@bitrix24/b24jssdk 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/index.cjs +19 -6
- package/dist/commonjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/umd/index.js +1076 -2743
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +18 -21
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +3 -4
package/dist/umd/index.min.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
(function(q,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(q=typeof globalThis<"u"?globalThis:q||self,M(q.B24Js=q.B24Js||{}))})(this,function(q){"use strict";var M=(r=>(r.desktop="desktop",r.log="log",r.info="info",r.warn="warn",r.error="error",r.trace="trace",r))(M||{});const Ze=new Map;Ze.set("title",["%c#title#","color: #959ca4; font-style: italic; padding: 0 6px; border-top: 1px solid #ccc; border-left: 1px solid #ccc; border-bottom: 1px solid #ccc"]),Ze.set("desktop",["%cDESKTOP","color: white; font-style: italic; background-color: #29619b; padding: 0 6px; border: 1px solid #29619b"]),Ze.set("log",["%cLOG","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]),Ze.set("info",["%cINFO","color: #fff; font-style: italic; background-color: #6b7f96; padding: 0 6px; border: 1px solid #6b7f96"]),Ze.set("warn",["%cWARNING","color: #f0a74f; font-style: italic; padding: 0 6px; border: 1px solid #f0a74f"]),Ze.set("error",["%cERROR","color: white; font-style: italic; background-color: #8a3232; padding: 0 6px; border: 1px solid #8a3232"]),Ze.set("trace",["%cTRACE","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]);class Pe{#e;#t={desktop:!0,log:!1,info:!1,warn:!1,error:!0,trace:!0};static build(e,t=!1){const n=new Pe(e);return t&&(n.enable("log"),n.enable("info"),n.enable("warn")),n}constructor(e){this.#e=e}#r(e){const t=[],n=[];if(Ze.has("title")){const i=Ze.get("title");i[0]&&(t.push(i[0].replace("#title#",this.#e)),n.push(i[1]||""))}if(Ze.has(e)){const i=Ze.get(e);i[0]&&(t.push(i[0]),n.push(i[1]||""))}return[t.join(""),...n]}setConfig(e){for(const t in e)this.#t[t]=e[t]}enable(e){return typeof this.#t[e]>"u"?!1:(this.#t[e]=!0,!0)}disable(e){return typeof this.#t[e]>"u"?!1:(this.#t[e]=!1,!0)}isEnabled(e){return this.#t[e]}desktop(...e){this.isEnabled("desktop")&&console.log(...this.#r("desktop"),...e)}log(...e){this.isEnabled("log")&&console.log(...this.#r("log"),...e)}info(...e){this.isEnabled("info")&&console.info(...this.#r("info"),...e)}warn(...e){this.isEnabled("warn")&&console.warn(...this.#r("warn"),...e)}error(...e){this.isEnabled("error")&&console.error(...this.#r("error"),...e)}trace(...e){this.isEnabled("trace")&&console.trace(...this.#r("trace"),...e)}}var Wi=(r=>(r.undefined="undefined",r.any="any",r.integer="integer",r.boolean="boolean",r.double="double",r.date="date",r.datetime="datetime",r.string="string",r.text="text",r.file="file",r.array="array",r.object="object",r.user="user",r.location="location",r.crmCategory="crm_category",r.crmStatus="crm_status",r.crmCurrency="crm_currency",r))(Wi||{});const _l=Function.prototype.toString.call(Object);let El=class{getTag(e){return Object.prototype.toString.call(e)}isString(e){return e===""?!0:e?typeof e=="string"||e instanceof String:!1}isStringFilled(e){return this.isString(e)&&e!==""}isFunction(e){return e===null?!1:typeof e=="function"||e instanceof Function}isObject(e){return!!e&&(typeof e=="object"||typeof e=="function")}isObjectLike(e){return!!e&&typeof e=="object"}isPlainObject(e){if(!this.isObjectLike(e)||this.getTag(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=t.hasOwnProperty("constructor")&&t.constructor;return typeof n=="function"&&Function.prototype.toString.call(n)===_l}isJsonRpcRequest(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"method"in e&&this.isStringFilled(e.method)}isJsonRpcResponse(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"id"in e&&("result"in e||"error"in e)}isBoolean(e){return e===!0||e===!1}isNumber(e){return!Number.isNaN(e)&&typeof e=="number"}isInteger(e){return this.isNumber(e)&&e%1===0}isFloat(e){return this.isNumber(e)&&!this.isInteger(e)}isNil(e){return e==null}isArray(e){return!this.isNil(e)&&Array.isArray(e)}isArrayFilled(e){return this.isArray(e)&&e.length>0}isArrayLike(e){return!this.isNil(e)&&!this.isFunction(e)&&e.length>-1&&e.length<=Number.MAX_SAFE_INTEGER}isDate(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Date]"}isDomNode(e){return this.isObjectLike(e)&&!this.isPlainObject(e)&&"nodeType"in e}isElementNode(e){return this.isDomNode(e)&&e.nodeType===Node.ELEMENT_NODE}isTextNode(e){return this.isDomNode(e)&&e.nodeType===Node.TEXT_NODE}isMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Map]"}isSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Set]"}isWeakMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakMap]"}isWeakSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakSet]"}isPrototype(e){return(typeof(e&&e.constructor)=="function"&&e.constructor.prototype||Object.prototype)===e}isRegExp(e){return this.isObjectLike(e)&&this.getTag(e)==="[object RegExp]"}isNull(e){return e===null}isUndefined(e){return typeof e>"u"}isArrayBuffer(e){return this.isObjectLike(e)&&this.getTag(e)==="[object ArrayBuffer]"}isTypedArray(e){const t=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)]$/;return this.isObjectLike(e)&&t.test(this.getTag(e))}isBlob(e){return this.isObjectLike(e)&&this.isNumber(e.size)&&this.isString(e.type)&&this.isFunction(e.slice)}isFile(e){return this.isBlob(e)&&this.isString(e.name)&&(this.isNumber(e.lastModified)||this.isObjectLike(e.lastModifiedDate))}isFormData(e){return e instanceof FormData}clone(e,t=!0){let n,i,s;if(e===null)return null;if(this.isDomNode(e))n=e.cloneNode(t);else if(typeof e=="object")if(this.isArray(e))for(n=[],i=0,s=e.length;i<s;i++)typeof e[i]=="object"&&t?n[i]=this.clone(e[i],t):n[i]=e[i];else{n={},e.constructor&&(this.isDate(e)?n=new Date(e):n=new e.constructor);for(i in e)e.hasOwnProperty(i)&&(typeof e[i]=="object"&&t?n[i]=this.clone(e[i],t):n[i]=e[i])}else n=e;return n}};const x=new El;class vt extends Error{}class kl extends vt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Ol extends vt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Tl extends vt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Pt extends vt{}class qi extends vt{constructor(e){super(`Invalid unit ${e}`)}}class Te extends vt{}class ct extends vt{constructor(){super("Zone is an abstract class")}}const L="numeric",Ye="short",De="long",vr={year:L,month:L,day:L},Vi={year:L,month:Ye,day:L},Al={year:L,month:Ye,day:L,weekday:Ye},Hi={year:L,month:De,day:L},zi={year:L,month:De,day:L,weekday:De},Ji={hour:L,minute:L},Gi={hour:L,minute:L,second:L},Zi={hour:L,minute:L,second:L,timeZoneName:Ye},Yi={hour:L,minute:L,second:L,timeZoneName:De},Ki={hour:L,minute:L,hourCycle:"h23"},Qi={hour:L,minute:L,second:L,hourCycle:"h23"},Xi={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:Ye},es={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:De},ts={year:L,month:L,day:L,hour:L,minute:L},rs={year:L,month:L,day:L,hour:L,minute:L,second:L},ns={year:L,month:Ye,day:L,hour:L,minute:L},is={year:L,month:Ye,day:L,hour:L,minute:L,second:L},Il={year:L,month:Ye,day:L,weekday:Ye,hour:L,minute:L},ss={year:L,month:De,day:L,hour:L,minute:L,timeZoneName:Ye},os={year:L,month:De,day:L,hour:L,minute:L,second:L,timeZoneName:Ye},as={year:L,month:De,day:L,weekday:De,hour:L,minute:L,timeZoneName:De},ls={year:L,month:De,day:L,weekday:De,hour:L,minute:L,second:L,timeZoneName:De};class er{get type(){throw new ct}get name(){throw new ct}get ianaName(){return this.name}get isUniversal(){throw new ct}offsetName(e,t){throw new ct}formatOffset(e,t){throw new ct}offset(e){throw new ct}equals(e){throw new ct}get isValid(){throw new ct}}let rn=null;class Sr extends er{static get instance(){return rn===null&&(rn=new Sr),rn}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Fs(e,t,n)}formatOffset(e,t){return ir(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let _r={};function Cl(r){return _r[r]||(_r[r]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),_r[r]}const Rl={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Nl(r,e){const t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,i,s,o,l,a,u,c]=n;return[o,i,s,l,a,u,c]}function Pl(r,e){const t=r.formatToParts(e),n=[];for(let i=0;i<t.length;i++){const{type:s,value:o}=t[i],l=Rl[s];s==="era"?n[l]=o:J(l)||(n[l]=parseInt(o,10))}return n}let Er={};class ot extends er{static create(e){return Er[e]||(Er[e]=new ot(e)),Er[e]}static resetCache(){Er={},_r={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=ot.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Fs(e,t,n,this.name)}formatOffset(e,t){return ir(this.offset(e),t)}offset(e){const t=new Date(e);if(isNaN(t))return NaN;const n=Cl(this.name);let[i,s,o,l,a,u,c]=n.formatToParts?Pl(n,t):Nl(n,t);l==="BC"&&(i=-Math.abs(i)+1);const f=Ir({year:i,month:s,day:o,hour:a===24?0:a,minute:u,second:c,millisecond:0});let d=+t;const g=d%1e3;return d-=g>=0?g:1e3+g,(f-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let cs={};function Fl(r,e={}){const t=JSON.stringify([r,e]);let n=cs[t];return n||(n=new Intl.ListFormat(r,e),cs[t]=n),n}let nn={};function sn(r,e={}){const t=JSON.stringify([r,e]);let n=nn[t];return n||(n=new Intl.DateTimeFormat(r,e),nn[t]=n),n}let on={};function Ml(r,e={}){const t=JSON.stringify([r,e]);let n=on[t];return n||(n=new Intl.NumberFormat(r,e),on[t]=n),n}let an={};function Ll(r,e={}){const{base:t,...n}=e,i=JSON.stringify([r,n]);let s=an[i];return s||(s=new Intl.RelativeTimeFormat(r,e),an[i]=s),s}let tr=null;function Dl(){return tr||(tr=new Intl.DateTimeFormat().resolvedOptions().locale,tr)}let us={};function xl(r){let e=us[r];if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,us[r]=e}return e}function jl(r){const e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));const t=r.indexOf("-u-");if(t===-1)return[r];{let n,i;try{n=sn(r).resolvedOptions(),i=r}catch{const a=r.substring(0,t);n=sn(a).resolvedOptions(),i=a}const{numberingSystem:s,calendar:o}=n;return[i,s,o]}}function Ul(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function Bl(r){const e=[];for(let t=1;t<=12;t++){const n=z.utc(2009,t,1);e.push(r(n))}return e}function $l(r){const e=[];for(let t=1;t<=7;t++){const n=z.utc(2016,11,13+t);e.push(r(n))}return e}function kr(r,e,t,n){const i=r.listingMode();return i==="error"?null:i==="en"?t(e):n(e)}function Wl(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||new Intl.DateTimeFormat(r.intl).resolvedOptions().numberingSystem==="latn"}class ql{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:i,floor:s,...o}=n;if(!t||Object.keys(o).length>0){const l={useGrouping:!1,...n};n.padTo>0&&(l.minimumIntegerDigits=n.padTo),this.inf=Ml(e,l)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):gn(e,3);return ve(t,this.padTo)}}}class Vl{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),l=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&ot.create(l).valid?(i=l,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=sn(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:n}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Hl{constructor(e,t,n){this.opts={style:"long",...n},!t&&Cs()&&(this.rtf=Ll(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):pc(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const zl={firstDay:1,minimalDays:4,weekend:[6,7]};class le{static fromOpts(e){return le.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,i,s=!1){const o=e||ye.defaultLocale,l=o||(s?"en-US":Dl()),a=t||ye.defaultNumberingSystem,u=n||ye.defaultOutputCalendar,c=dn(i)||ye.defaultWeekSettings;return new le(l,a,u,c,o)}static resetCache(){tr=null,nn={},on={},an={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:i}={}){return le.create(e,t,n,i)}constructor(e,t,n,i,s){const[o,l,a]=jl(e);this.locale=o,this.numberingSystem=t||l||null,this.outputCalendar=n||a||null,this.weekSettings=i,this.intl=Ul(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Wl(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:le.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,dn(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return kr(this,e,Ds,()=>{const n=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=Bl(s=>this.extract(s,n,"month"))),this.monthsCache[i][e]})}weekdays(e,t=!1){return kr(this,e,Us,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=t?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=$l(s=>this.extract(s,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return kr(this,void 0,()=>Bs,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[z.utc(2016,11,13,9),z.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return kr(this,e,$s,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[z.utc(-40,1,1),z.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){const i=this.dtFormatter(e,t),s=i.formatToParts(),o=s.find(l=>l.type.toLowerCase()===n);return o?o.value:null}numberFormatter(e={}){return new ql(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Vl(e,this.intl,t)}relFormatter(e={}){return new Hl(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Fl(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Rs()?xl(this.locale):zl}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let ln=null;class Fe extends er{static get utcInstance(){return ln===null&&(ln=new Fe(0)),ln}static instance(e){return e===0?Fe.utcInstance:new Fe(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Fe(Cr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${ir(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${ir(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return ir(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Jl extends er{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function ut(r,e){if(J(r)||r===null)return e;if(r instanceof er)return r;if(Xl(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Sr.instance:t==="utc"||t==="gmt"?Fe.utcInstance:Fe.parseSpecifier(t)||ot.create(r)}else return ft(r)?Fe.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new Jl(r)}const cn={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},fs={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Gl=cn.hanidec.replace(/[\[|\]]/g,"").split("");function Zl(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){const n=r.charCodeAt(t);if(r[t].search(cn.hanidec)!==-1)e+=Gl.indexOf(r[t]);else for(const i in fs){const[s,o]=fs[i];n>=s&&n<=o&&(e+=n-s)}}return parseInt(e,10)}else return e}let Ft={};function Yl(){Ft={}}function Ke({numberingSystem:r},e=""){const t=r||"latn";return Ft[t]||(Ft[t]={}),Ft[t][e]||(Ft[t][e]=new RegExp(`${cn[t]}${e}`)),Ft[t][e]}let hs=()=>Date.now(),ds="system",ps=null,gs=null,ms=null,ys=60,ws,bs=null;class ye{static get now(){return hs}static set now(e){hs=e}static set defaultZone(e){ds=e}static get defaultZone(){return ut(ds,Sr.instance)}static get defaultLocale(){return ps}static set defaultLocale(e){ps=e}static get defaultNumberingSystem(){return gs}static set defaultNumberingSystem(e){gs=e}static get defaultOutputCalendar(){return ms}static set defaultOutputCalendar(e){ms=e}static get defaultWeekSettings(){return bs}static set defaultWeekSettings(e){bs=dn(e)}static get twoDigitCutoffYear(){return ys}static set twoDigitCutoffYear(e){ys=e%100}static get throwOnInvalid(){return ws}static set throwOnInvalid(e){ws=e}static resetCaches(){le.resetCache(),ot.resetCache(),z.resetCache(),Yl()}}class Qe{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const vs=[0,31,59,90,120,151,181,212,243,273,304,334],Ss=[0,31,60,91,121,152,182,213,244,274,305,335];function qe(r,e){return new Qe("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function un(r,e,t){const n=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const i=n.getUTCDay();return i===0?7:i}function _s(r,e,t){return t+(rr(r)?Ss:vs)[e-1]}function Es(r,e){const t=rr(r)?Ss:vs,n=t.findIndex(s=>s<e),i=e-t[n];return{month:n+1,day:i}}function fn(r,e){return(r-e+7)%7+1}function Or(r,e=4,t=1){const{year:n,month:i,day:s}=r,o=_s(n,i,s),l=fn(un(n,i,s),t);let a=Math.floor((o-l+14-e)/7),u;return a<1?(u=n-1,a=nr(u,e,t)):a>nr(n,e,t)?(u=n+1,a=1):u=n,{weekYear:u,weekNumber:a,weekday:l,...Nr(r)}}function ks(r,e=4,t=1){const{weekYear:n,weekNumber:i,weekday:s}=r,o=fn(un(n,1,e),t),l=Lt(n);let a=i*7+s-o-7+e,u;a<1?(u=n-1,a+=Lt(u)):a>l?(u=n+1,a-=Lt(n)):u=n;const{month:c,day:h}=Es(u,a);return{year:u,month:c,day:h,...Nr(r)}}function hn(r){const{year:e,month:t,day:n}=r,i=_s(e,t,n);return{year:e,ordinal:i,...Nr(r)}}function Os(r){const{year:e,ordinal:t}=r,{month:n,day:i}=Es(e,t);return{year:e,month:n,day:i,...Nr(r)}}function Ts(r,e){if(!J(r.localWeekday)||!J(r.localWeekNumber)||!J(r.localWeekYear)){if(!J(r.weekday)||!J(r.weekNumber)||!J(r.weekYear))throw new Pt("Cannot mix locale-based week fields with ISO-based week fields");return J(r.localWeekday)||(r.weekday=r.localWeekday),J(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),J(r.localWeekYear)||(r.weekYear=r.localWeekYear),delete r.localWeekday,delete r.localWeekNumber,delete r.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Kl(r,e=4,t=1){const n=Tr(r.weekYear),i=Ve(r.weekNumber,1,nr(r.weekYear,e,t)),s=Ve(r.weekday,1,7);return n?i?s?!1:qe("weekday",r.weekday):qe("week",r.weekNumber):qe("weekYear",r.weekYear)}function Ql(r){const e=Tr(r.year),t=Ve(r.ordinal,1,Lt(r.year));return e?t?!1:qe("ordinal",r.ordinal):qe("year",r.year)}function As(r){const e=Tr(r.year),t=Ve(r.month,1,12),n=Ve(r.day,1,Ar(r.year,r.month));return e?t?n?!1:qe("day",r.day):qe("month",r.month):qe("year",r.year)}function Is(r){const{hour:e,minute:t,second:n,millisecond:i}=r,s=Ve(e,0,23)||e===24&&t===0&&n===0&&i===0,o=Ve(t,0,59),l=Ve(n,0,59),a=Ve(i,0,999);return s?o?l?a?!1:qe("millisecond",i):qe("second",n):qe("minute",t):qe("hour",e)}function J(r){return typeof r>"u"}function ft(r){return typeof r=="number"}function Tr(r){return typeof r=="number"&&r%1===0}function Xl(r){return typeof r=="string"}function ec(r){return Object.prototype.toString.call(r)==="[object Date]"}function Cs(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Rs(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function tc(r){return Array.isArray(r)?r:[r]}function Ns(r,e,t){if(r.length!==0)return r.reduce((n,i)=>{const s=[e(i),i];return n&&t(n[0],s[0])===n[0]?n:s},null)[1]}function rc(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function Mt(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function dn(r){if(r==null)return null;if(typeof r!="object")throw new Te("Week settings must be an object");if(!Ve(r.firstDay,1,7)||!Ve(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!Ve(e,1,7)))throw new Te("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function Ve(r,e,t){return Tr(r)&&r>=e&&r<=t}function nc(r,e){return r-e*Math.floor(r/e)}function ve(r,e=2){const t=r<0;let n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function ht(r){if(!(J(r)||r===null||r===""))return parseInt(r,10)}function St(r){if(!(J(r)||r===null||r===""))return parseFloat(r)}function pn(r){if(!(J(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function gn(r,e,t=!1){const n=10**e;return(t?Math.trunc:Math.round)(r*n)/n}function rr(r){return r%4===0&&(r%100!==0||r%400===0)}function Lt(r){return rr(r)?366:365}function Ar(r,e){const t=nc(e-1,12)+1,n=r+(e-t)/12;return t===2?rr(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Ir(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}function Ps(r,e,t){return-fn(un(r,1,e),t)+e-1}function nr(r,e=4,t=1){const n=Ps(r,e,t),i=Ps(r+1,e,t);return(Lt(r)-n+i)/7}function mn(r){return r>99?r:r>ye.twoDigitCutoffYear?1900+r:2e3+r}function Fs(r,e,t,n=null){const i=new Date(r),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(s.timeZone=n);const o={timeZoneName:e,...s},l=new Intl.DateTimeFormat(t,o).formatToParts(i).find(a=>a.type.toLowerCase()==="timezonename");return l?l.value:null}function Cr(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const n=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-n:n;return t*60+i}function Ms(r){const e=Number(r);if(typeof r=="boolean"||r===""||Number.isNaN(e))throw new Te(`Invalid unit value ${r}`);return e}function Rr(r,e){const t={};for(const n in r)if(Mt(r,n)){const i=r[n];if(i==null)continue;t[e(n)]=Ms(i)}return t}function ir(r,e){const t=Math.trunc(Math.abs(r/60)),n=Math.trunc(Math.abs(r%60)),i=r>=0?"+":"-";switch(e){case"short":return`${i}${ve(t,2)}:${ve(n,2)}`;case"narrow":return`${i}${t}${n>0?`:${n}`:""}`;case"techie":return`${i}${ve(t,2)}${ve(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Nr(r){return rc(r,["hour","minute","second","millisecond"])}const ic=["January","February","March","April","May","June","July","August","September","October","November","December"],Ls=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],sc=["J","F","M","A","M","J","J","A","S","O","N","D"];function Ds(r){switch(r){case"narrow":return[...sc];case"short":return[...Ls];case"long":return[...ic];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const xs=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],js=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],oc=["M","T","W","T","F","S","S"];function Us(r){switch(r){case"narrow":return[...oc];case"short":return[...js];case"long":return[...xs];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Bs=["AM","PM"],ac=["Before Christ","Anno Domini"],lc=["BC","AD"],cc=["B","A"];function $s(r){switch(r){case"narrow":return[...cc];case"short":return[...lc];case"long":return[...ac];default:return null}}function uc(r){return Bs[r.hour<12?0:1]}function fc(r,e){return Us(e)[r.weekday-1]}function hc(r,e){return Ds(e)[r.month-1]}function dc(r,e){return $s(e)[r.year<0?0:1]}function pc(r,e,t="always",n=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&s){const h=r==="days";switch(e){case 1:return h?"tomorrow":`next ${i[r][0]}`;case-1:return h?"yesterday":`last ${i[r][0]}`;case 0:return h?"today":`this ${i[r][0]}`}}const o=Object.is(e,-0)||e<0,l=Math.abs(e),a=l===1,u=i[r],c=n?a?u[1]:u[2]||u[1]:a?i[r][0]:r;return o?`${l} ${c} ago`:`in ${l} ${c}`}function Ws(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const gc={D:vr,DD:Vi,DDD:Hi,DDDD:zi,t:Ji,tt:Gi,ttt:Zi,tttt:Yi,T:Ki,TT:Qi,TTT:Xi,TTTT:es,f:ts,ff:ns,fff:ss,ffff:as,F:rs,FF:is,FFF:os,FFFF:ls};class Ae{static create(e,t={}){return new Ae(e,t)}static parseFormat(e){let t=null,n="",i=!1;const s=[];for(let o=0;o<e.length;o++){const l=e.charAt(o);l==="'"?(n.length>0&&s.push({literal:i||/^\s+$/.test(n),val:n}),t=null,n="",i=!i):i||l===t?n+=l:(n.length>0&&s.push({literal:/^\s+$/.test(n),val:n}),n=l,t=l)}return n.length>0&&s.push({literal:i||/^\s+$/.test(n),val:n}),s}static macroTokenToFormatOpts(e){return gc[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return ve(e,t);const n={...this.opts};return t>0&&(n.padTo=t),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(d,g)=>this.loc.extract(e,d,g),o=d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"",l=()=>n?uc(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(d,g)=>n?hc(e,d):s(g?{month:d}:{month:d,day:"numeric"},"month"),u=(d,g)=>n?fc(e,d):s(g?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),c=d=>{const g=Ae.macroTokenToFormatOpts(d);return g?this.formatWithSystemDefault(e,g):d},h=d=>n?dc(e,d):s({era:d},"era"),f=d=>{switch(d){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return l();case"d":return i?s({day:"numeric"},"day"):this.num(e.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(e.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(e.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return h("short");case"GG":return h("long");case"GGGGG":return h("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(d)}};return Ws(Ae.parseFormat(t),f)}formatDurationFromString(e,t){const n=a=>{switch(a[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=a=>u=>{const c=n(u);return c?this.num(a.get(c),u.length):u},s=Ae.parseFormat(t),o=s.reduce((a,{literal:u,val:c})=>u?a:a.concat(c),[]),l=e.shiftTo(...o.map(n).filter(a=>a));return Ws(s,i(l))}}const qs=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Dt(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function xt(...r){return e=>r.reduce(([t,n,i],s)=>{const[o,l,a]=s(e,i);return[{...t,...o},l||n,a]},[{},null,1]).slice(0,2)}function jt(r,...e){if(r==null)return[null,null];for(const[t,n]of e){const i=t.exec(r);if(i)return n(i)}return[null,null]}function Vs(...r){return(e,t)=>{const n={};let i;for(i=0;i<r.length;i++)n[r[i]]=ht(e[t+i]);return[n,null,t+i]}}const Hs=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,mc=`(?:${Hs.source}?(?:\\[(${qs.source})\\])?)?`,yn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,zs=RegExp(`${yn.source}${mc}`),wn=RegExp(`(?:T${zs.source})?`),yc=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,wc=/(\d{4})-?W(\d\d)(?:-?(\d))?/,bc=/(\d{4})-?(\d{3})/,vc=Vs("weekYear","weekNumber","weekDay"),Sc=Vs("year","ordinal"),_c=/(\d{4})-(\d\d)-(\d\d)/,Js=RegExp(`${yn.source} ?(?:${Hs.source}|(${qs.source}))?`),Ec=RegExp(`(?: ${Js.source})?`);function Ut(r,e,t){const n=r[e];return J(n)?t:ht(n)}function kc(r,e){return[{year:Ut(r,e),month:Ut(r,e+1,1),day:Ut(r,e+2,1)},null,e+3]}function Bt(r,e){return[{hours:Ut(r,e,0),minutes:Ut(r,e+1,0),seconds:Ut(r,e+2,0),milliseconds:pn(r[e+3])},null,e+4]}function sr(r,e){const t=!r[e]&&!r[e+1],n=Cr(r[e+1],r[e+2]),i=t?null:Fe.instance(n);return[{},i,e+3]}function or(r,e){const t=r[e]?ot.create(r[e]):null;return[{},t,e+1]}const Oc=RegExp(`^T?${yn.source}$`),Tc=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Ac(r){const[e,t,n,i,s,o,l,a,u]=r,c=e[0]==="-",h=a&&a[0]==="-",f=(d,g=!1)=>d!==void 0&&(g||d&&c)?-d:d;return[{years:f(St(t)),months:f(St(n)),weeks:f(St(i)),days:f(St(s)),hours:f(St(o)),minutes:f(St(l)),seconds:f(St(a),a==="-0"),milliseconds:f(pn(u),h)}]}const Ic={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function bn(r,e,t,n,i,s,o){const l={year:e.length===2?mn(ht(e)):ht(e),month:Ls.indexOf(t)+1,day:ht(n),hour:ht(i),minute:ht(s)};return o&&(l.second=ht(o)),r&&(l.weekday=r.length>3?xs.indexOf(r)+1:js.indexOf(r)+1),l}const Cc=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Rc(r){const[,e,t,n,i,s,o,l,a,u,c,h]=r,f=bn(e,i,n,t,s,o,l);let d;return a?d=Ic[a]:u?d=0:d=Cr(c,h),[f,new Fe(d)]}function Nc(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const Pc=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Fc=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Mc=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Gs(r){const[,e,t,n,i,s,o,l]=r;return[bn(e,i,n,t,s,o,l),Fe.utcInstance]}function Lc(r){const[,e,t,n,i,s,o,l]=r;return[bn(e,l,t,n,i,s,o),Fe.utcInstance]}const Dc=Dt(yc,wn),xc=Dt(wc,wn),jc=Dt(bc,wn),Uc=Dt(zs),Zs=xt(kc,Bt,sr,or),Bc=xt(vc,Bt,sr,or),$c=xt(Sc,Bt,sr,or),Wc=xt(Bt,sr,or);function qc(r){return jt(r,[Dc,Zs],[xc,Bc],[jc,$c],[Uc,Wc])}function Vc(r){return jt(Nc(r),[Cc,Rc])}function Hc(r){return jt(r,[Pc,Gs],[Fc,Gs],[Mc,Lc])}function zc(r){return jt(r,[Tc,Ac])}const Jc=xt(Bt);function Gc(r){return jt(r,[Oc,Jc])}const Zc=Dt(_c,Ec),Yc=Dt(Js),Kc=xt(Bt,sr,or);function Qc(r){return jt(r,[Zc,Zs],[Yc,Kc])}const Ys="Invalid Duration",Ks={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Xc={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...Ks},He=146097/400,$t=146097/4800,eu={years:{quarters:4,months:12,weeks:He/7,days:He,hours:He*24,minutes:He*24*60,seconds:He*24*60*60,milliseconds:He*24*60*60*1e3},quarters:{months:3,weeks:He/28,days:He/4,hours:He*24/4,minutes:He*24*60/4,seconds:He*24*60*60/4,milliseconds:He*24*60*60*1e3/4},months:{weeks:$t/7,days:$t,hours:$t*24,minutes:$t*24*60,seconds:$t*24*60*60,milliseconds:$t*24*60*60*1e3},...Ks},_t=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],tu=_t.slice(0).reverse();function dt(r,e,t=!1){const n={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new ie(n)}function Qs(r,e){let t=e.milliseconds??0;for(const n of tu.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function Xs(r,e){const t=Qs(r,e)<0?-1:1;_t.reduceRight((n,i)=>{if(J(e[i]))return n;if(n){const s=e[n]*t,o=r[i][n],l=Math.floor(s/o);e[i]+=l*t,e[n]-=l*o*t}return i},null),_t.reduce((n,i)=>{if(J(e[i]))return n;if(n){const s=e[n]%1;e[n]-=s,e[i]+=s*r[n][i]}return i},null)}function ru(r){const e={};for(const[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}class ie{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let n=t?eu:Xc;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||le.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return ie.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new Te(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new ie({values:Rr(e,ie.normalizeUnit),loc:le.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(ft(e))return ie.fromMillis(e);if(ie.isDuration(e))return e;if(typeof e=="object")return ie.fromObject(e);throw new Te(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=zc(e);return n?ie.fromObject(n,t):ie.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=Gc(e);return n?ie.fromObject(n,t):ie.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Te("need to specify a reason the Duration is invalid");const n=e instanceof Qe?e:new Qe(e,t);if(ye.throwOnInvalid)throw new Tl(n);return new ie({invalid:n})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new qi(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Ae.create(this.loc,n).formatDurationFromString(this,e):Ys}toHuman(e={}){if(!this.isValid)return Ys;const t=_t.map(n=>{const i=this.values[n];return J(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=gn(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},z.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Qs(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=ie.fromDurationLike(e),n={};for(const i of _t)(Mt(t.values,i)||Mt(this.values,i))&&(n[i]=t.get(i)+this.get(i));return dt(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=ie.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=Ms(e(this.values[n],n));return dt(this,{values:t},!0)}get(e){return this[ie.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Rr(e,ie.normalizeUnit)};return dt(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:i}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:i,conversionAccuracy:n};return dt(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Xs(this.matrix,e),dt(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=ru(this.normalize().shiftToAll().toObject());return dt(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>ie.normalizeUnit(o));const t={},n={},i=this.toObject();let s;for(const o of _t)if(e.indexOf(o)>=0){s=o;let l=0;for(const u in n)l+=this.matrix[u][o]*n[u],n[u]=0;ft(i[o])&&(l+=i[o]);const a=Math.trunc(l);t[o]=a,n[o]=(l*1e3-a*1e3)/1e3}else ft(i[o])&&(n[o]=i[o]);for(const o in n)n[o]!==0&&(t[s]+=o===s?n[o]:n[o]/this.matrix[s][o]);return Xs(this.matrix,t),dt(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return dt(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(const n of _t)if(!t(this.values[n],e.values[n]))return!1;return!0}}const Wt="Invalid Interval";function nu(r,e){return!r||!r.isValid?we.invalid("missing or invalid start"):!e||!e.isValid?we.invalid("missing or invalid end"):e<r?we.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}class we{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Te("need to specify a reason the Interval is invalid");const n=e instanceof Qe?e:new Qe(e,t);if(ye.throwOnInvalid)throw new Ol(n);return new we({invalid:n})}static fromDateTimes(e,t){const n=lr(e),i=lr(t),s=nu(n,i);return s??new we({start:n,end:i})}static after(e,t){const n=ie.fromDurationLike(t),i=lr(e);return we.fromDateTimes(i,i.plus(n))}static before(e,t){const n=ie.fromDurationLike(t),i=lr(e);return we.fromDateTimes(i.minus(n),i)}static fromISO(e,t){const[n,i]=(e||"").split("/",2);if(n&&i){let s,o;try{s=z.fromISO(n,t),o=s.isValid}catch{o=!1}let l,a;try{l=z.fromISO(i,t),a=l.isValid}catch{a=!1}if(o&&a)return we.fromDateTimes(s,l);if(o){const u=ie.fromISO(i,t);if(u.isValid)return we.after(s,u)}else if(a){const u=ie.fromISO(n,t);if(u.isValid)return we.before(l,u)}}return we.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const n=this.start.startOf(e,t);let i;return t?.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(e,t),Math.floor(i.diff(n,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?we.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(lr).filter(o=>this.contains(o)).sort((o,l)=>o.toMillis()-l.toMillis()),n=[];let{s:i}=this,s=0;for(;i<this.e;){const o=t[s]||this.e,l=+o>+this.e?this.e:o;n.push(we.fromDateTimes(i,l)),i=l,s+=1}return n}splitBy(e){const t=ie.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,i=1,s;const o=[];for(;n<this.e;){const l=this.start.plus(t.mapUnits(a=>a*i));s=+l>+this.e?this.e:l,o.push(we.fromDateTimes(n,s)),n=s,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:we.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return we.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const i=[],s=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...s),l=o.sort((a,u)=>a.time-u.time);for(const a of l)n+=a.type==="s"?1:-1,n===1?t=a.time:(t&&+t!=+a.time&&i.push(we.fromDateTimes(t,a.time)),t=null);return we.merge(i)}difference(...e){return we.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Wt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=vr,t={}){return this.isValid?Ae.create(this.s.loc.clone(t),e).formatInterval(this):Wt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Wt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Wt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Wt}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Wt}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):ie.invalid(this.invalidReason)}mapEndpoints(e){return we.fromDateTimes(e(this.s),e(this.e))}}class Pr{static hasDST(e=ye.defaultZone){const t=z.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return ot.isValidZone(e)}static normalizeZone(e){return ut(e,ye.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||le.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||le.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||le.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||le.create(t,n,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||le.create(t,n,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||le.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:i=null}={}){return(i||le.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return le.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return le.create(t,null,"gregory").eras(e)}static features(){return{relative:Cs(),localeWeek:Rs()}}}function eo(r,e){const t=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(ie.fromMillis(n).as("days"))}function iu(r,e,t){const n=[["years",(a,u)=>u.year-a.year],["quarters",(a,u)=>u.quarter-a.quarter+(u.year-a.year)*4],["months",(a,u)=>u.month-a.month+(u.year-a.year)*12],["weeks",(a,u)=>{const c=eo(a,u);return(c-c%7)/7}],["days",eo]],i={},s=r;let o,l;for(const[a,u]of n)t.indexOf(a)>=0&&(o=a,i[a]=u(r,e),l=s.plus(i),l>e?(i[a]--,r=s.plus(i),r>e&&(l=r,i[a]--,r=s.plus(i))):r=l);return[r,i,l,o]}function su(r,e,t,n){let[i,s,o,l]=iu(r,e,t);const a=e-i,u=t.filter(h=>["hours","minutes","seconds","milliseconds"].indexOf(h)>=0);u.length===0&&(o<e&&(o=i.plus({[l]:1})),o!==i&&(s[l]=(s[l]||0)+a/(o-i)));const c=ie.fromObject(s,n);return u.length>0?ie.fromMillis(a,n).shiftTo(...u).plus(c):c}const ou="missing Intl.DateTimeFormat.formatToParts support";function ae(r,e=t=>t){return{regex:r,deser:([t])=>e(Zl(t))}}const to="[ \xA0]",ro=new RegExp(to,"g");function au(r){return r.replace(/\./g,"\\.?").replace(ro,to)}function no(r){return r.replace(/\./g,"").replace(ro," ").toLowerCase()}function Xe(r,e){return r===null?null:{regex:RegExp(r.map(au).join("|")),deser:([t])=>r.findIndex(n=>no(t)===no(n))+e}}function io(r,e){return{regex:r,deser:([,t,n])=>Cr(t,n),groups:e}}function Fr(r){return{regex:r,deser:([e])=>e}}function lu(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function cu(r,e){const t=Ke(e),n=Ke(e,"{2}"),i=Ke(e,"{3}"),s=Ke(e,"{4}"),o=Ke(e,"{6}"),l=Ke(e,"{1,2}"),a=Ke(e,"{1,3}"),u=Ke(e,"{1,6}"),c=Ke(e,"{1,9}"),h=Ke(e,"{2,4}"),f=Ke(e,"{4,6}"),d=m=>({regex:RegExp(lu(m.val)),deser:([y])=>y,literal:!0}),p=(m=>{if(r.literal)return d(m);switch(m.val){case"G":return Xe(e.eras("short"),0);case"GG":return Xe(e.eras("long"),0);case"y":return ae(u);case"yy":return ae(h,mn);case"yyyy":return ae(s);case"yyyyy":return ae(f);case"yyyyyy":return ae(o);case"M":return ae(l);case"MM":return ae(n);case"MMM":return Xe(e.months("short",!0),1);case"MMMM":return Xe(e.months("long",!0),1);case"L":return ae(l);case"LL":return ae(n);case"LLL":return Xe(e.months("short",!1),1);case"LLLL":return Xe(e.months("long",!1),1);case"d":return ae(l);case"dd":return ae(n);case"o":return ae(a);case"ooo":return ae(i);case"HH":return ae(n);case"H":return ae(l);case"hh":return ae(n);case"h":return ae(l);case"mm":return ae(n);case"m":return ae(l);case"q":return ae(l);case"qq":return ae(n);case"s":return ae(l);case"ss":return ae(n);case"S":return ae(a);case"SSS":return ae(i);case"u":return Fr(c);case"uu":return Fr(l);case"uuu":return ae(t);case"a":return Xe(e.meridiems(),0);case"kkkk":return ae(s);case"kk":return ae(h,mn);case"W":return ae(l);case"WW":return ae(n);case"E":case"c":return ae(t);case"EEE":return Xe(e.weekdays("short",!1),1);case"EEEE":return Xe(e.weekdays("long",!1),1);case"ccc":return Xe(e.weekdays("short",!0),1);case"cccc":return Xe(e.weekdays("long",!0),1);case"Z":case"ZZ":return io(new RegExp(`([+-]${l.source})(?::(${n.source}))?`),2);case"ZZZ":return io(new RegExp(`([+-]${l.source})(${n.source})?`),2);case"z":return Fr(/[a-z_+-/]{1,256}?/i);case" ":return Fr(/[^\S\n\r]/);default:return d(m)}})(r)||{invalidReason:ou};return p.token=r,p}const uu={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function fu(r,e,t){const{type:n,value:i}=r;if(n==="literal"){const a=/^\s+$/.test(i);return{literal:!a,val:a?" ":i}}const s=e[n];let o=n;n==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let l=uu[o];if(typeof l=="object"&&(l=l[s]),l)return{literal:!1,val:l}}function hu(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function du(r,e,t){const n=r.match(e);if(n){const i={};let s=1;for(const o in t)if(Mt(t,o)){const l=t[o],a=l.groups?l.groups+1:1;!l.literal&&l.token&&(i[l.token.val[0]]=l.deser(n.slice(s,s+a))),s+=a}return[n,i]}else return[n,{}]}function pu(r){const e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,n;return J(r.z)||(t=ot.create(r.z)),J(r.Z)||(t||(t=new Fe(r.Z)),n=r.Z),J(r.q)||(r.M=(r.q-1)*3+1),J(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),J(r.u)||(r.S=pn(r.u)),[Object.keys(r).reduce((s,o)=>{const l=e(o);return l&&(s[l]=r[o]),s},{}),t,n]}let vn=null;function gu(){return vn||(vn=z.fromMillis(1555555555555)),vn}function mu(r,e){if(r.literal)return r;const t=Ae.macroTokenToFormatOpts(r.val),n=lo(t,e);return n==null||n.includes(void 0)?r:n}function so(r,e){return Array.prototype.concat(...r.map(t=>mu(t,e)))}class oo{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=so(Ae.parseFormat(t),e),this.units=this.tokens.map(n=>cu(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,i]=hu(this.units);this.regex=RegExp(n,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){const[t,n]=du(e,this.regex,this.handlers),[i,s,o]=n?pu(n):[null,null,void 0];if(Mt(n,"a")&&Mt(n,"H"))throw new Pt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:i,zone:s,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function ao(r,e,t){return new oo(r,t).explainFromTokens(e)}function yu(r,e,t){const{result:n,zone:i,specificOffset:s,invalidReason:o}=ao(r,e,t);return[n,i,s,o]}function lo(r,e){if(!r)return null;const n=Ae.create(e,r).dtFormatter(gu()),i=n.formatToParts(),s=n.resolvedOptions();return i.map(o=>fu(o,r,s))}const Sn="Invalid DateTime",co=864e13;function ar(r){return new Qe("unsupported zone",`the zone "${r.name}" is not supported`)}function _n(r){return r.weekData===null&&(r.weekData=Or(r.c)),r.weekData}function En(r){return r.localWeekData===null&&(r.localWeekData=Or(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function Et(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new z({...t,...e,old:t})}function uo(r,e,t){let n=r-e*60*1e3;const i=t.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;const s=t.offset(n);return i===s?[n,i]:[r-Math.min(i,s)*60*1e3,Math.max(i,s)]}function Mr(r,e){r+=e*60*1e3;const t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Lr(r,e,t){return uo(Ir(r),e,t)}function fo(r,e){const t=r.o,n=r.c.year+Math.trunc(e.years),i=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...r.c,year:n,month:i,day:Math.min(r.c.day,Ar(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=ie.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),l=Ir(s);let[a,u]=uo(l,t,r.zone);return o!==0&&(a+=o,u=r.zone.offset(a)),{ts:a,o:u}}function qt(r,e,t,n,i,s){const{setZone:o,zone:l}=t;if(r&&Object.keys(r).length!==0||e){const a=e||l,u=z.fromObject(r,{...t,zone:a,specificOffset:s});return o?u:u.setZone(l)}else return z.invalid(new Qe("unparsable",`the input "${i}" can't be parsed as ${n}`))}function Dr(r,e,t=!0){return r.isValid?Ae.create(le.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function kn(r,e){const t=r.c.year>9999||r.c.year<0;let n="";return t&&r.c.year>=0&&(n+="+"),n+=ve(r.c.year,t?6:4),e?(n+="-",n+=ve(r.c.month),n+="-",n+=ve(r.c.day)):(n+=ve(r.c.month),n+=ve(r.c.day)),n}function ho(r,e,t,n,i,s){let o=ve(r.c.hour);return e?(o+=":",o+=ve(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(o+=":")):o+=ve(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(o+=ve(r.c.second),(r.c.millisecond!==0||!n)&&(o+=".",o+=ve(r.c.millisecond,3))),i&&(r.isOffsetFixed&&r.offset===0&&!s?o+="Z":r.o<0?(o+="-",o+=ve(Math.trunc(-r.o/60)),o+=":",o+=ve(Math.trunc(-r.o%60))):(o+="+",o+=ve(Math.trunc(r.o/60)),o+=":",o+=ve(Math.trunc(r.o%60)))),s&&(o+="["+r.zone.ianaName+"]"),o}const po={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},wu={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},bu={ordinal:1,hour:0,minute:0,second:0,millisecond:0},go=["year","month","day","hour","minute","second","millisecond"],vu=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Su=["year","ordinal","hour","minute","second","millisecond"];function _u(r){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new qi(r);return e}function mo(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return _u(r)}}function Eu(r){return jr[r]||(xr===void 0&&(xr=ye.now()),jr[r]=r.offset(xr)),jr[r]}function yo(r,e){const t=ut(e.zone,ye.defaultZone);if(!t.isValid)return z.invalid(ar(t));const n=le.fromObject(e);let i,s;if(J(r.year))i=ye.now();else{for(const a of go)J(r[a])&&(r[a]=po[a]);const o=As(r)||Is(r);if(o)return z.invalid(o);const l=Eu(t);[i,s]=Lr(r,l,t)}return new z({ts:i,zone:t,loc:n,o:s})}function wo(r,e,t){const n=J(t.round)?!0:t.round,i=(o,l)=>(o=gn(o,n||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(o,l)),s=o=>t.calendary?e.hasSame(r,o)?0:e.startOf(o).diff(r.startOf(o),o).get(o):e.diff(r,o).get(o);if(t.unit)return i(s(t.unit),t.unit);for(const o of t.units){const l=s(o);if(Math.abs(l)>=1)return i(l,o)}return i(r>e?-0:0,t.units[t.units.length-1])}function bo(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}let xr,jr={};class z{constructor(e){const t=e.zone||ye.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Qe("invalid input"):null)||(t.isValid?null:ar(t));this.ts=J(e.ts)?ye.now():e.ts;let i=null,s=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[i,s]=[e.old.c,e.old.o];else{const l=ft(e.o)&&!e.old?e.o:t.offset(this.ts);i=Mr(this.ts,l),n=Number.isNaN(i.year)?new Qe("invalid input"):null,i=n?null:i,s=n?null:l}this._zone=t,this.loc=e.loc||le.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new z({})}static local(){const[e,t]=bo(arguments),[n,i,s,o,l,a,u]=t;return yo({year:n,month:i,day:s,hour:o,minute:l,second:a,millisecond:u},e)}static utc(){const[e,t]=bo(arguments),[n,i,s,o,l,a,u]=t;return e.zone=Fe.utcInstance,yo({year:n,month:i,day:s,hour:o,minute:l,second:a,millisecond:u},e)}static fromJSDate(e,t={}){const n=ec(e)?e.valueOf():NaN;if(Number.isNaN(n))return z.invalid("invalid input");const i=ut(t.zone,ye.defaultZone);return i.isValid?new z({ts:n,zone:i,loc:le.fromObject(t)}):z.invalid(ar(i))}static fromMillis(e,t={}){if(ft(e))return e<-co||e>co?z.invalid("Timestamp out of range"):new z({ts:e,zone:ut(t.zone,ye.defaultZone),loc:le.fromObject(t)});throw new Te(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ft(e))return new z({ts:e*1e3,zone:ut(t.zone,ye.defaultZone),loc:le.fromObject(t)});throw new Te("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=ut(t.zone,ye.defaultZone);if(!n.isValid)return z.invalid(ar(n));const i=le.fromObject(t),s=Rr(e,mo),{minDaysInFirstWeek:o,startOfWeek:l}=Ts(s,i),a=ye.now(),u=J(t.specificOffset)?n.offset(a):t.specificOffset,c=!J(s.ordinal),h=!J(s.year),f=!J(s.month)||!J(s.day),d=h||f,g=s.weekYear||s.weekNumber;if((d||c)&&g)throw new Pt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new Pt("Can't mix ordinal dates with month/day");const p=g||s.weekday&&!d;let m,y,w=Mr(a,u);p?(m=vu,y=wu,w=Or(w,o,l)):c?(m=Su,y=bu,w=hn(w)):(m=go,y=po);let _=!1;for(const R of m){const Y=s[R];J(Y)?_?s[R]=y[R]:s[R]=w[R]:_=!0}const b=p?Kl(s,o,l):c?Ql(s):As(s),k=b||Is(s);if(k)return z.invalid(k);const S=p?ks(s,o,l):c?Os(s):s,[O,C]=Lr(S,u,n),F=new z({ts:O,zone:n,o:C,loc:i});return s.weekday&&d&&e.weekday!==F.weekday?z.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${F.toISO()}`):F.isValid?F:z.invalid(F.invalid)}static fromISO(e,t={}){const[n,i]=qc(e);return qt(n,i,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,i]=Vc(e);return qt(n,i,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,i]=Hc(e);return qt(n,i,t,"HTTP",t)}static fromFormat(e,t,n={}){if(J(e)||J(t))throw new Te("fromFormat requires an input string and a format");const{locale:i=null,numberingSystem:s=null}=n,o=le.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[l,a,u,c]=yu(o,e,t);return c?z.invalid(c):qt(l,a,n,`format ${t}`,e,u)}static fromString(e,t,n={}){return z.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,i]=Qc(e);return qt(n,i,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Te("need to specify a reason the DateTime is invalid");const n=e instanceof Qe?e:new Qe(e,t);if(ye.throwOnInvalid)throw new kl(n);return new z({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=lo(e,le.fromObject(t));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,t={}){return so(Ae.parseFormat(e),le.fromObject(t)).map(i=>i.val).join("")}static resetCache(){xr=void 0,jr={}}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?_n(this).weekYear:NaN}get weekNumber(){return this.isValid?_n(this).weekNumber:NaN}get weekday(){return this.isValid?_n(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?En(this).weekday:NaN}get localWeekNumber(){return this.isValid?En(this).weekNumber:NaN}get localWeekYear(){return this.isValid?En(this).weekYear:NaN}get ordinal(){return this.isValid?hn(this.c).ordinal:NaN}get monthShort(){return this.isValid?Pr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Pr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Pr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Pr.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,n=Ir(this.c),i=this.zone.offset(n-e),s=this.zone.offset(n+e),o=this.zone.offset(n-i*t),l=this.zone.offset(n-s*t);if(o===l)return[this];const a=n-o*t,u=n-l*t,c=Mr(a,o),h=Mr(u,l);return c.hour===h.hour&&c.minute===h.minute&&c.second===h.second&&c.millisecond===h.millisecond?[Et(this,{ts:a}),Et(this,{ts:u})]:[this]}get isInLeapYear(){return rr(this.year)}get daysInMonth(){return Ar(this.year,this.month)}get daysInYear(){return this.isValid?Lt(this.year):NaN}get weeksInWeekYear(){return this.isValid?nr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?nr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:i}=Ae.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:i}}toUTC(e=0,t={}){return this.setZone(Fe.instance(e),t)}toLocal(){return this.setZone(ye.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=ut(e,ye.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(t||n){const s=e.offset(this.ts),o=this.toObject();[i]=Lr(o,s,e)}return Et(this,{ts:i,zone:e})}else return z.invalid(ar(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const i=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return Et(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Rr(e,mo),{minDaysInFirstWeek:n,startOfWeek:i}=Ts(t,this.loc),s=!J(t.weekYear)||!J(t.weekNumber)||!J(t.weekday),o=!J(t.ordinal),l=!J(t.year),a=!J(t.month)||!J(t.day),u=l||a,c=t.weekYear||t.weekNumber;if((u||o)&&c)throw new Pt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Pt("Can't mix ordinal dates with month/day");let h;s?h=ks({...Or(this.c,n,i),...t},n,i):J(t.ordinal)?(h={...this.toObject(),...t},J(t.day)&&(h.day=Math.min(Ar(h.year,h.month),h.day))):h=Os({...hn(this.c),...t});const[f,d]=Lr(h,this.o,this.zone);return Et(this,{ts:f,o:d})}plus(e){if(!this.isValid)return this;const t=ie.fromDurationLike(e);return Et(this,fo(this,t))}minus(e){if(!this.isValid)return this;const t=ie.fromDurationLike(e).negate();return Et(this,fo(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},i=ie.normalizeUnit(e);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(i==="weeks")if(t){const s=this.loc.getStartOfWeek(),{weekday:o}=this;o<s&&(n.weekNumber=this.weekNumber-1),n.weekday=s}else n.weekday=1;if(i==="quarters"){const s=Math.ceil(this.month/3);n.month=(s-1)*3+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Ae.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Sn}toLocaleString(e=vr,t={}){return this.isValid?Ae.create(this.loc.clone(t),e).formatDateTime(this):Sn}toLocaleParts(e={}){return this.isValid?Ae.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:s=!1}={}){if(!this.isValid)return null;const o=e==="extended";let l=kn(this,o);return l+="T",l+=ho(this,o,t,n,i,s),l}toISODate({format:e="extended"}={}){return this.isValid?kn(this,e==="extended"):null}toISOWeekDate(){return Dr(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:s=!1,format:o="extended"}={}){return this.isValid?(i?"T":"")+ho(this,o==="extended",t,e,n,s):null}toRFC2822(){return Dr(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Dr(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?kn(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(t||e)&&(n&&(i+=" "),t?i+="z":e&&(i+="ZZ")),Dr(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Sn}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return ie.invalid("created by diffing an invalid DateTime");const i={locale:this.locale,numberingSystem:this.numberingSystem,...n},s=tc(t).map(ie.normalizeUnit),o=e.valueOf()>this.valueOf(),l=o?this:e,a=o?e:this,u=su(l,a,s,i);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(z.now(),e,t)}until(e){return this.isValid?we.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,n)<=i&&i<=s.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||z.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let i=["years","months","days","hours","minutes","seconds"],s=e.unit;return Array.isArray(e.unit)&&(i=e.unit,s=void 0),wo(t,this.plus(n),{...e,numeric:"always",units:i,unit:s})}toRelativeCalendar(e={}){return this.isValid?wo(e.base||z.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(z.isDateTime))throw new Te("min requires all arguments be DateTimes");return Ns(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(z.isDateTime))throw new Te("max requires all arguments be DateTimes");return Ns(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:i=null,numberingSystem:s=null}=n,o=le.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return ao(o,e,t)}static fromStringExplain(e,t,n={}){return z.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:i=null}=t,s=le.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return new oo(s,e)}static fromFormatParser(e,t,n={}){if(J(e)||J(t))throw new Te("fromFormatParser requires an input string and a format parser");const{locale:i=null,numberingSystem:s=null}=n,o=le.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});if(!o.equals(t.locale))throw new Te(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:l,zone:a,specificOffset:u,invalidReason:c}=t.explainFromTokens(e);return c?z.invalid(c):qt(l,a,n,`format ${t.format}`,e,u)}static get DATE_SHORT(){return vr}static get DATE_MED(){return Vi}static get DATE_MED_WITH_WEEKDAY(){return Al}static get DATE_FULL(){return Hi}static get DATE_HUGE(){return zi}static get TIME_SIMPLE(){return Ji}static get TIME_WITH_SECONDS(){return Gi}static get TIME_WITH_SHORT_OFFSET(){return Zi}static get TIME_WITH_LONG_OFFSET(){return Yi}static get TIME_24_SIMPLE(){return Ki}static get TIME_24_WITH_SECONDS(){return Qi}static get TIME_24_WITH_SHORT_OFFSET(){return Xi}static get TIME_24_WITH_LONG_OFFSET(){return es}static get DATETIME_SHORT(){return ts}static get DATETIME_SHORT_WITH_SECONDS(){return rs}static get DATETIME_MED(){return ns}static get DATETIME_MED_WITH_SECONDS(){return is}static get DATETIME_MED_WITH_WEEKDAY(){return Il}static get DATETIME_FULL(){return ss}static get DATETIME_FULL_WITH_SECONDS(){return os}static get DATETIME_HUGE(){return as}static get DATETIME_HUGE_WITH_SECONDS(){return ls}}function lr(r){if(z.isDateTime(r))return r;if(r&&r.valueOf&&ft(r.valueOf()))return z.fromJSDate(r);if(r&&typeof r=="object")return z.fromObject(r);throw new Te(`Unknown datetime argument: ${r}, of type ${typeof r}`)}const On={};let Tn;const ku=new Uint8Array(16),ke=[];for(let r=0;r<256;++r)ke.push((r+256).toString(16).slice(1));function Ou(r,e,t){return r.msecs??=-1/0,r.seq??=0,e>r.msecs?(r.seq=t[6]<<23|t[7]<<16|t[8]<<8|t[9],r.msecs=e):(r.seq=Math.trunc(r.seq+1),r.seq===0&&r.msecs++),r}function Tu(r,e,t,n,i=0){return n||(n=new Uint8Array(16),i=0),e??=Date.now(),t??=r[6]*127<<24|r[7]<<16|r[8]<<8|r[9],n[i++]=e/1099511627776&255,n[i++]=e/4294967296&255,n[i++]=e/16777216&255,n[i++]=e/65536&255,n[i++]=e/256&255,n[i++]=e&255,n[i++]=112|t>>>28&15,n[i++]=t>>>20&255,n[i++]=128|t>>>14&63,n[i++]=t>>>6&255,n[i++]=t<<2&255|r[10]&3,n[i++]=r[11],n[i++]=r[12],n[i++]=r[13],n[i++]=r[14],n[i++]=r[15],n}function Au(r,e=0){return(ke[r[e]]+ke[r[e+1]]+ke[r[e+2]]+ke[r[e+3]]+"-"+ke[r[e+4]]+ke[r[e+5]]+"-"+ke[r[e+6]]+ke[r[e+7]]+"-"+ke[r[e+8]]+ke[r[e+9]]+"-"+ke[r[e+10]]+ke[r[e+11]]+ke[r[e+12]]+ke[r[e+13]]+ke[r[e+14]]+ke[r[e+15]]).toLowerCase()}function Iu(){const r=Date.now();if(!Tn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported.");Tn=crypto.getRandomValues.bind(crypto)}const e=Tn(ku);Ou(On,r,e);const t=Tu(e,On.msecs,On.seq,void 0,void 0);return Au(t)}const Cu=/[&<>'"]/g,Ru=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g,Nu={"&":"&","<":"<",">":">","'":"'",'"':"""},Pu={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","&apos":"'","'":"'",""":'"',""":'"'};class Fu{getRandom(e=8){return[...Array(e)].map(()=>Math.trunc(Math.random()*36).toString(36)).join("")}getUniqId(){return"xxxxxxxx-xlsx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.trunc(Math.random()*16);return(e==="x"?t:t&3|8).toString(16)})}getUuidRfc4122(){return Iu()}encode(e){return x.isString(e)?e.replace(Cu,t=>Nu[t]):e}decode(e){return x.isString(e)?e.replace(Ru,t=>Pu[t]):e}toNumber(e){const t=Number.parseFloat(e);return x.isNumber(t)?t:0}toInteger(e){return this.toNumber(Number.parseInt(e,10))}toBoolean(e,t=[]){const n=x.isString(e)?e.toLowerCase():e;return["true","y","1",1,!0,...t].includes(n)}toCamelCase(e){if(!x.isStringFilled(e))return e;const t=/[-_\s]+(.)?/g;return t.test(e)?(e=e.toLowerCase(),e=e.replace(t,(n,i)=>i?i.toUpperCase():""),e[0].toLowerCase()+e.substring(1)):e.match(/^[A-Z]+$/)?e.toLowerCase():e[0].toLowerCase()+e.slice(1)}toPascalCase(e){return x.isStringFilled(e)?this.capitalize(this.toCamelCase(e)):e}toKebabCase(e){if(!x.isStringFilled(e))return e;const t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);return t?t.map(n=>n.toLowerCase()).join("-"):e}capitalize(e){return x.isStringFilled(e)?e[0].toUpperCase()+e.substring(1):e}numberFormat(e,t=0,n=".",i=","){const s=Number.isFinite(e)?e:0,o=Number.isFinite(t)?Math.abs(t):0,l=(o?((a,u)=>{const c=Math.pow(10,u);return Math.round(a*c)/c})(s,o):Math.round(s)).toString().split(".");return l[0].length>3&&(l[0]=l[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,i)),(l[1]||"").length<o&&(l[1]=l[1]||"",l[1]+=new Array(o-l[1].length+1).join("0")),l.join(n)}toDateTime(e,t,n){return!(typeof t>"u")&&x.isStringFilled(t)?z.fromFormat(e,t,n):z.fromISO(e,n)}getDateForLog(){return z.now().toFormat("y-MM-dd HH:mm:ss")}buildQueryString(e){let t="";for(const n in e){if(!e.hasOwnProperty(n))continue;const i=e[n];x.isArray(i)?i.forEach((s,o)=>{t+=encodeURIComponent(n+"["+o+"]")+"="+encodeURIComponent(s)+"&"}):t+=encodeURIComponent(n)+"="+encodeURIComponent(i)+"&"}return t.length>0&&(t=t.substring(0,t.length-1)),t}}const G=new Fu;let Se="";try{Se=navigator?.userAgent.toLowerCase()}catch{Se="?"}let Mu=class{isOpera(){return Se.includes("opera")}isIE(){return"attachEvent"in document&&!this.isOpera()}isIE6(){return Se.includes("msie 6")}isIE7(){return Se.includes("msie 7")}isIE8(){return Se.includes("msie 8")}isIE9(){return"documentMode"in document&&document.documentMode>=9}isIE10(){return"documentMode"in document&&document.documentMode>=10}isSafari(){return Se.includes("safari")&&!Se.includes("chrome")}isFirefox(){return Se.includes("firefox")}isChrome(){return Se.includes("chrome")}detectIEVersion(){if(this.isOpera()||this.isSafari()||this.isFirefox()||this.isChrome())return-1;let e=-1;if(window.MSStream&&!window.ActiveXObject&&"ActiveXObject"in window?e=11:this.isIE10()?e=10:this.isIE9()?e=9:this.isIE()&&(e=8),e===-1||e===8){if(navigator.appName==="Microsoft Internet Explorer"){const t=new RegExp("MSIE ([0-9]+[.0-9]*)"),n=navigator.userAgent.match(t);x.isArrayLike(n)&&n.length>0&&(e=Number.parseFloat(n[1]))}if(navigator.appName==="Netscape"){e=11;const t=new RegExp("Trident/.*rv:([0-9]+[.0-9]*)");if(t.exec(navigator.userAgent)!=null){const n=navigator.userAgent.match(t);x.isArrayLike(n)&&n.length>0&&(e=Number.parseFloat(n[1]))}}}return e}isIE11(){return this.detectIEVersion()>=11}isMac(){return Se.includes("macintosh")}isWin(){return Se.includes("windows")}isLinux(){return Se.includes("linux")&&!this.isAndroid()}isAndroid(){return Se.includes("android")}isIPad(){return Se.includes("ipad;")||this.isMac()&&this.isTouchDevice()}isIPhone(){return Se.includes("iphone;")}isIOS(){return this.isIPad()||this.isIPhone()}isMobile(){return this.isIPhone()||this.isIPad()||this.isAndroid()||Se.includes("mobile")||Se.includes("touch")}isRetina(){return(window.devicePixelRatio&&window.devicePixelRatio>=2)===!0}isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}isDoctype(e){const t=e||document;return t.compatMode?t.compatMode==="CSS1Compat":t.documentElement&&t.documentElement.clientHeight}isLocalStorageSupported(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch{return!1}}detectAndroidVersion(){const e=new RegExp("Android ([0-9]+[.0-9]*)");if(e.exec(navigator.userAgent)!=null){const t=navigator.userAgent.match(e);if(x.isArrayLike(t)&&t.length>0)return Number.parseFloat(t[1])}return 0}};const vo=new Mu,So={sleep:1e3,speed:.001,amount:30},An={sleep:600,speed:.01,amount:30*5};var _o=(r=>(r.undefined="UNDEFINED",r.lead="CRM_LEAD",r.deal="CRM_DEAL",r.contact="CRM_CONTACT",r.company="CRM_COMPANY",r.oldInvoice="CRM_INVOICE",r.invoice="CRM_SMART_INVOICE",r.quote="CRM_QUOTE",r.requisite="CRM_REQUISITE",r))(_o||{}),Eo=(r=>(r[r.undefined=0]="undefined",r[r.lead=1]="lead",r[r.deal=2]="deal",r[r.contact=3]="contact",r[r.company=4]="company",r[r.oldInvoice=5]="oldInvoice",r[r.invoice=31]="invoice",r[r.quote=7]="quote",r[r.requisite=8]="requisite",r))(Eo||{}),de=(r=>(r.App="app",r.Profile="profile",r.Currency="currency",r.AppOptions="appOptions",r.UserOptions="userOptions",r))(de||{});const kt={Free:"F",Demo:"D",Trial:"T",Paid:"P",Local:"L",Subscription:"S"},ko={[kt.Free]:"Free",[kt.Demo]:"Demo",[kt.Trial]:"Trial",[kt.Paid]:"Paid",[kt.Local]:"Local",[kt.Subscription]:"Subscription"},Ot={MainSettings:"MainSettings",UfList:"UfList",UfPage:"UfPage"};var at=(r=>(r.NotSet="notSet",r.JsonArray="jsonArray",r.JsonObject="jsonObject",r.FloatVal="float",r.IntegerVal="integer",r.BoolYN="boolYN",r.StringVal="string",r))(at||{}),ge=(r=>(r.Undefined="undefined",r.WebSocket="webSocket",r.LongPolling="longPolling",r))(ge||{}),xe=(r=>(r.PullConfig="bx-pull-config",r.WebsocketBlocked="bx-pull-websocket-blocked",r.LongPollingBlocked="bx-pull-longpolling-blocked",r.LoggingEnabled="bx-pull-logging-enabled",r))(xe||{}),je=(r=>(r.Online="online",r.Offline="offline",r.Connecting="connect",r))(je||{}),Ur=(r=>(r[r.Unknown=0]="Unknown",r[r.Client=1]="Client",r[r.Backend=2]="Backend",r))(Ur||{}),Ue=(r=>(r.Server="server",r.Client="client",r.Online="online",r.Status="status",r.Revision="revision",r))(Ue||{}),Ie=(r=>(r[r.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",r[r.SERVER_DIE=1001]="SERVER_DIE",r[r.CONFIG_REPLACED=3e3]="CONFIG_REPLACED",r[r.CHANNEL_EXPIRED=3001]="CHANNEL_EXPIRED",r[r.SERVER_RESTARTED=3002]="SERVER_RESTARTED",r[r.CONFIG_EXPIRED=3003]="CONFIG_EXPIRED",r[r.MANUAL=3004]="MANUAL",r[r.STUCK=3005]="STUCK",r[r.WRONG_CHANNEL_ID=4010]="WRONG_CHANNEL_ID",r))(Ie||{}),cr=(r=>(r.CHANNEL_EXPIRE="CHANNEL_EXPIRE",r.CONFIG_EXPIRE="CONFIG_EXPIRE",r.SERVER_RESTART="SERVER_RESTART",r))(cr||{}),In=(r=>(r.Shared="shared",r.Personal="personal",r))(In||{});const Cn={Parse:{code:-32700,message:"Parse error"},InvalidRequest:{code:-32600,message:"Invalid Request"},MethodNotFound:{code:-32601,message:"Method not found"},InvalidParams:{code:-32602,message:"Invalid params"},Internal:{code:-32603,message:"Internal error"}};var st=(r=>(r.Publish="publish",r.GetUsersLastSeen="getUsersLastSeen",r.Ping="ping",r.ListChannels="listChannels",r.SubscribeStatusChange="subscribeStatusChange",r.UnsubscribeStatusChange="unsubscribeStatusChange",r))(st||{});class Vt{_errorCollection;_data;constructor(){this._errorCollection=new Set,this._data=null}get isSuccess(){return this._errorCollection.size===0}setData(e){return this._data=e,this}getData(){return this._data}addError(e){return e instanceof Error?this._errorCollection.add(e):this._errorCollection.add(new Error(e.toString())),this}addErrors(e){for(const t of e)t instanceof Error?this._errorCollection.add(t):this._errorCollection.add(new Error(t.toString()));return this}getErrors(){return this._errorCollection.values()}getErrorMessages(){return[...this.getErrors()].map(e=>e.message)}toString(){return this.isSuccess?`Result (success): data: ${JSON.stringify(this._data)}`:`Result (failure): errors: ${this.getErrorMessages().join(", ")}`}}class ur extends Error{cause;_status;_answerError;constructor(e){const t=`${e.answerError.error}${e.answerError.errorDescription?": "+e.answerError.errorDescription:""}`;super(t),this.cause=e.cause||null,this.name=this.constructor.name,this._status=e.status,this._answerError=e.answerError}get answerError(){return this._answerError}get status(){return this._status}set status(e){this._status=e}toString(){return`${this.answerError.error}${this.answerError.errorDescription?": "+this.answerError.errorDescription:""} (${this.status})`}}class Rn extends Vt{_status;_query;_data;constructor(e,t,n){if(super(),this._data=e,this._query=structuredClone(t),this._status=n,typeof this._data.error<"u"){const i=typeof this._data.error=="string"?this._data:this._data.error;this.addError(new ur({status:this._status,answerError:{error:i.error||"",errorDescription:i.error_description||""}}))}}setData(e){throw new Error("AjaxResult not support setData()")}getData(){return this._data}isMore(){return x.isNumber(this._data?.next)}getTotal(){return G.toInteger(this._data?.total)}getStatus(){return this._status}getQuery(){return this._query}async getNext(e){return this.isMore()&&this.isSuccess?(this._query.start=Number.parseInt(this._data?.next),e.call(this._query.method,this._query.params,this._query.start)):Promise.resolve(!1)}}let Lu=class{#e;#t;#r;_logger=null;constructor(){this.#e=So,this.#r=0,this.#t=0}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}get params(){return{...this.#e}}set params(e){this.#e=e,this.getLogger().log("new restriction manager params",e)}check(e=""){return new Promise(t=>{if(this.#i(),this.#s())return this.getLogger().log(`>> no sleep >>> ${e}`,this.#n()),this.#o(),t(null);{const n=s=>{this.getLogger().info(`>> go sleep >>> ${e}`,this.#n()),setTimeout(()=>{s()},this.#e.sleep)},i=()=>{if(this.#i(),this.#s())return this.getLogger().info(`<< stop sleep <<< ${e}`,this.#n()),this.#o(),t(null);n(i)};n(i)}})}#n(){return`${this.#r.toFixed(4)} from ${this.#e.amount}`}#i(){this.#t>0&&(this.#r-=(Date.now()-this.#t)*this.#e.speed,this.#r<0&&(this.#r=0)),this.#t=Date.now()}#o(){this.#r++}#s(){return this.#r<this.#e.amount}};const Du="X-Request-ID",xu="bx24_request_id",ju="bx24_sdk_ver";let Uu=class{getQueryStringParameterName(){return xu}getQueryStringSdkParameterName(){return ju}generate(){return G.getUuidRfc4122()}getRequestId(){return this.generate()}getHeaderFieldName(){return Du}};function Oo(r,e){return function(){return r.apply(e,arguments)}}const{toString:Bu}=Object.prototype,{getPrototypeOf:Nn}=Object,Br=(r=>e=>{const t=Bu.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),et=r=>(r=r.toLowerCase(),e=>Br(e)===r),$r=r=>e=>typeof e===r,{isArray:Ht}=Array,fr=$r("undefined");function $u(r){return r!==null&&!fr(r)&&r.constructor!==null&&!fr(r.constructor)&&Be(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const To=et("ArrayBuffer");function Wu(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&To(r.buffer),e}const qu=$r("string"),Be=$r("function"),Ao=$r("number"),Wr=r=>r!==null&&typeof r=="object",Vu=r=>r===!0||r===!1,qr=r=>{if(Br(r)!=="object")return!1;const e=Nn(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},Hu=et("Date"),zu=et("File"),Ju=et("Blob"),Gu=et("FileList"),Zu=r=>Wr(r)&&Be(r.pipe),Yu=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Be(r.append)&&((e=Br(r))==="formdata"||e==="object"&&Be(r.toString)&&r.toString()==="[object FormData]"))},Ku=et("URLSearchParams"),[Qu,Xu,ef,tf]=["ReadableStream","Request","Response","Headers"].map(et),rf=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function hr(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,i;if(typeof r!="object"&&(r=[r]),Ht(r))for(n=0,i=r.length;n<i;n++)e.call(null,r[n],n,r);else{const s=t?Object.getOwnPropertyNames(r):Object.keys(r),o=s.length;let l;for(n=0;n<o;n++)l=s[n],e.call(null,r[l],l,r)}}function Io(r,e){e=e.toLowerCase();const t=Object.keys(r);let n=t.length,i;for(;n-- >0;)if(i=t[n],e===i.toLowerCase())return i;return null}const Tt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Co=r=>!fr(r)&&r!==Tt;function Pn(){const{caseless:r}=Co(this)&&this||{},e={},t=(n,i)=>{const s=r&&Io(e,i)||i;qr(e[s])&&qr(n)?e[s]=Pn(e[s],n):qr(n)?e[s]=Pn({},n):Ht(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&hr(arguments[n],t);return e}const nf=(r,e,t,{allOwnKeys:n}={})=>(hr(e,(i,s)=>{t&&Be(i)?r[s]=Oo(i,t):r[s]=i},{allOwnKeys:n}),r),sf=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),of=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},af=(r,e,t,n)=>{let i,s,o;const l={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),s=i.length;s-- >0;)o=i[s],(!n||n(o,r,e))&&!l[o]&&(e[o]=r[o],l[o]=!0);r=t!==!1&&Nn(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},lf=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const n=r.indexOf(e,t);return n!==-1&&n===t},cf=r=>{if(!r)return null;if(Ht(r))return r;let e=r.length;if(!Ao(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},uf=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&Nn(Uint8Array)),ff=(r,e)=>{const n=(r&&r[Symbol.iterator]).call(r);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(r,s[0],s[1])}},hf=(r,e)=>{let t;const n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},df=et("HTMLFormElement"),pf=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,i){return n.toUpperCase()+i}),Ro=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),gf=et("RegExp"),No=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),n={};hr(t,(i,s)=>{let o;(o=e(i,s,r))!==!1&&(n[s]=o||i)}),Object.defineProperties(r,n)},mf=r=>{No(r,(e,t)=>{if(Be(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=r[t];if(Be(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},yf=(r,e)=>{const t={},n=i=>{i.forEach(s=>{t[s]=!0})};return Ht(r)?n(r):n(String(r).split(e)),t},wf=()=>{},bf=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,Fn="abcdefghijklmnopqrstuvwxyz",Po="0123456789",Fo={DIGIT:Po,ALPHA:Fn,ALPHA_DIGIT:Fn+Fn.toUpperCase()+Po},vf=(r=16,e=Fo.ALPHA_DIGIT)=>{let t="";const{length:n}=e;for(;r--;)t+=e[Math.random()*n|0];return t};function Sf(r){return!!(r&&Be(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}const _f=r=>{const e=new Array(10),t=(n,i)=>{if(Wr(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=Ht(n)?[]:{};return hr(n,(o,l)=>{const a=t(o,i+1);!fr(a)&&(s[l]=a)}),e[i]=void 0,s}}return n};return t(r,0)},Ef=et("AsyncFunction"),kf=r=>r&&(Wr(r)||Be(r))&&Be(r.then)&&Be(r.catch),Mo=((r,e)=>r?setImmediate:e?((t,n)=>(Tt.addEventListener("message",({source:i,data:s})=>{i===Tt&&s===t&&n.length&&n.shift()()},!1),i=>{n.push(i),Tt.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Be(Tt.postMessage)),Of=typeof queueMicrotask<"u"?queueMicrotask.bind(Tt):typeof process<"u"&&process.nextTick||Mo,T={isArray:Ht,isArrayBuffer:To,isBuffer:$u,isFormData:Yu,isArrayBufferView:Wu,isString:qu,isNumber:Ao,isBoolean:Vu,isObject:Wr,isPlainObject:qr,isReadableStream:Qu,isRequest:Xu,isResponse:ef,isHeaders:tf,isUndefined:fr,isDate:Hu,isFile:zu,isBlob:Ju,isRegExp:gf,isFunction:Be,isStream:Zu,isURLSearchParams:Ku,isTypedArray:uf,isFileList:Gu,forEach:hr,merge:Pn,extend:nf,trim:rf,stripBOM:sf,inherits:of,toFlatObject:af,kindOf:Br,kindOfTest:et,endsWith:lf,toArray:cf,forEachEntry:ff,matchAll:hf,isHTMLForm:df,hasOwnProperty:Ro,hasOwnProp:Ro,reduceDescriptors:No,freezeMethods:mf,toObjectSet:yf,toCamelCase:pf,noop:wf,toFiniteNumber:bf,findKey:Io,global:Tt,isContextDefined:Co,ALPHABET:Fo,generateString:vf,isSpecCompliantForm:Sf,toJSONObject:_f,isAsyncFn:Ef,isThenable:kf,setImmediate:Mo,asap:Of};function Q(r,e,t,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}T.inherits(Q,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:T.toJSONObject(this.config),code:this.code,status:this.status}}});const Lo=Q.prototype,Do={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{Do[r]={value:r}}),Object.defineProperties(Q,Do),Object.defineProperty(Lo,"isAxiosError",{value:!0}),Q.from=(r,e,t,n,i,s)=>{const o=Object.create(Lo);return T.toFlatObject(r,o,function(a){return a!==Error.prototype},l=>l!=="isAxiosError"),Q.call(o,r.message,e,t,n,i),o.cause=r,o.name=r.name,s&&Object.assign(o,s),o};const Tf=null;function Mn(r){return T.isPlainObject(r)||T.isArray(r)}function xo(r){return T.endsWith(r,"[]")?r.slice(0,-2):r}function jo(r,e,t){return r?r.concat(e).map(function(i,s){return i=xo(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function Af(r){return T.isArray(r)&&!r.some(Mn)}const If=T.toFlatObject(T,{},null,function(e){return/^is[A-Z]/.test(e)});function Vr(r,e,t){if(!T.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=T.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,m){return!T.isUndefined(m[p])});const n=t.metaTokens,i=t.visitor||c,s=t.dots,o=t.indexes,a=(t.Blob||typeof Blob<"u"&&Blob)&&T.isSpecCompliantForm(e);if(!T.isFunction(i))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(T.isDate(g))return g.toISOString();if(!a&&T.isBlob(g))throw new Q("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(g)||T.isTypedArray(g)?a&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function c(g,p,m){let y=g;if(g&&!m&&typeof g=="object"){if(T.endsWith(p,"{}"))p=n?p:p.slice(0,-2),g=JSON.stringify(g);else if(T.isArray(g)&&Af(g)||(T.isFileList(g)||T.endsWith(p,"[]"))&&(y=T.toArray(g)))return p=xo(p),y.forEach(function(_,b){!(T.isUndefined(_)||_===null)&&e.append(o===!0?jo([p],b,s):o===null?p:p+"[]",u(_))}),!1}return Mn(g)?!0:(e.append(jo(m,p,s),u(g)),!1)}const h=[],f=Object.assign(If,{defaultVisitor:c,convertValue:u,isVisitable:Mn});function d(g,p){if(!T.isUndefined(g)){if(h.indexOf(g)!==-1)throw Error("Circular reference detected in "+p.join("."));h.push(g),T.forEach(g,function(y,w){(!(T.isUndefined(y)||y===null)&&i.call(e,y,T.isString(w)?w.trim():w,p,f))===!0&&d(y,p?p.concat(w):[w])}),h.pop()}}if(!T.isObject(r))throw new TypeError("data must be an object");return d(r),e}function Uo(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Ln(r,e){this._pairs=[],r&&Vr(r,this,e)}const Bo=Ln.prototype;Bo.append=function(e,t){this._pairs.push([e,t])},Bo.toString=function(e){const t=e?function(n){return e.call(this,n,Uo)}:Uo;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function Cf(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $o(r,e,t){if(!e)return r;const n=t&&t.encode||Cf,i=t&&t.serialize;let s;if(i?s=i(e,t):s=T.isURLSearchParams(e)?e.toString():new Ln(e,t).toString(n),s){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}class Wo{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){T.forEach(this.handlers,function(n){n!==null&&e(n)})}}const qo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Rf={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ln,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Dn=typeof window<"u"&&typeof document<"u",xn=typeof navigator=="object"&&navigator||void 0,Nf=Dn&&(!xn||["ReactNative","NativeScript","NS"].indexOf(xn.product)<0),Pf=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ff=Dn&&window.location.href||"http://localhost",Me={...{__proto__:null,hasBrowserEnv:Dn,hasStandardBrowserEnv:Nf,hasStandardBrowserWebWorkerEnv:Pf,navigator:xn,origin:Ff},...Rf};function Mf(r,e){return Vr(r,new Me.classes.URLSearchParams,Object.assign({visitor:function(t,n,i,s){return Me.isNode&&T.isBuffer(t)?(this.append(n,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function Lf(r){return T.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Df(r){const e={},t=Object.keys(r);let n;const i=t.length;let s;for(n=0;n<i;n++)s=t[n],e[s]=r[s];return e}function Vo(r){function e(t,n,i,s){let o=t[s++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),a=s>=t.length;return o=!o&&T.isArray(i)?i.length:o,a?(T.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!l):((!i[o]||!T.isObject(i[o]))&&(i[o]=[]),e(t,n,i[o],s)&&T.isArray(i[o])&&(i[o]=Df(i[o])),!l)}if(T.isFormData(r)&&T.isFunction(r.entries)){const t={};return T.forEachEntry(r,(n,i)=>{e(Lf(n),i,t,0)}),t}return null}function xf(r,e,t){if(T.isString(r))try{return(e||JSON.parse)(r),T.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(0,JSON.stringify)(r)}const dr={transitional:qo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,s=T.isObject(e);if(s&&T.isHTMLForm(e)&&(e=new FormData(e)),T.isFormData(e))return i?JSON.stringify(Vo(e)):e;if(T.isArrayBuffer(e)||T.isBuffer(e)||T.isStream(e)||T.isFile(e)||T.isBlob(e)||T.isReadableStream(e))return e;if(T.isArrayBufferView(e))return e.buffer;if(T.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Mf(e,this.formSerializer).toString();if((l=T.isFileList(e))||n.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Vr(l?{"files[]":e}:e,a&&new a,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),xf(e)):e}],transformResponse:[function(e){const t=this.transitional||dr.transitional,n=t&&t.forcedJSONParsing,i=this.responseType==="json";if(T.isResponse(e)||T.isReadableStream(e))return e;if(e&&T.isString(e)&&(n&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(l){if(o)throw l.name==="SyntaxError"?Q.from(l,Q.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Me.classes.FormData,Blob:Me.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};T.forEach(["delete","get","head","post","put","patch"],r=>{dr.headers[r]={}});const jf=T.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Uf=r=>{const e={};let t,n,i;return r&&r.split(`
|
|
2
|
-
`).forEach(function(o){
|
|
3
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(i=>n.set(i)),n}static accessor(e){const n=(this[Ho]=this[Ho]={accessors:{}}).accessors,i=this.prototype;function s(o){const l=pr(o);n[l]||(qf(i,o),n[l]=!0)}return T.isArray(e)?e.forEach(s):s(e),this}};Le.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),T.reduceDescriptors(Le.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}}),T.freezeMethods(Le);function Un(r,e){const t=this||dr,n=e||t,i=Le.from(n.headers);let s=n.data;return T.forEach(r,function(l){s=l.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function zo(r){return!!(r&&r.__CANCEL__)}function zt(r,e,t){Q.call(this,r??"canceled",Q.ERR_CANCELED,e,t),this.name="CanceledError"}T.inherits(zt,Q,{__CANCEL__:!0});function Jo(r,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new Q("Request failed with status code "+t.status,[Q.ERR_BAD_REQUEST,Q.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Vf(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function Hf(r,e){r=r||10;const t=new Array(r),n=new Array(r);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(a){const u=Date.now(),c=n[s];o||(o=u),t[i]=a,n[i]=u;let h=s,f=0;for(;h!==i;)f+=t[h++],h=h%r;if(i=(i+1)%r,i===s&&(s=(s+1)%r),u-o<e)return;const d=c&&u-c;return d?Math.round(f*1e3/d):void 0}}function zf(r,e){let t=0,n=1e3/e,i,s;const o=(u,c=Date.now())=>{t=c,i=null,s&&(clearTimeout(s),s=null),r.apply(null,u)};return[(...u)=>{const c=Date.now(),h=c-t;h>=n?o(u,c):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},n-h)))},()=>i&&o(i)]}const zr=(r,e,t=3)=>{let n=0;const i=Hf(50,250);return zf(s=>{const o=s.loaded,l=s.lengthComputable?s.total:void 0,a=o-n,u=i(a),c=o<=l;n=o;const h={loaded:o,total:l,progress:l?o/l:void 0,bytes:a,rate:u||void 0,estimated:u&&l&&c?(l-o)/u:void 0,event:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};r(h)},t)},Go=(r,e)=>{const t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},Zo=r=>(...e)=>T.asap(()=>r(...e)),Jf=Me.hasStandardBrowserEnv?function(){const e=Me.navigator&&/(msie|trident)/i.test(Me.navigator.userAgent),t=document.createElement("a");let n;function i(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return n=i(window.location.href),function(o){const l=T.isString(o)?i(o):o;return l.protocol===n.protocol&&l.host===n.host}}():function(){return function(){return!0}}(),Gf=Me.hasStandardBrowserEnv?{write(r,e,t,n,i,s){const o=[r+"="+encodeURIComponent(e)];T.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),T.isString(n)&&o.push("path="+n),T.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(r){const e=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Zf(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function Yf(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function Yo(r,e){return r&&!Zf(e)?Yf(r,e):e}const Ko=r=>r instanceof Le?{...r}:r;function At(r,e){e=e||{};const t={};function n(u,c,h){return T.isPlainObject(u)&&T.isPlainObject(c)?T.merge.call({caseless:h},u,c):T.isPlainObject(c)?T.merge({},c):T.isArray(c)?c.slice():c}function i(u,c,h){if(T.isUndefined(c)){if(!T.isUndefined(u))return n(void 0,u,h)}else return n(u,c,h)}function s(u,c){if(!T.isUndefined(c))return n(void 0,c)}function o(u,c){if(T.isUndefined(c)){if(!T.isUndefined(u))return n(void 0,u)}else return n(void 0,c)}function l(u,c,h){if(h in e)return n(u,c);if(h in r)return n(void 0,u)}const a={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,c)=>i(Ko(u),Ko(c),!0)};return T.forEach(Object.keys(Object.assign({},r,e)),function(c){const h=a[c]||i,f=h(r[c],e[c],c);T.isUndefined(f)&&h!==l||(t[c]=f)}),t}const Qo=r=>{const e=At({},r);let{data:t,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:l}=e;e.headers=o=Le.from(o),e.url=$o(Yo(e.baseURL,e.url),r.params,r.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let a;if(T.isFormData(t)){if(Me.hasStandardBrowserEnv||Me.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((a=o.getContentType())!==!1){const[u,...c]=a?a.split(";").map(h=>h.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...c].join("; "))}}if(Me.hasStandardBrowserEnv&&(n&&T.isFunction(n)&&(n=n(e)),n||n!==!1&&Jf(e.url))){const u=i&&s&&Gf.read(s);u&&o.set(i,u)}return e},Kf=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(t,n){const i=Qo(r);let s=i.data;const o=Le.from(i.headers).normalize();let{responseType:l,onUploadProgress:a,onDownloadProgress:u}=i,c,h,f,d,g;function p(){d&&d(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(c),i.signal&&i.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(i.method.toUpperCase(),i.url,!0),m.timeout=i.timeout;function y(){if(!m)return;const _=Le.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),k={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:_,config:r,request:m};Jo(function(O){t(O),p()},function(O){n(O),p()},k),m=null}"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(y)},m.onabort=function(){m&&(n(new Q("Request aborted",Q.ECONNABORTED,r,m)),m=null)},m.onerror=function(){n(new Q("Network Error",Q.ERR_NETWORK,r,m)),m=null},m.ontimeout=function(){let b=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const k=i.transitional||qo;i.timeoutErrorMessage&&(b=i.timeoutErrorMessage),n(new Q(b,k.clarifyTimeoutError?Q.ETIMEDOUT:Q.ECONNABORTED,r,m)),m=null},s===void 0&&o.setContentType(null),"setRequestHeader"in m&&T.forEach(o.toJSON(),function(b,k){m.setRequestHeader(k,b)}),T.isUndefined(i.withCredentials)||(m.withCredentials=!!i.withCredentials),l&&l!=="json"&&(m.responseType=i.responseType),u&&([f,g]=zr(u,!0),m.addEventListener("progress",f)),a&&m.upload&&([h,d]=zr(a),m.upload.addEventListener("progress",h),m.upload.addEventListener("loadend",d)),(i.cancelToken||i.signal)&&(c=_=>{m&&(n(!_||_.type?new zt(null,r,m):_),m.abort(),m=null)},i.cancelToken&&i.cancelToken.subscribe(c),i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c)));const w=Vf(i.url);if(w&&Me.protocols.indexOf(w)===-1){n(new Q("Unsupported protocol "+w+":",Q.ERR_BAD_REQUEST,r));return}m.send(s||null)})},Qf=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,i;const s=function(u){if(!i){i=!0,l();const c=u instanceof Error?u:this.reason;n.abort(c instanceof Q?c:new zt(c instanceof Error?c.message:c))}};let o=e&&setTimeout(()=>{o=null,s(new Q(`timeout ${e} of ms exceeded`,Q.ETIMEDOUT))},e);const l=()=>{r&&(o&&clearTimeout(o),o=null,r.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),r=null)};r.forEach(u=>u.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>T.asap(l),a}},Xf=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let n=0,i;for(;n<t;)i=n+e,yield r.slice(n,i),n=i},eh=async function*(r,e){for await(const t of th(r))yield*Xf(t,e)},th=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},Xo=(r,e,t,n)=>{const i=eh(r,e);let s=0,o,l=a=>{o||(o=!0,n&&n(a))};return new ReadableStream({async pull(a){try{const{done:u,value:c}=await i.next();if(u){l(),a.close();return}let h=c.byteLength;if(t){let f=s+=h;t(f)}a.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(a){return l(a),i.return()}},{highWaterMark:2})},Jr=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ea=Jr&&typeof ReadableStream=="function",rh=Jr&&(typeof TextEncoder=="function"?(r=>e=>r.encode(e))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),ta=(r,...e)=>{try{return!!r(...e)}catch{return!1}},nh=ea&&ta(()=>{let r=!1;const e=new Request(Me.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!e}),ra=64*1024,Bn=ea&&ta(()=>T.isReadableStream(new Response("").body)),Gr={stream:Bn&&(r=>r.body)};Jr&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Gr[e]&&(Gr[e]=T.isFunction(r[e])?t=>t[e]():(t,n)=>{throw new Q(`Response type '${e}' is not supported`,Q.ERR_NOT_SUPPORT,n)})})})(new Response);const ih=async r=>{if(r==null)return 0;if(T.isBlob(r))return r.size;if(T.isSpecCompliantForm(r))return(await new Request(Me.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(T.isArrayBufferView(r)||T.isArrayBuffer(r))return r.byteLength;if(T.isURLSearchParams(r)&&(r=r+""),T.isString(r))return(await rh(r)).byteLength},sh=async(r,e)=>{const t=T.toFiniteNumber(r.getContentLength());return t??ih(e)},$n={http:Tf,xhr:Kf,fetch:Jr&&(async r=>{let{url:e,method:t,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:l,onUploadProgress:a,responseType:u,headers:c,withCredentials:h="same-origin",fetchOptions:f}=Qo(r);u=u?(u+"").toLowerCase():"text";let d=Qf([i,s&&s.toAbortSignal()],o),g;const p=d&&d.unsubscribe&&(()=>{d.unsubscribe()});let m;try{if(a&&nh&&t!=="get"&&t!=="head"&&(m=await sh(c,n))!==0){let k=new Request(e,{method:"POST",body:n,duplex:"half"}),S;if(T.isFormData(n)&&(S=k.headers.get("content-type"))&&c.setContentType(S),k.body){const[O,C]=Go(m,zr(Zo(a)));n=Xo(k.body,ra,O,C)}}T.isString(h)||(h=h?"include":"omit");const y="credentials"in Request.prototype;g=new Request(e,{...f,signal:d,method:t.toUpperCase(),headers:c.normalize().toJSON(),body:n,duplex:"half",credentials:y?h:void 0});let w=await fetch(g);const _=Bn&&(u==="stream"||u==="response");if(Bn&&(l||_&&p)){const k={};["status","statusText","headers"].forEach(F=>{k[F]=w[F]});const S=T.toFiniteNumber(w.headers.get("content-length")),[O,C]=l&&Go(S,zr(Zo(l),!0))||[];w=new Response(Xo(w.body,ra,O,()=>{C&&C(),p&&p()}),k)}u=u||"text";let b=await Gr[T.findKey(Gr,u)||"text"](w,r);return!_&&p&&p(),await new Promise((k,S)=>{Jo(k,S,{data:b,headers:Le.from(w.headers),status:w.status,statusText:w.statusText,config:r,request:g})})}catch(y){throw p&&p(),y&&y.name==="TypeError"&&/fetch/i.test(y.message)?Object.assign(new Q("Network Error",Q.ERR_NETWORK,r,g),{cause:y.cause||y}):Q.from(y,y&&y.code,r,g)}})};T.forEach($n,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const na=r=>`- ${r}`,oh=r=>T.isFunction(r)||r===null||r===!1,ia={getAdapter:r=>{r=T.isArray(r)?r:[r];const{length:e}=r;let t,n;const i={};for(let s=0;s<e;s++){t=r[s];let o;if(n=t,!oh(t)&&(n=$n[(o=String(t)).toLowerCase()],n===void 0))throw new Q(`Unknown adapter '${o}'`);if(n)break;i[o||"#"+s]=n}if(!n){const s=Object.entries(i).map(([l,a])=>`adapter ${l} `+(a===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since :
|
|
4
|
-
`+
|
|
5
|
-
`):" "+
|
|
6
|
-
`+s):n.stack=s}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=At(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:s}=t;n!==void 0&&Vn.assertOptions(n,{silentJSONParsing:pt.transitional(pt.boolean),forcedJSONParsing:pt.transitional(pt.boolean),clarifyTimeoutError:pt.transitional(pt.boolean)},!1),i!=null&&(T.isFunction(i)?t.paramsSerializer={serialize:i}:Vn.assertOptions(i,{encode:pt.function,serialize:pt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&T.merge(s.common,s[t.method]);s&&T.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),t.headers=Le.concat(o,s);const l=[];let a=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(t)===!1||(a=a&&p.synchronous,l.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let c,h=0,f;if(!a){const g=[sa.bind(this),void 0];for(g.unshift.apply(g,l),g.push.apply(g,u),f=g.length,c=Promise.resolve(t);h<f;)c=c.then(g[h++],g[h++]);return c}f=l.length;let d=t;for(h=0;h<f;){const g=l[h++],p=l[h++];try{d=g(d)}catch(m){p.call(this,m);break}}try{c=sa.call(this,d)}catch(g){return Promise.reject(g)}for(h=0,f=u.length;h<f;)c=c.then(u[h++],u[h++]);return c}getUri(e){e=At(this.defaults,e);const t=Yo(e.baseURL,e.url);return $o(t,e.params,e.paramsSerializer)}};T.forEach(["delete","get","head","options"],function(e){It.prototype[e]=function(t,n){return this.request(At(n||{},{method:e,url:t,data:(n||{}).data}))}}),T.forEach(["post","put","patch"],function(e){function t(n){return function(s,o,l){return this.request(At(l||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}It.prototype[e]=t(),It.prototype[e+"Form"]=t(!0)});let lh=class Sl{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(l=>{n.subscribe(l),s=l}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,l){n.reason||(n.reason=new zt(s,o,l),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Sl(function(i){e=i}),cancel:e}}};function ch(r){return function(t){return r.apply(null,t)}}function uh(r){return T.isObject(r)&&r.isAxiosError===!0}const Hn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Hn).forEach(([r,e])=>{Hn[e]=r});function la(r){const e=new It(r),t=Oo(It.prototype.request,e);return T.extend(t,It.prototype,e,{allOwnKeys:!0}),T.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return la(At(r,i))},t}const be=la(dr);be.Axios=It,be.CanceledError=zt,be.CancelToken=lh,be.isCancel=zo,be.VERSION=oa,be.toFormData=Vr,be.AxiosError=Q,be.Cancel=be.CanceledError,be.all=function(e){return Promise.all(e)},be.spread=ch,be.isAxiosError=uh,be.mergeConfig=At,be.AxiosHeaders=Le,be.formToJSON=r=>Vo(T.isHTMLForm(r)?new FormData(r):r),be.getAdapter=ia.getAdapter,be.HttpStatusCode=Hn,be.default=be;const{Axios:vd,AxiosError:ca,CanceledError:Sd,isCancel:_d,CancelToken:Ed,VERSION:kd,all:Od,Cancel:Td,isAxiosError:Ad,spread:Id,toFormData:Cd,AxiosHeaders:Rd,HttpStatusCode:Nd,formToJSON:Pd,getAdapter:Fd,mergeConfig:Md}=be;var Ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ua(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function fh(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var zn,fa;function hh(){return fa||(fa=1,zn=Error),zn}var Jn,ha;function dh(){return ha||(ha=1,Jn=EvalError),Jn}var Gn,da;function ph(){return da||(da=1,Gn=RangeError),Gn}var Zn,pa;function gh(){return pa||(pa=1,Zn=ReferenceError),Zn}var Yn,ga;function ma(){return ga||(ga=1,Yn=SyntaxError),Yn}var Kn,ya;function gr(){return ya||(ya=1,Kn=TypeError),Kn}var Qn,wa;function mh(){return wa||(wa=1,Qn=URIError),Qn}var Xn,ba;function yh(){return ba||(ba=1,Xn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==i||o.enumerable!==!0)return!1}return!0}),Xn}var ei,va;function wh(){if(va)return ei;va=1;var r=typeof Symbol<"u"&&Symbol,e=yh();return ei=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},ei}var ti,Sa;function bh(){if(Sa)return ti;Sa=1;var r={__proto__:null,foo:{}},e=Object;return ti=function(){return{__proto__:r}.foo===r.foo&&!(r instanceof e)},ti}var ri,_a;function vh(){if(_a)return ri;_a=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",i=function(a,u){for(var c=[],h=0;h<a.length;h+=1)c[h]=a[h];for(var f=0;f<u.length;f+=1)c[f+a.length]=u[f];return c},s=function(a,u){for(var c=[],h=u,f=0;h<a.length;h+=1,f+=1)c[f]=a[h];return c},o=function(l,a){for(var u="",c=0;c<l.length;c+=1)u+=l[c],c+1<l.length&&(u+=a);return u};return ri=function(a){var u=this;if(typeof u!="function"||e.apply(u)!==n)throw new TypeError(r+u);for(var c=s(arguments,1),h,f=function(){if(this instanceof h){var y=u.apply(this,i(c,arguments));return Object(y)===y?y:this}return u.apply(a,i(c,arguments))},d=t(0,u.length-c.length),g=[],p=0;p<d;p++)g[p]="$"+p;if(h=Function("binder","return function ("+o(g,",")+"){ return binder.apply(this,arguments); }")(f),u.prototype){var m=function(){};m.prototype=u.prototype,h.prototype=new m,m.prototype=null}return h},ri}var ni,Ea;function ii(){if(Ea)return ni;Ea=1;var r=vh();return ni=Function.prototype.bind||r,ni}var si,ka;function Sh(){if(ka)return si;ka=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=ii();return si=t.call(r,e),si}var oi,Oa;function Jt(){if(Oa)return oi;Oa=1;var r,e=hh(),t=dh(),n=ph(),i=gh(),s=ma(),o=gr(),l=mh(),a=Function,u=function(X){try{return a('"use strict"; return ('+X+").constructor;")()}catch{}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch{c=null}var h=function(){throw new o},f=c?function(){try{return arguments.callee,h}catch{try{return c(arguments,"callee").get}catch{return h}}}():h,d=wh()(),g=bh()(),p=Object.getPrototypeOf||(g?function(X){return X.__proto__}:null),m={},y=typeof Uint8Array>"u"||!p?r:p(Uint8Array),w={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":d&&p?p([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":m,"%AsyncGenerator%":m,"%AsyncGeneratorFunction%":m,"%AsyncIteratorPrototype%":m,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":t,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":a,"%GeneratorFunction%":m,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":d&&p?p(p([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!d||!p?r:p(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!d||!p?r:p(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":d&&p?p(""[Symbol.iterator]()):r,"%Symbol%":d?Symbol:r,"%SyntaxError%":s,"%ThrowTypeError%":f,"%TypedArray%":y,"%TypeError%":o,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":l,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet};if(p)try{null.error}catch(X){var _=p(p(X));w["%Error.prototype%"]=_}var b=function X(A){var ne;if(A==="%AsyncFunction%")ne=u("async function () {}");else if(A==="%GeneratorFunction%")ne=u("function* () {}");else if(A==="%AsyncGeneratorFunction%")ne=u("async function* () {}");else if(A==="%AsyncGenerator%"){var te=X("%AsyncGeneratorFunction%");te&&(ne=te.prototype)}else if(A==="%AsyncIteratorPrototype%"){var ce=X("%AsyncGenerator%");ce&&p&&(ne=p(ce.prototype))}return w[A]=ne,ne},k={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},S=ii(),O=Sh(),C=S.call(Function.call,Array.prototype.concat),F=S.call(Function.apply,Array.prototype.splice),R=S.call(Function.call,String.prototype.replace),Y=S.call(Function.call,String.prototype.slice),B=S.call(Function.call,RegExp.prototype.exec),W=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ee=/\\(\\)?/g,D=function(A){var ne=Y(A,0,1),te=Y(A,-1);if(ne==="%"&&te!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(te==="%"&&ne!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var ce=[];return R(A,W,function($,re,K,se){ce[ce.length]=K?R(se,ee,"$1"):re||$}),ce},he=function(A,ne){var te=A,ce;if(O(k,te)&&(ce=k[te],te="%"+ce[0]+"%"),O(w,te)){var $=w[te];if($===m&&($=b(te)),typeof $>"u"&&!ne)throw new o("intrinsic "+A+" exists, but is not available. Please file an issue!");return{alias:ce,name:te,value:$}}throw new s("intrinsic "+A+" does not exist!")};return oi=function(A,ne){if(typeof A!="string"||A.length===0)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof ne!="boolean")throw new o('"allowMissing" argument must be a boolean');if(B(/^%?[^%]*%?$/,A)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var te=D(A),ce=te.length>0?te[0]:"",$=he("%"+ce+"%",ne),re=$.name,K=$.value,se=!1,ue=$.alias;ue&&(ce=ue[0],F(te,C([0,1],ue)));for(var me=1,U=!0;me<te.length;me+=1){var pe=te[me],Re=Y(pe,0,1),$e=Y(pe,-1);if((Re==='"'||Re==="'"||Re==="`"||$e==='"'||$e==="'"||$e==="`")&&Re!==$e)throw new s("property names with quotes must have matching quotes");if((pe==="constructor"||!U)&&(se=!0),ce+="."+pe,re="%"+ce+"%",O(w,re))K=w[re];else if(K!=null){if(!(pe in K)){if(!ne)throw new o("base intrinsic for "+A+" exists, but the property is not available.");return}if(c&&me+1>=te.length){var ze=c(K,pe);U=!!ze,U&&"get"in ze&&!("originalValue"in ze.get)?K=ze.get:K=K[pe]}else U=O(K,pe),K=K[pe];U&&!se&&(w[re]=K)}}return K},oi}var ai={exports:{}},li,Ta;function ci(){if(Ta)return li;Ta=1;var r=Jt(),e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return li=e,li}var ui,Aa;function Ia(){if(Aa)return ui;Aa=1;var r=Jt(),e=r("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return ui=e,ui}var fi,Ca;function _h(){if(Ca)return fi;Ca=1;var r=ci(),e=ma(),t=gr(),n=Ia();return fi=function(s,o,l){if(!s||typeof s!="object"&&typeof s!="function")throw new t("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,f=!!n&&n(s,o);if(r)r(s,o,{configurable:c===null&&f?f.configurable:!c,enumerable:a===null&&f?f.enumerable:!a,value:l,writable:u===null&&f?f.writable:!u});else if(h||!a&&!u&&!c)s[o]=l;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},fi}var hi,Ra;function Eh(){if(Ra)return hi;Ra=1;var r=ci(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},hi=e,hi}var di,Na;function kh(){if(Na)return di;Na=1;var r=Jt(),e=_h(),t=Eh()(),n=Ia(),i=gr(),s=r("%Math.floor%");return di=function(l,a){if(typeof l!="function")throw new i("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||s(a)!==a)throw new i("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],c=!0,h=!0;if("length"in l&&n){var f=n(l,"length");f&&!f.configurable&&(c=!1),f&&!f.writable&&(h=!1)}return(c||h||!u)&&(t?e(l,"length",a,!0,!0):e(l,"length",a)),l},di}var Pa;function Oh(){return Pa||(Pa=1,function(r){var e=ii(),t=Jt(),n=kh(),i=gr(),s=t("%Function.prototype.apply%"),o=t("%Function.prototype.call%"),l=t("%Reflect.apply%",!0)||e.call(o,s),a=ci(),u=t("%Math.max%");r.exports=function(f){if(typeof f!="function")throw new i("a function is required");var d=l(e,o,arguments);return n(d,1+u(0,f.length-(arguments.length-1)),!0)};var c=function(){return l(e,s,arguments)};a?a(r.exports,"apply",{value:c}):r.exports.apply=c}(ai)),ai.exports}var pi,Fa;function Th(){if(Fa)return pi;Fa=1;var r=Jt(),e=Oh(),t=e(r("String.prototype.indexOf"));return pi=function(i,s){var o=r(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e(o):o},pi}const Ah=fh({__proto__:null,default:{}});var gi,Ma;function Ih(){if(Ma)return gi;Ma=1;var r=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=r&&e&&typeof e.get=="function"?e.get:null,n=r&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,s=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,o=i&&s&&typeof s.get=="function"?s.get:null,l=i&&Set.prototype.forEach,a=typeof WeakMap=="function"&&WeakMap.prototype,u=a?WeakMap.prototype.has:null,c=typeof WeakSet=="function"&&WeakSet.prototype,h=c?WeakSet.prototype.has:null,f=typeof WeakRef=="function"&&WeakRef.prototype,d=f?WeakRef.prototype.deref:null,g=Boolean.prototype.valueOf,p=Object.prototype.toString,m=Function.prototype.toString,y=String.prototype.match,w=String.prototype.slice,_=String.prototype.replace,b=String.prototype.toUpperCase,k=String.prototype.toLowerCase,S=RegExp.prototype.test,O=Array.prototype.concat,C=Array.prototype.join,F=Array.prototype.slice,R=Math.floor,Y=typeof BigInt=="function"?BigInt.prototype.valueOf:null,B=Object.getOwnPropertySymbols,W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ee=typeof Symbol=="function"&&typeof Symbol.iterator=="object",D=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ee||!0)?Symbol.toStringTag:null,he=Object.prototype.propertyIsEnumerable,X=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(v){return v.__proto__}:null);function A(v,E){if(v===1/0||v===-1/0||v!==v||v&&v>-1e3&&v<1e3||S.call(/e/,E))return E;var P=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof v=="number"){var V=v<0?-R(-v):R(v);if(V!==v){var Z=String(V),H=w.call(E,Z.length+1);return _.call(Z,P,"$&_")+"."+_.call(_.call(H,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _.call(E,P,"$&_")}var ne=Ah,te=ne.custom,ce=tt(te)?te:null,$={__proto__:null,double:'"',single:"'"},re={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};gi=function v(E,P,V,Z){var H=P||{};if(rt(H,"quoteStyle")&&!rt($,H.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(rt(H,"maxStringLength")&&(typeof H.maxStringLength=="number"?H.maxStringLength<0&&H.maxStringLength!==1/0:H.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Ne=rt(H,"customInspect")?H.customInspect:!0;if(typeof Ne!="boolean"&&Ne!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(rt(H,"indent")&&H.indent!==null&&H.indent!==" "&&!(parseInt(H.indent,10)===H.indent&&H.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(rt(H,"numericSeparator")&&typeof H.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var nt=H.numericSeparator;if(typeof E>"u")return"undefined";if(E===null)return"null";if(typeof E=="boolean")return E?"true":"false";if(typeof E=="string")return We(E,H);if(typeof E=="number"){if(E===0)return 1/0/E>0?"0":"-0";var Oe=String(E);return nt?A(E,Oe):Oe}if(typeof E=="bigint"){var wt=String(E)+"n";return nt?A(E,wt):wt}var Li=typeof H.depth>"u"?5:H.depth;if(typeof V>"u"&&(V=0),V>=Li&&Li>0&&typeof E=="object")return ue(E)?"[Array]":"[Object]";var Qt=Mi(H,V);if(typeof Z>"u")Z=[];else if(Qr(Z,E)>=0)return"[Circular]";function it(Xt,tn,hd){if(tn&&(Z=F.call(Z),Z.push(tn)),hd){var vl={depth:H.depth};return rt(H,"quoteStyle")&&(vl.quoteStyle=H.quoteStyle),v(Xt,vl,V+1,Z)}return v(Xt,H,V+1,Z)}if(typeof E=="function"&&!U(E)){var dl=Ge(E),pl=N(E,it);return"[Function"+(dl?": "+dl:" (anonymous)")+"]"+(pl.length>0?" { "+C.call(pl,", ")+" }":"")}if(tt(E)){var gl=ee?_.call(String(E),/^(Symbol\(.*\))_[^)]*$/,"$1"):W.call(E);return typeof E=="object"&&!ee?yt(gl):gl}if(Pi(E)){for(var br="<"+k.call(String(E.nodeName)),Di=E.attributes||[],en=0;en<Di.length;en++)br+=" "+Di[en].name+"="+K(se(Di[en].value),"double",H);return br+=">",E.childNodes&&E.childNodes.length&&(br+="..."),br+="</"+k.call(String(E.nodeName))+">",br}if(ue(E)){if(E.length===0)return"[]";var xi=N(E,it);return Qt&&!Fi(xi)?"["+Ee(xi,Qt)+"]":"[ "+C.call(xi,", ")+" ]"}if(pe(E)){var ji=N(E,it);return!("cause"in Error.prototype)&&"cause"in E&&!he.call(E,"cause")?"{ ["+String(E)+"] "+C.call(O.call("[cause]: "+it(E.cause),ji),", ")+" }":ji.length===0?"["+String(E)+"]":"{ ["+String(E)+"] "+C.call(ji,", ")+" }"}if(typeof E=="object"&&Ne){if(ce&&typeof E[ce]=="function"&&ne)return ne(E,{depth:Li-V});if(Ne!=="symbol"&&typeof E.inspect=="function")return E.inspect()}if(mt(E)){var ml=[];return n&&n.call(E,function(Xt,tn){ml.push(it(tn,E,!0)+" => "+it(Xt,E))}),Xr("Map",t.call(E),ml,Qt)}if(Ri(E)){var yl=[];return l&&l.call(E,function(Xt){yl.push(it(Xt,E))}),Xr("Set",o.call(E),yl,Qt)}if(Ii(E))return Nt("WeakMap");if(Ni(E))return Nt("WeakSet");if(Ci(E))return Nt("WeakRef");if($e(E))return yt(it(Number(E)));if(Kt(E))return yt(it(Y.call(E)));if(ze(E))return yt(g.call(E));if(Re(E))return yt(it(String(E)));if(typeof window<"u"&&E===window)return"{ [object Window] }";if(typeof globalThis<"u"&&E===globalThis||typeof Ct<"u"&&E===Ct)return"{ [object globalThis] }";if(!me(E)&&!U(E)){var Ui=N(E,it),wl=X?X(E)===Object.prototype:E instanceof Object||E.constructor===Object,Bi=E instanceof Object?"":"null prototype",bl=!wl&&D&&Object(E)===E&&D in E?w.call(Je(E),8,-1):Bi?"Object":"",fd=wl||typeof E.constructor!="function"?"":E.constructor.name?E.constructor.name+" ":"",$i=fd+(bl||Bi?"["+C.call(O.call([],bl||[],Bi||[]),": ")+"] ":"");return Ui.length===0?$i+"{}":Qt?$i+"{"+Ee(Ui,Qt)+"}":$i+"{ "+C.call(Ui,", ")+" }"}return String(E)};function K(v,E,P){var V=P.quoteStyle||E,Z=$[V];return Z+v+Z}function se(v){return _.call(String(v),/"/g,""")}function ue(v){return Je(v)==="[object Array]"&&(!D||!(typeof v=="object"&&D in v))}function me(v){return Je(v)==="[object Date]"&&(!D||!(typeof v=="object"&&D in v))}function U(v){return Je(v)==="[object RegExp]"&&(!D||!(typeof v=="object"&&D in v))}function pe(v){return Je(v)==="[object Error]"&&(!D||!(typeof v=="object"&&D in v))}function Re(v){return Je(v)==="[object String]"&&(!D||!(typeof v=="object"&&D in v))}function $e(v){return Je(v)==="[object Number]"&&(!D||!(typeof v=="object"&&D in v))}function ze(v){return Je(v)==="[object Boolean]"&&(!D||!(typeof v=="object"&&D in v))}function tt(v){if(ee)return v&&typeof v=="object"&&v instanceof Symbol;if(typeof v=="symbol")return!0;if(!v||typeof v!="object"||!W)return!1;try{return W.call(v),!0}catch{}return!1}function Kt(v){if(!v||typeof v!="object"||!Y)return!1;try{return Y.call(v),!0}catch{}return!1}var Rt=Object.prototype.hasOwnProperty||function(v){return v in this};function rt(v,E){return Rt.call(v,E)}function Je(v){return p.call(v)}function Ge(v){if(v.name)return v.name;var E=y.call(m.call(v),/^function\s*([\w$]+)/);return E?E[1]:null}function Qr(v,E){if(v.indexOf)return v.indexOf(E);for(var P=0,V=v.length;P<V;P++)if(v[P]===E)return P;return-1}function mt(v){if(!t||!v||typeof v!="object")return!1;try{t.call(v);try{o.call(v)}catch{return!0}return v instanceof Map}catch{}return!1}function Ii(v){if(!u||!v||typeof v!="object")return!1;try{u.call(v,u);try{h.call(v,h)}catch{return!0}return v instanceof WeakMap}catch{}return!1}function Ci(v){if(!d||!v||typeof v!="object")return!1;try{return d.call(v),!0}catch{}return!1}function Ri(v){if(!o||!v||typeof v!="object")return!1;try{o.call(v);try{t.call(v)}catch{return!0}return v instanceof Set}catch{}return!1}function Ni(v){if(!h||!v||typeof v!="object")return!1;try{h.call(v,h);try{u.call(v,u)}catch{return!0}return v instanceof WeakSet}catch{}return!1}function Pi(v){return!v||typeof v!="object"?!1:typeof HTMLElement<"u"&&v instanceof HTMLElement?!0:typeof v.nodeName=="string"&&typeof v.getAttribute=="function"}function We(v,E){if(v.length>E.maxStringLength){var P=v.length-E.maxStringLength,V="... "+P+" more character"+(P>1?"s":"");return We(w.call(v,0,E.maxStringLength),E)+V}var Z=re[E.quoteStyle||"single"];Z.lastIndex=0;var H=_.call(_.call(v,Z,"\\$1"),/[\x00-\x1f]/g,wr);return K(H,"single",E)}function wr(v){var E=v.charCodeAt(0),P={8:"b",9:"t",10:"n",12:"f",13:"r"}[E];return P?"\\"+P:"\\x"+(E<16?"0":"")+b.call(E.toString(16))}function yt(v){return"Object("+v+")"}function Nt(v){return v+" { ? }"}function Xr(v,E,P,V){var Z=V?Ee(P,V):C.call(P,", ");return v+" ("+E+") {"+Z+"}"}function Fi(v){for(var E=0;E<v.length;E++)if(Qr(v[E],`
|
|
7
|
-
`)>=0)return!1;return!0}function Mi(v,E){var P;if(v.indent===" ")P=" ";else if(typeof v.indent=="number"&&v.indent>0)P=C.call(Array(v.indent+1)," ");else return null;return{base:P,prev:C.call(Array(E+1),P)}}function Ee(v,E){if(v.length===0)return"";var P=`
|
|
8
|
-
`+E.prev+E.base;return P+C.call(v,","+P)+`
|
|
9
|
-
`+E.prev}function N(v,E){var P=ue(v),V=[];if(P){V.length=v.length;for(var Z=0;Z<v.length;Z++)V[Z]=rt(v,Z)?E(v[Z],v):""}var H=typeof B=="function"?B(v):[],Ne;if(ee){Ne={};for(var nt=0;nt<H.length;nt++)Ne["$"+H[nt]]=H[nt]}for(var Oe in v)rt(v,Oe)&&(P&&String(Number(Oe))===Oe&&Oe<v.length||ee&&Ne["$"+Oe]instanceof Symbol||(S.call(/[^\w$]/,Oe)?V.push(E(Oe,v)+": "+E(v[Oe],v)):V.push(Oe+": "+E(v[Oe],v))));if(typeof B=="function")for(var wt=0;wt<H.length;wt++)he.call(v,H[wt])&&V.push("["+E(H[wt])+"]: "+E(v[H[wt]],v));return V}return gi}var mi,La;function Ch(){if(La)return mi;La=1;var r=Jt(),e=Th(),t=Ih(),n=gr(),i=r("%WeakMap%",!0),s=r("%Map%",!0),o=e("WeakMap.prototype.get",!0),l=e("WeakMap.prototype.set",!0),a=e("WeakMap.prototype.has",!0),u=e("Map.prototype.get",!0),c=e("Map.prototype.set",!0),h=e("Map.prototype.has",!0),f=function(m,y){for(var w=m,_;(_=w.next)!==null;w=_)if(_.key===y)return w.next=_.next,_.next=m.next,m.next=_,_},d=function(m,y){var w=f(m,y);return w&&w.value},g=function(m,y,w){var _=f(m,y);_?_.value=w:m.next={key:y,next:m.next,value:w}},p=function(m,y){return!!f(m,y)};return mi=function(){var y,w,_,b={assert:function(k){if(!b.has(k))throw new n("Side channel does not contain "+t(k))},get:function(k){if(i&&k&&(typeof k=="object"||typeof k=="function")){if(y)return o(y,k)}else if(s){if(w)return u(w,k)}else if(_)return d(_,k)},has:function(k){if(i&&k&&(typeof k=="object"||typeof k=="function")){if(y)return a(y,k)}else if(s){if(w)return h(w,k)}else if(_)return p(_,k);return!1},set:function(k,S){i&&k&&(typeof k=="object"||typeof k=="function")?(y||(y=new i),l(y,k,S)):s?(w||(w=new s),c(w,k,S)):(_||(_={key:{},next:null}),g(_,k,S))}};return b},mi}var yi,Da;function wi(){if(Da)return yi;Da=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return yi={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},yi}var bi,xa;function ja(){if(xa)return bi;xa=1;var r=wi(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var m=[],y=0;y<256;++y)m.push("%"+((y<16?"0":"")+y.toString(16)).toUpperCase());return m}(),i=function(y){for(;y.length>1;){var w=y.pop(),_=w.obj[w.prop];if(t(_)){for(var b=[],k=0;k<_.length;++k)typeof _[k]<"u"&&b.push(_[k]);w.obj[w.prop]=b}}},s=function(y,w){for(var _=w&&w.plainObjects?Object.create(null):{},b=0;b<y.length;++b)typeof y[b]<"u"&&(_[b]=y[b]);return _},o=function m(y,w,_){if(!w)return y;if(typeof w!="object"){if(t(y))y.push(w);else if(y&&typeof y=="object")(_&&(_.plainObjects||_.allowPrototypes)||!e.call(Object.prototype,w))&&(y[w]=!0);else return[y,w];return y}if(!y||typeof y!="object")return[y].concat(w);var b=y;return t(y)&&!t(w)&&(b=s(y,_)),t(y)&&t(w)?(w.forEach(function(k,S){if(e.call(y,S)){var O=y[S];O&&typeof O=="object"&&k&&typeof k=="object"?y[S]=m(O,k,_):y.push(k)}else y[S]=k}),y):Object.keys(w).reduce(function(k,S){var O=w[S];return e.call(k,S)?k[S]=m(k[S],O,_):k[S]=O,k},b)},l=function(y,w){return Object.keys(w).reduce(function(_,b){return _[b]=w[b],_},y)},a=function(m,y,w){var _=m.replace(/\+/g," ");if(w==="iso-8859-1")return _.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(_)}catch{return _}},u=1024,c=function(y,w,_,b,k){if(y.length===0)return y;var S=y;if(typeof y=="symbol"?S=Symbol.prototype.toString.call(y):typeof y!="string"&&(S=String(y)),_==="iso-8859-1")return escape(S).replace(/%u[0-9a-f]{4}/gi,function(W){return"%26%23"+parseInt(W.slice(2),16)+"%3B"});for(var O="",C=0;C<S.length;C+=u){for(var F=S.length>=u?S.slice(C,C+u):S,R=[],Y=0;Y<F.length;++Y){var B=F.charCodeAt(Y);if(B===45||B===46||B===95||B===126||B>=48&&B<=57||B>=65&&B<=90||B>=97&&B<=122||k===r.RFC1738&&(B===40||B===41)){R[R.length]=F.charAt(Y);continue}if(B<128){R[R.length]=n[B];continue}if(B<2048){R[R.length]=n[192|B>>6]+n[128|B&63];continue}if(B<55296||B>=57344){R[R.length]=n[224|B>>12]+n[128|B>>6&63]+n[128|B&63];continue}Y+=1,B=65536+((B&1023)<<10|F.charCodeAt(Y)&1023),R[R.length]=n[240|B>>18]+n[128|B>>12&63]+n[128|B>>6&63]+n[128|B&63]}O+=R.join("")}return O},h=function(y){for(var w=[{obj:{o:y},prop:"o"}],_=[],b=0;b<w.length;++b)for(var k=w[b],S=k.obj[k.prop],O=Object.keys(S),C=0;C<O.length;++C){var F=O[C],R=S[F];typeof R=="object"&&R!==null&&_.indexOf(R)===-1&&(w.push({obj:S,prop:F}),_.push(R))}return i(w),y},f=function(y){return Object.prototype.toString.call(y)==="[object RegExp]"},d=function(y){return!y||typeof y!="object"?!1:!!(y.constructor&&y.constructor.isBuffer&&y.constructor.isBuffer(y))},g=function(y,w){return[].concat(y,w)},p=function(y,w){if(t(y)){for(var _=[],b=0;b<y.length;b+=1)_.push(w(y[b]));return _}return w(y)};return bi={arrayToObject:s,assign:l,combine:g,compact:h,decode:a,encode:c,isBuffer:d,isRegExp:f,maybeMap:p,merge:o},bi}var vi,Ua;function Rh(){if(Ua)return vi;Ua=1;var r=Ch(),e=ja(),t=wi(),n=Object.prototype.hasOwnProperty,i={brackets:function(m){return m+"[]"},comma:"comma",indices:function(m,y){return m+"["+y+"]"},repeat:function(m){return m}},s=Array.isArray,o=Array.prototype.push,l=function(p,m){o.apply(p,s(m)?m:[m])},a=Date.prototype.toISOString,u=t.default,c={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,format:u,formatter:t.formatters[u],indices:!1,serializeDate:function(m){return a.call(m)},skipNulls:!1,strictNullHandling:!1},h=function(m){return typeof m=="string"||typeof m=="number"||typeof m=="boolean"||typeof m=="symbol"||typeof m=="bigint"},f={},d=function p(m,y,w,_,b,k,S,O,C,F,R,Y,B,W,ee,D,he,X){for(var A=m,ne=X,te=0,ce=!1;(ne=ne.get(f))!==void 0&&!ce;){var $=ne.get(m);if(te+=1,typeof $<"u"){if($===te)throw new RangeError("Cyclic object value");ce=!0}typeof ne.get(f)>"u"&&(te=0)}if(typeof F=="function"?A=F(y,A):A instanceof Date?A=B(A):w==="comma"&&s(A)&&(A=e.maybeMap(A,function(Rt){return Rt instanceof Date?B(Rt):Rt})),A===null){if(k)return C&&!D?C(y,c.encoder,he,"key",W):y;A=""}if(h(A)||e.isBuffer(A)){if(C){var re=D?y:C(y,c.encoder,he,"key",W);return[ee(re)+"="+ee(C(A,c.encoder,he,"value",W))]}return[ee(y)+"="+ee(String(A))]}var K=[];if(typeof A>"u")return K;var se;if(w==="comma"&&s(A))D&&C&&(A=e.maybeMap(A,C)),se=[{value:A.length>0?A.join(",")||null:void 0}];else if(s(F))se=F;else{var ue=Object.keys(A);se=R?ue.sort(R):ue}var me=O?y.replace(/\./g,"%2E"):y,U=_&&s(A)&&A.length===1?me+"[]":me;if(b&&s(A)&&A.length===0)return U+"[]";for(var pe=0;pe<se.length;++pe){var Re=se[pe],$e=typeof Re=="object"&&typeof Re.value<"u"?Re.value:A[Re];if(!(S&&$e===null)){var ze=Y&&O?Re.replace(/\./g,"%2E"):Re,tt=s(A)?typeof w=="function"?w(U,ze):U:U+(Y?"."+ze:"["+ze+"]");X.set(m,te);var Kt=r();Kt.set(f,X),l(K,p($e,tt,w,_,b,k,S,O,w==="comma"&&D&&s(A)?null:C,F,R,Y,B,W,ee,D,he,Kt))}}return K},g=function(m){if(!m)return c;if(typeof m.allowEmptyArrays<"u"&&typeof m.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof m.encodeDotInKeys<"u"&&typeof m.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(m.encoder!==null&&typeof m.encoder<"u"&&typeof m.encoder!="function")throw new TypeError("Encoder has to be a function.");var y=m.charset||c.charset;if(typeof m.charset<"u"&&m.charset!=="utf-8"&&m.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var w=t.default;if(typeof m.format<"u"){if(!n.call(t.formatters,m.format))throw new TypeError("Unknown format option provided.");w=m.format}var _=t.formatters[w],b=c.filter;(typeof m.filter=="function"||s(m.filter))&&(b=m.filter);var k;if(m.arrayFormat in i?k=m.arrayFormat:"indices"in m?k=m.indices?"indices":"repeat":k=c.arrayFormat,"commaRoundTrip"in m&&typeof m.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var S=typeof m.allowDots>"u"?m.encodeDotInKeys===!0?!0:c.allowDots:!!m.allowDots;return{addQueryPrefix:typeof m.addQueryPrefix=="boolean"?m.addQueryPrefix:c.addQueryPrefix,allowDots:S,allowEmptyArrays:typeof m.allowEmptyArrays=="boolean"?!!m.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:k,charset:y,charsetSentinel:typeof m.charsetSentinel=="boolean"?m.charsetSentinel:c.charsetSentinel,commaRoundTrip:m.commaRoundTrip,delimiter:typeof m.delimiter>"u"?c.delimiter:m.delimiter,encode:typeof m.encode=="boolean"?m.encode:c.encode,encodeDotInKeys:typeof m.encodeDotInKeys=="boolean"?m.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof m.encoder=="function"?m.encoder:c.encoder,encodeValuesOnly:typeof m.encodeValuesOnly=="boolean"?m.encodeValuesOnly:c.encodeValuesOnly,filter:b,format:w,formatter:_,serializeDate:typeof m.serializeDate=="function"?m.serializeDate:c.serializeDate,skipNulls:typeof m.skipNulls=="boolean"?m.skipNulls:c.skipNulls,sort:typeof m.sort=="function"?m.sort:null,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:c.strictNullHandling}};return vi=function(p,m){var y=p,w=g(m),_,b;typeof w.filter=="function"?(b=w.filter,y=b("",y)):s(w.filter)&&(b=w.filter,_=b);var k=[];if(typeof y!="object"||y===null)return"";var S=i[w.arrayFormat],O=S==="comma"&&w.commaRoundTrip;_||(_=Object.keys(y)),w.sort&&_.sort(w.sort);for(var C=r(),F=0;F<_.length;++F){var R=_[F];w.skipNulls&&y[R]===null||l(k,d(y[R],R,S,O,w.allowEmptyArrays,w.strictNullHandling,w.skipNulls,w.encodeDotInKeys,w.encode?w.encoder:null,w.filter,w.sort,w.allowDots,w.serializeDate,w.format,w.formatter,w.encodeValuesOnly,w.charset,C))}var Y=k.join(w.delimiter),B=w.addQueryPrefix===!0?"?":"";return w.charsetSentinel&&(w.charset==="iso-8859-1"?B+="utf8=%26%2310003%3B&":B+="utf8=%E2%9C%93&"),Y.length>0?B+Y:""},vi}var Si,Ba;function Nh(){if(Ba)return Si;Ba=1;var r=ja(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},i=function(f){return f.replace(/&#(\d+);/g,function(d,g){return String.fromCharCode(parseInt(g,10))})},s=function(f,d){return f&&typeof f=="string"&&d.comma&&f.indexOf(",")>-1?f.split(","):f},o="utf8=%26%2310003%3B",l="utf8=%E2%9C%93",a=function(d,g){var p={__proto__:null},m=g.ignoreQueryPrefix?d.replace(/^\?/,""):d;m=m.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var y=g.parameterLimit===1/0?void 0:g.parameterLimit,w=m.split(g.delimiter,y),_=-1,b,k=g.charset;if(g.charsetSentinel)for(b=0;b<w.length;++b)w[b].indexOf("utf8=")===0&&(w[b]===l?k="utf-8":w[b]===o&&(k="iso-8859-1"),_=b,b=w.length);for(b=0;b<w.length;++b)if(b!==_){var S=w[b],O=S.indexOf("]="),C=O===-1?S.indexOf("="):O+1,F,R;C===-1?(F=g.decoder(S,n.decoder,k,"key"),R=g.strictNullHandling?null:""):(F=g.decoder(S.slice(0,C),n.decoder,k,"key"),R=r.maybeMap(s(S.slice(C+1),g),function(B){return g.decoder(B,n.decoder,k,"value")})),R&&g.interpretNumericEntities&&k==="iso-8859-1"&&(R=i(R)),S.indexOf("[]=")>-1&&(R=t(R)?[R]:R);var Y=e.call(p,F);Y&&g.duplicates==="combine"?p[F]=r.combine(p[F],R):(!Y||g.duplicates==="last")&&(p[F]=R)}return p},u=function(f,d,g,p){for(var m=p?d:s(d,g),y=f.length-1;y>=0;--y){var w,_=f[y];if(_==="[]"&&g.parseArrays)w=g.allowEmptyArrays&&(m===""||g.strictNullHandling&&m===null)?[]:[].concat(m);else{w=g.plainObjects?Object.create(null):{};var b=_.charAt(0)==="["&&_.charAt(_.length-1)==="]"?_.slice(1,-1):_,k=g.decodeDotInKeys?b.replace(/%2E/g,"."):b,S=parseInt(k,10);!g.parseArrays&&k===""?w={0:m}:!isNaN(S)&&_!==k&&String(S)===k&&S>=0&&g.parseArrays&&S<=g.arrayLimit?(w=[],w[S]=m):k!=="__proto__"&&(w[k]=m)}m=w}return m},c=function(d,g,p,m){if(d){var y=p.allowDots?d.replace(/\.([^.[]+)/g,"[$1]"):d,w=/(\[[^[\]]*])/,_=/(\[[^[\]]*])/g,b=p.depth>0&&w.exec(y),k=b?y.slice(0,b.index):y,S=[];if(k){if(!p.plainObjects&&e.call(Object.prototype,k)&&!p.allowPrototypes)return;S.push(k)}for(var O=0;p.depth>0&&(b=_.exec(y))!==null&&O<p.depth;){if(O+=1,!p.plainObjects&&e.call(Object.prototype,b[1].slice(1,-1))&&!p.allowPrototypes)return;S.push(b[1])}if(b){if(p.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+p.depth+" and strictDepth is true");S.push("["+y.slice(b.index)+"]")}return u(S,g,p,m)}},h=function(d){if(!d)return n;if(typeof d.allowEmptyArrays<"u"&&typeof d.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof d.decodeDotInKeys<"u"&&typeof d.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(d.decoder!==null&&typeof d.decoder<"u"&&typeof d.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof d.charset<"u"&&d.charset!=="utf-8"&&d.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var g=typeof d.charset>"u"?n.charset:d.charset,p=typeof d.duplicates>"u"?n.duplicates:d.duplicates;if(p!=="combine"&&p!=="first"&&p!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var m=typeof d.allowDots>"u"?d.decodeDotInKeys===!0?!0:n.allowDots:!!d.allowDots;return{allowDots:m,allowEmptyArrays:typeof d.allowEmptyArrays=="boolean"?!!d.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof d.allowPrototypes=="boolean"?d.allowPrototypes:n.allowPrototypes,allowSparse:typeof d.allowSparse=="boolean"?d.allowSparse:n.allowSparse,arrayLimit:typeof d.arrayLimit=="number"?d.arrayLimit:n.arrayLimit,charset:g,charsetSentinel:typeof d.charsetSentinel=="boolean"?d.charsetSentinel:n.charsetSentinel,comma:typeof d.comma=="boolean"?d.comma:n.comma,decodeDotInKeys:typeof d.decodeDotInKeys=="boolean"?d.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof d.decoder=="function"?d.decoder:n.decoder,delimiter:typeof d.delimiter=="string"||r.isRegExp(d.delimiter)?d.delimiter:n.delimiter,depth:typeof d.depth=="number"||d.depth===!1?+d.depth:n.depth,duplicates:p,ignoreQueryPrefix:d.ignoreQueryPrefix===!0,interpretNumericEntities:typeof d.interpretNumericEntities=="boolean"?d.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof d.parameterLimit=="number"?d.parameterLimit:n.parameterLimit,parseArrays:d.parseArrays!==!1,plainObjects:typeof d.plainObjects=="boolean"?d.plainObjects:n.plainObjects,strictDepth:typeof d.strictDepth=="boolean"?!!d.strictDepth:n.strictDepth,strictNullHandling:typeof d.strictNullHandling=="boolean"?d.strictNullHandling:n.strictNullHandling}};return Si=function(f,d){var g=h(d);if(f===""||f===null||typeof f>"u")return g.plainObjects?Object.create(null):{};for(var p=typeof f=="string"?a(f,g):f,m=g.plainObjects?Object.create(null):{},y=Object.keys(p),w=0;w<y.length;++w){var _=y[w],b=c(_,p[_],g,typeof f=="string");m=r.merge(m,b,g)}return g.allowSparse===!0?m:r.compact(m)},Si}var _i,$a;function Ph(){if($a)return _i;$a=1;var r=Rh(),e=Nh(),t=wi();return _i={formats:t,parse:e,stringify:r},_i}var Fh=Ph();const Ei=ua(Fh);let Wa=class{#e;#t;#r;#n;_logger=null;#i="";constructor(e,t,n){this.#e=be.create({baseURL:e,...n}),this.#t=t,this.#r=new Lu,this.#n=new Uu}setLogger(e){this._logger=e,this.#r.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}setRestrictionManagerParams(e){this.#r.params=e}getRestrictionManagerParams(){return this.#r.params}setLogTag(e){this.#i=e}clearLogTag(){this.#i=""}async batch(e,t=!0){const n=Array.isArray(e),i=n?[]:{};let s=0;const o=(l,a)=>{let u=null,c=null;if(Array.isArray(l)?(u=l[0],c=l[1]):l.method&&(u=l.method,c=l.params),u){s++;const h=u+"?"+Ei.stringify(c);n||Array.isArray(i)?i.push(h):i[a]=h}};if(n)for(const[l,a]of e.entries())o(a,l);else for(const[l,a]of Object.entries(e))o(a,l);return s<1?Promise.resolve(new Vt):this.call("batch",{halt:t?1:0,cmd:i}).then(l=>{const a=l.getData().result,u=n?[]:{},c=(g,p)=>{if(typeof a.result[p]<"u"||typeof a.result_error[p]<"u"){const m=g.split("?"),y=new Rn({result:x.isUndefined(a.result[p])?{}:a.result[p],error:a?.result_error[p]||void 0,total:a.result_total[p],next:a.result_next[p]},{method:m[0]||"",params:Ei.parse(m[1]||""),start:0},l.getStatus());n||Array.isArray(u)?u.push(y):u[p]=y}};if(Array.isArray(i))for(const[g,p]of i.entries())c(p,g);else for(const[g,p]of Object.entries(i))c(p,g);let h;const f=g=>new ur({status:0,answerError:{error:g.getErrorMessages().join("; "),errorDescription:`batch ${g.getQuery().method}: ${Ei.stringify(g.getQuery().params,{encode:!1})}`},cause:g.getErrors().next().value}),d=new Vt;if(n||Array.isArray(u)){h=[];for(const g of u){if(g.getStatus()!==200||!g.isSuccess){const p=f(g);if(!t&&!g.isSuccess){d.addError(p);continue}return Promise.reject(p)}h.push(g.getData().result)}}else{h={};for(const g of Object.keys(u)){const p=u[g];if(p.getStatus()!==200||!p.isSuccess){const m=f(p);if(!t&&!p.isSuccess){d.addError(m);continue}return Promise.reject(m)}h[g]=p.getData().result}}return d.setData(h),Promise.resolve(d)})}async call(e,t,n=0){let i=this.#t.getAuthData();return i===!1&&(i=await this.#t.refreshAuth()),await this.#r.check(),this.#e.post(this.#s(e),this.#o(i,t,n)).then(s=>{const o=s.data;return Promise.resolve({status:s.status,payload:o})},async s=>{let o={error:s?.code||0,errorDescription:s?.message||""};if(s instanceof ca&&s.response&&s.response.data){const a=s.response.data;o={error:a.error,errorDescription:a.error_description}}const l=new ur({status:s.response?.status||0,answerError:o,cause:s});return l.status===401&&["expired_token","invalid_token"].includes(l.answerError.error)?(this.getLogger().info(`refreshAuth >> ${l.answerError.error} >>>`),i=await this.#t.refreshAuth(),await this.#r.check(),this.#e.post(this.#s(e),this.#o(i,t,n)).then(async a=>{const u=a.data;return Promise.resolve({status:a.status,payload:u})},async a=>{let u={error:a?.code||0,errorDescription:a?.message||""};if(a instanceof ca&&a.response&&a.response.data){const h=a.response.data;u={error:h.error,errorDescription:h.error_description}}const c=new ur({status:a.response?.status||0,answerError:u,cause:a});return Promise.reject(c)})):Promise.reject(l)}).then(s=>{const o=new Rn(s.payload,{method:e,params:t,start:n},s.status);return Promise.resolve(o)})}#o(e,t,n=0){const i=Object.assign({},t);return this.#i.length>0&&(i.logTag=this.#i),i[this.#n.getQueryStringParameterName()]=this.#n.getRequestId(),i[this.#n.getQueryStringSdkParameterName()]="0.1.3",i.data&&i.data.start&&delete i.data.start,e.refresh_token!=="hook"&&(i.auth=e.access_token),i.start=n,i}#s(e){return`${encodeURIComponent(e)}.json`}};class Gt{static batchSize=50;_isInit=!1;_http=null;_logger=null;constructor(){this._isInit=!1}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}setLogger(e){this._logger=e,this.getHttpClient().setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}callMethod(e,t,n){return this.getHttpClient().call(e,t||{},n||0)}async callListMethod(e,t={},n=null,i=null){const s=new Vt;return x.isFunction(n)&&n!==null&&n(0),this.callMethod(e,t,0).then(async o=>{let l=[],a;if(i===null?a=o.getData().result:a=o.getData().result[i],l=[...l,...a],o.isMore()){let u=o;for(;u=await u.getNext(this.getHttpClient()),u!==!1;){let c;if(i===null?c=u.getData().result:c=u.getData().result[i],l=[...l,...c],n){const h=u.getTotal();n(h>0?Math.round(100*l.length/h):100)}}}return s.setData(l),n&&n(100),s})}async*fetchListMethod(e,t={},n="ID",i=null){t.order=t.order||{},t.filter=t.filter||{},t.start=-1;const s=`>${n}`;t.order[n]="ASC",t.filter[s]=0;do{const o=await this.callMethod(e,t,t.start);let l;if(!x.isNull(i)&&i!==null?l=o.getData().result[i]:l=o.getData().result,l.length===0||(yield l,l.length<Gt.batchSize))break;const a=l.at(-1);a&&n in a&&(t.filter[s]=a[n])}while(!0)}async callBatch(e,t=!0){return this.getHttpClient().batch(e,t)}chunkArray(e,t=50){const n=[];for(let i=0;i<e.length;i+=t){const s=e.slice(i,i+t);n.push(s)}return n}async callBatchByChunk(e,t=!0){const n=new Vt,i=[],s=this.chunkArray(e,Gt.batchSize);for(const o of s){const l=await this.callBatch(o,t);i.push(...l.getData())}return n.setData(i)}getHttpClient(){if(!this.isInit||this._http===null)throw new Error("Http not init");return this._http}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new Error("B24 not initialized")}}var ki=(r=>(r.en="en",r.de="de",r.la="la",r.br="br",r.fr="fr",r.it="it",r.pl="pl",r.ru="ru",r.ua="ua",r.tr="tr",r.sc="sc",r.tc="tc",r.ja="ja",r.vn="vn",r.id="id",r.ms="ms",r.th="th",r.ar="ar",r))(ki||{});const Mh=()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)});let Lh=class bt{static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!bt.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");bt.isInternalConstructing=!1}static getInstance(){return bt.instance||(bt.isInternalConstructing=!0,bt.instance=new bt),bt.instance}setDefLocale(e){this._defLocale=e}format(e,t){let n;(typeof t>"u"||!x.isStringFilled(t))&&(t=x.isStringFilled(this._defLocale)?this._defLocale||"en":navigator?.language),Number.isInteger(e)?n=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):n=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let i=n.format(e);return t.includes("ru")&&(i=i.replace(",",".")),i}};class I{countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,n,i){this.countryCode=e,this.length=t,this.structure=n,this.example=i}isValid(e){return this.length===e.length&&this.countryCode===e.slice(0,2)&&this._regex().test(e.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(e))==1}toBBAN(e,t){return(this._regex().exec(e.slice(4)||"")||[]).slice(1).join(t)}fromBBAN(e){if(!this.isValidBBAN(e))throw new Error("Invalid BBAN");const t=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+e)))).slice(-2);return this.countryCode+t+e}isValidBBAN(e){return this.length-4===e.length&&this._regex().test(e)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(e){const t=(e.match(/(.{3})/g)||[]).map(n=>{let i;const s=n.slice(0,1),o=Number.parseInt(n.slice(1),10);switch(s){case"A":i="0-9A-Za-z";break;case"B":i="0-9A-Z";break;case"C":i="A-Za-z";break;case"F":i="0-9";break;case"L":i="a-z";break;case"U":i="A-Z";break;case"W":i="0-9a-z";break}return"(["+i+"]{"+o+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const n=t.charCodeAt(0);return n>=65&&n<=90?(n-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,n;for(;t.length>2;)n=t.slice(0,9),t=Number.parseInt(n,10)%97+t.slice(n.length);return Number.parseInt(t,10)%97}}class lt{static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!lt.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");lt.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return lt.instance||(lt.isInternalConstructing=!0,lt.instance=new lt),lt.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!this._isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const n=this._countries.get(t);return!!n&&n.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const n=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(n,"$1"+t)}electronicFormat(e){const t=/[^a-zA-Z0-9]/g;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const n=e.slice(0,2);if(!this._countries.has(n))throw new Error(`No country with code ${n}`);const i=this._countries.get(n);if(!i)throw new Error(`No country with code ${n}`);return i.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);if(!n)throw new Error(`No country with code ${e}`);return n.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!this._isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);return!!n&&n.isValidBBAN(this.electronicFormat(t))}_isString(e){return typeof e=="string"||e instanceof String}}const Dh=()=>{const r=Lh.getInstance(),e=lt.getInstance();return e.addSpecification(new I("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new I("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new I("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new I("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new I("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new I("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new I("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new I("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new I("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new I("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new I("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new I("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new I("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new I("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new I("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new I("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new I("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new I("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new I("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new I("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new I("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new I("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new I("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new I("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new I("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new I("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new I("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new I("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new I("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new I("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new I("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new I("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new I("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new I("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new I("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new I("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new I("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new I("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new I("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new I("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new I("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new I("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new I("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new I("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new I("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new I("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new I("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new I("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new I("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new I("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new I("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new I("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new I("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new I("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new I("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new I("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new I("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new I("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new I("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new I("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new I("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new I("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new I("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new I("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new I("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new I("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new I("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new I("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new I("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new I("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new I("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new I("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new I("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new I("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new I("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new I("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new I("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new I("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new I("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new I("BI",16,"F12","BI41123456789012")),e.addSpecification(new I("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new I("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new I("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new I("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new I("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new I("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new I("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new I("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new I("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new I("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new I("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new I("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new I("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new I("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new I("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new I("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new I("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new I("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new I("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new I("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new I("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new I("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}};class qa{#e;constructor(e){this.#e=Object.freeze(Object.assign({},e))}getAuthData(){const e=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,"");return{access_token:this.#e.secret,refresh_token:"hook",expires_in:0,domain:e,member_id:e}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#e.b24Url}`}getTargetOriginWithPath(){return`${this.#e.b24Url}/rest/${this.#e.userId}/${this.#e.secret}`}get isAdmin(){return!0}}class xh extends Gt{#e;constructor(e){super(),this.#e=new qa(e),this._http=new Wa(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._isInit=!0}setLogger(e){super.setLogger(e)}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var fe=(r=>(r.getInitData="getInitData",r.setInstallFinish="setInstallFinish",r.setInstall="setInstall",r.refreshAuth="refreshAuth",r.setAppOption="setAppOption",r.setUserOption="setUserOption",r.resizeWindow="resizeWindow",r.reloadWindow="reloadWindow",r.setTitle="setTitle",r.setScroll="setScroll",r.openApplication="openApplication",r.closeApplication="closeApplication",r.openPath="openPath",r.imCallTo="imCallTo",r.imPhoneTo="imPhoneTo",r.imOpenMessenger="imOpenMessenger",r.imOpenHistory="imOpenHistory",r.selectUser="selectUser",r.selectAccess="selectAccess",r.selectCRM="selectCRM",r.showAppForm="showAppForm",r))(fe||{});class Va{#e;#t;_logger=null;runCallbackHandler;constructor(e){this.#e=e,this.#t=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(e,t=null){return new Promise((n,i)=>{let s;const o={resolve:n,reject:i,timeoutId:null},l=this.#r(o);if(e.toString().includes(":"))s={method:e.toString(),params:t??"",callback:l,appSid:this.#e.getAppSid()};else{s=e.toString();const a=[t?JSON.stringify(t):null,l,this.#e.getAppSid()];s+=":"+a.filter(Boolean).join(":")}this.getLogger().log(`send to ${this.#e.getTargetOrigin()}`,{cmd:s}),parent.postMessage(s,this.#e.getTargetOrigin()),t?.isSafely&&(this.#t.get(l).timeoutId=window.setTimeout(()=>{this.#t.has(l)&&(this.getLogger().warn(`Action ${e.toString()} stop by timeout`),this.#t.delete(l),n({isSafely:!0}))},Number.parseInt(String(t?.safelyTime||900))))})}_runCallback(e){if(e.origin===this.#e.getTargetOrigin()&&e.data){this.getLogger().log(`get from ${e.origin}`,{data:e.data});const t=e.data.split(":"),n={id:t[0],args:t.slice(1).join(":")};if(n.args&&(n.args=JSON.parse(n.args)),this.#t.has(n.id)){const i=this.#t.get(n.id);i.timeoutId&&clearTimeout(i.timeoutId),this.#t.delete(n.id),i.resolve(n.args)}}}#r(e){const t=G.getUniqId();return this.#t.set(t,e),t}}class Ha{#e="";#t=!0;#r=null;#n=null;#i=null;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#t=e.PROTOCOL===!0,e.LANG&&(this.#i=e.LANG),e.APP_SID&&(this.#r=e.APP_SID)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#n||(this.#n=e.PATH),this.#i||(this.#i=e.LANG),this.#t=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this}getAppSid(){if(this.#r===null)throw new Error("Not init appSid");return this.#r}getTargetOrigin(){return`${this.#t?"https":"http"}://${this.#e}`}getTargetOriginWithPath(){return this.getTargetOrigin()+(this.#n??"")}getLang(){return this.#i||ki.en}}class za{#e=null;#t=null;#r=0;#n=null;#i=!1;#o;#s;constructor(e,t){this.#o=e,this.#s=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,this.#i=e.IS_ADMIN,this.#n=e.MEMBER_ID||""),this}getAuthData(){return this.#r>Date.now()?{access_token:this.#e,refresh_token:this.#t,expires_in:this.#r,domain:this.#o.getTargetOrigin(),member_id:this.#n}:!1}async refreshAuth(){return this.#s.send(fe.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#n||""].join("_")}get isAdmin(){return this.#i}}class Ja{#e;constructor(e){this.#e=e}async closeApplication(){return this.#e.send(fe.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(fe.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(fe.resizeWindow,{width:e,height:t,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${e} or height:number = ${t}`))}async resizeWindowAuto(e=null,t=0,n=0){const i=document.body;let s=Math.max(i.scrollWidth,i.offsetWidth);n>0&&(s=Math.max(n,s));let o=Math.max(i.scrollHeight,i.offsetHeight);return e&&(o=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(o=Math.max(t,o)),this.resizeWindow(s,o)}getScrollSize(){return Mh()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(fe.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(fe.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(fe.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(fe.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(fe.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(fe.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(fe.imOpenHistory,{dialogId:e,isSafely:!0})}}let Ga=class{#e;#t=null;#r=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#t=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#r=e.USER_OPTIONS),this}appGet(e){if(this.#t&&this.#t[e])return this.#t[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#t||(this.#t=[]),this.#t[e]=t,this.#n(fe.setAppOption,e,this.#t[e])}userGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#t||(this.#t=[]),this.#t[e]||(this.#t[e]=null),this.#r[e]=t,this.#n(fe.setUserOption,e,this.#r[e])}async#n(e,t,n){return this.#e.send(e,{name:t,value:n,isSafely:!0}).then(()=>Promise.resolve())}};class Za{#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(fe.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(fe.selectUser,{mult:!0})}async selectAccess(e=[]){return console.warn("@deprecated selectAccess"),this.#e.send(fe.selectAccess,{value:e})}async selectCRM(e){return console.warn("@deprecated selectCRM"),this.#e.send(fe.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value})}}class Ya{#e;#t;constructor(e,t){this.#e=e,this.#t=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#t.send(fe.openApplication,e)}async closeSliderAppPage(){return this.#t.send(fe.closeApplication,{isSafely:!1})}#r(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const n=new URL(e);return n.searchParams.set("IFRAME","Y"),n.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#t.send(fe.openPath,{path:[this.#r(t),n.pathname,n.search].join("")}).then(i=>i?.result==="error"?i?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((s,o)=>{const l=window.open(e,"_blank");if(!l){o(new Error("Error open window"));return}let a=0;const u=1e3*60*5,c=window.setInterval(()=>{a=a+1,l.closed?(clearInterval(c),s({isOpenAtNewWindow:!0,isClose:!0})):a>u&&(clearInterval(c),s({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(i?.errorCode)):i?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}async showAppForm(e){return console.warn("@deprecated showAppForm"),this.#t.send(fe.showAppForm,{params:e,isSafely:!0})}}class Ka{#e="";#t={};constructor(){}initData(e){this.#e=e.PLACEMENT||"DEFAULT";const t=e.PLACEMENT_OPTIONS;return this.#t=Object.freeze(t),this}get title(){return this.#e}get isDefault(){return this.title==="DEFAULT"}get options(){return this.#t}get isSliderMode(){return this.options?.IFRAME==="Y"}}class Qa extends Gt{#e=!1;#t=!1;#r;#n;#i;#o;#s;#l;#c;#a;constructor(e){super(),this.#r=new Ha(e),this.#n=new Va(this.#r),this.#n.subscribe(),this.#i=new za(this.#r,this.#n),this.#o=new Ja(this.#n),this.#s=new Ga(this.#n),this.#l=new Za(this.#n),this.#c=new Ya(this.#r,this.#n),this.#a=new Ka,this._isInit=!1}setLogger(e){super.setLogger(e),this.#n.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#t}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#o}get auth(){return this._ensureInitialized(),this.#i}get slider(){return this._ensureInitialized(),this.#c}get placement(){return this._ensureInitialized(),this.#a}get options(){return this._ensureInitialized(),this.#s}get dialog(){return this._ensureInitialized(),this.#l}async init(){return this.#n.send(fe.getInitData,{}).then(e=>(this.getLogger().log("init data:",e),this.#r.initData(e),this.#i.initData(e),this.#a.initData(e),this.#s.initData(e),this.#e=e.INSTALL,this.#t=e.FIRST_RUN,this._http=new Wa(this.#r.getTargetOriginWithPath(),this.#i,this._getHttpOptions()),this._isInit=!0,this.#t?this.#n.send(fe.setInstall,{install:!0}):Promise.resolve()))}destroy(){this.#n.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#n.send(fe.setInstallFinish,{}):Promise.reject(new Error("Application was previously installed. You cannot call installFinish"))}getTargetOrigin(){return this._ensureInitialized(),this.#r.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#r.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#r.getAppSid()}getLang(){return this._ensureInitialized(),this.#r.getLang()}}class Oi extends Error{constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=new Error("for stack").stack}}class Zt{_b24;_logger=null;_data=null;constructor(e){this._b24=e}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}async initData(e){return this.getLogger().log(e),Promise.reject(new Error("Rewrite this function"))}}class jh extends Zt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}class Uh extends Zt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return ko[this.data.status]||"Unknown status"}}class Bh extends Zt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}class $h extends Zt{_data=null;async initData(e){this._data=e,this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}makeRestrictionManagerParams(){this.data?.license&&this.data.license.includes("ent")&&(this.getLogger().log(`LICENSE ${this.data.license} => up restriction manager params`,An),this._b24.getHttpClient().setRestrictionManagerParams(An))}}class Wh extends Zt{async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(console.error(t),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{(await this._b24.callBatchByChunk(e,!0)).getData().forEach(t=>{if(typeof t.LANG>"u")return;const n=t.CURRENCY,i=this.data.currencyList.get(n);if(!(typeof i>"u"))for(const[s,o]of Object.entries(t.LANG))switch(i.lang[s]={decimals:Number.parseInt(o.DECIMALS),decPoint:o.DEC_POINT,formatString:o.FORMAT_STRING,fullName:o.FULL_NAME,isHideZero:o.HIDE_ZERO==="Y",thousandsSep:o.THOUSANDS_SEP,thousandsVariant:o.THOUSANDS_VARIANT},i.lang[s].thousandsVariant){case"N":i.lang[s].thousandsSep="";break;case"D":i.lang[s].thousandsSep=".";break;case"C":i.lang[s].thousandsSep=",";break;case"S":i.lang[s].thousandsSep=" ";break;case"B":i.lang[s].thousandsSep=" ";break;default:x.isStringFilled(i.lang[s].thousandsSep)||(i.lang[s].thousandsSep=" ");break}})}catch(t){console.error(t)}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(e){this._data.currencyBase=e}get baseCurrency(){return this.data.currencyBase}setCurrencyList(e=[]){this.data.currencyList.clear();for(const t of e)this.data.currencyList.set(t.CURRENCY,{amount:Number.parseFloat(t.CURRENCY),amountCnt:Number.parseInt(t.AMOUNT_CNT),isBase:t.BASE==="Y",currencyCode:t.CURRENCY,dateUpdate:G.toDateTime(t.DATE_UPDATE),decimals:Number.parseInt(t.DECIMALS),decPoint:t.DEC_POINT,formatString:t.FORMAT_STRING,fullName:t.FULL_NAME,lid:t.LID,sort:Number.parseInt(t.SORT),thousandsSep:t?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Oi(e);let i=n.fullName;if(!(typeof t>"u")){const s=n.lang[t];x.isUndefined(s)||(i=s.fullName)}return i}getCurrencyLiteral(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Oi(e);let i=n.formatString;if(!(typeof t>"u")){const s=n.lang[t];x.isUndefined(s)||(i=s.formatString)}return i.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,n){const i=this.data.currencyList.get(t);if(typeof i>"u")throw new Oi(t);const s={formatString:i.formatString,decimals:i.decimals,decPoint:i.decPoint,thousandsSep:i.thousandsSep};x.isStringFilled(s.thousandsSep)||(s.thousandsSep="");const o=i.lang[n];return x.isUndefined(o)||(s.formatString=o.formatString,s.decimals=o.decimals,s.decPoint=o.decPoint,s.thousandsSep=o.thousandsSep),s.formatString.replaceAll("&#","&%").replace("#",G.numberFormat(e,s.decimals,s.decPoint,s.thousandsSep)).replaceAll("&%","&#")||""}}class Ti extends Zt{_data;_type;static getSupportTypes(){return[at.NotSet,at.JsonArray,at.JsonObject,at.FloatVal,at.IntegerVal,at.BoolYN,at.StringVal]}static prepareArrayList(e){return x.isArray(e)?e:x.isObject(e)?Object.values(e):[]}constructor(e,t){super(e),this._type=t,this._data=new Map}get data(){return this._data}reset(){this.data.clear()}async initData(e){if(this.reset(),x.isObject(e))for(const[t,n]of Object.entries(e))this.data.set(t,n)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n),!x.isArray(n)&&!x.isObject(n)&&(n=t)}catch(i){this.getLogger().error(i),n=t}return Ti.prepareArrayList(n)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n)}catch(i){this.getLogger().error(i),n=t}return x.isObject(n)||(n=t),n}getFloat(e,t=0){return this.data.has(e)?G.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?G.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?G.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?G.toBoolean(this.data.get(e)):t}getString(e,t=""){return this.data.has(e)?this.data.get(e).toString():t}getDate(e,t=null){if(!this.data.has(e))return t;try{const n=G.toDateTime(this.data.get(e).toString());return n.isValid?n:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(n){this.getLogger().warn(n,e)}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t){const n=[];return n.push({method:this.getMethodSave(),params:{options:e}}),x.isObject(t)&&n.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.callBatch(n,!0)}}class Xa{_logger=null;userId;siteId;constructor(e={}){this.userId=e.userId?G.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}set(e,t){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window.localStorage>"u")return t||null;const n=window.localStorage.getItem(this._getKey(e));return n===null?t||null:JSON.parse(n)}remove(e){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}return window.localStorage.removeItem(this._getKey(e))}_getKey(e){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${e}`}compareKey(e,t){return e===this._getKey(t)}}class qh extends Error{constructor(e){super(e),this.name="ErrorNotConnected"}}class Vh extends Error{constructor(e){super(e),this.name="ErrorTimeout"}}const Zr="2.0";class Hh{_logger=null;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._connector=e.connector,x.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,n=5){return new Promise((i,s)=>{const o=this.createRequest(e,t);this._connector.send(JSON.stringify(o))||s(new qh("websocket is not connected"));const l=setTimeout(()=>{this._rpcResponseAwaiters.delete(o.id),s(new Vh("no response"))},n*1e3);this._rpcResponseAwaiters.set(o.id,{resolve:i,reject:s,timeout:l})})}executeOutgoingRpcBatch(e){const t=[],n=[];return e.forEach(({method:i,params:s,id:o})=>{const l=this.createRequest(i,s,o);t.push(l),n.push(new Promise((a,u)=>this._rpcResponseAwaiters.set(l.id,{resolve:a,reject:u})))}),this._connector.send(JSON.stringify(t)),n}processRpcResponse(e){if("id"in e&&this._rpcResponseAwaiters.has(Number(e.id))){const t=this._rpcResponseAwaiters.get(Number(e.id));t&&("result"in e?t.resolve(e.result):"error"in e?t.reject(e?.error||"error"):t.reject("wrong response structure"),clearTimeout(t.timeout),this._rpcResponseAwaiters.delete(Number(e.id)));return}this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Received rpc response with unknown id`),e)}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(n){this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Could not decode json rpc message`),n);return}if(x.isArray(t))return this.executeIncomingRpcBatch(t);if(x.isJsonRpcRequest(t))return this.executeIncomingRpcCommand(t);if(x.isJsonRpcResponse(t))return this.processRpcResponse(t);this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: unknown rpc packet`),t)}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:Zr,error:Cn.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const n of e)if("jsonrpc"in n)if("method"in n){const i=this.executeIncomingRpcCommand(n);i&&(i.jsonrpc=Zr,i.id=n.id,t.push(i))}else this.processRpcResponse(n);else this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: unknown rpc command in batch`),n),t.push({jsonrpc:Zr,error:Cn.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,n){return n||(n=this.nextId()),{jsonrpc:Zr,method:e,params:t,id:n}}}class zh{_logger=null;_storage;_ttl=24*60*60;_callbacks;constructor(e={}){e=e||{},this._storage=e.storage||new Xa,this._callbacks={onWebSocketBlockChanged:x.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",xe.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(xe.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(xe.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage. Error: `),t),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(xe.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(xe.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage. Error: `),t),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(xe.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(xe.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: LocalStorage error: `),t),!1}return!0}getTimestamp(){return Date.now()}}class Jh{_logger=null;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}async getPublicIds(e){const t=new Date,n={},i=[];for(const s of e){const o=this._publicIds.get(s);o&&o.end>t?n[o.userId]=o:i.push(s)}return i.length===0?Promise.resolve(n):new Promise(s=>{this._restClient.callMethod(this._getPublicListMethod,{users:i}).then(o=>{const l=o.getData().result;this.setPublicIds(Object.values(l));for(const a of i){const u=this._publicIds.get(a);u&&(n[u.userId]=u)}s(n)}).catch(o=>(this.getLogger().error(o),s({})))})}setPublicIds(e){e.forEach(t=>{const n=Number(t.user_id);this._publicIds.set(n,{userId:n,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var Ai={exports:{}};/*!
|
|
1
|
+
(function(j,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(j=typeof globalThis<"u"?globalThis:j||self,I(j.B24Js=j.B24Js||{}))})(this,function(j){"use strict";var I=(r=>(r.desktop="desktop",r.log="log",r.info="info",r.warn="warn",r.error="error",r.trace="trace",r))(I||{});const je=new Map;je.set("title",["%c#title#","color: #959ca4; font-style: italic; padding: 0 6px; border-top: 1px solid #ccc; border-left: 1px solid #ccc; border-bottom: 1px solid #ccc"]),je.set("desktop",["%cDESKTOP","color: white; font-style: italic; background-color: #29619b; padding: 0 6px; border: 1px solid #29619b"]),je.set("log",["%cLOG","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]),je.set("info",["%cINFO","color: #fff; font-style: italic; background-color: #6b7f96; padding: 0 6px; border: 1px solid #6b7f96"]),je.set("warn",["%cWARNING","color: #f0a74f; font-style: italic; padding: 0 6px; border: 1px solid #f0a74f"]),je.set("error",["%cERROR","color: white; font-style: italic; background-color: #8a3232; padding: 0 6px; border: 1px solid #8a3232"]),je.set("trace",["%cTRACE","color: #2a323b; font-style: italic; background-color: #ccc; padding: 0 6px; border: 1px solid #ccc"]);class Ee{#e;#t={desktop:!0,log:!1,info:!1,warn:!1,error:!0,trace:!0};static build(e,t=!1){const n=new Ee(e);return t&&(n.enable("log"),n.enable("info"),n.enable("warn")),n}constructor(e){this.#e=e}#r(e){const t=[],n=[];if(je.has("title")){const s=je.get("title");s[0]&&(t.push(s[0].replace("#title#",this.#e)),n.push(s[1]||""))}if(je.has(e)){const s=je.get(e);s[0]&&(t.push(s[0]),n.push(s[1]||""))}return[t.join(""),...n]}setConfig(e){for(const t in e)this.#t[t]=e[t]}enable(e){return typeof this.#t[e]>"u"?!1:(this.#t[e]=!0,!0)}disable(e){return typeof this.#t[e]>"u"?!1:(this.#t[e]=!1,!0)}isEnabled(e){return this.#t[e]}desktop(...e){this.isEnabled("desktop")&&console.log(...this.#r("desktop"),...e)}log(...e){this.isEnabled("log")&&console.log(...this.#r("log"),...e)}info(...e){this.isEnabled("info")&&console.info(...this.#r("info"),...e)}warn(...e){this.isEnabled("warn")&&console.warn(...this.#r("warn"),...e)}error(...e){this.isEnabled("error")&&console.error(...this.#r("error"),...e)}trace(...e){this.isEnabled("trace")&&console.trace(...this.#r("trace"),...e)}}var Hn=(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))(Hn||{});const Zo=Function.prototype.toString.call(Object);let Go=class{getTag(e){return Object.prototype.toString.call(e)}isString(e){return e===""?!0:e?typeof e=="string"||e instanceof String:!1}isStringFilled(e){return this.isString(e)&&e!==""}isFunction(e){return e===null?!1:typeof e=="function"||e instanceof Function}isObject(e){return!!e&&(typeof e=="object"||typeof e=="function")}isObjectLike(e){return!!e&&typeof e=="object"}isPlainObject(e){if(!this.isObjectLike(e)||this.getTag(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=t.hasOwnProperty("constructor")&&t.constructor;return typeof n=="function"&&Function.prototype.toString.call(n)===Zo}isJsonRpcRequest(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"method"in e&&this.isStringFilled(e.method)}isJsonRpcResponse(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"id"in e&&("result"in e||"error"in e)}isBoolean(e){return e===!0||e===!1}isNumber(e){return!Number.isNaN(e)&&typeof e=="number"}isInteger(e){return this.isNumber(e)&&e%1===0}isFloat(e){return this.isNumber(e)&&!this.isInteger(e)}isNil(e){return e==null}isArray(e){return!this.isNil(e)&&Array.isArray(e)}isArrayFilled(e){return this.isArray(e)&&e.length>0}isArrayLike(e){return!this.isNil(e)&&!this.isFunction(e)&&e.length>-1&&e.length<=Number.MAX_SAFE_INTEGER}isDate(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Date]"}isDomNode(e){return this.isObjectLike(e)&&!this.isPlainObject(e)&&"nodeType"in e}isElementNode(e){return this.isDomNode(e)&&e.nodeType===Node.ELEMENT_NODE}isTextNode(e){return this.isDomNode(e)&&e.nodeType===Node.TEXT_NODE}isMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Map]"}isSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Set]"}isWeakMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakMap]"}isWeakSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakSet]"}isPrototype(e){return(typeof(e&&e.constructor)=="function"&&e.constructor.prototype||Object.prototype)===e}isRegExp(e){return this.isObjectLike(e)&&this.getTag(e)==="[object RegExp]"}isNull(e){return e===null}isUndefined(e){return typeof e>"u"}isArrayBuffer(e){return this.isObjectLike(e)&&this.getTag(e)==="[object ArrayBuffer]"}isTypedArray(e){const t=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)]$/;return this.isObjectLike(e)&&t.test(this.getTag(e))}isBlob(e){return this.isObjectLike(e)&&this.isNumber(e.size)&&this.isString(e.type)&&this.isFunction(e.slice)}isFile(e){return this.isBlob(e)&&this.isString(e.name)&&(this.isNumber(e.lastModified)||this.isObjectLike(e.lastModifiedDate))}isFormData(e){return e instanceof FormData}clone(e,t=!0){let n,s,i;if(e===null)return null;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 L=new Go;class ut extends Error{}class Yo extends ut{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Ko extends ut{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Qo extends ut{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class vt extends ut{}class qn extends ut{constructor(e){super(`Invalid unit ${e}`)}}class be extends ut{}class et extends ut{constructor(){super("Zone is an abstract class")}}const C="numeric",Ue="short",Ne="long",or={year:C,month:C,day:C},zn={year:C,month:Ue,day:C},Xo={year:C,month:Ue,day:C,weekday:Ue},Jn={year:C,month:Ne,day:C},Zn={year:C,month:Ne,day:C,weekday:Ne},Gn={hour:C,minute:C},Yn={hour:C,minute:C,second:C},Kn={hour:C,minute:C,second:C,timeZoneName:Ue},Qn={hour:C,minute:C,second:C,timeZoneName:Ne},Xn={hour:C,minute:C,hourCycle:"h23"},es={hour:C,minute:C,second:C,hourCycle:"h23"},ts={hour:C,minute:C,second:C,hourCycle:"h23",timeZoneName:Ue},rs={hour:C,minute:C,second:C,hourCycle:"h23",timeZoneName:Ne},ns={year:C,month:C,day:C,hour:C,minute:C},ss={year:C,month:C,day:C,hour:C,minute:C,second:C},is={year:C,month:Ue,day:C,hour:C,minute:C},os={year:C,month:Ue,day:C,hour:C,minute:C,second:C},ea={year:C,month:Ue,day:C,weekday:Ue,hour:C,minute:C},as={year:C,month:Ne,day:C,hour:C,minute:C,timeZoneName:Ue},cs={year:C,month:Ne,day:C,hour:C,minute:C,second:C,timeZoneName:Ue},ls={year:C,month:Ne,day:C,weekday:Ne,hour:C,minute:C,timeZoneName:Ne},us={year:C,month:Ne,day:C,weekday:Ne,hour:C,minute:C,second:C,timeZoneName:Ne};class Wt{get type(){throw new et}get name(){throw new et}get ianaName(){return this.name}get isUniversal(){throw new et}offsetName(e,t){throw new et}formatOffset(e,t){throw new et}offset(e){throw new et}equals(e){throw new et}get isValid(){throw new et}}let jr=null;class ar extends Wt{static get instance(){return jr===null&&(jr=new ar),jr}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Ms(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}}let cr={};function ta(r){return cr[r]||(cr[r]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),cr[r]}const ra={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function na(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 sa(r,e){const t=r.formatToParts(e),n=[];for(let s=0;s<t.length;s++){const{type:i,value:o}=t[s],c=ra[i];i==="era"?n[c]=o:$(c)||(n[c]=parseInt(o,10))}return n}let lr={};class Ge extends Wt{static create(e){return lr[e]||(lr[e]=new Ge(e)),lr[e]}static resetCache(){lr={},cr={}}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=Ge.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Ms(e,t,n,this.name)}formatOffset(e,t){return zt(this.offset(e),t)}offset(e){const t=new Date(e);if(isNaN(t))return NaN;const n=ta(this.name);let[s,i,o,c,a,u,l]=n.formatToParts?sa(n,t):na(n,t);c==="BC"&&(s=-Math.abs(s)+1);const f=pr({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,(f-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let hs={};function ia(r,e={}){const t=JSON.stringify([r,e]);let n=hs[t];return n||(n=new Intl.ListFormat(r,e),hs[t]=n),n}let Ur={};function Br(r,e={}){const t=JSON.stringify([r,e]);let n=Ur[t];return n||(n=new Intl.DateTimeFormat(r,e),Ur[t]=n),n}let $r={};function oa(r,e={}){const t=JSON.stringify([r,e]);let n=$r[t];return n||(n=new Intl.NumberFormat(r,e),$r[t]=n),n}let Wr={};function aa(r,e={}){const{base:t,...n}=e,s=JSON.stringify([r,n]);let i=Wr[s];return i||(i=new Intl.RelativeTimeFormat(r,e),Wr[s]=i),i}let Vt=null;function ca(){return Vt||(Vt=new Intl.DateTimeFormat().resolvedOptions().locale,Vt)}let fs={};function la(r){let e=fs[r];if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,fs[r]=e}return e}function ua(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=Br(r).resolvedOptions(),s=r}catch{const a=r.substring(0,t);n=Br(a).resolvedOptions(),s=a}const{numberingSystem:i,calendar:o}=n;return[s,i,o]}}function ha(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function fa(r){const e=[];for(let t=1;t<=12;t++){const n=U.utc(2009,t,1);e.push(r(n))}return e}function da(r){const e=[];for(let t=1;t<=7;t++){const n=U.utc(2016,11,13+t);e.push(r(n))}return e}function ur(r,e,t,n){const s=r.listingMode();return s==="error"?null:s==="en"?t(e):n(e)}function pa(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||new Intl.DateTimeFormat(r.intl).resolvedOptions().numberingSystem==="latn"}class ma{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=oa(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):Yr(e,3);return ue(t,this.padTo)}}}class ga{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&&Ge.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=Br(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 ya{constructor(e,t,n){this.opts={style:"long",...n},!t&&Rs()&&(this.rtf=aa(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):Ba(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const wa={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":ca()),a=t||ne.defaultNumberingSystem,u=n||ne.defaultOutputCalendar,l=Zr(s)||ne.defaultWeekSettings;return new K(c,a,u,l,o)}static resetCache(){Vt=null,Ur={},$r={},Wr={}}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]=ua(e);this.locale=o,this.numberingSystem=t||c||null,this.outputCalendar=n||a||null,this.weekSettings=s,this.intl=ha(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=pa(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,Zr(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 ur(this,e,js,()=>{const n=t?{month:e,day:"numeric"}:{month:e},s=t?"format":"standalone";return this.monthsCache[s][e]||(this.monthsCache[s][e]=fa(i=>this.extract(i,n,"month"))),this.monthsCache[s][e]})}weekdays(e,t=!1){return ur(this,e,$s,()=>{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]=da(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[s][e]})}meridiems(){return ur(this,void 0,()=>Ws,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[U.utc(2016,11,13,9),U.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return ur(this,e,Vs,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[U.utc(-40,1,1),U.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){const s=this.dtFormatter(e,t),i=s.formatToParts(),o=i.find(c=>c.type.toLowerCase()===n);return o?o.value:null}numberFormatter(e={}){return new ma(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new ga(e,this.intl,t)}relFormatter(e={}){return new ya(this.intl,this.isEnglish(),e)}listFormatter(e={}){return ia(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ls()?la(this.locale):wa}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 Vr=null;class Te extends Wt{static get utcInstance(){return Vr===null&&(Vr=new Te(0)),Vr}static instance(e){return e===0?Te.utcInstance:new Te(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Te(mr(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 ba extends Wt{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function tt(r,e){if($(r)||r===null)return e;if(r instanceof Wt)return r;if(Ta(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?ar.instance:t==="utc"||t==="gmt"?Te.utcInstance:Te.parseSpecifier(t)||Ge.create(r)}else return rt(r)?Te.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new ba(r)}const Hr={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"},ds={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]},Sa=Hr.hanidec.replace(/[\[|\]]/g,"").split("");function _a(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(Hr.hanidec)!==-1)e+=Sa.indexOf(r[t]);else for(const s in ds){const[i,o]=ds[s];n>=i&&n<=o&&(e+=n-i)}}return parseInt(e,10)}else return e}let kt={};function va(){kt={}}function Be({numberingSystem:r},e=""){const t=r||"latn";return kt[t]||(kt[t]={}),kt[t][e]||(kt[t][e]=new RegExp(`${Hr[t]}${e}`)),kt[t][e]}let ps=()=>Date.now(),ms="system",gs=null,ys=null,ws=null,bs=60,Ss,_s=null;class ne{static get now(){return ps}static set now(e){ps=e}static set defaultZone(e){ms=e}static get defaultZone(){return tt(ms,ar.instance)}static get defaultLocale(){return gs}static set defaultLocale(e){gs=e}static get defaultNumberingSystem(){return ys}static set defaultNumberingSystem(e){ys=e}static get defaultOutputCalendar(){return ws}static set defaultOutputCalendar(e){ws=e}static get defaultWeekSettings(){return _s}static set defaultWeekSettings(e){_s=Zr(e)}static get twoDigitCutoffYear(){return bs}static set twoDigitCutoffYear(e){bs=e%100}static get throwOnInvalid(){return Ss}static set throwOnInvalid(e){Ss=e}static resetCaches(){K.resetCache(),Ge.resetCache(),U.resetCache(),va()}}class $e{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const vs=[0,31,59,90,120,151,181,212,243,273,304,334],ks=[0,31,60,91,121,152,182,213,244,274,305,335];function Me(r,e){return new $e("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function qr(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 Es(r,e,t){return t+(Ht(r)?ks:vs)[e-1]}function Ts(r,e){const t=Ht(r)?ks:vs,n=t.findIndex(i=>i<e),s=e-t[n];return{month:n+1,day:s}}function zr(r,e){return(r-e+7)%7+1}function hr(r,e=4,t=1){const{year:n,month:s,day:i}=r,o=Es(n,s,i),c=zr(qr(n,s,i),t);let a=Math.floor((o-c+14-e)/7),u;return a<1?(u=n-1,a=qt(u,e,t)):a>qt(n,e,t)?(u=n+1,a=1):u=n,{weekYear:u,weekNumber:a,weekday:c,...yr(r)}}function Os(r,e=4,t=1){const{weekYear:n,weekNumber:s,weekday:i}=r,o=zr(qr(n,1,e),t),c=Tt(n);let a=s*7+i-o-7+e,u;a<1?(u=n-1,a+=Tt(u)):a>c?(u=n+1,a-=Tt(n)):u=n;const{month:l,day:h}=Ts(u,a);return{year:u,month:l,day:h,...yr(r)}}function Jr(r){const{year:e,month:t,day:n}=r,s=Es(e,t,n);return{year:e,ordinal:s,...yr(r)}}function As(r){const{year:e,ordinal:t}=r,{month:n,day:s}=Ts(e,t);return{year:e,month:n,day:s,...yr(r)}}function Is(r,e){if(!$(r.localWeekday)||!$(r.localWeekNumber)||!$(r.localWeekYear)){if(!$(r.weekday)||!$(r.weekNumber)||!$(r.weekYear))throw new vt("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 ka(r,e=4,t=1){const n=fr(r.weekYear),s=xe(r.weekNumber,1,qt(r.weekYear,e,t)),i=xe(r.weekday,1,7);return n?s?i?!1:Me("weekday",r.weekday):Me("week",r.weekNumber):Me("weekYear",r.weekYear)}function Ea(r){const e=fr(r.year),t=xe(r.ordinal,1,Tt(r.year));return e?t?!1:Me("ordinal",r.ordinal):Me("year",r.year)}function Cs(r){const e=fr(r.year),t=xe(r.month,1,12),n=xe(r.day,1,dr(r.year,r.month));return e?t?n?!1:Me("day",r.day):Me("month",r.month):Me("year",r.year)}function Ns(r){const{hour:e,minute:t,second:n,millisecond:s}=r,i=xe(e,0,23)||e===24&&t===0&&n===0&&s===0,o=xe(t,0,59),c=xe(n,0,59),a=xe(s,0,999);return i?o?c?a?!1:Me("millisecond",s):Me("second",n):Me("minute",t):Me("hour",e)}function $(r){return typeof r>"u"}function rt(r){return typeof r=="number"}function fr(r){return typeof r=="number"&&r%1===0}function Ta(r){return typeof r=="string"}function Oa(r){return Object.prototype.toString.call(r)==="[object Date]"}function Rs(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Ls(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Aa(r){return Array.isArray(r)?r:[r]}function Fs(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 Ia(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function Et(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Zr(r){if(r==null)return null;if(typeof r!="object")throw new be("Week settings must be an object");if(!xe(r.firstDay,1,7)||!xe(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!xe(e,1,7)))throw new be("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function xe(r,e,t){return fr(r)&&r>=e&&r<=t}function Ca(r,e){return r-e*Math.floor(r/e)}function ue(r,e=2){const t=r<0;let n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function nt(r){if(!($(r)||r===null||r===""))return parseInt(r,10)}function ht(r){if(!($(r)||r===null||r===""))return parseFloat(r)}function Gr(r){if(!($(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function Yr(r,e,t=!1){const n=10**e;return(t?Math.trunc:Math.round)(r*n)/n}function Ht(r){return r%4===0&&(r%100!==0||r%400===0)}function Tt(r){return Ht(r)?366:365}function dr(r,e){const t=Ca(e-1,12)+1,n=r+(e-t)/12;return t===2?Ht(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function pr(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}function Ps(r,e,t){return-zr(qr(r,1,e),t)+e-1}function qt(r,e=4,t=1){const n=Ps(r,e,t),s=Ps(r+1,e,t);return(Tt(r)-n+s)/7}function Kr(r){return r>99?r:r>ne.twoDigitCutoffYear?1900+r:2e3+r}function Ms(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 mr(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 xs(r){const e=Number(r);if(typeof r=="boolean"||r===""||Number.isNaN(e))throw new be(`Invalid unit value ${r}`);return e}function gr(r,e){const t={};for(const n in r)if(Et(r,n)){const s=r[n];if(s==null)continue;t[e(n)]=xs(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}${ue(t,2)}:${ue(n,2)}`;case"narrow":return`${s}${t}${n>0?`:${n}`:""}`;case"techie":return`${s}${ue(t,2)}${ue(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function yr(r){return Ia(r,["hour","minute","second","millisecond"])}const Na=["January","February","March","April","May","June","July","August","September","October","November","December"],Ds=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ra=["J","F","M","A","M","J","J","A","S","O","N","D"];function js(r){switch(r){case"narrow":return[...Ra];case"short":return[...Ds];case"long":return[...Na];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 Us=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Bs=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],La=["M","T","W","T","F","S","S"];function $s(r){switch(r){case"narrow":return[...La];case"short":return[...Bs];case"long":return[...Us];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Ws=["AM","PM"],Fa=["Before Christ","Anno Domini"],Pa=["BC","AD"],Ma=["B","A"];function Vs(r){switch(r){case"narrow":return[...Ma];case"short":return[...Pa];case"long":return[...Fa];default:return null}}function xa(r){return Ws[r.hour<12?0:1]}function Da(r,e){return $s(e)[r.weekday-1]}function ja(r,e){return js(e)[r.month-1]}function Ua(r,e){return Vs(e)[r.year<0?0:1]}function Ba(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 h=r==="days";switch(e){case 1:return h?"tomorrow":`next ${s[r][0]}`;case-1:return h?"yesterday":`last ${s[r][0]}`;case 0:return h?"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 Hs(r,e){let t="";for(const n of r)n.literal?t+=n.val:t+=e(n.val);return t}const $a={D:or,DD:zn,DDD:Jn,DDDD:Zn,t:Gn,tt:Yn,ttt:Kn,tttt:Qn,T:Xn,TT:es,TTT:ts,TTTT:rs,f:ns,ff:is,fff:as,ffff:ls,F:ss,FF:os,FFF:cs,FFFF:us};class Se{static create(e,t={}){return new Se(e,t)}static parseFormat(e){let t=null,n="",s=!1;const i=[];for(let o=0;o<e.length;o++){const 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 $a[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 ue(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?xa(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(d,p)=>n?ja(e,d):i(p?{month:d}:{month:d,day:"numeric"},"month"),u=(d,p)=>n?Da(e,d):i(p?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),l=d=>{const p=Se.macroTokenToFormatOpts(d);return p?this.formatWithSystemDefault(e,p):d},h=d=>n?Ua(e,d):i({era:d},"era"),f=d=>{switch(d){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return 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 h("short");case"GG":return h("long");case"GGGGG":return h("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return l(d)}};return Hs(Se.parseFormat(t),f)}formatDurationFromString(e,t){const n=a=>{switch(a[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},s=a=>u=>{const l=n(u);return l?this.num(a.get(l),u.length):u},i=Se.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 Hs(i,s(c))}}const qs=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Ot(...r){const e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function At(...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 It(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 zs(...r){return(e,t)=>{const n={};let s;for(s=0;s<r.length;s++)n[r[s]]=nt(e[t+s]);return[n,null,t+s]}}const Js=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Wa=`(?:${Js.source}?(?:\\[(${qs.source})\\])?)?`,Qr=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Zs=RegExp(`${Qr.source}${Wa}`),Xr=RegExp(`(?:T${Zs.source})?`),Va=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Ha=/(\d{4})-?W(\d\d)(?:-?(\d))?/,qa=/(\d{4})-?(\d{3})/,za=zs("weekYear","weekNumber","weekDay"),Ja=zs("year","ordinal"),Za=/(\d{4})-(\d\d)-(\d\d)/,Gs=RegExp(`${Qr.source} ?(?:${Js.source}|(${qs.source}))?`),Ga=RegExp(`(?: ${Gs.source})?`);function Ct(r,e,t){const n=r[e];return $(n)?t:nt(n)}function Ya(r,e){return[{year:Ct(r,e),month:Ct(r,e+1,1),day:Ct(r,e+2,1)},null,e+3]}function Nt(r,e){return[{hours:Ct(r,e,0),minutes:Ct(r,e+1,0),seconds:Ct(r,e+2,0),milliseconds:Gr(r[e+3])},null,e+4]}function Jt(r,e){const t=!r[e]&&!r[e+1],n=mr(r[e+1],r[e+2]),s=t?null:Te.instance(n);return[{},s,e+3]}function Zt(r,e){const t=r[e]?Ge.create(r[e]):null;return[{},t,e+1]}const Ka=RegExp(`^T?${Qr.source}$`),Qa=/^-?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 Xa(r){const[e,t,n,s,i,o,c,a,u]=r,l=e[0]==="-",h=a&&a[0]==="-",f=(d,p=!1)=>d!==void 0&&(p||d&&l)?-d:d;return[{years:f(ht(t)),months:f(ht(n)),weeks:f(ht(s)),days:f(ht(i)),hours:f(ht(o)),minutes:f(ht(c)),seconds:f(ht(a),a==="-0"),milliseconds:f(Gr(u),h)}]}const ec={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 en(r,e,t,n,s,i,o){const c={year:e.length===2?Kr(nt(e)):nt(e),month:Ds.indexOf(t)+1,day:nt(n),hour:nt(s),minute:nt(i)};return o&&(c.second=nt(o)),r&&(c.weekday=r.length>3?Us.indexOf(r)+1:Bs.indexOf(r)+1),c}const tc=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function rc(r){const[,e,t,n,s,i,o,c,a,u,l,h]=r,f=en(e,s,n,t,i,o,c);let d;return a?d=ec[a]:u?d=0:d=mr(l,h),[f,new Te(d)]}function nc(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const sc=/^(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$/,ic=/^(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$/,oc=/^(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 Ys(r){const[,e,t,n,s,i,o,c]=r;return[en(e,s,n,t,i,o,c),Te.utcInstance]}function ac(r){const[,e,t,n,s,i,o,c]=r;return[en(e,c,t,n,s,i,o),Te.utcInstance]}const cc=Ot(Va,Xr),lc=Ot(Ha,Xr),uc=Ot(qa,Xr),hc=Ot(Zs),Ks=At(Ya,Nt,Jt,Zt),fc=At(za,Nt,Jt,Zt),dc=At(Ja,Nt,Jt,Zt),pc=At(Nt,Jt,Zt);function mc(r){return It(r,[cc,Ks],[lc,fc],[uc,dc],[hc,pc])}function gc(r){return It(nc(r),[tc,rc])}function yc(r){return It(r,[sc,Ys],[ic,Ys],[oc,ac])}function wc(r){return It(r,[Qa,Xa])}const bc=At(Nt);function Sc(r){return It(r,[Ka,bc])}const _c=Ot(Za,Ga),vc=Ot(Gs),kc=At(Nt,Jt,Zt);function Ec(r){return It(r,[_c,Ks],[vc,kc])}const Qs="Invalid Duration",Xs={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}},Tc={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},...Xs},De=146097/400,Rt=146097/4800,Oc={years:{quarters:4,months:12,weeks:De/7,days:De,hours:De*24,minutes:De*24*60,seconds:De*24*60*60,milliseconds:De*24*60*60*1e3},quarters:{months:3,weeks:De/28,days:De/4,hours:De*24/4,minutes:De*24*60/4,seconds:De*24*60*60/4,milliseconds:De*24*60*60*1e3/4},months:{weeks:Rt/7,days:Rt,hours:Rt*24,minutes:Rt*24*60,seconds:Rt*24*60*60,milliseconds:Rt*24*60*60*1e3},...Xs},ft=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Ac=ft.slice(0).reverse();function st(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 ei(r,e){let t=e.milliseconds??0;for(const n of Ac.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function ti(r,e){const t=ei(r,e)<0?-1:1;ft.reduceRight((n,s)=>{if($(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),ft.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 Ic(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?Oc:Tc;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 be(`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(rt(e))return Z.fromMillis(e);if(Z.isDuration(e))return e;if(typeof e=="object")return Z.fromObject(e);throw new be(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=wc(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]=Sc(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 be("need to specify a reason the Duration is invalid");const n=e instanceof $e?e:new $e(e,t);if(ne.throwOnInvalid)throw new Qo(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 qn(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Se.create(this.loc,n).formatDurationFromString(this,e):Qs}toHuman(e={}){if(!this.isValid)return Qs;const t=ft.map(n=>{const s=this.values[n];return $(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+=Yr(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},U.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?ei(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 ft)(Et(t.values,s)||Et(this.values,s))&&(n[s]=t.get(s)+this.get(s));return st(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]=xs(e(this.values[n],n));return st(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 st(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 st(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return ti(this.matrix,e),st(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=Ic(this.normalize().shiftToAll().toObject());return st(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 ft)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;rt(s[o])&&(c+=s[o]);const a=Math.trunc(c);t[o]=a,n[o]=(c*1e3-a*1e3)/1e3}else rt(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 ti(this.matrix,t),st(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 st(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 ft)if(!t(this.values[n],e.values[n]))return!1;return!0}}const Lt="Invalid Interval";function Cc(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 be("need to specify a reason the Interval is invalid");const n=e instanceof $e?e:new $e(e,t);if(ne.throwOnInvalid)throw new Ko(n);return new se({invalid:n})}static fromDateTimes(e,t){const n=Yt(e),s=Yt(t),i=Cc(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=U.fromISO(n,t),o=i.isValid}catch{o=!1}let c,a;try{c=U.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 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()})`:Lt}[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=or,t={}){return this.isValid?Se.create(this.s.loc.clone(t),e).formatInterval(this):Lt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Lt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Lt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Lt}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Lt}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 wr{static hasDST(e=ne.defaultZone){const t=U.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Ge.isValidZone(e)}static normalizeZone(e){return tt(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:Rs(),localeWeek:Ls()}}}function ri(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 Nc(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=ri(a,u);return(l-l%7)/7}],["days",ri]],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 Rc(r,e,t,n){let[s,i,o,c]=Nc(r,e,t);const a=e-s,u=t.filter(h=>["hours","minutes","seconds","milliseconds"].indexOf(h)>=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 Lc="missing Intl.DateTimeFormat.formatToParts support";function Y(r,e=t=>t){return{regex:r,deser:([t])=>e(_a(t))}}const ni="[ \xA0]",si=new RegExp(ni,"g");function Fc(r){return r.replace(/\./g,"\\.?").replace(si,ni)}function ii(r){return r.replace(/\./g,"").replace(si," ").toLowerCase()}function We(r,e){return r===null?null:{regex:RegExp(r.map(Fc).join("|")),deser:([t])=>r.findIndex(n=>ii(t)===ii(n))+e}}function oi(r,e){return{regex:r,deser:([,t,n])=>mr(t,n),groups:e}}function br(r){return{regex:r,deser:([e])=>e}}function Pc(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Mc(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}"),h=Be(e,"{2,4}"),f=Be(e,"{4,6}"),d=g=>({regex:RegExp(Pc(g.val)),deser:([y])=>y,literal:!0}),m=(g=>{if(r.literal)return d(g);switch(g.val){case"G":return We(e.eras("short"),0);case"GG":return We(e.eras("long"),0);case"y":return Y(u);case"yy":return Y(h,Kr);case"yyyy":return Y(i);case"yyyyy":return Y(f);case"yyyyyy":return Y(o);case"M":return Y(c);case"MM":return Y(n);case"MMM":return We(e.months("short",!0),1);case"MMMM":return We(e.months("long",!0),1);case"L":return Y(c);case"LL":return Y(n);case"LLL":return We(e.months("short",!1),1);case"LLLL":return We(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 br(l);case"uu":return br(c);case"uuu":return Y(t);case"a":return We(e.meridiems(),0);case"kkkk":return Y(i);case"kk":return Y(h,Kr);case"W":return Y(c);case"WW":return Y(n);case"E":case"c":return Y(t);case"EEE":return We(e.weekdays("short",!1),1);case"EEEE":return We(e.weekdays("long",!1),1);case"ccc":return We(e.weekdays("short",!0),1);case"cccc":return We(e.weekdays("long",!0),1);case"Z":case"ZZ":return oi(new RegExp(`([+-]${c.source})(?::(${n.source}))?`),2);case"ZZZ":return oi(new RegExp(`([+-]${c.source})(${n.source})?`),2);case"z":return br(/[a-z_+-/]{1,256}?/i);case" ":return br(/[^\S\n\r]/);default:return d(g)}})(r)||{invalidReason:Lc};return m.token=r,m}const xc={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 Dc(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=xc[o];if(typeof c=="object"&&(c=c[i]),c)return{literal:!1,val:c}}function jc(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function Uc(r,e,t){const n=r.match(e);if(n){const s={};let i=1;for(const o in t)if(Et(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 Bc(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=Ge.create(r.z)),$(r.Z)||(t||(t=new Te(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=Gr(r.u)),[Object.keys(r).reduce((i,o)=>{const c=e(o);return c&&(i[c]=r[o]),i},{}),t,n]}let tn=null;function $c(){return tn||(tn=U.fromMillis(1555555555555)),tn}function Wc(r,e){if(r.literal)return r;const t=Se.macroTokenToFormatOpts(r.val),n=ui(t,e);return n==null||n.includes(void 0)?r:n}function ai(r,e){return Array.prototype.concat(...r.map(t=>Wc(t,e)))}class ci{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=ai(Se.parseFormat(t),e),this.units=this.tokens.map(n=>Mc(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){const[n,s]=jc(this.units);this.regex=RegExp(n,"i"),this.handlers=s}}explainFromTokens(e){if(this.isValid){const[t,n]=Uc(e,this.regex,this.handlers),[s,i,o]=n?Bc(n):[null,null,void 0];if(Et(n,"a")&&Et(n,"H"))throw new vt("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 li(r,e,t){return new ci(r,t).explainFromTokens(e)}function Vc(r,e,t){const{result:n,zone:s,specificOffset:i,invalidReason:o}=li(r,e,t);return[n,s,i,o]}function ui(r,e){if(!r)return null;const n=Se.create(e,r).dtFormatter($c()),s=n.formatToParts(),i=n.resolvedOptions();return s.map(o=>Dc(o,r,i))}const rn="Invalid DateTime",hi=864e13;function Gt(r){return new $e("unsupported zone",`the zone "${r.name}" is not supported`)}function nn(r){return r.weekData===null&&(r.weekData=hr(r.c)),r.weekData}function sn(r){return r.localWeekData===null&&(r.localWeekData=hr(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function dt(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new U({...t,...e,old:t})}function fi(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 Sr(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 _r(r,e,t){return fi(pr(r),e,t)}function di(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,dr(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=pr(i);let[a,u]=fi(c,t,r.zone);return o!==0&&(a+=o,u=r.zone.offset(a)),{ts:a,o:u}}function Ft(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=U.fromObject(r,{...t,zone:a,specificOffset:i});return o?u:u.setZone(c)}else return U.invalid(new $e("unparsable",`the input "${s}" can't be parsed as ${n}`))}function vr(r,e,t=!0){return r.isValid?Se.create(K.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function on(r,e){const t=r.c.year>9999||r.c.year<0;let n="";return t&&r.c.year>=0&&(n+="+"),n+=ue(r.c.year,t?6:4),e?(n+="-",n+=ue(r.c.month),n+="-",n+=ue(r.c.day)):(n+=ue(r.c.month),n+=ue(r.c.day)),n}function pi(r,e,t,n,s,i){let o=ue(r.c.hour);return e?(o+=":",o+=ue(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(o+=":")):o+=ue(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(o+=ue(r.c.second),(r.c.millisecond!==0||!n)&&(o+=".",o+=ue(r.c.millisecond,3))),s&&(r.isOffsetFixed&&r.offset===0&&!i?o+="Z":r.o<0?(o+="-",o+=ue(Math.trunc(-r.o/60)),o+=":",o+=ue(Math.trunc(-r.o%60))):(o+="+",o+=ue(Math.trunc(r.o/60)),o+=":",o+=ue(Math.trunc(r.o%60)))),i&&(o+="["+r.zone.ianaName+"]"),o}const mi={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Hc={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},qc={ordinal:1,hour:0,minute:0,second:0,millisecond:0},gi=["year","month","day","hour","minute","second","millisecond"],zc=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Jc=["year","ordinal","hour","minute","second","millisecond"];function Zc(r){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new qn(r);return e}function yi(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Zc(r)}}function Gc(r){return Er[r]||(kr===void 0&&(kr=ne.now()),Er[r]=r.offset(kr)),Er[r]}function wi(r,e){const t=tt(e.zone,ne.defaultZone);if(!t.isValid)return U.invalid(Gt(t));const n=K.fromObject(e);let s,i;if($(r.year))s=ne.now();else{for(const a of gi)$(r[a])&&(r[a]=mi[a]);const o=Cs(r)||Ns(r);if(o)return U.invalid(o);const c=Gc(t);[s,i]=_r(r,c,t)}return new U({ts:s,zone:t,loc:n,o:i})}function bi(r,e,t){const n=$(t.round)?!0:t.round,s=(o,c)=>(o=Yr(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 Si(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 kr,Er={};class U{constructor(e){const t=e.zone||ne.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new $e("invalid input"):null)||(t.isValid?null:Gt(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 c=rt(e.o)&&!e.old?e.o:t.offset(this.ts);s=Sr(this.ts,c),n=Number.isNaN(s.year)?new $e("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 U({})}static local(){const[e,t]=Si(arguments),[n,s,i,o,c,a,u]=t;return wi({year:n,month:s,day:i,hour:o,minute:c,second:a,millisecond:u},e)}static utc(){const[e,t]=Si(arguments),[n,s,i,o,c,a,u]=t;return e.zone=Te.utcInstance,wi({year:n,month:s,day:i,hour:o,minute:c,second:a,millisecond:u},e)}static fromJSDate(e,t={}){const n=Oa(e)?e.valueOf():NaN;if(Number.isNaN(n))return U.invalid("invalid input");const s=tt(t.zone,ne.defaultZone);return s.isValid?new U({ts:n,zone:s,loc:K.fromObject(t)}):U.invalid(Gt(s))}static fromMillis(e,t={}){if(rt(e))return e<-hi||e>hi?U.invalid("Timestamp out of range"):new U({ts:e,zone:tt(t.zone,ne.defaultZone),loc:K.fromObject(t)});throw new be(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(rt(e))return new U({ts:e*1e3,zone:tt(t.zone,ne.defaultZone),loc:K.fromObject(t)});throw new be("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=tt(t.zone,ne.defaultZone);if(!n.isValid)return U.invalid(Gt(n));const s=K.fromObject(t),i=gr(e,yi),{minDaysInFirstWeek:o,startOfWeek:c}=Is(i,s),a=ne.now(),u=$(t.specificOffset)?n.offset(a):t.specificOffset,l=!$(i.ordinal),h=!$(i.year),f=!$(i.month)||!$(i.day),d=h||f,p=i.weekYear||i.weekNumber;if((d||l)&&p)throw new vt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&l)throw new vt("Can't mix ordinal dates with month/day");const m=p||i.weekday&&!d;let g,y,w=Sr(a,u);m?(g=zc,y=Hc,w=hr(w,o,c)):l?(g=Jc,y=qc,w=Jr(w)):(g=gi,y=mi);let _=!1;for(const M of g){const J=i[M];$(J)?_?i[M]=y[M]:i[M]=w[M]:_=!0}const b=m?ka(i,o,c):l?Ea(i):Cs(i),k=b||Ns(i);if(k)return U.invalid(k);const S=m?Os(i,o,c):l?As(i):i,[E,N]=_r(S,u,n),x=new U({ts:E,zone:n,o:N,loc:s});return i.weekday&&d&&e.weekday!==x.weekday?U.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${x.toISO()}`):x.isValid?x:U.invalid(x.invalid)}static fromISO(e,t={}){const[n,s]=mc(e);return Ft(n,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,s]=gc(e);return Ft(n,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,s]=yc(e);return Ft(n,s,t,"HTTP",t)}static fromFormat(e,t,n={}){if($(e)||$(t))throw new be("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]=Vc(o,e,t);return l?U.invalid(l):Ft(c,a,n,`format ${t}`,e,u)}static fromString(e,t,n={}){return U.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,s]=Ec(e);return Ft(n,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new be("need to specify a reason the DateTime is invalid");const n=e instanceof $e?e:new $e(e,t);if(ne.throwOnInvalid)throw new Yo(n);return new U({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=ui(e,K.fromObject(t));return n?n.map(s=>s?s.val:null).join(""):null}static expandFormat(e,t={}){return ai(Se.parseFormat(e),K.fromObject(t)).map(s=>s.val).join("")}static resetCache(){kr=void 0,Er={}}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?nn(this).weekYear:NaN}get weekNumber(){return this.isValid?nn(this).weekNumber:NaN}get weekday(){return this.isValid?nn(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?sn(this).weekday:NaN}get localWeekNumber(){return this.isValid?sn(this).weekNumber:NaN}get localWeekYear(){return this.isValid?sn(this).weekYear:NaN}get ordinal(){return this.isValid?Jr(this.c).ordinal:NaN}get monthShort(){return this.isValid?wr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?wr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?wr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?wr.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=pr(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=Sr(a,o),h=Sr(u,c);return l.hour===h.hour&&l.minute===h.minute&&l.second===h.second&&l.millisecond===h.millisecond?[dt(this,{ts:a}),dt(this,{ts:u})]:[this]}get isInLeapYear(){return Ht(this.year)}get daysInMonth(){return dr(this.year,this.month)}get daysInYear(){return this.isValid?Tt(this.year):NaN}get weeksInWeekYear(){return this.isValid?qt(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?qt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:s}=Se.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(Te.instance(e),t)}toLocal(){return this.setZone(ne.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=tt(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]=_r(o,i,e)}return dt(this,{ts:s,zone:e})}else return U.invalid(Gt(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return dt(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=gr(e,yi),{minDaysInFirstWeek:n,startOfWeek:s}=Is(t,this.loc),i=!$(t.weekYear)||!$(t.weekNumber)||!$(t.weekday),o=!$(t.ordinal),c=!$(t.year),a=!$(t.month)||!$(t.day),u=c||a,l=t.weekYear||t.weekNumber;if((u||o)&&l)throw new vt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new vt("Can't mix ordinal dates with month/day");let h;i?h=Os({...hr(this.c,n,s),...t},n,s):$(t.ordinal)?(h={...this.toObject(),...t},$(t.day)&&(h.day=Math.min(dr(h.year,h.month),h.day))):h=As({...Jr(this.c),...t});const[f,d]=_r(h,this.o,this.zone);return dt(this,{ts:f,o:d})}plus(e){if(!this.isValid)return this;const t=Z.fromDurationLike(e);return dt(this,di(this,t))}minus(e){if(!this.isValid)return this;const t=Z.fromDurationLike(e).negate();return dt(this,di(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?Se.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):rn}toLocaleString(e=or,t={}){return this.isValid?Se.create(this.loc.clone(t),e).formatDateTime(this):rn}toLocaleParts(e={}){return this.isValid?Se.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:s=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;const o=e==="extended";let c=on(this,o);return c+="T",c+=pi(this,o,t,n,s,i),c}toISODate({format:e="extended"}={}){return this.isValid?on(this,e==="extended"):null}toISOWeekDate(){return vr(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":"")+pi(this,o==="extended",t,e,n,i):null}toRFC2822(){return vr(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return vr(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?on(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")),vr(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():rn}[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=Aa(t).map(Z.normalizeUnit),o=e.valueOf()>this.valueOf(),c=o?this:e,a=o?e:this,u=Rc(c,a,i,s);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(U.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||U.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let s=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(s=e.unit,i=void 0),bi(t,this.plus(n),{...e,numeric:"always",units:s,unit:i})}toRelativeCalendar(e={}){return this.isValid?bi(e.base||U.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(U.isDateTime))throw new be("min requires all arguments be DateTimes");return Fs(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(U.isDateTime))throw new be("max requires all arguments be DateTimes");return Fs(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 li(o,e,t)}static fromStringExplain(e,t,n={}){return U.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:s=null}=t,i=K.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0});return new ci(i,e)}static fromFormatParser(e,t,n={}){if($(e)||$(t))throw new be("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 be(`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?U.invalid(l):Ft(c,a,n,`format ${t.format}`,e,u)}static get DATE_SHORT(){return or}static get DATE_MED(){return zn}static get DATE_MED_WITH_WEEKDAY(){return Xo}static get DATE_FULL(){return Jn}static get DATE_HUGE(){return Zn}static get TIME_SIMPLE(){return Gn}static get TIME_WITH_SECONDS(){return Yn}static get TIME_WITH_SHORT_OFFSET(){return Kn}static get TIME_WITH_LONG_OFFSET(){return Qn}static get TIME_24_SIMPLE(){return Xn}static get TIME_24_WITH_SECONDS(){return es}static get TIME_24_WITH_SHORT_OFFSET(){return ts}static get TIME_24_WITH_LONG_OFFSET(){return rs}static get DATETIME_SHORT(){return ns}static get DATETIME_SHORT_WITH_SECONDS(){return ss}static get DATETIME_MED(){return is}static get DATETIME_MED_WITH_SECONDS(){return os}static get DATETIME_MED_WITH_WEEKDAY(){return ea}static get DATETIME_FULL(){return as}static get DATETIME_FULL_WITH_SECONDS(){return cs}static get DATETIME_HUGE(){return ls}static get DATETIME_HUGE_WITH_SECONDS(){return us}}function Yt(r){if(U.isDateTime(r))return r;if(r&&r.valueOf&&rt(r.valueOf()))return U.fromJSDate(r);if(r&&typeof r=="object")return U.fromObject(r);throw new be(`Unknown datetime argument: ${r}, of type ${typeof r}`)}const an={};let cn;const Yc=new Uint8Array(16),ye=[];for(let r=0;r<256;++r)ye.push((r+256).toString(16).slice(1));function Kc(r,e,t){return r.msecs??=-1/0,r.seq??=0,e>r.msecs?(r.seq=t[6]<<23|t[7]<<16|t[8]<<8|t[9],r.msecs=e):(r.seq=Math.trunc(r.seq+1),r.seq===0&&r.msecs++),r}function Qc(r,e,t,n,s=0){return n||(n=new Uint8Array(16),s=0),e??=Date.now(),t??=r[6]*127<<24|r[7]<<16|r[8]<<8|r[9],n[s++]=e/1099511627776&255,n[s++]=e/4294967296&255,n[s++]=e/16777216&255,n[s++]=e/65536&255,n[s++]=e/256&255,n[s++]=e&255,n[s++]=112|t>>>28&15,n[s++]=t>>>20&255,n[s++]=128|t>>>14&63,n[s++]=t>>>6&255,n[s++]=t<<2&255|r[10]&3,n[s++]=r[11],n[s++]=r[12],n[s++]=r[13],n[s++]=r[14],n[s++]=r[15],n}function Xc(r,e=0){return(ye[r[e]]+ye[r[e+1]]+ye[r[e+2]]+ye[r[e+3]]+"-"+ye[r[e+4]]+ye[r[e+5]]+"-"+ye[r[e+6]]+ye[r[e+7]]+"-"+ye[r[e+8]]+ye[r[e+9]]+"-"+ye[r[e+10]]+ye[r[e+11]]+ye[r[e+12]]+ye[r[e+13]]+ye[r[e+14]]+ye[r[e+15]]).toLowerCase()}function el(){const r=Date.now();if(!cn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported.");cn=crypto.getRandomValues.bind(crypto)}const e=cn(Yc);Kc(an,r,e);const t=Qc(e,an.msecs,an.seq,void 0,void 0);return Xc(t)}const tl=/[&<>'"]/g,rl=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g,nl={"&":"&","<":"<",">":">","'":"'",'"':"""},sl={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","&apos":"'","'":"'",""":'"',""":'"'};class il{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 el()}encode(e){return L.isString(e)?e.replace(tl,t=>nl[t]):e}decode(e){return L.isString(e)?e.replace(rl,t=>sl[t]):e}toNumber(e){const t=Number.parseFloat(e);return L.isNumber(t)?t:0}toInteger(e){return this.toNumber(Number.parseInt(e,10))}toBoolean(e,t=[]){const n=L.isString(e)?e.toLowerCase():e;return["true","y","1",1,!0,...t].includes(n)}toCamelCase(e){if(!L.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 L.isStringFilled(e)?this.capitalize(this.toCamelCase(e)):e}toKebabCase(e){if(!L.isStringFilled(e))return e;const t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[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 L.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")&&L.isStringFilled(t)?U.fromFormat(e,t,n):U.fromISO(e,n)}getDateForLog(){return U.now().toFormat("y-MM-dd HH:mm:ss")}buildQueryString(e){let t="";for(const n in e){if(!e.hasOwnProperty(n))continue;const s=e[n];L.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 il;let me="";try{me=navigator?.userAgent.toLowerCase()}catch{me="?"}let ol=class{isOpera(){return me.includes("opera")}isIE(){return"attachEvent"in document&&!this.isOpera()}isIE6(){return me.includes("msie 6")}isIE7(){return me.includes("msie 7")}isIE8(){return me.includes("msie 8")}isIE9(){return"documentMode"in document&&document.documentMode>=9}isIE10(){return"documentMode"in document&&document.documentMode>=10}isSafari(){return me.includes("safari")&&!me.includes("chrome")}isFirefox(){return me.includes("firefox")}isChrome(){return me.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);L.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);L.isArrayLike(n)&&n.length>0&&(e=Number.parseFloat(n[1]))}}}return e}isIE11(){return this.detectIEVersion()>=11}isMac(){return me.includes("macintosh")}isWin(){return me.includes("windows")}isLinux(){return me.includes("linux")&&!this.isAndroid()}isAndroid(){return me.includes("android")}isIPad(){return me.includes("ipad;")||this.isMac()&&this.isTouchDevice()}isIPhone(){return me.includes("iphone;")}isIOS(){return this.isIPad()||this.isIPhone()}isMobile(){return this.isIPhone()||this.isIPad()||this.isAndroid()||me.includes("mobile")||me.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(L.isArrayLike(t)&&t.length>0)return Number.parseFloat(t[1])}return 0}};const _i=new ol,vi={sleep:1e3,speed:.001,amount:30},ln={sleep:600,speed:.01,amount:30*5};var ki=(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))(ki||{}),Ei=(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))(Ei||{}),ee=(r=>(r.App="app",r.Profile="profile",r.Currency="currency",r.AppOptions="appOptions",r.UserOptions="userOptions",r))(ee||{});const pt={Free:"F",Demo:"D",Trial:"T",Paid:"P",Local:"L",Subscription:"S"},Ti={[pt.Free]:"Free",[pt.Demo]:"Demo",[pt.Trial]:"Trial",[pt.Paid]:"Paid",[pt.Local]:"Local",[pt.Subscription]:"Subscription"},mt={MainSettings:"MainSettings",UfList:"UfList",UfPage:"UfPage"};var Ye=(r=>(r.NotSet="notSet",r.JsonArray="jsonArray",r.JsonObject="jsonObject",r.FloatVal="float",r.IntegerVal="integer",r.BoolYN="boolYN",r.StringVal="string",r))(Ye||{}),te=(r=>(r.Undefined="undefined",r.WebSocket="webSocket",r.LongPolling="longPolling",r))(te||{}),Re=(r=>(r.PullConfig="bx-pull-config",r.WebsocketBlocked="bx-pull-websocket-blocked",r.LongPollingBlocked="bx-pull-longpolling-blocked",r.LoggingEnabled="bx-pull-logging-enabled",r))(Re||{}),Le=(r=>(r.Online="online",r.Offline="offline",r.Connecting="connect",r))(Le||{}),Tr=(r=>(r[r.Unknown=0]="Unknown",r[r.Client=1]="Client",r[r.Backend=2]="Backend",r))(Tr||{}),Fe=(r=>(r.Server="server",r.Client="client",r.Online="online",r.Status="status",r.Revision="revision",r))(Fe||{}),_e=(r=>(r[r.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",r[r.SERVER_DIE=1001]="SERVER_DIE",r[r.CONFIG_REPLACED=3e3]="CONFIG_REPLACED",r[r.CHANNEL_EXPIRED=3001]="CHANNEL_EXPIRED",r[r.SERVER_RESTARTED=3002]="SERVER_RESTARTED",r[r.CONFIG_EXPIRED=3003]="CONFIG_EXPIRED",r[r.MANUAL=3004]="MANUAL",r[r.STUCK=3005]="STUCK",r[r.WRONG_CHANNEL_ID=4010]="WRONG_CHANNEL_ID",r))(_e||{}),Kt=(r=>(r.CHANNEL_EXPIRE="CHANNEL_EXPIRE",r.CONFIG_EXPIRE="CONFIG_EXPIRE",r.SERVER_RESTART="SERVER_RESTART",r))(Kt||{}),un=(r=>(r.Shared="shared",r.Personal="personal",r))(un||{});const hn={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 He=(r=>(r.Publish="publish",r.GetUsersLastSeen="getUsersLastSeen",r.Ping="ping",r.ListChannels="listChannels",r.SubscribeStatusChange="subscribeStatusChange",r.UnsubscribeStatusChange="unsubscribeStatusChange",r))(He||{});class Pt{_errorCollection;_data;constructor(){this._errorCollection=new Set,this._data=null}get isSuccess(){return this._errorCollection.size===0}setData(e){return this._data=e,this}getData(){return this._data}addError(e){return e instanceof Error?this._errorCollection.add(e):this._errorCollection.add(new Error(e.toString())),this}addErrors(e){for(const t of e)t instanceof Error?this._errorCollection.add(t):this._errorCollection.add(new Error(t.toString()));return this}getErrors(){return this._errorCollection.values()}getErrorMessages(){return[...this.getErrors()].map(e=>e.message)}toString(){return this.isSuccess?`Result (success): data: ${JSON.stringify(this._data)}`:`Result (failure): errors: ${this.getErrorMessages().join(", ")}`}}class Qt extends Error{cause;_status;_answerError;constructor(e){const t=`${e.answerError.error}${e.answerError.errorDescription?": "+e.answerError.errorDescription:""}`;super(t),this.cause=e.cause||null,this.name=this.constructor.name,this._status=e.status,this._answerError=e.answerError}get answerError(){return this._answerError}get status(){return this._status}set status(e){this._status=e}toString(){return`${this.answerError.error}${this.answerError.errorDescription?": "+this.answerError.errorDescription:""} (${this.status})`}}class fn extends Pt{_status;_query;_data;constructor(e,t,n){if(super(),this._data=e,this._query=structuredClone(t),this._status=n,typeof this._data.error<"u"){const s=typeof this._data.error=="string"?this._data:this._data.error;this.addError(new Qt({status:this._status,answerError:{error:s.error||"",errorDescription:s.error_description||""}}))}}setData(e){throw new Error("AjaxResult not support setData()")}getData(){return this._data}isMore(){return L.isNumber(this._data?.next)}getTotal(){return W.toInteger(this._data?.total)}getStatus(){return this._status}getQuery(){return this._query}async getNext(e){return this.isMore()&&this.isSuccess?(this._query.start=Number.parseInt(this._data?.next),e.call(this._query.method,this._query.params,this._query.start)):Promise.resolve(!1)}}let al=class{#e;#t;#r;_logger=null;constructor(){this.#e=vi,this.#r=0,this.#t=0}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Ee.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.#r.toFixed(4)} from ${this.#e.amount}`}#s(){this.#t>0&&(this.#r-=(Date.now()-this.#t)*this.#e.speed,this.#r<0&&(this.#r=0)),this.#t=Date.now()}#o(){this.#r++}#i(){return this.#r<this.#e.amount}};const cl="X-Request-ID",ll="bx24_request_id",ul="bx24_sdk_ver";let hl=class{getQueryStringParameterName(){return ll}getQueryStringSdkParameterName(){return ul}generate(){return W.getUuidRfc4122()}getRequestId(){return this.generate()}getHeaderFieldName(){return cl}};function Oi(r,e){return function(){return r.apply(e,arguments)}}const{toString:fl}=Object.prototype,{getPrototypeOf:dn}=Object,Or=(r=>e=>{const t=fl.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ve=r=>(r=r.toLowerCase(),e=>Or(e)===r),Ar=r=>e=>typeof e===r,{isArray:Mt}=Array,Xt=Ar("undefined");function dl(r){return r!==null&&!Xt(r)&&r.constructor!==null&&!Xt(r.constructor)&&Pe(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const Ai=Ve("ArrayBuffer");function pl(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Ai(r.buffer),e}const ml=Ar("string"),Pe=Ar("function"),Ii=Ar("number"),Ir=r=>r!==null&&typeof r=="object",gl=r=>r===!0||r===!1,Cr=r=>{if(Or(r)!=="object")return!1;const e=dn(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},yl=Ve("Date"),wl=Ve("File"),bl=Ve("Blob"),Sl=Ve("FileList"),_l=r=>Ir(r)&&Pe(r.pipe),vl=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Pe(r.append)&&((e=Or(r))==="formdata"||e==="object"&&Pe(r.toString)&&r.toString()==="[object FormData]"))},kl=Ve("URLSearchParams"),[El,Tl,Ol,Al]=["ReadableStream","Request","Response","Headers"].map(Ve),Il=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function er(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 Ci(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 gt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ni=r=>!Xt(r)&&r!==gt;function pn(){const{caseless:r}=Ni(this)&&this||{},e={},t=(n,s)=>{const i=r&&Ci(e,s)||s;Cr(e[i])&&Cr(n)?e[i]=pn(e[i],n):Cr(n)?e[i]=pn({},n):Mt(n)?e[i]=n.slice():e[i]=n};for(let n=0,s=arguments.length;n<s;n++)arguments[n]&&er(arguments[n],t);return e}const Cl=(r,e,t,{allOwnKeys:n}={})=>(er(e,(s,i)=>{t&&Pe(s)?r[i]=Oi(s,t):r[i]=s},{allOwnKeys:n}),r),Nl=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Rl=(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)},Ll=(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&&dn(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},Fl=(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},Pl=r=>{if(!r)return null;if(Mt(r))return r;let e=r.length;if(!Ii(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},Ml=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&dn(Uint8Array)),xl=(r,e)=>{const n=(r&&r[Symbol.iterator]).call(r);let s;for(;(s=n.next())&&!s.done;){const i=s.value;e.call(r,i[0],i[1])}},Dl=(r,e)=>{let t;const n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},jl=Ve("HTMLFormElement"),Ul=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,s){return n.toUpperCase()+s}),Ri=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),Bl=Ve("RegExp"),Li=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),n={};er(t,(s,i)=>{let o;(o=e(s,i,r))!==!1&&(n[i]=o||s)}),Object.defineProperties(r,n)},$l=r=>{Li(r,(e,t)=>{if(Pe(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=r[t];if(Pe(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+"'")})}})},Wl=(r,e)=>{const t={},n=s=>{s.forEach(i=>{t[i]=!0})};return Mt(r)?n(r):n(String(r).split(e)),t},Vl=()=>{},Hl=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,mn="abcdefghijklmnopqrstuvwxyz",Fi="0123456789",Pi={DIGIT:Fi,ALPHA:mn,ALPHA_DIGIT:mn+mn.toUpperCase()+Fi},ql=(r=16,e=Pi.ALPHA_DIGIT)=>{let t="";const{length:n}=e;for(;r--;)t+=e[Math.random()*n|0];return t};function zl(r){return!!(r&&Pe(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}const Jl=r=>{const e=new Array(10),t=(n,s)=>{if(Ir(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[s]=n;const i=Mt(n)?[]:{};return er(n,(o,c)=>{const a=t(o,s+1);!Xt(a)&&(i[c]=a)}),e[s]=void 0,i}}return n};return t(r,0)},Zl=Ve("AsyncFunction"),Gl=r=>r&&(Ir(r)||Pe(r))&&Pe(r.then)&&Pe(r.catch),Mi=((r,e)=>r?setImmediate:e?((t,n)=>(gt.addEventListener("message",({source:s,data:i})=>{s===gt&&i===t&&n.length&&n.shift()()},!1),s=>{n.push(s),gt.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Pe(gt.postMessage)),Yl=typeof queueMicrotask<"u"?queueMicrotask.bind(gt):typeof process<"u"&&process.nextTick||Mi,v={isArray:Mt,isArrayBuffer:Ai,isBuffer:dl,isFormData:vl,isArrayBufferView:pl,isString:ml,isNumber:Ii,isBoolean:gl,isObject:Ir,isPlainObject:Cr,isReadableStream:El,isRequest:Tl,isResponse:Ol,isHeaders:Al,isUndefined:Xt,isDate:yl,isFile:wl,isBlob:bl,isRegExp:Bl,isFunction:Pe,isStream:_l,isURLSearchParams:kl,isTypedArray:Ml,isFileList:Sl,forEach:er,merge:pn,extend:Cl,trim:Il,stripBOM:Nl,inherits:Rl,toFlatObject:Ll,kindOf:Or,kindOfTest:Ve,endsWith:Fl,toArray:Pl,forEachEntry:xl,matchAll:Dl,isHTMLForm:jl,hasOwnProperty:Ri,hasOwnProp:Ri,reduceDescriptors:Li,freezeMethods:$l,toObjectSet:Wl,toCamelCase:Ul,noop:Vl,toFiniteNumber:Hl,findKey:Ci,global:gt,isContextDefined:Ni,ALPHABET:Pi,generateString:ql,isSpecCompliantForm:zl,toJSONObject:Jl,isAsyncFn:Zl,isThenable:Gl,setImmediate:Mi,asap:Yl};function H(r,e,t,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),s&&(this.response=s,this.status=s.status?s.status:null)}v.inherits(H,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:v.toJSONObject(this.config),code:this.code,status:this.status}}});const xi=H.prototype,Di={};["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=>{Di[r]={value:r}}),Object.defineProperties(H,Di),Object.defineProperty(xi,"isAxiosError",{value:!0}),H.from=(r,e,t,n,s,i)=>{const o=Object.create(xi);return v.toFlatObject(r,o,function(a){return a!==Error.prototype},c=>c!=="isAxiosError"),H.call(o,r.message,e,t,n,s),o.cause=r,o.name=r.name,i&&Object.assign(o,i),o};const Kl=null;function gn(r){return v.isPlainObject(r)||v.isArray(r)}function ji(r){return v.endsWith(r,"[]")?r.slice(0,-2):r}function Ui(r,e,t){return r?r.concat(e).map(function(s,i){return s=ji(s),!t&&i?"["+s+"]":s}).join(t?".":""):e}function Ql(r){return v.isArray(r)&&!r.some(gn)}const Xl=v.toFlatObject(v,{},null,function(e){return/^is[A-Z]/.test(e)});function Nr(r,e,t){if(!v.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=v.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,g){return!v.isUndefined(g[m])});const n=t.metaTokens,s=t.visitor||l,i=t.dots,o=t.indexes,a=(t.Blob||typeof Blob<"u"&&Blob)&&v.isSpecCompliantForm(e);if(!v.isFunction(s))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(v.isDate(p))return p.toISOString();if(!a&&v.isBlob(p))throw new H("Blob is not supported. Use a Buffer instead.");return v.isArrayBuffer(p)||v.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(v.endsWith(m,"{}"))m=n?m:m.slice(0,-2),p=JSON.stringify(p);else if(v.isArray(p)&&Ql(p)||(v.isFileList(p)||v.endsWith(m,"[]"))&&(y=v.toArray(p)))return m=ji(m),y.forEach(function(_,b){!(v.isUndefined(_)||_===null)&&e.append(o===!0?Ui([m],b,i):o===null?m:m+"[]",u(_))}),!1}return gn(p)?!0:(e.append(Ui(g,m,i),u(p)),!1)}const h=[],f=Object.assign(Xl,{defaultVisitor:l,convertValue:u,isVisitable:gn});function d(p,m){if(!v.isUndefined(p)){if(h.indexOf(p)!==-1)throw Error("Circular reference detected in "+m.join("."));h.push(p),v.forEach(p,function(y,w){(!(v.isUndefined(y)||y===null)&&s.call(e,y,v.isString(w)?w.trim():w,m,f))===!0&&d(y,m?m.concat(w):[w])}),h.pop()}}if(!v.isObject(r))throw new TypeError("data must be an object");return d(r),e}function Bi(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function yn(r,e){this._pairs=[],r&&Nr(r,this,e)}const $i=yn.prototype;$i.append=function(e,t){this._pairs.push([e,t])},$i.toString=function(e){const t=e?function(n){return e.call(this,n,Bi)}:Bi;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};function eu(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Wi(r,e,t){if(!e)return r;const n=t&&t.encode||eu,s=t&&t.serialize;let i;if(s?i=s(e,t):i=v.isURLSearchParams(e)?e.toString():new yn(e,t).toString(n),i){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+i}return r}class Vi{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){v.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Hi={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},tu={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:yn,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},wn=typeof window<"u"&&typeof document<"u",bn=typeof navigator=="object"&&navigator||void 0,ru=wn&&(!bn||["ReactNative","NativeScript","NS"].indexOf(bn.product)<0),nu=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",su=wn&&window.location.href||"http://localhost",Oe={...{__proto__:null,hasBrowserEnv:wn,hasStandardBrowserEnv:ru,hasStandardBrowserWebWorkerEnv:nu,navigator:bn,origin:su},...tu};function iu(r,e){return Nr(r,new Oe.classes.URLSearchParams,Object.assign({visitor:function(t,n,s,i){return Oe.isNode&&v.isBuffer(t)?(this.append(n,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function ou(r){return v.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function au(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 qi(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&&v.isArray(s)?s.length:o,a?(v.hasOwnProp(s,o)?s[o]=[s[o],n]:s[o]=n,!c):((!s[o]||!v.isObject(s[o]))&&(s[o]=[]),e(t,n,s[o],i)&&v.isArray(s[o])&&(s[o]=au(s[o])),!c)}if(v.isFormData(r)&&v.isFunction(r.entries)){const t={};return v.forEachEntry(r,(n,s)=>{e(ou(n),s,t,0)}),t}return null}function cu(r,e,t){if(v.isString(r))try{return(e||JSON.parse)(r),v.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}const tr={transitional:Hi,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",s=n.indexOf("application/json")>-1,i=v.isObject(e);if(i&&v.isHTMLForm(e)&&(e=new FormData(e)),v.isFormData(e))return s?JSON.stringify(qi(e)):e;if(v.isArrayBuffer(e)||v.isBuffer(e)||v.isStream(e)||v.isFile(e)||v.isBlob(e)||v.isReadableStream(e))return e;if(v.isArrayBufferView(e))return e.buffer;if(v.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 iu(e,this.formSerializer).toString();if((c=v.isFileList(e))||n.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Nr(c?{"files[]":e}:e,a&&new a,this.formSerializer)}}return i||s?(t.setContentType("application/json",!1),cu(e)):e}],transformResponse:[function(e){const t=this.transitional||tr.transitional,n=t&&t.forcedJSONParsing,s=this.responseType==="json";if(v.isResponse(e)||v.isReadableStream(e))return e;if(e&&v.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"?H.from(c,H.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:Oe.classes.FormData,Blob:Oe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};v.forEach(["delete","get","head","post","put","patch"],r=>{tr.headers[r]={}});const lu=v.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"]),uu=r=>{const e={};let t,n,s;return r&&r.split(`
|
|
2
|
+
`).forEach(function(o){s=o.indexOf(":"),t=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!t||e[t]&&lu[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e},zi=Symbol("internals");function rr(r){return r&&String(r).trim().toLowerCase()}function Rr(r){return r===!1||r==null?r:v.isArray(r)?r.map(Rr):String(r)}function hu(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 fu=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function Sn(r,e,t,n,s){if(v.isFunction(n))return n.call(this,e,t);if(s&&(e=t),!!v.isString(e)){if(v.isString(n))return e.indexOf(n)!==-1;if(v.isRegExp(n))return n.test(e)}}function du(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function pu(r,e){const t=v.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{value:function(s,i,o){return this[n].call(this,e,s,i,o)},configurable:!0})})}let Ae=class{constructor(e){e&&this.set(e)}set(e,t,n){const s=this;function i(c,a,u){const l=rr(a);if(!l)throw new Error("header name must be a non-empty string");const h=v.findKey(s,l);(!h||s[h]===void 0||u===!0||u===void 0&&s[h]!==!1)&&(s[h||a]=Rr(c))}const o=(c,a)=>v.forEach(c,(u,l)=>i(u,l,a));if(v.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(v.isString(e)&&(e=e.trim())&&!fu(e))o(uu(e),t);else if(v.isHeaders(e))for(const[c,a]of e.entries())i(a,c,n);else e!=null&&i(t,e,n);return this}get(e,t){if(e=rr(e),e){const n=v.findKey(this,e);if(n){const s=this[n];if(!t)return s;if(t===!0)return hu(s);if(v.isFunction(t))return t.call(this,s,n);if(v.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=rr(e),e){const n=v.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||Sn(this,this[n],n,t)))}return!1}delete(e,t){const n=this;let s=!1;function i(o){if(o=rr(o),o){const c=v.findKey(n,o);c&&(!t||Sn(n,n[c],c,t))&&(delete n[c],s=!0)}}return v.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||Sn(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const t=this,n={};return v.forEach(this,(s,i)=>{const o=v.findKey(n,i);if(o){t[o]=Rr(s),delete t[i];return}const c=e?du(i):String(i).trim();c!==i&&delete t[i],t[c]=Rr(s),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return v.forEach(this,(n,s)=>{n!=null&&n!==!1&&(t[s]=e&&v.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
3
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[zi]=this[zi]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=rr(o);n[c]||(pu(s,o),n[c]=!0)}return v.isArray(e)?e.forEach(i):i(e),this}};Ae.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),v.reduceDescriptors(Ae.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}}),v.freezeMethods(Ae);function _n(r,e){const t=this||tr,n=e||t,s=Ae.from(n.headers);let i=n.data;return v.forEach(r,function(c){i=c.call(t,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function Ji(r){return!!(r&&r.__CANCEL__)}function xt(r,e,t){H.call(this,r??"canceled",H.ERR_CANCELED,e,t),this.name="CanceledError"}v.inherits(xt,H,{__CANCEL__:!0});function Zi(r,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new H("Request failed with status code "+t.status,[H.ERR_BAD_REQUEST,H.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function mu(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function gu(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 h=i,f=0;for(;h!==s;)f+=t[h++],h=h%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(f*1e3/d):void 0}}function yu(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(),h=l-t;h>=n?o(u,l):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},n-h)))},()=>s&&o(s)]}const Lr=(r,e,t=3)=>{let n=0;const s=gu(50,250);return yu(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,a=o-n,u=s(a),l=o<=c;n=o;const h={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(h)},t)},Gi=(r,e)=>{const t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},Yi=r=>(...e)=>v.asap(()=>r(...e)),wu=Oe.hasStandardBrowserEnv?function(){const e=Oe.navigator&&/(msie|trident)/i.test(Oe.navigator.userAgent),t=document.createElement("a");let n;function s(i){let o=i;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return n=s(window.location.href),function(o){const c=v.isString(o)?s(o):o;return c.protocol===n.protocol&&c.host===n.host}}():function(){return function(){return!0}}(),bu=Oe.hasStandardBrowserEnv?{write(r,e,t,n,s,i){const o=[r+"="+encodeURIComponent(e)];v.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),v.isString(n)&&o.push("path="+n),v.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 Su(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function _u(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function Ki(r,e){return r&&!Su(e)?_u(r,e):e}const Qi=r=>r instanceof Ae?{...r}:r;function yt(r,e){e=e||{};const t={};function n(u,l,h){return v.isPlainObject(u)&&v.isPlainObject(l)?v.merge.call({caseless:h},u,l):v.isPlainObject(l)?v.merge({},l):v.isArray(l)?l.slice():l}function s(u,l,h){if(v.isUndefined(l)){if(!v.isUndefined(u))return n(void 0,u,h)}else return n(u,l,h)}function i(u,l){if(!v.isUndefined(l))return n(void 0,l)}function o(u,l){if(v.isUndefined(l)){if(!v.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function c(u,l,h){if(h in e)return n(u,l);if(h 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)=>s(Qi(u),Qi(l),!0)};return v.forEach(Object.keys(Object.assign({},r,e)),function(l){const h=a[l]||s,f=h(r[l],e[l],l);v.isUndefined(f)&&h!==c||(t[l]=f)}),t}const Xi=r=>{const e=yt({},r);let{data:t,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=e;e.headers=o=Ae.from(o),e.url=Wi(Ki(e.baseURL,e.url),r.params,r.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let a;if(v.isFormData(t)){if(Oe.hasStandardBrowserEnv||Oe.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((a=o.getContentType())!==!1){const[u,...l]=a?a.split(";").map(h=>h.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...l].join("; "))}}if(Oe.hasStandardBrowserEnv&&(n&&v.isFunction(n)&&(n=n(e)),n||n!==!1&&wu(e.url))){const u=s&&i&&bu.read(i);u&&o.set(s,u)}return e},vu=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(t,n){const s=Xi(r);let i=s.data;const o=Ae.from(s.headers).normalize();let{responseType:c,onUploadProgress:a,onDownloadProgress:u}=s,l,h,f,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 _=Ae.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),k={data:!c||c==="text"||c==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:_,config:r,request:g};Zi(function(E){t(E),m()},function(E){n(E),m()},k),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 H("Request aborted",H.ECONNABORTED,r,g)),g=null)},g.onerror=function(){n(new H("Network Error",H.ERR_NETWORK,r,g)),g=null},g.ontimeout=function(){let b=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const k=s.transitional||Hi;s.timeoutErrorMessage&&(b=s.timeoutErrorMessage),n(new H(b,k.clarifyTimeoutError?H.ETIMEDOUT:H.ECONNABORTED,r,g)),g=null},i===void 0&&o.setContentType(null),"setRequestHeader"in g&&v.forEach(o.toJSON(),function(b,k){g.setRequestHeader(k,b)}),v.isUndefined(s.withCredentials)||(g.withCredentials=!!s.withCredentials),c&&c!=="json"&&(g.responseType=s.responseType),u&&([f,p]=Lr(u,!0),g.addEventListener("progress",f)),a&&g.upload&&([h,d]=Lr(a),g.upload.addEventListener("progress",h),g.upload.addEventListener("loadend",d)),(s.cancelToken||s.signal)&&(l=_=>{g&&(n(!_||_.type?new xt(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=mu(s.url);if(w&&Oe.protocols.indexOf(w)===-1){n(new H("Unsupported protocol "+w+":",H.ERR_BAD_REQUEST,r));return}g.send(i||null)})},ku=(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 H?l:new xt(l instanceof Error?l.message:l))}};let o=e&&setTimeout(()=>{o=null,i(new H(`timeout ${e} of ms exceeded`,H.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=()=>v.asap(c),a}},Eu=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},Tu=async function*(r,e){for await(const t of Ou(r))yield*Eu(t,e)},Ou=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()}},eo=(r,e,t,n)=>{const s=Tu(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 h=l.byteLength;if(t){let f=i+=h;t(f)}a.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(a){return c(a),s.return()}},{highWaterMark:2})},Fr=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",to=Fr&&typeof ReadableStream=="function",Au=Fr&&(typeof TextEncoder=="function"?(r=>e=>r.encode(e))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),ro=(r,...e)=>{try{return!!r(...e)}catch{return!1}},Iu=to&&ro(()=>{let r=!1;const e=new Request(Oe.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!e}),no=64*1024,vn=to&&ro(()=>v.isReadableStream(new Response("").body)),Pr={stream:vn&&(r=>r.body)};Fr&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Pr[e]&&(Pr[e]=v.isFunction(r[e])?t=>t[e]():(t,n)=>{throw new H(`Response type '${e}' is not supported`,H.ERR_NOT_SUPPORT,n)})})})(new Response);const Cu=async r=>{if(r==null)return 0;if(v.isBlob(r))return r.size;if(v.isSpecCompliantForm(r))return(await new Request(Oe.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(v.isArrayBufferView(r)||v.isArrayBuffer(r))return r.byteLength;if(v.isURLSearchParams(r)&&(r=r+""),v.isString(r))return(await Au(r)).byteLength},Nu=async(r,e)=>{const t=v.toFiniteNumber(r.getContentLength());return t??Cu(e)},kn={http:Kl,xhr:vu,fetch:Fr&&(async r=>{let{url:e,method:t,data:n,signal:s,cancelToken:i,timeout:o,onDownloadProgress:c,onUploadProgress:a,responseType:u,headers:l,withCredentials:h="same-origin",fetchOptions:f}=Xi(r);u=u?(u+"").toLowerCase():"text";let d=ku([s,i&&i.toAbortSignal()],o),p;const m=d&&d.unsubscribe&&(()=>{d.unsubscribe()});let g;try{if(a&&Iu&&t!=="get"&&t!=="head"&&(g=await Nu(l,n))!==0){let k=new Request(e,{method:"POST",body:n,duplex:"half"}),S;if(v.isFormData(n)&&(S=k.headers.get("content-type"))&&l.setContentType(S),k.body){const[E,N]=Gi(g,Lr(Yi(a)));n=eo(k.body,no,E,N)}}v.isString(h)||(h=h?"include":"omit");const y="credentials"in Request.prototype;p=new Request(e,{...f,signal:d,method:t.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:y?h:void 0});let w=await fetch(p);const _=vn&&(u==="stream"||u==="response");if(vn&&(c||_&&m)){const k={};["status","statusText","headers"].forEach(x=>{k[x]=w[x]});const S=v.toFiniteNumber(w.headers.get("content-length")),[E,N]=c&&Gi(S,Lr(Yi(c),!0))||[];w=new Response(eo(w.body,no,E,()=>{N&&N(),m&&m()}),k)}u=u||"text";let b=await Pr[v.findKey(Pr,u)||"text"](w,r);return!_&&m&&m(),await new Promise((k,S)=>{Zi(k,S,{data:b,headers:Ae.from(w.headers),status:w.status,statusText:w.statusText,config:r,request:p})})}catch(y){throw m&&m(),y&&y.name==="TypeError"&&/fetch/i.test(y.message)?Object.assign(new H("Network Error",H.ERR_NETWORK,r,p),{cause:y.cause||y}):H.from(y,y&&y.code,r,p)}})};v.forEach(kn,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const so=r=>`- ${r}`,Ru=r=>v.isFunction(r)||r===null||r===!1,io={getAdapter:r=>{r=v.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,!Ru(t)&&(n=kn[(o=String(t)).toLowerCase()],n===void 0))throw new H(`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 :
|
|
4
|
+
`+i.map(so).join(`
|
|
5
|
+
`):" "+so(i[0]):"as no adapter specified";throw new H("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:kn};function En(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new xt(null,r)}function oo(r){return En(r),r.headers=Ae.from(r.headers),r.data=_n.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),io.getAdapter(r.adapter||tr.adapter)(r).then(function(n){return En(r),n.data=_n.call(r,r.transformResponse,n),n.headers=Ae.from(n.headers),n},function(n){return Ji(n)||(En(r),n&&n.response&&(n.response.data=_n.call(r,r.transformResponse,n.response),n.response.headers=Ae.from(n.response.headers))),Promise.reject(n)})}const ao="1.7.7",Tn={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{Tn[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});const co={};Tn.transitional=function(e,t,n){function s(i,o){return"[Axios v"+ao+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,c)=>{if(e===!1)throw new H(s(o," has been removed"+(t?" in "+t:"")),H.ERR_DEPRECATED);return t&&!co[o]&&(co[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}};function Lu(r,e,t){if(typeof r!="object")throw new H("options must be an object",H.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 H("option "+i+" must be "+a,H.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new H("Unknown option "+i,H.ERR_BAD_OPTION)}}const On={assertOptions:Lu,validators:Tn},it=On.validators;let wt=class{constructor(e){this.defaults=e,this.interceptors={request:new Vi,response:new Vi}}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+=`
|
|
6
|
+
`+i):n.stack=i}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=yt(this.defaults,t);const{transitional:n,paramsSerializer:s,headers:i}=t;n!==void 0&&On.assertOptions(n,{silentJSONParsing:it.transitional(it.boolean),forcedJSONParsing:it.transitional(it.boolean),clarifyTimeoutError:it.transitional(it.boolean)},!1),s!=null&&(v.isFunction(s)?t.paramsSerializer={serialize:s}:On.assertOptions(s,{encode:it.function,serialize:it.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&v.merge(i.common,i[t.method]);i&&v.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),t.headers=Ae.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,h=0,f;if(!a){const p=[oo.bind(this),void 0];for(p.unshift.apply(p,c),p.push.apply(p,u),f=p.length,l=Promise.resolve(t);h<f;)l=l.then(p[h++],p[h++]);return l}f=c.length;let d=t;for(h=0;h<f;){const p=c[h++],m=c[h++];try{d=p(d)}catch(g){m.call(this,g);break}}try{l=oo.call(this,d)}catch(p){return Promise.reject(p)}for(h=0,f=u.length;h<f;)l=l.then(u[h++],u[h++]);return l}getUri(e){e=yt(this.defaults,e);const t=Ki(e.baseURL,e.url);return Wi(t,e.params,e.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(e){wt.prototype[e]=function(t,n){return this.request(yt(n||{},{method:e,url:t,data:(n||{}).data}))}}),v.forEach(["post","put","patch"],function(e){function t(n){return function(i,o,c){return this.request(yt(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}wt.prototype[e]=t(),wt.prototype[e+"Form"]=t(!0)});let Fu=class Jo{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 xt(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 Jo(function(s){e=s}),cancel:e}}};function Pu(r){return function(t){return r.apply(null,t)}}function Mu(r){return v.isObject(r)&&r.isAxiosError===!0}const An={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(An).forEach(([r,e])=>{An[e]=r});function lo(r){const e=new wt(r),t=Oi(wt.prototype.request,e);return v.extend(t,wt.prototype,e,{allOwnKeys:!0}),v.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return lo(yt(r,s))},t}const ae=lo(tr);ae.Axios=wt,ae.CanceledError=xt,ae.CancelToken=Fu,ae.isCancel=Ji,ae.VERSION=ao,ae.toFormData=Nr,ae.AxiosError=H,ae.Cancel=ae.CanceledError,ae.all=function(e){return Promise.all(e)},ae.spread=Pu,ae.isAxiosError=Mu,ae.mergeConfig=yt,ae.AxiosHeaders=Ae,ae.formToJSON=r=>qi(v.isHTMLForm(r)?new FormData(r):r),ae.getAdapter=io.getAdapter,ae.HttpStatusCode=An,ae.default=ae;const{Axios:af,AxiosError:uo,CanceledError:cf,isCancel:lf,CancelToken:uf,VERSION:hf,all:ff,Cancel:df,isAxiosError:pf,spread:mf,toFormData:gf,AxiosHeaders:yf,HttpStatusCode:wf,formToJSON:bf,getAdapter:Sf,mergeConfig:_f}=ae,xu=String.prototype.replace,Du=/%20/g,ho={RFC1738:"RFC1738",RFC3986:"RFC3986"},In={RFC1738:function(r){return xu.call(r,Du,"+")},RFC3986:function(r){return String(r)}},ju=ho.RFC1738,fo=ho.RFC3986,Cn=Object.prototype.hasOwnProperty,bt=Array.isArray,qe=function(){const r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Uu=function(e){for(;e.length>1;){const t=e.pop(),n=t.obj[t.prop];if(bt(n)){const s=[];for(let i=0;i<n.length;++i)typeof n[i]<"u"&&s.push(n[i]);t.obj[t.prop]=s}}},Bu=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},$u=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(bt(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!Cn.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 bt(e)&&!bt(t)&&(s=Bu(e,n)),bt(e)&&bt(t)?(t.forEach(function(i,o){if(Cn.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 Cn.call(i,o)?i[o]=r(i[o],c,n):i[o]=c,i},s)},Wu=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}},Nn=1024,Vu=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+=Nn){const u=o.length>=Nn?o.slice(a,a+Nn):o,l=[];for(let h=0;h<u.length;++h){let f=u.charCodeAt(h);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||i===ju&&(f===40||f===41)){l[l.length]=u.charAt(h);continue}if(f<128){l[l.length]=qe[f];continue}if(f<2048){l[l.length]=qe[192|f>>6]+qe[128|f&63];continue}if(f<55296||f>=57344){l[l.length]=qe[224|f>>12]+qe[128|f>>6&63]+qe[128|f&63];continue}h+=1,f=65536+((f&1023)<<10|u.charCodeAt(h)&1023),l[l.length]=qe[240|f>>18]+qe[128|f>>12&63]+qe[128|f>>6&63]+qe[128|f&63]}c+=l.join("")}return c},Hu=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 Uu(t),e},qu=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},zu=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Ju=function(e,t){return[].concat(e,t)},Rn=function(e,t){if(bt(e)){const n=[];for(let s=0;s<e.length;s+=1)n.push(t(e[s]));return n}return t(e)},Zu=Object.prototype.hasOwnProperty,po={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ze=Array.isArray,Gu=Array.prototype.push,mo=function(r,e){Gu.apply(r,ze(e)?e:[e])},Yu=Date.prototype.toISOString,go=fo,fe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Vu,encodeValuesOnly:!1,format:go,formatter:In[go],indices:!1,serializeDate:function(e){return Yu.call(e)},skipNulls:!1,strictNullHandling:!1},Ku=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Ln={},yo=function(e,t,n,s,i,o,c,a,u,l,h,f,d,p,m,g,y,w){let _=e,b=w,k=0,S=!1;for(;(b=b.get(Ln))!==void 0&&!S;){const J=b.get(e);if(k+=1,typeof J<"u"){if(J===k)throw new RangeError("Cyclic object value");S=!0}typeof b.get(Ln)>"u"&&(k=0)}if(typeof l=="function"?_=l(t,_):_ instanceof Date?_=d(_):n==="comma"&&ze(_)&&(_=Rn(_,function(J){return J instanceof Date?d(J):J})),_===null){if(o)return u&&!g?u(t,fe.encoder,y,"key",p):t;_=""}if(Ku(_)||zu(_)){if(u){const J=g?t:u(t,fe.encoder,y,"key",p);return[m(J)+"="+m(u(_,fe.encoder,y,"value",p))]}return[m(t)+"="+m(String(_))]}const E=[];if(typeof _>"u")return E;let N;if(n==="comma"&&ze(_))g&&u&&(_=Rn(_,u)),N=[{value:_.length>0?_.join(",")||null:void 0}];else if(ze(l))N=l;else{const J=Object.keys(_);N=h?J.sort(h):J}const x=a?t.replace(/\./g,"%2E"):t,M=s&&ze(_)&&_.length===1?x+"[]":x;if(i&&ze(_)&&_.length===0)return M+"[]";for(let J=0;J<N.length;++J){const we=N[J],q=typeof we=="object"&&typeof we.value<"u"?we.value:_[we];if(c&&q===null)continue;const Q=f&&a?we.replace(/\./g,"%2E"):we,B=ze(_)?typeof n=="function"?n(M,Q):M:M+(f?"."+Q:"["+Q+"]");w.set(e,k);const de=new WeakMap;de.set(Ln,w),mo(E,yo(q,B,n,s,i,o,c,a,n==="comma"&&g&&ze(_)?null:u,l,h,f,d,p,m,g,y,de))}return E},Qu=function(e){if(!e)return fe;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");const t=e.charset||fe.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=fo;if(typeof e.format<"u"){if(!Zu.call(In,e.format))throw new TypeError("Unknown format option provided.");n=e.format}const s=In[n];let i=fe.filter;(typeof e.filter=="function"||ze(e.filter))&&(i=e.filter);let o;if(e.arrayFormat in po?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=fe.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const c=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:fe.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:fe.addQueryPrefix,allowDots:c,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:fe.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:fe.charsetSentinel,commaRoundTrip:e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?fe.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:fe.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:fe.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:fe.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:fe.encodeValuesOnly,filter:i,format:n,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:fe.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:fe.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:fe.strictNullHandling}};function wo(r,e){let t=r;const n=Qu(e);let s,i;typeof n.filter=="function"?(i=n.filter,t=i("",t)):ze(n.filter)&&(i=n.filter,s=i);const o=[];if(typeof t!="object"||t===null)return"";const c=po[n.arrayFormat],a=c==="comma"&&n.commaRoundTrip;s||(s=Object.keys(t)),n.sort&&s.sort(n.sort);const u=new WeakMap;for(let f=0;f<s.length;++f){const d=s[f];n.skipNulls&&t[d]===null||mo(o,yo(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 h=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),l.length>0?h+l:""}const Fn=Object.prototype.hasOwnProperty,Xu=Array.isArray,ce={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Wu,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},eh=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},bo=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},th="utf8=%26%2310003%3B",rh="utf8=%E2%9C%93",nh=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]===rh?u="utf-8":o[a]===th&&(u="iso-8859-1"),c=a,a=o.length);for(a=0;a<o.length;++a){if(a===c)continue;const l=o[a],h=l.indexOf("]="),f=h===-1?l.indexOf("="):h+1;let d,p;f===-1?(d=t.decoder(l,ce.decoder,u,"key"),p=t.strictNullHandling?null:""):(d=t.decoder(l.slice(0,f),ce.decoder,u,"key"),p=Rn(bo(l.slice(f+1),t),function(g){return t.decoder(g,ce.decoder,u,"value")})),p&&t.interpretNumericEntities&&u==="iso-8859-1"&&(p=eh(p)),l.indexOf("[]=")>-1&&(p=Xu(p)?[p]:p);const m=Fn.call(n,d);m&&t.duplicates==="combine"?n[d]=Ju(n[d],p):(!m||t.duplicates==="last")&&(n[d]=p)}return n},sh=function(r,e,t,n){let s=n?e:bo(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},ih=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 h=0;for(;n.depth>0&&(a=c.exec(i))!==null&&h<n.depth;){if(h+=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)+"]"),sh(l,t,n,s)},oh=function(e){if(!e)return ce;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");const t=typeof e.charset>"u"?ce.charset:e.charset,n=typeof e.duplicates>"u"?ce.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:ce.allowDots:!!e.allowDots,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:ce.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:ce.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:ce.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:ce.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ce.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:ce.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:ce.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:ce.decoder,delimiter:typeof e.delimiter=="string"||qu(e.delimiter)?e.delimiter:ce.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:ce.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:ce.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:ce.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:ce.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ce.strictNullHandling}};function ah(r,e){const t=oh(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};const n=typeof r=="string"?nh(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=ih(c,n[c],t,typeof r=="string");s=$u(s,a,t)}return t.allowSparse===!0?s:Hu(s)}let So=class{#e;#t;#r;#n;_logger=null;#s="";constructor(e,t,n){this.#e=ae.create({baseURL:e,...n}),this.#t=t,this.#r=new al,this.#n=new hl}setLogger(e){this._logger=e,this.#r.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=Ee.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}setRestrictionManagerParams(e){this.#r.params=e}getRestrictionManagerParams(){return this.#r.params}setLogTag(e){this.#s=e}clearLogTag(){this.#s=""}async batch(e,t=!0){const n=Array.isArray(e),s=n?[]:{};let i=0;const o=(c,a)=>{let u=null,l=null;if(Array.isArray(c)?(u=c[0],l=c[1]):c.method&&(u=c.method,l=c.params),u){i++;const h=u+"?"+wo(l);n||Array.isArray(s)?s.push(h):s[a]=h}};if(n)for(const[c,a]of e.entries())o(a,c);else for(const[c,a]of Object.entries(e))o(a,c);return i<1?Promise.resolve(new Pt):this.call("batch",{halt:t?1:0,cmd:s}).then(c=>{const a=c.getData().result,u=n?[]:{},l=(p,m)=>{if(typeof a.result[m]<"u"||typeof a.result_error[m]<"u"){const g=p.split("?"),y=new fn({result:L.isUndefined(a.result[m])?{}:a.result[m],error:a?.result_error[m]||void 0,total:a.result_total[m],next:a.result_next[m]},{method:g[0]||"",params:ah(g[1]||""),start:0},c.getStatus());n||Array.isArray(u)?u.push(y):u[m]=y}};if(Array.isArray(s))for(const[p,m]of s.entries())l(m,p);else for(const[p,m]of Object.entries(s))l(m,p);let h;const f=p=>new Qt({status:0,answerError:{error:p.getErrorMessages().join("; "),errorDescription:`batch ${p.getQuery().method}: ${wo(p.getQuery().params,{encode:!1})}`},cause:p.getErrors().next().value}),d=new Pt;if(n||Array.isArray(u)){h=[];for(const p of u){if(p.getStatus()!==200||!p.isSuccess){const m=f(p);if(!t&&!p.isSuccess){d.addError(m);continue}return Promise.reject(m)}h.push(p.getData().result)}}else{h={};for(const p of Object.keys(u)){const m=u[p];if(m.getStatus()!==200||!m.isSuccess){const g=f(m);if(!t&&!m.isSuccess){d.addError(g);continue}return Promise.reject(g)}h[p]=m.getData().result}}return d.setData(h),Promise.resolve(d)})}async call(e,t,n=0){let s=this.#t.getAuthData();return s===!1&&(s=await this.#t.refreshAuth()),await this.#r.check(),this.#e.post(this.#i(e),this.#o(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 uo&&i.response&&i.response.data){const a=i.response.data;o={error:a.error,errorDescription:a.error_description}}const c=new Qt({status:i.response?.status||0,answerError:o,cause:i});return c.status===401&&["expired_token","invalid_token"].includes(c.answerError.error)?(this.getLogger().info(`refreshAuth >> ${c.answerError.error} >>>`),s=await this.#t.refreshAuth(),await this.#r.check(),this.#e.post(this.#i(e),this.#o(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 uo&&a.response&&a.response.data){const h=a.response.data;u={error:h.error,errorDescription:h.error_description}}const l=new Qt({status:a.response?.status||0,answerError:u,cause:a});return Promise.reject(l)})):Promise.reject(c)}).then(i=>{const o=new fn(i.payload,{method:e,params:t,start:n},i.status);return Promise.resolve(o)})}#o(e,t,n=0){const s=Object.assign({},t);return this.#s.length>0&&(s.logTag=this.#s),s[this.#n.getQueryStringParameterName()]=this.#n.getRequestId(),s[this.#n.getQueryStringSdkParameterName()]="0.1.4",s.data&&s.data.start&&delete s.data.start,e.refresh_token!=="hook"&&(s.auth=e.access_token),s.start=n,s}#i(e){return`${encodeURIComponent(e)}.json`}};class Dt{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=Ee.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 Pt;return L.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 h=u.getTotal();n(h>0?Math.round(100*c.length/h):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(!L.isNull(s)&&s!==null?c=o.getData().result[s]:c=o.getData().result,c.length===0||(yield c,c.length<Dt.batchSize))break;const a=c.at(-1);a&&n in a&&(t.filter[i]=a[n])}while(!0)}async callBatch(e,t=!0){return this.getHttpClient().batch(e,t)}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 Pt,s=[],i=this.chunkArray(e,Dt.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 Pn=(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))(Pn||{});const ch=()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)});let lh=class lt{static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!lt.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");lt.isInternalConstructing=!1}static getInstance(){return lt.instance||(lt.isInternalConstructing=!0,lt.instance=new lt),lt.instance}setDefLocale(e){this._defLocale=e}format(e,t){let n;(typeof t>"u"||!L.isStringFilled(t))&&(t=L.isStringFilled(this._defLocale)?this._defLocale||"en":navigator?.language),Number.isInteger(e)?n=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):n=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let 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 Ke{static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!Ke.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");Ke.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return Ke.instance||(Ke.isInternalConstructing=!0,Ke.instance=new Ke),Ke.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!this._isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const n=this._countries.get(t);return!!n&&n.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const n=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(n,"$1"+t)}electronicFormat(e){const t=/[^a-zA-Z0-9]/g;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const n=e.slice(0,2);if(!this._countries.has(n))throw new Error(`No country with code ${n}`);const 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(!this._isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);return!!n&&n.isValidBBAN(this.electronicFormat(t))}_isString(e){return typeof e=="string"||e instanceof String}}const uh=()=>{const r=lh.getInstance(),e=Ke.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 _o{#e;constructor(e){this.#e=Object.freeze(Object.assign({},e))}getAuthData(){const e=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,"");return{access_token:this.#e.secret,refresh_token:"hook",expires_in:0,domain:e,member_id:e}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#e.b24Url}`}getTargetOriginWithPath(){return`${this.#e.b24Url}/rest/${this.#e.userId}/${this.#e.secret}`}get isAdmin(){return!0}}class hh extends Dt{#e;constructor(e){super(),this.#e=new _o(e),this._http=new So(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._isInit=!0}setLogger(e){super.setLogger(e)}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var 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))(X||{});class vo{#e;#t;_logger=null;runCallbackHandler;constructor(e){this.#e=e,this.#t=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Ee.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.#r(o);if(e.toString().includes(":"))i={method:e.toString(),params:t??"",callback:c,appSid:this.#e.getAppSid()};else{i=e.toString();const a=[t?JSON.stringify(t):null,c,this.#e.getAppSid()];i+=":"+a.filter(Boolean).join(":")}this.getLogger().log(`send to ${this.#e.getTargetOrigin()}`,{cmd:i}),parent.postMessage(i,this.#e.getTargetOrigin()),t?.isSafely&&(this.#t.get(c).timeoutId=window.setTimeout(()=>{this.#t.has(c)&&(this.getLogger().warn(`Action ${e.toString()} stop by timeout`),this.#t.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.#t.has(n.id)){const s=this.#t.get(n.id);s.timeoutId&&clearTimeout(s.timeoutId),this.#t.delete(n.id),s.resolve(n.args)}}}#r(e){const t=W.getUniqId();return this.#t.set(t,e),t}}class ko{#e="";#t=!0;#r=null;#n=null;#s=null;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#t=e.PROTOCOL===!0,e.LANG&&(this.#s=e.LANG),e.APP_SID&&(this.#r=e.APP_SID)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#n||(this.#n=e.PATH),this.#s||(this.#s=e.LANG),this.#t=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this}getAppSid(){if(this.#r===null)throw new Error("Not init appSid");return this.#r}getTargetOrigin(){return`${this.#t?"https":"http"}://${this.#e}`}getTargetOriginWithPath(){return this.getTargetOrigin()+(this.#n??"")}getLang(){return this.#s||Pn.en}}class Eo{#e=null;#t=null;#r=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.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,this.#s=e.IS_ADMIN,this.#n=e.MEMBER_ID||""),this}getAuthData(){return this.#r>Date.now()?{access_token:this.#e,refresh_token:this.#t,expires_in:this.#r,domain:this.#o.getTargetOrigin(),member_id:this.#n}:!1}async refreshAuth(){return this.#i.send(X.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#n||""].join("_")}get isAdmin(){return this.#s}}class To{#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 ch()}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 Oo=class{#e;#t=null;#r=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#t=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#r=e.USER_OPTIONS),this}appGet(e){if(this.#t&&this.#t[e])return this.#t[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#t||(this.#t=[]),this.#t[e]=t,this.#n(X.setAppOption,e,this.#t[e])}userGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#t||(this.#t=[]),this.#t[e]||(this.#t[e]=null),this.#r[e]=t,this.#n(X.setUserOption,e,this.#r[e])}async#n(e,t,n){return this.#e.send(e,{name:t,value:n,isSafely:!0}).then(()=>Promise.resolve())}};class Ao{#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 Io{#e;#t;constructor(e,t){this.#e=e,this.#t=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#t.send(X.openApplication,e)}async closeSliderAppPage(){return this.#t.send(X.closeApplication,{isSafely:!1})}#r(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const n=new URL(e);return n.searchParams.set("IFRAME","Y"),n.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#t.send(X.openPath,{path:[this.#r(t),n.pathname,n.search].join("")}).then(s=>s?.result==="error"?s?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((i,o)=>{const 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.#t.send(X.showAppForm,{params:e,isSafely:!0})}}class Co{#e="";#t={};constructor(){}initData(e){this.#e=e.PLACEMENT||"DEFAULT";const t=e.PLACEMENT_OPTIONS;return this.#t=Object.freeze(t),this}get title(){return this.#e}get isDefault(){return this.title==="DEFAULT"}get options(){return this.#t}get isSliderMode(){return this.options?.IFRAME==="Y"}}class No extends Dt{#e=!1;#t=!1;#r;#n;#s;#o;#i;#c;#l;#a;constructor(e){super(),this.#r=new ko(e),this.#n=new vo(this.#r),this.#n.subscribe(),this.#s=new Eo(this.#r,this.#n),this.#o=new To(this.#n),this.#i=new Oo(this.#n),this.#c=new Ao(this.#n),this.#l=new Io(this.#r,this.#n),this.#a=new Co,this._isInit=!1}setLogger(e){super.setLogger(e),this.#n.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#t}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#o}get auth(){return this._ensureInitialized(),this.#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.#r.initData(e),this.#s.initData(e),this.#a.initData(e),this.#i.initData(e),this.#e=e.INSTALL,this.#t=e.FIRST_RUN,this._http=new So(this.#r.getTargetOriginWithPath(),this.#s,this._getHttpOptions()),this._isInit=!0,this.#t?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.#r.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#r.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#r.getAppSid()}getLang(){return this._ensureInitialized(),this.#r.getLang()}}class Mn extends Error{constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=new Error("for stack").stack}}class jt{_b24;_logger=null;_data=null;constructor(e){this._b24=e}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Ee.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 fh extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}class dh extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return Ti[this.data.status]||"Unknown status"}}class ph extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}class mh extends jt{_data=null;async initData(e){this._data=e,this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}makeRestrictionManagerParams(){this.data?.license&&this.data.license.includes("ent")&&(this.getLogger().log(`LICENSE ${this.data.license} => up restriction manager params`,ln),this._b24.getHttpClient().setRestrictionManagerParams(ln))}}class gh extends jt{async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(console.error(t),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{(await this._b24.callBatchByChunk(e,!0)).getData().forEach(t=>{if(typeof t.LANG>"u")return;const n=t.CURRENCY,s=this.data.currencyList.get(n);if(!(typeof s>"u"))for(const[i,o]of Object.entries(t.LANG))switch(s.lang[i]={decimals:Number.parseInt(o.DECIMALS),decPoint:o.DEC_POINT,formatString:o.FORMAT_STRING,fullName:o.FULL_NAME,isHideZero:o.HIDE_ZERO==="Y",thousandsSep:o.THOUSANDS_SEP,thousandsVariant:o.THOUSANDS_VARIANT},s.lang[i].thousandsVariant){case"N":s.lang[i].thousandsSep="";break;case"D":s.lang[i].thousandsSep=".";break;case"C":s.lang[i].thousandsSep=",";break;case"S":s.lang[i].thousandsSep=" ";break;case"B":s.lang[i].thousandsSep=" ";break;default:L.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 Mn(e);let s=n.fullName;if(!(typeof t>"u")){const i=n.lang[t];L.isUndefined(i)||(s=i.fullName)}return s}getCurrencyLiteral(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Mn(e);let s=n.formatString;if(!(typeof t>"u")){const i=n.lang[t];L.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 Mn(t);const i={formatString:s.formatString,decimals:s.decimals,decPoint:s.decPoint,thousandsSep:s.thousandsSep};L.isStringFilled(i.thousandsSep)||(i.thousandsSep="");const o=s.lang[n];return L.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 xn extends jt{_data;_type;static getSupportTypes(){return[Ye.NotSet,Ye.JsonArray,Ye.JsonObject,Ye.FloatVal,Ye.IntegerVal,Ye.BoolYN,Ye.StringVal]}static prepareArrayList(e){return L.isArray(e)?e:L.isObject(e)?Object.values(e):[]}constructor(e,t){super(e),this._type=t,this._data=new Map}get data(){return this._data}reset(){this.data.clear()}async initData(e){if(this.reset(),L.isObject(e))for(const[t,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),!L.isArray(n)&&!L.isObject(n)&&(n=t)}catch(s){this.getLogger().error(s),n=t}return xn.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 L.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}}),L.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 Ro{_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=Ee.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 yh extends Error{constructor(e){super(e),this.name="ErrorNotConnected"}}class wh extends Error{constructor(e){super(e),this.name="ErrorTimeout"}}const Mr="2.0";class bh{_logger=null;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._connector=e.connector,L.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Ee.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 yh("websocket is not connected"));const c=setTimeout(()=>{this._rpcResponseAwaiters.delete(o.id),i(new wh("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(`${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(L.isArray(t))return this.executeIncomingRpcBatch(t);if(L.isJsonRpcRequest(t))return this.executeIncomingRpcCommand(t);if(L.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:Mr,error:hn.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=Mr,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:Mr,error:hn.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:Mr,method:e,params:t,id:n}}}class Sh{_logger=null;_storage;_ttl=24*60*60;_callbacks;constructor(e={}){e=e||{},this._storage=e.storage||new Ro,this._callbacks={onWebSocketBlockChanged:L.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Ee.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",Re.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(Re.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(Re.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage. Error: `),t),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(Re.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(Re.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage. Error: `),t),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(Re.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(Re.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: LocalStorage error: `),t),!1}return!0}getTimestamp(){return Date.now()}}class _h{_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=Ee.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 nr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Dn={exports:{}};/*!
|
|
10
7
|
* protobuf.js v6.8.6 (c) 2016, daniel wirtz
|
|
11
8
|
* compiled mon, 26 feb 2018 11:35:34 utc
|
|
12
9
|
* licensed under the bsd-3-clause license
|
|
@@ -14,28 +11,28 @@
|
|
|
14
11
|
*
|
|
15
12
|
* Modify a list for integration with Bitrix Framework:
|
|
16
13
|
* - removed integration with RequireJS and AMD package builders;
|
|
17
|
-
*/var
|
|
14
|
+
*/var Lo;function kh(){return Lo||(Lo=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,h=!0;l<arguments.length;)a[u++]=arguments[l++];return new Promise(function(f,d){a[u]=function(p){if(h)if(h=!1,p)d(p);else{for(var m=new Array(arguments.length-1),g=0;g<m.length;)m[g++]=arguments[g];f.apply(null,m)}};try{o.apply(c||null,a)}catch(p){h&&(h=!1,d(p))}})}},{}],2:[function(t,n,s){var i=s;i.length=function(l){var h=l.length;if(!h)return 0;for(var f=0;--h%4>1&&l.charAt(h)==="=";)++f;return Math.ceil(l.length*3)/4-f};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,h,f){for(var d=null,p=[],m=0,g=0,y;h<f;){var w=l[h++];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,h,f){for(var d=f,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:h[f++]=m<<2|(y&48)>>4,m=y,p=2;break;case 2:h[f++]=(m&15)<<4|(y&60)>>2,m=y,p=3;break;case 3:h[f++]=(m&3)<<6|y,p=0;break}}if(p===1)throw Error(u);return f-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(h){if(typeof h!="string"){var f=l();if(i.verbose&&console.log("codegen: "+f),f="return "+f,h){for(var d=Object.keys(h),p=new Array(d.length+1),m=new Array(d.length),g=0;g<d.length;)p[g]=d[g],m[g]=h[d[g++]];return p[g]=f,Function.apply(null,p).apply(null,m)}return Function(f)()}for(var y=new Array(arguments.length-1),w=0;w<y.length;)y[w]=arguments[++w];if(w=0,h=h.replace(/%([%dfijs])/g,function(_,b){var k=y[w++];switch(b){case"d":case"f":return String(Number(k));case"i":return String(Math.floor(k));case"j":return JSON.stringify(k);case"s":return String(k)}return"%"}),w!==y.length)throw Error("parameter count mismatch");return a.push(h),u}function l(h){return"function "+(h||c||"")+"("+(o&&o.join(",")||"")+`){
|
|
18
15
|
`+a.join(`
|
|
19
16
|
`)+`
|
|
20
|
-
}`}return u.toString=c,u}s.verbose=!1},{}],4:[function(t,n,i){n.exports=s;function s(){this._listeners={}}s.prototype.on=function(o,l,a){return(this._listeners[o]||(this._listeners[o]=[])).push({fn:l,ctx:a||this}),this},s.prototype.off=function(o,l){if(o===e)this._listeners={};else if(l===e)this._listeners[o]=[];else for(var a=this._listeners[o],u=0;u<a.length;)a[u].fn===l?a.splice(u,1):++u;return this},s.prototype.emit=function(o){var l=this._listeners[o];if(l){for(var a=[],u=1;u<arguments.length;)a.push(arguments[u++]);for(u=0;u<l.length;)l[u].fn.apply(l[u++].ctx,a)}return this}},{}],5:[function(t,n,i){n.exports=a;var s=t(1),o=t(7),l=o("fs");function a(u,c,h){return typeof c=="function"?(h=c,c={}):c||(c={}),h?!c.xhr&&l&&l.readFile?l.readFile(u,function(f,d){return f&&typeof XMLHttpRequest<"u"?a.xhr(u,c,h):f?h(f):h(null,c.binary?d:d.toString("utf8"))}):a.xhr(u,c,h):s(a,this,u,c)}a.xhr=function(u,c,h){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState!==4)return e;if(f.status!==0&&f.status!==200)return h(Error("status "+f.status));if(c.binary){var d=f.response;if(!d){d=[];for(var g=0;g<f.responseText.length;++g)d.push(f.responseText.charCodeAt(g)&255)}return h(null,typeof Uint8Array<"u"?new Uint8Array(d):d)}return h(null,f.responseText)},c.binary&&("overrideMimeType"in f&&f.overrideMimeType("text/plain; charset=x-user-defined"),f.responseType="arraybuffer"),f.open("GET",u),f.send()}},{1:1,7:7}],6:[function(t,n,i){n.exports=s(s);function s(c){return typeof Float32Array<"u"?function(){var h=new Float32Array([-0]),f=new Uint8Array(h.buffer),d=f[3]===128;function g(w,_,b){h[0]=w,_[b]=f[0],_[b+1]=f[1],_[b+2]=f[2],_[b+3]=f[3]}function p(w,_,b){h[0]=w,_[b]=f[3],_[b+1]=f[2],_[b+2]=f[1],_[b+3]=f[0]}c.writeFloatLE=d?g:p,c.writeFloatBE=d?p:g;function m(w,_){return f[0]=w[_],f[1]=w[_+1],f[2]=w[_+2],f[3]=w[_+3],h[0]}function y(w,_){return f[3]=w[_],f[2]=w[_+1],f[1]=w[_+2],f[0]=w[_+3],h[0]}c.readFloatLE=d?m:y,c.readFloatBE=d?y:m}():function(){function h(d,g,p,m){var y=g<0?1:0;if(y&&(g=-g),g===0)d(1/g>0?0:2147483648,p,m);else if(isNaN(g))d(2143289344,p,m);else if(g>34028234663852886e22)d((y<<31|2139095040)>>>0,p,m);else if(g<11754943508222875e-54)d((y<<31|Math.round(g/1401298464324817e-60))>>>0,p,m);else{var w=Math.floor(Math.log(g)/Math.LN2),_=Math.round(g*Math.pow(2,-w)*8388608)&8388607;d((y<<31|w+127<<23|_)>>>0,p,m)}}c.writeFloatLE=h.bind(null,o),c.writeFloatBE=h.bind(null,l);function f(d,g,p){var m=d(g,p),y=(m>>31)*2+1,w=m>>>23&255,_=m&8388607;return w===255?_?NaN:y*(1/0):w===0?y*1401298464324817e-60*_:y*Math.pow(2,w-150)*(_+8388608)}c.readFloatLE=f.bind(null,a),c.readFloatBE=f.bind(null,u)}(),typeof Float64Array<"u"?function(){var h=new Float64Array([-0]),f=new Uint8Array(h.buffer),d=f[7]===128;function g(w,_,b){h[0]=w,_[b]=f[0],_[b+1]=f[1],_[b+2]=f[2],_[b+3]=f[3],_[b+4]=f[4],_[b+5]=f[5],_[b+6]=f[6],_[b+7]=f[7]}function p(w,_,b){h[0]=w,_[b]=f[7],_[b+1]=f[6],_[b+2]=f[5],_[b+3]=f[4],_[b+4]=f[3],_[b+5]=f[2],_[b+6]=f[1],_[b+7]=f[0]}c.writeDoubleLE=d?g:p,c.writeDoubleBE=d?p:g;function m(w,_){return f[0]=w[_],f[1]=w[_+1],f[2]=w[_+2],f[3]=w[_+3],f[4]=w[_+4],f[5]=w[_+5],f[6]=w[_+6],f[7]=w[_+7],h[0]}function y(w,_){return f[7]=w[_],f[6]=w[_+1],f[5]=w[_+2],f[4]=w[_+3],f[3]=w[_+4],f[2]=w[_+5],f[1]=w[_+6],f[0]=w[_+7],h[0]}c.readDoubleLE=d?m:y,c.readDoubleBE=d?y:m}():function(){function h(d,g,p,m,y,w){var _=m<0?1:0;if(_&&(m=-m),m===0)d(0,y,w+g),d(1/m>0?0:2147483648,y,w+p);else if(isNaN(m))d(0,y,w+g),d(2146959360,y,w+p);else if(m>17976931348623157e292)d(0,y,w+g),d((_<<31|2146435072)>>>0,y,w+p);else{var b;if(m<22250738585072014e-324)b=m/5e-324,d(b>>>0,y,w+g),d((_<<31|b/4294967296)>>>0,y,w+p);else{var k=Math.floor(Math.log(m)/Math.LN2);k===1024&&(k=1023),b=m*Math.pow(2,-k),d(b*4503599627370496>>>0,y,w+g),d((_<<31|k+1023<<20|b*1048576&1048575)>>>0,y,w+p)}}}c.writeDoubleLE=h.bind(null,o,0,4),c.writeDoubleBE=h.bind(null,l,4,0);function f(d,g,p,m,y){var w=d(m,y+g),_=d(m,y+p),b=(_>>31)*2+1,k=_>>>20&2047,S=4294967296*(_&1048575)+w;return k===2047?S?NaN:b*(1/0):k===0?b*5e-324*S:b*Math.pow(2,k-1075)*(S+4503599627370496)}c.readDoubleLE=f.bind(null,a,0,4),c.readDoubleBE=f.bind(null,u,4,0)}(),c}function o(c,h,f){h[f]=c&255,h[f+1]=c>>>8&255,h[f+2]=c>>>16&255,h[f+3]=c>>>24}function l(c,h,f){h[f]=c>>>24,h[f+1]=c>>>16&255,h[f+2]=c>>>8&255,h[f+3]=c&255}function a(c,h){return(c[h]|c[h+1]<<8|c[h+2]<<16|c[h+3]<<24)>>>0}function u(c,h){return(c[h]<<24|c[h+1]<<16|c[h+2]<<8|c[h+3])>>>0}},{}],7:[function(t,n,i){n.exports=s;function s(o){try{var l=t(o);if(l&&(l.length||Object.keys(l).length))return l}catch{}return null}},{}],8:[function(t,n,i){var s=i,o=s.isAbsolute=function(a){return/^(?:\/|\w+:)/.test(a)},l=s.normalize=function(a){a=a.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var u=a.split("/"),c=o(a),h="";c&&(h=u.shift()+"/");for(var f=0;f<u.length;)u[f]===".."?f>0&&u[f-1]!==".."?u.splice(--f,2):c?u.splice(f,1):++f:u[f]==="."?u.splice(f,1):++f;return h+u.join("/")};s.resolve=function(a,u,c){return c||(u=l(u)),o(u)?u:(c||(a=l(a)),(a=a.replace(/(?:\/|^)[^/]+$/,"")).length?l(a+"/"+u):u)}},{}],9:[function(t,n,i){n.exports=s;function s(o,l,a){var u=a||8192,c=u>>>1,h=null,f=u;return function(d){if(d<1||d>c)return o(d);f+d>u&&(h=o(u),f=0);var g=l.call(h,f,f+=d);return f&7&&(f=(f|7)+1),g}}},{}],10:[function(t,n,i){var s=i;s.length=function(o){for(var l=0,a=0,u=0;u<o.length;++u)a=o.charCodeAt(u),a<128?l+=1:a<2048?l+=2:(a&64512)===55296&&(o.charCodeAt(u+1)&64512)===56320?(++u,l+=4):l+=3;return l},s.read=function(o,l,a){var u=a-l;if(u<1)return"";for(var c=null,h=[],f=0,d;l<a;)d=o[l++],d<128?h[f++]=d:d>191&&d<224?h[f++]=(d&31)<<6|o[l++]&63:d>239&&d<365?(d=((d&7)<<18|(o[l++]&63)<<12|(o[l++]&63)<<6|o[l++]&63)-65536,h[f++]=55296+(d>>10),h[f++]=56320+(d&1023)):h[f++]=(d&15)<<12|(o[l++]&63)<<6|o[l++]&63,f>8191&&((c||(c=[])).push(String.fromCharCode.apply(String,h)),f=0);return c?(f&&c.push(String.fromCharCode.apply(String,h.slice(0,f))),c.join("")):String.fromCharCode.apply(String,h.slice(0,f))},s.write=function(o,l,a){for(var u=a,c,h,f=0;f<o.length;++f)c=o.charCodeAt(f),c<128?l[a++]=c:c<2048?(l[a++]=c>>6|192,l[a++]=c&63|128):(c&64512)===55296&&((h=o.charCodeAt(f+1))&64512)===56320?(c=65536+((c&1023)<<10)+(h&1023),++f,l[a++]=c>>18|240,l[a++]=c>>12&63|128,l[a++]=c>>6&63|128,l[a++]=c&63|128):(l[a++]=c>>12|224,l[a++]=c>>6&63|128,l[a++]=c&63|128);return a-u}},{}],11:[function(t,n,i){n.exports=o;var s=/\/|\./;function o(a,u){s.test(a)||(a="google/protobuf/"+a+".proto",u={nested:{google:{nested:{protobuf:{nested:u}}}}}),o[a]=u}o("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var l;o("duration",{Duration:l={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),o("timestamp",{Timestamp:l}),o("empty",{Empty:{fields:{}}}),o("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),o("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),o("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),o.get=function(a){return o[a]||null}},{}],12:[function(t,n,i){var s=i,o=t(15),l=t(37);function a(c,h,f,d){if(h.resolvedType)if(h.resolvedType instanceof o){c("switch(d%s){",d);for(var g=h.resolvedType.values,p=Object.keys(g),m=0;m<p.length;++m)h.repeated&&g[p[m]]===h.typeDefault&&c("default:"),c("case%j:",p[m])("case %i:",g[p[m]])("m%s=%j",d,g[p[m]])("break");c("}")}else c('if(typeof d%s!=="object")',d)("throw TypeError(%j)",h.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",d,f,d);else{var y=!1;switch(h.type){case"double":case"float":c("m%s=Number(d%s)",d,d);break;case"uint32":case"fixed32":c("m%s=d%s>>>0",d,d);break;case"int32":case"sint32":case"sfixed32":c("m%s=d%s|0",d,d);break;case"uint64":y=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":c("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",d,d,y)('else if(typeof d%s==="string")',d)("m%s=parseInt(d%s,10)",d,d)('else if(typeof d%s==="number")',d)("m%s=d%s",d,d)('else if(typeof d%s==="object")',d)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",d,d,d,y?"true":"");break;case"bytes":c('if(typeof d%s==="string")',d)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",d,d,d)("else if(d%s.length)",d)("m%s=d%s",d,d);break;case"string":c("m%s=String(d%s)",d,d);break;case"bool":c("m%s=Boolean(d%s)",d,d);break}}return c}s.fromObject=function(c){var h=c.fieldsArray,f=l.codegen(["d"],c.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!h.length)return f("return new this.ctor");f("var m=new this.ctor");for(var d=0;d<h.length;++d){var g=h[d].resolve(),p=l.safeProp(g.name);g.map?(f("if(d%s){",p)('if(typeof d%s!=="object")',p)("throw TypeError(%j)",g.fullName+": object expected")("m%s={}",p)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",p),a(f,g,d,p+"[ks[i]]")("}")("}")):g.repeated?(f("if(d%s){",p)("if(!Array.isArray(d%s))",p)("throw TypeError(%j)",g.fullName+": array expected")("m%s=[]",p)("for(var i=0;i<d%s.length;++i){",p),a(f,g,d,p+"[i]")("}")("}")):(g.resolvedType instanceof o||f("if(d%s!=null){",p),a(f,g,d,p),g.resolvedType instanceof o||f("}"))}return f("return m")};function u(c,h,f,d){if(h.resolvedType)h.resolvedType instanceof o?c("d%s=o.enums===String?types[%i].values[m%s]:m%s",d,f,d,d):c("d%s=types[%i].toObject(m%s,o)",d,f,d);else{var g=!1;switch(h.type){case"double":case"float":c("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",d,d,d,d);break;case"uint64":g=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":c('if(typeof m%s==="number")',d)("d%s=o.longs===String?String(m%s):m%s",d,d,d)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",d,d,d,d,g?"true":"",d);break;case"bytes":c("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",d,d,d,d,d);break;default:c("d%s=m%s",d,d);break}}return c}s.toObject=function(c){var h=c.fieldsArray.slice().sort(l.compareFieldsById);if(!h.length)return l.codegen()("return {}");for(var f=l.codegen(["m","o"],c.name+"$toObject")("if(!o)")("o={}")("var d={}"),d=[],g=[],p=[],m=0;m<h.length;++m)h[m].partOf||(h[m].resolve().repeated?d:h[m].map?g:p).push(h[m]);if(d.length){for(f("if(o.arrays||o.defaults){"),m=0;m<d.length;++m)f("d%s=[]",l.safeProp(d[m].name));f("}")}if(g.length){for(f("if(o.objects||o.defaults){"),m=0;m<g.length;++m)f("d%s={}",l.safeProp(g[m].name));f("}")}if(p.length){for(f("if(o.defaults){"),m=0;m<p.length;++m){var y=p[m],w=l.safeProp(y.name);y.resolvedType instanceof o?f("d%s=o.enums===String?%j:%j",w,y.resolvedType.valuesById[y.typeDefault],y.typeDefault):y.long?f("if(util.Long){")("var n=new util.Long(%i,%i,%j)",y.typeDefault.low,y.typeDefault.high,y.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",w)("}else")("d%s=o.longs===String?%j:%i",w,y.typeDefault.toString(),y.typeDefault.toNumber()):y.bytes?f("d%s=o.bytes===String?%j:%s",w,String.fromCharCode.apply(String,y.typeDefault),"["+Array.prototype.slice.call(y.typeDefault).join(",")+"]"):f("d%s=%j",w,y.typeDefault)}f("}")}var _=!1;for(m=0;m<h.length;++m){var y=h[m],b=c._fieldsArray.indexOf(y),w=l.safeProp(y.name);y.map?(_||(_=!0,f("var ks2")),f("if(m%s&&(ks2=Object.keys(m%s)).length){",w,w)("d%s={}",w)("for(var j=0;j<ks2.length;++j){"),u(f,y,b,w+"[ks2[j]]")("}")):y.repeated?(f("if(m%s&&m%s.length){",w,w)("d%s=[]",w)("for(var j=0;j<m%s.length;++j){",w),u(f,y,b,w+"[j]")("}")):(f("if(m%s!=null&&m.hasOwnProperty(%j)){",w,y.name),u(f,y,b,w),y.partOf&&f("if(o.oneofs)")("d%s=%j",l.safeProp(y.partOf.name),y.name)),f("}")}return f("return d")}},{15:15,37:37}],13:[function(t,n,i){n.exports=u;var s=t(15),o=t(36),l=t(37);function a(c){return"missing required '"+c.name+"'"}function u(c){var h=l.codegen(["r","l"],c.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(c.fieldsArray.filter(function(y){return y.map}).length?",k":""))("while(r.pos<c){")("var t=r.uint32()");c.group&&h("if((t&7)===4)")("break"),h("switch(t>>>3){");for(var f=0;f<c.fieldsArray.length;++f){var d=c._fieldsArray[f].resolve(),g=d.resolvedType instanceof s?"int32":d.type,p="m"+l.safeProp(d.name);h("case %i:",d.id),d.map?(h("r.skip().pos++")("if(%s===util.emptyObject)",p)("%s={}",p)("k=r.%s()",d.keyType)("r.pos++"),o.long[d.keyType]!==e?o.basic[g]===e?h('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',p,f):h('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',p,g):o.basic[g]===e?h("%s[k]=types[%i].decode(r,r.uint32())",p,f):h("%s[k]=r.%s()",p,g)):d.repeated?(h("if(!(%s&&%s.length))",p,p)("%s=[]",p),o.packed[g]!==e&&h("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",p,g)("}else"),o.basic[g]===e?h(d.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",p,f):h("%s.push(r.%s())",p,g)):o.basic[g]===e?h(d.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",p,f):h("%s=r.%s()",p,g),h("break")}for(h("default:")("r.skipType(t&7)")("break")("}")("}"),f=0;f<c._fieldsArray.length;++f){var m=c._fieldsArray[f];m.required&&h("if(!m.hasOwnProperty(%j))",m.name)("throw util.ProtocolError(%j,{instance:m})",a(m))}return h("return m")}},{15:15,36:36,37:37}],14:[function(t,n,i){n.exports=u;var s=t(15),o=t(36),l=t(37);function a(c,h,f,d){return h.resolvedType.group?c("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",f,d,(h.id<<3|3)>>>0,(h.id<<3|4)>>>0):c("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",f,d,(h.id<<3|2)>>>0)}function u(c){for(var h=l.codegen(["m","w"],c.name+"$encode")("if(!w)")("w=Writer.create()"),g,f,d=c.fieldsArray.slice().sort(l.compareFieldsById),g=0;g<d.length;++g){var p=d[g].resolve(),m=c._fieldsArray.indexOf(p),y=p.resolvedType instanceof s?"int32":p.type,w=o.basic[y];f="m"+l.safeProp(p.name),p.map?(h("if(%s!=null&&m.hasOwnProperty(%j)){",f,p.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",f)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(p.id<<3|2)>>>0,8|o.mapKey[p.keyType],p.keyType),w===e?h("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",m,f):h(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|w,y,f),h("}")("}")):p.repeated?(h("if(%s!=null&&%s.length){",f,f),p.packed&&o.packed[y]!==e?h("w.uint32(%i).fork()",(p.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",f)("w.%s(%s[i])",y,f)("w.ldelim()"):(h("for(var i=0;i<%s.length;++i)",f),w===e?a(h,p,m,f+"[i]"):h("w.uint32(%i).%s(%s[i])",(p.id<<3|w)>>>0,y,f)),h("}")):(p.optional&&h("if(%s!=null&&m.hasOwnProperty(%j))",f,p.name),w===e?a(h,p,m,f):h("w.uint32(%i).%s(%s)",(p.id<<3|w)>>>0,y,f))}return h("return w")}},{15:15,36:36,37:37}],15:[function(t,n,i){n.exports=a;var s=t(24);((a.prototype=Object.create(s.prototype)).constructor=a).className="Enum";var o=t(23),l=t(37);function a(u,c,h,f,d){if(s.call(this,u,h),c&&typeof c!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=f,this.comments=d||{},this.reserved=e,c)for(var g=Object.keys(c),p=0;p<g.length;++p)typeof c[g[p]]=="number"&&(this.valuesById[this.values[g[p]]=c[g[p]]]=g[p])}a.fromJSON=function(u,c){var h=new a(u,c.values,c.options,c.comment,c.comments);return h.reserved=c.reserved,h},a.prototype.toJSON=function(u){var c=u?!!u.keepComments:!1;return l.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:e,"comment",c?this.comment:e,"comments",c?this.comments:e])},a.prototype.add=function(u,c,h){if(!l.isString(u))throw TypeError("name must be a string");if(!l.isInteger(c))throw TypeError("id must be an integer");if(this.values[u]!==e)throw Error("duplicate name '"+u+"' in "+this);if(this.isReservedId(c))throw Error("id "+c+" is reserved in "+this);if(this.isReservedName(u))throw Error("name '"+u+"' is reserved in "+this);if(this.valuesById[c]!==e){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+c+" in "+this);this.values[u]=c}else this.valuesById[this.values[u]=c]=u;return this.comments[u]=h||null,this},a.prototype.remove=function(u){if(!l.isString(u))throw TypeError("name must be a string");var c=this.values[u];if(c==null)throw Error("name '"+u+"' does not exist in "+this);return delete this.valuesById[c],delete this.values[u],delete this.comments[u],this},a.prototype.isReservedId=function(u){return o.isReservedId(this.reserved,u)},a.prototype.isReservedName=function(u){return o.isReservedName(this.reserved,u)}},{23:23,24:24,37:37}],16:[function(t,n,i){n.exports=h;var s=t(24);((h.prototype=Object.create(s.prototype)).constructor=h).className="Field";var o=t(15),l=t(36),a=t(37),u,c=/^required|optional|repeated$/;h.fromJSON=function(f,d){return new h(f,d.id,d.type,d.rule,d.extend,d.options,d.comment)};function h(f,d,g,p,m,y,w){if(a.isObject(p)?(w=m,y=p,p=m=e):a.isObject(m)&&(w=y,y=m,m=e),s.call(this,f,y),!a.isInteger(d)||d<0)throw TypeError("id must be a non-negative integer");if(!a.isString(g))throw TypeError("type must be a string");if(p!==e&&!c.test(p=p.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(m!==e&&!a.isString(m))throw TypeError("extend must be a string");this.rule=p&&p!=="optional"?p:e,this.type=g,this.id=d,this.extend=m||e,this.required=p==="required",this.optional=!this.required,this.repeated=p==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=a.Long?l.long[g]!==e:!1,this.bytes=g==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=w}Object.defineProperty(h.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}}),h.prototype.setOption=function(f,d,g){return f==="packed"&&(this._packed=null),s.prototype.setOption.call(this,f,d,g)},h.prototype.toJSON=function(f){var d=f?!!f.keepComments:!1;return a.toObject(["rule",this.rule!=="optional"&&this.rule||e,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",d?this.comment:e])},h.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=l.defaults[this.type])===e&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof u?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof o&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==e&&this.resolvedType&&!(this.resolvedType instanceof o))&&delete this.options.packed,Object.keys(this.options).length||(this.options=e)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var f;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,f=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,f=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=f}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof u&&(this.parent.ctor.prototype[this.name]=this.defaultValue),s.prototype.resolve.call(this)},h.d=function(f,d,g,p){return typeof d=="function"?d=a.decorateType(d).name:d&&typeof d=="object"&&(d=a.decorateEnum(d).name),function(m,y){a.decorateType(m.constructor).add(new h(y,f,d,g,{default:p}))}},h._configure=function(f){u=f}},{15:15,24:24,36:36,37:37}],17:[function(t,n,i){var s=n.exports=t(18);s.build="light";function o(a,u,c){return typeof u=="function"?(c=u,u=new s.Root):u||(u=new s.Root),u.load(a,c)}s.load=o;function l(a,u){return u||(u=new s.Root),u.loadSync(a)}s.loadSync=l,s.encoder=t(14),s.decoder=t(13),s.verifier=t(40),s.converter=t(12),s.ReflectionObject=t(24),s.Namespace=t(23),s.Root=t(29),s.Enum=t(15),s.Type=t(35),s.Field=t(16),s.OneOf=t(25),s.MapField=t(20),s.Service=t(33),s.Method=t(22),s.Message=t(21),s.wrappers=t(41),s.types=t(36),s.util=t(37),s.ReflectionObject._configure(s.Root),s.Namespace._configure(s.Type,s.Service),s.Root._configure(s.Type),s.Field._configure(s.Type)},{12:12,13:13,14:14,15:15,16:16,18:18,20:20,21:21,22:22,23:23,24:24,25:25,29:29,33:33,35:35,36:36,37:37,40:40,41:41}],18:[function(t,n,i){var s=i;s.build="minimal",s.Writer=t(42),s.BufferWriter=t(43),s.Reader=t(27),s.BufferReader=t(28),s.util=t(39),s.rpc=t(31),s.roots=t(30),s.configure=o;function o(){s.Reader._configure(s.BufferReader),s.util._configure()}s.Writer._configure(s.BufferWriter),o()},{27:27,28:28,30:30,31:31,39:39,42:42,43:43}],19:[function(t,n,i){var s=n.exports=t(17);s.build="full",s.tokenize=t(34),s.parse=t(26),s.common=t(11),s.Root._configure(s.Type,s.parse,s.common)},{11:11,17:17,26:26,34:34}],20:[function(t,n,i){n.exports=a;var s=t(16);((a.prototype=Object.create(s.prototype)).constructor=a).className="MapField";var o=t(36),l=t(37);function a(u,c,h,f,d,g){if(s.call(this,u,c,f,e,e,d,g),!l.isString(h))throw TypeError("keyType must be a string");this.keyType=h,this.resolvedKeyType=null,this.map=!0}a.fromJSON=function(u,c){return new a(u,c.id,c.keyType,c.type,c.options,c.comment)},a.prototype.toJSON=function(u){var c=u?!!u.keepComments:!1;return l.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",c?this.comment:e])},a.prototype.resolve=function(){if(this.resolved)return this;if(o.mapKey[this.keyType]===e)throw Error("invalid key type: "+this.keyType);return s.prototype.resolve.call(this)},a.d=function(u,c,h){return typeof h=="function"?h=l.decorateType(h).name:h&&typeof h=="object"&&(h=l.decorateEnum(h).name),function(f,d){l.decorateType(f.constructor).add(new a(d,u,c,h))}}},{16:16,36:36,37:37}],21:[function(t,n,i){n.exports=o;var s=t(39);function o(l){if(l)for(var a=Object.keys(l),u=0;u<a.length;++u)this[a[u]]=l[a[u]]}o.create=function(l){return this.$type.create(l)},o.encode=function(l,a){return this.$type.encode(l,a)},o.encodeDelimited=function(l,a){return this.$type.encodeDelimited(l,a)},o.decode=function(l){return this.$type.decode(l)},o.decodeDelimited=function(l){return this.$type.decodeDelimited(l)},o.verify=function(l){return this.$type.verify(l)},o.fromObject=function(l){return this.$type.fromObject(l)},o.toObject=function(l,a){return this.$type.toObject(l,a)},o.prototype.toJSON=function(){return this.$type.toObject(this,s.toJSONOptions)}},{39:39}],22:[function(t,n,i){n.exports=l;var s=t(24);((l.prototype=Object.create(s.prototype)).constructor=l).className="Method";var o=t(37);function l(a,u,c,h,f,d,g,p){if(o.isObject(f)?(g=f,f=d=e):o.isObject(d)&&(g=d,d=e),!(u===e||o.isString(u)))throw TypeError("type must be a string");if(!o.isString(c))throw TypeError("requestType must be a string");if(!o.isString(h))throw TypeError("responseType must be a string");s.call(this,a,g),this.type=u||"rpc",this.requestType=c,this.requestStream=f?!0:e,this.responseType=h,this.responseStream=d?!0:e,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=p}l.fromJSON=function(a,u){return new l(a,u.type,u.requestType,u.responseType,u.requestStream,u.responseStream,u.options,u.comment)},l.prototype.toJSON=function(a){var u=a?!!a.keepComments:!1;return o.toObject(["type",this.type!=="rpc"&&this.type||e,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",u?this.comment:e])},l.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),s.prototype.resolve.call(this))}},{24:24,37:37}],23:[function(t,n,i){n.exports=f;var s=t(24);((f.prototype=Object.create(s.prototype)).constructor=f).className="Namespace";var o=t(15),l=t(16),a=t(37),u,c;f.fromJSON=function(g,p){return new f(g,p.options).addJSON(p.nested)};function h(g,p){if(!(g&&g.length))return e;for(var m={},y=0;y<g.length;++y)m[g[y].name]=g[y].toJSON(p);return m}f.arrayToJSON=h,f.isReservedId=function(g,p){if(g){for(var m=0;m<g.length;++m)if(typeof g[m]!="string"&&g[m][0]<=p&&g[m][1]>=p)return!0}return!1},f.isReservedName=function(g,p){if(g){for(var m=0;m<g.length;++m)if(g[m]===p)return!0}return!1};function f(g,p){s.call(this,g,p),this.nested=e,this._nestedArray=null}function d(g){return g._nestedArray=null,g}Object.defineProperty(f.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=a.toArray(this.nested))}}),f.prototype.toJSON=function(g){return a.toObject(["options",this.options,"nested",h(this.nestedArray,g)])},f.prototype.addJSON=function(g){var p=this;if(g)for(var m=Object.keys(g),y=0,w;y<m.length;++y)w=g[m[y]],p.add((w.fields!==e?u.fromJSON:w.values!==e?o.fromJSON:w.methods!==e?c.fromJSON:w.id!==e?l.fromJSON:f.fromJSON)(m[y],w));return this},f.prototype.get=function(g){return this.nested&&this.nested[g]||null},f.prototype.getEnum=function(g){if(this.nested&&this.nested[g]instanceof o)return this.nested[g].values;throw Error("no such enum: "+g)},f.prototype.add=function(g){if(!(g instanceof l&&g.extend!==e||g instanceof u||g instanceof o||g instanceof c||g instanceof f))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var p=this.get(g.name);if(p)if(p instanceof f&&g instanceof f&&!(p instanceof u||p instanceof c)){for(var m=p.nestedArray,y=0;y<m.length;++y)g.add(m[y]);this.remove(p),this.nested||(this.nested={}),g.setOptions(p.options,!0)}else throw Error("duplicate name '"+g.name+"' in "+this)}return this.nested[g.name]=g,g.onAdd(this),d(this)},f.prototype.remove=function(g){if(!(g instanceof s))throw TypeError("object must be a ReflectionObject");if(g.parent!==this)throw Error(g+" is not a member of "+this);return delete this.nested[g.name],Object.keys(this.nested).length||(this.nested=e),g.onRemove(this),d(this)},f.prototype.define=function(g,p){if(a.isString(g))g=g.split(".");else if(!Array.isArray(g))throw TypeError("illegal path");if(g&&g.length&&g[0]==="")throw Error("path must be relative");for(var m=this;g.length>0;){var y=g.shift();if(m.nested&&m.nested[y]){if(m=m.nested[y],!(m instanceof f))throw Error("path conflicts with non-namespace objects")}else m.add(m=new f(y))}return p&&m.addJSON(p),m},f.prototype.resolveAll=function(){for(var g=this.nestedArray,p=0;p<g.length;)g[p]instanceof f?g[p++].resolveAll():g[p++].resolve();return this.resolve()},f.prototype.lookup=function(g,p,m){if(typeof p=="boolean"?(m=p,p=e):p&&!Array.isArray(p)&&(p=[p]),a.isString(g)&&g.length){if(g===".")return this.root;g=g.split(".")}else if(!g.length)return this;if(g[0]==="")return this.root.lookup(g.slice(1),p);var y=this.get(g[0]);if(y){if(g.length===1){if(!p||p.indexOf(y.constructor)>-1)return y}else if(y instanceof f&&(y=y.lookup(g.slice(1),p,!0)))return y}else for(var w=0;w<this.nestedArray.length;++w)if(this._nestedArray[w]instanceof f&&(y=this._nestedArray[w].lookup(g,p,!0)))return y;return this.parent===null||m?null:this.parent.lookup(g,p)},f.prototype.lookupType=function(g){var p=this.lookup(g,[u]);if(!p)throw Error("no such type: "+g);return p},f.prototype.lookupEnum=function(g){var p=this.lookup(g,[o]);if(!p)throw Error("no such Enum '"+g+"' in "+this);return p},f.prototype.lookupTypeOrEnum=function(g){var p=this.lookup(g,[u,o]);if(!p)throw Error("no such Type or Enum '"+g+"' in "+this);return p},f.prototype.lookupService=function(g){var p=this.lookup(g,[c]);if(!p)throw Error("no such Service '"+g+"' in "+this);return p},f._configure=function(g,p){u=g,c=p}},{15:15,16:16,24:24,37:37}],24:[function(t,n,i){n.exports=l,l.className="ReflectionObject";var s=t(37),o;function l(a,u){if(!s.isString(a))throw TypeError("name must be a string");if(u&&!s.isObject(u))throw TypeError("options must be an object");this.options=u,this.name=a,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(l.prototype,{root:{get:function(){for(var a=this;a.parent!==null;)a=a.parent;return a}},fullName:{get:function(){for(var a=[this.name],u=this.parent;u;)a.unshift(u.name),u=u.parent;return a.join(".")}}}),l.prototype.toJSON=function(){throw Error()},l.prototype.onAdd=function(a){this.parent&&this.parent!==a&&this.parent.remove(this),this.parent=a,this.resolved=!1;var u=a.root;u instanceof o&&u._handleAdd(this)},l.prototype.onRemove=function(a){var u=a.root;u instanceof o&&u._handleRemove(this),this.parent=null,this.resolved=!1},l.prototype.resolve=function(){return this.resolved?this:(this.root instanceof o&&(this.resolved=!0),this)},l.prototype.getOption=function(a){return this.options?this.options[a]:e},l.prototype.setOption=function(a,u,c){return(!c||!this.options||this.options[a]===e)&&((this.options||(this.options={}))[a]=u),this},l.prototype.setOptions=function(a,u){if(a)for(var c=Object.keys(a),h=0;h<c.length;++h)this.setOption(c[h],a[c[h]],u);return this},l.prototype.toString=function(){var a=this.constructor.className,u=this.fullName;return u.length?a+" "+u:a},l._configure=function(a){o=a}},{37:37}],25:[function(t,n,i){n.exports=a;var s=t(24);((a.prototype=Object.create(s.prototype)).constructor=a).className="OneOf";var o=t(16),l=t(37);function a(c,h,f,d){if(Array.isArray(h)||(f=h,h=e),s.call(this,c,f),!(h===e||Array.isArray(h)))throw TypeError("fieldNames must be an Array");this.oneof=h||[],this.fieldsArray=[],this.comment=d}a.fromJSON=function(c,h){return new a(c,h.oneof,h.options,h.comment)},a.prototype.toJSON=function(c){var h=c?!!c.keepComments:!1;return l.toObject(["options",this.options,"oneof",this.oneof,"comment",h?this.comment:e])};function u(c){if(c.parent)for(var h=0;h<c.fieldsArray.length;++h)c.fieldsArray[h].parent||c.parent.add(c.fieldsArray[h])}a.prototype.add=function(c){if(!(c instanceof o))throw TypeError("field must be a Field");return c.parent&&c.parent!==this.parent&&c.parent.remove(c),this.oneof.push(c.name),this.fieldsArray.push(c),c.partOf=this,u(this),this},a.prototype.remove=function(c){if(!(c instanceof o))throw TypeError("field must be a Field");var h=this.fieldsArray.indexOf(c);if(h<0)throw Error(c+" is not a member of "+this);return this.fieldsArray.splice(h,1),h=this.oneof.indexOf(c.name),h>-1&&this.oneof.splice(h,1),c.partOf=null,this},a.prototype.onAdd=function(c){s.prototype.onAdd.call(this,c);for(var h=this,f=0;f<this.oneof.length;++f){var d=c.get(this.oneof[f]);d&&!d.partOf&&(d.partOf=h,h.fieldsArray.push(d))}u(this)},a.prototype.onRemove=function(c){for(var h=0,f;h<this.fieldsArray.length;++h)(f=this.fieldsArray[h]).parent&&f.parent.remove(f);s.prototype.onRemove.call(this,c)},a.d=function(){for(var c=new Array(arguments.length),h=0;h<arguments.length;)c[h]=arguments[h++];return function(f,d){l.decorateType(f.constructor).add(new a(d,c)),Object.defineProperty(f,d,{get:l.oneOfGetter(c),set:l.oneOfSetter(c)})}}},{16:16,24:24,37:37}],26:[function(t,n,i){n.exports=R,R.filename=null,R.defaults={keepCase:!1};var s=t(34),o=t(29),l=t(35),a=t(16),u=t(20),c=t(25),h=t(15),f=t(33),d=t(22),g=t(36),p=t(37),m=/^[1-9][0-9]*$/,y=/^-?[1-9][0-9]*$/,w=/^0[x][0-9a-fA-F]+$/,_=/^-?0[x][0-9a-fA-F]+$/,b=/^0[0-7]+$/,k=/^-?0[0-7]+$/,S=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,O=/^[a-zA-Z_][a-zA-Z_0-9]*$/,C=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,F=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function R(Y,B,W){B instanceof o||(W=B,B=new o),W||(W=R.defaults);var ee=s(Y,W.alternateCommentMode||!1),D=ee.next,he=ee.push,X=ee.peek,A=ee.skip,ne=ee.cmnt,te=!0,ce,$,re,K,se=!1,ue=B,me=W.keepCase?function(N){return N}:p.camelCase;function U(N,v,E){var P=R.filename;return E||(R.filename=null),Error("illegal "+(v||"token")+" '"+N+"' ("+(P?P+", ":"")+"line "+ee.line+")")}function pe(){var N=[],v;do{if((v=D())!=='"'&&v!=="'")throw U(v);N.push(D()),A(v),v=X()}while(v==='"'||v==="'");return N.join("")}function Re(N){var v=D();switch(v){case"'":case'"':return he(v),pe();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return ze(v,!0)}catch{if(C.test(v))return v;throw U(v,"value")}}function $e(N,v){var E,P;do v&&((E=X())==='"'||E==="'")?N.push(pe()):N.push([P=tt(D()),A("to",!0)?tt(D()):P]);while(A(",",!0));A(";")}function ze(N,v){var E=1;switch(N.charAt(0)==="-"&&(E=-1,N=N.substring(1)),N){case"inf":case"INF":case"Inf":return E*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(m.test(N))return E*parseInt(N,10);if(w.test(N))return E*parseInt(N,16);if(b.test(N))return E*parseInt(N,8);if(S.test(N))return E*parseFloat(N);throw U(N,"number",v)}function tt(N,v){switch(N){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!v&&N.charAt(0)==="-")throw U(N,"id");if(y.test(N))return parseInt(N,10);if(_.test(N))return parseInt(N,16);if(k.test(N))return parseInt(N,8);throw U(N,"id")}function Kt(){if(ce!==e)throw U("package");if(ce=D(),!C.test(ce))throw U(ce,"name");ue=ue.define(ce),A(";")}function Rt(){var N=X(),v;switch(N){case"weak":v=re||(re=[]),D();break;case"public":D();default:v=$||($=[]);break}N=pe(),A(";"),v.push(N)}function rt(){if(A("="),K=pe(),se=K==="proto3",!se&&K!=="proto2")throw U(K,"syntax");A(";")}function Je(N,v){switch(v){case"option":return We(N,v),A(";"),!0;case"message":return Qr(N,v),!0;case"enum":return Ni(N,v),!0;case"service":return Xr(N,v),!0;case"extend":return Mi(N,v),!0}return!1}function Ge(N,v,E){var P=ee.line;if(N&&(N.comment=ne(),N.filename=R.filename),A("{",!0)){for(var V;(V=D())!=="}";)v(V);A(";",!0)}else E&&E(),A(";"),N&&typeof N.comment!="string"&&(N.comment=ne(P))}function Qr(N,v){if(!O.test(v=D()))throw U(v,"type name");var E=new l(v);Ge(E,function(P){if(!Je(E,P))switch(P){case"map":Ci(E);break;case"required":case"optional":case"repeated":mt(E,P);break;case"oneof":Ri(E,P);break;case"extensions":$e(E.extensions||(E.extensions=[]));break;case"reserved":$e(E.reserved||(E.reserved=[]),!0);break;default:if(!se||!C.test(P))throw U(P);he(P),mt(E,"optional");break}}),N.add(E)}function mt(N,v,E){var P=D();if(P==="group"){Ii(N,v);return}if(!C.test(P))throw U(P,"type");var V=D();if(!O.test(V))throw U(V,"name");V=me(V),A("=");var Z=new a(V,tt(D()),P,v,E);Ge(Z,function(H){if(H==="option")We(Z,H),A(";");else throw U(H)},function(){Nt(Z)}),N.add(Z),!se&&Z.repeated&&(g.packed[P]!==e||g.basic[P]===e)&&Z.setOption("packed",!1,!0)}function Ii(N,v){var E=D();if(!O.test(E))throw U(E,"name");var P=p.lcFirst(E);E===P&&(E=p.ucFirst(E)),A("=");var V=tt(D()),Z=new l(E);Z.group=!0;var H=new a(P,V,E,v);H.filename=R.filename,Ge(Z,function(Ne){switch(Ne){case"option":We(Z,Ne),A(";");break;case"required":case"optional":case"repeated":mt(Z,Ne);break;default:throw U(Ne)}}),N.add(Z).add(H)}function Ci(N){A("<");var v=D();if(g.mapKey[v]===e)throw U(v,"type");A(",");var E=D();if(!C.test(E))throw U(E,"type");A(">");var P=D();if(!O.test(P))throw U(P,"name");A("=");var V=new u(me(P),tt(D()),v,E);Ge(V,function(Z){if(Z==="option")We(V,Z),A(";");else throw U(Z)},function(){Nt(V)}),N.add(V)}function Ri(N,v){if(!O.test(v=D()))throw U(v,"name");var E=new c(me(v));Ge(E,function(P){P==="option"?(We(E,P),A(";")):(he(P),mt(E,"optional"))}),N.add(E)}function Ni(N,v){if(!O.test(v=D()))throw U(v,"name");var E=new h(v);Ge(E,function(P){switch(P){case"option":We(E,P),A(";");break;case"reserved":$e(E.reserved||(E.reserved=[]),!0);break;default:Pi(E,P)}}),N.add(E)}function Pi(N,v){if(!O.test(v))throw U(v,"name");A("=");var E=tt(D(),!0),P={};Ge(P,function(V){if(V==="option")We(P,V),A(";");else throw U(V)},function(){Nt(P)}),N.add(v,E,P.comment)}function We(N,v){var E=A("(",!0);if(!C.test(v=D()))throw U(v,"name");var P=v;E&&(A(")"),P="("+P+")",v=X(),F.test(v)&&(P+=v,D())),A("="),wr(N,P)}function wr(N,v){if(A("{",!0))do{if(!O.test(Ee=D()))throw U(Ee,"name");X()==="{"?wr(N,v+"."+Ee):(A(":"),X()==="{"?wr(N,v+"."+Ee):yt(N,v+"."+Ee,Re()))}while(!A("}",!0));else yt(N,v,Re())}function yt(N,v,E){N.setOption&&N.setOption(v,E)}function Nt(N){if(A("[",!0)){do We(N,"option");while(A(",",!0));A("]")}return N}function Xr(N,v){if(!O.test(v=D()))throw U(v,"service name");var E=new f(v);Ge(E,function(P){if(!Je(E,P))if(P==="rpc")Fi(E,P);else throw U(P)}),N.add(E)}function Fi(N,v){var E=v;if(!O.test(v=D()))throw U(v,"name");var P=v,V,Z,H,Ne;if(A("("),A("stream",!0)&&(Z=!0),!C.test(v=D())||(V=v,A(")"),A("returns"),A("("),A("stream",!0)&&(Ne=!0),!C.test(v=D())))throw U(v);H=v,A(")");var nt=new d(P,E,V,H,Z,Ne);Ge(nt,function(Oe){if(Oe==="option")We(nt,Oe),A(";");else throw U(Oe)}),N.add(nt)}function Mi(N,v){if(!C.test(v=D()))throw U(v,"reference");var E=v;Ge(null,function(P){switch(P){case"required":case"repeated":case"optional":mt(N,P,E);break;default:if(!se||!C.test(P))throw U(P);he(P),mt(N,"optional",E);break}})}for(var Ee;(Ee=D())!==null;)switch(Ee){case"package":if(!te)throw U(Ee);Kt();break;case"import":if(!te)throw U(Ee);Rt();break;case"syntax":if(!te)throw U(Ee);rt();break;case"option":if(!te)throw U(Ee);We(ue,Ee),A(";");break;default:if(Je(ue,Ee)){te=!1;continue}throw U(Ee)}return R.filename=null,{package:ce,imports:$,weakImports:re,syntax:K,root:B}}},{15:15,16:16,20:20,22:22,25:25,29:29,33:33,34:34,35:35,36:36,37:37}],27:[function(t,n,i){n.exports=c;var s=t(39),o,l=s.LongBits,a=s.utf8;function u(p,m){return RangeError("index out of range: "+p.pos+" + "+(m||1)+" > "+p.len)}function c(p){this.buf=p,this.pos=0,this.len=p.length}var h=typeof Uint8Array<"u"?function(p){if(p instanceof Uint8Array||Array.isArray(p))return new c(p);throw Error("illegal buffer")}:function(p){if(Array.isArray(p))return new c(p);throw Error("illegal buffer")};c.create=s.Buffer?function(p){return(c.create=function(m){return s.Buffer.isBuffer(m)?new o(m):h(m)})(p)}:h,c.prototype._slice=s.Array.prototype.subarray||s.Array.prototype.slice,c.prototype.uint32=function(){var p=4294967295;return function(){if(p=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(p=(p|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(p=(p|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(p=(p|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(p=(p|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return p;if((this.pos+=5)>this.len)throw this.pos=this.len,u(this,10);return p}}(),c.prototype.int32=function(){return this.uint32()|0},c.prototype.sint32=function(){var p=this.uint32();return p>>>1^-(p&1)|0};function f(){var p=new l(0,0),m=0;if(this.len-this.pos>4){for(;m<4;++m)if(p.lo=(p.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return p;if(p.lo=(p.lo|(this.buf[this.pos]&127)<<28)>>>0,p.hi=(p.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return p;m=0}else{for(;m<3;++m){if(this.pos>=this.len)throw u(this);if(p.lo=(p.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return p}return p.lo=(p.lo|(this.buf[this.pos++]&127)<<m*7)>>>0,p}if(this.len-this.pos>4){for(;m<5;++m)if(p.hi=(p.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return p}else for(;m<5;++m){if(this.pos>=this.len)throw u(this);if(p.hi=(p.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return p}throw Error("invalid varint encoding")}c.prototype.bool=function(){return this.uint32()!==0};function d(p,m){return(p[m-4]|p[m-3]<<8|p[m-2]<<16|p[m-1]<<24)>>>0}c.prototype.fixed32=function(){if(this.pos+4>this.len)throw u(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw u(this,4);return d(this.buf,this.pos+=4)|0};function g(){if(this.pos+8>this.len)throw u(this,8);return new l(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.prototype.float=function(){if(this.pos+4>this.len)throw u(this,4);var p=s.float.readFloatLE(this.buf,this.pos);return this.pos+=4,p},c.prototype.double=function(){if(this.pos+8>this.len)throw u(this,4);var p=s.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,p},c.prototype.bytes=function(){var p=this.uint32(),m=this.pos,y=this.pos+p;if(y>this.len)throw u(this,p);return this.pos+=p,Array.isArray(this.buf)?this.buf.slice(m,y):m===y?new this.buf.constructor(0):this._slice.call(this.buf,m,y)},c.prototype.string=function(){var p=this.bytes();return a.read(p,0,p.length)},c.prototype.skip=function(p){if(typeof p=="number"){if(this.pos+p>this.len)throw u(this,p);this.pos+=p}else do if(this.pos>=this.len)throw u(this);while(this.buf[this.pos++]&128);return this},c.prototype.skipType=function(p){switch(p){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:do{if((p=this.uint32()&7)===4)break;this.skipType(p)}while(!0);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+p+" at offset "+this.pos)}return this},c._configure=function(p){o=p;var m=s.Long?"toLong":"toNumber";s.merge(c.prototype,{int64:function(){return f.call(this)[m](!1)},uint64:function(){return f.call(this)[m](!0)},sint64:function(){return f.call(this).zzDecode()[m](!1)},fixed64:function(){return g.call(this)[m](!0)},sfixed64:function(){return g.call(this)[m](!1)}})}},{39:39}],28:[function(t,n,i){n.exports=l;var s=t(27);(l.prototype=Object.create(s.prototype)).constructor=l;var o=t(39);function l(a){s.call(this,a)}o.Buffer&&(l.prototype._slice=o.Buffer.prototype.slice),l.prototype.string=function(){var a=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+a,this.len))}},{27:27,39:39}],29:[function(t,n,i){n.exports=d;var s=t(23);((d.prototype=Object.create(s.prototype)).constructor=d).className="Root";var o=t(16),l=t(15),a=t(25),u=t(37),c,h,f;function d(y){s.call(this,"",y),this.deferred=[],this.files=[]}d.fromJSON=function(y,w){return w||(w=new d),y.options&&w.setOptions(y.options),w.addJSON(y.nested)},d.prototype.resolvePath=u.path.resolve;function g(){}d.prototype.load=function y(w,_,b){typeof _=="function"&&(b=_,_=e);var k=this;if(!b)return u.asPromise(y,k,w,_);var S=b===g;function O(W,ee){if(b){var D=b;if(b=null,S)throw W;D(W,ee)}}function C(W,ee){try{if(u.isString(ee)&&ee.charAt(0)==="{"&&(ee=JSON.parse(ee)),!u.isString(ee))k.setOptions(ee.options).addJSON(ee.nested);else{h.filename=W;var D=h(ee,k,_),he,X=0;if(D.imports)for(;X<D.imports.length;++X)(he=k.resolvePath(W,D.imports[X]))&&F(he);if(D.weakImports)for(X=0;X<D.weakImports.length;++X)(he=k.resolvePath(W,D.weakImports[X]))&&F(he,!0)}}catch(A){O(A)}!S&&!R&&O(null,k)}function F(W,ee){var D=W.lastIndexOf("google/protobuf/");if(D>-1){var he=W.substring(D);he in f&&(W=he)}if(!(k.files.indexOf(W)>-1)){if(k.files.push(W),W in f){S?C(W,f[W]):(++R,setTimeout(function(){--R,C(W,f[W])}));return}if(S){var X;try{X=u.fs.readFileSync(W).toString("utf8")}catch(A){ee||O(A);return}C(W,X)}else++R,u.fetch(W,function(A,ne){if(--R,!!b){if(A){ee?R||O(null,k):O(A);return}C(W,ne)}})}}var R=0;u.isString(w)&&(w=[w]);for(var Y=0,B;Y<w.length;++Y)(B=k.resolvePath("",w[Y]))&&F(B);return S?k:(R||O(null,k),e)},d.prototype.loadSync=function(y,w){if(!u.isNode)throw Error("not supported");return this.load(y,w,g)},d.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(y){return"'extend "+y.extend+"' in "+y.parent.fullName}).join(", "));return s.prototype.resolveAll.call(this)};var p=/^[A-Z]/;function m(y,w){var _=w.parent.lookup(w.extend);if(_){var b=new o(w.fullName,w.id,w.type,w.rule,e,w.options);return b.declaringField=w,w.extensionField=b,_.add(b),!0}return!1}d.prototype._handleAdd=function(y){if(y instanceof o)y.extend!==e&&!y.extensionField&&(m(this,y)||this.deferred.push(y));else if(y instanceof l)p.test(y.name)&&(y.parent[y.name]=y.values);else if(!(y instanceof a)){if(y instanceof c)for(var w=0;w<this.deferred.length;)m(this,this.deferred[w])?this.deferred.splice(w,1):++w;for(var _=0;_<y.nestedArray.length;++_)this._handleAdd(y._nestedArray[_]);p.test(y.name)&&(y.parent[y.name]=y)}},d.prototype._handleRemove=function(y){if(y instanceof o){if(y.extend!==e)if(y.extensionField)y.extensionField.parent.remove(y.extensionField),y.extensionField=null;else{var w=this.deferred.indexOf(y);w>-1&&this.deferred.splice(w,1)}}else if(y instanceof l)p.test(y.name)&&delete y.parent[y.name];else if(y instanceof s){for(var _=0;_<y.nestedArray.length;++_)this._handleRemove(y._nestedArray[_]);p.test(y.name)&&delete y.parent[y.name]}},d._configure=function(y,w,_){c=y,h=w,f=_}},{15:15,16:16,23:23,25:25,37:37}],30:[function(t,n,i){n.exports={}},{}],31:[function(t,n,i){var s=i;s.Service=t(32)},{32:32}],32:[function(t,n,i){n.exports=o;var s=t(39);(o.prototype=Object.create(s.EventEmitter.prototype)).constructor=o;function o(l,a,u){if(typeof l!="function")throw TypeError("rpcImpl must be a function");s.EventEmitter.call(this),this.rpcImpl=l,this.requestDelimited=!!a,this.responseDelimited=!!u}o.prototype.rpcCall=function l(a,u,c,h,f){if(!h)throw TypeError("request must be specified");var d=this;if(!f)return s.asPromise(l,d,a,u,c,h);if(!d.rpcImpl)return setTimeout(function(){f(Error("already ended"))},0),e;try{return d.rpcImpl(a,u[d.requestDelimited?"encodeDelimited":"encode"](h).finish(),function(g,p){if(g)return d.emit("error",g,a),f(g);if(p===null)return d.end(!0),e;if(!(p instanceof c))try{p=c[d.responseDelimited?"decodeDelimited":"decode"](p)}catch(m){return d.emit("error",m,a),f(m)}return d.emit("data",p,a),f(null,p)})}catch(g){return d.emit("error",g,a),setTimeout(function(){f(g)},0),e}},o.prototype.end=function(l){return this.rpcImpl&&(l||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{39:39}],33:[function(t,n,i){n.exports=u;var s=t(23);((u.prototype=Object.create(s.prototype)).constructor=u).className="Service";var o=t(22),l=t(37),a=t(31);function u(h,f){s.call(this,h,f),this.methods={},this._methodsArray=null}u.fromJSON=function(h,f){var d=new u(h,f.options);if(f.methods)for(var g=Object.keys(f.methods),p=0;p<g.length;++p)d.add(o.fromJSON(g[p],f.methods[g[p]]));return f.nested&&d.addJSON(f.nested),d.comment=f.comment,d},u.prototype.toJSON=function(h){var f=s.prototype.toJSON.call(this,h),d=h?!!h.keepComments:!1;return l.toObject(["options",f&&f.options||e,"methods",s.arrayToJSON(this.methodsArray,h)||{},"nested",f&&f.nested||e,"comment",d?this.comment:e])},Object.defineProperty(u.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=l.toArray(this.methods))}});function c(h){return h._methodsArray=null,h}u.prototype.get=function(h){return this.methods[h]||s.prototype.get.call(this,h)},u.prototype.resolveAll=function(){for(var h=this.methodsArray,f=0;f<h.length;++f)h[f].resolve();return s.prototype.resolve.call(this)},u.prototype.add=function(h){if(this.get(h.name))throw Error("duplicate name '"+h.name+"' in "+this);return h instanceof o?(this.methods[h.name]=h,h.parent=this,c(this)):s.prototype.add.call(this,h)},u.prototype.remove=function(h){if(h instanceof o){if(this.methods[h.name]!==h)throw Error(h+" is not a member of "+this);return delete this.methods[h.name],h.parent=null,c(this)}return s.prototype.remove.call(this,h)},u.prototype.create=function(h,f,d){for(var g=new a.Service(h,f,d),p=0,m;p<this.methodsArray.length;++p){var y=l.lcFirst((m=this._methodsArray[p]).resolve().name).replace(/[^$\w_]/g,"");g[y]=l.codegen(["r","c"],l.isReserved(y)?y+"_":y)("return this.rpcCall(m,q,s,r,c)")({m,q:m.resolvedRequestType.ctor,s:m.resolvedResponseType.ctor})}return g}},{22:22,23:23,31:31,37:37}],34:[function(t,n,i){n.exports=p;var s=/[\s{}=;:[\],'"()<>]/g,o=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,l=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,a=/^ *[*/]+ */,u=/^\s*\*?\/*/,c=/\n/g,h=/\s/,f=/\\(.?)/g,d={0:"\0",r:"\r",n:`
|
|
21
|
-
`,t:" "};function g
|
|
22
|
-
`){
|
|
23
|
-
`).trim()}function
|
|
24
|
-
`;)re++;return re}function
|
|
25
|
-
`&&++b,++w===_)return null;if(
|
|
26
|
-
`;)if(w===_)return null;++w,
|
|
27
|
-
`&&++b,++w===_)throw Y("comment");re=K,K=W(w)}while(re!=="*"||K!=="/");++w,ue&&ee(se,w-2),$=!0}else return"/"}}while($);var me=w;s.lastIndex=0;var U=s.test(W(me++));if(!U)for(;me<_&&!s.test(W(me));)++me;var pe=m.substring(w,w=me);return(pe==='"'||pe==="'")&&(R=pe),pe}function A($){F.push($)}function ne(){if(!F.length){var $=X();if($===null)return null;A($)}return F[0]}function te($,re){var K=ne(),se=K===$;if(se)return X(),!0;if(!re)throw Y("token '"+K+"', '"+$+"' expected");return!1}function ce($){var re=null;return $===e?O===b-1&&(y||k==="*"||C)&&(re=S):(O<$&&ne(),O===$&&!C&&(y||k==="/")&&(re=S)),re}return Object.defineProperty({next:X,peek:ne,push:A,skip:te,cmnt:ce},"line",{get:function(){return b}})}},{}],35:[function(t,n,i){n.exports=b;var s=t(23);((b.prototype=Object.create(s.prototype)).constructor=b).className="Type";var o=t(15),l=t(25),a=t(16),u=t(20),c=t(33),h=t(21),f=t(27),d=t(42),g=t(37),p=t(14),m=t(13),y=t(40),w=t(12),_=t(41);function b(S,O){s.call(this,S,O),this.fields={},this.oneofs=e,this.extensions=e,this.reserved=e,this.group=e,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(b.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var S=Object.keys(this.fields),O=0;O<S.length;++O){var C=this.fields[S[O]],F=C.id;if(this._fieldsById[F])throw Error("duplicate id "+F+" in "+this);this._fieldsById[F]=C}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=g.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=g.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=b.generateConstructor(this)())},set:function(S){var O=S.prototype;O instanceof h||((S.prototype=new h).constructor=S,g.merge(S.prototype,O)),S.$type=S.prototype.$type=this,g.merge(S,h,!0),this._ctor=S;for(var C=0;C<this.fieldsArray.length;++C)this._fieldsArray[C].resolve();var F={};for(C=0;C<this.oneofsArray.length;++C)F[this._oneofsArray[C].resolve().name]={get:g.oneOfGetter(this._oneofsArray[C].oneof),set:g.oneOfSetter(this._oneofsArray[C].oneof)};C&&Object.defineProperties(S.prototype,F)}}}),b.generateConstructor=function(S){for(var O=g.codegen(["p"],S.name),C=0,F;C<S.fieldsArray.length;++C)(F=S._fieldsArray[C]).map?O("this%s={}",g.safeProp(F.name)):F.repeated&&O("this%s=[]",g.safeProp(F.name));return O("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")};function k(S){return S._fieldsById=S._fieldsArray=S._oneofsArray=null,delete S.encode,delete S.decode,delete S.verify,S}b.fromJSON=function(S,O){var C=new b(S,O.options);C.extensions=O.extensions,C.reserved=O.reserved;for(var F=Object.keys(O.fields),R=0;R<F.length;++R)C.add((typeof O.fields[F[R]].keyType<"u"?u.fromJSON:a.fromJSON)(F[R],O.fields[F[R]]));if(O.oneofs)for(F=Object.keys(O.oneofs),R=0;R<F.length;++R)C.add(l.fromJSON(F[R],O.oneofs[F[R]]));if(O.nested)for(F=Object.keys(O.nested),R=0;R<F.length;++R){var Y=O.nested[F[R]];C.add((Y.id!==e?a.fromJSON:Y.fields!==e?b.fromJSON:Y.values!==e?o.fromJSON:Y.methods!==e?c.fromJSON:s.fromJSON)(F[R],Y))}return O.extensions&&O.extensions.length&&(C.extensions=O.extensions),O.reserved&&O.reserved.length&&(C.reserved=O.reserved),O.group&&(C.group=!0),O.comment&&(C.comment=O.comment),C},b.prototype.toJSON=function(S){var O=s.prototype.toJSON.call(this,S),C=S?!!S.keepComments:!1;return g.toObject(["options",O&&O.options||e,"oneofs",s.arrayToJSON(this.oneofsArray,S),"fields",s.arrayToJSON(this.fieldsArray.filter(function(F){return!F.declaringField}),S)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:e,"reserved",this.reserved&&this.reserved.length?this.reserved:e,"group",this.group||e,"nested",O&&O.nested||e,"comment",C?this.comment:e])},b.prototype.resolveAll=function(){for(var S=this.fieldsArray,O=0;O<S.length;)S[O++].resolve();var C=this.oneofsArray;for(O=0;O<C.length;)C[O++].resolve();return s.prototype.resolveAll.call(this)},b.prototype.get=function(S){return this.fields[S]||this.oneofs&&this.oneofs[S]||this.nested&&this.nested[S]||null},b.prototype.add=function(S){if(this.get(S.name))throw Error("duplicate name '"+S.name+"' in "+this);if(S instanceof a&&S.extend===e){if(this._fieldsById?this._fieldsById[S.id]:this.fieldsById[S.id])throw Error("duplicate id "+S.id+" in "+this);if(this.isReservedId(S.id))throw Error("id "+S.id+" is reserved in "+this);if(this.isReservedName(S.name))throw Error("name '"+S.name+"' is reserved in "+this);return S.parent&&S.parent.remove(S),this.fields[S.name]=S,S.message=this,S.onAdd(this),k(this)}return S instanceof l?(this.oneofs||(this.oneofs={}),this.oneofs[S.name]=S,S.onAdd(this),k(this)):s.prototype.add.call(this,S)},b.prototype.remove=function(S){if(S instanceof a&&S.extend===e){if(!this.fields||this.fields[S.name]!==S)throw Error(S+" is not a member of "+this);return delete this.fields[S.name],S.parent=null,S.onRemove(this),k(this)}if(S instanceof l){if(!this.oneofs||this.oneofs[S.name]!==S)throw Error(S+" is not a member of "+this);return delete this.oneofs[S.name],S.parent=null,S.onRemove(this),k(this)}return s.prototype.remove.call(this,S)},b.prototype.isReservedId=function(S){return s.isReservedId(this.reserved,S)},b.prototype.isReservedName=function(S){return s.isReservedName(this.reserved,S)},b.prototype.create=function(S){return new this.ctor(S)},b.prototype.setup=function(){for(var S=this.fullName,O=[],C=0;C<this.fieldsArray.length;++C)O.push(this._fieldsArray[C].resolve().resolvedType);this.encode=p(this)({Writer:d,types:O,util:g}),this.decode=m(this)({Reader:f,types:O,util:g}),this.verify=y(this)({types:O,util:g}),this.fromObject=w.fromObject(this)({types:O,util:g}),this.toObject=w.toObject(this)({types:O,util:g});var F=_[S];if(F){var R=Object.create(this);R.fromObject=this.fromObject,this.fromObject=F.fromObject.bind(R),R.toObject=this.toObject,this.toObject=F.toObject.bind(R)}return this},b.prototype.encode=function(S,O){return this.setup().encode(S,O)},b.prototype.encodeDelimited=function(S,O){return this.encode(S,O&&O.len?O.fork():O).ldelim()},b.prototype.decode=function(S,O){return this.setup().decode(S,O)},b.prototype.decodeDelimited=function(S){return S instanceof f||(S=f.create(S)),this.decode(S,S.uint32())},b.prototype.verify=function(S){return this.setup().verify(S)},b.prototype.fromObject=function(S){return this.setup().fromObject(S)},b.prototype.toObject=function(S,O){return this.setup().toObject(S,O)},b.d=function(S){return function(O){g.decorateType(O,S)}}},{12:12,13:13,14:14,15:15,16:16,20:20,21:21,23:23,25:25,27:27,33:33,37:37,40:40,41:41,42:42}],36:[function(t,n,i){var s=i,o=t(37),l=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function a(u,c){var h=0,f={};for(c|=0;h<u.length;)f[l[h+c]]=u[h++];return f}s.basic=a([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),s.defaults=a([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",o.emptyArray,null]),s.long=a([0,0,0,1,1],7),s.mapKey=a([0,0,0,5,5,0,0,0,1,1,0,2],2),s.packed=a([1,5,0,0,0,5,5,0,0,0,1,1,0])},{37:37}],37:[function(t,n,i){var s=n.exports=t(39),o=t(30),l,a;s.codegen=t(3),s.fetch=t(5),s.path=t(8),s.fs=s.inquire("fs"),s.toArray=function(d){if(d){for(var g=Object.keys(d),p=new Array(g.length),m=0;m<g.length;)p[m]=d[g[m++]];return p}return[]},s.toObject=function(d){for(var g={},p=0;p<d.length;){var m=d[p++],y=d[p++];y!==e&&(g[m]=y)}return g};var u=/\\/g,c=/"/g;s.isReserved=function(d){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(d)},s.safeProp=function(d){return!/^[$\w_]+$/.test(d)||s.isReserved(d)?'["'+d.replace(u,"\\\\").replace(c,'\\"')+'"]':"."+d},s.ucFirst=function(d){return d.charAt(0).toUpperCase()+d.substring(1)};var h=/_([a-z])/g;s.camelCase=function(d){return d.substring(0,1)+d.substring(1).replace(h,function(g,p){return p.toUpperCase()})},s.compareFieldsById=function(d,g){return d.id-g.id},s.decorateType=function(d,g){if(d.$type)return g&&d.$type.name!==g&&(s.decorateRoot.remove(d.$type),d.$type.name=g,s.decorateRoot.add(d.$type)),d.$type;l||(l=t(35));var p=new l(g||d.name);return s.decorateRoot.add(p),p.ctor=d,Object.defineProperty(d,"$type",{value:p,enumerable:!1}),Object.defineProperty(d.prototype,"$type",{value:p,enumerable:!1}),p};var f=0;s.decorateEnum=function(d){if(d.$type)return d.$type;a||(a=t(15));var g=new a("Enum"+f++,d);return s.decorateRoot.add(g),Object.defineProperty(d,"$type",{value:g,enumerable:!1}),g},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(t(29)))}})},{15:15,29:29,3:3,30:30,35:35,39:39,5:5,8:8}],38:[function(t,n,i){n.exports=o;var s=t(39);function o(c,h){this.lo=c>>>0,this.hi=h>>>0}var l=o.zero=new o(0,0);l.toNumber=function(){return 0},l.zzEncode=l.zzDecode=function(){return this},l.length=function(){return 1};var a=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(c){if(c===0)return l;var h=c<0;h&&(c=-c);var f=c>>>0,d=(c-f)/4294967296>>>0;return h&&(d=~d>>>0,f=~f>>>0,++f>4294967295&&(f=0,++d>4294967295&&(d=0))),new o(f,d)},o.from=function(c){if(typeof c=="number")return o.fromNumber(c);if(s.isString(c))if(s.Long)c=s.Long.fromString(c);else return o.fromNumber(parseInt(c,10));return c.low||c.high?new o(c.low>>>0,c.high>>>0):l},o.prototype.toNumber=function(c){if(!c&&this.hi>>>31){var h=~this.lo+1>>>0,f=~this.hi>>>0;return h||(f=f+1>>>0),-(h+f*4294967296)}return this.lo+this.hi*4294967296},o.prototype.toLong=function(c){return s.Long?new s.Long(this.lo|0,this.hi|0,!!c):{low:this.lo|0,high:this.hi|0,unsigned:!!c}};var u=String.prototype.charCodeAt;o.fromHash=function(c){return c===a?l:new o((u.call(c,0)|u.call(c,1)<<8|u.call(c,2)<<16|u.call(c,3)<<24)>>>0,(u.call(c,4)|u.call(c,5)<<8|u.call(c,6)<<16|u.call(c,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var c=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^c)>>>0,this.lo=(this.lo<<1^c)>>>0,this},o.prototype.zzDecode=function(){var c=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^c)>>>0,this.hi=(this.hi>>>1^c)>>>0,this},o.prototype.length=function(){var c=this.lo,h=(this.lo>>>28|this.hi<<4)>>>0,f=this.hi>>>24;return f===0?h===0?c<16384?c<128?1:2:c<2097152?3:4:h<16384?h<128?5:6:h<2097152?7:8:f<128?9:10}},{39:39}],39:[function(t,n,i){var s=i;s.asPromise=t(1),s.base64=t(2),s.EventEmitter=t(4),s.float=t(6),s.inquire=t(7),s.utf8=t(10),s.pool=t(9),s.LongBits=t(38),s.emptyArray=Object.freeze?Object.freeze([]):[],s.emptyObject=Object.freeze?Object.freeze({}):{},s.isNode=!!(Ct.process&&Ct.process.versions&&Ct.process.versions.node),s.isInteger=Number.isInteger||function(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a},s.isString=function(a){return typeof a=="string"||a instanceof String},s.isObject=function(a){return a&&typeof a=="object"},s.isset=s.isSet=function(a,u){var c=a[u];return c!=null&&a.hasOwnProperty(u)?typeof c!="object"||(Array.isArray(c)?c.length:Object.keys(c).length)>0:!1},s.Buffer=function(){try{var a=s.inquire("buffer").Buffer;return a.prototype.utf8Write?a:null}catch{return null}}(),s._Buffer_from=null,s._Buffer_allocUnsafe=null,s.newBuffer=function(a){return typeof a=="number"?s.Buffer?s._Buffer_allocUnsafe(a):new s.Array(a):s.Buffer?s._Buffer_from(a):typeof Uint8Array>"u"?a:new Uint8Array(a)},s.Array=typeof Uint8Array<"u"?Uint8Array:Array,s.Long=Ct.dcodeIO&&Ct.dcodeIO.Long||s.inquire("long"),s.key2Re=/^true|false|0|1$/,s.key32Re=/^-?(?:0|[1-9][0-9]*)$/,s.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,s.longToHash=function(a){return a?s.LongBits.from(a).toHash():s.LongBits.zeroHash},s.longFromHash=function(a,u){var c=s.LongBits.fromHash(a);return s.Long?s.Long.fromBits(c.lo,c.hi,u):c.toNumber(!!u)};function o(a,u,c){for(var h=Object.keys(u),f=0;f<h.length;++f)(a[h[f]]===e||!c)&&(a[h[f]]=u[h[f]]);return a}s.merge=o,s.lcFirst=function(a){return a.charAt(0).toLowerCase()+a.substring(1)};function l(a){function u(c,h){if(!(this instanceof u))return new u(c,h);Object.defineProperty(this,"message",{get:function(){return c}}),Error.captureStackTrace?Error.captureStackTrace(this,u):Object.defineProperty(this,"stack",{value:new Error().stack||""}),h&&o(this,h)}return(u.prototype=Object.create(Error.prototype)).constructor=u,Object.defineProperty(u.prototype,"name",{get:function(){return a}}),u.prototype.toString=function(){return this.name+": "+this.message},u}s.newError=l,s.ProtocolError=l("ProtocolError"),s.oneOfGetter=function(a){for(var u={},c=0;c<a.length;++c)u[a[c]]=1;return function(){for(var h=Object.keys(this),f=h.length-1;f>-1;--f)if(u[h[f]]===1&&this[h[f]]!==e&&this[h[f]]!==null)return h[f]}},s.oneOfSetter=function(a){return function(u){for(var c=0;c<a.length;++c)a[c]!==u&&delete this[a[c]]}},s.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},s._configure=function(){var a=s.Buffer;if(!a){s._Buffer_from=s._Buffer_allocUnsafe=null;return}s._Buffer_from=a.from!==Uint8Array.from&&a.from||function(u,c){return new a(u,c)},s._Buffer_allocUnsafe=a.allocUnsafe||function(u){return new a(u)}}},{1:1,10:10,2:2,38:38,4:4,6:6,7:7,9:9}],40:[function(t,n,i){n.exports=c;var s=t(15),o=t(37);function l(h,f){return h.name+": "+f+(h.repeated&&f!=="array"?"[]":h.map&&f!=="object"?"{k:"+h.keyType+"}":"")+" expected"}function a(h,f,d,g){if(f.resolvedType)if(f.resolvedType instanceof s){h("switch(%s){",g)("default:")("return%j",l(f,"enum value"));for(var p=Object.keys(f.resolvedType.values),m=0;m<p.length;++m)h("case %i:",f.resolvedType.values[p[m]]);h("break")("}")}else h("{")("var e=types[%i].verify(%s);",d,g)("if(e)")("return%j+e",f.name+".")("}");else switch(f.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":h("if(!util.isInteger(%s))",g)("return%j",l(f,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":h("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",g,g,g,g)("return%j",l(f,"integer|Long"));break;case"float":case"double":h('if(typeof %s!=="number")',g)("return%j",l(f,"number"));break;case"bool":h('if(typeof %s!=="boolean")',g)("return%j",l(f,"boolean"));break;case"string":h("if(!util.isString(%s))",g)("return%j",l(f,"string"));break;case"bytes":h('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',g,g,g)("return%j",l(f,"buffer"));break}return h}function u(h,f,d){switch(f.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":h("if(!util.key32Re.test(%s))",d)("return%j",l(f,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":h("if(!util.key64Re.test(%s))",d)("return%j",l(f,"integer|Long key"));break;case"bool":h("if(!util.key2Re.test(%s))",d)("return%j",l(f,"boolean key"));break}return h}function c(h){var f=o.codegen(["m"],h.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),d=h.oneofsArray,g={};d.length&&f("var p={}");for(var p=0;p<h.fieldsArray.length;++p){var m=h._fieldsArray[p].resolve(),y="m"+o.safeProp(m.name);if(m.optional&&f("if(%s!=null&&m.hasOwnProperty(%j)){",y,m.name),m.map)f("if(!util.isObject(%s))",y)("return%j",l(m,"object"))("var k=Object.keys(%s)",y)("for(var i=0;i<k.length;++i){"),u(f,m,"k[i]"),a(f,m,p,y+"[k[i]]")("}");else if(m.repeated)f("if(!Array.isArray(%s))",y)("return%j",l(m,"array"))("for(var i=0;i<%s.length;++i){",y),a(f,m,p,y+"[i]")("}");else{if(m.partOf){var w=o.safeProp(m.partOf.name);g[m.partOf.name]===1&&f("if(p%s===1)",w)("return%j",m.partOf.name+": multiple values"),g[m.partOf.name]=1,f("p%s=1",w)}a(f,m,p,y)}m.optional&&f("}")}return f("return null")}},{15:15,37:37}],41:[function(t,n,i){var s=i,o=t(21);s[".google.protobuf.Any"]={fromObject:function(l){if(l&&l["@type"]){var a=this.lookup(l["@type"]);if(a){var u=l["@type"].charAt(0)==="."?l["@type"].substr(1):l["@type"];return this.create({type_url:"/"+u,value:a.encode(a.fromObject(l)).finish()})}}return this.fromObject(l)},toObject:function(l,a){if(a&&a.json&&l.type_url&&l.value){var u=l.type_url.substring(l.type_url.lastIndexOf("/")+1),c=this.lookup(u);c&&(l=c.decode(l.value))}if(!(l instanceof this.ctor)&&l instanceof o){var h=l.$type.toObject(l,a);return h["@type"]=l.$type.fullName,h}return this.toObject(l,a)}}},{21:21}],42:[function(t,n,i){n.exports=d;var s=t(39),o,l=s.LongBits,a=s.base64,u=s.utf8;function c(b,k,S){this.fn=b,this.len=k,this.next=e,this.val=S}function h(){}function f(b){this.head=b.head,this.tail=b.tail,this.len=b.len,this.next=b.states}function d(){this.len=0,this.head=new c(h,0,0),this.tail=this.head,this.states=null}d.create=s.Buffer?function(){return(d.create=function(){return new o})()}:function(){return new d},d.alloc=function(b){return new s.Array(b)},s.Array!==Array&&(d.alloc=s.pool(d.alloc,s.Array.prototype.subarray)),d.prototype._push=function(b,k,S){return this.tail=this.tail.next=new c(b,k,S),this.len+=k,this};function g(b,k,S){k[S]=b&255}function p(b,k,S){for(;b>127;)k[S++]=b&127|128,b>>>=7;k[S]=b}function m(b,k){this.len=b,this.next=e,this.val=k}m.prototype=Object.create(c.prototype),m.prototype.fn=p,d.prototype.uint32=function(b){return this.len+=(this.tail=this.tail.next=new m((b=b>>>0)<128?1:b<16384?2:b<2097152?3:b<268435456?4:5,b)).len,this},d.prototype.int32=function(b){return b<0?this._push(y,10,l.fromNumber(b)):this.uint32(b)},d.prototype.sint32=function(b){return this.uint32((b<<1^b>>31)>>>0)};function y(b,k,S){for(;b.hi;)k[S++]=b.lo&127|128,b.lo=(b.lo>>>7|b.hi<<25)>>>0,b.hi>>>=7;for(;b.lo>127;)k[S++]=b.lo&127|128,b.lo=b.lo>>>7;k[S++]=b.lo}d.prototype.uint64=function(b){var k=l.from(b);return this._push(y,k.length(),k)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(b){var k=l.from(b).zzEncode();return this._push(y,k.length(),k)},d.prototype.bool=function(b){return this._push(g,1,b?1:0)};function w(b,k,S){k[S]=b&255,k[S+1]=b>>>8&255,k[S+2]=b>>>16&255,k[S+3]=b>>>24}d.prototype.fixed32=function(b){return this._push(w,4,b>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(b){var k=l.from(b);return this._push(w,4,k.lo)._push(w,4,k.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(b){return this._push(s.float.writeFloatLE,4,b)},d.prototype.double=function(b){return this._push(s.float.writeDoubleLE,8,b)};var _=s.Array.prototype.set?function(b,k,S){k.set(b,S)}:function(b,k,S){for(var O=0;O<b.length;++O)k[S+O]=b[O]};d.prototype.bytes=function(b){var k=b.length>>>0;if(!k)return this._push(g,1,0);if(s.isString(b)){var S=d.alloc(k=a.length(b));a.decode(b,S,0),b=S}return this.uint32(k)._push(_,k,b)},d.prototype.string=function(b){var k=u.length(b);return k?this.uint32(k)._push(u.write,k,b):this._push(g,1,0)},d.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new c(h,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(h,0,0),this.len=0),this},d.prototype.ldelim=function(){var b=this.head,k=this.tail,S=this.len;return this.reset().uint32(S),S&&(this.tail.next=b.next,this.tail=k,this.len+=S),this},d.prototype.finish=function(){for(var b=this.head.next,k=this.constructor.alloc(this.len),S=0;b;)b.fn(b.val,k,S),S+=b.len,b=b.next;return k},d._configure=function(b){o=b}},{39:39}],43:[function(t,n,i){n.exports=a;var s=t(42);(a.prototype=Object.create(s.prototype)).constructor=a;var o=t(39),l=o.Buffer;function a(){s.call(this)}a.alloc=function(h){return(a.alloc=o._Buffer_allocUnsafe)(h)};var u=l&&l.prototype instanceof Uint8Array&&l.prototype.set.name==="set"?function(h,f,d){f.set(h,d)}:function(h,f,d){if(h.copy)h.copy(f,d,0,h.length);else for(var g=0;g<h.length;)f[d++]=h[g++]};a.prototype.bytes=function(h){o.isString(h)&&(h=o._Buffer_from(h,"base64"));var f=h.length>>>0;return this.uint32(f),f&&this._push(u,f,h),this};function c(h,f,d){h.length<40?o.utf8.write(h,f,d):f.utf8Write(h,d)}a.prototype.string=function(h){var f=l.byteLength(h);return this.uint32(f),f&&this._push(c,f,h),this}},{39:39,42:42}]},{},[19])})()}(Ai)),Ai.exports}var Zh=Gh();const mr=ua(Zh);let oe=mr.Reader,Ce=mr.Writer,_e=mr.util;const j=mr.roots["push-server"]||(mr.roots["push-server"]={});j.RequestBatch=function(){function r(e){if(this.requests=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.requests=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.requests!=null&&e.requests.length)for(var n=0;n<e.requests.length;++n)j.Request.encode(e.requests[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.RequestBatch;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.requests&&i.requests.length||(i.requests=[]),i.requests.push(j.Request.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.Request=function(){function r(t){if(t)for(var n=Object.keys(t),i=0;i<n.length;++i)t[n[i]]!=null&&(this[n[i]]=t[n[i]])}r.prototype.incomingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:_e.oneOfGetter(e=["incomingMessages","channelStats","serverStats"]),set:_e.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=Ce.create()),t.incomingMessages!=null&&t.hasOwnProperty("incomingMessages")&&j.IncomingMessagesRequest.encode(t.incomingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&j.ChannelStatsRequest.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&j.ServerStatsRequest.encode(t.serverStats,n.uint32(26).fork()).ldelim(),n},r.decode=function(t,n){t instanceof oe||(t=oe.create(t));for(var i=n===void 0?t.len:t.pos+n,s=new j.Request;t.pos<i;){var o=t.uint32();switch(o>>>3){case 1:s.incomingMessages=j.IncomingMessagesRequest.decode(t,t.uint32());break;case 2:s.channelStats=j.ChannelStatsRequest.decode(t,t.uint32());break;case 3:s.serverStats=j.ServerStatsRequest.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return s},r}(),j.IncomingMessagesRequest=function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.messages=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)j.IncomingMessage.encode(e.messages[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.IncomingMessagesRequest;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.messages&&i.messages.length||(i.messages=[]),i.messages.push(j.IncomingMessage.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.IncomingMessage=function(){function r(e){if(this.receivers=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.receivers=_e.emptyArray,r.prototype.sender=null,r.prototype.body="",r.prototype.expiry=0,r.prototype.type="",r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.receivers!=null&&e.receivers.length)for(var n=0;n<e.receivers.length;++n)j.Receiver.encode(e.receivers[n],t.uint32(10).fork()).ldelim();return e.sender!=null&&e.hasOwnProperty("sender")&&j.Sender.encode(e.sender,t.uint32(18).fork()).ldelim(),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(26).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(32).uint32(e.expiry),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(42).string(e.type),t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.IncomingMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.receivers&&i.receivers.length||(i.receivers=[]),i.receivers.push(j.Receiver.decode(e,e.uint32()));break;case 2:i.sender=j.Sender.decode(e,e.uint32());break;case 3:i.body=e.string();break;case 4:i.expiry=e.uint32();break;case 5:i.type=e.string();break;default:e.skipType(s&7);break}}return i},r}(),j.ChannelStatsRequest=function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.channels=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)j.ChannelId.encode(e.channels[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ChannelStatsRequest;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.channels&&i.channels.length||(i.channels=[]),i.channels.push(j.ChannelId.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.ChannelId=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=_e.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=_e.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=Ce.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ChannelId;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.id=e.bytes();break;case 2:i.isPrivate=e.bool();break;case 3:i.signature=e.bytes();break;default:e.skipType(s&7);break}}return i},r}(),j.ServerStatsRequest=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=Ce.create()),t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ServerStatsRequest;e.pos<n;){var s=e.uint32();switch(s>>>3){default:e.skipType(s&7);break}}return i},r}(),j.Sender=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.type=0,r.prototype.id=_e.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=Ce.create()),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(8).int32(e.type),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(18).bytes(e.id),t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.Sender;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.type=e.int32();break;case 2:i.id=e.bytes();break;default:e.skipType(s&7);break}}return i},r}(),j.SenderType=function(){var r={},e=Object.create(r);return e[r[0]="UNKNOWN"]=0,e[r[1]="CLIENT"]=1,e[r[2]="BACKEND"]=2,e}(),j.Receiver=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=_e.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=_e.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=Ce.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.Receiver;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.id=e.bytes();break;case 2:i.isPrivate=e.bool();break;case 3:i.signature=e.bytes();break;default:e.skipType(s&7);break}}return i},r}(),j.ResponseBatch=function(){function r(e){if(this.responses=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.responses=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.responses!=null&&e.responses.length)for(var n=0;n<e.responses.length;++n)j.Response.encode(e.responses[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ResponseBatch;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.responses&&i.responses.length||(i.responses=[]),i.responses.push(j.Response.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.Response=function(){function r(t){if(t)for(var n=Object.keys(t),i=0;i<n.length;++i)t[n[i]]!=null&&(this[n[i]]=t[n[i]])}r.prototype.outgoingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:_e.oneOfGetter(e=["outgoingMessages","channelStats","serverStats"]),set:_e.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=Ce.create()),t.outgoingMessages!=null&&t.hasOwnProperty("outgoingMessages")&&j.OutgoingMessagesResponse.encode(t.outgoingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&j.ChannelStatsResponse.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&j.JsonResponse.encode(t.serverStats,n.uint32(26).fork()).ldelim(),n},r.decode=function(t,n){t instanceof oe||(t=oe.create(t));for(var i=n===void 0?t.len:t.pos+n,s=new j.Response;t.pos<i;){var o=t.uint32();switch(o>>>3){case 1:s.outgoingMessages=j.OutgoingMessagesResponse.decode(t,t.uint32());break;case 2:s.channelStats=j.ChannelStatsResponse.decode(t,t.uint32());break;case 3:s.serverStats=j.JsonResponse.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return s},r}(),j.OutgoingMessagesResponse=function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.messages=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)j.OutgoingMessage.encode(e.messages[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.OutgoingMessagesResponse;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.messages&&i.messages.length||(i.messages=[]),i.messages.push(j.OutgoingMessage.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.OutgoingMessage=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=_e.newBuffer([]),r.prototype.body="",r.prototype.expiry=0,r.prototype.created=0,r.prototype.sender=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=Ce.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(18).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(24).uint32(e.expiry),e.created!=null&&e.hasOwnProperty("created")&&t.uint32(37).fixed32(e.created),e.sender!=null&&e.hasOwnProperty("sender")&&j.Sender.encode(e.sender,t.uint32(42).fork()).ldelim(),t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.OutgoingMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.id=e.bytes();break;case 2:i.body=e.string();break;case 3:i.expiry=e.uint32();break;case 4:i.created=e.fixed32();break;case 5:i.sender=j.Sender.decode(e,e.uint32());break;default:e.skipType(s&7);break}}return i},r}(),j.ChannelStatsResponse=function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.channels=_e.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=Ce.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)j.ChannelStats.encode(e.channels[n],t.uint32(10).fork()).ldelim();return t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ChannelStatsResponse;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.channels&&i.channels.length||(i.channels=[]),i.channels.push(j.ChannelStats.decode(e,e.uint32()));break;default:e.skipType(s&7);break}}return i},r}(),j.ChannelStats=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=_e.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.isOnline=!1,r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=Ce.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.isOnline!=null&&e.hasOwnProperty("isOnline")&&t.uint32(24).bool(e.isOnline),t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.ChannelStats;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.id=e.bytes();break;case 2:i.isPrivate=e.bool();break;case 3:i.isOnline=e.bool();break;default:e.skipType(s&7);break}}return i},r}(),j.JsonResponse=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.json="",r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=Ce.create()),e.json!=null&&e.hasOwnProperty("json")&&t.uint32(10).string(e.json),t},r.decode=function(e,t){e instanceof oe||(e=oe.create(e));for(var n=t===void 0?e.len:e.pos+t,i=new j.JsonResponse;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:i.json=e.string();break;default:e.skipType(s&7);break}}return i},r}();const Yh=j.ResponseBatch,tl=j.RequestBatch,Kh=j.IncomingMessage,rl=j.Receiver;class nl{_logger=null;_connected=!1;_connectionType;_disconnectCode=0;_disconnectReason="";_parent;_callbacks;constructor(e){this._parent=e.parent,this._connectionType=ge.Undefined,this._callbacks={onOpen:x.isFunction(e.onOpen)?e.onOpen:()=>{},onDisconnect:x.isFunction(e.onDisconnect)?e.onDisconnect:()=>{},onError:x.isFunction(e.onError)?e.onError:()=>{},onMessage:x.isFunction(e.onMessage)?e.onMessage:()=>{}}}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}destroy(){}get connected(){return this._connected}set connected(e){e!=this._connected&&(this._connected=e,this._connected?this._callbacks.onOpen():this._callbacks.onDisconnect({code:this.disconnectCode,reason:this.disconnectReason}))}get disconnectCode(){return this._disconnectCode}get disconnectReason(){return this._disconnectReason}get connectionPath(){return this._parent.getConnectionPath(this._connectionType)}}class Qh extends nl{_socket;_onSocketOpenHandler;_onSocketCloseHandler;_onSocketErrorHandler;_onSocketMessageHandler;constructor(e){super(e),this._connectionType=ge.WebSocket,this._socket=null,this._onSocketOpenHandler=this._onSocketOpen.bind(this),this._onSocketCloseHandler=this._onSocketClose.bind(this),this._onSocketErrorHandler=this._onSocketError.bind(this),this._onSocketMessageHandler=this._onSocketMessage.bind(this)}destroy(){super.destroy(),this._socket&&(this._socket.close(),this._socket=null)}connect(){if(this._socket){if(this._socket.readyState===1)return;this.clearEventListener(),this._socket.close(),this._socket=null}this._createSocket()}get socket(){return this._socket}disconnect(e,t){this._socket!==null&&(this.clearEventListener(),this._socket.close(e,t)),this._socket=null,this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}send(e){return!this._socket||this._socket.readyState!==1?(this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: WebSocket is not connected`)),!1):(this._socket.send(e),!0)}_onSocketOpen(){this.connected=!0}_onSocketClose(e){this._socket=null,this._disconnectCode=Number(e.code),this._disconnectReason=e.reason,this.connected=!1}_onSocketError(e){this._callbacks.onError(new Error(`Socket error: ${e}`))}_onSocketMessage(e){this._callbacks.onMessage(e.data)}clearEventListener(){this._socket&&(this._socket.removeEventListener("open",this._onSocketOpenHandler),this._socket.removeEventListener("close",this._onSocketCloseHandler),this._socket.removeEventListener("error",this._onSocketErrorHandler),this._socket.removeEventListener("message",this._onSocketMessageHandler))}_createSocket(){if(this._socket)throw new Error("Socket already exists");if(!this.connectionPath)throw new Error("Websocket connection path is not defined");this._socket=new WebSocket(this.connectionPath),this._socket.binaryType="arraybuffer",this._socket.addEventListener("open",this._onSocketOpenHandler),this._socket.addEventListener("close",this._onSocketCloseHandler),this._socket.addEventListener("error",this._onSocketErrorHandler),this._socket.addEventListener("message",this._onSocketMessageHandler)}}const Xh=60;class ed extends nl{_active;_requestTimeout;_failureTimeout;_xhr;_requestAborted;constructor(e){super(e),this._active=!1,this._connectionType=ge.LongPolling,this._requestTimeout=null,this._failureTimeout=null,this._xhr=this.createXhr(),this._requestAborted=!1}connect(){this._active=!0,this.performRequest()}disconnect(e,t){this._active=!1,this.clearTimeOut(),this._xhr&&(this._requestAborted=!0,this._xhr.abort()),this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}performRequest(){if(this._active){if(!this.connectionPath)throw new Error("Long polling connection path is not defined");this._xhr.readyState!==0&&this._xhr.readyState!==4||(this.clearTimeOut(),this._failureTimeout=setTimeout(()=>{this.connected=!0},5e3),this._requestTimeout=setTimeout(this.onRequestTimeout.bind(this),Xh*1e3),this._xhr.open("GET",this.connectionPath),this._xhr.send())}}onRequestTimeout(){this._requestAborted=!0,this._xhr.abort(),this.performRequest()}onXhrReadyStateChange(){this._xhr.readyState===4&&((!this._requestAborted||this._xhr.status==200)&&this.onResponse(this._xhr.response),this._requestAborted=!1)}send(e){const t=this._parent.getPublicationPath();if(!t)return this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: publication path is empty`)),!1;const n=new XMLHttpRequest;return n.open("POST",t),n.send(e),!0}onResponse(e){if(this.clearTimeOut(),this._xhr.status===200)this.connected=!0,x.isStringFilled(e)||e instanceof ArrayBuffer?this._callbacks.onMessage(e):this._parent.session.mid=null,this.performRequest();else if(this._xhr.status===304){if(this.connected=!0,this._xhr.getResponseHeader("Expires")==="Thu, 01 Jan 1973 11:11:01 GMT"){const t=this._xhr.getResponseHeader("Last-Message-Id");x.isStringFilled(t)&&this._parent.setLastMessageId(t||"")}this.performRequest()}else this._callbacks.onError(new Error("Could not connect to the server")),this.connected=!1}clearTimeOut(){this._failureTimeout&&(clearTimeout(this._failureTimeout),this._failureTimeout=null),this._requestTimeout&&(clearTimeout(this._requestTimeout),this._requestTimeout=null)}createXhr(){const e=new XMLHttpRequest;return this._parent.isProtobufSupported()&&!this._parent.isJsonRpc()&&(e.responseType="arraybuffer"),e.addEventListener("readystatechange",this.onXhrReadyStateChange.bind(this)),e}}const yr=19,il=30*60,td=5e3,rd=60*1e3,sl=10,ol=10,nd="ping",id="pong",al="bx-pull-session",sd=20,ll={api:{},channels:{},publicChannels:{},server:{timeShift:0},clientId:null,jwt:null,exp:0};class cl{_logger=null;_restClient;_status;_context;_guestMode;_guestUserId;_userId;_configGetMethod;_getPublicListMethod;_siteId;_enabled;_unloading=!1;_starting=!1;_debug=!1;_connectionAttempt=0;_connectionType=ge.WebSocket;_reconnectTimeout=null;_restartTimeout=null;_restoreWebSocketTimeout=null;_skipStorageInit;_skipCheckRevision;_subscribers={};_watchTagsQueue=new Map;_watchUpdateInterval=174e4;_watchForceUpdateInterval=5e3;_configTimestamp=0;_session={mid:null,tag:null,time:null,history:{},lastMessageIds:[],messageCount:0};_connectors={[ge.Undefined]:null,[ge.WebSocket]:null,[ge.LongPolling]:null};_isSecure;_config=null;_storage=null;_sharedConfig;_channelManager;_jsonRpcAdapter=null;_checkInterval=null;_offlineTimeout=null;_watchUpdateTimeout=null;_pingWaitTimeout=null;_isManualDisconnect=!1;_loggingEnabled=!1;_onPingTimeoutHandler;_userStatusCallbacks={};_connectPromise=null;_startingPromise=null;constructor(e){this._restClient=e.b24,this._status=je.Offline,this._context="master",e.restApplication&&(typeof e.configGetMethod>"u"&&(e.configGetMethod="pull.application.config.get"),typeof e.skipCheckRevision>"u"&&(e.skipCheckRevision=!0),x.isStringFilled(e.restApplication)&&(e.siteId=e.restApplication),e.serverEnabled=!0),this._guestMode=e.guestMode?G.toBoolean(e.guestMode):!1,this._guestUserId=e.guestUserId?G.toInteger(e.guestUserId):0,this._guestMode&&this._guestUserId>0?this._userId=this._guestUserId:(this._guestMode=!1,this._userId=e.userId?G.toInteger(e.userId):0),this._siteId=e.siteId??"none",this._enabled=x.isUndefined(e.serverEnabled)?!0:e.serverEnabled===!0,this._configGetMethod=x.isStringFilled(e.configGetMethod)?e.configGetMethod||"":"pull.config.get",this._getPublicListMethod=x.isStringFilled(e.getPublicListMethod)?e.getPublicListMethod||"":"pull.channel.public.list",this._skipStorageInit=e.skipStorageInit===!0,this._skipCheckRevision=e.skipCheckRevision===!0,x.isUndefined(e.configTimestamp)||(this._configTimestamp=G.toInteger(e.configTimestamp)),this._isSecure=document?.location.href.indexOf("https")===0,this._userId&&!this._skipStorageInit&&(this._storage=new Xa({userId:this._userId,siteId:this._siteId})),this._sharedConfig=new zh({onWebSocketBlockChanged:this.onWebSocketBlockChanged.bind(this),storage:this._storage}),this._channelManager=new Jh({b24:this._restClient,getPublicListMethod:this._getPublicListMethod}),this._loggingEnabled=this._sharedConfig.isLoggingEnabled(),this._onPingTimeoutHandler=this.onPingTimeout.bind(this)}setLogger(e){this._logger=e,this._jsonRpcAdapter?.setLogger(this.getLogger()),this._storage?.setLogger(this.getLogger()),this._sharedConfig.setLogger(this.getLogger()),this._channelManager.setLogger(this.getLogger()),this._connectors.webSocket?.setLogger(this.getLogger()),this._connectors.longPolling?.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}destroy(){this.stop(Ie.NORMAL_CLOSURE,"manual stop"),this.onBeforeUnload()}init(){this._connectors.webSocket=new Qh({parent:this,onOpen:this.onWebSocketOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onWebSocketDisconnect.bind(this),onError:this.onWebSocketError.bind(this)}),this._connectors.longPolling=new ed({parent:this,onOpen:this.onLongPollingOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onLongPollingDisconnect.bind(this),onError:this.onLongPollingError.bind(this)}),this._connectionType=this.isWebSocketAllowed()?ge.WebSocket:ge.LongPolling,window.addEventListener("beforeunload",this.onBeforeUnload.bind(this)),window.addEventListener("offline",this.onOffline.bind(this)),window.addEventListener("online",this.onOnline.bind(this)),this._jsonRpcAdapter=new Hh({connector:this._connectors.webSocket,handlers:{"incoming.message":this.handleRpcIncomingMessage.bind(this)}})}get connector(){return this._connectors[this._connectionType]}get status(){return this._status}set status(e){this._status!==e&&(this._status=e,this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),e===je.Offline?this.sendPullStatusDelayed(e,td):this.sendPullStatus(e))}get session(){return this._session}subscribe(e){if(!x.isPlainObject(e))return this.attachCommandHandler(e);if(e=e,e.type=e.type||Ue.Server,e.command=e.command||null,e.type==Ue.Server||e.type==Ue.Client){if(typeof e.moduleId>"u")throw new TypeError(`${G.getDateForLog()}: Pull.subscribe: parameter moduleId is not specified`);return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),e.command?(typeof this._subscribers[e.type][e.moduleId].commands[e.command]>"u"&&(this._subscribers[e.type][e.moduleId].commands[e.command]=[]),this._subscribers[e.type][e.moduleId].commands[e.command].push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||typeof e.command>"u"||e.command===null||(this._subscribers[e.type][e.moduleId].commands[e.command]=this._subscribers[e.type][e.moduleId].commands[e.command].filter(t=>t!==e.callback))}):(this._subscribers[e.type][e.moduleId].callbacks.push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||(this._subscribers[e.type][e.moduleId].callbacks=this._subscribers[e.type][e.moduleId].callbacks.filter(t=>t!==e.callback))})}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].push(e.callback),()=>{typeof e.type>"u"||(this._subscribers[e.type]=this._subscribers[e.type].filter(t=>t!==e.callback))}}attachCommandHandler(e){if(typeof e.getModuleId!="function"||typeof e.getModuleId()!="string")return this.getLogger().error(`${G.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string.`),()=>{};let t=Ue.Server;return typeof e.getSubscriptionType=="function"&&(t=e.getSubscriptionType()),this.subscribe({type:t,moduleId:e.getModuleId(),callback:n=>{let i=null;if(typeof e.getMap=="function"){const s=e.getMap();if(s&&typeof s=="object"){const o=s[n.command];typeof o=="function"?i=o.bind(e):typeof o=="string"&&typeof e[o]=="function"&&(i=e[o].bind(e))}}if(!i){const s=`handle${G.capitalize(n.command)}`;typeof e[s]=="function"&&(i=e[s].bind(e))}i&&(this._debug&&this._context!=="master"&&this.getLogger().warn(`${G.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,n),i(n.params,n.extra,n.command))}})}async start(e=null){let t=!0;if(this.isConnected())return Promise.resolve(!0);if(this._starting&&this._startingPromise)return this._startingPromise;if(!this._userId)throw new Error("Not set userId");if(this._siteId==="none")throw new Error("Not set siteId");let n=!1;if(e&&x.isPlainObject(e)&&(typeof e?.skipReconnectToLastSession<"u"&&(n=e.skipReconnectToLastSession,delete e.skipReconnectToLastSession),this._config=e,t=!1),!this._enabled)return Promise.reject({ex:{error:"PULL_DISABLED",error_description:"Push & Pull server is disabled"}});const i=Date.now();let s;return!n&&this._storage&&(s=this._storage.get(al,null)),x.isPlainObject(s)&&s.hasOwnProperty("ttl")&&s.ttl>=i&&(this._session.mid=s.mid),this._starting=!0,this._startingPromise=new Promise((o,l)=>{this.loadConfig("client_start").then(a=>{this.setConfig(a,t),this.init(),this.updateWatch(!0),this.startCheckConfig(),this.connect().then(()=>o(!0),u=>l(u))}).catch(a=>{this._starting=!1,this.status=je.Offline,this.stopCheckConfig(),this.getLogger().error(`${G.getDateForLog()}: Pull: could not read push-server config `,a),l(a)})})}restart(e=Ie.NORMAL_CLOSURE,t="manual restart"){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),this.getLogger().log(`${G.getDateForLog()}: Pull: restarting with code ${e}`),this.disconnect(e,t),this._storage&&this._storage.remove(xe.PullConfig),this._config=null;const n=`${e}_${t.replaceAll(" ","_")}`;this.loadConfig(n).then(i=>{this.setConfig(i,!0),this.updateWatch(),this.startCheckConfig(),this.connect().catch(s=>{this.getLogger().error(s)})},i=>{this.getLogger().error(`${G.getDateForLog()}: Pull: could not read push-server config `,i),this.status=je.Offline,this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),(i?.status==401||i?.status==403)&&(this.stopCheckConfig(),this.onCustomEvent("onPullError",["AUTHORIZE_ERROR"]))})}stop(e=Ie.NORMAL_CLOSURE,t="manual stop"){this.disconnect(e,t),this.stopCheckConfig()}reconnect(e,t,n=1){this.disconnect(e,t),this.scheduleReconnect(n)}setLastMessageId(e){this._session.mid=e}async sendMessage(e,t,n,i,s){const o={userList:e,body:{module_id:t,command:n,params:i},expiry:s};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.Publish,o):this.sendMessageBatch([o])}async sendMessageToChannels(e,t,n,i,s){const o={channelList:e,body:{module_id:t,command:n,params:i},expiry:s};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.Publish,o):this.sendMessageBatch([o])}capturePullEvent(e=!0){this._debug=e}enableLogging(e=!0){this._sharedConfig.setLoggingEnabled(e),this._loggingEnabled=e}async listChannels(){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.ListChannels,{})||Promise.reject(new Error("jsonRpcAdapter not init"))}async getUsersLastSeen(e){if(!x.isArray(e)||!e.every(n=>typeof n=="number"))throw new Error("userList must be an array of numbers");const t={};return new Promise((n,i)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.GetUsersLastSeen,{userList:e}).then(s=>{const o=[];for(let a=0;a<e.length;a++)s.hasOwnProperty(e[a])||o.push(e[a]);if(o.length===0)return n(t);const l={userIds:o,sendToQueueSever:!0};this._restClient.callMethod("pull.api.user.getLastSeen",l).then(a=>{const u=a.getData().result;for(const c in u)t[Number(c)]=Number(u[c]);return n(t)}).catch(a=>{this.getLogger().error(a),i(a)})}).catch(s=>{this.getLogger().error(s),i(s)})})}async ping(e=5){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.Ping,{},e)}async subscribeUserStatusChange(e,t){return new Promise((n,i)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.SubscribeStatusChange,{userId:e}).then(()=>(this._userStatusCallbacks[e]||(this._userStatusCallbacks[e]=[]),x.isFunction(t)&&this._userStatusCallbacks[e].push(t),n())).catch(s=>i(s))})}async unsubscribeUserStatusChange(e,t){return this._userStatusCallbacks[e]&&(this._userStatusCallbacks[e]=this._userStatusCallbacks[e].filter(n=>n!==t),this._userStatusCallbacks[e].length===0)?this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.UnsubscribeStatusChange,{userId:e}):Promise.resolve()}getRevision(){return this._config&&this._config.api?this._config.api.revision_web:null}getServerVersion(){return this._config&&this._config.server?this._config.server.version:0}getServerMode(){return this._config&&this._config.server?this._config.server.mode:null}getConfig(){return this._config}getDebugInfo(){if(!JSON||!JSON.stringify)return{};let e;this._config&&this._config.channels?e={ChannelID:this._config.channels.private?.id||"n/a",ChannelDie:this._config.channels.private?.end||"n/a",ChannelDieShared:this._config.channels.shared?.end||"n/a"}:e={ConfigError:"config is not loaded"};let t="-";return this._connectors.webSocket&&this._connectors.webSocket?.socket&&(this.isJsonRpc()?t="json-rpc":t=this._connectors.webSocket?.socket?.url.search("binaryMode=true")!=-1?"protobuf":"text"),{UserId:this._userId+(this._userId>0?"":"(guest)"),"Guest userId":this._guestMode&&this._guestUserId!==0?this._guestUserId:"-","Browser online":navigator.onLine?"Y":"N",Connect:this.isConnected()?"Y":"N","Server type":this.isSharedMode()?"cloud":"local","WebSocket supported":this.isWebSocketSupported()?"Y":"N","WebSocket connected":this._connectors.webSocket&&this._connectors.webSocket.connected?"Y":"N","WebSocket mode":t,"Try connect":this._reconnectTimeout?"Y":"N","Try number":this._connectionAttempt,Path:this.connector?.connectionPath||"-",...e,"Last message":this._session.mid||"-","Session history":this._session.history,"Watch tags":this._watchTagsQueue.entries()}}getConnectionPath(e){let t;const n={};switch(e){case ge.WebSocket:t=this._isSecure?this._config?.server.websocket_secure:this._config?.server.websocket;break;case ge.LongPolling:t=this._isSecure?this._config?.server.long_pooling_secure:this._config?.server.long_polling;break;default:throw new Error(`Unknown connection type ${e}`)}if(!x.isStringFilled(t))throw new Error("Empty path");if(typeof this._config?.jwt=="string"&&this._config?.jwt!=="")n.token=this._config?.jwt;else{const i=[];if(this._config?.channels?.private&&i.push(this._config.channels.private?.id||""),this._config?.channels.private?.id&&i.push(this._config.channels.private.id),this._config?.channels.shared?.id&&i.push(this._config.channels.shared.id),i.length===0)throw new Error("Empty channels");n.CHANNEL_ID=i.join("/")}if(this.isJsonRpc()?n.jsonRpc="true":this.isProtobufSupported()&&(n.binaryMode="true"),this.isSharedMode()){if(!this._config?.clientId)throw new Error("Push-server is in shared mode, but clientId is not set");n.clientId=this._config.clientId}return this._session.mid&&(n.mid=this._session.mid),this._session.tag&&(n.tag=this._session.tag),this._session.time&&(n.time=this._session.time),n.revision=yr,`${t}?${G.buildQueryString(n)}`}getPublicationPath(){const e=this._isSecure?this._config?.server.publish_secure:this._config?.server.publish;if(!e)return"";const t=[];this._config?.channels.private?.id&&t.push(this._config.channels.private.id),this._config?.channels.shared?.id&&t.push(this._config.channels.shared.id);const n={CHANNEL_ID:t.join("/")};return e+"?"+G.buildQueryString(n)}isConnected(){return this.connector?this.connector.connected:!1}isWebSocketSupported(){return typeof window.WebSocket<"u"}isWebSocketAllowed(){return this._sharedConfig.isWebSocketBlocked()?!1:this.isWebSocketEnabled()}isWebSocketEnabled(){return!this.isWebSocketSupported()||!this._config||!this._config.server?!1:this._config.server.websocket_enabled}isPublishingSupported(){return this.getServerVersion()>3}isPublishingEnabled(){return this.isPublishingSupported()?this._config?.server.publish_enabled===!0:!1}isProtobufSupported(){return this.getServerVersion()==4&&!vo.isIE()}isJsonRpc(){return this.getServerVersion()>=5}isSharedMode(){return this.getServerMode()===In.Shared}emit(e){if(e.type==Ue.Server||e.type==Ue.Client){if(typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof e.moduleId>"u")throw new TypeError(`${G.getDateForLog()}: Pull.emit: parameter moduleId is not specified`);return typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),this._subscribers[e.type][e.moduleId].callbacks.length>0&&this._subscribers[e.type][e.moduleId].callbacks.forEach(t=>{t(e.data,{type:e.type,moduleId:e.moduleId})}),!(typeof e.data>"u")&&!(typeof e.data.command>"u")&&this._subscribers[e.type][e.moduleId].commands[e.data.command]&&this._subscribers[e.type][e.moduleId].commands[e.data.command].length>0&&this._subscribers[e.type][e.moduleId].commands[e.data.command].forEach(t=>{typeof e.data>"u"||t(e.data.params,e.data.extra,e.data.command,{type:e.type,moduleId:e.moduleId})}),!0}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].length<=0||this._subscribers[e.type].forEach(t=>{t(e.data,{type:e.type})}),!0}broadcastMessage(e){const t=e.module_id=e.module_id.toLowerCase(),n=e.command;e.extra||(e.extra={}),e.extra.server_time_unix&&(e.extra.server_time_ago=(Date.now()-e.extra.server_time_unix*1e3)/1e3-(this._config?.server.timeShift||0),e.extra.server_time_ago=e.extra.server_time_ago>0?e.extra.server_time_ago:0),this.logMessage(e);try{e.extra.sender&&e.extra.sender.type===Ur.Client?(this.onCustomEvent("onPullClientEvent-"+t,[n,e.params,e.extra],!0),this.onCustomEvent("onPullClientEvent",[t,n,e.params,e.extra],!0),this.emit({type:Ue.Client,moduleId:t,data:{command:n,params:x.clone(e.params),extra:x.clone(e.extra)}})):t==="pull"?this.handleInternalPullEvent(n,e):t=="online"?((e?.extra?.server_time_ago||0)<240&&(this.onCustomEvent("onPullOnlineEvent",[n,e.params,e.extra],!0),this.emit({type:Ue.Online,data:{command:n,params:x.clone(e.params),extra:x.clone(e.extra)}})),n==="userStatusChange"&&this.emitUserStatusChange(e.params.user_id,e.params.online)):(this.onCustomEvent("onPullEvent-"+t,[n,e.params,e.extra],!0),this.onCustomEvent("onPullEvent",[t,n,e.params,e.extra],!0),this.emit({type:Ue.Server,moduleId:t,data:{command:n,params:x.clone(e.params),extra:x.clone(e.extra)}}))}catch(i){this.getLogger().warn(`
|
|
17
|
+
}`}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,h){return typeof l=="function"?(h=l,l={}):l||(l={}),h?!l.xhr&&c&&c.readFile?c.readFile(u,function(f,d){return f&&typeof XMLHttpRequest<"u"?a.xhr(u,l,h):f?h(f):h(null,l.binary?d:d.toString("utf8"))}):a.xhr(u,l,h):i(a,this,u,l)}a.xhr=function(u,l,h){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState!==4)return e;if(f.status!==0&&f.status!==200)return h(Error("status "+f.status));if(l.binary){var d=f.response;if(!d){d=[];for(var p=0;p<f.responseText.length;++p)d.push(f.responseText.charCodeAt(p)&255)}return h(null,typeof Uint8Array<"u"?new Uint8Array(d):d)}return h(null,f.responseText)},l.binary&&("overrideMimeType"in f&&f.overrideMimeType("text/plain; charset=x-user-defined"),f.responseType="arraybuffer"),f.open("GET",u),f.send()}},{1:1,7:7}],6:[function(t,n,s){n.exports=i(i);function i(l){return typeof Float32Array<"u"?function(){var h=new Float32Array([-0]),f=new Uint8Array(h.buffer),d=f[3]===128;function p(w,_,b){h[0]=w,_[b]=f[0],_[b+1]=f[1],_[b+2]=f[2],_[b+3]=f[3]}function m(w,_,b){h[0]=w,_[b]=f[3],_[b+1]=f[2],_[b+2]=f[1],_[b+3]=f[0]}l.writeFloatLE=d?p:m,l.writeFloatBE=d?m:p;function g(w,_){return f[0]=w[_],f[1]=w[_+1],f[2]=w[_+2],f[3]=w[_+3],h[0]}function y(w,_){return f[3]=w[_],f[2]=w[_+1],f[1]=w[_+2],f[0]=w[_+3],h[0]}l.readFloatLE=d?g:y,l.readFloatBE=d?y:g}():function(){function h(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=h.bind(null,o),l.writeFloatBE=h.bind(null,c);function f(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=f.bind(null,a),l.readFloatBE=f.bind(null,u)}(),typeof Float64Array<"u"?function(){var h=new Float64Array([-0]),f=new Uint8Array(h.buffer),d=f[7]===128;function p(w,_,b){h[0]=w,_[b]=f[0],_[b+1]=f[1],_[b+2]=f[2],_[b+3]=f[3],_[b+4]=f[4],_[b+5]=f[5],_[b+6]=f[6],_[b+7]=f[7]}function m(w,_,b){h[0]=w,_[b]=f[7],_[b+1]=f[6],_[b+2]=f[5],_[b+3]=f[4],_[b+4]=f[3],_[b+5]=f[2],_[b+6]=f[1],_[b+7]=f[0]}l.writeDoubleLE=d?p:m,l.writeDoubleBE=d?m:p;function g(w,_){return f[0]=w[_],f[1]=w[_+1],f[2]=w[_+2],f[3]=w[_+3],f[4]=w[_+4],f[5]=w[_+5],f[6]=w[_+6],f[7]=w[_+7],h[0]}function y(w,_){return f[7]=w[_],f[6]=w[_+1],f[5]=w[_+2],f[4]=w[_+3],f[3]=w[_+4],f[2]=w[_+5],f[1]=w[_+6],f[0]=w[_+7],h[0]}l.readDoubleLE=d?g:y,l.readDoubleBE=d?y:g}():function(){function h(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 k=Math.floor(Math.log(g)/Math.LN2);k===1024&&(k=1023),b=g*Math.pow(2,-k),d(b*4503599627370496>>>0,y,w+p),d((_<<31|k+1023<<20|b*1048576&1048575)>>>0,y,w+m)}}}l.writeDoubleLE=h.bind(null,o,0,4),l.writeDoubleBE=h.bind(null,c,4,0);function f(d,p,m,g,y){var w=d(g,y+p),_=d(g,y+m),b=(_>>31)*2+1,k=_>>>20&2047,S=4294967296*(_&1048575)+w;return k===2047?S?NaN:b*(1/0):k===0?b*5e-324*S:b*Math.pow(2,k-1075)*(S+4503599627370496)}l.readDoubleLE=f.bind(null,a,0,4),l.readDoubleBE=f.bind(null,u,4,0)}(),l}function o(l,h,f){h[f]=l&255,h[f+1]=l>>>8&255,h[f+2]=l>>>16&255,h[f+3]=l>>>24}function c(l,h,f){h[f]=l>>>24,h[f+1]=l>>>16&255,h[f+2]=l>>>8&255,h[f+3]=l&255}function a(l,h){return(l[h]|l[h+1]<<8|l[h+2]<<16|l[h+3]<<24)>>>0}function u(l,h){return(l[h]<<24|l[h+1]<<16|l[h+2]<<8|l[h+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),h="";l&&(h=u.shift()+"/");for(var f=0;f<u.length;)u[f]===".."?f>0&&u[f-1]!==".."?u.splice(--f,2):l?u.splice(f,1):++f:u[f]==="."?u.splice(f,1):++f;return h+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,h=null,f=u;return function(d){if(d<1||d>l)return o(d);f+d>u&&(h=o(u),f=0);var p=c.call(h,f,f+=d);return f&7&&(f=(f|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,h=[],f=0,d;c<a;)d=o[c++],d<128?h[f++]=d:d>191&&d<224?h[f++]=(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,h[f++]=55296+(d>>10),h[f++]=56320+(d&1023)):h[f++]=(d&15)<<12|(o[c++]&63)<<6|o[c++]&63,f>8191&&((l||(l=[])).push(String.fromCharCode.apply(String,h)),f=0);return l?(f&&l.push(String.fromCharCode.apply(String,h.slice(0,f))),l.join("")):String.fromCharCode.apply(String,h.slice(0,f))},i.write=function(o,c,a){for(var u=a,l,h,f=0;f<o.length;++f)l=o.charCodeAt(f),l<128?c[a++]=l:l<2048?(c[a++]=l>>6|192,c[a++]=l&63|128):(l&64512)===55296&&((h=o.charCodeAt(f+1))&64512)===56320?(l=65536+((l&1023)<<10)+(h&1023),++f,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,h,f,d){if(h.resolvedType)if(h.resolvedType instanceof o){l("switch(d%s){",d);for(var p=h.resolvedType.values,m=Object.keys(p),g=0;g<m.length;++g)h.repeated&&p[m[g]]===h.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)",h.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",d,f,d);else{var y=!1;switch(h.type){case"double":case"float":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 h=l.fieldsArray,f=c.codegen(["d"],l.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!h.length)return f("return new this.ctor");f("var m=new this.ctor");for(var d=0;d<h.length;++d){var p=h[d].resolve(),m=c.safeProp(p.name);p.map?(f("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(f,p,d,m+"[ks[i]]")("}")("}")):p.repeated?(f("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(f,p,d,m+"[i]")("}")("}")):(p.resolvedType instanceof o||f("if(d%s!=null){",m),a(f,p,d,m),p.resolvedType instanceof o||f("}"))}return f("return m")};function u(l,h,f,d){if(h.resolvedType)h.resolvedType instanceof o?l("d%s=o.enums===String?types[%i].values[m%s]:m%s",d,f,d,d):l("d%s=types[%i].toObject(m%s,o)",d,f,d);else{var p=!1;switch(h.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 h=l.fieldsArray.slice().sort(c.compareFieldsById);if(!h.length)return c.codegen()("return {}");for(var f=c.codegen(["m","o"],l.name+"$toObject")("if(!o)")("o={}")("var d={}"),d=[],p=[],m=[],g=0;g<h.length;++g)h[g].partOf||(h[g].resolve().repeated?d:h[g].map?p:m).push(h[g]);if(d.length){for(f("if(o.arrays||o.defaults){"),g=0;g<d.length;++g)f("d%s=[]",c.safeProp(d[g].name));f("}")}if(p.length){for(f("if(o.objects||o.defaults){"),g=0;g<p.length;++g)f("d%s={}",c.safeProp(p[g].name));f("}")}if(m.length){for(f("if(o.defaults){"),g=0;g<m.length;++g){var y=m[g],w=c.safeProp(y.name);y.resolvedType instanceof o?f("d%s=o.enums===String?%j:%j",w,y.resolvedType.valuesById[y.typeDefault],y.typeDefault):y.long?f("if(util.Long){")("var n=new util.Long(%i,%i,%j)",y.typeDefault.low,y.typeDefault.high,y.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",w)("}else")("d%s=o.longs===String?%j:%i",w,y.typeDefault.toString(),y.typeDefault.toNumber()):y.bytes?f("d%s=o.bytes===String?%j:%s",w,String.fromCharCode.apply(String,y.typeDefault),"["+Array.prototype.slice.call(y.typeDefault).join(",")+"]"):f("d%s=%j",w,y.typeDefault)}f("}")}var _=!1;for(g=0;g<h.length;++g){var y=h[g],b=l._fieldsArray.indexOf(y),w=c.safeProp(y.name);y.map?(_||(_=!0,f("var ks2")),f("if(m%s&&(ks2=Object.keys(m%s)).length){",w,w)("d%s={}",w)("for(var j=0;j<ks2.length;++j){"),u(f,y,b,w+"[ks2[j]]")("}")):y.repeated?(f("if(m%s&&m%s.length){",w,w)("d%s=[]",w)("for(var j=0;j<m%s.length;++j){",w),u(f,y,b,w+"[j]")("}")):(f("if(m%s!=null&&m.hasOwnProperty(%j)){",w,y.name),u(f,y,b,w),y.partOf&&f("if(o.oneofs)")("d%s=%j",c.safeProp(y.partOf.name),y.name)),f("}")}return f("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 h=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&&h("if((t&7)===4)")("break"),h("switch(t>>>3){");for(var f=0;f<l.fieldsArray.length;++f){var d=l._fieldsArray[f].resolve(),p=d.resolvedType instanceof i?"int32":d.type,m="m"+c.safeProp(d.name);h("case %i:",d.id),d.map?(h("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?h('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',m,f):h('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',m,p):o.basic[p]===e?h("%s[k]=types[%i].decode(r,r.uint32())",m,f):h("%s[k]=r.%s()",m,p)):d.repeated?(h("if(!(%s&&%s.length))",m,m)("%s=[]",m),o.packed[p]!==e&&h("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?h(d.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",m,f):h("%s.push(r.%s())",m,p)):o.basic[p]===e?h(d.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",m,f):h("%s=r.%s()",m,p),h("break")}for(h("default:")("r.skipType(t&7)")("break")("}")("}"),f=0;f<l._fieldsArray.length;++f){var g=l._fieldsArray[f];g.required&&h("if(!m.hasOwnProperty(%j))",g.name)("throw util.ProtocolError(%j,{instance:m})",a(g))}return h("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,h,f,d){return h.resolvedType.group?l("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",f,d,(h.id<<3|3)>>>0,(h.id<<3|4)>>>0):l("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",f,d,(h.id<<3|2)>>>0)}function u(l){for(var h=c.codegen(["m","w"],l.name+"$encode")("if(!w)")("w=Writer.create()"),p,f,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];f="m"+c.safeProp(m.name),m.map?(h("if(%s!=null&&m.hasOwnProperty(%j)){",f,m.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",f)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(m.id<<3|2)>>>0,8|o.mapKey[m.keyType],m.keyType),w===e?h("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",g,f):h(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|w,y,f),h("}")("}")):m.repeated?(h("if(%s!=null&&%s.length){",f,f),m.packed&&o.packed[y]!==e?h("w.uint32(%i).fork()",(m.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",f)("w.%s(%s[i])",y,f)("w.ldelim()"):(h("for(var i=0;i<%s.length;++i)",f),w===e?a(h,m,g,f+"[i]"):h("w.uint32(%i).%s(%s[i])",(m.id<<3|w)>>>0,y,f)),h("}")):(m.optional&&h("if(%s!=null&&m.hasOwnProperty(%j))",f,m.name),w===e?a(h,m,g,f):h("w.uint32(%i).%s(%s)",(m.id<<3|w)>>>0,y,f))}return h("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,h,f,d){if(i.call(this,u,h),l&&typeof l!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=f,this.comments=d||{},this.reserved=e,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 h=new a(u,l.values,l.options,l.comment,l.comments);return h.reserved=l.reserved,h},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,h){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]=h||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=h;var i=t(24);((h.prototype=Object.create(i.prototype)).constructor=h).className="Field";var o=t(15),c=t(36),a=t(37),u,l=/^required|optional|repeated$/;h.fromJSON=function(f,d){return new h(f,d.id,d.type,d.rule,d.extend,d.options,d.comment)};function h(f,d,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,f,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(h.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}}),h.prototype.setOption=function(f,d,p){return f==="packed"&&(this._packed=null),i.prototype.setOption.call(this,f,d,p)},h.prototype.toJSON=function(f){var d=f?!!f.keepComments:!1;return a.toObject(["rule",this.rule!=="optional"&&this.rule||e,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",d?this.comment:e])},h.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=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 f;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,f=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,f=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=f}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof u&&(this.parent.ctor.prototype[this.name]=this.defaultValue),i.prototype.resolve.call(this)},h.d=function(f,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 h(y,f,d,p,{default:m}))}},h._configure=function(f){u=f}},{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,h,f,d,p){if(i.call(this,u,l,f,e,e,d,p),!c.isString(h))throw TypeError("keyType must be a string");this.keyType=h,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,h){return typeof h=="function"?h=c.decorateType(h).name:h&&typeof h=="object"&&(h=c.decorateEnum(h).name),function(f,d){c.decorateType(f.constructor).add(new a(d,u,l,h))}}},{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,h,f,d,p,m){if(o.isObject(f)?(p=f,f=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(h))throw TypeError("responseType must be a string");i.call(this,a,p),this.type=u||"rpc",this.requestType=l,this.requestStream=f?!0:e,this.responseType=h,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=f;var i=t(24);((f.prototype=Object.create(i.prototype)).constructor=f).className="Namespace";var o=t(15),c=t(16),a=t(37),u,l;f.fromJSON=function(p,m){return new f(p,m.options).addJSON(m.nested)};function h(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}f.arrayToJSON=h,f.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},f.isReservedName=function(p,m){if(p){for(var g=0;g<p.length;++g)if(p[g]===m)return!0}return!1};function f(p,m){i.call(this,p,m),this.nested=e,this._nestedArray=null}function d(p){return p._nestedArray=null,p}Object.defineProperty(f.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=a.toArray(this.nested))}}),f.prototype.toJSON=function(p){return a.toObject(["options",this.options,"nested",h(this.nestedArray,p)])},f.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:f.fromJSON)(g[y],w));return this},f.prototype.get=function(p){return this.nested&&this.nested[p]||null},f.prototype.getEnum=function(p){if(this.nested&&this.nested[p]instanceof o)return this.nested[p].values;throw Error("no such enum: "+p)},f.prototype.add=function(p){if(!(p instanceof c&&p.extend!==e||p instanceof u||p instanceof o||p instanceof l||p instanceof f))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 f&&p instanceof f&&!(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)},f.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)},f.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 f))throw Error("path conflicts with non-namespace objects")}else g.add(g=new f(y))}return m&&g.addJSON(m),g},f.prototype.resolveAll=function(){for(var p=this.nestedArray,m=0;m<p.length;)p[m]instanceof f?p[m++].resolveAll():p[m++].resolve();return this.resolve()},f.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 f&&(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 f&&(y=this._nestedArray[w].lookup(p,m,!0)))return y;return this.parent===null||g?null:this.parent.lookup(p,m)},f.prototype.lookupType=function(p){var m=this.lookup(p,[u]);if(!m)throw Error("no such type: "+p);return m},f.prototype.lookupEnum=function(p){var m=this.lookup(p,[o]);if(!m)throw Error("no such Enum '"+p+"' in "+this);return m},f.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},f.prototype.lookupService=function(p){var m=this.lookup(p,[l]);if(!m)throw Error("no such Service '"+p+"' in "+this);return m},f._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),h=0;h<l.length;++h)this.setOption(l[h],a[l[h]],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,h,f,d){if(Array.isArray(h)||(f=h,h=e),i.call(this,l,f),!(h===e||Array.isArray(h)))throw TypeError("fieldNames must be an Array");this.oneof=h||[],this.fieldsArray=[],this.comment=d}a.fromJSON=function(l,h){return new a(l,h.oneof,h.options,h.comment)},a.prototype.toJSON=function(l){var h=l?!!l.keepComments:!1;return c.toObject(["options",this.options,"oneof",this.oneof,"comment",h?this.comment:e])};function u(l){if(l.parent)for(var h=0;h<l.fieldsArray.length;++h)l.fieldsArray[h].parent||l.parent.add(l.fieldsArray[h])}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 h=this.fieldsArray.indexOf(l);if(h<0)throw Error(l+" is not a member of "+this);return this.fieldsArray.splice(h,1),h=this.oneof.indexOf(l.name),h>-1&&this.oneof.splice(h,1),l.partOf=null,this},a.prototype.onAdd=function(l){i.prototype.onAdd.call(this,l);for(var h=this,f=0;f<this.oneof.length;++f){var d=l.get(this.oneof[f]);d&&!d.partOf&&(d.partOf=h,h.fieldsArray.push(d))}u(this)},a.prototype.onRemove=function(l){for(var h=0,f;h<this.fieldsArray.length;++h)(f=this.fieldsArray[h]).parent&&f.parent.remove(f);i.prototype.onRemove.call(this,l)},a.d=function(){for(var l=new Array(arguments.length),h=0;h<arguments.length;)l[h]=arguments[h++];return function(f,d){c.decorateType(f.constructor).add(new a(d,l)),Object.defineProperty(f,d,{get:c.oneOfGetter(l),set:c.oneOfSetter(l)})}}},{16:16,24:24,37:37}],26:[function(t,n,s){n.exports=M,M.filename=null,M.defaults={keepCase:!1};var i=t(34),o=t(29),c=t(35),a=t(16),u=t(20),l=t(25),h=t(15),f=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]+$/,k=/^-?0[0-7]+$/,S=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,E=/^[a-zA-Z_][a-zA-Z_0-9]*$/,N=/^(?:\.?[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 M(J,we,q){we instanceof o||(q=we,we=new o),q||(q=M.defaults);var Q=i(J,q.alternateCommentMode||!1),B=Q.next,de=Q.push,le=Q.peek,D=Q.skip,at=Q.cmnt,St=!0,ct,z,re,ie,he=!1,ke=we,Ie=q.keepCase?function(A){return A}:m.camelCase;function V(A,O,R){var P=M.filename;return R||(M.filename=null),Error("illegal "+(O||"token")+" '"+A+"' ("+(P?P+", ":"")+"line "+Q.line+")")}function Qe(){var A=[],O;do{if((O=B())!=='"'&&O!=="'")throw V(O);A.push(B()),D(O),O=le()}while(O==='"'||O==="'");return A.join("")}function qo(A){var O=B();switch(O){case"'":case'"':return de(O),Qe();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return Bh(O,!0)}catch{if(N.test(O))return O;throw V(O,"value")}}function jn(A,O){var R,P;do O&&((R=le())==='"'||R==="'")?A.push(Qe()):A.push([P=Bt(B()),D("to",!0)?Bt(B()):P]);while(D(",",!0));D(";")}function Bh(A,O){var R=1;switch(A.charAt(0)==="-"&&(R=-1,A=A.substring(1)),A){case"inf":case"INF":case"Inf":return R*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(g.test(A))return R*parseInt(A,10);if(w.test(A))return R*parseInt(A,16);if(b.test(A))return R*parseInt(A,8);if(S.test(A))return R*parseFloat(A);throw V(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 V(A,"id");if(y.test(A))return parseInt(A,10);if(_.test(A))return parseInt(A,16);if(k.test(A))return parseInt(A,8);throw V(A,"id")}function $h(){if(ct!==e)throw V("package");if(ct=B(),!N.test(ct))throw V(ct,"name");ke=ke.define(ct),D(";")}function Wh(){var A=le(),O;switch(A){case"weak":O=re||(re=[]),B();break;case"public":B();default:O=z||(z=[]);break}A=Qe(),D(";"),O.push(A)}function Vh(){if(D("="),ie=Qe(),he=ie==="proto3",!he&&ie!=="proto2")throw V(ie,"syntax");D(";")}function Un(A,O){switch(O){case"option":return Ze(A,O),D(";"),!0;case"message":return Hh(A,O),!0;case"enum":return Zh(A,O),!0;case"service":return Yh(A,O),!0;case"extend":return Qh(A,O),!0}return!1}function Je(A,O,R){var P=Q.line;if(A&&(A.comment=at(),A.filename=M.filename),D("{",!0)){for(var oe;(oe=B())!=="}";)O(oe);D(";",!0)}else R&&R(),D(";"),A&&typeof A.comment!="string"&&(A.comment=at(P))}function Hh(A,O){if(!E.test(O=B()))throw V(O,"type name");var R=new c(O);Je(R,function(P){if(!Un(R,P))switch(P){case"map":zh(R);break;case"required":case"optional":case"repeated":$t(R,P);break;case"oneof":Jh(R,P);break;case"extensions":jn(R.extensions||(R.extensions=[]));break;case"reserved":jn(R.reserved||(R.reserved=[]),!0);break;default:if(!he||!N.test(P))throw V(P);de(P),$t(R,"optional");break}}),A.add(R)}function $t(A,O,R){var P=B();if(P==="group"){qh(A,O);return}if(!N.test(P))throw V(P,"type");var oe=B();if(!E.test(oe))throw V(oe,"name");oe=Ie(oe),D("=");var pe=new a(oe,Bt(B()),P,O,R);Je(pe,function(Xe){if(Xe==="option")Ze(pe,Xe),D(";");else throw V(Xe)},function(){$n(pe)}),A.add(pe),!he&&pe.repeated&&(p.packed[P]!==e||p.basic[P]===e)&&pe.setOption("packed",!1,!0)}function qh(A,O){var R=B();if(!E.test(R))throw V(R,"name");var P=m.lcFirst(R);R===P&&(R=m.ucFirst(R)),D("=");var oe=Bt(B()),pe=new c(R);pe.group=!0;var Xe=new a(P,oe,R,O);Xe.filename=M.filename,Je(pe,function(_t){switch(_t){case"option":Ze(pe,_t),D(";");break;case"required":case"optional":case"repeated":$t(pe,_t);break;default:throw V(_t)}}),A.add(pe).add(Xe)}function zh(A){D("<");var O=B();if(p.mapKey[O]===e)throw V(O,"type");D(",");var R=B();if(!N.test(R))throw V(R,"type");D(">");var P=B();if(!E.test(P))throw V(P,"name");D("=");var oe=new u(Ie(P),Bt(B()),O,R);Je(oe,function(pe){if(pe==="option")Ze(oe,pe),D(";");else throw V(pe)},function(){$n(oe)}),A.add(oe)}function Jh(A,O){if(!E.test(O=B()))throw V(O,"name");var R=new l(Ie(O));Je(R,function(P){P==="option"?(Ze(R,P),D(";")):(de(P),$t(R,"optional"))}),A.add(R)}function Zh(A,O){if(!E.test(O=B()))throw V(O,"name");var R=new h(O);Je(R,function(P){switch(P){case"option":Ze(R,P),D(";");break;case"reserved":jn(R.reserved||(R.reserved=[]),!0);break;default:Gh(R,P)}}),A.add(R)}function Gh(A,O){if(!E.test(O))throw V(O,"name");D("=");var R=Bt(B(),!0),P={};Je(P,function(oe){if(oe==="option")Ze(P,oe),D(";");else throw V(oe)},function(){$n(P)}),A.add(O,R,P.comment)}function Ze(A,O){var R=D("(",!0);if(!N.test(O=B()))throw V(O,"name");var P=O;R&&(D(")"),P="("+P+")",O=le(),x.test(O)&&(P+=O,B())),D("="),Bn(A,P)}function Bn(A,O){if(D("{",!0))do{if(!E.test(Ce=B()))throw V(Ce,"name");le()==="{"?Bn(A,O+"."+Ce):(D(":"),le()==="{"?Bn(A,O+"."+Ce):zo(A,O+"."+Ce,qo()))}while(!D("}",!0));else zo(A,O,qo())}function zo(A,O,R){A.setOption&&A.setOption(O,R)}function $n(A){if(D("[",!0)){do Ze(A,"option");while(D(",",!0));D("]")}return A}function Yh(A,O){if(!E.test(O=B()))throw V(O,"service name");var R=new f(O);Je(R,function(P){if(!Un(R,P))if(P==="rpc")Kh(R,P);else throw V(P)}),A.add(R)}function Kh(A,O){var R=O;if(!E.test(O=B()))throw V(O,"name");var P=O,oe,pe,Xe,_t;if(D("("),D("stream",!0)&&(pe=!0),!N.test(O=B())||(oe=O,D(")"),D("returns"),D("("),D("stream",!0)&&(_t=!0),!N.test(O=B())))throw V(O);Xe=O,D(")");var Wn=new d(P,R,oe,Xe,pe,_t);Je(Wn,function(Vn){if(Vn==="option")Ze(Wn,Vn),D(";");else throw V(Vn)}),A.add(Wn)}function Qh(A,O){if(!N.test(O=B()))throw V(O,"reference");var R=O;Je(null,function(P){switch(P){case"required":case"repeated":case"optional":$t(A,P,R);break;default:if(!he||!N.test(P))throw V(P);de(P),$t(A,"optional",R);break}})}for(var Ce;(Ce=B())!==null;)switch(Ce){case"package":if(!St)throw V(Ce);$h();break;case"import":if(!St)throw V(Ce);Wh();break;case"syntax":if(!St)throw V(Ce);Vh();break;case"option":if(!St)throw V(Ce);Ze(ke,Ce),D(";");break;default:if(Un(ke,Ce)){St=!1;continue}throw V(Ce)}return M.filename=null,{package:ct,imports:z,weakImports:re,syntax:ie,root:we}}},{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 h=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):h(g)})(m)}:h,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 f(){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 f.call(this)[g](!1)},uint64:function(){return f.call(this)[g](!0)},sint64:function(){return f.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,h,f;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 k=this;if(!b)return u.asPromise(y,k,w,_);var S=b===p;function E(q,Q){if(b){var B=b;if(b=null,S)throw q;B(q,Q)}}function N(q,Q){try{if(u.isString(Q)&&Q.charAt(0)==="{"&&(Q=JSON.parse(Q)),!u.isString(Q))k.setOptions(Q.options).addJSON(Q.nested);else{h.filename=q;var B=h(Q,k,_),de,le=0;if(B.imports)for(;le<B.imports.length;++le)(de=k.resolvePath(q,B.imports[le]))&&x(de);if(B.weakImports)for(le=0;le<B.weakImports.length;++le)(de=k.resolvePath(q,B.weakImports[le]))&&x(de,!0)}}catch(D){E(D)}!S&&!M&&E(null,k)}function x(q,Q){var B=q.lastIndexOf("google/protobuf/");if(B>-1){var de=q.substring(B);de in f&&(q=de)}if(!(k.files.indexOf(q)>-1)){if(k.files.push(q),q in f){S?N(q,f[q]):(++M,setTimeout(function(){--M,N(q,f[q])}));return}if(S){var le;try{le=u.fs.readFileSync(q).toString("utf8")}catch(D){Q||E(D);return}N(q,le)}else++M,u.fetch(q,function(D,at){if(--M,!!b){if(D){Q?M||E(null,k):E(D);return}N(q,at)}})}}var M=0;u.isString(w)&&(w=[w]);for(var J=0,we;J<w.length;++J)(we=k.resolvePath("",w[J]))&&x(we);return S?k:(M||E(null,k),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,h=w,f=_}},{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,h,f){if(!h)throw TypeError("request must be specified");var d=this;if(!f)return i.asPromise(c,d,a,u,l,h);if(!d.rpcImpl)return setTimeout(function(){f(Error("already ended"))},0),e;try{return d.rpcImpl(a,u[d.requestDelimited?"encodeDelimited":"encode"](h).finish(),function(p,m){if(p)return d.emit("error",p,a),f(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),f(g)}return d.emit("data",m,a),f(null,m)})}catch(p){return d.emit("error",p,a),setTimeout(function(){f(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(h,f){i.call(this,h,f),this.methods={},this._methodsArray=null}u.fromJSON=function(h,f){var d=new u(h,f.options);if(f.methods)for(var p=Object.keys(f.methods),m=0;m<p.length;++m)d.add(o.fromJSON(p[m],f.methods[p[m]]));return f.nested&&d.addJSON(f.nested),d.comment=f.comment,d},u.prototype.toJSON=function(h){var f=i.prototype.toJSON.call(this,h),d=h?!!h.keepComments:!1;return c.toObject(["options",f&&f.options||e,"methods",i.arrayToJSON(this.methodsArray,h)||{},"nested",f&&f.nested||e,"comment",d?this.comment:e])},Object.defineProperty(u.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=c.toArray(this.methods))}});function l(h){return h._methodsArray=null,h}u.prototype.get=function(h){return this.methods[h]||i.prototype.get.call(this,h)},u.prototype.resolveAll=function(){for(var h=this.methodsArray,f=0;f<h.length;++f)h[f].resolve();return i.prototype.resolve.call(this)},u.prototype.add=function(h){if(this.get(h.name))throw Error("duplicate name '"+h.name+"' in "+this);return h instanceof o?(this.methods[h.name]=h,h.parent=this,l(this)):i.prototype.add.call(this,h)},u.prototype.remove=function(h){if(h instanceof o){if(this.methods[h.name]!==h)throw Error(h+" is not a member of "+this);return delete this.methods[h.name],h.parent=null,l(this)}return i.prototype.remove.call(this,h)},u.prototype.create=function(h,f,d){for(var p=new a.Service(h,f,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,h=/\s/,f=/\\(.?)/g,d={0:"\0",r:"\r",n:`
|
|
18
|
+
`,t:" "};function p(g){return g.replace(f,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,k=null,S=null,E=0,N=!1,x=[],M=null;function J(z){return Error("illegal "+z+" (line "+b+")")}function we(){var z=M==="'"?c:o;z.lastIndex=w-1;var re=z.exec(g);if(!re)throw J("string");return w=z.lastIndex,D(M),M=null,p(re[1])}function q(z){return g.charAt(z)}function Q(z,re){k=g.charAt(z++),E=b,N=!1;var ie;y?ie=2:ie=3;var he=z-ie,ke;do if(--he<0||(ke=g.charAt(he))===`
|
|
19
|
+
`){N=!0;break}while(ke===" "||ke===" ");for(var Ie=g.substring(z,re).split(l),V=0;V<Ie.length;++V)Ie[V]=Ie[V].replace(y?u:a,"").trim();S=Ie.join(`
|
|
20
|
+
`).trim()}function B(z){var re=de(z),ie=g.substring(z,re),he=/^\s*\/{1,2}/.test(ie);return he}function de(z){for(var re=z;re<_&&q(re)!==`
|
|
21
|
+
`;)re++;return re}function le(){if(x.length>0)return x.shift();if(M)return we();var z,re,ie,he,ke;do{if(w===_)return null;for(z=!1;h.test(ie=q(w));)if(ie===`
|
|
22
|
+
`&&++b,++w===_)return null;if(q(w)==="/"){if(++w===_)throw J("comment");if(q(w)==="/")if(y){if(he=w,ke=!1,B(w)){ke=!0;do{if(w=de(w),w===_)break;w++}while(B(w))}else w=Math.min(_,de(w)+1);ke&&Q(he,w),b++,z=!0}else{for(ke=q(he=w+1)==="/";q(++w)!==`
|
|
23
|
+
`;)if(w===_)return null;++w,ke&&Q(he,w-1),++b,z=!0}else if((ie=q(w))==="*"){he=w+1,ke=y||q(he)==="*";do{if(ie===`
|
|
24
|
+
`&&++b,++w===_)throw J("comment");re=ie,ie=q(w)}while(re!=="*"||ie!=="/");++w,ke&&Q(he,w-2),z=!0}else return"/"}}while(z);var Ie=w;i.lastIndex=0;var V=i.test(q(Ie++));if(!V)for(;Ie<_&&!i.test(q(Ie));)++Ie;var Qe=g.substring(w,w=Ie);return(Qe==='"'||Qe==="'")&&(M=Qe),Qe}function D(z){x.push(z)}function at(){if(!x.length){var z=le();if(z===null)return null;D(z)}return x[0]}function St(z,re){var ie=at(),he=ie===z;if(he)return le(),!0;if(!re)throw J("token '"+ie+"', '"+z+"' expected");return!1}function ct(z){var re=null;return z===e?E===b-1&&(y||k==="*"||N)&&(re=S):(E<z&&at(),E===z&&!N&&(y||k==="/")&&(re=S)),re}return Object.defineProperty({next:le,peek:at,push:D,skip:St,cmnt:ct},"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),h=t(21),f=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 N=this.fields[S[E]],x=N.id;if(this._fieldsById[x])throw Error("duplicate id "+x+" in "+this);this._fieldsById[x]=N}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 h||((S.prototype=new h).constructor=S,p.merge(S.prototype,E)),S.$type=S.prototype.$type=this,p.merge(S,h,!0),this._ctor=S;for(var N=0;N<this.fieldsArray.length;++N)this._fieldsArray[N].resolve();var x={};for(N=0;N<this.oneofsArray.length;++N)x[this._oneofsArray[N].resolve().name]={get:p.oneOfGetter(this._oneofsArray[N].oneof),set:p.oneOfSetter(this._oneofsArray[N].oneof)};N&&Object.defineProperties(S.prototype,x)}}}),b.generateConstructor=function(S){for(var E=p.codegen(["p"],S.name),N=0,x;N<S.fieldsArray.length;++N)(x=S._fieldsArray[N]).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 k(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 N=new b(S,E.options);N.extensions=E.extensions,N.reserved=E.reserved;for(var x=Object.keys(E.fields),M=0;M<x.length;++M)N.add((typeof E.fields[x[M]].keyType<"u"?u.fromJSON:a.fromJSON)(x[M],E.fields[x[M]]));if(E.oneofs)for(x=Object.keys(E.oneofs),M=0;M<x.length;++M)N.add(c.fromJSON(x[M],E.oneofs[x[M]]));if(E.nested)for(x=Object.keys(E.nested),M=0;M<x.length;++M){var J=E.nested[x[M]];N.add((J.id!==e?a.fromJSON:J.fields!==e?b.fromJSON:J.values!==e?o.fromJSON:J.methods!==e?l.fromJSON:i.fromJSON)(x[M],J))}return E.extensions&&E.extensions.length&&(N.extensions=E.extensions),E.reserved&&E.reserved.length&&(N.reserved=E.reserved),E.group&&(N.group=!0),E.comment&&(N.comment=E.comment),N},b.prototype.toJSON=function(S){var E=i.prototype.toJSON.call(this,S),N=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",N?this.comment:e])},b.prototype.resolveAll=function(){for(var S=this.fieldsArray,E=0;E<S.length;)S[E++].resolve();var N=this.oneofsArray;for(E=0;E<N.length;)N[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),k(this)}return S instanceof c?(this.oneofs||(this.oneofs={}),this.oneofs[S.name]=S,S.onAdd(this),k(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),k(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),k(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=[],N=0;N<this.fieldsArray.length;++N)E.push(this._fieldsArray[N].resolve().resolvedType);this.encode=m(this)({Writer:d,types:E,util:p}),this.decode=g(this)({Reader:f,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 M=Object.create(this);M.fromObject=this.fromObject,this.fromObject=x.fromObject.bind(M),M.toObject=this.toObject,this.toObject=x.toObject.bind(M)}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 f||(S=f.create(S)),this.decode(S,S.uint32())},b.prototype.verify=function(S){return this.setup().verify(S)},b.prototype.fromObject=function(S){return this.setup().fromObject(S)},b.prototype.toObject=function(S,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 h=0,f={};for(l|=0;h<u.length;)f[c[h+l]]=u[h++];return f}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 h=/_([a-z])/g;i.camelCase=function(d){return d.substring(0,1)+d.substring(1).replace(h,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 f=0;i.decorateEnum=function(d){if(d.$type)return d.$type;a||(a=t(15));var p=new a("Enum"+f++,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,h){this.lo=l>>>0,this.hi=h>>>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 h=l<0;h&&(l=-l);var f=l>>>0,d=(l-f)/4294967296>>>0;return h&&(d=~d>>>0,f=~f>>>0,++f>4294967295&&(f=0,++d>4294967295&&(d=0))),new o(f,d)},o.from=function(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 h=~this.lo+1>>>0,f=~this.hi>>>0;return h||(f=f+1>>>0),-(h+f*4294967296)}return this.lo+this.hi*4294967296},o.prototype.toLong=function(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,h=(this.lo>>>28|this.hi<<4)>>>0,f=this.hi>>>24;return f===0?h===0?l<16384?l<128?1:2:l<2097152?3:4:h<16384?h<128?5:6:h<2097152?7:8:f<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=!!(nr.process&&nr.process.versions&&nr.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=nr.dcodeIO&&nr.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 h=Object.keys(u),f=0;f<h.length;++f)(a[h[f]]===e||!l)&&(a[h[f]]=u[h[f]]);return a}i.merge=o,i.lcFirst=function(a){return a.charAt(0).toLowerCase()+a.substring(1)};function c(a){function u(l,h){if(!(this instanceof u))return new u(l,h);Object.defineProperty(this,"message",{get:function(){return l}}),Error.captureStackTrace?Error.captureStackTrace(this,u):Object.defineProperty(this,"stack",{value:new Error().stack||""}),h&&o(this,h)}return(u.prototype=Object.create(Error.prototype)).constructor=u,Object.defineProperty(u.prototype,"name",{get:function(){return a}}),u.prototype.toString=function(){return this.name+": "+this.message},u}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 h=Object.keys(this),f=h.length-1;f>-1;--f)if(u[h[f]]===1&&this[h[f]]!==e&&this[h[f]]!==null)return h[f]}},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(h,f){return h.name+": "+f+(h.repeated&&f!=="array"?"[]":h.map&&f!=="object"?"{k:"+h.keyType+"}":"")+" expected"}function a(h,f,d,p){if(f.resolvedType)if(f.resolvedType instanceof i){h("switch(%s){",p)("default:")("return%j",c(f,"enum value"));for(var m=Object.keys(f.resolvedType.values),g=0;g<m.length;++g)h("case %i:",f.resolvedType.values[m[g]]);h("break")("}")}else h("{")("var e=types[%i].verify(%s);",d,p)("if(e)")("return%j+e",f.name+".")("}");else switch(f.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":h("if(!util.isInteger(%s))",p)("return%j",c(f,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":h("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",p,p,p,p)("return%j",c(f,"integer|Long"));break;case"float":case"double":h('if(typeof %s!=="number")',p)("return%j",c(f,"number"));break;case"bool":h('if(typeof %s!=="boolean")',p)("return%j",c(f,"boolean"));break;case"string":h("if(!util.isString(%s))",p)("return%j",c(f,"string"));break;case"bytes":h('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',p,p,p)("return%j",c(f,"buffer"));break}return h}function u(h,f,d){switch(f.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":h("if(!util.key32Re.test(%s))",d)("return%j",c(f,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":h("if(!util.key64Re.test(%s))",d)("return%j",c(f,"integer|Long key"));break;case"bool":h("if(!util.key2Re.test(%s))",d)("return%j",c(f,"boolean key"));break}return h}function l(h){var f=o.codegen(["m"],h.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),d=h.oneofsArray,p={};d.length&&f("var p={}");for(var m=0;m<h.fieldsArray.length;++m){var g=h._fieldsArray[m].resolve(),y="m"+o.safeProp(g.name);if(g.optional&&f("if(%s!=null&&m.hasOwnProperty(%j)){",y,g.name),g.map)f("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(f,g,"k[i]"),a(f,g,m,y+"[k[i]]")("}");else if(g.repeated)f("if(!Array.isArray(%s))",y)("return%j",c(g,"array"))("for(var i=0;i<%s.length;++i){",y),a(f,g,m,y+"[i]")("}");else{if(g.partOf){var w=o.safeProp(g.partOf.name);p[g.partOf.name]===1&&f("if(p%s===1)",w)("return%j",g.partOf.name+": multiple values"),p[g.partOf.name]=1,f("p%s=1",w)}a(f,g,m,y)}g.optional&&f("}")}return f("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 h=c.$type.toObject(c,a);return h["@type"]=c.$type.fullName,h}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,k,S){this.fn=b,this.len=k,this.next=e,this.val=S}function h(){}function f(b){this.head=b.head,this.tail=b.tail,this.len=b.len,this.next=b.states}function d(){this.len=0,this.head=new l(h,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,k,S){return this.tail=this.tail.next=new l(b,k,S),this.len+=k,this};function p(b,k,S){k[S]=b&255}function m(b,k,S){for(;b>127;)k[S++]=b&127|128,b>>>=7;k[S]=b}function g(b,k){this.len=b,this.next=e,this.val=k}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,k,S){for(;b.hi;)k[S++]=b.lo&127|128,b.lo=(b.lo>>>7|b.hi<<25)>>>0,b.hi>>>=7;for(;b.lo>127;)k[S++]=b.lo&127|128,b.lo=b.lo>>>7;k[S++]=b.lo}d.prototype.uint64=function(b){var k=c.from(b);return this._push(y,k.length(),k)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(b){var k=c.from(b).zzEncode();return this._push(y,k.length(),k)},d.prototype.bool=function(b){return this._push(p,1,b?1:0)};function w(b,k,S){k[S]=b&255,k[S+1]=b>>>8&255,k[S+2]=b>>>16&255,k[S+3]=b>>>24}d.prototype.fixed32=function(b){return this._push(w,4,b>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(b){var k=c.from(b);return this._push(w,4,k.lo)._push(w,4,k.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(b){return this._push(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,k,S){k.set(b,S)}:function(b,k,S){for(var E=0;E<b.length;++E)k[S+E]=b[E]};d.prototype.bytes=function(b){var k=b.length>>>0;if(!k)return this._push(p,1,0);if(i.isString(b)){var S=d.alloc(k=a.length(b));a.decode(b,S,0),b=S}return this.uint32(k)._push(_,k,b)},d.prototype.string=function(b){var k=u.length(b);return k?this.uint32(k)._push(u.write,k,b):this._push(p,1,0)},d.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new l(h,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(h,0,0),this.len=0),this},d.prototype.ldelim=function(){var b=this.head,k=this.tail,S=this.len;return this.reset().uint32(S),S&&(this.tail.next=b.next,this.tail=k,this.len+=S),this},d.prototype.finish=function(){for(var b=this.head.next,k=this.constructor.alloc(this.len),S=0;b;)b.fn(b.val,k,S),S+=b.len,b=b.next;return k},d._configure=function(b){o=b}},{39:39}],43:[function(t,n,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(h){return(a.alloc=o._Buffer_allocUnsafe)(h)};var u=c&&c.prototype instanceof Uint8Array&&c.prototype.set.name==="set"?function(h,f,d){f.set(h,d)}:function(h,f,d){if(h.copy)h.copy(f,d,0,h.length);else for(var p=0;p<h.length;)f[d++]=h[p++]};a.prototype.bytes=function(h){o.isString(h)&&(h=o._Buffer_from(h,"base64"));var f=h.length>>>0;return this.uint32(f),f&&this._push(u,f,h),this};function l(h,f,d){h.length<40?o.utf8.write(h,f,d):f.utf8Write(h,d)}a.prototype.string=function(h){var f=c.byteLength(h);return this.uint32(f),f&&this._push(l,f,h),this}},{39:39,42:42}]},{},[19])})()}(Dn)),Dn.exports}var Eh=kh();const sr=vh(Eh);let G=sr.Reader,ve=sr.Writer,ge=sr.util;const F=sr.roots["push-server"]||(sr.roots["push-server"]={});F.RequestBatch=function(){function r(e){if(this.requests=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.requests=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.requests!=null&&e.requests.length)for(var n=0;n<e.requests.length;++n)F.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 F.RequestBatch;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.requests&&s.requests.length||(s.requests=[]),s.requests.push(F.Request.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),F.Request=function(){function r(t){if(t)for(var n=Object.keys(t),s=0;s<n.length;++s)t[n[s]]!=null&&(this[n[s]]=t[n[s]])}r.prototype.incomingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:ge.oneOfGetter(e=["incomingMessages","channelStats","serverStats"]),set:ge.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=ve.create()),t.incomingMessages!=null&&t.hasOwnProperty("incomingMessages")&&F.IncomingMessagesRequest.encode(t.incomingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&F.ChannelStatsRequest.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&F.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 F.Request;t.pos<s;){var o=t.uint32();switch(o>>>3){case 1:i.incomingMessages=F.IncomingMessagesRequest.decode(t,t.uint32());break;case 2:i.channelStats=F.ChannelStatsRequest.decode(t,t.uint32());break;case 3:i.serverStats=F.ServerStatsRequest.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return i},r}(),F.IncomingMessagesRequest=function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.messages=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)F.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 F.IncomingMessagesRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(F.IncomingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),F.IncomingMessage=function(){function r(e){if(this.receivers=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.receivers=ge.emptyArray,r.prototype.sender=null,r.prototype.body="",r.prototype.expiry=0,r.prototype.type="",r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.receivers!=null&&e.receivers.length)for(var n=0;n<e.receivers.length;++n)F.Receiver.encode(e.receivers[n],t.uint32(10).fork()).ldelim();return e.sender!=null&&e.hasOwnProperty("sender")&&F.Sender.encode(e.sender,t.uint32(18).fork()).ldelim(),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(26).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(32).uint32(e.expiry),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(42).string(e.type),t},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 F.IncomingMessage;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.receivers&&s.receivers.length||(s.receivers=[]),s.receivers.push(F.Receiver.decode(e,e.uint32()));break;case 2:s.sender=F.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}(),F.ChannelStatsRequest=function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.channels=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)F.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 F.ChannelStatsRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.channels&&s.channels.length||(s.channels=[]),s.channels.push(F.ChannelId.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),F.ChannelId=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=ge.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=ge.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new F.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}(),F.ServerStatsRequest=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new F.ServerStatsRequest;e.pos<n;){var i=e.uint32();switch(i>>>3){default:e.skipType(i&7);break}}return s},r}(),F.Sender=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.type=0,r.prototype.id=ge.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(8).int32(e.type),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(18).bytes(e.id),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new F.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}(),F.SenderType=function(){var r={},e=Object.create(r);return e[r[0]="UNKNOWN"]=0,e[r[1]="CLIENT"]=1,e[r[2]="BACKEND"]=2,e}(),F.Receiver=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=ge.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=ge.newBuffer([]),r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new F.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}(),F.ResponseBatch=function(){function r(e){if(this.responses=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.responses=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.responses!=null&&e.responses.length)for(var n=0;n<e.responses.length;++n)F.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 F.ResponseBatch;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.responses&&s.responses.length||(s.responses=[]),s.responses.push(F.Response.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),F.Response=function(){function r(t){if(t)for(var n=Object.keys(t),s=0;s<n.length;++s)t[n[s]]!=null&&(this[n[s]]=t[n[s]])}r.prototype.outgoingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:ge.oneOfGetter(e=["outgoingMessages","channelStats","serverStats"]),set:ge.oneOfSetter(e)}),r.create=function(t){return new r(t)},r.encode=function(t,n){return n||(n=ve.create()),t.outgoingMessages!=null&&t.hasOwnProperty("outgoingMessages")&&F.OutgoingMessagesResponse.encode(t.outgoingMessages,n.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&F.ChannelStatsResponse.encode(t.channelStats,n.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&F.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 F.Response;t.pos<s;){var o=t.uint32();switch(o>>>3){case 1:i.outgoingMessages=F.OutgoingMessagesResponse.decode(t,t.uint32());break;case 2:i.channelStats=F.ChannelStatsResponse.decode(t,t.uint32());break;case 3:i.serverStats=F.JsonResponse.decode(t,t.uint32());break;default:t.skipType(o&7);break}}return i},r}(),F.OutgoingMessagesResponse=function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.messages=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.messages!=null&&e.messages.length)for(var n=0;n<e.messages.length;++n)F.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 F.OutgoingMessagesResponse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(F.OutgoingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),F.OutgoingMessage=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=ge.newBuffer([]),r.prototype.body="",r.prototype.expiry=0,r.prototype.created=0,r.prototype.sender=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(18).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(24).uint32(e.expiry),e.created!=null&&e.hasOwnProperty("created")&&t.uint32(37).fixed32(e.created),e.sender!=null&&e.hasOwnProperty("sender")&&F.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 F.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=F.Sender.decode(e,e.uint32());break;default:e.skipType(i&7);break}}return s},r}(),F.ChannelStatsResponse=function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.channels=ge.emptyArray,r.create=function(e){return new r(e)},r.encode=function(e,t){if(t||(t=ve.create()),e.channels!=null&&e.channels.length)for(var n=0;n<e.channels.length;++n)F.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 F.ChannelStatsResponse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:s.channels&&s.channels.length||(s.channels=[]),s.channels.push(F.ChannelStats.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return s},r}(),F.ChannelStats=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.id=ge.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.isOnline=!1,r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.isOnline!=null&&e.hasOwnProperty("isOnline")&&t.uint32(24).bool(e.isOnline),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new F.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}(),F.JsonResponse=function(){function r(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return r.prototype.json="",r.create=function(e){return new r(e)},r.encode=function(e,t){return t||(t=ve.create()),e.json!=null&&e.hasOwnProperty("json")&&t.uint32(10).string(e.json),t},r.decode=function(e,t){e instanceof G||(e=G.create(e));for(var n=t===void 0?e.len:e.pos+t,s=new F.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 Th=F.ResponseBatch,Fo=F.RequestBatch,Oh=F.IncomingMessage,Po=F.Receiver;class Mo{_logger=null;_connected=!1;_connectionType;_disconnectCode=0;_disconnectReason="";_parent;_callbacks;constructor(e){this._parent=e.parent,this._connectionType=te.Undefined,this._callbacks={onOpen:L.isFunction(e.onOpen)?e.onOpen:()=>{},onDisconnect:L.isFunction(e.onDisconnect)?e.onDisconnect:()=>{},onError:L.isFunction(e.onError)?e.onError:()=>{},onMessage:L.isFunction(e.onMessage)?e.onMessage:()=>{}}}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Ee.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 Ah extends Mo{_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 Ih=60;class Ch extends Mo{_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),Ih*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,L.isStringFilled(e)||e instanceof ArrayBuffer?this._callbacks.onMessage(e):this._parent.session.mid=null,this.performRequest();else if(this._xhr.status===304){if(this.connected=!0,this._xhr.getResponseHeader("Expires")==="Thu, 01 Jan 1973 11:11:01 GMT"){const t=this._xhr.getResponseHeader("Last-Message-Id");L.isStringFilled(t)&&this._parent.setLastMessageId(t||"")}this.performRequest()}else this._callbacks.onError(new Error("Could not connect to the server")),this.connected=!1}clearTimeOut(){this._failureTimeout&&(clearTimeout(this._failureTimeout),this._failureTimeout=null),this._requestTimeout&&(clearTimeout(this._requestTimeout),this._requestTimeout=null)}createXhr(){const e=new XMLHttpRequest;return this._parent.isProtobufSupported()&&!this._parent.isJsonRpc()&&(e.responseType="arraybuffer"),e.addEventListener("readystatechange",this.onXhrReadyStateChange.bind(this)),e}}const ir=19,xo=30*60,Nh=5e3,Rh=60*1e3,Do=10,jo=10,Lh="ping",Fh="pong",Uo="bx-pull-session",Ph=20,Bo={api:{},channels:{},publicChannels:{},server:{timeShift:0},clientId:null,jwt:null,exp:0};class $o{_logger=null;_restClient;_status;_context;_guestMode;_guestUserId;_userId;_configGetMethod;_getPublicListMethod;_siteId;_enabled;_unloading=!1;_starting=!1;_debug=!1;_connectionAttempt=0;_connectionType=te.WebSocket;_reconnectTimeout=null;_restartTimeout=null;_restoreWebSocketTimeout=null;_skipStorageInit;_skipCheckRevision;_subscribers={};_watchTagsQueue=new Map;_watchUpdateInterval=174e4;_watchForceUpdateInterval=5e3;_configTimestamp=0;_session={mid:null,tag:null,time:null,history:{},lastMessageIds:[],messageCount:0};_connectors={[te.Undefined]:null,[te.WebSocket]:null,[te.LongPolling]:null};_isSecure;_config=null;_storage=null;_sharedConfig;_channelManager;_jsonRpcAdapter=null;_checkInterval=null;_offlineTimeout=null;_watchUpdateTimeout=null;_pingWaitTimeout=null;_isManualDisconnect=!1;_loggingEnabled=!1;_onPingTimeoutHandler;_userStatusCallbacks={};_connectPromise=null;_startingPromise=null;constructor(e){this._restClient=e.b24,this._status=Le.Offline,this._context="master",e.restApplication&&(typeof e.configGetMethod>"u"&&(e.configGetMethod="pull.application.config.get"),typeof e.skipCheckRevision>"u"&&(e.skipCheckRevision=!0),L.isStringFilled(e.restApplication)&&(e.siteId=e.restApplication),e.serverEnabled=!0),this._guestMode=e.guestMode?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=L.isUndefined(e.serverEnabled)?!0:e.serverEnabled===!0,this._configGetMethod=L.isStringFilled(e.configGetMethod)?e.configGetMethod||"":"pull.config.get",this._getPublicListMethod=L.isStringFilled(e.getPublicListMethod)?e.getPublicListMethod||"":"pull.channel.public.list",this._skipStorageInit=e.skipStorageInit===!0,this._skipCheckRevision=e.skipCheckRevision===!0,L.isUndefined(e.configTimestamp)||(this._configTimestamp=W.toInteger(e.configTimestamp)),this._isSecure=document?.location.href.indexOf("https")===0,this._userId&&!this._skipStorageInit&&(this._storage=new Ro({userId:this._userId,siteId:this._siteId})),this._sharedConfig=new Sh({onWebSocketBlockChanged:this.onWebSocketBlockChanged.bind(this),storage:this._storage}),this._channelManager=new _h({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=Ee.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}destroy(){this.stop(_e.NORMAL_CLOSURE,"manual stop"),this.onBeforeUnload()}init(){this._connectors.webSocket=new Ah({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 Ch({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 bh({connector:this._connectors.webSocket,handlers:{"incoming.message":this.handleRpcIncomingMessage.bind(this)}})}get connector(){return this._connectors[this._connectionType]}get status(){return this._status}set status(e){this._status!==e&&(this._status=e,this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),e===Le.Offline?this.sendPullStatusDelayed(e,Nh):this.sendPullStatus(e))}get session(){return this._session}subscribe(e){if(!L.isPlainObject(e))return this.attachCommandHandler(e);if(e=e,e.type=e.type||Fe.Server,e.command=e.command||null,e.type==Fe.Server||e.type==Fe.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=Fe.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&&L.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(Uo,null)),L.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=Le.Offline,this.stopCheckConfig(),this.getLogger().error(`${W.getDateForLog()}: Pull: could not read push-server config `,a),c(a)})})}restart(e=_e.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(Re.PullConfig),this._config=null;const n=`${e}_${t.replaceAll(" ","_")}`;this.loadConfig(n).then(s=>{this.setConfig(s,!0),this.updateWatch(),this.startCheckConfig(),this.connect().catch(i=>{this.getLogger().error(i)})},s=>{this.getLogger().error(`${W.getDateForLog()}: Pull: could not read push-server config `,s),this.status=Le.Offline,this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),(s?.status==401||s?.status==403)&&(this.stopCheckConfig(),this.onCustomEvent("onPullError",["AUTHORIZE_ERROR"]))})}stop(e=_e.NORMAL_CLOSURE,t="manual stop"){this.disconnect(e,t),this.stopCheckConfig()}reconnect(e,t,n=1){this.disconnect(e,t),this.scheduleReconnect(n)}setLastMessageId(e){this._session.mid=e}async sendMessage(e,t,n,s,i){const o={userList:e,body:{module_id:t,command:n,params:s},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(He.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(He.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(He.ListChannels,{})||Promise.reject(new Error("jsonRpcAdapter not init"))}async getUsersLastSeen(e){if(!L.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(He.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(He.Ping,{},e)}async subscribeUserStatusChange(e,t){return new Promise((n,s)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(He.SubscribeStatusChange,{userId:e}).then(()=>(this._userStatusCallbacks[e]||(this._userStatusCallbacks[e]=[]),L.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(He.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(!L.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=ir,`${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&&!_i.isIE()}isJsonRpc(){return this.getServerVersion()>=5}isSharedMode(){return this.getServerMode()===un.Shared}emit(e){if(e.type==Fe.Server||e.type==Fe.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=e.extra.server_time_ago>0?e.extra.server_time_ago:0),this.logMessage(e);try{e.extra.sender&&e.extra.sender.type===Tr.Client?(this.onCustomEvent("onPullClientEvent-"+t,[n,e.params,e.extra],!0),this.onCustomEvent("onPullClientEvent",[t,n,e.params,e.extra],!0),this.emit({type:Fe.Client,moduleId:t,data:{command:n,params:L.clone(e.params),extra:L.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:Fe.Online,data:{command:n,params:L.clone(e.params),extra:L.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:Fe.Server,moduleId:t,data:{command:n,params:L.clone(e.params),extra:L.clone(e.extra)}}))}catch(s){this.getLogger().warn(`
|
|
28
25
|
========= PULL ERROR ===========
|
|
29
26
|
Error type: broadcastMessages execute error
|
|
30
|
-
Error event: `,
|
|
27
|
+
Error event: `,s,`
|
|
31
28
|
Message: `,e,`
|
|
32
29
|
================================
|
|
33
|
-
`)}e.extra&&e.extra.revision_web&&this.checkRevision(G.toInteger(e.extra.revision_web))}broadcastMessages(e){for(const t of e)this.broadcastMessage(t)}async sendMessageBatch(e){if(!this.isPublishingEnabled())return this.getLogger().error("Client publishing is not supported or is disabled"),Promise.reject(new Error("Client publishing is not supported or is disabled"));if(this.isJsonRpc()){const t=this._jsonRpcAdapter?.createPublishRequest(e);return this.connector?.send(JSON.stringify(t)),Promise.resolve(!0)}else{const t={};for(const n of e)if(typeof n.userList<"u")for(const i of n.userList){const s=Number(i);t[s]=s}this._channelManager?.getPublicIds(Object.values(t)).then(n=>{const i=this.connector?.send(this.encodeMessageBatch(e,n));return Promise.resolve(i)})}}encodeMessageBatch(e,t){const n=[];e.forEach(s=>{const o=s.body;let l=[];if(s.userList&&(l=this.createMessageReceivers(s.userList,t)),s.channelList){if(!x.isArray(s.channelList))throw new TypeError("messageFields.publicChannels must be an array");s.channelList.forEach(u=>{let c,h;if(typeof u=="string"&&u.includes(".")){const f=u.toString().split(".");c=f[0],h=f[1]}else if(typeof u=="object"&&"publicId"in u&&"signature"in u)c=u?.publicId,h=u?.signature;else throw new Error(`Public channel MUST be either a string, formatted like "{publicId}.{signature}" or an object with fields 'publicId' and 'signature'`);l.push(rl.create({id:this.encodeId(c),signature:this.encodeId(h)}))})}const a=Kh.create({receivers:l,body:JSON.stringify(o),expiry:s.expiry||0});n.push(a)});const i=tl.create({requests:[{incomingMessages:{messages:n}}]});return tl.encode(i).finish()}createMessageReceivers(e,t){const n=[];for(const i of e){if(!t[i]||!t[i].publicId)throw new Error(`Could not determine public id for user ${i}`);n.push(rl.create({id:this.encodeId(t[i].publicId),signature:this.encodeId(t[i].signature)}))}return n}emitUserStatusChange(e,t){if(this._userStatusCallbacks[e])for(const n of this._userStatusCallbacks[e])n({userId:e,isOnline:t})}restoreUserStatusSubscription(){for(const e in this._userStatusCallbacks)this._userStatusCallbacks.hasOwnProperty(e)&&this._userStatusCallbacks[e].length>0&&this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.SubscribeStatusChange,{userId:e})}async loadConfig(e){if(this._config){if(this.isConfigActual(this._config)&&this.checkRevision(this._config.api.revision_web))return Promise.resolve(this._config);this._config=Object.assign({},ll)}else{this._config=Object.assign({},ll);let t;if(this._storage&&(t=this._storage.get(xe.PullConfig,null)),this.isConfigActual(t)&&this.checkRevision(t.api.revision_web))return Promise.resolve(t);this._storage&&this._storage.remove(xe.PullConfig)}return new Promise((t,n)=>{this._restClient.getHttpClient().setLogTag(e),this._restClient.callMethod(this._configGetMethod,{CACHE:"N"}).then(i=>{const s=i.getData().result,o=Math.floor((Date.now()-new Date(s.serverTime).getTime())/1e3);delete s.serverTime;const l=Object.assign({},s);l.server.timeShift=o,t(l)}).catch(i=>{(i?.answerError?.error==="AUTHORIZE_ERROR"||i?.answerError?.error==="WRONG_AUTH_TYPE")&&(i.status=403),n(i)}).finally(()=>{this._restClient.getHttpClient().clearLogTag()})})}isConfigActual(e){if(!x.isPlainObject(e)||Number(e.server.config_timestamp)!==this._configTimestamp)return!1;const t=new Date;if(x.isNumber(e.exp)&&e.exp>0&&e.exp<t.getTime()/1e3||Object.keys(e.channels).length===0)return!1;for(const n in e.channels){if(!e.channels.hasOwnProperty(n))continue;const i=e.channels[n];if(new Date(i.end)<t)return!1}return!0}startCheckConfig(){this._checkInterval&&(clearInterval(this._checkInterval),this._checkInterval=null),this._checkInterval=setInterval(this.checkConfig.bind(this),rd)}stopCheckConfig(){this._checkInterval&&clearInterval(this._checkInterval),this._checkInterval=null}checkConfig(){if(this.isConfigActual(this._config)){if(!this.checkRevision(G.toInteger(this._config?.api.revision_web)))return!1}else this.logToConsole("Stale config detected. Restarting"),this.restart(Ie.CONFIG_EXPIRED,"config expired");return!0}setConfig(e,t){for(const n in e)e.hasOwnProperty(n)&&this._config?.hasOwnProperty(n)&&(this._config[n]=e[n]);if(e.publicChannels&&this.setPublicIds(Object.values(e.publicChannels)),this._configTimestamp=Number(e.server.config_timestamp),this._storage&&t)try{this._storage.set(xe.PullConfig,e)}catch(n){localStorage&&localStorage.removeItem&&localStorage.removeItem("history"),this.getLogger().error(`${G.getDateForLog()}: Pull: Could not cache config in local storage. Error: `,n)}}setPublicIds(e){this._channelManager.setPublicIds(e)}checkRevision(e){return this._skipCheckRevision?!0:e>0&&e!==yr?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(Ie.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[e,yr]),this.emit({type:Ue.Revision,data:{server:e,client:yr}}),this.logToConsole(`Pull revision changed from ${yr} to ${e}. Reload required`),!1):!0}disconnect(e,t){this.connector&&(this._isManualDisconnect=!0,this.connector.disconnect(e,t))}restoreWebSocketConnection(){this._connectionType!==ge.WebSocket&&this._connectors.webSocket?.connect()}scheduleReconnect(e=0){this._enabled&&(e||(e=this.getConnectionAttemptDelay(this._connectionAttempt)),this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.logToConsole(`Pull: scheduling reconnection in ${e} seconds; attempt # ${this._connectionAttempt}`),this._reconnectTimeout=setTimeout(()=>{this.connect().catch(t=>{this.getLogger().error(t)})},e*1e3))}scheduleRestoreWebSocketConnection(){this.logToConsole(`Pull: scheduling restoration of websocket connection in ${il} seconds`),!this._restoreWebSocketTimeout&&(this._restoreWebSocketTimeout=setTimeout(()=>{this._restoreWebSocketTimeout=0,this.restoreWebSocketConnection()},il*1e3))}async connect(){return this._enabled?this.connector?.connected?Promise.resolve():(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.status=je.Connecting,this._connectionAttempt++,new Promise((e,t)=>{this._connectPromise={resolve:e,reject:t},this.connector?.connect()})):Promise.reject()}scheduleRestart(e,t,n=0){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),n<1&&(n=Math.ceil(Math.random()*30)+5),this._restartTimeout=setTimeout(()=>this.restart(e,t),n*1e3)}handleRpcIncomingMessage(e){this._session.mid=e.mid;const t=e.body;return e.body.extra||(t.extra={}),t.extra.sender=e.sender,"user_params"in e&&x.isPlainObject(e.user_params)&&Object.assign(t.params,e.user_params),"dictionary"in e&&x.isPlainObject(e.dictionary)&&Object.assign(t.params,e.dictionary),this.checkDuplicate(e.mid)&&(this.addMessageToStat(t),this.trimDuplicates(),this.broadcastMessage(t)),this.connector?.send(`mack:${e.mid}`),{}}handleIncomingEvents(e){const t=[];if(e.length===0){this._session.mid=null;return}for(const n of e)this.updateSessionFromEvent(n),!(n.mid&&!this.checkDuplicate(n.mid))&&(this.addMessageToStat(n.text),t.push(n.text));this.trimDuplicates(),this.broadcastMessages(t)}updateSessionFromEvent(e){this._session.mid=e.mid||null,this._session.tag=e.tag||null,this._session.time=e.time||null}handleInternalPullEvent(e,t){switch(e.toUpperCase()){case cr.CHANNEL_EXPIRE:{if(t.params.action==="reconnect"){const n=t.params?.channel.type;n==="private"&&this._config?.channels?.private&&(this._config.channels.private=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.private}`)),n==="shared"&&this._config?.channels?.shared&&(this._config.channels.shared=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.shared}`)),this.reconnect(Ie.CONFIG_REPLACED,"config was replaced")}else this.restart(Ie.CHANNEL_EXPIRED,"channel expired received");break}case cr.CONFIG_EXPIRE:{this.restart(Ie.CONFIG_EXPIRED,"config expired received");break}case cr.SERVER_RESTART:{this.reconnect(Ie.SERVER_RESTARTED,"server was restarted",15);break}}}onIncomingMessage(e){if(this.isJsonRpc())e===nd?this.onJsonRpcPing():this._jsonRpcAdapter?.parseJsonRpcMessage(e);else{const t=this.extractMessages(e);this.handleIncomingEvents(t)}}onLongPollingOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=je.Online,this.logToConsole("Pull: Long polling connection with push-server opened"),this.isWebSocketEnabled()&&this.scheduleRestoreWebSocketConnection(),this._connectPromise&&this._connectPromise.resolve({})}onLongPollingDisconnect(e){this._connectionType===ge.LongPolling&&(this.status=je.Offline),this.logToConsole(`Pull: Long polling connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`),this._isManualDisconnect||this.scheduleReconnect(),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onLongPollingError(e){this._starting=!1,this._connectionType===ge.LongPolling&&(this.status=je.Offline),this.getLogger().error(`${G.getDateForLog()}: Pull: Long polling connection error `,e),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}onWebSocketBlockChanged(e){const t=e.isWebSocketBlocked;t&&this._connectionType===ge.WebSocket&&!this.isConnected()?(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._connectionAttempt=0,this._connectionType=ge.LongPolling,this.scheduleReconnect(1)):!t&&this._connectionType===ge.LongPolling&&(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this._connectionAttempt=0,this._connectionType=ge.WebSocket,this.scheduleReconnect(1))}onWebSocketOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=je.Online,this._sharedConfig.setWebSocketBlocked(!1),this._sharedConfig.setLongPollingBlocked(!0),this._connectionType==ge.LongPolling&&(this._connectionType=ge.WebSocket,this._connectors.longPolling?.disconnect(Ie.CONFIG_REPLACED,"Fire at onWebSocketOpen")),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this.logToConsole("Pull: Websocket connection with push-server opened"),this._connectPromise&&this._connectPromise.resolve({}),this.restoreUserStatusSubscription()}onWebSocketDisconnect(e){this._connectionType===ge.WebSocket&&(this.status=je.Offline),this.logToConsole(`Pull: Websocket connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`,!0),this._isManualDisconnect||(e.code==Ie.WRONG_CHANNEL_ID?this.scheduleRestart(Ie.WRONG_CHANNEL_ID,"wrong channel signature"):this.scheduleReconnect()),this._sharedConfig.setLongPollingBlocked(!0),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onWebSocketError(e){this._starting=!1,this._connectionType===ge.WebSocket&&(this.status=je.Offline),this.getLogger().error(`${G.getDateForLog()}: Pull: WebSocket connection error `,e),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}extractMessages(e){if(e instanceof ArrayBuffer)return this.extractProtobufMessages(e);if(x.isStringFilled(e))return this.extractPlainTextMessages(e);throw new Error("Error pullEvent type")}extractProtobufMessages(e){const t=[];try{const n=Yh.decode(new Uint8Array(e));for(let i=0;i<n.responses.length;i++){const s=n.responses[i];if(s.command!=="outgoingMessages")continue;const o=s.outgoingMessages.messages;for(const l of o){let a;try{a=JSON.parse(l.body)}catch(c){this.getLogger().error(`${G.getDateForLog()}: Pull: Could not parse message body `,c);continue}a.extra||(a.extra={}),a.extra.sender={type:l.sender.type},l.sender.id instanceof Uint8Array&&(a.extra.sender.id=this.decodeId(l.sender.id));const u={mid:this.decodeId(l.id),text:a};t.push(u)}}}catch(n){this.getLogger().error(`${G.getDateForLog()}: Pull: Could not parse message `,n)}return t}extractPlainTextMessages(e){const t=[],n=e.match(/#!NGINXNMS!#(.*?)#!NGINXNME!#/gm);if(n===null){const i=`
|
|
30
|
+
`)}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 c=[];if(i.userList&&(c=this.createMessageReceivers(i.userList,t)),i.channelList){if(!L.isArray(i.channelList))throw new TypeError("messageFields.publicChannels must be an array");i.channelList.forEach(u=>{let l,h;if(typeof u=="string"&&u.includes(".")){const f=u.toString().split(".");l=f[0],h=f[1]}else if(typeof u=="object"&&"publicId"in u&&"signature"in u)l=u?.publicId,h=u?.signature;else throw new Error(`Public channel MUST be either a string, formatted like "{publicId}.{signature}" or an object with fields 'publicId' and 'signature'`);c.push(Po.create({id:this.encodeId(l),signature:this.encodeId(h)}))})}const a=Oh.create({receivers:c,body:JSON.stringify(o),expiry:i.expiry||0});n.push(a)});const s=Fo.create({requests:[{incomingMessages:{messages:n}}]});return Fo.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(Po.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(He.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({},Bo)}else{this._config=Object.assign({},Bo);let t;if(this._storage&&(t=this._storage.get(Re.PullConfig,null)),this.isConfigActual(t)&&this.checkRevision(t.api.revision_web))return Promise.resolve(t);this._storage&&this._storage.remove(Re.PullConfig)}return new Promise((t,n)=>{this._restClient.getHttpClient().setLogTag(e),this._restClient.callMethod(this._configGetMethod,{CACHE:"N"}).then(s=>{const i=s.getData().result,o=Math.floor((Date.now()-new Date(i.serverTime).getTime())/1e3);delete i.serverTime;const 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(!L.isPlainObject(e)||Number(e.server.config_timestamp)!==this._configTimestamp)return!1;const t=new Date;if(L.isNumber(e.exp)&&e.exp>0&&e.exp<t.getTime()/1e3||Object.keys(e.channels).length===0)return!1;for(const 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),Rh)}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(_e.CONFIG_EXPIRED,"config expired");return!0}setConfig(e,t){for(const n in e)e.hasOwnProperty(n)&&this._config?.hasOwnProperty(n)&&(this._config[n]=e[n]);if(e.publicChannels&&this.setPublicIds(Object.values(e.publicChannels)),this._configTimestamp=Number(e.server.config_timestamp),this._storage&&t)try{this._storage.set(Re.PullConfig,e)}catch(n){localStorage&&localStorage.removeItem&&localStorage.removeItem("history"),this.getLogger().error(`${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!==ir?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(_e.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[e,ir]),this.emit({type:Fe.Revision,data:{server:e,client:ir}}),this.logToConsole(`Pull revision changed from ${ir} 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 ${xo} seconds`),!this._restoreWebSocketTimeout&&(this._restoreWebSocketTimeout=setTimeout(()=>{this._restoreWebSocketTimeout=0,this.restoreWebSocketConnection()},xo*1e3))}async connect(){return this._enabled?this.connector?.connected?Promise.resolve():(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.status=Le.Connecting,this._connectionAttempt++,new Promise((e,t)=>{this._connectPromise={resolve:e,reject:t},this.connector?.connect()})):Promise.reject()}scheduleRestart(e,t,n=0){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),n<1&&(n=Math.ceil(Math.random()*30)+5),this._restartTimeout=setTimeout(()=>this.restart(e,t),n*1e3)}handleRpcIncomingMessage(e){this._session.mid=e.mid;const t=e.body;return e.body.extra||(t.extra={}),t.extra.sender=e.sender,"user_params"in e&&L.isPlainObject(e.user_params)&&Object.assign(t.params,e.user_params),"dictionary"in e&&L.isPlainObject(e.dictionary)&&Object.assign(t.params,e.dictionary),this.checkDuplicate(e.mid)&&(this.addMessageToStat(t),this.trimDuplicates(),this.broadcastMessage(t)),this.connector?.send(`mack:${e.mid}`),{}}handleIncomingEvents(e){const t=[];if(e.length===0){this._session.mid=null;return}for(const 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(_e.CONFIG_REPLACED,"config was replaced")}else this.restart(_e.CHANNEL_EXPIRED,"channel expired received");break}case Kt.CONFIG_EXPIRE:{this.restart(_e.CONFIG_EXPIRED,"config expired received");break}case Kt.SERVER_RESTART:{this.reconnect(_e.SERVER_RESTARTED,"server was restarted",15);break}}}onIncomingMessage(e){if(this.isJsonRpc())e===Lh?this.onJsonRpcPing():this._jsonRpcAdapter?.parseJsonRpcMessage(e);else{const t=this.extractMessages(e);this.handleIncomingEvents(t)}}onLongPollingOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Le.Online,this.logToConsole("Pull: Long polling connection with push-server opened"),this.isWebSocketEnabled()&&this.scheduleRestoreWebSocketConnection(),this._connectPromise&&this._connectPromise.resolve({})}onLongPollingDisconnect(e){this._connectionType===te.LongPolling&&(this.status=Le.Offline),this.logToConsole(`Pull: Long polling connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`),this._isManualDisconnect||this.scheduleReconnect(),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onLongPollingError(e){this._starting=!1,this._connectionType===te.LongPolling&&(this.status=Le.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=Le.Online,this._sharedConfig.setWebSocketBlocked(!1),this._sharedConfig.setLongPollingBlocked(!0),this._connectionType==te.LongPolling&&(this._connectionType=te.WebSocket,this._connectors.longPolling?.disconnect(_e.CONFIG_REPLACED,"Fire at onWebSocketOpen")),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this.logToConsole("Pull: Websocket connection with push-server opened"),this._connectPromise&&this._connectPromise.resolve({}),this.restoreUserStatusSubscription()}onWebSocketDisconnect(e){this._connectionType===te.WebSocket&&(this.status=Le.Offline),this.logToConsole(`Pull: Websocket connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`,!0),this._isManualDisconnect||(e.code==_e.WRONG_CHANNEL_ID?this.scheduleRestart(_e.WRONG_CHANNEL_ID,"wrong channel signature"):this.scheduleReconnect()),this._sharedConfig.setLongPollingBlocked(!0),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onWebSocketError(e){this._starting=!1,this._connectionType===te.WebSocket&&(this.status=Le.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(L.isStringFilled(e))return this.extractPlainTextMessages(e);throw new Error("Error pullEvent type")}extractProtobufMessages(e){const t=[];try{const n=Th.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(`${W.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(`${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=`
|
|
34
31
|
========= PULL ERROR ===========
|
|
35
32
|
Error type: parseResponse error parsing message
|
|
36
33
|
|
|
37
34
|
Data string: ${e}
|
|
38
35
|
================================
|
|
39
36
|
|
|
40
|
-
`;return this.getLogger().warn(i),[]}for(let i=0;i<n.length;i++){if(n[i]=n[i].substring(12,n[i].length-12),n[i].length<=0)continue;let s;try{s=JSON.parse(n[i])}catch{continue}t.push(s)}return t}decodeId(e){let t="";for(const n of e){const i=n.toString(16);i.length===1&&(t+="0"),t+=i}return t}encodeId(e){if(!e)return new Uint8Array;const t=[];for(let n=0;n<e.length;n+=2)t.push(Number.parseInt(e.slice(n,n+2),16));return new Uint8Array(t)}onOffline(){this.disconnect(Ie.NORMAL_CLOSURE,"offline")}onOnline(){this.connect().catch(e=>{this.getLogger().error(e)})}onBeforeUnload(){this._unloading=!0;const e=x.clone(this.session);if(e.ttl=Date.now()+sd*1e3,this._storage)try{this._storage.set(al,JSON.stringify(e))}catch(t){this.getLogger().error(`${G.getDateForLog()}: Pull: Could not save session info in local storage. Error: `,t)}this.scheduleReconnect(15)}sendPullStatusDelayed(e,t){this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),this._offlineTimeout=setTimeout(()=>{this._offlineTimeout=null,this.sendPullStatus(e)},t)}sendPullStatus(e){this._unloading||(this.onCustomEvent("onPullStatus",[e]),this.emit({type:Ue.Status,data:{status:e}}))}extendWatch(e,t=!1){this._watchTagsQueue.get(e)||(this._watchTagsQueue.set(e,!0),t&&this.updateWatch(t))}updateWatch(e=!1){this._watchUpdateTimeout&&(clearTimeout(this._watchUpdateTimeout),this._watchUpdateTimeout=null),this._watchUpdateTimeout=setTimeout(()=>{const t=[...this._watchTagsQueue.keys()];t.length>0?this._restClient.callMethod("pull.watch.extend",{tags:t}).then(n=>{const i=n.getData().result;for(const s of i)this.clearWatch(s);this.updateWatch()}).catch(()=>{this.updateWatch()}):this.updateWatch()},e?this._watchForceUpdateInterval:this._watchUpdateInterval)}clearWatch(e){this._watchTagsQueue.delete(e)}onJsonRpcPing(){this.updatePingWaitTimeout(),this.connector?.send(id)}updatePingWaitTimeout(){this._pingWaitTimeout&&(clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null),this._pingWaitTimeout=setTimeout(this._onPingTimeoutHandler,ol*2*1e3)}clearPingWaitTimeout(){this._pingWaitTimeout&&clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null}onPingTimeout(){this._pingWaitTimeout=null,!(!this._enabled||!this.isConnected())&&(this.getLogger().warn(`No pings are received in ${ol*2} seconds. Reconnecting`),this.disconnect(Ie.STUCK,"connection stuck"),this.scheduleReconnect())}getConnectionAttemptDelay(e){let t;return e<1?t=.5:e<3?t=15:e<5?t=45:e<10?t=600:t=3600,t+t*Math.random()*.2}checkDuplicate(e){return this._session.lastMessageIds.includes(e)?(this.getLogger().warn(`Duplicate message ${e} skipped`),!1):(this._session.lastMessageIds.push(e),!0)}trimDuplicates(){this._session.lastMessageIds.length>sl&&(this._session.lastMessageIds=this._session.lastMessageIds.slice(-sl))}logMessage(e){this._debug&&(e.extra?.sender&&e.extra.sender.type===Ur.Client?this.getLogger().info(`onPullClientEvent-${e.module_id}`,e.command,e.params,e.extra):e.module_id=="online"?this.getLogger().info("onPullOnlineEvent",e.command,e.params,e.extra):this.getLogger().info("onPullEvent",e.module_id,e.command,e.params,e.extra))}logToConsole(e,t=!1){(this._loggingEnabled||t)&&this.getLogger().log(`${G.getDateForLog()}: ${e}`)}addMessageToStat(e){this._session.history[e.module_id]||(this._session.history[e.module_id]={}),this._session.history[e.module_id][e.command]||(this.session.history[e.module_id][e.command]=0),this._session.history[e.module_id][e.command]++,this._session.messageCount++}showNotification(e){this.getLogger().warn(e)}onCustomEvent(e,t,n=!1){}}class od{_b24;_logger=null;_isInit=!1;_profile=null;_app=null;_payment=null;_license=null;_currency=null;_appOptions=null;_userOptions=null;_b24PullClient=null;_pullClientUnSubscribe=[];_pullClientModuleId="";constructor(e){this._b24=e,this.setLogger(this._b24.getLogger())}setLogger(e){this._logger=e,this._profile!==null&&this._profile.setLogger(this.getLogger()),this._app!==null&&this._app.setLogger(this.getLogger()),this._payment!==null&&this._payment.setLogger(this.getLogger()),this._license!==null&&this._license.setLogger(this.getLogger()),this._currency!==null&&this._currency.setLogger(this.getLogger()),this._appOptions!==null&&this._appOptions.setLogger(this.getLogger()),this._userOptions!==null&&this._userOptions.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}destroy(){this._destroyPullClient()}async loadData(e=[de.App,de.Profile]){const t={[de.App]:{method:"app.info"},[de.Profile]:{method:"profile"},[de.Currency]:[{method:"crm.currency.base.get"},{method:"crm.currency.list"}],[de.AppOptions]:{method:"app.option.get"},[de.UserOptions]:{method:"user.option.get"}},n=e.reduce((i,s)=>{if(t[s])if(Array.isArray(t[s]))for(const[o,l]of t[s].entries())i[`get_${s}_${o}`]=l;else i[`get_${s}`]=t[s];return i},{});try{const i=(await this._b24.callBatch(n)).getData();i[`get_${de.App}`]&&(this._app=await this.parseAppData(i[`get_${de.App}`]),this._payment=await this.parsePaymentData(i[`get_${de.App}`]),this._license=await this.parseLicenseData(i[`get_${de.App}`])),i[`get_${de.Profile}`]&&(this._profile=await this.parseUserData(i[`get_${de.Profile}`])),i[`get_${de.Currency}_0`]&&i[`get_${de.Currency}_1`]&&(this._currency=await this.parseCurrencyData({currencyBase:i[`get_${de.Currency}_0`],currencyList:i[`get_${de.Currency}_1`]})),i[`get_${de.AppOptions}`]&&(this._appOptions=await this.parseOptionsData("app",i[`get_${de.AppOptions}`])),i[`get_${de.UserOptions}`]&&(this._userOptions=await this.parseOptionsData("user",i[`get_${de.UserOptions}`])),this._isInit=!0}catch(i){throw i instanceof Error?i:(console.error("Error loading data:",i),new Error("Failed to load data"))}}async parseUserData(e){const t=new jh(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number(e.ID),isAdmin:e.ADMIN===!0,lastName:e?.LAST_NAME||"",name:e?.NAME||"",gender:e?.PERSONAL_GENDER||"",photo:e?.PERSONAL_PHOTO||"",TimeZone:e?.TIME_ZONE||"",TimeZoneOffset:e?.TIME_ZONE_OFFSET}).then(()=>t)}async parseAppData(e){const t=new Uh(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number.parseInt(e.ID),code:e.CODE,version:Number.parseInt(e.VERSION),status:e.STATUS,isInstalled:e.INSTALLED}).then(()=>t)}async parsePaymentData(e){const t=new Bh(this._b24);return t.setLogger(this.getLogger()),t.initData({isExpired:e.PAYMENT_EXPIRED==="Y",days:Number.parseInt(e.DAYS||"0")}).then(()=>t)}async parseLicenseData(e){const t=new $h(this._b24);return t.setLogger(this.getLogger()),t.initData({languageId:e.LANGUAGE_ID,license:e.LICENSE,licensePrevious:e.LICENSE_PREVIOUS,licenseType:e.LICENSE_TYPE,licenseFamily:e.LICENSE_FAMILY,isSelfHosted:e.LICENSE.includes("selfhosted")}).then(()=>t)}async parseCurrencyData(e){const t=new Wh(this._b24);return t.setLogger(this.getLogger()),t.initData(e).then(()=>t)}async parseOptionsData(e,t){const n=new Ti(this._b24,e);return n.setLogger(this.getLogger()),n.initData(t).then(()=>n)}get isInit(){return this._isInit}get forB24Form(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");if(this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return{app_code:this.appInfo.data.code,app_status:this.appInfo.data.status,payment_expired:this.paymentInfo.data.isExpired?"Y":"N",days:this.paymentInfo.data.days,b24_plan:this.licenseInfo.data.license,c_name:this.profileInfo.data.name,c_last_name:this.profileInfo.data.lastName,hostname:this.hostName}}get hostName(){return this._b24.getTargetOrigin()}get profileInfo(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");return this._profile}get appInfo(){if(this.ensureInitialized(),this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return this._app}get paymentInfo(){if(this.ensureInitialized(),this._payment===null)throw new Error("B24HelperManager.paymentInfo not initialized");return this._payment}get licenseInfo(){if(this.ensureInitialized(),this._license===null)throw new Error("B24HelperManager.licenseInfo not initialized");return this._license}get currency(){if(this.ensureInitialized(),this._currency===null)throw new Error("B24HelperManager.currency not initialized");return this._currency}get appOptions(){if(this.ensureInitialized(),this._appOptions===null)throw new Error("B24HelperManager.appOptions not initialized");return this._appOptions}get userOptions(){if(this.ensureInitialized(),this._userOptions===null)throw new Error("B24HelperManager.userOptions not initialized");return this._userOptions}get isSelfHosted(){return this.licenseInfo.data.isSelfHosted}get primaryKeyIncrementValue(){return this.isSelfHosted?1:2}get b24SpecificUrl(){return this.isSelfHosted?{[Ot.MainSettings]:"/configs/",[Ot.UfList]:"/configs/userfield_list.php",[Ot.UfPage]:"/configs/userfield.php"}:{[Ot.MainSettings]:"/settings/configs/",[Ot.UfList]:"/settings/configs/userfield_list.php",[Ot.UfPage]:"/settings/configs/userfield.php"}}usePullClient(e="prefix",t){return this._b24PullClient?this:(this.initializePullClient(typeof t>"u"?this.profileInfo.data.id||0:t,e),this)}initializePullClient(e,t="prefix"){this._b24PullClient=new cl({b24:this._b24,restApplication:this._b24.auth.getUniq(t),userId:e})}subscribePullClient(e,t="application"){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId=t,this._pullClientUnSubscribe.push(this._b24PullClient.subscribe({moduleId:this._pullClientModuleId,callback:e})),this}startPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");this._b24PullClient.start().catch(e=>{this.getLogger().error(`${G.getDateForLog()}: Pull not running`,e)})}getModuleIdPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId}_destroyPullClient(){for(const e of this._pullClientUnSubscribe)e();this._b24PullClient?.destroy(),this._b24PullClient=null}ensureInitialized(){if(!this._isInit)throw new Error("B24HelperManager not initialized")}}const ad=()=>{let r=!1,e=!1,t=null;return{initB24Helper:async(n,i=[de.App,de.Profile])=>(t===null&&(t=new od(n)),r?t:t.loadData(i).then(()=>(r=!0,t))),isInitB24Helper:()=>r,destroyB24Helper:()=>{t?.destroy(),t=null,r=!1,e=!1},getB24Helper:()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");return t},usePullClient:()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");t.usePullClient(),e=!0},useSubscribePullClient:(n,i="application")=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.subscribePullClient(n,i)},startPullClient:()=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.startPullClient()}}},ld=50;let gt=null,Yr=!1,Yt=null,ul=!1,Kr=[],fl=!1;function hl(){window.setTimeout(()=>{if(!Yr||gt===null){hl();return}cd(),Kr=[]},ld)}function cd(){if(Yt!==null)for(const r of Kr)r.reject(Yt);if(!(!Yr||gt===null))for(const r of Kr)r.resolve(gt)}async function ud(){return Yr&>!==null?Promise.resolve(gt):ul?(fl||(fl=!0,hl()),new Promise((r,e)=>{Kr.push({resolve:r,reject:e})})):(ul=!0,new Promise((r,e)=>{const t={DOMAIN:null,PROTOCOL:!1,APP_SID:null,LANG:null};if(window.name){const[n,i,s]=window.name.split("|");t.DOMAIN=n,t.PROTOCOL=Number.parseInt(i)===1,t.APP_SID=s,t.LANG=null}(!t.DOMAIN||!t.APP_SID)&&(Yt=new Error("Unable to initialize Bitrix24Frame library!"),e(Yt)),gt=new Qa(t),gt.init().then(()=>{Yr=!0,r(gt)}).catch(n=>{Yt=n,e(Yt)})}))}q.AbstractB24=Gt,q.AjaxError=ur,q.AjaxResult=Rn,q.AppFrame=Ha,q.AuthHookManager=qa,q.AuthManager=za,q.B24Frame=Qa,q.B24Hook=xh,q.B24LangList=ki,q.B24PullClientManager=cl,q.Browser=vo,q.CloseReasons=Ie,q.ConnectionType=ge,q.DataType=Wi,q.DialogManager=Za,q.EnumAppStatus=kt,q.EnumCrmEntityType=_o,q.EnumCrmEntityTypeId=Eo,q.ListRpcError=Cn,q.LoadDataType=de,q.LoggerBrowser=Pe,q.LoggerType=M,q.LsKeys=xe,q.MessageCommands=fe,q.MessageManager=Va,q.OptionsManager=Ga,q.ParentManager=Ja,q.PlacementManager=Ka,q.PullStatus=je,q.RestrictionManagerParamsBase=So,q.RestrictionManagerParamsForEnterprise=An,q.Result=Vt,q.RpcMethod=st,q.SenderType=Ur,q.ServerMode=In,q.SliderManager=Ya,q.StatusDescriptions=ko,q.SubscriptionType=Ue,q.SystemCommands=cr,q.Text=G,q.Type=x,q.TypeOption=at,q.TypeSpecificUrl=Ot,q.initializeB24Frame=ud,q.useB24Helper=ad,q.useFormatter=Dh});
|
|
37
|
+
`;return this.getLogger().warn(s),[]}for(let s=0;s<n.length;s++){if(n[s]=n[s].substring(12,n[s].length-12),n[s].length<=0)continue;let i;try{i=JSON.parse(n[s])}catch{continue}t.push(i)}return t}decodeId(e){let t="";for(const n of e){const s=n.toString(16);s.length===1&&(t+="0"),t+=s}return t}encodeId(e){if(!e)return new Uint8Array;const t=[];for(let n=0;n<e.length;n+=2)t.push(Number.parseInt(e.slice(n,n+2),16));return new Uint8Array(t)}onOffline(){this.disconnect(_e.NORMAL_CLOSURE,"offline")}onOnline(){this.connect().catch(e=>{this.getLogger().error(e)})}onBeforeUnload(){this._unloading=!0;const e=L.clone(this.session);if(e.ttl=Date.now()+Ph*1e3,this._storage)try{this._storage.set(Uo,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:Fe.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(Fh)}updatePingWaitTimeout(){this._pingWaitTimeout&&(clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null),this._pingWaitTimeout=setTimeout(this._onPingTimeoutHandler,jo*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 ${jo*2} seconds. Reconnecting`),this.disconnect(_e.STUCK,"connection stuck"),this.scheduleReconnect())}getConnectionAttemptDelay(e){let t;return e<1?t=.5:e<3?t=15:e<5?t=45:e<10?t=600:t=3600,t+t*Math.random()*.2}checkDuplicate(e){return this._session.lastMessageIds.includes(e)?(this.getLogger().warn(`Duplicate message ${e} skipped`),!1):(this._session.lastMessageIds.push(e),!0)}trimDuplicates(){this._session.lastMessageIds.length>Do&&(this._session.lastMessageIds=this._session.lastMessageIds.slice(-Do))}logMessage(e){this._debug&&(e.extra?.sender&&e.extra.sender.type===Tr.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 Mh{_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=Ee.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 fh(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 dh(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 ph(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 mh(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 gh(this._b24);return t.setLogger(this.getLogger()),t.initData(e).then(()=>t)}async parseOptionsData(e,t){const n=new xn(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 $o({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 xh=()=>{let r=!1,e=!1,t=null;return{initB24Helper:async(n,s=[ee.App,ee.Profile])=>(t===null&&(t=new Mh(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()}}},Dh=50;let ot=null,xr=!1,Ut=null,Wo=!1,Dr=[],Vo=!1;function Ho(){window.setTimeout(()=>{if(!xr||ot===null){Ho();return}jh(),Dr=[]},Dh)}function jh(){if(Ut!==null)for(const r of Dr)r.reject(Ut);if(!(!xr||ot===null))for(const r of Dr)r.resolve(ot)}async function Uh(){return xr&&ot!==null?Promise.resolve(ot):Wo?(Vo||(Vo=!0,Ho()),new Promise((r,e)=>{Dr.push({resolve:r,reject:e})})):(Wo=!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)&&(Ut=new Error("Unable to initialize Bitrix24Frame library!"),e(Ut)),ot=new No(t),ot.init().then(()=>{xr=!0,r(ot)}).catch(n=>{Ut=n,e(Ut)})}))}j.AbstractB24=Dt,j.AjaxError=Qt,j.AjaxResult=fn,j.AppFrame=ko,j.AuthHookManager=_o,j.AuthManager=Eo,j.B24Frame=No,j.B24Hook=hh,j.B24LangList=Pn,j.B24PullClientManager=$o,j.Browser=_i,j.CloseReasons=_e,j.ConnectionType=te,j.DataType=Hn,j.DialogManager=Ao,j.EnumAppStatus=pt,j.EnumCrmEntityType=ki,j.EnumCrmEntityTypeId=Ei,j.ListRpcError=hn,j.LoadDataType=ee,j.LoggerBrowser=Ee,j.LoggerType=I,j.LsKeys=Re,j.MessageCommands=X,j.MessageManager=vo,j.OptionsManager=Oo,j.ParentManager=To,j.PlacementManager=Co,j.PullStatus=Le,j.RestrictionManagerParamsBase=vi,j.RestrictionManagerParamsForEnterprise=ln,j.Result=Pt,j.RpcMethod=He,j.SenderType=Tr,j.ServerMode=un,j.SliderManager=Io,j.StatusDescriptions=Ti,j.SubscriptionType=Fe,j.SystemCommands=Kt,j.Text=W,j.Type=L,j.TypeOption=Ye,j.TypeSpecificUrl=mt,j.initializeB24Frame=Uh,j.useB24Helper=xh,j.useFormatter=uh});
|
|
41
38
|
//# sourceMappingURL=index.min.js.map
|