szdl-utils-kit 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,2 @@
1
- var et=(d,m,p)=>{if(!m.has(d))throw TypeError("Cannot "+p)};var s=(d,m,p)=>(et(d,m,"read from private field"),p?p.call(d):m.get(d)),o=(d,m,p)=>{if(m.has(d))throw TypeError("Cannot add the same private member more than once");m instanceof WeakSet?m.add(d):m.set(d,p)},c=(d,m,p,E)=>(et(d,m,"write to private field"),E?E.call(d,p):m.set(d,p),p);var h=(d,m,p)=>(et(d,m,"access private method"),p);(function(d,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(d=typeof globalThis<"u"?globalThis:d||self,m(d["szdl-utils-kit"]={}))})(this,function(d){var p,E,w,j,A,P,S,k,y,T,Q,C,O,M,D,R,Y,_,st,v,it,I,rt,K,nt,$,ht,U,mt,V,pt,z,ot,F,lt,G,ct,x,Z,H,at,W,gt,L,N,B,q,J,ut;"use strict";class m{constructor(t,e={}){o(this,R);o(this,_);o(this,v);o(this,I);o(this,K);o(this,$);o(this,U);o(this,V);o(this,z);o(this,F);o(this,G);o(this,x);o(this,H);o(this,W);o(this,L);o(this,B);o(this,J);o(this,p,null);o(this,E,null);o(this,w,[]);o(this,j,{});o(this,A,{});o(this,P,50);o(this,S,!0);o(this,k,null);o(this,y,null);o(this,T,null);o(this,Q,100);o(this,C,"no");o(this,O,!1);o(this,M,!1);o(this,D,!1);c(this,p,t),c(this,E,e)}get serial(){return s(this,O)}setSerial(){c(this,O,!0),c(this,M,!0),c(this,D,!1)}setParallel(){c(this,O,!1),c(this,M,!1),c(this,D,!0)}stop(){c(this,S,!1)}async batch(t,e){s(this,T)&&h(this,_,st).call(this),e&&c(this,k,e),s(this,M)===!1&&c(this,O,!1),Object.keys(t).length>500&&c(this,O,!0),c(this,S,!0),c(this,w,[]),c(this,j,{}),c(this,A,{});const r=h(this,I,rt).call(this,t);if(Object.keys(t).length<500){const i=r.map((l,n)=>h(this,K,nt).call(this,l,r[n]));return Promise.allSettled(i).then(l=>{let n={};for(let u of l)u.status==="fulfilled"&&(n={...n,...u.value});return n})}else{let i={},l=0,n=1,u=Object.keys(t).length||1,a=f=>{l+=Object.keys(f).length,n=Math.round(l/u*100)};for(let[f,g]of Object.entries(r)){let b=await h(this,K,nt).call(this,g,r[f],!0);a(g),e&&e({percent:n}),i={...i,...b}}return i}}async batchTotalCount(t,e){c(this,j,{}),c(this,A,{});let r=1,i=0,l=Object.keys(t).length||1,n=a=>{i+=Object.keys(a).length,r=Math.round(i/l*100)};e&&e({percent:r});const u=h(this,I,rt).call(this,t);if(s(this,D)){const a=u.map(f=>h(this,$,ht).call(this,f).then(g=>(n(f),e&&e({percent:r}),g)));return Promise.allSettled(a).then(f=>{let g={};for(let b of f)b.status==="fulfilled"&&(g={...g,...b.value});return g})}else{let a={};for(let f of u){let g=await h(this,$,ht).call(this,f);n(f),e&&e({percent:r}),a={...a,...g}}return a}}}p=new WeakMap,E=new WeakMap,w=new WeakMap,j=new WeakMap,A=new WeakMap,P=new WeakMap,S=new WeakMap,k=new WeakMap,y=new WeakMap,T=new WeakMap,Q=new WeakMap,C=new WeakMap,O=new WeakMap,M=new WeakMap,D=new WeakMap,R=new WeakSet,Y=function(){let t=0;if(!s(this,y))return Math.round(t);let e=0,r=0;return Object.values(s(this,y)).forEach(i=>{const{total:l,count:n}=i;e+=l??0,r+=n??0}),e?t=r/e*100:t=100,{percent:Math.round(t),allCount:r,allTotal:e}},_=new WeakSet,st=function(){clearInterval(s(this,T)),c(this,T,""),c(this,y,""),c(this,k,""),c(this,C,"no")},v=new WeakSet,it=function({key:t,value:e}){const r=h(this,L,N).call(this,e.data()),i=Array.isArray(r)?r.length:0,l=h(this,B,q).call(this,e.total(),i);let n=1;r&&(n=i),s(this,k)&&(s(this,y)||c(this,y,{}),s(this,y)[t]&&s(this,y)[t].count&&(n+=s(this,y)[t].count),s(this,y)[t]={total:l,count:n},s(this,T)||c(this,T,setInterval(()=>{const{percent:u,allCount:a,allTotal:f}=s(this,R,Y);(s(this,C)==="no"||s(this,C)<s(this,R,Y).percent)&&(s(this,k).call(this,{data:s(this,y),percent:u,allCount:a,allTotal:f}),c(this,C,s(this,R,Y).percent)),u===100&&h(this,_,st).call(this)},s(this,Q))))},I=new WeakSet,rt=function(t){const e=[],r=Object.entries(t);for(let i=0;i<r.length;i+=s(this,P)){const l=r.slice(i,i+s(this,P));e.push(Object.fromEntries(l))}return e},K=new WeakSet,nt=function(t,e,r){return new Promise(i=>{const l=h(this,H,at).call(this,e),n=[];let u=0,a=0;s(this,p).call(this,t,f=>{Object.entries(f).forEach(([g,b])=>{const ft=b.error();ft&&(s(this,A)[g]=ft,u+=1);const tt=h(this,L,N).call(this,b.data()),dt=Array.isArray(tt)?tt.length:0,X=h(this,B,q).call(this,b.total(),dt);if(s(this,j)[g]=tt,a+=X,r||h(this,v,it).call(this,{key:g,value:b}),X>s(this,P)&&X>dt){const bt=Math.ceil(X/s(this,P))-1,yt=Array.from({length:bt});n.push([g,l[g],yt])}}),a>5e3&&s(this,M)===!1&&s(this,D)===!1&&c(this,O,!0),u>0&&h(this,J,ut).call(this),n.length?(h(this,U,mt).call(this,n),h(this,V,pt).call(this).then(()=>i(h(this,x,Z).call(this)))):i(h(this,x,Z).call(this))})})},$=new WeakSet,ht=function(t){return new Promise(e=>{const r=h(this,H,at).call(this,t);let i=0;s(this,p).call(this,r,l=>{Object.entries(l).forEach(([n,u])=>{const a=u.error();a&&(s(this,A)[n]=a,i+=1);const f=h(this,L,N).call(this,u.data()),g=Array.isArray(f)?f.length:0,b=h(this,B,q).call(this,u.total(),g);s(this,j)[n]=b}),i>0&&h(this,J,ut).call(this),e(h(this,x,Z).call(this))})})},U=new WeakSet,mt=function(t){let e=[];t.forEach(([r,i,l])=>{l.forEach((n,u)=>{const a=u+1,f=s(this,P)*a,b=[[r,a].join("_"),h(this,W,gt).call(this,i,f)];e.length===s(this,P)?(s(this,w).push(e),e=[b]):e.push(b)})}),e.length&&s(this,w).push(e)},V=new WeakSet,pt=function(){const t=[],e=[],r=i=>{Object.entries(i).forEach(([l,n])=>{const[u]=l.split("_"),a=h(this,L,N).call(this,n.data());Array.isArray(a)&&s(this,j)[u].push(...a),h(this,v,it).call(this,{key:u,value:n})})};return s(this,w).forEach((i,l)=>{const n=Object.fromEntries(i),u=()=>new Promise(a=>s(this,p).call(this,n,f=>{s(this,O)?r(f):e[l]=f,a()}));t.push(u)}),s(this,O)?h(this,F,lt).call(this,t):h(this,G,ct).call(this,t).then(()=>{e.forEach(r)})},z=new WeakSet,ot=function(){return new Promise(t=>setTimeout(t,500))},F=new WeakSet,lt=function(t){if(!t.length)return Promise.resolve();const e=t.shift();return Promise.allSettled([e(),h(this,z,ot).call(this)]).then(()=>s(this,S)?h(this,F,lt).call(this,t):Promise.resolve())},G=new WeakSet,ct=function(t){if(!t.length)return Promise.resolve();const e=t.shift();return h(this,z,ot).call(this).then(()=>e()).then(()=>s(this,S)?h(this,G,ct).call(this,t):Promise.resolve())},x=new WeakSet,Z=function(){return Object.entries(s(this,E)).forEach(([t,e])=>{s(this,j)[t]&&(s(this,j)[t]=e(s(this,j)[t]))}),s(this,j)},H=new WeakSet,at=function(t){return Object.entries(t).reduce((e,[r,i])=>{if(Array.isArray(i)){const[l,n={}]=i;e[r]=[l,n]}else{const{method:l,params:n={}}=i;e[r]=[l,n]}return e},{})},W=new WeakSet,gt=function(t,e){const[r,i]=t;return[r,{start:e,...i}]},L=new WeakSet,N=function(t){return((t==null?void 0:t.items)||(t==null?void 0:t.documents))??t},B=new WeakSet,q=function(t,e){return t!==t&&(t=0),t===0&&e===0?0:t||e},J=new WeakSet,ut=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(s(this,A)).forEach(([t,e])=>{console.info(`[${t}]`,e.toString())}),console.groupEnd()},d.Batch=m,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
1
+ var $t=Object.defineProperty;var te=(A,R,d)=>R in A?$t(A,R,{enumerable:!0,configurable:!0,writable:!0,value:d}):A[R]=d;var X=(A,R,d)=>(te(A,typeof R!="symbol"?R+"":R,d),d),It=(A,R,d)=>{if(!R.has(A))throw TypeError("Cannot "+d)};var u=(A,R,d)=>(It(A,R,"read from private field"),d?d.call(A):R.get(A)),_=(A,R,d)=>{if(R.has(A))throw TypeError("Cannot add the same private member more than once");R instanceof WeakSet?R.add(A):R.set(A,d)},E=(A,R,d,$)=>(It(A,R,"write to private field"),$?$.call(A,d):R.set(A,d),d);var N=(A,R,d)=>(It(A,R,"access private method"),d);(function(A,R){typeof exports=="object"&&typeof module<"u"?R(exports):typeof define=="function"&&define.amd?define(["exports"],R):(A=typeof globalThis<"u"?globalThis:A||self,R(A["szdl-utils-kit"]={}))})(this,function(A){var j,it,k,G,w,W,V,Z,I,J,St,z,C,K,Q,tt,Ht,rt,Gt,nt,Bt,ot,Ct,ht,Pt,at,Ft,Rt,kt,Tt,Vt,ut,Wt,ct,wt,mt,Jt,et,Yt,lt,xt,yt,Zt,q,At,st,Dt,ft,Xt,Et,zt,Mt,Kt;"use strict";var R=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function d(F){return F&&F.__esModule&&Object.prototype.hasOwnProperty.call(F,"default")?F.default:F}var $={exports:{}};(function(F,r){(function(s){Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){var n,o;for(n=e||0,o=this.length;n<o;n+=1)if(this[n]===t)return n;return-1});var a=this,h=function(t,e){for(var n=t.toString();n.length<e;)n="0"+n;return n},l=function(t,e){return e!==s?(t.year(e.year()||e.year),t.month(e.month()||e.month),t.day(e.day()||e.day),t.hours(e.hours()||e.hours),t.minutes(e.minutes()||e.minutes),t.seconds(e.seconds()||e.seconds),t.milliseconds(e.milliseconds()||e.milliseconds),t):s},f=function(t,e){var n,o="";return n=t.slice(e,e+1),n!==""&&!isNaN(Number(n))&&(o+="%H"),n=t.charAt(e+2),n!==""&&n===":"&&(o+=n),n=t.slice(e+3,e+4),n!==""&&!isNaN(Number(n))&&(o+="%M"),n=t.charAt(e+5),n!==""&&n===":"&&(o+=n),n=t.slice(e+6,e+7),n!==""&&!isNaN(Number(n))&&(o+="%S"),o},T=function(t,e){var n,o=[t.slice(e,e+1),t.charAt(e+2),t.slice(e+3,e+4),t.charAt(e+5),t.slice(e+6,e+9)],L;return!isNaN(Number(o[0]))&&!isNaN(Number(o[2]))&&!isNaN(Number(o[4]))?(o[1]==="."&&o[3]==="."?n="%d.%m.%Y":o[1]==="-"&&o[3]==="-"?n="%m-%d-%Y":o[1]==="/"&&o[3]==="/"&&(n="%m/%d/%Y"),n):(L=[t.slice(e,e+3),t.charAt(e+4),t.slice(e+5,e+6),t.charAt(e+7),t.slice(e+8,e+9)],!isNaN(Number(L[0]))&&!isNaN(Number(L[2]))&&!isNaN(Number(L[4]))?(L[1]==="-"&&L[3]==="-"&&(n="%Y-%m-%d"),n):"")},S=a.tempus,i,g,H=a.navigator||{},c="en",m={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"}},Nt=function(){return[m[c].JANUARY_LONG,m[c].FEBRUARY_LONG,m[c].MARCH_LONG,m[c].APRIL_LONG,m[c].MAY_LONG,m[c].JUNE_LONG,m[c].JULY_LONG,m[c].AUGUST_LONG,m[c].SEPTEMBER_LONG,m[c].OCTOBER_LONG,m[c].NOVEMBER_LONG,m[c].DECEMBER_LONG]},v=function(){return[m[c].JANUARY_SHORT,m[c].FEBRUARY_SHORT,m[c].MARCH_SHORT,m[c].APRIL_SHORT,m[c].MAY_SHORT,m[c].JUNE_SHORT,m[c].JULY_SHORT,m[c].AUGUST_SHORT,m[c].SEPTEMBER_SHORT,m[c].OCTOBER_SHORT,m[c].NOVEMBER_SHORT,m[c].DECEMBER_SHORT]},gt=function(){return[m[c].SUNDAY_LONG,m[c].MONDAY_LONG,m[c].TUESDAY_LONG,m[c].WEDNESDAY_LONG,m[c].THURSDAY_LONG,m[c].FRIDAY_LONG,m[c].SATURDAY_LONG]},dt=function(){return[m[c].SUNDAY_SHORT,m[c].MONDAY_SHORT,m[c].TUESDAY_SHORT,m[c].WEDNESDAY_SHORT,m[c].THURSDAY_SHORT,m[c].FRIDAY_SHORT,m[c].SATURDAY_SHORT]},Lt,pt,_t,Ot,vt=function(t,e,n){var o;a.XMLHttpRequest?o=new XMLHttpRequest:o=new ActiveXObject("Microsoft.XMLHTTP"),o.onreadystatechange=function(){o.readyState===4&&(o.status===200?e&&(a.JSON===s?alert(`Please, include json2 into your project if you want use old browsers!
2
+ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`):e(JSON.parse(o.responseText))):n&&n(o))},o.open("GET",t,!1),o.send()},B={"%d":{format:function(t){return h(t.day()||i.MIN_DAY,2)},parse:function(t){var e=Number(t);return{day:isNaN(e)?s:e}},minLength:2,maxLength:2,type:"number"},"%m":{format:function(t){return h(t.month()||i.MIN_MONTH,2)},parse:function(t){var e=Number(t);return{month:isNaN(e)?s:e}},minLength:2,maxLength:2,type:"number"},"%Y":{format:function(t){return h(t.year()||i.MIN_YEAR,4)},parse:function(t){var e=Number(t);return{year:isNaN(e)?s:e}},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 e=t.dayOfWeek();return Ot[e!==s?e:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%A":{format:function(t){var e=t.dayOfWeek();return _t[e!==s?e:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%b":{format:function(t){var e=i.options("monthFromZero")?t.month():t.month()-1;return pt[e!==s?e:i.MIN_MONTH]},parse:function(t){var e=i.monthNames().indexOf(t)+(i.options("monthFromZero")?0:1);return{month:e!==-1?e:s}},minLength:1,maxLength:999,type:"word"},"%B":{format:function(t){var e=i.options("monthFromZero")?t.month():t.month()-1;return Lt[e!==s?e:i.MIN_MONTH]},parse:function(t){var e=i.monthNames(!0).indexOf(t)+(i.options("monthFromZero")?0:1);return{month:e!==-1?e:s}},minLength:1,maxLength:999,type:"word"},"%H":{format:function(t){return h(t.hours()||i.MIN_HOURS,2)},parse:function(t){var e=Number(t);return{hours:isNaN(e)?s:e}},minLength:2,maxLength:2,type:"number"},"%M":{format:function(t){return h(t.minutes()||i.MIN_MINUTES,2)},parse:function(t){var e=Number(t);return{minutes:isNaN(e)?s:e}},minLength:2,maxLength:2,type:"number"},"%S":{format:function(t){return h(t.seconds()||i.MIN_SECONDS,2)},parse:function(t){var e=Number(t);return{seconds:isNaN(e)?s:e}},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 h(t.year()||i.MIN_YEAR,4)+"-"+h(t.month()||i.MIN_MONTH,2)+"-"+h(t.day()||i.MIN_DAY,2)},parse:function(t){var e=Number(t.slice(0,4)),n=Number(t.slice(5,7)),o=Number(t.slice(8,10));return{year:e,month:n,day:o}},minLength:10,maxLength:10,type:"string"},"%D":{format:function(t){return h(t.month()||i.MIN_MONTH,2)+"/"+h(t.day()||i.MIN_DAY,2)+"/"+h(t.year()||i.MIN_YEAR,4)},parse:function(t){var e=Number(t.slice(0,2)),n=Number(t.slice(3,5)),o=Number(t.slice(6,10));return{year:o,month:e,day:n}},minLength:10,maxLength:10,type:"string"}},bt={useMilliseconds:!1,monthFromZero:!1},y;y=function(t,e,n){return this._d=new Date,this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t!==s&&this.set(t,e,n),this},y.fn=y.prototype,y.fn.dayCount=function(){var t=this.month(),e=i.MAX_DAY_IN_MONTHS[t-(i.options("monthFromZero")?0:1)];return this.leapYear()&&t===(i.options("monthFromZero")?1:2)&&(e+=1),e},y.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},y.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},y.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},y.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},y.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},y.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},y.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},y.fn.week=function(){var t=new Date(this.year(),0,1),e=i(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc()*1e3;return Math.ceil(((e-t.getTime())/864e5+t.getDay()+1)/7)},y.fn.set=function(t,e,n){if(this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t===s)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 o,L=[],O,M,x=[],D=0,U=0,p,P,b={},Y;if(t===s)return O=l(this,n),O===s&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),O;for(e===s&&(e=i.detectFormat(t));D<e.length;){if(e.charAt(D)==="%"){if(M=e.charAt(D)+e.charAt(D+1),B[M]!==s){switch(p=0,P="",B[M].type){case"number":for(;p<B[M].maxLength&&U+p<t.length&&!isNaN(Number(t.charAt(U+p)));)P+=t.charAt(U+p),p+=1;break;case"word":for(;p<B[M].maxLength&&U+p<t.length&&/^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(U+p));)P+=t.charAt(U+p),p+=1;break;case"string":for(;p<B[M].maxLength&&U+p<t.length;)P+=t.charAt(U+p),p+=1;break}if(p<B[M].minLength)return O=l(this,n),O===s&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),O;L.push(M),x.push(P),p-=1,U+=p,D+=1}}else if(t.charAt(U)!==e.charAt(D))return O=l(this,n),O===s&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),O;D+=1,U+=1}for(o in L)L.hasOwnProperty(o)&&B.hasOwnProperty(L[o])&&(Y=B[L[o]].parse(x[o]),b={year:Y.year!==s?Y.year:b.year,month:Y.month!==s?Y.month:b.month,day:Y.day!==s?Y.day:b.day,hours:Y.hours!==s?Y.hours:b.hours,minutes:Y.minutes!==s?Y.minutes:b.minutes,seconds:Y.seconds!==s?Y.seconds:b.seconds});this.day(i.MIN_DAY),this.year(b.year),this.month(b.month),this.day(b.day),this.hours(b.hours),this.minutes(b.minutes),this.seconds(b.seconds),this.milliseconds(b.milliseconds)}return this},y.fn.leapYear=function(){var t=this.year();return t%4===0?t%100===0?t%400===0:!0:!1},y.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},y.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)},y.fn.dayOfWeek=function(t){if(t==="long")return _t[this._d.getDay()];if(t==="short")return Ot[this._d.getDay()];if(t===s)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()})},y.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}},y.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()}}},y.fn.format=function(t){for(var e=0,n="",o;e<t.length;)t.charAt(e)==="%"?(o=t.charAt(e)+t.charAt(e+1),B[o]!==s?(n+=B[o].format(this),e+=1):n+="%"):n+=t.charAt(e),e+=1;return n},y.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},y.fn.errors=function(){return this._i},y.fn.between=function(t,e){var n=this.timestamp(),o=t.timestamp();switch(e){case"year":return Math.floor((o-n)/31556952);case"month":return Math.floor((o-n)/2629746);case"day":return Math.floor((o-n)/86400);case"hours":return Math.floor((o-n)/3600);case"minutes":return Math.floor((o-n)/60);case"seconds":return o-n;default:return s}},y.fn.calc=function(t){return t.year!==s&&this._d.setFullYear(this._d.getFullYear()+t.year),t.month!==s&&this._d.setMonth(this._d.getMonth()+t.month),t.day!==s&&this._d.setDate(this._d.getDate()+t.day),t.hours!==s&&this._d.setHours(this._d.getHours()+t.hours),t.minutes!==s&&this._d.setMinutes(this._d.getMinutes()+t.minutes),t.seconds!==s&&this._d.setSeconds(this._d.getSeconds()+t.seconds),t.milliseconds!==s&&this._d.setMilliseconds(this._d.getMilliseconds()+t.milliseconds),this},i=function(t,e,n){return new y(t,e,n)},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,e){if(t===s)return bt;if(bt.hasOwnProperty(t)){if(e===s)return bt[t];bt[t]=e,t==="monthFromZero"&&(i.MIN_MONTH=e?0:1,i.MAX_MONTH=e?11:12)}return s},i.noConflict=function(){return a.tempus=S,i},i.generate=function(t){var e,n,o,L,O,M,x,D;if(typeof t.dateFrom!="number"&&(t.dateFrom instanceof y?e=t.dateFrom.utc():e=i(t.dateFrom,t.formatFrom).utc()),typeof t.dateTo!="number"&&(t.dateTo instanceof y?n=t.dateTo.utc():n=i(t.dateTo,t.formatTo!==s?t.formatTo:t.formatFrom).utc()),typeof t.period=="number"?O={year:0,month:0,day:0,hours:0,minutes:0,seconds:t.period}:typeof t.period=="string"?O={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"&&(O={year:t.period.year!==s?t.period.year:0,month:t.period.month!==s?t.period.month:0,day:t.period.day!==s?t.period.day:0,hours:t.period.hours!==s?t.period.hours:0,minutes:t.period.minutes!==s?t.period.minutes:0,seconds:t.period.seconds!==s?t.period.seconds:0}),t.groupBy===s?M=t.asObject===!0?{}:[]:(M=[],M.push([]),x=i(e).get()[t.groupBy]),D=function(P,b,Y){return t.asObject===!0?t.format!==s?P[i(b).format(t.format)]={}:P[i(b).format("%F %H:%M:%S")]={}:t.format!==s?P.push(Y?null:i(b).format(t.format)):P.push(Y?null:i(b)),P},t.groupBy!==s&&t.fillNulls){var U={year:O.year?-O.year:s,month:O.month?-O.month:s,day:O.day?-O.day:s,hours:O.hours?-O.hours:s,minutes:O.minutes?-O.minutes:s,seconds:O.seconds?-O.seconds:s,milliseconds:O.milliseconds?-O.milliseconds:s};for(o=i(e).calc(U).utc();i(o).get()[t.groupBy]===x;)D(M[M.length-1],o,!0),o=i(o).calc(U).utc();if(t.groupBy==="week"){var p=i(e).dayOfWeek();for(o=i(e).dayOfWeek(0).utc();M[0].length<p&&o<e;)D(M[M.length-1],o,!0),o=i(o).calc(O).utc()}}for(;e<=n;)t.groupBy===s?D(M,e):i(e).get()[t.groupBy]===x?D(M[M.length-1],e):(M.push([]),D(M[M.length-1],e),x=i(e).get()[t.groupBy]),e=i(e).calc(O).utc();if(t.groupBy!==s&&t.fillNulls)for(L=i(n).calc(O).utc();i(L).get()[t.groupBy]===x;)D(M[M.length-1],L,!0),L=i(L).calc(O).utc();return M},i.monthNames=function(t){switch(t){case"long":return Lt;default:return pt}},i.dayNames=function(t){switch(t){case"long":return _t;default:return Ot}},i.lang=function(t){if(t!==s)c=t,m[c]===s&&(c="en"),Lt=Nt(),pt=v(),_t=gt(),Ot=dt();else return c;return s},i.availableLangs=function(){return Object.keys(m)},i.registerFormat=function(t,e,n,o,L,O){B[t]={format:e,parse:n,minLength:o,maxLength:L,type:O}},i.unregisterFormat=function(t){delete B[t]},i.detectFormat=function(t){var e,n,o;return e=T(t,0),e!==""&&(o=10),n=t.charAt(o),(n==="T"||n===" ")&&(e+=n,o+=1),e+=f(t,o),e},g={TempusDate:y},i.classes=function(t,e){if(e===s)return g[t];g[t]=e},i.loadTranslations=function(t){typeof t=="object"?m=t:typeof t=="string"&&vt(t,function(e){m=e},function(e){})},c=(H.language||H.systemLanguage||H.userLanguage||"en").substr(0,2).toLowerCase(),m[c]===s&&(c="en"),Lt=Nt(),pt=v(),_t=gt(),Ot=dt(),F.exports&&(r=F.exports=i),r.tempus=i}).call(R)})($,$.exports);var Qt=$.exports;const jt=d(Qt);class Ut{constructor(r,s={}){_(this,tt);_(this,rt);_(this,nt);_(this,ot);_(this,ht);_(this,at);_(this,Rt);_(this,Tt);_(this,ut);_(this,ct);_(this,mt);_(this,et);_(this,lt);_(this,yt);_(this,q);_(this,st);_(this,ft);_(this,j,null);_(this,it,null);_(this,k,[]);_(this,G,{});_(this,w,{});_(this,W,50);_(this,V,!0);_(this,Z,null);_(this,I,null);_(this,J,null);_(this,St,100);_(this,z,"no");_(this,C,!1);_(this,K,!1);_(this,Q,!1);E(this,j,r),E(this,it,s)}get serial(){return u(this,C)}setSerial(){E(this,C,!0),E(this,K,!0),E(this,Q,!1)}setParallel(){E(this,C,!1),E(this,K,!1),E(this,Q,!0)}stop(){E(this,V,!1)}async batch(r,s){u(this,J)&&N(this,rt,Gt).call(this),s&&E(this,Z,s),u(this,K)===!1&&E(this,C,!1),Object.keys(r).length>500&&E(this,C,!0),E(this,V,!0),E(this,k,[]),E(this,G,{}),E(this,w,{});const a=N(this,ot,Ct).call(this,r);if(Object.keys(r).length<500){const h=a.map((l,f)=>N(this,ht,Pt).call(this,l,a[f]));return Promise.allSettled(h).then(l=>{let f={};for(let T of l)T.status==="fulfilled"&&(f={...f,...T.value});return f})}else{let h={},l=0,f=1,T=Object.keys(r).length||1,S=i=>{l+=Object.keys(i).length,f=Math.round(l/T*100)};for(let[i,g]of Object.entries(a)){let H=await N(this,ht,Pt).call(this,g,a[i],!0);S(g),s&&s({percent:f}),h={...h,...H}}return h}}async batchTotalCount(r,s){E(this,G,{}),E(this,w,{});let a=1,h=0,l=Object.keys(r).length||1,f=S=>{h+=Object.keys(S).length,a=Math.round(h/l*100)};s&&s({percent:a});const T=N(this,ot,Ct).call(this,r);if(u(this,Q)){const S=T.map(i=>N(this,at,Ft).call(this,i).then(g=>(f(i),s&&s({percent:a}),g)));return Promise.allSettled(S).then(i=>{let g={};for(let H of i)H.status==="fulfilled"&&(g={...g,...H.value});return g})}else{let S={};for(let i of T){let g=await N(this,at,Ft).call(this,i);f(i),s&&s({percent:a}),S={...S,...g}}return S}}}j=new WeakMap,it=new WeakMap,k=new WeakMap,G=new WeakMap,w=new WeakMap,W=new WeakMap,V=new WeakMap,Z=new WeakMap,I=new WeakMap,J=new WeakMap,St=new WeakMap,z=new WeakMap,C=new WeakMap,K=new WeakMap,Q=new WeakMap,tt=new WeakSet,Ht=function(){let r=0;if(!u(this,I))return Math.round(r);let s=0,a=0;return Object.values(u(this,I)).forEach(h=>{const{total:l,count:f}=h;s+=l??0,a+=f??0}),s?r=a/s*100:r=100,{percent:Math.round(r),allCount:a,allTotal:s}},rt=new WeakSet,Gt=function(){clearInterval(u(this,J)),E(this,J,""),E(this,I,""),E(this,Z,""),E(this,z,"no")},nt=new WeakSet,Bt=function({key:r,value:s}){const a=N(this,q,At).call(this,s.data()),h=Array.isArray(a)?a.length:0,l=N(this,st,Dt).call(this,s.total(),h);let f=1;a&&(f=h),u(this,Z)&&(u(this,I)||E(this,I,{}),u(this,I)[r]&&u(this,I)[r].count&&(f+=u(this,I)[r].count),u(this,I)[r]={total:l,count:f},u(this,J)||E(this,J,setInterval(()=>{const{percent:T,allCount:S,allTotal:i}=u(this,tt,Ht);(u(this,z)==="no"||u(this,z)<u(this,tt,Ht).percent)&&(u(this,Z).call(this,{data:u(this,I),percent:T,allCount:S,allTotal:i}),E(this,z,u(this,tt,Ht).percent)),T===100&&N(this,rt,Gt).call(this)},u(this,St))))},ot=new WeakSet,Ct=function(r){const s=[],a=Object.entries(r);for(let h=0;h<a.length;h+=u(this,W)){const l=a.slice(h,h+u(this,W));s.push(Object.fromEntries(l))}return s},ht=new WeakSet,Pt=function(r,s,a){return new Promise(h=>{const l=N(this,lt,xt).call(this,s),f=[];let T=0,S=0;u(this,j).call(this,r,i=>{Object.entries(i).forEach(([g,H])=>{const c=H.error();c&&(u(this,w)[g]=c,T+=1);const m=N(this,q,At).call(this,H.data()),Nt=Array.isArray(m)?m.length:0,v=N(this,st,Dt).call(this,H.total(),Nt);if(u(this,G)[g]=m,S+=v,a||N(this,nt,Bt).call(this,{key:g,value:H}),v>u(this,W)&&v>Nt){const gt=Math.ceil(v/u(this,W))-1,dt=Array.from({length:gt});f.push([g,l[g],dt])}}),S>5e3&&u(this,K)===!1&&u(this,Q)===!1&&E(this,C,!0),T>0&&N(this,ft,Xt).call(this),f.length?(N(this,Rt,kt).call(this,f),N(this,Tt,Vt).call(this).then(()=>h(N(this,et,Yt).call(this)))):h(N(this,et,Yt).call(this))})})},at=new WeakSet,Ft=function(r){return new Promise(s=>{const a=N(this,lt,xt).call(this,r);let h=0;u(this,j).call(this,a,l=>{Object.entries(l).forEach(([f,T])=>{const S=T.error();S&&(u(this,w)[f]=S,h+=1);const i=N(this,q,At).call(this,T.data()),g=Array.isArray(i)?i.length:0,H=N(this,st,Dt).call(this,T.total(),g);u(this,G)[f]=H}),h>0&&N(this,ft,Xt).call(this),s(N(this,et,Yt).call(this))})})},Rt=new WeakSet,kt=function(r){let s=[];r.forEach(([a,h,l])=>{l.forEach((f,T)=>{const S=T+1,i=u(this,W)*S,H=[[a,S].join("_"),N(this,yt,Zt).call(this,h,i)];s.length===u(this,W)?(u(this,k).push(s),s=[H]):s.push(H)})}),s.length&&u(this,k).push(s)},Tt=new WeakSet,Vt=function(){const r=[],s=[],a=h=>{Object.entries(h).forEach(([l,f])=>{const[T]=l.split("_"),S=N(this,q,At).call(this,f.data());Array.isArray(S)&&u(this,G)[T].push(...S),N(this,nt,Bt).call(this,{key:T,value:f})})};return u(this,k).forEach((h,l)=>{const f=Object.fromEntries(h),T=()=>new Promise(S=>u(this,j).call(this,f,i=>{u(this,C)?a(i):s[l]=i,S()}));r.push(T)}),u(this,C)?N(this,ct,wt).call(this,r):N(this,mt,Jt).call(this,r).then(()=>{s.forEach(a)})},ut=new WeakSet,Wt=function(){return new Promise(r=>setTimeout(r,500))},ct=new WeakSet,wt=function(r){if(!r.length)return Promise.resolve();const s=r.shift();return Promise.allSettled([s(),N(this,ut,Wt).call(this)]).then(()=>u(this,V)?N(this,ct,wt).call(this,r):Promise.resolve())},mt=new WeakSet,Jt=function(r){if(!r.length)return Promise.resolve();const s=r.shift();return N(this,ut,Wt).call(this).then(()=>s()).then(()=>u(this,V)?N(this,mt,Jt).call(this,r):Promise.resolve())},et=new WeakSet,Yt=function(){return Object.entries(u(this,it)).forEach(([r,s])=>{u(this,G)[r]&&(u(this,G)[r]=s(u(this,G)[r]))}),u(this,G)},lt=new WeakSet,xt=function(r){return Object.entries(r).reduce((s,[a,h])=>{if(Array.isArray(h)){const[l,f={}]=h;s[a]=[l,f]}else{const{method:l,params:f={}}=h;s[a]=[l,f]}return s},{})},yt=new WeakSet,Zt=function(r,s){const[a,h]=r;return[a,{start:s,...h}]},q=new WeakSet,At=function(r){return((r==null?void 0:r.items)||(r==null?void 0:r.documents))??r},st=new WeakSet,Dt=function(r,s){return r!==r&&(r=0),r===0&&s===0?0:r||s},ft=new WeakSet,Xt=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(u(this,w)).forEach(([r,s])=>{console.info(`[${r}]`,s.toString())}),console.groupEnd()};class qt{constructor(r){_(this,Et);_(this,Mt);X(this,"domain","");X(this,"isAdmin",!1);X(this,"appInfo",null);X(this,"appConst",null);X(this,"userInfo",null);X(this,"placeData",null);X(this,"placeInfo",null);this.appConst=r}init(){return new Promise(r=>{let s=setInterval(()=>{window.BX24&&BX24.init(async()=>{console.info("init BX24"),clearInterval(s),this.domain=BX24.getDomain(),this.isAdmin=BX24.isAdmin(),this.placeInfo=BX24.placement.info();const[a,h]=await Promise.all([N(this,Et,zt).call(this),N(this,Mt,Kt).call(this)]);this.appInfo=a,this.userInfo=h,r(!0)})},100)})}userOption(r,s){return s?BX24.userOption.set(r,s):BX24.userOption.get(r)}call({method:r,params:s}){return new Promise(a=>{s||(s={}),BX24.callMethod(r,s,function(h){if(h.error()){let l=h.error();console.error(l),a(!1)}else{let l=h.data();l!=null&&l.items&&(l=l.items),a(l)}})})}batch(r,s){return new Ut(BX24.callBatch).batch(r,s)}batchTotalCount(r,s){return new Ut(BX24.callBatch).batchTotalCount(r,s)}getPlacement(){return this.call({method:"placement.get"}).then(r=>(this.placeData||(this.placeData=r),r))}async placementBind(r){this.placeData||(this.placeData=await this.getPlacement());const{appName:s,pathApp:a}=this.appConst,h=this.placeData.map(f=>f.placement);let l=this.placeData.find(f=>f.placement==r);h.includes(r)?l.handler!=a&&(window.placementUnBind||(window.placementUnBind={}),window.placementUnBind[r]||this.placementUnBind(l).then(()=>{window.placementUnBind[r]||(window.placementUnBind[r]=!0,this.placementBind(r))})):this.call({method:"placement.bind",params:{PLACEMENT:r,HANDLER:a,LANG_ALL:{ru:{TITLE:s}}}}).then(f=>{f?console.info("Приложение успешно встроено в",r):console.warn("Приложение не может быть встроено в",r)})}placementUnBind(r){const{pathApp:s,appName:a}=this.appConst;return this.call({method:"placement.unbind",params:{PLACEMENT:r,HANDLER:s,LANG_ALL:{ru:{TITLE:a}}}}).then(h=>(console.log("Встройка отвязана",r),h))}getBotList(){return this.call({method:"imbot.bot.list",params:{}}).then(r=>{let s=Object.values(r);return console.log("chat-bot list:",s),s})}regBot({code:r,type:s,name:a}){const{appName:h,pathApp:l,chatBotLogo:f}=this.appConst,T=this.appInfo.ID;return this.call({method:"imbot.register",params:{CODE:r??this.appInfo.CODE,TYPE:s??"O",EVENT_HANDLER:l,OPENLINE:"Y",CLIENT_ID:"",PROPERTIES:{NAME:`${a??h} - бот #${T}`,LAST_NAME:"",COLOR:"GREEN",EMAIL:"",PERSONAL_BIRTHDAY:jt().format("%Y-%m-%d"),WORK_POSITION:"Почтальон",PERSONAL_WWW:"",PERSONAL_GENDER:"M",PERSONAL_PHOTO:f??""}}}).then(S=>(console.log("Чат-бот добавлен",S),S))}unRegBot(r){return this.call({method:"imbot.unregister",params:{BOT_ID:r}}).then(s=>(console.log("чат-бот удален",s),s))}}Et=new WeakSet,zt=function(){return this.call({method:"app.info"})},Mt=new WeakSet,Kt=function(){return this.call({method:"user.current"})},A.Batch=Ut,A.BxBoot=qt,A.tempus=jt,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
@@ -15,7 +15,7 @@ declare class Batch{
15
15
  * @constructor
16
16
  * @param {()=>void} callBatch - пробрасываем метод BX24.callBatch
17
17
  */
18
- constructor(callBatch:()=>void);
18
+ constructor(callBatch: ()=>void);
19
19
 
20
20
  /**
21
21
  * Флаг режима передачи
@@ -25,37 +25,37 @@ declare class Batch{
25
25
  /**
26
26
  * Установить последовательный режим
27
27
  */
28
- setSerial: ()=> void;
28
+ setSerial(): void;
29
29
 
30
30
  /**
31
31
  * Установить параллельный режим режим
32
32
  */
33
- setParallel: ()=>void;
33
+ setParallel(): void;
34
34
 
35
35
  /**
36
36
  * Принудительно остановить выгрузку данных
37
37
  */
38
- stop: ()=>void;
38
+ stop(): void;
39
39
 
40
40
  /**
41
- * Запрос данных
41
+ * Пакетный запрос данных
42
42
  * @param commandList - лист команд можно передавать как в виде объекта, так и в виде массива команд
43
43
  * @param progressCall - принимает callback в который передается статус загрузки данных в процентах
44
44
  */
45
- batch: (
45
+ batch(
46
46
  commandList: Record<string, TCommand>,
47
47
  progressCall?: (data:{ percent: number })=>void
48
- ) => Record<string, unknown[]>;
48
+ ): Awaited<Record<string, unknown[]> | boolean>;
49
49
 
50
50
  /**
51
- * Запрос количества элементов по запрощенным сущностям
51
+ * Пакетный запрос количества элементов по запрощенным сущностям
52
52
  * @param commandList - лист команд можно передавать как в виде объекта, так и в виде массива команд
53
53
  * @param progressCall - принимает callback в который передается статус загрузки данных в процентах
54
54
  */
55
- batchTotalCount: (
55
+ batchTotalCount(
56
56
  commandList: Record<string, TCommand>,
57
57
  progressCall?: (data:{ percent: number })=>void
58
- ) => Record<string, number>;
58
+ ): Awaited<Record<string, unknown[]> | boolean>;
59
59
  }
60
60
 
61
61
  export default Batch;
@@ -0,0 +1,143 @@
1
+ type TAppConst = {
2
+ appName: string,
3
+ appNameEng: string,
4
+ pathApp: string,
5
+ zip: string,
6
+ chatBotLogo: string,
7
+ entity: { key: string, name: string }[],
8
+ }
9
+ type UserOptionReturnType<T> = T extends undefined ? string | number : void;
10
+
11
+ type TCommand = {
12
+ method: string,
13
+ params: Record<string, unknown> | {
14
+ select?: string[],
15
+ filter?: Record<string, string | string[]>,
16
+ } | {
17
+ id?: string,
18
+ params?: Record<string, string>,
19
+ fields?: Record<string, unknown>,
20
+ }
21
+ }
22
+
23
+ declare class BxBoot{
24
+ /** В конструктор передаются константы приложения appConst */
25
+ constructor(appConst: {
26
+ appName: string,
27
+ appNameEng: string,
28
+ pathApp: string,
29
+ zip: string,
30
+ chatBotLogo: string,
31
+ entity: { key: string, name: string }[],
32
+ }): void;
33
+
34
+ /** Доменное имя портала */
35
+ domain: string;
36
+ isAdmin: boolean;
37
+
38
+ /** Информация о приложении */
39
+ appInfo: {
40
+ ID: number,
41
+ CODE: string,
42
+ VERSION: number,
43
+ STATUS: string,
44
+ INSTALLED: boolean,
45
+ PAYMENT_EXPIRED: string,
46
+ DAYS: null | number,
47
+ LANGUAGE_ID: string,
48
+ LICENSE: string,
49
+ LICENSE_TYPE: string,
50
+ LICENSE_FAMILY: string
51
+ };
52
+
53
+ /** Параметры приложения */
54
+ appConst: {
55
+ appName: string,
56
+ appNameEng: string,
57
+ pathApp: string,
58
+ zip: string,
59
+ chatBotLogo: string,
60
+ entity: { key: string, name: string }[],
61
+ };
62
+
63
+ /** Информация о текущем пользователе */
64
+ userInfo: Record<string, unknown>;
65
+
66
+ /** Информация о встройках */
67
+ placeData: Record<string, unknown>[];
68
+
69
+ /** Информация о текущем месте встройки */
70
+ placeInfo: {
71
+ placement: string;
72
+ options: Record<string, string>;
73
+ };
74
+
75
+
76
+
77
+ /** Метод инициализации библиотеки rest api BX24 */
78
+ init(): Awaited<Promise<boolean>>;
79
+
80
+ /** Получение\изменение опций юзера.
81
+ *
82
+ * Если передан 'key', то возвращает опцию по ключу. <br>
83
+ * Если передан 'key' и 'value', то функция изменяет ключ по переданному значению.
84
+ */
85
+ userOption<T extends string | number | undefined>(key: string, value?: T): UserOptionReturnType<T>
86
+
87
+
88
+ /** Вызывает указанный метод REST-сервиса с указанными параметрам */
89
+ call({ method, params }: TCommand): Awaited<unknown[] | boolean>;
90
+
91
+ /**
92
+ * Пакетный запрос данных
93
+ * @param commandList - лист команд можно передавать как в виде объекта, так и в виде массива команд
94
+ * @param progressCall - принимает callback в который передается статус загрузки данных в процентах
95
+ */
96
+ batch(
97
+ commandList: Record<string, TCommand>,
98
+ progressCall?: (data:{ percent: number })=>void
99
+ ): Awaited<Record<string, unknown[]> | boolean>;
100
+
101
+ /**
102
+ * Пакетный запрос количества элементов по запрощенным сущностям
103
+ * @param commandList - лист команд можно передавать как в виде объекта, так и в виде массива команд
104
+ * @param progressCall - принимает callback в который передается статус загрузки данных в процентах
105
+ */
106
+ batchTotalCount(
107
+ commandList: Record<string, TCommand>,
108
+ progressCall?: (data:{ percent: number })=>void
109
+ ): Awaited<Record<string, unknown[]> | boolean>;
110
+
111
+ /** Запрос данных о местах встройки приложения */
112
+ getPlacement(): Awaited<unknown[] | boolean>;
113
+
114
+ /** Встройка приложения в place
115
+ *
116
+ * @param place - индификатор места встройки
117
+ */
118
+ placementBind(place: string): void;
119
+
120
+ /** Отвязка встройки из place
121
+ *
122
+ * @param place - индификатор места встройки
123
+ */
124
+ placementUnBind(place: string): Awaited<boolean>;
125
+
126
+ /** Получение списка чат-ботов */
127
+ getBotList(): Awaited<unknown[] | boolean>;
128
+
129
+ /** Регистрация чат-бота
130
+ * @param code - Строковой идентификатор бота, уникальный в рамках вашего приложения
131
+ * @param type - Тип бота, B - чат-бот, ответы поступают сразу, H - человек, ответы поступают с задержкой от 2-х до 10 секунд, O - чат-бот для Открытых линий, S - чат-бот с повышенными привилегиями (supervisor)
132
+ * @param name - Имя чат-бота
133
+ */
134
+ regBot({ code, type, name }:{
135
+ code: string, type: string, name: string
136
+ }): Awaited<unknown | boolean>;
137
+
138
+ /** Удаление чат-бота */
139
+ unRegBot(id: number|string): Awaited<unknown | boolean>;
140
+
141
+ }
142
+
143
+ export default BxBoot;
@@ -1,3 +1,6 @@
1
1
  import Batch from "./batch";
2
+ import BxBoot from "./bx-boot";
2
3
 
3
- export { Batch }
4
+ declare const tempus = {};
5
+
6
+ export { Batch, BxBoot, tempus }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "szdl-utils-kit",
3
3
  "description": "utils-kit library",
4
4
  "private": false,
5
- "version": "0.0.1",
5
+ "version": "0.1.1",
6
6
  "type": "module",
7
7
  "author": "Stanislav Ovv",
8
8
  "license": "BSD",
@@ -34,5 +34,8 @@
34
34
  "vite": "^4.4.5",
35
35
  "vite-plugin-dts": "^3.6.0",
36
36
  "vite-plugin-static-copy": "^0.17.0"
37
+ },
38
+ "dependencies": {
39
+ "tempusjs": "^0.2.18"
37
40
  }
38
41
  }