@bitrix24/b24jssdk 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/index.cjs +3 -3
- package/dist/commonjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/umd/index.js +3 -3
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +1 -1
package/dist/umd/index.min.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
`+s):n.stack=s}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=At(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:s}=t;n!==void 0&&Vn.assertOptions(n,{silentJSONParsing:pt.transitional(pt.boolean),forcedJSONParsing:pt.transitional(pt.boolean),clarifyTimeoutError:pt.transitional(pt.boolean)},!1),i!=null&&(T.isFunction(i)?t.paramsSerializer={serialize:i}:Vn.assertOptions(i,{encode:pt.function,serialize:pt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&T.merge(s.common,s[t.method]);s&&T.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),t.headers=Le.concat(o,s);const l=[];let a=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(t)===!1||(a=a&&p.synchronous,l.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let c,h=0,f;if(!a){const g=[sa.bind(this),void 0];for(g.unshift.apply(g,l),g.push.apply(g,u),f=g.length,c=Promise.resolve(t);h<f;)c=c.then(g[h++],g[h++]);return c}f=l.length;let d=t;for(h=0;h<f;){const g=l[h++],p=l[h++];try{d=g(d)}catch(m){p.call(this,m);break}}try{c=sa.call(this,d)}catch(g){return Promise.reject(g)}for(h=0,f=u.length;h<f;)c=c.then(u[h++],u[h++]);return c}getUri(e){e=At(this.defaults,e);const t=Yo(e.baseURL,e.url);return $o(t,e.params,e.paramsSerializer)}};T.forEach(["delete","get","head","options"],function(e){It.prototype[e]=function(t,n){return this.request(At(n||{},{method:e,url:t,data:(n||{}).data}))}}),T.forEach(["post","put","patch"],function(e){function t(n){return function(s,o,l){return this.request(At(l||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}It.prototype[e]=t(),It.prototype[e+"Form"]=t(!0)});let lh=class Sl{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(l=>{n.subscribe(l),s=l}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,l){n.reason||(n.reason=new zt(s,o,l),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Sl(function(i){e=i}),cancel:e}}};function ch(r){return function(t){return r.apply(null,t)}}function uh(r){return T.isObject(r)&&r.isAxiosError===!0}const Hn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Hn).forEach(([r,e])=>{Hn[e]=r});function la(r){const e=new It(r),t=Oo(It.prototype.request,e);return T.extend(t,It.prototype,e,{allOwnKeys:!0}),T.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return la(At(r,i))},t}const be=la(dr);be.Axios=It,be.CanceledError=zt,be.CancelToken=lh,be.isCancel=zo,be.VERSION=oa,be.toFormData=Vr,be.AxiosError=Q,be.Cancel=be.CanceledError,be.all=function(e){return Promise.all(e)},be.spread=ch,be.isAxiosError=uh,be.mergeConfig=At,be.AxiosHeaders=Le,be.formToJSON=r=>Vo(T.isHTMLForm(r)?new FormData(r):r),be.getAdapter=ia.getAdapter,be.HttpStatusCode=Hn,be.default=be;const{Axios:vd,AxiosError:ca,CanceledError:Sd,isCancel:_d,CancelToken:Ed,VERSION:kd,all:Od,Cancel:Td,isAxiosError:Ad,spread:Id,toFormData:Cd,AxiosHeaders:Rd,HttpStatusCode:Nd,formToJSON:Pd,getAdapter:Fd,mergeConfig:Md}=be;var Ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ua(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function fh(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var zn,fa;function hh(){return fa||(fa=1,zn=Error),zn}var Jn,ha;function dh(){return ha||(ha=1,Jn=EvalError),Jn}var Gn,da;function ph(){return da||(da=1,Gn=RangeError),Gn}var Zn,pa;function gh(){return pa||(pa=1,Zn=ReferenceError),Zn}var Yn,ga;function ma(){return ga||(ga=1,Yn=SyntaxError),Yn}var Kn,ya;function gr(){return ya||(ya=1,Kn=TypeError),Kn}var Qn,wa;function mh(){return wa||(wa=1,Qn=URIError),Qn}var Xn,ba;function yh(){return ba||(ba=1,Xn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==i||o.enumerable!==!0)return!1}return!0}),Xn}var ei,va;function wh(){if(va)return ei;va=1;var r=typeof Symbol<"u"&&Symbol,e=yh();return ei=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},ei}var ti,Sa;function bh(){if(Sa)return ti;Sa=1;var r={__proto__:null,foo:{}},e=Object;return ti=function(){return{__proto__:r}.foo===r.foo&&!(r instanceof e)},ti}var ri,_a;function vh(){if(_a)return ri;_a=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",i=function(a,u){for(var c=[],h=0;h<a.length;h+=1)c[h]=a[h];for(var f=0;f<u.length;f+=1)c[f+a.length]=u[f];return c},s=function(a,u){for(var c=[],h=u,f=0;h<a.length;h+=1,f+=1)c[f]=a[h];return c},o=function(l,a){for(var u="",c=0;c<l.length;c+=1)u+=l[c],c+1<l.length&&(u+=a);return u};return ri=function(a){var u=this;if(typeof u!="function"||e.apply(u)!==n)throw new TypeError(r+u);for(var c=s(arguments,1),h,f=function(){if(this instanceof h){var y=u.apply(this,i(c,arguments));return Object(y)===y?y:this}return u.apply(a,i(c,arguments))},d=t(0,u.length-c.length),g=[],p=0;p<d;p++)g[p]="$"+p;if(h=Function("binder","return function ("+o(g,",")+"){ return binder.apply(this,arguments); }")(f),u.prototype){var m=function(){};m.prototype=u.prototype,h.prototype=new m,m.prototype=null}return h},ri}var ni,Ea;function ii(){if(Ea)return ni;Ea=1;var r=vh();return ni=Function.prototype.bind||r,ni}var si,ka;function Sh(){if(ka)return si;ka=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=ii();return si=t.call(r,e),si}var oi,Oa;function Jt(){if(Oa)return oi;Oa=1;var r,e=hh(),t=dh(),n=ph(),i=gh(),s=ma(),o=gr(),l=mh(),a=Function,u=function(X){try{return a('"use strict"; return ('+X+").constructor;")()}catch{}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch{c=null}var h=function(){throw new o},f=c?function(){try{return arguments.callee,h}catch{try{return c(arguments,"callee").get}catch{return h}}}():h,d=wh()(),g=bh()(),p=Object.getPrototypeOf||(g?function(X){return X.__proto__}:null),m={},y=typeof Uint8Array>"u"||!p?r:p(Uint8Array),w={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":d&&p?p([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":m,"%AsyncGenerator%":m,"%AsyncGeneratorFunction%":m,"%AsyncIteratorPrototype%":m,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":t,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":a,"%GeneratorFunction%":m,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":d&&p?p(p([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!d||!p?r:p(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!d||!p?r:p(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":d&&p?p(""[Symbol.iterator]()):r,"%Symbol%":d?Symbol:r,"%SyntaxError%":s,"%ThrowTypeError%":f,"%TypedArray%":y,"%TypeError%":o,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":l,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet};if(p)try{null.error}catch(X){var _=p(p(X));w["%Error.prototype%"]=_}var b=function X(A){var ne;if(A==="%AsyncFunction%")ne=u("async function () {}");else if(A==="%GeneratorFunction%")ne=u("function* () {}");else if(A==="%AsyncGeneratorFunction%")ne=u("async function* () {}");else if(A==="%AsyncGenerator%"){var te=X("%AsyncGeneratorFunction%");te&&(ne=te.prototype)}else if(A==="%AsyncIteratorPrototype%"){var ce=X("%AsyncGenerator%");ce&&p&&(ne=p(ce.prototype))}return w[A]=ne,ne},k={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},S=ii(),O=Sh(),C=S.call(Function.call,Array.prototype.concat),F=S.call(Function.apply,Array.prototype.splice),R=S.call(Function.call,String.prototype.replace),Y=S.call(Function.call,String.prototype.slice),B=S.call(Function.call,RegExp.prototype.exec),W=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ee=/\\(\\)?/g,D=function(A){var ne=Y(A,0,1),te=Y(A,-1);if(ne==="%"&&te!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(te==="%"&&ne!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var ce=[];return R(A,W,function($,re,K,se){ce[ce.length]=K?R(se,ee,"$1"):re||$}),ce},he=function(A,ne){var te=A,ce;if(O(k,te)&&(ce=k[te],te="%"+ce[0]+"%"),O(w,te)){var $=w[te];if($===m&&($=b(te)),typeof $>"u"&&!ne)throw new o("intrinsic "+A+" exists, but is not available. Please file an issue!");return{alias:ce,name:te,value:$}}throw new s("intrinsic "+A+" does not exist!")};return oi=function(A,ne){if(typeof A!="string"||A.length===0)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof ne!="boolean")throw new o('"allowMissing" argument must be a boolean');if(B(/^%?[^%]*%?$/,A)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var te=D(A),ce=te.length>0?te[0]:"",$=he("%"+ce+"%",ne),re=$.name,K=$.value,se=!1,ue=$.alias;ue&&(ce=ue[0],F(te,C([0,1],ue)));for(var me=1,U=!0;me<te.length;me+=1){var pe=te[me],Re=Y(pe,0,1),$e=Y(pe,-1);if((Re==='"'||Re==="'"||Re==="`"||$e==='"'||$e==="'"||$e==="`")&&Re!==$e)throw new s("property names with quotes must have matching quotes");if((pe==="constructor"||!U)&&(se=!0),ce+="."+pe,re="%"+ce+"%",O(w,re))K=w[re];else if(K!=null){if(!(pe in K)){if(!ne)throw new o("base intrinsic for "+A+" exists, but the property is not available.");return}if(c&&me+1>=te.length){var ze=c(K,pe);U=!!ze,U&&"get"in ze&&!("originalValue"in ze.get)?K=ze.get:K=K[pe]}else U=O(K,pe),K=K[pe];U&&!se&&(w[re]=K)}}return K},oi}var ai={exports:{}},li,Ta;function ci(){if(Ta)return li;Ta=1;var r=Jt(),e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return li=e,li}var ui,Aa;function Ia(){if(Aa)return ui;Aa=1;var r=Jt(),e=r("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return ui=e,ui}var fi,Ca;function _h(){if(Ca)return fi;Ca=1;var r=ci(),e=ma(),t=gr(),n=Ia();return fi=function(s,o,l){if(!s||typeof s!="object"&&typeof s!="function")throw new t("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,f=!!n&&n(s,o);if(r)r(s,o,{configurable:c===null&&f?f.configurable:!c,enumerable:a===null&&f?f.enumerable:!a,value:l,writable:u===null&&f?f.writable:!u});else if(h||!a&&!u&&!c)s[o]=l;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},fi}var hi,Ra;function Eh(){if(Ra)return hi;Ra=1;var r=ci(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},hi=e,hi}var di,Na;function kh(){if(Na)return di;Na=1;var r=Jt(),e=_h(),t=Eh()(),n=Ia(),i=gr(),s=r("%Math.floor%");return di=function(l,a){if(typeof l!="function")throw new i("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||s(a)!==a)throw new i("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],c=!0,h=!0;if("length"in l&&n){var f=n(l,"length");f&&!f.configurable&&(c=!1),f&&!f.writable&&(h=!1)}return(c||h||!u)&&(t?e(l,"length",a,!0,!0):e(l,"length",a)),l},di}var Pa;function Oh(){return Pa||(Pa=1,function(r){var e=ii(),t=Jt(),n=kh(),i=gr(),s=t("%Function.prototype.apply%"),o=t("%Function.prototype.call%"),l=t("%Reflect.apply%",!0)||e.call(o,s),a=ci(),u=t("%Math.max%");r.exports=function(f){if(typeof f!="function")throw new i("a function is required");var d=l(e,o,arguments);return n(d,1+u(0,f.length-(arguments.length-1)),!0)};var c=function(){return l(e,s,arguments)};a?a(r.exports,"apply",{value:c}):r.exports.apply=c}(ai)),ai.exports}var pi,Fa;function Th(){if(Fa)return pi;Fa=1;var r=Jt(),e=Oh(),t=e(r("String.prototype.indexOf"));return pi=function(i,s){var o=r(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e(o):o},pi}const Ah=fh({__proto__:null,default:{}});var gi,Ma;function Ih(){if(Ma)return gi;Ma=1;var r=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=r&&e&&typeof e.get=="function"?e.get:null,n=r&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,s=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,o=i&&s&&typeof s.get=="function"?s.get:null,l=i&&Set.prototype.forEach,a=typeof WeakMap=="function"&&WeakMap.prototype,u=a?WeakMap.prototype.has:null,c=typeof WeakSet=="function"&&WeakSet.prototype,h=c?WeakSet.prototype.has:null,f=typeof WeakRef=="function"&&WeakRef.prototype,d=f?WeakRef.prototype.deref:null,g=Boolean.prototype.valueOf,p=Object.prototype.toString,m=Function.prototype.toString,y=String.prototype.match,w=String.prototype.slice,_=String.prototype.replace,b=String.prototype.toUpperCase,k=String.prototype.toLowerCase,S=RegExp.prototype.test,O=Array.prototype.concat,C=Array.prototype.join,F=Array.prototype.slice,R=Math.floor,Y=typeof BigInt=="function"?BigInt.prototype.valueOf:null,B=Object.getOwnPropertySymbols,W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ee=typeof Symbol=="function"&&typeof Symbol.iterator=="object",D=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ee||!0)?Symbol.toStringTag:null,he=Object.prototype.propertyIsEnumerable,X=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(v){return v.__proto__}:null);function A(v,E){if(v===1/0||v===-1/0||v!==v||v&&v>-1e3&&v<1e3||S.call(/e/,E))return E;var P=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof v=="number"){var V=v<0?-R(-v):R(v);if(V!==v){var Z=String(V),H=w.call(E,Z.length+1);return _.call(Z,P,"$&_")+"."+_.call(_.call(H,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _.call(E,P,"$&_")}var ne=Ah,te=ne.custom,ce=tt(te)?te:null,$={__proto__:null,double:'"',single:"'"},re={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};gi=function v(E,P,V,Z){var H=P||{};if(rt(H,"quoteStyle")&&!rt($,H.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(rt(H,"maxStringLength")&&(typeof H.maxStringLength=="number"?H.maxStringLength<0&&H.maxStringLength!==1/0:H.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Ne=rt(H,"customInspect")?H.customInspect:!0;if(typeof Ne!="boolean"&&Ne!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(rt(H,"indent")&&H.indent!==null&&H.indent!==" "&&!(parseInt(H.indent,10)===H.indent&&H.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(rt(H,"numericSeparator")&&typeof H.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var nt=H.numericSeparator;if(typeof E>"u")return"undefined";if(E===null)return"null";if(typeof E=="boolean")return E?"true":"false";if(typeof E=="string")return We(E,H);if(typeof E=="number"){if(E===0)return 1/0/E>0?"0":"-0";var Oe=String(E);return nt?A(E,Oe):Oe}if(typeof E=="bigint"){var wt=String(E)+"n";return nt?A(E,wt):wt}var Li=typeof H.depth>"u"?5:H.depth;if(typeof V>"u"&&(V=0),V>=Li&&Li>0&&typeof E=="object")return ue(E)?"[Array]":"[Object]";var Qt=Mi(H,V);if(typeof Z>"u")Z=[];else if(Qr(Z,E)>=0)return"[Circular]";function it(Xt,tn,hd){if(tn&&(Z=F.call(Z),Z.push(tn)),hd){var vl={depth:H.depth};return rt(H,"quoteStyle")&&(vl.quoteStyle=H.quoteStyle),v(Xt,vl,V+1,Z)}return v(Xt,H,V+1,Z)}if(typeof E=="function"&&!U(E)){var dl=Ge(E),pl=N(E,it);return"[Function"+(dl?": "+dl:" (anonymous)")+"]"+(pl.length>0?" { "+C.call(pl,", ")+" }":"")}if(tt(E)){var gl=ee?_.call(String(E),/^(Symbol\(.*\))_[^)]*$/,"$1"):W.call(E);return typeof E=="object"&&!ee?yt(gl):gl}if(Pi(E)){for(var br="<"+k.call(String(E.nodeName)),Di=E.attributes||[],en=0;en<Di.length;en++)br+=" "+Di[en].name+"="+K(se(Di[en].value),"double",H);return br+=">",E.childNodes&&E.childNodes.length&&(br+="..."),br+="</"+k.call(String(E.nodeName))+">",br}if(ue(E)){if(E.length===0)return"[]";var xi=N(E,it);return Qt&&!Fi(xi)?"["+Ee(xi,Qt)+"]":"[ "+C.call(xi,", ")+" ]"}if(pe(E)){var ji=N(E,it);return!("cause"in Error.prototype)&&"cause"in E&&!he.call(E,"cause")?"{ ["+String(E)+"] "+C.call(O.call("[cause]: "+it(E.cause),ji),", ")+" }":ji.length===0?"["+String(E)+"]":"{ ["+String(E)+"] "+C.call(ji,", ")+" }"}if(typeof E=="object"&&Ne){if(ce&&typeof E[ce]=="function"&&ne)return ne(E,{depth:Li-V});if(Ne!=="symbol"&&typeof E.inspect=="function")return E.inspect()}if(mt(E)){var ml=[];return n&&n.call(E,function(Xt,tn){ml.push(it(tn,E,!0)+" => "+it(Xt,E))}),Xr("Map",t.call(E),ml,Qt)}if(Ri(E)){var yl=[];return l&&l.call(E,function(Xt){yl.push(it(Xt,E))}),Xr("Set",o.call(E),yl,Qt)}if(Ii(E))return Nt("WeakMap");if(Ni(E))return Nt("WeakSet");if(Ci(E))return Nt("WeakRef");if($e(E))return yt(it(Number(E)));if(Kt(E))return yt(it(Y.call(E)));if(ze(E))return yt(g.call(E));if(Re(E))return yt(it(String(E)));if(typeof window<"u"&&E===window)return"{ [object Window] }";if(typeof globalThis<"u"&&E===globalThis||typeof Ct<"u"&&E===Ct)return"{ [object globalThis] }";if(!me(E)&&!U(E)){var Ui=N(E,it),wl=X?X(E)===Object.prototype:E instanceof Object||E.constructor===Object,Bi=E instanceof Object?"":"null prototype",bl=!wl&&D&&Object(E)===E&&D in E?w.call(Je(E),8,-1):Bi?"Object":"",fd=wl||typeof E.constructor!="function"?"":E.constructor.name?E.constructor.name+" ":"",$i=fd+(bl||Bi?"["+C.call(O.call([],bl||[],Bi||[]),": ")+"] ":"");return Ui.length===0?$i+"{}":Qt?$i+"{"+Ee(Ui,Qt)+"}":$i+"{ "+C.call(Ui,", ")+" }"}return String(E)};function K(v,E,P){var V=P.quoteStyle||E,Z=$[V];return Z+v+Z}function se(v){return _.call(String(v),/"/g,""")}function ue(v){return Je(v)==="[object Array]"&&(!D||!(typeof v=="object"&&D in v))}function me(v){return Je(v)==="[object Date]"&&(!D||!(typeof v=="object"&&D in v))}function U(v){return Je(v)==="[object RegExp]"&&(!D||!(typeof v=="object"&&D in v))}function pe(v){return Je(v)==="[object Error]"&&(!D||!(typeof v=="object"&&D in v))}function Re(v){return Je(v)==="[object String]"&&(!D||!(typeof v=="object"&&D in v))}function $e(v){return Je(v)==="[object Number]"&&(!D||!(typeof v=="object"&&D in v))}function ze(v){return Je(v)==="[object Boolean]"&&(!D||!(typeof v=="object"&&D in v))}function tt(v){if(ee)return v&&typeof v=="object"&&v instanceof Symbol;if(typeof v=="symbol")return!0;if(!v||typeof v!="object"||!W)return!1;try{return W.call(v),!0}catch{}return!1}function Kt(v){if(!v||typeof v!="object"||!Y)return!1;try{return Y.call(v),!0}catch{}return!1}var Rt=Object.prototype.hasOwnProperty||function(v){return v in this};function rt(v,E){return Rt.call(v,E)}function Je(v){return p.call(v)}function Ge(v){if(v.name)return v.name;var E=y.call(m.call(v),/^function\s*([\w$]+)/);return E?E[1]:null}function Qr(v,E){if(v.indexOf)return v.indexOf(E);for(var P=0,V=v.length;P<V;P++)if(v[P]===E)return P;return-1}function mt(v){if(!t||!v||typeof v!="object")return!1;try{t.call(v);try{o.call(v)}catch{return!0}return v instanceof Map}catch{}return!1}function Ii(v){if(!u||!v||typeof v!="object")return!1;try{u.call(v,u);try{h.call(v,h)}catch{return!0}return v instanceof WeakMap}catch{}return!1}function Ci(v){if(!d||!v||typeof v!="object")return!1;try{return d.call(v),!0}catch{}return!1}function Ri(v){if(!o||!v||typeof v!="object")return!1;try{o.call(v);try{t.call(v)}catch{return!0}return v instanceof Set}catch{}return!1}function Ni(v){if(!h||!v||typeof v!="object")return!1;try{h.call(v,h);try{u.call(v,u)}catch{return!0}return v instanceof WeakSet}catch{}return!1}function Pi(v){return!v||typeof v!="object"?!1:typeof HTMLElement<"u"&&v instanceof HTMLElement?!0:typeof v.nodeName=="string"&&typeof v.getAttribute=="function"}function We(v,E){if(v.length>E.maxStringLength){var P=v.length-E.maxStringLength,V="... "+P+" more character"+(P>1?"s":"");return We(w.call(v,0,E.maxStringLength),E)+V}var Z=re[E.quoteStyle||"single"];Z.lastIndex=0;var H=_.call(_.call(v,Z,"\\$1"),/[\x00-\x1f]/g,wr);return K(H,"single",E)}function wr(v){var E=v.charCodeAt(0),P={8:"b",9:"t",10:"n",12:"f",13:"r"}[E];return P?"\\"+P:"\\x"+(E<16?"0":"")+b.call(E.toString(16))}function yt(v){return"Object("+v+")"}function Nt(v){return v+" { ? }"}function Xr(v,E,P,V){var Z=V?Ee(P,V):C.call(P,", ");return v+" ("+E+") {"+Z+"}"}function Fi(v){for(var E=0;E<v.length;E++)if(Qr(v[E],`
|
|
7
7
|
`)>=0)return!1;return!0}function Mi(v,E){var P;if(v.indent===" ")P=" ";else if(typeof v.indent=="number"&&v.indent>0)P=C.call(Array(v.indent+1)," ");else return null;return{base:P,prev:C.call(Array(E+1),P)}}function Ee(v,E){if(v.length===0)return"";var P=`
|
|
8
8
|
`+E.prev+E.base;return P+C.call(v,","+P)+`
|
|
9
|
-
`+E.prev}function N(v,E){var P=ue(v),V=[];if(P){V.length=v.length;for(var Z=0;Z<v.length;Z++)V[Z]=rt(v,Z)?E(v[Z],v):""}var H=typeof B=="function"?B(v):[],Ne;if(ee){Ne={};for(var nt=0;nt<H.length;nt++)Ne["$"+H[nt]]=H[nt]}for(var Oe in v)rt(v,Oe)&&(P&&String(Number(Oe))===Oe&&Oe<v.length||ee&&Ne["$"+Oe]instanceof Symbol||(S.call(/[^\w$]/,Oe)?V.push(E(Oe,v)+": "+E(v[Oe],v)):V.push(Oe+": "+E(v[Oe],v))));if(typeof B=="function")for(var wt=0;wt<H.length;wt++)he.call(v,H[wt])&&V.push("["+E(H[wt])+"]: "+E(v[H[wt]],v));return V}return gi}var mi,La;function Ch(){if(La)return mi;La=1;var r=Jt(),e=Th(),t=Ih(),n=gr(),i=r("%WeakMap%",!0),s=r("%Map%",!0),o=e("WeakMap.prototype.get",!0),l=e("WeakMap.prototype.set",!0),a=e("WeakMap.prototype.has",!0),u=e("Map.prototype.get",!0),c=e("Map.prototype.set",!0),h=e("Map.prototype.has",!0),f=function(m,y){for(var w=m,_;(_=w.next)!==null;w=_)if(_.key===y)return w.next=_.next,_.next=m.next,m.next=_,_},d=function(m,y){var w=f(m,y);return w&&w.value},g=function(m,y,w){var _=f(m,y);_?_.value=w:m.next={key:y,next:m.next,value:w}},p=function(m,y){return!!f(m,y)};return mi=function(){var y,w,_,b={assert:function(k){if(!b.has(k))throw new n("Side channel does not contain "+t(k))},get:function(k){if(i&&k&&(typeof k=="object"||typeof k=="function")){if(y)return o(y,k)}else if(s){if(w)return u(w,k)}else if(_)return d(_,k)},has:function(k){if(i&&k&&(typeof k=="object"||typeof k=="function")){if(y)return a(y,k)}else if(s){if(w)return h(w,k)}else if(_)return p(_,k);return!1},set:function(k,S){i&&k&&(typeof k=="object"||typeof k=="function")?(y||(y=new i),l(y,k,S)):s?(w||(w=new s),c(w,k,S)):(_||(_={key:{},next:null}),g(_,k,S))}};return b},mi}var yi,Da;function wi(){if(Da)return yi;Da=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return yi={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},yi}var bi,xa;function ja(){if(xa)return bi;xa=1;var r=wi(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var m=[],y=0;y<256;++y)m.push("%"+((y<16?"0":"")+y.toString(16)).toUpperCase());return m}(),i=function(y){for(;y.length>1;){var w=y.pop(),_=w.obj[w.prop];if(t(_)){for(var b=[],k=0;k<_.length;++k)typeof _[k]<"u"&&b.push(_[k]);w.obj[w.prop]=b}}},s=function(y,w){for(var _=w&&w.plainObjects?Object.create(null):{},b=0;b<y.length;++b)typeof y[b]<"u"&&(_[b]=y[b]);return _},o=function m(y,w,_){if(!w)return y;if(typeof w!="object"){if(t(y))y.push(w);else if(y&&typeof y=="object")(_&&(_.plainObjects||_.allowPrototypes)||!e.call(Object.prototype,w))&&(y[w]=!0);else return[y,w];return y}if(!y||typeof y!="object")return[y].concat(w);var b=y;return t(y)&&!t(w)&&(b=s(y,_)),t(y)&&t(w)?(w.forEach(function(k,S){if(e.call(y,S)){var O=y[S];O&&typeof O=="object"&&k&&typeof k=="object"?y[S]=m(O,k,_):y.push(k)}else y[S]=k}),y):Object.keys(w).reduce(function(k,S){var O=w[S];return e.call(k,S)?k[S]=m(k[S],O,_):k[S]=O,k},b)},l=function(y,w){return Object.keys(w).reduce(function(_,b){return _[b]=w[b],_},y)},a=function(m,y,w){var _=m.replace(/\+/g," ");if(w==="iso-8859-1")return _.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(_)}catch{return _}},u=1024,c=function(y,w,_,b,k){if(y.length===0)return y;var S=y;if(typeof y=="symbol"?S=Symbol.prototype.toString.call(y):typeof y!="string"&&(S=String(y)),_==="iso-8859-1")return escape(S).replace(/%u[0-9a-f]{4}/gi,function(W){return"%26%23"+parseInt(W.slice(2),16)+"%3B"});for(var O="",C=0;C<S.length;C+=u){for(var F=S.length>=u?S.slice(C,C+u):S,R=[],Y=0;Y<F.length;++Y){var B=F.charCodeAt(Y);if(B===45||B===46||B===95||B===126||B>=48&&B<=57||B>=65&&B<=90||B>=97&&B<=122||k===r.RFC1738&&(B===40||B===41)){R[R.length]=F.charAt(Y);continue}if(B<128){R[R.length]=n[B];continue}if(B<2048){R[R.length]=n[192|B>>6]+n[128|B&63];continue}if(B<55296||B>=57344){R[R.length]=n[224|B>>12]+n[128|B>>6&63]+n[128|B&63];continue}Y+=1,B=65536+((B&1023)<<10|F.charCodeAt(Y)&1023),R[R.length]=n[240|B>>18]+n[128|B>>12&63]+n[128|B>>6&63]+n[128|B&63]}O+=R.join("")}return O},h=function(y){for(var w=[{obj:{o:y},prop:"o"}],_=[],b=0;b<w.length;++b)for(var k=w[b],S=k.obj[k.prop],O=Object.keys(S),C=0;C<O.length;++C){var F=O[C],R=S[F];typeof R=="object"&&R!==null&&_.indexOf(R)===-1&&(w.push({obj:S,prop:F}),_.push(R))}return i(w),y},f=function(y){return Object.prototype.toString.call(y)==="[object RegExp]"},d=function(y){return!y||typeof y!="object"?!1:!!(y.constructor&&y.constructor.isBuffer&&y.constructor.isBuffer(y))},g=function(y,w){return[].concat(y,w)},p=function(y,w){if(t(y)){for(var _=[],b=0;b<y.length;b+=1)_.push(w(y[b]));return _}return w(y)};return bi={arrayToObject:s,assign:l,combine:g,compact:h,decode:a,encode:c,isBuffer:d,isRegExp:f,maybeMap:p,merge:o},bi}var vi,Ua;function Rh(){if(Ua)return vi;Ua=1;var r=Ch(),e=ja(),t=wi(),n=Object.prototype.hasOwnProperty,i={brackets:function(m){return m+"[]"},comma:"comma",indices:function(m,y){return m+"["+y+"]"},repeat:function(m){return m}},s=Array.isArray,o=Array.prototype.push,l=function(p,m){o.apply(p,s(m)?m:[m])},a=Date.prototype.toISOString,u=t.default,c={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,format:u,formatter:t.formatters[u],indices:!1,serializeDate:function(m){return a.call(m)},skipNulls:!1,strictNullHandling:!1},h=function(m){return typeof m=="string"||typeof m=="number"||typeof m=="boolean"||typeof m=="symbol"||typeof m=="bigint"},f={},d=function p(m,y,w,_,b,k,S,O,C,F,R,Y,B,W,ee,D,he,X){for(var A=m,ne=X,te=0,ce=!1;(ne=ne.get(f))!==void 0&&!ce;){var $=ne.get(m);if(te+=1,typeof $<"u"){if($===te)throw new RangeError("Cyclic object value");ce=!0}typeof ne.get(f)>"u"&&(te=0)}if(typeof F=="function"?A=F(y,A):A instanceof Date?A=B(A):w==="comma"&&s(A)&&(A=e.maybeMap(A,function(Rt){return Rt instanceof Date?B(Rt):Rt})),A===null){if(k)return C&&!D?C(y,c.encoder,he,"key",W):y;A=""}if(h(A)||e.isBuffer(A)){if(C){var re=D?y:C(y,c.encoder,he,"key",W);return[ee(re)+"="+ee(C(A,c.encoder,he,"value",W))]}return[ee(y)+"="+ee(String(A))]}var K=[];if(typeof A>"u")return K;var se;if(w==="comma"&&s(A))D&&C&&(A=e.maybeMap(A,C)),se=[{value:A.length>0?A.join(",")||null:void 0}];else if(s(F))se=F;else{var ue=Object.keys(A);se=R?ue.sort(R):ue}var me=O?y.replace(/\./g,"%2E"):y,U=_&&s(A)&&A.length===1?me+"[]":me;if(b&&s(A)&&A.length===0)return U+"[]";for(var pe=0;pe<se.length;++pe){var Re=se[pe],$e=typeof Re=="object"&&typeof Re.value<"u"?Re.value:A[Re];if(!(S&&$e===null)){var ze=Y&&O?Re.replace(/\./g,"%2E"):Re,tt=s(A)?typeof w=="function"?w(U,ze):U:U+(Y?"."+ze:"["+ze+"]");X.set(m,te);var Kt=r();Kt.set(f,X),l(K,p($e,tt,w,_,b,k,S,O,w==="comma"&&D&&s(A)?null:C,F,R,Y,B,W,ee,D,he,Kt))}}return K},g=function(m){if(!m)return c;if(typeof m.allowEmptyArrays<"u"&&typeof m.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof m.encodeDotInKeys<"u"&&typeof m.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(m.encoder!==null&&typeof m.encoder<"u"&&typeof m.encoder!="function")throw new TypeError("Encoder has to be a function.");var y=m.charset||c.charset;if(typeof m.charset<"u"&&m.charset!=="utf-8"&&m.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var w=t.default;if(typeof m.format<"u"){if(!n.call(t.formatters,m.format))throw new TypeError("Unknown format option provided.");w=m.format}var _=t.formatters[w],b=c.filter;(typeof m.filter=="function"||s(m.filter))&&(b=m.filter);var k;if(m.arrayFormat in i?k=m.arrayFormat:"indices"in m?k=m.indices?"indices":"repeat":k=c.arrayFormat,"commaRoundTrip"in m&&typeof m.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var S=typeof m.allowDots>"u"?m.encodeDotInKeys===!0?!0:c.allowDots:!!m.allowDots;return{addQueryPrefix:typeof m.addQueryPrefix=="boolean"?m.addQueryPrefix:c.addQueryPrefix,allowDots:S,allowEmptyArrays:typeof m.allowEmptyArrays=="boolean"?!!m.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:k,charset:y,charsetSentinel:typeof m.charsetSentinel=="boolean"?m.charsetSentinel:c.charsetSentinel,commaRoundTrip:m.commaRoundTrip,delimiter:typeof m.delimiter>"u"?c.delimiter:m.delimiter,encode:typeof m.encode=="boolean"?m.encode:c.encode,encodeDotInKeys:typeof m.encodeDotInKeys=="boolean"?m.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof m.encoder=="function"?m.encoder:c.encoder,encodeValuesOnly:typeof m.encodeValuesOnly=="boolean"?m.encodeValuesOnly:c.encodeValuesOnly,filter:b,format:w,formatter:_,serializeDate:typeof m.serializeDate=="function"?m.serializeDate:c.serializeDate,skipNulls:typeof m.skipNulls=="boolean"?m.skipNulls:c.skipNulls,sort:typeof m.sort=="function"?m.sort:null,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:c.strictNullHandling}};return vi=function(p,m){var y=p,w=g(m),_,b;typeof w.filter=="function"?(b=w.filter,y=b("",y)):s(w.filter)&&(b=w.filter,_=b);var k=[];if(typeof y!="object"||y===null)return"";var S=i[w.arrayFormat],O=S==="comma"&&w.commaRoundTrip;_||(_=Object.keys(y)),w.sort&&_.sort(w.sort);for(var C=r(),F=0;F<_.length;++F){var R=_[F];w.skipNulls&&y[R]===null||l(k,d(y[R],R,S,O,w.allowEmptyArrays,w.strictNullHandling,w.skipNulls,w.encodeDotInKeys,w.encode?w.encoder:null,w.filter,w.sort,w.allowDots,w.serializeDate,w.format,w.formatter,w.encodeValuesOnly,w.charset,C))}var Y=k.join(w.delimiter),B=w.addQueryPrefix===!0?"?":"";return w.charsetSentinel&&(w.charset==="iso-8859-1"?B+="utf8=%26%2310003%3B&":B+="utf8=%E2%9C%93&"),Y.length>0?B+Y:""},vi}var Si,Ba;function Nh(){if(Ba)return Si;Ba=1;var r=ja(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},i=function(f){return f.replace(/&#(\d+);/g,function(d,g){return String.fromCharCode(parseInt(g,10))})},s=function(f,d){return f&&typeof f=="string"&&d.comma&&f.indexOf(",")>-1?f.split(","):f},o="utf8=%26%2310003%3B",l="utf8=%E2%9C%93",a=function(d,g){var p={__proto__:null},m=g.ignoreQueryPrefix?d.replace(/^\?/,""):d;m=m.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var y=g.parameterLimit===1/0?void 0:g.parameterLimit,w=m.split(g.delimiter,y),_=-1,b,k=g.charset;if(g.charsetSentinel)for(b=0;b<w.length;++b)w[b].indexOf("utf8=")===0&&(w[b]===l?k="utf-8":w[b]===o&&(k="iso-8859-1"),_=b,b=w.length);for(b=0;b<w.length;++b)if(b!==_){var S=w[b],O=S.indexOf("]="),C=O===-1?S.indexOf("="):O+1,F,R;C===-1?(F=g.decoder(S,n.decoder,k,"key"),R=g.strictNullHandling?null:""):(F=g.decoder(S.slice(0,C),n.decoder,k,"key"),R=r.maybeMap(s(S.slice(C+1),g),function(B){return g.decoder(B,n.decoder,k,"value")})),R&&g.interpretNumericEntities&&k==="iso-8859-1"&&(R=i(R)),S.indexOf("[]=")>-1&&(R=t(R)?[R]:R);var Y=e.call(p,F);Y&&g.duplicates==="combine"?p[F]=r.combine(p[F],R):(!Y||g.duplicates==="last")&&(p[F]=R)}return p},u=function(f,d,g,p){for(var m=p?d:s(d,g),y=f.length-1;y>=0;--y){var w,_=f[y];if(_==="[]"&&g.parseArrays)w=g.allowEmptyArrays&&(m===""||g.strictNullHandling&&m===null)?[]:[].concat(m);else{w=g.plainObjects?Object.create(null):{};var b=_.charAt(0)==="["&&_.charAt(_.length-1)==="]"?_.slice(1,-1):_,k=g.decodeDotInKeys?b.replace(/%2E/g,"."):b,S=parseInt(k,10);!g.parseArrays&&k===""?w={0:m}:!isNaN(S)&&_!==k&&String(S)===k&&S>=0&&g.parseArrays&&S<=g.arrayLimit?(w=[],w[S]=m):k!=="__proto__"&&(w[k]=m)}m=w}return m},c=function(d,g,p,m){if(d){var y=p.allowDots?d.replace(/\.([^.[]+)/g,"[$1]"):d,w=/(\[[^[\]]*])/,_=/(\[[^[\]]*])/g,b=p.depth>0&&w.exec(y),k=b?y.slice(0,b.index):y,S=[];if(k){if(!p.plainObjects&&e.call(Object.prototype,k)&&!p.allowPrototypes)return;S.push(k)}for(var O=0;p.depth>0&&(b=_.exec(y))!==null&&O<p.depth;){if(O+=1,!p.plainObjects&&e.call(Object.prototype,b[1].slice(1,-1))&&!p.allowPrototypes)return;S.push(b[1])}if(b){if(p.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+p.depth+" and strictDepth is true");S.push("["+y.slice(b.index)+"]")}return u(S,g,p,m)}},h=function(d){if(!d)return n;if(typeof d.allowEmptyArrays<"u"&&typeof d.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof d.decodeDotInKeys<"u"&&typeof d.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(d.decoder!==null&&typeof d.decoder<"u"&&typeof d.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof d.charset<"u"&&d.charset!=="utf-8"&&d.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var g=typeof d.charset>"u"?n.charset:d.charset,p=typeof d.duplicates>"u"?n.duplicates:d.duplicates;if(p!=="combine"&&p!=="first"&&p!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var m=typeof d.allowDots>"u"?d.decodeDotInKeys===!0?!0:n.allowDots:!!d.allowDots;return{allowDots:m,allowEmptyArrays:typeof d.allowEmptyArrays=="boolean"?!!d.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof d.allowPrototypes=="boolean"?d.allowPrototypes:n.allowPrototypes,allowSparse:typeof d.allowSparse=="boolean"?d.allowSparse:n.allowSparse,arrayLimit:typeof d.arrayLimit=="number"?d.arrayLimit:n.arrayLimit,charset:g,charsetSentinel:typeof d.charsetSentinel=="boolean"?d.charsetSentinel:n.charsetSentinel,comma:typeof d.comma=="boolean"?d.comma:n.comma,decodeDotInKeys:typeof d.decodeDotInKeys=="boolean"?d.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof d.decoder=="function"?d.decoder:n.decoder,delimiter:typeof d.delimiter=="string"||r.isRegExp(d.delimiter)?d.delimiter:n.delimiter,depth:typeof d.depth=="number"||d.depth===!1?+d.depth:n.depth,duplicates:p,ignoreQueryPrefix:d.ignoreQueryPrefix===!0,interpretNumericEntities:typeof d.interpretNumericEntities=="boolean"?d.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof d.parameterLimit=="number"?d.parameterLimit:n.parameterLimit,parseArrays:d.parseArrays!==!1,plainObjects:typeof d.plainObjects=="boolean"?d.plainObjects:n.plainObjects,strictDepth:typeof d.strictDepth=="boolean"?!!d.strictDepth:n.strictDepth,strictNullHandling:typeof d.strictNullHandling=="boolean"?d.strictNullHandling:n.strictNullHandling}};return Si=function(f,d){var g=h(d);if(f===""||f===null||typeof f>"u")return g.plainObjects?Object.create(null):{};for(var p=typeof f=="string"?a(f,g):f,m=g.plainObjects?Object.create(null):{},y=Object.keys(p),w=0;w<y.length;++w){var _=y[w],b=c(_,p[_],g,typeof f=="string");m=r.merge(m,b,g)}return g.allowSparse===!0?m:r.compact(m)},Si}var _i,$a;function Ph(){if($a)return _i;$a=1;var r=Rh(),e=Nh(),t=wi();return _i={formats:t,parse:e,stringify:r},_i}var Fh=Ph();const Ei=ua(Fh);let Wa=class{#e;#t;#r;#n;_logger=null;#i="";constructor(e,t,n){this.#e=be.create({baseURL:e,...n}),this.#t=t,this.#r=new Lu,this.#n=new Uu}setLogger(e){this._logger=e,this.#r.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}setRestrictionManagerParams(e){this.#r.params=e}getRestrictionManagerParams(){return this.#r.params}setLogTag(e){this.#i=e}clearLogTag(){this.#i=""}async batch(e,t=!0){const n=Array.isArray(e),i=n?[]:{};let s=0;const o=(l,a)=>{let u=null,c=null;if(Array.isArray(l)?(u=l[0],c=l[1]):l.method&&(u=l.method,c=l.params),u){s++;const h=u+"?"+Ei.stringify(c);n||Array.isArray(i)?i.push(h):i[a]=h}};if(n)for(const[l,a]of e.entries())o(a,l);else for(const[l,a]of Object.entries(e))o(a,l);return s<1?Promise.resolve(new Vt):this.call("batch",{halt:t?1:0,cmd:i}).then(l=>{const a=l.getData().result,u=n?[]:{},c=(g,p)=>{if(typeof a.result[p]<"u"||typeof a.result_error[p]<"u"){const m=g.split("?"),y=new Rn({result:x.isUndefined(a.result[p])?{}:a.result[p],error:a?.result_error[p]||void 0,total:a.result_total[p],next:a.result_next[p]},{method:m[0]||"",params:Ei.parse(m[1]||""),start:0},l.getStatus());n||Array.isArray(u)?u.push(y):u[p]=y}};if(Array.isArray(i))for(const[g,p]of i.entries())c(p,g);else for(const[g,p]of Object.entries(i))c(p,g);let h;const f=g=>new ur({status:0,answerError:{error:g.getErrorMessages().join("; "),errorDescription:`batch ${g.getQuery().method}: ${Ei.stringify(g.getQuery().params,{encode:!1})}`},cause:g.getErrors().next().value}),d=new Vt;if(n||Array.isArray(u)){h=[];for(const g of u){if(g.getStatus()!==200||!g.isSuccess){const p=f(g);if(!t&&!g.isSuccess){d.addError(p);continue}return Promise.reject(p)}h.push(g.getData().result)}}else{h={};for(const g of Object.keys(u)){const p=u[g];if(p.getStatus()!==200||!p.isSuccess){const m=f(p);if(!t&&!p.isSuccess){d.addError(m);continue}return Promise.reject(m)}h[g]=p.getData().result}}return d.setData(h),Promise.resolve(d)})}async call(e,t,n=0){let i=this.#t.getAuthData();return i===!1&&(i=await this.#t.refreshAuth()),await this.#r.check(),this.#e.post(this.#s(e),this.#o(i,t,n)).then(s=>{const o=s.data;return Promise.resolve({status:s.status,payload:o})},async s=>{let o={error:s?.code||0,errorDescription:s?.message||""};if(s instanceof ca&&s.response&&s.response.data){const a=s.response.data;o={error:a.error,errorDescription:a.error_description}}const l=new ur({status:s.response?.status||0,answerError:o,cause:s});return l.status===401&&["expired_token","invalid_token"].includes(l.answerError.error)?(this.getLogger().info(`refreshAuth >> ${l.answerError.error} >>>`),i=await this.#t.refreshAuth(),await this.#r.check(),this.#e.post(this.#s(e),this.#o(i,t,n)).then(async a=>{const u=a.data;return Promise.resolve({status:a.status,payload:u})},async a=>{let u={error:a?.code||0,errorDescription:a?.message||""};if(a instanceof ca&&a.response&&a.response.data){const h=a.response.data;u={error:h.error,errorDescription:h.error_description}}const c=new ur({status:a.response?.status||0,answerError:u,cause:a});return Promise.reject(c)})):Promise.reject(l)}).then(s=>{const o=new Rn(s.payload,{method:e,params:t,start:n},s.status);return Promise.resolve(o)})}#o(e,t,n=0){const i=Object.assign({},t);return this.#i.length>0&&(i.logTag=this.#i),i[this.#n.getQueryStringParameterName()]=this.#n.getRequestId(),i[this.#n.getQueryStringSdkParameterName()]="0.1.2",i.data&&i.data.start&&delete i.data.start,e.refresh_token!=="hook"&&(i.auth=e.access_token),i.start=n,i}#s(e){return`${encodeURIComponent(e)}.json`}};class Gt{static batchSize=50;_isInit=!1;_http=null;_logger=null;constructor(){this._isInit=!1}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}setLogger(e){this._logger=e,this.getHttpClient().setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}callMethod(e,t,n){return this.getHttpClient().call(e,t||{},n||0)}async callListMethod(e,t={},n=null,i=null){const s=new Vt;return x.isFunction(n)&&n!==null&&n(0),this.callMethod(e,t,0).then(async o=>{let l=[],a;if(i===null?a=o.getData().result:a=o.getData().result[i],l=[...l,...a],o.isMore()){let u=o;for(;u=await u.getNext(this.getHttpClient()),u!==!1;){let c;if(i===null?c=u.getData().result:c=u.getData().result[i],l=[...l,...c],n){const h=u.getTotal();n(h>0?Math.round(100*l.length/h):100)}}}return s.setData(l),n&&n(100),s})}async*fetchListMethod(e,t={},n="ID",i=null){t.order=t.order||{},t.filter=t.filter||{},t.start=-1;const s=`>${n}`;t.order[n]="ASC",t.filter[s]=0;do{const o=await this.callMethod(e,t,t.start);let l;if(x.isNull(i)&&i!==null?l=o.getData().result[i]:l=o.getData().result,l.length===0||(yield l,l.length<Gt.batchSize))break;const a=l.at(-1);a&&n in a&&(t.filter[s]=a[n])}while(!0)}async callBatch(e,t=!0){return this.getHttpClient().batch(e,t)}chunkArray(e,t=50){const n=[];for(let i=0;i<e.length;i+=t){const s=e.slice(i,i+t);n.push(s)}return n}async callBatchByChunk(e,t=!0){const n=new Vt,i=[],s=this.chunkArray(e,Gt.batchSize);for(const o of s){const l=await this.callBatch(o,t);i.push(...l.getData())}return n.setData(i)}getHttpClient(){if(!this.isInit||this._http===null)throw new Error("Http not init");return this._http}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new Error("B24 not initialized")}}var ki=(r=>(r.en="en",r.de="de",r.la="la",r.br="br",r.fr="fr",r.it="it",r.pl="pl",r.ru="ru",r.ua="ua",r.tr="tr",r.sc="sc",r.tc="tc",r.ja="ja",r.vn="vn",r.id="id",r.ms="ms",r.th="th",r.ar="ar",r))(ki||{});const Mh=()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)});let Lh=class bt{static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!bt.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");bt.isInternalConstructing=!1}static getInstance(){return bt.instance||(bt.isInternalConstructing=!0,bt.instance=new bt),bt.instance}setDefLocale(e){this._defLocale=e}format(e,t){let n;(typeof t>"u"||!x.isStringFilled(t))&&(t=x.isStringFilled(this._defLocale)?this._defLocale||"en":navigator?.language),Number.isInteger(e)?n=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):n=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let i=n.format(e);return t.includes("ru")&&(i=i.replace(",",".")),i}};class I{countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,n,i){this.countryCode=e,this.length=t,this.structure=n,this.example=i}isValid(e){return this.length===e.length&&this.countryCode===e.slice(0,2)&&this._regex().test(e.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(e))==1}toBBAN(e,t){return(this._regex().exec(e.slice(4)||"")||[]).slice(1).join(t)}fromBBAN(e){if(!this.isValidBBAN(e))throw new Error("Invalid BBAN");const t=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+e)))).slice(-2);return this.countryCode+t+e}isValidBBAN(e){return this.length-4===e.length&&this._regex().test(e)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(e){const t=(e.match(/(.{3})/g)||[]).map(n=>{let i;const s=n.slice(0,1),o=Number.parseInt(n.slice(1),10);switch(s){case"A":i="0-9A-Za-z";break;case"B":i="0-9A-Z";break;case"C":i="A-Za-z";break;case"F":i="0-9";break;case"L":i="a-z";break;case"U":i="A-Z";break;case"W":i="0-9a-z";break}return"(["+i+"]{"+o+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const n=t.charCodeAt(0);return n>=65&&n<=90?(n-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,n;for(;t.length>2;)n=t.slice(0,9),t=Number.parseInt(n,10)%97+t.slice(n.length);return Number.parseInt(t,10)%97}}class lt{static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!lt.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");lt.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return lt.instance||(lt.isInternalConstructing=!0,lt.instance=new lt),lt.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!this._isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const n=this._countries.get(t);return!!n&&n.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const n=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(n,"$1"+t)}electronicFormat(e){const t=/[^a-zA-Z0-9]/g;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const n=e.slice(0,2);if(!this._countries.has(n))throw new Error(`No country with code ${n}`);const i=this._countries.get(n);if(!i)throw new Error(`No country with code ${n}`);return i.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);if(!n)throw new Error(`No country with code ${e}`);return n.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!this._isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);return!!n&&n.isValidBBAN(this.electronicFormat(t))}_isString(e){return typeof e=="string"||e instanceof String}}const Dh=()=>{const r=Lh.getInstance(),e=lt.getInstance();return e.addSpecification(new I("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new I("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new I("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new I("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new I("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new I("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new I("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new I("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new I("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new I("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new I("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new I("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new I("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new I("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new I("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new I("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new I("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new I("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new I("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new I("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new I("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new I("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new I("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new I("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new I("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new I("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new I("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new I("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new I("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new I("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new I("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new I("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new I("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new I("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new I("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new I("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new I("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new I("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new I("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new I("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new I("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new I("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new I("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new I("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new I("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new I("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new I("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new I("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new I("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new I("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new I("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new I("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new I("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new I("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new I("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new I("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new I("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new I("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new I("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new I("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new I("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new I("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new I("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new I("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new I("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new I("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new I("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new I("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new I("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new I("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new I("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new I("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new I("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new I("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new I("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new I("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new I("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new I("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new I("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new I("BI",16,"F12","BI41123456789012")),e.addSpecification(new I("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new I("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new I("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new I("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new I("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new I("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new I("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new I("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new I("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new I("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new I("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new I("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new I("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new I("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new I("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new I("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new I("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new I("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new I("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new I("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new I("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new I("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}};class qa{#e;constructor(e){this.#e=Object.freeze(Object.assign({},e))}getAuthData(){const e=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,"");return{access_token:this.#e.secret,refresh_token:"hook",expires_in:0,domain:e,member_id:e}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#e.b24Url}`}getTargetOriginWithPath(){return`${this.#e.b24Url}/rest/${this.#e.userId}/${this.#e.secret}`}get isAdmin(){return!0}}class xh extends Gt{#e;constructor(e){super(),this.#e=new qa(e),this._http=new Wa(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._isInit=!0}setLogger(e){super.setLogger(e)}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var fe=(r=>(r.getInitData="getInitData",r.setInstallFinish="setInstallFinish",r.setInstall="setInstall",r.refreshAuth="refreshAuth",r.setAppOption="setAppOption",r.setUserOption="setUserOption",r.resizeWindow="resizeWindow",r.reloadWindow="reloadWindow",r.setTitle="setTitle",r.setScroll="setScroll",r.openApplication="openApplication",r.closeApplication="closeApplication",r.openPath="openPath",r.imCallTo="imCallTo",r.imPhoneTo="imPhoneTo",r.imOpenMessenger="imOpenMessenger",r.imOpenHistory="imOpenHistory",r.selectUser="selectUser",r.selectAccess="selectAccess",r.selectCRM="selectCRM",r.showAppForm="showAppForm",r))(fe||{});class Va{#e;#t;_logger=null;runCallbackHandler;constructor(e){this.#e=e,this.#t=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(e,t=null){return new Promise((n,i)=>{let s;const o={resolve:n,reject:i,timeoutId:null},l=this.#r(o);if(e.toString().includes(":"))s={method:e.toString(),params:t??"",callback:l,appSid:this.#e.getAppSid()};else{s=e.toString();const a=[t?JSON.stringify(t):null,l,this.#e.getAppSid()];s+=":"+a.filter(Boolean).join(":")}this.getLogger().log(`send to ${this.#e.getTargetOrigin()}`,{cmd:s}),parent.postMessage(s,this.#e.getTargetOrigin()),t?.isSafely&&(this.#t.get(l).timeoutId=window.setTimeout(()=>{this.#t.has(l)&&(this.getLogger().warn(`Action ${e.toString()} stop by timeout`),this.#t.delete(l),n({isSafely:!0}))},Number.parseInt(String(t?.safelyTime||900))))})}_runCallback(e){if(e.origin===this.#e.getTargetOrigin()&&e.data){this.getLogger().log(`get from ${e.origin}`,{data:e.data});const t=e.data.split(":"),n={id:t[0],args:t.slice(1).join(":")};if(n.args&&(n.args=JSON.parse(n.args)),this.#t.has(n.id)){const i=this.#t.get(n.id);i.timeoutId&&clearTimeout(i.timeoutId),this.#t.delete(n.id),i.resolve(n.args)}}}#r(e){const t=G.getUniqId();return this.#t.set(t,e),t}}class Ha{#e="";#t=!0;#r=null;#n=null;#i=null;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#t=e.PROTOCOL===!0,e.LANG&&(this.#i=e.LANG),e.APP_SID&&(this.#r=e.APP_SID)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#n||(this.#n=e.PATH),this.#i||(this.#i=e.LANG),this.#t=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this}getAppSid(){if(this.#r===null)throw new Error("Not init appSid");return this.#r}getTargetOrigin(){return`${this.#t?"https":"http"}://${this.#e}`}getTargetOriginWithPath(){return this.getTargetOrigin()+(this.#n??"")}getLang(){return this.#i||ki.en}}class za{#e=null;#t=null;#r=0;#n=null;#i=!1;#o;#s;constructor(e,t){this.#o=e,this.#s=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,this.#i=e.IS_ADMIN,this.#n=e.MEMBER_ID||""),this}getAuthData(){return this.#r>Date.now()?{access_token:this.#e,refresh_token:this.#t,expires_in:this.#r,domain:this.#o.getTargetOrigin(),member_id:this.#n}:!1}async refreshAuth(){return this.#s.send(fe.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#n||""].join("_")}get isAdmin(){return this.#i}}class Ja{#e;constructor(e){this.#e=e}async closeApplication(){return this.#e.send(fe.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(fe.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(fe.resizeWindow,{width:e,height:t,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${e} or height:number = ${t}`))}async resizeWindowAuto(e=null,t=0,n=0){const i=document.body;let s=Math.max(i.scrollWidth,i.offsetWidth);n>0&&(s=Math.max(n,s));let o=Math.max(i.scrollHeight,i.offsetHeight);return e&&(o=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(o=Math.max(t,o)),this.resizeWindow(s,o)}getScrollSize(){return Mh()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(fe.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(fe.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(fe.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(fe.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(fe.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(fe.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(fe.imOpenHistory,{dialogId:e,isSafely:!0})}}let Ga=class{#e;#t=null;#r=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#t=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#r=e.USER_OPTIONS),this}appGet(e){if(this.#t&&this.#t[e])return this.#t[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#t||(this.#t=[]),this.#t[e]=t,this.#n(fe.setAppOption,e,this.#t[e])}userGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#t||(this.#t=[]),this.#t[e]||(this.#t[e]=null),this.#r[e]=t,this.#n(fe.setUserOption,e,this.#r[e])}async#n(e,t,n){return this.#e.send(e,{name:t,value:n,isSafely:!0}).then(()=>Promise.resolve())}};class Za{#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(fe.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(fe.selectUser,{mult:!0})}async selectAccess(e=[]){return console.warn("@deprecated selectAccess"),this.#e.send(fe.selectAccess,{value:e})}async selectCRM(e){return console.warn("@deprecated selectCRM"),this.#e.send(fe.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value})}}class Ya{#e;#t;constructor(e,t){this.#e=e,this.#t=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#t.send(fe.openApplication,e)}async closeSliderAppPage(){return this.#t.send(fe.closeApplication,{isSafely:!1})}#r(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const n=new URL(e);return n.searchParams.set("IFRAME","Y"),n.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#t.send(fe.openPath,{path:[this.#r(t),n.pathname,n.search].join("")}).then(i=>i?.result==="error"?i?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((s,o)=>{const l=window.open(e,"_blank");if(!l){o(new Error("Error open window"));return}let a=0;const u=1e3*60*5,c=window.setInterval(()=>{a=a+1,l.closed?(clearInterval(c),s({isOpenAtNewWindow:!0,isClose:!0})):a>u&&(clearInterval(c),s({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(i?.errorCode)):i?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}async showAppForm(e){return console.warn("@deprecated showAppForm"),this.#t.send(fe.showAppForm,{params:e,isSafely:!0})}}class Ka{#e="";#t={};constructor(){}initData(e){this.#e=e.PLACEMENT||"DEFAULT";const t=e.PLACEMENT_OPTIONS;return this.#t=Object.freeze(t),this}get title(){return this.#e}get isDefault(){return this.title==="DEFAULT"}get options(){return this.#t}get isSliderMode(){return this.options?.IFRAME==="Y"}}class Qa extends Gt{#e=!1;#t=!1;#r;#n;#i;#o;#s;#l;#c;#a;constructor(e){super(),this.#r=new Ha(e),this.#n=new Va(this.#r),this.#n.subscribe(),this.#i=new za(this.#r,this.#n),this.#o=new Ja(this.#n),this.#s=new Ga(this.#n),this.#l=new Za(this.#n),this.#c=new Ya(this.#r,this.#n),this.#a=new Ka,this._isInit=!1}setLogger(e){super.setLogger(e),this.#n.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#t}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#o}get auth(){return this._ensureInitialized(),this.#i}get slider(){return this._ensureInitialized(),this.#c}get placement(){return this._ensureInitialized(),this.#a}get options(){return this._ensureInitialized(),this.#s}get dialog(){return this._ensureInitialized(),this.#l}async init(){return this.#n.send(fe.getInitData,{}).then(e=>(this.getLogger().log("init data:",e),this.#r.initData(e),this.#i.initData(e),this.#a.initData(e),this.#s.initData(e),this.#e=e.INSTALL,this.#t=e.FIRST_RUN,this._http=new Wa(this.#r.getTargetOriginWithPath(),this.#i,this._getHttpOptions()),this._isInit=!0,this.#t?this.#n.send(fe.setInstall,{install:!0}):Promise.resolve()))}destroy(){this.#n.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#n.send(fe.setInstallFinish,{}):Promise.reject(new Error("Application was previously installed. You cannot call installFinish"))}getTargetOrigin(){return this._ensureInitialized(),this.#r.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#r.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#r.getAppSid()}getLang(){return this._ensureInitialized(),this.#r.getLang()}}class Oi extends Error{constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=new Error("for stack").stack}}class Zt{_b24;_logger=null;_data=null;constructor(e){this._b24=e}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}async initData(e){return this.getLogger().log(e),Promise.reject(new Error("Rewrite this function"))}}class jh extends Zt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}class Uh extends Zt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return ko[this.data.status]||"Unknown status"}}class Bh extends Zt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}class $h extends Zt{_data=null;async initData(e){this._data=e,this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}makeRestrictionManagerParams(){this.data?.license&&this.data.license.includes("ent")&&(this.getLogger().log(`LICENSE ${this.data.license} => up restriction manager params`,An),this._b24.getHttpClient().setRestrictionManagerParams(An))}}class Wh extends Zt{async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(console.error(t),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{(await this._b24.callBatchByChunk(e,!0)).getData().forEach(t=>{if(typeof t.LANG>"u")return;const n=t.CURRENCY,i=this.data.currencyList.get(n);if(!(typeof i>"u"))for(const[s,o]of Object.entries(t.LANG))switch(i.lang[s]={decimals:Number.parseInt(o.DECIMALS),decPoint:o.DEC_POINT,formatString:o.FORMAT_STRING,fullName:o.FULL_NAME,isHideZero:o.HIDE_ZERO==="Y",thousandsSep:o.THOUSANDS_SEP,thousandsVariant:o.THOUSANDS_VARIANT},i.lang[s].thousandsVariant){case"N":i.lang[s].thousandsSep="";break;case"D":i.lang[s].thousandsSep=".";break;case"C":i.lang[s].thousandsSep=",";break;case"S":i.lang[s].thousandsSep=" ";break;case"B":i.lang[s].thousandsSep=" ";break;default:x.isStringFilled(i.lang[s].thousandsSep)||(i.lang[s].thousandsSep=" ");break}})}catch(t){console.error(t)}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(e){this._data.currencyBase=e}get baseCurrency(){return this.data.currencyBase}setCurrencyList(e=[]){this.data.currencyList.clear();for(const t of e)this.data.currencyList.set(t.CURRENCY,{amount:Number.parseFloat(t.CURRENCY),amountCnt:Number.parseInt(t.AMOUNT_CNT),isBase:t.BASE==="Y",currencyCode:t.CURRENCY,dateUpdate:G.toDateTime(t.DATE_UPDATE),decimals:Number.parseInt(t.DECIMALS),decPoint:t.DEC_POINT,formatString:t.FORMAT_STRING,fullName:t.FULL_NAME,lid:t.LID,sort:Number.parseInt(t.SORT),thousandsSep:t?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Oi(e);let i=n.fullName;if(!(typeof t>"u")){const s=n.lang[t];x.isUndefined(s)||(i=s.fullName)}return i}getCurrencyLiteral(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Oi(e);let i=n.formatString;if(!(typeof t>"u")){const s=n.lang[t];x.isUndefined(s)||(i=s.formatString)}return i.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,n){const i=this.data.currencyList.get(t);if(typeof i>"u")throw new Oi(t);const s={formatString:i.formatString,decimals:i.decimals,decPoint:i.decPoint,thousandsSep:i.thousandsSep};x.isStringFilled(s.thousandsSep)||(s.thousandsSep="");const o=i.lang[n];return x.isUndefined(o)||(s.formatString=o.formatString,s.decimals=o.decimals,s.decPoint=o.decPoint,s.thousandsSep=o.thousandsSep),s.formatString.replaceAll("&#","&%").replace("#",G.numberFormat(e,s.decimals,s.decPoint,s.thousandsSep)).replaceAll("&%","&#")||""}}class Ti extends Zt{_data;_type;static getSupportTypes(){return[at.NotSet,at.JsonArray,at.JsonObject,at.FloatVal,at.IntegerVal,at.BoolYN,at.StringVal]}static prepareArrayList(e){return x.isArray(e)?e:x.isObject(e)?Object.values(e):[]}constructor(e,t){super(e),this._type=t,this._data=new Map}get data(){return this._data}reset(){this.data.clear()}async initData(e){if(this.reset(),x.isObject(e))for(const[t,n]of Object.entries(e))this.data.set(t,n)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n),!x.isArray(n)&&!x.isObject(n)&&(n=t)}catch(i){this.getLogger().error(i),n=t}return Ti.prepareArrayList(n)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n)}catch(i){this.getLogger().error(i),n=t}return x.isObject(n)||(n=t),n}getFloat(e,t=0){return this.data.has(e)?G.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?G.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?G.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?G.toBoolean(this.data.get(e)):t}getString(e,t=""){return this.data.has(e)?this.data.get(e).toString():t}getDate(e,t=null){if(!this.data.has(e))return t;try{const n=G.toDateTime(this.data.get(e).toString());return n.isValid?n:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(n){this.getLogger().warn(n,e)}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t){const n=[];return n.push({method:this.getMethodSave(),params:{options:e}}),x.isObject(t)&&n.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.callBatch(n,!0)}}class Xa{_logger=null;userId;siteId;constructor(e={}){this.userId=e.userId?G.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}set(e,t){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window.localStorage>"u")return t||null;const n=window.localStorage.getItem(this._getKey(e));return n===null?t||null:JSON.parse(n)}remove(e){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}return window.localStorage.removeItem(this._getKey(e))}_getKey(e){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${e}`}compareKey(e,t){return e===this._getKey(t)}}class qh extends Error{constructor(e){super(e),this.name="ErrorNotConnected"}}class Vh extends Error{constructor(e){super(e),this.name="ErrorTimeout"}}const Zr="2.0";class Hh{_logger=null;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._connector=e.connector,x.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,n=5){return new Promise((i,s)=>{const o=this.createRequest(e,t);this._connector.send(JSON.stringify(o))||s(new qh("websocket is not connected"));const l=setTimeout(()=>{this._rpcResponseAwaiters.delete(o.id),s(new Vh("no response"))},n*1e3);this._rpcResponseAwaiters.set(o.id,{resolve:i,reject:s,timeout:l})})}executeOutgoingRpcBatch(e){const t=[],n=[];return e.forEach(({method:i,params:s,id:o})=>{const l=this.createRequest(i,s,o);t.push(l),n.push(new Promise((a,u)=>this._rpcResponseAwaiters.set(l.id,{resolve:a,reject:u})))}),this._connector.send(JSON.stringify(t)),n}processRpcResponse(e){if("id"in e&&this._rpcResponseAwaiters.has(Number(e.id))){const t=this._rpcResponseAwaiters.get(Number(e.id));t&&("result"in e?t.resolve(e.result):"error"in e?t.reject(e?.error||"error"):t.reject("wrong response structure"),clearTimeout(t.timeout),this._rpcResponseAwaiters.delete(Number(e.id)));return}this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Received rpc response with unknown id`),e)}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(n){this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Could not decode json rpc message`),n);return}if(x.isArray(t))return this.executeIncomingRpcBatch(t);if(x.isJsonRpcRequest(t))return this.executeIncomingRpcCommand(t);if(x.isJsonRpcResponse(t))return this.processRpcResponse(t);this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: unknown rpc packet`),t)}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:Zr,error:Cn.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const n of e)if("jsonrpc"in n)if("method"in n){const i=this.executeIncomingRpcCommand(n);i&&(i.jsonrpc=Zr,i.id=n.id,t.push(i))}else this.processRpcResponse(n);else this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: unknown rpc command in batch`),n),t.push({jsonrpc:Zr,error:Cn.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,n){return n||(n=this.nextId()),{jsonrpc:Zr,method:e,params:t,id:n}}}class zh{_logger=null;_storage;_ttl=24*60*60;_callbacks;constructor(e={}){e=e||{},this._storage=e.storage||new Xa,this._callbacks={onWebSocketBlockChanged:x.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",xe.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(xe.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(xe.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage. Error: `),t),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(xe.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(xe.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage. Error: `),t),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(xe.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(xe.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: LocalStorage error: `),t),!1}return!0}getTimestamp(){return Date.now()}}class Jh{_logger=null;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}async getPublicIds(e){const t=new Date,n={},i=[];for(const s of e){const o=this._publicIds.get(s);o&&o.end>t?n[o.userId]=o:i.push(s)}return i.length===0?Promise.resolve(n):new Promise(s=>{this._restClient.callMethod(this._getPublicListMethod,{users:i}).then(o=>{const l=o.getData().result;this.setPublicIds(Object.values(l));for(const a of i){const u=this._publicIds.get(a);u&&(n[u.userId]=u)}s(n)}).catch(o=>(this.getLogger().error(o),s({})))})}setPublicIds(e){e.forEach(t=>{const n=Number(t.user_id);this._publicIds.set(n,{userId:n,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var Ai={exports:{}};/*!
|
|
9
|
+
`+E.prev}function N(v,E){var P=ue(v),V=[];if(P){V.length=v.length;for(var Z=0;Z<v.length;Z++)V[Z]=rt(v,Z)?E(v[Z],v):""}var H=typeof B=="function"?B(v):[],Ne;if(ee){Ne={};for(var nt=0;nt<H.length;nt++)Ne["$"+H[nt]]=H[nt]}for(var Oe in v)rt(v,Oe)&&(P&&String(Number(Oe))===Oe&&Oe<v.length||ee&&Ne["$"+Oe]instanceof Symbol||(S.call(/[^\w$]/,Oe)?V.push(E(Oe,v)+": "+E(v[Oe],v)):V.push(Oe+": "+E(v[Oe],v))));if(typeof B=="function")for(var wt=0;wt<H.length;wt++)he.call(v,H[wt])&&V.push("["+E(H[wt])+"]: "+E(v[H[wt]],v));return V}return gi}var mi,La;function Ch(){if(La)return mi;La=1;var r=Jt(),e=Th(),t=Ih(),n=gr(),i=r("%WeakMap%",!0),s=r("%Map%",!0),o=e("WeakMap.prototype.get",!0),l=e("WeakMap.prototype.set",!0),a=e("WeakMap.prototype.has",!0),u=e("Map.prototype.get",!0),c=e("Map.prototype.set",!0),h=e("Map.prototype.has",!0),f=function(m,y){for(var w=m,_;(_=w.next)!==null;w=_)if(_.key===y)return w.next=_.next,_.next=m.next,m.next=_,_},d=function(m,y){var w=f(m,y);return w&&w.value},g=function(m,y,w){var _=f(m,y);_?_.value=w:m.next={key:y,next:m.next,value:w}},p=function(m,y){return!!f(m,y)};return mi=function(){var y,w,_,b={assert:function(k){if(!b.has(k))throw new n("Side channel does not contain "+t(k))},get:function(k){if(i&&k&&(typeof k=="object"||typeof k=="function")){if(y)return o(y,k)}else if(s){if(w)return u(w,k)}else if(_)return d(_,k)},has:function(k){if(i&&k&&(typeof k=="object"||typeof k=="function")){if(y)return a(y,k)}else if(s){if(w)return h(w,k)}else if(_)return p(_,k);return!1},set:function(k,S){i&&k&&(typeof k=="object"||typeof k=="function")?(y||(y=new i),l(y,k,S)):s?(w||(w=new s),c(w,k,S)):(_||(_={key:{},next:null}),g(_,k,S))}};return b},mi}var yi,Da;function wi(){if(Da)return yi;Da=1;var r=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return yi={default:t.RFC3986,formatters:{RFC1738:function(n){return r.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},yi}var bi,xa;function ja(){if(xa)return bi;xa=1;var r=wi(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n=function(){for(var m=[],y=0;y<256;++y)m.push("%"+((y<16?"0":"")+y.toString(16)).toUpperCase());return m}(),i=function(y){for(;y.length>1;){var w=y.pop(),_=w.obj[w.prop];if(t(_)){for(var b=[],k=0;k<_.length;++k)typeof _[k]<"u"&&b.push(_[k]);w.obj[w.prop]=b}}},s=function(y,w){for(var _=w&&w.plainObjects?Object.create(null):{},b=0;b<y.length;++b)typeof y[b]<"u"&&(_[b]=y[b]);return _},o=function m(y,w,_){if(!w)return y;if(typeof w!="object"){if(t(y))y.push(w);else if(y&&typeof y=="object")(_&&(_.plainObjects||_.allowPrototypes)||!e.call(Object.prototype,w))&&(y[w]=!0);else return[y,w];return y}if(!y||typeof y!="object")return[y].concat(w);var b=y;return t(y)&&!t(w)&&(b=s(y,_)),t(y)&&t(w)?(w.forEach(function(k,S){if(e.call(y,S)){var O=y[S];O&&typeof O=="object"&&k&&typeof k=="object"?y[S]=m(O,k,_):y.push(k)}else y[S]=k}),y):Object.keys(w).reduce(function(k,S){var O=w[S];return e.call(k,S)?k[S]=m(k[S],O,_):k[S]=O,k},b)},l=function(y,w){return Object.keys(w).reduce(function(_,b){return _[b]=w[b],_},y)},a=function(m,y,w){var _=m.replace(/\+/g," ");if(w==="iso-8859-1")return _.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(_)}catch{return _}},u=1024,c=function(y,w,_,b,k){if(y.length===0)return y;var S=y;if(typeof y=="symbol"?S=Symbol.prototype.toString.call(y):typeof y!="string"&&(S=String(y)),_==="iso-8859-1")return escape(S).replace(/%u[0-9a-f]{4}/gi,function(W){return"%26%23"+parseInt(W.slice(2),16)+"%3B"});for(var O="",C=0;C<S.length;C+=u){for(var F=S.length>=u?S.slice(C,C+u):S,R=[],Y=0;Y<F.length;++Y){var B=F.charCodeAt(Y);if(B===45||B===46||B===95||B===126||B>=48&&B<=57||B>=65&&B<=90||B>=97&&B<=122||k===r.RFC1738&&(B===40||B===41)){R[R.length]=F.charAt(Y);continue}if(B<128){R[R.length]=n[B];continue}if(B<2048){R[R.length]=n[192|B>>6]+n[128|B&63];continue}if(B<55296||B>=57344){R[R.length]=n[224|B>>12]+n[128|B>>6&63]+n[128|B&63];continue}Y+=1,B=65536+((B&1023)<<10|F.charCodeAt(Y)&1023),R[R.length]=n[240|B>>18]+n[128|B>>12&63]+n[128|B>>6&63]+n[128|B&63]}O+=R.join("")}return O},h=function(y){for(var w=[{obj:{o:y},prop:"o"}],_=[],b=0;b<w.length;++b)for(var k=w[b],S=k.obj[k.prop],O=Object.keys(S),C=0;C<O.length;++C){var F=O[C],R=S[F];typeof R=="object"&&R!==null&&_.indexOf(R)===-1&&(w.push({obj:S,prop:F}),_.push(R))}return i(w),y},f=function(y){return Object.prototype.toString.call(y)==="[object RegExp]"},d=function(y){return!y||typeof y!="object"?!1:!!(y.constructor&&y.constructor.isBuffer&&y.constructor.isBuffer(y))},g=function(y,w){return[].concat(y,w)},p=function(y,w){if(t(y)){for(var _=[],b=0;b<y.length;b+=1)_.push(w(y[b]));return _}return w(y)};return bi={arrayToObject:s,assign:l,combine:g,compact:h,decode:a,encode:c,isBuffer:d,isRegExp:f,maybeMap:p,merge:o},bi}var vi,Ua;function Rh(){if(Ua)return vi;Ua=1;var r=Ch(),e=ja(),t=wi(),n=Object.prototype.hasOwnProperty,i={brackets:function(m){return m+"[]"},comma:"comma",indices:function(m,y){return m+"["+y+"]"},repeat:function(m){return m}},s=Array.isArray,o=Array.prototype.push,l=function(p,m){o.apply(p,s(m)?m:[m])},a=Date.prototype.toISOString,u=t.default,c={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,format:u,formatter:t.formatters[u],indices:!1,serializeDate:function(m){return a.call(m)},skipNulls:!1,strictNullHandling:!1},h=function(m){return typeof m=="string"||typeof m=="number"||typeof m=="boolean"||typeof m=="symbol"||typeof m=="bigint"},f={},d=function p(m,y,w,_,b,k,S,O,C,F,R,Y,B,W,ee,D,he,X){for(var A=m,ne=X,te=0,ce=!1;(ne=ne.get(f))!==void 0&&!ce;){var $=ne.get(m);if(te+=1,typeof $<"u"){if($===te)throw new RangeError("Cyclic object value");ce=!0}typeof ne.get(f)>"u"&&(te=0)}if(typeof F=="function"?A=F(y,A):A instanceof Date?A=B(A):w==="comma"&&s(A)&&(A=e.maybeMap(A,function(Rt){return Rt instanceof Date?B(Rt):Rt})),A===null){if(k)return C&&!D?C(y,c.encoder,he,"key",W):y;A=""}if(h(A)||e.isBuffer(A)){if(C){var re=D?y:C(y,c.encoder,he,"key",W);return[ee(re)+"="+ee(C(A,c.encoder,he,"value",W))]}return[ee(y)+"="+ee(String(A))]}var K=[];if(typeof A>"u")return K;var se;if(w==="comma"&&s(A))D&&C&&(A=e.maybeMap(A,C)),se=[{value:A.length>0?A.join(",")||null:void 0}];else if(s(F))se=F;else{var ue=Object.keys(A);se=R?ue.sort(R):ue}var me=O?y.replace(/\./g,"%2E"):y,U=_&&s(A)&&A.length===1?me+"[]":me;if(b&&s(A)&&A.length===0)return U+"[]";for(var pe=0;pe<se.length;++pe){var Re=se[pe],$e=typeof Re=="object"&&typeof Re.value<"u"?Re.value:A[Re];if(!(S&&$e===null)){var ze=Y&&O?Re.replace(/\./g,"%2E"):Re,tt=s(A)?typeof w=="function"?w(U,ze):U:U+(Y?"."+ze:"["+ze+"]");X.set(m,te);var Kt=r();Kt.set(f,X),l(K,p($e,tt,w,_,b,k,S,O,w==="comma"&&D&&s(A)?null:C,F,R,Y,B,W,ee,D,he,Kt))}}return K},g=function(m){if(!m)return c;if(typeof m.allowEmptyArrays<"u"&&typeof m.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof m.encodeDotInKeys<"u"&&typeof m.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(m.encoder!==null&&typeof m.encoder<"u"&&typeof m.encoder!="function")throw new TypeError("Encoder has to be a function.");var y=m.charset||c.charset;if(typeof m.charset<"u"&&m.charset!=="utf-8"&&m.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var w=t.default;if(typeof m.format<"u"){if(!n.call(t.formatters,m.format))throw new TypeError("Unknown format option provided.");w=m.format}var _=t.formatters[w],b=c.filter;(typeof m.filter=="function"||s(m.filter))&&(b=m.filter);var k;if(m.arrayFormat in i?k=m.arrayFormat:"indices"in m?k=m.indices?"indices":"repeat":k=c.arrayFormat,"commaRoundTrip"in m&&typeof m.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var S=typeof m.allowDots>"u"?m.encodeDotInKeys===!0?!0:c.allowDots:!!m.allowDots;return{addQueryPrefix:typeof m.addQueryPrefix=="boolean"?m.addQueryPrefix:c.addQueryPrefix,allowDots:S,allowEmptyArrays:typeof m.allowEmptyArrays=="boolean"?!!m.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:k,charset:y,charsetSentinel:typeof m.charsetSentinel=="boolean"?m.charsetSentinel:c.charsetSentinel,commaRoundTrip:m.commaRoundTrip,delimiter:typeof m.delimiter>"u"?c.delimiter:m.delimiter,encode:typeof m.encode=="boolean"?m.encode:c.encode,encodeDotInKeys:typeof m.encodeDotInKeys=="boolean"?m.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof m.encoder=="function"?m.encoder:c.encoder,encodeValuesOnly:typeof m.encodeValuesOnly=="boolean"?m.encodeValuesOnly:c.encodeValuesOnly,filter:b,format:w,formatter:_,serializeDate:typeof m.serializeDate=="function"?m.serializeDate:c.serializeDate,skipNulls:typeof m.skipNulls=="boolean"?m.skipNulls:c.skipNulls,sort:typeof m.sort=="function"?m.sort:null,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:c.strictNullHandling}};return vi=function(p,m){var y=p,w=g(m),_,b;typeof w.filter=="function"?(b=w.filter,y=b("",y)):s(w.filter)&&(b=w.filter,_=b);var k=[];if(typeof y!="object"||y===null)return"";var S=i[w.arrayFormat],O=S==="comma"&&w.commaRoundTrip;_||(_=Object.keys(y)),w.sort&&_.sort(w.sort);for(var C=r(),F=0;F<_.length;++F){var R=_[F];w.skipNulls&&y[R]===null||l(k,d(y[R],R,S,O,w.allowEmptyArrays,w.strictNullHandling,w.skipNulls,w.encodeDotInKeys,w.encode?w.encoder:null,w.filter,w.sort,w.allowDots,w.serializeDate,w.format,w.formatter,w.encodeValuesOnly,w.charset,C))}var Y=k.join(w.delimiter),B=w.addQueryPrefix===!0?"?":"";return w.charsetSentinel&&(w.charset==="iso-8859-1"?B+="utf8=%26%2310003%3B&":B+="utf8=%E2%9C%93&"),Y.length>0?B+Y:""},vi}var Si,Ba;function Nh(){if(Ba)return Si;Ba=1;var r=ja(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},i=function(f){return f.replace(/&#(\d+);/g,function(d,g){return String.fromCharCode(parseInt(g,10))})},s=function(f,d){return f&&typeof f=="string"&&d.comma&&f.indexOf(",")>-1?f.split(","):f},o="utf8=%26%2310003%3B",l="utf8=%E2%9C%93",a=function(d,g){var p={__proto__:null},m=g.ignoreQueryPrefix?d.replace(/^\?/,""):d;m=m.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var y=g.parameterLimit===1/0?void 0:g.parameterLimit,w=m.split(g.delimiter,y),_=-1,b,k=g.charset;if(g.charsetSentinel)for(b=0;b<w.length;++b)w[b].indexOf("utf8=")===0&&(w[b]===l?k="utf-8":w[b]===o&&(k="iso-8859-1"),_=b,b=w.length);for(b=0;b<w.length;++b)if(b!==_){var S=w[b],O=S.indexOf("]="),C=O===-1?S.indexOf("="):O+1,F,R;C===-1?(F=g.decoder(S,n.decoder,k,"key"),R=g.strictNullHandling?null:""):(F=g.decoder(S.slice(0,C),n.decoder,k,"key"),R=r.maybeMap(s(S.slice(C+1),g),function(B){return g.decoder(B,n.decoder,k,"value")})),R&&g.interpretNumericEntities&&k==="iso-8859-1"&&(R=i(R)),S.indexOf("[]=")>-1&&(R=t(R)?[R]:R);var Y=e.call(p,F);Y&&g.duplicates==="combine"?p[F]=r.combine(p[F],R):(!Y||g.duplicates==="last")&&(p[F]=R)}return p},u=function(f,d,g,p){for(var m=p?d:s(d,g),y=f.length-1;y>=0;--y){var w,_=f[y];if(_==="[]"&&g.parseArrays)w=g.allowEmptyArrays&&(m===""||g.strictNullHandling&&m===null)?[]:[].concat(m);else{w=g.plainObjects?Object.create(null):{};var b=_.charAt(0)==="["&&_.charAt(_.length-1)==="]"?_.slice(1,-1):_,k=g.decodeDotInKeys?b.replace(/%2E/g,"."):b,S=parseInt(k,10);!g.parseArrays&&k===""?w={0:m}:!isNaN(S)&&_!==k&&String(S)===k&&S>=0&&g.parseArrays&&S<=g.arrayLimit?(w=[],w[S]=m):k!=="__proto__"&&(w[k]=m)}m=w}return m},c=function(d,g,p,m){if(d){var y=p.allowDots?d.replace(/\.([^.[]+)/g,"[$1]"):d,w=/(\[[^[\]]*])/,_=/(\[[^[\]]*])/g,b=p.depth>0&&w.exec(y),k=b?y.slice(0,b.index):y,S=[];if(k){if(!p.plainObjects&&e.call(Object.prototype,k)&&!p.allowPrototypes)return;S.push(k)}for(var O=0;p.depth>0&&(b=_.exec(y))!==null&&O<p.depth;){if(O+=1,!p.plainObjects&&e.call(Object.prototype,b[1].slice(1,-1))&&!p.allowPrototypes)return;S.push(b[1])}if(b){if(p.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+p.depth+" and strictDepth is true");S.push("["+y.slice(b.index)+"]")}return u(S,g,p,m)}},h=function(d){if(!d)return n;if(typeof d.allowEmptyArrays<"u"&&typeof d.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof d.decodeDotInKeys<"u"&&typeof d.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(d.decoder!==null&&typeof d.decoder<"u"&&typeof d.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof d.charset<"u"&&d.charset!=="utf-8"&&d.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var g=typeof d.charset>"u"?n.charset:d.charset,p=typeof d.duplicates>"u"?n.duplicates:d.duplicates;if(p!=="combine"&&p!=="first"&&p!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var m=typeof d.allowDots>"u"?d.decodeDotInKeys===!0?!0:n.allowDots:!!d.allowDots;return{allowDots:m,allowEmptyArrays:typeof d.allowEmptyArrays=="boolean"?!!d.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof d.allowPrototypes=="boolean"?d.allowPrototypes:n.allowPrototypes,allowSparse:typeof d.allowSparse=="boolean"?d.allowSparse:n.allowSparse,arrayLimit:typeof d.arrayLimit=="number"?d.arrayLimit:n.arrayLimit,charset:g,charsetSentinel:typeof d.charsetSentinel=="boolean"?d.charsetSentinel:n.charsetSentinel,comma:typeof d.comma=="boolean"?d.comma:n.comma,decodeDotInKeys:typeof d.decodeDotInKeys=="boolean"?d.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof d.decoder=="function"?d.decoder:n.decoder,delimiter:typeof d.delimiter=="string"||r.isRegExp(d.delimiter)?d.delimiter:n.delimiter,depth:typeof d.depth=="number"||d.depth===!1?+d.depth:n.depth,duplicates:p,ignoreQueryPrefix:d.ignoreQueryPrefix===!0,interpretNumericEntities:typeof d.interpretNumericEntities=="boolean"?d.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof d.parameterLimit=="number"?d.parameterLimit:n.parameterLimit,parseArrays:d.parseArrays!==!1,plainObjects:typeof d.plainObjects=="boolean"?d.plainObjects:n.plainObjects,strictDepth:typeof d.strictDepth=="boolean"?!!d.strictDepth:n.strictDepth,strictNullHandling:typeof d.strictNullHandling=="boolean"?d.strictNullHandling:n.strictNullHandling}};return Si=function(f,d){var g=h(d);if(f===""||f===null||typeof f>"u")return g.plainObjects?Object.create(null):{};for(var p=typeof f=="string"?a(f,g):f,m=g.plainObjects?Object.create(null):{},y=Object.keys(p),w=0;w<y.length;++w){var _=y[w],b=c(_,p[_],g,typeof f=="string");m=r.merge(m,b,g)}return g.allowSparse===!0?m:r.compact(m)},Si}var _i,$a;function Ph(){if($a)return _i;$a=1;var r=Rh(),e=Nh(),t=wi();return _i={formats:t,parse:e,stringify:r},_i}var Fh=Ph();const Ei=ua(Fh);let Wa=class{#e;#t;#r;#n;_logger=null;#i="";constructor(e,t,n){this.#e=be.create({baseURL:e,...n}),this.#t=t,this.#r=new Lu,this.#n=new Uu}setLogger(e){this._logger=e,this.#r.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}setRestrictionManagerParams(e){this.#r.params=e}getRestrictionManagerParams(){return this.#r.params}setLogTag(e){this.#i=e}clearLogTag(){this.#i=""}async batch(e,t=!0){const n=Array.isArray(e),i=n?[]:{};let s=0;const o=(l,a)=>{let u=null,c=null;if(Array.isArray(l)?(u=l[0],c=l[1]):l.method&&(u=l.method,c=l.params),u){s++;const h=u+"?"+Ei.stringify(c);n||Array.isArray(i)?i.push(h):i[a]=h}};if(n)for(const[l,a]of e.entries())o(a,l);else for(const[l,a]of Object.entries(e))o(a,l);return s<1?Promise.resolve(new Vt):this.call("batch",{halt:t?1:0,cmd:i}).then(l=>{const a=l.getData().result,u=n?[]:{},c=(g,p)=>{if(typeof a.result[p]<"u"||typeof a.result_error[p]<"u"){const m=g.split("?"),y=new Rn({result:x.isUndefined(a.result[p])?{}:a.result[p],error:a?.result_error[p]||void 0,total:a.result_total[p],next:a.result_next[p]},{method:m[0]||"",params:Ei.parse(m[1]||""),start:0},l.getStatus());n||Array.isArray(u)?u.push(y):u[p]=y}};if(Array.isArray(i))for(const[g,p]of i.entries())c(p,g);else for(const[g,p]of Object.entries(i))c(p,g);let h;const f=g=>new ur({status:0,answerError:{error:g.getErrorMessages().join("; "),errorDescription:`batch ${g.getQuery().method}: ${Ei.stringify(g.getQuery().params,{encode:!1})}`},cause:g.getErrors().next().value}),d=new Vt;if(n||Array.isArray(u)){h=[];for(const g of u){if(g.getStatus()!==200||!g.isSuccess){const p=f(g);if(!t&&!g.isSuccess){d.addError(p);continue}return Promise.reject(p)}h.push(g.getData().result)}}else{h={};for(const g of Object.keys(u)){const p=u[g];if(p.getStatus()!==200||!p.isSuccess){const m=f(p);if(!t&&!p.isSuccess){d.addError(m);continue}return Promise.reject(m)}h[g]=p.getData().result}}return d.setData(h),Promise.resolve(d)})}async call(e,t,n=0){let i=this.#t.getAuthData();return i===!1&&(i=await this.#t.refreshAuth()),await this.#r.check(),this.#e.post(this.#s(e),this.#o(i,t,n)).then(s=>{const o=s.data;return Promise.resolve({status:s.status,payload:o})},async s=>{let o={error:s?.code||0,errorDescription:s?.message||""};if(s instanceof ca&&s.response&&s.response.data){const a=s.response.data;o={error:a.error,errorDescription:a.error_description}}const l=new ur({status:s.response?.status||0,answerError:o,cause:s});return l.status===401&&["expired_token","invalid_token"].includes(l.answerError.error)?(this.getLogger().info(`refreshAuth >> ${l.answerError.error} >>>`),i=await this.#t.refreshAuth(),await this.#r.check(),this.#e.post(this.#s(e),this.#o(i,t,n)).then(async a=>{const u=a.data;return Promise.resolve({status:a.status,payload:u})},async a=>{let u={error:a?.code||0,errorDescription:a?.message||""};if(a instanceof ca&&a.response&&a.response.data){const h=a.response.data;u={error:h.error,errorDescription:h.error_description}}const c=new ur({status:a.response?.status||0,answerError:u,cause:a});return Promise.reject(c)})):Promise.reject(l)}).then(s=>{const o=new Rn(s.payload,{method:e,params:t,start:n},s.status);return Promise.resolve(o)})}#o(e,t,n=0){const i=Object.assign({},t);return this.#i.length>0&&(i.logTag=this.#i),i[this.#n.getQueryStringParameterName()]=this.#n.getRequestId(),i[this.#n.getQueryStringSdkParameterName()]="0.1.3",i.data&&i.data.start&&delete i.data.start,e.refresh_token!=="hook"&&(i.auth=e.access_token),i.start=n,i}#s(e){return`${encodeURIComponent(e)}.json`}};class Gt{static batchSize=50;_isInit=!1;_http=null;_logger=null;constructor(){this._isInit=!1}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}setLogger(e){this._logger=e,this.getHttpClient().setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}callMethod(e,t,n){return this.getHttpClient().call(e,t||{},n||0)}async callListMethod(e,t={},n=null,i=null){const s=new Vt;return x.isFunction(n)&&n!==null&&n(0),this.callMethod(e,t,0).then(async o=>{let l=[],a;if(i===null?a=o.getData().result:a=o.getData().result[i],l=[...l,...a],o.isMore()){let u=o;for(;u=await u.getNext(this.getHttpClient()),u!==!1;){let c;if(i===null?c=u.getData().result:c=u.getData().result[i],l=[...l,...c],n){const h=u.getTotal();n(h>0?Math.round(100*l.length/h):100)}}}return s.setData(l),n&&n(100),s})}async*fetchListMethod(e,t={},n="ID",i=null){t.order=t.order||{},t.filter=t.filter||{},t.start=-1;const s=`>${n}`;t.order[n]="ASC",t.filter[s]=0;do{const o=await this.callMethod(e,t,t.start);let l;if(!x.isNull(i)&&i!==null?l=o.getData().result[i]:l=o.getData().result,l.length===0||(yield l,l.length<Gt.batchSize))break;const a=l.at(-1);a&&n in a&&(t.filter[s]=a[n])}while(!0)}async callBatch(e,t=!0){return this.getHttpClient().batch(e,t)}chunkArray(e,t=50){const n=[];for(let i=0;i<e.length;i+=t){const s=e.slice(i,i+t);n.push(s)}return n}async callBatchByChunk(e,t=!0){const n=new Vt,i=[],s=this.chunkArray(e,Gt.batchSize);for(const o of s){const l=await this.callBatch(o,t);i.push(...l.getData())}return n.setData(i)}getHttpClient(){if(!this.isInit||this._http===null)throw new Error("Http not init");return this._http}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new Error("B24 not initialized")}}var ki=(r=>(r.en="en",r.de="de",r.la="la",r.br="br",r.fr="fr",r.it="it",r.pl="pl",r.ru="ru",r.ua="ua",r.tr="tr",r.sc="sc",r.tc="tc",r.ja="ja",r.vn="vn",r.id="id",r.ms="ms",r.th="th",r.ar="ar",r))(ki||{});const Mh=()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)});let Lh=class bt{static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!bt.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");bt.isInternalConstructing=!1}static getInstance(){return bt.instance||(bt.isInternalConstructing=!0,bt.instance=new bt),bt.instance}setDefLocale(e){this._defLocale=e}format(e,t){let n;(typeof t>"u"||!x.isStringFilled(t))&&(t=x.isStringFilled(this._defLocale)?this._defLocale||"en":navigator?.language),Number.isInteger(e)?n=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):n=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let i=n.format(e);return t.includes("ru")&&(i=i.replace(",",".")),i}};class I{countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,n,i){this.countryCode=e,this.length=t,this.structure=n,this.example=i}isValid(e){return this.length===e.length&&this.countryCode===e.slice(0,2)&&this._regex().test(e.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(e))==1}toBBAN(e,t){return(this._regex().exec(e.slice(4)||"")||[]).slice(1).join(t)}fromBBAN(e){if(!this.isValidBBAN(e))throw new Error("Invalid BBAN");const t=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+e)))).slice(-2);return this.countryCode+t+e}isValidBBAN(e){return this.length-4===e.length&&this._regex().test(e)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(e){const t=(e.match(/(.{3})/g)||[]).map(n=>{let i;const s=n.slice(0,1),o=Number.parseInt(n.slice(1),10);switch(s){case"A":i="0-9A-Za-z";break;case"B":i="0-9A-Z";break;case"C":i="A-Za-z";break;case"F":i="0-9";break;case"L":i="a-z";break;case"U":i="A-Z";break;case"W":i="0-9a-z";break}return"(["+i+"]{"+o+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const n=t.charCodeAt(0);return n>=65&&n<=90?(n-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,n;for(;t.length>2;)n=t.slice(0,9),t=Number.parseInt(n,10)%97+t.slice(n.length);return Number.parseInt(t,10)%97}}class lt{static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!lt.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");lt.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return lt.instance||(lt.isInternalConstructing=!0,lt.instance=new lt),lt.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!this._isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const n=this._countries.get(t);return!!n&&n.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const n=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(n,"$1"+t)}electronicFormat(e){const t=/[^a-zA-Z0-9]/g;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const n=e.slice(0,2);if(!this._countries.has(n))throw new Error(`No country with code ${n}`);const i=this._countries.get(n);if(!i)throw new Error(`No country with code ${n}`);return i.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);if(!n)throw new Error(`No country with code ${e}`);return n.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!this._isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);return!!n&&n.isValidBBAN(this.electronicFormat(t))}_isString(e){return typeof e=="string"||e instanceof String}}const Dh=()=>{const r=Lh.getInstance(),e=lt.getInstance();return e.addSpecification(new I("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new I("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new I("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new I("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new I("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new I("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new I("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new I("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new I("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new I("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new I("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new I("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new I("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new I("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new I("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new I("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new I("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new I("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new I("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new I("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new I("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new I("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new I("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new I("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new I("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new I("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new I("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new I("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new I("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new I("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new I("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new I("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new I("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new I("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new I("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new I("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new I("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new I("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new I("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new I("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new I("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new I("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new I("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new I("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new I("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new I("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new I("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new I("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new I("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new I("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new I("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new I("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new I("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new I("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new I("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new I("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new I("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new I("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new I("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new I("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new I("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new I("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new I("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new I("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new I("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new I("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new I("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new I("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new I("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new I("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new I("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new I("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new I("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new I("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new I("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new I("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new I("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new I("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new I("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new I("BI",16,"F12","BI41123456789012")),e.addSpecification(new I("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new I("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new I("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new I("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new I("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new I("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new I("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new I("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new I("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new I("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new I("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new I("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new I("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new I("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new I("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new I("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new I("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new I("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new I("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new I("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new I("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new I("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}};class qa{#e;constructor(e){this.#e=Object.freeze(Object.assign({},e))}getAuthData(){const e=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,"");return{access_token:this.#e.secret,refresh_token:"hook",expires_in:0,domain:e,member_id:e}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#e.b24Url}`}getTargetOriginWithPath(){return`${this.#e.b24Url}/rest/${this.#e.userId}/${this.#e.secret}`}get isAdmin(){return!0}}class xh extends Gt{#e;constructor(e){super(),this.#e=new qa(e),this._http=new Wa(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._isInit=!0}setLogger(e){super.setLogger(e)}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var fe=(r=>(r.getInitData="getInitData",r.setInstallFinish="setInstallFinish",r.setInstall="setInstall",r.refreshAuth="refreshAuth",r.setAppOption="setAppOption",r.setUserOption="setUserOption",r.resizeWindow="resizeWindow",r.reloadWindow="reloadWindow",r.setTitle="setTitle",r.setScroll="setScroll",r.openApplication="openApplication",r.closeApplication="closeApplication",r.openPath="openPath",r.imCallTo="imCallTo",r.imPhoneTo="imPhoneTo",r.imOpenMessenger="imOpenMessenger",r.imOpenHistory="imOpenHistory",r.selectUser="selectUser",r.selectAccess="selectAccess",r.selectCRM="selectCRM",r.showAppForm="showAppForm",r))(fe||{});class Va{#e;#t;_logger=null;runCallbackHandler;constructor(e){this.#e=e,this.#t=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(e,t=null){return new Promise((n,i)=>{let s;const o={resolve:n,reject:i,timeoutId:null},l=this.#r(o);if(e.toString().includes(":"))s={method:e.toString(),params:t??"",callback:l,appSid:this.#e.getAppSid()};else{s=e.toString();const a=[t?JSON.stringify(t):null,l,this.#e.getAppSid()];s+=":"+a.filter(Boolean).join(":")}this.getLogger().log(`send to ${this.#e.getTargetOrigin()}`,{cmd:s}),parent.postMessage(s,this.#e.getTargetOrigin()),t?.isSafely&&(this.#t.get(l).timeoutId=window.setTimeout(()=>{this.#t.has(l)&&(this.getLogger().warn(`Action ${e.toString()} stop by timeout`),this.#t.delete(l),n({isSafely:!0}))},Number.parseInt(String(t?.safelyTime||900))))})}_runCallback(e){if(e.origin===this.#e.getTargetOrigin()&&e.data){this.getLogger().log(`get from ${e.origin}`,{data:e.data});const t=e.data.split(":"),n={id:t[0],args:t.slice(1).join(":")};if(n.args&&(n.args=JSON.parse(n.args)),this.#t.has(n.id)){const i=this.#t.get(n.id);i.timeoutId&&clearTimeout(i.timeoutId),this.#t.delete(n.id),i.resolve(n.args)}}}#r(e){const t=G.getUniqId();return this.#t.set(t,e),t}}class Ha{#e="";#t=!0;#r=null;#n=null;#i=null;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#t=e.PROTOCOL===!0,e.LANG&&(this.#i=e.LANG),e.APP_SID&&(this.#r=e.APP_SID)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#n||(this.#n=e.PATH),this.#i||(this.#i=e.LANG),this.#t=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this}getAppSid(){if(this.#r===null)throw new Error("Not init appSid");return this.#r}getTargetOrigin(){return`${this.#t?"https":"http"}://${this.#e}`}getTargetOriginWithPath(){return this.getTargetOrigin()+(this.#n??"")}getLang(){return this.#i||ki.en}}class za{#e=null;#t=null;#r=0;#n=null;#i=!1;#o;#s;constructor(e,t){this.#o=e,this.#s=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,this.#i=e.IS_ADMIN,this.#n=e.MEMBER_ID||""),this}getAuthData(){return this.#r>Date.now()?{access_token:this.#e,refresh_token:this.#t,expires_in:this.#r,domain:this.#o.getTargetOrigin(),member_id:this.#n}:!1}async refreshAuth(){return this.#s.send(fe.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#n||""].join("_")}get isAdmin(){return this.#i}}class Ja{#e;constructor(e){this.#e=e}async closeApplication(){return this.#e.send(fe.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(fe.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(fe.resizeWindow,{width:e,height:t,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${e} or height:number = ${t}`))}async resizeWindowAuto(e=null,t=0,n=0){const i=document.body;let s=Math.max(i.scrollWidth,i.offsetWidth);n>0&&(s=Math.max(n,s));let o=Math.max(i.scrollHeight,i.offsetHeight);return e&&(o=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(o=Math.max(t,o)),this.resizeWindow(s,o)}getScrollSize(){return Mh()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(fe.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(fe.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(fe.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(fe.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(fe.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(fe.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(fe.imOpenHistory,{dialogId:e,isSafely:!0})}}let Ga=class{#e;#t=null;#r=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#t=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#r=e.USER_OPTIONS),this}appGet(e){if(this.#t&&this.#t[e])return this.#t[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#t||(this.#t=[]),this.#t[e]=t,this.#n(fe.setAppOption,e,this.#t[e])}userGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#t||(this.#t=[]),this.#t[e]||(this.#t[e]=null),this.#r[e]=t,this.#n(fe.setUserOption,e,this.#r[e])}async#n(e,t,n){return this.#e.send(e,{name:t,value:n,isSafely:!0}).then(()=>Promise.resolve())}};class Za{#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(fe.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(fe.selectUser,{mult:!0})}async selectAccess(e=[]){return console.warn("@deprecated selectAccess"),this.#e.send(fe.selectAccess,{value:e})}async selectCRM(e){return console.warn("@deprecated selectCRM"),this.#e.send(fe.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value})}}class Ya{#e;#t;constructor(e,t){this.#e=e,this.#t=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#t.send(fe.openApplication,e)}async closeSliderAppPage(){return this.#t.send(fe.closeApplication,{isSafely:!1})}#r(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const n=new URL(e);return n.searchParams.set("IFRAME","Y"),n.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#t.send(fe.openPath,{path:[this.#r(t),n.pathname,n.search].join("")}).then(i=>i?.result==="error"?i?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((s,o)=>{const l=window.open(e,"_blank");if(!l){o(new Error("Error open window"));return}let a=0;const u=1e3*60*5,c=window.setInterval(()=>{a=a+1,l.closed?(clearInterval(c),s({isOpenAtNewWindow:!0,isClose:!0})):a>u&&(clearInterval(c),s({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(i?.errorCode)):i?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}async showAppForm(e){return console.warn("@deprecated showAppForm"),this.#t.send(fe.showAppForm,{params:e,isSafely:!0})}}class Ka{#e="";#t={};constructor(){}initData(e){this.#e=e.PLACEMENT||"DEFAULT";const t=e.PLACEMENT_OPTIONS;return this.#t=Object.freeze(t),this}get title(){return this.#e}get isDefault(){return this.title==="DEFAULT"}get options(){return this.#t}get isSliderMode(){return this.options?.IFRAME==="Y"}}class Qa extends Gt{#e=!1;#t=!1;#r;#n;#i;#o;#s;#l;#c;#a;constructor(e){super(),this.#r=new Ha(e),this.#n=new Va(this.#r),this.#n.subscribe(),this.#i=new za(this.#r,this.#n),this.#o=new Ja(this.#n),this.#s=new Ga(this.#n),this.#l=new Za(this.#n),this.#c=new Ya(this.#r,this.#n),this.#a=new Ka,this._isInit=!1}setLogger(e){super.setLogger(e),this.#n.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#t}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#o}get auth(){return this._ensureInitialized(),this.#i}get slider(){return this._ensureInitialized(),this.#c}get placement(){return this._ensureInitialized(),this.#a}get options(){return this._ensureInitialized(),this.#s}get dialog(){return this._ensureInitialized(),this.#l}async init(){return this.#n.send(fe.getInitData,{}).then(e=>(this.getLogger().log("init data:",e),this.#r.initData(e),this.#i.initData(e),this.#a.initData(e),this.#s.initData(e),this.#e=e.INSTALL,this.#t=e.FIRST_RUN,this._http=new Wa(this.#r.getTargetOriginWithPath(),this.#i,this._getHttpOptions()),this._isInit=!0,this.#t?this.#n.send(fe.setInstall,{install:!0}):Promise.resolve()))}destroy(){this.#n.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#n.send(fe.setInstallFinish,{}):Promise.reject(new Error("Application was previously installed. You cannot call installFinish"))}getTargetOrigin(){return this._ensureInitialized(),this.#r.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#r.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#r.getAppSid()}getLang(){return this._ensureInitialized(),this.#r.getLang()}}class Oi extends Error{constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=new Error("for stack").stack}}class Zt{_b24;_logger=null;_data=null;constructor(e){this._b24=e}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}async initData(e){return this.getLogger().log(e),Promise.reject(new Error("Rewrite this function"))}}class jh extends Zt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}class Uh extends Zt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return ko[this.data.status]||"Unknown status"}}class Bh extends Zt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}class $h extends Zt{_data=null;async initData(e){this._data=e,this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}makeRestrictionManagerParams(){this.data?.license&&this.data.license.includes("ent")&&(this.getLogger().log(`LICENSE ${this.data.license} => up restriction manager params`,An),this._b24.getHttpClient().setRestrictionManagerParams(An))}}class Wh extends Zt{async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(console.error(t),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{(await this._b24.callBatchByChunk(e,!0)).getData().forEach(t=>{if(typeof t.LANG>"u")return;const n=t.CURRENCY,i=this.data.currencyList.get(n);if(!(typeof i>"u"))for(const[s,o]of Object.entries(t.LANG))switch(i.lang[s]={decimals:Number.parseInt(o.DECIMALS),decPoint:o.DEC_POINT,formatString:o.FORMAT_STRING,fullName:o.FULL_NAME,isHideZero:o.HIDE_ZERO==="Y",thousandsSep:o.THOUSANDS_SEP,thousandsVariant:o.THOUSANDS_VARIANT},i.lang[s].thousandsVariant){case"N":i.lang[s].thousandsSep="";break;case"D":i.lang[s].thousandsSep=".";break;case"C":i.lang[s].thousandsSep=",";break;case"S":i.lang[s].thousandsSep=" ";break;case"B":i.lang[s].thousandsSep=" ";break;default:x.isStringFilled(i.lang[s].thousandsSep)||(i.lang[s].thousandsSep=" ");break}})}catch(t){console.error(t)}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(e){this._data.currencyBase=e}get baseCurrency(){return this.data.currencyBase}setCurrencyList(e=[]){this.data.currencyList.clear();for(const t of e)this.data.currencyList.set(t.CURRENCY,{amount:Number.parseFloat(t.CURRENCY),amountCnt:Number.parseInt(t.AMOUNT_CNT),isBase:t.BASE==="Y",currencyCode:t.CURRENCY,dateUpdate:G.toDateTime(t.DATE_UPDATE),decimals:Number.parseInt(t.DECIMALS),decPoint:t.DEC_POINT,formatString:t.FORMAT_STRING,fullName:t.FULL_NAME,lid:t.LID,sort:Number.parseInt(t.SORT),thousandsSep:t?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Oi(e);let i=n.fullName;if(!(typeof t>"u")){const s=n.lang[t];x.isUndefined(s)||(i=s.fullName)}return i}getCurrencyLiteral(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Oi(e);let i=n.formatString;if(!(typeof t>"u")){const s=n.lang[t];x.isUndefined(s)||(i=s.formatString)}return i.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,n){const i=this.data.currencyList.get(t);if(typeof i>"u")throw new Oi(t);const s={formatString:i.formatString,decimals:i.decimals,decPoint:i.decPoint,thousandsSep:i.thousandsSep};x.isStringFilled(s.thousandsSep)||(s.thousandsSep="");const o=i.lang[n];return x.isUndefined(o)||(s.formatString=o.formatString,s.decimals=o.decimals,s.decPoint=o.decPoint,s.thousandsSep=o.thousandsSep),s.formatString.replaceAll("&#","&%").replace("#",G.numberFormat(e,s.decimals,s.decPoint,s.thousandsSep)).replaceAll("&%","&#")||""}}class Ti extends Zt{_data;_type;static getSupportTypes(){return[at.NotSet,at.JsonArray,at.JsonObject,at.FloatVal,at.IntegerVal,at.BoolYN,at.StringVal]}static prepareArrayList(e){return x.isArray(e)?e:x.isObject(e)?Object.values(e):[]}constructor(e,t){super(e),this._type=t,this._data=new Map}get data(){return this._data}reset(){this.data.clear()}async initData(e){if(this.reset(),x.isObject(e))for(const[t,n]of Object.entries(e))this.data.set(t,n)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n),!x.isArray(n)&&!x.isObject(n)&&(n=t)}catch(i){this.getLogger().error(i),n=t}return Ti.prepareArrayList(n)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n)}catch(i){this.getLogger().error(i),n=t}return x.isObject(n)||(n=t),n}getFloat(e,t=0){return this.data.has(e)?G.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?G.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?G.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?G.toBoolean(this.data.get(e)):t}getString(e,t=""){return this.data.has(e)?this.data.get(e).toString():t}getDate(e,t=null){if(!this.data.has(e))return t;try{const n=G.toDateTime(this.data.get(e).toString());return n.isValid?n:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(n){this.getLogger().warn(n,e)}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t){const n=[];return n.push({method:this.getMethodSave(),params:{options:e}}),x.isObject(t)&&n.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.callBatch(n,!0)}}class Xa{_logger=null;userId;siteId;constructor(e={}){this.userId=e.userId?G.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}set(e,t){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window.localStorage>"u")return t||null;const n=window.localStorage.getItem(this._getKey(e));return n===null?t||null:JSON.parse(n)}remove(e){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}return window.localStorage.removeItem(this._getKey(e))}_getKey(e){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${e}`}compareKey(e,t){return e===this._getKey(t)}}class qh extends Error{constructor(e){super(e),this.name="ErrorNotConnected"}}class Vh extends Error{constructor(e){super(e),this.name="ErrorTimeout"}}const Zr="2.0";class Hh{_logger=null;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._connector=e.connector,x.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,n=5){return new Promise((i,s)=>{const o=this.createRequest(e,t);this._connector.send(JSON.stringify(o))||s(new qh("websocket is not connected"));const l=setTimeout(()=>{this._rpcResponseAwaiters.delete(o.id),s(new Vh("no response"))},n*1e3);this._rpcResponseAwaiters.set(o.id,{resolve:i,reject:s,timeout:l})})}executeOutgoingRpcBatch(e){const t=[],n=[];return e.forEach(({method:i,params:s,id:o})=>{const l=this.createRequest(i,s,o);t.push(l),n.push(new Promise((a,u)=>this._rpcResponseAwaiters.set(l.id,{resolve:a,reject:u})))}),this._connector.send(JSON.stringify(t)),n}processRpcResponse(e){if("id"in e&&this._rpcResponseAwaiters.has(Number(e.id))){const t=this._rpcResponseAwaiters.get(Number(e.id));t&&("result"in e?t.resolve(e.result):"error"in e?t.reject(e?.error||"error"):t.reject("wrong response structure"),clearTimeout(t.timeout),this._rpcResponseAwaiters.delete(Number(e.id)));return}this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Received rpc response with unknown id`),e)}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(n){this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Could not decode json rpc message`),n);return}if(x.isArray(t))return this.executeIncomingRpcBatch(t);if(x.isJsonRpcRequest(t))return this.executeIncomingRpcCommand(t);if(x.isJsonRpcResponse(t))return this.processRpcResponse(t);this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: unknown rpc packet`),t)}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:Zr,error:Cn.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const n of e)if("jsonrpc"in n)if("method"in n){const i=this.executeIncomingRpcCommand(n);i&&(i.jsonrpc=Zr,i.id=n.id,t.push(i))}else this.processRpcResponse(n);else this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: unknown rpc command in batch`),n),t.push({jsonrpc:Zr,error:Cn.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,n){return n||(n=this.nextId()),{jsonrpc:Zr,method:e,params:t,id:n}}}class zh{_logger=null;_storage;_ttl=24*60*60;_callbacks;constructor(e={}){e=e||{},this._storage=e.storage||new Xa,this._callbacks={onWebSocketBlockChanged:x.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",xe.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(xe.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(xe.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage. Error: `),t),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(xe.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(xe.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage. Error: `),t),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(xe.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(xe.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${G.getDateForLog()}: LocalStorage error: `),t),!1}return!0}getTimestamp(){return Date.now()}}class Jh{_logger=null;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=Pe.build("NullLogger"),this._logger.setConfig({[M.desktop]:!1,[M.log]:!1,[M.info]:!1,[M.warn]:!1,[M.error]:!0,[M.trace]:!1})),this._logger}async getPublicIds(e){const t=new Date,n={},i=[];for(const s of e){const o=this._publicIds.get(s);o&&o.end>t?n[o.userId]=o:i.push(s)}return i.length===0?Promise.resolve(n):new Promise(s=>{this._restClient.callMethod(this._getPublicListMethod,{users:i}).then(o=>{const l=o.getData().result;this.setPublicIds(Object.values(l));for(const a of i){const u=this._publicIds.get(a);u&&(n[u.userId]=u)}s(n)}).catch(o=>(this.getLogger().error(o),s({})))})}setPublicIds(e){e.forEach(t=>{const n=Number(t.user_id);this._publicIds.set(n,{userId:n,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var Ai={exports:{}};/*!
|
|
10
10
|
* protobuf.js v6.8.6 (c) 2016, daniel wirtz
|
|
11
11
|
* compiled mon, 26 feb 2018 11:35:34 utc
|
|
12
12
|
* licensed under the bsd-3-clause license
|