/* OxJS v0.2.0 | (c) 2024 0x2620 | MIT License | oxjs.org */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Ox={})}(this,function(exports){"use strict";function typeOf(e){const t=Object.prototype.toString.call(e).slice(8,-1).toLowerCase();if("object"===t){if(null===e)return"null";if(e instanceof Array)return"array";if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return"number"===t&&isNaN$1(e)?"nan":t}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isDate(e){return e instanceof Date&&!isNaN$1(e)}function isDefined(e){return void 0!==e}function isElement(e){return!(!e||1!==e.nodeType)}function isEmpty$1(e){return null==e||(isArray(e)||isString(e)?0===e.length:!!isObject(e)&&0===Object.keys(e).length)}function isEqual(e,t){if(e===t)return!0;const n=typeOf(e);if(n!==typeOf(t))return!1;if("array"===n){if(e.length!==t.length)return!1;for(let n=0;nt):[]}function values$1(e){return isObject(e)?Object.values(e):isArray(e)?[...e]:isString(e)?e.split(""):[]}const STACK_LENGTH=5e4;function slice(e,t,n){try{const r=Array.prototype.slice.call(e,t,n);if(0===r.length&&e.length>0)throw new Error("Broken slice implementation");return r}catch(r){const a=void 0===n?[t]:[t,n],o=[];let i,s;for("string"===typeOf(e)&&(e=e.split("")),s=e.length,i=0;i{"string"==typeof e?r.appendChild(document.createTextNode(e)):e&&r.appendChild(e)}),r}var DOM={documentReady:documentReady,$:$,createElement:createElement},DOMUtils=Object.freeze({__proto__:null,$:$,createElement:createElement,default:DOM,documentReady:documentReady});async function getFile(e,t){try{const n=await fetch(e),r=await n.text();return t&&t(r),r}catch(n){return console.error("Failed to get file:",e,n),t&&t(null),null}}async function getJSON(e,t){try{const n=await fetch(e),r=await n.json();return t&&t(r),r}catch(n){return console.error("Failed to get JSON:",e,n),t&&t(null),null}}async function post(e,t,n){try{const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),a=await r.json();return n&&n(a),a}catch(t){return console.error("Failed to post:",e,t),n&&n(null),null}}var Request={getFile:getFile,getJSON:getJSON,post:post},RequestUtils=Object.freeze({__proto__:null,default:Request,getFile:getFile,getJSON:getJSON,post:post});let LOCALE="en";const LOCALES={};async function setLocale(e,t){LOCALE=e,t&&t()}function _(e,t={}){return e}var Locale={LOCALE:LOCALE,LOCALES:LOCALES,setLocale:setLocale,_:_},LocaleUtils=Object.freeze({__proto__:null,get LOCALE(){return LOCALE},LOCALES:LOCALES,_:_,default:Locale,setLocale:setLocale});function wrap(e){return{value:e,_wrapped:!0}}const Core={wrap:wrap};function localStorage(e){let t;try{t=window.localStorage||{},t.setItem("OxJS.test",""),t.removeItem("OxJS.test")}catch(e){t={}}function n(r,a){let o;if(0===arguments.length){o={};for(const n in t)n.startsWith(e+".")&&(o[n.slice(e.length+1)]=JSON.parse(t[n]))}else if(1===arguments.length&&"string"==typeof r){const n=t[e+"."+r];o=void 0===n?void 0:JSON.parse(n)}else{const i="object"==typeof r?r:{[r]:a};for(const[n,r]of Object.entries(i))t[e+"."+n]=JSON.stringify(r);o=n}return o}return n.delete=function(...r){return(0===r.length?Object.keys(n()):r).forEach(n=>{delete t[e+"."+n]}),n},n}function loop(...e){const t=e.length,n=t>2?e[0]:0,r=e[t>2?1:0],a=4===t?e[2]:n<=r?1:-1,o=e[t-1];let i;for(i=n;(a>0?ir)&&!1!==o(i);i+=a);return i}function cache(e,t){var n={},r=(t=t||{}).async,a=t.key||JSON.stringify;return function(){var t=Array.prototype.slice.call(arguments),o=r?t.pop():null,i=a(t);if(i in n){if(!r)return n[i];setTimeout(function(){o(n[i])},0)}else{if(!r)return n[i]=e.apply(this,t);e.apply(this,t.concat(function(e){n[i]=e,o(e)}))}}}function debounce(e,t,n){var r;return function(){var a=this,o=arguments,i=n&&!r;clearTimeout(r),r=setTimeout(function(){r=null,n||e.apply(a,o)},t),i&&e.apply(a,o)}}function sequence(){var e=Array.prototype.slice.call(arguments);return function(){var t=Array.prototype.slice.call(arguments),n=this;e.forEach(function(e){e.apply(n,t)})}}function throttle(e,t){var n,r,a,o,i=0,s=function(){i=Date.now(),n=null,o=e.apply(r,a),n||(r=a=null)};return function(){var u=Date.now(),c=t-(u-i);return r=this,a=arguments,c<=0||c>t?(n&&(clearTimeout(n),n=null),i=u,o=e.apply(r,a),n||(r=a=null)):n||(n=setTimeout(s,c)),o}}function bind(e,t){var n=Array.prototype.slice.call(arguments,2);return function(){return e.apply(t,n.concat(Array.prototype.slice.call(arguments)))}}function identity(e){return e}function noop(){}function once(e){var t,n=!1;return function(){return n||(n=!0,t=e.apply(this,arguments)),t}}function constant(e){return function(){return e}}function compose(){var e=Array.prototype.slice.call(arguments);return function(){for(var t=Array.prototype.slice.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}}function pipe(){var e=Array.prototype.slice.call(arguments);return function(){for(var t=Array.prototype.slice.call(arguments),n=0;n!r.includes(e)))},n.log=function(...e){if(!t.filterEnabled||t.filter.includes(e[0])){const t=new Date,n=`${t.toTimeString().split(" ")[0]}.${t.getMilliseconds().toString().padStart(3,"0")}`;return e.unshift(n),window.console&&window.console.log&&window.console.log(...e),e.join(" ")}}}();var Function={cache:cache,debounce:debounce,sequence:sequence,throttle:throttle,bind:bind,identity:identity,noop:noop,once:once,constant:constant,compose:compose,pipe:pipe,memoize:memoize,partial:partial},FunctionUtils=Object.freeze({__proto__:null,bind:bind,cache:cache,compose:compose,constant:constant,debounce:debounce,default:Function,identity:identity,memoize:memoize,noop:noop,once:once,partial:partial,pipe:pipe,sequence:sequence,throttle:throttle});function applyPolyfills(){Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Array.prototype.forEach||(Array.prototype.forEach=function(e,t){var n,r;if(null==this)throw new TypeError("this is null or not defined");var a=Object(this),o=a.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=0;r>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=new Array(i),a=0;a>>0;if("function"!=typeof e)throw new TypeError;for(var r=[],a=arguments.length>=2?arguments[1]:void 0,o=0;o>>0;if(0===a)return-1;var o=+t||0;if(Math.abs(o)===1/0&&(o=0),o>=a)return-1;for(n=Math.max(o>=0?o:a-Math.abs(o),0);n=0?n:n+t}function rad(e){return e*Math.PI/180}function random(e,t){return 0===arguments.length?Math.random():1===arguments.length?Math.floor(Math.random()*e):e+Math.floor(Math.random()*(t-e))}function round(e,t){var n=Math.pow(10,t||0);return Math.round(e*n)/n}function sign(e){return e>0?1:e<0?-1:0}function sinh(e){return(Math.exp(e)-Math.exp(-e))/2}function sum$1(e){return e.reduce(function(e,t){return e+(isNumber(t)?t:0)},0)}function tanh(e){return sinh(e)/cosh(e)}function getBearing(e,t){var n=rad(e.lat),r=rad(t.lat),a=rad(e.lng),o=rad(t.lng),i=Math.sin(o-a)*Math.cos(r),s=Math.cos(n)*Math.sin(r)-Math.sin(n)*Math.cos(r)*Math.cos(o-a);return(deg(Math.atan2(i,s))+360)%360}function getCenter(e){var t=0,n=0;return e.forEach(function(e){t+=e.lat,n+=e.lng}),{lat:t/e.length,lng:n/e.length}}function getCircle(e,t,n){var r=360/(n=n||36);return Array.from({length:n},function(n,a){return getPoint(e,r*a,t)})}function getDistance(e,t){var n=rad(e.lat),r=rad(t.lat),a=rad(t.lat-e.lat),o=rad(t.lng-e.lng),i=Math.sin(a/2)*Math.sin(a/2)+Math.cos(n)*Math.cos(r)*Math.sin(o/2)*Math.sin(o/2);return 6371e3*(2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i)))}function getPoint(e,t,n){var r=rad(e.lat),a=rad(e.lng);t=rad(t),n/=6371e3;var o=Math.asin(Math.sin(r)*Math.cos(n)+Math.cos(r)*Math.sin(n)*Math.cos(t)),i=a+Math.atan2(Math.sin(t)*Math.sin(n)*Math.cos(r),Math.cos(n)-Math.sin(r)*Math.sin(o));return{lat:deg(o),lng:deg(i)}}var Math$1={acosh:acosh,asinh:asinh,atanh:atanh,cosh:cosh,deg:deg,divmod:divmod,limit:limit,log:log,mod:mod,rad:rad,random:random,round:round,sign:sign,sinh:sinh,sum:sum$1,tanh:tanh,getBearing:getBearing,getCenter:getCenter,getCircle:getCircle,getDistance:getDistance,getPoint:getPoint},MathUtils=Object.freeze({__proto__:null,acosh:acosh,asinh:asinh,atanh:atanh,cosh:cosh,default:Math$1,deg:deg,divmod:divmod,getBearing:getBearing,getCenter:getCenter,getCircle:getCircle,getDistance:getDistance,getPoint:getPoint,limit:limit,log:log,mod:mod,rad:rad,random:random,round:round,sign:sign,sinh:sinh,sum:sum$1,tanh:tanh});function capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}function clean(e){return e.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")}function endsWith$1(e,t){return e.slice(-t.length)===t}function format(e,...t){return e.replace(/\{(\d+)\}/g,function(e,n){return isUndefined(t[n])?e:t[n]})}function isValidEmail(e){return/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(e)}function lowercase(e){return e.toLowerCase()}function pad$1(e,t,n,r){e=String(e),n=n||" ",r=r||"left";var a=Math.max(0,t-e.length),o=repeat(n,Math.ceil(a/n.length)).slice(0,a);return"left"===r||"both"===r?o+e:e+o}function parsePath$1(e){var t=/^(.+\/)?(.+?)(\.[^.]+)?$/.exec(e)||[];return{pathname:e,dirname:t[1]||"",filename:t[2]||"",extension:t[3]?t[3].slice(1):""}}function parseURL(e){var t=/^(?:(https?:)\/\/)?([\w.-]+)(:\d+)?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/.exec(e)||[];return{protocol:t[1]||"",hostname:t[2]||"",port:t[3]?t[3].slice(1):"",pathname:t[4]||"/",search:t[5]||"",hash:t[6]||""}}function removeHTML(e){return e.replace(/<[^>]*>/g,"")}function repeat(e,t){return new Array(t+1).join(e)}function reverse(e){return e.split("").reverse().join("")}function startsWith$1(e,t){return e.slice(0,t.length)===t}function stripTags$1(e){return e.replace(/<[^>]+>/g,"")}function toCamelCase(e){return e.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}function toDashes(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}function toNumber(e){return+e}function toTitleCase(e){return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})}function toUnderscores(e){return e.replace(/[A-Z]/g,function(e){return"_"+e.toLowerCase()})}function truncate(e,t,n,r){if(n=n||"...",r=r||"right",e.length<=t)return e;if(t=Math.max(t-n.length,0),"left"===r)return n+e.slice(-t);if("center"===r){var a=Math.ceil(t/2),o=Math.floor(t/2);return e.slice(0,a)+n+e.slice(-o)}return e.slice(0,t)+n}function uppercase(e){return e.toUpperCase()}function words(e){return e.split(/\s+/).filter(function(e){return e.length>0})}function wordwrap(e,t,n,r){t=t||80,n=n||"\n";var a=[],o=e.split(" "),i="";return o.forEach(function(e){i&&(i+" "+e).length>t?(a.push(i),i=e):i=i?i+" "+e:e}),i&&a.push(i),a.join(n)}const char=String.fromCharCode;function splice(e,t,n){const r=e.split("");return Array.prototype.splice.apply(r,slice(arguments,1)),r.join("")}var String$1={capitalize:capitalize,clean:clean,endsWith:endsWith$1,format:format,isValidEmail:isValidEmail,lowercase:lowercase,pad:pad$1,parsePath:parsePath$1,parseURL:parseURL,removeHTML:removeHTML,repeat:repeat,reverse:reverse,startsWith:startsWith$1,stripTags:stripTags$1,toCamelCase:toCamelCase,toDashes:toDashes,toNumber:toNumber,toTitleCase:toTitleCase,toUnderscores:toUnderscores,truncate:truncate,uppercase:uppercase,words:words,wordwrap:wordwrap,char:char,splice:splice},StringUtils=Object.freeze({__proto__:null,capitalize:capitalize,char:char,clean:clean,default:String$1,endsWith:endsWith$1,format:format,isValidEmail:isValidEmail,lowercase:lowercase,pad:pad$1,parsePath:parsePath$1,parseURL:parseURL,removeHTML:removeHTML,repeat:repeat,reverse:reverse,splice:splice,startsWith:startsWith$1,stripTags:stripTags$1,toCamelCase:toCamelCase,toDashes:toDashes,toNumber:toNumber,toTitleCase:toTitleCase,toUnderscores:toUnderscores,truncate:truncate,uppercase:uppercase,words:words,wordwrap:wordwrap});function api(e,t){var n,r,a={cache:(t=t||{}).cache,enums:t.enums?(n=t.enums,r={},forEach(n,function(e,t){r[t]=e}),r):{},geo:t.geo,map:t.map||{},sort:t.sort||[],sums:t.sums||[],unique:t.unique||"id"},o=function(t,n){var r,o,s,c={},l={data:{},status:{code:200,text:"ok"}};return(t=t||{}).query?(t.query.conditions=i(t.query.conditions),l.data.items=e.filter(function(e){return u(e,t.query)})):l.data.items=clone(e),t.sort&&l.data.items.length>1&&(o=[],t.sort=(s=t.sort.concat(a.sort),s.map(function(e){return isString(e)?{key:e.slice(1),operator:"+"==e[0]?"+":"-"}:e})).filter(function(e){var t=-1==o.indexOf(e.key);return t&&o.push(e.key),t}),t.sort.forEach(function(e){var t=e.key;a.enums[t]?c[t]=function(e){return a.enums[t].indexOf(e)}:a.map[t]&&(c[t]=a.map[t])}),l.data.items=sortBy$1(l.data.items,t.sort,c)),t.positions?(r={},t.positions.forEach(function(e){r[e]=getIndex(l.data.items,a.unique,e)}),l.data={positions:r}):t.keys?(isUndefined(t.range)||(l.data.items=l.data.items.slice(t.range[0],t.range[1])),t.keys&&(l.data.items=l.data.items.map(function(e){var n={};return t.keys.forEach(function(t){n[t]=e[t]}),n})),l.data={items:l.data.items}):(r={},a.sums.forEach(function(e){r[e]=sum(l.data.items,e)}),l.data=extend(r,{items:l.data.items.length})),n&&n(l),l};function i(e){return e.map(function(e){var t=extend({},e);return t.conditions?t.conditions=i(t.conditions):t.value=isArray(t.value)?t.value.map(s):s(t.value),t})}function s(e){return isString(e)?e.toLowerCase():e}function u(e,t){var n="&"==t.operator;return forEach(t.conditions,function(r){var a=r.conditions?u(e,r):function(e,t){var n=t.key,r=t.operator.replace(/^!/,""),a=t.value,o=map[n]?map[n](e[n],e):e[n],i={"=":function(e,t){return isArray(t)?t.indexOf(e)>-1:isString(e)?e.toLowerCase().indexOf(t)>-1:e===t},"==":function(e,t){return isArray(t)?t.indexOf(e)>-1:e===t},"<":function(e,t){return isString(e)?-1==e.toLowerCase().localeCompare(t):e":function(e,t){return isString(e)?1==e.toLowerCase().localeCompare(t):e>t},">=":function(e,t){return isString(e)?e.toLowerCase().localeCompare(t)>-1:e>=t},"^":function(e,t){return isArray(t)?t.some(function(t){return startsWith(e,t)}):startsWith(e,t)},$:function(e,t){return isArray(t)?t.some(function(t){return endsWith(e,t)}):endsWith(e,t)}}[r](o,a);return"!"==t.operator[0]?!i:i}(e,r);return a&&"|"==t.operator?(n=!0,!1):a||"&"!=t.operator?void 0:(n=!1,!1)}),n}return o.enums=a.enums,o.map=a.map,o.sort=a.sort,o.sums=a.sums,a.cache&&(o=cache(o,{async:!0})),o}function compact(e){return filter(e,function(e){return null!=e})}function count(e,t){return filter(e,t||identity).length}function sort(e,t){var n=getSortValues(t?e.map(t):e);return e.sort(function(e,r){return e=t?t(e):e,r=t?t(r):r,n[e]n[r]?1:0})}function unique(e,t){var n=[];return e.length&&(t?e.forEach(function(e){var r=t(e);n.some(function(e){return t(e)===r})||n.push(e)}):n=e.filter(function(t,n){return e.indexOf(t)==n})),n}function zip(){var e=Array.prototype.slice.call(arguments);return e[0].map(function(t,n){return e.map(function(e){return e[n]})})}function startsWith(e,t){return isString(e)&&0===e.toLowerCase().indexOf(t)}function endsWith(e,t){return isString(e)&&e.toLowerCase().indexOf(t)===e.length-t.length}function getIndex(e,t,n){var r=-1;return e.some(function(e,a){if(e[t]===n)return r=a,!0}),r}function sum(e,t){return e.reduce(function(e,n){return e+(n[t]||0)},0)}function sortBy$1(e,t,n){var r={};return(t=t||[]).forEach(function(t){var a=t.key,o=n&&n[a]?n[a]:identity;r[a]={},e.forEach(function(e){var t=o(e[a],e);r[a][t]||(r[a][t]=getSortValue(isString(t)?t.toLowerCase():t))})}),e.sort(function(e,a){var o=0;return t.some(function(t){var i=t.key,s=n&&n[i]?n[i]:identity,u=s(e[i],e),c=s(a[i],a),l=r[i][u],f=r[i][c];return lf&&(o="+"==t.operator?1:-1),0!==o}),o})}function getSortValue(e){var t=e;return isString(e)&&(t=e.toLowerCase().replace(/^\W+/,"").replace(/\d+/g,function(e){return e.padStart(16,"0")})),t}function getSortValues(e){var t={};return e.forEach(function(e){t[e]||(t[e]=getSortValue(e))}),t}function last$1(e,t){var n;return 1==arguments.length?n=e[e.length-1]:(e[e.length-1]=t,n=e),n}function makeArray(e){var t=typeOf(e);return"arguments"==t||"nodelist"==t?slice(e):"array"==t?e:[e]}function range(){var e=[];return loop.apply(null,slice(arguments).concat(function(t){e.push(t)})),e}var Array$1={api:api,compact:compact,count:count,sort:sort,unique:unique,zip:zip,last:last$1,makeArray:makeArray,range:range,slice:slice,max:max,min:min,forEach:forEach,len:len,map:map,filter:filter,values:values,keyOf:keyOf,isEmpty:isEmpty,contains:contains,random:random,char:char,splice:splice,clean:clean,repeat:repeat,loop:loop},ArrayUtils=Object.freeze({__proto__:null,api:api,char:char,clean:clean,compact:compact,contains:contains,count:count,default:Array$1,filter:filter,forEach:forEach,isEmpty:isEmpty,keyOf:keyOf,last:last$1,len:len,loop:loop,makeArray:makeArray,map:map,max:max,min:min,random:random,range:range,repeat:repeat,slice:slice,sort:sort,splice:splice,unique:unique,values:values,zip:zip});function getDayName(e,t){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][getDayOfWeek(e,t)]}function getDayOfWeek(e,t){return e=makeDate(e),t?e.getUTCDay():e.getDay()}function getDayOfYear(e,t){const n=(e=makeDate(e))-new Date(Date.UTC(getFullYear(e,t),0,1));return Math.floor(n/864e5)+1}function getDaysInMonth(e,t){return new Date(e,t+1,0).getDate()}function getDaysInYear(e){return isLeapYear(e)?366:365}function getFirstDayOfWeek(e,t){const n=getDayOfWeek(e=makeDate(e),t);return new Date(e.getTime()-864e5*n)}function getFullYear(e,t){return e=makeDate(e),t?e.getUTCFullYear():e.getFullYear()}function getHours(e,t){return e=makeDate(e),t?e.getUTCHours():e.getHours()}function getISODate(e,t){return formatDate$1(e,"%Y-%m-%d",t)}function getISOWeek(e,t){const n=getFullYear(e=makeDate(e),t),r=getFirstThursday(n,t),a=Math.floor((e-r)/6048e5)+1;if(a<1)return getISOWeek(new Date(n-1,11,31),t);if(a>52){if(e>=getFirstThursday(n+1,t))return 1}return a}function getISOYear(e,t){const n=getFullYear(e=makeDate(e),t),r=getISOWeek(e,t);return 1===r&&11===getMonth(e,t)?n+1:r>=52&&0===getMonth(e,t)?n-1:n}function getMinutes(e,t){return e=makeDate(e),t?e.getUTCMinutes():e.getMinutes()}function getMonth(e,t){return e=makeDate(e),t?e.getUTCMonth():e.getMonth()}function getMonthName(e,t){return["January","February","March","April","May","June","July","August","September","October","November","December"][getMonth(e,t)]}function getSeconds(e,t){return e=makeDate(e),t?e.getUTCSeconds():e.getSeconds()}function getMilliseconds(e,t){return e=makeDate(e),t?e.getUTCMilliseconds():e.getMilliseconds()}function getTimezoneOffset(e){return makeDate(e).getTimezoneOffset()}function getTimezoneOffsetString(e){const t=getTimezoneOffset(e),n=t<=0?"+":"-",r=Math.floor(Math.abs(t)/60),a=Math.abs(t)%60;return n+pad(r,2)+":"+pad(a,2)}function getUnixTime(e){return Math.floor(makeDate(e).getTime()/1e3)}function getWeek(e,t){e=makeDate(e);const n=new Date(Date.UTC(getFullYear(e,t),0,1)),r=Math.floor((e-n)/864e5);return Math.ceil((r+getDayOfWeek(n,t)+1)/7)}function isLeapYear(e){return e%4==0&&(e%100!=0||e%400==0)}function isValidDate(e){return e=makeDate(e),!isNaN(e.getTime())}function makeDate(e){return isDate(e)?e:isString(e)||isNumber(e)?new Date(e):isUndefined(e)?new Date:new Date(e)}function formatDate$1(e,t,n){e=makeDate(e);const r={"%a":()=>getDayName(e,n).substr(0,3),"%A":()=>getDayName(e,n),"%b":()=>getMonthName(e,n).substr(0,3),"%B":()=>getMonthName(e,n),"%c":()=>e.toLocaleString(),"%d":()=>pad(getDate(e,n),2),"%e":()=>pad(getDate(e,n),2," "),"%H":()=>pad(getHours(e,n),2),"%I":()=>pad((getHours(e,n)+11)%12+1,2),"%j":()=>pad(getDayOfYear(e,n),3),"%k":()=>pad(getHours(e,n),2," "),"%l":()=>pad((getHours(e,n)+11)%12+1,2," "),"%m":()=>pad(getMonth(e,n)+1,2),"%M":()=>pad(getMinutes(e,n),2),"%p":()=>getHours(e,n)<12?"AM":"PM","%S":()=>pad(getSeconds(e,n),2),"%u":()=>getDayOfWeek(e,n)||7,"%U":()=>pad(getWeek(e,n),2),"%V":()=>pad(getISOWeek(e,n),2),"%w":()=>getDayOfWeek(e,n),"%W":()=>pad(getWeek(e,n),2),"%x":()=>e.toLocaleDateString(),"%X":()=>e.toLocaleTimeString(),"%y":()=>pad(getFullYear(e,n)%100,2),"%Y":()=>getFullYear(e,n),"%z":()=>getTimezoneOffsetString(e),"%Z":()=>"","%%":()=>"%"};return(t=t||"%Y-%m-%d %H:%M:%S").replace(/%[a-zA-Z%]/g,e=>r[e]?r[e]():e)}function parseDate$1(e,t,n){return new Date(e)}function getDate(e,t){return e=makeDate(e),t?e.getUTCDate():e.getDate()}function getDay(e,t){return getDayOfWeek(e,t)}function getISODay(e,t){const n=getDayOfWeek(e,t);return 0===n?7:n}function getDayOfTheYear(e,t){return getDayOfYear(e,t)}function getFirstDayOfTheYear(e,t){const n=getFullYear(e=makeDate(e),t);return new Date(Date.UTC(n,0,1))}function setDate(e,t,n){return e=makeDate(e),n?e.setUTCDate(t):e.setDate(t),e}function setFullYear(e,t,n){return e=makeDate(e),n?e.setUTCFullYear(t):e.setFullYear(t),e}function setMonth(e,t,n){return e=makeDate(e),n?e.setUTCMonth(t):e.setMonth(t),e}function setHours(e,t,n){return e=makeDate(e),n?e.setUTCHours(t):e.setHours(t),e}function setMinutes(e,t,n){return e=makeDate(e),n?e.setUTCMinutes(t):e.setMinutes(t),e}function setSeconds(e,t,n){return e=makeDate(e),n?e.setUTCSeconds(t):e.setSeconds(t),e}function getFirstThursday(e,t){const n=new Date(Date.UTC(e,0,1)),r=(11-getDayOfWeek(n,t))%7;return new Date(n.getTime()+864e5*r)}function pad(e,t,n){n=n||"0";const r=String(e);return n.repeat(Math.max(0,t-r.length))+r}var Date$1={getDayName:getDayName,getDayOfWeek:getDayOfWeek,getDayOfYear:getDayOfYear,getDaysInMonth:getDaysInMonth,getDaysInYear:getDaysInYear,getFirstDayOfWeek:getFirstDayOfWeek,getFullYear:getFullYear,getHours:getHours,getISODate:getISODate,getISOWeek:getISOWeek,getISOYear:getISOYear,getMinutes:getMinutes,getMonth:getMonth,getMonthName:getMonthName,getSeconds:getSeconds,getMilliseconds:getMilliseconds,getTimezoneOffset:getTimezoneOffset,getTimezoneOffsetString:getTimezoneOffsetString,getUnixTime:getUnixTime,getWeek:getWeek,isLeapYear:isLeapYear,isValidDate:isValidDate,makeDate:makeDate,formatDate:formatDate$1,parseDate:parseDate$1,getDate:getDate,getDay:getDay,getISODay:getISODay,getDayOfTheYear:getDayOfTheYear,getFirstDayOfTheYear:getFirstDayOfTheYear,setDate:setDate,setFullYear:setFullYear,setMonth:setMonth,setHours:setHours,setMinutes:setMinutes,setSeconds:setSeconds},DateUtils=Object.freeze({__proto__:null,default:Date$1,formatDate:formatDate$1,getDate:getDate,getDay:getDay,getDayName:getDayName,getDayOfTheYear:getDayOfTheYear,getDayOfWeek:getDayOfWeek,getDayOfYear:getDayOfYear,getDaysInMonth:getDaysInMonth,getDaysInYear:getDaysInYear,getFirstDayOfTheYear:getFirstDayOfTheYear,getFirstDayOfWeek:getFirstDayOfWeek,getFullYear:getFullYear,getHours:getHours,getISODate:getISODate,getISODay:getISODay,getISOWeek:getISOWeek,getISOYear:getISOYear,getMilliseconds:getMilliseconds,getMinutes:getMinutes,getMonth:getMonth,getMonthName:getMonthName,getSeconds:getSeconds,getTimezoneOffset:getTimezoneOffset,getTimezoneOffsetString:getTimezoneOffsetString,getUnixTime:getUnixTime,getWeek:getWeek,isLeapYear:isLeapYear,isValidDate:isValidDate,makeDate:makeDate,parseDate:parseDate$1,setDate:setDate,setFullYear:setFullYear,setHours:setHours,setMinutes:setMinutes,setMonth:setMonth,setSeconds:setSeconds});function last(e){return e[e.length-1]}function sortBy(e,t){return e.slice().sort(function(e,n){var r=Array.isArray(t)?t.map(t=>e[t]):e[t],a=Array.isArray(t)?t.map(e=>n[e]):n[t];return r>a?1:r=1e6?"k":"";return t=isUndefined(t)?8:t,formatNumber((n?e/1e6:e).toPrecision(t))+" "+n+"m²"}function formatCount(e,t,n){return n=(n||t+"s")+(2===e?"{2}":""),(0===e?_("no"):formatNumber(e))+" "+_(1===e?t:n)}function formatCurrency(e,t,n){return t+formatNumber(e,n)}var formatPatterns=[["%",function(){return"%{%}"}],["c",function(){return"%D %r"}],["D",function(){return"%m/%d/%y"}],["ED",function(){return"%ES %T"}],["Ed",function(){return"%ES %R"}],["EL",function(){return _("%A, %B %e, %Y")}],["El",function(){return _("%B %e, %Y")}],["EM",function(){return _("%a, %b %e, %Y")}],["Em",function(){return _("%b %e, %Y")}],["ES",function(){return _("%m/%d/%Y")}],["Es",function(){return _("%m/%d/%y")}],["ET",function(){return _("%I:%M:%S %p")}],["Et",function(){return _("%I:%M %p")}],["F",function(){return"%Y-%m-%d"}],["h",function(){return"%b"}],["R",function(){return"%H:%M"}],["r",function(){return"%I:%M:%S %p"}],["T",function(){return"%H:%M:%S"}],["v",function(){return"%e-%b-%Y"}],["\\+",function(){return"%a %b %e %H:%M:%S %Z %Y"}],["A",function(e,t){return _(WEEKDAYS[(getDay(e,t)+6)%7])}],["a",function(e,t){return _(SHORT_WEEKDAYS[(getDay(e,t)+6)%7])}],["B",function(e,t){return _(MONTHS[getMonth(e,t)])}],["b",function(e,t){return _(SHORT_MONTHS[getMonth(e,t)])}],["C",function(e,t){return Math.floor(getFullYear(e,t)/100).toString()}],["d",function(e,t){return pad$1(getDate(e,t),2)}],["e",function(e,t){return pad$1(getDate(e,t),2," ")}],["G",function(e,t){return getISOYear(e,t)}],["g",function(e,t){return getISOYear(e,t).toString().slice(-2)}],["H",function(e,t){return pad$1(getHours(e,t),2)}],["I",function(e,t){return pad$1((getHours(e,t)+11)%12+1,2)}],["j",function(e,t){return pad$1(getDayOfTheYear(e,t),3)}],["k",function(e,t){return pad$1(getHours(e,t),2," ")}],["l",function(e,t){return pad$1((getHours(e,t)+11)%12+1,2," ")}],["M",function(e,t){return pad$1(getMinutes(e,t),2)}],["m",function(e,t){return pad$1(getMonth(e,t)+1,2)}],["p",function(e,t){return _(AMPM[Math.floor(getHours(e,t)/12)])}],["Q",function(e,t){return Math.floor(getMonth(e,t)/4)+1}],["S",function(e,t){return pad$1(getSeconds(e,t),2)}],["s",function(e,t){return Math.floor((+e-(t?getTimezoneOffset(e):0))/1e3)}],["U",function(e,t){return pad$1(getWeek(e,t),2)}],["u",function(e,t){return getISODay(e,t)}],["V",function(e,t){return pad$1(getISOWeek(e,t),2)}],["W",function(e,t){return pad$1(Math.floor((getDayOfTheYear(e,t)+(getFirstDayOfTheYear(e,t)||7)-2)/7),2)}],["w",function(e,t){return getDay(e,t)}],["X",function(e,t){var n=getFullYear(e,t);return Math.abs(n)+" "+_(BCAD[n<0?0:1])}],["x",function(e,t){var n=getFullYear(e,t);return Math.abs(n)+(n<1e3?" "+_(BCAD[n<0?0:1]):"")}],["Y",function(e,t){return getFullYear(e,t)}],["y",function(e,t){return getFullYear(e,t).toString().slice(-2)}],["Z",function(e,t){return t?"UTC":(e.toString().split("(")[1]||"").replace(")","")}],["z",function(e,t){return t?"+0000":getTimezoneOffsetString(e)}],["n",function(){return"\n"}],["t",function(){return"\t"}],["\\{%\\}",function(){return"%"}]].map(function(e){return[new RegExp("%"+e[0],"g"),e[1]]});function formatDate(e,t,n){return""===e?"":(e=makeDate(e),formatPatterns.forEach(function(r){t=t.replace(r[0],function(){return r[1](e,n)})}),t)}function formatDateRange(e,t,n){t=t||formatDate(new Date,"%Y-%m-%d");var r,a=!1,o=[e,t],i=o.map(function(e){return parseDate(e)}),s=o.map(function(e){var t=compact(/(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?/.exec(e));return t.shift(),t.map(function(e){return parseInt(e,10)})}),u=s.map(function(e){return e.length}),c=s[0][0]<0?"%X":"%Y",l=[c,"%B "+c,"%a, %b %e, "+c,"%a, %b %e, "+c+", %H:%M","%a, %b %e, "+c+", %H:%M","%a, %b %e, "+c+", %H:%M:%S"];return u[0]==u[1]&&(a=!0,loop(u[0],function(e){if(e1?"s":""):""})).join(" ")}function formatDegrees(e,t){var n=0,r=e<0?"-":"",a=formatDuration(Math.round(3600*Math.abs(e))).split(":");return 4==a.length&&(n=parseInt(a.shift(),10)),a[0]=24*n+parseInt(a[0],10),(t?"":r)+a[0]+"°"+a[1]+"'"+a[2]+'"'+("lat"==t?e<0?"S":"N":"lng"==t?e<0?"W":"E":"")}function formatDimensions(e,t){return e.map(function(e){return formatNumber(e)}).join(" × ")+(t?" "+t:"")}const formatResolution=formatDimensions;function formatDuration(e){for(var t=last(arguments),n="short"==t||"long"==t?t:"none",r=isNumber(arguments[1])?arguments[1]:0,a=(e=round(Math.abs(e),r),[Math.floor(e/31536e3),Math.floor(e%31536e3/86400),Math.floor(e%86400/3600),Math.floor(e%3600/60),formatNumber(e%60,r)]),o="short"==n?["y","d","h","m","s"]:"long"==n?["year","day","hour","minute","second"]:[],i=[a[0].toString().length,a[0]?3:a[1].toString().length,2,2,r?r+3:2];!a[0]&&a.length>("none"==n?3:1);)a.shift(),o.shift(),i.shift();return filter(map(a,function(e,t){return"none"==n?pad$1(e,"left",i[t],"0"):(isNumber(e)?e:parseFloat(e))?e+("long"==n?" ":"")+_(o[t]+("long"==n?1==e?"":2==e?"s{2}":"s":"")):""})).join("none"==n?":":" ")}function formatISBN(e,t,n){var r="";function a(e){var t=10==e.length?11:10;return(mod(t-sum$1(e.slice(0,-1).split("").map(function(t,n){return 10==e.length?parseInt(t)*(10-n):parseInt(t)*(n%2==0?1:3)})),t)+"").replace("10","X")}return 10==(e=e.toUpperCase().replace(/[^\dX]/g,"")).length&&(e=e.slice(0,-1).replace(/\D/g,"")+e.slice(-1)),10!=e.length&&13!=e.length||e.slice(-1)!=a(e)||(e.length==t?r=e:10!=e.length&&"978"!=e.slice(0,3)||(r=(e=10==e.length?"978"+e:e.slice(3)).slice(0,-1)+a(e))),n?[r.slice(-13,-10),r.slice(-10,-9),r.slice(-9,-6),r.slice(-6,-1),r.slice(-1)].join("-").replace(/^-+/,""):r}function formatNumber(e,t){for(var n=[],r=Math.abs(e).toFixed(t).split(".");r[0];)n.unshift(r[0].slice(-3)),r[0]=r[0].slice(0,-3);return r[0]=n.join(_(",")),(e<0?"-":"")+r.join(_("."))}function formatOrdinal(e){var t=formatNumber(e),n=t.length,r=t[n-1],a=n>1&&"1"==t[n-2],o=n>1&&!a;return t+=_("1"!=r||a?"2"!=r||a?"3"!=r||a?"th"+(contains("123",r)&&a?"{1"+r+"}":""):"rd"+(o?"{23}":""):"nd"+(o?"{22}":""):"st"+(o?"{21}":""))}function formatPercent(e,t,n){return formatNumber(e/t*100,n)+_("%")}function formatRoman(e){var t="";return forEach({M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1},function(n,r){for(;e>=n;)t+=r,e-=n}),t}function formatSRT(e){return"\ufeff"+sortBy(e,["in","out"]).map(function(e,t){return[t+1,["in","out"].map(function(t){return formatDuration(e[t],3).replace(".",",")}).join(" --\x3e "),e.text].join("\r\n")}).join("\r\n\r\n")+"\r\n\r\n"}function formatString(e,t,n){return e.replace(/\{([^}]+)\}/g,function(e,r){for(var a,o=r.replace(/\\\./g,"\n").split(".").map(function(e){return e.replace(/\n/g,".")}),i=t||{};o.length;){if(!i[a=o.shift()]){i=null;break}i=i[a]}return null!==i?i:n?"{"+r+"}":""})}function formatUnit(e,t,n){return formatNumber(e,n)+(/^[:%]/.test(t)?"":" ")+t}function formatValue(e,t,n){var r,a=n?1024:1e3,o=PREFIXES.length;return forEach(PREFIXES,function(i,s){if(e1&&r--,a[i]=r<1/6?t+6*(n-t)*r:r<.5?n:r<2/3?t+6*(n-t)*(2/3-r):t})),a.map(function(e){return Math.round(255*e)})}function toHex(e){return e.map(function(e){return pad$1(e.toString(16).toUpperCase(),"left",2,"0")}).join("")}function toRGB(e){return range(3).map(function(t){return parseInt(e.substr(2*t,2),16)})}var ColorUtils=Object.freeze({__proto__:null,hsl:hsl,rgb:rgb,toHex:toHex,toRGB:toRGB});function encodeBase26(e){for(var t="";e;)t=String.fromCharCode(65+(e-1)%26)+t,e=Math.floor((e-1)/26);return t}function decodeBase26(e){return e.toUpperCase().split("").reverse().reduce(function(e,t,n){return e+(t.charCodeAt(0)-64)*Math.pow(26,n)},0)}function encodeBase32(e){return map(e.toString(32),function(e){return BASE_32_DIGITS[parseInt(e,32)]})}function decodeBase32(e){return parseInt(map(e.toUpperCase(),function(e){var t=BASE_32_DIGITS.indexOf(BASE_32_ALIASES[e]||e);return-1==t?" ":t.toString(32)}),32)}function encodeBase64(e){return btoa(encodeBase256(e)).replace(/=/g,"")}function decodeBase64(e){return decodeBase256(atob(e))}function encodeBase128(e){for(var t="";e;)t=char(127&e)+t,e>>=7;return t}function decodeBase128(e){return e.split("").reverse().reduce(function(e,t,n){return e+(t.charCodeAt(0)<<7*n)},0)}function encodeBase256(e){for(var t="";e;)t=char(255&e)+t,e>>=8;return t}function decodeBase256(e){return e.split("").reverse().reduce(function(e,t,n){return e+(t.charCodeAt(0)<<8*n)},0)}function encodeDeflate(e,t){var n,r,a=1+(e=encodeUTF8(e)).length,o=canvas(Math.ceil(a/3),1),i=(3-a%3)%3;for(e=char(i)+e+repeat("ÿ",i),loop(o.data.length,function(t){o.data[t]=t%4<3?e.charCodeAt(t-parseInt(t/4)):255}),o.context.putImageData(o.imageData,0,0),n=(e=atob(o.canvas.toDataURL().split(",")[1])).slice(16,20)+e.slice(29,33),r=e.slice(33,-12);r;)n+=(a=r.slice(0,4))+r.slice(8,12+(a=decodeBase256(a))),r=r.slice(12+a);return t&&t(n),n}function decodeDeflate(e,t){var n,r=new Image,a="‰PNG\r\n\n\0\0\0\rIHDR"+e.slice(0,4)+"\0\0\0\b\0\0\0"+e.slice(4,8),o=e.slice(8);function i(){throw new RangeError("Deflate codec can't decode data.")}for(;o;)a+=(n=o.slice(0,4))+"IDAT"+o.slice(4,8+(n=decodeBase256(n))),o=o.slice(8+n);a+="\0\0\0\0IEND®B`‚",r.onload=function(){e=slice(canvas(r).data).map(function(e,t){return t%4<3?char(e):""}).join("");try{e=decodeUTF8(e.slice(1,-e.charCodeAt(0)||void 0))}catch(e){i()}t(e)},r.onerror=i,r.src="data:image/png;base64,"+btoa(a)}function decodeURICompat(e){return decodeURI(function e(t){return t.toString().replace(/%(?![0-9A-Fa-f]{2})/g,"%25").replace(/(%[0-9A-Fa-f]{2})+/g,function(t){var n,r=t.split("%").slice(1);try{n=decodeURI("%"+r.join("%"))}catch(e){}return n||"%25"+r[0]+e(t.slice(3))})}(e))}function decodeURIComponentCompat(e){return decodeURIComponent(function e(t){return t.toString().replace(/%(?![0-9A-Fa-f]{2})/g,"%25").replace(/(%[0-9A-Fa-f]{2})+/g,function(t){var n,r=t.split("%").slice(1);try{n=decodeURIComponent("%"+r.join("%"))}catch(e){}return n||"%25"+r[0]+e(t.slice(3))})}(e))}function encodeUTF8(e){return map(e,function(e){var t=e.charCodeAt(0);return t<128?e:t<2048?String.fromCharCode(t>>6|192)+String.fromCharCode(63&t|128):String.fromCharCode(t>>12|224)+String.fromCharCode(t>>6&63|128)+String.fromCharCode(63&t|128)})}function decodeUTF8(e){var t,n=0,r=e.length,a="";function o(e,t){throw new RangeError("UTF-8 codec can't decode byte 0x"+e.toString(16).toUpperCase()+" at position "+t)}for(;n=192&&t[0]<240&&n=128&&t[1]<192?t[0]<224?(a+=String.fromCharCode((31&t[0])<<6|63&t[1]),n+=2):t[2]>=128&&t[2]<192?(a+=String.fromCharCode((15&t[0])<<12|(63&t[1])<<6|63&t[2]),n+=3):o(t[2],n+2):o(t[1],n+1):o(t[0],n);return a}function encodeEmailAddress$1(e,t){var n=["mailto:"+e,t||e].map(function(e){return map(e,function(e){var t=e.charCodeAt(0);return":"==e?":":"&#"+(Math.random()<.5?t:"x"+t.toString(16))+";"})});return''+n[1]+""}!function(){function e(t){return t.toString().replace(/%(?![0-9A-Fa-f]{2})/g,"%25").replace(/(%[0-9A-Fa-f]{2})+/g,function(t){var n,r=t.split("%").slice(1);return forEach(range(1,r.length+1),function(a){var o=range(a).map(function(e){return char(parseInt(r[e],16))}).join("");try{return decodeUTF8(o),n=t.slice(0,3*a)+e(t.slice(3*a)),!1}catch(e){}}),n||"%25"+r[0]+e(t.slice(3))})}decodeURIFn=function(t){return decodeURI(e(t))},decodeURIComponentFn=function(t){return decodeURIComponent(e(t))}}();var EncodingUtils=Object.freeze({__proto__:null,decodeBase128:decodeBase128,decodeBase256:decodeBase256,decodeBase26:decodeBase26,decodeBase32:decodeBase32,decodeBase64:decodeBase64,decodeDeflate:decodeDeflate,decodeURI:decodeURICompat,decodeURICompat:decodeURICompat,decodeURIComponent:decodeURIComponentCompat,decodeURIComponentCompat:decodeURIComponentCompat,decodeUTF8:decodeUTF8,encodeBase128:encodeBase128,encodeBase256:encodeBase256,encodeBase26:encodeBase26,encodeBase32:encodeBase32,encodeBase64:encodeBase64,encodeDeflate:encodeDeflate,encodeEmailAddress:encodeEmailAddress$1,encodeUTF8:encodeUTF8});function escapeRegExp(e){return(e+"").replace(/([\/\\^$*+?.\-|(){}[\]])/g,"\\$1")}var RegExpUtils=Object.freeze({__proto__:null,escapeRegExp:escapeRegExp}),defaultTags=[{name:"b"},{name:"bdi"},{name:"code"},{name:"em"},{name:"i"},{name:"q"},{name:"s"},{name:"span"},{name:"strong"},{name:"sub"},{name:"sup"},{name:"u"},{name:"blockquote"},{name:"cite"},{name:"div",optional:["style"],validate:{style:/^direction: rtl$/}},{name:"h1"},{name:"h2"},{name:"h3"},{name:"h4"},{name:"h5"},{name:"h6"},{name:"p"},{name:"pre"},{name:"li"},{name:"ol"},{name:"ul"},{name:"dl"},{name:"dt"},{name:"dd"},{name:"table"},{name:"tbody"},{name:"td"},{name:"tfoot"},{name:"th"},{name:"thead"},{name:"tr"},{name:"[]"},{name:"a",required:["href"],optional:["target"],validate:{href:/^((https?:\/\/|\/|mailto:).*?)/,target:/^_blank$/}},{name:"br"},{name:"iframe",optional:["width","height"],required:["src"],validate:{width:/^\d+$/,height:/^\d+$/,src:/^((https?:\/\/|\/).*?)/}},{name:"img",optional:["width","height"],required:["src"],validate:{width:/^\d+$/,height:/^\d+$/,src:/^((https?:\/\/|\/).*?)/}},{name:"figure"},{name:"figcaption"}],htmlEntities={'"':""","&":"&","'":"'","<":"<",">":">"},regexp={entity:/&[^\s]+?;/g,html:/[<&]/,tag:new RegExp("<\\/?("+["a","b","br","code","i","s","span","u"].join("|")+")\\/?>","gi")},salt=range(2).map(function(){return range(16).map(function(){return char(65+random(26))}).join("")});function addLinksInternal(e,t){return e.replace(/\b((https?:\/\/|www\.).+?)([.,:;!?)\]]*?(\s|$))/gi,function(e,t,n,r){return formatString('{url}{end}',{end:r,prefix:n="www."==n.toLowerCase()?"http://":"",url:t})}).replace(/\b([0-9A-Z.+\-_]+@(?:[0-9A-Z\-]+\.)+[A-Z]{2,6})\b/gi,'$1')}function decodeHTMLEntitiesInternal(e){return e.replace(new RegExp("("+values(htmlEntities).join("|")+")","g"),function(e){return keyOf(htmlEntities,e)}).replace(/&#([0-9A-FX]+);/gi,function(e,t){return char(/^X/i.test(t)?parseInt(t.slice(1),16):parseInt(t,10))})}function splitHTMLTags(e,t){var n=!1,r=[""];return t=t||[],forEach(e,function(e,a){n||"<"!=e||-1!=t.indexOf(a)||(n=!0,r.push("")),r[r.length-1]+=e,n&&">"==e&&(n=!1,r.push(""))}),r}function addLinks(e,t){var n=!1;return t?splitHTMLTags(e).map(function(e,t){var r=t%2;return r&&(/^'+n[1]+""}function encodeHTMLEntities(e,t){return map(String(e),function(e){var n=e.charCodeAt(0);return n<128?e=e in htmlEntities?htmlEntities[e]:e:t&&(e="&#x"+pad$1(n.toString(16).toUpperCase(),"left",4,"0")+";"),e})}function decodeHTMLEntities(e,t){return t?decodeHTMLEntities(normalizeHTML(e)):decodeHTMLEntitiesInternal(e)}function highlight(e,t,n,r){if(!t)return e;var a=0,o=[],i=[],s=0,u=isRegExp(t)?t:new RegExp(escapeRegExp(t),"gi"),c=['',""],l=[];function f(t){t.forEach(function(t){e=splice(e,t.position,t.length,t.value),i.forEach(function(e){t.position"+r.trim().replace(/"),salt.join(t.length-1)}).replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,n,r,a,o){return t.push(n+""+a.trim().replace(/"),salt.join(t.length-1)}).replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"$2").replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"$2").replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,function(e,t,n,r,a,o,i,s){return'"+n+""}).replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'$1').replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(e,t){return encodeEmailAddress(t)}).replace(/\n\n/g,"

").replace(new RegExp(salt.join("(\\d+)"),"g"),function(e,n){return t[parseInt(n)]})}function sanitizeHTML(e,t,n){n=n||[];var r={},a=0,o=["img","br"],i={},s={},u={},c=(t=t||defaultTags).map(function(e){return i[e.name]=n.concat(e.required||[]).concat(e.optional||[]),s[e.name]=e.required||[],u[e.name]=e.validate||{},e.name});return contains(c,"[]")&&(e=e.replace(/\[((\/|https?:\/\/|mailto:).+?) (.+?)\]/gi,'$3'),c=c.filter(function(e){return"[]"!=e})),normalizeHTML(e=(e=addLinks(e=splitHTMLTags(e).map(function(e,t){var n,l,f,p,d,g={},m=/([^=\ ]+)="([^"]+)"/g,h=!0;if(t%2&&(d=/<(\/)?([^\ \/]+)(.*?)(\/)?>/g.exec(e))){for(f=!isUndefined(d[1]),p=d[2],l=d[3].trim();n=m.exec(l);)i[p]&&contains(i[p],n[1])&&(g[n[1]]=n[2]);if(f||contains(o,p)||a++,!contains(c,p)||l.length&&isEmpty(g)?h=!1:!f&&s[p]&&s[p].forEach(function(e){isUndefined(g[e])&&(h=!1)}),h&&!isEmpty(g)&&forEach(g,function(e,t){if(!isUndefined(u[p][t])&&!u[p][t].exec(e))return h=!1,!1}),h&&f?h=!r[a]:r[a]=!h,f&&a--,h)return"<"+(f?"/":"")+p+(f||isEmpty(g)?"":" "+values(map(g,function(e,t){return t+'="'+e+'"'})).join(" "))+">"}return encodeHTMLEntities(decodeHTMLEntitiesInternal(e))}).join(""),!0)).replace(/\n\n/g,"

"))}function stripTags(e){return e.replace(/<.*?>/g,"")}var HTMLUtils=Object.freeze({__proto__:null,addLinks:addLinks,decodeHTMLEntities:decodeHTMLEntities,encodeEmailAddress:encodeEmailAddress,encodeHTMLEntities:encodeHTMLEntities,highlight:highlight,normalizeHTML:normalizeHTML,parseMarkdown:parseMarkdown,sanitizeHTML:sanitizeHTML,stripTags:stripTags});function asyncMap(e,t,n,r,a){var o=typeOf(t),i="object"==o?{}:[];a=last$1(arguments),e(t,function(e,t,r,a){n(e,t,r,function(e){i[t]=e,a()})},r=5==arguments.length?r:null,function(){a("string"==o?i.join(""):i)})}function asyncMapFn(e,t,n,r){e=makeArray(e),r=last$1(arguments),n=4==arguments.length?n:null,e.some(Array.isArray)?serialMap(e,function(e,n,r,a){parallelMap(makeArray(e),t,a)},r):parallelMap(e,t,r)}function nonblockingForEach(e,t,n,r,a){var o,i,s,u=0,c=last$1(arguments),l=typeOf(e);r=isFunction(c)?c:arguments[arguments.length-2],e="array"==l||"object"==l?e:slice(e),o="object"==l?Object.keys(e):range(e.length),a=a||1e3,i=len(e),n=5==arguments.length||4==arguments.length&&isFunction(c)?n:null,s=+new Date,function c(){forEach(o.slice(u),function(r){return r in e&&!1===t.call(n,e[r],r,e)?(u=i,!1):(u++,!(+new Date>=s+a)&&void 0)}),u>>=16;n&&a++}while(n)}return o}(e.size.toString());function r(e,t){var n,r,a,o;return o=e[3]+t[3],a=e[2]+t[2]+(o>>16),o&=65535,r=e[1]+t[1]+(a>>16),a&=65535,n=e[0]+t[0]+(r>>16),[n&=65535,r&=65535,a,o]}function a(e,t){return t=t||0,[e.charCodeAt(t+6)+(e.charCodeAt(t+7)<<8),e.charCodeAt(t+4)+(e.charCodeAt(t+5)<<8),e.charCodeAt(t+2)+(e.charCodeAt(t+3)<<8),e.charCodeAt(t+0)+(e.charCodeAt(t+1)<<8)]}!function o(i,s){var u,c=65536,l=new FileReader;l.onload=function(i){var u,l,f=i.target.result,p=f.length-8;for(u=0;u<=p;u+=8)n=r(n,a(f,u));e.size>>32-t}function n(e){var t,n="";for(t=7;t>=0;t--)n+=(e>>>4*t&15).toString(16);return n}var r,a,o,i,s,u,c,l,f,p=new Array(80),d=1732584193,g=4023233417,m=2562383102,h=271733878,y=3285377520,S=(e=encodeUTF8(e)).length,E=new Array;for(a=0;a>>29),E.push(S<<3&4294967295),r=0;r