szdl-utils-kit 0.2.7 → 0.2.8
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 +747 -804
- package/dist/index.umd.cjs +2 -8
- package/package.json +1 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`):e(JSON.parse(a.responseText))):o&&o(a))},a.open("GET",A,!1),a.send()},w={"%d":{format:function(A){return r(A.day()||i.MIN_DAY,2)},parse:function(A){var e=Number(A);return{day:isNaN(e)?t:e}},minLength:2,maxLength:2,type:"number"},"%m":{format:function(A){return r(A.month()||i.MIN_MONTH,2)},parse:function(A){var e=Number(A);return{month:isNaN(e)?t:e}},minLength:2,maxLength:2,type:"number"},"%Y":{format:function(A){return r(A.year()||i.MIN_YEAR,4)},parse:function(A){var e=Number(A);return{year:isNaN(e)?t:e}},minLength:4,maxLength:4,type:"number"},"%w":{format:function(A){return A.dayOfWeek()||i.MIN_DAY_OF_WEEK},parse:function(){return{}},minLength:1,maxLength:1,type:"number"},"%a":{format:function(A){var e=A.dayOfWeek();return CA[e!==t?e:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%A":{format:function(A){var e=A.dayOfWeek();return RA[e!==t?e:i.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%b":{format:function(A){var e=i.options("monthFromZero")?A.month():A.month()-1;return ZA[e!==t?e:i.MIN_MONTH]},parse:function(A){var e=i.monthNames().indexOf(A)+(i.options("monthFromZero")?0:1);return{month:e!==-1?e:t}},minLength:1,maxLength:999,type:"word"},"%B":{format:function(A){var e=i.options("monthFromZero")?A.month():A.month()-1;return X[e!==t?e:i.MIN_MONTH]},parse:function(A){var e=i.monthNames(!0).indexOf(A)+(i.options("monthFromZero")?0:1);return{month:e!==-1?e:t}},minLength:1,maxLength:999,type:"word"},"%H":{format:function(A){return r(A.hours()||i.MIN_HOURS,2)},parse:function(A){var e=Number(A);return{hours:isNaN(e)?t:e}},minLength:2,maxLength:2,type:"number"},"%M":{format:function(A){return r(A.minutes()||i.MIN_MINUTES,2)},parse:function(A){var e=Number(A);return{minutes:isNaN(e)?t:e}},minLength:2,maxLength:2,type:"number"},"%S":{format:function(A){return r(A.seconds()||i.MIN_SECONDS,2)},parse:function(A){var e=Number(A);return{seconds:isNaN(e)?t:e}},minLength:2,maxLength:2,type:"number"},"%s":{format:function(A){return A.timestamp()},parse:function(A){return isNaN(Number(A))?{}:i(Number(A)).get()},minLength:1,maxLength:20,type:"number"},"%F":{format:function(A){return r(A.year()||i.MIN_YEAR,4)+"-"+r(A.month()||i.MIN_MONTH,2)+"-"+r(A.day()||i.MIN_DAY,2)},parse:function(A){var e=Number(A.slice(0,4)),o=Number(A.slice(5,7)),a=Number(A.slice(8,10));return{year:e,month:o,day:a}},minLength:10,maxLength:10,type:"string"},"%D":{format:function(A){return r(A.month()||i.MIN_MONTH,2)+"/"+r(A.day()||i.MIN_DAY,2)+"/"+r(A.year()||i.MIN_YEAR,4)},parse:function(A){var e=Number(A.slice(0,2)),o=Number(A.slice(3,5)),a=Number(A.slice(6,10));return{year:a,month:e,day:o}},minLength:10,maxLength:10,type:"string"}},JA={useMilliseconds:!1,monthFromZero:!1},I;I=function(A,e,o){return this._d=new Date,this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},A!==t&&this.set(A,e,o),this},I.fn=I.prototype,I.fn.dayCount=function(){var A=this.month(),e=i.MAX_DAY_IN_MONTHS[A-(i.options("monthFromZero")?0:1)];return this.leapYear()&&A===(i.options("monthFromZero")?1:2)&&(e+=1),e},I.fn.year=function(A){if(arguments.length!==0)(typeof A=="number"||typeof A=="string")&&!isNaN(Number(A))?Number(A)>=i.MIN_YEAR&&Number(A)<=i.MAX_YEAR?(this._d.setFullYear(Number(A)),this._i.year=!1):this._i.year=Number(A):(this._d.setFullYear(i.MIN_YEAR),this._i.year=!1);else return this._i.year===!1?this._d.getFullYear():this._i.year;return this},I.fn.month=function(A){if(arguments.length!==0)(typeof A=="number"||typeof A=="string")&&!isNaN(Number(A))?Number(A)>=i.MIN_MONTH&&Number(A)<=i.MAX_MONTH?(this._d.setMonth(i.options("monthFromZero")?Number(A):Number(A)-1),this._i.month=!1):this._i.month=Number(A):(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},I.fn.day=function(A){if(arguments.length!==0)(typeof A=="number"||typeof A=="string")&&!isNaN(Number(A))?Number(A)>=i.MIN_DAY&&Number(A)<=this.dayCount()?(this._d.setDate(Number(A)),this._i.day=!1):this._i.day=Number(A):(this._d.setDate(i.MIN_DAY),this._i.day=!1);else return this._i.day===!1?this._d.getDate():this._i.day;return this},I.fn.hours=function(A){if(arguments.length!==0)(typeof A=="number"||typeof A=="string")&&!isNaN(Number(A))?Number(A)>=i.MIN_HOURS&&Number(A)<=i.MAX_HOURS?(this._d.setHours(Number(A)),this._i.hours=!1):this._i.hours=Number(A):(this._d.setHours(i.MIN_HOURS),this._i.hours=!1);else return this._i.hours===!1?this._d.getHours():this._i.hours;return this},I.fn.minutes=function(A){if(arguments.length!==0)(typeof A=="number"||typeof A=="string")&&!isNaN(Number(A))?Number(A)>=i.MIN_MINUTES&&Number(A)<=i.MAX_MINUTES?(this._d.setMinutes(Number(A)),this._i.minutes=!1):this._i.minutes=Number(A):(this._d.setMinutes(i.MIN_MINUTES),this._i.minutes=!1);else return this._i.minutes===!1?this._d.getMinutes():this._i.minutes;return this},I.fn.seconds=function(A){if(arguments.length!==0)(typeof A=="number"||typeof A=="string")&&!isNaN(Number(A))?Number(A)>=i.MIN_SECONDS&&Number(A)<=i.MAX_SECONDS?(this._d.setSeconds(Number(A)),this._i.seconds=!1):this._i.seconds=Number(A):(this._d.setSeconds(i.MIN_SECONDS),this._i.seconds=!1);else return this._i.seconds===!1?this._d.getSeconds():this._i.seconds;return this},I.fn.milliseconds=function(A){if(arguments.length!==0)(typeof A=="number"||typeof A=="string")&&!isNaN(Number(A))?Number(A)>=i.MIN_MILLISECONDS&&Number(A)<=i.MAX_MILLISECONDS?(this._d.setMilliseconds(Number(A)),this._i.milliseconds=!1):this._i.milliseconds=Number(A):(this._d.setMilliseconds(i.MIN_MILLISECONDS),this._i.milliseconds=!1);else return this._i.milliseconds===!1?this._d.getMilliseconds():this._i.milliseconds;return this},I.fn.week=function(){var A=new Date(this.year(),0,1),e=i(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc()*1e3;return Math.ceil(((e-A.getTime())/864e5+A.getDay()+1)/7)},I.fn.set=function(A,e,o){if(this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},A===t)return this._d=new Date,this;if(A instanceof Date)return this._d=A,this;if(typeof A=="number")return this._d=new Date(A*(i.options("useMilliseconds")?1:1e3)),this;if(typeof A=="object"&&(A instanceof Array?(this.day(i.MIN_DAY),this.year(A[0]),this.month(A[1]),this.day(A[2]),this.hours(A[3]),this.minutes(A[4]),this.seconds(A[5]),this.milliseconds(A[6])):(this.day(i.MIN_DAY),this.year(A.year),this.month(A.month),this.day(A.day),this.hours(A.hours),this.minutes(A.minutes),this.seconds(A.seconds),this.milliseconds(A.milliseconds))),typeof A=="string"){var a,M=[],N,y,x=[],D=0,b=0,T,J,p={},Y;if(A===t)return N=c(this,o),N===t&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),N;for(e===t&&(e=i.detectFormat(A));D<e.length;){if(e.charAt(D)==="%"){if(y=e.charAt(D)+e.charAt(D+1),w[y]!==t){switch(T=0,J="",w[y].type){case"number":for(;T<w[y].maxLength&&b+T<A.length&&!isNaN(Number(A.charAt(b+T)));)J+=A.charAt(b+T),T+=1;break;case"word":for(;T<w[y].maxLength&&b+T<A.length&&/^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(A.charAt(b+T));)J+=A.charAt(b+T),T+=1;break;case"string":for(;T<w[y].maxLength&&b+T<A.length;)J+=A.charAt(b+T),T+=1;break}if(T<w[y].minLength)return N=c(this,o),N===t&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),N;M.push(y),x.push(J),T-=1,b+=T,D+=1}}else if(A.charAt(b)!==e.charAt(D))return N=c(this,o),N===t&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),N;D+=1,b+=1}for(a in M)M.hasOwnProperty(a)&&w.hasOwnProperty(M[a])&&(Y=w[M[a]].parse(x[a]),p={year:Y.year!==t?Y.year:p.year,month:Y.month!==t?Y.month:p.month,day:Y.day!==t?Y.day:p.day,hours:Y.hours!==t?Y.hours:p.hours,minutes:Y.minutes!==t?Y.minutes:p.minutes,seconds:Y.seconds!==t?Y.seconds:p.seconds});this.day(i.MIN_DAY),this.year(p.year),this.month(p.month),this.day(p.day),this.hours(p.hours),this.minutes(p.minutes),this.seconds(p.seconds),this.milliseconds(p.milliseconds)}return this},I.fn.leapYear=function(){var A=this.year();return A%4===0?A%100===0?A%400===0:!0:!1},I.fn.timestamp=function(A){return arguments.length!==0?(this._d=new Date(Number(A)*(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},I.fn.utc=function(A){return arguments.length!==0?(this._d=new Date(Number(A)*(i.options("useMilliseconds")?1:1e3)),this):i.options("useMilliseconds")?this._d.getTime():Math.floor(this._d.getTime()/1e3)},I.fn.dayOfWeek=function(A){if(A==="long")return RA[this._d.getDay()];if(A==="short")return CA[this._d.getDay()];if(A===t)return this._d.getDay();if(A===0||A==="Sunday")return this.calc({day:-this.dayOfWeek()});if(A===1||A==="Monday")return this.calc({day:(this.dayOfWeek()===0?-6:1)-this.dayOfWeek()});if(A===2||A==="Tuesday")return this.calc({day:(this.dayOfWeek()===0?-5:2)-this.dayOfWeek()});if(A===3||A==="Wednesday")return this.calc({day:(this.dayOfWeek()===0?-4:3)-this.dayOfWeek()});if(A===4||A==="Thursday")return this.calc({day:(this.dayOfWeek()===0?-3:4)-this.dayOfWeek()});if(A===5||A==="Friday")return this.calc({day:(this.dayOfWeek()===0?-2:5)-this.dayOfWeek()});if(A===6||A==="Saturday")return this.calc({day:(this.dayOfWeek()===0?-1:6)-this.dayOfWeek()})},I.fn.timezone=function(A){switch(A){case"hours":return Math.floor(this._d.getTimezoneOffset()/60);case"minutes":return this._d.getTimezoneOffset();default:return this._d.getTimezoneOffset()*60}},I.fn.get=function(A){switch(A){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()}}},I.fn.format=function(A){for(var e=0,o="",a;e<A.length;)A.charAt(e)==="%"?(a=A.charAt(e)+A.charAt(e+1),w[a]!==t?(o+=w[a].format(this),e+=1):o+="%"):o+=A.charAt(e),e+=1;return o},I.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},I.fn.errors=function(){return this._i},I.fn.between=function(A,e){var o=this.timestamp(),a=A.timestamp();switch(e){case"year":return Math.floor((a-o)/31556952);case"month":return Math.floor((a-o)/2629746);case"day":return Math.floor((a-o)/86400);case"hours":return Math.floor((a-o)/3600);case"minutes":return Math.floor((a-o)/60);case"seconds":return a-o;default:return t}},I.fn.calc=function(A){return A.year!==t&&this._d.setFullYear(this._d.getFullYear()+A.year),A.month!==t&&this._d.setMonth(this._d.getMonth()+A.month),A.day!==t&&this._d.setDate(this._d.getDate()+A.day),A.hours!==t&&this._d.setHours(this._d.getHours()+A.hours),A.minutes!==t&&this._d.setMinutes(this._d.getMinutes()+A.minutes),A.seconds!==t&&this._d.setSeconds(this._d.getSeconds()+A.seconds),A.milliseconds!==t&&this._d.setMilliseconds(this._d.getMilliseconds()+A.milliseconds),this},i=function(A,e,o){return new I(A,e,o)},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(A,e){if(A===t)return JA;if(JA.hasOwnProperty(A)){if(e===t)return JA[A];JA[A]=e,A==="monthFromZero"&&(i.MIN_MONTH=e?0:1,i.MAX_MONTH=e?11:12)}return t},i.noConflict=function(){return n.tempus=u,i},i.generate=function(A){var e,o,a,M,N,y,x,D;if(typeof A.dateFrom!="number"&&(A.dateFrom instanceof I?e=A.dateFrom.utc():e=i(A.dateFrom,A.formatFrom).utc()),typeof A.dateTo!="number"&&(A.dateTo instanceof I?o=A.dateTo.utc():o=i(A.dateTo,A.formatTo!==t?A.formatTo:A.formatFrom).utc()),typeof A.period=="number"?N={year:0,month:0,day:0,hours:0,minutes:0,seconds:A.period}:typeof A.period=="string"?N={year:A.period==="year"?1:0,month:A.period==="month"?1:0,day:A.period==="day"?1:0,hours:A.period==="hours"?1:0,minutes:A.period==="minutes"?1:0,seconds:A.period==="seconds"?1:0}:typeof A.period=="object"&&(N={year:A.period.year!==t?A.period.year:0,month:A.period.month!==t?A.period.month:0,day:A.period.day!==t?A.period.day:0,hours:A.period.hours!==t?A.period.hours:0,minutes:A.period.minutes!==t?A.period.minutes:0,seconds:A.period.seconds!==t?A.period.seconds:0}),A.groupBy===t?y=A.asObject===!0?{}:[]:(y=[],y.push([]),x=i(e).get()[A.groupBy]),D=function(J,p,Y){return A.asObject===!0?A.format!==t?J[i(p).format(A.format)]={}:J[i(p).format("%F %H:%M:%S")]={}:A.format!==t?J.push(Y?null:i(p).format(A.format)):J.push(Y?null:i(p)),J},A.groupBy!==t&&A.fillNulls){var b={year:N.year?-N.year:t,month:N.month?-N.month:t,day:N.day?-N.day:t,hours:N.hours?-N.hours:t,minutes:N.minutes?-N.minutes:t,seconds:N.seconds?-N.seconds:t,milliseconds:N.milliseconds?-N.milliseconds:t};for(a=i(e).calc(b).utc();i(a).get()[A.groupBy]===x;)D(y[y.length-1],a,!0),a=i(a).calc(b).utc();if(A.groupBy==="week"){var T=i(e).dayOfWeek();for(a=i(e).dayOfWeek(0).utc();y[0].length<T&&a<e;)D(y[y.length-1],a,!0),a=i(a).calc(N).utc()}}for(;e<=o;)A.groupBy===t?D(y,e):i(e).get()[A.groupBy]===x?D(y[y.length-1],e):(y.push([]),D(y[y.length-1],e),x=i(e).get()[A.groupBy]),e=i(e).calc(N).utc();if(A.groupBy!==t&&A.fillNulls)for(M=i(o).calc(N).utc();i(M).get()[A.groupBy]===x;)D(y[y.length-1],M,!0),M=i(M).calc(N).utc();return y},i.monthNames=function(A){switch(A){case"long":return X;default:return ZA}},i.dayNames=function(A){switch(A){case"long":return RA;default:return CA}},i.lang=function(A){if(A!==t)m=A,g[m]===t&&(m="en"),X=Z(),ZA=yA(),RA=nA(),CA=j();else return m;return t},i.availableLangs=function(){return Object.keys(g)},i.registerFormat=function(A,e,o,a,M,N){w[A]={format:e,parse:o,minLength:a,maxLength:M,type:N}},i.unregisterFormat=function(A){delete w[A]},i.detectFormat=function(A){var e,o,a;return e=O(A,0),e!==""&&(a=10),o=A.charAt(a),(o==="T"||o===" ")&&(e+=o,a+=1),e+=l(A,a),e},d={TempusDate:I},i.classes=function(A,e){if(e===t)return d[A];d[A]=e},i.loadTranslations=function(A){typeof A=="object"?g=A:typeof A=="string"&&Rt(A,function(e){g=e},function(e){})},m=(R.language||R.systemLanguage||R.userLanguage||"en").substr(0,2).toLowerCase(),g[m]===t&&(m="en"),X=Z(),ZA=yA(),RA=nA(),CA=j(),G.exports&&(s=G.exports=i),s.tempus=i}).call(S)})(oA,oA.exports);var Ot=oA.exports;const TA=C(Ot);class V{constructor(s,t={}){E(this,hA);E(this,mA);E(this,uA);E(this,gA);E(this,EA);E(this,fA);E(this,YA);E(this,DA);E(this,OA);E(this,NA);E(this,BA);E(this,aA);E(this,SA);E(this,LA);E(this,sA);E(this,cA);E(this,dA);E(this,K,null);E(this,lA,null);E(this,z,[]);E(this,L,{});E(this,W,50);E(this,v,!0);E(this,$,null);E(this,Q,null);E(this,P,null);E(this,pA,100);E(this,AA,"no");E(this,k,!1);E(this,tA,!1);E(this,eA,!1);U(this,"errors",{});U(this,"answerData",{});_(this,K,s),_(this,lA,t)}get serial(){return h(this,k)}setSerial(){_(this,k,!0),_(this,tA,!0),_(this,eA,!1)}setParallel(){_(this,k,!1),_(this,tA,!1),_(this,eA,!0)}stop(){_(this,v,!1)}async batch(s,t){h(this,P)&&f(this,mA,xA).call(this),t&&_(this,$,t),h(this,tA)===!1&&_(this,k,!1),Object.keys(s).length>500&&_(this,k,!0),_(this,v,!0),_(this,z,[]),_(this,L,{}),this.errors={},this.answerData={};const n=f(this,gA,zA).call(this,s);if(Object.keys(s).length<500){const r=n.map((c,l)=>f(this,EA,vA).call(this,c,n[l]));return Promise.allSettled(r).then(c=>{let l={};for(let O of c)O.status==="fulfilled"&&(l={...l,...O.value});return l})}else{let r={},c=0,l=1,O=Object.keys(s).length||1,u=i=>{c+=Object.keys(i).length,l=Math.round(c/O*100)};for(let[i,d]of Object.entries(n)){let R=await f(this,EA,vA).call(this,d,n[i],!0);u(d),t&&t({percent:l}),r={...r,...R}}return r}}async batchTotalCount(s,t){_(this,L,{}),this.errors={};let n=1,r=0,c=Object.keys(s).length||1,l=u=>{r+=Object.keys(u).length,n=Math.round(r/c*100)};t&&t({percent:n});const O=f(this,gA,zA).call(this,s);if(h(this,eA)){const u=O.map(i=>f(this,fA,$A).call(this,i).then(d=>(l(i),t&&t({percent:n}),d)));return Promise.allSettled(u).then(i=>{let d={};for(let R of i)R.status==="fulfilled"&&(d={...d,...R.value});return d})}else{let u={};for(let i of O){let d=await f(this,fA,$A).call(this,i);l(i),t&&t({percent:n}),u={...u,...d}}return u}}}K=new WeakMap,lA=new WeakMap,z=new WeakMap,L=new WeakMap,W=new WeakMap,v=new WeakMap,$=new WeakMap,Q=new WeakMap,P=new WeakMap,pA=new WeakMap,AA=new WeakMap,k=new WeakMap,tA=new WeakMap,eA=new WeakMap,hA=new WeakSet,FA=function(){let s=0;if(!h(this,Q))return Math.round(s);let t=0,n=0;return Object.values(h(this,Q)).forEach(r=>{const{total:c,count:l}=r;t+=c??0,n+=l??0}),t?s=n/t*100:s=100,{percent:Math.round(s),allCount:n,allTotal:t}},mA=new WeakSet,xA=function(){clearInterval(h(this,P)),_(this,P,""),_(this,Q,""),_(this,$,""),_(this,AA,"no")},uA=new WeakSet,KA=function({key:s,value:t}){const n=f(this,sA,MA).call(this,t.data()),r=Array.isArray(n)?n.length:0,c=f(this,cA,VA).call(this,t.total(),r);let l=1;n&&(l=r),h(this,$)&&(h(this,Q)||_(this,Q,{}),h(this,Q)[s]&&h(this,Q)[s].count&&(l+=h(this,Q)[s].count),h(this,Q)[s]={total:c,count:l},h(this,P)||_(this,P,setInterval(()=>{const{percent:O,allCount:u,allTotal:i}=h(this,hA,FA);(h(this,AA)==="no"||h(this,AA)<h(this,hA,FA).percent)&&(h(this,$).call(this,{data:h(this,Q),percent:O,allCount:u,allTotal:i}),_(this,AA,h(this,hA,FA).percent)),O===100&&f(this,mA,xA).call(this)},h(this,pA))))},gA=new WeakSet,zA=function(s){const t=[],n=Object.entries(s);for(let r=0;r<n.length;r+=h(this,W)){const c=n.slice(r,r+h(this,W));t.push(Object.fromEntries(c))}return t},EA=new WeakSet,vA=function(s,t,n){return new Promise(r=>{const c=f(this,SA,st).call(this,t),l=[];let O=0,u=0;h(this,K).call(this,s,i=>{Object.entries(i).forEach(([d,R])=>{let m={};const g=R.error();if(g){let{query:{method:j},answer:X}=R;this.errors[d]={error:g,method:j},O+=1}if(R!=null&&R.answer&&Object.keys(R.answer).length){for(let[j,X]of Object.entries(R.answer))j!="result"&&X&&(m[j]=X);Object.keys(m).length&&(this.answerData[d]=m)}const Z=f(this,sA,MA).call(this,R.data()),yA=Array.isArray(Z)?Z.length:0,nA=f(this,cA,VA).call(this,R.total(),yA);if(Array.isArray(Z)?h(this,L)[d]=Z:typeof Z=="object"&&Z!==null&&Object.keys(Z).length===0?h(this,L)[d]=[]:h(this,L)[d]=Z,u+=nA,n||f(this,uA,KA).call(this,{key:d,value:R}),nA>h(this,W)&&nA>yA){const j=Math.ceil(nA/h(this,W))-1,X=Array.from({length:j});l.push([d,c[d],X])}}),u>5e3&&h(this,tA)===!1&&h(this,eA)===!1&&_(this,k,!0),O>0&&f(this,dA,it).call(this),l.length?(f(this,YA,ht).call(this,l),f(this,DA,at).call(this).then(()=>r(f(this,aA,XA).call(this)))):r(f(this,aA,XA).call(this))})})},fA=new WeakSet,$A=function(s){return new Promise(t=>{const n=f(this,SA,st).call(this,s);let r=0;h(this,K).call(this,n,c=>{Object.entries(c).forEach(([l,O])=>{const u=O.error();u&&(this.errors[l]=u,r+=1);const i=f(this,sA,MA).call(this,O.data()),d=Array.isArray(i)?i.length:0,R=f(this,cA,VA).call(this,O.total(),d);h(this,L)[l]=R}),r>0&&f(this,dA,it).call(this),t(f(this,aA,XA).call(this))})})},YA=new WeakSet,ht=function(s){let t=[];s.forEach(([n,r,c])=>{c.forEach((l,O)=>{const u=O+1,i=h(this,W)*u,R=[[n,u].join("_"),f(this,LA,ct).call(this,r,i)];t.length===h(this,W)?(h(this,z).push(t),t=[R]):t.push(R)})}),t.length&&h(this,z).push(t)},DA=new WeakSet,at=function(){const s=[],t=[],n=r=>{Object.entries(r).forEach(([c,l])=>{const[O]=c.split("_"),u=f(this,sA,MA).call(this,l.data());Array.isArray(u)&&h(this,L)[O].push(...u),f(this,uA,KA).call(this,{key:O,value:l})})};return h(this,z).forEach((r,c)=>{const l=Object.fromEntries(r),O=()=>new Promise(u=>h(this,K).call(this,l,i=>{h(this,k)?n(i):t[c]=i,u()}));s.push(O)}),h(this,k)?f(this,NA,tt).call(this,s):f(this,BA,et).call(this,s).then(()=>{t.forEach(n)})},OA=new WeakSet,At=function(){return new Promise(s=>setTimeout(s,500))},NA=new WeakSet,tt=function(s){if(!s.length)return Promise.resolve();const t=s.shift();return Promise.allSettled([t(),f(this,OA,At).call(this)]).then(()=>h(this,v)?f(this,NA,tt).call(this,s):Promise.resolve())},BA=new WeakSet,et=function(s){if(!s.length)return Promise.resolve();const t=s.shift();return f(this,OA,At).call(this).then(()=>t()).then(()=>h(this,v)?f(this,BA,et).call(this,s):Promise.resolve())},aA=new WeakSet,XA=function(){return Object.entries(h(this,lA)).forEach(([s,t])=>{h(this,L)[s]&&(h(this,L)[s]=t(h(this,L)[s]))}),h(this,L)},SA=new WeakSet,st=function(s){return Object.entries(s).reduce((t,[n,r])=>{if(Array.isArray(r)){const[c,l={}]=r;t[n]=[c,l]}else{const{method:c,params:l={}}=r;t[n]=[c,l]}return t},{})},LA=new WeakSet,ct=function(s,t){const[n,r]=s;return[n,{start:t,...r}]},sA=new WeakSet,MA=function(s){return((s==null?void 0:s.items)||(s==null?void 0:s.documents))??s},cA=new WeakSet,VA=function(s,t){return s!==s&&(s=0),s===0&&t===0?0:s||t},dA=new WeakSet,it=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(this.errors).forEach(([s,t])=>{console.info(`[${s}]`,t.toString())}),console.groupEnd()};var Nt={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEA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QashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZ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AAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"};const{webm:Bt,mp4:St}=Nt,WA=()=>typeof navigator<"u"&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,jA=()=>"wakeLock"in navigator;class dt{constructor(){if(this.enabled=!1,jA()){this._wakeLock=null;const s=()=>{this._wakeLock!==null&&document.visibilityState==="visible"&&this.enable()};document.addEventListener("visibilitychange",s),document.addEventListener("fullscreenchange",s)}else WA()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",Bt),this._addSourceToVideo(this.noSleepVideo,"mp4",St),this.noSleepVideo.addEventListener("loadedmetadata",()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())})}))}_addSourceToVideo(s,t,n){var r=document.createElement("source");r.src=n,r.type=`video/${t}`,s.appendChild(r)}get isEnabled(){return this.enabled}enable(){return jA()?navigator.wakeLock.request("screen").then(s=>{this._wakeLock=s,this.enabled=!0,console.log("Wake Lock active."),this._wakeLock.addEventListener("release",()=>{console.log("Wake Lock released.")})}).catch(s=>{throw this.enabled=!1,console.error(`${s.name}, ${s.message}`),s}):WA()?(this.disable(),console.warn(`
|
|
3
|
-
NoSleep enabled for older iOS devices. This can interrupt
|
|
4
|
-
active or long-running network requests from completing successfully.
|
|
5
|
-
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
|
|
6
|
-
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(t=>(this.enabled=!0,t)).catch(t=>{throw this.enabled=!1,t})}disable(){jA()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):WA()?this.noSleepTimer&&(console.warn(`
|
|
7
|
-
NoSleep now disabled for older iOS devices.
|
|
8
|
-
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}var It=dt;const _t=C(It);class nt{constructor(){E(this,iA,{})}get hash(){return this.createHash(8)}createHash(s){let t="abcdefghijklmnopqrstuvwxyz0123456789",n="";s=s||6;for(let r=0;r<s;r++)n+=t.charAt(Math.floor(Math.random()*t.length));return n}actionFilter({keyTimer:s,duration:t=10,action:n}){h(this,iA)[s]&&(clearTimeout(h(this,iA)[s]),h(this,iA)[s]=null),n&&(h(this,iA)[s]=setTimeout(()=>{n()},t))}}iA=new WeakMap;const PA=new nt;class ot{constructor(){E(this,QA);E(this,_A);E(this,GA);E(this,HA);E(this,wA);E(this,F,"logger");E(this,q,!1);E(this,bA,2e3);E(this,rA,new Map);E(this,IA,{});U(this,"periodClear",3);f(this,QA,lt).call(this)}async init(){let s=new V(BX24.callBatch),{entityList:t}=await s.batch({entityList:{method:"entity.get"}});if(t!=null&&t.length)if(t.find(r=>r.ENTITY==h(this,F)))_(this,q,!0);else{let{entityAdd:r}=await s.batch({entityAdd:{method:"entity.add",params:{ENTITY:h(this,F),NAME:h(this,F),ACCESS:{AU:"X"}}}});r&&_(this,q,!0)}return f(this,HA,ut).call(this),h(this,q)}start({type:s,data:t}){if(!h(this,q)){f(this,_A,rt).call(this,"entity");return}const n=PA.hash;return h(this,rA).set(n,{type:s,data:t,userInfo:h(this,IA),errorList:[],status:"",answer:null,date:new Date().getTime()}),n}stop({key:s,errorList:t,status:n,answer:r}){if(!h(this,q)){f(this,_A,rt).call(this,"entity");return}let c=h(this,rA).get(s);t&&(c.errorList=t),n&&(c.status=n),r&&(c.answer=r),PA.actionFilter({keyTimer:"add.entity.items",duration:h(this,bA),action:()=>{f(this,GA,mt).call(this)}})}async getEntityList(){let s=new V(BX24.callBatch),{entityList:t}=await s.batch({entityList:{method:"entity.item.get",params:{ENTITY:h(this,F),SORT:{ID:"DESC"}}}});return t=t.map(n=>{const{ID:r,DATE_CREATE:c,DETAIL_TEXT:l}=n;return{...JSON.parse(l),id:r,dateCreate:c}}),t}}F=new WeakMap,q=new WeakMap,bA=new WeakMap,rA=new WeakMap,IA=new WeakMap,QA=new WeakSet,lt=async function(){const s=new V(BX24.callBatch),t=BX24.isAdmin(),{curUser:n}=await s.batch({curUser:{method:"user.current"}});_(this,IA,{isAdmin:t,curUser:n})},_A=new WeakSet,rt=function(s){s=="entity"&&PA.actionFilter({keyTimer:"error.logger.entity",duration:500,action:()=>{console.error("Хранилище для логгера не инициализировано")}})},GA=new WeakSet,mt=async function(){let s={},t=new V(BX24.callBatch);for(let[n,r]of h(this,rA).entries())r.status&&(s[n]={method:"entity.item.add",params:{ENTITY:h(this,F),NAME:h(this,F),DETAIL_TEXT:JSON.stringify(r)}});if(Object.keys(s).length){let n=await t.batch(s),{errors:r}=t;for(let[c,l]of Object.entries({...n,...r}))h(this,rA).delete(c)}},HA=new WeakSet,ut=async function(){let s=new V(BX24.callBatch),t=await this.getEntityList(),{serverTime:n}=await s.batch({serverTime:{method:"server.time"}}),r=t.filter(c=>{let{dateCreate:l}=c;return TA(new Date(l)).between(TA(new Date(n)),"month")>=this.periodClear});f(this,wA,gt).call(this,r)},wA=new WeakSet,gt=async function(s){let t=new V(BX24.callBatch),n=s.map(r=>{let{id:c}=r;return{method:"entity.item.delete",params:{ENTITY:h(this,F),ID:c}}});return await t.batch(n)};const H=new ot;class yt{constructor(s){E(this,UA);E(this,kA);U(this,"domain","");U(this,"isAdmin",!1);U(this,"appInfo",null);U(this,"appConst",null);U(this,"userInfo",null);U(this,"placeData",null);U(this,"placeInfo",null);U(this,"noSleep",null);this.appConst=s}init(){return new Promise(s=>{let t=setInterval(()=>{window.BX24&&BX24.init(async()=>{console.info("init BX24"),clearInterval(t),this.domain=BX24.getDomain(),this.isAdmin=BX24.isAdmin(),this.placeInfo=BX24.placement.info(),await H.init();const[n,r]=await Promise.all([f(this,UA,Et).call(this),f(this,kA,ft).call(this)]);this.appInfo=n,this.userInfo=r,this.noSleep=new _t,this.noSleep.enable(),s(!0)})},100)})}userOption(s,t){return t?BX24.userOption.set(s,t):BX24.userOption.get(s)}call({method:s,params:t,updateList:n}){let r=H.start({type:"call",data:{method:s,params:t,updateList:n}});return new Promise(c=>{t||(t={}),BX24.callMethod(s,t,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),H.stop({answer:O,key:r,status:"fail",errorList:[u.toSting()]}),c(!1)}else{let u=l.data();u!=null&&u.items&&(u=u.items),H.stop({answer:O,key:r,status:"success"}),c(u)}})})}async batch(s,t,{updateList:n,errorCall:r}={}){let c=new V(BX24.callBatch),l=H.start({type:"batch",data:{commandList:s,updateList:n}});try{let O=await c.batch(s,t);if(Object.keys(c.errors).length){let u=Object.entries(c.errors).map(([i,d])=>({key:i,error:d.toSting()}));r&&r(c.errors),H.stop({key:l,status:"fail",errorList:u,answer:c.answerData})}else H.stop({key:l,status:"success",answer:c.answerData});return O}catch(O){return H.stop({key:l,status:"fail-runtime",errorList:[O.toSting()],answer:c.answerData}),console.error(O),!1}}async batchTotalCount(s,t){let n=new V(BX24.callBatch),r=H.start({type:"batch",data:{commandList:s}});try{let c=await n.batchTotalCount(s,t);if(Object.keys(n.errors).length){let l=Object.entries(n.errors).map(([O,u])=>({key:O,error:u.toSting()}));H.stop({key:r,status:"fail",errorList:l})}else H.stop({key:r,status:"success"});return c}catch(c){return H.stop({key:r,status:"fail",errorList:[c.toSting()]}),console.error(c),!1}}getPlacement(){return this.call({method:"placement.get"}).then(s=>(this.placeData||(this.placeData=s),s))}async placementBind(s){this.placeData||(this.placeData=await this.getPlacement());const{appName:t,pathApp:n}=this.appConst,r=this.placeData.map(l=>l.placement);let c=this.placeData.find(l=>l.placement==s);r.includes(s)?c.handler!=n&&(window.placementUnBind||(window.placementUnBind={}),window.placementUnBind[s]||this.placementUnBind(c).then(()=>{window.placementUnBind[s]||(window.placementUnBind[s]=!0,this.placementBind(s))})):this.call({method:"placement.bind",params:{PLACEMENT:s,HANDLER:n,LANG_ALL:{ru:{TITLE:t}}}}).then(l=>{l?console.info("Приложение успешно встроено в",s):console.warn("Приложение не может быть встроено в",s)})}placementUnBind(s){const{pathApp:t,appName:n}=this.appConst;return this.call({method:"placement.unbind",params:{PLACEMENT:s,HANDLER:t,LANG_ALL:{ru:{TITLE:n}}}}).then(r=>(console.log("Встройка отвязана",s),r))}getBotList(){return this.call({method:"imbot.bot.list",params:{}}).then(s=>{let t=Object.values(s);return console.log("chat-bot list:",t),t})}regBot({code:s,type:t,name:n}){const{appName:r,pathApp:c,chatBotLogo:l}=this.appConst,O=this.appInfo.ID;return this.call({method:"imbot.register",params:{CODE:s??this.appInfo.CODE,TYPE:t??"O",EVENT_HANDLER:c,OPENLINE:"Y",CLIENT_ID:"",PROPERTIES:{NAME:`${n??r} - бот #${O}`,LAST_NAME:"",COLOR:"GREEN",EMAIL:"",PERSONAL_BIRTHDAY:TA().format("%Y-%m-%d"),WORK_POSITION:"Почтальон",PERSONAL_WWW:"",PERSONAL_GENDER:"M",PERSONAL_PHOTO:l??""}}}).then(u=>(console.log("Чат-бот добавлен",u),u))}unRegBot(s){return this.call({method:"imbot.unregister",params:{BOT_ID:s}}).then(t=>(console.log("чат-бот удален",t),t))}}UA=new WeakSet,Et=function(){return this.call({method:"app.info"})},kA=new WeakSet,ft=function(){return this.call({method:"user.current"})},B.Batch=V,B.BxBoot=yt,B.BxHelper=nt,B.BxLogger=ot,B.tempus=TA,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
var Ae=Object.defineProperty;var Te=(T,S,L)=>S in T?Ae(T,S,{enumerable:!0,configurable:!0,writable:!0,value:L}):T[S]=L;var W=(T,S,L)=>(Te(T,typeof S!="symbol"?S+"":S,L),L),zt=(T,S,L)=>{if(!S.has(T))throw TypeError("Cannot "+L)};var a=(T,S,L)=>(zt(T,S,"read from private field"),L?L.call(T):S.get(T)),_=(T,S,L)=>{if(S.has(T))throw TypeError("Cannot add the same private member more than once");S instanceof WeakSet?S.add(T):S.set(T,L)},E=(T,S,L,ht)=>(zt(T,S,"write to private field"),ht?ht.call(T,L):S.set(T,L),L);var O=(T,S,L)=>(zt(T,S,"access private method"),L);(function(T,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(T=typeof globalThis<"u"?globalThis:T||self,S(T["szdl-utils-kit"]={}))})(this,function(T){var q,ut,Q,I,x,v,$,B,V,Dt,tt,P,et,st,at,Xt,mt,Vt,ft,Zt,Nt,Kt,_t,qt,Ot,Qt,Ht,oe,Yt,he,yt,vt,At,$t,Tt,te,ct,jt,St,ee,It,ae,rt,pt,lt,kt,dt,se,it,X,Z,Ut,nt,gt,Bt,ce,Et,re,Gt,le,wt,ue,Ct,me,Pt,fe,Ft,Ne;"use strict";var S=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function L(w){return w&&w.__esModule&&Object.prototype.hasOwnProperty.call(w,"default")?w.default:w}var ht={exports:{}};(function(w,i){(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 o=this,n=function(t,s){for(var h=t.toString();h.length<s;)h="0"+h;return h},l=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},u=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},y=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):"")},f=o.tempus,r,d,M=o.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"}},F=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]},Rt=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]},z=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]},j,Jt,Mt,Lt,ye=function(t,s,h){var c;o.XMLHttpRequest?c=new XMLHttpRequest:c=new ActiveXObject("Microsoft.XMLHTTP"),c.onreadystatechange=function(){c.readyState===4&&(c.status===200?s&&(o.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()},C={"%d":{format:function(t){return n(t.day()||r.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 n(t.month()||r.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 n(t.year()||r.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()||r.MIN_DAY_OF_WEEK},parse:function(){return{}},minLength:1,maxLength:1,type:"number"},"%a":{format:function(t){var s=t.dayOfWeek();return Lt[s!==e?s:r.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%A":{format:function(t){var s=t.dayOfWeek();return Mt[s!==e?s:r.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%b":{format:function(t){var s=r.options("monthFromZero")?t.month():t.month()-1;return Jt[s!==e?s:r.MIN_MONTH]},parse:function(t){var s=r.monthNames().indexOf(t)+(r.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%B":{format:function(t){var s=r.options("monthFromZero")?t.month():t.month()-1;return j[s!==e?s:r.MIN_MONTH]},parse:function(t){var s=r.monthNames(!0).indexOf(t)+(r.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%H":{format:function(t){return n(t.hours()||r.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 n(t.minutes()||r.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 n(t.seconds()||r.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))?{}:r(Number(t)).get()},minLength:1,maxLength:20,type:"number"},"%F":{format:function(t){return n(t.year()||r.MIN_YEAR,4)+"-"+n(t.month()||r.MIN_MONTH,2)+"-"+n(t.day()||r.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 n(t.month()||r.MIN_MONTH,2)+"/"+n(t.day()||r.MIN_DAY,2)+"/"+n(t.year()||r.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"}},Wt={useMilliseconds:!1,monthFromZero:!1},g;g=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},g.fn=g.prototype,g.fn.dayCount=function(){var t=this.month(),s=r.MAX_DAY_IN_MONTHS[t-(r.options("monthFromZero")?0:1)];return this.leapYear()&&t===(r.options("monthFromZero")?1:2)&&(s+=1),s},g.fn.year=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=r.MIN_YEAR&&Number(t)<=r.MAX_YEAR?(this._d.setFullYear(Number(t)),this._i.year=!1):this._i.year=Number(t):(this._d.setFullYear(r.MIN_YEAR),this._i.year=!1);else return this._i.year===!1?this._d.getFullYear():this._i.year;return this},g.fn.month=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=r.MIN_MONTH&&Number(t)<=r.MAX_MONTH?(this._d.setMonth(r.options("monthFromZero")?Number(t):Number(t)-1),this._i.month=!1):this._i.month=Number(t):(this._d.setMonth(r.options("monthFromZero")?r.MIN_MONTH:r.MIN_MONTH-1),this._i.month=!1);else return this._i.month===!1?r.options("monthFromZero")?this._d.getMonth():this._d.getMonth()+1:this._i.month;return this},g.fn.day=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=r.MIN_DAY&&Number(t)<=this.dayCount()?(this._d.setDate(Number(t)),this._i.day=!1):this._i.day=Number(t):(this._d.setDate(r.MIN_DAY),this._i.day=!1);else return this._i.day===!1?this._d.getDate():this._i.day;return this},g.fn.hours=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=r.MIN_HOURS&&Number(t)<=r.MAX_HOURS?(this._d.setHours(Number(t)),this._i.hours=!1):this._i.hours=Number(t):(this._d.setHours(r.MIN_HOURS),this._i.hours=!1);else return this._i.hours===!1?this._d.getHours():this._i.hours;return this},g.fn.minutes=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=r.MIN_MINUTES&&Number(t)<=r.MAX_MINUTES?(this._d.setMinutes(Number(t)),this._i.minutes=!1):this._i.minutes=Number(t):(this._d.setMinutes(r.MIN_MINUTES),this._i.minutes=!1);else return this._i.minutes===!1?this._d.getMinutes():this._i.minutes;return this},g.fn.seconds=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=r.MIN_SECONDS&&Number(t)<=r.MAX_SECONDS?(this._d.setSeconds(Number(t)),this._i.seconds=!1):this._i.seconds=Number(t):(this._d.setSeconds(r.MIN_SECONDS),this._i.seconds=!1);else return this._i.seconds===!1?this._d.getSeconds():this._i.seconds;return this},g.fn.milliseconds=function(t){if(arguments.length!==0)(typeof t=="number"||typeof t=="string")&&!isNaN(Number(t))?Number(t)>=r.MIN_MILLISECONDS&&Number(t)<=r.MAX_MILLISECONDS?(this._d.setMilliseconds(Number(t)),this._i.milliseconds=!1):this._i.milliseconds=Number(t):(this._d.setMilliseconds(r.MIN_MILLISECONDS),this._i.milliseconds=!1);else return this._i.milliseconds===!1?this._d.getMilliseconds():this._i.milliseconds;return this},g.fn.week=function(){var t=new Date(this.year(),0,1),s=r(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc()*1e3;return Math.ceil(((s-t.getTime())/864e5+t.getDay()+1)/7)},g.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*(r.options("useMilliseconds")?1:1e3)),this;if(typeof t=="object"&&(t instanceof Array?(this.day(r.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(r.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=[],A,R,K=[],Y=0,U=0,b,J,D={},H;if(t===e)return A=l(this,h),A===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),A;for(s===e&&(s=r.detectFormat(t));Y<s.length;){if(s.charAt(Y)==="%"){if(R=s.charAt(Y)+s.charAt(Y+1),C[R]!==e){switch(b=0,J="",C[R].type){case"number":for(;b<C[R].maxLength&&U+b<t.length&&!isNaN(Number(t.charAt(U+b)));)J+=t.charAt(U+b),b+=1;break;case"word":for(;b<C[R].maxLength&&U+b<t.length&&/^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(U+b));)J+=t.charAt(U+b),b+=1;break;case"string":for(;b<C[R].maxLength&&U+b<t.length;)J+=t.charAt(U+b),b+=1;break}if(b<C[R].minLength)return A=l(this,h),A===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),A;p.push(R),K.push(J),b-=1,U+=b,Y+=1}}else if(t.charAt(U)!==s.charAt(Y))return A=l(this,h),A===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),A;Y+=1,U+=1}for(c in p)p.hasOwnProperty(c)&&C.hasOwnProperty(p[c])&&(H=C[p[c]].parse(K[c]),D={year:H.year!==e?H.year:D.year,month:H.month!==e?H.month:D.month,day:H.day!==e?H.day:D.day,hours:H.hours!==e?H.hours:D.hours,minutes:H.minutes!==e?H.minutes:D.minutes,seconds:H.seconds!==e?H.seconds:D.seconds});this.day(r.MIN_DAY),this.year(D.year),this.month(D.month),this.day(D.day),this.hours(D.hours),this.minutes(D.minutes),this.seconds(D.seconds),this.milliseconds(D.milliseconds)}return this},g.fn.leapYear=function(){var t=this.year();return t%4===0?t%100===0?t%400===0:!0:!1},g.fn.timestamp=function(t){return arguments.length!==0?(this._d=new Date(Number(t)*(r.options("useMilliseconds")?1:1e3)+this._d.getTimezoneOffset()*6e4),this):r.options("useMilliseconds")?this._d.getTime()-this._d.getTimezoneOffset()*6e4:Math.floor(this._d.getTime()/1e3)-this._d.getTimezoneOffset()*60},g.fn.utc=function(t){return arguments.length!==0?(this._d=new Date(Number(t)*(r.options("useMilliseconds")?1:1e3)),this):r.options("useMilliseconds")?this._d.getTime():Math.floor(this._d.getTime()/1e3)},g.fn.dayOfWeek=function(t){if(t==="long")return Mt[this._d.getDay()];if(t==="short")return Lt[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()})},g.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}},g.fn.get=function(t){switch(t){case"Date":return new Date(this.year(),this.month()-(r.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()-(r.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()}}},g.fn.format=function(t){for(var s=0,h="",c;s<t.length;)t.charAt(s)==="%"?(c=t.charAt(s)+t.charAt(s+1),C[c]!==e?(h+=C[c].format(this),s+=1):h+="%"):h+=t.charAt(s),s+=1;return h},g.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},g.fn.errors=function(){return this._i},g.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}},g.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},r=function(t,s,h){return new g(t,s,h)},r.MIN_YEAR=1e3,r.MAX_YEAR=3e3,r.MIN_MONTH=1,r.MAX_MONTH=12,r.MIN_DAY=1,r.MAX_DAY_IN_MONTHS=[31,28,31,30,31,30,31,31,30,31,30,31],r.MIN_DAY_OF_WEEK=0,r.MAX_DAY_OF_WEEK=6,r.MIN_HOURS=0,r.MAX_HOURS=23,r.MIN_MINUTES=0,r.MAX_MINUTES=59,r.MIN_SECONDS=0,r.MAX_SECONDS=59,r.MIN_MILLISECONDS=0,r.MAX_MILLISECONDS=999,r.VERSION="0.2.18",r.options=function(t,s){if(t===e)return Wt;if(Wt.hasOwnProperty(t)){if(s===e)return Wt[t];Wt[t]=s,t==="monthFromZero"&&(r.MIN_MONTH=s?0:1,r.MAX_MONTH=s?11:12)}return e},r.noConflict=function(){return o.tempus=f,r},r.generate=function(t){var s,h,c,p,A,R,K,Y;if(typeof t.dateFrom!="number"&&(t.dateFrom instanceof g?s=t.dateFrom.utc():s=r(t.dateFrom,t.formatFrom).utc()),typeof t.dateTo!="number"&&(t.dateTo instanceof g?h=t.dateTo.utc():h=r(t.dateTo,t.formatTo!==e?t.formatTo:t.formatFrom).utc()),typeof t.period=="number"?A={year:0,month:0,day:0,hours:0,minutes:0,seconds:t.period}:typeof t.period=="string"?A={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"&&(A={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?R=t.asObject===!0?{}:[]:(R=[],R.push([]),K=r(s).get()[t.groupBy]),Y=function(J,D,H){return t.asObject===!0?t.format!==e?J[r(D).format(t.format)]={}:J[r(D).format("%F %H:%M:%S")]={}:t.format!==e?J.push(H?null:r(D).format(t.format)):J.push(H?null:r(D)),J},t.groupBy!==e&&t.fillNulls){var U={year:A.year?-A.year:e,month:A.month?-A.month:e,day:A.day?-A.day:e,hours:A.hours?-A.hours:e,minutes:A.minutes?-A.minutes:e,seconds:A.seconds?-A.seconds:e,milliseconds:A.milliseconds?-A.milliseconds:e};for(c=r(s).calc(U).utc();r(c).get()[t.groupBy]===K;)Y(R[R.length-1],c,!0),c=r(c).calc(U).utc();if(t.groupBy==="week"){var b=r(s).dayOfWeek();for(c=r(s).dayOfWeek(0).utc();R[0].length<b&&c<s;)Y(R[R.length-1],c,!0),c=r(c).calc(A).utc()}}for(;s<=h;)t.groupBy===e?Y(R,s):r(s).get()[t.groupBy]===K?Y(R[R.length-1],s):(R.push([]),Y(R[R.length-1],s),K=r(s).get()[t.groupBy]),s=r(s).calc(A).utc();if(t.groupBy!==e&&t.fillNulls)for(p=r(h).calc(A).utc();r(p).get()[t.groupBy]===K;)Y(R[R.length-1],p,!0),p=r(p).calc(A).utc();return R},r.monthNames=function(t){switch(t){case"long":return j;default:return Jt}},r.dayNames=function(t){switch(t){case"long":return Mt;default:return Lt}},r.lang=function(t){if(t!==e)m=t,N[m]===e&&(m="en"),j=F(),Jt=Rt(),Mt=ot(),Lt=z();else return m;return e},r.availableLangs=function(){return Object.keys(N)},r.registerFormat=function(t,s,h,c,p,A){C[t]={format:s,parse:h,minLength:c,maxLength:p,type:A}},r.unregisterFormat=function(t){delete C[t]},r.detectFormat=function(t){var s,h,c;return s=y(t,0),s!==""&&(c=10),h=t.charAt(c),(h==="T"||h===" ")&&(s+=h,c+=1),s+=u(t,c),s},d={TempusDate:g},r.classes=function(t,s){if(s===e)return d[t];d[t]=s},r.loadTranslations=function(t){typeof t=="object"?N=t:typeof t=="string"&&ye(t,function(s){N=s},function(s){})},m=(M.language||M.systemLanguage||M.userLanguage||"en").substr(0,2).toLowerCase(),N[m]===e&&(m="en"),j=F(),Jt=Rt(),Mt=ot(),Lt=z(),w.exports&&(i=w.exports=r),i.tempus=r}).call(S)})(ht,ht.exports);var _e=ht.exports;const bt=L(_e);class k{constructor(i,e={}){_(this,at);_(this,mt);_(this,ft);_(this,Nt);_(this,_t);_(this,Ot);_(this,Ht);_(this,Yt);_(this,yt);_(this,At);_(this,Tt);_(this,ct);_(this,St);_(this,It);_(this,rt);_(this,lt);_(this,dt);_(this,q,null);_(this,ut,null);_(this,Q,[]);_(this,I,{});_(this,x,50);_(this,v,!0);_(this,$,null);_(this,B,null);_(this,V,null);_(this,Dt,100);_(this,tt,"no");_(this,P,!1);_(this,et,!1);_(this,st,!1);W(this,"errors",{});W(this,"answerData",{});E(this,q,i),E(this,ut,e)}get serial(){return a(this,P)}setSerial(){E(this,P,!0),E(this,et,!0),E(this,st,!1)}setParallel(){E(this,P,!1),E(this,et,!1),E(this,st,!0)}stop(){E(this,v,!1)}async batch(i,e){a(this,V)&&O(this,mt,Vt).call(this),e&&E(this,$,e),a(this,et)===!1&&E(this,P,!1),Object.keys(i).length>500&&E(this,P,!0),E(this,v,!0),E(this,Q,[]),E(this,I,{}),this.errors={},this.answerData={};const o=O(this,Nt,Kt).call(this,i);if(Object.keys(i).length<500){const n=o.map((l,u)=>O(this,_t,qt).call(this,l,o[u]));return Promise.allSettled(n).then(l=>{let u={};for(let y of l)y.status==="fulfilled"&&(u={...u,...y.value});return u})}else{let n={},l=0,u=1,y=Object.keys(i).length||1,f=r=>{l+=Object.keys(r).length,u=Math.round(l/y*100)};for(let[r,d]of Object.entries(o)){let M=await O(this,_t,qt).call(this,d,o[r],!0);f(d),e&&e({percent:u}),n={...n,...M}}return n}}async batchTotalCount(i,e){E(this,I,{}),this.errors={};let o=1,n=0,l=Object.keys(i).length||1,u=f=>{n+=Object.keys(f).length,o=Math.round(n/l*100)};e&&e({percent:o});const y=O(this,Nt,Kt).call(this,i);if(a(this,st)){const f=y.map(r=>O(this,Ot,Qt).call(this,r).then(d=>(u(r),e&&e({percent:o}),d)));return Promise.allSettled(f).then(r=>{let d={};for(let M of r)M.status==="fulfilled"&&(d={...d,...M.value});return d})}else{let f={};for(let r of y){let d=await O(this,Ot,Qt).call(this,r);u(r),e&&e({percent:o}),f={...f,...d}}return f}}}q=new WeakMap,ut=new WeakMap,Q=new WeakMap,I=new WeakMap,x=new WeakMap,v=new WeakMap,$=new WeakMap,B=new WeakMap,V=new WeakMap,Dt=new WeakMap,tt=new WeakMap,P=new WeakMap,et=new WeakMap,st=new WeakMap,at=new WeakSet,Xt=function(){let i=0;if(!a(this,B))return Math.round(i);let e=0,o=0;return Object.values(a(this,B)).forEach(n=>{const{total:l,count:u}=n;e+=l??0,o+=u??0}),e?i=o/e*100:i=100,{percent:Math.round(i),allCount:o,allTotal:e}},mt=new WeakSet,Vt=function(){clearInterval(a(this,V)),E(this,V,""),E(this,B,""),E(this,$,""),E(this,tt,"no")},ft=new WeakSet,Zt=function({key:i,value:e}){const o=O(this,rt,pt).call(this,e.data()),n=Array.isArray(o)?o.length:0,l=O(this,lt,kt).call(this,e.total(),n);let u=1;o&&(u=n),a(this,$)&&(a(this,B)||E(this,B,{}),a(this,B)[i]&&a(this,B)[i].count&&(u+=a(this,B)[i].count),a(this,B)[i]={total:l,count:u},a(this,V)||E(this,V,setInterval(()=>{const{percent:y,allCount:f,allTotal:r}=a(this,at,Xt);(a(this,tt)==="no"||a(this,tt)<a(this,at,Xt).percent)&&(a(this,$).call(this,{data:a(this,B),percent:y,allCount:f,allTotal:r}),E(this,tt,a(this,at,Xt).percent)),y===100&&O(this,mt,Vt).call(this)},a(this,Dt))))},Nt=new WeakSet,Kt=function(i){const e=[],o=Object.entries(i);for(let n=0;n<o.length;n+=a(this,x)){const l=o.slice(n,n+a(this,x));e.push(Object.fromEntries(l))}return e},_t=new WeakSet,qt=function(i,e,o){return new Promise(n=>{const l=O(this,St,ee).call(this,e),u=[];let y=0,f=0;a(this,q).call(this,i,r=>{Object.entries(r).forEach(([d,M])=>{let m={};const N=M.error();if(N){let{query:{method:z},answer:j}=M;this.errors[d]={error:N,method:z},y+=1}if(M!=null&&M.answer&&Object.keys(M.answer).length){for(let[z,j]of Object.entries(M.answer))z!="result"&&j&&(m[z]=j);Object.keys(m).length&&(this.answerData[d]=m)}const F=O(this,rt,pt).call(this,M.data()),Rt=Array.isArray(F)?F.length:0,ot=O(this,lt,kt).call(this,M.total(),Rt);if(Array.isArray(F)?a(this,I)[d]=F:typeof F=="object"&&F!==null&&Object.keys(F).length===0?a(this,I)[d]=[]:a(this,I)[d]=F,f+=ot,o||O(this,ft,Zt).call(this,{key:d,value:M}),ot>a(this,x)&&ot>Rt){const z=Math.ceil(ot/a(this,x))-1,j=Array.from({length:z});u.push([d,l[d],j])}}),f>5e3&&a(this,et)===!1&&a(this,st)===!1&&E(this,P,!0),y>0&&O(this,dt,se).call(this),u.length?(O(this,Ht,oe).call(this,u),O(this,Yt,he).call(this).then(()=>n(O(this,ct,jt).call(this)))):n(O(this,ct,jt).call(this))})})},Ot=new WeakSet,Qt=function(i){return new Promise(e=>{const o=O(this,St,ee).call(this,i);let n=0;a(this,q).call(this,o,l=>{Object.entries(l).forEach(([u,y])=>{const f=y.error();f&&(this.errors[u]=f,n+=1);const r=O(this,rt,pt).call(this,y.data()),d=Array.isArray(r)?r.length:0,M=O(this,lt,kt).call(this,y.total(),d);a(this,I)[u]=M}),n>0&&O(this,dt,se).call(this),e(O(this,ct,jt).call(this))})})},Ht=new WeakSet,oe=function(i){let e=[];i.forEach(([o,n,l])=>{l.forEach((u,y)=>{const f=y+1,r=a(this,x)*f,M=[[o,f].join("_"),O(this,It,ae).call(this,n,r)];e.length===a(this,x)?(a(this,Q).push(e),e=[M]):e.push(M)})}),e.length&&a(this,Q).push(e)},Yt=new WeakSet,he=function(){const i=[],e=[],o=n=>{Object.entries(n).forEach(([l,u])=>{const[y]=l.split("_"),f=O(this,rt,pt).call(this,u.data());Array.isArray(f)&&a(this,I)[y].push(...f),O(this,ft,Zt).call(this,{key:y,value:u})})};return a(this,Q).forEach((n,l)=>{const u=Object.fromEntries(n),y=()=>new Promise(f=>a(this,q).call(this,u,r=>{a(this,P)?o(r):e[l]=r,f()}));i.push(y)}),a(this,P)?O(this,At,$t).call(this,i):O(this,Tt,te).call(this,i).then(()=>{e.forEach(o)})},yt=new WeakSet,vt=function(){return new Promise(i=>setTimeout(i,500))},At=new WeakSet,$t=function(i){if(!i.length)return Promise.resolve();const e=i.shift();return Promise.allSettled([e(),O(this,yt,vt).call(this)]).then(()=>a(this,v)?O(this,At,$t).call(this,i):Promise.resolve())},Tt=new WeakSet,te=function(i){if(!i.length)return Promise.resolve();const e=i.shift();return O(this,yt,vt).call(this).then(()=>e()).then(()=>a(this,v)?O(this,Tt,te).call(this,i):Promise.resolve())},ct=new WeakSet,jt=function(){return Object.entries(a(this,ut)).forEach(([i,e])=>{a(this,I)[i]&&(a(this,I)[i]=e(a(this,I)[i]))}),a(this,I)},St=new WeakSet,ee=function(i){return Object.entries(i).reduce((e,[o,n])=>{if(Array.isArray(n)){const[l,u={}]=n;e[o]=[l,u]}else{const{method:l,params:u={}}=n;e[o]=[l,u]}return e},{})},It=new WeakSet,ae=function(i,e){const[o,n]=i;return[o,{start:e,...n}]},rt=new WeakSet,pt=function(i){return((i==null?void 0:i.items)||(i==null?void 0:i.documents))??i},lt=new WeakSet,kt=function(i,e){return i!==i&&(i=0),i===0&&e===0?0:i||e},dt=new WeakSet,se=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(this.errors).forEach(([i,e])=>{console.info(`[${i}]`,e.toString())}),console.groupEnd()};class ie{constructor(){_(this,it,{})}get hash(){return this.createHash(8)}createHash(i){let e="abcdefghijklmnopqrstuvwxyz0123456789",o="";i=i||6;for(let n=0;n<i;n++)o+=e.charAt(Math.floor(Math.random()*e.length));return o}actionFilter({keyTimer:i,duration:e=10,action:o}){a(this,it)[i]&&(clearTimeout(a(this,it)[i]),a(this,it)[i]=null),o&&(a(this,it)[i]=setTimeout(()=>{o()},e))}}it=new WeakMap;const xt=new ie;class ne{constructor(){_(this,Bt);_(this,Et);_(this,Gt);_(this,wt);_(this,Ct);_(this,X,"logger");_(this,Z,!1);_(this,Ut,2e3);_(this,nt,new Map);_(this,gt,{});W(this,"periodClear",3);O(this,Bt,ce).call(this)}async init(){let i=new k(BX24.callBatch),{entityList:e}=await i.batch({entityList:{method:"entity.get"}});if(e!=null&&e.length)if(e.find(n=>n.ENTITY==a(this,X)))E(this,Z,!0);else{let{entityAdd:n}=await i.batch({entityAdd:{method:"entity.add",params:{ENTITY:a(this,X),NAME:a(this,X),ACCESS:{AU:"X"}}}});n&&E(this,Z,!0)}return O(this,wt,ue).call(this),a(this,Z)}start({type:i,data:e}){if(!a(this,Z)){O(this,Et,re).call(this,"entity");return}const o=xt.hash;return a(this,nt).set(o,{type:i,data:e,userInfo:a(this,gt),errorList:[],status:"",answer:null,date:new Date().getTime()}),o}stop({key:i,errorList:e,status:o,answer:n}){if(!a(this,Z)){O(this,Et,re).call(this,"entity");return}let l=a(this,nt).get(i);e&&(l.errorList=e),o&&(l.status=o),n&&(l.answer=n),xt.actionFilter({keyTimer:"add.entity.items",duration:a(this,Ut),action:()=>{O(this,Gt,le).call(this)}})}async getEntityList(){let i=new k(BX24.callBatch),{entityList:e}=await i.batch({entityList:{method:"entity.item.get",params:{ENTITY:a(this,X),SORT:{ID:"DESC"}}}});return e=e.map(o=>{const{ID:n,DATE_CREATE:l,DETAIL_TEXT:u}=o;return{...JSON.parse(u),id:n,dateCreate:l}}),e}}X=new WeakMap,Z=new WeakMap,Ut=new WeakMap,nt=new WeakMap,gt=new WeakMap,Bt=new WeakSet,ce=async function(){const i=new k(BX24.callBatch),e=BX24.isAdmin(),{curUser:o}=await i.batch({curUser:{method:"user.current"}});E(this,gt,{isAdmin:e,curUser:o})},Et=new WeakSet,re=function(i){i=="entity"&&xt.actionFilter({keyTimer:"error.logger.entity",duration:500,action:()=>{console.error("Хранилище для логгера не инициализировано")}})},Gt=new WeakSet,le=async function(){let i={},e=new k(BX24.callBatch);for(let[o,n]of a(this,nt).entries())n.status&&(i[o]={method:"entity.item.add",params:{ENTITY:a(this,X),NAME:a(this,X),DETAIL_TEXT:JSON.stringify(n)}});if(Object.keys(i).length){let o=await e.batch(i),{errors:n}=e;for(let[l,u]of Object.entries({...o,...n}))a(this,nt).delete(l)}},wt=new WeakSet,ue=async function(){let i=new k(BX24.callBatch),e=await this.getEntityList(),{serverTime:o}=await i.batch({serverTime:{method:"server.time"}}),n=e.filter(l=>{let{dateCreate:u}=l;return bt(new Date(u)).between(bt(new Date(o)),"month")>=this.periodClear});O(this,Ct,me).call(this,n)},Ct=new WeakSet,me=async function(i){let e=new k(BX24.callBatch),o=i.map(n=>{let{id:l}=n;return{method:"entity.item.delete",params:{ENTITY:a(this,X),ID:l}}});return await e.batch(o)};const G=new ne;class Oe{constructor(i){_(this,Pt);_(this,Ft);W(this,"domain","");W(this,"isAdmin",!1);W(this,"appInfo",null);W(this,"appConst",null);W(this,"userInfo",null);W(this,"placeData",null);W(this,"placeInfo",null);this.appConst=i}init(){return new Promise(i=>{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 G.init();const[o,n]=await Promise.all([O(this,Pt,fe).call(this),O(this,Ft,Ne).call(this)]);this.appInfo=o,this.userInfo=n,i(!0)})},100)})}userOption(i,e){return e?BX24.userOption.set(i,e):BX24.userOption.get(i)}call({method:i,params:e,updateList:o}){let n=G.start({type:"call",data:{method:i,params:e,updateList:o}});return new Promise(l=>{e||(e={}),BX24.callMethod(i,e,function(u){let y={};if(u!=null&&u.answer)for(let[f,r]of Object.entries(u.answer))f!="result"&&r&&(y[f]=r);if(u.error()){let f=u.error();console.error(f),G.stop({answer:y,key:n,status:"fail",errorList:[f.toSting()]}),l(!1)}else{let f=u.data();f!=null&&f.items&&(f=f.items),G.stop({answer:y,key:n,status:"success"}),l(f)}})})}async batch(i,e,{updateList:o,errorCall:n}={}){let l=new k(BX24.callBatch),u=G.start({type:"batch",data:{commandList:i,updateList:o}});try{let y=await l.batch(i,e);if(Object.keys(l.errors).length){let f=Object.entries(l.errors).map(([r,d])=>({key:r,error:d.toSting()}));n&&n(l.errors),G.stop({key:u,status:"fail",errorList:f,answer:l.answerData})}else G.stop({key:u,status:"success",answer:l.answerData});return y}catch(y){return G.stop({key:u,status:"fail-runtime",errorList:[y.toSting()],answer:l.answerData}),console.error(y),!1}}async batchTotalCount(i,e){let o=new k(BX24.callBatch),n=G.start({type:"batch",data:{commandList:i}});try{let l=await o.batchTotalCount(i,e);if(Object.keys(o.errors).length){let u=Object.entries(o.errors).map(([y,f])=>({key:y,error:f.toSting()}));G.stop({key:n,status:"fail",errorList:u})}else G.stop({key:n,status:"success"});return l}catch(l){return G.stop({key:n,status:"fail",errorList:[l.toSting()]}),console.error(l),!1}}getPlacement(){return this.call({method:"placement.get"}).then(i=>(this.placeData||(this.placeData=i),i))}async placementBind(i){this.placeData||(this.placeData=await this.getPlacement());const{appName:e,pathApp:o}=this.appConst,n=this.placeData.map(u=>u.placement);let l=this.placeData.find(u=>u.placement==i);n.includes(i)?l.handler!=o&&(window.placementUnBind||(window.placementUnBind={}),window.placementUnBind[i]||this.placementUnBind(l).then(()=>{window.placementUnBind[i]||(window.placementUnBind[i]=!0,this.placementBind(i))})):this.call({method:"placement.bind",params:{PLACEMENT:i,HANDLER:o,LANG_ALL:{ru:{TITLE:e}}}}).then(u=>{u?console.info("Приложение успешно встроено в",i):console.warn("Приложение не может быть встроено в",i)})}placementUnBind(i){const{pathApp:e,appName:o}=this.appConst;return this.call({method:"placement.unbind",params:{PLACEMENT:i,HANDLER:e,LANG_ALL:{ru:{TITLE:o}}}}).then(n=>(console.log("Встройка отвязана",i),n))}getBotList(){return this.call({method:"imbot.bot.list",params:{}}).then(i=>{let e=Object.values(i);return console.log("chat-bot list:",e),e})}regBot({code:i,type:e,name:o}){const{appName:n,pathApp:l,chatBotLogo:u}=this.appConst,y=this.appInfo.ID;return this.call({method:"imbot.register",params:{CODE:i??this.appInfo.CODE,TYPE:e??"O",EVENT_HANDLER:l,OPENLINE:"Y",CLIENT_ID:"",PROPERTIES:{NAME:`${o??n} - бот #${y}`,LAST_NAME:"",COLOR:"GREEN",EMAIL:"",PERSONAL_BIRTHDAY:bt().format("%Y-%m-%d"),WORK_POSITION:"Почтальон",PERSONAL_WWW:"",PERSONAL_GENDER:"M",PERSONAL_PHOTO:u??""}}}).then(f=>(console.log("Чат-бот добавлен",f),f))}unRegBot(i){return this.call({method:"imbot.unregister",params:{BOT_ID:i}}).then(e=>(console.log("чат-бот удален",e),e))}}Pt=new WeakSet,fe=function(){return this.call({method:"app.info"})},Ft=new WeakSet,Ne=function(){return this.call({method:"user.current"})},T.Batch=k,T.BxBoot=Oe,T.BxHelper=ie,T.BxLogger=ne,T.tempus=bt,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
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.2.
|
|
5
|
+
"version": "0.2.8",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Stanislav Ovv",
|
|
8
8
|
"license": "BSD",
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
"vite-plugin-static-copy": "^0.17.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"nosleep.js": "^0.12.0",
|
|
40
39
|
"tempusjs": "^0.2.18"
|
|
41
40
|
}
|
|
42
41
|
}
|