tripetto-runner-foundation
Version:
Foundation library for building form/survey runners for Tripetto.
2 lines • 241 kB
JavaScript
/*! Tripetto Runner Foundation 6.3.0 - Copyright (C) 2022 Tripetto B.V. - All Rights Reserved */
var t,e,s=Object.freeze({__proto__:null,get NAME(){return ri},get VERSION(){return ai},get Slots(){return _s},get SHA2(){return Ne},get AES(){return ii},get L10n(){return Vs},get Context(){return vs},get Data(){return Ss},get Errors(){return fs},get Instance(){return Es},get Value(){return Cs},get Slot(){return hs},get Condition(){return Us},get ConditionBlock(){return hn},get ConditionBlocksNamespace(){return un},get Branch(){return $s},get Cluster(){return Gs},get RunnerFoundation(){return En},get Node(){return on},get NodeBlock(){return rn},get HeadlessBlock(){return an},get NodeBlocksNamespace(){return vn},get markdownify(){return Xs},get markdownifyTo(){return sn},get markdownifyToString(){return tn},get markdownifyToPlainText(){return nn},get markdownifyToURL(){return en},get MarkdownFeatures(){return Ks},get isVariable(){return Js},get Storyline(){return fn},get Moment(){return gn},get Import(){return dn},get Export(){return pn},get Namespaces(){return Cn},get mountNamespace(){return kn},get unmountNamespace(){return Sn},get tripetto(){return Pn},get block(){return Pn},get condition(){return Fn},get validator(){return An},get destroy(){return On},get fingerprint(){return Tn},get calculateFingerprintAndStencil(){return Mn},get stencil(){return Ln},get checksum(){return Rn},get powSolve(){return Un},get powVerify(){return $n},get powHashRate(){return Gn},get powSpentTime(){return Kn},get powDuration(){return qn},get Await(){return Je},get Callback(){return We},get arrayItem(){return L},get arraySize(){return O},get assert(){return D},get call(){return ut},get callAsync(){return lt},get callBind(){return pt},get callEx(){return mt},get callFunction(){return dt},get callPromise(){return ct},get cancelFrame(){return St},get cancelInterval(){return Et},get cancelPromise(){return vt},get cancelTick(){return _t},get cancelTimeout(){return wt},get cancelUIInterval(){return Ft},get cancelUITimeout(){return Tt},get cast(){return z},get castToBoolean(){return K},get castToFloat(){return G},get castToNumber(){return $},get castToString(){return U},get clone(){return q},get compare(){return J},get count(){return nt},get createInstanceOf(){return Kt},get each(){return Y},get eachReverse(){return Z},get extend(){return j},get extendImmutable(){return W},get filter(){return rt},get find(){return ht},get findFirst(){return at},get findLast(){return ot},get firstArrayItem(){return R},get forEach(){return it},get get(){return Vt},get getAny(){return Nt},get getBoolean(){return Dt},get getFloat(){return $t},get getNumber(){return Ut},get getString(){return zt},get has(){return tt},get hasOneOrMore(){return st},get hasOnly(){return et},get isArray(){return P},get isArrayOrCollection(){return A},get isBoolean(){return E},get isCollection(){return F},get isDate(){return B},get isDefined(){return y},get isError(){return N},get isFilledString(){return w},get isFloat(){return I},get isFunction(){return k},get isNull(){return v},get isNumber(){return M},get isNumberFinite(){return T},get isObject(){return C},get isRegEx(){return V},get isString(){return S},get isUndefined(){return b},get lastArrayItem(){return H},get map(){return Q},get noop(){return _},get reduce(){return X},get scheduleAction(){return Rt},get scheduleAndCancelFrame(){return kt},get scheduleAndCancelPromise(){return yt},get scheduleAndCancelTick(){return ft},get scheduleAnimation(){return Ot},get scheduleEvent(){return Lt},get scheduleFrame(){return Ct},get scheduleInterval(){return It},get scheduleNumberOfFrames(){return At},get schedulePromise(){return bt},get scheduleTick(){return gt},get scheduleTimeout(){return xt},get scheduleUIInterval(){return Pt},get scheduleUITimeout(){return Mt},get set(){return Ht},get setAny(){return Bt},get stringLength(){return x},get Console(){return qt},get Environment(){return jt},get Num(){return t},get Str(){return e},get DateTime(){return f},get Flags(){return Wt},get Enumerator(){return i},get Debounce(){return Zt},get Limiter(){return Jt},get Throttle(){return Yt},get Stack(){return Qt},get DEBUG(){return Xt},get disableDebugging(){return ee},get enableDebugging(){return te}});!function(t){function e(t,e){const s=Math.pow(10,e||0);return T(t)?Math.round($((t*s).toFixed(1)))/s:0}t.round=function(t){return T(t)?Math.round(t):0},t.floor=function(t){return T(t)?Math.floor(t):0},t.ceil=function(t){return T(t)?Math.ceil(t):0},t.conform=e,t.positive=function(t){return T(t)&&t>0?t:0},t.negative=function(t){return T(t)&&t<0?t:0},t.max=function(t,e){return T(t)&&T(e)?Math.max(t,e):T(t)?t:T(e)?e:0},t.maxL=function(...t){const e=O(t);let s=NaN;if(e>0)for(let n=0;n<e;n++){const e=t[n];T(e)&&(!T(s)||e>s)&&(s=e)}return T(s)?s:0},t.min=function(t,e){return T(t)&&T(e)?Math.min(t,e):T(t)?t:T(e)?e:0},t.minL=function(...t){const e=O(t);let s=NaN;if(e>0)for(let n=0;n<e;n++){const e=t[n];T(e)&&(!T(s)||e<s)&&(s=e)}return T(s)?s:0},t.range=function(t,e,s){return T(t)?(T(s)&&e>s&&(e=s),T(e)&&t<e?e:T(s)&&t>s?s:t):T(e)?e:T(s)?s:0},t.inRange=function(t,e,s,n=!0,i=!1){return T(t)&&(n?t>=e:t>e)&&(i?t<=s:t<s)},t.format=function(t,s=0,n=",",i=".",r="-"){let a,o,h,u="";if(-1!==`${t="auto"===s?G(t):e(G(t),s)}`.indexOf("e"))if(-1!==`${t}`.indexOf("e-")){const e=t;for(let s=20;s>=0&&(t=e.toFixed(s).replace(/(0*$)/g,"")||"0",parseFloat(t)!==e);s--);}else t=t<0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER;if(a=U(t).replace("-",r).split("."),o=a[0],h=O(a)>=2?a[1]:"",w(n))for(let t=x(o)-1,e=0;t>=0;t--)u=o.charAt(t)+(3===e&&o.charAt(t)!==r?n:"")+u,3===e&&(e=0),e++;else u=o;if(("auto"===s||s>0)&&((h||"auto"!==s)&&(u+=i+h),"auto"!==s))for(s-=x(h);s>0;)u+="0",s--;return u}}(t||(t={})),function(t){function e(t){return w(t)?t.toLowerCase():""}function s(t){return w(t)?t.replace(/(^\s*)|(\s*$)/g,""):""}function n(t){return w(t)?t.replace(/(\s*$)/g,""):""}function i(t){return w(t)?t.replace(/[^\S\r\n\.]{2,}/g," ").replace(/\n[^\S\r\n\.]/g,"\n"):""}function r(t){return i(s(t))}function a(t,e,s=""){return t=U(t),T(e)&&e>0&&e<x(t)?w(s)?n(t.substr(0,e))+s:t.substr(0,e):t}function o(t,s,n="",i=!1){let r="",a=0;return t=U(t),s=U(s),Y(i?e(t).split(e(s)):t.split(s),(e=>{const i=x(e);r+=(a>0?n:"")+t.substr(a,i),a+=i+x(s)})),r}function h(t,e="",s,...n){let i="";if(t){let o,h;F(t)?o=t:P(t)||(h=Object.keys(t));const u=(h||o||t).length;for(let l=0;l<u;l++)i+=(""===i?"":e)+U(s?ut(s,...(r=h?h[l]:l,a=n.slice(0),S(r)?a.unshift(t[r]):o?a.unshift(o.item(r)):a.unshift(t[r]),a)):h?t[h[l]]:o?o.item(l):t[l])}var r,a;return i}t.lowercase=e,t.uppercase=function(t){return w(t)?t.toUpperCase():""},t.capitalize=function(t,s="first-character",n=!1){if(n&&(t=e(t)),w(t)){const e="each-sentence"===s?t.split("."):[t];return Y(e,(t=>{let e="";if("each-word"!==s){let s=t.toString(),n=0;for(;n<x(s);){const t=s.charAt(n);if(" "!==t&&"\t"!==t&&"\r"!==t&&"\n"!==t&&"."!==t){s=s.substr(0,n)+s.substr(n,1).toUpperCase()+s.substr(n+1);break}n++}e+=(0===n?" ":"")+s}else e=t.replace(/(^|[\s`~!@#$%^&+\-*=_()[\]{};:'"\\|,<.>\/?])[^\s`~!@#$%^&+\-*=_()[\]{};:'"\\|,<.>\/?]/g,(t=>t.toUpperCase()));return e}),{replace:!0}),r(h(e,"."))}return""},t.trim=s,t.trimLeft=function(t){return w(t)?t.replace(/(^\s*)/g,""):""},t.trimRight=n,t.trimMultiple=i,t.sanitize=r,t.removeWhitespaces=function(t){return w(t)?t.replace(/\s/g,""):""},t.limit=a,t.replace=o,t.replaceMultiple=function(t,e,s,n){return t=U(t),Y(e,(e=>{t=o(t,e,s,n)})),t},t.makeHTMLSafe=function(t){return U(t).replace(/[<>]/g,(t=>"<"===t?"<":">"))},t.CRLFToHTML=function(t){return U(t).replace(/(\r\n|[\r\n])/g,"<br />")},t.iterateToString=h,t.extract=function(t,s){const n=U(s.left);if(t=U(t),w(n)){const i=(s.ignoreCase?e(t):t).indexOf(s.ignoreCase?e(n):n);if(-1!==i&&""!==(t=t.substr(i+x(n)))){const n=w(s.right)?s.fromEnd?(s.ignoreCase?e(t):t).lastIndexOf(s.ignoreCase?e(s.right):s.right):(s.ignoreCase?e(t):t).indexOf(s.ignoreCase?e(s.right):s.right):x(t);if(-1!==n)return t.substr(0,n)}}return""},t.fill=function(t,e){let s="";for(t=U(t),e=$(e);e>0;)s+=t,e--;return s},t.padLeft=function(t,e,s,n,i){let r=U(i||T(t)?$(t):t);if(S(e)&&T(s)&&x(e)>=1){let a,o="";if(a=(i||T(t))&&"-"===r.charAt(0),n&&x(r)>s)return r.substr(x(r)-s);if(x(r)>=s)return r;a&&(r=r.substr(1));do{o+=e}while(x(o)<s);return(a?"-":"")+(o+r).substr(x(o+r)+(a?1:0)-s)}return r},t.padRight=function(t,e,s,n){let i=U(t);if(S(e)&&T(s)&&x(e)>=1){if(i=U(i),n&&x(i)>s)return a(i,s);if(x(i)>=s)return i;for(;x(i)<s;)i=a(i+e,s)}return i},t.djb2Hash=function(t,e=""){const s=x(t);let n=0,i=5381;for(;n<s;)i=33*i^t.charCodeAt(n),n++;return e+(i>>>0).toString(36)}}(e||(e={}));class n{constructor(t){this.m_fnScheduler=t,this.m_pStack=[],this.m_nCall=0,this.m_nOffset=0}call(){const t=this.m_pStack.length;for(let e=0;e<t;e++){const t=this.m_pStack[e];t&&t.callee&&t.callee(...t.arguments)}this.m_pStack.splice(0,t),this.m_pStack.length>0?(this.m_nOffset=this.m_nCall-this.m_pStack.length+1,this.m_fnScheduler((()=>this.call()))):this.m_nOffset=0}schedule(t,...e){return t?(this.m_nCall++,this.m_pStack.push({callee:t,arguments:e}),0===this.m_nOffset&&(this.m_nOffset=this.m_nCall,this.m_fnScheduler((()=>this.call()))),this.m_nCall):0}cancel(t){this.m_nOffset>0&&t>=this.m_nOffset&&t<=this.m_nCall&&(this.m_pStack[t-this.m_nOffset]=void 0)}}class i{constructor(){this.m_nEnumerator=0}static get n(){return this.m_nEnumerator===Number.MAX_VALUE&&(this.m_nEnumerator=0),++this.m_nEnumerator}get n(){return this.m_nEnumerator===Number.MAX_VALUE&&(this.m_nEnumerator=0),++this.m_nEnumerator}set n(t){t>this.m_nEnumerator&&t<=Number.MAX_VALUE&&(this.m_nEnumerator=t)}static recycle(){this.m_nEnumerator=Number.MAX_VALUE}recycle(){this.m_nEnumerator=Number.MAX_VALUE}}i.m_nEnumerator=0;const r="undefined"!=typeof process&&process&&process.nextTick?t=>{process.nextTick(t)}:"undefined"!=typeof Promise&&Promise?t=>{Promise.resolve().then(t)}:t=>{setTimeout(t,0)},a="undefined"!=typeof Promise&&Promise?t=>{Promise.resolve().then(t)}:"undefined"!=typeof process&&process&&process.nextTick?t=>{process.nextTick(t)}:t=>{setTimeout(t,0)},o="undefined"!=typeof requestAnimationFrame?t=>requestAnimationFrame(t)||0:t=>setTimeout(t,1e3/60)||0,h="undefined"!=typeof window,u="undefined"==typeof window&&"undefined"!=typeof process,l="undefined"!=typeof self&&"function"==typeof postMessage,c=new n(r),m=new n(o),p=new n(a),d={},g=new i;class f{constructor(t=new Date){t instanceof f?this.m_pDate=new Date(t.time):B(t)?this.m_pDate=new Date(t.getTime()):this.m_pDate=new Date(t)}static get now(){return Date.now()}static get precise(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()}static get UTC(){return this.now-60*(new Date).getTimezoneOffset()*1e3}static get today(){const t=new Date;return t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t.getTime()}static get UTCToday(){const t=new Date,e=new Date;return e.setUTCFullYear(t.getFullYear()),e.setUTCMonth(t.getMonth()),e.setUTCDate(t.getDate()),e.setUTCHours(0),e.setUTCMinutes(0),e.setUTCSeconds(0),e.setUTCMilliseconds(0),e.getTime()}static isFuture(t){return this.now<t}static isPast(t){return this.now>=t}static elapsed(t,e=!1){return(K(e)?this.precise:this.now)-t}static timerReset(){const t=this.m_nStamp;return this.m_nStamp=this.precise,t}static get timerElapsed(){return this.precise-this.timerReset()}static get timerStamp(){return this.formatElapsed()}static format(t="dd-MM-yyyy HH:mm:ss.SSS",s=this.now,n=!1,i){const r=new Date(s);return e.sanitize(t.replace(/('[^']+')|('')|(HH)|(H)|(hh)|(h)|(mm)|(m)|(ss)|(s)|(SSS)|(S)|(zzzz)|(z)|(dd)|(d)|(MMMMM)|(MMMM)|(MMM)|(MM)|(M)|(LLLLL)|(LLLL)|(LLL)|(EEEEE)|(EEEE)|(EEE)|(EE)|(E)|(ccccc)|(cccc)|(ccc)|(cc)|(yyyy)|(yy)|(y)|(a)/g,(t=>{switch(t){case"HH":return e.padLeft(U(n?r.getUTCHours():r.getHours()),"0",2);case"H":return U(n?r.getUTCHours():r.getHours());case"hh":return e.padLeft(U(((n?r.getUTCHours():r.getHours())+11)%12+1),"0",2);case"h":return U(((n?r.getUTCHours():r.getHours())+11)%12+1);case"a":return i?U((n?r.getUTCHours():r.getHours())>=12?i.PM:i.AM):"";case"mm":return e.padLeft(U(n?r.getUTCMinutes():r.getMinutes()),"0",2);case"m":return U(n?r.getUTCMinutes():r.getMinutes());case"ss":return e.padLeft(U(n?r.getUTCSeconds():r.getSeconds()),"0",2);case"s":return U(n?r.getUTCSeconds():r.getSeconds());case"SSS":return e.padLeft(U(n?r.getUTCMilliseconds():r.getMilliseconds()),"0",3);case"S":return U(n?r.getUTCMilliseconds():r.getMilliseconds());case"z":case"zzzz":return"";case"dd":return e.padLeft(U(n?r.getUTCDate():r.getDate()),"0",2);case"d":return U(n?r.getUTCDate():r.getDate());case"yyyy":return U(n?r.getUTCFullYear():r.getFullYear());case"yy":return e.padLeft(U(n?r.getUTCFullYear():r.getFullYear()),"0",2,!0);case"y":return U(n?r.getUTCFullYear():r.getFullYear());case"MMMMM":return U(L(i?i.monthsFormattedNarrow:void 0,n?r.getUTCMonth():r.getMonth(),"?"));case"MMMM":return U(L(i?i.monthsFormattedWide:void 0,n?r.getUTCMonth():r.getMonth(),"?"));case"MMM":return U(L(i?i.monthsFormattedAbbreviated:void 0,n?r.getUTCMonth():r.getMonth(),"?"));case"MM":return e.padLeft(U((n?r.getUTCMonth():r.getMonth())+1),"0",2);case"M":return U((n?r.getUTCMonth():r.getMonth())+1);case"LLLLL":return U(L(i?i.monthsNominativeNarrow:void 0,n?r.getUTCMonth():r.getMonth(),"?"));case"LLLL":return U(L(i?i.monthsNominativeWide:void 0,n?r.getUTCMonth():r.getMonth(),"?"));case"LLL":return U(L(i?i.monthsNominativeAbbreviated:void 0,n?r.getUTCMonth():r.getMonth(),"?"));case"EEEEE":return U(L(i?i.weekdaysFormattedNarrow:void 0,n?r.getUTCDay():r.getDay(),"?"));case"EEEE":return U(L(i?i.weekdaysFormattedWide:void 0,n?r.getUTCDay():r.getDay(),"?"));case"EEE":return U(L(i?i.weekdaysFormattedAbbreviated:void 0,n?r.getUTCDay():r.getDay(),"?"));case"EE":return U(L(i?i.weekdaysFormattedShort:void 0,n?r.getUTCDay():r.getDay(),"?"));case"E":return U(n?r.getUTCDay():r.getDay());case"ccccc":return U(L(i?i.weekdaysNominativeNarrow:void 0,n?r.getUTCDay():r.getDay(),"?"));case"cccc":return U(L(i?i.weekdaysNominativeWide:void 0,n?r.getUTCDay():r.getDay(),"?"));case"ccc":return U(L(i?i.weekdaysNominativeAbbreviated:void 0,n?r.getUTCDay():r.getDay(),"?"));case"cc":return U(L(i?i.weekdaysNominativeShort:void 0,n?r.getUTCDay():r.getDay(),"?"));case"''":return"'"}return t.replace(/'/g,"")})))}static formatElapsed(s="H'h':mm'm':ss's'.SSS'ms'.uuu'µs'",n,i,r){let a,o,h,u,l,c;return n=t.conform(G(n,this.timerElapsed),3),a=Math.floor(n/36e5),o=Math.floor(n%36e5/6e4),h=Math.floor(n%36e5%6e4/1e3),c=U(t.conform(n%36e5%6e4%1e3,3)).split("."),u=c[0],l=O(c)>=2?c[1]:"0",e.sanitize(s.replace(/('[^']+')|('')|(HH)|(H)|(hh)|(h)|(mm)|(m)|(ss)|(s)|(SSS)|(S)|(uuu)|(u)|(zzzz)|(z)|(dd)|(d)|(MMMMM)|(MMMM)|(MMM)|(MM)|(M)|(LLLLL)|(LLLL)|(LLL)|(EEEEE)|(EEEE)|(EEE)|(EE)|(E)|(ccccc)|(cccc)|(ccc)|(cc)|(yyyy)|(yy)|(y)|(a)/g,(t=>{switch(t){case"HH":return e.padLeft(U(a),"0",2);case"H":return U(a);case"hh":return e.padLeft(U((a+11)%12+1),"0",2);case"h":return U((a+11)%12+1);case"a":return U(a>=12?r:i);case"mm":return e.padLeft(U(o),"0",2);case"m":return U(o);case"ss":return e.padLeft(U(h),"0",2);case"s":return U(h);case"SSS":return e.padLeft(u,"0",3);case"S":return u;case"uuu":return e.padLeft(l,"0",3);case"u":return l;case"z":case"zzzz":return"";case"''":return"'"}return t.replace(/'/g,"")})))}static get log(){return this.format("dd-MM-yyyy HH:mm:ss.SSS")}static get logTime(){return this.format("HH:mm:ss.SSS")}get date(){return this.m_pDate}get time(){return this.date.getTime()}set time(t){this.m_pDate=new Date(t)}}function _(){}function b(t){return void 0===t}function y(t){return!b(t)}function v(t){return b(t)||"object"==typeof t&&null===t}function C(t){return"object"==typeof t&&null!==t&&!P(t)}function k(t){return"function"==typeof t}function S(t){return"string"==typeof t}function x(t){return S(t)?t.length:0}function w(t){return x(t)>0}function M(t){return"number"==typeof t&&!isNaN(t)}function T(t,e,s){return"number"==typeof t&&isFinite(t)&&("number"!=typeof e||t>=e)&&("number"!=typeof s||t<=s)}function I(t,e,s){return"number"==typeof t&&isFinite(t)&&t%1!=0&&("number"!=typeof e||t>=e)&&("number"!=typeof s||t<=s)}function E(t){return"boolean"==typeof t}function P(t){return Array.isArray(t)}function F(t){return(C(t)||P(t)||k(t))&&"number"==typeof t.length&&"function"==typeof t.item}function A(t){return P(t)||F(t)}function O(t){return P(t)||F(t)?t.length:C(t)?O(Object.keys(t)):0}function L(t,e,s){if(e=$(e),t)if(P(t)){if(e>=0&&e<O(t))return t[e]}else if(F(t)){if(e>=0&&e<O(t))return t.item(e)}else if(C(t)){const s=Object.keys(t);if(e>=0&&e<O(s))return t[s[e]]}return y(s)?s:void 0}function R(t,e){if(t)if(P(t)){if(O(t)>0)return t[0]}else if(F(t)){if(O(t)>0)return t.item(0)}else if(C(t)){const e=Object.keys(t);if(O(e)>0)return t[e[0]]}return y(e)?e:void 0}function H(t,e){if(t)if(P(t)){const e=O(t);if(e>0)return t[e-1]}else if(F(t)){const e=O(t);if(e>0)return t.item(e-1)}else if(C(t)){const e=Object.keys(t),s=O(e);if(s>0)return t[e[s-1]]}return y(e)?e:void 0}function B(t){return C(t)&&"[object Date]"===Object.prototype.toString.call(t)}function V(t){return C(t)&&"[object RegExp]"===Object.prototype.toString.call(t)}function N(t){return t instanceof Error}function D(t,e){if(v(t))throw new Error(e||"Assert failed!");return t}function z(t){return t}function U(t,e){return S(t)?t:y(t)&&!v(t)&&k(t.toString)?t.toString():S(e)?e:""}function $(t,e){if(T(t))return Math.round(t);if(E(t))return t?1:0;if(y(t)&&!v(t)&&k(t.toString)){const e=parseFloat(t.toString().replace(/[^-e\d.]/g,""));if(T(e))return Math.round(e)}return T(e)?Math.round(e):0}function G(t,e){if(T(t))return parseFloat(`${t}`);if(E(t))return t?1:0;if(y(t)&&!v(t)&&k(t.toString)){const e=parseFloat(t.toString().replace(/[^-e\d.]/g,""));if(T(e))return e}return T(e)?e:0}function K(t,e){if(E(t))return t;if(T(t))return!!t;if(y(t)&&!v(t)&&k(t.toString)){const e=t.toString();return!("0"===e||"false"===e.toLowerCase())}return!!e}function q(t){return Object.create(t)}function j(t,...e){const s=t;return Y(e,(t=>{Y(t,((t,e)=>{C(t)&&C(s[e])?j(s[e],t):s[e]=t}),{keys:!0})})),s}function W(...t){const e={};return Y(t,(t=>{Y(t,((t,s)=>{C(t)&&C(e[s])?e[s]=W(e[s],t):e[s]=t}),{keys:!0})})),e}function J(t,e,s){if(C(t)||P(t)){let n,i,r=!1,a=!1;if(C(t)!==C(e)||P(t)!==P(e))return!1;if(F(t)?r=!0:P(t)||(n=Object.keys(t)),F(e)?a=!0:P(e)||(i=Object.keys(e)),r!==a||P(n)!==P(i)||(n||t).length!==(i||e).length)return!1;const o=(n||t).length;for(let h=0;h<o;h++){const o=n?n[h]:h,u=i?i[h]:h;if(o!==u||!J(r?t.item(o):t[o],a?e.item(u):e[u],s))return!1}return!0}return!(typeof t!=typeof e||v(t)!==v(e)||s&&t!==e)}function Y(t,e,s){if(t&&e){const n=s&&s.arguments?s.arguments:void 0,i=!(!s||!s.replace);let r;if(r=s&&s.keys?n?(t,s)=>e(t,s,...n):(t,s)=>e(t,s):n?t=>e(t,...n):t=>e(t),P(t))t.forEach(((e,s)=>{const n=r(e,s);i&&(t[s]=n)}));else if(F(t)){const e=t,s=e.length;for(let t=0;t<s;t++)r(e.item(t),t)}else{Object.keys(t).forEach((e=>{const s=r(t[e],e);i&&(t[e]=s)}))}}return t}function Z(t,e,s){if(t){let r,a;F(t)?r=t:P(t)||(a=Object.keys(t));for(let o=(a||r||t).length-1;o>=0;o--){const h=ut(e,...(n=a?a[o]:o,i=s&&s.arguments?s.arguments.slice(0):[],s&&s.keys&&i.unshift(n),S(n)?i.unshift(t[n]):r?i.unshift(r.item(n)):i.unshift(t[n]),i));s&&s.replace&&!r&&(a?t[a[o]]=h:t[o]=h)}}var n,i;return t}function Q(t,e,...s){const n=[];if(t){let a,o;F(t)?a=t:P(t)||(o=Object.keys(t));const h=(o||a||t).length;for(let u=0;u<h;u++)n.push(ut(e,...(i=o?o[u]:u,r=s.slice(0),S(i)?r.unshift(t[i]):a?r.unshift(a.item(i)):r.unshift(t[i]),r)))}var i,r;return n}function X(t,e,s,...n){if(t){let a,o;F(t)?a=t:P(t)||(o=Object.keys(t));const h=(o||a||t).length;for(let u=0;u<h;u++)s=ut(e,...(i=o?o[u]:u,r=n.slice(0),S(i)?r.unshift(t[i]):a?r.unshift(a.item(i)):r.unshift(t[i]),r.unshift(s),r))}var i,r;return s}function tt(t,e,s=!1){if(t){let n,i;F(t)?n=t:P(t)||(i=Object.keys(t));const r=(i||n||t).length;for(let a=0;a<r;a++){let r=!1;if(r=K(ut(e,i?t[i[a]]:n?n.item(a):t[a])),s===r)return s}return!s}return!1}function et(t,e){return tt(t,e,!1)}function st(t,e){return tt(t,e,!0)}function nt(t,e){let s=0;if(t){let n,i;F(t)?n=t:P(t)||(i=Object.keys(t));const r=(i||n||t).length;for(let a=0;a<r;a++){let r=!0;k(e)&&(r=K(ut(e,i?t[i[a]]:n?n.item(a):t[a]))),r&&s++}}return s}function it(t,e,s){const n=!(!s||"first"!==s.return),i=!(!s||"last"!==s.return);let r;if(s&&s.return&&"matches"!==s.return||(r=[]),t){let h,u;F(t)?h=t:P(t)||(u=Object.keys(t));const l=(u||h||t).length;for(let c=i?l-1:0;i&&c>=0||!i&&c<l;i?c--:c++){let l=!0;if(l=K(ut(e,u?t[u[c]]:h?h.item(c):t[c])),l){if(s&&k(s.do)){const e=ut(s.do,...(a=u?u[c]:c,o=s&&s.arguments?s.arguments.slice(0):[],S(a)?o.unshift(t[a]):h?o.unshift(h.item(a)):o.unshift(t[a]),o));s&&s.replace&&!h&&(u?t[u[c]]=e:t[c]=e)}if(n||i)return u?t[u[c]]:h?h.item(c):t[c];r&&(u?r.push(t[u[c]]):h?r.push(h.item(c)):r.push(t[c]))}}}var a,o;return r}function rt(t,e){return it(t,e)}function at(t,e){return it(t,e,{return:"first"})}function ot(t,e){return it(t,e,{return:"last"})}function ht(t,e){if(t){let s,n;F(t)?s=t:P(t)||(n=Object.keys(t));const i=(n||s||t).length;for(let r=0;r<i;r++){let i=!0;if(i=K(ut(e,n?t[n[r]]:s?s.item(r):t[r])),i)return n?n[r]:r}}}function ut(t,...e){if(t)return t(...e)}function lt(t,...e){c.schedule(t,...e)}function ct(t,...e){p.schedule(t,...e)}function mt(t,e,...s){e?ut(t,...s):lt(t,...s)}function pt(t,e,...s){if(t&&e)return t.bind(e)(...s)}function dt(t,...e){if(k(t))return t(...e)}function gt(t,...e){return c.schedule(t,...e)}function ft(t,e,...s){return _t(e),gt(t,...s)}function _t(t){return c.cancel(t),0}function bt(t,...e){return p.schedule(t,...e)}function yt(t,e,...s){return vt(e),bt(t,...s)}function vt(t){return p.cancel(t),0}function Ct(t,...e){return m.schedule(t,...e)}function kt(t,e,...s){return St(e),Ct(t,...s)}function St(t){return m.cancel(t),0}function xt(t,e,...s){return((t,e=0)=>setTimeout(t,e)||0)((()=>t(...s)),e)}function wt(t){return 0!==t&&clearTimeout(t),0}function Mt(t,e,...s){const n=g.n+1,i=U(n),r=f.precise,a=()=>{d[i]&&(f.elapsed(r,!0)>=e?(d[i](...s),Gt(d,i)):Ct(a))};return d[i]=t,Ct(a),n}function Tt(t){return 0!==t&&Gt(d,U(t)),0}function It(t,e,...s){return((t,e=0)=>setInterval(t,e)||0)((()=>t(...s)),e)}function Et(t){return 0!==t&&clearInterval(t),0}function Pt(t,e,...s){const n=g.n+1,i=U(n);let r=f.precise;const a=()=>{d[i]&&(f.elapsed(r,!0)>=e&&(d[i](...s),r=f.precise),Ct(a))};return d[i]=t,Ct(a),n}function Ft(t){return 0!==t&&Gt(d,U(t)),0}function At(t,e,...s){t&&(e>0?Ct((()=>At(t,--e,...s))):t(...s))}function Ot(t,...e){At(t,2,...e)}function Lt(t,...e){At(t,2,...e)}function Rt(t,...e){At(t,5,...e)}function Ht(t,e,s){return t[e]=s}function Bt(t,e,s){return(C(t)||k(t))&&w(e)?t[e]=s:s}function Vt(t,e){return t[e]}function Nt(t,e){if(t&&w(e))return t[e]}function Dt(t,e,s=!1){return K(Nt(t,e),s)}function zt(t,e,s=""){return U(Nt(t,e),s)}function Ut(t,e,s=0){return $(Nt(t,e),s)}function $t(t,e,s=0){return G(Nt(t,e),s)}function Gt(t,e){return!!(t&&w(e)&&y(t[e]))&&delete t[e]}function Kt(t,...e){return new t(...e)}f.m_nStamp=0;var qt,jt;!function(t){function s(){return e.padRight(f.logTime," ",16,!0)}function n(t){return e.padRight(t," ",23,!0)}t.time=s,t.module=n,t.log=function(t,e){return s()+n(t)+e}}(qt||(qt={})),function(t){t.isBrowser=h,t.isNode=u,t.isWebWorker=l}(jt||(jt={}));class Wt{constructor(){this.m_nFlag=1}get flag(){const t=this.m_nFlag;return this.m_nFlag=this.m_nFlag<<1,t}static convert(...t){let e=1;return X(t,((t,s)=>(t|=s?e:0,e*=2,t)),0)||0}static has(t,e){let s=1;if(e>0)for(;--e;)s*=2;return K(t&s)}}class Jt{constructor(t,e,s){this.m_pArguments=[],this.m_nTime=0,this.m_nHandle=0,this.m_bPromise=!1,this.m_bFrame=!1,this.m_bDoubleFrame=!1,this.m_sHold=!1,this.m_bThrottle="debounce"!==t,this.m_bDelay="throttle-delay"===t,this.m_fnCallback=e,this.m_nTimeout="tick"!==s&&"promise"!==s&&"frame"!==s&&"double-frame"!==s&&s||0,this.m_bPromise="promise"===s,this.m_bFrame="frame"===s||"double-frame"===s,this.m_bDoubleFrame="double-frame"===s}call(){this.m_nHandle=0,this.m_fnCallback(...this.m_pArguments)}invoke(...t){if(!this.m_sHold&&this.m_bThrottle&&this.m_nTimeout>0){if(!this.m_bDelay)return void(f.elapsed(this.m_nTime,!0)>=this.m_nTimeout&&(this.m_pArguments=t,this.m_nTime=f.precise,this.call()));0!==this.m_nHandle&&f.elapsed(this.m_nTime,!0)>=this.m_nTimeout&&(this.cancel(),this.call())}this.m_pArguments=t,this.m_bThrottle||this.cancel(),this.m_sHold?this.m_sHold="hold":0===this.m_nHandle&&(this.m_nTime=f.precise,this.m_nTimeout>0?this.m_nHandle=xt((()=>this.call()),this.m_nTimeout):this.m_bPromise?this.m_nHandle=bt((()=>this.call())):this.m_bFrame?this.m_nHandle=Ct((()=>{this.m_bDoubleFrame?this.m_nHandle=Ct((()=>this.call())):this.call()})):this.m_nHandle=gt((()=>this.call())))}cancel(){const t=this.m_nTimeout>0?wt:this.m_bPromise?vt:this.m_bFrame?St:_t;this.m_nHandle=t(this.m_nHandle)}flush(){this.m_sHold=!1,0!==this.m_nHandle&&(this.cancel(),this.call())}hold(){this.m_sHold=this.m_sHold||(0===this.m_nHandle?"catch":"hold"),this.cancel()}release(t=!1){if(this.m_sHold){const e="hold"===this.m_sHold;this.m_sHold=!1,e&&(t?this.call():this.invoke(...this.m_pArguments))}}}class Yt extends Jt{constructor(t,e="frame",s=!0){super(s?"throttle-delay":"throttle",t,e)}}class Zt extends Jt{constructor(t,e="frame"){super("debounce",t,e)}}class Qt{constructor(){this.m_pStack=[]}add(t){this.m_pStack.push(t)}flush(){const t=this.m_pStack.length;for(let e=0;e<t;e++)this.m_pStack[e]()}clear(){this.m_pStack=[]}flushAndClear(){this.flush(),this.clear()}}let Xt=!1;function te(){Xt=!0}function ee(){Xt=!1}class se{constructor(){this.m_pHooks={},this.m_nHookTimeout=0,this.m_nHookFrame=0,this.m_nHookBuffer=0}get isHookBufferEnabled(){return this.m_nHookBuffer>0}getHooks(t){const e=this.m_pHooks[t];if(e)return e}prepareHookPayload(t,e,s){return t.hook={name:e,type:s},t}scheduleHook(t){"framed"===t?this.m_nHookFrame=kt((()=>this.invokeHook(t)),this.m_nHookFrame):this.m_nHookTimeout=ft((()=>this.invokeHook(t)),this.m_nHookTimeout)}invokeHook(t){const e=new Qt;Y(this.m_pHooks,((s,n)=>{Y(s,(s=>{s.type===t&&Y(s.payloads.splice(0,s.payloads.length),(t=>{e.add((()=>s.hook(this.prepareHookPayload(t,n,s.type))))}))}))}),{keys:!0}),e.flush()}attachHook(t,e,s,n,i){(this.getHooks(t)||(this.m_pHooks[t]=[])).push({hook:s,payloads:[],type:e,group:n,context:i})}hook(t,e,s,n){return this.attachHook(t,e,s,!1,n),this}groupedHook(t,e,s,n){return this.attachHook(t,e,s,!0,n),this}emitHook(t,e,s="fifo"){const n=this.getHooks(t);if(n){const i=new Qt;return Y(n,(n=>{"synchronous"!==n.type||this.isHookBufferEnabled?(n.group&&n.payloads.length>0?n.payloads[0]=e:"lifo"===s?n.payloads.splice(0,0,e):n.payloads.push(e),"synchronous"===n.type||this.isHookBufferEnabled||this.scheduleHook(n.type)):i.add((()=>n.hook(this.prepareHookPayload(e,t,"synchronous"))))})),i.flush(),!0}return!1}bufferHooks(){this.m_nHookTimeout=_t(this.m_nHookTimeout),this.m_nHookFrame=St(this.m_nHookFrame),this.m_nHookBuffer++}flushHooks(){if(this.m_nHookBuffer>0&&(this.m_nHookBuffer--,0===this.m_nHookBuffer)){const t=new Qt;Y(this.m_pHooks,((e,s)=>{Y(e,(e=>{"synchronous"===e.type?Y(e.payloads.splice(0,e.payloads.length),(n=>{t.add((()=>e.hook(this.prepareHookPayload(n,s,e.type))))})):this.scheduleHook(e.type)}))}),{keys:!0}),t.flush()}}unhook(t,e){const s=this.getHooks(t);if(s){let n=!1;if(e){let t=s.length;for(;t--;){const i=s[t];i.context!==e&&i.hook!==e||(s.splice(t,1),n=!0)}}return e&&0!==s.length?n:(Gt(this.m_pHooks,t),!0)}return!1}unhookContext(t){let e=!1;return Y(this.m_pHooks,((s,n)=>{let i=s.length;for(;i--;){s[i].context===t&&(s.splice(i,1),e=!0)}0===s.length&&Gt(this.m_pHooks,n)}),{keys:!0}),e}destroy(){const t=new Qt;this.m_nHookTimeout=_t(this.m_nHookTimeout),this.m_nHookFrame=St(this.m_nHookFrame),this.m_nHookBuffer=0,Y(this.m_pHooks,((e,s)=>{Y(e,(e=>{Y(e.payloads.splice(0,e.payloads.length),(n=>{t.add((()=>e.hook(this.prepareHookPayload(n,s,e.type))))}))}))}),{keys:!0}),this.m_pHooks={},t.flush()}}function ne(t,e,s,n,i="multiple"){if(!n||!k(n.value))throw new Error(`The '@${t}' decorator can only be applied to a method but '${s}' seems to be a property.`);const r=`@marker @${t}`,a=`@marker @${t} #${s}`,o=Object.getOwnPropertyDescriptor(e,r);if(Object.getOwnPropertyDescriptor(e,a))throw new Error(`Decorator '@${t}' is already applied to the method '${s}'.`);if("single"===i&&o)throw new Error(`Decorator '@${t}' is already used in this class, but can only be applied once.`);Object.defineProperty(e,a,{value:!0,writable:!1,enumerable:!1,configurable:!1}),o?o.value.push(n.value):Object.defineProperty(e,r,{value:[n.value],writable:!1,enumerable:!1,configurable:!1})}function ie(t,e,...s){const n=Nt(e,`@marker @${t}`);if(n){const t=n.length;if(1===t)return pt(n[0],e,...s);for(let i=0;i<t;i++)pt(n[i],e,...s)}}function re(t,e,s,n,i){const r={target:e,property:s,oldValue:n,newValue:i};Y(Nt(e,t),(t=>{pt(t,e,r)}))}class ae{constructor(){this.m_pStack=[]}push(t){this.m_pStack.push(t)}flush(){let t=this.m_pStack.shift();for(;t;)t(),t=this.m_pStack.shift()}}class oe extends se{constructor(t=0,e=0,s=1){super(),this.m_nCurrentCount=0,this.m_pCursor={column:0,row:0,index:0},this.m_bSilent=!1,this.m_pItems=[],this.m_nUniqueId=oe.enumerator.n,this.m_nType=t,this.m_nOrientation=e,this.m_nColumns=this.m_nCurrentColumns=0===this.type?Math.max(s,1):0,this.m_nRows=this.m_nCurrentRows=1===this.type?Math.max(s,1):0}get uniqueId(){return this.m_nUniqueId}get type(){return this.m_nType}set type(t){this.m_nType!==t&&(this.m_nType=t,this.recalculate(new ae,0,"change",-1,32).flush())}get orientation(){return this.m_nOrientation}set orientation(t){if(this.m_nOrientation!==t){const e=new ae;this.m_nOrientation=t,this.reindex(e,0,-1,"change",-1,32),e.flush()}}get columns(){return this.m_nColumns}set columns(t){this.m_nType=0,t!==this.m_nColumns&&(this.m_nColumns=Math.max(t,1),this.recalculate(new ae,0,"change",-1,32).flush())}get rows(){return this.m_nRows}set rows(t){this.m_nType=1,t!==this.m_nRows&&(this.m_nRows=Math.max(t,1),this.recalculate(new ae,0,"change",-1,32).flush())}get count(){return this.m_pItems.length}get all(){return this.m_pItems}get currentItem(){return this.itemAtIndex(this.safeCursor.index)}get firstItem(){return this.itemAtIndex(0)}get lastItem(){return this.itemAtIndex(this.count-1)}get lastItemInFirstRow(){return this.lastItemInRow(0)}get lastItemInFirstColumn(){return this.lastItemInColumn(0)}get cursor(){return this.m_pCursor}set cursor(t){const e=this.m_pCursor.column,s=this.m_pCursor.row;this.m_pCursor=this.getSafeCursor(t),this.m_pCursor.column===e&&this.m_pCursor.row===s||this.isSilent||this.onCursorChange({matrix:this,cursor:this.cursor})}get safeCursor(){return this.m_pCursor}get isCursorAtFirstColumn(){return 0===this.cursor.column}get isCursorAtLastColumn(){return this.cursor.column===this.columns-1}get isCursorAtEndColumn(){return this.cursor.column===this.columns}get isCursorAtFirstRow(){return 0===this.cursor.row}get isCursorAtLastRow(){return this.cursor.row===this.rows-1}get isCursorAtEndRow(){return this.cursor.row===this.rows}get isCursorAtFirst(){return 0===this.cursor.index}get isCursorAtLast(){return this.cursor.index===this.count-1}get isCursorAtEnd(){return this.cursor.index===this.count}get isSilent(){return k(this.m_bSilent)?this.m_bSilent():this.m_bSilent}set isSilent(t){this.m_bSilent=t}isValidIndex(t,e=!1){return T(t)&&t>=0&&t<this.count+(e?1:0)}reindex(e,s,n,i,r,a){let o=!1;for(s=t.max(s,0),n=this.isValidIndex(n)?n+1:this.count,r=this.isValidIndex(r)?r:-1,this.isSilent&&(i="nothing");s<n;)o=this.m_pItems[s].reindex(e,this,s,"nothing"!==i?r===s?i:"auto":"nothing",a)||o,s++;return o}recalculate(t,e,s,n,i){const r="nothing"!==s&&!this.isSilent,a=this.count;switch(this.m_nType){case 0:0===this.m_nColumns&&(this.m_nColumns=1),this.m_nRows=Math.max(Math.ceil(a/this.m_nColumns),a>0?1:0);break;case 1:0===this.m_nRows&&(this.m_nRows=1),this.m_nColumns=Math.max(Math.ceil(a/this.m_nRows),a>0?1:0);break;case 2:this.m_nColumns=this.m_nRows=Math.max(Math.ceil(Math.sqrt(a)),a>0?1:0);break;case 3:case 4:for(this.m_nColumns=this.m_nRows=Math.max(Math.floor(Math.sqrt(a)),a>0?1:0);this.m_nColumns*this.m_nRows<a;)for(3===this.m_nType?this.m_nColumns++:this.m_nRows++;this.m_nColumns*this.m_nRows<a;)4===this.m_nType?this.m_nColumns++:this.m_nRows++}return r&&(this.bufferHooks(),(1===this.m_nOrientation&&this.m_nColumns!==this.m_nCurrentColumns||0===this.m_nOrientation&&this.m_nRows!==this.m_nCurrentRows)&&(e=0),this.isValidIndex(e)&&this.reindex(t,e,a,s,n,i)),this.m_nColumns===this.m_nCurrentColumns&&this.m_nRows===this.m_nCurrentRows||((this.safeCursor.column>this.m_nColumns||this.safeCursor.row>this.m_nRows)&&(this.cursor={column:Math.min(this.safeCursor.column,this.m_nColumns),row:Math.min(this.safeCursor.row,this.m_nRows)}),r&&t.push((()=>{this.onDimensionChange({matrix:this,difference:this.m_nColumns*this.m_nRows-this.m_nCurrentColumns*this.m_nCurrentRows,columns:this.m_nColumns,rows:this.m_nRows,reason:i})})),this.m_nCurrentColumns=this.m_nColumns,this.m_nCurrentRows=this.m_nRows),a!==this.m_nCurrentCount&&(r&&t.push((()=>{this.onCountChange({matrix:this,difference:a-this.m_nCurrentCount,count:a,reason:i})})),this.m_nCurrentCount=a),r&&this.flushHooks(),t}getSafeCursor(t){if(!T(t.index)||t.index<0){const e=Math.min(Math.max(T(t.column)?t.column:this.columns,0),this.columns),s=Math.min(Math.max(T(t.row)?t.row:this.rows,0),this.rows);return{column:e,row:s,index:this.indexFromColumnRow(e,s)}}return this.cursorFromIndex(t.index)}onDimensionChange(t){this.emitHook("OnDimensionChange",t)}onCountChange(t){this.emitHook("OnCountChange",t)}onCursorChange(t){this.emitHook("OnCursorChange",t)}indexFromColumnRow(t,e){const s=t>=0&&t<this.columns&&e>=0&&e<this.rows?0===this.orientation?this.rows*t+e:this.columns*e+t:-1;return s>=0&&s<this.count?s:-1}cursorFromIndex(t){return{column:(t=Math.min(Math.max(t||0,0),this.count))<this.count?0===this.orientation?Math.floor(t/this.rows):t%this.columns:this.columns,row:t<this.count?0===this.orientation?t%this.rows:Math.floor(t/this.columns):this.rows,index:t}}pushToMatrix(t,e={index:void 0,recalculate:!0,emit:"push"}){const s=this.isSilent?"nothing":e.emit,n=K(e.recalculate,!0),i=new ae;let r,a;if(a=T(e.index)?e.index:t.index,!t.isPopped&&t.parent){if(this===t.parent)return this.isValidIndex(e.index,!0)&&t.moveToIndex(e.index),t;r=t.parent,t.popSilent()}if(this.isValidIndex(a)?this.m_pItems.splice(a,0,t):a=this.m_pItems.push(t)-1,"nothing"!==s&&this.bufferHooks(),n&&"nothing"!==s||t.reindex(i,this,a,s,1),n&&this.recalculate(i,a,s,a,1),"nothing"!==s){if(t.isFirst){const e=t.successorSibling;e&&(e.dispatch(i,{hook:"OnItemChange",payload:{matrix:this,matrixPrevious:r,item:e,reason:128}}),this.emitHook("OnItemChange",{matrix:this,matrixPrevious:r,item:e,reason:128}))}if(t.isLast){const e=t.predecessorSibling;e&&(e.dispatch(i,{hook:"OnItemChange",payload:{matrix:this,matrixPrevious:r,item:e,reason:64}}),this.emitHook("OnItemChange",{matrix:this,matrixPrevious:r,item:e,reason:64}))}}return i.flush(),"nothing"!==s&&this.flushHooks(),t}moveTo(t,e){return this.moveToIndex(t,this.getSafeCursor(e).index)}moveToIndex(t,e){if(this.isValidIndex(e,!0)&&t.index!==e){const s=new ae;return this.m_pItems.splice(e,0,this.m_pItems.splice(t.index,1)[0]),this.reindex(s,Math.min(t.index,e),Math.max(t.index,e),"change",-1,4),s.flush(),!0}return!1}moveToPosition(t,e,s){return this.moveToIndex(t,this.indexFromColumnRow(e,s))}moveToItem(t,e,s){return this.moveToIndex(t,e.index+(s?0:1)-(t.index<e.index?1:0))}moveUpOrDown(t,e){if(e&&!t.isFirstOfMatrix||!e&&!t.isLastOfMatrix){const s=new ae;return this.m_pItems[t.index]=this.m_pItems[t.index+(e?-1:1)],this.m_pItems[t.index+(e?-1:1)]=t,this.reindex(s,t.index-(e?1:0),t.index+(e?0:1),"change",-1,4),s.flush(),!0}return!1}swap(e,s){if(e.index!==s.index){const n=new ae;return this.m_pItems[e.index]=s,this.m_pItems[s.index]=e,this.reindex(n,t.min(e.index,s.index),t.max(e.index,s.index),"change",-1,8),n.flush(),!0}return!1}popFromMatrix(t,e=!0){let s=[],n=!1,i=!1;if(t||(t=this.itemAtIndex(this.count-1)),t&&(n=t.isFirst,i=t.isLast,this.isValidIndex(t.index)&&t===this.m_pItems[t.index]&&(s=this.m_pItems.splice(t.index,1))),1===s.length&&s[0]){const t=new ae,r=!!this.isSilent;if(s[0].dispatch(t,"Pop"),r||(this.bufferHooks(),e&&(s[0].dispatch(t,{hook:"OnItemPop",payload:{matrix:this,item:s[0]}}),this.emitHook("OnItemPop",{matrix:this,item:s[0]}))),this.recalculate(t,s[0].index,"change",-1,2),!r){if(n){const e=this.firstItem;e&&(e.dispatch(t,{hook:"OnItemChange",payload:{matrix:this,matrixPrevious:void 0,item:e,reason:128}}),this.emitHook("OnItemChange",{matrix:this,matrixPrevious:void 0,item:e,reason:128}))}if(i){const e=this.lastItem;e&&(e.dispatch(t,{hook:"OnItemChange",payload:{matrix:this,matrixPrevious:void 0,item:e,reason:64}}),this.emitHook("OnItemChange",{matrix:this,matrixPrevious:void 0,item:e,reason:64}))}}return t.flush(),r||this.flushHooks(),s[0]}}sort(t=((t,e)=>t.uniqueId-e.uniqueId)){this.m_pItems.sort(t);const e=new ae,s=this.reindex(e,0,-1,"change",-1,16);return e.flush(),s}clear(t="thorough"){const e=new ae;if("dirty"!==t){const s=this.count;for(let n=0;n<s;n++){const s=this.m_pItems[n];s.dispatch(e,"Pop"),this.isSilent||(s.dispatch(e,{hook:"OnItemPop",payload:{matrix:this,item:s}}),"thorough"===t&&this.emitHook("OnItemPop",{matrix:this,item:s})),s.dispatch(e,"Detach")}}this.m_pItems=[],"dirty"!==t&&("thorough"===t&&this.recalculate(e,0,"change",-1,2),e.flush())}invalidateMatrix(){this.onDimensionChange({matrix:this,difference:this.m_nColumns*this.m_nRows-this.m_nCurrentColumns*this.m_nCurrentRows,columns:this.columns,rows:this.rows,reason:32})}recalculateMatrix(){this.recalculate(new ae,0,"change",-1,32).flush()}each(t,e,s){const n=this.m_pItems.slice(e,T(s)&&s>=0?s+1:s),i=n.length;for(let e=0;e<i;e++){const s=t(n[e]);if(E(s)&&s)return!0}return!1}reverseEach(t,e,s){const n=this.m_pItems.slice(e,T(s)&&s>=0?s+1:s);for(let e=n.length-1;e>=0;e--){const s=t(n[e]);if(E(s)&&s)return!0}return!1}itemAtIndex(t){return this.isValidIndex(t)?this.m_pItems[t]:void 0}itemAtPosition(t,e){return this.itemAtIndex(this.indexFromColumnRow(t,e))}itemAtCursor(t){return this.itemAtIndex(this.getSafeCursor(t).index)}itemFromId(t){return at(this.m_pItems,(e=>e.uniqueId===t))}lastItemInRow(t){let e,s=this.columns;for(;!e&&s>0;)e=this.itemAtPosition(--s,t);return e}lastItemInColumn(t){let e,s=this.rows;for(;!e&&s>0;)e=this.itemAtPosition(t,--s);return e}moveCursorToFirstColumn(t=!1){return this.cursor={column:0,row:t?0:this.safeCursor.row,index:-1}}moveCursorToSuccessorColumn(t=!1){return this.cursor={column:this.cursor.column+1,row:t?0:this.safeCursor.row,index:-1}}moveCursorToPredecessorColumn(t=!1){return this.cursor={column:this.cursor.column-1,row:t?0:this.safeCursor.row,index:-1}}moveCursorToLastColumn(t=!1){return this.cursor={column:this.columns-1,row:t?0:this.safeCursor.row,index:-1}}moveCursorToFirstRow(t=!1){return this.cursor={column:t?0:this.safeCursor.column,row:0,index:-1}}moveCursorToSuccessorRow(t=!1){return this.cursor={column:t?0:this.safeCursor.column,row:this.cursor.row+1,index:-1}}moveCursorToPredecessorRow(t=!1){return this.cursor={column:t?0:this.safeCursor.column,row:this.cursor.row-1,index:-1}}moveCursorToLastRow(t=!1){return this.cursor={column:t?0:this.safeCursor.column,row:this.rows-1,index:-1}}moveCursorToFirst(){return this.cursor={column:-1,row:-1,index:0}}moveCursorToSuccessor(){return this.cursor={column:-1,row:-1,index:this.safeCursor.index+1}}moveCursorToPredecessor(){return this.cursor={column:-1,row:-1,index:this.safeCursor.index-1}}moveCursorToLast(){return this.cursor={column:-1,row:-1,index:this.count-1}}moveCursorToEnd(){return this.cursor={column:-1,row:-1,index:this.count}}}oe.enumerator=new i;const he=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],ue=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],le=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428],ce=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],me=[2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561],pe=[573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882],de=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],ge=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function fe(t,e){return t>>>e|t<<32-e}function _e(t,e,s,n){return fe(t,e)^fe(t,s)^t>>>n}function be(t,e){return t[15&e]+=_e(t[e+14&15],17,19,10)+t[e+9&15]+_e(t[e+1&15],7,18,3)}function ye(t,e){const s=(65535&t)+(65535&e);return(e=(t>>16)+(e>>16)+(s>>16))<<16|65535&s}function ve(t,e,...s){let n=0,i=0,r=0,a=0;for(;n<s.length/2;n++)i=s[n],r+=65535&i,a+=i>>>16;for(a+=r>>>16,t[e+1]=a<<16|65535&r,r=a>>>16,a=0;n<s.length;n++)i=s[n],r+=65535&i,a+=i>>>16;a+=r>>>16,t[e]=a<<16|65535&r}function Ce(t,e){let s=0;const n=[],i=[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]];for(;s<16;)n[s]=e[3+(s<<2)]|e[2+(s<<2)]<<8|e[1+(s<<2)]<<16|e[s<<2]<<24,s++;for(s=0;s<64;s++){const t=i[0],e=i[1],r=i[2],a=i[4],o=i[7]+(fe(a,6)^fe(a,11)^fe(a,25))+(a&i[5]^~a&i[6])+de[s]+(s<16?n[s]:be(n,s));for(let s=7;s>=0;s--)i[s]=4===s?ye(i[3],o):0===s?ye(o,(fe(t,2)^fe(t,13)^fe(t,22))+(t&e^t&r^e&r)):i[s-1]}for(s=0;s<8;s++)t[s]+=i[s]}function ke(t,e,s){let n;try{n=unescape(encodeURIComponent(t))}catch(e){n=function(t){const e=t.length;let s="";for(let n=0;n<e;n++){const e=t.charCodeAt(n);if(e<128)s+=String.fromCharCode(e);else if(e<2048)s+=String.fromCharCode(192|e>>>6,128|63&e);else if(e<55296||e>=57344)s+=String.fromCharCode(224|e>>>12,128|e>>>6&63,128|63&e);else{const i=65536+((1023&e)<<10|1023&t.charCodeAt(++n));s+=String.fromCharCode(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)}}return s}(t)}const i=(e?224===s?me:256===s?pe:384===s?le:ce:224===s?he:ue).slice(),r=n.length,a=[];let o,h,u="",l=0,c=!0,m=0,p=0,d=0,g=0,f=0;if(e){const t=[0,0,0,0,0,0,0,0],e=[24,16,8,0];let s;do{for(a[0]=l,o=1;o<=32;o++)a[o]=0;for(o=d;m<r&&o<128;++m){const t=n.charCodeAt(m);t<128?a[o>>2]|=t<<e[3&o++]:(a[o>>2]|=(192|t>>6)<<e[3&o++],a[o>>2]|=(128|63&t)<<e[3&o++])}for(p+=o-d,d=o-128,m===r&&(a[o>>2]|=[-2147483648,8388608,32768,128][3&o],++m),l=a[32],m>r&&o<112&&(a[31]=p<<3,c=!1),h=32;h<160;h+=2){const t=a[h-30],e=a[h-29],s=a[h-4],n=a[h-3];ve(a,h,a[h-13],a[h-31],(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25),(n>>>19|s<<13)^(s>>>29|n<<3)^(n>>>6|s<<26),a[h-14],a[h-32],(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7,(s>>>19|n<<13)^(n>>>29|s<<3)^s>>>6)}for(s=i.slice(),t[6]=s[2]&s[4],t[7]=s[3]&s[5],o=0;o<160;o+=8)for(h=0;h<8;h+=2){const e=h>0?8-h:0,n=[0,0,0,0];ve(n,0,ge[o+h+1],a[o+h+1],s[9+e]&s[2===h?9:11+e]^~s[9+e]&s[6===h?15:13-h],(s[9+e]>>>14|s[8+e]<<18)^(s[9+e]>>>18|s[8+e]<<14)^(s[8+e]>>>9|s[9+e]<<23),s[15-h],ge[o+h],a[o+h],s[8+e]&s[2===h?8:10+e]^~s[8+e]&s[6===h?14:12-h],(s[8+e]>>>14|s[9+e]<<18)^(s[8+e]>>>18|s[9+e]<<14)^(s[9+e]>>>9|s[8+e]<<23),s[14-h]),ve(n,2,(t[h+1]=s[1+e]&s[2===h?1:3+e])^s[1+e]&s[(6===h?h:4-h)+1]^t[7-e],(s[1+e]>>>28|s[e]<<4)^(s[e]>>>2|s[1+e]<<30)^(s[e]>>>7|s[1+e]<<25),(t[h]=s[e]&s[2===h?0:2+e])^s[e]&s[6===h?h:4-h]^t[6-e],(s[e]>>>28|s[1+e]<<4)^(s[1+e]>>>2|s[e]<<30)^(s[1+e]>>>7|s[e]<<25)),ve(s,14-h,s[7-h],n[1],s[6-h],n[0]),ve(s,6-h,n[3],n[1],n[2],n[0])}for(o=0;o<16;o+=2)ve(i,o,i[o+1],s[o+1],i[o],s[o])}while(c)}else{for(d=63&r,g=r<<3,f=r>>29,o=0;o+63<r;o+=64){for(h=m;h<64;h++)a[h]=n.charCodeAt(p++);Ce(i,a),m=0}for(o=0;o<d;o++)a[o]=n.charCodeAt(p++);for(m=g>>3&63,a[m++]=128,o=m;o<(m>56?64:56);o++)a[o]=0;if(m>56)for(Ce(i,a),o=0;o<56;o++)a[o]=0;for(;o<64;)for(h=24;h>=0;h-=8,o++)a[o]=(o>=60?g:f)>>>h&255;Ce(i,a)}for(o=0;o<(512===s?16:384===s?12:256===s?8:7);o++)for(h=28;h>=0;h-=4)u+="0123456789abcdef".charAt(i[o]>>>h&15);return u}function Se(t){return ke(t,!1,224)}function xe(t){return ke(t,!1,256)}function we(t){return ke(t,!0,384)}function Me(t){return ke(t,!0,512)}function Te(t){return ke(t,!0,224)}function Ie(t){return ke(t,!0,256)}const Ee={},Pe={},Fe={},Ae={},Oe={},Le={};function Re(t){const e=Pe[t];return e||(Pe[t]=xe(t))}var He,Be,Ve,Ne=Object.freeze({__proto__:null,SHA2_224:Se,SHA2_256:xe,SHA2_384:we,SHA2_512:Me,SHA2_512_224:Te,SHA2_512_256:Ie,CSHA2_224:function(t){const e=Ee[t];return e||(Ee[t]=Se(t))},CSHA2_256:Re,CSHA2_384:function(t){const e=Fe[t];return e||(Fe[t]=we(t))},CSHA2_512:function(t){const e=Ae[t];return e||(Ae[t]=Me(t))},CSHA2_512_224:function(t){const e=Oe[t];return e||(Oe[t]=Te(t))},CSHA2_512_256:function(t){const e=Le[t];return e||(Le[t]=Ie(t))}});class De extends se{constructor(t){super(),this.m_nIndex=-1,this.m_nColumn=-1,this.m_nRow=-1,this.m_bPopped=!0,this.m_nUniqueId=De.enumerator.n,this.m_pMatrix=t}static pushToMatrix(t,e){return(e=e||t.parent)&&e.pushToMatrix(t,{index:-1,recalculate:!0,emit:"push"}),t}get parent(){return this.matrix()}get uniqueId(){return this.m_nUniqueId}get hash(){return this.m_sHash||(this.m_sHash=xe(`${f.now}${Math.random()}.${this.uniqueId}`))}set hash(t){w(t)&&/[A-Fa-f0-9]{64}/.test(t)&&(this.m_sHash=t)}get index(){return this.m_nIndex}set index(t){this.moveToIndex(t)}get columnIndex(){return this.m_nColumn}get rowIndex(){return this.m_nRow}get isPopped(){return this.m_bPopped}get isFirst(){return!!this.m_pMatrix&&(0===this.m_pMatrix.orientation?0===this.rowIndex:0===this.columnIndex)}get isLast(){return!!this.m_pMatrix&&(this.isLastOfMatrix||(0===this.m_pMatrix.orientation?this.rowIndex===this.m_pMatrix.rows-1:this.columnIndex===this.m_pMatrix.columns-1))}get isFirstColumn(){return 0===this.columnIndex}get isLastColumn(){return!!this.m_pMatrix&&(this.isLastOfMatrix||this.columnIndex===this.m_pMatrix.columns-1)}get isFirstRow(){return 0===this.rowIndex}get isLastRow(){return!!this.m_pMatrix&&(this.isLastOfMatrix||this.rowIndex===this.m_pMatrix.rows-1)}get isFirstOfMatrix(){return 0===this.index}get isLastOfMatrix(){return!!this.m_pMatrix&&this.index===this.m_pMatrix.count-(this.m_bPopped?0:1)}get predecessorSibling(){return this.m_pMatrix&&!this.isFirstOfMatrix?this.m_pMatrix.itemAtIndex(this.index-1):void 0}get successorSibling(){return this.m_pMatrix&&!this.isLastOfMatrix?this.m_pMatrix.itemAtIndex(this.index+(this.m_bPopped?0:1)):void 0}get predecessorInColumn(){return this.m_pMatrix?this.m_pMatrix.itemAtPosition(this.m_nColumn,this.m_nRow-1):void 0}get successorInColumn(){return this.m_pMatrix?this.m_pMatrix.itemAtPosition(this.m_nColumn,this.m_nRow+1):void 0}get predecessorInRow(){return this.m_pMatrix?this.m_pMatrix.itemAtPosition(this.m_nColumn-1,this.m_nRow):void 0}get successorInRow(){return this.m_pMatrix?this.m_pMatrix.itemAtPosition(this.m_nColumn+1,this.m_nRow):void 0}matrix(){return this.m_pMatrix}onPush(t){this.emitHook("OnItemPush",t,"lifo")}onChange(t){this.emitHook("OnItemChange",t)}onPop(t){this.emitHook("OnItemPop",t)}dispatch(t,e){if("Pop"!==e)if("Detach"!==e)switch(e.hook){case"OnItemChange":t.push((()=>{this.onChange(e.payload)}));break;case"OnItemPop":t.push((()=>{this.onPop(e.payload)}))}else this.m_pMatrix=void 0;else this.m_bPopped=!0}reindex(t,e,s,n,i){const r=this.m_nColumn,a=this.m_nRow;let o,h=!1;if(this.m_pMatrix!==e&&(o=this.m_pMatrix,this.m_pMatrix=e,h=!0),this.m_nIndex===s&&"change"!==n&&"push"!==n||(0!==s&&0!==this.m_nIndex||(i|=128),s+1!==e.count&&this.m_nIndex+1!==e.count||(i|=64),this.m_nIndex=s,h=!0),this.m_nColumn=0===this.m_pMatrix.orientation?Math.floor(this.m_nIndex/this.m_pMatrix.rows):this.m_nIndex%this.m_pMatrix.columns,this.m_n