@bitrix24/b24jssdk 1.1.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-AI.md +15 -3
- package/dist/esm/_virtual/_commonjsHelpers.mjs +1 -1
- package/dist/esm/_virtual/protobuf.mjs +1 -1
- package/dist/esm/_virtual/protobuf2.mjs +1 -1
- package/dist/esm/core/abstract-b24.mjs +1 -1
- package/dist/esm/core/actions/abstract-action.mjs +1 -1
- package/dist/esm/core/actions/abstract-batch.mjs +1 -1
- package/dist/esm/core/actions/manager.mjs +1 -1
- package/dist/esm/core/actions/v2/batch-by-chunk.mjs +1 -1
- package/dist/esm/core/actions/v2/batch.mjs +4 -4
- package/dist/esm/core/actions/v2/batch.mjs.map +1 -1
- package/dist/esm/core/actions/v2/call-list.mjs +17 -10
- package/dist/esm/core/actions/v2/call-list.mjs.map +1 -1
- package/dist/esm/core/actions/v2/call.mjs +1 -1
- package/dist/esm/core/actions/v2/fetch-list.mjs +17 -10
- package/dist/esm/core/actions/v2/fetch-list.mjs.map +1 -1
- package/dist/esm/core/actions/v2/manager-v2.mjs +6 -6
- package/dist/esm/core/actions/v2/manager-v2.mjs.map +1 -1
- package/dist/esm/core/actions/v3/batch-by-chunk.mjs +1 -1
- package/dist/esm/core/actions/v3/batch.mjs +4 -4
- package/dist/esm/core/actions/v3/batch.mjs.map +1 -1
- package/dist/esm/core/actions/v3/call-list.mjs +16 -9
- package/dist/esm/core/actions/v3/call-list.mjs.map +1 -1
- package/dist/esm/core/actions/v3/call.mjs +1 -1
- package/dist/esm/core/actions/v3/fetch-list.mjs +16 -9
- package/dist/esm/core/actions/v3/fetch-list.mjs.map +1 -1
- package/dist/esm/core/actions/v3/manager-v3.mjs +6 -6
- package/dist/esm/core/actions/v3/manager-v3.mjs.map +1 -1
- package/dist/esm/core/http/abstract-http.mjs +30 -6
- package/dist/esm/core/http/abstract-http.mjs.map +1 -1
- package/dist/esm/core/http/ajax-error.mjs +1 -1
- package/dist/esm/core/http/ajax-result.mjs +1 -1
- package/dist/esm/core/http/limiters/adaptive-delayer.mjs +1 -1
- package/dist/esm/core/http/limiters/manager.mjs +31 -1
- package/dist/esm/core/http/limiters/manager.mjs.map +1 -1
- package/dist/esm/core/http/limiters/operating-limiter.mjs +1 -1
- package/dist/esm/core/http/limiters/params-factory.mjs +1 -1
- package/dist/esm/core/http/limiters/rate-limiter.mjs +1 -1
- package/dist/esm/core/http/redact.mjs +1 -1
- package/dist/esm/core/http/v2.mjs +2 -2
- package/dist/esm/core/http/v3.mjs +2 -2
- package/dist/esm/core/interaction/batch/abstract-interaction-batch.mjs +1 -1
- package/dist/esm/core/interaction/batch/parse-row.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/as-object.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/as-object.mjs +1 -1
- package/dist/esm/core/interaction/batch/v2.mjs +1 -1
- package/dist/esm/core/interaction/batch/v3.mjs +1 -1
- package/dist/esm/core/language/list.mjs +1 -1
- package/dist/esm/core/request-id-generator.mjs +1 -1
- package/dist/esm/core/result.mjs +28 -1
- package/dist/esm/core/result.mjs.map +1 -1
- package/dist/esm/core/sdk-error.mjs +1 -1
- package/dist/esm/core/tools/abstract-tool.mjs +1 -1
- package/dist/esm/core/tools/healthcheck.mjs +1 -1
- package/dist/esm/core/tools/manager.mjs +3 -3
- package/dist/esm/core/tools/manager.mjs.map +1 -1
- package/dist/esm/core/tools/ping.mjs +1 -1
- package/dist/esm/core/version-manager.mjs +89 -12
- package/dist/esm/core/version-manager.mjs.map +1 -1
- package/dist/esm/frame/auth.mjs +1 -1
- package/dist/esm/frame/b24.mjs +1 -1
- package/dist/esm/frame/dialog.mjs +1 -1
- package/dist/esm/frame/frame.mjs +1 -1
- package/dist/esm/frame/message/commands.mjs +1 -1
- package/dist/esm/frame/message/controller.mjs +1 -1
- package/dist/esm/frame/options.mjs +1 -1
- package/dist/esm/frame/parent.mjs +6 -2
- package/dist/esm/frame/parent.mjs.map +1 -1
- package/dist/esm/frame/placement.mjs +1 -1
- package/dist/esm/frame/slider.mjs +5 -1
- package/dist/esm/frame/slider.mjs.map +1 -1
- package/dist/esm/helper/abstract-helper.mjs +1 -1
- package/dist/esm/helper/app-manager.mjs +1 -1
- package/dist/esm/helper/currency-manager.mjs +1 -1
- package/dist/esm/helper/helper-manager.mjs +1 -1
- package/dist/esm/helper/license-manager.mjs +1 -1
- package/dist/esm/helper/options-manager.mjs +1 -1
- package/dist/esm/helper/payment-manager.mjs +1 -1
- package/dist/esm/helper/profile-manager.mjs +1 -1
- package/dist/esm/helper/use-b24-helper.mjs +1 -1
- package/dist/esm/hook/auth.mjs +1 -1
- package/dist/esm/hook/b24.mjs +1 -1
- package/dist/esm/index.d.mts +101 -22
- package/dist/esm/index.d.ts +101 -22
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/loader-b24frame.mjs +1 -1
- package/dist/esm/logger/abstract-logger.mjs +1 -1
- package/dist/esm/logger/browser.mjs +1 -1
- package/dist/esm/logger/formatter/abstract-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/json-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/line-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/telegram-formatter.mjs +1 -1
- package/dist/esm/logger/handler/abstract-handler.mjs +1 -1
- package/dist/esm/logger/handler/consola-adapter.mjs +1 -1
- package/dist/esm/logger/handler/console-handler.mjs +1 -1
- package/dist/esm/logger/handler/console-v2-handler.mjs +1 -1
- package/dist/esm/logger/handler/memory-handler.mjs +1 -1
- package/dist/esm/logger/handler/stream-handler.mjs +1 -1
- package/dist/esm/logger/handler/telegram-handler.mjs +1 -1
- package/dist/esm/logger/handler/winston-adapter.mjs +1 -1
- package/dist/esm/logger/logger-factory.mjs +1 -1
- package/dist/esm/logger/logger.mjs +1 -1
- package/dist/esm/logger/null-logger.mjs +1 -1
- package/dist/esm/logger/processor/memory-usage-processor.mjs +1 -1
- package/dist/esm/logger/processor/pid-processor.mjs +1 -1
- package/dist/esm/oauth/auth.mjs +1 -1
- package/dist/esm/oauth/b24.mjs +1 -1
- package/dist/esm/oauth/refresh-token-error.mjs +1 -1
- package/dist/esm/pullClient/abstract-connector.mjs +1 -1
- package/dist/esm/pullClient/channel-manager.mjs +1 -1
- package/dist/esm/pullClient/client.mjs +1 -1
- package/dist/esm/pullClient/errors.mjs +1 -1
- package/dist/esm/pullClient/json-rpc.mjs +1 -1
- package/dist/esm/pullClient/long-polling-connector.mjs +1 -1
- package/dist/esm/pullClient/protobuf/index.mjs +1 -1
- package/dist/esm/pullClient/protobuf/model.mjs +1 -1
- package/dist/esm/pullClient/protobuf/protobuf.mjs +53 -53
- package/dist/esm/pullClient/protobuf/protobuf.mjs.map +1 -1
- package/dist/esm/pullClient/shared-config.mjs +1 -1
- package/dist/esm/pullClient/storage-manager.mjs +1 -1
- package/dist/esm/pullClient/web-socket-connector.mjs +1 -1
- package/dist/esm/tools/browser.mjs +1 -1
- package/dist/esm/tools/environment.mjs +1 -1
- package/dist/esm/tools/formatters/iban.mjs +1 -1
- package/dist/esm/tools/formatters/numbers.mjs +1 -1
- package/dist/esm/tools/index.mjs +1 -1
- package/dist/esm/tools/scroll-size.mjs +1 -1
- package/dist/esm/tools/text.mjs +1 -1
- package/dist/esm/tools/type.mjs +1 -1
- package/dist/esm/tools/use-formatters.mjs +1 -1
- package/dist/esm/tools/uuidv7.mjs +1 -1
- package/dist/esm/types/b24-helper.mjs +1 -1
- package/dist/esm/types/b24.mjs +1 -1
- package/dist/esm/types/bizproc/index.mjs +1 -1
- package/dist/esm/types/catalog/index.mjs +1 -1
- package/dist/esm/types/common.mjs +1 -1
- package/dist/esm/types/crm/entity-type.mjs +1 -1
- package/dist/esm/types/crm/productrow.mjs +1 -1
- package/dist/esm/types/logger.mjs +1 -1
- package/dist/esm/types/pull.mjs +1 -1
- package/dist/umd/index.js +1899 -1309
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +28 -28
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +1 -1
package/dist/umd/index.min.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Yy=Object.defineProperty;var a=(A,z)=>Yy(A,"name",{value:z,configurable:!0});/**
|
|
2
2
|
* @package @bitrix24/b24jssdk
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.3.0
|
|
4
4
|
* @copyright (c) 2026 Bitrix24
|
|
5
5
|
* @license MIT
|
|
6
6
|
* @see https://github.com/bitrix24/b24jssdk
|
|
7
7
|
* @see https://bitrix24.github.io/b24jssdk/
|
|
8
|
-
*/(function(R,H){typeof exports=="object"&&typeof module<"u"?H(exports):typeof define=="function"&&define.amd?define(["exports"],H):(R=typeof globalThis<"u"?globalThis:R||self,H(R.B24Js={}))})(this,(function(R){"use strict";var H=(r=>(r[r.DEBUG=0]="DEBUG",r[r.INFO=1]="INFO",r[r.NOTICE=2]="NOTICE",r[r.WARNING=3]="WARNING",r[r.ERROR=4]="ERROR",r[r.CRITICAL=5]="CRITICAL",r[r.ALERT=6]="ALERT",r[r.EMERGENCY=7]="EMERGENCY",r))(H||{});class vt extends Error{static{a(this,"LuxonError")}}class Fc extends vt{static{a(this,"InvalidDateTimeError")}constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class xc extends vt{static{a(this,"InvalidIntervalError")}constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class $c extends vt{static{a(this,"InvalidDurationError")}constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Pt extends vt{static{a(this,"ConflictingSpecificationError")}}class Vn extends vt{static{a(this,"InvalidUnitError")}constructor(e){super(`Invalid unit ${e}`)}}class Ie extends vt{static{a(this,"InvalidArgumentError")}}class pt extends vt{static{a(this,"ZoneIsAbstractError")}constructor(){super("Zone is an abstract class")}}const M="numeric",Ye="short",Be="long",Er={year:M,month:M,day:M},qn={year:M,month:Ye,day:M},jc={year:M,month:Ye,day:M,weekday:Ye},Wn={year:M,month:Be,day:M},Hn={year:M,month:Be,day:M,weekday:Be},zn={hour:M,minute:M},Jn={hour:M,minute:M,second:M},Gn={hour:M,minute:M,second:M,timeZoneName:Ye},Yn={hour:M,minute:M,second:M,timeZoneName:Be},Zn={hour:M,minute:M,hourCycle:"h23"},Kn={hour:M,minute:M,second:M,hourCycle:"h23"},Xn={hour:M,minute:M,second:M,hourCycle:"h23",timeZoneName:Ye},Qn={hour:M,minute:M,second:M,hourCycle:"h23",timeZoneName:Be},ei={year:M,month:M,day:M,hour:M,minute:M},ti={year:M,month:M,day:M,hour:M,minute:M,second:M},ri={year:M,month:Ye,day:M,hour:M,minute:M},si={year:M,month:Ye,day:M,hour:M,minute:M,second:M},Bc={year:M,month:Ye,day:M,weekday:Ye,hour:M,minute:M},ni={year:M,month:Be,day:M,hour:M,minute:M,timeZoneName:Ye},ii={year:M,month:Be,day:M,hour:M,minute:M,second:M,timeZoneName:Ye},oi={year:M,month:Be,day:M,weekday:Be,hour:M,minute:M,timeZoneName:Be},ai={year:M,month:Be,day:M,weekday:Be,hour:M,minute:M,second:M,timeZoneName:Be};class Kt{static{a(this,"Zone")}get type(){throw new pt}get name(){throw new pt}get ianaName(){return this.name}get isUniversal(){throw new pt}offsetName(e,t){throw new pt}formatOffset(e,t){throw new pt}offset(e){throw new pt}equals(e){throw new pt}get isValid(){throw new pt}}let ys=null;class Or extends Kt{static{a(this,"SystemZone")}static get instance(){return ys===null&&(ys=new Or),ys}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return Mi(e,t,s)}formatOffset(e,t){return tr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const bs=new Map;function Uc(r){let e=bs.get(r);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),bs.set(r,e)),e}a(Uc,"makeDTF");const Vc={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function qc(r,e){const t=r.format(e).replace(/\u200E/g,""),s=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,n,i,c,o,u,h,l]=s;return[c,n,i,o,u,h,l]}a(qc,"hackyOffset");function Wc(r,e){const t=r.formatToParts(e),s=[];for(let n=0;n<t.length;n++){const{type:i,value:c}=t[n],o=Vc[i];i==="era"?s[o]=c:J(o)||(s[o]=parseInt(c,10))}return s}a(Wc,"partsOffset");const _s=new Map;class at extends Kt{static{a(this,"IANAZone")}static create(e){let t=_s.get(e);return t===void 0&&_s.set(e,t=new at(e)),t}static resetCache(){_s.clear(),bs.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=at.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return Mi(e,t,s,this.name)}formatOffset(e,t){return tr(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const s=Uc(this.name);let[n,i,c,o,u,h,l]=s.formatToParts?Wc(s,t):qc(s,t);o==="BC"&&(n=-Math.abs(n)+1);const p=Rr({year:n,month:i,day:c,hour:u===24?0:u,minute:h,second:l,millisecond:0});let f=+t;const d=f%1e3;return f-=d>=0?d:1e3+d,(p-f)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let ci={};function Hc(r,e={}){const t=JSON.stringify([r,e]);let s=ci[t];return s||(s=new Intl.ListFormat(r,e),ci[t]=s),s}a(Hc,"getCachedLF");const ws=new Map;function Ss(r,e={}){const t=JSON.stringify([r,e]);let s=ws.get(t);return s===void 0&&(s=new Intl.DateTimeFormat(r,e),ws.set(t,s)),s}a(Ss,"getCachedDTF");const vs=new Map;function zc(r,e={}){const t=JSON.stringify([r,e]);let s=vs.get(t);return s===void 0&&(s=new Intl.NumberFormat(r,e),vs.set(t,s)),s}a(zc,"getCachedINF");const Es=new Map;function Jc(r,e={}){const{base:t,...s}=e,n=JSON.stringify([r,s]);let i=Es.get(n);return i===void 0&&(i=new Intl.RelativeTimeFormat(r,e),Es.set(n,i)),i}a(Jc,"getCachedRTF");let Xt=null;function Gc(){return Xt||(Xt=new Intl.DateTimeFormat().resolvedOptions().locale,Xt)}a(Gc,"systemLocale");const Os=new Map;function li(r){let e=Os.get(r);return e===void 0&&(e=new Intl.DateTimeFormat(r).resolvedOptions(),Os.set(r,e)),e}a(li,"getCachedIntResolvedOptions");const Ts=new Map;function Yc(r){let e=Ts.get(r);if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...ui,...e}),Ts.set(r,e)}return e}a(Yc,"getCachedWeekInfo");function Zc(r){const e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));const t=r.indexOf("-u-");if(t===-1)return[r];{let s,n;try{s=Ss(r).resolvedOptions(),n=r}catch{const u=r.substring(0,t);s=Ss(u).resolvedOptions(),n=u}const{numberingSystem:i,calendar:c}=s;return[n,i,c]}}a(Zc,"parseLocaleString");function Kc(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}a(Kc,"intlConfigString");function Xc(r){const e=[];for(let t=1;t<=12;t++){const s=V.utc(2009,t,1);e.push(r(s))}return e}a(Xc,"mapMonths");function Qc(r){const e=[];for(let t=1;t<=7;t++){const s=V.utc(2016,11,13+t);e.push(r(s))}return e}a(Qc,"mapWeekdays");function Tr(r,e,t,s){const n=r.listingMode();return n==="error"?null:n==="en"?t(e):s(e)}a(Tr,"listStuff");function el(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||li(r.locale).numberingSystem==="latn"}a(el,"supportsFastNumbers");class tl{static{a(this,"PolyNumberFormatter")}constructor(e,t,s){this.padTo=s.padTo||0,this.floor=s.floor||!1;const{padTo:n,floor:i,...c}=s;if(!t||Object.keys(c).length>0){const o={useGrouping:!1,...s};s.padTo>0&&(o.minimumIntegerDigits=s.padTo),this.inf=zc(e,o)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):Ps(e,3);return we(t,this.padTo)}}}class rl{static{a(this,"PolyDateFormatter")}constructor(e,t,s){this.opts=s,this.originalZone=void 0;let n;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const c=-1*(e.offset/60),o=c>=0?`Etc/GMT+${c}`:`Etc/GMT${c}`;e.offset!==0&&at.create(o).valid?(n=o,this.dt=e):(n="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||n,this.dtf=Ss(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const s=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:s}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class sl{static{a(this,"PolyRelFormatter")}constructor(e,t,s){this.opts={style:"long",...s},!t&&Ri()&&(this.rtf=Jc(e,s))}format(e,t){return this.rtf?this.rtf.format(e,t):Tl(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const ui={firstDay:1,minimalDays:4,weekend:[6,7]};class se{static{a(this,"Locale")}static fromOpts(e){return se.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,s,n,i=!1){const c=e||de.defaultLocale,o=c||(i?"en-US":Gc()),u=t||de.defaultNumberingSystem,h=s||de.defaultOutputCalendar,l=Ds(n)||de.defaultWeekSettings;return new se(o,u,h,l,c)}static resetCache(){Xt=null,ws.clear(),vs.clear(),Es.clear(),Os.clear(),Ts.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:s,weekSettings:n}={}){return se.create(e,t,s,n)}constructor(e,t,s,n,i){const[c,o,u]=Zc(e);this.locale=c,this.numberingSystem=t||o||null,this.outputCalendar=s||u||null,this.weekSettings=n,this.intl=Kc(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=el(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:se.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Ds(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 Tr(this,e,Fi,()=>{const s=this.intl==="ja"||this.intl.startsWith("ja-");t&=!s;const n=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const c=s?o=>this.dtFormatter(o,n).format():o=>this.extract(o,n,"month");this.monthsCache[i][e]=Xc(c)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return Tr(this,e,ji,()=>{const s=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=t?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=Qc(i=>this.extract(i,s,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return Tr(this,void 0,()=>Bi,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[V.utc(2016,11,13,9),V.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Tr(this,e,Ui,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[V.utc(-40,1,1),V.utc(2017,1,1)].map(s=>this.extract(s,t,"era"))),this.eraCache[e]})}extract(e,t,s){const n=this.dtFormatter(e,t),i=n.formatToParts(),c=i.find(o=>o.type.toLowerCase()===s);return c?c.value:null}numberFormatter(e={}){return new tl(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new rl(e,this.intl,t)}relFormatter(e={}){return new sl(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Hc(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||li(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ci()?Yc(this.locale):ui}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 ks=null;class Me extends Kt{static{a(this,"FixedOffsetZone")}static get utcInstance(){return ks===null&&(ks=new Me(0)),ks}static instance(e){return e===0?Me.utcInstance:new Me(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Me(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${tr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${tr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return tr(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 nl extends Kt{static{a(this,"InvalidZone")}constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function gt(r,e){if(J(r)||r===null)return e;if(r instanceof Kt)return r;if(ul(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Or.instance:t==="utc"||t==="gmt"?Me.utcInstance:Me.parseSpecifier(t)||at.create(r)}else return mt(r)?Me.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new nl(r)}a(gt,"normalizeZone");const Is={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"},hi={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]},il=Is.hanidec.replace(/[\[|\]]/g,"").split("");function ol(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){const s=r.charCodeAt(t);if(r[t].search(Is.hanidec)!==-1)e+=il.indexOf(r[t]);else for(const n in hi){const[i,c]=hi[n];s>=i&&s<=c&&(e+=s-i)}}return parseInt(e,10)}else return e}a(ol,"parseDigits");const As=new Map;function al(){As.clear()}a(al,"resetDigitRegexCache");function Ze({numberingSystem:r},e=""){const t=r||"latn";let s=As.get(t);s===void 0&&(s=new Map,As.set(t,s));let n=s.get(e);return n===void 0&&(n=new RegExp(`${Is[t]}${e}`),s.set(e,n)),n}a(Ze,"digitRegex");let di=a(()=>Date.now(),"now"),fi="system",pi=null,gi=null,mi=null,yi=60,bi,_i=null;class de{static{a(this,"Settings")}static get now(){return di}static set now(e){di=e}static set defaultZone(e){fi=e}static get defaultZone(){return gt(fi,Or.instance)}static get defaultLocale(){return pi}static set defaultLocale(e){pi=e}static get defaultNumberingSystem(){return gi}static set defaultNumberingSystem(e){gi=e}static get defaultOutputCalendar(){return mi}static set defaultOutputCalendar(e){mi=e}static get defaultWeekSettings(){return _i}static set defaultWeekSettings(e){_i=Ds(e)}static get twoDigitCutoffYear(){return yi}static set twoDigitCutoffYear(e){yi=e%100}static get throwOnInvalid(){return bi}static set throwOnInvalid(e){bi=e}static resetCaches(){se.resetCache(),at.resetCache(),V.resetCache(),al()}}class Ke{static{a(this,"Invalid")}constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const wi=[0,31,59,90,120,151,181,212,243,273,304,334],Si=[0,31,60,91,121,152,182,213,244,274,305,335];function He(r,e){return new Ke("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}a(He,"unitOutOfRange");function Rs(r,e,t){const s=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&s.setUTCFullYear(s.getUTCFullYear()-1900);const n=s.getUTCDay();return n===0?7:n}a(Rs,"dayOfWeek");function vi(r,e,t){return t+(Qt(r)?Si:wi)[e-1]}a(vi,"computeOrdinal");function Ei(r,e){const t=Qt(r)?Si:wi,s=t.findIndex(i=>i<e),n=e-t[s];return{month:s+1,day:n}}a(Ei,"uncomputeOrdinal");function Cs(r,e){return(r-e+7)%7+1}a(Cs,"isoWeekdayToLocal");function kr(r,e=4,t=1){const{year:s,month:n,day:i}=r,c=vi(s,n,i),o=Cs(Rs(s,n,i),t);let u=Math.floor((c-o+14-e)/7),h;return u<1?(h=s-1,u=er(h,e,t)):u>er(s,e,t)?(h=s+1,u=1):h=s,{weekYear:h,weekNumber:u,weekday:o,...Dr(r)}}a(kr,"gregorianToWeek");function Oi(r,e=4,t=1){const{weekYear:s,weekNumber:n,weekday:i}=r,c=Cs(Rs(s,1,e),t),o=Ft(s);let u=n*7+i-c-7+e,h;u<1?(h=s-1,u+=Ft(h)):u>o?(h=s+1,u-=Ft(s)):h=s;const{month:l,day:g}=Ei(h,u);return{year:h,month:l,day:g,...Dr(r)}}a(Oi,"weekToGregorian");function Ns(r){const{year:e,month:t,day:s}=r,n=vi(e,t,s);return{year:e,ordinal:n,...Dr(r)}}a(Ns,"gregorianToOrdinal");function Ti(r){const{year:e,ordinal:t}=r,{month:s,day:n}=Ei(e,t);return{year:e,month:s,day:n,...Dr(r)}}a(Ti,"ordinalToGregorian");function ki(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}}a(ki,"usesLocalWeekValues");function cl(r,e=4,t=1){const s=Ir(r.weekYear),n=ze(r.weekNumber,1,er(r.weekYear,e,t)),i=ze(r.weekday,1,7);return s?n?i?!1:He("weekday",r.weekday):He("week",r.weekNumber):He("weekYear",r.weekYear)}a(cl,"hasInvalidWeekData");function ll(r){const e=Ir(r.year),t=ze(r.ordinal,1,Ft(r.year));return e?t?!1:He("ordinal",r.ordinal):He("year",r.year)}a(ll,"hasInvalidOrdinalData");function Ii(r){const e=Ir(r.year),t=ze(r.month,1,12),s=ze(r.day,1,Ar(r.year,r.month));return e?t?s?!1:He("day",r.day):He("month",r.month):He("year",r.year)}a(Ii,"hasInvalidGregorianData");function Ai(r){const{hour:e,minute:t,second:s,millisecond:n}=r,i=ze(e,0,23)||e===24&&t===0&&s===0&&n===0,c=ze(t,0,59),o=ze(s,0,59),u=ze(n,0,999);return i?c?o?u?!1:He("millisecond",n):He("second",s):He("minute",t):He("hour",e)}a(Ai,"hasInvalidTimeData");function J(r){return typeof r>"u"}a(J,"isUndefined$1");function mt(r){return typeof r=="number"}a(mt,"isNumber$1");function Ir(r){return typeof r=="number"&&r%1===0}a(Ir,"isInteger");function ul(r){return typeof r=="string"}a(ul,"isString$1");function hl(r){return Object.prototype.toString.call(r)==="[object Date]"}a(hl,"isDate$1");function Ri(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}a(Ri,"hasRelative");function Ci(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}a(Ci,"hasLocaleWeekInfo");function dl(r){return Array.isArray(r)?r:[r]}a(dl,"maybeArray");function Ni(r,e,t){if(r.length!==0)return r.reduce((s,n)=>{const i=[e(n),n];return s&&t(s[0],i[0])===s[0]?s:i},null)[1]}a(Ni,"bestBy");function fl(r,e){return e.reduce((t,s)=>(t[s]=r[s],t),{})}a(fl,"pick$1");function Lt(r,e){return Object.prototype.hasOwnProperty.call(r,e)}a(Lt,"hasOwnProperty$1");function Ds(r){if(r==null)return null;if(typeof r!="object")throw new Ie("Week settings must be an object");if(!ze(r.firstDay,1,7)||!ze(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!ze(e,1,7)))throw new Ie("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}a(Ds,"validateWeekSettings");function ze(r,e,t){return Ir(r)&&r>=e&&r<=t}a(ze,"integerBetween");function pl(r,e){return r-e*Math.floor(r/e)}a(pl,"floorMod");function we(r,e=2){const t=r<0;let s;return t?s="-"+(""+-r).padStart(e,"0"):s=(""+r).padStart(e,"0"),s}a(we,"padStart");function yt(r){if(!(J(r)||r===null||r===""))return parseInt(r,10)}a(yt,"parseInteger");function Et(r){if(!(J(r)||r===null||r===""))return parseFloat(r)}a(Et,"parseFloating");function Ms(r){if(!(J(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}a(Ms,"parseMillis");function Ps(r,e,t="round"){const s=10**e;switch(t){case"expand":return r>0?Math.ceil(r*s)/s:Math.floor(r*s)/s;case"trunc":return Math.trunc(r*s)/s;case"round":return Math.round(r*s)/s;case"floor":return Math.floor(r*s)/s;case"ceil":return Math.ceil(r*s)/s;default:throw new RangeError(`Value rounding ${t} is out of range`)}}a(Ps,"roundTo");function Qt(r){return r%4===0&&(r%100!==0||r%400===0)}a(Qt,"isLeapYear");function Ft(r){return Qt(r)?366:365}a(Ft,"daysInYear");function Ar(r,e){const t=pl(e-1,12)+1,s=r+(e-t)/12;return t===2?Qt(s)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}a(Ar,"daysInMonth");function Rr(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}a(Rr,"objToLocalTS");function Di(r,e,t){return-Cs(Rs(r,1,e),t)+e-1}a(Di,"firstWeekOffset");function er(r,e=4,t=1){const s=Di(r,e,t),n=Di(r+1,e,t);return(Ft(r)-s+n)/7}a(er,"weeksInWeekYear");function Ls(r){return r>99?r:r>de.twoDigitCutoffYear?1900+r:2e3+r}a(Ls,"untruncateYear");function Mi(r,e,t,s=null){const n=new Date(r),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};s&&(i.timeZone=s);const c={timeZoneName:e,...i},o=new Intl.DateTimeFormat(t,c).formatToParts(n).find(u=>u.type.toLowerCase()==="timezonename");return o?o.value:null}a(Mi,"parseZoneInfo");function Cr(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const s=parseInt(e,10)||0,n=t<0||Object.is(t,-0)?-s:s;return t*60+n}a(Cr,"signedOffset");function Pi(r){const e=Number(r);if(typeof r=="boolean"||r===""||!Number.isFinite(e))throw new Ie(`Invalid unit value ${r}`);return e}a(Pi,"asNumber");function Nr(r,e){const t={};for(const s in r)if(Lt(r,s)){const n=r[s];if(n==null)continue;t[e(s)]=Pi(n)}return t}a(Nr,"normalizeObject");function tr(r,e){const t=Math.trunc(Math.abs(r/60)),s=Math.trunc(Math.abs(r%60)),n=r>=0?"+":"-";switch(e){case"short":return`${n}${we(t,2)}:${we(s,2)}`;case"narrow":return`${n}${t}${s>0?`:${s}`:""}`;case"techie":return`${n}${we(t,2)}${we(s,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}a(tr,"formatOffset");function Dr(r){return fl(r,["hour","minute","second","millisecond"])}a(Dr,"timeObject");const gl=["January","February","March","April","May","June","July","August","September","October","November","December"],Li=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ml=["J","F","M","A","M","J","J","A","S","O","N","D"];function Fi(r){switch(r){case"narrow":return[...ml];case"short":return[...Li];case"long":return[...gl];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}a(Fi,"months");const xi=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],$i=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],yl=["M","T","W","T","F","S","S"];function ji(r){switch(r){case"narrow":return[...yl];case"short":return[...$i];case"long":return[...xi];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}a(ji,"weekdays");const Bi=["AM","PM"],bl=["Before Christ","Anno Domini"],_l=["BC","AD"],wl=["B","A"];function Ui(r){switch(r){case"narrow":return[...wl];case"short":return[..._l];case"long":return[...bl];default:return null}}a(Ui,"eras");function Sl(r){return Bi[r.hour<12?0:1]}a(Sl,"meridiemForDateTime");function vl(r,e){return ji(e)[r.weekday-1]}a(vl,"weekdayForDateTime");function El(r,e){return Fi(e)[r.month-1]}a(El,"monthForDateTime");function Ol(r,e){return Ui(e)[r.year<0?0:1]}a(Ol,"eraForDateTime");function Tl(r,e,t="always",s=!1){const n={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&i){const g=r==="days";switch(e){case 1:return g?"tomorrow":`next ${n[r][0]}`;case-1:return g?"yesterday":`last ${n[r][0]}`;case 0:return g?"today":`this ${n[r][0]}`}}const c=Object.is(e,-0)||e<0,o=Math.abs(e),u=o===1,h=n[r],l=s?u?h[1]:h[2]||h[1]:u?n[r][0]:r;return c?`${o} ${l} ago`:`in ${o} ${l}`}a(Tl,"formatRelativeTime");function Vi(r,e){let t="";for(const s of r)s.literal?t+=s.val:t+=e(s.val);return t}a(Vi,"stringifyTokens");const kl={D:Er,DD:qn,DDD:Wn,DDDD:Hn,t:zn,tt:Jn,ttt:Gn,tttt:Yn,T:Zn,TT:Kn,TTT:Xn,TTTT:Qn,f:ei,ff:ri,fff:ni,ffff:oi,F:ti,FF:si,FFF:ii,FFFF:ai};class Ae{static{a(this,"Formatter")}static create(e,t={}){return new Ae(e,t)}static parseFormat(e){let t=null,s="",n=!1;const i=[];for(let c=0;c<e.length;c++){const o=e.charAt(c);o==="'"?((s.length>0||n)&&i.push({literal:n||/^\s+$/.test(s),val:s===""?"'":s}),t=null,s="",n=!n):n||o===t?s+=o:(s.length>0&&i.push({literal:/^\s+$/.test(s),val:s}),s=o,t=o)}return s.length>0&&i.push({literal:n||/^\s+$/.test(s),val:s}),i}static macroTokenToFormatOpts(e){return kl[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,s=void 0){if(this.opts.forceSimple)return we(e,t);const n={...this.opts};return t>0&&(n.padTo=t),s&&(n.signDisplay=s),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const s=this.loc.listingMode()==="en",n=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=a((f,d)=>this.loc.extract(e,f,d),"string"),c=a(f=>e.isOffsetFixed&&e.offset===0&&f.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,f.format):"","formatOffset"),o=a(()=>s?Sl(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),"meridiem"),u=a((f,d)=>s?El(e,f):i(d?{month:f}:{month:f,day:"numeric"},"month"),"month"),h=a((f,d)=>s?vl(e,f):i(d?{weekday:f}:{weekday:f,month:"long",day:"numeric"},"weekday"),"weekday"),l=a(f=>{const d=Ae.macroTokenToFormatOpts(f);return d?this.formatWithSystemDefault(e,d):f},"maybeMacro"),g=a(f=>s?Ol(e,f):i({era:f},"era"),"era"),p=a(f=>{switch(f){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return c({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return c({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return c({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return n?i({day:"numeric"},"day"):this.num(e.day);case"dd":return n?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return h("short",!0);case"cccc":return h("long",!0);case"ccccc":return h("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return h("short",!1);case"EEEE":return h("long",!1);case"EEEEE":return h("narrow",!1);case"L":return n?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return n?i({month:"numeric"},"month"):this.num(e.month);case"MM":return n?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return n?i({year:"numeric"},"year"):this.num(e.year);case"yy":return n?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return g("short");case"GG":return g("long");case"GGGGG":return g("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return l(f)}},"tokenToString");return Vi(Ae.parseFormat(t),p)}formatDurationFromString(e,t){const s=this.opts.signMode==="negativeLargestOnly"?-1:1,n=a(l=>{switch(l[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},"tokenToField"),i=a((l,g)=>p=>{const f=n(p);if(f){const d=g.isNegativeDuration&&f!==g.largestUnit?s:1;let m;return this.opts.signMode==="negativeLargestOnly"&&f!==g.largestUnit?m="never":this.opts.signMode==="all"?m="always":m="auto",this.num(l.get(f)*d,p.length,m)}else return p},"tokenToString"),c=Ae.parseFormat(t),o=c.reduce((l,{literal:g,val:p})=>g?l:l.concat(p),[]),u=e.shiftTo(...o.map(n).filter(l=>l)),h={isNegativeDuration:u<0,largestUnit:Object.keys(u.values)[0]};return Vi(c,i(u,h))}}const qi=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function xt(...r){const e=r.reduce((t,s)=>t+s.source,"");return RegExp(`^${e}$`)}a(xt,"combineRegexes");function $t(...r){return e=>r.reduce(([t,s,n],i)=>{const[c,o,u]=i(e,n);return[{...t,...c},o||s,u]},[{},null,1]).slice(0,2)}a($t,"combineExtractors");function jt(r,...e){if(r==null)return[null,null];for(const[t,s]of e){const n=t.exec(r);if(n)return s(n)}return[null,null]}a(jt,"parse");function Wi(...r){return(e,t)=>{const s={};let n;for(n=0;n<r.length;n++)s[r[n]]=yt(e[t+n]);return[s,null,t+n]}}a(Wi,"simpleParse");const Hi=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Il=`(?:${Hi.source}?(?:\\[(${qi.source})\\])?)?`,Fs=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,zi=RegExp(`${Fs.source}${Il}`),xs=RegExp(`(?:[Tt]${zi.source})?`),Al=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Rl=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Cl=/(\d{4})-?(\d{3})/,Nl=Wi("weekYear","weekNumber","weekDay"),Dl=Wi("year","ordinal"),Ml=/(\d{4})-(\d\d)-(\d\d)/,Ji=RegExp(`${Fs.source} ?(?:${Hi.source}|(${qi.source}))?`),Pl=RegExp(`(?: ${Ji.source})?`);function Bt(r,e,t){const s=r[e];return J(s)?t:yt(s)}a(Bt,"int");function Ll(r,e){return[{year:Bt(r,e),month:Bt(r,e+1,1),day:Bt(r,e+2,1)},null,e+3]}a(Ll,"extractISOYmd");function Ut(r,e){return[{hours:Bt(r,e,0),minutes:Bt(r,e+1,0),seconds:Bt(r,e+2,0),milliseconds:Ms(r[e+3])},null,e+4]}a(Ut,"extractISOTime");function rr(r,e){const t=!r[e]&&!r[e+1],s=Cr(r[e+1],r[e+2]),n=t?null:Me.instance(s);return[{},n,e+3]}a(rr,"extractISOOffset");function sr(r,e){const t=r[e]?at.create(r[e]):null;return[{},t,e+1]}a(sr,"extractIANAZone");const Fl=RegExp(`^T?${Fs.source}$`),xl=/^-?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 $l(r){const[e,t,s,n,i,c,o,u,h]=r,l=e[0]==="-",g=u&&u[0]==="-",p=a((f,d=!1)=>f!==void 0&&(d||f&&l)?-f:f,"maybeNegate");return[{years:p(Et(t)),months:p(Et(s)),weeks:p(Et(n)),days:p(Et(i)),hours:p(Et(c)),minutes:p(Et(o)),seconds:p(Et(u),u==="-0"),milliseconds:p(Ms(h),g)}]}a($l,"extractISODuration");const jl={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function $s(r,e,t,s,n,i,c){const o={year:e.length===2?Ls(yt(e)):yt(e),month:Li.indexOf(t)+1,day:yt(s),hour:yt(n),minute:yt(i)};return c&&(o.second=yt(c)),r&&(o.weekday=r.length>3?xi.indexOf(r)+1:$i.indexOf(r)+1),o}a($s,"fromStrings");const Bl=/^(?:(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 Ul(r){const[,e,t,s,n,i,c,o,u,h,l,g]=r,p=$s(e,n,s,t,i,c,o);let f;return u?f=jl[u]:h?f=0:f=Cr(l,g),[p,new Me(f)]}a(Ul,"extractRFC2822");function Vl(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}a(Vl,"preprocessRFC2822");const ql=/^(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$/,Wl=/^(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$/,Hl=/^(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 Gi(r){const[,e,t,s,n,i,c,o]=r;return[$s(e,n,s,t,i,c,o),Me.utcInstance]}a(Gi,"extractRFC1123Or850");function zl(r){const[,e,t,s,n,i,c,o]=r;return[$s(e,o,t,s,n,i,c),Me.utcInstance]}a(zl,"extractASCII");const Jl=xt(Al,xs),Gl=xt(Rl,xs),Yl=xt(Cl,xs),Zl=xt(zi),Yi=$t(Ll,Ut,rr,sr),Kl=$t(Nl,Ut,rr,sr),Xl=$t(Dl,Ut,rr,sr),Ql=$t(Ut,rr,sr);function eu(r){return jt(r,[Jl,Yi],[Gl,Kl],[Yl,Xl],[Zl,Ql])}a(eu,"parseISODate");function tu(r){return jt(Vl(r),[Bl,Ul])}a(tu,"parseRFC2822Date");function ru(r){return jt(r,[ql,Gi],[Wl,Gi],[Hl,zl])}a(ru,"parseHTTPDate");function su(r){return jt(r,[xl,$l])}a(su,"parseISODuration");const nu=$t(Ut);function iu(r){return jt(r,[Fl,nu])}a(iu,"parseISOTimeOnly");const ou=xt(Ml,Pl),au=xt(Ji),cu=$t(Ut,rr,sr);function lu(r){return jt(r,[ou,Yi],[au,cu])}a(lu,"parseSQL");const Zi="Invalid Duration",Ki={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},uu={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...Ki},Je=146097/400,Vt=146097/4800,hu={years:{quarters:4,months:12,weeks:Je/7,days:Je,hours:Je*24,minutes:Je*24*60,seconds:Je*24*60*60,milliseconds:Je*24*60*60*1e3},quarters:{months:3,weeks:Je/28,days:Je/4,hours:Je*24/4,minutes:Je*24*60/4,seconds:Je*24*60*60/4,milliseconds:Je*24*60*60*1e3/4},months:{weeks:Vt/7,days:Vt,hours:Vt*24,minutes:Vt*24*60,seconds:Vt*24*60*60,milliseconds:Vt*24*60*60*1e3},...Ki},Ot=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],du=Ot.slice(0).reverse();function ct(r,e,t=!1){const s={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new Q(s)}a(ct,"clone$1");function Xi(r,e){let t=e.milliseconds??0;for(const s of du.slice(1))e[s]&&(t+=e[s]*r[s].milliseconds);return t}a(Xi,"durationToMillis");function Qi(r,e){const t=Xi(r,e)<0?-1:1;Ot.reduceRight((s,n)=>{if(J(e[n]))return s;if(s){const i=e[s]*t,c=r[n][s],o=Math.floor(i/c);e[n]+=o*t,e[s]-=o*c*t}return n},null),Ot.reduce((s,n)=>{if(J(e[n]))return s;if(s){const i=e[s]%1;e[s]-=i,e[n]+=i*r[s][n]}return n},null)}a(Qi,"normalizeValues");function eo(r){const e={};for(const[t,s]of Object.entries(r))s!==0&&(e[t]=s);return e}a(eo,"removeZeroes");class Q{static{a(this,"Duration")}constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let s=t?hu:uu;e.matrix&&(s=e.matrix),this.values=e.values,this.loc=e.loc||se.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=s,this.isLuxonDuration=!0}static fromMillis(e,t){return Q.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new Ie(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new Q({values:Nr(e,Q.normalizeUnit),loc:se.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(mt(e))return Q.fromMillis(e);if(Q.isDuration(e))return e;if(typeof e=="object")return Q.fromObject(e);throw new Ie(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[s]=su(e);return s?Q.fromObject(s,t):Q.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[s]=iu(e);return s?Q.fromObject(s,t):Q.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Ie("need to specify a reason the Duration is invalid");const s=e instanceof Ke?e:new Ke(e,t);if(de.throwOnInvalid)throw new $c(s);return new Q({invalid:s})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Vn(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const s={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Ae.create(this.loc,s).formatDurationFromString(this,e):Zi}toHuman(e={}){if(!this.isValid)return Zi;const t=e.showZeros!==!1,s=Ot.map(n=>{const i=this.values[n];return J(i)||i===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(s)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Ps(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},V.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Xi(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Q.fromDurationLike(e),s={};for(const n of Ot)(Lt(t.values,n)||Lt(this.values,n))&&(s[n]=t.get(n)+this.get(n));return ct(this,{values:s},!0)}minus(e){if(!this.isValid)return this;const t=Q.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const s of Object.keys(this.values))t[s]=Pi(e(this.values[s],s));return ct(this,{values:t},!0)}get(e){return this[Q.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Nr(e,Q.normalizeUnit)};return ct(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:s,matrix:n}={}){const c={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:n,conversionAccuracy:s};return ct(this,c)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Qi(this.matrix,e),ct(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=eo(this.normalize().shiftToAll().toObject());return ct(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(c=>Q.normalizeUnit(c));const t={},s={},n=this.toObject();let i;for(const c of Ot)if(e.indexOf(c)>=0){i=c;let o=0;for(const h in s)o+=this.matrix[h][c]*s[h],s[h]=0;mt(n[c])&&(o+=n[c]);const u=Math.trunc(o);t[c]=u,s[c]=(o*1e3-u*1e3)/1e3}else mt(n[c])&&(s[c]=n[c]);for(const c in s)s[c]!==0&&(t[i]+=c===i?s[c]:s[c]/this.matrix[i][c]);return Qi(this.matrix,t),ct(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return ct(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=eo(this.values);return ct(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(s,n){return s===void 0||s===0?n===void 0||n===0:s===n}a(t,"eq");for(const s of Ot)if(!t(this.values[s],e.values[s]))return!1;return!0}}const qt="Invalid Interval";function fu(r,e){return!r||!r.isValid?fe.invalid("missing or invalid start"):!e||!e.isValid?fe.invalid("missing or invalid end"):e<r?fe.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}a(fu,"validateStartEnd");class fe{static{a(this,"Interval")}constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Ie("need to specify a reason the Interval is invalid");const s=e instanceof Ke?e:new Ke(e,t);if(de.throwOnInvalid)throw new xc(s);return new fe({invalid:s})}static fromDateTimes(e,t){const s=or(e),n=or(t),i=fu(s,n);return i??new fe({start:s,end:n})}static after(e,t){const s=Q.fromDurationLike(t),n=or(e);return fe.fromDateTimes(n,n.plus(s))}static before(e,t){const s=Q.fromDurationLike(t),n=or(e);return fe.fromDateTimes(n.minus(s),n)}static fromISO(e,t){const[s,n]=(e||"").split("/",2);if(s&&n){let i,c;try{i=V.fromISO(s,t),c=i.isValid}catch{c=!1}let o,u;try{o=V.fromISO(n,t),u=o.isValid}catch{u=!1}if(c&&u)return fe.fromDateTimes(i,o);if(c){const h=Q.fromISO(n,t);if(h.isValid)return fe.after(i,h)}else if(u){const h=Q.fromISO(s,t);if(h.isValid)return fe.before(o,h)}}return fe.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const s=this.start.startOf(e,t);let n;return t?.useLocaleWeeks?n=this.end.reconfigure({locale:s.locale}):n=this.end,n=n.startOf(e,t),Math.floor(n.diff(s,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?fe.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(or).filter(c=>this.contains(c)).sort((c,o)=>c.toMillis()-o.toMillis()),s=[];let{s:n}=this,i=0;for(;n<this.e;){const c=t[i]||this.e,o=+c>+this.e?this.e:c;s.push(fe.fromDateTimes(n,o)),n=o,i+=1}return s}splitBy(e){const t=Q.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s}=this,n=1,i;const c=[];for(;s<this.e;){const o=this.start.plus(t.mapUnits(u=>u*n));i=+o>+this.e?this.e:o,c.push(fe.fromDateTimes(s,i)),s=i,n+=1}return c}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,s=this.e<e.e?this.e:e.e;return t>=s?null:fe.fromDateTimes(t,s)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,s=this.e>e.e?this.e:e.e;return fe.fromDateTimes(t,s)}static merge(e){const[t,s]=e.sort((n,i)=>n.s-i.s).reduce(([n,i],c)=>i?i.overlaps(c)||i.abutsStart(c)?[n,i.union(c)]:[n.concat([i]),c]:[n,c],[[],null]);return s&&t.push(s),t}static xor(e){let t=null,s=0;const n=[],i=e.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),c=Array.prototype.concat(...i),o=c.sort((u,h)=>u.time-h.time);for(const u of o)s+=u.type==="s"?1:-1,s===1?t=u.time:(t&&+t!=+u.time&&n.push(fe.fromDateTimes(t,u.time)),t=null);return fe.merge(n)}difference(...e){return fe.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:qt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Er,t={}){return this.isValid?Ae.create(this.s.loc.clone(t),e).formatInterval(this):qt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:qt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:qt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:qt}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:qt}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Q.invalid(this.invalidReason)}mapEndpoints(e){return fe.fromDateTimes(e(this.s),e(this.e))}}class Mr{static{a(this,"Info")}static hasDST(e=de.defaultZone){const t=V.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return at.isValidZone(e)}static normalizeZone(e){return gt(e,de.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||se.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||se.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||se.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||se.create(t,s,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||se.create(t,s,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null}={}){return(n||se.create(t,s,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null}={}){return(n||se.create(t,s,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return se.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return se.create(t,null,"gregory").eras(e)}static features(){return{relative:Ri(),localeWeek:Ci()}}}function to(r,e){const t=a(n=>n.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),"utcDayStart"),s=t(e)-t(r);return Math.floor(Q.fromMillis(s).as("days"))}a(to,"dayDiff");function pu(r,e,t){const s=[["years",(u,h)=>h.year-u.year],["quarters",(u,h)=>h.quarter-u.quarter+(h.year-u.year)*4],["months",(u,h)=>h.month-u.month+(h.year-u.year)*12],["weeks",(u,h)=>{const l=to(u,h);return(l-l%7)/7}],["days",to]],n={},i=r;let c,o;for(const[u,h]of s)t.indexOf(u)>=0&&(c=u,n[u]=h(r,e),o=i.plus(n),o>e?(n[u]--,r=i.plus(n),r>e&&(o=r,n[u]--,r=i.plus(n))):r=o);return[r,n,o,c]}a(pu,"highOrderDiffs");function gu(r,e,t,s){let[n,i,c,o]=pu(r,e,t);const u=e-n,h=t.filter(g=>["hours","minutes","seconds","milliseconds"].indexOf(g)>=0);h.length===0&&(c<e&&(c=n.plus({[o]:1})),c!==n&&(i[o]=(i[o]||0)+u/(c-n)));const l=Q.fromObject(i,s);return h.length>0?Q.fromMillis(u,s).shiftTo(...h).plus(l):l}a(gu,"diff");const mu="missing Intl.DateTimeFormat.formatToParts support";function re(r,e=t=>t){return{regex:r,deser:a(([t])=>e(ol(t)),"deser")}}a(re,"intUnit");const ro="[ \xA0]",so=new RegExp(ro,"g");function yu(r){return r.replace(/\./g,"\\.?").replace(so,ro)}a(yu,"fixListRegex");function no(r){return r.replace(/\./g,"").replace(so," ").toLowerCase()}a(no,"stripInsensitivities");function Xe(r,e){return r===null?null:{regex:RegExp(r.map(yu).join("|")),deser:a(([t])=>r.findIndex(s=>no(t)===no(s))+e,"deser")}}a(Xe,"oneOf");function io(r,e){return{regex:r,deser:a(([,t,s])=>Cr(t,s),"deser"),groups:e}}a(io,"offset");function Pr(r){return{regex:r,deser:a(([e])=>e,"deser")}}a(Pr,"simple");function bu(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}a(bu,"escapeToken");function _u(r,e){const t=Ze(e),s=Ze(e,"{2}"),n=Ze(e,"{3}"),i=Ze(e,"{4}"),c=Ze(e,"{6}"),o=Ze(e,"{1,2}"),u=Ze(e,"{1,3}"),h=Ze(e,"{1,6}"),l=Ze(e,"{1,9}"),g=Ze(e,"{2,4}"),p=Ze(e,"{4,6}"),f=a(y=>({regex:RegExp(bu(y.val)),deser:a(([b])=>b,"deser"),literal:!0}),"literal"),m=a(y=>{if(r.literal)return f(y);switch(y.val){case"G":return Xe(e.eras("short"),0);case"GG":return Xe(e.eras("long"),0);case"y":return re(h);case"yy":return re(g,Ls);case"yyyy":return re(i);case"yyyyy":return re(p);case"yyyyyy":return re(c);case"M":return re(o);case"MM":return re(s);case"MMM":return Xe(e.months("short",!0),1);case"MMMM":return Xe(e.months("long",!0),1);case"L":return re(o);case"LL":return re(s);case"LLL":return Xe(e.months("short",!1),1);case"LLLL":return Xe(e.months("long",!1),1);case"d":return re(o);case"dd":return re(s);case"o":return re(u);case"ooo":return re(n);case"HH":return re(s);case"H":return re(o);case"hh":return re(s);case"h":return re(o);case"mm":return re(s);case"m":return re(o);case"q":return re(o);case"qq":return re(s);case"s":return re(o);case"ss":return re(s);case"S":return re(u);case"SSS":return re(n);case"u":return Pr(l);case"uu":return Pr(o);case"uuu":return re(t);case"a":return Xe(e.meridiems(),0);case"kkkk":return re(i);case"kk":return re(g,Ls);case"W":return re(o);case"WW":return re(s);case"E":case"c":return re(t);case"EEE":return Xe(e.weekdays("short",!1),1);case"EEEE":return Xe(e.weekdays("long",!1),1);case"ccc":return Xe(e.weekdays("short",!0),1);case"cccc":return Xe(e.weekdays("long",!0),1);case"Z":case"ZZ":return io(new RegExp(`([+-]${o.source})(?::(${s.source}))?`),2);case"ZZZ":return io(new RegExp(`([+-]${o.source})(${s.source})?`),2);case"z":return Pr(/[a-z_+-/]{1,256}?/i);case" ":return Pr(/[^\S\n\r]/);default:return f(y)}},"unitate")(r)||{invalidReason:mu};return m.token=r,m}a(_u,"unitForToken");const wu={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 Su(r,e,t){const{type:s,value:n}=r;if(s==="literal"){const u=/^\s+$/.test(n);return{literal:!u,val:u?" ":n}}const i=e[s];let c=s;s==="hour"&&(e.hour12!=null?c=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?c="hour12":c="hour24":c=t.hour12?"hour12":"hour24");let o=wu[c];if(typeof o=="object"&&(o=o[i]),o)return{literal:!1,val:o}}a(Su,"tokenForPart");function vu(r){return[`^${r.map(t=>t.regex).reduce((t,s)=>`${t}(${s.source})`,"")}$`,r]}a(vu,"buildRegex");function Eu(r,e,t){const s=r.match(e);if(s){const n={};let i=1;for(const c in t)if(Lt(t,c)){const o=t[c],u=o.groups?o.groups+1:1;!o.literal&&o.token&&(n[o.token.val[0]]=o.deser(s.slice(i,i+u))),i+=u}return[s,n]}else return[s,{}]}a(Eu,"match");function Ou(r){const e=a(i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},"toField");let t=null,s;return J(r.z)||(t=at.create(r.z)),J(r.Z)||(t||(t=new Me(r.Z)),s=r.Z),J(r.q)||(r.M=(r.q-1)*3+1),J(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),J(r.u)||(r.S=Ms(r.u)),[Object.keys(r).reduce((i,c)=>{const o=e(c);return o&&(i[o]=r[c]),i},{}),t,s]}a(Ou,"dateTimeFromMatches");let js=null;function Tu(){return js||(js=V.fromMillis(1555555555555)),js}a(Tu,"getDummyDateTime");function ku(r,e){if(r.literal)return r;const t=Ae.macroTokenToFormatOpts(r.val),s=lo(t,e);return s==null||s.includes(void 0)?r:s}a(ku,"maybeExpandMacroToken");function oo(r,e){return Array.prototype.concat(...r.map(t=>ku(t,e)))}a(oo,"expandMacroTokens");class ao{static{a(this,"TokenParser")}constructor(e,t){if(this.locale=e,this.format=t,this.tokens=oo(Ae.parseFormat(t),e),this.units=this.tokens.map(s=>_u(s,e)),this.disqualifyingUnit=this.units.find(s=>s.invalidReason),!this.disqualifyingUnit){const[s,n]=vu(this.units);this.regex=RegExp(s,"i"),this.handlers=n}}explainFromTokens(e){if(this.isValid){const[t,s]=Eu(e,this.regex,this.handlers),[n,i,c]=s?Ou(s):[null,null,void 0];if(Lt(s,"a")&&Lt(s,"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:s,result:n,zone:i,specificOffset:c}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function co(r,e,t){return new ao(r,t).explainFromTokens(e)}a(co,"explainFromTokens");function Iu(r,e,t){const{result:s,zone:n,specificOffset:i,invalidReason:c}=co(r,e,t);return[s,n,i,c]}a(Iu,"parseFromTokens");function lo(r,e){if(!r)return null;const s=Ae.create(e,r).dtFormatter(Tu()),n=s.formatToParts(),i=s.resolvedOptions();return n.map(c=>Su(c,r,i))}a(lo,"formatOptsToTokens");const Bs="Invalid DateTime",uo=864e13;function nr(r){return new Ke("unsupported zone",`the zone "${r.name}" is not supported`)}a(nr,"unsupportedZone");function Us(r){return r.weekData===null&&(r.weekData=kr(r.c)),r.weekData}a(Us,"possiblyCachedWeekData");function Vs(r){return r.localWeekData===null&&(r.localWeekData=kr(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}a(Vs,"possiblyCachedLocalWeekData");function Tt(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new V({...t,...e,old:t})}a(Tt,"clone");function ho(r,e,t){let s=r-e*60*1e3;const n=t.offset(s);if(e===n)return[s,e];s-=(n-e)*60*1e3;const i=t.offset(s);return n===i?[s,n]:[r-Math.min(n,i)*60*1e3,Math.max(n,i)]}a(ho,"fixOffset");function Lr(r,e){r+=e*60*1e3;const t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}a(Lr,"tsToObj");function Fr(r,e,t){return ho(Rr(r),e,t)}a(Fr,"objToTS");function fo(r,e){const t=r.o,s=r.c.year+Math.trunc(e.years),n=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...r.c,year:s,month:n,day:Math.min(r.c.day,Ar(s,n))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},c=Q.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Rr(i);let[u,h]=ho(o,t,r.zone);return c!==0&&(u+=c,h=r.zone.offset(u)),{ts:u,o:h}}a(fo,"adjustTime");function Wt(r,e,t,s,n,i){const{setZone:c,zone:o}=t;if(r&&Object.keys(r).length!==0||e){const u=e||o,h=V.fromObject(r,{...t,zone:u,specificOffset:i});return c?h:h.setZone(o)}else return V.invalid(new Ke("unparsable",`the input "${n}" can't be parsed as ${s}`))}a(Wt,"parseDataToDateTime");function xr(r,e,t=!0){return r.isValid?Ae.create(se.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}a(xr,"toTechFormat");function qs(r,e,t){const s=r.c.year>9999||r.c.year<0;let n="";if(s&&r.c.year>=0&&(n+="+"),n+=we(r.c.year,s?6:4),t==="year")return n;if(e){if(n+="-",n+=we(r.c.month),t==="month")return n;n+="-"}else if(n+=we(r.c.month),t==="month")return n;return n+=we(r.c.day),n}a(qs,"toISODate");function po(r,e,t,s,n,i,c){let o=!t||r.c.millisecond!==0||r.c.second!==0,u="";switch(c){case"day":case"month":case"year":break;default:if(u+=we(r.c.hour),c==="hour")break;if(e){if(u+=":",u+=we(r.c.minute),c==="minute")break;o&&(u+=":",u+=we(r.c.second))}else{if(u+=we(r.c.minute),c==="minute")break;o&&(u+=we(r.c.second))}if(c==="second")break;o&&(!s||r.c.millisecond!==0)&&(u+=".",u+=we(r.c.millisecond,3))}return n&&(r.isOffsetFixed&&r.offset===0&&!i?u+="Z":r.o<0?(u+="-",u+=we(Math.trunc(-r.o/60)),u+=":",u+=we(Math.trunc(-r.o%60))):(u+="+",u+=we(Math.trunc(r.o/60)),u+=":",u+=we(Math.trunc(r.o%60)))),i&&(u+="["+r.zone.ianaName+"]"),u}a(po,"toISOTime");const go={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Au={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ru={ordinal:1,hour:0,minute:0,second:0,millisecond:0},$r=["year","month","day","hour","minute","second","millisecond"],Cu=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Nu=["year","ordinal","hour","minute","second","millisecond"];function jr(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 Vn(r);return e}a(jr,"normalizeUnit");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 jr(r)}}a(mo,"normalizeUnitWithLocalWeeks");function Du(r){if(ir===void 0&&(ir=de.now()),r.type!=="iana")return r.offset(ir);const e=r.name;let t=Ws.get(e);return t===void 0&&(t=r.offset(ir),Ws.set(e,t)),t}a(Du,"guessOffsetForZone");function yo(r,e){const t=gt(e.zone,de.defaultZone);if(!t.isValid)return V.invalid(nr(t));const s=se.fromObject(e);let n,i;if(J(r.year))n=de.now();else{for(const u of $r)J(r[u])&&(r[u]=go[u]);const c=Ii(r)||Ai(r);if(c)return V.invalid(c);const o=Du(t);[n,i]=Fr(r,o,t)}return new V({ts:n,zone:t,loc:s,o:i})}a(yo,"quickDT");function bo(r,e,t){const s=J(t.round)?!0:t.round,n=J(t.rounding)?"trunc":t.rounding,i=a((o,u)=>(o=Ps(o,s||t.calendary?0:2,t.calendary?"round":n),e.loc.clone(t).relFormatter(t).format(o,u)),"format"),c=a(o=>t.calendary?e.hasSame(r,o)?0:e.startOf(o).diff(r.startOf(o),o).get(o):e.diff(r,o).get(o),"differ");if(t.unit)return i(c(t.unit),t.unit);for(const o of t.units){const u=c(o);if(Math.abs(u)>=1)return i(u,o)}return i(r>e?-0:0,t.units[t.units.length-1])}a(bo,"diffRelative");function _o(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}a(_o,"lastOpts");let ir;const Ws=new Map;class V{static{a(this,"DateTime")}constructor(e){const t=e.zone||de.defaultZone;let s=e.invalid||(Number.isNaN(e.ts)?new Ke("invalid input"):null)||(t.isValid?null:nr(t));this.ts=J(e.ts)?de.now():e.ts;let n=null,i=null;if(!s)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[n,i]=[e.old.c,e.old.o];else{const o=mt(e.o)&&!e.old?e.o:t.offset(this.ts);n=Lr(this.ts,o),s=Number.isNaN(n.year)?new Ke("invalid input"):null,n=s?null:n,i=s?null:o}this._zone=t,this.loc=e.loc||se.create(),this.invalid=s,this.weekData=null,this.localWeekData=null,this.c=n,this.o=i,this.isLuxonDateTime=!0}static now(){return new V({})}static local(){const[e,t]=_o(arguments),[s,n,i,c,o,u,h]=t;return yo({year:s,month:n,day:i,hour:c,minute:o,second:u,millisecond:h},e)}static utc(){const[e,t]=_o(arguments),[s,n,i,c,o,u,h]=t;return e.zone=Me.utcInstance,yo({year:s,month:n,day:i,hour:c,minute:o,second:u,millisecond:h},e)}static fromJSDate(e,t={}){const s=hl(e)?e.valueOf():NaN;if(Number.isNaN(s))return V.invalid("invalid input");const n=gt(t.zone,de.defaultZone);return n.isValid?new V({ts:s,zone:n,loc:se.fromObject(t)}):V.invalid(nr(n))}static fromMillis(e,t={}){if(mt(e))return e<-uo||e>uo?V.invalid("Timestamp out of range"):new V({ts:e,zone:gt(t.zone,de.defaultZone),loc:se.fromObject(t)});throw new Ie(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(mt(e))return new V({ts:e*1e3,zone:gt(t.zone,de.defaultZone),loc:se.fromObject(t)});throw new Ie("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const s=gt(t.zone,de.defaultZone);if(!s.isValid)return V.invalid(nr(s));const n=se.fromObject(t),i=Nr(e,mo),{minDaysInFirstWeek:c,startOfWeek:o}=ki(i,n),u=de.now(),h=J(t.specificOffset)?s.offset(u):t.specificOffset,l=!J(i.ordinal),g=!J(i.year),p=!J(i.month)||!J(i.day),f=g||p,d=i.weekYear||i.weekNumber;if((f||l)&&d)throw new Pt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(p&&l)throw new Pt("Can't mix ordinal dates with month/day");const m=d||i.weekday&&!f;let y,b,_=Lr(u,h);m?(y=Cu,b=Au,_=kr(_,c,o)):l?(y=Nu,b=Ru,_=Ns(_)):(y=$r,b=go);let w=!1;for(const D of y){const B=i[D];J(B)?w?i[D]=b[D]:i[D]=_[D]:w=!0}const S=m?cl(i,c,o):l?ll(i):Ii(i),T=S||Ai(i);if(T)return V.invalid(T);const v=m?Oi(i,c,o):l?Ti(i):i,[I,E]=Fr(v,h,s),k=new V({ts:I,zone:s,o:E,loc:n});return i.weekday&&f&&e.weekday!==k.weekday?V.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${k.toISO()}`):k.isValid?k:V.invalid(k.invalid)}static fromISO(e,t={}){const[s,n]=eu(e);return Wt(s,n,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[s,n]=tu(e);return Wt(s,n,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[s,n]=ru(e);return Wt(s,n,t,"HTTP",t)}static fromFormat(e,t,s={}){if(J(e)||J(t))throw new Ie("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:i=null}=s,c=se.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),[o,u,h,l]=Iu(c,e,t);return l?V.invalid(l):Wt(o,u,s,`format ${t}`,e,h)}static fromString(e,t,s={}){return V.fromFormat(e,t,s)}static fromSQL(e,t={}){const[s,n]=lu(e);return Wt(s,n,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Ie("need to specify a reason the DateTime is invalid");const s=e instanceof Ke?e:new Ke(e,t);if(de.throwOnInvalid)throw new Fc(s);return new V({invalid:s})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const s=lo(e,se.fromObject(t));return s?s.map(n=>n?n.val:null).join(""):null}static expandFormat(e,t={}){return oo(Ae.parseFormat(e),se.fromObject(t)).map(n=>n.val).join("")}static resetCache(){ir=void 0,Ws.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Us(this).weekYear:NaN}get weekNumber(){return this.isValid?Us(this).weekNumber:NaN}get weekday(){return this.isValid?Us(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Vs(this).weekday:NaN}get localWeekNumber(){return this.isValid?Vs(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Vs(this).weekYear:NaN}get ordinal(){return this.isValid?Ns(this.c).ordinal:NaN}get monthShort(){return this.isValid?Mr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Mr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Mr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Mr.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,s=Rr(this.c),n=this.zone.offset(s-e),i=this.zone.offset(s+e),c=this.zone.offset(s-n*t),o=this.zone.offset(s-i*t);if(c===o)return[this];const u=s-c*t,h=s-o*t,l=Lr(u,c),g=Lr(h,o);return l.hour===g.hour&&l.minute===g.minute&&l.second===g.second&&l.millisecond===g.millisecond?[Tt(this,{ts:u}),Tt(this,{ts:h})]:[this]}get isInLeapYear(){return Qt(this.year)}get daysInMonth(){return Ar(this.year,this.month)}get daysInYear(){return this.isValid?Ft(this.year):NaN}get weeksInWeekYear(){return this.isValid?er(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?er(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:s,calendar:n}=Ae.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:s,outputCalendar:n}}toUTC(e=0,t={}){return this.setZone(Me.instance(e),t)}toLocal(){return this.setZone(de.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:s=!1}={}){if(e=gt(e,de.defaultZone),e.equals(this.zone))return this;if(e.isValid){let n=this.ts;if(t||s){const i=e.offset(this.ts),c=this.toObject();[n]=Fr(c,i,e)}return Tt(this,{ts:n,zone:e})}else return V.invalid(nr(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:s}={}){const n=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:s});return Tt(this,{loc:n})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Nr(e,mo),{minDaysInFirstWeek:s,startOfWeek:n}=ki(t,this.loc),i=!J(t.weekYear)||!J(t.weekNumber)||!J(t.weekday),c=!J(t.ordinal),o=!J(t.year),u=!J(t.month)||!J(t.day),h=o||u,l=t.weekYear||t.weekNumber;if((h||c)&&l)throw new Pt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&c)throw new Pt("Can't mix ordinal dates with month/day");let g;i?g=Oi({...kr(this.c,s,n),...t},s,n):J(t.ordinal)?(g={...this.toObject(),...t},J(t.day)&&(g.day=Math.min(Ar(g.year,g.month),g.day))):g=Ti({...Ns(this.c),...t});const[p,f]=Fr(g,this.o,this.zone);return Tt(this,{ts:p,o:f})}plus(e){if(!this.isValid)return this;const t=Q.fromDurationLike(e);return Tt(this,fo(this,t))}minus(e){if(!this.isValid)return this;const t=Q.fromDurationLike(e).negate();return Tt(this,fo(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const s={},n=Q.normalizeUnit(e);switch(n){case"years":s.month=1;case"quarters":case"months":s.day=1;case"weeks":case"days":s.hour=0;case"hours":s.minute=0;case"minutes":s.second=0;case"seconds":s.millisecond=0;break}if(n==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:c}=this;c<i&&(s.weekNumber=this.weekNumber-1),s.weekday=i}else s.weekday=1;if(n==="quarters"){const i=Math.ceil(this.month/3);s.month=(i-1)*3+1}return this.set(s)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Ae.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Bs}toLocaleString(e=Er,t={}){return this.isValid?Ae.create(this.loc.clone(t),e).formatDateTime(this):Bs}toLocaleParts(e={}){return this.isValid?Ae.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:s=!1,includeOffset:n=!0,extendedZone:i=!1,precision:c="milliseconds"}={}){if(!this.isValid)return null;c=jr(c);const o=e==="extended";let u=qs(this,o,c);return $r.indexOf(c)>=3&&(u+="T"),u+=po(this,o,t,s,n,i,c),u}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?qs(this,e==="extended",jr(t)):null}toISOWeekDate(){return xr(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:s=!0,includePrefix:n=!1,extendedZone:i=!1,format:c="extended",precision:o="milliseconds"}={}){return this.isValid?(o=jr(o),(n&&$r.indexOf(o)>=3?"T":"")+po(this,c==="extended",t,e,s,i,o)):null}toRFC2822(){return xr(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return xr(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?qs(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:s=!0}={}){let n="HH:mm:ss.SSS";return(t||e)&&(s&&(n+=" "),t?n+="z":e&&(n+="ZZ")),xr(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Bs}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",s={}){if(!this.isValid||!e.isValid)return Q.invalid("created by diffing an invalid DateTime");const n={locale:this.locale,numberingSystem:this.numberingSystem,...s},i=dl(t).map(Q.normalizeUnit),c=e.valueOf()>this.valueOf(),o=c?this:e,u=c?e:this,h=gu(o,u,i,n);return c?h.negate():h}diffNow(e="milliseconds",t={}){return this.diff(V.now(),e,t)}until(e){return this.isValid?fe.fromDateTimes(this,e):this}hasSame(e,t,s){if(!this.isValid)return!1;const n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,s)<=n&&n<=i.endOf(t,s)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||V.fromObject({},{zone:this.zone}),s=e.padding?this<t?-e.padding:e.padding:0;let n=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(n=e.unit,i=void 0),bo(t,this.plus(s),{...e,numeric:"always",units:n,unit:i})}toRelativeCalendar(e={}){return this.isValid?bo(e.base||V.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(V.isDateTime))throw new Ie("min requires all arguments be DateTimes");return Ni(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(V.isDateTime))throw new Ie("max requires all arguments be DateTimes");return Ni(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,s={}){const{locale:n=null,numberingSystem:i=null}=s,c=se.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return co(c,e,t)}static fromStringExplain(e,t,s={}){return V.fromFormatExplain(e,t,s)}static buildFormatParser(e,t={}){const{locale:s=null,numberingSystem:n=null}=t,i=se.fromOpts({locale:s,numberingSystem:n,defaultToEN:!0});return new ao(i,e)}static fromFormatParser(e,t,s={}){if(J(e)||J(t))throw new Ie("fromFormatParser requires an input string and a format parser");const{locale:n=null,numberingSystem:i=null}=s,c=se.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});if(!c.equals(t.locale))throw new Ie(`fromFormatParser called with a locale of ${c}, but the format parser was created for ${t.locale}`);const{result:o,zone:u,specificOffset:h,invalidReason:l}=t.explainFromTokens(e);return l?V.invalid(l):Wt(o,u,s,`format ${t.format}`,e,h)}static get DATE_SHORT(){return Er}static get DATE_MED(){return qn}static get DATE_MED_WITH_WEEKDAY(){return jc}static get DATE_FULL(){return Wn}static get DATE_HUGE(){return Hn}static get TIME_SIMPLE(){return zn}static get TIME_WITH_SECONDS(){return Jn}static get TIME_WITH_SHORT_OFFSET(){return Gn}static get TIME_WITH_LONG_OFFSET(){return Yn}static get TIME_24_SIMPLE(){return Zn}static get TIME_24_WITH_SECONDS(){return Kn}static get TIME_24_WITH_SHORT_OFFSET(){return Xn}static get TIME_24_WITH_LONG_OFFSET(){return Qn}static get DATETIME_SHORT(){return ei}static get DATETIME_SHORT_WITH_SECONDS(){return ti}static get DATETIME_MED(){return ri}static get DATETIME_MED_WITH_SECONDS(){return si}static get DATETIME_MED_WITH_WEEKDAY(){return Bc}static get DATETIME_FULL(){return ni}static get DATETIME_FULL_WITH_SECONDS(){return ii}static get DATETIME_HUGE(){return oi}static get DATETIME_HUGE_WITH_SECONDS(){return ai}}function or(r){if(V.isDateTime(r))return r;if(r&&r.valueOf&&mt(r.valueOf()))return V.fromJSDate(r);if(r&&typeof r=="object")return V.fromObject(r);throw new Ie(`Unknown datetime argument: ${r}, of type ${typeof r}`)}a(or,"friendlyDateTime");var Mu=Object.defineProperty,Pu=a((r,e)=>Mu(r,"name",{value:e,configurable:!0}),"o$s");class Hs{static{a(this,"AbstractFormatter")}static{Pu(this,"AbstractFormatter")}dateFormat;constructor(e="YYYY-MM-DD HH:mm:ss"){this.dateFormat=e}_formatTimestamp(e){const t=V.fromJSDate(e);return Math.floor(t.toSeconds()).toFixed(0)}_formatDate(e){return V.fromJSDate(e).toFormat(this.dateFormat.replace(/YYYY/g,"yyyy").replace(/YY/g,"yy").replace(/DD/g,"dd").replace(/D/g,"d"))}}var Lu=Object.defineProperty,Fu=a((r,e)=>Lu(r,"name",{value:e,configurable:!0}),"m$8");class xu extends Hs{static{a(this,"JsonFormatter")}static{Fu(this,"JsonFormatter")}constructor(e="YYYY-MM-DD HH:mm:ss"){super(e)}format(e){return JSON.stringify({channel:e.channel,levelName:e.levelName,message:e.message,context:e.context,extra:e.extra,timestamp:this._formatTimestamp(e.timestamp),date:this._formatDate(e.timestamp)})}}var $u=Object.defineProperty,ju=a((r,e)=>$u(r,"name",{value:e,configurable:!0}),"s$w");class Br extends Hs{static{a(this,"LineFormatter")}static{ju(this,"LineFormatter")}formatString;constructor(e="[{channel}] {levelName}: {message} {context} {extra} {date}",t="YYYY-MM-DD HH:mm:ss"){super(t),this.formatString=e}format(e){let t=this.formatString;const s={"{channel}":e.channel,"{levelName}":e.levelName,"{message}":e.message,"{context}":JSON.stringify(e.context),"{extra}":JSON.stringify(e.extra),"{timestamp}":this._formatTimestamp(e.timestamp),"{date}":this._formatDate(e.timestamp)};for(const[n,i]of Object.entries(s))t=t.replace(n,i);return t}}var Bu=Object.defineProperty,Uu=a((r,e)=>Bu(r,"name",{value:e,configurable:!0}),"n$f");class wo extends Hs{static{a(this,"TelegramFormatter")}static{Uu(this,"TelegramFormatter")}useHtml;maxMessageLength;constructor(e=!0,t="YYYY-MM-DD HH:mm:ss",s=4096){super(t),this.useHtml=e,this.maxMessageLength=s}format(e){let t=this._formatBaseMessage(e);const s=this._formatAdditionalInfo(e);return s&&(t+=`
|
|
8
|
+
*/(function(A,z){typeof exports=="object"&&typeof module<"u"?z(exports):typeof define=="function"&&define.amd?define(["exports"],z):(A=typeof globalThis<"u"?globalThis:A||self,z(A.B24Js={}))})(this,(function(A){"use strict";var z=(r=>(r[r.DEBUG=0]="DEBUG",r[r.INFO=1]="INFO",r[r.NOTICE=2]="NOTICE",r[r.WARNING=3]="WARNING",r[r.ERROR=4]="ERROR",r[r.CRITICAL=5]="CRITICAL",r[r.ALERT=6]="ALERT",r[r.EMERGENCY=7]="EMERGENCY",r))(z||{});class Et extends Error{static{a(this,"LuxonError")}}class Fc extends Et{static{a(this,"InvalidDateTimeError")}constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class xc extends Et{static{a(this,"InvalidIntervalError")}constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class $c extends Et{static{a(this,"InvalidDurationError")}constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Mt extends Et{static{a(this,"ConflictingSpecificationError")}}class zn extends Et{static{a(this,"InvalidUnitError")}constructor(e){super(`Invalid unit ${e}`)}}class Ce extends Et{static{a(this,"InvalidArgumentError")}}class pt extends Et{static{a(this,"ZoneIsAbstractError")}constructor(){super("Zone is an abstract class")}}const L="numeric",Ye="short",Ue="long",kr={year:L,month:L,day:L},Jn={year:L,month:Ye,day:L},Bc={year:L,month:Ye,day:L,weekday:Ye},Gn={year:L,month:Ue,day:L},Yn={year:L,month:Ue,day:L,weekday:Ue},Kn={hour:L,minute:L},Zn={hour:L,minute:L,second:L},Xn={hour:L,minute:L,second:L,timeZoneName:Ye},Qn={hour:L,minute:L,second:L,timeZoneName:Ue},ei={hour:L,minute:L,hourCycle:"h23"},ti={hour:L,minute:L,second:L,hourCycle:"h23"},ri={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:Ye},si={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:Ue},ni={year:L,month:L,day:L,hour:L,minute:L},ii={year:L,month:L,day:L,hour:L,minute:L,second:L},oi={year:L,month:Ye,day:L,hour:L,minute:L},ai={year:L,month:Ye,day:L,hour:L,minute:L,second:L},jc={year:L,month:Ye,day:L,weekday:Ye,hour:L,minute:L},ci={year:L,month:Ue,day:L,hour:L,minute:L,timeZoneName:Ye},li={year:L,month:Ue,day:L,hour:L,minute:L,second:L,timeZoneName:Ye},ui={year:L,month:Ue,day:L,weekday:Ue,hour:L,minute:L,timeZoneName:Ue},hi={year:L,month:Ue,day:L,weekday:Ue,hour:L,minute:L,second:L,timeZoneName:Ue};class er{static{a(this,"Zone")}get type(){throw new pt}get name(){throw new pt}get ianaName(){return this.name}get isUniversal(){throw new pt}offsetName(e,t){throw new pt}formatOffset(e,t){throw new pt}offset(e){throw new pt}equals(e){throw new pt}get isValid(){throw new pt}}let _s=null;class Ir extends er{static{a(this,"SystemZone")}static get instance(){return _s===null&&(_s=new Ir),_s}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return xi(e,t,s)}formatOffset(e,t){return nr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const ws=new Map;function Uc(r){let e=ws.get(r);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),ws.set(r,e)),e}a(Uc,"makeDTF");const Vc={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function qc(r,e){const t=r.format(e).replace(/\u200E/g,""),s=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,n,i,c,o,l,h,u]=s;return[c,n,i,o,l,h,u]}a(qc,"hackyOffset");function Hc(r,e){const t=r.formatToParts(e),s=[];for(let n=0;n<t.length;n++){const{type:i,value:c}=t[n],o=Vc[i];i==="era"?s[o]=c:G(o)||(s[o]=parseInt(c,10))}return s}a(Hc,"partsOffset");const Ss=new Map;class at extends er{static{a(this,"IANAZone")}static create(e){let t=Ss.get(e);return t===void 0&&Ss.set(e,t=new at(e)),t}static resetCache(){Ss.clear(),ws.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=at.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return xi(e,t,s,this.name)}formatOffset(e,t){return nr(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const s=Uc(this.name);let[n,i,c,o,l,h,u]=s.formatToParts?Hc(s,t):qc(s,t);o==="BC"&&(n=-Math.abs(n)+1);const p=Dr({year:n,month:i,day:c,hour:l===24?0:l,minute:h,second:u,millisecond:0});let d=+t;const f=d%1e3;return d-=f>=0?f:1e3+f,(p-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let di={};function Wc(r,e={}){const t=JSON.stringify([r,e]);let s=di[t];return s||(s=new Intl.ListFormat(r,e),di[t]=s),s}a(Wc,"getCachedLF");const vs=new Map;function Es(r,e={}){const t=JSON.stringify([r,e]);let s=vs.get(t);return s===void 0&&(s=new Intl.DateTimeFormat(r,e),vs.set(t,s)),s}a(Es,"getCachedDTF");const Os=new Map;function zc(r,e={}){const t=JSON.stringify([r,e]);let s=Os.get(t);return s===void 0&&(s=new Intl.NumberFormat(r,e),Os.set(t,s)),s}a(zc,"getCachedINF");const Ts=new Map;function Jc(r,e={}){const{base:t,...s}=e,n=JSON.stringify([r,s]);let i=Ts.get(n);return i===void 0&&(i=new Intl.RelativeTimeFormat(r,e),Ts.set(n,i)),i}a(Jc,"getCachedRTF");let tr=null;function Gc(){return tr||(tr=new Intl.DateTimeFormat().resolvedOptions().locale,tr)}a(Gc,"systemLocale");const ks=new Map;function fi(r){let e=ks.get(r);return e===void 0&&(e=new Intl.DateTimeFormat(r).resolvedOptions(),ks.set(r,e)),e}a(fi,"getCachedIntResolvedOptions");const Is=new Map;function Yc(r){let e=Is.get(r);if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...pi,...e}),Is.set(r,e)}return e}a(Yc,"getCachedWeekInfo");function Kc(r){const e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));const t=r.indexOf("-u-");if(t===-1)return[r];{let s,n;try{s=Es(r).resolvedOptions(),n=r}catch{const l=r.substring(0,t);s=Es(l).resolvedOptions(),n=l}const{numberingSystem:i,calendar:c}=s;return[n,i,c]}}a(Kc,"parseLocaleString");function Zc(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}a(Zc,"intlConfigString");function Xc(r){const e=[];for(let t=1;t<=12;t++){const s=q.utc(2009,t,1);e.push(r(s))}return e}a(Xc,"mapMonths");function Qc(r){const e=[];for(let t=1;t<=7;t++){const s=q.utc(2016,11,13+t);e.push(r(s))}return e}a(Qc,"mapWeekdays");function Ar(r,e,t,s){const n=r.listingMode();return n==="error"?null:n==="en"?t(e):s(e)}a(Ar,"listStuff");function el(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||fi(r.locale).numberingSystem==="latn"}a(el,"supportsFastNumbers");class tl{static{a(this,"PolyNumberFormatter")}constructor(e,t,s){this.padTo=s.padTo||0,this.floor=s.floor||!1;const{padTo:n,floor:i,...c}=s;if(!t||Object.keys(c).length>0){const o={useGrouping:!1,...s};s.padTo>0&&(o.minimumIntegerDigits=s.padTo),this.inf=zc(e,o)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):Fs(e,3);return ve(t,this.padTo)}}}class rl{static{a(this,"PolyDateFormatter")}constructor(e,t,s){this.opts=s,this.originalZone=void 0;let n;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const c=-1*(e.offset/60),o=c>=0?`Etc/GMT+${c}`:`Etc/GMT${c}`;e.offset!==0&&at.create(o).valid?(n=o,this.dt=e):(n="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||n,this.dtf=Es(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const s=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:s}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class sl{static{a(this,"PolyRelFormatter")}constructor(e,t,s){this.opts={style:"long",...s},!t&&Li()&&(this.rtf=Jc(e,s))}format(e,t){return this.rtf?this.rtf.format(e,t):Tl(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const pi={firstDay:1,minimalDays:4,weekend:[6,7]};class oe{static{a(this,"Locale")}static fromOpts(e){return oe.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,s,n,i=!1){const c=e||ge.defaultLocale,o=c||(i?"en-US":Gc()),l=t||ge.defaultNumberingSystem,h=s||ge.defaultOutputCalendar,u=Ps(n)||ge.defaultWeekSettings;return new oe(o,l,h,u,c)}static resetCache(){tr=null,vs.clear(),Os.clear(),Ts.clear(),ks.clear(),Is.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:s,weekSettings:n}={}){return oe.create(e,t,s,n)}constructor(e,t,s,n,i){const[c,o,l]=Kc(e);this.locale=c,this.numberingSystem=t||o||null,this.outputCalendar=s||l||null,this.weekSettings=n,this.intl=Zc(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=el(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:oe.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Ps(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Ar(this,e,ji,()=>{const s=this.intl==="ja"||this.intl.startsWith("ja-");t&=!s;const n=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const c=s?o=>this.dtFormatter(o,n).format():o=>this.extract(o,n,"month");this.monthsCache[i][e]=Xc(c)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return Ar(this,e,qi,()=>{const s=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=t?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=Qc(i=>this.extract(i,s,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return Ar(this,void 0,()=>Hi,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[q.utc(2016,11,13,9),q.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Ar(this,e,Wi,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[q.utc(-40,1,1),q.utc(2017,1,1)].map(s=>this.extract(s,t,"era"))),this.eraCache[e]})}extract(e,t,s){const n=this.dtFormatter(e,t),i=n.formatToParts(),c=i.find(o=>o.type.toLowerCase()===s);return c?c.value:null}numberFormatter(e={}){return new tl(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new rl(e,this.intl,t)}relFormatter(e={}){return new sl(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Wc(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||fi(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Pi()?Yc(this.locale):pi}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 As=null;class Me extends er{static{a(this,"FixedOffsetZone")}static get utcInstance(){return As===null&&(As=new Me(0)),As}static instance(e){return e===0?Me.utcInstance:new Me(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Me(Lr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${nr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${nr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return nr(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 nl extends er{static{a(this,"InvalidZone")}constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function mt(r,e){if(G(r)||r===null)return e;if(r instanceof er)return r;if(ul(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Ir.instance:t==="utc"||t==="gmt"?Me.utcInstance:Me.parseSpecifier(t)||at.create(r)}else return gt(r)?Me.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new nl(r)}a(mt,"normalizeZone");const Rs={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"},mi={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]},il=Rs.hanidec.replace(/[\[|\]]/g,"").split("");function ol(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){const s=r.charCodeAt(t);if(r[t].search(Rs.hanidec)!==-1)e+=il.indexOf(r[t]);else for(const n in mi){const[i,c]=mi[n];s>=i&&s<=c&&(e+=s-i)}}return parseInt(e,10)}else return e}a(ol,"parseDigits");const Cs=new Map;function al(){Cs.clear()}a(al,"resetDigitRegexCache");function Ke({numberingSystem:r},e=""){const t=r||"latn";let s=Cs.get(t);s===void 0&&(s=new Map,Cs.set(t,s));let n=s.get(e);return n===void 0&&(n=new RegExp(`${Rs[t]}${e}`),s.set(e,n)),n}a(Ke,"digitRegex");let gi=a(()=>Date.now(),"now"),yi="system",bi=null,_i=null,wi=null,Si=60,vi,Ei=null;class ge{static{a(this,"Settings")}static get now(){return gi}static set now(e){gi=e}static set defaultZone(e){yi=e}static get defaultZone(){return mt(yi,Ir.instance)}static get defaultLocale(){return bi}static set defaultLocale(e){bi=e}static get defaultNumberingSystem(){return _i}static set defaultNumberingSystem(e){_i=e}static get defaultOutputCalendar(){return wi}static set defaultOutputCalendar(e){wi=e}static get defaultWeekSettings(){return Ei}static set defaultWeekSettings(e){Ei=Ps(e)}static get twoDigitCutoffYear(){return Si}static set twoDigitCutoffYear(e){Si=e%100}static get throwOnInvalid(){return vi}static set throwOnInvalid(e){vi=e}static resetCaches(){oe.resetCache(),at.resetCache(),q.resetCache(),al()}}class Ze{static{a(this,"Invalid")}constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Oi=[0,31,59,90,120,151,181,212,243,273,304,334],Ti=[0,31,60,91,121,152,182,213,244,274,305,335];function We(r,e){return new Ze("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}a(We,"unitOutOfRange");function Ns(r,e,t){const s=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&s.setUTCFullYear(s.getUTCFullYear()-1900);const n=s.getUTCDay();return n===0?7:n}a(Ns,"dayOfWeek");function ki(r,e,t){return t+(rr(r)?Ti:Oi)[e-1]}a(ki,"computeOrdinal");function Ii(r,e){const t=rr(r)?Ti:Oi,s=t.findIndex(i=>i<e),n=e-t[s];return{month:s+1,day:n}}a(Ii,"uncomputeOrdinal");function Ds(r,e){return(r-e+7)%7+1}a(Ds,"isoWeekdayToLocal");function Rr(r,e=4,t=1){const{year:s,month:n,day:i}=r,c=ki(s,n,i),o=Ds(Ns(s,n,i),t);let l=Math.floor((c-o+14-e)/7),h;return l<1?(h=s-1,l=sr(h,e,t)):l>sr(s,e,t)?(h=s+1,l=1):h=s,{weekYear:h,weekNumber:l,weekday:o,...Mr(r)}}a(Rr,"gregorianToWeek");function Ai(r,e=4,t=1){const{weekYear:s,weekNumber:n,weekday:i}=r,c=Ds(Ns(s,1,e),t),o=xt(s);let l=n*7+i-c-7+e,h;l<1?(h=s-1,l+=xt(h)):l>o?(h=s+1,l-=xt(s)):h=s;const{month:u,day:g}=Ii(h,l);return{year:h,month:u,day:g,...Mr(r)}}a(Ai,"weekToGregorian");function Ls(r){const{year:e,month:t,day:s}=r,n=ki(e,t,s);return{year:e,ordinal:n,...Mr(r)}}a(Ls,"gregorianToOrdinal");function Ri(r){const{year:e,ordinal:t}=r,{month:s,day:n}=Ii(e,t);return{year:e,month:s,day:n,...Mr(r)}}a(Ri,"ordinalToGregorian");function Ci(r,e){if(!G(r.localWeekday)||!G(r.localWeekNumber)||!G(r.localWeekYear)){if(!G(r.weekday)||!G(r.weekNumber)||!G(r.weekYear))throw new Mt("Cannot mix locale-based week fields with ISO-based week fields");return G(r.localWeekday)||(r.weekday=r.localWeekday),G(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),G(r.localWeekYear)||(r.weekYear=r.localWeekYear),delete r.localWeekday,delete r.localWeekNumber,delete r.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}a(Ci,"usesLocalWeekValues");function cl(r,e=4,t=1){const s=Cr(r.weekYear),n=ze(r.weekNumber,1,sr(r.weekYear,e,t)),i=ze(r.weekday,1,7);return s?n?i?!1:We("weekday",r.weekday):We("week",r.weekNumber):We("weekYear",r.weekYear)}a(cl,"hasInvalidWeekData");function ll(r){const e=Cr(r.year),t=ze(r.ordinal,1,xt(r.year));return e?t?!1:We("ordinal",r.ordinal):We("year",r.year)}a(ll,"hasInvalidOrdinalData");function Ni(r){const e=Cr(r.year),t=ze(r.month,1,12),s=ze(r.day,1,Nr(r.year,r.month));return e?t?s?!1:We("day",r.day):We("month",r.month):We("year",r.year)}a(Ni,"hasInvalidGregorianData");function Di(r){const{hour:e,minute:t,second:s,millisecond:n}=r,i=ze(e,0,23)||e===24&&t===0&&s===0&&n===0,c=ze(t,0,59),o=ze(s,0,59),l=ze(n,0,999);return i?c?o?l?!1:We("millisecond",n):We("second",s):We("minute",t):We("hour",e)}a(Di,"hasInvalidTimeData");function G(r){return typeof r>"u"}a(G,"isUndefined$1");function gt(r){return typeof r=="number"}a(gt,"isNumber$1");function Cr(r){return typeof r=="number"&&r%1===0}a(Cr,"isInteger");function ul(r){return typeof r=="string"}a(ul,"isString$1");function hl(r){return Object.prototype.toString.call(r)==="[object Date]"}a(hl,"isDate$1");function Li(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}a(Li,"hasRelative");function Pi(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}a(Pi,"hasLocaleWeekInfo");function dl(r){return Array.isArray(r)?r:[r]}a(dl,"maybeArray");function Mi(r,e,t){if(r.length!==0)return r.reduce((s,n)=>{const i=[e(n),n];return s&&t(s[0],i[0])===s[0]?s:i},null)[1]}a(Mi,"bestBy");function fl(r,e){return e.reduce((t,s)=>(t[s]=r[s],t),{})}a(fl,"pick$1");function Ft(r,e){return Object.prototype.hasOwnProperty.call(r,e)}a(Ft,"hasOwnProperty$1");function Ps(r){if(r==null)return null;if(typeof r!="object")throw new Ce("Week settings must be an object");if(!ze(r.firstDay,1,7)||!ze(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!ze(e,1,7)))throw new Ce("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}a(Ps,"validateWeekSettings");function ze(r,e,t){return Cr(r)&&r>=e&&r<=t}a(ze,"integerBetween");function pl(r,e){return r-e*Math.floor(r/e)}a(pl,"floorMod");function ve(r,e=2){const t=r<0;let s;return t?s="-"+(""+-r).padStart(e,"0"):s=(""+r).padStart(e,"0"),s}a(ve,"padStart");function yt(r){if(!(G(r)||r===null||r===""))return parseInt(r,10)}a(yt,"parseInteger");function Ot(r){if(!(G(r)||r===null||r===""))return parseFloat(r)}a(Ot,"parseFloating");function Ms(r){if(!(G(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}a(Ms,"parseMillis");function Fs(r,e,t="round"){const s=10**e;switch(t){case"expand":return r>0?Math.ceil(r*s)/s:Math.floor(r*s)/s;case"trunc":return Math.trunc(r*s)/s;case"round":return Math.round(r*s)/s;case"floor":return Math.floor(r*s)/s;case"ceil":return Math.ceil(r*s)/s;default:throw new RangeError(`Value rounding ${t} is out of range`)}}a(Fs,"roundTo");function rr(r){return r%4===0&&(r%100!==0||r%400===0)}a(rr,"isLeapYear");function xt(r){return rr(r)?366:365}a(xt,"daysInYear");function Nr(r,e){const t=pl(e-1,12)+1,s=r+(e-t)/12;return t===2?rr(s)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}a(Nr,"daysInMonth");function Dr(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}a(Dr,"objToLocalTS");function Fi(r,e,t){return-Ds(Ns(r,1,e),t)+e-1}a(Fi,"firstWeekOffset");function sr(r,e=4,t=1){const s=Fi(r,e,t),n=Fi(r+1,e,t);return(xt(r)-s+n)/7}a(sr,"weeksInWeekYear");function xs(r){return r>99?r:r>ge.twoDigitCutoffYear?1900+r:2e3+r}a(xs,"untruncateYear");function xi(r,e,t,s=null){const n=new Date(r),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};s&&(i.timeZone=s);const c={timeZoneName:e,...i},o=new Intl.DateTimeFormat(t,c).formatToParts(n).find(l=>l.type.toLowerCase()==="timezonename");return o?o.value:null}a(xi,"parseZoneInfo");function Lr(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const s=parseInt(e,10)||0,n=t<0||Object.is(t,-0)?-s:s;return t*60+n}a(Lr,"signedOffset");function $i(r){const e=Number(r);if(typeof r=="boolean"||r===""||!Number.isFinite(e))throw new Ce(`Invalid unit value ${r}`);return e}a($i,"asNumber");function Pr(r,e){const t={};for(const s in r)if(Ft(r,s)){const n=r[s];if(n==null)continue;t[e(s)]=$i(n)}return t}a(Pr,"normalizeObject");function nr(r,e){const t=Math.trunc(Math.abs(r/60)),s=Math.trunc(Math.abs(r%60)),n=r>=0?"+":"-";switch(e){case"short":return`${n}${ve(t,2)}:${ve(s,2)}`;case"narrow":return`${n}${t}${s>0?`:${s}`:""}`;case"techie":return`${n}${ve(t,2)}${ve(s,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}a(nr,"formatOffset");function Mr(r){return fl(r,["hour","minute","second","millisecond"])}a(Mr,"timeObject");const ml=["January","February","March","April","May","June","July","August","September","October","November","December"],Bi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],gl=["J","F","M","A","M","J","J","A","S","O","N","D"];function ji(r){switch(r){case"narrow":return[...gl];case"short":return[...Bi];case"long":return[...ml];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}a(ji,"months");const Ui=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Vi=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],yl=["M","T","W","T","F","S","S"];function qi(r){switch(r){case"narrow":return[...yl];case"short":return[...Vi];case"long":return[...Ui];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}a(qi,"weekdays");const Hi=["AM","PM"],bl=["Before Christ","Anno Domini"],_l=["BC","AD"],wl=["B","A"];function Wi(r){switch(r){case"narrow":return[...wl];case"short":return[..._l];case"long":return[...bl];default:return null}}a(Wi,"eras");function Sl(r){return Hi[r.hour<12?0:1]}a(Sl,"meridiemForDateTime");function vl(r,e){return qi(e)[r.weekday-1]}a(vl,"weekdayForDateTime");function El(r,e){return ji(e)[r.month-1]}a(El,"monthForDateTime");function Ol(r,e){return Wi(e)[r.year<0?0:1]}a(Ol,"eraForDateTime");function Tl(r,e,t="always",s=!1){const n={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&i){const g=r==="days";switch(e){case 1:return g?"tomorrow":`next ${n[r][0]}`;case-1:return g?"yesterday":`last ${n[r][0]}`;case 0:return g?"today":`this ${n[r][0]}`}}const c=Object.is(e,-0)||e<0,o=Math.abs(e),l=o===1,h=n[r],u=s?l?h[1]:h[2]||h[1]:l?n[r][0]:r;return c?`${o} ${u} ago`:`in ${o} ${u}`}a(Tl,"formatRelativeTime");function zi(r,e){let t="";for(const s of r)s.literal?t+=s.val:t+=e(s.val);return t}a(zi,"stringifyTokens");const kl={D:kr,DD:Jn,DDD:Gn,DDDD:Yn,t:Kn,tt:Zn,ttt:Xn,tttt:Qn,T:ei,TT:ti,TTT:ri,TTTT:si,f:ni,ff:oi,fff:ci,ffff:ui,F:ii,FF:ai,FFF:li,FFFF:hi};class Ne{static{a(this,"Formatter")}static create(e,t={}){return new Ne(e,t)}static parseFormat(e){let t=null,s="",n=!1;const i=[];for(let c=0;c<e.length;c++){const o=e.charAt(c);o==="'"?((s.length>0||n)&&i.push({literal:n||/^\s+$/.test(s),val:s===""?"'":s}),t=null,s="",n=!n):n||o===t?s+=o:(s.length>0&&i.push({literal:/^\s+$/.test(s),val:s}),s=o,t=o)}return s.length>0&&i.push({literal:n||/^\s+$/.test(s),val:s}),i}static macroTokenToFormatOpts(e){return kl[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,s=void 0){if(this.opts.forceSimple)return ve(e,t);const n={...this.opts};return t>0&&(n.padTo=t),s&&(n.signDisplay=s),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const s=this.loc.listingMode()==="en",n=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=a((d,f)=>this.loc.extract(e,d,f),"string"),c=a(d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"","formatOffset"),o=a(()=>s?Sl(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),"meridiem"),l=a((d,f)=>s?El(e,d):i(f?{month:d}:{month:d,day:"numeric"},"month"),"month"),h=a((d,f)=>s?vl(e,d):i(f?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),"weekday"),u=a(d=>{const f=Ne.macroTokenToFormatOpts(d);return f?this.formatWithSystemDefault(e,f):d},"maybeMacro"),g=a(d=>s?Ol(e,d):i({era:d},"era"),"era"),p=a(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 c({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return c({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return c({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return n?i({day:"numeric"},"day"):this.num(e.day);case"dd":return n?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return h("short",!0);case"cccc":return h("long",!0);case"ccccc":return h("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return h("short",!1);case"EEEE":return h("long",!1);case"EEEEE":return h("narrow",!1);case"L":return n?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return n?i({month:"numeric"},"month"):this.num(e.month);case"MM":return n?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return n?i({year:"numeric"},"year"):this.num(e.year);case"yy":return n?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return g("short");case"GG":return g("long");case"GGGGG":return g("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(d)}},"tokenToString");return zi(Ne.parseFormat(t),p)}formatDurationFromString(e,t){const s=this.opts.signMode==="negativeLargestOnly"?-1:1,n=a(u=>{switch(u[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},"tokenToField"),i=a((u,g)=>p=>{const d=n(p);if(d){const f=g.isNegativeDuration&&d!==g.largestUnit?s:1;let m;return this.opts.signMode==="negativeLargestOnly"&&d!==g.largestUnit?m="never":this.opts.signMode==="all"?m="always":m="auto",this.num(u.get(d)*f,p.length,m)}else return p},"tokenToString"),c=Ne.parseFormat(t),o=c.reduce((u,{literal:g,val:p})=>g?u:u.concat(p),[]),l=e.shiftTo(...o.map(n).filter(u=>u)),h={isNegativeDuration:l<0,largestUnit:Object.keys(l.values)[0]};return zi(c,i(l,h))}}const Ji=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function $t(...r){const e=r.reduce((t,s)=>t+s.source,"");return RegExp(`^${e}$`)}a($t,"combineRegexes");function Bt(...r){return e=>r.reduce(([t,s,n],i)=>{const[c,o,l]=i(e,n);return[{...t,...c},o||s,l]},[{},null,1]).slice(0,2)}a(Bt,"combineExtractors");function jt(r,...e){if(r==null)return[null,null];for(const[t,s]of e){const n=t.exec(r);if(n)return s(n)}return[null,null]}a(jt,"parse");function Gi(...r){return(e,t)=>{const s={};let n;for(n=0;n<r.length;n++)s[r[n]]=yt(e[t+n]);return[s,null,t+n]}}a(Gi,"simpleParse");const Yi=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Il=`(?:${Yi.source}?(?:\\[(${Ji.source})\\])?)?`,$s=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Ki=RegExp(`${$s.source}${Il}`),Bs=RegExp(`(?:[Tt]${Ki.source})?`),Al=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Rl=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Cl=/(\d{4})-?(\d{3})/,Nl=Gi("weekYear","weekNumber","weekDay"),Dl=Gi("year","ordinal"),Ll=/(\d{4})-(\d\d)-(\d\d)/,Zi=RegExp(`${$s.source} ?(?:${Yi.source}|(${Ji.source}))?`),Pl=RegExp(`(?: ${Zi.source})?`);function Ut(r,e,t){const s=r[e];return G(s)?t:yt(s)}a(Ut,"int");function Ml(r,e){return[{year:Ut(r,e),month:Ut(r,e+1,1),day:Ut(r,e+2,1)},null,e+3]}a(Ml,"extractISOYmd");function Vt(r,e){return[{hours:Ut(r,e,0),minutes:Ut(r,e+1,0),seconds:Ut(r,e+2,0),milliseconds:Ms(r[e+3])},null,e+4]}a(Vt,"extractISOTime");function ir(r,e){const t=!r[e]&&!r[e+1],s=Lr(r[e+1],r[e+2]),n=t?null:Me.instance(s);return[{},n,e+3]}a(ir,"extractISOOffset");function or(r,e){const t=r[e]?at.create(r[e]):null;return[{},t,e+1]}a(or,"extractIANAZone");const Fl=RegExp(`^T?${$s.source}$`),xl=/^-?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 $l(r){const[e,t,s,n,i,c,o,l,h]=r,u=e[0]==="-",g=l&&l[0]==="-",p=a((d,f=!1)=>d!==void 0&&(f||d&&u)?-d:d,"maybeNegate");return[{years:p(Ot(t)),months:p(Ot(s)),weeks:p(Ot(n)),days:p(Ot(i)),hours:p(Ot(c)),minutes:p(Ot(o)),seconds:p(Ot(l),l==="-0"),milliseconds:p(Ms(h),g)}]}a($l,"extractISODuration");const Bl={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function js(r,e,t,s,n,i,c){const o={year:e.length===2?xs(yt(e)):yt(e),month:Bi.indexOf(t)+1,day:yt(s),hour:yt(n),minute:yt(i)};return c&&(o.second=yt(c)),r&&(o.weekday=r.length>3?Ui.indexOf(r)+1:Vi.indexOf(r)+1),o}a(js,"fromStrings");const jl=/^(?:(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 Ul(r){const[,e,t,s,n,i,c,o,l,h,u,g]=r,p=js(e,n,s,t,i,c,o);let d;return l?d=Bl[l]:h?d=0:d=Lr(u,g),[p,new Me(d)]}a(Ul,"extractRFC2822");function Vl(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}a(Vl,"preprocessRFC2822");const ql=/^(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$/,Hl=/^(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$/,Wl=/^(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 Xi(r){const[,e,t,s,n,i,c,o]=r;return[js(e,n,s,t,i,c,o),Me.utcInstance]}a(Xi,"extractRFC1123Or850");function zl(r){const[,e,t,s,n,i,c,o]=r;return[js(e,o,t,s,n,i,c),Me.utcInstance]}a(zl,"extractASCII");const Jl=$t(Al,Bs),Gl=$t(Rl,Bs),Yl=$t(Cl,Bs),Kl=$t(Ki),Qi=Bt(Ml,Vt,ir,or),Zl=Bt(Nl,Vt,ir,or),Xl=Bt(Dl,Vt,ir,or),Ql=Bt(Vt,ir,or);function eu(r){return jt(r,[Jl,Qi],[Gl,Zl],[Yl,Xl],[Kl,Ql])}a(eu,"parseISODate");function tu(r){return jt(Vl(r),[jl,Ul])}a(tu,"parseRFC2822Date");function ru(r){return jt(r,[ql,Xi],[Hl,Xi],[Wl,zl])}a(ru,"parseHTTPDate");function su(r){return jt(r,[xl,$l])}a(su,"parseISODuration");const nu=Bt(Vt);function iu(r){return jt(r,[Fl,nu])}a(iu,"parseISOTimeOnly");const ou=$t(Ll,Pl),au=$t(Zi),cu=Bt(Vt,ir,or);function lu(r){return jt(r,[ou,Qi],[au,cu])}a(lu,"parseSQL");const eo="Invalid Duration",to={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},uu={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...to},Je=146097/400,qt=146097/4800,hu={years:{quarters:4,months:12,weeks:Je/7,days:Je,hours:Je*24,minutes:Je*24*60,seconds:Je*24*60*60,milliseconds:Je*24*60*60*1e3},quarters:{months:3,weeks:Je/28,days:Je/4,hours:Je*24/4,minutes:Je*24*60/4,seconds:Je*24*60*60/4,milliseconds:Je*24*60*60*1e3/4},months:{weeks:qt/7,days:qt,hours:qt*24,minutes:qt*24*60,seconds:qt*24*60*60,milliseconds:qt*24*60*60*1e3},...to},Tt=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],du=Tt.slice(0).reverse();function ct(r,e,t=!1){const s={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new ee(s)}a(ct,"clone$1");function ro(r,e){let t=e.milliseconds??0;for(const s of du.slice(1))e[s]&&(t+=e[s]*r[s].milliseconds);return t}a(ro,"durationToMillis");function so(r,e){const t=ro(r,e)<0?-1:1;Tt.reduceRight((s,n)=>{if(G(e[n]))return s;if(s){const i=e[s]*t,c=r[n][s],o=Math.floor(i/c);e[n]+=o*t,e[s]-=o*c*t}return n},null),Tt.reduce((s,n)=>{if(G(e[n]))return s;if(s){const i=e[s]%1;e[s]-=i,e[n]+=i*r[s][n]}return n},null)}a(so,"normalizeValues");function no(r){const e={};for(const[t,s]of Object.entries(r))s!==0&&(e[t]=s);return e}a(no,"removeZeroes");class ee{static{a(this,"Duration")}constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let s=t?hu:uu;e.matrix&&(s=e.matrix),this.values=e.values,this.loc=e.loc||oe.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=s,this.isLuxonDuration=!0}static fromMillis(e,t){return ee.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new Ce(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new ee({values:Pr(e,ee.normalizeUnit),loc:oe.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(gt(e))return ee.fromMillis(e);if(ee.isDuration(e))return e;if(typeof e=="object")return ee.fromObject(e);throw new Ce(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[s]=su(e);return s?ee.fromObject(s,t):ee.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[s]=iu(e);return s?ee.fromObject(s,t):ee.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Ce("need to specify a reason the Duration is invalid");const s=e instanceof Ze?e:new Ze(e,t);if(ge.throwOnInvalid)throw new $c(s);return new ee({invalid:s})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new zn(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const s={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Ne.create(this.loc,s).formatDurationFromString(this,e):eo}toHuman(e={}){if(!this.isValid)return eo;const t=e.showZeros!==!1,s=Tt.map(n=>{const i=this.values[n];return G(i)||i===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(s)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Fs(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},q.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?ro(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=ee.fromDurationLike(e),s={};for(const n of Tt)(Ft(t.values,n)||Ft(this.values,n))&&(s[n]=t.get(n)+this.get(n));return ct(this,{values:s},!0)}minus(e){if(!this.isValid)return this;const t=ee.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const s of Object.keys(this.values))t[s]=$i(e(this.values[s],s));return ct(this,{values:t},!0)}get(e){return this[ee.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Pr(e,ee.normalizeUnit)};return ct(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:s,matrix:n}={}){const c={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:n,conversionAccuracy:s};return ct(this,c)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return so(this.matrix,e),ct(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=no(this.normalize().shiftToAll().toObject());return ct(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(c=>ee.normalizeUnit(c));const t={},s={},n=this.toObject();let i;for(const c of Tt)if(e.indexOf(c)>=0){i=c;let o=0;for(const h in s)o+=this.matrix[h][c]*s[h],s[h]=0;gt(n[c])&&(o+=n[c]);const l=Math.trunc(o);t[c]=l,s[c]=(o*1e3-l*1e3)/1e3}else gt(n[c])&&(s[c]=n[c]);for(const c in s)s[c]!==0&&(t[i]+=c===i?s[c]:s[c]/this.matrix[i][c]);return so(this.matrix,t),ct(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return ct(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=no(this.values);return ct(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(s,n){return s===void 0||s===0?n===void 0||n===0:s===n}a(t,"eq");for(const s of Tt)if(!t(this.values[s],e.values[s]))return!1;return!0}}const Ht="Invalid Interval";function fu(r,e){return!r||!r.isValid?ye.invalid("missing or invalid start"):!e||!e.isValid?ye.invalid("missing or invalid end"):e<r?ye.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}a(fu,"validateStartEnd");class ye{static{a(this,"Interval")}constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Ce("need to specify a reason the Interval is invalid");const s=e instanceof Ze?e:new Ze(e,t);if(ge.throwOnInvalid)throw new xc(s);return new ye({invalid:s})}static fromDateTimes(e,t){const s=lr(e),n=lr(t),i=fu(s,n);return i??new ye({start:s,end:n})}static after(e,t){const s=ee.fromDurationLike(t),n=lr(e);return ye.fromDateTimes(n,n.plus(s))}static before(e,t){const s=ee.fromDurationLike(t),n=lr(e);return ye.fromDateTimes(n.minus(s),n)}static fromISO(e,t){const[s,n]=(e||"").split("/",2);if(s&&n){let i,c;try{i=q.fromISO(s,t),c=i.isValid}catch{c=!1}let o,l;try{o=q.fromISO(n,t),l=o.isValid}catch{l=!1}if(c&&l)return ye.fromDateTimes(i,o);if(c){const h=ee.fromISO(n,t);if(h.isValid)return ye.after(i,h)}else if(l){const h=ee.fromISO(s,t);if(h.isValid)return ye.before(o,h)}}return ye.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const s=this.start.startOf(e,t);let n;return t?.useLocaleWeeks?n=this.end.reconfigure({locale:s.locale}):n=this.end,n=n.startOf(e,t),Math.floor(n.diff(s,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?ye.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(lr).filter(c=>this.contains(c)).sort((c,o)=>c.toMillis()-o.toMillis()),s=[];let{s:n}=this,i=0;for(;n<this.e;){const c=t[i]||this.e,o=+c>+this.e?this.e:c;s.push(ye.fromDateTimes(n,o)),n=o,i+=1}return s}splitBy(e){const t=ee.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s}=this,n=1,i;const c=[];for(;s<this.e;){const o=this.start.plus(t.mapUnits(l=>l*n));i=+o>+this.e?this.e:o,c.push(ye.fromDateTimes(s,i)),s=i,n+=1}return c}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,s=this.e<e.e?this.e:e.e;return t>=s?null:ye.fromDateTimes(t,s)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,s=this.e>e.e?this.e:e.e;return ye.fromDateTimes(t,s)}static merge(e){const[t,s]=e.sort((n,i)=>n.s-i.s).reduce(([n,i],c)=>i?i.overlaps(c)||i.abutsStart(c)?[n,i.union(c)]:[n.concat([i]),c]:[n,c],[[],null]);return s&&t.push(s),t}static xor(e){let t=null,s=0;const n=[],i=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),c=Array.prototype.concat(...i),o=c.sort((l,h)=>l.time-h.time);for(const l of o)s+=l.type==="s"?1:-1,s===1?t=l.time:(t&&+t!=+l.time&&n.push(ye.fromDateTimes(t,l.time)),t=null);return ye.merge(n)}difference(...e){return ye.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()})`:Ht}[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=kr,t={}){return this.isValid?Ne.create(this.s.loc.clone(t),e).formatInterval(this):Ht}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Ht}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Ht}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Ht}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Ht}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):ee.invalid(this.invalidReason)}mapEndpoints(e){return ye.fromDateTimes(e(this.s),e(this.e))}}class Fr{static{a(this,"Info")}static hasDST(e=ge.defaultZone){const t=q.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return at.isValidZone(e)}static normalizeZone(e){return mt(e,ge.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||oe.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||oe.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||oe.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||oe.create(t,s,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||oe.create(t,s,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null}={}){return(n||oe.create(t,s,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null}={}){return(n||oe.create(t,s,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return oe.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return oe.create(t,null,"gregory").eras(e)}static features(){return{relative:Li(),localeWeek:Pi()}}}function io(r,e){const t=a(n=>n.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),"utcDayStart"),s=t(e)-t(r);return Math.floor(ee.fromMillis(s).as("days"))}a(io,"dayDiff");function pu(r,e,t){const s=[["years",(l,h)=>h.year-l.year],["quarters",(l,h)=>h.quarter-l.quarter+(h.year-l.year)*4],["months",(l,h)=>h.month-l.month+(h.year-l.year)*12],["weeks",(l,h)=>{const u=io(l,h);return(u-u%7)/7}],["days",io]],n={},i=r;let c,o;for(const[l,h]of s)t.indexOf(l)>=0&&(c=l,n[l]=h(r,e),o=i.plus(n),o>e?(n[l]--,r=i.plus(n),r>e&&(o=r,n[l]--,r=i.plus(n))):r=o);return[r,n,o,c]}a(pu,"highOrderDiffs");function mu(r,e,t,s){let[n,i,c,o]=pu(r,e,t);const l=e-n,h=t.filter(g=>["hours","minutes","seconds","milliseconds"].indexOf(g)>=0);h.length===0&&(c<e&&(c=n.plus({[o]:1})),c!==n&&(i[o]=(i[o]||0)+l/(c-n)));const u=ee.fromObject(i,s);return h.length>0?ee.fromMillis(l,s).shiftTo(...h).plus(u):u}a(mu,"diff");const gu="missing Intl.DateTimeFormat.formatToParts support";function ne(r,e=t=>t){return{regex:r,deser:a(([t])=>e(ol(t)),"deser")}}a(ne,"intUnit");const oo="[ \xA0]",ao=new RegExp(oo,"g");function yu(r){return r.replace(/\./g,"\\.?").replace(ao,oo)}a(yu,"fixListRegex");function co(r){return r.replace(/\./g,"").replace(ao," ").toLowerCase()}a(co,"stripInsensitivities");function Xe(r,e){return r===null?null:{regex:RegExp(r.map(yu).join("|")),deser:a(([t])=>r.findIndex(s=>co(t)===co(s))+e,"deser")}}a(Xe,"oneOf");function lo(r,e){return{regex:r,deser:a(([,t,s])=>Lr(t,s),"deser"),groups:e}}a(lo,"offset");function xr(r){return{regex:r,deser:a(([e])=>e,"deser")}}a(xr,"simple");function bu(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}a(bu,"escapeToken");function _u(r,e){const t=Ke(e),s=Ke(e,"{2}"),n=Ke(e,"{3}"),i=Ke(e,"{4}"),c=Ke(e,"{6}"),o=Ke(e,"{1,2}"),l=Ke(e,"{1,3}"),h=Ke(e,"{1,6}"),u=Ke(e,"{1,9}"),g=Ke(e,"{2,4}"),p=Ke(e,"{4,6}"),d=a(y=>({regex:RegExp(bu(y.val)),deser:a(([b])=>b,"deser"),literal:!0}),"literal"),m=a(y=>{if(r.literal)return d(y);switch(y.val){case"G":return Xe(e.eras("short"),0);case"GG":return Xe(e.eras("long"),0);case"y":return ne(h);case"yy":return ne(g,xs);case"yyyy":return ne(i);case"yyyyy":return ne(p);case"yyyyyy":return ne(c);case"M":return ne(o);case"MM":return ne(s);case"MMM":return Xe(e.months("short",!0),1);case"MMMM":return Xe(e.months("long",!0),1);case"L":return ne(o);case"LL":return ne(s);case"LLL":return Xe(e.months("short",!1),1);case"LLLL":return Xe(e.months("long",!1),1);case"d":return ne(o);case"dd":return ne(s);case"o":return ne(l);case"ooo":return ne(n);case"HH":return ne(s);case"H":return ne(o);case"hh":return ne(s);case"h":return ne(o);case"mm":return ne(s);case"m":return ne(o);case"q":return ne(o);case"qq":return ne(s);case"s":return ne(o);case"ss":return ne(s);case"S":return ne(l);case"SSS":return ne(n);case"u":return xr(u);case"uu":return xr(o);case"uuu":return ne(t);case"a":return Xe(e.meridiems(),0);case"kkkk":return ne(i);case"kk":return ne(g,xs);case"W":return ne(o);case"WW":return ne(s);case"E":case"c":return ne(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 lo(new RegExp(`([+-]${o.source})(?::(${s.source}))?`),2);case"ZZZ":return lo(new RegExp(`([+-]${o.source})(${s.source})?`),2);case"z":return xr(/[a-z_+-/]{1,256}?/i);case" ":return xr(/[^\S\n\r]/);default:return d(y)}},"unitate")(r)||{invalidReason:gu};return m.token=r,m}a(_u,"unitForToken");const wu={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 Su(r,e,t){const{type:s,value:n}=r;if(s==="literal"){const l=/^\s+$/.test(n);return{literal:!l,val:l?" ":n}}const i=e[s];let c=s;s==="hour"&&(e.hour12!=null?c=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?c="hour12":c="hour24":c=t.hour12?"hour12":"hour24");let o=wu[c];if(typeof o=="object"&&(o=o[i]),o)return{literal:!1,val:o}}a(Su,"tokenForPart");function vu(r){return[`^${r.map(t=>t.regex).reduce((t,s)=>`${t}(${s.source})`,"")}$`,r]}a(vu,"buildRegex");function Eu(r,e,t){const s=r.match(e);if(s){const n={};let i=1;for(const c in t)if(Ft(t,c)){const o=t[c],l=o.groups?o.groups+1:1;!o.literal&&o.token&&(n[o.token.val[0]]=o.deser(s.slice(i,i+l))),i+=l}return[s,n]}else return[s,{}]}a(Eu,"match");function Ou(r){const e=a(i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},"toField");let t=null,s;return G(r.z)||(t=at.create(r.z)),G(r.Z)||(t||(t=new Me(r.Z)),s=r.Z),G(r.q)||(r.M=(r.q-1)*3+1),G(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),G(r.u)||(r.S=Ms(r.u)),[Object.keys(r).reduce((i,c)=>{const o=e(c);return o&&(i[o]=r[c]),i},{}),t,s]}a(Ou,"dateTimeFromMatches");let Us=null;function Tu(){return Us||(Us=q.fromMillis(1555555555555)),Us}a(Tu,"getDummyDateTime");function ku(r,e){if(r.literal)return r;const t=Ne.macroTokenToFormatOpts(r.val),s=po(t,e);return s==null||s.includes(void 0)?r:s}a(ku,"maybeExpandMacroToken");function uo(r,e){return Array.prototype.concat(...r.map(t=>ku(t,e)))}a(uo,"expandMacroTokens");class ho{static{a(this,"TokenParser")}constructor(e,t){if(this.locale=e,this.format=t,this.tokens=uo(Ne.parseFormat(t),e),this.units=this.tokens.map(s=>_u(s,e)),this.disqualifyingUnit=this.units.find(s=>s.invalidReason),!this.disqualifyingUnit){const[s,n]=vu(this.units);this.regex=RegExp(s,"i"),this.handlers=n}}explainFromTokens(e){if(this.isValid){const[t,s]=Eu(e,this.regex,this.handlers),[n,i,c]=s?Ou(s):[null,null,void 0];if(Ft(s,"a")&&Ft(s,"H"))throw new Mt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:s,result:n,zone:i,specificOffset:c}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function fo(r,e,t){return new ho(r,t).explainFromTokens(e)}a(fo,"explainFromTokens");function Iu(r,e,t){const{result:s,zone:n,specificOffset:i,invalidReason:c}=fo(r,e,t);return[s,n,i,c]}a(Iu,"parseFromTokens");function po(r,e){if(!r)return null;const s=Ne.create(e,r).dtFormatter(Tu()),n=s.formatToParts(),i=s.resolvedOptions();return n.map(c=>Su(c,r,i))}a(po,"formatOptsToTokens");const Vs="Invalid DateTime",mo=864e13;function ar(r){return new Ze("unsupported zone",`the zone "${r.name}" is not supported`)}a(ar,"unsupportedZone");function qs(r){return r.weekData===null&&(r.weekData=Rr(r.c)),r.weekData}a(qs,"possiblyCachedWeekData");function Hs(r){return r.localWeekData===null&&(r.localWeekData=Rr(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}a(Hs,"possiblyCachedLocalWeekData");function kt(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new q({...t,...e,old:t})}a(kt,"clone");function go(r,e,t){let s=r-e*60*1e3;const n=t.offset(s);if(e===n)return[s,e];s-=(n-e)*60*1e3;const i=t.offset(s);return n===i?[s,n]:[r-Math.min(n,i)*60*1e3,Math.max(n,i)]}a(go,"fixOffset");function $r(r,e){r+=e*60*1e3;const t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}a($r,"tsToObj");function Br(r,e,t){return go(Dr(r),e,t)}a(Br,"objToTS");function yo(r,e){const t=r.o,s=r.c.year+Math.trunc(e.years),n=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...r.c,year:s,month:n,day:Math.min(r.c.day,Nr(s,n))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},c=ee.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Dr(i);let[l,h]=go(o,t,r.zone);return c!==0&&(l+=c,h=r.zone.offset(l)),{ts:l,o:h}}a(yo,"adjustTime");function Wt(r,e,t,s,n,i){const{setZone:c,zone:o}=t;if(r&&Object.keys(r).length!==0||e){const l=e||o,h=q.fromObject(r,{...t,zone:l,specificOffset:i});return c?h:h.setZone(o)}else return q.invalid(new Ze("unparsable",`the input "${n}" can't be parsed as ${s}`))}a(Wt,"parseDataToDateTime");function jr(r,e,t=!0){return r.isValid?Ne.create(oe.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}a(jr,"toTechFormat");function Ws(r,e,t){const s=r.c.year>9999||r.c.year<0;let n="";if(s&&r.c.year>=0&&(n+="+"),n+=ve(r.c.year,s?6:4),t==="year")return n;if(e){if(n+="-",n+=ve(r.c.month),t==="month")return n;n+="-"}else if(n+=ve(r.c.month),t==="month")return n;return n+=ve(r.c.day),n}a(Ws,"toISODate");function bo(r,e,t,s,n,i,c){let o=!t||r.c.millisecond!==0||r.c.second!==0,l="";switch(c){case"day":case"month":case"year":break;default:if(l+=ve(r.c.hour),c==="hour")break;if(e){if(l+=":",l+=ve(r.c.minute),c==="minute")break;o&&(l+=":",l+=ve(r.c.second))}else{if(l+=ve(r.c.minute),c==="minute")break;o&&(l+=ve(r.c.second))}if(c==="second")break;o&&(!s||r.c.millisecond!==0)&&(l+=".",l+=ve(r.c.millisecond,3))}return n&&(r.isOffsetFixed&&r.offset===0&&!i?l+="Z":r.o<0?(l+="-",l+=ve(Math.trunc(-r.o/60)),l+=":",l+=ve(Math.trunc(-r.o%60))):(l+="+",l+=ve(Math.trunc(r.o/60)),l+=":",l+=ve(Math.trunc(r.o%60)))),i&&(l+="["+r.zone.ianaName+"]"),l}a(bo,"toISOTime");const _o={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Au={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ru={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ur=["year","month","day","hour","minute","second","millisecond"],Cu=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Nu=["year","ordinal","hour","minute","second","millisecond"];function Vr(r){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new zn(r);return e}a(Vr,"normalizeUnit");function wo(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Vr(r)}}a(wo,"normalizeUnitWithLocalWeeks");function Du(r){if(cr===void 0&&(cr=ge.now()),r.type!=="iana")return r.offset(cr);const e=r.name;let t=zs.get(e);return t===void 0&&(t=r.offset(cr),zs.set(e,t)),t}a(Du,"guessOffsetForZone");function So(r,e){const t=mt(e.zone,ge.defaultZone);if(!t.isValid)return q.invalid(ar(t));const s=oe.fromObject(e);let n,i;if(G(r.year))n=ge.now();else{for(const l of Ur)G(r[l])&&(r[l]=_o[l]);const c=Ni(r)||Di(r);if(c)return q.invalid(c);const o=Du(t);[n,i]=Br(r,o,t)}return new q({ts:n,zone:t,loc:s,o:i})}a(So,"quickDT");function vo(r,e,t){const s=G(t.round)?!0:t.round,n=G(t.rounding)?"trunc":t.rounding,i=a((o,l)=>(o=Fs(o,s||t.calendary?0:2,t.calendary?"round":n),e.loc.clone(t).relFormatter(t).format(o,l)),"format"),c=a(o=>t.calendary?e.hasSame(r,o)?0:e.startOf(o).diff(r.startOf(o),o).get(o):e.diff(r,o).get(o),"differ");if(t.unit)return i(c(t.unit),t.unit);for(const o of t.units){const l=c(o);if(Math.abs(l)>=1)return i(l,o)}return i(r>e?-0:0,t.units[t.units.length-1])}a(vo,"diffRelative");function Eo(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}a(Eo,"lastOpts");let cr;const zs=new Map;class q{static{a(this,"DateTime")}constructor(e){const t=e.zone||ge.defaultZone;let s=e.invalid||(Number.isNaN(e.ts)?new Ze("invalid input"):null)||(t.isValid?null:ar(t));this.ts=G(e.ts)?ge.now():e.ts;let n=null,i=null;if(!s)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[n,i]=[e.old.c,e.old.o];else{const o=gt(e.o)&&!e.old?e.o:t.offset(this.ts);n=$r(this.ts,o),s=Number.isNaN(n.year)?new Ze("invalid input"):null,n=s?null:n,i=s?null:o}this._zone=t,this.loc=e.loc||oe.create(),this.invalid=s,this.weekData=null,this.localWeekData=null,this.c=n,this.o=i,this.isLuxonDateTime=!0}static now(){return new q({})}static local(){const[e,t]=Eo(arguments),[s,n,i,c,o,l,h]=t;return So({year:s,month:n,day:i,hour:c,minute:o,second:l,millisecond:h},e)}static utc(){const[e,t]=Eo(arguments),[s,n,i,c,o,l,h]=t;return e.zone=Me.utcInstance,So({year:s,month:n,day:i,hour:c,minute:o,second:l,millisecond:h},e)}static fromJSDate(e,t={}){const s=hl(e)?e.valueOf():NaN;if(Number.isNaN(s))return q.invalid("invalid input");const n=mt(t.zone,ge.defaultZone);return n.isValid?new q({ts:s,zone:n,loc:oe.fromObject(t)}):q.invalid(ar(n))}static fromMillis(e,t={}){if(gt(e))return e<-mo||e>mo?q.invalid("Timestamp out of range"):new q({ts:e,zone:mt(t.zone,ge.defaultZone),loc:oe.fromObject(t)});throw new Ce(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(gt(e))return new q({ts:e*1e3,zone:mt(t.zone,ge.defaultZone),loc:oe.fromObject(t)});throw new Ce("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const s=mt(t.zone,ge.defaultZone);if(!s.isValid)return q.invalid(ar(s));const n=oe.fromObject(t),i=Pr(e,wo),{minDaysInFirstWeek:c,startOfWeek:o}=Ci(i,n),l=ge.now(),h=G(t.specificOffset)?s.offset(l):t.specificOffset,u=!G(i.ordinal),g=!G(i.year),p=!G(i.month)||!G(i.day),d=g||p,f=i.weekYear||i.weekNumber;if((d||u)&&f)throw new Mt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(p&&u)throw new Mt("Can't mix ordinal dates with month/day");const m=f||i.weekday&&!d;let y,b,_=$r(l,h);m?(y=Cu,b=Au,_=Rr(_,c,o)):u?(y=Nu,b=Ru,_=Ls(_)):(y=Ur,b=_o);let w=!1;for(const N of y){const j=i[N];G(j)?w?i[N]=b[N]:i[N]=_[N]:w=!0}const S=m?cl(i,c,o):u?ll(i):Ni(i),T=S||Di(i);if(T)return q.invalid(T);const v=m?Ai(i,c,o):u?Ri(i):i,[R,O]=Br(v,h,s),k=new q({ts:R,zone:s,o:O,loc:n});return i.weekday&&d&&e.weekday!==k.weekday?q.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${k.toISO()}`):k.isValid?k:q.invalid(k.invalid)}static fromISO(e,t={}){const[s,n]=eu(e);return Wt(s,n,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[s,n]=tu(e);return Wt(s,n,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[s,n]=ru(e);return Wt(s,n,t,"HTTP",t)}static fromFormat(e,t,s={}){if(G(e)||G(t))throw new Ce("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:i=null}=s,c=oe.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),[o,l,h,u]=Iu(c,e,t);return u?q.invalid(u):Wt(o,l,s,`format ${t}`,e,h)}static fromString(e,t,s={}){return q.fromFormat(e,t,s)}static fromSQL(e,t={}){const[s,n]=lu(e);return Wt(s,n,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Ce("need to specify a reason the DateTime is invalid");const s=e instanceof Ze?e:new Ze(e,t);if(ge.throwOnInvalid)throw new Fc(s);return new q({invalid:s})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const s=po(e,oe.fromObject(t));return s?s.map(n=>n?n.val:null).join(""):null}static expandFormat(e,t={}){return uo(Ne.parseFormat(e),oe.fromObject(t)).map(n=>n.val).join("")}static resetCache(){cr=void 0,zs.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?qs(this).weekYear:NaN}get weekNumber(){return this.isValid?qs(this).weekNumber:NaN}get weekday(){return this.isValid?qs(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Hs(this).weekday:NaN}get localWeekNumber(){return this.isValid?Hs(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Hs(this).weekYear:NaN}get ordinal(){return this.isValid?Ls(this.c).ordinal:NaN}get monthShort(){return this.isValid?Fr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Fr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Fr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Fr.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,s=Dr(this.c),n=this.zone.offset(s-e),i=this.zone.offset(s+e),c=this.zone.offset(s-n*t),o=this.zone.offset(s-i*t);if(c===o)return[this];const l=s-c*t,h=s-o*t,u=$r(l,c),g=$r(h,o);return u.hour===g.hour&&u.minute===g.minute&&u.second===g.second&&u.millisecond===g.millisecond?[kt(this,{ts:l}),kt(this,{ts:h})]:[this]}get isInLeapYear(){return rr(this.year)}get daysInMonth(){return Nr(this.year,this.month)}get daysInYear(){return this.isValid?xt(this.year):NaN}get weeksInWeekYear(){return this.isValid?sr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?sr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:s,calendar:n}=Ne.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:s,outputCalendar:n}}toUTC(e=0,t={}){return this.setZone(Me.instance(e),t)}toLocal(){return this.setZone(ge.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:s=!1}={}){if(e=mt(e,ge.defaultZone),e.equals(this.zone))return this;if(e.isValid){let n=this.ts;if(t||s){const i=e.offset(this.ts),c=this.toObject();[n]=Br(c,i,e)}return kt(this,{ts:n,zone:e})}else return q.invalid(ar(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:s}={}){const n=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:s});return kt(this,{loc:n})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Pr(e,wo),{minDaysInFirstWeek:s,startOfWeek:n}=Ci(t,this.loc),i=!G(t.weekYear)||!G(t.weekNumber)||!G(t.weekday),c=!G(t.ordinal),o=!G(t.year),l=!G(t.month)||!G(t.day),h=o||l,u=t.weekYear||t.weekNumber;if((h||c)&&u)throw new Mt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&c)throw new Mt("Can't mix ordinal dates with month/day");let g;i?g=Ai({...Rr(this.c,s,n),...t},s,n):G(t.ordinal)?(g={...this.toObject(),...t},G(t.day)&&(g.day=Math.min(Nr(g.year,g.month),g.day))):g=Ri({...Ls(this.c),...t});const[p,d]=Br(g,this.o,this.zone);return kt(this,{ts:p,o:d})}plus(e){if(!this.isValid)return this;const t=ee.fromDurationLike(e);return kt(this,yo(this,t))}minus(e){if(!this.isValid)return this;const t=ee.fromDurationLike(e).negate();return kt(this,yo(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const s={},n=ee.normalizeUnit(e);switch(n){case"years":s.month=1;case"quarters":case"months":s.day=1;case"weeks":case"days":s.hour=0;case"hours":s.minute=0;case"minutes":s.second=0;case"seconds":s.millisecond=0;break}if(n==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:c}=this;c<i&&(s.weekNumber=this.weekNumber-1),s.weekday=i}else s.weekday=1;if(n==="quarters"){const i=Math.ceil(this.month/3);s.month=(i-1)*3+1}return this.set(s)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Ne.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Vs}toLocaleString(e=kr,t={}){return this.isValid?Ne.create(this.loc.clone(t),e).formatDateTime(this):Vs}toLocaleParts(e={}){return this.isValid?Ne.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:s=!1,includeOffset:n=!0,extendedZone:i=!1,precision:c="milliseconds"}={}){if(!this.isValid)return null;c=Vr(c);const o=e==="extended";let l=Ws(this,o,c);return Ur.indexOf(c)>=3&&(l+="T"),l+=bo(this,o,t,s,n,i,c),l}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?Ws(this,e==="extended",Vr(t)):null}toISOWeekDate(){return jr(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:s=!0,includePrefix:n=!1,extendedZone:i=!1,format:c="extended",precision:o="milliseconds"}={}){return this.isValid?(o=Vr(o),(n&&Ur.indexOf(o)>=3?"T":"")+bo(this,c==="extended",t,e,s,i,o)):null}toRFC2822(){return jr(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return jr(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Ws(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:s=!0}={}){let n="HH:mm:ss.SSS";return(t||e)&&(s&&(n+=" "),t?n+="z":e&&(n+="ZZ")),jr(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Vs}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",s={}){if(!this.isValid||!e.isValid)return ee.invalid("created by diffing an invalid DateTime");const n={locale:this.locale,numberingSystem:this.numberingSystem,...s},i=dl(t).map(ee.normalizeUnit),c=e.valueOf()>this.valueOf(),o=c?this:e,l=c?e:this,h=mu(o,l,i,n);return c?h.negate():h}diffNow(e="milliseconds",t={}){return this.diff(q.now(),e,t)}until(e){return this.isValid?ye.fromDateTimes(this,e):this}hasSame(e,t,s){if(!this.isValid)return!1;const n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,s)<=n&&n<=i.endOf(t,s)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||q.fromObject({},{zone:this.zone}),s=e.padding?this<t?-e.padding:e.padding:0;let n=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(n=e.unit,i=void 0),vo(t,this.plus(s),{...e,numeric:"always",units:n,unit:i})}toRelativeCalendar(e={}){return this.isValid?vo(e.base||q.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(q.isDateTime))throw new Ce("min requires all arguments be DateTimes");return Mi(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(q.isDateTime))throw new Ce("max requires all arguments be DateTimes");return Mi(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,s={}){const{locale:n=null,numberingSystem:i=null}=s,c=oe.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return fo(c,e,t)}static fromStringExplain(e,t,s={}){return q.fromFormatExplain(e,t,s)}static buildFormatParser(e,t={}){const{locale:s=null,numberingSystem:n=null}=t,i=oe.fromOpts({locale:s,numberingSystem:n,defaultToEN:!0});return new ho(i,e)}static fromFormatParser(e,t,s={}){if(G(e)||G(t))throw new Ce("fromFormatParser requires an input string and a format parser");const{locale:n=null,numberingSystem:i=null}=s,c=oe.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});if(!c.equals(t.locale))throw new Ce(`fromFormatParser called with a locale of ${c}, but the format parser was created for ${t.locale}`);const{result:o,zone:l,specificOffset:h,invalidReason:u}=t.explainFromTokens(e);return u?q.invalid(u):Wt(o,l,s,`format ${t.format}`,e,h)}static get DATE_SHORT(){return kr}static get DATE_MED(){return Jn}static get DATE_MED_WITH_WEEKDAY(){return Bc}static get DATE_FULL(){return Gn}static get DATE_HUGE(){return Yn}static get TIME_SIMPLE(){return Kn}static get TIME_WITH_SECONDS(){return Zn}static get TIME_WITH_SHORT_OFFSET(){return Xn}static get TIME_WITH_LONG_OFFSET(){return Qn}static get TIME_24_SIMPLE(){return ei}static get TIME_24_WITH_SECONDS(){return ti}static get TIME_24_WITH_SHORT_OFFSET(){return ri}static get TIME_24_WITH_LONG_OFFSET(){return si}static get DATETIME_SHORT(){return ni}static get DATETIME_SHORT_WITH_SECONDS(){return ii}static get DATETIME_MED(){return oi}static get DATETIME_MED_WITH_SECONDS(){return ai}static get DATETIME_MED_WITH_WEEKDAY(){return jc}static get DATETIME_FULL(){return ci}static get DATETIME_FULL_WITH_SECONDS(){return li}static get DATETIME_HUGE(){return ui}static get DATETIME_HUGE_WITH_SECONDS(){return hi}}function lr(r){if(q.isDateTime(r))return r;if(r&&r.valueOf&>(r.valueOf()))return q.fromJSDate(r);if(r&&typeof r=="object")return q.fromObject(r);throw new Ce(`Unknown datetime argument: ${r}, of type ${typeof r}`)}a(lr,"friendlyDateTime");var Lu=Object.defineProperty,Pu=a((r,e)=>Lu(r,"name",{value:e,configurable:!0}),"o$s");class Js{static{a(this,"AbstractFormatter")}static{Pu(this,"AbstractFormatter")}dateFormat;constructor(e="YYYY-MM-DD HH:mm:ss"){this.dateFormat=e}_formatTimestamp(e){const t=q.fromJSDate(e);return Math.floor(t.toSeconds()).toFixed(0)}_formatDate(e){return q.fromJSDate(e).toFormat(this.dateFormat.replace(/YYYY/g,"yyyy").replace(/YY/g,"yy").replace(/DD/g,"dd").replace(/D/g,"d"))}}var Mu=Object.defineProperty,Fu=a((r,e)=>Mu(r,"name",{value:e,configurable:!0}),"m$8");class xu extends Js{static{a(this,"JsonFormatter")}static{Fu(this,"JsonFormatter")}constructor(e="YYYY-MM-DD HH:mm:ss"){super(e)}format(e){return JSON.stringify({channel:e.channel,levelName:e.levelName,message:e.message,context:e.context,extra:e.extra,timestamp:this._formatTimestamp(e.timestamp),date:this._formatDate(e.timestamp)})}}var $u=Object.defineProperty,Bu=a((r,e)=>$u(r,"name",{value:e,configurable:!0}),"s$w");class qr extends Js{static{a(this,"LineFormatter")}static{Bu(this,"LineFormatter")}formatString;constructor(e="[{channel}] {levelName}: {message} {context} {extra} {date}",t="YYYY-MM-DD HH:mm:ss"){super(t),this.formatString=e}format(e){let t=this.formatString;const s={"{channel}":e.channel,"{levelName}":e.levelName,"{message}":e.message,"{context}":JSON.stringify(e.context),"{extra}":JSON.stringify(e.extra),"{timestamp}":this._formatTimestamp(e.timestamp),"{date}":this._formatDate(e.timestamp)};for(const[n,i]of Object.entries(s))t=t.replace(n,i);return t}}var ju=Object.defineProperty,Uu=a((r,e)=>ju(r,"name",{value:e,configurable:!0}),"n$g");class Oo extends Js{static{a(this,"TelegramFormatter")}static{Uu(this,"TelegramFormatter")}useHtml;maxMessageLength;constructor(e=!0,t="YYYY-MM-DD HH:mm:ss",s=4096){super(t),this.useHtml=e,this.maxMessageLength=s}format(e){let t=this._formatBaseMessage(e);const s=this._formatAdditionalInfo(e);return s&&(t+=`
|
|
9
9
|
|
|
10
10
|
${s}`),t.length>this.maxMessageLength&&(t=t.substring(0,this.maxMessageLength-3)+"..."),t}_formatBaseMessage(e){const t=this._formatDate(e.timestamp),s=e.levelName;return this.useHtml?`<b>${s}</b> | <code>${e.channel}</code>
|
|
11
11
|
<i>Time:</i> ${t}
|
|
@@ -23,32 +23,32 @@ ${s}
|
|
|
23
23
|
${s}
|
|
24
24
|
\`\`\``)}return t.join(`
|
|
25
25
|
|
|
26
|
-
`)}_escapeHtml(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}_escapeMarkdownV2(e){return e.replace(/_/g,"\\_").replace(/\*/g,"\\*").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/\(/g,"\\(").replace(/\)/g,"\\)").replace(/~/g,"\\~").replace(/`/g,"\\`").replace(/>/g,"\\>").replace(/#/g,"\\#").replace(/\+/g,"\\+").replace(/-/g,"\\-").replace(/=/g,"\\=").replace(/\|/g,"\\|").replace(/\{/g,"\\{").replace(/\}/g,"\\}").replace(/\./g,"\\.").replace(/!/g,"\\!")}setUseHtml(e){return this.useHtml=e,this}setMaxMessageLength(e){return this.maxMessageLength=e,this}}var Vu=Object.defineProperty,qu=a((r,e)=>Vu(r,"name",{value:e,configurable:!0}),"e$c");const
|
|
27
|
-
`;this.stream.write(t)}catch(t){return console.error(`StreamHandler write error: ${t}`),!1}return!0}async close(){if(typeof this.stream.end=="function")return new Promise((e,t)=>{this.stream.end(s=>{s?t(s):e()})})}}var oh=Object.defineProperty,ah=a((r,e)=>oh(r,"name",{value:e,configurable:!0}),"o$p");class ch extends
|
|
26
|
+
`)}_escapeHtml(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}_escapeMarkdownV2(e){return e.replace(/_/g,"\\_").replace(/\*/g,"\\*").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/\(/g,"\\(").replace(/\)/g,"\\)").replace(/~/g,"\\~").replace(/`/g,"\\`").replace(/>/g,"\\>").replace(/#/g,"\\#").replace(/\+/g,"\\+").replace(/-/g,"\\-").replace(/=/g,"\\=").replace(/\|/g,"\\|").replace(/\{/g,"\\{").replace(/\}/g,"\\}").replace(/\./g,"\\.").replace(/!/g,"\\!")}setUseHtml(e){return this.useHtml=e,this}setMaxMessageLength(e){return this.maxMessageLength=e,this}}var Vu=Object.defineProperty,qu=a((r,e)=>Vu(r,"name",{value:e,configurable:!0}),"e$c");const Hu=qu(r=>(r.extra.pid="?",typeof process<"u"&&process.pid&&(r.extra.pid=process.pid),r),"pidProcessor");var Wu=Object.defineProperty,zu=a((r,e)=>Wu(r,"name",{value:e,configurable:!0}),"o$r");const Ju=zu(r=>(r.extra.memoryUsage="?",typeof process<"u"&&process.memoryUsage&&(r.extra.memoryUsage=Math.round(process.memoryUsage().heapUsed/1024/1024)+"MB"),r),"memoryUsageProcessor");var Gu=Object.defineProperty,Yu=a((r,e)=>Gu(r,"name",{value:e,configurable:!0}),"o$q");class zt{static{a(this,"AbstractHandler")}static{Yu(this,"AbstractHandler")}level;formatter=null;bubble=!0;constructor(e=z.DEBUG,t){this.level=e,t!==void 0&&(this.bubble=t)}isHandling(e){return e>=this.level}shouldBubble(){return this.bubble}setFormatter(e){this.formatter=e}getFormatter(){return this.formatter}}var Ku=Object.defineProperty,Zu=a((r,e)=>Ku(r,"name",{value:e,configurable:!0}),"c$9");class To extends zt{static{a(this,"ConsoleHandler")}static{Zu(this,"ConsoleHandler")}_styles=new Map;_useStyles;constructor(e=z.DEBUG,t){const s={useStyles:!0,...t};super(e,s.bubble),this._useStyles=s.useStyles,this._initStyles(),this.setFormatter(new qr)}_initStyles(){const e="color: _color_; background: _bg_; padding: 2px 6px; border-radius: 3px; font-size: 11px;";this._styles.set(z.DEBUG,["%cDEBUG",e.replace("_color_","#666666").replace("_bg_","#F0F0F0")]),this._styles.set(z.INFO,["%cINFO",e.replace("_color_","white").replace("_bg_","#2196F3")]),this._styles.set(z.NOTICE,["%cNOTICE",e.replace("_color_","white").replace("_bg_","#213BF3")]),this._styles.set(z.WARNING,["%cWARN",e.replace("_color_","white").replace("_bg_","#FF9800")]),this._styles.set(z.ERROR,["%cERROR",e.replace("_color_","white").replace("_bg_","#F44336")]),this._styles.set(z.CRITICAL,["%cCRITICAL",e.replace("_color_","white").replace("_bg_","#9C27B0")])}async handle(e){const t=this.getFormatter().format(e);let s=this._getConsoleMethod(e.level);e.context.needTrace===!0&&(s="trace");const n=[];if(this._useStyles&&this._styles.has(e.level)){const i=this._styles.get(e.level);n.push(i[0],i[1])}return n.push(t),console[s](...n.filter(Boolean)),!0}_getConsoleMethod(e){switch(e){case z.INFO:case z.NOTICE:return"info";case z.WARNING:return"warn";case z.ERROR:case z.CRITICAL:case z.ALERT:case z.EMERGENCY:return"error";default:return"log"}}}var Xu=Object.defineProperty,Qu=a((r,e)=>Xu(r,"name",{value:e,configurable:!0}),"a$m");class Gs extends To{static{a(this,"ConsoleV2Handler")}static{Qu(this,"ConsoleV2Handler")}constructor(e=z.DEBUG,t){super(e,t),this.setFormatter(new qr("[{channel}]: {message}"))}async handle(e){const t=this.getFormatter().format(e);let s=this._getConsoleMethod(e.level);e.context.needTrace===!0&&(s="trace");const n=e.context&&Object.keys(e.context).length>0?e.context:void 0,i=e.extra&&Object.keys(e.extra).length>0?e.extra:void 0,c=[];if(this._useStyles&&this._styles.has(e.level)){const o=this._styles.get(e.level);c.push(o[0],o[1])}return c.push(t),c.push(n),c.push(i),console[s](...c.filter(Boolean)),!0}}var eh=Object.defineProperty,th=a((r,e)=>eh(r,"name",{value:e,configurable:!0}),"t$a");class rh extends zt{static{a(this,"MemoryHandler")}static{th(this,"MemoryHandler")}records=[];limit;constructor(e=z.DEBUG,t){const s={bubble:!0,limit:1e3,...t};super(e,s.bubble),this.limit=s.limit}async handle(e){return this.records.push(e),this.records.length>this.limit&&this.records.shift(),!0}getRecords(){return[...this.records]}clear(){this.records=[]}}var sh=Object.defineProperty,nh=a((r,e)=>sh(r,"name",{value:e,configurable:!0}),"s$s");class ih extends zt{static{a(this,"StreamHandler")}static{nh(this,"StreamHandler")}stream;constructor(e=z.DEBUG,t){const s={bubble:!0,...t};super(e,s.bubble),this.stream=s.stream,this.setFormatter(new qr)}async handle(e){try{const t=this.getFormatter().format(e)+`
|
|
27
|
+
`;this.stream.write(t)}catch(t){return console.error(`StreamHandler write error: ${t}`),!1}return!0}async close(){if(typeof this.stream.end=="function")return new Promise((e,t)=>{this.stream.end(s=>{s?t(s):e()})})}}var oh=Object.defineProperty,ah=a((r,e)=>oh(r,"name",{value:e,configurable:!0}),"o$p");class ch extends zt{static{a(this,"ConsolaAdapter")}static{ah(this,"ConsolaAdapter")}consolaInstance;constructor(e=z.DEBUG,t){const s={bubble:!0,...t};super(e,s.bubble),this.consolaInstance=s.consolaInstance}setFormatter(e){}getFormatter(){return null}async handle(e){const t=`[${e.channel}] ${e.levelName}: ${e.message}`,s={...e.context,...e.extra,timestamp:e.timestamp};switch(e.level){case z.DEBUG:this.consolaInstance.log(t,s);break;case z.INFO:this.consolaInstance.info(t,s);break;case z.NOTICE:this.consolaInstance.success(t,s);break;case z.WARNING:this.consolaInstance.warn(t,s);break;case z.ERROR:case z.CRITICAL:case z.ALERT:case z.EMERGENCY:this.consolaInstance.error(t,s);break;default:this.consolaInstance.log(t,s)}return!0}}var lh=Object.defineProperty,uh=a((r,e)=>lh(r,"name",{value:e,configurable:!0}),"n$f");class hh extends zt{static{a(this,"WinstonAdapter")}static{uh(this,"WinstonAdapter")}winstonLogger;constructor(e=z.DEBUG,t){const s={bubble:!0,...t};super(e,s.bubble),this.winstonLogger=s.winstonLogger}setFormatter(e){}getFormatter(){return null}async handle(e){const t={DEBUG:"debug",INFO:"info",NOTICE:"notice",WARNING:"warn",ERROR:"error",CRITICAL:"error",ALERT:"error",EMERGENCY:"error"},s=t[e.levelName]||t.INFO;return this.winstonLogger.log({level:s,channel:e.channel,message:e.message,context:e.context,extra:e.extra,timestamp:e.timestamp}),!0}}var dh=Object.defineProperty,fh=a((r,e)=>dh(r,"name",{value:e,configurable:!0}),"e$b"),ur=(r=>(r.UNKNOWN="unknown",r.BROWSE="browser",r.NODE="node",r))(ur||{});function Hr(){return typeof window<"u"&&typeof window.document<"u"?"browser":typeof process<"u"&&process.versions&&process.versions.node?"node":"unknown"}a(Hr,"getEnvironment"),fh(Hr,"getEnvironment");var ph=Object.defineProperty,mh=a((r,e)=>ph(r,"name",{value:e,configurable:!0}),"s$q");class gh extends zt{static{a(this,"TelegramHandler")}static{mh(this,"TelegramHandler")}botToken;chatId;parseMode;disableNotification;disableWebPagePreview;environment;warnInBrowser;constructor(e=z.ERROR,t){if(super(e,t.bubble),!t.botToken)throw new Error("botToken is required for TelegramHandler");if(!t.chatId)throw new Error("chatId is required for TelegramHandler");this.botToken=t.botToken,this.chatId=t.chatId,this.parseMode=t.parseMode||"HTML",this.disableNotification=t.disableNotification||!1,this.disableWebPagePreview=t.disableWebPagePreview||!0,this.environment=Hr(),this.warnInBrowser=t.warnInBrowser!==!1,this.setFormatter(new Oo(this.parseMode==="HTML"))}async handle(e){const t=this.getFormatter();if(!t)return console.error("TelegramHandler: No formatter set"),!1;const s=t.format(e);return this.environment===ur.BROWSE?this._handleInBrowser(s,e):this.environment===ur.NODE?this._handleInNode(s,e):(console.warn("TelegramHandler: Unknown environment, using fallback"),this._handleFallback(s))}async _handleInBrowser(e,t){if(this.warnInBrowser){const s=`\u26A0\uFE0F TelegramHandler: Cannot send logs to Telegram from browser environment.
|
|
28
28
|
This would expose your bot token. Consider disabling this handler in browser.
|
|
29
29
|
Log message: ${t.message}
|
|
30
|
-
If you need to send logs from browser, use a proxy server.`;console.warn(s),console.log("%cTelegram Handler Warning","color: #FF9800; background: #FFF3E0; padding: 8px; border: 1px solid #FFB74D; border-radius: 4px;",s)}return!1}async _handleInNode(e,t){try{const s=`https://api.telegram.org/bot${this.botToken}/sendMessage`,n=JSON.stringify({chat_id:this.chatId,text:e,parse_mode:this.parseMode,disable_notification:this.disableNotification,disable_web_page_preview:this.disableWebPagePreview}),i=await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:n})).json();return i.ok?!0:(console.error("TelegramHandler: Failed to send message",i),!1)}catch(s){return console.error("TelegramHandler: Error sending message",s),!1}}async _handleFallback(e){return console.log("TelegramHandler (fallback):",e),!1}updateSettings(e){return e.botToken&&(this.botToken=e.botToken),e.chatId&&(this.chatId=e.chatId),e.parseMode&&(this.parseMode=e.parseMode),e.disableNotification!==void 0&&(this.disableNotification=e.disableNotification),e.disableWebPagePreview!==void 0&&(this.disableWebPagePreview=e.disableWebPagePreview),e.warnInBrowser!==void 0&&(this.warnInBrowser=e.warnInBrowser),this}getEnvironment(){return this.environment}async testConnection(){if(this.environment==="browser")return console.warn("TelegramHandler: Cannot test connection in browser environment"),!1;try{const e=`https://api.telegram.org/bot${this.botToken}/getMe`;return(await(await fetch(e)).json()).ok===!0}catch(e){return console.error("TelegramHandler: Test connection failed",e),!1}}}var yh=Object.defineProperty,bh=a((r,e)=>yh(r,"name",{value:e,configurable:!0}),"n$d");class Js{static{a(this,"AbstractLogger")}static{bh(this,"AbstractLogger")}async debug(e,t){return this.log(H.DEBUG,e,t)}async info(e,t){return this.log(H.INFO,e,t)}async notice(e,t){return this.log(H.NOTICE,e,t)}async warning(e,t){return this.log(H.WARNING,e,t)}async error(e,t){return this.log(H.ERROR,e,t)}async critical(e,t){return this.log(H.CRITICAL,e,t)}async alert(e,t){return this.log(H.ALERT,e,t)}async emergency(e,t){return this.log(H.EMERGENCY,e,t)}}var _h=Object.defineProperty,wh=a((r,e)=>_h(r,"name",{value:e,configurable:!0}),"r$h");class cr extends Js{static{a(this,"NullLogger")}static{wh(this,"NullLogger")}static create(){return new cr}async log(e,t,s){}}var Sh=Object.defineProperty,vh=a((r,e)=>Sh(r,"name",{value:e,configurable:!0}),"o$n");class lr extends Js{static{a(this,"Logger")}static{vh(this,"Logger")}channel;handlers=[];processors=[];constructor(e){super(),this.channel=e}static create(e){return new lr(e)}pushHandler(e){return this.handlers.push(e),this}popHandler(){return this.handlers.pop()||null}setHandlers(e){return this.handlers=e,this}pushProcessor(e){return this.processors.push(e),this}async log(e,t,s){let n={channel:this.channel,level:e,levelName:H[e],message:t,context:s??{},extra:{},timestamp:new Date};for(const i of this.processors)n=i(n);for(const i of this.handlers)if(i.isHandling(e)&&await i.handle(n)&&!i.shouldBubble())break}}var Eh=Object.defineProperty,Oh=a((r,e)=>Eh(r,"name",{value:e,configurable:!0}),"t$8");class ee{static{a(this,"LoggerFactory")}static{Oh(this,"LoggerFactory")}static createNullLogger(){return cr.create()}static createForBrowser(e,t=!1){return t?ee.createForBrowserDevelopment(e):ee.createForBrowserProduction(e)}static createForBrowserDevelopment(e,t=H.DEBUG){const s=new lr(e),n=new zs(t);return s.pushHandler(n),s}static createForBrowserProduction(e,t=H.ERROR){const s=new lr(e),n=new zs(t);return s.pushHandler(n),s}static async forcedLog(e,t,s,n){if(!(typeof globalThis<"u"&&"vitest"in globalThis)){if(e instanceof cr)switch(t){case"debug":console.log(s,n);return;case"info":case"notice":console.info(s,n);return;case"warning":console.warn(s,n);return;default:console.error(s,n);return}return e[t](s,n)}}}var Th=Object.defineProperty,kh=a((r,e)=>Th(r,"name",{value:e,configurable:!0}),"t$7");const Te="@deprecate: use Logger. https://bitrix24.github.io/b24jssdk/docs/working-with-the-rest-api/logger/";var vo=(r=>(r.desktop="desktop",r.log="log",r.info="info",r.warn="warn",r.error="error",r.trace="trace",r))(vo||{});class Gs{static{a(this,"LoggerBrowser")}static{kh(this,"LoggerBrowser")}#e;static build(e,t=!1){return new Gs(e,t)}constructor(e,t=!1){console.warn(Te),t?this.#e=ee.createForBrowserDevelopment(e):this.#e=ee.createForBrowserProduction(e)}setConfig(e){console.warn(Te)}enable(e){return console.warn(Te),!0}disable(e){return console.warn(Te),!0}isEnabled(e){return console.warn(Te),!1}async desktop(...e){console.warn(Te);const t={needDesktop:!0,params:{...e}};return this.#e.debug("desktop",t)}async log(...e){console.warn(Te);const t={params:{...e}};return this.#e.debug("log",t)}async info(...e){console.warn(Te);const t={params:{...e}};return this.#e.info("info",t)}async warn(...e){console.warn(Te);const t={params:{...e}};return this.#e.warning("warn",t)}async error(...e){console.warn(Te);const t={params:{...e}};return this.#e.error("error",t)}async trace(...e){console.warn(Te);const t={needTrace:!0,params:{...e}};return this.#e.debug("trace",t)}async debug(...e){console.warn(Te);const t={params:{...e}};return this.#e.debug("debug",t)}async notice(...e){console.warn(Te);const t={params:{...e}};return this.#e.info("notice",t)}async warning(...e){console.warn(Te);const t={params:{...e}};return this.#e.warning("warning",t)}async critical(...e){console.warn(Te);const t={params:{...e}};return this.#e.critical("critical",t)}async alert(...e){console.warn(Te);const t={params:{...e}};return this.#e.alert("alert",t)}async emergency(...e){console.warn(Te);const t={params:{...e}};return this.#e.emergency("alert",t)}}var Eo=(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))(Eo||{}),Ih=Object.defineProperty,Ah=a((r,e)=>Ih(r,"name",{value:e,configurable:!0}),"o$l");const Rh=Function.prototype.toString.call(Object);let Ch=class{static{a(this,"y")}static{Ah(this,"TypeManager")}getTag(e){return Object.prototype.toString.call(e)}isString(e){return typeof e=="string"||e instanceof String}isStringFilled(e){return this.isString(e)&&e!==""}isFunction(e){return e===null?!1:typeof e=="function"||e instanceof Function}isObject(e){return!!e&&(typeof e=="object"||typeof e=="function")}isObjectLike(e){return!!e&&typeof e=="object"}isPlainObject(e){if(!this.isObjectLike(e)||this.getTag(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const s=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof s=="function"&&Function.prototype.toString.call(s)===Rh}isJsonRpcRequest(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"method"in e&&this.isStringFilled(e.method)}isJsonRpcResponse(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"id"in e&&("result"in e||"error"in e)}isBoolean(e){return e===!0||e===!1}isNumber(e){return typeof e=="number"&&!Number.isNaN(e)}isInteger(e){return Number.isInteger(e)}isFloat(e){return this.isNumber(e)&&!this.isInteger(e)}isNil(e){return e==null}isArray(e){return!this.isNil(e)&&Array.isArray(e)}isArrayFilled(e){return this.isArray(e)&&e.length>0}isArrayLike(e){return!this.isNil(e)&&!this.isFunction(e)&&e.length>-1&&e.length<=Number.MAX_SAFE_INTEGER}isDate(e){return e instanceof Date}isDomNode(e){return this.isObjectLike(e)&&!this.isPlainObject(e)&&"nodeType"in e}isElementNode(e){return this.isDomNode(e)&&e.nodeType===Node.ELEMENT_NODE}isTextNode(e){return this.isDomNode(e)&&e.nodeType===Node.TEXT_NODE}isMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Map]"}isSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Set]"}isWeakMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakMap]"}isWeakSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakSet]"}isPrototype(e){return(typeof(e&&e.constructor)=="function"&&e.constructor.prototype||Object.prototype)===e}isRegExp(e){return this.isObjectLike(e)&&this.getTag(e)==="[object RegExp]"}isNull(e){return e===null}isUndefined(e){return typeof e>"u"}isArrayBuffer(e){return this.isObjectLike(e)&&this.getTag(e)==="[object ArrayBuffer]"}isTypedArray(e){const t=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)\]$/;return this.isObjectLike(e)&&t.test(this.getTag(e))}isBlob(e){return this.isObjectLike(e)&&this.isNumber(e.size)&&this.isString(e.type)&&this.isFunction(e.slice)}isFile(e){return this.isBlob(e)&&this.isString(e.name)&&(this.isNumber(e.lastModified)||this.isObjectLike(e.lastModifiedDate))}isFormData(e){return typeof FormData<"u"&&e instanceof FormData?!0:this.isObjectLike(e)&&this.getTag(e)==="[object FormData]"}clone(e,t=!0){let s,n,i;if(this.isNil(e)||typeof e!="object")return e;if(this.isDomNode(e))s=e.cloneNode(t);else if(typeof e=="object")if(this.isArray(e))for(s=[],n=0,i=e.length;n<i;n++)typeof e[n]=="object"&&t?s[n]=this.clone(e[n],t):s[n]=e[n];else{s={},e.constructor&&(this.isDate(e)?s=new Date(e):s=new e.constructor);for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(typeof e[n]=="object"&&t?s[n]=this.clone(e[n],t):s[n]=e[n])}else s=e;return s}};const P=new Ch;var Nh=Object.defineProperty,Vr=a((r,e)=>Nh(r,"name",{value:e,configurable:!0}),"r$g");function Oo(r,e){const t={};for(const s of e)t[s]=r[s];return t}a(Oo,"pick"),Vr(Oo,"pick");function Ys(r,e){const t={...r};for(const s of e)delete t[s];return t}a(Ys,"omit"),Vr(Ys,"omit");function To(r){return Array.isArray(r[0])}a(To,"isArrayOfArray"),Vr(To,"isArrayOfArray");function ko(r,e){return Object.values(r).includes(e)?e:void 0}a(ko,"getEnumValue"),Vr(ko,"getEnumValue");var Dh=Object.defineProperty,Io=a((r,e)=>Dh(r,"name",{value:e,configurable:!0}),"i$i");const ke=[];for(let r=0;r<256;++r)ke.push((r+256).toString(16).slice(1));function Ao(r,e,t,s){return()=>{r|=0,e|=0,t|=0,s|=0;const n=(r+e|0)+s|0;return s=s+1|0,r=e^e>>>9,e=t+(t<<3)|0,t=(t<<21|t>>>11)+n|0,n>>>0}}a(Ao,"m$7"),Io(Ao,"sfc32");function Ro(){const r=new Uint8Array(16),e=BigInt(Date.now()),t=BigInt(Math.floor(performance.now()*1e3)%65535),s=e<<16n|t;r[0]=Number(s>>40n&0xFFn),r[1]=Number(s>>32n&0xFFn),r[2]=Number(s>>24n&0xFFn),r[3]=Number(s>>16n&0xFFn),r[4]=Number(s>>8n&0xFFn),r[5]=Number(s&0xFFn);const n=(Math.random()*4294967295^Date.now()^performance.now())>>>0,i=Ao(2654435769,608135816,3084996962,n),c=new DataView(r.buffer);return c.setUint32(6,i()),c.setUint32(10,i()),c.setUint16(14,i()),r[6]=112|r[6]&15,r[8]=128|r[8]&63,(ke[r[0]]+ke[r[1]]+ke[r[2]]+ke[r[3]]+"-"+ke[r[4]]+ke[r[5]]+"-"+ke[r[6]]+ke[r[7]]+"-"+ke[r[8]]+ke[r[9]]+"-"+ke[r[10]]+ke[r[11]]+ke[r[12]]+ke[r[13]]+ke[r[14]]+ke[r[15]]).toLowerCase()}a(Ro,"a$k"),Io(Ro,"uuidv7");var Mh=Object.defineProperty,Co=a((r,e)=>Mh(r,"name",{value:e,configurable:!0}),"u$8");const Ph=/[&<>'"]/g,Lh=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g,Fh={"&":"&","<":"<",">":">","'":"'",'"':"""},xh={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","&apos":"'","'":"'",""":'"',""":'"'};class $h{static{a(this,"F")}static{Co(this,"TextManager")}getRandom(e=8){return[...Array(e)].map(()=>Math.trunc(Math.random()*36).toString(36)).join("")}getUniqId(){return"xxxxxxxx-xlsx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.trunc(Math.random()*16);return(e==="x"?t:t&3|8).toString(16)})}getUuidRfc4122(){return Ro()}encode(e){return P.isString(e)?e.replace(Ph,t=>Fh[t]):e}decode(e){return P.isString(e)?e.replace(Lh,t=>xh[t]):e}toNumber(e){const t=Number.parseFloat(e);return P.isNumber(t)?t:0}toInteger(e){return this.toNumber(Number.parseInt(e,10))}toBoolean(e,t=[]){const s=P.isString(e)?e.toLowerCase():e;return["true","y","1",1,!0,...t].includes(s)}toCamelCase(e){if(!P.isStringFilled(e))return e;const t=/[-_\s]+(.)?/g;return t.test(e)?(e=e.toLowerCase(),e=e.replace(t,(s,n)=>n?n.toUpperCase():""),e[0].toLowerCase()+e.substring(1)):e.match(/^[A-Z]+$/)?e.toLowerCase():e[0].toLowerCase()+e.slice(1)}toPascalCase(e){return P.isStringFilled(e)?this.capitalize(this.toCamelCase(e)):e}toKebabCase(e){if(!P.isStringFilled(e))return e;const t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+\d*|\b)|[A-Z]?[a-z]+\d*|[A-Z]|\d+/g);return t?t.map(s=>s.toLowerCase()).join("-"):e}capitalize(e){return P.isStringFilled(e)?e[0].toUpperCase()+e.substring(1):e}numberFormat(e,t=0,s=".",n=","){const i=Number.isFinite(e)?e:0,c=Number.isFinite(t)?Math.abs(t):0,o=(c?Co((u,h)=>{const l=Math.pow(10,h);return Math.round(u*l)/l},"toFixedFix")(i,c):Math.round(i)).toString().split(".");return o[0]&&o[0].length>3&&(o[0]=o[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,n)),(o[1]||"").length<c&&(o[1]=o[1]||"",o[1]+=new Array(c-o[1].length+1).join("0")),o.join(s)}toDateTime(e,t,s){return!(typeof t>"u")&&P.isStringFilled(t)?V.fromFormat(e,t,s):V.fromISO(e,s)}toB24Format(e){return typeof e=="string"?e:e instanceof Date?this.toB24Format(V.fromJSDate(e)):e.toFormat("yyyy-MM-dd'T'HH:mm:ssZZ")}getDateForLog(){return V.now().toFormat("y-MM-dd HH:mm:ss")}buildQueryString(e){let t="";for(const s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const n=e[s];P.isArray(n)?n.forEach((i,c)=>{t+=encodeURIComponent(s+"["+c+"]")+"="+encodeURIComponent(i)+"&"}):t+=encodeURIComponent(s)+"="+encodeURIComponent(n)+"&"}return t.length>0&&(t=t.substring(0,t.length-1)),t}}const z=new $h;var jh=Object.defineProperty,Bh=a((r,e)=>jh(r,"name",{value:e,configurable:!0}),"s$o");let Ee="";try{Ee=navigator?.userAgent.toLowerCase()}catch{Ee="?"}let Uh=class{static{a(this,"u")}static{Bh(this,"BrowserManager")}isOpera(){return Ee.includes("opera")}isIE(){return"attachEvent"in document&&!this.isOpera()}isIE6(){return Ee.includes("msie 6")}isIE7(){return Ee.includes("msie 7")}isIE8(){return Ee.includes("msie 8")}isIE9(){return"documentMode"in document&&document?.documentMode>=9}isIE10(){return"documentMode"in document&&document?.documentMode>=10}isSafari(){return Ee.includes("safari")&&!Ee.includes("chrome")}isFirefox(){return Ee.includes("firefox")}isChrome(){return Ee.includes("chrome")}detectIEVersion(){if(this.isOpera()||this.isSafari()||this.isFirefox()||this.isChrome())return-1;let e=-1;if(window.MSStream&&!window.ActiveXObject&&"ActiveXObject"in window?e=11:this.isIE10()?e=10:this.isIE9()?e=9:this.isIE()&&(e=8),e===-1||e===8){if(navigator.appName==="Microsoft Internet Explorer"){const t=/MSIE (\d[.0-9]*)/,s=navigator.userAgent.match(t);P.isArrayLike(s)&&s.length>0&&(e=Number.parseFloat(s[1]))}if(navigator.appName==="Netscape"){e=11;const t=/Trident\/.*rv:(\d[.0-9]*)/;if(t.exec(navigator.userAgent)!=null){const s=navigator.userAgent.match(t);P.isArrayLike(s)&&s.length>0&&(e=Number.parseFloat(s[1]))}}}return e}isIE11(){return this.detectIEVersion()>=11}isMac(){return Ee.includes("macintosh")}isWin(){return Ee.includes("windows")}isLinux(){return Ee.includes("linux")&&!this.isAndroid()}isAndroid(){return Ee.includes("android")}isIPad(){return Ee.includes("ipad;")||this.isMac()&&this.isTouchDevice()}isIPhone(){return Ee.includes("iphone;")}isIOS(){return this.isIPad()||this.isIPhone()}isMobile(){return this.isIPhone()||this.isIPad()||this.isAndroid()||Ee.includes("mobile")||Ee.includes("touch")}isRetina(){return(window.devicePixelRatio&&window.devicePixelRatio>=2)===!0}isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0}isDoctype(e){const t=e||document;return t.compatMode?t.compatMode==="CSS1Compat":t.documentElement&&t.documentElement.clientHeight}isLocalStorageSupported(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch{return!1}}detectAndroidVersion(){const e=/Android (\d[.0-9]*)/;if(e.exec(navigator.userAgent)!=null){const t=navigator.userAgent.match(e);if(P.isArrayLike(t)&&t.length>0)return Number.parseFloat(t[1])}return 0}};const No=new Uh;var K=(r=>(r.v3="v3",r.v2="v2",r))(K||{}),Vh=Object.defineProperty,qh=a((r,e)=>Vh(r,"name",{value:e,configurable:!0}),"R$2"),Do=(r=>(r.undefined="UNDEFINED",r.lead="CRM_LEAD",r.deal="CRM_DEAL",r.contact="CRM_CONTACT",r.company="CRM_COMPANY",r.oldInvoice="CRM_INVOICE",r.invoice="CRM_SMART_INVOICE",r.quote="CRM_QUOTE",r.requisite="CRM_REQUISITE",r.order="ORDER",r))(Do||{}),Qe=(r=>(r[r.undefined=0]="undefined",r[r.lead=1]="lead",r[r.deal=2]="deal",r[r.contact=3]="contact",r[r.company=4]="company",r[r.oldInvoice=5]="oldInvoice",r[r.invoice=31]="invoice",r[r.quote=7]="quote",r[r.requisite=8]="requisite",r[r.order=14]="order",r))(Qe||{}),Zs=(r=>(r.undefined="?",r.lead="L",r.deal="D",r.contact="C",r.company="CO",r.oldInvoice="I",r.invoice="SI",r.quote="Q",r.requisite="RQ",r.order="O",r))(Zs||{});function Mo(r){const e=Qe[r];return Zs[e]||"?"}a(Mo,"getEnumCrmEntityTypeShort"),qh(Mo,"getEnumCrmEntityTypeShort");var Po=(r=>(r[r.undefined=0]="undefined",r[r.absolute=1]="absolute",r[r.percentage=2]="percentage",r))(Po||{}),Lo=(r=>(r[r.undefined=0]="undefined",r[r.product=1]="product",r[r.service=7]="service",r[r.sku=3]="sku",r[r.skuEmpty=6]="skuEmpty",r[r.offer=4]="offer",r[r.offerEmpty=5]="offerEmpty",r))(Lo||{}),Fo=(r=>(r.undefined="UNDEFINED",r.detail="DETAIL_PICTURE",r.preview="PREVIEW_PICTURE",r.morePhoto="MORE_PHOTO",r))(Fo||{}),xo=(r=>(r[r.undefined=0]="undefined",r[r.mathematical=1]="mathematical",r[r.roundingUp=2]="roundingUp",r[r.roundingDown=4]="roundingDown",r))(xo||{}),Wh=Object.defineProperty,qr=a((r,e)=>Wh(r,"name",{value:e,configurable:!0}),"u$6"),$o=(r=>(r.undefined="undefined",r.b24="b24",r.box="box",r))($o||{}),jo=(r=>(r.undefined="undefined",r.crm="crm",r.disk="disk",r.lists="lists",r))(jo||{}),Bo=(r=>(r.undefined="undefined",r.lead="CCrmDocumentLead",r.company="CCrmDocumentCompany",r.contact="CCrmDocumentContact",r.deal="CCrmDocumentDeal",r.invoice="Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice",r.quote="Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote",r.order="Bitrix\\Crm\\Integration\\BizProc\\Document\\Order",r.dynamic="Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic",r.disk="Bitrix\\Disk\\BizProcDocument",r.lists="BizprocDocument",r.listsList="Bitrix\\Lists\\BizprocDocumentLists",r))(Bo||{});function Uo(r){switch(r){case"CCrmDocumentLead":return Qe.lead;case"CCrmDocumentCompany":return Qe.company;case"CCrmDocumentContact":return Qe.contact;case"CCrmDocumentDeal":return Qe.deal;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":return Qe.invoice;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":return Qe.quote;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":return Qe.order}return Qe.undefined}a(Uo,"convertBizprocDocumentTypeToCrmEntityTypeId"),qr(Uo,"convertBizprocDocumentTypeToCrmEntityTypeId");function Wr(r,e){let t="",s="undefined";switch(r){case"CCrmDocumentLead":s="crm",t="LEAD";break;case"CCrmDocumentCompany":s="crm",t="COMPANY";break;case"CCrmDocumentContact":s="crm",t="CONTACT";break;case"CCrmDocumentDeal":s="crm",t="DEAL";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":s="crm",t="SMART_INVOICE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":s="crm",t="QUOTE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":s="crm",t="ORDER";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(s="crm",t=`DYNAMIC_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Disk\\BizProcDocument":if(s="disk",t=`STORAGE_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"BizprocDocument":if(s="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Lists\\BizprocDocumentLists":if(s="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break}return[s,r,t]}a(Wr,"getDocumentType"),qr(Wr,"getDocumentType");function Vo(r,e,t){let s="";const n=Wr(r,1);switch(r){case"CCrmDocumentLead":s=`LEAD_${e}`;break;case"CCrmDocumentCompany":s=`COMPANY_${e}`;break;case"CCrmDocumentContact":s=`CONTACT_${e}`;break;case"CCrmDocumentDeal":s=`DEAL_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":s=`SMART_INVOICE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":s=`QUOTE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":s=`ORDER_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(s=`DYNAMIC_${t||0}_${e}`,(t||0)<1)throw new Error("Need set dynamicId");break;case"Bitrix\\Disk\\BizProcDocument":s=`${e}`;break;case"BizprocDocument":s=`${e}`;break;case"Bitrix\\Lists\\BizprocDocumentLists":s=`${e}`;break}return[n[0],n[1],s]}a(Vo,"getDocumentId"),qr(Vo,"getDocumentId");function qo(r){const e=Wr(r,1);return[e[0],e[1]]}a(qo,"getDocumentTypeForFilter"),qr(qo,"getDocumentTypeForFilter");var le=(r=>(r.App="app",r.Profile="profile",r.Currency="currency",r.AppOptions="appOptions",r.UserOptions="userOptions",r))(le||{});const lt={Free:"F",Demo:"D",Trial:"T",Paid:"P",Local:"L",Subscription:"S"},Wo={[lt.Free]:"Free",[lt.Demo]:"Demo",[lt.Trial]:"Trial",[lt.Paid]:"Paid",[lt.Local]:"Local",[lt.Subscription]:"Subscription"},kt={MainSettings:"MainSettings",UfList:"UfList",UfPage:"UfPage"};var ut=(r=>(r.NotSet="notSet",r.JsonArray="jsonArray",r.JsonObject="jsonObject",r.FloatVal="float",r.IntegerVal="integer",r.BoolYN="boolYN",r.StringVal="string",r))(ut||{}),he=(r=>(r.Undefined="undefined",r.WebSocket="webSocket",r.LongPolling="longPolling",r))(he||{}),Ue=(r=>(r.PullConfig="bx-pull-config",r.WebsocketBlocked="bx-pull-websocket-blocked",r.LongPollingBlocked="bx-pull-longpolling-blocked",r.LoggingEnabled="bx-pull-logging-enabled",r))(Ue||{}),Ve=(r=>(r.Online="online",r.Offline="offline",r.Connecting="connect",r))(Ve||{}),Hr=(r=>(r[r.Unknown=0]="Unknown",r[r.Client=1]="Client",r[r.Backend=2]="Backend",r))(Hr||{}),qe=(r=>(r.Server="server",r.Client="client",r.Online="online",r.Status="status",r.Revision="revision",r))(qe||{}),Re=(r=>(r[r.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",r[r.SERVER_DIE=1001]="SERVER_DIE",r[r.CONFIG_REPLACED=3e3]="CONFIG_REPLACED",r[r.CHANNEL_EXPIRED=3001]="CHANNEL_EXPIRED",r[r.SERVER_RESTARTED=3002]="SERVER_RESTARTED",r[r.CONFIG_EXPIRED=3003]="CONFIG_EXPIRED",r[r.MANUAL=3004]="MANUAL",r[r.STUCK=3005]="STUCK",r[r.WRONG_CHANNEL_ID=4010]="WRONG_CHANNEL_ID",r))(Re||{}),ur=(r=>(r.CHANNEL_EXPIRE="CHANNEL_EXPIRE",r.CONFIG_EXPIRE="CONFIG_EXPIRE",r.SERVER_RESTART="SERVER_RESTART",r))(ur||{}),Ks=(r=>(r.Shared="shared",r.Personal="personal",r))(Ks||{});const Xs={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||{}),Qs=(r=>(r.ru="ru",r.id="id",r.ms="ms",r.de="de",r.en="en",r.la="la",r.fr="fr",r.in="in",r.it="it",r.pl="pl",r.br="br",r.vn="vn",r.tr="tr",r.kz="kz",r.ua="ua",r.ar="ar",r.th="th",r.sc="sc",r.tc="tc",r.ja="ja",r))(Qs||{});const Hh={ru:"ru-RU",id:"id-ID",ms:"ms-MY",de:"de-DE",en:"en-EN",la:"es-ES",fr:"fr-FR",in:"hi-IN",it:"it-IT",pl:"pl-PL",br:"pt-BR",vn:"vi-VN",tr:"tr-TR",kz:"kk",ua:"uk-UA",ar:"ar-SA",th:"th-TH",sc:"zh-CN",tc:"zh-TW",ja:"ja-JP"};var zh=Object.defineProperty,Jh=a((r,e)=>zh(r,"name",{value:e,configurable:!0}),"s$n");class Pe{static{a(this,"Result")}static{Jh(this,"Result")}_errors;_data;constructor(e){this._errors=new Map,this._data=e??null}get isSuccess(){return this._errors.size===0}get errors(){return this._errors}setData(e){return this._data=e,this}getData(){return this._data}addError(e,t){const s=t??z.getUuidRfc4122(),n=typeof e=="string"?new Error(e):e;return this._errors.set(s,n),this}addErrors(e){for(const t of e)this.addError(t);return this}getErrors(){return this._errors.values()}hasError(e){return this._errors.has(e)}getErrorMessages(){return Array.from(this._errors.values(),e=>e.message)}toString(){const e=this.isSuccess?"success":"failure",t=this.safeStringify(this._data);return this.isSuccess?`Result(${e}): ${t}`:`Result(${e}): ${t}
|
|
31
|
-
Errors: ${this.getErrorMessages().join(", ")}`}safeStringify(e){try{return JSON.stringify(e,this.replacer,2)}catch{return"[Unable to serialize data]"}}replacer(e,t){return t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t}static ok(e){return new
|
|
30
|
+
If you need to send logs from browser, use a proxy server.`;console.warn(s),console.log("%cTelegram Handler Warning","color: #FF9800; background: #FFF3E0; padding: 8px; border: 1px solid #FFB74D; border-radius: 4px;",s)}return!1}async _handleInNode(e,t){try{const s=`https://api.telegram.org/bot${this.botToken}/sendMessage`,n=JSON.stringify({chat_id:this.chatId,text:e,parse_mode:this.parseMode,disable_notification:this.disableNotification,disable_web_page_preview:this.disableWebPagePreview}),i=await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:n})).json();return i.ok?!0:(console.error("TelegramHandler: Failed to send message",i),!1)}catch(s){return console.error("TelegramHandler: Error sending message",s),!1}}async _handleFallback(e){return console.log("TelegramHandler (fallback):",e),!1}updateSettings(e){return e.botToken&&(this.botToken=e.botToken),e.chatId&&(this.chatId=e.chatId),e.parseMode&&(this.parseMode=e.parseMode),e.disableNotification!==void 0&&(this.disableNotification=e.disableNotification),e.disableWebPagePreview!==void 0&&(this.disableWebPagePreview=e.disableWebPagePreview),e.warnInBrowser!==void 0&&(this.warnInBrowser=e.warnInBrowser),this}getEnvironment(){return this.environment}async testConnection(){if(this.environment==="browser")return console.warn("TelegramHandler: Cannot test connection in browser environment"),!1;try{const e=`https://api.telegram.org/bot${this.botToken}/getMe`;return(await(await fetch(e)).json()).ok===!0}catch(e){return console.error("TelegramHandler: Test connection failed",e),!1}}}var yh=Object.defineProperty,bh=a((r,e)=>yh(r,"name",{value:e,configurable:!0}),"n$e");class Ys{static{a(this,"AbstractLogger")}static{bh(this,"AbstractLogger")}async debug(e,t){return this.log(z.DEBUG,e,t)}async info(e,t){return this.log(z.INFO,e,t)}async notice(e,t){return this.log(z.NOTICE,e,t)}async warning(e,t){return this.log(z.WARNING,e,t)}async error(e,t){return this.log(z.ERROR,e,t)}async critical(e,t){return this.log(z.CRITICAL,e,t)}async alert(e,t){return this.log(z.ALERT,e,t)}async emergency(e,t){return this.log(z.EMERGENCY,e,t)}}var _h=Object.defineProperty,wh=a((r,e)=>_h(r,"name",{value:e,configurable:!0}),"r$i");class hr extends Ys{static{a(this,"NullLogger")}static{wh(this,"NullLogger")}static create(){return new hr}async log(e,t,s){}}var Sh=Object.defineProperty,vh=a((r,e)=>Sh(r,"name",{value:e,configurable:!0}),"o$n");class dr extends Ys{static{a(this,"Logger")}static{vh(this,"Logger")}channel;handlers=[];processors=[];constructor(e){super(),this.channel=e}static create(e){return new dr(e)}pushHandler(e){return this.handlers.push(e),this}popHandler(){return this.handlers.pop()||null}setHandlers(e){return this.handlers=e,this}pushProcessor(e){return this.processors.push(e),this}async log(e,t,s){let n={channel:this.channel,level:e,levelName:z[e],message:t,context:s??{},extra:{},timestamp:new Date};for(const i of this.processors)n=i(n);for(const i of this.handlers)if(i.isHandling(e)&&await i.handle(n)&&!i.shouldBubble())break}}var Eh=Object.defineProperty,Oh=a((r,e)=>Eh(r,"name",{value:e,configurable:!0}),"t$8");class te{static{a(this,"LoggerFactory")}static{Oh(this,"LoggerFactory")}static createNullLogger(){return hr.create()}static createForBrowser(e,t=!1){return t?te.createForBrowserDevelopment(e):te.createForBrowserProduction(e)}static createForBrowserDevelopment(e,t=z.DEBUG){const s=new dr(e),n=new Gs(t);return s.pushHandler(n),s}static createForBrowserProduction(e,t=z.ERROR){const s=new dr(e),n=new Gs(t);return s.pushHandler(n),s}static async forcedLog(e,t,s,n){if(!(typeof globalThis<"u"&&"vitest"in globalThis)){if(e instanceof hr)switch(t){case"debug":console.log(s,n);return;case"info":case"notice":console.info(s,n);return;case"warning":console.warn(s,n);return;default:console.error(s,n);return}return e[t](s,n)}}}var Th=Object.defineProperty,kh=a((r,e)=>Th(r,"name",{value:e,configurable:!0}),"t$7");const Ie="@deprecate: use Logger. https://bitrix24.github.io/b24jssdk/docs/working-with-the-rest-api/logger/";var ko=(r=>(r.desktop="desktop",r.log="log",r.info="info",r.warn="warn",r.error="error",r.trace="trace",r))(ko||{});class Ks{static{a(this,"LoggerBrowser")}static{kh(this,"LoggerBrowser")}#e;static build(e,t=!1){return new Ks(e,t)}constructor(e,t=!1){console.warn(Ie),t?this.#e=te.createForBrowserDevelopment(e):this.#e=te.createForBrowserProduction(e)}setConfig(e){console.warn(Ie)}enable(e){return console.warn(Ie),!0}disable(e){return console.warn(Ie),!0}isEnabled(e){return console.warn(Ie),!1}async desktop(...e){console.warn(Ie);const t={needDesktop:!0,params:{...e}};return this.#e.debug("desktop",t)}async log(...e){console.warn(Ie);const t={params:{...e}};return this.#e.debug("log",t)}async info(...e){console.warn(Ie);const t={params:{...e}};return this.#e.info("info",t)}async warn(...e){console.warn(Ie);const t={params:{...e}};return this.#e.warning("warn",t)}async error(...e){console.warn(Ie);const t={params:{...e}};return this.#e.error("error",t)}async trace(...e){console.warn(Ie);const t={needTrace:!0,params:{...e}};return this.#e.debug("trace",t)}async debug(...e){console.warn(Ie);const t={params:{...e}};return this.#e.debug("debug",t)}async notice(...e){console.warn(Ie);const t={params:{...e}};return this.#e.info("notice",t)}async warning(...e){console.warn(Ie);const t={params:{...e}};return this.#e.warning("warning",t)}async critical(...e){console.warn(Ie);const t={params:{...e}};return this.#e.critical("critical",t)}async alert(...e){console.warn(Ie);const t={params:{...e}};return this.#e.alert("alert",t)}async emergency(...e){console.warn(Ie);const t={params:{...e}};return this.#e.emergency("alert",t)}}var Io=(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))(Io||{}),Ih=Object.defineProperty,Ah=a((r,e)=>Ih(r,"name",{value:e,configurable:!0}),"o$l");const Rh=Function.prototype.toString.call(Object);let Ch=class{static{a(this,"y")}static{Ah(this,"TypeManager")}getTag(e){return Object.prototype.toString.call(e)}isString(e){return typeof e=="string"||e instanceof String}isStringFilled(e){return this.isString(e)&&e!==""}isFunction(e){return e===null?!1:typeof e=="function"||e instanceof Function}isObject(e){return!!e&&(typeof e=="object"||typeof e=="function")}isObjectLike(e){return!!e&&typeof e=="object"}isPlainObject(e){if(!this.isObjectLike(e)||this.getTag(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const s=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof s=="function"&&Function.prototype.toString.call(s)===Rh}isJsonRpcRequest(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"method"in e&&this.isStringFilled(e.method)}isJsonRpcResponse(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"id"in e&&("result"in e||"error"in e)}isBoolean(e){return e===!0||e===!1}isNumber(e){return typeof e=="number"&&!Number.isNaN(e)}isInteger(e){return Number.isInteger(e)}isFloat(e){return this.isNumber(e)&&!this.isInteger(e)}isNil(e){return e==null}isArray(e){return!this.isNil(e)&&Array.isArray(e)}isArrayFilled(e){return this.isArray(e)&&e.length>0}isArrayLike(e){return!this.isNil(e)&&!this.isFunction(e)&&e.length>-1&&e.length<=Number.MAX_SAFE_INTEGER}isDate(e){return e instanceof Date}isDomNode(e){return this.isObjectLike(e)&&!this.isPlainObject(e)&&"nodeType"in e}isElementNode(e){return this.isDomNode(e)&&e.nodeType===Node.ELEMENT_NODE}isTextNode(e){return this.isDomNode(e)&&e.nodeType===Node.TEXT_NODE}isMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Map]"}isSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Set]"}isWeakMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakMap]"}isWeakSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakSet]"}isPrototype(e){return(typeof(e&&e.constructor)=="function"&&e.constructor.prototype||Object.prototype)===e}isRegExp(e){return this.isObjectLike(e)&&this.getTag(e)==="[object RegExp]"}isNull(e){return e===null}isUndefined(e){return typeof e>"u"}isArrayBuffer(e){return this.isObjectLike(e)&&this.getTag(e)==="[object ArrayBuffer]"}isTypedArray(e){const t=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)\]$/;return this.isObjectLike(e)&&t.test(this.getTag(e))}isBlob(e){return this.isObjectLike(e)&&this.isNumber(e.size)&&this.isString(e.type)&&this.isFunction(e.slice)}isFile(e){return this.isBlob(e)&&this.isString(e.name)&&(this.isNumber(e.lastModified)||this.isObjectLike(e.lastModifiedDate))}isFormData(e){return typeof FormData<"u"&&e instanceof FormData?!0:this.isObjectLike(e)&&this.getTag(e)==="[object FormData]"}clone(e,t=!0){let s,n,i;if(this.isNil(e)||typeof e!="object")return e;if(this.isDomNode(e))s=e.cloneNode(t);else if(typeof e=="object")if(this.isArray(e))for(s=[],n=0,i=e.length;n<i;n++)typeof e[n]=="object"&&t?s[n]=this.clone(e[n],t):s[n]=e[n];else{s={},e.constructor&&(this.isDate(e)?s=new Date(e):s=new e.constructor);for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(typeof e[n]=="object"&&t?s[n]=this.clone(e[n],t):s[n]=e[n])}else s=e;return s}};const P=new Ch;var Nh=Object.defineProperty,Wr=a((r,e)=>Nh(r,"name",{value:e,configurable:!0}),"r$h");function Ao(r,e){const t={};for(const s of e)t[s]=r[s];return t}a(Ao,"pick"),Wr(Ao,"pick");function Zs(r,e){const t={...r};for(const s of e)delete t[s];return t}a(Zs,"omit"),Wr(Zs,"omit");function Ro(r){return Array.isArray(r[0])}a(Ro,"isArrayOfArray"),Wr(Ro,"isArrayOfArray");function Co(r,e){return Object.values(r).includes(e)?e:void 0}a(Co,"getEnumValue"),Wr(Co,"getEnumValue");var Dh=Object.defineProperty,No=a((r,e)=>Dh(r,"name",{value:e,configurable:!0}),"i$j");const Ae=[];for(let r=0;r<256;++r)Ae.push((r+256).toString(16).slice(1));function Do(r,e,t,s){return()=>{r|=0,e|=0,t|=0,s|=0;const n=(r+e|0)+s|0;return s=s+1|0,r=e^e>>>9,e=t+(t<<3)|0,t=(t<<21|t>>>11)+n|0,n>>>0}}a(Do,"m$7"),No(Do,"sfc32");function Lo(){const r=new Uint8Array(16),e=BigInt(Date.now()),t=BigInt(Math.floor(performance.now()*1e3)%65535),s=e<<16n|t;r[0]=Number(s>>40n&0xFFn),r[1]=Number(s>>32n&0xFFn),r[2]=Number(s>>24n&0xFFn),r[3]=Number(s>>16n&0xFFn),r[4]=Number(s>>8n&0xFFn),r[5]=Number(s&0xFFn);const n=(Math.random()*4294967295^Date.now()^performance.now())>>>0,i=Do(2654435769,608135816,3084996962,n),c=new DataView(r.buffer);return c.setUint32(6,i()),c.setUint32(10,i()),c.setUint16(14,i()),r[6]=112|r[6]&15,r[8]=128|r[8]&63,(Ae[r[0]]+Ae[r[1]]+Ae[r[2]]+Ae[r[3]]+"-"+Ae[r[4]]+Ae[r[5]]+"-"+Ae[r[6]]+Ae[r[7]]+"-"+Ae[r[8]]+Ae[r[9]]+"-"+Ae[r[10]]+Ae[r[11]]+Ae[r[12]]+Ae[r[13]]+Ae[r[14]]+Ae[r[15]]).toLowerCase()}a(Lo,"a$i"),No(Lo,"uuidv7");var Lh=Object.defineProperty,Po=a((r,e)=>Lh(r,"name",{value:e,configurable:!0}),"u$7");const Ph=/[&<>'"]/g,Mh=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g,Fh={"&":"&","<":"<",">":">","'":"'",'"':"""},xh={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","&apos":"'","'":"'",""":'"',""":'"'};class $h{static{a(this,"F")}static{Po(this,"TextManager")}getRandom(e=8){return[...Array(e)].map(()=>Math.trunc(Math.random()*36).toString(36)).join("")}getUniqId(){return"xxxxxxxx-xlsx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.trunc(Math.random()*16);return(e==="x"?t:t&3|8).toString(16)})}getUuidRfc4122(){return Lo()}encode(e){return P.isString(e)?e.replace(Ph,t=>Fh[t]):e}decode(e){return P.isString(e)?e.replace(Mh,t=>xh[t]):e}toNumber(e){const t=Number.parseFloat(e);return P.isNumber(t)?t:0}toInteger(e){return this.toNumber(Number.parseInt(e,10))}toBoolean(e,t=[]){const s=P.isString(e)?e.toLowerCase():e;return["true","y","1",1,!0,...t].includes(s)}toCamelCase(e){if(!P.isStringFilled(e))return e;const t=/[-_\s]+(.)?/g;return t.test(e)?(e=e.toLowerCase(),e=e.replace(t,(s,n)=>n?n.toUpperCase():""),e[0].toLowerCase()+e.substring(1)):e.match(/^[A-Z]+$/)?e.toLowerCase():e[0].toLowerCase()+e.slice(1)}toPascalCase(e){return P.isStringFilled(e)?this.capitalize(this.toCamelCase(e)):e}toKebabCase(e){if(!P.isStringFilled(e))return e;const t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+\d*|\b)|[A-Z]?[a-z]+\d*|[A-Z]|\d+/g);return t?t.map(s=>s.toLowerCase()).join("-"):e}capitalize(e){return P.isStringFilled(e)?e[0].toUpperCase()+e.substring(1):e}numberFormat(e,t=0,s=".",n=","){const i=Number.isFinite(e)?e:0,c=Number.isFinite(t)?Math.abs(t):0,o=(c?Po((l,h)=>{const u=Math.pow(10,h);return Math.round(l*u)/u},"toFixedFix")(i,c):Math.round(i)).toString().split(".");return o[0]&&o[0].length>3&&(o[0]=o[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,n)),(o[1]||"").length<c&&(o[1]=o[1]||"",o[1]+=new Array(c-o[1].length+1).join("0")),o.join(s)}toDateTime(e,t,s){return!(typeof t>"u")&&P.isStringFilled(t)?q.fromFormat(e,t,s):q.fromISO(e,s)}toB24Format(e){return typeof e=="string"?e:e instanceof Date?this.toB24Format(q.fromJSDate(e)):e.toFormat("yyyy-MM-dd'T'HH:mm:ssZZ")}getDateForLog(){return q.now().toFormat("y-MM-dd HH:mm:ss")}buildQueryString(e){let t="";for(const s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const n=e[s];P.isArray(n)?n.forEach((i,c)=>{t+=encodeURIComponent(s+"["+c+"]")+"="+encodeURIComponent(i)+"&"}):t+=encodeURIComponent(s)+"="+encodeURIComponent(n)+"&"}return t.length>0&&(t=t.substring(0,t.length-1)),t}}const J=new $h;var Bh=Object.defineProperty,jh=a((r,e)=>Bh(r,"name",{value:e,configurable:!0}),"s$o");let Te="";try{Te=navigator?.userAgent.toLowerCase()}catch{Te="?"}let Uh=class{static{a(this,"u")}static{jh(this,"BrowserManager")}isOpera(){return Te.includes("opera")}isIE(){return"attachEvent"in document&&!this.isOpera()}isIE6(){return Te.includes("msie 6")}isIE7(){return Te.includes("msie 7")}isIE8(){return Te.includes("msie 8")}isIE9(){return"documentMode"in document&&document?.documentMode>=9}isIE10(){return"documentMode"in document&&document?.documentMode>=10}isSafari(){return Te.includes("safari")&&!Te.includes("chrome")}isFirefox(){return Te.includes("firefox")}isChrome(){return Te.includes("chrome")}detectIEVersion(){if(this.isOpera()||this.isSafari()||this.isFirefox()||this.isChrome())return-1;let e=-1;if(window.MSStream&&!window.ActiveXObject&&"ActiveXObject"in window?e=11:this.isIE10()?e=10:this.isIE9()?e=9:this.isIE()&&(e=8),e===-1||e===8){if(navigator.appName==="Microsoft Internet Explorer"){const t=/MSIE (\d[.0-9]*)/,s=navigator.userAgent.match(t);P.isArrayLike(s)&&s.length>0&&(e=Number.parseFloat(s[1]))}if(navigator.appName==="Netscape"){e=11;const t=/Trident\/.*rv:(\d[.0-9]*)/;if(t.exec(navigator.userAgent)!=null){const s=navigator.userAgent.match(t);P.isArrayLike(s)&&s.length>0&&(e=Number.parseFloat(s[1]))}}}return e}isIE11(){return this.detectIEVersion()>=11}isMac(){return Te.includes("macintosh")}isWin(){return Te.includes("windows")}isLinux(){return Te.includes("linux")&&!this.isAndroid()}isAndroid(){return Te.includes("android")}isIPad(){return Te.includes("ipad;")||this.isMac()&&this.isTouchDevice()}isIPhone(){return Te.includes("iphone;")}isIOS(){return this.isIPad()||this.isIPhone()}isMobile(){return this.isIPhone()||this.isIPad()||this.isAndroid()||Te.includes("mobile")||Te.includes("touch")}isRetina(){return(window.devicePixelRatio&&window.devicePixelRatio>=2)===!0}isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0}isDoctype(e){const t=e||document;return t.compatMode?t.compatMode==="CSS1Compat":t.documentElement&&t.documentElement.clientHeight}isLocalStorageSupported(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch{return!1}}detectAndroidVersion(){const e=/Android (\d[.0-9]*)/;if(e.exec(navigator.userAgent)!=null){const t=navigator.userAgent.match(e);if(P.isArrayLike(t)&&t.length>0)return Number.parseFloat(t[1])}return 0}};const Mo=new Uh;var X=(r=>(r.v3="v3",r.v2="v2",r))(X||{}),Vh=Object.defineProperty,qh=a((r,e)=>Vh(r,"name",{value:e,configurable:!0}),"R$2"),Fo=(r=>(r.undefined="UNDEFINED",r.lead="CRM_LEAD",r.deal="CRM_DEAL",r.contact="CRM_CONTACT",r.company="CRM_COMPANY",r.oldInvoice="CRM_INVOICE",r.invoice="CRM_SMART_INVOICE",r.quote="CRM_QUOTE",r.requisite="CRM_REQUISITE",r.order="ORDER",r))(Fo||{}),Qe=(r=>(r[r.undefined=0]="undefined",r[r.lead=1]="lead",r[r.deal=2]="deal",r[r.contact=3]="contact",r[r.company=4]="company",r[r.oldInvoice=5]="oldInvoice",r[r.invoice=31]="invoice",r[r.quote=7]="quote",r[r.requisite=8]="requisite",r[r.order=14]="order",r))(Qe||{}),Xs=(r=>(r.undefined="?",r.lead="L",r.deal="D",r.contact="C",r.company="CO",r.oldInvoice="I",r.invoice="SI",r.quote="Q",r.requisite="RQ",r.order="O",r))(Xs||{});function xo(r){const e=Qe[r];return Xs[e]||"?"}a(xo,"getEnumCrmEntityTypeShort"),qh(xo,"getEnumCrmEntityTypeShort");var $o=(r=>(r[r.undefined=0]="undefined",r[r.absolute=1]="absolute",r[r.percentage=2]="percentage",r))($o||{}),Bo=(r=>(r[r.undefined=0]="undefined",r[r.product=1]="product",r[r.service=7]="service",r[r.sku=3]="sku",r[r.skuEmpty=6]="skuEmpty",r[r.offer=4]="offer",r[r.offerEmpty=5]="offerEmpty",r))(Bo||{}),jo=(r=>(r.undefined="UNDEFINED",r.detail="DETAIL_PICTURE",r.preview="PREVIEW_PICTURE",r.morePhoto="MORE_PHOTO",r))(jo||{}),Uo=(r=>(r[r.undefined=0]="undefined",r[r.mathematical=1]="mathematical",r[r.roundingUp=2]="roundingUp",r[r.roundingDown=4]="roundingDown",r))(Uo||{}),Hh=Object.defineProperty,zr=a((r,e)=>Hh(r,"name",{value:e,configurable:!0}),"u$5"),Vo=(r=>(r.undefined="undefined",r.b24="b24",r.box="box",r))(Vo||{}),qo=(r=>(r.undefined="undefined",r.crm="crm",r.disk="disk",r.lists="lists",r))(qo||{}),Ho=(r=>(r.undefined="undefined",r.lead="CCrmDocumentLead",r.company="CCrmDocumentCompany",r.contact="CCrmDocumentContact",r.deal="CCrmDocumentDeal",r.invoice="Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice",r.quote="Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote",r.order="Bitrix\\Crm\\Integration\\BizProc\\Document\\Order",r.dynamic="Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic",r.disk="Bitrix\\Disk\\BizProcDocument",r.lists="BizprocDocument",r.listsList="Bitrix\\Lists\\BizprocDocumentLists",r))(Ho||{});function Wo(r){switch(r){case"CCrmDocumentLead":return Qe.lead;case"CCrmDocumentCompany":return Qe.company;case"CCrmDocumentContact":return Qe.contact;case"CCrmDocumentDeal":return Qe.deal;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":return Qe.invoice;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":return Qe.quote;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":return Qe.order}return Qe.undefined}a(Wo,"convertBizprocDocumentTypeToCrmEntityTypeId"),zr(Wo,"convertBizprocDocumentTypeToCrmEntityTypeId");function Jr(r,e){let t="",s="undefined";switch(r){case"CCrmDocumentLead":s="crm",t="LEAD";break;case"CCrmDocumentCompany":s="crm",t="COMPANY";break;case"CCrmDocumentContact":s="crm",t="CONTACT";break;case"CCrmDocumentDeal":s="crm",t="DEAL";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":s="crm",t="SMART_INVOICE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":s="crm",t="QUOTE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":s="crm",t="ORDER";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(s="crm",t=`DYNAMIC_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Disk\\BizProcDocument":if(s="disk",t=`STORAGE_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"BizprocDocument":if(s="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Lists\\BizprocDocumentLists":if(s="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break}return[s,r,t]}a(Jr,"getDocumentType"),zr(Jr,"getDocumentType");function zo(r,e,t){let s="";const n=Jr(r,1);switch(r){case"CCrmDocumentLead":s=`LEAD_${e}`;break;case"CCrmDocumentCompany":s=`COMPANY_${e}`;break;case"CCrmDocumentContact":s=`CONTACT_${e}`;break;case"CCrmDocumentDeal":s=`DEAL_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":s=`SMART_INVOICE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":s=`QUOTE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":s=`ORDER_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(s=`DYNAMIC_${t||0}_${e}`,(t||0)<1)throw new Error("Need set dynamicId");break;case"Bitrix\\Disk\\BizProcDocument":s=`${e}`;break;case"BizprocDocument":s=`${e}`;break;case"Bitrix\\Lists\\BizprocDocumentLists":s=`${e}`;break}return[n[0],n[1],s]}a(zo,"getDocumentId"),zr(zo,"getDocumentId");function Jo(r){const e=Jr(r,1);return[e[0],e[1]]}a(Jo,"getDocumentTypeForFilter"),zr(Jo,"getDocumentTypeForFilter");var de=(r=>(r.App="app",r.Profile="profile",r.Currency="currency",r.AppOptions="appOptions",r.UserOptions="userOptions",r))(de||{});const lt={Free:"F",Demo:"D",Trial:"T",Paid:"P",Local:"L",Subscription:"S"},Go={[lt.Free]:"Free",[lt.Demo]:"Demo",[lt.Trial]:"Trial",[lt.Paid]:"Paid",[lt.Local]:"Local",[lt.Subscription]:"Subscription"},It={MainSettings:"MainSettings",UfList:"UfList",UfPage:"UfPage"};var ut=(r=>(r.NotSet="notSet",r.JsonArray="jsonArray",r.JsonObject="jsonObject",r.FloatVal="float",r.IntegerVal="integer",r.BoolYN="boolYN",r.StringVal="string",r))(ut||{}),fe=(r=>(r.Undefined="undefined",r.WebSocket="webSocket",r.LongPolling="longPolling",r))(fe||{}),Ve=(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))(Ve||{}),qe=(r=>(r.Online="online",r.Offline="offline",r.Connecting="connect",r))(qe||{}),Gr=(r=>(r[r.Unknown=0]="Unknown",r[r.Client=1]="Client",r[r.Backend=2]="Backend",r))(Gr||{}),He=(r=>(r.Server="server",r.Client="client",r.Online="online",r.Status="status",r.Revision="revision",r))(He||{}),De=(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))(De||{}),fr=(r=>(r.CHANNEL_EXPIRE="CHANNEL_EXPIRE",r.CONFIG_EXPIRE="CONFIG_EXPIRE",r.SERVER_RESTART="SERVER_RESTART",r))(fr||{}),Qs=(r=>(r.Shared="shared",r.Personal="personal",r))(Qs||{});const en={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 nt=(r=>(r.Publish="publish",r.GetUsersLastSeen="getUsersLastSeen",r.Ping="ping",r.ListChannels="listChannels",r.SubscribeStatusChange="subscribeStatusChange",r.UnsubscribeStatusChange="unsubscribeStatusChange",r))(nt||{}),tn=(r=>(r.ru="ru",r.id="id",r.ms="ms",r.de="de",r.en="en",r.la="la",r.fr="fr",r.in="in",r.it="it",r.pl="pl",r.br="br",r.vn="vn",r.tr="tr",r.kz="kz",r.ua="ua",r.ar="ar",r.th="th",r.sc="sc",r.tc="tc",r.ja="ja",r))(tn||{});const Wh={ru:"ru-RU",id:"id-ID",ms:"ms-MY",de:"de-DE",en:"en-EN",la:"es-ES",fr:"fr-FR",in:"hi-IN",it:"it-IT",pl:"pl-PL",br:"pt-BR",vn:"vi-VN",tr:"tr-TR",kz:"kk",ua:"uk-UA",ar:"ar-SA",th:"th-TH",sc:"zh-CN",tc:"zh-TW",ja:"ja-JP"};var zh=Object.defineProperty,Jh=a((r,e)=>zh(r,"name",{value:e,configurable:!0}),"s$n");class Fe{static{a(this,"Result")}static{Jh(this,"Result")}_errors;_data;constructor(e){this._errors=new Map,this._data=e??null}get isSuccess(){return this._errors.size===0}get errors(){return this._errors}setData(e){return this._data=e,this}getData(){return this._data}addError(e,t){const s=t??J.getUuidRfc4122(),n=typeof e=="string"?new Error(e):e;return this._errors.set(s,n),this}addErrors(e){for(const t of e)this.addError(t);return this}getErrors(){return this._errors.values()}hasError(e){return this._errors.has(e)}getErrorMessages(){return Array.from(this._errors.values(),e=>e.message)}getErrorsByKey(){return Object.fromEntries(this._errors)}getErrorMessagesByKey(){return Object.fromEntries(Array.from(this._errors,([e,t])=>[e,t.message]))}toString(){const e=this.isSuccess?"success":"failure",t=this.safeStringify(this._data);return this.isSuccess?`Result(${e}): ${t}`:`Result(${e}): ${t}
|
|
31
|
+
Errors: ${this.getErrorMessages().join(", ")}`}safeStringify(e){try{return JSON.stringify(e,this.replacer,2)}catch{return"[Unable to serialize data]"}}replacer(e,t){return t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t}static ok(e){return new Fe(e)}static fail(e,t){return new Fe().addError(e,t)}}var Gh=Object.defineProperty,Yh=a((r,e)=>Gh(r,"name",{value:e,configurable:!0}),"r$g");class ce extends Error{static{a(this,"SdkError")}static{Yh(this,"SdkError")}code;_status;timestamp;originalError;constructor(e){const t=ce.formatErrorMessage(e);super(t),this.name="SdkError",this.code=e.code,this._status=e.status,this.originalError=e.originalError,this.timestamp=new Date,this.cleanErrorStack()}get status(){return this._status}static fromException(e,t){return e instanceof ce?e:new ce({code:t?.code||"JSSDK_INTERNAL_ERROR",status:t?.status||500,description:e instanceof Error?e.message:`${e}`,originalError:e})}toJSON(){return{name:this.name,code:this.code,message:this.message,status:this._status,timestamp:this.timestamp.toISOString(),stack:this.stack}}toString(){let e=`[${this.name}] ${this.code} (${this._status}): ${this.message}`;return this.stack&&(e+=`
|
|
32
32
|
Stack trace:
|
|
33
33
|
${this.stack}`),e}static formatErrorMessage(e){return e?.description?`${e.description}`:"Internal error"}cleanErrorStack(){typeof this.stack=="string"&&(this.stack=this.stack.split(`
|
|
34
34
|
`).filter(e=>!e.includes("SdkError.constructor")).join(`
|
|
35
|
-
`))}}var
|
|
35
|
+
`))}}var Kh=Object.defineProperty,rn=a((r,e)=>Kh(r,"name",{value:e,configurable:!0}),"s$m");const Zh=["auth","password","token","secret","access_token","refresh_token"],Xh="***REDACTED***";function Yr(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}a(Yr,"i$f"),rn(Yr,"isPlainObject");function Kr(r,e){const t={...r};for(const s of Object.keys(t)){if(Zh.includes(s)){t[s]=Xh;continue}if(e<=0)continue;const n=t[s];Yr(n)?t[s]=Kr(n,e-1):Array.isArray(n)&&(t[s]=n.map(i=>Yr(i)?Kr(i,e-1):i))}return t}a(Kr,"u$4"),rn(Kr,"redactObject");const Qh=2;function pr(r){return Yr(r)?Kr(r,Qh):r}a(pr,"redactSensitiveParams"),rn(pr,"redactSensitiveParams");var ed=Object.defineProperty,td=a((r,e)=>ed(r,"name",{value:e,configurable:!0}),"e$8");class we extends ce{static{a(this,"AjaxError")}static{td(this,"AjaxError")}requestInfo;constructor(e){(e.code==="AUTHORIZE_ERROR"||e.code==="WRONG_AUTH_TYPE")&&(e.status=403),e.description=we.formatErrorMessage(e),super(e),this.name="AjaxError",this.requestInfo=e.requestInfo?{...e.requestInfo,...e.requestInfo.params!==void 0?{params:pr(e.requestInfo.params)}:{}}:void 0,this.cleanErrorStack()}static fromResponse(e){return new we({code:e.data?.error||"JSSDK_INTERNAL_AJAX_ERROR",description:e.data?.error_description,status:e.status,requestInfo:e.config})}static fromException(e,t){return e instanceof we?e:new we({code:t?.code||"JSSDK_INTERNAL_AJAX_ERROR",status:t?.status||500,description:e instanceof Error?e.message:String(e),requestInfo:t?.requestInfo,originalError:e})}toJSON(){return{name:this.name,code:this.code,message:this.message,status:this._status,timestamp:this.timestamp.toISOString(),requestInfo:this.requestInfo,stack:this.stack}}toString(){let e=`[${this.name}] ${this.code} (${this._status}): ${this.message}`;return this.requestInfo&&(e+=`
|
|
36
36
|
Request: ${this.requestInfo?.requestId?`[${this.requestInfo.requestId}] `:""}${this.requestInfo.method}`),this.stack&&(e+=`
|
|
37
37
|
Stack trace:
|
|
38
38
|
${this.stack}`),e}static formatErrorMessage(e){return e?.description?`${e.description}`:e.requestInfo?.method?`${e.code} (on ${e.requestInfo.method})`:"Internal ajax error"}cleanErrorStack(){typeof this.stack=="string"&&(this.stack=this.stack.split(`
|
|
39
39
|
`).filter(e=>!e.includes("AjaxError.constructor")).join(`
|
|
40
|
-
`))}}var rd=Object.defineProperty,sd=a((r,e)=>rd(r,"name",{value:e,configurable:!0}),"i$e");class dr extends Pe{static{a(this,"AjaxResult")}static{sd(this,"AjaxResult")}_status;_query;_data;constructor(e){super(),this._data=e.answer?Object.freeze(e.answer):void 0,this._query=Object.freeze(structuredClone(e.query)),this._status=e.status,this.#r()}get isSuccess(){return this.#e()}#e(){return this._errors.size===0}getData(){if(!this.isSuccess)return;const e=this._data;return Object.freeze({result:e.result,time:e.time})}#r(){if(this._data&&typeof this._data=="object"&&"error"in this._data){const e=this._data;if(e.error&&typeof e.error=="object"&&"code"in e.error){const t=e.error.code;let s=e.error.message.trimEnd();e.error.validation&&(s.length>0&&(s.endsWith(".")||(s+="."),s+=" "),e.error.validation.forEach(n=>{s+=`${n?.message||JSON.stringify(n)}`})),this.addError(this.#s({code:t,description:s,status:this._status}),"base-error")}else if(e.error&&typeof e.error=="string"){const t=e.error!=="0"?e.error:"JSSDK_RESPONSE_ERROR",s=e?.error_description??"Some error in response";this.addError(this.#s({code:t,description:s,status:this._status}),"base-error")}}}#s(e){return new be({code:e.code,description:e.description,status:e.status,requestInfo:{method:this._query.method,params:this._query.params,requestId:this._query.requestId}})}hasMore(){return this.isMore()}isMore(){if(!this.isSuccess)return!1;const e=this._data,t="next"in e?e.next:void 0;return P.isNumber(t)}getTotal(){if(!this.isSuccess)return 0;const e=this._data,t="total"in e?e.total:void 0;return z.toInteger(t)}getStatus(){return this._status}getQuery(){return this._query}async fetchNext(e){const t=await this.getNext(e);return t===!1?null:t}async getNext(e){if(e.apiVersion===K.v3)throw new ne({code:"JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",description:"restApi:v3 not support method getNext",status:500});if(!this.isSuccess||!this.isMore())return!1;const t=this.#t();return e.call(t.method,t.params)}#t(){const e={...this._query},t=this._data,s="next"in t?t.next:void 0;return e.params.start=z.toInteger(z.toInteger(s)),e}setData(){throw new ReferenceError("AjaxResult does not allow data modification")}}var nd=Object.defineProperty,id=a((r,e)=>nd(r,"name",{value:e,configurable:!0}),"a$g");class tn{static{a(this,"ParamsFactory")}static{id(this,"ParamsFactory")}static getDefault(){return{rateLimit:{burstLimit:50,drainRate:2,adaptiveEnabled:!0},operatingLimit:{windowMs:6e5,limitMs:48e4,heavyPercent:80},adaptiveConfig:{enabled:!0,thresholdPercent:80,coefficient:.01,maxDelay:7e3},maxRetries:3,retryDelay:1e3,retryOnNetworkError:!0}}static getEnterprise(){return{...this.getDefault(),rateLimit:{burstLimit:250,drainRate:5,adaptiveEnabled:!0}}}static getBatchProcessing(){return{...this.getDefault(),rateLimit:{burstLimit:30,drainRate:1,adaptiveEnabled:!0},operatingLimit:{windowMs:6e5,limitMs:48e4,heavyPercent:50},adaptiveConfig:{enabled:!0,thresholdPercent:50,coefficient:.015,maxDelay:1e4},maxRetries:5}}static getRealtime(){return{...this.getDefault(),adaptiveConfig:{enabled:!1,thresholdPercent:100,coefficient:.001,maxDelay:48e4},maxRetries:1}}static fromTariffPlan(e){switch(e.toLowerCase()){case"enterprise":return this.getEnterprise();case"company":case"start":case"standard":case"basic":default:return this.getDefault()}}}var od=Object.defineProperty,ad=a((r,e)=>od(r,"name",{value:e,configurable:!0}),"c$7");class Ho{static{a(this,"RateLimiter")}static{ad(this,"RateLimiter")}#e;#r;#s;#t;#i=[];#n;#o=5;#c=20;#h=.5;#d=5;#a=[];#u=[];_logger;constructor(e){this._logger=ee.createNullLogger(),this.#t=e,this.#n={...e},this.#e=e.burstLimit,this.#r=Date.now(),this.#s=1e3/e.drainRate}getTitle(){return"rateLimiter"}setLogger(e){this._logger=e}getLogger(){return this._logger}async canProceed(e,t,s){await this.#l(e);try{const n=Date.now(),i=(n-this.#r)*this.#t.drainRate/1e3;return this.#e=Math.min(this.#t.burstLimit,this.#e+i),this.#r=n,this.#e>=1}finally{this.#f()}}async waitIfNeeded(e,t,s){await this.#l(e);try{const n=Date.now(),i=(n-this.#r)*this.#t.drainRate/1e3;if(this.#e=Math.min(this.#t.burstLimit,this.#e+i),this.#r=n,this.#e>=1)return this.#e-=1,0;const c=1-this.#e;return Math.ceil(c*this.#s)}finally{this.#f()}}async handleExceeded(e){await this.#l(e);try{return this.#_(),this.#t.adaptiveEnabled&&this.#g()&&this.#m(e),this.#e=0,this.#s+1e3}finally{this.#f()}}async updateStats(e,t,s){if(!t.startsWith("batch::")){await this.#l(e);try{this.#w(),this.#t.adaptiveEnabled&&this.#T(e),this.#t.adaptiveEnabled&&this.#p()&&this.#b(e)}finally{this.#f()}}}async reset(){await this.#l("reset");try{this.#e=this.#t.burstLimit,this.#r=Date.now(),this.#a=[],this.#u=[],this.#t.drainRate=this.#n.drainRate,this.#t.burstLimit=this.#n.burstLimit,this.#s=1e3/this.#t.drainRate}finally{this.#f()}}getStats(){return{tokens:this.#e,burstLimit:this.#t.burstLimit,originalBurstLimit:this.#n.burstLimit,drainRate:this.#t.drainRate,originalDrainRate:this.#n.drainRate,refillIntervalMs:this.#s,lastRefill:this.#r,pendingRequests:this.#i.length,recentErrors:this.#a.length,recentSuccesses:this.#u.length}}async setConfig(e){await this.#l("setConfig");try{this.#t=e,this.#n={...e},this.#s=1e3/this.#t.drainRate,e.burstLimit>this.#e&&(this.#e=Math.min(e.burstLimit,this.#e)),this.#a=[],this.#u=[]}finally{this.#f()}}async#l(e){return new Promise(t=>{const s=this.#i.push(t);s>1&&this.#O(e,s),this.#i.length===1&&t()})}#f(){if(this.#i.shift(),this.#i.length>0){const e=this.#i[0];e()}}#g(){return this.#a.length>=this.#o}#p(){return this.#u.length>=this.#c&&this.#a.length<this.#o/2&&(this.#t.drainRate<this.#n.drainRate||this.#t.burstLimit<this.#n.burstLimit)}#m(e){const t=Math.max(this.#h,Number.parseFloat((this.#t.drainRate*.8).toFixed(2))),s=Math.max(this.#d,Number.parseFloat((this.#t.burstLimit*.8).toFixed(2)));this.#t.drainRate=t,this.#t.burstLimit=s,this.#s=1e3/t,this.#v(e,t,s),this.#a=[],this.#u=[]}#b(e){if(this.#t.drainRate===this.#n.drainRate&&this.#t.burstLimit===this.#n.burstLimit)return;const t=Math.min(this.#n.drainRate,Number.parseFloat((this.#t.drainRate*1.1).toFixed(2))),s=Math.min(this.#n.burstLimit,Number.parseFloat((this.#t.burstLimit*1.1).toFixed(2)));this.#t.drainRate=t,this.#t.burstLimit=s,this.#s=1e3/t,this.#E(e,t,s),this.#a=[],this.#u=[]}#_(){const e=Date.now();this.#a.push(e),this.#u=[],this.#y(e)}#y(e){const t=e-6e4;this.#a=this.#a.filter(s=>s>t)}#w(){const e=Date.now();this.#u.push(e),this.#S(),this.#y(e)}#S(){this.#u=this.#u.slice(-1*this.#c)}#v(e,t,s){const n=this.#n.drainRate,i=t<n,c=this.#n.burstLimit,o=s<c;this.getLogger().warning(`${this.getTitle()} is lowering limits due to frequent errors`,{requestId:e,drainRate:{current:t,original:n,condition:i,formatted:`(${t} < ${n}) ${i}`},burstLimit:{current:s,original:c,condition:o,formatted:`(${s} < ${c}) ${o}`}})}#E(e,t,s){const n=this.#n.drainRate,i=t<n,c=this.#n.burstLimit,o=s<c;this.getLogger().warning(`${this.getTitle()} increases limits during stable operation`,{requestId:e,drainRate:{current:t,original:n,condition:i,formatted:`(${t} < ${n}) ${i}`},burstLimit:{current:s,original:c,condition:o,formatted:`(${s} < ${c}) ${o}`}})}#O(e,t){this.getLogger().debug(`${this.getTitle()} request in queue`,{requestId:e,queueLength:t})}#T(e){const t=this.#u.length,s=this.#c,n=t>=s,i=this.#a.length,c=this.#o,o=i<c/2,u=this.#t.drainRate,h=this.#n.drainRate,l=u<h,g=this.#t.burstLimit,p=this.#n.burstLimit,f=g<p;this.getLogger().debug(`${this.getTitle()} state`,{requestId:e,success:{count:t,threshold:s,condition:n,formatted:`(${t} >= ${s}) ${n}`},fail:{count:i,threshold:c/2,condition:o,formatted:`(${i} < ${c/2}) ${o}`},drainRate:{current:u,original:h,condition:l,formatted:`(${u} < ${h}) ${l}`},burstLimit:{current:g,original:p,condition:f,formatted:`(${g} < ${p}) ${f}`}})}}var cd=Object.defineProperty,ld=a((r,e)=>cd(r,"name",{value:e,configurable:!0}),"g$8");class zo{static{a(this,"OperatingLimiter")}static{ld(this,"OperatingLimiter")}#e;#r=new Map;#s={heavyRequestCount:0};_logger;getTitle(){return"operatingLimiter"}constructor(e){this._logger=ee.createNullLogger(),this.#e=e}setLogger(e){this._logger=e}getLogger(){return this._logger}get limitMs(){return this.#e.limitMs}getMethodStat(e){const t=this.#r.get(e);if(t)return t}async canProceed(e,t,s){return await this.getTimeToFree(e,t,s)===0}async waitIfNeeded(e,t,s){return this.getTimeToFree(e,t,s)}async getTimeToFree(e,t,s,n){if(this.#i(),t==="batch")return this.#t(e,s);const i=this.#r.get(t);if(!i)return 0;const c=Math.max(1e3,this.#e.limitMs-5e3);if(i.operating>=c){const o=Date.now();return i.operating_reset_at>o?i.operating_reset_at-o+1e3:5e3}return 0}async#t(e,t){let s=0;if(!t?.cmd||!Array.isArray(t.cmd))return s;const n=t.cmd.map(i=>i.split("?")[0]).filter(Boolean);for(const i of n){const c=await this.getTimeToFree(e,`batch::${i}`,{});s=Math.max(s,c)}return s}async updateStats(e,t,s){this.#i();const{operating:n,operating_reset_at:i}=s;if(n==null)return;this.#r.has(t)||this.#r.set(t,{operating:0,operating_reset_at:0,lastUpdated:Date.now()});const c=this.#r.get(t);c.operating=n*1e3,c.operating_reset_at=i*1e3,c.lastUpdated=Date.now();const o=c.operating/this.#e.limitMs*100;o>this.#e.heavyPercent&&(this.#s.heavyRequestCount++,this.#n(e,t,o,c.operating))}#i(){const e=Date.now(),t=this.#e.windowMs+1e4;for(const[s,n]of this.#r.entries())e-n.lastUpdated>t&&this.#r.delete(s)}async reset(){this.#r.clear(),this.#s={heavyRequestCount:0}}getStats(){const e={};for(const[t,s]of this.#r.entries())e[t]=Number.parseFloat((s.operating/1e3).toFixed(2));return{...this.#s,operatingStats:e}}async setConfig(e){this.#e=e}#n(e,t,s,n){this.getLogger().debug(`${this.getTitle()} detected limit for method ${t}`,{requestId:e,method:t,operating:{percent:Number.parseFloat(s.toFixed(2)),current:Number.parseFloat((n/1e3).toFixed(0)),max:Number.parseFloat((this.#e.limitMs/1e3).toFixed(0))}})}}var ud=Object.defineProperty,hd=a((r,e)=>ud(r,"name",{value:e,configurable:!0}),"l$7");class Jo{static{a(this,"AdaptiveDelayer")}static{hd(this,"AdaptiveDelayer")}#e;#r;#s={adaptiveDelays:0,totalAdaptiveDelay:0};_logger;getTitle(){return"adaptiveDelayer"}constructor(e,t){this._logger=ee.createNullLogger(),this.#e=e,this.#r=t}setLogger(e){this._logger=e}getLogger(){return this._logger}async canProceed(e,t,s){return!0}async waitIfNeeded(e,t,s){if(!this.#e.enabled)return 0;const n=this.#t(e,t,s);return n>0&&(this.incrementAdaptiveDelays(),this.#s.totalAdaptiveDelay+=n),n}#t(e,t,s){if(t==="batch")return this.#i(e,s);const n=this.#r.getMethodStat(t);if(typeof n>"u")return 0;const i=n.operating/this.#r.limitMs*100;if(i>this.#e.thresholdPercent){let c=0;const o=Date.now();n.operating_reset_at>o?c+=(n.operating_reset_at-o)*this.#e.coefficient:c+=7e3;const u=Number.parseInt(Math.min(c,this.#e.maxDelay).toFixed(0));return this.#n(e,t,i,c,u),u}return 0}#i(e,t){let s=0;if(!t?.cmd||!Array.isArray(t.cmd))return s;const n=t.cmd.map(c=>c.split("?")[0]).filter(Boolean),i=[...new Set(n)];for(const c of i){const o=this.#t(e,`batch::${c}`,{});s=Math.max(s,o)}return s}async updateStats(e,t,s){}async reset(){this.#s={adaptiveDelays:0,totalAdaptiveDelay:0}}getStats(){return{...this.#s,adaptiveDelayAvg:this.#s.adaptiveDelays>0?this.#s.totalAdaptiveDelay/this.#s.adaptiveDelays:0}}async setConfig(e){this.#e=e}incrementAdaptiveDelays(){this.#s.adaptiveDelays++}#n(e,t,s,n,i){this.getLogger().debug(`${this.getTitle()} state for method ${t}`,{requestId:e,method:t,percent:Number.parseFloat(s.toFixed(2)),delays:{calculated:n,actual:i}})}}var dd=Object.defineProperty,fd=a((r,e)=>dd(r,"name",{value:e,configurable:!0}),"E$2");class fr{static{a(this,"RestrictionManager")}static{fd(this,"RestrictionManager")}#e;#r;#s;#t;#i={retries:0,consecutiveErrors:0,limitHits:0};#n=new Map;_logger;constructor(e){this._logger=ee.createNullLogger(),this.#t=e,this.#e=new Ho(e.rateLimit),this.#r=new zo(e.operatingLimit),this.#s=new Jo(e.adaptiveConfig,this.#r)}setLogger(e){this._logger=e,this.#e.setLogger(this._logger),this.#r.setLogger(this._logger),this.#s.setLogger(this._logger)}getLogger(){return this._logger}async applyOperatingLimits(e,t,s){const n=await this.#r.waitIfNeeded(e,t,s);if(n>0)this.incrementStats("limitHits"),this.#f(this.#r.getTitle(),e,t,n),await this.#l(n);else{const i=await this.#s.waitIfNeeded(e,t,s);i>0&&(this.incrementStats("limitHits"),this.#f(this.#s.getTitle(),e,t,i),await this.#l(i))}}async checkRateLimit(e,t){let s,n=1;do s=await this.#e.waitIfNeeded(e,t),s>0&&(this.incrementStats("limitHits"),this.#g(this.#e.getTitle(),e,t,s,n),await this.#l(s),n++);while(s>0)}async updateStats(e,t,s){await this.#r.updateStats(e,t,s),await this.#s.updateStats(e,t,s),await this.#e.updateStats(e,t,s)}async handleError(e,t,s,n,i){if(this.#o(n)){const c=await this.#c(e)*Math.pow(1.5,i);return this.#p(this.#e.getTitle(),e,"QUERY_LIMIT_EXCEEDED",n.message,t,c),c}if(this.#h(n)){const c=Math.max(1e4,await this.#d(e,t,s,n));return this.#p(this.#r.getTitle(),e,"OPERATION_TIME_LIMIT",n.message,t,c),c}if(!this.#a(n)){const c=await this.#u(e),o=Math.max(3e4,c),u=Math.min(o,c*Math.pow(2,i)),h=u*.1*(Math.random()*2-1),l=Math.max(100,u+h);return this.#m(e,n?.code?`${n.code}`:"?",n.message,t,l),l}return 0}#o(e){return e.status===503||e.code==="QUERY_LIMIT_EXCEEDED"}async#c(e){return this.#e.handleExceeded(e)}#h(e){return e.status===429||e.code==="OPERATION_TIME_LIMIT"}async#d(e,t,s,n){return this.#r.getTimeToFree(e,t,s,n)}#a(e){const t={code:e?.code??"-1",description:e?.message??""};return[...this.exceptionCodeForHard,...this.exceptionCodeForSoft].includes(t.code)||(t.description??"").includes("Could not find value for parameter")}static BUILT_IN_HARD_ERROR_CODES=["ERR_BAD_REQUEST","JSSDK_UNKNOWN_ERROR","100","INTERNAL_SERVER_ERROR","ERROR_UNEXPECTED_ANSWER","PORTAL_DELETED","ERROR_BATCH_METHOD_NOT_ALLOWED","ERROR_BATCH_LENGTH_EXCEEDED","NO_AUTH_FOUND","INVALID_REQUEST","OVERLOAD_LIMIT","expired_token","ACCESS_DENIED","INVALID_CREDENTIALS","user_access_error","insufficient_scope","ERROR_MANIFEST_IS_NOT_AVAILABLE","allowed_only_intranet_user","NOT_FOUND","INVALID_ARG_VALUE"];static BUILT_IN_SOFT_ERROR_CODES=["ERROR_ENTITY_NOT_FOUND","BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDJSONEXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDFILTEREXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDSELECTEXCEPTION","BITRIX_REST_V3_EXCEPTION_ENTITYNOTFOUNDEXCEPTION","BITRIX_REST_V3_EXCEPTION_METHODNOTFOUNDEXCEPTION","BITRIX_REST_V3_EXCEPTION_UNKNOWNDTOPROPERTYEXCEPTION","BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION","BITRIX_REST_V3_EXCEPTION_VALIDATION_DTOVALIDATIONEXCEPTION"];get exceptionCodeForHard(){const e=[...fr.BUILT_IN_HARD_ERROR_CODES];return this.#t.retryOnNetworkError===!1&&e.push("NETWORK_ERROR","REQUEST_TIMEOUT"),this.#t.hardErrorCodes&&this.#t.hardErrorCodes.length>0&&e.push(...this.#t.hardErrorCodes),e}get exceptionCodeForSoft(){const e=[...fr.BUILT_IN_SOFT_ERROR_CODES];return this.#t.softErrorCodes&&this.#t.softErrorCodes.length>0&&e.push(...this.#t.softErrorCodes),e}async#u(e){return this.#t.retryDelay}incrementError(e){const t=this.#n.get(e)||0;this.#n.set(e,t+1),this.incrementStats("consecutiveErrors")}resetErrors(e){this.#n.delete(e),this.#i.consecutiveErrors=0}incrementStats(e){this.#i[e]++}getStats(){return{...this.#i,...this.#e.getStats(),...this.#s.getStats(),...this.#r.getStats(),errorCounts:Object.fromEntries(this.#n)}}async reset(){await this.#e.reset(),await this.#r.reset(),await this.#s.reset(),this.#n.clear(),this.#i={retries:0,consecutiveErrors:0,limitHits:0}}async setConfig(e){this.#t=e,await this.#e.setConfig(e.rateLimit),await this.#r.setConfig(e.operatingLimit),await this.#s.setConfig(e.adaptiveConfig)}getParams(){return{...this.#t}}async#l(e){return new Promise(t=>setTimeout(t,e))}async waiteDelay(e){return this.#l(e)}#f(e,t,s,n){this.getLogger().notice(`${e} blocked method ${s}`,{requestId:t,method:s,wait:n,limiter:e})}#g(e,t,s,n,i){this.getLogger().notice(`${e} blocked method ${s} | ${i} times`,{requestId:t,method:s,times:i,wait:n,limiter:e})}#p(e,t,s,n,i,c){this.getLogger().error(`${e} recognized the ${s} error for the ${i} method`,{requestId:t,method:i,wait:c,limiter:e,error:{code:s,message:n}})}#m(e,t,s,n,i){this.getLogger().error(`recognized the ${t} error for the ${n} method`,{requestId:e,method:n,wait:i,error:{code:t,message:s}})}}var pd=Object.defineProperty,gd=a((r,e)=>pd(r,"name",{value:e,configurable:!0}),"r$e");class bt{static{a(this,"ParseRow")}static{gd(this,"ParseRow")}static getBatchCommand(e,t){if(e){if(typeof e=="object"&&"method"in e&&typeof e.method=="string")return{method:e.method,query:e.params,as:e.as??t.asDefaultValue,parallel:e.parallel??t.parallelDefaultValue};if(Array.isArray(e)&&e.length>0&&typeof e[0]=="string")return{method:e[0],query:e[1],as:t.asDefaultValue,parallel:t.parallelDefaultValue}}throw new ne({code:"JSSDK_INTERACTION_BATCH_ROW_FAIL",description:`There were difficulties parsing the command for batch.
|
|
41
|
-
${JSON.stringify({row:e,options:t})}`,status:500})}static getMethodsFromCommands(e){const t=[],s={parallelDefaultValue:!1};return Array.isArray(e)?e.forEach(n=>{const i=bt.getBatchCommand(n,s);t.push(i.method)}):Object.entries(e).forEach(([n,i])=>{const c=bt.getBatchCommand(i,{...s,asDefaultValue:n});t.push(c.method)}),t}}var md=Object.defineProperty,yd=a((r,e)=>md(r,"name",{value:e,configurable:!0}),"i$c");const nt=class Mc{static{a(this,"a")}static{yd(this,"VersionManager")}#e;constructor(){this.#e=["/batch","/scopes","/rest.scope.list","/rest.documentation.openapi","/documentation","/main.eventlog.list","/main.eventlog.get","/main.eventlog.tail","/tasks.task.chat.message.send","/tasks.task.access.get","/tasks.task.file.attach","/tasks.task.update","/tasks.task.delete","/tasks.task.add","/tasks.task.get"]}static create(){return new Mc}getAllApiVersions(){return[K.v3,K.v2]}isSupport(e,t){switch(e){case K.v3:return this.#r(t);case K.v2:return!0}return!1}#r(e){return this.#e.includes(`/${e}`)}automaticallyObtainApiVersion(e){const t=this.getAllApiVersions().find(s=>nt.isSupport(s,e));if(!t)throw new ne({code:"JSSDK_VERSION_MANAGER_NOT_DETECT_FOR_METHOD",description:`No API version found that supports method ${e}.`,status:500});return t}automaticallyObtainApiVersionForBatch(e){const t=bt.getMethodsFromCommands(e);let s=!0;for(const[n,i]of t.entries())if(!this.isSupport(K.v3,i)){s=!1;break}return s?K.v3:K.v2}}.create();var bd=Object.defineProperty,_d=a((r,e)=>bd(r,"name",{value:e,configurable:!0}),"o$j");class It{static{a(this,"AbstractAction")}static{_d(this,"AbstractAction")}_b24;_logger;constructor(e,t){this._b24=e,this._logger=t}}var wd=Object.defineProperty,Sd=a((r,e)=>wd(r,"name",{value:e,configurable:!0}),"r$d");class vd extends It{static{a(this,"CallV2")}static{Sd(this,"CallV2")}async make(e){nt.isSupport(K.v3,e.method)&&ee.forcedLog(this._logger,"warning",`The method ${e.method} is available in restApi:v3. It's worth migrating to the new API.`,{method:e.method,requestId:e.requestId,code:"JSSDK_CORE_METHOD_AVAILABLE_IN_API_V3"});const t=e.params||{};return this._b24.getHttpClient(K.v2).call(e.method,t,e.requestId)}}var Ed=Object.defineProperty,Od=a((r,e)=>Ed(r,"name",{value:e,configurable:!0}),"f$3");class Td extends It{static{a(this,"CallListV2")}static{Od(this,"CallListV2")}async make(e){const t=new Pe,s=e?.idKey??"ID",n=e?.customKeyForResult??null,i=e?.params??{};"order"in i&&i.order&&this._logger.warning("callList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by idKey. Use `filter` to narrow results instead.");const c=`>${s}`,{order:o,...u}=i,h={...u,order:{[s]:"ASC"},filter:{...i.filter||{},[c]:0},start:-1};let l=[],g=!0;do{const p=await this._b24.actions.v2.call.make({method:e.method,params:h,requestId:e.requestId});if(!p.isSuccess){this._logger.error("callFastListMethod",{method:e.method,requestId:e.requestId,messages:p.getErrorMessages()});for(const[y,b]of p.errors)t.addError(b,y);g=!1;break}const f=p.getData();if(!f){g=!1;break}let d=[];if(n===null?d=f.result:d=f.result[n],d.length===0){g=!1;break}if(l=[...l,...d],d.length<50){g=!1;break}const m=d[d.length-1];if(m&&typeof m[s]<"u")h.filter[c]=Number.parseInt(m[s]);else{g=!1;break}}while(g);return t.setData(l)}}var kd=Object.defineProperty,Id=a((r,e)=>kd(r,"name",{value:e,configurable:!0}),"u$4");class Ad extends It{static{a(this,"FetchListV2")}static{Id(this,"FetchListV2")}async*make(e){const t=e?.idKey??"ID",s=e?.customKeyForResult??null,n=e?.params??{};"order"in n&&n.order&&this._logger.warning("fetchList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by idKey. Use `filter` to narrow results instead.");const i=`>${t}`,{order:c,...o}=n,u={...o,order:{[t]:"ASC"},filter:{...n.filter||{},[i]:0},start:-1};let h=!0;do{const l=await this._b24.actions.v2.call.make({method:e.method,params:u,requestId:e.requestId});if(!l.isSuccess)throw this._logger.error("fetchListMethod",{method:e.method,requestId:e.requestId,messages:l.getErrorMessages()}),new ne({code:"JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V2",description:`API Error: ${l.getErrorMessages().join("; ")}`,status:500});const g=l.getData();if(!g){h=!1;break}let p=[];if(s===null?p=g.result:p=g.result[s],p.length===0){h=!1;break}if(yield p,p.length<50){h=!1;break}const f=p[p.length-1];if(f&&typeof f[t]<"u")u.filter[i]=Number.parseInt(f[t]);else{h=!1;break}}while(h)}}var Rd=Object.defineProperty,Cd=a((r,e)=>Rd(r,"name",{value:e,configurable:!0}),"u$3");class Gr extends It{static{a(this,"AbstractBatch")}static{Cd(this,"AbstractBatch")}_addBatchErrorsIfAny(e,t){if(!e.isSuccess)for(const[s,n]of e.errors)t.addError(n,s)}_processBatchResponse(e,t,s){const n=Array.isArray(t);return s.returnAjaxResult?this._createBatchResultWithAjax(e,n):this._createBatchResultSimple(e,n)}_createBatchResultWithAjax(e,t){return t?this._createBatchArrayResult(e):this._createBatchObjectResult(e)}_createBatchArrayResult(e){const t=new Pe;this._addBatchErrorsIfAny(e,t);const s=[];for(const[n,i]of e.getData().result)s.push(i);return t.setData(s)}_createBatchObjectResult(e){const t=new Pe;this._addBatchErrorsIfAny(e,t);const s={};for(const[n,i]of e.getData().result)s[n]=i;return t.setData(s)}_createBatchResultSimple(e,t){const s=new Pe;return this._addBatchErrorsIfAny(e,s),s.setData(this._extractBatchSimpleData(e,t))}_extractBatchSimpleData(e,t){if(t){const s=[];for(const[n,i]of e.getData().result)i.isSuccess&&s.push(i.getData().result);return s}else{const s={};for(const[n,i]of e.getData().result)i.isSuccess&&(s[n]=i.getData().result);return s}}chunkArray(e,t=50){const s=[];for(let n=0;n<e.length;n+=t){const i=e.slice(n,n+t);s.push(i)}return s}}var Nd=Object.defineProperty,Dd=a((r,e)=>Nd(r,"name",{value:e,configurable:!0}),"o$i");class Md extends Gr{static{a(this,"BatchV2")}static{Dd(this,"BatchV2")}async make(e){const t={...e.options,apiVersion:K.v2},s=await this._b24.getHttpClient(K.v2).batch(e.calls,t);return this._processBatchResponse(s,e.calls,t)}}var Pd=Object.defineProperty,Ld=a((r,e)=>Pd(r,"name",{value:e,configurable:!0}),"r$c");class Fd extends Gr{static{a(this,"BatchByChunkV2")}static{Ld(this,"BatchByChunkV2")}async make(e){const t={...e.options,returnAjaxResult:!1,apiVersion:K.v2},s=new Pe,n=[],i=this.chunkArray(e.calls,50);for(const c of i){const o=await this._b24.getHttpClient(K.v2).batch(c,t);o.isSuccess||this._addBatchErrorsIfAny(o,s);for(const[u,h]of o.getData().result)h.isSuccess&&n.push(h.getData().result)}return s.setData(n)}}var xd=Object.defineProperty,$d=a((r,e)=>xd(r,"name",{value:e,configurable:!0}),"r$b");const rn=Symbol("call_V2"),sn=Symbol("callList_V2"),nn=Symbol("fetchList_V2"),on=Symbol("batch_V2"),an=Symbol("batchByChunk_V2");class jd{static{a(this,"ActionsManagerV2")}static{$d(this,"ActionsManagerV2")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=ee.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get call(){return this._mapActions.has(rn)||this._mapActions.set(rn,new vd(this._b24,this._logger)),this._mapActions.get(rn)}get callList(){return this._mapActions.has(sn)||this._mapActions.set(sn,new Td(this._b24,this._logger)),this._mapActions.get(sn)}get fetchList(){return this._mapActions.has(nn)||this._mapActions.set(nn,new Ad(this._b24,this._logger)),this._mapActions.get(nn)}get batch(){return this._mapActions.has(on)||this._mapActions.set(on,new Md(this._b24,this._logger)),this._mapActions.get(on)}get batchByChunk(){return this._mapActions.has(an)||this._mapActions.set(an,new Fd(this._b24,this._logger)),this._mapActions.get(an)}}var Bd=Object.defineProperty,Ud=a((r,e)=>Bd(r,"name",{value:e,configurable:!0}),"e$6");class Vd extends It{static{a(this,"CallV3")}static{Ud(this,"CallV3")}async make(e){if(!nt.isSupport(K.v3,e.method))throw new ne({code:"JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",description:`restApi:v3 not support method ${e.method}`,status:500});const t=e.params||{};return this._b24.getHttpClient(K.v3).call(e.method,t,e.requestId)}}var qd=Object.defineProperty,Wd=a((r,e)=>qd(r,"name",{value:e,configurable:!0}),"g$7");class Hd extends It{static{a(this,"CallListV3")}static{Wd(this,"CallListV3")}async make(e){const t=e?.limit??50,s=new Pe,n=e?.idKey??"id",i=e?.customKeyForResult??null,c=e?.params??{};"order"in c&&c.order&&this._logger.warning("callList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by idKey. Use `filter` to narrow results instead.");const{order:o,...u}=c,h={...u,order:{[n]:"ASC"},filter:[...c.filter||[]],pagination:{page:0,limit:t}};let l=[],g=!0,p=0;do{const f={...h,filter:[...h.filter]};f.filter.push([n,">",p]);const d=await this._b24.actions.v3.call.make({method:e.method,params:f,requestId:e.requestId});if(!d.isSuccess){this._logger.error("callFastListMethod",{method:e.method,requestId:e.requestId,messages:d.getErrorMessages()});for(const[_,w]of d.errors)s.addError(w,_);g=!1;break}const m=d.getData();if(!m){g=!1;break}const y=m.result[i];if(y.length===0){g=!1;break}if(l=[...l,...y],y.length<t){g=!1;break}const b=y[y.length-1];if(b&&typeof b[n]<"u")p=Number.parseInt(b[n]);else{g=!1;break}}while(g);return s.setData(l)}}var zd=Object.defineProperty,Jd=a((r,e)=>zd(r,"name",{value:e,configurable:!0}),"p$9");class Gd extends It{static{a(this,"FetchListV3")}static{Jd(this,"FetchListV3")}async*make(e){const t=e?.limit??50,s=e?.idKey??"id",n=e?.customKeyForResult??null,i=e?.params??{};"order"in i&&i.order&&this._logger.warning("fetchList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by idKey. Use `filter` to narrow results instead.");const{order:c,...o}=i,u={...o,order:{[s]:"ASC"},filter:[...i.filter||[]],pagination:{page:0,limit:t}};let h=!0,l=0;do{const g={...u,filter:[...u.filter]};g.filter.push([s,">",l]);const p=await this._b24.actions.v3.call.make({method:e.method,params:g,requestId:e.requestId});if(!p.isSuccess)throw this._logger.error("fetchListMethod",{method:e.method,requestId:e.requestId,messages:p.getErrorMessages()}),new ne({code:"JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V3",description:`API Error: ${p.getErrorMessages().join("; ")}`,status:500});const f=p.getData();if(!f){h=!1;break}const d=f.result[n];if(d.length===0){h=!1;break}if(yield d,d.length<t){h=!1;break}const m=d[d.length-1];if(m&&typeof m[s]<"u")l=Number.parseInt(m[s]);else{h=!1;break}}while(h)}}var Yd=Object.defineProperty,Zd=a((r,e)=>Yd(r,"name",{value:e,configurable:!0}),"o$g");class Kd extends Gr{static{a(this,"BatchV3")}static{Zd(this,"BatchV3")}async make(e){const t={...e.options,apiVersion:K.v3};if(nt.automaticallyObtainApiVersionForBatch(e.calls)!==t.apiVersion)throw new ne({code:"JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",description:`restApi:v3 not support some methods in calls: ${JSON.stringify(e.calls)}`,status:500});const s=await this._b24.getHttpClient(K.v3).batch(e.calls,t);return this._processBatchResponse(s,e.calls,t)}}var Xd=Object.defineProperty,Qd=a((r,e)=>Xd(r,"name",{value:e,configurable:!0}),"r$a");class ef extends Gr{static{a(this,"BatchByChunkV3")}static{Qd(this,"BatchByChunkV3")}async make(e){const t={...e.options,returnAjaxResult:!1,apiVersion:K.v3},s=new Pe,n=[],i=this.chunkArray(e.calls,50);for(const c of i){const o=await this._b24.getHttpClient(K.v3).batch(c,t);o.isSuccess||this._addBatchErrorsIfAny(o,s);for(const[u,h]of o.getData().result)h.isSuccess&&n.push(h.getData().result)}return s.setData(n)}}var tf=Object.defineProperty,rf=a((r,e)=>tf(r,"name",{value:e,configurable:!0}),"r$9");const cn=Symbol("call_V3"),ln=Symbol("callList_V3"),un=Symbol("fetchList_V3"),hn=Symbol("batch_V3"),dn=Symbol("batchByChunk_V3");class sf{static{a(this,"ActionsManagerV3")}static{rf(this,"ActionsManagerV3")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=ee.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get call(){return this._mapActions.has(cn)||this._mapActions.set(cn,new Vd(this._b24,this._logger)),this._mapActions.get(cn)}get callList(){return this._mapActions.has(ln)||this._mapActions.set(ln,new Hd(this._b24,this._logger)),this._mapActions.get(ln)}get fetchList(){return this._mapActions.has(un)||this._mapActions.set(un,new Gd(this._b24,this._logger)),this._mapActions.get(un)}get batch(){return this._mapActions.has(hn)||this._mapActions.set(hn,new Kd(this._b24,this._logger)),this._mapActions.get(hn)}get batchByChunk(){return this._mapActions.has(dn)||this._mapActions.set(dn,new ef(this._b24,this._logger)),this._mapActions.get(dn)}}var nf=Object.defineProperty,of=a((r,e)=>nf(r,"name",{value:e,configurable:!0}),"s$j");const fn=Symbol(K.v2),pn=Symbol(K.v3);class af{static{a(this,"ActionsManager")}static{of(this,"ActionsManager")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=ee.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e,this.v2.setLogger(this._logger),this.v3.setLogger(this._logger)}getLogger(){return this._logger}get v2(){return this._mapActions.has(fn)||this._mapActions.set(fn,new jd(this._b24)),this._mapActions.get(fn)}get v3(){return this._mapActions.has(pn)||this._mapActions.set(pn,new sf(this._b24)),this._mapActions.get(pn)}}var cf=Object.defineProperty,lf=a((r,e)=>cf(r,"name",{value:e,configurable:!0}),"o$d");class Go{static{a(this,"AbstractTool")}static{lf(this,"AbstractTool")}_b24;_logger;constructor(e,t){this._b24=e,this._logger=t}}var uf=Object.defineProperty,hf=a((r,e)=>uf(r,"name",{value:e,configurable:!0}),"r$8");class df extends Go{static{a(this,"Ping")}static{hf(this,"Ping")}async make(e){const t=Date.now();try{return await this._b24.actions.v2.call.make({method:"server.time",params:{},requestId:e?.requestId}),Date.now()-t}catch{return-1}}}var ff=Object.defineProperty,pf=a((r,e)=>ff(r,"name",{value:e,configurable:!0}),"s$h");class gf extends Go{static{a(this,"HealthCheck")}static{pf(this,"HealthCheck")}async make(e){try{return(await this._b24.actions.v2.call.make({method:"server.time",params:{},requestId:e?.requestId})).isSuccess}catch{return!1}}}var mf=Object.defineProperty,yf=a((r,e)=>mf(r,"name",{value:e,configurable:!0}),"g$5");const gn=Symbol("ping"),mn=Symbol("healthCheck");class bf{static{a(this,"ToolsManager")}static{yf(this,"ToolsManager")}_b24;_logger;_mapTools;constructor(e){this._b24=e,this._logger=ee.createNullLogger(),this._mapTools=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get ping(){return this._mapTools.has(gn)||this._mapTools.set(gn,new df(this._b24,this._logger)),this._mapTools.get(gn)}get healthCheck(){return this._mapTools.has(mn)||this._mapTools.set(mn,new gf(this._b24,this._logger)),this._mapTools.get(mn)}}var _f=Object.defineProperty,wf=a((r,e)=>_f(r,"name",{value:e,configurable:!0}),"u$2");class Yr{static{a(this,"AbstractB24")}static{wf(this,"AbstractB24")}static batchSize=50;_isInit=!1;_httpV2=null;_httpV3=null;_logger;_actionsManager;_toolsManager;constructor(){this._isInit=!1,this._logger=ee.createNullLogger(),this._actionsManager=new af(this),this._toolsManager=new bf(this)}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}get actions(){return this._ensureInitialized(),this._actionsManager}get tools(){return this._ensureInitialized(),this._toolsManager}async callMethod(e,t,s){return ee.forcedLog(this._logger,"warning","The AbstractB24.callMethod() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.call.make(options) or b24.actions.v2.call.make(options)",{class:"AbstractB24",method:"callMethod",replacement:"b24.actions.v3.call.make(options) | b24.actions.v2.call.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"}),t={...t},!("start"in t&&Number.isInteger(t.start))&&Number.isInteger(s)&&(t.start=s),this._actionsManager.v2.call.make({method:e,params:t})}async callListMethod(e,t,s,n){ee.forcedLog(this._logger,"warning","The AbstractB24.callListMethod() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.callList.make(options) or b24.actions.v2.callList.make(options)",{class:"AbstractB24",method:"callListMethod",replacement:"b24.actions.v3.callList.make(options) | b24.actions.v2.callList.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const i=new Pe;P.isFunction(s)&&s!==null&&s(0);const c={...t,start:0};return this.actions.v2.call.make({method:e,params:c}).then(async o=>{let u=[],h;if(n?h=o.getData().result[n]:h=o.getData().result,u=[...u,...h],o.isMore()){let l=o;for(;l=await l.getNext(this.getHttpClient(K.v2)),l!==!1;){let g;if(n?g=l.getData().result[n]:g=l.getData().result,u=[...u,...g],s){const p=l.getTotal();s(p>0?Math.round(100*u.length/p):100)}}}return i.setData(u),s&&s(100),i})}async*fetchListMethod(e,t,s,n){ee.forcedLog(this._logger,"warning","The AbstractB24.fetchListMethod() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.fetchList.make(options) or b24.actions.v2.fetchList.make(options)",{class:"AbstractB24",method:"fetchListMethod",replacement:"b24.actions.v3.fetchList.make(options) | b24.actions.v2.fetchList.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const i={method:e,params:t,idKey:s,customKeyForResult:n===null?void 0:n};yield*this.actions.v2.fetchList.make(i)}async callBatch(e,t,s){ee.forcedLog(this._logger,"warning","The AbstractB24.callBatch() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.batch.make(options) or b24.actions.v2.batch.make(options)",{class:"AbstractB24",method:"callBatch",replacement:"b24.actions.v3.batch.make(options) | b24.actions.v2.batch.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const n=e,i={isHaltOnError:t??!0,returnAjaxResult:s??!1};return this.actions.v2.batch.make({calls:n,options:i})}async callBatchByChunk(e,t){ee.forcedLog(this._logger,"warning","The AbstractB24.callBatchByChunk() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.batchByChunk.make(options) or b24.actions.v2.batchByChunk.make(options)",{class:"AbstractB24",method:"callBatchByChunk",replacement:"b24.actions.v3.batchByChunk.make(options) | b24.actions.v2.batchByChunk.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const s=e,n={isHaltOnError:t,returnAjaxResult:!1};return this.actions.v2.batchByChunk.make({calls:s,options:n})}getHttpClient(e){switch(this._ensureInitialized(),e){case K.v3:if(this._httpV3===null)throw new ne({code:"JSSDK_CORE_B24_HTTP_V3_NOT_INIT",description:"HttpV3 not init",status:500});return this._httpV3;case K.v2:if(this._httpV2===null)throw new ne({code:"JSSDK_CORE_B24_HTTP_V2_NOT_INIT",description:"HttpV2 not init",status:500});return this._httpV2}throw new ne({code:"JSSDK_CORE_B24_API_WRONG",description:`Wrong Api Version ${e}`,status:500})}setHttpClient(e,t){switch(e){case K.v3:this._httpV3=t;return;case K.v2:this._httpV2=t;return}throw new ne({code:"JSSDK_CORE_B24_API_WRONG",description:`Wrong Api Version ${e}`,status:500})}setLogger(e){this._logger=e,this._actionsManager.setLogger(this._logger),this._toolsManager.setLogger(this._logger),nt.getAllApiVersions().forEach(t=>{this.getHttpClient(t).setLogger(this._logger)})}getLogger(){return this._logger}async setRestrictionManagerParams(e){const t=nt.getAllApiVersions().map(s=>this.getHttpClient(s).setRestrictionManagerParams(e));await Promise.allSettled(t)}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new ne({code:"JSSDK_CORE_B24_NOT_INIT",description:"B24 not initialized",status:500})}}function Yo(r,e){return a(function(){return r.apply(e,arguments)},"wrap")}a(Yo,"bind");const{toString:Sf}=Object.prototype,{getPrototypeOf:Zr}=Object,{iterator:Kr,toStringTag:Zo}=Symbol,Xr=(r=>e=>{const t=Sf.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),et=a(r=>(r=r.toLowerCase(),e=>Xr(e)===r),"kindOfTest"),Qr=a(r=>e=>typeof e===r,"typeOfTest"),{isArray:zt}=Array,Jt=Qr("undefined");function pr(r){return r!==null&&!Jt(r)&&r.constructor!==null&&!Jt(r.constructor)&&Fe(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}a(pr,"isBuffer$1");const Ko=et("ArrayBuffer");function vf(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Ko(r.buffer),e}a(vf,"isArrayBufferView");const Ef=Qr("string"),Fe=Qr("function"),Xo=Qr("number"),gr=a(r=>r!==null&&typeof r=="object","isObject"),Of=a(r=>r===!0||r===!1,"isBoolean"),es=a(r=>{if(Xr(r)!=="object")return!1;const e=Zr(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Zo in r)&&!(Kr in r)},"isPlainObject"),Tf=a(r=>{if(!gr(r)||pr(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},"isEmptyObject"),kf=et("Date"),If=et("File"),Af=a(r=>!!(r&&typeof r.uri<"u"),"isReactNativeBlob"),Rf=a(r=>r&&typeof r.getParts<"u","isReactNative"),Cf=et("Blob"),Nf=et("FileList"),Df=a(r=>gr(r)&&Fe(r.pipe),"isStream");function Mf(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}a(Mf,"getGlobal");const Qo=Mf(),ea=typeof Qo.FormData<"u"?Qo.FormData:void 0,Pf=a(r=>{if(!r)return!1;if(ea&&r instanceof ea)return!0;const e=Zr(r);if(!e||e===Object.prototype||!Fe(r.append))return!1;const t=Xr(r);return t==="formdata"||t==="object"&&Fe(r.toString)&&r.toString()==="[object FormData]"},"isFormData"),Lf=et("URLSearchParams"),[Ff,xf,$f,jf]=["ReadableStream","Request","Response","Headers"].map(et),Bf=a(r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function mr(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let s,n;if(typeof r!="object"&&(r=[r]),zt(r))for(s=0,n=r.length;s<n;s++)e.call(null,r[s],s,r);else{if(pr(r))return;const i=t?Object.getOwnPropertyNames(r):Object.keys(r),c=i.length;let o;for(s=0;s<c;s++)o=i[s],e.call(null,r[o],o,r)}}a(mr,"forEach");function ta(r,e){if(pr(r))return null;e=e.toLowerCase();const t=Object.keys(r);let s=t.length,n;for(;s-- >0;)if(n=t[s],e===n.toLowerCase())return n;return null}a(ta,"findKey");const At=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ra=a(r=>!Jt(r)&&r!==At,"isContextDefined");function yn(){const{caseless:r,skipUndefined:e}=ra(this)&&this||{},t={},s=a((n,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const c=r&&ta(t,i)||i;es(t[c])&&es(n)?t[c]=yn(t[c],n):es(n)?t[c]=yn({},n):zt(n)?t[c]=n.slice():(!e||!Jt(n))&&(t[c]=n)},"assignValue");for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&mr(arguments[n],s);return t}a(yn,"merge");const Uf=a((r,e,t,{allOwnKeys:s}={})=>(mr(e,(n,i)=>{t&&Fe(n)?Object.defineProperty(r,i,{value:Yo(n,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,i,{value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),r),"extend"),Vf=a(r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),"stripBOM"),qf=a((r,e,t,s)=>{r.prototype=Object.create(e.prototype,s),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},"inherits"),Wf=a((r,e,t,s)=>{let n,i,c;const o={};if(e=e||{},r==null)return e;do{for(n=Object.getOwnPropertyNames(r),i=n.length;i-- >0;)c=n[i],(!s||s(c,r,e))&&!o[c]&&(e[c]=r[c],o[c]=!0);r=t!==!1&&Zr(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},"toFlatObject"),Hf=a((r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const s=r.indexOf(e,t);return s!==-1&&s===t},"endsWith"),zf=a(r=>{if(!r)return null;if(zt(r))return r;let e=r.length;if(!Xo(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},"toArray"),Jf=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&Zr(Uint8Array)),Gf=a((r,e)=>{const s=(r&&r[Kr]).call(r);let n;for(;(n=s.next())&&!n.done;){const i=n.value;e.call(r,i[0],i[1])}},"forEachEntry"),Yf=a((r,e)=>{let t;const s=[];for(;(t=r.exec(e))!==null;)s.push(t);return s},"matchAll"),Zf=et("HTMLFormElement"),Kf=a(r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,a(function(t,s,n){return s.toUpperCase()+n},"replacer")),"toCamelCase"),sa=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),Xf=et("RegExp"),na=a((r,e)=>{const t=Object.getOwnPropertyDescriptors(r),s={};mr(t,(n,i)=>{let c;(c=e(n,i,r))!==!1&&(s[i]=c||n)}),Object.defineProperties(r,s)},"reduceDescriptors"),Qf=a(r=>{na(r,(e,t)=>{if(Fe(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const s=r[t];if(Fe(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),ep=a((r,e)=>{const t={},s=a(n=>{n.forEach(i=>{t[i]=!0})},"define");return zt(r)?s(r):s(String(r).split(e)),t},"toObjectSet"),tp=a(()=>{},"noop"),rp=a((r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,"toFiniteNumber");function sp(r){return!!(r&&Fe(r.append)&&r[Zo]==="FormData"&&r[Kr])}a(sp,"isSpecCompliantForm");const np=a(r=>{const e=new Array(10),t=a((s,n)=>{if(gr(s)){if(e.indexOf(s)>=0)return;if(pr(s))return s;if(!("toJSON"in s)){e[n]=s;const i=zt(s)?[]:{};return mr(s,(c,o)=>{const u=t(c,n+1);!Jt(u)&&(i[o]=u)}),e[n]=void 0,i}}return s},"visit");return t(r,0)},"toJSONObject"),ip=et("AsyncFunction"),op=a(r=>r&&(gr(r)||Fe(r))&&Fe(r.then)&&Fe(r.catch),"isThenable"),ia=((r,e)=>r?setImmediate:e?((t,s)=>(At.addEventListener("message",({source:n,data:i})=>{n===At&&i===t&&s.length&&s.shift()()},!1),n=>{s.push(n),At.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Fe(At.postMessage)),ap=typeof queueMicrotask<"u"?queueMicrotask.bind(At):typeof process<"u"&&process.nextTick||ia,O={isArray:zt,isArrayBuffer:Ko,isBuffer:pr,isFormData:Pf,isArrayBufferView:vf,isString:Ef,isNumber:Xo,isBoolean:Of,isObject:gr,isPlainObject:es,isEmptyObject:Tf,isReadableStream:Ff,isRequest:xf,isResponse:$f,isHeaders:jf,isUndefined:Jt,isDate:kf,isFile:If,isReactNativeBlob:Af,isReactNative:Rf,isBlob:Cf,isRegExp:Xf,isFunction:Fe,isStream:Df,isURLSearchParams:Lf,isTypedArray:Jf,isFileList:Nf,forEach:mr,merge:yn,extend:Uf,trim:Bf,stripBOM:Vf,inherits:qf,toFlatObject:Wf,kindOf:Xr,kindOfTest:et,endsWith:Hf,toArray:zf,forEachEntry:Gf,matchAll:Yf,isHTMLForm:Zf,hasOwnProperty:sa,hasOwnProp:sa,reduceDescriptors:na,freezeMethods:Qf,toObjectSet:ep,toCamelCase:Kf,noop:tp,toFiniteNumber:rp,findKey:ta,global:At,isContextDefined:ra,isSpecCompliantForm:sp,toJSONObject:np,isAsyncFn:ip,isThenable:op,setImmediate:ia,asap:ap,isIterable:a(r=>r!=null&&Fe(r[Kr]),"isIterable")};let q=class Pc extends Error{static{a(this,"AxiosError")}static from(e,t,s,n,i,c){const o=new Pc(e.message,t||e.code,s,n,i);return o.cause=e,o.name=e.name,e.status!=null&&o.status==null&&(o.status=e.status),c&&Object.assign(o,c),o}constructor(e,t,s,n,i){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),s&&(this.config=s),n&&(this.request=n),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:O.toJSONObject(this.config),code:this.code,status:this.status}}};q.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",q.ERR_BAD_OPTION="ERR_BAD_OPTION",q.ECONNABORTED="ECONNABORTED",q.ETIMEDOUT="ETIMEDOUT",q.ERR_NETWORK="ERR_NETWORK",q.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",q.ERR_DEPRECATED="ERR_DEPRECATED",q.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",q.ERR_BAD_REQUEST="ERR_BAD_REQUEST",q.ERR_CANCELED="ERR_CANCELED",q.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",q.ERR_INVALID_URL="ERR_INVALID_URL",q.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const cp=null;function bn(r){return O.isPlainObject(r)||O.isArray(r)}a(bn,"isVisitable");function oa(r){return O.endsWith(r,"[]")?r.slice(0,-2):r}a(oa,"removeBrackets");function _n(r,e,t){return r?r.concat(e).map(a(function(n,i){return n=oa(n),!t&&i?"["+n+"]":n},"each")).join(t?".":""):e}a(_n,"renderKey");function lp(r){return O.isArray(r)&&!r.some(bn)}a(lp,"isFlatArray");const up=O.toFlatObject(O,{},null,a(function(e){return/^is[A-Z]/.test(e)},"filter"));function ts(r,e,t){if(!O.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=O.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,a(function(y,b){return!O.isUndefined(b[y])},"defined"));const s=t.metaTokens,n=t.visitor||g,i=t.dots,c=t.indexes,o=t.Blob||typeof Blob<"u"&&Blob,u=t.maxDepth===void 0?100:t.maxDepth,h=o&&O.isSpecCompliantForm(e);if(!O.isFunction(n))throw new TypeError("visitor must be a function");function l(m){if(m===null)return"";if(O.isDate(m))return m.toISOString();if(O.isBoolean(m))return m.toString();if(!h&&O.isBlob(m))throw new q("Blob is not supported. Use a Buffer instead.");return O.isArrayBuffer(m)||O.isTypedArray(m)?h&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}a(l,"convertValue");function g(m,y,b){let _=m;if(O.isReactNative(e)&&O.isReactNativeBlob(m))return e.append(_n(b,y,i),l(m)),!1;if(m&&!b&&typeof m=="object"){if(O.endsWith(y,"{}"))y=s?y:y.slice(0,-2),m=JSON.stringify(m);else if(O.isArray(m)&&lp(m)||(O.isFileList(m)||O.endsWith(y,"[]"))&&(_=O.toArray(m)))return y=oa(y),_.forEach(a(function(S,T){!(O.isUndefined(S)||S===null)&&e.append(c===!0?_n([y],T,i):c===null?y:y+"[]",l(S))},"each")),!1}return bn(m)?!0:(e.append(_n(b,y,i),l(m)),!1)}a(g,"defaultVisitor");const p=[],f=Object.assign(up,{defaultVisitor:g,convertValue:l,isVisitable:bn});function d(m,y,b=0){if(!O.isUndefined(m)){if(b>u)throw new q("Object is too deeply nested ("+b+" levels). Max depth: "+u,q.ERR_FORM_DATA_DEPTH_EXCEEDED);if(p.indexOf(m)!==-1)throw Error("Circular reference detected in "+y.join("."));p.push(m),O.forEach(m,a(function(w,S){(!(O.isUndefined(w)||w===null)&&n.call(e,w,O.isString(S)?S.trim():S,y,f))===!0&&d(w,y?y.concat(S):[S],b+1)},"each")),p.pop()}}if(a(d,"build"),!O.isObject(r))throw new TypeError("data must be an object");return d(r),e}a(ts,"toFormData$1");function aa(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(r).replace(/[!'()~]|%20/g,a(function(s){return e[s]},"replacer"))}a(aa,"encode$2");function wn(r,e){this._pairs=[],r&&ts(r,this,e)}a(wn,"AxiosURLSearchParams");const ca=wn.prototype;ca.append=a(function(e,t){this._pairs.push([e,t])},"append"),ca.toString=a(function(e){const t=e?function(s){return e.call(this,s,aa)}:aa;return this._pairs.map(a(function(n){return t(n[0])+"="+t(n[1])},"each"),"").join("&")},"toString");function hp(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}a(hp,"encode$1");function la(r,e,t){if(!e)return r;const s=t&&t.encode||hp,n=O.isFunction(t)?{serialize:t}:t,i=n&&n.serialize;let c;if(i?c=i(e,n):c=O.isURLSearchParams(e)?e.toString():new wn(e,n).toString(s),c){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+c}return r}a(la,"buildURL");class ua{static{a(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){O.forEach(this.handlers,a(function(s){s!==null&&e(s)},"forEachHandler"))}}const Sn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},dp={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:wn,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},vn=typeof window<"u"&&typeof document<"u",En=typeof navigator=="object"&&navigator||void 0,fp=vn&&(!En||["ReactNative","NativeScript","NS"].indexOf(En.product)<0),pp=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",gp=vn&&window.location.href||"http://localhost",Ce={...{__proto__:null,hasBrowserEnv:vn,hasStandardBrowserEnv:fp,hasStandardBrowserWebWorkerEnv:pp,navigator:En,origin:gp},...dp};function mp(r,e){return ts(r,new Ce.classes.URLSearchParams,{visitor:a(function(t,s,n,i){return Ce.isNode&&O.isBuffer(t)?(this.append(s,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},"visitor"),...e})}a(mp,"toURLEncodedForm");function yp(r){return O.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}a(yp,"parsePropPath");function bp(r){const e={},t=Object.keys(r);let s;const n=t.length;let i;for(s=0;s<n;s++)i=t[s],e[i]=r[i];return e}a(bp,"arrayToObject");function ha(r){function e(t,s,n,i){let c=t[i++];if(c==="__proto__")return!0;const o=Number.isFinite(+c),u=i>=t.length;return c=!c&&O.isArray(n)?n.length:c,u?(O.hasOwnProp(n,c)?n[c]=O.isArray(n[c])?n[c].concat(s):[n[c],s]:n[c]=s,!o):((!n[c]||!O.isObject(n[c]))&&(n[c]=[]),e(t,s,n[c],i)&&O.isArray(n[c])&&(n[c]=bp(n[c])),!o)}if(a(e,"buildPath"),O.isFormData(r)&&O.isFunction(r.entries)){const t={};return O.forEachEntry(r,(s,n)=>{e(yp(s),n,t,0)}),t}return null}a(ha,"formDataToJSON");const Gt=a((r,e)=>r!=null&&O.hasOwnProp(r,e)?r[e]:void 0,"own");function _p(r,e,t){if(O.isString(r))try{return(e||JSON.parse)(r),O.trim(r)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(r)}a(_p,"stringifySafely");const yr={transitional:Sn,adapter:["xhr","http","fetch"],transformRequest:[a(function(e,t){const s=t.getContentType()||"",n=s.indexOf("application/json")>-1,i=O.isObject(e);if(i&&O.isHTMLForm(e)&&(e=new FormData(e)),O.isFormData(e))return n?JSON.stringify(ha(e)):e;if(O.isArrayBuffer(e)||O.isBuffer(e)||O.isStream(e)||O.isFile(e)||O.isBlob(e)||O.isReadableStream(e))return e;if(O.isArrayBufferView(e))return e.buffer;if(O.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){const u=Gt(this,"formSerializer");if(s.indexOf("application/x-www-form-urlencoded")>-1)return mp(e,u).toString();if((o=O.isFileList(e))||s.indexOf("multipart/form-data")>-1){const h=Gt(this,"env"),l=h&&h.FormData;return ts(o?{"files[]":e}:e,l&&new l,u)}}return i||n?(t.setContentType("application/json",!1),_p(e)):e},"transformRequest")],transformResponse:[a(function(e){const t=Gt(this,"transitional")||yr.transitional,s=t&&t.forcedJSONParsing,n=Gt(this,"responseType"),i=n==="json";if(O.isResponse(e)||O.isReadableStream(e))return e;if(e&&O.isString(e)&&(s&&!n||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,Gt(this,"parseReviver"))}catch(u){if(o)throw u.name==="SyntaxError"?q.from(u,q.ERR_BAD_RESPONSE,this,null,Gt(this,"response")):u}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ce.classes.FormData,Blob:Ce.classes.Blob},validateStatus:a(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};O.forEach(["delete","get","head","post","put","patch"],r=>{yr.headers[r]={}});const wp=O.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Sp=a(r=>{const e={};let t,s,n;return r&&r.split(`
|
|
42
|
-
`).forEach(a(function(c){n=c.indexOf(":"),t=c.substring(0,n).trim().toLowerCase(),s=c.substring(n+1).trim(),!(!t||e[t]&&
|
|
43
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach(n=>s.set(n)),s}static accessor(e){const s=(this[da]=this[da]={accessors:{}}).accessors,n=this.prototype;function i(c){const o=br(c);s[o]||(Ap(n,c),s[o]=!0)}return a(i,"defineAccessor"),O.isArray(e)?e.forEach(i):i(e),this}};xe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),O.reduceDescriptors(xe.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:a(()=>r,"get"),set(s){this[t]=s}}}),O.freezeMethods(xe);function Tn(r,e){const t=this||yr,s=e||t,n=xe.from(s.headers);let i=s.data;return O.forEach(r,a(function(o){i=o.call(t,i,n.normalize(),e?e.status:void 0)},"transform")),n.normalize(),i}a(Tn,"transformData");function fa(r){return!!(r&&r.__CANCEL__)}a(fa,"isCancel$1");let _r=class extends q{static{a(this,"CanceledError")}constructor(e,t,s){super(e??"canceled",q.ERR_CANCELED,t,s),this.name="CanceledError",this.__CANCEL__=!0}};function pa(r,e,t){const s=t.config.validateStatus;!t.status||!s||s(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))}a(pa,"settle");function Rp(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}a(Rp,"parseProtocol");function Cp(r,e){r=r||10;const t=new Array(r),s=new Array(r);let n=0,i=0,c;return e=e!==void 0?e:1e3,a(function(u){const h=Date.now(),l=s[i];c||(c=h),t[n]=u,s[n]=h;let g=i,p=0;for(;g!==n;)p+=t[g++],g=g%r;if(n=(n+1)%r,n===i&&(i=(i+1)%r),h-c<e)return;const f=l&&h-l;return f?Math.round(p*1e3/f):void 0},"push")}a(Cp,"speedometer");function Np(r,e){let t=0,s=1e3/e,n,i;const c=a((h,l=Date.now())=>{t=l,n=null,i&&(clearTimeout(i),i=null),r(...h)},"invoke");return[a((...h)=>{const l=Date.now(),g=l-t;g>=s?c(h,l):(n=h,i||(i=setTimeout(()=>{i=null,c(n)},s-g)))},"throttled"),a(()=>n&&c(n),"flush")]}a(Np,"throttle");const ss=a((r,e,t=3)=>{let s=0;const n=Cp(50,250);return Np(i=>{const c=i.loaded,o=i.lengthComputable?i.total:void 0,u=o!=null?Math.min(c,o):c,h=Math.max(0,u-s),l=n(h);s=Math.max(s,u);const g={loaded:u,total:o,progress:o?u/o:void 0,bytes:h,rate:l||void 0,estimated:l&&o?(o-u)/l:void 0,event:i,lengthComputable:o!=null,[e?"download":"upload"]:!0};r(g)},t)},"progressEventReducer"),ga=a((r,e)=>{const t=r!=null;return[s=>e[0]({lengthComputable:t,total:r,loaded:s}),e[1]]},"progressEventDecorator"),ma=a(r=>(...e)=>O.asap(()=>r(...e)),"asyncDecorator"),Dp=Ce.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,Ce.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(Ce.origin),Ce.navigator&&/(msie|trident)/i.test(Ce.navigator.userAgent)):()=>!0,Mp=Ce.hasStandardBrowserEnv?{write(r,e,t,s,n,i,c){if(typeof document>"u")return;const o=[`${r}=${encodeURIComponent(e)}`];O.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),O.isString(s)&&o.push(`path=${s}`),O.isString(n)&&o.push(`domain=${n}`),i===!0&&o.push("secure"),O.isString(c)&&o.push(`SameSite=${c}`),document.cookie=o.join("; ")},read(r){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+r+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Pp(r){return typeof r!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}a(Pp,"isAbsoluteURL");function Lp(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}a(Lp,"combineURLs");function ya(r,e,t){let s=!Pp(e);return r&&(s||t===!1)?Lp(r,e):e}a(ya,"buildFullPath");const ba=a(r=>r instanceof xe?{...r}:r,"headersToObject");function Rt(r,e){e=e||{};const t=Object.create(null);Object.defineProperty(t,"hasOwnProperty",{value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function s(h,l,g,p){return O.isPlainObject(h)&&O.isPlainObject(l)?O.merge.call({caseless:p},h,l):O.isPlainObject(l)?O.merge({},l):O.isArray(l)?l.slice():l}a(s,"getMergedValue");function n(h,l,g,p){if(O.isUndefined(l)){if(!O.isUndefined(h))return s(void 0,h,g,p)}else return s(h,l,g,p)}a(n,"mergeDeepProperties");function i(h,l){if(!O.isUndefined(l))return s(void 0,l)}a(i,"valueFromConfig2");function c(h,l){if(O.isUndefined(l)){if(!O.isUndefined(h))return s(void 0,h)}else return s(void 0,l)}a(c,"defaultToConfig2");function o(h,l,g){if(O.hasOwnProp(e,g))return s(h,l);if(O.hasOwnProp(r,g))return s(void 0,h)}a(o,"mergeDirectKeys");const u={url:i,method:i,data:i,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,allowedSocketPaths:c,responseEncoding:c,validateStatus:o,headers:a((h,l,g)=>n(ba(h),ba(l),g,!0),"headers")};return O.forEach(Object.keys({...r,...e}),a(function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const g=O.hasOwnProp(u,l)?u[l]:n,p=O.hasOwnProp(r,l)?r[l]:void 0,f=O.hasOwnProp(e,l)?e[l]:void 0,d=g(p,f,l);O.isUndefined(d)&&g!==o||(t[l]=d)},"computeConfigValue")),t}a(Rt,"mergeConfig$1");const _a=a(r=>{const e=Rt({},r),t=a(p=>O.hasOwnProp(e,p)?e[p]:void 0,"own"),s=t("data");let n=t("withXSRFToken");const i=t("xsrfHeaderName"),c=t("xsrfCookieName");let o=t("headers");const u=t("auth"),h=t("baseURL"),l=t("allowAbsoluteUrls"),g=t("url");if(e.headers=o=xe.from(o),e.url=la(ya(h,g,l),r.params,r.paramsSerializer),u&&o.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),O.isFormData(s)){if(Ce.hasStandardBrowserEnv||Ce.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(O.isFunction(s.getHeaders)){const p=s.getHeaders(),f=["content-type","content-length"];Object.entries(p).forEach(([d,m])=>{f.includes(d.toLowerCase())&&o.set(d,m)})}}if(Ce.hasStandardBrowserEnv&&(O.isFunction(n)&&(n=n(e)),n===!0||n==null&&Dp(e.url))){const f=i&&c&&Mp.read(c);f&&o.set(i,f)}return e},"resolveConfig"),Fp=typeof XMLHttpRequest<"u"&&function(r){return new Promise(a(function(t,s){const n=_a(r);let i=n.data;const c=xe.from(n.headers).normalize();let{responseType:o,onUploadProgress:u,onDownloadProgress:h}=n,l,g,p,f,d;function m(){f&&f(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}a(m,"done");let y=new XMLHttpRequest;y.open(n.method.toUpperCase(),n.url,!0),y.timeout=n.timeout;function b(){if(!y)return;const w=xe.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),T={data:!o||o==="text"||o==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:w,config:r,request:y};pa(a(function(I){t(I),m()},"_resolve"),a(function(I){s(I),m()},"_reject"),T),y=null}a(b,"onloadend"),"onloadend"in y?y.onloadend=b:y.onreadystatechange=a(function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(b)},"handleLoad"),y.onabort=a(function(){y&&(s(new q("Request aborted",q.ECONNABORTED,r,y)),y=null)},"handleAbort"),y.onerror=a(function(S){const T=S&&S.message?S.message:"Network Error",v=new q(T,q.ERR_NETWORK,r,y);v.event=S||null,s(v),y=null},"handleError"),y.ontimeout=a(function(){let S=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const T=n.transitional||Sn;n.timeoutErrorMessage&&(S=n.timeoutErrorMessage),s(new q(S,T.clarifyTimeoutError?q.ETIMEDOUT:q.ECONNABORTED,r,y)),y=null},"handleTimeout"),i===void 0&&c.setContentType(null),"setRequestHeader"in y&&O.forEach(c.toJSON(),a(function(S,T){y.setRequestHeader(T,S)},"setRequestHeader")),O.isUndefined(n.withCredentials)||(y.withCredentials=!!n.withCredentials),o&&o!=="json"&&(y.responseType=n.responseType),h&&([p,d]=ss(h,!0),y.addEventListener("progress",p)),u&&y.upload&&([g,f]=ss(u),y.upload.addEventListener("progress",g),y.upload.addEventListener("loadend",f)),(n.cancelToken||n.signal)&&(l=a(w=>{y&&(s(!w||w.type?new _r(null,r,y):w),y.abort(),y=null)},"onCanceled"),n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const _=Rp(n.url);if(_&&Ce.protocols.indexOf(_)===-1){s(new q("Unsupported protocol "+_+":",q.ERR_BAD_REQUEST,r));return}y.send(i||null)},"dispatchXhrRequest"))},xp=a((r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let s=new AbortController,n;const i=a(function(h){if(!n){n=!0,o();const l=h instanceof Error?h:this.reason;s.abort(l instanceof q?l:new _r(l instanceof Error?l.message:l))}},"onabort");let c=e&&setTimeout(()=>{c=null,i(new q(`timeout of ${e}ms exceeded`,q.ETIMEDOUT))},e);const o=a(()=>{r&&(c&&clearTimeout(c),c=null,r.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),r=null)},"unsubscribe");r.forEach(h=>h.addEventListener("abort",i));const{signal:u}=s;return u.unsubscribe=()=>O.asap(o),u}},"composeSignals"),$p=a(function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let s=0,n;for(;s<t;)n=s+e,yield r.slice(s,n),s=n},"streamChunk"),jp=a(async function*(r,e){for await(const t of Bp(r))yield*$p(t,e)},"readBytes"),Bp=a(async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:s}=await e.read();if(t)break;yield s}}finally{await e.cancel()}},"readStream"),wa=a((r,e,t,s)=>{const n=jp(r,e);let i=0,c,o=a(u=>{c||(c=!0,s&&s(u))},"_onFinish");return new ReadableStream({async pull(u){try{const{done:h,value:l}=await n.next();if(h){o(),u.close();return}let g=l.byteLength;if(t){let p=i+=g;t(p)}u.enqueue(new Uint8Array(l))}catch(h){throw o(h),h}},cancel(u){return o(u),n.return()}},{highWaterMark:2})},"trackStream"),Sa=64*1024,{isFunction:ns}=O,Up=(({Request:r,Response:e})=>({Request:r,Response:e}))(O.global),{ReadableStream:va,TextEncoder:Ea}=O.global,Oa=a((r,...e)=>{try{return!!r(...e)}catch{return!1}},"test"),Vp=a(r=>{r=O.merge.call({skipUndefined:!0},Up,r);const{fetch:e,Request:t,Response:s}=r,n=e?ns(e):typeof fetch=="function",i=ns(t),c=ns(s);if(!n)return!1;const o=n&&ns(va),u=n&&(typeof Ea=="function"?(d=>m=>d.encode(m))(new Ea):async d=>new Uint8Array(await new t(d).arrayBuffer())),h=i&&o&&Oa(()=>{let d=!1;const m=new t(Ce.origin,{body:new va,method:"POST",get duplex(){return d=!0,"half"}}),y=m.headers.has("Content-Type");return m.body!=null&&m.body.cancel(),d&&!y}),l=c&&o&&Oa(()=>O.isReadableStream(new s("").body)),g={stream:l&&(d=>d.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!g[d]&&(g[d]=(m,y)=>{let b=m&&m[d];if(b)return b.call(m);throw new q(`Response type '${d}' is not supported`,q.ERR_NOT_SUPPORT,y)})});const p=a(async d=>{if(d==null)return 0;if(O.isBlob(d))return d.size;if(O.isSpecCompliantForm(d))return(await new t(Ce.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(O.isArrayBufferView(d)||O.isArrayBuffer(d))return d.byteLength;if(O.isURLSearchParams(d)&&(d=d+""),O.isString(d))return(await u(d)).byteLength},"getBodyLength"),f=a(async(d,m)=>{const y=O.toFiniteNumber(d.getContentLength());return y??p(m)},"resolveBodyLength");return async d=>{let{url:m,method:y,data:b,signal:_,cancelToken:w,timeout:S,onDownloadProgress:T,onUploadProgress:v,responseType:I,headers:E,withCredentials:k="same-origin",fetchOptions:D}=_a(d),B=e||fetch;I=I?(I+"").toLowerCase():"text";let U=xp([_,w&&w.toAbortSignal()],S),oe=null;const _e=U&&U.unsubscribe&&(()=>{U.unsubscribe()});let G;try{if(v&&h&&y!=="get"&&y!=="head"&&(G=await f(E,b))!==0){let ge=new t(m,{method:"POST",body:b,duplex:"half"}),Le;if(O.isFormData(b)&&(Le=ge.headers.get("content-type"))&&E.setContentType(Le),ge.body){const[We,Z]=ga(G,ss(ma(v)));b=wa(ge.body,Sa,We,Z)}}O.isString(k)||(k=k?"include":"omit");const X=i&&"credentials"in t.prototype;if(O.isFormData(b)){const ge=E.getContentType();ge&&/^multipart\/form-data/i.test(ge)&&!/boundary=/i.test(ge)&&E.delete("content-type")}const W={...D,signal:U,method:y.toUpperCase(),headers:E.normalize().toJSON(),body:b,duplex:"half",credentials:X?k:void 0};oe=i&&new t(m,W);let ce=await(i?B(oe,D):B(m,W));const ue=l&&(I==="stream"||I==="response");if(l&&(T||ue&&_e)){const ge={};["status","statusText","headers"].forEach(ae=>{ge[ae]=ce[ae]});const Le=O.toFiniteNumber(ce.headers.get("content-length")),[We,Z]=T&&ga(Le,ss(ma(T),!0))||[];ce=new s(wa(ce.body,Sa,We,()=>{Z&&Z(),_e&&_e()}),ge)}I=I||"text";let j=await g[O.findKey(g,I)||"text"](ce,d);return!ue&&_e&&_e(),await new Promise((ge,Le)=>{pa(ge,Le,{data:j,headers:xe.from(ce.headers),status:ce.status,statusText:ce.statusText,config:d,request:oe})})}catch(X){throw _e&&_e(),X&&X.name==="TypeError"&&/Load failed|fetch/i.test(X.message)?Object.assign(new q("Network Error",q.ERR_NETWORK,d,oe,X&&X.response),{cause:X.cause||X}):q.from(X,X&&X.code,d,oe,X&&X.response)}}},"factory"),qp=new Map,Ta=a(r=>{let e=r&&r.env||{};const{fetch:t,Request:s,Response:n}=e,i=[s,n,t];let c=i.length,o=c,u,h,l=qp;for(;o--;)u=i[o],h=l.get(u),h===void 0&&l.set(u,h=o?new Map:Vp(e)),l=h;return h},"getFetch");Ta();const kn={http:cp,xhr:Fp,fetch:{get:Ta}};O.forEach(kn,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const ka=a(r=>`- ${r}`,"renderReason"),Wp=a(r=>O.isFunction(r)||r===null||r===!1,"isResolvedHandle");function Hp(r,e){r=O.isArray(r)?r:[r];const{length:t}=r;let s,n;const i={};for(let c=0;c<t;c++){s=r[c];let o;if(n=s,!Wp(s)&&(n=kn[(o=String(s)).toLowerCase()],n===void 0))throw new q(`Unknown adapter '${o}'`);if(n&&(O.isFunction(n)||(n=n.get(e))))break;i[o||"#"+c]=n}if(!n){const c=Object.entries(i).map(([u,h])=>`adapter ${u} `+(h===!1?"is not supported by the environment":"is not available in the build"));let o=t?c.length>1?`since :
|
|
44
|
-
`+c.map(
|
|
45
|
-
`):" "+
|
|
40
|
+
`))}}var rd=Object.defineProperty,sd=a((r,e)=>rd(r,"name",{value:e,configurable:!0}),"i$e");class mr extends Fe{static{a(this,"AjaxResult")}static{sd(this,"AjaxResult")}_status;_query;_data;constructor(e){super(),this._data=e.answer?Object.freeze(e.answer):void 0,this._query=Object.freeze(structuredClone(e.query)),this._status=e.status,this.#r()}get isSuccess(){return this.#e()}#e(){return this._errors.size===0}getData(){if(!this.isSuccess)return;const e=this._data;return Object.freeze({result:e.result,time:e.time})}#r(){if(this._data&&typeof this._data=="object"&&"error"in this._data){const e=this._data;if(e.error&&typeof e.error=="object"&&"code"in e.error){const t=e.error.code;let s=e.error.message.trimEnd();e.error.validation&&(s.length>0&&(s.endsWith(".")||(s+="."),s+=" "),e.error.validation.forEach(n=>{s+=`${n?.message||JSON.stringify(n)}`})),this.addError(this.#s({code:t,description:s,status:this._status}),"base-error")}else if(e.error&&typeof e.error=="string"){const t=e.error!=="0"?e.error:"JSSDK_RESPONSE_ERROR",s=e?.error_description??"Some error in response";this.addError(this.#s({code:t,description:s,status:this._status}),"base-error")}}}#s(e){return new we({code:e.code,description:e.description,status:e.status,requestInfo:{method:this._query.method,params:this._query.params,requestId:this._query.requestId}})}hasMore(){return this.isMore()}isMore(){if(!this.isSuccess)return!1;const e=this._data,t="next"in e?e.next:void 0;return P.isNumber(t)}getTotal(){if(!this.isSuccess)return 0;const e=this._data,t="total"in e?e.total:void 0;return J.toInteger(t)}getStatus(){return this._status}getQuery(){return this._query}async fetchNext(e){const t=await this.getNext(e);return t===!1?null:t}async getNext(e){if(e.apiVersion===X.v3)throw new ce({code:"JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",description:"restApi:v3 not support method getNext",status:500});if(!this.isSuccess||!this.isMore())return!1;const t=this.#t();return e.call(t.method,t.params)}#t(){const e={...this._query},t=this._data,s="next"in t?t.next:void 0;return e.params.start=J.toInteger(J.toInteger(s)),e}setData(){throw new ReferenceError("AjaxResult does not allow data modification")}}var nd=Object.defineProperty,id=a((r,e)=>nd(r,"name",{value:e,configurable:!0}),"a$f");class sn{static{a(this,"ParamsFactory")}static{id(this,"ParamsFactory")}static getDefault(){return{rateLimit:{burstLimit:50,drainRate:2,adaptiveEnabled:!0},operatingLimit:{windowMs:6e5,limitMs:48e4,heavyPercent:80},adaptiveConfig:{enabled:!0,thresholdPercent:80,coefficient:.01,maxDelay:7e3},maxRetries:3,retryDelay:1e3,retryOnNetworkError:!0}}static getEnterprise(){return{...this.getDefault(),rateLimit:{burstLimit:250,drainRate:5,adaptiveEnabled:!0}}}static getBatchProcessing(){return{...this.getDefault(),rateLimit:{burstLimit:30,drainRate:1,adaptiveEnabled:!0},operatingLimit:{windowMs:6e5,limitMs:48e4,heavyPercent:50},adaptiveConfig:{enabled:!0,thresholdPercent:50,coefficient:.015,maxDelay:1e4},maxRetries:5}}static getRealtime(){return{...this.getDefault(),adaptiveConfig:{enabled:!1,thresholdPercent:100,coefficient:.001,maxDelay:48e4},maxRetries:1}}static fromTariffPlan(e){return e.toLowerCase()==="enterprise"?this.getEnterprise():this.getDefault()}}var od=Object.defineProperty,ad=a((r,e)=>od(r,"name",{value:e,configurable:!0}),"c$6");class Yo{static{a(this,"RateLimiter")}static{ad(this,"RateLimiter")}#e;#r;#s;#t;#i=[];#n;#o=5;#c=20;#h=.5;#f=5;#a=[];#l=[];_logger;constructor(e){this._logger=te.createNullLogger(),this.#t=e,this.#n={...e},this.#e=e.burstLimit,this.#r=Date.now(),this.#s=1e3/e.drainRate}getTitle(){return"rateLimiter"}setLogger(e){this._logger=e}getLogger(){return this._logger}async canProceed(e,t,s){await this.#u(e);try{const n=Date.now(),i=(n-this.#r)*this.#t.drainRate/1e3;return this.#e=Math.min(this.#t.burstLimit,this.#e+i),this.#r=n,this.#e>=1}finally{this.#d()}}async waitIfNeeded(e,t,s){await this.#u(e);try{const n=Date.now(),i=(n-this.#r)*this.#t.drainRate/1e3;if(this.#e=Math.min(this.#t.burstLimit,this.#e+i),this.#r=n,this.#e>=1)return this.#e-=1,0;const c=1-this.#e;return Math.ceil(c*this.#s)}finally{this.#d()}}async handleExceeded(e){await this.#u(e);try{return this.#b(),this.#t.adaptiveEnabled&&this.#p()&&this.#m(e),this.#e=0,this.#s+1e3}finally{this.#d()}}async updateStats(e,t,s){if(!t.startsWith("batch::")){await this.#u(e);try{this.#w(),this.#t.adaptiveEnabled&&this.#T(e),this.#t.adaptiveEnabled&&this.#g()&&this.#y(e)}finally{this.#d()}}}async reset(){await this.#u("reset");try{this.#e=this.#t.burstLimit,this.#r=Date.now(),this.#a=[],this.#l=[],this.#t.drainRate=this.#n.drainRate,this.#t.burstLimit=this.#n.burstLimit,this.#s=1e3/this.#t.drainRate}finally{this.#d()}}getStats(){return{tokens:this.#e,burstLimit:this.#t.burstLimit,originalBurstLimit:this.#n.burstLimit,drainRate:this.#t.drainRate,originalDrainRate:this.#n.drainRate,refillIntervalMs:this.#s,lastRefill:this.#r,pendingRequests:this.#i.length,recentErrors:this.#a.length,recentSuccesses:this.#l.length}}async setConfig(e){await this.#u("setConfig");try{this.#t=e,this.#n={...e},this.#s=1e3/this.#t.drainRate,e.burstLimit>this.#e&&(this.#e=Math.min(e.burstLimit,this.#e)),this.#a=[],this.#l=[]}finally{this.#d()}}async#u(e){return new Promise(t=>{const s=this.#i.push(t);s>1&&this.#O(e,s),this.#i.length===1&&t()})}#d(){if(this.#i.shift(),this.#i.length>0){const e=this.#i[0];e()}}#p(){return this.#a.length>=this.#o}#g(){return this.#l.length>=this.#c&&this.#a.length<this.#o/2&&(this.#t.drainRate<this.#n.drainRate||this.#t.burstLimit<this.#n.burstLimit)}#m(e){const t=Math.max(this.#h,Number.parseFloat((this.#t.drainRate*.8).toFixed(2))),s=Math.max(this.#f,Number.parseFloat((this.#t.burstLimit*.8).toFixed(2)));this.#t.drainRate=t,this.#t.burstLimit=s,this.#s=1e3/t,this.#v(e,t,s),this.#a=[],this.#l=[]}#y(e){if(this.#t.drainRate===this.#n.drainRate&&this.#t.burstLimit===this.#n.burstLimit)return;const t=Math.min(this.#n.drainRate,Number.parseFloat((this.#t.drainRate*1.1).toFixed(2))),s=Math.min(this.#n.burstLimit,Number.parseFloat((this.#t.burstLimit*1.1).toFixed(2)));this.#t.drainRate=t,this.#t.burstLimit=s,this.#s=1e3/t,this.#E(e,t,s),this.#a=[],this.#l=[]}#b(){const e=Date.now();this.#a.push(e),this.#l=[],this.#_(e)}#_(e){const t=e-6e4;this.#a=this.#a.filter(s=>s>t)}#w(){const e=Date.now();this.#l.push(e),this.#S(),this.#_(e)}#S(){this.#l=this.#l.slice(-1*this.#c)}#v(e,t,s){const n=this.#n.drainRate,i=t<n,c=this.#n.burstLimit,o=s<c;this.getLogger().warning(`${this.getTitle()} is lowering limits due to frequent errors`,{requestId:e,drainRate:{current:t,original:n,condition:i,formatted:`(${t} < ${n}) ${i}`},burstLimit:{current:s,original:c,condition:o,formatted:`(${s} < ${c}) ${o}`}})}#E(e,t,s){const n=this.#n.drainRate,i=t<n,c=this.#n.burstLimit,o=s<c;this.getLogger().warning(`${this.getTitle()} increases limits during stable operation`,{requestId:e,drainRate:{current:t,original:n,condition:i,formatted:`(${t} < ${n}) ${i}`},burstLimit:{current:s,original:c,condition:o,formatted:`(${s} < ${c}) ${o}`}})}#O(e,t){this.getLogger().debug(`${this.getTitle()} request in queue`,{requestId:e,queueLength:t})}#T(e){const t=this.#l.length,s=this.#c,n=t>=s,i=this.#a.length,c=this.#o,o=i<c/2,l=this.#t.drainRate,h=this.#n.drainRate,u=l<h,g=this.#t.burstLimit,p=this.#n.burstLimit,d=g<p;this.getLogger().debug(`${this.getTitle()} state`,{requestId:e,success:{count:t,threshold:s,condition:n,formatted:`(${t} >= ${s}) ${n}`},fail:{count:i,threshold:c/2,condition:o,formatted:`(${i} < ${c/2}) ${o}`},drainRate:{current:l,original:h,condition:u,formatted:`(${l} < ${h}) ${u}`},burstLimit:{current:g,original:p,condition:d,formatted:`(${g} < ${p}) ${d}`}})}}var cd=Object.defineProperty,ld=a((r,e)=>cd(r,"name",{value:e,configurable:!0}),"g$8");class Ko{static{a(this,"OperatingLimiter")}static{ld(this,"OperatingLimiter")}#e;#r=new Map;#s={heavyRequestCount:0};_logger;getTitle(){return"operatingLimiter"}constructor(e){this._logger=te.createNullLogger(),this.#e=e}setLogger(e){this._logger=e}getLogger(){return this._logger}get limitMs(){return this.#e.limitMs}getMethodStat(e){const t=this.#r.get(e);if(t)return t}async canProceed(e,t,s){return await this.getTimeToFree(e,t,s)===0}async waitIfNeeded(e,t,s){return this.getTimeToFree(e,t,s)}async getTimeToFree(e,t,s,n){if(this.#i(),t==="batch")return this.#t(e,s);const i=this.#r.get(t);if(!i)return 0;const c=Math.max(1e3,this.#e.limitMs-5e3);if(i.operating>=c){const o=Date.now();return i.operating_reset_at>o?i.operating_reset_at-o+1e3:5e3}return 0}async#t(e,t){let s=0;if(!t?.cmd||!Array.isArray(t.cmd))return s;const n=t.cmd.map(i=>i.split("?")[0]).filter(Boolean);for(const i of n){const c=await this.getTimeToFree(e,`batch::${i}`,{});s=Math.max(s,c)}return s}async updateStats(e,t,s){this.#i();const{operating:n,operating_reset_at:i}=s;if(n==null)return;this.#r.has(t)||this.#r.set(t,{operating:0,operating_reset_at:0,lastUpdated:Date.now()});const c=this.#r.get(t);c.operating=n*1e3,c.operating_reset_at=i*1e3,c.lastUpdated=Date.now();const o=c.operating/this.#e.limitMs*100;o>this.#e.heavyPercent&&(this.#s.heavyRequestCount++,this.#n(e,t,o,c.operating))}#i(){const e=Date.now(),t=this.#e.windowMs+1e4;for(const[s,n]of this.#r.entries())e-n.lastUpdated>t&&this.#r.delete(s)}async reset(){this.#r.clear(),this.#s={heavyRequestCount:0}}getStats(){const e={};for(const[t,s]of this.#r.entries())e[t]=Number.parseFloat((s.operating/1e3).toFixed(2));return{...this.#s,operatingStats:e}}async setConfig(e){this.#e=e}#n(e,t,s,n){this.getLogger().debug(`${this.getTitle()} detected limit for method ${t}`,{requestId:e,method:t,operating:{percent:Number.parseFloat(s.toFixed(2)),current:Number.parseFloat((n/1e3).toFixed(0)),max:Number.parseFloat((this.#e.limitMs/1e3).toFixed(0))}})}}var ud=Object.defineProperty,hd=a((r,e)=>ud(r,"name",{value:e,configurable:!0}),"l$7");class Zo{static{a(this,"AdaptiveDelayer")}static{hd(this,"AdaptiveDelayer")}#e;#r;#s={adaptiveDelays:0,totalAdaptiveDelay:0};_logger;getTitle(){return"adaptiveDelayer"}constructor(e,t){this._logger=te.createNullLogger(),this.#e=e,this.#r=t}setLogger(e){this._logger=e}getLogger(){return this._logger}async canProceed(e,t,s){return!0}async waitIfNeeded(e,t,s){if(!this.#e.enabled)return 0;const n=this.#t(e,t,s);return n>0&&(this.incrementAdaptiveDelays(),this.#s.totalAdaptiveDelay+=n),n}#t(e,t,s){if(t==="batch")return this.#i(e,s);const n=this.#r.getMethodStat(t);if(typeof n>"u")return 0;const i=n.operating/this.#r.limitMs*100;if(i>this.#e.thresholdPercent){let c=0;const o=Date.now();n.operating_reset_at>o?c+=(n.operating_reset_at-o)*this.#e.coefficient:c+=7e3;const l=Number.parseInt(Math.min(c,this.#e.maxDelay).toFixed(0));return this.#n(e,t,i,c,l),l}return 0}#i(e,t){let s=0;if(!t?.cmd||!Array.isArray(t.cmd))return s;const n=t.cmd.map(c=>c.split("?")[0]).filter(Boolean),i=[...new Set(n)];for(const c of i){const o=this.#t(e,`batch::${c}`,{});s=Math.max(s,o)}return s}async updateStats(e,t,s){}async reset(){this.#s={adaptiveDelays:0,totalAdaptiveDelay:0}}getStats(){return{...this.#s,adaptiveDelayAvg:this.#s.adaptiveDelays>0?this.#s.totalAdaptiveDelay/this.#s.adaptiveDelays:0}}async setConfig(e){this.#e=e}incrementAdaptiveDelays(){this.#s.adaptiveDelays++}#n(e,t,s,n,i){this.getLogger().debug(`${this.getTitle()} state for method ${t}`,{requestId:e,method:t,percent:Number.parseFloat(s.toFixed(2)),delays:{calculated:n,actual:i}})}}var dd=Object.defineProperty,fd=a((r,e)=>dd(r,"name",{value:e,configurable:!0}),"E$2");class gr{static{a(this,"RestrictionManager")}static{fd(this,"RestrictionManager")}#e;#r;#s;#t;#i={retries:0,consecutiveErrors:0,limitHits:0};#n=new Map;_logger;constructor(e){this._logger=te.createNullLogger(),this.#t=e,this.#e=new Yo(e.rateLimit),this.#r=new Ko(e.operatingLimit),this.#s=new Zo(e.adaptiveConfig,this.#r)}setLogger(e){this._logger=e,this.#e.setLogger(this._logger),this.#r.setLogger(this._logger),this.#s.setLogger(this._logger)}getLogger(){return this._logger}async applyOperatingLimits(e,t,s){const n=await this.#r.waitIfNeeded(e,t,s);if(n>0)this.incrementStats("limitHits"),this.#p(this.#r.getTitle(),e,t,n),await this.#d(n);else{const i=await this.#s.waitIfNeeded(e,t,s);i>0&&(this.incrementStats("limitHits"),this.#p(this.#s.getTitle(),e,t,i),await this.#d(i))}}async checkRateLimit(e,t){let s,n=1;do s=await this.#e.waitIfNeeded(e,t),s>0&&(this.incrementStats("limitHits"),this.#g(this.#e.getTitle(),e,t,s,n),await this.#d(s),n++);while(s>0)}async updateStats(e,t,s){await this.#r.updateStats(e,t,s),await this.#s.updateStats(e,t,s),await this.#e.updateStats(e,t,s)}async handleError(e,t,s,n,i){if(this.#o(n)){const c=await this.#c(e)*Math.pow(1.5,i);return this.#m(this.#e.getTitle(),e,"QUERY_LIMIT_EXCEEDED",n.message,t,c),c}if(this.#h(n)){const c=Math.max(1e4,await this.#f(e,t,s,n));return this.#m(this.#r.getTitle(),e,"OPERATION_TIME_LIMIT",n.message,t,c),c}if(this.#a(n))return this.#b(e,n?.code?`${n.code}`:"?",n?.message??"",t,Number(n?.status??0)),0;if(!this.#l(n)){const c=await this.#u(e),o=Math.max(3e4,c),l=Math.min(o,c*Math.pow(2,i)),h=l*.1*(Math.random()*2-1),u=Math.max(100,l+h);return this.#y(e,n?.code?`${n.code}`:"?",n.message,t,u),u}return 0}#o(e){return e.status===503||e.code==="QUERY_LIMIT_EXCEEDED"}async#c(e){return this.#e.handleExceeded(e)}#h(e){return e.status===429||e.code==="OPERATION_TIME_LIMIT"}async#f(e,t,s,n){return this.#r.getTimeToFree(e,t,s,n)}#a(e){const t=Number(e?.status??0);return Number.isNaN(t)?!1:t>=400&&t<500&&t!==408&&t!==429}#l(e){const t={code:e?.code??"-1",description:e?.message??""};return[...this.exceptionCodeForHard,...this.exceptionCodeForSoft].includes(t.code)||(t.description??"").includes("Could not find value for parameter")}static BUILT_IN_HARD_ERROR_CODES=["ERR_BAD_REQUEST","JSSDK_UNKNOWN_ERROR","100","INTERNAL_SERVER_ERROR","ERROR_UNEXPECTED_ANSWER","PORTAL_DELETED","ERROR_BATCH_METHOD_NOT_ALLOWED","ERROR_BATCH_LENGTH_EXCEEDED","NO_AUTH_FOUND","INVALID_REQUEST","OVERLOAD_LIMIT","expired_token","invalid_token","ACCESS_DENIED","INVALID_CREDENTIALS","user_access_error","insufficient_scope","ERROR_MANIFEST_IS_NOT_AVAILABLE","allowed_only_intranet_user","NOT_FOUND","INVALID_ARG_VALUE"];static BUILT_IN_SOFT_ERROR_CODES=["ERROR_ENTITY_NOT_FOUND","BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDJSONEXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDFILTEREXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDSELECTEXCEPTION","BITRIX_REST_V3_EXCEPTION_ENTITYNOTFOUNDEXCEPTION","BITRIX_REST_V3_EXCEPTION_METHODNOTFOUNDEXCEPTION","BITRIX_REST_V3_EXCEPTION_UNKNOWNDTOPROPERTYEXCEPTION","BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION","BITRIX_REST_V3_EXCEPTION_VALIDATION_DTOVALIDATIONEXCEPTION"];get exceptionCodeForHard(){const e=[...gr.BUILT_IN_HARD_ERROR_CODES];return this.#t.retryOnNetworkError===!1&&e.push("NETWORK_ERROR","REQUEST_TIMEOUT"),this.#t.hardErrorCodes&&this.#t.hardErrorCodes.length>0&&e.push(...this.#t.hardErrorCodes),e}get exceptionCodeForSoft(){const e=[...gr.BUILT_IN_SOFT_ERROR_CODES];return this.#t.softErrorCodes&&this.#t.softErrorCodes.length>0&&e.push(...this.#t.softErrorCodes),e}async#u(e){return this.#t.retryDelay}incrementError(e){const t=this.#n.get(e)||0;this.#n.set(e,t+1),this.incrementStats("consecutiveErrors")}resetErrors(e){this.#n.delete(e),this.#i.consecutiveErrors=0}incrementStats(e){this.#i[e]++}getStats(){return{...this.#i,...this.#e.getStats(),...this.#s.getStats(),...this.#r.getStats(),errorCounts:Object.fromEntries(this.#n)}}async reset(){await this.#e.reset(),await this.#r.reset(),await this.#s.reset(),this.#n.clear(),this.#i={retries:0,consecutiveErrors:0,limitHits:0}}async setConfig(e){this.#t=e,await this.#e.setConfig(e.rateLimit),await this.#r.setConfig(e.operatingLimit),await this.#s.setConfig(e.adaptiveConfig)}getParams(){return{...this.#t}}async#d(e){return new Promise(t=>setTimeout(t,e))}async waiteDelay(e){return this.#d(e)}#p(e,t,s,n){this.getLogger().notice(`${e} blocked method ${s}`,{requestId:t,method:s,wait:n,limiter:e})}#g(e,t,s,n,i){this.getLogger().notice(`${e} blocked method ${s} | ${i} times`,{requestId:t,method:s,times:i,wait:n,limiter:e})}#m(e,t,s,n,i,c){this.getLogger().error(`${e} recognized the ${s} error for the ${i} method`,{requestId:t,method:i,wait:c,limiter:e,error:{code:s,message:n}})}#y(e,t,s,n,i){this.getLogger().error(`recognized the ${t} error for the ${n} method`,{requestId:e,method:n,wait:i,error:{code:t,message:s}})}#b(e,t,s,n,i){this.getLogger().error(`client error ${i} (${t}) for the ${n} method is not retryable`,{requestId:e,method:n,status:i,error:{code:t,message:s}})}}var pd=Object.defineProperty,md=a((r,e)=>pd(r,"name",{value:e,configurable:!0}),"r$f");class bt{static{a(this,"ParseRow")}static{md(this,"ParseRow")}static getBatchCommand(e,t){if(e){if(typeof e=="object"&&"method"in e&&typeof e.method=="string")return{method:e.method,query:e.params,as:e.as??t.asDefaultValue,parallel:e.parallel??t.parallelDefaultValue};if(Array.isArray(e)&&e.length>0&&typeof e[0]=="string")return{method:e[0],query:e[1],as:t.asDefaultValue,parallel:t.parallelDefaultValue}}throw new ce({code:"JSSDK_INTERACTION_BATCH_ROW_FAIL",description:`There were difficulties parsing the command for batch.
|
|
41
|
+
${JSON.stringify({row:e,options:t})}`,status:500})}static getMethodsFromCommands(e){const t=[],s={parallelDefaultValue:!1};return Array.isArray(e)?e.forEach(n=>{const i=bt.getBatchCommand(n,s);t.push(i.method)}):Object.entries(e).forEach(([n,i])=>{const c=bt.getBatchCommand(i,{...s,asDefaultValue:n});t.push(c.method)}),t}}var gd=Object.defineProperty,yd=a((r,e)=>gd(r,"name",{value:e,configurable:!0}),"r$e");const it=class Lc{static{a(this,"i")}static{yd(this,"VersionManager")}#e;constructor(){this.#e=["/batch","/scopes","/rest.scope.list","/rest.documentation.openapi","/documentation","/main.eventlog.list","/main.eventlog.get","/main.eventlog.tail","/main.eventlog.field.list","/main.eventlog.field.get","/mail.mailbox.list","/mail.mailbox.get","/mail.mailbox.senders","/mail.mailbox.field.list","/mail.mailbox.field.get","/mail.message.list","/mail.message.get","/mail.message.thread","/mail.message.send","/mail.message.reply","/mail.message.forward","/mail.message.movetofolder","/mail.message.createcrmactivity","/mail.message.removecrmactivity","/mail.message.createtask","/mail.message.createcalendarevent","/mail.message.createchat","/mail.message.createfeedpost","/mail.message.field.list","/mail.message.field.get","/mail.recipient.listcontacts","/mail.recipient.listemployees","/mail.recipient.field.list","/mail.recipient.field.get","/humanresources.node.add","/humanresources.node.edit","/humanresources.node.get","/humanresources.node.list","/humanresources.node.search","/humanresources.node.children","/humanresources.node.count","/humanresources.node.move","/humanresources.node.field.list","/humanresources.node.field.get","/humanresources.node.member.add","/humanresources.node.member.set","/humanresources.node.member.move","/humanresources.node.member.remove","/humanresources.node.communication.edit","/humanresources.node.communication.list","/humanresources.employee.search","/humanresources.employee.subordinates","/humanresources.employee.count","/humanresources.employee.multidepartment","/humanresources.employee.field.list","/humanresources.employee.field.get","/tasks.task.add","/tasks.task.get","/tasks.task.update","/tasks.task.delete","/tasks.task.access.get","/tasks.task.file.attach","/tasks.task.chat.message.send","/tasks.task.result.add","/tasks.task.result.addfromchatmessage","/tasks.task.result.update","/tasks.task.result.list","/tasks.task.result.delete","/tasks.task.field.list","/tasks.task.field.get","/tasks.task.access.field.list","/tasks.task.access.field.get","/tasks.task.file.field.list","/tasks.task.file.field.get","/tasks.task.chat.message.field.list","/tasks.task.chat.message.field.get","/timeman.record.list","/timeman.record.field.list","/timeman.record.field.get"]}static create(){return new Lc}getAllApiVersions(){return[X.v3,X.v2]}isSupport(e,t){switch(e){case X.v3:return this.#r(t);case X.v2:return!0}return!1}#r(e){return this.#e.includes(`/${e}`)}automaticallyObtainApiVersion(e){const t=this.getAllApiVersions().find(s=>it.isSupport(s,e));if(!t)throw new ce({code:"JSSDK_VERSION_MANAGER_NOT_DETECT_FOR_METHOD",description:`No API version found that supports method ${e}.`,status:500});return t}automaticallyObtainApiVersionForBatch(e){const t=bt.getMethodsFromCommands(e);let s=!0;for(const[n,i]of t.entries())if(!this.isSupport(X.v3,i)){s=!1;break}return s?X.v3:X.v2}}.create();var bd=Object.defineProperty,_d=a((r,e)=>bd(r,"name",{value:e,configurable:!0}),"o$j");class At{static{a(this,"AbstractAction")}static{_d(this,"AbstractAction")}_b24;_logger;constructor(e,t){this._b24=e,this._logger=t}}var wd=Object.defineProperty,Sd=a((r,e)=>wd(r,"name",{value:e,configurable:!0}),"r$d");class vd extends At{static{a(this,"CallV2")}static{Sd(this,"CallV2")}async make(e){it.isSupport(X.v3,e.method)&&te.forcedLog(this._logger,"warning",`The method ${e.method} is available in restApi:v3. It's worth migrating to the new API.`,{method:e.method,requestId:e.requestId,code:"JSSDK_CORE_METHOD_AVAILABLE_IN_API_V3"});const t=e.params||{};return this._b24.getHttpClient(X.v2).call(e.method,t,e.requestId)}}var Ed=Object.defineProperty,Od=a((r,e)=>Ed(r,"name",{value:e,configurable:!0}),"p$b");class Td extends At{static{a(this,"CallListV2")}static{Od(this,"CallListV2")}async make(e){const t=new Fe,s=e?.idKey??"ID",n=e?.cursorIdKey??s,i=e?.customKeyForResult??null,c=e?.params??{};"order"in c&&c.order&&this._logger.warning("callList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.");const o=`>${n}`,{order:l,...h}=c,u={...h,order:{[n]:"ASC"},filter:{...c.filter||{},[o]:0},start:-1};let g=[],p=!0;do{const d=await this._b24.actions.v2.call.make({method:e.method,params:u,requestId:e.requestId});if(!d.isSuccess){this._logger.error("callFastListMethod",{method:e.method,requestId:e.requestId,messages:d.getErrorMessages()});for(const[_,w]of d.errors)t.addError(w,_);p=!1;break}const f=d.getData();if(!f){p=!1;break}let m=[];if(i===null?m=f.result:m=f.result[i],m.length===0){p=!1;break}if(g=[...g,...m],m.length<50){p=!1;break}const y=m[m.length-1],b=y?Number.parseInt(y[s],10):Number.NaN;if(Number.isFinite(b))u.filter[o]=b;else{this._logger.warning(`callList.make: pagination stops here \u2014 no numeric id could be read from the returned items via idKey "${s}". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`),p=!1;break}}while(p);return t.setData(g)}}var kd=Object.defineProperty,Id=a((r,e)=>kd(r,"name",{value:e,configurable:!0}),"y$2");class Ad extends At{static{a(this,"FetchListV2")}static{Id(this,"FetchListV2")}async*make(e){const t=e?.idKey??"ID",s=e?.cursorIdKey??t,n=e?.customKeyForResult??null,i=e?.params??{};"order"in i&&i.order&&this._logger.warning("fetchList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.");const c=`>${s}`,{order:o,...l}=i,h={...l,order:{[s]:"ASC"},filter:{...i.filter||{},[c]:0},start:-1};let u=!0;do{const g=await this._b24.actions.v2.call.make({method:e.method,params:h,requestId:e.requestId});if(!g.isSuccess)throw this._logger.error("fetchListMethod",{method:e.method,requestId:e.requestId,messages:g.getErrorMessages()}),new ce({code:"JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V2",description:`API Error: ${g.getErrorMessages().join("; ")}`,status:500});const p=g.getData();if(!p){u=!1;break}let d=[];if(n===null?d=p.result:d=p.result[n],d.length===0){u=!1;break}if(yield d,d.length<50){u=!1;break}const f=d[d.length-1],m=f?Number.parseInt(f[t],10):Number.NaN;if(Number.isFinite(m))h.filter[c]=m;else{this._logger.warning(`fetchList.make: pagination stops here \u2014 no numeric id could be read from the returned items via idKey "${t}". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`),u=!1;break}}while(u)}}var Rd=Object.defineProperty,Cd=a((r,e)=>Rd(r,"name",{value:e,configurable:!0}),"u$3");class Zr extends At{static{a(this,"AbstractBatch")}static{Cd(this,"AbstractBatch")}_addBatchErrorsIfAny(e,t){if(!e.isSuccess)for(const[s,n]of e.errors)t.addError(n,s)}_processBatchResponse(e,t,s){const n=Array.isArray(t);return s.returnAjaxResult?this._createBatchResultWithAjax(e,n):this._createBatchResultSimple(e,n)}_createBatchResultWithAjax(e,t){return t?this._createBatchArrayResult(e):this._createBatchObjectResult(e)}_createBatchArrayResult(e){const t=new Fe;this._addBatchErrorsIfAny(e,t);const s=[];for(const[n,i]of e.getData().result)s.push(i);return t.setData(s)}_createBatchObjectResult(e){const t=new Fe;this._addBatchErrorsIfAny(e,t);const s={};for(const[n,i]of e.getData().result)s[n]=i;return t.setData(s)}_createBatchResultSimple(e,t){const s=new Fe;return this._addBatchErrorsIfAny(e,s),s.setData(this._extractBatchSimpleData(e,t))}_extractBatchSimpleData(e,t){if(t){const s=[];for(const[n,i]of e.getData().result)i.isSuccess&&s.push(i.getData().result);return s}else{const s={};for(const[n,i]of e.getData().result)i.isSuccess&&(s[n]=i.getData().result);return s}}chunkArray(e,t=50){const s=[];for(let n=0;n<e.length;n+=t){const i=e.slice(n,n+t);s.push(i)}return s}}var Nd=Object.defineProperty,Dd=a((r,e)=>Nd(r,"name",{value:e,configurable:!0}),"o$i");class Ld extends Zr{static{a(this,"BatchV2")}static{Dd(this,"BatchV2")}async make(e){const t={...e.options,apiVersion:X.v2},s=await this._b24.getHttpClient(X.v2).batch(e.calls,t);return this._processBatchResponse(s,e.calls,t)}}var Pd=Object.defineProperty,Md=a((r,e)=>Pd(r,"name",{value:e,configurable:!0}),"r$c");class Fd extends Zr{static{a(this,"BatchByChunkV2")}static{Md(this,"BatchByChunkV2")}async make(e){const t={...e.options,returnAjaxResult:!1,apiVersion:X.v2},s=new Fe,n=[],i=this.chunkArray(e.calls,50);for(const c of i){const o=await this._b24.getHttpClient(X.v2).batch(c,t);o.isSuccess||this._addBatchErrorsIfAny(o,s);for(const[l,h]of o.getData().result)h.isSuccess&&n.push(h.getData().result)}return s.setData(n)}}var xd=Object.defineProperty,$d=a((r,e)=>xd(r,"name",{value:e,configurable:!0}),"r$b");const nn=Symbol("call_V2"),on=Symbol("callList_V2"),an=Symbol("fetchList_V2"),cn=Symbol("batch_V2"),ln=Symbol("batchByChunk_V2");class Bd{static{a(this,"ActionsManagerV2")}static{$d(this,"ActionsManagerV2")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=te.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get call(){return this._mapActions.has(nn)||this._mapActions.set(nn,new vd(this._b24,this._logger)),this._mapActions.get(nn)}get callList(){return this._mapActions.has(on)||this._mapActions.set(on,new Td(this._b24,this._logger)),this._mapActions.get(on)}get fetchList(){return this._mapActions.has(an)||this._mapActions.set(an,new Ad(this._b24,this._logger)),this._mapActions.get(an)}get batch(){return this._mapActions.has(cn)||this._mapActions.set(cn,new Ld(this._b24,this._logger)),this._mapActions.get(cn)}get batchByChunk(){return this._mapActions.has(ln)||this._mapActions.set(ln,new Fd(this._b24,this._logger)),this._mapActions.get(ln)}}var jd=Object.defineProperty,Ud=a((r,e)=>jd(r,"name",{value:e,configurable:!0}),"e$6");class Vd extends At{static{a(this,"CallV3")}static{Ud(this,"CallV3")}async make(e){if(!it.isSupport(X.v3,e.method))throw new ce({code:"JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",description:`restApi:v3 not support method ${e.method}`,status:500});const t=e.params||{};return this._b24.getHttpClient(X.v3).call(e.method,t,e.requestId)}}var qd=Object.defineProperty,Hd=a((r,e)=>qd(r,"name",{value:e,configurable:!0}),"h$4");class Wd extends At{static{a(this,"CallListV3")}static{Hd(this,"CallListV3")}async make(e){const t=e?.limit??50,s=new Fe,n=e?.idKey??"id",i=e?.cursorIdKey??n,c=e?.customKeyForResult??null,o=e?.params??{};"order"in o&&o.order&&this._logger.warning("callList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.");const{order:l,...h}=o,u={...h,order:{[i]:"ASC"},filter:[...o.filter||[]],pagination:{page:0,limit:t}};let g=[],p=!0,d=0;do{const f={...u,filter:[...u.filter]};f.filter.push([i,">",d]);const m=await this._b24.actions.v3.call.make({method:e.method,params:f,requestId:e.requestId});if(!m.isSuccess){this._logger.error("callFastListMethod",{method:e.method,requestId:e.requestId,messages:m.getErrorMessages()});for(const[S,T]of m.errors)s.addError(T,S);p=!1;break}const y=m.getData();if(!y){p=!1;break}const b=y.result[c];if(b.length===0){p=!1;break}if(g=[...g,...b],b.length<t){p=!1;break}const _=b[b.length-1],w=_?Number.parseInt(_[n],10):Number.NaN;if(Number.isFinite(w))d=w;else{this._logger.warning(`callList.make: pagination stops here \u2014 no numeric id could be read from the returned items via idKey "${n}". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`),p=!1;break}}while(p);return s.setData(g)}}var zd=Object.defineProperty,Jd=a((r,e)=>zd(r,"name",{value:e,configurable:!0}),"h$3");class Gd extends At{static{a(this,"FetchListV3")}static{Jd(this,"FetchListV3")}async*make(e){const t=e?.limit??50,s=e?.idKey??"id",n=e?.cursorIdKey??s,i=e?.customKeyForResult??null,c=e?.params??{};"order"in c&&c.order&&this._logger.warning("fetchList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.");const{order:o,...l}=c,h={...l,order:{[n]:"ASC"},filter:[...c.filter||[]],pagination:{page:0,limit:t}};let u=!0,g=0;do{const p={...h,filter:[...h.filter]};p.filter.push([n,">",g]);const d=await this._b24.actions.v3.call.make({method:e.method,params:p,requestId:e.requestId});if(!d.isSuccess)throw this._logger.error("fetchListMethod",{method:e.method,requestId:e.requestId,messages:d.getErrorMessages()}),new ce({code:"JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V3",description:`API Error: ${d.getErrorMessages().join("; ")}`,status:500});const f=d.getData();if(!f){u=!1;break}const m=f.result[i];if(m.length===0){u=!1;break}if(yield m,m.length<t){u=!1;break}const y=m[m.length-1],b=y?Number.parseInt(y[s],10):Number.NaN;if(Number.isFinite(b))g=b;else{this._logger.warning(`fetchList.make: pagination stops here \u2014 no numeric id could be read from the returned items via idKey "${s}". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`),u=!1;break}}while(u)}}var Yd=Object.defineProperty,Kd=a((r,e)=>Yd(r,"name",{value:e,configurable:!0}),"o$g");class Zd extends Zr{static{a(this,"BatchV3")}static{Kd(this,"BatchV3")}async make(e){const t={...e.options,apiVersion:X.v3};if(it.automaticallyObtainApiVersionForBatch(e.calls)!==t.apiVersion)throw new ce({code:"JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",description:`restApi:v3 not support some methods in calls: ${JSON.stringify(e.calls)}`,status:500});const s=await this._b24.getHttpClient(X.v3).batch(e.calls,t);return this._processBatchResponse(s,e.calls,t)}}var Xd=Object.defineProperty,Qd=a((r,e)=>Xd(r,"name",{value:e,configurable:!0}),"r$a");class ef extends Zr{static{a(this,"BatchByChunkV3")}static{Qd(this,"BatchByChunkV3")}async make(e){const t={...e.options,returnAjaxResult:!1,apiVersion:X.v3},s=new Fe,n=[],i=this.chunkArray(e.calls,50);for(const c of i){const o=await this._b24.getHttpClient(X.v3).batch(c,t);o.isSuccess||this._addBatchErrorsIfAny(o,s);for(const[l,h]of o.getData().result)h.isSuccess&&n.push(h.getData().result)}return s.setData(n)}}var tf=Object.defineProperty,rf=a((r,e)=>tf(r,"name",{value:e,configurable:!0}),"r$9");const un=Symbol("call_V3"),hn=Symbol("callList_V3"),dn=Symbol("fetchList_V3"),fn=Symbol("batch_V3"),pn=Symbol("batchByChunk_V3");class sf{static{a(this,"ActionsManagerV3")}static{rf(this,"ActionsManagerV3")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=te.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get call(){return this._mapActions.has(un)||this._mapActions.set(un,new Vd(this._b24,this._logger)),this._mapActions.get(un)}get callList(){return this._mapActions.has(hn)||this._mapActions.set(hn,new Wd(this._b24,this._logger)),this._mapActions.get(hn)}get fetchList(){return this._mapActions.has(dn)||this._mapActions.set(dn,new Gd(this._b24,this._logger)),this._mapActions.get(dn)}get batch(){return this._mapActions.has(fn)||this._mapActions.set(fn,new Zd(this._b24,this._logger)),this._mapActions.get(fn)}get batchByChunk(){return this._mapActions.has(pn)||this._mapActions.set(pn,new ef(this._b24,this._logger)),this._mapActions.get(pn)}}var nf=Object.defineProperty,of=a((r,e)=>nf(r,"name",{value:e,configurable:!0}),"s$j");const mn=Symbol(X.v2),gn=Symbol(X.v3);class af{static{a(this,"ActionsManager")}static{of(this,"ActionsManager")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=te.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e,this.v2.setLogger(this._logger),this.v3.setLogger(this._logger)}getLogger(){return this._logger}get v2(){return this._mapActions.has(mn)||this._mapActions.set(mn,new Bd(this._b24)),this._mapActions.get(mn)}get v3(){return this._mapActions.has(gn)||this._mapActions.set(gn,new sf(this._b24)),this._mapActions.get(gn)}}var cf=Object.defineProperty,lf=a((r,e)=>cf(r,"name",{value:e,configurable:!0}),"o$d");class Xo{static{a(this,"AbstractTool")}static{lf(this,"AbstractTool")}_b24;_logger;constructor(e,t){this._b24=e,this._logger=t}}var uf=Object.defineProperty,hf=a((r,e)=>uf(r,"name",{value:e,configurable:!0}),"r$8");class df extends Xo{static{a(this,"Ping")}static{hf(this,"Ping")}async make(e){const t=Date.now();try{return await this._b24.actions.v2.call.make({method:"server.time",params:{},requestId:e?.requestId}),Date.now()-t}catch{return-1}}}var ff=Object.defineProperty,pf=a((r,e)=>ff(r,"name",{value:e,configurable:!0}),"s$h");class mf extends Xo{static{a(this,"HealthCheck")}static{pf(this,"HealthCheck")}async make(e){try{return(await this._b24.actions.v2.call.make({method:"server.time",params:{},requestId:e?.requestId})).isSuccess}catch{return!1}}}var gf=Object.defineProperty,yf=a((r,e)=>gf(r,"name",{value:e,configurable:!0}),"g$5");const yn=Symbol("ping"),bn=Symbol("healthCheck");class bf{static{a(this,"ToolsManager")}static{yf(this,"ToolsManager")}_b24;_logger;_mapTools;constructor(e){this._b24=e,this._logger=te.createNullLogger(),this._mapTools=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get ping(){return this._mapTools.has(yn)||this._mapTools.set(yn,new df(this._b24,this._logger)),this._mapTools.get(yn)}get healthCheck(){return this._mapTools.has(bn)||this._mapTools.set(bn,new mf(this._b24,this._logger)),this._mapTools.get(bn)}}var _f=Object.defineProperty,wf=a((r,e)=>_f(r,"name",{value:e,configurable:!0}),"u$2");class Xr{static{a(this,"AbstractB24")}static{wf(this,"AbstractB24")}static batchSize=50;_isInit=!1;_httpV2=null;_httpV3=null;_logger;_actionsManager;_toolsManager;constructor(){this._isInit=!1,this._logger=te.createNullLogger(),this._actionsManager=new af(this),this._toolsManager=new bf(this)}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}get actions(){return this._ensureInitialized(),this._actionsManager}get tools(){return this._ensureInitialized(),this._toolsManager}async callMethod(e,t,s){return te.forcedLog(this._logger,"warning","The AbstractB24.callMethod() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.call.make(options) or b24.actions.v2.call.make(options)",{class:"AbstractB24",method:"callMethod",replacement:"b24.actions.v3.call.make(options) | b24.actions.v2.call.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"}),t={...t},!("start"in t&&Number.isInteger(t.start))&&Number.isInteger(s)&&(t.start=s),this._actionsManager.v2.call.make({method:e,params:t})}async callListMethod(e,t,s,n){te.forcedLog(this._logger,"warning","The AbstractB24.callListMethod() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.callList.make(options) or b24.actions.v2.callList.make(options)",{class:"AbstractB24",method:"callListMethod",replacement:"b24.actions.v3.callList.make(options) | b24.actions.v2.callList.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const i=new Fe;P.isFunction(s)&&s!==null&&s(0);const c={...t,start:0};return this.actions.v2.call.make({method:e,params:c}).then(async o=>{let l=[],h;if(n?h=o.getData().result[n]:h=o.getData().result,l=[...l,...h],o.isMore()){let u=o;for(;u=await u.getNext(this.getHttpClient(X.v2)),u!==!1;){let g;if(n?g=u.getData().result[n]:g=u.getData().result,l=[...l,...g],s){const p=u.getTotal();s(p>0?Math.round(100*l.length/p):100)}}}return i.setData(l),s&&s(100),i})}async*fetchListMethod(e,t,s,n){te.forcedLog(this._logger,"warning","The AbstractB24.fetchListMethod() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.fetchList.make(options) or b24.actions.v2.fetchList.make(options)",{class:"AbstractB24",method:"fetchListMethod",replacement:"b24.actions.v3.fetchList.make(options) | b24.actions.v2.fetchList.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const i={method:e,params:t,idKey:s,customKeyForResult:n===null?void 0:n};yield*this.actions.v2.fetchList.make(i)}async callBatch(e,t,s){te.forcedLog(this._logger,"warning","The AbstractB24.callBatch() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.batch.make(options) or b24.actions.v2.batch.make(options)",{class:"AbstractB24",method:"callBatch",replacement:"b24.actions.v3.batch.make(options) | b24.actions.v2.batch.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const n=e,i={isHaltOnError:t??!0,returnAjaxResult:s??!1};return this.actions.v2.batch.make({calls:n,options:i})}async callBatchByChunk(e,t){te.forcedLog(this._logger,"warning","The AbstractB24.callBatchByChunk() method is deprecated and will be removed in version 2.0.0. Use b24.actions.v3.batchByChunk.make(options) or b24.actions.v2.batchByChunk.make(options)",{class:"AbstractB24",method:"callBatchByChunk",replacement:"b24.actions.v3.batchByChunk.make(options) | b24.actions.v2.batchByChunk.make(options)",removalVersion:"2.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const s=e,n={isHaltOnError:t,returnAjaxResult:!1};return this.actions.v2.batchByChunk.make({calls:s,options:n})}getHttpClient(e){switch(this._ensureInitialized(),e){case X.v3:if(this._httpV3===null)throw new ce({code:"JSSDK_CORE_B24_HTTP_V3_NOT_INIT",description:"HttpV3 not init",status:500});return this._httpV3;case X.v2:if(this._httpV2===null)throw new ce({code:"JSSDK_CORE_B24_HTTP_V2_NOT_INIT",description:"HttpV2 not init",status:500});return this._httpV2}throw new ce({code:"JSSDK_CORE_B24_API_WRONG",description:`Wrong Api Version ${e}`,status:500})}setHttpClient(e,t){switch(e){case X.v3:this._httpV3=t;return;case X.v2:this._httpV2=t;return}throw new ce({code:"JSSDK_CORE_B24_API_WRONG",description:`Wrong Api Version ${e}`,status:500})}setLogger(e){this._logger=e,this._actionsManager.setLogger(this._logger),this._toolsManager.setLogger(this._logger),it.getAllApiVersions().forEach(t=>{this.getHttpClient(t).setLogger(this._logger)})}getLogger(){return this._logger}async setRestrictionManagerParams(e){const t=it.getAllApiVersions().map(s=>this.getHttpClient(s).setRestrictionManagerParams(e));await Promise.allSettled(t)}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new ce({code:"JSSDK_CORE_B24_NOT_INIT",description:"B24 not initialized",status:500})}}function Qo(r,e){return a(function(){return r.apply(e,arguments)},"wrap")}a(Qo,"bind");const{toString:Sf}=Object.prototype,{getPrototypeOf:Qr}=Object,{iterator:es,toStringTag:ea}=Symbol,ts=(r=>e=>{const t=Sf.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),et=a(r=>(r=r.toLowerCase(),e=>ts(e)===r),"kindOfTest"),rs=a(r=>e=>typeof e===r,"typeOfTest"),{isArray:Jt}=Array,Gt=rs("undefined");function yr(r){return r!==null&&!Gt(r)&&r.constructor!==null&&!Gt(r.constructor)&&Be(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}a(yr,"isBuffer$1");const ta=et("ArrayBuffer");function vf(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&ta(r.buffer),e}a(vf,"isArrayBufferView");const Ef=rs("string"),Be=rs("function"),ra=rs("number"),br=a(r=>r!==null&&typeof r=="object","isObject"),Of=a(r=>r===!0||r===!1,"isBoolean"),ss=a(r=>{if(ts(r)!=="object")return!1;const e=Qr(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(ea in r)&&!(es in r)},"isPlainObject"),Tf=a(r=>{if(!br(r)||yr(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},"isEmptyObject"),kf=et("Date"),If=et("File"),Af=a(r=>!!(r&&typeof r.uri<"u"),"isReactNativeBlob"),Rf=a(r=>r&&typeof r.getParts<"u","isReactNative"),Cf=et("Blob"),Nf=et("FileList"),Df=a(r=>br(r)&&Be(r.pipe),"isStream");function Lf(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}a(Lf,"getGlobal");const sa=Lf(),na=typeof sa.FormData<"u"?sa.FormData:void 0,Pf=a(r=>{if(!r)return!1;if(na&&r instanceof na)return!0;const e=Qr(r);if(!e||e===Object.prototype||!Be(r.append))return!1;const t=ts(r);return t==="formdata"||t==="object"&&Be(r.toString)&&r.toString()==="[object FormData]"},"isFormData"),Mf=et("URLSearchParams"),[Ff,xf,$f,Bf]=["ReadableStream","Request","Response","Headers"].map(et),jf=a(r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function _r(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let s,n;if(typeof r!="object"&&(r=[r]),Jt(r))for(s=0,n=r.length;s<n;s++)e.call(null,r[s],s,r);else{if(yr(r))return;const i=t?Object.getOwnPropertyNames(r):Object.keys(r),c=i.length;let o;for(s=0;s<c;s++)o=i[s],e.call(null,r[o],o,r)}}a(_r,"forEach");function ia(r,e){if(yr(r))return null;e=e.toLowerCase();const t=Object.keys(r);let s=t.length,n;for(;s-- >0;)if(n=t[s],e===n.toLowerCase())return n;return null}a(ia,"findKey");const Rt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,oa=a(r=>!Gt(r)&&r!==Rt,"isContextDefined");function _n(...r){const{caseless:e,skipUndefined:t}=oa(this)&&this||{},s={},n=a((i,c)=>{if(c==="__proto__"||c==="constructor"||c==="prototype")return;const o=e&&ia(s,c)||c,l=wn(s,o)?s[o]:void 0;ss(l)&&ss(i)?s[o]=_n(l,i):ss(i)?s[o]=_n({},i):Jt(i)?s[o]=i.slice():(!t||!Gt(i))&&(s[o]=i)},"assignValue");for(let i=0,c=r.length;i<c;i++)r[i]&&_r(r[i],n);return s}a(_n,"merge");const Uf=a((r,e,t,{allOwnKeys:s}={})=>(_r(e,(n,i)=>{t&&Be(n)?Object.defineProperty(r,i,{__proto__:null,value:Qo(n,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,i,{__proto__:null,value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),r),"extend"),Vf=a(r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),"stripBOM"),qf=a((r,e,t,s)=>{r.prototype=Object.create(e.prototype,s),Object.defineProperty(r.prototype,"constructor",{__proto__:null,value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{__proto__:null,value:e.prototype}),t&&Object.assign(r.prototype,t)},"inherits"),Hf=a((r,e,t,s)=>{let n,i,c;const o={};if(e=e||{},r==null)return e;do{for(n=Object.getOwnPropertyNames(r),i=n.length;i-- >0;)c=n[i],(!s||s(c,r,e))&&!o[c]&&(e[c]=r[c],o[c]=!0);r=t!==!1&&Qr(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},"toFlatObject"),Wf=a((r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const s=r.indexOf(e,t);return s!==-1&&s===t},"endsWith"),zf=a(r=>{if(!r)return null;if(Jt(r))return r;let e=r.length;if(!ra(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},"toArray"),Jf=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&Qr(Uint8Array)),Gf=a((r,e)=>{const s=(r&&r[es]).call(r);let n;for(;(n=s.next())&&!n.done;){const i=n.value;e.call(r,i[0],i[1])}},"forEachEntry"),Yf=a((r,e)=>{let t;const s=[];for(;(t=r.exec(e))!==null;)s.push(t);return s},"matchAll"),Kf=et("HTMLFormElement"),Zf=a(r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,a(function(t,s,n){return s.toUpperCase()+n},"replacer")),"toCamelCase"),wn=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),Xf=et("RegExp"),aa=a((r,e)=>{const t=Object.getOwnPropertyDescriptors(r),s={};_r(t,(n,i)=>{let c;(c=e(n,i,r))!==!1&&(s[i]=c||n)}),Object.defineProperties(r,s)},"reduceDescriptors"),Qf=a(r=>{aa(r,(e,t)=>{if(Be(r)&&["arguments","caller","callee"].includes(t))return!1;const s=r[t];if(Be(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),ep=a((r,e)=>{const t={},s=a(n=>{n.forEach(i=>{t[i]=!0})},"define");return Jt(r)?s(r):s(String(r).split(e)),t},"toObjectSet"),tp=a(()=>{},"noop"),rp=a((r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,"toFiniteNumber");function sp(r){return!!(r&&Be(r.append)&&r[ea]==="FormData"&&r[es])}a(sp,"isSpecCompliantForm");const np=a(r=>{const e=new WeakSet,t=a(s=>{if(br(s)){if(e.has(s))return;if(yr(s))return s;if(!("toJSON"in s)){e.add(s);const n=Jt(s)?[]:{};return _r(s,(i,c)=>{const o=t(i);!Gt(o)&&(n[c]=o)}),e.delete(s),n}}return s},"visit");return t(r)},"toJSONObject"),ip=et("AsyncFunction"),op=a(r=>r&&(br(r)||Be(r))&&Be(r.then)&&Be(r.catch),"isThenable"),ca=((r,e)=>r?setImmediate:e?((t,s)=>(Rt.addEventListener("message",({source:n,data:i})=>{n===Rt&&i===t&&s.length&&s.shift()()},!1),n=>{s.push(n),Rt.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Be(Rt.postMessage)),ap=typeof queueMicrotask<"u"?queueMicrotask.bind(Rt):typeof process<"u"&&process.nextTick||ca,E={isArray:Jt,isArrayBuffer:ta,isBuffer:yr,isFormData:Pf,isArrayBufferView:vf,isString:Ef,isNumber:ra,isBoolean:Of,isObject:br,isPlainObject:ss,isEmptyObject:Tf,isReadableStream:Ff,isRequest:xf,isResponse:$f,isHeaders:Bf,isUndefined:Gt,isDate:kf,isFile:If,isReactNativeBlob:Af,isReactNative:Rf,isBlob:Cf,isRegExp:Xf,isFunction:Be,isStream:Df,isURLSearchParams:Mf,isTypedArray:Jf,isFileList:Nf,forEach:_r,merge:_n,extend:Uf,trim:jf,stripBOM:Vf,inherits:qf,toFlatObject:Hf,kindOf:ts,kindOfTest:et,endsWith:Wf,toArray:zf,forEachEntry:Gf,matchAll:Yf,isHTMLForm:Kf,hasOwnProperty:wn,hasOwnProp:wn,reduceDescriptors:aa,freezeMethods:Qf,toObjectSet:ep,toCamelCase:Zf,noop:tp,toFiniteNumber:rp,findKey:ia,global:Rt,isContextDefined:oa,isSpecCompliantForm:sp,toJSONObject:np,isAsyncFn:ip,isThenable:op,setImmediate:ca,asap:ap,isIterable:a(r=>r!=null&&Be(r[es]),"isIterable")},cp=E.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"]),lp=a(r=>{const e={};let t,s,n;return r&&r.split(`
|
|
42
|
+
`).forEach(a(function(c){n=c.indexOf(":"),t=c.substring(0,n).trim().toLowerCase(),s=c.substring(n+1).trim(),!(!t||e[t]&&cp[t])&&(t==="set-cookie"?e[t]?e[t].push(s):e[t]=[s]:e[t]=e[t]?e[t]+", "+s:s)},"parser")),e},"parseHeaders");function up(r){let e=0,t=r.length;for(;e<t;){const s=r.charCodeAt(e);if(s!==9&&s!==32)break;e+=1}for(;t>e;){const s=r.charCodeAt(t-1);if(s!==9&&s!==32)break;t-=1}return e===0&&t===r.length?r:r.slice(e,t)}a(up,"trimSPorHTAB");const hp=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),dp=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Sn(r,e){return E.isArray(r)?r.map(t=>Sn(t,e)):up(String(r).replace(e,""))}a(Sn,"sanitizeValue");const fp=a(r=>Sn(r,hp),"sanitizeHeaderValue"),pp=a(r=>Sn(r,dp),"sanitizeByteStringHeaderValue");function la(r){const e=Object.create(null);return E.forEach(r.toJSON(),(t,s)=>{e[s]=pp(t)}),e}a(la,"toByteStringHeaderObject");const ua=Symbol("internals");function wr(r){return r&&String(r).trim().toLowerCase()}a(wr,"normalizeHeader");function ns(r){return r===!1||r==null?r:E.isArray(r)?r.map(ns):fp(String(r))}a(ns,"normalizeValue");function mp(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=t.exec(r);)e[s[1]]=s[2];return e}a(mp,"parseTokens");const gp=a(r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim()),"isValidHeaderName");function vn(r,e,t,s,n){if(E.isFunction(s))return s.call(this,e,t);if(n&&(e=t),!!E.isString(e)){if(E.isString(s))return e.indexOf(s)!==-1;if(E.isRegExp(s))return s.test(e)}}a(vn,"matchHeaderValue");function yp(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}a(yp,"formatHeader");function bp(r,e){const t=E.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(r,s+t,{__proto__:null,value:a(function(n,i,c){return this[s].call(this,e,n,i,c)},"value"),configurable:!0})})}a(bp,"buildAccessors");let xe=class{static{a(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,t,s){const n=this;function i(o,l,h){const u=wr(l);if(!u)throw new Error("header name must be a non-empty string");const g=E.findKey(n,u);(!g||n[g]===void 0||h===!0||h===void 0&&n[g]!==!1)&&(n[g||l]=ns(o))}a(i,"setHeader");const c=a((o,l)=>E.forEach(o,(h,u)=>i(h,u,l)),"setHeaders");if(E.isPlainObject(e)||e instanceof this.constructor)c(e,t);else if(E.isString(e)&&(e=e.trim())&&!gp(e))c(lp(e),t);else if(E.isObject(e)&&E.isIterable(e)){let o={},l,h;for(const u of e){if(!E.isArray(u))throw TypeError("Object iterator must return a key-value pair");o[h=u[0]]=(l=o[h])?E.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}c(o,t)}else e!=null&&i(t,e,s);return this}get(e,t){if(e=wr(e),e){const s=E.findKey(this,e);if(s){const n=this[s];if(!t)return n;if(t===!0)return mp(n);if(E.isFunction(t))return t.call(this,n,s);if(E.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=wr(e),e){const s=E.findKey(this,e);return!!(s&&this[s]!==void 0&&(!t||vn(this,this[s],s,t)))}return!1}delete(e,t){const s=this;let n=!1;function i(c){if(c=wr(c),c){const o=E.findKey(s,c);o&&(!t||vn(s,s[o],o,t))&&(delete s[o],n=!0)}}return a(i,"deleteHeader"),E.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let s=t.length,n=!1;for(;s--;){const i=t[s];(!e||vn(this,this[i],i,e,!0))&&(delete this[i],n=!0)}return n}normalize(e){const t=this,s={};return E.forEach(this,(n,i)=>{const c=E.findKey(s,i);if(c){t[c]=ns(n),delete t[i];return}const o=e?yp(i):String(i).trim();o!==i&&delete t[i],t[o]=ns(n),s[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return E.forEach(this,(s,n)=>{s!=null&&s!==!1&&(t[n]=e&&E.isArray(s)?s.join(", "):s)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
43
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach(n=>s.set(n)),s}static accessor(e){const s=(this[ua]=this[ua]={accessors:{}}).accessors,n=this.prototype;function i(c){const o=wr(c);s[o]||(bp(n,c),s[o]=!0)}return a(i,"defineAccessor"),E.isArray(e)?e.forEach(i):i(e),this}};xe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),E.reduceDescriptors(xe.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:a(()=>r,"get"),set(s){this[t]=s}}}),E.freezeMethods(xe);const _p="[REDACTED ****]";function wp(r){if(E.hasOwnProp(r,"toJSON"))return!0;let e=Object.getPrototypeOf(r);for(;e&&e!==Object.prototype;){if(E.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}a(wp,"hasOwnOrPrototypeToJSON");function Sp(r,e){const t=new Set(e.map(i=>String(i).toLowerCase())),s=[],n=a(i=>{if(i===null||typeof i!="object"||E.isBuffer(i))return i;if(s.indexOf(i)!==-1)return;i instanceof xe&&(i=i.toJSON()),s.push(i);let c;if(E.isArray(i))c=[],i.forEach((o,l)=>{const h=n(o);E.isUndefined(h)||(c[l]=h)});else{if(!E.isPlainObject(i)&&wp(i))return s.pop(),i;c=Object.create(null);for(const[o,l]of Object.entries(i)){const h=t.has(o.toLowerCase())?_p:n(l);E.isUndefined(h)||(c[o]=h)}}return s.pop(),c},"visit");return n(r)}a(Sp,"redactConfig");let B=class Pc extends Error{static{a(this,"AxiosError")}static from(e,t,s,n,i,c){const o=new Pc(e.message,t||e.code,s,n,i);return o.cause=e,o.name=e.name,e.status!=null&&o.status==null&&(o.status=e.status),c&&Object.assign(o,c),o}constructor(e,t,s,n,i){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),s&&(this.config=s),n&&(this.request=n),i&&(this.response=i,this.status=i.status)}toJSON(){const e=this.config,t=e&&E.hasOwnProp(e,"redact")?e.redact:void 0,s=E.isArray(t)&&t.length>0?Sp(e,t):E.toJSONObject(e);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:s,code:this.code,status:this.status}}};B.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",B.ERR_BAD_OPTION="ERR_BAD_OPTION",B.ECONNABORTED="ECONNABORTED",B.ETIMEDOUT="ETIMEDOUT",B.ECONNREFUSED="ECONNREFUSED",B.ERR_NETWORK="ERR_NETWORK",B.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",B.ERR_DEPRECATED="ERR_DEPRECATED",B.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",B.ERR_BAD_REQUEST="ERR_BAD_REQUEST",B.ERR_CANCELED="ERR_CANCELED",B.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",B.ERR_INVALID_URL="ERR_INVALID_URL",B.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const vp=null;function En(r){return E.isPlainObject(r)||E.isArray(r)}a(En,"isVisitable");function ha(r){return E.endsWith(r,"[]")?r.slice(0,-2):r}a(ha,"removeBrackets");function On(r,e,t){return r?r.concat(e).map(a(function(n,i){return n=ha(n),!t&&i?"["+n+"]":n},"each")).join(t?".":""):e}a(On,"renderKey");function Ep(r){return E.isArray(r)&&!r.some(En)}a(Ep,"isFlatArray");const Op=E.toFlatObject(E,{},null,a(function(e){return/^is[A-Z]/.test(e)},"filter"));function is(r,e,t){if(!E.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=E.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,a(function(y,b){return!E.isUndefined(b[y])},"defined"));const s=t.metaTokens,n=t.visitor||g,i=t.dots,c=t.indexes,o=t.Blob||typeof Blob<"u"&&Blob,l=t.maxDepth===void 0?100:t.maxDepth,h=o&&E.isSpecCompliantForm(e);if(!E.isFunction(n))throw new TypeError("visitor must be a function");function u(m){if(m===null)return"";if(E.isDate(m))return m.toISOString();if(E.isBoolean(m))return m.toString();if(!h&&E.isBlob(m))throw new B("Blob is not supported. Use a Buffer instead.");return E.isArrayBuffer(m)||E.isTypedArray(m)?h&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}a(u,"convertValue");function g(m,y,b){let _=m;if(E.isReactNative(e)&&E.isReactNativeBlob(m))return e.append(On(b,y,i),u(m)),!1;if(m&&!b&&typeof m=="object"){if(E.endsWith(y,"{}"))y=s?y:y.slice(0,-2),m=JSON.stringify(m);else if(E.isArray(m)&&Ep(m)||(E.isFileList(m)||E.endsWith(y,"[]"))&&(_=E.toArray(m)))return y=ha(y),_.forEach(a(function(S,T){!(E.isUndefined(S)||S===null)&&e.append(c===!0?On([y],T,i):c===null?y:y+"[]",u(S))},"each")),!1}return En(m)?!0:(e.append(On(b,y,i),u(m)),!1)}a(g,"defaultVisitor");const p=[],d=Object.assign(Op,{defaultVisitor:g,convertValue:u,isVisitable:En});function f(m,y,b=0){if(!E.isUndefined(m)){if(b>l)throw new B("Object is too deeply nested ("+b+" levels). Max depth: "+l,B.ERR_FORM_DATA_DEPTH_EXCEEDED);if(p.indexOf(m)!==-1)throw Error("Circular reference detected in "+y.join("."));p.push(m),E.forEach(m,a(function(w,S){(!(E.isUndefined(w)||w===null)&&n.call(e,w,E.isString(S)?S.trim():S,y,d))===!0&&f(w,y?y.concat(S):[S],b+1)},"each")),p.pop()}}if(a(f,"build"),!E.isObject(r))throw new TypeError("data must be an object");return f(r),e}a(is,"toFormData$1");function da(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(r).replace(/[!'()~]|%20/g,a(function(s){return e[s]},"replacer"))}a(da,"encode$2");function Tn(r,e){this._pairs=[],r&&is(r,this,e)}a(Tn,"AxiosURLSearchParams");const fa=Tn.prototype;fa.append=a(function(e,t){this._pairs.push([e,t])},"append"),fa.toString=a(function(e){const t=e?function(s){return e.call(this,s,da)}:da;return this._pairs.map(a(function(n){return t(n[0])+"="+t(n[1])},"each"),"").join("&")},"toString");function Tp(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}a(Tp,"encode$1");function pa(r,e,t){if(!e)return r;const s=t&&t.encode||Tp,n=E.isFunction(t)?{serialize:t}:t,i=n&&n.serialize;let c;if(i?c=i(e,n):c=E.isURLSearchParams(e)?e.toString():new Tn(e,n).toString(s),c){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+c}return r}a(pa,"buildURL");class ma{static{a(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){E.forEach(this.handlers,a(function(s){s!==null&&e(s)},"forEachHandler"))}}const kn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},kp={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Tn,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},In=typeof window<"u"&&typeof document<"u",An=typeof navigator=="object"&&navigator||void 0,Ip=In&&(!An||["ReactNative","NativeScript","NS"].indexOf(An.product)<0),Ap=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Rp=In&&window.location.href||"http://localhost",Le={...{__proto__:null,hasBrowserEnv:In,hasStandardBrowserEnv:Ip,hasStandardBrowserWebWorkerEnv:Ap,navigator:An,origin:Rp},...kp};function Cp(r,e){return is(r,new Le.classes.URLSearchParams,{visitor:a(function(t,s,n,i){return Le.isNode&&E.isBuffer(t)?(this.append(s,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},"visitor"),...e})}a(Cp,"toURLEncodedForm");function Np(r){return E.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}a(Np,"parsePropPath");function Dp(r){const e={},t=Object.keys(r);let s;const n=t.length;let i;for(s=0;s<n;s++)i=t[s],e[i]=r[i];return e}a(Dp,"arrayToObject");function ga(r){function e(t,s,n,i){let c=t[i++];if(c==="__proto__")return!0;const o=Number.isFinite(+c),l=i>=t.length;return c=!c&&E.isArray(n)?n.length:c,l?(E.hasOwnProp(n,c)?n[c]=E.isArray(n[c])?n[c].concat(s):[n[c],s]:n[c]=s,!o):((!E.hasOwnProp(n,c)||!E.isObject(n[c]))&&(n[c]=[]),e(t,s,n[c],i)&&E.isArray(n[c])&&(n[c]=Dp(n[c])),!o)}if(a(e,"buildPath"),E.isFormData(r)&&E.isFunction(r.entries)){const t={};return E.forEachEntry(r,(s,n)=>{e(Np(s),n,t,0)}),t}return null}a(ga,"formDataToJSON");const Yt=a((r,e)=>r!=null&&E.hasOwnProp(r,e)?r[e]:void 0,"own");function Lp(r,e,t){if(E.isString(r))try{return(e||JSON.parse)(r),E.trim(r)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(r)}a(Lp,"stringifySafely");const Sr={transitional:kn,adapter:["xhr","http","fetch"],transformRequest:[a(function(e,t){const s=t.getContentType()||"",n=s.indexOf("application/json")>-1,i=E.isObject(e);if(i&&E.isHTMLForm(e)&&(e=new FormData(e)),E.isFormData(e))return n?JSON.stringify(ga(e)):e;if(E.isArrayBuffer(e)||E.isBuffer(e)||E.isStream(e)||E.isFile(e)||E.isBlob(e)||E.isReadableStream(e))return e;if(E.isArrayBufferView(e))return e.buffer;if(E.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){const l=Yt(this,"formSerializer");if(s.indexOf("application/x-www-form-urlencoded")>-1)return Cp(e,l).toString();if((o=E.isFileList(e))||s.indexOf("multipart/form-data")>-1){const h=Yt(this,"env"),u=h&&h.FormData;return is(o?{"files[]":e}:e,u&&new u,l)}}return i||n?(t.setContentType("application/json",!1),Lp(e)):e},"transformRequest")],transformResponse:[a(function(e){const t=Yt(this,"transitional")||Sr.transitional,s=t&&t.forcedJSONParsing,n=Yt(this,"responseType"),i=n==="json";if(E.isResponse(e)||E.isReadableStream(e))return e;if(e&&E.isString(e)&&(s&&!n||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,Yt(this,"parseReviver"))}catch(l){if(o)throw l.name==="SyntaxError"?B.from(l,B.ERR_BAD_RESPONSE,this,null,Yt(this,"response")):l}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Le.classes.FormData,Blob:Le.classes.Blob},validateStatus:a(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};E.forEach(["delete","get","head","post","put","patch","query"],r=>{Sr.headers[r]={}});function Rn(r,e){const t=this||Sr,s=e||t,n=xe.from(s.headers);let i=s.data;return E.forEach(r,a(function(o){i=o.call(t,i,n.normalize(),e?e.status:void 0)},"transform")),n.normalize(),i}a(Rn,"transformData");function ya(r){return!!(r&&r.__CANCEL__)}a(ya,"isCancel$1");let vr=class extends B{static{a(this,"CanceledError")}constructor(e,t,s){super(e??"canceled",B.ERR_CANCELED,t,s),this.name="CanceledError",this.__CANCEL__=!0}};function ba(r,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?r(t):e(new B("Request failed with status code "+t.status,t.status>=400&&t.status<500?B.ERR_BAD_REQUEST:B.ERR_BAD_RESPONSE,t.config,t.request,t))}a(ba,"settle");function Pp(r){const e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(r);return e&&e[1]||""}a(Pp,"parseProtocol");function Mp(r,e){r=r||10;const t=new Array(r),s=new Array(r);let n=0,i=0,c;return e=e!==void 0?e:1e3,a(function(l){const h=Date.now(),u=s[i];c||(c=h),t[n]=l,s[n]=h;let g=i,p=0;for(;g!==n;)p+=t[g++],g=g%r;if(n=(n+1)%r,n===i&&(i=(i+1)%r),h-c<e)return;const d=u&&h-u;return d?Math.round(p*1e3/d):void 0},"push")}a(Mp,"speedometer");function Fp(r,e){let t=0,s=1e3/e,n,i;const c=a((h,u=Date.now())=>{t=u,n=null,i&&(clearTimeout(i),i=null),r(...h)},"invoke");return[a((...h)=>{const u=Date.now(),g=u-t;g>=s?c(h,u):(n=h,i||(i=setTimeout(()=>{i=null,c(n)},s-g)))},"throttled"),a(()=>n&&c(n),"flush")]}a(Fp,"throttle");const os=a((r,e,t=3)=>{let s=0;const n=Mp(50,250);return Fp(i=>{if(!i||typeof i.loaded!="number")return;const c=i.loaded,o=i.lengthComputable?i.total:void 0,l=o!=null?Math.min(c,o):c,h=Math.max(0,l-s),u=n(h);s=Math.max(s,l);const g={loaded:l,total:o,progress:o?l/o:void 0,bytes:h,rate:u||void 0,estimated:u&&o?(o-l)/u:void 0,event:i,lengthComputable:o!=null,[e?"download":"upload"]:!0};r(g)},t)},"progressEventReducer"),_a=a((r,e)=>{const t=r!=null;return[s=>e[0]({lengthComputable:t,total:r,loaded:s}),e[1]]},"progressEventDecorator"),wa=a(r=>(...e)=>E.asap(()=>r(...e)),"asyncDecorator"),xp=Le.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,Le.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(Le.origin),Le.navigator&&/(msie|trident)/i.test(Le.navigator.userAgent)):()=>!0,$p=Le.hasStandardBrowserEnv?{write(r,e,t,s,n,i,c){if(typeof document>"u")return;const o=[`${r}=${encodeURIComponent(e)}`];E.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),E.isString(s)&&o.push(`path=${s}`),E.isString(n)&&o.push(`domain=${n}`),i===!0&&o.push("secure"),E.isString(c)&&o.push(`SameSite=${c}`),document.cookie=o.join("; ")},read(r){if(typeof document>"u")return null;const e=document.cookie.split(";");for(let t=0;t<e.length;t++){const s=e[t].replace(/^\s+/,""),n=s.indexOf("=");if(n!==-1&&s.slice(0,n)===r)return decodeURIComponent(s.slice(n+1))}return null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Bp(r){return typeof r!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}a(Bp,"isAbsoluteURL");function jp(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}a(jp,"combineURLs");function Sa(r,e,t){let s=!Bp(e);return r&&(s||t===!1)?jp(r,e):e}a(Sa,"buildFullPath");const va=a(r=>r instanceof xe?{...r}:r,"headersToObject");function Ct(r,e){e=e||{};const t=Object.create(null);Object.defineProperty(t,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function s(h,u,g,p){return E.isPlainObject(h)&&E.isPlainObject(u)?E.merge.call({caseless:p},h,u):E.isPlainObject(u)?E.merge({},u):E.isArray(u)?u.slice():u}a(s,"getMergedValue");function n(h,u,g,p){if(E.isUndefined(u)){if(!E.isUndefined(h))return s(void 0,h,g,p)}else return s(h,u,g,p)}a(n,"mergeDeepProperties");function i(h,u){if(!E.isUndefined(u))return s(void 0,u)}a(i,"valueFromConfig2");function c(h,u){if(E.isUndefined(u)){if(!E.isUndefined(h))return s(void 0,h)}else return s(void 0,u)}a(c,"defaultToConfig2");function o(h,u,g){if(E.hasOwnProp(e,g))return s(h,u);if(E.hasOwnProp(r,g))return s(void 0,h)}a(o,"mergeDirectKeys");const l={url:i,method:i,data:i,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,allowedSocketPaths:c,responseEncoding:c,validateStatus:o,headers:a((h,u,g)=>n(va(h),va(u),g,!0),"headers")};return E.forEach(Object.keys({...r,...e}),a(function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const g=E.hasOwnProp(l,u)?l[u]:n,p=E.hasOwnProp(r,u)?r[u]:void 0,d=E.hasOwnProp(e,u)?e[u]:void 0,f=g(p,d,u);E.isUndefined(f)&&g!==o||(t[u]=f)},"computeConfigValue")),t}a(Ct,"mergeConfig$1");const Up=["content-type","content-length"];function Vp(r,e,t){if(t!=="content-only"){r.set(e);return}Object.entries(e).forEach(([s,n])=>{Up.includes(s.toLowerCase())&&r.set(s,n)})}a(Vp,"setFormDataHeaders");const qp=a(r=>encodeURIComponent(r).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),"encodeUTF8"),Ea=a(r=>{const e=Ct({},r),t=a(p=>E.hasOwnProp(e,p)?e[p]:void 0,"own"),s=t("data");let n=t("withXSRFToken");const i=t("xsrfHeaderName"),c=t("xsrfCookieName");let o=t("headers");const l=t("auth"),h=t("baseURL"),u=t("allowAbsoluteUrls"),g=t("url");if(e.headers=o=xe.from(o),e.url=pa(Sa(h,g,u),r.params,r.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?qp(l.password):""))),E.isFormData(s)&&(Le.hasStandardBrowserEnv||Le.hasStandardBrowserWebWorkerEnv?o.setContentType(void 0):E.isFunction(s.getHeaders)&&Vp(o,s.getHeaders(),t("formDataHeaderPolicy"))),Le.hasStandardBrowserEnv&&(E.isFunction(n)&&(n=n(e)),n===!0||n==null&&xp(e.url))){const d=i&&c&&$p.read(c);d&&o.set(i,d)}return e},"resolveConfig"),Hp=typeof XMLHttpRequest<"u"&&function(r){return new Promise(a(function(t,s){const n=Ea(r);let i=n.data;const c=xe.from(n.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:h}=n,u,g,p,d,f;function m(){d&&d(),f&&f(),n.cancelToken&&n.cancelToken.unsubscribe(u),n.signal&&n.signal.removeEventListener("abort",u)}a(m,"done");let y=new XMLHttpRequest;y.open(n.method.toUpperCase(),n.url,!0),y.timeout=n.timeout;function b(){if(!y)return;const w=xe.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),T={data:!o||o==="text"||o==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:w,config:r,request:y};ba(a(function(R){t(R),m()},"_resolve"),a(function(R){s(R),m()},"_reject"),T),y=null}a(b,"onloadend"),"onloadend"in y?y.onloadend=b:y.onreadystatechange=a(function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(b)},"handleLoad"),y.onabort=a(function(){y&&(s(new B("Request aborted",B.ECONNABORTED,r,y)),m(),y=null)},"handleAbort"),y.onerror=a(function(S){const T=S&&S.message?S.message:"Network Error",v=new B(T,B.ERR_NETWORK,r,y);v.event=S||null,s(v),m(),y=null},"handleError"),y.ontimeout=a(function(){let S=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const T=n.transitional||kn;n.timeoutErrorMessage&&(S=n.timeoutErrorMessage),s(new B(S,T.clarifyTimeoutError?B.ETIMEDOUT:B.ECONNABORTED,r,y)),m(),y=null},"handleTimeout"),i===void 0&&c.setContentType(null),"setRequestHeader"in y&&E.forEach(la(c),a(function(S,T){y.setRequestHeader(T,S)},"setRequestHeader")),E.isUndefined(n.withCredentials)||(y.withCredentials=!!n.withCredentials),o&&o!=="json"&&(y.responseType=n.responseType),h&&([p,f]=os(h,!0),y.addEventListener("progress",p)),l&&y.upload&&([g,d]=os(l),y.upload.addEventListener("progress",g),y.upload.addEventListener("loadend",d)),(n.cancelToken||n.signal)&&(u=a(w=>{y&&(s(!w||w.type?new vr(null,r,y):w),y.abort(),m(),y=null)},"onCanceled"),n.cancelToken&&n.cancelToken.subscribe(u),n.signal&&(n.signal.aborted?u():n.signal.addEventListener("abort",u)));const _=Pp(n.url);if(_&&!Le.protocols.includes(_)){s(new B("Unsupported protocol "+_+":",B.ERR_BAD_REQUEST,r));return}y.send(i||null)},"dispatchXhrRequest"))},Wp=a((r,e)=>{if(r=r?r.filter(Boolean):[],!e&&!r.length)return;const t=new AbortController;let s=!1;const n=a(function(l){if(!s){s=!0,c();const h=l instanceof Error?l:this.reason;t.abort(h instanceof B?h:new vr(h instanceof Error?h.message:h))}},"onabort");let i=e&&setTimeout(()=>{i=null,n(new B(`timeout of ${e}ms exceeded`,B.ETIMEDOUT))},e);const c=a(()=>{r&&(i&&clearTimeout(i),i=null,r.forEach(l=>{l.unsubscribe?l.unsubscribe(n):l.removeEventListener("abort",n)}),r=null)},"unsubscribe");r.forEach(l=>l.addEventListener("abort",n));const{signal:o}=t;return o.unsubscribe=()=>E.asap(c),o},"composeSignals"),zp=a(function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let s=0,n;for(;s<t;)n=s+e,yield r.slice(s,n),s=n},"streamChunk"),Jp=a(async function*(r,e){for await(const t of Gp(r))yield*zp(t,e)},"readBytes"),Gp=a(async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:s}=await e.read();if(t)break;yield s}}finally{await e.cancel()}},"readStream"),Oa=a((r,e,t,s)=>{const n=Jp(r,e);let i=0,c,o=a(l=>{c||(c=!0,s&&s(l))},"_onFinish");return new ReadableStream({async pull(l){try{const{done:h,value:u}=await n.next();if(h){o(),l.close();return}let g=u.byteLength;if(t){let p=i+=g;t(p)}l.enqueue(new Uint8Array(u))}catch(h){throw o(h),h}},cancel(l){return o(l),n.return()}},{highWaterMark:2})},"trackStream");function Yp(r){if(!r||typeof r!="string"||!r.startsWith("data:"))return 0;const e=r.indexOf(",");if(e<0)return 0;const t=r.slice(5,e),s=r.slice(e+1);if(/;base64/i.test(t)){let c=s.length;const o=s.length;for(let d=0;d<o;d++)if(s.charCodeAt(d)===37&&d+2<o){const f=s.charCodeAt(d+1),m=s.charCodeAt(d+2);(f>=48&&f<=57||f>=65&&f<=70||f>=97&&f<=102)&&(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102)&&(c-=2,d+=2)}let l=0,h=o-1;const u=a(d=>d>=2&&s.charCodeAt(d-2)===37&&s.charCodeAt(d-1)===51&&(s.charCodeAt(d)===68||s.charCodeAt(d)===100),"tailIsPct3D");h>=0&&(s.charCodeAt(h)===61?(l++,h--):u(h)&&(l++,h-=3)),l===1&&h>=0&&(s.charCodeAt(h)===61||u(h))&&l++;const p=Math.floor(c/4)*3-(l||0);return p>0?p:0}if(typeof Buffer<"u"&&typeof Buffer.byteLength=="function")return Buffer.byteLength(s,"utf8");let i=0;for(let c=0,o=s.length;c<o;c++){const l=s.charCodeAt(c);if(l<128)i+=1;else if(l<2048)i+=2;else if(l>=55296&&l<=56319&&c+1<o){const h=s.charCodeAt(c+1);h>=56320&&h<=57343?(i+=4,c++):i+=3}else i+=3}return i}a(Yp,"estimateDataURLDecodedBytes");const Cn="1.16.1",Ta=64*1024,{isFunction:as}=E,ka=a((r,...e)=>{try{return!!r(...e)}catch{return!1}},"test"),Kp=a(r=>{const e=E.global!==void 0&&E.global!==null?E.global:globalThis,{ReadableStream:t,TextEncoder:s}=e;r=E.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},r);const{fetch:n,Request:i,Response:c}=r,o=n?as(n):typeof fetch=="function",l=as(i),h=as(c);if(!o)return!1;const u=o&&as(t),g=o&&(typeof s=="function"?(b=>_=>b.encode(_))(new s):async b=>new Uint8Array(await new i(b).arrayBuffer())),p=l&&u&&ka(()=>{let b=!1;const _=new i(Le.origin,{body:new t,method:"POST",get duplex(){return b=!0,"half"}}),w=_.headers.has("Content-Type");return _.body!=null&&_.body.cancel(),b&&!w}),d=h&&u&&ka(()=>E.isReadableStream(new c("").body)),f={stream:d&&(b=>b.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!f[b]&&(f[b]=(_,w)=>{let S=_&&_[b];if(S)return S.call(_);throw new B(`Response type '${b}' is not supported`,B.ERR_NOT_SUPPORT,w)})});const m=a(async b=>{if(b==null)return 0;if(E.isBlob(b))return b.size;if(E.isSpecCompliantForm(b))return(await new i(Le.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(E.isArrayBufferView(b)||E.isArrayBuffer(b))return b.byteLength;if(E.isURLSearchParams(b)&&(b=b+""),E.isString(b))return(await g(b)).byteLength},"getBodyLength"),y=a(async(b,_)=>{const w=E.toFiniteNumber(b.getContentLength());return w??m(_)},"resolveBodyLength");return async b=>{let{url:_,method:w,data:S,signal:T,cancelToken:v,timeout:R,onDownloadProgress:O,onUploadProgress:k,responseType:N,headers:j,withCredentials:V="same-origin",fetchOptions:pe,maxContentLength:me,maxBodyLength:Y}=Ea(b);const se=E.isNumber(me)&&me>-1,W=E.isNumber(Y)&&Y>-1;let Ee=n||fetch;N=N?(N+"").toLowerCase():"text";let ie=Wp([T,v&&v.toAbortSignal()],R),F=null;const Re=ie&&ie.unsubscribe&&(()=>{ie.unsubscribe()});let tt;try{if(se&&typeof _=="string"&&_.startsWith("data:")&&Yp(_)>me)throw new B("maxContentLength size of "+me+" exceeded",B.ERR_BAD_RESPONSE,b,F);if(W&&w!=="get"&&w!=="head"){const Z=await y(j,S);if(typeof Z=="number"&&isFinite(Z)&&Z>Y)throw new B("Request body larger than maxBodyLength limit",B.ERR_BAD_REQUEST,b,F)}if(k&&p&&w!=="get"&&w!=="head"&&(tt=await y(j,S))!==0){let Z=new i(_,{method:"POST",body:S,duplex:"half"}),Se;if(E.isFormData(S)&&(Se=Z.headers.get("content-type"))&&j.setContentType(Se),Z.body){const[H,$e]=_a(tt,os(wa(k)));S=Oa(Z.body,Ta,H,$e)}}E.isString(V)||(V=V?"include":"omit");const ue=l&&"credentials"in i.prototype;if(E.isFormData(S)){const Z=j.getContentType();Z&&/^multipart\/form-data/i.test(Z)&&!/boundary=/i.test(Z)&&j.delete("content-type")}j.set("User-Agent","axios/"+Cn,!1);const K={...pe,signal:ie,method:w.toUpperCase(),headers:la(j.normalize()),body:S,duplex:"half",credentials:ue?V:void 0};F=l&&new i(_,K);let Q=await(l?Ee(F,pe):Ee(_,K));if(se){const Z=E.toFiniteNumber(Q.headers.get("content-length"));if(Z!=null&&Z>me)throw new B("maxContentLength size of "+me+" exceeded",B.ERR_BAD_RESPONSE,b,F)}const he=d&&(N==="stream"||N==="response");if(d&&Q.body&&(O||se||he&&Re)){const Z={};["status","statusText","headers"].forEach(St=>{Z[St]=Q[St]});const Se=E.toFiniteNumber(Q.headers.get("content-length")),[H,$e]=O&&_a(Se,os(wa(O),!0))||[];let Xt=0;const Qt=a(St=>{if(se&&(Xt=St,Xt>me))throw new B("maxContentLength size of "+me+" exceeded",B.ERR_BAD_RESPONSE,b,F);H&&H(St)},"onChunkProgress");Q=new c(Oa(Q.body,Ta,Qt,()=>{$e&&$e(),Re&&Re()}),Z)}N=N||"text";let ae=await f[E.findKey(f,N)||"text"](Q,b);if(se&&!d&&!he){let Z;if(ae!=null&&(typeof ae.byteLength=="number"?Z=ae.byteLength:typeof ae.size=="number"?Z=ae.size:typeof ae=="string"&&(Z=typeof s=="function"?new s().encode(ae).byteLength:ae.length)),typeof Z=="number"&&Z>me)throw new B("maxContentLength size of "+me+" exceeded",B.ERR_BAD_RESPONSE,b,F)}return!he&&Re&&Re(),await new Promise((Z,Se)=>{ba(Z,Se,{data:ae,headers:xe.from(Q.headers),status:Q.status,statusText:Q.statusText,config:b,request:F})})}catch(ue){if(Re&&Re(),ie&&ie.aborted&&ie.reason instanceof B){const K=ie.reason;throw K.config=b,F&&(K.request=F),ue!==K&&(K.cause=ue),K}throw ue&&ue.name==="TypeError"&&/Load failed|fetch/i.test(ue.message)?Object.assign(new B("Network Error",B.ERR_NETWORK,b,F,ue&&ue.response),{cause:ue.cause||ue}):B.from(ue,ue&&ue.code,b,F,ue&&ue.response)}}},"factory"),Zp=new Map,Ia=a(r=>{let e=r&&r.env||{};const{fetch:t,Request:s,Response:n}=e,i=[s,n,t];let c=i.length,o=c,l,h,u=Zp;for(;o--;)l=i[o],h=u.get(l),h===void 0&&u.set(l,h=o?new Map:Kp(e)),u=h;return h},"getFetch");Ia();const Nn={http:vp,xhr:Hp,fetch:{get:Ia}};E.forEach(Nn,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(r,"adapterName",{__proto__:null,value:e})}});const Aa=a(r=>`- ${r}`,"renderReason"),Xp=a(r=>E.isFunction(r)||r===null||r===!1,"isResolvedHandle");function Qp(r,e){r=E.isArray(r)?r:[r];const{length:t}=r;let s,n;const i={};for(let c=0;c<t;c++){s=r[c];let o;if(n=s,!Xp(s)&&(n=Nn[(o=String(s)).toLowerCase()],n===void 0))throw new B(`Unknown adapter '${o}'`);if(n&&(E.isFunction(n)||(n=n.get(e))))break;i[o||"#"+c]=n}if(!n){const c=Object.entries(i).map(([l,h])=>`adapter ${l} `+(h===!1?"is not supported by the environment":"is not available in the build"));let o=t?c.length>1?`since :
|
|
44
|
+
`+c.map(Aa).join(`
|
|
45
|
+
`):" "+Aa(c[0]):"as no adapter specified";throw new B("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n}a(Qp,"getAdapter$1");const Ra={getAdapter:Qp,adapters:Nn};function Dn(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new vr(null,r)}a(Dn,"throwIfCancellationRequested");function Ca(r){return Dn(r),r.headers=xe.from(r.headers),r.data=Rn.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Ra.getAdapter(r.adapter||Sr.adapter,r)(r).then(a(function(s){Dn(r),r.response=s;try{s.data=Rn.call(r,r.transformResponse,s)}finally{delete r.response}return s.headers=xe.from(s.headers),s},"onAdapterResolution"),a(function(s){if(!ya(s)&&(Dn(r),s&&s.response)){r.response=s.response;try{s.response.data=Rn.call(r,r.transformResponse,s.response)}finally{delete r.response}s.response.headers=xe.from(s.response.headers)}return Promise.reject(s)},"onAdapterRejection"))}a(Ca,"dispatchRequest");const cs={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{cs[r]=a(function(s){return typeof s===r||"a"+(e<1?"n ":" ")+r},"validator")});const Na={};cs.transitional=a(function(e,t,s){function n(i,c){return"[Axios v"+Cn+"] Transitional option '"+i+"'"+c+(s?". "+s:"")}return a(n,"formatMessage"),(i,c,o)=>{if(e===!1)throw new B(n(c," has been removed"+(t?" in "+t:"")),B.ERR_DEPRECATED);return t&&!Na[c]&&(Na[c]=!0,console.warn(n(c," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,c,o):!0}},"transitional"),cs.spelling=a(function(e){return(t,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)},"spelling");function em(r,e,t){if(typeof r!="object")throw new B("options must be an object",B.ERR_BAD_OPTION_VALUE);const s=Object.keys(r);let n=s.length;for(;n-- >0;){const i=s[n],c=Object.prototype.hasOwnProperty.call(e,i)?e[i]:void 0;if(c){const o=r[i],l=o===void 0||c(o,i,r);if(l!==!0)throw new B("option "+i+" must be "+l,B.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new B("Unknown option "+i,B.ERR_BAD_OPTION)}}a(em,"assertOptions");const ls={assertOptions:em,validators:cs},Ge=ls.validators;let Nt=class{static{a(this,"Axios")}constructor(e){this.defaults=e||{},this.interceptors={request:new ma,response:new ma}}async request(e,t){try{return await this._request(e,t)}catch(s){if(s instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const i=(()=>{if(!n.stack)return"";const c=n.stack.indexOf(`
|
|
46
46
|
`);return c===-1?"":n.stack.slice(c+1)})();try{if(!s.stack)s.stack=i;else if(i){const c=i.indexOf(`
|
|
47
47
|
`),o=c===-1?-1:i.indexOf(`
|
|
48
|
-
`,c+1),
|
|
49
|
-
`+i)}}catch{}}throw s}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Rt(this.defaults,t);const{transitional:s,paramsSerializer:n,headers:i}=t;s!==void 0&&os.assertOptions(s,{silentJSONParsing:Ge.transitional(Ge.boolean),forcedJSONParsing:Ge.transitional(Ge.boolean),clarifyTimeoutError:Ge.transitional(Ge.boolean),legacyInterceptorReqResOrdering:Ge.transitional(Ge.boolean)},!1),n!=null&&(O.isFunction(n)?t.paramsSerializer={serialize:n}:os.assertOptions(n,{encode:Ge.function,serialize:Ge.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),os.assertOptions(t,{baseUrl:Ge.spelling("baseURL"),withXsrfToken:Ge.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let c=i&&O.merge(i.common,i[t.method]);i&&O.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),t.headers=xe.concat(c,i);const o=[];let u=!0;this.interceptors.request.forEach(a(function(m){if(typeof m.runWhen=="function"&&m.runWhen(t)===!1)return;u=u&&m.synchronous;const y=t.transitional||Sn;y&&y.legacyInterceptorReqResOrdering?o.unshift(m.fulfilled,m.rejected):o.push(m.fulfilled,m.rejected)},"unshiftRequestInterceptors"));const h=[];this.interceptors.response.forEach(a(function(m){h.push(m.fulfilled,m.rejected)},"pushResponseInterceptors"));let l,g=0,p;if(!u){const d=[Aa.bind(this),void 0];for(d.unshift(...o),d.push(...h),p=d.length,l=Promise.resolve(t);g<p;)l=l.then(d[g++],d[g++]);return l}p=o.length;let f=t;for(;g<p;){const d=o[g++],m=o[g++];try{f=d(f)}catch(y){m.call(this,y);break}}try{l=Aa.call(this,f)}catch(d){return Promise.reject(d)}for(g=0,p=h.length;g<p;)l=l.then(h[g++],h[g++]);return l}getUri(e){e=Rt(this.defaults,e);const t=ya(e.baseURL,e.url,e.allowAbsoluteUrls);return la(t,e.params,e.paramsSerializer)}};O.forEach(["delete","get","head","options"],a(function(e){Ct.prototype[e]=function(t,s){return this.request(Rt(s||{},{method:e,url:t,data:(s||{}).data}))}},"forEachMethodNoData")),O.forEach(["post","put","patch"],a(function(e){function t(s){return a(function(i,c,o){return this.request(Rt(o||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:c}))},"httpMethod")}a(t,"generateHTTPMethod"),Ct.prototype[e]=t(),Ct.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));let Jp=class Lc{static{a(this,"CancelToken")}constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(a(function(i){t=i},"promiseExecutor"));const s=this;this.promise.then(n=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](n);s._listeners=null}),this.promise.then=n=>{let i;const c=new Promise(o=>{s.subscribe(o),i=o}).then(n);return c.cancel=a(function(){s.unsubscribe(i)},"reject"),c},e(a(function(i,c,o){s.reason||(s.reason=new _r(i,c,o),t(s.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=a(s=>{e.abort(s)},"abort");return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Lc(a(function(n){e=n},"executor")),cancel:e}}};function Gp(r){return a(function(t){return r.apply(null,t)},"wrap")}a(Gp,"spread$1");function Yp(r){return O.isObject(r)&&r.isAxiosError===!0}a(Yp,"isAxiosError$1");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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(An).forEach(([r,e])=>{An[e]=r});function Na(r){const e=new Ct(r),t=Yo(Ct.prototype.request,e);return O.extend(t,Ct.prototype,e,{allOwnKeys:!0}),O.extend(t,e,null,{allOwnKeys:!0}),t.create=a(function(n){return Na(Rt(r,n))},"create"),t}a(Na,"createInstance");const pe=Na(yr);pe.Axios=Ct,pe.CanceledError=_r,pe.CancelToken=Jp,pe.isCancel=fa,pe.VERSION=Ra,pe.toFormData=ts,pe.AxiosError=q,pe.Cancel=pe.CanceledError,pe.all=a(function(e){return Promise.all(e)},"all"),pe.spread=Gp,pe.isAxiosError=Yp,pe.mergeConfig=Rt,pe.AxiosHeaders=xe,pe.formToJSON=r=>ha(O.isHTMLForm(r)?new FormData(r):r),pe.getAdapter=Ia.getAdapter,pe.HttpStatusCode=An,pe.default=pe;const{Axios:Zy,AxiosError:Rn,CanceledError:Ky,isCancel:Xy,CancelToken:Qy,VERSION:e0,all:t0,Cancel:r0,isAxiosError:s0,spread:n0,toFormData:i0,AxiosHeaders:o0,HttpStatusCode:a0,formToJSON:c0,getAdapter:l0,mergeConfig:u0}=pe;var Zp=Object.defineProperty,Kp=a((r,e)=>Zp(r,"name",{value:e,configurable:!0}),"t$5");const Xp="X-Request-ID",Qp="bx24_request_id",eg="bx24_sdk_ver",tg="bx24_sdk_type";class rg{static{a(this,"RequestIdGenerator")}static{Kp(this,"RequestIdGenerator")}getQueryStringParameterName(){return Qp}getQueryStringSdkParameterName(){return eg}getQueryStringSdkTypeParameterName(){return tg}generate(){return z.getUuidRfc4122()}getRequestId(){return this.generate()}getHeaderFieldName(){return Xp}}var sg=Object.defineProperty,ng=a((r,e)=>sg(r,"name",{value:e,configurable:!0}),"m$5");class Da{static{a(this,"AbstractHttp")}static{ng(this,"AbstractHttp")}_clientAxios;_authActions;_requestIdGenerator;_restrictionManager;_logger;_isClientSideWarning=!1;_clientSideWarningMessage="";_version;_metrics={totalRequests:0,successfulRequests:0,failedRequests:0,totalDuration:0,byMethod:new Map,lastErrors:[]};constructor(e,t,s){this._version=K.v2,this._logger=ee.createNullLogger();const n={};this.isServerSide()&&(n["User-Agent"]="b24-js-sdk/1.1.2"),this._authActions=e,this._requestIdGenerator=new rg,this._clientAxios=pe.create({headers:{...n,...t?t.headers:{}},timeout:3e4,timeoutErrorMessage:"Request timeout exceeded",...t&&{...t,headers:void 0}});const i={...tn.getDefault(),...s};this._restrictionManager=new fr(i)}get apiVersion(){return this._version}get ajaxClient(){return this._clientAxios}setLogger(e){this._logger=e,this._restrictionManager.setLogger(this._logger)}getLogger(){return this._logger}async setRestrictionManagerParams(e){await this._restrictionManager.setConfig(e)}getRestrictionManagerParams(){return this._restrictionManager.getParams()}getStats(){return{...this._restrictionManager.getStats(),totalRequests:this._metrics.totalDuration,successfulRequests:this._metrics.successfulRequests,failedRequests:this._metrics.failedRequests,totalDuration:this._metrics.totalDuration,byMethod:this._metrics.byMethod,lastErrors:this._metrics.lastErrors}}async reset(){return this._metrics.totalDuration=0,this._metrics.successfulRequests=0,this._metrics.failedRequests=0,this._metrics.totalDuration=0,this._metrics.byMethod.clear(),this._metrics.lastErrors=[],this._restrictionManager.reset()}_updateMetrics(e,t,s,n){this._metrics.totalRequests++,t?this._metrics.successfulRequests++:(this._metrics.failedRequests++,n instanceof be&&(this._metrics.lastErrors.push({method:e,error:n.message,timestamp:Date.now()}),this._metrics.lastErrors.length>100&&(this._metrics.lastErrors=this._metrics.lastErrors.slice(-100)))),this._metrics.byMethod.has(e)||this._metrics.byMethod.set(e,{count:0,totalDuration:0});const i=this._metrics.byMethod.get(e);i.count++,i.totalDuration+=s}_validateParams(e,t,s){try{JSON.stringify(s)}catch(n){throw new be({code:"JSSDK_INVALID_PARAMS",description:"Parameters contain circular references",status:400,requestInfo:{method:t,params:s,requestId:e},originalError:n})}}async call(e,t,s){s=s??this._requestIdGenerator.getRequestId();const n=this._restrictionManager.getParams().maxRetries;this._validateParams(s,e,t),this._logRequest(s,e,t);let i=null;const c=Date.now();for(let o=0;o<n;o++)try{this._logAttempt(s,e,o+1,n),await this._restrictionManager.applyOperatingLimits(s,e,t);const u=await this._executeSingleCall(s,e,t),h=Date.now()-c;return this._restrictionManager.resetErrors(e),this._updateMetrics(e,!0,h),this._logSuccessfulRequest(s,e,h),u}catch(u){i=this._convertToAjaxError(s,u,e,t);const h=Date.now()-c;if(this._restrictionManager.incrementError(e),this._updateMetrics(e,!1,h,i),this._logFailedRequest(s,e,o+1,n,i),o<n){const l=await this._restrictionManager.handleError(s,e,t,i,o);if(l>0){this._restrictionManager.incrementStats("limitHits"),this._logAttemptRetryWaiteDelay(s,e,l,o+1,n),await this._restrictionManager.waiteDelay(l),this._restrictionManager.incrementStats("retries");continue}}if(o+1===n&&this._logAllAttemptsExhausted(s,e,o+1,n),this._restrictionManager.exceptionCodeForSoft.includes(i.code))return this._createAjaxResultWithErrorFromResponse(i,s,e,t);throw i}throw new be({code:"JSSDK_CALL_ALL_ATTEMPTS_EXHAUSTED",description:"All attempts exhausted",status:i?.status||500,requestInfo:{method:e,params:t,requestId:s},originalError:i?.originalError||null})}_convertToAjaxError(e,t,s,n){return t instanceof be?t:t instanceof Rn?this._convertAxiosErrorToAjaxError(e,t,s,n):this._convertUnknownErrorToAjaxError(e,t,s,n)}_convertAxiosErrorToAjaxError(e,t,s,n){let i=`${t.code||"JSSDK_AXIOS_ERROR"}`,c=t.message;const o=t.response?.status||0;if(i==="ERR_NETWORK")return new be({code:"NETWORK_ERROR",description:"Network connection failed",status:0,requestInfo:{method:s,params:n,requestId:e},originalError:t});if(i==="ECONNABORTED"||t.message.includes("timeout"))return new be({code:"REQUEST_TIMEOUT",description:"Request timeout exceeded",status:408,requestInfo:{method:s,params:n,requestId:e},originalError:t});if(t.response?.data&&typeof t.response.data=="object"){const u=t.response.data;u.error&&typeof u.error=="object"&&"code"in u.error?(i=u.error.code,c=u.error.message.trimEnd(),u.error.validation&&(c.length>0&&(c.endsWith(".")||(c+="."),c+=" "),u.error.validation.forEach(h=>{c+=`${h?.message||JSON.stringify(h)}`}))):u.error&&typeof u.error=="string"&&(i=u.error!=="0"?u.error:i,c=u?.error_description??c)}return new be({code:i,description:c,status:o,requestInfo:{method:s,params:n,requestId:e},originalError:t})}_convertUnknownErrorToAjaxError(e,t,s,n){return new be({code:"JSSDK_UNKNOWN_ERROR",description:t instanceof Error?t.message:String(t),status:0,requestInfo:{method:s,params:n,requestId:e},originalError:t})}async _executeSingleCall(e,t,s){this._checkClientSideWarning(e);const n=await this._ensureAuth(e),i=await this._makeRequestWithAuthRetry(e,t,s,n);return this._createAjaxResultFromResponse(i,e,t,s)}async _ensureAuth(e){let t=this._authActions.getAuthData();return t===!1&&(this._logRefreshingAuthToken(e),t=await this._authActions.refreshAuth()),t}async _makeRequestWithAuthRetry(e,t,s,n){try{return await this._restrictionManager.checkRateLimit(e,t),await this._makeAxiosRequest(e,t,s,n)}catch(i){if(i instanceof Rn&&this.getLogger().info("post/catchError",{requestId:e,status:i.status,responseData:JSON.stringify(hr(i?.response?.data),null,0)}),this._isAuthError(i)){this._logAuthErrorDetected(e),this._logRefreshingAuthToken(e);const c=await this._authActions.refreshAuth();return await this._restrictionManager.checkRateLimit(e,t),await this._makeAxiosRequest(e,t,s,c)}throw i}}async _makeAxiosRequest(e,t,s,n){const i=this._prepareMethod(e,t,this.getBaseUrl()),c=this._prepareParams(n,s),o=JSON.stringify(hr(c),null,0),u=300,h=100;this.getLogger().info("post/send",{requestId:e,method:t,params:o.length>u?o.slice(0,h)+"...":o});const l=await this._clientAxios.post(i,c),g=JSON.stringify(l.data.result,null,0);return this.getLogger().info("post/response",{requestId:e,result:g.length>u?g.slice(0,h)+"...":g,time:JSON.stringify(l.data.time,null,0)}),{status:l.status,payload:l.data}}_isAuthError(e){return e instanceof be?e.status===401&&["expired_token","invalid_token"].includes(e.code):!1}async _createAjaxResultFromResponse(e,t,s,n){const i=new dr({answer:e.payload,query:{method:s,params:n,requestId:t},status:e.status});if(i.isSuccess){const c=i.getData()?.time;await this._restrictionManager.updateStats(t,s,c)}return i}_createAjaxResultWithErrorFromResponse(e,t,s,n){return new dr({answer:{error:{code:e.code,message:e.message}},query:{method:s,params:n,requestId:t},status:e.status})}_prepareParams(e,t){const s={...t};if(e.refresh_token!=="hook"&&(s.auth=e.access_token),s?.data&&"start"in s.data){const{start:n,...i}=s.data;s.data=i}return s}setClientSideWarning(e,t){this._isClientSideWarning=e,this._clientSideWarningMessage=t}isServerSide(){return Ur()!==ar.BROWSE}getBaseUrl(){return this._authActions.getTargetOriginWithPath().get(this._version)}_sanitizeParams(e){return hr(e)}_logRequest(e,t,s){this.getLogger().debug("http request starting",{requestId:e,method:t,params:this._sanitizeParams(s),api:this.apiVersion,timestamp:Date.now()})}_logAttempt(e,t,s,n){this.getLogger().info("http request attempt",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n}})}_logRefreshingAuthToken(e){this.getLogger().info("http refreshing auth token",{requestId:e,api:this.apiVersion})}_logAuthErrorDetected(e){this.getLogger().info("http auth error detected",{requestId:e,api:this.apiVersion})}_logSuccessfulRequest(e,t,s){this.getLogger().debug("http request successful",{requestId:e,method:t,api:this.apiVersion,duration:{ms:s,sec:Number.parseFloat((s/1e3).toFixed(2))}})}_logFailedRequest(e,t,s,n,i){this.getLogger().debug("http request failed",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n},error:{code:i.code,message:i.message,status:i.status}})}_logAttemptRetryWaiteDelay(e,t,s,n,i){this.getLogger().debug(`http wait ${(s/1e3).toFixed(2)} sec.`,{requestId:e,method:t,api:this.apiVersion,wait:s,attempt:{current:n,max:i}})}_logAllAttemptsExhausted(e,t,s,n){this.getLogger().warning("http all retry attempts exhausted",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n}})}_logBatchStart(e,t,s){const n=Array.isArray(t)?t.length:Object.keys(t).length;this.getLogger().debug("http batch request starting ",{requestId:e,callCount:n,api:this.apiVersion,isHaltOnError:s.isHaltOnError,timestamp:Date.now()})}_logBatchCompletion(e,t,s){this.getLogger().debug("http batch request completed",{requestId:e,api:this.apiVersion,totalCalls:t,successful:t-s,failed:s,successRate:t>0?((t-s)/t*100).toFixed(1)+"%":"??"})}_checkClientSideWarning(e){this._isClientSideWarning&&!this.isServerSide()&&P.isStringFilled(this._clientSideWarningMessage)&&ee.forcedLog(this.getLogger(),"warning",this._clientSideWarningMessage,{requestId:e,code:"JSSDK_CLIENT_SIDE_WARNING"})}}var ig=Object.defineProperty,og=a((r,e)=>ig(r,"name",{value:e,configurable:!0}),"r$7");class Ma{static{a(this,"AbstractInteractionBatch")}static{og(this,"AbstractInteractionBatch")}parallelDefaultValue;requestId;restrictionManager;processingStrategy;_commands=[];constructor(e){this.parallelDefaultValue=e.parallelDefaultValue,this.requestId=e.requestId,this.restrictionManager=e.restrictionManager,this.processingStrategy=e.processingStrategy}setProcessingStrategy(e){this.processingStrategy=e}get size(){return this._commands.length}get maxSize(){return 0}addCommands(e){if(!this.processingStrategy)throw new ne({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});this._commands=this.processingStrategy.prepareCommands(e,{parallelDefaultValue:this.parallelDefaultValue})}getCommandsForCall(){if(!this.processingStrategy)throw new ne({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});return this.processingStrategy.buildCommands(this._commands)}}var ag=Object.defineProperty,cg=a((r,e)=>ag(r,"name",{value:e,configurable:!0}),"s$d");const lg=50;class ug extends Ma{static{a(this,"InteractionBatchV2")}static{cg(this,"InteractionBatchV2")}get maxSize(){return lg}async prepareResponse(e){if(!this.processingStrategy)throw new ne({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});const t={requestId:e.getQuery().requestId,parallelDefaultValue:this.parallelDefaultValue,restrictionManager:this.restrictionManager,response:e},s=await this.processingStrategy.prepareItems(this._commands,t);return this.processingStrategy.handleResults(this._commands,s,t)}}const hg=String.prototype.replace,dg=/%20/g,Pa={RFC1738:"RFC1738",RFC3986:"RFC3986"},fg={RFC1738:a(function(r){return hg.call(r,dg,"+")},"RFC1738"),RFC3986:a(function(r){return String(r)},"RFC3986")},pg=Pa.RFC1738,gg=Pa.RFC3986,mg=Array.isArray,it=(function(){const r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r})(),Cn=1024,yg=a(function(e,t,s,n){if(e.length===0)return e;let i=e;typeof e=="symbol"?i=Symbol.prototype.toString.call(e):typeof e!="string"&&(i=String(e));let c="";for(let o=0;o<i.length;o+=Cn){const u=i.length>=Cn?i.slice(o,o+Cn):i,h=[];for(let l=0;l<u.length;++l){let g=u.charCodeAt(l);if(g===45||g===46||g===95||g===126||g>=48&&g<=57||g>=65&&g<=90||g>=97&&g<=122||n===pg&&(g===40||g===41)){h[h.length]=u.charAt(l);continue}if(g<128){h[h.length]=it[g];continue}if(g<2048){h[h.length]=it[192|g>>6]+it[128|g&63];continue}if(g<55296||g>=57344){h[h.length]=it[224|g>>12]+it[128|g>>6&63]+it[128|g&63];continue}l+=1,g=65536+((g&1023)<<10|u.charCodeAt(l)&1023),h[h.length]=it[240|g>>18]+it[128|g>>12&63]+it[128|g>>6&63]+it[128|g&63]}c+=h.join("")}return c},"encode"),bg=a(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),La=a(function(e,t){if(mg(e)){const s=[];for(let n=0;n<e.length;n+=1)s.push(t(e[n]));return s}return t(e)},"maybeMap"),_g={brackets:a(function(e){return e+"[]"},"brackets"),comma:"comma",indices:a(function(e,t){return e+"["+t+"]"},"indices"),repeat:a(function(e){return e},"repeat")},ht=Array.isArray,wg=Array.prototype.push,Fa=a(function(r,e){wg.apply(r,ht(e)?e:[e])},"pushToArray"),Sg=Date.prototype.toISOString,xa=gg,as={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:yg,encodeValuesOnly:!1,format:xa,formatter:fg[xa],indices:!1,serializeDate:a(function(e){return Sg.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},vg=a(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),Nn={},$a=a(function(e,t,s,n,i,c,o,u,h,l,g,p,f,d,m,y,b){let _=e,w=b,S=0,T=!1;for(;(w=w.get(Nn))!==void 0&&!T;){const D=w.get(e);if(S+=1,typeof D<"u"){if(D===S)throw new RangeError("Cyclic object value");T=!0}typeof w.get(Nn)>"u"&&(S=0)}if(typeof l=="function"?_=l(t,_):_ instanceof Date?_=f(_):s==="comma"&&ht(_)&&(_=La(_,function(D){return D instanceof Date?f(D):D})),_===null){if(c)return h&&!y?h(t,as.encoder,"key",d):t;_=""}if(vg(_)||bg(_)){if(h){const D=y?t:h(t,as.encoder,"key",d);return[m(D)+"="+m(h(_,as.encoder,"value",d))]}return[m(t)+"="+m(String(_))]}const v=[];if(typeof _>"u")return v;let I;if(s==="comma"&&ht(_))y&&h&&(_=La(_,h)),I=[{value:_.length>0?_.join(",")||null:void 0}];else if(ht(l))I=l;else{const D=Object.keys(_);I=g?D.sort(g):D}const E=u?t.replace(/\./g,"%2E"):t,k=n&&ht(_)&&_.length===1?E+"[]":E;if(i&&ht(_)&&_.length===0)return k+"[]";for(let D=0;D<I.length;++D){const B=I[D],U=typeof B=="object"&&typeof B.value<"u"?B.value:_[B];if(o&&U===null)continue;const oe=p&&u?B.replace(/\./g,"%2E"):B,_e=ht(_)?typeof s=="function"?s(k,oe):k:k+(p?"."+oe:"["+oe+"]");b.set(e,S);const G=new WeakMap;G.set(Nn,b),Fa(v,$a(U,_e,s,n,i,c,o,u,s==="comma"&&y&&ht(_)?null:h,l,g,p,f,d,m,y,G))}return v},"stringify"),Eg=a(function(e){return as},"normalizeStringifyOptions");function Og(r,e){let t=r;const s=Eg();let n,i;typeof s.filter=="function"?(i=s.filter,t=i("",t)):ht(s.filter)&&(i=s.filter,n=i);const c=[];if(typeof t!="object"||t===null)return"";const o=_g[s.arrayFormat],u=o==="comma"&&s.commaRoundTrip;n||(n=Object.keys(t)),s.sort&&n.sort(s.sort);const h=new WeakMap;for(let p=0;p<n.length;++p){const f=n[p];s.skipNulls&&t[f]===null||Fa(c,$a(t[f],f,o,u,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,h))}const l=c.join(s.delimiter),g=s.addQueryPrefix===!0?"?":"";return l.length>0?g+l:""}a(Og,"stringify");var Tg=Object.defineProperty,kg=a((r,e)=>Tg(r,"name",{value:e,configurable:!0}),"s$c");class ja{static{a(this,"AbstractProcessing")}static{kg(this,"AbstractProcessing")}_getBatchResultByIndex(e,t){if(e)return e[t]}_createErrorFromAjaxResult(e){return e.hasError("base-error")?e.errors.get("base-error"):new be({code:"JSSDK_BATCH_SUB_ERROR",description:e.getErrorMessages().join("; "),status:e.getStatus(),requestInfo:{...e.getQuery()},originalError:e.getErrors().next().value})}}var Ig=Object.defineProperty,Ag=a((r,e)=>Ig(r,"name",{value:e,configurable:!0}),"l$6");class Ba extends ja{static{a(this,"AbstractProcessingV2")}static{Ag(this,"AbstractProcessingV2")}_buildRow(e){return`${e.method}?${Og(e.query||{})}`}buildCommands(e){if(e.length<1)throw new ne({code:"JSSDK_INTERACTION_BATCH_STRATEGY_V2_EMPTY_COMMANDS",description:"commands not set",status:500});const t=e[0];if(typeof t.as=="string"&&t.as.length>0){const n={};for(const i of e)n[i.as]=this._buildRow(i);return n}const s=[];for(const n of e)s.push(this._buildRow(n));return s}async prepareItems(e,t){const s=new Map;for(const[n,i]of e.entries())await this._processResponseItem(i,i.as??n,t,s);return s}async _processResponseItem(e,t,s,n){const i=s.response.getData().result,c=this._getBatchResultByIndex(i.result,t),o=this._getBatchResultByIndex(i.result_error,t);if(typeof c<"u"||typeof o<"u"){const u=e.method,h=this._getBatchResultByIndex(i.result_time,t);typeof h<"u"&&await s.restrictionManager.updateStats(s.requestId,`batch::${u}`,h);const l=new dr({answer:{error:o?typeof o=="string"?o:o.error:void 0,error_description:o?typeof o=="string"?void 0:o.error_description:void 0,result:c,total:Number.parseInt(this._getBatchResultByIndex(i.result_total,t)||"0"),next:Number.parseInt(this._getBatchResultByIndex(i.result_next,t)||"0"),time:h},query:{method:u,params:e.query||{},requestId:s.requestId},status:s.response.getStatus()});n.set(t,l);return}if(s.parallelDefaultValue)throw new ne({code:"JSSDK_INTERACTION_BATCH_STRATEGY_V2_EMPTY_COMMAND_RESPONSE",description:`There were difficulties parsing the response for batch { index: ${t}, method: ${e.method} }`,status:500})}async handleResults(e,t,s){const n=new Pe,i=new Map;for(const[c,o]of t){if(o.getStatus()!==200||!o.isSuccess){const u=this._createErrorFromAjaxResult(o);this._processResponseError(n,u,`${c}`),i.set(c,o)}i.set(c,o)}return n.setData({result:i,time:s.response.getData().time}),n}}var Rg=Object.defineProperty,Cg=a((r,e)=>Rg(r,"name",{value:e,configurable:!0}),"o$8");class Ng extends Ba{static{a(this,"ProcessingAsArrayV2")}static{Cg(this,"ProcessingAsArrayV2")}prepareCommands(e,t){const s=[];return e.forEach(n=>{const i=bt.getBatchCommand(n,t);s.push(i)}),s}_processResponseError(e,t,s){e.addError(t)}}var Dg=Object.defineProperty,Mg=a((r,e)=>Dg(r,"name",{value:e,configurable:!0}),"s$b");class Pg extends Ba{static{a(this,"ProcessingAsObjectV2")}static{Mg(this,"ProcessingAsObjectV2")}prepareCommands(e,t){const s=[];return Object.entries(e).forEach(([n,i])=>{const c=bt.getBatchCommand(i,{...t,asDefaultValue:n});s.push(c)}),s}_processResponseError(e,t,s){e.addError(t,s)}}var Lg=Object.defineProperty,Fg=a((r,e)=>Lg(r,"name",{value:e,configurable:!0}),"i$6");class cs extends Da{static{a(this,"HttpV2")}static{Fg(this,"HttpV2")}constructor(e,t,s){super(e,t,s),this._version=K.v2}async batch(e,t){const s={isHaltOnError:!0,...t},n=s.requestId??this._requestIdGenerator.getRequestId();this._logBatchStart(n,e,s);const i=new ug({requestId:n,parallelDefaultValue:!s.isHaltOnError,restrictionManager:this._restrictionManager});if(Array.isArray(e)?i.setProcessingStrategy(new Ng):i.setProcessingStrategy(new Pg),i.addCommands(e),i.size>i.maxSize)throw new be({code:"JSSDK_BATCH_TOO_LARGE",description:`Batch too large: ${i.size} commands (max: ${i.maxSize})`,status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});if(i.size===0)throw new be({code:"JSSDK_BATCH_EMPTY",description:"Batch must contain at least one command",status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});const c=await this.call("batch",{halt:s.isHaltOnError?1:0,cmd:i.getCommandsForCall()},n),o=await i.prepareResponse(c);return this._logBatchCompletion(n,o.getData()?.result?.size??0,o.getErrorMessages().length),o}_prepareMethod(e,t,s){const n=`/${encodeURIComponent(t)}`;if(t.includes("task."))return`${s}${n}`;const i=new URLSearchParams({[this._requestIdGenerator.getQueryStringParameterName()]:e,[this._requestIdGenerator.getQueryStringSdkParameterName()]:"1.1.2",[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]:"b24-js-sdk"});return`${s}${n}?${i.toString()}`}}var xg=Object.defineProperty,$g=a((r,e)=>xg(r,"name",{value:e,configurable:!0}),"s$a");const jg=50;class Bg extends Ma{static{a(this,"InteractionBatchV3")}static{$g(this,"InteractionBatchV3")}get maxSize(){return jg}async prepareResponse(e){if(!this.processingStrategy)throw new ne({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});const t={requestId:e.getQuery().requestId,parallelDefaultValue:this.parallelDefaultValue,restrictionManager:this.restrictionManager,response:e},s=await this.processingStrategy.prepareItems(this._commands,t);return this.processingStrategy.handleResults(this._commands,s,t)}}var Ug=Object.defineProperty,Vg=a((r,e)=>Ug(r,"name",{value:e,configurable:!0}),"p$4");class Ua extends ja{static{a(this,"AbstractProcessingV3")}static{Vg(this,"AbstractProcessingV3")}buildCommands(e){if(e.length<1)throw new ne({code:"JSSDK_INTERACTION_BATCH_BUILD_STRATEGY_V3_EMPTY_COMMANDS",description:"commands not set",status:500});return e}async prepareItems(e,t){const s=new Map;if(!t.response.isSuccess)return s;for(const[n,i]of e.entries())await this._processResponseItem(i,n,t,s);return s}async _processResponseItem(e,t,s,n){const i=s.response.getData().result,c=this._getBatchResultByIndex(i,t);if(typeof c>"u")throw new ne({code:"JSSDK_INTERACTION_BATCH_STRATEGY_V3_EMPTY_COMMAND_RESPONSE",description:`There were difficulties parsing the response for batch { index: ${t}, method: ${e.method} }`,status:500});const o=s.response.getData().time,u=new dr({answer:{result:c,error:void 0,time:o},query:{method:e.method,params:e.query||{},requestId:s.requestId},status:s.response.getStatus()});n.set(t,u)}async handleResults(e,t,s){const n=new Pe,i=new Map;if(!s.response.isSuccess){for(const[c,o]of s.response.errors)n.addError(o,c);return n.setData({result:i,time:void 0}),n}for(const[c,o]of t){const u=Number.parseInt(`${c}`),h=e[u];if(typeof h>"u")throw new ne({code:"JSSDK_INTERACTION_BATCH_BUILD_STRATEGY_V3_EMPTY_COMMAND",description:`command for index ${c} not set`,status:500});const l=h.as??c;if(o.getStatus()!==200||!o.isSuccess){const g=this._createErrorFromAjaxResult(o);this._processResponseError(n,g,`${l}`),i.set(l,o)}i.set(l,o)}return n.setData({result:i,time:s.response.getData().time}),n}}var qg=Object.defineProperty,Wg=a((r,e)=>qg(r,"name",{value:e,configurable:!0}),"o$6");class Hg extends Ua{static{a(this,"ProcessingAsArrayV3")}static{Wg(this,"ProcessingAsArrayV3")}prepareCommands(e,t){const s=[];return e.forEach(n=>{const i=bt.getBatchCommand(n,t);s.push(i)}),s}_processResponseError(e,t,s){e.addError(t)}}var zg=Object.defineProperty,Jg=a((r,e)=>zg(r,"name",{value:e,configurable:!0}),"s$9");class Gg extends Ua{static{a(this,"ProcessingAsObjectV3")}static{Jg(this,"ProcessingAsObjectV3")}prepareCommands(e,t){const s=[];return Object.entries(e).forEach(([n,i])=>{const c=bt.getBatchCommand(i,{...t,asDefaultValue:n});s.push(c)}),s}_processResponseError(e,t,s){e.addError(t,s)}}var Yg=Object.defineProperty,Zg=a((r,e)=>Yg(r,"name",{value:e,configurable:!0}),"i$5");class ls extends Da{static{a(this,"HttpV3")}static{Zg(this,"HttpV3")}constructor(e,t,s){super(e,t,s),this._version=K.v3}async batch(e,t){const s={isHaltOnError:!0,...t},n=s.requestId??this._requestIdGenerator.getRequestId();this._logBatchStart(n,e,s);const i=new Bg({requestId:n,parallelDefaultValue:!s.isHaltOnError,restrictionManager:this._restrictionManager});if(Array.isArray(e)?i.setProcessingStrategy(new Hg):i.setProcessingStrategy(new Gg),i.addCommands(e),i.size>i.maxSize)throw new be({code:"JSSDK_BATCH_TOO_LARGE",description:`Batch too large: ${i.size} commands (max: ${i.maxSize})`,status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});if(i.size===0)throw new be({code:"JSSDK_BATCH_EMPTY",description:"Batch must contain at least one command",status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});const c=await this.call("batch",i.getCommandsForCall(),n),o=await i.prepareResponse(c);return this._logBatchCompletion(n,o.getData()?.result?.size??0,o.getErrorMessages().length),o}_prepareMethod(e,t,s){const n=`/${encodeURIComponent(t)}`,i=new URLSearchParams({[this._requestIdGenerator.getQueryStringParameterName()]:e,[this._requestIdGenerator.getQueryStringSdkParameterName()]:"1.1.2",[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]:"b24-js-sdk"});return`${s}${n}?${i.toString()}`}}var Kg=Object.defineProperty,Xg=a((r,e)=>Kg(r,"name",{value:e,configurable:!0}),"e$3");const Qg=Xg(()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)}),"useScrollSize");var em=Object.defineProperty,tm=a((r,e)=>em(r,"name",{value:e,configurable:!0}),"s$8");let rm=class St{static{a(this,"t")}static{tm(this,"FormatterNumbers")}static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!St.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");St.isInternalConstructing=!1}static getInstance(){return St.instance||(St.isInternalConstructing=!0,St.instance=new St),St.instance}setDefLocale(e){this._defLocale=e}format(e,t){let s;(typeof t>"u"||!P.isStringFilled(t))&&(t=P.isStringFilled(this._defLocale)?this._defLocale||"en":typeof navigator>"u"?"en":navigator?.language||"en"),Number.isInteger(e)?s=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):s=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let n=s.format(e);return t.includes("ru")&&(n=n.replace(",",".")),n}};var sm=Object.defineProperty,Va=a((r,e)=>sm(r,"name",{value:e,configurable:!0}),"n$7");class A{static{a(this,"IbanSpecification")}static{Va(this,"IbanSpecification")}countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,s,n){this.countryCode=e,this.length=t,this.structure=s,this.example=n}isValid(e){return this.length===e.length&&this.countryCode===e.slice(0,2)&&this._regex().test(e.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(e))==1}toBBAN(e,t){return(this._regex().exec(e.slice(4)||"")||[]).slice(1).join(t)}fromBBAN(e){if(!this.isValidBBAN(e))throw new Error("Invalid BBAN");const t=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+e)))).slice(-2);return this.countryCode+t+e}isValidBBAN(e){return this.length-4===e.length&&this._regex().test(e)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(e){const t=(e.match(/(.{3})/g)||[]).map(s=>{let n;const i=s.slice(0,1),c=Number.parseInt(s.slice(1),10);switch(i){case"A":n="0-9A-Za-z";break;case"B":n="0-9A-Z";break;case"C":n="A-Za-z";break;case"F":n="0-9";break;case"L":n="a-z";break;case"U":n="A-Z";break;case"W":n="0-9a-z";break}return"(["+n+"]{"+c+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const s=t.charCodeAt(0);return s>=65&&s<=90?(s-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,s;for(;t.length>2;)s=t.slice(0,9),t=Number.parseInt(s,10)%97+t.slice(s.length);return Number.parseInt(t,10)%97}}class dt{static{a(this,"FormatterIban")}static{Va(this,"FormatterIban")}static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!dt.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");dt.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return dt.instance||(dt.isInternalConstructing=!0,dt.instance=new dt),dt.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!P.isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const s=this._countries.get(t);return!!s&&s.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const s=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(s,"$1"+t)}electronicFormat(e){const t=/[^a-z0-9]/gi;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const s=e.slice(0,2);if(!this._countries.has(s))throw new Error(`No country with code ${s}`);const n=this._countries.get(s);if(!n)throw new Error(`No country with code ${s}`);return n.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const s=this._countries.get(e);if(!s)throw new Error(`No country with code ${e}`);return s.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!P.isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const s=this._countries.get(e);return!!s&&s.isValidBBAN(this.electronicFormat(t))}}var nm=Object.defineProperty,im=a((r,e)=>nm(r,"name",{value:e,configurable:!0}),"n$6");const om=im(()=>{const r=rm.getInstance(),e=dt.getInstance();return e.addSpecification(new A("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new A("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new A("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new A("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new A("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new A("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new A("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new A("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new A("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new A("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new A("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new A("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new A("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new A("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new A("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new A("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new A("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new A("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new A("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new A("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new A("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new A("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new A("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new A("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new A("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new A("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new A("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new A("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new A("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new A("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new A("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new A("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new A("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new A("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new A("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new A("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new A("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new A("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new A("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new A("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new A("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new A("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new A("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new A("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new A("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new A("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new A("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new A("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new A("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new A("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new A("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new A("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new A("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new A("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new A("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new A("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new A("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new A("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new A("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new A("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new A("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new A("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new A("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new A("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new A("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new A("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new A("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new A("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new A("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new A("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new A("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new A("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new A("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new A("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new A("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new A("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new A("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new A("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new A("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new A("BI",16,"F12","BI41123456789012")),e.addSpecification(new A("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new A("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new A("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new A("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new A("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new A("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new A("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new A("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new A("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new A("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new A("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new A("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new A("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new A("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new A("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new A("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new A("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new A("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new A("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new A("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new A("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new A("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}},"useFormatter");var am=Object.defineProperty,cm=a((r,e)=>am(r,"name",{value:e,configurable:!0}),"r$6");class qa{static{a(this,"AuthHookManager")}static{cm(this,"AuthHookManager")}#e;#r;#s;#t;#i;constructor(e){this.#e=Object.freeze(Object.assign({},e)),this.#r=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#s=`https://${this.#r}/rest`,this.#t=`https://${this.#r}`,this.#i=new Map,this.#i.set(K.v2,`${this.#s}/${this.#e.userId}/${this.#e.secret}`),this.#i.set(K.v3,`${this.#s}/api/${this.#e.userId}/${this.#e.secret}`)}getAuthData(){return{access_token:this.#e.secret,refresh_token:"hook",expires:0,expires_in:0,domain:this.#r,member_id:this.#r}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#t}`}getTargetOriginWithPath(){return this.#i}get isAdmin(){return!0}}var lm=Object.defineProperty,um=a((r,e)=>lm(r,"name",{value:e,configurable:!0}),"s$7");class Dn extends Yr{static{a(this,"B24Hook")}static{um(this,"B24Hook")}#e;constructor(e,t){super(),this.#e=new qa(e);const s=`The B24Hook object is intended exclusively for use on the server.
|
|
50
|
-
A webhook contains a secret access key, which MUST NOT be used in client-side code (browser, mobile app).`;this._httpV2=new cs(this.#e,this._getHttpOptions(),t?.restrictionParams),this._httpV2.setClientSideWarning(!0,s),this._httpV3=new ls(this.#e,this._getHttpOptions(),t?.restrictionParams),this._httpV3.setClientSideWarning(!0,s),this._isInit=!0}get auth(){return this.#e}offClientSideWarning(){nt.getAllApiVersions().forEach(e=>{this.getHttpClient(e).setClientSideWarning(!1,"")})}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}static fromWebhookUrl(e,t){if(!e.trim())throw new Error("Webhook URL cannot be empty");let s;try{s=new URL(e.replace("/rest/api","/rest"))}catch{throw new Error(`Invalid webhook URL format: ${e}`)}if(s.protocol!=="https:")throw new Error("Webhook requires HTTPS protocol");const n=s.pathname.split("/").filter(Boolean);if(!(n.length===3&&n[0]==="rest"||n.length===4&&n[0]==="rest"&&n[1]==="api"))throw new Error("Webhook URL must follow format: /rest/<userId>/<secret> or /rest/api/<userId>/<secret>");const i=n[1]==="api"?2:1,c=n[1]==="api"?3:2,o=n[i],u=n[c];if(!/^\d+$/.test(o))throw new Error(`User ID must be numeric in webhook URL, received: ${o}`);const h=Number.parseInt(o,10);return new Dn({b24Url:s.origin,userId:h,secret:u},t)}}var ie=(r=>(r.getInitData="getInitData",r.setInstallFinish="setInstallFinish",r.setInstall="setInstall",r.refreshAuth="refreshAuth",r.setAppOption="setAppOption",r.setUserOption="setUserOption",r.resizeWindow="resizeWindow",r.reloadWindow="reloadWindow",r.setTitle="setTitle",r.setScroll="setScroll",r.openApplication="openApplication",r.closeApplication="closeApplication",r.openPath="openPath",r.imCallTo="imCallTo",r.imPhoneTo="imPhoneTo",r.imOpenMessenger="imOpenMessenger",r.imOpenHistory="imOpenHistory",r.selectUser="selectUser",r.selectAccess="selectAccess",r.selectCRM="selectCRM",r.showAppForm="showAppForm",r.getInterface="getInterface",r.placementBindEvent="placementBindEvent",r))(ie||{}),hm=Object.defineProperty,dm=a((r,e)=>hm(r,"name",{value:e,configurable:!0}),"m$3");class Wa{static{a(this,"MessageManager")}static{dm(this,"MessageManager")}#e;#r;#s;_logger;runCallbackHandler;constructor(e){this._logger=ee.createNullLogger(),this.#e=e,this.#r=new Map,this.#s=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(e,t=null){return new Promise((s,n)=>{let i;const c={resolve:s,reject:n,timeoutId:null},o=this.#t(c);let u=null;const h=Ys(t||{},["singleOption","callBack","isSafely","safelyTime","requestId"]),{callBack:l,singleOption:g,requestId:p}=t||{};if(l&&this.#s.set(o,l),g?u=g:Object.keys(h).length>0&&(u={...h}),e.toString().includes(":"))i={method:e.toString(),params:u||"",callback:o,appSid:this.#e.getAppSid(),requestId:p};else{i=e.toString(),t?.isRawValue!==!0&&u?u=JSON.stringify(u):t?.isRawValue===!0&&u&&P.isPlainObject(u)&&u.value&&(u=u.value);const f=[u||"",o,this.#e.getAppSid()];i+=":"+f.filter(Boolean).join(":")}if(this.getLogger().debug(`send to ${this.#e.getTargetOrigin()}`,{cmd:i,origin:this.#e.getTargetOrigin()}),parent.postMessage(i,this.#e.getTargetOrigin()),t?.isSafely){const f=Number.parseInt(String(t?.safelyTime||900));this.#r.get(o).timeoutId=window.setTimeout(()=>{this.#r.has(o)&&(this.getLogger().warning(`action ${e.toString()} stop by timeout`,{command:e.toString(),safelyTime:f}),this.#r.delete(o),s({isSafely:!0}))},f)}})}_runCallback(e){if(e.origin===this.#e.getTargetOrigin()&&e.data){this.getLogger().debug(`get from ${e.origin}`,{data:e.data,origin:e.origin});const t=e.data.split(":"),s={id:t[0],args:t.slice(1).join(":")};if(s.args&&(s.args=JSON.parse(s.args)),this.#r.has(s.id)){const n=this.#r.get(s.id);n.timeoutId&&clearTimeout(n.timeoutId),this.#r.delete(s.id),n.resolve(s.args)}else if(this.#s.has(s.id)){const n=this.#s.get(s.id);n&&n.apply(globalThis,[s.args])}}}#t(e){const t=z.getUniqId();return this.#r.set(t,e),t}}var fm=Object.defineProperty,pm=a((r,e)=>fm(r,"name",{value:e,configurable:!0}),"h$1");class Ha{static{a(this,"AppFrame")}static{pm(this,"AppFrame")}#e="";#r=!0;#s=null;#t=null;#i=null;#n;#o;#c;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#r=e.PROTOCOL===!0,e.LANG&&(this.#i=e.LANG),e.APP_SID&&(this.#s=e.APP_SID),this.#c=new Map,this.#o=`${this.#r?"https":"http"}://${this.#e}`,this.#n=`${this.#o}/rest`,this.#c.set(K.v2,`${this.#n}`),this.#c.set(K.v3,`${this.#n}/api`)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#t||(this.#t=e.PATH),this.#i||(this.#i=e.LANG),this.#r=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this.#o=`${this.#r?"https":"http"}://${this.#e}`,this.#n=`${this.#o}/rest`,this.#c.set(K.v2,`${this.#n}`),this.#c.set(K.v3,`${this.#n}/api`),this}getAppSid(){if(this.#s===null)throw new Error("Not init appSid");return this.#s}getTargetOrigin(){return this.#o}getTargetOriginWithPath(){return this.#c}getLang(){return this.#i||Qs.en}}var gm=Object.defineProperty,mm=a((r,e)=>gm(r,"name",{value:e,configurable:!0}),"s$6");class za{static{a(this,"AuthManager")}static{mm(this,"AuthManager")}#e=null;#r=null;#s=0;#t=0;#i=null;#n=!1;#o;#c;constructor(e,t){this.#o=e,this.#c=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#r=e.REFRESH_ID,this.#t=Number.parseInt(e.AUTH_EXPIRES),this.#s=Date.now()+this.#t*1e3,this.#n=e.IS_ADMIN,this.#i=e.MEMBER_ID||""),this}getAuthData(){return this.#s>Date.now()?{access_token:this.#e,refresh_token:this.#r,expires:this.#s/1e3,expires_in:this.#t,domain:this.#o.getTargetOrigin(),member_id:this.#i}:!1}async refreshAuth(){return this.#c.send(ie.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#r=e.REFRESH_ID,this.#s=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#i||""].join("_")}get isAdmin(){return this.#n}getTargetOrigin(){return this.#o.getTargetOrigin()}getTargetOriginWithPath(){return this.#o.getTargetOriginWithPath()}}var ym=Object.defineProperty,bm=a((r,e)=>ym(r,"name",{value:e,configurable:!0}),"m$2");class Ja{static{a(this,"ParentManager")}static{bm(this,"ParentManager")}#e;constructor(e){this.#e=e}get message(){return this.#e}async closeApplication(){return this.#e.send(ie.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(ie.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(ie.resizeWindow,{width:e,height:t,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${e} or height:number = ${t}`))}async resizeWindowAuto(e=null,t=0,s=0){const n=document.body;let i=Math.max(n.scrollWidth,n.offsetWidth);s>0&&(i=Math.max(s,i));let c=Math.max(n.scrollHeight,n.offsetHeight);return e&&(c=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(c=Math.max(t,c)),this.resizeWindow(i,c)}getScrollSize(){return Qg()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(ie.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(ie.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(ie.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(ie.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(ie.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(ie.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(ie.imOpenHistory,{dialogId:e,isSafely:!0})}}var _m=Object.defineProperty,wm=a((r,e)=>_m(r,"name",{value:e,configurable:!0}),"r$4");let Ga=class{static{a(this,"OptionsManager")}static{wm(this,"OptionsManager")}#e;#r=null;#s=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#r=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#s=e.USER_OPTIONS),this}appGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#r||(this.#r=[]),this.#r[e]=t,this.#t(ie.setAppOption,e,this.#r[e])}userGet(e){if(this.#s&&this.#s[e])return this.#s[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#r||(this.#r=[]),this.#r[e]||(this.#r[e]=null),this.#s[e]=t,this.#t(ie.setUserOption,e,this.#s[e])}async#t(e,t,s){return this.#e.send(e,{name:t,value:s,isSafely:!0}).then(()=>Promise.resolve())}};var Sm=Object.defineProperty,Ya=a((r,e)=>Sm(r,"name",{value:e,configurable:!0}),"i$3");class Za{static{a(this,"DialogManager")}static{Ya(this,"DialogManager")}#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(ie.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(ie.selectUser,{mult:!0})}async selectAccess(e=[]){return this.#e.send(ie.selectAccess,{value:e})}async selectCRM(e){const t=await this.#e.send(ie.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value}),s={};if(!t)return s;const n=Ya(l=>{if(l!=null)return Array.isArray(l)?l:Object.values(l)},"toArray"),i=n(t.lead);i&&(s.lead=i);const c=n(t.contact);c&&(s.contact=c);const o=n(t.company);o&&(s.company=o);const u=n(t.deal);u&&(s.deal=u);const h=n(t.quote);return h&&(s.quote=h),s}}var vm=Object.defineProperty,Em=a((r,e)=>vm(r,"name",{value:e,configurable:!0}),"m$1");class Ka{static{a(this,"SliderManager")}static{Em(this,"SliderManager")}#e;#r;constructor(e,t){this.#e=e,this.#r=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#r.send(ie.openApplication,e)}async closeSliderAppPage(){return this.#r.send(ie.closeApplication,{isSafely:!1})}#s(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const s=new URL(e);return s.searchParams.set("IFRAME","Y"),s.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#r.send(ie.openPath,{path:[this.#s(t),s.pathname,s.search].join("")}).then(n=>n?.result==="error"?n?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((i,c)=>{const o=window.open(e,"_blank");if(!o){c(new Error("Error open window"));return}let u=0;const h=1e3*60*5,l=window.setInterval(()=>{u=u+1,o.closed?(clearInterval(l),i({isOpenAtNewWindow:!0,isClose:!0})):u>h&&(clearInterval(l),i({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(n?.errorCode)):n?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}}var Om=Object.defineProperty,Tm=a((r,e)=>Om(r,"name",{value:e,configurable:!0}),"i$2");class Xa{static{a(this,"PlacementManager")}static{Tm(this,"PlacementManager")}#e;#r="";#s={};constructor(e){this.#e=e}initData(e){return this.#r=e.PLACEMENT||"DEFAULT",this.#s=Object.freeze(e.PLACEMENT_OPTIONS),this}get title(){return this.#r}get placement(){return this.#r}get isDefault(){return this.placement==="DEFAULT"}get options(){return this.#s}get isSliderMode(){return this.options?.IFRAME==="Y"}async getInterface(){return this.#e.send(ie.getInterface,{isSafely:!0})}async bindEvent(e,t){return this.#e.send(ie.placementBindEvent,{event:e,callBack:t,isSafely:!0})}async call(e,t={}){if(e==="setValue"&&!P.isString(t?.value))throw new TypeError("placement.call('setValue', { value }) expects `value` to be a JSON-serialized string. Use placement.setValue(value) to serialize automatically, or call JSON.stringify yourself.");return this.#e.send(e,{...t,isSafely:!0,isRawValue:["setValue"].includes(e)})}async setValue(e){return this.#e.send("setValue",{value:JSON.stringify(e),isSafely:!0,isRawValue:!0})}async callCustomBind(e,t=null,s){let n={};return P.isString(t)?n.singleOption=t:P.isObjectLike(t)&&(n={...t}),this.#e.send(e,{...n,callBack:s,isSafely:!0})}}var km=Object.defineProperty,Im=a((r,e)=>km(r,"name",{value:e,configurable:!0}),"r$3");class Qa extends Yr{static{a(this,"B24Frame")}static{Im(this,"B24Frame")}#e=!1;#r=!1;#s;#t;#i;#n;#o;#c;#h;#d;#a;constructor(e,t){super(),this.#a=t?.restrictionParams,this.#s=new Ha(e),this.#t=new Wa(this.#s),this.#t.subscribe(),this.#i=new za(this.#s,this.#t),this.#n=new Ja(this.#t),this.#o=new Ga(this.#t),this.#c=new Za(this.#t),this.#h=new Ka(this.#s,this.#t),this.#d=new Xa(this.#t),this._isInit=!1}setLogger(e){super.setLogger(e),this.#t.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#r}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#n}get auth(){return this._ensureInitialized(),this.#i}get slider(){return this._ensureInitialized(),this.#h}get placement(){return this._ensureInitialized(),this.#d}get options(){return this._ensureInitialized(),this.#o}get dialog(){return this._ensureInitialized(),this.#c}async init(){const e=await this.#t.send(ie.getInitData,{});return this.getLogger().debug("init data",{data:e}),this.#s.initData(e),this.#i.initData(e),this.#d.initData(e),this.#o.initData(e),this.#e=e.INSTALL,this.#r=e.FIRST_RUN,this._httpV2=new cs(this.#i,this._getHttpOptions(),this.#a),this._httpV3=new ls(this.#i,this._getHttpOptions(),this.#a),this._isInit=!0,this.#r?this.#t.send(ie.setInstall,{install:!0}):Promise.resolve()}destroy(){this.#t.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#t.send(ie.setInstallFinish,{}):Promise.reject(new Error("Application was previously installed. You cannot call installFinish"))}getTargetOrigin(){return this._ensureInitialized(),this.#i.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#i.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#s.getAppSid()}getLang(){return this._ensureInitialized(),this.#s.getLang()}}var Am=Object.defineProperty,Rm=a((r,e)=>Am(r,"name",{value:e,configurable:!0}),"e$2");class ec extends ne{static{a(this,"RefreshTokenError")}static{Rm(this,"RefreshTokenError")}}var Cm=Object.defineProperty,Nm=a((r,e)=>Cm(r,"name",{value:e,configurable:!0}),"n$5");class tc{static{a(this,"AuthOAuthManager")}static{Nm(this,"AuthOAuthManager")}#e;#r=null;#s=null;#t;#i;#n=0;#o=0;#c;#h;#d;#a;#u;#l=null;constructor(e,t){this.#t=Object.assign({},e),this.#i=Object.freeze(Object.assign({},t)),this.#c=this.#t.domain.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#h=this.#t.clientEndpoint,this.#d=this.#h.replace("/rest/",""),this.#u=this.#t.serverEndpoint.replace("/rest/",""),this.#n=this.#t.expires*1e3,this.#o=this.#t.expiresIn,this.#e=pe.create({baseURL:this.#u,headers:{"Content-Type":"application/json"}}),this.#a=new Map,this.#a.set(K.v2,`${this.#h}`),this.#a.set(K.v3,`${this.#h}/api`)}getAuthData(){return this.#n>Date.now()?{access_token:this.#t.accessToken,refresh_token:this.#t.refreshToken,expires:this.#n/1e3,expires_in:this.#o,domain:this.#c,member_id:this.#t.memberId}:!1}async refreshAuth(){try{let e;if(this.#s)e=await this.#s();else{const s=await this.#e.get("/oauth/token/",{params:{grant_type:"refresh_token",client_id:this.#i.clientId,client_secret:this.#i.clientSecret,refresh_token:this.#t.refreshToken}});if(s.data.error)throw new Error(`Token update error: ${s.data.error}`);if(s.status!==200)throw new Error(`Token update error status code: ${s.status}`);e=s.data}if(!e)throw new Error("Unable to obtain authorization update data");this.#t.accessToken=e.access_token,this.#t.refreshToken=e.refresh_token,this.#t.expires=Number.parseInt(e.expires||"0"),this.#t.expiresIn=Number.parseInt(e.expires_in||"3600"),this.#t.clientEndpoint=e.client_endpoint,this.#t.serverEndpoint=e.server_endpoint,this.#t.scope=e.scope,this.#t.status=Object.values(lt).find(s=>s===e.status)||lt.Free,this.#n=this.#t.expires*1e3;const t=this.getAuthData();return this.#r&&await this.#r({authData:t,b24OAuthParams:this.#t}),t}catch(e){if(e instanceof Rn){const t={code:e?.code||0,description:e?.message||""};if(e.response&&e.response.data&&!P.isUndefined(e.response.data.error)){const s=e.response.data;s.error&&typeof s.error=="object"&&"code"in s.error?(t.code=s.error.code,t.description=s.error.message,s.error.validation&&s.error.validation.forEach(n=>{t.description+=`${n?.message||JSON.stringify(n)}`})):s.error&&typeof s.error=="string"&&(t.code=s.error,t.description=s?.error_description??t.description)}throw new ec({code:String(t.code),description:t.description,status:e.response?.status||0})}else if(e instanceof Error)throw e;throw new Error(`Strange error: ${e instanceof Error?e.message:e}`,{cause:e})}}setCallbackRefreshAuth(e){this.#r=e}removeCallbackRefreshAuth(){this.#r=null}setCustomRefreshAuth(e){this.#s=e}removeCustomRefreshAuth(){this.#s=null}getUniq(e){return[e,this.#t.memberId||""].join("_")}getTargetOrigin(){return`${this.#d}`}getTargetOriginWithPath(){return this.#a}get isAdmin(){if(this.#l===null)throw new Error("isAdmin not init. You need call B24OAuth::initIsAdmin().");return this.#l}async initIsAdmin(e,t){if(this.#l=!1,e.apiVersion===K.v3){const n=await e.call("profile",{},t);if(!n.isSuccess)throw new Error(n.getErrorMessages().join(";"));n.getData().result.profile?.admin&&(this.#l=!0);return}const s=await e.call("profile",{},t);if(!s.isSuccess)throw new Error(s.getErrorMessages().join(";"));s.getData().result?.ADMIN&&(this.#l=!0)}}var Dm=Object.defineProperty,Mm=a((r,e)=>Dm(r,"name",{value:e,configurable:!0}),"n$4");class Pm extends Yr{static{a(this,"B24OAuth")}static{Mm(this,"B24OAuth")}#e;constructor(e,t,s){super(),this.#e=new tc(e,t);const n=`The B24OAuth object is intended exclusively for use on the server.
|
|
51
|
-
A webhook contains a secret access key, which MUST NOT be used in client-side code (browser, mobile app).`;this._httpV2=new cs(this.#e,this._getHttpOptions(),s?.restrictionParams),this._httpV2.setClientSideWarning(!0,n),this._httpV3=new ls(this.#e,this._getHttpOptions(),s?.restrictionParams),this._httpV3.setClientSideWarning(!0,n),this._isInit=!0}async initIsAdmin(e){const t="profile";this._ensureInitialized();try{const s=nt.automaticallyObtainApiVersion(t),n=this.getHttpClient(s);return this.#e.initIsAdmin(n,e)}catch{return}}setCallbackRefreshAuth(e){this._ensureInitialized(),this.#e.setCallbackRefreshAuth(e)}removeCallbackRefreshAuth(){this._ensureInitialized(),this.#e.removeCallbackRefreshAuth()}setCustomRefreshAuth(e){this._ensureInitialized(),this.#e.setCustomRefreshAuth(e)}removeCustomRefreshAuth(){this._ensureInitialized(),this.#e.removeCustomRefreshAuth()}offClientSideWarning(){nt.getAllApiVersions().forEach(e=>{this.getHttpClient(e).setClientSideWarning(!1,"")})}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var Lm=Object.defineProperty,rc=a((r,e)=>Lm(r,"name",{value:e,configurable:!0}),"t$3");class Mn extends Error{static{a(this,"UnhandledMatchError")}static{rc(this,"UnhandledMatchError")}constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=`${new Error("for stack").stack}`}}class Yt{static{a(this,"AbstractHelper")}static{rc(this,"AbstractHelper")}_b24;_data=null;_logger;constructor(e){this._b24=e,this._logger=ee.createNullLogger()}setLogger(e){this._logger=e}getLogger(){return this._logger}async initData(e){return Promise.reject(new Error("Rewrite this function"))}}var Fm=Object.defineProperty,xm=a((r,e)=>Fm(r,"name",{value:e,configurable:!0}),"t$2");class $m extends Yt{static{a(this,"ProfileManager")}static{xm(this,"ProfileManager")}_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}var jm=Object.defineProperty,Bm=a((r,e)=>jm(r,"name",{value:e,configurable:!0}),"a$4");class Um extends Yt{static{a(this,"AppManager")}static{Bm(this,"AppManager")}_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return Wo[this.data.status]||"Unknown status"}}var Vm=Object.defineProperty,qm=a((r,e)=>Vm(r,"name",{value:e,configurable:!0}),"a$3");class Wm extends Yt{static{a(this,"PaymentManager")}static{qm(this,"PaymentManager")}_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}var Hm=Object.defineProperty,zm=a((r,e)=>Hm(r,"name",{value:e,configurable:!0}),"t$1");class Jm extends Yt{static{a(this,"LicenseManager")}static{zm(this,"LicenseManager")}_data=null;async initData(e){this._data=e,await this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}async makeRestrictionManagerParams(){if(!this.data?.license)return;const e=tn.fromTariffPlan(this.data.license);this.getLogger().debug("set restriction manager params",{license:this.data.license,restrictionParams:e}),await this._b24.setRestrictionManagerParams(e)}}var Gm=Object.defineProperty,Ym=a((r,e)=>Gm(r,"name",{value:e,configurable:!0}),"l$4");class Zm extends Yt{static{a(this,"CurrencyManager")}static{Ym(this,"CurrencyManager")}async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(this.getLogger().error("Failed to load data",{error:t}),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{const t=(await this._b24.actions.v2.batchByChunk.make({calls:e,options:{isHaltOnError:!0}})).getData();if(!Array.isArray(t))return Promise.resolve();t.forEach(s=>{if(typeof s.LANG>"u")return;const n=s.CURRENCY,i=this.data.currencyList.get(n);if(!(typeof i>"u"))for(const[c,o]of Object.entries(s.LANG))switch(i.lang[c]={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[c].thousandsVariant){case"N":i.lang[c].thousandsSep="";break;case"D":i.lang[c].thousandsSep=".";break;case"C":i.lang[c].thousandsSep=",";break;case"S":i.lang[c].thousandsSep=" ";break;case"B":i.lang[c].thousandsSep=" ";break;default:P.isStringFilled(i.lang[c].thousandsSep)||(i.lang[c].thousandsSep=" ");break}})}catch(t){this.getLogger().error("Failed to load data",{error:t})}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(e){this._data.currencyBase=e}get baseCurrency(){return this.data.currencyBase}setCurrencyList(e=[]){this.data.currencyList.clear();for(const t of e)this.data.currencyList.set(t.CURRENCY,{amount:Number.parseFloat(t.CURRENCY),amountCnt:Number.parseInt(t.AMOUNT_CNT),isBase:t.BASE==="Y",currencyCode:t.CURRENCY,dateUpdate:z.toDateTime(t.DATE_UPDATE),decimals:Number.parseInt(t.DECIMALS),decPoint:t.DEC_POINT,formatString:t.FORMAT_STRING,fullName:t.FULL_NAME,lid:t.LID,sort:Number.parseInt(t.SORT),thousandsSep:t?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(e,t){const s=this.data.currencyList.get(e);if(typeof s>"u")throw new Mn(e);let n=s.fullName;if(!(typeof t>"u")){const i=s.lang[t];P.isUndefined(i)||(n=i.fullName)}return n}getCurrencyLiteral(e,t){const s=this.data.currencyList.get(e);if(typeof s>"u")throw new Mn(e);let n=s.formatString;if(!(typeof t>"u")){const i=s.lang[t];P.isUndefined(i)||(n=i.formatString)}return n.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,s){const n=this.data.currencyList.get(t);if(typeof n>"u")throw new Mn(t);const i={formatString:n.formatString,decimals:n.decimals,decPoint:n.decPoint,thousandsSep:n.thousandsSep};P.isStringFilled(i.thousandsSep)||(i.thousandsSep="");const c=n.lang[s];return P.isUndefined(c)||(i.formatString=c.formatString,i.decimals=c.decimals,i.decPoint=c.decPoint,i.thousandsSep=c.thousandsSep),i.formatString.replaceAll("&#","&%").replace("#",z.numberFormat(e,i.decimals,i.decPoint,i.thousandsSep)).replaceAll("&%","&#")||""}}var Km=Object.defineProperty,Xm=a((r,e)=>Km(r,"name",{value:e,configurable:!0}),"o$2");class Pn extends Yt{static{a(this,"OptionsManager")}static{Xm(this,"OptionsManager")}_data;_type;static getSupportTypes(){return[ut.NotSet,ut.JsonArray,ut.JsonObject,ut.FloatVal,ut.IntegerVal,ut.BoolYN,ut.StringVal]}static prepareArrayList(e){return P.isArray(e)?e:P.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(),P.isObject(e))for(const[t,s]of Object.entries(e))this.data.set(t,s)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let s=this.data.get(e);try{s=JSON.parse(s),!P.isArray(s)&&!P.isObject(s)&&(s=t)}catch(n){this.getLogger().error("Failed JSON parse",{error:n}),s=t}return Pn.prepareArrayList(s)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let s=this.data.get(e);try{s=JSON.parse(s)}catch(n){this.getLogger().error("Failed JSON parse",{error:n}),s=t}return P.isObject(s)||(s=t),s}getFloat(e,t=0){return this.data.has(e)?z.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?z.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?z.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?z.toBoolean(this.data.get(e)):t}getString(e,t=""){return this.data.has(e)?this.data.get(e).toString():t}getDate(e,t=null){if(!this.data.has(e))return t;try{const s=z.toDateTime(this.data.get(e).toString());return s.isValid?s:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(s){this.getLogger().error("Failed JSON parse",{error:s})}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t,s){const n=[];return n.push({method:this.getMethodSave(),params:{options:e}}),P.isObject(t)&&n.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.actions.v2.batch.make({calls:n,options:{isHaltOnError:!0,returnAjaxResult:!1,requestId:s}})}}var Qm=Object.defineProperty,ey=a((r,e)=>Qm(r,"name",{value:e,configurable:!0}),"g$2");class sc{static{a(this,"StorageManager")}static{ey(this,"StorageManager")}_logger;userId;siteId;constructor(e={}){this._logger=ee.createNullLogger(),this.userId=e.userId?z.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger}set(e,t){if(typeof window.localStorage>"u"){this.getLogger().error("localStorage undefined",{error:new Error("undefined window.localStorage")});return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window.localStorage>"u")return t||null;const s=window.localStorage.getItem(this._getKey(e));return s===null?t||null:JSON.parse(s)}remove(e){if(typeof window.localStorage>"u"){this.getLogger().error("localStorage undefined",{error:new Error("undefined window.localStorage")});return}return window.localStorage.removeItem(this._getKey(e))}_getKey(e){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${e}`}compareKey(e,t){return e===this._getKey(t)}}var ty=Object.defineProperty,nc=a((r,e)=>ty(r,"name",{value:e,configurable:!0}),"t");class ry extends Error{static{a(this,"ErrorNotConnected")}static{nc(this,"ErrorNotConnected")}constructor(e){super(e),this.name="ErrorNotConnected"}}class sy extends Error{static{a(this,"ErrorTimeout")}static{nc(this,"ErrorTimeout")}constructor(e){super(e),this.name="ErrorTimeout"}}var ny=Object.defineProperty,iy=a((r,e)=>ny(r,"name",{value:e,configurable:!0}),"R$1");const us="2.0";class oy{static{a(this,"JsonRpc")}static{iy(this,"JsonRpc")}_logger;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._logger=ee.createNullLogger(),this._connector=e.connector,P.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,s=5){return new Promise((n,i)=>{const c=this.createRequest(e,t);this._connector.send(JSON.stringify(c))||i(new ry("websocket is not connected"));const o=setTimeout(()=>{this._rpcResponseAwaiters.delete(c.id),i(new sy("no response"))},s*1e3);this._rpcResponseAwaiters.set(c.id,{resolve:n,reject:i,timeout:o})})}executeOutgoingRpcBatch(e){const t=[],s=[];return e.forEach(({method:n,params:i,id:c})=>{const o=this.createRequest(n,i,c);t.push(o),s.push(new Promise((u,h)=>this._rpcResponseAwaiters.set(o.id,{resolve:u,reject:h})))}),this._connector.send(JSON.stringify(t)),s}processRpcResponse(e){if("id"in e&&this._rpcResponseAwaiters.has(Number(e.id))){const t=this._rpcResponseAwaiters.get(Number(e.id));t&&("result"in e?t.resolve(e.result):"error"in e?t.reject(e?.error||"error"):t.reject("wrong response structure"),clearTimeout(t.timeout),this._rpcResponseAwaiters.delete(Number(e.id)));return}this.getLogger().error(`${z.getDateForLog()}: Pull: Received rpc response with unknown id`,{response:e})}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(s){return this.getLogger().error(`${z.getDateForLog()}: Pull: Could not decode json rpc message`,{error:s}),[]}return P.isArray(t)?this.executeIncomingRpcBatch(t):P.isJsonRpcRequest(t)?this.executeIncomingRpcCommand(t):P.isJsonRpcResponse(t)?(this.processRpcResponse(t),[]):(this.getLogger().error(`${z.getDateForLog()}: Pull: unknown rpc packet`,{decoded:t}),[])}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:us,error:Xs.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const s of e)if("jsonrpc"in s)if("method"in s){const n=this.executeIncomingRpcCommand(s);n&&(n.jsonrpc=us,n.id=s.id,t.push(n))}else this.processRpcResponse(s);else this.getLogger().error(`${z.getDateForLog()}: Pull: unknown rpc command in batch`,{command:s}),t.push({jsonrpc:us,error:Xs.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,s){return s||(s=this.nextId()),{jsonrpc:us,method:e,params:t,id:s}}}var ay=Object.defineProperty,cy=a((r,e)=>ay(r,"name",{value:e,configurable:!0}),"g$1");class ly{static{a(this,"SharedConfig")}static{cy(this,"SharedConfig")}_logger;_storage;_ttl=1440*60;_callbacks;constructor(e={}){this._logger=ee.createNullLogger(),e=e||{},this._storage=e.storage||new sc,this._callbacks={onWebSocketBlockChanged:P.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",Ue.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(Ue.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(Ue.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(`${z.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage`,{error:t}),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(Ue.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(Ue.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(`${z.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage.`,{error:t}),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(Ue.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(Ue.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(`${z.getDateForLog()}: LocalStorage error.`,{error:t}),!1}return!0}getTimestamp(){return Date.now()}}var uy=Object.defineProperty,hy=a((r,e)=>uy(r,"name",{value:e,configurable:!0}),"l$3");class dy{static{a(this,"ChannelManager")}static{hy(this,"ChannelManager")}_logger;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._logger=ee.createNullLogger(),this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger}async getPublicIds(e){const t=new Date,s={},n=[];for(const i of e){const c=this._publicIds.get(i);c&&c.end>t?s[c.userId]=c:n.push(i)}return n.length===0?Promise.resolve(s):new Promise(i=>{this._restClient.callMethod(this._getPublicListMethod,{users:n}).then(c=>{const o=c.getData().result;this.setPublicIds(Object.values(o));for(const u of n){const h=this._publicIds.get(u);h&&(s[h.userId]=h)}i(s)}).catch(c=>(this.getLogger().error("some error in getPublicIds",{error:c}),i({})))})}setPublicIds(e){e.forEach(t=>{const s=Number(t.user_id);this._publicIds.set(s,{userId:s,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fy(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}a(fy,"getDefaultExportFromCjs");var Ln={exports:{}},ic;function py(){return ic||(ic=1,(function(r){var e=Object.defineProperty,t=a((s,n)=>e(s,"name",{value:n,configurable:!0}),"i");/*!
|
|
48
|
+
`,c+1),l=o===-1?"":i.slice(o+1);String(s.stack).endsWith(l)||(s.stack+=`
|
|
49
|
+
`+i)}}catch{}}throw s}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Ct(this.defaults,t);const{transitional:s,paramsSerializer:n,headers:i}=t;s!==void 0&&ls.assertOptions(s,{silentJSONParsing:Ge.transitional(Ge.boolean),forcedJSONParsing:Ge.transitional(Ge.boolean),clarifyTimeoutError:Ge.transitional(Ge.boolean),legacyInterceptorReqResOrdering:Ge.transitional(Ge.boolean)},!1),n!=null&&(E.isFunction(n)?t.paramsSerializer={serialize:n}:ls.assertOptions(n,{encode:Ge.function,serialize:Ge.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ls.assertOptions(t,{baseUrl:Ge.spelling("baseURL"),withXsrfToken:Ge.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let c=i&&E.merge(i.common,i[t.method]);i&&E.forEach(["delete","get","head","post","put","patch","query","common"],f=>{delete i[f]}),t.headers=xe.concat(c,i);const o=[];let l=!0;this.interceptors.request.forEach(a(function(m){if(typeof m.runWhen=="function"&&m.runWhen(t)===!1)return;l=l&&m.synchronous;const y=t.transitional||kn;y&&y.legacyInterceptorReqResOrdering?o.unshift(m.fulfilled,m.rejected):o.push(m.fulfilled,m.rejected)},"unshiftRequestInterceptors"));const h=[];this.interceptors.response.forEach(a(function(m){h.push(m.fulfilled,m.rejected)},"pushResponseInterceptors"));let u,g=0,p;if(!l){const f=[Ca.bind(this),void 0];for(f.unshift(...o),f.push(...h),p=f.length,u=Promise.resolve(t);g<p;)u=u.then(f[g++],f[g++]);return u}p=o.length;let d=t;for(;g<p;){const f=o[g++],m=o[g++];try{d=f(d)}catch(y){m.call(this,y);break}}try{u=Ca.call(this,d)}catch(f){return Promise.reject(f)}for(g=0,p=h.length;g<p;)u=u.then(h[g++],h[g++]);return u}getUri(e){e=Ct(this.defaults,e);const t=Sa(e.baseURL,e.url,e.allowAbsoluteUrls);return pa(t,e.params,e.paramsSerializer)}};E.forEach(["delete","get","head","options"],a(function(e){Nt.prototype[e]=function(t,s){return this.request(Ct(s||{},{method:e,url:t,data:(s||{}).data}))}},"forEachMethodNoData")),E.forEach(["post","put","patch","query"],a(function(e){function t(s){return a(function(i,c,o){return this.request(Ct(o||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:c}))},"httpMethod")}a(t,"generateHTTPMethod"),Nt.prototype[e]=t(),e!=="query"&&(Nt.prototype[e+"Form"]=t(!0))},"forEachMethodWithData"));let tm=class Mc{static{a(this,"CancelToken")}constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(a(function(i){t=i},"promiseExecutor"));const s=this;this.promise.then(n=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](n);s._listeners=null}),this.promise.then=n=>{let i;const c=new Promise(o=>{s.subscribe(o),i=o}).then(n);return c.cancel=a(function(){s.unsubscribe(i)},"reject"),c},e(a(function(i,c,o){s.reason||(s.reason=new vr(i,c,o),t(s.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=a(s=>{e.abort(s)},"abort");return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Mc(a(function(n){e=n},"executor")),cancel:e}}};function rm(r){return a(function(t){return r.apply(null,t)},"wrap")}a(rm,"spread$1");function sm(r){return E.isObject(r)&&r.isAxiosError===!0}a(sm,"isAxiosError$1");const Ln={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ln).forEach(([r,e])=>{Ln[e]=r});function Da(r){const e=new Nt(r),t=Qo(Nt.prototype.request,e);return E.extend(t,Nt.prototype,e,{allOwnKeys:!0}),E.extend(t,e,null,{allOwnKeys:!0}),t.create=a(function(n){return Da(Ct(r,n))},"create"),t}a(Da,"createInstance");const be=Da(Sr);be.Axios=Nt,be.CanceledError=vr,be.CancelToken=tm,be.isCancel=ya,be.VERSION=Cn,be.toFormData=is,be.AxiosError=B,be.Cancel=be.CanceledError,be.all=a(function(e){return Promise.all(e)},"all"),be.spread=rm,be.isAxiosError=sm,be.mergeConfig=Ct,be.AxiosHeaders=xe,be.formToJSON=r=>ga(E.isHTMLForm(r)?new FormData(r):r),be.getAdapter=Ra.getAdapter,be.HttpStatusCode=Ln,be.default=be;const{Axios:n0,AxiosError:Pn,CanceledError:i0,isCancel:o0,CancelToken:a0,VERSION:c0,all:l0,Cancel:u0,isAxiosError:h0,spread:d0,toFormData:f0,AxiosHeaders:p0,HttpStatusCode:m0,formToJSON:g0,getAdapter:y0,mergeConfig:b0,create:_0}=be;var nm=Object.defineProperty,im=a((r,e)=>nm(r,"name",{value:e,configurable:!0}),"t$5");const om="X-Request-ID",am="bx24_request_id",cm="bx24_sdk_ver",lm="bx24_sdk_type";class um{static{a(this,"RequestIdGenerator")}static{im(this,"RequestIdGenerator")}getQueryStringParameterName(){return am}getQueryStringSdkParameterName(){return cm}getQueryStringSdkTypeParameterName(){return lm}generate(){return J.getUuidRfc4122()}getRequestId(){return this.generate()}getHeaderFieldName(){return om}}var hm=Object.defineProperty,dm=a((r,e)=>hm(r,"name",{value:e,configurable:!0}),"m$5");class La{static{a(this,"AbstractHttp")}static{dm(this,"AbstractHttp")}_clientAxios;_authActions;_requestIdGenerator;_restrictionManager;_pendingRefresh=null;_logger;_isClientSideWarning=!1;_clientSideWarningMessage="";_version;_metrics={totalRequests:0,successfulRequests:0,failedRequests:0,totalDuration:0,byMethod:new Map,lastErrors:[]};constructor(e,t,s){this._version=X.v2,this._logger=te.createNullLogger();const n={};this.isServerSide()&&(n["User-Agent"]="b24-js-sdk/1.3.0"),this._authActions=e,this._requestIdGenerator=new um,this._clientAxios=be.create({headers:{...n,...t?t.headers:{}},timeout:3e4,timeoutErrorMessage:"Request timeout exceeded",...t&&{...t,headers:void 0}});const i={...sn.getDefault(),...s};this._restrictionManager=new gr(i)}get apiVersion(){return this._version}get ajaxClient(){return this._clientAxios}setLogger(e){this._logger=e,this._restrictionManager.setLogger(this._logger)}getLogger(){return this._logger}async setRestrictionManagerParams(e){await this._restrictionManager.setConfig(e)}getRestrictionManagerParams(){return this._restrictionManager.getParams()}getStats(){return{...this._restrictionManager.getStats(),totalRequests:this._metrics.totalDuration,successfulRequests:this._metrics.successfulRequests,failedRequests:this._metrics.failedRequests,totalDuration:this._metrics.totalDuration,byMethod:this._metrics.byMethod,lastErrors:this._metrics.lastErrors}}async reset(){return this._metrics.totalDuration=0,this._metrics.successfulRequests=0,this._metrics.failedRequests=0,this._metrics.totalDuration=0,this._metrics.byMethod.clear(),this._metrics.lastErrors=[],this._restrictionManager.reset()}_updateMetrics(e,t,s,n){this._metrics.totalRequests++,t?this._metrics.successfulRequests++:(this._metrics.failedRequests++,n instanceof we&&(this._metrics.lastErrors.push({method:e,error:n.message,timestamp:Date.now()}),this._metrics.lastErrors.length>100&&(this._metrics.lastErrors=this._metrics.lastErrors.slice(-100)))),this._metrics.byMethod.has(e)||this._metrics.byMethod.set(e,{count:0,totalDuration:0});const i=this._metrics.byMethod.get(e);i.count++,i.totalDuration+=s}_validateParams(e,t,s){try{JSON.stringify(s)}catch(n){throw new we({code:"JSSDK_INVALID_PARAMS",description:"Parameters contain circular references",status:400,requestInfo:{method:t,params:s,requestId:e},originalError:n})}}async call(e,t,s){s=s??this._requestIdGenerator.getRequestId();const n=this._restrictionManager.getParams().maxRetries;this._validateParams(s,e,t),this._logRequest(s,e,t);let i=null;const c=Date.now();for(let o=0;o<n;o++)try{this._logAttempt(s,e,o+1,n),await this._restrictionManager.applyOperatingLimits(s,e,t);const l=await this._executeSingleCall(s,e,t),h=Date.now()-c;return this._restrictionManager.resetErrors(e),this._updateMetrics(e,!0,h),this._logSuccessfulRequest(s,e,h),l}catch(l){i=this._convertToAjaxError(s,l,e,t);const h=Date.now()-c;if(this._restrictionManager.incrementError(e),this._updateMetrics(e,!1,h,i),this._logFailedRequest(s,e,o+1,n,i),o<n){const u=await this._restrictionManager.handleError(s,e,t,i,o);if(u>0){this._restrictionManager.incrementStats("limitHits"),this._logAttemptRetryWaiteDelay(s,e,u,o+1,n),await this._restrictionManager.waiteDelay(u),this._restrictionManager.incrementStats("retries");continue}}if(o+1===n&&this._logAllAttemptsExhausted(s,e,o+1,n),this._restrictionManager.exceptionCodeForSoft.includes(i.code))return this._createAjaxResultWithErrorFromResponse(i,s,e,t);throw i}throw new we({code:"JSSDK_CALL_ALL_ATTEMPTS_EXHAUSTED",description:"All attempts exhausted",status:i?.status||500,requestInfo:{method:e,params:t,requestId:s},originalError:i?.originalError||null})}_convertToAjaxError(e,t,s,n){return t instanceof we?t:t instanceof Pn?this._convertAxiosErrorToAjaxError(e,t,s,n):this._convertUnknownErrorToAjaxError(e,t,s,n)}_convertAxiosErrorToAjaxError(e,t,s,n){let i=`${t.code||"JSSDK_AXIOS_ERROR"}`,c=t.message;const o=t.response?.status||0;if(i==="ERR_NETWORK")return new we({code:"NETWORK_ERROR",description:"Network connection failed",status:0,requestInfo:{method:s,params:n,requestId:e},originalError:t});if(i==="ECONNABORTED"||t.message.includes("timeout"))return new we({code:"REQUEST_TIMEOUT",description:"Request timeout exceeded",status:408,requestInfo:{method:s,params:n,requestId:e},originalError:t});if(t.response?.data&&typeof t.response.data=="object"){const l=t.response.data;l.error&&typeof l.error=="object"&&"code"in l.error?(i=l.error.code,c=l.error.message.trimEnd(),l.error.validation&&(c.length>0&&(c.endsWith(".")||(c+="."),c+=" "),l.error.validation.forEach(h=>{c+=`${h?.message||JSON.stringify(h)}`}))):l.error&&typeof l.error=="string"&&(i=l.error!=="0"?l.error:i,c=l?.error_description??c)}return new we({code:i,description:c,status:o,requestInfo:{method:s,params:n,requestId:e},originalError:t})}_convertUnknownErrorToAjaxError(e,t,s,n){return new we({code:"JSSDK_UNKNOWN_ERROR",description:t instanceof Error?t.message:String(t),status:0,requestInfo:{method:s,params:n,requestId:e},originalError:t})}async _executeSingleCall(e,t,s){this._checkClientSideWarning(e);const n=await this._ensureAuth(e),i=await this._makeRequestWithAuthRetry(e,t,s,n);return this._createAjaxResultFromResponse(i,e,t,s)}async _ensureAuth(e){let t=this._authActions.getAuthData();return t===!1&&(this._logRefreshingAuthToken(e),t=await this._refreshAuth()),t}_refreshAuth(){if(this._pendingRefresh)return this._pendingRefresh;const e=this._authActions.refreshAuth();return this._pendingRefresh=e,e.finally(()=>{this._pendingRefresh=null}).catch(()=>{}),e}async _makeRequestWithAuthRetry(e,t,s,n){try{return await this._restrictionManager.checkRateLimit(e,t),await this._makeAxiosRequest(e,t,s,n)}catch(i){i instanceof Pn&&this.getLogger().info("post/catchError",{requestId:e,status:i.status,responseData:JSON.stringify(pr(i?.response?.data),null,0)});const c=this._convertToAjaxError(e,i,t,s);if(this._isAuthError(c)){this._logAuthErrorDetected(e),this._logRefreshingAuthToken(e);const o=await this._refreshAuth();return await this._restrictionManager.checkRateLimit(e,t),await this._makeAxiosRequest(e,t,s,o)}throw c}}async _makeAxiosRequest(e,t,s,n){const i=this._prepareMethod(e,t,this.getBaseUrl()),c=this._prepareParams(n,s),o=JSON.stringify(pr(c),null,0),l=300,h=100;this.getLogger().info("post/send",{requestId:e,method:t,params:o.length>l?o.slice(0,h)+"...":o});const u=await this._clientAxios.post(i,c),g=JSON.stringify(u.data.result,null,0);return this.getLogger().info("post/response",{requestId:e,result:g.length>l?g.slice(0,h)+"...":g,time:JSON.stringify(u.data.time,null,0)}),{status:u.status,payload:u.data}}_isAuthError(e){return e instanceof we?e.status===401&&["expired_token","invalid_token"].includes(e.code):!1}async _createAjaxResultFromResponse(e,t,s,n){const i=new mr({answer:e.payload,query:{method:s,params:n,requestId:t},status:e.status});if(i.isSuccess){const c=i.getData()?.time;await this._restrictionManager.updateStats(t,s,c)}return i}_createAjaxResultWithErrorFromResponse(e,t,s,n){return new mr({answer:{error:{code:e.code,message:e.message}},query:{method:s,params:n,requestId:t},status:e.status})}_prepareParams(e,t){const s={...t};if(e.refresh_token!=="hook"&&(s.auth=e.access_token),s?.data&&"start"in s.data){const{start:n,...i}=s.data;s.data=i}return s}setClientSideWarning(e,t){this._isClientSideWarning=e,this._clientSideWarningMessage=t}isServerSide(){return Hr()!==ur.BROWSE}getBaseUrl(){return this._authActions.getTargetOriginWithPath().get(this._version)}_sanitizeParams(e){return pr(e)}_logRequest(e,t,s){this.getLogger().debug("http request starting",{requestId:e,method:t,params:this._sanitizeParams(s),api:this.apiVersion,timestamp:Date.now()})}_logAttempt(e,t,s,n){this.getLogger().info("http request attempt",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n}})}_logRefreshingAuthToken(e){this.getLogger().info("http refreshing auth token",{requestId:e,api:this.apiVersion})}_logAuthErrorDetected(e){this.getLogger().info("http auth error detected",{requestId:e,api:this.apiVersion})}_logSuccessfulRequest(e,t,s){this.getLogger().debug("http request successful",{requestId:e,method:t,api:this.apiVersion,duration:{ms:s,sec:Number.parseFloat((s/1e3).toFixed(2))}})}_logFailedRequest(e,t,s,n,i){this.getLogger().debug("http request failed",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n},error:{code:i.code,message:i.message,status:i.status}})}_logAttemptRetryWaiteDelay(e,t,s,n,i){this.getLogger().debug(`http wait ${(s/1e3).toFixed(2)} sec.`,{requestId:e,method:t,api:this.apiVersion,wait:s,attempt:{current:n,max:i}})}_logAllAttemptsExhausted(e,t,s,n){this.getLogger().warning("http all retry attempts exhausted",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n}})}_logBatchStart(e,t,s){const n=Array.isArray(t)?t.length:Object.keys(t).length;this.getLogger().debug("http batch request starting ",{requestId:e,callCount:n,api:this.apiVersion,isHaltOnError:s.isHaltOnError,timestamp:Date.now()})}_logBatchCompletion(e,t,s){this.getLogger().debug("http batch request completed",{requestId:e,api:this.apiVersion,totalCalls:t,successful:t-s,failed:s,successRate:t>0?((t-s)/t*100).toFixed(1)+"%":"??"})}_checkClientSideWarning(e){this._isClientSideWarning&&!this.isServerSide()&&P.isStringFilled(this._clientSideWarningMessage)&&te.forcedLog(this.getLogger(),"warning",this._clientSideWarningMessage,{requestId:e,code:"JSSDK_CLIENT_SIDE_WARNING"})}}var fm=Object.defineProperty,pm=a((r,e)=>fm(r,"name",{value:e,configurable:!0}),"r$7");class Pa{static{a(this,"AbstractInteractionBatch")}static{pm(this,"AbstractInteractionBatch")}parallelDefaultValue;requestId;restrictionManager;processingStrategy;_commands=[];constructor(e){this.parallelDefaultValue=e.parallelDefaultValue,this.requestId=e.requestId,this.restrictionManager=e.restrictionManager,this.processingStrategy=e.processingStrategy}setProcessingStrategy(e){this.processingStrategy=e}get size(){return this._commands.length}get maxSize(){return 0}addCommands(e){if(!this.processingStrategy)throw new ce({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});this._commands=this.processingStrategy.prepareCommands(e,{parallelDefaultValue:this.parallelDefaultValue})}getCommandsForCall(){if(!this.processingStrategy)throw new ce({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});return this.processingStrategy.buildCommands(this._commands)}}var mm=Object.defineProperty,gm=a((r,e)=>mm(r,"name",{value:e,configurable:!0}),"s$d");const ym=50;class bm extends Pa{static{a(this,"InteractionBatchV2")}static{gm(this,"InteractionBatchV2")}get maxSize(){return ym}async prepareResponse(e){if(!this.processingStrategy)throw new ce({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});const t={requestId:e.getQuery().requestId,parallelDefaultValue:this.parallelDefaultValue,restrictionManager:this.restrictionManager,response:e},s=await this.processingStrategy.prepareItems(this._commands,t);return this.processingStrategy.handleResults(this._commands,s,t)}}const _m=String.prototype.replace,wm=/%20/g,Ma={RFC1738:"RFC1738",RFC3986:"RFC3986"},Sm={RFC1738:a(function(r){return _m.call(r,wm,"+")},"RFC1738"),RFC3986:a(function(r){return String(r)},"RFC3986")},vm=Ma.RFC1738,Em=Ma.RFC3986,Om=Array.isArray,ot=(function(){const r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r})(),Mn=1024,Tm=a(function(e,t,s,n){if(e.length===0)return e;let i=e;typeof e=="symbol"?i=Symbol.prototype.toString.call(e):typeof e!="string"&&(i=String(e));let c="";for(let o=0;o<i.length;o+=Mn){const l=i.length>=Mn?i.slice(o,o+Mn):i,h=[];for(let u=0;u<l.length;++u){let g=l.charCodeAt(u);if(g===45||g===46||g===95||g===126||g>=48&&g<=57||g>=65&&g<=90||g>=97&&g<=122||n===vm&&(g===40||g===41)){h[h.length]=l.charAt(u);continue}if(g<128){h[h.length]=ot[g];continue}if(g<2048){h[h.length]=ot[192|g>>6]+ot[128|g&63];continue}if(g<55296||g>=57344){h[h.length]=ot[224|g>>12]+ot[128|g>>6&63]+ot[128|g&63];continue}u+=1,g=65536+((g&1023)<<10|l.charCodeAt(u)&1023),h[h.length]=ot[240|g>>18]+ot[128|g>>12&63]+ot[128|g>>6&63]+ot[128|g&63]}c+=h.join("")}return c},"encode"),km=a(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),Fa=a(function(e,t){if(Om(e)){const s=[];for(let n=0;n<e.length;n+=1)s.push(t(e[n]));return s}return t(e)},"maybeMap"),Im={brackets:a(function(e){return e+"[]"},"brackets"),comma:"comma",indices:a(function(e,t){return e+"["+t+"]"},"indices"),repeat:a(function(e){return e},"repeat")},ht=Array.isArray,Am=Array.prototype.push,xa=a(function(r,e){Am.apply(r,ht(e)?e:[e])},"pushToArray"),Rm=Date.prototype.toISOString,$a=Em,us={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Tm,encodeValuesOnly:!1,format:$a,formatter:Sm[$a],indices:!1,serializeDate:a(function(e){return Rm.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},Cm=a(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),Fn={},Ba=a(function(e,t,s,n,i,c,o,l,h,u,g,p,d,f,m,y,b){let _=e,w=b,S=0,T=!1;for(;(w=w.get(Fn))!==void 0&&!T;){const N=w.get(e);if(S+=1,typeof N<"u"){if(N===S)throw new RangeError("Cyclic object value");T=!0}typeof w.get(Fn)>"u"&&(S=0)}if(typeof u=="function"?_=u(t,_):_ instanceof Date?_=d(_):s==="comma"&&ht(_)&&(_=Fa(_,function(N){return N instanceof Date?d(N):N})),_===null){if(c)return h&&!y?h(t,us.encoder,"key",f):t;_=""}if(Cm(_)||km(_)){if(h){const N=y?t:h(t,us.encoder,"key",f);return[m(N)+"="+m(h(_,us.encoder,"value",f))]}return[m(t)+"="+m(String(_))]}const v=[];if(typeof _>"u")return v;let R;if(s==="comma"&&ht(_))y&&h&&(_=Fa(_,h)),R=[{value:_.length>0?_.join(",")||null:void 0}];else if(ht(u))R=u;else{const N=Object.keys(_);R=g?N.sort(g):N}const O=l?t.replace(/\./g,"%2E"):t,k=n&&ht(_)&&_.length===1?O+"[]":O;if(i&&ht(_)&&_.length===0)return k+"[]";for(let N=0;N<R.length;++N){const j=R[N],V=typeof j=="object"&&typeof j.value<"u"?j.value:_[j];if(o&&V===null)continue;const pe=p&&l?j.replace(/\./g,"%2E"):j,me=ht(_)?typeof s=="function"?s(k,pe):k:k+(p?"."+pe:"["+pe+"]");b.set(e,S);const Y=new WeakMap;Y.set(Fn,b),xa(v,Ba(V,me,s,n,i,c,o,l,s==="comma"&&y&&ht(_)?null:h,u,g,p,d,f,m,y,Y))}return v},"stringify"),Nm=a(function(e){return us},"normalizeStringifyOptions");function Dm(r,e){let t=r;const s=Nm();let n,i;typeof s.filter=="function"?(i=s.filter,t=i("",t)):ht(s.filter)&&(i=s.filter,n=i);const c=[];if(typeof t!="object"||t===null)return"";const o=Im[s.arrayFormat],l=o==="comma"&&s.commaRoundTrip;n||(n=Object.keys(t)),s.sort&&n.sort(s.sort);const h=new WeakMap;for(let p=0;p<n.length;++p){const d=n[p];s.skipNulls&&t[d]===null||xa(c,Ba(t[d],d,o,l,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,h))}const u=c.join(s.delimiter),g=s.addQueryPrefix===!0?"?":"";return u.length>0?g+u:""}a(Dm,"stringify");var Lm=Object.defineProperty,Pm=a((r,e)=>Lm(r,"name",{value:e,configurable:!0}),"s$c");class ja{static{a(this,"AbstractProcessing")}static{Pm(this,"AbstractProcessing")}_getBatchResultByIndex(e,t){if(e)return e[t]}_createErrorFromAjaxResult(e){return e.hasError("base-error")?e.errors.get("base-error"):new we({code:"JSSDK_BATCH_SUB_ERROR",description:e.getErrorMessages().join("; "),status:e.getStatus(),requestInfo:{...e.getQuery()},originalError:e.getErrors().next().value})}}var Mm=Object.defineProperty,Fm=a((r,e)=>Mm(r,"name",{value:e,configurable:!0}),"l$6");class Ua extends ja{static{a(this,"AbstractProcessingV2")}static{Fm(this,"AbstractProcessingV2")}_buildRow(e){return`${e.method}?${Dm(e.query||{})}`}buildCommands(e){if(e.length<1)throw new ce({code:"JSSDK_INTERACTION_BATCH_STRATEGY_V2_EMPTY_COMMANDS",description:"commands not set",status:500});const t=e[0];if(typeof t.as=="string"&&t.as.length>0){const n={};for(const i of e)n[i.as]=this._buildRow(i);return n}const s=[];for(const n of e)s.push(this._buildRow(n));return s}async prepareItems(e,t){const s=new Map;for(const[n,i]of e.entries())await this._processResponseItem(i,i.as??n,t,s);return s}async _processResponseItem(e,t,s,n){const i=s.response.getData().result,c=this._getBatchResultByIndex(i.result,t),o=this._getBatchResultByIndex(i.result_error,t);if(typeof c<"u"||typeof o<"u"){const l=e.method,h=this._getBatchResultByIndex(i.result_time,t);typeof h<"u"&&await s.restrictionManager.updateStats(s.requestId,`batch::${l}`,h);const u=new mr({answer:{error:o?typeof o=="string"?o:o.error:void 0,error_description:o?typeof o=="string"?void 0:o.error_description:void 0,result:c,total:Number.parseInt(this._getBatchResultByIndex(i.result_total,t)||"0"),next:Number.parseInt(this._getBatchResultByIndex(i.result_next,t)||"0"),time:h},query:{method:l,params:e.query||{},requestId:s.requestId},status:s.response.getStatus()});n.set(t,u);return}if(s.parallelDefaultValue)throw new ce({code:"JSSDK_INTERACTION_BATCH_STRATEGY_V2_EMPTY_COMMAND_RESPONSE",description:`There were difficulties parsing the response for batch { index: ${t}, method: ${e.method} }`,status:500})}async handleResults(e,t,s){const n=new Fe,i=new Map;for(const[c,o]of t){if(o.getStatus()!==200||!o.isSuccess){const l=this._createErrorFromAjaxResult(o);this._processResponseError(n,l,`${c}`),i.set(c,o)}i.set(c,o)}return n.setData({result:i,time:s.response.getData().time}),n}}var xm=Object.defineProperty,$m=a((r,e)=>xm(r,"name",{value:e,configurable:!0}),"o$8");class Bm extends Ua{static{a(this,"ProcessingAsArrayV2")}static{$m(this,"ProcessingAsArrayV2")}prepareCommands(e,t){const s=[];return e.forEach(n=>{const i=bt.getBatchCommand(n,t);s.push(i)}),s}_processResponseError(e,t,s){e.addError(t)}}var jm=Object.defineProperty,Um=a((r,e)=>jm(r,"name",{value:e,configurable:!0}),"s$b");class Vm extends Ua{static{a(this,"ProcessingAsObjectV2")}static{Um(this,"ProcessingAsObjectV2")}prepareCommands(e,t){const s=[];return Object.entries(e).forEach(([n,i])=>{const c=bt.getBatchCommand(i,{...t,asDefaultValue:n});s.push(c)}),s}_processResponseError(e,t,s){e.addError(t,s)}}var qm=Object.defineProperty,Hm=a((r,e)=>qm(r,"name",{value:e,configurable:!0}),"i$6");class hs extends La{static{a(this,"HttpV2")}static{Hm(this,"HttpV2")}constructor(e,t,s){super(e,t,s),this._version=X.v2}async batch(e,t){const s={isHaltOnError:!0,...t},n=s.requestId??this._requestIdGenerator.getRequestId();this._logBatchStart(n,e,s);const i=new bm({requestId:n,parallelDefaultValue:!s.isHaltOnError,restrictionManager:this._restrictionManager});if(Array.isArray(e)?i.setProcessingStrategy(new Bm):i.setProcessingStrategy(new Vm),i.addCommands(e),i.size>i.maxSize)throw new we({code:"JSSDK_BATCH_TOO_LARGE",description:`Batch too large: ${i.size} commands (max: ${i.maxSize})`,status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});if(i.size===0)throw new we({code:"JSSDK_BATCH_EMPTY",description:"Batch must contain at least one command",status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});const c=await this.call("batch",{halt:s.isHaltOnError?1:0,cmd:i.getCommandsForCall()},n),o=await i.prepareResponse(c);return this._logBatchCompletion(n,o.getData()?.result?.size??0,o.getErrorMessages().length),o}_prepareMethod(e,t,s){const n=`/${encodeURIComponent(t)}`;if(t.includes("task."))return`${s}${n}`;const i=new URLSearchParams({[this._requestIdGenerator.getQueryStringParameterName()]:e,[this._requestIdGenerator.getQueryStringSdkParameterName()]:"1.3.0",[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]:"b24-js-sdk"});return`${s}${n}?${i.toString()}`}}var Wm=Object.defineProperty,zm=a((r,e)=>Wm(r,"name",{value:e,configurable:!0}),"s$a");const Jm=50;class Gm extends Pa{static{a(this,"InteractionBatchV3")}static{zm(this,"InteractionBatchV3")}get maxSize(){return Jm}async prepareResponse(e){if(!this.processingStrategy)throw new ce({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});const t={requestId:e.getQuery().requestId,parallelDefaultValue:this.parallelDefaultValue,restrictionManager:this.restrictionManager,response:e},s=await this.processingStrategy.prepareItems(this._commands,t);return this.processingStrategy.handleResults(this._commands,s,t)}}var Ym=Object.defineProperty,Km=a((r,e)=>Ym(r,"name",{value:e,configurable:!0}),"p$4");class Va extends ja{static{a(this,"AbstractProcessingV3")}static{Km(this,"AbstractProcessingV3")}buildCommands(e){if(e.length<1)throw new ce({code:"JSSDK_INTERACTION_BATCH_BUILD_STRATEGY_V3_EMPTY_COMMANDS",description:"commands not set",status:500});return e}async prepareItems(e,t){const s=new Map;if(!t.response.isSuccess)return s;for(const[n,i]of e.entries())await this._processResponseItem(i,n,t,s);return s}async _processResponseItem(e,t,s,n){const i=s.response.getData().result,c=this._getBatchResultByIndex(i,t);if(typeof c>"u")throw new ce({code:"JSSDK_INTERACTION_BATCH_STRATEGY_V3_EMPTY_COMMAND_RESPONSE",description:`There were difficulties parsing the response for batch { index: ${t}, method: ${e.method} }`,status:500});const o=s.response.getData().time,l=new mr({answer:{result:c,error:void 0,time:o},query:{method:e.method,params:e.query||{},requestId:s.requestId},status:s.response.getStatus()});n.set(t,l)}async handleResults(e,t,s){const n=new Fe,i=new Map;if(!s.response.isSuccess){for(const[c,o]of s.response.errors)n.addError(o,c);return n.setData({result:i,time:void 0}),n}for(const[c,o]of t){const l=Number.parseInt(`${c}`),h=e[l];if(typeof h>"u")throw new ce({code:"JSSDK_INTERACTION_BATCH_BUILD_STRATEGY_V3_EMPTY_COMMAND",description:`command for index ${c} not set`,status:500});const u=h.as??c;if(o.getStatus()!==200||!o.isSuccess){const g=this._createErrorFromAjaxResult(o);this._processResponseError(n,g,`${u}`),i.set(u,o)}i.set(u,o)}return n.setData({result:i,time:s.response.getData().time}),n}}var Zm=Object.defineProperty,Xm=a((r,e)=>Zm(r,"name",{value:e,configurable:!0}),"o$6");class Qm extends Va{static{a(this,"ProcessingAsArrayV3")}static{Xm(this,"ProcessingAsArrayV3")}prepareCommands(e,t){const s=[];return e.forEach(n=>{const i=bt.getBatchCommand(n,t);s.push(i)}),s}_processResponseError(e,t,s){e.addError(t)}}var eg=Object.defineProperty,tg=a((r,e)=>eg(r,"name",{value:e,configurable:!0}),"s$9");class rg extends Va{static{a(this,"ProcessingAsObjectV3")}static{tg(this,"ProcessingAsObjectV3")}prepareCommands(e,t){const s=[];return Object.entries(e).forEach(([n,i])=>{const c=bt.getBatchCommand(i,{...t,asDefaultValue:n});s.push(c)}),s}_processResponseError(e,t,s){e.addError(t,s)}}var sg=Object.defineProperty,ng=a((r,e)=>sg(r,"name",{value:e,configurable:!0}),"i$5");class ds extends La{static{a(this,"HttpV3")}static{ng(this,"HttpV3")}constructor(e,t,s){super(e,t,s),this._version=X.v3}async batch(e,t){const s={isHaltOnError:!0,...t},n=s.requestId??this._requestIdGenerator.getRequestId();this._logBatchStart(n,e,s);const i=new Gm({requestId:n,parallelDefaultValue:!s.isHaltOnError,restrictionManager:this._restrictionManager});if(Array.isArray(e)?i.setProcessingStrategy(new Qm):i.setProcessingStrategy(new rg),i.addCommands(e),i.size>i.maxSize)throw new we({code:"JSSDK_BATCH_TOO_LARGE",description:`Batch too large: ${i.size} commands (max: ${i.maxSize})`,status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});if(i.size===0)throw new we({code:"JSSDK_BATCH_EMPTY",description:"Batch must contain at least one command",status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});const c=await this.call("batch",i.getCommandsForCall(),n),o=await i.prepareResponse(c);return this._logBatchCompletion(n,o.getData()?.result?.size??0,o.getErrorMessages().length),o}_prepareMethod(e,t,s){const n=`/${encodeURIComponent(t)}`,i=new URLSearchParams({[this._requestIdGenerator.getQueryStringParameterName()]:e,[this._requestIdGenerator.getQueryStringSdkParameterName()]:"1.3.0",[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]:"b24-js-sdk"});return`${s}${n}?${i.toString()}`}}var ig=Object.defineProperty,og=a((r,e)=>ig(r,"name",{value:e,configurable:!0}),"e$3");const ag=og(()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)}),"useScrollSize");var cg=Object.defineProperty,lg=a((r,e)=>cg(r,"name",{value:e,configurable:!0}),"s$8");let ug=class vt{static{a(this,"t")}static{lg(this,"FormatterNumbers")}static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!vt.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");vt.isInternalConstructing=!1}static getInstance(){return vt.instance||(vt.isInternalConstructing=!0,vt.instance=new vt),vt.instance}setDefLocale(e){this._defLocale=e}format(e,t){let s;(typeof t>"u"||!P.isStringFilled(t))&&(t=P.isStringFilled(this._defLocale)?this._defLocale||"en":typeof navigator>"u"?"en":navigator?.language||"en"),Number.isInteger(e)?s=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):s=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let n=s.format(e);return t.includes("ru")&&(n=n.replace(",",".")),n}};var hg=Object.defineProperty,qa=a((r,e)=>hg(r,"name",{value:e,configurable:!0}),"n$7");class I{static{a(this,"IbanSpecification")}static{qa(this,"IbanSpecification")}countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,s,n){this.countryCode=e,this.length=t,this.structure=s,this.example=n}isValid(e){return this.length===e.length&&this.countryCode===e.slice(0,2)&&this._regex().test(e.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(e))==1}toBBAN(e,t){return(this._regex().exec(e.slice(4)||"")||[]).slice(1).join(t)}fromBBAN(e){if(!this.isValidBBAN(e))throw new Error("Invalid BBAN");const t=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+e)))).slice(-2);return this.countryCode+t+e}isValidBBAN(e){return this.length-4===e.length&&this._regex().test(e)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(e){const t=(e.match(/(.{3})/g)||[]).map(s=>{let n;const i=s.slice(0,1),c=Number.parseInt(s.slice(1),10);switch(i){case"A":n="0-9A-Za-z";break;case"B":n="0-9A-Z";break;case"C":n="A-Za-z";break;case"F":n="0-9";break;case"L":n="a-z";break;case"U":n="A-Z";break;case"W":n="0-9a-z";break}return"(["+n+"]{"+c+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const s=t.charCodeAt(0);return s>=65&&s<=90?(s-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,s;for(;t.length>2;)s=t.slice(0,9),t=Number.parseInt(s,10)%97+t.slice(s.length);return Number.parseInt(t,10)%97}}class dt{static{a(this,"FormatterIban")}static{qa(this,"FormatterIban")}static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!dt.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");dt.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return dt.instance||(dt.isInternalConstructing=!0,dt.instance=new dt),dt.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!P.isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const s=this._countries.get(t);return!!s&&s.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const s=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(s,"$1"+t)}electronicFormat(e){const t=/[^a-z0-9]/gi;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const s=e.slice(0,2);if(!this._countries.has(s))throw new Error(`No country with code ${s}`);const n=this._countries.get(s);if(!n)throw new Error(`No country with code ${s}`);return n.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const s=this._countries.get(e);if(!s)throw new Error(`No country with code ${e}`);return s.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!P.isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const s=this._countries.get(e);return!!s&&s.isValidBBAN(this.electronicFormat(t))}}var dg=Object.defineProperty,fg=a((r,e)=>dg(r,"name",{value:e,configurable:!0}),"n$6");const pg=fg(()=>{const r=ug.getInstance(),e=dt.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}},"useFormatter");var mg=Object.defineProperty,gg=a((r,e)=>mg(r,"name",{value:e,configurable:!0}),"r$6");class Ha{static{a(this,"AuthHookManager")}static{gg(this,"AuthHookManager")}#e;#r;#s;#t;#i;constructor(e){this.#e=Object.freeze(Object.assign({},e)),this.#r=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#s=`https://${this.#r}/rest`,this.#t=`https://${this.#r}`,this.#i=new Map,this.#i.set(X.v2,`${this.#s}/${this.#e.userId}/${this.#e.secret}`),this.#i.set(X.v3,`${this.#s}/api/${this.#e.userId}/${this.#e.secret}`)}getAuthData(){return{access_token:this.#e.secret,refresh_token:"hook",expires:0,expires_in:0,domain:this.#r,member_id:this.#r}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#t}`}getTargetOriginWithPath(){return this.#i}get isAdmin(){return!0}}var yg=Object.defineProperty,bg=a((r,e)=>yg(r,"name",{value:e,configurable:!0}),"s$7");class xn extends Xr{static{a(this,"B24Hook")}static{bg(this,"B24Hook")}#e;constructor(e,t){super(),this.#e=new Ha(e);const s=`The B24Hook object is intended exclusively for use on the server.
|
|
50
|
+
A webhook contains a secret access key, which MUST NOT be used in client-side code (browser, mobile app).`;this._httpV2=new hs(this.#e,this._getHttpOptions(),t?.restrictionParams),this._httpV2.setClientSideWarning(!0,s),this._httpV3=new ds(this.#e,this._getHttpOptions(),t?.restrictionParams),this._httpV3.setClientSideWarning(!0,s),this._isInit=!0}get auth(){return this.#e}offClientSideWarning(){it.getAllApiVersions().forEach(e=>{this.getHttpClient(e).setClientSideWarning(!1,"")})}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}static fromWebhookUrl(e,t){if(!e.trim())throw new Error("Webhook URL cannot be empty");let s;try{s=new URL(e.replace("/rest/api","/rest"))}catch{throw new Error(`Invalid webhook URL format: ${e}`)}if(s.protocol!=="https:")throw new Error("Webhook requires HTTPS protocol");const n=s.pathname.split("/").filter(Boolean);if(!(n.length===3&&n[0]==="rest"||n.length===4&&n[0]==="rest"&&n[1]==="api"))throw new Error("Webhook URL must follow format: /rest/<userId>/<secret> or /rest/api/<userId>/<secret>");const i=n[1]==="api"?2:1,c=n[1]==="api"?3:2,o=n[i],l=n[c];if(!/^\d+$/.test(o))throw new Error(`User ID must be numeric in webhook URL, received: ${o}`);const h=Number.parseInt(o,10);return new xn({b24Url:s.origin,userId:h,secret:l},t)}}var le=(r=>(r.getInitData="getInitData",r.setInstallFinish="setInstallFinish",r.setInstall="setInstall",r.refreshAuth="refreshAuth",r.setAppOption="setAppOption",r.setUserOption="setUserOption",r.resizeWindow="resizeWindow",r.reloadWindow="reloadWindow",r.setTitle="setTitle",r.setScroll="setScroll",r.openApplication="openApplication",r.closeApplication="closeApplication",r.openPath="openPath",r.imCallTo="imCallTo",r.imPhoneTo="imPhoneTo",r.imOpenMessenger="imOpenMessenger",r.imOpenHistory="imOpenHistory",r.selectUser="selectUser",r.selectAccess="selectAccess",r.selectCRM="selectCRM",r.showAppForm="showAppForm",r.getInterface="getInterface",r.placementBindEvent="placementBindEvent",r))(le||{}),_g=Object.defineProperty,wg=a((r,e)=>_g(r,"name",{value:e,configurable:!0}),"m$3");class Wa{static{a(this,"MessageManager")}static{wg(this,"MessageManager")}#e;#r;#s;_logger;runCallbackHandler;constructor(e){this._logger=te.createNullLogger(),this.#e=e,this.#r=new Map,this.#s=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(e,t=null){return new Promise((s,n)=>{let i;const c={resolve:s,reject:n,timeoutId:null},o=this.#t(c);let l=null;const h=Zs(t||{},["singleOption","callBack","isSafely","safelyTime","requestId"]),{callBack:u,singleOption:g,requestId:p}=t||{};if(u&&this.#s.set(o,u),g?l=g:Object.keys(h).length>0&&(l={...h}),e.toString().includes(":"))i={method:e.toString(),params:l||"",callback:o,appSid:this.#e.getAppSid(),requestId:p};else{i=e.toString(),t?.isRawValue!==!0&&l?l=JSON.stringify(l):t?.isRawValue===!0&&l&&P.isPlainObject(l)&&l.value&&(l=l.value);const d=[l||"",o,this.#e.getAppSid()];i+=":"+d.filter(Boolean).join(":")}if(this.getLogger().debug(`send to ${this.#e.getTargetOrigin()}`,{cmd:i,origin:this.#e.getTargetOrigin()}),parent.postMessage(i,this.#e.getTargetOrigin()),t?.isSafely){const d=Number.parseInt(String(t?.safelyTime||900));this.#r.get(o).timeoutId=window.setTimeout(()=>{this.#r.has(o)&&(this.getLogger().warning(`action ${e.toString()} stop by timeout`,{command:e.toString(),safelyTime:d}),this.#r.delete(o),s({isSafely:!0}))},d)}})}_runCallback(e){if(e.origin===this.#e.getTargetOrigin()&&e.data){this.getLogger().debug(`get from ${e.origin}`,{data:e.data,origin:e.origin});const t=e.data.split(":"),s={id:t[0],args:t.slice(1).join(":")};if(s.args&&(s.args=JSON.parse(s.args)),this.#r.has(s.id)){const n=this.#r.get(s.id);n.timeoutId&&clearTimeout(n.timeoutId),this.#r.delete(s.id),n.resolve(s.args)}else if(this.#s.has(s.id)){const n=this.#s.get(s.id);n&&n.apply(globalThis,[s.args])}}}#t(e){const t=J.getUniqId();return this.#r.set(t,e),t}}var Sg=Object.defineProperty,vg=a((r,e)=>Sg(r,"name",{value:e,configurable:!0}),"h$1");class za{static{a(this,"AppFrame")}static{vg(this,"AppFrame")}#e="";#r=!0;#s=null;#t=null;#i=null;#n;#o;#c;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#r=e.PROTOCOL===!0,e.LANG&&(this.#i=e.LANG),e.APP_SID&&(this.#s=e.APP_SID),this.#c=new Map,this.#o=`${this.#r?"https":"http"}://${this.#e}`,this.#n=`${this.#o}/rest`,this.#c.set(X.v2,`${this.#n}`),this.#c.set(X.v3,`${this.#n}/api`)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#t||(this.#t=e.PATH),this.#i||(this.#i=e.LANG),this.#r=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this.#o=`${this.#r?"https":"http"}://${this.#e}`,this.#n=`${this.#o}/rest`,this.#c.set(X.v2,`${this.#n}`),this.#c.set(X.v3,`${this.#n}/api`),this}getAppSid(){if(this.#s===null)throw new Error("Not init appSid");return this.#s}getTargetOrigin(){return this.#o}getTargetOriginWithPath(){return this.#c}getLang(){return this.#i||tn.en}}var Eg=Object.defineProperty,Og=a((r,e)=>Eg(r,"name",{value:e,configurable:!0}),"s$6");class Ja{static{a(this,"AuthManager")}static{Og(this,"AuthManager")}#e=null;#r=null;#s=0;#t=0;#i=null;#n=!1;#o;#c;constructor(e,t){this.#o=e,this.#c=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#r=e.REFRESH_ID,this.#t=Number.parseInt(e.AUTH_EXPIRES),this.#s=Date.now()+this.#t*1e3,this.#n=e.IS_ADMIN,this.#i=e.MEMBER_ID||""),this}getAuthData(){return this.#s>Date.now()?{access_token:this.#e,refresh_token:this.#r,expires:this.#s/1e3,expires_in:this.#t,domain:this.#o.getTargetOrigin(),member_id:this.#i}:!1}async refreshAuth(){return this.#c.send(le.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#r=e.REFRESH_ID,this.#s=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#i||""].join("_")}get isAdmin(){return this.#n}getTargetOrigin(){return this.#o.getTargetOrigin()}getTargetOriginWithPath(){return this.#o.getTargetOriginWithPath()}}var Tg=Object.defineProperty,kg=a((r,e)=>Tg(r,"name",{value:e,configurable:!0}),"m$2");class Ga{static{a(this,"ParentManager")}static{kg(this,"ParentManager")}#e;constructor(e){this.#e=e}get message(){return this.#e}async closeApplication(){return this.#e.send(le.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(le.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(le.resizeWindow,{width:e,height:t,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${e} or height:number = ${t}`))}async resizeWindowAuto(e=null,t=0,s=0){const n=document.body;let i=Math.max(n.scrollWidth,n.offsetWidth);s>0&&(i=Math.max(s,i));let c=Math.max(n.scrollHeight,n.offsetHeight);return e&&(c=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(c=Math.max(t,c)),this.resizeWindow(i,c)}getScrollSize(){return ag()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(le.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(le.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(le.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(le.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(le.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(le.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(le.imOpenHistory,{dialogId:e,isSafely:!0})}}var Ig=Object.defineProperty,Ag=a((r,e)=>Ig(r,"name",{value:e,configurable:!0}),"r$4");let Ya=class{static{a(this,"OptionsManager")}static{Ag(this,"OptionsManager")}#e;#r=null;#s=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#r=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#s=e.USER_OPTIONS),this}appGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#r||(this.#r=[]),this.#r[e]=t,this.#t(le.setAppOption,e,this.#r[e])}userGet(e){if(this.#s&&this.#s[e])return this.#s[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#r||(this.#r=[]),this.#r[e]||(this.#r[e]=null),this.#s[e]=t,this.#t(le.setUserOption,e,this.#s[e])}async#t(e,t,s){return this.#e.send(e,{name:t,value:s,isSafely:!0}).then(()=>Promise.resolve())}};var Rg=Object.defineProperty,Ka=a((r,e)=>Rg(r,"name",{value:e,configurable:!0}),"i$3");class Za{static{a(this,"DialogManager")}static{Ka(this,"DialogManager")}#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(le.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(le.selectUser,{mult:!0})}async selectAccess(e=[]){return this.#e.send(le.selectAccess,{value:e})}async selectCRM(e){const t=await this.#e.send(le.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value}),s={};if(!t)return s;const n=Ka(u=>{if(u!=null)return Array.isArray(u)?u:Object.values(u)},"toArray"),i=n(t.lead);i&&(s.lead=i);const c=n(t.contact);c&&(s.contact=c);const o=n(t.company);o&&(s.company=o);const l=n(t.deal);l&&(s.deal=l);const h=n(t.quote);return h&&(s.quote=h),s}}var Cg=Object.defineProperty,Ng=a((r,e)=>Cg(r,"name",{value:e,configurable:!0}),"m$1");class Xa{static{a(this,"SliderManager")}static{Ng(this,"SliderManager")}#e;#r;constructor(e,t){this.#e=e,this.#r=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#r.send(le.openApplication,e)}async closeSliderAppPage(){return this.#r.send(le.closeApplication,{isSafely:!1})}#s(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const s=new URL(e);return s.searchParams.set("IFRAME","Y"),s.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#r.send(le.openPath,{path:[this.#s(t),s.pathname,s.search].join("")}).then(n=>n?.result==="error"?n?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((i,c)=>{const o=window.open(e,"_blank");if(!o){c(new Error("Error open window"));return}let l=0;const h=1e3*60*5,u=window.setInterval(()=>{l=l+1,o.closed?(clearInterval(u),i({isOpenAtNewWindow:!0,isClose:!0})):l>h&&(clearInterval(u),i({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(n?.errorCode)):n?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}}var Dg=Object.defineProperty,Lg=a((r,e)=>Dg(r,"name",{value:e,configurable:!0}),"i$2");class Qa{static{a(this,"PlacementManager")}static{Lg(this,"PlacementManager")}#e;#r="";#s={};constructor(e){this.#e=e}initData(e){return this.#r=e.PLACEMENT||"DEFAULT",this.#s=Object.freeze(e.PLACEMENT_OPTIONS),this}get title(){return this.#r}get placement(){return this.#r}get isDefault(){return this.placement==="DEFAULT"}get options(){return this.#s}get isSliderMode(){return this.options?.IFRAME==="Y"}async getInterface(){return this.#e.send(le.getInterface,{isSafely:!0})}async bindEvent(e,t){return this.#e.send(le.placementBindEvent,{event:e,callBack:t,isSafely:!0})}async call(e,t={}){if(e==="setValue"&&!P.isString(t?.value))throw new TypeError("placement.call('setValue', { value }) expects `value` to be a JSON-serialized string. Use placement.setValue(value) to serialize automatically, or call JSON.stringify yourself.");return this.#e.send(e,{...t,isSafely:!0,isRawValue:["setValue"].includes(e)})}async setValue(e){return this.#e.send("setValue",{value:JSON.stringify(e),isSafely:!0,isRawValue:!0})}async callCustomBind(e,t=null,s){let n={};return P.isString(t)?n.singleOption=t:P.isObjectLike(t)&&(n={...t}),this.#e.send(e,{...n,callBack:s,isSafely:!0})}}var Pg=Object.defineProperty,Mg=a((r,e)=>Pg(r,"name",{value:e,configurable:!0}),"r$3");class ec extends Xr{static{a(this,"B24Frame")}static{Mg(this,"B24Frame")}#e=!1;#r=!1;#s;#t;#i;#n;#o;#c;#h;#f;#a;constructor(e,t){super(),this.#a=t?.restrictionParams,this.#s=new za(e),this.#t=new Wa(this.#s),this.#t.subscribe(),this.#i=new Ja(this.#s,this.#t),this.#n=new Ga(this.#t),this.#o=new Ya(this.#t),this.#c=new Za(this.#t),this.#h=new Xa(this.#s,this.#t),this.#f=new Qa(this.#t),this._isInit=!1}setLogger(e){super.setLogger(e),this.#t.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#r}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#n}get auth(){return this._ensureInitialized(),this.#i}get slider(){return this._ensureInitialized(),this.#h}get placement(){return this._ensureInitialized(),this.#f}get options(){return this._ensureInitialized(),this.#o}get dialog(){return this._ensureInitialized(),this.#c}async init(){const e=await this.#t.send(le.getInitData,{});return this.getLogger().debug("init data",{data:e}),this.#s.initData(e),this.#i.initData(e),this.#f.initData(e),this.#o.initData(e),this.#e=e.INSTALL,this.#r=e.FIRST_RUN,this._httpV2=new hs(this.#i,this._getHttpOptions(),this.#a),this._httpV3=new ds(this.#i,this._getHttpOptions(),this.#a),this._isInit=!0,this.#r?this.#t.send(le.setInstall,{install:!0}):Promise.resolve()}destroy(){this.#t.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#t.send(le.setInstallFinish,{}):Promise.reject(new Error("Application was previously installed. You cannot call installFinish"))}getTargetOrigin(){return this._ensureInitialized(),this.#i.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#i.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#s.getAppSid()}getLang(){return this._ensureInitialized(),this.#s.getLang()}}var Fg=Object.defineProperty,xg=a((r,e)=>Fg(r,"name",{value:e,configurable:!0}),"e$2");class tc extends ce{static{a(this,"RefreshTokenError")}static{xg(this,"RefreshTokenError")}}var $g=Object.defineProperty,Bg=a((r,e)=>$g(r,"name",{value:e,configurable:!0}),"n$5");class rc{static{a(this,"AuthOAuthManager")}static{Bg(this,"AuthOAuthManager")}#e;#r=null;#s=null;#t;#i;#n=0;#o=0;#c;#h;#f;#a;#l;#u=null;constructor(e,t){this.#t=Object.assign({},e),this.#i=Object.freeze(Object.assign({},t)),this.#c=this.#t.domain.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#h=this.#t.clientEndpoint,this.#f=this.#h.replace("/rest/",""),this.#l=this.#t.serverEndpoint.replace("/rest/",""),this.#n=this.#t.expires*1e3,this.#o=this.#t.expiresIn,this.#e=be.create({baseURL:this.#l,headers:{"Content-Type":"application/json"}}),this.#a=new Map,this.#a.set(X.v2,`${this.#h}`),this.#a.set(X.v3,`${this.#h}/api`)}getAuthData(){return this.#n>Date.now()?{access_token:this.#t.accessToken,refresh_token:this.#t.refreshToken,expires:this.#n/1e3,expires_in:this.#o,domain:this.#c,member_id:this.#t.memberId}:!1}async refreshAuth(){try{let e;if(this.#s)e=await this.#s();else{const s=await this.#e.get("/oauth/token/",{params:{grant_type:"refresh_token",client_id:this.#i.clientId,client_secret:this.#i.clientSecret,refresh_token:this.#t.refreshToken}});if(s.data.error)throw new Error(`Token update error: ${s.data.error}`);if(s.status!==200)throw new Error(`Token update error status code: ${s.status}`);e=s.data}if(!e)throw new Error("Unable to obtain authorization update data");this.#t.accessToken=e.access_token,this.#t.refreshToken=e.refresh_token,this.#t.expires=Number.parseInt(e.expires||"0"),this.#t.expiresIn=Number.parseInt(e.expires_in||"3600"),this.#t.clientEndpoint=e.client_endpoint,this.#t.serverEndpoint=e.server_endpoint,this.#t.scope=e.scope,this.#t.status=Object.values(lt).find(s=>s===e.status)||lt.Free,this.#n=this.#t.expires*1e3;const t=this.getAuthData();return this.#r&&await this.#r({authData:t,b24OAuthParams:this.#t}),t}catch(e){if(e instanceof Pn){const t={code:e?.code||0,description:e?.message||""};if(e.response&&e.response.data&&!P.isUndefined(e.response.data.error)){const s=e.response.data;s.error&&typeof s.error=="object"&&"code"in s.error?(t.code=s.error.code,t.description=s.error.message,s.error.validation&&s.error.validation.forEach(n=>{t.description+=`${n?.message||JSON.stringify(n)}`})):s.error&&typeof s.error=="string"&&(t.code=s.error,t.description=s?.error_description??t.description)}throw new tc({code:String(t.code),description:t.description,status:e.response?.status||0})}else if(e instanceof Error)throw e;throw new Error(`Strange error: ${e instanceof Error?e.message:e}`,{cause:e})}}setCallbackRefreshAuth(e){this.#r=e}removeCallbackRefreshAuth(){this.#r=null}setCustomRefreshAuth(e){this.#s=e}removeCustomRefreshAuth(){this.#s=null}getUniq(e){return[e,this.#t.memberId||""].join("_")}getTargetOrigin(){return`${this.#f}`}getTargetOriginWithPath(){return this.#a}get isAdmin(){if(this.#u===null)throw new Error("isAdmin not init. You need call B24OAuth::initIsAdmin().");return this.#u}async initIsAdmin(e,t){if(this.#u=!1,e.apiVersion===X.v3){const n=await e.call("profile",{},t);if(!n.isSuccess)throw new Error(n.getErrorMessages().join(";"));n.getData().result.profile?.admin&&(this.#u=!0);return}const s=await e.call("profile",{},t);if(!s.isSuccess)throw new Error(s.getErrorMessages().join(";"));s.getData().result?.ADMIN&&(this.#u=!0)}}var jg=Object.defineProperty,Ug=a((r,e)=>jg(r,"name",{value:e,configurable:!0}),"n$4");class Vg extends Xr{static{a(this,"B24OAuth")}static{Ug(this,"B24OAuth")}#e;constructor(e,t,s){super(),this.#e=new rc(e,t);const n=`The B24OAuth object is intended exclusively for use on the server.
|
|
51
|
+
A webhook contains a secret access key, which MUST NOT be used in client-side code (browser, mobile app).`;this._httpV2=new hs(this.#e,this._getHttpOptions(),s?.restrictionParams),this._httpV2.setClientSideWarning(!0,n),this._httpV3=new ds(this.#e,this._getHttpOptions(),s?.restrictionParams),this._httpV3.setClientSideWarning(!0,n),this._isInit=!0}async initIsAdmin(e){const t="profile";this._ensureInitialized();try{const s=it.automaticallyObtainApiVersion(t),n=this.getHttpClient(s);return this.#e.initIsAdmin(n,e)}catch{return}}setCallbackRefreshAuth(e){this._ensureInitialized(),this.#e.setCallbackRefreshAuth(e)}removeCallbackRefreshAuth(){this._ensureInitialized(),this.#e.removeCallbackRefreshAuth()}setCustomRefreshAuth(e){this._ensureInitialized(),this.#e.setCustomRefreshAuth(e)}removeCustomRefreshAuth(){this._ensureInitialized(),this.#e.removeCustomRefreshAuth()}offClientSideWarning(){it.getAllApiVersions().forEach(e=>{this.getHttpClient(e).setClientSideWarning(!1,"")})}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var qg=Object.defineProperty,sc=a((r,e)=>qg(r,"name",{value:e,configurable:!0}),"t$3");class $n extends Error{static{a(this,"UnhandledMatchError")}static{sc(this,"UnhandledMatchError")}constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=`${new Error("for stack").stack}`}}class Kt{static{a(this,"AbstractHelper")}static{sc(this,"AbstractHelper")}_b24;_data=null;_logger;constructor(e){this._b24=e,this._logger=te.createNullLogger()}setLogger(e){this._logger=e}getLogger(){return this._logger}async initData(e){return Promise.reject(new Error("Rewrite this function"))}}var Hg=Object.defineProperty,Wg=a((r,e)=>Hg(r,"name",{value:e,configurable:!0}),"t$2");class zg extends Kt{static{a(this,"ProfileManager")}static{Wg(this,"ProfileManager")}_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}var Jg=Object.defineProperty,Gg=a((r,e)=>Jg(r,"name",{value:e,configurable:!0}),"a$4");class Yg extends Kt{static{a(this,"AppManager")}static{Gg(this,"AppManager")}_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return Go[this.data.status]||"Unknown status"}}var Kg=Object.defineProperty,Zg=a((r,e)=>Kg(r,"name",{value:e,configurable:!0}),"a$3");class Xg extends Kt{static{a(this,"PaymentManager")}static{Zg(this,"PaymentManager")}_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}var Qg=Object.defineProperty,ey=a((r,e)=>Qg(r,"name",{value:e,configurable:!0}),"t$1");class ty extends Kt{static{a(this,"LicenseManager")}static{ey(this,"LicenseManager")}_data=null;async initData(e){this._data=e,await this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}async makeRestrictionManagerParams(){if(!this.data?.license)return;const e=sn.fromTariffPlan(this.data.license);this.getLogger().debug("set restriction manager params",{license:this.data.license,restrictionParams:e}),await this._b24.setRestrictionManagerParams(e)}}var ry=Object.defineProperty,sy=a((r,e)=>ry(r,"name",{value:e,configurable:!0}),"l$4");class ny extends Kt{static{a(this,"CurrencyManager")}static{sy(this,"CurrencyManager")}async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(this.getLogger().error("Failed to load data",{error:t}),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{const t=(await this._b24.actions.v2.batchByChunk.make({calls:e,options:{isHaltOnError:!0}})).getData();if(!Array.isArray(t))return Promise.resolve();t.forEach(s=>{if(typeof s.LANG>"u")return;const n=s.CURRENCY,i=this.data.currencyList.get(n);if(!(typeof i>"u"))for(const[c,o]of Object.entries(s.LANG))switch(i.lang[c]={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[c].thousandsVariant){case"N":i.lang[c].thousandsSep="";break;case"D":i.lang[c].thousandsSep=".";break;case"C":i.lang[c].thousandsSep=",";break;case"S":i.lang[c].thousandsSep=" ";break;case"B":i.lang[c].thousandsSep=" ";break;default:P.isStringFilled(i.lang[c].thousandsSep)||(i.lang[c].thousandsSep=" ");break}})}catch(t){this.getLogger().error("Failed to load data",{error:t})}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(e){this._data.currencyBase=e}get baseCurrency(){return this.data.currencyBase}setCurrencyList(e=[]){this.data.currencyList.clear();for(const t of e)this.data.currencyList.set(t.CURRENCY,{amount:Number.parseFloat(t.CURRENCY),amountCnt:Number.parseInt(t.AMOUNT_CNT),isBase:t.BASE==="Y",currencyCode:t.CURRENCY,dateUpdate:J.toDateTime(t.DATE_UPDATE),decimals:Number.parseInt(t.DECIMALS),decPoint:t.DEC_POINT,formatString:t.FORMAT_STRING,fullName:t.FULL_NAME,lid:t.LID,sort:Number.parseInt(t.SORT),thousandsSep:t?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(e,t){const s=this.data.currencyList.get(e);if(typeof s>"u")throw new $n(e);let n=s.fullName;if(!(typeof t>"u")){const i=s.lang[t];P.isUndefined(i)||(n=i.fullName)}return n}getCurrencyLiteral(e,t){const s=this.data.currencyList.get(e);if(typeof s>"u")throw new $n(e);let n=s.formatString;if(!(typeof t>"u")){const i=s.lang[t];P.isUndefined(i)||(n=i.formatString)}return n.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,s){const n=this.data.currencyList.get(t);if(typeof n>"u")throw new $n(t);const i={formatString:n.formatString,decimals:n.decimals,decPoint:n.decPoint,thousandsSep:n.thousandsSep};P.isStringFilled(i.thousandsSep)||(i.thousandsSep="");const c=n.lang[s];return P.isUndefined(c)||(i.formatString=c.formatString,i.decimals=c.decimals,i.decPoint=c.decPoint,i.thousandsSep=c.thousandsSep),i.formatString.replaceAll("&#","&%").replace("#",J.numberFormat(e,i.decimals,i.decPoint,i.thousandsSep)).replaceAll("&%","&#")||""}}var iy=Object.defineProperty,oy=a((r,e)=>iy(r,"name",{value:e,configurable:!0}),"o$2");class Bn extends Kt{static{a(this,"OptionsManager")}static{oy(this,"OptionsManager")}_data;_type;static getSupportTypes(){return[ut.NotSet,ut.JsonArray,ut.JsonObject,ut.FloatVal,ut.IntegerVal,ut.BoolYN,ut.StringVal]}static prepareArrayList(e){return P.isArray(e)?e:P.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(),P.isObject(e))for(const[t,s]of Object.entries(e))this.data.set(t,s)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let s=this.data.get(e);try{s=JSON.parse(s),!P.isArray(s)&&!P.isObject(s)&&(s=t)}catch(n){this.getLogger().error("Failed JSON parse",{error:n}),s=t}return Bn.prepareArrayList(s)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let s=this.data.get(e);try{s=JSON.parse(s)}catch(n){this.getLogger().error("Failed JSON parse",{error:n}),s=t}return P.isObject(s)||(s=t),s}getFloat(e,t=0){return this.data.has(e)?J.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?J.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?J.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?J.toBoolean(this.data.get(e)):t}getString(e,t=""){return this.data.has(e)?this.data.get(e).toString():t}getDate(e,t=null){if(!this.data.has(e))return t;try{const s=J.toDateTime(this.data.get(e).toString());return s.isValid?s:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(s){this.getLogger().error("Failed JSON parse",{error:s})}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t,s){const n=[];return n.push({method:this.getMethodSave(),params:{options:e}}),P.isObject(t)&&n.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.actions.v2.batch.make({calls:n,options:{isHaltOnError:!0,returnAjaxResult:!1,requestId:s}})}}var ay=Object.defineProperty,cy=a((r,e)=>ay(r,"name",{value:e,configurable:!0}),"g$2");class nc{static{a(this,"StorageManager")}static{cy(this,"StorageManager")}_logger;userId;siteId;constructor(e={}){this._logger=te.createNullLogger(),this.userId=e.userId?J.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger}set(e,t){if(typeof window.localStorage>"u"){this.getLogger().error("localStorage undefined",{error:new Error("undefined window.localStorage")});return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window.localStorage>"u")return t||null;const s=window.localStorage.getItem(this._getKey(e));return s===null?t||null:JSON.parse(s)}remove(e){if(typeof window.localStorage>"u"){this.getLogger().error("localStorage undefined",{error:new Error("undefined window.localStorage")});return}return window.localStorage.removeItem(this._getKey(e))}_getKey(e){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${e}`}compareKey(e,t){return e===this._getKey(t)}}var ly=Object.defineProperty,ic=a((r,e)=>ly(r,"name",{value:e,configurable:!0}),"t");class uy extends Error{static{a(this,"ErrorNotConnected")}static{ic(this,"ErrorNotConnected")}constructor(e){super(e),this.name="ErrorNotConnected"}}class hy extends Error{static{a(this,"ErrorTimeout")}static{ic(this,"ErrorTimeout")}constructor(e){super(e),this.name="ErrorTimeout"}}var dy=Object.defineProperty,fy=a((r,e)=>dy(r,"name",{value:e,configurable:!0}),"R$1");const fs="2.0";class py{static{a(this,"JsonRpc")}static{fy(this,"JsonRpc")}_logger;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._logger=te.createNullLogger(),this._connector=e.connector,P.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,s=5){return new Promise((n,i)=>{const c=this.createRequest(e,t);this._connector.send(JSON.stringify(c))||i(new uy("websocket is not connected"));const o=setTimeout(()=>{this._rpcResponseAwaiters.delete(c.id),i(new hy("no response"))},s*1e3);this._rpcResponseAwaiters.set(c.id,{resolve:n,reject:i,timeout:o})})}executeOutgoingRpcBatch(e){const t=[],s=[];return e.forEach(({method:n,params:i,id:c})=>{const o=this.createRequest(n,i,c);t.push(o),s.push(new Promise((l,h)=>this._rpcResponseAwaiters.set(o.id,{resolve:l,reject:h})))}),this._connector.send(JSON.stringify(t)),s}processRpcResponse(e){if("id"in e&&this._rpcResponseAwaiters.has(Number(e.id))){const t=this._rpcResponseAwaiters.get(Number(e.id));t&&("result"in e?t.resolve(e.result):"error"in e?t.reject(e?.error||"error"):t.reject("wrong response structure"),clearTimeout(t.timeout),this._rpcResponseAwaiters.delete(Number(e.id)));return}this.getLogger().error(`${J.getDateForLog()}: Pull: Received rpc response with unknown id`,{response:e})}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(s){return this.getLogger().error(`${J.getDateForLog()}: Pull: Could not decode json rpc message`,{error:s}),[]}return P.isArray(t)?this.executeIncomingRpcBatch(t):P.isJsonRpcRequest(t)?this.executeIncomingRpcCommand(t):P.isJsonRpcResponse(t)?(this.processRpcResponse(t),[]):(this.getLogger().error(`${J.getDateForLog()}: Pull: unknown rpc packet`,{decoded:t}),[])}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:fs,error:en.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const s of e)if("jsonrpc"in s)if("method"in s){const n=this.executeIncomingRpcCommand(s);n&&(n.jsonrpc=fs,n.id=s.id,t.push(n))}else this.processRpcResponse(s);else this.getLogger().error(`${J.getDateForLog()}: Pull: unknown rpc command in batch`,{command:s}),t.push({jsonrpc:fs,error:en.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,s){return s||(s=this.nextId()),{jsonrpc:fs,method:e,params:t,id:s}}}var my=Object.defineProperty,gy=a((r,e)=>my(r,"name",{value:e,configurable:!0}),"g$1");class yy{static{a(this,"SharedConfig")}static{gy(this,"SharedConfig")}_logger;_storage;_ttl=1440*60;_callbacks;constructor(e={}){this._logger=te.createNullLogger(),e=e||{},this._storage=e.storage||new nc,this._callbacks={onWebSocketBlockChanged:P.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",Ve.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(Ve.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(Ve.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(`${J.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage`,{error:t}),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(Ve.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(Ve.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(`${J.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage.`,{error:t}),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(Ve.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(Ve.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(`${J.getDateForLog()}: LocalStorage error.`,{error:t}),!1}return!0}getTimestamp(){return Date.now()}}var by=Object.defineProperty,_y=a((r,e)=>by(r,"name",{value:e,configurable:!0}),"l$3");class wy{static{a(this,"ChannelManager")}static{_y(this,"ChannelManager")}_logger;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._logger=te.createNullLogger(),this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger}async getPublicIds(e){const t=new Date,s={},n=[];for(const i of e){const c=this._publicIds.get(i);c&&c.end>t?s[c.userId]=c:n.push(i)}return n.length===0?Promise.resolve(s):new Promise(i=>{this._restClient.callMethod(this._getPublicListMethod,{users:n}).then(c=>{const o=c.getData().result;this.setPublicIds(Object.values(o));for(const l of n){const h=this._publicIds.get(l);h&&(s[h.userId]=h)}i(s)}).catch(c=>(this.getLogger().error("some error in getPublicIds",{error:c}),i({})))})}setPublicIds(e){e.forEach(t=>{const s=Number(t.user_id);this._publicIds.set(s,{userId:s,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var Er=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sy(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}a(Sy,"getDefaultExportFromCjs");var jn={exports:{}},oc;function vy(){return oc||(oc=1,(function(r){var e=Object.defineProperty,t=a((s,n)=>e(s,"name",{value:n,configurable:!0}),"i");/*!
|
|
52
52
|
* protobuf.js v6.8.6 (c) 2016, daniel wirtz
|
|
53
53
|
* compiled mon, 26 feb 2018 11:35:34 utc
|
|
54
54
|
* licensed under the bsd-3-clause license
|
|
@@ -56,15 +56,15 @@ A webhook contains a secret access key, which MUST NOT be used in client-side co
|
|
|
56
56
|
*
|
|
57
57
|
* Modify a list for integration with Bitrix Framework:
|
|
58
58
|
* - removed integration with RequireJS and AMD package builders;
|
|
59
|
-
*/(function(s){t((function(n,i,c){function o(h){var
|
|
60
|
-
`+
|
|
59
|
+
*/(function(s){t((function(n,i,c){function o(h){var u=i[h];return u||n[h][0].call(u=i[h]={exports:{}},o,u,u.exports),u.exports}a(o,"d"),t(o,"$require");var l=o(c[0]);r&&r.exports&&(r.exports=l)}),"prelude")({1:[function(n,i,c){i.exports=o;function o(l,h){for(var u=new Array(arguments.length-1),g=0,p=2,d=!0;p<arguments.length;)u[g++]=arguments[p++];return new Promise(t(function(f,m){u[g]=t(function(y){if(d)if(d=!1,y)m(y);else{for(var b=new Array(arguments.length-1),_=0;_<b.length;)b[_++]=arguments[_];f.apply(null,b)}},"callback");try{l.apply(h||null,u)}catch(y){d&&(d=!1,m(y))}},"executor"))}a(o,"l"),t(o,"asPromise")},{}],2:[function(n,i,c){var o=c;o.length=t(function(p){var d=p.length;if(!d)return 0;for(var f=0;--d%4>1&&p.charAt(d)==="=";)++f;return Math.ceil(p.length*3)/4-f},"length");for(var l=new Array(64),h=new Array(123),u=0;u<64;)h[l[u]=u<26?u+65:u<52?u+71:u<62?u-4:u-59|43]=u++;o.encode=t(function(p,d,f){for(var m=null,y=[],b=0,_=0,w;d<f;){var S=p[d++];switch(_){case 0:y[b++]=l[S>>2],w=(S&3)<<4,_=1;break;case 1:y[b++]=l[w|S>>4],w=(S&15)<<2,_=2;break;case 2:y[b++]=l[w|S>>6],y[b++]=l[S&63],_=0;break}b>8191&&((m||(m=[])).push(String.fromCharCode.apply(String,y)),b=0)}return _&&(y[b++]=l[w],y[b++]=61,_===1&&(y[b++]=61)),m?(b&&m.push(String.fromCharCode.apply(String,y.slice(0,b))),m.join("")):String.fromCharCode.apply(String,y.slice(0,b))},"encode");var g="invalid encoding";o.decode=t(function(p,d,f){for(var m=f,y=0,b,_=0;_<p.length;){var w=p.charCodeAt(_++);if(w===61&&y>1)break;if((w=h[w])===s)throw Error(g);switch(y){case 0:b=w,y=1;break;case 1:d[f++]=b<<2|(w&48)>>4,b=w,y=2;break;case 2:d[f++]=(b&15)<<4|(w&60)>>2,b=w,y=3;break;case 3:d[f++]=(b&3)<<6|w,y=0;break}}if(y===1)throw Error(g);return f-m},"decode"),o.test=t(function(p){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(p)},"test")},{}],3:[function(n,i,c){i.exports=o;function o(l,h){typeof l=="string"&&(h=l,l=s);var u=[];function g(d){if(typeof d!="string"){var f=p();if(o.verbose&&console.log("codegen: "+f),f="return "+f,d){for(var m=Object.keys(d),y=new Array(m.length+1),b=new Array(m.length),_=0;_<m.length;)y[_]=m[_],b[_]=d[m[_++]];return y[_]=f,Function.apply(null,y).apply(null,b)}return Function(f)()}for(var w=new Array(arguments.length-1),S=0;S<w.length;)w[S]=arguments[++S];if(S=0,d=d.replace(/%([%dfijs])/g,t(function(T,v){var R=w[S++];switch(v){case"d":case"f":return String(Number(R));case"i":return String(Math.floor(R));case"j":return JSON.stringify(R);case"s":return String(R)}return"%"},"replace")),S!==w.length)throw Error("parameter count mismatch");return u.push(d),g}a(g,"a"),t(g,"Codegen");function p(d){return"function "+(d||h||"")+"("+(l&&l.join(",")||"")+`){
|
|
60
|
+
`+u.join(`
|
|
61
61
|
`)+`
|
|
62
|
-
}`}return a(p,"s"),t(p,"toString"),g.toString=p,g}a(o,"l"),t(o,"codegen"),o.verbose=!1},{}],4:[function(n,i,c){i.exports=o;function o(){this._listeners={}}a(o,"l"),t(o,"EventEmitter"),o.prototype.on=t(function(u,h,l){return(this._listeners[u]||(this._listeners[u]=[])).push({fn:h,ctx:l||this}),this},"on"),o.prototype.off=t(function(u,h){if(u===s)this._listeners={};else if(h===s)this._listeners[u]=[];else for(var l=this._listeners[u],g=0;g<l.length;)l[g].fn===h?l.splice(g,1):++g;return this},"off"),o.prototype.emit=t(function(u){var h=this._listeners[u];if(h){for(var l=[],g=1;g<arguments.length;)l.push(arguments[g++]);for(g=0;g<h.length;)h[g].fn.apply(h[g++].ctx,l)}return this},"emit")},{}],5:[function(n,i,c){i.exports=l;var o=n(1),u=n(7),h=u("fs");function l(g,p,f){return typeof p=="function"?(f=p,p={}):p||(p={}),f?!p.xhr&&h&&h.readFile?h.readFile(g,t(function(d,m){return d&&typeof XMLHttpRequest<"u"?l.xhr(g,p,f):d?f(d):f(null,p.binary?m:m.toString("utf8"))},"fetchReadFileCallback")):l.xhr(g,p,f):o(l,this,g,p)}a(l,"u"),t(l,"fetch"),l.xhr=t(function(g,p,f){var d=new XMLHttpRequest;d.onreadystatechange=t(function(){if(d.readyState!==4)return s;if(d.status!==0&&d.status!==200)return f(Error("status "+d.status));if(p.binary){var m=d.response;if(!m){m=[];for(var y=0;y<d.responseText.length;++y)m.push(d.responseText.charCodeAt(y)&255)}return f(null,typeof Uint8Array<"u"?new Uint8Array(m):m)}return f(null,d.responseText)},"fetchOnReadyStateChange"),p.binary&&("overrideMimeType"in d&&d.overrideMimeType("text/plain; charset=x-user-defined"),d.responseType="arraybuffer"),d.open("GET",g),d.send()},"fetch_xhr")},{1:1,7:7}],6:[function(n,i,c){i.exports=o(o);function o(p){return typeof Float32Array<"u"?(function(){var f=new Float32Array([-0]),d=new Uint8Array(f.buffer),m=d[3]===128;function y(S,T,v){f[0]=S,T[v]=d[0],T[v+1]=d[1],T[v+2]=d[2],T[v+3]=d[3]}a(y,"f"),t(y,"writeFloat_f32_cpy");function b(S,T,v){f[0]=S,T[v]=d[3],T[v+1]=d[2],T[v+2]=d[1],T[v+3]=d[0]}a(b,"n"),t(b,"writeFloat_f32_rev"),p.writeFloatLE=m?y:b,p.writeFloatBE=m?b:y;function _(S,T){return d[0]=S[T],d[1]=S[T+1],d[2]=S[T+2],d[3]=S[T+3],f[0]}a(_,"o"),t(_,"readFloat_f32_cpy");function w(S,T){return d[3]=S[T],d[2]=S[T+1],d[1]=S[T+2],d[0]=S[T+3],f[0]}a(w,"p"),t(w,"readFloat_f32_rev"),p.readFloatLE=m?_:w,p.readFloatBE=m?w:_})():(function(){function f(m,y,b,_){var w=y<0?1:0;if(w&&(y=-y),y===0)m(1/y>0?0:2147483648,b,_);else if(isNaN(y))m(2143289344,b,_);else if(y>34028234663852886e22)m((w<<31|2139095040)>>>0,b,_);else if(y<11754943508222875e-54)m((w<<31|Math.round(y/1401298464324817e-60))>>>0,b,_);else{var S=Math.floor(Math.log(y)/Math.LN2),T=Math.round(y*Math.pow(2,-S)*8388608)&8388607;m((w<<31|S+127<<23|T)>>>0,b,_)}}a(f,"t"),t(f,"writeFloat_ieee754"),p.writeFloatLE=f.bind(null,u),p.writeFloatBE=f.bind(null,h);function d(m,y,b){var _=m(y,b),w=(_>>31)*2+1,S=_>>>23&255,T=_&8388607;return S===255?T?NaN:w*(1/0):S===0?w*1401298464324817e-60*T:w*Math.pow(2,S-150)*(T+8388608)}a(d,"r"),t(d,"readFloat_ieee754"),p.readFloatLE=d.bind(null,l),p.readFloatBE=d.bind(null,g)})(),typeof Float64Array<"u"?(function(){var f=new Float64Array([-0]),d=new Uint8Array(f.buffer),m=d[7]===128;function y(S,T,v){f[0]=S,T[v]=d[0],T[v+1]=d[1],T[v+2]=d[2],T[v+3]=d[3],T[v+4]=d[4],T[v+5]=d[5],T[v+6]=d[6],T[v+7]=d[7]}a(y,"f"),t(y,"writeDouble_f64_cpy");function b(S,T,v){f[0]=S,T[v]=d[7],T[v+1]=d[6],T[v+2]=d[5],T[v+3]=d[4],T[v+4]=d[3],T[v+5]=d[2],T[v+6]=d[1],T[v+7]=d[0]}a(b,"n"),t(b,"writeDouble_f64_rev"),p.writeDoubleLE=m?y:b,p.writeDoubleBE=m?b:y;function _(S,T){return d[0]=S[T],d[1]=S[T+1],d[2]=S[T+2],d[3]=S[T+3],d[4]=S[T+4],d[5]=S[T+5],d[6]=S[T+6],d[7]=S[T+7],f[0]}a(_,"o"),t(_,"readDouble_f64_cpy");function w(S,T){return d[7]=S[T],d[6]=S[T+1],d[5]=S[T+2],d[4]=S[T+3],d[3]=S[T+4],d[2]=S[T+5],d[1]=S[T+6],d[0]=S[T+7],f[0]}a(w,"p"),t(w,"readDouble_f64_rev"),p.readDoubleLE=m?_:w,p.readDoubleBE=m?w:_})():(function(){function f(m,y,b,_,w,S){var T=_<0?1:0;if(T&&(_=-_),_===0)m(0,w,S+y),m(1/_>0?0:2147483648,w,S+b);else if(isNaN(_))m(0,w,S+y),m(2146959360,w,S+b);else if(_>17976931348623157e292)m(0,w,S+y),m((T<<31|2146435072)>>>0,w,S+b);else{var v;if(_<22250738585072014e-324)v=_/5e-324,m(v>>>0,w,S+y),m((T<<31|v/4294967296)>>>0,w,S+b);else{var I=Math.floor(Math.log(_)/Math.LN2);I===1024&&(I=1023),v=_*Math.pow(2,-I),m(v*4503599627370496>>>0,w,S+y),m((T<<31|I+1023<<20|v*1048576&1048575)>>>0,w,S+b)}}}a(f,"t"),t(f,"writeDouble_ieee754"),p.writeDoubleLE=f.bind(null,u,0,4),p.writeDoubleBE=f.bind(null,h,4,0);function d(m,y,b,_,w){var S=m(_,w+y),T=m(_,w+b),v=(T>>31)*2+1,I=T>>>20&2047,E=4294967296*(T&1048575)+S;return I===2047?E?NaN:v*(1/0):I===0?v*5e-324*E:v*Math.pow(2,I-1075)*(E+4503599627370496)}a(d,"r"),t(d,"readDouble_ieee754"),p.readDoubleLE=d.bind(null,l,0,4),p.readDoubleBE=d.bind(null,g,4,0)})(),p}a(o,"l"),t(o,"factory");function u(p,f,d){f[d]=p&255,f[d+1]=p>>>8&255,f[d+2]=p>>>16&255,f[d+3]=p>>>24}a(u,"d"),t(u,"writeUintLE");function h(p,f,d){f[d]=p>>>24,f[d+1]=p>>>16&255,f[d+2]=p>>>8&255,f[d+3]=p&255}a(h,"c"),t(h,"writeUintBE");function l(p,f){return(p[f]|p[f+1]<<8|p[f+2]<<16|p[f+3]<<24)>>>0}a(l,"u"),t(l,"readUintLE");function g(p,f){return(p[f]<<24|p[f+1]<<16|p[f+2]<<8|p[f+3])>>>0}a(g,"a"),t(g,"readUintBE")},{}],7:[function(n,i,c){i.exports=o;function o(u){try{var h=n(u);if(h&&(h.length||Object.keys(h).length))return h}catch{}return null}a(o,"l"),t(o,"inquire")},{}],8:[function(n,i,c){var o=c,u=o.isAbsolute=t(function(l){return/^(?:\/|\w+:)/.test(l)},"isAbsolute"),h=o.normalize=t(function(l){l=l.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var g=l.split("/"),p=u(l),f="";p&&(f=g.shift()+"/");for(var d=0;d<g.length;)g[d]===".."?d>0&&g[d-1]!==".."?g.splice(--d,2):p?g.splice(d,1):++d:g[d]==="."?g.splice(d,1):++d;return f+g.join("/")},"normalize");o.resolve=t(function(l,g,p){return p||(g=h(g)),u(g)?g:(p||(l=h(l)),(l=l.replace(/(?:\/|^)[^/]+$/,"")).length?h(l+"/"+g):g)},"resolve")},{}],9:[function(n,i,c){i.exports=o;function o(u,h,l){var g=l||8192,p=g>>>1,f=null,d=g;return t(function(m){if(m<1||m>p)return u(m);d+m>g&&(f=u(g),d=0);var y=h.call(f,d,d+=m);return d&7&&(d=(d|7)+1),y},"pool_alloc")}a(o,"l"),t(o,"pool")},{}],10:[function(n,i,c){var o=c;o.length=t(function(u){for(var h=0,l=0,g=0;g<u.length;++g)l=u.charCodeAt(g),l<128?h+=1:l<2048?h+=2:(l&64512)===55296&&(u.charCodeAt(g+1)&64512)===56320?(++g,h+=4):h+=3;return h},"utf8_length"),o.read=t(function(u,h,l){var g=l-h;if(g<1)return"";for(var p=null,f=[],d=0,m;h<l;)m=u[h++],m<128?f[d++]=m:m>191&&m<224?f[d++]=(m&31)<<6|u[h++]&63:m>239&&m<365?(m=((m&7)<<18|(u[h++]&63)<<12|(u[h++]&63)<<6|u[h++]&63)-65536,f[d++]=55296+(m>>10),f[d++]=56320+(m&1023)):f[d++]=(m&15)<<12|(u[h++]&63)<<6|u[h++]&63,d>8191&&((p||(p=[])).push(String.fromCharCode.apply(String,f)),d=0);return p?(d&&p.push(String.fromCharCode.apply(String,f.slice(0,d))),p.join("")):String.fromCharCode.apply(String,f.slice(0,d))},"utf8_read"),o.write=t(function(u,h,l){for(var g=l,p,f,d=0;d<u.length;++d)p=u.charCodeAt(d),p<128?h[l++]=p:p<2048?(h[l++]=p>>6|192,h[l++]=p&63|128):(p&64512)===55296&&((f=u.charCodeAt(d+1))&64512)===56320?(p=65536+((p&1023)<<10)+(f&1023),++d,h[l++]=p>>18|240,h[l++]=p>>12&63|128,h[l++]=p>>6&63|128,h[l++]=p&63|128):(h[l++]=p>>12|224,h[l++]=p>>6&63|128,h[l++]=p&63|128);return l-g},"utf8_write")},{}],11:[function(n,i,c){i.exports=u;var o=/\/|\./;function u(l,g){o.test(l)||(l="google/protobuf/"+l+".proto",g={nested:{google:{nested:{protobuf:{nested:g}}}}}),u[l]=g}a(u,"d"),t(u,"common"),u("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var h;u("duration",{Duration:h={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),u("timestamp",{Timestamp:h}),u("empty",{Empty:{fields:{}}}),u("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),u("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),u("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),u.get=t(function(l){return u[l]||null},"get")},{}],12:[function(n,i,c){var o=c,u=n(15),h=n(37);function l(p,f,d,m){if(f.resolvedType)if(f.resolvedType instanceof u){p("switch(d%s){",m);for(var y=f.resolvedType.values,b=Object.keys(y),_=0;_<b.length;++_)f.repeated&&y[b[_]]===f.typeDefault&&p("default:"),p("case%j:",b[_])("case %i:",y[b[_]])("m%s=%j",m,y[b[_]])("break");p("}")}else p('if(typeof d%s!=="object")',m)("throw TypeError(%j)",f.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",m,d,m);else{var w=!1;switch(f.type){case"double":case"float":p("m%s=Number(d%s)",m,m);break;case"uint32":case"fixed32":p("m%s=d%s>>>0",m,m);break;case"int32":case"sint32":case"sfixed32":p("m%s=d%s|0",m,m);break;case"uint64":w=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":p("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",m,m,w)('else if(typeof d%s==="string")',m)("m%s=parseInt(d%s,10)",m,m)('else if(typeof d%s==="number")',m)("m%s=d%s",m,m)('else if(typeof d%s==="object")',m)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",m,m,m,w?"true":"");break;case"bytes":p('if(typeof d%s==="string")',m)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",m,m,m)("else if(d%s.length)",m)("m%s=d%s",m,m);break;case"string":p("m%s=String(d%s)",m,m);break;case"bool":p("m%s=Boolean(d%s)",m,m);break}}return p}a(l,"u"),t(l,"genValuePartial_fromObject"),o.fromObject=t(function(p){var f=p.fieldsArray,d=h.codegen(["d"],p.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!f.length)return d("return new this.ctor");d("var m=new this.ctor");for(var m=0;m<f.length;++m){var y=f[m].resolve(),b=h.safeProp(y.name);y.map?(d("if(d%s){",b)('if(typeof d%s!=="object")',b)("throw TypeError(%j)",y.fullName+": object expected")("m%s={}",b)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",b),l(d,y,m,b+"[ks[i]]")("}")("}")):y.repeated?(d("if(d%s){",b)("if(!Array.isArray(d%s))",b)("throw TypeError(%j)",y.fullName+": array expected")("m%s=[]",b)("for(var i=0;i<d%s.length;++i){",b),l(d,y,m,b+"[i]")("}")("}")):(y.resolvedType instanceof u||d("if(d%s!=null){",b),l(d,y,m,b),y.resolvedType instanceof u||d("}"))}return d("return m")},"fromObject");function g(p,f,d,m){if(f.resolvedType)f.resolvedType instanceof u?p("d%s=o.enums===String?types[%i].values[m%s]:m%s",m,d,m,m):p("d%s=types[%i].toObject(m%s,o)",m,d,m);else{var y=!1;switch(f.type){case"double":case"float":p("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",m,m,m,m);break;case"uint64":y=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":p('if(typeof m%s==="number")',m)("d%s=o.longs===String?String(m%s):m%s",m,m,m)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",m,m,m,m,y?"true":"",m);break;case"bytes":p("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",m,m,m,m,m);break;default:p("d%s=m%s",m,m);break}}return p}a(g,"a"),t(g,"genValuePartial_toObject"),o.toObject=t(function(p){var f=p.fieldsArray.slice().sort(h.compareFieldsById);if(!f.length)return h.codegen()("return {}");for(var d=h.codegen(["m","o"],p.name+"$toObject")("if(!o)")("o={}")("var d={}"),m=[],y=[],b=[],_=0;_<f.length;++_)f[_].partOf||(f[_].resolve().repeated?m:f[_].map?y:b).push(f[_]);if(m.length){for(d("if(o.arrays||o.defaults){"),_=0;_<m.length;++_)d("d%s=[]",h.safeProp(m[_].name));d("}")}if(y.length){for(d("if(o.objects||o.defaults){"),_=0;_<y.length;++_)d("d%s={}",h.safeProp(y[_].name));d("}")}if(b.length){for(d("if(o.defaults){"),_=0;_<b.length;++_){var w=b[_],S=h.safeProp(w.name);w.resolvedType instanceof u?d("d%s=o.enums===String?%j:%j",S,w.resolvedType.valuesById[w.typeDefault],w.typeDefault):w.long?d("if(util.Long){")("var n=new util.Long(%i,%i,%j)",w.typeDefault.low,w.typeDefault.high,w.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",S)("}else")("d%s=o.longs===String?%j:%i",S,w.typeDefault.toString(),w.typeDefault.toNumber()):w.bytes?d("d%s=o.bytes===String?%j:%s",S,String.fromCharCode.apply(String,w.typeDefault),"["+Array.prototype.slice.call(w.typeDefault).join(",")+"]"):d("d%s=%j",S,w.typeDefault)}d("}")}var T=!1;for(_=0;_<f.length;++_){var w=f[_],v=p._fieldsArray.indexOf(w),S=h.safeProp(w.name);w.map?(T||(T=!0,d("var ks2")),d("if(m%s&&(ks2=Object.keys(m%s)).length){",S,S)("d%s={}",S)("for(var j=0;j<ks2.length;++j){"),g(d,w,v,S+"[ks2[j]]")("}")):w.repeated?(d("if(m%s&&m%s.length){",S,S)("d%s=[]",S)("for(var j=0;j<m%s.length;++j){",S),g(d,w,v,S+"[j]")("}")):(d("if(m%s!=null&&m.hasOwnProperty(%j)){",S,w.name),g(d,w,v,S),w.partOf&&d("if(o.oneofs)")("d%s=%j",h.safeProp(w.partOf.name),w.name)),d("}")}return d("return d")},"toObject")},{15:15,37:37}],13:[function(n,i,c){i.exports=g;var o=n(15),u=n(36),h=n(37);function l(p){return"missing required '"+p.name+"'"}a(l,"u"),t(l,"missing");function g(p){var f=h.codegen(["r","l"],p.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(p.fieldsArray.filter(function(w){return w.map}).length?",k":""))("while(r.pos<c){")("var t=r.uint32()");p.group&&f("if((t&7)===4)")("break"),f("switch(t>>>3){");for(var d=0;d<p.fieldsArray.length;++d){var m=p._fieldsArray[d].resolve(),y=m.resolvedType instanceof o?"int32":m.type,b="m"+h.safeProp(m.name);f("case %i:",m.id),m.map?(f("r.skip().pos++")("if(%s===util.emptyObject)",b)("%s={}",b)("k=r.%s()",m.keyType)("r.pos++"),u.long[m.keyType]!==s?u.basic[y]===s?f('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',b,d):f('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',b,y):u.basic[y]===s?f("%s[k]=types[%i].decode(r,r.uint32())",b,d):f("%s[k]=r.%s()",b,y)):m.repeated?(f("if(!(%s&&%s.length))",b,b)("%s=[]",b),u.packed[y]!==s&&f("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",b,y)("}else"),u.basic[y]===s?f(m.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",b,d):f("%s.push(r.%s())",b,y)):u.basic[y]===s?f(m.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",b,d):f("%s=r.%s()",b,y),f("break")}for(f("default:")("r.skipType(t&7)")("break")("}")("}"),d=0;d<p._fieldsArray.length;++d){var _=p._fieldsArray[d];_.required&&f("if(!m.hasOwnProperty(%j))",_.name)("throw util.ProtocolError(%j,{instance:m})",l(_))}return f("return m")}a(g,"a"),t(g,"decoder")},{15:15,36:36,37:37}],14:[function(n,i,c){i.exports=g;var o=n(15),u=n(36),h=n(37);function l(p,f,d,m){return f.resolvedType.group?p("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",d,m,(f.id<<3|3)>>>0,(f.id<<3|4)>>>0):p("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",d,m,(f.id<<3|2)>>>0)}a(l,"u"),t(l,"genTypePartial");function g(p){for(var f=h.codegen(["m","w"],p.name+"$encode")("if(!w)")("w=Writer.create()"),y,d,m=p.fieldsArray.slice().sort(h.compareFieldsById),y=0;y<m.length;++y){var b=m[y].resolve(),_=p._fieldsArray.indexOf(b),w=b.resolvedType instanceof o?"int32":b.type,S=u.basic[w];d="m"+h.safeProp(b.name),b.map?(f("if(%s!=null&&m.hasOwnProperty(%j)){",d,b.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",d)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(b.id<<3|2)>>>0,8|u.mapKey[b.keyType],b.keyType),S===s?f("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",_,d):f(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|S,w,d),f("}")("}")):b.repeated?(f("if(%s!=null&&%s.length){",d,d),b.packed&&u.packed[w]!==s?f("w.uint32(%i).fork()",(b.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",d)("w.%s(%s[i])",w,d)("w.ldelim()"):(f("for(var i=0;i<%s.length;++i)",d),S===s?l(f,b,_,d+"[i]"):f("w.uint32(%i).%s(%s[i])",(b.id<<3|S)>>>0,w,d)),f("}")):(b.optional&&f("if(%s!=null&&m.hasOwnProperty(%j))",d,b.name),S===s?l(f,b,_,d):f("w.uint32(%i).%s(%s)",(b.id<<3|S)>>>0,w,d))}return f("return w")}a(g,"a"),t(g,"encoder")},{15:15,36:36,37:37}],15:[function(n,i,c){i.exports=l;var o=n(24);((l.prototype=Object.create(o.prototype)).constructor=l).className="Enum";var u=n(23),h=n(37);function l(g,p,f,d,m){if(o.call(this,g,f),p&&typeof p!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=d,this.comments=m||{},this.reserved=s,p)for(var y=Object.keys(p),b=0;b<y.length;++b)typeof p[y[b]]=="number"&&(this.valuesById[this.values[y[b]]=p[y[b]]]=y[b])}a(l,"u"),t(l,"Enum"),l.fromJSON=t(function(g,p){var f=new l(g,p.values,p.options,p.comment,p.comments);return f.reserved=p.reserved,f},"fromJSON"),l.prototype.toJSON=t(function(g){var p=g?!!g.keepComments:!1;return h.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:s,"comment",p?this.comment:s,"comments",p?this.comments:s])},"toJSON"),l.prototype.add=t(function(g,p,f){if(!h.isString(g))throw TypeError("name must be a string");if(!h.isInteger(p))throw TypeError("id must be an integer");if(this.values[g]!==s)throw Error("duplicate name '"+g+"' in "+this);if(this.isReservedId(p))throw Error("id "+p+" is reserved in "+this);if(this.isReservedName(g))throw Error("name '"+g+"' is reserved in "+this);if(this.valuesById[p]!==s){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+p+" in "+this);this.values[g]=p}else this.valuesById[this.values[g]=p]=g;return this.comments[g]=f||null,this},"add"),l.prototype.remove=t(function(g){if(!h.isString(g))throw TypeError("name must be a string");var p=this.values[g];if(p==null)throw Error("name '"+g+"' does not exist in "+this);return delete this.valuesById[p],delete this.values[g],delete this.comments[g],this},"remove"),l.prototype.isReservedId=t(function(g){return u.isReservedId(this.reserved,g)},"isReservedId"),l.prototype.isReservedName=t(function(g){return u.isReservedName(this.reserved,g)},"isReservedName")},{23:23,24:24,37:37}],16:[function(n,i,c){i.exports=f;var o=n(24);((f.prototype=Object.create(o.prototype)).constructor=f).className="Field";var u=n(15),h=n(36),l=n(37),g,p=/^required|optional|repeated$/;f.fromJSON=t(function(d,m){return new f(d,m.id,m.type,m.rule,m.extend,m.options,m.comment)},"fromJSON");function f(d,m,y,b,_,w,S){if(l.isObject(b)?(S=_,w=b,b=_=s):l.isObject(_)&&(S=w,w=_,_=s),o.call(this,d,w),!l.isInteger(m)||m<0)throw TypeError("id must be a non-negative integer");if(!l.isString(y))throw TypeError("type must be a string");if(b!==s&&!p.test(b=b.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(_!==s&&!l.isString(_))throw TypeError("extend must be a string");this.rule=b&&b!=="optional"?b:s,this.type=y,this.id=m,this.extend=_||s,this.required=b==="required",this.optional=!this.required,this.repeated=b==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=l.Long?h.long[y]!==s:!1,this.bytes=y==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=S}a(f,"t"),t(f,"Field"),Object.defineProperty(f.prototype,"packed",{get:t(function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed},"get")}),f.prototype.setOption=t(function(d,m,y){return d==="packed"&&(this._packed=null),o.prototype.setOption.call(this,d,m,y)},"setOption"),f.prototype.toJSON=t(function(d){var m=d?!!d.keepComments:!1;return l.toObject(["rule",this.rule!=="optional"&&this.rule||s,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",m?this.comment:s])},"toJSON"),f.prototype.resolve=t(function(){if(this.resolved)return this;if((this.typeDefault=h.defaults[this.type])===s&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof g?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof u&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==s&&this.resolvedType&&!(this.resolvedType instanceof u))&&delete this.options.packed,Object.keys(this.options).length||(this.options=s)),this.long)this.typeDefault=l.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var d;l.base64.test(this.typeDefault)?l.base64.decode(this.typeDefault,d=l.newBuffer(l.base64.length(this.typeDefault)),0):l.utf8.write(this.typeDefault,d=l.newBuffer(l.utf8.length(this.typeDefault)),0),this.typeDefault=d}return this.map?this.defaultValue=l.emptyObject:this.repeated?this.defaultValue=l.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof g&&(this.parent.ctor.prototype[this.name]=this.defaultValue),o.prototype.resolve.call(this)},"resolve"),f.d=t(function(d,m,y,b){return typeof m=="function"?m=l.decorateType(m).name:m&&typeof m=="object"&&(m=l.decorateEnum(m).name),t(function(_,w){l.decorateType(_.constructor).add(new f(w,d,m,y,{default:b}))},"fieldDecorator")},"decorateField"),f._configure=t(function(d){g=d},"configure")},{15:15,24:24,36:36,37:37}],17:[function(n,i,c){var o=i.exports=n(18);o.build="light";function u(l,g,p){return typeof g=="function"?(p=g,g=new o.Root):g||(g=new o.Root),g.load(l,p)}a(u,"d"),t(u,"load"),o.load=u;function h(l,g){return g||(g=new o.Root),g.loadSync(l)}a(h,"c"),t(h,"loadSync"),o.loadSync=h,o.encoder=n(14),o.decoder=n(13),o.verifier=n(40),o.converter=n(12),o.ReflectionObject=n(24),o.Namespace=n(23),o.Root=n(29),o.Enum=n(15),o.Type=n(35),o.Field=n(16),o.OneOf=n(25),o.MapField=n(20),o.Service=n(33),o.Method=n(22),o.Message=n(21),o.wrappers=n(41),o.types=n(36),o.util=n(37),o.ReflectionObject._configure(o.Root),o.Namespace._configure(o.Type,o.Service),o.Root._configure(o.Type),o.Field._configure(o.Type)},{12:12,13:13,14:14,15:15,16:16,18:18,20:20,21:21,22:22,23:23,24:24,25:25,29:29,33:33,35:35,36:36,37:37,40:40,41:41}],18:[function(n,i,c){var o=c;o.build="minimal",o.Writer=n(42),o.BufferWriter=n(43),o.Reader=n(27),o.BufferReader=n(28),o.util=n(39),o.rpc=n(31),o.roots=n(30),o.configure=u;function u(){o.Reader._configure(o.BufferReader),o.util._configure()}a(u,"d"),t(u,"configure"),o.Writer._configure(o.BufferWriter),u()},{27:27,28:28,30:30,31:31,39:39,42:42,43:43}],19:[function(n,i,c){var o=i.exports=n(17);o.build="full",o.tokenize=n(34),o.parse=n(26),o.common=n(11),o.Root._configure(o.Type,o.parse,o.common)},{11:11,17:17,26:26,34:34}],20:[function(n,i,c){i.exports=l;var o=n(16);((l.prototype=Object.create(o.prototype)).constructor=l).className="MapField";var u=n(36),h=n(37);function l(g,p,f,d,m,y){if(o.call(this,g,p,d,s,s,m,y),!h.isString(f))throw TypeError("keyType must be a string");this.keyType=f,this.resolvedKeyType=null,this.map=!0}a(l,"u"),t(l,"MapField"),l.fromJSON=t(function(g,p){return new l(g,p.id,p.keyType,p.type,p.options,p.comment)},"fromJSON"),l.prototype.toJSON=t(function(g){var p=g?!!g.keepComments:!1;return h.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",p?this.comment:s])},"toJSON"),l.prototype.resolve=t(function(){if(this.resolved)return this;if(u.mapKey[this.keyType]===s)throw Error("invalid key type: "+this.keyType);return o.prototype.resolve.call(this)},"resolve"),l.d=t(function(g,p,f){return typeof f=="function"?f=h.decorateType(f).name:f&&typeof f=="object"&&(f=h.decorateEnum(f).name),t(function(d,m){h.decorateType(d.constructor).add(new l(m,g,p,f))},"mapFieldDecorator")},"decorateMapField")},{16:16,36:36,37:37}],21:[function(n,i,c){i.exports=u;var o=n(39);function u(h){if(h)for(var l=Object.keys(h),g=0;g<l.length;++g)this[l[g]]=h[l[g]]}a(u,"d"),t(u,"Message"),u.create=t(function(h){return this.$type.create(h)},"create"),u.encode=t(function(h,l){return this.$type.encode(h,l)},"encode"),u.encodeDelimited=t(function(h,l){return this.$type.encodeDelimited(h,l)},"encodeDelimited"),u.decode=t(function(h){return this.$type.decode(h)},"decode"),u.decodeDelimited=t(function(h){return this.$type.decodeDelimited(h)},"decodeDelimited"),u.verify=t(function(h){return this.$type.verify(h)},"verify"),u.fromObject=t(function(h){return this.$type.fromObject(h)},"fromObject"),u.toObject=t(function(h,l){return this.$type.toObject(h,l)},"toObject"),u.prototype.toJSON=t(function(){return this.$type.toObject(this,o.toJSONOptions)},"toJSON")},{39:39}],22:[function(n,i,c){i.exports=h;var o=n(24);((h.prototype=Object.create(o.prototype)).constructor=h).className="Method";var u=n(37);function h(l,g,p,f,d,m,y,b){if(u.isObject(d)?(y=d,d=m=s):u.isObject(m)&&(y=m,m=s),!(g===s||u.isString(g)))throw TypeError("type must be a string");if(!u.isString(p))throw TypeError("requestType must be a string");if(!u.isString(f))throw TypeError("responseType must be a string");o.call(this,l,y),this.type=g||"rpc",this.requestType=p,this.requestStream=d?!0:s,this.responseType=f,this.responseStream=m?!0:s,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=b}a(h,"c"),t(h,"Method"),h.fromJSON=t(function(l,g){return new h(l,g.type,g.requestType,g.responseType,g.requestStream,g.responseStream,g.options,g.comment)},"fromJSON"),h.prototype.toJSON=t(function(l){var g=l?!!l.keepComments:!1;return u.toObject(["type",this.type!=="rpc"&&this.type||s,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",g?this.comment:s])},"toJSON"),h.prototype.resolve=t(function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),o.prototype.resolve.call(this))},"resolve")},{24:24,37:37}],23:[function(n,i,c){i.exports=d;var o=n(24);((d.prototype=Object.create(o.prototype)).constructor=d).className="Namespace";var u=n(15),h=n(16),l=n(37),g,p;d.fromJSON=t(function(y,b){return new d(y,b.options).addJSON(b.nested)},"fromJSON");function f(y,b){if(!(y&&y.length))return s;for(var _={},w=0;w<y.length;++w)_[y[w].name]=y[w].toJSON(b);return _}a(f,"t"),t(f,"arrayToJSON"),d.arrayToJSON=f,d.isReservedId=t(function(y,b){if(y){for(var _=0;_<y.length;++_)if(typeof y[_]!="string"&&y[_][0]<=b&&y[_][1]>=b)return!0}return!1},"isReservedId"),d.isReservedName=t(function(y,b){if(y){for(var _=0;_<y.length;++_)if(y[_]===b)return!0}return!1},"isReservedName");function d(y,b){o.call(this,y,b),this.nested=s,this._nestedArray=null}a(d,"r"),t(d,"Namespace");function m(y){return y._nestedArray=null,y}a(m,"e"),t(m,"clearCache"),Object.defineProperty(d.prototype,"nestedArray",{get:t(function(){return this._nestedArray||(this._nestedArray=l.toArray(this.nested))},"get")}),d.prototype.toJSON=t(function(y){return l.toObject(["options",this.options,"nested",f(this.nestedArray,y)])},"toJSON"),d.prototype.addJSON=t(function(y){var b=this;if(y)for(var _=Object.keys(y),w=0,S;w<_.length;++w)S=y[_[w]],b.add((S.fields!==s?g.fromJSON:S.values!==s?u.fromJSON:S.methods!==s?p.fromJSON:S.id!==s?h.fromJSON:d.fromJSON)(_[w],S));return this},"addJSON"),d.prototype.get=t(function(y){return this.nested&&this.nested[y]||null},"get"),d.prototype.getEnum=t(function(y){if(this.nested&&this.nested[y]instanceof u)return this.nested[y].values;throw Error("no such enum: "+y)},"getEnum"),d.prototype.add=t(function(y){if(!(y instanceof h&&y.extend!==s||y instanceof g||y instanceof u||y instanceof p||y instanceof d))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var b=this.get(y.name);if(b)if(b instanceof d&&y instanceof d&&!(b instanceof g||b instanceof p)){for(var _=b.nestedArray,w=0;w<_.length;++w)y.add(_[w]);this.remove(b),this.nested||(this.nested={}),y.setOptions(b.options,!0)}else throw Error("duplicate name '"+y.name+"' in "+this)}return this.nested[y.name]=y,y.onAdd(this),m(this)},"add"),d.prototype.remove=t(function(y){if(!(y instanceof o))throw TypeError("object must be a ReflectionObject");if(y.parent!==this)throw Error(y+" is not a member of "+this);return delete this.nested[y.name],Object.keys(this.nested).length||(this.nested=s),y.onRemove(this),m(this)},"remove"),d.prototype.define=t(function(y,b){if(l.isString(y))y=y.split(".");else if(!Array.isArray(y))throw TypeError("illegal path");if(y&&y.length&&y[0]==="")throw Error("path must be relative");for(var _=this;y.length>0;){var w=y.shift();if(_.nested&&_.nested[w]){if(_=_.nested[w],!(_ instanceof d))throw Error("path conflicts with non-namespace objects")}else _.add(_=new d(w))}return b&&_.addJSON(b),_},"define"),d.prototype.resolveAll=t(function(){for(var y=this.nestedArray,b=0;b<y.length;)y[b]instanceof d?y[b++].resolveAll():y[b++].resolve();return this.resolve()},"resolveAll"),d.prototype.lookup=t(function(y,b,_){if(typeof b=="boolean"?(_=b,b=s):b&&!Array.isArray(b)&&(b=[b]),l.isString(y)&&y.length){if(y===".")return this.root;y=y.split(".")}else if(!y.length)return this;if(y[0]==="")return this.root.lookup(y.slice(1),b);var w=this.get(y[0]);if(w){if(y.length===1){if(!b||b.indexOf(w.constructor)>-1)return w}else if(w instanceof d&&(w=w.lookup(y.slice(1),b,!0)))return w}else for(var S=0;S<this.nestedArray.length;++S)if(this._nestedArray[S]instanceof d&&(w=this._nestedArray[S].lookup(y,b,!0)))return w;return this.parent===null||_?null:this.parent.lookup(y,b)},"lookup"),d.prototype.lookupType=t(function(y){var b=this.lookup(y,[g]);if(!b)throw Error("no such type: "+y);return b},"lookupType"),d.prototype.lookupEnum=t(function(y){var b=this.lookup(y,[u]);if(!b)throw Error("no such Enum '"+y+"' in "+this);return b},"lookupEnum"),d.prototype.lookupTypeOrEnum=t(function(y){var b=this.lookup(y,[g,u]);if(!b)throw Error("no such Type or Enum '"+y+"' in "+this);return b},"lookupTypeOrEnum"),d.prototype.lookupService=t(function(y){var b=this.lookup(y,[p]);if(!b)throw Error("no such Service '"+y+"' in "+this);return b},"lookupService"),d._configure=function(y,b){g=y,p=b}},{15:15,16:16,24:24,37:37}],24:[function(n,i,c){i.exports=h,h.className="ReflectionObject";var o=n(37),u;function h(l,g){if(!o.isString(l))throw TypeError("name must be a string");if(g&&!o.isObject(g))throw TypeError("options must be an object");this.options=g,this.name=l,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}a(h,"c"),t(h,"ReflectionObject"),Object.defineProperties(h.prototype,{root:{get:t(function(){for(var l=this;l.parent!==null;)l=l.parent;return l},"get")},fullName:{get:t(function(){for(var l=[this.name],g=this.parent;g;)l.unshift(g.name),g=g.parent;return l.join(".")},"get")}}),h.prototype.toJSON=t(function(){throw Error()},"toJSON"),h.prototype.onAdd=t(function(l){this.parent&&this.parent!==l&&this.parent.remove(this),this.parent=l,this.resolved=!1;var g=l.root;g instanceof u&&g._handleAdd(this)},"onAdd"),h.prototype.onRemove=t(function(l){var g=l.root;g instanceof u&&g._handleRemove(this),this.parent=null,this.resolved=!1},"onRemove"),h.prototype.resolve=t(function(){return this.resolved?this:(this.root instanceof u&&(this.resolved=!0),this)},"resolve"),h.prototype.getOption=t(function(l){return this.options?this.options[l]:s},"getOption"),h.prototype.setOption=t(function(l,g,p){return(!p||!this.options||this.options[l]===s)&&((this.options||(this.options={}))[l]=g),this},"setOption"),h.prototype.setOptions=t(function(l,g){if(l)for(var p=Object.keys(l),f=0;f<p.length;++f)this.setOption(p[f],l[p[f]],g);return this},"setOptions"),h.prototype.toString=t(function(){var l=this.constructor.className,g=this.fullName;return g.length?l+" "+g:l},"toString"),h._configure=function(l){u=l}},{37:37}],25:[function(n,i,c){i.exports=l;var o=n(24);((l.prototype=Object.create(o.prototype)).constructor=l).className="OneOf";var u=n(16),h=n(37);function l(p,f,d,m){if(Array.isArray(f)||(d=f,f=s),o.call(this,p,d),!(f===s||Array.isArray(f)))throw TypeError("fieldNames must be an Array");this.oneof=f||[],this.fieldsArray=[],this.comment=m}a(l,"u"),t(l,"OneOf"),l.fromJSON=t(function(p,f){return new l(p,f.oneof,f.options,f.comment)},"fromJSON"),l.prototype.toJSON=t(function(p){var f=p?!!p.keepComments:!1;return h.toObject(["options",this.options,"oneof",this.oneof,"comment",f?this.comment:s])},"toJSON");function g(p){if(p.parent)for(var f=0;f<p.fieldsArray.length;++f)p.fieldsArray[f].parent||p.parent.add(p.fieldsArray[f])}a(g,"a"),t(g,"addFieldsToParent"),l.prototype.add=t(function(p){if(!(p instanceof u))throw TypeError("field must be a Field");return p.parent&&p.parent!==this.parent&&p.parent.remove(p),this.oneof.push(p.name),this.fieldsArray.push(p),p.partOf=this,g(this),this},"add"),l.prototype.remove=t(function(p){if(!(p instanceof u))throw TypeError("field must be a Field");var f=this.fieldsArray.indexOf(p);if(f<0)throw Error(p+" is not a member of "+this);return this.fieldsArray.splice(f,1),f=this.oneof.indexOf(p.name),f>-1&&this.oneof.splice(f,1),p.partOf=null,this},"remove"),l.prototype.onAdd=t(function(p){o.prototype.onAdd.call(this,p);for(var f=this,d=0;d<this.oneof.length;++d){var m=p.get(this.oneof[d]);m&&!m.partOf&&(m.partOf=f,f.fieldsArray.push(m))}g(this)},"onAdd"),l.prototype.onRemove=t(function(p){for(var f=0,d;f<this.fieldsArray.length;++f)(d=this.fieldsArray[f]).parent&&d.parent.remove(d);o.prototype.onRemove.call(this,p)},"onRemove"),l.d=t(function(){for(var p=new Array(arguments.length),f=0;f<arguments.length;)p[f]=arguments[f++];return t(function(d,m){h.decorateType(d.constructor).add(new l(m,p)),Object.defineProperty(d,m,{get:h.oneOfGetter(p),set:h.oneOfSetter(p)})},"oneOfDecorator")},"decorateOneOf")},{16:16,24:24,37:37}],26:[function(n,i,c){i.exports=U,U.filename=null,U.defaults={keepCase:!1};var o=n(34),u=n(29),h=n(35),l=n(16),g=n(20),p=n(25),f=n(15),d=n(33),m=n(22),y=n(36),b=n(37),_=/^[1-9][0-9]*$/,w=/^-?[1-9][0-9]*$/,S=/^0[x][0-9a-fA-F]+$/,T=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,I=/^-?0[0-7]+$/,E=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,k=/^[a-zA-Z_][a-zA-Z_0-9]*$/,D=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,B=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function U(oe,_e,G){_e instanceof u||(G=_e,_e=new u),G||(G=U.defaults);var X=o(oe,G.alternateCommentMode||!1),W=X.next,ce=X.push,ue=X.peek,j=X.skip,ge=X.cmnt,Le=!0,We,Z,ae,me,Se=!1,De=_e,$e=G.keepCase?function(N){return N}:b.camelCase;function Y(N,C,L){var $=U.filename;return L||(U.filename=null),Error("illegal "+(C||"token")+" '"+N+"' ("+($?$+", ":"")+"line "+X.line+")")}a(Y,"F"),t(Y,"illegal");function ot(){var N=[],C;do{if((C=W())!=='"'&&C!=="'")throw Y(C);N.push(W()),j(C),C=ue()}while(C==='"'||C==="'");return N.join("")}a(ot,"Y"),t(ot,"readString");function $n(N){var C=W();switch(C){case"'":case'"':return ce(C),ot();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return wc(C,!0)}catch{if(N&&D.test(C))return C;throw Y(C,"value")}}a($n,"ht"),t($n,"readValue");function fs(N,C){var L,$;do C&&((L=ue())==='"'||L==="'")?N.push(ot()):N.push([$=Nt(W()),j("to",!0)?Nt(W()):$]);while(j(",",!0));j(";")}a(fs,"ot"),t(fs,"readRanges");function wc(N,C){var L=1;switch(N.charAt(0)==="-"&&(L=-1,N=N.substring(1)),N){case"inf":case"INF":case"Inf":return L*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(_.test(N))return L*parseInt(N,10);if(S.test(N))return L*parseInt(N,16);if(v.test(N))return L*parseInt(N,8);if(E.test(N))return L*parseFloat(N);throw Y(N,"number",C)}a(wc,"pt"),t(wc,"parseNumber");function Nt(N,C){switch(N){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!C&&N.charAt(0)==="-")throw Y(N,"id");if(w.test(N))return parseInt(N,10);if(T.test(N))return parseInt(N,16);if(I.test(N))return parseInt(N,8);throw Y(N,"id")}a(Nt,"nt"),t(Nt,"parseId");function Sc(){if(We!==s)throw Y("package");if(We=W(),!D.test(We))throw Y(We,"name");De=De.define(We),j(";")}a(Sc,"dt"),t(Sc,"parsePackage");function vc(){var N=ue(),C;switch(N){case"weak":C=ae||(ae=[]),W();break;case"public":W();default:C=Z||(Z=[]);break}N=ot(),j(";"),C.push(N)}a(vc,"yt"),t(vc,"parseImport");function Ec(){if(j("="),me=ot(),Se=me==="proto3",!Se&&me!=="proto2")throw Y(me,"syntax");j(";")}a(Ec,"mt"),t(Ec,"parseSyntax");function ps(N,C){switch(C){case"option":return rt(N,C),j(";"),!0;case"message":return Oc(N,C),!0;case"enum":return Ac(N,C),!0;case"service":return Cc(N,C),!0;case"extend":return Dc(N,C),!0}return!1}a(ps,"at"),t(ps,"parseCommon");function tt(N,C,L){var $=X.line;if(N&&(N.comment=ge(),N.filename=U.filename),j("{",!0)){for(var ye;(ye=W())!=="}";)C(ye);j(";",!0)}else L&&L(),j(";"),N&&typeof N.comment!="string"&&(N.comment=ge($))}a(tt,"K"),t(tt,"ifBlock");function Oc(N,C){if(!k.test(C=W()))throw Y(C,"type name");var L=new h(C);tt(L,t(function($){if(!ps(L,$))switch($){case"map":kc(L);break;case"required":case"optional":case"repeated":Dt(L,$);break;case"oneof":Ic(L,$);break;case"extensions":fs(L.extensions||(L.extensions=[]));break;case"reserved":fs(L.reserved||(L.reserved=[]),!0);break;default:if(!Se||!D.test($))throw Y($);ce($),Dt(L,"optional");break}},"parseType_block")),N.add(L)}a(Oc,"vt"),t(Oc,"parseType");function Dt(N,C,L){var $=W();if($==="group"){Tc(N,C);return}if(!D.test($))throw Y($,"type");var ye=W();if(!k.test(ye))throw Y(ye,"name");ye=$e(ye),j("=");var ve=new l(ye,Nt(W()),$,C,L);tt(ve,t(function(ft){if(ft==="option")rt(ve,ft),j(";");else throw Y(ft)},"parseField_block"),t(function(){ms(ve)},"parseField_line")),N.add(ve),!Se&&ve.repeated&&(y.packed[$]!==s||y.basic[$]===s)&&ve.setOption("packed",!1,!0)}a(Dt,"st"),t(Dt,"parseField");function Tc(N,C){var L=W();if(!k.test(L))throw Y(L,"name");var $=b.lcFirst(L);L===$&&(L=b.ucFirst(L)),j("=");var ye=Nt(W()),ve=new h(L);ve.group=!0;var ft=new l($,ye,L,C);ft.filename=U.filename,tt(ve,t(function(Mt){switch(Mt){case"option":rt(ve,Mt),j(";");break;case"required":case"optional":case"repeated":Dt(ve,Mt);break;default:throw Y(Mt)}},"parseGroup_block")),N.add(ve).add(ft)}a(Tc,"gt"),t(Tc,"parseGroup");function kc(N){j("<");var C=W();if(y.mapKey[C]===s)throw Y(C,"type");j(",");var L=W();if(!D.test(L))throw Y(L,"type");j(">");var $=W();if(!k.test($))throw Y($,"name");j("=");var ye=new g($e($),Nt(W()),C,L);tt(ye,t(function(ve){if(ve==="option")rt(ye,ve),j(";");else throw Y(ve)},"parseMapField_block"),t(function(){ms(ye)},"parseMapField_line")),N.add(ye)}a(kc,"wt"),t(kc,"parseMapField");function Ic(N,C){if(!k.test(C=W()))throw Y(C,"name");var L=new p($e(C));tt(L,t(function($){$==="option"?(rt(L,$),j(";")):(ce($),Dt(L,"optional"))},"parseOneOf_block")),N.add(L)}a(Ic,"Ot"),t(Ic,"parseOneOf");function Ac(N,C){if(!k.test(C=W()))throw Y(C,"name");var L=new f(C);tt(L,t(function($){switch($){case"option":rt(L,$),j(";");break;case"reserved":fs(L.reserved||(L.reserved=[]),!0);break;default:Rc(L,$)}},"parseEnum_block")),N.add(L)}a(Ac,"bt"),t(Ac,"parseEnum");function Rc(N,C){if(!k.test(C))throw Y(C,"name");j("=");var L=Nt(W(),!0),$={};tt($,t(function(ye){if(ye==="option")rt($,ye),j(";");else throw Y(ye)},"parseEnumValue_block"),t(function(){ms($)},"parseEnumValue_line")),N.add(C,L,$.comment)}a(Rc,"_t"),t(Rc,"parseEnumValue");function rt(N,C){var L=j("(",!0);if(!D.test(C=W()))throw Y(C,"name");var $=C;L&&(j(")"),$="("+$+")",C=ue(),B.test(C)&&($+=C,W())),j("="),gs(N,$)}a(rt,"Q"),t(rt,"parseOption");function gs(N,C){if(j("{",!0))do{if(!k.test(je=W()))throw Y(je,"name");ue()==="{"?gs(N,C+"."+je):(j(":"),ue()==="{"?gs(N,C+"."+je):jn(N,C+"."+je,$n(!0)))}while(!j("}",!0));else jn(N,C,$n(!0))}a(gs,"ut"),t(gs,"parseOptionValue");function jn(N,C,L){N.setOption&&N.setOption(C,L)}a(jn,"ct"),t(jn,"setOption");function ms(N){if(j("[",!0)){do rt(N,"option");while(j(",",!0));j("]")}return N}a(ms,"ft"),t(ms,"parseInlineOptions");function Cc(N,C){if(!k.test(C=W()))throw Y(C,"service name");var L=new d(C);tt(L,t(function($){if(!ps(L,$))if($==="rpc")Nc(L,$);else throw Y($)},"parseService_block")),N.add(L)}a(Cc,"xt"),t(Cc,"parseService");function Nc(N,C){var L=C;if(!k.test(C=W()))throw Y(C,"name");var $=C,ye,ve,ft,Mt;if(j("("),j("stream",!0)&&(ve=!0),!D.test(C=W())||(ye=C,j(")"),j("returns"),j("("),j("stream",!0)&&(Mt=!0),!D.test(C=W())))throw Y(C);ft=C,j(")");var Bn=new m($,L,ye,ft,ve,Mt);tt(Bn,t(function(Un){if(Un==="option")rt(Bn,Un),j(";");else throw Y(Un)},"parseMethod_block")),N.add(Bn)}a(Nc,"At"),t(Nc,"parseMethod");function Dc(N,C){if(!D.test(C=W()))throw Y(C,"reference");var L=C;tt(null,t(function($){switch($){case"required":case"repeated":case"optional":Dt(N,$,L);break;default:if(!Se||!D.test($))throw Y($);ce($),Dt(N,"optional",L);break}},"parseExtension_block"))}a(Dc,"St"),t(Dc,"parseExtension");for(var je;(je=W())!==null;)switch(je){case"package":if(!Le)throw Y(je);Sc();break;case"import":if(!Le)throw Y(je);vc();break;case"syntax":if(!Le)throw Y(je);Ec();break;case"option":if(!Le)throw Y(je);rt(De,je),j(";");break;default:if(ps(De,je)){Le=!1;continue}throw Y(je)}return U.filename=null,{package:We,imports:Z,weakImports:ae,syntax:me,root:_e}}a(U,"T"),t(U,"parse")},{15:15,16:16,20:20,22:22,25:25,29:29,33:33,34:34,35:35,36:36,37:37}],27:[function(n,i,c){i.exports=p;var o=n(39),u,h=o.LongBits,l=o.utf8;function g(b,_){return RangeError("index out of range: "+b.pos+" + "+(_||1)+" > "+b.len)}a(g,"a"),t(g,"indexOutOfRange");function p(b){this.buf=b,this.pos=0,this.len=b.length}a(p,"s"),t(p,"Reader");var f=typeof Uint8Array<"u"?t(function(b){if(b instanceof Uint8Array||Array.isArray(b))return new p(b);throw Error("illegal buffer")},"create_typed_array"):t(function(b){if(Array.isArray(b))return new p(b);throw Error("illegal buffer")},"create_array");p.create=o.Buffer?t(function(b){return(p.create=t(function(_){return o.Buffer.isBuffer(_)?new u(_):f(_)},"create_buffer"))(b)},"create_buffer_setup"):f,p.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,p.prototype.uint32=t((function(){var b=4294967295;return t(function(){if(b=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(b=(b|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(b=(b|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(b=(b|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(b=(b|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return b;if((this.pos+=5)>this.len)throw this.pos=this.len,g(this,10);return b},"read_uint32")}),"read_uint32_setup")(),p.prototype.int32=t(function(){return this.uint32()|0},"read_int32"),p.prototype.sint32=t(function(){var b=this.uint32();return b>>>1^-(b&1)|0},"read_sint32");function d(){var b=new h(0,0),_=0;if(this.len-this.pos>4){for(;_<4;++_)if(b.lo=(b.lo|(this.buf[this.pos]&127)<<_*7)>>>0,this.buf[this.pos++]<128)return b;if(b.lo=(b.lo|(this.buf[this.pos]&127)<<28)>>>0,b.hi=(b.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return b;_=0}else{for(;_<3;++_){if(this.pos>=this.len)throw g(this);if(b.lo=(b.lo|(this.buf[this.pos]&127)<<_*7)>>>0,this.buf[this.pos++]<128)return b}return b.lo=(b.lo|(this.buf[this.pos++]&127)<<_*7)>>>0,b}if(this.len-this.pos>4){for(;_<5;++_)if(b.hi=(b.hi|(this.buf[this.pos]&127)<<_*7+3)>>>0,this.buf[this.pos++]<128)return b}else for(;_<5;++_){if(this.pos>=this.len)throw g(this);if(b.hi=(b.hi|(this.buf[this.pos]&127)<<_*7+3)>>>0,this.buf[this.pos++]<128)return b}throw Error("invalid varint encoding")}a(d,"r"),t(d,"readLongVarint"),p.prototype.bool=t(function(){return this.uint32()!==0},"read_bool");function m(b,_){return(b[_-4]|b[_-3]<<8|b[_-2]<<16|b[_-1]<<24)>>>0}a(m,"e"),t(m,"readFixed32_end"),p.prototype.fixed32=t(function(){if(this.pos+4>this.len)throw g(this,4);return m(this.buf,this.pos+=4)},"read_fixed32"),p.prototype.sfixed32=t(function(){if(this.pos+4>this.len)throw g(this,4);return m(this.buf,this.pos+=4)|0},"read_sfixed32");function y(){if(this.pos+8>this.len)throw g(this,8);return new h(m(this.buf,this.pos+=4),m(this.buf,this.pos+=4))}a(y,"f"),t(y,"readFixed64"),p.prototype.float=t(function(){if(this.pos+4>this.len)throw g(this,4);var b=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,b},"read_float"),p.prototype.double=t(function(){if(this.pos+8>this.len)throw g(this,4);var b=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,b},"read_double"),p.prototype.bytes=t(function(){var b=this.uint32(),_=this.pos,w=this.pos+b;if(w>this.len)throw g(this,b);return this.pos+=b,Array.isArray(this.buf)?this.buf.slice(_,w):_===w?new this.buf.constructor(0):this._slice.call(this.buf,_,w)},"read_bytes"),p.prototype.string=t(function(){var b=this.bytes();return l.read(b,0,b.length)},"read_string"),p.prototype.skip=t(function(b){if(typeof b=="number"){if(this.pos+b>this.len)throw g(this,b);this.pos+=b}else do if(this.pos>=this.len)throw g(this);while(this.buf[this.pos++]&128);return this},"skip"),p.prototype.skipType=function(b){switch(b){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:do{if((b=this.uint32()&7)===4)break;this.skipType(b)}while(!0);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+b+" at offset "+this.pos)}return this},p._configure=function(b){u=b;var _=o.Long?"toLong":"toNumber";o.merge(p.prototype,{int64:t(function(){return d.call(this)[_](!1)},"read_int64"),uint64:t(function(){return d.call(this)[_](!0)},"read_uint64"),sint64:t(function(){return d.call(this).zzDecode()[_](!1)},"read_sint64"),fixed64:t(function(){return y.call(this)[_](!0)},"read_fixed64"),sfixed64:t(function(){return y.call(this)[_](!1)},"read_sfixed64")})}},{39:39}],28:[function(n,i,c){i.exports=h;var o=n(27);(h.prototype=Object.create(o.prototype)).constructor=h;var u=n(39);function h(l){o.call(this,l)}a(h,"c"),t(h,"BufferReader"),u.Buffer&&(h.prototype._slice=u.Buffer.prototype.slice),h.prototype.string=t(function(){var l=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+l,this.len))},"read_string_buffer")},{27:27,39:39}],29:[function(n,i,c){i.exports=m;var o=n(23);((m.prototype=Object.create(o.prototype)).constructor=m).className="Root";var u=n(16),h=n(15),l=n(25),g=n(37),p,f,d;function m(w){o.call(this,"",w),this.deferred=[],this.files=[]}a(m,"e"),t(m,"Root"),m.fromJSON=t(function(w,S){return S||(S=new m),w.options&&S.setOptions(w.options),S.addJSON(w.nested)},"fromJSON"),m.prototype.resolvePath=g.path.resolve;function y(){}a(y,"f"),t(y,"SYNC"),m.prototype.load=t(a(function w(S,T,v){typeof T=="function"&&(v=T,T=s);var I=this;if(!v)return g.asPromise(w,I,S,T);var E=v===y;function k(G,X){if(v){var W=v;if(v=null,E)throw G;W(G,X)}}a(k,"g"),t(k,"finish");function D(G,X){try{if(g.isString(X)&&X.charAt(0)==="{"&&(X=JSON.parse(X)),!g.isString(X))I.setOptions(X.options).addJSON(X.nested);else{f.filename=G;var W=f(X,I,T),ce,ue=0;if(W.imports)for(;ue<W.imports.length;++ue)(ce=I.resolvePath(G,W.imports[ue]))&&B(ce);if(W.weakImports)for(ue=0;ue<W.weakImports.length;++ue)(ce=I.resolvePath(G,W.weakImports[ue]))&&B(ce,!0)}}catch(j){k(j)}!E&&!U&&k(null,I)}a(D,"_"),t(D,"process");function B(G,X){var W=G.lastIndexOf("google/protobuf/");if(W>-1){var ce=G.substring(W);ce in d&&(G=ce)}if(!(I.files.indexOf(G)>-1)){if(I.files.push(G),G in d){E?D(G,d[G]):(++U,setTimeout(function(){--U,D(G,d[G])}));return}if(E){var ue;try{ue=g.fs.readFileSync(G).toString("utf8")}catch(j){X||k(j);return}D(G,ue)}else++U,g.fetch(G,function(j,ge){if(--U,!!v){if(j){X?U||k(null,I):k(j);return}D(G,ge)}})}}a(B,"D"),t(B,"fetch");var U=0;g.isString(S)&&(S=[S]);for(var oe=0,_e;oe<S.length;++oe)(_e=I.resolvePath("",S[oe]))&&B(_e);return E?I:(U||k(null,I),s)},"p"),"load"),m.prototype.loadSync=t(function(w,S){if(!g.isNode)throw Error("not supported");return this.load(w,S,y)},"loadSync"),m.prototype.resolveAll=t(function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(w){return"'extend "+w.extend+"' in "+w.parent.fullName}).join(", "));return o.prototype.resolveAll.call(this)},"resolveAll");var b=/^[A-Z]/;function _(w,S){var T=S.parent.lookup(S.extend);if(T){var v=new u(S.fullName,S.id,S.type,S.rule,s,S.options);return v.declaringField=S,S.extensionField=v,T.add(v),!0}return!1}a(_,"o"),t(_,"tryHandleExtension"),m.prototype._handleAdd=t(function(w){if(w instanceof u)w.extend!==s&&!w.extensionField&&(_(this,w)||this.deferred.push(w));else if(w instanceof h)b.test(w.name)&&(w.parent[w.name]=w.values);else if(!(w instanceof l)){if(w instanceof p)for(var S=0;S<this.deferred.length;)_(this,this.deferred[S])?this.deferred.splice(S,1):++S;for(var T=0;T<w.nestedArray.length;++T)this._handleAdd(w._nestedArray[T]);b.test(w.name)&&(w.parent[w.name]=w)}},"_handleAdd"),m.prototype._handleRemove=t(function(w){if(w instanceof u){if(w.extend!==s)if(w.extensionField)w.extensionField.parent.remove(w.extensionField),w.extensionField=null;else{var S=this.deferred.indexOf(w);S>-1&&this.deferred.splice(S,1)}}else if(w instanceof h)b.test(w.name)&&delete w.parent[w.name];else if(w instanceof o){for(var T=0;T<w.nestedArray.length;++T)this._handleRemove(w._nestedArray[T]);b.test(w.name)&&delete w.parent[w.name]}},"_handleRemove"),m._configure=function(w,S,T){p=w,f=S,d=T}},{15:15,16:16,23:23,25:25,37:37}],30:[function(n,i,c){i.exports={}},{}],31:[function(n,i,c){var o=c;o.Service=n(32)},{32:32}],32:[function(n,i,c){i.exports=u;var o=n(39);(u.prototype=Object.create(o.EventEmitter.prototype)).constructor=u;function u(h,l,g){if(typeof h!="function")throw TypeError("rpcImpl must be a function");o.EventEmitter.call(this),this.rpcImpl=h,this.requestDelimited=!!l,this.responseDelimited=!!g}a(u,"d"),t(u,"Service"),u.prototype.rpcCall=t(a(function h(l,g,p,f,d){if(!f)throw TypeError("request must be specified");var m=this;if(!d)return o.asPromise(h,m,l,g,p,f);if(!m.rpcImpl)return setTimeout(function(){d(Error("already ended"))},0),s;try{return m.rpcImpl(l,g[m.requestDelimited?"encodeDelimited":"encode"](f).finish(),t(function(y,b){if(y)return m.emit("error",y,l),d(y);if(b===null)return m.end(!0),s;if(!(b instanceof p))try{b=p[m.responseDelimited?"decodeDelimited":"decode"](b)}catch(_){return m.emit("error",_,l),d(_)}return m.emit("data",b,l),d(null,b)},"rpcCallback"))}catch(y){return m.emit("error",y,l),setTimeout(function(){d(y)},0),s}},"c"),"rpcCall"),u.prototype.end=t(function(h){return this.rpcImpl&&(h||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},"end")},{39:39}],33:[function(n,i,c){i.exports=g;var o=n(23);((g.prototype=Object.create(o.prototype)).constructor=g).className="Service";var u=n(22),h=n(37),l=n(31);function g(f,d){o.call(this,f,d),this.methods={},this._methodsArray=null}a(g,"a"),t(g,"Service"),g.fromJSON=t(function(f,d){var m=new g(f,d.options);if(d.methods)for(var y=Object.keys(d.methods),b=0;b<y.length;++b)m.add(u.fromJSON(y[b],d.methods[y[b]]));return d.nested&&m.addJSON(d.nested),m.comment=d.comment,m},"fromJSON"),g.prototype.toJSON=t(function(f){var d=o.prototype.toJSON.call(this,f),m=f?!!f.keepComments:!1;return h.toObject(["options",d&&d.options||s,"methods",o.arrayToJSON(this.methodsArray,f)||{},"nested",d&&d.nested||s,"comment",m?this.comment:s])},"toJSON"),Object.defineProperty(g.prototype,"methodsArray",{get:t(function(){return this._methodsArray||(this._methodsArray=h.toArray(this.methods))},"get")});function p(f){return f._methodsArray=null,f}a(p,"s"),t(p,"clearCache"),g.prototype.get=t(function(f){return this.methods[f]||o.prototype.get.call(this,f)},"get"),g.prototype.resolveAll=t(function(){for(var f=this.methodsArray,d=0;d<f.length;++d)f[d].resolve();return o.prototype.resolve.call(this)},"resolveAll"),g.prototype.add=t(function(f){if(this.get(f.name))throw Error("duplicate name '"+f.name+"' in "+this);return f instanceof u?(this.methods[f.name]=f,f.parent=this,p(this)):o.prototype.add.call(this,f)},"add"),g.prototype.remove=t(function(f){if(f instanceof u){if(this.methods[f.name]!==f)throw Error(f+" is not a member of "+this);return delete this.methods[f.name],f.parent=null,p(this)}return o.prototype.remove.call(this,f)},"remove"),g.prototype.create=t(function(f,d,m){for(var y=new l.Service(f,d,m),b=0,_;b<this.methodsArray.length;++b){var w=h.lcFirst((_=this._methodsArray[b]).resolve().name).replace(/[^$\w_]/g,"");y[w]=h.codegen(["r","c"],h.isReserved(w)?w+"_":w)("return this.rpcCall(m,q,s,r,c)")({m:_,q:_.resolvedRequestType.ctor,s:_.resolvedResponseType.ctor})}return y},"create")},{22:22,23:23,31:31,37:37}],34:[function(n,i,c){i.exports=b;var o=/[\s{}=;:[\],'"()<>]/g,u=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,h=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,l=/^ *[*/]+ */,g=/^\s*\*?\/*/,p=/\n/g,f=/\s/,d=/\\(.?)/g,m={0:"\0",r:"\r",n:`
|
|
63
|
-
`,t:" "};function y(_){return _.replace(
|
|
64
|
-
`){
|
|
65
|
-
`).trim()}a(
|
|
66
|
-
`;)
|
|
67
|
-
`&&++v,++S===T)return null;if(
|
|
68
|
-
`;)if(S===T)return null;++S,
|
|
69
|
-
`&&++v,++S===T)throw oe("comment");ae=me,me=G(S)}while(ae!=="*"||me!=="/");++S,De&&X(Se,S-2),Z=!0}else return"/"}}while(Z);var $e=S;o.lastIndex=0;var Y=o.test(G($e++));if(!Y)for(;$e<T&&!o.test(G($e));)++$e;var ot=_.substring(S,S=$e);return(ot==='"'||ot==="'")&&(U=ot),ot}a(ue,"P"),t(ue,"next");function j(Z){B.push(Z)}a(j,"N"),t(j,"push");function ge(){if(!B.length){var Z=ue();if(Z===null)return null;j(Z)}return B[0]}a(ge,"q"),t(ge,"peek");function Le(Z,ae){var me=ge(),Se=me===Z;if(Se)return ue(),!0;if(!ae)throw oe("token '"+me+"', '"+Z+"' expected");return!1}a(Le,"rt"),t(Le,"skip");function We(Z){var ae=null;return Z===s?k===v-1&&(w||I==="*"||D)&&(ae=E):(k<Z&&ge(),k===Z&&!D&&(w||I==="/")&&(ae=E)),ae}return a(We,"tt"),t(We,"cmnt"),Object.defineProperty({next:ue,peek:ge,push:j,skip:Le,cmnt:We},"line",{get:t(function(){return v},"get")})}a(b,"n"),t(b,"tokenize")},{}],35:[function(n,i,c){i.exports=v;var o=n(23);((v.prototype=Object.create(o.prototype)).constructor=v).className="Type";var u=n(15),h=n(25),l=n(16),g=n(20),p=n(33),f=n(21),d=n(27),m=n(42),y=n(37),b=n(14),_=n(13),w=n(40),S=n(12),T=n(41);function v(E,k){o.call(this,E,k),this.fields={},this.oneofs=s,this.extensions=s,this.reserved=s,this.group=s,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}a(v,"m"),t(v,"Type"),Object.defineProperties(v.prototype,{fieldsById:{get:t(function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var E=Object.keys(this.fields),k=0;k<E.length;++k){var D=this.fields[E[k]],B=D.id;if(this._fieldsById[B])throw Error("duplicate id "+B+" in "+this);this._fieldsById[B]=D}return this._fieldsById},"get")},fieldsArray:{get:t(function(){return this._fieldsArray||(this._fieldsArray=y.toArray(this.fields))},"get")},oneofsArray:{get:t(function(){return this._oneofsArray||(this._oneofsArray=y.toArray(this.oneofs))},"get")},ctor:{get:t(function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},"get"),set:t(function(E){var k=E.prototype;k instanceof f||((E.prototype=new f).constructor=E,y.merge(E.prototype,k)),E.$type=E.prototype.$type=this,y.merge(E,f,!0),this._ctor=E;for(var D=0;D<this.fieldsArray.length;++D)this._fieldsArray[D].resolve();var B={};for(D=0;D<this.oneofsArray.length;++D)B[this._oneofsArray[D].resolve().name]={get:y.oneOfGetter(this._oneofsArray[D].oneof),set:y.oneOfSetter(this._oneofsArray[D].oneof)};D&&Object.defineProperties(E.prototype,B)},"set")}}),v.generateConstructor=t(function(E){for(var k=y.codegen(["p"],E.name),D=0,B;D<E.fieldsArray.length;++D)(B=E._fieldsArray[D]).map?k("this%s={}",y.safeProp(B.name)):B.repeated&&k("this%s=[]",y.safeProp(B.name));return k("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},"generateConstructor");function I(E){return E._fieldsById=E._fieldsArray=E._oneofsArray=null,delete E.encode,delete E.decode,delete E.verify,E}a(I,"w"),t(I,"clearCache"),v.fromJSON=t(function(E,k){var D=new v(E,k.options);D.extensions=k.extensions,D.reserved=k.reserved;for(var B=Object.keys(k.fields),U=0;U<B.length;++U)D.add((typeof k.fields[B[U]].keyType<"u"?g.fromJSON:l.fromJSON)(B[U],k.fields[B[U]]));if(k.oneofs)for(B=Object.keys(k.oneofs),U=0;U<B.length;++U)D.add(h.fromJSON(B[U],k.oneofs[B[U]]));if(k.nested)for(B=Object.keys(k.nested),U=0;U<B.length;++U){var oe=k.nested[B[U]];D.add((oe.id!==s?l.fromJSON:oe.fields!==s?v.fromJSON:oe.values!==s?u.fromJSON:oe.methods!==s?p.fromJSON:o.fromJSON)(B[U],oe))}return k.extensions&&k.extensions.length&&(D.extensions=k.extensions),k.reserved&&k.reserved.length&&(D.reserved=k.reserved),k.group&&(D.group=!0),k.comment&&(D.comment=k.comment),D},"fromJSON"),v.prototype.toJSON=t(function(E){var k=o.prototype.toJSON.call(this,E),D=E?!!E.keepComments:!1;return y.toObject(["options",k&&k.options||s,"oneofs",o.arrayToJSON(this.oneofsArray,E),"fields",o.arrayToJSON(this.fieldsArray.filter(function(B){return!B.declaringField}),E)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:s,"reserved",this.reserved&&this.reserved.length?this.reserved:s,"group",this.group||s,"nested",k&&k.nested||s,"comment",D?this.comment:s])},"toJSON"),v.prototype.resolveAll=t(function(){for(var E=this.fieldsArray,k=0;k<E.length;)E[k++].resolve();var D=this.oneofsArray;for(k=0;k<D.length;)D[k++].resolve();return o.prototype.resolveAll.call(this)},"resolveAll"),v.prototype.get=t(function(E){return this.fields[E]||this.oneofs&&this.oneofs[E]||this.nested&&this.nested[E]||null},"get"),v.prototype.add=t(function(E){if(this.get(E.name))throw Error("duplicate name '"+E.name+"' in "+this);if(E instanceof l&&E.extend===s){if(this._fieldsById?this._fieldsById[E.id]:this.fieldsById[E.id])throw Error("duplicate id "+E.id+" in "+this);if(this.isReservedId(E.id))throw Error("id "+E.id+" is reserved in "+this);if(this.isReservedName(E.name))throw Error("name '"+E.name+"' is reserved in "+this);return E.parent&&E.parent.remove(E),this.fields[E.name]=E,E.message=this,E.onAdd(this),I(this)}return E instanceof h?(this.oneofs||(this.oneofs={}),this.oneofs[E.name]=E,E.onAdd(this),I(this)):o.prototype.add.call(this,E)},"add"),v.prototype.remove=t(function(E){if(E instanceof l&&E.extend===s){if(!this.fields||this.fields[E.name]!==E)throw Error(E+" is not a member of "+this);return delete this.fields[E.name],E.parent=null,E.onRemove(this),I(this)}if(E instanceof h){if(!this.oneofs||this.oneofs[E.name]!==E)throw Error(E+" is not a member of "+this);return delete this.oneofs[E.name],E.parent=null,E.onRemove(this),I(this)}return o.prototype.remove.call(this,E)},"remove"),v.prototype.isReservedId=t(function(E){return o.isReservedId(this.reserved,E)},"isReservedId"),v.prototype.isReservedName=t(function(E){return o.isReservedName(this.reserved,E)},"isReservedName"),v.prototype.create=t(function(E){return new this.ctor(E)},"create"),v.prototype.setup=t(function(){for(var E=this.fullName,k=[],D=0;D<this.fieldsArray.length;++D)k.push(this._fieldsArray[D].resolve().resolvedType);this.encode=b(this)({Writer:m,types:k,util:y}),this.decode=_(this)({Reader:d,types:k,util:y}),this.verify=w(this)({types:k,util:y}),this.fromObject=S.fromObject(this)({types:k,util:y}),this.toObject=S.toObject(this)({types:k,util:y});var B=T[E];if(B){var U=Object.create(this);U.fromObject=this.fromObject,this.fromObject=B.fromObject.bind(U),U.toObject=this.toObject,this.toObject=B.toObject.bind(U)}return this},"setup"),v.prototype.encode=t(function(E,k){return this.setup().encode(E,k)},"encode_setup"),v.prototype.encodeDelimited=t(function(E,k){return this.encode(E,k&&k.len?k.fork():k).ldelim()},"encodeDelimited"),v.prototype.decode=t(function(E,k){return this.setup().decode(E,k)},"decode_setup"),v.prototype.decodeDelimited=t(function(E){return E instanceof d||(E=d.create(E)),this.decode(E,E.uint32())},"decodeDelimited"),v.prototype.verify=t(function(E){return this.setup().verify(E)},"verify_setup"),v.prototype.fromObject=t(function(E){return this.setup().fromObject(E)},"fromObject"),v.prototype.toObject=t(function(E,k){return this.setup().toObject(E,k)},"toObject"),v.d=t(function(E){return t(function(k){y.decorateType(k,E)},"typeDecorator")},"decorateType")},{12:12,13:13,14:14,15:15,16:16,20:20,21:21,23:23,25:25,27:27,33:33,37:37,40:40,41:41,42:42}],36:[function(n,i,c){var o=c,u=n(37),h=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function l(g,p){var f=0,d={};for(p|=0;f<g.length;)d[h[f+p]]=g[f++];return d}a(l,"u"),t(l,"bake"),o.basic=l([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),o.defaults=l([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",u.emptyArray,null]),o.long=l([0,0,0,1,1],7),o.mapKey=l([0,0,0,5,5,0,0,0,1,1,0,2],2),o.packed=l([1,5,0,0,0,5,5,0,0,0,1,1,0])},{37:37}],37:[function(n,i,c){var o=i.exports=n(39),u=n(30),h,l;o.codegen=n(3),o.fetch=n(5),o.path=n(8),o.fs=o.inquire("fs"),o.toArray=t(function(m){if(m){for(var y=Object.keys(m),b=new Array(y.length),_=0;_<y.length;)b[_]=m[y[_++]];return b}return[]},"toArray"),o.toObject=t(function(m){for(var y={},b=0;b<m.length;){var _=m[b++],w=m[b++];w!==s&&(y[_]=w)}return y},"toObject");var g=/\\/g,p=/"/g;o.isReserved=t(function(m){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(m)},"isReserved"),o.safeProp=t(function(m){return!/^[$\w_]+$/.test(m)||o.isReserved(m)?'["'+m.replace(g,"\\\\").replace(p,'\\"')+'"]':"."+m},"safeProp"),o.ucFirst=t(function(m){return m.charAt(0).toUpperCase()+m.substring(1)},"ucFirst");var f=/_([a-z])/g;o.camelCase=t(function(m){return m.substring(0,1)+m.substring(1).replace(f,function(y,b){return b.toUpperCase()})},"camelCase"),o.compareFieldsById=t(function(m,y){return m.id-y.id},"compareFieldsById"),o.decorateType=t(function(m,y){if(m.$type)return y&&m.$type.name!==y&&(o.decorateRoot.remove(m.$type),m.$type.name=y,o.decorateRoot.add(m.$type)),m.$type;h||(h=n(35));var b=new h(y||m.name);return o.decorateRoot.add(b),b.ctor=m,Object.defineProperty(m,"$type",{value:b,enumerable:!1}),Object.defineProperty(m.prototype,"$type",{value:b,enumerable:!1}),b},"decorateType");var d=0;o.decorateEnum=t(function(m){if(m.$type)return m.$type;l||(l=n(15));var y=new l("Enum"+d++,m);return o.decorateRoot.add(y),Object.defineProperty(m,"$type",{value:y,enumerable:!1}),y},"decorateEnum"),Object.defineProperty(o,"decorateRoot",{get:t(function(){return u.decorated||(u.decorated=new(n(29)))},"get")})},{15:15,29:29,3:3,30:30,35:35,39:39,5:5,8:8}],38:[function(n,i,c){i.exports=u;var o=n(39);function u(p,f){this.lo=p>>>0,this.hi=f>>>0}a(u,"d"),t(u,"LongBits");var h=u.zero=new u(0,0);h.toNumber=function(){return 0},h.zzEncode=h.zzDecode=function(){return this},h.length=function(){return 1};var l=u.zeroHash="\0\0\0\0\0\0\0\0";u.fromNumber=t(function(p){if(p===0)return h;var f=p<0;f&&(p=-p);var d=p>>>0,m=(p-d)/4294967296>>>0;return f&&(m=~m>>>0,d=~d>>>0,++d>4294967295&&(d=0,++m>4294967295&&(m=0))),new u(d,m)},"fromNumber"),u.from=t(function(p){if(typeof p=="number")return u.fromNumber(p);if(o.isString(p))if(o.Long)p=o.Long.fromString(p);else return u.fromNumber(parseInt(p,10));return p.low||p.high?new u(p.low>>>0,p.high>>>0):h},"from"),u.prototype.toNumber=t(function(p){if(!p&&this.hi>>>31){var f=~this.lo+1>>>0,d=~this.hi>>>0;return f||(d=d+1>>>0),-(f+d*4294967296)}return this.lo+this.hi*4294967296},"toNumber"),u.prototype.toLong=t(function(p){return o.Long?new o.Long(this.lo|0,this.hi|0,!!p):{low:this.lo|0,high:this.hi|0,unsigned:!!p}},"toLong");var g=String.prototype.charCodeAt;u.fromHash=t(function(p){return p===l?h:new u((g.call(p,0)|g.call(p,1)<<8|g.call(p,2)<<16|g.call(p,3)<<24)>>>0,(g.call(p,4)|g.call(p,5)<<8|g.call(p,6)<<16|g.call(p,7)<<24)>>>0)},"fromHash"),u.prototype.toHash=t(function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},"toHash"),u.prototype.zzEncode=t(function(){var p=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^p)>>>0,this.lo=(this.lo<<1^p)>>>0,this},"zzEncode"),u.prototype.zzDecode=t(function(){var p=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^p)>>>0,this.hi=(this.hi>>>1^p)>>>0,this},"zzDecode"),u.prototype.length=t(function(){var p=this.lo,f=(this.lo>>>28|this.hi<<4)>>>0,d=this.hi>>>24;return d===0?f===0?p<16384?p<128?1:2:p<2097152?3:4:f<16384?f<128?5:6:f<2097152?7:8:d<128?9:10},"length")},{39:39}],39:[function(n,i,c){var o=c;o.asPromise=n(1),o.base64=n(2),o.EventEmitter=n(4),o.float=n(6),o.inquire=n(7),o.utf8=n(10),o.pool=n(9),o.LongBits=n(38),o.emptyArray=Object.freeze?Object.freeze([]):[],o.emptyObject=Object.freeze?Object.freeze({}):{},o.isNode=!!(wr.process&&wr.process.versions&&wr.process.versions.node),o.isInteger=Number.isInteger||t(function(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l},"isInteger"),o.isString=t(function(l){return typeof l=="string"||l instanceof String},"isString"),o.isObject=t(function(l){return l&&typeof l=="object"},"isObject"),o.isset=o.isSet=t(function(l,g){var p=l[g];return p!=null&&l.hasOwnProperty(g)?typeof p!="object"||(Array.isArray(p)?p.length:Object.keys(p).length)>0:!1},"isSet"),o.Buffer=(function(){try{var l=o.inquire("buffer").Buffer;return l.prototype.utf8Write?l:null}catch{return null}})(),o._Buffer_from=null,o._Buffer_allocUnsafe=null,o.newBuffer=t(function(l){return typeof l=="number"?o.Buffer?o._Buffer_allocUnsafe(l):new o.Array(l):o.Buffer?o._Buffer_from(l):typeof Uint8Array>"u"?l:new Uint8Array(l)},"newBuffer"),o.Array=typeof Uint8Array<"u"?Uint8Array:Array,o.Long=wr.dcodeIO&&wr.dcodeIO.Long||o.inquire("long"),o.key2Re=/^true|false|0|1$/,o.key32Re=/^-?(?:0|[1-9][0-9]*)$/,o.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,o.longToHash=t(function(l){return l?o.LongBits.from(l).toHash():o.LongBits.zeroHash},"longToHash"),o.longFromHash=t(function(l,g){var p=o.LongBits.fromHash(l);return o.Long?o.Long.fromBits(p.lo,p.hi,g):p.toNumber(!!g)},"longFromHash");function u(l,g,p){for(var f=Object.keys(g),d=0;d<f.length;++d)(l[f[d]]===s||!p)&&(l[f[d]]=g[f[d]]);return l}a(u,"d"),t(u,"merge"),o.merge=u,o.lcFirst=t(function(l){return l.charAt(0).toLowerCase()+l.substring(1)},"lcFirst");function h(l){function g(p,f){if(!(this instanceof g))return new g(p,f);Object.defineProperty(this,"message",{get:t(function(){return p},"get")}),Error.captureStackTrace?Error.captureStackTrace(this,g):Object.defineProperty(this,"stack",{value:new Error().stack||""}),f&&u(this,f)}return a(g,"a"),t(g,"CustomError"),(g.prototype=Object.create(Error.prototype)).constructor=g,Object.defineProperty(g.prototype,"name",{get:t(function(){return l},"get")}),g.prototype.toString=t(function(){return this.name+": "+this.message},"toString"),g}a(h,"c"),t(h,"newError"),o.newError=h,o.ProtocolError=h("ProtocolError"),o.oneOfGetter=t(function(l){for(var g={},p=0;p<l.length;++p)g[l[p]]=1;return function(){for(var f=Object.keys(this),d=f.length-1;d>-1;--d)if(g[f[d]]===1&&this[f[d]]!==s&&this[f[d]]!==null)return f[d]}},"getOneOf"),o.oneOfSetter=t(function(l){return function(g){for(var p=0;p<l.length;++p)l[p]!==g&&delete this[l[p]]}},"setOneOf"),o.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},o._configure=function(){var l=o.Buffer;if(!l){o._Buffer_from=o._Buffer_allocUnsafe=null;return}o._Buffer_from=l.from!==Uint8Array.from&&l.from||t(function(g,p){return new l(g,p)},"Buffer_from"),o._Buffer_allocUnsafe=l.allocUnsafe||t(function(g){return new l(g)},"Buffer_allocUnsafe")}},{1:1,10:10,2:2,38:38,4:4,6:6,7:7,9:9}],40:[function(n,i,c){i.exports=p;var o=n(15),u=n(37);function h(f,d){return f.name+": "+d+(f.repeated&&d!=="array"?"[]":f.map&&d!=="object"?"{k:"+f.keyType+"}":"")+" expected"}a(h,"c"),t(h,"invalid");function l(f,d,m,y){if(d.resolvedType)if(d.resolvedType instanceof o){f("switch(%s){",y)("default:")("return%j",h(d,"enum value"));for(var b=Object.keys(d.resolvedType.values),_=0;_<b.length;++_)f("case %i:",d.resolvedType.values[b[_]]);f("break")("}")}else f("{")("var e=types[%i].verify(%s);",m,y)("if(e)")("return%j+e",d.name+".")("}");else switch(d.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":f("if(!util.isInteger(%s))",y)("return%j",h(d,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":f("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",y,y,y,y)("return%j",h(d,"integer|Long"));break;case"float":case"double":f('if(typeof %s!=="number")',y)("return%j",h(d,"number"));break;case"bool":f('if(typeof %s!=="boolean")',y)("return%j",h(d,"boolean"));break;case"string":f("if(!util.isString(%s))",y)("return%j",h(d,"string"));break;case"bytes":f('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',y,y,y)("return%j",h(d,"buffer"));break}return f}a(l,"u"),t(l,"genVerifyValue");function g(f,d,m){switch(d.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":f("if(!util.key32Re.test(%s))",m)("return%j",h(d,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":f("if(!util.key64Re.test(%s))",m)("return%j",h(d,"integer|Long key"));break;case"bool":f("if(!util.key2Re.test(%s))",m)("return%j",h(d,"boolean key"));break}return f}a(g,"a"),t(g,"genVerifyKey");function p(f){var d=u.codegen(["m"],f.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),m=f.oneofsArray,y={};m.length&&d("var p={}");for(var b=0;b<f.fieldsArray.length;++b){var _=f._fieldsArray[b].resolve(),w="m"+u.safeProp(_.name);if(_.optional&&d("if(%s!=null&&m.hasOwnProperty(%j)){",w,_.name),_.map)d("if(!util.isObject(%s))",w)("return%j",h(_,"object"))("var k=Object.keys(%s)",w)("for(var i=0;i<k.length;++i){"),g(d,_,"k[i]"),l(d,_,b,w+"[k[i]]")("}");else if(_.repeated)d("if(!Array.isArray(%s))",w)("return%j",h(_,"array"))("for(var i=0;i<%s.length;++i){",w),l(d,_,b,w+"[i]")("}");else{if(_.partOf){var S=u.safeProp(_.partOf.name);y[_.partOf.name]===1&&d("if(p%s===1)",S)("return%j",_.partOf.name+": multiple values"),y[_.partOf.name]=1,d("p%s=1",S)}l(d,_,b,w)}_.optional&&d("}")}return d("return null")}a(p,"s"),t(p,"verifier")},{15:15,37:37}],41:[function(n,i,c){var o=c,u=n(21);o[".google.protobuf.Any"]={fromObject:t(function(h){if(h&&h["@type"]){var l=this.lookup(h["@type"]);if(l){var g=h["@type"].charAt(0)==="."?h["@type"].substr(1):h["@type"];return this.create({type_url:"/"+g,value:l.encode(l.fromObject(h)).finish()})}}return this.fromObject(h)},"fromObject"),toObject:t(function(h,l){if(l&&l.json&&h.type_url&&h.value){var g=h.type_url.substring(h.type_url.lastIndexOf("/")+1),p=this.lookup(g);p&&(h=p.decode(h.value))}if(!(h instanceof this.ctor)&&h instanceof u){var f=h.$type.toObject(h,l);return f["@type"]=h.$type.fullName,f}return this.toObject(h,l)},"toObject")}},{21:21}],42:[function(n,i,c){i.exports=m;var o=n(39),u,h=o.LongBits,l=o.base64,g=o.utf8;function p(v,I,E){this.fn=v,this.len=I,this.next=s,this.val=E}a(p,"s"),t(p,"Op");function f(){}a(f,"t"),t(f,"noop");function d(v){this.head=v.head,this.tail=v.tail,this.len=v.len,this.next=v.states}a(d,"r"),t(d,"State");function m(){this.len=0,this.head=new p(f,0,0),this.tail=this.head,this.states=null}a(m,"e"),t(m,"Writer"),m.create=o.Buffer?t(function(){return(m.create=t(function(){return new u},"create_buffer"))()},"create_buffer_setup"):t(function(){return new m},"create_array"),m.alloc=t(function(v){return new o.Array(v)},"alloc"),o.Array!==Array&&(m.alloc=o.pool(m.alloc,o.Array.prototype.subarray)),m.prototype._push=t(function(v,I,E){return this.tail=this.tail.next=new p(v,I,E),this.len+=I,this},"push");function y(v,I,E){I[E]=v&255}a(y,"f"),t(y,"writeByte");function b(v,I,E){for(;v>127;)I[E++]=v&127|128,v>>>=7;I[E]=v}a(b,"n"),t(b,"writeVarint32");function _(v,I){this.len=v,this.next=s,this.val=I}a(_,"o"),t(_,"VarintOp"),_.prototype=Object.create(p.prototype),_.prototype.fn=b,m.prototype.uint32=t(function(v){return this.len+=(this.tail=this.tail.next=new _((v=v>>>0)<128?1:v<16384?2:v<2097152?3:v<268435456?4:5,v)).len,this},"write_uint32"),m.prototype.int32=t(function(v){return v<0?this._push(w,10,h.fromNumber(v)):this.uint32(v)},"write_int32"),m.prototype.sint32=t(function(v){return this.uint32((v<<1^v>>31)>>>0)},"write_sint32");function w(v,I,E){for(;v.hi;)I[E++]=v.lo&127|128,v.lo=(v.lo>>>7|v.hi<<25)>>>0,v.hi>>>=7;for(;v.lo>127;)I[E++]=v.lo&127|128,v.lo=v.lo>>>7;I[E++]=v.lo}a(w,"p"),t(w,"writeVarint64"),m.prototype.uint64=t(function(v){var I=h.from(v);return this._push(w,I.length(),I)},"write_uint64"),m.prototype.int64=m.prototype.uint64,m.prototype.sint64=t(function(v){var I=h.from(v).zzEncode();return this._push(w,I.length(),I)},"write_sint64"),m.prototype.bool=t(function(v){return this._push(y,1,v?1:0)},"write_bool");function S(v,I,E){I[E]=v&255,I[E+1]=v>>>8&255,I[E+2]=v>>>16&255,I[E+3]=v>>>24}a(S,"h"),t(S,"writeFixed32"),m.prototype.fixed32=t(function(v){return this._push(S,4,v>>>0)},"write_fixed32"),m.prototype.sfixed32=m.prototype.fixed32,m.prototype.fixed64=t(function(v){var I=h.from(v);return this._push(S,4,I.lo)._push(S,4,I.hi)},"write_fixed64"),m.prototype.sfixed64=m.prototype.fixed64,m.prototype.float=t(function(v){return this._push(o.float.writeFloatLE,4,v)},"write_float"),m.prototype.double=t(function(v){return this._push(o.float.writeDoubleLE,8,v)},"write_double");var T=o.Array.prototype.set?t(function(v,I,E){I.set(v,E)},"writeBytes_set"):t(function(v,I,E){for(var k=0;k<v.length;++k)I[E+k]=v[k]},"writeBytes_for");m.prototype.bytes=t(function(v){var I=v.length>>>0;if(!I)return this._push(y,1,0);if(o.isString(v)){var E=m.alloc(I=l.length(v));l.decode(v,E,0),v=E}return this.uint32(I)._push(T,I,v)},"write_bytes"),m.prototype.string=t(function(v){var I=g.length(v);return I?this.uint32(I)._push(g.write,I,v):this._push(y,1,0)},"write_string"),m.prototype.fork=t(function(){return this.states=new d(this),this.head=this.tail=new p(f,0,0),this.len=0,this},"fork"),m.prototype.reset=t(function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new p(f,0,0),this.len=0),this},"reset"),m.prototype.ldelim=t(function(){var v=this.head,I=this.tail,E=this.len;return this.reset().uint32(E),E&&(this.tail.next=v.next,this.tail=I,this.len+=E),this},"ldelim"),m.prototype.finish=t(function(){for(var v=this.head.next,I=this.constructor.alloc(this.len),E=0;v;)v.fn(v.val,I,E),E+=v.len,v=v.next;return I},"finish"),m._configure=function(v){u=v}},{39:39}],43:[function(n,i,c){i.exports=l;var o=n(42);(l.prototype=Object.create(o.prototype)).constructor=l;var u=n(39),h=u.Buffer;function l(){o.call(this)}a(l,"u"),t(l,"BufferWriter"),l.alloc=t(function(f){return(l.alloc=u._Buffer_allocUnsafe)(f)},"alloc_buffer");var g=h&&h.prototype instanceof Uint8Array&&h.prototype.set.name==="set"?t(function(f,d,m){d.set(f,m)},"writeBytesBuffer_set"):t(function(f,d,m){if(f.copy)f.copy(d,m,0,f.length);else for(var y=0;y<f.length;)d[m++]=f[y++]},"writeBytesBuffer_copy");l.prototype.bytes=t(function(f){u.isString(f)&&(f=u._Buffer_from(f,"base64"));var d=f.length>>>0;return this.uint32(d),d&&this._push(g,d,f),this},"write_bytes_buffer");function p(f,d,m){f.length<40?u.utf8.write(f,d,m):d.utf8Write(f,m)}a(p,"s"),t(p,"writeStringBuffer"),l.prototype.string=t(function(f){var d=h.byteLength(f);return this.uint32(d),d&&this._push(p,d,f),this},"write_string_buffer")},{39:39,42:42}]},{},[19])})()})(Ln)),Ln.exports}a(py,"requireProtobuf");var gy=py();const Sr=fy(gy);var my=Object.defineProperty,x=a((r,e)=>my(r,"name",{value:e,configurable:!0}),"s$3");let te=Sr.Reader,Ne=Sr.Writer,Oe=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),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"RequestBatch"),r.prototype.requests=Oe.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.requests!=null&&e.requests.length)for(var s=0;s<e.requests.length;++s)F.Request.encode(e.requests[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.RequestBatch;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.requests&&n.requests.length||(n.requests=[]),n.requests.push(F.Request.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.Request=(function(){function r(t){if(t)for(var s=Object.keys(t),n=0;n<s.length;++n)t[s[n]]!=null&&(this[s[n]]=t[s[n]])}a(r,"t"),x(r,"Request"),r.prototype.incomingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:Oe.oneOfGetter(e=["incomingMessages","channelStats","serverStats"]),set:Oe.oneOfSetter(e)}),r.create=x(function(t){return new r(t)},"create"),r.encode=x(function(t,s){return s||(s=Ne.create()),t.incomingMessages!=null&&t.hasOwnProperty("incomingMessages")&&F.IncomingMessagesRequest.encode(t.incomingMessages,s.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&F.ChannelStatsRequest.encode(t.channelStats,s.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&F.ServerStatsRequest.encode(t.serverStats,s.uint32(26).fork()).ldelim(),s},"encode"),r.decode=x(function(t,s){t instanceof te||(t=te.create(t));for(var n=s===void 0?t.len:t.pos+s,i=new F.Request;t.pos<n;){var c=t.uint32();switch(c>>>3){case 1:i.incomingMessages=F.IncomingMessagesRequest.decode(t,t.uint32());break;case 2:i.channelStats=F.ChannelStatsRequest.decode(t,t.uint32());break;case 3:i.serverStats=F.ServerStatsRequest.decode(t,t.uint32());break;default:t.skipType(c&7);break}}return i},"decode"),r})(),F.IncomingMessagesRequest=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"IncomingMessagesRequest"),r.prototype.messages=Oe.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.messages!=null&&e.messages.length)for(var s=0;s<e.messages.length;++s)F.IncomingMessage.encode(e.messages[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.IncomingMessagesRequest;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.messages&&n.messages.length||(n.messages=[]),n.messages.push(F.IncomingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.IncomingMessage=(function(){function r(e){if(this.receivers=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"IncomingMessage"),r.prototype.receivers=Oe.emptyArray,r.prototype.sender=null,r.prototype.body="",r.prototype.expiry=0,r.prototype.type="",r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.receivers!=null&&e.receivers.length)for(var s=0;s<e.receivers.length;++s)F.Receiver.encode(e.receivers[s],t.uint32(10).fork()).ldelim();return e.sender!=null&&e.hasOwnProperty("sender")&&F.Sender.encode(e.sender,t.uint32(18).fork()).ldelim(),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(26).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(32).uint32(e.expiry),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(42).string(e.type),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.IncomingMessage;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.receivers&&n.receivers.length||(n.receivers=[]),n.receivers.push(F.Receiver.decode(e,e.uint32()));break;case 2:n.sender=F.Sender.decode(e,e.uint32());break;case 3:n.body=e.string();break;case 4:n.expiry=e.uint32();break;case 5:n.type=e.string();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ChannelStatsRequest=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ChannelStatsRequest"),r.prototype.channels=Oe.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.channels!=null&&e.channels.length)for(var s=0;s<e.channels.length;++s)F.ChannelId.encode(e.channels[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ChannelStatsRequest;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.channels&&n.channels.length||(n.channels=[]),n.channels.push(F.ChannelId.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ChannelId=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ChannelId"),r.prototype.id=Oe.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=Oe.newBuffer([]),r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ChannelId;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.signature=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ServerStatsRequest=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ServerStatsRequest"),r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ServerStatsRequest;e.pos<s;){var i=e.uint32();switch(i>>>3){default:e.skipType(i&7);break}}return n},"decode"),r})(),F.Sender=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"Sender"),r.prototype.type=0,r.prototype.id=Oe.newBuffer([]),r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(8).int32(e.type),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(18).bytes(e.id),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.Sender;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.type=e.int32();break;case 2:n.id=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.SenderType=(function(){var r={},e=Object.create(r);return e[r[0]="UNKNOWN"]=0,e[r[1]="CLIENT"]=1,e[r[2]="BACKEND"]=2,e})(),F.Receiver=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"Receiver"),r.prototype.id=Oe.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=Oe.newBuffer([]),r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.Receiver;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.signature=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ResponseBatch=(function(){function r(e){if(this.responses=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ResponseBatch"),r.prototype.responses=Oe.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.responses!=null&&e.responses.length)for(var s=0;s<e.responses.length;++s)F.Response.encode(e.responses[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ResponseBatch;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.responses&&n.responses.length||(n.responses=[]),n.responses.push(F.Response.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.Response=(function(){function r(t){if(t)for(var s=Object.keys(t),n=0;n<s.length;++n)t[s[n]]!=null&&(this[s[n]]=t[s[n]])}a(r,"t"),x(r,"Response"),r.prototype.outgoingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:Oe.oneOfGetter(e=["outgoingMessages","channelStats","serverStats"]),set:Oe.oneOfSetter(e)}),r.create=x(function(t){return new r(t)},"create"),r.encode=x(function(t,s){return s||(s=Ne.create()),t.outgoingMessages!=null&&t.hasOwnProperty("outgoingMessages")&&F.OutgoingMessagesResponse.encode(t.outgoingMessages,s.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&F.ChannelStatsResponse.encode(t.channelStats,s.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&F.JsonResponse.encode(t.serverStats,s.uint32(26).fork()).ldelim(),s},"encode"),r.decode=x(function(t,s){t instanceof te||(t=te.create(t));for(var n=s===void 0?t.len:t.pos+s,i=new F.Response;t.pos<n;){var c=t.uint32();switch(c>>>3){case 1:i.outgoingMessages=F.OutgoingMessagesResponse.decode(t,t.uint32());break;case 2:i.channelStats=F.ChannelStatsResponse.decode(t,t.uint32());break;case 3:i.serverStats=F.JsonResponse.decode(t,t.uint32());break;default:t.skipType(c&7);break}}return i},"decode"),r})(),F.OutgoingMessagesResponse=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"OutgoingMessagesResponse"),r.prototype.messages=Oe.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.messages!=null&&e.messages.length)for(var s=0;s<e.messages.length;++s)F.OutgoingMessage.encode(e.messages[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.OutgoingMessagesResponse;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.messages&&n.messages.length||(n.messages=[]),n.messages.push(F.OutgoingMessage.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.OutgoingMessage=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"OutgoingMessage"),r.prototype.id=Oe.newBuffer([]),r.prototype.body="",r.prototype.expiry=0,r.prototype.created=0,r.prototype.sender=null,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(18).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(24).uint32(e.expiry),e.created!=null&&e.hasOwnProperty("created")&&t.uint32(37).fixed32(e.created),e.sender!=null&&e.hasOwnProperty("sender")&&F.Sender.encode(e.sender,t.uint32(42).fork()).ldelim(),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.OutgoingMessage;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.body=e.string();break;case 3:n.expiry=e.uint32();break;case 4:n.created=e.fixed32();break;case 5:n.sender=F.Sender.decode(e,e.uint32());break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ChannelStatsResponse=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ChannelStatsResponse"),r.prototype.channels=Oe.emptyArray,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){if(t||(t=Ne.create()),e.channels!=null&&e.channels.length)for(var s=0;s<e.channels.length;++s)F.ChannelStats.encode(e.channels[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ChannelStatsResponse;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.channels&&n.channels.length||(n.channels=[]),n.channels.push(F.ChannelStats.decode(e,e.uint32()));break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.ChannelStats=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"ChannelStats"),r.prototype.id=Oe.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.isOnline=!1,r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.isOnline!=null&&e.hasOwnProperty("isOnline")&&t.uint32(24).bool(e.isOnline),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.ChannelStats;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.isOnline=e.bool();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),F.JsonResponse=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),x(r,"JsonResponse"),r.prototype.json="",r.create=x(function(e){return new r(e)},"create"),r.encode=x(function(e,t){return t||(t=Ne.create()),e.json!=null&&e.hasOwnProperty("json")&&t.uint32(10).string(e.json),t},"encode"),r.decode=x(function(e,t){e instanceof te||(e=te.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new F.JsonResponse;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.json=e.string();break;default:e.skipType(i&7);break}}return n},"decode"),r})();const yy=F.ResponseBatch,oc=F.RequestBatch,by=F.IncomingMessage,ac=F.Receiver;var _y=Object.defineProperty,wy=a((r,e)=>_y(r,"name",{value:e,configurable:!0}),"o$1");class cc{static{a(this,"AbstractConnector")}static{wy(this,"AbstractConnector")}_logger;_connected=!1;_connectionType;_disconnectCode=0;_disconnectReason="";_parent;_callbacks;constructor(e){this._logger=ee.createNullLogger(),this._parent=e.parent,this._connectionType=he.Undefined,this._callbacks={onOpen:P.isFunction(e.onOpen)?e.onOpen:()=>{},onDisconnect:P.isFunction(e.onDisconnect)?e.onDisconnect:()=>{},onError:P.isFunction(e.onError)?e.onError:()=>{},onMessage:P.isFunction(e.onMessage)?e.onMessage:()=>{}}}setLogger(e){this._logger=e}getLogger(){return this._logger}destroy(){}get connected(){return this._connected}set connected(e){e!=this._connected&&(this._connected=e,this._connected?this._callbacks.onOpen():this._callbacks.onDisconnect({code:this.disconnectCode,reason:this.disconnectReason}))}get disconnectCode(){return this._disconnectCode}get disconnectReason(){return this._disconnectReason}get connectionPath(){return this._parent.getConnectionPath(this._connectionType)}}var Sy=Object.defineProperty,vy=a((r,e)=>Sy(r,"name",{value:e,configurable:!0}),"s$2");class Ey extends cc{static{a(this,"WebSocketConnector")}static{vy(this,"WebSocketConnector")}_socket;_onSocketOpenHandler;_onSocketCloseHandler;_onSocketErrorHandler;_onSocketMessageHandler;constructor(e){super(e),this._connectionType=he.WebSocket,this._socket=null,this._onSocketOpenHandler=this._onSocketOpen.bind(this),this._onSocketCloseHandler=this._onSocketClose.bind(this),this._onSocketErrorHandler=this._onSocketError.bind(this),this._onSocketMessageHandler=this._onSocketMessage.bind(this)}destroy(){super.destroy(),this._socket&&(this._socket.close(),this._socket=null)}connect(){if(this._socket){if(this._socket.readyState===1)return;this.clearEventListener(),this._socket.close(),this._socket=null}this._createSocket()}get socket(){return this._socket}disconnect(e,t){this._socket!==null&&(this.clearEventListener(),this._socket.close(e,t)),this._socket=null,this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}send(e){return!this._socket||this._socket.readyState!==1?(this.getLogger().error(`${z.getDateForLog()}: Pull: WebSocket is not connected`),!1):(this._socket.send(e),!0)}_onSocketOpen(){this.connected=!0}_onSocketClose(e){this._socket=null,this._disconnectCode=Number(e.code),this._disconnectReason=e.reason,this.connected=!1}_onSocketError(e){this._callbacks.onError(new Error(`Socket error: ${e}`))}_onSocketMessage(e){this._callbacks.onMessage(e.data)}clearEventListener(){this._socket&&(this._socket.removeEventListener("open",this._onSocketOpenHandler),this._socket.removeEventListener("close",this._onSocketCloseHandler),this._socket.removeEventListener("error",this._onSocketErrorHandler),this._socket.removeEventListener("message",this._onSocketMessageHandler))}_createSocket(){if(this._socket)throw new Error("Socket already exists");if(!this.connectionPath)throw new Error("Websocket connection path is not defined");this._socket=new WebSocket(this.connectionPath),this._socket.binaryType="arraybuffer",this._socket.addEventListener("open",this._onSocketOpenHandler),this._socket.addEventListener("close",this._onSocketCloseHandler),this._socket.addEventListener("error",this._onSocketErrorHandler),this._socket.addEventListener("message",this._onSocketMessageHandler)}}var Oy=Object.defineProperty,Ty=a((r,e)=>Oy(r,"name",{value:e,configurable:!0}),"s$1");const ky=60;class Iy extends cc{static{a(this,"LongPollingConnector")}static{Ty(this,"LongPollingConnector")}_active;_requestTimeout;_failureTimeout;_xhr;_requestAborted;constructor(e){super(e),this._active=!1,this._connectionType=he.LongPolling,this._requestTimeout=null,this._failureTimeout=null,this._xhr=this.createXhr(),this._requestAborted=!1}connect(){this._active=!0,this.performRequest()}disconnect(e,t){this._active=!1,this.clearTimeOut(),this._xhr&&(this._requestAborted=!0,this._xhr.abort()),this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}performRequest(){if(this._active){if(!this.connectionPath)throw new Error("Long polling connection path is not defined");this._xhr.readyState!==0&&this._xhr.readyState!==4||(this.clearTimeOut(),this._failureTimeout=setTimeout(()=>{this.connected=!0},5e3),this._requestTimeout=setTimeout(this.onRequestTimeout.bind(this),ky*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(`${z.getDateForLog()}: Pull: publication path is empty`),!1;const s=new XMLHttpRequest;return s.open("POST",t),s.send(e),!0}onResponse(e){if(this.clearTimeOut(),this._xhr.status===200)this.connected=!0,P.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");P.isStringFilled(t)&&this._parent.setLastMessageId(t||"")}this.performRequest()}else this._callbacks.onError(new Error("Could not connect to the server")),this.connected=!1}clearTimeOut(){this._failureTimeout&&(clearTimeout(this._failureTimeout),this._failureTimeout=null),this._requestTimeout&&(clearTimeout(this._requestTimeout),this._requestTimeout=null)}createXhr(){const e=new XMLHttpRequest;return this._parent.isProtobufSupported()&&!this._parent.isJsonRpc()&&(e.responseType="arraybuffer"),e.addEventListener("readystatechange",this.onXhrReadyStateChange.bind(this)),e}}var Ay=Object.defineProperty,lc=a((r,e)=>Ay(r,"name",{value:e,configurable:!0}),"v");const vr=19,uc=1800,Ry=5e3,Cy=60*1e3,hc=10,dc=10,Ny="ping",Dy="pong",fc="bx-pull-session",My=20,pc={api:{},channels:{},publicChannels:{},server:{timeShift:0},clientId:null,jwt:null,exp:0};class gc{static{a(this,"PullClient")}static{lc(this,"PullClient")}_logger;_restClient;_status;_context;_guestMode;_guestUserId;_userId;_configGetMethod;_getPublicListMethod;_siteId;_enabled;_unloading=!1;_starting=!1;_debug=!1;_connectionAttempt=0;_connectionType=he.WebSocket;_skipStorageInit;_skipCheckRevision;_subscribers={};_watchTagsQueue=new Map;_watchUpdateInterval=174e4;_watchForceUpdateInterval=5e3;_configTimestamp=0;_session={mid:null,tag:null,time:null,history:{},lastMessageIds:[],messageCount:0};_connectors={[he.Undefined]:null,[he.WebSocket]:null,[he.LongPolling]:null};_isSecure;_config=null;_storage=null;_sharedConfig;_channelManager;_jsonRpcAdapter=null;_reconnectTimeout=null;_restartTimeout=null;_restoreWebSocketTimeout=null;_checkInterval=null;_offlineTimeout=null;_watchUpdateTimeout=null;_pingWaitTimeout=null;_isManualDisconnect=!1;_loggingEnabled=!1;_onPingTimeoutHandler;_userStatusCallbacks={};_connectPromise=null;_startingPromise=null;constructor(e){this._logger=ee.createNullLogger(),this._restClient=e.b24,this._status=Ve.Offline,this._context="master",e.restApplication&&(typeof e.configGetMethod>"u"&&(e.configGetMethod="pull.application.config.get"),typeof e.skipCheckRevision>"u"&&(e.skipCheckRevision=!0),P.isStringFilled(e.restApplication)&&(e.siteId=e.restApplication),e.serverEnabled=!0),this._guestMode=e.guestMode?z.toBoolean(e.guestMode):!1,this._guestUserId=e.guestUserId?z.toInteger(e.guestUserId):0,this._guestMode&&this._guestUserId>0?this._userId=this._guestUserId:(this._guestMode=!1,this._userId=e.userId?z.toInteger(e.userId):0),this._siteId=e.siteId??"none",this._enabled=P.isUndefined(e.serverEnabled)?!0:e.serverEnabled===!0,this._configGetMethod=P.isStringFilled(e.configGetMethod)?e.configGetMethod||"":"pull.config.get",this._getPublicListMethod=P.isStringFilled(e.getPublicListMethod)?e.getPublicListMethod||"":"pull.channel.public.list",this._skipStorageInit=e.skipStorageInit===!0,this._skipCheckRevision=e.skipCheckRevision===!0,P.isUndefined(e.configTimestamp)||(this._configTimestamp=z.toInteger(e.configTimestamp)),this._isSecure=document?.location.href.indexOf("https")===0,this._userId&&!this._skipStorageInit&&(this._storage=new sc({userId:this._userId,siteId:this._siteId})),this._sharedConfig=new ly({onWebSocketBlockChanged:this.onWebSocketBlockChanged.bind(this),storage:this._storage}),this._channelManager=new dy({b24:this._restClient,getPublicListMethod:this._getPublicListMethod}),this._loggingEnabled=this._sharedConfig.isLoggingEnabled(),this._onPingTimeoutHandler=this.onPingTimeout.bind(this)}setLogger(e){this._logger=e,this._jsonRpcAdapter?.setLogger(this.getLogger()),this._storage?.setLogger(this.getLogger()),this._sharedConfig.setLogger(this.getLogger()),this._channelManager.setLogger(this.getLogger()),this._connectors.webSocket?.setLogger(this.getLogger()),this._connectors.longPolling?.setLogger(this.getLogger())}getLogger(){return this._logger}destroy(){this.stop(Re.NORMAL_CLOSURE,"manual stop"),this.onBeforeUnload()}init(){this._connectors.webSocket=new Ey({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 Iy({parent:this,onOpen:this.onLongPollingOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onLongPollingDisconnect.bind(this),onError:this.onLongPollingError.bind(this)}),this._connectionType=this.isWebSocketAllowed()?he.WebSocket:he.LongPolling,window.addEventListener("beforeunload",this.onBeforeUnload.bind(this)),window.addEventListener("offline",this.onOffline.bind(this)),window.addEventListener("online",this.onOnline.bind(this)),this._jsonRpcAdapter=new oy({connector:this._connectors.webSocket,handlers:{"incoming.message":this.handleRpcIncomingMessage.bind(this)}})}get connector(){return this._connectors[this._connectionType]}get status(){return this._status}set status(e){this._status!==e&&(this._status=e,this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),e===Ve.Offline?this.sendPullStatusDelayed(e,Ry):this.sendPullStatus(e))}get session(){return this._session}subscribe(e){if(!P.isPlainObject(e))return this.attachCommandHandler(e);if(e=e,e.type=e.type||qe.Server,e.command=e.command||null,e.type==qe.Server||e.type==qe.Client){if(typeof e.moduleId>"u")throw new TypeError(`${z.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(`${z.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string.`),()=>{};let t=qe.Server;return typeof e.getSubscriptionType=="function"&&(t=e.getSubscriptionType()),this.subscribe({type:t,moduleId:e.getModuleId(),callback:lc(s=>{let n=null;if(typeof e.getMap=="function"){const i=e.getMap();if(i&&typeof i=="object"){const c=i[s.command];typeof c=="function"?n=c.bind(e):typeof c=="string"&&typeof e[c]=="function"&&(n=e[c].bind(e))}}if(!n){const i=`handle${z.capitalize(s.command)}`;typeof e[i]=="function"&&(n=e[i].bind(e))}n&&(this._debug&&this._context!=="master"&&this.getLogger().warning(`${z.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,{data:s}),n(s.params,s.extra,s.command))},"callback")})}async start(e=null){let t=!0;if(this.isConnected())return Promise.resolve(!0);if(this._starting&&this._startingPromise)return this._startingPromise;if(!this._userId)throw new Error("Not set userId");if(this._siteId==="none")throw new Error("Not set siteId");let s=!1;if(e&&P.isPlainObject(e)&&(typeof e?.skipReconnectToLastSession<"u"&&(s=e.skipReconnectToLastSession,delete e.skipReconnectToLastSession),this._config=e,t=!1),!this._enabled)return Promise.reject({ex:{error:"PULL_DISABLED",error_description:"Push & Pull server is disabled"}});const n=Date.now();let i;return!s&&this._storage&&(i=this._storage.get(fc,null)),P.isPlainObject(i)&&Object.prototype.hasOwnProperty.call(i,"ttl")&&i.ttl>=n&&(this._session.mid=i.mid),this._starting=!0,this._startingPromise=new Promise((c,o)=>{this.loadConfig("client_start").then(u=>{this.setConfig(u,t),this.init(),this.updateWatch(!0),this.startCheckConfig(),this.connect().then(()=>c(!0),h=>o(h))}).catch(u=>{this._starting=!1,this.status=Ve.Offline,this.stopCheckConfig(),this.getLogger().error(`${z.getDateForLog()}: Pull: could not read push-server config`,{error:u}),o(u)})})}restart(e=Re.NORMAL_CLOSURE,t="manual restart"){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),this.getLogger().debug(`${z.getDateForLog()}: Pull: restarting with code ${e}`),this.disconnect(e,t),this._storage&&this._storage.remove(Ue.PullConfig),this._config=null;const s=`${e}_${t.replaceAll(" ","_")}`;this.loadConfig(s).then(n=>{this.setConfig(n,!0),this.updateWatch(),this.startCheckConfig(),this.connect().catch(i=>{this.getLogger().error("restart error",{error:i})})},n=>{this.getLogger().error(`${z.getDateForLog()}: Pull: could not read push-server config `,{error:n}),this.status=Ve.Offline,this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),(n?.status==401||n?.status==403)&&(this.stopCheckConfig(),this.onCustomEvent("onPullError",["AUTHORIZE_ERROR"]))})}stop(e=Re.NORMAL_CLOSURE,t="manual stop"){this.disconnect(e,t),this.stopCheckConfig()}reconnect(e,t,s=1){this.disconnect(e,t),this.scheduleReconnect(s)}setLastMessageId(e){this._session.mid=e}async sendMessage(e,t,s,n,i){const c={userList:e,body:{module_id:t,command:s,params:n},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.Publish,c):this.sendMessageBatch([c])}async sendMessageToChannels(e,t,s,n,i){const c={channelList:e,body:{module_id:t,command:s,params:n},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.Publish,c):this.sendMessageBatch([c])}capturePullEvent(e=!0){this._debug=e}enableLogging(e=!0){this._sharedConfig.setLoggingEnabled(e),this._loggingEnabled=e}async listChannels(){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.ListChannels,{})||Promise.reject(new Error("jsonRpcAdapter not init"))}async getUsersLastSeen(e){if(!P.isArray(e)||!e.every(s=>typeof s=="number"))throw new Error("userList must be an array of numbers");const t={};return new Promise((s,n)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.GetUsersLastSeen,{userList:e}).then(i=>{const c=[];for(let u=0;u<e.length;u++)Object.prototype.hasOwnProperty.call(i,e[u])||c.push(e[u]);if(c.length===0)return s(t);const o={userIds:c,sendToQueueSever:!0};this._restClient.actions.v2.call.make({method:"pull.api.user.getLastSeen",params:o}).then(u=>{const h=u.getData().result;for(const l in h)t[Number(l)]=Number(h[l]);return s(t)}).catch(u=>{this.getLogger().error("getUsersLastSeen",{error:u}),n(u)})}).catch(i=>{this.getLogger().error("getUsersLastSeen",{error:i}),n(i)})})}async ping(e=5){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.Ping,{},e)}async subscribeUserStatusChange(e,t){return new Promise((s,n)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.SubscribeStatusChange,{userId:e}).then(()=>(this._userStatusCallbacks[e]||(this._userStatusCallbacks[e]=[]),P.isFunction(t)&&this._userStatusCallbacks[e].push(t),s())).catch(i=>n(i))})}async unsubscribeUserStatusChange(e,t){return this._userStatusCallbacks[e]&&(this._userStatusCallbacks[e]=this._userStatusCallbacks[e].filter(s=>s!==t),this._userStatusCallbacks[e].length===0)?this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.UnsubscribeStatusChange,{userId:e}):Promise.resolve()}getRevision(){return this._config&&this._config.api?this._config.api.revision_web:null}getServerVersion(){return this._config&&this._config.server?this._config.server.version:0}getServerMode(){return this._config&&this._config.server?this._config.server.mode:null}getConfig(){return this._config}getDebugInfo(){if(!JSON||!JSON.stringify)return{};let e;this._config&&this._config.channels?e={ChannelID:this._config.channels.private?.id||"n/a",ChannelDie:this._config.channels.private?.end||"n/a",ChannelDieShared:this._config.channels.shared?.end||"n/a"}:e={ConfigError:"config is not loaded"};let t="-";return this._connectors.webSocket&&this._connectors.webSocket?.socket&&(this.isJsonRpc()?t="json-rpc":t=this._connectors.webSocket?.socket?.url.search("binaryMode=true")!=-1?"protobuf":"text"),{UserId:this._userId+(this._userId>0?"":"(guest)"),"Guest userId":this._guestMode&&this._guestUserId!==0?this._guestUserId:"-","Browser online":navigator.onLine?"Y":"N",Connect:this.isConnected()?"Y":"N","Server type":this.isSharedMode()?"cloud":"local","WebSocket supported":this.isWebSocketSupported()?"Y":"N","WebSocket connected":this._connectors.webSocket&&this._connectors.webSocket.connected?"Y":"N","WebSocket mode":t,"Try connect":this._reconnectTimeout?"Y":"N","Try number":this._connectionAttempt,Path:this.connector?.connectionPath||"-",...e,"Last message":this._session.mid||"-","Session history":this._session.history,"Watch tags":this._watchTagsQueue.entries()}}getConnectionPath(e){let t;const s={};switch(e){case he.WebSocket:t=this._isSecure?this._config?.server.websocket_secure:this._config?.server.websocket;break;case he.LongPolling:t=this._isSecure?this._config?.server.long_pooling_secure:this._config?.server.long_polling;break;default:throw new Error(`Unknown connection type ${e}`)}if(!P.isStringFilled(t))throw new Error("Empty path");if(typeof this._config?.jwt=="string"&&this._config?.jwt!=="")s.token=this._config?.jwt;else{const n=[];if(this._config?.channels?.private&&n.push(this._config.channels.private?.id||""),this._config?.channels.private?.id&&n.push(this._config.channels.private.id),this._config?.channels.shared?.id&&n.push(this._config.channels.shared.id),n.length===0)throw new Error("Empty channels");s.CHANNEL_ID=n.join("/")}if(this.isJsonRpc()?s.jsonRpc="true":this.isProtobufSupported()&&(s.binaryMode="true"),this.isSharedMode()){if(!this._config?.clientId)throw new Error("Push-server is in shared mode, but clientId is not set");s.clientId=this._config.clientId}return this._session.mid&&(s.mid=this._session.mid),this._session.tag&&(s.tag=this._session.tag),this._session.time&&(s.time=this._session.time),s.revision=vr,`${t}?${z.buildQueryString(s)}`}getPublicationPath(){const e=this._isSecure?this._config?.server.publish_secure:this._config?.server.publish;if(!e)return"";const t=[];this._config?.channels.private?.id&&t.push(this._config.channels.private.id),this._config?.channels.shared?.id&&t.push(this._config.channels.shared.id);const s={CHANNEL_ID:t.join("/")};return e+"?"+z.buildQueryString(s)}isConnected(){return this.connector?this.connector.connected:!1}isWebSocketSupported(){return typeof window.WebSocket<"u"}isWebSocketAllowed(){return this._sharedConfig.isWebSocketBlocked()?!1:this.isWebSocketEnabled()}isWebSocketEnabled(){return!this.isWebSocketSupported()||!this._config||!this._config.server?!1:this._config.server.websocket_enabled}isPublishingSupported(){return this.getServerVersion()>3}isPublishingEnabled(){return this.isPublishingSupported()?this._config?.server.publish_enabled===!0:!1}isProtobufSupported(){return this.getServerVersion()==4&&!No.isIE()}isJsonRpc(){return this.getServerVersion()>=5}isSharedMode(){return this.getServerMode()===Ks.Shared}emit(e){if(e.type==qe.Server||e.type==qe.Client){if(typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof e.moduleId>"u")throw new TypeError(`${z.getDateForLog()}: Pull.emit: parameter moduleId is not specified`);return typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),this._subscribers[e.type][e.moduleId].callbacks.length>0&&this._subscribers[e.type][e.moduleId].callbacks.forEach(t=>{t(e.data,{type:e.type,moduleId:e.moduleId??"?"})}),!(typeof e.data>"u")&&!(typeof e.data.command>"u")&&this._subscribers[e.type][e.moduleId].commands[e.data.command]&&this._subscribers[e.type][e.moduleId].commands[e.data.command].length>0&&this._subscribers[e.type][e.moduleId].commands[e.data.command].forEach(t=>{typeof e.data>"u"||t(e.data.params,e.data.extra,e.data.command,{type:e.type,moduleId:e.moduleId})}),!0}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].length<=0||this._subscribers[e.type].forEach(t=>{t(e.data,{type:e.type})}),!0}broadcastMessage(e){const t=e.module_id=e.module_id.toLowerCase(),s=e.command;e.extra||(e.extra={}),e.extra.server_time_unix&&(e.extra.server_time_ago=(Date.now()-e.extra.server_time_unix*1e3)/1e3-(this._config?.server.timeShift||0),e.extra.server_time_ago=Math.max(e.extra.server_time_ago,0)),this.logMessage(e);try{e.extra.sender&&e.extra.sender.type===Hr.Client?(this.onCustomEvent("onPullClientEvent-"+t,[s,e.params,e.extra],!0),this.onCustomEvent("onPullClientEvent",[t,s,e.params,e.extra],!0),this.emit({type:qe.Client,moduleId:t,data:{command:s,params:P.clone(e.params),extra:P.clone(e.extra)}})):t==="pull"?this.handleInternalPullEvent(s,e):t=="online"?((e?.extra?.server_time_ago||0)<240&&(this.onCustomEvent("onPullOnlineEvent",[s,e.params,e.extra],!0),this.emit({type:qe.Online,data:{command:s,params:P.clone(e.params),extra:P.clone(e.extra)}})),s==="userStatusChange"&&this.emitUserStatusChange(e.params.user_id,e.params.online)):(this.onCustomEvent("onPullEvent-"+t,[s,e.params,e.extra],!0),this.onCustomEvent("onPullEvent",[t,s,e.params,e.extra],!0),this.emit({type:qe.Server,moduleId:t,data:{command:s,params:P.clone(e.params),extra:P.clone(e.extra)}}))}catch(n){this.getLogger().warning("PULL ERROR",{errorType:"broadcastMessages execute error",errorEvent:n,message:e})}e.extra&&e.extra.revision_web&&this.checkRevision(z.toInteger(e.extra.revision_web))}broadcastMessages(e){for(const t of e)this.broadcastMessage(t)}async sendMessageBatch(e){if(!this.isPublishingEnabled())return this.getLogger().error("Client publishing is not supported or is disabled"),Promise.reject(new Error("Client publishing is not supported or is disabled"));if(this.isJsonRpc()){const t=this._jsonRpcAdapter?.createPublishRequest(e);return this.connector?.send(JSON.stringify(t)),Promise.resolve(!0)}else{const t={};for(const s of e)if(typeof s.userList<"u")for(const n of s.userList){const i=Number(n);t[i]=i}this._channelManager?.getPublicIds(Object.values(t)).then(s=>{const n=this.connector?.send(this.encodeMessageBatch(e,s));return Promise.resolve(n)})}}encodeMessageBatch(e,t){const s=[];e.forEach(i=>{const c=i.body;let o=[];if(i.userList&&(o=this.createMessageReceivers(i.userList,t)),i.channelList){if(!P.isArray(i.channelList))throw new TypeError("messageFields.publicChannels must be an array");i.channelList.forEach(h=>{let l,g;if(typeof h=="string"&&h.includes(".")){const p=h.toString().split(".");l=p[0],g=p[1]}else if(typeof h=="object"&&"publicId"in h&&"signature"in h)l=h?.publicId,g=h?.signature;else throw new Error(`Public channel MUST be either a string, formatted like "{publicId}.{signature}" or an object with fields 'publicId' and 'signature'`);o.push(ac.create({id:this.encodeId(l),signature:this.encodeId(g)}))})}const u=by.create({receivers:o,body:JSON.stringify(c),expiry:i.expiry||0});s.push(u)});const n=oc.create({requests:[{incomingMessages:{messages:s}}]});return oc.encode(n).finish()}createMessageReceivers(e,t){const s=[];for(const n of e){if(!t[n]||!t[n].publicId)throw new Error(`Could not determine public id for user ${n}`);s.push(ac.create({id:this.encodeId(t[n].publicId),signature:this.encodeId(t[n].signature)}))}return s}emitUserStatusChange(e,t){if(this._userStatusCallbacks[e])for(const s of this._userStatusCallbacks[e])s({userId:e,isOnline:t})}restoreUserStatusSubscription(){for(const e in this._userStatusCallbacks)Object.prototype.hasOwnProperty.call(this._userStatusCallbacks,e)&&this._userStatusCallbacks[e].length>0&&this._jsonRpcAdapter?.executeOutgoingRpcCommand(st.SubscribeStatusChange,{userId:e})}async loadConfig(e){if(this._config){if(this.isConfigActual(this._config)&&this.checkRevision(this._config.api.revision_web))return Promise.resolve(this._config);this._config=Object.assign({},pc)}else{this._config=Object.assign({},pc);let t;if(this._storage&&(t=this._storage.get(Ue.PullConfig,null)),this.isConfigActual(t)&&this.checkRevision(t.api.revision_web))return Promise.resolve(t);this._storage&&this._storage.remove(Ue.PullConfig)}return new Promise((t,s)=>{this._restClient.actions.v2.call.make({method:this._configGetMethod,params:{CACHE:"N"}}).then(n=>{const i=n.getData().result,c=Math.floor((Date.now()-new Date(i.serverTime).getTime())/1e3);delete i.serverTime;const o=Object.assign({},i);o.server.timeShift=c,t(o)}).catch(n=>{s(n)})})}isConfigActual(e){if(!P.isPlainObject(e)||Number(e.server.config_timestamp)!==this._configTimestamp)return!1;const t=new Date;if(P.isNumber(e.exp)&&e.exp>0&&e.exp<t.getTime()/1e3||Object.keys(e.channels).length===0)return!1;for(const s in e.channels){if(!Object.prototype.hasOwnProperty.call(e.channels,s))continue;const n=e.channels[s];if(new Date(n.end)<t)return!1}return!0}startCheckConfig(){this._checkInterval&&(clearInterval(this._checkInterval),this._checkInterval=null),this._checkInterval=setInterval(this.checkConfig.bind(this),Cy)}stopCheckConfig(){this._checkInterval&&clearInterval(this._checkInterval),this._checkInterval=null}checkConfig(){if(this.isConfigActual(this._config)){if(!this.checkRevision(z.toInteger(this._config?.api.revision_web)))return!1}else this.logToConsole("Stale config detected. Restarting"),this.restart(Re.CONFIG_EXPIRED,"config expired");return!0}setConfig(e,t){for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&Object.prototype.hasOwnProperty.call(this._config,s)&&(this._config[s]=e[s]);if(e.publicChannels&&this.setPublicIds(Object.values(e.publicChannels)),this._configTimestamp=Number(e.server.config_timestamp),this._storage&&t)try{this._storage.set(Ue.PullConfig,e)}catch(s){localStorage&&localStorage.removeItem&&localStorage.removeItem("history"),this.getLogger().error(`${z.getDateForLog()}: Pull: Could not cache config in local storage.`,{error:s})}}setPublicIds(e){this._channelManager.setPublicIds(e)}checkRevision(e){return this._skipCheckRevision?!0:e>0&&e!==vr?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(Re.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[e,vr]),this.emit({type:qe.Revision,data:{server:e,client:vr}}),this.logToConsole(`Pull revision changed from ${vr} to ${e}. Reload required`),!1):!0}disconnect(e,t){this.connector&&(this._isManualDisconnect=!0,this.connector.disconnect(e,t))}restoreWebSocketConnection(){this._connectionType!==he.WebSocket&&this._connectors.webSocket?.connect()}scheduleReconnect(e=0){this._enabled&&(e||(e=this.getConnectionAttemptDelay(this._connectionAttempt)),this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.logToConsole(`Pull: scheduling reconnection in ${e} seconds; attempt # ${this._connectionAttempt}`),this._reconnectTimeout=setTimeout(()=>{this.connect().catch(t=>{this.getLogger().error("scheduleReconnect",{error:t})})},e*1e3))}scheduleRestoreWebSocketConnection(){this.logToConsole(`Pull: scheduling restoration of websocket connection in ${uc} seconds`),!this._restoreWebSocketTimeout&&(this._restoreWebSocketTimeout=setTimeout(()=>{this._restoreWebSocketTimeout=null,this.restoreWebSocketConnection()},uc*1e3))}async connect(){return this._enabled?this.connector?.connected?Promise.resolve():(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.status=Ve.Connecting,this._connectionAttempt++,new Promise((e,t)=>{this._connectPromise={resolve:e,reject:t},this.connector?.connect()})):Promise.reject()}scheduleRestart(e,t,s=0){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),s<1&&(s=Math.ceil(Math.random()*30)+5),this._restartTimeout=setTimeout(()=>this.restart(e,t),s*1e3)}handleRpcIncomingMessage(e){this._session.mid=e.mid;const t=e.body;return e.body.extra||(t.extra={}),t.extra.sender=e.sender,"user_params"in e&&P.isPlainObject(e.user_params)&&Object.assign(t.params,e.user_params),"dictionary"in e&&P.isPlainObject(e.dictionary)&&Object.assign(t.params,e.dictionary),this.checkDuplicate(e.mid)&&(this.addMessageToStat(t),this.trimDuplicates(),this.broadcastMessage(t)),this.connector?.send(`mack:${e.mid}`),{}}handleIncomingEvents(e){const t=[];if(e.length===0){this._session.mid=null;return}for(const s of e)this.updateSessionFromEvent(s),!(s.mid&&!this.checkDuplicate(s.mid))&&(this.addMessageToStat(s.text),t.push(s.text));this.trimDuplicates(),this.broadcastMessages(t)}updateSessionFromEvent(e){this._session.mid=e.mid||null,this._session.tag=e.tag||null,this._session.time=e.time||null}handleInternalPullEvent(e,t){switch(e.toUpperCase()){case ur.CHANNEL_EXPIRE:{if(t.params.action==="reconnect"){const s=t.params?.channel.type;s==="private"&&this._config?.channels?.private&&(this._config.channels.private=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.private}`)),s==="shared"&&this._config?.channels?.shared&&(this._config.channels.shared=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.shared}`)),this.reconnect(Re.CONFIG_REPLACED,"config was replaced")}else this.restart(Re.CHANNEL_EXPIRED,"channel expired received");break}case ur.CONFIG_EXPIRE:{this.restart(Re.CONFIG_EXPIRED,"config expired received");break}case ur.SERVER_RESTART:{this.reconnect(Re.SERVER_RESTARTED,"server was restarted",15);break}}}onIncomingMessage(e){if(this.isJsonRpc())e===Ny?this.onJsonRpcPing():this._jsonRpcAdapter?.parseJsonRpcMessage(e);else{const t=this.extractMessages(e);this.handleIncomingEvents(t)}}onLongPollingOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Ve.Online,this.logToConsole("Pull: Long polling connection with push-server opened"),this.isWebSocketEnabled()&&this.scheduleRestoreWebSocketConnection(),this._connectPromise&&this._connectPromise.resolve({})}onLongPollingDisconnect(e){this._connectionType===he.LongPolling&&(this.status=Ve.Offline),this.logToConsole(`Pull: Long polling connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`),this._isManualDisconnect||this.scheduleReconnect(),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onLongPollingError(e){this._starting=!1,this._connectionType===he.LongPolling&&(this.status=Ve.Offline),this.getLogger().error(`${z.getDateForLog()}: Pull: Long polling connection error`,{error:e}),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}onWebSocketBlockChanged(e){const t=e.isWebSocketBlocked;t&&this._connectionType===he.WebSocket&&!this.isConnected()?(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._connectionAttempt=0,this._connectionType=he.LongPolling,this.scheduleReconnect(1)):!t&&this._connectionType===he.LongPolling&&(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this._connectionAttempt=0,this._connectionType=he.WebSocket,this.scheduleReconnect(1))}onWebSocketOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Ve.Online,this._sharedConfig.setWebSocketBlocked(!1),this._sharedConfig.setLongPollingBlocked(!0),this._connectionType==he.LongPolling&&(this._connectionType=he.WebSocket,this._connectors.longPolling?.disconnect(Re.CONFIG_REPLACED,"Fire at onWebSocketOpen")),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this.logToConsole("Pull: Websocket connection with push-server opened"),this._connectPromise&&this._connectPromise.resolve({}),this.restoreUserStatusSubscription()}onWebSocketDisconnect(e){this._connectionType===he.WebSocket&&(this.status=Ve.Offline),this.logToConsole(`Pull: Websocket connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`,!0),this._isManualDisconnect||(e.code==Re.WRONG_CHANNEL_ID?this.scheduleRestart(Re.WRONG_CHANNEL_ID,"wrong channel signature"):this.scheduleReconnect()),this._sharedConfig.setLongPollingBlocked(!0),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onWebSocketError(e){this._starting=!1,this._connectionType===he.WebSocket&&(this.status=Ve.Offline),this.getLogger().error(`${z.getDateForLog()}: Pull: WebSocket connection error`,{error:e}),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}extractMessages(e){if(e instanceof ArrayBuffer)return this.extractProtobufMessages(e);if(P.isStringFilled(e))return this.extractPlainTextMessages(e);throw new Error("Error pullEvent type")}extractProtobufMessages(e){const t=[];try{const s=yy.decode(new Uint8Array(e));for(let n=0;n<s.responses.length;n++){const i=s.responses[n];if(i.command!=="outgoingMessages")continue;const c=i.outgoingMessages.messages;for(const o of c){let u;try{u=JSON.parse(o.body)}catch(l){this.getLogger().error(`${z.getDateForLog()}: Pull: Could not parse message body`,{error:l});continue}u.extra||(u.extra={}),u.extra.sender={type:o.sender.type},o.sender.id instanceof Uint8Array&&(u.extra.sender.id=this.decodeId(o.sender.id));const h={mid:this.decodeId(o.id),text:u};t.push(h)}}}catch(s){this.getLogger().error(`${z.getDateForLog()}: Pull: Could not parse message`,{error:s})}return t}extractPlainTextMessages(e){const t=[],s=e.match(/#!NGINXNMS!#(.*?)#!NGINXNME!#/g);if(s===null)return this.getLogger().warning("PULL ERROR",{errorType:"parseResponse error parsing message",dataString:e}),[];for(let n=0;n<s.length;n++){if(s[n]=s[n].substring(12,s[n].length-12),s[n].length<=0)continue;let i;try{i=JSON.parse(s[n])}catch{continue}t.push(i)}return t}decodeId(e){let t="";for(const s of e){const n=s.toString(16);n.length===1&&(t+="0"),t+=n}return t}encodeId(e){if(!e)return new Uint8Array;const t=[];for(let s=0;s<e.length;s+=2)t.push(Number.parseInt(e.slice(s,s+2),16));return new Uint8Array(t)}onOffline(){this.disconnect(Re.NORMAL_CLOSURE,"offline")}onOnline(){this.connect().catch(e=>{this.getLogger().error("onOnline",{error:e})})}onBeforeUnload(){this._unloading=!0;const e=P.clone(this.session);if(e.ttl=Date.now()+My*1e3,this._storage)try{this._storage.set(fc,JSON.stringify(e))}catch(t){this.getLogger().error(`${z.getDateForLog()}: Pull: Could not save session info in local storage. Error: `,{error:t})}this.scheduleReconnect(15)}sendPullStatusDelayed(e,t){this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),this._offlineTimeout=setTimeout(()=>{this._offlineTimeout=null,this.sendPullStatus(e)},t)}sendPullStatus(e){this._unloading||(this.onCustomEvent("onPullStatus",[e]),this.emit({type:qe.Status,data:{status:e}}))}extendWatch(e,t=!1){this._watchTagsQueue.get(e)||(this._watchTagsQueue.set(e,!0),t&&this.updateWatch(t))}updateWatch(e=!1){this._watchUpdateTimeout&&(clearTimeout(this._watchUpdateTimeout),this._watchUpdateTimeout=null),this._watchUpdateTimeout=setTimeout(()=>{const t=[...this._watchTagsQueue.keys()];t.length>0?this._restClient.actions.v2.call.make({method:"pull.watch.extend",params:{tags:t}}).then(s=>{const n=s.getData().result;for(const i of n)this.clearWatch(i);this.updateWatch()}).catch(()=>{this.updateWatch()}):this.updateWatch()},e?this._watchForceUpdateInterval:this._watchUpdateInterval)}clearWatch(e){this._watchTagsQueue.delete(e)}onJsonRpcPing(){this.updatePingWaitTimeout(),this.connector?.send(Dy)}updatePingWaitTimeout(){this._pingWaitTimeout&&(clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null),this._pingWaitTimeout=setTimeout(this._onPingTimeoutHandler,dc*2*1e3)}clearPingWaitTimeout(){this._pingWaitTimeout&&clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null}onPingTimeout(){this._pingWaitTimeout=null,!(!this._enabled||!this.isConnected())&&(this.getLogger().warning(`No pings are received in ${dc*2} seconds. Reconnecting`),this.disconnect(Re.STUCK,"connection stuck"),this.scheduleReconnect())}getConnectionAttemptDelay(e){let t;return e<1?t=.5:e<3?t=15:e<5?t=45:e<10?t=600:t=3600,t+t*Math.random()*.2}checkDuplicate(e){return this._session.lastMessageIds.includes(e)?(this.getLogger().warning(`Duplicate message ${e} skipped`),!1):(this._session.lastMessageIds.push(e),!0)}trimDuplicates(){this._session.lastMessageIds.length>hc&&(this._session.lastMessageIds=this._session.lastMessageIds.slice(-hc))}logMessage(e){this._debug&&(e.extra?.sender&&e.extra.sender.type===Hr.Client?this.getLogger().info(`onPullClientEvent-${e.module_id}`,{command:e.command,params:e.params,extra:e.extra}):e.module_id=="online"?this.getLogger().info("onPullOnlineEvent",{command:e.command,params:e.params,extra:e.extra}):this.getLogger().info("onPullEvent",{moduleId:e.module_id,command:e.command,params:e.params,extra:e.extra}))}logToConsole(e,t=!1){(this._loggingEnabled||t)&&this.getLogger().debug(`${z.getDateForLog()}: ${e}`)}addMessageToStat(e){this._session.history[e.module_id]||(this._session.history[e.module_id]={}),this._session.history[e.module_id][e.command]||(this.session.history[e.module_id][e.command]=0),this._session.history[e.module_id][e.command]++,this._session.messageCount++}showNotification(e){this.getLogger().notice(e)}onCustomEvent(e,t,s=!1){}}var Py=Object.defineProperty,Ly=a((r,e)=>Py(r,"name",{value:e,configurable:!0}),"l$1");class Fy{static{a(this,"B24HelperManager")}static{Ly(this,"B24HelperManager")}_b24;_isInit=!1;_profile=null;_app=null;_payment=null;_license=null;_currency=null;_appOptions=null;_userOptions=null;_b24PullClient=null;_pullClientUnSubscribe=[];_pullClientModuleId="";_logger;constructor(e){this._logger=ee.createNullLogger(),this._b24=e}setLogger(e){this._logger=e,this._profile!==null&&this._profile.setLogger(this.getLogger()),this._app!==null&&this._app.setLogger(this.getLogger()),this._payment!==null&&this._payment.setLogger(this.getLogger()),this._license!==null&&this._license.setLogger(this.getLogger()),this._currency!==null&&this._currency.setLogger(this.getLogger()),this._appOptions!==null&&this._appOptions.setLogger(this.getLogger()),this._userOptions!==null&&this._userOptions.setLogger(this.getLogger())}getLogger(){return this._logger}destroy(){this._destroyPullClient()}async loadData(e=[le.App,le.Profile],t="helper-load-data"){const s={[le.App]:{method:"app.info"},[le.Profile]:{method:"profile"},[le.Currency]:[{method:"crm.currency.base.get"},{method:"crm.currency.list"}],[le.AppOptions]:{method:"app.option.get"},[le.UserOptions]:{method:"user.option.get"}},n=e.reduce((i,c)=>{if(s[c])if(Array.isArray(s[c]))for(const[o,u]of s[c].entries())i[`get_${c}_${o}`]=u;else i[`get_${c}`]=s[c];return i},{});try{const i=(await this._b24.actions.v2.batch.make({calls:n,options:{isHaltOnError:!0,returnAjaxResult:!1,requestId:t}})).getData();i[`get_${le.App}`]&&(this._app=await this.parseAppData(i[`get_${le.App}`]),this._payment=await this.parsePaymentData(i[`get_${le.App}`]),this._license=await this.parseLicenseData(i[`get_${le.App}`])),i[`get_${le.Profile}`]&&(this._profile=await this.parseUserData(i[`get_${le.Profile}`])),i[`get_${le.Currency}_0`]&&i[`get_${le.Currency}_1`]&&(this._currency=await this.parseCurrencyData({currencyBase:i[`get_${le.Currency}_0`],currencyList:i[`get_${le.Currency}_1`]})),i[`get_${le.AppOptions}`]&&(this._appOptions=await this.parseOptionsData("app",i[`get_${le.AppOptions}`])),i[`get_${le.UserOptions}`]&&(this._userOptions=await this.parseOptionsData("user",i[`get_${le.UserOptions}`])),this._isInit=!0}catch(i){throw i instanceof Error?i:(this.getLogger().error("Failed to load data",{error:i}),new Error("Failed to load data"))}}async parseUserData(e){const t=new $m(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 Um(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 Wm(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 Jm(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 Zm(this._b24);return t.setLogger(this.getLogger()),t.initData(e).then(()=>t)}async parseOptionsData(e,t){const s=new Pn(this._b24,e);return s.setLogger(this.getLogger()),s.initData(t).then(()=>s)}get isInit(){return this._isInit}get forB24Form(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");if(this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return{app_code:this.appInfo.data.code,app_status:this.appInfo.data.status,payment_expired:this.paymentInfo.data.isExpired?"Y":"N",days:this.paymentInfo.data.days,b24_plan:this.licenseInfo.data.license,c_name:this.profileInfo.data.name,c_last_name:this.profileInfo.data.lastName,hostname:this.hostName}}get hostName(){return this._b24.getTargetOrigin()}get profileInfo(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");return this._profile}get appInfo(){if(this.ensureInitialized(),this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return this._app}get paymentInfo(){if(this.ensureInitialized(),this._payment===null)throw new Error("B24HelperManager.paymentInfo not initialized");return this._payment}get licenseInfo(){if(this.ensureInitialized(),this._license===null)throw new Error("B24HelperManager.licenseInfo not initialized");return this._license}get currency(){if(this.ensureInitialized(),this._currency===null)throw new Error("B24HelperManager.currency not initialized");return this._currency}get appOptions(){if(this.ensureInitialized(),this._appOptions===null)throw new Error("B24HelperManager.appOptions not initialized");return this._appOptions}get userOptions(){if(this.ensureInitialized(),this._userOptions===null)throw new Error("B24HelperManager.userOptions not initialized");return this._userOptions}get isSelfHosted(){return this.licenseInfo.data.isSelfHosted}get primaryKeyIncrementValue(){return this.isSelfHosted?1:2}get b24SpecificUrl(){return this.isSelfHosted?{[kt.MainSettings]:"/configs/",[kt.UfList]:"/configs/userfield_list.php",[kt.UfPage]:"/configs/userfield.php"}:{[kt.MainSettings]:"/settings/configs/",[kt.UfList]:"/settings/configs/userfield_list.php",[kt.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 gc({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(`${z.getDateForLog()}: Pull not running`,{error:e})})}getModuleIdPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId}_destroyPullClient(){for(const e of this._pullClientUnSubscribe)e();this._b24PullClient?.destroy(),this._b24PullClient=null}ensureInitialized(){if(!this._isInit)throw new Error("B24HelperManager not initialized")}}var xy=Object.defineProperty,_t=a((r,e)=>xy(r,"name",{value:e,configurable:!0}),"l");const $y=_t(()=>{let r=!1,e=!1,t=null;return{initB24Helper:_t(async(s,n=[le.App,le.Profile],i="helper-load-data")=>(t===null&&(t=new Fy(s)),r||(await t.loadData(n,i),r=!0),t),"initB24Helper"),isInitB24Helper:_t(()=>r,"isInitB24Helper"),destroyB24Helper:_t(()=>{t?.destroy(),t=null,r=!1,e=!1},"destroyB24Helper"),getB24Helper:_t(()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");return t},"getB24Helper"),usePullClient:_t(()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");t.usePullClient(),e=!0},"usePullClient"),useSubscribePullClient:_t((s,n="application")=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.subscribePullClient(s,n)},"useSubscribePullClient"),startPullClient:_t(()=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.startPullClient()},"startPullClient")}},"useB24Helper");var jy=Object.defineProperty,Fn=a((r,e)=>jy(r,"name",{value:e,configurable:!0}),"n");const By=50;let wt=null,hs=!1,Zt=null,mc=!1,ds=[],yc=!1;function xn(){window.setTimeout(()=>{if(!hs||wt===null){xn();return}bc(),ds=[]},By)}a(xn,"p"),Fn(xn,"startWatch");function bc(){if(Zt!==null)for(const r of ds)r.reject(Zt);if(!(!hs||wt===null))for(const r of ds)r.resolve(wt)}a(bc,"I"),Fn(bc,"processResult");async function _c(r){return hs&&wt!==null?Promise.resolve(wt):mc?(yc||(yc=!0,xn()),new Promise((e,t)=>{ds.push({resolve:e,reject:t})})):(mc=!0,new Promise((e,t)=>{const s={DOMAIN:null,PROTOCOL:!1,APP_SID:null,LANG:null};if(window.name){const[n,i,c]=window.name.split("|");s.DOMAIN=n,s.PROTOCOL=Number.parseInt(i??"0")===1,s.APP_SID=c,s.LANG=null}(!s.DOMAIN||!s.APP_SID)&&(Zt=new ne({code:"JSSDK_CLIENT_SIDE_WARNING",description:"Well done! Now paste this URL into the Bitrix24 app settings",status:500}),t(Zt)),wt=new Qa(s,r),wt.init().then(()=>{hs=!0,e(wt)}).catch(n=>{Zt=n,t(Zt)})}))}a(_c,"initializeB24Frame"),Fn(_c,"initializeB24Frame"),R.AbstractB24=Yr,R.AbstractLogger=Js,R.AdaptiveDelayer=Jo,R.AjaxError=be,R.AjaxResult=dr,R.ApiVersion=K,R.AppFrame=Ha,R.AuthHookManager=qa,R.AuthManager=za,R.AuthOAuthManager=tc,R.B24Frame=Qa,R.B24Hook=Dn,R.B24LangList=Qs,R.B24LocaleMap=Hh,R.B24OAuth=Pm,R.B24PullClientManager=gc,R.Browser=No,R.CatalogProductImageType=Fo,R.CatalogProductType=Lo,R.CatalogRoundingRuleType=xo,R.CloseReasons=Re,R.ConnectionType=he,R.ConsolaAdapter=ch,R.ConsoleHandler=So,R.ConsoleV2Handler=zs,R.DataType=Eo,R.DialogManager=Za,R.EnumAppStatus=lt,R.EnumBitrix24Edition=$o,R.EnumBizprocBaseType=jo,R.EnumBizprocDocumentType=Bo,R.EnumCrmEntityType=Do,R.EnumCrmEntityTypeId=Qe,R.EnumCrmEntityTypeShort=Zs,R.Environment=ar,R.HttpV2=cs,R.HttpV3=ls,R.JsonFormatter=xu,R.LineFormatter=Br,R.ListRpcError=Xs,R.LoadDataType=le,R.LogLevel=H,R.Logger=lr,R.LoggerBrowser=Gs,R.LoggerFactory=ee,R.LoggerType=vo,R.LsKeys=Ue,R.MemoryHandler=rh,R.MessageCommands=ie,R.MessageManager=Wa,R.NullLogger=cr,R.OperatingLimiter=zo,R.OptionsManager=Ga,R.ParamsFactory=tn,R.ParentManager=Ja,R.PlacementManager=Xa,R.ProductRowDiscountTypeId=Po,R.PullStatus=Ve,R.RateLimiter=Ho,R.RefreshTokenError=ec,R.RestrictionManager=fr,R.Result=Pe,R.RpcMethod=st,R.SdkError=ne,R.SenderType=Hr,R.ServerMode=Ks,R.SliderManager=Ka,R.StatusDescriptions=Wo,R.StreamHandler=ih,R.SubscriptionType=qe,R.SystemCommands=ur,R.TelegramFormatter=wo,R.TelegramHandler=mh,R.Text=z,R.Type=P,R.TypeOption=ut,R.TypeSpecificUrl=kt,R.WinstonAdapter=hh,R.convertBizprocDocumentTypeToCrmEntityTypeId=Uo,R.getDocumentId=Vo,R.getDocumentType=Wr,R.getDocumentTypeForFilter=qo,R.getEnumCrmEntityTypeShort=Mo,R.getEnumValue=ko,R.getEnvironment=Ur,R.initializeB24Frame=_c,R.isArrayOfArray=To,R.memoryUsageProcessor=Ju,R.omit=Ys,R.pick=Oo,R.pidProcessor=Wu,R.useB24Helper=$y,R.useFormatter=om,R.versionManager=nt}));
|
|
62
|
+
}`}return a(p,"s"),t(p,"toString"),g.toString=p,g}a(o,"l"),t(o,"codegen"),o.verbose=!1},{}],4:[function(n,i,c){i.exports=o;function o(){this._listeners={}}a(o,"l"),t(o,"EventEmitter"),o.prototype.on=t(function(l,h,u){return(this._listeners[l]||(this._listeners[l]=[])).push({fn:h,ctx:u||this}),this},"on"),o.prototype.off=t(function(l,h){if(l===s)this._listeners={};else if(h===s)this._listeners[l]=[];else for(var u=this._listeners[l],g=0;g<u.length;)u[g].fn===h?u.splice(g,1):++g;return this},"off"),o.prototype.emit=t(function(l){var h=this._listeners[l];if(h){for(var u=[],g=1;g<arguments.length;)u.push(arguments[g++]);for(g=0;g<h.length;)h[g].fn.apply(h[g++].ctx,u)}return this},"emit")},{}],5:[function(n,i,c){i.exports=u;var o=n(1),l=n(7),h=l("fs");function u(g,p,d){return typeof p=="function"?(d=p,p={}):p||(p={}),d?!p.xhr&&h&&h.readFile?h.readFile(g,t(function(f,m){return f&&typeof XMLHttpRequest<"u"?u.xhr(g,p,d):f?d(f):d(null,p.binary?m:m.toString("utf8"))},"fetchReadFileCallback")):u.xhr(g,p,d):o(u,this,g,p)}a(u,"u"),t(u,"fetch"),u.xhr=t(function(g,p,d){var f=new XMLHttpRequest;f.onreadystatechange=t(function(){if(f.readyState!==4)return s;if(f.status!==0&&f.status!==200)return d(Error("status "+f.status));if(p.binary){var m=f.response;if(!m){m=[];for(var y=0;y<f.responseText.length;++y)m.push(f.responseText.charCodeAt(y)&255)}return d(null,typeof Uint8Array<"u"?new Uint8Array(m):m)}return d(null,f.responseText)},"fetchOnReadyStateChange"),p.binary&&("overrideMimeType"in f&&f.overrideMimeType("text/plain; charset=x-user-defined"),f.responseType="arraybuffer"),f.open("GET",g),f.send()},"fetch_xhr")},{1:1,7:7}],6:[function(n,i,c){i.exports=o(o);function o(p){return typeof Float32Array<"u"?(function(){var d=new Float32Array([-0]),f=new Uint8Array(d.buffer),m=f[3]===128;function y(S,T,v){d[0]=S,T[v]=f[0],T[v+1]=f[1],T[v+2]=f[2],T[v+3]=f[3]}a(y,"f"),t(y,"writeFloat_f32_cpy");function b(S,T,v){d[0]=S,T[v]=f[3],T[v+1]=f[2],T[v+2]=f[1],T[v+3]=f[0]}a(b,"n"),t(b,"writeFloat_f32_rev"),p.writeFloatLE=m?y:b,p.writeFloatBE=m?b:y;function _(S,T){return f[0]=S[T],f[1]=S[T+1],f[2]=S[T+2],f[3]=S[T+3],d[0]}a(_,"o"),t(_,"readFloat_f32_cpy");function w(S,T){return f[3]=S[T],f[2]=S[T+1],f[1]=S[T+2],f[0]=S[T+3],d[0]}a(w,"p"),t(w,"readFloat_f32_rev"),p.readFloatLE=m?_:w,p.readFloatBE=m?w:_})():(function(){function d(m,y,b,_){var w=y<0?1:0;if(w&&(y=-y),y===0)m(1/y>0?0:2147483648,b,_);else if(isNaN(y))m(2143289344,b,_);else if(y>34028234663852886e22)m((w<<31|2139095040)>>>0,b,_);else if(y<11754943508222875e-54)m((w<<31|Math.round(y/1401298464324817e-60))>>>0,b,_);else{var S=Math.floor(Math.log(y)/Math.LN2),T=Math.round(y*Math.pow(2,-S)*8388608)&8388607;m((w<<31|S+127<<23|T)>>>0,b,_)}}a(d,"t"),t(d,"writeFloat_ieee754"),p.writeFloatLE=d.bind(null,l),p.writeFloatBE=d.bind(null,h);function f(m,y,b){var _=m(y,b),w=(_>>31)*2+1,S=_>>>23&255,T=_&8388607;return S===255?T?NaN:w*(1/0):S===0?w*1401298464324817e-60*T:w*Math.pow(2,S-150)*(T+8388608)}a(f,"r"),t(f,"readFloat_ieee754"),p.readFloatLE=f.bind(null,u),p.readFloatBE=f.bind(null,g)})(),typeof Float64Array<"u"?(function(){var d=new Float64Array([-0]),f=new Uint8Array(d.buffer),m=f[7]===128;function y(S,T,v){d[0]=S,T[v]=f[0],T[v+1]=f[1],T[v+2]=f[2],T[v+3]=f[3],T[v+4]=f[4],T[v+5]=f[5],T[v+6]=f[6],T[v+7]=f[7]}a(y,"f"),t(y,"writeDouble_f64_cpy");function b(S,T,v){d[0]=S,T[v]=f[7],T[v+1]=f[6],T[v+2]=f[5],T[v+3]=f[4],T[v+4]=f[3],T[v+5]=f[2],T[v+6]=f[1],T[v+7]=f[0]}a(b,"n"),t(b,"writeDouble_f64_rev"),p.writeDoubleLE=m?y:b,p.writeDoubleBE=m?b:y;function _(S,T){return f[0]=S[T],f[1]=S[T+1],f[2]=S[T+2],f[3]=S[T+3],f[4]=S[T+4],f[5]=S[T+5],f[6]=S[T+6],f[7]=S[T+7],d[0]}a(_,"o"),t(_,"readDouble_f64_cpy");function w(S,T){return f[7]=S[T],f[6]=S[T+1],f[5]=S[T+2],f[4]=S[T+3],f[3]=S[T+4],f[2]=S[T+5],f[1]=S[T+6],f[0]=S[T+7],d[0]}a(w,"p"),t(w,"readDouble_f64_rev"),p.readDoubleLE=m?_:w,p.readDoubleBE=m?w:_})():(function(){function d(m,y,b,_,w,S){var T=_<0?1:0;if(T&&(_=-_),_===0)m(0,w,S+y),m(1/_>0?0:2147483648,w,S+b);else if(isNaN(_))m(0,w,S+y),m(2146959360,w,S+b);else if(_>17976931348623157e292)m(0,w,S+y),m((T<<31|2146435072)>>>0,w,S+b);else{var v;if(_<22250738585072014e-324)v=_/5e-324,m(v>>>0,w,S+y),m((T<<31|v/4294967296)>>>0,w,S+b);else{var R=Math.floor(Math.log(_)/Math.LN2);R===1024&&(R=1023),v=_*Math.pow(2,-R),m(v*4503599627370496>>>0,w,S+y),m((T<<31|R+1023<<20|v*1048576&1048575)>>>0,w,S+b)}}}a(d,"t"),t(d,"writeDouble_ieee754"),p.writeDoubleLE=d.bind(null,l,0,4),p.writeDoubleBE=d.bind(null,h,4,0);function f(m,y,b,_,w){var S=m(_,w+y),T=m(_,w+b),v=(T>>31)*2+1,R=T>>>20&2047,O=4294967296*(T&1048575)+S;return R===2047?O?NaN:v*(1/0):R===0?v*5e-324*O:v*Math.pow(2,R-1075)*(O+4503599627370496)}a(f,"r"),t(f,"readDouble_ieee754"),p.readDoubleLE=f.bind(null,u,0,4),p.readDoubleBE=f.bind(null,g,4,0)})(),p}a(o,"l"),t(o,"factory");function l(p,d,f){d[f]=p&255,d[f+1]=p>>>8&255,d[f+2]=p>>>16&255,d[f+3]=p>>>24}a(l,"d"),t(l,"writeUintLE");function h(p,d,f){d[f]=p>>>24,d[f+1]=p>>>16&255,d[f+2]=p>>>8&255,d[f+3]=p&255}a(h,"c"),t(h,"writeUintBE");function u(p,d){return(p[d]|p[d+1]<<8|p[d+2]<<16|p[d+3]<<24)>>>0}a(u,"u"),t(u,"readUintLE");function g(p,d){return(p[d]<<24|p[d+1]<<16|p[d+2]<<8|p[d+3])>>>0}a(g,"a"),t(g,"readUintBE")},{}],7:[function(n,i,c){i.exports=o;function o(l){try{var h=n(l);if(h&&(h.length||Object.keys(h).length))return h}catch{}return null}a(o,"l"),t(o,"inquire")},{}],8:[function(n,i,c){var o=c,l=o.isAbsolute=t(function(u){return/^(?:\/|\w+:)/.test(u)},"isAbsolute"),h=o.normalize=t(function(u){u=u.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var g=u.split("/"),p=l(u),d="";p&&(d=g.shift()+"/");for(var f=0;f<g.length;)g[f]===".."?f>0&&g[f-1]!==".."?g.splice(--f,2):p?g.splice(f,1):++f:g[f]==="."?g.splice(f,1):++f;return d+g.join("/")},"normalize");o.resolve=t(function(u,g,p){return p||(g=h(g)),l(g)?g:(p||(u=h(u)),(u=u.replace(/(?:\/|^)[^/]+$/,"")).length?h(u+"/"+g):g)},"resolve")},{}],9:[function(n,i,c){i.exports=o;function o(l,h,u){var g=u||8192,p=g>>>1,d=null,f=g;return t(function(m){if(m<1||m>p)return l(m);f+m>g&&(d=l(g),f=0);var y=h.call(d,f,f+=m);return f&7&&(f=(f|7)+1),y},"pool_alloc")}a(o,"l"),t(o,"pool")},{}],10:[function(n,i,c){var o=c;o.length=t(function(l){for(var h=0,u=0,g=0;g<l.length;++g)u=l.charCodeAt(g),u<128?h+=1:u<2048?h+=2:(u&64512)===55296&&(l.charCodeAt(g+1)&64512)===56320?(++g,h+=4):h+=3;return h},"utf8_length"),o.read=t(function(l,h,u){var g=u-h;if(g<1)return"";for(var p=null,d=[],f=0,m;h<u;)m=l[h++],m<128?d[f++]=m:m>191&&m<224?d[f++]=(m&31)<<6|l[h++]&63:m>239&&m<365?(m=((m&7)<<18|(l[h++]&63)<<12|(l[h++]&63)<<6|l[h++]&63)-65536,d[f++]=55296+(m>>10),d[f++]=56320+(m&1023)):d[f++]=(m&15)<<12|(l[h++]&63)<<6|l[h++]&63,f>8191&&((p||(p=[])).push(String.fromCharCode.apply(String,d)),f=0);return p?(f&&p.push(String.fromCharCode.apply(String,d.slice(0,f))),p.join("")):String.fromCharCode.apply(String,d.slice(0,f))},"utf8_read"),o.write=t(function(l,h,u){for(var g=u,p,d,f=0;f<l.length;++f)p=l.charCodeAt(f),p<128?h[u++]=p:p<2048?(h[u++]=p>>6|192,h[u++]=p&63|128):(p&64512)===55296&&((d=l.charCodeAt(f+1))&64512)===56320?(p=65536+((p&1023)<<10)+(d&1023),++f,h[u++]=p>>18|240,h[u++]=p>>12&63|128,h[u++]=p>>6&63|128,h[u++]=p&63|128):(h[u++]=p>>12|224,h[u++]=p>>6&63|128,h[u++]=p&63|128);return u-g},"utf8_write")},{}],11:[function(n,i,c){i.exports=l;var o=/\/|\./;function l(u,g){o.test(u)||(u="google/protobuf/"+u+".proto",g={nested:{google:{nested:{protobuf:{nested:g}}}}}),l[u]=g}a(l,"d"),t(l,"common"),l("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var h;l("duration",{Duration:h={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),l("timestamp",{Timestamp:h}),l("empty",{Empty:{fields:{}}}),l("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}}}}),l("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}}}}),l("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),l.get=t(function(u){return l[u]||null},"get")},{}],12:[function(n,i,c){var o=c,l=n(15),h=n(37);function u(p,d,f,m){if(d.resolvedType)if(d.resolvedType instanceof l){p("switch(d%s){",m);for(var y=d.resolvedType.values,b=Object.keys(y),_=0;_<b.length;++_)d.repeated&&y[b[_]]===d.typeDefault&&p("default:"),p("case%j:",b[_])("case %i:",y[b[_]])("m%s=%j",m,y[b[_]])("break");p("}")}else p('if(typeof d%s!=="object")',m)("throw TypeError(%j)",d.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",m,f,m);else{var w=!1;switch(d.type){case"double":case"float":p("m%s=Number(d%s)",m,m);break;case"uint32":case"fixed32":p("m%s=d%s>>>0",m,m);break;case"int32":case"sint32":case"sfixed32":p("m%s=d%s|0",m,m);break;case"uint64":w=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":p("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",m,m,w)('else if(typeof d%s==="string")',m)("m%s=parseInt(d%s,10)",m,m)('else if(typeof d%s==="number")',m)("m%s=d%s",m,m)('else if(typeof d%s==="object")',m)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",m,m,m,w?"true":"");break;case"bytes":p('if(typeof d%s==="string")',m)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",m,m,m)("else if(d%s.length)",m)("m%s=d%s",m,m);break;case"string":p("m%s=String(d%s)",m,m);break;case"bool":p("m%s=Boolean(d%s)",m,m);break}}return p}a(u,"u"),t(u,"genValuePartial_fromObject"),o.fromObject=t(function(p){var d=p.fieldsArray,f=h.codegen(["d"],p.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!d.length)return f("return new this.ctor");f("var m=new this.ctor");for(var m=0;m<d.length;++m){var y=d[m].resolve(),b=h.safeProp(y.name);y.map?(f("if(d%s){",b)('if(typeof d%s!=="object")',b)("throw TypeError(%j)",y.fullName+": object expected")("m%s={}",b)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",b),u(f,y,m,b+"[ks[i]]")("}")("}")):y.repeated?(f("if(d%s){",b)("if(!Array.isArray(d%s))",b)("throw TypeError(%j)",y.fullName+": array expected")("m%s=[]",b)("for(var i=0;i<d%s.length;++i){",b),u(f,y,m,b+"[i]")("}")("}")):(y.resolvedType instanceof l||f("if(d%s!=null){",b),u(f,y,m,b),y.resolvedType instanceof l||f("}"))}return f("return m")},"fromObject");function g(p,d,f,m){if(d.resolvedType)d.resolvedType instanceof l?p("d%s=o.enums===String?types[%i].values[m%s]:m%s",m,f,m,m):p("d%s=types[%i].toObject(m%s,o)",m,f,m);else{var y=!1;switch(d.type){case"double":case"float":p("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",m,m,m,m);break;case"uint64":y=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":p('if(typeof m%s==="number")',m)("d%s=o.longs===String?String(m%s):m%s",m,m,m)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",m,m,m,m,y?"true":"",m);break;case"bytes":p("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",m,m,m,m,m);break;default:p("d%s=m%s",m,m);break}}return p}a(g,"a"),t(g,"genValuePartial_toObject"),o.toObject=t(function(p){var d=p.fieldsArray.slice().sort(h.compareFieldsById);if(!d.length)return h.codegen()("return {}");for(var f=h.codegen(["m","o"],p.name+"$toObject")("if(!o)")("o={}")("var d={}"),m=[],y=[],b=[],_=0;_<d.length;++_)d[_].partOf||(d[_].resolve().repeated?m:d[_].map?y:b).push(d[_]);if(m.length){for(f("if(o.arrays||o.defaults){"),_=0;_<m.length;++_)f("d%s=[]",h.safeProp(m[_].name));f("}")}if(y.length){for(f("if(o.objects||o.defaults){"),_=0;_<y.length;++_)f("d%s={}",h.safeProp(y[_].name));f("}")}if(b.length){for(f("if(o.defaults){"),_=0;_<b.length;++_){var w=b[_],S=h.safeProp(w.name);w.resolvedType instanceof l?f("d%s=o.enums===String?%j:%j",S,w.resolvedType.valuesById[w.typeDefault],w.typeDefault):w.long?f("if(util.Long){")("var n=new util.Long(%i,%i,%j)",w.typeDefault.low,w.typeDefault.high,w.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",S)("}else")("d%s=o.longs===String?%j:%i",S,w.typeDefault.toString(),w.typeDefault.toNumber()):w.bytes?f("d%s=o.bytes===String?%j:%s",S,String.fromCharCode.apply(String,w.typeDefault),"["+Array.prototype.slice.call(w.typeDefault).join(",")+"]"):f("d%s=%j",S,w.typeDefault)}f("}")}var T=!1;for(_=0;_<d.length;++_){var w=d[_],v=p._fieldsArray.indexOf(w),S=h.safeProp(w.name);w.map?(T||(T=!0,f("var ks2")),f("if(m%s&&(ks2=Object.keys(m%s)).length){",S,S)("d%s={}",S)("for(var j=0;j<ks2.length;++j){"),g(f,w,v,S+"[ks2[j]]")("}")):w.repeated?(f("if(m%s&&m%s.length){",S,S)("d%s=[]",S)("for(var j=0;j<m%s.length;++j){",S),g(f,w,v,S+"[j]")("}")):(f("if(m%s!=null&&m.hasOwnProperty(%j)){",S,w.name),g(f,w,v,S),w.partOf&&f("if(o.oneofs)")("d%s=%j",h.safeProp(w.partOf.name),w.name)),f("}")}return f("return d")},"toObject")},{15:15,37:37}],13:[function(n,i,c){i.exports=g;var o=n(15),l=n(36),h=n(37);function u(p){return"missing required '"+p.name+"'"}a(u,"u"),t(u,"missing");function g(p){var d=h.codegen(["r","l"],p.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(p.fieldsArray.filter(function(w){return w.map}).length?",k":""))("while(r.pos<c){")("var t=r.uint32()");p.group&&d("if((t&7)===4)")("break"),d("switch(t>>>3){");for(var f=0;f<p.fieldsArray.length;++f){var m=p._fieldsArray[f].resolve(),y=m.resolvedType instanceof o?"int32":m.type,b="m"+h.safeProp(m.name);d("case %i:",m.id),m.map?(d("r.skip().pos++")("if(%s===util.emptyObject)",b)("%s={}",b)("k=r.%s()",m.keyType)("r.pos++"),l.long[m.keyType]!==s?l.basic[y]===s?d('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',b,f):d('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',b,y):l.basic[y]===s?d("%s[k]=types[%i].decode(r,r.uint32())",b,f):d("%s[k]=r.%s()",b,y)):m.repeated?(d("if(!(%s&&%s.length))",b,b)("%s=[]",b),l.packed[y]!==s&&d("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",b,y)("}else"),l.basic[y]===s?d(m.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",b,f):d("%s.push(r.%s())",b,y)):l.basic[y]===s?d(m.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",b,f):d("%s=r.%s()",b,y),d("break")}for(d("default:")("r.skipType(t&7)")("break")("}")("}"),f=0;f<p._fieldsArray.length;++f){var _=p._fieldsArray[f];_.required&&d("if(!m.hasOwnProperty(%j))",_.name)("throw util.ProtocolError(%j,{instance:m})",u(_))}return d("return m")}a(g,"a"),t(g,"decoder")},{15:15,36:36,37:37}],14:[function(n,i,c){i.exports=g;var o=n(15),l=n(36),h=n(37);function u(p,d,f,m){return d.resolvedType.group?p("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",f,m,(d.id<<3|3)>>>0,(d.id<<3|4)>>>0):p("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",f,m,(d.id<<3|2)>>>0)}a(u,"u"),t(u,"genTypePartial");function g(p){for(var d=h.codegen(["m","w"],p.name+"$encode")("if(!w)")("w=Writer.create()"),y,f,m=p.fieldsArray.slice().sort(h.compareFieldsById),y=0;y<m.length;++y){var b=m[y].resolve(),_=p._fieldsArray.indexOf(b),w=b.resolvedType instanceof o?"int32":b.type,S=l.basic[w];f="m"+h.safeProp(b.name),b.map?(d("if(%s!=null&&m.hasOwnProperty(%j)){",f,b.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",f)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(b.id<<3|2)>>>0,8|l.mapKey[b.keyType],b.keyType),S===s?d("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",_,f):d(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|S,w,f),d("}")("}")):b.repeated?(d("if(%s!=null&&%s.length){",f,f),b.packed&&l.packed[w]!==s?d("w.uint32(%i).fork()",(b.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",f)("w.%s(%s[i])",w,f)("w.ldelim()"):(d("for(var i=0;i<%s.length;++i)",f),S===s?u(d,b,_,f+"[i]"):d("w.uint32(%i).%s(%s[i])",(b.id<<3|S)>>>0,w,f)),d("}")):(b.optional&&d("if(%s!=null&&m.hasOwnProperty(%j))",f,b.name),S===s?u(d,b,_,f):d("w.uint32(%i).%s(%s)",(b.id<<3|S)>>>0,w,f))}return d("return w")}a(g,"a"),t(g,"encoder")},{15:15,36:36,37:37}],15:[function(n,i,c){i.exports=u;var o=n(24);((u.prototype=Object.create(o.prototype)).constructor=u).className="Enum";var l=n(23),h=n(37);function u(g,p,d,f,m){if(o.call(this,g,d),p&&typeof p!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=f,this.comments=m||{},this.reserved=s,p)for(var y=Object.keys(p),b=0;b<y.length;++b)typeof p[y[b]]=="number"&&(this.valuesById[this.values[y[b]]=p[y[b]]]=y[b])}a(u,"u"),t(u,"Enum"),u.fromJSON=t(function(g,p){var d=new u(g,p.values,p.options,p.comment,p.comments);return d.reserved=p.reserved,d},"fromJSON"),u.prototype.toJSON=t(function(g){var p=g?!!g.keepComments:!1;return h.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:s,"comment",p?this.comment:s,"comments",p?this.comments:s])},"toJSON"),u.prototype.add=t(function(g,p,d){if(!h.isString(g))throw TypeError("name must be a string");if(!h.isInteger(p))throw TypeError("id must be an integer");if(this.values[g]!==s)throw Error("duplicate name '"+g+"' in "+this);if(this.isReservedId(p))throw Error("id "+p+" is reserved in "+this);if(this.isReservedName(g))throw Error("name '"+g+"' is reserved in "+this);if(this.valuesById[p]!==s){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+p+" in "+this);this.values[g]=p}else this.valuesById[this.values[g]=p]=g;return this.comments[g]=d||null,this},"add"),u.prototype.remove=t(function(g){if(!h.isString(g))throw TypeError("name must be a string");var p=this.values[g];if(p==null)throw Error("name '"+g+"' does not exist in "+this);return delete this.valuesById[p],delete this.values[g],delete this.comments[g],this},"remove"),u.prototype.isReservedId=t(function(g){return l.isReservedId(this.reserved,g)},"isReservedId"),u.prototype.isReservedName=t(function(g){return l.isReservedName(this.reserved,g)},"isReservedName")},{23:23,24:24,37:37}],16:[function(n,i,c){i.exports=d;var o=n(24);((d.prototype=Object.create(o.prototype)).constructor=d).className="Field";var l=n(15),h=n(36),u=n(37),g,p=/^required|optional|repeated$/;d.fromJSON=t(function(f,m){return new d(f,m.id,m.type,m.rule,m.extend,m.options,m.comment)},"fromJSON");function d(f,m,y,b,_,w,S){if(u.isObject(b)?(S=_,w=b,b=_=s):u.isObject(_)&&(S=w,w=_,_=s),o.call(this,f,w),!u.isInteger(m)||m<0)throw TypeError("id must be a non-negative integer");if(!u.isString(y))throw TypeError("type must be a string");if(b!==s&&!p.test(b=b.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(_!==s&&!u.isString(_))throw TypeError("extend must be a string");this.rule=b&&b!=="optional"?b:s,this.type=y,this.id=m,this.extend=_||s,this.required=b==="required",this.optional=!this.required,this.repeated=b==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=u.Long?h.long[y]!==s:!1,this.bytes=y==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=S}a(d,"t"),t(d,"Field"),Object.defineProperty(d.prototype,"packed",{get:t(function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed},"get")}),d.prototype.setOption=t(function(f,m,y){return f==="packed"&&(this._packed=null),o.prototype.setOption.call(this,f,m,y)},"setOption"),d.prototype.toJSON=t(function(f){var m=f?!!f.keepComments:!1;return u.toObject(["rule",this.rule!=="optional"&&this.rule||s,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",m?this.comment:s])},"toJSON"),d.prototype.resolve=t(function(){if(this.resolved)return this;if((this.typeDefault=h.defaults[this.type])===s&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof g?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof l&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==s&&this.resolvedType&&!(this.resolvedType instanceof l))&&delete this.options.packed,Object.keys(this.options).length||(this.options=s)),this.long)this.typeDefault=u.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;u.base64.test(this.typeDefault)?u.base64.decode(this.typeDefault,f=u.newBuffer(u.base64.length(this.typeDefault)),0):u.utf8.write(this.typeDefault,f=u.newBuffer(u.utf8.length(this.typeDefault)),0),this.typeDefault=f}return this.map?this.defaultValue=u.emptyObject:this.repeated?this.defaultValue=u.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof g&&(this.parent.ctor.prototype[this.name]=this.defaultValue),o.prototype.resolve.call(this)},"resolve"),d.d=t(function(f,m,y,b){return typeof m=="function"?m=u.decorateType(m).name:m&&typeof m=="object"&&(m=u.decorateEnum(m).name),t(function(_,w){u.decorateType(_.constructor).add(new d(w,f,m,y,{default:b}))},"fieldDecorator")},"decorateField"),d._configure=t(function(f){g=f},"configure")},{15:15,24:24,36:36,37:37}],17:[function(n,i,c){var o=i.exports=n(18);o.build="light";function l(u,g,p){return typeof g=="function"?(p=g,g=new o.Root):g||(g=new o.Root),g.load(u,p)}a(l,"d"),t(l,"load"),o.load=l;function h(u,g){return g||(g=new o.Root),g.loadSync(u)}a(h,"c"),t(h,"loadSync"),o.loadSync=h,o.encoder=n(14),o.decoder=n(13),o.verifier=n(40),o.converter=n(12),o.ReflectionObject=n(24),o.Namespace=n(23),o.Root=n(29),o.Enum=n(15),o.Type=n(35),o.Field=n(16),o.OneOf=n(25),o.MapField=n(20),o.Service=n(33),o.Method=n(22),o.Message=n(21),o.wrappers=n(41),o.types=n(36),o.util=n(37),o.ReflectionObject._configure(o.Root),o.Namespace._configure(o.Type,o.Service),o.Root._configure(o.Type),o.Field._configure(o.Type)},{12:12,13:13,14:14,15:15,16:16,18:18,20:20,21:21,22:22,23:23,24:24,25:25,29:29,33:33,35:35,36:36,37:37,40:40,41:41}],18:[function(n,i,c){var o=c;o.build="minimal",o.Writer=n(42),o.BufferWriter=n(43),o.Reader=n(27),o.BufferReader=n(28),o.util=n(39),o.rpc=n(31),o.roots=n(30),o.configure=l;function l(){o.Reader._configure(o.BufferReader),o.util._configure()}a(l,"d"),t(l,"configure"),o.Writer._configure(o.BufferWriter),l()},{27:27,28:28,30:30,31:31,39:39,42:42,43:43}],19:[function(n,i,c){var o=i.exports=n(17);o.build="full",o.tokenize=n(34),o.parse=n(26),o.common=n(11),o.Root._configure(o.Type,o.parse,o.common)},{11:11,17:17,26:26,34:34}],20:[function(n,i,c){i.exports=u;var o=n(16);((u.prototype=Object.create(o.prototype)).constructor=u).className="MapField";var l=n(36),h=n(37);function u(g,p,d,f,m,y){if(o.call(this,g,p,f,s,s,m,y),!h.isString(d))throw TypeError("keyType must be a string");this.keyType=d,this.resolvedKeyType=null,this.map=!0}a(u,"u"),t(u,"MapField"),u.fromJSON=t(function(g,p){return new u(g,p.id,p.keyType,p.type,p.options,p.comment)},"fromJSON"),u.prototype.toJSON=t(function(g){var p=g?!!g.keepComments:!1;return h.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",p?this.comment:s])},"toJSON"),u.prototype.resolve=t(function(){if(this.resolved)return this;if(l.mapKey[this.keyType]===s)throw Error("invalid key type: "+this.keyType);return o.prototype.resolve.call(this)},"resolve"),u.d=t(function(g,p,d){return typeof d=="function"?d=h.decorateType(d).name:d&&typeof d=="object"&&(d=h.decorateEnum(d).name),t(function(f,m){h.decorateType(f.constructor).add(new u(m,g,p,d))},"mapFieldDecorator")},"decorateMapField")},{16:16,36:36,37:37}],21:[function(n,i,c){i.exports=l;var o=n(39);function l(h){if(h)for(var u=Object.keys(h),g=0;g<u.length;++g)this[u[g]]=h[u[g]]}a(l,"d"),t(l,"Message"),l.create=t(function(h){return this.$type.create(h)},"create"),l.encode=t(function(h,u){return this.$type.encode(h,u)},"encode"),l.encodeDelimited=t(function(h,u){return this.$type.encodeDelimited(h,u)},"encodeDelimited"),l.decode=t(function(h){return this.$type.decode(h)},"decode"),l.decodeDelimited=t(function(h){return this.$type.decodeDelimited(h)},"decodeDelimited"),l.verify=t(function(h){return this.$type.verify(h)},"verify"),l.fromObject=t(function(h){return this.$type.fromObject(h)},"fromObject"),l.toObject=t(function(h,u){return this.$type.toObject(h,u)},"toObject"),l.prototype.toJSON=t(function(){return this.$type.toObject(this,o.toJSONOptions)},"toJSON")},{39:39}],22:[function(n,i,c){i.exports=h;var o=n(24);((h.prototype=Object.create(o.prototype)).constructor=h).className="Method";var l=n(37);function h(u,g,p,d,f,m,y,b){if(l.isObject(f)?(y=f,f=m=s):l.isObject(m)&&(y=m,m=s),!(g===s||l.isString(g)))throw TypeError("type must be a string");if(!l.isString(p))throw TypeError("requestType must be a string");if(!l.isString(d))throw TypeError("responseType must be a string");o.call(this,u,y),this.type=g||"rpc",this.requestType=p,this.requestStream=f?!0:s,this.responseType=d,this.responseStream=m?!0:s,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=b}a(h,"c"),t(h,"Method"),h.fromJSON=t(function(u,g){return new h(u,g.type,g.requestType,g.responseType,g.requestStream,g.responseStream,g.options,g.comment)},"fromJSON"),h.prototype.toJSON=t(function(u){var g=u?!!u.keepComments:!1;return l.toObject(["type",this.type!=="rpc"&&this.type||s,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",g?this.comment:s])},"toJSON"),h.prototype.resolve=t(function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),o.prototype.resolve.call(this))},"resolve")},{24:24,37:37}],23:[function(n,i,c){i.exports=f;var o=n(24);((f.prototype=Object.create(o.prototype)).constructor=f).className="Namespace";var l=n(15),h=n(16),u=n(37),g,p;f.fromJSON=t(function(y,b){return new f(y,b.options).addJSON(b.nested)},"fromJSON");function d(y,b){if(!(y&&y.length))return s;for(var _={},w=0;w<y.length;++w)_[y[w].name]=y[w].toJSON(b);return _}a(d,"t"),t(d,"arrayToJSON"),f.arrayToJSON=d,f.isReservedId=t(function(y,b){if(y){for(var _=0;_<y.length;++_)if(typeof y[_]!="string"&&y[_][0]<=b&&y[_][1]>=b)return!0}return!1},"isReservedId"),f.isReservedName=t(function(y,b){if(y){for(var _=0;_<y.length;++_)if(y[_]===b)return!0}return!1},"isReservedName");function f(y,b){o.call(this,y,b),this.nested=s,this._nestedArray=null}a(f,"r"),t(f,"Namespace");function m(y){return y._nestedArray=null,y}a(m,"e"),t(m,"clearCache"),Object.defineProperty(f.prototype,"nestedArray",{get:t(function(){return this._nestedArray||(this._nestedArray=u.toArray(this.nested))},"get")}),f.prototype.toJSON=t(function(y){return u.toObject(["options",this.options,"nested",d(this.nestedArray,y)])},"toJSON"),f.prototype.addJSON=t(function(y){var b=this;if(y)for(var _=Object.keys(y),w=0,S;w<_.length;++w)S=y[_[w]],b.add((S.fields!==s?g.fromJSON:S.values!==s?l.fromJSON:S.methods!==s?p.fromJSON:S.id!==s?h.fromJSON:f.fromJSON)(_[w],S));return this},"addJSON"),f.prototype.get=t(function(y){return this.nested&&this.nested[y]||null},"get"),f.prototype.getEnum=t(function(y){if(this.nested&&this.nested[y]instanceof l)return this.nested[y].values;throw Error("no such enum: "+y)},"getEnum"),f.prototype.add=t(function(y){if(!(y instanceof h&&y.extend!==s||y instanceof g||y instanceof l||y instanceof p||y instanceof f))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var b=this.get(y.name);if(b)if(b instanceof f&&y instanceof f&&!(b instanceof g||b instanceof p)){for(var _=b.nestedArray,w=0;w<_.length;++w)y.add(_[w]);this.remove(b),this.nested||(this.nested={}),y.setOptions(b.options,!0)}else throw Error("duplicate name '"+y.name+"' in "+this)}return this.nested[y.name]=y,y.onAdd(this),m(this)},"add"),f.prototype.remove=t(function(y){if(!(y instanceof o))throw TypeError("object must be a ReflectionObject");if(y.parent!==this)throw Error(y+" is not a member of "+this);return delete this.nested[y.name],Object.keys(this.nested).length||(this.nested=s),y.onRemove(this),m(this)},"remove"),f.prototype.define=t(function(y,b){if(u.isString(y))y=y.split(".");else if(!Array.isArray(y))throw TypeError("illegal path");if(y&&y.length&&y[0]==="")throw Error("path must be relative");for(var _=this;y.length>0;){var w=y.shift();if(_.nested&&_.nested[w]){if(_=_.nested[w],!(_ instanceof f))throw Error("path conflicts with non-namespace objects")}else _.add(_=new f(w))}return b&&_.addJSON(b),_},"define"),f.prototype.resolveAll=t(function(){for(var y=this.nestedArray,b=0;b<y.length;)y[b]instanceof f?y[b++].resolveAll():y[b++].resolve();return this.resolve()},"resolveAll"),f.prototype.lookup=t(function(y,b,_){if(typeof b=="boolean"?(_=b,b=s):b&&!Array.isArray(b)&&(b=[b]),u.isString(y)&&y.length){if(y===".")return this.root;y=y.split(".")}else if(!y.length)return this;if(y[0]==="")return this.root.lookup(y.slice(1),b);var w=this.get(y[0]);if(w){if(y.length===1){if(!b||b.indexOf(w.constructor)>-1)return w}else if(w instanceof f&&(w=w.lookup(y.slice(1),b,!0)))return w}else for(var S=0;S<this.nestedArray.length;++S)if(this._nestedArray[S]instanceof f&&(w=this._nestedArray[S].lookup(y,b,!0)))return w;return this.parent===null||_?null:this.parent.lookup(y,b)},"lookup"),f.prototype.lookupType=t(function(y){var b=this.lookup(y,[g]);if(!b)throw Error("no such type: "+y);return b},"lookupType"),f.prototype.lookupEnum=t(function(y){var b=this.lookup(y,[l]);if(!b)throw Error("no such Enum '"+y+"' in "+this);return b},"lookupEnum"),f.prototype.lookupTypeOrEnum=t(function(y){var b=this.lookup(y,[g,l]);if(!b)throw Error("no such Type or Enum '"+y+"' in "+this);return b},"lookupTypeOrEnum"),f.prototype.lookupService=t(function(y){var b=this.lookup(y,[p]);if(!b)throw Error("no such Service '"+y+"' in "+this);return b},"lookupService"),f._configure=function(y,b){g=y,p=b}},{15:15,16:16,24:24,37:37}],24:[function(n,i,c){i.exports=h,h.className="ReflectionObject";var o=n(37),l;function h(u,g){if(!o.isString(u))throw TypeError("name must be a string");if(g&&!o.isObject(g))throw TypeError("options must be an object");this.options=g,this.name=u,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}a(h,"c"),t(h,"ReflectionObject"),Object.defineProperties(h.prototype,{root:{get:t(function(){for(var u=this;u.parent!==null;)u=u.parent;return u},"get")},fullName:{get:t(function(){for(var u=[this.name],g=this.parent;g;)u.unshift(g.name),g=g.parent;return u.join(".")},"get")}}),h.prototype.toJSON=t(function(){throw Error()},"toJSON"),h.prototype.onAdd=t(function(u){this.parent&&this.parent!==u&&this.parent.remove(this),this.parent=u,this.resolved=!1;var g=u.root;g instanceof l&&g._handleAdd(this)},"onAdd"),h.prototype.onRemove=t(function(u){var g=u.root;g instanceof l&&g._handleRemove(this),this.parent=null,this.resolved=!1},"onRemove"),h.prototype.resolve=t(function(){return this.resolved?this:(this.root instanceof l&&(this.resolved=!0),this)},"resolve"),h.prototype.getOption=t(function(u){return this.options?this.options[u]:s},"getOption"),h.prototype.setOption=t(function(u,g,p){return(!p||!this.options||this.options[u]===s)&&((this.options||(this.options={}))[u]=g),this},"setOption"),h.prototype.setOptions=t(function(u,g){if(u)for(var p=Object.keys(u),d=0;d<p.length;++d)this.setOption(p[d],u[p[d]],g);return this},"setOptions"),h.prototype.toString=t(function(){var u=this.constructor.className,g=this.fullName;return g.length?u+" "+g:u},"toString"),h._configure=function(u){l=u}},{37:37}],25:[function(n,i,c){i.exports=u;var o=n(24);((u.prototype=Object.create(o.prototype)).constructor=u).className="OneOf";var l=n(16),h=n(37);function u(p,d,f,m){if(Array.isArray(d)||(f=d,d=s),o.call(this,p,f),!(d===s||Array.isArray(d)))throw TypeError("fieldNames must be an Array");this.oneof=d||[],this.fieldsArray=[],this.comment=m}a(u,"u"),t(u,"OneOf"),u.fromJSON=t(function(p,d){return new u(p,d.oneof,d.options,d.comment)},"fromJSON"),u.prototype.toJSON=t(function(p){var d=p?!!p.keepComments:!1;return h.toObject(["options",this.options,"oneof",this.oneof,"comment",d?this.comment:s])},"toJSON");function g(p){if(p.parent)for(var d=0;d<p.fieldsArray.length;++d)p.fieldsArray[d].parent||p.parent.add(p.fieldsArray[d])}a(g,"a"),t(g,"addFieldsToParent"),u.prototype.add=t(function(p){if(!(p instanceof l))throw TypeError("field must be a Field");return p.parent&&p.parent!==this.parent&&p.parent.remove(p),this.oneof.push(p.name),this.fieldsArray.push(p),p.partOf=this,g(this),this},"add"),u.prototype.remove=t(function(p){if(!(p instanceof l))throw TypeError("field must be a Field");var d=this.fieldsArray.indexOf(p);if(d<0)throw Error(p+" is not a member of "+this);return this.fieldsArray.splice(d,1),d=this.oneof.indexOf(p.name),d>-1&&this.oneof.splice(d,1),p.partOf=null,this},"remove"),u.prototype.onAdd=t(function(p){o.prototype.onAdd.call(this,p);for(var d=this,f=0;f<this.oneof.length;++f){var m=p.get(this.oneof[f]);m&&!m.partOf&&(m.partOf=d,d.fieldsArray.push(m))}g(this)},"onAdd"),u.prototype.onRemove=t(function(p){for(var d=0,f;d<this.fieldsArray.length;++d)(f=this.fieldsArray[d]).parent&&f.parent.remove(f);o.prototype.onRemove.call(this,p)},"onRemove"),u.d=t(function(){for(var p=new Array(arguments.length),d=0;d<arguments.length;)p[d]=arguments[d++];return t(function(f,m){h.decorateType(f.constructor).add(new u(m,p)),Object.defineProperty(f,m,{get:h.oneOfGetter(p),set:h.oneOfSetter(p)})},"oneOfDecorator")},"decorateOneOf")},{16:16,24:24,37:37}],26:[function(n,i,c){i.exports=V,V.filename=null,V.defaults={keepCase:!1};var o=n(34),l=n(29),h=n(35),u=n(16),g=n(20),p=n(25),d=n(15),f=n(33),m=n(22),y=n(36),b=n(37),_=/^[1-9][0-9]*$/,w=/^-?[1-9][0-9]*$/,S=/^0[x][0-9a-fA-F]+$/,T=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,R=/^-?0[0-7]+$/,O=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,k=/^[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]*)*$/,j=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function V(pe,me,Y){me instanceof l||(Y=me,me=new l),Y||(Y=V.defaults);var se=o(pe,Y.alternateCommentMode||!1),W=se.next,Ee=se.push,ie=se.peek,F=se.skip,Re=se.cmnt,tt=!0,ue,K,Q,he,ae=!1,Z=me,Se=Y.keepCase?function(D){return D}:b.camelCase;function H(D,C,M){var U=V.filename;return M||(V.filename=null),Error("illegal "+(C||"token")+" '"+D+"' ("+(U?U+", ":"")+"line "+se.line+")")}a(H,"F"),t(H,"illegal");function $e(){var D=[],C;do{if((C=W())!=='"'&&C!=="'")throw H(C);D.push(W()),F(C),C=ie()}while(C==='"'||C==="'");return D.join("")}a($e,"Y"),t($e,"readString");function Xt(D){var C=W();switch(C){case"'":case'"':return Ee(C),$e();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return St(C,!0)}catch{if(D&&N.test(C))return C;throw H(C,"value")}}a(Xt,"ht"),t(Xt,"readValue");function Qt(D,C){var M,U;do C&&((M=ie())==='"'||M==="'")?D.push($e()):D.push([U=Dt(W()),F("to",!0)?Dt(W()):U]);while(F(",",!0));F(";")}a(Qt,"ot"),t(Qt,"readRanges");function St(D,C){var M=1;switch(D.charAt(0)==="-"&&(M=-1,D=D.substring(1)),D){case"inf":case"INF":case"Inf":return M*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(_.test(D))return M*parseInt(D,10);if(S.test(D))return M*parseInt(D,16);if(v.test(D))return M*parseInt(D,8);if(O.test(D))return M*parseFloat(D);throw H(D,"number",C)}a(St,"pt"),t(St,"parseNumber");function Dt(D,C){switch(D){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!C&&D.charAt(0)==="-")throw H(D,"id");if(w.test(D))return parseInt(D,10);if(T.test(D))return parseInt(D,16);if(R.test(D))return parseInt(D,8);throw H(D,"id")}a(Dt,"nt"),t(Dt,"parseId");function Sc(){if(ue!==s)throw H("package");if(ue=W(),!N.test(ue))throw H(ue,"name");Z=Z.define(ue),F(";")}a(Sc,"dt"),t(Sc,"parsePackage");function vc(){var D=ie(),C;switch(D){case"weak":C=Q||(Q=[]),W();break;case"public":W();default:C=K||(K=[]);break}D=$e(),F(";"),C.push(D)}a(vc,"yt"),t(vc,"parseImport");function Ec(){if(F("="),he=$e(),ae=he==="proto3",!ae&&he!=="proto2")throw H(he,"syntax");F(";")}a(Ec,"mt"),t(Ec,"parseSyntax");function gs(D,C){switch(C){case"option":return st(D,C),F(";"),!0;case"message":return Oc(D,C),!0;case"enum":return Ac(D,C),!0;case"service":return Cc(D,C),!0;case"extend":return Dc(D,C),!0}return!1}a(gs,"at"),t(gs,"parseCommon");function rt(D,C,M){var U=se.line;if(D&&(D.comment=Re(),D.filename=V.filename),F("{",!0)){for(var _e;(_e=W())!=="}";)C(_e);F(";",!0)}else M&&M(),F(";"),D&&typeof D.comment!="string"&&(D.comment=Re(U))}a(rt,"K"),t(rt,"ifBlock");function Oc(D,C){if(!k.test(C=W()))throw H(C,"type name");var M=new h(C);rt(M,t(function(U){if(!gs(M,U))switch(U){case"map":kc(M);break;case"required":case"optional":case"repeated":Lt(M,U);break;case"oneof":Ic(M,U);break;case"extensions":Qt(M.extensions||(M.extensions=[]));break;case"reserved":Qt(M.reserved||(M.reserved=[]),!0);break;default:if(!ae||!N.test(U))throw H(U);Ee(U),Lt(M,"optional");break}},"parseType_block")),D.add(M)}a(Oc,"vt"),t(Oc,"parseType");function Lt(D,C,M){var U=W();if(U==="group"){Tc(D,C);return}if(!N.test(U))throw H(U,"type");var _e=W();if(!k.test(_e))throw H(_e,"name");_e=Se(_e),F("=");var Oe=new u(_e,Dt(W()),U,C,M);rt(Oe,t(function(ft){if(ft==="option")st(Oe,ft),F(";");else throw H(ft)},"parseField_block"),t(function(){bs(Oe)},"parseField_line")),D.add(Oe),!ae&&Oe.repeated&&(y.packed[U]!==s||y.basic[U]===s)&&Oe.setOption("packed",!1,!0)}a(Lt,"st"),t(Lt,"parseField");function Tc(D,C){var M=W();if(!k.test(M))throw H(M,"name");var U=b.lcFirst(M);M===U&&(M=b.ucFirst(M)),F("=");var _e=Dt(W()),Oe=new h(M);Oe.group=!0;var ft=new u(U,_e,M,C);ft.filename=V.filename,rt(Oe,t(function(Pt){switch(Pt){case"option":st(Oe,Pt),F(";");break;case"required":case"optional":case"repeated":Lt(Oe,Pt);break;default:throw H(Pt)}},"parseGroup_block")),D.add(Oe).add(ft)}a(Tc,"gt"),t(Tc,"parseGroup");function kc(D){F("<");var C=W();if(y.mapKey[C]===s)throw H(C,"type");F(",");var M=W();if(!N.test(M))throw H(M,"type");F(">");var U=W();if(!k.test(U))throw H(U,"name");F("=");var _e=new g(Se(U),Dt(W()),C,M);rt(_e,t(function(Oe){if(Oe==="option")st(_e,Oe),F(";");else throw H(Oe)},"parseMapField_block"),t(function(){bs(_e)},"parseMapField_line")),D.add(_e)}a(kc,"wt"),t(kc,"parseMapField");function Ic(D,C){if(!k.test(C=W()))throw H(C,"name");var M=new p(Se(C));rt(M,t(function(U){U==="option"?(st(M,U),F(";")):(Ee(U),Lt(M,"optional"))},"parseOneOf_block")),D.add(M)}a(Ic,"Ot"),t(Ic,"parseOneOf");function Ac(D,C){if(!k.test(C=W()))throw H(C,"name");var M=new d(C);rt(M,t(function(U){switch(U){case"option":st(M,U),F(";");break;case"reserved":Qt(M.reserved||(M.reserved=[]),!0);break;default:Rc(M,U)}},"parseEnum_block")),D.add(M)}a(Ac,"bt"),t(Ac,"parseEnum");function Rc(D,C){if(!k.test(C))throw H(C,"name");F("=");var M=Dt(W(),!0),U={};rt(U,t(function(_e){if(_e==="option")st(U,_e),F(";");else throw H(_e)},"parseEnumValue_block"),t(function(){bs(U)},"parseEnumValue_line")),D.add(C,M,U.comment)}a(Rc,"_t"),t(Rc,"parseEnumValue");function st(D,C){var M=F("(",!0);if(!N.test(C=W()))throw H(C,"name");var U=C;M&&(F(")"),U="("+U+")",C=ie(),j.test(C)&&(U+=C,W())),F("="),ys(D,U)}a(st,"Q"),t(st,"parseOption");function ys(D,C){if(F("{",!0))do{if(!k.test(je=W()))throw H(je,"name");ie()==="{"?ys(D,C+"."+je):(F(":"),ie()==="{"?ys(D,C+"."+je):qn(D,C+"."+je,Xt(!0)))}while(!F("}",!0));else qn(D,C,Xt(!0))}a(ys,"ut"),t(ys,"parseOptionValue");function qn(D,C,M){D.setOption&&D.setOption(C,M)}a(qn,"ct"),t(qn,"setOption");function bs(D){if(F("[",!0)){do st(D,"option");while(F(",",!0));F("]")}return D}a(bs,"ft"),t(bs,"parseInlineOptions");function Cc(D,C){if(!k.test(C=W()))throw H(C,"service name");var M=new f(C);rt(M,t(function(U){if(!gs(M,U))if(U==="rpc")Nc(M,U);else throw H(U)},"parseService_block")),D.add(M)}a(Cc,"xt"),t(Cc,"parseService");function Nc(D,C){var M=C;if(!k.test(C=W()))throw H(C,"name");var U=C,_e,Oe,ft,Pt;if(F("("),F("stream",!0)&&(Oe=!0),!N.test(C=W())||(_e=C,F(")"),F("returns"),F("("),F("stream",!0)&&(Pt=!0),!N.test(C=W())))throw H(C);ft=C,F(")");var Hn=new m(U,M,_e,ft,Oe,Pt);rt(Hn,t(function(Wn){if(Wn==="option")st(Hn,Wn),F(";");else throw H(Wn)},"parseMethod_block")),D.add(Hn)}a(Nc,"At"),t(Nc,"parseMethod");function Dc(D,C){if(!N.test(C=W()))throw H(C,"reference");var M=C;rt(null,t(function(U){switch(U){case"required":case"repeated":case"optional":Lt(D,U,M);break;default:if(!ae||!N.test(U))throw H(U);Ee(U),Lt(D,"optional",M);break}},"parseExtension_block"))}a(Dc,"St"),t(Dc,"parseExtension");for(var je;(je=W())!==null;)switch(je){case"package":if(!tt)throw H(je);Sc();break;case"import":if(!tt)throw H(je);vc();break;case"syntax":if(!tt)throw H(je);Ec();break;case"option":if(!tt)throw H(je);st(Z,je),F(";");break;default:if(gs(Z,je)){tt=!1;continue}throw H(je)}return V.filename=null,{package:ue,imports:K,weakImports:Q,syntax:he,root:me}}a(V,"T"),t(V,"parse")},{15:15,16:16,20:20,22:22,25:25,29:29,33:33,34:34,35:35,36:36,37:37}],27:[function(n,i,c){i.exports=p;var o=n(39),l,h=o.LongBits,u=o.utf8;function g(b,_){return RangeError("index out of range: "+b.pos+" + "+(_||1)+" > "+b.len)}a(g,"a"),t(g,"indexOutOfRange");function p(b){this.buf=b,this.pos=0,this.len=b.length}a(p,"s"),t(p,"Reader");var d=typeof Uint8Array<"u"?t(function(b){if(b instanceof Uint8Array||Array.isArray(b))return new p(b);throw Error("illegal buffer")},"create_typed_array"):t(function(b){if(Array.isArray(b))return new p(b);throw Error("illegal buffer")},"create_array");p.create=o.Buffer?t(function(b){return(p.create=t(function(_){return o.Buffer.isBuffer(_)?new l(_):d(_)},"create_buffer"))(b)},"create_buffer_setup"):d,p.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,p.prototype.uint32=t((function(){var b=4294967295;return t(function(){if(b=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(b=(b|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(b=(b|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(b=(b|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(b=(b|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return b;if((this.pos+=5)>this.len)throw this.pos=this.len,g(this,10);return b},"read_uint32")}),"read_uint32_setup")(),p.prototype.int32=t(function(){return this.uint32()|0},"read_int32"),p.prototype.sint32=t(function(){var b=this.uint32();return b>>>1^-(b&1)|0},"read_sint32");function f(){var b=new h(0,0),_=0;if(this.len-this.pos>4){for(;_<4;++_)if(b.lo=(b.lo|(this.buf[this.pos]&127)<<_*7)>>>0,this.buf[this.pos++]<128)return b;if(b.lo=(b.lo|(this.buf[this.pos]&127)<<28)>>>0,b.hi=(b.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return b;_=0}else{for(;_<3;++_){if(this.pos>=this.len)throw g(this);if(b.lo=(b.lo|(this.buf[this.pos]&127)<<_*7)>>>0,this.buf[this.pos++]<128)return b}return b.lo=(b.lo|(this.buf[this.pos++]&127)<<_*7)>>>0,b}if(this.len-this.pos>4){for(;_<5;++_)if(b.hi=(b.hi|(this.buf[this.pos]&127)<<_*7+3)>>>0,this.buf[this.pos++]<128)return b}else for(;_<5;++_){if(this.pos>=this.len)throw g(this);if(b.hi=(b.hi|(this.buf[this.pos]&127)<<_*7+3)>>>0,this.buf[this.pos++]<128)return b}throw Error("invalid varint encoding")}a(f,"r"),t(f,"readLongVarint"),p.prototype.bool=t(function(){return this.uint32()!==0},"read_bool");function m(b,_){return(b[_-4]|b[_-3]<<8|b[_-2]<<16|b[_-1]<<24)>>>0}a(m,"e"),t(m,"readFixed32_end"),p.prototype.fixed32=t(function(){if(this.pos+4>this.len)throw g(this,4);return m(this.buf,this.pos+=4)},"read_fixed32"),p.prototype.sfixed32=t(function(){if(this.pos+4>this.len)throw g(this,4);return m(this.buf,this.pos+=4)|0},"read_sfixed32");function y(){if(this.pos+8>this.len)throw g(this,8);return new h(m(this.buf,this.pos+=4),m(this.buf,this.pos+=4))}a(y,"f"),t(y,"readFixed64"),p.prototype.float=t(function(){if(this.pos+4>this.len)throw g(this,4);var b=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,b},"read_float"),p.prototype.double=t(function(){if(this.pos+8>this.len)throw g(this,4);var b=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,b},"read_double"),p.prototype.bytes=t(function(){var b=this.uint32(),_=this.pos,w=this.pos+b;if(w>this.len)throw g(this,b);return this.pos+=b,Array.isArray(this.buf)?this.buf.slice(_,w):_===w?new this.buf.constructor(0):this._slice.call(this.buf,_,w)},"read_bytes"),p.prototype.string=t(function(){var b=this.bytes();return u.read(b,0,b.length)},"read_string"),p.prototype.skip=t(function(b){if(typeof b=="number"){if(this.pos+b>this.len)throw g(this,b);this.pos+=b}else do if(this.pos>=this.len)throw g(this);while(this.buf[this.pos++]&128);return this},"skip"),p.prototype.skipType=function(b){switch(b){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:do{if((b=this.uint32()&7)===4)break;this.skipType(b)}while(!0);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+b+" at offset "+this.pos)}return this},p._configure=function(b){l=b;var _=o.Long?"toLong":"toNumber";o.merge(p.prototype,{int64:t(function(){return f.call(this)[_](!1)},"read_int64"),uint64:t(function(){return f.call(this)[_](!0)},"read_uint64"),sint64:t(function(){return f.call(this).zzDecode()[_](!1)},"read_sint64"),fixed64:t(function(){return y.call(this)[_](!0)},"read_fixed64"),sfixed64:t(function(){return y.call(this)[_](!1)},"read_sfixed64")})}},{39:39}],28:[function(n,i,c){i.exports=h;var o=n(27);(h.prototype=Object.create(o.prototype)).constructor=h;var l=n(39);function h(u){o.call(this,u)}a(h,"c"),t(h,"BufferReader"),l.Buffer&&(h.prototype._slice=l.Buffer.prototype.slice),h.prototype.string=t(function(){var u=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+u,this.len))},"read_string_buffer")},{27:27,39:39}],29:[function(n,i,c){i.exports=m;var o=n(23);((m.prototype=Object.create(o.prototype)).constructor=m).className="Root";var l=n(16),h=n(15),u=n(25),g=n(37),p,d,f;function m(w){o.call(this,"",w),this.deferred=[],this.files=[]}a(m,"e"),t(m,"Root"),m.fromJSON=t(function(w,S){return S||(S=new m),w.options&&S.setOptions(w.options),S.addJSON(w.nested)},"fromJSON"),m.prototype.resolvePath=g.path.resolve;function y(){}a(y,"f"),t(y,"SYNC"),m.prototype.load=t(a(function w(S,T,v){typeof T=="function"&&(v=T,T=s);var R=this;if(!v)return g.asPromise(w,R,S,T);var O=v===y;function k(Y,se){if(v){var W=v;if(v=null,O)throw Y;W(Y,se)}}a(k,"g"),t(k,"finish");function N(Y,se){try{if(g.isString(se)&&se.charAt(0)==="{"&&(se=JSON.parse(se)),!g.isString(se))R.setOptions(se.options).addJSON(se.nested);else{d.filename=Y;var W=d(se,R,T),Ee,ie=0;if(W.imports)for(;ie<W.imports.length;++ie)(Ee=R.resolvePath(Y,W.imports[ie]))&&j(Ee);if(W.weakImports)for(ie=0;ie<W.weakImports.length;++ie)(Ee=R.resolvePath(Y,W.weakImports[ie]))&&j(Ee,!0)}}catch(F){k(F)}!O&&!V&&k(null,R)}a(N,"_"),t(N,"process");function j(Y,se){var W=Y.lastIndexOf("google/protobuf/");if(W>-1){var Ee=Y.substring(W);Ee in f&&(Y=Ee)}if(!(R.files.indexOf(Y)>-1)){if(R.files.push(Y),Y in f){O?N(Y,f[Y]):(++V,setTimeout(function(){--V,N(Y,f[Y])}));return}if(O){var ie;try{ie=g.fs.readFileSync(Y).toString("utf8")}catch(F){se||k(F);return}N(Y,ie)}else++V,g.fetch(Y,function(F,Re){if(--V,!!v){if(F){se?V||k(null,R):k(F);return}N(Y,Re)}})}}a(j,"D"),t(j,"fetch");var V=0;g.isString(S)&&(S=[S]);for(var pe=0,me;pe<S.length;++pe)(me=R.resolvePath("",S[pe]))&&j(me);return O?R:(V||k(null,R),s)},"p"),"load"),m.prototype.loadSync=t(function(w,S){if(!g.isNode)throw Error("not supported");return this.load(w,S,y)},"loadSync"),m.prototype.resolveAll=t(function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(w){return"'extend "+w.extend+"' in "+w.parent.fullName}).join(", "));return o.prototype.resolveAll.call(this)},"resolveAll");var b=/^[A-Z]/;function _(w,S){var T=S.parent.lookup(S.extend);if(T){var v=new l(S.fullName,S.id,S.type,S.rule,s,S.options);return v.declaringField=S,S.extensionField=v,T.add(v),!0}return!1}a(_,"o"),t(_,"tryHandleExtension"),m.prototype._handleAdd=t(function(w){if(w instanceof l)w.extend!==s&&!w.extensionField&&(_(this,w)||this.deferred.push(w));else if(w instanceof h)b.test(w.name)&&(w.parent[w.name]=w.values);else if(!(w instanceof u)){if(w instanceof p)for(var S=0;S<this.deferred.length;)_(this,this.deferred[S])?this.deferred.splice(S,1):++S;for(var T=0;T<w.nestedArray.length;++T)this._handleAdd(w._nestedArray[T]);b.test(w.name)&&(w.parent[w.name]=w)}},"_handleAdd"),m.prototype._handleRemove=t(function(w){if(w instanceof l){if(w.extend!==s)if(w.extensionField)w.extensionField.parent.remove(w.extensionField),w.extensionField=null;else{var S=this.deferred.indexOf(w);S>-1&&this.deferred.splice(S,1)}}else if(w instanceof h)b.test(w.name)&&delete w.parent[w.name];else if(w instanceof o){for(var T=0;T<w.nestedArray.length;++T)this._handleRemove(w._nestedArray[T]);b.test(w.name)&&delete w.parent[w.name]}},"_handleRemove"),m._configure=function(w,S,T){p=w,d=S,f=T}},{15:15,16:16,23:23,25:25,37:37}],30:[function(n,i,c){i.exports={}},{}],31:[function(n,i,c){var o=c;o.Service=n(32)},{32:32}],32:[function(n,i,c){i.exports=l;var o=n(39);(l.prototype=Object.create(o.EventEmitter.prototype)).constructor=l;function l(h,u,g){if(typeof h!="function")throw TypeError("rpcImpl must be a function");o.EventEmitter.call(this),this.rpcImpl=h,this.requestDelimited=!!u,this.responseDelimited=!!g}a(l,"d"),t(l,"Service"),l.prototype.rpcCall=t(a(function h(u,g,p,d,f){if(!d)throw TypeError("request must be specified");var m=this;if(!f)return o.asPromise(h,m,u,g,p,d);if(!m.rpcImpl)return setTimeout(function(){f(Error("already ended"))},0),s;try{return m.rpcImpl(u,g[m.requestDelimited?"encodeDelimited":"encode"](d).finish(),t(function(y,b){if(y)return m.emit("error",y,u),f(y);if(b===null)return m.end(!0),s;if(!(b instanceof p))try{b=p[m.responseDelimited?"decodeDelimited":"decode"](b)}catch(_){return m.emit("error",_,u),f(_)}return m.emit("data",b,u),f(null,b)},"rpcCallback"))}catch(y){return m.emit("error",y,u),setTimeout(function(){f(y)},0),s}},"c"),"rpcCall"),l.prototype.end=t(function(h){return this.rpcImpl&&(h||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},"end")},{39:39}],33:[function(n,i,c){i.exports=g;var o=n(23);((g.prototype=Object.create(o.prototype)).constructor=g).className="Service";var l=n(22),h=n(37),u=n(31);function g(d,f){o.call(this,d,f),this.methods={},this._methodsArray=null}a(g,"a"),t(g,"Service"),g.fromJSON=t(function(d,f){var m=new g(d,f.options);if(f.methods)for(var y=Object.keys(f.methods),b=0;b<y.length;++b)m.add(l.fromJSON(y[b],f.methods[y[b]]));return f.nested&&m.addJSON(f.nested),m.comment=f.comment,m},"fromJSON"),g.prototype.toJSON=t(function(d){var f=o.prototype.toJSON.call(this,d),m=d?!!d.keepComments:!1;return h.toObject(["options",f&&f.options||s,"methods",o.arrayToJSON(this.methodsArray,d)||{},"nested",f&&f.nested||s,"comment",m?this.comment:s])},"toJSON"),Object.defineProperty(g.prototype,"methodsArray",{get:t(function(){return this._methodsArray||(this._methodsArray=h.toArray(this.methods))},"get")});function p(d){return d._methodsArray=null,d}a(p,"s"),t(p,"clearCache"),g.prototype.get=t(function(d){return this.methods[d]||o.prototype.get.call(this,d)},"get"),g.prototype.resolveAll=t(function(){for(var d=this.methodsArray,f=0;f<d.length;++f)d[f].resolve();return o.prototype.resolve.call(this)},"resolveAll"),g.prototype.add=t(function(d){if(this.get(d.name))throw Error("duplicate name '"+d.name+"' in "+this);return d instanceof l?(this.methods[d.name]=d,d.parent=this,p(this)):o.prototype.add.call(this,d)},"add"),g.prototype.remove=t(function(d){if(d instanceof l){if(this.methods[d.name]!==d)throw Error(d+" is not a member of "+this);return delete this.methods[d.name],d.parent=null,p(this)}return o.prototype.remove.call(this,d)},"remove"),g.prototype.create=t(function(d,f,m){for(var y=new u.Service(d,f,m),b=0,_;b<this.methodsArray.length;++b){var w=h.lcFirst((_=this._methodsArray[b]).resolve().name).replace(/[^$\w_]/g,"");y[w]=h.codegen(["r","c"],h.isReserved(w)?w+"_":w)("return this.rpcCall(m,q,s,r,c)")({m:_,q:_.resolvedRequestType.ctor,s:_.resolvedResponseType.ctor})}return y},"create")},{22:22,23:23,31:31,37:37}],34:[function(n,i,c){i.exports=b;var o=/[\s{}=;:[\],'"()<>]/g,l=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,h=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,u=/^ *[*/]+ */,g=/^\s*\*?\/*/,p=/\n/g,d=/\s/,f=/\\(.?)/g,m={0:"\0",r:"\r",n:`
|
|
63
|
+
`,t:" "};function y(_){return _.replace(f,function(w,S){switch(S){case"\\":case"":return S;default:return m[S]||""}})}a(y,"f"),t(y,"unescape"),b.unescape=y;function b(_,w){_=_.toString();var S=0,T=_.length,v=1,R=null,O=null,k=0,N=!1,j=[],V=null;function pe(K){return Error("illegal "+K+" (line "+v+")")}a(pe,"J"),t(pe,"illegal");function me(){var K=V==="'"?h:l;K.lastIndex=S-1;var Q=K.exec(_);if(!Q)throw pe("string");return S=K.lastIndex,F(V),V=null,y(Q[1])}a(me,"H"),t(me,"readString");function Y(K){return _.charAt(K)}a(Y,"I"),t(Y,"charAt");function se(K,Q){R=_.charAt(K++),k=v,N=!1;var he;w?he=2:he=3;var ae=K-he,Z;do if(--ae<0||(Z=_.charAt(ae))===`
|
|
64
|
+
`){N=!0;break}while(Z===" "||Z===" ");for(var Se=_.substring(K,Q).split(p),H=0;H<Se.length;++H)Se[H]=Se[H].replace(w?g:u,"").trim();O=Se.join(`
|
|
65
|
+
`).trim()}a(se,"$"),t(se,"setComment");function W(K){var Q=Ee(K),he=_.substring(K,Q),ae=/^\s*\/{1,2}/.test(he);return ae}a(W,"B"),t(W,"isDoubleSlashCommentLine");function Ee(K){for(var Q=K;Q<T&&Y(Q)!==`
|
|
66
|
+
`;)Q++;return Q}a(Ee,"U"),t(Ee,"findEndOfLine");function ie(){if(j.length>0)return j.shift();if(V)return me();var K,Q,he,ae,Z;do{if(S===T)return null;for(K=!1;d.test(he=Y(S));)if(he===`
|
|
67
|
+
`&&++v,++S===T)return null;if(Y(S)==="/"){if(++S===T)throw pe("comment");if(Y(S)==="/")if(w){if(ae=S,Z=!1,W(S)){Z=!0;do{if(S=Ee(S),S===T)break;S++}while(W(S))}else S=Math.min(T,Ee(S)+1);Z&&se(ae,S),v++,K=!0}else{for(Z=Y(ae=S+1)==="/";Y(++S)!==`
|
|
68
|
+
`;)if(S===T)return null;++S,Z&&se(ae,S-1),++v,K=!0}else if((he=Y(S))==="*"){ae=S+1,Z=w||Y(ae)==="*";do{if(he===`
|
|
69
|
+
`&&++v,++S===T)throw pe("comment");Q=he,he=Y(S)}while(Q!=="*"||he!=="/");++S,Z&&se(ae,S-2),K=!0}else return"/"}}while(K);var Se=S;o.lastIndex=0;var H=o.test(Y(Se++));if(!H)for(;Se<T&&!o.test(Y(Se));)++Se;var $e=_.substring(S,S=Se);return($e==='"'||$e==="'")&&(V=$e),$e}a(ie,"P"),t(ie,"next");function F(K){j.push(K)}a(F,"N"),t(F,"push");function Re(){if(!j.length){var K=ie();if(K===null)return null;F(K)}return j[0]}a(Re,"q"),t(Re,"peek");function tt(K,Q){var he=Re(),ae=he===K;if(ae)return ie(),!0;if(!Q)throw pe("token '"+he+"', '"+K+"' expected");return!1}a(tt,"rt"),t(tt,"skip");function ue(K){var Q=null;return K===s?k===v-1&&(w||R==="*"||N)&&(Q=O):(k<K&&Re(),k===K&&!N&&(w||R==="/")&&(Q=O)),Q}return a(ue,"tt"),t(ue,"cmnt"),Object.defineProperty({next:ie,peek:Re,push:F,skip:tt,cmnt:ue},"line",{get:t(function(){return v},"get")})}a(b,"n"),t(b,"tokenize")},{}],35:[function(n,i,c){i.exports=v;var o=n(23);((v.prototype=Object.create(o.prototype)).constructor=v).className="Type";var l=n(15),h=n(25),u=n(16),g=n(20),p=n(33),d=n(21),f=n(27),m=n(42),y=n(37),b=n(14),_=n(13),w=n(40),S=n(12),T=n(41);function v(O,k){o.call(this,O,k),this.fields={},this.oneofs=s,this.extensions=s,this.reserved=s,this.group=s,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}a(v,"m"),t(v,"Type"),Object.defineProperties(v.prototype,{fieldsById:{get:t(function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var O=Object.keys(this.fields),k=0;k<O.length;++k){var N=this.fields[O[k]],j=N.id;if(this._fieldsById[j])throw Error("duplicate id "+j+" in "+this);this._fieldsById[j]=N}return this._fieldsById},"get")},fieldsArray:{get:t(function(){return this._fieldsArray||(this._fieldsArray=y.toArray(this.fields))},"get")},oneofsArray:{get:t(function(){return this._oneofsArray||(this._oneofsArray=y.toArray(this.oneofs))},"get")},ctor:{get:t(function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},"get"),set:t(function(O){var k=O.prototype;k instanceof d||((O.prototype=new d).constructor=O,y.merge(O.prototype,k)),O.$type=O.prototype.$type=this,y.merge(O,d,!0),this._ctor=O;for(var N=0;N<this.fieldsArray.length;++N)this._fieldsArray[N].resolve();var j={};for(N=0;N<this.oneofsArray.length;++N)j[this._oneofsArray[N].resolve().name]={get:y.oneOfGetter(this._oneofsArray[N].oneof),set:y.oneOfSetter(this._oneofsArray[N].oneof)};N&&Object.defineProperties(O.prototype,j)},"set")}}),v.generateConstructor=t(function(O){for(var k=y.codegen(["p"],O.name),N=0,j;N<O.fieldsArray.length;++N)(j=O._fieldsArray[N]).map?k("this%s={}",y.safeProp(j.name)):j.repeated&&k("this%s=[]",y.safeProp(j.name));return k("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},"generateConstructor");function R(O){return O._fieldsById=O._fieldsArray=O._oneofsArray=null,delete O.encode,delete O.decode,delete O.verify,O}a(R,"w"),t(R,"clearCache"),v.fromJSON=t(function(O,k){var N=new v(O,k.options);N.extensions=k.extensions,N.reserved=k.reserved;for(var j=Object.keys(k.fields),V=0;V<j.length;++V)N.add((typeof k.fields[j[V]].keyType<"u"?g.fromJSON:u.fromJSON)(j[V],k.fields[j[V]]));if(k.oneofs)for(j=Object.keys(k.oneofs),V=0;V<j.length;++V)N.add(h.fromJSON(j[V],k.oneofs[j[V]]));if(k.nested)for(j=Object.keys(k.nested),V=0;V<j.length;++V){var pe=k.nested[j[V]];N.add((pe.id!==s?u.fromJSON:pe.fields!==s?v.fromJSON:pe.values!==s?l.fromJSON:pe.methods!==s?p.fromJSON:o.fromJSON)(j[V],pe))}return k.extensions&&k.extensions.length&&(N.extensions=k.extensions),k.reserved&&k.reserved.length&&(N.reserved=k.reserved),k.group&&(N.group=!0),k.comment&&(N.comment=k.comment),N},"fromJSON"),v.prototype.toJSON=t(function(O){var k=o.prototype.toJSON.call(this,O),N=O?!!O.keepComments:!1;return y.toObject(["options",k&&k.options||s,"oneofs",o.arrayToJSON(this.oneofsArray,O),"fields",o.arrayToJSON(this.fieldsArray.filter(function(j){return!j.declaringField}),O)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:s,"reserved",this.reserved&&this.reserved.length?this.reserved:s,"group",this.group||s,"nested",k&&k.nested||s,"comment",N?this.comment:s])},"toJSON"),v.prototype.resolveAll=t(function(){for(var O=this.fieldsArray,k=0;k<O.length;)O[k++].resolve();var N=this.oneofsArray;for(k=0;k<N.length;)N[k++].resolve();return o.prototype.resolveAll.call(this)},"resolveAll"),v.prototype.get=t(function(O){return this.fields[O]||this.oneofs&&this.oneofs[O]||this.nested&&this.nested[O]||null},"get"),v.prototype.add=t(function(O){if(this.get(O.name))throw Error("duplicate name '"+O.name+"' in "+this);if(O instanceof u&&O.extend===s){if(this._fieldsById?this._fieldsById[O.id]:this.fieldsById[O.id])throw Error("duplicate id "+O.id+" in "+this);if(this.isReservedId(O.id))throw Error("id "+O.id+" is reserved in "+this);if(this.isReservedName(O.name))throw Error("name '"+O.name+"' is reserved in "+this);return O.parent&&O.parent.remove(O),this.fields[O.name]=O,O.message=this,O.onAdd(this),R(this)}return O instanceof h?(this.oneofs||(this.oneofs={}),this.oneofs[O.name]=O,O.onAdd(this),R(this)):o.prototype.add.call(this,O)},"add"),v.prototype.remove=t(function(O){if(O instanceof u&&O.extend===s){if(!this.fields||this.fields[O.name]!==O)throw Error(O+" is not a member of "+this);return delete this.fields[O.name],O.parent=null,O.onRemove(this),R(this)}if(O instanceof h){if(!this.oneofs||this.oneofs[O.name]!==O)throw Error(O+" is not a member of "+this);return delete this.oneofs[O.name],O.parent=null,O.onRemove(this),R(this)}return o.prototype.remove.call(this,O)},"remove"),v.prototype.isReservedId=t(function(O){return o.isReservedId(this.reserved,O)},"isReservedId"),v.prototype.isReservedName=t(function(O){return o.isReservedName(this.reserved,O)},"isReservedName"),v.prototype.create=t(function(O){return new this.ctor(O)},"create"),v.prototype.setup=t(function(){for(var O=this.fullName,k=[],N=0;N<this.fieldsArray.length;++N)k.push(this._fieldsArray[N].resolve().resolvedType);this.encode=b(this)({Writer:m,types:k,util:y}),this.decode=_(this)({Reader:f,types:k,util:y}),this.verify=w(this)({types:k,util:y}),this.fromObject=S.fromObject(this)({types:k,util:y}),this.toObject=S.toObject(this)({types:k,util:y});var j=T[O];if(j){var V=Object.create(this);V.fromObject=this.fromObject,this.fromObject=j.fromObject.bind(V),V.toObject=this.toObject,this.toObject=j.toObject.bind(V)}return this},"setup"),v.prototype.encode=t(function(O,k){return this.setup().encode(O,k)},"encode_setup"),v.prototype.encodeDelimited=t(function(O,k){return this.encode(O,k&&k.len?k.fork():k).ldelim()},"encodeDelimited"),v.prototype.decode=t(function(O,k){return this.setup().decode(O,k)},"decode_setup"),v.prototype.decodeDelimited=t(function(O){return O instanceof f||(O=f.create(O)),this.decode(O,O.uint32())},"decodeDelimited"),v.prototype.verify=t(function(O){return this.setup().verify(O)},"verify_setup"),v.prototype.fromObject=t(function(O){return this.setup().fromObject(O)},"fromObject"),v.prototype.toObject=t(function(O,k){return this.setup().toObject(O,k)},"toObject"),v.d=t(function(O){return t(function(k){y.decorateType(k,O)},"typeDecorator")},"decorateType")},{12:12,13:13,14:14,15:15,16:16,20:20,21:21,23:23,25:25,27:27,33:33,37:37,40:40,41:41,42:42}],36:[function(n,i,c){var o=c,l=n(37),h=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function u(g,p){var d=0,f={};for(p|=0;d<g.length;)f[h[d+p]]=g[d++];return f}a(u,"u"),t(u,"bake"),o.basic=u([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),o.defaults=u([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",l.emptyArray,null]),o.long=u([0,0,0,1,1],7),o.mapKey=u([0,0,0,5,5,0,0,0,1,1,0,2],2),o.packed=u([1,5,0,0,0,5,5,0,0,0,1,1,0])},{37:37}],37:[function(n,i,c){var o=i.exports=n(39),l=n(30),h,u;o.codegen=n(3),o.fetch=n(5),o.path=n(8),o.fs=o.inquire("fs"),o.toArray=t(function(m){if(m){for(var y=Object.keys(m),b=new Array(y.length),_=0;_<y.length;)b[_]=m[y[_++]];return b}return[]},"toArray"),o.toObject=t(function(m){for(var y={},b=0;b<m.length;){var _=m[b++],w=m[b++];w!==s&&(y[_]=w)}return y},"toObject");var g=/\\/g,p=/"/g;o.isReserved=t(function(m){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(m)},"isReserved"),o.safeProp=t(function(m){return!/^[$\w_]+$/.test(m)||o.isReserved(m)?'["'+m.replace(g,"\\\\").replace(p,'\\"')+'"]':"."+m},"safeProp"),o.ucFirst=t(function(m){return m.charAt(0).toUpperCase()+m.substring(1)},"ucFirst");var d=/_([a-z])/g;o.camelCase=t(function(m){return m.substring(0,1)+m.substring(1).replace(d,function(y,b){return b.toUpperCase()})},"camelCase"),o.compareFieldsById=t(function(m,y){return m.id-y.id},"compareFieldsById"),o.decorateType=t(function(m,y){if(m.$type)return y&&m.$type.name!==y&&(o.decorateRoot.remove(m.$type),m.$type.name=y,o.decorateRoot.add(m.$type)),m.$type;h||(h=n(35));var b=new h(y||m.name);return o.decorateRoot.add(b),b.ctor=m,Object.defineProperty(m,"$type",{value:b,enumerable:!1}),Object.defineProperty(m.prototype,"$type",{value:b,enumerable:!1}),b},"decorateType");var f=0;o.decorateEnum=t(function(m){if(m.$type)return m.$type;u||(u=n(15));var y=new u("Enum"+f++,m);return o.decorateRoot.add(y),Object.defineProperty(m,"$type",{value:y,enumerable:!1}),y},"decorateEnum"),Object.defineProperty(o,"decorateRoot",{get:t(function(){return l.decorated||(l.decorated=new(n(29)))},"get")})},{15:15,29:29,3:3,30:30,35:35,39:39,5:5,8:8}],38:[function(n,i,c){i.exports=l;var o=n(39);function l(p,d){this.lo=p>>>0,this.hi=d>>>0}a(l,"d"),t(l,"LongBits");var h=l.zero=new l(0,0);h.toNumber=function(){return 0},h.zzEncode=h.zzDecode=function(){return this},h.length=function(){return 1};var u=l.zeroHash="\0\0\0\0\0\0\0\0";l.fromNumber=t(function(p){if(p===0)return h;var d=p<0;d&&(p=-p);var f=p>>>0,m=(p-f)/4294967296>>>0;return d&&(m=~m>>>0,f=~f>>>0,++f>4294967295&&(f=0,++m>4294967295&&(m=0))),new l(f,m)},"fromNumber"),l.from=t(function(p){if(typeof p=="number")return l.fromNumber(p);if(o.isString(p))if(o.Long)p=o.Long.fromString(p);else return l.fromNumber(parseInt(p,10));return p.low||p.high?new l(p.low>>>0,p.high>>>0):h},"from"),l.prototype.toNumber=t(function(p){if(!p&&this.hi>>>31){var d=~this.lo+1>>>0,f=~this.hi>>>0;return d||(f=f+1>>>0),-(d+f*4294967296)}return this.lo+this.hi*4294967296},"toNumber"),l.prototype.toLong=t(function(p){return o.Long?new o.Long(this.lo|0,this.hi|0,!!p):{low:this.lo|0,high:this.hi|0,unsigned:!!p}},"toLong");var g=String.prototype.charCodeAt;l.fromHash=t(function(p){return p===u?h:new l((g.call(p,0)|g.call(p,1)<<8|g.call(p,2)<<16|g.call(p,3)<<24)>>>0,(g.call(p,4)|g.call(p,5)<<8|g.call(p,6)<<16|g.call(p,7)<<24)>>>0)},"fromHash"),l.prototype.toHash=t(function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},"toHash"),l.prototype.zzEncode=t(function(){var p=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^p)>>>0,this.lo=(this.lo<<1^p)>>>0,this},"zzEncode"),l.prototype.zzDecode=t(function(){var p=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^p)>>>0,this.hi=(this.hi>>>1^p)>>>0,this},"zzDecode"),l.prototype.length=t(function(){var p=this.lo,d=(this.lo>>>28|this.hi<<4)>>>0,f=this.hi>>>24;return f===0?d===0?p<16384?p<128?1:2:p<2097152?3:4:d<16384?d<128?5:6:d<2097152?7:8:f<128?9:10},"length")},{39:39}],39:[function(n,i,c){var o=c;o.asPromise=n(1),o.base64=n(2),o.EventEmitter=n(4),o.float=n(6),o.inquire=n(7),o.utf8=n(10),o.pool=n(9),o.LongBits=n(38),o.emptyArray=Object.freeze?Object.freeze([]):[],o.emptyObject=Object.freeze?Object.freeze({}):{},o.isNode=!!(Er.process&&Er.process.versions&&Er.process.versions.node),o.isInteger=Number.isInteger||t(function(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u},"isInteger"),o.isString=t(function(u){return typeof u=="string"||u instanceof String},"isString"),o.isObject=t(function(u){return u&&typeof u=="object"},"isObject"),o.isset=o.isSet=t(function(u,g){var p=u[g];return p!=null&&u.hasOwnProperty(g)?typeof p!="object"||(Array.isArray(p)?p.length:Object.keys(p).length)>0:!1},"isSet"),o.Buffer=(function(){try{var u=o.inquire("buffer").Buffer;return u.prototype.utf8Write?u:null}catch{return null}})(),o._Buffer_from=null,o._Buffer_allocUnsafe=null,o.newBuffer=t(function(u){return typeof u=="number"?o.Buffer?o._Buffer_allocUnsafe(u):new o.Array(u):o.Buffer?o._Buffer_from(u):typeof Uint8Array>"u"?u:new Uint8Array(u)},"newBuffer"),o.Array=typeof Uint8Array<"u"?Uint8Array:Array,o.Long=Er.dcodeIO&&Er.dcodeIO.Long||o.inquire("long"),o.key2Re=/^true|false|0|1$/,o.key32Re=/^-?(?:0|[1-9][0-9]*)$/,o.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,o.longToHash=t(function(u){return u?o.LongBits.from(u).toHash():o.LongBits.zeroHash},"longToHash"),o.longFromHash=t(function(u,g){var p=o.LongBits.fromHash(u);return o.Long?o.Long.fromBits(p.lo,p.hi,g):p.toNumber(!!g)},"longFromHash");function l(u,g,p){for(var d=Object.keys(g),f=0;f<d.length;++f)(u[d[f]]===s||!p)&&(u[d[f]]=g[d[f]]);return u}a(l,"d"),t(l,"merge"),o.merge=l,o.lcFirst=t(function(u){return u.charAt(0).toLowerCase()+u.substring(1)},"lcFirst");function h(u){function g(p,d){if(!(this instanceof g))return new g(p,d);Object.defineProperty(this,"message",{get:t(function(){return p},"get")}),Error.captureStackTrace?Error.captureStackTrace(this,g):Object.defineProperty(this,"stack",{value:new Error().stack||""}),d&&l(this,d)}return a(g,"a"),t(g,"CustomError"),(g.prototype=Object.create(Error.prototype)).constructor=g,Object.defineProperty(g.prototype,"name",{get:t(function(){return u},"get")}),g.prototype.toString=t(function(){return this.name+": "+this.message},"toString"),g}a(h,"c"),t(h,"newError"),o.newError=h,o.ProtocolError=h("ProtocolError"),o.oneOfGetter=t(function(u){for(var g={},p=0;p<u.length;++p)g[u[p]]=1;return function(){for(var d=Object.keys(this),f=d.length-1;f>-1;--f)if(g[d[f]]===1&&this[d[f]]!==s&&this[d[f]]!==null)return d[f]}},"getOneOf"),o.oneOfSetter=t(function(u){return function(g){for(var p=0;p<u.length;++p)u[p]!==g&&delete this[u[p]]}},"setOneOf"),o.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},o._configure=function(){var u=o.Buffer;if(!u){o._Buffer_from=o._Buffer_allocUnsafe=null;return}o._Buffer_from=u.from!==Uint8Array.from&&u.from||t(function(g,p){return new u(g,p)},"Buffer_from"),o._Buffer_allocUnsafe=u.allocUnsafe||t(function(g){return new u(g)},"Buffer_allocUnsafe")}},{1:1,10:10,2:2,38:38,4:4,6:6,7:7,9:9}],40:[function(n,i,c){i.exports=p;var o=n(15),l=n(37);function h(d,f){return d.name+": "+f+(d.repeated&&f!=="array"?"[]":d.map&&f!=="object"?"{k:"+d.keyType+"}":"")+" expected"}a(h,"c"),t(h,"invalid");function u(d,f,m,y){if(f.resolvedType)if(f.resolvedType instanceof o){d("switch(%s){",y)("default:")("return%j",h(f,"enum value"));for(var b=Object.keys(f.resolvedType.values),_=0;_<b.length;++_)d("case %i:",f.resolvedType.values[b[_]]);d("break")("}")}else d("{")("var e=types[%i].verify(%s);",m,y)("if(e)")("return%j+e",f.name+".")("}");else switch(f.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":d("if(!util.isInteger(%s))",y)("return%j",h(f,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":d("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",y,y,y,y)("return%j",h(f,"integer|Long"));break;case"float":case"double":d('if(typeof %s!=="number")',y)("return%j",h(f,"number"));break;case"bool":d('if(typeof %s!=="boolean")',y)("return%j",h(f,"boolean"));break;case"string":d("if(!util.isString(%s))",y)("return%j",h(f,"string"));break;case"bytes":d('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',y,y,y)("return%j",h(f,"buffer"));break}return d}a(u,"u"),t(u,"genVerifyValue");function g(d,f,m){switch(f.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":d("if(!util.key32Re.test(%s))",m)("return%j",h(f,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":d("if(!util.key64Re.test(%s))",m)("return%j",h(f,"integer|Long key"));break;case"bool":d("if(!util.key2Re.test(%s))",m)("return%j",h(f,"boolean key"));break}return d}a(g,"a"),t(g,"genVerifyKey");function p(d){var f=l.codegen(["m"],d.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),m=d.oneofsArray,y={};m.length&&f("var p={}");for(var b=0;b<d.fieldsArray.length;++b){var _=d._fieldsArray[b].resolve(),w="m"+l.safeProp(_.name);if(_.optional&&f("if(%s!=null&&m.hasOwnProperty(%j)){",w,_.name),_.map)f("if(!util.isObject(%s))",w)("return%j",h(_,"object"))("var k=Object.keys(%s)",w)("for(var i=0;i<k.length;++i){"),g(f,_,"k[i]"),u(f,_,b,w+"[k[i]]")("}");else if(_.repeated)f("if(!Array.isArray(%s))",w)("return%j",h(_,"array"))("for(var i=0;i<%s.length;++i){",w),u(f,_,b,w+"[i]")("}");else{if(_.partOf){var S=l.safeProp(_.partOf.name);y[_.partOf.name]===1&&f("if(p%s===1)",S)("return%j",_.partOf.name+": multiple values"),y[_.partOf.name]=1,f("p%s=1",S)}u(f,_,b,w)}_.optional&&f("}")}return f("return null")}a(p,"s"),t(p,"verifier")},{15:15,37:37}],41:[function(n,i,c){var o=c,l=n(21);o[".google.protobuf.Any"]={fromObject:t(function(h){if(h&&h["@type"]){var u=this.lookup(h["@type"]);if(u){var g=h["@type"].charAt(0)==="."?h["@type"].substr(1):h["@type"];return this.create({type_url:"/"+g,value:u.encode(u.fromObject(h)).finish()})}}return this.fromObject(h)},"fromObject"),toObject:t(function(h,u){if(u&&u.json&&h.type_url&&h.value){var g=h.type_url.substring(h.type_url.lastIndexOf("/")+1),p=this.lookup(g);p&&(h=p.decode(h.value))}if(!(h instanceof this.ctor)&&h instanceof l){var d=h.$type.toObject(h,u);return d["@type"]=h.$type.fullName,d}return this.toObject(h,u)},"toObject")}},{21:21}],42:[function(n,i,c){i.exports=m;var o=n(39),l,h=o.LongBits,u=o.base64,g=o.utf8;function p(v,R,O){this.fn=v,this.len=R,this.next=s,this.val=O}a(p,"s"),t(p,"Op");function d(){}a(d,"t"),t(d,"noop");function f(v){this.head=v.head,this.tail=v.tail,this.len=v.len,this.next=v.states}a(f,"r"),t(f,"State");function m(){this.len=0,this.head=new p(d,0,0),this.tail=this.head,this.states=null}a(m,"e"),t(m,"Writer"),m.create=o.Buffer?t(function(){return(m.create=t(function(){return new l},"create_buffer"))()},"create_buffer_setup"):t(function(){return new m},"create_array"),m.alloc=t(function(v){return new o.Array(v)},"alloc"),o.Array!==Array&&(m.alloc=o.pool(m.alloc,o.Array.prototype.subarray)),m.prototype._push=t(function(v,R,O){return this.tail=this.tail.next=new p(v,R,O),this.len+=R,this},"push");function y(v,R,O){R[O]=v&255}a(y,"f"),t(y,"writeByte");function b(v,R,O){for(;v>127;)R[O++]=v&127|128,v>>>=7;R[O]=v}a(b,"n"),t(b,"writeVarint32");function _(v,R){this.len=v,this.next=s,this.val=R}a(_,"o"),t(_,"VarintOp"),_.prototype=Object.create(p.prototype),_.prototype.fn=b,m.prototype.uint32=t(function(v){return this.len+=(this.tail=this.tail.next=new _((v=v>>>0)<128?1:v<16384?2:v<2097152?3:v<268435456?4:5,v)).len,this},"write_uint32"),m.prototype.int32=t(function(v){return v<0?this._push(w,10,h.fromNumber(v)):this.uint32(v)},"write_int32"),m.prototype.sint32=t(function(v){return this.uint32((v<<1^v>>31)>>>0)},"write_sint32");function w(v,R,O){for(;v.hi;)R[O++]=v.lo&127|128,v.lo=(v.lo>>>7|v.hi<<25)>>>0,v.hi>>>=7;for(;v.lo>127;)R[O++]=v.lo&127|128,v.lo=v.lo>>>7;R[O++]=v.lo}a(w,"p"),t(w,"writeVarint64"),m.prototype.uint64=t(function(v){var R=h.from(v);return this._push(w,R.length(),R)},"write_uint64"),m.prototype.int64=m.prototype.uint64,m.prototype.sint64=t(function(v){var R=h.from(v).zzEncode();return this._push(w,R.length(),R)},"write_sint64"),m.prototype.bool=t(function(v){return this._push(y,1,v?1:0)},"write_bool");function S(v,R,O){R[O]=v&255,R[O+1]=v>>>8&255,R[O+2]=v>>>16&255,R[O+3]=v>>>24}a(S,"h"),t(S,"writeFixed32"),m.prototype.fixed32=t(function(v){return this._push(S,4,v>>>0)},"write_fixed32"),m.prototype.sfixed32=m.prototype.fixed32,m.prototype.fixed64=t(function(v){var R=h.from(v);return this._push(S,4,R.lo)._push(S,4,R.hi)},"write_fixed64"),m.prototype.sfixed64=m.prototype.fixed64,m.prototype.float=t(function(v){return this._push(o.float.writeFloatLE,4,v)},"write_float"),m.prototype.double=t(function(v){return this._push(o.float.writeDoubleLE,8,v)},"write_double");var T=o.Array.prototype.set?t(function(v,R,O){R.set(v,O)},"writeBytes_set"):t(function(v,R,O){for(var k=0;k<v.length;++k)R[O+k]=v[k]},"writeBytes_for");m.prototype.bytes=t(function(v){var R=v.length>>>0;if(!R)return this._push(y,1,0);if(o.isString(v)){var O=m.alloc(R=u.length(v));u.decode(v,O,0),v=O}return this.uint32(R)._push(T,R,v)},"write_bytes"),m.prototype.string=t(function(v){var R=g.length(v);return R?this.uint32(R)._push(g.write,R,v):this._push(y,1,0)},"write_string"),m.prototype.fork=t(function(){return this.states=new f(this),this.head=this.tail=new p(d,0,0),this.len=0,this},"fork"),m.prototype.reset=t(function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new p(d,0,0),this.len=0),this},"reset"),m.prototype.ldelim=t(function(){var v=this.head,R=this.tail,O=this.len;return this.reset().uint32(O),O&&(this.tail.next=v.next,this.tail=R,this.len+=O),this},"ldelim"),m.prototype.finish=t(function(){for(var v=this.head.next,R=this.constructor.alloc(this.len),O=0;v;)v.fn(v.val,R,O),O+=v.len,v=v.next;return R},"finish"),m._configure=function(v){l=v}},{39:39}],43:[function(n,i,c){i.exports=u;var o=n(42);(u.prototype=Object.create(o.prototype)).constructor=u;var l=n(39),h=l.Buffer;function u(){o.call(this)}a(u,"u"),t(u,"BufferWriter"),u.alloc=t(function(d){return(u.alloc=l._Buffer_allocUnsafe)(d)},"alloc_buffer");var g=h&&h.prototype instanceof Uint8Array&&h.prototype.set.name==="set"?t(function(d,f,m){f.set(d,m)},"writeBytesBuffer_set"):t(function(d,f,m){if(d.copy)d.copy(f,m,0,d.length);else for(var y=0;y<d.length;)f[m++]=d[y++]},"writeBytesBuffer_copy");u.prototype.bytes=t(function(d){l.isString(d)&&(d=l._Buffer_from(d,"base64"));var f=d.length>>>0;return this.uint32(f),f&&this._push(g,f,d),this},"write_bytes_buffer");function p(d,f,m){d.length<40?l.utf8.write(d,f,m):f.utf8Write(d,m)}a(p,"s"),t(p,"writeStringBuffer"),u.prototype.string=t(function(d){var f=h.byteLength(d);return this.uint32(f),f&&this._push(p,f,d),this},"write_string_buffer")},{39:39,42:42}]},{},[19])})()})(jn)),jn.exports}a(vy,"requireProtobuf");var Ey=vy();const Or=Sy(Ey);var Oy=Object.defineProperty,$=a((r,e)=>Oy(r,"name",{value:e,configurable:!0}),"s$3");let re=Or.Reader,Pe=Or.Writer,ke=Or.util;const x=Or.roots["push-server"]||(Or.roots["push-server"]={});x.RequestBatch=(function(){function r(e){if(this.requests=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"RequestBatch"),r.prototype.requests=ke.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=Pe.create()),e.requests!=null&&e.requests.length)for(var s=0;s<e.requests.length;++s)x.Request.encode(e.requests[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.RequestBatch;e.pos<s;){var i=e.uint32();i>>>3===1?(n.requests&&n.requests.length||(n.requests=[]),n.requests.push(x.Request.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.Request=(function(){function r(t){if(t)for(var s=Object.keys(t),n=0;n<s.length;++n)t[s[n]]!=null&&(this[s[n]]=t[s[n]])}a(r,"t"),$(r,"Request"),r.prototype.incomingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:ke.oneOfGetter(e=["incomingMessages","channelStats","serverStats"]),set:ke.oneOfSetter(e)}),r.create=$(function(t){return new r(t)},"create"),r.encode=$(function(t,s){return s||(s=Pe.create()),t.incomingMessages!=null&&t.hasOwnProperty("incomingMessages")&&x.IncomingMessagesRequest.encode(t.incomingMessages,s.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&x.ChannelStatsRequest.encode(t.channelStats,s.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&x.ServerStatsRequest.encode(t.serverStats,s.uint32(26).fork()).ldelim(),s},"encode"),r.decode=$(function(t,s){t instanceof re||(t=re.create(t));for(var n=s===void 0?t.len:t.pos+s,i=new x.Request;t.pos<n;){var c=t.uint32();switch(c>>>3){case 1:i.incomingMessages=x.IncomingMessagesRequest.decode(t,t.uint32());break;case 2:i.channelStats=x.ChannelStatsRequest.decode(t,t.uint32());break;case 3:i.serverStats=x.ServerStatsRequest.decode(t,t.uint32());break;default:t.skipType(c&7);break}}return i},"decode"),r})(),x.IncomingMessagesRequest=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"IncomingMessagesRequest"),r.prototype.messages=ke.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=Pe.create()),e.messages!=null&&e.messages.length)for(var s=0;s<e.messages.length;++s)x.IncomingMessage.encode(e.messages[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.IncomingMessagesRequest;e.pos<s;){var i=e.uint32();i>>>3===1?(n.messages&&n.messages.length||(n.messages=[]),n.messages.push(x.IncomingMessage.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.IncomingMessage=(function(){function r(e){if(this.receivers=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"IncomingMessage"),r.prototype.receivers=ke.emptyArray,r.prototype.sender=null,r.prototype.body="",r.prototype.expiry=0,r.prototype.type="",r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=Pe.create()),e.receivers!=null&&e.receivers.length)for(var s=0;s<e.receivers.length;++s)x.Receiver.encode(e.receivers[s],t.uint32(10).fork()).ldelim();return e.sender!=null&&e.hasOwnProperty("sender")&&x.Sender.encode(e.sender,t.uint32(18).fork()).ldelim(),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(26).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(32).uint32(e.expiry),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(42).string(e.type),t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.IncomingMessage;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.receivers&&n.receivers.length||(n.receivers=[]),n.receivers.push(x.Receiver.decode(e,e.uint32()));break;case 2:n.sender=x.Sender.decode(e,e.uint32());break;case 3:n.body=e.string();break;case 4:n.expiry=e.uint32();break;case 5:n.type=e.string();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.ChannelStatsRequest=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ChannelStatsRequest"),r.prototype.channels=ke.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=Pe.create()),e.channels!=null&&e.channels.length)for(var s=0;s<e.channels.length;++s)x.ChannelId.encode(e.channels[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ChannelStatsRequest;e.pos<s;){var i=e.uint32();i>>>3===1?(n.channels&&n.channels.length||(n.channels=[]),n.channels.push(x.ChannelId.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.ChannelId=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ChannelId"),r.prototype.id=ke.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=ke.newBuffer([]),r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=Pe.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ChannelId;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.signature=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.ServerStatsRequest=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ServerStatsRequest"),r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=Pe.create()),t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ServerStatsRequest;e.pos<s;){var i=e.uint32();switch(i>>>3){default:e.skipType(i&7);break}}return n},"decode"),r})(),x.Sender=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"Sender"),r.prototype.type=0,r.prototype.id=ke.newBuffer([]),r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=Pe.create()),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(8).int32(e.type),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(18).bytes(e.id),t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.Sender;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.type=e.int32();break;case 2:n.id=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.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})(),x.Receiver=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"Receiver"),r.prototype.id=ke.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=ke.newBuffer([]),r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=Pe.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.Receiver;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.signature=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.ResponseBatch=(function(){function r(e){if(this.responses=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ResponseBatch"),r.prototype.responses=ke.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=Pe.create()),e.responses!=null&&e.responses.length)for(var s=0;s<e.responses.length;++s)x.Response.encode(e.responses[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ResponseBatch;e.pos<s;){var i=e.uint32();i>>>3===1?(n.responses&&n.responses.length||(n.responses=[]),n.responses.push(x.Response.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.Response=(function(){function r(t){if(t)for(var s=Object.keys(t),n=0;n<s.length;++n)t[s[n]]!=null&&(this[s[n]]=t[s[n]])}a(r,"t"),$(r,"Response"),r.prototype.outgoingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:ke.oneOfGetter(e=["outgoingMessages","channelStats","serverStats"]),set:ke.oneOfSetter(e)}),r.create=$(function(t){return new r(t)},"create"),r.encode=$(function(t,s){return s||(s=Pe.create()),t.outgoingMessages!=null&&t.hasOwnProperty("outgoingMessages")&&x.OutgoingMessagesResponse.encode(t.outgoingMessages,s.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&x.ChannelStatsResponse.encode(t.channelStats,s.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&x.JsonResponse.encode(t.serverStats,s.uint32(26).fork()).ldelim(),s},"encode"),r.decode=$(function(t,s){t instanceof re||(t=re.create(t));for(var n=s===void 0?t.len:t.pos+s,i=new x.Response;t.pos<n;){var c=t.uint32();switch(c>>>3){case 1:i.outgoingMessages=x.OutgoingMessagesResponse.decode(t,t.uint32());break;case 2:i.channelStats=x.ChannelStatsResponse.decode(t,t.uint32());break;case 3:i.serverStats=x.JsonResponse.decode(t,t.uint32());break;default:t.skipType(c&7);break}}return i},"decode"),r})(),x.OutgoingMessagesResponse=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"OutgoingMessagesResponse"),r.prototype.messages=ke.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=Pe.create()),e.messages!=null&&e.messages.length)for(var s=0;s<e.messages.length;++s)x.OutgoingMessage.encode(e.messages[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.OutgoingMessagesResponse;e.pos<s;){var i=e.uint32();i>>>3===1?(n.messages&&n.messages.length||(n.messages=[]),n.messages.push(x.OutgoingMessage.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.OutgoingMessage=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"OutgoingMessage"),r.prototype.id=ke.newBuffer([]),r.prototype.body="",r.prototype.expiry=0,r.prototype.created=0,r.prototype.sender=null,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=Pe.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")&&x.Sender.encode(e.sender,t.uint32(42).fork()).ldelim(),t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.OutgoingMessage;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.body=e.string();break;case 3:n.expiry=e.uint32();break;case 4:n.created=e.fixed32();break;case 5:n.sender=x.Sender.decode(e,e.uint32());break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.ChannelStatsResponse=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ChannelStatsResponse"),r.prototype.channels=ke.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=Pe.create()),e.channels!=null&&e.channels.length)for(var s=0;s<e.channels.length;++s)x.ChannelStats.encode(e.channels[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ChannelStatsResponse;e.pos<s;){var i=e.uint32();i>>>3===1?(n.channels&&n.channels.length||(n.channels=[]),n.channels.push(x.ChannelStats.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.ChannelStats=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ChannelStats"),r.prototype.id=ke.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.isOnline=!1,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=Pe.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.isOnline!=null&&e.hasOwnProperty("isOnline")&&t.uint32(24).bool(e.isOnline),t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ChannelStats;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.isOnline=e.bool();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.JsonResponse=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"JsonResponse"),r.prototype.json="",r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=Pe.create()),e.json!=null&&e.hasOwnProperty("json")&&t.uint32(10).string(e.json),t},"encode"),r.decode=$(function(e,t){e instanceof re||(e=re.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.JsonResponse;e.pos<s;){var i=e.uint32();i>>>3===1?n.json=e.string():e.skipType(i&7)}return n},"decode"),r})();const Ty=x.ResponseBatch,ac=x.RequestBatch,ky=x.IncomingMessage,cc=x.Receiver;var Iy=Object.defineProperty,Ay=a((r,e)=>Iy(r,"name",{value:e,configurable:!0}),"o$1");class lc{static{a(this,"AbstractConnector")}static{Ay(this,"AbstractConnector")}_logger;_connected=!1;_connectionType;_disconnectCode=0;_disconnectReason="";_parent;_callbacks;constructor(e){this._logger=te.createNullLogger(),this._parent=e.parent,this._connectionType=fe.Undefined,this._callbacks={onOpen:P.isFunction(e.onOpen)?e.onOpen:()=>{},onDisconnect:P.isFunction(e.onDisconnect)?e.onDisconnect:()=>{},onError:P.isFunction(e.onError)?e.onError:()=>{},onMessage:P.isFunction(e.onMessage)?e.onMessage:()=>{}}}setLogger(e){this._logger=e}getLogger(){return this._logger}destroy(){}get connected(){return this._connected}set connected(e){e!=this._connected&&(this._connected=e,this._connected?this._callbacks.onOpen():this._callbacks.onDisconnect({code:this.disconnectCode,reason:this.disconnectReason}))}get disconnectCode(){return this._disconnectCode}get disconnectReason(){return this._disconnectReason}get connectionPath(){return this._parent.getConnectionPath(this._connectionType)}}var Ry=Object.defineProperty,Cy=a((r,e)=>Ry(r,"name",{value:e,configurable:!0}),"s$2");class Ny extends lc{static{a(this,"WebSocketConnector")}static{Cy(this,"WebSocketConnector")}_socket;_onSocketOpenHandler;_onSocketCloseHandler;_onSocketErrorHandler;_onSocketMessageHandler;constructor(e){super(e),this._connectionType=fe.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(`${J.getDateForLog()}: Pull: WebSocket is not connected`),!1):(this._socket.send(e),!0)}_onSocketOpen(){this.connected=!0}_onSocketClose(e){this._socket=null,this._disconnectCode=Number(e.code),this._disconnectReason=e.reason,this.connected=!1}_onSocketError(e){this._callbacks.onError(new Error(`Socket error: ${e}`))}_onSocketMessage(e){this._callbacks.onMessage(e.data)}clearEventListener(){this._socket&&(this._socket.removeEventListener("open",this._onSocketOpenHandler),this._socket.removeEventListener("close",this._onSocketCloseHandler),this._socket.removeEventListener("error",this._onSocketErrorHandler),this._socket.removeEventListener("message",this._onSocketMessageHandler))}_createSocket(){if(this._socket)throw new Error("Socket already exists");if(!this.connectionPath)throw new Error("Websocket connection path is not defined");this._socket=new WebSocket(this.connectionPath),this._socket.binaryType="arraybuffer",this._socket.addEventListener("open",this._onSocketOpenHandler),this._socket.addEventListener("close",this._onSocketCloseHandler),this._socket.addEventListener("error",this._onSocketErrorHandler),this._socket.addEventListener("message",this._onSocketMessageHandler)}}var Dy=Object.defineProperty,Ly=a((r,e)=>Dy(r,"name",{value:e,configurable:!0}),"s$1");const Py=60;class My extends lc{static{a(this,"LongPollingConnector")}static{Ly(this,"LongPollingConnector")}_active;_requestTimeout;_failureTimeout;_xhr;_requestAborted;constructor(e){super(e),this._active=!1,this._connectionType=fe.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),Py*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(`${J.getDateForLog()}: Pull: publication path is empty`),!1;const s=new XMLHttpRequest;return s.open("POST",t),s.send(e),!0}onResponse(e){if(this.clearTimeOut(),this._xhr.status===200)this.connected=!0,P.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");P.isStringFilled(t)&&this._parent.setLastMessageId(t||"")}this.performRequest()}else this._callbacks.onError(new Error("Could not connect to the server")),this.connected=!1}clearTimeOut(){this._failureTimeout&&(clearTimeout(this._failureTimeout),this._failureTimeout=null),this._requestTimeout&&(clearTimeout(this._requestTimeout),this._requestTimeout=null)}createXhr(){const e=new XMLHttpRequest;return this._parent.isProtobufSupported()&&!this._parent.isJsonRpc()&&(e.responseType="arraybuffer"),e.addEventListener("readystatechange",this.onXhrReadyStateChange.bind(this)),e}}var Fy=Object.defineProperty,uc=a((r,e)=>Fy(r,"name",{value:e,configurable:!0}),"v");const Tr=19,hc=1800,xy=5e3,$y=60*1e3,dc=10,fc=10,By="ping",jy="pong",pc="bx-pull-session",Uy=20,mc={api:{},channels:{},publicChannels:{},server:{timeShift:0},clientId:null,jwt:null,exp:0};class gc{static{a(this,"PullClient")}static{uc(this,"PullClient")}_logger;_restClient;_status;_context;_guestMode;_guestUserId;_userId;_configGetMethod;_getPublicListMethod;_siteId;_enabled;_unloading=!1;_starting=!1;_debug=!1;_connectionAttempt=0;_connectionType=fe.WebSocket;_skipStorageInit;_skipCheckRevision;_subscribers={};_watchTagsQueue=new Map;_watchUpdateInterval=174e4;_watchForceUpdateInterval=5e3;_configTimestamp=0;_session={mid:null,tag:null,time:null,history:{},lastMessageIds:[],messageCount:0};_connectors={[fe.Undefined]:null,[fe.WebSocket]:null,[fe.LongPolling]:null};_isSecure;_config=null;_storage=null;_sharedConfig;_channelManager;_jsonRpcAdapter=null;_reconnectTimeout=null;_restartTimeout=null;_restoreWebSocketTimeout=null;_checkInterval=null;_offlineTimeout=null;_watchUpdateTimeout=null;_pingWaitTimeout=null;_isManualDisconnect=!1;_loggingEnabled=!1;_onPingTimeoutHandler;_userStatusCallbacks={};_connectPromise=null;_startingPromise=null;constructor(e){this._logger=te.createNullLogger(),this._restClient=e.b24,this._status=qe.Offline,this._context="master",e.restApplication&&(typeof e.configGetMethod>"u"&&(e.configGetMethod="pull.application.config.get"),typeof e.skipCheckRevision>"u"&&(e.skipCheckRevision=!0),P.isStringFilled(e.restApplication)&&(e.siteId=e.restApplication),e.serverEnabled=!0),this._guestMode=e.guestMode?J.toBoolean(e.guestMode):!1,this._guestUserId=e.guestUserId?J.toInteger(e.guestUserId):0,this._guestMode&&this._guestUserId>0?this._userId=this._guestUserId:(this._guestMode=!1,this._userId=e.userId?J.toInteger(e.userId):0),this._siteId=e.siteId??"none",this._enabled=P.isUndefined(e.serverEnabled)?!0:e.serverEnabled===!0,this._configGetMethod=P.isStringFilled(e.configGetMethod)?e.configGetMethod||"":"pull.config.get",this._getPublicListMethod=P.isStringFilled(e.getPublicListMethod)?e.getPublicListMethod||"":"pull.channel.public.list",this._skipStorageInit=e.skipStorageInit===!0,this._skipCheckRevision=e.skipCheckRevision===!0,P.isUndefined(e.configTimestamp)||(this._configTimestamp=J.toInteger(e.configTimestamp)),this._isSecure=document?.location.href.indexOf("https")===0,this._userId&&!this._skipStorageInit&&(this._storage=new nc({userId:this._userId,siteId:this._siteId})),this._sharedConfig=new yy({onWebSocketBlockChanged:this.onWebSocketBlockChanged.bind(this),storage:this._storage}),this._channelManager=new wy({b24:this._restClient,getPublicListMethod:this._getPublicListMethod}),this._loggingEnabled=this._sharedConfig.isLoggingEnabled(),this._onPingTimeoutHandler=this.onPingTimeout.bind(this)}setLogger(e){this._logger=e,this._jsonRpcAdapter?.setLogger(this.getLogger()),this._storage?.setLogger(this.getLogger()),this._sharedConfig.setLogger(this.getLogger()),this._channelManager.setLogger(this.getLogger()),this._connectors.webSocket?.setLogger(this.getLogger()),this._connectors.longPolling?.setLogger(this.getLogger())}getLogger(){return this._logger}destroy(){this.stop(De.NORMAL_CLOSURE,"manual stop"),this.onBeforeUnload()}init(){this._connectors.webSocket=new Ny({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 My({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()?fe.WebSocket:fe.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 py({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===qe.Offline?this.sendPullStatusDelayed(e,xy):this.sendPullStatus(e))}get session(){return this._session}subscribe(e){if(!P.isPlainObject(e))return this.attachCommandHandler(e);if(e=e,e.type=e.type||He.Server,e.command=e.command||null,e.type==He.Server||e.type==He.Client){if(typeof e.moduleId>"u")throw new TypeError(`${J.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(`${J.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string.`),()=>{};let t=He.Server;return typeof e.getSubscriptionType=="function"&&(t=e.getSubscriptionType()),this.subscribe({type:t,moduleId:e.getModuleId(),callback:uc(s=>{let n=null;if(typeof e.getMap=="function"){const i=e.getMap();if(i&&typeof i=="object"){const c=i[s.command];typeof c=="function"?n=c.bind(e):typeof c=="string"&&typeof e[c]=="function"&&(n=e[c].bind(e))}}if(!n){const i=`handle${J.capitalize(s.command)}`;typeof e[i]=="function"&&(n=e[i].bind(e))}n&&(this._debug&&this._context!=="master"&&this.getLogger().warning(`${J.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,{data:s}),n(s.params,s.extra,s.command))},"callback")})}async start(e=null){let t=!0;if(this.isConnected())return Promise.resolve(!0);if(this._starting&&this._startingPromise)return this._startingPromise;if(!this._userId)throw new Error("Not set userId");if(this._siteId==="none")throw new Error("Not set siteId");let s=!1;if(e&&P.isPlainObject(e)&&(typeof e?.skipReconnectToLastSession<"u"&&(s=e.skipReconnectToLastSession,delete e.skipReconnectToLastSession),this._config=e,t=!1),!this._enabled)return Promise.reject({ex:{error:"PULL_DISABLED",error_description:"Push & Pull server is disabled"}});const n=Date.now();let i;return!s&&this._storage&&(i=this._storage.get(pc,null)),P.isPlainObject(i)&&Object.prototype.hasOwnProperty.call(i,"ttl")&&i.ttl>=n&&(this._session.mid=i.mid),this._starting=!0,this._startingPromise=new Promise((c,o)=>{this.loadConfig("client_start").then(l=>{this.setConfig(l,t),this.init(),this.updateWatch(!0),this.startCheckConfig(),this.connect().then(()=>c(!0),h=>o(h))}).catch(l=>{this._starting=!1,this.status=qe.Offline,this.stopCheckConfig(),this.getLogger().error(`${J.getDateForLog()}: Pull: could not read push-server config`,{error:l}),o(l)})})}restart(e=De.NORMAL_CLOSURE,t="manual restart"){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),this.getLogger().debug(`${J.getDateForLog()}: Pull: restarting with code ${e}`),this.disconnect(e,t),this._storage&&this._storage.remove(Ve.PullConfig),this._config=null;const s=`${e}_${t.replaceAll(" ","_")}`;this.loadConfig(s).then(n=>{this.setConfig(n,!0),this.updateWatch(),this.startCheckConfig(),this.connect().catch(i=>{this.getLogger().error("restart error",{error:i})})},n=>{this.getLogger().error(`${J.getDateForLog()}: Pull: could not read push-server config `,{error:n}),this.status=qe.Offline,this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),(n?.status==401||n?.status==403)&&(this.stopCheckConfig(),this.onCustomEvent("onPullError",["AUTHORIZE_ERROR"]))})}stop(e=De.NORMAL_CLOSURE,t="manual stop"){this.disconnect(e,t),this.stopCheckConfig()}reconnect(e,t,s=1){this.disconnect(e,t),this.scheduleReconnect(s)}setLastMessageId(e){this._session.mid=e}async sendMessage(e,t,s,n,i){const c={userList:e,body:{module_id:t,command:s,params:n},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(nt.Publish,c):this.sendMessageBatch([c])}async sendMessageToChannels(e,t,s,n,i){const c={channelList:e,body:{module_id:t,command:s,params:n},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(nt.Publish,c):this.sendMessageBatch([c])}capturePullEvent(e=!0){this._debug=e}enableLogging(e=!0){this._sharedConfig.setLoggingEnabled(e),this._loggingEnabled=e}async listChannels(){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(nt.ListChannels,{})||Promise.reject(new Error("jsonRpcAdapter not init"))}async getUsersLastSeen(e){if(!P.isArray(e)||!e.every(s=>typeof s=="number"))throw new Error("userList must be an array of numbers");const t={};return new Promise((s,n)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(nt.GetUsersLastSeen,{userList:e}).then(i=>{const c=[];for(let l=0;l<e.length;l++)Object.prototype.hasOwnProperty.call(i,e[l])||c.push(e[l]);if(c.length===0)return s(t);const o={userIds:c,sendToQueueSever:!0};this._restClient.actions.v2.call.make({method:"pull.api.user.getLastSeen",params:o}).then(l=>{const h=l.getData().result;for(const u in h)t[Number(u)]=Number(h[u]);return s(t)}).catch(l=>{this.getLogger().error("getUsersLastSeen",{error:l}),n(l)})}).catch(i=>{this.getLogger().error("getUsersLastSeen",{error:i}),n(i)})})}async ping(e=5){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(nt.Ping,{},e)}async subscribeUserStatusChange(e,t){return new Promise((s,n)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(nt.SubscribeStatusChange,{userId:e}).then(()=>(this._userStatusCallbacks[e]||(this._userStatusCallbacks[e]=[]),P.isFunction(t)&&this._userStatusCallbacks[e].push(t),s())).catch(i=>n(i))})}async unsubscribeUserStatusChange(e,t){return this._userStatusCallbacks[e]&&(this._userStatusCallbacks[e]=this._userStatusCallbacks[e].filter(s=>s!==t),this._userStatusCallbacks[e].length===0)?this._jsonRpcAdapter?.executeOutgoingRpcCommand(nt.UnsubscribeStatusChange,{userId:e}):Promise.resolve()}getRevision(){return this._config&&this._config.api?this._config.api.revision_web:null}getServerVersion(){return this._config&&this._config.server?this._config.server.version:0}getServerMode(){return this._config&&this._config.server?this._config.server.mode:null}getConfig(){return this._config}getDebugInfo(){if(!JSON||!JSON.stringify)return{};let e;this._config&&this._config.channels?e={ChannelID:this._config.channels.private?.id||"n/a",ChannelDie:this._config.channels.private?.end||"n/a",ChannelDieShared:this._config.channels.shared?.end||"n/a"}:e={ConfigError:"config is not loaded"};let t="-";return this._connectors.webSocket&&this._connectors.webSocket?.socket&&(this.isJsonRpc()?t="json-rpc":t=this._connectors.webSocket?.socket?.url.search("binaryMode=true")!=-1?"protobuf":"text"),{UserId:this._userId+(this._userId>0?"":"(guest)"),"Guest userId":this._guestMode&&this._guestUserId!==0?this._guestUserId:"-","Browser online":navigator.onLine?"Y":"N",Connect:this.isConnected()?"Y":"N","Server type":this.isSharedMode()?"cloud":"local","WebSocket supported":this.isWebSocketSupported()?"Y":"N","WebSocket connected":this._connectors.webSocket&&this._connectors.webSocket.connected?"Y":"N","WebSocket mode":t,"Try connect":this._reconnectTimeout?"Y":"N","Try number":this._connectionAttempt,Path:this.connector?.connectionPath||"-",...e,"Last message":this._session.mid||"-","Session history":this._session.history,"Watch tags":this._watchTagsQueue.entries()}}getConnectionPath(e){let t;const s={};switch(e){case fe.WebSocket:t=this._isSecure?this._config?.server.websocket_secure:this._config?.server.websocket;break;case fe.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(!P.isStringFilled(t))throw new Error("Empty path");if(typeof this._config?.jwt=="string"&&this._config?.jwt!=="")s.token=this._config?.jwt;else{const n=[];if(this._config?.channels?.private&&n.push(this._config.channels.private?.id||""),this._config?.channels.private?.id&&n.push(this._config.channels.private.id),this._config?.channels.shared?.id&&n.push(this._config.channels.shared.id),n.length===0)throw new Error("Empty channels");s.CHANNEL_ID=n.join("/")}if(this.isJsonRpc()?s.jsonRpc="true":this.isProtobufSupported()&&(s.binaryMode="true"),this.isSharedMode()){if(!this._config?.clientId)throw new Error("Push-server is in shared mode, but clientId is not set");s.clientId=this._config.clientId}return this._session.mid&&(s.mid=this._session.mid),this._session.tag&&(s.tag=this._session.tag),this._session.time&&(s.time=this._session.time),s.revision=Tr,`${t}?${J.buildQueryString(s)}`}getPublicationPath(){const e=this._isSecure?this._config?.server.publish_secure:this._config?.server.publish;if(!e)return"";const t=[];this._config?.channels.private?.id&&t.push(this._config.channels.private.id),this._config?.channels.shared?.id&&t.push(this._config.channels.shared.id);const s={CHANNEL_ID:t.join("/")};return e+"?"+J.buildQueryString(s)}isConnected(){return this.connector?this.connector.connected:!1}isWebSocketSupported(){return typeof window.WebSocket<"u"}isWebSocketAllowed(){return this._sharedConfig.isWebSocketBlocked()?!1:this.isWebSocketEnabled()}isWebSocketEnabled(){return!this.isWebSocketSupported()||!this._config||!this._config.server?!1:this._config.server.websocket_enabled}isPublishingSupported(){return this.getServerVersion()>3}isPublishingEnabled(){return this.isPublishingSupported()?this._config?.server.publish_enabled===!0:!1}isProtobufSupported(){return this.getServerVersion()==4&&!Mo.isIE()}isJsonRpc(){return this.getServerVersion()>=5}isSharedMode(){return this.getServerMode()===Qs.Shared}emit(e){if(e.type==He.Server||e.type==He.Client){if(typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof e.moduleId>"u")throw new TypeError(`${J.getDateForLog()}: Pull.emit: parameter moduleId is not specified`);return typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),this._subscribers[e.type][e.moduleId].callbacks.length>0&&this._subscribers[e.type][e.moduleId].callbacks.forEach(t=>{t(e.data,{type:e.type,moduleId:e.moduleId??"?"})}),!(typeof e.data>"u")&&!(typeof e.data.command>"u")&&this._subscribers[e.type][e.moduleId].commands[e.data.command]&&this._subscribers[e.type][e.moduleId].commands[e.data.command].length>0&&this._subscribers[e.type][e.moduleId].commands[e.data.command].forEach(t=>{typeof e.data>"u"||t(e.data.params,e.data.extra,e.data.command,{type:e.type,moduleId:e.moduleId})}),!0}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].length<=0||this._subscribers[e.type].forEach(t=>{t(e.data,{type:e.type})}),!0}broadcastMessage(e){const t=e.module_id=e.module_id.toLowerCase(),s=e.command;e.extra||(e.extra={}),e.extra.server_time_unix&&(e.extra.server_time_ago=(Date.now()-e.extra.server_time_unix*1e3)/1e3-(this._config?.server.timeShift||0),e.extra.server_time_ago=Math.max(e.extra.server_time_ago,0)),this.logMessage(e);try{e.extra.sender&&e.extra.sender.type===Gr.Client?(this.onCustomEvent("onPullClientEvent-"+t,[s,e.params,e.extra],!0),this.onCustomEvent("onPullClientEvent",[t,s,e.params,e.extra],!0),this.emit({type:He.Client,moduleId:t,data:{command:s,params:P.clone(e.params),extra:P.clone(e.extra)}})):t==="pull"?this.handleInternalPullEvent(s,e):t=="online"?((e?.extra?.server_time_ago||0)<240&&(this.onCustomEvent("onPullOnlineEvent",[s,e.params,e.extra],!0),this.emit({type:He.Online,data:{command:s,params:P.clone(e.params),extra:P.clone(e.extra)}})),s==="userStatusChange"&&this.emitUserStatusChange(e.params.user_id,e.params.online)):(this.onCustomEvent("onPullEvent-"+t,[s,e.params,e.extra],!0),this.onCustomEvent("onPullEvent",[t,s,e.params,e.extra],!0),this.emit({type:He.Server,moduleId:t,data:{command:s,params:P.clone(e.params),extra:P.clone(e.extra)}}))}catch(n){this.getLogger().warning("PULL ERROR",{errorType:"broadcastMessages execute error",errorEvent:n,message:e})}e.extra&&e.extra.revision_web&&this.checkRevision(J.toInteger(e.extra.revision_web))}broadcastMessages(e){for(const t of e)this.broadcastMessage(t)}async sendMessageBatch(e){if(!this.isPublishingEnabled())return this.getLogger().error("Client publishing is not supported or is disabled"),Promise.reject(new Error("Client publishing is not supported or is disabled"));if(this.isJsonRpc()){const t=this._jsonRpcAdapter?.createPublishRequest(e);return this.connector?.send(JSON.stringify(t)),Promise.resolve(!0)}else{const t={};for(const s of e)if(typeof s.userList<"u")for(const n of s.userList){const i=Number(n);t[i]=i}this._channelManager?.getPublicIds(Object.values(t)).then(s=>{const n=this.connector?.send(this.encodeMessageBatch(e,s));return Promise.resolve(n)})}}encodeMessageBatch(e,t){const s=[];e.forEach(i=>{const c=i.body;let o=[];if(i.userList&&(o=this.createMessageReceivers(i.userList,t)),i.channelList){if(!P.isArray(i.channelList))throw new TypeError("messageFields.publicChannels must be an array");i.channelList.forEach(h=>{let u,g;if(typeof h=="string"&&h.includes(".")){const p=h.toString().split(".");u=p[0],g=p[1]}else if(typeof h=="object"&&"publicId"in h&&"signature"in h)u=h?.publicId,g=h?.signature;else throw new Error(`Public channel MUST be either a string, formatted like "{publicId}.{signature}" or an object with fields 'publicId' and 'signature'`);o.push(cc.create({id:this.encodeId(u),signature:this.encodeId(g)}))})}const l=ky.create({receivers:o,body:JSON.stringify(c),expiry:i.expiry||0});s.push(l)});const n=ac.create({requests:[{incomingMessages:{messages:s}}]});return ac.encode(n).finish()}createMessageReceivers(e,t){const s=[];for(const n of e){if(!t[n]||!t[n].publicId)throw new Error(`Could not determine public id for user ${n}`);s.push(cc.create({id:this.encodeId(t[n].publicId),signature:this.encodeId(t[n].signature)}))}return s}emitUserStatusChange(e,t){if(this._userStatusCallbacks[e])for(const s of this._userStatusCallbacks[e])s({userId:e,isOnline:t})}restoreUserStatusSubscription(){for(const e in this._userStatusCallbacks)Object.prototype.hasOwnProperty.call(this._userStatusCallbacks,e)&&this._userStatusCallbacks[e].length>0&&this._jsonRpcAdapter?.executeOutgoingRpcCommand(nt.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({},mc)}else{this._config=Object.assign({},mc);let t;if(this._storage&&(t=this._storage.get(Ve.PullConfig,null)),this.isConfigActual(t)&&this.checkRevision(t.api.revision_web))return Promise.resolve(t);this._storage&&this._storage.remove(Ve.PullConfig)}return new Promise((t,s)=>{this._restClient.actions.v2.call.make({method:this._configGetMethod,params:{CACHE:"N"}}).then(n=>{const i=n.getData().result,c=Math.floor((Date.now()-new Date(i.serverTime).getTime())/1e3);delete i.serverTime;const o=Object.assign({},i);o.server.timeShift=c,t(o)}).catch(n=>{s(n)})})}isConfigActual(e){if(!P.isPlainObject(e)||Number(e.server.config_timestamp)!==this._configTimestamp)return!1;const t=new Date;if(P.isNumber(e.exp)&&e.exp>0&&e.exp<t.getTime()/1e3||Object.keys(e.channels).length===0)return!1;for(const s in e.channels){if(!Object.prototype.hasOwnProperty.call(e.channels,s))continue;const n=e.channels[s];if(new Date(n.end)<t)return!1}return!0}startCheckConfig(){this._checkInterval&&(clearInterval(this._checkInterval),this._checkInterval=null),this._checkInterval=setInterval(this.checkConfig.bind(this),$y)}stopCheckConfig(){this._checkInterval&&clearInterval(this._checkInterval),this._checkInterval=null}checkConfig(){if(this.isConfigActual(this._config)){if(!this.checkRevision(J.toInteger(this._config?.api.revision_web)))return!1}else this.logToConsole("Stale config detected. Restarting"),this.restart(De.CONFIG_EXPIRED,"config expired");return!0}setConfig(e,t){for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&Object.prototype.hasOwnProperty.call(this._config,s)&&(this._config[s]=e[s]);if(e.publicChannels&&this.setPublicIds(Object.values(e.publicChannels)),this._configTimestamp=Number(e.server.config_timestamp),this._storage&&t)try{this._storage.set(Ve.PullConfig,e)}catch(s){localStorage&&localStorage.removeItem&&localStorage.removeItem("history"),this.getLogger().error(`${J.getDateForLog()}: Pull: Could not cache config in local storage.`,{error:s})}}setPublicIds(e){this._channelManager.setPublicIds(e)}checkRevision(e){return this._skipCheckRevision?!0:e>0&&e!==Tr?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(De.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[e,Tr]),this.emit({type:He.Revision,data:{server:e,client:Tr}}),this.logToConsole(`Pull revision changed from ${Tr} to ${e}. Reload required`),!1):!0}disconnect(e,t){this.connector&&(this._isManualDisconnect=!0,this.connector.disconnect(e,t))}restoreWebSocketConnection(){this._connectionType!==fe.WebSocket&&this._connectors.webSocket?.connect()}scheduleReconnect(e=0){this._enabled&&(e||(e=this.getConnectionAttemptDelay(this._connectionAttempt)),this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.logToConsole(`Pull: scheduling reconnection in ${e} seconds; attempt # ${this._connectionAttempt}`),this._reconnectTimeout=setTimeout(()=>{this.connect().catch(t=>{this.getLogger().error("scheduleReconnect",{error:t})})},e*1e3))}scheduleRestoreWebSocketConnection(){this.logToConsole(`Pull: scheduling restoration of websocket connection in ${hc} seconds`),!this._restoreWebSocketTimeout&&(this._restoreWebSocketTimeout=setTimeout(()=>{this._restoreWebSocketTimeout=null,this.restoreWebSocketConnection()},hc*1e3))}async connect(){return this._enabled?this.connector?.connected?Promise.resolve():(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.status=qe.Connecting,this._connectionAttempt++,new Promise((e,t)=>{this._connectPromise={resolve:e,reject:t},this.connector?.connect()})):Promise.reject()}scheduleRestart(e,t,s=0){this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),s<1&&(s=Math.ceil(Math.random()*30)+5),this._restartTimeout=setTimeout(()=>this.restart(e,t),s*1e3)}handleRpcIncomingMessage(e){this._session.mid=e.mid;const t=e.body;return e.body.extra||(t.extra={}),t.extra.sender=e.sender,"user_params"in e&&P.isPlainObject(e.user_params)&&Object.assign(t.params,e.user_params),"dictionary"in e&&P.isPlainObject(e.dictionary)&&Object.assign(t.params,e.dictionary),this.checkDuplicate(e.mid)&&(this.addMessageToStat(t),this.trimDuplicates(),this.broadcastMessage(t)),this.connector?.send(`mack:${e.mid}`),{}}handleIncomingEvents(e){const t=[];if(e.length===0){this._session.mid=null;return}for(const s of e)this.updateSessionFromEvent(s),!(s.mid&&!this.checkDuplicate(s.mid))&&(this.addMessageToStat(s.text),t.push(s.text));this.trimDuplicates(),this.broadcastMessages(t)}updateSessionFromEvent(e){this._session.mid=e.mid||null,this._session.tag=e.tag||null,this._session.time=e.time||null}handleInternalPullEvent(e,t){switch(e.toUpperCase()){case fr.CHANNEL_EXPIRE:{if(t.params.action==="reconnect"){const s=t.params?.channel.type;s==="private"&&this._config?.channels?.private&&(this._config.channels.private=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.private}`)),s==="shared"&&this._config?.channels?.shared&&(this._config.channels.shared=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: ${this._config.channels.shared}`)),this.reconnect(De.CONFIG_REPLACED,"config was replaced")}else this.restart(De.CHANNEL_EXPIRED,"channel expired received");break}case fr.CONFIG_EXPIRE:{this.restart(De.CONFIG_EXPIRED,"config expired received");break}case fr.SERVER_RESTART:{this.reconnect(De.SERVER_RESTARTED,"server was restarted",15);break}}}onIncomingMessage(e){if(this.isJsonRpc())e===By?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=qe.Online,this.logToConsole("Pull: Long polling connection with push-server opened"),this.isWebSocketEnabled()&&this.scheduleRestoreWebSocketConnection(),this._connectPromise&&this._connectPromise.resolve({})}onLongPollingDisconnect(e){this._connectionType===fe.LongPolling&&(this.status=qe.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===fe.LongPolling&&(this.status=qe.Offline),this.getLogger().error(`${J.getDateForLog()}: Pull: Long polling connection error`,{error:e}),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}onWebSocketBlockChanged(e){const t=e.isWebSocketBlocked;t&&this._connectionType===fe.WebSocket&&!this.isConnected()?(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._connectionAttempt=0,this._connectionType=fe.LongPolling,this.scheduleReconnect(1)):!t&&this._connectionType===fe.LongPolling&&(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this._connectionAttempt=0,this._connectionType=fe.WebSocket,this.scheduleReconnect(1))}onWebSocketOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=qe.Online,this._sharedConfig.setWebSocketBlocked(!1),this._sharedConfig.setLongPollingBlocked(!0),this._connectionType==fe.LongPolling&&(this._connectionType=fe.WebSocket,this._connectors.longPolling?.disconnect(De.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===fe.WebSocket&&(this.status=qe.Offline),this.logToConsole(`Pull: Websocket connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`,!0),this._isManualDisconnect||(e.code==De.WRONG_CHANNEL_ID?this.scheduleRestart(De.WRONG_CHANNEL_ID,"wrong channel signature"):this.scheduleReconnect()),this._sharedConfig.setLongPollingBlocked(!0),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onWebSocketError(e){this._starting=!1,this._connectionType===fe.WebSocket&&(this.status=qe.Offline),this.getLogger().error(`${J.getDateForLog()}: Pull: WebSocket connection error`,{error:e}),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}extractMessages(e){if(e instanceof ArrayBuffer)return this.extractProtobufMessages(e);if(P.isStringFilled(e))return this.extractPlainTextMessages(e);throw new Error("Error pullEvent type")}extractProtobufMessages(e){const t=[];try{const s=Ty.decode(new Uint8Array(e));for(let n=0;n<s.responses.length;n++){const i=s.responses[n];if(i.command!=="outgoingMessages")continue;const c=i.outgoingMessages.messages;for(const o of c){let l;try{l=JSON.parse(o.body)}catch(u){this.getLogger().error(`${J.getDateForLog()}: Pull: Could not parse message body`,{error:u});continue}l.extra||(l.extra={}),l.extra.sender={type:o.sender.type},o.sender.id instanceof Uint8Array&&(l.extra.sender.id=this.decodeId(o.sender.id));const h={mid:this.decodeId(o.id),text:l};t.push(h)}}}catch(s){this.getLogger().error(`${J.getDateForLog()}: Pull: Could not parse message`,{error:s})}return t}extractPlainTextMessages(e){const t=[],s=e.match(/#!NGINXNMS!#(.*?)#!NGINXNME!#/g);if(s===null)return this.getLogger().warning("PULL ERROR",{errorType:"parseResponse error parsing message",dataString:e}),[];for(let n=0;n<s.length;n++){if(s[n]=s[n].substring(12,s[n].length-12),s[n].length<=0)continue;let i;try{i=JSON.parse(s[n])}catch{continue}t.push(i)}return t}decodeId(e){let t="";for(const s of e){const n=s.toString(16);n.length===1&&(t+="0"),t+=n}return t}encodeId(e){if(!e)return new Uint8Array;const t=[];for(let s=0;s<e.length;s+=2)t.push(Number.parseInt(e.slice(s,s+2),16));return new Uint8Array(t)}onOffline(){this.disconnect(De.NORMAL_CLOSURE,"offline")}onOnline(){this.connect().catch(e=>{this.getLogger().error("onOnline",{error:e})})}onBeforeUnload(){this._unloading=!0;const e=P.clone(this.session);if(e.ttl=Date.now()+Uy*1e3,this._storage)try{this._storage.set(pc,JSON.stringify(e))}catch(t){this.getLogger().error(`${J.getDateForLog()}: Pull: Could not save session info in local storage. Error: `,{error:t})}this.scheduleReconnect(15)}sendPullStatusDelayed(e,t){this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),this._offlineTimeout=setTimeout(()=>{this._offlineTimeout=null,this.sendPullStatus(e)},t)}sendPullStatus(e){this._unloading||(this.onCustomEvent("onPullStatus",[e]),this.emit({type:He.Status,data:{status:e}}))}extendWatch(e,t=!1){this._watchTagsQueue.get(e)||(this._watchTagsQueue.set(e,!0),t&&this.updateWatch(t))}updateWatch(e=!1){this._watchUpdateTimeout&&(clearTimeout(this._watchUpdateTimeout),this._watchUpdateTimeout=null),this._watchUpdateTimeout=setTimeout(()=>{const t=[...this._watchTagsQueue.keys()];t.length>0?this._restClient.actions.v2.call.make({method:"pull.watch.extend",params:{tags:t}}).then(s=>{const n=s.getData().result;for(const i of n)this.clearWatch(i);this.updateWatch()}).catch(()=>{this.updateWatch()}):this.updateWatch()},e?this._watchForceUpdateInterval:this._watchUpdateInterval)}clearWatch(e){this._watchTagsQueue.delete(e)}onJsonRpcPing(){this.updatePingWaitTimeout(),this.connector?.send(jy)}updatePingWaitTimeout(){this._pingWaitTimeout&&(clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null),this._pingWaitTimeout=setTimeout(this._onPingTimeoutHandler,fc*2*1e3)}clearPingWaitTimeout(){this._pingWaitTimeout&&clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null}onPingTimeout(){this._pingWaitTimeout=null,!(!this._enabled||!this.isConnected())&&(this.getLogger().warning(`No pings are received in ${fc*2} seconds. Reconnecting`),this.disconnect(De.STUCK,"connection stuck"),this.scheduleReconnect())}getConnectionAttemptDelay(e){let t;return e<1?t=.5:e<3?t=15:e<5?t=45:e<10?t=600:t=3600,t+t*Math.random()*.2}checkDuplicate(e){return this._session.lastMessageIds.includes(e)?(this.getLogger().warning(`Duplicate message ${e} skipped`),!1):(this._session.lastMessageIds.push(e),!0)}trimDuplicates(){this._session.lastMessageIds.length>dc&&(this._session.lastMessageIds=this._session.lastMessageIds.slice(-dc))}logMessage(e){this._debug&&(e.extra?.sender&&e.extra.sender.type===Gr.Client?this.getLogger().info(`onPullClientEvent-${e.module_id}`,{command:e.command,params:e.params,extra:e.extra}):e.module_id=="online"?this.getLogger().info("onPullOnlineEvent",{command:e.command,params:e.params,extra:e.extra}):this.getLogger().info("onPullEvent",{moduleId:e.module_id,command:e.command,params:e.params,extra:e.extra}))}logToConsole(e,t=!1){(this._loggingEnabled||t)&&this.getLogger().debug(`${J.getDateForLog()}: ${e}`)}addMessageToStat(e){this._session.history[e.module_id]||(this._session.history[e.module_id]={}),this._session.history[e.module_id][e.command]||(this.session.history[e.module_id][e.command]=0),this._session.history[e.module_id][e.command]++,this._session.messageCount++}showNotification(e){this.getLogger().notice(e)}onCustomEvent(e,t,s=!1){}}var Vy=Object.defineProperty,qy=a((r,e)=>Vy(r,"name",{value:e,configurable:!0}),"l$1");class Hy{static{a(this,"B24HelperManager")}static{qy(this,"B24HelperManager")}_b24;_isInit=!1;_profile=null;_app=null;_payment=null;_license=null;_currency=null;_appOptions=null;_userOptions=null;_b24PullClient=null;_pullClientUnSubscribe=[];_pullClientModuleId="";_logger;constructor(e){this._logger=te.createNullLogger(),this._b24=e}setLogger(e){this._logger=e,this._profile!==null&&this._profile.setLogger(this.getLogger()),this._app!==null&&this._app.setLogger(this.getLogger()),this._payment!==null&&this._payment.setLogger(this.getLogger()),this._license!==null&&this._license.setLogger(this.getLogger()),this._currency!==null&&this._currency.setLogger(this.getLogger()),this._appOptions!==null&&this._appOptions.setLogger(this.getLogger()),this._userOptions!==null&&this._userOptions.setLogger(this.getLogger())}getLogger(){return this._logger}destroy(){this._destroyPullClient()}async loadData(e=[de.App,de.Profile],t="helper-load-data"){const s={[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,c)=>{if(s[c])if(Array.isArray(s[c]))for(const[o,l]of s[c].entries())i[`get_${c}_${o}`]=l;else i[`get_${c}`]=s[c];return i},{});try{const i=(await this._b24.actions.v2.batch.make({calls:n,options:{isHaltOnError:!0,returnAjaxResult:!1,requestId:t}})).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:(this.getLogger().error("Failed to load data",{error:i}),new Error("Failed to load data"))}}async parseUserData(e){const t=new zg(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 Yg(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 Xg(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 ty(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 ny(this._b24);return t.setLogger(this.getLogger()),t.initData(e).then(()=>t)}async parseOptionsData(e,t){const s=new Bn(this._b24,e);return s.setLogger(this.getLogger()),s.initData(t).then(()=>s)}get isInit(){return this._isInit}get forB24Form(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");if(this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return{app_code:this.appInfo.data.code,app_status:this.appInfo.data.status,payment_expired:this.paymentInfo.data.isExpired?"Y":"N",days:this.paymentInfo.data.days,b24_plan:this.licenseInfo.data.license,c_name:this.profileInfo.data.name,c_last_name:this.profileInfo.data.lastName,hostname:this.hostName}}get hostName(){return this._b24.getTargetOrigin()}get profileInfo(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");return this._profile}get appInfo(){if(this.ensureInitialized(),this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return this._app}get paymentInfo(){if(this.ensureInitialized(),this._payment===null)throw new Error("B24HelperManager.paymentInfo not initialized");return this._payment}get licenseInfo(){if(this.ensureInitialized(),this._license===null)throw new Error("B24HelperManager.licenseInfo not initialized");return this._license}get currency(){if(this.ensureInitialized(),this._currency===null)throw new Error("B24HelperManager.currency not initialized");return this._currency}get appOptions(){if(this.ensureInitialized(),this._appOptions===null)throw new Error("B24HelperManager.appOptions not initialized");return this._appOptions}get userOptions(){if(this.ensureInitialized(),this._userOptions===null)throw new Error("B24HelperManager.userOptions not initialized");return this._userOptions}get isSelfHosted(){return this.licenseInfo.data.isSelfHosted}get primaryKeyIncrementValue(){return this.isSelfHosted?1:2}get b24SpecificUrl(){return this.isSelfHosted?{[It.MainSettings]:"/configs/",[It.UfList]:"/configs/userfield_list.php",[It.UfPage]:"/configs/userfield.php"}:{[It.MainSettings]:"/settings/configs/",[It.UfList]:"/settings/configs/userfield_list.php",[It.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 gc({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(`${J.getDateForLog()}: Pull not running`,{error:e})})}getModuleIdPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId}_destroyPullClient(){for(const e of this._pullClientUnSubscribe)e();this._b24PullClient?.destroy(),this._b24PullClient=null}ensureInitialized(){if(!this._isInit)throw new Error("B24HelperManager not initialized")}}var Wy=Object.defineProperty,_t=a((r,e)=>Wy(r,"name",{value:e,configurable:!0}),"l");const zy=_t(()=>{let r=!1,e=!1,t=null;return{initB24Helper:_t(async(s,n=[de.App,de.Profile],i="helper-load-data")=>(t===null&&(t=new Hy(s)),r||(await t.loadData(n,i),r=!0),t),"initB24Helper"),isInitB24Helper:_t(()=>r,"isInitB24Helper"),destroyB24Helper:_t(()=>{t?.destroy(),t=null,r=!1,e=!1},"destroyB24Helper"),getB24Helper:_t(()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");return t},"getB24Helper"),usePullClient:_t(()=>{if(t===null)throw new Error("B24HelperManager is not initialized. You need to call initB24Helper first.");t.usePullClient(),e=!0},"usePullClient"),useSubscribePullClient:_t((s,n="application")=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.subscribePullClient(s,n)},"useSubscribePullClient"),startPullClient:_t(()=>{if(!e)throw new Error("PullClient is not initialized. You need to call usePullClient first.");t?.startPullClient()},"startPullClient")}},"useB24Helper");var Jy=Object.defineProperty,Un=a((r,e)=>Jy(r,"name",{value:e,configurable:!0}),"n");const Gy=50;let wt=null,ps=!1,Zt=null,yc=!1,ms=[],bc=!1;function Vn(){window.setTimeout(()=>{if(!ps||wt===null){Vn();return}_c(),ms=[]},Gy)}a(Vn,"p"),Un(Vn,"startWatch");function _c(){if(Zt!==null)for(const r of ms)r.reject(Zt);if(!(!ps||wt===null))for(const r of ms)r.resolve(wt)}a(_c,"I"),Un(_c,"processResult");async function wc(r){return ps&&wt!==null?Promise.resolve(wt):yc?(bc||(bc=!0,Vn()),new Promise((e,t)=>{ms.push({resolve:e,reject:t})})):(yc=!0,new Promise((e,t)=>{const s={DOMAIN:null,PROTOCOL:!1,APP_SID:null,LANG:null};if(window.name){const[n,i,c]=window.name.split("|");s.DOMAIN=n,s.PROTOCOL=Number.parseInt(i??"0")===1,s.APP_SID=c,s.LANG=null}(!s.DOMAIN||!s.APP_SID)&&(Zt=new ce({code:"JSSDK_CLIENT_SIDE_WARNING",description:"Well done! Now paste this URL into the Bitrix24 app settings",status:500}),t(Zt)),wt=new ec(s,r),wt.init().then(()=>{ps=!0,e(wt)}).catch(n=>{Zt=n,t(Zt)})}))}a(wc,"initializeB24Frame"),Un(wc,"initializeB24Frame"),A.AbstractB24=Xr,A.AbstractLogger=Ys,A.AdaptiveDelayer=Zo,A.AjaxError=we,A.AjaxResult=mr,A.ApiVersion=X,A.AppFrame=za,A.AuthHookManager=Ha,A.AuthManager=Ja,A.AuthOAuthManager=rc,A.B24Frame=ec,A.B24Hook=xn,A.B24LangList=tn,A.B24LocaleMap=Wh,A.B24OAuth=Vg,A.B24PullClientManager=gc,A.Browser=Mo,A.CatalogProductImageType=jo,A.CatalogProductType=Bo,A.CatalogRoundingRuleType=Uo,A.CloseReasons=De,A.ConnectionType=fe,A.ConsolaAdapter=ch,A.ConsoleHandler=To,A.ConsoleV2Handler=Gs,A.DataType=Io,A.DialogManager=Za,A.EnumAppStatus=lt,A.EnumBitrix24Edition=Vo,A.EnumBizprocBaseType=qo,A.EnumBizprocDocumentType=Ho,A.EnumCrmEntityType=Fo,A.EnumCrmEntityTypeId=Qe,A.EnumCrmEntityTypeShort=Xs,A.Environment=ur,A.HttpV2=hs,A.HttpV3=ds,A.JsonFormatter=xu,A.LineFormatter=qr,A.ListRpcError=en,A.LoadDataType=de,A.LogLevel=z,A.Logger=dr,A.LoggerBrowser=Ks,A.LoggerFactory=te,A.LoggerType=ko,A.LsKeys=Ve,A.MemoryHandler=rh,A.MessageCommands=le,A.MessageManager=Wa,A.NullLogger=hr,A.OperatingLimiter=Ko,A.OptionsManager=Ya,A.ParamsFactory=sn,A.ParentManager=Ga,A.PlacementManager=Qa,A.ProductRowDiscountTypeId=$o,A.PullStatus=qe,A.RateLimiter=Yo,A.RefreshTokenError=tc,A.RestrictionManager=gr,A.Result=Fe,A.RpcMethod=nt,A.SdkError=ce,A.SenderType=Gr,A.ServerMode=Qs,A.SliderManager=Xa,A.StatusDescriptions=Go,A.StreamHandler=ih,A.SubscriptionType=He,A.SystemCommands=fr,A.TelegramFormatter=Oo,A.TelegramHandler=gh,A.Text=J,A.Type=P,A.TypeOption=ut,A.TypeSpecificUrl=It,A.WinstonAdapter=hh,A.convertBizprocDocumentTypeToCrmEntityTypeId=Wo,A.getDocumentId=zo,A.getDocumentType=Jr,A.getDocumentTypeForFilter=Jo,A.getEnumCrmEntityTypeShort=xo,A.getEnumValue=Co,A.getEnvironment=Hr,A.initializeB24Frame=wc,A.isArrayOfArray=Ro,A.memoryUsageProcessor=Ju,A.omit=Zs,A.pick=Ao,A.pidProcessor=Hu,A.useB24Helper=zy,A.useFormatter=pg,A.versionManager=it}));
|
|
70
70
|
//# sourceMappingURL=index.min.js.map
|