@bitrix24/b24jssdk 0.4.5 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- (function(R,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(R=typeof globalThis<"u"?globalThis:R||self,I(R.B24Js=R.B24Js||{}))})(this,function(R){"use strict";var I=(r=>(r.desktop="desktop",r.log="log",r.info="info",r.warn="warn",r.error="error",r.trace="trace",r))(I||{});const xe=new Map;xe.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"]),xe.set("desktop",["%cDESKTOP","color: white; font-style: italic; background-color: #29619b; padding: 0 6px; border: 1px solid #29619b"]),xe.set("log",["%cLOG","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]),xe.set("info",["%cINFO","color: #fff; font-style: italic; background-color: #6b7f96; padding: 0 6px; border: 1px solid #6b7f96"]),xe.set("warn",["%cWARNING","color: #f0a74f; font-style: italic; padding: 0 6px; border: 1px solid #f0a74f"]),xe.set("error",["%cERROR","color: white; font-style: italic; background-color: #8a3232; padding: 0 6px; border: 1px solid #8a3232"]),xe.set("trace",["%cTRACE","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]);class ye{#e;#r={desktop:!0,log:!1,info:!1,warn:!1,error:!0,trace:!0};static build(e,t=!1){const n=new ye(e);return t&&(n.enable("log"),n.enable("info"),n.enable("warn")),n}constructor(e){this.#e=e}#t(e){const t=[],n=[];if(xe.has("title")){const s=xe.get("title");s[0]&&(t.push(s[0].replace("#title#",this.#e)),n.push(s[1]||""))}if(xe.has(e)){const s=xe.get(e);s[0]&&(t.push(s[0]),n.push(s[1]||""))}return[t.join(""),...n]}setConfig(e){for(const t in e)this.#r[t]=e[t]}enable(e){return typeof this.#r[e]>"u"?!1:(this.#r[e]=!0,!0)}disable(e){return typeof this.#r[e]>"u"?!1:(this.#r[e]=!1,!0)}isEnabled(e){return this.#r[e]}desktop(...e){this.isEnabled("desktop")&&console.log(...this.#t("desktop"),...e)}log(...e){this.isEnabled("log")&&console.log(...this.#t("log"),...e)}info(...e){this.isEnabled("info")&&console.info(...this.#t("info"),...e)}warn(...e){this.isEnabled("warn")&&console.warn(...this.#t("warn"),...e)}error(...e){this.isEnabled("error")&&console.error(...this.#t("error"),...e)}trace(...e){this.isEnabled("trace")&&console.trace(...this.#t("trace"),...e)}}var Gn=(r=>(r.undefined="undefined",r.any="any",r.integer="integer",r.boolean="boolean",r.double="double",r.date="date",r.datetime="datetime",r.string="string",r.text="text",r.file="file",r.array="array",r.object="object",r.user="user",r.location="location",r.crmCategory="crm_category",r.crmStatus="crm_status",r.crmCurrency="crm_currency",r))(Gn||{});const ra=Function.prototype.toString.call(Object);class na{getTag(e){return Object.prototype.toString.call(e)}isString(e){return typeof e=="string"||e instanceof String}isStringFilled(e){return this.isString(e)&&e!==""}isFunction(e){return e===null?!1:typeof e=="function"||e instanceof Function}isObject(e){return!!e&&(typeof e=="object"||typeof e=="function")}isObjectLike(e){return!!e&&typeof e=="object"}isPlainObject(e){if(!this.isObjectLike(e)||this.getTag(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=t.hasOwnProperty("constructor")&&t.constructor;return typeof n=="function"&&Function.prototype.toString.call(n)===ra}isJsonRpcRequest(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"method"in e&&this.isStringFilled(e.method)}isJsonRpcResponse(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"id"in e&&("result"in e||"error"in e)}isBoolean(e){return e===!0||e===!1}isNumber(e){return typeof e=="number"&&!Number.isNaN(e)}isInteger(e){return Number.isInteger(e)}isFloat(e){return this.isNumber(e)&&!this.isInteger(e)}isNil(e){return e==null}isArray(e){return!this.isNil(e)&&Array.isArray(e)}isArrayFilled(e){return this.isArray(e)&&e.length>0}isArrayLike(e){return!this.isNil(e)&&!this.isFunction(e)&&e.length>-1&&e.length<=Number.MAX_SAFE_INTEGER}isDate(e){return e instanceof Date}isDomNode(e){return this.isObjectLike(e)&&!this.isPlainObject(e)&&"nodeType"in e}isElementNode(e){return this.isDomNode(e)&&e.nodeType===Node.ELEMENT_NODE}isTextNode(e){return this.isDomNode(e)&&e.nodeType===Node.TEXT_NODE}isMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Map]"}isSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Set]"}isWeakMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakMap]"}isWeakSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakSet]"}isPrototype(e){return(typeof(e&&e.constructor)=="function"&&e.constructor.prototype||Object.prototype)===e}isRegExp(e){return this.isObjectLike(e)&&this.getTag(e)==="[object RegExp]"}isNull(e){return e===null}isUndefined(e){return typeof e>"u"}isArrayBuffer(e){return this.isObjectLike(e)&&this.getTag(e)==="[object ArrayBuffer]"}isTypedArray(e){const t=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)]$/;return this.isObjectLike(e)&&t.test(this.getTag(e))}isBlob(e){return this.isObjectLike(e)&&this.isNumber(e.size)&&this.isString(e.type)&&this.isFunction(e.slice)}isFile(e){return this.isBlob(e)&&this.isString(e.name)&&(this.isNumber(e.lastModified)||this.isObjectLike(e.lastModifiedDate))}isFormData(e){return typeof FormData<"u"&&e instanceof FormData?!0:this.isObjectLike(e)&&this.getTag(e)==="[object FormData]"}clone(e,t=!0){let n,s,i;if(this.isNil(e)||typeof e!="object")return e;if(this.isDomNode(e))n=e.cloneNode(t);else if(typeof e=="object")if(this.isArray(e))for(n=[],s=0,i=e.length;s<i;s++)typeof e[s]=="object"&&t?n[s]=this.clone(e[s],t):n[s]=e[s];else{n={},e.constructor&&(this.isDate(e)?n=new Date(e):n=new e.constructor);for(s in e)e.hasOwnProperty(s)&&(typeof e[s]=="object"&&t?n[s]=this.clone(e[s],t):n[s]=e[s])}else n=e;return n}}const C=new na;function sa(r,e){const t={};for(const n of e)t[n]=r[n];return t}function Yn(r,e){const t={...r};for(const n of e)delete t[n];return t}function ia(r){return Array.isArray(r[0])}function oa(r,e){return Object.values(r).includes(e)?e:void 0}class ft extends Error{}class aa extends ft{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class ca extends ft{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class la extends ft{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Et extends ft{}class Kn extends ft{constructor(e){super(`Invalid unit ${e}`)}}class we extends ft{}class nt extends ft{constructor(){super("Zone is an abstract class")}}const N="numeric",je="short",Ce="long",ir={year:N,month:N,day:N},Qn={year:N,month:je,day:N},ua={year:N,month:je,day:N,weekday:je},Xn={year:N,month:Ce,day:N},es={year:N,month:Ce,day:N,weekday:Ce},ts={hour:N,minute:N},rs={hour:N,minute:N,second:N},ns={hour:N,minute:N,second:N,timeZoneName:je},ss={hour:N,minute:N,second:N,timeZoneName:Ce},is={hour:N,minute:N,hourCycle:"h23"},os={hour:N,minute:N,second:N,hourCycle:"h23"},as={hour:N,minute:N,second:N,hourCycle:"h23",timeZoneName:je},cs={hour:N,minute:N,second:N,hourCycle:"h23",timeZoneName:Ce},ls={year:N,month:N,day:N,hour:N,minute:N},us={year:N,month:N,day:N,hour:N,minute:N,second:N},hs={year:N,month:je,day:N,hour:N,minute:N},fs={year:N,month:je,day:N,hour:N,minute:N,second:N},ha={year:N,month:je,day:N,weekday:je,hour:N,minute:N},ds={year:N,month:Ce,day:N,hour:N,minute:N,timeZoneName:je},ps={year:N,month:Ce,day:N,hour:N,minute:N,second:N,timeZoneName:je},ms={year:N,month:Ce,day:N,weekday:Ce,hour:N,minute:N,timeZoneName:Ce},gs={year:N,month:Ce,day:N,weekday:Ce,hour:N,minute:N,second:N,timeZoneName:Ce};class $t{get type(){throw new nt}get name(){throw new nt}get ianaName(){return this.name}get isUniversal(){throw new nt}offsetName(e,t){throw new nt}formatOffset(e,t){throw new nt}offset(e){throw new nt}equals(e){throw new nt}get isValid(){throw new nt}}let Br=null;class or extends $t{static get instance(){return Br===null&&(Br=new or),Br}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Ws(e,t,n)}formatOffset(e,t){return zt(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const Ur=new Map;function fa(r){let e=Ur.get(r);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Ur.set(r,e)),e}const da={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function pa(r,e){const t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,i,o,c,a,u,l]=n;return[o,s,i,c,a,u,l]}function ma(r,e){const t=r.formatToParts(e),n=[];for(let s=0;s<t.length;s++){const{type:i,value:o}=t[s],c=da[i];i==="era"?n[c]=o:W(c)||(n[c]=parseInt(o,10))}return n}const $r=new Map;class Ye extends $t{static create(e){let t=$r.get(e);return t===void 0&&$r.set(e,t=new Ye(e)),t}static resetCache(){$r.clear(),Ur.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=Ye.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Ws(e,t,n,this.name)}formatOffset(e,t){return zt(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const n=fa(this.name);let[s,i,o,c,a,u,l]=n.formatToParts?ma(n,t):pa(n,t);c==="BC"&&(s=-Math.abs(s)+1);const h=hr({year:s,month:i,day:o,hour:a===24?0:a,minute:u,second:l,millisecond:0});let d=+t;const p=d%1e3;return d-=p>=0?p:1e3+p,(h-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let ys={};function ga(r,e={}){const t=JSON.stringify([r,e]);let n=ys[t];return n||(n=new Intl.ListFormat(r,e),ys[t]=n),n}const Wr=new Map;function qr(r,e={}){const t=JSON.stringify([r,e]);let n=Wr.get(t);return n===void 0&&(n=new Intl.DateTimeFormat(r,e),Wr.set(t,n)),n}const Vr=new Map;function ya(r,e={}){const t=JSON.stringify([r,e]);let n=Vr.get(t);return n===void 0&&(n=new Intl.NumberFormat(r,e),Vr.set(t,n)),n}const zr=new Map;function wa(r,e={}){const{base:t,...n}=e,s=JSON.stringify([r,n]);let i=zr.get(s);return i===void 0&&(i=new Intl.RelativeTimeFormat(r,e),zr.set(s,i)),i}let Wt=null;function ba(){return Wt||(Wt=new Intl.DateTimeFormat().resolvedOptions().locale,Wt)}const Hr=new Map;function ws(r){let e=Hr.get(r);return e===void 0&&(e=new Intl.DateTimeFormat(r).resolvedOptions(),Hr.set(r,e)),e}const Jr=new Map;function Sa(r){let e=Jr.get(r);if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...bs,...e}),Jr.set(r,e)}return e}function _a(r){const e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));const t=r.indexOf("-u-");if(t===-1)return[r];{let n,s;try{n=qr(r).resolvedOptions(),s=r}catch{const a=r.substring(0,t);n=qr(a).resolvedOptions(),s=a}const{numberingSystem:i,calendar:o}=n;return[s,i,o]}}function ka(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function va(r){const e=[];for(let t=1;t<=12;t++){const n=B.utc(2009,t,1);e.push(r(n))}return e}function Ea(r){const e=[];for(let t=1;t<=7;t++){const n=B.utc(2016,11,13+t);e.push(r(n))}return e}function ar(r,e,t,n){const s=r.listingMode();return s==="error"?null:s==="en"?t(e):n(e)}function Ta(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||ws(r.locale).numberingSystem==="latn"}class Oa{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:s,floor:i,...o}=n;if(!t||Object.keys(o).length>0){const c={useGrouping:!1,...n};n.padTo>0&&(c.minimumIntegerDigits=n.padTo),this.inf=ya(e,c)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):rn(e,3);return le(t,this.padTo)}}}class Aa{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let s;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),c=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Ye.create(c).valid?(s=c,this.dt=e):(s="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,s=e.zone.name):(s="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||s,this.dtf=qr(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:n}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Ia{constructor(e,t,n){this.opts={style:"long",...n},!t&&js()&&(this.rtf=wa(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):Ya(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const bs={firstDay:1,minimalDays:4,weekend:[6,7]};class K{static fromOpts(e){return K.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,s,i=!1){const o=e||ne.defaultLocale,c=o||(i?"en-US":ba()),a=t||ne.defaultNumberingSystem,u=n||ne.defaultOutputCalendar,l=en(s)||ne.defaultWeekSettings;return new K(c,a,u,l,o)}static resetCache(){Wt=null,Wr.clear(),Vr.clear(),zr.clear(),Hr.clear(),Jr.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:s}={}){return K.create(e,t,n,s)}constructor(e,t,n,s,i){const[o,c,a]=_a(e);this.locale=o,this.numberingSystem=t||c||null,this.outputCalendar=n||a||null,this.weekSettings=s,this.intl=ka(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Ta(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:K.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,en(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return ar(this,e,zs,()=>{const n=t?{month:e,day:"numeric"}:{month:e},s=t?"format":"standalone";return this.monthsCache[s][e]||(this.monthsCache[s][e]=va(i=>this.extract(i,n,"month"))),this.monthsCache[s][e]})}weekdays(e,t=!1){return ar(this,e,Zs,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},s=t?"format":"standalone";return this.weekdaysCache[s][e]||(this.weekdaysCache[s][e]=Ea(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[s][e]})}meridiems(){return ar(this,void 0,()=>Gs,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[B.utc(2016,11,13,9),B.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return ar(this,e,Ys,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[B.utc(-40,1,1),B.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){const s=this.dtFormatter(e,t),i=s.formatToParts(),o=i.find(c=>c.type.toLowerCase()===n);return o?o.value:null}numberFormatter(e={}){return new Oa(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Aa(e,this.intl,t)}relFormatter(e={}){return new Ia(this.intl,this.isEnglish(),e)}listFormatter(e={}){return ga(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||ws(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Bs()?Sa(this.locale):bs}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Zr=null;class Ee extends $t{static get utcInstance(){return Zr===null&&(Zr=new Ee(0)),Zr}static instance(e){return e===0?Ee.utcInstance:new Ee(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Ee(fr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${zt(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${zt(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return zt(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Ca extends $t{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function st(r,e){if(W(r)||r===null)return e;if(r instanceof $t)return r;if(Ma(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?or.instance:t==="utc"||t==="gmt"?Ee.utcInstance:Ee.parseSpecifier(t)||Ye.create(r)}else return it(r)?Ee.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new Ca(r)}const Gr={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"},Ss={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]},Na=Gr.hanidec.replace(/[\[|\]]/g,"").split("");function Ra(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){const n=r.charCodeAt(t);if(r[t].search(Gr.hanidec)!==-1)e+=Na.indexOf(r[t]);else for(const s in Ss){const[i,o]=Ss[s];n>=i&&n<=o&&(e+=n-i)}}return parseInt(e,10)}else return e}const Yr=new Map;function La(){Yr.clear()}function Be({numberingSystem:r},e=""){const t=r||"latn";let n=Yr.get(t);n===void 0&&(n=new Map,Yr.set(t,n));let s=n.get(e);return s===void 0&&(s=new RegExp(`${Gr[t]}${e}`),n.set(e,s)),s}let _s=()=>Date.now(),ks="system",vs=null,Es=null,Ts=null,Os=60,As,Is=null;class ne{static get now(){return _s}static set now(e){_s=e}static set defaultZone(e){ks=e}static get defaultZone(){return st(ks,or.instance)}static get defaultLocale(){return vs}static set defaultLocale(e){vs=e}static get defaultNumberingSystem(){return Es}static set defaultNumberingSystem(e){Es=e}static get defaultOutputCalendar(){return Ts}static set defaultOutputCalendar(e){Ts=e}static get defaultWeekSettings(){return Is}static set defaultWeekSettings(e){Is=en(e)}static get twoDigitCutoffYear(){return Os}static set twoDigitCutoffYear(e){Os=e%100}static get throwOnInvalid(){return As}static set throwOnInvalid(e){As=e}static resetCaches(){K.resetCache(),Ye.resetCache(),B.resetCache(),La()}}class Ue{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Cs=[0,31,59,90,120,151,181,212,243,273,304,334],Ns=[0,31,60,91,121,152,182,213,244,274,305,335];function De(r,e){return new Ue("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function Kr(r,e,t){const n=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const s=n.getUTCDay();return s===0?7:s}function Rs(r,e,t){return t+(qt(r)?Ns:Cs)[e-1]}function Ls(r,e){const t=qt(r)?Ns:Cs,n=t.findIndex(i=>i<e),s=e-t[n];return{month:n+1,day:s}}function Qr(r,e){return(r-e+7)%7+1}function cr(r,e=4,t=1){const{year:n,month:s,day:i}=r,o=Rs(n,s,i),c=Qr(Kr(n,s,i),t);let a=Math.floor((o-c+14-e)/7),u;return a<1?(u=n-1,a=Vt(u,e,t)):a>Vt(n,e,t)?(u=n+1,a=1):u=n,{weekYear:u,weekNumber:a,weekday:c,...pr(r)}}function Ds(r,e=4,t=1){const{weekYear:n,weekNumber:s,weekday:i}=r,o=Qr(Kr(n,1,e),t),c=Ot(n);let a=s*7+i-o-7+e,u;a<1?(u=n-1,a+=Ot(u)):a>c?(u=n+1,a-=Ot(n)):u=n;const{month:l,day:f}=Ls(u,a);return{year:u,month:l,day:f,...pr(r)}}function Xr(r){const{year:e,month:t,day:n}=r,s=Rs(e,t,n);return{year:e,ordinal:s,...pr(r)}}function Ps(r){const{year:e,ordinal:t}=r,{month:n,day:s}=Ls(e,t);return{year:e,month:n,day:s,...pr(r)}}function Ms(r,e){if(!W(r.localWeekday)||!W(r.localWeekNumber)||!W(r.localWeekYear)){if(!W(r.weekday)||!W(r.weekNumber)||!W(r.weekYear))throw new Et("Cannot mix locale-based week fields with ISO-based week fields");return W(r.localWeekday)||(r.weekday=r.localWeekday),W(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),W(r.localWeekYear)||(r.weekYear=r.localWeekYear),delete r.localWeekday,delete r.localWeekNumber,delete r.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Da(r,e=4,t=1){const n=lr(r.weekYear),s=Pe(r.weekNumber,1,Vt(r.weekYear,e,t)),i=Pe(r.weekday,1,7);return n?s?i?!1:De("weekday",r.weekday):De("week",r.weekNumber):De("weekYear",r.weekYear)}function Pa(r){const e=lr(r.year),t=Pe(r.ordinal,1,Ot(r.year));return e?t?!1:De("ordinal",r.ordinal):De("year",r.year)}function Fs(r){const e=lr(r.year),t=Pe(r.month,1,12),n=Pe(r.day,1,ur(r.year,r.month));return e?t?n?!1:De("day",r.day):De("month",r.month):De("year",r.year)}function xs(r){const{hour:e,minute:t,second:n,millisecond:s}=r,i=Pe(e,0,23)||e===24&&t===0&&n===0&&s===0,o=Pe(t,0,59),c=Pe(n,0,59),a=Pe(s,0,999);return i?o?c?a?!1:De("millisecond",s):De("second",n):De("minute",t):De("hour",e)}function W(r){return typeof r>"u"}function it(r){return typeof r=="number"}function lr(r){return typeof r=="number"&&r%1===0}function Ma(r){return typeof r=="string"}function Fa(r){return Object.prototype.toString.call(r)==="[object Date]"}function js(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Bs(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function xa(r){return Array.isArray(r)?r:[r]}function Us(r,e,t){if(r.length!==0)return r.reduce((n,s)=>{const i=[e(s),s];return n&&t(n[0],i[0])===n[0]?n:i},null)[1]}function ja(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function Tt(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function en(r){if(r==null)return null;if(typeof r!="object")throw new we("Week settings must be an object");if(!Pe(r.firstDay,1,7)||!Pe(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!Pe(e,1,7)))throw new we("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function Pe(r,e,t){return lr(r)&&r>=e&&r<=t}function Ba(r,e){return r-e*Math.floor(r/e)}function le(r,e=2){const t=r<0;let n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function ot(r){if(!(W(r)||r===null||r===""))return parseInt(r,10)}function dt(r){if(!(W(r)||r===null||r===""))return parseFloat(r)}function tn(r){if(!(W(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function rn(r,e,t=!1){const n=10**e;return(t?Math.trunc:Math.round)(r*n)/n}function qt(r){return r%4===0&&(r%100!==0||r%400===0)}function Ot(r){return qt(r)?366:365}function ur(r,e){const t=Ba(e-1,12)+1,n=r+(e-t)/12;return t===2?qt(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function hr(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}function $s(r,e,t){return-Qr(Kr(r,1,e),t)+e-1}function Vt(r,e=4,t=1){const n=$s(r,e,t),s=$s(r+1,e,t);return(Ot(r)-n+s)/7}function nn(r){return r>99?r:r>ne.twoDigitCutoffYear?1900+r:2e3+r}function Ws(r,e,t,n=null){const s=new Date(r),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(i.timeZone=n);const o={timeZoneName:e,...i},c=new Intl.DateTimeFormat(t,o).formatToParts(s).find(a=>a.type.toLowerCase()==="timezonename");return c?c.value:null}function fr(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const n=parseInt(e,10)||0,s=t<0||Object.is(t,-0)?-n:n;return t*60+s}function qs(r){const e=Number(r);if(typeof r=="boolean"||r===""||Number.isNaN(e))throw new we(`Invalid unit value ${r}`);return e}function dr(r,e){const t={};for(const n in r)if(Tt(r,n)){const s=r[n];if(s==null)continue;t[e(n)]=qs(s)}return t}function zt(r,e){const t=Math.trunc(Math.abs(r/60)),n=Math.trunc(Math.abs(r%60)),s=r>=0?"+":"-";switch(e){case"short":return`${s}${le(t,2)}:${le(n,2)}`;case"narrow":return`${s}${t}${n>0?`:${n}`:""}`;case"techie":return`${s}${le(t,2)}${le(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function pr(r){return ja(r,["hour","minute","second","millisecond"])}const Ua=["January","February","March","April","May","June","July","August","September","October","November","December"],Vs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],$a=["J","F","M","A","M","J","J","A","S","O","N","D"];function zs(r){switch(r){case"narrow":return[...$a];case"short":return[...Vs];case"long":return[...Ua];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 Hs=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Js=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Wa=["M","T","W","T","F","S","S"];function Zs(r){switch(r){case"narrow":return[...Wa];case"short":return[...Js];case"long":return[...Hs];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Gs=["AM","PM"],qa=["Before Christ","Anno Domini"],Va=["BC","AD"],za=["B","A"];function Ys(r){switch(r){case"narrow":return[...za];case"short":return[...Va];case"long":return[...qa];default:return null}}function Ha(r){return Gs[r.hour<12?0:1]}function Ja(r,e){return Zs(e)[r.weekday-1]}function Za(r,e){return zs(e)[r.month-1]}function Ga(r,e){return Ys(e)[r.year<0?0:1]}function Ya(r,e,t="always",n=!1){const s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&i){const f=r==="days";switch(e){case 1:return f?"tomorrow":`next ${s[r][0]}`;case-1:return f?"yesterday":`last ${s[r][0]}`;case 0:return f?"today":`this ${s[r][0]}`}}const o=Object.is(e,-0)||e<0,c=Math.abs(e),a=c===1,u=s[r],l=n?a?u[1]:u[2]||u[1]:a?s[r][0]:r;return o?`${c} ${l} ago`:`in ${c} ${l}`}function Ks(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const Ka={D:ir,DD:Qn,DDD:Xn,DDDD:es,t:ts,tt:rs,ttt:ns,tttt:ss,T:is,TT:os,TTT:as,TTTT:cs,f:ls,ff:hs,fff:ds,ffff:ms,F:us,FF:fs,FFF:ps,FFFF:gs};class be{static create(e,t={}){return new be(e,t)}static parseFormat(e){let t=null,n="",s=!1;const i=[];for(let o=0;o<e.length;o++){const c=e.charAt(o);c==="'"?(n.length>0&&i.push({literal:s||/^\s+$/.test(n),val:n}),t=null,n="",s=!s):s||c===t?n+=c:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=c,t=c)}return n.length>0&&i.push({literal:s||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return Ka[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return le(e,t);const n={...this.opts};return t>0&&(n.padTo=t),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const n=this.loc.listingMode()==="en",s=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(d,p)=>this.loc.extract(e,d,p),o=d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"",c=()=>n?Ha(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(d,p)=>n?Za(e,d):i(p?{month:d}:{month:d,day:"numeric"},"month"),u=(d,p)=>n?Ja(e,d):i(p?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),l=d=>{const p=be.macroTokenToFormatOpts(d);return p?this.formatWithSystemDefault(e,p):d},f=d=>n?Ga(e,d):i({era:d},"era"),h=d=>{switch(d){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return c();case"d":return s?i({day:"numeric"},"day"):this.num(e.day);case"dd":return s?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return s?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return s?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return s?i({month:"numeric"},"month"):this.num(e.month);case"MM":return s?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return s?i({year:"numeric"},"year"):this.num(e.year);case"yy":return s?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return s?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return s?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return l(d)}};return Ks(be.parseFormat(t),h)}formatDurationFromString(e,t){const n=a=>{switch(a[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},s=a=>u=>{const l=n(u);return l?this.num(a.get(l),u.length):u},i=be.parseFormat(t),o=i.reduce((a,{literal:u,val:l})=>u?a:a.concat(l),[]),c=e.shiftTo(...o.map(n).filter(a=>a));return Ks(i,s(c))}}const Qs=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function At(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function It(...r){return e=>r.reduce(([t,n,s],i)=>{const[o,c,a]=i(e,s);return[{...t,...o},c||n,a]},[{},null,1]).slice(0,2)}function Ct(r,...e){if(r==null)return[null,null];for(const[t,n]of e){const s=t.exec(r);if(s)return n(s)}return[null,null]}function Xs(...r){return(e,t)=>{const n={};let s;for(s=0;s<r.length;s++)n[r[s]]=ot(e[t+s]);return[n,null,t+s]}}const ei=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Qa=`(?:${ei.source}?(?:\\[(${Qs.source})\\])?)?`,sn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ti=RegExp(`${sn.source}${Qa}`),on=RegExp(`(?:T${ti.source})?`),Xa=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,ec=/(\d{4})-?W(\d\d)(?:-?(\d))?/,tc=/(\d{4})-?(\d{3})/,rc=Xs("weekYear","weekNumber","weekDay"),nc=Xs("year","ordinal"),sc=/(\d{4})-(\d\d)-(\d\d)/,ri=RegExp(`${sn.source} ?(?:${ei.source}|(${Qs.source}))?`),ic=RegExp(`(?: ${ri.source})?`);function Nt(r,e,t){const n=r[e];return W(n)?t:ot(n)}function oc(r,e){return[{year:Nt(r,e),month:Nt(r,e+1,1),day:Nt(r,e+2,1)},null,e+3]}function Rt(r,e){return[{hours:Nt(r,e,0),minutes:Nt(r,e+1,0),seconds:Nt(r,e+2,0),milliseconds:tn(r[e+3])},null,e+4]}function Ht(r,e){const t=!r[e]&&!r[e+1],n=fr(r[e+1],r[e+2]),s=t?null:Ee.instance(n);return[{},s,e+3]}function Jt(r,e){const t=r[e]?Ye.create(r[e]):null;return[{},t,e+1]}const ac=RegExp(`^T?${sn.source}$`),cc=/^-?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 lc(r){const[e,t,n,s,i,o,c,a,u]=r,l=e[0]==="-",f=a&&a[0]==="-",h=(d,p=!1)=>d!==void 0&&(p||d&&l)?-d:d;return[{years:h(dt(t)),months:h(dt(n)),weeks:h(dt(s)),days:h(dt(i)),hours:h(dt(o)),minutes:h(dt(c)),seconds:h(dt(a),a==="-0"),milliseconds:h(tn(u),f)}]}const uc={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 an(r,e,t,n,s,i,o){const c={year:e.length===2?nn(ot(e)):ot(e),month:Vs.indexOf(t)+1,day:ot(n),hour:ot(s),minute:ot(i)};return o&&(c.second=ot(o)),r&&(c.weekday=r.length>3?Hs.indexOf(r)+1:Js.indexOf(r)+1),c}const hc=/^(?:(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 fc(r){const[,e,t,n,s,i,o,c,a,u,l,f]=r,h=an(e,s,n,t,i,o,c);let d;return a?d=uc[a]:u?d=0:d=fr(l,f),[h,new Ee(d)]}function dc(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const pc=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,mc=/^(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$/,gc=/^(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 ni(r){const[,e,t,n,s,i,o,c]=r;return[an(e,s,n,t,i,o,c),Ee.utcInstance]}function yc(r){const[,e,t,n,s,i,o,c]=r;return[an(e,c,t,n,s,i,o),Ee.utcInstance]}const wc=At(Xa,on),bc=At(ec,on),Sc=At(tc,on),_c=At(ti),si=It(oc,Rt,Ht,Jt),kc=It(rc,Rt,Ht,Jt),vc=It(nc,Rt,Ht,Jt),Ec=It(Rt,Ht,Jt);function Tc(r){return Ct(r,[wc,si],[bc,kc],[Sc,vc],[_c,Ec])}function Oc(r){return Ct(dc(r),[hc,fc])}function Ac(r){return Ct(r,[pc,ni],[mc,ni],[gc,yc])}function Ic(r){return Ct(r,[cc,lc])}const Cc=It(Rt);function Nc(r){return Ct(r,[ac,Cc])}const Rc=At(sc,ic),Lc=At(ri),Dc=It(Rt,Ht,Jt);function Pc(r){return Ct(r,[Rc,si],[Lc,Dc])}const ii="Invalid Duration",oi={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}},Mc={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},...oi},Me=146097/400,Lt=146097/4800,Fc={years:{quarters:4,months:12,weeks:Me/7,days:Me,hours:Me*24,minutes:Me*24*60,seconds:Me*24*60*60,milliseconds:Me*24*60*60*1e3},quarters:{months:3,weeks:Me/28,days:Me/4,hours:Me*24/4,minutes:Me*24*60/4,seconds:Me*24*60*60/4,milliseconds:Me*24*60*60*1e3/4},months:{weeks:Lt/7,days:Lt,hours:Lt*24,minutes:Lt*24*60,seconds:Lt*24*60*60,milliseconds:Lt*24*60*60*1e3},...oi},pt=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],xc=pt.slice(0).reverse();function at(r,e,t=!1){const n={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new Z(n)}function ai(r,e){let t=e.milliseconds??0;for(const n of xc.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function ci(r,e){const t=ai(r,e)<0?-1:1;pt.reduceRight((n,s)=>{if(W(e[s]))return n;if(n){const i=e[n]*t,o=r[s][n],c=Math.floor(i/o);e[s]+=c*t,e[n]-=c*o*t}return s},null),pt.reduce((n,s)=>{if(W(e[s]))return n;if(n){const i=e[n]%1;e[n]-=i,e[s]+=i*r[n][s]}return s},null)}function jc(r){const e={};for(const[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}class Z{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let n=t?Fc:Mc;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||K.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return Z.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new we(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new Z({values:dr(e,Z.normalizeUnit),loc:K.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(it(e))return Z.fromMillis(e);if(Z.isDuration(e))return e;if(typeof e=="object")return Z.fromObject(e);throw new we(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=Ic(e);return n?Z.fromObject(n,t):Z.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=Nc(e);return n?Z.fromObject(n,t):Z.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new we("need to specify a reason the Duration is invalid");const n=e instanceof Ue?e:new Ue(e,t);if(ne.throwOnInvalid)throw new la(n);return new Z({invalid:n})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Kn(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?be.create(this.loc,n).formatDurationFromString(this,e):ii}toHuman(e={}){if(!this.isValid)return ii;const t=pt.map(n=>{const s=this.values[n];return W(s)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(s)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=rn(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},B.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?ai(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Z.fromDurationLike(e),n={};for(const s of pt)(Tt(t.values,s)||Tt(this.values,s))&&(n[s]=t.get(s)+this.get(s));return at(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=Z.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=qs(e(this.values[n],n));return at(this,{values:t},!0)}get(e){return this[Z.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...dr(e,Z.normalizeUnit)};return at(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:s}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:s,conversionAccuracy:n};return at(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return ci(this.matrix,e),at(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=jc(this.normalize().shiftToAll().toObject());return at(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>Z.normalizeUnit(o));const t={},n={},s=this.toObject();let i;for(const o of pt)if(e.indexOf(o)>=0){i=o;let c=0;for(const u in n)c+=this.matrix[u][o]*n[u],n[u]=0;it(s[o])&&(c+=s[o]);const a=Math.trunc(c);t[o]=a,n[o]=(c*1e3-a*1e3)/1e3}else it(s[o])&&(n[o]=s[o]);for(const o in n)n[o]!==0&&(t[i]+=o===i?n[o]:n[o]/this.matrix[i][o]);return ci(this.matrix,t),at(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return at(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(n,s){return n===void 0||n===0?s===void 0||s===0:n===s}for(const n of pt)if(!t(this.values[n],e.values[n]))return!1;return!0}}const Dt="Invalid Interval";function Bc(r,e){return!r||!r.isValid?se.invalid("missing or invalid start"):!e||!e.isValid?se.invalid("missing or invalid end"):e<r?se.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}class se{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new we("need to specify a reason the Interval is invalid");const n=e instanceof Ue?e:new Ue(e,t);if(ne.throwOnInvalid)throw new ca(n);return new se({invalid:n})}static fromDateTimes(e,t){const n=Yt(e),s=Yt(t),i=Bc(n,s);return i??new se({start:n,end:s})}static after(e,t){const n=Z.fromDurationLike(t),s=Yt(e);return se.fromDateTimes(s,s.plus(n))}static before(e,t){const n=Z.fromDurationLike(t),s=Yt(e);return se.fromDateTimes(s.minus(n),s)}static fromISO(e,t){const[n,s]=(e||"").split("/",2);if(n&&s){let i,o;try{i=B.fromISO(n,t),o=i.isValid}catch{o=!1}let c,a;try{c=B.fromISO(s,t),a=c.isValid}catch{a=!1}if(o&&a)return se.fromDateTimes(i,c);if(o){const u=Z.fromISO(s,t);if(u.isValid)return se.after(i,u)}else if(a){const u=Z.fromISO(n,t);if(u.isValid)return se.before(c,u)}}return se.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const n=this.start.startOf(e,t);let s;return t?.useLocaleWeeks?s=this.end.reconfigure({locale:n.locale}):s=this.end,s=s.startOf(e,t),Math.floor(s.diff(n,e).get(e))+(s.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?se.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Yt).filter(o=>this.contains(o)).sort((o,c)=>o.toMillis()-c.toMillis()),n=[];let{s}=this,i=0;for(;s<this.e;){const o=t[i]||this.e,c=+o>+this.e?this.e:o;n.push(se.fromDateTimes(s,c)),s=c,i+=1}return n}splitBy(e){const t=Z.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,s=1,i;const o=[];for(;n<this.e;){const c=this.start.plus(t.mapUnits(a=>a*s));i=+c>+this.e?this.e:c,o.push(se.fromDateTimes(n,i)),n=i,s+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:se.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return se.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((s,i)=>s.s-i.s).reduce(([s,i],o)=>i?i.overlaps(o)||i.abutsStart(o)?[s,i.union(o)]:[s.concat([i]),o]:[s,o],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const s=[],i=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...i),c=o.sort((a,u)=>a.time-u.time);for(const a of c)n+=a.type==="s"?1:-1,n===1?t=a.time:(t&&+t!=+a.time&&s.push(se.fromDateTimes(t,a.time)),t=null);return se.merge(s)}difference(...e){return se.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Dt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=ir,t={}){return this.isValid?be.create(this.s.loc.clone(t),e).formatInterval(this):Dt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Dt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Dt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Dt}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Dt}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Z.invalid(this.invalidReason)}mapEndpoints(e){return se.fromDateTimes(e(this.s),e(this.e))}}class mr{static hasDST(e=ne.defaultZone){const t=B.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Ye.isValidZone(e)}static normalizeZone(e){return st(e,ne.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||K.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||K.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||K.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||K.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||K.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null}={}){return(s||K.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null}={}){return(s||K.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return K.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return K.create(t,null,"gregory").eras(e)}static features(){return{relative:js(),localeWeek:Bs()}}}function li(r,e){const t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(Z.fromMillis(n).as("days"))}function Uc(r,e,t){const n=[["years",(a,u)=>u.year-a.year],["quarters",(a,u)=>u.quarter-a.quarter+(u.year-a.year)*4],["months",(a,u)=>u.month-a.month+(u.year-a.year)*12],["weeks",(a,u)=>{const l=li(a,u);return(l-l%7)/7}],["days",li]],s={},i=r;let o,c;for(const[a,u]of n)t.indexOf(a)>=0&&(o=a,s[a]=u(r,e),c=i.plus(s),c>e?(s[a]--,r=i.plus(s),r>e&&(c=r,s[a]--,r=i.plus(s))):r=c);return[r,s,c,o]}function $c(r,e,t,n){let[s,i,o,c]=Uc(r,e,t);const a=e-s,u=t.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);u.length===0&&(o<e&&(o=s.plus({[c]:1})),o!==s&&(i[c]=(i[c]||0)+a/(o-s)));const l=Z.fromObject(i,n);return u.length>0?Z.fromMillis(a,n).shiftTo(...u).plus(l):l}const Wc="missing Intl.DateTimeFormat.formatToParts support";function Y(r,e=t=>t){return{regex:r,deser:([t])=>e(Ra(t))}}const ui="[ \xA0]",hi=new RegExp(ui,"g");function qc(r){return r.replace(/\./g,"\\.?").replace(hi,ui)}function fi(r){return r.replace(/\./g,"").replace(hi," ").toLowerCase()}function $e(r,e){return r===null?null:{regex:RegExp(r.map(qc).join("|")),deser:([t])=>r.findIndex(n=>fi(t)===fi(n))+e}}function di(r,e){return{regex:r,deser:([,t,n])=>fr(t,n),groups:e}}function gr(r){return{regex:r,deser:([e])=>e}}function Vc(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function zc(r,e){const t=Be(e),n=Be(e,"{2}"),s=Be(e,"{3}"),i=Be(e,"{4}"),o=Be(e,"{6}"),c=Be(e,"{1,2}"),a=Be(e,"{1,3}"),u=Be(e,"{1,6}"),l=Be(e,"{1,9}"),f=Be(e,"{2,4}"),h=Be(e,"{4,6}"),d=g=>({regex:RegExp(Vc(g.val)),deser:([y])=>y,literal:!0}),m=(g=>{if(r.literal)return d(g);switch(g.val){case"G":return $e(e.eras("short"),0);case"GG":return $e(e.eras("long"),0);case"y":return Y(u);case"yy":return Y(f,nn);case"yyyy":return Y(i);case"yyyyy":return Y(h);case"yyyyyy":return Y(o);case"M":return Y(c);case"MM":return Y(n);case"MMM":return $e(e.months("short",!0),1);case"MMMM":return $e(e.months("long",!0),1);case"L":return Y(c);case"LL":return Y(n);case"LLL":return $e(e.months("short",!1),1);case"LLLL":return $e(e.months("long",!1),1);case"d":return Y(c);case"dd":return Y(n);case"o":return Y(a);case"ooo":return Y(s);case"HH":return Y(n);case"H":return Y(c);case"hh":return Y(n);case"h":return Y(c);case"mm":return Y(n);case"m":return Y(c);case"q":return Y(c);case"qq":return Y(n);case"s":return Y(c);case"ss":return Y(n);case"S":return Y(a);case"SSS":return Y(s);case"u":return gr(l);case"uu":return gr(c);case"uuu":return Y(t);case"a":return $e(e.meridiems(),0);case"kkkk":return Y(i);case"kk":return Y(f,nn);case"W":return Y(c);case"WW":return Y(n);case"E":case"c":return Y(t);case"EEE":return $e(e.weekdays("short",!1),1);case"EEEE":return $e(e.weekdays("long",!1),1);case"ccc":return $e(e.weekdays("short",!0),1);case"cccc":return $e(e.weekdays("long",!0),1);case"Z":case"ZZ":return di(new RegExp(`([+-]${c.source})(?::(${n.source}))?`),2);case"ZZZ":return di(new RegExp(`([+-]${c.source})(${n.source})?`),2);case"z":return gr(/[a-z_+-/]{1,256}?/i);case" ":return gr(/[^\S\n\r]/);default:return d(g)}})(r)||{invalidReason:Wc};return m.token=r,m}const Hc={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 Jc(r,e,t){const{type:n,value:s}=r;if(n==="literal"){const a=/^\s+$/.test(s);return{literal:!a,val:a?" ":s}}const i=e[n];let o=n;n==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let c=Hc[o];if(typeof c=="object"&&(c=c[i]),c)return{literal:!1,val:c}}function Zc(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function Gc(r,e,t){const n=r.match(e);if(n){const s={};let i=1;for(const o in t)if(Tt(t,o)){const c=t[o],a=c.groups?c.groups+1:1;!c.literal&&c.token&&(s[c.token.val[0]]=c.deser(n.slice(i,i+a))),i+=a}return[n,s]}else return[n,{}]}function Yc(r){const e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,n;return W(r.z)||(t=Ye.create(r.z)),W(r.Z)||(t||(t=new Ee(r.Z)),n=r.Z),W(r.q)||(r.M=(r.q-1)*3+1),W(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),W(r.u)||(r.S=tn(r.u)),[Object.keys(r).reduce((i,o)=>{const c=e(o);return c&&(i[c]=r[o]),i},{}),t,n]}let cn=null;function Kc(){return cn||(cn=B.fromMillis(1555555555555)),cn}function Qc(r,e){if(r.literal)return r;const t=be.macroTokenToFormatOpts(r.val),n=yi(t,e);return n==null||n.includes(void 0)?r:n}function pi(r,e){return Array.prototype.concat(...r.map(t=>Qc(t,e)))}class mi{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=pi(be.parseFormat(t),e),this.units=this.tokens.map(n=>zc(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,s]=Zc(this.units);this.regex=RegExp(n,"i"),this.handlers=s}}explainFromTokens(e){if(this.isValid){const[t,n]=Gc(e,this.regex,this.handlers),[s,i,o]=n?Yc(n):[null,null,void 0];if(Tt(n,"a")&&Tt(n,"H"))throw new Et("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:s,zone:i,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function gi(r,e,t){return new mi(r,t).explainFromTokens(e)}function Xc(r,e,t){const{result:n,zone:s,specificOffset:i,invalidReason:o}=gi(r,e,t);return[n,s,i,o]}function yi(r,e){if(!r)return null;const n=be.create(e,r).dtFormatter(Kc()),s=n.formatToParts(),i=n.resolvedOptions();return s.map(o=>Jc(o,r,i))}const ln="Invalid DateTime",el=864e13;function Zt(r){return new Ue("unsupported zone",`the zone "${r.name}" is not supported`)}function un(r){return r.weekData===null&&(r.weekData=cr(r.c)),r.weekData}function hn(r){return r.localWeekData===null&&(r.localWeekData=cr(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function mt(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new B({...t,...e,old:t})}function wi(r,e,t){let n=r-e*60*1e3;const s=t.offset(n);if(e===s)return[n,e];n-=(s-e)*60*1e3;const i=t.offset(n);return s===i?[n,s]:[r-Math.min(s,i)*60*1e3,Math.max(s,i)]}function yr(r,e){r+=e*60*1e3;const t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function wr(r,e,t){return wi(hr(r),e,t)}function bi(r,e){const t=r.o,n=r.c.year+Math.trunc(e.years),s=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...r.c,year:n,month:s,day:Math.min(r.c.day,ur(n,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=Z.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),c=hr(i);let[a,u]=wi(c,t,r.zone);return o!==0&&(a+=o,u=r.zone.offset(a)),{ts:a,o:u}}function Pt(r,e,t,n,s,i){const{setZone:o,zone:c}=t;if(r&&Object.keys(r).length!==0||e){const a=e||c,u=B.fromObject(r,{...t,zone:a,specificOffset:i});return o?u:u.setZone(c)}else return B.invalid(new Ue("unparsable",`the input "${s}" can't be parsed as ${n}`))}function br(r,e,t=!0){return r.isValid?be.create(K.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function fn(r,e){const t=r.c.year>9999||r.c.year<0;let n="";return t&&r.c.year>=0&&(n+="+"),n+=le(r.c.year,t?6:4),e?(n+="-",n+=le(r.c.month),n+="-",n+=le(r.c.day)):(n+=le(r.c.month),n+=le(r.c.day)),n}function Si(r,e,t,n,s,i){let o=le(r.c.hour);return e?(o+=":",o+=le(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(o+=":")):o+=le(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(o+=le(r.c.second),(r.c.millisecond!==0||!n)&&(o+=".",o+=le(r.c.millisecond,3))),s&&(r.isOffsetFixed&&r.offset===0&&!i?o+="Z":r.o<0?(o+="-",o+=le(Math.trunc(-r.o/60)),o+=":",o+=le(Math.trunc(-r.o%60))):(o+="+",o+=le(Math.trunc(r.o/60)),o+=":",o+=le(Math.trunc(r.o%60)))),i&&(o+="["+r.zone.ianaName+"]"),o}const _i={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},tl={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},rl={ordinal:1,hour:0,minute:0,second:0,millisecond:0},ki=["year","month","day","hour","minute","second","millisecond"],nl=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],sl=["year","ordinal","hour","minute","second","millisecond"];function il(r){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new Kn(r);return e}function vi(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return il(r)}}function ol(r){if(Gt===void 0&&(Gt=ne.now()),r.type!=="iana")return r.offset(Gt);const e=r.name;let t=dn.get(e);return t===void 0&&(t=r.offset(Gt),dn.set(e,t)),t}function Ei(r,e){const t=st(e.zone,ne.defaultZone);if(!t.isValid)return B.invalid(Zt(t));const n=K.fromObject(e);let s,i;if(W(r.year))s=ne.now();else{for(const a of ki)W(r[a])&&(r[a]=_i[a]);const o=Fs(r)||xs(r);if(o)return B.invalid(o);const c=ol(t);[s,i]=wr(r,c,t)}return new B({ts:s,zone:t,loc:n,o:i})}function Ti(r,e,t){const n=W(t.round)?!0:t.round,s=(o,c)=>(o=rn(o,n||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(o,c)),i=o=>t.calendary?e.hasSame(r,o)?0:e.startOf(o).diff(r.startOf(o),o).get(o):e.diff(r,o).get(o);if(t.unit)return s(i(t.unit),t.unit);for(const o of t.units){const c=i(o);if(Math.abs(c)>=1)return s(c,o)}return s(r>e?-0:0,t.units[t.units.length-1])}function Oi(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}let Gt;const dn=new Map;class B{constructor(e){const t=e.zone||ne.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Ue("invalid input"):null)||(t.isValid?null:Zt(t));this.ts=W(e.ts)?ne.now():e.ts;let s=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[s,i]=[e.old.c,e.old.o];else{const c=it(e.o)&&!e.old?e.o:t.offset(this.ts);s=yr(this.ts,c),n=Number.isNaN(s.year)?new Ue("invalid input"):null,s=n?null:s,i=n?null:c}this._zone=t,this.loc=e.loc||K.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=s,this.o=i,this.isLuxonDateTime=!0}static now(){return new B({})}static local(){const[e,t]=Oi(arguments),[n,s,i,o,c,a,u]=t;return Ei({year:n,month:s,day:i,hour:o,minute:c,second:a,millisecond:u},e)}static utc(){const[e,t]=Oi(arguments),[n,s,i,o,c,a,u]=t;return e.zone=Ee.utcInstance,Ei({year:n,month:s,day:i,hour:o,minute:c,second:a,millisecond:u},e)}static fromJSDate(e,t={}){const n=Fa(e)?e.valueOf():NaN;if(Number.isNaN(n))return B.invalid("invalid input");const s=st(t.zone,ne.defaultZone);return s.isValid?new B({ts:n,zone:s,loc:K.fromObject(t)}):B.invalid(Zt(s))}static fromMillis(e,t={}){if(it(e))return e<-864e13||e>el?B.invalid("Timestamp out of range"):new B({ts:e,zone:st(t.zone,ne.defaultZone),loc:K.fromObject(t)});throw new we(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(it(e))return new B({ts:e*1e3,zone:st(t.zone,ne.defaultZone),loc:K.fromObject(t)});throw new we("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=st(t.zone,ne.defaultZone);if(!n.isValid)return B.invalid(Zt(n));const s=K.fromObject(t),i=dr(e,vi),{minDaysInFirstWeek:o,startOfWeek:c}=Ms(i,s),a=ne.now(),u=W(t.specificOffset)?n.offset(a):t.specificOffset,l=!W(i.ordinal),f=!W(i.year),h=!W(i.month)||!W(i.day),d=f||h,p=i.weekYear||i.weekNumber;if((d||l)&&p)throw new Et("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&l)throw new Et("Can't mix ordinal dates with month/day");const m=p||i.weekday&&!d;let g,y,w=yr(a,u);m?(g=nl,y=tl,w=cr(w,o,c)):l?(g=sl,y=rl,w=Xr(w)):(g=ki,y=_i);let _=!1;for(const F of g){const J=i[F];W(J)?_?i[F]=y[F]:i[F]=w[F]:_=!0}const b=m?Da(i,o,c):l?Pa(i):Fs(i),v=b||xs(i);if(v)return B.invalid(v);const S=m?Ds(i,o,c):l?Ps(i):i,[E,L]=wr(S,u,n),x=new B({ts:E,zone:n,o:L,loc:s});return i.weekday&&d&&e.weekday!==x.weekday?B.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${x.toISO()}`):x.isValid?x:B.invalid(x.invalid)}static fromISO(e,t={}){const[n,s]=Tc(e);return Pt(n,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,s]=Oc(e);return Pt(n,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,s]=Ac(e);return Pt(n,s,t,"HTTP",t)}static fromFormat(e,t,n={}){if(W(e)||W(t))throw new we("fromFormat requires an input string and a format");const{locale:s=null,numberingSystem:i=null}=n,o=K.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0}),[c,a,u,l]=Xc(o,e,t);return l?B.invalid(l):Pt(c,a,n,`format ${t}`,e,u)}static fromString(e,t,n={}){return B.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,s]=Pc(e);return Pt(n,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new we("need to specify a reason the DateTime is invalid");const n=e instanceof Ue?e:new Ue(e,t);if(ne.throwOnInvalid)throw new aa(n);return new B({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=yi(e,K.fromObject(t));return n?n.map(s=>s?s.val:null).join(""):null}static expandFormat(e,t={}){return pi(be.parseFormat(e),K.fromObject(t)).map(s=>s.val).join("")}static resetCache(){Gt=void 0,dn.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?un(this).weekYear:NaN}get weekNumber(){return this.isValid?un(this).weekNumber:NaN}get weekday(){return this.isValid?un(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?hn(this).weekday:NaN}get localWeekNumber(){return this.isValid?hn(this).weekNumber:NaN}get localWeekYear(){return this.isValid?hn(this).weekYear:NaN}get ordinal(){return this.isValid?Xr(this.c).ordinal:NaN}get monthShort(){return this.isValid?mr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?mr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?mr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?mr.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,n=hr(this.c),s=this.zone.offset(n-e),i=this.zone.offset(n+e),o=this.zone.offset(n-s*t),c=this.zone.offset(n-i*t);if(o===c)return[this];const a=n-o*t,u=n-c*t,l=yr(a,o),f=yr(u,c);return l.hour===f.hour&&l.minute===f.minute&&l.second===f.second&&l.millisecond===f.millisecond?[mt(this,{ts:a}),mt(this,{ts:u})]:[this]}get isInLeapYear(){return qt(this.year)}get daysInMonth(){return ur(this.year,this.month)}get daysInYear(){return this.isValid?Ot(this.year):NaN}get weeksInWeekYear(){return this.isValid?Vt(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Vt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:s}=be.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(Ee.instance(e),t)}toLocal(){return this.setZone(ne.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=st(e,ne.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||n){const i=e.offset(this.ts),o=this.toObject();[s]=wr(o,i,e)}return mt(this,{ts:s,zone:e})}else return B.invalid(Zt(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return mt(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=dr(e,vi),{minDaysInFirstWeek:n,startOfWeek:s}=Ms(t,this.loc),i=!W(t.weekYear)||!W(t.weekNumber)||!W(t.weekday),o=!W(t.ordinal),c=!W(t.year),a=!W(t.month)||!W(t.day),u=c||a,l=t.weekYear||t.weekNumber;if((u||o)&&l)throw new Et("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Et("Can't mix ordinal dates with month/day");let f;i?f=Ds({...cr(this.c,n,s),...t},n,s):W(t.ordinal)?(f={...this.toObject(),...t},W(t.day)&&(f.day=Math.min(ur(f.year,f.month),f.day))):f=Ps({...Xr(this.c),...t});const[h,d]=wr(f,this.o,this.zone);return mt(this,{ts:h,o:d})}plus(e){if(!this.isValid)return this;const t=Z.fromDurationLike(e);return mt(this,bi(this,t))}minus(e){if(!this.isValid)return this;const t=Z.fromDurationLike(e).negate();return mt(this,bi(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},s=Z.normalizeUnit(e);switch(s){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(s==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:o}=this;o<i&&(n.weekNumber=this.weekNumber-1),n.weekday=i}else n.weekday=1;if(s==="quarters"){const i=Math.ceil(this.month/3);n.month=(i-1)*3+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?be.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):ln}toLocaleString(e=ir,t={}){return this.isValid?be.create(this.loc.clone(t),e).formatDateTime(this):ln}toLocaleParts(e={}){return this.isValid?be.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:s=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;const o=e==="extended";let c=fn(this,o);return c+="T",c+=Si(this,o,t,n,s,i),c}toISODate({format:e="extended"}={}){return this.isValid?fn(this,e==="extended"):null}toISOWeekDate(){return br(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:s=!1,extendedZone:i=!1,format:o="extended"}={}){return this.isValid?(s?"T":"")+Si(this,o==="extended",t,e,n,i):null}toRFC2822(){return br(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return br(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?fn(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let s="HH:mm:ss.SSS";return(t||e)&&(n&&(s+=" "),t?s+="z":e&&(s+="ZZ")),br(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():ln}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return Z.invalid("created by diffing an invalid DateTime");const s={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=xa(t).map(Z.normalizeUnit),o=e.valueOf()>this.valueOf(),c=o?this:e,a=o?e:this,u=$c(c,a,i,s);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(B.now(),e,t)}until(e){return this.isValid?se.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const s=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=s&&s<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||B.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let s=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(s=e.unit,i=void 0),Ti(t,this.plus(n),{...e,numeric:"always",units:s,unit:i})}toRelativeCalendar(e={}){return this.isValid?Ti(e.base||B.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(B.isDateTime))throw new we("min requires all arguments be DateTimes");return Us(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(B.isDateTime))throw new we("max requires all arguments be DateTimes");return Us(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:s=null,numberingSystem:i=null}=n,o=K.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});return gi(o,e,t)}static fromStringExplain(e,t,n={}){return B.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:s=null}=t,i=K.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0});return new mi(i,e)}static fromFormatParser(e,t,n={}){if(W(e)||W(t))throw new we("fromFormatParser requires an input string and a format parser");const{locale:s=null,numberingSystem:i=null}=n,o=K.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new we(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:c,zone:a,specificOffset:u,invalidReason:l}=t.explainFromTokens(e);return l?B.invalid(l):Pt(c,a,n,`format ${t.format}`,e,u)}static get DATE_SHORT(){return ir}static get DATE_MED(){return Qn}static get DATE_MED_WITH_WEEKDAY(){return ua}static get DATE_FULL(){return Xn}static get DATE_HUGE(){return es}static get TIME_SIMPLE(){return ts}static get TIME_WITH_SECONDS(){return rs}static get TIME_WITH_SHORT_OFFSET(){return ns}static get TIME_WITH_LONG_OFFSET(){return ss}static get TIME_24_SIMPLE(){return is}static get TIME_24_WITH_SECONDS(){return os}static get TIME_24_WITH_SHORT_OFFSET(){return as}static get TIME_24_WITH_LONG_OFFSET(){return cs}static get DATETIME_SHORT(){return ls}static get DATETIME_SHORT_WITH_SECONDS(){return us}static get DATETIME_MED(){return hs}static get DATETIME_MED_WITH_SECONDS(){return fs}static get DATETIME_MED_WITH_WEEKDAY(){return ha}static get DATETIME_FULL(){return ds}static get DATETIME_FULL_WITH_SECONDS(){return ps}static get DATETIME_HUGE(){return ms}static get DATETIME_HUGE_WITH_SECONDS(){return gs}}function Yt(r){if(B.isDateTime(r))return r;if(r&&r.valueOf&&it(r.valueOf()))return B.fromJSDate(r);if(r&&typeof r=="object")return B.fromObject(r);throw new we(`Unknown datetime argument: ${r}, of type ${typeof r}`)}const me=[];for(let r=0;r<256;++r)me.push((r+256).toString(16).slice(1));function al(r,e,t,n){return()=>{r|=0,e|=0,t|=0,n|=0;const s=(r+e|0)+n|0;return n=n+1|0,r=e^e>>>9,e=t+(t<<3)|0,t=(t<<21|t>>>11)+s|0,s>>>0}}function cl(){const r=new Uint8Array(16),e=BigInt(Date.now()),t=BigInt(Math.floor(performance.now()*1e3)%65535),n=e<<16n|t;r[0]=Number(n>>40n&0xffn),r[1]=Number(n>>32n&0xffn),r[2]=Number(n>>24n&0xffn),r[3]=Number(n>>16n&0xffn),r[4]=Number(n>>8n&0xffn),r[5]=Number(n&0xffn);const s=(Math.random()*4294967295^Date.now()^performance.now())>>>0,i=al(2654435769,608135816,3084996962,s),o=new DataView(r.buffer);return o.setUint32(6,i()),o.setUint32(10,i()),o.setUint16(14,i()),r[6]=112|r[6]&15,r[8]=128|r[8]&63,(me[r[0]]+me[r[1]]+me[r[2]]+me[r[3]]+"-"+me[r[4]]+me[r[5]]+"-"+me[r[6]]+me[r[7]]+"-"+me[r[8]]+me[r[9]]+"-"+me[r[10]]+me[r[11]]+me[r[12]]+me[r[13]]+me[r[14]]+me[r[15]]).toLowerCase()}const ll=/[&<>'"]/g,ul=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g,hl={"&":"&amp","<":"&lt",">":"&gt","'":"&#39",'"':"&quot"},fl={"&amp":"&","&#38":"&","&lt":"<","&#60":"<","&gt":">","&#62":">","&apos":"'","&#39":"'","&quot":'"',"&#34":'"'};class dl{getRandom(e=8){return[...Array(e)].map(()=>Math.trunc(Math.random()*36).toString(36)).join("")}getUniqId(){return"xxxxxxxx-xlsx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.trunc(Math.random()*16);return(e==="x"?t:t&3|8).toString(16)})}getUuidRfc4122(){return cl()}encode(e){return C.isString(e)?e.replace(ll,t=>hl[t]):e}decode(e){return C.isString(e)?e.replace(ul,t=>fl[t]):e}toNumber(e){const t=Number.parseFloat(e);return C.isNumber(t)?t:0}toInteger(e){return this.toNumber(Number.parseInt(e,10))}toBoolean(e,t=[]){const n=C.isString(e)?e.toLowerCase():e;return["true","y","1",1,!0,...t].includes(n)}toCamelCase(e){if(!C.isStringFilled(e))return e;const t=/[-_\s]+(.)?/g;return t.test(e)?(e=e.toLowerCase(),e=e.replace(t,(n,s)=>s?s.toUpperCase():""),e[0].toLowerCase()+e.substring(1)):e.match(/^[A-Z]+$/)?e.toLowerCase():e[0].toLowerCase()+e.slice(1)}toPascalCase(e){return C.isStringFilled(e)?this.capitalize(this.toCamelCase(e)):e}toKebabCase(e){if(!C.isStringFilled(e))return e;const t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);return t?t.map(n=>n.toLowerCase()).join("-"):e}capitalize(e){return C.isStringFilled(e)?e[0].toUpperCase()+e.substring(1):e}numberFormat(e,t=0,n=".",s=","){const i=Number.isFinite(e)?e:0,o=Number.isFinite(t)?Math.abs(t):0,c=(o?((a,u)=>{const l=Math.pow(10,u);return Math.round(a*l)/l})(i,o):Math.round(i)).toString().split(".");return c[0].length>3&&(c[0]=c[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,s)),(c[1]||"").length<o&&(c[1]=c[1]||"",c[1]+=new Array(o-c[1].length+1).join("0")),c.join(n)}toDateTime(e,t,n){return!(typeof t>"u")&&C.isStringFilled(t)?B.fromFormat(e,t,n):B.fromISO(e,n)}getDateForLog(){return B.now().toFormat("y-MM-dd HH:mm:ss")}buildQueryString(e){let t="";for(const n in e){if(!e.hasOwnProperty(n))continue;const s=e[n];C.isArray(s)?s.forEach((i,o)=>{t+=encodeURIComponent(n+"["+o+"]")+"="+encodeURIComponent(i)+"&"}):t+=encodeURIComponent(n)+"="+encodeURIComponent(s)+"&"}return t.length>0&&(t=t.substring(0,t.length-1)),t}}const $=new dl;let de="";try{de=navigator?.userAgent.toLowerCase()}catch{de="?"}let pl=class{isOpera(){return de.includes("opera")}isIE(){return"attachEvent"in document&&!this.isOpera()}isIE6(){return de.includes("msie 6")}isIE7(){return de.includes("msie 7")}isIE8(){return de.includes("msie 8")}isIE9(){return"documentMode"in document&&document.documentMode>=9}isIE10(){return"documentMode"in document&&document.documentMode>=10}isSafari(){return de.includes("safari")&&!de.includes("chrome")}isFirefox(){return de.includes("firefox")}isChrome(){return de.includes("chrome")}detectIEVersion(){if(this.isOpera()||this.isSafari()||this.isFirefox()||this.isChrome())return-1;let e=-1;if(window.MSStream&&!window.ActiveXObject&&"ActiveXObject"in window?e=11:this.isIE10()?e=10:this.isIE9()?e=9:this.isIE()&&(e=8),e===-1||e===8){if(navigator.appName==="Microsoft Internet Explorer"){const t=new RegExp("MSIE ([0-9]+[.0-9]*)"),n=navigator.userAgent.match(t);C.isArrayLike(n)&&n.length>0&&(e=Number.parseFloat(n[1]))}if(navigator.appName==="Netscape"){e=11;const t=new RegExp("Trident/.*rv:([0-9]+[.0-9]*)");if(t.exec(navigator.userAgent)!=null){const n=navigator.userAgent.match(t);C.isArrayLike(n)&&n.length>0&&(e=Number.parseFloat(n[1]))}}}return e}isIE11(){return this.detectIEVersion()>=11}isMac(){return de.includes("macintosh")}isWin(){return de.includes("windows")}isLinux(){return de.includes("linux")&&!this.isAndroid()}isAndroid(){return de.includes("android")}isIPad(){return de.includes("ipad;")||this.isMac()&&this.isTouchDevice()}isIPhone(){return de.includes("iphone;")}isIOS(){return this.isIPad()||this.isIPhone()}isMobile(){return this.isIPhone()||this.isIPad()||this.isAndroid()||de.includes("mobile")||de.includes("touch")}isRetina(){return(window.devicePixelRatio&&window.devicePixelRatio>=2)===!0}isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}isDoctype(e){const t=e||document;return t.compatMode?t.compatMode==="CSS1Compat":t.documentElement&&t.documentElement.clientHeight}isLocalStorageSupported(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch{return!1}}detectAndroidVersion(){const e=new RegExp("Android ([0-9]+[.0-9]*)");if(e.exec(navigator.userAgent)!=null){const t=navigator.userAgent.match(e);if(C.isArrayLike(t)&&t.length>0)return Number.parseFloat(t[1])}return 0}};const Ai=new pl,Ii={sleep:1e3,speed:.001,amount:30},pn={sleep:600,speed:.01,amount:30*5};var Ci=(r=>(r.undefined="UNDEFINED",r.lead="CRM_LEAD",r.deal="CRM_DEAL",r.contact="CRM_CONTACT",r.company="CRM_COMPANY",r.oldInvoice="CRM_INVOICE",r.invoice="CRM_SMART_INVOICE",r.quote="CRM_QUOTE",r.requisite="CRM_REQUISITE",r.order="ORDER",r))(Ci||{}),We=(r=>(r[r.undefined=0]="undefined",r[r.lead=1]="lead",r[r.deal=2]="deal",r[r.contact=3]="contact",r[r.company=4]="company",r[r.oldInvoice=5]="oldInvoice",r[r.invoice=31]="invoice",r[r.quote=7]="quote",r[r.requisite=8]="requisite",r[r.order=14]="order",r))(We||{}),mn=(r=>(r.undefined="?",r.lead="L",r.deal="D",r.contact="C",r.company="CO",r.oldInvoice="I",r.invoice="SI",r.quote="Q",r.requisite="RQ",r.order="O",r))(mn||{});function ml(r){const e=We[r];return mn[e]||"?"}var Ni=(r=>(r[r.undefined=0]="undefined",r[r.absolute=1]="absolute",r[r.percentage=2]="percentage",r))(Ni||{}),Ri=(r=>(r[r.undefined=0]="undefined",r[r.product=1]="product",r[r.service=7]="service",r[r.sku=3]="sku",r[r.skuEmpty=6]="skuEmpty",r[r.offer=4]="offer",r[r.offerEmpty=5]="offerEmpty",r))(Ri||{}),Li=(r=>(r.undefined="UNDEFINED",r.detail="DETAIL_PICTURE",r.preview="PREVIEW_PICTURE",r.morePhoto="MORE_PHOTO",r))(Li||{}),Di=(r=>(r[r.undefined=0]="undefined",r[r.mathematical=1]="mathematical",r[r.roundingUp=2]="roundingUp",r[r.roundingDown=4]="roundingDown",r))(Di||{}),Pi=(r=>(r.undefined="undefined",r.b24="b24",r.box="box",r))(Pi||{}),Mi=(r=>(r.undefined="undefined",r.crm="crm",r.disk="disk",r.lists="lists",r))(Mi||{}),Fi=(r=>(r.undefined="undefined",r.lead="CCrmDocumentLead",r.company="CCrmDocumentCompany",r.contact="CCrmDocumentContact",r.deal="CCrmDocumentDeal",r.invoice="Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice",r.quote="Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote",r.order="Bitrix\\Crm\\Integration\\BizProc\\Document\\Order",r.dynamic="Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic",r.disk="Bitrix\\Disk\\BizProcDocument",r.lists="BizprocDocument",r.listsList="Bitrix\\Lists\\BizprocDocumentLists",r))(Fi||{});function gl(r){switch(r){case"CCrmDocumentLead":return We.lead;case"CCrmDocumentCompany":return We.company;case"CCrmDocumentContact":return We.contact;case"CCrmDocumentDeal":return We.deal;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":return We.invoice;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":return We.quote;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":return We.order}return We.undefined}function gn(r,e){let t="",n="undefined";switch(r){case"CCrmDocumentLead":n="crm",t="LEAD";break;case"CCrmDocumentCompany":n="crm",t="COMPANY";break;case"CCrmDocumentContact":n="crm",t="CONTACT";break;case"CCrmDocumentDeal":n="crm",t="DEAL";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":n="crm",t="SMART_INVOICE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":n="crm",t="QUOTE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":n="crm",t="ORDER";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(n="crm",t=`DYNAMIC_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Disk\\BizProcDocument":if(n="disk",t=`STORAGE_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"BizprocDocument":if(n="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Lists\\BizprocDocumentLists":if(n="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break}return[n,r,t]}function yl(r,e,t){let n="";const s=gn(r,1);switch(r){case"CCrmDocumentLead":n=`LEAD_${e}`;break;case"CCrmDocumentCompany":n=`COMPANY_${e}`;break;case"CCrmDocumentContact":n=`CONTACT_${e}`;break;case"CCrmDocumentDeal":n=`DEAL_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":n=`SMART_INVOICE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":n=`QUOTE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":n=`ORDER_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(n=`DYNAMIC_${t||0}_${e}`,(t||0)<1)throw new Error("Need set dynamicId");break;case"Bitrix\\Disk\\BizProcDocument":n=`${e}`;break;case"BizprocDocument":n=`${e}`;break;case"Bitrix\\Lists\\BizprocDocumentLists":n=`${e}`;break}return[s[0],s[1],n]}function wl(r){const e=gn(r,1);return[e[0],e[1]]}var ee=(r=>(r.App="app",r.Profile="profile",r.Currency="currency",r.AppOptions="appOptions",r.UserOptions="userOptions",r))(ee||{});const Ke={Free:"F",Demo:"D",Trial:"T",Paid:"P",Local:"L",Subscription:"S"},xi={[Ke.Free]:"Free",[Ke.Demo]:"Demo",[Ke.Trial]:"Trial",[Ke.Paid]:"Paid",[Ke.Local]:"Local",[Ke.Subscription]:"Subscription"},gt={MainSettings:"MainSettings",UfList:"UfList",UfPage:"UfPage"};var Qe=(r=>(r.NotSet="notSet",r.JsonArray="jsonArray",r.JsonObject="jsonObject",r.FloatVal="float",r.IntegerVal="integer",r.BoolYN="boolYN",r.StringVal="string",r))(Qe||{}),te=(r=>(r.Undefined="undefined",r.WebSocket="webSocket",r.LongPolling="longPolling",r))(te||{}),Ne=(r=>(r.PullConfig="bx-pull-config",r.WebsocketBlocked="bx-pull-websocket-blocked",r.LongPollingBlocked="bx-pull-longpolling-blocked",r.LoggingEnabled="bx-pull-logging-enabled",r))(Ne||{}),Re=(r=>(r.Online="online",r.Offline="offline",r.Connecting="connect",r))(Re||{}),Sr=(r=>(r[r.Unknown=0]="Unknown",r[r.Client=1]="Client",r[r.Backend=2]="Backend",r))(Sr||{}),Le=(r=>(r.Server="server",r.Client="client",r.Online="online",r.Status="status",r.Revision="revision",r))(Le||{}),Se=(r=>(r[r.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",r[r.SERVER_DIE=1001]="SERVER_DIE",r[r.CONFIG_REPLACED=3e3]="CONFIG_REPLACED",r[r.CHANNEL_EXPIRED=3001]="CHANNEL_EXPIRED",r[r.SERVER_RESTARTED=3002]="SERVER_RESTARTED",r[r.CONFIG_EXPIRED=3003]="CONFIG_EXPIRED",r[r.MANUAL=3004]="MANUAL",r[r.STUCK=3005]="STUCK",r[r.WRONG_CHANNEL_ID=4010]="WRONG_CHANNEL_ID",r))(Se||{}),Kt=(r=>(r.CHANNEL_EXPIRE="CHANNEL_EXPIRE",r.CONFIG_EXPIRE="CONFIG_EXPIRE",r.SERVER_RESTART="SERVER_RESTART",r))(Kt||{}),yn=(r=>(r.Shared="shared",r.Personal="personal",r))(yn||{});const wn={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 ze=(r=>(r.Publish="publish",r.GetUsersLastSeen="getUsersLastSeen",r.Ping="ping",r.ListChannels="listChannels",r.SubscribeStatusChange="subscribeStatusChange",r.UnsubscribeStatusChange="unsubscribeStatusChange",r))(ze||{});class qe{_errors;_data;constructor(e){this._errors=new Map,this._data=e??null}get isSuccess(){return this._errors.size===0}get errors(){return this._errors}setData(e){return this._data=e,this}getData(){return this._data}addError(e,t){const n=t??$.getUuidRfc4122(),s=typeof e=="string"?new Error(e):e;return this._errors.set(n,s),this}addErrors(e){for(const t of e)this.addError(t);return this}getErrors(){return this._errors.values()}hasError(e){return this._errors.has(e)}getErrorMessages(){return Array.from(this._errors.values(),e=>e.message)}toString(){const e=this.isSuccess?"success":"failure",t=this.safeStringify(this._data);return this.isSuccess?`Result(${e}): ${t}`:`Result(${e}): ${t}
1
+ (function(R,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(R=typeof globalThis<"u"?globalThis:R||self,I(R.B24Js=R.B24Js||{}))})(this,(function(R){"use strict";var I=(r=>(r.desktop="desktop",r.log="log",r.info="info",r.warn="warn",r.error="error",r.trace="trace",r))(I||{});const xe=new Map;xe.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"]),xe.set("desktop",["%cDESKTOP","color: white; font-style: italic; background-color: #29619b; padding: 0 6px; border: 1px solid #29619b"]),xe.set("log",["%cLOG","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]),xe.set("info",["%cINFO","color: #fff; font-style: italic; background-color: #6b7f96; padding: 0 6px; border: 1px solid #6b7f96"]),xe.set("warn",["%cWARNING","color: #f0a74f; font-style: italic; padding: 0 6px; border: 1px solid #f0a74f"]),xe.set("error",["%cERROR","color: white; font-style: italic; background-color: #8a3232; padding: 0 6px; border: 1px solid #8a3232"]),xe.set("trace",["%cTRACE","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]);class ye{#e;#r={desktop:!0,log:!1,info:!1,warn:!1,error:!0,trace:!0};static build(e,t=!1){const n=new ye(e);return t&&(n.enable("log"),n.enable("info"),n.enable("warn")),n}constructor(e){this.#e=e}#t(e){const t=[],n=[];if(xe.has("title")){const s=xe.get("title");s[0]&&(t.push(s[0].replace("#title#",this.#e)),n.push(s[1]||""))}if(xe.has(e)){const s=xe.get(e);s[0]&&(t.push(s[0]),n.push(s[1]||""))}return[t.join(""),...n]}setConfig(e){for(const t in e)this.#r[t]=e[t]}enable(e){return typeof this.#r[e]>"u"?!1:(this.#r[e]=!0,!0)}disable(e){return typeof this.#r[e]>"u"?!1:(this.#r[e]=!1,!0)}isEnabled(e){return this.#r[e]}desktop(...e){this.isEnabled("desktop")&&console.log(...this.#t("desktop"),...e)}log(...e){this.isEnabled("log")&&console.log(...this.#t("log"),...e)}info(...e){this.isEnabled("info")&&console.info(...this.#t("info"),...e)}warn(...e){this.isEnabled("warn")&&console.warn(...this.#t("warn"),...e)}error(...e){this.isEnabled("error")&&console.error(...this.#t("error"),...e)}trace(...e){this.isEnabled("trace")&&console.trace(...this.#t("trace"),...e)}}var Qn=(r=>(r.undefined="undefined",r.any="any",r.integer="integer",r.boolean="boolean",r.double="double",r.date="date",r.datetime="datetime",r.string="string",r.text="text",r.file="file",r.array="array",r.object="object",r.user="user",r.location="location",r.crmCategory="crm_category",r.crmStatus="crm_status",r.crmCurrency="crm_currency",r))(Qn||{});const aa=Function.prototype.toString.call(Object);class la{getTag(e){return Object.prototype.toString.call(e)}isString(e){return typeof e=="string"||e instanceof String}isStringFilled(e){return this.isString(e)&&e!==""}isFunction(e){return e===null?!1:typeof e=="function"||e instanceof Function}isObject(e){return!!e&&(typeof e=="object"||typeof e=="function")}isObjectLike(e){return!!e&&typeof e=="object"}isPlainObject(e){if(!this.isObjectLike(e)||this.getTag(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=t.hasOwnProperty("constructor")&&t.constructor;return typeof n=="function"&&Function.prototype.toString.call(n)===aa}isJsonRpcRequest(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"method"in e&&this.isStringFilled(e.method)}isJsonRpcResponse(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"id"in e&&("result"in e||"error"in e)}isBoolean(e){return e===!0||e===!1}isNumber(e){return typeof e=="number"&&!Number.isNaN(e)}isInteger(e){return Number.isInteger(e)}isFloat(e){return this.isNumber(e)&&!this.isInteger(e)}isNil(e){return e==null}isArray(e){return!this.isNil(e)&&Array.isArray(e)}isArrayFilled(e){return this.isArray(e)&&e.length>0}isArrayLike(e){return!this.isNil(e)&&!this.isFunction(e)&&e.length>-1&&e.length<=Number.MAX_SAFE_INTEGER}isDate(e){return e instanceof Date}isDomNode(e){return this.isObjectLike(e)&&!this.isPlainObject(e)&&"nodeType"in e}isElementNode(e){return this.isDomNode(e)&&e.nodeType===Node.ELEMENT_NODE}isTextNode(e){return this.isDomNode(e)&&e.nodeType===Node.TEXT_NODE}isMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Map]"}isSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Set]"}isWeakMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakMap]"}isWeakSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakSet]"}isPrototype(e){return(typeof(e&&e.constructor)=="function"&&e.constructor.prototype||Object.prototype)===e}isRegExp(e){return this.isObjectLike(e)&&this.getTag(e)==="[object RegExp]"}isNull(e){return e===null}isUndefined(e){return typeof e>"u"}isArrayBuffer(e){return this.isObjectLike(e)&&this.getTag(e)==="[object ArrayBuffer]"}isTypedArray(e){const t=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)]$/;return this.isObjectLike(e)&&t.test(this.getTag(e))}isBlob(e){return this.isObjectLike(e)&&this.isNumber(e.size)&&this.isString(e.type)&&this.isFunction(e.slice)}isFile(e){return this.isBlob(e)&&this.isString(e.name)&&(this.isNumber(e.lastModified)||this.isObjectLike(e.lastModifiedDate))}isFormData(e){return typeof FormData<"u"&&e instanceof FormData?!0:this.isObjectLike(e)&&this.getTag(e)==="[object FormData]"}clone(e,t=!0){let n,s,i;if(this.isNil(e)||typeof e!="object")return e;if(this.isDomNode(e))n=e.cloneNode(t);else if(typeof e=="object")if(this.isArray(e))for(n=[],s=0,i=e.length;s<i;s++)typeof e[s]=="object"&&t?n[s]=this.clone(e[s],t):n[s]=e[s];else{n={},e.constructor&&(this.isDate(e)?n=new Date(e):n=new e.constructor);for(s in e)e.hasOwnProperty(s)&&(typeof e[s]=="object"&&t?n[s]=this.clone(e[s],t):n[s]=e[s])}else n=e;return n}}const C=new la;function ca(r,e){const t={};for(const n of e)t[n]=r[n];return t}function Xn(r,e){const t={...r};for(const n of e)delete t[n];return t}function ua(r){return Array.isArray(r[0])}function ha(r,e){return Object.values(r).includes(e)?e:void 0}class ft extends Error{}class fa extends ft{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class da extends ft{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class pa extends ft{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Et extends ft{}class es extends ft{constructor(e){super(`Invalid unit ${e}`)}}class we extends ft{}class st extends ft{constructor(){super("Zone is an abstract class")}}const N="numeric",je="short",Ce="long",ar={year:N,month:N,day:N},ts={year:N,month:je,day:N},ga={year:N,month:je,day:N,weekday:je},rs={year:N,month:Ce,day:N},ns={year:N,month:Ce,day:N,weekday:Ce},ss={hour:N,minute:N},is={hour:N,minute:N,second:N},os={hour:N,minute:N,second:N,timeZoneName:je},as={hour:N,minute:N,second:N,timeZoneName:Ce},ls={hour:N,minute:N,hourCycle:"h23"},cs={hour:N,minute:N,second:N,hourCycle:"h23"},us={hour:N,minute:N,second:N,hourCycle:"h23",timeZoneName:je},hs={hour:N,minute:N,second:N,hourCycle:"h23",timeZoneName:Ce},fs={year:N,month:N,day:N,hour:N,minute:N},ds={year:N,month:N,day:N,hour:N,minute:N,second:N},ps={year:N,month:je,day:N,hour:N,minute:N},gs={year:N,month:je,day:N,hour:N,minute:N,second:N},ma={year:N,month:je,day:N,weekday:je,hour:N,minute:N},ms={year:N,month:Ce,day:N,hour:N,minute:N,timeZoneName:je},ys={year:N,month:Ce,day:N,hour:N,minute:N,second:N,timeZoneName:je},ws={year:N,month:Ce,day:N,weekday:Ce,hour:N,minute:N,timeZoneName:Ce},bs={year:N,month:Ce,day:N,weekday:Ce,hour:N,minute:N,second:N,timeZoneName:Ce};class $t{get type(){throw new st}get name(){throw new st}get ianaName(){return this.name}get isUniversal(){throw new st}offsetName(e,t){throw new st}formatOffset(e,t){throw new st}offset(e){throw new st}equals(e){throw new st}get isValid(){throw new st}}let Wr=null;class lr extends $t{static get instance(){return Wr===null&&(Wr=new lr),Wr}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return zs(e,t,n)}formatOffset(e,t){return zt(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const qr=new Map;function ya(r){let e=qr.get(r);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),qr.set(r,e)),e}const wa={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function ba(r,e){const t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,i,o,l,a,u,c]=n;return[o,s,i,l,a,u,c]}function Sa(r,e){const t=r.formatToParts(e),n=[];for(let s=0;s<t.length;s++){const{type:i,value:o}=t[s],l=wa[i];i==="era"?n[l]=o:$(l)||(n[l]=parseInt(o,10))}return n}const Vr=new Map;class Ye extends $t{static create(e){let t=Vr.get(e);return t===void 0&&Vr.set(e,t=new Ye(e)),t}static resetCache(){Vr.clear(),qr.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=Ye.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return zs(e,t,n,this.name)}formatOffset(e,t){return zt(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const n=ya(this.name);let[s,i,o,l,a,u,c]=n.formatToParts?Sa(n,t):ba(n,t);l==="BC"&&(s=-Math.abs(s)+1);const h=dr({year:s,month:i,day:o,hour:a===24?0:a,minute:u,second:c,millisecond:0});let d=+t;const p=d%1e3;return d-=p>=0?p:1e3+p,(h-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Ss={};function _a(r,e={}){const t=JSON.stringify([r,e]);let n=Ss[t];return n||(n=new Intl.ListFormat(r,e),Ss[t]=n),n}const zr=new Map;function Hr(r,e={}){const t=JSON.stringify([r,e]);let n=zr.get(t);return n===void 0&&(n=new Intl.DateTimeFormat(r,e),zr.set(t,n)),n}const Jr=new Map;function ka(r,e={}){const t=JSON.stringify([r,e]);let n=Jr.get(t);return n===void 0&&(n=new Intl.NumberFormat(r,e),Jr.set(t,n)),n}const Zr=new Map;function va(r,e={}){const{base:t,...n}=e,s=JSON.stringify([r,n]);let i=Zr.get(s);return i===void 0&&(i=new Intl.RelativeTimeFormat(r,e),Zr.set(s,i)),i}let Wt=null;function Ea(){return Wt||(Wt=new Intl.DateTimeFormat().resolvedOptions().locale,Wt)}const Gr=new Map;function _s(r){let e=Gr.get(r);return e===void 0&&(e=new Intl.DateTimeFormat(r).resolvedOptions(),Gr.set(r,e)),e}const Yr=new Map;function Ta(r){let e=Yr.get(r);if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...ks,...e}),Yr.set(r,e)}return e}function Oa(r){const e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));const t=r.indexOf("-u-");if(t===-1)return[r];{let n,s;try{n=Hr(r).resolvedOptions(),s=r}catch{const a=r.substring(0,t);n=Hr(a).resolvedOptions(),s=a}const{numberingSystem:i,calendar:o}=n;return[s,i,o]}}function Aa(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function Ia(r){const e=[];for(let t=1;t<=12;t++){const n=B.utc(2009,t,1);e.push(r(n))}return e}function Ca(r){const e=[];for(let t=1;t<=7;t++){const n=B.utc(2016,11,13+t);e.push(r(n))}return e}function cr(r,e,t,n){const s=r.listingMode();return s==="error"?null:s==="en"?t(e):n(e)}function Na(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||_s(r.locale).numberingSystem==="latn"}class Ra{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:s,floor:i,...o}=n;if(!t||Object.keys(o).length>0){const l={useGrouping:!1,...n};n.padTo>0&&(l.minimumIntegerDigits=n.padTo),this.inf=ka(e,l)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):on(e,3);return ce(t,this.padTo)}}}class La{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let s;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),l=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Ye.create(l).valid?(s=l,this.dt=e):(s="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,s=e.zone.name):(s="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||s,this.dtf=Hr(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:n}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Da{constructor(e,t,n){this.opts={style:"long",...n},!t&&$s()&&(this.rtf=va(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):tl(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const ks={firstDay:1,minimalDays:4,weekend:[6,7]};class K{static fromOpts(e){return K.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,s,i=!1){const o=e||ne.defaultLocale,l=o||(i?"en-US":Ea()),a=t||ne.defaultNumberingSystem,u=n||ne.defaultOutputCalendar,c=nn(s)||ne.defaultWeekSettings;return new K(l,a,u,c,o)}static resetCache(){Wt=null,zr.clear(),Jr.clear(),Zr.clear(),Gr.clear(),Yr.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:s}={}){return K.create(e,t,n,s)}constructor(e,t,n,s,i){const[o,l,a]=Oa(e);this.locale=o,this.numberingSystem=t||l||null,this.outputCalendar=n||a||null,this.weekSettings=s,this.intl=Aa(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Na(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:K.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,nn(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return cr(this,e,Zs,()=>{const n=this.intl==="ja"||this.intl.startsWith("ja-");t&=!n;const s=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const o=n?l=>this.dtFormatter(l,s).format():l=>this.extract(l,s,"month");this.monthsCache[i][e]=Ia(o)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return cr(this,e,Ks,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},s=t?"format":"standalone";return this.weekdaysCache[s][e]||(this.weekdaysCache[s][e]=Ca(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[s][e]})}meridiems(){return cr(this,void 0,()=>Qs,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[B.utc(2016,11,13,9),B.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return cr(this,e,Xs,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[B.utc(-40,1,1),B.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){const s=this.dtFormatter(e,t),i=s.formatToParts(),o=i.find(l=>l.type.toLowerCase()===n);return o?o.value:null}numberFormatter(e={}){return new Ra(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new La(e,this.intl,t)}relFormatter(e={}){return new Da(this.intl,this.isEnglish(),e)}listFormatter(e={}){return _a(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||_s(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ws()?Ta(this.locale):ks}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Kr=null;class Ee extends $t{static get utcInstance(){return Kr===null&&(Kr=new Ee(0)),Kr}static instance(e){return e===0?Ee.utcInstance:new Ee(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Ee(pr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${zt(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${zt(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return zt(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Pa extends $t{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function it(r,e){if($(r)||r===null)return e;if(r instanceof $t)return r;if(Ua(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?lr.instance:t==="utc"||t==="gmt"?Ee.utcInstance:Ee.parseSpecifier(t)||Ye.create(r)}else return ot(r)?Ee.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new Pa(r)}const Qr={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"},vs={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Ma=Qr.hanidec.replace(/[\[|\]]/g,"").split("");function Fa(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){const n=r.charCodeAt(t);if(r[t].search(Qr.hanidec)!==-1)e+=Ma.indexOf(r[t]);else for(const s in vs){const[i,o]=vs[s];n>=i&&n<=o&&(e+=n-i)}}return parseInt(e,10)}else return e}const Xr=new Map;function xa(){Xr.clear()}function Be({numberingSystem:r},e=""){const t=r||"latn";let n=Xr.get(t);n===void 0&&(n=new Map,Xr.set(t,n));let s=n.get(e);return s===void 0&&(s=new RegExp(`${Qr[t]}${e}`),n.set(e,s)),s}let Es=()=>Date.now(),Ts="system",Os=null,As=null,Is=null,Cs=60,Ns,Rs=null;class ne{static get now(){return Es}static set now(e){Es=e}static set defaultZone(e){Ts=e}static get defaultZone(){return it(Ts,lr.instance)}static get defaultLocale(){return Os}static set defaultLocale(e){Os=e}static get defaultNumberingSystem(){return As}static set defaultNumberingSystem(e){As=e}static get defaultOutputCalendar(){return Is}static set defaultOutputCalendar(e){Is=e}static get defaultWeekSettings(){return Rs}static set defaultWeekSettings(e){Rs=nn(e)}static get twoDigitCutoffYear(){return Cs}static set twoDigitCutoffYear(e){Cs=e%100}static get throwOnInvalid(){return Ns}static set throwOnInvalid(e){Ns=e}static resetCaches(){K.resetCache(),Ye.resetCache(),B.resetCache(),xa()}}class Ue{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Ls=[0,31,59,90,120,151,181,212,243,273,304,334],Ds=[0,31,60,91,121,152,182,213,244,274,305,335];function De(r,e){return new Ue("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function en(r,e,t){const n=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const s=n.getUTCDay();return s===0?7:s}function Ps(r,e,t){return t+(qt(r)?Ds:Ls)[e-1]}function Ms(r,e){const t=qt(r)?Ds:Ls,n=t.findIndex(i=>i<e),s=e-t[n];return{month:n+1,day:s}}function tn(r,e){return(r-e+7)%7+1}function ur(r,e=4,t=1){const{year:n,month:s,day:i}=r,o=Ps(n,s,i),l=tn(en(n,s,i),t);let a=Math.floor((o-l+14-e)/7),u;return a<1?(u=n-1,a=Vt(u,e,t)):a>Vt(n,e,t)?(u=n+1,a=1):u=n,{weekYear:u,weekNumber:a,weekday:l,...mr(r)}}function Fs(r,e=4,t=1){const{weekYear:n,weekNumber:s,weekday:i}=r,o=tn(en(n,1,e),t),l=Ot(n);let a=s*7+i-o-7+e,u;a<1?(u=n-1,a+=Ot(u)):a>l?(u=n+1,a-=Ot(n)):u=n;const{month:c,day:f}=Ms(u,a);return{year:u,month:c,day:f,...mr(r)}}function rn(r){const{year:e,month:t,day:n}=r,s=Ps(e,t,n);return{year:e,ordinal:s,...mr(r)}}function xs(r){const{year:e,ordinal:t}=r,{month:n,day:s}=Ms(e,t);return{year:e,month:n,day:s,...mr(r)}}function js(r,e){if(!$(r.localWeekday)||!$(r.localWeekNumber)||!$(r.localWeekYear)){if(!$(r.weekday)||!$(r.weekNumber)||!$(r.weekYear))throw new Et("Cannot mix locale-based week fields with ISO-based week fields");return $(r.localWeekday)||(r.weekday=r.localWeekday),$(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),$(r.localWeekYear)||(r.weekYear=r.localWeekYear),delete r.localWeekday,delete r.localWeekNumber,delete r.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ja(r,e=4,t=1){const n=hr(r.weekYear),s=Pe(r.weekNumber,1,Vt(r.weekYear,e,t)),i=Pe(r.weekday,1,7);return n?s?i?!1:De("weekday",r.weekday):De("week",r.weekNumber):De("weekYear",r.weekYear)}function Ba(r){const e=hr(r.year),t=Pe(r.ordinal,1,Ot(r.year));return e?t?!1:De("ordinal",r.ordinal):De("year",r.year)}function Bs(r){const e=hr(r.year),t=Pe(r.month,1,12),n=Pe(r.day,1,fr(r.year,r.month));return e?t?n?!1:De("day",r.day):De("month",r.month):De("year",r.year)}function Us(r){const{hour:e,minute:t,second:n,millisecond:s}=r,i=Pe(e,0,23)||e===24&&t===0&&n===0&&s===0,o=Pe(t,0,59),l=Pe(n,0,59),a=Pe(s,0,999);return i?o?l?a?!1:De("millisecond",s):De("second",n):De("minute",t):De("hour",e)}function $(r){return typeof r>"u"}function ot(r){return typeof r=="number"}function hr(r){return typeof r=="number"&&r%1===0}function Ua(r){return typeof r=="string"}function $a(r){return Object.prototype.toString.call(r)==="[object Date]"}function $s(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Ws(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Wa(r){return Array.isArray(r)?r:[r]}function qs(r,e,t){if(r.length!==0)return r.reduce((n,s)=>{const i=[e(s),s];return n&&t(n[0],i[0])===n[0]?n:i},null)[1]}function qa(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function Tt(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function nn(r){if(r==null)return null;if(typeof r!="object")throw new we("Week settings must be an object");if(!Pe(r.firstDay,1,7)||!Pe(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!Pe(e,1,7)))throw new we("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function Pe(r,e,t){return hr(r)&&r>=e&&r<=t}function Va(r,e){return r-e*Math.floor(r/e)}function ce(r,e=2){const t=r<0;let n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function at(r){if(!($(r)||r===null||r===""))return parseInt(r,10)}function dt(r){if(!($(r)||r===null||r===""))return parseFloat(r)}function sn(r){if(!($(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function on(r,e,t="round"){const n=10**e;switch(t){case"expand":return r>0?Math.ceil(r*n)/n:Math.floor(r*n)/n;case"trunc":return Math.trunc(r*n)/n;case"round":return Math.round(r*n)/n;case"floor":return Math.floor(r*n)/n;case"ceil":return Math.ceil(r*n)/n;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function qt(r){return r%4===0&&(r%100!==0||r%400===0)}function Ot(r){return qt(r)?366:365}function fr(r,e){const t=Va(e-1,12)+1,n=r+(e-t)/12;return t===2?qt(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function dr(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}function Vs(r,e,t){return-tn(en(r,1,e),t)+e-1}function Vt(r,e=4,t=1){const n=Vs(r,e,t),s=Vs(r+1,e,t);return(Ot(r)-n+s)/7}function an(r){return r>99?r:r>ne.twoDigitCutoffYear?1900+r:2e3+r}function zs(r,e,t,n=null){const s=new Date(r),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(i.timeZone=n);const o={timeZoneName:e,...i},l=new Intl.DateTimeFormat(t,o).formatToParts(s).find(a=>a.type.toLowerCase()==="timezonename");return l?l.value:null}function pr(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const n=parseInt(e,10)||0,s=t<0||Object.is(t,-0)?-n:n;return t*60+s}function Hs(r){const e=Number(r);if(typeof r=="boolean"||r===""||!Number.isFinite(e))throw new we(`Invalid unit value ${r}`);return e}function gr(r,e){const t={};for(const n in r)if(Tt(r,n)){const s=r[n];if(s==null)continue;t[e(n)]=Hs(s)}return t}function zt(r,e){const t=Math.trunc(Math.abs(r/60)),n=Math.trunc(Math.abs(r%60)),s=r>=0?"+":"-";switch(e){case"short":return`${s}${ce(t,2)}:${ce(n,2)}`;case"narrow":return`${s}${t}${n>0?`:${n}`:""}`;case"techie":return`${s}${ce(t,2)}${ce(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function mr(r){return qa(r,["hour","minute","second","millisecond"])}const za=["January","February","March","April","May","June","July","August","September","October","November","December"],Js=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ha=["J","F","M","A","M","J","J","A","S","O","N","D"];function Zs(r){switch(r){case"narrow":return[...Ha];case"short":return[...Js];case"long":return[...za];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Gs=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ys=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ja=["M","T","W","T","F","S","S"];function Ks(r){switch(r){case"narrow":return[...Ja];case"short":return[...Ys];case"long":return[...Gs];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Qs=["AM","PM"],Za=["Before Christ","Anno Domini"],Ga=["BC","AD"],Ya=["B","A"];function Xs(r){switch(r){case"narrow":return[...Ya];case"short":return[...Ga];case"long":return[...Za];default:return null}}function Ka(r){return Qs[r.hour<12?0:1]}function Qa(r,e){return Ks(e)[r.weekday-1]}function Xa(r,e){return Zs(e)[r.month-1]}function el(r,e){return Xs(e)[r.year<0?0:1]}function tl(r,e,t="always",n=!1){const s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&i){const f=r==="days";switch(e){case 1:return f?"tomorrow":`next ${s[r][0]}`;case-1:return f?"yesterday":`last ${s[r][0]}`;case 0:return f?"today":`this ${s[r][0]}`}}const o=Object.is(e,-0)||e<0,l=Math.abs(e),a=l===1,u=s[r],c=n?a?u[1]:u[2]||u[1]:a?s[r][0]:r;return o?`${l} ${c} ago`:`in ${l} ${c}`}function ei(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const rl={D:ar,DD:ts,DDD:rs,DDDD:ns,t:ss,tt:is,ttt:os,tttt:as,T:ls,TT:cs,TTT:us,TTTT:hs,f:fs,ff:ps,fff:ms,ffff:ws,F:ds,FF:gs,FFF:ys,FFFF:bs};class be{static create(e,t={}){return new be(e,t)}static parseFormat(e){let t=null,n="",s=!1;const i=[];for(let o=0;o<e.length;o++){const l=e.charAt(o);l==="'"?((n.length>0||s)&&i.push({literal:s||/^\s+$/.test(n),val:n===""?"'":n}),t=null,n="",s=!s):s||l===t?n+=l:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=l,t=l)}return n.length>0&&i.push({literal:s||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return rl[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n=void 0){if(this.opts.forceSimple)return ce(e,t);const s={...this.opts};return t>0&&(s.padTo=t),n&&(s.signDisplay=n),this.loc.numberFormatter(s).format(e)}formatDateTimeFromString(e,t){const n=this.loc.listingMode()==="en",s=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(d,p)=>this.loc.extract(e,d,p),o=d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"",l=()=>n?Ka(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(d,p)=>n?Xa(e,d):i(p?{month:d}:{month:d,day:"numeric"},"month"),u=(d,p)=>n?Qa(e,d):i(p?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),c=d=>{const p=be.macroTokenToFormatOpts(d);return p?this.formatWithSystemDefault(e,p):d},f=d=>n?el(e,d):i({era:d},"era"),h=d=>{switch(d){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return l();case"d":return s?i({day:"numeric"},"day"):this.num(e.day);case"dd":return s?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return s?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return s?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return s?i({month:"numeric"},"month"):this.num(e.month);case"MM":return s?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return s?i({year:"numeric"},"year"):this.num(e.year);case"yy":return s?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return s?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return s?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(d)}};return ei(be.parseFormat(t),h)}formatDurationFromString(e,t){const n=this.opts.signMode==="negativeLargestOnly"?-1:1,s=c=>{switch(c[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},i=(c,f)=>h=>{const d=s(h);if(d){const p=f.isNegativeDuration&&d!==f.largestUnit?n:1;let g;return this.opts.signMode==="negativeLargestOnly"&&d!==f.largestUnit?g="never":this.opts.signMode==="all"?g="always":g="auto",this.num(c.get(d)*p,h.length,g)}else return h},o=be.parseFormat(t),l=o.reduce((c,{literal:f,val:h})=>f?c:c.concat(h),[]),a=e.shiftTo(...l.map(s).filter(c=>c)),u={isNegativeDuration:a<0,largestUnit:Object.keys(a.values)[0]};return ei(o,i(a,u))}}const ti=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function At(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function It(...r){return e=>r.reduce(([t,n,s],i)=>{const[o,l,a]=i(e,s);return[{...t,...o},l||n,a]},[{},null,1]).slice(0,2)}function Ct(r,...e){if(r==null)return[null,null];for(const[t,n]of e){const s=t.exec(r);if(s)return n(s)}return[null,null]}function ri(...r){return(e,t)=>{const n={};let s;for(s=0;s<r.length;s++)n[r[s]]=at(e[t+s]);return[n,null,t+s]}}const ni=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,nl=`(?:${ni.source}?(?:\\[(${ti.source})\\])?)?`,ln=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,si=RegExp(`${ln.source}${nl}`),cn=RegExp(`(?:[Tt]${si.source})?`),sl=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,il=/(\d{4})-?W(\d\d)(?:-?(\d))?/,ol=/(\d{4})-?(\d{3})/,al=ri("weekYear","weekNumber","weekDay"),ll=ri("year","ordinal"),cl=/(\d{4})-(\d\d)-(\d\d)/,ii=RegExp(`${ln.source} ?(?:${ni.source}|(${ti.source}))?`),ul=RegExp(`(?: ${ii.source})?`);function Nt(r,e,t){const n=r[e];return $(n)?t:at(n)}function hl(r,e){return[{year:Nt(r,e),month:Nt(r,e+1,1),day:Nt(r,e+2,1)},null,e+3]}function Rt(r,e){return[{hours:Nt(r,e,0),minutes:Nt(r,e+1,0),seconds:Nt(r,e+2,0),milliseconds:sn(r[e+3])},null,e+4]}function Ht(r,e){const t=!r[e]&&!r[e+1],n=pr(r[e+1],r[e+2]),s=t?null:Ee.instance(n);return[{},s,e+3]}function Jt(r,e){const t=r[e]?Ye.create(r[e]):null;return[{},t,e+1]}const fl=RegExp(`^T?${ln.source}$`),dl=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function pl(r){const[e,t,n,s,i,o,l,a,u]=r,c=e[0]==="-",f=a&&a[0]==="-",h=(d,p=!1)=>d!==void 0&&(p||d&&c)?-d:d;return[{years:h(dt(t)),months:h(dt(n)),weeks:h(dt(s)),days:h(dt(i)),hours:h(dt(o)),minutes:h(dt(l)),seconds:h(dt(a),a==="-0"),milliseconds:h(sn(u),f)}]}const gl={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function un(r,e,t,n,s,i,o){const l={year:e.length===2?an(at(e)):at(e),month:Js.indexOf(t)+1,day:at(n),hour:at(s),minute:at(i)};return o&&(l.second=at(o)),r&&(l.weekday=r.length>3?Gs.indexOf(r)+1:Ys.indexOf(r)+1),l}const ml=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function yl(r){const[,e,t,n,s,i,o,l,a,u,c,f]=r,h=un(e,s,n,t,i,o,l);let d;return a?d=gl[a]:u?d=0:d=pr(c,f),[h,new Ee(d)]}function wl(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const bl=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Sl=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,_l=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function oi(r){const[,e,t,n,s,i,o,l]=r;return[un(e,s,n,t,i,o,l),Ee.utcInstance]}function kl(r){const[,e,t,n,s,i,o,l]=r;return[un(e,l,t,n,s,i,o),Ee.utcInstance]}const vl=At(sl,cn),El=At(il,cn),Tl=At(ol,cn),Ol=At(si),ai=It(hl,Rt,Ht,Jt),Al=It(al,Rt,Ht,Jt),Il=It(ll,Rt,Ht,Jt),Cl=It(Rt,Ht,Jt);function Nl(r){return Ct(r,[vl,ai],[El,Al],[Tl,Il],[Ol,Cl])}function Rl(r){return Ct(wl(r),[ml,yl])}function Ll(r){return Ct(r,[bl,oi],[Sl,oi],[_l,kl])}function Dl(r){return Ct(r,[dl,pl])}const Pl=It(Rt);function Ml(r){return Ct(r,[fl,Pl])}const Fl=At(cl,ul),xl=At(ii),jl=It(Rt,Ht,Jt);function Bl(r){return Ct(r,[Fl,ai],[xl,jl])}const li="Invalid Duration",ci={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Ul={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...ci},Me=146097/400,Lt=146097/4800,$l={years:{quarters:4,months:12,weeks:Me/7,days:Me,hours:Me*24,minutes:Me*24*60,seconds:Me*24*60*60,milliseconds:Me*24*60*60*1e3},quarters:{months:3,weeks:Me/28,days:Me/4,hours:Me*24/4,minutes:Me*24*60/4,seconds:Me*24*60*60/4,milliseconds:Me*24*60*60*1e3/4},months:{weeks:Lt/7,days:Lt,hours:Lt*24,minutes:Lt*24*60,seconds:Lt*24*60*60,milliseconds:Lt*24*60*60*1e3},...ci},pt=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Wl=pt.slice(0).reverse();function Ke(r,e,t=!1){const n={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new Z(n)}function ui(r,e){let t=e.milliseconds??0;for(const n of Wl.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function hi(r,e){const t=ui(r,e)<0?-1:1;pt.reduceRight((n,s)=>{if($(e[s]))return n;if(n){const i=e[n]*t,o=r[s][n],l=Math.floor(i/o);e[s]+=l*t,e[n]-=l*o*t}return s},null),pt.reduce((n,s)=>{if($(e[s]))return n;if(n){const i=e[n]%1;e[n]-=i,e[s]+=i*r[n][s]}return s},null)}function fi(r){const e={};for(const[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}class Z{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let n=t?$l:Ul;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||K.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return Z.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new we(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new Z({values:gr(e,Z.normalizeUnit),loc:K.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(ot(e))return Z.fromMillis(e);if(Z.isDuration(e))return e;if(typeof e=="object")return Z.fromObject(e);throw new we(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=Dl(e);return n?Z.fromObject(n,t):Z.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=Ml(e);return n?Z.fromObject(n,t):Z.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new we("need to specify a reason the Duration is invalid");const n=e instanceof Ue?e:new Ue(e,t);if(ne.throwOnInvalid)throw new pa(n);return new Z({invalid:n})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new es(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?be.create(this.loc,n).formatDurationFromString(this,e):li}toHuman(e={}){if(!this.isValid)return li;const t=e.showZeros!==!1,n=pt.map(s=>{const i=this.values[s];return $(i)||i===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:s.slice(0,-1)}).format(i)}).filter(s=>s);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=on(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},B.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?ui(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Z.fromDurationLike(e),n={};for(const s of pt)(Tt(t.values,s)||Tt(this.values,s))&&(n[s]=t.get(s)+this.get(s));return Ke(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=Z.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=Hs(e(this.values[n],n));return Ke(this,{values:t},!0)}get(e){return this[Z.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...gr(e,Z.normalizeUnit)};return Ke(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:s}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:s,conversionAccuracy:n};return Ke(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return hi(this.matrix,e),Ke(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=fi(this.normalize().shiftToAll().toObject());return Ke(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>Z.normalizeUnit(o));const t={},n={},s=this.toObject();let i;for(const o of pt)if(e.indexOf(o)>=0){i=o;let l=0;for(const u in n)l+=this.matrix[u][o]*n[u],n[u]=0;ot(s[o])&&(l+=s[o]);const a=Math.trunc(l);t[o]=a,n[o]=(l*1e3-a*1e3)/1e3}else ot(s[o])&&(n[o]=s[o]);for(const o in n)n[o]!==0&&(t[i]+=o===i?n[o]:n[o]/this.matrix[i][o]);return hi(this.matrix,t),Ke(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Ke(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=fi(this.values);return Ke(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(n,s){return n===void 0||n===0?s===void 0||s===0:n===s}for(const n of pt)if(!t(this.values[n],e.values[n]))return!1;return!0}}const Dt="Invalid Interval";function ql(r,e){return!r||!r.isValid?se.invalid("missing or invalid start"):!e||!e.isValid?se.invalid("missing or invalid end"):e<r?se.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}class se{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new we("need to specify a reason the Interval is invalid");const n=e instanceof Ue?e:new Ue(e,t);if(ne.throwOnInvalid)throw new da(n);return new se({invalid:n})}static fromDateTimes(e,t){const n=Yt(e),s=Yt(t),i=ql(n,s);return i??new se({start:n,end:s})}static after(e,t){const n=Z.fromDurationLike(t),s=Yt(e);return se.fromDateTimes(s,s.plus(n))}static before(e,t){const n=Z.fromDurationLike(t),s=Yt(e);return se.fromDateTimes(s.minus(n),s)}static fromISO(e,t){const[n,s]=(e||"").split("/",2);if(n&&s){let i,o;try{i=B.fromISO(n,t),o=i.isValid}catch{o=!1}let l,a;try{l=B.fromISO(s,t),a=l.isValid}catch{a=!1}if(o&&a)return se.fromDateTimes(i,l);if(o){const u=Z.fromISO(s,t);if(u.isValid)return se.after(i,u)}else if(a){const u=Z.fromISO(n,t);if(u.isValid)return se.before(l,u)}}return se.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const n=this.start.startOf(e,t);let s;return t?.useLocaleWeeks?s=this.end.reconfigure({locale:n.locale}):s=this.end,s=s.startOf(e,t),Math.floor(s.diff(n,e).get(e))+(s.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?se.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Yt).filter(o=>this.contains(o)).sort((o,l)=>o.toMillis()-l.toMillis()),n=[];let{s}=this,i=0;for(;s<this.e;){const o=t[i]||this.e,l=+o>+this.e?this.e:o;n.push(se.fromDateTimes(s,l)),s=l,i+=1}return n}splitBy(e){const t=Z.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,s=1,i;const o=[];for(;n<this.e;){const l=this.start.plus(t.mapUnits(a=>a*s));i=+l>+this.e?this.e:l,o.push(se.fromDateTimes(n,i)),n=i,s+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:se.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return se.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((s,i)=>s.s-i.s).reduce(([s,i],o)=>i?i.overlaps(o)||i.abutsStart(o)?[s,i.union(o)]:[s.concat([i]),o]:[s,o],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const s=[],i=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...i),l=o.sort((a,u)=>a.time-u.time);for(const a of l)n+=a.type==="s"?1:-1,n===1?t=a.time:(t&&+t!=+a.time&&s.push(se.fromDateTimes(t,a.time)),t=null);return se.merge(s)}difference(...e){return se.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Dt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=ar,t={}){return this.isValid?be.create(this.s.loc.clone(t),e).formatInterval(this):Dt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Dt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Dt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Dt}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Dt}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Z.invalid(this.invalidReason)}mapEndpoints(e){return se.fromDateTimes(e(this.s),e(this.e))}}class yr{static hasDST(e=ne.defaultZone){const t=B.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Ye.isValidZone(e)}static normalizeZone(e){return it(e,ne.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||K.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||K.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||K.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||K.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||K.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null}={}){return(s||K.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null}={}){return(s||K.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return K.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return K.create(t,null,"gregory").eras(e)}static features(){return{relative:$s(),localeWeek:Ws()}}}function di(r,e){const t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(Z.fromMillis(n).as("days"))}function Vl(r,e,t){const n=[["years",(a,u)=>u.year-a.year],["quarters",(a,u)=>u.quarter-a.quarter+(u.year-a.year)*4],["months",(a,u)=>u.month-a.month+(u.year-a.year)*12],["weeks",(a,u)=>{const c=di(a,u);return(c-c%7)/7}],["days",di]],s={},i=r;let o,l;for(const[a,u]of n)t.indexOf(a)>=0&&(o=a,s[a]=u(r,e),l=i.plus(s),l>e?(s[a]--,r=i.plus(s),r>e&&(l=r,s[a]--,r=i.plus(s))):r=l);return[r,s,l,o]}function zl(r,e,t,n){let[s,i,o,l]=Vl(r,e,t);const a=e-s,u=t.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);u.length===0&&(o<e&&(o=s.plus({[l]:1})),o!==s&&(i[l]=(i[l]||0)+a/(o-s)));const c=Z.fromObject(i,n);return u.length>0?Z.fromMillis(a,n).shiftTo(...u).plus(c):c}const Hl="missing Intl.DateTimeFormat.formatToParts support";function Y(r,e=t=>t){return{regex:r,deser:([t])=>e(Fa(t))}}const pi="[ \xA0]",gi=new RegExp(pi,"g");function Jl(r){return r.replace(/\./g,"\\.?").replace(gi,pi)}function mi(r){return r.replace(/\./g,"").replace(gi," ").toLowerCase()}function $e(r,e){return r===null?null:{regex:RegExp(r.map(Jl).join("|")),deser:([t])=>r.findIndex(n=>mi(t)===mi(n))+e}}function yi(r,e){return{regex:r,deser:([,t,n])=>pr(t,n),groups:e}}function wr(r){return{regex:r,deser:([e])=>e}}function Zl(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Gl(r,e){const t=Be(e),n=Be(e,"{2}"),s=Be(e,"{3}"),i=Be(e,"{4}"),o=Be(e,"{6}"),l=Be(e,"{1,2}"),a=Be(e,"{1,3}"),u=Be(e,"{1,6}"),c=Be(e,"{1,9}"),f=Be(e,"{2,4}"),h=Be(e,"{4,6}"),d=m=>({regex:RegExp(Zl(m.val)),deser:([y])=>y,literal:!0}),g=(m=>{if(r.literal)return d(m);switch(m.val){case"G":return $e(e.eras("short"),0);case"GG":return $e(e.eras("long"),0);case"y":return Y(u);case"yy":return Y(f,an);case"yyyy":return Y(i);case"yyyyy":return Y(h);case"yyyyyy":return Y(o);case"M":return Y(l);case"MM":return Y(n);case"MMM":return $e(e.months("short",!0),1);case"MMMM":return $e(e.months("long",!0),1);case"L":return Y(l);case"LL":return Y(n);case"LLL":return $e(e.months("short",!1),1);case"LLLL":return $e(e.months("long",!1),1);case"d":return Y(l);case"dd":return Y(n);case"o":return Y(a);case"ooo":return Y(s);case"HH":return Y(n);case"H":return Y(l);case"hh":return Y(n);case"h":return Y(l);case"mm":return Y(n);case"m":return Y(l);case"q":return Y(l);case"qq":return Y(n);case"s":return Y(l);case"ss":return Y(n);case"S":return Y(a);case"SSS":return Y(s);case"u":return wr(c);case"uu":return wr(l);case"uuu":return Y(t);case"a":return $e(e.meridiems(),0);case"kkkk":return Y(i);case"kk":return Y(f,an);case"W":return Y(l);case"WW":return Y(n);case"E":case"c":return Y(t);case"EEE":return $e(e.weekdays("short",!1),1);case"EEEE":return $e(e.weekdays("long",!1),1);case"ccc":return $e(e.weekdays("short",!0),1);case"cccc":return $e(e.weekdays("long",!0),1);case"Z":case"ZZ":return yi(new RegExp(`([+-]${l.source})(?::(${n.source}))?`),2);case"ZZZ":return yi(new RegExp(`([+-]${l.source})(${n.source})?`),2);case"z":return wr(/[a-z_+-/]{1,256}?/i);case" ":return wr(/[^\S\n\r]/);default:return d(m)}})(r)||{invalidReason:Hl};return g.token=r,g}const Yl={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Kl(r,e,t){const{type:n,value:s}=r;if(n==="literal"){const a=/^\s+$/.test(s);return{literal:!a,val:a?" ":s}}const i=e[n];let o=n;n==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let l=Yl[o];if(typeof l=="object"&&(l=l[i]),l)return{literal:!1,val:l}}function Ql(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function Xl(r,e,t){const n=r.match(e);if(n){const s={};let i=1;for(const o in t)if(Tt(t,o)){const l=t[o],a=l.groups?l.groups+1:1;!l.literal&&l.token&&(s[l.token.val[0]]=l.deser(n.slice(i,i+a))),i+=a}return[n,s]}else return[n,{}]}function ec(r){const e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,n;return $(r.z)||(t=Ye.create(r.z)),$(r.Z)||(t||(t=new Ee(r.Z)),n=r.Z),$(r.q)||(r.M=(r.q-1)*3+1),$(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),$(r.u)||(r.S=sn(r.u)),[Object.keys(r).reduce((i,o)=>{const l=e(o);return l&&(i[l]=r[o]),i},{}),t,n]}let hn=null;function tc(){return hn||(hn=B.fromMillis(1555555555555)),hn}function rc(r,e){if(r.literal)return r;const t=be.macroTokenToFormatOpts(r.val),n=_i(t,e);return n==null||n.includes(void 0)?r:n}function wi(r,e){return Array.prototype.concat(...r.map(t=>rc(t,e)))}class bi{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=wi(be.parseFormat(t),e),this.units=this.tokens.map(n=>Gl(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,s]=Ql(this.units);this.regex=RegExp(n,"i"),this.handlers=s}}explainFromTokens(e){if(this.isValid){const[t,n]=Xl(e,this.regex,this.handlers),[s,i,o]=n?ec(n):[null,null,void 0];if(Tt(n,"a")&&Tt(n,"H"))throw new Et("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:s,zone:i,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function Si(r,e,t){return new bi(r,t).explainFromTokens(e)}function nc(r,e,t){const{result:n,zone:s,specificOffset:i,invalidReason:o}=Si(r,e,t);return[n,s,i,o]}function _i(r,e){if(!r)return null;const n=be.create(e,r).dtFormatter(tc()),s=n.formatToParts(),i=n.resolvedOptions();return s.map(o=>Kl(o,r,i))}const fn="Invalid DateTime",ki=864e13;function Zt(r){return new Ue("unsupported zone",`the zone "${r.name}" is not supported`)}function dn(r){return r.weekData===null&&(r.weekData=ur(r.c)),r.weekData}function pn(r){return r.localWeekData===null&&(r.localWeekData=ur(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function gt(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new B({...t,...e,old:t})}function vi(r,e,t){let n=r-e*60*1e3;const s=t.offset(n);if(e===s)return[n,e];n-=(s-e)*60*1e3;const i=t.offset(n);return s===i?[n,s]:[r-Math.min(s,i)*60*1e3,Math.max(s,i)]}function br(r,e){r+=e*60*1e3;const t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Sr(r,e,t){return vi(dr(r),e,t)}function Ei(r,e){const t=r.o,n=r.c.year+Math.trunc(e.years),s=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...r.c,year:n,month:s,day:Math.min(r.c.day,fr(n,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=Z.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),l=dr(i);let[a,u]=vi(l,t,r.zone);return o!==0&&(a+=o,u=r.zone.offset(a)),{ts:a,o:u}}function Pt(r,e,t,n,s,i){const{setZone:o,zone:l}=t;if(r&&Object.keys(r).length!==0||e){const a=e||l,u=B.fromObject(r,{...t,zone:a,specificOffset:i});return o?u:u.setZone(l)}else return B.invalid(new Ue("unparsable",`the input "${s}" can't be parsed as ${n}`))}function _r(r,e,t=!0){return r.isValid?be.create(K.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function gn(r,e,t){const n=r.c.year>9999||r.c.year<0;let s="";if(n&&r.c.year>=0&&(s+="+"),s+=ce(r.c.year,n?6:4),t==="year")return s;if(e){if(s+="-",s+=ce(r.c.month),t==="month")return s;s+="-"}else if(s+=ce(r.c.month),t==="month")return s;return s+=ce(r.c.day),s}function Ti(r,e,t,n,s,i,o){let l=!t||r.c.millisecond!==0||r.c.second!==0,a="";switch(o){case"day":case"month":case"year":break;default:if(a+=ce(r.c.hour),o==="hour")break;if(e){if(a+=":",a+=ce(r.c.minute),o==="minute")break;l&&(a+=":",a+=ce(r.c.second))}else{if(a+=ce(r.c.minute),o==="minute")break;l&&(a+=ce(r.c.second))}if(o==="second")break;l&&(!n||r.c.millisecond!==0)&&(a+=".",a+=ce(r.c.millisecond,3))}return s&&(r.isOffsetFixed&&r.offset===0&&!i?a+="Z":r.o<0?(a+="-",a+=ce(Math.trunc(-r.o/60)),a+=":",a+=ce(Math.trunc(-r.o%60))):(a+="+",a+=ce(Math.trunc(r.o/60)),a+=":",a+=ce(Math.trunc(r.o%60)))),i&&(a+="["+r.zone.ianaName+"]"),a}const Oi={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},sc={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ic={ordinal:1,hour:0,minute:0,second:0,millisecond:0},kr=["year","month","day","hour","minute","second","millisecond"],oc=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],ac=["year","ordinal","hour","minute","second","millisecond"];function vr(r){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new es(r);return e}function Ai(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return vr(r)}}function lc(r){if(Gt===void 0&&(Gt=ne.now()),r.type!=="iana")return r.offset(Gt);const e=r.name;let t=mn.get(e);return t===void 0&&(t=r.offset(Gt),mn.set(e,t)),t}function Ii(r,e){const t=it(e.zone,ne.defaultZone);if(!t.isValid)return B.invalid(Zt(t));const n=K.fromObject(e);let s,i;if($(r.year))s=ne.now();else{for(const a of kr)$(r[a])&&(r[a]=Oi[a]);const o=Bs(r)||Us(r);if(o)return B.invalid(o);const l=lc(t);[s,i]=Sr(r,l,t)}return new B({ts:s,zone:t,loc:n,o:i})}function Ci(r,e,t){const n=$(t.round)?!0:t.round,s=$(t.rounding)?"trunc":t.rounding,i=(l,a)=>(l=on(l,n||t.calendary?0:2,t.calendary?"round":s),e.loc.clone(t).relFormatter(t).format(l,a)),o=l=>t.calendary?e.hasSame(r,l)?0:e.startOf(l).diff(r.startOf(l),l).get(l):e.diff(r,l).get(l);if(t.unit)return i(o(t.unit),t.unit);for(const l of t.units){const a=o(l);if(Math.abs(a)>=1)return i(a,l)}return i(r>e?-0:0,t.units[t.units.length-1])}function Ni(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}let Gt;const mn=new Map;class B{constructor(e){const t=e.zone||ne.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Ue("invalid input"):null)||(t.isValid?null:Zt(t));this.ts=$(e.ts)?ne.now():e.ts;let s=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[s,i]=[e.old.c,e.old.o];else{const l=ot(e.o)&&!e.old?e.o:t.offset(this.ts);s=br(this.ts,l),n=Number.isNaN(s.year)?new Ue("invalid input"):null,s=n?null:s,i=n?null:l}this._zone=t,this.loc=e.loc||K.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=s,this.o=i,this.isLuxonDateTime=!0}static now(){return new B({})}static local(){const[e,t]=Ni(arguments),[n,s,i,o,l,a,u]=t;return Ii({year:n,month:s,day:i,hour:o,minute:l,second:a,millisecond:u},e)}static utc(){const[e,t]=Ni(arguments),[n,s,i,o,l,a,u]=t;return e.zone=Ee.utcInstance,Ii({year:n,month:s,day:i,hour:o,minute:l,second:a,millisecond:u},e)}static fromJSDate(e,t={}){const n=$a(e)?e.valueOf():NaN;if(Number.isNaN(n))return B.invalid("invalid input");const s=it(t.zone,ne.defaultZone);return s.isValid?new B({ts:n,zone:s,loc:K.fromObject(t)}):B.invalid(Zt(s))}static fromMillis(e,t={}){if(ot(e))return e<-ki||e>ki?B.invalid("Timestamp out of range"):new B({ts:e,zone:it(t.zone,ne.defaultZone),loc:K.fromObject(t)});throw new we(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ot(e))return new B({ts:e*1e3,zone:it(t.zone,ne.defaultZone),loc:K.fromObject(t)});throw new we("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=it(t.zone,ne.defaultZone);if(!n.isValid)return B.invalid(Zt(n));const s=K.fromObject(t),i=gr(e,Ai),{minDaysInFirstWeek:o,startOfWeek:l}=js(i,s),a=ne.now(),u=$(t.specificOffset)?n.offset(a):t.specificOffset,c=!$(i.ordinal),f=!$(i.year),h=!$(i.month)||!$(i.day),d=f||h,p=i.weekYear||i.weekNumber;if((d||c)&&p)throw new Et("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&c)throw new Et("Can't mix ordinal dates with month/day");const g=p||i.weekday&&!d;let m,y,w=br(a,u);g?(m=oc,y=sc,w=ur(w,o,l)):c?(m=ac,y=ic,w=rn(w)):(m=kr,y=Oi);let _=!1;for(const F of m){const J=i[F];$(J)?_?i[F]=y[F]:i[F]=w[F]:_=!0}const b=g?ja(i,o,l):c?Ba(i):Bs(i),v=b||Us(i);if(v)return B.invalid(v);const S=g?Fs(i,o,l):c?xs(i):i,[E,L]=Sr(S,u,n),x=new B({ts:E,zone:n,o:L,loc:s});return i.weekday&&d&&e.weekday!==x.weekday?B.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${x.toISO()}`):x.isValid?x:B.invalid(x.invalid)}static fromISO(e,t={}){const[n,s]=Nl(e);return Pt(n,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,s]=Rl(e);return Pt(n,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,s]=Ll(e);return Pt(n,s,t,"HTTP",t)}static fromFormat(e,t,n={}){if($(e)||$(t))throw new we("fromFormat requires an input string and a format");const{locale:s=null,numberingSystem:i=null}=n,o=K.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0}),[l,a,u,c]=nc(o,e,t);return c?B.invalid(c):Pt(l,a,n,`format ${t}`,e,u)}static fromString(e,t,n={}){return B.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,s]=Bl(e);return Pt(n,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new we("need to specify a reason the DateTime is invalid");const n=e instanceof Ue?e:new Ue(e,t);if(ne.throwOnInvalid)throw new fa(n);return new B({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=_i(e,K.fromObject(t));return n?n.map(s=>s?s.val:null).join(""):null}static expandFormat(e,t={}){return wi(be.parseFormat(e),K.fromObject(t)).map(s=>s.val).join("")}static resetCache(){Gt=void 0,mn.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?dn(this).weekYear:NaN}get weekNumber(){return this.isValid?dn(this).weekNumber:NaN}get weekday(){return this.isValid?dn(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?pn(this).weekday:NaN}get localWeekNumber(){return this.isValid?pn(this).weekNumber:NaN}get localWeekYear(){return this.isValid?pn(this).weekYear:NaN}get ordinal(){return this.isValid?rn(this.c).ordinal:NaN}get monthShort(){return this.isValid?yr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?yr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?yr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?yr.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,n=dr(this.c),s=this.zone.offset(n-e),i=this.zone.offset(n+e),o=this.zone.offset(n-s*t),l=this.zone.offset(n-i*t);if(o===l)return[this];const a=n-o*t,u=n-l*t,c=br(a,o),f=br(u,l);return c.hour===f.hour&&c.minute===f.minute&&c.second===f.second&&c.millisecond===f.millisecond?[gt(this,{ts:a}),gt(this,{ts:u})]:[this]}get isInLeapYear(){return qt(this.year)}get daysInMonth(){return fr(this.year,this.month)}get daysInYear(){return this.isValid?Ot(this.year):NaN}get weeksInWeekYear(){return this.isValid?Vt(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Vt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:s}=be.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(Ee.instance(e),t)}toLocal(){return this.setZone(ne.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=it(e,ne.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||n){const i=e.offset(this.ts),o=this.toObject();[s]=Sr(o,i,e)}return gt(this,{ts:s,zone:e})}else return B.invalid(Zt(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return gt(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=gr(e,Ai),{minDaysInFirstWeek:n,startOfWeek:s}=js(t,this.loc),i=!$(t.weekYear)||!$(t.weekNumber)||!$(t.weekday),o=!$(t.ordinal),l=!$(t.year),a=!$(t.month)||!$(t.day),u=l||a,c=t.weekYear||t.weekNumber;if((u||o)&&c)throw new Et("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Et("Can't mix ordinal dates with month/day");let f;i?f=Fs({...ur(this.c,n,s),...t},n,s):$(t.ordinal)?(f={...this.toObject(),...t},$(t.day)&&(f.day=Math.min(fr(f.year,f.month),f.day))):f=xs({...rn(this.c),...t});const[h,d]=Sr(f,this.o,this.zone);return gt(this,{ts:h,o:d})}plus(e){if(!this.isValid)return this;const t=Z.fromDurationLike(e);return gt(this,Ei(this,t))}minus(e){if(!this.isValid)return this;const t=Z.fromDurationLike(e).negate();return gt(this,Ei(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},s=Z.normalizeUnit(e);switch(s){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(s==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:o}=this;o<i&&(n.weekNumber=this.weekNumber-1),n.weekday=i}else n.weekday=1;if(s==="quarters"){const i=Math.ceil(this.month/3);n.month=(i-1)*3+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?be.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):fn}toLocaleString(e=ar,t={}){return this.isValid?be.create(this.loc.clone(t),e).formatDateTime(this):fn}toLocaleParts(e={}){return this.isValid?be.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:s=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=vr(o);const l=e==="extended";let a=gn(this,l,o);return kr.indexOf(o)>=3&&(a+="T"),a+=Ti(this,l,t,n,s,i,o),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?gn(this,e==="extended",vr(t)):null}toISOWeekDate(){return _r(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:s=!1,extendedZone:i=!1,format:o="extended",precision:l="milliseconds"}={}){return this.isValid?(l=vr(l),(s&&kr.indexOf(l)>=3?"T":"")+Ti(this,o==="extended",t,e,n,i,l)):null}toRFC2822(){return _r(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return _r(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?gn(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let s="HH:mm:ss.SSS";return(t||e)&&(n&&(s+=" "),t?s+="z":e&&(s+="ZZ")),_r(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():fn}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return Z.invalid("created by diffing an invalid DateTime");const s={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=Wa(t).map(Z.normalizeUnit),o=e.valueOf()>this.valueOf(),l=o?this:e,a=o?e:this,u=zl(l,a,i,s);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(B.now(),e,t)}until(e){return this.isValid?se.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const s=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=s&&s<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||B.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let s=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(s=e.unit,i=void 0),Ci(t,this.plus(n),{...e,numeric:"always",units:s,unit:i})}toRelativeCalendar(e={}){return this.isValid?Ci(e.base||B.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(B.isDateTime))throw new we("min requires all arguments be DateTimes");return qs(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(B.isDateTime))throw new we("max requires all arguments be DateTimes");return qs(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:s=null,numberingSystem:i=null}=n,o=K.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});return Si(o,e,t)}static fromStringExplain(e,t,n={}){return B.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:s=null}=t,i=K.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0});return new bi(i,e)}static fromFormatParser(e,t,n={}){if($(e)||$(t))throw new we("fromFormatParser requires an input string and a format parser");const{locale:s=null,numberingSystem:i=null}=n,o=K.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new we(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:l,zone:a,specificOffset:u,invalidReason:c}=t.explainFromTokens(e);return c?B.invalid(c):Pt(l,a,n,`format ${t.format}`,e,u)}static get DATE_SHORT(){return ar}static get DATE_MED(){return ts}static get DATE_MED_WITH_WEEKDAY(){return ga}static get DATE_FULL(){return rs}static get DATE_HUGE(){return ns}static get TIME_SIMPLE(){return ss}static get TIME_WITH_SECONDS(){return is}static get TIME_WITH_SHORT_OFFSET(){return os}static get TIME_WITH_LONG_OFFSET(){return as}static get TIME_24_SIMPLE(){return ls}static get TIME_24_WITH_SECONDS(){return cs}static get TIME_24_WITH_SHORT_OFFSET(){return us}static get TIME_24_WITH_LONG_OFFSET(){return hs}static get DATETIME_SHORT(){return fs}static get DATETIME_SHORT_WITH_SECONDS(){return ds}static get DATETIME_MED(){return ps}static get DATETIME_MED_WITH_SECONDS(){return gs}static get DATETIME_MED_WITH_WEEKDAY(){return ma}static get DATETIME_FULL(){return ms}static get DATETIME_FULL_WITH_SECONDS(){return ys}static get DATETIME_HUGE(){return ws}static get DATETIME_HUGE_WITH_SECONDS(){return bs}}function Yt(r){if(B.isDateTime(r))return r;if(r&&r.valueOf&&ot(r.valueOf()))return B.fromJSDate(r);if(r&&typeof r=="object")return B.fromObject(r);throw new we(`Unknown datetime argument: ${r}, of type ${typeof r}`)}const ge=[];for(let r=0;r<256;++r)ge.push((r+256).toString(16).slice(1));function cc(r,e,t,n){return()=>{r|=0,e|=0,t|=0,n|=0;const s=(r+e|0)+n|0;return n=n+1|0,r=e^e>>>9,e=t+(t<<3)|0,t=(t<<21|t>>>11)+s|0,s>>>0}}function uc(){const r=new Uint8Array(16),e=BigInt(Date.now()),t=BigInt(Math.floor(performance.now()*1e3)%65535),n=e<<16n|t;r[0]=Number(n>>40n&0xffn),r[1]=Number(n>>32n&0xffn),r[2]=Number(n>>24n&0xffn),r[3]=Number(n>>16n&0xffn),r[4]=Number(n>>8n&0xffn),r[5]=Number(n&0xffn);const s=(Math.random()*4294967295^Date.now()^performance.now())>>>0,i=cc(2654435769,608135816,3084996962,s),o=new DataView(r.buffer);return o.setUint32(6,i()),o.setUint32(10,i()),o.setUint16(14,i()),r[6]=112|r[6]&15,r[8]=128|r[8]&63,(ge[r[0]]+ge[r[1]]+ge[r[2]]+ge[r[3]]+"-"+ge[r[4]]+ge[r[5]]+"-"+ge[r[6]]+ge[r[7]]+"-"+ge[r[8]]+ge[r[9]]+"-"+ge[r[10]]+ge[r[11]]+ge[r[12]]+ge[r[13]]+ge[r[14]]+ge[r[15]]).toLowerCase()}const hc=/[&<>'"]/g,fc=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g,dc={"&":"&amp","<":"&lt",">":"&gt","'":"&#39",'"':"&quot"},pc={"&amp":"&","&#38":"&","&lt":"<","&#60":"<","&gt":">","&#62":">","&apos":"'","&#39":"'","&quot":'"',"&#34":'"'};class gc{getRandom(e=8){return[...Array(e)].map(()=>Math.trunc(Math.random()*36).toString(36)).join("")}getUniqId(){return"xxxxxxxx-xlsx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.trunc(Math.random()*16);return(e==="x"?t:t&3|8).toString(16)})}getUuidRfc4122(){return uc()}encode(e){return C.isString(e)?e.replace(hc,t=>dc[t]):e}decode(e){return C.isString(e)?e.replace(fc,t=>pc[t]):e}toNumber(e){const t=Number.parseFloat(e);return C.isNumber(t)?t:0}toInteger(e){return this.toNumber(Number.parseInt(e,10))}toBoolean(e,t=[]){const n=C.isString(e)?e.toLowerCase():e;return["true","y","1",1,!0,...t].includes(n)}toCamelCase(e){if(!C.isStringFilled(e))return e;const t=/[-_\s]+(.)?/g;return t.test(e)?(e=e.toLowerCase(),e=e.replace(t,(n,s)=>s?s.toUpperCase():""),e[0].toLowerCase()+e.substring(1)):e.match(/^[A-Z]+$/)?e.toLowerCase():e[0].toLowerCase()+e.slice(1)}toPascalCase(e){return C.isStringFilled(e)?this.capitalize(this.toCamelCase(e)):e}toKebabCase(e){if(!C.isStringFilled(e))return e;const t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);return t?t.map(n=>n.toLowerCase()).join("-"):e}capitalize(e){return C.isStringFilled(e)?e[0].toUpperCase()+e.substring(1):e}numberFormat(e,t=0,n=".",s=","){const i=Number.isFinite(e)?e:0,o=Number.isFinite(t)?Math.abs(t):0,l=(o?((a,u)=>{const c=Math.pow(10,u);return Math.round(a*c)/c})(i,o):Math.round(i)).toString().split(".");return l[0].length>3&&(l[0]=l[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,s)),(l[1]||"").length<o&&(l[1]=l[1]||"",l[1]+=new Array(o-l[1].length+1).join("0")),l.join(n)}toDateTime(e,t,n){return!(typeof t>"u")&&C.isStringFilled(t)?B.fromFormat(e,t,n):B.fromISO(e,n)}getDateForLog(){return B.now().toFormat("y-MM-dd HH:mm:ss")}buildQueryString(e){let t="";for(const n in e){if(!e.hasOwnProperty(n))continue;const s=e[n];C.isArray(s)?s.forEach((i,o)=>{t+=encodeURIComponent(n+"["+o+"]")+"="+encodeURIComponent(i)+"&"}):t+=encodeURIComponent(n)+"="+encodeURIComponent(s)+"&"}return t.length>0&&(t=t.substring(0,t.length-1)),t}}const W=new gc;let de="";try{de=navigator?.userAgent.toLowerCase()}catch{de="?"}let mc=class{isOpera(){return de.includes("opera")}isIE(){return"attachEvent"in document&&!this.isOpera()}isIE6(){return de.includes("msie 6")}isIE7(){return de.includes("msie 7")}isIE8(){return de.includes("msie 8")}isIE9(){return"documentMode"in document&&document.documentMode>=9}isIE10(){return"documentMode"in document&&document.documentMode>=10}isSafari(){return de.includes("safari")&&!de.includes("chrome")}isFirefox(){return de.includes("firefox")}isChrome(){return de.includes("chrome")}detectIEVersion(){if(this.isOpera()||this.isSafari()||this.isFirefox()||this.isChrome())return-1;let e=-1;if(window.MSStream&&!window.ActiveXObject&&"ActiveXObject"in window?e=11:this.isIE10()?e=10:this.isIE9()?e=9:this.isIE()&&(e=8),e===-1||e===8){if(navigator.appName==="Microsoft Internet Explorer"){const t=new RegExp("MSIE ([0-9]+[.0-9]*)"),n=navigator.userAgent.match(t);C.isArrayLike(n)&&n.length>0&&(e=Number.parseFloat(n[1]))}if(navigator.appName==="Netscape"){e=11;const t=new RegExp("Trident/.*rv:([0-9]+[.0-9]*)");if(t.exec(navigator.userAgent)!=null){const n=navigator.userAgent.match(t);C.isArrayLike(n)&&n.length>0&&(e=Number.parseFloat(n[1]))}}}return e}isIE11(){return this.detectIEVersion()>=11}isMac(){return de.includes("macintosh")}isWin(){return de.includes("windows")}isLinux(){return de.includes("linux")&&!this.isAndroid()}isAndroid(){return de.includes("android")}isIPad(){return de.includes("ipad;")||this.isMac()&&this.isTouchDevice()}isIPhone(){return de.includes("iphone;")}isIOS(){return this.isIPad()||this.isIPhone()}isMobile(){return this.isIPhone()||this.isIPad()||this.isAndroid()||de.includes("mobile")||de.includes("touch")}isRetina(){return(window.devicePixelRatio&&window.devicePixelRatio>=2)===!0}isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}isDoctype(e){const t=e||document;return t.compatMode?t.compatMode==="CSS1Compat":t.documentElement&&t.documentElement.clientHeight}isLocalStorageSupported(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch{return!1}}detectAndroidVersion(){const e=new RegExp("Android ([0-9]+[.0-9]*)");if(e.exec(navigator.userAgent)!=null){const t=navigator.userAgent.match(e);if(C.isArrayLike(t)&&t.length>0)return Number.parseFloat(t[1])}return 0}};const Ri=new mc,Li={sleep:1e3,speed:.001,amount:30},yn={sleep:600,speed:.01,amount:150};var Di=(r=>(r.undefined="UNDEFINED",r.lead="CRM_LEAD",r.deal="CRM_DEAL",r.contact="CRM_CONTACT",r.company="CRM_COMPANY",r.oldInvoice="CRM_INVOICE",r.invoice="CRM_SMART_INVOICE",r.quote="CRM_QUOTE",r.requisite="CRM_REQUISITE",r.order="ORDER",r))(Di||{}),We=(r=>(r[r.undefined=0]="undefined",r[r.lead=1]="lead",r[r.deal=2]="deal",r[r.contact=3]="contact",r[r.company=4]="company",r[r.oldInvoice=5]="oldInvoice",r[r.invoice=31]="invoice",r[r.quote=7]="quote",r[r.requisite=8]="requisite",r[r.order=14]="order",r))(We||{}),wn=(r=>(r.undefined="?",r.lead="L",r.deal="D",r.contact="C",r.company="CO",r.oldInvoice="I",r.invoice="SI",r.quote="Q",r.requisite="RQ",r.order="O",r))(wn||{});function yc(r){const e=We[r];return wn[e]||"?"}var Pi=(r=>(r[r.undefined=0]="undefined",r[r.absolute=1]="absolute",r[r.percentage=2]="percentage",r))(Pi||{}),Mi=(r=>(r[r.undefined=0]="undefined",r[r.product=1]="product",r[r.service=7]="service",r[r.sku=3]="sku",r[r.skuEmpty=6]="skuEmpty",r[r.offer=4]="offer",r[r.offerEmpty=5]="offerEmpty",r))(Mi||{}),Fi=(r=>(r.undefined="UNDEFINED",r.detail="DETAIL_PICTURE",r.preview="PREVIEW_PICTURE",r.morePhoto="MORE_PHOTO",r))(Fi||{}),xi=(r=>(r[r.undefined=0]="undefined",r[r.mathematical=1]="mathematical",r[r.roundingUp=2]="roundingUp",r[r.roundingDown=4]="roundingDown",r))(xi||{}),ji=(r=>(r.undefined="undefined",r.b24="b24",r.box="box",r))(ji||{}),Bi=(r=>(r.undefined="undefined",r.crm="crm",r.disk="disk",r.lists="lists",r))(Bi||{}),Ui=(r=>(r.undefined="undefined",r.lead="CCrmDocumentLead",r.company="CCrmDocumentCompany",r.contact="CCrmDocumentContact",r.deal="CCrmDocumentDeal",r.invoice="Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice",r.quote="Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote",r.order="Bitrix\\Crm\\Integration\\BizProc\\Document\\Order",r.dynamic="Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic",r.disk="Bitrix\\Disk\\BizProcDocument",r.lists="BizprocDocument",r.listsList="Bitrix\\Lists\\BizprocDocumentLists",r))(Ui||{});function wc(r){switch(r){case"CCrmDocumentLead":return We.lead;case"CCrmDocumentCompany":return We.company;case"CCrmDocumentContact":return We.contact;case"CCrmDocumentDeal":return We.deal;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":return We.invoice;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":return We.quote;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":return We.order}return We.undefined}function bn(r,e){let t="",n="undefined";switch(r){case"CCrmDocumentLead":n="crm",t="LEAD";break;case"CCrmDocumentCompany":n="crm",t="COMPANY";break;case"CCrmDocumentContact":n="crm",t="CONTACT";break;case"CCrmDocumentDeal":n="crm",t="DEAL";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":n="crm",t="SMART_INVOICE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":n="crm",t="QUOTE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":n="crm",t="ORDER";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(n="crm",t=`DYNAMIC_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Disk\\BizProcDocument":if(n="disk",t=`STORAGE_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"BizprocDocument":if(n="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Lists\\BizprocDocumentLists":if(n="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break}return[n,r,t]}function bc(r,e,t){let n="";const s=bn(r,1);switch(r){case"CCrmDocumentLead":n=`LEAD_${e}`;break;case"CCrmDocumentCompany":n=`COMPANY_${e}`;break;case"CCrmDocumentContact":n=`CONTACT_${e}`;break;case"CCrmDocumentDeal":n=`DEAL_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":n=`SMART_INVOICE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":n=`QUOTE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":n=`ORDER_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(n=`DYNAMIC_${t||0}_${e}`,(t||0)<1)throw new Error("Need set dynamicId");break;case"Bitrix\\Disk\\BizProcDocument":n=`${e}`;break;case"BizprocDocument":n=`${e}`;break;case"Bitrix\\Lists\\BizprocDocumentLists":n=`${e}`;break}return[s[0],s[1],n]}function Sc(r){const e=bn(r,1);return[e[0],e[1]]}var ee=(r=>(r.App="app",r.Profile="profile",r.Currency="currency",r.AppOptions="appOptions",r.UserOptions="userOptions",r))(ee||{});const Qe={Free:"F",Demo:"D",Trial:"T",Paid:"P",Local:"L",Subscription:"S"},$i={[Qe.Free]:"Free",[Qe.Demo]:"Demo",[Qe.Trial]:"Trial",[Qe.Paid]:"Paid",[Qe.Local]:"Local",[Qe.Subscription]:"Subscription"},mt={MainSettings:"MainSettings",UfList:"UfList",UfPage:"UfPage"};var Xe=(r=>(r.NotSet="notSet",r.JsonArray="jsonArray",r.JsonObject="jsonObject",r.FloatVal="float",r.IntegerVal="integer",r.BoolYN="boolYN",r.StringVal="string",r))(Xe||{}),te=(r=>(r.Undefined="undefined",r.WebSocket="webSocket",r.LongPolling="longPolling",r))(te||{}),Ne=(r=>(r.PullConfig="bx-pull-config",r.WebsocketBlocked="bx-pull-websocket-blocked",r.LongPollingBlocked="bx-pull-longpolling-blocked",r.LoggingEnabled="bx-pull-logging-enabled",r))(Ne||{}),Re=(r=>(r.Online="online",r.Offline="offline",r.Connecting="connect",r))(Re||{}),Er=(r=>(r[r.Unknown=0]="Unknown",r[r.Client=1]="Client",r[r.Backend=2]="Backend",r))(Er||{}),Le=(r=>(r.Server="server",r.Client="client",r.Online="online",r.Status="status",r.Revision="revision",r))(Le||{}),Se=(r=>(r[r.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",r[r.SERVER_DIE=1001]="SERVER_DIE",r[r.CONFIG_REPLACED=3e3]="CONFIG_REPLACED",r[r.CHANNEL_EXPIRED=3001]="CHANNEL_EXPIRED",r[r.SERVER_RESTARTED=3002]="SERVER_RESTARTED",r[r.CONFIG_EXPIRED=3003]="CONFIG_EXPIRED",r[r.MANUAL=3004]="MANUAL",r[r.STUCK=3005]="STUCK",r[r.WRONG_CHANNEL_ID=4010]="WRONG_CHANNEL_ID",r))(Se||{}),Kt=(r=>(r.CHANNEL_EXPIRE="CHANNEL_EXPIRE",r.CONFIG_EXPIRE="CONFIG_EXPIRE",r.SERVER_RESTART="SERVER_RESTART",r))(Kt||{}),Sn=(r=>(r.Shared="shared",r.Personal="personal",r))(Sn||{});const _n={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 ze=(r=>(r.Publish="publish",r.GetUsersLastSeen="getUsersLastSeen",r.Ping="ping",r.ListChannels="listChannels",r.SubscribeStatusChange="subscribeStatusChange",r.UnsubscribeStatusChange="unsubscribeStatusChange",r))(ze||{});class qe{_errors;_data;constructor(e){this._errors=new Map,this._data=e??null}get isSuccess(){return this._errors.size===0}get errors(){return this._errors}setData(e){return this._data=e,this}getData(){return this._data}addError(e,t){const n=t??W.getUuidRfc4122(),s=typeof e=="string"?new Error(e):e;return this._errors.set(n,s),this}addErrors(e){for(const t of e)this.addError(t);return this}getErrors(){return this._errors.values()}hasError(e){return this._errors.has(e)}getErrorMessages(){return Array.from(this._errors.values(),e=>e.message)}toString(){const e=this.isSuccess?"success":"failure",t=this.safeStringify(this._data);return this.isSuccess?`Result(${e}): ${t}`:`Result(${e}): ${t}
2
2
  Errors: ${this.getErrorMessages().join(", ")}`}safeStringify(e){try{return JSON.stringify(e,this.replacer,2)}catch{return"[Unable to serialize data]"}}replacer(e,t){return t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t}static ok(e){return new qe(e)}static fail(e,t){return new qe().addError(e,t)}}class Fe extends Error{code;_status;requestInfo;timestamp;originalError;constructor(e){const t=Fe.formatErrorMessage(e);super(t),this.name="AjaxError",this.code=e.code,this._status=e.status,this.requestInfo=e.requestInfo,this.originalError=e.originalError,this.timestamp=new Date,this.cleanErrorStack()}get answerError(){return{error:this.message,errorDescription:""}}get status(){return this._status}set status(e){this._status=e}static fromResponse(e){return new Fe({code:e.data?.error||"unknown_error",description:e.data?.error_description,status:e.status,requestInfo:{method:e.config?.method?.toUpperCase(),url:e.config?.url,params:e.config?.params}})}static fromException(e,t){return e instanceof Fe?e:new Fe({code:t?.code||"internal_error",status:t?.status||500,description:e instanceof Error?e.message:String(e),requestInfo:t?.requestInfo,originalError:e})}toJSON(){return{name:this.name,code:this.code,message:this.message,status:this._status,timestamp:this.timestamp.toISOString(),requestInfo:this.requestInfo,stack:this.stack}}toString(){let e=`[${this.name}] ${this.code} (${this._status}): ${this.message}`;return this.requestInfo&&(e+=`
3
3
  Request: ${this.requestInfo.method} ${this.requestInfo.url}`),this.stack&&(e+=`
4
4
  Stack trace:
5
5
  ${this.stack}`),e}static formatErrorMessage(e){const t=[e.code];return e.description&&t.push(`- ${e.description}`),e.requestInfo?.method&&e.requestInfo.url&&t.push(`(on ${e.requestInfo.method} ${e.requestInfo.url})`),t.join(" ")}cleanErrorStack(){typeof this.stack=="string"&&(this.stack=this.stack.split(`
6
6
  `).filter(e=>!e.includes("AjaxError.constructor")).join(`
7
- `))}}class _r extends qe{_status;_query;_data;constructor(e){super(),this._data=Object.freeze(e.answer),this._query=Object.freeze(structuredClone(e.query)),this._status=e.status,this.#e()}#e(){const{error:e}=this._data;if(!e)return;const t=this.#r(e);this.addError(this.#t(t),"base-error")}#r(e){return typeof e=="string"?{code:e,description:this._data.error_description||""}:{code:e.error,description:e.error_description||""}}#t(e){return new Fe({code:String(this._status),description:e.description,status:this._status,requestInfo:{method:this._query.method,params:this._query.params}})}getData(){return Object.freeze({result:this._data.result,next:this._data.next,total:this._data.total,time:this._data.time})}hasMore(){return this.isMore()}isMore(){return C.isNumber(this._data?.next)}getTotal(){return $.toInteger(this._data?.total)}getStatus(){return this._status}getQuery(){return this._query}async fetchNext(e){const t=await this.getNext(e);return t===!1?null:t}async getNext(e){if(!this.isMore()||!this.isSuccess)return!1;const t=this.#n();return e.call(t.method,t.params,t.start)}#n(){return{...this._query,start:$.toInteger(this._data.next)}}setData(){throw new ReferenceError("AjaxResult does not allow data modification")}}let bl=class{#e;#r;#t;_logger=null;constructor(){this.#e=Ii,this.#t=0,this.#r=0}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}get params(){return{...this.#e}}set params(e){this.#e=e,this.getLogger().log("new restriction manager params",e)}check(e=""){return new Promise(t=>{if(this.#s(),this.#i())return this.getLogger().log(`>> no sleep >>> ${e}`,this.#n()),this.#o(),t(null);{const n=i=>{this.getLogger().info(`>> go sleep >>> ${e}`,this.#n()),setTimeout(()=>{i()},this.#e.sleep)},s=()=>{if(this.#s(),this.#i())return this.getLogger().info(`<< stop sleep <<< ${e}`,this.#n()),this.#o(),t(null);n(s)};n(s)}})}#n(){return`${this.#t.toFixed(4)} from ${this.#e.amount}`}#s(){this.#r>0&&(this.#t-=(Date.now()-this.#r)*this.#e.speed,this.#t<0&&(this.#t=0)),this.#r=Date.now()}#o(){this.#t++}#i(){return this.#t<this.#e.amount}};const Sl="X-Request-ID",_l="bx24_request_id",kl="bx24_sdk_ver",vl="bx24_sdk_type";let El=class{getQueryStringParameterName(){return _l}getQueryStringSdkParameterName(){return kl}getQueryStringSdkTypeParameterName(){return vl}generate(){return $.getUuidRfc4122()}getRequestId(){return this.generate()}getHeaderFieldName(){return Sl}};function ji(r,e){return function(){return r.apply(e,arguments)}}const{toString:Tl}=Object.prototype,{getPrototypeOf:bn}=Object,{iterator:kr,toStringTag:Bi}=Symbol,vr=(r=>e=>{const t=Tl.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ve=r=>(r=r.toLowerCase(),e=>vr(e)===r),Er=r=>e=>typeof e===r,{isArray:Mt}=Array,Qt=Er("undefined");function Ol(r){return r!==null&&!Qt(r)&&r.constructor!==null&&!Qt(r.constructor)&&Te(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const Ui=Ve("ArrayBuffer");function Al(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Ui(r.buffer),e}const Il=Er("string"),Te=Er("function"),$i=Er("number"),Tr=r=>r!==null&&typeof r=="object",Cl=r=>r===!0||r===!1,Or=r=>{if(vr(r)!=="object")return!1;const e=bn(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Bi in r)&&!(kr in r)},Nl=Ve("Date"),Rl=Ve("File"),Ll=Ve("Blob"),Dl=Ve("FileList"),Pl=r=>Tr(r)&&Te(r.pipe),Ml=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Te(r.append)&&((e=vr(r))==="formdata"||e==="object"&&Te(r.toString)&&r.toString()==="[object FormData]"))},Fl=Ve("URLSearchParams"),[xl,jl,Bl,Ul]=["ReadableStream","Request","Response","Headers"].map(Ve),$l=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Xt(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,s;if(typeof r!="object"&&(r=[r]),Mt(r))for(n=0,s=r.length;n<s;n++)e.call(null,r[n],n,r);else{const i=t?Object.getOwnPropertyNames(r):Object.keys(r),o=i.length;let c;for(n=0;n<o;n++)c=i[n],e.call(null,r[c],c,r)}}function Wi(r,e){e=e.toLowerCase();const t=Object.keys(r);let n=t.length,s;for(;n-- >0;)if(s=t[n],e===s.toLowerCase())return s;return null}const yt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,qi=r=>!Qt(r)&&r!==yt;function Sn(){const{caseless:r}=qi(this)&&this||{},e={},t=(n,s)=>{const i=r&&Wi(e,s)||s;Or(e[i])&&Or(n)?e[i]=Sn(e[i],n):Or(n)?e[i]=Sn({},n):Mt(n)?e[i]=n.slice():e[i]=n};for(let n=0,s=arguments.length;n<s;n++)arguments[n]&&Xt(arguments[n],t);return e}const Wl=(r,e,t,{allOwnKeys:n}={})=>(Xt(e,(s,i)=>{t&&Te(s)?r[i]=ji(s,t):r[i]=s},{allOwnKeys:n}),r),ql=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Vl=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},zl=(r,e,t,n)=>{let s,i,o;const c={};if(e=e||{},r==null)return e;do{for(s=Object.getOwnPropertyNames(r),i=s.length;i-- >0;)o=s[i],(!n||n(o,r,e))&&!c[o]&&(e[o]=r[o],c[o]=!0);r=t!==!1&&bn(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},Hl=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const n=r.indexOf(e,t);return n!==-1&&n===t},Jl=r=>{if(!r)return null;if(Mt(r))return r;let e=r.length;if(!$i(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},Zl=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&bn(Uint8Array)),Gl=(r,e)=>{const n=(r&&r[kr]).call(r);let s;for(;(s=n.next())&&!s.done;){const i=s.value;e.call(r,i[0],i[1])}},Yl=(r,e)=>{let t;const n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},Kl=Ve("HTMLFormElement"),Ql=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,s){return n.toUpperCase()+s}),Vi=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),Xl=Ve("RegExp"),zi=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),n={};Xt(t,(s,i)=>{let o;(o=e(s,i,r))!==!1&&(n[i]=o||s)}),Object.defineProperties(r,n)},eu=r=>{zi(r,(e,t)=>{if(Te(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=r[t];if(Te(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},tu=(r,e)=>{const t={},n=s=>{s.forEach(i=>{t[i]=!0})};return Mt(r)?n(r):n(String(r).split(e)),t},ru=()=>{},nu=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function su(r){return!!(r&&Te(r.append)&&r[Bi]==="FormData"&&r[kr])}const iu=r=>{const e=new Array(10),t=(n,s)=>{if(Tr(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[s]=n;const i=Mt(n)?[]:{};return Xt(n,(o,c)=>{const a=t(o,s+1);!Qt(a)&&(i[c]=a)}),e[s]=void 0,i}}return n};return t(r,0)},ou=Ve("AsyncFunction"),au=r=>r&&(Tr(r)||Te(r))&&Te(r.then)&&Te(r.catch),Hi=((r,e)=>r?setImmediate:e?((t,n)=>(yt.addEventListener("message",({source:s,data:i})=>{s===yt&&i===t&&n.length&&n.shift()()},!1),s=>{n.push(s),yt.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Te(yt.postMessage)),cu=typeof queueMicrotask<"u"?queueMicrotask.bind(yt):typeof process<"u"&&process.nextTick||Hi,k={isArray:Mt,isArrayBuffer:Ui,isBuffer:Ol,isFormData:Ml,isArrayBufferView:Al,isString:Il,isNumber:$i,isBoolean:Cl,isObject:Tr,isPlainObject:Or,isReadableStream:xl,isRequest:jl,isResponse:Bl,isHeaders:Ul,isUndefined:Qt,isDate:Nl,isFile:Rl,isBlob:Ll,isRegExp:Xl,isFunction:Te,isStream:Pl,isURLSearchParams:Fl,isTypedArray:Zl,isFileList:Dl,forEach:Xt,merge:Sn,extend:Wl,trim:$l,stripBOM:ql,inherits:Vl,toFlatObject:zl,kindOf:vr,kindOfTest:Ve,endsWith:Hl,toArray:Jl,forEachEntry:Gl,matchAll:Yl,isHTMLForm:Kl,hasOwnProperty:Vi,hasOwnProp:Vi,reduceDescriptors:zi,freezeMethods:eu,toObjectSet:tu,toCamelCase:Ql,noop:ru,toFiniteNumber:nu,findKey:Wi,global:yt,isContextDefined:qi,isSpecCompliantForm:su,toJSONObject:iu,isAsyncFn:ou,isThenable:au,setImmediate:Hi,asap:cu,isIterable:r=>r!=null&&Te(r[kr])};function V(r,e,t,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),s&&(this.response=s,this.status=s.status?s.status:null)}k.inherits(V,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:k.toJSONObject(this.config),code:this.code,status:this.status}}});const Ji=V.prototype,Zi={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{Zi[r]={value:r}}),Object.defineProperties(V,Zi),Object.defineProperty(Ji,"isAxiosError",{value:!0}),V.from=(r,e,t,n,s,i)=>{const o=Object.create(Ji);return k.toFlatObject(r,o,function(a){return a!==Error.prototype},c=>c!=="isAxiosError"),V.call(o,r.message,e,t,n,s),o.cause=r,o.name=r.name,i&&Object.assign(o,i),o};const lu=null;function _n(r){return k.isPlainObject(r)||k.isArray(r)}function Gi(r){return k.endsWith(r,"[]")?r.slice(0,-2):r}function Yi(r,e,t){return r?r.concat(e).map(function(s,i){return s=Gi(s),!t&&i?"["+s+"]":s}).join(t?".":""):e}function uu(r){return k.isArray(r)&&!r.some(_n)}const hu=k.toFlatObject(k,{},null,function(e){return/^is[A-Z]/.test(e)});function Ar(r,e,t){if(!k.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=k.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,g){return!k.isUndefined(g[m])});const n=t.metaTokens,s=t.visitor||l,i=t.dots,o=t.indexes,a=(t.Blob||typeof Blob<"u"&&Blob)&&k.isSpecCompliantForm(e);if(!k.isFunction(s))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(k.isDate(p))return p.toISOString();if(k.isBoolean(p))return p.toString();if(!a&&k.isBlob(p))throw new V("Blob is not supported. Use a Buffer instead.");return k.isArrayBuffer(p)||k.isTypedArray(p)?a&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function l(p,m,g){let y=p;if(p&&!g&&typeof p=="object"){if(k.endsWith(m,"{}"))m=n?m:m.slice(0,-2),p=JSON.stringify(p);else if(k.isArray(p)&&uu(p)||(k.isFileList(p)||k.endsWith(m,"[]"))&&(y=k.toArray(p)))return m=Gi(m),y.forEach(function(_,b){!(k.isUndefined(_)||_===null)&&e.append(o===!0?Yi([m],b,i):o===null?m:m+"[]",u(_))}),!1}return _n(p)?!0:(e.append(Yi(g,m,i),u(p)),!1)}const f=[],h=Object.assign(hu,{defaultVisitor:l,convertValue:u,isVisitable:_n});function d(p,m){if(!k.isUndefined(p)){if(f.indexOf(p)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(p),k.forEach(p,function(y,w){(!(k.isUndefined(y)||y===null)&&s.call(e,y,k.isString(w)?w.trim():w,m,h))===!0&&d(y,m?m.concat(w):[w])}),f.pop()}}if(!k.isObject(r))throw new TypeError("data must be an object");return d(r),e}function Ki(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function kn(r,e){this._pairs=[],r&&Ar(r,this,e)}const Qi=kn.prototype;Qi.append=function(e,t){this._pairs.push([e,t])},Qi.toString=function(e){const t=e?function(n){return e.call(this,n,Ki)}:Ki;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};function fu(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Xi(r,e,t){if(!e)return r;const n=t&&t.encode||fu;k.isFunction(t)&&(t={serialize:t});const s=t&&t.serialize;let i;if(s?i=s(e,t):i=k.isURLSearchParams(e)?e.toString():new kn(e,t).toString(n),i){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+i}return r}class eo{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){k.forEach(this.handlers,function(n){n!==null&&e(n)})}}const to={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},du={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:kn,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},vn=typeof window<"u"&&typeof document<"u",En=typeof navigator=="object"&&navigator||void 0,pu=vn&&(!En||["ReactNative","NativeScript","NS"].indexOf(En.product)<0),mu=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",gu=vn&&window.location.href||"http://localhost",_e={...{__proto__:null,hasBrowserEnv:vn,hasStandardBrowserEnv:pu,hasStandardBrowserWebWorkerEnv:mu,navigator:En,origin:gu},...du};function yu(r,e){return Ar(r,new _e.classes.URLSearchParams,Object.assign({visitor:function(t,n,s,i){return _e.isNode&&k.isBuffer(t)?(this.append(n,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function wu(r){return k.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function bu(r){const e={},t=Object.keys(r);let n;const s=t.length;let i;for(n=0;n<s;n++)i=t[n],e[i]=r[i];return e}function ro(r){function e(t,n,s,i){let o=t[i++];if(o==="__proto__")return!0;const c=Number.isFinite(+o),a=i>=t.length;return o=!o&&k.isArray(s)?s.length:o,a?(k.hasOwnProp(s,o)?s[o]=[s[o],n]:s[o]=n,!c):((!s[o]||!k.isObject(s[o]))&&(s[o]=[]),e(t,n,s[o],i)&&k.isArray(s[o])&&(s[o]=bu(s[o])),!c)}if(k.isFormData(r)&&k.isFunction(r.entries)){const t={};return k.forEachEntry(r,(n,s)=>{e(wu(n),s,t,0)}),t}return null}function Su(r,e,t){if(k.isString(r))try{return(e||JSON.parse)(r),k.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}const er={transitional:to,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",s=n.indexOf("application/json")>-1,i=k.isObject(e);if(i&&k.isHTMLForm(e)&&(e=new FormData(e)),k.isFormData(e))return s?JSON.stringify(ro(e)):e;if(k.isArrayBuffer(e)||k.isBuffer(e)||k.isStream(e)||k.isFile(e)||k.isBlob(e)||k.isReadableStream(e))return e;if(k.isArrayBufferView(e))return e.buffer;if(k.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return yu(e,this.formSerializer).toString();if((c=k.isFileList(e))||n.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Ar(c?{"files[]":e}:e,a&&new a,this.formSerializer)}}return i||s?(t.setContentType("application/json",!1),Su(e)):e}],transformResponse:[function(e){const t=this.transitional||er.transitional,n=t&&t.forcedJSONParsing,s=this.responseType==="json";if(k.isResponse(e)||k.isReadableStream(e))return e;if(e&&k.isString(e)&&(n&&!this.responseType||s)){const o=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(c){if(o)throw c.name==="SyntaxError"?V.from(c,V.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_e.classes.FormData,Blob:_e.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};k.forEach(["delete","get","head","post","put","patch"],r=>{er.headers[r]={}});const _u=k.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ku=r=>{const e={};let t,n,s;return r&&r.split(`
8
- `).forEach(function(o){s=o.indexOf(":"),t=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!t||e[t]&&_u[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e},no=Symbol("internals");function tr(r){return r&&String(r).trim().toLowerCase()}function Ir(r){return r===!1||r==null?r:k.isArray(r)?r.map(Ir):String(r)}function vu(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=t.exec(r);)e[n[1]]=n[2];return e}const Eu=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function Tn(r,e,t,n,s){if(k.isFunction(n))return n.call(this,e,t);if(s&&(e=t),!!k.isString(e)){if(k.isString(n))return e.indexOf(n)!==-1;if(k.isRegExp(n))return n.test(e)}}function Tu(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function Ou(r,e){const t=k.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{value:function(s,i,o){return this[n].call(this,e,s,i,o)},configurable:!0})})}let Oe=class{constructor(e){e&&this.set(e)}set(e,t,n){const s=this;function i(c,a,u){const l=tr(a);if(!l)throw new Error("header name must be a non-empty string");const f=k.findKey(s,l);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||a]=Ir(c))}const o=(c,a)=>k.forEach(c,(u,l)=>i(u,l,a));if(k.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(k.isString(e)&&(e=e.trim())&&!Eu(e))o(ku(e),t);else if(k.isObject(e)&&k.isIterable(e)){let c={},a,u;for(const l of e){if(!k.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[u=l[0]]=(a=c[u])?k.isArray(a)?[...a,l[1]]:[a,l[1]]:l[1]}o(c,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=tr(e),e){const n=k.findKey(this,e);if(n){const s=this[n];if(!t)return s;if(t===!0)return vu(s);if(k.isFunction(t))return t.call(this,s,n);if(k.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=tr(e),e){const n=k.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||Tn(this,this[n],n,t)))}return!1}delete(e,t){const n=this;let s=!1;function i(o){if(o=tr(o),o){const c=k.findKey(n,o);c&&(!t||Tn(n,n[c],c,t))&&(delete n[c],s=!0)}}return k.isArray(e)?e.forEach(i):i(e),s}clear(e){const t=Object.keys(this);let n=t.length,s=!1;for(;n--;){const i=t[n];(!e||Tn(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const t=this,n={};return k.forEach(this,(s,i)=>{const o=k.findKey(n,i);if(o){t[o]=Ir(s),delete t[i];return}const c=e?Tu(i):String(i).trim();c!==i&&delete t[i],t[c]=Ir(s),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return k.forEach(this,(n,s)=>{n!=null&&n!==!1&&(t[s]=e&&k.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
9
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[no]=this[no]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=tr(o);n[c]||(Ou(s,o),n[c]=!0)}return k.isArray(e)?e.forEach(i):i(e),this}};Oe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),k.reduceDescriptors(Oe.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}}),k.freezeMethods(Oe);function On(r,e){const t=this||er,n=e||t,s=Oe.from(n.headers);let i=n.data;return k.forEach(r,function(c){i=c.call(t,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function so(r){return!!(r&&r.__CANCEL__)}function Ft(r,e,t){V.call(this,r??"canceled",V.ERR_CANCELED,e,t),this.name="CanceledError"}k.inherits(Ft,V,{__CANCEL__:!0});function io(r,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new V("Request failed with status code "+t.status,[V.ERR_BAD_REQUEST,V.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Au(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function Iu(r,e){r=r||10;const t=new Array(r),n=new Array(r);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(a){const u=Date.now(),l=n[i];o||(o=u),t[s]=a,n[s]=u;let f=i,h=0;for(;f!==s;)h+=t[f++],f=f%r;if(s=(s+1)%r,s===i&&(i=(i+1)%r),u-o<e)return;const d=l&&u-l;return d?Math.round(h*1e3/d):void 0}}function Cu(r,e){let t=0,n=1e3/e,s,i;const o=(u,l=Date.now())=>{t=l,s=null,i&&(clearTimeout(i),i=null),r.apply(null,u)};return[(...u)=>{const l=Date.now(),f=l-t;f>=n?o(u,l):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const Cr=(r,e,t=3)=>{let n=0;const s=Iu(50,250);return Cu(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,a=o-n,u=s(a),l=o<=c;n=o;const f={loaded:o,total:c,progress:c?o/c:void 0,bytes:a,rate:u||void 0,estimated:u&&c&&l?(c-o)/u:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};r(f)},t)},oo=(r,e)=>{const t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},ao=r=>(...e)=>k.asap(()=>r(...e)),Nu=_e.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,_e.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(_e.origin),_e.navigator&&/(msie|trident)/i.test(_e.navigator.userAgent)):()=>!0,Ru=_e.hasStandardBrowserEnv?{write(r,e,t,n,s,i){const o=[r+"="+encodeURIComponent(e)];k.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),k.isString(n)&&o.push("path="+n),k.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(r){const e=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Lu(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function Du(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function co(r,e,t){let n=!Lu(e);return r&&(n||t==!1)?Du(r,e):e}const lo=r=>r instanceof Oe?{...r}:r;function wt(r,e){e=e||{};const t={};function n(u,l,f,h){return k.isPlainObject(u)&&k.isPlainObject(l)?k.merge.call({caseless:h},u,l):k.isPlainObject(l)?k.merge({},l):k.isArray(l)?l.slice():l}function s(u,l,f,h){if(k.isUndefined(l)){if(!k.isUndefined(u))return n(void 0,u,f,h)}else return n(u,l,f,h)}function i(u,l){if(!k.isUndefined(l))return n(void 0,l)}function o(u,l){if(k.isUndefined(l)){if(!k.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function c(u,l,f){if(f in e)return n(u,l);if(f in r)return n(void 0,u)}const a={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,l,f)=>s(lo(u),lo(l),f,!0)};return k.forEach(Object.keys(Object.assign({},r,e)),function(l){const f=a[l]||s,h=f(r[l],e[l],l);k.isUndefined(h)&&f!==c||(t[l]=h)}),t}const uo=r=>{const e=wt({},r);let{data:t,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=e;e.headers=o=Oe.from(o),e.url=Xi(co(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let a;if(k.isFormData(t)){if(_e.hasStandardBrowserEnv||_e.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((a=o.getContentType())!==!1){const[u,...l]=a?a.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...l].join("; "))}}if(_e.hasStandardBrowserEnv&&(n&&k.isFunction(n)&&(n=n(e)),n||n!==!1&&Nu(e.url))){const u=s&&i&&Ru.read(i);u&&o.set(s,u)}return e},Pu=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(t,n){const s=uo(r);let i=s.data;const o=Oe.from(s.headers).normalize();let{responseType:c,onUploadProgress:a,onDownloadProgress:u}=s,l,f,h,d,p;function m(){d&&d(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let g=new XMLHttpRequest;g.open(s.method.toUpperCase(),s.url,!0),g.timeout=s.timeout;function y(){if(!g)return;const _=Oe.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),v={data:!c||c==="text"||c==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:_,config:r,request:g};io(function(E){t(E),m()},function(E){n(E),m()},v),g=null}"onloadend"in g?g.onloadend=y:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(y)},g.onabort=function(){g&&(n(new V("Request aborted",V.ECONNABORTED,r,g)),g=null)},g.onerror=function(){n(new V("Network Error",V.ERR_NETWORK,r,g)),g=null},g.ontimeout=function(){let b=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const v=s.transitional||to;s.timeoutErrorMessage&&(b=s.timeoutErrorMessage),n(new V(b,v.clarifyTimeoutError?V.ETIMEDOUT:V.ECONNABORTED,r,g)),g=null},i===void 0&&o.setContentType(null),"setRequestHeader"in g&&k.forEach(o.toJSON(),function(b,v){g.setRequestHeader(v,b)}),k.isUndefined(s.withCredentials)||(g.withCredentials=!!s.withCredentials),c&&c!=="json"&&(g.responseType=s.responseType),u&&([h,p]=Cr(u,!0),g.addEventListener("progress",h)),a&&g.upload&&([f,d]=Cr(a),g.upload.addEventListener("progress",f),g.upload.addEventListener("loadend",d)),(s.cancelToken||s.signal)&&(l=_=>{g&&(n(!_||_.type?new Ft(null,r,g):_),g.abort(),g=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const w=Au(s.url);if(w&&_e.protocols.indexOf(w)===-1){n(new V("Unsupported protocol "+w+":",V.ERR_BAD_REQUEST,r));return}g.send(i||null)})},Mu=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,s;const i=function(u){if(!s){s=!0,c();const l=u instanceof Error?u:this.reason;n.abort(l instanceof V?l:new Ft(l instanceof Error?l.message:l))}};let o=e&&setTimeout(()=>{o=null,i(new V(`timeout ${e} of ms exceeded`,V.ETIMEDOUT))},e);const c=()=>{r&&(o&&clearTimeout(o),o=null,r.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),r=null)};r.forEach(u=>u.addEventListener("abort",i));const{signal:a}=n;return a.unsubscribe=()=>k.asap(c),a}},Fu=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let n=0,s;for(;n<t;)s=n+e,yield r.slice(n,s),n=s},xu=async function*(r,e){for await(const t of ju(r))yield*Fu(t,e)},ju=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},ho=(r,e,t,n)=>{const s=xu(r,e);let i=0,o,c=a=>{o||(o=!0,n&&n(a))};return new ReadableStream({async pull(a){try{const{done:u,value:l}=await s.next();if(u){c(),a.close();return}let f=l.byteLength;if(t){let h=i+=f;t(h)}a.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(a){return c(a),s.return()}},{highWaterMark:2})},Nr=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",fo=Nr&&typeof ReadableStream=="function",Bu=Nr&&(typeof TextEncoder=="function"?(r=>e=>r.encode(e))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),po=(r,...e)=>{try{return!!r(...e)}catch{return!1}},Uu=fo&&po(()=>{let r=!1;const e=new Request(_e.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!e}),mo=64*1024,An=fo&&po(()=>k.isReadableStream(new Response("").body)),Rr={stream:An&&(r=>r.body)};Nr&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Rr[e]&&(Rr[e]=k.isFunction(r[e])?t=>t[e]():(t,n)=>{throw new V(`Response type '${e}' is not supported`,V.ERR_NOT_SUPPORT,n)})})})(new Response);const $u=async r=>{if(r==null)return 0;if(k.isBlob(r))return r.size;if(k.isSpecCompliantForm(r))return(await new Request(_e.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(k.isArrayBufferView(r)||k.isArrayBuffer(r))return r.byteLength;if(k.isURLSearchParams(r)&&(r=r+""),k.isString(r))return(await Bu(r)).byteLength},Wu=async(r,e)=>{const t=k.toFiniteNumber(r.getContentLength());return t??$u(e)},In={http:lu,xhr:Pu,fetch:Nr&&(async r=>{let{url:e,method:t,data:n,signal:s,cancelToken:i,timeout:o,onDownloadProgress:c,onUploadProgress:a,responseType:u,headers:l,withCredentials:f="same-origin",fetchOptions:h}=uo(r);u=u?(u+"").toLowerCase():"text";let d=Mu([s,i&&i.toAbortSignal()],o),p;const m=d&&d.unsubscribe&&(()=>{d.unsubscribe()});let g;try{if(a&&Uu&&t!=="get"&&t!=="head"&&(g=await Wu(l,n))!==0){let v=new Request(e,{method:"POST",body:n,duplex:"half"}),S;if(k.isFormData(n)&&(S=v.headers.get("content-type"))&&l.setContentType(S),v.body){const[E,L]=oo(g,Cr(ao(a)));n=ho(v.body,mo,E,L)}}k.isString(f)||(f=f?"include":"omit");const y="credentials"in Request.prototype;p=new Request(e,{...h,signal:d,method:t.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:y?f:void 0});let w=await fetch(p,h);const _=An&&(u==="stream"||u==="response");if(An&&(c||_&&m)){const v={};["status","statusText","headers"].forEach(x=>{v[x]=w[x]});const S=k.toFiniteNumber(w.headers.get("content-length")),[E,L]=c&&oo(S,Cr(ao(c),!0))||[];w=new Response(ho(w.body,mo,E,()=>{L&&L(),m&&m()}),v)}u=u||"text";let b=await Rr[k.findKey(Rr,u)||"text"](w,r);return!_&&m&&m(),await new Promise((v,S)=>{io(v,S,{data:b,headers:Oe.from(w.headers),status:w.status,statusText:w.statusText,config:r,request:p})})}catch(y){throw m&&m(),y&&y.name==="TypeError"&&/Load failed|fetch/i.test(y.message)?Object.assign(new V("Network Error",V.ERR_NETWORK,r,p),{cause:y.cause||y}):V.from(y,y&&y.code,r,p)}})};k.forEach(In,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const go=r=>`- ${r}`,qu=r=>k.isFunction(r)||r===null||r===!1,yo={getAdapter:r=>{r=k.isArray(r)?r:[r];const{length:e}=r;let t,n;const s={};for(let i=0;i<e;i++){t=r[i];let o;if(n=t,!qu(t)&&(n=In[(o=String(t)).toLowerCase()],n===void 0))throw new V(`Unknown adapter '${o}'`);if(n)break;s[o||"#"+i]=n}if(!n){const i=Object.entries(s).map(([c,a])=>`adapter ${c} `+(a===!1?"is not supported by the environment":"is not available in the build"));let o=e?i.length>1?`since :
10
- `+i.map(go).join(`
11
- `):" "+go(i[0]):"as no adapter specified";throw new V("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:In};function Cn(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Ft(null,r)}function wo(r){return Cn(r),r.headers=Oe.from(r.headers),r.data=On.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),yo.getAdapter(r.adapter||er.adapter)(r).then(function(n){return Cn(r),n.data=On.call(r,r.transformResponse,n),n.headers=Oe.from(n.headers),n},function(n){return so(n)||(Cn(r),n&&n.response&&(n.response.data=On.call(r,r.transformResponse,n.response),n.response.headers=Oe.from(n.response.headers))),Promise.reject(n)})}const bo="1.10.0",Lr={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{Lr[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});const So={};Lr.transitional=function(e,t,n){function s(i,o){return"[Axios v"+bo+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,c)=>{if(e===!1)throw new V(s(o," has been removed"+(t?" in "+t:"")),V.ERR_DEPRECATED);return t&&!So[o]&&(So[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,c):!0}},Lr.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function Vu(r,e,t){if(typeof r!="object")throw new V("options must be an object",V.ERR_BAD_OPTION_VALUE);const n=Object.keys(r);let s=n.length;for(;s-- >0;){const i=n[s],o=e[i];if(o){const c=r[i],a=c===void 0||o(c,i,r);if(a!==!0)throw new V("option "+i+" must be "+a,V.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new V("Unknown option "+i,V.ERR_BAD_OPTION)}}const Dr={assertOptions:Vu,validators:Lr},He=Dr.validators;let bt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new eo,response:new eo}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=`
12
- `+i):n.stack=i}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=wt(this.defaults,t);const{transitional:n,paramsSerializer:s,headers:i}=t;n!==void 0&&Dr.assertOptions(n,{silentJSONParsing:He.transitional(He.boolean),forcedJSONParsing:He.transitional(He.boolean),clarifyTimeoutError:He.transitional(He.boolean)},!1),s!=null&&(k.isFunction(s)?t.paramsSerializer={serialize:s}:Dr.assertOptions(s,{encode:He.function,serialize:He.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Dr.assertOptions(t,{baseUrl:He.spelling("baseURL"),withXsrfToken:He.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&k.merge(i.common,i[t.method]);i&&k.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),t.headers=Oe.concat(o,i);const c=[];let a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(a=a&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let l,f=0,h;if(!a){const p=[wo.bind(this),void 0];for(p.unshift.apply(p,c),p.push.apply(p,u),h=p.length,l=Promise.resolve(t);f<h;)l=l.then(p[f++],p[f++]);return l}h=c.length;let d=t;for(f=0;f<h;){const p=c[f++],m=c[f++];try{d=p(d)}catch(g){m.call(this,g);break}}try{l=wo.call(this,d)}catch(p){return Promise.reject(p)}for(f=0,h=u.length;f<h;)l=l.then(u[f++],u[f++]);return l}getUri(e){e=wt(this.defaults,e);const t=co(e.baseURL,e.url,e.allowAbsoluteUrls);return Xi(t,e.params,e.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(e){bt.prototype[e]=function(t,n){return this.request(wt(n||{},{method:e,url:t,data:(n||{}).data}))}}),k.forEach(["post","put","patch"],function(e){function t(n){return function(i,o,c){return this.request(wt(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}bt.prototype[e]=t(),bt.prototype[e+"Form"]=t(!0)});let zu=class ta{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{n.subscribe(c),i=c}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},e(function(i,o,c){n.reason||(n.reason=new Ft(i,o,c),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ta(function(s){e=s}),cancel:e}}};function Hu(r){return function(t){return r.apply(null,t)}}function Ju(r){return k.isObject(r)&&r.isAxiosError===!0}const Nn={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(Nn).forEach(([r,e])=>{Nn[e]=r});function _o(r){const e=new bt(r),t=ji(bt.prototype.request,e);return k.extend(t,bt.prototype,e,{allOwnKeys:!0}),k.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return _o(wt(r,s))},t}const ie=_o(er);ie.Axios=bt,ie.CanceledError=Ft,ie.CancelToken=zu,ie.isCancel=so,ie.VERSION=bo,ie.toFormData=Ar,ie.AxiosError=V,ie.Cancel=ie.CanceledError,ie.all=function(e){return Promise.all(e)},ie.spread=Hu,ie.isAxiosError=Ju,ie.mergeConfig=wt,ie.AxiosHeaders=Oe,ie.formToJSON=r=>ro(k.isHTMLForm(r)?new FormData(r):r),ie.getAdapter=yo.getAdapter,ie.HttpStatusCode=Nn,ie.default=ie;const{Axios:vf,AxiosError:Rn,CanceledError:Ef,isCancel:Tf,CancelToken:Of,VERSION:Af,all:If,Cancel:Cf,isAxiosError:Nf,spread:Rf,toFormData:Lf,AxiosHeaders:Df,HttpStatusCode:Pf,formToJSON:Mf,getAdapter:Ff,mergeConfig:xf}=ie,Zu=String.prototype.replace,Gu=/%20/g,ko={RFC1738:"RFC1738",RFC3986:"RFC3986"},Yu={RFC1738:function(r){return Zu.call(r,Gu,"+")},RFC3986:function(r){return String(r)}},Ku=ko.RFC1738,Qu=ko.RFC3986,Ln=Object.prototype.hasOwnProperty,St=Array.isArray,Je=function(){const r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Xu=function(e){for(;e.length>1;){const t=e.pop(),n=t.obj[t.prop];if(St(n)){const s=[];for(let i=0;i<n.length;++i)typeof n[i]<"u"&&s.push(n[i]);t.obj[t.prop]=s}}},eh=function(e,t){const n=t&&t.plainObjects?Object.create(null):{};for(let s=0;s<e.length;++s)typeof e[s]<"u"&&(n[s]=e[s]);return n},th=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(St(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!Ln.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);let s=e;return St(e)&&!St(t)&&(s=eh(e,n)),St(e)&&St(t)?(t.forEach(function(i,o){if(Ln.call(e,o)){const c=e[o];c&&typeof c=="object"&&i&&typeof i=="object"?e[o]=r(c,i,n):e.push(i)}else e[o]=i}),e):Object.keys(t).reduce(function(i,o){const c=t[o];return Ln.call(i,o)?i[o]=r(i[o],c,n):i[o]=c,i},s)},rh=function(r,e,t){const n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Dn=1024,nh=function(e,t,n,s,i){if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let c="";for(let a=0;a<o.length;a+=Dn){const u=o.length>=Dn?o.slice(a,a+Dn):o,l=[];for(let f=0;f<u.length;++f){let h=u.charCodeAt(f);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||i===Ku&&(h===40||h===41)){l[l.length]=u.charAt(f);continue}if(h<128){l[l.length]=Je[h];continue}if(h<2048){l[l.length]=Je[192|h>>6]+Je[128|h&63];continue}if(h<55296||h>=57344){l[l.length]=Je[224|h>>12]+Je[128|h>>6&63]+Je[128|h&63];continue}f+=1,h=65536+((h&1023)<<10|u.charCodeAt(f)&1023),l[l.length]=Je[240|h>>18]+Je[128|h>>12&63]+Je[128|h>>6&63]+Je[128|h&63]}c+=l.join("")}return c},sh=function(e){const t=[{obj:{o:e},prop:"o"}],n=[];for(let s=0;s<t.length;++s){const i=t[s],o=i.obj[i.prop],c=Object.keys(o);for(let a=0;a<c.length;++a){const u=c[a],l=o[u];typeof l=="object"&&l!==null&&n.indexOf(l)===-1&&(t.push({obj:o,prop:u}),n.push(l))}}return Xu(t),e},ih=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},oh=function(e,t){return[].concat(e,t)},Pn=function(e,t){if(St(e)){const n=[];for(let s=0;s<e.length;s+=1)n.push(t(e[s]));return n}return t(e)},ah={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},Xe=Array.isArray,ch=Array.prototype.push,vo=function(r,e){ch.apply(r,Xe(e)?e:[e])},lh=Date.prototype.toISOString,Eo=Qu,Pr={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:nh,encodeValuesOnly:!1,format:Eo,formatter:Yu[Eo],indices:!1,serializeDate:function(e){return lh.call(e)},skipNulls:!1,strictNullHandling:!1},uh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Mn={},To=function(e,t,n,s,i,o,c,a,u,l,f,h,d,p,m,g,y,w){let _=e,b=w,v=0,S=!1;for(;(b=b.get(Mn))!==void 0&&!S;){const J=b.get(e);if(v+=1,typeof J<"u"){if(J===v)throw new RangeError("Cyclic object value");S=!0}typeof b.get(Mn)>"u"&&(v=0)}if(typeof l=="function"?_=l(t,_):_ instanceof Date?_=d(_):n==="comma"&&Xe(_)&&(_=Pn(_,function(J){return J instanceof Date?d(J):J})),_===null){if(o)return u&&!g?u(t,Pr.encoder,y,"key",p):t;_=""}if(uh(_)||ih(_)){if(u){const J=g?t:u(t,Pr.encoder,y,"key",p);return[m(J)+"="+m(u(_,Pr.encoder,y,"value",p))]}return[m(t)+"="+m(String(_))]}const E=[];if(typeof _>"u")return E;let L;if(n==="comma"&&Xe(_))g&&u&&(_=Pn(_,u)),L=[{value:_.length>0?_.join(",")||null:void 0}];else if(Xe(l))L=l;else{const J=Object.keys(_);L=f?J.sort(f):J}const x=a?t.replace(/\./g,"%2E"):t,F=s&&Xe(_)&&_.length===1?x+"[]":x;if(i&&Xe(_)&&_.length===0)return F+"[]";for(let J=0;J<L.length;++J){const ge=L[J],z=typeof ge=="object"&&typeof ge.value<"u"?ge.value:_[ge];if(c&&z===null)continue;const Q=h&&a?ge.replace(/\./g,"%2E"):ge,U=Xe(_)?typeof n=="function"?n(F,Q):F:F+(h?"."+Q:"["+Q+"]");w.set(e,v);const he=new WeakMap;he.set(Mn,w),vo(E,To(z,U,n,s,i,o,c,a,n==="comma"&&g&&Xe(_)?null:u,l,f,h,d,p,m,g,y,he))}return E},hh=function(e){return Pr};function Oo(r,e){let t=r;const n=hh();let s,i;typeof n.filter=="function"?(i=n.filter,t=i("",t)):Xe(n.filter)&&(i=n.filter,s=i);const o=[];if(typeof t!="object"||t===null)return"";const c=ah[n.arrayFormat],a=c==="comma"&&n.commaRoundTrip;s||(s=Object.keys(t)),n.sort&&s.sort(n.sort);const u=new WeakMap;for(let h=0;h<s.length;++h){const d=s[h];n.skipNulls&&t[d]===null||vo(o,To(t[d],d,c,a,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,u))}const l=o.join(n.delimiter);let f=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),l.length>0?f+l:""}const Fn=Object.prototype.hasOwnProperty,fh=Array.isArray,Mr={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:rh,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},dh=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Ao=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},ph="utf8=%26%2310003%3B",mh="utf8=%E2%9C%93",gh=function(e,t){const n={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,o=s.split(t.delimiter,i);let c=-1,a,u=t.charset;if(t.charsetSentinel)for(a=0;a<o.length;++a)o[a].indexOf("utf8=")===0&&(o[a]===mh?u="utf-8":o[a]===ph&&(u="iso-8859-1"),c=a,a=o.length);for(a=0;a<o.length;++a){if(a===c)continue;const l=o[a],f=l.indexOf("]="),h=f===-1?l.indexOf("="):f+1;let d,p;h===-1?(d=t.decoder(l,Mr.decoder,u,"key"),p=t.strictNullHandling?null:""):(d=t.decoder(l.slice(0,h),Mr.decoder,u,"key"),p=Pn(Ao(l.slice(h+1),t),function(g){return t.decoder(g,Mr.decoder,u,"value")})),p&&t.interpretNumericEntities&&u==="iso-8859-1"&&(p=dh(p)),l.indexOf("[]=")>-1&&(p=fh(p)?[p]:p);const m=Fn.call(n,d);m&&t.duplicates==="combine"?n[d]=oh(n[d],p):(!m||t.duplicates==="last")&&(n[d]=p)}return n},yh=function(r,e,t,n){let s=n?e:Ao(e,t);for(let i=r.length-1;i>=0;--i){let o;const c=r[i];if(c==="[]"&&t.parseArrays)o=t.allowEmptyArrays&&s===""?[]:[].concat(s);else{o=t.plainObjects?Object.create(null):{};const a=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,u=t.decodeDotInKeys?a.replace(/%2E/g,"."):a,l=parseInt(u,10);!t.parseArrays&&u===""?o={0:s}:!isNaN(l)&&c!==u&&String(l)===u&&l>=0&&t.parseArrays&&l<=t.arrayLimit?(o=[],o[l]=s):u!=="__proto__"&&(o[u]=s)}s=o}return s},wh=function(e,t,n,s){if(!e)return;const i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,c=/(\[[^[\]]*])/g;let a=n.depth>0&&o.exec(i);const u=a?i.slice(0,a.index):i,l=[];if(u){if(!n.plainObjects&&Fn.call(Object.prototype,u)&&!n.allowPrototypes)return;l.push(u)}let f=0;for(;n.depth>0&&(a=c.exec(i))!==null&&f<n.depth;){if(f+=1,!n.plainObjects&&Fn.call(Object.prototype,a[1].slice(1,-1))&&!n.allowPrototypes)return;l.push(a[1])}return a&&l.push("["+i.slice(a.index)+"]"),yh(l,t,n,s)},bh=function(e){return Mr};function Io(r,e){const t=bh();if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};const n=typeof r=="string"?gh(r,t):r;let s=t.plainObjects?Object.create(null):{};const i=Object.keys(n);for(let o=0;o<i.length;++o){const c=i[o],a=wh(c,n[c],t,typeof r=="string");s=th(s,a,t)}return t.allowSparse===!0?s:sh(s)}class xn{#e;#r;#t;#n;_logger=null;_loggerSystem=null;#s="";#o=!1;#i="";constructor(e,t,n){const s={};this.#e=ie.create({baseURL:e,headers:{...s,...n?n.headers:{}},...n&&{...n,headers:void 0}}),this.#r=t,this.#t=new bl,this.#n=new El}setLogger(e){this._logger=e,this.#t.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}getSystemLogger(){return this._loggerSystem===null&&(this._loggerSystem=ye.build("SystemLogger"),this._loggerSystem.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!0,[I.warn]:!0,[I.error]:!0,[I.trace]:!1})),this._loggerSystem}setRestrictionManagerParams(e){this.#t.params=e}getRestrictionManagerParams(){return this.#t.params}setLogTag(e){this.#s=e}clearLogTag(){this.#s=""}async batch(e,t=!0,n=!1){return Array.isArray(e)?this.#l(e,t,n):this.#c(e,t,n)}async#c(e,t=!0,n=!1){const s={};let i=0;const o=(c,a)=>{let u=null,l=null;c.method?(u=c.method??null,l=c?.params??null):Array.isArray(c)&&c.length>0&&(u=c[0]??null,l=c[1]??null),u&&(i++,s[a]=u+"?"+Oo(l))};for(const[c,a]of Object.entries(e))o(a,c);return i<1?Promise.resolve(new qe):this.call("batch",{halt:t?1:0,cmd:s}).then(c=>{const a=c.getData().result,u={},l=(p,m)=>{if(typeof a.result[m]<"u"||typeof a.result_error[m]<"u"){const g=p.split("?");u[m]=new _r({answer:{result:C.isUndefined(a.result[m])?{}:a.result[m],error:a?.result_error[m]||void 0,total:a.result_total[m],next:a.result_next[m],time:a.result_time[m]},query:{method:g[0]||"",params:Io(g[1]||""),start:0},status:c.getStatus()})}};for(const[p,m]of Object.entries(s))l(m,p);const f={},h=p=>p.hasError("base-error")?p.errors.get("base-error"):new Fe({code:"0",description:p.getErrorMessages().join("; "),status:0,requestInfo:{method:p.getQuery().method,params:p.getQuery().params},originalError:p.getErrors().next().value}),d=new qe;for(const p of Object.keys(u)){const m=u[p];if(m.getStatus()!==200||!m.isSuccess){const g=h(m);if(!t&&!m.isSuccess){d.addError(g,p);continue}return Promise.reject(g)}f[p]=n?m:m.getData().result}return d.setData(f),Promise.resolve(d)})}async#l(e,t=!0,n=!1){const s=[];let i=0;const o=c=>{let a=null,u=null;if(c.method?(a=c.method??null,u=c?.params??null):Array.isArray(c)&&c.length>0&&(a=c[0]??null,u=c[1]??null),a){i++;const l=a+"?"+Oo(u);s.push(l)}};for(const[c,a]of e.entries())o(a);return i<1?Promise.resolve(new qe):this.call("batch",{halt:t?1:0,cmd:s}).then(c=>{const a=c.getData().result,u=[],l=(p,m)=>{if(typeof a.result[m]<"u"||typeof a.result_error[m]<"u"){const g=p.split("?"),y=new _r({answer:{result:C.isUndefined(a.result[m])?{}:a.result[m],error:a?.result_error[m]||void 0,total:a.result_total[m],next:a.result_next[m],time:a.result_time[m]},query:{method:g[0]||"",params:Io(g[1]||""),start:0},status:c.getStatus()});u.push(y)}};for(const[p,m]of s.entries())l(m,p);const f=[],h=p=>p.hasError("base-error")?p.errors.get("base-error"):new Fe({code:"0",description:p.getErrorMessages().join("; "),status:0,requestInfo:{method:p.getQuery().method,params:p.getQuery().params},originalError:p.getErrors().next().value}),d=new qe;for(const p of u){if(p.getStatus()!==200||!p.isSuccess){const m=h(p);if(!t&&!p.isSuccess){d.addError(m);continue}return Promise.reject(m)}f.push(n?p:p.getData().result)}return d.setData(f),Promise.resolve(d)})}async call(e,t,n=0){let s=this.#r.getAuthData();return s===!1&&(s=await this.#r.refreshAuth()),await this.#t.check(),this.#o&&!this.isServerSide()&&C.isStringFilled(this.#i)&&this.getSystemLogger().warn(this.#i),this.#e.post(this.#u(e),this.#a(s,t,n)).then(i=>{const o=i.data;return Promise.resolve({status:i.status,payload:o})},async i=>{let o={error:i?.code||0,errorDescription:i?.message||""};if(i instanceof Rn&&i.response&&i.response.data&&!C.isUndefined(i.response.data.error)){const a=i.response.data;o={error:a.error,errorDescription:a.error_description}}const c=new Fe({code:String(o.error),description:o.errorDescription,status:i.response?.status||0,requestInfo:{method:e,params:t},originalError:i});return c.status===401&&["expired_token","invalid_token"].includes(c.answerError.error)?(this.getLogger().info(`refreshAuth >> ${c.answerError.error} >>>`),s=await this.#r.refreshAuth(),await this.#t.check(),this.#e.post(this.#u(e),this.#a(s,t,n)).then(async a=>{const u=a.data;return Promise.resolve({status:a.status,payload:u})},async a=>{let u={error:a?.code||0,errorDescription:a?.message||""};if(a instanceof Rn&&a.response&&a.response.data){const f=a.response.data;u={error:f.error,errorDescription:f.error_description}}const l=new Fe({code:String(u.error),description:u.errorDescription,status:i.response?.status||0,requestInfo:{method:e,params:t},originalError:a});return Promise.reject(l)})):Promise.reject(c)}).then(i=>{const o=new _r({answer:i.payload,query:{method:e,params:t,start:n},status:i.status});return Promise.resolve(o)})}#a(e,t,n=0){const s=Object.assign({},t);return this.#s.length>0&&(s.logTag=this.#s),s.data&&s.data.start&&delete s.data.start,e.refresh_token!=="hook"&&(s.auth=e.access_token),s.start=n,s}#u(e){const t=`${encodeURIComponent(e)}.json`,n=new URLSearchParams({[this.#n.getQueryStringParameterName()]:this.#n.getRequestId(),[this.#n.getQueryStringSdkParameterName()]:"0.4.5",[this.#n.getQueryStringSdkTypeParameterName()]:"b24-js-sdk"});return`${t}?${n.toString()}`}setClientSideWarning(e,t){this.#o=e,this.#i=t}isServerSide(){return typeof window>"u"}}class _t{static batchSize=50;_isInit=!1;_http=null;_logger=null;constructor(){this._isInit=!1}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}setLogger(e){this._logger=e,this.getHttpClient().setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}callMethod(e,t,n){return this.getHttpClient().call(e,t||{},n||0)}async callListMethod(e,t={},n=null,s=null){const i=new qe;return C.isFunction(n)&&n!==null&&n(0),this.callMethod(e,t,0).then(async o=>{let c=[],a;if(s===null?a=o.getData().result:a=o.getData().result[s],c=[...c,...a],o.isMore()){let u=o;for(;u=await u.getNext(this.getHttpClient()),u!==!1;){let l;if(s===null?l=u.getData().result:l=u.getData().result[s],c=[...c,...l],n){const f=u.getTotal();n(f>0?Math.round(100*c.length/f):100)}}}return i.setData(c),n&&n(100),i})}async*fetchListMethod(e,t={},n="ID",s=null){t.order=t.order||{},t.filter=t.filter||{},t.start=-1;const i=`>${n}`;t.order[n]="ASC",t.filter[i]=0;do{const o=await this.callMethod(e,t,t.start);let c;if(!C.isNull(s)&&s!==null?c=o.getData().result[s]:c=o.getData().result,c.length===0||(yield c,c.length<_t.batchSize))break;const a=c.at(-1);a&&n in a&&(t.filter[i]=a[n])}while(!0)}async callBatch(e,t=!0,n=!1){return this.getHttpClient().batch(e,t,n)}chunkArray(e,t=50){const n=[];for(let s=0;s<e.length;s+=t){const i=e.slice(s,s+t);n.push(i)}return n}async callBatchByChunk(e,t=!0){const n=new qe,s=[],i=this.chunkArray(e,_t.batchSize);for(const o of i){const c=await this.callBatch(o,t);s.push(...c.getData())}return n.setData(s)}getHttpClient(){if(!this.isInit||this._http===null)throw new Error("Http not init");return this._http}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new Error("B24 not initialized")}}var jn=(r=>(r.en="en",r.de="de",r.la="la",r.br="br",r.fr="fr",r.it="it",r.pl="pl",r.ru="ru",r.ua="ua",r.tr="tr",r.sc="sc",r.tc="tc",r.ja="ja",r.vn="vn",r.id="id",r.ms="ms",r.th="th",r.ar="ar",r))(jn||{});const Sh={en:"en-EN",de:"de-DE",la:"es-ES",br:"pt-BR",fr:"fr-FR",it:"it-IT",pl:"pl-PL",ru:"ru-RU",ua:"uk-UA",tr:"tr-TR",sc:"zh-CN",tc:"zh-TW",ja:"ja-JP",vn:"vi-VN",id:"id-ID",ms:"ms-MY",th:"th-TH",ar:"ar-SA"},_h=()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)});let kh=class ht{static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!ht.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");ht.isInternalConstructing=!1}static getInstance(){return ht.instance||(ht.isInternalConstructing=!0,ht.instance=new ht),ht.instance}setDefLocale(e){this._defLocale=e}format(e,t){let n;(typeof t>"u"||!C.isStringFilled(t))&&(t=C.isStringFilled(this._defLocale)?this._defLocale||"en":typeof navigator>"u"?"en":navigator?.language||"en"),Number.isInteger(e)?n=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):n=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let s=n.format(e);return t.includes("ru")&&(s=s.replace(",",".")),s}};class T{countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,n,s){this.countryCode=e,this.length=t,this.structure=n,this.example=s}isValid(e){return this.length===e.length&&this.countryCode===e.slice(0,2)&&this._regex().test(e.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(e))==1}toBBAN(e,t){return(this._regex().exec(e.slice(4)||"")||[]).slice(1).join(t)}fromBBAN(e){if(!this.isValidBBAN(e))throw new Error("Invalid BBAN");const t=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+e)))).slice(-2);return this.countryCode+t+e}isValidBBAN(e){return this.length-4===e.length&&this._regex().test(e)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(e){const t=(e.match(/(.{3})/g)||[]).map(n=>{let s;const i=n.slice(0,1),o=Number.parseInt(n.slice(1),10);switch(i){case"A":s="0-9A-Za-z";break;case"B":s="0-9A-Z";break;case"C":s="A-Za-z";break;case"F":s="0-9";break;case"L":s="a-z";break;case"U":s="A-Z";break;case"W":s="0-9a-z";break}return"(["+s+"]{"+o+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const n=t.charCodeAt(0);return n>=65&&n<=90?(n-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,n;for(;t.length>2;)n=t.slice(0,9),t=Number.parseInt(n,10)%97+t.slice(n.length);return Number.parseInt(t,10)%97}}class et{static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!et.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");et.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return et.instance||(et.isInternalConstructing=!0,et.instance=new et),et.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!C.isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const n=this._countries.get(t);return!!n&&n.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const n=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(n,"$1"+t)}electronicFormat(e){const t=/[^a-zA-Z0-9]/g;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const n=e.slice(0,2);if(!this._countries.has(n))throw new Error(`No country with code ${n}`);const s=this._countries.get(n);if(!s)throw new Error(`No country with code ${n}`);return s.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);if(!n)throw new Error(`No country with code ${e}`);return n.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!C.isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);return!!n&&n.isValidBBAN(this.electronicFormat(t))}}const vh=()=>{const r=kh.getInstance(),e=et.getInstance();return e.addSpecification(new T("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new T("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new T("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new T("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new T("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new T("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new T("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new T("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new T("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new T("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new T("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new T("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new T("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new T("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new T("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new T("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new T("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new T("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new T("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new T("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new T("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new T("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new T("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new T("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new T("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new T("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new T("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new T("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new T("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new T("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new T("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new T("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new T("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new T("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new T("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new T("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new T("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new T("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new T("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new T("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new T("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new T("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new T("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new T("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new T("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new T("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new T("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new T("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new T("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new T("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new T("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new T("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new T("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new T("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new T("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new T("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new T("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new T("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new T("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new T("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new T("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new T("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new T("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new T("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new T("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new T("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new T("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new T("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new T("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new T("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new T("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new T("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new T("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new T("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new T("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new T("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new T("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new T("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new T("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new T("BI",16,"F12","BI41123456789012")),e.addSpecification(new T("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new T("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new T("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new T("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new T("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new T("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new T("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new T("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new T("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new T("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new T("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new T("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new T("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new T("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new T("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new T("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new T("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new T("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new T("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new T("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new T("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new T("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}};class Co{#e;#r;#t;#n;constructor(e){this.#e=Object.freeze(Object.assign({},e)),this.#r=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#t=`https://${this.#r}/rest`,this.#n=`https://${this.#r}`}getAuthData(){return{access_token:this.#e.secret,refresh_token:"hook",expires_in:0,domain:this.#r,member_id:this.#r}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#n}`}getTargetOriginWithPath(){return`${this.#t}/${this.#e.userId}/${this.#e.secret}`}get isAdmin(){return!0}}class Bn extends _t{#e;constructor(e){super(),this.#e=new Co(e),this._http=new xn(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._http.setClientSideWarning(!0,"It is not safe to use hook requests on the client side"),this._isInit=!0}setLogger(e){super.setLogger(e)}get auth(){return this.#e}offClientSideWarning(){this.getHttpClient().setClientSideWarning(!1,"")}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}static fromWebhookUrl(e){if(!e.trim())throw new Error("Webhook URL cannot be empty");let t;try{t=new URL(e)}catch{throw new Error(`Invalid webhook URL format: ${e}`)}if(t.protocol!=="https:")throw new Error("Webhook requires HTTPS protocol");const n=t.pathname.split("/").filter(Boolean);if(n.length<3||n[0]!=="rest")throw new Error("Webhook URL must follow format: /rest/<userId>/<secret>");const s=n[1],i=n[2];if(!/^\d+$/.test(s))throw new Error(`User ID must be numeric in webhook URL, received: ${s}`);const o=Number.parseInt(s,10);return new Bn({b24Url:t.origin,userId:o,secret:i})}}var X=(r=>(r.getInitData="getInitData",r.setInstallFinish="setInstallFinish",r.setInstall="setInstall",r.refreshAuth="refreshAuth",r.setAppOption="setAppOption",r.setUserOption="setUserOption",r.resizeWindow="resizeWindow",r.reloadWindow="reloadWindow",r.setTitle="setTitle",r.setScroll="setScroll",r.openApplication="openApplication",r.closeApplication="closeApplication",r.openPath="openPath",r.imCallTo="imCallTo",r.imPhoneTo="imPhoneTo",r.imOpenMessenger="imOpenMessenger",r.imOpenHistory="imOpenHistory",r.selectUser="selectUser",r.selectAccess="selectAccess",r.selectCRM="selectCRM",r.showAppForm="showAppForm",r.getInterface="getInterface",r.placementBindEvent="placementBindEvent",r))(X||{});class No{#e;#r;#t;_logger=null;runCallbackHandler;constructor(e){this.#e=e,this.#r=new Map,this.#t=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(e,t=null){return new Promise((n,s)=>{let i;const o={resolve:n,reject:s,timeoutId:null},c=this.#n(o);let a=null;const u=Yn(t||{},["singleOption","callBack","isSafely","safelyTime"]),{callBack:l,singleOption:f}=t||{};if(l&&this.#t.set(c,l),f?a=f:Object.keys(u).length>0&&(a={...u}),e.toString().includes(":"))i={method:e.toString(),params:a||"",callback:c,appSid:this.#e.getAppSid()};else{i=e.toString();const h=[a?JSON.stringify(a):"",c,this.#e.getAppSid()];i+=":"+h.filter(Boolean).join(":")}this.getLogger().log(`send to ${this.#e.getTargetOrigin()}`,{cmd:i}),parent.postMessage(i,this.#e.getTargetOrigin()),t?.isSafely&&(this.#r.get(c).timeoutId=window.setTimeout(()=>{this.#r.has(c)&&(this.getLogger().warn(`Action ${e.toString()} stop by timeout`),this.#r.delete(c),n({isSafely:!0}))},Number.parseInt(String(t?.safelyTime||900))))})}_runCallback(e){if(e.origin===this.#e.getTargetOrigin()&&e.data){this.getLogger().log(`get from ${e.origin}`,{data:e.data});const t=e.data.split(":"),n={id:t[0],args:t.slice(1).join(":")};if(n.args&&(n.args=JSON.parse(n.args)),this.#r.has(n.id)){const s=this.#r.get(n.id);s.timeoutId&&clearTimeout(s.timeoutId),this.#r.delete(n.id),s.resolve(n.args)}else if(this.#t.has(n.id)){const s=this.#t.get(n.id);s&&s.apply(globalThis,[n.args])}}}#n(e){const t=$.getUniqId();return this.#r.set(t,e),t}}class Ro{#e="";#r=!0;#t=null;#n=null;#s=null;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#r=e.PROTOCOL===!0,e.LANG&&(this.#s=e.LANG),e.APP_SID&&(this.#t=e.APP_SID)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#n||(this.#n=e.PATH),this.#s||(this.#s=e.LANG),this.#r=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this}getAppSid(){if(this.#t===null)throw new Error("Not init appSid");return this.#t}getTargetOrigin(){return`${this.#r?"https":"http"}://${this.#e}`}getTargetOriginWithPath(){return this.getTargetOrigin()+(this.#n??"")}getLang(){return this.#s||jn.en}}class Lo{#e=null;#r=null;#t=0;#n=null;#s=!1;#o;#i;constructor(e,t){this.#o=e,this.#i=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#r=e.REFRESH_ID,this.#t=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,this.#s=e.IS_ADMIN,this.#n=e.MEMBER_ID||""),this}getAuthData(){return this.#t>Date.now()?{access_token:this.#e,refresh_token:this.#r,expires_in:this.#t,domain:this.#o.getTargetOrigin(),member_id:this.#n}:!1}async refreshAuth(){return this.#i.send(X.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#r=e.REFRESH_ID,this.#t=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#n||""].join("_")}get isAdmin(){return this.#s}}class Do{#e;constructor(e){this.#e=e}async closeApplication(){return this.#e.send(X.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(X.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(X.resizeWindow,{width:e,height:t,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${e} or height:number = ${t}`))}async resizeWindowAuto(e=null,t=0,n=0){const s=document.body;let i=Math.max(s.scrollWidth,s.offsetWidth);n>0&&(i=Math.max(n,i));let o=Math.max(s.scrollHeight,s.offsetHeight);return e&&(o=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(o=Math.max(t,o)),this.resizeWindow(i,o)}getScrollSize(){return _h()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(X.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(X.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(X.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(X.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(X.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(X.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(X.imOpenHistory,{dialogId:e,isSafely:!0})}}let Po=class{#e;#r=null;#t=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#r=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#t=e.USER_OPTIONS),this}appGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#r||(this.#r=[]),this.#r[e]=t,this.#n(X.setAppOption,e,this.#r[e])}userGet(e){if(this.#t&&this.#t[e])return this.#t[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#r||(this.#r=[]),this.#r[e]||(this.#r[e]=null),this.#t[e]=t,this.#n(X.setUserOption,e,this.#t[e])}async#n(e,t,n){return this.#e.send(e,{name:t,value:n,isSafely:!0}).then(()=>Promise.resolve())}};class Mo{#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(X.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(X.selectUser,{mult:!0})}async selectAccess(e=[]){return console.warn("@deprecated selectAccess"),this.#e.send(X.selectAccess,{value:e})}async selectCRM(e){return console.warn("@deprecated selectCRM"),this.#e.send(X.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value})}}class Fo{#e;#r;constructor(e,t){this.#e=e,this.#r=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#r.send(X.openApplication,e)}async closeSliderAppPage(){return this.#r.send(X.closeApplication,{isSafely:!1})}#t(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const n=new URL(e);return n.searchParams.set("IFRAME","Y"),n.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#r.send(X.openPath,{path:[this.#t(t),n.pathname,n.search].join("")}).then(s=>s?.result==="error"?s?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((i,o)=>{const c=window.open(e,"_blank");if(!c){o(new Error("Error open window"));return}let a=0;const u=1e3*60*5,l=window.setInterval(()=>{a=a+1,c.closed?(clearInterval(l),i({isOpenAtNewWindow:!0,isClose:!0})):a>u&&(clearInterval(l),i({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(s?.errorCode)):s?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}async showAppForm(e){return console.warn("@deprecated showAppForm"),this.#r.send(X.showAppForm,{params:e,isSafely:!0})}}class xo{#e;#r="";#t={};constructor(e){this.#e=e}initData(e){this.#r=e.PLACEMENT||"DEFAULT";const t=e.PLACEMENT_OPTIONS;return this.#t=Object.freeze(t),this}get title(){return this.#r}get isDefault(){return this.title==="DEFAULT"}get options(){return this.#t}get isSliderMode(){return this.options?.IFRAME==="Y"}async getInterface(){return this.#e.send(X.getInterface,{isSafely:!0})}async bindEvent(e,t){return this.#e.send(X.placementBindEvent,{event:e,callBack:t,isSafely:!0})}async call(e,t={}){return this.#e.send(e,{...t,isSafely:!0})}async callCustomBind(e,t=null,n){let s={};return C.isString(t)?s.singleOption=t:C.isObjectLike(t)&&(s={...t}),this.#e.send(e,{...s,callBack:n,isSafely:!0})}}class jo extends _t{#e=!1;#r=!1;#t;#n;#s;#o;#i;#c;#l;#a;constructor(e){super(),this.#t=new Ro(e),this.#n=new No(this.#t),this.#n.subscribe(),this.#s=new Lo(this.#t,this.#n),this.#o=new Do(this.#n),this.#i=new Po(this.#n),this.#c=new Mo(this.#n),this.#l=new Fo(this.#t,this.#n),this.#a=new xo(this.#n),this._isInit=!1}setLogger(e){super.setLogger(e),this.#n.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#r}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#o}get auth(){return this._ensureInitialized(),this.#s}get slider(){return this._ensureInitialized(),this.#l}get placement(){return this._ensureInitialized(),this.#a}get options(){return this._ensureInitialized(),this.#i}get dialog(){return this._ensureInitialized(),this.#c}async init(){return this.#n.send(X.getInitData,{}).then(e=>(this.getLogger().log("init data:",e),this.#t.initData(e),this.#s.initData(e),this.#a.initData(e),this.#i.initData(e),this.#e=e.INSTALL,this.#r=e.FIRST_RUN,this._http=new xn(this.#t.getTargetOriginWithPath(),this.#s,this._getHttpOptions()),this._isInit=!0,this.#r?this.#n.send(X.setInstall,{install:!0}):Promise.resolve()))}destroy(){this.#n.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#n.send(X.setInstallFinish,{}):Promise.reject(new Error("Application was previously installed. You cannot call installFinish"))}getTargetOrigin(){return this._ensureInitialized(),this.#t.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#t.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#t.getAppSid()}getLang(){return this._ensureInitialized(),this.#t.getLang()}}class Eh extends Fe{}class Bo{#e;#r=null;#t;#n;#s=0;#o;#i;#c;#l;#a=null;constructor(e,t){this.#t=Object.assign({},e),this.#n=Object.freeze(Object.assign({},t)),this.#o=this.#t.domain.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#i=this.#t.clientEndpoint,this.#c=this.#i.replace("/rest/",""),this.#l=this.#t.serverEndpoint.replace("/rest/",""),this.#s=this.#t.expires*1e3,this.#e=ie.create({baseURL:this.#l,headers:{"Content-Type":"application/json"}})}getAuthData(){return this.#s>Date.now()?{access_token:this.#t.accessToken,refresh_token:this.#t.refreshToken,expires_in:this.#t.expiresIn,domain:this.#o,member_id:this.#t.memberId}:!1}async refreshAuth(){try{const e=await this.#e.get("/oauth/token/",{params:{grant_type:"refresh_token",client_id:this.#n.clientId,client_secret:this.#n.clientSecret,refresh_token:this.#t.refreshToken}});if(e.data.error)throw new Error(`Token update error: ${e.data.error}`);if(e.status!==200)throw new Error(`Token update error status code: ${e.status}`);const t=e.data;this.#t.accessToken=t.access_token,this.#t.refreshToken=t.refresh_token,this.#t.expires=Number.parseInt(t.expires||"0"),this.#t.expiresIn=Number.parseInt(t.expires_in||"3600"),this.#t.clientEndpoint=t.client_endpoint,this.#t.serverEndpoint=t.server_endpoint,this.#t.scope=t.scope,this.#t.status=Object.values(Ke).find(s=>s===t.status)||Ke.Free,this.#s=this.#t.expires*1e3;const n=this.getAuthData();return this.#r&&await this.#r({authData:n,b24OAuthParams:this.#t}),n}catch(e){if(e instanceof Rn){let t={error:e?.code||0,errorDescription:e?.message||""};if(e.response&&e.response.data&&!C.isUndefined(e.response.data.error)){const n=e.response.data;t={error:n.error,errorDescription:n.error_description}}throw new Eh({code:String(t.error),description:t.errorDescription,status:e.response?.status||0,requestInfo:{method:"/oauth/token/"}})}else if(e instanceof Error)throw e;throw new Error(`Strange error: ${e instanceof Error?e.message:e}`,{cause:e})}}setCallbackRefreshAuth(e){this.#r=e}removeCallbackRefreshAuth(){this.#r=null}getUniq(e){return[e,this.#t.memberId||""].join("_")}getTargetOrigin(){return`${this.#c}`}getTargetOriginWithPath(){return`${this.#i}`}get isAdmin(){if(this.#a===null)throw new Error("isAdmin not init. You need call B24OAuth::initIsAdmin().");return this.#a}async initIsAdmin(e){const t=await e.call("profile",{},0);if(!t.isSuccess)throw new Error(t.getErrorMessages().join(";"));t.getData().result?.ADMIN&&(this.#a=!0)}}class Th extends _t{#e;constructor(e,t){super(),this.#e=new Bo(e,t),this._http=new xn(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._http.setClientSideWarning(!0,"It is not safe to use oauth requests on the client side"),this._isInit=!0}setLogger(e){super.setLogger(e)}async initIsAdmin(){return this._ensureInitialized(),this.#e.initIsAdmin(this._http)}setCallbackRefreshAuth(e){this._ensureInitialized(),this.#e.setCallbackRefreshAuth(e)}removeCallbackRefreshAuth(){this._ensureInitialized(),this.#e.removeCallbackRefreshAuth()}offClientSideWarning(){this.getHttpClient().setClientSideWarning(!1,"")}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}class Un extends Error{constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=new Error("for stack").stack}}class xt{_b24;_logger=null;_data=null;constructor(e){this._b24=e}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}async initData(e){return this.getLogger().log(e),Promise.reject(new Error("Rewrite this function"))}}class Oh extends xt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}class Ah extends xt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return xi[this.data.status]||"Unknown status"}}class Ih extends xt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}class Ch extends xt{_data=null;async initData(e){this._data=e,this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}makeRestrictionManagerParams(){this.data?.license&&this.data.license.includes("ent")&&(this.getLogger().log(`LICENSE ${this.data.license} => up restriction manager params`,pn),this._b24.getHttpClient().setRestrictionManagerParams(pn))}}class Nh extends xt{async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(console.error(t),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{(await this._b24.callBatchByChunk(e,!0)).getData().forEach(t=>{if(typeof t.LANG>"u")return;const n=t.CURRENCY,s=this.data.currencyList.get(n);if(!(typeof s>"u"))for(const[i,o]of Object.entries(t.LANG))switch(s.lang[i]={decimals:Number.parseInt(o.DECIMALS),decPoint:o.DEC_POINT,formatString:o.FORMAT_STRING,fullName:o.FULL_NAME,isHideZero:o.HIDE_ZERO==="Y",thousandsSep:o.THOUSANDS_SEP,thousandsVariant:o.THOUSANDS_VARIANT},s.lang[i].thousandsVariant){case"N":s.lang[i].thousandsSep="";break;case"D":s.lang[i].thousandsSep=".";break;case"C":s.lang[i].thousandsSep=",";break;case"S":s.lang[i].thousandsSep=" ";break;case"B":s.lang[i].thousandsSep="&nbsp;";break;default:C.isStringFilled(s.lang[i].thousandsSep)||(s.lang[i].thousandsSep=" ");break}})}catch(t){console.error(t)}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(e){this._data.currencyBase=e}get baseCurrency(){return this.data.currencyBase}setCurrencyList(e=[]){this.data.currencyList.clear();for(const t of e)this.data.currencyList.set(t.CURRENCY,{amount:Number.parseFloat(t.CURRENCY),amountCnt:Number.parseInt(t.AMOUNT_CNT),isBase:t.BASE==="Y",currencyCode:t.CURRENCY,dateUpdate:$.toDateTime(t.DATE_UPDATE),decimals:Number.parseInt(t.DECIMALS),decPoint:t.DEC_POINT,formatString:t.FORMAT_STRING,fullName:t.FULL_NAME,lid:t.LID,sort:Number.parseInt(t.SORT),thousandsSep:t?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Un(e);let s=n.fullName;if(!(typeof t>"u")){const i=n.lang[t];C.isUndefined(i)||(s=i.fullName)}return s}getCurrencyLiteral(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Un(e);let s=n.formatString;if(!(typeof t>"u")){const i=n.lang[t];C.isUndefined(i)||(s=i.formatString)}return s.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,n){const s=this.data.currencyList.get(t);if(typeof s>"u")throw new Un(t);const i={formatString:s.formatString,decimals:s.decimals,decPoint:s.decPoint,thousandsSep:s.thousandsSep};C.isStringFilled(i.thousandsSep)||(i.thousandsSep="");const o=s.lang[n];return C.isUndefined(o)||(i.formatString=o.formatString,i.decimals=o.decimals,i.decPoint=o.decPoint,i.thousandsSep=o.thousandsSep),i.formatString.replaceAll("&#","&%").replace("#",$.numberFormat(e,i.decimals,i.decPoint,i.thousandsSep)).replaceAll("&%","&#")||""}}class $n extends xt{_data;_type;static getSupportTypes(){return[Qe.NotSet,Qe.JsonArray,Qe.JsonObject,Qe.FloatVal,Qe.IntegerVal,Qe.BoolYN,Qe.StringVal]}static prepareArrayList(e){return C.isArray(e)?e:C.isObject(e)?Object.values(e):[]}constructor(e,t){super(e),this._type=t,this._data=new Map}get data(){return this._data}reset(){this.data.clear()}async initData(e){if(this.reset(),C.isObject(e))for(const[t,n]of Object.entries(e))this.data.set(t,n)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n),!C.isArray(n)&&!C.isObject(n)&&(n=t)}catch(s){this.getLogger().error(s),n=t}return $n.prepareArrayList(n)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n)}catch(s){this.getLogger().error(s),n=t}return C.isObject(n)||(n=t),n}getFloat(e,t=0){return this.data.has(e)?$.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?$.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?$.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?$.toBoolean(this.data.get(e)):t}getString(e,t=""){return this.data.has(e)?this.data.get(e).toString():t}getDate(e,t=null){if(!this.data.has(e))return t;try{const n=$.toDateTime(this.data.get(e).toString());return n.isValid?n:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(n){this.getLogger().warn(n,e)}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t){const n=[];return n.push({method:this.getMethodSave(),params:{options:e}}),C.isObject(t)&&n.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.callBatch(n,!0)}}class Uo{_logger=null;userId;siteId;constructor(e={}){this.userId=e.userId?$.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}set(e,t){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window.localStorage>"u")return t||null;const n=window.localStorage.getItem(this._getKey(e));return n===null?t||null:JSON.parse(n)}remove(e){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}return window.localStorage.removeItem(this._getKey(e))}_getKey(e){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${e}`}compareKey(e,t){return e===this._getKey(t)}}class Rh extends Error{constructor(e){super(e),this.name="ErrorNotConnected"}}class Lh extends Error{constructor(e){super(e),this.name="ErrorTimeout"}}const Fr="2.0";class Dh{_logger=null;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._connector=e.connector,C.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,n=5){return new Promise((s,i)=>{const o=this.createRequest(e,t);this._connector.send(JSON.stringify(o))||i(new Rh("websocket is not connected"));const c=setTimeout(()=>{this._rpcResponseAwaiters.delete(o.id),i(new Lh("no response"))},n*1e3);this._rpcResponseAwaiters.set(o.id,{resolve:s,reject:i,timeout:c})})}executeOutgoingRpcBatch(e){const t=[],n=[];return e.forEach(({method:s,params:i,id:o})=>{const c=this.createRequest(s,i,o);t.push(c),n.push(new Promise((a,u)=>this._rpcResponseAwaiters.set(c.id,{resolve:a,reject:u})))}),this._connector.send(JSON.stringify(t)),n}processRpcResponse(e){if("id"in e&&this._rpcResponseAwaiters.has(Number(e.id))){const t=this._rpcResponseAwaiters.get(Number(e.id));t&&("result"in e?t.resolve(e.result):"error"in e?t.reject(e?.error||"error"):t.reject("wrong response structure"),clearTimeout(t.timeout),this._rpcResponseAwaiters.delete(Number(e.id)));return}this.getLogger().error(new Error(`${$.getDateForLog()}: Pull: Received rpc response with unknown id`),e)}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(n){this.getLogger().error(new Error(`${$.getDateForLog()}: Pull: Could not decode json rpc message`),n);return}if(C.isArray(t))return this.executeIncomingRpcBatch(t);if(C.isJsonRpcRequest(t))return this.executeIncomingRpcCommand(t);if(C.isJsonRpcResponse(t))return this.processRpcResponse(t);this.getLogger().error(new Error(`${$.getDateForLog()}: Pull: unknown rpc packet`),t)}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:Fr,error:wn.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const n of e)if("jsonrpc"in n)if("method"in n){const s=this.executeIncomingRpcCommand(n);s&&(s.jsonrpc=Fr,s.id=n.id,t.push(s))}else this.processRpcResponse(n);else this.getLogger().error(new Error(`${$.getDateForLog()}: Pull: unknown rpc command in batch`),n),t.push({jsonrpc:Fr,error:wn.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,n){return n||(n=this.nextId()),{jsonrpc:Fr,method:e,params:t,id:n}}}class Ph{_logger=null;_storage;_ttl=24*60*60;_callbacks;constructor(e={}){e=e||{},this._storage=e.storage||new Uo,this._callbacks={onWebSocketBlockChanged:C.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",Ne.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(Ne.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(Ne.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${$.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage. Error: `),t),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(Ne.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(Ne.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${$.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage. Error: `),t),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(Ne.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(Ne.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${$.getDateForLog()}: LocalStorage error: `),t),!1}return!0}getTimestamp(){return Date.now()}}class Mh{_logger=null;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}async getPublicIds(e){const t=new Date,n={},s=[];for(const i of e){const o=this._publicIds.get(i);o&&o.end>t?n[o.userId]=o:s.push(i)}return s.length===0?Promise.resolve(n):new Promise(i=>{this._restClient.callMethod(this._getPublicListMethod,{users:s}).then(o=>{const c=o.getData().result;this.setPublicIds(Object.values(c));for(const a of s){const u=this._publicIds.get(a);u&&(n[u.userId]=u)}i(n)}).catch(o=>(this.getLogger().error(o),i({})))})}setPublicIds(e){e.forEach(t=>{const n=Number(t.user_id);this._publicIds.set(n,{userId:n,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var rr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Wn={exports:{}};/*!
7
+ `))}}class Tr extends qe{_status;_query;_data;constructor(e){super(),this._data=Object.freeze(e.answer),this._query=Object.freeze(structuredClone(e.query)),this._status=e.status,this.#e()}#e(){const{error:e}=this._data;if(!e)return;const t=this.#r(e);this.addError(this.#t(t),"base-error")}#r(e){return typeof e=="string"?{code:e,description:this._data.error_description||""}:{code:e.error,description:e.error_description||""}}#t(e){return new Fe({code:String(this._status),description:e.description,status:this._status,requestInfo:{method:this._query.method,params:this._query.params}})}getData(){return Object.freeze({result:this._data.result,next:this._data.next,total:this._data.total,time:this._data.time})}hasMore(){return this.isMore()}isMore(){return C.isNumber(this._data?.next)}getTotal(){return W.toInteger(this._data?.total)}getStatus(){return this._status}getQuery(){return this._query}async fetchNext(e){const t=await this.getNext(e);return t===!1?null:t}async getNext(e){if(!this.isMore()||!this.isSuccess)return!1;const t=this.#n();return e.call(t.method,t.params,t.start)}#n(){return{...this._query,start:W.toInteger(this._data.next)}}setData(){throw new ReferenceError("AjaxResult does not allow data modification")}}let _c=class{#e;#r;#t;_logger=null;constructor(){this.#e=Li,this.#t=0,this.#r=0}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}get params(){return{...this.#e}}set params(e){this.#e=e,this.getLogger().log("new restriction manager params",e)}check(e=""){return new Promise(t=>{if(this.#s(),this.#i())return this.getLogger().log(`>> no sleep >>> ${e}`,this.#n()),this.#o(),t(null);{const n=i=>{this.getLogger().info(`>> go sleep >>> ${e}`,this.#n()),setTimeout(()=>{i()},this.#e.sleep)},s=()=>{if(this.#s(),this.#i())return this.getLogger().info(`<< stop sleep <<< ${e}`,this.#n()),this.#o(),t(null);n(s)};n(s)}})}#n(){return`${this.#t.toFixed(4)} from ${this.#e.amount}`}#s(){this.#r>0&&(this.#t-=(Date.now()-this.#r)*this.#e.speed,this.#t<0&&(this.#t=0)),this.#r=Date.now()}#o(){this.#t++}#i(){return this.#t<this.#e.amount}};const kc="X-Request-ID",vc="bx24_request_id",Ec="bx24_sdk_ver",Tc="bx24_sdk_type";let Oc=class{getQueryStringParameterName(){return vc}getQueryStringSdkParameterName(){return Ec}getQueryStringSdkTypeParameterName(){return Tc}generate(){return W.getUuidRfc4122()}getRequestId(){return this.generate()}getHeaderFieldName(){return kc}};function Wi(r,e){return function(){return r.apply(e,arguments)}}const{toString:Ac}=Object.prototype,{getPrototypeOf:kn}=Object,{iterator:Or,toStringTag:qi}=Symbol,Ar=(r=>e=>{const t=Ac.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ve=r=>(r=r.toLowerCase(),e=>Ar(e)===r),Ir=r=>e=>typeof e===r,{isArray:Mt}=Array,Qt=Ir("undefined");function Xt(r){return r!==null&&!Qt(r)&&r.constructor!==null&&!Qt(r.constructor)&&Te(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const Vi=Ve("ArrayBuffer");function Ic(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Vi(r.buffer),e}const Cc=Ir("string"),Te=Ir("function"),zi=Ir("number"),er=r=>r!==null&&typeof r=="object",Nc=r=>r===!0||r===!1,Cr=r=>{if(Ar(r)!=="object")return!1;const e=kn(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(qi in r)&&!(Or in r)},Rc=r=>{if(!er(r)||Xt(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},Lc=Ve("Date"),Dc=Ve("File"),Pc=Ve("Blob"),Mc=Ve("FileList"),Fc=r=>er(r)&&Te(r.pipe),xc=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Te(r.append)&&((e=Ar(r))==="formdata"||e==="object"&&Te(r.toString)&&r.toString()==="[object FormData]"))},jc=Ve("URLSearchParams"),[Bc,Uc,$c,Wc]=["ReadableStream","Request","Response","Headers"].map(Ve),qc=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tr(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,s;if(typeof r!="object"&&(r=[r]),Mt(r))for(n=0,s=r.length;n<s;n++)e.call(null,r[n],n,r);else{if(Xt(r))return;const i=t?Object.getOwnPropertyNames(r):Object.keys(r),o=i.length;let l;for(n=0;n<o;n++)l=i[n],e.call(null,r[l],l,r)}}function Hi(r,e){if(Xt(r))return null;e=e.toLowerCase();const t=Object.keys(r);let n=t.length,s;for(;n-- >0;)if(s=t[n],e===s.toLowerCase())return s;return null}const yt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ji=r=>!Qt(r)&&r!==yt;function vn(){const{caseless:r}=Ji(this)&&this||{},e={},t=(n,s)=>{const i=r&&Hi(e,s)||s;Cr(e[i])&&Cr(n)?e[i]=vn(e[i],n):Cr(n)?e[i]=vn({},n):Mt(n)?e[i]=n.slice():e[i]=n};for(let n=0,s=arguments.length;n<s;n++)arguments[n]&&tr(arguments[n],t);return e}const Vc=(r,e,t,{allOwnKeys:n}={})=>(tr(e,(s,i)=>{t&&Te(s)?r[i]=Wi(s,t):r[i]=s},{allOwnKeys:n}),r),zc=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Hc=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},Jc=(r,e,t,n)=>{let s,i,o;const l={};if(e=e||{},r==null)return e;do{for(s=Object.getOwnPropertyNames(r),i=s.length;i-- >0;)o=s[i],(!n||n(o,r,e))&&!l[o]&&(e[o]=r[o],l[o]=!0);r=t!==!1&&kn(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},Zc=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const n=r.indexOf(e,t);return n!==-1&&n===t},Gc=r=>{if(!r)return null;if(Mt(r))return r;let e=r.length;if(!zi(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},Yc=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&kn(Uint8Array)),Kc=(r,e)=>{const n=(r&&r[Or]).call(r);let s;for(;(s=n.next())&&!s.done;){const i=s.value;e.call(r,i[0],i[1])}},Qc=(r,e)=>{let t;const n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},Xc=Ve("HTMLFormElement"),eu=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,s){return n.toUpperCase()+s}),Zi=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),tu=Ve("RegExp"),Gi=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),n={};tr(t,(s,i)=>{let o;(o=e(s,i,r))!==!1&&(n[i]=o||s)}),Object.defineProperties(r,n)},ru=r=>{Gi(r,(e,t)=>{if(Te(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=r[t];if(Te(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},nu=(r,e)=>{const t={},n=s=>{s.forEach(i=>{t[i]=!0})};return Mt(r)?n(r):n(String(r).split(e)),t},su=()=>{},iu=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function ou(r){return!!(r&&Te(r.append)&&r[qi]==="FormData"&&r[Or])}const au=r=>{const e=new Array(10),t=(n,s)=>{if(er(n)){if(e.indexOf(n)>=0)return;if(Xt(n))return n;if(!("toJSON"in n)){e[s]=n;const i=Mt(n)?[]:{};return tr(n,(o,l)=>{const a=t(o,s+1);!Qt(a)&&(i[l]=a)}),e[s]=void 0,i}}return n};return t(r,0)},lu=Ve("AsyncFunction"),cu=r=>r&&(er(r)||Te(r))&&Te(r.then)&&Te(r.catch),Yi=((r,e)=>r?setImmediate:e?((t,n)=>(yt.addEventListener("message",({source:s,data:i})=>{s===yt&&i===t&&n.length&&n.shift()()},!1),s=>{n.push(s),yt.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Te(yt.postMessage)),uu=typeof queueMicrotask<"u"?queueMicrotask.bind(yt):typeof process<"u"&&process.nextTick||Yi,k={isArray:Mt,isArrayBuffer:Vi,isBuffer:Xt,isFormData:xc,isArrayBufferView:Ic,isString:Cc,isNumber:zi,isBoolean:Nc,isObject:er,isPlainObject:Cr,isEmptyObject:Rc,isReadableStream:Bc,isRequest:Uc,isResponse:$c,isHeaders:Wc,isUndefined:Qt,isDate:Lc,isFile:Dc,isBlob:Pc,isRegExp:tu,isFunction:Te,isStream:Fc,isURLSearchParams:jc,isTypedArray:Yc,isFileList:Mc,forEach:tr,merge:vn,extend:Vc,trim:qc,stripBOM:zc,inherits:Hc,toFlatObject:Jc,kindOf:Ar,kindOfTest:Ve,endsWith:Zc,toArray:Gc,forEachEntry:Kc,matchAll:Qc,isHTMLForm:Xc,hasOwnProperty:Zi,hasOwnProp:Zi,reduceDescriptors:Gi,freezeMethods:ru,toObjectSet:nu,toCamelCase:eu,noop:su,toFiniteNumber:iu,findKey:Hi,global:yt,isContextDefined:Ji,isSpecCompliantForm:ou,toJSONObject:au,isAsyncFn:lu,isThenable:cu,setImmediate:Yi,asap:uu,isIterable:r=>r!=null&&Te(r[Or])};function V(r,e,t,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),s&&(this.response=s,this.status=s.status?s.status:null)}k.inherits(V,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:k.toJSONObject(this.config),code:this.code,status:this.status}}});const Ki=V.prototype,Qi={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{Qi[r]={value:r}}),Object.defineProperties(V,Qi),Object.defineProperty(Ki,"isAxiosError",{value:!0}),V.from=(r,e,t,n,s,i)=>{const o=Object.create(Ki);return k.toFlatObject(r,o,function(a){return a!==Error.prototype},l=>l!=="isAxiosError"),V.call(o,r.message,e,t,n,s),o.cause=r,o.name=r.name,i&&Object.assign(o,i),o};const hu=null;function En(r){return k.isPlainObject(r)||k.isArray(r)}function Xi(r){return k.endsWith(r,"[]")?r.slice(0,-2):r}function eo(r,e,t){return r?r.concat(e).map(function(s,i){return s=Xi(s),!t&&i?"["+s+"]":s}).join(t?".":""):e}function fu(r){return k.isArray(r)&&!r.some(En)}const du=k.toFlatObject(k,{},null,function(e){return/^is[A-Z]/.test(e)});function Nr(r,e,t){if(!k.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=k.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,m){return!k.isUndefined(m[g])});const n=t.metaTokens,s=t.visitor||c,i=t.dots,o=t.indexes,a=(t.Blob||typeof Blob<"u"&&Blob)&&k.isSpecCompliantForm(e);if(!k.isFunction(s))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(k.isDate(p))return p.toISOString();if(k.isBoolean(p))return p.toString();if(!a&&k.isBlob(p))throw new V("Blob is not supported. Use a Buffer instead.");return k.isArrayBuffer(p)||k.isTypedArray(p)?a&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function c(p,g,m){let y=p;if(p&&!m&&typeof p=="object"){if(k.endsWith(g,"{}"))g=n?g:g.slice(0,-2),p=JSON.stringify(p);else if(k.isArray(p)&&fu(p)||(k.isFileList(p)||k.endsWith(g,"[]"))&&(y=k.toArray(p)))return g=Xi(g),y.forEach(function(_,b){!(k.isUndefined(_)||_===null)&&e.append(o===!0?eo([g],b,i):o===null?g:g+"[]",u(_))}),!1}return En(p)?!0:(e.append(eo(m,g,i),u(p)),!1)}const f=[],h=Object.assign(du,{defaultVisitor:c,convertValue:u,isVisitable:En});function d(p,g){if(!k.isUndefined(p)){if(f.indexOf(p)!==-1)throw Error("Circular reference detected in "+g.join("."));f.push(p),k.forEach(p,function(y,w){(!(k.isUndefined(y)||y===null)&&s.call(e,y,k.isString(w)?w.trim():w,g,h))===!0&&d(y,g?g.concat(w):[w])}),f.pop()}}if(!k.isObject(r))throw new TypeError("data must be an object");return d(r),e}function to(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Tn(r,e){this._pairs=[],r&&Nr(r,this,e)}const ro=Tn.prototype;ro.append=function(e,t){this._pairs.push([e,t])},ro.toString=function(e){const t=e?function(n){return e.call(this,n,to)}:to;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};function pu(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function no(r,e,t){if(!e)return r;const n=t&&t.encode||pu;k.isFunction(t)&&(t={serialize:t});const s=t&&t.serialize;let i;if(s?i=s(e,t):i=k.isURLSearchParams(e)?e.toString():new Tn(e,t).toString(n),i){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+i}return r}class so{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){k.forEach(this.handlers,function(n){n!==null&&e(n)})}}const io={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},gu={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Tn,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},On=typeof window<"u"&&typeof document<"u",An=typeof navigator=="object"&&navigator||void 0,mu=On&&(!An||["ReactNative","NativeScript","NS"].indexOf(An.product)<0),yu=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",wu=On&&window.location.href||"http://localhost",_e={...{__proto__:null,hasBrowserEnv:On,hasStandardBrowserEnv:mu,hasStandardBrowserWebWorkerEnv:yu,navigator:An,origin:wu},...gu};function bu(r,e){return Nr(r,new _e.classes.URLSearchParams,{visitor:function(t,n,s,i){return _e.isNode&&k.isBuffer(t)?(this.append(n,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function Su(r){return k.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function _u(r){const e={},t=Object.keys(r);let n;const s=t.length;let i;for(n=0;n<s;n++)i=t[n],e[i]=r[i];return e}function oo(r){function e(t,n,s,i){let o=t[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),a=i>=t.length;return o=!o&&k.isArray(s)?s.length:o,a?(k.hasOwnProp(s,o)?s[o]=[s[o],n]:s[o]=n,!l):((!s[o]||!k.isObject(s[o]))&&(s[o]=[]),e(t,n,s[o],i)&&k.isArray(s[o])&&(s[o]=_u(s[o])),!l)}if(k.isFormData(r)&&k.isFunction(r.entries)){const t={};return k.forEachEntry(r,(n,s)=>{e(Su(n),s,t,0)}),t}return null}function ku(r,e,t){if(k.isString(r))try{return(e||JSON.parse)(r),k.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}const rr={transitional:io,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",s=n.indexOf("application/json")>-1,i=k.isObject(e);if(i&&k.isHTMLForm(e)&&(e=new FormData(e)),k.isFormData(e))return s?JSON.stringify(oo(e)):e;if(k.isArrayBuffer(e)||k.isBuffer(e)||k.isStream(e)||k.isFile(e)||k.isBlob(e)||k.isReadableStream(e))return e;if(k.isArrayBufferView(e))return e.buffer;if(k.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return bu(e,this.formSerializer).toString();if((l=k.isFileList(e))||n.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Nr(l?{"files[]":e}:e,a&&new a,this.formSerializer)}}return i||s?(t.setContentType("application/json",!1),ku(e)):e}],transformResponse:[function(e){const t=this.transitional||rr.transitional,n=t&&t.forcedJSONParsing,s=this.responseType==="json";if(k.isResponse(e)||k.isReadableStream(e))return e;if(e&&k.isString(e)&&(n&&!this.responseType||s)){const o=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(l){if(o)throw l.name==="SyntaxError"?V.from(l,V.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_e.classes.FormData,Blob:_e.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};k.forEach(["delete","get","head","post","put","patch"],r=>{rr.headers[r]={}});const vu=k.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Eu=r=>{const e={};let t,n,s;return r&&r.split(`
8
+ `).forEach(function(o){s=o.indexOf(":"),t=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!t||e[t]&&vu[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e},ao=Symbol("internals");function nr(r){return r&&String(r).trim().toLowerCase()}function Rr(r){return r===!1||r==null?r:k.isArray(r)?r.map(Rr):String(r)}function Tu(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=t.exec(r);)e[n[1]]=n[2];return e}const Ou=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function In(r,e,t,n,s){if(k.isFunction(n))return n.call(this,e,t);if(s&&(e=t),!!k.isString(e)){if(k.isString(n))return e.indexOf(n)!==-1;if(k.isRegExp(n))return n.test(e)}}function Au(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function Iu(r,e){const t=k.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{value:function(s,i,o){return this[n].call(this,e,s,i,o)},configurable:!0})})}let Oe=class{constructor(e){e&&this.set(e)}set(e,t,n){const s=this;function i(l,a,u){const c=nr(a);if(!c)throw new Error("header name must be a non-empty string");const f=k.findKey(s,c);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||a]=Rr(l))}const o=(l,a)=>k.forEach(l,(u,c)=>i(u,c,a));if(k.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(k.isString(e)&&(e=e.trim())&&!Ou(e))o(Eu(e),t);else if(k.isObject(e)&&k.isIterable(e)){let l={},a,u;for(const c of e){if(!k.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[u=c[0]]=(a=l[u])?k.isArray(a)?[...a,c[1]]:[a,c[1]]:c[1]}o(l,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=nr(e),e){const n=k.findKey(this,e);if(n){const s=this[n];if(!t)return s;if(t===!0)return Tu(s);if(k.isFunction(t))return t.call(this,s,n);if(k.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=nr(e),e){const n=k.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||In(this,this[n],n,t)))}return!1}delete(e,t){const n=this;let s=!1;function i(o){if(o=nr(o),o){const l=k.findKey(n,o);l&&(!t||In(n,n[l],l,t))&&(delete n[l],s=!0)}}return k.isArray(e)?e.forEach(i):i(e),s}clear(e){const t=Object.keys(this);let n=t.length,s=!1;for(;n--;){const i=t[n];(!e||In(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const t=this,n={};return k.forEach(this,(s,i)=>{const o=k.findKey(n,i);if(o){t[o]=Rr(s),delete t[i];return}const l=e?Au(i):String(i).trim();l!==i&&delete t[i],t[l]=Rr(s),n[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return k.forEach(this,(n,s)=>{n!=null&&n!==!1&&(t[s]=e&&k.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
9
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[ao]=this[ao]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=nr(o);n[l]||(Iu(s,o),n[l]=!0)}return k.isArray(e)?e.forEach(i):i(e),this}};Oe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),k.reduceDescriptors(Oe.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}}),k.freezeMethods(Oe);function Cn(r,e){const t=this||rr,n=e||t,s=Oe.from(n.headers);let i=n.data;return k.forEach(r,function(l){i=l.call(t,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function lo(r){return!!(r&&r.__CANCEL__)}function Ft(r,e,t){V.call(this,r??"canceled",V.ERR_CANCELED,e,t),this.name="CanceledError"}k.inherits(Ft,V,{__CANCEL__:!0});function co(r,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new V("Request failed with status code "+t.status,[V.ERR_BAD_REQUEST,V.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Cu(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function Nu(r,e){r=r||10;const t=new Array(r),n=new Array(r);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(a){const u=Date.now(),c=n[i];o||(o=u),t[s]=a,n[s]=u;let f=i,h=0;for(;f!==s;)h+=t[f++],f=f%r;if(s=(s+1)%r,s===i&&(i=(i+1)%r),u-o<e)return;const d=c&&u-c;return d?Math.round(h*1e3/d):void 0}}function Ru(r,e){let t=0,n=1e3/e,s,i;const o=(u,c=Date.now())=>{t=c,s=null,i&&(clearTimeout(i),i=null),r(...u)};return[(...u)=>{const c=Date.now(),f=c-t;f>=n?o(u,c):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const Lr=(r,e,t=3)=>{let n=0;const s=Nu(50,250);return Ru(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,a=o-n,u=s(a),c=o<=l;n=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:a,rate:u||void 0,estimated:u&&l&&c?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};r(f)},t)},uo=(r,e)=>{const t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},ho=r=>(...e)=>k.asap(()=>r(...e)),Lu=_e.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,_e.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(_e.origin),_e.navigator&&/(msie|trident)/i.test(_e.navigator.userAgent)):()=>!0,Du=_e.hasStandardBrowserEnv?{write(r,e,t,n,s,i){const o=[r+"="+encodeURIComponent(e)];k.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),k.isString(n)&&o.push("path="+n),k.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(r){const e=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Pu(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function Mu(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function fo(r,e,t){let n=!Pu(e);return r&&(n||t==!1)?Mu(r,e):e}const po=r=>r instanceof Oe?{...r}:r;function wt(r,e){e=e||{};const t={};function n(u,c,f,h){return k.isPlainObject(u)&&k.isPlainObject(c)?k.merge.call({caseless:h},u,c):k.isPlainObject(c)?k.merge({},c):k.isArray(c)?c.slice():c}function s(u,c,f,h){if(k.isUndefined(c)){if(!k.isUndefined(u))return n(void 0,u,f,h)}else return n(u,c,f,h)}function i(u,c){if(!k.isUndefined(c))return n(void 0,c)}function o(u,c){if(k.isUndefined(c)){if(!k.isUndefined(u))return n(void 0,u)}else return n(void 0,c)}function l(u,c,f){if(f in e)return n(u,c);if(f in r)return n(void 0,u)}const a={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,c,f)=>s(po(u),po(c),f,!0)};return k.forEach(Object.keys({...r,...e}),function(c){const f=a[c]||s,h=f(r[c],e[c],c);k.isUndefined(h)&&f!==l||(t[c]=h)}),t}const go=r=>{const e=wt({},r);let{data:t,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=e;e.headers=o=Oe.from(o),e.url=no(fo(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let a;if(k.isFormData(t)){if(_e.hasStandardBrowserEnv||_e.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((a=o.getContentType())!==!1){const[u,...c]=a?a.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...c].join("; "))}}if(_e.hasStandardBrowserEnv&&(n&&k.isFunction(n)&&(n=n(e)),n||n!==!1&&Lu(e.url))){const u=s&&i&&Du.read(i);u&&o.set(s,u)}return e},Fu=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(t,n){const s=go(r);let i=s.data;const o=Oe.from(s.headers).normalize();let{responseType:l,onUploadProgress:a,onDownloadProgress:u}=s,c,f,h,d,p;function g(){d&&d(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function y(){if(!m)return;const _=Oe.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),v={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:_,config:r,request:m};co(function(E){t(E),g()},function(E){n(E),g()},v),m=null}"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(y)},m.onabort=function(){m&&(n(new V("Request aborted",V.ECONNABORTED,r,m)),m=null)},m.onerror=function(){n(new V("Network Error",V.ERR_NETWORK,r,m)),m=null},m.ontimeout=function(){let b=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const v=s.transitional||io;s.timeoutErrorMessage&&(b=s.timeoutErrorMessage),n(new V(b,v.clarifyTimeoutError?V.ETIMEDOUT:V.ECONNABORTED,r,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&k.forEach(o.toJSON(),function(b,v){m.setRequestHeader(v,b)}),k.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),l&&l!=="json"&&(m.responseType=s.responseType),u&&([h,p]=Lr(u,!0),m.addEventListener("progress",h)),a&&m.upload&&([f,d]=Lr(a),m.upload.addEventListener("progress",f),m.upload.addEventListener("loadend",d)),(s.cancelToken||s.signal)&&(c=_=>{m&&(n(!_||_.type?new Ft(null,r,m):_),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const w=Cu(s.url);if(w&&_e.protocols.indexOf(w)===-1){n(new V("Unsupported protocol "+w+":",V.ERR_BAD_REQUEST,r));return}m.send(i||null)})},xu=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,s;const i=function(u){if(!s){s=!0,l();const c=u instanceof Error?u:this.reason;n.abort(c instanceof V?c:new Ft(c instanceof Error?c.message:c))}};let o=e&&setTimeout(()=>{o=null,i(new V(`timeout ${e} of ms exceeded`,V.ETIMEDOUT))},e);const l=()=>{r&&(o&&clearTimeout(o),o=null,r.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),r=null)};r.forEach(u=>u.addEventListener("abort",i));const{signal:a}=n;return a.unsubscribe=()=>k.asap(l),a}},ju=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let n=0,s;for(;n<t;)s=n+e,yield r.slice(n,s),n=s},Bu=async function*(r,e){for await(const t of Uu(r))yield*ju(t,e)},Uu=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},mo=(r,e,t,n)=>{const s=Bu(r,e);let i=0,o,l=a=>{o||(o=!0,n&&n(a))};return new ReadableStream({async pull(a){try{const{done:u,value:c}=await s.next();if(u){l(),a.close();return}let f=c.byteLength;if(t){let h=i+=f;t(h)}a.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(a){return l(a),s.return()}},{highWaterMark:2})},Dr=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",yo=Dr&&typeof ReadableStream=="function",$u=Dr&&(typeof TextEncoder=="function"?(r=>e=>r.encode(e))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),wo=(r,...e)=>{try{return!!r(...e)}catch{return!1}},Wu=yo&&wo(()=>{let r=!1;const e=new Request(_e.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!e}),bo=64*1024,Nn=yo&&wo(()=>k.isReadableStream(new Response("").body)),Pr={stream:Nn&&(r=>r.body)};Dr&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Pr[e]&&(Pr[e]=k.isFunction(r[e])?t=>t[e]():(t,n)=>{throw new V(`Response type '${e}' is not supported`,V.ERR_NOT_SUPPORT,n)})})})(new Response);const qu=async r=>{if(r==null)return 0;if(k.isBlob(r))return r.size;if(k.isSpecCompliantForm(r))return(await new Request(_e.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(k.isArrayBufferView(r)||k.isArrayBuffer(r))return r.byteLength;if(k.isURLSearchParams(r)&&(r=r+""),k.isString(r))return(await $u(r)).byteLength},Vu=async(r,e)=>{const t=k.toFiniteNumber(r.getContentLength());return t??qu(e)},Rn={http:hu,xhr:Fu,fetch:Dr&&(async r=>{let{url:e,method:t,data:n,signal:s,cancelToken:i,timeout:o,onDownloadProgress:l,onUploadProgress:a,responseType:u,headers:c,withCredentials:f="same-origin",fetchOptions:h}=go(r);u=u?(u+"").toLowerCase():"text";let d=xu([s,i&&i.toAbortSignal()],o),p;const g=d&&d.unsubscribe&&(()=>{d.unsubscribe()});let m;try{if(a&&Wu&&t!=="get"&&t!=="head"&&(m=await Vu(c,n))!==0){let v=new Request(e,{method:"POST",body:n,duplex:"half"}),S;if(k.isFormData(n)&&(S=v.headers.get("content-type"))&&c.setContentType(S),v.body){const[E,L]=uo(m,Lr(ho(a)));n=mo(v.body,bo,E,L)}}k.isString(f)||(f=f?"include":"omit");const y="credentials"in Request.prototype;p=new Request(e,{...h,signal:d,method:t.toUpperCase(),headers:c.normalize().toJSON(),body:n,duplex:"half",credentials:y?f:void 0});let w=await fetch(p,h);const _=Nn&&(u==="stream"||u==="response");if(Nn&&(l||_&&g)){const v={};["status","statusText","headers"].forEach(x=>{v[x]=w[x]});const S=k.toFiniteNumber(w.headers.get("content-length")),[E,L]=l&&uo(S,Lr(ho(l),!0))||[];w=new Response(mo(w.body,bo,E,()=>{L&&L(),g&&g()}),v)}u=u||"text";let b=await Pr[k.findKey(Pr,u)||"text"](w,r);return!_&&g&&g(),await new Promise((v,S)=>{co(v,S,{data:b,headers:Oe.from(w.headers),status:w.status,statusText:w.statusText,config:r,request:p})})}catch(y){throw g&&g(),y&&y.name==="TypeError"&&/Load failed|fetch/i.test(y.message)?Object.assign(new V("Network Error",V.ERR_NETWORK,r,p),{cause:y.cause||y}):V.from(y,y&&y.code,r,p)}})};k.forEach(Rn,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const So=r=>`- ${r}`,zu=r=>k.isFunction(r)||r===null||r===!1,_o={getAdapter:r=>{r=k.isArray(r)?r:[r];const{length:e}=r;let t,n;const s={};for(let i=0;i<e;i++){t=r[i];let o;if(n=t,!zu(t)&&(n=Rn[(o=String(t)).toLowerCase()],n===void 0))throw new V(`Unknown adapter '${o}'`);if(n)break;s[o||"#"+i]=n}if(!n){const i=Object.entries(s).map(([l,a])=>`adapter ${l} `+(a===!1?"is not supported by the environment":"is not available in the build"));let o=e?i.length>1?`since :
10
+ `+i.map(So).join(`
11
+ `):" "+So(i[0]):"as no adapter specified";throw new V("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:Rn};function Ln(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Ft(null,r)}function ko(r){return Ln(r),r.headers=Oe.from(r.headers),r.data=Cn.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),_o.getAdapter(r.adapter||rr.adapter)(r).then(function(n){return Ln(r),n.data=Cn.call(r,r.transformResponse,n),n.headers=Oe.from(n.headers),n},function(n){return lo(n)||(Ln(r),n&&n.response&&(n.response.data=Cn.call(r,r.transformResponse,n.response),n.response.headers=Oe.from(n.response.headers))),Promise.reject(n)})}const vo="1.11.0",Mr={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{Mr[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});const Eo={};Mr.transitional=function(e,t,n){function s(i,o){return"[Axios v"+vo+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,l)=>{if(e===!1)throw new V(s(o," has been removed"+(t?" in "+t:"")),V.ERR_DEPRECATED);return t&&!Eo[o]&&(Eo[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,l):!0}},Mr.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function Hu(r,e,t){if(typeof r!="object")throw new V("options must be an object",V.ERR_BAD_OPTION_VALUE);const n=Object.keys(r);let s=n.length;for(;s-- >0;){const i=n[s],o=e[i];if(o){const l=r[i],a=l===void 0||o(l,i,r);if(a!==!0)throw new V("option "+i+" must be "+a,V.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new V("Unknown option "+i,V.ERR_BAD_OPTION)}}const Fr={assertOptions:Hu,validators:Mr},He=Fr.validators;let bt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new so,response:new so}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=`
12
+ `+i):n.stack=i}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=wt(this.defaults,t);const{transitional:n,paramsSerializer:s,headers:i}=t;n!==void 0&&Fr.assertOptions(n,{silentJSONParsing:He.transitional(He.boolean),forcedJSONParsing:He.transitional(He.boolean),clarifyTimeoutError:He.transitional(He.boolean)},!1),s!=null&&(k.isFunction(s)?t.paramsSerializer={serialize:s}:Fr.assertOptions(s,{encode:He.function,serialize:He.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Fr.assertOptions(t,{baseUrl:He.spelling("baseURL"),withXsrfToken:He.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&k.merge(i.common,i[t.method]);i&&k.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),t.headers=Oe.concat(o,i);const l=[];let a=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(t)===!1||(a=a&&g.synchronous,l.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let c,f=0,h;if(!a){const p=[ko.bind(this),void 0];for(p.unshift(...l),p.push(...u),h=p.length,c=Promise.resolve(t);f<h;)c=c.then(p[f++],p[f++]);return c}h=l.length;let d=t;for(f=0;f<h;){const p=l[f++],g=l[f++];try{d=p(d)}catch(m){g.call(this,m);break}}try{c=ko.call(this,d)}catch(p){return Promise.reject(p)}for(f=0,h=u.length;f<h;)c=c.then(u[f++],u[f++]);return c}getUri(e){e=wt(this.defaults,e);const t=fo(e.baseURL,e.url,e.allowAbsoluteUrls);return no(t,e.params,e.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(e){bt.prototype[e]=function(t,n){return this.request(wt(n||{},{method:e,url:t,data:(n||{}).data}))}}),k.forEach(["post","put","patch"],function(e){function t(n){return function(i,o,l){return this.request(wt(l||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}bt.prototype[e]=t(),bt.prototype[e+"Form"]=t(!0)});let Ju=class oa{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{n.subscribe(l),i=l}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},e(function(i,o,l){n.reason||(n.reason=new Ft(i,o,l),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new oa(function(s){e=s}),cancel:e}}};function Zu(r){return function(t){return r.apply(null,t)}}function Gu(r){return k.isObject(r)&&r.isAxiosError===!0}const Dn={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(Dn).forEach(([r,e])=>{Dn[e]=r});function To(r){const e=new bt(r),t=Wi(bt.prototype.request,e);return k.extend(t,bt.prototype,e,{allOwnKeys:!0}),k.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return To(wt(r,s))},t}const ie=To(rr);ie.Axios=bt,ie.CanceledError=Ft,ie.CancelToken=Ju,ie.isCancel=lo,ie.VERSION=vo,ie.toFormData=Nr,ie.AxiosError=V,ie.Cancel=ie.CanceledError,ie.all=function(e){return Promise.all(e)},ie.spread=Zu,ie.isAxiosError=Gu,ie.mergeConfig=wt,ie.AxiosHeaders=Oe,ie.formToJSON=r=>oo(k.isHTMLForm(r)?new FormData(r):r),ie.getAdapter=_o.getAdapter,ie.HttpStatusCode=Dn,ie.default=ie;const{Axios:Ef,AxiosError:Pn,CanceledError:Tf,isCancel:Of,CancelToken:Af,VERSION:If,all:Cf,Cancel:Nf,isAxiosError:Rf,spread:Lf,toFormData:Df,AxiosHeaders:Pf,HttpStatusCode:Mf,formToJSON:Ff,getAdapter:xf,mergeConfig:jf}=ie,Yu=String.prototype.replace,Ku=/%20/g,Oo={RFC1738:"RFC1738",RFC3986:"RFC3986"},Qu={RFC1738:function(r){return Yu.call(r,Ku,"+")},RFC3986:function(r){return String(r)}},Xu=Oo.RFC1738,eh=Oo.RFC3986,Mn=Object.prototype.hasOwnProperty,St=Array.isArray,Je=(function(){const r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r})(),th=function(e){for(;e.length>1;){const t=e.pop(),n=t.obj[t.prop];if(St(n)){const s=[];for(let i=0;i<n.length;++i)typeof n[i]<"u"&&s.push(n[i]);t.obj[t.prop]=s}}},rh=function(e,t){const n=t&&t.plainObjects?Object.create(null):{};for(let s=0;s<e.length;++s)typeof e[s]<"u"&&(n[s]=e[s]);return n},nh=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(St(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!Mn.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);let s=e;return St(e)&&!St(t)&&(s=rh(e,n)),St(e)&&St(t)?(t.forEach(function(i,o){if(Mn.call(e,o)){const l=e[o];l&&typeof l=="object"&&i&&typeof i=="object"?e[o]=r(l,i,n):e.push(i)}else e[o]=i}),e):Object.keys(t).reduce(function(i,o){const l=t[o];return Mn.call(i,o)?i[o]=r(i[o],l,n):i[o]=l,i},s)},sh=function(r,e,t){const n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Fn=1024,ih=function(e,t,n,s,i){if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let l="";for(let a=0;a<o.length;a+=Fn){const u=o.length>=Fn?o.slice(a,a+Fn):o,c=[];for(let f=0;f<u.length;++f){let h=u.charCodeAt(f);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||i===Xu&&(h===40||h===41)){c[c.length]=u.charAt(f);continue}if(h<128){c[c.length]=Je[h];continue}if(h<2048){c[c.length]=Je[192|h>>6]+Je[128|h&63];continue}if(h<55296||h>=57344){c[c.length]=Je[224|h>>12]+Je[128|h>>6&63]+Je[128|h&63];continue}f+=1,h=65536+((h&1023)<<10|u.charCodeAt(f)&1023),c[c.length]=Je[240|h>>18]+Je[128|h>>12&63]+Je[128|h>>6&63]+Je[128|h&63]}l+=c.join("")}return l},oh=function(e){const t=[{obj:{o:e},prop:"o"}],n=[];for(let s=0;s<t.length;++s){const i=t[s],o=i.obj[i.prop],l=Object.keys(o);for(let a=0;a<l.length;++a){const u=l[a],c=o[u];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(t.push({obj:o,prop:u}),n.push(c))}}return th(t),e},ah=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},lh=function(e,t){return[].concat(e,t)},xn=function(e,t){if(St(e)){const n=[];for(let s=0;s<e.length;s+=1)n.push(t(e[s]));return n}return t(e)},ch={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},et=Array.isArray,uh=Array.prototype.push,Ao=function(r,e){uh.apply(r,et(e)?e:[e])},hh=Date.prototype.toISOString,Io=eh,xr={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ih,encodeValuesOnly:!1,format:Io,formatter:Qu[Io],indices:!1,serializeDate:function(e){return hh.call(e)},skipNulls:!1,strictNullHandling:!1},fh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},jn={},Co=function(e,t,n,s,i,o,l,a,u,c,f,h,d,p,g,m,y,w){let _=e,b=w,v=0,S=!1;for(;(b=b.get(jn))!==void 0&&!S;){const J=b.get(e);if(v+=1,typeof J<"u"){if(J===v)throw new RangeError("Cyclic object value");S=!0}typeof b.get(jn)>"u"&&(v=0)}if(typeof c=="function"?_=c(t,_):_ instanceof Date?_=d(_):n==="comma"&&et(_)&&(_=xn(_,function(J){return J instanceof Date?d(J):J})),_===null){if(o)return u&&!m?u(t,xr.encoder,y,"key",p):t;_=""}if(fh(_)||ah(_)){if(u){const J=m?t:u(t,xr.encoder,y,"key",p);return[g(J)+"="+g(u(_,xr.encoder,y,"value",p))]}return[g(t)+"="+g(String(_))]}const E=[];if(typeof _>"u")return E;let L;if(n==="comma"&&et(_))m&&u&&(_=xn(_,u)),L=[{value:_.length>0?_.join(",")||null:void 0}];else if(et(c))L=c;else{const J=Object.keys(_);L=f?J.sort(f):J}const x=a?t.replace(/\./g,"%2E"):t,F=s&&et(_)&&_.length===1?x+"[]":x;if(i&&et(_)&&_.length===0)return F+"[]";for(let J=0;J<L.length;++J){const me=L[J],z=typeof me=="object"&&typeof me.value<"u"?me.value:_[me];if(l&&z===null)continue;const Q=h&&a?me.replace(/\./g,"%2E"):me,U=et(_)?typeof n=="function"?n(F,Q):F:F+(h?"."+Q:"["+Q+"]");w.set(e,v);const he=new WeakMap;he.set(jn,w),Ao(E,Co(z,U,n,s,i,o,l,a,n==="comma"&&m&&et(_)?null:u,c,f,h,d,p,g,m,y,he))}return E},dh=function(e){return xr};function No(r,e){let t=r;const n=dh();let s,i;typeof n.filter=="function"?(i=n.filter,t=i("",t)):et(n.filter)&&(i=n.filter,s=i);const o=[];if(typeof t!="object"||t===null)return"";const l=ch[n.arrayFormat],a=l==="comma"&&n.commaRoundTrip;s||(s=Object.keys(t)),n.sort&&s.sort(n.sort);const u=new WeakMap;for(let h=0;h<s.length;++h){const d=s[h];n.skipNulls&&t[d]===null||Ao(o,Co(t[d],d,l,a,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,u))}const c=o.join(n.delimiter);let f=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),c.length>0?f+c:""}const Bn=Object.prototype.hasOwnProperty,ph=Array.isArray,jr={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:sh,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},gh=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Ro=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},mh="utf8=%26%2310003%3B",yh="utf8=%E2%9C%93",wh=function(e,t){const n={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,o=s.split(t.delimiter,i);let l=-1,a,u=t.charset;if(t.charsetSentinel)for(a=0;a<o.length;++a)o[a].indexOf("utf8=")===0&&(o[a]===yh?u="utf-8":o[a]===mh&&(u="iso-8859-1"),l=a,a=o.length);for(a=0;a<o.length;++a){if(a===l)continue;const c=o[a],f=c.indexOf("]="),h=f===-1?c.indexOf("="):f+1;let d,p;h===-1?(d=t.decoder(c,jr.decoder,u,"key"),p=t.strictNullHandling?null:""):(d=t.decoder(c.slice(0,h),jr.decoder,u,"key"),p=xn(Ro(c.slice(h+1),t),function(m){return t.decoder(m,jr.decoder,u,"value")})),p&&t.interpretNumericEntities&&u==="iso-8859-1"&&(p=gh(p)),c.indexOf("[]=")>-1&&(p=ph(p)?[p]:p);const g=Bn.call(n,d);g&&t.duplicates==="combine"?n[d]=lh(n[d],p):(!g||t.duplicates==="last")&&(n[d]=p)}return n},bh=function(r,e,t,n){let s=n?e:Ro(e,t);for(let i=r.length-1;i>=0;--i){let o;const l=r[i];if(l==="[]"&&t.parseArrays)o=t.allowEmptyArrays&&s===""?[]:[].concat(s);else{o=t.plainObjects?Object.create(null):{};const a=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=t.decodeDotInKeys?a.replace(/%2E/g,"."):a,c=parseInt(u,10);!t.parseArrays&&u===""?o={0:s}:!isNaN(c)&&l!==u&&String(c)===u&&c>=0&&t.parseArrays&&c<=t.arrayLimit?(o=[],o[c]=s):u!=="__proto__"&&(o[u]=s)}s=o}return s},Sh=function(e,t,n,s){if(!e)return;const i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g;let a=n.depth>0&&o.exec(i);const u=a?i.slice(0,a.index):i,c=[];if(u){if(!n.plainObjects&&Bn.call(Object.prototype,u)&&!n.allowPrototypes)return;c.push(u)}let f=0;for(;n.depth>0&&(a=l.exec(i))!==null&&f<n.depth;){if(f+=1,!n.plainObjects&&Bn.call(Object.prototype,a[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(a[1])}return a&&c.push("["+i.slice(a.index)+"]"),bh(c,t,n,s)},_h=function(e){return jr};function Lo(r,e){const t=_h();if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};const n=typeof r=="string"?wh(r,t):r;let s=t.plainObjects?Object.create(null):{};const i=Object.keys(n);for(let o=0;o<i.length;++o){const l=i[o],a=Sh(l,n[l],t,typeof r=="string");s=nh(s,a,t)}return t.allowSparse===!0?s:oh(s)}class Un{#e;#r;#t;#n;_logger=null;_loggerSystem=null;#s="";#o=!1;#i="";constructor(e,t,n){const s={};this.#e=ie.create({baseURL:e,headers:{...s,...n?n.headers:{}},...n&&{...n,headers:void 0}}),this.#r=t,this.#t=new _c,this.#n=new Oc}setLogger(e){this._logger=e,this.#t.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}getSystemLogger(){return this._loggerSystem===null&&(this._loggerSystem=ye.build("SystemLogger"),this._loggerSystem.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!0,[I.warn]:!0,[I.error]:!0,[I.trace]:!1})),this._loggerSystem}setRestrictionManagerParams(e){this.#t.params=e}getRestrictionManagerParams(){return this.#t.params}setLogTag(e){this.#s=e}clearLogTag(){this.#s=""}async batch(e,t=!0,n=!1){return Array.isArray(e)?this.#c(e,t,n):this.#l(e,t,n)}async#l(e,t=!0,n=!1){const s={};let i=0;const o=(l,a)=>{let u=null,c=null;l.method?(u=l.method??null,c=l?.params??null):Array.isArray(l)&&l.length>0&&(u=l[0]??null,c=l[1]??null),u&&(i++,s[a]=u+"?"+No(c))};for(const[l,a]of Object.entries(e))o(a,l);return i<1?Promise.resolve(new qe):this.call("batch",{halt:t?1:0,cmd:s}).then(l=>{const a=l.getData().result,u={},c=(p,g)=>{if(typeof a.result[g]<"u"||typeof a.result_error[g]<"u"){const m=p.split("?");u[g]=new Tr({answer:{result:C.isUndefined(a.result[g])?{}:a.result[g],error:a?.result_error[g]||void 0,total:a.result_total[g],next:a.result_next[g],time:a.result_time[g]},query:{method:m[0]||"",params:Lo(m[1]||""),start:0},status:l.getStatus()})}};for(const[p,g]of Object.entries(s))c(g,p);const f={},h=p=>p.hasError("base-error")?p.errors.get("base-error"):new Fe({code:"0",description:p.getErrorMessages().join("; "),status:0,requestInfo:{method:p.getQuery().method,params:p.getQuery().params},originalError:p.getErrors().next().value}),d=new qe;for(const p of Object.keys(u)){const g=u[p];if(g.getStatus()!==200||!g.isSuccess){const m=h(g);if(!t&&!g.isSuccess){d.addError(m,p);continue}return Promise.reject(m)}f[p]=n?g:g.getData().result}return d.setData(f),Promise.resolve(d)})}async#c(e,t=!0,n=!1){const s=[];let i=0;const o=l=>{let a=null,u=null;if(l.method?(a=l.method??null,u=l?.params??null):Array.isArray(l)&&l.length>0&&(a=l[0]??null,u=l[1]??null),a){i++;const c=a+"?"+No(u);s.push(c)}};for(const[l,a]of e.entries())o(a);return i<1?Promise.resolve(new qe):this.call("batch",{halt:t?1:0,cmd:s}).then(l=>{const a=l.getData().result,u=[],c=(p,g)=>{if(typeof a.result[g]<"u"||typeof a.result_error[g]<"u"){const m=p.split("?"),y=new Tr({answer:{result:C.isUndefined(a.result[g])?{}:a.result[g],error:a?.result_error[g]||void 0,total:a.result_total[g],next:a.result_next[g],time:a.result_time[g]},query:{method:m[0]||"",params:Lo(m[1]||""),start:0},status:l.getStatus()});u.push(y)}};for(const[p,g]of s.entries())c(g,p);const f=[],h=p=>p.hasError("base-error")?p.errors.get("base-error"):new Fe({code:"0",description:p.getErrorMessages().join("; "),status:0,requestInfo:{method:p.getQuery().method,params:p.getQuery().params},originalError:p.getErrors().next().value}),d=new qe;for(const p of u){if(p.getStatus()!==200||!p.isSuccess){const g=h(p);if(!t&&!p.isSuccess){d.addError(g);continue}return Promise.reject(g)}f.push(n?p:p.getData().result)}return d.setData(f),Promise.resolve(d)})}async call(e,t,n=0){let s=this.#r.getAuthData();return s===!1&&(s=await this.#r.refreshAuth()),await this.#t.check(),this.#o&&!this.isServerSide()&&C.isStringFilled(this.#i)&&this.getSystemLogger().warn(this.#i),this.#e.post(this.#u(e),this.#a(s,t,n)).then(i=>{const o=i.data;return Promise.resolve({status:i.status,payload:o})},async i=>{let o={error:i?.code||0,errorDescription:i?.message||""};if(i instanceof Pn&&i.response&&i.response.data&&!C.isUndefined(i.response.data.error)){const a=i.response.data;o={error:a.error,errorDescription:a.error_description}}const l=new Fe({code:String(o.error),description:o.errorDescription,status:i.response?.status||0,requestInfo:{method:e,params:t},originalError:i});return l.status===401&&["expired_token","invalid_token"].includes(l.answerError.error)?(this.getLogger().info(`refreshAuth >> ${l.answerError.error} >>>`),s=await this.#r.refreshAuth(),await this.#t.check(),this.#e.post(this.#u(e),this.#a(s,t,n)).then(async a=>{const u=a.data;return Promise.resolve({status:a.status,payload:u})},async a=>{let u={error:a?.code||0,errorDescription:a?.message||""};if(a instanceof Pn&&a.response&&a.response.data){const f=a.response.data;u={error:f.error,errorDescription:f.error_description}}const c=new Fe({code:String(u.error),description:u.errorDescription,status:i.response?.status||0,requestInfo:{method:e,params:t},originalError:a});return Promise.reject(c)})):Promise.reject(l)}).then(i=>{const o=new Tr({answer:i.payload,query:{method:e,params:t,start:n},status:i.status});return Promise.resolve(o)})}#a(e,t,n=0){const s=Object.assign({},t);return this.#s.length>0&&(s.logTag=this.#s),s.data&&s.data.start&&delete s.data.start,e.refresh_token!=="hook"&&(s.auth=e.access_token),s.start=n,s}#u(e){const t=`${encodeURIComponent(e)}.json`,n=new URLSearchParams({[this.#n.getQueryStringParameterName()]:this.#n.getRequestId(),[this.#n.getQueryStringSdkParameterName()]:"0.4.8",[this.#n.getQueryStringSdkTypeParameterName()]:"b24-js-sdk"});return`${t}?${n.toString()}`}setClientSideWarning(e,t){this.#o=e,this.#i=t}isServerSide(){return typeof window>"u"}}class _t{static batchSize=50;_isInit=!1;_http=null;_logger=null;constructor(){this._isInit=!1}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}setLogger(e){this._logger=e,this.getHttpClient().setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}callMethod(e,t,n){return this.getHttpClient().call(e,t||{},n||0)}async callListMethod(e,t={},n=null,s=null){const i=new qe;return C.isFunction(n)&&n!==null&&n(0),this.callMethod(e,t,0).then(async o=>{let l=[],a;if(s===null?a=o.getData().result:a=o.getData().result[s],l=[...l,...a],o.isMore()){let u=o;for(;u=await u.getNext(this.getHttpClient()),u!==!1;){let c;if(s===null?c=u.getData().result:c=u.getData().result[s],l=[...l,...c],n){const f=u.getTotal();n(f>0?Math.round(100*l.length/f):100)}}}return i.setData(l),n&&n(100),i})}async*fetchListMethod(e,t={},n="ID",s=null){t.order=t.order||{},t.filter=t.filter||{},t.start=-1;const i=`>${n}`;t.order[n]="ASC",t.filter[i]=0;do{const o=await this.callMethod(e,t,t.start);let l;if(!C.isNull(s)&&s!==null?l=o.getData().result[s]:l=o.getData().result,l.length===0||(yield l,l.length<_t.batchSize))break;const a=l.at(-1);a&&n in a&&(t.filter[i]=a[n])}while(!0)}async callBatch(e,t=!0,n=!1){return this.getHttpClient().batch(e,t,n)}chunkArray(e,t=50){const n=[];for(let s=0;s<e.length;s+=t){const i=e.slice(s,s+t);n.push(i)}return n}async callBatchByChunk(e,t=!0){const n=new qe,s=[],i=this.chunkArray(e,_t.batchSize);for(const o of i){const l=await this.callBatch(o,t);s.push(...l.getData())}return n.setData(s)}getHttpClient(){if(!this.isInit||this._http===null)throw new Error("Http not init");return this._http}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new Error("B24 not initialized")}}var $n=(r=>(r.en="en",r.de="de",r.la="la",r.br="br",r.fr="fr",r.it="it",r.pl="pl",r.ru="ru",r.ua="ua",r.tr="tr",r.sc="sc",r.tc="tc",r.ja="ja",r.vn="vn",r.id="id",r.ms="ms",r.th="th",r.ar="ar",r))($n||{});const kh={en:"en-EN",de:"de-DE",la:"es-ES",br:"pt-BR",fr:"fr-FR",it:"it-IT",pl:"pl-PL",ru:"ru-RU",ua:"uk-UA",tr:"tr-TR",sc:"zh-CN",tc:"zh-TW",ja:"ja-JP",vn:"vi-VN",id:"id-ID",ms:"ms-MY",th:"th-TH",ar:"ar-SA"},vh=()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)});let Eh=class ht{static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!ht.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");ht.isInternalConstructing=!1}static getInstance(){return ht.instance||(ht.isInternalConstructing=!0,ht.instance=new ht),ht.instance}setDefLocale(e){this._defLocale=e}format(e,t){let n;(typeof t>"u"||!C.isStringFilled(t))&&(t=C.isStringFilled(this._defLocale)?this._defLocale||"en":typeof navigator>"u"?"en":navigator?.language||"en"),Number.isInteger(e)?n=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):n=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let s=n.format(e);return t.includes("ru")&&(s=s.replace(",",".")),s}};class T{countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,n,s){this.countryCode=e,this.length=t,this.structure=n,this.example=s}isValid(e){return this.length===e.length&&this.countryCode===e.slice(0,2)&&this._regex().test(e.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(e))==1}toBBAN(e,t){return(this._regex().exec(e.slice(4)||"")||[]).slice(1).join(t)}fromBBAN(e){if(!this.isValidBBAN(e))throw new Error("Invalid BBAN");const t=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+e)))).slice(-2);return this.countryCode+t+e}isValidBBAN(e){return this.length-4===e.length&&this._regex().test(e)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(e){const t=(e.match(/(.{3})/g)||[]).map(n=>{let s;const i=n.slice(0,1),o=Number.parseInt(n.slice(1),10);switch(i){case"A":s="0-9A-Za-z";break;case"B":s="0-9A-Z";break;case"C":s="A-Za-z";break;case"F":s="0-9";break;case"L":s="a-z";break;case"U":s="A-Z";break;case"W":s="0-9a-z";break}return"(["+s+"]{"+o+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const n=t.charCodeAt(0);return n>=65&&n<=90?(n-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,n;for(;t.length>2;)n=t.slice(0,9),t=Number.parseInt(n,10)%97+t.slice(n.length);return Number.parseInt(t,10)%97}}class tt{static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!tt.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");tt.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return tt.instance||(tt.isInternalConstructing=!0,tt.instance=new tt),tt.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!C.isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const n=this._countries.get(t);return!!n&&n.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const n=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(n,"$1"+t)}electronicFormat(e){const t=/[^a-zA-Z0-9]/g;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const n=e.slice(0,2);if(!this._countries.has(n))throw new Error(`No country with code ${n}`);const s=this._countries.get(n);if(!s)throw new Error(`No country with code ${n}`);return s.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);if(!n)throw new Error(`No country with code ${e}`);return n.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!C.isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);return!!n&&n.isValidBBAN(this.electronicFormat(t))}}const Th=()=>{const r=Eh.getInstance(),e=tt.getInstance();return e.addSpecification(new T("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new T("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new T("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new T("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new T("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new T("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new T("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new T("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new T("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new T("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new T("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new T("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new T("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new T("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new T("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new T("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new T("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new T("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new T("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new T("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new T("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new T("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new T("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new T("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new T("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new T("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new T("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new T("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new T("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new T("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new T("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new T("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new T("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new T("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new T("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new T("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new T("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new T("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new T("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new T("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new T("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new T("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new T("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new T("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new T("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new T("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new T("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new T("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new T("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new T("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new T("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new T("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new T("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new T("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new T("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new T("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new T("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new T("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new T("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new T("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new T("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new T("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new T("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new T("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new T("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new T("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new T("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new T("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new T("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new T("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new T("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new T("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new T("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new T("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new T("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new T("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new T("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new T("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new T("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new T("BI",16,"F12","BI41123456789012")),e.addSpecification(new T("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new T("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new T("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new T("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new T("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new T("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new T("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new T("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new T("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new T("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new T("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new T("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new T("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new T("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new T("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new T("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new T("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new T("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new T("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new T("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new T("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new T("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}};class Do{#e;#r;#t;#n;constructor(e){this.#e=Object.freeze(Object.assign({},e)),this.#r=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#t=`https://${this.#r}/rest`,this.#n=`https://${this.#r}`}getAuthData(){return{access_token:this.#e.secret,refresh_token:"hook",expires_in:0,domain:this.#r,member_id:this.#r}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#n}`}getTargetOriginWithPath(){return`${this.#t}/${this.#e.userId}/${this.#e.secret}`}get isAdmin(){return!0}}class Wn extends _t{#e;constructor(e){super(),this.#e=new Do(e),this._http=new Un(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._http.setClientSideWarning(!0,"It is not safe to use hook requests on the client side"),this._isInit=!0}setLogger(e){super.setLogger(e)}get auth(){return this.#e}offClientSideWarning(){this.getHttpClient().setClientSideWarning(!1,"")}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}static fromWebhookUrl(e){if(!e.trim())throw new Error("Webhook URL cannot be empty");let t;try{t=new URL(e)}catch{throw new Error(`Invalid webhook URL format: ${e}`)}if(t.protocol!=="https:")throw new Error("Webhook requires HTTPS protocol");const n=t.pathname.split("/").filter(Boolean);if(n.length<3||n[0]!=="rest")throw new Error("Webhook URL must follow format: /rest/<userId>/<secret>");const s=n[1],i=n[2];if(!/^\d+$/.test(s))throw new Error(`User ID must be numeric in webhook URL, received: ${s}`);const o=Number.parseInt(s,10);return new Wn({b24Url:t.origin,userId:o,secret:i})}}var X=(r=>(r.getInitData="getInitData",r.setInstallFinish="setInstallFinish",r.setInstall="setInstall",r.refreshAuth="refreshAuth",r.setAppOption="setAppOption",r.setUserOption="setUserOption",r.resizeWindow="resizeWindow",r.reloadWindow="reloadWindow",r.setTitle="setTitle",r.setScroll="setScroll",r.openApplication="openApplication",r.closeApplication="closeApplication",r.openPath="openPath",r.imCallTo="imCallTo",r.imPhoneTo="imPhoneTo",r.imOpenMessenger="imOpenMessenger",r.imOpenHistory="imOpenHistory",r.selectUser="selectUser",r.selectAccess="selectAccess",r.selectCRM="selectCRM",r.showAppForm="showAppForm",r.getInterface="getInterface",r.placementBindEvent="placementBindEvent",r))(X||{});class Po{#e;#r;#t;_logger=null;runCallbackHandler;constructor(e){this.#e=e,this.#r=new Map,this.#t=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(e,t=null){return new Promise((n,s)=>{let i;const o={resolve:n,reject:s,timeoutId:null},l=this.#n(o);let a=null;const u=Xn(t||{},["singleOption","callBack","isSafely","safelyTime"]),{callBack:c,singleOption:f}=t||{};if(c&&this.#t.set(l,c),f?a=f:Object.keys(u).length>0&&(a={...u}),e.toString().includes(":"))i={method:e.toString(),params:a||"",callback:l,appSid:this.#e.getAppSid()};else{i=e.toString(),t?.isRawValue!==!0&&a&&(a=JSON.stringify(a));const h=[a||"",l,this.#e.getAppSid()];i+=":"+h.filter(Boolean).join(":")}this.getLogger().log(`send to ${this.#e.getTargetOrigin()}`,{cmd:i}),parent.postMessage(i,this.#e.getTargetOrigin()),t?.isSafely&&(this.#r.get(l).timeoutId=window.setTimeout(()=>{this.#r.has(l)&&(this.getLogger().warn(`Action ${e.toString()} stop by timeout`),this.#r.delete(l),n({isSafely:!0}))},Number.parseInt(String(t?.safelyTime||900))))})}_runCallback(e){if(e.origin===this.#e.getTargetOrigin()&&e.data){this.getLogger().log(`get from ${e.origin}`,{data:e.data});const t=e.data.split(":"),n={id:t[0],args:t.slice(1).join(":")};if(n.args&&(n.args=JSON.parse(n.args)),this.#r.has(n.id)){const s=this.#r.get(n.id);s.timeoutId&&clearTimeout(s.timeoutId),this.#r.delete(n.id),s.resolve(n.args)}else if(this.#t.has(n.id)){const s=this.#t.get(n.id);s&&s.apply(globalThis,[n.args])}}}#n(e){const t=W.getUniqId();return this.#r.set(t,e),t}}class Mo{#e="";#r=!0;#t=null;#n=null;#s=null;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#r=e.PROTOCOL===!0,e.LANG&&(this.#s=e.LANG),e.APP_SID&&(this.#t=e.APP_SID)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#n||(this.#n=e.PATH),this.#s||(this.#s=e.LANG),this.#r=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this}getAppSid(){if(this.#t===null)throw new Error("Not init appSid");return this.#t}getTargetOrigin(){return`${this.#r?"https":"http"}://${this.#e}`}getTargetOriginWithPath(){return this.getTargetOrigin()+(this.#n??"")}getLang(){return this.#s||$n.en}}class Fo{#e=null;#r=null;#t=0;#n=null;#s=!1;#o;#i;constructor(e,t){this.#o=e,this.#i=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#r=e.REFRESH_ID,this.#t=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,this.#s=e.IS_ADMIN,this.#n=e.MEMBER_ID||""),this}getAuthData(){return this.#t>Date.now()?{access_token:this.#e,refresh_token:this.#r,expires_in:this.#t,domain:this.#o.getTargetOrigin(),member_id:this.#n}:!1}async refreshAuth(){return this.#i.send(X.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#r=e.REFRESH_ID,this.#t=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#n||""].join("_")}get isAdmin(){return this.#s}}class xo{#e;constructor(e){this.#e=e}async closeApplication(){return this.#e.send(X.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(X.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(X.resizeWindow,{width:e,height:t,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${e} or height:number = ${t}`))}async resizeWindowAuto(e=null,t=0,n=0){const s=document.body;let i=Math.max(s.scrollWidth,s.offsetWidth);n>0&&(i=Math.max(n,i));let o=Math.max(s.scrollHeight,s.offsetHeight);return e&&(o=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(o=Math.max(t,o)),this.resizeWindow(i,o)}getScrollSize(){return vh()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(X.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(X.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(X.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(X.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(X.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(X.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(X.imOpenHistory,{dialogId:e,isSafely:!0})}}let jo=class{#e;#r=null;#t=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#r=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#t=e.USER_OPTIONS),this}appGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#r||(this.#r=[]),this.#r[e]=t,this.#n(X.setAppOption,e,this.#r[e])}userGet(e){if(this.#t&&this.#t[e])return this.#t[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#r||(this.#r=[]),this.#r[e]||(this.#r[e]=null),this.#t[e]=t,this.#n(X.setUserOption,e,this.#t[e])}async#n(e,t,n){return this.#e.send(e,{name:t,value:n,isSafely:!0}).then(()=>Promise.resolve())}};class Bo{#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(X.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(X.selectUser,{mult:!0})}async selectAccess(e=[]){return console.warn("@deprecated selectAccess"),this.#e.send(X.selectAccess,{value:e})}async selectCRM(e){return console.warn("@deprecated selectCRM"),this.#e.send(X.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value})}}class Uo{#e;#r;constructor(e,t){this.#e=e,this.#r=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#r.send(X.openApplication,e)}async closeSliderAppPage(){return this.#r.send(X.closeApplication,{isSafely:!1})}#t(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const n=new URL(e);return n.searchParams.set("IFRAME","Y"),n.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#r.send(X.openPath,{path:[this.#t(t),n.pathname,n.search].join("")}).then(s=>s?.result==="error"?s?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((i,o)=>{const l=window.open(e,"_blank");if(!l){o(new Error("Error open window"));return}let a=0;const u=1e3*60*5,c=window.setInterval(()=>{a=a+1,l.closed?(clearInterval(c),i({isOpenAtNewWindow:!0,isClose:!0})):a>u&&(clearInterval(c),i({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(s?.errorCode)):s?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}async showAppForm(e){return console.warn("@deprecated showAppForm"),this.#r.send(X.showAppForm,{params:e,isSafely:!0})}}class $o{#e;#r="";#t={};constructor(e){this.#e=e}initData(e){this.#r=e.PLACEMENT||"DEFAULT";const t=e.PLACEMENT_OPTIONS;return this.#t=Object.freeze(t),this}get title(){return this.#r}get isDefault(){return this.title==="DEFAULT"}get options(){return this.#t}get isSliderMode(){return this.options?.IFRAME==="Y"}async getInterface(){return this.#e.send(X.getInterface,{isSafely:!0})}async bindEvent(e,t){return this.#e.send(X.placementBindEvent,{event:e,callBack:t,isSafely:!0})}async call(e,t={}){return this.#e.send(e,{...t,isSafely:!0,isRawValue:["setValue"].includes(e)})}async callCustomBind(e,t=null,n){let s={};return C.isString(t)?s.singleOption=t:C.isObjectLike(t)&&(s={...t}),this.#e.send(e,{...s,callBack:n,isSafely:!0})}}class Wo extends _t{#e=!1;#r=!1;#t;#n;#s;#o;#i;#l;#c;#a;constructor(e){super(),this.#t=new Mo(e),this.#n=new Po(this.#t),this.#n.subscribe(),this.#s=new Fo(this.#t,this.#n),this.#o=new xo(this.#n),this.#i=new jo(this.#n),this.#l=new Bo(this.#n),this.#c=new Uo(this.#t,this.#n),this.#a=new $o(this.#n),this._isInit=!1}setLogger(e){super.setLogger(e),this.#n.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#r}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#o}get auth(){return this._ensureInitialized(),this.#s}get slider(){return this._ensureInitialized(),this.#c}get placement(){return this._ensureInitialized(),this.#a}get options(){return this._ensureInitialized(),this.#i}get dialog(){return this._ensureInitialized(),this.#l}async init(){return this.#n.send(X.getInitData,{}).then(e=>(this.getLogger().log("init data:",e),this.#t.initData(e),this.#s.initData(e),this.#a.initData(e),this.#i.initData(e),this.#e=e.INSTALL,this.#r=e.FIRST_RUN,this._http=new Un(this.#t.getTargetOriginWithPath(),this.#s,this._getHttpOptions()),this._isInit=!0,this.#r?this.#n.send(X.setInstall,{install:!0}):Promise.resolve()))}destroy(){this.#n.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#n.send(X.setInstallFinish,{}):Promise.reject(new Error("Application was previously installed. You cannot call installFinish"))}getTargetOrigin(){return this._ensureInitialized(),this.#t.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#t.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#t.getAppSid()}getLang(){return this._ensureInitialized(),this.#t.getLang()}}class Oh extends Fe{}class qo{#e;#r=null;#t;#n;#s=0;#o;#i;#l;#c;#a=null;constructor(e,t){this.#t=Object.assign({},e),this.#n=Object.freeze(Object.assign({},t)),this.#o=this.#t.domain.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#i=this.#t.clientEndpoint,this.#l=this.#i.replace("/rest/",""),this.#c=this.#t.serverEndpoint.replace("/rest/",""),this.#s=this.#t.expires*1e3,this.#e=ie.create({baseURL:this.#c,headers:{"Content-Type":"application/json"}})}getAuthData(){return this.#s>Date.now()?{access_token:this.#t.accessToken,refresh_token:this.#t.refreshToken,expires_in:this.#t.expiresIn,domain:this.#o,member_id:this.#t.memberId}:!1}async refreshAuth(){try{const e=await this.#e.get("/oauth/token/",{params:{grant_type:"refresh_token",client_id:this.#n.clientId,client_secret:this.#n.clientSecret,refresh_token:this.#t.refreshToken}});if(e.data.error)throw new Error(`Token update error: ${e.data.error}`);if(e.status!==200)throw new Error(`Token update error status code: ${e.status}`);const t=e.data;this.#t.accessToken=t.access_token,this.#t.refreshToken=t.refresh_token,this.#t.expires=Number.parseInt(t.expires||"0"),this.#t.expiresIn=Number.parseInt(t.expires_in||"3600"),this.#t.clientEndpoint=t.client_endpoint,this.#t.serverEndpoint=t.server_endpoint,this.#t.scope=t.scope,this.#t.status=Object.values(Qe).find(s=>s===t.status)||Qe.Free,this.#s=this.#t.expires*1e3;const n=this.getAuthData();return this.#r&&await this.#r({authData:n,b24OAuthParams:this.#t}),n}catch(e){if(e instanceof Pn){let t={error:e?.code||0,errorDescription:e?.message||""};if(e.response&&e.response.data&&!C.isUndefined(e.response.data.error)){const n=e.response.data;t={error:n.error,errorDescription:n.error_description}}throw new Oh({code:String(t.error),description:t.errorDescription,status:e.response?.status||0,requestInfo:{method:"/oauth/token/"}})}else if(e instanceof Error)throw e;throw new Error(`Strange error: ${e instanceof Error?e.message:e}`,{cause:e})}}setCallbackRefreshAuth(e){this.#r=e}removeCallbackRefreshAuth(){this.#r=null}getUniq(e){return[e,this.#t.memberId||""].join("_")}getTargetOrigin(){return`${this.#l}`}getTargetOriginWithPath(){return`${this.#i}`}get isAdmin(){if(this.#a===null)throw new Error("isAdmin not init. You need call B24OAuth::initIsAdmin().");return this.#a}async initIsAdmin(e){const t=await e.call("profile",{},0);if(!t.isSuccess)throw new Error(t.getErrorMessages().join(";"));t.getData().result?.ADMIN&&(this.#a=!0)}}class Ah extends _t{#e;constructor(e,t){super(),this.#e=new qo(e,t),this._http=new Un(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._http.setClientSideWarning(!0,"It is not safe to use oauth requests on the client side"),this._isInit=!0}setLogger(e){super.setLogger(e)}async initIsAdmin(){return this._ensureInitialized(),this.#e.initIsAdmin(this._http)}setCallbackRefreshAuth(e){this._ensureInitialized(),this.#e.setCallbackRefreshAuth(e)}removeCallbackRefreshAuth(){this._ensureInitialized(),this.#e.removeCallbackRefreshAuth()}offClientSideWarning(){this.getHttpClient().setClientSideWarning(!1,"")}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}class qn extends Error{constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=new Error("for stack").stack}}class xt{_b24;_logger=null;_data=null;constructor(e){this._b24=e}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}async initData(e){return this.getLogger().log(e),Promise.reject(new Error("Rewrite this function"))}}class Ih extends xt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}class Ch extends xt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return $i[this.data.status]||"Unknown status"}}class Nh extends xt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}class Rh extends xt{_data=null;async initData(e){this._data=e,this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}makeRestrictionManagerParams(){this.data?.license&&this.data.license.includes("ent")&&(this.getLogger().log(`LICENSE ${this.data.license} => up restriction manager params`,yn),this._b24.getHttpClient().setRestrictionManagerParams(yn))}}class Lh extends xt{async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(console.error(t),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{(await this._b24.callBatchByChunk(e,!0)).getData().forEach(t=>{if(typeof t.LANG>"u")return;const n=t.CURRENCY,s=this.data.currencyList.get(n);if(!(typeof s>"u"))for(const[i,o]of Object.entries(t.LANG))switch(s.lang[i]={decimals:Number.parseInt(o.DECIMALS),decPoint:o.DEC_POINT,formatString:o.FORMAT_STRING,fullName:o.FULL_NAME,isHideZero:o.HIDE_ZERO==="Y",thousandsSep:o.THOUSANDS_SEP,thousandsVariant:o.THOUSANDS_VARIANT},s.lang[i].thousandsVariant){case"N":s.lang[i].thousandsSep="";break;case"D":s.lang[i].thousandsSep=".";break;case"C":s.lang[i].thousandsSep=",";break;case"S":s.lang[i].thousandsSep=" ";break;case"B":s.lang[i].thousandsSep="&nbsp;";break;default:C.isStringFilled(s.lang[i].thousandsSep)||(s.lang[i].thousandsSep=" ");break}})}catch(t){console.error(t)}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(e){this._data.currencyBase=e}get baseCurrency(){return this.data.currencyBase}setCurrencyList(e=[]){this.data.currencyList.clear();for(const t of e)this.data.currencyList.set(t.CURRENCY,{amount:Number.parseFloat(t.CURRENCY),amountCnt:Number.parseInt(t.AMOUNT_CNT),isBase:t.BASE==="Y",currencyCode:t.CURRENCY,dateUpdate:W.toDateTime(t.DATE_UPDATE),decimals:Number.parseInt(t.DECIMALS),decPoint:t.DEC_POINT,formatString:t.FORMAT_STRING,fullName:t.FULL_NAME,lid:t.LID,sort:Number.parseInt(t.SORT),thousandsSep:t?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new qn(e);let s=n.fullName;if(!(typeof t>"u")){const i=n.lang[t];C.isUndefined(i)||(s=i.fullName)}return s}getCurrencyLiteral(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new qn(e);let s=n.formatString;if(!(typeof t>"u")){const i=n.lang[t];C.isUndefined(i)||(s=i.formatString)}return s.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,n){const s=this.data.currencyList.get(t);if(typeof s>"u")throw new qn(t);const i={formatString:s.formatString,decimals:s.decimals,decPoint:s.decPoint,thousandsSep:s.thousandsSep};C.isStringFilled(i.thousandsSep)||(i.thousandsSep="");const o=s.lang[n];return C.isUndefined(o)||(i.formatString=o.formatString,i.decimals=o.decimals,i.decPoint=o.decPoint,i.thousandsSep=o.thousandsSep),i.formatString.replaceAll("&#","&%").replace("#",W.numberFormat(e,i.decimals,i.decPoint,i.thousandsSep)).replaceAll("&%","&#")||""}}class Vn extends xt{_data;_type;static getSupportTypes(){return[Xe.NotSet,Xe.JsonArray,Xe.JsonObject,Xe.FloatVal,Xe.IntegerVal,Xe.BoolYN,Xe.StringVal]}static prepareArrayList(e){return C.isArray(e)?e:C.isObject(e)?Object.values(e):[]}constructor(e,t){super(e),this._type=t,this._data=new Map}get data(){return this._data}reset(){this.data.clear()}async initData(e){if(this.reset(),C.isObject(e))for(const[t,n]of Object.entries(e))this.data.set(t,n)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n),!C.isArray(n)&&!C.isObject(n)&&(n=t)}catch(s){this.getLogger().error(s),n=t}return Vn.prepareArrayList(n)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n)}catch(s){this.getLogger().error(s),n=t}return C.isObject(n)||(n=t),n}getFloat(e,t=0){return this.data.has(e)?W.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?W.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?W.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?W.toBoolean(this.data.get(e)):t}getString(e,t=""){return this.data.has(e)?this.data.get(e).toString():t}getDate(e,t=null){if(!this.data.has(e))return t;try{const n=W.toDateTime(this.data.get(e).toString());return n.isValid?n:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(n){this.getLogger().warn(n,e)}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t){const n=[];return n.push({method:this.getMethodSave(),params:{options:e}}),C.isObject(t)&&n.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.callBatch(n,!0)}}class Vo{_logger=null;userId;siteId;constructor(e={}){this.userId=e.userId?W.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}set(e,t){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window.localStorage>"u")return t||null;const n=window.localStorage.getItem(this._getKey(e));return n===null?t||null:JSON.parse(n)}remove(e){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}return window.localStorage.removeItem(this._getKey(e))}_getKey(e){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${e}`}compareKey(e,t){return e===this._getKey(t)}}class Dh extends Error{constructor(e){super(e),this.name="ErrorNotConnected"}}class Ph extends Error{constructor(e){super(e),this.name="ErrorTimeout"}}const Br="2.0";class Mh{_logger=null;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._connector=e.connector,C.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,n=5){return new Promise((s,i)=>{const o=this.createRequest(e,t);this._connector.send(JSON.stringify(o))||i(new Dh("websocket is not connected"));const l=setTimeout(()=>{this._rpcResponseAwaiters.delete(o.id),i(new Ph("no response"))},n*1e3);this._rpcResponseAwaiters.set(o.id,{resolve:s,reject:i,timeout:l})})}executeOutgoingRpcBatch(e){const t=[],n=[];return e.forEach(({method:s,params:i,id:o})=>{const l=this.createRequest(s,i,o);t.push(l),n.push(new Promise((a,u)=>this._rpcResponseAwaiters.set(l.id,{resolve:a,reject:u})))}),this._connector.send(JSON.stringify(t)),n}processRpcResponse(e){if("id"in e&&this._rpcResponseAwaiters.has(Number(e.id))){const t=this._rpcResponseAwaiters.get(Number(e.id));t&&("result"in e?t.resolve(e.result):"error"in e?t.reject(e?.error||"error"):t.reject("wrong response structure"),clearTimeout(t.timeout),this._rpcResponseAwaiters.delete(Number(e.id)));return}this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Received rpc response with unknown id`),e)}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(n){this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Could not decode json rpc message`),n);return}if(C.isArray(t))return this.executeIncomingRpcBatch(t);if(C.isJsonRpcRequest(t))return this.executeIncomingRpcCommand(t);if(C.isJsonRpcResponse(t))return this.processRpcResponse(t);this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: unknown rpc packet`),t)}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:Br,error:_n.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const n of e)if("jsonrpc"in n)if("method"in n){const s=this.executeIncomingRpcCommand(n);s&&(s.jsonrpc=Br,s.id=n.id,t.push(s))}else this.processRpcResponse(n);else this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: unknown rpc command in batch`),n),t.push({jsonrpc:Br,error:_n.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,n){return n||(n=this.nextId()),{jsonrpc:Br,method:e,params:t,id:n}}}class Fh{_logger=null;_storage;_ttl=1440*60;_callbacks;constructor(e={}){e=e||{},this._storage=e.storage||new Vo,this._callbacks={onWebSocketBlockChanged:C.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",Ne.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(Ne.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(Ne.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage. Error: `),t),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(Ne.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(Ne.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage. Error: `),t),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(Ne.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(Ne.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: LocalStorage error: `),t),!1}return!0}getTimestamp(){return Date.now()}}class xh{_logger=null;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}async getPublicIds(e){const t=new Date,n={},s=[];for(const i of e){const o=this._publicIds.get(i);o&&o.end>t?n[o.userId]=o:s.push(i)}return s.length===0?Promise.resolve(n):new Promise(i=>{this._restClient.callMethod(this._getPublicListMethod,{users:s}).then(o=>{const l=o.getData().result;this.setPublicIds(Object.values(l));for(const a of s){const u=this._publicIds.get(a);u&&(n[u.userId]=u)}i(n)}).catch(o=>(this.getLogger().error(o),i({})))})}setPublicIds(e){e.forEach(t=>{const n=Number(t.user_id);this._publicIds.set(n,{userId:n,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var sr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var zn={exports:{}};/*!
13
13
  * protobuf.js v6.8.6 (c) 2016, daniel wirtz
14
14
  * compiled mon, 26 feb 2018 11:35:34 utc
15
15
  * licensed under the bsd-3-clause license
@@ -17,28 +17,28 @@ ${this.stack}`),e}static formatErrorMessage(e){const t=[e.code];return e.descrip
17
17
  *
18
18
  * Modify a list for integration with Bitrix Framework:
19
19
  * - removed integration with RequireJS and AMD package builders;
20
- */var $o;function xh(){return $o||($o=1,function(r){(function(e){(function(t,n,s){function i(c){var a=n[c];return a||t[c][0].call(a=n[c]={exports:{}},i,a,a.exports),a.exports}var o=i(s[0]);r&&r.exports&&(r.exports=o)})({1:[function(t,n,s){n.exports=i;function i(o,c){for(var a=new Array(arguments.length-1),u=0,l=2,f=!0;l<arguments.length;)a[u++]=arguments[l++];return new Promise(function(h,d){a[u]=function(p){if(f)if(f=!1,p)d(p);else{for(var m=new Array(arguments.length-1),g=0;g<m.length;)m[g++]=arguments[g];h.apply(null,m)}};try{o.apply(c||null,a)}catch(p){f&&(f=!1,d(p))}})}},{}],2:[function(t,n,s){var i=s;i.length=function(l){var f=l.length;if(!f)return 0;for(var h=0;--f%4>1&&l.charAt(f)==="=";)++h;return Math.ceil(l.length*3)/4-h};for(var o=new Array(64),c=new Array(123),a=0;a<64;)c[o[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;i.encode=function(l,f,h){for(var d=null,p=[],m=0,g=0,y;f<h;){var w=l[f++];switch(g){case 0:p[m++]=o[w>>2],y=(w&3)<<4,g=1;break;case 1:p[m++]=o[y|w>>4],y=(w&15)<<2,g=2;break;case 2:p[m++]=o[y|w>>6],p[m++]=o[w&63],g=0;break}m>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,p)),m=0)}return g&&(p[m++]=o[y],p[m++]=61,g===1&&(p[m++]=61)),d?(m&&d.push(String.fromCharCode.apply(String,p.slice(0,m))),d.join("")):String.fromCharCode.apply(String,p.slice(0,m))};var u="invalid encoding";i.decode=function(l,f,h){for(var d=h,p=0,m,g=0;g<l.length;){var y=l.charCodeAt(g++);if(y===61&&p>1)break;if((y=c[y])===e)throw Error(u);switch(p){case 0:m=y,p=1;break;case 1:f[h++]=m<<2|(y&48)>>4,m=y,p=2;break;case 2:f[h++]=(m&15)<<4|(y&60)>>2,m=y,p=3;break;case 3:f[h++]=(m&3)<<6|y,p=0;break}}if(p===1)throw Error(u);return h-d},i.test=function(l){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(l)}},{}],3:[function(t,n,s){n.exports=i;function i(o,c){typeof o=="string"&&(c=o,o=e);var a=[];function u(f){if(typeof f!="string"){var h=l();if(i.verbose&&console.log("codegen: "+h),h="return "+h,f){for(var d=Object.keys(f),p=new Array(d.length+1),m=new Array(d.length),g=0;g<d.length;)p[g]=d[g],m[g]=f[d[g++]];return p[g]=h,Function.apply(null,p).apply(null,m)}return Function(h)()}for(var y=new Array(arguments.length-1),w=0;w<y.length;)y[w]=arguments[++w];if(w=0,f=f.replace(/%([%dfijs])/g,function(_,b){var v=y[w++];switch(b){case"d":case"f":return String(Number(v));case"i":return String(Math.floor(v));case"j":return JSON.stringify(v);case"s":return String(v)}return"%"}),w!==y.length)throw Error("parameter count mismatch");return a.push(f),u}function l(f){return"function "+(f||c||"")+"("+(o&&o.join(",")||"")+`){
20
+ */var zo;function Bh(){return zo||(zo=1,(function(r){(function(e){(function(t,n,s){function i(l){var a=n[l];return a||t[l][0].call(a=n[l]={exports:{}},i,a,a.exports),a.exports}var o=i(s[0]);r&&r.exports&&(r.exports=o)})({1:[function(t,n,s){n.exports=i;function i(o,l){for(var a=new Array(arguments.length-1),u=0,c=2,f=!0;c<arguments.length;)a[u++]=arguments[c++];return new Promise(function(h,d){a[u]=function(p){if(f)if(f=!1,p)d(p);else{for(var g=new Array(arguments.length-1),m=0;m<g.length;)g[m++]=arguments[m];h.apply(null,g)}};try{o.apply(l||null,a)}catch(p){f&&(f=!1,d(p))}})}},{}],2:[function(t,n,s){var i=s;i.length=function(c){var f=c.length;if(!f)return 0;for(var h=0;--f%4>1&&c.charAt(f)==="=";)++h;return Math.ceil(c.length*3)/4-h};for(var o=new Array(64),l=new Array(123),a=0;a<64;)l[o[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;i.encode=function(c,f,h){for(var d=null,p=[],g=0,m=0,y;f<h;){var w=c[f++];switch(m){case 0:p[g++]=o[w>>2],y=(w&3)<<4,m=1;break;case 1:p[g++]=o[y|w>>4],y=(w&15)<<2,m=2;break;case 2:p[g++]=o[y|w>>6],p[g++]=o[w&63],m=0;break}g>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,p)),g=0)}return m&&(p[g++]=o[y],p[g++]=61,m===1&&(p[g++]=61)),d?(g&&d.push(String.fromCharCode.apply(String,p.slice(0,g))),d.join("")):String.fromCharCode.apply(String,p.slice(0,g))};var u="invalid encoding";i.decode=function(c,f,h){for(var d=h,p=0,g,m=0;m<c.length;){var y=c.charCodeAt(m++);if(y===61&&p>1)break;if((y=l[y])===e)throw Error(u);switch(p){case 0:g=y,p=1;break;case 1:f[h++]=g<<2|(y&48)>>4,g=y,p=2;break;case 2:f[h++]=(g&15)<<4|(y&60)>>2,g=y,p=3;break;case 3:f[h++]=(g&3)<<6|y,p=0;break}}if(p===1)throw Error(u);return h-d},i.test=function(c){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(c)}},{}],3:[function(t,n,s){n.exports=i;function i(o,l){typeof o=="string"&&(l=o,o=e);var a=[];function u(f){if(typeof f!="string"){var h=c();if(i.verbose&&console.log("codegen: "+h),h="return "+h,f){for(var d=Object.keys(f),p=new Array(d.length+1),g=new Array(d.length),m=0;m<d.length;)p[m]=d[m],g[m]=f[d[m++]];return p[m]=h,Function.apply(null,p).apply(null,g)}return Function(h)()}for(var y=new Array(arguments.length-1),w=0;w<y.length;)y[w]=arguments[++w];if(w=0,f=f.replace(/%([%dfijs])/g,function(_,b){var v=y[w++];switch(b){case"d":case"f":return String(Number(v));case"i":return String(Math.floor(v));case"j":return JSON.stringify(v);case"s":return String(v)}return"%"}),w!==y.length)throw Error("parameter count mismatch");return a.push(f),u}function c(f){return"function "+(f||l||"")+"("+(o&&o.join(",")||"")+`){
21
21
  `+a.join(`
22
22
  `)+`
23
- }`}return u.toString=l,u}i.verbose=!1},{}],4:[function(t,n,s){n.exports=i;function i(){this._listeners={}}i.prototype.on=function(o,c,a){return(this._listeners[o]||(this._listeners[o]=[])).push({fn:c,ctx:a||this}),this},i.prototype.off=function(o,c){if(o===e)this._listeners={};else if(c===e)this._listeners[o]=[];else for(var a=this._listeners[o],u=0;u<a.length;)a[u].fn===c?a.splice(u,1):++u;return this},i.prototype.emit=function(o){var c=this._listeners[o];if(c){for(var a=[],u=1;u<arguments.length;)a.push(arguments[u++]);for(u=0;u<c.length;)c[u].fn.apply(c[u++].ctx,a)}return this}},{}],5:[function(t,n,s){n.exports=a;var i=t(1),o=t(7),c=o("fs");function a(u,l,f){return typeof l=="function"?(f=l,l={}):l||(l={}),f?!l.xhr&&c&&c.readFile?c.readFile(u,function(h,d){return h&&typeof XMLHttpRequest<"u"?a.xhr(u,l,f):h?f(h):f(null,l.binary?d:d.toString("utf8"))}):a.xhr(u,l,f):i(a,this,u,l)}a.xhr=function(u,l,f){var h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState!==4)return e;if(h.status!==0&&h.status!==200)return f(Error("status "+h.status));if(l.binary){var d=h.response;if(!d){d=[];for(var p=0;p<h.responseText.length;++p)d.push(h.responseText.charCodeAt(p)&255)}return f(null,typeof Uint8Array<"u"?new Uint8Array(d):d)}return f(null,h.responseText)},l.binary&&("overrideMimeType"in h&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.responseType="arraybuffer"),h.open("GET",u),h.send()}},{1:1,7:7}],6:[function(t,n,s){n.exports=i(i);function i(l){return typeof Float32Array<"u"?function(){var f=new Float32Array([-0]),h=new Uint8Array(f.buffer),d=h[3]===128;function p(w,_,b){f[0]=w,_[b]=h[0],_[b+1]=h[1],_[b+2]=h[2],_[b+3]=h[3]}function m(w,_,b){f[0]=w,_[b]=h[3],_[b+1]=h[2],_[b+2]=h[1],_[b+3]=h[0]}l.writeFloatLE=d?p:m,l.writeFloatBE=d?m:p;function g(w,_){return h[0]=w[_],h[1]=w[_+1],h[2]=w[_+2],h[3]=w[_+3],f[0]}function y(w,_){return h[3]=w[_],h[2]=w[_+1],h[1]=w[_+2],h[0]=w[_+3],f[0]}l.readFloatLE=d?g:y,l.readFloatBE=d?y:g}():function(){function f(d,p,m,g){var y=p<0?1:0;if(y&&(p=-p),p===0)d(1/p>0?0:2147483648,m,g);else if(isNaN(p))d(2143289344,m,g);else if(p>34028234663852886e22)d((y<<31|2139095040)>>>0,m,g);else if(p<11754943508222875e-54)d((y<<31|Math.round(p/1401298464324817e-60))>>>0,m,g);else{var w=Math.floor(Math.log(p)/Math.LN2),_=Math.round(p*Math.pow(2,-w)*8388608)&8388607;d((y<<31|w+127<<23|_)>>>0,m,g)}}l.writeFloatLE=f.bind(null,o),l.writeFloatBE=f.bind(null,c);function h(d,p,m){var g=d(p,m),y=(g>>31)*2+1,w=g>>>23&255,_=g&8388607;return w===255?_?NaN:y*(1/0):w===0?y*1401298464324817e-60*_:y*Math.pow(2,w-150)*(_+8388608)}l.readFloatLE=h.bind(null,a),l.readFloatBE=h.bind(null,u)}(),typeof Float64Array<"u"?function(){var f=new Float64Array([-0]),h=new Uint8Array(f.buffer),d=h[7]===128;function p(w,_,b){f[0]=w,_[b]=h[0],_[b+1]=h[1],_[b+2]=h[2],_[b+3]=h[3],_[b+4]=h[4],_[b+5]=h[5],_[b+6]=h[6],_[b+7]=h[7]}function m(w,_,b){f[0]=w,_[b]=h[7],_[b+1]=h[6],_[b+2]=h[5],_[b+3]=h[4],_[b+4]=h[3],_[b+5]=h[2],_[b+6]=h[1],_[b+7]=h[0]}l.writeDoubleLE=d?p:m,l.writeDoubleBE=d?m:p;function g(w,_){return h[0]=w[_],h[1]=w[_+1],h[2]=w[_+2],h[3]=w[_+3],h[4]=w[_+4],h[5]=w[_+5],h[6]=w[_+6],h[7]=w[_+7],f[0]}function y(w,_){return h[7]=w[_],h[6]=w[_+1],h[5]=w[_+2],h[4]=w[_+3],h[3]=w[_+4],h[2]=w[_+5],h[1]=w[_+6],h[0]=w[_+7],f[0]}l.readDoubleLE=d?g:y,l.readDoubleBE=d?y:g}():function(){function f(d,p,m,g,y,w){var _=g<0?1:0;if(_&&(g=-g),g===0)d(0,y,w+p),d(1/g>0?0:2147483648,y,w+m);else if(isNaN(g))d(0,y,w+p),d(2146959360,y,w+m);else if(g>17976931348623157e292)d(0,y,w+p),d((_<<31|2146435072)>>>0,y,w+m);else{var b;if(g<22250738585072014e-324)b=g/5e-324,d(b>>>0,y,w+p),d((_<<31|b/4294967296)>>>0,y,w+m);else{var v=Math.floor(Math.log(g)/Math.LN2);v===1024&&(v=1023),b=g*Math.pow(2,-v),d(b*4503599627370496>>>0,y,w+p),d((_<<31|v+1023<<20|b*1048576&1048575)>>>0,y,w+m)}}}l.writeDoubleLE=f.bind(null,o,0,4),l.writeDoubleBE=f.bind(null,c,4,0);function h(d,p,m,g,y){var w=d(g,y+p),_=d(g,y+m),b=(_>>31)*2+1,v=_>>>20&2047,S=4294967296*(_&1048575)+w;return v===2047?S?NaN:b*(1/0):v===0?b*5e-324*S:b*Math.pow(2,v-1075)*(S+4503599627370496)}l.readDoubleLE=h.bind(null,a,0,4),l.readDoubleBE=h.bind(null,u,4,0)}(),l}function o(l,f,h){f[h]=l&255,f[h+1]=l>>>8&255,f[h+2]=l>>>16&255,f[h+3]=l>>>24}function c(l,f,h){f[h]=l>>>24,f[h+1]=l>>>16&255,f[h+2]=l>>>8&255,f[h+3]=l&255}function a(l,f){return(l[f]|l[f+1]<<8|l[f+2]<<16|l[f+3]<<24)>>>0}function u(l,f){return(l[f]<<24|l[f+1]<<16|l[f+2]<<8|l[f+3])>>>0}},{}],7:[function(t,n,s){n.exports=i;function i(o){try{var c=t(o);if(c&&(c.length||Object.keys(c).length))return c}catch{}return null}},{}],8:[function(t,n,s){var i=s,o=i.isAbsolute=function(a){return/^(?:\/|\w+:)/.test(a)},c=i.normalize=function(a){a=a.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var u=a.split("/"),l=o(a),f="";l&&(f=u.shift()+"/");for(var h=0;h<u.length;)u[h]===".."?h>0&&u[h-1]!==".."?u.splice(--h,2):l?u.splice(h,1):++h:u[h]==="."?u.splice(h,1):++h;return f+u.join("/")};i.resolve=function(a,u,l){return l||(u=c(u)),o(u)?u:(l||(a=c(a)),(a=a.replace(/(?:\/|^)[^/]+$/,"")).length?c(a+"/"+u):u)}},{}],9:[function(t,n,s){n.exports=i;function i(o,c,a){var u=a||8192,l=u>>>1,f=null,h=u;return function(d){if(d<1||d>l)return o(d);h+d>u&&(f=o(u),h=0);var p=c.call(f,h,h+=d);return h&7&&(h=(h|7)+1),p}}},{}],10:[function(t,n,s){var i=s;i.length=function(o){for(var c=0,a=0,u=0;u<o.length;++u)a=o.charCodeAt(u),a<128?c+=1:a<2048?c+=2:(a&64512)===55296&&(o.charCodeAt(u+1)&64512)===56320?(++u,c+=4):c+=3;return c},i.read=function(o,c,a){var u=a-c;if(u<1)return"";for(var l=null,f=[],h=0,d;c<a;)d=o[c++],d<128?f[h++]=d:d>191&&d<224?f[h++]=(d&31)<<6|o[c++]&63:d>239&&d<365?(d=((d&7)<<18|(o[c++]&63)<<12|(o[c++]&63)<<6|o[c++]&63)-65536,f[h++]=55296+(d>>10),f[h++]=56320+(d&1023)):f[h++]=(d&15)<<12|(o[c++]&63)<<6|o[c++]&63,h>8191&&((l||(l=[])).push(String.fromCharCode.apply(String,f)),h=0);return l?(h&&l.push(String.fromCharCode.apply(String,f.slice(0,h))),l.join("")):String.fromCharCode.apply(String,f.slice(0,h))},i.write=function(o,c,a){for(var u=a,l,f,h=0;h<o.length;++h)l=o.charCodeAt(h),l<128?c[a++]=l:l<2048?(c[a++]=l>>6|192,c[a++]=l&63|128):(l&64512)===55296&&((f=o.charCodeAt(h+1))&64512)===56320?(l=65536+((l&1023)<<10)+(f&1023),++h,c[a++]=l>>18|240,c[a++]=l>>12&63|128,c[a++]=l>>6&63|128,c[a++]=l&63|128):(c[a++]=l>>12|224,c[a++]=l>>6&63|128,c[a++]=l&63|128);return a-u}},{}],11:[function(t,n,s){n.exports=o;var i=/\/|\./;function o(a,u){i.test(a)||(a="google/protobuf/"+a+".proto",u={nested:{google:{nested:{protobuf:{nested:u}}}}}),o[a]=u}o("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var c;o("duration",{Duration:c={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),o("timestamp",{Timestamp:c}),o("empty",{Empty:{fields:{}}}),o("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),o("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),o("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),o.get=function(a){return o[a]||null}},{}],12:[function(t,n,s){var i=s,o=t(15),c=t(37);function a(l,f,h,d){if(f.resolvedType)if(f.resolvedType instanceof o){l("switch(d%s){",d);for(var p=f.resolvedType.values,m=Object.keys(p),g=0;g<m.length;++g)f.repeated&&p[m[g]]===f.typeDefault&&l("default:"),l("case%j:",m[g])("case %i:",p[m[g]])("m%s=%j",d,p[m[g]])("break");l("}")}else l('if(typeof d%s!=="object")',d)("throw TypeError(%j)",f.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",d,h,d);else{var y=!1;switch(f.type){case"double":case"float":l("m%s=Number(d%s)",d,d);break;case"uint32":case"fixed32":l("m%s=d%s>>>0",d,d);break;case"int32":case"sint32":case"sfixed32":l("m%s=d%s|0",d,d);break;case"uint64":y=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":l("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",d,d,y)('else if(typeof d%s==="string")',d)("m%s=parseInt(d%s,10)",d,d)('else if(typeof d%s==="number")',d)("m%s=d%s",d,d)('else if(typeof d%s==="object")',d)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",d,d,d,y?"true":"");break;case"bytes":l('if(typeof d%s==="string")',d)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",d,d,d)("else if(d%s.length)",d)("m%s=d%s",d,d);break;case"string":l("m%s=String(d%s)",d,d);break;case"bool":l("m%s=Boolean(d%s)",d,d);break}}return l}i.fromObject=function(l){var f=l.fieldsArray,h=c.codegen(["d"],l.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!f.length)return h("return new this.ctor");h("var m=new this.ctor");for(var d=0;d<f.length;++d){var p=f[d].resolve(),m=c.safeProp(p.name);p.map?(h("if(d%s){",m)('if(typeof d%s!=="object")',m)("throw TypeError(%j)",p.fullName+": object expected")("m%s={}",m)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",m),a(h,p,d,m+"[ks[i]]")("}")("}")):p.repeated?(h("if(d%s){",m)("if(!Array.isArray(d%s))",m)("throw TypeError(%j)",p.fullName+": array expected")("m%s=[]",m)("for(var i=0;i<d%s.length;++i){",m),a(h,p,d,m+"[i]")("}")("}")):(p.resolvedType instanceof o||h("if(d%s!=null){",m),a(h,p,d,m),p.resolvedType instanceof o||h("}"))}return h("return m")};function u(l,f,h,d){if(f.resolvedType)f.resolvedType instanceof o?l("d%s=o.enums===String?types[%i].values[m%s]:m%s",d,h,d,d):l("d%s=types[%i].toObject(m%s,o)",d,h,d);else{var p=!1;switch(f.type){case"double":case"float":l("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",d,d,d,d);break;case"uint64":p=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":l('if(typeof m%s==="number")',d)("d%s=o.longs===String?String(m%s):m%s",d,d,d)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",d,d,d,d,p?"true":"",d);break;case"bytes":l("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",d,d,d,d,d);break;default:l("d%s=m%s",d,d);break}}return l}i.toObject=function(l){var f=l.fieldsArray.slice().sort(c.compareFieldsById);if(!f.length)return c.codegen()("return {}");for(var h=c.codegen(["m","o"],l.name+"$toObject")("if(!o)")("o={}")("var d={}"),d=[],p=[],m=[],g=0;g<f.length;++g)f[g].partOf||(f[g].resolve().repeated?d:f[g].map?p:m).push(f[g]);if(d.length){for(h("if(o.arrays||o.defaults){"),g=0;g<d.length;++g)h("d%s=[]",c.safeProp(d[g].name));h("}")}if(p.length){for(h("if(o.objects||o.defaults){"),g=0;g<p.length;++g)h("d%s={}",c.safeProp(p[g].name));h("}")}if(m.length){for(h("if(o.defaults){"),g=0;g<m.length;++g){var y=m[g],w=c.safeProp(y.name);y.resolvedType instanceof o?h("d%s=o.enums===String?%j:%j",w,y.resolvedType.valuesById[y.typeDefault],y.typeDefault):y.long?h("if(util.Long){")("var n=new util.Long(%i,%i,%j)",y.typeDefault.low,y.typeDefault.high,y.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",w)("}else")("d%s=o.longs===String?%j:%i",w,y.typeDefault.toString(),y.typeDefault.toNumber()):y.bytes?h("d%s=o.bytes===String?%j:%s",w,String.fromCharCode.apply(String,y.typeDefault),"["+Array.prototype.slice.call(y.typeDefault).join(",")+"]"):h("d%s=%j",w,y.typeDefault)}h("}")}var _=!1;for(g=0;g<f.length;++g){var y=f[g],b=l._fieldsArray.indexOf(y),w=c.safeProp(y.name);y.map?(_||(_=!0,h("var ks2")),h("if(m%s&&(ks2=Object.keys(m%s)).length){",w,w)("d%s={}",w)("for(var j=0;j<ks2.length;++j){"),u(h,y,b,w+"[ks2[j]]")("}")):y.repeated?(h("if(m%s&&m%s.length){",w,w)("d%s=[]",w)("for(var j=0;j<m%s.length;++j){",w),u(h,y,b,w+"[j]")("}")):(h("if(m%s!=null&&m.hasOwnProperty(%j)){",w,y.name),u(h,y,b,w),y.partOf&&h("if(o.oneofs)")("d%s=%j",c.safeProp(y.partOf.name),y.name)),h("}")}return h("return d")}},{15:15,37:37}],13:[function(t,n,s){n.exports=u;var i=t(15),o=t(36),c=t(37);function a(l){return"missing required '"+l.name+"'"}function u(l){var f=c.codegen(["r","l"],l.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(l.fieldsArray.filter(function(y){return y.map}).length?",k":""))("while(r.pos<c){")("var t=r.uint32()");l.group&&f("if((t&7)===4)")("break"),f("switch(t>>>3){");for(var h=0;h<l.fieldsArray.length;++h){var d=l._fieldsArray[h].resolve(),p=d.resolvedType instanceof i?"int32":d.type,m="m"+c.safeProp(d.name);f("case %i:",d.id),d.map?(f("r.skip().pos++")("if(%s===util.emptyObject)",m)("%s={}",m)("k=r.%s()",d.keyType)("r.pos++"),o.long[d.keyType]!==e?o.basic[p]===e?f('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',m,h):f('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',m,p):o.basic[p]===e?f("%s[k]=types[%i].decode(r,r.uint32())",m,h):f("%s[k]=r.%s()",m,p)):d.repeated?(f("if(!(%s&&%s.length))",m,m)("%s=[]",m),o.packed[p]!==e&&f("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",m,p)("}else"),o.basic[p]===e?f(d.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",m,h):f("%s.push(r.%s())",m,p)):o.basic[p]===e?f(d.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",m,h):f("%s=r.%s()",m,p),f("break")}for(f("default:")("r.skipType(t&7)")("break")("}")("}"),h=0;h<l._fieldsArray.length;++h){var g=l._fieldsArray[h];g.required&&f("if(!m.hasOwnProperty(%j))",g.name)("throw util.ProtocolError(%j,{instance:m})",a(g))}return f("return m")}},{15:15,36:36,37:37}],14:[function(t,n,s){n.exports=u;var i=t(15),o=t(36),c=t(37);function a(l,f,h,d){return f.resolvedType.group?l("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",h,d,(f.id<<3|3)>>>0,(f.id<<3|4)>>>0):l("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",h,d,(f.id<<3|2)>>>0)}function u(l){for(var f=c.codegen(["m","w"],l.name+"$encode")("if(!w)")("w=Writer.create()"),p,h,d=l.fieldsArray.slice().sort(c.compareFieldsById),p=0;p<d.length;++p){var m=d[p].resolve(),g=l._fieldsArray.indexOf(m),y=m.resolvedType instanceof i?"int32":m.type,w=o.basic[y];h="m"+c.safeProp(m.name),m.map?(f("if(%s!=null&&m.hasOwnProperty(%j)){",h,m.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",h)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(m.id<<3|2)>>>0,8|o.mapKey[m.keyType],m.keyType),w===e?f("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",g,h):f(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|w,y,h),f("}")("}")):m.repeated?(f("if(%s!=null&&%s.length){",h,h),m.packed&&o.packed[y]!==e?f("w.uint32(%i).fork()",(m.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",h)("w.%s(%s[i])",y,h)("w.ldelim()"):(f("for(var i=0;i<%s.length;++i)",h),w===e?a(f,m,g,h+"[i]"):f("w.uint32(%i).%s(%s[i])",(m.id<<3|w)>>>0,y,h)),f("}")):(m.optional&&f("if(%s!=null&&m.hasOwnProperty(%j))",h,m.name),w===e?a(f,m,g,h):f("w.uint32(%i).%s(%s)",(m.id<<3|w)>>>0,y,h))}return f("return w")}},{15:15,36:36,37:37}],15:[function(t,n,s){n.exports=a;var i=t(24);((a.prototype=Object.create(i.prototype)).constructor=a).className="Enum";var o=t(23),c=t(37);function a(u,l,f,h,d){if(i.call(this,u,f),l&&typeof l!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=h,this.comments=d||{},this.reserved=e,l)for(var p=Object.keys(l),m=0;m<p.length;++m)typeof l[p[m]]=="number"&&(this.valuesById[this.values[p[m]]=l[p[m]]]=p[m])}a.fromJSON=function(u,l){var f=new a(u,l.values,l.options,l.comment,l.comments);return f.reserved=l.reserved,f},a.prototype.toJSON=function(u){var l=u?!!u.keepComments:!1;return c.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:e,"comment",l?this.comment:e,"comments",l?this.comments:e])},a.prototype.add=function(u,l,f){if(!c.isString(u))throw TypeError("name must be a string");if(!c.isInteger(l))throw TypeError("id must be an integer");if(this.values[u]!==e)throw Error("duplicate name '"+u+"' in "+this);if(this.isReservedId(l))throw Error("id "+l+" is reserved in "+this);if(this.isReservedName(u))throw Error("name '"+u+"' is reserved in "+this);if(this.valuesById[l]!==e){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+l+" in "+this);this.values[u]=l}else this.valuesById[this.values[u]=l]=u;return this.comments[u]=f||null,this},a.prototype.remove=function(u){if(!c.isString(u))throw TypeError("name must be a string");var l=this.values[u];if(l==null)throw Error("name '"+u+"' does not exist in "+this);return delete this.valuesById[l],delete this.values[u],delete this.comments[u],this},a.prototype.isReservedId=function(u){return o.isReservedId(this.reserved,u)},a.prototype.isReservedName=function(u){return o.isReservedName(this.reserved,u)}},{23:23,24:24,37:37}],16:[function(t,n,s){n.exports=f;var i=t(24);((f.prototype=Object.create(i.prototype)).constructor=f).className="Field";var o=t(15),c=t(36),a=t(37),u,l=/^required|optional|repeated$/;f.fromJSON=function(h,d){return new f(h,d.id,d.type,d.rule,d.extend,d.options,d.comment)};function f(h,d,p,m,g,y,w){if(a.isObject(m)?(w=g,y=m,m=g=e):a.isObject(g)&&(w=y,y=g,g=e),i.call(this,h,y),!a.isInteger(d)||d<0)throw TypeError("id must be a non-negative integer");if(!a.isString(p))throw TypeError("type must be a string");if(m!==e&&!l.test(m=m.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(g!==e&&!a.isString(g))throw TypeError("extend must be a string");this.rule=m&&m!=="optional"?m:e,this.type=p,this.id=d,this.extend=g||e,this.required=m==="required",this.optional=!this.required,this.repeated=m==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=a.Long?c.long[p]!==e:!1,this.bytes=p==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=w}Object.defineProperty(f.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}}),f.prototype.setOption=function(h,d,p){return h==="packed"&&(this._packed=null),i.prototype.setOption.call(this,h,d,p)},f.prototype.toJSON=function(h){var d=h?!!h.keepComments:!1;return a.toObject(["rule",this.rule!=="optional"&&this.rule||e,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",d?this.comment:e])},f.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=c.defaults[this.type])===e&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof u?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof o&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==e&&this.resolvedType&&!(this.resolvedType instanceof o))&&delete this.options.packed,Object.keys(this.options).length||(this.options=e)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var h;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,h=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,h=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=h}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof u&&(this.parent.ctor.prototype[this.name]=this.defaultValue),i.prototype.resolve.call(this)},f.d=function(h,d,p,m){return typeof d=="function"?d=a.decorateType(d).name:d&&typeof d=="object"&&(d=a.decorateEnum(d).name),function(g,y){a.decorateType(g.constructor).add(new f(y,h,d,p,{default:m}))}},f._configure=function(h){u=h}},{15:15,24:24,36:36,37:37}],17:[function(t,n,s){var i=n.exports=t(18);i.build="light";function o(a,u,l){return typeof u=="function"?(l=u,u=new i.Root):u||(u=new i.Root),u.load(a,l)}i.load=o;function c(a,u){return u||(u=new i.Root),u.loadSync(a)}i.loadSync=c,i.encoder=t(14),i.decoder=t(13),i.verifier=t(40),i.converter=t(12),i.ReflectionObject=t(24),i.Namespace=t(23),i.Root=t(29),i.Enum=t(15),i.Type=t(35),i.Field=t(16),i.OneOf=t(25),i.MapField=t(20),i.Service=t(33),i.Method=t(22),i.Message=t(21),i.wrappers=t(41),i.types=t(36),i.util=t(37),i.ReflectionObject._configure(i.Root),i.Namespace._configure(i.Type,i.Service),i.Root._configure(i.Type),i.Field._configure(i.Type)},{12:12,13:13,14:14,15:15,16:16,18:18,20:20,21:21,22:22,23:23,24:24,25:25,29:29,33:33,35:35,36:36,37:37,40:40,41:41}],18:[function(t,n,s){var i=s;i.build="minimal",i.Writer=t(42),i.BufferWriter=t(43),i.Reader=t(27),i.BufferReader=t(28),i.util=t(39),i.rpc=t(31),i.roots=t(30),i.configure=o;function o(){i.Reader._configure(i.BufferReader),i.util._configure()}i.Writer._configure(i.BufferWriter),o()},{27:27,28:28,30:30,31:31,39:39,42:42,43:43}],19:[function(t,n,s){var i=n.exports=t(17);i.build="full",i.tokenize=t(34),i.parse=t(26),i.common=t(11),i.Root._configure(i.Type,i.parse,i.common)},{11:11,17:17,26:26,34:34}],20:[function(t,n,s){n.exports=a;var i=t(16);((a.prototype=Object.create(i.prototype)).constructor=a).className="MapField";var o=t(36),c=t(37);function a(u,l,f,h,d,p){if(i.call(this,u,l,h,e,e,d,p),!c.isString(f))throw TypeError("keyType must be a string");this.keyType=f,this.resolvedKeyType=null,this.map=!0}a.fromJSON=function(u,l){return new a(u,l.id,l.keyType,l.type,l.options,l.comment)},a.prototype.toJSON=function(u){var l=u?!!u.keepComments:!1;return c.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",l?this.comment:e])},a.prototype.resolve=function(){if(this.resolved)return this;if(o.mapKey[this.keyType]===e)throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},a.d=function(u,l,f){return typeof f=="function"?f=c.decorateType(f).name:f&&typeof f=="object"&&(f=c.decorateEnum(f).name),function(h,d){c.decorateType(h.constructor).add(new a(d,u,l,f))}}},{16:16,36:36,37:37}],21:[function(t,n,s){n.exports=o;var i=t(39);function o(c){if(c)for(var a=Object.keys(c),u=0;u<a.length;++u)this[a[u]]=c[a[u]]}o.create=function(c){return this.$type.create(c)},o.encode=function(c,a){return this.$type.encode(c,a)},o.encodeDelimited=function(c,a){return this.$type.encodeDelimited(c,a)},o.decode=function(c){return this.$type.decode(c)},o.decodeDelimited=function(c){return this.$type.decodeDelimited(c)},o.verify=function(c){return this.$type.verify(c)},o.fromObject=function(c){return this.$type.fromObject(c)},o.toObject=function(c,a){return this.$type.toObject(c,a)},o.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},{39:39}],22:[function(t,n,s){n.exports=c;var i=t(24);((c.prototype=Object.create(i.prototype)).constructor=c).className="Method";var o=t(37);function c(a,u,l,f,h,d,p,m){if(o.isObject(h)?(p=h,h=d=e):o.isObject(d)&&(p=d,d=e),!(u===e||o.isString(u)))throw TypeError("type must be a string");if(!o.isString(l))throw TypeError("requestType must be a string");if(!o.isString(f))throw TypeError("responseType must be a string");i.call(this,a,p),this.type=u||"rpc",this.requestType=l,this.requestStream=h?!0:e,this.responseType=f,this.responseStream=d?!0:e,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=m}c.fromJSON=function(a,u){return new c(a,u.type,u.requestType,u.responseType,u.requestStream,u.responseStream,u.options,u.comment)},c.prototype.toJSON=function(a){var u=a?!!a.keepComments:!1;return o.toObject(["type",this.type!=="rpc"&&this.type||e,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",u?this.comment:e])},c.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),i.prototype.resolve.call(this))}},{24:24,37:37}],23:[function(t,n,s){n.exports=h;var i=t(24);((h.prototype=Object.create(i.prototype)).constructor=h).className="Namespace";var o=t(15),c=t(16),a=t(37),u,l;h.fromJSON=function(p,m){return new h(p,m.options).addJSON(m.nested)};function f(p,m){if(!(p&&p.length))return e;for(var g={},y=0;y<p.length;++y)g[p[y].name]=p[y].toJSON(m);return g}h.arrayToJSON=f,h.isReservedId=function(p,m){if(p){for(var g=0;g<p.length;++g)if(typeof p[g]!="string"&&p[g][0]<=m&&p[g][1]>=m)return!0}return!1},h.isReservedName=function(p,m){if(p){for(var g=0;g<p.length;++g)if(p[g]===m)return!0}return!1};function h(p,m){i.call(this,p,m),this.nested=e,this._nestedArray=null}function d(p){return p._nestedArray=null,p}Object.defineProperty(h.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=a.toArray(this.nested))}}),h.prototype.toJSON=function(p){return a.toObject(["options",this.options,"nested",f(this.nestedArray,p)])},h.prototype.addJSON=function(p){var m=this;if(p)for(var g=Object.keys(p),y=0,w;y<g.length;++y)w=p[g[y]],m.add((w.fields!==e?u.fromJSON:w.values!==e?o.fromJSON:w.methods!==e?l.fromJSON:w.id!==e?c.fromJSON:h.fromJSON)(g[y],w));return this},h.prototype.get=function(p){return this.nested&&this.nested[p]||null},h.prototype.getEnum=function(p){if(this.nested&&this.nested[p]instanceof o)return this.nested[p].values;throw Error("no such enum: "+p)},h.prototype.add=function(p){if(!(p instanceof c&&p.extend!==e||p instanceof u||p instanceof o||p instanceof l||p instanceof h))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var m=this.get(p.name);if(m)if(m instanceof h&&p instanceof h&&!(m instanceof u||m instanceof l)){for(var g=m.nestedArray,y=0;y<g.length;++y)p.add(g[y]);this.remove(m),this.nested||(this.nested={}),p.setOptions(m.options,!0)}else throw Error("duplicate name '"+p.name+"' in "+this)}return this.nested[p.name]=p,p.onAdd(this),d(this)},h.prototype.remove=function(p){if(!(p instanceof i))throw TypeError("object must be a ReflectionObject");if(p.parent!==this)throw Error(p+" is not a member of "+this);return delete this.nested[p.name],Object.keys(this.nested).length||(this.nested=e),p.onRemove(this),d(this)},h.prototype.define=function(p,m){if(a.isString(p))p=p.split(".");else if(!Array.isArray(p))throw TypeError("illegal path");if(p&&p.length&&p[0]==="")throw Error("path must be relative");for(var g=this;p.length>0;){var y=p.shift();if(g.nested&&g.nested[y]){if(g=g.nested[y],!(g instanceof h))throw Error("path conflicts with non-namespace objects")}else g.add(g=new h(y))}return m&&g.addJSON(m),g},h.prototype.resolveAll=function(){for(var p=this.nestedArray,m=0;m<p.length;)p[m]instanceof h?p[m++].resolveAll():p[m++].resolve();return this.resolve()},h.prototype.lookup=function(p,m,g){if(typeof m=="boolean"?(g=m,m=e):m&&!Array.isArray(m)&&(m=[m]),a.isString(p)&&p.length){if(p===".")return this.root;p=p.split(".")}else if(!p.length)return this;if(p[0]==="")return this.root.lookup(p.slice(1),m);var y=this.get(p[0]);if(y){if(p.length===1){if(!m||m.indexOf(y.constructor)>-1)return y}else if(y instanceof h&&(y=y.lookup(p.slice(1),m,!0)))return y}else for(var w=0;w<this.nestedArray.length;++w)if(this._nestedArray[w]instanceof h&&(y=this._nestedArray[w].lookup(p,m,!0)))return y;return this.parent===null||g?null:this.parent.lookup(p,m)},h.prototype.lookupType=function(p){var m=this.lookup(p,[u]);if(!m)throw Error("no such type: "+p);return m},h.prototype.lookupEnum=function(p){var m=this.lookup(p,[o]);if(!m)throw Error("no such Enum '"+p+"' in "+this);return m},h.prototype.lookupTypeOrEnum=function(p){var m=this.lookup(p,[u,o]);if(!m)throw Error("no such Type or Enum '"+p+"' in "+this);return m},h.prototype.lookupService=function(p){var m=this.lookup(p,[l]);if(!m)throw Error("no such Service '"+p+"' in "+this);return m},h._configure=function(p,m){u=p,l=m}},{15:15,16:16,24:24,37:37}],24:[function(t,n,s){n.exports=c,c.className="ReflectionObject";var i=t(37),o;function c(a,u){if(!i.isString(a))throw TypeError("name must be a string");if(u&&!i.isObject(u))throw TypeError("options must be an object");this.options=u,this.name=a,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(c.prototype,{root:{get:function(){for(var a=this;a.parent!==null;)a=a.parent;return a}},fullName:{get:function(){for(var a=[this.name],u=this.parent;u;)a.unshift(u.name),u=u.parent;return a.join(".")}}}),c.prototype.toJSON=function(){throw Error()},c.prototype.onAdd=function(a){this.parent&&this.parent!==a&&this.parent.remove(this),this.parent=a,this.resolved=!1;var u=a.root;u instanceof o&&u._handleAdd(this)},c.prototype.onRemove=function(a){var u=a.root;u instanceof o&&u._handleRemove(this),this.parent=null,this.resolved=!1},c.prototype.resolve=function(){return this.resolved?this:(this.root instanceof o&&(this.resolved=!0),this)},c.prototype.getOption=function(a){return this.options?this.options[a]:e},c.prototype.setOption=function(a,u,l){return(!l||!this.options||this.options[a]===e)&&((this.options||(this.options={}))[a]=u),this},c.prototype.setOptions=function(a,u){if(a)for(var l=Object.keys(a),f=0;f<l.length;++f)this.setOption(l[f],a[l[f]],u);return this},c.prototype.toString=function(){var a=this.constructor.className,u=this.fullName;return u.length?a+" "+u:a},c._configure=function(a){o=a}},{37:37}],25:[function(t,n,s){n.exports=a;var i=t(24);((a.prototype=Object.create(i.prototype)).constructor=a).className="OneOf";var o=t(16),c=t(37);function a(l,f,h,d){if(Array.isArray(f)||(h=f,f=e),i.call(this,l,h),!(f===e||Array.isArray(f)))throw TypeError("fieldNames must be an Array");this.oneof=f||[],this.fieldsArray=[],this.comment=d}a.fromJSON=function(l,f){return new a(l,f.oneof,f.options,f.comment)},a.prototype.toJSON=function(l){var f=l?!!l.keepComments:!1;return c.toObject(["options",this.options,"oneof",this.oneof,"comment",f?this.comment:e])};function u(l){if(l.parent)for(var f=0;f<l.fieldsArray.length;++f)l.fieldsArray[f].parent||l.parent.add(l.fieldsArray[f])}a.prototype.add=function(l){if(!(l instanceof o))throw TypeError("field must be a Field");return l.parent&&l.parent!==this.parent&&l.parent.remove(l),this.oneof.push(l.name),this.fieldsArray.push(l),l.partOf=this,u(this),this},a.prototype.remove=function(l){if(!(l instanceof o))throw TypeError("field must be a Field");var f=this.fieldsArray.indexOf(l);if(f<0)throw Error(l+" is not a member of "+this);return this.fieldsArray.splice(f,1),f=this.oneof.indexOf(l.name),f>-1&&this.oneof.splice(f,1),l.partOf=null,this},a.prototype.onAdd=function(l){i.prototype.onAdd.call(this,l);for(var f=this,h=0;h<this.oneof.length;++h){var d=l.get(this.oneof[h]);d&&!d.partOf&&(d.partOf=f,f.fieldsArray.push(d))}u(this)},a.prototype.onRemove=function(l){for(var f=0,h;f<this.fieldsArray.length;++f)(h=this.fieldsArray[f]).parent&&h.parent.remove(h);i.prototype.onRemove.call(this,l)},a.d=function(){for(var l=new Array(arguments.length),f=0;f<arguments.length;)l[f]=arguments[f++];return function(h,d){c.decorateType(h.constructor).add(new a(d,l)),Object.defineProperty(h,d,{get:c.oneOfGetter(l),set:c.oneOfSetter(l)})}}},{16:16,24:24,37:37}],26:[function(t,n,s){n.exports=F,F.filename=null,F.defaults={keepCase:!1};var i=t(34),o=t(29),c=t(35),a=t(16),u=t(20),l=t(25),f=t(15),h=t(33),d=t(22),p=t(36),m=t(37),g=/^[1-9][0-9]*$/,y=/^-?[1-9][0-9]*$/,w=/^0[x][0-9a-fA-F]+$/,_=/^-?0[x][0-9a-fA-F]+$/,b=/^0[0-7]+$/,v=/^-?0[0-7]+$/,S=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,E=/^[a-zA-Z_][a-zA-Z_0-9]*$/,L=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,x=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function F(J,ge,z){ge instanceof o||(z=ge,ge=new o),z||(z=F.defaults);var Q=i(J,z.alternateCommentMode||!1),U=Q.next,he=Q.push,ce=Q.peek,j=Q.skip,lt=Q.cmnt,kt=!0,ut,H,re,oe,ue=!1,ve=ge,Ae=z.keepCase?function(A){return A}:m.camelCase;function q(A,O,D){var M=F.filename;return D||(F.filename=null),Error("illegal "+(O||"token")+" '"+A+"' ("+(M?M+", ":"")+"line "+Q.line+")")}function tt(){var A=[],O;do{if((O=U())!=='"'&&O!=="'")throw q(O);A.push(U()),j(O),O=ce()}while(O==='"'||O==="'");return A.join("")}function Xo(A){var O=U();switch(O){case"'":case'"':return he(O),tt();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return tf(O,!0)}catch{if(L.test(O))return O;throw q(O,"value")}}function qn(A,O){var D,M;do O&&((D=ce())==='"'||D==="'")?A.push(tt()):A.push([M=Bt(U()),j("to",!0)?Bt(U()):M]);while(j(",",!0));j(";")}function tf(A,O){var D=1;switch(A.charAt(0)==="-"&&(D=-1,A=A.substring(1)),A){case"inf":case"INF":case"Inf":return D*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(g.test(A))return D*parseInt(A,10);if(w.test(A))return D*parseInt(A,16);if(b.test(A))return D*parseInt(A,8);if(S.test(A))return D*parseFloat(A);throw q(A,"number",O)}function Bt(A,O){switch(A){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!O&&A.charAt(0)==="-")throw q(A,"id");if(y.test(A))return parseInt(A,10);if(_.test(A))return parseInt(A,16);if(v.test(A))return parseInt(A,8);throw q(A,"id")}function rf(){if(ut!==e)throw q("package");if(ut=U(),!L.test(ut))throw q(ut,"name");ve=ve.define(ut),j(";")}function nf(){var A=ce(),O;switch(A){case"weak":O=re||(re=[]),U();break;case"public":U();default:O=H||(H=[]);break}A=tt(),j(";"),O.push(A)}function sf(){if(j("="),oe=tt(),ue=oe==="proto3",!ue&&oe!=="proto2")throw q(oe,"syntax");j(";")}function Vn(A,O){switch(O){case"option":return Ge(A,O),j(";"),!0;case"message":return of(A,O),!0;case"enum":return uf(A,O),!0;case"service":return ff(A,O),!0;case"extend":return pf(A,O),!0}return!1}function Ze(A,O,D){var M=Q.line;if(A&&(A.comment=lt(),A.filename=F.filename),j("{",!0)){for(var ae;(ae=U())!=="}";)O(ae);j(";",!0)}else D&&D(),j(";"),A&&typeof A.comment!="string"&&(A.comment=lt(M))}function of(A,O){if(!E.test(O=U()))throw q(O,"type name");var D=new c(O);Ze(D,function(M){if(!Vn(D,M))switch(M){case"map":cf(D);break;case"required":case"optional":case"repeated":Ut(D,M);break;case"oneof":lf(D,M);break;case"extensions":qn(D.extensions||(D.extensions=[]));break;case"reserved":qn(D.reserved||(D.reserved=[]),!0);break;default:if(!ue||!L.test(M))throw q(M);he(M),Ut(D,"optional");break}}),A.add(D)}function Ut(A,O,D){var M=U();if(M==="group"){af(A,O);return}if(!L.test(M))throw q(M,"type");var ae=U();if(!E.test(ae))throw q(ae,"name");ae=Ae(ae),j("=");var fe=new a(ae,Bt(U()),M,O,D);Ze(fe,function(rt){if(rt==="option")Ge(fe,rt),j(";");else throw q(rt)},function(){Hn(fe)}),A.add(fe),!ue&&fe.repeated&&(p.packed[M]!==e||p.basic[M]===e)&&fe.setOption("packed",!1,!0)}function af(A,O){var D=U();if(!E.test(D))throw q(D,"name");var M=m.lcFirst(D);D===M&&(D=m.ucFirst(D)),j("=");var ae=Bt(U()),fe=new c(D);fe.group=!0;var rt=new a(M,ae,D,O);rt.filename=F.filename,Ze(fe,function(vt){switch(vt){case"option":Ge(fe,vt),j(";");break;case"required":case"optional":case"repeated":Ut(fe,vt);break;default:throw q(vt)}}),A.add(fe).add(rt)}function cf(A){j("<");var O=U();if(p.mapKey[O]===e)throw q(O,"type");j(",");var D=U();if(!L.test(D))throw q(D,"type");j(">");var M=U();if(!E.test(M))throw q(M,"name");j("=");var ae=new u(Ae(M),Bt(U()),O,D);Ze(ae,function(fe){if(fe==="option")Ge(ae,fe),j(";");else throw q(fe)},function(){Hn(ae)}),A.add(ae)}function lf(A,O){if(!E.test(O=U()))throw q(O,"name");var D=new l(Ae(O));Ze(D,function(M){M==="option"?(Ge(D,M),j(";")):(he(M),Ut(D,"optional"))}),A.add(D)}function uf(A,O){if(!E.test(O=U()))throw q(O,"name");var D=new f(O);Ze(D,function(M){switch(M){case"option":Ge(D,M),j(";");break;case"reserved":qn(D.reserved||(D.reserved=[]),!0);break;default:hf(D,M)}}),A.add(D)}function hf(A,O){if(!E.test(O))throw q(O,"name");j("=");var D=Bt(U(),!0),M={};Ze(M,function(ae){if(ae==="option")Ge(M,ae),j(";");else throw q(ae)},function(){Hn(M)}),A.add(O,D,M.comment)}function Ge(A,O){var D=j("(",!0);if(!L.test(O=U()))throw q(O,"name");var M=O;D&&(j(")"),M="("+M+")",O=ce(),x.test(O)&&(M+=O,U())),j("="),zn(A,M)}function zn(A,O){if(j("{",!0))do{if(!E.test(Ie=U()))throw q(Ie,"name");ce()==="{"?zn(A,O+"."+Ie):(j(":"),ce()==="{"?zn(A,O+"."+Ie):ea(A,O+"."+Ie,Xo()))}while(!j("}",!0));else ea(A,O,Xo())}function ea(A,O,D){A.setOption&&A.setOption(O,D)}function Hn(A){if(j("[",!0)){do Ge(A,"option");while(j(",",!0));j("]")}return A}function ff(A,O){if(!E.test(O=U()))throw q(O,"service name");var D=new h(O);Ze(D,function(M){if(!Vn(D,M))if(M==="rpc")df(D,M);else throw q(M)}),A.add(D)}function df(A,O){var D=O;if(!E.test(O=U()))throw q(O,"name");var M=O,ae,fe,rt,vt;if(j("("),j("stream",!0)&&(fe=!0),!L.test(O=U())||(ae=O,j(")"),j("returns"),j("("),j("stream",!0)&&(vt=!0),!L.test(O=U())))throw q(O);rt=O,j(")");var Jn=new d(M,D,ae,rt,fe,vt);Ze(Jn,function(Zn){if(Zn==="option")Ge(Jn,Zn),j(";");else throw q(Zn)}),A.add(Jn)}function pf(A,O){if(!L.test(O=U()))throw q(O,"reference");var D=O;Ze(null,function(M){switch(M){case"required":case"repeated":case"optional":Ut(A,M,D);break;default:if(!ue||!L.test(M))throw q(M);he(M),Ut(A,"optional",D);break}})}for(var Ie;(Ie=U())!==null;)switch(Ie){case"package":if(!kt)throw q(Ie);rf();break;case"import":if(!kt)throw q(Ie);nf();break;case"syntax":if(!kt)throw q(Ie);sf();break;case"option":if(!kt)throw q(Ie);Ge(ve,Ie),j(";");break;default:if(Vn(ve,Ie)){kt=!1;continue}throw q(Ie)}return F.filename=null,{package:ut,imports:H,weakImports:re,syntax:oe,root:ge}}},{15:15,16:16,20:20,22:22,25:25,29:29,33:33,34:34,35:35,36:36,37:37}],27:[function(t,n,s){n.exports=l;var i=t(39),o,c=i.LongBits,a=i.utf8;function u(m,g){return RangeError("index out of range: "+m.pos+" + "+(g||1)+" > "+m.len)}function l(m){this.buf=m,this.pos=0,this.len=m.length}var f=typeof Uint8Array<"u"?function(m){if(m instanceof Uint8Array||Array.isArray(m))return new l(m);throw Error("illegal buffer")}:function(m){if(Array.isArray(m))return new l(m);throw Error("illegal buffer")};l.create=i.Buffer?function(m){return(l.create=function(g){return i.Buffer.isBuffer(g)?new o(g):f(g)})(m)}:f,l.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,l.prototype.uint32=function(){var m=4294967295;return function(){if(m=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(m=(m|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(m=(m|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(m=(m|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(m=(m|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return m;if((this.pos+=5)>this.len)throw this.pos=this.len,u(this,10);return m}}(),l.prototype.int32=function(){return this.uint32()|0},l.prototype.sint32=function(){var m=this.uint32();return m>>>1^-(m&1)|0};function h(){var m=new c(0,0),g=0;if(this.len-this.pos>4){for(;g<4;++g)if(m.lo=(m.lo|(this.buf[this.pos]&127)<<g*7)>>>0,this.buf[this.pos++]<128)return m;if(m.lo=(m.lo|(this.buf[this.pos]&127)<<28)>>>0,m.hi=(m.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return m;g=0}else{for(;g<3;++g){if(this.pos>=this.len)throw u(this);if(m.lo=(m.lo|(this.buf[this.pos]&127)<<g*7)>>>0,this.buf[this.pos++]<128)return m}return m.lo=(m.lo|(this.buf[this.pos++]&127)<<g*7)>>>0,m}if(this.len-this.pos>4){for(;g<5;++g)if(m.hi=(m.hi|(this.buf[this.pos]&127)<<g*7+3)>>>0,this.buf[this.pos++]<128)return m}else for(;g<5;++g){if(this.pos>=this.len)throw u(this);if(m.hi=(m.hi|(this.buf[this.pos]&127)<<g*7+3)>>>0,this.buf[this.pos++]<128)return m}throw Error("invalid varint encoding")}l.prototype.bool=function(){return this.uint32()!==0};function d(m,g){return(m[g-4]|m[g-3]<<8|m[g-2]<<16|m[g-1]<<24)>>>0}l.prototype.fixed32=function(){if(this.pos+4>this.len)throw u(this,4);return d(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw u(this,4);return d(this.buf,this.pos+=4)|0};function p(){if(this.pos+8>this.len)throw u(this,8);return new c(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}l.prototype.float=function(){if(this.pos+4>this.len)throw u(this,4);var m=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,m},l.prototype.double=function(){if(this.pos+8>this.len)throw u(this,4);var m=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,m},l.prototype.bytes=function(){var m=this.uint32(),g=this.pos,y=this.pos+m;if(y>this.len)throw u(this,m);return this.pos+=m,Array.isArray(this.buf)?this.buf.slice(g,y):g===y?new this.buf.constructor(0):this._slice.call(this.buf,g,y)},l.prototype.string=function(){var m=this.bytes();return a.read(m,0,m.length)},l.prototype.skip=function(m){if(typeof m=="number"){if(this.pos+m>this.len)throw u(this,m);this.pos+=m}else do if(this.pos>=this.len)throw u(this);while(this.buf[this.pos++]&128);return this},l.prototype.skipType=function(m){switch(m){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:do{if((m=this.uint32()&7)===4)break;this.skipType(m)}while(!0);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+m+" at offset "+this.pos)}return this},l._configure=function(m){o=m;var g=i.Long?"toLong":"toNumber";i.merge(l.prototype,{int64:function(){return h.call(this)[g](!1)},uint64:function(){return h.call(this)[g](!0)},sint64:function(){return h.call(this).zzDecode()[g](!1)},fixed64:function(){return p.call(this)[g](!0)},sfixed64:function(){return p.call(this)[g](!1)}})}},{39:39}],28:[function(t,n,s){n.exports=c;var i=t(27);(c.prototype=Object.create(i.prototype)).constructor=c;var o=t(39);function c(a){i.call(this,a)}o.Buffer&&(c.prototype._slice=o.Buffer.prototype.slice),c.prototype.string=function(){var a=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+a,this.len))}},{27:27,39:39}],29:[function(t,n,s){n.exports=d;var i=t(23);((d.prototype=Object.create(i.prototype)).constructor=d).className="Root";var o=t(16),c=t(15),a=t(25),u=t(37),l,f,h;function d(y){i.call(this,"",y),this.deferred=[],this.files=[]}d.fromJSON=function(y,w){return w||(w=new d),y.options&&w.setOptions(y.options),w.addJSON(y.nested)},d.prototype.resolvePath=u.path.resolve;function p(){}d.prototype.load=function y(w,_,b){typeof _=="function"&&(b=_,_=e);var v=this;if(!b)return u.asPromise(y,v,w,_);var S=b===p;function E(z,Q){if(b){var U=b;if(b=null,S)throw z;U(z,Q)}}function L(z,Q){try{if(u.isString(Q)&&Q.charAt(0)==="{"&&(Q=JSON.parse(Q)),!u.isString(Q))v.setOptions(Q.options).addJSON(Q.nested);else{f.filename=z;var U=f(Q,v,_),he,ce=0;if(U.imports)for(;ce<U.imports.length;++ce)(he=v.resolvePath(z,U.imports[ce]))&&x(he);if(U.weakImports)for(ce=0;ce<U.weakImports.length;++ce)(he=v.resolvePath(z,U.weakImports[ce]))&&x(he,!0)}}catch(j){E(j)}!S&&!F&&E(null,v)}function x(z,Q){var U=z.lastIndexOf("google/protobuf/");if(U>-1){var he=z.substring(U);he in h&&(z=he)}if(!(v.files.indexOf(z)>-1)){if(v.files.push(z),z in h){S?L(z,h[z]):(++F,setTimeout(function(){--F,L(z,h[z])}));return}if(S){var ce;try{ce=u.fs.readFileSync(z).toString("utf8")}catch(j){Q||E(j);return}L(z,ce)}else++F,u.fetch(z,function(j,lt){if(--F,!!b){if(j){Q?F||E(null,v):E(j);return}L(z,lt)}})}}var F=0;u.isString(w)&&(w=[w]);for(var J=0,ge;J<w.length;++J)(ge=v.resolvePath("",w[J]))&&x(ge);return S?v:(F||E(null,v),e)},d.prototype.loadSync=function(y,w){if(!u.isNode)throw Error("not supported");return this.load(y,w,p)},d.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(y){return"'extend "+y.extend+"' in "+y.parent.fullName}).join(", "));return i.prototype.resolveAll.call(this)};var m=/^[A-Z]/;function g(y,w){var _=w.parent.lookup(w.extend);if(_){var b=new o(w.fullName,w.id,w.type,w.rule,e,w.options);return b.declaringField=w,w.extensionField=b,_.add(b),!0}return!1}d.prototype._handleAdd=function(y){if(y instanceof o)y.extend!==e&&!y.extensionField&&(g(this,y)||this.deferred.push(y));else if(y instanceof c)m.test(y.name)&&(y.parent[y.name]=y.values);else if(!(y instanceof a)){if(y instanceof l)for(var w=0;w<this.deferred.length;)g(this,this.deferred[w])?this.deferred.splice(w,1):++w;for(var _=0;_<y.nestedArray.length;++_)this._handleAdd(y._nestedArray[_]);m.test(y.name)&&(y.parent[y.name]=y)}},d.prototype._handleRemove=function(y){if(y instanceof o){if(y.extend!==e)if(y.extensionField)y.extensionField.parent.remove(y.extensionField),y.extensionField=null;else{var w=this.deferred.indexOf(y);w>-1&&this.deferred.splice(w,1)}}else if(y instanceof c)m.test(y.name)&&delete y.parent[y.name];else if(y instanceof i){for(var _=0;_<y.nestedArray.length;++_)this._handleRemove(y._nestedArray[_]);m.test(y.name)&&delete y.parent[y.name]}},d._configure=function(y,w,_){l=y,f=w,h=_}},{15:15,16:16,23:23,25:25,37:37}],30:[function(t,n,s){n.exports={}},{}],31:[function(t,n,s){var i=s;i.Service=t(32)},{32:32}],32:[function(t,n,s){n.exports=o;var i=t(39);(o.prototype=Object.create(i.EventEmitter.prototype)).constructor=o;function o(c,a,u){if(typeof c!="function")throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=c,this.requestDelimited=!!a,this.responseDelimited=!!u}o.prototype.rpcCall=function c(a,u,l,f,h){if(!f)throw TypeError("request must be specified");var d=this;if(!h)return i.asPromise(c,d,a,u,l,f);if(!d.rpcImpl)return setTimeout(function(){h(Error("already ended"))},0),e;try{return d.rpcImpl(a,u[d.requestDelimited?"encodeDelimited":"encode"](f).finish(),function(p,m){if(p)return d.emit("error",p,a),h(p);if(m===null)return d.end(!0),e;if(!(m instanceof l))try{m=l[d.responseDelimited?"decodeDelimited":"decode"](m)}catch(g){return d.emit("error",g,a),h(g)}return d.emit("data",m,a),h(null,m)})}catch(p){return d.emit("error",p,a),setTimeout(function(){h(p)},0),e}},o.prototype.end=function(c){return this.rpcImpl&&(c||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{39:39}],33:[function(t,n,s){n.exports=u;var i=t(23);((u.prototype=Object.create(i.prototype)).constructor=u).className="Service";var o=t(22),c=t(37),a=t(31);function u(f,h){i.call(this,f,h),this.methods={},this._methodsArray=null}u.fromJSON=function(f,h){var d=new u(f,h.options);if(h.methods)for(var p=Object.keys(h.methods),m=0;m<p.length;++m)d.add(o.fromJSON(p[m],h.methods[p[m]]));return h.nested&&d.addJSON(h.nested),d.comment=h.comment,d},u.prototype.toJSON=function(f){var h=i.prototype.toJSON.call(this,f),d=f?!!f.keepComments:!1;return c.toObject(["options",h&&h.options||e,"methods",i.arrayToJSON(this.methodsArray,f)||{},"nested",h&&h.nested||e,"comment",d?this.comment:e])},Object.defineProperty(u.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=c.toArray(this.methods))}});function l(f){return f._methodsArray=null,f}u.prototype.get=function(f){return this.methods[f]||i.prototype.get.call(this,f)},u.prototype.resolveAll=function(){for(var f=this.methodsArray,h=0;h<f.length;++h)f[h].resolve();return i.prototype.resolve.call(this)},u.prototype.add=function(f){if(this.get(f.name))throw Error("duplicate name '"+f.name+"' in "+this);return f instanceof o?(this.methods[f.name]=f,f.parent=this,l(this)):i.prototype.add.call(this,f)},u.prototype.remove=function(f){if(f instanceof o){if(this.methods[f.name]!==f)throw Error(f+" is not a member of "+this);return delete this.methods[f.name],f.parent=null,l(this)}return i.prototype.remove.call(this,f)},u.prototype.create=function(f,h,d){for(var p=new a.Service(f,h,d),m=0,g;m<this.methodsArray.length;++m){var y=c.lcFirst((g=this._methodsArray[m]).resolve().name).replace(/[^$\w_]/g,"");p[y]=c.codegen(["r","c"],c.isReserved(y)?y+"_":y)("return this.rpcCall(m,q,s,r,c)")({m:g,q:g.resolvedRequestType.ctor,s:g.resolvedResponseType.ctor})}return p}},{22:22,23:23,31:31,37:37}],34:[function(t,n,s){n.exports=m;var i=/[\s{}=;:[\],'"()<>]/g,o=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,c=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,a=/^ *[*/]+ */,u=/^\s*\*?\/*/,l=/\n/g,f=/\s/,h=/\\(.?)/g,d={0:"\0",r:"\r",n:`
24
- `,t:" "};function p(g){return g.replace(h,function(y,w){switch(w){case"\\":case"":return w;default:return d[w]||""}})}m.unescape=p;function m(g,y){g=g.toString();var w=0,_=g.length,b=1,v=null,S=null,E=0,L=!1,x=[],F=null;function J(H){return Error("illegal "+H+" (line "+b+")")}function ge(){var H=F==="'"?c:o;H.lastIndex=w-1;var re=H.exec(g);if(!re)throw J("string");return w=H.lastIndex,j(F),F=null,p(re[1])}function z(H){return g.charAt(H)}function Q(H,re){v=g.charAt(H++),E=b,L=!1;var oe;y?oe=2:oe=3;var ue=H-oe,ve;do if(--ue<0||(ve=g.charAt(ue))===`
25
- `){L=!0;break}while(ve===" "||ve===" ");for(var Ae=g.substring(H,re).split(l),q=0;q<Ae.length;++q)Ae[q]=Ae[q].replace(y?u:a,"").trim();S=Ae.join(`
26
- `).trim()}function U(H){var re=he(H),oe=g.substring(H,re),ue=/^\s*\/{1,2}/.test(oe);return ue}function he(H){for(var re=H;re<_&&z(re)!==`
27
- `;)re++;return re}function ce(){if(x.length>0)return x.shift();if(F)return ge();var H,re,oe,ue,ve;do{if(w===_)return null;for(H=!1;f.test(oe=z(w));)if(oe===`
23
+ }`}return u.toString=c,u}i.verbose=!1},{}],4:[function(t,n,s){n.exports=i;function i(){this._listeners={}}i.prototype.on=function(o,l,a){return(this._listeners[o]||(this._listeners[o]=[])).push({fn:l,ctx:a||this}),this},i.prototype.off=function(o,l){if(o===e)this._listeners={};else if(l===e)this._listeners[o]=[];else for(var a=this._listeners[o],u=0;u<a.length;)a[u].fn===l?a.splice(u,1):++u;return this},i.prototype.emit=function(o){var l=this._listeners[o];if(l){for(var a=[],u=1;u<arguments.length;)a.push(arguments[u++]);for(u=0;u<l.length;)l[u].fn.apply(l[u++].ctx,a)}return this}},{}],5:[function(t,n,s){n.exports=a;var i=t(1),o=t(7),l=o("fs");function a(u,c,f){return typeof c=="function"?(f=c,c={}):c||(c={}),f?!c.xhr&&l&&l.readFile?l.readFile(u,function(h,d){return h&&typeof XMLHttpRequest<"u"?a.xhr(u,c,f):h?f(h):f(null,c.binary?d:d.toString("utf8"))}):a.xhr(u,c,f):i(a,this,u,c)}a.xhr=function(u,c,f){var h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState!==4)return e;if(h.status!==0&&h.status!==200)return f(Error("status "+h.status));if(c.binary){var d=h.response;if(!d){d=[];for(var p=0;p<h.responseText.length;++p)d.push(h.responseText.charCodeAt(p)&255)}return f(null,typeof Uint8Array<"u"?new Uint8Array(d):d)}return f(null,h.responseText)},c.binary&&("overrideMimeType"in h&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.responseType="arraybuffer"),h.open("GET",u),h.send()}},{1:1,7:7}],6:[function(t,n,s){n.exports=i(i);function i(c){return typeof Float32Array<"u"?(function(){var f=new Float32Array([-0]),h=new Uint8Array(f.buffer),d=h[3]===128;function p(w,_,b){f[0]=w,_[b]=h[0],_[b+1]=h[1],_[b+2]=h[2],_[b+3]=h[3]}function g(w,_,b){f[0]=w,_[b]=h[3],_[b+1]=h[2],_[b+2]=h[1],_[b+3]=h[0]}c.writeFloatLE=d?p:g,c.writeFloatBE=d?g:p;function m(w,_){return h[0]=w[_],h[1]=w[_+1],h[2]=w[_+2],h[3]=w[_+3],f[0]}function y(w,_){return h[3]=w[_],h[2]=w[_+1],h[1]=w[_+2],h[0]=w[_+3],f[0]}c.readFloatLE=d?m:y,c.readFloatBE=d?y:m})():(function(){function f(d,p,g,m){var y=p<0?1:0;if(y&&(p=-p),p===0)d(1/p>0?0:2147483648,g,m);else if(isNaN(p))d(2143289344,g,m);else if(p>34028234663852886e22)d((y<<31|2139095040)>>>0,g,m);else if(p<11754943508222875e-54)d((y<<31|Math.round(p/1401298464324817e-60))>>>0,g,m);else{var w=Math.floor(Math.log(p)/Math.LN2),_=Math.round(p*Math.pow(2,-w)*8388608)&8388607;d((y<<31|w+127<<23|_)>>>0,g,m)}}c.writeFloatLE=f.bind(null,o),c.writeFloatBE=f.bind(null,l);function h(d,p,g){var m=d(p,g),y=(m>>31)*2+1,w=m>>>23&255,_=m&8388607;return w===255?_?NaN:y*(1/0):w===0?y*1401298464324817e-60*_:y*Math.pow(2,w-150)*(_+8388608)}c.readFloatLE=h.bind(null,a),c.readFloatBE=h.bind(null,u)})(),typeof Float64Array<"u"?(function(){var f=new Float64Array([-0]),h=new Uint8Array(f.buffer),d=h[7]===128;function p(w,_,b){f[0]=w,_[b]=h[0],_[b+1]=h[1],_[b+2]=h[2],_[b+3]=h[3],_[b+4]=h[4],_[b+5]=h[5],_[b+6]=h[6],_[b+7]=h[7]}function g(w,_,b){f[0]=w,_[b]=h[7],_[b+1]=h[6],_[b+2]=h[5],_[b+3]=h[4],_[b+4]=h[3],_[b+5]=h[2],_[b+6]=h[1],_[b+7]=h[0]}c.writeDoubleLE=d?p:g,c.writeDoubleBE=d?g:p;function m(w,_){return h[0]=w[_],h[1]=w[_+1],h[2]=w[_+2],h[3]=w[_+3],h[4]=w[_+4],h[5]=w[_+5],h[6]=w[_+6],h[7]=w[_+7],f[0]}function y(w,_){return h[7]=w[_],h[6]=w[_+1],h[5]=w[_+2],h[4]=w[_+3],h[3]=w[_+4],h[2]=w[_+5],h[1]=w[_+6],h[0]=w[_+7],f[0]}c.readDoubleLE=d?m:y,c.readDoubleBE=d?y:m})():(function(){function f(d,p,g,m,y,w){var _=m<0?1:0;if(_&&(m=-m),m===0)d(0,y,w+p),d(1/m>0?0:2147483648,y,w+g);else if(isNaN(m))d(0,y,w+p),d(2146959360,y,w+g);else if(m>17976931348623157e292)d(0,y,w+p),d((_<<31|2146435072)>>>0,y,w+g);else{var b;if(m<22250738585072014e-324)b=m/5e-324,d(b>>>0,y,w+p),d((_<<31|b/4294967296)>>>0,y,w+g);else{var v=Math.floor(Math.log(m)/Math.LN2);v===1024&&(v=1023),b=m*Math.pow(2,-v),d(b*4503599627370496>>>0,y,w+p),d((_<<31|v+1023<<20|b*1048576&1048575)>>>0,y,w+g)}}}c.writeDoubleLE=f.bind(null,o,0,4),c.writeDoubleBE=f.bind(null,l,4,0);function h(d,p,g,m,y){var w=d(m,y+p),_=d(m,y+g),b=(_>>31)*2+1,v=_>>>20&2047,S=4294967296*(_&1048575)+w;return v===2047?S?NaN:b*(1/0):v===0?b*5e-324*S:b*Math.pow(2,v-1075)*(S+4503599627370496)}c.readDoubleLE=h.bind(null,a,0,4),c.readDoubleBE=h.bind(null,u,4,0)})(),c}function o(c,f,h){f[h]=c&255,f[h+1]=c>>>8&255,f[h+2]=c>>>16&255,f[h+3]=c>>>24}function l(c,f,h){f[h]=c>>>24,f[h+1]=c>>>16&255,f[h+2]=c>>>8&255,f[h+3]=c&255}function a(c,f){return(c[f]|c[f+1]<<8|c[f+2]<<16|c[f+3]<<24)>>>0}function u(c,f){return(c[f]<<24|c[f+1]<<16|c[f+2]<<8|c[f+3])>>>0}},{}],7:[function(t,n,s){n.exports=i;function i(o){try{var l=t(o);if(l&&(l.length||Object.keys(l).length))return l}catch{}return null}},{}],8:[function(t,n,s){var i=s,o=i.isAbsolute=function(a){return/^(?:\/|\w+:)/.test(a)},l=i.normalize=function(a){a=a.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var u=a.split("/"),c=o(a),f="";c&&(f=u.shift()+"/");for(var h=0;h<u.length;)u[h]===".."?h>0&&u[h-1]!==".."?u.splice(--h,2):c?u.splice(h,1):++h:u[h]==="."?u.splice(h,1):++h;return f+u.join("/")};i.resolve=function(a,u,c){return c||(u=l(u)),o(u)?u:(c||(a=l(a)),(a=a.replace(/(?:\/|^)[^/]+$/,"")).length?l(a+"/"+u):u)}},{}],9:[function(t,n,s){n.exports=i;function i(o,l,a){var u=a||8192,c=u>>>1,f=null,h=u;return function(d){if(d<1||d>c)return o(d);h+d>u&&(f=o(u),h=0);var p=l.call(f,h,h+=d);return h&7&&(h=(h|7)+1),p}}},{}],10:[function(t,n,s){var i=s;i.length=function(o){for(var l=0,a=0,u=0;u<o.length;++u)a=o.charCodeAt(u),a<128?l+=1:a<2048?l+=2:(a&64512)===55296&&(o.charCodeAt(u+1)&64512)===56320?(++u,l+=4):l+=3;return l},i.read=function(o,l,a){var u=a-l;if(u<1)return"";for(var c=null,f=[],h=0,d;l<a;)d=o[l++],d<128?f[h++]=d:d>191&&d<224?f[h++]=(d&31)<<6|o[l++]&63:d>239&&d<365?(d=((d&7)<<18|(o[l++]&63)<<12|(o[l++]&63)<<6|o[l++]&63)-65536,f[h++]=55296+(d>>10),f[h++]=56320+(d&1023)):f[h++]=(d&15)<<12|(o[l++]&63)<<6|o[l++]&63,h>8191&&((c||(c=[])).push(String.fromCharCode.apply(String,f)),h=0);return c?(h&&c.push(String.fromCharCode.apply(String,f.slice(0,h))),c.join("")):String.fromCharCode.apply(String,f.slice(0,h))},i.write=function(o,l,a){for(var u=a,c,f,h=0;h<o.length;++h)c=o.charCodeAt(h),c<128?l[a++]=c:c<2048?(l[a++]=c>>6|192,l[a++]=c&63|128):(c&64512)===55296&&((f=o.charCodeAt(h+1))&64512)===56320?(c=65536+((c&1023)<<10)+(f&1023),++h,l[a++]=c>>18|240,l[a++]=c>>12&63|128,l[a++]=c>>6&63|128,l[a++]=c&63|128):(l[a++]=c>>12|224,l[a++]=c>>6&63|128,l[a++]=c&63|128);return a-u}},{}],11:[function(t,n,s){n.exports=o;var i=/\/|\./;function o(a,u){i.test(a)||(a="google/protobuf/"+a+".proto",u={nested:{google:{nested:{protobuf:{nested:u}}}}}),o[a]=u}o("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var l;o("duration",{Duration:l={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),o("timestamp",{Timestamp:l}),o("empty",{Empty:{fields:{}}}),o("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),o("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),o("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),o.get=function(a){return o[a]||null}},{}],12:[function(t,n,s){var i=s,o=t(15),l=t(37);function a(c,f,h,d){if(f.resolvedType)if(f.resolvedType instanceof o){c("switch(d%s){",d);for(var p=f.resolvedType.values,g=Object.keys(p),m=0;m<g.length;++m)f.repeated&&p[g[m]]===f.typeDefault&&c("default:"),c("case%j:",g[m])("case %i:",p[g[m]])("m%s=%j",d,p[g[m]])("break");c("}")}else c('if(typeof d%s!=="object")',d)("throw TypeError(%j)",f.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",d,h,d);else{var y=!1;switch(f.type){case"double":case"float":c("m%s=Number(d%s)",d,d);break;case"uint32":case"fixed32":c("m%s=d%s>>>0",d,d);break;case"int32":case"sint32":case"sfixed32":c("m%s=d%s|0",d,d);break;case"uint64":y=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":c("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",d,d,y)('else if(typeof d%s==="string")',d)("m%s=parseInt(d%s,10)",d,d)('else if(typeof d%s==="number")',d)("m%s=d%s",d,d)('else if(typeof d%s==="object")',d)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",d,d,d,y?"true":"");break;case"bytes":c('if(typeof d%s==="string")',d)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",d,d,d)("else if(d%s.length)",d)("m%s=d%s",d,d);break;case"string":c("m%s=String(d%s)",d,d);break;case"bool":c("m%s=Boolean(d%s)",d,d);break}}return c}i.fromObject=function(c){var f=c.fieldsArray,h=l.codegen(["d"],c.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!f.length)return h("return new this.ctor");h("var m=new this.ctor");for(var d=0;d<f.length;++d){var p=f[d].resolve(),g=l.safeProp(p.name);p.map?(h("if(d%s){",g)('if(typeof d%s!=="object")',g)("throw TypeError(%j)",p.fullName+": object expected")("m%s={}",g)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",g),a(h,p,d,g+"[ks[i]]")("}")("}")):p.repeated?(h("if(d%s){",g)("if(!Array.isArray(d%s))",g)("throw TypeError(%j)",p.fullName+": array expected")("m%s=[]",g)("for(var i=0;i<d%s.length;++i){",g),a(h,p,d,g+"[i]")("}")("}")):(p.resolvedType instanceof o||h("if(d%s!=null){",g),a(h,p,d,g),p.resolvedType instanceof o||h("}"))}return h("return m")};function u(c,f,h,d){if(f.resolvedType)f.resolvedType instanceof o?c("d%s=o.enums===String?types[%i].values[m%s]:m%s",d,h,d,d):c("d%s=types[%i].toObject(m%s,o)",d,h,d);else{var p=!1;switch(f.type){case"double":case"float":c("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",d,d,d,d);break;case"uint64":p=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":c('if(typeof m%s==="number")',d)("d%s=o.longs===String?String(m%s):m%s",d,d,d)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",d,d,d,d,p?"true":"",d);break;case"bytes":c("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",d,d,d,d,d);break;default:c("d%s=m%s",d,d);break}}return c}i.toObject=function(c){var f=c.fieldsArray.slice().sort(l.compareFieldsById);if(!f.length)return l.codegen()("return {}");for(var h=l.codegen(["m","o"],c.name+"$toObject")("if(!o)")("o={}")("var d={}"),d=[],p=[],g=[],m=0;m<f.length;++m)f[m].partOf||(f[m].resolve().repeated?d:f[m].map?p:g).push(f[m]);if(d.length){for(h("if(o.arrays||o.defaults){"),m=0;m<d.length;++m)h("d%s=[]",l.safeProp(d[m].name));h("}")}if(p.length){for(h("if(o.objects||o.defaults){"),m=0;m<p.length;++m)h("d%s={}",l.safeProp(p[m].name));h("}")}if(g.length){for(h("if(o.defaults){"),m=0;m<g.length;++m){var y=g[m],w=l.safeProp(y.name);y.resolvedType instanceof o?h("d%s=o.enums===String?%j:%j",w,y.resolvedType.valuesById[y.typeDefault],y.typeDefault):y.long?h("if(util.Long){")("var n=new util.Long(%i,%i,%j)",y.typeDefault.low,y.typeDefault.high,y.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",w)("}else")("d%s=o.longs===String?%j:%i",w,y.typeDefault.toString(),y.typeDefault.toNumber()):y.bytes?h("d%s=o.bytes===String?%j:%s",w,String.fromCharCode.apply(String,y.typeDefault),"["+Array.prototype.slice.call(y.typeDefault).join(",")+"]"):h("d%s=%j",w,y.typeDefault)}h("}")}var _=!1;for(m=0;m<f.length;++m){var y=f[m],b=c._fieldsArray.indexOf(y),w=l.safeProp(y.name);y.map?(_||(_=!0,h("var ks2")),h("if(m%s&&(ks2=Object.keys(m%s)).length){",w,w)("d%s={}",w)("for(var j=0;j<ks2.length;++j){"),u(h,y,b,w+"[ks2[j]]")("}")):y.repeated?(h("if(m%s&&m%s.length){",w,w)("d%s=[]",w)("for(var j=0;j<m%s.length;++j){",w),u(h,y,b,w+"[j]")("}")):(h("if(m%s!=null&&m.hasOwnProperty(%j)){",w,y.name),u(h,y,b,w),y.partOf&&h("if(o.oneofs)")("d%s=%j",l.safeProp(y.partOf.name),y.name)),h("}")}return h("return d")}},{15:15,37:37}],13:[function(t,n,s){n.exports=u;var i=t(15),o=t(36),l=t(37);function a(c){return"missing required '"+c.name+"'"}function u(c){var f=l.codegen(["r","l"],c.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(c.fieldsArray.filter(function(y){return y.map}).length?",k":""))("while(r.pos<c){")("var t=r.uint32()");c.group&&f("if((t&7)===4)")("break"),f("switch(t>>>3){");for(var h=0;h<c.fieldsArray.length;++h){var d=c._fieldsArray[h].resolve(),p=d.resolvedType instanceof i?"int32":d.type,g="m"+l.safeProp(d.name);f("case %i:",d.id),d.map?(f("r.skip().pos++")("if(%s===util.emptyObject)",g)("%s={}",g)("k=r.%s()",d.keyType)("r.pos++"),o.long[d.keyType]!==e?o.basic[p]===e?f('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',g,h):f('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',g,p):o.basic[p]===e?f("%s[k]=types[%i].decode(r,r.uint32())",g,h):f("%s[k]=r.%s()",g,p)):d.repeated?(f("if(!(%s&&%s.length))",g,g)("%s=[]",g),o.packed[p]!==e&&f("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",g,p)("}else"),o.basic[p]===e?f(d.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",g,h):f("%s.push(r.%s())",g,p)):o.basic[p]===e?f(d.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",g,h):f("%s=r.%s()",g,p),f("break")}for(f("default:")("r.skipType(t&7)")("break")("}")("}"),h=0;h<c._fieldsArray.length;++h){var m=c._fieldsArray[h];m.required&&f("if(!m.hasOwnProperty(%j))",m.name)("throw util.ProtocolError(%j,{instance:m})",a(m))}return f("return m")}},{15:15,36:36,37:37}],14:[function(t,n,s){n.exports=u;var i=t(15),o=t(36),l=t(37);function a(c,f,h,d){return f.resolvedType.group?c("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",h,d,(f.id<<3|3)>>>0,(f.id<<3|4)>>>0):c("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",h,d,(f.id<<3|2)>>>0)}function u(c){for(var f=l.codegen(["m","w"],c.name+"$encode")("if(!w)")("w=Writer.create()"),p,h,d=c.fieldsArray.slice().sort(l.compareFieldsById),p=0;p<d.length;++p){var g=d[p].resolve(),m=c._fieldsArray.indexOf(g),y=g.resolvedType instanceof i?"int32":g.type,w=o.basic[y];h="m"+l.safeProp(g.name),g.map?(f("if(%s!=null&&m.hasOwnProperty(%j)){",h,g.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",h)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(g.id<<3|2)>>>0,8|o.mapKey[g.keyType],g.keyType),w===e?f("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",m,h):f(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|w,y,h),f("}")("}")):g.repeated?(f("if(%s!=null&&%s.length){",h,h),g.packed&&o.packed[y]!==e?f("w.uint32(%i).fork()",(g.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",h)("w.%s(%s[i])",y,h)("w.ldelim()"):(f("for(var i=0;i<%s.length;++i)",h),w===e?a(f,g,m,h+"[i]"):f("w.uint32(%i).%s(%s[i])",(g.id<<3|w)>>>0,y,h)),f("}")):(g.optional&&f("if(%s!=null&&m.hasOwnProperty(%j))",h,g.name),w===e?a(f,g,m,h):f("w.uint32(%i).%s(%s)",(g.id<<3|w)>>>0,y,h))}return f("return w")}},{15:15,36:36,37:37}],15:[function(t,n,s){n.exports=a;var i=t(24);((a.prototype=Object.create(i.prototype)).constructor=a).className="Enum";var o=t(23),l=t(37);function a(u,c,f,h,d){if(i.call(this,u,f),c&&typeof c!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=h,this.comments=d||{},this.reserved=e,c)for(var p=Object.keys(c),g=0;g<p.length;++g)typeof c[p[g]]=="number"&&(this.valuesById[this.values[p[g]]=c[p[g]]]=p[g])}a.fromJSON=function(u,c){var f=new a(u,c.values,c.options,c.comment,c.comments);return f.reserved=c.reserved,f},a.prototype.toJSON=function(u){var c=u?!!u.keepComments:!1;return l.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:e,"comment",c?this.comment:e,"comments",c?this.comments:e])},a.prototype.add=function(u,c,f){if(!l.isString(u))throw TypeError("name must be a string");if(!l.isInteger(c))throw TypeError("id must be an integer");if(this.values[u]!==e)throw Error("duplicate name '"+u+"' in "+this);if(this.isReservedId(c))throw Error("id "+c+" is reserved in "+this);if(this.isReservedName(u))throw Error("name '"+u+"' is reserved in "+this);if(this.valuesById[c]!==e){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+c+" in "+this);this.values[u]=c}else this.valuesById[this.values[u]=c]=u;return this.comments[u]=f||null,this},a.prototype.remove=function(u){if(!l.isString(u))throw TypeError("name must be a string");var c=this.values[u];if(c==null)throw Error("name '"+u+"' does not exist in "+this);return delete this.valuesById[c],delete this.values[u],delete this.comments[u],this},a.prototype.isReservedId=function(u){return o.isReservedId(this.reserved,u)},a.prototype.isReservedName=function(u){return o.isReservedName(this.reserved,u)}},{23:23,24:24,37:37}],16:[function(t,n,s){n.exports=f;var i=t(24);((f.prototype=Object.create(i.prototype)).constructor=f).className="Field";var o=t(15),l=t(36),a=t(37),u,c=/^required|optional|repeated$/;f.fromJSON=function(h,d){return new f(h,d.id,d.type,d.rule,d.extend,d.options,d.comment)};function f(h,d,p,g,m,y,w){if(a.isObject(g)?(w=m,y=g,g=m=e):a.isObject(m)&&(w=y,y=m,m=e),i.call(this,h,y),!a.isInteger(d)||d<0)throw TypeError("id must be a non-negative integer");if(!a.isString(p))throw TypeError("type must be a string");if(g!==e&&!c.test(g=g.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(m!==e&&!a.isString(m))throw TypeError("extend must be a string");this.rule=g&&g!=="optional"?g:e,this.type=p,this.id=d,this.extend=m||e,this.required=g==="required",this.optional=!this.required,this.repeated=g==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=a.Long?l.long[p]!==e:!1,this.bytes=p==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=w}Object.defineProperty(f.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}}),f.prototype.setOption=function(h,d,p){return h==="packed"&&(this._packed=null),i.prototype.setOption.call(this,h,d,p)},f.prototype.toJSON=function(h){var d=h?!!h.keepComments:!1;return a.toObject(["rule",this.rule!=="optional"&&this.rule||e,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",d?this.comment:e])},f.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=l.defaults[this.type])===e&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof u?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof o&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==e&&this.resolvedType&&!(this.resolvedType instanceof o))&&delete this.options.packed,Object.keys(this.options).length||(this.options=e)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var h;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,h=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,h=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=h}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof u&&(this.parent.ctor.prototype[this.name]=this.defaultValue),i.prototype.resolve.call(this)},f.d=function(h,d,p,g){return typeof d=="function"?d=a.decorateType(d).name:d&&typeof d=="object"&&(d=a.decorateEnum(d).name),function(m,y){a.decorateType(m.constructor).add(new f(y,h,d,p,{default:g}))}},f._configure=function(h){u=h}},{15:15,24:24,36:36,37:37}],17:[function(t,n,s){var i=n.exports=t(18);i.build="light";function o(a,u,c){return typeof u=="function"?(c=u,u=new i.Root):u||(u=new i.Root),u.load(a,c)}i.load=o;function l(a,u){return u||(u=new i.Root),u.loadSync(a)}i.loadSync=l,i.encoder=t(14),i.decoder=t(13),i.verifier=t(40),i.converter=t(12),i.ReflectionObject=t(24),i.Namespace=t(23),i.Root=t(29),i.Enum=t(15),i.Type=t(35),i.Field=t(16),i.OneOf=t(25),i.MapField=t(20),i.Service=t(33),i.Method=t(22),i.Message=t(21),i.wrappers=t(41),i.types=t(36),i.util=t(37),i.ReflectionObject._configure(i.Root),i.Namespace._configure(i.Type,i.Service),i.Root._configure(i.Type),i.Field._configure(i.Type)},{12:12,13:13,14:14,15:15,16:16,18:18,20:20,21:21,22:22,23:23,24:24,25:25,29:29,33:33,35:35,36:36,37:37,40:40,41:41}],18:[function(t,n,s){var i=s;i.build="minimal",i.Writer=t(42),i.BufferWriter=t(43),i.Reader=t(27),i.BufferReader=t(28),i.util=t(39),i.rpc=t(31),i.roots=t(30),i.configure=o;function o(){i.Reader._configure(i.BufferReader),i.util._configure()}i.Writer._configure(i.BufferWriter),o()},{27:27,28:28,30:30,31:31,39:39,42:42,43:43}],19:[function(t,n,s){var i=n.exports=t(17);i.build="full",i.tokenize=t(34),i.parse=t(26),i.common=t(11),i.Root._configure(i.Type,i.parse,i.common)},{11:11,17:17,26:26,34:34}],20:[function(t,n,s){n.exports=a;var i=t(16);((a.prototype=Object.create(i.prototype)).constructor=a).className="MapField";var o=t(36),l=t(37);function a(u,c,f,h,d,p){if(i.call(this,u,c,h,e,e,d,p),!l.isString(f))throw TypeError("keyType must be a string");this.keyType=f,this.resolvedKeyType=null,this.map=!0}a.fromJSON=function(u,c){return new a(u,c.id,c.keyType,c.type,c.options,c.comment)},a.prototype.toJSON=function(u){var c=u?!!u.keepComments:!1;return l.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",c?this.comment:e])},a.prototype.resolve=function(){if(this.resolved)return this;if(o.mapKey[this.keyType]===e)throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},a.d=function(u,c,f){return typeof f=="function"?f=l.decorateType(f).name:f&&typeof f=="object"&&(f=l.decorateEnum(f).name),function(h,d){l.decorateType(h.constructor).add(new a(d,u,c,f))}}},{16:16,36:36,37:37}],21:[function(t,n,s){n.exports=o;var i=t(39);function o(l){if(l)for(var a=Object.keys(l),u=0;u<a.length;++u)this[a[u]]=l[a[u]]}o.create=function(l){return this.$type.create(l)},o.encode=function(l,a){return this.$type.encode(l,a)},o.encodeDelimited=function(l,a){return this.$type.encodeDelimited(l,a)},o.decode=function(l){return this.$type.decode(l)},o.decodeDelimited=function(l){return this.$type.decodeDelimited(l)},o.verify=function(l){return this.$type.verify(l)},o.fromObject=function(l){return this.$type.fromObject(l)},o.toObject=function(l,a){return this.$type.toObject(l,a)},o.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},{39:39}],22:[function(t,n,s){n.exports=l;var i=t(24);((l.prototype=Object.create(i.prototype)).constructor=l).className="Method";var o=t(37);function l(a,u,c,f,h,d,p,g){if(o.isObject(h)?(p=h,h=d=e):o.isObject(d)&&(p=d,d=e),!(u===e||o.isString(u)))throw TypeError("type must be a string");if(!o.isString(c))throw TypeError("requestType must be a string");if(!o.isString(f))throw TypeError("responseType must be a string");i.call(this,a,p),this.type=u||"rpc",this.requestType=c,this.requestStream=h?!0:e,this.responseType=f,this.responseStream=d?!0:e,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=g}l.fromJSON=function(a,u){return new l(a,u.type,u.requestType,u.responseType,u.requestStream,u.responseStream,u.options,u.comment)},l.prototype.toJSON=function(a){var u=a?!!a.keepComments:!1;return o.toObject(["type",this.type!=="rpc"&&this.type||e,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",u?this.comment:e])},l.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),i.prototype.resolve.call(this))}},{24:24,37:37}],23:[function(t,n,s){n.exports=h;var i=t(24);((h.prototype=Object.create(i.prototype)).constructor=h).className="Namespace";var o=t(15),l=t(16),a=t(37),u,c;h.fromJSON=function(p,g){return new h(p,g.options).addJSON(g.nested)};function f(p,g){if(!(p&&p.length))return e;for(var m={},y=0;y<p.length;++y)m[p[y].name]=p[y].toJSON(g);return m}h.arrayToJSON=f,h.isReservedId=function(p,g){if(p){for(var m=0;m<p.length;++m)if(typeof p[m]!="string"&&p[m][0]<=g&&p[m][1]>=g)return!0}return!1},h.isReservedName=function(p,g){if(p){for(var m=0;m<p.length;++m)if(p[m]===g)return!0}return!1};function h(p,g){i.call(this,p,g),this.nested=e,this._nestedArray=null}function d(p){return p._nestedArray=null,p}Object.defineProperty(h.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=a.toArray(this.nested))}}),h.prototype.toJSON=function(p){return a.toObject(["options",this.options,"nested",f(this.nestedArray,p)])},h.prototype.addJSON=function(p){var g=this;if(p)for(var m=Object.keys(p),y=0,w;y<m.length;++y)w=p[m[y]],g.add((w.fields!==e?u.fromJSON:w.values!==e?o.fromJSON:w.methods!==e?c.fromJSON:w.id!==e?l.fromJSON:h.fromJSON)(m[y],w));return this},h.prototype.get=function(p){return this.nested&&this.nested[p]||null},h.prototype.getEnum=function(p){if(this.nested&&this.nested[p]instanceof o)return this.nested[p].values;throw Error("no such enum: "+p)},h.prototype.add=function(p){if(!(p instanceof l&&p.extend!==e||p instanceof u||p instanceof o||p instanceof c||p instanceof h))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var g=this.get(p.name);if(g)if(g instanceof h&&p instanceof h&&!(g instanceof u||g instanceof c)){for(var m=g.nestedArray,y=0;y<m.length;++y)p.add(m[y]);this.remove(g),this.nested||(this.nested={}),p.setOptions(g.options,!0)}else throw Error("duplicate name '"+p.name+"' in "+this)}return this.nested[p.name]=p,p.onAdd(this),d(this)},h.prototype.remove=function(p){if(!(p instanceof i))throw TypeError("object must be a ReflectionObject");if(p.parent!==this)throw Error(p+" is not a member of "+this);return delete this.nested[p.name],Object.keys(this.nested).length||(this.nested=e),p.onRemove(this),d(this)},h.prototype.define=function(p,g){if(a.isString(p))p=p.split(".");else if(!Array.isArray(p))throw TypeError("illegal path");if(p&&p.length&&p[0]==="")throw Error("path must be relative");for(var m=this;p.length>0;){var y=p.shift();if(m.nested&&m.nested[y]){if(m=m.nested[y],!(m instanceof h))throw Error("path conflicts with non-namespace objects")}else m.add(m=new h(y))}return g&&m.addJSON(g),m},h.prototype.resolveAll=function(){for(var p=this.nestedArray,g=0;g<p.length;)p[g]instanceof h?p[g++].resolveAll():p[g++].resolve();return this.resolve()},h.prototype.lookup=function(p,g,m){if(typeof g=="boolean"?(m=g,g=e):g&&!Array.isArray(g)&&(g=[g]),a.isString(p)&&p.length){if(p===".")return this.root;p=p.split(".")}else if(!p.length)return this;if(p[0]==="")return this.root.lookup(p.slice(1),g);var y=this.get(p[0]);if(y){if(p.length===1){if(!g||g.indexOf(y.constructor)>-1)return y}else if(y instanceof h&&(y=y.lookup(p.slice(1),g,!0)))return y}else for(var w=0;w<this.nestedArray.length;++w)if(this._nestedArray[w]instanceof h&&(y=this._nestedArray[w].lookup(p,g,!0)))return y;return this.parent===null||m?null:this.parent.lookup(p,g)},h.prototype.lookupType=function(p){var g=this.lookup(p,[u]);if(!g)throw Error("no such type: "+p);return g},h.prototype.lookupEnum=function(p){var g=this.lookup(p,[o]);if(!g)throw Error("no such Enum '"+p+"' in "+this);return g},h.prototype.lookupTypeOrEnum=function(p){var g=this.lookup(p,[u,o]);if(!g)throw Error("no such Type or Enum '"+p+"' in "+this);return g},h.prototype.lookupService=function(p){var g=this.lookup(p,[c]);if(!g)throw Error("no such Service '"+p+"' in "+this);return g},h._configure=function(p,g){u=p,c=g}},{15:15,16:16,24:24,37:37}],24:[function(t,n,s){n.exports=l,l.className="ReflectionObject";var i=t(37),o;function l(a,u){if(!i.isString(a))throw TypeError("name must be a string");if(u&&!i.isObject(u))throw TypeError("options must be an object");this.options=u,this.name=a,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(l.prototype,{root:{get:function(){for(var a=this;a.parent!==null;)a=a.parent;return a}},fullName:{get:function(){for(var a=[this.name],u=this.parent;u;)a.unshift(u.name),u=u.parent;return a.join(".")}}}),l.prototype.toJSON=function(){throw Error()},l.prototype.onAdd=function(a){this.parent&&this.parent!==a&&this.parent.remove(this),this.parent=a,this.resolved=!1;var u=a.root;u instanceof o&&u._handleAdd(this)},l.prototype.onRemove=function(a){var u=a.root;u instanceof o&&u._handleRemove(this),this.parent=null,this.resolved=!1},l.prototype.resolve=function(){return this.resolved?this:(this.root instanceof o&&(this.resolved=!0),this)},l.prototype.getOption=function(a){return this.options?this.options[a]:e},l.prototype.setOption=function(a,u,c){return(!c||!this.options||this.options[a]===e)&&((this.options||(this.options={}))[a]=u),this},l.prototype.setOptions=function(a,u){if(a)for(var c=Object.keys(a),f=0;f<c.length;++f)this.setOption(c[f],a[c[f]],u);return this},l.prototype.toString=function(){var a=this.constructor.className,u=this.fullName;return u.length?a+" "+u:a},l._configure=function(a){o=a}},{37:37}],25:[function(t,n,s){n.exports=a;var i=t(24);((a.prototype=Object.create(i.prototype)).constructor=a).className="OneOf";var o=t(16),l=t(37);function a(c,f,h,d){if(Array.isArray(f)||(h=f,f=e),i.call(this,c,h),!(f===e||Array.isArray(f)))throw TypeError("fieldNames must be an Array");this.oneof=f||[],this.fieldsArray=[],this.comment=d}a.fromJSON=function(c,f){return new a(c,f.oneof,f.options,f.comment)},a.prototype.toJSON=function(c){var f=c?!!c.keepComments:!1;return l.toObject(["options",this.options,"oneof",this.oneof,"comment",f?this.comment:e])};function u(c){if(c.parent)for(var f=0;f<c.fieldsArray.length;++f)c.fieldsArray[f].parent||c.parent.add(c.fieldsArray[f])}a.prototype.add=function(c){if(!(c instanceof o))throw TypeError("field must be a Field");return c.parent&&c.parent!==this.parent&&c.parent.remove(c),this.oneof.push(c.name),this.fieldsArray.push(c),c.partOf=this,u(this),this},a.prototype.remove=function(c){if(!(c instanceof o))throw TypeError("field must be a Field");var f=this.fieldsArray.indexOf(c);if(f<0)throw Error(c+" is not a member of "+this);return this.fieldsArray.splice(f,1),f=this.oneof.indexOf(c.name),f>-1&&this.oneof.splice(f,1),c.partOf=null,this},a.prototype.onAdd=function(c){i.prototype.onAdd.call(this,c);for(var f=this,h=0;h<this.oneof.length;++h){var d=c.get(this.oneof[h]);d&&!d.partOf&&(d.partOf=f,f.fieldsArray.push(d))}u(this)},a.prototype.onRemove=function(c){for(var f=0,h;f<this.fieldsArray.length;++f)(h=this.fieldsArray[f]).parent&&h.parent.remove(h);i.prototype.onRemove.call(this,c)},a.d=function(){for(var c=new Array(arguments.length),f=0;f<arguments.length;)c[f]=arguments[f++];return function(h,d){l.decorateType(h.constructor).add(new a(d,c)),Object.defineProperty(h,d,{get:l.oneOfGetter(c),set:l.oneOfSetter(c)})}}},{16:16,24:24,37:37}],26:[function(t,n,s){n.exports=F,F.filename=null,F.defaults={keepCase:!1};var i=t(34),o=t(29),l=t(35),a=t(16),u=t(20),c=t(25),f=t(15),h=t(33),d=t(22),p=t(36),g=t(37),m=/^[1-9][0-9]*$/,y=/^-?[1-9][0-9]*$/,w=/^0[x][0-9a-fA-F]+$/,_=/^-?0[x][0-9a-fA-F]+$/,b=/^0[0-7]+$/,v=/^-?0[0-7]+$/,S=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,E=/^[a-zA-Z_][a-zA-Z_0-9]*$/,L=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,x=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function F(J,me,z){me instanceof o||(z=me,me=new o),z||(z=F.defaults);var Q=i(J,z.alternateCommentMode||!1),U=Q.next,he=Q.push,le=Q.peek,j=Q.skip,ct=Q.cmnt,kt=!0,ut,H,re,oe,ue=!1,ve=me,Ae=z.keepCase?function(A){return A}:g.camelCase;function q(A,O,D){var M=F.filename;return D||(F.filename=null),Error("illegal "+(O||"token")+" '"+A+"' ("+(M?M+", ":"")+"line "+Q.line+")")}function rt(){var A=[],O;do{if((O=U())!=='"'&&O!=="'")throw q(O);A.push(U()),j(O),O=le()}while(O==='"'||O==="'");return A.join("")}function sa(A){var O=U();switch(O){case"'":case'"':return he(O),rt();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return rf(O,!0)}catch{if(L.test(O))return O;throw q(O,"value")}}function Hn(A,O){var D,M;do O&&((D=le())==='"'||D==="'")?A.push(rt()):A.push([M=Bt(U()),j("to",!0)?Bt(U()):M]);while(j(",",!0));j(";")}function rf(A,O){var D=1;switch(A.charAt(0)==="-"&&(D=-1,A=A.substring(1)),A){case"inf":case"INF":case"Inf":return D*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(m.test(A))return D*parseInt(A,10);if(w.test(A))return D*parseInt(A,16);if(b.test(A))return D*parseInt(A,8);if(S.test(A))return D*parseFloat(A);throw q(A,"number",O)}function Bt(A,O){switch(A){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!O&&A.charAt(0)==="-")throw q(A,"id");if(y.test(A))return parseInt(A,10);if(_.test(A))return parseInt(A,16);if(v.test(A))return parseInt(A,8);throw q(A,"id")}function nf(){if(ut!==e)throw q("package");if(ut=U(),!L.test(ut))throw q(ut,"name");ve=ve.define(ut),j(";")}function sf(){var A=le(),O;switch(A){case"weak":O=re||(re=[]),U();break;case"public":U();default:O=H||(H=[]);break}A=rt(),j(";"),O.push(A)}function of(){if(j("="),oe=rt(),ue=oe==="proto3",!ue&&oe!=="proto2")throw q(oe,"syntax");j(";")}function Jn(A,O){switch(O){case"option":return Ge(A,O),j(";"),!0;case"message":return af(A,O),!0;case"enum":return hf(A,O),!0;case"service":return df(A,O),!0;case"extend":return gf(A,O),!0}return!1}function Ze(A,O,D){var M=Q.line;if(A&&(A.comment=ct(),A.filename=F.filename),j("{",!0)){for(var ae;(ae=U())!=="}";)O(ae);j(";",!0)}else D&&D(),j(";"),A&&typeof A.comment!="string"&&(A.comment=ct(M))}function af(A,O){if(!E.test(O=U()))throw q(O,"type name");var D=new l(O);Ze(D,function(M){if(!Jn(D,M))switch(M){case"map":cf(D);break;case"required":case"optional":case"repeated":Ut(D,M);break;case"oneof":uf(D,M);break;case"extensions":Hn(D.extensions||(D.extensions=[]));break;case"reserved":Hn(D.reserved||(D.reserved=[]),!0);break;default:if(!ue||!L.test(M))throw q(M);he(M),Ut(D,"optional");break}}),A.add(D)}function Ut(A,O,D){var M=U();if(M==="group"){lf(A,O);return}if(!L.test(M))throw q(M,"type");var ae=U();if(!E.test(ae))throw q(ae,"name");ae=Ae(ae),j("=");var fe=new a(ae,Bt(U()),M,O,D);Ze(fe,function(nt){if(nt==="option")Ge(fe,nt),j(";");else throw q(nt)},function(){Gn(fe)}),A.add(fe),!ue&&fe.repeated&&(p.packed[M]!==e||p.basic[M]===e)&&fe.setOption("packed",!1,!0)}function lf(A,O){var D=U();if(!E.test(D))throw q(D,"name");var M=g.lcFirst(D);D===M&&(D=g.ucFirst(D)),j("=");var ae=Bt(U()),fe=new l(D);fe.group=!0;var nt=new a(M,ae,D,O);nt.filename=F.filename,Ze(fe,function(vt){switch(vt){case"option":Ge(fe,vt),j(";");break;case"required":case"optional":case"repeated":Ut(fe,vt);break;default:throw q(vt)}}),A.add(fe).add(nt)}function cf(A){j("<");var O=U();if(p.mapKey[O]===e)throw q(O,"type");j(",");var D=U();if(!L.test(D))throw q(D,"type");j(">");var M=U();if(!E.test(M))throw q(M,"name");j("=");var ae=new u(Ae(M),Bt(U()),O,D);Ze(ae,function(fe){if(fe==="option")Ge(ae,fe),j(";");else throw q(fe)},function(){Gn(ae)}),A.add(ae)}function uf(A,O){if(!E.test(O=U()))throw q(O,"name");var D=new c(Ae(O));Ze(D,function(M){M==="option"?(Ge(D,M),j(";")):(he(M),Ut(D,"optional"))}),A.add(D)}function hf(A,O){if(!E.test(O=U()))throw q(O,"name");var D=new f(O);Ze(D,function(M){switch(M){case"option":Ge(D,M),j(";");break;case"reserved":Hn(D.reserved||(D.reserved=[]),!0);break;default:ff(D,M)}}),A.add(D)}function ff(A,O){if(!E.test(O))throw q(O,"name");j("=");var D=Bt(U(),!0),M={};Ze(M,function(ae){if(ae==="option")Ge(M,ae),j(";");else throw q(ae)},function(){Gn(M)}),A.add(O,D,M.comment)}function Ge(A,O){var D=j("(",!0);if(!L.test(O=U()))throw q(O,"name");var M=O;D&&(j(")"),M="("+M+")",O=le(),x.test(O)&&(M+=O,U())),j("="),Zn(A,M)}function Zn(A,O){if(j("{",!0))do{if(!E.test(Ie=U()))throw q(Ie,"name");le()==="{"?Zn(A,O+"."+Ie):(j(":"),le()==="{"?Zn(A,O+"."+Ie):ia(A,O+"."+Ie,sa()))}while(!j("}",!0));else ia(A,O,sa())}function ia(A,O,D){A.setOption&&A.setOption(O,D)}function Gn(A){if(j("[",!0)){do Ge(A,"option");while(j(",",!0));j("]")}return A}function df(A,O){if(!E.test(O=U()))throw q(O,"service name");var D=new h(O);Ze(D,function(M){if(!Jn(D,M))if(M==="rpc")pf(D,M);else throw q(M)}),A.add(D)}function pf(A,O){var D=O;if(!E.test(O=U()))throw q(O,"name");var M=O,ae,fe,nt,vt;if(j("("),j("stream",!0)&&(fe=!0),!L.test(O=U())||(ae=O,j(")"),j("returns"),j("("),j("stream",!0)&&(vt=!0),!L.test(O=U())))throw q(O);nt=O,j(")");var Yn=new d(M,D,ae,nt,fe,vt);Ze(Yn,function(Kn){if(Kn==="option")Ge(Yn,Kn),j(";");else throw q(Kn)}),A.add(Yn)}function gf(A,O){if(!L.test(O=U()))throw q(O,"reference");var D=O;Ze(null,function(M){switch(M){case"required":case"repeated":case"optional":Ut(A,M,D);break;default:if(!ue||!L.test(M))throw q(M);he(M),Ut(A,"optional",D);break}})}for(var Ie;(Ie=U())!==null;)switch(Ie){case"package":if(!kt)throw q(Ie);nf();break;case"import":if(!kt)throw q(Ie);sf();break;case"syntax":if(!kt)throw q(Ie);of();break;case"option":if(!kt)throw q(Ie);Ge(ve,Ie),j(";");break;default:if(Jn(ve,Ie)){kt=!1;continue}throw q(Ie)}return F.filename=null,{package:ut,imports:H,weakImports:re,syntax:oe,root:me}}},{15:15,16:16,20:20,22:22,25:25,29:29,33:33,34:34,35:35,36:36,37:37}],27:[function(t,n,s){n.exports=c;var i=t(39),o,l=i.LongBits,a=i.utf8;function u(g,m){return RangeError("index out of range: "+g.pos+" + "+(m||1)+" > "+g.len)}function c(g){this.buf=g,this.pos=0,this.len=g.length}var f=typeof Uint8Array<"u"?function(g){if(g instanceof Uint8Array||Array.isArray(g))return new c(g);throw Error("illegal buffer")}:function(g){if(Array.isArray(g))return new c(g);throw Error("illegal buffer")};c.create=i.Buffer?function(g){return(c.create=function(m){return i.Buffer.isBuffer(m)?new o(m):f(m)})(g)}:f,c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=(function(){var g=4294967295;return function(){if(g=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(g=(g|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(g=(g|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(g=(g|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(g=(g|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return g;if((this.pos+=5)>this.len)throw this.pos=this.len,u(this,10);return g}})(),c.prototype.int32=function(){return this.uint32()|0},c.prototype.sint32=function(){var g=this.uint32();return g>>>1^-(g&1)|0};function h(){var g=new l(0,0),m=0;if(this.len-this.pos>4){for(;m<4;++m)if(g.lo=(g.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return g;if(g.lo=(g.lo|(this.buf[this.pos]&127)<<28)>>>0,g.hi=(g.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return g;m=0}else{for(;m<3;++m){if(this.pos>=this.len)throw u(this);if(g.lo=(g.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return g}return g.lo=(g.lo|(this.buf[this.pos++]&127)<<m*7)>>>0,g}if(this.len-this.pos>4){for(;m<5;++m)if(g.hi=(g.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return g}else for(;m<5;++m){if(this.pos>=this.len)throw u(this);if(g.hi=(g.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return g}throw Error("invalid varint encoding")}c.prototype.bool=function(){return this.uint32()!==0};function d(g,m){return(g[m-4]|g[m-3]<<8|g[m-2]<<16|g[m-1]<<24)>>>0}c.prototype.fixed32=function(){if(this.pos+4>this.len)throw u(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw u(this,4);return d(this.buf,this.pos+=4)|0};function p(){if(this.pos+8>this.len)throw u(this,8);return new l(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.prototype.float=function(){if(this.pos+4>this.len)throw u(this,4);var g=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,g},c.prototype.double=function(){if(this.pos+8>this.len)throw u(this,4);var g=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,g},c.prototype.bytes=function(){var g=this.uint32(),m=this.pos,y=this.pos+g;if(y>this.len)throw u(this,g);return this.pos+=g,Array.isArray(this.buf)?this.buf.slice(m,y):m===y?new this.buf.constructor(0):this._slice.call(this.buf,m,y)},c.prototype.string=function(){var g=this.bytes();return a.read(g,0,g.length)},c.prototype.skip=function(g){if(typeof g=="number"){if(this.pos+g>this.len)throw u(this,g);this.pos+=g}else do if(this.pos>=this.len)throw u(this);while(this.buf[this.pos++]&128);return this},c.prototype.skipType=function(g){switch(g){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:do{if((g=this.uint32()&7)===4)break;this.skipType(g)}while(!0);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+g+" at offset "+this.pos)}return this},c._configure=function(g){o=g;var m=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[m](!1)},uint64:function(){return h.call(this)[m](!0)},sint64:function(){return h.call(this).zzDecode()[m](!1)},fixed64:function(){return p.call(this)[m](!0)},sfixed64:function(){return p.call(this)[m](!1)}})}},{39:39}],28:[function(t,n,s){n.exports=l;var i=t(27);(l.prototype=Object.create(i.prototype)).constructor=l;var o=t(39);function l(a){i.call(this,a)}o.Buffer&&(l.prototype._slice=o.Buffer.prototype.slice),l.prototype.string=function(){var a=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+a,this.len))}},{27:27,39:39}],29:[function(t,n,s){n.exports=d;var i=t(23);((d.prototype=Object.create(i.prototype)).constructor=d).className="Root";var o=t(16),l=t(15),a=t(25),u=t(37),c,f,h;function d(y){i.call(this,"",y),this.deferred=[],this.files=[]}d.fromJSON=function(y,w){return w||(w=new d),y.options&&w.setOptions(y.options),w.addJSON(y.nested)},d.prototype.resolvePath=u.path.resolve;function p(){}d.prototype.load=function y(w,_,b){typeof _=="function"&&(b=_,_=e);var v=this;if(!b)return u.asPromise(y,v,w,_);var S=b===p;function E(z,Q){if(b){var U=b;if(b=null,S)throw z;U(z,Q)}}function L(z,Q){try{if(u.isString(Q)&&Q.charAt(0)==="{"&&(Q=JSON.parse(Q)),!u.isString(Q))v.setOptions(Q.options).addJSON(Q.nested);else{f.filename=z;var U=f(Q,v,_),he,le=0;if(U.imports)for(;le<U.imports.length;++le)(he=v.resolvePath(z,U.imports[le]))&&x(he);if(U.weakImports)for(le=0;le<U.weakImports.length;++le)(he=v.resolvePath(z,U.weakImports[le]))&&x(he,!0)}}catch(j){E(j)}!S&&!F&&E(null,v)}function x(z,Q){var U=z.lastIndexOf("google/protobuf/");if(U>-1){var he=z.substring(U);he in h&&(z=he)}if(!(v.files.indexOf(z)>-1)){if(v.files.push(z),z in h){S?L(z,h[z]):(++F,setTimeout(function(){--F,L(z,h[z])}));return}if(S){var le;try{le=u.fs.readFileSync(z).toString("utf8")}catch(j){Q||E(j);return}L(z,le)}else++F,u.fetch(z,function(j,ct){if(--F,!!b){if(j){Q?F||E(null,v):E(j);return}L(z,ct)}})}}var F=0;u.isString(w)&&(w=[w]);for(var J=0,me;J<w.length;++J)(me=v.resolvePath("",w[J]))&&x(me);return S?v:(F||E(null,v),e)},d.prototype.loadSync=function(y,w){if(!u.isNode)throw Error("not supported");return this.load(y,w,p)},d.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(y){return"'extend "+y.extend+"' in "+y.parent.fullName}).join(", "));return i.prototype.resolveAll.call(this)};var g=/^[A-Z]/;function m(y,w){var _=w.parent.lookup(w.extend);if(_){var b=new o(w.fullName,w.id,w.type,w.rule,e,w.options);return b.declaringField=w,w.extensionField=b,_.add(b),!0}return!1}d.prototype._handleAdd=function(y){if(y instanceof o)y.extend!==e&&!y.extensionField&&(m(this,y)||this.deferred.push(y));else if(y instanceof l)g.test(y.name)&&(y.parent[y.name]=y.values);else if(!(y instanceof a)){if(y instanceof c)for(var w=0;w<this.deferred.length;)m(this,this.deferred[w])?this.deferred.splice(w,1):++w;for(var _=0;_<y.nestedArray.length;++_)this._handleAdd(y._nestedArray[_]);g.test(y.name)&&(y.parent[y.name]=y)}},d.prototype._handleRemove=function(y){if(y instanceof o){if(y.extend!==e)if(y.extensionField)y.extensionField.parent.remove(y.extensionField),y.extensionField=null;else{var w=this.deferred.indexOf(y);w>-1&&this.deferred.splice(w,1)}}else if(y instanceof l)g.test(y.name)&&delete y.parent[y.name];else if(y instanceof i){for(var _=0;_<y.nestedArray.length;++_)this._handleRemove(y._nestedArray[_]);g.test(y.name)&&delete y.parent[y.name]}},d._configure=function(y,w,_){c=y,f=w,h=_}},{15:15,16:16,23:23,25:25,37:37}],30:[function(t,n,s){n.exports={}},{}],31:[function(t,n,s){var i=s;i.Service=t(32)},{32:32}],32:[function(t,n,s){n.exports=o;var i=t(39);(o.prototype=Object.create(i.EventEmitter.prototype)).constructor=o;function o(l,a,u){if(typeof l!="function")throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=l,this.requestDelimited=!!a,this.responseDelimited=!!u}o.prototype.rpcCall=function l(a,u,c,f,h){if(!f)throw TypeError("request must be specified");var d=this;if(!h)return i.asPromise(l,d,a,u,c,f);if(!d.rpcImpl)return setTimeout(function(){h(Error("already ended"))},0),e;try{return d.rpcImpl(a,u[d.requestDelimited?"encodeDelimited":"encode"](f).finish(),function(p,g){if(p)return d.emit("error",p,a),h(p);if(g===null)return d.end(!0),e;if(!(g instanceof c))try{g=c[d.responseDelimited?"decodeDelimited":"decode"](g)}catch(m){return d.emit("error",m,a),h(m)}return d.emit("data",g,a),h(null,g)})}catch(p){return d.emit("error",p,a),setTimeout(function(){h(p)},0),e}},o.prototype.end=function(l){return this.rpcImpl&&(l||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{39:39}],33:[function(t,n,s){n.exports=u;var i=t(23);((u.prototype=Object.create(i.prototype)).constructor=u).className="Service";var o=t(22),l=t(37),a=t(31);function u(f,h){i.call(this,f,h),this.methods={},this._methodsArray=null}u.fromJSON=function(f,h){var d=new u(f,h.options);if(h.methods)for(var p=Object.keys(h.methods),g=0;g<p.length;++g)d.add(o.fromJSON(p[g],h.methods[p[g]]));return h.nested&&d.addJSON(h.nested),d.comment=h.comment,d},u.prototype.toJSON=function(f){var h=i.prototype.toJSON.call(this,f),d=f?!!f.keepComments:!1;return l.toObject(["options",h&&h.options||e,"methods",i.arrayToJSON(this.methodsArray,f)||{},"nested",h&&h.nested||e,"comment",d?this.comment:e])},Object.defineProperty(u.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=l.toArray(this.methods))}});function c(f){return f._methodsArray=null,f}u.prototype.get=function(f){return this.methods[f]||i.prototype.get.call(this,f)},u.prototype.resolveAll=function(){for(var f=this.methodsArray,h=0;h<f.length;++h)f[h].resolve();return i.prototype.resolve.call(this)},u.prototype.add=function(f){if(this.get(f.name))throw Error("duplicate name '"+f.name+"' in "+this);return f instanceof o?(this.methods[f.name]=f,f.parent=this,c(this)):i.prototype.add.call(this,f)},u.prototype.remove=function(f){if(f instanceof o){if(this.methods[f.name]!==f)throw Error(f+" is not a member of "+this);return delete this.methods[f.name],f.parent=null,c(this)}return i.prototype.remove.call(this,f)},u.prototype.create=function(f,h,d){for(var p=new a.Service(f,h,d),g=0,m;g<this.methodsArray.length;++g){var y=l.lcFirst((m=this._methodsArray[g]).resolve().name).replace(/[^$\w_]/g,"");p[y]=l.codegen(["r","c"],l.isReserved(y)?y+"_":y)("return this.rpcCall(m,q,s,r,c)")({m,q:m.resolvedRequestType.ctor,s:m.resolvedResponseType.ctor})}return p}},{22:22,23:23,31:31,37:37}],34:[function(t,n,s){n.exports=g;var i=/[\s{}=;:[\],'"()<>]/g,o=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,l=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,a=/^ *[*/]+ */,u=/^\s*\*?\/*/,c=/\n/g,f=/\s/,h=/\\(.?)/g,d={0:"\0",r:"\r",n:`
24
+ `,t:" "};function p(m){return m.replace(h,function(y,w){switch(w){case"\\":case"":return w;default:return d[w]||""}})}g.unescape=p;function g(m,y){m=m.toString();var w=0,_=m.length,b=1,v=null,S=null,E=0,L=!1,x=[],F=null;function J(H){return Error("illegal "+H+" (line "+b+")")}function me(){var H=F==="'"?l:o;H.lastIndex=w-1;var re=H.exec(m);if(!re)throw J("string");return w=H.lastIndex,j(F),F=null,p(re[1])}function z(H){return m.charAt(H)}function Q(H,re){v=m.charAt(H++),E=b,L=!1;var oe;y?oe=2:oe=3;var ue=H-oe,ve;do if(--ue<0||(ve=m.charAt(ue))===`
25
+ `){L=!0;break}while(ve===" "||ve===" ");for(var Ae=m.substring(H,re).split(c),q=0;q<Ae.length;++q)Ae[q]=Ae[q].replace(y?u:a,"").trim();S=Ae.join(`
26
+ `).trim()}function U(H){var re=he(H),oe=m.substring(H,re),ue=/^\s*\/{1,2}/.test(oe);return ue}function he(H){for(var re=H;re<_&&z(re)!==`
27
+ `;)re++;return re}function le(){if(x.length>0)return x.shift();if(F)return me();var H,re,oe,ue,ve;do{if(w===_)return null;for(H=!1;f.test(oe=z(w));)if(oe===`
28
28
  `&&++b,++w===_)return null;if(z(w)==="/"){if(++w===_)throw J("comment");if(z(w)==="/")if(y){if(ue=w,ve=!1,U(w)){ve=!0;do{if(w=he(w),w===_)break;w++}while(U(w))}else w=Math.min(_,he(w)+1);ve&&Q(ue,w),b++,H=!0}else{for(ve=z(ue=w+1)==="/";z(++w)!==`
29
29
  `;)if(w===_)return null;++w,ve&&Q(ue,w-1),++b,H=!0}else if((oe=z(w))==="*"){ue=w+1,ve=y||z(ue)==="*";do{if(oe===`
30
- `&&++b,++w===_)throw J("comment");re=oe,oe=z(w)}while(re!=="*"||oe!=="/");++w,ve&&Q(ue,w-2),H=!0}else return"/"}}while(H);var Ae=w;i.lastIndex=0;var q=i.test(z(Ae++));if(!q)for(;Ae<_&&!i.test(z(Ae));)++Ae;var tt=g.substring(w,w=Ae);return(tt==='"'||tt==="'")&&(F=tt),tt}function j(H){x.push(H)}function lt(){if(!x.length){var H=ce();if(H===null)return null;j(H)}return x[0]}function kt(H,re){var oe=lt(),ue=oe===H;if(ue)return ce(),!0;if(!re)throw J("token '"+oe+"', '"+H+"' expected");return!1}function ut(H){var re=null;return H===e?E===b-1&&(y||v==="*"||L)&&(re=S):(E<H&&lt(),E===H&&!L&&(y||v==="/")&&(re=S)),re}return Object.defineProperty({next:ce,peek:lt,push:j,skip:kt,cmnt:ut},"line",{get:function(){return b}})}},{}],35:[function(t,n,s){n.exports=b;var i=t(23);((b.prototype=Object.create(i.prototype)).constructor=b).className="Type";var o=t(15),c=t(25),a=t(16),u=t(20),l=t(33),f=t(21),h=t(27),d=t(42),p=t(37),m=t(14),g=t(13),y=t(40),w=t(12),_=t(41);function b(S,E){i.call(this,S,E),this.fields={},this.oneofs=e,this.extensions=e,this.reserved=e,this.group=e,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(b.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var S=Object.keys(this.fields),E=0;E<S.length;++E){var L=this.fields[S[E]],x=L.id;if(this._fieldsById[x])throw Error("duplicate id "+x+" in "+this);this._fieldsById[x]=L}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=p.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=p.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=b.generateConstructor(this)())},set:function(S){var E=S.prototype;E instanceof f||((S.prototype=new f).constructor=S,p.merge(S.prototype,E)),S.$type=S.prototype.$type=this,p.merge(S,f,!0),this._ctor=S;for(var L=0;L<this.fieldsArray.length;++L)this._fieldsArray[L].resolve();var x={};for(L=0;L<this.oneofsArray.length;++L)x[this._oneofsArray[L].resolve().name]={get:p.oneOfGetter(this._oneofsArray[L].oneof),set:p.oneOfSetter(this._oneofsArray[L].oneof)};L&&Object.defineProperties(S.prototype,x)}}}),b.generateConstructor=function(S){for(var E=p.codegen(["p"],S.name),L=0,x;L<S.fieldsArray.length;++L)(x=S._fieldsArray[L]).map?E("this%s={}",p.safeProp(x.name)):x.repeated&&E("this%s=[]",p.safeProp(x.name));return E("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 v(S){return S._fieldsById=S._fieldsArray=S._oneofsArray=null,delete S.encode,delete S.decode,delete S.verify,S}b.fromJSON=function(S,E){var L=new b(S,E.options);L.extensions=E.extensions,L.reserved=E.reserved;for(var x=Object.keys(E.fields),F=0;F<x.length;++F)L.add((typeof E.fields[x[F]].keyType<"u"?u.fromJSON:a.fromJSON)(x[F],E.fields[x[F]]));if(E.oneofs)for(x=Object.keys(E.oneofs),F=0;F<x.length;++F)L.add(c.fromJSON(x[F],E.oneofs[x[F]]));if(E.nested)for(x=Object.keys(E.nested),F=0;F<x.length;++F){var J=E.nested[x[F]];L.add((J.id!==e?a.fromJSON:J.fields!==e?b.fromJSON:J.values!==e?o.fromJSON:J.methods!==e?l.fromJSON:i.fromJSON)(x[F],J))}return E.extensions&&E.extensions.length&&(L.extensions=E.extensions),E.reserved&&E.reserved.length&&(L.reserved=E.reserved),E.group&&(L.group=!0),E.comment&&(L.comment=E.comment),L},b.prototype.toJSON=function(S){var E=i.prototype.toJSON.call(this,S),L=S?!!S.keepComments:!1;return p.toObject(["options",E&&E.options||e,"oneofs",i.arrayToJSON(this.oneofsArray,S),"fields",i.arrayToJSON(this.fieldsArray.filter(function(x){return!x.declaringField}),S)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:e,"reserved",this.reserved&&this.reserved.length?this.reserved:e,"group",this.group||e,"nested",E&&E.nested||e,"comment",L?this.comment:e])},b.prototype.resolveAll=function(){for(var S=this.fieldsArray,E=0;E<S.length;)S[E++].resolve();var L=this.oneofsArray;for(E=0;E<L.length;)L[E++].resolve();return i.prototype.resolveAll.call(this)},b.prototype.get=function(S){return this.fields[S]||this.oneofs&&this.oneofs[S]||this.nested&&this.nested[S]||null},b.prototype.add=function(S){if(this.get(S.name))throw Error("duplicate name '"+S.name+"' in "+this);if(S instanceof a&&S.extend===e){if(this._fieldsById?this._fieldsById[S.id]:this.fieldsById[S.id])throw Error("duplicate id "+S.id+" in "+this);if(this.isReservedId(S.id))throw Error("id "+S.id+" is reserved in "+this);if(this.isReservedName(S.name))throw Error("name '"+S.name+"' is reserved in "+this);return S.parent&&S.parent.remove(S),this.fields[S.name]=S,S.message=this,S.onAdd(this),v(this)}return S instanceof c?(this.oneofs||(this.oneofs={}),this.oneofs[S.name]=S,S.onAdd(this),v(this)):i.prototype.add.call(this,S)},b.prototype.remove=function(S){if(S instanceof a&&S.extend===e){if(!this.fields||this.fields[S.name]!==S)throw Error(S+" is not a member of "+this);return delete this.fields[S.name],S.parent=null,S.onRemove(this),v(this)}if(S instanceof c){if(!this.oneofs||this.oneofs[S.name]!==S)throw Error(S+" is not a member of "+this);return delete this.oneofs[S.name],S.parent=null,S.onRemove(this),v(this)}return i.prototype.remove.call(this,S)},b.prototype.isReservedId=function(S){return i.isReservedId(this.reserved,S)},b.prototype.isReservedName=function(S){return i.isReservedName(this.reserved,S)},b.prototype.create=function(S){return new this.ctor(S)},b.prototype.setup=function(){for(var S=this.fullName,E=[],L=0;L<this.fieldsArray.length;++L)E.push(this._fieldsArray[L].resolve().resolvedType);this.encode=m(this)({Writer:d,types:E,util:p}),this.decode=g(this)({Reader:h,types:E,util:p}),this.verify=y(this)({types:E,util:p}),this.fromObject=w.fromObject(this)({types:E,util:p}),this.toObject=w.toObject(this)({types:E,util:p});var x=_[S];if(x){var F=Object.create(this);F.fromObject=this.fromObject,this.fromObject=x.fromObject.bind(F),F.toObject=this.toObject,this.toObject=x.toObject.bind(F)}return this},b.prototype.encode=function(S,E){return this.setup().encode(S,E)},b.prototype.encodeDelimited=function(S,E){return this.encode(S,E&&E.len?E.fork():E).ldelim()},b.prototype.decode=function(S,E){return this.setup().decode(S,E)},b.prototype.decodeDelimited=function(S){return S instanceof h||(S=h.create(S)),this.decode(S,S.uint32())},b.prototype.verify=function(S){return this.setup().verify(S)},b.prototype.fromObject=function(S){return this.setup().fromObject(S)},b.prototype.toObject=function(S,E){return this.setup().toObject(S,E)},b.d=function(S){return function(E){p.decorateType(E,S)}}},{12:12,13:13,14:14,15:15,16:16,20:20,21:21,23:23,25:25,27:27,33:33,37:37,40:40,41:41,42:42}],36:[function(t,n,s){var i=s,o=t(37),c=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function a(u,l){var f=0,h={};for(l|=0;f<u.length;)h[c[f+l]]=u[f++];return h}i.basic=a([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),i.defaults=a([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",o.emptyArray,null]),i.long=a([0,0,0,1,1],7),i.mapKey=a([0,0,0,5,5,0,0,0,1,1,0,2],2),i.packed=a([1,5,0,0,0,5,5,0,0,0,1,1,0])},{37:37}],37:[function(t,n,s){var i=n.exports=t(39),o=t(30),c,a;i.codegen=t(3),i.fetch=t(5),i.path=t(8),i.fs=i.inquire("fs"),i.toArray=function(d){if(d){for(var p=Object.keys(d),m=new Array(p.length),g=0;g<p.length;)m[g]=d[p[g++]];return m}return[]},i.toObject=function(d){for(var p={},m=0;m<d.length;){var g=d[m++],y=d[m++];y!==e&&(p[g]=y)}return p};var u=/\\/g,l=/"/g;i.isReserved=function(d){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(d)},i.safeProp=function(d){return!/^[$\w_]+$/.test(d)||i.isReserved(d)?'["'+d.replace(u,"\\\\").replace(l,'\\"')+'"]':"."+d},i.ucFirst=function(d){return d.charAt(0).toUpperCase()+d.substring(1)};var f=/_([a-z])/g;i.camelCase=function(d){return d.substring(0,1)+d.substring(1).replace(f,function(p,m){return m.toUpperCase()})},i.compareFieldsById=function(d,p){return d.id-p.id},i.decorateType=function(d,p){if(d.$type)return p&&d.$type.name!==p&&(i.decorateRoot.remove(d.$type),d.$type.name=p,i.decorateRoot.add(d.$type)),d.$type;c||(c=t(35));var m=new c(p||d.name);return i.decorateRoot.add(m),m.ctor=d,Object.defineProperty(d,"$type",{value:m,enumerable:!1}),Object.defineProperty(d.prototype,"$type",{value:m,enumerable:!1}),m};var h=0;i.decorateEnum=function(d){if(d.$type)return d.$type;a||(a=t(15));var p=new a("Enum"+h++,d);return i.decorateRoot.add(p),Object.defineProperty(d,"$type",{value:p,enumerable:!1}),p},Object.defineProperty(i,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(t(29)))}})},{15:15,29:29,3:3,30:30,35:35,39:39,5:5,8:8}],38:[function(t,n,s){n.exports=o;var i=t(39);function o(l,f){this.lo=l>>>0,this.hi=f>>>0}var c=o.zero=new o(0,0);c.toNumber=function(){return 0},c.zzEncode=c.zzDecode=function(){return this},c.length=function(){return 1};var a=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(l){if(l===0)return c;var f=l<0;f&&(l=-l);var h=l>>>0,d=(l-h)/4294967296>>>0;return f&&(d=~d>>>0,h=~h>>>0,++h>4294967295&&(h=0,++d>4294967295&&(d=0))),new o(h,d)},o.from=function(l){if(typeof l=="number")return o.fromNumber(l);if(i.isString(l))if(i.Long)l=i.Long.fromString(l);else return o.fromNumber(parseInt(l,10));return l.low||l.high?new o(l.low>>>0,l.high>>>0):c},o.prototype.toNumber=function(l){if(!l&&this.hi>>>31){var f=~this.lo+1>>>0,h=~this.hi>>>0;return f||(h=h+1>>>0),-(f+h*4294967296)}return this.lo+this.hi*4294967296},o.prototype.toLong=function(l){return i.Long?new i.Long(this.lo|0,this.hi|0,!!l):{low:this.lo|0,high:this.hi|0,unsigned:!!l}};var u=String.prototype.charCodeAt;o.fromHash=function(l){return l===a?c:new o((u.call(l,0)|u.call(l,1)<<8|u.call(l,2)<<16|u.call(l,3)<<24)>>>0,(u.call(l,4)|u.call(l,5)<<8|u.call(l,6)<<16|u.call(l,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var l=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^l)>>>0,this.lo=(this.lo<<1^l)>>>0,this},o.prototype.zzDecode=function(){var l=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^l)>>>0,this.hi=(this.hi>>>1^l)>>>0,this},o.prototype.length=function(){var l=this.lo,f=(this.lo>>>28|this.hi<<4)>>>0,h=this.hi>>>24;return h===0?f===0?l<16384?l<128?1:2:l<2097152?3:4:f<16384?f<128?5:6:f<2097152?7:8:h<128?9:10}},{39:39}],39:[function(t,n,s){var i=s;i.asPromise=t(1),i.base64=t(2),i.EventEmitter=t(4),i.float=t(6),i.inquire=t(7),i.utf8=t(10),i.pool=t(9),i.LongBits=t(38),i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isNode=!!(rr.process&&rr.process.versions&&rr.process.versions.node),i.isInteger=Number.isInteger||function(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a},i.isString=function(a){return typeof a=="string"||a instanceof String},i.isObject=function(a){return a&&typeof a=="object"},i.isset=i.isSet=function(a,u){var l=a[u];return l!=null&&a.hasOwnProperty(u)?typeof l!="object"||(Array.isArray(l)?l.length:Object.keys(l).length)>0:!1},i.Buffer=function(){try{var a=i.inquire("buffer").Buffer;return a.prototype.utf8Write?a:null}catch{return null}}(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(a){return typeof a=="number"?i.Buffer?i._Buffer_allocUnsafe(a):new i.Array(a):i.Buffer?i._Buffer_from(a):typeof Uint8Array>"u"?a:new Uint8Array(a)},i.Array=typeof Uint8Array<"u"?Uint8Array:Array,i.Long=rr.dcodeIO&&rr.dcodeIO.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(a){return a?i.LongBits.from(a).toHash():i.LongBits.zeroHash},i.longFromHash=function(a,u){var l=i.LongBits.fromHash(a);return i.Long?i.Long.fromBits(l.lo,l.hi,u):l.toNumber(!!u)};function o(a,u,l){for(var f=Object.keys(u),h=0;h<f.length;++h)(a[f[h]]===e||!l)&&(a[f[h]]=u[f[h]]);return a}i.merge=o,i.lcFirst=function(a){return a.charAt(0).toLowerCase()+a.substring(1)};function c(a){function u(l,f){if(!(this instanceof u))return new u(l,f);Object.defineProperty(this,"message",{get:function(){return l}}),Error.captureStackTrace?Error.captureStackTrace(this,u):Object.defineProperty(this,"stack",{value:new Error().stack||""}),f&&o(this,f)}return(u.prototype=Object.create(Error.prototype)).constructor=u,Object.defineProperty(u.prototype,"name",{get:function(){return a}}),u.prototype.toString=function(){return this.name+": "+this.message},u}i.newError=c,i.ProtocolError=c("ProtocolError"),i.oneOfGetter=function(a){for(var u={},l=0;l<a.length;++l)u[a[l]]=1;return function(){for(var f=Object.keys(this),h=f.length-1;h>-1;--h)if(u[f[h]]===1&&this[f[h]]!==e&&this[f[h]]!==null)return f[h]}},i.oneOfSetter=function(a){return function(u){for(var l=0;l<a.length;++l)a[l]!==u&&delete this[a[l]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i._configure=function(){var a=i.Buffer;if(!a){i._Buffer_from=i._Buffer_allocUnsafe=null;return}i._Buffer_from=a.from!==Uint8Array.from&&a.from||function(u,l){return new a(u,l)},i._Buffer_allocUnsafe=a.allocUnsafe||function(u){return new a(u)}}},{1:1,10:10,2:2,38:38,4:4,6:6,7:7,9:9}],40:[function(t,n,s){n.exports=l;var i=t(15),o=t(37);function c(f,h){return f.name+": "+h+(f.repeated&&h!=="array"?"[]":f.map&&h!=="object"?"{k:"+f.keyType+"}":"")+" expected"}function a(f,h,d,p){if(h.resolvedType)if(h.resolvedType instanceof i){f("switch(%s){",p)("default:")("return%j",c(h,"enum value"));for(var m=Object.keys(h.resolvedType.values),g=0;g<m.length;++g)f("case %i:",h.resolvedType.values[m[g]]);f("break")("}")}else f("{")("var e=types[%i].verify(%s);",d,p)("if(e)")("return%j+e",h.name+".")("}");else switch(h.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":f("if(!util.isInteger(%s))",p)("return%j",c(h,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":f("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",p,p,p,p)("return%j",c(h,"integer|Long"));break;case"float":case"double":f('if(typeof %s!=="number")',p)("return%j",c(h,"number"));break;case"bool":f('if(typeof %s!=="boolean")',p)("return%j",c(h,"boolean"));break;case"string":f("if(!util.isString(%s))",p)("return%j",c(h,"string"));break;case"bytes":f('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',p,p,p)("return%j",c(h,"buffer"));break}return f}function u(f,h,d){switch(h.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":f("if(!util.key32Re.test(%s))",d)("return%j",c(h,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":f("if(!util.key64Re.test(%s))",d)("return%j",c(h,"integer|Long key"));break;case"bool":f("if(!util.key2Re.test(%s))",d)("return%j",c(h,"boolean key"));break}return f}function l(f){var h=o.codegen(["m"],f.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),d=f.oneofsArray,p={};d.length&&h("var p={}");for(var m=0;m<f.fieldsArray.length;++m){var g=f._fieldsArray[m].resolve(),y="m"+o.safeProp(g.name);if(g.optional&&h("if(%s!=null&&m.hasOwnProperty(%j)){",y,g.name),g.map)h("if(!util.isObject(%s))",y)("return%j",c(g,"object"))("var k=Object.keys(%s)",y)("for(var i=0;i<k.length;++i){"),u(h,g,"k[i]"),a(h,g,m,y+"[k[i]]")("}");else if(g.repeated)h("if(!Array.isArray(%s))",y)("return%j",c(g,"array"))("for(var i=0;i<%s.length;++i){",y),a(h,g,m,y+"[i]")("}");else{if(g.partOf){var w=o.safeProp(g.partOf.name);p[g.partOf.name]===1&&h("if(p%s===1)",w)("return%j",g.partOf.name+": multiple values"),p[g.partOf.name]=1,h("p%s=1",w)}a(h,g,m,y)}g.optional&&h("}")}return h("return null")}},{15:15,37:37}],41:[function(t,n,s){var i=s,o=t(21);i[".google.protobuf.Any"]={fromObject:function(c){if(c&&c["@type"]){var a=this.lookup(c["@type"]);if(a){var u=c["@type"].charAt(0)==="."?c["@type"].substr(1):c["@type"];return this.create({type_url:"/"+u,value:a.encode(a.fromObject(c)).finish()})}}return this.fromObject(c)},toObject:function(c,a){if(a&&a.json&&c.type_url&&c.value){var u=c.type_url.substring(c.type_url.lastIndexOf("/")+1),l=this.lookup(u);l&&(c=l.decode(c.value))}if(!(c instanceof this.ctor)&&c instanceof o){var f=c.$type.toObject(c,a);return f["@type"]=c.$type.fullName,f}return this.toObject(c,a)}}},{21:21}],42:[function(t,n,s){n.exports=d;var i=t(39),o,c=i.LongBits,a=i.base64,u=i.utf8;function l(b,v,S){this.fn=b,this.len=v,this.next=e,this.val=S}function f(){}function h(b){this.head=b.head,this.tail=b.tail,this.len=b.len,this.next=b.states}function d(){this.len=0,this.head=new l(f,0,0),this.tail=this.head,this.states=null}d.create=i.Buffer?function(){return(d.create=function(){return new o})()}:function(){return new d},d.alloc=function(b){return new i.Array(b)},i.Array!==Array&&(d.alloc=i.pool(d.alloc,i.Array.prototype.subarray)),d.prototype._push=function(b,v,S){return this.tail=this.tail.next=new l(b,v,S),this.len+=v,this};function p(b,v,S){v[S]=b&255}function m(b,v,S){for(;b>127;)v[S++]=b&127|128,b>>>=7;v[S]=b}function g(b,v){this.len=b,this.next=e,this.val=v}g.prototype=Object.create(l.prototype),g.prototype.fn=m,d.prototype.uint32=function(b){return this.len+=(this.tail=this.tail.next=new g((b=b>>>0)<128?1:b<16384?2:b<2097152?3:b<268435456?4:5,b)).len,this},d.prototype.int32=function(b){return b<0?this._push(y,10,c.fromNumber(b)):this.uint32(b)},d.prototype.sint32=function(b){return this.uint32((b<<1^b>>31)>>>0)};function y(b,v,S){for(;b.hi;)v[S++]=b.lo&127|128,b.lo=(b.lo>>>7|b.hi<<25)>>>0,b.hi>>>=7;for(;b.lo>127;)v[S++]=b.lo&127|128,b.lo=b.lo>>>7;v[S++]=b.lo}d.prototype.uint64=function(b){var v=c.from(b);return this._push(y,v.length(),v)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(b){var v=c.from(b).zzEncode();return this._push(y,v.length(),v)},d.prototype.bool=function(b){return this._push(p,1,b?1:0)};function w(b,v,S){v[S]=b&255,v[S+1]=b>>>8&255,v[S+2]=b>>>16&255,v[S+3]=b>>>24}d.prototype.fixed32=function(b){return this._push(w,4,b>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(b){var v=c.from(b);return this._push(w,4,v.lo)._push(w,4,v.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(b){return this._push(i.float.writeFloatLE,4,b)},d.prototype.double=function(b){return this._push(i.float.writeDoubleLE,8,b)};var _=i.Array.prototype.set?function(b,v,S){v.set(b,S)}:function(b,v,S){for(var E=0;E<b.length;++E)v[S+E]=b[E]};d.prototype.bytes=function(b){var v=b.length>>>0;if(!v)return this._push(p,1,0);if(i.isString(b)){var S=d.alloc(v=a.length(b));a.decode(b,S,0),b=S}return this.uint32(v)._push(_,v,b)},d.prototype.string=function(b){var v=u.length(b);return v?this.uint32(v)._push(u.write,v,b):this._push(p,1,0)},d.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new l(f,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(f,0,0),this.len=0),this},d.prototype.ldelim=function(){var b=this.head,v=this.tail,S=this.len;return this.reset().uint32(S),S&&(this.tail.next=b.next,this.tail=v,this.len+=S),this},d.prototype.finish=function(){for(var b=this.head.next,v=this.constructor.alloc(this.len),S=0;b;)b.fn(b.val,v,S),S+=b.len,b=b.next;return v},d._configure=function(b){o=b}},{39:39}],43:[function(t,n,s){n.exports=a;var i=t(42);(a.prototype=Object.create(i.prototype)).constructor=a;var o=t(39),c=o.Buffer;function a(){i.call(this)}a.alloc=function(f){return(a.alloc=o._Buffer_allocUnsafe)(f)};var u=c&&c.prototype instanceof Uint8Array&&c.prototype.set.name==="set"?function(f,h,d){h.set(f,d)}:function(f,h,d){if(f.copy)f.copy(h,d,0,f.length);else for(var p=0;p<f.length;)h[d++]=f[p++]};a.prototype.bytes=function(f){o.isString(f)&&(f=o._Buffer_from(f,"base64"));var h=f.length>>>0;return this.uint32(h),h&&this._push(u,h,f),this};function l(f,h,d){f.length<40?o.utf8.write(f,h,d):h.utf8Write(f,d)}a.prototype.string=function(f){var h=c.byteLength(f);return this.uint32(h),h&&this._push(l,h,f),this}},{39:39,42:42}]},{},[19])})()}(Wn)),Wn.exports}var jh=xh();const nr=Fh(jh);let G=nr.Reader,ke=nr.Writer,pe=nr.util;const P=nr.roots["push-server"]||(nr.roots["push-server"]={});P.RequestBatch=function(){function r(e){if(this.requests=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.requests=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.requests!=null&&e.requests.length)for(var n=0;n<e.requests.length;++n)P.Request.encode(e.requests[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.RequestBatch;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.requests&&s.requests.length||(s.requests=[]),s.requests.push(P.Request.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),P.Request=function(){function r(t){if(t)for(var n=Object.keys(t),s=0;s<n.length;++s)t[n[s]]!=null&&(this[n[s]]=t[n[s]])}r.prototype.incomingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:pe.oneOfGetter(e=["incomingMessages","channelStats","serverStats"]),set:pe.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=ke.create()),t.incomingMessages!=null&&t.hasOwnProperty("incomingMessages")&&P.IncomingMessagesRequest.encode(t.incomingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&P.ChannelStatsRequest.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&P.ServerStatsRequest.encode(t.serverStats,n.uint32(26).fork()).ldelim(),n},r.decode=function(t,n){t instanceof G||(t=G.create(t));for(var s=n===void 0?t.len:t.pos+n,i=new P.Request;t.pos<s;){var o=t.uint32();switch(o>>>3){case 1:i.incomingMessages=P.IncomingMessagesRequest.decode(t,t.uint32());break;case 2:i.channelStats=P.ChannelStatsRequest.decode(t,t.uint32());break;case 3:i.serverStats=P.ServerStatsRequest.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return i},r}(),P.IncomingMessagesRequest=function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.messages=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)P.IncomingMessage.encode(e.messages[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.IncomingMessagesRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(P.IncomingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),P.IncomingMessage=function(){function r(e){if(this.receivers=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.receivers=pe.emptyArray,r.prototype.sender=null,r.prototype.body="",r.prototype.expiry=0,r.prototype.type="",r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.receivers!=null&&e.receivers.length)for(var n=0;n<e.receivers.length;++n)P.Receiver.encode(e.receivers[n],t.uint32(10).fork()).ldelim();return e.sender!=null&&e.hasOwnProperty("sender")&&P.Sender.encode(e.sender,t.uint32(18).fork()).ldelim(),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(26).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(32).uint32(e.expiry),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(42).string(e.type),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.IncomingMessage;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.receivers&&s.receivers.length||(s.receivers=[]),s.receivers.push(P.Receiver.decode(e,e.uint32()));break;case 2:s.sender=P.Sender.decode(e,e.uint32());break;case 3:s.body=e.string();break;case 4:s.expiry=e.uint32();break;case 5:s.type=e.string();break;default:e.skipType(i&7);break}}return s},r}(),P.ChannelStatsRequest=function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.channels=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)P.ChannelId.encode(e.channels[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ChannelStatsRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.channels&&s.channels.length||(s.channels=[]),s.channels.push(P.ChannelId.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),P.ChannelId=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=pe.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=pe.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ChannelId;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.isPrivate=e.bool();break;case 3:s.signature=e.bytes();break;default:e.skipType(i&7);break}}return s},r}(),P.ServerStatsRequest=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ServerStatsRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){default:e.skipType(i&7);break}}return s},r}(),P.Sender=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.type=0,r.prototype.id=pe.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(8).int32(e.type),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(18).bytes(e.id),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.Sender;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.type=e.int32();break;case 2:s.id=e.bytes();break;default:e.skipType(i&7);break}}return s},r}(),P.SenderType=function(){var r={},e=Object.create(r);return e[r[0]="UNKNOWN"]=0,e[r[1]="CLIENT"]=1,e[r[2]="BACKEND"]=2,e}(),P.Receiver=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=pe.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=pe.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.Receiver;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.isPrivate=e.bool();break;case 3:s.signature=e.bytes();break;default:e.skipType(i&7);break}}return s},r}(),P.ResponseBatch=function(){function r(e){if(this.responses=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.responses=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.responses!=null&&e.responses.length)for(var n=0;n<e.responses.length;++n)P.Response.encode(e.responses[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ResponseBatch;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.responses&&s.responses.length||(s.responses=[]),s.responses.push(P.Response.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),P.Response=function(){function r(t){if(t)for(var n=Object.keys(t),s=0;s<n.length;++s)t[n[s]]!=null&&(this[n[s]]=t[n[s]])}r.prototype.outgoingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:pe.oneOfGetter(e=["outgoingMessages","channelStats","serverStats"]),set:pe.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=ke.create()),t.outgoingMessages!=null&&t.hasOwnProperty("outgoingMessages")&&P.OutgoingMessagesResponse.encode(t.outgoingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&P.ChannelStatsResponse.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&P.JsonResponse.encode(t.serverStats,n.uint32(26).fork()).ldelim(),n},r.decode=function(t,n){t instanceof G||(t=G.create(t));for(var s=n===void 0?t.len:t.pos+n,i=new P.Response;t.pos<s;){var o=t.uint32();switch(o>>>3){case 1:i.outgoingMessages=P.OutgoingMessagesResponse.decode(t,t.uint32());break;case 2:i.channelStats=P.ChannelStatsResponse.decode(t,t.uint32());break;case 3:i.serverStats=P.JsonResponse.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return i},r}(),P.OutgoingMessagesResponse=function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.messages=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)P.OutgoingMessage.encode(e.messages[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.OutgoingMessagesResponse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(P.OutgoingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),P.OutgoingMessage=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=pe.newBuffer([]),r.prototype.body="",r.prototype.expiry=0,r.prototype.created=0,r.prototype.sender=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(18).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(24).uint32(e.expiry),e.created!=null&&e.hasOwnProperty("created")&&t.uint32(37).fixed32(e.created),e.sender!=null&&e.hasOwnProperty("sender")&&P.Sender.encode(e.sender,t.uint32(42).fork()).ldelim(),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.OutgoingMessage;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.body=e.string();break;case 3:s.expiry=e.uint32();break;case 4:s.created=e.fixed32();break;case 5:s.sender=P.Sender.decode(e,e.uint32());break;default:e.skipType(i&7);break}}return s},r}(),P.ChannelStatsResponse=function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.channels=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)P.ChannelStats.encode(e.channels[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ChannelStatsResponse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.channels&&s.channels.length||(s.channels=[]),s.channels.push(P.ChannelStats.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),P.ChannelStats=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=pe.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.isOnline=!1,r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.isOnline!=null&&e.hasOwnProperty("isOnline")&&t.uint32(24).bool(e.isOnline),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ChannelStats;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.isPrivate=e.bool();break;case 3:s.isOnline=e.bool();break;default:e.skipType(i&7);break}}return s},r}(),P.JsonResponse=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.json="",r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.json!=null&&e.hasOwnProperty("json")&&t.uint32(10).string(e.json),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.JsonResponse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.json=e.string();break;default:e.skipType(i&7);break}}return s},r}();const Bh=P.ResponseBatch,Wo=P.RequestBatch,Uh=P.IncomingMessage,qo=P.Receiver;class Vo{_logger=null;_connected=!1;_connectionType;_disconnectCode=0;_disconnectReason="";_parent;_callbacks;constructor(e){this._parent=e.parent,this._connectionType=te.Undefined,this._callbacks={onOpen:C.isFunction(e.onOpen)?e.onOpen:()=>{},onDisconnect:C.isFunction(e.onDisconnect)?e.onDisconnect:()=>{},onError:C.isFunction(e.onError)?e.onError:()=>{},onMessage:C.isFunction(e.onMessage)?e.onMessage:()=>{}}}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}destroy(){}get connected(){return this._connected}set connected(e){e!=this._connected&&(this._connected=e,this._connected?this._callbacks.onOpen():this._callbacks.onDisconnect({code:this.disconnectCode,reason:this.disconnectReason}))}get disconnectCode(){return this._disconnectCode}get disconnectReason(){return this._disconnectReason}get connectionPath(){return this._parent.getConnectionPath(this._connectionType)}}class $h extends Vo{_socket;_onSocketOpenHandler;_onSocketCloseHandler;_onSocketErrorHandler;_onSocketMessageHandler;constructor(e){super(e),this._connectionType=te.WebSocket,this._socket=null,this._onSocketOpenHandler=this._onSocketOpen.bind(this),this._onSocketCloseHandler=this._onSocketClose.bind(this),this._onSocketErrorHandler=this._onSocketError.bind(this),this._onSocketMessageHandler=this._onSocketMessage.bind(this)}destroy(){super.destroy(),this._socket&&(this._socket.close(),this._socket=null)}connect(){if(this._socket){if(this._socket.readyState===1)return;this.clearEventListener(),this._socket.close(),this._socket=null}this._createSocket()}get socket(){return this._socket}disconnect(e,t){this._socket!==null&&(this.clearEventListener(),this._socket.close(e,t)),this._socket=null,this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}send(e){return!this._socket||this._socket.readyState!==1?(this.getLogger().error(new Error(`${$.getDateForLog()}: Pull: WebSocket is not connected`)),!1):(this._socket.send(e),!0)}_onSocketOpen(){this.connected=!0}_onSocketClose(e){this._socket=null,this._disconnectCode=Number(e.code),this._disconnectReason=e.reason,this.connected=!1}_onSocketError(e){this._callbacks.onError(new Error(`Socket error: ${e}`))}_onSocketMessage(e){this._callbacks.onMessage(e.data)}clearEventListener(){this._socket&&(this._socket.removeEventListener("open",this._onSocketOpenHandler),this._socket.removeEventListener("close",this._onSocketCloseHandler),this._socket.removeEventListener("error",this._onSocketErrorHandler),this._socket.removeEventListener("message",this._onSocketMessageHandler))}_createSocket(){if(this._socket)throw new Error("Socket already exists");if(!this.connectionPath)throw new Error("Websocket connection path is not defined");this._socket=new WebSocket(this.connectionPath),this._socket.binaryType="arraybuffer",this._socket.addEventListener("open",this._onSocketOpenHandler),this._socket.addEventListener("close",this._onSocketCloseHandler),this._socket.addEventListener("error",this._onSocketErrorHandler),this._socket.addEventListener("message",this._onSocketMessageHandler)}}const Wh=60;class qh extends Vo{_active;_requestTimeout;_failureTimeout;_xhr;_requestAborted;constructor(e){super(e),this._active=!1,this._connectionType=te.LongPolling,this._requestTimeout=null,this._failureTimeout=null,this._xhr=this.createXhr(),this._requestAborted=!1}connect(){this._active=!0,this.performRequest()}disconnect(e,t){this._active=!1,this.clearTimeOut(),this._xhr&&(this._requestAborted=!0,this._xhr.abort()),this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}performRequest(){if(this._active){if(!this.connectionPath)throw new Error("Long polling connection path is not defined");this._xhr.readyState!==0&&this._xhr.readyState!==4||(this.clearTimeOut(),this._failureTimeout=setTimeout(()=>{this.connected=!0},5e3),this._requestTimeout=setTimeout(this.onRequestTimeout.bind(this),Wh*1e3),this._xhr.open("GET",this.connectionPath),this._xhr.send())}}onRequestTimeout(){this._requestAborted=!0,this._xhr.abort(),this.performRequest()}onXhrReadyStateChange(){this._xhr.readyState===4&&((!this._requestAborted||this._xhr.status==200)&&this.onResponse(this._xhr.response),this._requestAborted=!1)}send(e){const t=this._parent.getPublicationPath();if(!t)return this.getLogger().error(new Error(`${$.getDateForLog()}: Pull: publication path is empty`)),!1;const n=new XMLHttpRequest;return n.open("POST",t),n.send(e),!0}onResponse(e){if(this.clearTimeOut(),this._xhr.status===200)this.connected=!0,C.isStringFilled(e)||e instanceof ArrayBuffer?this._callbacks.onMessage(e):this._parent.session.mid=null,this.performRequest();else if(this._xhr.status===304){if(this.connected=!0,this._xhr.getResponseHeader("Expires")==="Thu, 01 Jan 1973 11:11:01 GMT"){const t=this._xhr.getResponseHeader("Last-Message-Id");C.isStringFilled(t)&&this._parent.setLastMessageId(t||"")}this.performRequest()}else this._callbacks.onError(new Error("Could not connect to the server")),this.connected=!1}clearTimeOut(){this._failureTimeout&&(clearTimeout(this._failureTimeout),this._failureTimeout=null),this._requestTimeout&&(clearTimeout(this._requestTimeout),this._requestTimeout=null)}createXhr(){const e=new XMLHttpRequest;return this._parent.isProtobufSupported()&&!this._parent.isJsonRpc()&&(e.responseType="arraybuffer"),e.addEventListener("readystatechange",this.onXhrReadyStateChange.bind(this)),e}}const sr=19,zo=30*60,Vh=5e3,zh=60*1e3,Hh=10,Ho=10,Jh="ping",Zh="pong",Jo="bx-pull-session",Gh=20,Zo={api:{},channels:{},publicChannels:{},server:{timeShift:0},clientId:null,jwt:null,exp:0};class Go{_logger=null;_restClient;_status;_context;_guestMode;_guestUserId;_userId;_configGetMethod;_getPublicListMethod;_siteId;_enabled;_unloading=!1;_starting=!1;_debug=!1;_connectionAttempt=0;_connectionType=te.WebSocket;_skipStorageInit;_skipCheckRevision;_subscribers={};_watchTagsQueue=new Map;_watchUpdateInterval=174e4;_watchForceUpdateInterval=5e3;_configTimestamp=0;_session={mid:null,tag:null,time:null,history:{},lastMessageIds:[],messageCount:0};_connectors={[te.Undefined]:null,[te.WebSocket]:null,[te.LongPolling]:null};_isSecure;_config=null;_storage=null;_sharedConfig;_channelManager;_jsonRpcAdapter=null;_reconnectTimeout=null;_restartTimeout=null;_restoreWebSocketTimeout=null;_checkInterval=null;_offlineTimeout=null;_watchUpdateTimeout=null;_pingWaitTimeout=null;_isManualDisconnect=!1;_loggingEnabled=!1;_onPingTimeoutHandler;_userStatusCallbacks={};_connectPromise=null;_startingPromise=null;constructor(e){this._restClient=e.b24,this._status=Re.Offline,this._context="master",e.restApplication&&(typeof e.configGetMethod>"u"&&(e.configGetMethod="pull.application.config.get"),typeof e.skipCheckRevision>"u"&&(e.skipCheckRevision=!0),C.isStringFilled(e.restApplication)&&(e.siteId=e.restApplication),e.serverEnabled=!0),this._guestMode=e.guestMode?$.toBoolean(e.guestMode):!1,this._guestUserId=e.guestUserId?$.toInteger(e.guestUserId):0,this._guestMode&&this._guestUserId>0?this._userId=this._guestUserId:(this._guestMode=!1,this._userId=e.userId?$.toInteger(e.userId):0),this._siteId=e.siteId??"none",this._enabled=C.isUndefined(e.serverEnabled)?!0:e.serverEnabled===!0,this._configGetMethod=C.isStringFilled(e.configGetMethod)?e.configGetMethod||"":"pull.config.get",this._getPublicListMethod=C.isStringFilled(e.getPublicListMethod)?e.getPublicListMethod||"":"pull.channel.public.list",this._skipStorageInit=e.skipStorageInit===!0,this._skipCheckRevision=e.skipCheckRevision===!0,C.isUndefined(e.configTimestamp)||(this._configTimestamp=$.toInteger(e.configTimestamp)),this._isSecure=document?.location.href.indexOf("https")===0,this._userId&&!this._skipStorageInit&&(this._storage=new Uo({userId:this._userId,siteId:this._siteId})),this._sharedConfig=new Ph({onWebSocketBlockChanged:this.onWebSocketBlockChanged.bind(this),storage:this._storage}),this._channelManager=new Mh({b24:this._restClient,getPublicListMethod:this._getPublicListMethod}),this._loggingEnabled=this._sharedConfig.isLoggingEnabled(),this._onPingTimeoutHandler=this.onPingTimeout.bind(this)}setLogger(e){this._logger=e,this._jsonRpcAdapter?.setLogger(this.getLogger()),this._storage?.setLogger(this.getLogger()),this._sharedConfig.setLogger(this.getLogger()),this._channelManager.setLogger(this.getLogger()),this._connectors.webSocket?.setLogger(this.getLogger()),this._connectors.longPolling?.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}destroy(){this.stop(Se.NORMAL_CLOSURE,"manual stop"),this.onBeforeUnload()}init(){this._connectors.webSocket=new $h({parent:this,onOpen:this.onWebSocketOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onWebSocketDisconnect.bind(this),onError:this.onWebSocketError.bind(this)}),this._connectors.longPolling=new qh({parent:this,onOpen:this.onLongPollingOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onLongPollingDisconnect.bind(this),onError:this.onLongPollingError.bind(this)}),this._connectionType=this.isWebSocketAllowed()?te.WebSocket:te.LongPolling,window.addEventListener("beforeunload",this.onBeforeUnload.bind(this)),window.addEventListener("offline",this.onOffline.bind(this)),window.addEventListener("online",this.onOnline.bind(this)),this._jsonRpcAdapter=new Dh({connector:this._connectors.webSocket,handlers:{"incoming.message":this.handleRpcIncomingMessage.bind(this)}})}get connector(){return this._connectors[this._connectionType]}get status(){return this._status}set status(e){this._status!==e&&(this._status=e,this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),e===Re.Offline?this.sendPullStatusDelayed(e,Vh):this.sendPullStatus(e))}get session(){return this._session}subscribe(e){if(!C.isPlainObject(e))return this.attachCommandHandler(e);if(e=e,e.type=e.type||Le.Server,e.command=e.command||null,e.type==Le.Server||e.type==Le.Client){if(typeof e.moduleId>"u")throw new TypeError(`${$.getDateForLog()}: Pull.subscribe: parameter moduleId is not specified`);return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),e.command?(typeof this._subscribers[e.type][e.moduleId].commands[e.command]>"u"&&(this._subscribers[e.type][e.moduleId].commands[e.command]=[]),this._subscribers[e.type][e.moduleId].commands[e.command].push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||typeof e.command>"u"||e.command===null||(this._subscribers[e.type][e.moduleId].commands[e.command]=this._subscribers[e.type][e.moduleId].commands[e.command].filter(t=>t!==e.callback))}):(this._subscribers[e.type][e.moduleId].callbacks.push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||(this._subscribers[e.type][e.moduleId].callbacks=this._subscribers[e.type][e.moduleId].callbacks.filter(t=>t!==e.callback))})}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].push(e.callback),()=>{typeof e.type>"u"||(this._subscribers[e.type]=this._subscribers[e.type].filter(t=>t!==e.callback))}}attachCommandHandler(e){if(typeof e.getModuleId!="function"||typeof e.getModuleId()!="string")return this.getLogger().error(`${$.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string.`),()=>{};let t=Le.Server;return typeof e.getSubscriptionType=="function"&&(t=e.getSubscriptionType()),this.subscribe({type:t,moduleId:e.getModuleId(),callback:n=>{let s=null;if(typeof e.getMap=="function"){const i=e.getMap();if(i&&typeof i=="object"){const o=i[n.command];typeof o=="function"?s=o.bind(e):typeof o=="string"&&typeof e[o]=="function"&&(s=e[o].bind(e))}}if(!s){const i=`handle${$.capitalize(n.command)}`;typeof e[i]=="function"&&(s=e[i].bind(e))}s&&(this._debug&&this._context!=="master"&&this.getLogger().warn(`${$.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,n),s(n.params,n.extra,n.command))}})}async start(e=null){let t=!0;if(this.isConnected())return Promise.resolve(!0);if(this._starting&&this._startingPromise)return this._startingPromise;if(!this._userId)throw new Error("Not set userId");if(this._siteId==="none")throw new Error("Not set siteId");let n=!1;if(e&&C.isPlainObject(e)&&(typeof e?.skipReconnectToLastSession<"u"&&(n=e.skipReconnectToLastSession,delete e.skipReconnectToLastSession),this._config=e,t=!1),!this._enabled)return Promise.reject({ex:{error:"PULL_DISABLED",error_description:"Push & Pull server is disabled"}});const s=Date.now();let i;return!n&&this._storage&&(i=this._storage.get(Jo,null)),C.isPlainObject(i)&&i.hasOwnProperty("ttl")&&i.ttl>=s&&(this._session.mid=i.mid),this._starting=!0,this._startingPromise=new Promise((o,c)=>{this.loadConfig("client_start").then(a=>{this.setConfig(a,t),this.init(),this.updateWatch(!0),this.startCheckConfig(),this.connect().then(()=>o(!0),u=>c(u))}).catch(a=>{this._starting=!1,this.status=Re.Offline,this.stopCheckConfig(),this.getLogger().error(`${$.getDateForLog()}: Pull: could not read push-server config `,a),c(a)})})}restart(e=Se.NORMAL_CLOSURE,t="manual restart"){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),this.getLogger().log(`${$.getDateForLog()}: Pull: restarting with code ${e}`),this.disconnect(e,t),this._storage&&this._storage.remove(Ne.PullConfig),this._config=null;const n=`${e}_${t.replaceAll(" ","_")}`;this.loadConfig(n).then(s=>{this.setConfig(s,!0),this.updateWatch(),this.startCheckConfig(),this.connect().catch(i=>{this.getLogger().error(i)})},s=>{this.getLogger().error(`${$.getDateForLog()}: Pull: could not read push-server config `,s),this.status=Re.Offline,this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),(s?.status==401||s?.status==403)&&(this.stopCheckConfig(),this.onCustomEvent("onPullError",["AUTHORIZE_ERROR"]))})}stop(e=Se.NORMAL_CLOSURE,t="manual stop"){this.disconnect(e,t),this.stopCheckConfig()}reconnect(e,t,n=1){this.disconnect(e,t),this.scheduleReconnect(n)}setLastMessageId(e){this._session.mid=e}async sendMessage(e,t,n,s,i){const o={userList:e,body:{module_id:t,command:n,params:s},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.Publish,o):this.sendMessageBatch([o])}async sendMessageToChannels(e,t,n,s,i){const o={channelList:e,body:{module_id:t,command:n,params:s},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.Publish,o):this.sendMessageBatch([o])}capturePullEvent(e=!0){this._debug=e}enableLogging(e=!0){this._sharedConfig.setLoggingEnabled(e),this._loggingEnabled=e}async listChannels(){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.ListChannels,{})||Promise.reject(new Error("jsonRpcAdapter not init"))}async getUsersLastSeen(e){if(!C.isArray(e)||!e.every(n=>typeof n=="number"))throw new Error("userList must be an array of numbers");const t={};return new Promise((n,s)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.GetUsersLastSeen,{userList:e}).then(i=>{const o=[];for(let a=0;a<e.length;a++)i.hasOwnProperty(e[a])||o.push(e[a]);if(o.length===0)return n(t);const c={userIds:o,sendToQueueSever:!0};this._restClient.callMethod("pull.api.user.getLastSeen",c).then(a=>{const u=a.getData().result;for(const l in u)t[Number(l)]=Number(u[l]);return n(t)}).catch(a=>{this.getLogger().error(a),s(a)})}).catch(i=>{this.getLogger().error(i),s(i)})})}async ping(e=5){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.Ping,{},e)}async subscribeUserStatusChange(e,t){return new Promise((n,s)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.SubscribeStatusChange,{userId:e}).then(()=>(this._userStatusCallbacks[e]||(this._userStatusCallbacks[e]=[]),C.isFunction(t)&&this._userStatusCallbacks[e].push(t),n())).catch(i=>s(i))})}async unsubscribeUserStatusChange(e,t){return this._userStatusCallbacks[e]&&(this._userStatusCallbacks[e]=this._userStatusCallbacks[e].filter(n=>n!==t),this._userStatusCallbacks[e].length===0)?this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.UnsubscribeStatusChange,{userId:e}):Promise.resolve()}getRevision(){return this._config&&this._config.api?this._config.api.revision_web:null}getServerVersion(){return this._config&&this._config.server?this._config.server.version:0}getServerMode(){return this._config&&this._config.server?this._config.server.mode:null}getConfig(){return this._config}getDebugInfo(){if(!JSON||!JSON.stringify)return{};let e;this._config&&this._config.channels?e={ChannelID:this._config.channels.private?.id||"n/a",ChannelDie:this._config.channels.private?.end||"n/a",ChannelDieShared:this._config.channels.shared?.end||"n/a"}:e={ConfigError:"config is not loaded"};let t="-";return this._connectors.webSocket&&this._connectors.webSocket?.socket&&(this.isJsonRpc()?t="json-rpc":t=this._connectors.webSocket?.socket?.url.search("binaryMode=true")!=-1?"protobuf":"text"),{UserId:this._userId+(this._userId>0?"":"(guest)"),"Guest userId":this._guestMode&&this._guestUserId!==0?this._guestUserId:"-","Browser online":navigator.onLine?"Y":"N",Connect:this.isConnected()?"Y":"N","Server type":this.isSharedMode()?"cloud":"local","WebSocket supported":this.isWebSocketSupported()?"Y":"N","WebSocket connected":this._connectors.webSocket&&this._connectors.webSocket.connected?"Y":"N","WebSocket mode":t,"Try connect":this._reconnectTimeout?"Y":"N","Try number":this._connectionAttempt,Path:this.connector?.connectionPath||"-",...e,"Last message":this._session.mid||"-","Session history":this._session.history,"Watch tags":this._watchTagsQueue.entries()}}getConnectionPath(e){let t;const n={};switch(e){case te.WebSocket:t=this._isSecure?this._config?.server.websocket_secure:this._config?.server.websocket;break;case te.LongPolling:t=this._isSecure?this._config?.server.long_pooling_secure:this._config?.server.long_polling;break;default:throw new Error(`Unknown connection type ${e}`)}if(!C.isStringFilled(t))throw new Error("Empty path");if(typeof this._config?.jwt=="string"&&this._config?.jwt!=="")n.token=this._config?.jwt;else{const s=[];if(this._config?.channels?.private&&s.push(this._config.channels.private?.id||""),this._config?.channels.private?.id&&s.push(this._config.channels.private.id),this._config?.channels.shared?.id&&s.push(this._config.channels.shared.id),s.length===0)throw new Error("Empty channels");n.CHANNEL_ID=s.join("/")}if(this.isJsonRpc()?n.jsonRpc="true":this.isProtobufSupported()&&(n.binaryMode="true"),this.isSharedMode()){if(!this._config?.clientId)throw new Error("Push-server is in shared mode, but clientId is not set");n.clientId=this._config.clientId}return this._session.mid&&(n.mid=this._session.mid),this._session.tag&&(n.tag=this._session.tag),this._session.time&&(n.time=this._session.time),n.revision=sr,`${t}?${$.buildQueryString(n)}`}getPublicationPath(){const e=this._isSecure?this._config?.server.publish_secure:this._config?.server.publish;if(!e)return"";const t=[];this._config?.channels.private?.id&&t.push(this._config.channels.private.id),this._config?.channels.shared?.id&&t.push(this._config.channels.shared.id);const n={CHANNEL_ID:t.join("/")};return e+"?"+$.buildQueryString(n)}isConnected(){return this.connector?this.connector.connected:!1}isWebSocketSupported(){return typeof window.WebSocket<"u"}isWebSocketAllowed(){return this._sharedConfig.isWebSocketBlocked()?!1:this.isWebSocketEnabled()}isWebSocketEnabled(){return!this.isWebSocketSupported()||!this._config||!this._config.server?!1:this._config.server.websocket_enabled}isPublishingSupported(){return this.getServerVersion()>3}isPublishingEnabled(){return this.isPublishingSupported()?this._config?.server.publish_enabled===!0:!1}isProtobufSupported(){return this.getServerVersion()==4&&!Ai.isIE()}isJsonRpc(){return this.getServerVersion()>=5}isSharedMode(){return this.getServerMode()===yn.Shared}emit(e){if(e.type==Le.Server||e.type==Le.Client){if(typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof e.moduleId>"u")throw new TypeError(`${$.getDateForLog()}: Pull.emit: parameter moduleId is not specified`);return typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),this._subscribers[e.type][e.moduleId].callbacks.length>0&&this._subscribers[e.type][e.moduleId].callbacks.forEach(t=>{t(e.data,{type:e.type,moduleId:e.moduleId})}),!(typeof e.data>"u")&&!(typeof e.data.command>"u")&&this._subscribers[e.type][e.moduleId].commands[e.data.command]&&this._subscribers[e.type][e.moduleId].commands[e.data.command].length>0&&this._subscribers[e.type][e.moduleId].commands[e.data.command].forEach(t=>{typeof e.data>"u"||t(e.data.params,e.data.extra,e.data.command,{type:e.type,moduleId:e.moduleId})}),!0}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].length<=0||this._subscribers[e.type].forEach(t=>{t(e.data,{type:e.type})}),!0}broadcastMessage(e){const t=e.module_id=e.module_id.toLowerCase(),n=e.command;e.extra||(e.extra={}),e.extra.server_time_unix&&(e.extra.server_time_ago=(Date.now()-e.extra.server_time_unix*1e3)/1e3-(this._config?.server.timeShift||0),e.extra.server_time_ago=Math.max(e.extra.server_time_ago,0)),this.logMessage(e);try{e.extra.sender&&e.extra.sender.type===Sr.Client?(this.onCustomEvent("onPullClientEvent-"+t,[n,e.params,e.extra],!0),this.onCustomEvent("onPullClientEvent",[t,n,e.params,e.extra],!0),this.emit({type:Le.Client,moduleId:t,data:{command:n,params:C.clone(e.params),extra:C.clone(e.extra)}})):t==="pull"?this.handleInternalPullEvent(n,e):t=="online"?((e?.extra?.server_time_ago||0)<240&&(this.onCustomEvent("onPullOnlineEvent",[n,e.params,e.extra],!0),this.emit({type:Le.Online,data:{command:n,params:C.clone(e.params),extra:C.clone(e.extra)}})),n==="userStatusChange"&&this.emitUserStatusChange(e.params.user_id,e.params.online)):(this.onCustomEvent("onPullEvent-"+t,[n,e.params,e.extra],!0),this.onCustomEvent("onPullEvent",[t,n,e.params,e.extra],!0),this.emit({type:Le.Server,moduleId:t,data:{command:n,params:C.clone(e.params),extra:C.clone(e.extra)}}))}catch(s){this.getLogger().warn(`
30
+ `&&++b,++w===_)throw J("comment");re=oe,oe=z(w)}while(re!=="*"||oe!=="/");++w,ve&&Q(ue,w-2),H=!0}else return"/"}}while(H);var Ae=w;i.lastIndex=0;var q=i.test(z(Ae++));if(!q)for(;Ae<_&&!i.test(z(Ae));)++Ae;var rt=m.substring(w,w=Ae);return(rt==='"'||rt==="'")&&(F=rt),rt}function j(H){x.push(H)}function ct(){if(!x.length){var H=le();if(H===null)return null;j(H)}return x[0]}function kt(H,re){var oe=ct(),ue=oe===H;if(ue)return le(),!0;if(!re)throw J("token '"+oe+"', '"+H+"' expected");return!1}function ut(H){var re=null;return H===e?E===b-1&&(y||v==="*"||L)&&(re=S):(E<H&&ct(),E===H&&!L&&(y||v==="/")&&(re=S)),re}return Object.defineProperty({next:le,peek:ct,push:j,skip:kt,cmnt:ut},"line",{get:function(){return b}})}},{}],35:[function(t,n,s){n.exports=b;var i=t(23);((b.prototype=Object.create(i.prototype)).constructor=b).className="Type";var o=t(15),l=t(25),a=t(16),u=t(20),c=t(33),f=t(21),h=t(27),d=t(42),p=t(37),g=t(14),m=t(13),y=t(40),w=t(12),_=t(41);function b(S,E){i.call(this,S,E),this.fields={},this.oneofs=e,this.extensions=e,this.reserved=e,this.group=e,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(b.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var S=Object.keys(this.fields),E=0;E<S.length;++E){var L=this.fields[S[E]],x=L.id;if(this._fieldsById[x])throw Error("duplicate id "+x+" in "+this);this._fieldsById[x]=L}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=p.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=p.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=b.generateConstructor(this)())},set:function(S){var E=S.prototype;E instanceof f||((S.prototype=new f).constructor=S,p.merge(S.prototype,E)),S.$type=S.prototype.$type=this,p.merge(S,f,!0),this._ctor=S;for(var L=0;L<this.fieldsArray.length;++L)this._fieldsArray[L].resolve();var x={};for(L=0;L<this.oneofsArray.length;++L)x[this._oneofsArray[L].resolve().name]={get:p.oneOfGetter(this._oneofsArray[L].oneof),set:p.oneOfSetter(this._oneofsArray[L].oneof)};L&&Object.defineProperties(S.prototype,x)}}}),b.generateConstructor=function(S){for(var E=p.codegen(["p"],S.name),L=0,x;L<S.fieldsArray.length;++L)(x=S._fieldsArray[L]).map?E("this%s={}",p.safeProp(x.name)):x.repeated&&E("this%s=[]",p.safeProp(x.name));return E("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 v(S){return S._fieldsById=S._fieldsArray=S._oneofsArray=null,delete S.encode,delete S.decode,delete S.verify,S}b.fromJSON=function(S,E){var L=new b(S,E.options);L.extensions=E.extensions,L.reserved=E.reserved;for(var x=Object.keys(E.fields),F=0;F<x.length;++F)L.add((typeof E.fields[x[F]].keyType<"u"?u.fromJSON:a.fromJSON)(x[F],E.fields[x[F]]));if(E.oneofs)for(x=Object.keys(E.oneofs),F=0;F<x.length;++F)L.add(l.fromJSON(x[F],E.oneofs[x[F]]));if(E.nested)for(x=Object.keys(E.nested),F=0;F<x.length;++F){var J=E.nested[x[F]];L.add((J.id!==e?a.fromJSON:J.fields!==e?b.fromJSON:J.values!==e?o.fromJSON:J.methods!==e?c.fromJSON:i.fromJSON)(x[F],J))}return E.extensions&&E.extensions.length&&(L.extensions=E.extensions),E.reserved&&E.reserved.length&&(L.reserved=E.reserved),E.group&&(L.group=!0),E.comment&&(L.comment=E.comment),L},b.prototype.toJSON=function(S){var E=i.prototype.toJSON.call(this,S),L=S?!!S.keepComments:!1;return p.toObject(["options",E&&E.options||e,"oneofs",i.arrayToJSON(this.oneofsArray,S),"fields",i.arrayToJSON(this.fieldsArray.filter(function(x){return!x.declaringField}),S)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:e,"reserved",this.reserved&&this.reserved.length?this.reserved:e,"group",this.group||e,"nested",E&&E.nested||e,"comment",L?this.comment:e])},b.prototype.resolveAll=function(){for(var S=this.fieldsArray,E=0;E<S.length;)S[E++].resolve();var L=this.oneofsArray;for(E=0;E<L.length;)L[E++].resolve();return i.prototype.resolveAll.call(this)},b.prototype.get=function(S){return this.fields[S]||this.oneofs&&this.oneofs[S]||this.nested&&this.nested[S]||null},b.prototype.add=function(S){if(this.get(S.name))throw Error("duplicate name '"+S.name+"' in "+this);if(S instanceof a&&S.extend===e){if(this._fieldsById?this._fieldsById[S.id]:this.fieldsById[S.id])throw Error("duplicate id "+S.id+" in "+this);if(this.isReservedId(S.id))throw Error("id "+S.id+" is reserved in "+this);if(this.isReservedName(S.name))throw Error("name '"+S.name+"' is reserved in "+this);return S.parent&&S.parent.remove(S),this.fields[S.name]=S,S.message=this,S.onAdd(this),v(this)}return S instanceof l?(this.oneofs||(this.oneofs={}),this.oneofs[S.name]=S,S.onAdd(this),v(this)):i.prototype.add.call(this,S)},b.prototype.remove=function(S){if(S instanceof a&&S.extend===e){if(!this.fields||this.fields[S.name]!==S)throw Error(S+" is not a member of "+this);return delete this.fields[S.name],S.parent=null,S.onRemove(this),v(this)}if(S instanceof l){if(!this.oneofs||this.oneofs[S.name]!==S)throw Error(S+" is not a member of "+this);return delete this.oneofs[S.name],S.parent=null,S.onRemove(this),v(this)}return i.prototype.remove.call(this,S)},b.prototype.isReservedId=function(S){return i.isReservedId(this.reserved,S)},b.prototype.isReservedName=function(S){return i.isReservedName(this.reserved,S)},b.prototype.create=function(S){return new this.ctor(S)},b.prototype.setup=function(){for(var S=this.fullName,E=[],L=0;L<this.fieldsArray.length;++L)E.push(this._fieldsArray[L].resolve().resolvedType);this.encode=g(this)({Writer:d,types:E,util:p}),this.decode=m(this)({Reader:h,types:E,util:p}),this.verify=y(this)({types:E,util:p}),this.fromObject=w.fromObject(this)({types:E,util:p}),this.toObject=w.toObject(this)({types:E,util:p});var x=_[S];if(x){var F=Object.create(this);F.fromObject=this.fromObject,this.fromObject=x.fromObject.bind(F),F.toObject=this.toObject,this.toObject=x.toObject.bind(F)}return this},b.prototype.encode=function(S,E){return this.setup().encode(S,E)},b.prototype.encodeDelimited=function(S,E){return this.encode(S,E&&E.len?E.fork():E).ldelim()},b.prototype.decode=function(S,E){return this.setup().decode(S,E)},b.prototype.decodeDelimited=function(S){return S instanceof h||(S=h.create(S)),this.decode(S,S.uint32())},b.prototype.verify=function(S){return this.setup().verify(S)},b.prototype.fromObject=function(S){return this.setup().fromObject(S)},b.prototype.toObject=function(S,E){return this.setup().toObject(S,E)},b.d=function(S){return function(E){p.decorateType(E,S)}}},{12:12,13:13,14:14,15:15,16:16,20:20,21:21,23:23,25:25,27:27,33:33,37:37,40:40,41:41,42:42}],36:[function(t,n,s){var i=s,o=t(37),l=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function a(u,c){var f=0,h={};for(c|=0;f<u.length;)h[l[f+c]]=u[f++];return h}i.basic=a([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),i.defaults=a([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",o.emptyArray,null]),i.long=a([0,0,0,1,1],7),i.mapKey=a([0,0,0,5,5,0,0,0,1,1,0,2],2),i.packed=a([1,5,0,0,0,5,5,0,0,0,1,1,0])},{37:37}],37:[function(t,n,s){var i=n.exports=t(39),o=t(30),l,a;i.codegen=t(3),i.fetch=t(5),i.path=t(8),i.fs=i.inquire("fs"),i.toArray=function(d){if(d){for(var p=Object.keys(d),g=new Array(p.length),m=0;m<p.length;)g[m]=d[p[m++]];return g}return[]},i.toObject=function(d){for(var p={},g=0;g<d.length;){var m=d[g++],y=d[g++];y!==e&&(p[m]=y)}return p};var u=/\\/g,c=/"/g;i.isReserved=function(d){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(d)},i.safeProp=function(d){return!/^[$\w_]+$/.test(d)||i.isReserved(d)?'["'+d.replace(u,"\\\\").replace(c,'\\"')+'"]':"."+d},i.ucFirst=function(d){return d.charAt(0).toUpperCase()+d.substring(1)};var f=/_([a-z])/g;i.camelCase=function(d){return d.substring(0,1)+d.substring(1).replace(f,function(p,g){return g.toUpperCase()})},i.compareFieldsById=function(d,p){return d.id-p.id},i.decorateType=function(d,p){if(d.$type)return p&&d.$type.name!==p&&(i.decorateRoot.remove(d.$type),d.$type.name=p,i.decorateRoot.add(d.$type)),d.$type;l||(l=t(35));var g=new l(p||d.name);return i.decorateRoot.add(g),g.ctor=d,Object.defineProperty(d,"$type",{value:g,enumerable:!1}),Object.defineProperty(d.prototype,"$type",{value:g,enumerable:!1}),g};var h=0;i.decorateEnum=function(d){if(d.$type)return d.$type;a||(a=t(15));var p=new a("Enum"+h++,d);return i.decorateRoot.add(p),Object.defineProperty(d,"$type",{value:p,enumerable:!1}),p},Object.defineProperty(i,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(t(29)))}})},{15:15,29:29,3:3,30:30,35:35,39:39,5:5,8:8}],38:[function(t,n,s){n.exports=o;var i=t(39);function o(c,f){this.lo=c>>>0,this.hi=f>>>0}var l=o.zero=new o(0,0);l.toNumber=function(){return 0},l.zzEncode=l.zzDecode=function(){return this},l.length=function(){return 1};var a=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(c){if(c===0)return l;var f=c<0;f&&(c=-c);var h=c>>>0,d=(c-h)/4294967296>>>0;return f&&(d=~d>>>0,h=~h>>>0,++h>4294967295&&(h=0,++d>4294967295&&(d=0))),new o(h,d)},o.from=function(c){if(typeof c=="number")return o.fromNumber(c);if(i.isString(c))if(i.Long)c=i.Long.fromString(c);else return o.fromNumber(parseInt(c,10));return c.low||c.high?new o(c.low>>>0,c.high>>>0):l},o.prototype.toNumber=function(c){if(!c&&this.hi>>>31){var f=~this.lo+1>>>0,h=~this.hi>>>0;return f||(h=h+1>>>0),-(f+h*4294967296)}return this.lo+this.hi*4294967296},o.prototype.toLong=function(c){return i.Long?new i.Long(this.lo|0,this.hi|0,!!c):{low:this.lo|0,high:this.hi|0,unsigned:!!c}};var u=String.prototype.charCodeAt;o.fromHash=function(c){return c===a?l:new o((u.call(c,0)|u.call(c,1)<<8|u.call(c,2)<<16|u.call(c,3)<<24)>>>0,(u.call(c,4)|u.call(c,5)<<8|u.call(c,6)<<16|u.call(c,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var c=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^c)>>>0,this.lo=(this.lo<<1^c)>>>0,this},o.prototype.zzDecode=function(){var c=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^c)>>>0,this.hi=(this.hi>>>1^c)>>>0,this},o.prototype.length=function(){var c=this.lo,f=(this.lo>>>28|this.hi<<4)>>>0,h=this.hi>>>24;return h===0?f===0?c<16384?c<128?1:2:c<2097152?3:4:f<16384?f<128?5:6:f<2097152?7:8:h<128?9:10}},{39:39}],39:[function(t,n,s){var i=s;i.asPromise=t(1),i.base64=t(2),i.EventEmitter=t(4),i.float=t(6),i.inquire=t(7),i.utf8=t(10),i.pool=t(9),i.LongBits=t(38),i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isNode=!!(sr.process&&sr.process.versions&&sr.process.versions.node),i.isInteger=Number.isInteger||function(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a},i.isString=function(a){return typeof a=="string"||a instanceof String},i.isObject=function(a){return a&&typeof a=="object"},i.isset=i.isSet=function(a,u){var c=a[u];return c!=null&&a.hasOwnProperty(u)?typeof c!="object"||(Array.isArray(c)?c.length:Object.keys(c).length)>0:!1},i.Buffer=(function(){try{var a=i.inquire("buffer").Buffer;return a.prototype.utf8Write?a:null}catch{return null}})(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(a){return typeof a=="number"?i.Buffer?i._Buffer_allocUnsafe(a):new i.Array(a):i.Buffer?i._Buffer_from(a):typeof Uint8Array>"u"?a:new Uint8Array(a)},i.Array=typeof Uint8Array<"u"?Uint8Array:Array,i.Long=sr.dcodeIO&&sr.dcodeIO.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(a){return a?i.LongBits.from(a).toHash():i.LongBits.zeroHash},i.longFromHash=function(a,u){var c=i.LongBits.fromHash(a);return i.Long?i.Long.fromBits(c.lo,c.hi,u):c.toNumber(!!u)};function o(a,u,c){for(var f=Object.keys(u),h=0;h<f.length;++h)(a[f[h]]===e||!c)&&(a[f[h]]=u[f[h]]);return a}i.merge=o,i.lcFirst=function(a){return a.charAt(0).toLowerCase()+a.substring(1)};function l(a){function u(c,f){if(!(this instanceof u))return new u(c,f);Object.defineProperty(this,"message",{get:function(){return c}}),Error.captureStackTrace?Error.captureStackTrace(this,u):Object.defineProperty(this,"stack",{value:new Error().stack||""}),f&&o(this,f)}return(u.prototype=Object.create(Error.prototype)).constructor=u,Object.defineProperty(u.prototype,"name",{get:function(){return a}}),u.prototype.toString=function(){return this.name+": "+this.message},u}i.newError=l,i.ProtocolError=l("ProtocolError"),i.oneOfGetter=function(a){for(var u={},c=0;c<a.length;++c)u[a[c]]=1;return function(){for(var f=Object.keys(this),h=f.length-1;h>-1;--h)if(u[f[h]]===1&&this[f[h]]!==e&&this[f[h]]!==null)return f[h]}},i.oneOfSetter=function(a){return function(u){for(var c=0;c<a.length;++c)a[c]!==u&&delete this[a[c]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i._configure=function(){var a=i.Buffer;if(!a){i._Buffer_from=i._Buffer_allocUnsafe=null;return}i._Buffer_from=a.from!==Uint8Array.from&&a.from||function(u,c){return new a(u,c)},i._Buffer_allocUnsafe=a.allocUnsafe||function(u){return new a(u)}}},{1:1,10:10,2:2,38:38,4:4,6:6,7:7,9:9}],40:[function(t,n,s){n.exports=c;var i=t(15),o=t(37);function l(f,h){return f.name+": "+h+(f.repeated&&h!=="array"?"[]":f.map&&h!=="object"?"{k:"+f.keyType+"}":"")+" expected"}function a(f,h,d,p){if(h.resolvedType)if(h.resolvedType instanceof i){f("switch(%s){",p)("default:")("return%j",l(h,"enum value"));for(var g=Object.keys(h.resolvedType.values),m=0;m<g.length;++m)f("case %i:",h.resolvedType.values[g[m]]);f("break")("}")}else f("{")("var e=types[%i].verify(%s);",d,p)("if(e)")("return%j+e",h.name+".")("}");else switch(h.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":f("if(!util.isInteger(%s))",p)("return%j",l(h,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":f("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",p,p,p,p)("return%j",l(h,"integer|Long"));break;case"float":case"double":f('if(typeof %s!=="number")',p)("return%j",l(h,"number"));break;case"bool":f('if(typeof %s!=="boolean")',p)("return%j",l(h,"boolean"));break;case"string":f("if(!util.isString(%s))",p)("return%j",l(h,"string"));break;case"bytes":f('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',p,p,p)("return%j",l(h,"buffer"));break}return f}function u(f,h,d){switch(h.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":f("if(!util.key32Re.test(%s))",d)("return%j",l(h,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":f("if(!util.key64Re.test(%s))",d)("return%j",l(h,"integer|Long key"));break;case"bool":f("if(!util.key2Re.test(%s))",d)("return%j",l(h,"boolean key"));break}return f}function c(f){var h=o.codegen(["m"],f.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),d=f.oneofsArray,p={};d.length&&h("var p={}");for(var g=0;g<f.fieldsArray.length;++g){var m=f._fieldsArray[g].resolve(),y="m"+o.safeProp(m.name);if(m.optional&&h("if(%s!=null&&m.hasOwnProperty(%j)){",y,m.name),m.map)h("if(!util.isObject(%s))",y)("return%j",l(m,"object"))("var k=Object.keys(%s)",y)("for(var i=0;i<k.length;++i){"),u(h,m,"k[i]"),a(h,m,g,y+"[k[i]]")("}");else if(m.repeated)h("if(!Array.isArray(%s))",y)("return%j",l(m,"array"))("for(var i=0;i<%s.length;++i){",y),a(h,m,g,y+"[i]")("}");else{if(m.partOf){var w=o.safeProp(m.partOf.name);p[m.partOf.name]===1&&h("if(p%s===1)",w)("return%j",m.partOf.name+": multiple values"),p[m.partOf.name]=1,h("p%s=1",w)}a(h,m,g,y)}m.optional&&h("}")}return h("return null")}},{15:15,37:37}],41:[function(t,n,s){var i=s,o=t(21);i[".google.protobuf.Any"]={fromObject:function(l){if(l&&l["@type"]){var a=this.lookup(l["@type"]);if(a){var u=l["@type"].charAt(0)==="."?l["@type"].substr(1):l["@type"];return this.create({type_url:"/"+u,value:a.encode(a.fromObject(l)).finish()})}}return this.fromObject(l)},toObject:function(l,a){if(a&&a.json&&l.type_url&&l.value){var u=l.type_url.substring(l.type_url.lastIndexOf("/")+1),c=this.lookup(u);c&&(l=c.decode(l.value))}if(!(l instanceof this.ctor)&&l instanceof o){var f=l.$type.toObject(l,a);return f["@type"]=l.$type.fullName,f}return this.toObject(l,a)}}},{21:21}],42:[function(t,n,s){n.exports=d;var i=t(39),o,l=i.LongBits,a=i.base64,u=i.utf8;function c(b,v,S){this.fn=b,this.len=v,this.next=e,this.val=S}function f(){}function h(b){this.head=b.head,this.tail=b.tail,this.len=b.len,this.next=b.states}function d(){this.len=0,this.head=new c(f,0,0),this.tail=this.head,this.states=null}d.create=i.Buffer?function(){return(d.create=function(){return new o})()}:function(){return new d},d.alloc=function(b){return new i.Array(b)},i.Array!==Array&&(d.alloc=i.pool(d.alloc,i.Array.prototype.subarray)),d.prototype._push=function(b,v,S){return this.tail=this.tail.next=new c(b,v,S),this.len+=v,this};function p(b,v,S){v[S]=b&255}function g(b,v,S){for(;b>127;)v[S++]=b&127|128,b>>>=7;v[S]=b}function m(b,v){this.len=b,this.next=e,this.val=v}m.prototype=Object.create(c.prototype),m.prototype.fn=g,d.prototype.uint32=function(b){return this.len+=(this.tail=this.tail.next=new m((b=b>>>0)<128?1:b<16384?2:b<2097152?3:b<268435456?4:5,b)).len,this},d.prototype.int32=function(b){return b<0?this._push(y,10,l.fromNumber(b)):this.uint32(b)},d.prototype.sint32=function(b){return this.uint32((b<<1^b>>31)>>>0)};function y(b,v,S){for(;b.hi;)v[S++]=b.lo&127|128,b.lo=(b.lo>>>7|b.hi<<25)>>>0,b.hi>>>=7;for(;b.lo>127;)v[S++]=b.lo&127|128,b.lo=b.lo>>>7;v[S++]=b.lo}d.prototype.uint64=function(b){var v=l.from(b);return this._push(y,v.length(),v)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(b){var v=l.from(b).zzEncode();return this._push(y,v.length(),v)},d.prototype.bool=function(b){return this._push(p,1,b?1:0)};function w(b,v,S){v[S]=b&255,v[S+1]=b>>>8&255,v[S+2]=b>>>16&255,v[S+3]=b>>>24}d.prototype.fixed32=function(b){return this._push(w,4,b>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(b){var v=l.from(b);return this._push(w,4,v.lo)._push(w,4,v.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(b){return this._push(i.float.writeFloatLE,4,b)},d.prototype.double=function(b){return this._push(i.float.writeDoubleLE,8,b)};var _=i.Array.prototype.set?function(b,v,S){v.set(b,S)}:function(b,v,S){for(var E=0;E<b.length;++E)v[S+E]=b[E]};d.prototype.bytes=function(b){var v=b.length>>>0;if(!v)return this._push(p,1,0);if(i.isString(b)){var S=d.alloc(v=a.length(b));a.decode(b,S,0),b=S}return this.uint32(v)._push(_,v,b)},d.prototype.string=function(b){var v=u.length(b);return v?this.uint32(v)._push(u.write,v,b):this._push(p,1,0)},d.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new c(f,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(f,0,0),this.len=0),this},d.prototype.ldelim=function(){var b=this.head,v=this.tail,S=this.len;return this.reset().uint32(S),S&&(this.tail.next=b.next,this.tail=v,this.len+=S),this},d.prototype.finish=function(){for(var b=this.head.next,v=this.constructor.alloc(this.len),S=0;b;)b.fn(b.val,v,S),S+=b.len,b=b.next;return v},d._configure=function(b){o=b}},{39:39}],43:[function(t,n,s){n.exports=a;var i=t(42);(a.prototype=Object.create(i.prototype)).constructor=a;var o=t(39),l=o.Buffer;function a(){i.call(this)}a.alloc=function(f){return(a.alloc=o._Buffer_allocUnsafe)(f)};var u=l&&l.prototype instanceof Uint8Array&&l.prototype.set.name==="set"?function(f,h,d){h.set(f,d)}:function(f,h,d){if(f.copy)f.copy(h,d,0,f.length);else for(var p=0;p<f.length;)h[d++]=f[p++]};a.prototype.bytes=function(f){o.isString(f)&&(f=o._Buffer_from(f,"base64"));var h=f.length>>>0;return this.uint32(h),h&&this._push(u,h,f),this};function c(f,h,d){f.length<40?o.utf8.write(f,h,d):h.utf8Write(f,d)}a.prototype.string=function(f){var h=l.byteLength(f);return this.uint32(h),h&&this._push(c,h,f),this}},{39:39,42:42}]},{},[19])})()})(zn)),zn.exports}var Uh=Bh();const ir=jh(Uh);let G=ir.Reader,ke=ir.Writer,pe=ir.util;const P=ir.roots["push-server"]||(ir.roots["push-server"]={});P.RequestBatch=(function(){function r(e){if(this.requests=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.requests=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.requests!=null&&e.requests.length)for(var n=0;n<e.requests.length;++n)P.Request.encode(e.requests[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.RequestBatch;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.requests&&s.requests.length||(s.requests=[]),s.requests.push(P.Request.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),P.Request=(function(){function r(t){if(t)for(var n=Object.keys(t),s=0;s<n.length;++s)t[n[s]]!=null&&(this[n[s]]=t[n[s]])}r.prototype.incomingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:pe.oneOfGetter(e=["incomingMessages","channelStats","serverStats"]),set:pe.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=ke.create()),t.incomingMessages!=null&&t.hasOwnProperty("incomingMessages")&&P.IncomingMessagesRequest.encode(t.incomingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&P.ChannelStatsRequest.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&P.ServerStatsRequest.encode(t.serverStats,n.uint32(26).fork()).ldelim(),n},r.decode=function(t,n){t instanceof G||(t=G.create(t));for(var s=n===void 0?t.len:t.pos+n,i=new P.Request;t.pos<s;){var o=t.uint32();switch(o>>>3){case 1:i.incomingMessages=P.IncomingMessagesRequest.decode(t,t.uint32());break;case 2:i.channelStats=P.ChannelStatsRequest.decode(t,t.uint32());break;case 3:i.serverStats=P.ServerStatsRequest.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return i},r})(),P.IncomingMessagesRequest=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.messages=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)P.IncomingMessage.encode(e.messages[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.IncomingMessagesRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(P.IncomingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),P.IncomingMessage=(function(){function r(e){if(this.receivers=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.receivers=pe.emptyArray,r.prototype.sender=null,r.prototype.body="",r.prototype.expiry=0,r.prototype.type="",r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.receivers!=null&&e.receivers.length)for(var n=0;n<e.receivers.length;++n)P.Receiver.encode(e.receivers[n],t.uint32(10).fork()).ldelim();return e.sender!=null&&e.hasOwnProperty("sender")&&P.Sender.encode(e.sender,t.uint32(18).fork()).ldelim(),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(26).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(32).uint32(e.expiry),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(42).string(e.type),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.IncomingMessage;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.receivers&&s.receivers.length||(s.receivers=[]),s.receivers.push(P.Receiver.decode(e,e.uint32()));break;case 2:s.sender=P.Sender.decode(e,e.uint32());break;case 3:s.body=e.string();break;case 4:s.expiry=e.uint32();break;case 5:s.type=e.string();break;default:e.skipType(i&7);break}}return s},r})(),P.ChannelStatsRequest=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.channels=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)P.ChannelId.encode(e.channels[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ChannelStatsRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.channels&&s.channels.length||(s.channels=[]),s.channels.push(P.ChannelId.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),P.ChannelId=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=pe.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=pe.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ChannelId;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.isPrivate=e.bool();break;case 3:s.signature=e.bytes();break;default:e.skipType(i&7);break}}return s},r})(),P.ServerStatsRequest=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ServerStatsRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){default:e.skipType(i&7);break}}return s},r})(),P.Sender=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.type=0,r.prototype.id=pe.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(8).int32(e.type),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(18).bytes(e.id),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.Sender;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.type=e.int32();break;case 2:s.id=e.bytes();break;default:e.skipType(i&7);break}}return s},r})(),P.SenderType=(function(){var r={},e=Object.create(r);return e[r[0]="UNKNOWN"]=0,e[r[1]="CLIENT"]=1,e[r[2]="BACKEND"]=2,e})(),P.Receiver=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=pe.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=pe.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.Receiver;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.isPrivate=e.bool();break;case 3:s.signature=e.bytes();break;default:e.skipType(i&7);break}}return s},r})(),P.ResponseBatch=(function(){function r(e){if(this.responses=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.responses=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.responses!=null&&e.responses.length)for(var n=0;n<e.responses.length;++n)P.Response.encode(e.responses[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ResponseBatch;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.responses&&s.responses.length||(s.responses=[]),s.responses.push(P.Response.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),P.Response=(function(){function r(t){if(t)for(var n=Object.keys(t),s=0;s<n.length;++s)t[n[s]]!=null&&(this[n[s]]=t[n[s]])}r.prototype.outgoingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:pe.oneOfGetter(e=["outgoingMessages","channelStats","serverStats"]),set:pe.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=ke.create()),t.outgoingMessages!=null&&t.hasOwnProperty("outgoingMessages")&&P.OutgoingMessagesResponse.encode(t.outgoingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&P.ChannelStatsResponse.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&P.JsonResponse.encode(t.serverStats,n.uint32(26).fork()).ldelim(),n},r.decode=function(t,n){t instanceof G||(t=G.create(t));for(var s=n===void 0?t.len:t.pos+n,i=new P.Response;t.pos<s;){var o=t.uint32();switch(o>>>3){case 1:i.outgoingMessages=P.OutgoingMessagesResponse.decode(t,t.uint32());break;case 2:i.channelStats=P.ChannelStatsResponse.decode(t,t.uint32());break;case 3:i.serverStats=P.JsonResponse.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return i},r})(),P.OutgoingMessagesResponse=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.messages=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)P.OutgoingMessage.encode(e.messages[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.OutgoingMessagesResponse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(P.OutgoingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),P.OutgoingMessage=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=pe.newBuffer([]),r.prototype.body="",r.prototype.expiry=0,r.prototype.created=0,r.prototype.sender=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(18).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(24).uint32(e.expiry),e.created!=null&&e.hasOwnProperty("created")&&t.uint32(37).fixed32(e.created),e.sender!=null&&e.hasOwnProperty("sender")&&P.Sender.encode(e.sender,t.uint32(42).fork()).ldelim(),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.OutgoingMessage;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.body=e.string();break;case 3:s.expiry=e.uint32();break;case 4:s.created=e.fixed32();break;case 5:s.sender=P.Sender.decode(e,e.uint32());break;default:e.skipType(i&7);break}}return s},r})(),P.ChannelStatsResponse=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.channels=pe.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ke.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)P.ChannelStats.encode(e.channels[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ChannelStatsResponse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.channels&&s.channels.length||(s.channels=[]),s.channels.push(P.ChannelStats.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r})(),P.ChannelStats=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=pe.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.isOnline=!1,r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.isOnline!=null&&e.hasOwnProperty("isOnline")&&t.uint32(24).bool(e.isOnline),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.ChannelStats;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.id=e.bytes();break;case 2:s.isPrivate=e.bool();break;case 3:s.isOnline=e.bool();break;default:e.skipType(i&7);break}}return s},r})(),P.JsonResponse=(function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.json="",r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ke.create()),e.json!=null&&e.hasOwnProperty("json")&&t.uint32(10).string(e.json),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new P.JsonResponse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.json=e.string();break;default:e.skipType(i&7);break}}return s},r})();const $h=P.ResponseBatch,Ho=P.RequestBatch,Wh=P.IncomingMessage,Jo=P.Receiver;class Zo{_logger=null;_connected=!1;_connectionType;_disconnectCode=0;_disconnectReason="";_parent;_callbacks;constructor(e){this._parent=e.parent,this._connectionType=te.Undefined,this._callbacks={onOpen:C.isFunction(e.onOpen)?e.onOpen:()=>{},onDisconnect:C.isFunction(e.onDisconnect)?e.onDisconnect:()=>{},onError:C.isFunction(e.onError)?e.onError:()=>{},onMessage:C.isFunction(e.onMessage)?e.onMessage:()=>{}}}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}destroy(){}get connected(){return this._connected}set connected(e){e!=this._connected&&(this._connected=e,this._connected?this._callbacks.onOpen():this._callbacks.onDisconnect({code:this.disconnectCode,reason:this.disconnectReason}))}get disconnectCode(){return this._disconnectCode}get disconnectReason(){return this._disconnectReason}get connectionPath(){return this._parent.getConnectionPath(this._connectionType)}}class qh extends Zo{_socket;_onSocketOpenHandler;_onSocketCloseHandler;_onSocketErrorHandler;_onSocketMessageHandler;constructor(e){super(e),this._connectionType=te.WebSocket,this._socket=null,this._onSocketOpenHandler=this._onSocketOpen.bind(this),this._onSocketCloseHandler=this._onSocketClose.bind(this),this._onSocketErrorHandler=this._onSocketError.bind(this),this._onSocketMessageHandler=this._onSocketMessage.bind(this)}destroy(){super.destroy(),this._socket&&(this._socket.close(),this._socket=null)}connect(){if(this._socket){if(this._socket.readyState===1)return;this.clearEventListener(),this._socket.close(),this._socket=null}this._createSocket()}get socket(){return this._socket}disconnect(e,t){this._socket!==null&&(this.clearEventListener(),this._socket.close(e,t)),this._socket=null,this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}send(e){return!this._socket||this._socket.readyState!==1?(this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: WebSocket is not connected`)),!1):(this._socket.send(e),!0)}_onSocketOpen(){this.connected=!0}_onSocketClose(e){this._socket=null,this._disconnectCode=Number(e.code),this._disconnectReason=e.reason,this.connected=!1}_onSocketError(e){this._callbacks.onError(new Error(`Socket error: ${e}`))}_onSocketMessage(e){this._callbacks.onMessage(e.data)}clearEventListener(){this._socket&&(this._socket.removeEventListener("open",this._onSocketOpenHandler),this._socket.removeEventListener("close",this._onSocketCloseHandler),this._socket.removeEventListener("error",this._onSocketErrorHandler),this._socket.removeEventListener("message",this._onSocketMessageHandler))}_createSocket(){if(this._socket)throw new Error("Socket already exists");if(!this.connectionPath)throw new Error("Websocket connection path is not defined");this._socket=new WebSocket(this.connectionPath),this._socket.binaryType="arraybuffer",this._socket.addEventListener("open",this._onSocketOpenHandler),this._socket.addEventListener("close",this._onSocketCloseHandler),this._socket.addEventListener("error",this._onSocketErrorHandler),this._socket.addEventListener("message",this._onSocketMessageHandler)}}const Vh=60;class zh extends Zo{_active;_requestTimeout;_failureTimeout;_xhr;_requestAborted;constructor(e){super(e),this._active=!1,this._connectionType=te.LongPolling,this._requestTimeout=null,this._failureTimeout=null,this._xhr=this.createXhr(),this._requestAborted=!1}connect(){this._active=!0,this.performRequest()}disconnect(e,t){this._active=!1,this.clearTimeOut(),this._xhr&&(this._requestAborted=!0,this._xhr.abort()),this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}performRequest(){if(this._active){if(!this.connectionPath)throw new Error("Long polling connection path is not defined");this._xhr.readyState!==0&&this._xhr.readyState!==4||(this.clearTimeOut(),this._failureTimeout=setTimeout(()=>{this.connected=!0},5e3),this._requestTimeout=setTimeout(this.onRequestTimeout.bind(this),Vh*1e3),this._xhr.open("GET",this.connectionPath),this._xhr.send())}}onRequestTimeout(){this._requestAborted=!0,this._xhr.abort(),this.performRequest()}onXhrReadyStateChange(){this._xhr.readyState===4&&((!this._requestAborted||this._xhr.status==200)&&this.onResponse(this._xhr.response),this._requestAborted=!1)}send(e){const t=this._parent.getPublicationPath();if(!t)return this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: publication path is empty`)),!1;const n=new XMLHttpRequest;return n.open("POST",t),n.send(e),!0}onResponse(e){if(this.clearTimeOut(),this._xhr.status===200)this.connected=!0,C.isStringFilled(e)||e instanceof ArrayBuffer?this._callbacks.onMessage(e):this._parent.session.mid=null,this.performRequest();else if(this._xhr.status===304){if(this.connected=!0,this._xhr.getResponseHeader("Expires")==="Thu, 01 Jan 1973 11:11:01 GMT"){const t=this._xhr.getResponseHeader("Last-Message-Id");C.isStringFilled(t)&&this._parent.setLastMessageId(t||"")}this.performRequest()}else this._callbacks.onError(new Error("Could not connect to the server")),this.connected=!1}clearTimeOut(){this._failureTimeout&&(clearTimeout(this._failureTimeout),this._failureTimeout=null),this._requestTimeout&&(clearTimeout(this._requestTimeout),this._requestTimeout=null)}createXhr(){const e=new XMLHttpRequest;return this._parent.isProtobufSupported()&&!this._parent.isJsonRpc()&&(e.responseType="arraybuffer"),e.addEventListener("readystatechange",this.onXhrReadyStateChange.bind(this)),e}}const or=19,Go=1800,Hh=5e3,Jh=60*1e3,Yo=10,Ko=10,Zh="ping",Gh="pong",Qo="bx-pull-session",Yh=20,Xo={api:{},channels:{},publicChannels:{},server:{timeShift:0},clientId:null,jwt:null,exp:0};class ea{_logger=null;_restClient;_status;_context;_guestMode;_guestUserId;_userId;_configGetMethod;_getPublicListMethod;_siteId;_enabled;_unloading=!1;_starting=!1;_debug=!1;_connectionAttempt=0;_connectionType=te.WebSocket;_skipStorageInit;_skipCheckRevision;_subscribers={};_watchTagsQueue=new Map;_watchUpdateInterval=174e4;_watchForceUpdateInterval=5e3;_configTimestamp=0;_session={mid:null,tag:null,time:null,history:{},lastMessageIds:[],messageCount:0};_connectors={[te.Undefined]:null,[te.WebSocket]:null,[te.LongPolling]:null};_isSecure;_config=null;_storage=null;_sharedConfig;_channelManager;_jsonRpcAdapter=null;_reconnectTimeout=null;_restartTimeout=null;_restoreWebSocketTimeout=null;_checkInterval=null;_offlineTimeout=null;_watchUpdateTimeout=null;_pingWaitTimeout=null;_isManualDisconnect=!1;_loggingEnabled=!1;_onPingTimeoutHandler;_userStatusCallbacks={};_connectPromise=null;_startingPromise=null;constructor(e){this._restClient=e.b24,this._status=Re.Offline,this._context="master",e.restApplication&&(typeof e.configGetMethod>"u"&&(e.configGetMethod="pull.application.config.get"),typeof e.skipCheckRevision>"u"&&(e.skipCheckRevision=!0),C.isStringFilled(e.restApplication)&&(e.siteId=e.restApplication),e.serverEnabled=!0),this._guestMode=e.guestMode?W.toBoolean(e.guestMode):!1,this._guestUserId=e.guestUserId?W.toInteger(e.guestUserId):0,this._guestMode&&this._guestUserId>0?this._userId=this._guestUserId:(this._guestMode=!1,this._userId=e.userId?W.toInteger(e.userId):0),this._siteId=e.siteId??"none",this._enabled=C.isUndefined(e.serverEnabled)?!0:e.serverEnabled===!0,this._configGetMethod=C.isStringFilled(e.configGetMethod)?e.configGetMethod||"":"pull.config.get",this._getPublicListMethod=C.isStringFilled(e.getPublicListMethod)?e.getPublicListMethod||"":"pull.channel.public.list",this._skipStorageInit=e.skipStorageInit===!0,this._skipCheckRevision=e.skipCheckRevision===!0,C.isUndefined(e.configTimestamp)||(this._configTimestamp=W.toInteger(e.configTimestamp)),this._isSecure=document?.location.href.indexOf("https")===0,this._userId&&!this._skipStorageInit&&(this._storage=new Vo({userId:this._userId,siteId:this._siteId})),this._sharedConfig=new Fh({onWebSocketBlockChanged:this.onWebSocketBlockChanged.bind(this),storage:this._storage}),this._channelManager=new xh({b24:this._restClient,getPublicListMethod:this._getPublicListMethod}),this._loggingEnabled=this._sharedConfig.isLoggingEnabled(),this._onPingTimeoutHandler=this.onPingTimeout.bind(this)}setLogger(e){this._logger=e,this._jsonRpcAdapter?.setLogger(this.getLogger()),this._storage?.setLogger(this.getLogger()),this._sharedConfig.setLogger(this.getLogger()),this._channelManager.setLogger(this.getLogger()),this._connectors.webSocket?.setLogger(this.getLogger()),this._connectors.longPolling?.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}destroy(){this.stop(Se.NORMAL_CLOSURE,"manual stop"),this.onBeforeUnload()}init(){this._connectors.webSocket=new qh({parent:this,onOpen:this.onWebSocketOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onWebSocketDisconnect.bind(this),onError:this.onWebSocketError.bind(this)}),this._connectors.longPolling=new zh({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()?te.WebSocket:te.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 Mh({connector:this._connectors.webSocket,handlers:{"incoming.message":this.handleRpcIncomingMessage.bind(this)}})}get connector(){return this._connectors[this._connectionType]}get status(){return this._status}set status(e){this._status!==e&&(this._status=e,this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),e===Re.Offline?this.sendPullStatusDelayed(e,Hh):this.sendPullStatus(e))}get session(){return this._session}subscribe(e){if(!C.isPlainObject(e))return this.attachCommandHandler(e);if(e=e,e.type=e.type||Le.Server,e.command=e.command||null,e.type==Le.Server||e.type==Le.Client){if(typeof e.moduleId>"u")throw new TypeError(`${W.getDateForLog()}: Pull.subscribe: parameter moduleId is not specified`);return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),e.command?(typeof this._subscribers[e.type][e.moduleId].commands[e.command]>"u"&&(this._subscribers[e.type][e.moduleId].commands[e.command]=[]),this._subscribers[e.type][e.moduleId].commands[e.command].push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||typeof e.command>"u"||e.command===null||(this._subscribers[e.type][e.moduleId].commands[e.command]=this._subscribers[e.type][e.moduleId].commands[e.command].filter(t=>t!==e.callback))}):(this._subscribers[e.type][e.moduleId].callbacks.push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||(this._subscribers[e.type][e.moduleId].callbacks=this._subscribers[e.type][e.moduleId].callbacks.filter(t=>t!==e.callback))})}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].push(e.callback),()=>{typeof e.type>"u"||(this._subscribers[e.type]=this._subscribers[e.type].filter(t=>t!==e.callback))}}attachCommandHandler(e){if(typeof e.getModuleId!="function"||typeof e.getModuleId()!="string")return this.getLogger().error(`${W.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string.`),()=>{};let t=Le.Server;return typeof e.getSubscriptionType=="function"&&(t=e.getSubscriptionType()),this.subscribe({type:t,moduleId:e.getModuleId(),callback:n=>{let s=null;if(typeof e.getMap=="function"){const i=e.getMap();if(i&&typeof i=="object"){const o=i[n.command];typeof o=="function"?s=o.bind(e):typeof o=="string"&&typeof e[o]=="function"&&(s=e[o].bind(e))}}if(!s){const i=`handle${W.capitalize(n.command)}`;typeof e[i]=="function"&&(s=e[i].bind(e))}s&&(this._debug&&this._context!=="master"&&this.getLogger().warn(`${W.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,n),s(n.params,n.extra,n.command))}})}async start(e=null){let t=!0;if(this.isConnected())return Promise.resolve(!0);if(this._starting&&this._startingPromise)return this._startingPromise;if(!this._userId)throw new Error("Not set userId");if(this._siteId==="none")throw new Error("Not set siteId");let n=!1;if(e&&C.isPlainObject(e)&&(typeof e?.skipReconnectToLastSession<"u"&&(n=e.skipReconnectToLastSession,delete e.skipReconnectToLastSession),this._config=e,t=!1),!this._enabled)return Promise.reject({ex:{error:"PULL_DISABLED",error_description:"Push & Pull server is disabled"}});const s=Date.now();let i;return!n&&this._storage&&(i=this._storage.get(Qo,null)),C.isPlainObject(i)&&i.hasOwnProperty("ttl")&&i.ttl>=s&&(this._session.mid=i.mid),this._starting=!0,this._startingPromise=new Promise((o,l)=>{this.loadConfig("client_start").then(a=>{this.setConfig(a,t),this.init(),this.updateWatch(!0),this.startCheckConfig(),this.connect().then(()=>o(!0),u=>l(u))}).catch(a=>{this._starting=!1,this.status=Re.Offline,this.stopCheckConfig(),this.getLogger().error(`${W.getDateForLog()}: Pull: could not read push-server config `,a),l(a)})})}restart(e=Se.NORMAL_CLOSURE,t="manual restart"){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),this.getLogger().log(`${W.getDateForLog()}: Pull: restarting with code ${e}`),this.disconnect(e,t),this._storage&&this._storage.remove(Ne.PullConfig),this._config=null;const n=`${e}_${t.replaceAll(" ","_")}`;this.loadConfig(n).then(s=>{this.setConfig(s,!0),this.updateWatch(),this.startCheckConfig(),this.connect().catch(i=>{this.getLogger().error(i)})},s=>{this.getLogger().error(`${W.getDateForLog()}: Pull: could not read push-server config `,s),this.status=Re.Offline,this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),(s?.status==401||s?.status==403)&&(this.stopCheckConfig(),this.onCustomEvent("onPullError",["AUTHORIZE_ERROR"]))})}stop(e=Se.NORMAL_CLOSURE,t="manual stop"){this.disconnect(e,t),this.stopCheckConfig()}reconnect(e,t,n=1){this.disconnect(e,t),this.scheduleReconnect(n)}setLastMessageId(e){this._session.mid=e}async sendMessage(e,t,n,s,i){const o={userList:e,body:{module_id:t,command:n,params:s},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.Publish,o):this.sendMessageBatch([o])}async sendMessageToChannels(e,t,n,s,i){const o={channelList:e,body:{module_id:t,command:n,params:s},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.Publish,o):this.sendMessageBatch([o])}capturePullEvent(e=!0){this._debug=e}enableLogging(e=!0){this._sharedConfig.setLoggingEnabled(e),this._loggingEnabled=e}async listChannels(){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.ListChannels,{})||Promise.reject(new Error("jsonRpcAdapter not init"))}async getUsersLastSeen(e){if(!C.isArray(e)||!e.every(n=>typeof n=="number"))throw new Error("userList must be an array of numbers");const t={};return new Promise((n,s)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.GetUsersLastSeen,{userList:e}).then(i=>{const o=[];for(let a=0;a<e.length;a++)i.hasOwnProperty(e[a])||o.push(e[a]);if(o.length===0)return n(t);const l={userIds:o,sendToQueueSever:!0};this._restClient.callMethod("pull.api.user.getLastSeen",l).then(a=>{const u=a.getData().result;for(const c in u)t[Number(c)]=Number(u[c]);return n(t)}).catch(a=>{this.getLogger().error(a),s(a)})}).catch(i=>{this.getLogger().error(i),s(i)})})}async ping(e=5){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.Ping,{},e)}async subscribeUserStatusChange(e,t){return new Promise((n,s)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.SubscribeStatusChange,{userId:e}).then(()=>(this._userStatusCallbacks[e]||(this._userStatusCallbacks[e]=[]),C.isFunction(t)&&this._userStatusCallbacks[e].push(t),n())).catch(i=>s(i))})}async unsubscribeUserStatusChange(e,t){return this._userStatusCallbacks[e]&&(this._userStatusCallbacks[e]=this._userStatusCallbacks[e].filter(n=>n!==t),this._userStatusCallbacks[e].length===0)?this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.UnsubscribeStatusChange,{userId:e}):Promise.resolve()}getRevision(){return this._config&&this._config.api?this._config.api.revision_web:null}getServerVersion(){return this._config&&this._config.server?this._config.server.version:0}getServerMode(){return this._config&&this._config.server?this._config.server.mode:null}getConfig(){return this._config}getDebugInfo(){if(!JSON||!JSON.stringify)return{};let e;this._config&&this._config.channels?e={ChannelID:this._config.channels.private?.id||"n/a",ChannelDie:this._config.channels.private?.end||"n/a",ChannelDieShared:this._config.channels.shared?.end||"n/a"}:e={ConfigError:"config is not loaded"};let t="-";return this._connectors.webSocket&&this._connectors.webSocket?.socket&&(this.isJsonRpc()?t="json-rpc":t=this._connectors.webSocket?.socket?.url.search("binaryMode=true")!=-1?"protobuf":"text"),{UserId:this._userId+(this._userId>0?"":"(guest)"),"Guest userId":this._guestMode&&this._guestUserId!==0?this._guestUserId:"-","Browser online":navigator.onLine?"Y":"N",Connect:this.isConnected()?"Y":"N","Server type":this.isSharedMode()?"cloud":"local","WebSocket supported":this.isWebSocketSupported()?"Y":"N","WebSocket connected":this._connectors.webSocket&&this._connectors.webSocket.connected?"Y":"N","WebSocket mode":t,"Try connect":this._reconnectTimeout?"Y":"N","Try number":this._connectionAttempt,Path:this.connector?.connectionPath||"-",...e,"Last message":this._session.mid||"-","Session history":this._session.history,"Watch tags":this._watchTagsQueue.entries()}}getConnectionPath(e){let t;const n={};switch(e){case te.WebSocket:t=this._isSecure?this._config?.server.websocket_secure:this._config?.server.websocket;break;case te.LongPolling:t=this._isSecure?this._config?.server.long_pooling_secure:this._config?.server.long_polling;break;default:throw new Error(`Unknown connection type ${e}`)}if(!C.isStringFilled(t))throw new Error("Empty path");if(typeof this._config?.jwt=="string"&&this._config?.jwt!=="")n.token=this._config?.jwt;else{const s=[];if(this._config?.channels?.private&&s.push(this._config.channels.private?.id||""),this._config?.channels.private?.id&&s.push(this._config.channels.private.id),this._config?.channels.shared?.id&&s.push(this._config.channels.shared.id),s.length===0)throw new Error("Empty channels");n.CHANNEL_ID=s.join("/")}if(this.isJsonRpc()?n.jsonRpc="true":this.isProtobufSupported()&&(n.binaryMode="true"),this.isSharedMode()){if(!this._config?.clientId)throw new Error("Push-server is in shared mode, but clientId is not set");n.clientId=this._config.clientId}return this._session.mid&&(n.mid=this._session.mid),this._session.tag&&(n.tag=this._session.tag),this._session.time&&(n.time=this._session.time),n.revision=or,`${t}?${W.buildQueryString(n)}`}getPublicationPath(){const e=this._isSecure?this._config?.server.publish_secure:this._config?.server.publish;if(!e)return"";const t=[];this._config?.channels.private?.id&&t.push(this._config.channels.private.id),this._config?.channels.shared?.id&&t.push(this._config.channels.shared.id);const n={CHANNEL_ID:t.join("/")};return e+"?"+W.buildQueryString(n)}isConnected(){return this.connector?this.connector.connected:!1}isWebSocketSupported(){return typeof window.WebSocket<"u"}isWebSocketAllowed(){return this._sharedConfig.isWebSocketBlocked()?!1:this.isWebSocketEnabled()}isWebSocketEnabled(){return!this.isWebSocketSupported()||!this._config||!this._config.server?!1:this._config.server.websocket_enabled}isPublishingSupported(){return this.getServerVersion()>3}isPublishingEnabled(){return this.isPublishingSupported()?this._config?.server.publish_enabled===!0:!1}isProtobufSupported(){return this.getServerVersion()==4&&!Ri.isIE()}isJsonRpc(){return this.getServerVersion()>=5}isSharedMode(){return this.getServerMode()===Sn.Shared}emit(e){if(e.type==Le.Server||e.type==Le.Client){if(typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof e.moduleId>"u")throw new TypeError(`${W.getDateForLog()}: Pull.emit: parameter moduleId is not specified`);return typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),this._subscribers[e.type][e.moduleId].callbacks.length>0&&this._subscribers[e.type][e.moduleId].callbacks.forEach(t=>{t(e.data,{type:e.type,moduleId:e.moduleId})}),!(typeof e.data>"u")&&!(typeof e.data.command>"u")&&this._subscribers[e.type][e.moduleId].commands[e.data.command]&&this._subscribers[e.type][e.moduleId].commands[e.data.command].length>0&&this._subscribers[e.type][e.moduleId].commands[e.data.command].forEach(t=>{typeof e.data>"u"||t(e.data.params,e.data.extra,e.data.command,{type:e.type,moduleId:e.moduleId})}),!0}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].length<=0||this._subscribers[e.type].forEach(t=>{t(e.data,{type:e.type})}),!0}broadcastMessage(e){const t=e.module_id=e.module_id.toLowerCase(),n=e.command;e.extra||(e.extra={}),e.extra.server_time_unix&&(e.extra.server_time_ago=(Date.now()-e.extra.server_time_unix*1e3)/1e3-(this._config?.server.timeShift||0),e.extra.server_time_ago=Math.max(e.extra.server_time_ago,0)),this.logMessage(e);try{e.extra.sender&&e.extra.sender.type===Er.Client?(this.onCustomEvent("onPullClientEvent-"+t,[n,e.params,e.extra],!0),this.onCustomEvent("onPullClientEvent",[t,n,e.params,e.extra],!0),this.emit({type:Le.Client,moduleId:t,data:{command:n,params:C.clone(e.params),extra:C.clone(e.extra)}})):t==="pull"?this.handleInternalPullEvent(n,e):t=="online"?((e?.extra?.server_time_ago||0)<240&&(this.onCustomEvent("onPullOnlineEvent",[n,e.params,e.extra],!0),this.emit({type:Le.Online,data:{command:n,params:C.clone(e.params),extra:C.clone(e.extra)}})),n==="userStatusChange"&&this.emitUserStatusChange(e.params.user_id,e.params.online)):(this.onCustomEvent("onPullEvent-"+t,[n,e.params,e.extra],!0),this.onCustomEvent("onPullEvent",[t,n,e.params,e.extra],!0),this.emit({type:Le.Server,moduleId:t,data:{command:n,params:C.clone(e.params),extra:C.clone(e.extra)}}))}catch(s){this.getLogger().warn(`
31
31
  ========= PULL ERROR ===========
32
32
  Error type: broadcastMessages execute error
33
33
  Error event: `,s,`
34
34
  Message: `,e,`
35
35
  ================================
36
- `)}e.extra&&e.extra.revision_web&&this.checkRevision($.toInteger(e.extra.revision_web))}broadcastMessages(e){for(const t of e)this.broadcastMessage(t)}async sendMessageBatch(e){if(!this.isPublishingEnabled())return this.getLogger().error("Client publishing is not supported or is disabled"),Promise.reject(new Error("Client publishing is not supported or is disabled"));if(this.isJsonRpc()){const t=this._jsonRpcAdapter?.createPublishRequest(e);return this.connector?.send(JSON.stringify(t)),Promise.resolve(!0)}else{const t={};for(const n of e)if(typeof n.userList<"u")for(const s of n.userList){const i=Number(s);t[i]=i}this._channelManager?.getPublicIds(Object.values(t)).then(n=>{const s=this.connector?.send(this.encodeMessageBatch(e,n));return Promise.resolve(s)})}}encodeMessageBatch(e,t){const n=[];e.forEach(i=>{const o=i.body;let c=[];if(i.userList&&(c=this.createMessageReceivers(i.userList,t)),i.channelList){if(!C.isArray(i.channelList))throw new TypeError("messageFields.publicChannels must be an array");i.channelList.forEach(u=>{let l,f;if(typeof u=="string"&&u.includes(".")){const h=u.toString().split(".");l=h[0],f=h[1]}else if(typeof u=="object"&&"publicId"in u&&"signature"in u)l=u?.publicId,f=u?.signature;else throw new Error(`Public channel MUST be either a string, formatted like "{publicId}.{signature}" or an object with fields 'publicId' and 'signature'`);c.push(qo.create({id:this.encodeId(l),signature:this.encodeId(f)}))})}const a=Uh.create({receivers:c,body:JSON.stringify(o),expiry:i.expiry||0});n.push(a)});const s=Wo.create({requests:[{incomingMessages:{messages:n}}]});return Wo.encode(s).finish()}createMessageReceivers(e,t){const n=[];for(const s of e){if(!t[s]||!t[s].publicId)throw new Error(`Could not determine public id for user ${s}`);n.push(qo.create({id:this.encodeId(t[s].publicId),signature:this.encodeId(t[s].signature)}))}return n}emitUserStatusChange(e,t){if(this._userStatusCallbacks[e])for(const n of this._userStatusCallbacks[e])n({userId:e,isOnline:t})}restoreUserStatusSubscription(){for(const e in this._userStatusCallbacks)this._userStatusCallbacks.hasOwnProperty(e)&&this._userStatusCallbacks[e].length>0&&this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.SubscribeStatusChange,{userId:e})}async loadConfig(e){if(this._config){if(this.isConfigActual(this._config)&&this.checkRevision(this._config.api.revision_web))return Promise.resolve(this._config);this._config=Object.assign({},Zo)}else{this._config=Object.assign({},Zo);let t;if(this._storage&&(t=this._storage.get(Ne.PullConfig,null)),this.isConfigActual(t)&&this.checkRevision(t.api.revision_web))return Promise.resolve(t);this._storage&&this._storage.remove(Ne.PullConfig)}return new Promise((t,n)=>{this._restClient.getHttpClient().setLogTag(e),this._restClient.callMethod(this._configGetMethod,{CACHE:"N"}).then(s=>{const i=s.getData().result,o=Math.floor((Date.now()-new Date(i.serverTime).getTime())/1e3);delete i.serverTime;const c=Object.assign({},i);c.server.timeShift=o,t(c)}).catch(s=>{(s?.answerError?.error==="AUTHORIZE_ERROR"||s?.answerError?.error==="WRONG_AUTH_TYPE")&&(s.status=403),n(s)}).finally(()=>{this._restClient.getHttpClient().clearLogTag()})})}isConfigActual(e){if(!C.isPlainObject(e)||Number(e.server.config_timestamp)!==this._configTimestamp)return!1;const t=new Date;if(C.isNumber(e.exp)&&e.exp>0&&e.exp<t.getTime()/1e3||Object.keys(e.channels).length===0)return!1;for(const n in e.channels){if(!e.channels.hasOwnProperty(n))continue;const s=e.channels[n];if(new Date(s.end)<t)return!1}return!0}startCheckConfig(){this._checkInterval&&(clearInterval(this._checkInterval),this._checkInterval=null),this._checkInterval=setInterval(this.checkConfig.bind(this),zh)}stopCheckConfig(){this._checkInterval&&clearInterval(this._checkInterval),this._checkInterval=null}checkConfig(){if(this.isConfigActual(this._config)){if(!this.checkRevision($.toInteger(this._config?.api.revision_web)))return!1}else this.logToConsole("Stale config detected. Restarting"),this.restart(Se.CONFIG_EXPIRED,"config expired");return!0}setConfig(e,t){for(const n in e)e.hasOwnProperty(n)&&this._config?.hasOwnProperty(n)&&(this._config[n]=e[n]);if(e.publicChannels&&this.setPublicIds(Object.values(e.publicChannels)),this._configTimestamp=Number(e.server.config_timestamp),this._storage&&t)try{this._storage.set(Ne.PullConfig,e)}catch(n){localStorage&&localStorage.removeItem&&localStorage.removeItem("history"),this.getLogger().error(`${$.getDateForLog()}: Pull: Could not cache config in local storage. Error: `,n)}}setPublicIds(e){this._channelManager.setPublicIds(e)}checkRevision(e){return this._skipCheckRevision?!0:e>0&&e!==sr?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(Se.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[e,sr]),this.emit({type:Le.Revision,data:{server:e,client:sr}}),this.logToConsole(`Pull revision changed from ${sr} to ${e}. Reload required`),!1):!0}disconnect(e,t){this.connector&&(this._isManualDisconnect=!0,this.connector.disconnect(e,t))}restoreWebSocketConnection(){this._connectionType!==te.WebSocket&&this._connectors.webSocket?.connect()}scheduleReconnect(e=0){this._enabled&&(e||(e=this.getConnectionAttemptDelay(this._connectionAttempt)),this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.logToConsole(`Pull: scheduling reconnection in ${e} seconds; attempt # ${this._connectionAttempt}`),this._reconnectTimeout=setTimeout(()=>{this.connect().catch(t=>{this.getLogger().error(t)})},e*1e3))}scheduleRestoreWebSocketConnection(){this.logToConsole(`Pull: scheduling restoration of websocket connection in ${zo} seconds`),!this._restoreWebSocketTimeout&&(this._restoreWebSocketTimeout=setTimeout(()=>{this._restoreWebSocketTimeout=null,this.restoreWebSocketConnection()},zo*1e3))}async connect(){return this._enabled?this.connector?.connected?Promise.resolve():(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.status=Re.Connecting,this._connectionAttempt++,new Promise((e,t)=>{this._connectPromise={resolve:e,reject:t},this.connector?.connect()})):Promise.reject()}scheduleRestart(e,t,n=0){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),n<1&&(n=Math.ceil(Math.random()*30)+5),this._restartTimeout=setTimeout(()=>this.restart(e,t),n*1e3)}handleRpcIncomingMessage(e){this._session.mid=e.mid;const t=e.body;return e.body.extra||(t.extra={}),t.extra.sender=e.sender,"user_params"in e&&C.isPlainObject(e.user_params)&&Object.assign(t.params,e.user_params),"dictionary"in e&&C.isPlainObject(e.dictionary)&&Object.assign(t.params,e.dictionary),this.checkDuplicate(e.mid)&&(this.addMessageToStat(t),this.trimDuplicates(),this.broadcastMessage(t)),this.connector?.send(`mack:${e.mid}`),{}}handleIncomingEvents(e){const t=[];if(e.length===0){this._session.mid=null;return}for(const n of e)this.updateSessionFromEvent(n),!(n.mid&&!this.checkDuplicate(n.mid))&&(this.addMessageToStat(n.text),t.push(n.text));this.trimDuplicates(),this.broadcastMessages(t)}updateSessionFromEvent(e){this._session.mid=e.mid||null,this._session.tag=e.tag||null,this._session.time=e.time||null}handleInternalPullEvent(e,t){switch(e.toUpperCase()){case Kt.CHANNEL_EXPIRE:{if(t.params.action==="reconnect"){const n=t.params?.channel.type;n==="private"&&this._config?.channels?.private&&(this._config.channels.private=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.private}`)),n==="shared"&&this._config?.channels?.shared&&(this._config.channels.shared=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.shared}`)),this.reconnect(Se.CONFIG_REPLACED,"config was replaced")}else this.restart(Se.CHANNEL_EXPIRED,"channel expired received");break}case Kt.CONFIG_EXPIRE:{this.restart(Se.CONFIG_EXPIRED,"config expired received");break}case Kt.SERVER_RESTART:{this.reconnect(Se.SERVER_RESTARTED,"server was restarted",15);break}}}onIncomingMessage(e){if(this.isJsonRpc())e===Jh?this.onJsonRpcPing():this._jsonRpcAdapter?.parseJsonRpcMessage(e);else{const t=this.extractMessages(e);this.handleIncomingEvents(t)}}onLongPollingOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Re.Online,this.logToConsole("Pull: Long polling connection with push-server opened"),this.isWebSocketEnabled()&&this.scheduleRestoreWebSocketConnection(),this._connectPromise&&this._connectPromise.resolve({})}onLongPollingDisconnect(e){this._connectionType===te.LongPolling&&(this.status=Re.Offline),this.logToConsole(`Pull: Long polling connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`),this._isManualDisconnect||this.scheduleReconnect(),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onLongPollingError(e){this._starting=!1,this._connectionType===te.LongPolling&&(this.status=Re.Offline),this.getLogger().error(`${$.getDateForLog()}: Pull: Long polling connection error `,e),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}onWebSocketBlockChanged(e){const t=e.isWebSocketBlocked;t&&this._connectionType===te.WebSocket&&!this.isConnected()?(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._connectionAttempt=0,this._connectionType=te.LongPolling,this.scheduleReconnect(1)):!t&&this._connectionType===te.LongPolling&&(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this._connectionAttempt=0,this._connectionType=te.WebSocket,this.scheduleReconnect(1))}onWebSocketOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Re.Online,this._sharedConfig.setWebSocketBlocked(!1),this._sharedConfig.setLongPollingBlocked(!0),this._connectionType==te.LongPolling&&(this._connectionType=te.WebSocket,this._connectors.longPolling?.disconnect(Se.CONFIG_REPLACED,"Fire at onWebSocketOpen")),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this.logToConsole("Pull: Websocket connection with push-server opened"),this._connectPromise&&this._connectPromise.resolve({}),this.restoreUserStatusSubscription()}onWebSocketDisconnect(e){this._connectionType===te.WebSocket&&(this.status=Re.Offline),this.logToConsole(`Pull: Websocket connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`,!0),this._isManualDisconnect||(e.code==Se.WRONG_CHANNEL_ID?this.scheduleRestart(Se.WRONG_CHANNEL_ID,"wrong channel signature"):this.scheduleReconnect()),this._sharedConfig.setLongPollingBlocked(!0),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onWebSocketError(e){this._starting=!1,this._connectionType===te.WebSocket&&(this.status=Re.Offline),this.getLogger().error(`${$.getDateForLog()}: Pull: WebSocket connection error `,e),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}extractMessages(e){if(e instanceof ArrayBuffer)return this.extractProtobufMessages(e);if(C.isStringFilled(e))return this.extractPlainTextMessages(e);throw new Error("Error pullEvent type")}extractProtobufMessages(e){const t=[];try{const n=Bh.decode(new Uint8Array(e));for(let s=0;s<n.responses.length;s++){const i=n.responses[s];if(i.command!=="outgoingMessages")continue;const o=i.outgoingMessages.messages;for(const c of o){let a;try{a=JSON.parse(c.body)}catch(l){this.getLogger().error(`${$.getDateForLog()}: Pull: Could not parse message body `,l);continue}a.extra||(a.extra={}),a.extra.sender={type:c.sender.type},c.sender.id instanceof Uint8Array&&(a.extra.sender.id=this.decodeId(c.sender.id));const u={mid:this.decodeId(c.id),text:a};t.push(u)}}}catch(n){this.getLogger().error(`${$.getDateForLog()}: Pull: Could not parse message `,n)}return t}extractPlainTextMessages(e){const t=[],n=e.match(/#!NGINXNMS!#(.*?)#!NGINXNME!#/gm);if(n===null){const s=`
36
+ `)}e.extra&&e.extra.revision_web&&this.checkRevision(W.toInteger(e.extra.revision_web))}broadcastMessages(e){for(const t of e)this.broadcastMessage(t)}async sendMessageBatch(e){if(!this.isPublishingEnabled())return this.getLogger().error("Client publishing is not supported or is disabled"),Promise.reject(new Error("Client publishing is not supported or is disabled"));if(this.isJsonRpc()){const t=this._jsonRpcAdapter?.createPublishRequest(e);return this.connector?.send(JSON.stringify(t)),Promise.resolve(!0)}else{const t={};for(const n of e)if(typeof n.userList<"u")for(const s of n.userList){const i=Number(s);t[i]=i}this._channelManager?.getPublicIds(Object.values(t)).then(n=>{const s=this.connector?.send(this.encodeMessageBatch(e,n));return Promise.resolve(s)})}}encodeMessageBatch(e,t){const n=[];e.forEach(i=>{const o=i.body;let l=[];if(i.userList&&(l=this.createMessageReceivers(i.userList,t)),i.channelList){if(!C.isArray(i.channelList))throw new TypeError("messageFields.publicChannels must be an array");i.channelList.forEach(u=>{let c,f;if(typeof u=="string"&&u.includes(".")){const h=u.toString().split(".");c=h[0],f=h[1]}else if(typeof u=="object"&&"publicId"in u&&"signature"in u)c=u?.publicId,f=u?.signature;else throw new Error(`Public channel MUST be either a string, formatted like "{publicId}.{signature}" or an object with fields 'publicId' and 'signature'`);l.push(Jo.create({id:this.encodeId(c),signature:this.encodeId(f)}))})}const a=Wh.create({receivers:l,body:JSON.stringify(o),expiry:i.expiry||0});n.push(a)});const s=Ho.create({requests:[{incomingMessages:{messages:n}}]});return Ho.encode(s).finish()}createMessageReceivers(e,t){const n=[];for(const s of e){if(!t[s]||!t[s].publicId)throw new Error(`Could not determine public id for user ${s}`);n.push(Jo.create({id:this.encodeId(t[s].publicId),signature:this.encodeId(t[s].signature)}))}return n}emitUserStatusChange(e,t){if(this._userStatusCallbacks[e])for(const n of this._userStatusCallbacks[e])n({userId:e,isOnline:t})}restoreUserStatusSubscription(){for(const e in this._userStatusCallbacks)this._userStatusCallbacks.hasOwnProperty(e)&&this._userStatusCallbacks[e].length>0&&this._jsonRpcAdapter?.executeOutgoingRpcCommand(ze.SubscribeStatusChange,{userId:e})}async loadConfig(e){if(this._config){if(this.isConfigActual(this._config)&&this.checkRevision(this._config.api.revision_web))return Promise.resolve(this._config);this._config=Object.assign({},Xo)}else{this._config=Object.assign({},Xo);let t;if(this._storage&&(t=this._storage.get(Ne.PullConfig,null)),this.isConfigActual(t)&&this.checkRevision(t.api.revision_web))return Promise.resolve(t);this._storage&&this._storage.remove(Ne.PullConfig)}return new Promise((t,n)=>{this._restClient.getHttpClient().setLogTag(e),this._restClient.callMethod(this._configGetMethod,{CACHE:"N"}).then(s=>{const i=s.getData().result,o=Math.floor((Date.now()-new Date(i.serverTime).getTime())/1e3);delete i.serverTime;const l=Object.assign({},i);l.server.timeShift=o,t(l)}).catch(s=>{(s?.answerError?.error==="AUTHORIZE_ERROR"||s?.answerError?.error==="WRONG_AUTH_TYPE")&&(s.status=403),n(s)}).finally(()=>{this._restClient.getHttpClient().clearLogTag()})})}isConfigActual(e){if(!C.isPlainObject(e)||Number(e.server.config_timestamp)!==this._configTimestamp)return!1;const t=new Date;if(C.isNumber(e.exp)&&e.exp>0&&e.exp<t.getTime()/1e3||Object.keys(e.channels).length===0)return!1;for(const n in e.channels){if(!e.channels.hasOwnProperty(n))continue;const s=e.channels[n];if(new Date(s.end)<t)return!1}return!0}startCheckConfig(){this._checkInterval&&(clearInterval(this._checkInterval),this._checkInterval=null),this._checkInterval=setInterval(this.checkConfig.bind(this),Jh)}stopCheckConfig(){this._checkInterval&&clearInterval(this._checkInterval),this._checkInterval=null}checkConfig(){if(this.isConfigActual(this._config)){if(!this.checkRevision(W.toInteger(this._config?.api.revision_web)))return!1}else this.logToConsole("Stale config detected. Restarting"),this.restart(Se.CONFIG_EXPIRED,"config expired");return!0}setConfig(e,t){for(const n in e)e.hasOwnProperty(n)&&this._config?.hasOwnProperty(n)&&(this._config[n]=e[n]);if(e.publicChannels&&this.setPublicIds(Object.values(e.publicChannels)),this._configTimestamp=Number(e.server.config_timestamp),this._storage&&t)try{this._storage.set(Ne.PullConfig,e)}catch(n){localStorage&&localStorage.removeItem&&localStorage.removeItem("history"),this.getLogger().error(`${W.getDateForLog()}: Pull: Could not cache config in local storage. Error: `,n)}}setPublicIds(e){this._channelManager.setPublicIds(e)}checkRevision(e){return this._skipCheckRevision?!0:e>0&&e!==or?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(Se.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[e,or]),this.emit({type:Le.Revision,data:{server:e,client:or}}),this.logToConsole(`Pull revision changed from ${or} to ${e}. Reload required`),!1):!0}disconnect(e,t){this.connector&&(this._isManualDisconnect=!0,this.connector.disconnect(e,t))}restoreWebSocketConnection(){this._connectionType!==te.WebSocket&&this._connectors.webSocket?.connect()}scheduleReconnect(e=0){this._enabled&&(e||(e=this.getConnectionAttemptDelay(this._connectionAttempt)),this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.logToConsole(`Pull: scheduling reconnection in ${e} seconds; attempt # ${this._connectionAttempt}`),this._reconnectTimeout=setTimeout(()=>{this.connect().catch(t=>{this.getLogger().error(t)})},e*1e3))}scheduleRestoreWebSocketConnection(){this.logToConsole(`Pull: scheduling restoration of websocket connection in ${Go} seconds`),!this._restoreWebSocketTimeout&&(this._restoreWebSocketTimeout=setTimeout(()=>{this._restoreWebSocketTimeout=null,this.restoreWebSocketConnection()},Go*1e3))}async connect(){return this._enabled?this.connector?.connected?Promise.resolve():(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.status=Re.Connecting,this._connectionAttempt++,new Promise((e,t)=>{this._connectPromise={resolve:e,reject:t},this.connector?.connect()})):Promise.reject()}scheduleRestart(e,t,n=0){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),n<1&&(n=Math.ceil(Math.random()*30)+5),this._restartTimeout=setTimeout(()=>this.restart(e,t),n*1e3)}handleRpcIncomingMessage(e){this._session.mid=e.mid;const t=e.body;return e.body.extra||(t.extra={}),t.extra.sender=e.sender,"user_params"in e&&C.isPlainObject(e.user_params)&&Object.assign(t.params,e.user_params),"dictionary"in e&&C.isPlainObject(e.dictionary)&&Object.assign(t.params,e.dictionary),this.checkDuplicate(e.mid)&&(this.addMessageToStat(t),this.trimDuplicates(),this.broadcastMessage(t)),this.connector?.send(`mack:${e.mid}`),{}}handleIncomingEvents(e){const t=[];if(e.length===0){this._session.mid=null;return}for(const n of e)this.updateSessionFromEvent(n),!(n.mid&&!this.checkDuplicate(n.mid))&&(this.addMessageToStat(n.text),t.push(n.text));this.trimDuplicates(),this.broadcastMessages(t)}updateSessionFromEvent(e){this._session.mid=e.mid||null,this._session.tag=e.tag||null,this._session.time=e.time||null}handleInternalPullEvent(e,t){switch(e.toUpperCase()){case Kt.CHANNEL_EXPIRE:{if(t.params.action==="reconnect"){const n=t.params?.channel.type;n==="private"&&this._config?.channels?.private&&(this._config.channels.private=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.private}`)),n==="shared"&&this._config?.channels?.shared&&(this._config.channels.shared=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.shared}`)),this.reconnect(Se.CONFIG_REPLACED,"config was replaced")}else this.restart(Se.CHANNEL_EXPIRED,"channel expired received");break}case Kt.CONFIG_EXPIRE:{this.restart(Se.CONFIG_EXPIRED,"config expired received");break}case Kt.SERVER_RESTART:{this.reconnect(Se.SERVER_RESTARTED,"server was restarted",15);break}}}onIncomingMessage(e){if(this.isJsonRpc())e===Zh?this.onJsonRpcPing():this._jsonRpcAdapter?.parseJsonRpcMessage(e);else{const t=this.extractMessages(e);this.handleIncomingEvents(t)}}onLongPollingOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Re.Online,this.logToConsole("Pull: Long polling connection with push-server opened"),this.isWebSocketEnabled()&&this.scheduleRestoreWebSocketConnection(),this._connectPromise&&this._connectPromise.resolve({})}onLongPollingDisconnect(e){this._connectionType===te.LongPolling&&(this.status=Re.Offline),this.logToConsole(`Pull: Long polling connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`),this._isManualDisconnect||this.scheduleReconnect(),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onLongPollingError(e){this._starting=!1,this._connectionType===te.LongPolling&&(this.status=Re.Offline),this.getLogger().error(`${W.getDateForLog()}: Pull: Long polling connection error `,e),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}onWebSocketBlockChanged(e){const t=e.isWebSocketBlocked;t&&this._connectionType===te.WebSocket&&!this.isConnected()?(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._connectionAttempt=0,this._connectionType=te.LongPolling,this.scheduleReconnect(1)):!t&&this._connectionType===te.LongPolling&&(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this._connectionAttempt=0,this._connectionType=te.WebSocket,this.scheduleReconnect(1))}onWebSocketOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Re.Online,this._sharedConfig.setWebSocketBlocked(!1),this._sharedConfig.setLongPollingBlocked(!0),this._connectionType==te.LongPolling&&(this._connectionType=te.WebSocket,this._connectors.longPolling?.disconnect(Se.CONFIG_REPLACED,"Fire at onWebSocketOpen")),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this.logToConsole("Pull: Websocket connection with push-server opened"),this._connectPromise&&this._connectPromise.resolve({}),this.restoreUserStatusSubscription()}onWebSocketDisconnect(e){this._connectionType===te.WebSocket&&(this.status=Re.Offline),this.logToConsole(`Pull: Websocket connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`,!0),this._isManualDisconnect||(e.code==Se.WRONG_CHANNEL_ID?this.scheduleRestart(Se.WRONG_CHANNEL_ID,"wrong channel signature"):this.scheduleReconnect()),this._sharedConfig.setLongPollingBlocked(!0),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onWebSocketError(e){this._starting=!1,this._connectionType===te.WebSocket&&(this.status=Re.Offline),this.getLogger().error(`${W.getDateForLog()}: Pull: WebSocket connection error `,e),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}extractMessages(e){if(e instanceof ArrayBuffer)return this.extractProtobufMessages(e);if(C.isStringFilled(e))return this.extractPlainTextMessages(e);throw new Error("Error pullEvent type")}extractProtobufMessages(e){const t=[];try{const n=$h.decode(new Uint8Array(e));for(let s=0;s<n.responses.length;s++){const i=n.responses[s];if(i.command!=="outgoingMessages")continue;const o=i.outgoingMessages.messages;for(const l of o){let a;try{a=JSON.parse(l.body)}catch(c){this.getLogger().error(`${W.getDateForLog()}: Pull: Could not parse message body `,c);continue}a.extra||(a.extra={}),a.extra.sender={type:l.sender.type},l.sender.id instanceof Uint8Array&&(a.extra.sender.id=this.decodeId(l.sender.id));const u={mid:this.decodeId(l.id),text:a};t.push(u)}}}catch(n){this.getLogger().error(`${W.getDateForLog()}: Pull: Could not parse message `,n)}return t}extractPlainTextMessages(e){const t=[],n=e.match(/#!NGINXNMS!#(.*?)#!NGINXNME!#/gm);if(n===null){const s=`
37
37
  ========= PULL ERROR ===========
38
38
  Error type: parseResponse error parsing message
39
39
 
40
40
  Data string: ${e}
41
41
  ================================
42
42
 
43
- `;return this.getLogger().warn(s),[]}for(let s=0;s<n.length;s++){if(n[s]=n[s].substring(12,n[s].length-12),n[s].length<=0)continue;let i;try{i=JSON.parse(n[s])}catch{continue}t.push(i)}return t}decodeId(e){let t="";for(const n of e){const s=n.toString(16);s.length===1&&(t+="0"),t+=s}return t}encodeId(e){if(!e)return new Uint8Array;const t=[];for(let n=0;n<e.length;n+=2)t.push(Number.parseInt(e.slice(n,n+2),16));return new Uint8Array(t)}onOffline(){this.disconnect(Se.NORMAL_CLOSURE,"offline")}onOnline(){this.connect().catch(e=>{this.getLogger().error(e)})}onBeforeUnload(){this._unloading=!0;const e=C.clone(this.session);if(e.ttl=Date.now()+Gh*1e3,this._storage)try{this._storage.set(Jo,JSON.stringify(e))}catch(t){this.getLogger().error(`${$.getDateForLog()}: Pull: Could not save session info in local storage. Error: `,t)}this.scheduleReconnect(15)}sendPullStatusDelayed(e,t){this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),this._offlineTimeout=setTimeout(()=>{this._offlineTimeout=null,this.sendPullStatus(e)},t)}sendPullStatus(e){this._unloading||(this.onCustomEvent("onPullStatus",[e]),this.emit({type:Le.Status,data:{status:e}}))}extendWatch(e,t=!1){this._watchTagsQueue.get(e)||(this._watchTagsQueue.set(e,!0),t&&this.updateWatch(t))}updateWatch(e=!1){this._watchUpdateTimeout&&(clearTimeout(this._watchUpdateTimeout),this._watchUpdateTimeout=null),this._watchUpdateTimeout=setTimeout(()=>{const t=[...this._watchTagsQueue.keys()];t.length>0?this._restClient.callMethod("pull.watch.extend",{tags:t}).then(n=>{const s=n.getData().result;for(const i of s)this.clearWatch(i);this.updateWatch()}).catch(()=>{this.updateWatch()}):this.updateWatch()},e?this._watchForceUpdateInterval:this._watchUpdateInterval)}clearWatch(e){this._watchTagsQueue.delete(e)}onJsonRpcPing(){this.updatePingWaitTimeout(),this.connector?.send(Zh)}updatePingWaitTimeout(){this._pingWaitTimeout&&(clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null),this._pingWaitTimeout=setTimeout(this._onPingTimeoutHandler,Ho*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 ${Ho*2} seconds. Reconnecting`),this.disconnect(Se.STUCK,"connection stuck"),this.scheduleReconnect())}getConnectionAttemptDelay(e){let t;return e<1?t=.5:e<3?t=15:e<5?t=45:e<10?t=600:t=3600,t+t*Math.random()*.2}checkDuplicate(e){return this._session.lastMessageIds.includes(e)?(this.getLogger().warn(`Duplicate message ${e} skipped`),!1):(this._session.lastMessageIds.push(e),!0)}trimDuplicates(){this._session.lastMessageIds.length>Hh&&(this._session.lastMessageIds=this._session.lastMessageIds.slice(-10))}logMessage(e){this._debug&&(e.extra?.sender&&e.extra.sender.type===Sr.Client?this.getLogger().info(`onPullClientEvent-${e.module_id}`,e.command,e.params,e.extra):e.module_id=="online"?this.getLogger().info("onPullOnlineEvent",e.command,e.params,e.extra):this.getLogger().info("onPullEvent",e.module_id,e.command,e.params,e.extra))}logToConsole(e,t=!1){(this._loggingEnabled||t)&&this.getLogger().log(`${$.getDateForLog()}: ${e}`)}addMessageToStat(e){this._session.history[e.module_id]||(this._session.history[e.module_id]={}),this._session.history[e.module_id][e.command]||(this.session.history[e.module_id][e.command]=0),this._session.history[e.module_id][e.command]++,this._session.messageCount++}showNotification(e){this.getLogger().warn(e)}onCustomEvent(e,t,n=!1){}}class Yh{_b24;_logger=null;_isInit=!1;_profile=null;_app=null;_payment=null;_license=null;_currency=null;_appOptions=null;_userOptions=null;_b24PullClient=null;_pullClientUnSubscribe=[];_pullClientModuleId="";constructor(e){this._b24=e,this.setLogger(this._b24.getLogger())}setLogger(e){this._logger=e,this._profile!==null&&this._profile.setLogger(this.getLogger()),this._app!==null&&this._app.setLogger(this.getLogger()),this._payment!==null&&this._payment.setLogger(this.getLogger()),this._license!==null&&this._license.setLogger(this.getLogger()),this._currency!==null&&this._currency.setLogger(this.getLogger()),this._appOptions!==null&&this._appOptions.setLogger(this.getLogger()),this._userOptions!==null&&this._userOptions.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}destroy(){this._destroyPullClient()}async loadData(e=[ee.App,ee.Profile]){const t={[ee.App]:{method:"app.info"},[ee.Profile]:{method:"profile"},[ee.Currency]:[{method:"crm.currency.base.get"},{method:"crm.currency.list"}],[ee.AppOptions]:{method:"app.option.get"},[ee.UserOptions]:{method:"user.option.get"}},n=e.reduce((s,i)=>{if(t[i])if(Array.isArray(t[i]))for(const[o,c]of t[i].entries())s[`get_${i}_${o}`]=c;else s[`get_${i}`]=t[i];return s},{});try{const s=(await this._b24.callBatch(n)).getData();s[`get_${ee.App}`]&&(this._app=await this.parseAppData(s[`get_${ee.App}`]),this._payment=await this.parsePaymentData(s[`get_${ee.App}`]),this._license=await this.parseLicenseData(s[`get_${ee.App}`])),s[`get_${ee.Profile}`]&&(this._profile=await this.parseUserData(s[`get_${ee.Profile}`])),s[`get_${ee.Currency}_0`]&&s[`get_${ee.Currency}_1`]&&(this._currency=await this.parseCurrencyData({currencyBase:s[`get_${ee.Currency}_0`],currencyList:s[`get_${ee.Currency}_1`]})),s[`get_${ee.AppOptions}`]&&(this._appOptions=await this.parseOptionsData("app",s[`get_${ee.AppOptions}`])),s[`get_${ee.UserOptions}`]&&(this._userOptions=await this.parseOptionsData("user",s[`get_${ee.UserOptions}`])),this._isInit=!0}catch(s){throw s instanceof Error?s:(console.error("Error loading data:",s),new Error("Failed to load data"))}}async parseUserData(e){const t=new Oh(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number(e.ID),isAdmin:e.ADMIN===!0,lastName:e?.LAST_NAME||"",name:e?.NAME||"",gender:e?.PERSONAL_GENDER||"",photo:e?.PERSONAL_PHOTO||"",TimeZone:e?.TIME_ZONE||"",TimeZoneOffset:e?.TIME_ZONE_OFFSET}).then(()=>t)}async parseAppData(e){const t=new Ah(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number.parseInt(e.ID),code:e.CODE,version:Number.parseInt(e.VERSION),status:e.STATUS,isInstalled:e.INSTALLED}).then(()=>t)}async parsePaymentData(e){const t=new Ih(this._b24);return t.setLogger(this.getLogger()),t.initData({isExpired:e.PAYMENT_EXPIRED==="Y",days:Number.parseInt(e.DAYS||"0")}).then(()=>t)}async parseLicenseData(e){const t=new Ch(this._b24);return t.setLogger(this.getLogger()),t.initData({languageId:e.LANGUAGE_ID,license:e.LICENSE,licensePrevious:e.LICENSE_PREVIOUS,licenseType:e.LICENSE_TYPE,licenseFamily:e.LICENSE_FAMILY,isSelfHosted:e.LICENSE.includes("selfhosted")}).then(()=>t)}async parseCurrencyData(e){const t=new Nh(this._b24);return t.setLogger(this.getLogger()),t.initData(e).then(()=>t)}async parseOptionsData(e,t){const n=new $n(this._b24,e);return n.setLogger(this.getLogger()),n.initData(t).then(()=>n)}get isInit(){return this._isInit}get forB24Form(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");if(this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return{app_code:this.appInfo.data.code,app_status:this.appInfo.data.status,payment_expired:this.paymentInfo.data.isExpired?"Y":"N",days:this.paymentInfo.data.days,b24_plan:this.licenseInfo.data.license,c_name:this.profileInfo.data.name,c_last_name:this.profileInfo.data.lastName,hostname:this.hostName}}get hostName(){return this._b24.getTargetOrigin()}get profileInfo(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");return this._profile}get appInfo(){if(this.ensureInitialized(),this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return this._app}get paymentInfo(){if(this.ensureInitialized(),this._payment===null)throw new Error("B24HelperManager.paymentInfo not initialized");return this._payment}get licenseInfo(){if(this.ensureInitialized(),this._license===null)throw new Error("B24HelperManager.licenseInfo not initialized");return this._license}get currency(){if(this.ensureInitialized(),this._currency===null)throw new Error("B24HelperManager.currency not initialized");return this._currency}get appOptions(){if(this.ensureInitialized(),this._appOptions===null)throw new Error("B24HelperManager.appOptions not initialized");return this._appOptions}get userOptions(){if(this.ensureInitialized(),this._userOptions===null)throw new Error("B24HelperManager.userOptions not initialized");return this._userOptions}get isSelfHosted(){return this.licenseInfo.data.isSelfHosted}get primaryKeyIncrementValue(){return this.isSelfHosted?1:2}get b24SpecificUrl(){return this.isSelfHosted?{[gt.MainSettings]:"/configs/",[gt.UfList]:"/configs/userfield_list.php",[gt.UfPage]:"/configs/userfield.php"}:{[gt.MainSettings]:"/settings/configs/",[gt.UfList]:"/settings/configs/userfield_list.php",[gt.UfPage]:"/settings/configs/userfield.php"}}usePullClient(e="prefix",t){return this._b24PullClient?this:(this.initializePullClient(typeof t>"u"?this.profileInfo.data.id||0:t,e),this)}initializePullClient(e,t="prefix"){this._b24PullClient=new Go({b24:this._b24,restApplication:this._b24.auth.getUniq(t),userId:e})}subscribePullClient(e,t="application"){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId=t,this._pullClientUnSubscribe.push(this._b24PullClient.subscribe({moduleId:this._pullClientModuleId,callback:e})),this}startPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");this._b24PullClient.start().catch(e=>{this.getLogger().error(`${$.getDateForLog()}: Pull not running`,e)})}getModuleIdPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId}_destroyPullClient(){for(const e of this._pullClientUnSubscribe)e();this._b24PullClient?.destroy(),this._b24PullClient=null}ensureInitialized(){if(!this._isInit)throw new Error("B24HelperManager not initialized")}}const Kh=()=>{let r=!1,e=!1,t=null;return{initB24Helper:async(n,s=[ee.App,ee.Profile])=>(t===null&&(t=new Yh(n)),r?t:t.loadData(s).then(()=>(r=!0,t))),isInitB24Helper:()=>r,destroyB24Helper:()=>{t?.destroy(),t=null,r=!1,e=!1},getB24Helper:()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");return t},usePullClient:()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");t.usePullClient(),e=!0},useSubscribePullClient:(n,s="application")=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.subscribePullClient(n,s)},startPullClient:()=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.startPullClient()}}},Qh=50;let ct=null,xr=!1,jt=null,Yo=!1,jr=[],Ko=!1;function Qo(){window.setTimeout(()=>{if(!xr||ct===null){Qo();return}Xh(),jr=[]},Qh)}function Xh(){if(jt!==null)for(const r of jr)r.reject(jt);if(!(!xr||ct===null))for(const r of jr)r.resolve(ct)}async function ef(){return xr&&ct!==null?Promise.resolve(ct):Yo?(Ko||(Ko=!0,Qo()),new Promise((r,e)=>{jr.push({resolve:r,reject:e})})):(Yo=!0,new Promise((r,e)=>{const t={DOMAIN:null,PROTOCOL:!1,APP_SID:null,LANG:null};if(window.name){const[n,s,i]=window.name.split("|");t.DOMAIN=n,t.PROTOCOL=Number.parseInt(s)===1,t.APP_SID=i,t.LANG=null}(!t.DOMAIN||!t.APP_SID)&&(jt=new Error("Unable to initialize Bitrix24Frame library!"),e(jt)),ct=new jo(t),ct.init().then(()=>{xr=!0,r(ct)}).catch(n=>{jt=n,e(jt)})}))}R.AbstractB24=_t,R.AjaxError=Fe,R.AjaxResult=_r,R.AppFrame=Ro,R.AuthHookManager=Co,R.AuthManager=Lo,R.AuthOAuthManager=Bo,R.B24Frame=jo,R.B24Hook=Bn,R.B24LangList=jn,R.B24LocaleMap=Sh,R.B24OAuth=Th,R.B24PullClientManager=Go,R.Browser=Ai,R.CatalogProductImageType=Li,R.CatalogProductType=Ri,R.CatalogRoundingRuleType=Di,R.CloseReasons=Se,R.ConnectionType=te,R.DataType=Gn,R.DialogManager=Mo,R.EnumAppStatus=Ke,R.EnumBitrix24Edition=Pi,R.EnumBizprocBaseType=Mi,R.EnumBizprocDocumentType=Fi,R.EnumCrmEntityType=Ci,R.EnumCrmEntityTypeId=We,R.EnumCrmEntityTypeShort=mn,R.ListRpcError=wn,R.LoadDataType=ee,R.LoggerBrowser=ye,R.LoggerType=I,R.LsKeys=Ne,R.MessageCommands=X,R.MessageManager=No,R.OptionsManager=Po,R.ParentManager=Do,R.PlacementManager=xo,R.ProductRowDiscountTypeId=Ni,R.PullStatus=Re,R.RestrictionManagerParamsBase=Ii,R.RestrictionManagerParamsForEnterprise=pn,R.Result=qe,R.RpcMethod=ze,R.SenderType=Sr,R.ServerMode=yn,R.SliderManager=Fo,R.StatusDescriptions=xi,R.SubscriptionType=Le,R.SystemCommands=Kt,R.Text=$,R.Type=C,R.TypeOption=Qe,R.TypeSpecificUrl=gt,R.convertBizprocDocumentTypeToCrmEntityTypeId=gl,R.getDocumentId=yl,R.getDocumentType=gn,R.getDocumentTypeForFilter=wl,R.getEnumCrmEntityTypeShort=ml,R.getEnumValue=oa,R.initializeB24Frame=ef,R.isArrayOfArray=ia,R.omit=Yn,R.pick=sa,R.useB24Helper=Kh,R.useFormatter=vh});
43
+ `;return this.getLogger().warn(s),[]}for(let s=0;s<n.length;s++){if(n[s]=n[s].substring(12,n[s].length-12),n[s].length<=0)continue;let i;try{i=JSON.parse(n[s])}catch{continue}t.push(i)}return t}decodeId(e){let t="";for(const n of e){const s=n.toString(16);s.length===1&&(t+="0"),t+=s}return t}encodeId(e){if(!e)return new Uint8Array;const t=[];for(let n=0;n<e.length;n+=2)t.push(Number.parseInt(e.slice(n,n+2),16));return new Uint8Array(t)}onOffline(){this.disconnect(Se.NORMAL_CLOSURE,"offline")}onOnline(){this.connect().catch(e=>{this.getLogger().error(e)})}onBeforeUnload(){this._unloading=!0;const e=C.clone(this.session);if(e.ttl=Date.now()+Yh*1e3,this._storage)try{this._storage.set(Qo,JSON.stringify(e))}catch(t){this.getLogger().error(`${W.getDateForLog()}: Pull: Could not save session info in local storage. Error: `,t)}this.scheduleReconnect(15)}sendPullStatusDelayed(e,t){this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),this._offlineTimeout=setTimeout(()=>{this._offlineTimeout=null,this.sendPullStatus(e)},t)}sendPullStatus(e){this._unloading||(this.onCustomEvent("onPullStatus",[e]),this.emit({type:Le.Status,data:{status:e}}))}extendWatch(e,t=!1){this._watchTagsQueue.get(e)||(this._watchTagsQueue.set(e,!0),t&&this.updateWatch(t))}updateWatch(e=!1){this._watchUpdateTimeout&&(clearTimeout(this._watchUpdateTimeout),this._watchUpdateTimeout=null),this._watchUpdateTimeout=setTimeout(()=>{const t=[...this._watchTagsQueue.keys()];t.length>0?this._restClient.callMethod("pull.watch.extend",{tags:t}).then(n=>{const s=n.getData().result;for(const i of s)this.clearWatch(i);this.updateWatch()}).catch(()=>{this.updateWatch()}):this.updateWatch()},e?this._watchForceUpdateInterval:this._watchUpdateInterval)}clearWatch(e){this._watchTagsQueue.delete(e)}onJsonRpcPing(){this.updatePingWaitTimeout(),this.connector?.send(Gh)}updatePingWaitTimeout(){this._pingWaitTimeout&&(clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null),this._pingWaitTimeout=setTimeout(this._onPingTimeoutHandler,Ko*2*1e3)}clearPingWaitTimeout(){this._pingWaitTimeout&&clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null}onPingTimeout(){this._pingWaitTimeout=null,!(!this._enabled||!this.isConnected())&&(this.getLogger().warn(`No pings are received in ${Ko*2} seconds. Reconnecting`),this.disconnect(Se.STUCK,"connection stuck"),this.scheduleReconnect())}getConnectionAttemptDelay(e){let t;return e<1?t=.5:e<3?t=15:e<5?t=45:e<10?t=600:t=3600,t+t*Math.random()*.2}checkDuplicate(e){return this._session.lastMessageIds.includes(e)?(this.getLogger().warn(`Duplicate message ${e} skipped`),!1):(this._session.lastMessageIds.push(e),!0)}trimDuplicates(){this._session.lastMessageIds.length>Yo&&(this._session.lastMessageIds=this._session.lastMessageIds.slice(-Yo))}logMessage(e){this._debug&&(e.extra?.sender&&e.extra.sender.type===Er.Client?this.getLogger().info(`onPullClientEvent-${e.module_id}`,e.command,e.params,e.extra):e.module_id=="online"?this.getLogger().info("onPullOnlineEvent",e.command,e.params,e.extra):this.getLogger().info("onPullEvent",e.module_id,e.command,e.params,e.extra))}logToConsole(e,t=!1){(this._loggingEnabled||t)&&this.getLogger().log(`${W.getDateForLog()}: ${e}`)}addMessageToStat(e){this._session.history[e.module_id]||(this._session.history[e.module_id]={}),this._session.history[e.module_id][e.command]||(this.session.history[e.module_id][e.command]=0),this._session.history[e.module_id][e.command]++,this._session.messageCount++}showNotification(e){this.getLogger().warn(e)}onCustomEvent(e,t,n=!1){}}class Kh{_b24;_logger=null;_isInit=!1;_profile=null;_app=null;_payment=null;_license=null;_currency=null;_appOptions=null;_userOptions=null;_b24PullClient=null;_pullClientUnSubscribe=[];_pullClientModuleId="";constructor(e){this._b24=e,this.setLogger(this._b24.getLogger())}setLogger(e){this._logger=e,this._profile!==null&&this._profile.setLogger(this.getLogger()),this._app!==null&&this._app.setLogger(this.getLogger()),this._payment!==null&&this._payment.setLogger(this.getLogger()),this._license!==null&&this._license.setLogger(this.getLogger()),this._currency!==null&&this._currency.setLogger(this.getLogger()),this._appOptions!==null&&this._appOptions.setLogger(this.getLogger()),this._userOptions!==null&&this._userOptions.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=ye.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}destroy(){this._destroyPullClient()}async loadData(e=[ee.App,ee.Profile]){const t={[ee.App]:{method:"app.info"},[ee.Profile]:{method:"profile"},[ee.Currency]:[{method:"crm.currency.base.get"},{method:"crm.currency.list"}],[ee.AppOptions]:{method:"app.option.get"},[ee.UserOptions]:{method:"user.option.get"}},n=e.reduce((s,i)=>{if(t[i])if(Array.isArray(t[i]))for(const[o,l]of t[i].entries())s[`get_${i}_${o}`]=l;else s[`get_${i}`]=t[i];return s},{});try{const s=(await this._b24.callBatch(n)).getData();s[`get_${ee.App}`]&&(this._app=await this.parseAppData(s[`get_${ee.App}`]),this._payment=await this.parsePaymentData(s[`get_${ee.App}`]),this._license=await this.parseLicenseData(s[`get_${ee.App}`])),s[`get_${ee.Profile}`]&&(this._profile=await this.parseUserData(s[`get_${ee.Profile}`])),s[`get_${ee.Currency}_0`]&&s[`get_${ee.Currency}_1`]&&(this._currency=await this.parseCurrencyData({currencyBase:s[`get_${ee.Currency}_0`],currencyList:s[`get_${ee.Currency}_1`]})),s[`get_${ee.AppOptions}`]&&(this._appOptions=await this.parseOptionsData("app",s[`get_${ee.AppOptions}`])),s[`get_${ee.UserOptions}`]&&(this._userOptions=await this.parseOptionsData("user",s[`get_${ee.UserOptions}`])),this._isInit=!0}catch(s){throw s instanceof Error?s:(console.error("Error loading data:",s),new Error("Failed to load data"))}}async parseUserData(e){const t=new Ih(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number(e.ID),isAdmin:e.ADMIN===!0,lastName:e?.LAST_NAME||"",name:e?.NAME||"",gender:e?.PERSONAL_GENDER||"",photo:e?.PERSONAL_PHOTO||"",TimeZone:e?.TIME_ZONE||"",TimeZoneOffset:e?.TIME_ZONE_OFFSET}).then(()=>t)}async parseAppData(e){const t=new Ch(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number.parseInt(e.ID),code:e.CODE,version:Number.parseInt(e.VERSION),status:e.STATUS,isInstalled:e.INSTALLED}).then(()=>t)}async parsePaymentData(e){const t=new Nh(this._b24);return t.setLogger(this.getLogger()),t.initData({isExpired:e.PAYMENT_EXPIRED==="Y",days:Number.parseInt(e.DAYS||"0")}).then(()=>t)}async parseLicenseData(e){const t=new Rh(this._b24);return t.setLogger(this.getLogger()),t.initData({languageId:e.LANGUAGE_ID,license:e.LICENSE,licensePrevious:e.LICENSE_PREVIOUS,licenseType:e.LICENSE_TYPE,licenseFamily:e.LICENSE_FAMILY,isSelfHosted:e.LICENSE.includes("selfhosted")}).then(()=>t)}async parseCurrencyData(e){const t=new Lh(this._b24);return t.setLogger(this.getLogger()),t.initData(e).then(()=>t)}async parseOptionsData(e,t){const n=new Vn(this._b24,e);return n.setLogger(this.getLogger()),n.initData(t).then(()=>n)}get isInit(){return this._isInit}get forB24Form(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");if(this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return{app_code:this.appInfo.data.code,app_status:this.appInfo.data.status,payment_expired:this.paymentInfo.data.isExpired?"Y":"N",days:this.paymentInfo.data.days,b24_plan:this.licenseInfo.data.license,c_name:this.profileInfo.data.name,c_last_name:this.profileInfo.data.lastName,hostname:this.hostName}}get hostName(){return this._b24.getTargetOrigin()}get profileInfo(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");return this._profile}get appInfo(){if(this.ensureInitialized(),this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return this._app}get paymentInfo(){if(this.ensureInitialized(),this._payment===null)throw new Error("B24HelperManager.paymentInfo not initialized");return this._payment}get licenseInfo(){if(this.ensureInitialized(),this._license===null)throw new Error("B24HelperManager.licenseInfo not initialized");return this._license}get currency(){if(this.ensureInitialized(),this._currency===null)throw new Error("B24HelperManager.currency not initialized");return this._currency}get appOptions(){if(this.ensureInitialized(),this._appOptions===null)throw new Error("B24HelperManager.appOptions not initialized");return this._appOptions}get userOptions(){if(this.ensureInitialized(),this._userOptions===null)throw new Error("B24HelperManager.userOptions not initialized");return this._userOptions}get isSelfHosted(){return this.licenseInfo.data.isSelfHosted}get primaryKeyIncrementValue(){return this.isSelfHosted?1:2}get b24SpecificUrl(){return this.isSelfHosted?{[mt.MainSettings]:"/configs/",[mt.UfList]:"/configs/userfield_list.php",[mt.UfPage]:"/configs/userfield.php"}:{[mt.MainSettings]:"/settings/configs/",[mt.UfList]:"/settings/configs/userfield_list.php",[mt.UfPage]:"/settings/configs/userfield.php"}}usePullClient(e="prefix",t){return this._b24PullClient?this:(this.initializePullClient(typeof t>"u"?this.profileInfo.data.id||0:t,e),this)}initializePullClient(e,t="prefix"){this._b24PullClient=new ea({b24:this._b24,restApplication:this._b24.auth.getUniq(t),userId:e})}subscribePullClient(e,t="application"){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId=t,this._pullClientUnSubscribe.push(this._b24PullClient.subscribe({moduleId:this._pullClientModuleId,callback:e})),this}startPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");this._b24PullClient.start().catch(e=>{this.getLogger().error(`${W.getDateForLog()}: Pull not running`,e)})}getModuleIdPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId}_destroyPullClient(){for(const e of this._pullClientUnSubscribe)e();this._b24PullClient?.destroy(),this._b24PullClient=null}ensureInitialized(){if(!this._isInit)throw new Error("B24HelperManager not initialized")}}const Qh=()=>{let r=!1,e=!1,t=null;return{initB24Helper:async(n,s=[ee.App,ee.Profile])=>(t===null&&(t=new Kh(n)),r?t:t.loadData(s).then(()=>(r=!0,t))),isInitB24Helper:()=>r,destroyB24Helper:()=>{t?.destroy(),t=null,r=!1,e=!1},getB24Helper:()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");return t},usePullClient:()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");t.usePullClient(),e=!0},useSubscribePullClient:(n,s="application")=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.subscribePullClient(n,s)},startPullClient:()=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.startPullClient()}}},Xh=50;let lt=null,Ur=!1,jt=null,ta=!1,$r=[],ra=!1;function na(){window.setTimeout(()=>{if(!Ur||lt===null){na();return}ef(),$r=[]},Xh)}function ef(){if(jt!==null)for(const r of $r)r.reject(jt);if(!(!Ur||lt===null))for(const r of $r)r.resolve(lt)}async function tf(){return Ur&&lt!==null?Promise.resolve(lt):ta?(ra||(ra=!0,na()),new Promise((r,e)=>{$r.push({resolve:r,reject:e})})):(ta=!0,new Promise((r,e)=>{const t={DOMAIN:null,PROTOCOL:!1,APP_SID:null,LANG:null};if(window.name){const[n,s,i]=window.name.split("|");t.DOMAIN=n,t.PROTOCOL=Number.parseInt(s)===1,t.APP_SID=i,t.LANG=null}(!t.DOMAIN||!t.APP_SID)&&(jt=new Error("Unable to initialize Bitrix24Frame library!"),e(jt)),lt=new Wo(t),lt.init().then(()=>{Ur=!0,r(lt)}).catch(n=>{jt=n,e(jt)})}))}R.AbstractB24=_t,R.AjaxError=Fe,R.AjaxResult=Tr,R.AppFrame=Mo,R.AuthHookManager=Do,R.AuthManager=Fo,R.AuthOAuthManager=qo,R.B24Frame=Wo,R.B24Hook=Wn,R.B24LangList=$n,R.B24LocaleMap=kh,R.B24OAuth=Ah,R.B24PullClientManager=ea,R.Browser=Ri,R.CatalogProductImageType=Fi,R.CatalogProductType=Mi,R.CatalogRoundingRuleType=xi,R.CloseReasons=Se,R.ConnectionType=te,R.DataType=Qn,R.DialogManager=Bo,R.EnumAppStatus=Qe,R.EnumBitrix24Edition=ji,R.EnumBizprocBaseType=Bi,R.EnumBizprocDocumentType=Ui,R.EnumCrmEntityType=Di,R.EnumCrmEntityTypeId=We,R.EnumCrmEntityTypeShort=wn,R.ListRpcError=_n,R.LoadDataType=ee,R.LoggerBrowser=ye,R.LoggerType=I,R.LsKeys=Ne,R.MessageCommands=X,R.MessageManager=Po,R.OptionsManager=jo,R.ParentManager=xo,R.PlacementManager=$o,R.ProductRowDiscountTypeId=Pi,R.PullStatus=Re,R.RestrictionManagerParamsBase=Li,R.RestrictionManagerParamsForEnterprise=yn,R.Result=qe,R.RpcMethod=ze,R.SenderType=Er,R.ServerMode=Sn,R.SliderManager=Uo,R.StatusDescriptions=$i,R.SubscriptionType=Le,R.SystemCommands=Kt,R.Text=W,R.Type=C,R.TypeOption=Xe,R.TypeSpecificUrl=mt,R.convertBizprocDocumentTypeToCrmEntityTypeId=wc,R.getDocumentId=bc,R.getDocumentType=bn,R.getDocumentTypeForFilter=Sc,R.getEnumCrmEntityTypeShort=yc,R.getEnumValue=ha,R.initializeB24Frame=tf,R.isArrayOfArray=ua,R.omit=Xn,R.pick=ca,R.useB24Helper=Qh,R.useFormatter=Th}));
44
44
  //# sourceMappingURL=index.min.js.map