@pacem/pacem 1.0.0-babbage → 1.0.0-bernoulli

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.
Files changed (49) hide show
  1. package/dist/browser/pacem-2d.js +1 -1
  2. package/dist/browser/pacem-2d.min.js +2 -2
  3. package/dist/browser/pacem-2d.min.js.map +1 -1
  4. package/dist/browser/pacem-3d.js +1 -1
  5. package/dist/browser/pacem-3d.min.js +2 -2
  6. package/dist/browser/pacem-3d.min.js.map +1 -1
  7. package/dist/browser/pacem-charts.js +1 -1
  8. package/dist/browser/pacem-charts.min.js +2 -2
  9. package/dist/browser/pacem-charts.min.js.map +1 -1
  10. package/dist/browser/pacem-cms.js +1 -1
  11. package/dist/browser/pacem-cms.min.js +2 -2
  12. package/dist/browser/pacem-cms.min.js.map +1 -1
  13. package/dist/browser/pacem-core.js +1 -1
  14. package/dist/browser/pacem-core.min.js +2 -2
  15. package/dist/browser/pacem-core.min.js.map +1 -1
  16. package/dist/browser/pacem-foundation.js +1 -1
  17. package/dist/browser/pacem-foundation.min.js +2 -2
  18. package/dist/browser/pacem-foundation.min.js.map +1 -1
  19. package/dist/browser/pacem-fx.js +1 -1
  20. package/dist/browser/pacem-fx.min.js +2 -2
  21. package/dist/browser/pacem-fx.min.js.map +1 -1
  22. package/dist/browser/pacem-logging.js +1 -1
  23. package/dist/browser/pacem-logging.min.js +2 -2
  24. package/dist/browser/pacem-logging.min.js.map +1 -1
  25. package/dist/browser/pacem-maps.js +1 -1
  26. package/dist/browser/pacem-maps.min.js +2 -2
  27. package/dist/browser/pacem-maps.min.js.map +1 -1
  28. package/dist/browser/pacem-media.js +1 -1
  29. package/dist/browser/pacem-media.min.js +2 -2
  30. package/dist/browser/pacem-media.min.js.map +1 -1
  31. package/dist/browser/pacem-networking.js +1 -1
  32. package/dist/browser/pacem-networking.min.js +2 -2
  33. package/dist/browser/pacem-networking.min.js.map +1 -1
  34. package/dist/browser/pacem-numerical.js +1 -1
  35. package/dist/browser/pacem-numerical.min.js +2 -2
  36. package/dist/browser/pacem-numerical.min.js.map +1 -1
  37. package/dist/browser/pacem-plus.js +1 -1
  38. package/dist/browser/pacem-plus.min.js +2 -2
  39. package/dist/browser/pacem-plus.min.js.map +1 -1
  40. package/dist/browser/pacem-scaffolding.js +1 -1
  41. package/dist/browser/pacem-scaffolding.min.js +2 -2
  42. package/dist/browser/pacem-scaffolding.min.js.map +1 -1
  43. package/dist/browser/pacem-ui.js +1 -1
  44. package/dist/browser/pacem-ui.min.js +2 -2
  45. package/dist/browser/pacem-ui.min.js.map +1 -1
  46. package/dist/bundle/pacem.min.mjs +1 -1
  47. package/dist/bundle/pacem.mjs +1 -1
  48. package/dist/typings/index.d.ts +1 -1
  49. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-babbage (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * @pacem/pacem v1.0.0-babbage (https://js.pacem.it)
2
+ * @pacem/pacem v1.0.0-bernoulli (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
6
- !function(){"use strict";Number.prototype.isCloseTo=function(t,e=14){const r=Number(`1e-${e}`);return this>t-r&&this<t+r},Number.prototype.roundoff=function(t=14){return parseFloat(this.toFixed(t))},Number.prototype.clamp=function(t,e){let r=this;return null==t||isNaN(t)||(r=Math.max(r,t)),null==e||isNaN(e)||(r=Math.min(r,e)),r},Number.prototype.toBase62=function(){for(var t=this,e="";0!=t;){e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".charAt(t%62)+e,t=Math.floor(t/62)}return e},Number.prototype.toBase36=function(){return this.toString(36)};const t=/^\/Date\([\d]+\)\/$/i;class e{static parse(e){let r;return"string"==typeof e?(r=t.test(e)?parseInt(e.substring(6)):Date.parse(e),new Date(r)):"number"==typeof e?new Date(e):e}static isLeapYear(t){return t%4==0&&t%100!=0||t%400==0}static daysInMonth(t,r){return[31,e.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][r]}static isDate(t){return t instanceof Date&&!isNaN(t.valueOf())}static dateOnly(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}static addMonths(t,r){let n=t.getDate(),s=new Date(t),a=s.getMonth()+r,i=0;for(;a<0;)a+=12,i--;return s.setDate(1),s.setMonth(a%12),s.setFullYear(s.getFullYear()+i+Math.floor(a/12)),s.setDate(Math.min(n,e.daysInMonth(s.getFullYear(),s.getMonth()))),s}static addDays(t,e){return new Date(t.valueOf()+864e5*e)}static daysBetween(t,e){return(e.valueOf()-t.valueOf())/864e5}}class r{static isNull(t){return null==t}static isEmpty(t){try{return Array.isArray(t)&&0===t.length||"string"==typeof t&&""===t||"object"==typeof t&&0===Object.keys(t).length&&!e.isDate(t)&&!(t instanceof RegExp)&&!(t instanceof FileSystemDirectoryHandle)&&!(t instanceof FileSystemFileHandle)}catch(t){return!1}}static isNullOrEmpty(t){return r.isNull(t)||r.isEmpty(t)}}function n(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)&&(t.constructor===Object||void 0===t.constructor)}function s(t,e){const r=t;for(const t of Object.keys(e)){const a=e[t],i=r[t];n(a)?r[t]=s(n(i)?i:{},a):Array.isArray(a)?r[t]=a.slice():r[t]=a}return r}Array.prototype.distinct=function(){return Array.from(new Set(this))},Array.prototype.union=function(t){const e=r.isNullOrEmpty(this),n=r.isNullOrEmpty(t);return e&&n?[]:n?this.slice():e?t.slice():this.concat(t).distinct()},Array.prototype.moveWithin=function(t,e){const r="Index must be greater or equal than 0 and less or equal than the length of the array.";var n=this;if(t<0||t>n.length)throw new Error(r);if(e<0||e>n.length)throw new Error(r);n.splice(e,0,Array.prototype.splice.apply(n,[t,1])[0])},Array.prototype.equalsContent=function(t){if(null==t||this.length!==t.length)return!1;for(let e=0;e<this.length;e++)if(this[e]!==t[e])return!1;return!0},Array.prototype.cloneFrom=function(t){if(null==t)throw"Cannot clone array from null object.";const e=t.length;var r=this.length!==t.length;for(let n=0;n<e;n++){const e=t[n];this.length>n?this[n]!==e&&(this[n]=e,r=!0):(Array.prototype.push.apply(this,[e]),r=!0)}r&&this.splice(e)};class a{constructor(){}static merge(t,e){return e??=globalThis.Pacem??={},s(e,t)}}class i{static blobToDataURL(t){return new Promise((e,r)=>{const n=new FileReader;n.onload=t=>{e(t.target.result)},n.readAsDataURL(t)})}static _b64ToUint8Array(t){let e=t.length;const r=new Uint8Array(e);for(;e--;)r[e]=t.charCodeAt(e);return r}static base64ToBlob(t,e){const r=i._b64ToUint8Array(atob(t));return new Blob([r],e)}static dataURLToBlob(t){const e=t.indexOf(",");if(-1===e)return i.base64ToBlob(t);{const r=t.substring(e+1),n=t.substring(0,e).match(/:(.*?);/)[1];return i.base64ToBlob(r,{type:n})}}static async blobToText(t,e){const r=await t.arrayBuffer();return new TextDecoder(e,{fatal:!1}).decode(r)}static textToBlob(t,e="text/plain",r="utf-8",n,s=63){let a=r.toLowerCase();const i=()=>`${e};charset=${a}`;switch(a){case"utf-8":{const e=(new TextEncoder).encode(t),r=n?[new Uint8Array([239,187,191]),e]:[e];return new Blob(r,{type:i()})}case"utf-16":a="utf-16le",n??=!0;case"utf-16le":case"utf-16be":{const e="utf-16be"!==a,r=n?1:0,s=new ArrayBuffer(2*(t.length+r)),o=new DataView(s);n&&o.setUint16(0,65279,e);for(let n=0;n<t.length;n++)o.setUint16(2*(n+r),t.charCodeAt(n),e);return new Blob([s],{type:i()})}case"ascii":case"iso-8859-1":case"latin1":{const e="ascii"===a?127:255,n=new Uint8Array(t.length),o=s>0;for(let a=0;a<t.length;a++){const i=t.charCodeAt(a);if(i>e){if(!o)throw new Error(`Character "${t[a]}" cannot be encoded in ${r}.`);n[a]=s}else n[a]=i}return new Blob([n],{type:i()})}default:throw new Error(`Encoding "${r}" is not supported safely in the browser. Use UTF-8 or any supported encoding.`)}}}const o=(t,e)=>{const r=t.match(e);return r?r[2]:null};const c=/^hsl\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*\)$/,l=/^hsla\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)\)$/,u=/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,h=/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\)$/,d=/^#[a-f0-9]{6}$/,p=/^#[a-f0-9]{3}$/;function f(t){return!r.isNullOrEmpty(t)&&"object"==typeof t&&"r"in t&&"g"in t&&"b"in t&&"number"==typeof t.r&&"number"==typeof t.b&&"number"==typeof t.g&&(t.a??=1,t.r>=0&&t.r<=1&&t.g>=0&&t.g<=1&&t.b>=0&&t.b<=1&&t.a>=0&&t.a<=1)}function g(t){return!r.isNullOrEmpty(t)&&"object"==typeof t&&"h"in t&&"s"in t&&"l"in t&&"number"==typeof t.h&&"number"==typeof t.s&&"number"==typeof t.l&&(t.a??=1,t.h>=0&&t.h<=360&&t.s>=0&&t.s<=1&&t.l>=0&&t.l<=1&&t.a>=0&&t.a<=1)}const y={adjustRgbChannel:t=>t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),adjustRgbChannelInv:t=>t<=.00304?12.92*t:1.055*(Math.pow(t,1/2.4)-.055),adjustRgb:t=>({r:y.adjustRgbChannel(t.r),g:y.adjustRgbChannel(t.g),b:y.adjustRgbChannel(t.b),a:t.a}),adjustRgbInv:t=>({r:y.adjustRgbChannelInv(t.r),g:y.adjustRgbChannelInv(t.g),b:y.adjustRgbChannelInv(t.b),a:t.a}),X:t=>.4125*t.r+.3576*t.g+.1804*t.b,Y:t=>.2126*t.r+.7152*t.g+.0722*t.b,Z:t=>.0193*t.r+.1191*t.g+.9503*t.b,relativeLuminance:t=>{const e=y.adjustRgb(t);return y.Y(e)},rgbToCieXYZ:t=>{const e=y.adjustRgb(t);return{x:y.X(e),y:y.Y(e),z:y.Z(e),a:t.a}},cieXYZToRgb:t=>{const e=3.241*t.x-1.5374*t.y-.4986*t.z,r=-.9692*t.x+1.876*t.y+.0416*t.z,n=.0556*t.x-.204*t.y+1.057*t.z;return y.adjustRgbInv({r:e,g:r,b:n,a:t.a})},contrastRatio:(t,e)=>{const r=y.relativeLuminance(t)+.05,n=y.relativeLuminance(e)+.05;return r>n?r/n:n/r}};function x(t){return t.toString(16).padStart(2,"0")}class m{static{this.WCAG_MINIMUM_CONTRAST=3}static{this.WCAG_NORMAL_TEXT_CONTRAST=4.5}static{this.WCAG_SAFE_CONTRAST=7}static _clampRGB(t){const e=t=>Math.min(1,Math.max(0,t));return null==t[3]&&(t[3]=1),{r:e(t[0]),g:e(t[1]),b:e(t[2]),a:Math.min(1,Math.max(0,t[3]))}}static _normalize(t){return[t[0]/255,t[1]/255,t[2]/255,t[3]]}static parse(t){if(t=(t||"").toLowerCase(),u.test(t)){let e=u.exec(t);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),1]))}if(h.test(t)){let e=h.exec(t);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),parseFloat(e[4])]))}if(d.test(t)){let e=d.exec(t)[0];return this._clampRGB(this._normalize([parseInt("0x"+e.substr(1,2)),parseInt("0x"+e.substr(3,2)),parseInt("0x"+e.substr(5,2)),1]))}if(p.test(t)){let e=p.exec(t)[0],r=e.substr(1,1),n=e.substr(2,1),s=e.substr(3,1);return this._clampRGB(this._normalize([parseInt("0x"+r+r),parseInt("0x"+n+n),parseInt("0x"+s+s),1]))}if(c.test(t)){let e=c.exec(t);const r={h:parseFloat(e[1]),s:.01*parseFloat(e[2]),l:.01*parseFloat(e[3])};return this.rgb(r)}if(l.test(t)){let e=l.exec(t);const r={h:parseFloat(e[1]),s:.01*parseFloat(e[2]),l:.01*parseFloat(e[3]),a:parseFloat(e[4])};return this.rgb(r)}}static hsl(t){const e=function(t){const e=t.r,r=t.g,n=t.b;return(.5*(Math.max(e,r,n)+Math.min(e,r,n))).clamp(0,1)}(t),r=function(t,e){const r=t.r,n=t.g,s=t.b,a=Math.max(r,n,s),i=Math.min(r,n,s);return(0===e||1===e?0:(a-i)/(1-Math.abs(2*e-1))).clamp(0,1)}(t,e),n=function(t){const e=t.r,r=t.g,n=t.b,s=Math.max(e,r,n),a=Math.min(e,r,n);let i=0;return s!==a&&(i=s===e?((r-n)/(s-a)*60+360)%360:s===r?((n-e)/(s-a)*60+120)%360:((e-r)/(s-a)*60+240)%360),i.clamp(0,360)}(t);return{h:n,s:r,l:e,a:t.a}}static cieXYZ(t){return g(t)&&(t=this.rgb(t)),y.rgbToCieXYZ(t)}static rgb(t){if(!g(t)){const e=y.cieXYZToRgb(t);return this._clampRGB([e.r,e.g,e.b,e.a])}{const e=t.h,r=t.s,n=t.l,s=e/60,a=(1-Math.abs(2*n-1))*r,i=a*(1-Math.abs(s%2-1)),o=n-a/2,c=(e,r,n)=>this._clampRGB([e+o,r+o,n+o,t.a]);if(s<=1)return c(a,i,0);if(s<=2)return c(i,a,0);if(s<=3)return c(0,a,i);if(s<=4)return c(0,i,a);if(s<=5)return c(i,0,a);if(s<=6)return c(a,0,i)}}static stringify(t,e=1){if(g(t)){e??=1,t.a??=1;const r="number"==typeof e?e:1;return`hsla(${t.h.roundoff(r)},${(100*t.s).roundoff(r)}%,${(100*t.l).roundoff(r)}%,${t.a.roundoff()})`}if(f(t)){e??=!0,t.a??=1;const r="boolean"==typeof e?e:!!e,n=Math.round(255*t.r),s=Math.round(255*t.g),a=Math.round(255*t.b),i=t.a.roundoff();return 1===i?r?("#"+x(n)+x(s)+x(a)).toUpperCase():`rgb(${n},${s},${a})`:`rgba(${n},${s},${a},${i})`}}static contrastRatio(t,e){return g(t)&&(t=this.rgb(t)),g(e)&&(e=this.rgb(e)),y.contrastRatio(t,e)}static luminance(t){return g(t)&&(t=m.rgb(t)),y.relativeLuminance(t)}static lighten(t,e=.1){if(e||=0,g(t)){const r=Math.min(1,Math.max(0,t.l+e));return Object.assign({},t,{l:r})}if(f(t)){const r=this.lighten(this.hsl(t),e);return this.rgb(r)}return t}static darken(t,e=.1){return this.lighten(t,-e)}static saturate(t,e=.1){if(e||=0,g(t)){const r=Math.min(1,Math.max(0,t.s+e));return Object.assign({},t,{s:r})}if(f(t)){const r=this.saturate(this.hsl(t),e);return this.rgb(r)}return t}static desaturate(t,e=.1){return this.saturate(t,-e)}static interpolate(t,e,r,n){r??=.5,n??=r;const s=(r+n).roundoff(),a=(r/s).roundoff(),i=(n/s).roundoff(),o=f(t),c=g(t),l=t=>f(t)||g(t)?m.cieXYZ(t):t;t=l(t),e=l(e);const u={x:(t.x*a+e.x*i).roundoff(),y:(t.y*a+e.y*i).roundoff(),z:(t.z*a+e.z*i).roundoff(),a:(t.a*a+e.a*i).roundoff()};return o?m.rgb(u):c?m.hsl(m.rgb(u)):u}}const b=/[-+]?([\d]+(\.[\d]+(e-[\d]+)?)?|[\d]*(\.[\d]+(e-[\d]+)?))/g;function w(t){const e=[];let r=t.match(b);return r&&r.length>0&&r.forEach(t=>e.push(parseFloat(t))),e}class k{static isAngle(t){return"object"==typeof t&&"vertex"in t&&C.isPoint(t.vertex)&&"start"in t&&C.isPoint(t.start)&&"end"in t&&C.isPoint(t.end)}static value(t){if(r.isNullOrEmpty(t)||!k.isAngle(t))return Number.NaN;const{vertex:e,start:n,end:s}=t;return k.angleBetween(e,n,s)}static angleBetween(t,e,r){const n=e.x-t.x,s=e.y-t.y,a=r.x-t.x,i=r.y-t.y,o=n*a+s*i,c=n*i-s*a;return-Math.atan2(c,o)}}class ${static parse(t){let e=w(t);if(e&&2===e.length)return{width:e[0],height:e[1]};throw new Error(`Cannot parse "${t}" as a valid Size.`)}static isSize(t){return"object"==typeof t&&"width"in t&&"number"==typeof t.width&&"height"in t&&"number"==typeof t.height}}class C{static parse(t){let e=w(t);if(e&&2===e.length)return{x:e[0],y:e[1]};throw new Error(`Cannot parse "${t}" as a valid Point.`)}static isPoint(t){return"object"==typeof t&&"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y}static distance(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}static subtract(t,e){return{x:e.x-t.x,y:e.y-t.y}}static add(...t){var e={x:0,y:0};for(var r of t)e.x+=r.x,e.y+=r.y;return e}static multiply(t,e){return{x:t.x*e,y:t.y*e}}}class M{static isIdentity(t){return 1===t.a&&1===t.d&&0===t.b&&0===t.f&&0===t.c&&0===t.e}static get identity(){return{a:1,b:0,c:0,d:1,e:0,f:0}}static copy(t){return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e,f:t.f}}static scale(t,e,r=e){return{a:t.a*e,b:t.b,c:t.c,d:t.d*r,e:t.e,f:t.f}}static translate(t,e){return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e+e.x,f:t.f+e.y}}static rotate(t,e){const r=Math.cos(e),n=Math.sin(e);return M.multiply(t,{a:r,b:n,c:-n,d:r,e:0,f:0})}static multiply(t,e){return"x"in t&&"y"in t?"number"==typeof e?{x:t.x*e,y:t.y*e}:{x:t.x*e.a+t.y*e.c+e.e,y:t.x*e.b+t.y*e.d+e.f}:"number"==typeof e?{a:t.a*e,b:t.b*e,c:t.c*e,d:t.d*e,e:t.e*e,f:t.f*e}:{a:t.a*e.a+t.b*e.c,b:t.a*e.b+t.b*e.d,c:t.c*e.a+t.d*e.c,d:t.c*e.b+t.d*e.d,e:t.e*e.a+t.f*e.c+e.e,f:t.e*e.b+t.f*e.d+e.f}}static det(t){return t.a*t.d-t.c*t.b}static invert(t){const e=this.det(t);if(0===e)return null;const r=1/e;return this.multiply({a:t.d,b:-t.b,c:-t.c,d:t.a,e:-t.e*t.d+t.c*t.f,f:t.e*t.b-t.a*t.f},r)}static toComponents(t,e={x:0,y:0}){const r=Math.sqrt(t.a*t.a+t.c*t.c),n=Math.sqrt(t.b*t.b+t.d*t.d),s=0!=r?t.a/r:0,a=0!=r?t.c/r:0,i=Math.atan2(a,s),{x:o,y:c}=e;return{scaleX:r,scaleY:n,rotation:i,translation:{x:t.e-o*(r*s-1)+c*r*a,y:t.f-c*(n*s-1)-o*n*a}}}static fromTransform([t,e,r],[n,s,a]){const i=t.x*(e.y-r.y)-t.y*(e.x-r.x)+(e.x*r.y-r.x*e.y);if(Math.abs(i)<1e-10)throw new Error("Points are collinear; matrix is singular and cannot be solved.");const o=1/i;return{a:o*(n.x*(e.y-r.y)+s.x*(r.y-t.y)+a.x*(t.y-e.y)),b:o*(n.y*(e.y-r.y)+s.y*(r.y-t.y)+a.y*(t.y-e.y)),c:o*(n.x*(r.x-e.x)+s.x*(t.x-r.x)+a.x*(e.x-t.x)),d:o*(n.y*(r.x-e.x)+s.y*(t.x-r.x)+a.y*(e.x-t.x)),e:o*(n.x*(e.x*r.y-r.x*e.y)+s.x*(r.x*t.y-t.x*r.y)+a.x*(t.x*e.y-e.x*t.y)),f:o*(n.y*(e.x*r.y-r.x*e.y)+s.y*(r.x*t.y-t.x*r.y)+a.y*(t.x*e.y-e.x*t.y))}}static areClose(t,e,r=12){return t.a.isCloseTo(e.a,r)&&t.b.isCloseTo(e.b,r)&&t.c.isCloseTo(e.c,r)&&t.d.isCloseTo(e.d,r)&&t.e.isCloseTo(e.e,r)&&t.f.isCloseTo(e.f,r)}}class I{static parse(t){let e=w(t);if(e&&4===e.length)return{x:e[0],y:e[1],width:e[2],height:e[3]};throw new Error(`Cannot parse "${t}" as a valid Rect.`)}static isRect(t){return C.isPoint(t)&&$.isSize(t)}static _stretch(t,e){return{a:e.width/t.width,b:0,c:0,d:e.height/t.height,e:e.x-t.x,f:e.y-t.y}}static _contain(t,e,r,n){let s=1;s=t.width/t.height>=e.width/e.height?e.width/t.width:e.height/t.height;const a=t.width*s,i=t.height*s,o=this._align({x:t.x,y:t.y,width:a,height:i},e,r,n);return M.translate({a:s,b:0,c:0,d:s,e:0,f:0},o)}static _cover(t,e,r,n){let s=1;s=t.width/t.height<e.width/e.height?e.width/t.width:e.height/t.height;const a=t.width*s,i=t.height*s,o=this._align({x:t.x,y:t.y,width:a,height:i},e,r,n);return M.translate({a:s,b:0,c:0,d:s,e:0,f:0},o)}static _align(t,e,r,n){let s=0,a=0;switch(r){case"left":s=e.x-t.x;break;case"right":s=e.x+e.width-t.width-t.x;break;default:s=e.x+.5*e.width-.5*t.width-t.x}switch(n){case"top":a=e.y-t.y;break;case"bottom":a=e.y+e.height-t.height-t.y;break;default:a=e.y+.5*e.height-.5*t.height-t.y}return{x:s,y:a}}static findTransform(t,e,r="stretch",n="center",s="middle"){switch(r){case"contain":return this._contain(t,e,n,s);case"cover":return this._cover(t,e,n,s);default:return this._stretch(t,e)}}static intersect(...t){const e={x:0,y:0,height:0,width:0},r=Array.from(t||[]);if(r.length<=0)return e;for(var n=r[0],s=1;s<r.length;s++){const t=r[s],a=Math.max(t.x,n.x),i=Math.max(t.y,n.y),o=Math.min(t.x+t.width,n.x+n.width)-a,c=Math.min(t.y+t.height,n.y+n.height)-i;if(o<0||c<=0)return e;n={x:a,y:i,width:o,height:c}}return n}static expand(t,...e){const r=Array.from(e||[]);let n=t.x,s=t.y,a=n,i=s;I.isRect(t)&&(a+=t.width,i+=t.height);for(let t of r)n=Math.min(t.x,n),s=Math.min(t.y,s),a=Math.max(t.x,a),i=Math.max(t.y,i);return{x:n,y:s,width:a-n,height:i-s}}}const S={mode:"stretch",align:"center",valign:"middle",quality:1,type:"image/jpeg"};class v{static async loadImage(t){const e=await fetch(t);if(!e.ok)return null;return await e.blob()}static async resizeImage(t,e,r,n){if(e<=0||r<=0||isNaN(e)||isNaN(r))throw new Error("Invalid target size");"string"==typeof t&&(t=await v.loadImage(t));const s=await self.createImageBitmap(t),a=s.width,i=s.height,o=new OffscreenCanvas(a,i),c=o.getContext("2d");c.imageSmoothingEnabled=c.mozImageSmoothingEnabled=c.oImageSmoothingEnabled=c.webkitImageSmoothingEnabled=!0;const{quality:l,type:u,mode:h,align:d,valign:p,background:f}=Object.assign({},S,n??{}),g={width:a,height:i,x:0,y:0},y={x:0,y:0,width:e,height:r},x=I.findTransform(g,y,h,d,p);o.width=e,o.height=r,f&&(c.fillStyle=f,c.fillRect(0,0,o.width,o.height)),c.setTransform(x),c.drawImage(s,0,0);return await o.convertToBlob({quality:l,type:u})}}class _{static#t;static uniqueId(){let t=_.#t||Date.now();return _.#t=++t}static uniqueCode(){return _.uniqueId().toBase62()}static randomString(t){let e="";do{e+=(62*Math.random()).toBase62()}while(e.length<t);return e}}function L(t,e){const r=t.length,n=e.length,s=Array.from({length:r+1},()=>Array(n+1).fill(0));for(let a=1;a<=r;a++)for(let r=1;r<=n;r++)t[a-1]===e[r-1]?s[a][r]=s[a-1][r-1]+1:s[a][r]=Math.max(s[a-1][r],s[a][r-1]);return s}function R(t,e,r,n=""){const s=t.length,a=e.length,i=[];let o=s,c=a,l=null;const u=()=>{l&&(i.push(l),l=null)};for(;o>0||c>0;){var h=null;let s=null;o>0&&c>0&&t[o-1]===e[c-1]?(h="=",s=t[o-1],o--,c--):c>0&&(0===o||r[o][c-1]>=r[o-1][c])?(h="+",s=e[c-1],c--):o>0&&(0===c||r[o-1][c]>r[o][c-1])&&(h="-",s=t[o-1],o--),h&&null!==s?l&&l.type===h?l.value=s+(l.value?n:"")+l.value:(u(),l={type:h,value:s}):u()}return u(),i.reverse()}class A{tokenize(t,e){const r=[];for(;t;){const n=t.length;for(let n of e){const e=n.exec(t,this),s=e?.length;if(s>0){Array.prototype.push.apply(r,e);const n=e[s-1];t=t.substr((n.index||0)+n.raw.length);break}}if(t.length>=n)throw new Error(`Cannot parse\n"${t}"\n using the provided grammar.`)}return r}}let E=class{constructor(t=new A){this._lexer=t}parse(t,e,r){const n=this._lexer.tokenize(t,e);return r.render(n)}};function B(t){return(t??"").replace(/</g,"&lt;")}function N(t){return t?.index||void 0}function O(t){return t?.replace(/[^\w]+/g," ").trim().replace(/ +/g,"-").toLowerCase()}function z(t,e,r){const n=e.exec(t);return n&&n.length?r(n):null}const T=/(<!--)([\s\S]*?)(-->|$)/,j=/^ {0,3}(={3,}|_{3,}|-{3,})(\r?\n|$)/,F=/^ {0,3}(#{1,6})\s+([^\n]+)(\r?\n|$)+/,H=/^ {0,3}([^\n]+)(\r?\n=+(\r?\n|$))+/,U=/^ {0,3}([^\n]+)(\r?\n-+(\r?\n|$))+/,D=/^ {4,}.+(\r?\n {4,}.+)*(\r?\n|$)+/,P=/^ {0,3}``` *([^\n]*)\r?\n(([\s\S](?!\r?\n {0,3}```))*.(\r?\n)+) {0,3}```(\r?\n|$)+/,q=/^ {0,3}> *([^\n]+)(\r?\n {0,3}> *([^\n]*))*(\r?\n|$)+/,Y=/^( {0,3}([-+]).*\r?\n|$)((?!(?: {0,3}(?:\d+[.\)]|\r?\n\S))).*(\r?\n|$))*/,G=/^( {0,3}(\d+[.\)]).*\r?\n|$)((?!(?: {0,3}(?:[+-]|\r?\n\S))).*(\r?\n|$))*/,Q=/^(?:[-+*]|\d+[.\)])/m,X=/^(?! {4,})(.+(\n(?! {0,3}```)(?! {0,3}([-+]|\d+[.\)]))(?! {4,})(?! {0,3}>).+)*)/,Z=/^ {0,3}(!?)\[([^\]]+)\]: +(\S+)(?: +['"\(](.+)['"\)])?(\r?\n|$)+/,W=/!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?(\[[^\[\]]*\]|\([^\(\)]*\))?/,J=/(\*\*?|__?)(\[[^\]]*]\([^\)]+\))\1/,K=/(?:(?<!\\)`)(.+?)(?:(?<!\\)`)/,V=/(\*\*?|__?)((?!\1\s?)(?:(?!\1)[\S\s])*[^\s])\1/,tt=/(~~?|__?)(?!\1\s?)([^\s][\s\S]*?(?!\1)[^\s])\1/,et=/(:")(?!":\s?)([^\s][\s\S]*?(?!":)[^\s])":/,rt=/^\s+/,nt=/ {2,}\r?\n/,st=/^[^\r\n]+/;var at,it;function ot(t=[]){const e={[it.Comment]:{exec:(t,e)=>z(t,T,r=>{const n=N(r),s=[{type:at.Html,index:n,raw:r[0],text:r[2]}];if(n>0){const r=t.substr(0,n),a=e.tokenize(r,g);Array.prototype.unshift.apply(s,a)}return s})},[it.Reference]:{exec:t=>z(t,Z,t=>{const e=N(t),r=t[0],n=r,s="!"===t[1],a=t[2],i=t[3],o=t[4];return[{type:at.Reference,index:e,raw:r,text:n,id:a,image:s,url:i,title:o}]})}},n=[],s=[],a={};for(let e of t){let t,r="inline";switch("type"in e?(r=e.type,t=e.rule):t=e,r){case"block":n.push(t);break;case"code":if("lang"in e){const r=e.lang.toLowerCase();(a[r]=a[r]||[]).push(t)}break;default:const r={exec:(e,r)=>{const n=t.exec(e,r);return c(e,n,r),n}};s.push(r)}}const i={[it.Text]:{exec:t=>z(t,st,t=>{const e=t[0],r=e;return[{index:N(t),raw:e,text:r,type:at.Text}]})},[it.Space]:{exec:t=>z(t,rt,t=>{const e=t[0];return[{type:at.Space,raw:e,text:e}]})}},o={[it.ImageOrLink]:{exec:(t,e)=>l(t,W,e,t=>{const n=N(t),s=t[0],a="!"===s.charAt(0),i=t[1],o=function(t){if(!(r.isNullOrEmpty(t)||/^\[/.test(t)&&/\]$/.test(t)))return/^\(/.test(t)&&/\)$/.test(t)&&(t=t.substr(1,t.length-2)),t}(t[2]),c=O(function(t){if(!(r.isNullOrEmpty(t)||/^\(/.test(t)&&/\)$/.test(t)))return/^\[/.test(t)&&/\]$/.test(t)&&(t=t.substr(1,t.length-2)),t}(t[2])??i);return a?[{index:n,type:o?at.Image:at.ImageLike,raw:s,text:i,src:o,ref:c,tokens:e.tokenize(i,u)}]:[{index:n,type:o?at.Link:at.LinkLike,raw:s,text:i,href:o,ref:c,tokens:e.tokenize(i,u)}]})},[it.Code]:{exec:(t,e)=>l(t,K,e,t=>{const e=B(t[1]);return[{type:at.Code,raw:t[0],text:e,index:N(t)}]})},[it.EmphasizedLink]:{exec:(t,e)=>l(t,J,e,t=>{if(t.length<3||r.isNullOrEmpty(t[2]))return null;const n=t[1].length>1?at.Bold:at.Italic,s=t[2];return[{index:N(t),type:n,raw:t[0],text:s,tokens:e.tokenize(s,u)}]})},[it.Emphasize]:{exec:(t,e)=>l(t,V,e,t=>{if(t.length<3||r.isNullOrEmpty(t[2]))return null;const n=t[1].length>1?at.Bold:at.Italic,s=t[2];return[{index:N(t),type:n,raw:t[0],text:s,tokens:e.tokenize(s,u)}]})},[it.StrikeThrough]:{exec:(t,e)=>l(t,tt,e,t=>{if(t.length<3||r.isNullOrEmpty(t[2]))return null;const n=at.StrikeThrough,s=t[2];return[{index:N(t),type:n,raw:t[0],text:s,tokens:e.tokenize(s,u)}]})},[it.Quote]:{exec:(t,e)=>l(t,et,e,t=>{if(t.length<3||r.isNullOrEmpty(t[2]))return null;const n=at.Quote,s=t[2];return[{index:N(t),type:n,raw:t[0],text:s,tokens:e.tokenize(s,u)}]})},[it.LineBreak]:{exec:(t,e)=>l(t,nt,e,t=>{const e=t[0],r=e;return[{index:N(t),raw:e,text:r,type:at.LineBreak}]})}},c=(t,e,r)=>{const n=e?.length>0&&e[0].index;if(n>0){const s=t.substr(0,n),a=r.tokenize(s,u)||[];Array.prototype.unshift.apply(e,a)}},l=(t,e,r,n)=>{const s=z(t,e,r=>{if(e!=K){const e=K.exec(t);if(e&&e.length&&e.index<r.index)return null}return n(r)});return c(t,s,r),s},u=Object.values(o);Array.prototype.push.apply(u,s),u.push(i[it.Text],i[it.Space]);const h=t=>{const e=[i[it.Text],i[it.Space]],r=t?.toLowerCase()||"";return r&&r in a&&Array.prototype.unshift.apply(e,a[r]),e},d={[it.Paragraph]:{exec:(t,e)=>z(t,X,t=>{const r=t[0],n=r;return[{type:at.Paragraph,raw:r,text:n,tokens:e.tokenize(n,u)}]})},[it.Space]:i[it.Space]},p=(t,e)=>{const r=/^ {0,3}(`{3,}|$|>|[+-]\s|\d+[.\)])/m.test(t)?g:u;return e.tokenize(t,r)},f={[it.HorizontalRule]:{exec:(t,e)=>z(t,j,t=>{const e=t[0],r=e;return[{type:at.HorizontalRule,raw:e,text:r}]})},[it.Heading]:{exec:(t,e)=>z(t,F,t=>{const r=t[2];return[{type:at.Heading,raw:t[0],text:r,level:t[1].length,ref:O(r),tokens:e.tokenize(r,u)}]})},[it.Heading1]:{exec:(t,e)=>z(t,H,t=>{const r=t[1];return[{type:at.Heading,raw:t[0],text:r,level:1,ref:O(r),tokens:e.tokenize(r,u)}]})},[it.Heading2]:{exec:(t,e)=>z(t,U,t=>{const r=t[1];return[{type:at.Heading,raw:t[0],text:r,level:2,ref:O(r),tokens:e.tokenize(r,u)}]})},[it.CodeBlock]:{exec:(t,e)=>z(t,D,t=>{const r=t[0],n=B(r);return[{type:at.CodeBlock,raw:r,text:n,tokens:e.tokenize(n,[])}]})},[it.Fences]:{exec:(t,e)=>z(t,P,t=>{const r=B(t[2]),n=t[1]?.toLowerCase();return[{type:at.CodeBlock,raw:t[0],text:r,lang:n,tokens:e.tokenize(r,h(n))}]})},[it.BlockQuote]:{exec:(t,e)=>z(t,q,t=>{const r=t[0],n=r.replace(/^ {0,3}> */gm,"");return[{type:at.BlockQuote,raw:r,text:n,tokens:e.tokenize(n,[d[it.Paragraph],d[it.Space]])}]})},[it.OrderedList]:{exec:(t,e)=>z(t,G,t=>{const n=t[0],s=n.replace(/^ {0,3}/gm,"").split(Q).filter(t=>!r.isNullOrEmpty(t)).map(t=>t.trim());return[{type:at.OrderedList,start:parseInt(/\d/.exec(t[0])[0]),raw:n,text:n,tokens:s.map(t=>({type:at.ListItem,raw:t,text:t,tokens:p(t,e)}))}]})},[it.UnorderedList]:{exec:(t,e)=>z(t,Y,t=>{const n=t[0],s=n.replace(/^ {0,3}/gm,"").split(Q).filter(t=>!r.isNullOrEmpty(t)).map(t=>t.trim());return[{type:at.UnorderedList,raw:n,text:n,tokens:s.map(t=>({type:at.ListItem,raw:t,text:t,tokens:p(t,e)}))}]})}},g=Object.values(f);return Array.prototype.push.apply(g,n),g.push(d[it.Paragraph],d[it.Space]),[e[it.Comment],e[it.Reference]].concat(g)}!function(t){t.Html="html",t.Text="text",t.Paragraph="paragraph",t.BlockQuote="blockquote",t.Space="space",t.Heading="heading",t.Bold="bold",t.Italic="italic",t.CodeBlock="codeblock",t.Code="code",t.Image="img",t.ImageLike="imglike",t.Link="link",t.LinkLike="linklike",t.LineBreak="br",t.StrikeThrough="strike",t.Quote="quote",t.HorizontalRule="hr",t.OrderedList="ol",t.UnorderedList="ul",t.ListItem="listitem",t.Reference="ref"}(at||(at={})),function(t){t[t.Comment=0]="Comment",t[t.Reference=1]="Reference",t[t.HorizontalRule=2]="HorizontalRule",t[t.Heading=3]="Heading",t[t.Heading1=4]="Heading1",t[t.Heading2=5]="Heading2",t[t.CodeBlock=6]="CodeBlock",t[t.Fences=7]="Fences",t[t.BlockQuote=8]="BlockQuote",t[t.OrderedList=9]="OrderedList",t[t.UnorderedList=10]="UnorderedList",t[t.Paragraph=11]="Paragraph",t[t.EmphasizedLink=12]="EmphasizedLink",t[t.ImageOrLink=13]="ImageOrLink",t[t.Emphasize=14]="Emphasize",t[t.StrikeThrough=15]="StrikeThrough",t[t.Quote=16]="Quote",t[t.Code=17]="Code",t[t.LineBreak=18]="LineBreak",t[t.Text=254]="Text",t[t.Space=255]="Space"}(it||(it={}));const ct=/[ \r\n]*\0+[ \r\n]*/g;class lt{constructor(t=(t,e)=>t?.text||""){this._extraItemRender=t,this._renderContent=t=>{const e=t.tokens;return r.isNullOrEmpty(e)?t.text:this._render(e)}}_rendeItem(t,e){const r=this._renderContent,n="\0";switch(t?.type){case at.Reference:return"";case at.Html:return t.raw;case at.BlockQuote:return`<blockquote>\n${r(t)}</blockquote>${n}`;case at.Bold:return`<b>${r(t)}</b>`;case at.CodeBlock:const s=t.lang;return`<pre>${n}<code${s?' class="'+s+'"':""}>${r(t)}</code>${n}</pre>${n}`;case at.Code:return`<code>${r(t)}</code>`;case at.HorizontalRule:return`<hr />${n}`;case at.Heading:const a=t.level;return`<h${a} id="${t.ref}">${r(t)}</h${a}>${n}`;case at.Image:case at.ImageLike:const i=t;let o=i.src,c="";const l=i.text,u=i.ref;if(!o&&u){const t=e.find(t=>t.type===at.Reference&&!0===t.image&&t.id?.toLowerCase()===u.toLowerCase());t&&(o=t.url,c=t.title??"")}return o?`<img src="${o}" alt="${l}"${c?' title="'+c+'"':""} />`:`![${r(t)}]`;case at.Italic:return`<i>${r(t)}</i>`;case at.StrikeThrough:return`<s>${r(t)}</s>`;case at.Quote:return`<q>${r(t)}</q>`;case at.LineBreak:return"<br />\0";case at.OrderedList:return`<ol start="${t.start}">\n${r(t)}</ol>${n}`;case at.UnorderedList:return`<ul>\n${r(t)}</ul>${n}`;case at.ListItem:return`\t<li>${r(t)}</li>${n}`;case at.Link:case at.LinkLike:const h=t;let d=h.href,p="";const f=h.ref;if(!d&&f){const t=e.find(t=>t.type===at.Reference&&!0!==t.image&&t.id?.toLowerCase()===f.toLowerCase());t&&(d=t.url,p=t.title??"")}return d?`<a href="${d}"${p?' title="'+p+'"':""}>${r(t)}</a>`:`[${r(t)}]`;case at.Paragraph:return`<p>${r(t)}</p>${n}`;case at.Text:case at.Space:return t.text}return this._extraItemRender(t,e)}_render(t){let e="";for(let r of t||[])e+=this._rendeItem(r,t);return e}render(t){return e=this._render(t),e?.replace(ct,"\n").trim();var e}}class ut{_render(t){return r.isNullOrEmpty(t)?"":JSON.stringify(t)}render(t){return"["+t.filter(t=>!r.isNullOrEmpty(t)).map(this._render).join(",")+"]"}}var ht=Object.freeze({__proto__:null,Parser:class extends E{toHtml(t,e,n){const s=new lt(n);return r.isNullOrEmpty(e)?this.parse(t,s):this.parse(t,ot(e),s)}tokenize(t,e){const r=this.parse(t,ot(e),new ut);return JSON.parse(r)}parse(t,e=ot(),r=new lt){return(n=e)&&"object"==typeof n&&"function"==typeof n.render?super.parse(t,ot(),e):super.parse(t,e,r);var n}}}),dt=Object.freeze({__proto__:null,Markdown:ht,Parser:E}),pt=Object.freeze({__proto__:null,Angle:k,Arrays:class{static range(t,e,n=2){let s=t;r.isNull(e)&&(e=n=t,t=1);const a=(e-t)/(n-1),i=[];if(a>0)for(;i.length<n;)i.push(s.roundoff()),s+=a;return i}static chunkify(t,e){if(r.isNullOrEmpty(t))return[];if(e<=0||e%1!=0)throw new Error("Provide a positive integer number.");const n=Math.ceil(t.length/e);return Array.from({length:n},(r,n)=>{const s=n*e,a=s+e;return t.slice(s,a)})}},Blobs:i,Colors:m,Compile:dt,Dates:e,DeepMerger:a,HistoryService:class{constructor(t,e){this.#e=t,this.#r=e}#n=[];#s=[];#r;#e;get current(){return this.#e}get canUndo(){return this.#n.length>0}get canRedo(){return this.#s.length>0}set maxlength(t){this.#r=t}undo(){if(this.canUndo){const t=this.#n,e=this.#s,r=this.#e;e.unshift(r),this.#e=t.pop()}}redo(){if(this.canRedo){const t=this.#n,e=this.#s,r=this.#e;t.push(r),this.#e=e.shift()}}push(t){this.#s.splice(0),this.#n.push(this.#e),this.#e=t;const e=this.#r,r=this.#n;e>0&&r.length>e&&r.splice(0,r.length-e)}reset(){this.#s.splice(0),this.#n.splice(0)}},Imaging:v,Keys:_,Matrix2D:M,NullChecker:r,Numbers:class{static round(t,e=1){return Math.round(t/e)*e}static log(t,e){return Math.log10(t)/Math.log10(e)}static rebase(t,e,r){const n=t.toString(),s=parseInt(n,e);return n.endsWith(s.toString(e))?parseInt(t.toString(),e).toString(r):Number.NaN.toString()}},Point:C,Rect:I,Size:$,Strings:class{static leftPad(t,e,r){return t.toString().padStart(e,r)}static format(t,...e){const n=Array.from(e);let s=t;for(let t=0;t<n.length;t++){const e=new RegExp("(^|[^\\{])\\{"+t+"\\}($|[^\\}])","g");s=s.replaceAll(e,(e,...r)=>e.replace("{"+t+"}",n[t]))}const a=/(^|[^\{}])\{(\d+)\}($|[^\}])/.exec(s);if(!r.isNullOrEmpty(a))throw new Error(`Missing argument at index ${a[2]}.`);return s}static diff(t,e,r="char"){switch(r){case"line":return function(t,e){const r=/\r?\n/,n=t.split(r),s=e.split(r);return R(n,s,L(n,s),"\n")}(t,e);case"word":return function(t,e){const r=/(\S+|\s+)/g,n=t.match(r)||[],s=e.match(r)||[];return R(n,s,L(n,s),"")}(t,e);default:return function(t,e){const r=t.split(""),n=e.split("");return R(r,n,L(r,n),"")}(t,e)}}static async hash(t,e="SHA-256"){const r=await crypto.subtle.digest(e,(new TextEncoder).encode(t));return Array.from(new Uint8Array(r)).map(t=>t.toString(16).padStart(2,"0")).join("")}},detect:function(t=navigator.userAgent){let e="unknown",r=null;switch(/ucbrowser/i.test(t)?e="UCBrowser":/edg/i.test(t)?e="Edge":/googlebot/i.test(t)?e="GoogleBot":/chromium/i.test(t)?e="Chromium":/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t)?e="Firefox":/; msie|trident/i.test(t)&&!/ucbrowser/i.test(t)?e="IE":/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t)?e="Chrome":/safari/i.test(t)&&!/chromium|edg|ucbrowser|chrome|crios|opr|opera|fxios|firefox/i.test(t)?e="Safari":/opr|opera/i.test(t)&&(e="Opera"),e){case"UCBrowser":r=o(t,/(ucbrowser)\/([\d\.]+)/i);break;case"Edge":r=o(t,/(edge|edga|edgios|edg)\/([\d\.]+)/i);break;case"GoogleBot":r=o(t,/(googlebot)\/([\d\.]+)/i);break;case"Chromium":r=o(t,/(chromium)\/([\d\.]+)/i);break;case"Firefox":r=o(t,/(firefox|fxios)\/([\d\.]+)/i);break;case"Chrome":r=o(t,/(chrome|crios)\/([\d\.]+)/i);break;case"Safari":r=o(t,/(safari)\/([\d\.]+)/i);break;case"Opera":r=o(t,/(opera|opr)\/([\d\.]+)/i);break;case"IE":{const e=o(t,/(trident)\/([\d\.]+)/i);r=e?`${parseFloat(e)+4}`:"7.0";break}default:r="0.0.0.0"}return{name:e,version:r}},parseAsNumericalArray:w});a.merge(pt)}();
6
+ !function(){"use strict";Number.prototype.isCloseTo=function(t,e=14){const r=Number(`1e-${e}`);return this>t-r&&this<t+r},Number.prototype.roundoff=function(t=14){return parseFloat(this.toFixed(t))},Number.prototype.clamp=function(t,e){let r=this;return null==t||isNaN(t)||(r=Math.max(r,t)),null==e||isNaN(e)||(r=Math.min(r,e)),r},Number.prototype.toBase62=function(){for(var t=this,e="";0!=t;){e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".charAt(t%62)+e,t=Math.floor(t/62)}return e},Number.prototype.toBase36=function(){return this.toString(36)};const t=/^\/Date\([\d]+\)\/$/i;class Dates{static parse(e){let r;return"string"==typeof e?(r=t.test(e)?parseInt(e.substring(6)):Date.parse(e),new Date(r)):"number"==typeof e?new Date(e):e}static isLeapYear(t){return t%4==0&&t%100!=0||t%400==0}static daysInMonth(t,e){return[31,Dates.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]}static isDate(t){return t instanceof Date&&!isNaN(t.valueOf())}static dateOnly(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}static addMonths(t,e){let r=t.getDate(),n=new Date(t),s=n.getMonth()+e,a=0;for(;s<0;)s+=12,a--;return n.setDate(1),n.setMonth(s%12),n.setFullYear(n.getFullYear()+a+Math.floor(s/12)),n.setDate(Math.min(r,Dates.daysInMonth(n.getFullYear(),n.getMonth()))),n}static addDays(t,e){return new Date(t.valueOf()+864e5*e)}static daysBetween(t,e){return(e.valueOf()-t.valueOf())/864e5}}class NullChecker{static isNull(t){return null==t}static isEmpty(t){try{return Array.isArray(t)&&0===t.length||"string"==typeof t&&""===t||"object"==typeof t&&0===Object.keys(t).length&&!Dates.isDate(t)&&!(t instanceof RegExp)&&!(t instanceof FileSystemDirectoryHandle)&&!(t instanceof FileSystemFileHandle)}catch(t){return!1}}static isNullOrEmpty(t){return NullChecker.isNull(t)||NullChecker.isEmpty(t)}}function e(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)&&(t.constructor===Object||void 0===t.constructor)}function r(t,n){const s=t;for(const t of Object.keys(n)){const a=n[t],i=s[t];e(a)?s[t]=r(e(i)?i:{},a):Array.isArray(a)?s[t]=a.slice():s[t]=a}return s}Array.prototype.distinct=function(){return Array.from(new Set(this))},Array.prototype.union=function(t){const e=NullChecker.isNullOrEmpty(this),r=NullChecker.isNullOrEmpty(t);return e&&r?[]:r?this.slice():e?t.slice():this.concat(t).distinct()},Array.prototype.moveWithin=function(t,e){const r="Index must be greater or equal than 0 and less or equal than the length of the array.";var n=this;if(t<0||t>n.length)throw new Error(r);if(e<0||e>n.length)throw new Error(r);n.splice(e,0,Array.prototype.splice.apply(n,[t,1])[0])},Array.prototype.equalsContent=function(t){if(null==t||this.length!==t.length)return!1;for(let e=0;e<this.length;e++)if(this[e]!==t[e])return!1;return!0},Array.prototype.cloneFrom=function(t){if(null==t)throw"Cannot clone array from null object.";const e=t.length;var r=this.length!==t.length;for(let n=0;n<e;n++){const e=t[n];this.length>n?this[n]!==e&&(this[n]=e,r=!0):(Array.prototype.push.apply(this,[e]),r=!0)}r&&this.splice(e)};class DeepMerger{constructor(){}static merge(t,e){return e??=globalThis.Pacem??={},r(e,t)}}class Blobs{static blobToDataURL(t){return new Promise((e,r)=>{const n=new FileReader;n.onload=t=>{e(t.target.result)},n.readAsDataURL(t)})}static _b64ToUint8Array(t){let e=t.length;const r=new Uint8Array(e);for(;e--;)r[e]=t.charCodeAt(e);return r}static base64ToBlob(t,e){const r=Blobs._b64ToUint8Array(atob(t));return new Blob([r],e)}static dataURLToBlob(t){const e=t.indexOf(",");if(-1===e)return Blobs.base64ToBlob(t);{const r=t.substring(e+1),n=t.substring(0,e).match(/:(.*?);/)[1];return Blobs.base64ToBlob(r,{type:n})}}static async blobToText(t,e){const r=await t.arrayBuffer();return new TextDecoder(e,{fatal:!1}).decode(r)}static textToBlob(t,e="text/plain",r="utf-8",n,s=63){let a=r.toLowerCase();const i=()=>`${e};charset=${a}`;switch(a){case"utf-8":{const e=(new TextEncoder).encode(t),r=n?[new Uint8Array([239,187,191]),e]:[e];return new Blob(r,{type:i()})}case"utf-16":a="utf-16le",n??=!0;case"utf-16le":case"utf-16be":{const e="utf-16be"!==a,r=n?1:0,s=new ArrayBuffer(2*(t.length+r)),o=new DataView(s);n&&o.setUint16(0,65279,e);for(let n=0;n<t.length;n++)o.setUint16(2*(n+r),t.charCodeAt(n),e);return new Blob([s],{type:i()})}case"ascii":case"iso-8859-1":case"latin1":{const e="ascii"===a?127:255,n=new Uint8Array(t.length),o=s>0;for(let a=0;a<t.length;a++){const i=t.charCodeAt(a);if(i>e){if(!o)throw new Error(`Character "${t[a]}" cannot be encoded in ${r}.`);n[a]=s}else n[a]=i}return new Blob([n],{type:i()})}default:throw new Error(`Encoding "${r}" is not supported safely in the browser. Use UTF-8 or any supported encoding.`)}}}const n=(t,e)=>{const r=t.match(e);return r?r[2]:null};const s=/^hsl\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*\)$/,a=/^hsla\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)%\s*,\s*([\d\.]+)\)$/,i=/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,o=/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\)$/,c=/^#[a-f0-9]{6}$/,l=/^#[a-f0-9]{3}$/;function u(t){return!NullChecker.isNullOrEmpty(t)&&"object"==typeof t&&"r"in t&&"g"in t&&"b"in t&&"number"==typeof t.r&&"number"==typeof t.b&&"number"==typeof t.g&&(t.a??=1,t.r>=0&&t.r<=1&&t.g>=0&&t.g<=1&&t.b>=0&&t.b<=1&&t.a>=0&&t.a<=1)}function h(t){return!NullChecker.isNullOrEmpty(t)&&"object"==typeof t&&"h"in t&&"s"in t&&"l"in t&&"number"==typeof t.h&&"number"==typeof t.s&&"number"==typeof t.l&&(t.a??=1,t.h>=0&&t.h<=360&&t.s>=0&&t.s<=1&&t.l>=0&&t.l<=1&&t.a>=0&&t.a<=1)}const d={adjustRgbChannel:t=>t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),adjustRgbChannelInv:t=>t<=.00304?12.92*t:1.055*(Math.pow(t,1/2.4)-.055),adjustRgb:t=>({r:d.adjustRgbChannel(t.r),g:d.adjustRgbChannel(t.g),b:d.adjustRgbChannel(t.b),a:t.a}),adjustRgbInv:t=>({r:d.adjustRgbChannelInv(t.r),g:d.adjustRgbChannelInv(t.g),b:d.adjustRgbChannelInv(t.b),a:t.a}),X:t=>.4125*t.r+.3576*t.g+.1804*t.b,Y:t=>.2126*t.r+.7152*t.g+.0722*t.b,Z:t=>.0193*t.r+.1191*t.g+.9503*t.b,relativeLuminance:t=>{const e=d.adjustRgb(t);return d.Y(e)},rgbToCieXYZ:t=>{const e=d.adjustRgb(t);return{x:d.X(e),y:d.Y(e),z:d.Z(e),a:t.a}},cieXYZToRgb:t=>{const e=3.241*t.x-1.5374*t.y-.4986*t.z,r=-.9692*t.x+1.876*t.y+.0416*t.z,n=.0556*t.x-.204*t.y+1.057*t.z;return d.adjustRgbInv({r:e,g:r,b:n,a:t.a})},contrastRatio:(t,e)=>{const r=d.relativeLuminance(t)+.05,n=d.relativeLuminance(e)+.05;return r>n?r/n:n/r}};function p(t){return t.toString(16).padStart(2,"0")}class Colors{static{this.WCAG_MINIMUM_CONTRAST=3}static{this.WCAG_NORMAL_TEXT_CONTRAST=4.5}static{this.WCAG_SAFE_CONTRAST=7}static _clampRGB(t){const e=t=>Math.min(1,Math.max(0,t));return null==t[3]&&(t[3]=1),{r:e(t[0]),g:e(t[1]),b:e(t[2]),a:Math.min(1,Math.max(0,t[3]))}}static _normalize(t){return[t[0]/255,t[1]/255,t[2]/255,t[3]]}static parse(t){if(t=(t||"").toLowerCase(),i.test(t)){let e=i.exec(t);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),1]))}if(o.test(t)){let e=o.exec(t);return this._clampRGB(this._normalize([parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),parseFloat(e[4])]))}if(c.test(t)){let e=c.exec(t)[0];return this._clampRGB(this._normalize([parseInt("0x"+e.substr(1,2)),parseInt("0x"+e.substr(3,2)),parseInt("0x"+e.substr(5,2)),1]))}if(l.test(t)){let e=l.exec(t)[0],r=e.substr(1,1),n=e.substr(2,1),s=e.substr(3,1);return this._clampRGB(this._normalize([parseInt("0x"+r+r),parseInt("0x"+n+n),parseInt("0x"+s+s),1]))}if(s.test(t)){let e=s.exec(t);const r={h:parseFloat(e[1]),s:.01*parseFloat(e[2]),l:.01*parseFloat(e[3])};return this.rgb(r)}if(a.test(t)){let e=a.exec(t);const r={h:parseFloat(e[1]),s:.01*parseFloat(e[2]),l:.01*parseFloat(e[3]),a:parseFloat(e[4])};return this.rgb(r)}}static hsl(t){const e=function(t){const e=t.r,r=t.g,n=t.b;return(.5*(Math.max(e,r,n)+Math.min(e,r,n))).clamp(0,1)}(t),r=function(t,e){const r=t.r,n=t.g,s=t.b,a=Math.max(r,n,s),i=Math.min(r,n,s);return(0===e||1===e?0:(a-i)/(1-Math.abs(2*e-1))).clamp(0,1)}(t,e),n=function(t){const e=t.r,r=t.g,n=t.b,s=Math.max(e,r,n),a=Math.min(e,r,n);let i=0;return s!==a&&(i=s===e?((r-n)/(s-a)*60+360)%360:s===r?((n-e)/(s-a)*60+120)%360:((e-r)/(s-a)*60+240)%360),i.clamp(0,360)}(t);return{h:n,s:r,l:e,a:t.a}}static cieXYZ(t){return h(t)&&(t=this.rgb(t)),d.rgbToCieXYZ(t)}static rgb(t){if(!h(t)){const e=d.cieXYZToRgb(t);return this._clampRGB([e.r,e.g,e.b,e.a])}{const e=t.h,r=t.s,n=t.l,s=e/60,a=(1-Math.abs(2*n-1))*r,i=a*(1-Math.abs(s%2-1)),o=n-a/2,c=(e,r,n)=>this._clampRGB([e+o,r+o,n+o,t.a]);if(s<=1)return c(a,i,0);if(s<=2)return c(i,a,0);if(s<=3)return c(0,a,i);if(s<=4)return c(0,i,a);if(s<=5)return c(i,0,a);if(s<=6)return c(a,0,i)}}static stringify(t,e=1){if(h(t)){e??=1,t.a??=1;const r="number"==typeof e?e:1;return`hsla(${t.h.roundoff(r)},${(100*t.s).roundoff(r)}%,${(100*t.l).roundoff(r)}%,${t.a.roundoff()})`}if(u(t)){e??=!0,t.a??=1;const r="boolean"==typeof e?e:!!e,n=Math.round(255*t.r),s=Math.round(255*t.g),a=Math.round(255*t.b),i=t.a.roundoff();return 1===i?r?("#"+p(n)+p(s)+p(a)).toUpperCase():`rgb(${n},${s},${a})`:`rgba(${n},${s},${a},${i})`}}static contrastRatio(t,e){return h(t)&&(t=this.rgb(t)),h(e)&&(e=this.rgb(e)),d.contrastRatio(t,e)}static luminance(t){return h(t)&&(t=Colors.rgb(t)),d.relativeLuminance(t)}static lighten(t,e=.1){if(e||=0,h(t)){const r=Math.min(1,Math.max(0,t.l+e));return Object.assign({},t,{l:r})}if(u(t)){const r=this.lighten(this.hsl(t),e);return this.rgb(r)}return t}static darken(t,e=.1){return this.lighten(t,-e)}static saturate(t,e=.1){if(e||=0,h(t)){const r=Math.min(1,Math.max(0,t.s+e));return Object.assign({},t,{s:r})}if(u(t)){const r=this.saturate(this.hsl(t),e);return this.rgb(r)}return t}static desaturate(t,e=.1){return this.saturate(t,-e)}static interpolate(t,e,r,n){r??=.5,n??=r;const s=(r+n).roundoff(),a=(r/s).roundoff(),i=(n/s).roundoff(),o=u(t),c=h(t),l=t=>u(t)||h(t)?Colors.cieXYZ(t):t;t=l(t),e=l(e);const d={x:(t.x*a+e.x*i).roundoff(),y:(t.y*a+e.y*i).roundoff(),z:(t.z*a+e.z*i).roundoff(),a:(t.a*a+e.a*i).roundoff()};return o?Colors.rgb(d):c?Colors.hsl(Colors.rgb(d)):d}}const g=/[-+]?([\d]+(\.[\d]+(e-[\d]+)?)?|[\d]*(\.[\d]+(e-[\d]+)?))/g;function f(t){const e=[];let r=t.match(g);return r&&r.length>0&&r.forEach(t=>e.push(parseFloat(t))),e}class Angle{static isAngle(t){return"object"==typeof t&&"vertex"in t&&Point.isPoint(t.vertex)&&"start"in t&&Point.isPoint(t.start)&&"end"in t&&Point.isPoint(t.end)}static value(t){if(NullChecker.isNullOrEmpty(t)||!Angle.isAngle(t))return Number.NaN;const{vertex:e,start:r,end:n}=t;return Angle.angleBetween(e,r,n)}static angleBetween(t,e,r){const n=e.x-t.x,s=e.y-t.y,a=r.x-t.x,i=r.y-t.y,o=n*a+s*i,c=n*i-s*a;return-Math.atan2(c,o)}}class Size{static parse(t){let e=f(t);if(e&&2===e.length)return{width:e[0],height:e[1]};throw new Error(`Cannot parse "${t}" as a valid Size.`)}static isSize(t){return"object"==typeof t&&"width"in t&&"number"==typeof t.width&&"height"in t&&"number"==typeof t.height}}class Point{static parse(t){let e=f(t);if(e&&2===e.length)return{x:e[0],y:e[1]};throw new Error(`Cannot parse "${t}" as a valid Point.`)}static isPoint(t){return"object"==typeof t&&"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y}static distance(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}static subtract(t,e){return{x:e.x-t.x,y:e.y-t.y}}static add(...t){var e={x:0,y:0};for(var r of t)e.x+=r.x,e.y+=r.y;return e}static multiply(t,e){return{x:t.x*e,y:t.y*e}}}class Matrix2D{static isIdentity(t){return 1===t.a&&1===t.d&&0===t.b&&0===t.f&&0===t.c&&0===t.e}static get identity(){return{a:1,b:0,c:0,d:1,e:0,f:0}}static copy(t){return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e,f:t.f}}static scale(t,e,r=e){return{a:t.a*e,b:t.b,c:t.c,d:t.d*r,e:t.e,f:t.f}}static translate(t,e){return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e+e.x,f:t.f+e.y}}static rotate(t,e){const r=Math.cos(e),n=Math.sin(e);return Matrix2D.multiply(t,{a:r,b:n,c:-n,d:r,e:0,f:0})}static multiply(t,e){return"x"in t&&"y"in t?"number"==typeof e?{x:t.x*e,y:t.y*e}:{x:t.x*e.a+t.y*e.c+e.e,y:t.x*e.b+t.y*e.d+e.f}:"number"==typeof e?{a:t.a*e,b:t.b*e,c:t.c*e,d:t.d*e,e:t.e*e,f:t.f*e}:{a:t.a*e.a+t.b*e.c,b:t.a*e.b+t.b*e.d,c:t.c*e.a+t.d*e.c,d:t.c*e.b+t.d*e.d,e:t.e*e.a+t.f*e.c+e.e,f:t.e*e.b+t.f*e.d+e.f}}static det(t){return t.a*t.d-t.c*t.b}static invert(t){const e=this.det(t);if(0===e)return null;const r=1/e;return this.multiply({a:t.d,b:-t.b,c:-t.c,d:t.a,e:-t.e*t.d+t.c*t.f,f:t.e*t.b-t.a*t.f},r)}static toComponents(t,e={x:0,y:0}){const r=Math.sqrt(t.a*t.a+t.c*t.c),n=Math.sqrt(t.b*t.b+t.d*t.d),s=0!=r?t.a/r:0,a=0!=r?t.c/r:0,i=Math.atan2(a,s),{x:o,y:c}=e;return{scaleX:r,scaleY:n,rotation:i,translation:{x:t.e-o*(r*s-1)+c*r*a,y:t.f-c*(n*s-1)-o*n*a}}}static fromTransform([t,e,r],[n,s,a]){const i=t.x*(e.y-r.y)-t.y*(e.x-r.x)+(e.x*r.y-r.x*e.y);if(Math.abs(i)<1e-10)throw new Error("Points are collinear; matrix is singular and cannot be solved.");const o=1/i;return{a:o*(n.x*(e.y-r.y)+s.x*(r.y-t.y)+a.x*(t.y-e.y)),b:o*(n.y*(e.y-r.y)+s.y*(r.y-t.y)+a.y*(t.y-e.y)),c:o*(n.x*(r.x-e.x)+s.x*(t.x-r.x)+a.x*(e.x-t.x)),d:o*(n.y*(r.x-e.x)+s.y*(t.x-r.x)+a.y*(e.x-t.x)),e:o*(n.x*(e.x*r.y-r.x*e.y)+s.x*(r.x*t.y-t.x*r.y)+a.x*(t.x*e.y-e.x*t.y)),f:o*(n.y*(e.x*r.y-r.x*e.y)+s.y*(r.x*t.y-t.x*r.y)+a.y*(t.x*e.y-e.x*t.y))}}static areClose(t,e,r=12){return t.a.isCloseTo(e.a,r)&&t.b.isCloseTo(e.b,r)&&t.c.isCloseTo(e.c,r)&&t.d.isCloseTo(e.d,r)&&t.e.isCloseTo(e.e,r)&&t.f.isCloseTo(e.f,r)}}class Rect{static parse(t){let e=f(t);if(e&&4===e.length)return{x:e[0],y:e[1],width:e[2],height:e[3]};throw new Error(`Cannot parse "${t}" as a valid Rect.`)}static isRect(t){return Point.isPoint(t)&&Size.isSize(t)}static _stretch(t,e){return{a:e.width/t.width,b:0,c:0,d:e.height/t.height,e:e.x-t.x,f:e.y-t.y}}static _contain(t,e,r,n){let s=1;s=t.width/t.height>=e.width/e.height?e.width/t.width:e.height/t.height;const a=t.width*s,i=t.height*s,o=this._align({x:t.x,y:t.y,width:a,height:i},e,r,n);return Matrix2D.translate({a:s,b:0,c:0,d:s,e:0,f:0},o)}static _cover(t,e,r,n){let s=1;s=t.width/t.height<e.width/e.height?e.width/t.width:e.height/t.height;const a=t.width*s,i=t.height*s,o=this._align({x:t.x,y:t.y,width:a,height:i},e,r,n);return Matrix2D.translate({a:s,b:0,c:0,d:s,e:0,f:0},o)}static _align(t,e,r,n){let s=0,a=0;switch(r){case"left":s=e.x-t.x;break;case"right":s=e.x+e.width-t.width-t.x;break;default:s=e.x+.5*e.width-.5*t.width-t.x}switch(n){case"top":a=e.y-t.y;break;case"bottom":a=e.y+e.height-t.height-t.y;break;default:a=e.y+.5*e.height-.5*t.height-t.y}return{x:s,y:a}}static findTransform(t,e,r="stretch",n="center",s="middle"){switch(r){case"contain":return this._contain(t,e,n,s);case"cover":return this._cover(t,e,n,s);default:return this._stretch(t,e)}}static intersect(...t){const e={x:0,y:0,height:0,width:0},r=Array.from(t||[]);if(r.length<=0)return e;for(var n=r[0],s=1;s<r.length;s++){const t=r[s],a=Math.max(t.x,n.x),i=Math.max(t.y,n.y),o=Math.min(t.x+t.width,n.x+n.width)-a,c=Math.min(t.y+t.height,n.y+n.height)-i;if(o<0||c<=0)return e;n={x:a,y:i,width:o,height:c}}return n}static expand(t,...e){const r=Array.from(e||[]);let n=t.x,s=t.y,a=n,i=s;Rect.isRect(t)&&(a+=t.width,i+=t.height);for(let t of r)n=Math.min(t.x,n),s=Math.min(t.y,s),a=Math.max(t.x,a),i=Math.max(t.y,i);return{x:n,y:s,width:a-n,height:i-s}}}const y={mode:"stretch",align:"center",valign:"middle",quality:1,type:"image/jpeg"};class Imaging{static async loadImage(t){const e=await fetch(t);if(!e.ok)return null;return await e.blob()}static async resizeImage(t,e,r,n){if(e<=0||r<=0||isNaN(e)||isNaN(r))throw new Error("Invalid target size");"string"==typeof t&&(t=await Imaging.loadImage(t));const s=await self.createImageBitmap(t),a=s.width,i=s.height,o=new OffscreenCanvas(a,i),c=o.getContext("2d");c.imageSmoothingEnabled=c.mozImageSmoothingEnabled=c.oImageSmoothingEnabled=c.webkitImageSmoothingEnabled=!0;const{quality:l,type:u,mode:h,align:d,valign:p,background:g}=Object.assign({},y,n??{}),f={width:a,height:i,x:0,y:0},x={x:0,y:0,width:e,height:r},m=Rect.findTransform(f,x,h,d,p);o.width=e,o.height=r,g&&(c.fillStyle=g,c.fillRect(0,0,o.width,o.height)),c.setTransform(m),c.drawImage(s,0,0);return await o.convertToBlob({quality:l,type:u})}}class Keys{static#t;static uniqueId(){let t=Keys.#t||Date.now();return Keys.#t=++t}static uniqueCode(){return Keys.uniqueId().toBase62()}static randomString(t){let e="";do{e+=(62*Math.random()).toBase62()}while(e.length<t);return e}}function x(t,e){const r=t.length,n=e.length,s=Array.from({length:r+1},()=>Array(n+1).fill(0));for(let a=1;a<=r;a++)for(let r=1;r<=n;r++)t[a-1]===e[r-1]?s[a][r]=s[a-1][r-1]+1:s[a][r]=Math.max(s[a-1][r],s[a][r-1]);return s}function m(t,e,r,n=""){const s=t.length,a=e.length,i=[];let o=s,c=a,l=null;const u=()=>{l&&(i.push(l),l=null)};for(;o>0||c>0;){var h=null;let s=null;o>0&&c>0&&t[o-1]===e[c-1]?(h="=",s=t[o-1],o--,c--):c>0&&(0===o||r[o][c-1]>=r[o-1][c])?(h="+",s=e[c-1],c--):o>0&&(0===c||r[o-1][c]>r[o][c-1])&&(h="-",s=t[o-1],o--),h&&null!==s?l&&l.type===h?l.value=s+(l.value?n:"")+l.value:(u(),l={type:h,value:s}):u()}return u(),i.reverse()}class LexerClass{tokenize(t,e){const r=[];for(;t;){const n=t.length;for(let n of e){const e=n.exec(t,this),s=e?.length;if(s>0){Array.prototype.push.apply(r,e);const n=e[s-1];t=t.substr((n.index||0)+n.raw.length);break}}if(t.length>=n)throw new Error(`Cannot parse\n"${t}"\n using the provided grammar.`)}return r}}let b=class Parser{constructor(t=new LexerClass){this._lexer=t}parse(t,e,r){const n=this._lexer.tokenize(t,e);return r.render(n)}};function w(t){return(t??"").replace(/</g,"&lt;")}function k(t){return t?.index||void 0}function C(t){return t?.replace(/[^\w]+/g," ").trim().replace(/ +/g,"-").toLowerCase()}function $(t,e,r){const n=e.exec(t);return n&&n.length?r(n):null}const N=/(<!--)([\s\S]*?)(-->|$)/,M=/^ {0,3}(={3,}|_{3,}|-{3,})(\r?\n|$)/,R=/^ {0,3}(#{1,6})\s+([^\n]+)(\r?\n|$)+/,S=/^ {0,3}([^\n]+)(\r?\n=+(\r?\n|$))+/,I=/^ {0,3}([^\n]+)(\r?\n-+(\r?\n|$))+/,v=/^ {4,}.+(\r?\n {4,}.+)*(\r?\n|$)+/,A=/^ {0,3}``` *([^\n]*)\r?\n(([\s\S](?!\r?\n {0,3}```))*.(\r?\n)+) {0,3}```(\r?\n|$)+/,L=/^ {0,3}> *([^\n]+)(\r?\n {0,3}> *([^\n]*))*(\r?\n|$)+/,_=/^( {0,3}([-+]).*\r?\n|$)((?!(?: {0,3}(?:\d+[.\)]|\r?\n\S))).*(\r?\n|$))*/,B=/^( {0,3}(\d+[.\)]).*\r?\n|$)((?!(?: {0,3}(?:[+-]|\r?\n\S))).*(\r?\n|$))*/,z=/^(?:[-+*]|\d+[.\)])/m,E=/^(?! {4,})(.+(\n(?! {0,3}```)(?! {0,3}([-+]|\d+[.\)]))(?! {4,})(?! {0,3}>).+)*)/,O=/^ {0,3}(!?)\[([^\]]+)\]: +(\S+)(?: +['"\(](.+)['"\)])?(\r?\n|$)+/,T=/!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?(\[[^\[\]]*\]|\([^\(\)]*\))?/,D=/(\*\*?|__?)(\[[^\]]*]\([^\)]+\))\1/,j=/(?:(?<!\\)`)(.+?)(?:(?<!\\)`)/,H=/(\*\*?|__?)((?!\1\s?)(?:(?!\1)[\S\s])*[^\s])\1/,P=/(~~?|__?)(?!\1\s?)([^\s][\s\S]*?(?!\1)[^\s])\1/,F=/(:")(?!":\s?)([^\s][\s\S]*?(?!":)[^\s])":/,U=/^\s+/,q=/ {2,}\r?\n/,Y=/^[^\r\n]+/;var G,Q;function X(t=[]){const e={[Q.Comment]:{exec:(t,e)=>$(t,N,r=>{const n=k(r),s=[{type:G.Html,index:n,raw:r[0],text:r[2]}];if(n>0){const r=t.substr(0,n),a=e.tokenize(r,g);Array.prototype.unshift.apply(s,a)}return s})},[Q.Reference]:{exec:t=>$(t,O,t=>{const e=k(t),r=t[0],n=r,s="!"===t[1],a=t[2],i=t[3],o=t[4];return[{type:G.Reference,index:e,raw:r,text:n,id:a,image:s,url:i,title:o}]})}},r=[],n=[],s={};for(let e of t){let t,a="inline";switch("type"in e?(a=e.type,t=e.rule):t=e,a){case"block":r.push(t);break;case"code":if("lang"in e){const r=e.lang.toLowerCase();(s[r]=s[r]||[]).push(t)}break;default:const a={exec:(e,r)=>{const n=t.exec(e,r);return o(e,n,r),n}};n.push(a)}}const a={[Q.Text]:{exec:t=>$(t,Y,t=>{const e=t[0],r=e;return[{index:k(t),raw:e,text:r,type:G.Text}]})},[Q.Space]:{exec:t=>$(t,U,t=>{const e=t[0];return[{type:G.Space,raw:e,text:e}]})}},i={[Q.ImageOrLink]:{exec:(t,e)=>c(t,T,e,t=>{const r=k(t),n=t[0],s="!"===n.charAt(0),a=t[1],i=function(t){if(!(NullChecker.isNullOrEmpty(t)||/^\[/.test(t)&&/\]$/.test(t)))return/^\(/.test(t)&&/\)$/.test(t)&&(t=t.substr(1,t.length-2)),t}(t[2]),o=C(function(t){if(!(NullChecker.isNullOrEmpty(t)||/^\(/.test(t)&&/\)$/.test(t)))return/^\[/.test(t)&&/\]$/.test(t)&&(t=t.substr(1,t.length-2)),t}(t[2])??a);return s?[{index:r,type:i?G.Image:G.ImageLike,raw:n,text:a,src:i,ref:o,tokens:e.tokenize(a,l)}]:[{index:r,type:i?G.Link:G.LinkLike,raw:n,text:a,href:i,ref:o,tokens:e.tokenize(a,l)}]})},[Q.Code]:{exec:(t,e)=>c(t,j,e,t=>{const e=w(t[1]);return[{type:G.Code,raw:t[0],text:e,index:k(t)}]})},[Q.EmphasizedLink]:{exec:(t,e)=>c(t,D,e,t=>{if(t.length<3||NullChecker.isNullOrEmpty(t[2]))return null;const r=t[1].length>1?G.Bold:G.Italic,n=t[2];return[{index:k(t),type:r,raw:t[0],text:n,tokens:e.tokenize(n,l)}]})},[Q.Emphasize]:{exec:(t,e)=>c(t,H,e,t=>{if(t.length<3||NullChecker.isNullOrEmpty(t[2]))return null;const r=t[1].length>1?G.Bold:G.Italic,n=t[2];return[{index:k(t),type:r,raw:t[0],text:n,tokens:e.tokenize(n,l)}]})},[Q.StrikeThrough]:{exec:(t,e)=>c(t,P,e,t=>{if(t.length<3||NullChecker.isNullOrEmpty(t[2]))return null;const r=G.StrikeThrough,n=t[2];return[{index:k(t),type:r,raw:t[0],text:n,tokens:e.tokenize(n,l)}]})},[Q.Quote]:{exec:(t,e)=>c(t,F,e,t=>{if(t.length<3||NullChecker.isNullOrEmpty(t[2]))return null;const r=G.Quote,n=t[2];return[{index:k(t),type:r,raw:t[0],text:n,tokens:e.tokenize(n,l)}]})},[Q.LineBreak]:{exec:(t,e)=>c(t,q,e,t=>{const e=t[0],r=e;return[{index:k(t),raw:e,text:r,type:G.LineBreak}]})}},o=(t,e,r)=>{const n=e?.length>0&&e[0].index;if(n>0){const s=t.substr(0,n),a=r.tokenize(s,l)||[];Array.prototype.unshift.apply(e,a)}},c=(t,e,r,n)=>{const s=$(t,e,r=>{if(e!=j){const e=j.exec(t);if(e&&e.length&&e.index<r.index)return null}return n(r)});return o(t,s,r),s},l=Object.values(i);Array.prototype.push.apply(l,n),l.push(a[Q.Text],a[Q.Space]);const u=t=>{const e=[a[Q.Text],a[Q.Space]],r=t?.toLowerCase()||"";return r&&r in s&&Array.prototype.unshift.apply(e,s[r]),e},h={[Q.Paragraph]:{exec:(t,e)=>$(t,E,t=>{const r=t[0],n=r;return[{type:G.Paragraph,raw:r,text:n,tokens:e.tokenize(n,l)}]})},[Q.Space]:a[Q.Space]},d=(t,e)=>{const r=/^ {0,3}(`{3,}|$|>|[+-]\s|\d+[.\)])/m.test(t)?g:l;return e.tokenize(t,r)},p={[Q.HorizontalRule]:{exec:(t,e)=>$(t,M,t=>{const e=t[0],r=e;return[{type:G.HorizontalRule,raw:e,text:r}]})},[Q.Heading]:{exec:(t,e)=>$(t,R,t=>{const r=t[2];return[{type:G.Heading,raw:t[0],text:r,level:t[1].length,ref:C(r),tokens:e.tokenize(r,l)}]})},[Q.Heading1]:{exec:(t,e)=>$(t,S,t=>{const r=t[1];return[{type:G.Heading,raw:t[0],text:r,level:1,ref:C(r),tokens:e.tokenize(r,l)}]})},[Q.Heading2]:{exec:(t,e)=>$(t,I,t=>{const r=t[1];return[{type:G.Heading,raw:t[0],text:r,level:2,ref:C(r),tokens:e.tokenize(r,l)}]})},[Q.CodeBlock]:{exec:(t,e)=>$(t,v,t=>{const r=t[0],n=w(r);return[{type:G.CodeBlock,raw:r,text:n,tokens:e.tokenize(n,[])}]})},[Q.Fences]:{exec:(t,e)=>$(t,A,t=>{const r=w(t[2]),n=t[1]?.toLowerCase();return[{type:G.CodeBlock,raw:t[0],text:r,lang:n,tokens:e.tokenize(r,u(n))}]})},[Q.BlockQuote]:{exec:(t,e)=>$(t,L,t=>{const r=t[0],n=r.replace(/^ {0,3}> */gm,"");return[{type:G.BlockQuote,raw:r,text:n,tokens:e.tokenize(n,[h[Q.Paragraph],h[Q.Space]])}]})},[Q.OrderedList]:{exec:(t,e)=>$(t,B,t=>{const r=t[0],n=r.replace(/^ {0,3}/gm,"").split(z).filter(t=>!NullChecker.isNullOrEmpty(t)).map(t=>t.trim());return[{type:G.OrderedList,start:parseInt(/\d/.exec(t[0])[0]),raw:r,text:r,tokens:n.map(t=>({type:G.ListItem,raw:t,text:t,tokens:d(t,e)}))}]})},[Q.UnorderedList]:{exec:(t,e)=>$(t,_,t=>{const r=t[0],n=r.replace(/^ {0,3}/gm,"").split(z).filter(t=>!NullChecker.isNullOrEmpty(t)).map(t=>t.trim());return[{type:G.UnorderedList,raw:r,text:r,tokens:n.map(t=>({type:G.ListItem,raw:t,text:t,tokens:d(t,e)}))}]})}},g=Object.values(p);return Array.prototype.push.apply(g,r),g.push(h[Q.Paragraph],h[Q.Space]),[e[Q.Comment],e[Q.Reference]].concat(g)}!function(t){t.Html="html",t.Text="text",t.Paragraph="paragraph",t.BlockQuote="blockquote",t.Space="space",t.Heading="heading",t.Bold="bold",t.Italic="italic",t.CodeBlock="codeblock",t.Code="code",t.Image="img",t.ImageLike="imglike",t.Link="link",t.LinkLike="linklike",t.LineBreak="br",t.StrikeThrough="strike",t.Quote="quote",t.HorizontalRule="hr",t.OrderedList="ol",t.UnorderedList="ul",t.ListItem="listitem",t.Reference="ref"}(G||(G={})),function(t){t[t.Comment=0]="Comment",t[t.Reference=1]="Reference",t[t.HorizontalRule=2]="HorizontalRule",t[t.Heading=3]="Heading",t[t.Heading1=4]="Heading1",t[t.Heading2=5]="Heading2",t[t.CodeBlock=6]="CodeBlock",t[t.Fences=7]="Fences",t[t.BlockQuote=8]="BlockQuote",t[t.OrderedList=9]="OrderedList",t[t.UnorderedList=10]="UnorderedList",t[t.Paragraph=11]="Paragraph",t[t.EmphasizedLink=12]="EmphasizedLink",t[t.ImageOrLink=13]="ImageOrLink",t[t.Emphasize=14]="Emphasize",t[t.StrikeThrough=15]="StrikeThrough",t[t.Quote=16]="Quote",t[t.Code=17]="Code",t[t.LineBreak=18]="LineBreak",t[t.Text=254]="Text",t[t.Space=255]="Space"}(Q||(Q={}));const Z=/[ \r\n]*\0+[ \r\n]*/g;class HtmlRenderer{constructor(t=(t,e)=>t?.text||""){this._extraItemRender=t,this._renderContent=t=>{const e=t.tokens;return NullChecker.isNullOrEmpty(e)?t.text:this._render(e)}}_rendeItem(t,e){const r=this._renderContent,n="\0";switch(t?.type){case G.Reference:return"";case G.Html:return t.raw;case G.BlockQuote:return`<blockquote>\n${r(t)}</blockquote>${n}`;case G.Bold:return`<b>${r(t)}</b>`;case G.CodeBlock:const s=t.lang;return`<pre>${n}<code${s?' class="'+s+'"':""}>${r(t)}</code>${n}</pre>${n}`;case G.Code:return`<code>${r(t)}</code>`;case G.HorizontalRule:return`<hr />${n}`;case G.Heading:const a=t.level;return`<h${a} id="${t.ref}">${r(t)}</h${a}>${n}`;case G.Image:case G.ImageLike:const i=t;let o=i.src,c="";const l=i.text,u=i.ref;if(!o&&u){const t=e.find(t=>t.type===G.Reference&&!0===t.image&&t.id?.toLowerCase()===u.toLowerCase());t&&(o=t.url,c=t.title??"")}return o?`<img src="${o}" alt="${l}"${c?' title="'+c+'"':""} />`:`![${r(t)}]`;case G.Italic:return`<i>${r(t)}</i>`;case G.StrikeThrough:return`<s>${r(t)}</s>`;case G.Quote:return`<q>${r(t)}</q>`;case G.LineBreak:return"<br />\0";case G.OrderedList:return`<ol start="${t.start}">\n${r(t)}</ol>${n}`;case G.UnorderedList:return`<ul>\n${r(t)}</ul>${n}`;case G.ListItem:return`\t<li>${r(t)}</li>${n}`;case G.Link:case G.LinkLike:const h=t;let d=h.href,p="";const g=h.ref;if(!d&&g){const t=e.find(t=>t.type===G.Reference&&!0!==t.image&&t.id?.toLowerCase()===g.toLowerCase());t&&(d=t.url,p=t.title??"")}return d?`<a href="${d}"${p?' title="'+p+'"':""}>${r(t)}</a>`:`[${r(t)}]`;case G.Paragraph:return`<p>${r(t)}</p>${n}`;case G.Text:case G.Space:return t.text}return this._extraItemRender(t,e)}_render(t){let e="";for(let r of t||[])e+=this._rendeItem(r,t);return e}render(t){return e=this._render(t),e?.replace(Z,"\n").trim();var e}}class TokenRenderer{_render(t){return NullChecker.isNullOrEmpty(t)?"":JSON.stringify(t)}render(t){return"["+t.filter(t=>!NullChecker.isNullOrEmpty(t)).map(this._render).join(",")+"]"}}var K=Object.freeze({__proto__:null,Parser:class Parser extends b{toHtml(t,e,r){const n=new HtmlRenderer(r);return NullChecker.isNullOrEmpty(e)?this.parse(t,n):this.parse(t,X(e),n)}tokenize(t,e){const r=this.parse(t,X(e),new TokenRenderer);return JSON.parse(r)}parse(t,e=X(),r=new HtmlRenderer){return(n=e)&&"object"==typeof n&&"function"==typeof n.render?super.parse(t,X(),e):super.parse(t,e,r);var n}}}),W=Object.freeze({__proto__:null,Markdown:K,Parser:b}),J=Object.freeze({__proto__:null,Angle:Angle,Arrays:class Arrays{static range(t,e,r=2){let n=t;NullChecker.isNull(e)&&(e=r=t,t=1);const s=(e-t)/(r-1),a=[];if(s>0)for(;a.length<r;)a.push(n.roundoff()),n+=s;return a}static chunkify(t,e){if(NullChecker.isNullOrEmpty(t))return[];if(e<=0||e%1!=0)throw new Error("Provide a positive integer number.");const r=Math.ceil(t.length/e);return Array.from({length:r},(r,n)=>{const s=n*e,a=s+e;return t.slice(s,a)})}},Blobs:Blobs,Colors:Colors,Compile:W,Dates:Dates,DeepMerger:DeepMerger,HistoryService:class HistoryService{constructor(t,e){this.#e=t,this.#r=e}#n=[];#s=[];#r;#e;get current(){return this.#e}get canUndo(){return this.#n.length>0}get canRedo(){return this.#s.length>0}set maxlength(t){this.#r=t}undo(){if(this.canUndo){const t=this.#n,e=this.#s,r=this.#e;e.unshift(r),this.#e=t.pop()}}redo(){if(this.canRedo){const t=this.#n,e=this.#s,r=this.#e;t.push(r),this.#e=e.shift()}}push(t){this.#s.splice(0),this.#n.push(this.#e),this.#e=t;const e=this.#r,r=this.#n;e>0&&r.length>e&&r.splice(0,r.length-e)}reset(){this.#s.splice(0),this.#n.splice(0)}},Imaging:Imaging,Keys:Keys,Matrix2D:Matrix2D,NullChecker:NullChecker,Numbers:class Numbers{static round(t,e=1){return Math.round(t/e)*e}static log(t,e){return Math.log10(t)/Math.log10(e)}static rebase(t,e,r){const n=t.toString(),s=parseInt(n,e);return n.endsWith(s.toString(e))?parseInt(t.toString(),e).toString(r):Number.NaN.toString()}},Point:Point,Rect:Rect,Size:Size,Strings:class Strings{static leftPad(t,e,r){return t.toString().padStart(e,r)}static format(t,...e){const r=Array.from(e);let n=t;for(let t=0;t<r.length;t++){const e=new RegExp("(^|[^\\{])\\{"+t+"\\}($|[^\\}])","g");n=n.replaceAll(e,(e,...n)=>e.replace("{"+t+"}",r[t]))}const s=/(^|[^\{}])\{(\d+)\}($|[^\}])/.exec(n);if(!NullChecker.isNullOrEmpty(s))throw new Error(`Missing argument at index ${s[2]}.`);return n}static diff(t,e,r="char"){switch(r){case"line":return function(t,e){const r=/\r?\n/,n=t.split(r),s=e.split(r);return m(n,s,x(n,s),"\n")}(t,e);case"word":return function(t,e){const r=/(\S+|\s+)/g,n=t.match(r)||[],s=e.match(r)||[];return m(n,s,x(n,s),"")}(t,e);default:return function(t,e){const r=t.split(""),n=e.split("");return m(r,n,x(r,n),"")}(t,e)}}static async hash(t,e="SHA-256"){const r=await crypto.subtle.digest(e,(new TextEncoder).encode(t));return Array.from(new Uint8Array(r)).map(t=>t.toString(16).padStart(2,"0")).join("")}},detect:function(t=navigator.userAgent){let e="unknown",r=null;switch(/ucbrowser/i.test(t)?e="UCBrowser":/edg/i.test(t)?e="Edge":/googlebot/i.test(t)?e="GoogleBot":/chromium/i.test(t)?e="Chromium":/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t)?e="Firefox":/; msie|trident/i.test(t)&&!/ucbrowser/i.test(t)?e="IE":/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t)?e="Chrome":/safari/i.test(t)&&!/chromium|edg|ucbrowser|chrome|crios|opr|opera|fxios|firefox/i.test(t)?e="Safari":/opr|opera/i.test(t)&&(e="Opera"),e){case"UCBrowser":r=n(t,/(ucbrowser)\/([\d\.]+)/i);break;case"Edge":r=n(t,/(edge|edga|edgios|edg)\/([\d\.]+)/i);break;case"GoogleBot":r=n(t,/(googlebot)\/([\d\.]+)/i);break;case"Chromium":r=n(t,/(chromium)\/([\d\.]+)/i);break;case"Firefox":r=n(t,/(firefox|fxios)\/([\d\.]+)/i);break;case"Chrome":r=n(t,/(chrome|crios)\/([\d\.]+)/i);break;case"Safari":r=n(t,/(safari)\/([\d\.]+)/i);break;case"Opera":r=n(t,/(opera|opr)\/([\d\.]+)/i);break;case"IE":{const e=n(t,/(trident)\/([\d\.]+)/i);r=e?`${parseFloat(e)+4}`:"7.0";break}default:r="0.0.0.0"}return{name:e,version:r}},parseAsNumericalArray:f});DeepMerger.merge(J)}();
7
7
  //# sourceMappingURL=pacem-foundation.min.js.map