szdl-utils-kit 0.2.23 → 0.2.25
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/index.js +2 -2
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1122,7 +1122,7 @@ class de {
|
|
|
1122
1122
|
let A = new X(BX24.callBatch), { entityList: e } = await A.batch({
|
|
1123
1123
|
entityList: { method: "entity.get" }
|
|
1124
1124
|
});
|
|
1125
|
-
if (e
|
|
1125
|
+
if (e && Array.isArray(e))
|
|
1126
1126
|
if (e.find((r) => r.ENTITY == o(this, W)))
|
|
1127
1127
|
d(this, Q, !0);
|
|
1128
1128
|
else {
|
|
@@ -1329,7 +1329,7 @@ class Ee {
|
|
|
1329
1329
|
data: { method: A, params: e, updateList: n }
|
|
1330
1330
|
});
|
|
1331
1331
|
return new Promise((a) => {
|
|
1332
|
-
e || (e = {}), BX24.callMethod(A, e,
|
|
1332
|
+
e || (e = {}), BX24.callMethod(A, e, (c) => {
|
|
1333
1333
|
let O = {};
|
|
1334
1334
|
if (c != null && c.answer)
|
|
1335
1335
|
for (let [u, i] of Object.entries(c.answer))
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
var ge=Object.defineProperty;var Ee=(g,T,M)=>T in g?ge(g,T,{enumerable:!0,configurable:!0,writable:!0,value:M}):g[T]=M;var C=(g,T,M)=>(Ee(g,typeof T!="symbol"?T+"":T,M),M),zt=(g,T,M)=>{if(!T.has(g))throw TypeError("Cannot "+M)};var o=(g,T,M)=>(zt(g,T,"read from private field"),M?M.call(g):T.get(g)),f=(g,T,M)=>{if(T.has(g))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(g):T.set(g,M)},y=(g,T,M,ht)=>(zt(g,T,"write to private field"),ht?ht.call(g,M):T.set(g,M),M);var _=(g,T,M)=>(zt(g,T,"access private method"),M);(function(g,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(g=typeof globalThis<"u"?globalThis:g||self,T(g["szdl-utils-kit"]={}))})(this,function(g){var q,ft,v,B,J,Q,$,tt,U,Z,Bt,et,F,At,st,at,xt,Nt,Kt,_t,qt,Ot,vt,yt,$t,dt,te,It,he,Ut,ae,gt,ee,Et,Ae,Tt,se,lt,Qt,Rt,ie,Gt,le,it,Dt,ct,Zt,St,re,rt,k,V,wt,nt,Lt,z,ut,Ct,ce,Mt,ne,Ft,ue,Pt,me,Wt,fe,Jt,Ne,kt,_e;"use strict";var T=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function M(G){return G&&G.__esModule&&Object.prototype.hasOwnProperty.call(G,"default")?G.default:G}var ht={exports:{}};(function(G,A){(function(e){Array.prototype.indexOf||(Array.prototype.indexOf=function(t,s){var h,c;for(h=s||0,c=this.length;h<c;h+=1)if(this[h]===t)return h;return-1});var n=this,r=function(t,s){for(var h=t.toString();h.length<s;)h="0"+h;return h},a=function(t,s){return s!==e?(t.year(s.year()||s.year),t.month(s.month()||s.month),t.day(s.day()||s.day),t.hours(s.hours()||s.hours),t.minutes(s.minutes()||s.minutes),t.seconds(s.seconds()||s.seconds),t.milliseconds(s.milliseconds()||s.milliseconds),t):e},l=function(t,s){var h,c="";return h=t.slice(s,s+1),h!==""&&!isNaN(Number(h))&&(c+="%H"),h=t.charAt(s+2),h!==""&&h===":"&&(c+=h),h=t.slice(s+3,s+4),h!==""&&!isNaN(Number(h))&&(c+="%M"),h=t.charAt(s+5),h!==""&&h===":"&&(c+=h),h=t.slice(s+6,s+7),h!==""&&!isNaN(Number(h))&&(c+="%S"),c},O=function(t,s){var h,c=[t.slice(s,s+1),t.charAt(s+2),t.slice(s+3,s+4),t.charAt(s+5),t.slice(s+6,s+9)],p;return!isNaN(Number(c[0]))&&!isNaN(Number(c[2]))&&!isNaN(Number(c[4]))?(c[1]==="."&&c[3]==="."?h="%d.%m.%Y":c[1]==="-"&&c[3]==="-"?h="%m-%d-%Y":c[1]==="/"&&c[3]==="/"&&(h="%m/%d/%Y"),h):(p=[t.slice(s,s+3),t.charAt(s+4),t.slice(s+5,s+6),t.charAt(s+7),t.slice(s+8,s+9)],!isNaN(Number(p[0]))&&!isNaN(Number(p[2]))&&!isNaN(Number(p[4]))?(p[1]==="-"&&p[3]==="-"&&(h="%Y-%m-%d"),h):"")},u=n.tempus,i,R,E=n.navigator||{},m="en",N={en:{JANUARY_SHORT:"Jan",FEBRUARY_SHORT:"Feb",MARCH_SHORT:"Mar",APRIL_SHORT:"Apr",MAY_SHORT:"May",JUNE_SHORT:"Jun",JULY_SHORT:"Jul",AUGUST_SHORT:"Aug",SEPTEMBER_SHORT:"Sep",OCTOBER_SHORT:"Oct",NOVEMBER_SHORT:"Nov",DECEMBER_SHORT:"Dec",JANUARY_LONG:"January",FEBRUARY_LONG:"February",MARCH_LONG:"March",APRIL_LONG:"April",MAY_LONG:"May",JUNE_LONG:"June",JULY_LONG:"July",AUGUST_LONG:"August",SEPTEMBER_LONG:"September",OCTOBER_LONG:"October",NOVEMBER_LONG:"November",DECEMBER_LONG:"December",SUNDAY_SHORT:"Sun",MONDAY_SHORT:"Mon",TUESDAY_SHORT:"Tue",WEDNESDAY_SHORT:"Wed",THURSDAY_SHORT:"Thu",FRIDAY_SHORT:"Fri",SATURDAY_SHORT:"Sat",SUNDAY_LONG:"Sunday",MONDAY_LONG:"Monday",TUESDAY_LONG:"Tuesday",WEDNESDAY_LONG:"Wednesday",THURSDAY_LONG:"Thursday",FRIDAY_LONG:"Friday",SATURDAY_LONG:"Saturday"},ru:{JANUARY_SHORT:"Янв",FEBRUARY_SHORT:"Фев",MARCH_SHORT:"Мар",APRIL_SHORT:"Апр",MAY_SHORT:"Май",JUNE_SHORT:"Июн",JULY_SHORT:"Июл",AUGUST_SHORT:"Авг",SEPTEMBER_SHORT:"Сен",OCTOBER_SHORT:"Окт",NOVEMBER_SHORT:"Ноя",DECEMBER_SHORT:"Дек",JANUARY_LONG:"Январь",FEBRUARY_LONG:"Февраль",MARCH_LONG:"Март",APRIL_LONG:"Апрель",MAY_LONG:"Май",JUNE_LONG:"Июнь",JULY_LONG:"Июль",AUGUST_LONG:"Август",SEPTEMBER_LONG:"Сентябрь",OCTOBER_LONG:"Октябрь",NOVEMBER_LONG:"Ноябрь",DECEMBER_LONG:"Декабрь",SUNDAY_SHORT:"Вс",MONDAY_SHORT:"Пн",TUESDAY_SHORT:"Вт",WEDNESDAY_SHORT:"Ср",THURSDAY_SHORT:"Чт",FRIDAY_SHORT:"Пт",SATURDAY_SHORT:"Сб",SUNDAY_LONG:"Воскресенье",MONDAY_LONG:"Понедельник",TUESDAY_LONG:"Вторник",WEDNESDAY_LONG:"Среда",THURSDAY_LONG:"Четверг",FRIDAY_LONG:"Пятница",SATURDAY_LONG:"Суббота"},ua:{JANUARY_SHORT:"Січ",FEBRUARY_SHORT:"Лют",MARCH_SHORT:"Берез",APRIL_SHORT:"Квіт",MAY_SHORT:"Трав",JUNE_SHORT:"Черв",JULY_SHORT:"Лип",AUGUST_SHORT:"Серп",SEPTEMBER_SHORT:"Верес",OCTOBER_SHORT:"Жовт",NOVEMBER_SHORT:"Листоп",DECEMBER_SHORT:"Груд",JANUARY_LONG:"Січень",FEBRUARY_LONG:"Лютий",MARCH_LONG:"Березень",APRIL_LONG:"Квітень",MAY_LONG:"Травень",JUNE_LONG:"Червень",JULY_LONG:"Липень",AUGUST_LONG:"Серпень",SEPTEMBER_LONG:"Вересень",OCTOBER_LONG:"Жовтень",NOVEMBER_LONG:"Листопад",DECEMBER_LONG:"Грудень",SUNDAY_SHORT:"Нд",MONDAY_SHORT:"Пн",TUESDAY_SHORT:"Вт",WEDNESDAY_SHORT:"Ср",THURSDAY_SHORT:"Чт",FRIDAY_SHORT:"Пт",SATURDAY_SHORT:"Сб",SUNDAY_LONG:"Неділя",MONDAY_LONG:"Понеділок",TUESDAY_LONG:"Вівторок",WEDNESDAY_LONG:"Середа",THURSDAY_LONG:"Четвер",FRIDAY_LONG:"П’ятниця",SATURDAY_LONG:"Субота"},de:{JANUARY_SHORT:"Jan",FEBRUARY_SHORT:"Feb",MARCH_SHORT:"März",APRIL_SHORT:"Apr",MAY_SHORT:"Mai",JUNE_SHORT:"Juni",JULY_SHORT:"Juli",AUGUST_SHORT:"Aug",SEPTEMBER_SHORT:"Sept",OCTOBER_SHORT:"Okt",NOVEMBER_SHORT:"Nov",DECEMBER_SHORT:"Dez",JANUARY_LONG:"Januar",FEBRUARY_LONG:"Februar",MARCH_LONG:"März",APRIL_LONG:"April",MAY_LONG:"Mai",JUNE_LONG:"Juni",JULY_LONG:"Juli",AUGUST_LONG:"August",SEPTEMBER_LONG:"September",OCTOBER_LONG:"Oktober",NOVEMBER_LONG:"November",DECEMBER_LONG:"Dezember",SUNDAY_SHORT:"So",MONDAY_SHORT:"Mo",TUESDAY_SHORT:"Di",WEDNESDAY_SHORT:"Mi",THURSDAY_SHORT:"Do",FRIDAY_SHORT:"Fr",SATURDAY_SHORT:"Sa",SUNDAY_LONG:"Sonntag",MONDAY_LONG:"Montag",TUESDAY_LONG:"Dienstag",WEDNESDAY_LONG:"Mittwoch",THURSDAY_LONG:"Donnerstag",FRIDAY_LONG:"Freitag",SATURDAY_LONG:"Samstag"}},P=function(){return[N[m].JANUARY_LONG,N[m].FEBRUARY_LONG,N[m].MARCH_LONG,N[m].APRIL_LONG,N[m].MAY_LONG,N[m].JUNE_LONG,N[m].JULY_LONG,N[m].AUGUST_LONG,N[m].SEPTEMBER_LONG,N[m].OCTOBER_LONG,N[m].NOVEMBER_LONG,N[m].DECEMBER_LONG]},pt=function(){return[N[m].JANUARY_SHORT,N[m].FEBRUARY_SHORT,N[m].MARCH_SHORT,N[m].APRIL_SHORT,N[m].MAY_SHORT,N[m].JUNE_SHORT,N[m].JULY_SHORT,N[m].AUGUST_SHORT,N[m].SEPTEMBER_SHORT,N[m].OCTOBER_SHORT,N[m].NOVEMBER_SHORT,N[m].DECEMBER_SHORT]},ot=function(){return[N[m].SUNDAY_LONG,N[m].MONDAY_LONG,N[m].TUESDAY_LONG,N[m].WEDNESDAY_LONG,N[m].THURSDAY_LONG,N[m].FRIDAY_LONG,N[m].SATURDAY_LONG]},x=function(){return[N[m].SUNDAY_SHORT,N[m].MONDAY_SHORT,N[m].TUESDAY_SHORT,N[m].WEDNESDAY_SHORT,N[m].THURSDAY_SHORT,N[m].FRIDAY_SHORT,N[m].SATURDAY_SHORT]},X,Xt,bt,Ht,de=function(t,s,h){var c;n.XMLHttpRequest?c=new XMLHttpRequest:c=new ActiveXObject("Microsoft.XMLHTTP"),c.onreadystatechange=function(){c.readyState===4&&(c.status===200?s&&(n.JSON===e?alert(`Please, include json2 into your project if you want use old browsers!
|
|
2
|
-
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`):s(JSON.parse(c.responseText))):h&&h(c))},c.open("GET",t,!1),c.send()},w={"%d":{format:function(t){return r(t.day()||i.MIN_DAY,2)},parse:function(t){var s=Number(t);return{day:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%m":{format:function(t){return r(t.month()||i.MIN_MONTH,2)},parse:function(t){var s=Number(t);return{month:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%Y":{format:function(t){return r(t.year()||i.MIN_YEAR,4)},parse:function(t){var s=Number(t);return{year:isNaN(s)?e:s}},minLength:4,maxLength:4,type:"number"},"%w":{format:function(t){return t.dayOfWeek()||i.MIN_DAY_OF_WEEK},parse:function(){return{}},minLength:1,maxLength:1,type:"number"},"%a":{format:function(t){var s=t.dayOfWeek();return Ht[s!==e?s:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%A":{format:function(t){var s=t.dayOfWeek();return bt[s!==e?s:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%b":{format:function(t){var s=i.options("monthFromZero")?t.month():t.month()-1;return Xt[s!==e?s:i.MIN_MONTH]},parse:function(t){var s=i.monthNames().indexOf(t)+(i.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%B":{format:function(t){var s=i.options("monthFromZero")?t.month():t.month()-1;return X[s!==e?s:i.MIN_MONTH]},parse:function(t){var s=i.monthNames(!0).indexOf(t)+(i.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%H":{format:function(t){return r(t.hours()||i.MIN_HOURS,2)},parse:function(t){var s=Number(t);return{hours:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%M":{format:function(t){return r(t.minutes()||i.MIN_MINUTES,2)},parse:function(t){var s=Number(t);return{minutes:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%S":{format:function(t){return r(t.seconds()||i.MIN_SECONDS,2)},parse:function(t){var s=Number(t);return{seconds:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%s":{format:function(t){return t.timestamp()},parse:function(t){return isNaN(Number(t))?{}:i(Number(t)).get()},minLength:1,maxLength:20,type:"number"},"%F":{format:function(t){return r(t.year()||i.MIN_YEAR,4)+"-"+r(t.month()||i.MIN_MONTH,2)+"-"+r(t.day()||i.MIN_DAY,2)},parse:function(t){var s=Number(t.slice(0,4)),h=Number(t.slice(5,7)),c=Number(t.slice(8,10));return{year:s,month:h,day:c}},minLength:10,maxLength:10,type:"string"},"%D":{format:function(t){return r(t.month()||i.MIN_MONTH,2)+"/"+r(t.day()||i.MIN_DAY,2)+"/"+r(t.year()||i.MIN_YEAR,4)},parse:function(t){var s=Number(t.slice(0,2)),h=Number(t.slice(3,5)),c=Number(t.slice(6,10));return{year:c,month:s,day:h}},minLength:10,maxLength:10,type:"string"}},jt={useMilliseconds:!1,monthFromZero:!1},S;S=function(t,s,h){return this._d=new Date,this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t!==e&&this.set(t,s,h),this},S.fn=S.prototype,S.fn.dayCount=function(){var t=this.month(),s=i.MAX_DAY_IN_MONTHS[t-(i.options("monthFromZero")?0:1)];return this.leapYear()&&t===(i.options("monthFromZero")?1:2)&&(s+=1),s},S.fn.year=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_YEAR&&Number(t)<=i.MAX_YEAR?(this._d.setFullYear(Number(t)),this._i.year=!1):this._i.year=Number(t):(this._d.setFullYear(i.MIN_YEAR),this._i.year=!1);else return this._i.year===!1?this._d.getFullYear():this._i.year;return this},S.fn.month=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MONTH&&Number(t)<=i.MAX_MONTH?(this._d.setMonth(i.options("monthFromZero")?Number(t):Number(t)-1),this._i.month=!1):this._i.month=Number(t):(this._d.setMonth(i.options("monthFromZero")?i.MIN_MONTH:i.MIN_MONTH-1),this._i.month=!1);else return this._i.month===!1?i.options("monthFromZero")?this._d.getMonth():this._d.getMonth()+1:this._i.month;return this},S.fn.day=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_DAY&&Number(t)<=this.dayCount()?(this._d.setDate(Number(t)),this._i.day=!1):this._i.day=Number(t):(this._d.setDate(i.MIN_DAY),this._i.day=!1);else return this._i.day===!1?this._d.getDate():this._i.day;return this},S.fn.hours=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_HOURS&&Number(t)<=i.MAX_HOURS?(this._d.setHours(Number(t)),this._i.hours=!1):this._i.hours=Number(t):(this._d.setHours(i.MIN_HOURS),this._i.hours=!1);else return this._i.hours===!1?this._d.getHours():this._i.hours;return this},S.fn.minutes=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MINUTES&&Number(t)<=i.MAX_MINUTES?(this._d.setMinutes(Number(t)),this._i.minutes=!1):this._i.minutes=Number(t):(this._d.setMinutes(i.MIN_MINUTES),this._i.minutes=!1);else return this._i.minutes===!1?this._d.getMinutes():this._i.minutes;return this},S.fn.seconds=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_SECONDS&&Number(t)<=i.MAX_SECONDS?(this._d.setSeconds(Number(t)),this._i.seconds=!1):this._i.seconds=Number(t):(this._d.setSeconds(i.MIN_SECONDS),this._i.seconds=!1);else return this._i.seconds===!1?this._d.getSeconds():this._i.seconds;return this},S.fn.milliseconds=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MILLISECONDS&&Number(t)<=i.MAX_MILLISECONDS?(this._d.setMilliseconds(Number(t)),this._i.milliseconds=!1):this._i.milliseconds=Number(t):(this._d.setMilliseconds(i.MIN_MILLISECONDS),this._i.milliseconds=!1);else return this._i.milliseconds===!1?this._d.getMilliseconds():this._i.milliseconds;return this},S.fn.week=function(){var t=new Date(this.year(),0,1),s=i(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc()*1e3;return Math.ceil(((s-t.getTime())/864e5+t.getDay()+1)/7)},S.fn.set=function(t,s,h){if(this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t===e)return this._d=new Date,this;if(t instanceof Date)return this._d=t,this;if(typeof t=="number")return this._d=new Date(t*(i.options("useMilliseconds")?1:1e3)),this;if(typeof t=="object"&&(t instanceof Array?(this.day(i.MIN_DAY),this.year(t[0]),this.month(t[1]),this.day(t[2]),this.hours(t[3]),this.minutes(t[4]),this.seconds(t[5]),this.milliseconds(t[6])):(this.day(i.MIN_DAY),this.year(t.year),this.month(t.month),this.day(t.day),this.hours(t.hours),this.minutes(t.minutes),this.seconds(t.seconds),this.milliseconds(t.milliseconds))),typeof t=="string"){var c,p=[],d,L,K=[],Y=0,I=0,b,W,H={},D;if(t===e)return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;for(s===e&&(s=i.detectFormat(t));Y<s.length;){if(s.charAt(Y)==="%"){if(L=s.charAt(Y)+s.charAt(Y+1),w[L]!==e){switch(b=0,W="",w[L].type){case"number":for(;b<w[L].maxLength&&I+b<t.length&&!isNaN(Number(t.charAt(I+b)));)W+=t.charAt(I+b),b+=1;break;case"word":for(;b<w[L].maxLength&&I+b<t.length&&/^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(I+b));)W+=t.charAt(I+b),b+=1;break;case"string":for(;b<w[L].maxLength&&I+b<t.length;)W+=t.charAt(I+b),b+=1;break}if(b<w[L].minLength)return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;p.push(L),K.push(W),b-=1,I+=b,Y+=1}}else if(t.charAt(I)!==s.charAt(Y))return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;Y+=1,I+=1}for(c in p)p.hasOwnProperty(c)&&w.hasOwnProperty(p[c])&&(D=w[p[c]].parse(K[c]),H={year:D.year!==e?D.year:H.year,month:D.month!==e?D.month:H.month,day:D.day!==e?D.day:H.day,hours:D.hours!==e?D.hours:H.hours,minutes:D.minutes!==e?D.minutes:H.minutes,seconds:D.seconds!==e?D.seconds:H.seconds});this.day(i.MIN_DAY),this.year(H.year),this.month(H.month),this.day(H.day),this.hours(H.hours),this.minutes(H.minutes),this.seconds(H.seconds),this.milliseconds(H.milliseconds)}return this},S.fn.leapYear=function(){var t=this.year();return t%4===0?t%100===0?t%400===0:!0:!1},S.fn.timestamp=function(t){return arguments.length!==0?(this._d=new Date(Number(t)*(i.options("useMilliseconds")?1:1e3)+this._d.getTimezoneOffset()*6e4),this):i.options("useMilliseconds")?this._d.getTime()-this._d.getTimezoneOffset()*6e4:Math.floor(this._d.getTime()/1e3)-this._d.getTimezoneOffset()*60},S.fn.utc=function(t){return arguments.length!==0?(this._d=new Date(Number(t)*(i.options("useMilliseconds")?1:1e3)),this):i.options("useMilliseconds")?this._d.getTime():Math.floor(this._d.getTime()/1e3)},S.fn.dayOfWeek=function(t){if(t==="long")return bt[this._d.getDay()];if(t==="short")return Ht[this._d.getDay()];if(t===e)return this._d.getDay();if(t===0||t==="Sunday")return this.calc({day:-this.dayOfWeek()});if(t===1||t==="Monday")return this.calc({day:(this.dayOfWeek()===0?-6:1)-this.dayOfWeek()});if(t===2||t==="Tuesday")return this.calc({day:(this.dayOfWeek()===0?-5:2)-this.dayOfWeek()});if(t===3||t==="Wednesday")return this.calc({day:(this.dayOfWeek()===0?-4:3)-this.dayOfWeek()});if(t===4||t==="Thursday")return this.calc({day:(this.dayOfWeek()===0?-3:4)-this.dayOfWeek()});if(t===5||t==="Friday")return this.calc({day:(this.dayOfWeek()===0?-2:5)-this.dayOfWeek()});if(t===6||t==="Saturday")return this.calc({day:(this.dayOfWeek()===0?-1:6)-this.dayOfWeek()})},S.fn.timezone=function(t){switch(t){case"hours":return Math.floor(this._d.getTimezoneOffset()/60);case"minutes":return this._d.getTimezoneOffset();default:return this._d.getTimezoneOffset()*60}},S.fn.get=function(t){switch(t){case"Date":return new Date(this.year(),this.month()-(i.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds());case"DateUTC":return new Date(Date.UTC(this.year(),this.month()-(i.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()));case"Array":return[this.year(),this.month(),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()];default:return{year:this.year(),month:this.month(),week:this.week(),day:this.day(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds(),utc:this.utc(),dayOfWeek:this.dayOfWeek(),dayOfWeekShort:this.dayOfWeek("short"),dayOfWeekLong:this.dayOfWeek("long"),timestamp:this.timestamp()}}},S.fn.format=function(t){for(var s=0,h="",c;s<t.length;)t.charAt(s)==="%"?(c=t.charAt(s)+t.charAt(s+1),w[c]!==e?(h+=w[c].format(this),s+=1):h+="%"):h+=t.charAt(s),s+=1;return h},S.fn.valid=function(){return this._i.year===!1&&this._i.month===!1&&this._i.day===!1&&this._i.hours===!1&&this._i.minutes===!1&&this._i.seconds===!1&&this._i.milliseconds===!1},S.fn.errors=function(){return this._i},S.fn.between=function(t,s){var h=this.timestamp(),c=t.timestamp();switch(s){case"year":return Math.floor((c-h)/31556952);case"month":return Math.floor((c-h)/2629746);case"day":return Math.floor((c-h)/86400);case"hours":return Math.floor((c-h)/3600);case"minutes":return Math.floor((c-h)/60);case"seconds":return c-h;default:return e}},S.fn.calc=function(t){return t.year!==e&&this._d.setFullYear(this._d.getFullYear()+t.year),t.month!==e&&this._d.setMonth(this._d.getMonth()+t.month),t.day!==e&&this._d.setDate(this._d.getDate()+t.day),t.hours!==e&&this._d.setHours(this._d.getHours()+t.hours),t.minutes!==e&&this._d.setMinutes(this._d.getMinutes()+t.minutes),t.seconds!==e&&this._d.setSeconds(this._d.getSeconds()+t.seconds),t.milliseconds!==e&&this._d.setMilliseconds(this._d.getMilliseconds()+t.milliseconds),this},i=function(t,s,h){return new S(t,s,h)},i.MIN_YEAR=1e3,i.MAX_YEAR=3e3,i.MIN_MONTH=1,i.MAX_MONTH=12,i.MIN_DAY=1,i.MAX_DAY_IN_MONTHS=[31,28,31,30,31,30,31,31,30,31,30,31],i.MIN_DAY_OF_WEEK=0,i.MAX_DAY_OF_WEEK=6,i.MIN_HOURS=0,i.MAX_HOURS=23,i.MIN_MINUTES=0,i.MAX_MINUTES=59,i.MIN_SECONDS=0,i.MAX_SECONDS=59,i.MIN_MILLISECONDS=0,i.MAX_MILLISECONDS=999,i.VERSION="0.2.18",i.options=function(t,s){if(t===e)return jt;if(jt.hasOwnProperty(t)){if(s===e)return jt[t];jt[t]=s,t==="monthFromZero"&&(i.MIN_MONTH=s?0:1,i.MAX_MONTH=s?11:12)}return e},i.noConflict=function(){return n.tempus=u,i},i.generate=function(t){var s,h,c,p,d,L,K,Y;if(typeof t.dateFrom!="number"&&(t.dateFrom instanceof S?s=t.dateFrom.utc():s=i(t.dateFrom,t.formatFrom).utc()),typeof t.dateTo!="number"&&(t.dateTo instanceof S?h=t.dateTo.utc():h=i(t.dateTo,t.formatTo!==e?t.formatTo:t.formatFrom).utc()),typeof t.period=="number"?d={year:0,month:0,day:0,hours:0,minutes:0,seconds:t.period}:typeof t.period=="string"?d={year:t.period==="year"?1:0,month:t.period==="month"?1:0,day:t.period==="day"?1:0,hours:t.period==="hours"?1:0,minutes:t.period==="minutes"?1:0,seconds:t.period==="seconds"?1:0}:typeof t.period=="object"&&(d={year:t.period.year!==e?t.period.year:0,month:t.period.month!==e?t.period.month:0,day:t.period.day!==e?t.period.day:0,hours:t.period.hours!==e?t.period.hours:0,minutes:t.period.minutes!==e?t.period.minutes:0,seconds:t.period.seconds!==e?t.period.seconds:0}),t.groupBy===e?L=t.asObject===!0?{}:[]:(L=[],L.push([]),K=i(s).get()[t.groupBy]),Y=function(W,H,D){return t.asObject===!0?t.format!==e?W[i(H).format(t.format)]={}:W[i(H).format("%F %H:%M:%S")]={}:t.format!==e?W.push(D?null:i(H).format(t.format)):W.push(D?null:i(H)),W},t.groupBy!==e&&t.fillNulls){var I={year:d.year?-d.year:e,month:d.month?-d.month:e,day:d.day?-d.day:e,hours:d.hours?-d.hours:e,minutes:d.minutes?-d.minutes:e,seconds:d.seconds?-d.seconds:e,milliseconds:d.milliseconds?-d.milliseconds:e};for(c=i(s).calc(I).utc();i(c).get()[t.groupBy]===K;)Y(L[L.length-1],c,!0),c=i(c).calc(I).utc();if(t.groupBy==="week"){var b=i(s).dayOfWeek();for(c=i(s).dayOfWeek(0).utc();L[0].length<b&&c<s;)Y(L[L.length-1],c,!0),c=i(c).calc(d).utc()}}for(;s<=h;)t.groupBy===e?Y(L,s):i(s).get()[t.groupBy]===K?Y(L[L.length-1],s):(L.push([]),Y(L[L.length-1],s),K=i(s).get()[t.groupBy]),s=i(s).calc(d).utc();if(t.groupBy!==e&&t.fillNulls)for(p=i(h).calc(d).utc();i(p).get()[t.groupBy]===K;)Y(L[L.length-1],p,!0),p=i(p).calc(d).utc();return L},i.monthNames=function(t){switch(t){case"long":return X;default:return Xt}},i.dayNames=function(t){switch(t){case"long":return bt;default:return Ht}},i.lang=function(t){if(t!==e)m=t,N[m]===e&&(m="en"),X=P(),Xt=pt(),bt=ot(),Ht=x();else return m;return e},i.availableLangs=function(){return Object.keys(N)},i.registerFormat=function(t,s,h,c,p,d){w[t]={format:s,parse:h,minLength:c,maxLength:p,type:d}},i.unregisterFormat=function(t){delete w[t]},i.detectFormat=function(t){var s,h,c;return s=O(t,0),s!==""&&(c=10),h=t.charAt(c),(h==="T"||h===" ")&&(s+=h,c+=1),s+=l(t,c),s},R={TempusDate:S},i.classes=function(t,s){if(s===e)return R[t];R[t]=s},i.loadTranslations=function(t){typeof t=="object"?N=t:typeof t=="string"&&de(t,function(s){N=s},function(s){})},m=(E.language||E.systemLanguage||E.userLanguage||"en").substr(0,2).toLowerCase(),N[m]===e&&(m="en"),X=P(),Xt=pt(),bt=ot(),Ht=x(),G.exports&&(A=G.exports=i),A.tempus=i}).call(T)})(ht,ht.exports);var Oe=ht.exports;const mt=M(Oe);class j{constructor(A,e={}){f(this,at);f(this,Nt);f(this,_t);f(this,Ot);f(this,yt);f(this,dt);f(this,It);f(this,Ut);f(this,gt);f(this,Et);f(this,Tt);f(this,lt);f(this,Rt);f(this,Gt);f(this,it);f(this,ct);f(this,St);f(this,q,null);f(this,ft,null);f(this,v,[]);f(this,B,{});f(this,J,50);f(this,Q,50);f(this,$,!0);f(this,tt,null);f(this,U,null);f(this,Z,null);f(this,Bt,100);f(this,et,"no");f(this,F,!1);f(this,At,!1);f(this,st,!1);C(this,"errors",{});C(this,"answerData",{});y(this,q,A),y(this,ft,e)}get serial(){return o(this,F)}get limitCommandSerial(){return o(this,Q)}set limitCommandSerial(A){if(A<10)throw new Error("limitCommandSerial не может быть меньше 10");A>=10&&A<50&&(y(this,J,A),y(this,Q,A)),y(this,Q,A)}setSerial(){y(this,F,!0),y(this,At,!0),y(this,st,!1)}setParallel(){y(this,F,!1),y(this,At,!1),y(this,st,!0)}stop(){y(this,$,!1)}async batch(A,e){o(this,Z)&&_(this,Nt,Kt).call(this),e&&y(this,tt,e),o(this,At)===!1&&y(this,F,!1),Object.keys(A).length>o(this,Q)&&y(this,F,!0),y(this,$,!0),y(this,v,[]),y(this,B,{}),this.errors={},this.answerData={};const n=_(this,Ot,vt).call(this,A);if(Object.keys(A).length<o(this,Q)){const r=n.map((a,l)=>_(this,yt,$t).call(this,a,n[l]));return Promise.allSettled(r).then(a=>{let l={};for(let O of a)O.status==="fulfilled"&&(l={...l,...O.value});return l})}else{let r={},a=0,l=1,O=Object.keys(A).length||1,u=i=>{a+=Object.keys(i).length,l=Math.round(a/O*100)};for(let[i,R]of Object.entries(n)){let E=await _(this,yt,$t).call(this,R,n[i],!0);u(R),e&&e({percent:l}),r={...r,...E}}return r}}async batchTotalCount(A,e){y(this,B,{}),this.errors={};let n=1,r=0,a=Object.keys(A).length||1,l=u=>{r+=Object.keys(u).length,n=Math.round(r/a*100)};e&&e({percent:n});const O=_(this,Ot,vt).call(this,A);if(o(this,st)){const u=O.map(i=>_(this,dt,te).call(this,i).then(R=>(l(i),e&&e({percent:n}),R)));return Promise.allSettled(u).then(i=>{let R={};for(let E of i)E.status==="fulfilled"&&(R={...R,...E.value});return R})}else{let u={};for(let i of O){let R=await _(this,dt,te).call(this,i);l(i),e&&e({percent:n}),u={...u,...R}}return u}}}q=new WeakMap,ft=new WeakMap,v=new WeakMap,B=new WeakMap,J=new WeakMap,Q=new WeakMap,$=new WeakMap,tt=new WeakMap,U=new WeakMap,Z=new WeakMap,Bt=new WeakMap,et=new WeakMap,F=new WeakMap,At=new WeakMap,st=new WeakMap,at=new WeakSet,xt=function(){let A=0;if(!o(this,U))return Math.round(A);let e=0,n=0;return Object.values(o(this,U)).forEach(r=>{const{total:a,count:l}=r;e+=a??0,n+=l??0}),e?A=n/e*100:A=100,{percent:Math.round(A),allCount:n,allTotal:e}},Nt=new WeakSet,Kt=function(){clearInterval(o(this,Z)),y(this,Z,""),y(this,U,""),y(this,tt,""),y(this,et,"no")},_t=new WeakSet,qt=function({key:A,value:e}){const n=_(this,it,Dt).call(this,e.data()),r=Array.isArray(n)?n.length:0,a=_(this,ct,Zt).call(this,e.total(),r);let l=1;n&&(l=r),o(this,tt)&&(o(this,U)||y(this,U,{}),o(this,U)[A]&&o(this,U)[A].count&&(l+=o(this,U)[A].count),o(this,U)[A]={total:a,count:l},o(this,Z)||y(this,Z,setInterval(()=>{const{percent:O,allCount:u,allTotal:i}=o(this,at,xt);(o(this,et)==="no"||o(this,et)<o(this,at,xt).percent)&&(o(this,tt).call(this,{data:o(this,U),percent:O,allCount:u,allTotal:i}),y(this,et,o(this,at,xt).percent)),O===100&&_(this,Nt,Kt).call(this)},o(this,Bt))))},Ot=new WeakSet,vt=function(A){const e=[],n=Object.entries(A);for(let r=0;r<n.length;r+=o(this,J)){const a=n.slice(r,r+o(this,J));e.push(Object.fromEntries(a))}return e},yt=new WeakSet,$t=function(A,e,n){return new Promise(r=>{const a=_(this,Rt,ie).call(this,e),l=[];let O=0,u=0;o(this,q).call(this,A,i=>{Object.entries(i).forEach(([R,E])=>{let m={};const N=E.error();if(N){let{query:{method:x},answer:X}=E;this.errors[R]={error:N,method:x},O+=1}if(E!=null&&E.answer&&Object.keys(E.answer).length){for(let[x,X]of Object.entries(E.answer))x!="result"&&X&&(m[x]=X);Object.keys(m).length&&(this.answerData[R]=m)}const P=_(this,it,Dt).call(this,E.data()),pt=Array.isArray(P)?P.length:0,ot=_(this,ct,Zt).call(this,E.total(),pt);if(Array.isArray(P)?o(this,B)[R]=P:typeof P=="object"&&P!==null&&Object.keys(P).length===0?o(this,B)[R]=[]:o(this,B)[R]=P,u+=ot,n||_(this,_t,qt).call(this,{key:R,value:E}),ot>o(this,J)&&ot>pt){const x=Math.ceil(ot/o(this,J))-1,X=Array.from({length:x});l.push([R,a[R],X])}}),u>5e3&&o(this,At)===!1&&o(this,st)===!1&&y(this,F,!0),O>0&&_(this,St,re).call(this),l.length?(_(this,It,he).call(this,l),_(this,Ut,ae).call(this).then(()=>r(_(this,lt,Qt).call(this)))):r(_(this,lt,Qt).call(this))})})},dt=new WeakSet,te=function(A){return new Promise(e=>{const n=_(this,Rt,ie).call(this,A);let r=0;o(this,q).call(this,n,a=>{Object.entries(a).forEach(([l,O])=>{const u=O.error();u&&(this.errors[l]=u,r+=1);const i=_(this,it,Dt).call(this,O.data()),R=Array.isArray(i)?i.length:0,E=_(this,ct,Zt).call(this,O.total(),R);o(this,B)[l]=E}),r>0&&_(this,St,re).call(this),e(_(this,lt,Qt).call(this))})})},It=new WeakSet,he=function(A){let e=[];A.forEach(([n,r,a])=>{a.forEach((l,O)=>{const u=O+1,i=o(this,J)*u,E=[[n,u].join("_"),_(this,Gt,le).call(this,r,i)];e.length===o(this,J)?(o(this,v).push(e),e=[E]):e.push(E)})}),e.length&&o(this,v).push(e)},Ut=new WeakSet,ae=function(){const A=[],e=[],n=r=>{Object.entries(r).forEach(([a,l])=>{const[O]=a.split("_"),u=_(this,it,Dt).call(this,l.data());Array.isArray(u)&&o(this,B)[O].push(...u),_(this,_t,qt).call(this,{key:O,value:l})})};return o(this,v).forEach((r,a)=>{const l=Object.fromEntries(r),O=()=>new Promise(u=>o(this,q).call(this,l,i=>{o(this,F)?n(i):e[a]=i,u()}));A.push(O)}),o(this,F)?_(this,Et,Ae).call(this,A):_(this,Tt,se).call(this,A).then(()=>{e.forEach(n)})},gt=new WeakSet,ee=function(){return new Promise(A=>setTimeout(A,500))},Et=new WeakSet,Ae=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return Promise.allSettled([e(),_(this,gt,ee).call(this)]).then(()=>o(this,$)?_(this,Et,Ae).call(this,A):Promise.resolve())},Tt=new WeakSet,se=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return _(this,gt,ee).call(this).then(()=>e()).then(()=>o(this,$)?_(this,Tt,se).call(this,A):Promise.resolve())},lt=new WeakSet,Qt=function(){return Object.entries(o(this,ft)).forEach(([A,e])=>{o(this,B)[A]&&(o(this,B)[A]=e(o(this,B)[A]))}),o(this,B)},Rt=new WeakSet,ie=function(A){return Object.entries(A).reduce((e,[n,r])=>{if(Array.isArray(r)){const[a,l={}]=r;e[n]=[a,l]}else{const{method:a,params:l={}}=r;e[n]=[a,l]}return e},{})},Gt=new WeakSet,le=function(A,e){const[n,r]=A;return[n,{start:e,...r}]},it=new WeakSet,Dt=function(A){return((A==null?void 0:A.items)||(A==null?void 0:A.documents))??A},ct=new WeakSet,Zt=function(A,e){return A!==A&&(A=0),A===0&&e===0?0:A||e},St=new WeakSet,re=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(this.errors).forEach(([A,e])=>{console.info(`[${A}]`,e)}),console.groupEnd()};class Vt{constructor(){f(this,rt,{})}get hash(){return this.createHash(8)}createHash(A){let e="abcdefghijklmnopqrstuvwxyz0123456789",n="";A=A||6;for(let r=0;r<A;r++)n+=e.charAt(Math.floor(Math.random()*e.length));return n}actionFilter({keyTimer:A,duration:e=10,action:n}){o(this,rt)[A]&&(clearTimeout(o(this,rt)[A]),o(this,rt)[A]=null),n&&(o(this,rt)[A]=setTimeout(()=>{n()},e))}async noSleep(){let A=document.createElement("video");A.classList.add("no-sleep"),A.addEventListener("loadeddata",()=>{A.style.position="fixed",A.style.left="-9999px",document.querySelector("body").append(A),A.play()}),A.addEventListener("ended",()=>{this.actionFilter({keyTimer:"no-sleep",duration:5e3,action:()=>A.play()})}),A.src="data:video/mp4;base64,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"}downloadFileJson(A,e){let n=new Blob([JSON.stringify(A)],{type:"application/json"}),r=URL.createObjectURL(n),a=document.createElement("a");a.style.display="none",a.href=r,a.download=`${e}.json`,document.body.appendChild(a),a.click(),setTimeout(()=>{document.body.removeChild(a),URL.revokeObjectURL(r)},200)}}rt=new WeakMap;const Yt=new Vt;class oe{constructor(){f(this,Ct);f(this,Mt);f(this,Ft);f(this,Pt);f(this,Wt);f(this,k,"logger");f(this,V,!1);f(this,wt,2e3);f(this,nt,new Map);f(this,Lt,{});f(this,z,null);f(this,ut,!1);C(this,"periodClear",3);_(this,Ct,ce).call(this)}async init(){let A=new j(BX24.callBatch),{entityList:e}=await A.batch({entityList:{method:"entity.get"}});if(e!=null&&e.length)if(e.find(r=>r.ENTITY==o(this,k)))y(this,V,!0);else{let{entityAdd:r}=await A.batch({entityAdd:{method:"entity.add",params:{ENTITY:o(this,k),NAME:o(this,k),ACCESS:{AU:"X"}}}});r&&y(this,V,!0)}return _(this,Pt,me).call(this),o(this,V)}start({type:A,data:e}){if(!o(this,V)){_(this,Mt,ne).call(this,"entity");return}const n=Yt.hash;return o(this,nt).set(n,{type:A,data:e,userInfo:o(this,Lt),errorList:[],status:"",answer:null,date:new Date().getTime()}),n}stop({key:A,errorList:e,status:n,answer:r}){if(!o(this,V)){_(this,Mt,ne).call(this,"entity");return}let a=o(this,nt).get(A);e&&(a.errorList=e),n&&(a.status=n),r&&(a.answer=r),Yt.actionFilter({keyTimer:"add.entity.items",duration:o(this,wt),action:async()=>{var l;await _(this,Ft,ue).call(this),(l=a==null?void 0:a.data)!=null&&l.updateList&&y(this,ut,!0)}})}async getEntityList(A){var r;if((r=o(this,z))!=null&&r.length&&!o(this,ut))return o(this,z);let e=new j(BX24.callBatch),{entityList:n}=await e.batch({entityList:{method:"entity.item.get",params:{ENTITY:o(this,k),SORT:{ID:"DESC"}}}},A);return n=n.map(a=>{const{ID:l,DATE_CREATE:O,DETAIL_TEXT:u}=a;return{...JSON.parse(u),id:l,dateCreate:O}}),y(this,ut,!1),n}async downAllEntityJson(){let A=await this.getEntityList(),e=mt().format("%Y-%m-%d");Yt.downloadFileJson(A,`sdklogger-entity-data__${e}`)}}k=new WeakMap,V=new WeakMap,wt=new WeakMap,nt=new WeakMap,Lt=new WeakMap,z=new WeakMap,ut=new WeakMap,Ct=new WeakSet,ce=async function(){const A=new j(BX24.callBatch),e=BX24.isAdmin(),{curUser:n}=await A.batch({curUser:{method:"user.current"}});y(this,Lt,{isAdmin:e,curUser:n})},Mt=new WeakSet,ne=function(A){A=="entity"&&Yt.actionFilter({keyTimer:"error.logger.entity",duration:500,action:()=>{console.error("Хранилище для логгера не инициализировано")}})},Ft=new WeakSet,ue=async function(){let A={},e=new j(BX24.callBatch);for(let[n,r]of o(this,nt).entries())r.status&&(A[n]={method:"entity.item.add",params:{ENTITY:o(this,k),NAME:o(this,k),DETAIL_TEXT:JSON.stringify(r)}});if(Object.keys(A).length){let n=await e.batch(A),{errors:r}=e;for(let[a,l]of Object.entries({...n,...r}))o(this,nt).delete(a);return!0}},Pt=new WeakSet,me=async function(){let A=new j(BX24.callBatch),{serverTime:e}=await A.batch({serverTime:{method:"server.time"}});o(this,z)||y(this,z,await this.getEntityList());let n=o(this,z).filter(r=>{let{dateCreate:a}=r;return mt(new Date(a)).between(mt(new Date(e)),"month")>=this.periodClear});_(this,Wt,fe).call(this,n)},Wt=new WeakSet,fe=async function(A){let e=new j(BX24.callBatch),n=A.map(r=>{let{id:a}=r;return{method:"entity.item.delete",params:{ENTITY:o(this,k),ID:a}}});return await e.batch(n)};class ye{constructor(A){f(this,Jt);f(this,kt);C(this,"domain","");C(this,"isAdmin",!1);C(this,"appInfo",null);C(this,"appConst",null);C(this,"userInfo",null);C(this,"placeData",null);C(this,"placeInfo",null);C(this,"logger",new oe);this.appConst=A}init(){return new Promise(A=>{let e=setInterval(()=>{window.BX24&&BX24.init(async()=>{console.info("init BX24"),clearInterval(e),this.domain=BX24.getDomain(),this.isAdmin=BX24.isAdmin(),this.placeInfo=BX24.placement.info(),await this.logger.init();const[n,r]=await Promise.all([_(this,Jt,Ne).call(this),_(this,kt,_e).call(this)]);this.appInfo=n,this.userInfo=r,new Vt().noSleep(),A(!0)})},100)})}userOption(A,e){return e?BX24.userOption.set(A,e):BX24.userOption.get(A)}call({method:A,params:e,updateList:n}){let r=this.logger.start({type:"call",data:{method:A,params:e,updateList:n}});return new Promise(a=>{e||(e={}),BX24.callMethod(A,e,function(l){let O={};if(l!=null&&l.answer)for(let[u,i]of Object.entries(l.answer))u!="result"&&i&&(O[u]=i);if(l.error()){let u=l.error();console.error(u),this.logger.stop({answer:O,key:r,status:"fail",errorList:[u.toSting()]}),a(!1)}else{let u=l.data();u!=null&&u.items&&(u=u.items),this.logger.stop({answer:O,key:r,status:"success"}),a(u)}})})}async batch(A,e,{updateList:n,errorCall:r,limitCommandSerial:a}={}){let l=new j(BX24.callBatch),O=this.logger.start({type:"batch",data:{commandList:A,updateList:n}});a&&(l.limitCommandSerial=a);try{let u=await l.batch(A,e);if(Object.keys(l.errors).length){let i=Object.entries(l.errors).map(([R,E])=>{var m;return{key:R,error:`${E==null?void 0:E.method} ${(m=E==null?void 0:E.error)==null?void 0:m.toString()}`.trim()}});r&&r(l.errors),this.logger.stop({key:O,status:"fail",errorList:i,answer:l.answerData})}else this.logger.stop({key:O,status:"success",answer:l.answerData});return u}catch(u){let i=u==null?void 0:u.toString();return this.logger.stop({key:O,status:"fail-runtime",errorList:[i],answer:l.answerData}),console.error(u),!1}}async batchTotalCount(A,e){let n=new j(BX24.callBatch),r=this.logger.start({type:"batch",data:{commandList:A}});try{let a=await n.batchTotalCount(A,e);if(Object.keys(n.errors).length){let l=Object.entries(n.errors).map(([O,u])=>({key:O,error:u.toSting()}));this.logger.stop({key:r,status:"fail",errorList:l})}else this.logger.stop({key:r,status:"success"});return a}catch(a){return this.logger.stop({key:r,status:"fail",errorList:[a.toSting()]}),console.error(a),!1}}getPlacement(){return this.call({method:"placement.get"}).then(A=>(this.placeData||(this.placeData=A),A))}async placementBind(A){this.placeData||(this.placeData=await this.getPlacement());const{appName:e,pathApp:n}=this.appConst,r=this.placeData.map(l=>l.placement);let a=this.placeData.find(l=>l.placement==A);r.includes(A)?a.handler!=n&&(window.placementUnBind||(window.placementUnBind={}),window.placementUnBind[A]||this.placementUnBind(a).then(()=>{window.placementUnBind[A]||(window.placementUnBind[A]=!0,this.placementBind(A))})):this.call({method:"placement.bind",params:{PLACEMENT:A,HANDLER:n,LANG_ALL:{ru:{TITLE:e}}}}).then(l=>{l?console.info("Приложение успешно встроено в",A):console.warn("Приложение не может быть встроено в",A)})}placementUnBind(A){const{pathApp:e,appName:n}=this.appConst;return this.call({method:"placement.unbind",params:{PLACEMENT:A,HANDLER:e,LANG_ALL:{ru:{TITLE:n}}}}).then(r=>(console.log("Встройка отвязана",A),r))}getBotList(){return this.call({method:"imbot.bot.list",params:{}}).then(A=>{let e=Object.values(A);return console.log("chat-bot list:",e),e})}regBot({code:A,type:e,name:n}){const{appName:r,pathApp:a,chatBotLogo:l}=this.appConst,O=this.appInfo.ID;return this.call({method:"imbot.register",params:{CODE:A??this.appInfo.CODE,TYPE:e??"O",EVENT_HANDLER:a,OPENLINE:"Y",CLIENT_ID:"",PROPERTIES:{NAME:`${n??r} - бот #${O}`,LAST_NAME:"",COLOR:"GREEN",EMAIL:"",PERSONAL_BIRTHDAY:mt().format("%Y-%m-%d"),WORK_POSITION:"Почтальон",PERSONAL_WWW:"",PERSONAL_GENDER:"M",PERSONAL_PHOTO:l??""}}}).then(u=>(console.log("Чат-бот добавлен",u),u))}unRegBot(A){return this.call({method:"imbot.unregister",params:{BOT_ID:A}}).then(e=>(console.log("чат-бот удален",e),e))}getLoggerList(A){return this.logger.getEntityList(A)}}Jt=new WeakSet,Ne=function(){return this.call({method:"app.info"})},kt=new WeakSet,_e=function(){return this.call({method:"user.current"})},g.Batch=j,g.BxBoot=ye,g.BxHelper=Vt,g.BxLogger=oe,g.tempus=mt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`):s(JSON.parse(c.responseText))):h&&h(c))},c.open("GET",t,!1),c.send()},w={"%d":{format:function(t){return r(t.day()||i.MIN_DAY,2)},parse:function(t){var s=Number(t);return{day:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%m":{format:function(t){return r(t.month()||i.MIN_MONTH,2)},parse:function(t){var s=Number(t);return{month:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%Y":{format:function(t){return r(t.year()||i.MIN_YEAR,4)},parse:function(t){var s=Number(t);return{year:isNaN(s)?e:s}},minLength:4,maxLength:4,type:"number"},"%w":{format:function(t){return t.dayOfWeek()||i.MIN_DAY_OF_WEEK},parse:function(){return{}},minLength:1,maxLength:1,type:"number"},"%a":{format:function(t){var s=t.dayOfWeek();return Ht[s!==e?s:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%A":{format:function(t){var s=t.dayOfWeek();return bt[s!==e?s:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%b":{format:function(t){var s=i.options("monthFromZero")?t.month():t.month()-1;return Xt[s!==e?s:i.MIN_MONTH]},parse:function(t){var s=i.monthNames().indexOf(t)+(i.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%B":{format:function(t){var s=i.options("monthFromZero")?t.month():t.month()-1;return X[s!==e?s:i.MIN_MONTH]},parse:function(t){var s=i.monthNames(!0).indexOf(t)+(i.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%H":{format:function(t){return r(t.hours()||i.MIN_HOURS,2)},parse:function(t){var s=Number(t);return{hours:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%M":{format:function(t){return r(t.minutes()||i.MIN_MINUTES,2)},parse:function(t){var s=Number(t);return{minutes:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%S":{format:function(t){return r(t.seconds()||i.MIN_SECONDS,2)},parse:function(t){var s=Number(t);return{seconds:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%s":{format:function(t){return t.timestamp()},parse:function(t){return isNaN(Number(t))?{}:i(Number(t)).get()},minLength:1,maxLength:20,type:"number"},"%F":{format:function(t){return r(t.year()||i.MIN_YEAR,4)+"-"+r(t.month()||i.MIN_MONTH,2)+"-"+r(t.day()||i.MIN_DAY,2)},parse:function(t){var s=Number(t.slice(0,4)),h=Number(t.slice(5,7)),c=Number(t.slice(8,10));return{year:s,month:h,day:c}},minLength:10,maxLength:10,type:"string"},"%D":{format:function(t){return r(t.month()||i.MIN_MONTH,2)+"/"+r(t.day()||i.MIN_DAY,2)+"/"+r(t.year()||i.MIN_YEAR,4)},parse:function(t){var s=Number(t.slice(0,2)),h=Number(t.slice(3,5)),c=Number(t.slice(6,10));return{year:c,month:s,day:h}},minLength:10,maxLength:10,type:"string"}},jt={useMilliseconds:!1,monthFromZero:!1},S;S=function(t,s,h){return this._d=new Date,this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t!==e&&this.set(t,s,h),this},S.fn=S.prototype,S.fn.dayCount=function(){var t=this.month(),s=i.MAX_DAY_IN_MONTHS[t-(i.options("monthFromZero")?0:1)];return this.leapYear()&&t===(i.options("monthFromZero")?1:2)&&(s+=1),s},S.fn.year=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_YEAR&&Number(t)<=i.MAX_YEAR?(this._d.setFullYear(Number(t)),this._i.year=!1):this._i.year=Number(t):(this._d.setFullYear(i.MIN_YEAR),this._i.year=!1);else return this._i.year===!1?this._d.getFullYear():this._i.year;return this},S.fn.month=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MONTH&&Number(t)<=i.MAX_MONTH?(this._d.setMonth(i.options("monthFromZero")?Number(t):Number(t)-1),this._i.month=!1):this._i.month=Number(t):(this._d.setMonth(i.options("monthFromZero")?i.MIN_MONTH:i.MIN_MONTH-1),this._i.month=!1);else return this._i.month===!1?i.options("monthFromZero")?this._d.getMonth():this._d.getMonth()+1:this._i.month;return this},S.fn.day=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_DAY&&Number(t)<=this.dayCount()?(this._d.setDate(Number(t)),this._i.day=!1):this._i.day=Number(t):(this._d.setDate(i.MIN_DAY),this._i.day=!1);else return this._i.day===!1?this._d.getDate():this._i.day;return this},S.fn.hours=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_HOURS&&Number(t)<=i.MAX_HOURS?(this._d.setHours(Number(t)),this._i.hours=!1):this._i.hours=Number(t):(this._d.setHours(i.MIN_HOURS),this._i.hours=!1);else return this._i.hours===!1?this._d.getHours():this._i.hours;return this},S.fn.minutes=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MINUTES&&Number(t)<=i.MAX_MINUTES?(this._d.setMinutes(Number(t)),this._i.minutes=!1):this._i.minutes=Number(t):(this._d.setMinutes(i.MIN_MINUTES),this._i.minutes=!1);else return this._i.minutes===!1?this._d.getMinutes():this._i.minutes;return this},S.fn.seconds=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_SECONDS&&Number(t)<=i.MAX_SECONDS?(this._d.setSeconds(Number(t)),this._i.seconds=!1):this._i.seconds=Number(t):(this._d.setSeconds(i.MIN_SECONDS),this._i.seconds=!1);else return this._i.seconds===!1?this._d.getSeconds():this._i.seconds;return this},S.fn.milliseconds=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=i.MIN_MILLISECONDS&&Number(t)<=i.MAX_MILLISECONDS?(this._d.setMilliseconds(Number(t)),this._i.milliseconds=!1):this._i.milliseconds=Number(t):(this._d.setMilliseconds(i.MIN_MILLISECONDS),this._i.milliseconds=!1);else return this._i.milliseconds===!1?this._d.getMilliseconds():this._i.milliseconds;return this},S.fn.week=function(){var t=new Date(this.year(),0,1),s=i(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc()*1e3;return Math.ceil(((s-t.getTime())/864e5+t.getDay()+1)/7)},S.fn.set=function(t,s,h){if(this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t===e)return this._d=new Date,this;if(t instanceof Date)return this._d=t,this;if(typeof t=="number")return this._d=new Date(t*(i.options("useMilliseconds")?1:1e3)),this;if(typeof t=="object"&&(t instanceof Array?(this.day(i.MIN_DAY),this.year(t[0]),this.month(t[1]),this.day(t[2]),this.hours(t[3]),this.minutes(t[4]),this.seconds(t[5]),this.milliseconds(t[6])):(this.day(i.MIN_DAY),this.year(t.year),this.month(t.month),this.day(t.day),this.hours(t.hours),this.minutes(t.minutes),this.seconds(t.seconds),this.milliseconds(t.milliseconds))),typeof t=="string"){var c,p=[],d,L,K=[],Y=0,I=0,b,W,H={},D;if(t===e)return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;for(s===e&&(s=i.detectFormat(t));Y<s.length;){if(s.charAt(Y)==="%"){if(L=s.charAt(Y)+s.charAt(Y+1),w[L]!==e){switch(b=0,W="",w[L].type){case"number":for(;b<w[L].maxLength&&I+b<t.length&&!isNaN(Number(t.charAt(I+b)));)W+=t.charAt(I+b),b+=1;break;case"word":for(;b<w[L].maxLength&&I+b<t.length&&/^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(I+b));)W+=t.charAt(I+b),b+=1;break;case"string":for(;b<w[L].maxLength&&I+b<t.length;)W+=t.charAt(I+b),b+=1;break}if(b<w[L].minLength)return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;p.push(L),K.push(W),b-=1,I+=b,Y+=1}}else if(t.charAt(I)!==s.charAt(Y))return d=a(this,h),d===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),d;Y+=1,I+=1}for(c in p)p.hasOwnProperty(c)&&w.hasOwnProperty(p[c])&&(D=w[p[c]].parse(K[c]),H={year:D.year!==e?D.year:H.year,month:D.month!==e?D.month:H.month,day:D.day!==e?D.day:H.day,hours:D.hours!==e?D.hours:H.hours,minutes:D.minutes!==e?D.minutes:H.minutes,seconds:D.seconds!==e?D.seconds:H.seconds});this.day(i.MIN_DAY),this.year(H.year),this.month(H.month),this.day(H.day),this.hours(H.hours),this.minutes(H.minutes),this.seconds(H.seconds),this.milliseconds(H.milliseconds)}return this},S.fn.leapYear=function(){var t=this.year();return t%4===0?t%100===0?t%400===0:!0:!1},S.fn.timestamp=function(t){return arguments.length!==0?(this._d=new Date(Number(t)*(i.options("useMilliseconds")?1:1e3)+this._d.getTimezoneOffset()*6e4),this):i.options("useMilliseconds")?this._d.getTime()-this._d.getTimezoneOffset()*6e4:Math.floor(this._d.getTime()/1e3)-this._d.getTimezoneOffset()*60},S.fn.utc=function(t){return arguments.length!==0?(this._d=new Date(Number(t)*(i.options("useMilliseconds")?1:1e3)),this):i.options("useMilliseconds")?this._d.getTime():Math.floor(this._d.getTime()/1e3)},S.fn.dayOfWeek=function(t){if(t==="long")return bt[this._d.getDay()];if(t==="short")return Ht[this._d.getDay()];if(t===e)return this._d.getDay();if(t===0||t==="Sunday")return this.calc({day:-this.dayOfWeek()});if(t===1||t==="Monday")return this.calc({day:(this.dayOfWeek()===0?-6:1)-this.dayOfWeek()});if(t===2||t==="Tuesday")return this.calc({day:(this.dayOfWeek()===0?-5:2)-this.dayOfWeek()});if(t===3||t==="Wednesday")return this.calc({day:(this.dayOfWeek()===0?-4:3)-this.dayOfWeek()});if(t===4||t==="Thursday")return this.calc({day:(this.dayOfWeek()===0?-3:4)-this.dayOfWeek()});if(t===5||t==="Friday")return this.calc({day:(this.dayOfWeek()===0?-2:5)-this.dayOfWeek()});if(t===6||t==="Saturday")return this.calc({day:(this.dayOfWeek()===0?-1:6)-this.dayOfWeek()})},S.fn.timezone=function(t){switch(t){case"hours":return Math.floor(this._d.getTimezoneOffset()/60);case"minutes":return this._d.getTimezoneOffset();default:return this._d.getTimezoneOffset()*60}},S.fn.get=function(t){switch(t){case"Date":return new Date(this.year(),this.month()-(i.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds());case"DateUTC":return new Date(Date.UTC(this.year(),this.month()-(i.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()));case"Array":return[this.year(),this.month(),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()];default:return{year:this.year(),month:this.month(),week:this.week(),day:this.day(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds(),utc:this.utc(),dayOfWeek:this.dayOfWeek(),dayOfWeekShort:this.dayOfWeek("short"),dayOfWeekLong:this.dayOfWeek("long"),timestamp:this.timestamp()}}},S.fn.format=function(t){for(var s=0,h="",c;s<t.length;)t.charAt(s)==="%"?(c=t.charAt(s)+t.charAt(s+1),w[c]!==e?(h+=w[c].format(this),s+=1):h+="%"):h+=t.charAt(s),s+=1;return h},S.fn.valid=function(){return this._i.year===!1&&this._i.month===!1&&this._i.day===!1&&this._i.hours===!1&&this._i.minutes===!1&&this._i.seconds===!1&&this._i.milliseconds===!1},S.fn.errors=function(){return this._i},S.fn.between=function(t,s){var h=this.timestamp(),c=t.timestamp();switch(s){case"year":return Math.floor((c-h)/31556952);case"month":return Math.floor((c-h)/2629746);case"day":return Math.floor((c-h)/86400);case"hours":return Math.floor((c-h)/3600);case"minutes":return Math.floor((c-h)/60);case"seconds":return c-h;default:return e}},S.fn.calc=function(t){return t.year!==e&&this._d.setFullYear(this._d.getFullYear()+t.year),t.month!==e&&this._d.setMonth(this._d.getMonth()+t.month),t.day!==e&&this._d.setDate(this._d.getDate()+t.day),t.hours!==e&&this._d.setHours(this._d.getHours()+t.hours),t.minutes!==e&&this._d.setMinutes(this._d.getMinutes()+t.minutes),t.seconds!==e&&this._d.setSeconds(this._d.getSeconds()+t.seconds),t.milliseconds!==e&&this._d.setMilliseconds(this._d.getMilliseconds()+t.milliseconds),this},i=function(t,s,h){return new S(t,s,h)},i.MIN_YEAR=1e3,i.MAX_YEAR=3e3,i.MIN_MONTH=1,i.MAX_MONTH=12,i.MIN_DAY=1,i.MAX_DAY_IN_MONTHS=[31,28,31,30,31,30,31,31,30,31,30,31],i.MIN_DAY_OF_WEEK=0,i.MAX_DAY_OF_WEEK=6,i.MIN_HOURS=0,i.MAX_HOURS=23,i.MIN_MINUTES=0,i.MAX_MINUTES=59,i.MIN_SECONDS=0,i.MAX_SECONDS=59,i.MIN_MILLISECONDS=0,i.MAX_MILLISECONDS=999,i.VERSION="0.2.18",i.options=function(t,s){if(t===e)return jt;if(jt.hasOwnProperty(t)){if(s===e)return jt[t];jt[t]=s,t==="monthFromZero"&&(i.MIN_MONTH=s?0:1,i.MAX_MONTH=s?11:12)}return e},i.noConflict=function(){return n.tempus=u,i},i.generate=function(t){var s,h,c,p,d,L,K,Y;if(typeof t.dateFrom!="number"&&(t.dateFrom instanceof S?s=t.dateFrom.utc():s=i(t.dateFrom,t.formatFrom).utc()),typeof t.dateTo!="number"&&(t.dateTo instanceof S?h=t.dateTo.utc():h=i(t.dateTo,t.formatTo!==e?t.formatTo:t.formatFrom).utc()),typeof t.period=="number"?d={year:0,month:0,day:0,hours:0,minutes:0,seconds:t.period}:typeof t.period=="string"?d={year:t.period==="year"?1:0,month:t.period==="month"?1:0,day:t.period==="day"?1:0,hours:t.period==="hours"?1:0,minutes:t.period==="minutes"?1:0,seconds:t.period==="seconds"?1:0}:typeof t.period=="object"&&(d={year:t.period.year!==e?t.period.year:0,month:t.period.month!==e?t.period.month:0,day:t.period.day!==e?t.period.day:0,hours:t.period.hours!==e?t.period.hours:0,minutes:t.period.minutes!==e?t.period.minutes:0,seconds:t.period.seconds!==e?t.period.seconds:0}),t.groupBy===e?L=t.asObject===!0?{}:[]:(L=[],L.push([]),K=i(s).get()[t.groupBy]),Y=function(W,H,D){return t.asObject===!0?t.format!==e?W[i(H).format(t.format)]={}:W[i(H).format("%F %H:%M:%S")]={}:t.format!==e?W.push(D?null:i(H).format(t.format)):W.push(D?null:i(H)),W},t.groupBy!==e&&t.fillNulls){var I={year:d.year?-d.year:e,month:d.month?-d.month:e,day:d.day?-d.day:e,hours:d.hours?-d.hours:e,minutes:d.minutes?-d.minutes:e,seconds:d.seconds?-d.seconds:e,milliseconds:d.milliseconds?-d.milliseconds:e};for(c=i(s).calc(I).utc();i(c).get()[t.groupBy]===K;)Y(L[L.length-1],c,!0),c=i(c).calc(I).utc();if(t.groupBy==="week"){var b=i(s).dayOfWeek();for(c=i(s).dayOfWeek(0).utc();L[0].length<b&&c<s;)Y(L[L.length-1],c,!0),c=i(c).calc(d).utc()}}for(;s<=h;)t.groupBy===e?Y(L,s):i(s).get()[t.groupBy]===K?Y(L[L.length-1],s):(L.push([]),Y(L[L.length-1],s),K=i(s).get()[t.groupBy]),s=i(s).calc(d).utc();if(t.groupBy!==e&&t.fillNulls)for(p=i(h).calc(d).utc();i(p).get()[t.groupBy]===K;)Y(L[L.length-1],p,!0),p=i(p).calc(d).utc();return L},i.monthNames=function(t){switch(t){case"long":return X;default:return Xt}},i.dayNames=function(t){switch(t){case"long":return bt;default:return Ht}},i.lang=function(t){if(t!==e)m=t,N[m]===e&&(m="en"),X=P(),Xt=pt(),bt=ot(),Ht=x();else return m;return e},i.availableLangs=function(){return Object.keys(N)},i.registerFormat=function(t,s,h,c,p,d){w[t]={format:s,parse:h,minLength:c,maxLength:p,type:d}},i.unregisterFormat=function(t){delete w[t]},i.detectFormat=function(t){var s,h,c;return s=O(t,0),s!==""&&(c=10),h=t.charAt(c),(h==="T"||h===" ")&&(s+=h,c+=1),s+=l(t,c),s},R={TempusDate:S},i.classes=function(t,s){if(s===e)return R[t];R[t]=s},i.loadTranslations=function(t){typeof t=="object"?N=t:typeof t=="string"&&de(t,function(s){N=s},function(s){})},m=(E.language||E.systemLanguage||E.userLanguage||"en").substr(0,2).toLowerCase(),N[m]===e&&(m="en"),X=P(),Xt=pt(),bt=ot(),Ht=x(),G.exports&&(A=G.exports=i),A.tempus=i}).call(T)})(ht,ht.exports);var Oe=ht.exports;const mt=M(Oe);class j{constructor(A,e={}){f(this,at);f(this,Nt);f(this,_t);f(this,Ot);f(this,yt);f(this,dt);f(this,It);f(this,Ut);f(this,gt);f(this,Et);f(this,Tt);f(this,lt);f(this,Rt);f(this,Gt);f(this,it);f(this,ct);f(this,St);f(this,q,null);f(this,ft,null);f(this,v,[]);f(this,B,{});f(this,J,50);f(this,Q,50);f(this,$,!0);f(this,tt,null);f(this,U,null);f(this,Z,null);f(this,Bt,100);f(this,et,"no");f(this,F,!1);f(this,At,!1);f(this,st,!1);C(this,"errors",{});C(this,"answerData",{});y(this,q,A),y(this,ft,e)}get serial(){return o(this,F)}get limitCommandSerial(){return o(this,Q)}set limitCommandSerial(A){if(A<10)throw new Error("limitCommandSerial не может быть меньше 10");A>=10&&A<50&&(y(this,J,A),y(this,Q,A)),y(this,Q,A)}setSerial(){y(this,F,!0),y(this,At,!0),y(this,st,!1)}setParallel(){y(this,F,!1),y(this,At,!1),y(this,st,!0)}stop(){y(this,$,!1)}async batch(A,e){o(this,Z)&&_(this,Nt,Kt).call(this),e&&y(this,tt,e),o(this,At)===!1&&y(this,F,!1),Object.keys(A).length>o(this,Q)&&y(this,F,!0),y(this,$,!0),y(this,v,[]),y(this,B,{}),this.errors={},this.answerData={};const n=_(this,Ot,vt).call(this,A);if(Object.keys(A).length<o(this,Q)){const r=n.map((a,l)=>_(this,yt,$t).call(this,a,n[l]));return Promise.allSettled(r).then(a=>{let l={};for(let O of a)O.status==="fulfilled"&&(l={...l,...O.value});return l})}else{let r={},a=0,l=1,O=Object.keys(A).length||1,u=i=>{a+=Object.keys(i).length,l=Math.round(a/O*100)};for(let[i,R]of Object.entries(n)){let E=await _(this,yt,$t).call(this,R,n[i],!0);u(R),e&&e({percent:l}),r={...r,...E}}return r}}async batchTotalCount(A,e){y(this,B,{}),this.errors={};let n=1,r=0,a=Object.keys(A).length||1,l=u=>{r+=Object.keys(u).length,n=Math.round(r/a*100)};e&&e({percent:n});const O=_(this,Ot,vt).call(this,A);if(o(this,st)){const u=O.map(i=>_(this,dt,te).call(this,i).then(R=>(l(i),e&&e({percent:n}),R)));return Promise.allSettled(u).then(i=>{let R={};for(let E of i)E.status==="fulfilled"&&(R={...R,...E.value});return R})}else{let u={};for(let i of O){let R=await _(this,dt,te).call(this,i);l(i),e&&e({percent:n}),u={...u,...R}}return u}}}q=new WeakMap,ft=new WeakMap,v=new WeakMap,B=new WeakMap,J=new WeakMap,Q=new WeakMap,$=new WeakMap,tt=new WeakMap,U=new WeakMap,Z=new WeakMap,Bt=new WeakMap,et=new WeakMap,F=new WeakMap,At=new WeakMap,st=new WeakMap,at=new WeakSet,xt=function(){let A=0;if(!o(this,U))return Math.round(A);let e=0,n=0;return Object.values(o(this,U)).forEach(r=>{const{total:a,count:l}=r;e+=a??0,n+=l??0}),e?A=n/e*100:A=100,{percent:Math.round(A),allCount:n,allTotal:e}},Nt=new WeakSet,Kt=function(){clearInterval(o(this,Z)),y(this,Z,""),y(this,U,""),y(this,tt,""),y(this,et,"no")},_t=new WeakSet,qt=function({key:A,value:e}){const n=_(this,it,Dt).call(this,e.data()),r=Array.isArray(n)?n.length:0,a=_(this,ct,Zt).call(this,e.total(),r);let l=1;n&&(l=r),o(this,tt)&&(o(this,U)||y(this,U,{}),o(this,U)[A]&&o(this,U)[A].count&&(l+=o(this,U)[A].count),o(this,U)[A]={total:a,count:l},o(this,Z)||y(this,Z,setInterval(()=>{const{percent:O,allCount:u,allTotal:i}=o(this,at,xt);(o(this,et)==="no"||o(this,et)<o(this,at,xt).percent)&&(o(this,tt).call(this,{data:o(this,U),percent:O,allCount:u,allTotal:i}),y(this,et,o(this,at,xt).percent)),O===100&&_(this,Nt,Kt).call(this)},o(this,Bt))))},Ot=new WeakSet,vt=function(A){const e=[],n=Object.entries(A);for(let r=0;r<n.length;r+=o(this,J)){const a=n.slice(r,r+o(this,J));e.push(Object.fromEntries(a))}return e},yt=new WeakSet,$t=function(A,e,n){return new Promise(r=>{const a=_(this,Rt,ie).call(this,e),l=[];let O=0,u=0;o(this,q).call(this,A,i=>{Object.entries(i).forEach(([R,E])=>{let m={};const N=E.error();if(N){let{query:{method:x},answer:X}=E;this.errors[R]={error:N,method:x},O+=1}if(E!=null&&E.answer&&Object.keys(E.answer).length){for(let[x,X]of Object.entries(E.answer))x!="result"&&X&&(m[x]=X);Object.keys(m).length&&(this.answerData[R]=m)}const P=_(this,it,Dt).call(this,E.data()),pt=Array.isArray(P)?P.length:0,ot=_(this,ct,Zt).call(this,E.total(),pt);if(Array.isArray(P)?o(this,B)[R]=P:typeof P=="object"&&P!==null&&Object.keys(P).length===0?o(this,B)[R]=[]:o(this,B)[R]=P,u+=ot,n||_(this,_t,qt).call(this,{key:R,value:E}),ot>o(this,J)&&ot>pt){const x=Math.ceil(ot/o(this,J))-1,X=Array.from({length:x});l.push([R,a[R],X])}}),u>5e3&&o(this,At)===!1&&o(this,st)===!1&&y(this,F,!0),O>0&&_(this,St,re).call(this),l.length?(_(this,It,he).call(this,l),_(this,Ut,ae).call(this).then(()=>r(_(this,lt,Qt).call(this)))):r(_(this,lt,Qt).call(this))})})},dt=new WeakSet,te=function(A){return new Promise(e=>{const n=_(this,Rt,ie).call(this,A);let r=0;o(this,q).call(this,n,a=>{Object.entries(a).forEach(([l,O])=>{const u=O.error();u&&(this.errors[l]=u,r+=1);const i=_(this,it,Dt).call(this,O.data()),R=Array.isArray(i)?i.length:0,E=_(this,ct,Zt).call(this,O.total(),R);o(this,B)[l]=E}),r>0&&_(this,St,re).call(this),e(_(this,lt,Qt).call(this))})})},It=new WeakSet,he=function(A){let e=[];A.forEach(([n,r,a])=>{a.forEach((l,O)=>{const u=O+1,i=o(this,J)*u,E=[[n,u].join("_"),_(this,Gt,le).call(this,r,i)];e.length===o(this,J)?(o(this,v).push(e),e=[E]):e.push(E)})}),e.length&&o(this,v).push(e)},Ut=new WeakSet,ae=function(){const A=[],e=[],n=r=>{Object.entries(r).forEach(([a,l])=>{const[O]=a.split("_"),u=_(this,it,Dt).call(this,l.data());Array.isArray(u)&&o(this,B)[O].push(...u),_(this,_t,qt).call(this,{key:O,value:l})})};return o(this,v).forEach((r,a)=>{const l=Object.fromEntries(r),O=()=>new Promise(u=>o(this,q).call(this,l,i=>{o(this,F)?n(i):e[a]=i,u()}));A.push(O)}),o(this,F)?_(this,Et,Ae).call(this,A):_(this,Tt,se).call(this,A).then(()=>{e.forEach(n)})},gt=new WeakSet,ee=function(){return new Promise(A=>setTimeout(A,500))},Et=new WeakSet,Ae=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return Promise.allSettled([e(),_(this,gt,ee).call(this)]).then(()=>o(this,$)?_(this,Et,Ae).call(this,A):Promise.resolve())},Tt=new WeakSet,se=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return _(this,gt,ee).call(this).then(()=>e()).then(()=>o(this,$)?_(this,Tt,se).call(this,A):Promise.resolve())},lt=new WeakSet,Qt=function(){return Object.entries(o(this,ft)).forEach(([A,e])=>{o(this,B)[A]&&(o(this,B)[A]=e(o(this,B)[A]))}),o(this,B)},Rt=new WeakSet,ie=function(A){return Object.entries(A).reduce((e,[n,r])=>{if(Array.isArray(r)){const[a,l={}]=r;e[n]=[a,l]}else{const{method:a,params:l={}}=r;e[n]=[a,l]}return e},{})},Gt=new WeakSet,le=function(A,e){const[n,r]=A;return[n,{start:e,...r}]},it=new WeakSet,Dt=function(A){return((A==null?void 0:A.items)||(A==null?void 0:A.documents))??A},ct=new WeakSet,Zt=function(A,e){return A!==A&&(A=0),A===0&&e===0?0:A||e},St=new WeakSet,re=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(this.errors).forEach(([A,e])=>{console.info(`[${A}]`,e)}),console.groupEnd()};class Vt{constructor(){f(this,rt,{})}get hash(){return this.createHash(8)}createHash(A){let e="abcdefghijklmnopqrstuvwxyz0123456789",n="";A=A||6;for(let r=0;r<A;r++)n+=e.charAt(Math.floor(Math.random()*e.length));return n}actionFilter({keyTimer:A,duration:e=10,action:n}){o(this,rt)[A]&&(clearTimeout(o(this,rt)[A]),o(this,rt)[A]=null),n&&(o(this,rt)[A]=setTimeout(()=>{n()},e))}async noSleep(){let A=document.createElement("video");A.classList.add("no-sleep"),A.addEventListener("loadeddata",()=>{A.style.position="fixed",A.style.left="-9999px",document.querySelector("body").append(A),A.play()}),A.addEventListener("ended",()=>{this.actionFilter({keyTimer:"no-sleep",duration:5e3,action:()=>A.play()})}),A.src="data:video/mp4;base64,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"}downloadFileJson(A,e){let n=new Blob([JSON.stringify(A)],{type:"application/json"}),r=URL.createObjectURL(n),a=document.createElement("a");a.style.display="none",a.href=r,a.download=`${e}.json`,document.body.appendChild(a),a.click(),setTimeout(()=>{document.body.removeChild(a),URL.revokeObjectURL(r)},200)}}rt=new WeakMap;const Yt=new Vt;class oe{constructor(){f(this,Ct);f(this,Mt);f(this,Ft);f(this,Pt);f(this,Wt);f(this,k,"logger");f(this,V,!1);f(this,wt,2e3);f(this,nt,new Map);f(this,Lt,{});f(this,z,null);f(this,ut,!1);C(this,"periodClear",3);_(this,Ct,ce).call(this)}async init(){let A=new j(BX24.callBatch),{entityList:e}=await A.batch({entityList:{method:"entity.get"}});if(e&&Array.isArray(e))if(e.find(r=>r.ENTITY==o(this,k)))y(this,V,!0);else{let{entityAdd:r}=await A.batch({entityAdd:{method:"entity.add",params:{ENTITY:o(this,k),NAME:o(this,k),ACCESS:{AU:"X"}}}});r&&y(this,V,!0)}return _(this,Pt,me).call(this),o(this,V)}start({type:A,data:e}){if(!o(this,V)){_(this,Mt,ne).call(this,"entity");return}const n=Yt.hash;return o(this,nt).set(n,{type:A,data:e,userInfo:o(this,Lt),errorList:[],status:"",answer:null,date:new Date().getTime()}),n}stop({key:A,errorList:e,status:n,answer:r}){if(!o(this,V)){_(this,Mt,ne).call(this,"entity");return}let a=o(this,nt).get(A);e&&(a.errorList=e),n&&(a.status=n),r&&(a.answer=r),Yt.actionFilter({keyTimer:"add.entity.items",duration:o(this,wt),action:async()=>{var l;await _(this,Ft,ue).call(this),(l=a==null?void 0:a.data)!=null&&l.updateList&&y(this,ut,!0)}})}async getEntityList(A){var r;if((r=o(this,z))!=null&&r.length&&!o(this,ut))return o(this,z);let e=new j(BX24.callBatch),{entityList:n}=await e.batch({entityList:{method:"entity.item.get",params:{ENTITY:o(this,k),SORT:{ID:"DESC"}}}},A);return n=n.map(a=>{const{ID:l,DATE_CREATE:O,DETAIL_TEXT:u}=a;return{...JSON.parse(u),id:l,dateCreate:O}}),y(this,ut,!1),n}async downAllEntityJson(){let A=await this.getEntityList(),e=mt().format("%Y-%m-%d");Yt.downloadFileJson(A,`sdklogger-entity-data__${e}`)}}k=new WeakMap,V=new WeakMap,wt=new WeakMap,nt=new WeakMap,Lt=new WeakMap,z=new WeakMap,ut=new WeakMap,Ct=new WeakSet,ce=async function(){const A=new j(BX24.callBatch),e=BX24.isAdmin(),{curUser:n}=await A.batch({curUser:{method:"user.current"}});y(this,Lt,{isAdmin:e,curUser:n})},Mt=new WeakSet,ne=function(A){A=="entity"&&Yt.actionFilter({keyTimer:"error.logger.entity",duration:500,action:()=>{console.error("Хранилище для логгера не инициализировано")}})},Ft=new WeakSet,ue=async function(){let A={},e=new j(BX24.callBatch);for(let[n,r]of o(this,nt).entries())r.status&&(A[n]={method:"entity.item.add",params:{ENTITY:o(this,k),NAME:o(this,k),DETAIL_TEXT:JSON.stringify(r)}});if(Object.keys(A).length){let n=await e.batch(A),{errors:r}=e;for(let[a,l]of Object.entries({...n,...r}))o(this,nt).delete(a);return!0}},Pt=new WeakSet,me=async function(){let A=new j(BX24.callBatch),{serverTime:e}=await A.batch({serverTime:{method:"server.time"}});o(this,z)||y(this,z,await this.getEntityList());let n=o(this,z).filter(r=>{let{dateCreate:a}=r;return mt(new Date(a)).between(mt(new Date(e)),"month")>=this.periodClear});_(this,Wt,fe).call(this,n)},Wt=new WeakSet,fe=async function(A){let e=new j(BX24.callBatch),n=A.map(r=>{let{id:a}=r;return{method:"entity.item.delete",params:{ENTITY:o(this,k),ID:a}}});return await e.batch(n)};class ye{constructor(A){f(this,Jt);f(this,kt);C(this,"domain","");C(this,"isAdmin",!1);C(this,"appInfo",null);C(this,"appConst",null);C(this,"userInfo",null);C(this,"placeData",null);C(this,"placeInfo",null);C(this,"logger",new oe);this.appConst=A}init(){return new Promise(A=>{let e=setInterval(()=>{window.BX24&&BX24.init(async()=>{console.info("init BX24"),clearInterval(e),this.domain=BX24.getDomain(),this.isAdmin=BX24.isAdmin(),this.placeInfo=BX24.placement.info(),await this.logger.init();const[n,r]=await Promise.all([_(this,Jt,Ne).call(this),_(this,kt,_e).call(this)]);this.appInfo=n,this.userInfo=r,new Vt().noSleep(),A(!0)})},100)})}userOption(A,e){return e?BX24.userOption.set(A,e):BX24.userOption.get(A)}call({method:A,params:e,updateList:n}){let r=this.logger.start({type:"call",data:{method:A,params:e,updateList:n}});return new Promise(a=>{e||(e={}),BX24.callMethod(A,e,l=>{let O={};if(l!=null&&l.answer)for(let[u,i]of Object.entries(l.answer))u!="result"&&i&&(O[u]=i);if(l.error()){let u=l.error();console.error(u),this.logger.stop({answer:O,key:r,status:"fail",errorList:[u.toSting()]}),a(!1)}else{let u=l.data();u!=null&&u.items&&(u=u.items),this.logger.stop({answer:O,key:r,status:"success"}),a(u)}})})}async batch(A,e,{updateList:n,errorCall:r,limitCommandSerial:a}={}){let l=new j(BX24.callBatch),O=this.logger.start({type:"batch",data:{commandList:A,updateList:n}});a&&(l.limitCommandSerial=a);try{let u=await l.batch(A,e);if(Object.keys(l.errors).length){let i=Object.entries(l.errors).map(([R,E])=>{var m;return{key:R,error:`${E==null?void 0:E.method} ${(m=E==null?void 0:E.error)==null?void 0:m.toString()}`.trim()}});r&&r(l.errors),this.logger.stop({key:O,status:"fail",errorList:i,answer:l.answerData})}else this.logger.stop({key:O,status:"success",answer:l.answerData});return u}catch(u){let i=u==null?void 0:u.toString();return this.logger.stop({key:O,status:"fail-runtime",errorList:[i],answer:l.answerData}),console.error(u),!1}}async batchTotalCount(A,e){let n=new j(BX24.callBatch),r=this.logger.start({type:"batch",data:{commandList:A}});try{let a=await n.batchTotalCount(A,e);if(Object.keys(n.errors).length){let l=Object.entries(n.errors).map(([O,u])=>({key:O,error:u.toSting()}));this.logger.stop({key:r,status:"fail",errorList:l})}else this.logger.stop({key:r,status:"success"});return a}catch(a){return this.logger.stop({key:r,status:"fail",errorList:[a.toSting()]}),console.error(a),!1}}getPlacement(){return this.call({method:"placement.get"}).then(A=>(this.placeData||(this.placeData=A),A))}async placementBind(A){this.placeData||(this.placeData=await this.getPlacement());const{appName:e,pathApp:n}=this.appConst,r=this.placeData.map(l=>l.placement);let a=this.placeData.find(l=>l.placement==A);r.includes(A)?a.handler!=n&&(window.placementUnBind||(window.placementUnBind={}),window.placementUnBind[A]||this.placementUnBind(a).then(()=>{window.placementUnBind[A]||(window.placementUnBind[A]=!0,this.placementBind(A))})):this.call({method:"placement.bind",params:{PLACEMENT:A,HANDLER:n,LANG_ALL:{ru:{TITLE:e}}}}).then(l=>{l?console.info("Приложение успешно встроено в",A):console.warn("Приложение не может быть встроено в",A)})}placementUnBind(A){const{pathApp:e,appName:n}=this.appConst;return this.call({method:"placement.unbind",params:{PLACEMENT:A,HANDLER:e,LANG_ALL:{ru:{TITLE:n}}}}).then(r=>(console.log("Встройка отвязана",A),r))}getBotList(){return this.call({method:"imbot.bot.list",params:{}}).then(A=>{let e=Object.values(A);return console.log("chat-bot list:",e),e})}regBot({code:A,type:e,name:n}){const{appName:r,pathApp:a,chatBotLogo:l}=this.appConst,O=this.appInfo.ID;return this.call({method:"imbot.register",params:{CODE:A??this.appInfo.CODE,TYPE:e??"O",EVENT_HANDLER:a,OPENLINE:"Y",CLIENT_ID:"",PROPERTIES:{NAME:`${n??r} - бот #${O}`,LAST_NAME:"",COLOR:"GREEN",EMAIL:"",PERSONAL_BIRTHDAY:mt().format("%Y-%m-%d"),WORK_POSITION:"Почтальон",PERSONAL_WWW:"",PERSONAL_GENDER:"M",PERSONAL_PHOTO:l??""}}}).then(u=>(console.log("Чат-бот добавлен",u),u))}unRegBot(A){return this.call({method:"imbot.unregister",params:{BOT_ID:A}}).then(e=>(console.log("чат-бот удален",e),e))}getLoggerList(A){return this.logger.getEntityList(A)}}Jt=new WeakSet,Ne=function(){return this.call({method:"app.info"})},kt=new WeakSet,_e=function(){return this.call({method:"user.current"})},g.Batch=j,g.BxBoot=ye,g.BxHelper=Vt,g.BxLogger=oe,g.tempus=mt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|