/*! DMXzone Formatter Version: 1.3.2 (c) 2023 Wappler.io @build 2023-01-19 16:16:50 */ !function(){function e(e,t){return("0000"+t).slice(-e)}dmx.Formatters("global",{default:function(e,t){return null==e?t:e},bool:function(e){return Boolean(e)},string:function(e){return String(e)},number:function(e){return Number(e)},date:function(t){var r,n=dmx.parseDate(t);if(r=n,console.warn("Invalid date object",r),r&&"Invalid Date"!=r.toString())return function(t){return e(4,t.getFullYear())+"-"+e(2,t.getMonth()+1)+"-"+e(2,t.getDate())+"T"+e(2,t.getHours())+":"+e(2,t.getMinutes())+":"+e(2,t.getSeconds())+"."+e(3,t.getMilliseconds())}(n)}})}(),function(){function e(e,t){return("0000"+t).slice(-e)}function t(e){return e&&"Invalid Date"!=e.toString()}dmx.Formatters("any",{default:function(e,t){return null==e?t:e},toBool:function(e){return Boolean(e)},toDate:function(r){var n=dmx.parseDate(r);if(t(n))return function(t){return e(4,t.getFullYear())+"-"+e(2,t.getMonth()+1)+"-"+e(2,t.getDate())+" "+e(2,t.getHours())+":"+e(2,t.getMinutes())+":"+e(2,t.getSeconds())+"."+e(3,t.getMilliseconds())}(n)},toJSON:function(e){return JSON.stringify(e)},toNumber:function(e){return Number(e)},toString:function(e){return String(e)},toTimestamp:function(e){var r=dmx.parseDate(e);if(t(r))return Math.floor(r.getTime()/1e3)},toUTCDate:function(e){var t=dmx.parseDate(e);if("Invalid Date"!=t.toString())return t.toISOString()},toISODate:function(r){var n=dmx.parseDate(r);if(t(n))return e(4,n.getFullYear())+"-"+e(2,n.getMonth()+1)+"-"+e(2,n.getDate())},toISOTime:function(r,n){var a=dmx.parseDate(r);if(t(a))return e(2,a.getHours())+":"+e(2,a.getMinutes())+":"+e(2,a.getSeconds())+(n?"."+e(3,a.getMilliseconds()):"")}})}(),dmx.propCheck=/^\w+$/,dmx.Formatters("array",{toKeyedObject:function(e,t,r){for(var n={},a=dmx.propCheck.test(t),u=dmx.propCheck.test(r),c=0;c-1},join:function(e,t){return e.join(t)},count:function(e){return e.length},top:function(e,t){return e.slice(0,t)},last:function(e,t){return null==t?e[e.length-1]:e.slice(-t)},first:function(e){return e[0]},get:function(e,t){return e[t]},slice:function(e,t,r){return e.slice(t,r)},reverse:function(e){return e.slice(0).reverse()},randomize:function(e){var t,r,n=dmx.randomizer(this.seed*dmx.hashCode(e)),a=e.length;for(e=e.slice(0);0!==a;)r=Math.floor(n()*a--),t=e[a],e[a]=e[r],e[r]=t;return e},filter:function(e,t){var r=this;return"$"==t[0]&&(e=dmx.repeatItems(e)),e.filter((function(e){return dmx.parse(t,new dmx.DataScope(e,r))}))},map:function(e,t){var r=this;return"$"==t[0]&&(e=dmx.repeatItems(e)),e.map((function(e){return dmx.parse(t,new dmx.DataScope(e,r))}))},where:function(e,t,r,n){var a=this;return n=n||"==","$"==t[0]&&(e=dmx.repeatItems(e)),e.filter((function(e){var u=dmx.propCheck.test(t)?e[t]:dmx.parse(t,new dmx.DataScope(e,a));switch(n){case"startsWith":return 0===String(u).indexOf(r);case"endsWith":return String(u).substr(-r.length)===r;case"contains":return-1!==String(u).indexOf(r);case"notContains":return-1===String(u).indexOf(r);case"inArray":return-1!==r.indexOf(u);case"notInArray":return-1===r.indexOf(u);case"fuzzySearch":return function(e,t){var r=e.length,n=t.length;if(n>r)return!1;if(n===r)return e===t;e:for(var a=0,u=0;a":return u>r;case">=":return u>=r}return!0}))},values:function(e,t){var r=this,n=dmx.propCheck.test(t);return e.map((function(e){return n?e[t]:dmx.parse(t,new dmx.DataScope(e,r))}))},groupBy:function(e,t){var r=this,n=dmx.propCheck.test(t);return e.reduce((function(e,a){var u=n?a[t]:dmx.parse(t,new dmx.DataScope(a,r));return e[u]||(e[u]=[]),e[u].push(a),e}),{})},unique:function(e,t){if(t){var r=this,n=dmx.propCheck.test(t);e=e.map((function(e){return n?e[t]:dmx.parse(t,new dmx.DataScope(e,r))}))}return Object.keys(e.reduce((function(e,t){return e[JSON.stringify(t)]=1,e}),{})).map((function(e){return JSON.parse(e)}))},sort:function(e,t){var r=this,n=!t||dmx.propCheck.test(t);return e.slice(0).sort((function(e,a){return t&&(e=n?e[t]:dmx.parse(t,new dmx.DataScope(e,r)),a=n?a[t]:dmx.parse(t,new dmx.DataScope(a,r))),ea?1:0}))},min:function(e,t){var r=this,n=!t||dmx.propCheck.test(t);return e.reduce((function(e,a){return t&&(a=n?a[t]:dmx.parse(t,new dmx.DataScope(a,r))),(a=Number(a))e?a:e}),-1/0)},sum:function(e,t){var r=this,n=!t||dmx.propCheck.test(t);return e.reduce((function(e,a){return t&&(a=n?a[t]:dmx.parse(t,new dmx.DataScope(a,r))),e+(a=Number(a))}),0)},avg:function(e,t){var r=this,n=!t||dmx.propCheck.test(t);return e.reduce((function(e,a){return t&&(a=n?a[t]:dmx.parse(t,new dmx.DataScope(a,r))),e+(a=Number(a))}),0)/e.length}}),dmx.Formatters("boolean",{then:function(e,t,r){return e?t:r}}),function(){var e=["January","February","March","April","May","June","July","August","September","October","November","December"],t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function a(e,t){return("0000"+t).slice(-e)}function u(e){return a(4,e.getFullYear())+"-"+a(2,e.getMonth()+1)+"-"+a(2,e.getDate())+" "+a(2,e.getHours())+":"+a(2,e.getMinutes())+":"+a(2,e.getSeconds())+"."+a(3,e.getMilliseconds())}function c(e){return Number(e)===e}function i(e){return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e}function o(e){return e&&"Invalid Date"!=e.toString()}dmx.Formatters("string",{getYear:function(e){var t=dmx.parseDate(e);if(o(t))return t.getFullYear()},getMonth:function(e){var t=dmx.parseDate(e);if(o(t))return t.getMonth()+1},getDate:function(e){var t=dmx.parseDate(e);if(o(t))return t.getDate()},getDay:function(e){var t=dmx.parseDate(e);if(o(t))return t.getDay()},addYears:function(e,t){var r=dmx.parseDate(e);if(o(r))return c(t)&&r.setFullYear(r.getFullYear()+t),u(r)},addMonths:function(e,t){var r=dmx.parseDate(e);if(o(r))return c(t)&&r.setMonth(r.getMonth()+t),u(r)},addWeeks:function(e,t){var r=dmx.parseDate(e);if(o(r))return c(t)&&r.setDate(r.getDate()+7*t),u(r)},addDays:function(e,t){var r=dmx.parseDate(e);if(o(r))return c(t)&&r.setDate(r.getDate()+t),u(r)},addHours:function(e,t){var r=dmx.parseDate(e);if(o(r))return c(t)&&r.setHours(r.getHours()+t),u(r)},addMinutes:function(e,t){var r=dmx.parseDate(e);if(o(r))return c(t)&&r.setMinutes(r.getMinutes()+t),u(r)},addSeconds:function(e,t){var r=dmx.parseDate(e);if(o(r))return c(t)&&r.setSeconds(r.getSeconds()+t),u(r)},addMilliseconds:function(e,t){var r=dmx.parseDate(e);if(o(r))return c(t)&&r.setMilliseconds(r.getMilliseconds()+t),u(r)},yearsUntil:function(e,t){var r=dmx.parseDate(e),n=dmx.parseDate(t);if(o(r)&&o(n))return n.getFullYear()-r.getFullYear()},monthsUntil:function(e,t){var r=dmx.parseDate(e),n=dmx.parseDate(t);if(o(r)&&o(n))return 12*n.getFullYear()+n.getMonth()-(12*r.getFullYear()+r.getMonth())},weeksUntil:function(e,t){var r=dmx.parseDate(e),n=dmx.parseDate(t);if(o(r)&&o(n))return Math.floor((n-r)/6048e5)},daysUntil:function(e,t){var r=dmx.parseDate(e),n=dmx.parseDate(t);if(o(r)&&o(n))return i(r),i(n),Math.round((n-r)/864e5)},hoursUntil:function(e,t){var r=dmx.parseDate(e),n=dmx.parseDate(t);if(o(r)&&o(n))return Math.floor((n-r)/36e5)},minutesUntil:function(e,t){var r=dmx.parseDate(e),n=dmx.parseDate(t);if(o(r)&&o(n))return Math.floor((n-r)/6e4)},secondsUntil:function(e,t){var r=dmx.parseDate(e),n=dmx.parseDate(t);if(o(r)&&o(n))return Math.floor((n-r)/1e3)},millisecondsUntil:function(e,t){var r=dmx.parseDate(e),n=dmx.parseDate(t);if(o(r)&&o(n))return n-r},timeUntil:function(e,t,r){var n=dmx.parseDate(e),u=dmx.parseDate(t);if(o(n)&&o(u)){var c=Math.floor((u-n)/1e3),i=Math.floor(c/60),f=Math.floor(i/60);return c-=60*i,r?f+":"+a(2,i-=60*f)+":"+a(2,c):i+":"+a(2,c)}},formatDate:function(u,c){var i=dmx.parseDate(u);if(o(i)){var f=i.getFullYear(),d=i.getMonth(),s=i.getDate(),l=i.getDay(),b=i.getHours(),p=i.getMinutes(),m=i.getSeconds();return c.replace(/([yMdHhmsaA])(\1+)?/g,(function(u){switch(u){case"yyyy":return a(4,f);case"yy":return a(2,f);case"y":return f;case"MMMM":return e[d];case"MMM":return t[d];case"MM":return a(2,d+1);case"M":return d+1;case"dddd":return r[l];case"ddd":return n[l];case"dd":return a(2,s);case"d":return s;case"HH":return a(2,b);case"H":return b;case"hh":return a(2,b%12||12);case"h":return b%12||12;case"mm":return a(2,p);case"m":return p;case"ss":return a(2,m);case"s":return m;case"a":return b<12?"am":"pm";case"A":return b<12?"AM":"PM"}return u}))}}})}(),dmx.Formatters("number",{inRange:function(e,t,r){return e>=t&&e<=r},abs:function(e){return Math.abs(e)},ceil:function(e){return Math.ceil(e)},floor:function(e){return Math.floor(e)},max:function(e,t){return Math.max(e,t)},min:function(e,t){return Math.min(e,t)},pow:function(e,t){return Math.pow(e,t)},per:function(e,t){return e*t/100},perOf:function(e,t){return e/t},round:function(e,t){var r=Math.pow(10,t||0),n=e*r;return Math.round(n)/r},pad:function(e,t){for(var r=e<0?"-":"",n=String(Math.abs(e));n.length=0?e.toFixed(t):e.toString()).split("."),c=u[0],i=u.length>1?r+u[1]:"";if(n)for(var o=/(\d+)(\d{3})/;o.test(c);)c=c.replace(o,"$1"+n+"$2");return(a?"-":"")+c+i},formatPercentage:function(e,t){var r=Math.pow(10,t);return Math.round(e*r*100)/r+"%"},formatCurrency:function(e,t,r,n,a){if(isNaN(e)||!isFinite(e))return"Invalid Amount";t=t||"$",r=r||".",n=n||",",a=null!=a?a:2;var u=e<0,c=Math.abs(e).toFixed(a).split("."),i=c[0],o=c.length>1?r+c[1]:"";if(n)for(var f=/(\d+)(\d{3})/;f.test(i);)i=i.replace(f,"$1"+n+"$2");return(u?"-":"")+t+i+o},formatSize:function(e,t,r){if(isNaN(e)||!isFinite(e))return"Invalid Size";t=t||2;for(var n=r?1024:1e3,a=r?["KiB","MiB","GiB","TiB"]:["KB","MB","GB","TB"],u=3;u>=0;u--){var c=Math.pow(n,u+1);if(e>=c){e/=c;var i=Math.pow(10,t);return(e=Math.round(e*i)/i)+a[u]}}return e+"B"}}),dmx.Formatters("string",{startsWith:function(e,t){return 0===e.indexOf(t)},endsWith:function(e,t){var r=e.length-t.length,n=e.lastIndexOf(t);return-1!==n&&n===r},contains:function(e,t){return-1!==e.indexOf(t)},notContains:function(e,t){return-1===e.indexOf(t)},search:function(e,t,r){return String(t).split(/\s+/)[r?"every":"some"]((function(t){return-1!==e.indexOf(t)}))},fuzzySearch:function(e,t){var r=e.length,n=t.length;if(n>r)return!1;if(n===r)return e===t;e:for(var a=0,u=0;at&&(e=e.substr(0,t),r&&-1!==e.indexOf(" ")&&(e=e.substr(0,e.lastIndexOf(" "))),e+=n),e},stripTags:function(e){return e.replace(/<[^>]+>/g,"")},padStart:function(e,t,r){if(r=r||" ",t<=e.length)return e;for(var n=t-e.length;r.length