UNPKG

x4js

Version:

X4 framework

2 lines 145 kB
"use strict";(()=>{var to=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var ir=l=>{throw TypeError(l)};var on=(l,e,t)=>e in l?to(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t;var s=(l,e)=>to(l,"name",{value:e,configurable:!0});var p=(l,e,t,o)=>{for(var r=o>1?void 0:o?tn(e,t):e,n=l.length-1,i;n>=0;n--)(i=l[n])&&(r=(o?i(e,t,r):i(r))||r);return o&&r&&to(e,t,r),r};var O=(l,e,t)=>on(l,typeof e!="symbol"?e+"":e,t),sr=(l,e,t)=>e.has(l)||ir("Cannot "+t);var P=(l,e,t)=>(sr(l,e,"read from private field"),t?t.call(l):e.get(l)),oe=(l,e,t)=>e.has(l)?ir("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,t),re=(l,e,t,o)=>(sr(l,e,"write to private field"),o?o.call(l,t):e.set(l,t),t);var ar=Symbol("i18n"),ze={};function lr(l,e){ze[l]={name:l,base:e,src_translations:{},translations:{}}}s(lr,"createLanguage");function cr(l){return ze[l]!==void 0}s(cr,"isLanguage");function dr(l,...e){if(!cr(l))return;let t=ze[l];e.forEach(o=>{hr(t.src_translations,o)}),t.translations=pr(t.src_translations,t.base,!0)}s(dr,"addTranslation");function hr(l,e){for(let t in e){let o=e[t];typeof o=="string"?l[t]=o:Array.isArray(o)&&(!l[t]||!Array.isArray(l[t]))?l[t]=[...o]:!l[t]||typeof l[t]!="object"?l[t]={...o}:hr(l[t],e[t])}}s(hr,"_patch");function pr(l,e,t){let o={};for(let r in l)typeof l[r]!="string"&&!Array.isArray(l[r])?o[r]=pr(l[r],e,!1):o[r]=l[r];return rn(o,e,t)}s(pr,"_proxyfy");function rn(l,e,t){return new Proxy(l,{get:s((o,r)=>{t?Tt=[r]:Tt.push(r);let n=o[r];return n===void 0&&(e&&(n=nn(e)),n===void 0&&console.error("I18N error: unable to find","_tr."+Tt.join("."))),n},"get")})}s(rn,"_mk_proxy");var Tt;function nn(l){for(;l;){let e=ze[l],t=e.translations,o;for(let r of Tt){if(o=t[r],o===void 0)break;t=o}if(o!==void 0)return t;l=e.base}}s(nn,"_findBaseTrans");var y={};function sn(l){if(cr(l))return y=ze[l].translations,y[ar]=l,y}s(sn,"selectLanguage");function ti(){return y[ar]}s(ti,"getCurrentLanguage");function oi(){return Object.keys(ze)}s(oi,"getAvailableLanguages");var an={global:{ok:"OK",cancel:"Annuler",ignore:"Ignorer",yes:"Oui",no:"Non",abort:"Abandonner",retry:"Réessayer",error:"Erreur",today:"Aujourd'hui",open:"Ouvrir",new:"Nouveau",delete:"Supprimer",close:"Fermer",save:"Enregistrer",search:"Rechercher",search_tip:"Saisissez le texte à rechercher. <b>Enter</b> pour lancer la recherche. <b>Esc</b> pour annuler.",required_field:"information requise",invalid_format:"format invalide",invalid_email:"adresse mail invalide",invalid_number:"valeur numérique invalide",diff_date_seconds:"{0} secondes",diff_date_minutes:"{0} minutes",diff_date_hours:"{0} heures",invalid_date:"Date non reconnue ({0})",empty_list:"Liste vide",date_input_formats:"d/m/y|d.m.y|d m y|d-m-y|dmy",date_format:"D/M/Y",day_short:["dim","lun","mar","mer","jeu","ven","sam"],day_long:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],month_short:["jan","fév","mar","avr","mai","jun","jui","aoû","sep","oct","nov","déc"],month_long:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],property:"Propriété",value:"Valeur",err_403:"Vous n'avez pas les droits suffisants pour effectuer cette action",copy:"Copier",cut:"Couper",paste:"Coller",filedrop:"Déposez un fichier",keyboard:{next:"Suivant",numeric:"123",alpha:"Abc"}}},ln={global:{ok:"OK",cancel:"Cancel",ignore:"Ignore",yes:"Yes",no:"No",abort:"Abort",retry:"Retry",error:"Error",today:"Today",open:"Open",new:"New",delete:"Delete",close:"Close",save:"Save",search:"Search",search_tip:"Type in the text to search. <b>Enter</b> to start the search. <b>Esc</b> to cancel.",required_field:"missing information",invalid_format:"invalid format",invalid_email:"invalid email address",invalid_number:"bad numeric value",diff_date_seconds:"{0} seconds",diff_date_minutes:"{0} minutes",diff_date_hours:"{0} hours",invalid_date:"Unrecognized date({0})",empty_list:"Empty list",date_input_formats:"m/d/y|m.d.y|m d y|m-d-y|mdy",date_format:"M/D/Y",day_short:["sun","mon","tue","wed","thu","fri","sat"],day_long:["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],month_short:["jan","feb","mar","apr","may","jun","jui","aug","sep","oct","nov","dec"],month_long:["january","february","march","april","mau","june","jully","august","september","october","november","december"],property:"Property",value:"Value",err_403:"You do not have sufficient rights to do that action",copy:"Copy",cut:"Cut",paste:"Paste",filedrop:"Drop a file",keyboard:{next:"Next",numeric:"123",alpha:"Abc"}}};lr("fr",null);dr("fr",an);lr("en","fr");dr("en",ln);sn("fr");function D(l){return typeof l=="string"}s(D,"isString");function V(l){return typeof l=="number"&&isFinite(l)}s(V,"isNumber");function X(l){return l instanceof Array}s(X,"isArray");function mr(l){return l instanceof Function}s(mr,"isFunction");var io=class io extends String{constructor(e){super(e)}};s(io,"UnsafeHtml");var Oe=io;function vt(l){return new Oe(l)}s(vt,"unsafeHtml");function si(l,...e){let t=l.reduce((o,r,n)=>o+r+(e[n]||""),"");return vt(t)}s(si,"unsafe");function G(l,e,t){return l<e?e:l>t?t:l}s(G,"clamp");var St=class St{left;top;height;width;constructor(e,t,o,r){e!==void 0&&(V(e)?(this.left=e,this.top=t,this.width=o,this.height=r):Object.assign(this,e))}get right(){return this.left+this.width}get bottom(){return this.top+this.height}contains(e){return e instanceof St?e.left>=this.left&&e.right<=this.right&&e.top>=this.top&&e.bottom<=this.bottom:e.x>=this.left&&e.x<this.right&&e.y>=this.top&&e.y<this.bottom}touches(e){return!(this.left>e.right||this.right<e.left||this.top>e.bottom||this.bottom<e.top)}normalize(){let e=this.width,t=this.height;return e<0&&(this.left+=e,this.width=-e),t<0&&(this.top+=t,this.height=-t),this}};s(St,"Rect");var Ve=St;function ai(l,e,t=0){let o=e.width-2*t,r=e.height-2*t,n=l.width/l.height,i=o,a=o/n;a>r&&(a=r,i=r*n);let c=e.left+(e.width-i)/2,h=e.top+(e.height-a)/2;return{left:c,top:h,width:i,height:a}}s(ai,"centerRect");function Lt(l){switch(l){case"eyedropper":return"EyeDropper"in window}return!1}s(Lt,"isFeatureAvailable");var so=class so{_timers;setTimeout(e,t,o){this._timers?this.clearTimeout(e):this._timers=new Map;let r=setTimeout(o,t);return this._timers.set(e,r),r}clearTimeout(e){this._timers&&this._timers.has(e)&&(clearTimeout(this._timers.get(e)),this._timers.delete(e))}setInterval(e,t,o){this._timers?this.clearInterval(e):this._timers=new Map;let r=setInterval(o,t);return this._timers.set(e,r),r}clearInterval(e){this._timers&&this._timers.has(e)&&(clearInterval(this._timers.get(e)),this._timers.delete(e))}clearAllTimeouts(){var e;(e=this._timers)==null||e.forEach(t=>{clearTimeout(t)}),this._timers=null}};s(so,"Timer");var He=so;function ne(l){return requestAnimationFrame(l)}s(ne,"asap");function li(l,e=0){return setTimeout(l,e)}s(li,"oneshot");function de(l,e,t="0"){let o;return D(l)?o=l:o=""+l,e>0?o.padEnd(e,t):o.padStart(-e,t)}s(de,"pad");function oo(l,...e){return l.replace(/{(\d+)}/g,function(t,o){return typeof e[o]<"u"?e[o]:t})}s(oo,"sprintf");function ci(l){let e=l;return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.toLowerCase(),e=e.replace(/[^- a-z0-9]+/g," "),e.indexOf(" ")<0?e:(e=e.trim(),e.replace(/ /g,"-"))}s(ci,"pascalCase");function di(l){let e=l.toLowerCase();return e=e.replace(/[^a-zA-Z0-9]+(.)/g,(t,o)=>o.toUpperCase()),e}s(di,"camelCase");var cn="fr-FR";function hi(l){cn=l}s(hi,"_date_set_locale");function pi(l,e){return Z(l)}s(pi,"date_format");function ui(l,e,t){let r=(l.getTime()-e.getTime())/1e3;if(r<60)return oo(y.global.diff_date_seconds,Math.round(r));let n=Math.floor(r/60);if(n<60)return oo(y.global.diff_date_minutes,Math.round(n));let i=Math.floor(n/60);return oo(y.global.diff_date_hours,i,n%60)}s(ui,"date_diff");function mi(l,e){return e?Z(l,"Y-M-D H:I:S"):Z(l,"Y-M-D")}s(mi,"date_to_sql");function fi(l){return new Date(l+" GMT")}s(fi,"date_sql_utc");function _e(l){return l.getFullYear()<<16|l.getMonth()<<8|l.getDate()}s(_e,"date_hash");function Ne(l){return new Date(l.getTime())}s(Ne,"date_clone");function ur(l){let e=new Date(l.getFullYear(),0,1),t=(l.valueOf()-e.valueOf())/864e5;return Math.floor((t+e.getDay()+1)/7)}s(ur,"date_calc_weeknum");function gi(l,e=y.global.date_input_formats){var o,r,n,i,a,c;let t=e.split("|");for(let h of t){let g="";for(let x=0;x<h.length;x++){let v=h[x];v=="d"?g+="(?<day>\\d{1,2})":v=="D"?g+="(?<day>\\d{2})":v=="m"?g+="(?<month>\\d{1,2})":v=="M"?g+="(?<month>\\d{2})":v=="y"?g+="(?<year>\\d{1,4})":v=="Y"?h[x+1]=="Y"?(g+="(?<year>\\d{4})",x++):g+="(?<year>\\d{2})":v=="h"?g+="(?<hour>\\d{1,2})":v=="H"?g+="(?<hour>\\d{2})":v=="i"?g+="(?<min>\\d{1,2})":v=="I"?g+="(?<min>\\d{2})":v=="s"?g+="(?<sec>\\d{1,2})":v=="S"?g+="(?<sec>\\d{2})":v==" "?g+="\\s+":g+="\\s*\\"+v+"\\s*"}let m=new RegExp("^"+g+"$","m").exec(l);if(m){let x=new Date,v=parseInt((o=m.groups.day)!=null?o:"1"),N=parseInt((r=m.groups.month)!=null?r:"1"),w=parseInt((n=m.groups.year)!=null?n:x.getFullYear()+""),T=parseInt((i=m.groups.hour)!=null?i:"0"),Q=parseInt((a=m.groups.min)!=null?a:"0"),B=parseInt((c=m.groups.sec)!=null?c:"0");w>0&&w<100&&(w+=2e3);let S=new Date(w,N-1,v,T,Q,B,0),ce=S.getFullYear(),Be=S.getMonth()+1,L=S.getDate();return ce!=w||Be!=N||L!=v?null:S}}return null}s(gi,"parseIntlDate");function Z(l,e=y.global.date_format){if(!l)return"";let t={year:l.getFullYear(),month:l.getMonth()+1,day:l.getDate(),wday:l.getDay(),hours:l.getHours(),minutes:l.getMinutes(),seconds:l.getSeconds(),milli:l.getMilliseconds()},o="",r=0;for(let n of e){if(n=="{"){if(++r==1)continue}else if(n=="}"&&--r==0)continue;if(r){o+=n;continue}n=="d"?o+=t.day:n=="D"?o+=de(t.day,-2):n=="j"?o+=y.global.day_short[t.wday]:n=="J"?o+=y.global.day_long[t.wday]:n=="w"?o+=ur(l):n=="W"?o+=de(ur(l),-2):n=="m"?o+=t.month:n=="M"?o+=de(t.month,-2):n=="o"?o+=y.global.month_short[t.month-1]:n=="O"?o+=y.global.month_long[t.month-1]:n=="y"||n=="Y"?o+=de(t.year,-4):n=="a"||n=="A"?o+=t.hours<12?"am":"pm":n=="h"?o+=t.hours:n=="H"?o+=de(t.hours,-2):n=="i"?o+=t.minutes:n=="I"?o+=de(t.minutes,-2):n=="s"?o+=t.seconds:n=="S"?o+=de(t.seconds,-2):n=="l"?o+=t.milli:n=="L"?o+=de(t.milli,-3):o+=n}return o}s(Z,"formatIntlDate");function xi(l,e){if(e===void 0&&(e=new Date),!l)return 0;let t=e.getFullYear()-l.getFullYear();return(e.getMonth()<l.getMonth()||e.getMonth()==l.getMonth()&&e.getDate()<l.getDate())&&t--,t}s(xi,"calcAge");function bi(){new Audio("data:audio/wav;base64,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qJrx4KOQjahZxWbcZgztj2c49nKmkId44S71j0c8eV9yDK6uPRzx5X18eDvjvQ6yKo9ZSS6l//8elePK/Lf//IInrOF/FvDoADYAGBMGb7FtErm5MXMlmPAJQVgWta7Zx2go+8xJ0UiCb8LHHdftWyLJE0QIAIsI+UbXu67dZMjmgDGCGl1H+vpF4NSDckSIkk7Vd+sxEhBQMRU8j/12UIRhzSaUdQ+rQU5kGeFxm+hb1oh6pWWmv3uvmReDl0UnvtapVaIzo1jZbf/pD6ElLqSX+rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=").play()}s(bi,"beep");var ro=-1;function vi(){if(ro<0){let l=document.createElement("div");l.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px";let e=document.createElement("div");e.style.width="200px",e.style.height="200px",l.appendChild(e),document.body.appendChild(l),ro=l.offsetWidth-l.clientWidth,document.body.removeChild(l)}return ro}s(vi,"getScrollbarSize");var Rt=Symbol("class-ns");function u(l){return function(e){e[Rt]=l}}s(u,"class_ns");function no(l){document.body.style.cursor=l?"wait":"default"}s(no,"setWaitCursor");function Ft(l){let e=['button:not([tabindex="-1"]):not([disabled])',"[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'];return Array.from(l.querySelectorAll(e.join(","))).filter(o=>o.offsetParent!=null)}s(Ft,"getFocusableElements");var Bt=(i=>(i[i.first=0]="first",i[i.prev=1]="prev",i[i.pgdn=2]="pgdn",i[i.pgup=3]="pgup",i[i.next=4]="next",i[i.last=5]="last",i))(Bt||{});var dn=s(function(){this.propagationStopped=!0},"stopPropagation"),hn=s(function(){this.defaultPrevented=!0},"preventDefault"),ao=class ao{_source;_registry;constructor(e=null){this._source=e!=null?e:this}addListener(e,t,o=!1){this._registry||(this._registry=new Map);let r=this._registry.get(e);r||(r=[],this._registry.set(e,r));let n=t;return r.indexOf(n)==-1&&(o?r.unshift(n):r.push(n)),()=>{this.removeListener(e,t)}}removeListener(e,t){if(!this._registry)return;let o=this._registry.get(e);if(!o)return;let r=t,n=o.indexOf(r);n!==-1&&o.splice(n,1)}fire(e,t){var r;let o=(r=this._registry)==null?void 0:r.get(e);if(o&&o.length){let n=t;if(n||(n={}),n.source||(n.source=this._source),n.type||(n.type=e),n.preventDefault||(n.preventDefault=hn),n.stopPropagation||(n.stopPropagation=dn),o.length==1)o[0](n);else{let i=o.slice();for(let a=0,c=i.length;a<c&&(i[a](n),!n.propagationStopped);a++);}}}};s(ao,"EventSource");var he=ao;var W,J,lo=class lo{constructor(){oe(this,W);oe(this,J)}__startTimer(e,t,o,r){P(this,J)?this.__stopTimer(e):re(this,J,new Map);let n=(o?setInterval:setTimeout)(r,t);P(this,J).set(e,()=>{(o?clearInterval:clearTimeout)(n),P(this,J).delete(e)})}__stopTimer(e){var o;let t=(o=P(this,J))==null?void 0:o.get(e);t&&t()}setTimeout(e,t,o){this.__startTimer(e,t,!1,o)}clearTimeout(e){this.__stopTimer(e)}setInterval(e,t,o){this.__startTimer(e,t,!0,o)}clearInterval(e){this.__stopTimer(e)}clearTimeouts(){for(let[e,t]of P(this,J))t();P(this,J).clear()}on(e,t){return console.assert(t!=null),P(this,W)||re(this,W,new he(this)),P(this,W).addListener(e,t),{off:s(()=>{P(this,W).removeListener(e,t)},"off")}}off(e,t){console.assert(t!=null),P(this,W)&&P(this,W).removeListener(e,t)}fire(e,t){P(this,W)&&P(this,W).fire(e,t)}};W=new WeakMap,J=new WeakMap,s(lo,"CoreElement");var ie=lo;var zt={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function xr(l){return!!zt[l]}s(xr,"isUnitLess");var pe=class pe{m_sheet;m_rules=new Map;constructor(){function e(t){for(let o=0;o<document.styleSheets.length;o++){let r=document.styleSheets[o];if(r.title===t)return r}}if(s(e,"getStyleSheet"),this.m_sheet=e("x4-dynamic-css"),!this.m_sheet){let t=document.createElement("style");t.setAttribute("id","x4-dynamic-css"),document.head.appendChild(t),this.m_sheet=t.sheet}}setRule(e,t){if(D(t)){let o=this.m_rules.get(e);o!==void 0?this.m_sheet.deleteRule(o):o=this.m_sheet.cssRules.length,this.m_rules.set(e,this.m_sheet.insertRule(t,o))}else{let o=1;for(let r in t){let n=r+" { ",i=t[r];for(let a in i){let c=i[a];for(let h=0;h<c.length;h++)n+=a+": "+c[h]+"; "}n+="}",this.setRule(e+"--"+o,n),o++}}}static getVar(e){return pe.doc_style||(pe.doc_style=getComputedStyle(document.documentElement)),e.startsWith("--")||(e="--"+e),pe.doc_style.getPropertyValue(e)}};s(pe,"Stylesheet"),O(pe,"guid",1),O(pe,"doc_style");var fr=pe,co=class co{m_style;constructor(e){this.m_style=e}value(e){return this.m_style[e]}parse(e){return parseInt(this.m_style[e])}get style(){return this.m_style}};s(co,"ComputedStyle");var gr=co;var pn={mouseleave:1,mouseenter:1,load:1,unload:1,scroll:1,focus:1,blur:1,rowexit:1,beforeunload:1,stop:1,dragdrop:1,dragenter:1,dragexit:1,draggesture:1,dragover:1,contextmenu:1,created:2,removed:2,sizechange:2},Ot=new WeakMap,ho=null,un=s((l,e)=>{let t=s((r,n)=>{let i=Ot.get(r);i&&i[n]&&r.dispatchEvent(new Event(n,{}))},"sendEvent"),o=s((r,n)=>{n&&t(r,"created");for(let i=r.firstChild;i;i=i.nextSibling)o(i,n);n||t(r,"removed")},"notify");for(let r of l)r.type=="childList"&&(r.addedNodes&&r.addedNodes.forEach(n=>{o(n,!0)}),r.removedNodes&&r.removedNodes.forEach(n=>{o(n,!1)}))},"observeMutation"),po=null;function mn(l){l.forEach(e=>{let t=e.target;t.offsetParent!==null&&t.dispatchEvent(new Event("resized"))})}s(mn,"observeSize");function fn(l){let e=l.target,t=pn[l.type]===2;for(;e;){let o=Ot.get(e);if(o){let r=o[l.type];if(r&&(Array.isArray(r)?r.some(n=>n(l)):r(l),l.stopPropagation||l.defaultPrevented||t))break}if(e=e.parentNode,e==document)break}}s(fn,"dispatchEvent");function Vt(l,e,t,o=!1){e=="removed"||e=="created"?ho||(ho=new MutationObserver(un),ho.observe(document.body,{childList:!0,subtree:!0})):e=="resized"&&(po||(po=new ResizeObserver(mn)),po.observe(l));let r=Ot.get(l);if(r||(r={},Ot.set(l,r)),!r[e])r[e]=t,l.addEventListener(e,fn);else{let n=r[e];Array.isArray(n)?n.push(t):r[e]=[n,t]}}s(Vt,"addEvent");var br=Symbol("fragment"),vr=Symbol("component"),gn=/^-?\d+(\.\d*)?$/;function xn(l){let e=[],t=Object.getPrototypeOf(l);if(t.constructor==d)return["x4-comp"];for(;t&&t.constructor!==d;){let o=t.constructor.name,r=Object.prototype.hasOwnProperty.call(t.constructor,Rt)?t.constructor[Rt]:"";e.push(r+o.toLowerCase()),t=Object.getPrototypeOf(t)}return e}s(xn,"genClassNames");var bn=1e3,q=s(()=>`x4-${bn++}`,"makeUniqueComponentId"),we,d=class extends ie{constructor(t){var o,r;super();O(this,"dom");O(this,"props");O(this,"clsprefix");oe(this,we);if(this.props=t,t.existingDOM)this.dom=t.existingDOM;else{t.ns?this.dom=document.createElementNS(t.ns,(o=t.tag)!=null?o:"div"):this.dom=document.createElement((r=t.tag)!=null?r:"div"),t.attrs&&this.setAttributes(t.attrs),t.cls&&this.addClass(t.cls),t.hidden&&this.show(!1),t.flex===!0?this.addClass("x4flex"):t.flex!==void 0&&this.setStyle({flexGrow:t.flex+""}),t.id!==void 0&&this.setAttribute("id",t.id),t.width!==void 0&&this.setStyleValue("width",t.width),t.height!==void 0&&this.setStyleValue("height",t.height),t.tooltip&&this.setAttribute("tooltip",t.tooltip),t.style&&this.setStyle(t.style),t.content&&this.setContent(t.content),t.dom_events&&this.setDOMEvents(t.dom_events);let n=xn(this);this.dom.classList.add(...n),t.disabled&&this.addDOMEvent("created",()=>{this.enable(!1)})}this.dom[vr]=this}hasClass(t){return this.dom.classList.contains(t)}addClass(t){if(t)if(t.indexOf(" ")>=0){t=t.trim();let o=t.split(" ");this.dom.classList.add(...o)}else this.dom.classList.add(t)}removeClass(t){if(t){if(t=="*"){this.dom.classList.value="";return}if(t.indexOf(" ")>=0){let o=t.split(" ");this.dom.classList.remove(...o)}else this.dom.classList.remove(t)}}removeClassEx(t){Array.from(this.dom.classList).forEach(r=>{r.match(t)&&this.dom.classList.remove(r)})}toggleClass(t){if(!t)return;let o=s(r=>{this.dom.classList.toggle(r)},"toggle");t.indexOf(" ")>=0?t.split(" ").forEach(o):o(t)}setClass(t,o=!0){return o?this.addClass(t):this.removeClass(t),this}setAttributes(t){for(let o in t)this.setAttribute(o,t[o]);return this}setAttribute(t,o){o==null?this.dom.removeAttribute(t):this.dom.setAttribute(t,""+o)}getAttribute(t){return this.dom.getAttribute(t)}getData(t){return this.getAttribute("data-"+t)}getIntData(t){let o=parseInt(this.getAttribute("data-"+t));if(Number.isFinite(o))return o}setData(t,o){return this.setAttribute("data-"+t,o)}setInternalData(t,o){return P(this,we)||re(this,we,new Map),P(this,we).set(t,o),this}getInternalData(t){var o;return(o=P(this,we))==null?void 0:o.get(t)}addDOMEvent(t,o,r=!1){Vt(this.dom,t,o,r)}setDOMEvents(t){for(let o in t)this.addDOMEvent(o,t[o])}mapPropEvents(t,...o){let r=t;o.forEach(n=>{Object.prototype.hasOwnProperty.call(r,n)&&r[n]&&this.on(n,r[n])})}clearContent(){let t=this.dom;for(;t.firstChild;)t.removeChild(t.firstChild)}setContent(t){this.clearContent(),this.appendContent(t)}appendContent(t){let o=s((r,n)=>{if(n instanceof d)r.appendChild(n.dom);else if(n instanceof Oe)r.insertAdjacentHTML("beforeend",n.toString());else if(typeof n=="string"||typeof n=="number"){let i=document.createTextNode(n.toString());r.appendChild(i)}else n&&console.warn("Unknown type to append: ",n)},"set");if(!X(t))o(this.dom,t);else if(t.length<=8)for(let r of t)o(this.dom,r);else{let r=document.createDocumentFragment();for(let n of t)o(r,n);this.dom.appendChild(r)}}prependContent(t){let o=this.dom,r=s(n=>{n instanceof d?o.insertAdjacentElement("afterbegin",n.dom):n instanceof Oe?o.insertAdjacentHTML("afterbegin",n.toString()):typeof n=="string"||typeof n=="number"?o.insertAdjacentText("afterbegin",n.toString()):console.warn("Unknown type to append: ",n)},"set");if(!X(t))r(t);else{let n=document.createDocumentFragment();for(let i of t)r(i);o.insertBefore(o.firstChild,n)}}removeChild(t){this.dom.removeChild(t.dom)}queryAll(t){let o=this.dom.querySelectorAll(t),r=new Array(o.length);return o.forEach((n,i)=>r[i]=uo(n)),r}query(t){let o=this.dom.querySelector(t);return R(o)}setAria(t,o){return this.setAttribute(t,o),this}setStyle(t){let o=this.dom.style;for(let r in t){let n=t[r];!zt[r]&&(V(n)||gn.test(n))&&(n+="px"),o[r]=n}return this}setStyleValue(t,o){let r=this.dom.style;if(V(o)){let n=o+"";zt[t]||(n+="px"),r[t]=n}else r[t]=o;return this}getStyleValue(t){return this.dom.style[t]}setWidth(t){this.setStyleValue("width",V(t)?t+"px":t)}setHeight(t){this.setStyleValue("height",V(t)?t+"px":t)}setStyleVariable(t,o){this.dom.style.setProperty(t,o)}getStyleVariable(t){return this.getComputedStyle().getPropertyValue(t)}getComputedStyle(){return getComputedStyle(this.dom)}setCapture(t){this.dom.setPointerCapture(t)}releaseCapture(t){this.dom.releasePointerCapture(t)}getBoundingRect(){let t=this.dom.getBoundingClientRect();return new Ve(t.x,t.y,t.width,t.height)}focus(){return this.dom.focus(),this}hasFocus(){return document.activeElement==this.dom}scrollIntoView(t){this.dom.scrollIntoView(t)}isVisible(){return this.dom.offsetParent!==null}show(t=!0){return this.setClass("x4hidden",!t),this}hide(){return this.show(!1),this}enable(t=!0){return this.setAttribute("disabled",t?null:"true"),(this.dom instanceof HTMLInputElement||this.dom instanceof HTMLButtonElement)&&(this.dom.disabled=!t),this.enumChildNodes(!0).forEach(r=>{(r instanceof HTMLInputElement||r instanceof HTMLButtonElement)&&(r.disabled=!t)}),this}disable(){return this.enable(!1),this}isDisabled(){return this.getAttribute("disabled")}nextElement(){let t=this.dom.nextElementSibling;return R(t)}prevElement(){let t=this.dom.previousElementSibling;return R(t)}parentElement(t){return d.parentElement(this.dom,t)}static parentElement(t,o){for(;t.parentElement;){let r=R(t.parentElement);if(!o||r&&r instanceof o)return r;t=t.parentElement}return null}firstChild(){let t=this.dom.firstElementChild;return R(t)}lastChild(){let t=this.dom.lastElementChild;return R(t)}enumChildComponents(t){let o=[];return this.enumChildNodes(t).forEach(n=>{let i=R(n);i&&o.push(i)}),o}enumChildNodes(t){return Array.from(t?this.dom.querySelectorAll("*"):this.dom.children)}animate(t,o){this.dom.animate(t,o)}static createElement(t,o,...r){let n;return t==this.createFragment||t===br?r:(t instanceof Function?(o=o!=null?o:{},!o.children&&r&&r.length&&(o.content=r),n=new t(o!=null?o:{})):n=new d({tag:t,content:r,...o}),r&&r.length,n)}static createFragment(){return this.createElement(br,null)}queryInterface(t){return null}};we=new WeakMap,s(d,"Component"),d=p([u("x4")],d);function R(l){return l?l[vr]:null}s(R,"componentFromDOM");function uo(l){let e=R(l);return e||new d({existingDOM:l})}s(uo,"wrapDOM");var mo=class mo extends d{constructor(){super({})}};s(mo,"Flex");var se=mo,fo=class fo extends d{constructor(e,t){super({width:e,cls:t})}};s(fo,"Space");var Ht=fo;var _r=Symbol("socket"),go=null,bo=class bo{getMaxTouchPoints(){return navigator.maxTouchPoints}};s(bo,"Process");var xo=bo,_t=class _t extends ie{env=new Map;mainview;constructor(){super(),console.assert(go==null,"Application must be a singleton."),go=this}setMainView(e){this.mainview=e,document.body.appendChild(e.dom),this._setupKeyboard()}static instance(){return go}getMainView(){return this.mainview}setEnv(e,t){this.env.set(e,t)}getEnv(e,t){var o;return(o=this.env.get(e))!=null?o:t}static fireGlobal(e,t){_t.instance().fire("global",{msg:e,params:t})}_setupKeyboard(){document.addEventListener("keydown",e=>{(e.key=="Tab"||e.key=="Enter")&&this.focusNext(!e.shiftKey)&&e.preventDefault()})}focusNext(e){let t=document.activeElement,o;for(;t!=document.body;){let n=R(t).queryInterface("tab-handler");if(n)return n.focusNext(e);t.classList.contains("x4box")&&(o=t),t=t.parentElement}if(o){let r=Ft(o);if(r.length){let n=r[0],i=r[r.length-1],a;if(!e&&document.activeElement===n?a=i:e&&document.activeElement===i&&(a=n),a)return a.focus(),!0}else return!0}return!1}setupSocketMessaging(e,t){let o=window.location.protocol==="https:"?"wss://":"ws://",r=e?o+e:`${o}${window.location.hostname}:${window.location.port}/ws`,n=0,i=null;this.on("global",a=>{Object.prototype.hasOwnProperty.call(a,_r)||i&&i.send(JSON.stringify({msg:a.msg,params:a.params}))}),i=new WebSocket(r,"messaging"),i.onopen=()=>{console.log("websocket opened"),n=1},i.onmessage=a=>{if(a.data!="ping"){let c=JSON.parse(a.data);c[_r]=!0,this.fire("global",c)}},i.onclose=a=>{console.log("websocket closed:",a),i=null,n&&(t(),n=0)}}getStorage(e){return localStorage.getItem(e)}getStorageJSON(e){try{return JSON.parse(localStorage.getItem(e))}catch{return}}setStorage(e,t){localStorage.setItem(e,t+"")}setStorageJSON(e,t){localStorage.setItem(e,JSON.stringify(t))}};s(_t,"Application"),O(_t,"process",new xo);var Nt=_t;function ye(l){return l.toString(16).padStart(2,"0")}s(ye,"hx");function Ue(l){return Math.round(l)}s(Ue,"round");var vo=class vo{rgb=[0,0,0,1];invalid=!1;constructor(...e){D(e[0])?this.setValue(e[0]):this.setRgb(e[0],e[1],e[2],e[3])}setValue(e){if(this.invalid=!1,e.length==4&&/#[0-9a-fA-F]{3}/.test(e)){let t=parseInt(e[1],16),o=parseInt(e[2],16),r=parseInt(e[3],16);return this.setRgb(t<<4|t,o<<4|o,r<<4|r,1)}if(e.length==7&&/#[0-9a-fA-F]{6}/.test(e)){let t=parseInt(e[1],16),o=parseInt(e[2],16),r=parseInt(e[3],16),n=parseInt(e[4],16),i=parseInt(e[5],16),a=parseInt(e[6],16);return this.setRgb(t<<4|o,r<<4|n,i<<4|a,1)}if(e.length==9&&/#[0-9a-fA-F]{8}/.test(e)){let t=parseInt(e[1],16),o=parseInt(e[2],16),r=parseInt(e[3],16),n=parseInt(e[4],16),i=parseInt(e[5],16),a=parseInt(e[6],16),c=parseInt(e[7],16),h=parseInt(e[8],16);return this.setRgb(t<<4|o,r<<4|n,i<<4|a,(c<<4|h)/255)}if(e.startsWith("rgba")){let o=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*((\d+)|(\d*\.\d+)|(\.\d+))\s*\)/.exec(e);if(o)return this.setRgb(parseInt(o[1]),parseInt(o[2]),parseInt(o[3]),parseFloat(o[4]))}else if(e.startsWith("rgb")){let o=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(e);if(o)return this.setRgb(parseInt(o[1]),parseInt(o[2]),parseInt(o[3]),1)}else if(e.startsWith("var")){let o=/var\s*\(([^)]*)\)/.exec(e);if(o){let r=o[1].trim(),i=getComputedStyle(document.documentElement).getPropertyValue(r);return this.setValue(i)}}return this.invalid=!0,this.setRgb(255,0,0,1)}setHsv(e,t,o,r=1){let n=Math.min(5,Math.floor(e*6)),i=e*6-n,a=o*(1-t),c=o*(1-i*t),h=o*(1-(1-i)*t),g,f,m;switch(n){case 0:g=o,f=h,m=a;break;case 1:g=c,f=o,m=a;break;case 2:g=a,f=o,m=h;break;case 3:g=a,f=c,m=o;break;case 4:g=h,f=a,m=o;break;case 5:g=o,f=a,m=c;break}return this.setRgb(g*255,f*255,m*255,r)}setRgb(e,t,o,r){return this.rgb=[G(e|0,0,255),G(t|0,0,255),G(o|0,0,255),G(r,0,1)],this}toRgbString(e){let t=this.rgb;return e===!1||t[3]==1?`rgb(${Ue(t[0])},${Ue(t[1])},${Ue(t[2])})`:`rgba(${Ue(t[0])},${Ue(t[1])},${Ue(t[2])},${t[3].toFixed(3)})`}toHexString(){let e=this.rgb;return e[3]==1?`#${ye(e[0])}${ye(e[1])}${ye(e[2])}`:`#${ye(e[0])}${ye(e[1])}${ye(e[2])}${ye(e[3]*255|0)}`}toRgb(){let e=this.rgb;return{red:e[0],green:e[1],blue:e[2],alpha:e[3]}}toHsv(){let e=this.toRgb();e.red/=255,e.green/=255,e.blue/=255;let t=Math.max(e.red,e.green,e.blue),o=Math.min(e.red,e.green,e.blue),r=t-o,n=t===0?0:r/t,i=t,a;if(r===0)a=0;else switch(t){case e.red:a=(e.green-e.blue)/r/6+(e.green<e.blue?1:0);break;case e.green:a=(e.blue-e.red)/r/6+1/3;break;case e.blue:a=(e.red-e.green)/r/6+2/3;break}return{hue:a,saturation:n,value:i,alpha:e.alpha}}getAlpha(){return this.rgb[3]}setAlpha(e){return this.rgb[3]=G(e,0,1),this}isInvalid(){return this.invalid}};s(vo,"Color");var U=vo;var ko=class ko{name;id;fields;constructor(e){this.name=e,this.id=void 0,this.fields=[]}};s(ko,"MetaInfos");var _o=ko,Ut=Symbol("metaField");function qt(l,e=!0){let t=l.constructor,o=Object.prototype.hasOwnProperty.call(t,Ut)?t[Ut]:void 0;if(o===void 0){e||console.assert(o!==void 0),o=new _o(t.name);let r=Object.getPrototypeOf(t);if(r!=wo){let n=r[Ut];o.fields=[...n.fields,...o.fields],console.assert(o.id===void 0,"cannot define mutiple record id"),o.id||(o.id=n.id)}l.constructor[Ut]=o}return o}s(qt,"_getMetas");var wr;(g=>{function l(){return(f,m)=>{let x=qt(f);x.fields.push({name:m,type:"any",required:!0}),x.id=m}}g.id=l,s(l,"id");function e(f){return(m,x)=>{qt(m).fields.push({name:x,...f})}}g.field=e,s(e,"field");function t(f){return e({...f,type:"string"})}g.string=t,s(t,"string");function o(f){return e({...f,type:"int"})}g.int=o,s(o,"int");function r(f){return e({...f,type:"float"})}g.float=r,s(r,"float");function n(f){return e({...f,type:"bool"})}g.bool=n,s(n,"bool");function i(f){return e({...f,type:"date"})}g.date=i,s(i,"date");function a(f){return e({...f,type:"calc"})}g.calc=a,s(a,"calc");function c(f,m){return g.field({...m,type:"array",model:f?new f:null})}g.array=c,s(c,"array");function h(f){return e({...f,type:"any"})}g.any=h,s(h,"any")})(wr||(wr={}));var Co=class Co{getFields(){return qt(this,!1).fields}validate(e){let t=null;return this.getFields().forEach(r=>{r.required&&!this.getField(r.name,e)&&(t&&(t=[]),t.push(new Error(`field ${r.name} is required.`)))}),t}getFieldIndex(e){return this.getFields().findIndex(o=>o.name==e)}serialize(e){let t={};return this.getFields().forEach(o=>{o.calc===void 0&&(t[o.name]=e[o.name])}),t}unSerialize(e,t){let o=this.getFields(),r=new Kt;return o.forEach(n=>{let i=e[n.name];i!==void 0&&(r[n.name]=this._convertField(n,i))}),t!==void 0?r[o[0].name]=t:console.assert(this.getID(r)!==void 0),r}_convertField(e,t){switch(e.type){case"float":{let o=typeof t=="number"?t:parseFloat(t);if(e.prec!==void 0){let r=Math.pow(10,e.prec);o=Math.round(o*r)/r}return o}case"int":return typeof t=="number"?t:parseInt(t);case"date":return D(t)?new Date(t):t;case"array":{debugger;break}}return t}getID(e){if(!e)return null;let t=qt(this,!1);return e[t.id]}getRaw(e,t){let o,r=this.getFields();if(typeof e=="string"){if(o=r.findIndex(i=>i.name==e),o<0){console.assert(!1,"unknown field: "+e);return}}else if(e<r.length){if(e<0)return;o=e}else{console.assert(!1,"bad field name: "+e);return}let n=r[o];return n.calc!==void 0?n.calc(t):t[n.name]}getField(e,t){let o=this.getRaw(e,t);return o==null?"":""+o}};s(Co,"DataModel");var wo=Co,Eo=class Eo{};s(Eo,"DataRecord");var Kt=Eo,Io=class Io extends ie{m_props;constructor(e){super(),this.m_props=e}async load(e){e?this.m_props.url=e:e=this.m_props.url,this.m_props.params&&(e+="?"+this.m_props.params.join("&"));let t=await fetch(e);if(t.ok){let o=await t.json(),r=o;this.m_props.solver&&(r=this.m_props.solver(r)),this.fire("change",{value:r,context:o})}}};s(Io,"DataProxy");var yo=Io,Ao=class Ao extends he{m_model;m_fields;m_records;m_proxy;m_rec_index;constructor(e){super(),this.m_fields=void 0,this.m_records=[],this.m_rec_index=null,this.m_model=e.model,this.m_fields=e.model.getFields(),e.data?this.setRawData(e.data):e.url&&(this.m_proxy=new yo({url:e.url,solver:e.solver}),this.m_proxy.on("change",t=>{this.setData(t.value)}),e.autoload!=!1&&this.m_proxy.load())}async load(e){return this.m_proxy.load(e)}async reload(){return this.m_proxy.load()}setData(e){let t=new Array(e.length);e.forEach((o,r)=>{t[r]=this.m_model.unSerialize(o)}),this.setRawData(t)}setRawData(e){this.m_records=e,this._rebuildIndex(),this.fire("data_change",{change_type:"change"})}_rebuildIndex(){this.m_rec_index=null,this.m_rec_index=this.createIndex(null),this.m_rec_index=this.sortIndex(this.m_rec_index,null)}update(e){let t=this.m_model.getID(e),o=this.indexOfId(t);return o<0?!1:(this.m_records[this.m_rec_index[o]]=e,this.fire("data_change",{change_type:"update",id:t}),!0)}append(e){e instanceof Kt||(e=this.m_model.unSerialize(e));let t=this.m_model.getID(e);console.assert(t!==void 0),this.m_records.push(e),this._rebuildIndex(),this.fire("data_change",{change_type:"create",id:t})}getMaxId(){let e,t=this.m_model;return this.m_records.forEach(o=>{let r=t.getID(o);(e===void 0||e<r)&&(e=r)}),e}delete(e){let t=this.indexOfId(e);return t<0?!1:(t=this.m_rec_index[t],this.m_records.splice(t,1),this._rebuildIndex(),this.fire("data_change",{change_type:"delete",id:e}),!0)}get count(){return this.m_rec_index?this.m_rec_index.length:this.m_records.length}get fields(){return this.m_fields}indexOfId(e){let t=this.m_model;for(let o=this.count,r=0;o!=0;o>>=1){let n=r+(o>>1),i=this.m_rec_index[n],a=t.getID(this.m_records[i]);if(a==e)return n;a<e&&(r=n+1,o--)}return-1}getById(e){let t=this.indexOfId(e);return t<0?null:(t=this.m_rec_index[t],this.m_records[t])}getByIndex(e){let t=this.m_rec_index[e];return this._getRecord(t)}_getRecord(e){var t;return(t=this.m_records[e])!=null?t:null}moveTo(e){e.setRawData(this.m_records)}createView(e){let t={...e,store:this};return new wt(t)}createIndex(e){if(e&&e.op==="empty-result")return new Uint32Array(0);let t=new Uint32Array(this.m_records.length),o=0;if(!e)this.forEach((f,m)=>{t[o++]=m});else if(typeof e.op=="function"){let f=e.op;this.forEach((m,x)=>{m&&f(m)&&(t[o++]=x)})}else{let x=function(L){return L<m},v=function(L){return L<=m},N=function(L){return L==m},w=function(L){return L!=m},T=function(L){return L>=m},Q=function(L){return L>m},B=function(L){return ce.lastIndex=-1,ce.test(L)};var r=x,n=v,i=N,a=w,c=T,h=Q,g=B;s(x,"_lt"),s(v,"_le"),s(N,"_eq"),s(w,"_neq"),s(T,"_ge"),s(Q,"_gt"),s(B,"_re");let f=this.m_model.getFieldIndex(e.field);if(f<0)return console.assert(!1,"unknown field name in filter"),new Uint32Array(0);let m=e.value;D(m)&&!e.caseSensitive&&(m=m.toUpperCase());let S,ce;if(m instanceof RegExp)ce=m,S=B;else switch(e.op){case"<":{S=x;break}case"<=":{S=v;break}case"=":{S=N;break}case">=":{S=T;break}case">":{S=Q;break}case"<>":{S=w;break}}let Be=this.m_model;this.forEach((L,Dt)=>{if(!L)return;let $=Be.getRaw(f,L);$==null?$="":($=""+$,e.caseSensitive||($=$.toUpperCase())),S($)&&(t[o++]=Dt)})}return t.slice(0,o)}sortIndex(e,t){let o=0,r=[];if(t===null?r.push({fidx:0,asc:!0}):r=t.map(i=>{let a=this.m_model.getFieldIndex(i.field);return a==-1&&(console.assert(!1,"unknown field name in sort"),o++),{fidx:a,asc:i.ascending}}),o||r.length==0)return e;let n=this.m_model;if(r.length==1){let i=r[0].fidx;e.sort((a,c)=>{var f,m;let h=(f=n.getRaw(i,this.getByIndex(a)))!=null?f:"",g=(m=n.getRaw(i,this.getByIndex(c)))!=null?m:"";return h>g?1:h<g?-1:0}),r[0].asc||e.reverse()}else e.sort((i,a)=>{var c,h;for(let g=0;g<r.length;g++){let f=r[g].fidx,m=r[g].asc?1:-1,x=(c=n.getRaw(f,this.getByIndex(i)))!=null?c:"",v=(h=n.getRaw(f,this.getByIndex(a)))!=null?h:"";if(x>v)return m;if(x<v)return-m}return 0});return e}forEach(e){this.m_rec_index?this.m_rec_index.some((t,o)=>{if(e(this.m_records[t],o))return o}):this.m_records.some((t,o)=>{if(t&&e(t,o))return o})}export(){return this.m_records}changed(){this.fire("data_change",{change_type:"change"})}getModel(){return this.m_model}};s(Ao,"DataStore");var yr=Ao,Mo=class Mo extends ie{m_index;m_store;m_model;m_sort;m_filter;m_props;constructor(e){super(),this.m_props=e,this.m_store=e.store,this.m_index=null,this.m_filter=null,this.m_sort=null,this.m_model=this.m_store.getModel(),this.filter(e.filter),e.order?D(e.order)?this.sort([{field:e.order,ascending:!0}]):X(e.order)?this.sort(e.order):this.sort([e.order]):this.sort(null),this.m_store.addListener("data_change",t=>this._storeChange(t))}_storeChange(e){this._filter(this.m_filter,e.type!="change"),this._sort(this.m_sort,e.type!="change"),this.fire("view_change",{change_type:"change"})}filter(e){return this.m_index=null,this._filter(e,!0)}_filter(e,t){return this.m_index=this.m_store.createIndex(e),this.m_filter=e,this.m_sort&&this.sort(this.m_sort),t&&this.fire("view_change",{change_type:"filter"}),this.m_index.length}sort(e){this._sort(e,!0)}_sort(e,t){this.m_index=this.m_store.sortIndex(this.m_index,e),this.m_sort=e,t&&this.fire("view_change",{change_type:"sort"})}getStore(){return this.m_store}getCount(){return this.m_index.length}indexOfId(e){let t=this.m_store.indexOfId(e);return this.m_index.findIndex(o=>o===t)}getByIndex(e){if(e>=0&&e<this.m_index.length){let t=this.m_index[e];return this.m_store.getByIndex(t)}return null}getIdByIndex(e){let t=this.getByIndex(e);return this.m_model.getID(t)}getRecId(e){return this.m_model.getID(e)}getById(e){return this.m_store.getById(e)}getModel(){return this.m_model}changed(){this.fire("view_change",{change_type:"change"})}forEach(e){this.m_index.some(t=>{let o=this.m_store.getByIndex(t);if(o&&e(o,t))return t})}};s(Mo,"DataView");var wt=Mo;var Do=Symbol("x-drag-cb"),To=class To{dragSource;dragGhost;dropTarget;notified;timer;registerDraggableElement(e){e.addDOMEvent("dragstart",t=>{this.dragSource=e,this.dragGhost=e.dom.cloneNode(!0),this.dragGhost.classList.add("dragged"),document.body.appendChild(this.dragGhost),e.addClass("dragging"),t.dataTransfer.setData("text/string","1"),t.dataTransfer.setDragImage(new Image,0,0),t.stopPropagation()}),e.addDOMEvent("drag",t=>{this.dragGhost.style.left=t.pageX+"px",this.dragGhost.style.top=t.pageY+"px"}),e.addDOMEvent("dragend",t=>{e.removeClass("dragging"),this.dragGhost.remove()}),e.setAttribute("draggable","true")}registerDropTarget(e,t,o){let r=s(c=>{if(o&&!o(this.dragSource,c.dataTransfer)){console.log("reject ",e),c.dataTransfer.dropEffect="none";return}console.log("accepted ",e),c.preventDefault(),c.dataTransfer.dropEffect="copy"},"dragEnter"),n=s(c=>{if(o&&!o(this.dragSource,c.dataTransfer)){console.log("reject ",e),c.dataTransfer.dropEffect="none";return}if(c.preventDefault(),this.dropTarget!=e&&(this.dropTarget=e,this._startCheck()),this.dropTarget){let h={pt:{x:c.pageX,y:c.pageY},data:c.dataTransfer};t("drag",this.dragSource,h)}c.dataTransfer.dropEffect="copy"},"dragOver"),i=s(c=>{this.dropTarget=null,c.preventDefault()},"dragLeave"),a=s(c=>{let h={pt:{x:c.pageX,y:c.pageY},data:c.dataTransfer};t("drop",this.dragSource,h),this.dropTarget=null,e.removeClass("drop-over"),c.preventDefault()},"drop");e.addDOMEvent("dragenter",r),e.addDOMEvent("dragover",n),e.addDOMEvent("dragleave",i),e.addDOMEvent("drop",a),e.setInternalData(Do,t)}_startCheck(){this.timer&&(clearInterval(this.timer),this._check()),this.timer=setInterval(()=>this._check(),300)}_check(){let e=s(o=>{o.removeClass("drop-over"),o.getInternalData(Do)("leave",this.dragSource)},"leaving"),t=s(o=>{o.addClass("drop-over"),o.getInternalData(Do)("enter",this.dragSource)},"entering");this.dropTarget?(!this.notified||this.notified!=this.dropTarget)&&(this.notified&&e(this.notified),this.notified=this.dropTarget,t(this.notified)):this.notified&&(e(this.notified),this.notified=null,clearInterval(this.timer))}};s(To,"DragManager");var Po=To,Gt=new Po;var So=class So{static create_element(e,t,...o){t=t||{};let r;return D(e)?(r=new d({tag:e}),Object.entries(t).forEach(([n,i])=>{n.startsWith("on")&&n.toLowerCase()in window?r.dom.addEventListener(n.toLowerCase().substring(2),i):r.setAttribute(n,i)})):r=new e(t),o&&o.length&&r.appendContent(o),r}};s(So,"x4_react");var kr=So;function vn(l,e=!1){if(l instanceof RegExp)return{keys:null,pattern:l};let t=l.split("/"),o=[],r="";t[0]==""&&t.shift();for(let n of t){let i=n[0];if(i==="*")o.push("wild"),r+="/(.*)";else if(i===":"){let a=n.indexOf("?",1),c=n.indexOf(".",1);o.push(n.substring(1,a>=0?a:c>=0?c:n.length)),r+=a>=0&&c<0?"(?:/([^/]+?))?":"/([^/]+?)",c>=0&&(r+=(a>=0?"?":"")+"\\"+n.substring(c))}else r+="/"+n}return{keys:o,pattern:new RegExp(`^${r}${e?"(?=$|/)":"/?$"}`,"i")}}s(vn,"parseRoute");var Lo=class Lo extends he{m_routes;m_useHash;constructor(e=!0){super(),this.m_routes=[],this.m_useHash=e,window.addEventListener("popstate",t=>{let o=this._getLocation(),r=this._find(o);r.handlers.forEach(n=>{n(r.params,o)}),this.fire("change",{value:this._getLocation()})})}get(e,t){let{keys:o,pattern:r}=vn(e);this.m_routes.push({keys:o,pattern:r,handler:t})}init(){this.navigate(this._getLocation())}_getLocation(){return this.m_useHash?"/"+document.location.hash.substring(1):document.location.pathname}navigate(e,t=!0,o=!1){e.startsWith("/")||(e="/"+e);let r=this._find(e);if(!r||r.handlers.length==0)return console.log("route not found: "+e),this.fire("error",{code:404,message:"route not found"}),!1;if(this.m_useHash){for(;e.at(0)=="/";)e=e.substring(1);e="#"+e}return o?window.history.replaceState({},"",e):window.history.pushState({},"",e),t&&r.handlers[0](r.params,e),this.fire("change",{value:this._getLocation()}),!0}_find(e){let t=[],o={},r=[];for(let n of this.m_routes)if(n.keys)if(n.keys.length>0){if(t=n.pattern.exec(e),t===null)continue;for(let i=0;i<n.keys.length;)o[n.keys[i]]=t[++i];r=[...r,n.handler]}else n.pattern.test(e)&&(r=[...r,n.handler]);else{if(t=n.pattern.exec(e),!t)continue;if(t.groups)for(let i in t.groups)o[i]=t.groups[i];r=[...r,n.handler]}return{params:o,handlers:r}}};s(Lo,"Router");var Cr=Lo;var Ro=class Ro{_state;_subscribers;_currentTracking;constructor(e){this._state=e?{...e}:{},this._subscribers=new Map,this._currentTracking=new Set}getState(e,t=null){this._currentTracking&&this._currentTracking.add(e);let o=e.split("."),r=this._state;for(let n of o){if((r==null?void 0:r[n])===void 0)return t;r=r[n]}return r}setState(e,t,o={}){let r=e.split("."),n=this._state;for(let i=0;i<r.length-1;i++){let a=r[i];(!n[a]||typeof n[a]!="object")&&(n[a]={}),n=n[a]}n[r[r.length-1]]=t,this._notifySubscribers(e,t)}};s(Ro,"StateManager");var Er=Ro;var Ir="http://www.w3.org/2000/svg";function _n(l){return l*Math.PI/180}s(_n,"d2r");function Ar(l,e,t,o){let r=_n(o);return{x:l+t*Math.cos(r),y:e+t*Math.sin(r)}}s(Ar,"p2c");function M(l){return Math.round(l*1e3)/1e3}s(M,"num");function Wt(l,...e){return e=e.map(t=>typeof t=="number"&&isFinite(t)?M(t):t),String.raw(l,...e)}s(Wt,"clean");var Vo=class Vo{_dom;constructor(e){this._dom=document.createElementNS("http://www.w3.org/2000/svg",e)}getDom(){return this._dom}reset(){let e=this._dom.attributes;for(let t=e.length-1;t>=0;t--)this._dom.removeAttribute(e[t].name);return this}stroke(e,t){return this.setAttr("stroke",e),t!==void 0&&this.setAttr("stroke-width",t+"px"),this}strokeWidth(e){return this.setAttr("stroke-width",e+"px"),this}strokeCap(e){return this.setAttr("stroke-linecap",e)}strokeOpacity(e){return this.setAttr("stroke-opacity",e+"")}antiAlias(e){return this.setAttr("shape-rendering",e?"auto":"crispEdges")}fill(e){return this.setAttr("fill",e),this}no_fill(){return this.setAttr("fill","transparent"),this}getAttr(e){return this._dom.getAttribute(e)}getNumAttr(e){return parseInt(this._dom.getAttribute(e))}setAttr(e,t){return this._dom.setAttribute(e,t),this}setStyle(e,t){let o=this._dom.style;if(V(t)){let r=t+"";xr(e)||(r+="px"),o[e]=r}else o[e]=t;return this}addClass(e){if(e){if(e=e.trim(),e.indexOf(" ")>=0){let t=e.split(" ");this._dom.classList.add(...t)}else this._dom.classList.add(e);return this}}removeClass(e){if(e){if(e.indexOf(" ")>=0){let t=e.split(" ");this._dom.classList.remove(...t)}else this._dom.classList.remove(e);return this}}clip(e){return this.setAttr("clip-path",`url(#${e})`),this}transform(e){var o;let t=(o=this.getAttr("transform"))!=null?o:"";return this.setAttr("transform",t+" "+e),this}clear_transform(){return this.setAttr("transform",null),this}rotate(e,t,o){return this.transform(`rotate( ${e} ${t} ${o} )`),this}translate(e,t){return this.transform(`translate( ${e} ${t} )`),this}scale(e){return this.transform(`scale( ${e} )`),this}addDOMEvent(e,t,o=!1){return Vt(this._dom,e,t,o),this}};s(Vo,"SvgItem");var ue=Vo,Ho=class Ho extends ue{_path;constructor(){super("path"),this._path=""}_update(){return this.setAttr("d",this._path),this}reset(){return this._path="",super.reset(),this}moveTo(e,t){return this._path+=Wt`M${e},${t}`,this._update()}lineTo(e,t){return this._path+=Wt`L${e},${t}`,this._update()}curveTo(e,t,o,r,n,i){return this._path+=Wt`C${e},${t} ${o},${r} ${n},${i}`,this._update()}closePath(){return this._path+="Z",this._update()}arc(e,t,o,r,n,i=!0){let a=Ar(e,t,o,r-90),c=Ar(e,t,o,n-90),h=n-r<=180?"0":"1";return this._path+=Wt`M${a.x},${a.y}A${o},${o} 0 ${h} ${i?"1":"0"} ${c.x},${c.y}`,this._update()}};s(Ho,"SvgPath");var Fo=Ho,No=class No extends ue{constructor(e,t,o){super("text"),this.setAttr("x",M(e)+""),this.setAttr("y",M(t)+""),this._dom.innerHTML=o}font(e){return this.setAttr("font-family",e)}fontSize(e){return this.setAttr("font-size",e+"")}fontWeight(e){return this.setAttr("font-weight",e)}textAlign(e){let t;switch(e){case"left":t="start";break;case"center":t="middle";break;case"right":t="end";break;default:return this}return this.setAttr("text-anchor",t)}verticalAlign(e){let t;switch(e){case"top":t="hanging";break;case"center":t="middle";break;case"bottom":t="baseline";break;case"baseline":t="mathematical";break;default:return}return this.setAttr("alignment-baseline",t)}};s(No,"SvgText");var Bo=No,Uo=class Uo extends ue{constructor(e){super("svg"),e.startsWith("data:image/svg+xml,")&&(e=e.substring(19));let o=new DOMParser().parseFromString(decodeURIComponent(e),"image/svg+xml"),r=o.querySelector("parsererror");r&&console.error(`error while parsing svg: `+r.textContent);let n=o.documentElement;for(let i=0;i<n.attributes.length;i++)this._dom.setAttribute(n.attributes[i].name,n.attributes[i].value);for(let i=0;i<n.childNodes.length;i++){let a=n.childNodes[i];a.nodeType===1&&this._dom.appendChild(a)}}};s(Uo,"SvgIcon");var zo=Uo,qo=class qo extends ue{constructor(e){super(e)}};s(qo,"SvgShape");var yt=qo,qe=class qe extends ue{_id;_stops;constructor(e,t,o,r){super("linearGradient"),this._id="gx-"+qe.g_id,qe.g_id++,this.setAttr("id",this._id),this.setAttr("x1",D(e)?e:M(e)+""),this.setAttr("x2",D(o)?o:M(o)+""),this.setAttr("y1",D(t)?t:M(t)+""),this.setAttr("y2",D(r)?r:M(r)+""),this._stops=[]}get id(){return"url(#"+this._id+")"}addStop(e,t){return this._dom.insertAdjacentHTML("beforeend",`<stop offset="${e}%" stop-color="${t}"></stop>`),this}};s(qe,"SvgGradient"),O(qe,"g_id",1);var Oo=qe,Qt=class Qt extends ue{constructor(e="g"){s