x4js 1.5.24 → 1.5.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +41 -9
- package/lib/cjs/index.js.map +4 -4
- package/lib/esm/index.mjs +47964 -879
- package/lib/esm/index.mjs.map +4 -4
- package/lib/src/application.ts +13 -2
- package/lib/src/router.ts +4 -0
- package/lib/src/version.ts +1 -1
- package/lib/types/application.d.ts +4 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/index.js
CHANGED
|
@@ -1,12 +1,44 @@
|
|
|
1
|
-
"use strict";var pt=Object.defineProperty;var Ps=Object.getOwnPropertyDescriptor;var Ss=Object.getOwnPropertyNames;var As=Object.prototype.hasOwnProperty;var Ts=(o,e,t)=>e in o?pt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var l=(o,e)=>pt(o,"name",{value:e,configurable:!0});var Bs=(o,e)=>{for(var t in e)pt(o,t,{get:e[t],enumerable:!0})},Ls=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ss(e))!As.call(o,s)&&s!==t&&pt(o,s,{get:()=>e[s],enumerable:!(i=Ps(e,s))||i.enumerable});return o};var Hs=o=>Ls(pt({},"__esModule",{value:!0}),o);var k=(o,e,t)=>(Ts(o,typeof e!="symbol"?e+"":e,t),t);var qn={};Bs(qn,{AbsLayout:()=>Gt,Application:()=>xe,AutoComplete:()=>ni,AutoLayout:()=>$t,AutoRecord:()=>mt,BaseButton:()=>ot,BaseComponent:()=>ae,BasicEvent:()=>P,Button:()=>z,CSSParser:()=>st,Calendar:()=>Ft,Canvas:()=>ri,CardView:()=>Ae,CheckBox:()=>ke,Clipboard:()=>Vt,Color:()=>V,ColorPicker:()=>ht,ColorPickerBox:()=>Te,ColorPickerEditor:()=>oi,ComboBox:()=>Ke,Component:()=>u,ComputedStyle:()=>Oe,Container:()=>O,DataProxy:()=>Dt,DataStore:()=>Be,DataView:()=>Mt,Dialog:()=>Ie,EvBtnClick:()=>qi,EvCancel:()=>xs,EvChange:()=>M,EvClick:()=>ne,EvContextMenu:()=>pe,EvDblClick:()=>ye,EvDrag:()=>Bi,EvError:()=>Li,EvFocus:()=>Kt,EvGridCheck:()=>Fs,EvLoaded:()=>Et,EvMessage:()=>Rs,EvMove:()=>ji,EvOverlayResize:()=>fs,EvSelectionChange:()=>ie,EvSize:()=>Q,EvTimer:()=>Ti,EvViewChange:()=>It,EventSource:()=>me,FileUpload:()=>St,Flex:()=>Ee,Form:()=>lt,GridLayout:()=>qt,GridView:()=>fi,HLayout:()=>w,HtmlString:()=>K,Icon:()=>L,Image:()=>Le,ImageUpload:()=>ui,Input:()=>j,Label:()=>I,Link:()=>gi,ListView:()=>yt,Masonry:()=>Zt,Md5:()=>De,Menu:()=>te,MenuBar:()=>ii,MenuItem:()=>ue,MenuSeparator:()=>ei,MenuTitle:()=>ti,MessageBox:()=>Me,NetworkError:()=>Ze,Panel:()=>_i,Point:()=>ee,Popup:()=>$,PopupCalendar:()=>at,PopupListView:()=>Se,PromptDialogBox:()=>Ge,PropertyEditor:()=>bi,RadioBtn:()=>ut,Rating:()=>vi,React:()=>Kn,Record:()=>Ue,Rect:()=>Y,Router:()=>Ci,SVGComponent:()=>Fi,SVGPathBuilder:()=>Bt,ScrollView:()=>Xt,Separator:()=>nt,Settings:()=>rt,SideBarView:()=>wi,Size:()=>fe,SizerOverlay:()=>_e,Space:()=>jt,Spreadsheet:()=>ct,Stylesheet:()=>he,TSXComponent:()=>Ai,TabBar:()=>Ii,TabView:()=>Di,TableLayout:()=>Yt,TextArea:()=>Mi,TextEdit:()=>U,Toaster:()=>Pi,ToggleButton:()=>si,Tooltip:()=>Ne,TreeView:()=>Si,VLayout:()=>H,_date_set_locale:()=>Gs,_tr:()=>D,_x4_unitless:()=>Ut,addTranslation:()=>zi,ajax:()=>$i,ajaxAsJSON:()=>Fn,ajaxAsText:()=>kn,ajaxRequest:()=>Gi,asap:()=>ce,bool_formatter:()=>Vn,calcAge:()=>Zs,camelCase:()=>js,clamp:()=>tt,classNames:()=>Nt,crc32:()=>en,createLanguage:()=>Hi,data:()=>Cs,date_calc_weeknum:()=>Wt,date_clone:()=>Qe,date_diff:()=>qs,date_format:()=>$s,date_formatter:()=>Hn,date_hash:()=>Je,date_sql_utc:()=>Xs,date_to_sql:()=>Ys,deferCall:()=>Ni,downloadData:()=>Oi,dragManager:()=>Dn,drawText:()=>Pn,escapeHtml:()=>gt,flyWrap:()=>J,formatIntlDate:()=>G,generatePassword:()=>nn,getAvailableLanguages:()=>Os,getCurrentLanguage:()=>Vs,getMousePos:()=>re,html:()=>it,initTooltips:()=>dn,installHMR:()=>rn,isArray:()=>X,isFunction:()=>Z,isHtmlString:()=>le,isLanguage:()=>Ri,isLiteralObject:()=>Wi,isNumber:()=>et,isString:()=>B,isTouchDevice:()=>ft,markdownToHtml:()=>Qs,mix:()=>sn,money_formatter:()=>Rn,money_formatter_nz:()=>zn,openFileDialog:()=>Tn,pad:()=>we,parseIntlDate:()=>_t,parseIntlFloat:()=>Vi,pascalCase:()=>Ve,removeHtmlTags:()=>Us,roundTo:()=>ze,saveFileDialog:()=>Bn,selectLanguage:()=>cs,setCurrencySymbol:()=>ys,setupWSMessaging:()=>Gn,sprintf:()=>Xe,sql_date_formatter:()=>Ln,waitFontLoading:()=>Js,x4js_version:()=>$n});module.exports=Hs(qn);var f=document;var os=l(function(){this.propagationStopped=!0},"stopPropagation"),as=l(function(){this.defaultPrevented=!0},"preventDefault");function P(o){return{stopPropagation:os,preventDefault:as,...o}}l(P,"BasicEvent");function ne(o=null){return P({context:o})}l(ne,"EvClick");function M(o,e=null){return P({value:o,context:e})}l(M,"EvChange");function ie(o,e=null){return P({selection:o,context:e})}l(ie,"EvSelectionChange");function pe(o,e=null){return P({uievent:o,context:e})}l(pe,"EvContextMenu");function Ti(o,e=0,t=null){return P({timer:o,time:e,context:t})}l(Ti,"EvTimer");function Rs(o,e,t){return P({msg:o,params:e,source:t})}l(Rs,"EvMessage");function Bi(o,e,t){return P({element:o,data:e,context:t})}l(Bi,"EvDrag");function Li(o,e){return P({code:o,message:e})}l(Li,"EvError");var me=class{m_source;m_eventRegistry;m_defaultHandlers;constructor(e=null){this.m_source=e??this}emit(e,t){this._emit(e,t)}_emit(e,t){let i=this.m_eventRegistry?.get(e),s=this.m_defaultHandlers?.get(e);if(t||(t={}),t.source||(t.source=this.m_source),t.type||(t.type=e),i&&i.length)if(t.preventDefault||(t.preventDefault=as),t.stopPropagation||(t.stopPropagation=os),i.length==1)i[0](t);else{let n=i.slice();for(let r=0,a=n.length;r<a&&(n[r](t),!t.propagationStopped);r++);}if(s&&s.length&&!t.defaultPrevented)return s[0](t)}signal(e,t,i=-1){this._signal(e,t,i)}_signal(e,t,i=-1){if(!this.m_eventRegistry)return;let s=this.m_eventRegistry.get(e);if(!(!s||!s.length))if(t||(t={}),t.type||(t.type=e),t.source||(t.source=this.m_source),t.preventDefault=t.stopPropagation=()=>{console.error("this event cannot be stopped not default prevented")},s.length==1&&i==-1)s[0](t);else{let n=s.slice(),r=l(()=>{for(let a=0,h=n.length;a<h;a++)n[a](t)},"call");i==-1?r():setTimeout(r,i)}}once(e,t){this._once(e,t)}_once(e,t){let i=l(s=>{this._off(e,i),t(s)},"newCallback");if(this._on(e,i),!t)return new Promise(function(s){t=s})}setDefaultHandler(e,t){let i=this.m_defaultHandlers;i||(i=this.m_defaultHandlers=new Map);let s=i.get(e);if(s){let n=s.indexOf(t);n!=-1&&s.splice(n,1),s.unshift(t)}else i.set(e,[t])}removeDefaultHandler(e,t){let i=this.m_defaultHandlers;if(!i)return;let s=i.get(e);if(s){let n=s.indexOf(t);n!=-1&&s.splice(n,1)}}listen(e){for(let t in e)this._on(t,e[t])}defaults(e){for(let t in e)this.setDefaultHandler(t,e[t])}on(e,t){return this._on(e,t)}_on(e,t,i=!1){this.m_eventRegistry||(this.m_eventRegistry=new Map);let s=this.m_eventRegistry.get(e);return s||(s=[],this.m_eventRegistry.set(e,s)),s.indexOf(t)==-1&&(i?s.unshift(t):s.push(t)),{dispose:()=>{this._off(e,t)}}}off(e,t){return this._off(e,t)}_off(e,t){if(!this.m_eventRegistry)return;let i=this.m_eventRegistry.get(e);if(!i)return;let s=i.indexOf(t);s!==-1&&i.splice(s,1)}removeAllListeners(e){e?(this.m_eventRegistry&&(this.m_eventRegistry[e]=void 0),this.m_defaultHandlers&&(this.m_defaultHandlers[e]=void 0)):this.m_eventRegistry=this.m_defaultHandlers=void 0}};l(me,"EventSource");var ae=class extends me{m_props;#e;constructor(e){super(),this.m_props=e,e.events&&this.listen(e.events)}startTimer(e,t,i=!0,s=null){this.#e?this.stopTimer(e):this.#e=new Map;let n=(i?setInterval:setTimeout)(r=>{s?s(e,r):this.emit("timer",Ti(e,r))},t);this.#e.set(e,()=>{(i?clearInterval:clearTimeout)(n)})}stopTimer(e){let t=this.#e.get(e);t&&t()}disposeTimers(){this.#e?.forEach(e=>e()),this.#e=void 0}singleShot(e,t=0){setTimeout(e,t)}mapPropEvents(e,...t){t.forEach(i=>{let s=i;e[s]&&this._on(s,e[s])})}};l(ae,"BaseComponent");var ls=Symbol("i18n"),Ye={};function Hi(o,e){Ye[o]={name:o,base:e,src_translations:{},translations:{}}}l(Hi,"createLanguage");function Ri(o){return Ye[o]!==void 0}l(Ri,"isLanguage");function zi(o,...e){if(!Ri(o))return;let t=Ye[o];e.forEach(i=>{hs(t.src_translations,i,t.base)}),t.translations=ms(t.src_translations,t.base,!0)}l(zi,"addTranslation");function hs(o,e,t){for(let i in e)o[i]instanceof Object?hs(o[i],e[i],t):(o[i]=e[i],o[i]=ms(o[i],t,!1));return o}l(hs,"_patch");var zt;function zs(o){for(;o;){let e=Ye[o],t=e.translations,i;for(let s of zt){if(i=t[s],i===void 0)break;t=i}if(i!==void 0)return t;o=e.base}console.error("I18N error: unable to find","_tr."+zt.join("."))}l(zs,"_findBaseTrans");function ms(o,e,t){return new Proxy(o,{get:(i,s)=>{t?zt=[s]:zt.push(s);let n=i[s];return n===void 0&&e&&(n=zs(e),i[s]=n),n}})}l(ms,"_mk_proxy");var D={};function cs(o){Ri(o)&&(D=Ye[o].translations,D[ls]=o)}l(cs,"selectLanguage");function Vs(){return D[ls]}l(Vs,"getCurrentLanguage");function Os(){return Object.keys(Ye)}l(Os,"getAvailableLanguages");var Ws={global:{ok:"OK",cancel:"Annuler",ignore:"Ignorer",yes:"Oui",no:"Non",open:"Ouvrir",new:"Nouveau",delete:"Supprimer",close:"Fermer",save:"Enregistrer",search:"Rechercher",search_tip:"Saisissez le texte \xE0 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\xE9rique 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\xE9v","mar","avr","mai","jun","jui","ao\xFB","sep","oct","nov","d\xE9c"],month_long:["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"],property:"Propri\xE9t\xE9",value:"Valeur",err_403:"Vous n'avez pas les droits suffisants pour effectuer cette action",copy:"Copier",cut:"Couper",paste:"Coller"}},Ns={global:{ok:"OK",cancel:"Cancel",ignore:"Ignore",yes:"Yes",no:"No",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"}};Hi("fr",null);zi("fr",Ws);Hi("en","fr");zi("en",Ns);cs("fr");function ft(){return"ontouchstart"in window}l(ft,"isTouchDevice");function ze(o,e){let t=Math.pow(10,e),i=Math.round(o*t)/t;return Object.is(i,-0)&&(i=0),i}l(ze,"roundTo");function Vi(o){return o=o.replace(/\s*/g,""),o=o.replace(",","."),o.length==0?0:parseFloat(o)}l(Vi,"parseIntlFloat");function Ve(o){let e=o;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,"-"))}l(Ve,"pascalCase");function js(o){let e=o.toLowerCase();return e=e.replace(/[^a-zA-Z0-9]+(.)/g,(t,i)=>i.toUpperCase()),e}l(js,"camelCase");var ee=class{x;y;constructor(e=0,t=0){this.x=e,this.y=t}};l(ee,"Point");var fe=class{width;height;constructor(e=0,t=0){this.width=e,this.height=t}};l(fe,"Size");var Y=class{left;top;width;height;constructor(e,t,i,s){if(e===void 0)this.left=this.top=this.right=this.bottom=0;else if(e instanceof Y||e instanceof DOMRect){let n=e;this.left=n.left,this.top=n.top,this.width=n.width,this.height=n.height}else this.left=e,this.top=t,this.width=i,this.height=s}set(e,t,i,s){this.left=e,this.top=t,this.width=i,this.height=s}get bottom(){return this.top+this.height}set bottom(e){this.height=e-this.top}get right(){return this.left+this.width}set right(e){this.width=e-this.left}get topLeft(){return new ee(this.left,this.top)}get bottomRight(){return new ee(this.right,this.bottom)}get size(){return new fe(this.width,this.height)}moveTo(e,t){return this.left=e,this.top=t,this}movedTo(e,t){return new Y(e,t,this.width,this.height)}moveBy(e,t){return this.left+=e,this.top+=t,this}movedBy(e,t){return new Y(this.left+e,this.top+t,this.width,this.height)}isEmpty(){return this.width==0&&this.height==0}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}normalized(){let e=new Y(this),t=e.width,i=e.height;return t<0&&(e.left+=t,e.width=-t),i<0&&(e.top+=i,e.height=-i),e}containsPt(e,t){return e>=this.left&&e<=this.right&&t>=this.top&&t<=this.bottom}contains(e){return e instanceof Y?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)}inflate(e,t){t===void 0&&(t=e),this.left-=e,this.top-=t,this.width+=e+e,this.height+=t+t}inflatedBy(e,t){return t===void 0&&(t=e),new Y(this.left-e,this.top-t,this.width+e+e,this.height+t+t)}combine(e){let t=Math.min(this.left,e.left),i=Math.min(this.top,e.top),s=Math.max(this.right,e.right),n=Math.max(this.bottom,e.bottom);this.left=t,this.top=i,this.right=s,this.bottom=n}};l(Y,"Rect");function Xe(o,...e){return o.replace(/{(\d+)}/g,function(t,i){return typeof e[i]<"u"?e[i]:t})}l(Xe,"sprintf");function gt(o,e=!1){if(!o||o.length==0)return"";let t=o.replace(/[<>\&\"\']/g,function(i){return"&#"+i.charCodeAt(0)+";"});return e&&(t=t.replace(/(\r\n|\n\r|\r|\n)/g,"<br/>")),t}l(gt,"escapeHtml");function Us(o,e=!1){if(o==null||!B(o)||o.length==0)return"";let t="";for(let i=0;i<o.length;i++){let s=o.codePointAt(i);s>127?t+="&#"+s+";":s==60?t+="<":t+=o.charAt(i)}return t}l(Us,"removeHtmlTags");var Ks="fr-FR";function Gs(o){Ks=o}l(Gs,"_date_set_locale");function $s(o,e){return G(o)}l($s,"date_format");function qs(o,e,t){var i=(o.getTime()-e.getTime())/1e3;let s=i;if(s<60)return Xe(D.global.diff_date_seconds,Math.round(s));let n=Math.floor(s/60);if(n<60)return Xe(D.global.diff_date_minutes,Math.round(n));let r=Math.floor(n/60);return Xe(D.global.diff_date_hours,r,n%60)}l(qs,"date_diff");function Ys(o,e){return e?G(o,"Y-M-D H:I:S"):G(o,"Y-M-D")}l(Ys,"date_to_sql");function Xs(o){return new Date(o+" GMT")}l(Xs,"date_sql_utc");function Je(o){return o.getFullYear()<<16|o.getMonth()<<8|o.getDate()}l(Je,"date_hash");Date.prototype.hash=function(){return Je(this)};function Qe(o){return new Date(o.getTime())}l(Qe,"date_clone");function Wt(o){let e=new Date(o.getFullYear(),0,1),t=(o.valueOf()-e.valueOf())/864e5;return Math.floor((t+e.getDay()+1)/7)}l(Wt,"date_calc_weeknum");function _t(o,e=D.global.date_input_formats){let t=e.split("|");for(let i of t){let s="";for(let a of i)a=="d"||a=="D"?s+="(?<day>\\d{1,2})":a=="m"||a=="M"?s+="(?<month>\\d{1,2})":a=="y"||a=="Y"?s+="(?<year>\\d{1,4})":a=="h"||a=="H"?s+="(?<hour>\\d{1,2})":a=="i"||a=="I"?s+="(?<min>\\d{1,2})":a=="s"||a=="S"?s+="(?<sec>\\d{1,2})":a==" "?s+="\\s+":s+="\\s*\\"+a+"\\s*";let r=new RegExp("^"+s+"$","m").exec(o);if(r){let a=new Date,h=parseInt(r.groups.day??"1"),m=parseInt(r.groups.month??"1"),c=parseInt(r.groups.year??a.getFullYear()+""),d=parseInt(r.groups.hour??"0"),p=parseInt(r.groups.min??"0"),g=parseInt(r.groups.sec??"0");c>0&&c<100&&(c+=2e3);let x=new Date(c,m-1,h,d,p,g,0),_=x.getFullYear(),F=x.getMonth()+1,S=x.getDate();return _!=c||F!=m||S!=h?null:x}}return null}l(_t,"parseIntlDate");function G(o,e=D.global.date_format){if(!o)return"";let t={year:o.getFullYear(),month:o.getMonth()+1,day:o.getDate(),wday:o.getDay(),hours:o.getHours(),minutes:o.getMinutes(),seconds:o.getSeconds(),milli:o.getMilliseconds()},i="",s=0;for(let n of e){if(n=="{"){if(++s==1)continue}else if(n=="}"&&--s==0)continue;if(s){i+=n;continue}n=="d"?i+=t.day:n=="D"?i+=we(t.day,-2):n=="j"?i+=D.global.day_short[t.wday]:n=="J"?i+=D.global.day_long[t.wday]:n=="w"?i+=Wt(o):n=="W"?i+=we(Wt(o),-2):n=="m"?i+=t.month:n=="M"?i+=we(t.month,-2):n=="o"?i+=D.global.month_short[t.month-1]:n=="O"?i+=D.global.month_long[t.month-1]:n=="y"||n=="Y"?i+=we(t.year,-4):n=="a"||n=="A"?i+=t.hours<12?"am":"pm":n=="h"?i+=t.hours:n=="H"?i+=we(t.hours,-2):n=="i"?i+=t.minutes:n=="I"?i+=we(t.minutes,-2):n=="s"?i+=t.seconds:n=="S"?i+=we(t.seconds,-2):n=="l"?i+=t.milli:n=="L"?i+=we(t.milli,-3):i+=n}return i}l(G,"formatIntlDate");function Zs(o,e){if(e===void 0&&(e=new Date),!o)return 0;let t=e.getFullYear()-o.getFullYear();return(e.getMonth()<o.getMonth()||e.getMonth()==o.getMonth()&&e.getDate()<o.getDate())&&t--,t}l(Zs,"calcAge");Date.prototype.isSameDay=function(o){return this.getDate()==o.getDate()&&this.getMonth()==o.getMonth()&&this.getFullYear()==o.getFullYear()};Date.prototype.hash=function(){return Je(this)};Date.prototype.clone=function(){return Qe(this)};Date.prototype.weekNum=function(){return Wt(this)};Date.prototype.format=function(o){return G(this,o)};Date.prototype.addDays=function(o){return this.setDate(this.getDate()+o),this};function Oi(o,e,t){let i=new Blob([o],{type:e}),s=window.URL.createObjectURL(i),n=f.createElement("a");n.style.display="none",n.href=s,n.download=t,f.body.appendChild(n),n.click(),window.URL.revokeObjectURL(s)}l(Oi,"downloadData");function B(o){return typeof o=="string"}l(B,"isString");function X(o){return o instanceof Array}l(X,"isArray");function Z(o){return o instanceof Function}l(Z,"isFunction");function Wi(o){return!!o&&o.constructor===Object}l(Wi,"isLiteralObject");function we(o,e,t="0"){let i;return B(o)?i=o:i=""+o,e>0?i.padEnd(e,t):i.padStart(-e,t)}l(we,"pad");function et(o){return typeof o=="number"&&isFinite(o)}l(et,"isNumber");function Js(o){let e=f.createElement("div");return e.style.position="absolute",e.style.fontFamily=o,e.style.fontSize="44px",e.style.opacity="0.001",e.innerText="X",f.body.appendChild(e),new Promise(t=>{let i=e.getBoundingClientRect(),s=setInterval(()=>{e.getBoundingClientRect().height!=i.height&&(clearInterval(s),f.body.removeChild(e),t())},0)})}l(Js,"waitFontLoading");function Ni(o,e=0,...t){setTimeout(o,e,...t)}l(Ni,"deferCall");function ce(o){requestAnimationFrame(o)}l(ce,"asap");function Qs(o){if(!o)return"";let e=o.split(`
|
|
2
|
-
`),
|
|
3
|
-
`}return t}parse_json(e,t){e&&!this.result[e]&&(this.result[e]={});for(let i in t){let s=t[i];if(X(s)){let n=s;for(let r=0;r<n.length;r++)this.addProperty(e,i,n[r])}else switch(typeof s){case"number":{this.addProperty(e,i,s);break}case"string":{this.addProperty(e,i,s);break}case"object":{this.parse_json(this.makeSelectorName(e,i),s);break}default:{console.error("ignoring unknown type "+typeof s+" in property "+i);break}}}}makePropertyName(e){return Ve(e)}makeSelectorName(e,t){let i=[],s=t.split(/\s*,\s*/),n=e.split(/\s*,\s*/);for(let r=0;r<n.length;r++){let a=n[r];for(let h=0;h<s.length;h++){let m=s[h],c=!1;m.charAt(0)=="&"&&(m=m.substr(1),c=!0),m.charAt(0)==="%"&&(m=".o-"+m.substr(1)),c?i.push(a+m):i.push(a?a+" "+m:m)}}return i.join(", ")}addProperty(e,t,i){let s=t.split(/\s*,\s*/);for(let n=0;n<s.length;n++){let r=this.makePropertyName(s[n]);this.result[e][r]?this.result[e][r].push(i):this.result[e][r]=[i];let h={"box-shadow":["-moz-box-shadow","-webkit-box-shadow"],"border-radius":["-moz-border-radius","-webkit-border-radius"],"border-radius-topleft":["-moz-border-radius-topleft","-webkit-border-top-left-radius"],"border-radius-topright":["-moz-border-radius-topright","-webkit-border-top-right-radius"],"border-radius-bottomleft":["-moz-border-radius-bottomleft","-webkit-border-bottom-left-radius"],"border-radius-bottomright":["-moz-border-radius-bottomright","-webkit-border-bottom-right-radius"]}[r];for(let m=0;h&&m<h.length;m++)this.addProperty(e,h[m],i)}}};l(st,"CSSParser");var Oe=class{m_style;constructor(e){this.m_style=e}value(e){return e=Ve(e),this.m_style[e]}parse(e){return e=Ve(e),parseInt(this.m_style[e])}get style(){return this.m_style}};l(Oe,"ComputedStyle");var on="x-",We=Symbol(),ge=Symbol(),Ut={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridColumn:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},ds={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,create:2,sizechange:2},an={touchstart:1,touchmove:1,touchend:1},ln=/^-?\d+(\.\d+)?$/;function ye(o=null){return P({context:o})}l(ye,"EvDblClick");function Kt(o=!0,e=null){return P({focus:o,context:e})}l(Kt,"EvFocus");var v=class extends ae{m_dom;m_iprops;constructor(e=null){super(e??{}),this.m_iprops={classes:{},dom_events:{},uid:v.__comp_guid++,inrender:!1},this.m_props.cls&&this.addClass(this.m_props.cls)}get uid(){return this.m_iprops.uid}setContent(e,t=!1){this.m_props.content=e??[],!(this.m_iprops.inrender||!this.m_dom)&&(t?this.update():this._updateContent())}getContent(){return this.m_props.content}appendChild(e){if(!e)return;let t=l(i=>{this.m_props.content?X(this.m_props.content)||(this.m_props.content=[this.m_props.content]):this.m_props.content=[],this.m_props.content.push(i),this.m_dom&&this._appendChild(i)},"append");X(e)?e.forEach(t):t(e)}setTag(e,t){this.m_props.tag=e,t&&(this.m_props.ns=t)}getData(e){if(this.m_props.data!==void 0)return this.m_props.data[e.toString()]}setData(e,t){let i=this.m_props.data;i===void 0&&(i=this.m_props.data={}),i[e.toString()]=t}get dom(){return this.m_dom}show(e){e===void 0||e===!0?this.removeClass("@hidden"):this.addClass("@hidden")}hide(){this.addClass("@hidden")}enable(e){e===void 0||e===!0?(this.removeClass("@disable"),this.removeAttribute("disabled")):this.disable()}disable(){this.addClass("@disable"),this.setAttribute("disabled","")}focus(){console.assert(!!this.m_dom),this.m_dom.focus()}setStyle(e){for(let t in e)this.setStyleValue(t,e[t])}setStyleValue(e,t){let i=this.m_props.style;i||(i=this.m_props.style={}),i[e]=t,this._setDomStyleValue(e,t)}_setDomStyleValue(e,t){this.m_dom&&(t===void 0?t=null:!Ut[e]&&(et(t)||ln.test(t))&&(t=t+"px"),this.m_dom.style[e]=t)}getComputedStyle(e){return this.dom?new Oe(getComputedStyle(this.dom,e??null)):new Oe(this.m_props.style)}getStyleValue(e){return this.getComputedStyle()[e]}setAttributes(e){for(let t in e)this.setAttribute(t,e[t])}setAttribute(e,t){if(t===!1||t===void 0)this.removeAttribute(e);else{t===!0?t="":et(t)&&(t=""+t);let i=this.m_props.attrs;i||(i=this.m_props.attrs={}),i[e]=t,this._setDomAttribute(e,t)}}_setDomAttribute(e,t){this.m_dom&&this.m_dom.setAttribute(e,t)}removeAttribute(e){let t=this.m_props.attrs;t&&(delete t[e],this.m_dom&&this.m_dom.removeAttribute(e))}getAttribute(e){return this.m_dom?this.m_dom.getAttribute(e):this.m_props.attrs?this.m_props.attrs[e]:void 0}hasAttribute(e){return this.m_dom?this.m_dom.hasAttribute(e):this.m_props.attrs.hasOwnProperty(e)}addClass(e){if(e==null||(e=e.trim(),e===""))return;let t=l(s=>{s==null||s===""||(s=this._makeCls(s),i[s]=!0,this.m_dom&&this.m_dom.classList.add(s))},"add"),i=this.m_iprops.classes;e.indexOf(" ")<0?t(e):e.split(" ").forEach(n=>t(n))}removeClass(e){if(e===void 0)return;let t=l(i=>{i==null||i===""||(i=this._makeCls(i),delete this.m_iprops.classes[i],this.m_dom&&this.m_dom.classList.remove(i))},"remove");if(e.indexOf(" ")<0)t(e);else{let i=e.trim().split(" ");for(let s of i)s!=null&&s!==""&&t(s)}}setClass(e,t){return t?this.addClass(e):this.removeClass(e),this}toggleClass(e){let t=l(i=>{i===void 0&&i===null&&i===""||(i=this._makeCls(i),this.m_iprops.classes[i]?delete this.m_iprops.classes[i]:this.m_iprops.classes[i]=!0,this.m_dom&&this.m_dom.classList.toggle(i))},"toggle");if(e.indexOf(" ")<0)t(e);else{let i=e.trim().split(" ");for(let s of i)t(s)}}hasClass(e){let t=this._makeCls(e);return this.m_dom?this.dom.classList.contains(t):!!this.m_iprops.classes[t]}clearClasses(){if(this.m_iprops.classes={},this.m_dom)return this.m_dom.classList.value=""}_build(){return this.m_dom?this.m_dom:(this._createDOM(),this.m_dom)}render(e){}_createDOM(){if(this.m_dom)return this.m_dom;let e=this.m_props;if(e.tabIndex!==void 0&&this._setTabIndex(e.tabIndex),this.render(e),e.left!==void 0&&this.setStyleValue("left",e.left),e.top!==void 0&&this.setStyleValue("top",e.top),e.width!==void 0&&this.setStyleValue("width",e.width),e.height!==void 0&&this.setStyleValue("height",e.height),e.flex!==void 0&&(this.addClass("@flex"),e.flex!=1&&this.setStyleValue("flex",e.flex)),e.enabled===!1&&this.disable(),e.tooltip!==void 0&&this.setAttribute("tip",e.tooltip.replace(/\n/gi,"<br/>")),e.dom_events)for(let a in e.dom_events)this._setDomEvent(a,e.dom_events[a]);this._genClassName(),this.m_props.cls=void 0;let t=this.m_iprops;e.ns?this.m_dom=f.createElementNS(e.ns,e.tag??"div"):this.m_dom=f.createElement(e.tag??"div"),this.m_dom[ge]=this,this.m_dom.classList.add(...Object.keys(t.classes));let i=e.style;if(i)for(let a in i)this._setDomStyleValue(a,i[a]);let s=e.attrs;if(s)for(let a in s){let h=s[a];h!==!1&&h!==void 0&&this._setDomAttribute(a,s[a])}this.m_props.id&&this._setDomAttribute("id",this.m_props.id);let n=this.m_iprops.dom_events;if(n)for(let a in n){let h=n[a];for(let m of h)this.createEvent(a,m)}let r=e.content;return r&&(X(r)||(r=[r]),r.forEach(a=>{a&&(B(a)?this.m_dom.insertAdjacentText("beforeend",a):le(a)?this.m_dom.insertAdjacentHTML("beforeend",a):a instanceof v?this.m_dom.append(a._build()):console.log("unknown element type: ",a))})),v.__createObserver||(v.__createObserver=new MutationObserver(v._observeCreation),v.__createObserver.observe(f.body,{childList:!0,subtree:!0})),this.m_dom}_setTabIndex(e,t=0){e===!0?e=0:e===void 0&&(e=t),e!==!1&&e!==void 0&&this.setAttribute("tabindex",e),this.m_props.tabIndex=e}static _observeCreation(e){let t=l(i=>{i.m_iprops.created||(i.dom&&i.m_iprops.dom_events&&i.m_iprops.dom_events.create&&i.dom.dispatchEvent(new Event("create")),i.componentCreated(),i.m_iprops.created=!0)},"notify");for(let i of e)if(i.type=="childList")for(let s=0,n=i.addedNodes.length;s<n;s++){let a=i.addedNodes[s][ge];a&&(a.enumChilds(h=>{t(h)},!0),t(a))}}dispose(){this.m_dom&&this._dispose(!0,!0)}_dispose(e,t){let i=this.m_dom;delete i[ge],delete i[We],e&&i.remove(),this.enumChilds(s=>{s._dispose(!1,!0)}),this.m_dom=null,t&&this.disposeTimers(),this.componentDisposed(),this.m_iprops.created=!1}componentDisposed(){}componentCreated(){}update(e=0){if(this.m_dom){let t=l(()=>{let i=this.m_dom;this._dispose(!1,!1);let s=this._build();console.assert(!!i.parentNode,"update in componentCreated is not allowed, use updateContent"),i.parentNode.replaceChild(s,i)},"_update");e?this.singleShot(t,e):t()}}_empty(){let e=this.m_dom;if(e)for(;e.firstChild;)e.removeChild(e.firstChild)}_updateContent(){if(!this.m_dom)return;this._empty();let e=this.m_props.content;e&&(X(e)||(e=[e]),e.forEach(t=>{t&&(le(t)?this.m_dom.insertAdjacentHTML("beforeend",t):t instanceof v?this.m_dom.append(t._build()):this.m_dom.insertAdjacentText("beforeend",t+""))}))}getBoundingRect(e=!1){console.assert(this.dom!=null,"cannot get bounding rect of an non DOM element");let t=this.dom.getBoundingClientRect(),i=new Y(t.left,t.top,t.width,t.height);if(e){let s=this.getComputedStyle(),n=s.parse("marginTop"),r=s.parse("marginBottom"),a=s.parse("marginLeft"),h=s.parse("marginRight");i.left-=a,i.width+=a+h,i.top-=n,i.height+=n+r}return i}setDomEvent(e,t){let i=t;this._setDomEvent(e,i)}_setDomEvent(e,t){this.m_iprops.dom_events||(this.m_iprops.dom_events={});let i=this.m_iprops.dom_events[e];i?i.push(t):i=this.m_iprops.dom_events[e]=[t],this.m_dom&&this.createEvent(e,t)}clearDomEvent(e){if(!this.m_iprops.dom_events)return;delete this.m_iprops.dom_events[e];let t=this.m_dom;if(t){let i=t[We];i&&delete i[e]}}createEvent(e,t){let i=this.m_dom,s=i[We];s||(s=i[We]={}),s[e]?s[e].push(t):s[e]=[t],ds[e]===1?i["on"+e]=v._dispatchUnbubbleEvent:v.__privateEvents[e]||(v.__privateEvents[e]=!0,an[e]?f.addEventListener(e,v._dispatchEvent,{passive:!1,capture:!0}):f.addEventListener(e,v._dispatchEvent,!0)),e==="sizechange"&&(v.__sizeObserver||(v.__sizeObserver=new ResizeObserver(v._observeSize)),v.__sizeObserver.observe(this.m_dom))}static _dispatchEvent(e){let t=e.target,i=ds[e.type]===2;for(;t;){if(t[We]){let s=t[We][e.type];if(s){let n=t[ge],r=n?.root??null;if(s instanceof Array?s.some(a=>{if(a(e,r),!n.dom)return!0}):s(e,r),e.cancelBubble||e.defaultPrevented||i)break}}if(t=t.parentNode,t==document)break}}static _dispatchUnbubbleEvent(e){let t=e.currentTarget||e.target,i=e.type,s=t[We],n=s&&s[i];if(n){let a=t[ge]?.root??null;n instanceof Array?n.forEach(h=>{h(e,a)}):n(e,a)}}static _observeSize(e){e.forEach(t=>{let i=t.target;i.offsetParent!==null&&i.dispatchEvent(new Event("sizechange"))})}enumChilds(e,t=!1){if(this.m_dom){let i=this.m_dom.firstChild;for(;i;){let s=i[ge];if(s&&(e(s),t&&s.enumChilds(e,!0)===!0))return!0;i=i.nextSibling}}else{let i=this.m_props.content;if(!i)return;X(i)||(i=[i]),i.some(s=>{if(!(!s||B(s)||le(s))&&(e(s)||t&&s.enumChilds(e,!0)===!0))return!0})}return!1}_appendChild(e){if(B(e))this.m_dom.insertAdjacentText("beforeend",e);else if(le(e))this.m_dom.insertAdjacentHTML("beforeend",e);else{let t=e;try{t._build(),this.m_dom.appendChild(t.m_dom)}catch(i){console.error(i)}}}_genClassName(){this.addClass("@comp");let e=Object.getPrototypeOf(this);for(;e&&e.constructor!==v;){let t=e.constructor.name;this.addClass("@"+Ve(t)),e=Object.getPrototypeOf(e)}}_makeCls(e){return e[0]=="@"?e=on+e.substring(1):e}static dispatchCaptures(e){v.__capture.handler(e)}static setCapture(e,t){if(console.assert(!v.__capture),v.__capture)debugger;let i=f.querySelectorAll("iframe");i.forEach(a=>{J(a).setStyleValue("pointer-events","none")});let s=f.querySelectorAll(":hover"),n=null;if(s.length){let a=s[s.length-1];n=window.getComputedStyle(a).cursor}v.__capture_mask=f.createElement("div");let r=J(v.__capture_mask);r.addClass("@capture-mask"),n&&r.setStyleValue("cursor",n),f.body.appendChild(r.dom),f.addEventListener("mousedown",v.dispatchCaptures),f.addEventListener("mousemove",v.dispatchCaptures),f.addEventListener("mouseup",v.dispatchCaptures),f.addEventListener("touchstart",v.dispatchCaptures),f.addEventListener("touchmove",v.dispatchCaptures),f.addEventListener("touchend",v.dispatchCaptures),v.__capture={initiator:e,handler:t,iframes:i}}static releaseCapture(){console.assert(!!v.__capture),f.removeEventListener("touchstart",v.dispatchCaptures),f.removeEventListener("touchmove",v.dispatchCaptures),f.removeEventListener("touchend",v.dispatchCaptures),f.removeEventListener("mousedown",v.dispatchCaptures),f.removeEventListener("mousemove",v.dispatchCaptures),f.removeEventListener("mouseup",v.dispatchCaptures),v.__capture.iframes.forEach(e=>{J(e).setStyleValue("pointer-events",null)}),v.__capture=null,v.__capture_mask&&(f.body.removeChild(v.__capture_mask),v.__capture_mask=null)}scrollIntoView(e){if(this.m_dom){let t=new Y(this.dom.getBoundingClientRect()),i,s,n,r,a=this.dom.parentElement,h=f.body;for(;a&&a!=h;){let m=a.getBoundingClientRect();(i===void 0||i<m.top)&&(i=m.top),(s===void 0||s>m.bottom)&&(s=m.bottom),(n===void 0||n<m.left)&&(n=m.left),(r===void 0||r>m.right)&&(r=m.right),a=a.parentElement}(i===void 0||t.top<i||t.bottom>s||t.left<n||t.right>r)&&this.m_dom.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"})}}queryItem(e){let t=this.dom.querySelector(e);return t?v.getElement(t):null}queryAll(e,t){let i=Array.from(this.m_dom.querySelectorAll(e));return t&&i.forEach(s=>{t(J(s))}),i}itemWithId(e){let t=this.dom.querySelector("#"+e);return t?v.getElement(t):null}itemWithRef(e){let t=null;return this.enumChilds(i=>{if(i.m_props.ref===e)return t=i,!0},!0),t}get ref(){return this.m_props.ref}static getCss(){return v.__css||(v.__css=new he),v.__css}getParent(){console.assert(!!this.m_dom);let e=this.dom.parentNode;return v.getElement(e)}static getElement(e,t){if(t){let i=B(t);for(;e;){let s=e[ge];if(i){if(s&&s.hasClass(t))return s}else if(s instanceof t)return s;e=e.parentElement}return null}else return e?e[ge]:null}static getScrollbarSize(){if(v.__sb_width===void 0){let e=f.createElement("div");e.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px";let t=f.createElement("div");t.style.width="200px",t.style.height="200px",e.appendChild(t),f.body.appendChild(e),v.__sb_width=e.offsetWidth-e.clientWidth,f.body.removeChild(e)}return v.__sb_width}isUserVisible(){return this.m_dom?this.m_dom.offsetParent!==null:!1}},u=v;l(u,"Component"),k(u,"__sb_width"),k(u,"__comp_guid",1e3),k(u,"__privateEvents",{}),k(u,"__sizeObserver"),k(u,"__createObserver"),k(u,"__capture",null),k(u,"__capture_mask",null),k(u,"__css",null);var ps=null;function J(o){if(o[ge])return o[ge];let e=ps;return e||(e=ps=new u({})),e.m_dom=o,e}l(J,"flyWrap");var Ee=class extends u{constructor(e={}){e.flex||(e.flex=1),super(e)}};l(Ee,"Flex");var jt=class extends u{m_size;constructor(e){super({}),this.m_size=e}componentCreated(){let e=this.dom,t=null;for(;e;){let i=e[ge];if(i.hasClass("@hlayout")){t={width:this.m_size};break}else if(i.hasClass("@vlayout")){t={height:this.m_size};break}e=e.parentElement}t||(t={width:this.m_size,height:this.m_size}),this.setStyle(t)}};l(jt,"Space");function Q(o,e=null,t=null){return P({size:o,mode:e,context:t})}l(Q,"EvSize");var nt=class extends u{m_irect;m_delta;m_target;constructor(e){super(e),this.setDomEvent("mousedown",t=>this._mousedown(t)),this.setDomEvent("touchstart",t=>this._mousedown(t)),this.setDomEvent("dblclick",t=>this._collapse(t))}render(){this.addClass(this.m_props.orientation)}_collapse(e){this.m_props.collapsible&&(this._findTarget(),this.m_target&&this.m_target.toggleClass("@collapsed"))}_mousedown(e){if(e.type=="touchstart"){let t=e;t.touches.length==1&&this._startMoving(t.touches[0].pageX,t.touches[0].pageY,e)}else{let t=e;this._startMoving(t.pageX,t.pageY,e)}}_startMoving(e,t,i){this._findTarget(),this.m_target&&(this.m_props.orientation=="horizontal"?this.m_props.sizing=="before"?this.m_delta=e-this.m_irect.right:this.m_delta=e-this.m_irect.left:this.m_props.sizing=="before"?this.m_delta=t-this.m_irect.bottom:this.m_delta=t-this.m_irect.top,i.preventDefault(),i.stopPropagation(),this.m_target.addClass("sizing"),u.setCapture(this,s=>this._pointerMoved(s)))}_pointerMoved(e){let t=l((i,s)=>{if(this.m_props.orientation=="horizontal"){let n;if(this.m_props.sizing=="after"?n=this.m_irect.right-(i-this.m_delta):n=i-this.m_delta-this.m_irect.left,n>0){let r=new fe(n,0);this.emit("resize",Q(r)),this.m_target.setStyleValue("width",r.width),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}else{let n;if(this.m_props.sizing=="after"?n=this.m_irect.bottom-(s-this.m_delta):n=s-this.m_delta-this.m_irect.top,n>0){let r=new fe(0,n);this.emit("resize",Q(r)),this.m_target.setStyleValue("height",r.height),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}},"__move");if(e.type=="mousemove"){let i=e;t(i.pageX,i.pageY),e.preventDefault(),e.stopPropagation()}else if(e.type=="touchmove"){let i=e;t(i.touches[0].pageX,i.touches[0].pageY),e.preventDefault(),e.stopPropagation()}else(e.type=="mouseup"||e.type=="touchend")&&(this.m_target.removeClass("sizing"),u.releaseCapture(),e.preventDefault(),e.stopPropagation())}_findTarget(){if(!this.m_target)if(this.m_props.sizing=="before"){let e=this.dom.previousElementSibling,t=e?u.getElement(e):null;this.m_target=t}else{let e=this.dom.nextElementSibling,t=e?u.getElement(e):null;this.m_target=t}this.m_target?this.m_irect=this.m_target.getBoundingRect():this.m_irect=null}};l(nt,"Separator");function fs(o,e,t=null){return P({ui_event:o,sens:e,context:t})}l(fs,"EvOverlayResize");var _e=class extends u{m_delta;m_irect;constructor(e){super(e),this.addClass(e.sens),this.setDomEvent("mousedown",t=>this._mousedown(t)),this.setDomEvent("touchstart",t=>this._mousedown(t)),this.setDomEvent("dblclick",t=>this.resetflex(t)),e.target.appendChild(this),e.resize&&this.on("resize",this.m_props.resize)}resetflex(e){this.m_props.target.addClass("@flex"),this.emit("resize",Q({width:-1,height:0})),e.preventDefault(),e.stopPropagation()}_mousedown(e){e.preventDefault(),e.stopPropagation();let t=fs(e,this.m_props.sens);if(this.emit("rawresize",t),t.defaultPrevented)return;let i=re(e,!0);this.m_irect=this.m_props.target.getBoundingRect(),this.m_props.sens=="right"?this.m_delta=i.x-this.m_irect.right:this.m_props.sens=="left"?this.m_delta=i.x-this.m_irect.left:this.m_props.sens=="bottom"?this.m_delta=i.y-this.m_irect.bottom:this.m_props.sens=="top"&&(this.m_delta=i.y-this.m_irect.top),this.m_props.target.addClass("sizing"),u.setCapture(this,s=>this._handle_mouse(s))}_is_horz(){return this.m_props.sens=="left"||this.m_props.sens=="right"}get sens(){return this.m_props.sens}_handle_mouse(e){let t=l((i,s)=>{if(this._is_horz()){let n;if(this.m_props.sens=="left"?n=this.m_irect.right-(i-this.m_delta):n=i-this.m_delta-this.m_irect.left,n>0){let r={width:n,height:void 0};this.emit("resize",Q(r)),this.m_props.target.setStyleValue("width",r.width),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}else{let n;if(this.m_props.sens=="top"?n=this.m_irect.bottom-(s-this.m_delta):n=s-this.m_delta-this.m_irect.top,n>0){let r=new fe(0,n);this.emit("resize",Q(r)),this.m_props.target.setStyleValue("height",r.height),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}},"__move");if(e.type=="mousemove"){let i=e;t(i.pageX,i.pageY),e.preventDefault(),e.stopPropagation()}else if(e.type=="touchmove"){let i=e;t(i.touches[0].pageX,i.touches[0].pageY),e.preventDefault(),e.stopPropagation()}else(e.type=="mouseup"||e.type=="touchend")&&(this.m_props.target.removeClass("sizing"),u.releaseCapture(),e.preventDefault(),e.stopPropagation())}};l(_e,"SizerOverlay");function hn(o){return P({name:o})}l(hn,"EvShortcut");var O=class extends u{m_shortcuts;constructor(e){X(e)?super({content:e}):super(e)}addShortcut(e,t,i=null,s=!1){this.m_shortcuts||(this.m_shortcuts=[],this.setDomEvent("keydown",n=>this._handleKeydown(n))),X(e)||(e=[e]),e.forEach(n=>{let r="";n.match(/SHIFT/i)&&(n=n.replace(/SHIFT/i,""),r+="shift+"),n.match(/CTRL/i)&&(n=n.replace(/CTRL/i,""),r+="ctrl+"),n.match(/CMD/i)&&(n=n.replace(/CMD/i,""),r+="cmd+"),n.match(/ALT/i)&&(n=n.replace(/ALT/i,""),r+="alt+"),r+=n.replace("+","").toLowerCase(),this.m_shortcuts.push({sequence:r,name:t,immediate:s,callback:i})})}removeShortcuts(){this.m_shortcuts&&(this.m_shortcuts=[])}_handleKeydown(e){if(!this.m_shortcuts)return;let t="";e.shiftKey&&(t+="shift+"),e.ctrlKey&&(t+="ctrl+"),e.metaKey&&(t+="cmd+"),e.altKey&&(t+="alt+"),t+=e.key.toLowerCase(),this.m_shortcuts.some(i=>{if(i.sequence==t)return i.callback?i.immediate?i.callback(e):ce(()=>{i.callback(e)}):this.emit("shortcut",hn(i.name)),e.preventDefault(),e.stopPropagation(),!0})}};l(O,"Container");var rt=class{m_data;m_name;constructor(e){this.m_data=null,this.m_name=e??"settings"}set(e,t){this._load(),this.m_data[e]=t,this._save()}get(e,t){return this._load(),this.m_data[e]??t}_save(){let e=JSON.stringify(this.m_data);localStorage.setItem(this.m_name,e)}_load(){if(this.m_data)return;this.m_data={};let e=localStorage.getItem(this.m_name);e!==null&&(e=JSON.parse(e),e?this.m_data=e:console.info("There was an error attempting to read your settings."))}};l(rt,"Settings");var Lr=Symbol(),bt=class extends ae{static instance(){return bt.self}m_mainView;m_app_name;m_app_version;m_app_uid;m_local_storage;m_user_data;m_touch_time;m_touch_count;constructor(e){console.assert(bt.self===null,"application is a singleton"),super(e),this.m_app_name=e.app_name??"application",this.m_app_version=e.app_version??"1.0",this.m_app_uid=e.app_uid??"application";let t=`${this.m_app_name}.${this.m_app_version}.settings`;this.m_local_storage=new rt(t),this.m_user_data={},this.m_touch_time=0,this.m_touch_count=0,bt.self=this,"onload"in globalThis?globalThis.addEventListener("load",()=>{this.ApplicationCreated()}):this.ApplicationCreated()}ApplicationCreated(){this.setTitle("")}get app_name(){return this.m_app_name}get app_uid(){return this.m_app_uid}get app_version(){return this.m_app_version}get local_storage(){return this.m_local_storage}get user_data(){return this.m_user_data}get history(){debugger;return null}setMainView(e,t){let i=this.m_props.renderTo??f.body,s=J(i);this.m_props.renderTo||s.setStyleValue("position","absolute"),s.addClass("x4-root-element"),t&&s._empty(),this.m_mainView=e,e.setStyleValue("position","absolute"),e._build(),i.appendChild(e.dom)}set mainView(e){this.setMainView(e,!1)}get mainView(){return this.m_mainView}setTitle(e){f.title=this.m_app_name+(e?" > "+e:"")}disableZoomWheel(){window.addEventListener("wheel",function(e){e.ctrlKey&&e.preventDefault()},{passive:!1,capture:!0})}enterModal(e){}enableTouchDblClick(){f.addEventListener("touchstart",e=>{let t=Date.now();if(t-this.m_touch_time>700?this.m_touch_count=1:this.m_touch_count++,this.m_touch_time=t,this.m_touch_count==2){this.m_touch_count=0;let i=e.touches[0],s={type:"dblclick"};for(let n in i)s[n]=i[n];u._dispatchEvent(s),e.stopPropagation()}})}},xe=bt;l(xe,"Application"),k(xe,"self",null);var Gt=class extends O{};l(Gt,"AbsLayout");var w=class extends O{};l(w,"HLayout");var H=class extends O{};l(H,"VLayout");var $t=class extends O{constructor(e){super(e),this.setDomEvent("sizechange",()=>this._updateLayout())}componentCreated(){super.componentCreated(),this._updateLayout()}_updateLayout(){let e=this.m_props.defaultLayout=="horizontal";if(this.m_props.switchSize<=0&&window.screen.height>window.screen.width)e=!e;else{let t=this.getBoundingRect();(e&&t.width<this.m_props.switchSize||!e&&t.height<this.m_props.switchSize)&&(e=!e)}e?(this.removeClass("@vlayout"),this.addClass("@hlayout")):(this.addClass("@vlayout"),this.removeClass("@hlayout"))}};l($t,"AutoLayout");var qt=class extends O{constructor(e){super(e)}render(){this.m_props.colSizes&&this.setStyleValue("grid-template-columns",this.m_props.colSizes),this.m_props.rowSizes&&this.setStyleValue("grid-template-rows",this.m_props.rowSizes),this.m_props.colGap&&this.setStyleValue("grid-gap",this.m_props.colGap),this.m_props.template&&this.setStyleValue("grid-template-areas",this.m_props.template.join(`
|
|
4
|
-
`))}};l(qt,"GridLayout");var Yt=class extends O{m_cells;constructor(e){super(e),this.setTag("table"),this.m_cells=new Map}_getCell(e,t,i=!0){let s=vt(e,t);return this.m_cells.get(s)??(i?{item:void 0}:null)}_setCell(e,t,i,s=!1){let n=vt(e,t);this.m_cells.set(n,i),this.dom&&i.item&&s&&(i.item instanceof u?i.item.update():this.enumChilds(r=>{if(r.getData("row")==e&&r.getData("col")==t)return r.setContent(i.item),r.update(),!0}))}setCell(e,t,i){let s=this._getCell(e,t);s.item=i,this._setCell(e,t,s,!0)}setCellData(e,t,i){let s=this._getCell(e,t);s.data=i,this._setCell(e,t,s,!0)}getCellData(e,t){return this._getCell(e,t,!1)?.data}merge(e,t,i,s){let n=this._getCell(e,t);n.rowSpan=i,n.colSpan=s,this._setCell(e,t,n)}setCellWidth(e,t,i){let s=this._getCell(e,t);s.width=i,this._setCell(e,t,s)}setCellHeight(e,t,i){let s=this._getCell(e,t);s.height=i,this._setCell(e,t,s)}setCellClass(e,t,i){let s=this._getCell(e,t);s.cls=i,this._setCell(e,t,s)}setColClass(e,t){let i=this._getCell(-1,e);i.cls=t,this._setCell(-1,e,i)}setRowClass(e,t){let i=this._getCell(e,999);i.cls=t,this._setCell(e,999,i)}getCell(e,t){return this._getCell(e,t)?.item}render(){let e=[],t=[];for(let i=0;i<this.m_props.rows;i++){let s=[];for(let a=0;a<this.m_props.columns;a++){let h=vt(i,a);if(t.indexOf(h)>=0)continue;let m=this.m_cells.get(h),c=this.m_cells.get(vt(-1,a)),d="";m&&m.cls&&(d=m.cls),c&&c.cls&&(d+=" "+c.cls);let p=new u({tag:"td",content:m?.item,width:m?.width,height:m?.height,data:{row:i,col:a},cls:d});if(m){let g=m.rowSpan??0,x=m.colSpan??0;if(g>0&&p.setAttribute("rowspan",g+1),x>0&&p.setAttribute("colspan",x+1),g||x)for(let _=0;_<=g;_++)for(let F=0;F<=x;F++)t.push(vt(_+i,F+a))}s.push(p)}let n=this._getCell(i,999,!1),r=new u({tag:"tr",data:{row:i},content:s,cls:n?.cls});e.push(r)}this.setContent(e)}};l(Yt,"TableLayout");function vt(o,e){return o*1e3+e}l(vt,"_mkid");var Xt=class extends u{constructor(e){super(e),this.setContent(e.content)}setContent(e){if(!e)super.setContent(null);else{let t;X(e)?t=new H({content:e}):t=e,t.addClass("@scroll-container"),super.setContent(t)}}};l(Xt,"ScrollView");var Zt=class extends O{constructor(e){let t=e.items;e.items=void 0,super(e),this.setDomEvent("sizechange",()=>{this.resizeAllItems()}),t&&t.forEach(i=>{this.addItem(i)})}resizeItem(e){let t=this.getComputedStyle(),i=t.parse("grid-auto-rows"),s=t.parse("grid-row-gap"),n=e.queryItem(".content");if(n||(n=e),n&&i+s){let r=n.getBoundingRect(),a=Math.ceil((r.height+s)/(i+s));e.setStyleValue("gridRowEnd","span "+a)}}resizeAllItems(){this.queryAll(".item",e=>{this.resizeItem(e)})}addItem(e){e.addClass("content"),this.appendChild(new O({cls:"item",content:e}))}};l(Zt,"Masonry");function ji(o){return P({pos:o})}l(ji,"EvMove");var Ct=class extends O{m_ui_mask;m_hasMask=!0;constructor(e){super(e),this.addClass("@hidden")}enableMask(e=!0){this.m_hasMask=e}show(e){if(e!==void 0?this.m_hasMask=!!e:e=this.m_hasMask,this.m_hasMask){let t=f.activeElement;for(t&&t.blur(),this.m_ui_mask=f.body.lastChild;this.m_ui_mask;){if(this.m_ui_mask.nodeType==1){let i=J(this.m_ui_mask);if(!(i.hasClass("@menu")||i.hasClass("@non-maskable"))){if(!(i.getStyleValue("display")=="none"||!i.isUserVisible())){if(i.hasClass("@comp"))break}}}this.m_ui_mask=this.m_ui_mask.previousSibling}this.m_ui_mask&&J(this.m_ui_mask).addClass("@mask")}if(e&&xe.instance().enterModal(!0),this.setStyle({left:0,top:0}),f.body.appendChild(this._build()),this.removeClass("@hidden"),this.centerOnScreen(),e){let t=f.activeElement;if(!this.dom.contains(t)){let i=this.queryItem("[autofocus]");if(i)i.focus();else{let s=this.queryAll("[tabindex]");s&&(s=s.filter(n=>n.offsetParent!==null),s.length&&s[0].focus())}}Ct.modal_stack.push(this.dom)}}centerOnScreen(){let e=this.getBoundingRect(),t=`max( 0px, 50vw - ${e.width/2}px )`,i=`max( 0px, 50vh - ${e.height/2}px )`;this.setStyleValue("left",t),this.setStyleValue("top",i)}displayAt(e,t,i="top left",s,n=!1){this.show(n);let r="l",a="t";i.indexOf("right")>=0&&(r="r"),i.indexOf("bottom")>=0&&(a="b");let h=f.body.getBoundingClientRect(),m=this.getBoundingRect();r=="r"&&(e-=m.width),a=="b"&&(t-=m.height),s&&(e+=s.x,t+=s.y),e<4&&(e=4),e+m.width>h.right-4&&(e=h.right-4-m.width,s?.x<0&&(e+=s.x)),t<4&&(t=4),t+m.height>h.bottom-4&&(t=h.bottom-4-m.height,s?.y<0&&(t+=s.y)),this.setStyle({left:e,top:t})}close(){this.hide(),this.m_hasMask&&this.m_ui_mask&&(J(this.m_ui_mask).removeClass("@mask"),xe.instance().enterModal(!1));let e=Ct.modal_stack.indexOf(this.dom);e>=0&&Ct.modal_stack.splice(e),this.dispose()}componentCreated(){if(this.m_props.sizable){this.addClass("@size-all");let e=["top","right","bottom","left","topleft","topright","bottomleft","bottomright"];for(let t of e)new _e({target:this,sens:t,events:{rawresize:i=>this._mouseResize(i)}})}}_mouseResize(e){e.preventDefault();let t=this.getBoundingRect(),i=this.getComputedStyle(),s=e.ui_event,n=i.parse("marginTop"),r=i.parse("marginLeft"),a=i.parse("marginRight"),h=i.parse("marginBottom"),m=0,c=0,d=re(s,!0);switch(e.sens){case"topright":case"bottomright":case"right":m=t.right-a-d.x;break;case"topleft":case"bottomleft":case"left":m=t.left-r-d.x;break}switch(e.sens){case"bottomleft":case"bottomright":case"bottom":c=t.bottom-h-d.y;break;case"topleft":case"topright":case"top":c=t.top-n-d.y;break}t.left-=r,t.top-=n;let p=e.sens;u.setCapture(this,g=>{let x=l((_,F)=>{let S=t.left,E=t.top,W=t.width,A=t.height,b,y,N=_+m,C=F+c;switch(N<0&&(N=0),C<0&&(C=0),p){case"topright":case"bottomright":case"right":W=N-S;break;case"topleft":case"bottomleft":case"left":b=S-N,W+=b,S-=b;break}switch(p){case"bottomleft":case"bottomright":case"bottom":A=C-E;break;case"topleft":case"topright":case"top":y=E-C,A+=y,E-=y;break}let T=new fe(W,A);this.setStyle({left:S,top:E,width:T.width,height:T.height}),this.emit("size",Q(T))},"__move");if(g.type=="mouseup"||g.type=="touchend")u.releaseCapture();else if(g.type=="mousemove"){let _=g;x(_.pageX,_.pageY)}else if(g.type=="touchmove"){let _=g;x(_.touches[0].pageX,_.touches[0].pageY)}})}},$=Ct;l($,"Popup"),k($,"modal_stack",[]);function mn(o){if(o.key=="Tab"||o.key=="Enter"){let e=o.target;if(e.tagName=="TEXTAREA")return;let t=u.getElement(e);if(t&&(t.hasAttribute("wants-tab")||t.hasAttribute("wants-enter")))return;let i=f.body;$.modal_stack.length&&(i=$.modal_stack[$.modal_stack.length-1]),cn(i,o.target,o.shiftKey),o.stopPropagation(),o.preventDefault()}}l(mn,"x4handleKeyDown");function cn(o,e,t){let i=f.activeElement;if(!o.contains(i))return;let s=u.getElement(e),n=Array.from(o.querySelectorAll("[tabindex]"));if(n=n.filter(a=>a.offsetParent!==null),!n.length)return;let r=n.indexOf(e);r<0?r=0:t?r>0?r--:r=n.length-1:r<n.length-1?r++:r=0,n[r].focus()}l(cn,"_nextTab");function gs(){f.body.addEventListener("keydown",mn,!0)}l(gs,"installKBHandler");f.body?gs():window.addEventListener("load",gs);function un(o){return P({source:o})}l(un,"EvAction");var wt=class extends ae{constructor(e){super(e),this.mapPropEvents(e,"run")}get props(){return this.m_props}set text(e){this.m_props.text=e,this.emit("change",M(this))}set icon(e){this.m_props.icon=e,this.emit("change",M(this))}fire(){this.emit("run",un(this))}};l(wt,"Action");function Et(o,e,t=null){return P({url:o,svg:e,context:t})}l(Et,"EvLoaded");function _s(o){let e=o.length;return o[0]=='"'&&o[e-1]=='"'&&(o=o.substring(1,e-1),o=o.replaceAll('\\"',"'")),o}l(_s,"trimQuotes");var Jt=class extends me{svgs;constructor(){super(),this.svgs=new Map}load(e){if(this.svgs.has(e)){let t=this.svgs.get(e);t&&this.signal("loaded",Et(e,t))}else this.svgs.set(e,null),l(async i=>{if(i.substring(0,24)=="data:image/svg+xml;utf8,"){let s=i.substring(24);this.svgs.set(i,s),this.signal("loaded",Et(i,s))}else{let s=await fetch(i);if(s.ok){let n=await s.text();!n.startsWith("<svg")&&!n.startsWith("<?xml")?(console.error("svg loading error: ",n),this.signal("loaded",Et(i,""))):(this.svgs.set(i,n),this.signal("loaded",Et(i,n)))}}},"_load")(e)}};l(Jt,"Loader");var Ui=new Jt,Qt=class extends u{m_icon;m_iconName;constructor(e){B(e)?super({icon:e}):super(e),this._setIcon(this.m_props.icon,!1),this.m_props.size&&this.setStyleValue("fontSize",this.m_props.size)}_setIcon(e,t){if(!e){this.m_iconName="";return}this.removeClass("@svg");let i,s;if(typeof e=="number")e=e.toString(16),i=e,console.error("deprecation error: invalid icon name");else{let a=/\s*var\s*\(\s*(.+)\s*\)\s*/gi,h=a.exec(e);for(;h;){let E=h[1].trim();if(e=he.getVar(E).trim(),e==""||e===void 0){console.error(`icon: unable to find variable named '${E}'`);return}else e=_s(e);h=a.exec(e)}if(e.startsWith("<svg")){this._setSVG("data:image/svg+xml;utf8,"+e);return}let m=/\s*svg\s*\(\s*(.+)\s*\)\s*/gi,c=/(.*\.svg)$/gi,d=m.exec(e)||c.exec(e);if(d){let E=d[1].trim();this._setSVG(E);return}let g=/^\s*(data\:image\/.+)\s*$/gi.exec(e);if(g){this._setSVG(g[1]);return}let _=/\s*cls\s*\(\s*(.+)\s*\)\s*/gi.exec(e);if(_){let E=_[1].trim();this.addClass(E);return}let S=/\s*url\s*\(\s*(.+)\s*\)\s*/gi.exec(e);if(S){s=_s(S[1].trim()),s=s.replaceAll("\\",""),this._setSVG(s);return}else console.error("deprecation error: invalid icon name"),i=e,e=he.getVar("icon-"+e),(e==""||e===void 0)&&(e="0")}if(this.m_iconName=i,this.m_icon===e)return;let n=u.getCss(),r;if(t&&this.m_icon&&(r="icon-"+i,this.removeClass(r)),r="icon-"+i,Qt.icon_cache[r]===void 0){Qt.icon_cache[r]=!0;let a;s?a=`display: block; content: ' '; background-image: url(${s}); background-size: contain; width: 100%; height: 100%; background-repeat: no-repeat; color: white;`:a=`content: "\\${e}";`,n.setRule(r,`.${r}::before {${a}}`)}this.addClass(r),this.m_icon=e}set icon(e){this._setIcon(e,!0)}get icon(){return this.m_iconName}_setSVG(e){let t=l(i=>{i.url==e&&(this.addClass("@svg-icon"),this.setContent(K.from(i.svg),!1),Ui.off("loaded",t))},"set");Ui.on("loaded",t),Ui.load(e)}_setSVGPath(e){this.addClass("@svg-icon"),this.setContent(K.from(`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="${e}/></svg>`),!1)}},L=Qt;l(L,"Icon"),k(L,"icon_cache",[]);var I=class extends u{constructor(e){typeof e=="string"||e instanceof K?super({text:e}):super(e)}render(e){let t=this.m_props.text;this.m_props.multiline&&!(t instanceof K)&&(t=new K(gt(t,!0))),e.icon?(this.setTag("span"),this.addClass("@hlayout"),this.setContent([new L({icon:e.icon}),new u({content:t,ref:"text"})])):this.setContent(t),this.addClass(e.align??"left")}set text(e){let t=this.m_props;if(t.text!==e){t.text=e;let i=this.m_props.text;if(this.m_props.multiline&&!(i instanceof K)&&(i=new K(gt(i,!0))),this.dom){let s=this;this.m_props.icon&&(s=this.itemWithRef("text")),s.setContent(i)}}}get text(){return this.m_props.text}};l(I,"Label");var ei=class extends u{};l(ei,"MenuSeparator");var ti=class extends I{};l(ti,"MenuTitle");var q=class extends ${m_subMenu;m_opener;m_virtual;m_lock;constructor(e,t){super(e),this.addClass("@shadow"),this.m_opener=t,this.m_virtual=!1,this.m_lock=0,this.enableMask(!1)}lock(e){this.m_lock+=e?1:-1}setVirtual(){this.m_virtual=!0}setSubMenu(e){this.m_subMenu=e}hideSubMenu(){this.m_subMenu&&(this.m_subMenu.m_opener._close(),this.m_subMenu.hide(),this.m_subMenu=null)}render(e){this.setContent(e.items)}show(){this.m_virtual||q._addMenu(this),super.show()}close(){!this.dom&&!this.m_virtual||(this.m_opener&&this.m_opener._close(),this.m_subMenu&&(this.m_subMenu.close(),this.m_subMenu=null),super.close(),q._removeMenu())}clear(){this.m_props.items=[]}static _addMenu(e){q.watchCount==0&&(q.rootMenu=e,f.addEventListener("mousedown",q._mouseWatcher)),q.watchCount++}static _removeMenu(){console.assert(q.watchCount>0),q.watchCount--,q.watchCount==0&&f.removeEventListener("mousedown",q._mouseWatcher)}static _mouseWatcher(e){if(e.defaultPrevented)return;let t=e.target;for(;t;){let i=u.getElement(t);if(i&&i instanceof q)return;t=t.parentElement}q._discardAll()}static _discardAll(){q.rootMenu&&(q.rootMenu.close(),q.rootMenu=null)}displayAt(...e){this.m_lock||q._discardAll();let t,i,s,n;e.length==1?{x:t,y:i}=re(e[0],!0):[t,i,s,n]=e,s||(s="top left"),super.displayAt(t,i,s,n)}},te=q;l(te,"Menu"),k(te,"watchCount",0),k(te,"rootMenu",null);var ue=class extends u{m_menu;m_isOpen;m_action;constructor(e,t){e instanceof wt?(super({click:()=>{e.fire()}}),this.m_action=e):B(e)?super({text:e,click:t}):super(e),this.mapPropEvents(this.m_props,"click"),this.m_menu=null,this.m_isOpen=!1,this.setDomEvent("mousedown",i=>this._mousedown(i)),this.setDomEvent("click",i=>this._click(i))}render(e){let t=e.icon??0,i=e.text;e.checked!==void 0&&(t=e.checked?"var( --x4-icon-check )":0),this.m_action&&(t||(t=this.m_action.props.icon),i===void 0&&(i=this.m_action.props.text));let s=null;this.isPopup&&(this.addClass("@popup-menu-item"),s=new L({icon:"var( --x4-icon-chevron-right )",cls:"pop-mark"})),!i&&!t&&this.addClass("@separator"),e.cls&&this.addClass(e.cls),this.setTag("a"),this.setContent([t<0?null:new L({icon:t}),new I({flex:1,text:i}),s])}get id(){return this.m_props.itemId}get text(){return this.m_props.text}get isPopup(){return!!this.m_props.items}_close(){this.removeClass("@opened"),this.m_isOpen=!1}_click(e){this.isPopup||(this.emit("click",ne()),te._discardAll())}_mousedown(e){if(this.isPopup){this.m_menu||(this.m_menu=new te({items:this.m_props.items},this));let t=this.m_isOpen,i=u.getElement(this.dom,te);if(i&&i.hideSubMenu(),!t){i&&i.setSubMenu(this.m_menu),this.m_isOpen=!0;let s=this.getBoundingRect();this.m_menu.lock(!0),i?this.m_menu.displayAt(s.right,s.top):this.m_menu.displayAt(s.left,s.bottom),this.m_menu.lock(!1),this.addClass("@opened")}e.preventDefault()}}};l(ue,"MenuItem");var ii=class extends w{m_items;constructor(e,t){super(e),console.assert(!1,"not imp"),this.addClass("@shadow"),this.m_items=e.items}render(){this.setContent(this.m_items)}};l(ii,"MenuBar");var yt=class extends H{m_selection;m_defer_sel;m_container;m_view;m_topIndex;m_itemHeight;m_cache;constructor(e){super(e),this.setDomEvent("keydown",t=>this.handleKey(t)),this.setDomEvent("click",t=>this._handleClick(t)),this.setDomEvent("dblclick",t=>this._handleClick(t)),this.setDomEvent("contextmenu",t=>this._handleCtxMenu(t)),this._setTabIndex(e.tabIndex,0),this.mapPropEvents(e,"click","dblClick","contextMenu","selectionChange","cancel")}componentCreated(){this.m_props.virtual?this._buildItems():this.m_props.populate&&(this.items=this.m_props.populate(null))}render(e){e.items=e.items||[],e.gadgets=e.gadgets,e.renderItem=e.renderItem,e.virtual=e.virtual??!1,this.m_topIndex=0,e.virtual?(console.assert(e.itemHeight!==void 0),this.m_itemHeight=e.itemHeight,this.m_cache=new Map,this.addClass("virtual")):(this.m_itemHeight=void 0,this.m_cache=void 0),this._buildContent()}set items(e){this.setItems(e)}get items(){return this.m_props.items}setItems(e,t=!0){this.m_props.items=e,t||(this.m_selection=null),this.m_container?this._buildItems():this._buildContent()}handleKey(e){let t=l(i=>{let s;Z(this.m_props.items)?(s=this.m_props.items(),this.m_props.items=s):s=this.m_props.items;let n;if(!this.m_selection)s&&(n=s[0]);else{let a=s.findIndex(h=>h===this.m_selection.item);i>0&&a<s.length-1?n=s[a+1]:i<0&&a>0?n=s[a-1]:n=this.selection}let r=this._findItemWithId(n?.id);this._selectItem(n,r,!0)},"moveSel");switch(e.key){case"ArrowDown":{t(1),e.preventDefault(),e.stopPropagation();break}case"ArrowUp":{t(-1),e.preventDefault(),e.stopPropagation();break}}}_buildContent(){let e=this.m_props;e.virtual?(this.m_container=new O({cls:"@scroll-container",content:[]}),this.m_view=new O({cls:"@scroll-view",flex:1,content:this.m_container,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)}}),this.setContent([this.m_view,e.gadgets?new w({cls:"gadgets",content:e.gadgets}):null])):(this.m_view=void 0,this.m_container=new H({cls:"@scroll-container",content:[]}),this.addClass("@scroll-view"),this.setContent(this.m_container,!1)),e.virtual&&this.m_container.setStyleValue("height",e.items.length*this.m_itemHeight),(this.dom||!e.virtual)&&this._buildItems()}_updateScroll(e){let t=l(()=>{let i=Math.floor(this.m_view.dom.scrollTop/this.m_itemHeight);(i!=this.m_topIndex||e)&&(this.m_topIndex=i,this._buildItems())},"update");e?this.startTimer("scroll",10,!1,t):t()}async _buildItems(){let e=this.m_props,t=[],i=e.items;Z(i)&&(i=i());let s=this.m_selection?.item.id,n=!1;if(e.virtual){let r=this.getBoundingRect(),a=100,h=0,m=this.m_topIndex*this.m_itemHeight,c=this.m_topIndex,d=r.height,p=e.items.length,g=[],x=this.m_cache;for(this.m_cache=new Map;h<d&&c<p&&--a>0;){let _=e.items[c],F;x.has(_.id)?(F=x.get(_.id),x.delete(_.id)):(F=this._renderItem(_),g.push(F)),s==_.id&&(F.addClass("@selected"),n=!0),F.setStyleValue("top",m+h),t.push(F),this.m_cache.set(_.id,F),h+=this.m_itemHeight,c++}x.forEach(_=>{_.dispose()}),this.m_container.appendChild(g),this.m_container.setStyleValue("height",p*this.m_itemHeight),n||i.some(_=>s==_.id)||(this.m_selection=null)}else i.forEach(r=>{let a=this._renderItem(r);s==r.id&&(a.addClass("@selected"),n=!0),t.push(a)}),this.m_container.setContent(t,!1),n||(this.m_selection=null);if(this.m_defer_sel){let r=this.m_defer_sel;this.m_defer_sel=void 0,this.selection=r}}_renderItem(e){let t=this.onRenderItem(e);return t.setAttribute("data-id",e.id),t.addClass("@list-item"),t.setData("item-id",e.id),t}onRenderItem(e){return this.m_props.renderItem?this.m_props.renderItem(e):new w({content:e.text})}_handleClick(e){e.stopImmediatePropagation(),e.preventDefault();let t=e.target,i=this.dom,s=this.m_props.items;for(;t&&t!=i;){let n=u.getElement(t),r=n?.getData("item-id");if(r!==void 0){let a=s.find(h=>h.id==r);if(a){let h;e.type=="click"?(h=ne(a),this.emit("click",h)):(h=ye(a),this.emit("dblClick",h)),h.defaultPrevented||this._selectItem(a,n)}else this._selectItem(null,null);return}t=t.parentElement}this._selectItem(null,null)}_handleCtxMenu(e){e.preventDefault();let t=e.target,i=this.dom,s=this.m_props.items;for(;t&&t!=i;){let n=u.getElement(t),r=n?.getData("item-id");if(r){let a=s.find(h=>h.id==r);a&&(this._selectItem(a,n),this.emit("contextMenu",pe(e,a)));return}t=t.parentElement}this.emit("contextMenu",pe(e,null))}_selectItem(e,t,i=!0){this.m_selection&&this.m_selection.citem&&this.m_selection.citem.removeClass("@selected"),this.m_selection=e?{item:e,citem:t}:null,this.m_selection&&this.m_selection.citem&&this.m_selection.citem.addClass("@selected"),i&&this.emit("selectionChange",ie(e))}get selection(){return this.m_selection?this.m_selection.item:null}set selection(e){if(e==null)this._selectItem(null,null);else if(Z(this.m_props.items))this.m_defer_sel=e;else{let t=this.m_props.items.find(s=>s.id==e),i=this._findItemWithId(t.id);this._selectItem(t,i,!1)}}_findItemWithId(e){let t=null;return this.dom&&this.m_container.enumChilds(i=>{if(i.getData("item-id")==e)return i.scrollIntoView(),t=i,!0}),t}appendItem(e,t=!1,i=!0){t?this.m_props.items.unshift(e):this.m_props.items.push(e),i&&(this.selection=null),this.m_container?this._buildItems():this._buildContent(),i&&(this.selection=e.id)}updateItem(e,t){let i=this.m_props.items.findIndex(r=>r.id===e);if(i<0)return;let s=!1;this.m_selection&&this.m_selection.item===this.m_props.items[i]&&(s=!0),this.m_props.items[i]=t;let n=this.queryItem(`[data-id="${t.id}"]`)?.dom;if(n){let r=this._renderItem(t);s&&(r.addClass("@selected"),this.m_selection.citem=r,this.m_selection.item=t);let a=r._build();this.m_container.dom.replaceChild(a,n)}}};l(yt,"ListView");function xs(o=null){return P({context:o})}l(xs,"EvCancel");var Se=class extends ${m_list;constructor(e){super({tabIndex:!1}),this.enableMask(!1),this.addClass("@non-maskable"),e.tabIndex=!1,this.m_list=new yt(e),this.setContent(this.m_list),this.mapPropEvents(e,"cancel")}set items(e){this.m_list.items=e}handleKey(e){this.m_list.handleKey(e)}_handleClick=e=>{if(!this.dom)return;let t=e.target;this.dom.contains(t)||u.getElement(t,ue)||(this.signal("cancel",xs()),this.close())};show(e){f.addEventListener("mousedown",this._handleClick),super.show(e)}hide(){f.removeEventListener("mousedown",this._handleClick),super.hide()}close(){f.removeEventListener("mousedown",this._handleClick),super.close()}get selection(){return this.m_list.selection}set selection(e){this.m_list.selection=e}};l(Se,"PopupListView");var j=class extends u{constructor(e){super(e)}render(e){this.setTag("input"),this._setTabIndex(e.tabIndex),this.setAttributes({value:e.value,type:e.type||"text",name:e.name,placeholder:e.placeHolder,autofocus:e.autoFocus,readonly:e.readOnly,autocomplete:"new-password",tabIndex:e.tabIndex,spellcheck:e.spellcheck===!1?"false":void 0,min:e.min,max:e.max,...e.attrs}),this.m_props.autosel=e.autosel??!0,e.uppercase&&this.setStyleValue("textTransform","uppercase"),this.m_props.autosel&&this.setDomEvent("focus",()=>{this.selectAll()})}getType(){return this.m_props.type}get value(){if(this.dom&&(this.m_props.value=this.dom.value),this.m_props.uppercase){let e=this.m_props.value.toUpperCase();this.dom&&e!=this.m_props.value&&(this.dom.value=e),this.m_props.value=e}return this.m_props.value}set value(e){this.m_props.value=e,this.dom&&(this.dom.value=e)}getStoreValue(){if(this.m_props.value_hook)return this.m_props.value_hook.get();{let e=this.getAttribute("type");e&&(e=e.toLowerCase());let t,i=this.dom;if(e==="file"){t=[];let s=i.files;for(let n=0;n<s.length;n++)t.push(s[n].name)}else if(e==="checkbox")i.checked?t=1:t=0;else if(e==="radio")i.checked&&(t=this.value);else if(e==="date")debugger;else t=this.value;return t}}setStoreValue(e){if(this.m_props.value_hook)return this.m_props.value_hook.set(e);{let t=this.getAttribute("type"),i=this.dom;if(t&&(t=t.toLowerCase()),t==="checkbox"){let s=e!==null&&e!=="0"&&e!==0&&e!==!1;s!==i.checked&&(i.setAttribute("checked",""+s),i.dispatchEvent(new Event("change")))}else this.value=e}}set readOnly(e){this.setAttribute("readonly",e)}selectAll(){this.dom.select()}select(e,t=9999){this.dom.setSelectionRange(e,e+t)}getSelection(){let e=this.dom;return{start:e.selectionStart,length:e.selectionEnd-e.selectionStart}}};l(j,"Input");var ot=class extends u{constructor(e){super(e),this.setTag("button"),this.setDomEvent("click",t=>this._handleClick(t)),this.setDomEvent("mousedown",()=>{this._startAutoRep(!0)}),this.setDomEvent("mouseup",()=>{this._startAutoRep(!1)}),this.setDomEvent("keydown",t=>this._handleKeyDown(t)),this.mapPropEvents(e,"click")}render(e){let t=e.action,i=e.icon,s=e.text;t&&(!i&&t.props.icon&&(i=t.props.icon),s===void 0&&t.props.text&&(s=t.props.text));let n=i?new L({icon:i,cls:"left",ref:"l_icon"}):null,r=new I({flex:1,text:s??"",align:e.align,ref:"label"}),a=e.rightIcon?new L({icon:e.rightIcon,cls:"right",ref:"r_icon"}):null;s===void 0&&r.addClass("@hidden"),this.setContent([n,r,a]),this._setTabIndex(e.tabIndex)}_startAutoRep(e){this.m_props.autoRepeat&&(e?this.startTimer("repeat",700,!1,()=>{this.startTimer("repeat",this.m_props.autoRepeat,!0,this._sendClick)}):this.stopTimer("repeat"))}_handleKeyDown(e){!e.ctrlKey&&!e.shiftKey&&!e.altKey&&(e.key=="Enter"||e.key==" ")&&(this._sendClick(),e.preventDefault(),e.stopPropagation())}_handleClick(e){if(this.m_props.menu){let t=new te({items:Z(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),i=this.getBoundingRect();t.displayAt(i.left,i.bottom,"tl")}else this._sendClick();e.preventDefault(),e.stopPropagation()}_sendClick(){if(this.m_props.menu){let e=new te({items:Z(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),t=this.getBoundingRect();e.displayAt(t.left,t.bottom,"tl")}else this.emit("click",ne()),this.m_props.action&&this.m_props.action.fire()}set text(e){this.m_props.text=e;let t=this.itemWithRef("label");t&&(t.text=e,t.removeClass("@hidden"))}get text(){return this.itemWithRef("label")?.text}set icon(e){this.m_props.icon=e;let t=this.itemWithRef("l_icon");t?t.icon=e:this.update()}get icon(){return this.itemWithRef("l_icon")?.icon}set rightIcon(e){this.m_props.rightIcon=e;let t=this.itemWithRef("r_icon");t&&(t.icon=e)}get rightIcon(){return this.itemWithRef("l_icon")?.icon}set menu(e){this.m_props.menu=e}};l(ot,"BaseButton");var z=class extends ot{};l(z,"Button");var si=class extends ot{constructor(e){super(e)}render(e){super.render(e),e.checked&&(this.addClass("checked"),this._updateIcon())}_sendClick(){super._sendClick(),this.m_props.checked=!this.m_props.checked,this.setClass("checked",this.m_props.checked),this.emit("change",M(this.m_props.checked)),this._updateIcon()}_updateIcon(){if(this.m_props.checkedIcon){let e=this.m_props.checked?this.m_props.checkedIcon:this.m_props.icon,t=this.itemWithRef("l_icon");t&&(t.icon=e)}}};l(si,"ToggleButton");var Ft=class extends H{m_date;constructor(e){super(e),this.mapPropEvents(e,"change"),this.m_date=e.date?.clone()??new Date}render(e){let t=Qe(this.m_date);t.setDate(1);let i=t.getDay();i==0&&(i=7),t.setDate(-i+1+1);let s=Qe(t),n=this.m_date.hash(),r=Qe(this.m_date);r.setDate(1),r.setMonth(r.getMonth()+1),r.setDate(0);let a=Je(r),h=[],m=new w({cls:"month-sel",content:[new I({cls:"month",text:G(this.m_date,"O"),dom_events:{click:()=>this._choose("month")}}),new I({cls:"year",text:G(this.m_date,"Y"),dom_events:{click:()=>this._choose("year")}}),new Ee,new z({text:"<",click:()=>this._next(!1)}),new z({text:">",click:()=>this._next(!0)})]});h.push(m);let c=[];c.push(new w({cls:"weeknum cell"}));for(let g=0;g<7;g++)c.push(new I({cls:"cell",flex:1,text:D.global.day_short[(g+1)%7]}));h.push(new w({cls:"week header",content:c}));let d=this.m_date.getMonth(),p=!0;for(;Je(s)<=a;){let g=[new w({cls:"weeknum cell",content:new u({tag:"span",content:G(s,"w")})})];for(let x=0;x<7;x++){let _="cell day";s.hash()==n&&(_+=" today"),s.getMonth()!=d&&(_+=" out");let F=l(S=>new w({cls:_,flex:1,content:new u({tag:"span",content:G(S,"d")}),dom_events:{click:()=>this.select(S)}}),"mkItem");g.push(F(s.clone())),s.setDate(s.getDate()+1),p=!1}h.push(new w({cls:"week",flex:1,content:g}))}this.setContent(h)}select(e){this.m_date=e,this.emit("change",M(e)),this.update()}_next(e){this.m_date.setMonth(this.m_date.getMonth()+(e?1:-1)),this.update()}_choose(e){let t=[];if(e=="month")for(let n=0;n<12;n++)t.push(new ue({text:D.global.month_long[n],click:()=>{this.m_date.setMonth(n),this.update()}}));else if(e=="year"){let n=this.m_props.minDate?.getFullYear()??1900,r=this.m_props.maxDate?.getFullYear()??2037;for(let a=n;a<r;a++)t.push(new ue({text:""+a,click:()=>{this.m_date.setFullYear(a),this.update()}}))}let i=new te({items:t}),s=this.getBoundingRect();i.displayAt(s.left,s.top)}get date(){return this.m_date}set date(e){this.m_date=e,this.update()}};l(Ft,"Calendar");var at=class extends ${m_cal;constructor(e){super({tabIndex:1}),this.enableMask(!1),this.m_cal=new Ft(e),this.m_cal.addClass("@fit"),this.setContent(this.m_cal)}_handleClick=e=>{if(!this.dom)return;let t=e.target;this.dom.contains(t)||u.getElement(t,ue)||this.close()};show(e,t){f.addEventListener("mousedown",this._handleClick),t?super.displayAt(t.x,t.y,"top left",void 0,e):super.show(e)}close(){f.removeEventListener("mousedown",this._handleClick),super.close()}};l(at,"PopupCalendar");var Ki,Fe,Ne=class extends u{m_text;set text(e){this.m_text.text=e}render(){this.setClass("@non-maskable",!0),this.setContent([new L({icon:"var( --x4-icon-tip )"}),this.m_text=new I({text:"help"})])}displayAt(e,t,i="top left"){this.show();let s="l",n="t";i.indexOf("right")>=0&&(s="r"),i.indexOf("bottom")>=0&&(n="b");let r=f.body.getBoundingClientRect(),a=this.getBoundingRect();s=="r"&&(e-=a.width),n=="b"&&(t-=a.height),e+a.width>r.right&&(e=r.right-a.width),t+a.height>r.bottom&&(t=r.bottom-a.height-17),this.setStyle({left:e,top:t})}};l(Ne,"Tooltip");function dn(o){if(ft())return;let e={target:null,x:0,y:0};function t(n){e.x=n.pageX,e.y=n.pageY}l(t,"handle_mpos");function i(n){let r=n.target,a=null;for(e.x=n.pageX+10,e.y=n.pageY+15;r&&(a=r.getAttribute("tip"),!a);)r=r.parentElement;if(!(r==e.target||Fe&&r==Fe.dom)){if(!r||!a){e.target=null,o?o(null):s();return}e.target=r,o?o(null):s(),o?o(a):Ki=setTimeout(()=>{Fe===void 0&&(Fe=new Ne({}),f.body.appendChild(Fe._build())),Fe.text=a,Fe.displayAt(e.x+17,e.y+17,"top left")},700)}}l(i,"handle_mouse");function s(){Ki&&clearTimeout(Ki),Fe&&Fe.hide()}l(s,"_hideTip"),f.body.addEventListener("mouseover",i),f.body.addEventListener("mouseout",i),f.body.addEventListener("mousemove",t)}l(dn,"initTooltips");var pn=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,U=class extends u{m_cal_popup;m_ui_input;m_error_tip;constructor(e){super(e),this.addClass("@hlayout"),this.mapPropEvents(e,"change","click","focus")}componentCreated(){super.componentCreated(),this.m_props.autoFocus&&this.focus()}componentDisposed(){this.m_error_tip&&this.m_error_tip.dispose(),super.componentDisposed()}focus(){this.m_ui_input.focus()}render(e){let t={flex:1,dom_events:{focus:()=>this._focus(),focusout:()=>this._blur(),input:()=>this._change()},value:e.value,name:e.name,type:e.type,placeHolder:e.placeHolder,autoFocus:e.autoFocus,readOnly:e.readOnly,value_hook:e.value_hook,uppercase:e.uppercase,spellcheck:e.spellcheck,tabIndex:e.tabIndex===void 0?!0:e.tabIndex,attrs:e.attrs,min:e.min,max:e.max,autosel:e.autosel};if(e.type=="date"){e.format=e.format??"Y-M-D",t.type="text";let p={get:()=>this._date_get_hook(),set:g=>this._date_set_hook(g)};t.value_hook=e.value_hook??p}this.m_ui_input=new j(t);let i;e.icon?i=new z({icon:e.icon,click:()=>this._btnClick(),tabIndex:!1}):e.type=="date"&&(i=new z({cls:"gadget",icon:"var( --x4-icon-calendar-days )",tabIndex:!1,click:()=>this._showDatePicker(i)}),e.validator||(e.validator=this._date_validator));let s=e.gadgets??[];s.forEach(p=>{p.addClass("gadget")});let n=[i,...s];this.setClass("@required",e.required),e.gadgets&&e.gadgets.length&&this.addClass("with-gadgets");let r,a,h=e.labelWidth;h>0&&(r=h),h<0&&(a=-h);let m,c=e.labelAlign,d=!1;e.label&&(c=="top"&&(c="left",d=!0,a=1),m=new I({ref:"label",tag:"label",cls:"label1"+(e.label?"":" @hidden"),text:e.label??"",width:r,flex:a,align:c})),d?(this.removeClass("@hlayout"),this.addClass("@vlayout vertical"),this.setContent([m,new w({width:r,content:[this.m_ui_input,...n]})])):(this.addClass("@hlayout"),this.setContent([m,this.m_ui_input,...n]))}enable(e){e===!0&&this.m_ui_input.enable(),super.enable(e)}disable(){this.m_ui_input.disable(),super.disable()}_btnClick(){this.emit("click",ne(this.value))}setDateStoreFormat(e){this.m_props.format=e}setStoreValue(e){this.m_ui_input.setStoreValue(e)}getStoreValue(){return this.m_ui_input.getStoreValue()}_date_get_hook(){let e=_t(this.value),t=this.m_props;return t.format=="native"?e:e?G(e,t.format):null}_date_set_hook(e){let t=this.m_props;if(t.format=="native")this.value=G(e);else if(e){let i=_t(e,t.format);this.value=G(i)}else this.value=""}showError(e){this.m_error_tip||(this.m_error_tip=new Ne({cls:"error"}),f.body.appendChild(this.m_error_tip._build()));let t=this.m_ui_input.getBoundingRect();this.m_error_tip.text=e,this.m_error_tip.displayAt(t.right,t.top,"top left"),this.addClass("@error")}clearError(){this.m_error_tip&&(this.m_error_tip.hide(),this.removeClass("@error"))}get value(){return this.m_ui_input?this.m_ui_input.value:this.m_props.value}set value(e){this.m_ui_input?this.m_ui_input.value=e:this.m_props.value=e}selectAll(){this.m_ui_input.selectAll()}select(e,t=9999){this.m_ui_input.select(e,t)}getSelection(){return this.m_ui_input.getSelection()}set readOnly(e){this.m_ui_input.readOnly=e}get label(){return this.itemWithRef("label")?.text}set label(e){this.itemWithRef("label").text=e}_change(){let e=this.m_ui_input.value;this.emit("change",M(e))}_focus(){this.clearError(),this.emit("focus",Kt(!0))}_blur(){this._validate(this.m_ui_input.value),this.emit("focus",Kt(!1))}validate(){return this._validate(this.value)}_validate(e){let t=this.m_props,i=!1;if(t.required&&e.length==0)return this.showError(D.global.required_field),!1;if(e!=""){let s=this.getAttribute("pattern");if(s){let n=new RegExp(s);if(n&&!n.test(e))return this.showError(D.global.invalid_format),!1}if(t.type=="email"){if(!pn.test(e.toLowerCase()))return this.showError(D.global.invalid_email),!1}else if(t.type=="number"){let n=parseFloat(e);if(isNaN(n))return this.showError(D.global.invalid_number),!1;let r=parseFloat(this.m_ui_input.getAttribute("min"));r!==void 0&&n<r&&(e=""+r,i=!0);let a=parseFloat(this.m_ui_input.getAttribute("max"));a!==void 0&&n>a&&(e=""+a,i=!0)}}if(t.validator)try{this.value=t.validator(e)}catch(s){return this.showError(s instanceof Error?s.message:s),!1}else i&&(this.value=e);return!0}_date_validator(e){if(e=e.trim(),e=="")return"";let t;if(e=="@")t=new Date;else if(t=_t(e),!t)throw Xe(D.global.invalid_date,D.global.date_format);return G(t)}_showDatePicker(e){this.m_cal_popup||(this.m_cal_popup=new at({change:i=>{this.value=G(i.value),this.m_cal_popup.close()}}));let t=this.m_ui_input.getBoundingRect();this.m_cal_popup.displayAt(t.left,t.bottom,"top left")}get input(){return this.m_ui_input}get type(){return this.m_props.type}};l(U,"TextEdit");var ni=class extends U{m_popup;m_popvis;m_needval;m_lockpop;constructor(e){super(e),this.setDomEvent("input",()=>this._onChange()),this.setDomEvent("focusin",()=>this._onFocus()),this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.m_popvis=!1,this.m_needval=!1,this.m_lockpop=!1,this.setDomEvent("keydown",t=>this._onKey(t))}_onKey(e){this.m_popvis?e.key=="ArrowUp"||e.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(e),this.m_lockpop=!1,e.preventDefault(),e.stopPropagation()):e.key=="Escape"&&(this._hidePopup(),e.preventDefault(),e.stopPropagation()):e.key=="ArrowDown"&&(this._onChange(),e.preventDefault(),e.stopPropagation())}_onChange(){let e=this.m_props.enumValues(this.value);this.showPopup(e)}componentDisposed(){this.m_popup&&this._hidePopup(),super.componentDisposed()}showPopup(e){if(this.m_props.readOnly||this.hasClass("@disable"))return;if(!this.m_popup){let s=this.getComputedStyle(),n=s.value("fontFamily"),r=s.value("fontSize");this.m_popup=new Se({cls:"@combo-popup",attrs:{tabindex:0},selectionChange:a=>{this.value=a.selection.id,this.m_lockpop||(this._hidePopup(),this.focus())},style:{fontFamily:n,fontSize:r}})}this.m_popup.items=e.map(s=>({id:s,text:s}));let i=this.m_ui_input.getBoundingRect();this.m_popup.setStyle({minWidth:i.width}),this.m_popup.displayAt(i.left,i.bottom),this.m_popvis=!0}_validate(e){return!0}validate(){return super._validate(this.value)}_checkFocus(){let e=document.activeElement;this.dom&&this.dom.contains(e)||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(e)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1),this.m_needval&&(this.validate(),this.m_needval=!1)}_onFocus(){this.value.length==0&&this._onChange(),this.m_needval=!0}};l(ni,"AutoComplete");function fn(o){return P({ctx:o})}l(fn,"EvPaint");function gn(o,e,t){let i=o;return i.width=e,i.height=t,i.smoothLine=_n,i.smoothLineEx=xn,i.line=bn,i.roundRect=vn,i.calcTextSize=Cn,i.setFontSize=wn,i.circle=En,i}l(gn,"mkPainter");function _n(o,e=null,t=!0){if(o.length<2)return;if(e||(e=this),o.length==2){t!==!1?e.moveTo(o[0].x,o[0].y):e.lineTo(o[0].x,o[0].y),e.lineTo(o[1].x,o[1].y);return}function i(h,m){return{x:h.x+(m.x-h.x)/2,y:h.y+(m.y-h.y)/2}}l(i,"midPointBtw");function s(h,m,c,d,p,g,x){return{x:(1-h)*(1-h)*m+2*(1-h)*h*d+h*h*g,y:(1-h)*(1-h)*c+2*(1-h)*h*p+h*h*x}}l(s,"getQuadraticXY");let n=o[0],r=o[1],a=n;e.moveTo(n.x,n.y);for(let h=1,m=o.length;h<m;h++){let c=i(n,r);for(let d=0;d<8;d++){let{x:p,y:g}=s(d/8,a.x,a.y,n.x,n.y,c.x,c.y);e.lineTo(p,g)}n=o[h],r=o[h+1],a=c}e.lineTo(n.x,n.y)}l(_n,"smoothLine");function xn(o,e=.5,t=10,i=null,s=!0,n=!1){let r=[];for(let b=0,y=o.length;b<y;b++)r.push(o[b].x),r.push(o[b].y);let a,h=1,m=r.length,c=0,d=(m-2)*t+2+(n?2*t:0),p=new Float32Array(d),g=new Float32Array((t+2)*4),x=4;for(a=r.slice(0),n?(a.unshift(r[m-1]),a.unshift(r[m-2]),a.push(r[0],r[1])):(a.unshift(r[1]),a.unshift(r[0]),a.push(r[m-2],r[m-1])),g[0]=1;h<t;h++){var _=h/t,F=_*_,S=F*_,E=S*2,W=F*3;g[x++]=E-W+1,g[x++]=W-E,g[x++]=S-2*F+_,g[x++]=S-F}g[x]=1,A(a,g,m),n&&(a=[],a.push(r[m-4],r[m-3],r[m-2],r[m-1]),a.push(r[0],r[1],r[2],r[3]),A(a,g,4));function A(b,y,N){for(var C=2,T;C<N;C+=2){var de=b[C],Re=b[C+1],dt=b[C+2],$e=b[C+3],qe=(dt-b[C-2])*e,Ce=($e-b[C-1])*e,Pe=(b[C+4]-de)*e,ts=(b[C+5]-Re)*e;for(T=0;T<t;T++){var Rt=T<<2,is=y[Rt],ss=y[Rt+1],ns=y[Rt+2],rs=y[Rt+3];p[c++]=is*de+ss*dt+ns*qe+rs*Pe,p[c++]=is*Re+ss*$e+ns*Ce+rs*ts}}}l(A,"parse"),m=n?0:r.length-2,p[c++]=r[m],p[c]=r[m+1],i||(i=this);for(let b=0,y=p.length;b<y;b+=2)b==0&&s!==!1?i.moveTo(p[b],p[b+1]):i.lineTo(p[b],p[b+1])}l(xn,"smoothLineEx");function bn(o,e,t,i,s,n=1){this.save(),this.beginPath(),this.moveTo(o,e),this.lineTo(t,i),this.lineWidth=n,this.strokeStyle=s,this.stroke(),this.restore()}l(bn,"line");function vn(o,e,t,i,s){this.moveTo(o+s,e),this.lineTo(o+t-s,e),this.quadraticCurveTo(o+t,e,o+t,e+s),this.lineTo(o+t,e+i-s),this.quadraticCurveTo(o+t,e+i,o+t-s,e+i),this.lineTo(o+s,e+i),this.quadraticCurveTo(o,e+i,o,e+i-s),this.lineTo(o,e+s),this.quadraticCurveTo(o,e,o+s,e),this.closePath()}l(vn,"roundRect");function Cn(o,e=!1){let t=this.measureText(o),i=t.fontBoundingBoxAscent+t.fontBoundingBoxDescent;return e?{width:Math.round(t.width),height:Math.round(i)}:{width:t.width,height:i}}l(Cn,"calcTextSize");function wn(o){let e=Math.round(o)+"px";this.font=this.font.replace(/\d+px/,e)}l(wn,"setFontSize");function En(o,e,t){this.moveTo(o+t,e),this.arc(o,e,t,0,Math.PI*2)}l(En,"circle");var ri=class extends u{m_iwidth=-1;m_iheight=-1;m_scale=1;m_canvas;constructor(e){super(e),this.setDomEvent("sizechange",()=>{this._paint()}),this.mapPropEvents(e,"paint")}render(){this.m_iwidth=-1,this.m_iheight=-1,this.m_canvas=new u({tag:"canvas"}),this.setContent(this.m_canvas)}update(e=0){this.m_iheight=this.m_iwidth=-1,super.update(e)}scale(e){this.m_scale=e,this.m_iwidth=-1,this.redraw()}get canvas(){return this.m_canvas}$update_rep=0;redraw(e){e!==void 0?++this.$update_rep>=20?(this.stopTimer("update"),this._paint()):this.startTimer("update",e,!1,()=>this._paint()):(this.stopTimer("update"),this._paint())}_paint(){this.$update_rep=0;let e=this.dom;if(!this.isUserVisible())return;let t=this.m_canvas.dom,i=e.clientWidth,s=e.clientHeight,n=t.getContext("2d");if(i!=this.m_iwidth||s!=this.m_iheight){let r=window.devicePixelRatio||1,a=n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1,h=this.canvas;if(r!==a||this.m_scale!=1){let m=r/a,c=i*m,d=s*m;h.setAttribute("width",""+c),h.setAttribute("height",""+d),h.setStyleValue("width",i),h.setStyleValue("height",s),m*=this.m_scale,n.scale(m,m)}else h.setAttribute("width",""+i),h.setAttribute("height",""+s),h.setStyleValue("width",i),h.setStyleValue("height",s),n.scale(1,1);this.m_iwidth=i,this.m_iheight=s}if(i&&s){let r=gn(n,i,s);this.m_props.autoClear&&r.clearRect(0,0,i,s),r.save(),r.translate(-.5,-.5),this.paint(r),r.restore()}}paint(e){try{this.m_props.painter?this.m_props.painter(e):this.emit("paint",fn(e))}catch(t){console.assert(!1,t)}}};l(ri,"Canvas");var Ae=class extends u{m_cards;m_ipage;m_cpage;constructor(e){super(e),this.m_cards=[],this.m_ipage=e.active,this.m_cpage=null,this.singleShot(()=>{this.setPages(e.pages)})}render(){let e=[];this.m_cards.forEach(t=>{t.page&&e.push(t.page)}),this.setContent(e)}switchTo(e){if(this.m_cards.length!=0&&(e===void 0&&(e=this.m_cards[0].name),e!==this.m_cpage?.name)){if(this.m_cpage&&(this.m_cpage.selector&&this.m_cpage.selector.removeClass("@active"),this.m_cpage.page&&!(this.m_cpage.page instanceof Function))){let t=this.m_cpage.page;t.removeClass("@active"),t.addClass("@hidden")}if(this.m_cpage=this.m_cards.find(t=>t.name==e),this.m_cpage){if(this.m_cpage.page){Z(this.m_cpage.page)&&(this.m_cpage.page=this.m_cpage.page(),console.assert(this.m_cpage.page!=null,"You must return a valid component"));let t=this.m_cpage.page;t.addClass("@active"),t.removeClass("@hidden"),t.dom||this._preparePage(t),this.m_cpage.selector&&this.m_cpage.selector.addClass("@active")}this.emit("change",M(this.m_cpage.name))}}}setPages(e){let t=this._initTabs(e);t&&ce(()=>{this.switchTo(t),this.update()})}_initTabs(e){if(!e)return;let t=this.m_ipage;return e.forEach(i=>{if(!i)return;let s={...i};s.selector=this._prepareSelector(i),s.active=!1,this.m_cards.push(s),t||(t=i.name),i.active&&(t=i.name)}),t}_updateSelector(){}_prepareSelector(e){return null}_preparePage(e){e.setStyleValue("flex",1),e.addClass("@tab-page")}};l(Ae,"CardView");var ke=class extends u{constructor(e){super(e),this.setDomEvent("focus",()=>this._setFocus()),this.mapPropEvents(e,"change"),e.slider&&this.addClass("slider")}render(e){let t=e.labelWidth??-1,i="__cb_"+this.uid;this.setTag("label"),this.addClass("@hlayout"),this.addClass(e.align??"left"),this.setContent([new j({ref:"input",type:"checkbox",name:e.name,id:i,tabIndex:e.tabIndex,value:e.value??"on",attrs:{checked:e.checked?"":void 0},dom_events:{change:this._change.bind(this)}}),e.slider?new u({cls:"@slide-el"}):null,new I({text:e.text??"",width:t<0?void 0:t,flex:t<0?-t:void 0,align:e.labelAlign??"left",style:{order:e.align=="right"?-1:1},attrs:{for:i}})])}_change(){this.emit("change",M(this.check))}_setFocus(){this.itemWithRef("input").focus()}get check(){return this.dom?this.itemWithRef("input").dom.checked:this.m_props.checked}set check(e){if(this.dom){let i=this.itemWithRef("input").dom;i&&(i.checked=e)}this.m_props.checked=e}get text(){return this.itemWithRef("label").text}set text(e){this.itemWithRef("label").text=e}toggle(){this.check=!this.check}};l(ke,"CheckBox");var bs={lightsalmon:4294942842,lightseagreen:4280332970,lightskyblue:4287090426,lightslategray:4286023833,lightsteelblue:4289774814,lightyellow:4294967264,lime:4278255360,limegreen:4281519410,linen:4294635750,magenta:4294902015,maroon:4286578688,mediumaquamarine:4284927402,mediumblue:4278190285,mediumorchid:4290401747,mediumpurple:4287852763,mediumseagreen:4282168177,mediumslateblue:4286277870,mediumspringgreen:4278254234,mediumturquoise:4282962380,mediumvioletred:4291237253,midnightblue:4279834992,mintcream:4294311930,mistyrose:4294960353,moccasin:4294960309,navajowhite:4294958765,navy:4278190208,oldlace:4294833638,olive:4286611456,olivedrab:4285238819,orange:4294944e3,orangered:4294919424,orchid:4292505814,palegoldenrod:4293847210,palegreen:4288215960,paleturquoise:4289720046,palevioletred:4292571283,papayawhip:4294963157,peachpuff:4294957753,peru:4291659071,pink:4294951115,plum:4292714717,powderblue:4289781990,purple:4286578816,red:4294901760,rosybrown:4290547599,royalblue:4282477025,saddlebrown:4287317267,salmon:4294606962,sandybrown:4294616160,seagreen:4281240407,seashell:4294964718,sienna:4288696877,silver:4290822336,skyblue:4287090411,slateblue:4285160141,slategray:4285563024,snow:4294966010,springgreen:4278255487,steelblue:4282811060,tan:4291998860,teal:4278222976,thistle:4292394968,tomato:4294927175,turquoise:4282441936,violet:4293821166,wheat:4294303411,white:4294967295,whitesmoke:4294309365,yellow:4294967040,yellowgreen:4288335154,aliceblue:4293982463,antiquewhite:4294634455,aqua:4278255615,aquamarine:4286578644,azure:4293984255,beige:4294309340,bisque:4294960324,black:4278190080,blanchedalmond:4294962125,blue:4278190335,blueviolet:4287245282,brown:4289014314,burlywood:4292786311,cadetblue:4284456608,chartreuse:4286578432,chocolate:4291979550,coral:4294934352,cornflowerblue:4284782061,cornsilk:4294965468,crimson:4292613180,cyan:4278255615,darkblue:4278190219,darkcyan:4278225803,darkgoldenrod:4290283019,darkgray:4289309097,darkgreen:4278215680,darkkhaki:4290623339,darkmagenta:4287299723,darkolivegreen:4283788079,darkorange:4294937600,darkorchid:4288230092,darkred:4287299584,darksalmon:4293498490,darkseagreen:4287609999,darkslateblue:4282924427,darkslategray:4281290575,darkturquoise:4278243025,darkviolet:4287889619,deeppink:4294907027,deepskyblue:4278239231,dimgray:4285098345,dodgerblue:4280193279,firebrick:4289864226,floralwhite:4294966e3,forestgreen:4280453922,fuchsia:4294902015,gainsboro:4292664540,ghostwhite:4294506751,gold:4294956800,goldenrod:4292519200,gray:4286611584,green:4278222848,greenyellow:4289593135,honeydew:4293984240,hotpink:4294928820,indianred:4291648604,indigo:4283105410,ivory:4294967280,khaki:4293977740,lavender:4293322490,lavenderblush:4294963445,lawngreen:4286381056,lemonchiffon:4294965965,lightblue:4289583334,lightcoral:4293951616,lightcyan:4292935679,lightgoldenrodyellow:4294638290,lightgreen:4287688336,lightgrey:4292072403,lightpink:4294948545,none:0,transparent:0},R=class{m_value;constructor(e,t,i,s){let n=arguments.length,r=this;function a(){if(!n)return 4278190080;if(n==1)return Number.isSafeInteger(e)?4278190080|e&16777215:r._getCustomColor(e);if(n==2){let h,m=((t*255|0)&255)<<24;return Number.isSafeInteger(e)?h=e:h=r._getCustomColor(e),h&16777215|m}else if(n==4&&s!==void 0&&s<=1)return s<=0?0:(s=s*255,s|=0,(s&255)<<24|(e&255)<<16|(t&255)<<8|i&255);return 4278190080|(e&255)<<16|(t&255)<<8|i&255}l(a,"_init"),this.m_value=a()}_shade(e){let t=e<0?0:255,i=e<0?-e:e,s=this._split();return new R(Math.round((t-s.r)*i)+s.r,Math.round((t-s.g)*i)+s.g,Math.round((t-s.b)*i)+s.b,s.a/255)}darken(e){return e<0&&(e=0),e>100&&(e=100),this._shade(-e/100)}lighten(e){return e<0&&(e=0),e>100&&(e=100),this._shade(e/100)}static mix(e,t,i){let s=e._split(),n=t._split(),r=s.a===n.a?s.a:Math.round(n.a*i+s.a*(1-i)),a=s.r===n.r?s.r:Math.round(n.r*i+s.r*(1-i)),h=s.g===n.g?s.g:Math.round(n.g*i+s.g*(1-i)),m=s.b===n.b?s.b:Math.round(n.b*i+s.b*(1-i));return new R(a,h,m,r/255)}_split(){let e=this.m_value;return{a:e>>24&255,r:e>>16&255,g:e>>8&255,b:e&255}}fadeout(e){let t=this._split();if(t.a=t.a/255,t.a=t.a-t.a*e/100,t.a>1)t.a=1;else if(t.a<=0)return R.NONE;return new R(t.r,t.g,t.b,t.a)}static fromHSV(e,t,i,s=1){let n=Math.min(5,Math.floor(e*6)),r=e*6-n,a=i*(1-t),h=i*(1-r*t),m=i*(1-(1-r)*t),c,d,p;switch(n){case 0:c=i,d=m,p=a;break;case 1:c=h,d=i,p=a;break;case 2:c=a,d=i,p=m;break;case 3:c=a,d=h,p=i;break;case 4:c=m,d=a,p=i;break;case 5:c=i,d=a,p=h;break}return new R(c*255,d*255,p*255,s)}static toHSV(e){let t=e._split();t.r/=255,t.g/=255,t.b/=255,t.a/=255;let i=Math.max(t.r,t.g,t.b),s=Math.min(t.r,t.g,t.b),n=i-s,r=i===0?0:n/i,a=i,h;if(n===0)h=0;else switch(i){case t.r:h=(t.g-t.b)/n/6+(t.g<t.b?1:0);break;case t.g:h=(t.b-t.r)/n/6+1/3;break;case t.b:h=(t.r-t.g)/n/6+2/3;break}return{h,s:r,v:a,a:t.a}}static fromHLS(e,t,i){let s,n,r;if(i==0)s=n=r=t;else{let h=function(d,p,g){return g<0&&(g+=1),g>1&&(g-=1),g<1/6?d+(p-d)*6*g:g<1/2?p:g<2/3?d+(p-d)*(2/3-g)*6:d};var a=h;l(h,"hue2rgb");let m=t<.5?t*(1+i):t+i-t*i,c=2*t-m;s=h(c,m,e+1/3),n=h(c,m,e),r=h(c,m,e-1/3)}return s=(s*255|0)&255,n=(n*255|0)&255,r=(r*255|0)&255,new R(s,n,r)}static toHLS(e){let t=e.m_value,i=(t>>16&255)/255,s=(t>>8&255)/255,n=(t&255)/255,r=i,a=i;s<r&&(r=s),n<r&&(r=n),s>a&&(a=s),n>a&&(a=n);let h=0,m=0,c=0,d=a-r,p=a+r,g=.5*p,x,_;if(a!=r)h=(a-i)/d,m=(a-s)/d,c=(a-n)/d;else return{h:0,l:g,s:0};return g<.5?x=d/p:x=d/(2-p),i==a?_=60*(6+c-m):s==a?_=60*(2+h-c):_=60*(4+m-h),_>360&&(_=_-360),{h:_/360,l:g,s:x}}red(){return this.m_value>>16&255}green(){return this.m_value>>8&255}blue(){return this.m_value&255}alpha(){return(this.m_value>>24&255)/255}value(){return this.m_value}toString(){if(this.m_value===0)return"transparent";let t=this._split();if(t.a===255)return`rgb(${t.r},${t.g},${t.b})`;{t.a/=255;let i=t.a.toFixed(3);return`rgba(${t.r},${t.g},${t.b},${i})`}}toHex(e=!0){if(this.m_value===0)return"transparent";let i=this._split();return i.a===255||!e?`#${je(i.r)}${je(i.g)}${je(i.b)}`:`#${je(i.r)}${je(i.g)}${je(i.b)}${je(i.a)}`}static addCustomColor(e,t){R.custom[e]=t}static addCssColor(e){let t=he.getVar(e);R.custom["css:"+e]=R.parse(t.trim())}static parse(e){let t;if(e[0]=="#"){if((t=/#(?<r>[a-fA-F0-9]{2})(?<g>[a-fA-F0-9]{2})(?<b>[a-fA-F0-9]{2})(?<a>[a-fA-F0-9]{2})?/.exec(e))!==null){let n=t.groups;return new R(parseInt(n.r,16),parseInt(n.g,16),parseInt(n.b,16),n.a!==void 0?parseInt(n.a,16)/255:1)}if((t=/#(?<r>[a-fA-F0-9])(?<g>[a-fA-F0-9])(?<b>[a-fA-F0-9])/.exec(e))!==null){let n=t.groups,r=parseInt(n.r,16),a=parseInt(n.g,16),h=parseInt(n.b,16);return new R(r<<4|r,a<<4|a,h<<4|h,1)}}if(e[0]=="r"){if((t=/rgb\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\)/.exec(e))!==null){let n=t.groups;return new R(parseInt(n.r,10),parseInt(n.g,10),parseInt(n.b,10),1)}if((t=/rgba\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\,\s*(?<a>[0-9.]+)\s*\)/.exec(e))!==null){let n=t.groups;return new R(parseInt(n.r,10),parseInt(n.g,10),parseInt(n.b,10),parseFloat(n.a))}}return console.log("invalid color value: "+e),new R(0)}_getCustomColor(e){if(e===null)return 0;let t=bs[e];return t!==void 0?t:R.custom[e]!==void 0?R.custom[e].m_value:e.substr(0,4)=="css:"?(R.addCssColor(e.substr(4)),R.custom[e].m_value):R.parse(e).m_value}static contrastColor(e){let t=e._split();return(.299*t.r+.587*t.g+.114*t.b)/255>.5?R.BLACK:R.WHITE}static valueFromColorName(e){let t=bs[e];return t?new R(t):null}static fromCssVar(e){return new R(e).toString()}},V=R;l(V,"Color"),k(V,"custom",[]),k(V,"WHITE",new R(255,255,255)),k(V,"BLACK",new R(0,0,0)),k(V,"NONE",new R(0,0,0,0));function je(o){return("00"+o.toString(16)).substr(-2).toUpperCase()}l(je,"_hx");var yn=1e4;function Gi(o){let e,t=o.url,i=o.method||"GET",s=!1;o.params instanceof FormData?(e=o.params,s=!0):i=="POST"?e=vs(o.params,!1):t+=vs(o.params,!0),t=encodeURI(t);let n=new XMLHttpRequest;if(n.open(i,t),n.upload.addEventListener("progress",r,!1),n.addEventListener("timeout",h),n.addEventListener("error",h),n.addEventListener("load",m),s||n.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8"),i!="POST"&&(n.responseType=o.responseType||"json",n.timeout=o.timeout||yn),o.headers)for(let c in o.headers)n.setRequestHeader(c,o.headers[c]);function r(c){if(console.log(c),o.progress)try{if(c.lengthComputable){let d=a(c.loaded)+" / "+a(c.total);o.progress(c.loaded,c.total,d)}}catch(d){console.error("unhandled exception:",d)}}l(r,"progress");function a(c){let d,p;return c>=1e9?(d="Gb",p=c/1e9):c>=1e6?(d="Mb",p=c/1e6):c>=1e3?(d="Kb",p=c/1e3):(d="bytes",p=c),p.toFixed(2)+d}l(a,"humanSize");function h(){o.failure&&o.failure(n.status,n.statusText,o.userData)}l(h,"failure");function m(){if(n.status>=200&&n.status<300){if(o.success)try{o.success(n.response,o.userData)}catch(c){console.error("unhandled exception:",c)}}else h()}return l(m,"success"),s||i=="POST"?n.send(e):n.send(),function(){n.abort()}}l(Gi,"ajaxRequest");function vs(o,e){if(!o)return"";let t=[];for(let s in o){let n=o[s];if(X(n))for(let r=0,a=n.length;r<a;r++)t.push(encodeURIComponent(s)+"[]="+encodeURIComponent(""+n[r]));else n===void 0&&(n=""),t.push(encodeURIComponent(s)+"="+encodeURIComponent(""+n))}let i=t.join("&");return e?"?"+i:i}l(vs,"buildQuery");async function Fn(o,e){return(await $i(o,e,"application/json")).json()}l(Fn,"ajaxAsJSON");async function kn(o,e){return(await $i(o,e,"text/plain")).text()}l(kn,"ajaxAsText");async function $i(o,e,t){let i={method:"GET",headers:{"X-Requested-With":"XMLHttpRequest"}};if(t&&(i.headers["Content-Type"]=t),e&&(i={...i,...e},e.body&&!B(e.body))){let n=!1;(Wi(e.body)||!(e.body instanceof Blob)&&!(e.body instanceof ArrayBuffer)&&!(e.body instanceof FormData)&&!(e.body instanceof URLSearchParams)&&!(e.body instanceof ReadableStream))&&(n=!0),n?i.body=JSON.stringify(e.body):i.body=e.body}let s=await fetch(o,i);if(e&&e.noGenX)return s;if(!s.ok)throw new Ze(s);return s}l($i,"ajax");var lt=class extends H{m_height;m_container;m_buttons;m_dirty;m_watchChanges;constructor(e){let t=e.content;e.content=null;let i=e.height;e.height=void 0,super(e),this.setTag(e.disableSuggestions?"section":"form"),this.mapPropEvents(e,"btnClick"),this.updateContent(t,e.buttons,i),this.m_dirty=!1,this.m_watchChanges=!1}get container(){return this.m_container}componentCreated(){super.componentCreated(),this.m_watchChanges&&this.watchChanges()}updateContent(e,t,i=0){i&&(this.m_height=i),this._makeButtons(t);let s=[this.m_container=new H({cls:"container",height:this.m_height,content:e}),this.m_buttons];super.setContent(s)}setContent(e,t=!0){this.m_container.setContent(e,t)}setButtons(e){this._makeButtons(e)}enableButton(e,t=!0){let i=this.getButton(e);i&&i.enable(t)}getButton(e){return this.m_buttons?.itemWithRef("@"+e)}_makeButtons(e){this.m_buttons||(this.m_buttons=new w({cls:"footer",ref:"buttons"}));let t=[];if(e)for(let i of e)if(i instanceof u)t.push(i);else switch(i){case"ok":{t.push(new z({ref:"@"+i,text:D.global.ok,click:()=>{this._click(i)}}));break}case"cancel":{t.push(new z({ref:"@"+i,text:D.global.cancel,click:()=>{this._click(i)}}));break}case"ignore":{t.push(new z({ref:"@"+i,text:D.global.ignore,click:()=>{this._click(i)}}));break}case"yes":{t.push(new z({ref:"@"+i,text:D.global.yes,click:()=>{this._click(i)}}));break}case"no":{t.push(new z({ref:"@"+i,text:D.global.no,click:()=>{this._click(i)}}));break}case"close":{t.push(new z({ref:"@"+i,text:D.global.close,click:()=>{this._click(i)}}));break}case"save":{t.push(new z({ref:"@"+i,text:D.global.save,click:()=>{this._click(i)}}));break}case"dontsave":{t.push(new z({ref:"@"+i,text:D.global.dontsave,click:()=>{this._click(i)}}));break}}t.length==1&&t[0].setAttribute("autofocus",!0),this.m_buttons.setContent(t)}validate(){let e=this.queryAll("input"),t=!0;for(let i=0;i<e.length;i++){let s=u.getElement(e[i],U);s&&!s.validate()&&(t=!1)}return t}_click(e){this.emit("btnClick",qi(e))}_getElements(){return console.assert(!!this.dom),this.queryAll("[name]")}setValues(e){let t=this._getElements();for(let i=0;i<t.length;i++){let s=t[i],n=u.getElement(s);if(!n.hasAttribute("name"))continue;let r=n.getAttribute("name"),a=n.getAttribute("type");e[r]!==void 0&&n.setStoreValue(e[r])}this.setDirty(!1)}getValues(){let e=this._getElements(),t={};for(let i=0;i<e.length;i++){let s=e[i],n=u.getElement(s);if(!n.hasAttribute("name"))continue;let r=n.getAttribute("name"),a=n.getStoreValue();a!==void 0&&(t[r]=a)}return t}submit(e,t){if(!this.validate())return!1;let i=this.getValues();if(t&&!t(i))return!1;let s=new FormData;for(let n in i)i.hasOwnProperty(n)&&s.append(n,i[n]===void 0?"":i[n]);return e.params=s,Gi(e)}watchChanges(){this.dom?(this.queryAll("input[name], textarea[name]").forEach(t=>{J(t).setDomEvent("input",()=>{this.setDirty()})}),this.m_watchChanges=!1):this.m_watchChanges=!0}setDirty(e=!0){this.m_dirty=e}isDirty(){return this.m_dirty}};l(lt,"Form");function qi(o){return P({button:o})}l(qi,"EvBtnClick");var Ie=class extends ${m_icon;m_title;m_form;m_buttons;m_closable;m_movable;m_maximized;m_minimized;m_maximizable;m_minimizable;m_minFormSize;m_rc_max;m_rc_min;m_el_title;m_last_down;m_auto_close;m_ui_title;m_form_cb;constructor(e){let t=e.content;e.content=null;let i=e.width,s=e.height;e.width=void 0,e.height=void 0,super(e),this.m_minFormSize={width:i,height:s},this.enableMask(!0),e.form?Z(e.form)?this.m_form_cb=e.form:(this.m_form=e.form,this.m_form.on("btnClick",n=>this._handleClick(n))):this.m_form=new lt({content:t,buttons:e.buttons,disableSuggestions:e.disableSuggestions,btnClick:n=>this._handleClick(n)}),this.m_movable=e.movable,this.m_auto_close=e.autoClose??!0,this.m_icon=e.icon,this.m_title=e.title,this.m_buttons=e.buttons??null,this.m_closable=e.closable??!1,this.m_last_down=0,this.on("size",n=>{this.addClass("@resized"),this.m_form.setStyleValue("width",null),this.m_form.setStyleValue("height",null)}),this.m_maximized=!1,this.m_minimized=!1,this.m_maximizable=!1,this.m_minimizable=!1,e.maximizable!==void 0&&(this.m_maximizable=e.maximizable),e.minimizable!==void 0&&(this.m_minimizable=e.minimizable),e.maximized==!0&&(this.m_maximizable=!0),e.btnClick&&this.on("btnClick",e.btnClick)}componentCreated(){super.componentCreated(),this.m_minFormSize.width&&this.m_form.setStyle({minWidth:this.m_minFormSize.width,width:this.m_minFormSize.width}),this.m_minFormSize.height&&this.m_form.setStyle({minHeight:this.m_minFormSize.height,height:this.m_minFormSize.height});let e=this.getBoundingRect();this.setStyleValue("min-width",e.width),this.setStyleValue("min-height",e.height),this.setStyleValue("width",e.width),this.setStyleValue("height",e.height),this.m_props.dlgWidth&&this.setStyleValue("width",this.m_props.dlgWidth+"%"),this.m_props.dlgHeight&&this.setStyleValue("height",this.m_props.dlgHeight+"%"),this.addClass("@resized"),this.m_el_title&&this.m_el_title.setStyleValue("width","auto"),this.m_props.maximized?(this._maximize(),this.emit("size",Q(null))):this.centerOnScreen()}_handleClick(e){this.emit("btnClick",e),e.defaultPrevented||this.close()}setGeometry(e){e.minimized&&this.m_minimizable?(this._minimize(!1),this.m_rc_min=new Y(e.left,e.top,e.width,e.height),this.displayAt(e.left,e.top,"top-left")):e.maximized&&this.m_maximizable?(this._maximize(!1),this.m_rc_max=new Y(e.left,e.top,e.width,e.height)):(this.setSize(e.width,e.height),this.displayAt(e.left,e.top,"top-left"))}getGeometry(){if(this.m_minimized)return{left:this.m_rc_min.left,top:this.m_rc_min.top,width:this.m_rc_min.width,height:this.m_rc_min.height,minimized:!0,maximized:!1};if(this.m_maximized)return{left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height,minimized:!1,maximized:!0};let e=this.getBoundingRect();return{left:e.left,top:e.top,width:e.width,height:e.height,minimized:!1,maximized:!1}}setSize(e,t){this.setStyle({width:e,height:t}),this.emit("size",Q({width:e,height:t}))}render(){this.m_form_cb&&(this.m_form=this.m_form_cb(),this.m_form.on("btnClick",t=>this._handleClick(t)),this.m_form_cb=null);let e=this.m_icon!==void 0||this.m_closable||this.m_title!==void 0||this.m_movable;this.m_el_title=null,e&&(this.m_el_title=new w({cls:"title",content:[this.m_icon?new L({icon:this.m_icon}):null,this.m_ui_title=new I({flex:1,text:this.m_title}),this.m_minimizable?new L({cls:"min-btn",icon:"var( --x4-icon-window-minimize )",dom_events:{click:()=>this._toggleMin()}}):null,this.m_maximizable?new L({cls:"max-btn",icon:"var( --x4-icon-window-maximize )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_maximizable?new L({cls:"res-btn",icon:"var( --x4-icon-window-restore )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_closable?new L({cls:"close-btn",icon:"var( --x4-icon-rectangle-times )",dom_events:{click:()=>this.close()}}):null]}),this.m_movable&&(ft()?this.m_el_title.setDomEvent("touchstart",t=>this._mouseDown(t)):this.m_el_title.setDomEvent("mousedown",t=>this._mouseDown(t)))),super.setContent([this.m_el_title,this.m_form])}setContent(e,t=!0){this.m_form.setContent(e,t)}setButtons(e){this.m_form.setButtons(e)}get form(){return this.m_form}close(){this.emit("close",{}),super.close()}_toggleMax(){this.m_maximizable&&(this.m_maximized?(this.removeClass("maximized"),this.setStyle({left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height}),this.m_maximized=!1,this.emit("size",Q(null,"restore"))):(this._maximize(),this.emit("size",Q(null,"maximize"))))}_toggleMin(){this.m_minimizable&&(this.m_minimized?(this.removeClass("minimized"),this.setStyle({width:this.m_rc_min.width,height:this.m_rc_min.height}),this.m_minimized=!1,this.emit("size",Q(null,"restore"))):(this._minimize(),this.emit("size",Q(null,"minimize"))))}_mouseDown(e){let{x:t,y:i}=re(e,!0),s=J(f.body).getBoundingRect(),n=this.getBoundingRect(!0),r=t-n.left,a=i-n.top,h=Date.now(),m=h-this.m_last_down;if(this.m_maximizable&&m<700){this._toggleMax();return}if(this.m_last_down=h,this.m_maximized)return;let c=l((d,p)=>{d>s.right?d=s.right:d<s.left&&(d=s.left),p>s.bottom?p=s.bottom:p<s.top&&(p=s.top);let g=d-r,x=p-a;this.setStyle({left:g,top:x})},"__move");u.setCapture(this,d=>{if(d.type=="mousemove"){let p=d;c(p.clientX,p.clientY)}else if(d.type=="touchmove"){let p=d;p.touches.length==1&&c(p.touches[0].clientX,p.touches[0].clientY)}else d.type=="mouseup"||d.type=="touchend"?(u.releaseCapture(),this.emit("move",ji(null))):d.type=="mousedown"||d.type=="touchstart"})}maximize(){!this.m_maximizable||this.m_maximized||(this._maximize(),this.emit("size",Q(null)))}_maximize(e=!0){e&&(this.m_rc_max=this.getBoundingRect(!1)),this.addClass("maximized"),this.m_maximized=!0,this.setStyle({left:void 0,top:void 0,width:void 0,height:void 0})}minimize(){!this.m_minimizable||this.m_minimized||(this._minimize(),this.emit("size",Q(null)))}_minimize(e=!0){e&&(this.m_rc_min=this.getBoundingRect(!1)),this.addClass("minimized"),this.m_minimized=!0,this.setStyle({width:void 0,height:void 0})}set title(e){this.m_title=e,this.m_ui_title&&(this.m_ui_title.text=e)}itemWithName(e){let t=this.dom.querySelector(`[name="${e}"]`);return t?u.getElement(t):null}getValues(){return this.m_form.getValues()}validate(){return this.m_form.validate()}};l(Ie,"Dialog");var ai=class extends O{m_colorSel;m_colorHue;m_colorAlpha;m_sample;m_selMark;m_hueMark;m_alphaMark;m_baseHSV;m_baseColor;m_transpCk;m_colorEdit;m_palmode;constructor(e){super(e),this.m_palmode=ai.last_palmode,this.setDomEvent("contextmenu",t=>this._showCtx(t))}_showCtx(e){let t=new te({items:[new ue({text:"Palette",checked:this.m_palmode,click:()=>{this.m_palmode=!this.m_palmode,ai.last_palmode=this.m_palmode,this.update()}})]}),i=re(e,!0);t.displayAt(i.x,i.y)}render(e){if(this.m_baseColor=e.color,this.m_baseHSV=V.toHSV(this.m_baseColor),this.m_palmode){let h=function(m){r=[],m.forEach(c=>{let d=new V(c.hex),p=d.value()==a,g=Nt("hclr-box xbox",{selected:p}),x=new u({cls:g,style:{backgroundColor:d.toHex(),color:V.contrastColor(d).toHex()},data:{color:d.value()},content:d.toHex()});r.push(x),p&&(s=x)}),i&&i.itemWithId("vsel").setContent(r)};var t=h;l(h,"fillSubs"),this.addClass("pal-mode");let i=null,s=null,n=[],r=[],a=this.m_baseColor.value();In.forEach(m=>{let c=m.variations[4].hex,d=c===a;d||(d=m.variations.some(x=>{if(new V(x.hex).value()===a)return!0}));let p=Nt("clr-box xbox",{selected:d}),g=new u({cls:p,style:{backgroundColor:new V(c).toHex()},data:{color:c,main:m.variations}});d&&h(m.variations),n.push(g)}),i=new H({content:[new w({id:"hsel",content:n}),new H({id:"vsel",flex:1,content:r})]}),this.m_colorEdit=new U({cls:"hexv",value:"",attrs:{spellcheck:!1},change:m=>{let c=new V(m.value);c&&(this.m_baseColor=c,this.m_baseHSV=V.toHSV(c),this._updateColor(!1))}}),this.m_transpCk=new ke({cls:"transp",text:"transparent",change:m=>{this.m_baseHSV.a=m.value?0:1,this._updateColor()}}),this.setContent([i,this.m_transpCk,this.m_colorEdit]),i.setDomEvent("click",m=>{s&&(s.removeClass("selected"),s=null);let c=u.getElement(m.target,"xbox");if(c){let d=c.getData("main");if(d)h(d);else{let p=new V(c.getData("color"));this.m_baseColor=p,this.m_baseHSV=V.toHSV(p),this._updateColor(),s=c,c.addClass("selected")}}})}else this.removeClass("pal-mode"),this.m_selMark=new u({cls:"marker"}),this.m_colorSel=new u({cls:"sel",content:[new u({cls:"@fit light"}),new u({cls:"@fit dark"}),this.m_selMark]}),this.m_hueMark=new u({cls:"marker"}),this.m_colorHue=new u({cls:"hue",content:[this.m_hueMark]}),this.m_sample=new u({cls:"sample"}),e.hasAlpha?(this.addClass("with-alpha"),this.m_alphaMark=new u({cls:"marker"}),this.m_colorAlpha=new u({cls:"alpha",content:[new u({cls:"bk @fit",ref:"color"}),this.m_alphaMark]})):(this.removeClass("with-alpha"),this.m_transpCk=new ke({cls:"transp",text:"transparent",change:i=>{this.m_baseHSV.a=i.value?0:1,this._updateColor()}})),this.m_colorEdit=new U({cls:"hexv",value:"",attrs:{spellcheck:!1},change:i=>{let s=new V(i.value);s&&(this.m_baseColor=s,this.m_baseHSV=V.toHSV(s),this._updateColor(!1))}}),this.setContent([this.m_colorSel,this.m_colorHue,this.m_colorAlpha,this.m_transpCk,this.m_colorEdit,this.m_sample]),this.m_colorSel.setDomEvent("mousedown",i=>{u.setCapture(this,s=>this._selChange(s))}),this.m_colorHue.setDomEvent("mousedown",i=>{u.setCapture(this,s=>this._hueChange(s))}),e.hasAlpha&&this.m_colorAlpha.setDomEvent("mousedown",i=>{u.setCapture(this,s=>this._alphaChange(s))}),this._updateColor()}set color(e){this.m_baseColor=e,this.m_baseHSV=V.toHSV(this.m_baseColor),this._updateColor()}get color(){return this.m_baseColor}_selChange(e){let t=re(e,!0);console.log(t);let i=this.m_colorSel.getBoundingRect();this.m_props.hasAlpha||(this.m_baseHSV.a=1),this.m_baseHSV.s=tt((t.x-i.left)/i.width,0,1),this.m_baseHSV.v=1-tt((t.y-i.top)/i.height,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&u.releaseCapture()}_hueChange(e){let t=re(e,!0),i=this.m_colorHue.getBoundingRect();this.m_baseHSV.h=tt((t.y-i.top)/i.height,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&u.releaseCapture()}_alphaChange(e){let t=re(e,!0),i=this.m_colorAlpha.getBoundingRect();this.m_baseHSV.a=tt((t.x-i.left)/i.width,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&u.releaseCapture()}_updateColor(e=!0){let t;if(this.m_palmode)this.m_transpCk.check=this.m_baseHSV.a==0;else{if(t=V.fromHSV(this.m_baseHSV.h,1,1,1),this.m_colorSel.setStyleValue("backgroundColor",t.toString()),t=V.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,1),this.m_sample.setStyleValue("backgroundColor",t.toString()),this.m_props.hasAlpha){let i=`linear-gradient(to right, rgba(0,0,0,0) 0%, ${t.toString()} 100%)`;this.m_colorAlpha.itemWithRef("color").setStyleValue("backgroundImage",i)}this.m_selMark.setStyle({left:this.m_baseHSV.s*100+"%",top:100-this.m_baseHSV.v*100+"%"}),this.m_hueMark.setStyle({top:this.m_baseHSV.h*100+"%"}),this.m_props.hasAlpha?this.m_alphaMark.setStyle({left:this.m_baseHSV.a*100+"%"}):this.m_transpCk.check=this.m_baseHSV.a==0}t=V.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,this.m_baseHSV.a),this.m_baseColor=t,e&&(this.m_colorEdit.value=t.alpha()==1?t.toHex():t.toString()),this._change()}_change(){this.emit("change",M(this.m_baseColor))}},ht=ai;l(ht,"ColorPicker"),k(ht,"last_palmode",!1);var Te=class extends Ie{m_picker;constructor(e){e.icon=void 0,e.buttons=void 0,super(e),this.mapPropEvents(e,"change"),this.m_picker=new ht({color:e.color,hasAlpha:e.hasAlpha,style:{padding:8},width:250,height:250});let t=this._makeCustoms(e.cust_colors);this.form.updateContent([new H({content:[this.m_picker,t]})],["ok","cancel"]),this.on("btnClick",i=>{i.button=="ok"&&this.emit("change",M(this.m_picker.color))})}_makeCustoms(e){let t=null;if(e&&e.length>0){let i=[];for(let s=0;s<e.length;s+=8){let n=[];for(let r=0;r<8;r++){let a=s+r,h=e[a];n.push(new I({cls:"cust-cc",text:"",flex:1,style:{backgroundColor:h?h.toString():"transparent"},tooltip:h?h.toString():void 0,dom_events:{click:()=>{h&&(this.m_picker.color=h,this.emit("change",M(h)),this.close())}}}))}i.push(new w({cls:"line",content:n}))}t=new H({cls:"customs",content:i})}return t}set color(e){this.m_picker.color=e}get color(){return this.m_picker.color}static show(e){let t;return B(e)?t=new Te({color:new V(e)}):t=new Te(e),t.show(),t}};l(Te,"ColorPickerBox");var oi=class extends w{constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){let t=e.color,i;this._isTransp(t)?(t=V.NONE,i="black"):i=V.contrastColor(t).toString(),this.setContent([e.label?new I({cls:"label",text:e.label,flex:e.labelWidth<0?-e.labelWidth:void 0,width:e.labelWidth>=0?e.labelWidth:void 0}):null,new u({flex:1,content:[new I({cls:"alpha @fit",text:""}),new I({cls:"value @fit",text:e.displayValue===!1?"":t.toHex(),style:{backgroundColor:t.toString(),color:i},dom_events:{click:()=>this._showPicker()}})]})]),e.displayValue===!1&&this.setStyleValue("background-image","url( 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAEsmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIKICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIKICAgIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIgogICAgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSIKICAgdGlmZjpJbWFnZVdpZHRoPSIxMCIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgeG1wOk1vZGlmeURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiPgogICA8eG1wTU06SGlzdG9yeT4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJwcm9kdWNlZCIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWZmaW5pdHkgRGVzaWduZXIgMS45LjAiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/Pn8+b7YAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRy0tCQRSHv7Qwyh5gRIsWEtZKwwyiNi2UXlAt1CCrjV5fgdrlXiOibdBWKIja9FrUX1DboHUQFEUQ7YLWRW0qbueqoESe4cz55jdzDjNnwBLOKFm93gvZXF4LTvid85EFp+0FK5204sURVXR1JjQepqZ93lNnxluPWav2uX+tOZ7QFahrFB5VVC0vPCk8vZZXTd4R7lDS0bjwmbBbkwsK35l6rMSvJqdK/G2yFg4GwNIu7ExVcayKlbSWFZaX48pmVpXyfcyX2BO5uZDEHvFudIJM4MfJFGMEGGKAEZmH8OCjX1bUyPcW82dZkVxFZpV1NJZJkSaPW9RVqZ6QmBQ9ISPDutn/v33Vk4O+UnW7HxqeDeO9F2zb8FMwjK8jw/g5BusTXOYq+SuHMPwheqGiuQ6gbRPOrypabBcutqDrUY1q0aJkFbckk/B2Ci0RcNxA02KpZ+V9Th4gvCFfdQ17+9An59uWfgF7Hmfv4QYbGAAAAAlwSFlzAAALEwAACxMBAJqcGAAAACdJREFUGJVjbGhoYEAC9fX1yFwmBryAptKM////R+Y3NjbSzW4C0gAo9QeQBmhTIwAAAABJRU5ErkJggg=='"),this._setTabIndex(e.tabIndex)}set value(e){this.m_props.color=e,this.update()}get value(){return this.m_props.color}set custom_colors(e){this.m_props.cust_colors=e}_showPicker(){let e=new Te({color:this.m_props.color,cust_colors:this.m_props.cust_colors,hasAlpha:this.m_props.hasAlpha,events:{change:i=>{this.m_props.color=i.value,this._change(),this.update()}}}),t=this.getBoundingRect();e.displayAt(t.left,t.bottom,"tl")}_change(){this.emit("change",M(this.m_props.color))}_isTransp(e){return!e.alpha()}};l(oi,"ColorPickerEditor");var In=[{color:"Red",variations:[{weight:50,hex:16772078},{weight:100,hex:16764370},{weight:200,hex:15702682},{weight:300,hex:15037299},{weight:400,hex:15684432},{weight:500,hex:16007990},{weight:600,hex:15022389},{weight:700,hex:13840175},{weight:800,hex:12986408},{weight:900,hex:12000284}]},{color:"Pink",variations:[{weight:50,hex:16573676},{weight:100,hex:16301008},{weight:200,hex:16027569},{weight:300,hex:15753874},{weight:400,hex:15483002},{weight:500,hex:15277667},{weight:600,hex:14162784},{weight:700,hex:12720219},{weight:800,hex:11342935},{weight:900,hex:8916559}]},{color:"Purple",variations:[{weight:50,hex:15984117},{weight:100,hex:14794471},{weight:200,hex:13538264},{weight:300,hex:12216520},{weight:400,hex:11225020},{weight:500,hex:10233776},{weight:600,hex:9315498},{weight:700,hex:8069026},{weight:800,hex:6953882},{weight:900,hex:4854924}]},{color:"Deep Purple",variations:[{weight:50,hex:15591414},{weight:100,hex:13747433},{weight:200,hex:11771355},{weight:300,hex:9795021},{weight:400,hex:8280002},{weight:500,hex:6765239},{weight:600,hex:6174129},{weight:700,hex:5320104},{weight:800,hex:4532128},{weight:900,hex:3218322}]},{color:"Indigo",variations:[{weight:50,hex:15264502},{weight:100,hex:12962537},{weight:200,hex:10463450},{weight:300,hex:7964363},{weight:400,hex:6056896},{weight:500,hex:4149685},{weight:600,hex:3754411},{weight:700,hex:3162015},{weight:800,hex:2635155},{weight:900,hex:1713022}]},{color:"Blue",variations:[{weight:50,hex:14938877},{weight:100,hex:12312315},{weight:200,hex:9489145},{weight:300,hex:6600182},{weight:400,hex:4367861},{weight:500,hex:2201331},{weight:600,hex:2001125},{weight:700,hex:1668818},{weight:800,hex:1402304},{weight:900,hex:870305}]},{color:"Light Blue",variations:[{weight:50,hex:14808574},{weight:100,hex:11789820},{weight:200,hex:8508666},{weight:300,hex:5227511},{weight:400,hex:2733814},{weight:500,hex:240116},{weight:600,hex:236517},{weight:700,hex:166097},{weight:800,hex:161725},{weight:900,hex:87963}]},{color:"Cyan",variations:[{weight:50,hex:14743546},{weight:100,hex:11725810},{weight:200,hex:8445674},{weight:300,hex:5099745},{weight:400,hex:2541274},{weight:500,hex:48340},{weight:600,hex:44225},{weight:700,hex:38823},{weight:800,hex:33679},{weight:900,hex:24676}]},{color:"Teal",variations:[{weight:50,hex:14742257},{weight:100,hex:11722715},{weight:200,hex:8440772},{weight:300,hex:5093036},{weight:400,hex:2533018},{weight:500,hex:38536},{weight:600,hex:35195},{weight:700,hex:31083},{weight:800,hex:26972},{weight:900,hex:19776}]},{color:"Green",variations:[{weight:50,hex:15267305},{weight:100,hex:13166281},{weight:200,hex:10868391},{weight:300,hex:8505220},{weight:400,hex:6732650},{weight:500,hex:5025616},{weight:600,hex:4431943},{weight:700,hex:3706428},{weight:800,hex:3046706},{weight:900,hex:1793568}]},{color:"Light Green",variations:[{weight:50,hex:15857897},{weight:100,hex:14478792},{weight:200,hex:12968357},{weight:300,hex:11457921},{weight:400,hex:10275941},{weight:500,hex:9159498},{weight:600,hex:8172354},{weight:700,hex:6856504},{weight:800,hex:5606191},{weight:900,hex:3369246}]},{color:"Lime",variations:[{weight:50,hex:16382951},{weight:100,hex:15791299},{weight:200,hex:15134364},{weight:300,hex:14477173},{weight:400,hex:13951319},{weight:500,hex:13491257},{weight:600,hex:12634675},{weight:700,hex:11514923},{weight:800,hex:10394916},{weight:900,hex:8550167}]},{color:"Yellow",variations:[{weight:50,hex:16776679},{weight:100,hex:16775620},{weight:200,hex:16774557},{weight:300,hex:16773494},{weight:400,hex:16772696},{weight:500,hex:16771899},{weight:600,hex:16635957},{weight:700,hex:16498733},{weight:800,hex:16361509},{weight:900,hex:16088855}]},{color:"Amber",variations:[{weight:50,hex:16775393},{weight:100,hex:16772275},{weight:200,hex:16769154},{weight:300,hex:16766287},{weight:400,hex:16763432},{weight:500,hex:16761095},{weight:600,hex:16757504},{weight:700,hex:16752640},{weight:800,hex:16748288},{weight:900,hex:16740096}]},{color:"Orange",variations:[{weight:50,hex:16774112},{weight:100,hex:16769202},{weight:200,hex:16764032},{weight:300,hex:16758605},{weight:400,hex:16754470},{weight:500,hex:16750592},{weight:600,hex:16485376},{weight:700,hex:16088064},{weight:800,hex:15690752},{weight:900,hex:15094016}]},{color:"Deep Orange",variations:[{weight:50,hex:16509415},{weight:100,hex:16764092},{weight:200,hex:16755601},{weight:300,hex:16747109},{weight:400,hex:16740419},{weight:500,hex:16733986},{weight:600,hex:16011550},{weight:700,hex:15092249},{weight:800,hex:14172949},{weight:900,hex:12531212}]},{color:"Brown",variations:[{weight:50,hex:15723497},{weight:100,hex:14142664},{weight:200,hex:12364452},{weight:300,hex:10586239},{weight:400,hex:9268835},{weight:500,hex:7951688},{weight:600,hex:7162945},{weight:700,hex:6111287},{weight:800,hex:5125166},{weight:900,hex:4073251}]},{color:"Grey",variations:[{weight:50,hex:16448250},{weight:100,hex:16119285},{weight:200,hex:15658734},{weight:300,hex:14737632},{weight:400,hex:12434877},{weight:500,hex:10395294},{weight:600,hex:7697781},{weight:700,hex:6381921},{weight:800,hex:4342338},{weight:900,hex:2171169}]},{color:"Blue Grey",variations:[{weight:50,hex:15527921},{weight:100,hex:13621468},{weight:200,hex:11583173},{weight:300,hex:9479342},{weight:400,hex:7901340},{weight:500,hex:6323595},{weight:600,hex:5533306},{weight:700,hex:4545124},{weight:800,hex:3622735},{weight:900,hex:2503224}]},{color:"Grey",variations:[{weight:50,hex:16777215},{weight:100,hex:14737632},{weight:200,hex:12895428},{weight:300,hex:11053224},{weight:400,hex:9211020},{weight:500,hex:7368816},{weight:600,hex:5526612},{weight:700,hex:3684408},{weight:800,hex:1842204},{weight:900,hex:0}]}];function kt(o,e){return P({type:o,id:e})}l(kt,"EvDataChange");var hi=class{name;id;fields;constructor(e){this.name=e,this.id=void 0,this.fields=[]}};l(hi,"MetaInfos");var li=Symbol("metaField");function mi(o,e=!0){let t=o.constructor,i=t.hasOwnProperty(li)?t[li]:void 0;if(i===void 0){e||console.assert(i!==void 0),i=new hi(t.name);let s=Object.getPrototypeOf(t);if(s!=Ue){let n=s[li];i.fields=[...n.fields,...i.fields],console.assert(i.id===void 0,"cannot define mutiple record id"),i.id||(i.id=n.id)}o.constructor[li]=i}return i}l(mi,"_getMetas");var Cs;(m=>{function o(){return(c,d)=>{let p=mi(c);p.fields.push({name:d,type:"any",required:!0}),p.id=d}}m.id=o,l(o,"id");function e(c){return(d,p)=>{mi(d).fields.push({name:p,...c})}}m.field=e,l(e,"field");function t(c){return e({...c,type:"string"})}m.string=t,l(t,"string");function i(c){return e({...c,type:"int"})}m.int=i,l(i,"int");function s(c){return e({...c,type:"float"})}m.float=s,l(s,"float");function n(c){return e({...c,type:"bool"})}m.bool=n,l(n,"bool");function r(c){return e({...c,type:"date"})}m.date=r,l(r,"date");function a(c){return e({...c,type:"calc"})}m.calc=a,l(a,"calc");function h(c,d){return m.field({...d,type:"array",model:new c})}m.array=h,l(h,"array")})(Cs||={});var Ue=class{constructor(e,t){e!==void 0&&this.unSerialize(e,t)}clone(e){let t=new this.constructor;return e&&t.unSerialize(e),t}getID(){let e=mi(this,!1);return this[e.id]}getFields(){return mi(this,!1).fields}validate(){let e=null;return this.getFields().forEach(i=>{i.required&&!this.getField(i.name)&&(e&&(e=[]),e.push(new Error(`field ${i.name} is required.`)))}),e}getFieldIndex(e){return this.getFields().findIndex(i=>i.name==e)}serialize(){let e={};return this.getFields().forEach(t=>{t.calc===void 0&&(e[t.name]=e[t.name])}),e}unSerialize(e,t){let i=this.getFields();return i.forEach(s=>{let n=e[s.name];n!==void 0&&(this[s.name]=this._convertField(s,n))}),t!==void 0?this[i[0].name]=t:console.assert(this.getID()!==void 0),this}_convertField(e,t){switch(e.type){case"float":{let i=typeof t=="number"?t:parseFloat(t);if(e.prec!==void 0){let s=Math.pow(10,e.prec);i=Math.round(i*s)/s}return i}case"int":return typeof t=="number"?t:parseInt(t);case"date":return B(t)?new Date(t):t;case"array":{let i=[];if(e.model)return t.forEach(s=>{i.push(e.model.clone(s))}),i;break}}return t}getRaw(e){let t,i=this.getFields();if(typeof e=="string"){if(t=i.findIndex(n=>n.name==e),t<0){console.assert(!1,"unknown field: "+e);return}}else if(e>=0&&e<i.length)t=e;else{console.assert(!1,"bad field name: "+e);return}let s=i[t];return s.calc!==void 0?s.calc(this):this[s.name]}setRaw(e,t){this[e]=t}getField(e){let t=this.getRaw(e);return t==null?"":""+t}setField(e,t){let i=this.getFields(),s=i.findIndex(r=>r.name==e);if(s<0){console.assert(!1,"unknown field: "+e);return}let n=i[s];if(n.calc!==void 0){console.assert(!1,"cannot set calc field: "+e);return}this.setRaw(n.name,t)}};l(Ue,"Record");var mt=class extends Ue{m_data;m_fid;constructor(e){super(),this.m_data=e}getID(){if(!this.m_fid){let e=Object.keys(this.m_data);this.m_fid=e[0]}return this.m_data[this.m_fid]}getFields(){return Object.keys(this.m_data).map(i=>({name:i}))}getRaw(e){return this.m_data[e]}setRaw(e,t){this.m_data[e]=t}clone(e){return new mt({...e})}};l(mt,"AutoRecord");var Dt=class extends ae{constructor(e){super(e)}load(e){e&&(this.m_props.url=e),this._refresh()}_refresh(e=0){let t=l(async()=>{let i=this.m_props.url;this.m_props.params&&(i+="?"+this.m_props.params.join("&"));let s=await fetch(i);if(s.ok){let n=await s.json(),r=n;this.m_props.solver&&(r=this.m_props.solver(r)),this.emit("change",M(r,n))}},"load");e?setTimeout(t,e):t()}};l(Dt,"DataProxy");var Be=class extends me{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 Dt({url:e.url,solver:e.solver,events:{change:t=>{this.setData(t.value)}}}),this.m_proxy.load())}load(e){this.m_proxy.load(e)}reload(){this.m_proxy.load()}setData(e){let t=[];e.forEach(i=>{t.push(this.m_model.clone(i))}),this.setRawData(t)}setRawData(e){this.m_records=e,this._rebuildIndex(),this.emit("data_change",kt("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=e.getID(),i=this.indexOfId(t);return i<0?!1:(this.m_records[this.m_rec_index[i]]=e,this.emit("data_change",kt("update",t)),!0)}append(e){e instanceof Ue||(e=this.m_model.clone().unSerialize(e)),console.assert(e.getID()),this.m_records.push(e),this._rebuildIndex(),this.emit("data_change",kt("create",e.getID()))}getMaxId(){let e;return this.m_records.forEach(t=>{let i=t.getID();(e===void 0||e<i)&&(e=i)}),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.emit("data_change",kt("delete",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){for(let t=this.count,i=0;t!=0;t>>=1){let s=i+(t>>1),n=this.m_rec_index[s],r=this.m_records[n].getID();if(r==e)return s;r<e&&(i=s+1,t--)}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){return this.m_records[e]??null}moveTo(e){e.setRawData(this.m_records)}createView(e){let t={...e,store:this};return new Mt(t)}createIndex(e){if(e&&e.op==="empty-result")return new Uint32Array(0);let t=new Uint32Array(this.m_records.length),i=0;if(!e)this.forEach((d,p)=>{t[i++]=p});else if(typeof e.op=="function"){let d=e.op;this.forEach((p,g)=>{p&&d(p)&&(t[i++]=g)})}else{let g=function(y){return y<p},x=function(y){return y<=p},_=function(y){return y==p},F=function(y){return y!=p},S=function(y){return y>=p},E=function(y){return y>p},W=function(y){return b.lastIndex=-1,b.test(y)};var s=g,n=x,r=_,a=F,h=S,m=E,c=W;l(g,"_lt"),l(x,"_le"),l(_,"_eq"),l(F,"_neq"),l(S,"_ge"),l(E,"_gt"),l(W,"_re");let d=this.m_model.getFieldIndex(e.field);if(d<0)return console.assert(!1,"unknown field name in filter"),new Uint32Array(0);let p=e.value;B(p)&&!e.caseSensitive&&(p=p.toUpperCase());let A,b;if(p instanceof RegExp)b=p,A=W;else switch(e.op){case"<":{A=g;break}case"<=":{A=x;break}case"=":{A=_;break}case">=":{A=S;break}case">":{A=E;break}case"<>":{A=F;break}}this.forEach((y,N)=>{if(!y)return;let C=y.getRaw(d);C==null?C="":(C=""+C,e.caseSensitive||(C=C.toUpperCase())),A(C)&&(t[i++]=N)})}return t.slice(0,i)}sortIndex(e,t){let i=0,s=[];if(t===null?s.push({fidx:0,asc:!0}):s=t.map(n=>{let r=this.m_model.getFieldIndex(n.field);return r==-1&&(console.assert(!1,"unknown field name in sort"),i++),{fidx:r,asc:n.ascending}}),i||s.length==0)return e;if(s.length==1){let n=s[0].fidx;e.sort((r,a)=>{let h=this.getByIndex(r).getRaw(n)??"",m=this.getByIndex(a).getRaw(n)??"";return h>m?1:h<m?-1:0}),s[0].asc||e.reverse()}else e.sort((n,r)=>{for(let a=0;a<s.length;a++){let h=s[a].fidx,m=s[a].asc?1:-1,c=this.getByIndex(n).getRaw(h)??"",d=this.getByIndex(r).getRaw(h)??"";if(c>d)return m;if(c<d)return-m}return 0});return e}forEach(e){this.m_rec_index?this.m_rec_index.some((t,i)=>{if(e(this.m_records[t],i))return i}):this.m_records.some((t,i)=>{if(t&&e(t,i))return i})}export(){return this.m_records}changed(){this.emit("data_change",kt("change"))}};l(Be,"DataStore");function It(o){return P({action:o})}l(It,"EvViewChange");var Mt=class extends ae{m_index;m_store;m_sort;m_filter;constructor(e){super(e),this.m_store=e.store,this.m_index=null,this.m_filter=null,this.m_sort=null,this.filter(e.filter),e.order?B(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.on("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.emit("view_change",It("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.emit("view_change",It("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.emit("view_change",It("sort"))}get store(){return this.m_store}get count(){return this.m_index.length}indexOfId(e){let t=this.m_store.indexOfId(e);return this.m_index.findIndex(i=>i===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}getById(e){return this.m_store.getById(e)}changed(){this.emit("view_change",It("change"))}forEach(e){debugger;this.m_index.some(t=>{let i=this.m_store.getByIndex(t);if(i&&e(i,t))return t})}};l(Mt,"DataView");var Ke=class extends w{m_ui_input;m_ui_button;m_popup;m_lockpop;m_lockchg;m_popvis;m_selection;constructor(e){super(e),e.editable||this.setDomEvent("keypress",()=>this.showPopup()),this.setDomEvent("click",()=>{this.m_props.editable&&this.m_ui_input.focus(),this.showPopup()}),this.setDomEvent("keydown",t=>this._onKey(t)),this.mapPropEvents(e,"selectionChange"),this.m_popvis=!1,this.m_lockpop=!1,this.m_lockchg=!1}_onKey(e){this.m_popvis&&(e.key=="ArrowUp"||e.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(e),this.m_lockpop=!1,e.preventDefault(),e.stopPropagation()):e.key=="Escape"&&(this._hidePopup(),e.preventDefault(),e.stopPropagation()))}set items(e){this.m_props.items=e,this.m_popup&&(this.m_popup.items=e)}render(e){if(e.renderer)this.m_ui_input=new u({flex:1,cls:"@fake-input @hlayout",tabIndex:1});else{let n=new j({flex:1,readOnly:!this.m_props.editable,tabIndex:0,name:e.name,value_hook:{get:()=>this.value,set:r=>{this.value=r}},dom_events:{focus:()=>{this.m_props.editable&&n.value.length==0&&this.showPopup()},input:()=>{if(this.m_lockchg)return;let r=n.value;this.m_selection={id:void 0,text:r};let a=this.showPopup();a&&a.length&&a[0].text==r&&(this.m_selection={id:a[0].id,text:r})}}});this.m_ui_input=n}let t,i,s=e.labelWidth??0;s>0?t=s:s<0&&(i=-s),this.setContent([new I({cls:"label1"+(e.label?"":" @hidden"),text:e.label,width:t,flex:i,align:e.labelAlign}),new w({flex:1,content:[this.m_ui_input,this.m_ui_button=new z({cls:"gadget",icon:"var( --x4-icon-angle-down )",tabIndex:!1,click:()=>{this.showPopup(!1)},dom_events:{focus:()=>{this.dom.focus()}}})]})]),e.value!==void 0&&(this.value=e.value)}componentDisposed(){this.m_popup&&this.m_popup.close(),super.componentDisposed()}showPopup(e=!0){let t=this.m_props;if(t.readOnly||this.hasClass("@disable"))return null;let i=t.items;if(Z(i)){let r=e?this.m_ui_input.value:null;i=i(r)}if(i.length==0)return null;if(!this.m_popup){let r=this.getComputedStyle(),a=r.value("fontFamily"),h=r.value("fontSize");this.m_popup=new Se({cls:"@combo-popup",populate:t.populate,renderItem:this.m_props.renderer,selectionChange:m=>{this._selectItem(m),this.m_lockpop||(this._hidePopup(),this.focus())},cancel:m=>this.signal("cancel",m),style:{fontFamily:a,fontSize:h}})}this.m_popup.items=i;let s=this.m_ui_button.getBoundingRect(),n=this.m_ui_input.getBoundingRect();return this.m_popup.setStyle({minWidth:s.right-n.left}),this.m_popup.displayAt(n.left,n.bottom),this.m_popvis=!0,this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.value!==void 0&&(this.m_popup.selection=this.value),i}_selectItem(e){let t=e.selection;t&&(this.m_lockchg=!0,this._setInput(t,!0),this.m_lockchg=!1,this.m_selection={id:t.id,text:t.text},this.emit("selectionChange",ie(t)),this.emit("change",M(t.id)))}_setInput(e,t=!1){e?this.m_ui_input?this.m_ui_input instanceof j?(this.m_ui_input.value=e.text,t&&this.m_ui_input.dom.dispatchEvent(new Event("input"))):this.m_ui_input.setContent(this.m_props.renderer(e)):this.m_props.value=e.id:this.m_ui_input&&this.m_ui_input instanceof j&&(this.m_ui_input.value="")}get value(){return this.m_selection?this.m_selection.id:void 0}get valueText(){return this.m_selection?this.m_selection.text:this.m_props.editable?this.m_ui_input.value:""}set value(e){let t=this.m_props.items;Z(t)&&(t=t(null)),t.some(s=>{if(s.id===e)return this._setInput(s),this.m_selection=s,!0})||(this._setInput(null),this.m_selection=null)}get input(){return this.m_ui_input instanceof j?this.m_ui_input:null}_checkFocus(){let e=document.activeElement;this.dom&&this.dom.contains(e)||e==document.body||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(e)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1,this.stopTimer("focus-check"))}static storeProxy(e){let t=e.store instanceof Be?e.store.createView():e.store;return()=>{let i=new Array(e.store.count);return e.store.forEach((s,n)=>{i[n]={id:s.getID(),text:e.display(s)}}),i}}focus(){this.m_props.editable?this.m_ui_input.focus():super.focus()}};l(Ke,"ComboBox");var Yi=Symbol("x-drag-cb"),ci=class{dragSource;dragGhost;dropTarget;notified;timer;registerDraggableElement(e){e.setDomEvent("dragstart",t=>{this.dragSource=e,this.dragGhost=e.dom.cloneNode(!0),this.dragGhost.classList.add("dragged"),f.body.appendChild(this.dragGhost),e.addClass("dragging"),t.dataTransfer.setData("text/string","1"),t.dataTransfer.setDragImage(new Image,0,0),t.stopPropagation()}),e.setDomEvent("drag",t=>{this.dragGhost.style.left=t.pageX+"px",this.dragGhost.style.top=t.pageY+"px"}),e.setDomEvent("dragend",t=>{e.removeClass("dragging"),this.dragGhost.remove()}),e.setAttribute("draggable","true")}registerDropTarget(e,t,i){let s=l(h=>{if(i&&!i(this.dragSource)){console.log("reject ",e),h.dataTransfer.dropEffect="none";return}console.log("accepted ",e),h.preventDefault(),h.dataTransfer.dropEffect="copy"},"dragEnter"),n=l(h=>{if(i&&!i(this.dragSource)){console.log("reject ",e),h.dataTransfer.dropEffect="none";return}if(h.preventDefault(),this.dropTarget!=e&&(this.dropTarget=e,this._startCheck()),this.dropTarget){let m={pt:new ee(h.pageX,h.pageY),data:h.dataTransfer};t("drag",this.dragSource,m)}h.dataTransfer.dropEffect="copy"},"dragOver"),r=l(h=>{this.dropTarget=null,h.preventDefault()},"dragLeave"),a=l(h=>{let m={pt:new ee(h.pageX,h.pageY),data:h.dataTransfer};t("drop",this.dragSource,m),this.dropTarget=null,e.removeClass("drop-over"),h.preventDefault()},"drop");e.setDomEvent("dragenter",s),e.setDomEvent("dragover",n),e.setDomEvent("dragleave",r),e.setDomEvent("drop",a),e.setData(Yi,t)}_startCheck(){this.timer&&(clearInterval(this.timer),this._check()),this.timer=setInterval(()=>this._check(),300)}_check(){let e=l(i=>{i.removeClass("drop-over"),i.getData(Yi)("leave",this.dragSource)},"leaving"),t=l(i=>{i.addClass("drop-over"),i.getData(Yi)("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))}};l(ci,"DragManager");var Dn=new ci;var Mn={align:"center",vAlign:"middle",fontSize:14,fontWeight:null,fontStyle:"",fontVariant:"",fontFamily:"Arial",lineHeight:0,clip:!0,columns:1,columnGap:0,lineBreak:!0};function Pn(o,e,t,i){if(t.width<=0||t.height<=0)return;if(i={...Mn,...i},o.save(),i.clip&&(o.beginPath(),o.rect(t.left,t.top,t.width,t.height),o.clip()),i.rotation){let C=new ee(t.left+t.width/2,t.top+t.height/2),T=i.rotation/180*Math.PI;o.translate(C.x,C.y),o.rotate(T),o.translate(-C.x,-C.y)}o.textBaseline="bottom";let s=ze(i.fontSize,2)??12,n="";i.fontStyle&&(n+=i.fontStyle+" "),i.fontVariant&&(n+=i.fontVariant+" "),i.fontWeight&&(n+=i.fontWeight+" "),n+=s+"px ";let r=i.fontFamily??"sans-serif";r.indexOf(".")>0&&(r='"'+r+'"'),n+=r,o.font=n.trim();let a=[],h=e.split(`
|
|
5
|
-
`),m=i.columns<1?1:i.columns,c=i.columnGap,d=(t.width-c*(m-1))/m,p=t.left,g=d;i.lineBreak||(g=99999999);let x=Xi(o," ");h.forEach(C=>{let T={width:0,words:[],space:0},de=Xi(o,C);if(de<g)T.width=de,T.words.push({width:de,text:C}),a.push(T);else{let dt=C.split(/\s/).filter(Ce=>Ce!=="").map(Ce=>({width:Xi(o,Ce),text:Ce})),$e=0,qe=0;for(;$e<dt.length;){let Ce=dt[$e],Pe=T.width;Pe&&(Pe+=x),Pe+=Ce.width,Pe>d&&qe>0?(a.push(T),qe=0,de=0,T={width:0,words:[],space:0}):(T.words.push(Ce),T.width=Pe,$e++,qe++)}qe&&(a.push(T),T.last=!0)}});let _=Sn(o,"Ag"),F=(i.lineHeight??1.3)*_,S=a.length,E=t.top;if(m==1){let C=F*S;S==1&&(F=_,C=_),i.vAlign==="middle"?(E=t.top+t.height/2-C/2,E+=F/2,o.textBaseline="middle"):i.vAlign==="bottom"?C<t.height&&(E=t.top+t.height-C+F):(E=t.top,o.textBaseline="top")}else E+=_;let W=i.align=="justify",A=m,b=E,y=0;switch(i.align){case"right":y=1;break;case"center":y=2;break}let N=0;return a.some(C=>{C.space=x,W&&!C.last&&An(C,d,x);let T=p,de=0;if(y==1?T+=d-C.width:y==2&&(T+=d/2-C.width/2),C.words.forEach(Re=>{o.fillText(Re.text,T,b),T+=Re.width+C.space,de+=Re.width+C.space}),b+=F,N<de&&(N=de),b>t.bottom+F&&(b=E,p+=d+c,--A==0))return!0}),o.restore(),{width:N,height:(a.length+.3)*F}}l(Pn,"drawText");function Sn(o,e){let t=o.measureText(e);return t.actualBoundingBoxAscent+t.actualBoundingBoxDescent}l(Sn,"_calcTextHeight");function Xi(o,e){return ze(o.measureText(e).width,2)}l(Xi,"_measureText");function An(o,e,t){let i=(e-o.width)/(o.words.length-1)+t;i<=0||(o.width=e,o.space=i)}l(An,"_justify");var Zi="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";function ws(o){return o.substr(0,5)=="data:"}l(ws,"_isStaticImage");var be=class extends u{m_created;m_lazysrc;constructor(e){super(e),this.m_created=!1,this.m_props.lazy=e.lazy!==!1,this.m_props.alt=e.alt,e.lazy!==!1&&(this.m_lazysrc=e.src,e.src=Zi),this.setDomEvent("create",()=>{e.lazy&&this.setImage(this.m_lazysrc,!0)})}render(){let e=this.m_props,t=new u({tag:"img",attrs:{draggable:!1,alt:e.alt??"",decoding:e.lazy?"async":void 0},style:{objectFit:e.alignment?e.alignment:void 0}});this.setContent(t)}setImage(e,t){e||(e=Zi),this.m_props.lazy?(t||this.m_lazysrc!=e)&&(ws(e)?(this.m_props.src=e,this.m_lazysrc=e,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src)):(this.m_props.src=Zi,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src),this.m_lazysrc=e,this.dom&&this._update_image())):(this.m_props.src=e,this.m_lazysrc=e,this.dom&&this.dom.firstChild.setAttribute("src",e))}_update_image(){console.assert(!!this.dom),this.m_lazysrc&&!ws(this.m_lazysrc)&&(be.lazy_images_waiting.push({dom:this.dom,src:this.m_lazysrc}),be.lazy_image_timer===void 0&&(be.lazy_image_timer=setInterval(be.lazyWatch,10)))}static lazyWatch(){let e=[],t=0;be.lazy_images_waiting.forEach(i=>{let s=i.dom,n=i.src;if(!s||s.offsetParent===null)return;let r=s.getBoundingClientRect();!t&&s.offsetParent!==null&&r.bottom>=0&&r.right>=0&&r.top<=(window.innerHeight||f.documentElement.clientHeight)&&r.left<=(window.innerWidth||f.documentElement.clientWidth)?(s.firstChild.setAttribute("src",n),t++):e.push(i)}),be.lazy_images_waiting=e,e.length==0&&(clearInterval(be.lazy_image_timer),be.lazy_image_timer=void 0)}},Le=be;l(Le,"Image"),k(Le,"lazy_images_waiting",[]),k(Le,"lazy_image_timer");var St=class extends w{constructor(e){super(e)}clear(){this.m_props.value=""}};l(St,"FileUpload");var ui=class extends St{m_path;m_ui_img;m_ui_input;render(e){let t="up"+this.uid;this.setContent([new u({tag:"label",attrs:{for:t},content:[this.m_ui_img=new Le({src:this.m_props.value})]}),this.m_ui_input=new j({cls:"@hidden",id:t,type:"file",name:this.m_props.name,value_hook:{get:()=>this._get_value(),set:i=>{this._set_value(i)}},attrs:{accept:"image/*"},dom_events:{change:i=>{this._handleChange(i)}}})])}clear(){super.clear(),this.m_ui_input.dom.value="",this.m_ui_img.setImage(null,!1)}_get_value(){return this.m_path}_set_value(e){debugger}_handleChange(e){let t=this;function i(a){let h=new FileReader;h.addEventListener("load",m=>{t.m_ui_img.setImage(h.result.toString())}),h.readAsDataURL(a)}l(i,"createThumbnail");let s=["png","jpg","jpeg","gif"],n=e.target.files,r=n.length;for(let a=0;a<r;a++){let h=n[a].name.split(".");if(h=h[h.length-1],h=h.toLowerCase(),s.indexOf(h)!=-1){i(n[a]),this.m_path=n[a];break}}}};l(ui,"ImageUpload");var Pt=null;function Es(){return Pt||(Pt=new u({tag:"input",style:{display:"none",id:"fileDialog"},attrs:{type:"file"}}),f.body.appendChild(Pt._build())),Pt.clearDomEvent("change"),Pt}l(Es,"_createFileInput");function Tn(o,e,t=!1){let i=Es();i.removeAttribute("nwsaveas"),i.setAttribute("accept",o),i.setAttribute("multiple",t),i.setDomEvent("change",s=>{let n=i.dom.files;e(n)}),i.dom.click()}l(Tn,"openFileDialog");function Bn(o,e,t){let i=Es();i.setAttribute("nwsaveas",o),i.setAttribute("accept",e),i.setDomEvent("change",s=>{let n=i.dom.files;t(n[0])}),i.dom.click()}l(Bn,"saveFileDialog");var Ji,di;function ys(o){o?di=new Intl.NumberFormat(Ji,{style:"currency",currency:o}):di=new Intl.NumberFormat(Ji,{style:"decimal",useGrouping:!0,minimumFractionDigits:2,maximumFractionDigits:2})}l(ys,"setCurrencySymbol");function Ln(o){if(o==null||o==="")return"";let e=new Date(Date.parse(o)),t={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return e.toLocaleDateString(Ji,t)}l(Ln,"sql_date_formatter");function Hn(o){if(o==null||o==="")return"";let e=typeof o=="string"?new Date(Date.parse(o)):o;return G(e)}l(Hn,"date_formatter");function Rn(o){if(o==null||o==="")return"";let e=ze(typeof o=="string"?parseFloat(o):o,2);return Object.is(e,-0)&&(e=0),di.format(e)}l(Rn,"money_formatter");function zn(o){if(o==null||o==="")return"";let e=ze(typeof o=="string"?parseFloat(o):o,2);return e?di.format(e):""}l(zn,"money_formatter_nz");function Vn(o){return o?"oui":"-"}l(Vn,"bool_formatter");ys(null);var Gm=Symbol("update");function Fs(o,e){return P({rec:o,chk:e})}l(Fs,"EvGridCheck");var pi=class extends u{m_sens;m_sorted;constructor(e,t){super(e),this.m_sorted=!1,this.m_sens="dn",this.setContent([new u({tag:"span",content:t}),new L({ref:"sorter",cls:"@hidden sort",icon:"var( --x4-icon-arrow-down )"})])}get sorted(){return this.m_sorted}sort(e,t){this.m_sorted=e,this.m_sens=t;let i=this.itemWithRef("sorter");i.icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )",i.show(e)}get sens(){return this.m_sens}toggleSens(){this.m_sens=this.m_sens=="up"?"dn":"up",this.itemWithRef("sorter").icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )"}};l(pi,"ColHeader");var fi=class extends H{m_dataview;m_data_cx;m_columns;m_view_el;m_container;m_header;m_footer;m_empty_msg;m_empty_text;m_selection;m_itemHeight;m_topIndex;m_visible_rows;m_hasMarks;m_marks;m_recycler;m_rowClassifier;constructor(e){super(e),this.m_columns=e.columns,this.m_hasMarks=e.hasMarks??!1,this.m_marks=new Set,this.m_hasMarks&&this.m_columns.unshift({id:"id",title:"",width:30,renderer:t=>this._renderCheck(t)}),this.setAttribute("tabindex",0),this.m_topIndex=0,this.m_itemHeight=0,this.m_recycler=[],this.m_rowClassifier=e.calcRowClass,this.m_empty_text=e.empty_text??D.global.empty_list,this.setDomEvent("click",t=>this._itemClick(t)),this.setDomEvent("dblclick",t=>this._itemDblClick(t)),this.setDomEvent("contextmenu",t=>this._itemMenu(t)),this.setDomEvent("keydown",t=>this._handleKey(t)),this.setStore(e.store)}componentCreated(){this._updateScroll(!0)}_moveSel(e,t=!0){let i=this.m_selection,s=null;if(i===void 0)i=this.m_dataview.getByIndex(0).getID();else{let n=this.m_dataview.indexOfId(this.m_selection);e==1?n++:e==-1?n--:e==2?n+=this.m_visible_rows.length-1:e==-2&&(n-=this.m_visible_rows.length-1),e<0?s="start":s="end",n<0?n=0:n>=this.m_dataview.count&&(n=this.m_dataview.count-1),i=this.m_dataview.getByIndex(n).getID()}return this.m_selection!=i&&t&&this._selectItem(i,null,s),i}_handleKey(e){if(!(!this.m_dataview||this.m_dataview.count==0))switch(e.key){case"ArrowDown":case"Down":{this._moveSel(1);break}case"ArrowUp":case"Up":{this._moveSel(-1);break}case"PageUp":{this._moveSel(-2);break}case"PageDown":{this._moveSel(2);break}}}getNextSel(e){return this._moveSel(e,!1)}_scrollIntoView(e,t){let i=this._findItem(e);i?i.scrollIntoView({block:"center"}):(this.m_topIndex=this.m_dataview.indexOfId(e),this.m_view_el.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),this._scrollIntoView(e))}setStore(e){this.m_selection=void 0,e instanceof Be?this.m_dataview=e.createView():this.m_dataview=e,this.m_hasMarks&&this.clearMarks(),this.m_data_cx&&this.m_data_cx.dispose(),this.m_dataview&&(this.m_data_cx=this.m_dataview.on("view_change",t=>{t.action=="change"&&(this.m_selection=void 0),this._updateScroll(!0)}),this._updateScroll(!0))}getView(){return this.m_dataview}getSelection(){return this.m_selection}getSelRec(){return this.m_selection?this.m_dataview.getById(this.m_selection):null}setSelection(e){this._selectItem(e,null,"center")}render(){this.m_recycler=[],this.m_container=new u({cls:"content"}),this.m_empty_msg=new I({cls:"empty-msg",text:""}),this.m_view_el=new u({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let e=!1,t=this.m_columns.map((s,n)=>{let r="@cell";s.cls&&(r+=" "+s.cls);let a=new pi({cls:r,flex:s.flex,sizable:"right",style:{width:s.width},dom_events:{click:m=>{J(m.target).hasClass("@sizer-overlay")||(this._sortCol(s),m.preventDefault())}}},s.title),h=l(m=>{if(this._on_col_resize(n,m.size.width),this.m_footer){let c=u.getElement(this.m_footer.dom.childNodes[n]);c&&c.setStyleValue("width",m.size.width)}},"resizeCol");return new _e({target:a,sens:"right",events:{resize:m=>h(m)}}),s.flex&&(e=!0),s.$hdr=a,a});t.push(new Ee({ref:"flex",cls:e?"@hidden":""}));let i=0;if(this.m_columns.forEach(s=>{i+=s.width??0}),this.m_header=new w({cls:"@header",content:t,style:{minWidth:i}}),this.m_props.hasFooter){let s=this.m_columns.map((n,r)=>{let a="@cell";n.align&&(a+=" "+n.align),n.cls&&(a+=" "+n.cls);let h=new u({cls:a,data:{col:r},flex:n.flex,style:{width:n.width}});return n.$ftr=h,h});s.push(new Ee({ref:"flex",cls:e?"@hidden":""})),this.m_footer=new w({cls:"@footer",content:s,style:{minWidth:i}})}else this.m_footer=null;this.setContent([this.m_header,this.m_view_el,this.m_footer,this.m_empty_msg])}_on_col_resize(e,t){let i=this.m_columns[e],s=!1;if(t>=0?(i.width=t,i.flex&&(i.$hdr.removeClass("@flex"),i.$ftr?.removeClass("@flex"),i.flex=void 0,s=!0)):t<0&&!i.flex&&(i.$hdr.addClass("@flex"),i.$ftr?.addClass("@flex"),i.flex=1,s=!0),s){let n=!1;this.m_columns.forEach(r=>{r.flex&&(n=!0)}),this.m_header.itemWithRef("flex")?.show(!n),this.m_footer&&this.m_footer.itemWithRef("flex")?.show(!n)}this._updateScroll(!0)}sortCol(e,t=!0){let i=this.m_columns.find(s=>s.id==e);if(i===void 0){console.assert(!1,"unknown field "+e+" in grid.sortCol");return}this._sortCol(i,t?"dn":"up")}_sortCol(e,t="up"){if(e.sortable===!1)return;this.m_columns.forEach(s=>{s!==e&&s.$hdr.sort(!1,"dn")});let i=e.$hdr;i.sorted?i.toggleSens():i.sort(!0,t),this.m_dataview&&this.m_dataview.sort([{field:e.id,ascending:i.sens!="dn"}])}_computeItemHeight(){let e=f.createElement("div");e.classList.add("x-row");let t=f.createElement("div");t.classList.add("x-grid-view"),t.style.position="absolute",t.style.top="-1000px",t.appendChild(e),this.dom.appendChild(t);let i=e.getBoundingClientRect();this.dom.removeChild(t),this.m_itemHeight=i.height}_createRow(e){let t;if(this.m_recycler.length){t=this.m_recycler.pop(),t.clearClasses(),t.addClass(e.cls),t.setContent(e.content),t.setStyle(e.style);for(let i in e.data)t.setData(i,e.data[i])}else t=new w(e);return t.dom||this.m_container.appendChild(t),t}_buildItems(e=!0){let t=this.getBoundingRect(),i=this.m_header.getBoundingRect(),s=t.height-i.height+this.m_itemHeight;this.m_itemHeight==0&&this._computeItemHeight();let n=this.m_topIndex*this.m_itemHeight,r=0,a=0,h=this.m_topIndex,m=this.m_dataview?this.m_dataview.count:0,c=0,d=!!(this.m_topIndex&1);if(this.m_columns.forEach(_=>{c+=_.width??0}),(m+1)*this.m_itemHeight>=s){let _=u.getScrollbarSize();this.m_header.setStyleValue("paddingRight",_),this.m_footer?.setStyleValue("paddingRight",_)}else this.m_header.setStyleValue("paddingRight",0),this.m_footer?.setStyleValue("paddingRight",0);this.m_visible_rows&&this.m_visible_rows.forEach(_=>{this.m_recycler.push(_)}),this.m_visible_rows=[];let p=100;for(;r<s&&h<m&&--p>0;){let _=this.m_dataview.getByIndex(h),F=_.getID(),S=e?this.m_recycler.findIndex(E=>E.getData("row-id")==F):-1;if(S>=0){let E=this.m_recycler.splice(S,1)[0];E.setStyle({top:r+n,minWidth:c}),this.m_hasMarks&&E.setClass("@marked",this.m_marks.has(F)),E.removeClass("@hidden"),E.setClass("@selected",this.m_selection===F),this.m_visible_rows[a]=E}else{let E=this.m_columns.map(b=>{let y="@cell";b.align&&(y+=" "+b.align),b.cls&&(y+=" "+b.cls);let N;if(b.renderer)N=b.renderer(_),N&&(N.addClass(y),N.setStyleValue("width",b.width),b.flex!==void 0&&(N.addClass("@flex"),N.setStyleValue("flex",b.flex)));else{let C=b.formatter,T;C&&C instanceof Function?T=C(_.getRaw(b.id),_):T=_.getField(b.id),N=new u({cls:y,width:b.width,content:it`<span>${T}</span>`,flex:b.flex})}return N}),W="@row @hlayout center";this.m_hasMarks&&this.m_marks.has(F)&&(W+=" @marked"),this.m_selection===F&&(W+=" @selected");let A=this.m_visible_rows[a]=this._createRow({cls:W,content:E,style:{top:r+n,minWidth:c},data:{"row-id":F,"row-idx":h}});A.addClass(d?"even":"odd"),d=!d,this.m_rowClassifier&&this.m_rowClassifier(_,A)}r+=this.m_itemHeight,h++,a++}this.m_recycler.forEach(_=>{_.addClass("@hidden")});let g=!m,x=this.m_empty_text instanceof Function?this.m_empty_text():this.m_empty_text;this.m_empty_msg.text=x,g&&x.length==0&&(g=!1),this.m_empty_msg.show(g),c<t.width?(this.m_header.setStyleValue("width",null),this.m_footer?.setStyleValue("width",null),this.m_container.setStyle({height:m*this.m_itemHeight,width:null})):(this.m_header.setStyleValue("width",c+1e3),this.m_footer?.setStyleValue("width",c+1e3),this.m_container.setStyle({height:m*this.m_itemHeight,width:c}))}_updateScroll(e){if(!this.m_view_el||!this.m_view_el.dom)return;let t=l(()=>{if(!this.dom)return;let i=Math.floor(this.m_view_el.dom.scrollTop/(this.m_itemHeight||1));(i!=this.m_topIndex||e)&&(this.m_topIndex=i,this._buildItems(!e));let s=this.m_view_el.dom.scrollLeft;this.m_header.setStyleValue("left",-s),this.m_footer?.setStyleValue("left",-s)},"update");e?this.singleShot(t,10):t()}_rowFromTarget(e){let t=this.dom;for(;e&&e!=t;){let i=u.getElement(e);if(i){let s=i.getData("row-id");if(s!==void 0)return{id:s,itm:i}}e=e.parentElement}}_itemClick(e){let t=this._rowFromTarget(e.target);t?this._selectItem(t.id,t.itm):this._selectItem(void 0,void 0)}_itemDblClick(e){let t=this._rowFromTarget(e.target);if(t){this._selectItem(t.id,t.itm);let i=this.m_dataview.getById(t.id);this.emit("dblClick",ye(i)),this.m_hasMarks&&this._toggleMark(i)}}_itemMenu(e){let t=e.target,i=this.dom;for(;t&&t!=i;){let s=u.getElement(t),n=s?.getData("row-id");if(n!==void 0){this._selectItem(n,s);let r=s.getData("row-idx"),a=this.m_dataview.getByIndex(r);this._showItemContextMenu(e,a),e.preventDefault();return}t=t.parentElement}}_findItem(e){for(let t=0;t<this.m_visible_rows.length;t++){let i=this.m_visible_rows[t];if(i.getData("row-id")===e)return i}return null}_selectItem(e,t,i){if(this.m_selection!==void 0){let s=this._findItem(this.m_selection);s&&s.removeClass("@selected")}if(this.m_selection=e,e){i&&this._scrollIntoView(e,i),t||(t=this._findItem(e)),t&&t.addClass("@selected");let s=this.m_dataview.getById(e);this.emit("selectionChange",ie(s))}else this.emit("selectionChange",ie(null))}_showItemContextMenu(e,t){this.emit("contextMenu",pe(e,t))}clearSelection(){this._selectItem(null,null)}exportData(e){let t="",i=" ",s=`\r
|
|
6
|
-
`,n="";this.m_columns.map(a=>{n.length&&(n+=i),n+=a.title}),t+=n+s;let r=this.m_dataview.count;for(let a=0;a<r;a++){let h=this.m_dataview.getByIndex(a);n="";let m=this.m_columns.map(c=>{let d=h.getField(c.id),p=c.formatter;p&&p instanceof Function&&(d=p(d,h)),n.length>0&&(n+=i),n+=d});t+=n+s}t=t.replace(/[àâä]/gm,"a"),t=t.replace(/[éèê]/gm,"e"),t=t.replace(/[îï]/gm,"i"),t=t.replace(/[ûüù]/gm,"u"),t=t.replace(/ /gm," "),Oi(t,"text/csv",e)}set empty_text(e){this.m_empty_msg.text=e}_renderCheck(e){let t="--x4-icon-square";return this.m_marks.has(e.getID())&&(t="--x4-icon-square-check"),new L({icon:`var(${t})`})}_toggleMark(e){let t=e.getID(),i=!1;this.m_marks.has(t)?this.m_marks.delete(t):(this.m_marks.add(t),i=!0),this.emit("gridCheck",Fs(e,i)),this._buildItems(!1)}getMarks(){let e=[];for(let t of this.m_marks.values())e.push(t);return e}clearMarks(){this.m_marks.size&&(this.m_marks=new Set,this._buildItems(!1))}setFooterData(e){this.m_footer&&this.m_footer.enumChilds(t=>{let i=t.getData("col");if(i){let s=this.m_columns[i],n=e[s.id];if(n!==void 0)if(Z(n))n(t);else{let r,a=s.formatter;a&&a instanceof Function?r=a(n,e):r=n,t.setContent(r,!1)}}})}};l(fi,"GridView");var gi=class extends u{constructor(e){super(e),this.setDomEvent("click",()=>this._handleClick()),this.mapPropEvents(e,"click")}_handleClick(){this.emit("click",ne())}render(e){let t=e.text??"",i=e.href??"#";this.setTag("a"),this.setAttribute("tabindex",0),this.setAttribute("href",i),this.setAttribute("target",e.target),t&&this.setContent(le(t)?t:it`<span>${t}</span>`)}set text(e){this.m_props.text=e,this.update()}};l(gi,"Link");var oe=class{static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=oe.hexChars,i=oe.hexOut,s,n,r,a;for(a=0;a<4;a+=1)for(n=a*8,s=e[a],r=0;r<8;r+=2)i[n+1+r]=t.charAt(s&15),s>>>=4,i[n+0+r]=t.charAt(s&15),s>>>=4;return i.join("")}static _md5cycle(e,t){let i=e[0],s=e[1],n=e[2],r=e[3];i+=(s&n|~s&r)+t[0]-680876936|0,i=(i<<7|i>>>25)+s|0,r+=(i&s|~i&n)+t[1]-389564586|0,r=(r<<12|r>>>20)+i|0,n+=(r&i|~r&s)+t[2]+606105819|0,n=(n<<17|n>>>15)+r|0,s+=(n&r|~n&i)+t[3]-1044525330|0,s=(s<<22|s>>>10)+n|0,i+=(s&n|~s&r)+t[4]-176418897|0,i=(i<<7|i>>>25)+s|0,r+=(i&s|~i&n)+t[5]+1200080426|0,r=(r<<12|r>>>20)+i|0,n+=(r&i|~r&s)+t[6]-1473231341|0,n=(n<<17|n>>>15)+r|0,s+=(n&r|~n&i)+t[7]-45705983|0,s=(s<<22|s>>>10)+n|0,i+=(s&n|~s&r)+t[8]+1770035416|0,i=(i<<7|i>>>25)+s|0,r+=(i&s|~i&n)+t[9]-1958414417|0,r=(r<<12|r>>>20)+i|0,n+=(r&i|~r&s)+t[10]-42063|0,n=(n<<17|n>>>15)+r|0,s+=(n&r|~n&i)+t[11]-1990404162|0,s=(s<<22|s>>>10)+n|0,i+=(s&n|~s&r)+t[12]+1804603682|0,i=(i<<7|i>>>25)+s|0,r+=(i&s|~i&n)+t[13]-40341101|0,r=(r<<12|r>>>20)+i|0,n+=(r&i|~r&s)+t[14]-1502002290|0,n=(n<<17|n>>>15)+r|0,s+=(n&r|~n&i)+t[15]+1236535329|0,s=(s<<22|s>>>10)+n|0,i+=(s&r|n&~r)+t[1]-165796510|0,i=(i<<5|i>>>27)+s|0,r+=(i&n|s&~n)+t[6]-1069501632|0,r=(r<<9|r>>>23)+i|0,n+=(r&s|i&~s)+t[11]+643717713|0,n=(n<<14|n>>>18)+r|0,s+=(n&i|r&~i)+t[0]-373897302|0,s=(s<<20|s>>>12)+n|0,i+=(s&r|n&~r)+t[5]-701558691|0,i=(i<<5|i>>>27)+s|0,r+=(i&n|s&~n)+t[10]+38016083|0,r=(r<<9|r>>>23)+i|0,n+=(r&s|i&~s)+t[15]-660478335|0,n=(n<<14|n>>>18)+r|0,s+=(n&i|r&~i)+t[4]-405537848|0,s=(s<<20|s>>>12)+n|0,i+=(s&r|n&~r)+t[9]+568446438|0,i=(i<<5|i>>>27)+s|0,r+=(i&n|s&~n)+t[14]-1019803690|0,r=(r<<9|r>>>23)+i|0,n+=(r&s|i&~s)+t[3]-187363961|0,n=(n<<14|n>>>18)+r|0,s+=(n&i|r&~i)+t[8]+1163531501|0,s=(s<<20|s>>>12)+n|0,i+=(s&r|n&~r)+t[13]-1444681467|0,i=(i<<5|i>>>27)+s|0,r+=(i&n|s&~n)+t[2]-51403784|0,r=(r<<9|r>>>23)+i|0,n+=(r&s|i&~s)+t[7]+1735328473|0,n=(n<<14|n>>>18)+r|0,s+=(n&i|r&~i)+t[12]-1926607734|0,s=(s<<20|s>>>12)+n|0,i+=(s^n^r)+t[5]-378558|0,i=(i<<4|i>>>28)+s|0,r+=(i^s^n)+t[8]-2022574463|0,r=(r<<11|r>>>21)+i|0,n+=(r^i^s)+t[11]+1839030562|0,n=(n<<16|n>>>16)+r|0,s+=(n^r^i)+t[14]-35309556|0,s=(s<<23|s>>>9)+n|0,i+=(s^n^r)+t[1]-1530992060|0,i=(i<<4|i>>>28)+s|0,r+=(i^s^n)+t[4]+1272893353|0,r=(r<<11|r>>>21)+i|0,n+=(r^i^s)+t[7]-155497632|0,n=(n<<16|n>>>16)+r|0,s+=(n^r^i)+t[10]-1094730640|0,s=(s<<23|s>>>9)+n|0,i+=(s^n^r)+t[13]+681279174|0,i=(i<<4|i>>>28)+s|0,r+=(i^s^n)+t[0]-358537222|0,r=(r<<11|r>>>21)+i|0,n+=(r^i^s)+t[3]-722521979|0,n=(n<<16|n>>>16)+r|0,s+=(n^r^i)+t[6]+76029189|0,s=(s<<23|s>>>9)+n|0,i+=(s^n^r)+t[9]-640364487|0,i=(i<<4|i>>>28)+s|0,r+=(i^s^n)+t[12]-421815835|0,r=(r<<11|r>>>21)+i|0,n+=(r^i^s)+t[15]+530742520|0,n=(n<<16|n>>>16)+r|0,s+=(n^r^i)+t[2]-995338651|0,s=(s<<23|s>>>9)+n|0,i+=(n^(s|~r))+t[0]-198630844|0,i=(i<<6|i>>>26)+s|0,r+=(s^(i|~n))+t[7]+1126891415|0,r=(r<<10|r>>>22)+i|0,n+=(i^(r|~s))+t[14]-1416354905|0,n=(n<<15|n>>>17)+r|0,s+=(r^(n|~i))+t[5]-57434055|0,s=(s<<21|s>>>11)+n|0,i+=(n^(s|~r))+t[12]+1700485571|0,i=(i<<6|i>>>26)+s|0,r+=(s^(i|~n))+t[3]-1894986606|0,r=(r<<10|r>>>22)+i|0,n+=(i^(r|~s))+t[10]-1051523|0,n=(n<<15|n>>>17)+r|0,s+=(r^(n|~i))+t[1]-2054922799|0,s=(s<<21|s>>>11)+n|0,i+=(n^(s|~r))+t[8]+1873313359|0,i=(i<<6|i>>>26)+s|0,r+=(s^(i|~n))+t[15]-30611744|0,r=(r<<10|r>>>22)+i|0,n+=(i^(r|~s))+t[6]-1560198380|0,n=(n<<15|n>>>17)+r|0,s+=(r^(n|~i))+t[13]+1309151649|0,s=(s<<21|s>>>11)+n|0,i+=(n^(s|~r))+t[4]-145523070|0,i=(i<<6|i>>>26)+s|0,r+=(s^(i|~n))+t[11]-1120210379|0,r=(r<<10|r>>>22)+i|0,n+=(i^(r|~s))+t[2]+718787259|0,n=(n<<15|n>>>17)+r|0,s+=(r^(n|~i))+t[9]-343485551|0,s=(s<<21|s>>>11)+n|0,e[0]=i+e[0]|0,e[1]=s+e[1]|0,e[2]=n+e[2]|0,e[3]=r+e[3]|0}_dataLength;_bufferLength;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(oe.stateIdentity),this}appendStr(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,n,r;for(r=0;r<e.length;r+=1){if(n=e.charCodeAt(r),n<128)t[s++]=n;else if(n<2048)t[s++]=(n>>>6)+192,t[s++]=n&63|128;else if(n<55296||n>56319)t[s++]=(n>>>12)+224,t[s++]=n>>>6&63|128,t[s++]=n&63|128;else{if(n=(n-55296)*1024+(e.charCodeAt(++r)-56320)+65536,n>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[s++]=(n>>>18)+240,t[s++]=n>>>12&63|128,t[s++]=n>>>6&63|128,t[s++]=n&63|128}s>=64&&(this._dataLength+=64,oe._md5cycle(this._state,i),s-=64,i[0]=i[16])}return this._bufferLength=s,this}appendAsciiStr(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,n,r=0;for(;;){for(n=Math.min(e.length-r,64-s);n--;)t[s++]=e.charCodeAt(r++);if(s<64)break;this._dataLength+=64,oe._md5cycle(this._state,i),s=0}return this._bufferLength=s,this}appendByteArray(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,n,r=0;for(;;){for(n=Math.min(e.length-r,64-s);n--;)t[s++]=e[r++];if(s<64)break;this._dataLength+=64,oe._md5cycle(this._state,i),s=0}return this._bufferLength=s,this}getState(){let e=this,t=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[t[0],t[1],t[2],t[3]]}}setState(e){let t=e.buffer,i=e.state,s=this._state,n;for(this._dataLength=e.length,this._bufferLength=e.buflen,s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],n=0;n<t.length;n+=1)this._buffer8[n]=t.charCodeAt(n)}end(e=!1){let t=this._bufferLength,i=this._buffer8,s=this._buffer32,n=(t>>2)+1,r;if(this._dataLength+=t,i[t]=128,i[t+1]=i[t+2]=i[t+3]=0,s.set(oe.buffer32Identity.subarray(n),n),t>55&&(oe._md5cycle(this._state,s),s.set(oe.buffer32Identity)),r=this._dataLength*8,r<=4294967295)s[14]=r;else{let a=r.toString(16).match(/(.*?)(.{0,8})$/);if(a===null)return;let h=parseInt(a[2],16),m=parseInt(a[1],16)||0;s[14]=h,s[15]=m}return oe._md5cycle(this._state,s),e?this._state:oe._hex(this._state)}},De=oe;l(De,"Md5"),k(De,"stateIdentity",new Int32Array([1732584193,-271733879,-1732584194,271733878])),k(De,"buffer32Identity",new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),k(De,"hexChars","0123456789abcdef"),k(De,"hexOut",[]),k(De,"onePassHasher",new oe);var Me=class extends Ie{m_label;constructor(e){let t=e.icon??"var( --x4-icon-exclamation )";e.icon=void 0;let i=e.buttons===void 0?["ok"]:e.buttons;e.buttons=void 0,super(e);let s=e.message;this.form.updateContent(new w({style:{padding:8},content:[t?new L({cls:"icon",icon:t}):null,this.m_label=new I({cls:"text",text:s,multiline:!0})]}),i),this.on("btnClick",n=>{this.m_props.click&&ce(()=>{this.m_props.click(n.button)})})}set text(e){this.m_label.text=e}static show(e){let t;return B(e)||le(e)?t=new Me({message:e,click:()=>{}}):t=new Me(e),t.show(),t}static async showAsync(e){return new Promise((t,i)=>{let s,n=l(a=>{t(a)},"cb");B(e)||le(e)?s={message:e,click:n}:s={...e,click:n},new Me(s).show()})}static alert(e,t=null){new Me({cls:"warning",title:t,message:e,buttons:["ok"],click:()=>{}}).show()}};l(Me,"MessageBox");var Ge=class extends Ie{m_edit;constructor(e){e.buttons=void 0,e.width=e.width??500,super(e),this.form.updateContent(new w({cls:"panel",content:[this.m_edit=new U({flex:1,autoFocus:!0,label:e.message,value:e.value})]}),["ok","cancel"]),e.click&&this.on("btnClick",t=>{t.button==="ok"&&ce(()=>{this.m_props.click(this.m_edit.value)})})}set text(e){this.m_edit.label=e}static show(e,t){let i;return B(e)||le(e)?i=new Ge({message:e,click:t}):i=new Ge(e),i.show(),i}};l(Ge,"PromptDialogBox");var _i=class extends H{m_ui_title;m_ui_body;constructor(e){super(e);let t=e?.sens=="horizontal"?"@hlayout":"@vlayout";this.m_ui_title=new I({cls:"title",text:this.m_props.title}),this.m_ui_body=new u({cls:"body "+t,content:this.m_props.content,style:e.bodyStyle})}render(){let e=this.m_props.gadgets??[],t=this.m_props.icon?new L({icon:this.m_props.icon}):null;super.setContent([new w({cls:"title",content:[t,this.m_ui_title,...e]}),this.m_ui_body])}setContent(e){this.m_ui_body.setContent(e)}set title(e){this.m_ui_title.text=e}};l(_i,"Panel");var At=class{text;cls};l(At,"CellData"),k(At,"empty_cell",{text:""});var ct=class extends H{m_columns;m_row_limit;m_cells_data;m_rows_data;m_view;m_container;m_header;m_itemHeight;m_topIndex;m_visible_cells;m_row_count;m_selection;m_editor;m_autoedit;m_lockupdate;m_auto_row_count;m_recycler;m_used_cells;constructor(e){super(e),this.m_columns=e.columns,this.m_autoedit=e.autoedit,this.m_lockupdate=0,this.m_cells_data=new Map,this.m_rows_data=new Map,this.m_itemHeight=0,this.m_selection={row:0,col:0},this.m_row_count=0,this.m_auto_row_count=!1,this.m_recycler=[],this.m_used_cells=[],e.maxrows===void 0?(this.m_row_limit=0,this.m_auto_row_count=!0):e.maxrows<0?(this.m_row_limit=0,this.m_auto_row_count=!0):this.m_row_limit=e.maxrows,this.setAttribute("tabindex",0),this.setDomEvent("click",t=>this._itemClick(t)),this.setDomEvent("dblclick",t=>this._itemDblClick(t)),this.setDomEvent("keydown",t=>this._handleKey(t)),this.setDomEvent("keypress",t=>this._keyPress(t)),this.setDomEvent("focus",()=>this._focus(!0)),this.setDomEvent("focusout",()=>this._focus(!1)),this.setDomEvent("contextmenu",t=>this._ctxMenu(t)),this.mapPropEvents(e,"dblClick","selectionChange","contextMenu","change")}componentCreated(){super.componentCreated(),this._updateScroll(!0)}setColWidth(e,t){this._on_col_resize(e,t),this.update(10)}getColWidth(e){if(this.m_columns[e])return this.m_columns[e].width}setColTitle(e,t){console.assert(this.m_columns[e]!==void 0),this.m_columns[e].title=t,this.update(10)}reset(e){e&&(this.m_columns=e),this.m_cells_data=new Map,this.m_rows_data=new Map,this.update(10)}insertRow(e){let t=new Map;this.m_cells_data.forEach((s,n)=>{let{row:r,col:a}=xi(n);r>=e?t.set(ve(r+1,a),s):t.set(n,s)});let i=new Map;this.m_rows_data.forEach((s,n)=>{n>=e?i.set(n+1,s):i.set(n,s)}),this.m_cells_data=t,this.m_rows_data=i,this._buildItems()}deleteRow(e){let t=new Map,i=new Map;this.m_cells_data.forEach((s,n)=>{let{row:r,col:a}=xi(n);r>e?t.set(ve(r-1,a),s):r<e&&t.set(n,s)}),this.m_rows_data.forEach((s,n)=>{n>e?i.set(n-1,s):n<e&&i.set(n,s)}),this.m_cells_data=t,this.m_rows_data=i,this._buildItems()}insertCol(e,t){let i=e;if(i<0&&(i=this.m_columns.length+1),this.m_columns.splice(i,0,t),e>=0){let s=new Map;this.m_cells_data.forEach((n,r)=>{let{row:a,col:h}=xi(r);h>=e?s.set(ve(a,h+1),n):s.set(r,n)}),this.m_cells_data=s}this.update()}deleteCol(e){this.m_columns.splice(e,1);let t=new Map;this.m_cells_data.forEach((i,s)=>{let{row:n,col:r}=xi(s);r>e?t.set(ve(n,r-1),i):r<e&&t.set(s,i)}),this.m_cells_data=t,this.update()}_getCellData(e,t,i=!1){let s=this.m_cells_data.get(ve(e,t));return s===void 0?i?null:At.empty_cell:s}_focus(e){this.setClass("@focus",e)}_ctxMenu(e){let t=e.target,i=this.dom;for(;t&&t!=i;){let s=u.getElement(t),n=s.getData("row-id"),r=s.getData("col-id");if(n!==void 0){this._selectItem(n,r),this.emit("contextMenu",pe(e,{row:n,col:r,item:s})),e.preventDefault();return}t=t.parentElement}}render(){this.m_recycler=[],this.m_container=new u({cls:"content"}),this.m_view=new u({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let e=this.m_columns.map((t,i)=>{let s=new u({cls:"@cell c"+i,content:t.title?t.title:" ",flex:t.width<0?-t.width:void 0,attrs:{title:t.title},style:{width:t.width>=0?t.width:void 0,minWidth:t.min_width}});return new _e({target:s,sens:"right",resize:n=>{this._on_col_resize(i,n.size.width)}}),t.$col=s,s});this.m_header=new w({cls:"@header",content:e}),this.setContent([this.m_header,this.m_view])}_on_col_resize(e,t){this.m_columns[e]&&(t<=0?this.m_columns[e].width=-1:this.m_columns[e].width=t,this._updateScroll(!0))}_computeItemHeight(){let e=f.createElement("div");e.classList.add("x-spreadsheet");let t=f.createElement("div");t.classList.add("content");let i=f.createElement("div");i.classList.add("x-cell"),i.append(" "),t.appendChild(i),e.appendChild(t),this.dom.appendChild(e);let s=i.getBoundingClientRect();this.dom.removeChild(e),this.m_itemHeight=s.height}_calcColWidths(e){let t=0,i=0,s=new Int32Array(this.m_columns.length),n=new Int32Array(this.m_columns.length),r=new Int32Array(this.m_columns.length);if(this.m_columns.forEach((a,h)=>{let m=Math.max(10,a.min_width??0);if(a.width>0){let c=Math.max(a.width,m);t+=c,s[h]=c}else{let c=-a.width;n[h]=c,i+=c}r[h]=m}),i){let a=e-t;for(let h=0;h<this.m_columns.length&&i;h++)if(!s[h]){let m=Math.round(a/i)*n[h];m<r[h]&&(m=r[h]),s[h]=m,a-=m,i-=n[h]}}return s}_createCell(){let e;return this.m_recycler.length?(e=this.m_recycler.pop(),e.clearClasses(),e.addClass("@comp")):e=new u({cls:"@cell"}),e.dom||this.m_container.appendChild(e),e}_buildItems(){let e=this.getBoundingRect(),t=this.m_header.getBoundingRect(),i=e.height-t.height;this.m_itemHeight==0&&this._computeItemHeight();let s=this.m_topIndex*this.m_itemHeight,n=0,r=0,a=this.m_topIndex,h=this.m_row_limit;this.m_auto_row_count&&(this.m_row_limit=h=this.getMaxRowCount());let m=0;if(h*this.m_itemHeight>i){let x=u.getScrollbarSize();e.width-=x,m=x}let c=!!(this.m_topIndex&1);this.m_visible_cells=new Map,this.m_used_cells.forEach(x=>{this.m_recycler.push(x)}),this.m_used_cells=[];let d=this._calcColWidths(e.width),p=0;for(let x=0;x<d.length;x++)p+=d[x];p<=e.width?(this.m_view.setStyleValue("overflow-x","hidden"),this.m_header.setStyleValue("width",e.width),this.m_container.setStyleValue("width",e.width),this.m_container.setStyle({height:h*this.m_itemHeight})):(this.m_header.setStyleValue("width",p),this.m_container.setStyleValue("width",p),this.m_view.setStyleValue("overflow-x","visible"),this.m_container.setStyle({height:h*this.m_itemHeight,width:p})),this.m_view.addClass("@hidden");let g=100;for(;n<i&&a<h&&--g>0;){let x=this.m_rows_data.get(a),_=0,F=this.m_columns.map((S,E)=>{let W="@cell c"+E;S.align&&(W+=" "+S.align),S.cls&&(W+=" "+S.cls);let A,b=this._getCellData(a,E),y=b.text;return S.renderer&&y.length&&(y=S.renderer(y,{row:a,col:E})),W+=c?" even":" odd",x&&(W+=" "+x),A=this._createCell(),this.m_used_cells.push(A),A.setContent(y),A.addClass(W),A.setStyle({left:_,top:s+n,width:d[E],height:this.m_itemHeight}),this.m_selection.row==a&&this.m_selection.col==E&&A.addClass("@selected"),A.setData("row-id",a),A.setData("col-id",E),b.cls&&A.addClass(b.cls),this.m_visible_cells.set(ve(a,E),A),_+=d[E],A});c=!c,n+=this.m_itemHeight,a++,r++}this.m_recycler.forEach(x=>{x.addClass("@hidden")}),this.m_row_count=r,this.m_view.removeClass("@hidden"),this.setClass("empty",h==0)}_itemClick(e){let t=e.target;if(this.m_editor&&this.m_editor.dom.contains(t))return;let i=u.getElement(t,u);if(!i)return;let s=i.getData("row-id"),n=i.getData("col-id");s===void 0||n===void 0||this._selectItem(s,n)}_itemDblClick(e){let t=e.target;if(this.m_editor&&this.m_editor.dom.contains(t))return;let i=u.getElement(t),s=i.getData("row-id"),n=i.getData("col-id");s===void 0||n===void 0||(this.emit("dblClick",ye({row:s,col:n})),this.editCell(s,n))}_selectItem(e,t,i){e<0&&(e=0),e>this.m_row_limit-1&&(e=this.m_row_limit-1),t<0&&(t=0);let s=this.m_columns.length-1;t>s&&(t=s),!(this.m_selection.row==e&&this.m_selection.col==t)&&this.select(e,t,i)}_scrollIntoView(e,t){let i=l((n,r="nearest")=>{n.scrollIntoView({block:r})},"doscroll"),s=this.m_topIndex+this.m_row_count-1;e<this.m_topIndex?(this.m_topIndex=e,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),i(this._findItem(e,t),"start")):e>s?(this.m_topIndex=e-this.m_row_count+1,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),i(this._findItem(e,t),"end")):i(this._findItem(e,t))}_findItem(e,t){return this.m_visible_cells?this.m_visible_cells.get(ve(e,t)):null}_updateScroll(e){if(!this?.m_view?.dom)return;let t=Math.floor(this.m_view.dom.scrollTop/(this.m_itemHeight||1));(t!=this.m_topIndex||e)&&(this.m_topIndex=t,this._buildItems());let i=this.m_view.dom.scrollLeft;this.m_header.setStyleValue("left",-i)}_moveSel(e,t){let i=this.m_selection,s=i.row??0,n=i.col??0;if(e==1?s++:e==-1?s--:e==2?s+=this.m_row_count-1:e==-2?s-=this.m_row_count-1:e==3?s=this.m_row_limit-1:e==-3&&(s=0),t==1)n++;else if(t==-1)n--;else if(t==2)n=this.m_columns.length-1;else if(t==-2)n=0;else if(t==3){n++;let r=this.m_columns.length-1;e:for(let a=0;a<2;a++){for(;n<r;){if(this.m_columns[n].createEditor!==null)break e;n++}n>r&&(s++,n=0)}}else if(t==-3){n--;let r=this.m_columns.length-1;e:for(let a=0;a<2;a++){for(;n>=0;){if(this.m_columns[n].createEditor!==null)break e;n--}n<0&&(s--,n=r)}}this._selectItem(s,n,!0)}_handleKey(e){let t=e.target;if(!(this.m_editor&&this.m_editor.dom.contains(t)))switch(e.key){case"ArrowDown":case"Down":{this._moveSel(1,0);break}case"ArrowUp":case"Up":{this._moveSel(-1,0);break}case"PageUp":{this._moveSel(-2,0);break}case"PageDown":{this._moveSel(2,0);break}case"ArrowLeft":case"Left":{this._moveSel(0,-1);break}case"ArrowRight":case"Right":{this._moveSel(0,1);break}case"Home":{e.ctrlKey?this._moveSel(-3,0):this._moveSel(0,-2);break}case"End":{e.ctrlKey?this._moveSel(3,0):this._moveSel(0,2);break}case"Enter":{this.editCurCell(),e.stopPropagation(),e.preventDefault();break}case"Delete":{this.clearCell(this.m_selection.row,this.m_selection.col);break}default:break}}_keyPress(e){let t=e.target;this.m_editor&&this.m_editor.dom.contains(t)||e.ctrlKey||e.altKey||this.editCurCell(e.key)}getSelection(){return this.m_selection}select(e,t,i=!0){if(this.m_selection.row==e&&this.m_selection.col==t)return;let s=this._findItem(this.m_selection.row,this.m_selection.col);s&&s.removeClass("@selected"),this.m_selection={row:e,col:t},i&&this._scrollIntoView(e,t);let n=this._findItem(e,t);n&&n.addClass("@selected"),this.emit("selectionChange",ie({row:e,col:t}))}rowCount(){return this.m_row_limit}getMaxRowCount(){let e=0;return this.m_cells_data.forEach((t,i)=>{let s=Math.round(i/1e3)+1;e<s&&(e=s)}),e}getColCount(){return this.m_columns.length}setRowStyle(e,t){this.m_rows_data.set(e,t),this.m_lockupdate==0&&this._buildItems()}getRowStyle(e){return this.m_rows_data.get(e)}setCellStyle(e,t,i){let s=this._getCellData(e,t,!0);if(s||(s={text:""},this.m_cells_data.set(ve(e,t),s)),s.cls=i,this.m_lockupdate==0&&this.m_visible_cells){let n=this._findItem(e,t);n?n.setClass(i,!0):this._buildItems()}}getCellText(e,t){return this._getCellData(e,t).text}getCellNumber(e,t){let i=this._getCellData(e,t).text;return Vi(i)}clearRow(e){for(let t=0;t<this.m_columns.length;t++)this.clearCell(e,t);this.update(10)}clearCell(e,t){this.setCellText(e,t,null)}editCurCell(e){this.editCell(this.m_selection.row,this.m_selection.col,e)}editCell(e,t,i){if(!this.m_autoedit||this.m_columns[t].createEditor===null)return;this._scrollIntoView(e,t);let n=this._findItem(e,t).dom,r=n.parentElement,a=n.getBoundingClientRect(),h=r.getBoundingClientRect(),m=this._getCellData(e,t,!0),c=l((p,g,x)=>new U(p),"edtBuilder");this.m_columns[t].createEditor&&(c=this.m_columns[t].createEditor);let d=i||(m?m.text:"");this.m_editor=c({cls:"@editor",style:{left:a.left-h.left,top:a.top-h.top,width:a.width-1,height:a.height-1},tabIndex:!1,value:d,data:{row:e,col:t}},e,t),this.m_editor&&(r.appendChild(this.m_editor._build()),this._setupEditor(),this.m_editor.setData("old-value",d),this.m_editor.focus(),this.m_editor instanceof U&&this.m_editor.selectAll())}_setupEditor(){let e=l((t,i)=>{Ni(()=>{this.killEditor(!0),this._moveSel(t,i),this.editCurCell()})},"movesel");if(this.m_editor instanceof U){let i=this.m_editor.input;i.setDomEvent("blur",()=>{this.killEditor(!0)}),i.setDomEvent("keydown",s=>{if(!s.defaultPrevented)switch(s.key){case"Escape":{this.killEditor(!1),s.stopPropagation(),s.preventDefault();break}case"Enter":case"Tab":{let n=3;s.shiftKey&&(n=-3),e(0,n),s.stopPropagation(),s.preventDefault();break}case"ArrowUp":case"Up":{e(-1,0),s.stopPropagation(),s.preventDefault();break}case"ArrowDown":case"Down":{e(1,0),s.stopPropagation(),s.preventDefault();break}}})}else if(this.m_editor instanceof Ke){let t=this.m_editor.input;t.setDomEvent("blur",()=>{this.killEditor(!0)}),t.setDomEvent("keydown",i=>{switch(i.key){case"Escape":{this.killEditor(!1),i.stopPropagation(),i.preventDefault();break}case"Enter":case"Tab":{let s=3;i.shiftKey&&(s=-3),e(0,s),i.stopPropagation(),i.preventDefault();break}}}),this.m_editor.showPopup(),this.m_editor.on("change",i=>{this.killEditor(!0)}),this.m_editor.on("cancel",i=>{this.killEditor(!1)})}}killEditor(e){if(this.m_editor){if(e){let i,s;this.m_editor instanceof U?i=this.m_editor.value:this.m_editor instanceof Ke&&(s=this.m_editor.value,i=this.m_editor.valueText);let n=this.m_editor.getData("row"),r=this.m_editor.getData("col"),a=this.m_editor.getData("old-value");this.setCellText(n,r,i);let h=M(i,{row:n,col:r,oldValue:a,id:s});this.emit("change",h),h.defaultPrevented&&this.setCellText(n,r,a)}let t=this.m_editor;ce(()=>{t.dispose()}),this.m_editor=null,this.focus()}}clearData(){this.m_cells_data=new Map,this.m_rows_data=new Map}setCellText(e,t,i){if(i==null||i.length==0)this.m_cells_data.delete(ve(e,t)),i="";else{let s=this._getCellData(e,t,!0);s||(s={}),s.text=i,this.m_cells_data.set(ve(e,t),s)}if(this.m_lockupdate==0&&this.m_visible_cells){let s=this._findItem(e,t);s?(this.m_columns[t].renderer&&(i=this.m_columns[t].renderer(i,{row:e,col:t})),s.setContent(i)):this._buildItems()}}lockUpdate(e){e?this.m_lockupdate++:--this.m_lockupdate==0&&this._updateScroll(!0)}};l(ct,"Spreadsheet");function ve(o,e){return o*1e3+e}l(ve,"_mkid");function xi(o){return{row:Math.floor(o/1e3)|0,col:o%1e3|0}}l(xi,"_getid");var bi=class extends u{m_fields;m_record;m_sheet;m_label_w;constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){this.m_record=e.record,this.m_fields=e.fields??[],this.m_label_w=e.labelWidth,this.m_sheet=new ct({cls:"@fit",columns:[{title:D.global.property,width:this.m_label_w>0?this.m_label_w:-1,cls:"property"},{title:D.global.value,width:-1,createEditor:(...t)=>this._editCell(...t),renderer:(...t)=>this._renderCell(...t)}],autoedit:!0,change:t=>this._cellChange(t)}),this._updateProperties(),this.setContent(this.m_sheet)}setFields(e){e?(this.m_fields=e,this._updateProperties()):this.m_sheet.clearData()}setRecord(e){this.m_record=e,this._updateProperties()}_updateProperties(){this.m_sheet.lockUpdate(!0),this.m_sheet.clearData(),this.m_fields.forEach((e,t)=>{this.m_sheet.setCellText(t,0,e.title),this.m_record?this.m_sheet.setCellText(t,1,this.m_record.getField(e.id)):this.m_sheet.setCellText(t,1,e.value)}),this.m_sheet.lockUpdate(!1)}_cellChange(e){let t=e.context,i=e.value;if(t.col!=1)return;let s=this.m_fields[t.row];switch(s.type){default:case"string":break;case"number":break;case"password":break;case"boolean":break;case"choice":break}this.m_record?this.m_record.setField(s.id,i):s.value=i,this.emit("change",M(i,s))}_renderCell(e,t){switch(this.m_fields[t.row].type){default:case"string":break;case"number":break;case"password":{e="\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF";break}case"boolean":break;case"choice":break}return e}_editCell(e,t,i){let s=this.m_fields[t],n;switch(s.type){default:case"string":{n=new U(e);break}case"number":{n=new U(e);break}case"password":{e.type="password",e.value=this.m_record.getField(s.id),n=new j(e);break}case"boolean":{n=new ke(e);break}case"choice":break}return n}_choicesFromArray(e){return e.map(i=>typeof i=="object"?{id:i.id,text:i.value}:{id:i,text:""+i})}_choicesFromStore(e,t){let i=[];for(let s=0,n=e.count;s<n;s++){let r=e.getByIndex(s);i.push({id:r.getID(),text:r.getField(t)})}return i}};l(bi,"PropertyEditor");var ut=class extends u{m_ui_input;constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){let t=e.text??"",i=e.name??e.group,s=e.labelWidth??-1,n=e.checked??!1,r=e.align??"left",a=e.value,h=e.icon;this.setTag("label"),this.addClass("@hlayout"),this.addClass(r),this._setTabIndex(e.tabIndex),n&&this.addClass("checked"),this.setContent([this.m_ui_input=new j({type:"radio",name:i,tabIndex:e.tabIndex,value:a,attrs:{checked:n?"":void 0},dom_events:{change:()=>this._change(),focus:()=>this.m_ui_input.focus()}}),new I({ref:"label",icon:h,text:t,width:s==="flex"?void 0:s,flex:s==="flex"?1:void 0,style:{order:r=="right"?-1:void 0}})])}_change(){let t=".x-input[name="+this.m_props.name+"]";f.querySelectorAll(t).forEach(n=>{u.getElement(n,ut).removeClass("checked")});let s=this.m_ui_input.dom;this.setClass("checked",s.checked),this.emit("change",M(!0))}get check(){return this.m_ui_input?this.m_ui_input.dom.checked:this.m_props.checked}set check(e){let t=this.m_ui_input.dom;e?(t&&(t.checked=!0),this.m_props.checked=!0):(t&&(t.checked=!1),this.m_props.checked=!1)}get text(){return this.itemWithRef("label").text}set text(e){this.itemWithRef("label").text=e}};l(ut,"RadioBtn");var vi=class extends w{m_els;m_input;constructor(e){super(e),e.steps=e.steps??5}render(e){let t=e.shape??"star",i=e.value??0;this.m_input=new j({cls:"@hidden",name:e.name,value:""+i}),this.addClass(t),this.setDomEvent("click",s=>this._onclick(s)),this.m_els=[];for(let s=0;s<e.steps;s++){let n="item";s+1<=i&&(n+=" checked");let r=new u({tag:"option",cls:n,data:{value:s+1}});this.m_els.push(r)}this.m_els.push(this.m_input),this.setContent(this.m_els)}getValue(){return this.m_props.value??0}set value(e){this.m_props.value=e;for(let t=0;t<this.m_props.steps;t++)this.m_els[t].setClass("checked",this.m_els[t].getData("value")<=e);this.m_input.value=""+this.m_props.value}set steps(e){this.m_props.steps=e,this.update()}set shape(e){this.removeClass(this.m_props.shape),this.m_props.shape=e,this.addClass(this.m_props.shape)}_onclick(e){let t=!0;for(let i=this.dom.firstChild;i;i=i.nextSibling){let s=u.getElement(i);s.setClass("checked",t),i==e.target&&(this.m_input.value=s.getData("value"),t=!1)}this.emit("change",M(this.m_props.value))}};l(vi,"Rating");function On(o,e=!1){if(o instanceof RegExp)return{keys:null,pattern:o};let t=o.split("/"),i=[],s="";t[0]==""&&t.shift();for(let n of t){let r=n[0];if(r==="*")i.push("wild"),s+="/(.*)";else if(r===":"){let a=n.indexOf("?",1),h=n.indexOf(".",1);i.push(n.substring(1,a>=0?a:h>=0?h:n.length)),s+=a>=0&&h<0?"(?:/([^/]+?))?":"/([^/]+?)",h>=0&&(s+=(a>=0?"?":"")+"\\"+n.substring(h))}else s+="/"+n}return{keys:i,pattern:new RegExp(`^${s}${e?"(?=$|/)":"/?$"}`,"i")}}l(On,"parseRoute");var Ci=class extends me{m_routes;m_useHash;constructor(e=!0){super(),this.m_routes=[],this.m_useHash=e,window.addEventListener("popstate",t=>{let i=this._getLocation(),s=this._find(i);s.handlers.forEach(n=>{n(s.params,i)})})}get(e,t){let{keys:i,pattern:s}=On(e);this.m_routes.push({keys:i,pattern:s,handler:t})}init(){this.navigate(this._getLocation())}_getLocation(){return this.m_useHash?"/"+f.location.hash.substring(1):f.location.pathname}navigate(e,t=!0){let i=this._find(e);if(!i||i.handlers.length==0){console.log("route not found: "+e),this.signal("error",Li(404,"route not found"));return}if(this.m_useHash){for(;e.startsWith("/");)e=e.substring(1);window.history.pushState({},"","#"+e)}else window.history.pushState({},"",e);t&&i.handlers.forEach(s=>{s(i.params,e)})}_find(e){let t=[],i={},s=[];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 r=0;r<n.keys.length;)i[n.keys[r]]=t[++r];s=[...s,n.handler]}else n.pattern.test(e)&&(s=[...s,n.handler]);else{if(t=n.pattern.exec(e),!t)continue;if(t.groups)for(let r in t.groups)i[r]=t.groups[r];s=[...s,n.handler]}return{params:i,handlers:s}}};l(Ci,"Router");var wi=class extends Ae{m_sidebar;m_content;constructor(e){super(e),this.addClass("@hlayout"),this.m_sidebar=new H({cls:"@side-bar",width:e.bar_width??void 0}),this.m_content=new w({flex:1,cls:"@tab-container"})}render(){let e=[];this.m_cards.forEach(t=>{e.push(t.selector)}),this.m_sidebar.setContent(new H({flex:1,cls:"content",content:e})),this.setContent([this.m_sidebar,this.m_props.bar_sizable?new nt({orientation:"horizontal",sizing:"before"}):void 0,this.m_content])}_prepareSelector(e){return new z({text:e.title,icon:e.icon,tooltip:e.title,click:()=>{this.switchTo(e.name)}})}_preparePage(e){super._preparePage(e),e.dom||this.m_content.appendChild(e)}};l(wi,"SideBarView");var Wn=/^-?\d+(\.\d+)?$/;function Nn(o){return o*Math.PI/180}l(Nn,"d2r");function ks(o,e,t,i){let s=Nn(i);return{x:o+t*Math.cos(s),y:e+t*Math.sin(s)}}l(ks,"p2c");function se(o){return Math.round(o*1e3)/1e3}l(se,"num");function Qi(o,...e){return e=e.map(t=>typeof t=="number"&&isFinite(t)?se(t):t),String.raw(o,...e)}l(Qi,"clean");var He=class{m_tag;m_attrs;m_style;constructor(e){this.m_tag=e,this.m_attrs=new Map,this.m_style=new Map}render(){return`<${this.m_tag} ${this.renderAttrs()} ${this.renderStyle()}>${this.renderContent()}</${this.m_tag}>`}stroke(e,t){return this.attr("stroke",e),t!==void 0&&this.attr("stroke-width",t+"px"),this}strokeWidth(e){return this.attr("stroke-width",e+"px"),this}fill(e){return this.attr("fill",e),this}attr(e,t){return this.m_attrs.set(e,t),this}style(e,t){if(t===void 0||t===""||t===void 0){this.m_style.delete(e);return}return!Ut[e]&&(et(t)||Wn.test(t))&&(t=t+"px"),this.m_style.set(e,""+t),this}class(e){let t=this.m_attrs.get("class");return this.m_attrs.set("class",(t??" "+e).trim()),this}renderAttrs(){if(!this.m_attrs.size)return"";let e="";return this.m_attrs.forEach((t,i)=>{e+=` ${i} = "${t}"`}),e}renderStyle(){if(!this.m_style.size)return"";let e='style="';return this.m_style.forEach((t,i)=>{e+=`${i}:${t};`}),e+'"'}renderContent(){return""}clip(e){return this.attr("clip-path",`url(#${e})`),this}transform(e){this.attr("transform",e)}rotate(e,t,i){this.transform(`rotate( ${e} ${t} ${i} )`)}translate(e,t){this.transform(`translate( ${e} ${t} )`)}scale(e){this.transform(`scale( ${e} )`)}};l(He,"SVGItem");var Ei=class extends He{m_path;constructor(){super("path"),this.m_path=""}renderAttrs(){return this.attr("d",this.m_path),super.renderAttrs()}moveTo(e,t){return this.m_path+=Qi`M${e},${t}`,this}lineTo(e,t){return this.m_path+=Qi`L${e},${t}`,this}closePath(){return this.m_path+="Z",this}arc(e,t,i,s,n){let r=ks(e,t,i,s-90),a=ks(e,t,i,n-90),h=n-s<=180?"0":"1";return this.m_path+=Qi`M${r.x},${r.y}A${i},${i} 0 ${h} 1 ${a.x},${a.y}`,this}};l(Ei,"SVGPath");var yi=class extends He{m_text;constructor(e,t,i){super("text"),this.m_text=i,this.attr("x",se(e)+""),this.attr("y",se(t)+"")}font(e){return this.attr("font-family",e),this}fontSize(e){return this.attr("font-size",e+""),this}fontWeight(e){return this.attr("font-weight",e),this}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.attr("text-anchor",t),this}verticalAlign(e){let t;switch(e){case"top":t="hanging";break;case"center":t="middle";break;case"bottom":t="baseline";break;default:return}return this.attr("alignment-baseline",t),this}renderContent(){return this.m_text}};l(yi,"SVGText");var Lt=class extends He{constructor(e){super(e)}};l(Lt,"SVGShape");var ki=class extends He{m_id;m_stops;constructor(e,t,i,s){super("linearGradient"),this.m_id="gx-"+ki.g_id,this.attr("id",this.m_id),this.attr("x1",B(e)?e:se(e)+""),this.attr("x2",B(i)?i:se(i)+""),this.attr("y1",B(t)?t:se(t)+""),this.attr("y2",B(s)?s:se(s)+""),this.m_stops=[],ki.g_id++}get id(){return"url(#"+this.m_id+")"}addStop(e,t){return this.m_stops.push({offset:e,color:t}),this}renderContent(){let e=[];return this.m_stops.forEach(t=>{e.push(`<stop offset="${t.offset}%" stop-color="${t.color}"></stop>`)}),e.join(`
|
|
7
|
-
`)}},Tt=ki;l(Tt,"SVGGradient"),k(Tt,"g_id",1);var Ht=class extends He{m_items;constructor(e="g"){super(e),this.m_items=[]}path(){let e=new Ei;return this.m_items.push(e),e}text(e,t,i){let s=new yi(e,t,i);return this.m_items.push(s),s}ellipse(e,t,i,s=i){let n=new Lt("ellipse");return n.attr("cx",se(e)+""),n.attr("cy",se(t)+""),n.attr("rx",se(i)+""),n.attr("ry",se(s)+""),this.m_items.push(n),n}rect(e,t,i,s){let n=new Lt("rect");return n.attr("x",se(e)+""),n.attr("y",se(t)+""),n.attr("width",se(i)+""),n.attr("height",se(s)+""),this.m_items.push(n),n}linear_gradient(e,t,i,s){let n=new Tt(e,t,i,s);return this.m_items.push(n),n}clear(){this.m_items=[]}renderContent(){let e=[];return this.m_items.forEach(t=>{e.push(t.render())}),e.join(`
|
|
8
|
-
`)}};l(
|
|
9
|
-
`)}},Bt=es;l(Bt,"SVGPathBuilder"),k(Bt,"g_clip_id",1);var Fi=class extends u{constructor(e){super(e),this.setTag("svg","http://www.w3.org/2000/svg"),this.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.setAttributes({viewBox:e.viewBox}),this.setContent(e.path)}};l(Fi,"SVGComponent");var Ii=class extends O{m_pages;m_curPage;constructor(e){super(e),this.m_pages=[],this.m_curPage=null,this.mapPropEvents(e,"change"),e.vertical?this.addClass("@vlayout"):this.addClass("@hlayout"),this.m_props.pages?.forEach(t=>this.addPage(t))}componentCreated(){this.m_props.default&&this.select(this.m_props.default,!0)}addPage(e){this.m_pages.push({...e}),this._updateContent()}render(){let e=[];this.m_pages.forEach(t=>{t.btn=new z({cls:t===this.m_curPage?"selected":"",text:t.title,icon:t.icon,click:()=>this._select(t,!0)}),e.push(t.btn)}),this.setContent(e)}select(e,t=!1){if(e){let i=this.m_pages.find(s=>s.id===e);return i?(this._select(i,t),!0):!1}else return this._select(null,t),!0}_select(e,t){if(this.m_curPage!=e){if(!this.dom){this.m_props.default=e.id;return}this.m_curPage&&(this.m_curPage.btn.removeClass("selected"),this.m_curPage.page&&this.m_curPage.page.hide()),this.m_curPage=e,t&&this.signal("change",M(e?e.id:null)),this.m_curPage&&(this.m_curPage.btn.addClass("selected"),this.m_curPage.page&&this.m_curPage.page.show())}}get selection(){return this.m_curPage?.page}};l(Ii,"TabBar");var Di=class extends Ae{m_tab_selector;m_menu;constructor(e){super(e),this.m_tab_selector=!!e.tab_selector,this.m_menu=e.menu,this.addClass("@vlayout")}render(){let e=[],t=[];this.m_menu&&(this.m_menu.addClass("@button @tab-btn"),this.m_menu.removeClass("@menu-item"),e.push(this.m_menu)),this.m_cards.forEach(i=>{e.push(i.selector),i.page instanceof Function||t.push(i.page)}),this.m_tab_selector&&t.unshift(new w({cls:"@tab-switch",content:e})),this.setContent(t)}_updateSelector(){}_prepareSelector(e){return new z({cls:"@tab-btn",text:e.title,icon:e.icon,click:()=>{this.switchTo(e.name)}})}_preparePage(e){super._preparePage(e),e.dom||this.appendChild(e)}};l(Di,"TabView");var Mi=class extends u{constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){e.text=e.text??"",this.setAttribute("tabindex",e.tabIndex??0),e.spellcheck===!1&&this.setAttribute("spellcheck","false"),e.readOnly!==void 0&&this.setAttribute("readonly",e.readOnly),e.rows&&this.setAttribute("rows",e.rows),e.placeHolder&&this.setAttribute("placeholder",e.placeHolder),e.autoFocus&&this.setAttribute("autofocus",e.autoFocus),e.name&&this.setAttribute("name",e.name),e.autoGrow&&(this.m_props.autoGrow=!0,this.setAttribute("rows",this._calcHeight(e.text)),this.setDomEvent("keydown",()=>{ce(()=>this._updateHeight())})),this.setDomEvent("keydown",t=>{t.stopPropagation()}),this.setTag("textarea"),this.setDomEvent("input",()=>this._change())}_change(){this.emit("change",M(this.value))}componentCreated(){this.value=this.m_props.text}get value(){return this.dom?this.dom.value:this.m_props.text}set value(e){this.m_props.text=e??"",this.dom&&(this.dom.value=this.m_props.text,this.m_props.autoGrow&&this.setAttribute("rows",this._calcHeight(this.m_props.text)))}get text(){return this.value}set text(e){this.value=e}_calcHeight(e){return 1+(e.match(/\n/g)||[]).length}_updateHeight(){let e=this.value,t=this._calcHeight(e);this.getData("lines")!=t&&(this.setAttribute("rows",t),this.setData("lines",t))}insertText(e){this.appendText(e)}appendText(e){if(this.dom){let t=this.dom,i=t.selectionEnd;t.setRangeText(e,i,i,"end")}}replaceText(e){this.dom&&this.dom.setRangeText(e)}getSelection(){if(this.dom){let e=this.dom;return{start:e.selectionStart,end:e.selectionEnd}}else return{start:0,end:0}}setSelection(e){if(this.dom){let t=this.dom;e.start!==void 0&&(t.selectionStart=e.start),e.end!==void 0&&(t.selectionEnd=e.end)}}getStoreValue(){return this.value}setStoreValue(e){this.value=e}};l(Mi,"TextArea");var Pi=class extends ${m_message;m_icon;constructor(e){super(e),this.m_message=e.message,this.m_icon=e.icon,this.enableMask(!1),this.addClass("@non-maskable")}render(){this.addClass("@hlayout"),this.setContent([new I({icon:this.m_icon,text:this.m_message})])}show(){this.show=super.show,this.displayAt(9999,9999,"br",{x:0,y:-24});let e=1;this.startTimer("fadeout",2e3,!1,()=>{this.startTimer("opacity",100,!0,()=>{this.setStyleValue("opacity",e),e-=.1,e<0&&this.dispose()})})}};l(Pi,"Toaster");function jn(o){return P({node:o})}l(jn,"EvExpand");var Si=class extends H{m_view;m_container;m_selection;constructor(e){super(e),e.root=e.root,e.indent=e.indent??8,e.gadgets=e.gadgets,e.sort=e.sort??!1,this.m_selection=null,this.m_container=new O({cls:"@scroll-container"}),this.m_view=new O({cls:"@scroll-view",flex:1,content:this.m_container}),this.setContent([this.m_view,e.gadgets?new w({cls:"gadgets",content:e.gadgets}):null]),this.setDomEvent("click",t=>this._click(t)),this.setDomEvent("dblclick",t=>this._click(t)),this.setDomEvent("contextmenu",t=>this._handleCtxMenu(t)),e.canDragItems&&(this.setDomEvent("dragstart",t=>{let s=u.getElement(t.target,u)?.getData("node");s?(t.dataTransfer.effectAllowed="move",t.dataTransfer.items.add(JSON.stringify({type:"treeview",id:s.id}),"string")):(t.preventDefault(),t.stopPropagation())}),this.setDomEvent("dragover",t=>this._dragEnter(t)),this.setDomEvent("dragenter",t=>this._dragEnter(t)),this.setDomEvent("dragend",t=>this._dragLeave(t)),this.setDomEvent("dragleave",t=>this._dragLeave(t)),this.setDomEvent("drop",t=>this._dragLeave(t)),this.setDomEvent("drop",t=>this._drop(t))),this.mapPropEvents(e,"dblclick","drag","selectionchange","contextMenu")}_dragEnter(e){e.preventDefault();let t=u.getElement(e.target,u);t?.getData("node")&&(t.addClass("@drag-over"),e.dataTransfer.dropEffect="move")}_dragLeave(e){let t=u.getElement(e.target,u);t?.getData("node")&&t.removeClass("@drag-over")}_drop(e){let t=u.getElement(e.target,u),i=t?.getData("node");if(i||(i=this.m_props.root),i){let s;i.children?s=i:s=t.getData("parent");for(let n=0;n<e.dataTransfer.items.length;n++)e.dataTransfer.items[0].getAsString(r=>{let a=JSON.parse(r);this.emit("drag",Bi(i,a,s))})}}render(){this.__update()}__update(){if(this.m_props.root){let e=[];this._buildBranch(this.m_props.root,-1,e,this.m_props.root),this.m_container.setContent(e)}}updateElement(e){let{node:t,item:i}=this._getNode(e);if(t){let s=t.dom.parentNode,n=this._makeNode(i,t.dom.classList.value,t.getData("icon"),t.getData("level")),r=n._build();s.replaceChild(r,t.dom),this.m_selection?.el===t&&(this.m_selection.el=n)}}set root(e){this.m_props.root=e,this.update()}openAll(e=!0){this.forEach(t=>{t.children&&(t.open=e)}),this.__update()}refreshRoot(e){let t=[];this.forEach(s=>(s.open&&t.push(s.id),!1));let i=this.selection;e&&(this.m_props.root=e),this.forEach(s=>(t.indexOf(s.id)>=0&&(s.open=!0),!1)),this.__update()}_buildBranch(e,t,i,s){let n="@tree-item";e.cls&&(n+=" "+e.cls),!e.open&&e.children&&(n+=" collapsed"),e.children&&(n+=" folder",e.children.length==0&&(n+=" empty"));let r=e.icon;if(r===void 0&&e.children&&(e.open===!0?r="var(--x4-icon-chevron-down)":r="var(--x4-icon-chevron-right)"),t>=0){let a=this._makeNode(e,n,r,t);this.m_selection?.id==e.id&&(this.m_selection.el=a,a.addClass("selected")),i.push(a)}(t==-1||e.open)&&e.children&&(this.m_props.sort&&(e.children=e.children.sort((a,h)=>{let m=(a.children?"0"+a.text:a.text)?.toLocaleLowerCase(),c=(h.children?"0"+h.text:h.text)?.toLocaleLowerCase();return m<c?-1:m>c?1:0})),e.children.forEach(a=>{this._buildBranch(a,t+1,i,e)}))}_renderDef(e){return new I({cls:"tree-label",flex:1,text:e.text})}_makeNode(e,t,i,s){return new w({cls:t,content:[new L({cls:"tree-icon",icon:i}),this.m_props.renderItem?this.m_props.renderItem(e):this._renderDef(e)],data:{node:e,level:s,icon:i},style:{paddingLeft:4+s*this.m_props.indent},attrs:{draggable:this.m_props.canDragItems?!0:void 0}})}forEach(e){let t=null;function i(s){if(e(s)==!0)return!0;if(s.children){for(let n=0;n<s.children.length;n++)if(i(s.children[n]))return!0}}return l(i,"scan"),this.m_props.root&&i(this.m_props.root),t}ensureVisible(e){let{node:t}=this._getNode(e);t&&t.scrollIntoView()}set selection(e){this.select(e,!1)}select(e,t=!0){if(this.m_selection?.el&&this.m_selection.el.removeClass("selected"),this.m_selection=null,e!==void 0){let{node:i}=this._getNode(e);if(i&&(this.m_selection={id:e,el:i},i.addClass("selected"),i.scrollIntoView(),t)){let s=i.getData("node");this.emit("selectionchange",ie(s))}}else t&&this.emit("selectionchange",ie(null))}_getNode(e){let t={node:null,item:null};return this.m_container.enumChilds(i=>{let s=i.getData("node");if(s?.id==e)return t={node:i,item:s},!0}),t}get selection(){return this.m_selection?.id}getNodeWithId(e){return this.forEach(t=>t.id==e)}_click(e){let t=e.target,i=t,s=!1;for(t.tabIndex!==-1&&(s=!0);t!=this.dom;){let n=u.getElement(t),r=n?.getData("node");if(r){if(r.children&&!s){(n.hasClass("selected")||i.classList.contains("tree-icon"))&&(r.open=!r.open),this.m_selection={id:r.id,el:null};let a=this.m_view?.dom?.scrollTop;this.update(),a&&this.m_view.dom.scrollTo(0,a),this.emit("expand",jn(r))}else this.selection=r.id,s||(e.type=="click"?this.emit("click",ne(r)):this.emit("dblclick",ye(r)));this.emit("selectionchange",ie(r));return}t=t.parentElement}e.type=="click"&&(this.m_selection=null,this.update(),this.emit("selectionchange",ie(null)))}_handleCtxMenu(e){e.preventDefault();let t=e.target,i=t;for(;t!=this.dom;){let n=u.getElement(t)?.getData("node");if(n){if(n.children&&i.classList.contains("tree-icon"))return;this.selection=n.id,this.emit("click",ne(n)),this.emit("contextMenu",pe(e,n));return}t=t.parentElement}this.selection=null,this.emit("contextMenu",pe(e,null))}static buildFromStrings(e,t="/"){let i={id:0,text:"<root>",children:[]};function s(n,r){let a=r.indexOf(t),h=r.substr(0,a<0?void 0:a),m;a>=0&&(m=n.find(c=>c.text==h)),m||(m={id:r,text:h},n.push(m)),a>=0&&(m.children||(m.children=[]),s(m.children,r.substr(a+t.length)))}return l(s,"insert"),e.forEach(n=>{s(i.children,n)}),i}static buildFromHierarchy(e,t){let i={id:0,text:"<root>",children:[]},s=[];function n(r){let a,h;r.parent>0?(h=s.find(m=>m.id==r.parent),h||(h={id:r.parent,text:"",children:[]},s.push(h)),h.children||(h.children=[])):h=i,a=s.find(m=>m.id==r.id),a?(a.text=r.name,a.parent=r.parent):(a={id:r.id,text:r.name,parent:r.parent,cls:r.cls,icon:r.icon,data:r.data},r.leaf?a.icon=null:a.children=[]),s.push(a),h.children.push(a)}return l(n,"insert"),e.forEach(n),t&&s.forEach(t),i}};l(Si,"TreeView");var Un=l((o,e,...t)=>{let i;return o==Ds||o==Is?t:(o instanceof Function?i=new o(e):i=new u({tag:o,...e}),t&&t.length&&i.setContent(t),i)},"createElement"),Is=Symbol("fragment"),Ds=l(()=>null,"createFragment"),Kn={createElement:Un,createFragment:Ds,Fragment:Is},Ai=class extends u{render(e){let t=this.renderTSX(e);t&&this.setContent(t)}};l(Ai,"TSXComponent");var Ms=Symbol("msg_sent");function Gn(o){let e=window.location.protocol==="https:"?"wss://":"ws://",t=new WebSocket(`${e}${window.location.hostname}:${window.location.port}`,"messaging"),i=xe.instance();i.on("global",s=>{s[Ms]||t.send(JSON.stringify({msg:s.msg,params:s.params}))}),t.onmessage=s=>{if(s.data!="ping"){let n=JSON.parse(s.data);n[Ms]=!0,i.signal("global",n)}},t.onclose=s=>{console.log("websocket closed:",s),o()},t.onerror=s=>{console.log("websocket error:",s)}}l(Gn,"setupWSMessaging");var $n="1.5.24";
|
|
1
|
+
"use strict";var Al=Object.defineProperty;var Mv=Object.getOwnPropertyDescriptor;var Pv=Object.getOwnPropertyNames;var Tv=Object.prototype.hasOwnProperty;var Fv=(e,t,i)=>t in e?Al(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var h=(e,t)=>Al(e,"name",{value:t,configurable:!0});var zv=(e,t)=>{for(var i in t)Al(e,i,{get:t[i],enumerable:!0})},Rv=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Pv(t))!Tv.call(e,r)&&r!==i&&Al(e,r,{get:()=>t[r],enumerable:!(s=Mv(t,r))||s.enumerable});return e};var Lv=e=>Rv(Al({},"__esModule",{value:!0}),e);var X=(e,t,i)=>(Fv(e,typeof t!="symbol"?t+"":t,i),i);var z2={};zv(z2,{AbsLayout:()=>uc,Application:()=>ys,AutoComplete:()=>Ec,AutoLayout:()=>dc,AutoRecord:()=>Sl,BaseButton:()=>Cl,BaseComponent:()=>ii,BasicEvent:()=>se,Button:()=>Se,CSSParser:()=>dn,Calendar:()=>ga,Canvas:()=>kc,CardView:()=>fr,CheckBox:()=>qs,Clipboard:()=>Ma,Color:()=>De,ColorPicker:()=>kl,ColorPickerBox:()=>pr,ColorPickerEditor:()=>Sc,ComboBox:()=>sn,Component:()=>I,ComputedStyle:()=>Cr,Container:()=>Ae,DataProxy:()=>ba,DataStore:()=>gr,DataView:()=>xa,Dialog:()=>Ks,EvBtnClick:()=>gf,EvCancel:()=>vv,EvChange:()=>ee,EvClick:()=>Yt,EvContextMenu:()=>Ai,EvDblClick:()=>Is,EvDrag:()=>eu,EvError:()=>tu,EvFocus:()=>La,EvGridCheck:()=>kv,EvLoaded:()=>fa,EvMessage:()=>Vv,EvMove:()=>uf,EvOverlayResize:()=>Ff,EvSelectionChange:()=>Bt,EvSize:()=>dt,EvTimer:()=>Qc,EvViewChange:()=>wa,EventSource:()=>_i,FileUpload:()=>ya,Flex:()=>Ds,Form:()=>El,GridLayout:()=>_c,GridView:()=>Rc,HLayout:()=>q,HtmlString:()=>Je,Icon:()=>ge,Image:()=>vr,ImageUpload:()=>Tc,Input:()=>Ke,Label:()=>Z,Link:()=>Lc,ListView:()=>pa,Masonry:()=>gc,Md5:()=>Ys,Menu:()=>Vt,MenuBar:()=>Cc,MenuItem:()=>Ii,MenuSeparator:()=>bc,MenuTitle:()=>xc,MessageBox:()=>Xs,NetworkError:()=>on,Panel:()=>Vc,Point:()=>At,Popup:()=>ot,PopupCalendar:()=>yl,PopupListView:()=>_r,PromptDialogBox:()=>rn,PropertyEditor:()=>Hc,RadioBtn:()=>Il,Rating:()=>Oc,React:()=>P2,Record:()=>tn,Rect:()=>ht,Router:()=>Wc,SVGComponent:()=>Uc,SVGPathBuilder:()=>Sa,ScrollView:()=>pc,Separator:()=>_n,Settings:()=>fn,SideBarView:()=>jc,Size:()=>Mi,SizerOverlay:()=>ls,Space:()=>za,Spreadsheet:()=>Dl,Stylesheet:()=>ri,TSXComponent:()=>Jc,TabBar:()=>qc,TabView:()=>Kc,TableLayout:()=>fc,TextArea:()=>Yc,TextEdit:()=>Ye,Toaster:()=>Xc,ToggleButton:()=>yc,Tooltip:()=>Qr,TreeView:()=>Zc,VLayout:()=>we,_date_set_locale:()=>$v,_tr:()=>Q,_x4_unitless:()=>Ra,addTranslation:()=>ru,ajax:()=>pf,ajaxAsJSON:()=>c2,ajaxAsText:()=>u2,ajaxRequest:()=>ff,asap:()=>fi,bool_formatter:()=>k2,calcAge:()=>Zv,camelCase:()=>Gv,clamp:()=>cn,classNames:()=>Fa,crc32:()=>ew,createLanguage:()=>iu,data:()=>xv,date_calc_weeknum:()=>Ta,date_clone:()=>hn,date_diff:()=>Kv,date_format:()=>qv,date_formatter:()=>C2,date_hash:()=>an,date_sql_utc:()=>Xv,date_to_sql:()=>Yv,deferCall:()=>au,downloadData:()=>lu,dragManager:()=>_2,drawText:()=>p2,escapeHtml:()=>Pl,flyWrap:()=>ut,formatIntlDate:()=>Qe,generatePassword:()=>sw,getAvailableLanguages:()=>Ov,getCurrentLanguage:()=>Hv,getMousePos:()=>Xt,html:()=>un,initTooltips:()=>Q1,installHMR:()=>rw,isArray:()=>mt,isFunction:()=>ct,isHtmlString:()=>si,isLanguage:()=>su,isLiteralObject:()=>ou,isNumber:()=>mn,isString:()=>re,isTouchDevice:()=>Ml,markdownToHtml:()=>Qv,mix:()=>iw,money_formatter:()=>y2,money_formatter_nz:()=>E2,openFileDialog:()=>w2,pad:()=>Ss,parseIntlDate:()=>Tl,parseIntlFloat:()=>nu,pascalCase:()=>xr,removeHtmlTags:()=>Nv,roundTo:()=>br,saveFileDialog:()=>b2,selectLanguage:()=>Af,setCurrencySymbol:()=>Ev,setupWSMessaging:()=>T2,sprintf:()=>ln,sql_date_formatter:()=>x2,waitFontLoading:()=>Jv,x4app:()=>fv,x4js_version:()=>F2});module.exports=Lv(z2);var L=document;var Ef=h(function(){this.propagationStopped=!0},"stopPropagation"),kf=h(function(){this.defaultPrevented=!0},"preventDefault");function se(e){return{stopPropagation:Ef,preventDefault:kf,...e}}h(se,"BasicEvent");function Yt(e=null){return se({context:e})}h(Yt,"EvClick");function ee(e,t=null){return se({value:e,context:t})}h(ee,"EvChange");function Bt(e,t=null){return se({selection:e,context:t})}h(Bt,"EvSelectionChange");function Ai(e,t=null){return se({uievent:e,context:t})}h(Ai,"EvContextMenu");function Qc(e,t=0,i=null){return se({timer:e,time:t,context:i})}h(Qc,"EvTimer");function Vv(e,t,i){return se({msg:e,params:t,source:i})}h(Vv,"EvMessage");function eu(e,t,i){return se({element:e,data:t,context:i})}h(eu,"EvDrag");function tu(e,t){return se({code:e,message:t})}h(tu,"EvError");var _i=class{m_source;m_eventRegistry;m_defaultHandlers;constructor(t=null){this.m_source=t??this}emit(t,i){this._emit(t,i)}_emit(t,i){let s=this.m_eventRegistry?.get(t),r=this.m_defaultHandlers?.get(t);if(i||(i={}),i.source||(i.source=this.m_source),i.type||(i.type=t),s&&s.length)if(i.preventDefault||(i.preventDefault=kf),i.stopPropagation||(i.stopPropagation=Ef),s.length==1)s[0](i);else{let n=s.slice();for(let l=0,o=n.length;l<o&&(n[l](i),!i.propagationStopped);l++);}if(r&&r.length&&!i.defaultPrevented)return r[0](i)}signal(t,i,s=-1){this._signal(t,i,s)}_signal(t,i,s=-1){if(!this.m_eventRegistry)return;let r=this.m_eventRegistry.get(t);if(!(!r||!r.length))if(i||(i={}),i.type||(i.type=t),i.source||(i.source=this.m_source),i.preventDefault=i.stopPropagation=()=>{console.error("this event cannot be stopped not default prevented")},r.length==1&&s==-1)r[0](i);else{let n=r.slice(),l=h(()=>{for(let o=0,a=n.length;o<a;o++)n[o](i)},"call");s==-1?l():setTimeout(l,s)}}once(t,i){this._once(t,i)}_once(t,i){let s=h(r=>{this._off(t,s),i(r)},"newCallback");if(this._on(t,s),!i)return new Promise(function(r){i=r})}setDefaultHandler(t,i){let s=this.m_defaultHandlers;s||(s=this.m_defaultHandlers=new Map);let r=s.get(t);if(r){let n=r.indexOf(i);n!=-1&&r.splice(n,1),r.unshift(i)}else s.set(t,[i])}removeDefaultHandler(t,i){let s=this.m_defaultHandlers;if(!s)return;let r=s.get(t);if(r){let n=r.indexOf(i);n!=-1&&r.splice(n,1)}}listen(t){for(let i in t)this._on(i,t[i])}defaults(t){for(let i in t)this.setDefaultHandler(i,t[i])}on(t,i){return this._on(t,i)}_on(t,i,s=!1){this.m_eventRegistry||(this.m_eventRegistry=new Map);let r=this.m_eventRegistry.get(t);return r||(r=[],this.m_eventRegistry.set(t,r)),r.indexOf(i)==-1&&(s?r.unshift(i):r.push(i)),{dispose:()=>{this._off(t,i)}}}off(t,i){return this._off(t,i)}_off(t,i){if(!this.m_eventRegistry)return;let s=this.m_eventRegistry.get(t);if(!s)return;let r=s.indexOf(i);r!==-1&&s.splice(r,1)}removeAllListeners(t){t?(this.m_eventRegistry&&(this.m_eventRegistry[t]=void 0),this.m_defaultHandlers&&(this.m_defaultHandlers[t]=void 0)):this.m_eventRegistry=this.m_defaultHandlers=void 0}};h(_i,"EventSource");var ii=class extends _i{m_props;#e;constructor(t){super(),this.m_props=t,t.events&&this.listen(t.events)}startTimer(t,i,s=!0,r=null){this.#e?this.stopTimer(t):this.#e=new Map;let n=(s?setInterval:setTimeout)(l=>{r?r(t,l):this.emit("timer",Qc(t,l))},i);this.#e.set(t,()=>{(s?clearInterval:clearTimeout)(n)})}stopTimer(t){let i=this.#e.get(t);i&&i()}disposeTimers(){this.#e?.forEach(t=>t()),this.#e=void 0}singleShot(t,i=0){setTimeout(t,i)}mapPropEvents(t,...i){i.forEach(s=>{let r=s;t[r]&&this._on(r,t[r])})}};h(ii,"BaseComponent");var Sf=Symbol("i18n"),nn={};function iu(e,t){nn[e]={name:e,base:t,src_translations:{},translations:{}}}h(iu,"createLanguage");function su(e){return nn[e]!==void 0}h(su,"isLanguage");function ru(e,...t){if(!su(e))return;let i=nn[e];t.forEach(s=>{Df(i.src_translations,s,i.base)}),i.translations=If(i.src_translations,i.base,!0)}h(ru,"addTranslation");function Df(e,t,i){for(let s in t)e[s]instanceof Object?Df(e[s],t[s],i):(e[s]=t[s],e[s]=If(e[s],i,!1));return e}h(Df,"_patch");var Aa;function Bv(e){for(;e;){let t=nn[e],i=t.translations,s;for(let r of Aa){if(s=i[r],s===void 0)break;i=s}if(s!==void 0)return i;e=t.base}console.error("I18N error: unable to find","_tr."+Aa.join("."))}h(Bv,"_findBaseTrans");function If(e,t,i){return new Proxy(e,{get:(s,r)=>{i?Aa=[r]:Aa.push(r);let n=s[r];return n===void 0&&t&&(n=Bv(t),s[r]=n),n}})}h(If,"_mk_proxy");var Q={};function Af(e){su(e)&&(Q=nn[e].translations,Q[Sf]=e)}h(Af,"selectLanguage");function Hv(){return Q[Sf]}h(Hv,"getCurrentLanguage");function Ov(){return Object.keys(nn)}h(Ov,"getAvailableLanguages");var Wv={global:{ok:"OK",cancel:"Annuler",ignore:"Ignorer",yes:"Oui",no:"Non",open:"Ouvrir",new:"Nouveau",delete:"Supprimer",close:"Fermer",save:"Enregistrer",search:"Rechercher",search_tip:"Saisissez le texte \xE0 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\xE9rique 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\xE9v","mar","avr","mai","jun","jui","ao\xFB","sep","oct","nov","d\xE9c"],month_long:["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"],property:"Propri\xE9t\xE9",value:"Valeur",err_403:"Vous n'avez pas les droits suffisants pour effectuer cette action",copy:"Copier",cut:"Couper",paste:"Coller"}},jv={global:{ok:"OK",cancel:"Cancel",ignore:"Ignore",yes:"Yes",no:"No",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"}};iu("fr",null);ru("fr",Wv);iu("en","fr");ru("en",jv);Af("fr");function Ml(){return"ontouchstart"in window}h(Ml,"isTouchDevice");function br(e,t){let i=Math.pow(10,t),s=Math.round(e*i)/i;return Object.is(s,-0)&&(s=0),s}h(br,"roundTo");function nu(e){return e=e.replace(/\s*/g,""),e=e.replace(",","."),e.length==0?0:parseFloat(e)}h(nu,"parseIntlFloat");function xr(e){let t=e;return t=t.replace(/([a-z])([A-Z])/g,"$1 $2"),t=t.toLowerCase(),t=t.replace(/[^- a-z0-9]+/g," "),t.indexOf(" ")<0?t:(t=t.trim(),t.replace(/ /g,"-"))}h(xr,"pascalCase");function Gv(e){let t=e.toLowerCase();return t=t.replace(/[^a-zA-Z0-9]+(.)/g,(i,s)=>s.toUpperCase()),t}h(Gv,"camelCase");var At=class{x;y;constructor(t=0,i=0){this.x=t,this.y=i}};h(At,"Point");var Mi=class{width;height;constructor(t=0,i=0){this.width=t,this.height=i}};h(Mi,"Size");var ht=class{left;top;width;height;constructor(t,i,s,r){if(t===void 0)this.left=this.top=this.right=this.bottom=0;else if(t instanceof ht||t instanceof DOMRect){let n=t;this.left=n.left,this.top=n.top,this.width=n.width,this.height=n.height}else this.left=t,this.top=i,this.width=s,this.height=r}set(t,i,s,r){this.left=t,this.top=i,this.width=s,this.height=r}get bottom(){return this.top+this.height}set bottom(t){this.height=t-this.top}get right(){return this.left+this.width}set right(t){this.width=t-this.left}get topLeft(){return new At(this.left,this.top)}get bottomRight(){return new At(this.right,this.bottom)}get size(){return new Mi(this.width,this.height)}moveTo(t,i){return this.left=t,this.top=i,this}movedTo(t,i){return new ht(t,i,this.width,this.height)}moveBy(t,i){return this.left+=t,this.top+=i,this}movedBy(t,i){return new ht(this.left+t,this.top+i,this.width,this.height)}isEmpty(){return this.width==0&&this.height==0}normalize(){let t=this.width,i=this.height;return t<0&&(this.left+=t,this.width=-t),i<0&&(this.top+=i,this.height=-i),this}normalized(){let t=new ht(this),i=t.width,s=t.height;return i<0&&(t.left+=i,t.width=-i),s<0&&(t.top+=s,t.height=-s),t}containsPt(t,i){return t>=this.left&&t<=this.right&&i>=this.top&&i<=this.bottom}contains(t){return t instanceof ht?t.left>=this.left&&t.right<=this.right&&t.top>=this.top&&t.bottom<=this.bottom:t.x>=this.left&&t.x<this.right&&t.y>=this.top&&t.y<this.bottom}touches(t){return!(this.left>t.right||this.right<t.left||this.top>t.bottom||this.bottom<t.top)}inflate(t,i){i===void 0&&(i=t),this.left-=t,this.top-=i,this.width+=t+t,this.height+=i+i}inflatedBy(t,i){return i===void 0&&(i=t),new ht(this.left-t,this.top-i,this.width+t+t,this.height+i+i)}combine(t){let i=Math.min(this.left,t.left),s=Math.min(this.top,t.top),r=Math.max(this.right,t.right),n=Math.max(this.bottom,t.bottom);this.left=i,this.top=s,this.right=r,this.bottom=n}};h(ht,"Rect");function ln(e,...t){return e.replace(/{(\d+)}/g,function(i,s){return typeof t[s]<"u"?t[s]:i})}h(ln,"sprintf");function Pl(e,t=!1){if(!e||e.length==0)return"";let i=e.replace(/[<>\&\"\']/g,function(s){return"&#"+s.charCodeAt(0)+";"});return t&&(i=i.replace(/(\r\n|\n\r|\r|\n)/g,"<br/>")),i}h(Pl,"escapeHtml");function Nv(e,t=!1){if(e==null||!re(e)||e.length==0)return"";let i="";for(let s=0;s<e.length;s++){let r=e.codePointAt(s);r>127?i+="&#"+r+";":r==60?i+="<":i+=e.charAt(s)}return i}h(Nv,"removeHtmlTags");var Uv="fr-FR";function $v(e){Uv=e}h($v,"_date_set_locale");function qv(e,t){return Qe(e)}h(qv,"date_format");function Kv(e,t,i){var s=(e.getTime()-t.getTime())/1e3;let r=s;if(r<60)return ln(Q.global.diff_date_seconds,Math.round(r));let n=Math.floor(r/60);if(n<60)return ln(Q.global.diff_date_minutes,Math.round(n));let l=Math.floor(n/60);return ln(Q.global.diff_date_hours,l,n%60)}h(Kv,"date_diff");function Yv(e,t){return t?Qe(e,"Y-M-D H:I:S"):Qe(e,"Y-M-D")}h(Yv,"date_to_sql");function Xv(e){return new Date(e+" GMT")}h(Xv,"date_sql_utc");function an(e){return e.getFullYear()<<16|e.getMonth()<<8|e.getDate()}h(an,"date_hash");Date.prototype.hash=function(){return an(this)};function hn(e){return new Date(e.getTime())}h(hn,"date_clone");function Ta(e){let t=new Date(e.getFullYear(),0,1),i=(e.valueOf()-t.valueOf())/864e5;return Math.floor((i+t.getDay()+1)/7)}h(Ta,"date_calc_weeknum");function Tl(e,t=Q.global.date_input_formats){let i=t.split("|");for(let s of i){let r="";for(let o of s)o=="d"||o=="D"?r+="(?<day>\\d{1,2})":o=="m"||o=="M"?r+="(?<month>\\d{1,2})":o=="y"||o=="Y"?r+="(?<year>\\d{1,4})":o=="h"||o=="H"?r+="(?<hour>\\d{1,2})":o=="i"||o=="I"?r+="(?<min>\\d{1,2})":o=="s"||o=="S"?r+="(?<sec>\\d{1,2})":o==" "?r+="\\s+":r+="\\s*\\"+o+"\\s*";let l=new RegExp("^"+r+"$","m").exec(e);if(l){let o=new Date,a=parseInt(l.groups.day??"1"),c=parseInt(l.groups.month??"1"),u=parseInt(l.groups.year??o.getFullYear()+""),_=parseInt(l.groups.hour??"0"),p=parseInt(l.groups.min??"0"),v=parseInt(l.groups.sec??"0");u>0&&u<100&&(u+=2e3);let g=new Date(u,c-1,a,_,p,v,0),x=g.getFullYear(),E=g.getMonth()+1,y=g.getDate();return x!=u||E!=c||y!=a?null:g}}return null}h(Tl,"parseIntlDate");function Qe(e,t=Q.global.date_format){if(!e)return"";let i={year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),wday:e.getDay(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milli:e.getMilliseconds()},s="",r=0;for(let n of t){if(n=="{"){if(++r==1)continue}else if(n=="}"&&--r==0)continue;if(r){s+=n;continue}n=="d"?s+=i.day:n=="D"?s+=Ss(i.day,-2):n=="j"?s+=Q.global.day_short[i.wday]:n=="J"?s+=Q.global.day_long[i.wday]:n=="w"?s+=Ta(e):n=="W"?s+=Ss(Ta(e),-2):n=="m"?s+=i.month:n=="M"?s+=Ss(i.month,-2):n=="o"?s+=Q.global.month_short[i.month-1]:n=="O"?s+=Q.global.month_long[i.month-1]:n=="y"||n=="Y"?s+=Ss(i.year,-4):n=="a"||n=="A"?s+=i.hours<12?"am":"pm":n=="h"?s+=i.hours:n=="H"?s+=Ss(i.hours,-2):n=="i"?s+=i.minutes:n=="I"?s+=Ss(i.minutes,-2):n=="s"?s+=i.seconds:n=="S"?s+=Ss(i.seconds,-2):n=="l"?s+=i.milli:n=="L"?s+=Ss(i.milli,-3):s+=n}return s}h(Qe,"formatIntlDate");function Zv(e,t){if(t===void 0&&(t=new Date),!e)return 0;let i=t.getFullYear()-e.getFullYear();return(t.getMonth()<e.getMonth()||t.getMonth()==e.getMonth()&&t.getDate()<e.getDate())&&i--,i}h(Zv,"calcAge");Date.prototype.isSameDay=function(e){return this.getDate()==e.getDate()&&this.getMonth()==e.getMonth()&&this.getFullYear()==e.getFullYear()};Date.prototype.hash=function(){return an(this)};Date.prototype.clone=function(){return hn(this)};Date.prototype.weekNum=function(){return Ta(this)};Date.prototype.format=function(e){return Qe(this,e)};Date.prototype.addDays=function(e){return this.setDate(this.getDate()+e),this};function lu(e,t,i){let s=new Blob([e],{type:t}),r=window.URL.createObjectURL(s),n=L.createElement("a");n.style.display="none",n.href=r,n.download=i,L.body.appendChild(n),n.click(),window.URL.revokeObjectURL(r)}h(lu,"downloadData");function re(e){return typeof e=="string"}h(re,"isString");function mt(e){return e instanceof Array}h(mt,"isArray");function ct(e){return e instanceof Function}h(ct,"isFunction");function ou(e){return!!e&&e.constructor===Object}h(ou,"isLiteralObject");function Ss(e,t,i="0"){let s;return re(e)?s=e:s=""+e,t>0?s.padEnd(t,i):s.padStart(-t,i)}h(Ss,"pad");function mn(e){return typeof e=="number"&&isFinite(e)}h(mn,"isNumber");function Jv(e){let t=L.createElement("div");return t.style.position="absolute",t.style.fontFamily=e,t.style.fontSize="44px",t.style.opacity="0.001",t.innerText="X",L.body.appendChild(t),new Promise(i=>{let s=t.getBoundingClientRect(),r=setInterval(()=>{t.getBoundingClientRect().height!=s.height&&(clearInterval(r),L.body.removeChild(t),i())},0)})}h(Jv,"waitFontLoading");function au(e,t=0,...i){setTimeout(e,t,...i)}h(au,"deferCall");function fi(e){requestAnimationFrame(e)}h(fi,"asap");function Qv(e){if(!e)return"";let t=e.split(`
|
|
2
|
+
`),i="para",s="p",r=[];return t.forEach(n=>{let l=n.trim();if(i=="para"){if(l[0]=="-")l=l.substr(1),r.push("<ul>"),i="list",s="li";else if(l[0]==">")l=l.substr(1),r.push("<blockquote>"),i="quote",s="p";else if(l[0]=="#"){let c=0;do l=l.substr(1),c++;while(l[0]=="#"&&c<5);s="h"+c,i="title"}}else i=="list"?l[0]!="-"?(r.push("</ul>"),i="para",s="p"):l=l.substr(1):i=="quote"&&(l[0]!=">"?(r.push("</blockquote>"),i="para",s="p"):l=l.substr(1));let o=/\*\*([^*]+)\*\*/gi;l=Pl(l,!1),l=l.replace(o,(c,...u)=>"<b>"+c.substr(2,c.length-4)+"</b>");let a=/\*([^*]+)\*/gi;l=l.replace(a,(c,...u)=>"<i>"+c.substr(1,c.length-2)+"</i>"),l==""&&(l=" "),r.push(`<${s}>`+l+`</${s}>`),i=="title"&&(i="para",s="p")}),i=="list"?r.push("</ul>"):i=="quote"&&r.push("</blockquote>"),r.join("")}h(Qv,"markdownToHtml");var on=class extends Error{m_code;constructor(t,i){t instanceof Response?(super(t.statusText),this.m_code=t.status):(super(i),this.m_code=t)}get code(){return this.m_code}};h(on,"NetworkError");function Xt(e,t){let i="offsetX",s="offsetY";if(t&&(i="clientX",s="clientY"),e.type=="mousemove"||e.type=="mousedown"||e.type=="mouseup"){let r=e;return new At(r[i],r[s])}else if(e.type=="pointermove"||e.type=="pointerdown"||e.type=="pointerup"){let r=e;return new At(r[i],r[s])}else if(e.type=="touchmove"||e.type=="touchstart"){let r=e;return new At(r.touches[0][i],r.touches[0][s])}else if(e.type=="contextmenu"){let r=e;return new At(r[i],r[s])}else return new At(0,0)}h(Xt,"getMousePos");function cn(e,t,i){return Math.min(Math.max(e,t),i)}h(cn,"clamp");var Je=class extends String{constructor(t){super(t)}static from(t){return new Je(t)}};h(Je,"HtmlString");function un(e,...t){return Je.from(String.raw(e,...t))}h(un,"html");function si(e){return e instanceof Je}h(si,"isHtmlString");var Ma=class{static copy(t){navigator.clipboard&&navigator.clipboard.writeText(JSON.stringify(t))}static paste(t){navigator.clipboard?navigator.clipboard.readText().then(i=>t(i)):console.error("no clipboard, are you in https ?")}};h(Ma,"Clipboard");function ew(e){let t=-1,i=Buffer.from(e),s=0,r=i.length;for(;s<r;)t=t>>>8^tw[(t^i[s])&255],s++;return(t^-1)>>>0}h(ew,"crc32");var tw=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]),iw=h(e=>new Pa(e),"mix"),Pa=class{superclass;constructor(t){this.superclass=t}with(...t){return t.reduce((i,s)=>s(i),this.superclass)}};h(Pa,"MixinBuilder");function Fa(...e){let t="";for(let i of e)if(typeof i=="string")t+=" "+i;else if(i)for(let s in i)i[s]&&(t+=" "+s);return t}h(Fa,"classNames");function sw(e,t){(!e||e==null)&&(e=8),t||(t=[{chars:"abcdefghijklmnopqrstuvwxyz",min:3},{chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",min:2},{chars:"0123456789",min:2},{chars:"!@#$*|%+-_.;",min:2}]);let i="",s=0;t.forEach(function(n){i+=n.chars,s+=n.min}),e<s&&(e=s),t.push({chars:i,min:e-s});let r="";return t.forEach(function(n){n.min>0&&(r+=Mf(n.chars,n.min))}),Mf(r)}h(sw,"generatePassword");function Mf(e,t){let i=e.split("").sort(()=>.5-Math.random()).join("");return t>0&&(i=i.substr(0,t)),i}h(Mf,"shuffle");function rw(e="127.0.0.1",t="9876",i){let s;function r(){document.body.style.visibility="hidden";let a=[].slice.call(document.getElementsByTagName("link")),c=document.getElementsByTagName("head")[0];for(let u=0;u<a.length;++u){let _=a[u];c.removeChild(_);let p=_.rel;if(_.href&&typeof p!="string"||p.length==0||p.toLowerCase()=="stylesheet"){let v=_.href.replace(/(&|\?)_cacheOverride=\d+/,"");_.href=v+(v.indexOf("?")>=0?"&":"?")+"_cacheOverride="+new Date().valueOf()}c.appendChild(_)}s&&clearTimeout(s),s=setTimeout(()=>{document.body.style.visibility="unset"},50)}h(r,"refreshCSS");let l=`${window.location.protocol==="https:"?"wss://":"ws://"}${e}:${t}/ws`,o=new WebSocket(l);o.onmessage=function(a){a.data=="reload"?i?i():window.location.reload():a.data=="refreshcss"&&r()},console.log("Live reload enabled.")}h(rw,"installHMR");var Fl=class{m_sheet;m_rules=new Map;constructor(){function t(i){for(let s=0;s<L.styleSheets.length;s++){let r=L.styleSheets[s];if(r.title===i)return r}}if(h(t,"getStyleSheet"),this.m_sheet=t("@dynamic-css"),!this.m_sheet){let i=L.createElement("style");i.setAttribute("id","@dynamic-css"),L.head.appendChild(i),this.m_sheet=i.sheet}}setRule(t,i){if(re(i)){let s=this.m_rules.get(t);s!==void 0?this.m_sheet.deleteRule(s):s=this.m_sheet.cssRules.length,this.m_rules.set(t,this.m_sheet.insertRule(i,s))}else{let s=1;for(let r in i){let n=r+" { ",l=i[r];for(let o in l){let a=l[o];for(let c=0;c<a.length;c++)n+=o+": "+a[c]+"; "}n+="}",this.setRule(t+"--"+s,n),s++}}}static getVar(t){return Fl.doc_style||(Fl.doc_style=getComputedStyle(L.documentElement)),t[0]!="-"&&(t="--"+t),Fl.doc_style.getPropertyValue(t)}},ri=Fl;h(ri,"Stylesheet"),X(ri,"guid",1),X(ri,"doc_style");var dn=class{result={};parse(t){return this.result={},this.parse_json("",t),dn.mk_string(this.result)}static mk_string(t){let i="";for(let s in t){let r=t[s];i+=s+" { ";for(let n in r){let l=r[n];for(let o=0;o<l.length;o++)i+=n+": "+l[o]+"; "}i+=`}
|
|
3
|
+
`}return i}parse_json(t,i){t&&!this.result[t]&&(this.result[t]={});for(let s in i){let r=i[s];if(mt(r)){let n=r;for(let l=0;l<n.length;l++)this.addProperty(t,s,n[l])}else switch(typeof r){case"number":{this.addProperty(t,s,r);break}case"string":{this.addProperty(t,s,r);break}case"object":{this.parse_json(this.makeSelectorName(t,s),r);break}default:{console.error("ignoring unknown type "+typeof r+" in property "+s);break}}}}makePropertyName(t){return xr(t)}makeSelectorName(t,i){let s=[],r=i.split(/\s*,\s*/),n=t.split(/\s*,\s*/);for(let l=0;l<n.length;l++){let o=n[l];for(let a=0;a<r.length;a++){let c=r[a],u=!1;c.charAt(0)=="&"&&(c=c.substr(1),u=!0),c.charAt(0)==="%"&&(c=".o-"+c.substr(1)),u?s.push(o+c):s.push(o?o+" "+c:c)}}return s.join(", ")}addProperty(t,i,s){let r=i.split(/\s*,\s*/);for(let n=0;n<r.length;n++){let l=this.makePropertyName(r[n]);this.result[t][l]?this.result[t][l].push(s):this.result[t][l]=[s];let a={"box-shadow":["-moz-box-shadow","-webkit-box-shadow"],"border-radius":["-moz-border-radius","-webkit-border-radius"],"border-radius-topleft":["-moz-border-radius-topleft","-webkit-border-top-left-radius"],"border-radius-topright":["-moz-border-radius-topright","-webkit-border-top-right-radius"],"border-radius-bottomleft":["-moz-border-radius-bottomleft","-webkit-border-bottom-left-radius"],"border-radius-bottomright":["-moz-border-radius-bottomright","-webkit-border-bottom-right-radius"]}[l];for(let c=0;a&&c<a.length;c++)this.addProperty(t,a[c],s)}}};h(dn,"CSSParser");var Cr=class{m_style;constructor(t){this.m_style=t}value(t){return t=xr(t),this.m_style[t]}parse(t){return t=xr(t),parseInt(this.m_style[t])}get style(){return this.m_style}};h(Cr,"ComputedStyle");var nw="x-",yr=Symbol(),Pi=Symbol(),Ra={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridColumn:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Pf={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,create:2,sizechange:2},lw={touchstart:1,touchmove:1,touchend:1},ow=/^-?\d+(\.\d+)?$/;function Is(e=null){return se({context:e})}h(Is,"EvDblClick");function La(e=!0,t=null){return se({focus:e,context:t})}h(La,"EvFocus");var j=class extends ii{m_dom;m_iprops;constructor(t=null){super(t??{}),this.m_iprops={classes:{},dom_events:{},uid:j.__comp_guid++,inrender:!1},this.m_props.cls&&this.addClass(this.m_props.cls)}get uid(){return this.m_iprops.uid}setContent(t,i=!1){this.m_props.content=t??[],!(this.m_iprops.inrender||!this.m_dom)&&(i?this.update():this._updateContent())}getContent(){return this.m_props.content}appendChild(t){if(!t)return;let i=h(s=>{this.m_props.content?mt(this.m_props.content)||(this.m_props.content=[this.m_props.content]):this.m_props.content=[],this.m_props.content.push(s),this.m_dom&&this._appendChild(s)},"append");mt(t)?t.forEach(i):i(t)}setTag(t,i){this.m_props.tag=t,i&&(this.m_props.ns=i)}getData(t){if(this.m_props.data!==void 0)return this.m_props.data[t.toString()]}setData(t,i){let s=this.m_props.data;s===void 0&&(s=this.m_props.data={}),s[t.toString()]=i}get dom(){return this.m_dom}show(t){t===void 0||t===!0?this.removeClass("@hidden"):this.addClass("@hidden")}hide(){this.addClass("@hidden")}enable(t){t===void 0||t===!0?(this.removeClass("@disable"),this.removeAttribute("disabled")):this.disable()}disable(){this.addClass("@disable"),this.setAttribute("disabled","")}focus(){console.assert(!!this.m_dom),this.m_dom.focus()}setStyle(t){for(let i in t)this.setStyleValue(i,t[i])}setStyleValue(t,i){let s=this.m_props.style;s||(s=this.m_props.style={}),s[t]=i,this._setDomStyleValue(t,i)}_setDomStyleValue(t,i){this.m_dom&&(i===void 0?i=null:!Ra[t]&&(mn(i)||ow.test(i))&&(i=i+"px"),this.m_dom.style[t]=i)}getComputedStyle(t){return this.dom?new Cr(getComputedStyle(this.dom,t??null)):new Cr(this.m_props.style)}getStyleValue(t){return this.getComputedStyle()[t]}setAttributes(t){for(let i in t)this.setAttribute(i,t[i])}setAttribute(t,i){if(i===!1||i===void 0)this.removeAttribute(t);else{i===!0?i="":mn(i)&&(i=""+i);let s=this.m_props.attrs;s||(s=this.m_props.attrs={}),s[t]=i,this._setDomAttribute(t,i)}}_setDomAttribute(t,i){this.m_dom&&this.m_dom.setAttribute(t,i)}removeAttribute(t){let i=this.m_props.attrs;i&&(delete i[t],this.m_dom&&this.m_dom.removeAttribute(t))}getAttribute(t){return this.m_dom?this.m_dom.getAttribute(t):this.m_props.attrs?this.m_props.attrs[t]:void 0}hasAttribute(t){return this.m_dom?this.m_dom.hasAttribute(t):this.m_props.attrs.hasOwnProperty(t)}addClass(t){if(t==null||(t=t.trim(),t===""))return;let i=h(r=>{r==null||r===""||(r=this._makeCls(r),s[r]=!0,this.m_dom&&this.m_dom.classList.add(r))},"add"),s=this.m_iprops.classes;t.indexOf(" ")<0?i(t):t.split(" ").forEach(n=>i(n))}removeClass(t){if(t===void 0)return;let i=h(s=>{s==null||s===""||(s=this._makeCls(s),delete this.m_iprops.classes[s],this.m_dom&&this.m_dom.classList.remove(s))},"remove");if(t.indexOf(" ")<0)i(t);else{let s=t.trim().split(" ");for(let r of s)r!=null&&r!==""&&i(r)}}setClass(t,i){return i?this.addClass(t):this.removeClass(t),this}toggleClass(t){let i=h(s=>{s===void 0&&s===null&&s===""||(s=this._makeCls(s),this.m_iprops.classes[s]?delete this.m_iprops.classes[s]:this.m_iprops.classes[s]=!0,this.m_dom&&this.m_dom.classList.toggle(s))},"toggle");if(t.indexOf(" ")<0)i(t);else{let s=t.trim().split(" ");for(let r of s)i(r)}}hasClass(t){let i=this._makeCls(t);return this.m_dom?this.dom.classList.contains(i):!!this.m_iprops.classes[i]}clearClasses(){if(this.m_iprops.classes={},this.m_dom)return this.m_dom.classList.value=""}_build(){return this.m_dom?this.m_dom:(this._createDOM(),this.m_dom)}render(t){}_createDOM(){if(this.m_dom)return this.m_dom;let t=this.m_props;if(t.tabIndex!==void 0&&this._setTabIndex(t.tabIndex),this.render(t),t.left!==void 0&&this.setStyleValue("left",t.left),t.top!==void 0&&this.setStyleValue("top",t.top),t.width!==void 0&&this.setStyleValue("width",t.width),t.height!==void 0&&this.setStyleValue("height",t.height),t.flex!==void 0&&(this.addClass("@flex"),t.flex!=1&&this.setStyleValue("flex",t.flex)),t.enabled===!1&&this.disable(),t.tooltip!==void 0&&this.setAttribute("tip",t.tooltip.replace(/\n/gi,"<br/>")),t.dom_events)for(let o in t.dom_events)this._setDomEvent(o,t.dom_events[o]);this._genClassName(),this.m_props.cls=void 0;let i=this.m_iprops;t.ns?this.m_dom=L.createElementNS(t.ns,t.tag??"div"):this.m_dom=L.createElement(t.tag??"div"),this.m_dom[Pi]=this,this.m_dom.classList.add(...Object.keys(i.classes));let s=t.style;if(s)for(let o in s)this._setDomStyleValue(o,s[o]);let r=t.attrs;if(r)for(let o in r){let a=r[o];a!==!1&&a!==void 0&&this._setDomAttribute(o,r[o])}this.m_props.id&&this._setDomAttribute("id",this.m_props.id);let n=this.m_iprops.dom_events;if(n)for(let o in n){let a=n[o];for(let c of a)this.createEvent(o,c)}let l=t.content;return l&&(mt(l)||(l=[l]),l.forEach(o=>{o&&(re(o)?this.m_dom.insertAdjacentText("beforeend",o):si(o)?this.m_dom.insertAdjacentHTML("beforeend",o):o instanceof j?this.m_dom.append(o._build()):console.log("unknown element type: ",o))})),j.__createObserver||(j.__createObserver=new MutationObserver(j._observeCreation),j.__createObserver.observe(L.body,{childList:!0,subtree:!0})),this.m_dom}_setTabIndex(t,i=0){t===!0?t=0:t===void 0&&(t=i),t!==!1&&t!==void 0&&this.setAttribute("tabindex",t),this.m_props.tabIndex=t}static _observeCreation(t){let i=h(s=>{s.m_iprops.created||(s.dom&&s.m_iprops.dom_events&&s.m_iprops.dom_events.create&&s.dom.dispatchEvent(new Event("create")),s.componentCreated(),s.m_iprops.created=!0)},"notify");for(let s of t)if(s.type=="childList")for(let r=0,n=s.addedNodes.length;r<n;r++){let o=s.addedNodes[r][Pi];o&&(o.enumChilds(a=>{i(a)},!0),i(o))}}dispose(){this.m_dom&&this._dispose(!0,!0)}_dispose(t,i){let s=this.m_dom;delete s[Pi],delete s[yr],t&&s.remove(),this.enumChilds(r=>{r._dispose(!1,!0)}),this.m_dom=null,i&&this.disposeTimers(),this.componentDisposed(),this.m_iprops.created=!1}componentDisposed(){}componentCreated(){}update(t=0){if(this.m_dom){let i=h(()=>{let s=this.m_dom;this._dispose(!1,!1);let r=this._build();console.assert(!!s.parentNode,"update in componentCreated is not allowed, use updateContent"),s.parentNode.replaceChild(r,s)},"_update");t?this.singleShot(i,t):i()}}_empty(){let t=this.m_dom;if(t)for(;t.firstChild;)t.removeChild(t.firstChild)}_updateContent(){if(!this.m_dom)return;this._empty();let t=this.m_props.content;t&&(mt(t)||(t=[t]),t.forEach(i=>{i&&(si(i)?this.m_dom.insertAdjacentHTML("beforeend",i):i instanceof j?this.m_dom.append(i._build()):this.m_dom.insertAdjacentText("beforeend",i+""))}))}getBoundingRect(t=!1){console.assert(this.dom!=null,"cannot get bounding rect of an non DOM element");let i=this.dom.getBoundingClientRect(),s=new ht(i.left,i.top,i.width,i.height);if(t){let r=this.getComputedStyle(),n=r.parse("marginTop"),l=r.parse("marginBottom"),o=r.parse("marginLeft"),a=r.parse("marginRight");s.left-=o,s.width+=o+a,s.top-=n,s.height+=n+l}return s}setDomEvent(t,i){let s=i;this._setDomEvent(t,s)}_setDomEvent(t,i){this.m_iprops.dom_events||(this.m_iprops.dom_events={});let s=this.m_iprops.dom_events[t];s?s.push(i):s=this.m_iprops.dom_events[t]=[i],this.m_dom&&this.createEvent(t,i)}clearDomEvent(t){if(!this.m_iprops.dom_events)return;delete this.m_iprops.dom_events[t];let i=this.m_dom;if(i){let s=i[yr];s&&delete s[t]}}createEvent(t,i){let s=this.m_dom,r=s[yr];r||(r=s[yr]={}),r[t]?r[t].push(i):r[t]=[i],Pf[t]===1?s["on"+t]=j._dispatchUnbubbleEvent:j.__privateEvents[t]||(j.__privateEvents[t]=!0,lw[t]?L.addEventListener(t,j._dispatchEvent,{passive:!1,capture:!0}):L.addEventListener(t,j._dispatchEvent,!0)),t==="sizechange"&&(j.__sizeObserver||(j.__sizeObserver=new ResizeObserver(j._observeSize)),j.__sizeObserver.observe(this.m_dom))}static _dispatchEvent(t){let i=t.target,s=Pf[t.type]===2;for(;i;){if(i[yr]){let r=i[yr][t.type];if(r){let n=i[Pi],l=n?.root??null;if(r instanceof Array?r.some(o=>{if(o(t,l),!n.dom)return!0}):r(t,l),t.cancelBubble||t.defaultPrevented||s)break}}if(i=i.parentNode,i==document)break}}static _dispatchUnbubbleEvent(t){let i=t.currentTarget||t.target,s=t.type,r=i[yr],n=r&&r[s];if(n){let o=i[Pi]?.root??null;n instanceof Array?n.forEach(a=>{a(t,o)}):n(t,o)}}static _observeSize(t){t.forEach(i=>{let s=i.target;s.offsetParent!==null&&s.dispatchEvent(new Event("sizechange"))})}enumChilds(t,i=!1){if(this.m_dom){let s=this.m_dom.firstChild;for(;s;){let r=s[Pi];if(r&&(t(r),i&&r.enumChilds(t,!0)===!0))return!0;s=s.nextSibling}}else{let s=this.m_props.content;if(!s)return;mt(s)||(s=[s]),s.some(r=>{if(!(!r||re(r)||si(r))&&(t(r)||i&&r.enumChilds(t,!0)===!0))return!0})}return!1}_appendChild(t){if(re(t))this.m_dom.insertAdjacentText("beforeend",t);else if(si(t))this.m_dom.insertAdjacentHTML("beforeend",t);else{let i=t;try{i._build(),this.m_dom.appendChild(i.m_dom)}catch(s){console.error(s)}}}_genClassName(){this.addClass("@comp");let t=Object.getPrototypeOf(this);for(;t&&t.constructor!==j;){let i=t.constructor.name;this.addClass("@"+xr(i)),t=Object.getPrototypeOf(t)}}_makeCls(t){return t[0]=="@"?t=nw+t.substring(1):t}static dispatchCaptures(t){j.__capture.handler(t)}static setCapture(t,i){if(console.assert(!j.__capture),j.__capture)debugger;let s=L.querySelectorAll("iframe");s.forEach(o=>{ut(o).setStyleValue("pointer-events","none")});let r=L.querySelectorAll(":hover"),n=null;if(r.length){let o=r[r.length-1];n=window.getComputedStyle(o).cursor}j.__capture_mask=L.createElement("div");let l=ut(j.__capture_mask);l.addClass("@capture-mask"),n&&l.setStyleValue("cursor",n),L.body.appendChild(l.dom),L.addEventListener("mousedown",j.dispatchCaptures),L.addEventListener("mousemove",j.dispatchCaptures),L.addEventListener("mouseup",j.dispatchCaptures),L.addEventListener("touchstart",j.dispatchCaptures),L.addEventListener("touchmove",j.dispatchCaptures),L.addEventListener("touchend",j.dispatchCaptures),j.__capture={initiator:t,handler:i,iframes:s}}static releaseCapture(){console.assert(!!j.__capture),L.removeEventListener("touchstart",j.dispatchCaptures),L.removeEventListener("touchmove",j.dispatchCaptures),L.removeEventListener("touchend",j.dispatchCaptures),L.removeEventListener("mousedown",j.dispatchCaptures),L.removeEventListener("mousemove",j.dispatchCaptures),L.removeEventListener("mouseup",j.dispatchCaptures),j.__capture.iframes.forEach(t=>{ut(t).setStyleValue("pointer-events",null)}),j.__capture=null,j.__capture_mask&&(L.body.removeChild(j.__capture_mask),j.__capture_mask=null)}scrollIntoView(t){if(this.m_dom){let i=new ht(this.dom.getBoundingClientRect()),s,r,n,l,o=this.dom.parentElement,a=L.body;for(;o&&o!=a;){let c=o.getBoundingClientRect();(s===void 0||s<c.top)&&(s=c.top),(r===void 0||r>c.bottom)&&(r=c.bottom),(n===void 0||n<c.left)&&(n=c.left),(l===void 0||l>c.right)&&(l=c.right),o=o.parentElement}(s===void 0||i.top<s||i.bottom>r||i.left<n||i.right>l)&&this.m_dom.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"})}}queryItem(t){let i=this.dom.querySelector(t);return i?j.getElement(i):null}queryAll(t,i){let s=Array.from(this.m_dom.querySelectorAll(t));return i&&s.forEach(r=>{i(ut(r))}),s}itemWithId(t){let i=this.dom.querySelector("#"+t);return i?j.getElement(i):null}itemWithRef(t){let i=null;return this.enumChilds(s=>{if(s.m_props.ref===t)return i=s,!0},!0),i}get ref(){return this.m_props.ref}static getCss(){return j.__css||(j.__css=new ri),j.__css}getParent(){console.assert(!!this.m_dom);let t=this.dom.parentNode;return j.getElement(t)}static getElement(t,i){if(i){let s=re(i);for(;t;){let r=t[Pi];if(s){if(r&&r.hasClass(i))return r}else if(r instanceof i)return r;t=t.parentElement}return null}else return t?t[Pi]:null}static getScrollbarSize(){if(j.__sb_width===void 0){let t=L.createElement("div");t.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px";let i=L.createElement("div");i.style.width="200px",i.style.height="200px",t.appendChild(i),L.body.appendChild(t),j.__sb_width=t.offsetWidth-t.clientWidth,L.body.removeChild(t)}return j.__sb_width}isUserVisible(){return this.m_dom?this.m_dom.offsetParent!==null:!1}},I=j;h(I,"Component"),X(I,"__sb_width"),X(I,"__comp_guid",1e3),X(I,"__privateEvents",{}),X(I,"__sizeObserver"),X(I,"__createObserver"),X(I,"__capture",null),X(I,"__capture_mask",null),X(I,"__css",null);var Tf=null;function ut(e){if(e[Pi])return e[Pi];let t=Tf;return t||(t=Tf=new I({})),t.m_dom=e,t}h(ut,"flyWrap");var Ds=class extends I{constructor(t={}){t.flex||(t.flex=1),super(t)}};h(Ds,"Flex");var za=class extends I{m_size;constructor(t){super({}),this.m_size=t}componentCreated(){let t=this.dom,i=null;for(;t;){let s=t[Pi];if(s.hasClass("@hlayout")){i={width:this.m_size};break}else if(s.hasClass("@vlayout")){i={height:this.m_size};break}t=t.parentElement}i||(i={width:this.m_size,height:this.m_size}),this.setStyle(i)}};h(za,"Space");function dt(e,t=null,i=null){return se({size:e,mode:t,context:i})}h(dt,"EvSize");var _n=class extends I{m_irect;m_delta;m_target;constructor(t){super(t),this.setDomEvent("mousedown",i=>this._mousedown(i)),this.setDomEvent("touchstart",i=>this._mousedown(i)),this.setDomEvent("dblclick",i=>this._collapse(i))}render(){this.addClass(this.m_props.orientation)}_collapse(t){this.m_props.collapsible&&(this._findTarget(),this.m_target&&this.m_target.toggleClass("@collapsed"))}_mousedown(t){if(t.type=="touchstart"){let i=t;i.touches.length==1&&this._startMoving(i.touches[0].pageX,i.touches[0].pageY,t)}else{let i=t;this._startMoving(i.pageX,i.pageY,t)}}_startMoving(t,i,s){this._findTarget(),this.m_target&&(this.m_props.orientation=="horizontal"?this.m_props.sizing=="before"?this.m_delta=t-this.m_irect.right:this.m_delta=t-this.m_irect.left:this.m_props.sizing=="before"?this.m_delta=i-this.m_irect.bottom:this.m_delta=i-this.m_irect.top,s.preventDefault(),s.stopPropagation(),this.m_target.addClass("sizing"),I.setCapture(this,r=>this._pointerMoved(r)))}_pointerMoved(t){let i=h((s,r)=>{if(this.m_props.orientation=="horizontal"){let n;if(this.m_props.sizing=="after"?n=this.m_irect.right-(s-this.m_delta):n=s-this.m_delta-this.m_irect.left,n>0){let l=new Mi(n,0);this.emit("resize",dt(l)),this.m_target.setStyleValue("width",l.width),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}else{let n;if(this.m_props.sizing=="after"?n=this.m_irect.bottom-(r-this.m_delta):n=r-this.m_delta-this.m_irect.top,n>0){let l=new Mi(0,n);this.emit("resize",dt(l)),this.m_target.setStyleValue("height",l.height),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}},"__move");if(t.type=="mousemove"){let s=t;i(s.pageX,s.pageY),t.preventDefault(),t.stopPropagation()}else if(t.type=="touchmove"){let s=t;i(s.touches[0].pageX,s.touches[0].pageY),t.preventDefault(),t.stopPropagation()}else(t.type=="mouseup"||t.type=="touchend")&&(this.m_target.removeClass("sizing"),I.releaseCapture(),t.preventDefault(),t.stopPropagation())}_findTarget(){if(!this.m_target)if(this.m_props.sizing=="before"){let t=this.dom.previousElementSibling,i=t?I.getElement(t):null;this.m_target=i}else{let t=this.dom.nextElementSibling,i=t?I.getElement(t):null;this.m_target=i}this.m_target?this.m_irect=this.m_target.getBoundingRect():this.m_irect=null}};h(_n,"Separator");function Ff(e,t,i=null){return se({ui_event:e,sens:t,context:i})}h(Ff,"EvOverlayResize");var ls=class extends I{m_delta;m_irect;constructor(t){super(t),this.addClass(t.sens),this.setDomEvent("mousedown",i=>this._mousedown(i)),this.setDomEvent("touchstart",i=>this._mousedown(i)),this.setDomEvent("dblclick",i=>this.resetflex(i)),t.target.appendChild(this),t.resize&&this.on("resize",this.m_props.resize)}resetflex(t){this.m_props.target.addClass("@flex"),this.emit("resize",dt({width:-1,height:0})),t.preventDefault(),t.stopPropagation()}_mousedown(t){t.preventDefault(),t.stopPropagation();let i=Ff(t,this.m_props.sens);if(this.emit("rawresize",i),i.defaultPrevented)return;let s=Xt(t,!0);this.m_irect=this.m_props.target.getBoundingRect(),this.m_props.sens=="right"?this.m_delta=s.x-this.m_irect.right:this.m_props.sens=="left"?this.m_delta=s.x-this.m_irect.left:this.m_props.sens=="bottom"?this.m_delta=s.y-this.m_irect.bottom:this.m_props.sens=="top"&&(this.m_delta=s.y-this.m_irect.top),this.m_props.target.addClass("sizing"),I.setCapture(this,r=>this._handle_mouse(r))}_is_horz(){return this.m_props.sens=="left"||this.m_props.sens=="right"}get sens(){return this.m_props.sens}_handle_mouse(t){let i=h((s,r)=>{if(this._is_horz()){let n;if(this.m_props.sens=="left"?n=this.m_irect.right-(s-this.m_delta):n=s-this.m_delta-this.m_irect.left,n>0){let l={width:n,height:void 0};this.emit("resize",dt(l)),this.m_props.target.setStyleValue("width",l.width),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}else{let n;if(this.m_props.sens=="top"?n=this.m_irect.bottom-(r-this.m_delta):n=r-this.m_delta-this.m_irect.top,n>0){let l=new Mi(0,n);this.emit("resize",dt(l)),this.m_props.target.setStyleValue("height",l.height),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}},"__move");if(t.type=="mousemove"){let s=t;i(s.pageX,s.pageY),t.preventDefault(),t.stopPropagation()}else if(t.type=="touchmove"){let s=t;i(s.touches[0].pageX,s.touches[0].pageY),t.preventDefault(),t.stopPropagation()}else(t.type=="mouseup"||t.type=="touchend")&&(this.m_props.target.removeClass("sizing"),I.releaseCapture(),t.preventDefault(),t.stopPropagation())}};h(ls,"SizerOverlay");function aw(e){return se({name:e})}h(aw,"EvShortcut");var Ae=class extends I{m_shortcuts;constructor(t){mt(t)?super({content:t}):super(t)}addShortcut(t,i,s=null,r=!1){this.m_shortcuts||(this.m_shortcuts=[],this.setDomEvent("keydown",n=>this._handleKeydown(n))),mt(t)||(t=[t]),t.forEach(n=>{let l="";n.match(/SHIFT/i)&&(n=n.replace(/SHIFT/i,""),l+="shift+"),n.match(/CTRL/i)&&(n=n.replace(/CTRL/i,""),l+="ctrl+"),n.match(/CMD/i)&&(n=n.replace(/CMD/i,""),l+="cmd+"),n.match(/ALT/i)&&(n=n.replace(/ALT/i,""),l+="alt+"),l+=n.replace("+","").toLowerCase(),this.m_shortcuts.push({sequence:l,name:i,immediate:r,callback:s})})}removeShortcuts(){this.m_shortcuts&&(this.m_shortcuts=[])}_handleKeydown(t){if(!this.m_shortcuts)return;let i="";t.shiftKey&&(i+="shift+"),t.ctrlKey&&(i+="ctrl+"),t.metaKey&&(i+="cmd+"),t.altKey&&(i+="alt+"),i+=t.key.toLowerCase(),this.m_shortcuts.some(s=>{if(s.sequence==i)return s.callback?s.immediate?s.callback(t):fi(()=>{s.callback(t)}):this.emit("shortcut",aw(s.name)),t.preventDefault(),t.stopPropagation(),!0})}};h(Ae,"Container");var fn=class{m_data;m_name;constructor(t){this.m_data=null,this.m_name=t??"settings"}set(t,i){this._load(),this.m_data[t]=i,this._save()}get(t,i){return this._load(),this.m_data[t]??i}_save(){let t=JSON.stringify(this.m_data);localStorage.setItem(this.m_name,t)}_load(){if(this.m_data)return;this.m_data={};let t=localStorage.getItem(this.m_name);t!==null&&(t=JSON.parse(t),t?this.m_data=t:console.info("There was an error attempting to read your settings."))}};h(fn,"Settings");var ep=Object.defineProperty,hw=h((e,t,i)=>t in e?ep(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,"__defNormalProp"),m=h((e,t)=>ep(e,"name",{value:t,configurable:!0}),"__name"),de=h((e,t,i)=>(hw(e,typeof t!="symbol"?t+"":t,i),i),"__publicField"),V=document,tp=m(function(){this.propagationStopped=!0},"stopPropagation"),ip=m(function(){this.defaultPrevented=!0},"preventDefault");function ze(e){return{stopPropagation:tp,preventDefault:ip,...e}}h(ze,"BasicEvent");m(ze,"BasicEvent");function lr(e=null){return ze({context:e})}h(lr,"EvClick");m(lr,"EvClick");function Xe(e,t=null){return ze({value:e,context:t})}h(Xe,"EvChange");m(Xe,"EvChange");function hs(e,t=null){return ze({selection:e,context:t})}h(hs,"EvSelectionChange");m(hs,"EvSelectionChange");function Hr(e,t=null){return ze({uievent:e,context:t})}h(Hr,"EvContextMenu");m(Hr,"EvContextMenu");function sp(e,t=0,i=null){return ze({timer:e,time:t,context:i})}h(sp,"EvTimer");m(sp,"EvTimer");function mw(e,t,i){return ze({msg:e,params:t,source:i})}h(mw,"EvMessage");m(mw,"EvMessage");function rp(e,t,i){return ze({element:e,data:t,context:i})}h(rp,"EvDrag");m(rp,"EvDrag");function np(e,t){return ze({code:e,message:t})}h(np,"EvError");m(np,"EvError");var po=h(class{m_source;m_eventRegistry;m_defaultHandlers;constructor(e=null){this.m_source=e??this}emit(e,t){this._emit(e,t)}_emit(e,t){let i=this.m_eventRegistry?.get(e),s=this.m_defaultHandlers?.get(e);if(t||(t={}),t.source||(t.source=this.m_source),t.type||(t.type=e),i&&i.length)if(t.preventDefault||(t.preventDefault=ip),t.stopPropagation||(t.stopPropagation=tp),i.length==1)i[0](t);else{let r=i.slice();for(let n=0,l=r.length;n<l&&(r[n](t),!t.propagationStopped);n++);}if(s&&s.length&&!t.defaultPrevented)return s[0](t)}signal(e,t,i=-1){this._signal(e,t,i)}_signal(e,t,i=-1){if(!this.m_eventRegistry)return;let s=this.m_eventRegistry.get(e);if(!(!s||!s.length))if(t||(t={}),t.type||(t.type=e),t.source||(t.source=this.m_source),t.preventDefault=t.stopPropagation=()=>{console.error("this event cannot be stopped not default prevented")},s.length==1&&i==-1)s[0](t);else{let r=s.slice(),n=m(()=>{for(let l=0,o=r.length;l<o;l++)r[l](t)},"call");i==-1?n():setTimeout(n,i)}}once(e,t){this._once(e,t)}_once(e,t){let i=m(s=>{this._off(e,i),t(s)},"newCallback");if(this._on(e,i),!t)return new Promise(function(s){t=s})}setDefaultHandler(e,t){let i=this.m_defaultHandlers;i||(i=this.m_defaultHandlers=new Map);let s=i.get(e);if(s){let r=s.indexOf(t);r!=-1&&s.splice(r,1),s.unshift(t)}else i.set(e,[t])}removeDefaultHandler(e,t){let i=this.m_defaultHandlers;if(!i)return;let s=i.get(e);if(s){let r=s.indexOf(t);r!=-1&&s.splice(r,1)}}listen(e){for(let t in e)this._on(t,e[t])}defaults(e){for(let t in e)this.setDefaultHandler(t,e[t])}on(e,t){return this._on(e,t)}_on(e,t,i=!1){this.m_eventRegistry||(this.m_eventRegistry=new Map);let s=this.m_eventRegistry.get(e);return s||(s=[],this.m_eventRegistry.set(e,s)),s.indexOf(t)==-1&&(i?s.unshift(t):s.push(t)),{dispose:()=>{this._off(e,t)}}}off(e,t){return this._off(e,t)}_off(e,t){if(!this.m_eventRegistry)return;let i=this.m_eventRegistry.get(e);if(!i)return;let s=i.indexOf(t);s!==-1&&i.splice(s,1)}removeAllListeners(e){e?(this.m_eventRegistry&&(this.m_eventRegistry[e]=void 0),this.m_defaultHandlers&&(this.m_defaultHandlers[e]=void 0)):this.m_eventRegistry=this.m_defaultHandlers=void 0}},"EventSource");m(po,"EventSource");var Yn=h(class extends po{m_props;#e;constructor(e){super(),this.m_props=e,e.events&&this.listen(e.events)}startTimer(e,t,i=!0,s=null){this.#e?this.stopTimer(e):this.#e=new Map;let r=(i?setInterval:setTimeout)(n=>{s?s(e,n):this.emit("timer",sp(e,n))},t);this.#e.set(e,()=>{(i?clearInterval:clearTimeout)(r)})}stopTimer(e){let t=this.#e.get(e);t&&t()}disposeTimers(){this.#e?.forEach(e=>e()),this.#e=void 0}singleShot(e,t=0){setTimeout(e,t)}mapPropEvents(e,...t){t.forEach(i=>{let s=i;e[s]&&this._on(s,e[s])})}},"BaseComponent");m(Yn,"BaseComponent");var lp=Symbol("i18n"),Xn={};function fd(e,t){Xn[e]={name:e,base:t,src_translations:{},translations:{}}}h(fd,"createLanguage");m(fd,"createLanguage");function pd(e){return Xn[e]!==void 0}h(pd,"isLanguage");m(pd,"isLanguage");function gd(e,...t){if(!pd(e))return;let i=Xn[e];t.forEach(s=>{vd(i.src_translations,s,i.base)}),i.translations=wd(i.src_translations,i.base,!0)}h(gd,"addTranslation");m(gd,"addTranslation");function vd(e,t,i){for(let s in t)e[s]instanceof Object?vd(e[s],t[s],i):(e[s]=t[s],e[s]=wd(e[s],i,!1));return e}h(vd,"_patch");m(vd,"_patch");var ih;function op(e){for(;e;){let t=Xn[e],i=t.translations,s;for(let r of ih){if(s=i[r],s===void 0)break;i=s}if(s!==void 0)return i;e=t.base}console.error("I18N error: unable to find","_tr."+ih.join("."))}h(op,"_findBaseTrans");m(op,"_findBaseTrans");function wd(e,t,i){return new Proxy(e,{get:(s,r)=>{i?ih=[r]:ih.push(r);let n=s[r];return n===void 0&&t&&(n=op(t),s[r]=n),n}})}h(wd,"_mk_proxy");m(wd,"_mk_proxy");var ne={};function ap(e){pd(e)&&(ne=Xn[e].translations,ne[lp]=e)}h(ap,"selectLanguage");m(ap,"selectLanguage");function cw(){return ne[lp]}h(cw,"getCurrentLanguage");m(cw,"getCurrentLanguage");function uw(){return Object.keys(Xn)}h(uw,"getAvailableLanguages");m(uw,"getAvailableLanguages");var dw={global:{ok:"OK",cancel:"Annuler",ignore:"Ignorer",yes:"Oui",no:"Non",open:"Ouvrir",new:"Nouveau",delete:"Supprimer",close:"Fermer",save:"Enregistrer",search:"Rechercher",search_tip:"Saisissez le texte \xE0 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\xE9rique 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\xE9v","mar","avr","mai","jun","jui","ao\xFB","sep","oct","nov","d\xE9c"],month_long:["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"],property:"Propri\xE9t\xE9",value:"Valeur",err_403:"Vous n'avez pas les droits suffisants pour effectuer cette action",copy:"Copier",cut:"Couper",paste:"Coller"}},_w={global:{ok:"OK",cancel:"Cancel",ignore:"Ignore",yes:"Yes",no:"No",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"}};fd("fr",null);gd("fr",dw);fd("en","fr");gd("en",_w);ap("fr");function bd(){return"ontouchstart"in window}h(bd,"isTouchDevice");m(bd,"isTouchDevice");function go(e,t){let i=Math.pow(10,t),s=Math.round(e*i)/i;return Object.is(s,-0)&&(s=0),s}h(go,"roundTo");m(go,"roundTo");function hp(e){return e=e.replace(/\s*/g,""),e=e.replace(",","."),e.length==0?0:parseFloat(e)}h(hp,"parseIntlFloat");m(hp,"parseIntlFloat");function Zl(e){let t=e;return t=t.replace(/([a-z])([A-Z])/g,"$1 $2"),t=t.toLowerCase(),t=t.replace(/[^- a-z0-9]+/g," "),t.indexOf(" ")<0?t:(t=t.trim(),t.replace(/ /g,"-"))}h(Zl,"pascalCase");m(Zl,"pascalCase");function fw(e){let t=e.toLowerCase();return t=t.replace(/[^a-zA-Z0-9]+(.)/g,(i,s)=>s.toUpperCase()),t}h(fw,"camelCase");m(fw,"camelCase");var Gi=h(class{x;y;constructor(e=0,t=0){this.x=e,this.y=t}},"Point");m(Gi,"Point");var Dn=h(class{width;height;constructor(e=0,t=0){this.width=e,this.height=t}},"Size");m(Dn,"Size");var Hi=h(class{left;top;width;height;constructor(e,t,i,s){if(e===void 0)this.left=this.top=this.right=this.bottom=0;else if(e instanceof Hi||e instanceof DOMRect){let r=e;this.left=r.left,this.top=r.top,this.width=r.width,this.height=r.height}else this.left=e,this.top=t,this.width=i,this.height=s}set(e,t,i,s){this.left=e,this.top=t,this.width=i,this.height=s}get bottom(){return this.top+this.height}set bottom(e){this.height=e-this.top}get right(){return this.left+this.width}set right(e){this.width=e-this.left}get topLeft(){return new Gi(this.left,this.top)}get bottomRight(){return new Gi(this.right,this.bottom)}get size(){return new Dn(this.width,this.height)}moveTo(e,t){return this.left=e,this.top=t,this}movedTo(e,t){return new Hi(e,t,this.width,this.height)}moveBy(e,t){return this.left+=e,this.top+=t,this}movedBy(e,t){return new Hi(this.left+e,this.top+t,this.width,this.height)}isEmpty(){return this.width==0&&this.height==0}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}normalized(){let e=new Hi(this),t=e.width,i=e.height;return t<0&&(e.left+=t,e.width=-t),i<0&&(e.top+=i,e.height=-i),e}containsPt(e,t){return e>=this.left&&e<=this.right&&t>=this.top&&t<=this.bottom}contains(e){return e instanceof Hi?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)}inflate(e,t){t===void 0&&(t=e),this.left-=e,this.top-=t,this.width+=e+e,this.height+=t+t}inflatedBy(e,t){return t===void 0&&(t=e),new Hi(this.left-e,this.top-t,this.width+e+e,this.height+t+t)}combine(e){let t=Math.min(this.left,e.left),i=Math.min(this.top,e.top),s=Math.max(this.right,e.right),r=Math.max(this.bottom,e.bottom);this.left=t,this.top=i,this.right=s,this.bottom=r}},"Rect");m(Hi,"Rect");function $l(e,...t){return e.replace(/{(\d+)}/g,function(i,s){return typeof t[s]<"u"?t[s]:i})}h($l,"sprintf");m($l,"sprintf");function sh(e,t=!1){if(!e||e.length==0)return"";let i=e.replace(/[<>\&\"\']/g,function(s){return"&#"+s.charCodeAt(0)+";"});return t&&(i=i.replace(/(\r\n|\n\r|\r|\n)/g,"<br/>")),i}h(sh,"escapeHtml");m(sh,"escapeHtml");function pw(e,t=!1){if(e==null||!We(e)||e.length==0)return"";let i="";for(let s=0;s<e.length;s++){let r=e.codePointAt(s);r>127?i+="&#"+r+";":r==60?i+="<":i+=e.charAt(s)}return i}h(pw,"removeHtmlTags");m(pw,"removeHtmlTags");var gw="fr-FR";function vw(e){gw=e}h(vw,"_date_set_locale");m(vw,"_date_set_locale");function ww(e,t){return Ot(e)}h(ww,"date_format");m(ww,"date_format");function bw(e,t,i){var s=(e.getTime()-t.getTime())/1e3;let r=s;if(r<60)return $l(ne.global.diff_date_seconds,Math.round(r));let n=Math.floor(r/60);if(n<60)return $l(ne.global.diff_date_minutes,Math.round(n));let l=Math.floor(n/60);return $l(ne.global.diff_date_hours,l,n%60)}h(bw,"date_diff");m(bw,"date_diff");function xw(e,t){return t?Ot(e,"Y-M-D H:I:S"):Ot(e,"Y-M-D")}h(xw,"date_to_sql");m(xw,"date_to_sql");function Cw(e){return new Date(e+" GMT")}h(Cw,"date_sql_utc");m(Cw,"date_sql_utc");function Jl(e){return e.getFullYear()<<16|e.getMonth()<<8|e.getDate()}h(Jl,"date_hash");m(Jl,"date_hash");Date.prototype.hash=function(){return Jl(this)};function ql(e){return new Date(e.getTime())}h(ql,"date_clone");m(ql,"date_clone");function rh(e){let t=new Date(e.getFullYear(),0,1),i=(e.valueOf()-t.valueOf())/864e5;return Math.floor((i+t.getDay()+1)/7)}h(rh,"date_calc_weeknum");m(rh,"date_calc_weeknum");function Wa(e,t=ne.global.date_input_formats){let i=t.split("|");for(let s of i){let r="";for(let o of s)o=="d"||o=="D"?r+="(?<day>\\d{1,2})":o=="m"||o=="M"?r+="(?<month>\\d{1,2})":o=="y"||o=="Y"?r+="(?<year>\\d{1,4})":o=="h"||o=="H"?r+="(?<hour>\\d{1,2})":o=="i"||o=="I"?r+="(?<min>\\d{1,2})":o=="s"||o=="S"?r+="(?<sec>\\d{1,2})":o==" "?r+="\\s+":r+="\\s*\\"+o+"\\s*";let l=new RegExp("^"+r+"$","m").exec(e);if(l){let o=new Date,a=parseInt(l.groups.day??"1"),c=parseInt(l.groups.month??"1"),u=parseInt(l.groups.year??o.getFullYear()+""),_=parseInt(l.groups.hour??"0"),p=parseInt(l.groups.min??"0"),v=parseInt(l.groups.sec??"0");u>0&&u<100&&(u+=2e3);let g=new Date(u,c-1,a,_,p,v,0),x=g.getFullYear(),E=g.getMonth()+1,y=g.getDate();return x!=u||E!=c||y!=a?null:g}}return null}h(Wa,"parseIntlDate");m(Wa,"parseIntlDate");function Ot(e,t=ne.global.date_format){if(!e)return"";let i={year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),wday:e.getDay(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milli:e.getMilliseconds()},s="",r=0;for(let n of t){if(n=="{"){if(++r==1)continue}else if(n=="}"&&--r==0)continue;if(r){s+=n;continue}n=="d"?s+=i.day:n=="D"?s+=Fs(i.day,-2):n=="j"?s+=ne.global.day_short[i.wday]:n=="J"?s+=ne.global.day_long[i.wday]:n=="w"?s+=rh(e):n=="W"?s+=Fs(rh(e),-2):n=="m"?s+=i.month:n=="M"?s+=Fs(i.month,-2):n=="o"?s+=ne.global.month_short[i.month-1]:n=="O"?s+=ne.global.month_long[i.month-1]:n=="y"||n=="Y"?s+=Fs(i.year,-4):n=="a"||n=="A"?s+=i.hours<12?"am":"pm":n=="h"?s+=i.hours:n=="H"?s+=Fs(i.hours,-2):n=="i"?s+=i.minutes:n=="I"?s+=Fs(i.minutes,-2):n=="s"?s+=i.seconds:n=="S"?s+=Fs(i.seconds,-2):n=="l"?s+=i.milli:n=="L"?s+=Fs(i.milli,-3):s+=n}return s}h(Ot,"formatIntlDate");m(Ot,"formatIntlDate");function yw(e,t){if(t===void 0&&(t=new Date),!e)return 0;let i=t.getFullYear()-e.getFullYear();return(t.getMonth()<e.getMonth()||t.getMonth()==e.getMonth()&&t.getDate()<e.getDate())&&i--,i}h(yw,"calcAge");m(yw,"calcAge");Date.prototype.isSameDay=function(e){return this.getDate()==e.getDate()&&this.getMonth()==e.getMonth()&&this.getFullYear()==e.getFullYear()};Date.prototype.hash=function(){return Jl(this)};Date.prototype.clone=function(){return ql(this)};Date.prototype.weekNum=function(){return rh(this)};Date.prototype.format=function(e){return Ot(this,e)};Date.prototype.addDays=function(e){return this.setDate(this.getDate()+e),this};function mp(e,t,i){let s=new Blob([e],{type:t}),r=window.URL.createObjectURL(s),n=V.createElement("a");n.style.display="none",n.href=r,n.download=i,V.body.appendChild(n),n.click(),window.URL.revokeObjectURL(r)}h(mp,"downloadData");m(mp,"downloadData");function We(e){return typeof e=="string"}h(We,"isString");m(We,"isString");function vi(e){return e instanceof Array}h(vi,"isArray");m(vi,"isArray");function rs(e){return e instanceof Function}h(rs,"isFunction");m(rs,"isFunction");function cp(e){return!!e&&e.constructor===Object}h(cp,"isLiteralObject");m(cp,"isLiteralObject");function Fs(e,t,i="0"){let s;return We(e)?s=e:s=""+e,t>0?s.padEnd(t,i):s.padStart(-t,i)}h(Fs,"pad");m(Fs,"pad");function nh(e){return typeof e=="number"&&isFinite(e)}h(nh,"isNumber");m(nh,"isNumber");function Ew(e){let t=V.createElement("div");return t.style.position="absolute",t.style.fontFamily=e,t.style.fontSize="44px",t.style.opacity="0.001",t.innerText="X",V.body.appendChild(t),new Promise(i=>{let s=t.getBoundingClientRect(),r=setInterval(()=>{t.getBoundingClientRect().height!=s.height&&(clearInterval(r),V.body.removeChild(t),i())},0)})}h(Ew,"waitFontLoading");m(Ew,"waitFontLoading");function up(e,t=0,...i){setTimeout(e,t,...i)}h(up,"deferCall");m(up,"deferCall");function Xr(e){requestAnimationFrame(e)}h(Xr,"asap");m(Xr,"asap");function kw(e){if(!e)return"";let t=e.split(`
|
|
4
|
+
`),i="para",s="p",r=[];return t.forEach(n=>{let l=n.trim();if(i=="para"){if(l[0]=="-")l=l.substr(1),r.push("<ul>"),i="list",s="li";else if(l[0]==">")l=l.substr(1),r.push("<blockquote>"),i="quote",s="p";else if(l[0]=="#"){let c=0;do l=l.substr(1),c++;while(l[0]=="#"&&c<5);s="h"+c,i="title"}}else i=="list"?l[0]!="-"?(r.push("</ul>"),i="para",s="p"):l=l.substr(1):i=="quote"&&(l[0]!=">"?(r.push("</blockquote>"),i="para",s="p"):l=l.substr(1));let o=/\*\*([^*]+)\*\*/gi;l=sh(l,!1),l=l.replace(o,(c,...u)=>"<b>"+c.substr(2,c.length-4)+"</b>");let a=/\*([^*]+)\*/gi;l=l.replace(a,(c,...u)=>"<i>"+c.substr(1,c.length-2)+"</i>"),l==""&&(l=" "),r.push(`<${s}>`+l+`</${s}>`),i=="title"&&(i="para",s="p")}),i=="list"?r.push("</ul>"):i=="quote"&&r.push("</blockquote>"),r.join("")}h(kw,"markdownToHtml");m(kw,"markdownToHtml");var dp=h(class extends Error{m_code;constructor(e,t){e instanceof Response?(super(e.statusText),this.m_code=e.status):(super(t),this.m_code=e)}get code(){return this.m_code}},"NetworkError");m(dp,"NetworkError");function Ws(e,t){let i="offsetX",s="offsetY";if(t&&(i="clientX",s="clientY"),e.type=="mousemove"||e.type=="mousedown"||e.type=="mouseup"){let r=e;return new Gi(r[i],r[s])}else if(e.type=="pointermove"||e.type=="pointerdown"||e.type=="pointerup"){let r=e;return new Gi(r[i],r[s])}else if(e.type=="touchmove"||e.type=="touchstart"){let r=e;return new Gi(r.touches[0][i],r.touches[0][s])}else if(e.type=="contextmenu"){let r=e;return new Gi(r[i],r[s])}else return new Gi(0,0)}h(Ws,"getMousePos");m(Ws,"getMousePos");function Bl(e,t,i){return Math.min(Math.max(e,t),i)}h(Bl,"clamp");m(Bl,"clamp");var Ni=h(class extends String{constructor(e){super(e)}static from(e){return new Ni(e)}},"HtmlString");m(Ni,"HtmlString");function xd(e,...t){return Ni.from(String.raw(e,...t))}h(xd,"html");m(xd,"html");function js(e){return e instanceof Ni}h(js,"isHtmlString");m(js,"isHtmlString");var Sw=h(class{static copy(e){navigator.clipboard&&navigator.clipboard.writeText(JSON.stringify(e))}static paste(e){navigator.clipboard?navigator.clipboard.readText().then(t=>e(t)):console.error("no clipboard, are you in https ?")}},"Clipboard");m(Sw,"Clipboard");function Dw(e){let t=-1,i=Buffer.from(e),s=0,r=i.length;for(;s<r;)t=t>>>8^Iw[(t^i[s])&255],s++;return(t^-1)>>>0}h(Dw,"crc32");m(Dw,"crc32");var Iw=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);var Aw=h(class{superclass;constructor(e){this.superclass=e}with(...e){return e.reduce((t,i)=>i(t),this.superclass)}},"MixinBuilder");m(Aw,"MixinBuilder");function ku(...e){let t="";for(let i of e)if(typeof i=="string")t+=" "+i;else if(i)for(let s in i)i[s]&&(t+=" "+s);return t}h(ku,"classNames");m(ku,"classNames");function Mw(e,t){(!e||e==null)&&(e=8),t||(t=[{chars:"abcdefghijklmnopqrstuvwxyz",min:3},{chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",min:2},{chars:"0123456789",min:2},{chars:"!@#$*|%+-_.;",min:2}]);let i="",s=0;t.forEach(function(n){i+=n.chars,s+=n.min}),e<s&&(e=s),t.push({chars:i,min:e-s});let r="";return t.forEach(function(n){n.min>0&&(r+=Su(n.chars,n.min))}),Su(r)}h(Mw,"generatePassword");m(Mw,"generatePassword");function Su(e,t){let i=e.split("").sort(()=>.5-Math.random()).join("");return t>0&&(i=i.substr(0,t)),i}h(Su,"shuffle");m(Su,"shuffle");function Pw(e="127.0.0.1",t="9876",i){let s;function r(){document.body.style.visibility="hidden";let a=[].slice.call(document.getElementsByTagName("link")),c=document.getElementsByTagName("head")[0];for(let u=0;u<a.length;++u){let _=a[u];c.removeChild(_);let p=_.rel;if(_.href&&typeof p!="string"||p.length==0||p.toLowerCase()=="stylesheet"){let v=_.href.replace(/(&|\?)_cacheOverride=\d+/,"");_.href=v+(v.indexOf("?")>=0?"&":"?")+"_cacheOverride="+new Date().valueOf()}c.appendChild(_)}s&&clearTimeout(s),s=setTimeout(()=>{document.body.style.visibility="unset"},50)}h(r,"refreshCSS"),m(r,"refreshCSS");let l=`${window.location.protocol==="https:"?"wss://":"ws://"}${e}:${t}/ws`,o=new WebSocket(l);o.onmessage=function(a){a.data=="reload"?i?i():window.location.reload():a.data=="refreshcss"&&r()},console.log("Live reload enabled.")}h(Pw,"installHMR");m(Pw,"installHMR");var ja=h(class{m_sheet;m_rules=new Map;constructor(){function e(t){for(let i=0;i<V.styleSheets.length;i++){let s=V.styleSheets[i];if(s.title===t)return s}}if(h(e,"getStyleSheet"),m(e,"getStyleSheet"),this.m_sheet=e("@dynamic-css"),!this.m_sheet){let t=V.createElement("style");t.setAttribute("id","@dynamic-css"),V.head.appendChild(t),this.m_sheet=t.sheet}}setRule(e,t){if(We(t)){let i=this.m_rules.get(e);i!==void 0?this.m_sheet.deleteRule(i):i=this.m_sheet.cssRules.length,this.m_rules.set(e,this.m_sheet.insertRule(t,i))}else{let i=1;for(let s in t){let r=s+" { ",n=t[s];for(let l in n){let o=n[l];for(let a=0;a<o.length;a++)r+=l+": "+o[a]+"; "}r+="}",this.setRule(e+"--"+i,r),i++}}}static getVar(e){return ja.doc_style||(ja.doc_style=getComputedStyle(V.documentElement)),e[0]!="-"&&(e="--"+e),ja.doc_style.getPropertyValue(e)}},"_Stylesheet"),Or=ja;m(Or,"Stylesheet");de(Or,"guid",1);de(Or,"doc_style");var _p=h(class{result={};parse(e){return this.result={},this.parse_json("",e),_p.mk_string(this.result)}static mk_string(e){let t="";for(let i in e){let s=e[i];t+=i+" { ";for(let r in s){let n=s[r];for(let l=0;l<n.length;l++)t+=r+": "+n[l]+"; "}t+=`}
|
|
5
|
+
`}return t}parse_json(e,t){e&&!this.result[e]&&(this.result[e]={});for(let i in t){let s=t[i];if(vi(s)){let r=s;for(let n=0;n<r.length;n++)this.addProperty(e,i,r[n])}else switch(typeof s){case"number":{this.addProperty(e,i,s);break}case"string":{this.addProperty(e,i,s);break}case"object":{this.parse_json(this.makeSelectorName(e,i),s);break}default:{console.error("ignoring unknown type "+typeof s+" in property "+i);break}}}}makePropertyName(e){return Zl(e)}makeSelectorName(e,t){let i=[],s=t.split(/\s*,\s*/),r=e.split(/\s*,\s*/);for(let n=0;n<r.length;n++){let l=r[n];for(let o=0;o<s.length;o++){let a=s[o],c=!1;a.charAt(0)=="&"&&(a=a.substr(1),c=!0),a.charAt(0)==="%"&&(a=".o-"+a.substr(1)),c?i.push(l+a):i.push(l?l+" "+a:a)}}return i.join(", ")}addProperty(e,t,i){let s=t.split(/\s*,\s*/);for(let r=0;r<s.length;r++){let n=this.makePropertyName(s[r]);this.result[e][n]?this.result[e][n].push(i):this.result[e][n]=[i];let o={"box-shadow":["-moz-box-shadow","-webkit-box-shadow"],"border-radius":["-moz-border-radius","-webkit-border-radius"],"border-radius-topleft":["-moz-border-radius-topleft","-webkit-border-top-left-radius"],"border-radius-topright":["-moz-border-radius-topright","-webkit-border-top-right-radius"],"border-radius-bottomleft":["-moz-border-radius-bottomleft","-webkit-border-bottom-left-radius"],"border-radius-bottomright":["-moz-border-radius-bottomright","-webkit-border-bottom-right-radius"]}[n];for(let a=0;o&&a<o.length;a++)this.addProperty(e,o[a],i)}}},"CSSParser");m(_p,"CSSParser");var Du=h(class{m_style;constructor(e){this.m_style=e}value(e){return e=Zl(e),this.m_style[e]}parse(e){return e=Zl(e),parseInt(this.m_style[e])}get style(){return this.m_style}},"ComputedStyle");m(Du,"ComputedStyle");var Tw="x-",Er=Symbol(),Fi=Symbol(),fp={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridColumn:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},zf={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,create:2,sizechange:2},Fw={touchstart:1,touchmove:1,touchend:1},zw=/^-?\d+(\.\d+)?$/;function vo(e=null){return ze({context:e})}h(vo,"EvDblClick");m(vo,"EvDblClick");function Iu(e=!0,t=null){return ze({focus:e,context:t})}h(Iu,"EvFocus");m(Iu,"EvFocus");var G=h(class extends Yn{m_dom;m_iprops;constructor(e=null){super(e??{}),this.m_iprops={classes:{},dom_events:{},uid:G.__comp_guid++,inrender:!1},this.m_props.cls&&this.addClass(this.m_props.cls)}get uid(){return this.m_iprops.uid}setContent(e,t=!1){this.m_props.content=e??[],!(this.m_iprops.inrender||!this.m_dom)&&(t?this.update():this._updateContent())}getContent(){return this.m_props.content}appendChild(e){if(!e)return;let t=m(i=>{this.m_props.content?vi(this.m_props.content)||(this.m_props.content=[this.m_props.content]):this.m_props.content=[],this.m_props.content.push(i),this.m_dom&&this._appendChild(i)},"append");vi(e)?e.forEach(t):t(e)}setTag(e,t){this.m_props.tag=e,t&&(this.m_props.ns=t)}getData(e){if(this.m_props.data!==void 0)return this.m_props.data[e.toString()]}setData(e,t){let i=this.m_props.data;i===void 0&&(i=this.m_props.data={}),i[e.toString()]=t}get dom(){return this.m_dom}show(e){e===void 0||e===!0?this.removeClass("@hidden"):this.addClass("@hidden")}hide(){this.addClass("@hidden")}enable(e){e===void 0||e===!0?(this.removeClass("@disable"),this.removeAttribute("disabled")):this.disable()}disable(){this.addClass("@disable"),this.setAttribute("disabled","")}focus(){console.assert(!!this.m_dom),this.m_dom.focus()}setStyle(e){for(let t in e)this.setStyleValue(t,e[t])}setStyleValue(e,t){let i=this.m_props.style;i||(i=this.m_props.style={}),i[e]=t,this._setDomStyleValue(e,t)}_setDomStyleValue(e,t){this.m_dom&&(t===void 0?t=null:!fp[e]&&(nh(t)||zw.test(t))&&(t=t+"px"),this.m_dom.style[e]=t)}getComputedStyle(e){return this.dom?new Du(getComputedStyle(this.dom,e??null)):new Du(this.m_props.style)}getStyleValue(e){return this.getComputedStyle()[e]}setAttributes(e){for(let t in e)this.setAttribute(t,e[t])}setAttribute(e,t){if(t===!1||t===void 0)this.removeAttribute(e);else{t===!0?t="":nh(t)&&(t=""+t);let i=this.m_props.attrs;i||(i=this.m_props.attrs={}),i[e]=t,this._setDomAttribute(e,t)}}_setDomAttribute(e,t){this.m_dom&&this.m_dom.setAttribute(e,t)}removeAttribute(e){let t=this.m_props.attrs;t&&(delete t[e],this.m_dom&&this.m_dom.removeAttribute(e))}getAttribute(e){return this.m_dom?this.m_dom.getAttribute(e):this.m_props.attrs?this.m_props.attrs[e]:void 0}hasAttribute(e){return this.m_dom?this.m_dom.hasAttribute(e):this.m_props.attrs.hasOwnProperty(e)}addClass(e){if(e==null||(e=e.trim(),e===""))return;let t=m(s=>{s==null||s===""||(s=this._makeCls(s),i[s]=!0,this.m_dom&&this.m_dom.classList.add(s))},"add"),i=this.m_iprops.classes;e.indexOf(" ")<0?t(e):e.split(" ").forEach(r=>t(r))}removeClass(e){if(e===void 0)return;let t=m(i=>{i==null||i===""||(i=this._makeCls(i),delete this.m_iprops.classes[i],this.m_dom&&this.m_dom.classList.remove(i))},"remove");if(e.indexOf(" ")<0)t(e);else{let i=e.trim().split(" ");for(let s of i)s!=null&&s!==""&&t(s)}}setClass(e,t){return t?this.addClass(e):this.removeClass(e),this}toggleClass(e){let t=m(i=>{i===void 0&&i===null&&i===""||(i=this._makeCls(i),this.m_iprops.classes[i]?delete this.m_iprops.classes[i]:this.m_iprops.classes[i]=!0,this.m_dom&&this.m_dom.classList.toggle(i))},"toggle");if(e.indexOf(" ")<0)t(e);else{let i=e.trim().split(" ");for(let s of i)t(s)}}hasClass(e){let t=this._makeCls(e);return this.m_dom?this.dom.classList.contains(t):!!this.m_iprops.classes[t]}clearClasses(){if(this.m_iprops.classes={},this.m_dom)return this.m_dom.classList.value=""}_build(){return this.m_dom?this.m_dom:(this._createDOM(),this.m_dom)}render(e){}_createDOM(){if(this.m_dom)return this.m_dom;let e=this.m_props;if(e.tabIndex!==void 0&&this._setTabIndex(e.tabIndex),this.render(e),e.left!==void 0&&this.setStyleValue("left",e.left),e.top!==void 0&&this.setStyleValue("top",e.top),e.width!==void 0&&this.setStyleValue("width",e.width),e.height!==void 0&&this.setStyleValue("height",e.height),e.flex!==void 0&&(this.addClass("@flex"),e.flex!=1&&this.setStyleValue("flex",e.flex)),e.enabled===!1&&this.disable(),e.tooltip!==void 0&&this.setAttribute("tip",e.tooltip.replace(/\n/gi,"<br/>")),e.dom_events)for(let l in e.dom_events)this._setDomEvent(l,e.dom_events[l]);this._genClassName(),this.m_props.cls=void 0;let t=this.m_iprops;e.ns?this.m_dom=V.createElementNS(e.ns,e.tag??"div"):this.m_dom=V.createElement(e.tag??"div"),this.m_dom[Fi]=this,this.m_dom.classList.add(...Object.keys(t.classes));let i=e.style;if(i)for(let l in i)this._setDomStyleValue(l,i[l]);let s=e.attrs;if(s)for(let l in s){let o=s[l];o!==!1&&o!==void 0&&this._setDomAttribute(l,s[l])}this.m_props.id&&this._setDomAttribute("id",this.m_props.id);let r=this.m_iprops.dom_events;if(r)for(let l in r){let o=r[l];for(let a of o)this.createEvent(l,a)}let n=e.content;return n&&(vi(n)||(n=[n]),n.forEach(l=>{l&&(We(l)?this.m_dom.insertAdjacentText("beforeend",l):js(l)?this.m_dom.insertAdjacentHTML("beforeend",l):l instanceof G?this.m_dom.append(l._build()):console.log("unknown element type: ",l))})),G.__createObserver||(G.__createObserver=new MutationObserver(G._observeCreation),G.__createObserver.observe(V.body,{childList:!0,subtree:!0})),this.m_dom}_setTabIndex(e,t=0){e===!0?e=0:e===void 0&&(e=t),e!==!1&&e!==void 0&&this.setAttribute("tabindex",e),this.m_props.tabIndex=e}static _observeCreation(e){let t=m(i=>{i.m_iprops.created||(i.dom&&i.m_iprops.dom_events&&i.m_iprops.dom_events.create&&i.dom.dispatchEvent(new Event("create")),i.componentCreated(),i.m_iprops.created=!0)},"notify");for(let i of e)if(i.type=="childList")for(let s=0,r=i.addedNodes.length;s<r;s++){let l=i.addedNodes[s][Fi];l&&(l.enumChilds(o=>{t(o)},!0),t(l))}}dispose(){this.m_dom&&this._dispose(!0,!0)}_dispose(e,t){let i=this.m_dom;delete i[Fi],delete i[Er],e&&i.remove(),this.enumChilds(s=>{s._dispose(!1,!0)}),this.m_dom=null,t&&this.disposeTimers(),this.componentDisposed(),this.m_iprops.created=!1}componentDisposed(){}componentCreated(){}update(e=0){if(this.m_dom){let t=m(()=>{let i=this.m_dom;this._dispose(!1,!1);let s=this._build();console.assert(!!i.parentNode,"update in componentCreated is not allowed, use updateContent"),i.parentNode.replaceChild(s,i)},"_update");e?this.singleShot(t,e):t()}}_empty(){let e=this.m_dom;if(e)for(;e.firstChild;)e.removeChild(e.firstChild)}_updateContent(){if(!this.m_dom)return;this._empty();let e=this.m_props.content;e&&(vi(e)||(e=[e]),e.forEach(t=>{t&&(js(t)?this.m_dom.insertAdjacentHTML("beforeend",t):t instanceof G?this.m_dom.append(t._build()):this.m_dom.insertAdjacentText("beforeend",t+""))}))}getBoundingRect(e=!1){console.assert(this.dom!=null,"cannot get bounding rect of an non DOM element");let t=this.dom.getBoundingClientRect(),i=new Hi(t.left,t.top,t.width,t.height);if(e){let s=this.getComputedStyle(),r=s.parse("marginTop"),n=s.parse("marginBottom"),l=s.parse("marginLeft"),o=s.parse("marginRight");i.left-=l,i.width+=l+o,i.top-=r,i.height+=r+n}return i}setDomEvent(e,t){let i=t;this._setDomEvent(e,i)}_setDomEvent(e,t){this.m_iprops.dom_events||(this.m_iprops.dom_events={});let i=this.m_iprops.dom_events[e];i?i.push(t):i=this.m_iprops.dom_events[e]=[t],this.m_dom&&this.createEvent(e,t)}clearDomEvent(e){if(!this.m_iprops.dom_events)return;delete this.m_iprops.dom_events[e];let t=this.m_dom;if(t){let i=t[Er];i&&delete i[e]}}createEvent(e,t){let i=this.m_dom,s=i[Er];s||(s=i[Er]={}),s[e]?s[e].push(t):s[e]=[t],zf[e]===1?i["on"+e]=G._dispatchUnbubbleEvent:G.__privateEvents[e]||(G.__privateEvents[e]=!0,Fw[e]?V.addEventListener(e,G._dispatchEvent,{passive:!1,capture:!0}):V.addEventListener(e,G._dispatchEvent,!0)),e==="sizechange"&&(G.__sizeObserver||(G.__sizeObserver=new ResizeObserver(G._observeSize)),G.__sizeObserver.observe(this.m_dom))}static _dispatchEvent(e){let t=e.target,i=zf[e.type]===2;for(;t;){if(t[Er]){let s=t[Er][e.type];if(s){let r=t[Fi],n=r?.root??null;if(s instanceof Array?s.some(l=>{if(l(e,n),!r.dom)return!0}):s(e,n),e.cancelBubble||e.defaultPrevented||i)break}}if(t=t.parentNode,t==document)break}}static _dispatchUnbubbleEvent(e){let t=e.currentTarget||e.target,i=e.type,s=t[Er],r=s&&s[i];if(r){let l=t[Fi]?.root??null;r instanceof Array?r.forEach(o=>{o(e,l)}):r(e,l)}}static _observeSize(e){e.forEach(t=>{let i=t.target;i.offsetParent!==null&&i.dispatchEvent(new Event("sizechange"))})}enumChilds(e,t=!1){if(this.m_dom){let i=this.m_dom.firstChild;for(;i;){let s=i[Fi];if(s&&(e(s),t&&s.enumChilds(e,!0)===!0))return!0;i=i.nextSibling}}else{let i=this.m_props.content;if(!i)return;vi(i)||(i=[i]),i.some(s=>{if(!(!s||We(s)||js(s))&&(e(s)||t&&s.enumChilds(e,!0)===!0))return!0})}return!1}_appendChild(e){if(We(e))this.m_dom.insertAdjacentText("beforeend",e);else if(js(e))this.m_dom.insertAdjacentHTML("beforeend",e);else{let t=e;try{t._build(),this.m_dom.appendChild(t.m_dom)}catch(i){console.error(i)}}}_genClassName(){this.addClass("@comp");let e=Object.getPrototypeOf(this);for(;e&&e.constructor!==G;){let t=e.constructor.name;this.addClass("@"+Zl(t)),e=Object.getPrototypeOf(e)}}_makeCls(e){return e[0]=="@"?e=Tw+e.substring(1):e}static dispatchCaptures(e){G.__capture.handler(e)}static setCapture(e,t){if(console.assert(!G.__capture),G.__capture)debugger;let i=V.querySelectorAll("iframe");i.forEach(l=>{wi(l).setStyleValue("pointer-events","none")});let s=V.querySelectorAll(":hover"),r=null;if(s.length){let l=s[s.length-1];r=window.getComputedStyle(l).cursor}G.__capture_mask=V.createElement("div");let n=wi(G.__capture_mask);n.addClass("@capture-mask"),r&&n.setStyleValue("cursor",r),V.body.appendChild(n.dom),V.addEventListener("mousedown",G.dispatchCaptures),V.addEventListener("mousemove",G.dispatchCaptures),V.addEventListener("mouseup",G.dispatchCaptures),V.addEventListener("touchstart",G.dispatchCaptures),V.addEventListener("touchmove",G.dispatchCaptures),V.addEventListener("touchend",G.dispatchCaptures),G.__capture={initiator:e,handler:t,iframes:i}}static releaseCapture(){console.assert(!!G.__capture),V.removeEventListener("touchstart",G.dispatchCaptures),V.removeEventListener("touchmove",G.dispatchCaptures),V.removeEventListener("touchend",G.dispatchCaptures),V.removeEventListener("mousedown",G.dispatchCaptures),V.removeEventListener("mousemove",G.dispatchCaptures),V.removeEventListener("mouseup",G.dispatchCaptures),G.__capture.iframes.forEach(e=>{wi(e).setStyleValue("pointer-events",null)}),G.__capture=null,G.__capture_mask&&(V.body.removeChild(G.__capture_mask),G.__capture_mask=null)}scrollIntoView(e){if(this.m_dom){let t=new Hi(this.dom.getBoundingClientRect()),i,s,r,n,l=this.dom.parentElement,o=V.body;for(;l&&l!=o;){let a=l.getBoundingClientRect();(i===void 0||i<a.top)&&(i=a.top),(s===void 0||s>a.bottom)&&(s=a.bottom),(r===void 0||r<a.left)&&(r=a.left),(n===void 0||n>a.right)&&(n=a.right),l=l.parentElement}(i===void 0||t.top<i||t.bottom>s||t.left<r||t.right>n)&&this.m_dom.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"})}}queryItem(e){let t=this.dom.querySelector(e);return t?G.getElement(t):null}queryAll(e,t){let i=Array.from(this.m_dom.querySelectorAll(e));return t&&i.forEach(s=>{t(wi(s))}),i}itemWithId(e){let t=this.dom.querySelector("#"+e);return t?G.getElement(t):null}itemWithRef(e){let t=null;return this.enumChilds(i=>{if(i.m_props.ref===e)return t=i,!0},!0),t}get ref(){return this.m_props.ref}static getCss(){return G.__css||(G.__css=new Or),G.__css}getParent(){console.assert(!!this.m_dom);let e=this.dom.parentNode;return G.getElement(e)}static getElement(e,t){if(t){let i=We(t);for(;e;){let s=e[Fi];if(i){if(s&&s.hasClass(t))return s}else if(s instanceof t)return s;e=e.parentElement}return null}else return e?e[Fi]:null}static getScrollbarSize(){if(G.__sb_width===void 0){let e=V.createElement("div");e.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px";let t=V.createElement("div");t.style.width="200px",t.style.height="200px",e.appendChild(t),V.body.appendChild(e),G.__sb_width=e.offsetWidth-e.clientWidth,V.body.removeChild(e)}return G.__sb_width}isUserVisible(){return this.m_dom?this.m_dom.offsetParent!==null:!1}},"_Component"),M=G;m(M,"Component");de(M,"__sb_width");de(M,"__comp_guid",1e3);de(M,"__privateEvents",{});de(M,"__sizeObserver");de(M,"__createObserver");de(M,"__capture",null);de(M,"__capture_mask",null);de(M,"__css",null);var Rf=null;function wi(e){if(e[Fi])return e[Fi];let t=Rf;return t||(t=Rf=new M({})),t.m_dom=e,t}h(wi,"flyWrap");m(wi,"flyWrap");var lh=h(class extends M{constructor(e={}){e.flex||(e.flex=1),super(e)}},"Flex");m(lh,"Flex");var Rw=h(class extends M{m_size;constructor(e){super({}),this.m_size=e}componentCreated(){let e=this.dom,t=null;for(;e;){let i=e[Fi];if(i.hasClass("@hlayout")){t={width:this.m_size};break}else if(i.hasClass("@vlayout")){t={height:this.m_size};break}e=e.parentElement}t||(t={width:this.m_size,height:this.m_size}),this.setStyle(t)}},"Space");m(Rw,"Space");function Ht(e,t=null,i=null){return ze({size:e,mode:t,context:i})}h(Ht,"EvSize");m(Ht,"EvSize");var pp=h(class extends M{m_irect;m_delta;m_target;constructor(e){super(e),this.setDomEvent("mousedown",t=>this._mousedown(t)),this.setDomEvent("touchstart",t=>this._mousedown(t)),this.setDomEvent("dblclick",t=>this._collapse(t))}render(){this.addClass(this.m_props.orientation)}_collapse(e){this.m_props.collapsible&&(this._findTarget(),this.m_target&&this.m_target.toggleClass("@collapsed"))}_mousedown(e){if(e.type=="touchstart"){let t=e;t.touches.length==1&&this._startMoving(t.touches[0].pageX,t.touches[0].pageY,e)}else{let t=e;this._startMoving(t.pageX,t.pageY,e)}}_startMoving(e,t,i){this._findTarget(),this.m_target&&(this.m_props.orientation=="horizontal"?this.m_props.sizing=="before"?this.m_delta=e-this.m_irect.right:this.m_delta=e-this.m_irect.left:this.m_props.sizing=="before"?this.m_delta=t-this.m_irect.bottom:this.m_delta=t-this.m_irect.top,i.preventDefault(),i.stopPropagation(),this.m_target.addClass("sizing"),M.setCapture(this,s=>this._pointerMoved(s)))}_pointerMoved(e){let t=m((i,s)=>{if(this.m_props.orientation=="horizontal"){let r;if(this.m_props.sizing=="after"?r=this.m_irect.right-(i-this.m_delta):r=i-this.m_delta-this.m_irect.left,r>0){let n=new Dn(r,0);this.emit("resize",Ht(n)),this.m_target.setStyleValue("width",n.width),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}else{let r;if(this.m_props.sizing=="after"?r=this.m_irect.bottom-(s-this.m_delta):r=s-this.m_delta-this.m_irect.top,r>0){let n=new Dn(0,r);this.emit("resize",Ht(n)),this.m_target.setStyleValue("height",n.height),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}},"__move");if(e.type=="mousemove"){let i=e;t(i.pageX,i.pageY),e.preventDefault(),e.stopPropagation()}else if(e.type=="touchmove"){let i=e;t(i.touches[0].pageX,i.touches[0].pageY),e.preventDefault(),e.stopPropagation()}else(e.type=="mouseup"||e.type=="touchend")&&(this.m_target.removeClass("sizing"),M.releaseCapture(),e.preventDefault(),e.stopPropagation())}_findTarget(){if(!this.m_target)if(this.m_props.sizing=="before"){let e=this.dom.previousElementSibling,t=e?M.getElement(e):null;this.m_target=t}else{let e=this.dom.nextElementSibling,t=e?M.getElement(e):null;this.m_target=t}this.m_target?this.m_irect=this.m_target.getBoundingRect():this.m_irect=null}},"Separator");m(pp,"Separator");function gp(e,t,i=null){return ze({ui_event:e,sens:t,context:i})}h(gp,"EvOverlayResize");m(gp,"EvOverlayResize");var Fh=h(class extends M{m_delta;m_irect;constructor(e){super(e),this.addClass(e.sens),this.setDomEvent("mousedown",t=>this._mousedown(t)),this.setDomEvent("touchstart",t=>this._mousedown(t)),this.setDomEvent("dblclick",t=>this.resetflex(t)),e.target.appendChild(this),e.resize&&this.on("resize",this.m_props.resize)}resetflex(e){this.m_props.target.addClass("@flex"),this.emit("resize",Ht({width:-1,height:0})),e.preventDefault(),e.stopPropagation()}_mousedown(e){e.preventDefault(),e.stopPropagation();let t=gp(e,this.m_props.sens);if(this.emit("rawresize",t),t.defaultPrevented)return;let i=Ws(e,!0);this.m_irect=this.m_props.target.getBoundingRect(),this.m_props.sens=="right"?this.m_delta=i.x-this.m_irect.right:this.m_props.sens=="left"?this.m_delta=i.x-this.m_irect.left:this.m_props.sens=="bottom"?this.m_delta=i.y-this.m_irect.bottom:this.m_props.sens=="top"&&(this.m_delta=i.y-this.m_irect.top),this.m_props.target.addClass("sizing"),M.setCapture(this,s=>this._handle_mouse(s))}_is_horz(){return this.m_props.sens=="left"||this.m_props.sens=="right"}get sens(){return this.m_props.sens}_handle_mouse(e){let t=m((i,s)=>{if(this._is_horz()){let r;if(this.m_props.sens=="left"?r=this.m_irect.right-(i-this.m_delta):r=i-this.m_delta-this.m_irect.left,r>0){let n={width:r,height:void 0};this.emit("resize",Ht(n)),this.m_props.target.setStyleValue("width",n.width),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}else{let r;if(this.m_props.sens=="top"?r=this.m_irect.bottom-(s-this.m_delta):r=s-this.m_delta-this.m_irect.top,r>0){let n=new Dn(0,r);this.emit("resize",Ht(n)),this.m_props.target.setStyleValue("height",n.height),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}},"__move");if(e.type=="mousemove"){let i=e;t(i.pageX,i.pageY),e.preventDefault(),e.stopPropagation()}else if(e.type=="touchmove"){let i=e;t(i.touches[0].pageX,i.touches[0].pageY),e.preventDefault(),e.stopPropagation()}else(e.type=="mouseup"||e.type=="touchend")&&(this.m_props.target.removeClass("sizing"),M.releaseCapture(),e.preventDefault(),e.stopPropagation())}},"SizerOverlay");m(Fh,"SizerOverlay");function vp(e){return ze({name:e})}h(vp,"EvShortcut");m(vp,"EvShortcut");var Ft=h(class extends M{m_shortcuts;constructor(e){vi(e)?super({content:e}):super(e)}addShortcut(e,t,i=null,s=!1){this.m_shortcuts||(this.m_shortcuts=[],this.setDomEvent("keydown",r=>this._handleKeydown(r))),vi(e)||(e=[e]),e.forEach(r=>{let n="";r.match(/SHIFT/i)&&(r=r.replace(/SHIFT/i,""),n+="shift+"),r.match(/CTRL/i)&&(r=r.replace(/CTRL/i,""),n+="ctrl+"),r.match(/CMD/i)&&(r=r.replace(/CMD/i,""),n+="cmd+"),r.match(/ALT/i)&&(r=r.replace(/ALT/i,""),n+="alt+"),n+=r.replace("+","").toLowerCase(),this.m_shortcuts.push({sequence:n,name:t,immediate:s,callback:i})})}removeShortcuts(){this.m_shortcuts&&(this.m_shortcuts=[])}_handleKeydown(e){if(!this.m_shortcuts)return;let t="";e.shiftKey&&(t+="shift+"),e.ctrlKey&&(t+="ctrl+"),e.metaKey&&(t+="cmd+"),e.altKey&&(t+="alt+"),t+=e.key.toLowerCase(),this.m_shortcuts.some(i=>{if(i.sequence==t)return i.callback?i.immediate?i.callback(e):Xr(()=>{i.callback(e)}):this.emit("shortcut",vp(i.name)),e.preventDefault(),e.stopPropagation(),!0})}},"Container");m(Ft,"Container");var wp=h(class{m_data;m_name;constructor(e){this.m_data=null,this.m_name=e??"settings"}set(e,t){this._load(),this.m_data[e]=t,this._save()}get(e,t){return this._load(),this.m_data[e]??t}_save(){let e=JSON.stringify(this.m_data);localStorage.setItem(this.m_name,e)}_load(){if(this.m_data)return;this.m_data={};let e=localStorage.getItem(this.m_name);e!==null&&(e=JSON.parse(e),e?this.m_data=e:console.info("There was an error attempting to read your settings."))}},"Settings");m(wp,"Settings");var bp=Object.defineProperty,Lw=m((e,t,i)=>t in e?bp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,"__defNormalProp"),d=m((e,t)=>bp(e,"name",{value:t,configurable:!0}),"__name"),_e=m((e,t,i)=>(Lw(e,typeof t!="symbol"?t+"":t,i),i),"__publicField"),B=document,xp=d(function(){this.propagationStopped=!0},"stopPropagation"),Cp=d(function(){this.defaultPrevented=!0},"preventDefault");function Pe(e){return{stopPropagation:xp,preventDefault:Cp,...e}}h(Pe,"BasicEvent2");m(Pe,"BasicEvent");d(Pe,"BasicEvent");function Gs(e=null){return Pe({context:e})}h(Gs,"EvClick2");m(Gs,"EvClick");d(Gs,"EvClick");function qe(e,t=null){return Pe({value:e,context:t})}h(qe,"EvChange2");m(qe,"EvChange");d(qe,"EvChange");function Zi(e,t=null){return Pe({selection:e,context:t})}h(Zi,"EvSelectionChange2");m(Zi,"EvSelectionChange");d(Zi,"EvSelectionChange");function or(e,t=null){return Pe({uievent:e,context:t})}h(or,"EvContextMenu2");m(or,"EvContextMenu");d(or,"EvContextMenu");function Cd(e,t=0,i=null){return Pe({timer:e,time:t,context:i})}h(Cd,"EvTimer2");m(Cd,"EvTimer");d(Cd,"EvTimer");function yp(e,t,i){return Pe({msg:e,params:t,source:i})}h(yp,"EvMessage2");m(yp,"EvMessage");d(yp,"EvMessage");function yd(e,t,i){return Pe({element:e,data:t,context:i})}h(yd,"EvDrag2");m(yd,"EvDrag");d(yd,"EvDrag");function Ed(e,t){return Pe({code:e,message:t})}h(Ed,"EvError2");m(Ed,"EvError");d(Ed,"EvError");var wo=m(class{m_source;m_eventRegistry;m_defaultHandlers;constructor(e=null){this.m_source=e??this}emit(e,t){this._emit(e,t)}_emit(e,t){let i=this.m_eventRegistry?.get(e),s=this.m_defaultHandlers?.get(e);if(t||(t={}),t.source||(t.source=this.m_source),t.type||(t.type=e),i&&i.length)if(t.preventDefault||(t.preventDefault=Cp),t.stopPropagation||(t.stopPropagation=xp),i.length==1)i[0](t);else{let r=i.slice();for(let n=0,l=r.length;n<l&&(r[n](t),!t.propagationStopped);n++);}if(s&&s.length&&!t.defaultPrevented)return s[0](t)}signal(e,t,i=-1){this._signal(e,t,i)}_signal(e,t,i=-1){if(!this.m_eventRegistry)return;let s=this.m_eventRegistry.get(e);if(!(!s||!s.length))if(t||(t={}),t.type||(t.type=e),t.source||(t.source=this.m_source),t.preventDefault=t.stopPropagation=()=>{console.error("this event cannot be stopped not default prevented")},s.length==1&&i==-1)s[0](t);else{let r=s.slice(),n=d(()=>{for(let l=0,o=r.length;l<o;l++)r[l](t)},"call");i==-1?n():setTimeout(n,i)}}once(e,t){this._once(e,t)}_once(e,t){let i=d(s=>{this._off(e,i),t(s)},"newCallback");if(this._on(e,i),!t)return new Promise(function(s){t=s})}setDefaultHandler(e,t){let i=this.m_defaultHandlers;i||(i=this.m_defaultHandlers=new Map);let s=i.get(e);if(s){let r=s.indexOf(t);r!=-1&&s.splice(r,1),s.unshift(t)}else i.set(e,[t])}removeDefaultHandler(e,t){let i=this.m_defaultHandlers;if(!i)return;let s=i.get(e);if(s){let r=s.indexOf(t);r!=-1&&s.splice(r,1)}}listen(e){for(let t in e)this._on(t,e[t])}defaults(e){for(let t in e)this.setDefaultHandler(t,e[t])}on(e,t){return this._on(e,t)}_on(e,t,i=!1){this.m_eventRegistry||(this.m_eventRegistry=new Map);let s=this.m_eventRegistry.get(e);return s||(s=[],this.m_eventRegistry.set(e,s)),s.indexOf(t)==-1&&(i?s.unshift(t):s.push(t)),{dispose:()=>{this._off(e,t)}}}off(e,t){return this._off(e,t)}_off(e,t){if(!this.m_eventRegistry)return;let i=this.m_eventRegistry.get(e);if(!i)return;let s=i.indexOf(t);s!==-1&&i.splice(s,1)}removeAllListeners(e){e?(this.m_eventRegistry&&(this.m_eventRegistry[e]=void 0),this.m_defaultHandlers&&(this.m_defaultHandlers[e]=void 0)):this.m_eventRegistry=this.m_defaultHandlers=void 0}},"EventSource");d(wo,"EventSource");var Zn=m(class extends wo{m_props;#e;constructor(e){super(),this.m_props=e,e.events&&this.listen(e.events)}startTimer(e,t,i=!0,s=null){this.#e?this.stopTimer(e):this.#e=new Map;let r=(i?setInterval:setTimeout)(n=>{s?s(e,n):this.emit("timer",Cd(e,n))},t);this.#e.set(e,()=>{(i?clearInterval:clearTimeout)(r)})}stopTimer(e){let t=this.#e.get(e);t&&t()}disposeTimers(){this.#e?.forEach(e=>e()),this.#e=void 0}singleShot(e,t=0){setTimeout(e,t)}mapPropEvents(e,...t){t.forEach(i=>{let s=i;e[s]&&this._on(s,e[s])})}},"BaseComponent");d(Zn,"BaseComponent");var Ep=Symbol("i18n"),Jn={};function zh(e,t){Jn[e]={name:e,base:t,src_translations:{},translations:{}}}h(zh,"createLanguage2");m(zh,"createLanguage");d(zh,"createLanguage");function Rh(e){return Jn[e]!==void 0}h(Rh,"isLanguage2");m(Rh,"isLanguage");d(Rh,"isLanguage");function Lh(e,...t){if(!Rh(e))return;let i=Jn[e];t.forEach(s=>{Vh(i.src_translations,s,i.base)}),i.translations=Bh(i.src_translations,i.base,!0)}h(Lh,"addTranslation2");m(Lh,"addTranslation");d(Lh,"addTranslation");function Vh(e,t,i){for(let s in t)e[s]instanceof Object?Vh(e[s],t[s],i):(e[s]=t[s],e[s]=Bh(e[s],i,!1));return e}h(Vh,"_patch2");m(Vh,"_patch");d(Vh,"_patch");var oh;function kd(e){for(;e;){let t=Jn[e],i=t.translations,s;for(let r of oh){if(s=i[r],s===void 0)break;i=s}if(s!==void 0)return i;e=t.base}console.error("I18N error: unable to find","_tr."+oh.join("."))}h(kd,"_findBaseTrans2");m(kd,"_findBaseTrans");d(kd,"_findBaseTrans");function Bh(e,t,i){return new Proxy(e,{get:(s,r)=>{i?oh=[r]:oh.push(r);let n=s[r];return n===void 0&&t&&(n=kd(t),s[r]=n),n}})}h(Bh,"_mk_proxy2");m(Bh,"_mk_proxy");d(Bh,"_mk_proxy");var le={};function Sd(e){Rh(e)&&(le=Jn[e].translations,le[Ep]=e)}h(Sd,"selectLanguage2");m(Sd,"selectLanguage");d(Sd,"selectLanguage");function kp(){return le[Ep]}h(kp,"getCurrentLanguage2");m(kp,"getCurrentLanguage");d(kp,"getCurrentLanguage");function Sp(){return Object.keys(Jn)}h(Sp,"getAvailableLanguages2");m(Sp,"getAvailableLanguages");d(Sp,"getAvailableLanguages");var Vw={global:{ok:"OK",cancel:"Annuler",ignore:"Ignorer",yes:"Oui",no:"Non",open:"Ouvrir",new:"Nouveau",delete:"Supprimer",close:"Fermer",save:"Enregistrer",search:"Rechercher",search_tip:"Saisissez le texte \xE0 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\xE9rique 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\xE9v","mar","avr","mai","jun","jui","ao\xFB","sep","oct","nov","d\xE9c"],month_long:["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"],property:"Propri\xE9t\xE9",value:"Valeur",err_403:"Vous n'avez pas les droits suffisants pour effectuer cette action",copy:"Copier",cut:"Couper",paste:"Coller"}},Bw={global:{ok:"OK",cancel:"Cancel",ignore:"Ignore",yes:"Yes",no:"No",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"}};zh("fr",null);Lh("fr",Vw);zh("en","fr");Lh("en",Bw);Sd("fr");function Hh(){return"ontouchstart"in window}h(Hh,"isTouchDevice2");m(Hh,"isTouchDevice");d(Hh,"isTouchDevice");function Qn(e,t){let i=Math.pow(10,t),s=Math.round(e*i)/i;return Object.is(s,-0)&&(s=0),s}h(Qn,"roundTo2");m(Qn,"roundTo");d(Qn,"roundTo");function Dd(e){return e=e.replace(/\s*/g,""),e=e.replace(",","."),e.length==0?0:parseFloat(e)}h(Dd,"parseIntlFloat2");m(Dd,"parseIntlFloat");d(Dd,"parseIntlFloat");function In(e){let t=e;return t=t.replace(/([a-z])([A-Z])/g,"$1 $2"),t=t.toLowerCase(),t=t.replace(/[^- a-z0-9]+/g," "),t.indexOf(" ")<0?t:(t=t.trim(),t.replace(/ /g,"-"))}h(In,"pascalCase2");m(In,"pascalCase");d(In,"pascalCase");function Dp(e){let t=e.toLowerCase();return t=t.replace(/[^a-zA-Z0-9]+(.)/g,(i,s)=>s.toUpperCase()),t}h(Dp,"camelCase2");m(Dp,"camelCase");d(Dp,"camelCase");var Ui=m(class{x;y;constructor(e=0,t=0){this.x=e,this.y=t}},"Point");d(Ui,"Point");var An=m(class{width;height;constructor(e=0,t=0){this.width=e,this.height=t}},"Size");d(An,"Size");var Oi=m(class{left;top;width;height;constructor(e,t,i,s){if(e===void 0)this.left=this.top=this.right=this.bottom=0;else if(e instanceof Oi||e instanceof DOMRect){let r=e;this.left=r.left,this.top=r.top,this.width=r.width,this.height=r.height}else this.left=e,this.top=t,this.width=i,this.height=s}set(e,t,i,s){this.left=e,this.top=t,this.width=i,this.height=s}get bottom(){return this.top+this.height}set bottom(e){this.height=e-this.top}get right(){return this.left+this.width}set right(e){this.width=e-this.left}get topLeft(){return new Ui(this.left,this.top)}get bottomRight(){return new Ui(this.right,this.bottom)}get size(){return new An(this.width,this.height)}moveTo(e,t){return this.left=e,this.top=t,this}movedTo(e,t){return new Oi(e,t,this.width,this.height)}moveBy(e,t){return this.left+=e,this.top+=t,this}movedBy(e,t){return new Oi(this.left+e,this.top+t,this.width,this.height)}isEmpty(){return this.width==0&&this.height==0}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}normalized(){let e=new Oi(this),t=e.width,i=e.height;return t<0&&(e.left+=t,e.width=-t),i<0&&(e.top+=i,e.height=-i),e}containsPt(e,t){return e>=this.left&&e<=this.right&&t>=this.top&&t<=this.bottom}contains(e){return e instanceof Oi?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)}inflate(e,t){t===void 0&&(t=e),this.left-=e,this.top-=t,this.width+=e+e,this.height+=t+t}inflatedBy(e,t){return t===void 0&&(t=e),new Oi(this.left-e,this.top-t,this.width+e+e,this.height+t+t)}combine(e){let t=Math.min(this.left,e.left),i=Math.min(this.top,e.top),s=Math.max(this.right,e.right),r=Math.max(this.bottom,e.bottom);this.left=t,this.top=i,this.right=s,this.bottom=r}},"Rect");d(Oi,"Rect");function Cn(e,...t){return e.replace(/{(\d+)}/g,function(i,s){return typeof t[s]<"u"?t[s]:i})}h(Cn,"sprintf2");m(Cn,"sprintf");d(Cn,"sprintf");function Ql(e,t=!1){if(!e||e.length==0)return"";let i=e.replace(/[<>\&\"\']/g,function(s){return"&#"+s.charCodeAt(0)+";"});return t&&(i=i.replace(/(\r\n|\n\r|\r|\n)/g,"<br/>")),i}h(Ql,"escapeHtml2");m(Ql,"escapeHtml");d(Ql,"escapeHtml");function Ip(e,t=!1){if(e==null||!He(e)||e.length==0)return"";let i="";for(let s=0;s<e.length;s++){let r=e.codePointAt(s);r>127?i+="&#"+r+";":r==60?i+="<":i+=e.charAt(s)}return i}h(Ip,"removeHtmlTags2");m(Ip,"removeHtmlTags");d(Ip,"removeHtmlTags");var Hw="fr-FR";function Ap(e){Hw=e}h(Ap,"_date_set_locale2");m(Ap,"_date_set_locale");d(Ap,"_date_set_locale");function Mp(e,t){return Tt(e)}h(Mp,"date_format2");m(Mp,"date_format");d(Mp,"date_format");function Pp(e,t,i){var s=(e.getTime()-t.getTime())/1e3;let r=s;if(r<60)return Cn(le.global.diff_date_seconds,Math.round(r));let n=Math.floor(r/60);if(n<60)return Cn(le.global.diff_date_minutes,Math.round(n));let l=Math.floor(n/60);return Cn(le.global.diff_date_hours,l,n%60)}h(Pp,"date_diff2");m(Pp,"date_diff");d(Pp,"date_diff");function Tp(e,t){return t?Tt(e,"Y-M-D H:I:S"):Tt(e,"Y-M-D")}h(Tp,"date_to_sql2");m(Tp,"date_to_sql");d(Tp,"date_to_sql");function Fp(e){return new Date(e+" GMT")}h(Fp,"date_sql_utc2");m(Fp,"date_sql_utc");d(Fp,"date_sql_utc");function Mn(e){return e.getFullYear()<<16|e.getMonth()<<8|e.getDate()}h(Mn,"date_hash2");m(Mn,"date_hash");d(Mn,"date_hash");Date.prototype.hash=function(){return Mn(this)};function yn(e){return new Date(e.getTime())}h(yn,"date_clone2");m(yn,"date_clone");d(yn,"date_clone");function eo(e){let t=new Date(e.getFullYear(),0,1),i=(e.valueOf()-t.valueOf())/864e5;return Math.floor((i+t.getDay()+1)/7)}h(eo,"date_calc_weeknum2");m(eo,"date_calc_weeknum");d(eo,"date_calc_weeknum");function Kl(e,t=le.global.date_input_formats){let i=t.split("|");for(let s of i){let r="";for(let o of s)o=="d"||o=="D"?r+="(?<day>\\d{1,2})":o=="m"||o=="M"?r+="(?<month>\\d{1,2})":o=="y"||o=="Y"?r+="(?<year>\\d{1,4})":o=="h"||o=="H"?r+="(?<hour>\\d{1,2})":o=="i"||o=="I"?r+="(?<min>\\d{1,2})":o=="s"||o=="S"?r+="(?<sec>\\d{1,2})":o==" "?r+="\\s+":r+="\\s*\\"+o+"\\s*";let l=new RegExp("^"+r+"$","m").exec(e);if(l){let o=new Date,a=parseInt(l.groups.day??"1"),c=parseInt(l.groups.month??"1"),u=parseInt(l.groups.year??o.getFullYear()+""),_=parseInt(l.groups.hour??"0"),p=parseInt(l.groups.min??"0"),v=parseInt(l.groups.sec??"0");u>0&&u<100&&(u+=2e3);let g=new Date(u,c-1,a,_,p,v,0),x=g.getFullYear(),E=g.getMonth()+1,y=g.getDate();return x!=u||E!=c||y!=a?null:g}}return null}h(Kl,"parseIntlDate2");m(Kl,"parseIntlDate");d(Kl,"parseIntlDate");function Tt(e,t=le.global.date_format){if(!e)return"";let i={year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),wday:e.getDay(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milli:e.getMilliseconds()},s="",r=0;for(let n of t){if(n=="{"){if(++r==1)continue}else if(n=="}"&&--r==0)continue;if(r){s+=n;continue}n=="d"?s+=i.day:n=="D"?s+=os(i.day,-2):n=="j"?s+=le.global.day_short[i.wday]:n=="J"?s+=le.global.day_long[i.wday]:n=="w"?s+=eo(e):n=="W"?s+=os(eo(e),-2):n=="m"?s+=i.month:n=="M"?s+=os(i.month,-2):n=="o"?s+=le.global.month_short[i.month-1]:n=="O"?s+=le.global.month_long[i.month-1]:n=="y"||n=="Y"?s+=os(i.year,-4):n=="a"||n=="A"?s+=i.hours<12?"am":"pm":n=="h"?s+=i.hours:n=="H"?s+=os(i.hours,-2):n=="i"?s+=i.minutes:n=="I"?s+=os(i.minutes,-2):n=="s"?s+=i.seconds:n=="S"?s+=os(i.seconds,-2):n=="l"?s+=i.milli:n=="L"?s+=os(i.milli,-3):s+=n}return s}h(Tt,"formatIntlDate2");m(Tt,"formatIntlDate");d(Tt,"formatIntlDate");function zp(e,t){if(t===void 0&&(t=new Date),!e)return 0;let i=t.getFullYear()-e.getFullYear();return(t.getMonth()<e.getMonth()||t.getMonth()==e.getMonth()&&t.getDate()<e.getDate())&&i--,i}h(zp,"calcAge2");m(zp,"calcAge");d(zp,"calcAge");Date.prototype.isSameDay=function(e){return this.getDate()==e.getDate()&&this.getMonth()==e.getMonth()&&this.getFullYear()==e.getFullYear()};Date.prototype.hash=function(){return Mn(this)};Date.prototype.clone=function(){return yn(this)};Date.prototype.weekNum=function(){return eo(this)};Date.prototype.format=function(e){return Tt(this,e)};Date.prototype.addDays=function(e){return this.setDate(this.getDate()+e),this};function Id(e,t,i){let s=new Blob([e],{type:t}),r=window.URL.createObjectURL(s),n=B.createElement("a");n.style.display="none",n.href=r,n.download=i,B.body.appendChild(n),n.click(),window.URL.revokeObjectURL(r)}h(Id,"downloadData2");m(Id,"downloadData");d(Id,"downloadData");function He(e){return typeof e=="string"}h(He,"isString2");m(He,"isString");d(He,"isString");function mi(e){return e instanceof Array}h(mi,"isArray2");m(mi,"isArray");d(mi,"isArray");function Di(e){return e instanceof Function}h(Di,"isFunction2");m(Di,"isFunction");d(Di,"isFunction");function Ad(e){return!!e&&e.constructor===Object}h(Ad,"isLiteralObject2");m(Ad,"isLiteralObject");d(Ad,"isLiteralObject");function os(e,t,i="0"){let s;return He(e)?s=e:s=""+e,t>0?s.padEnd(t,i):s.padStart(-t,i)}h(os,"pad2");m(os,"pad");d(os,"pad");function to(e){return typeof e=="number"&&isFinite(e)}h(to,"isNumber2");m(to,"isNumber");d(to,"isNumber");function Rp(e){let t=B.createElement("div");return t.style.position="absolute",t.style.fontFamily=e,t.style.fontSize="44px",t.style.opacity="0.001",t.innerText="X",B.body.appendChild(t),new Promise(i=>{let s=t.getBoundingClientRect(),r=setInterval(()=>{t.getBoundingClientRect().height!=s.height&&(clearInterval(r),B.body.removeChild(t),i())},0)})}h(Rp,"waitFontLoading2");m(Rp,"waitFontLoading");d(Rp,"waitFontLoading");function Md(e,t=0,...i){setTimeout(e,t,...i)}h(Md,"deferCall2");m(Md,"deferCall");d(Md,"deferCall");function cr(e){requestAnimationFrame(e)}h(cr,"asap2");m(cr,"asap");d(cr,"asap");function Lp(e){if(!e)return"";let t=e.split(`
|
|
6
|
+
`),i="para",s="p",r=[];return t.forEach(n=>{let l=n.trim();if(i=="para"){if(l[0]=="-")l=l.substr(1),r.push("<ul>"),i="list",s="li";else if(l[0]==">")l=l.substr(1),r.push("<blockquote>"),i="quote",s="p";else if(l[0]=="#"){let c=0;do l=l.substr(1),c++;while(l[0]=="#"&&c<5);s="h"+c,i="title"}}else i=="list"?l[0]!="-"?(r.push("</ul>"),i="para",s="p"):l=l.substr(1):i=="quote"&&(l[0]!=">"?(r.push("</blockquote>"),i="para",s="p"):l=l.substr(1));let o=/\*\*([^*]+)\*\*/gi;l=Ql(l,!1),l=l.replace(o,(c,...u)=>"<b>"+c.substr(2,c.length-4)+"</b>");let a=/\*([^*]+)\*/gi;l=l.replace(a,(c,...u)=>"<i>"+c.substr(1,c.length-2)+"</i>"),l==""&&(l=" "),r.push(`<${s}>`+l+`</${s}>`),i=="title"&&(i="para",s="p")}),i=="list"?r.push("</ul>"):i=="quote"&&r.push("</blockquote>"),r.join("")}h(Lp,"markdownToHtml2");m(Lp,"markdownToHtml");d(Lp,"markdownToHtml");var Vp=m(class extends Error{m_code;constructor(e,t){e instanceof Response?(super(e.statusText),this.m_code=e.status):(super(t),this.m_code=e)}get code(){return this.m_code}},"NetworkError");d(Vp,"NetworkError");function ms(e,t){let i="offsetX",s="offsetY";if(t&&(i="clientX",s="clientY"),e.type=="mousemove"||e.type=="mousedown"||e.type=="mouseup"){let r=e;return new Ui(r[i],r[s])}else if(e.type=="pointermove"||e.type=="pointerdown"||e.type=="pointerup"){let r=e;return new Ui(r[i],r[s])}else if(e.type=="touchmove"||e.type=="touchstart"){let r=e;return new Ui(r.touches[0][i],r.touches[0][s])}else if(e.type=="contextmenu"){let r=e;return new Ui(r[i],r[s])}else return new Ui(0,0)}h(ms,"getMousePos2");m(ms,"getMousePos");d(ms,"getMousePos");function vn(e,t,i){return Math.min(Math.max(e,t),i)}h(vn,"clamp2");m(vn,"clamp");d(vn,"clamp");var $i=m(class extends String{constructor(e){super(e)}static from(e){return new $i(e)}},"HtmlString");d($i,"HtmlString");function Oh(e,...t){return $i.from(String.raw(e,...t))}h(Oh,"html2");m(Oh,"html");d(Oh,"html");function cs(e){return e instanceof $i}h(cs,"isHtmlString2");m(cs,"isHtmlString");d(cs,"isHtmlString");var Ow=m(class{static copy(e){navigator.clipboard&&navigator.clipboard.writeText(JSON.stringify(e))}static paste(e){navigator.clipboard?navigator.clipboard.readText().then(t=>e(t)):console.error("no clipboard, are you in https ?")}},"Clipboard");d(Ow,"Clipboard");function Bp(e){let t=-1,i=Buffer.from(e),s=0,r=i.length;for(;s<r;)t=t>>>8^Ww[(t^i[s])&255],s++;return(t^-1)>>>0}h(Bp,"crc322");m(Bp,"crc32");d(Bp,"crc32");var Ww=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]),jw=m(class{superclass;constructor(e){this.superclass=e}with(...e){return e.reduce((t,i)=>i(t),this.superclass)}},"MixinBuilder");d(jw,"MixinBuilder");function ah(...e){let t="";for(let i of e)if(typeof i=="string")t+=" "+i;else if(i)for(let s in i)i[s]&&(t+=" "+s);return t}h(ah,"classNames2");m(ah,"classNames");d(ah,"classNames");function Hp(e,t){(!e||e==null)&&(e=8),t||(t=[{chars:"abcdefghijklmnopqrstuvwxyz",min:3},{chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",min:2},{chars:"0123456789",min:2},{chars:"!@#$*|%+-_.;",min:2}]);let i="",s=0;t.forEach(function(n){i+=n.chars,s+=n.min}),e<s&&(e=s),t.push({chars:i,min:e-s});let r="";return t.forEach(function(n){n.min>0&&(r+=hh(n.chars,n.min))}),hh(r)}h(Hp,"generatePassword2");m(Hp,"generatePassword");d(Hp,"generatePassword");function hh(e,t){let i=e.split("").sort(()=>.5-Math.random()).join("");return t>0&&(i=i.substr(0,t)),i}h(hh,"shuffle2");m(hh,"shuffle");d(hh,"shuffle");function Op(e="127.0.0.1",t="9876",i){let s;function r(){document.body.style.visibility="hidden";let a=[].slice.call(document.getElementsByTagName("link")),c=document.getElementsByTagName("head")[0];for(let u=0;u<a.length;++u){let _=a[u];c.removeChild(_);let p=_.rel;if(_.href&&typeof p!="string"||p.length==0||p.toLowerCase()=="stylesheet"){let v=_.href.replace(/(&|\?)_cacheOverride=\d+/,"");_.href=v+(v.indexOf("?")>=0?"&":"?")+"_cacheOverride="+new Date().valueOf()}c.appendChild(_)}s&&clearTimeout(s),s=setTimeout(()=>{document.body.style.visibility="unset"},50)}h(r,"refreshCSS"),m(r,"refreshCSS"),d(r,"refreshCSS");let l=`${window.location.protocol==="https:"?"wss://":"ws://"}${e}:${t}/ws`,o=new WebSocket(l);o.onmessage=function(a){a.data=="reload"?i?i():window.location.reload():a.data=="refreshcss"&&r()},console.log("Live reload enabled.")}h(Op,"installHMR2");m(Op,"installHMR");d(Op,"installHMR");var Ga=m(class{m_sheet;m_rules=new Map;constructor(){function e(t){for(let i=0;i<B.styleSheets.length;i++){let s=B.styleSheets[i];if(s.title===t)return s}}if(h(e,"getStyleSheet"),m(e,"getStyleSheet"),d(e,"getStyleSheet"),this.m_sheet=e("@dynamic-css"),!this.m_sheet){let t=B.createElement("style");t.setAttribute("id","@dynamic-css"),B.head.appendChild(t),this.m_sheet=t.sheet}}setRule(e,t){if(He(t)){let i=this.m_rules.get(e);i!==void 0?this.m_sheet.deleteRule(i):i=this.m_sheet.cssRules.length,this.m_rules.set(e,this.m_sheet.insertRule(t,i))}else{let i=1;for(let s in t){let r=s+" { ",n=t[s];for(let l in n){let o=n[l];for(let a=0;a<o.length;a++)r+=l+": "+o[a]+"; "}r+="}",this.setRule(e+"--"+i,r),i++}}}static getVar(e){return Ga.doc_style||(Ga.doc_style=getComputedStyle(B.documentElement)),e[0]!="-"&&(e="--"+e),Ga.doc_style.getPropertyValue(e)}},"_Stylesheet"),Wr=Ga;d(Wr,"Stylesheet");_e(Wr,"guid",1);_e(Wr,"doc_style");var Wp=m(class{result={};parse(e){return this.result={},this.parse_json("",e),Wp.mk_string(this.result)}static mk_string(e){let t="";for(let i in e){let s=e[i];t+=i+" { ";for(let r in s){let n=s[r];for(let l=0;l<n.length;l++)t+=r+": "+n[l]+"; "}t+=`}
|
|
7
|
+
`}return t}parse_json(e,t){e&&!this.result[e]&&(this.result[e]={});for(let i in t){let s=t[i];if(mi(s)){let r=s;for(let n=0;n<r.length;n++)this.addProperty(e,i,r[n])}else switch(typeof s){case"number":{this.addProperty(e,i,s);break}case"string":{this.addProperty(e,i,s);break}case"object":{this.parse_json(this.makeSelectorName(e,i),s);break}default:{console.error("ignoring unknown type "+typeof s+" in property "+i);break}}}}makePropertyName(e){return In(e)}makeSelectorName(e,t){let i=[],s=t.split(/\s*,\s*/),r=e.split(/\s*,\s*/);for(let n=0;n<r.length;n++){let l=r[n];for(let o=0;o<s.length;o++){let a=s[o],c=!1;a.charAt(0)=="&"&&(a=a.substr(1),c=!0),a.charAt(0)==="%"&&(a=".o-"+a.substr(1)),c?i.push(l+a):i.push(l?l+" "+a:a)}}return i.join(", ")}addProperty(e,t,i){let s=t.split(/\s*,\s*/);for(let r=0;r<s.length;r++){let n=this.makePropertyName(s[r]);this.result[e][n]?this.result[e][n].push(i):this.result[e][n]=[i];let o={"box-shadow":["-moz-box-shadow","-webkit-box-shadow"],"border-radius":["-moz-border-radius","-webkit-border-radius"],"border-radius-topleft":["-moz-border-radius-topleft","-webkit-border-top-left-radius"],"border-radius-topright":["-moz-border-radius-topright","-webkit-border-top-right-radius"],"border-radius-bottomleft":["-moz-border-radius-bottomleft","-webkit-border-bottom-left-radius"],"border-radius-bottomright":["-moz-border-radius-bottomright","-webkit-border-bottom-right-radius"]}[n];for(let a=0;o&&a<o.length;a++)this.addProperty(e,o[a],i)}}},"CSSParser");d(Wp,"CSSParser");var Au=m(class{m_style;constructor(e){this.m_style=e}value(e){return e=In(e),this.m_style[e]}parse(e){return e=In(e),parseInt(this.m_style[e])}get style(){return this.m_style}},"ComputedStyle");d(Au,"ComputedStyle");var Gw="x-",kr=Symbol(),zi=Symbol(),jp={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridColumn:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Lf={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,create:2,sizechange:2},Nw={touchstart:1,touchmove:1,touchend:1},Uw=/^-?\d+(\.\d+)?$/;function el(e=null){return Pe({context:e})}h(el,"EvDblClick2");m(el,"EvDblClick");d(el,"EvDblClick");function mh(e=!0,t=null){return Pe({focus:e,context:t})}h(mh,"EvFocus2");m(mh,"EvFocus");d(mh,"EvFocus");var N=m(class extends Zn{m_dom;m_iprops;constructor(e=null){super(e??{}),this.m_iprops={classes:{},dom_events:{},uid:N.__comp_guid++,inrender:!1},this.m_props.cls&&this.addClass(this.m_props.cls)}get uid(){return this.m_iprops.uid}setContent(e,t=!1){this.m_props.content=e??[],!(this.m_iprops.inrender||!this.m_dom)&&(t?this.update():this._updateContent())}getContent(){return this.m_props.content}appendChild(e){if(!e)return;let t=d(i=>{this.m_props.content?mi(this.m_props.content)||(this.m_props.content=[this.m_props.content]):this.m_props.content=[],this.m_props.content.push(i),this.m_dom&&this._appendChild(i)},"append");mi(e)?e.forEach(t):t(e)}setTag(e,t){this.m_props.tag=e,t&&(this.m_props.ns=t)}getData(e){if(this.m_props.data!==void 0)return this.m_props.data[e.toString()]}setData(e,t){let i=this.m_props.data;i===void 0&&(i=this.m_props.data={}),i[e.toString()]=t}get dom(){return this.m_dom}show(e){e===void 0||e===!0?this.removeClass("@hidden"):this.addClass("@hidden")}hide(){this.addClass("@hidden")}enable(e){e===void 0||e===!0?(this.removeClass("@disable"),this.removeAttribute("disabled")):this.disable()}disable(){this.addClass("@disable"),this.setAttribute("disabled","")}focus(){console.assert(!!this.m_dom),this.m_dom.focus()}setStyle(e){for(let t in e)this.setStyleValue(t,e[t])}setStyleValue(e,t){let i=this.m_props.style;i||(i=this.m_props.style={}),i[e]=t,this._setDomStyleValue(e,t)}_setDomStyleValue(e,t){this.m_dom&&(t===void 0?t=null:!jp[e]&&(to(t)||Uw.test(t))&&(t=t+"px"),this.m_dom.style[e]=t)}getComputedStyle(e){return this.dom?new Au(getComputedStyle(this.dom,e??null)):new Au(this.m_props.style)}getStyleValue(e){return this.getComputedStyle()[e]}setAttributes(e){for(let t in e)this.setAttribute(t,e[t])}setAttribute(e,t){if(t===!1||t===void 0)this.removeAttribute(e);else{t===!0?t="":to(t)&&(t=""+t);let i=this.m_props.attrs;i||(i=this.m_props.attrs={}),i[e]=t,this._setDomAttribute(e,t)}}_setDomAttribute(e,t){this.m_dom&&this.m_dom.setAttribute(e,t)}removeAttribute(e){let t=this.m_props.attrs;t&&(delete t[e],this.m_dom&&this.m_dom.removeAttribute(e))}getAttribute(e){return this.m_dom?this.m_dom.getAttribute(e):this.m_props.attrs?this.m_props.attrs[e]:void 0}hasAttribute(e){return this.m_dom?this.m_dom.hasAttribute(e):this.m_props.attrs.hasOwnProperty(e)}addClass(e){if(e==null||(e=e.trim(),e===""))return;let t=d(s=>{s==null||s===""||(s=this._makeCls(s),i[s]=!0,this.m_dom&&this.m_dom.classList.add(s))},"add"),i=this.m_iprops.classes;e.indexOf(" ")<0?t(e):e.split(" ").forEach(r=>t(r))}removeClass(e){if(e===void 0)return;let t=d(i=>{i==null||i===""||(i=this._makeCls(i),delete this.m_iprops.classes[i],this.m_dom&&this.m_dom.classList.remove(i))},"remove");if(e.indexOf(" ")<0)t(e);else{let i=e.trim().split(" ");for(let s of i)s!=null&&s!==""&&t(s)}}setClass(e,t){return t?this.addClass(e):this.removeClass(e),this}toggleClass(e){let t=d(i=>{i===void 0&&i===null&&i===""||(i=this._makeCls(i),this.m_iprops.classes[i]?delete this.m_iprops.classes[i]:this.m_iprops.classes[i]=!0,this.m_dom&&this.m_dom.classList.toggle(i))},"toggle");if(e.indexOf(" ")<0)t(e);else{let i=e.trim().split(" ");for(let s of i)t(s)}}hasClass(e){let t=this._makeCls(e);return this.m_dom?this.dom.classList.contains(t):!!this.m_iprops.classes[t]}clearClasses(){if(this.m_iprops.classes={},this.m_dom)return this.m_dom.classList.value=""}_build(){return this.m_dom?this.m_dom:(this._createDOM(),this.m_dom)}render(e){}_createDOM(){if(this.m_dom)return this.m_dom;let e=this.m_props;if(e.tabIndex!==void 0&&this._setTabIndex(e.tabIndex),this.render(e),e.left!==void 0&&this.setStyleValue("left",e.left),e.top!==void 0&&this.setStyleValue("top",e.top),e.width!==void 0&&this.setStyleValue("width",e.width),e.height!==void 0&&this.setStyleValue("height",e.height),e.flex!==void 0&&(this.addClass("@flex"),e.flex!=1&&this.setStyleValue("flex",e.flex)),e.enabled===!1&&this.disable(),e.tooltip!==void 0&&this.setAttribute("tip",e.tooltip.replace(/\n/gi,"<br/>")),e.dom_events)for(let l in e.dom_events)this._setDomEvent(l,e.dom_events[l]);this._genClassName(),this.m_props.cls=void 0;let t=this.m_iprops;e.ns?this.m_dom=B.createElementNS(e.ns,e.tag??"div"):this.m_dom=B.createElement(e.tag??"div"),this.m_dom[zi]=this,this.m_dom.classList.add(...Object.keys(t.classes));let i=e.style;if(i)for(let l in i)this._setDomStyleValue(l,i[l]);let s=e.attrs;if(s)for(let l in s){let o=s[l];o!==!1&&o!==void 0&&this._setDomAttribute(l,s[l])}this.m_props.id&&this._setDomAttribute("id",this.m_props.id);let r=this.m_iprops.dom_events;if(r)for(let l in r){let o=r[l];for(let a of o)this.createEvent(l,a)}let n=e.content;return n&&(mi(n)||(n=[n]),n.forEach(l=>{l&&(He(l)?this.m_dom.insertAdjacentText("beforeend",l):cs(l)?this.m_dom.insertAdjacentHTML("beforeend",l):l instanceof N?this.m_dom.append(l._build()):console.log("unknown element type: ",l))})),N.__createObserver||(N.__createObserver=new MutationObserver(N._observeCreation),N.__createObserver.observe(B.body,{childList:!0,subtree:!0})),this.m_dom}_setTabIndex(e,t=0){e===!0?e=0:e===void 0&&(e=t),e!==!1&&e!==void 0&&this.setAttribute("tabindex",e),this.m_props.tabIndex=e}static _observeCreation(e){let t=d(i=>{i.m_iprops.created||(i.dom&&i.m_iprops.dom_events&&i.m_iprops.dom_events.create&&i.dom.dispatchEvent(new Event("create")),i.componentCreated(),i.m_iprops.created=!0)},"notify");for(let i of e)if(i.type=="childList")for(let s=0,r=i.addedNodes.length;s<r;s++){let l=i.addedNodes[s][zi];l&&(l.enumChilds(o=>{t(o)},!0),t(l))}}dispose(){this.m_dom&&this._dispose(!0,!0)}_dispose(e,t){let i=this.m_dom;delete i[zi],delete i[kr],e&&i.remove(),this.enumChilds(s=>{s._dispose(!1,!0)}),this.m_dom=null,t&&this.disposeTimers(),this.componentDisposed(),this.m_iprops.created=!1}componentDisposed(){}componentCreated(){}update(e=0){if(this.m_dom){let t=d(()=>{let i=this.m_dom;this._dispose(!1,!1);let s=this._build();console.assert(!!i.parentNode,"update in componentCreated is not allowed, use updateContent"),i.parentNode.replaceChild(s,i)},"_update");e?this.singleShot(t,e):t()}}_empty(){let e=this.m_dom;if(e)for(;e.firstChild;)e.removeChild(e.firstChild)}_updateContent(){if(!this.m_dom)return;this._empty();let e=this.m_props.content;e&&(mi(e)||(e=[e]),e.forEach(t=>{t&&(cs(t)?this.m_dom.insertAdjacentHTML("beforeend",t):t instanceof N?this.m_dom.append(t._build()):this.m_dom.insertAdjacentText("beforeend",t+""))}))}getBoundingRect(e=!1){console.assert(this.dom!=null,"cannot get bounding rect of an non DOM element");let t=this.dom.getBoundingClientRect(),i=new Oi(t.left,t.top,t.width,t.height);if(e){let s=this.getComputedStyle(),r=s.parse("marginTop"),n=s.parse("marginBottom"),l=s.parse("marginLeft"),o=s.parse("marginRight");i.left-=l,i.width+=l+o,i.top-=r,i.height+=r+n}return i}setDomEvent(e,t){let i=t;this._setDomEvent(e,i)}_setDomEvent(e,t){this.m_iprops.dom_events||(this.m_iprops.dom_events={});let i=this.m_iprops.dom_events[e];i?i.push(t):i=this.m_iprops.dom_events[e]=[t],this.m_dom&&this.createEvent(e,t)}clearDomEvent(e){if(!this.m_iprops.dom_events)return;delete this.m_iprops.dom_events[e];let t=this.m_dom;if(t){let i=t[kr];i&&delete i[e]}}createEvent(e,t){let i=this.m_dom,s=i[kr];s||(s=i[kr]={}),s[e]?s[e].push(t):s[e]=[t],Lf[e]===1?i["on"+e]=N._dispatchUnbubbleEvent:N.__privateEvents[e]||(N.__privateEvents[e]=!0,Nw[e]?B.addEventListener(e,N._dispatchEvent,{passive:!1,capture:!0}):B.addEventListener(e,N._dispatchEvent,!0)),e==="sizechange"&&(N.__sizeObserver||(N.__sizeObserver=new ResizeObserver(N._observeSize)),N.__sizeObserver.observe(this.m_dom))}static _dispatchEvent(e){let t=e.target,i=Lf[e.type]===2;for(;t;){if(t[kr]){let s=t[kr][e.type];if(s){let r=t[zi],n=r?.root??null;if(s instanceof Array?s.some(l=>{if(l(e,n),!r.dom)return!0}):s(e,n),e.cancelBubble||e.defaultPrevented||i)break}}if(t=t.parentNode,t==document)break}}static _dispatchUnbubbleEvent(e){let t=e.currentTarget||e.target,i=e.type,s=t[kr],r=s&&s[i];if(r){let l=t[zi]?.root??null;r instanceof Array?r.forEach(o=>{o(e,l)}):r(e,l)}}static _observeSize(e){e.forEach(t=>{let i=t.target;i.offsetParent!==null&&i.dispatchEvent(new Event("sizechange"))})}enumChilds(e,t=!1){if(this.m_dom){let i=this.m_dom.firstChild;for(;i;){let s=i[zi];if(s&&(e(s),t&&s.enumChilds(e,!0)===!0))return!0;i=i.nextSibling}}else{let i=this.m_props.content;if(!i)return;mi(i)||(i=[i]),i.some(s=>{if(!(!s||He(s)||cs(s))&&(e(s)||t&&s.enumChilds(e,!0)===!0))return!0})}return!1}_appendChild(e){if(He(e))this.m_dom.insertAdjacentText("beforeend",e);else if(cs(e))this.m_dom.insertAdjacentHTML("beforeend",e);else{let t=e;try{t._build(),this.m_dom.appendChild(t.m_dom)}catch(i){console.error(i)}}}_genClassName(){this.addClass("@comp");let e=Object.getPrototypeOf(this);for(;e&&e.constructor!==N;){let t=e.constructor.name;this.addClass("@"+In(t)),e=Object.getPrototypeOf(e)}}_makeCls(e){return e[0]=="@"?e=Gw+e.substring(1):e}static dispatchCaptures(e){N.__capture.handler(e)}static setCapture(e,t){if(console.assert(!N.__capture),N.__capture)debugger;let i=B.querySelectorAll("iframe");i.forEach(l=>{ci(l).setStyleValue("pointer-events","none")});let s=B.querySelectorAll(":hover"),r=null;if(s.length){let l=s[s.length-1];r=window.getComputedStyle(l).cursor}N.__capture_mask=B.createElement("div");let n=ci(N.__capture_mask);n.addClass("@capture-mask"),r&&n.setStyleValue("cursor",r),B.body.appendChild(n.dom),B.addEventListener("mousedown",N.dispatchCaptures),B.addEventListener("mousemove",N.dispatchCaptures),B.addEventListener("mouseup",N.dispatchCaptures),B.addEventListener("touchstart",N.dispatchCaptures),B.addEventListener("touchmove",N.dispatchCaptures),B.addEventListener("touchend",N.dispatchCaptures),N.__capture={initiator:e,handler:t,iframes:i}}static releaseCapture(){console.assert(!!N.__capture),B.removeEventListener("touchstart",N.dispatchCaptures),B.removeEventListener("touchmove",N.dispatchCaptures),B.removeEventListener("touchend",N.dispatchCaptures),B.removeEventListener("mousedown",N.dispatchCaptures),B.removeEventListener("mousemove",N.dispatchCaptures),B.removeEventListener("mouseup",N.dispatchCaptures),N.__capture.iframes.forEach(e=>{ci(e).setStyleValue("pointer-events",null)}),N.__capture=null,N.__capture_mask&&(B.body.removeChild(N.__capture_mask),N.__capture_mask=null)}scrollIntoView(e){if(this.m_dom){let t=new Oi(this.dom.getBoundingClientRect()),i,s,r,n,l=this.dom.parentElement,o=B.body;for(;l&&l!=o;){let a=l.getBoundingClientRect();(i===void 0||i<a.top)&&(i=a.top),(s===void 0||s>a.bottom)&&(s=a.bottom),(r===void 0||r<a.left)&&(r=a.left),(n===void 0||n>a.right)&&(n=a.right),l=l.parentElement}(i===void 0||t.top<i||t.bottom>s||t.left<r||t.right>n)&&this.m_dom.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"})}}queryItem(e){let t=this.dom.querySelector(e);return t?N.getElement(t):null}queryAll(e,t){let i=Array.from(this.m_dom.querySelectorAll(e));return t&&i.forEach(s=>{t(ci(s))}),i}itemWithId(e){let t=this.dom.querySelector("#"+e);return t?N.getElement(t):null}itemWithRef(e){let t=null;return this.enumChilds(i=>{if(i.m_props.ref===e)return t=i,!0},!0),t}get ref(){return this.m_props.ref}static getCss(){return N.__css||(N.__css=new Wr),N.__css}getParent(){console.assert(!!this.m_dom);let e=this.dom.parentNode;return N.getElement(e)}static getElement(e,t){if(t){let i=He(t);for(;e;){let s=e[zi];if(i){if(s&&s.hasClass(t))return s}else if(s instanceof t)return s;e=e.parentElement}return null}else return e?e[zi]:null}static getScrollbarSize(){if(N.__sb_width===void 0){let e=B.createElement("div");e.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px";let t=B.createElement("div");t.style.width="200px",t.style.height="200px",e.appendChild(t),B.body.appendChild(e),N.__sb_width=e.offsetWidth-e.clientWidth,B.body.removeChild(e)}return N.__sb_width}isUserVisible(){return this.m_dom?this.m_dom.offsetParent!==null:!1}},"_Component"),P=N;d(P,"Component");_e(P,"__sb_width");_e(P,"__comp_guid",1e3);_e(P,"__privateEvents",{});_e(P,"__sizeObserver");_e(P,"__createObserver");_e(P,"__capture",null);_e(P,"__capture_mask",null);_e(P,"__css",null);var Vf=null;function ci(e){if(e[zi])return e[zi];let t=Vf;return t||(t=Vf=new P({})),t.m_dom=e,t}h(ci,"flyWrap2");m(ci,"flyWrap");d(ci,"flyWrap");var ch=m(class extends P{constructor(e={}){e.flex||(e.flex=1),super(e)}},"Flex");d(ch,"Flex");var $w=m(class extends P{m_size;constructor(e){super({}),this.m_size=e}componentCreated(){let e=this.dom,t=null;for(;e;){let i=e[zi];if(i.hasClass("@hlayout")){t={width:this.m_size};break}else if(i.hasClass("@vlayout")){t={height:this.m_size};break}e=e.parentElement}t||(t={width:this.m_size,height:this.m_size}),this.setStyle(t)}},"Space");d($w,"Space");function Mt(e,t=null,i=null){return Pe({size:e,mode:t,context:i})}h(Mt,"EvSize2");m(Mt,"EvSize");d(Mt,"EvSize");var Gp=m(class extends P{m_irect;m_delta;m_target;constructor(e){super(e),this.setDomEvent("mousedown",t=>this._mousedown(t)),this.setDomEvent("touchstart",t=>this._mousedown(t)),this.setDomEvent("dblclick",t=>this._collapse(t))}render(){this.addClass(this.m_props.orientation)}_collapse(e){this.m_props.collapsible&&(this._findTarget(),this.m_target&&this.m_target.toggleClass("@collapsed"))}_mousedown(e){if(e.type=="touchstart"){let t=e;t.touches.length==1&&this._startMoving(t.touches[0].pageX,t.touches[0].pageY,e)}else{let t=e;this._startMoving(t.pageX,t.pageY,e)}}_startMoving(e,t,i){this._findTarget(),this.m_target&&(this.m_props.orientation=="horizontal"?this.m_props.sizing=="before"?this.m_delta=e-this.m_irect.right:this.m_delta=e-this.m_irect.left:this.m_props.sizing=="before"?this.m_delta=t-this.m_irect.bottom:this.m_delta=t-this.m_irect.top,i.preventDefault(),i.stopPropagation(),this.m_target.addClass("sizing"),P.setCapture(this,s=>this._pointerMoved(s)))}_pointerMoved(e){let t=d((i,s)=>{if(this.m_props.orientation=="horizontal"){let r;if(this.m_props.sizing=="after"?r=this.m_irect.right-(i-this.m_delta):r=i-this.m_delta-this.m_irect.left,r>0){let n=new An(r,0);this.emit("resize",Mt(n)),this.m_target.setStyleValue("width",n.width),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}else{let r;if(this.m_props.sizing=="after"?r=this.m_irect.bottom-(s-this.m_delta):r=s-this.m_delta-this.m_irect.top,r>0){let n=new An(0,r);this.emit("resize",Mt(n)),this.m_target.setStyleValue("height",n.height),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}},"__move");if(e.type=="mousemove"){let i=e;t(i.pageX,i.pageY),e.preventDefault(),e.stopPropagation()}else if(e.type=="touchmove"){let i=e;t(i.touches[0].pageX,i.touches[0].pageY),e.preventDefault(),e.stopPropagation()}else(e.type=="mouseup"||e.type=="touchend")&&(this.m_target.removeClass("sizing"),P.releaseCapture(),e.preventDefault(),e.stopPropagation())}_findTarget(){if(!this.m_target)if(this.m_props.sizing=="before"){let e=this.dom.previousElementSibling,t=e?P.getElement(e):null;this.m_target=t}else{let e=this.dom.nextElementSibling,t=e?P.getElement(e):null;this.m_target=t}this.m_target?this.m_irect=this.m_target.getBoundingRect():this.m_irect=null}},"Separator");d(Gp,"Separator");function Pd(e,t,i=null){return Pe({ui_event:e,sens:t,context:i})}h(Pd,"EvOverlayResize2");m(Pd,"EvOverlayResize");d(Pd,"EvOverlayResize");var Wh=m(class extends P{m_delta;m_irect;constructor(e){super(e),this.addClass(e.sens),this.setDomEvent("mousedown",t=>this._mousedown(t)),this.setDomEvent("touchstart",t=>this._mousedown(t)),this.setDomEvent("dblclick",t=>this.resetflex(t)),e.target.appendChild(this),e.resize&&this.on("resize",this.m_props.resize)}resetflex(e){this.m_props.target.addClass("@flex"),this.emit("resize",Mt({width:-1,height:0})),e.preventDefault(),e.stopPropagation()}_mousedown(e){e.preventDefault(),e.stopPropagation();let t=Pd(e,this.m_props.sens);if(this.emit("rawresize",t),t.defaultPrevented)return;let i=ms(e,!0);this.m_irect=this.m_props.target.getBoundingRect(),this.m_props.sens=="right"?this.m_delta=i.x-this.m_irect.right:this.m_props.sens=="left"?this.m_delta=i.x-this.m_irect.left:this.m_props.sens=="bottom"?this.m_delta=i.y-this.m_irect.bottom:this.m_props.sens=="top"&&(this.m_delta=i.y-this.m_irect.top),this.m_props.target.addClass("sizing"),P.setCapture(this,s=>this._handle_mouse(s))}_is_horz(){return this.m_props.sens=="left"||this.m_props.sens=="right"}get sens(){return this.m_props.sens}_handle_mouse(e){let t=d((i,s)=>{if(this._is_horz()){let r;if(this.m_props.sens=="left"?r=this.m_irect.right-(i-this.m_delta):r=i-this.m_delta-this.m_irect.left,r>0){let n={width:r,height:void 0};this.emit("resize",Mt(n)),this.m_props.target.setStyleValue("width",n.width),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}else{let r;if(this.m_props.sens=="top"?r=this.m_irect.bottom-(s-this.m_delta):r=s-this.m_delta-this.m_irect.top,r>0){let n=new An(0,r);this.emit("resize",Mt(n)),this.m_props.target.setStyleValue("height",n.height),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}},"__move");if(e.type=="mousemove"){let i=e;t(i.pageX,i.pageY),e.preventDefault(),e.stopPropagation()}else if(e.type=="touchmove"){let i=e;t(i.touches[0].pageX,i.touches[0].pageY),e.preventDefault(),e.stopPropagation()}else(e.type=="mouseup"||e.type=="touchend")&&(this.m_props.target.removeClass("sizing"),P.releaseCapture(),e.preventDefault(),e.stopPropagation())}},"SizerOverlay");d(Wh,"SizerOverlay");function Td(e){return Pe({name:e})}h(Td,"EvShortcut2");m(Td,"EvShortcut");d(Td,"EvShortcut");var zt=m(class extends P{m_shortcuts;constructor(e){mi(e)?super({content:e}):super(e)}addShortcut(e,t,i=null,s=!1){this.m_shortcuts||(this.m_shortcuts=[],this.setDomEvent("keydown",r=>this._handleKeydown(r))),mi(e)||(e=[e]),e.forEach(r=>{let n="";r.match(/SHIFT/i)&&(r=r.replace(/SHIFT/i,""),n+="shift+"),r.match(/CTRL/i)&&(r=r.replace(/CTRL/i,""),n+="ctrl+"),r.match(/CMD/i)&&(r=r.replace(/CMD/i,""),n+="cmd+"),r.match(/ALT/i)&&(r=r.replace(/ALT/i,""),n+="alt+"),n+=r.replace("+","").toLowerCase(),this.m_shortcuts.push({sequence:n,name:t,immediate:s,callback:i})})}removeShortcuts(){this.m_shortcuts&&(this.m_shortcuts=[])}_handleKeydown(e){if(!this.m_shortcuts)return;let t="";e.shiftKey&&(t+="shift+"),e.ctrlKey&&(t+="ctrl+"),e.metaKey&&(t+="cmd+"),e.altKey&&(t+="alt+"),t+=e.key.toLowerCase(),this.m_shortcuts.some(i=>{if(i.sequence==t)return i.callback?i.immediate?i.callback(e):cr(()=>{i.callback(e)}):this.emit("shortcut",Td(i.name)),e.preventDefault(),e.stopPropagation(),!0})}},"Container");d(zt,"Container");var Np=m(class{m_data;m_name;constructor(e){this.m_data=null,this.m_name=e??"settings"}set(e,t){this._load(),this.m_data[e]=t,this._save()}get(e,t){return this._load(),this.m_data[e]??t}_save(){let e=JSON.stringify(this.m_data);localStorage.setItem(this.m_name,e)}_load(){if(this.m_data)return;this.m_data={};let e=localStorage.getItem(this.m_name);e!==null&&(e=JSON.parse(e),e?this.m_data=e:console.info("There was an error attempting to read your settings."))}},"Settings");d(Np,"Settings");var Up=Object.defineProperty,qw=d((e,t,i)=>t in e?Up(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,"__defNormalProp"),f=d((e,t)=>Up(e,"name",{value:t,configurable:!0}),"__name"),fe=d((e,t,i)=>(qw(e,typeof t!="symbol"?t+"":t,i),i),"__publicField"),H=document,$p=f(function(){this.propagationStopped=!0},"stopPropagation"),qp=f(function(){this.defaultPrevented=!0},"preventDefault");function Ie(e){return{stopPropagation:$p,preventDefault:qp,...e}}h(Ie,"BasicEvent22");m(Ie,"BasicEvent2");d(Ie,"BasicEvent");f(Ie,"BasicEvent");function bs(e=null){return Ie({context:e})}h(bs,"EvClick22");m(bs,"EvClick2");d(bs,"EvClick");f(bs,"EvClick");function $e(e,t=null){return Ie({value:e,context:t})}h($e,"EvChange22");m($e,"EvChange2");d($e,"EvChange");f($e,"EvChange");function bi(e,t=null){return Ie({selection:e,context:t})}h(bi,"EvSelectionChange22");m(bi,"EvSelectionChange2");d(bi,"EvSelectionChange");f(bi,"EvSelectionChange");function Ns(e,t=null){return Ie({uievent:e,context:t})}h(Ns,"EvContextMenu22");m(Ns,"EvContextMenu2");d(Ns,"EvContextMenu");f(Ns,"EvContextMenu");function jh(e,t=0,i=null){return Ie({timer:e,time:t,context:i})}h(jh,"EvTimer22");m(jh,"EvTimer2");d(jh,"EvTimer");f(jh,"EvTimer");function Fd(e,t,i){return Ie({msg:e,params:t,source:i})}h(Fd,"EvMessage22");m(Fd,"EvMessage2");d(Fd,"EvMessage");f(Fd,"EvMessage");function Gh(e,t,i){return Ie({element:e,data:t,context:i})}h(Gh,"EvDrag22");m(Gh,"EvDrag2");d(Gh,"EvDrag");f(Gh,"EvDrag");function Nh(e,t){return Ie({code:e,message:t})}h(Nh,"EvError22");m(Nh,"EvError2");d(Nh,"EvError");f(Nh,"EvError");var bo=d(class{m_source;m_eventRegistry;m_defaultHandlers;constructor(e=null){this.m_source=e??this}emit(e,t){this._emit(e,t)}_emit(e,t){let i=this.m_eventRegistry?.get(e),s=this.m_defaultHandlers?.get(e);if(t||(t={}),t.source||(t.source=this.m_source),t.type||(t.type=e),i&&i.length)if(t.preventDefault||(t.preventDefault=qp),t.stopPropagation||(t.stopPropagation=$p),i.length==1)i[0](t);else{let r=i.slice();for(let n=0,l=r.length;n<l&&(r[n](t),!t.propagationStopped);n++);}if(s&&s.length&&!t.defaultPrevented)return s[0](t)}signal(e,t,i=-1){this._signal(e,t,i)}_signal(e,t,i=-1){if(!this.m_eventRegistry)return;let s=this.m_eventRegistry.get(e);if(!(!s||!s.length))if(t||(t={}),t.type||(t.type=e),t.source||(t.source=this.m_source),t.preventDefault=t.stopPropagation=()=>{console.error("this event cannot be stopped not default prevented")},s.length==1&&i==-1)s[0](t);else{let r=s.slice(),n=f(()=>{for(let l=0,o=r.length;l<o;l++)r[l](t)},"call");i==-1?n():setTimeout(n,i)}}once(e,t){this._once(e,t)}_once(e,t){let i=f(s=>{this._off(e,i),t(s)},"newCallback");if(this._on(e,i),!t)return new Promise(function(s){t=s})}setDefaultHandler(e,t){let i=this.m_defaultHandlers;i||(i=this.m_defaultHandlers=new Map);let s=i.get(e);if(s){let r=s.indexOf(t);r!=-1&&s.splice(r,1),s.unshift(t)}else i.set(e,[t])}removeDefaultHandler(e,t){let i=this.m_defaultHandlers;if(!i)return;let s=i.get(e);if(s){let r=s.indexOf(t);r!=-1&&s.splice(r,1)}}listen(e){for(let t in e)this._on(t,e[t])}defaults(e){for(let t in e)this.setDefaultHandler(t,e[t])}on(e,t){return this._on(e,t)}_on(e,t,i=!1){this.m_eventRegistry||(this.m_eventRegistry=new Map);let s=this.m_eventRegistry.get(e);return s||(s=[],this.m_eventRegistry.set(e,s)),s.indexOf(t)==-1&&(i?s.unshift(t):s.push(t)),{dispose:()=>{this._off(e,t)}}}off(e,t){return this._off(e,t)}_off(e,t){if(!this.m_eventRegistry)return;let i=this.m_eventRegistry.get(e);if(!i)return;let s=i.indexOf(t);s!==-1&&i.splice(s,1)}removeAllListeners(e){e?(this.m_eventRegistry&&(this.m_eventRegistry[e]=void 0),this.m_defaultHandlers&&(this.m_defaultHandlers[e]=void 0)):this.m_eventRegistry=this.m_defaultHandlers=void 0}},"EventSource");f(bo,"EventSource");var tl=d(class extends bo{m_props;#e;constructor(e){super(),this.m_props=e,e.events&&this.listen(e.events)}startTimer(e,t,i=!0,s=null){this.#e?this.stopTimer(e):this.#e=new Map;let r=(i?setInterval:setTimeout)(n=>{s?s(e,n):this.emit("timer",jh(e,n))},t);this.#e.set(e,()=>{(i?clearInterval:clearTimeout)(r)})}stopTimer(e){let t=this.#e.get(e);t&&t()}disposeTimers(){this.#e?.forEach(e=>e()),this.#e=void 0}singleShot(e,t=0){setTimeout(e,t)}mapPropEvents(e,...t){t.forEach(i=>{let s=i;e[s]&&this._on(s,e[s])})}},"BaseComponent");f(tl,"BaseComponent");var Kp=Symbol("i18n"),il={};function xo(e,t){il[e]={name:e,base:t,src_translations:{},translations:{}}}h(xo,"createLanguage22");m(xo,"createLanguage2");d(xo,"createLanguage");f(xo,"createLanguage");function Co(e){return il[e]!==void 0}h(Co,"isLanguage22");m(Co,"isLanguage2");d(Co,"isLanguage");f(Co,"isLanguage");function yo(e,...t){if(!Co(e))return;let i=il[e];t.forEach(s=>{Eo(i.src_translations,s,i.base)}),i.translations=ko(i.src_translations,i.base,!0)}h(yo,"addTranslation22");m(yo,"addTranslation2");d(yo,"addTranslation");f(yo,"addTranslation");function Eo(e,t,i){for(let s in t)e[s]instanceof Object?Eo(e[s],t[s],i):(e[s]=t[s],e[s]=ko(e[s],i,!1));return e}h(Eo,"_patch22");m(Eo,"_patch2");d(Eo,"_patch");f(Eo,"_patch");var uh;function Uh(e){for(;e;){let t=il[e],i=t.translations,s;for(let r of uh){if(s=i[r],s===void 0)break;i=s}if(s!==void 0)return i;e=t.base}console.error("I18N error: unable to find","_tr."+uh.join("."))}h(Uh,"_findBaseTrans22");m(Uh,"_findBaseTrans2");d(Uh,"_findBaseTrans");f(Uh,"_findBaseTrans");function ko(e,t,i){return new Proxy(e,{get:(s,r)=>{i?uh=[r]:uh.push(r);let n=s[r];return n===void 0&&t&&(n=Uh(t),s[r]=n),n}})}h(ko,"_mk_proxy22");m(ko,"_mk_proxy2");d(ko,"_mk_proxy");f(ko,"_mk_proxy");var oe={};function $h(e){Co(e)&&(oe=il[e].translations,oe[Kp]=e)}h($h,"selectLanguage22");m($h,"selectLanguage2");d($h,"selectLanguage");f($h,"selectLanguage");function zd(){return oe[Kp]}h(zd,"getCurrentLanguage22");m(zd,"getCurrentLanguage2");d(zd,"getCurrentLanguage");f(zd,"getCurrentLanguage");function Rd(){return Object.keys(il)}h(Rd,"getAvailableLanguages22");m(Rd,"getAvailableLanguages2");d(Rd,"getAvailableLanguages");f(Rd,"getAvailableLanguages");var Kw={global:{ok:"OK",cancel:"Annuler",ignore:"Ignorer",yes:"Oui",no:"Non",open:"Ouvrir",new:"Nouveau",delete:"Supprimer",close:"Fermer",save:"Enregistrer",search:"Rechercher",search_tip:"Saisissez le texte \xE0 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\xE9rique 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\xE9v","mar","avr","mai","jun","jui","ao\xFB","sep","oct","nov","d\xE9c"],month_long:["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"],property:"Propri\xE9t\xE9",value:"Valeur",err_403:"Vous n'avez pas les droits suffisants pour effectuer cette action",copy:"Copier",cut:"Couper",paste:"Coller"}},Yw={global:{ok:"OK",cancel:"Cancel",ignore:"Ignore",yes:"Yes",no:"No",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"}};xo("fr",null);yo("fr",Kw);xo("en","fr");yo("en",Yw);$h("fr");function So(){return"ontouchstart"in window}h(So,"isTouchDevice22");m(So,"isTouchDevice2");d(So,"isTouchDevice");f(So,"isTouchDevice");function Zr(e,t){let i=Math.pow(10,t),s=Math.round(e*i)/i;return Object.is(s,-0)&&(s=0),s}h(Zr,"roundTo22");m(Zr,"roundTo2");d(Zr,"roundTo");f(Zr,"roundTo");function qh(e){return e=e.replace(/\s*/g,""),e=e.replace(",","."),e.length==0?0:parseFloat(e)}h(qh,"parseIntlFloat22");m(qh,"parseIntlFloat2");d(qh,"parseIntlFloat");f(qh,"parseIntlFloat");function jr(e){let t=e;return t=t.replace(/([a-z])([A-Z])/g,"$1 $2"),t=t.toLowerCase(),t=t.replace(/[^- a-z0-9]+/g," "),t.indexOf(" ")<0?t:(t=t.trim(),t.replace(/ /g,"-"))}h(jr,"pascalCase22");m(jr,"pascalCase2");d(jr,"pascalCase");f(jr,"pascalCase");function Ld(e){let t=e.toLowerCase();return t=t.replace(/[^a-zA-Z0-9]+(.)/g,(i,s)=>s.toUpperCase()),t}h(Ld,"camelCase22");m(Ld,"camelCase2");d(Ld,"camelCase");f(Ld,"camelCase");var qi=d(class{x;y;constructor(e=0,t=0){this.x=e,this.y=t}},"Point");f(qi,"Point");var Pn=d(class{width;height;constructor(e=0,t=0){this.width=e,this.height=t}},"Size");f(Pn,"Size");var Wi=d(class{left;top;width;height;constructor(e,t,i,s){if(e===void 0)this.left=this.top=this.right=this.bottom=0;else if(e instanceof Wi||e instanceof DOMRect){let r=e;this.left=r.left,this.top=r.top,this.width=r.width,this.height=r.height}else this.left=e,this.top=t,this.width=i,this.height=s}set(e,t,i,s){this.left=e,this.top=t,this.width=i,this.height=s}get bottom(){return this.top+this.height}set bottom(e){this.height=e-this.top}get right(){return this.left+this.width}set right(e){this.width=e-this.left}get topLeft(){return new qi(this.left,this.top)}get bottomRight(){return new qi(this.right,this.bottom)}get size(){return new Pn(this.width,this.height)}moveTo(e,t){return this.left=e,this.top=t,this}movedTo(e,t){return new Wi(e,t,this.width,this.height)}moveBy(e,t){return this.left+=e,this.top+=t,this}movedBy(e,t){return new Wi(this.left+e,this.top+t,this.width,this.height)}isEmpty(){return this.width==0&&this.height==0}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}normalized(){let e=new Wi(this),t=e.width,i=e.height;return t<0&&(e.left+=t,e.width=-t),i<0&&(e.top+=i,e.height=-i),e}containsPt(e,t){return e>=this.left&&e<=this.right&&t>=this.top&&t<=this.bottom}contains(e){return e instanceof Wi?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)}inflate(e,t){t===void 0&&(t=e),this.left-=e,this.top-=t,this.width+=e+e,this.height+=t+t}inflatedBy(e,t){return t===void 0&&(t=e),new Wi(this.left-e,this.top-t,this.width+e+e,this.height+t+t)}combine(e){let t=Math.min(this.left,e.left),i=Math.min(this.top,e.top),s=Math.max(this.right,e.right),r=Math.max(this.bottom,e.bottom);this.left=t,this.top=i,this.right=s,this.bottom=r}},"Rect");f(Wi,"Rect");function zr(e,...t){return e.replace(/{(\d+)}/g,function(i,s){return typeof t[s]<"u"?t[s]:i})}h(zr,"sprintf22");m(zr,"sprintf2");d(zr,"sprintf");f(zr,"sprintf");function Tn(e,t=!1){if(!e||e.length==0)return"";let i=e.replace(/[<>\&\"\']/g,function(s){return"&#"+s.charCodeAt(0)+";"});return t&&(i=i.replace(/(\r\n|\n\r|\r|\n)/g,"<br/>")),i}h(Tn,"escapeHtml22");m(Tn,"escapeHtml2");d(Tn,"escapeHtml");f(Tn,"escapeHtml");function Vd(e,t=!1){if(e==null||!Fe(e)||e.length==0)return"";let i="";for(let s=0;s<e.length;s++){let r=e.codePointAt(s);r>127?i+="&#"+r+";":r==60?i+="<":i+=e.charAt(s)}return i}h(Vd,"removeHtmlTags22");m(Vd,"removeHtmlTags2");d(Vd,"removeHtmlTags");f(Vd,"removeHtmlTags");var Xw="fr-FR";function Bd(e){Xw=e}h(Bd,"_date_set_locale22");m(Bd,"_date_set_locale2");d(Bd,"_date_set_locale");f(Bd,"_date_set_locale");function Hd(e,t){return Et(e)}h(Hd,"date_format22");m(Hd,"date_format2");d(Hd,"date_format");f(Hd,"date_format");function Od(e,t,i){var s=(e.getTime()-t.getTime())/1e3;let r=s;if(r<60)return zr(oe.global.diff_date_seconds,Math.round(r));let n=Math.floor(r/60);if(n<60)return zr(oe.global.diff_date_minutes,Math.round(n));let l=Math.floor(n/60);return zr(oe.global.diff_date_hours,l,n%60)}h(Od,"date_diff22");m(Od,"date_diff2");d(Od,"date_diff");f(Od,"date_diff");function Wd(e,t){return t?Et(e,"Y-M-D H:I:S"):Et(e,"Y-M-D")}h(Wd,"date_to_sql22");m(Wd,"date_to_sql2");d(Wd,"date_to_sql");f(Wd,"date_to_sql");function jd(e){return new Date(e+" GMT")}h(jd,"date_sql_utc22");m(jd,"date_sql_utc2");d(jd,"date_sql_utc");f(jd,"date_sql_utc");function Gr(e){return e.getFullYear()<<16|e.getMonth()<<8|e.getDate()}h(Gr,"date_hash22");m(Gr,"date_hash2");d(Gr,"date_hash");f(Gr,"date_hash");Date.prototype.hash=function(){return Gr(this)};function Rr(e){return new Date(e.getTime())}h(Rr,"date_clone22");m(Rr,"date_clone2");d(Rr,"date_clone");f(Rr,"date_clone");function Fn(e){let t=new Date(e.getFullYear(),0,1),i=(e.valueOf()-t.valueOf())/864e5;return Math.floor((i+t.getDay()+1)/7)}h(Fn,"date_calc_weeknum22");m(Fn,"date_calc_weeknum2");d(Fn,"date_calc_weeknum");f(Fn,"date_calc_weeknum");function En(e,t=oe.global.date_input_formats){let i=t.split("|");for(let s of i){let r="";for(let o of s)o=="d"||o=="D"?r+="(?<day>\\d{1,2})":o=="m"||o=="M"?r+="(?<month>\\d{1,2})":o=="y"||o=="Y"?r+="(?<year>\\d{1,4})":o=="h"||o=="H"?r+="(?<hour>\\d{1,2})":o=="i"||o=="I"?r+="(?<min>\\d{1,2})":o=="s"||o=="S"?r+="(?<sec>\\d{1,2})":o==" "?r+="\\s+":r+="\\s*\\"+o+"\\s*";let l=new RegExp("^"+r+"$","m").exec(e);if(l){let o=new Date,a=parseInt(l.groups.day??"1"),c=parseInt(l.groups.month??"1"),u=parseInt(l.groups.year??o.getFullYear()+""),_=parseInt(l.groups.hour??"0"),p=parseInt(l.groups.min??"0"),v=parseInt(l.groups.sec??"0");u>0&&u<100&&(u+=2e3);let g=new Date(u,c-1,a,_,p,v,0),x=g.getFullYear(),E=g.getMonth()+1,y=g.getDate();return x!=u||E!=c||y!=a?null:g}}return null}h(En,"parseIntlDate22");m(En,"parseIntlDate2");d(En,"parseIntlDate");f(En,"parseIntlDate");function Et(e,t=oe.global.date_format){if(!e)return"";let i={year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),wday:e.getDay(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milli:e.getMilliseconds()},s="",r=0;for(let n of t){if(n=="{"){if(++r==1)continue}else if(n=="}"&&--r==0)continue;if(r){s+=n;continue}n=="d"?s+=i.day:n=="D"?s+=Ri(i.day,-2):n=="j"?s+=oe.global.day_short[i.wday]:n=="J"?s+=oe.global.day_long[i.wday]:n=="w"?s+=Fn(e):n=="W"?s+=Ri(Fn(e),-2):n=="m"?s+=i.month:n=="M"?s+=Ri(i.month,-2):n=="o"?s+=oe.global.month_short[i.month-1]:n=="O"?s+=oe.global.month_long[i.month-1]:n=="y"||n=="Y"?s+=Ri(i.year,-4):n=="a"||n=="A"?s+=i.hours<12?"am":"pm":n=="h"?s+=i.hours:n=="H"?s+=Ri(i.hours,-2):n=="i"?s+=i.minutes:n=="I"?s+=Ri(i.minutes,-2):n=="s"?s+=i.seconds:n=="S"?s+=Ri(i.seconds,-2):n=="l"?s+=i.milli:n=="L"?s+=Ri(i.milli,-3):s+=n}return s}h(Et,"formatIntlDate22");m(Et,"formatIntlDate2");d(Et,"formatIntlDate");f(Et,"formatIntlDate");function Gd(e,t){if(t===void 0&&(t=new Date),!e)return 0;let i=t.getFullYear()-e.getFullYear();return(t.getMonth()<e.getMonth()||t.getMonth()==e.getMonth()&&t.getDate()<e.getDate())&&i--,i}h(Gd,"calcAge22");m(Gd,"calcAge2");d(Gd,"calcAge");f(Gd,"calcAge");Date.prototype.isSameDay=function(e){return this.getDate()==e.getDate()&&this.getMonth()==e.getMonth()&&this.getFullYear()==e.getFullYear()};Date.prototype.hash=function(){return Gr(this)};Date.prototype.clone=function(){return Rr(this)};Date.prototype.weekNum=function(){return Fn(this)};Date.prototype.format=function(e){return Et(this,e)};Date.prototype.addDays=function(e){return this.setDate(this.getDate()+e),this};function Kh(e,t,i){let s=new Blob([e],{type:t}),r=window.URL.createObjectURL(s),n=H.createElement("a");n.style.display="none",n.href=r,n.download=i,H.body.appendChild(n),n.click(),window.URL.revokeObjectURL(r)}h(Kh,"downloadData22");m(Kh,"downloadData2");d(Kh,"downloadData");f(Kh,"downloadData");function Fe(e){return typeof e=="string"}h(Fe,"isString22");m(Fe,"isString2");d(Fe,"isString");f(Fe,"isString");function Jt(e){return e instanceof Array}h(Jt,"isArray22");m(Jt,"isArray2");d(Jt,"isArray");f(Jt,"isArray");function di(e){return e instanceof Function}h(di,"isFunction22");m(di,"isFunction2");d(di,"isFunction");f(di,"isFunction");function Yh(e){return!!e&&e.constructor===Object}h(Yh,"isLiteralObject22");m(Yh,"isLiteralObject2");d(Yh,"isLiteralObject");f(Yh,"isLiteralObject");function Ri(e,t,i="0"){let s;return Fe(e)?s=e:s=""+e,t>0?s.padEnd(t,i):s.padStart(-t,i)}h(Ri,"pad22");m(Ri,"pad2");d(Ri,"pad");f(Ri,"pad");function zn(e){return typeof e=="number"&&isFinite(e)}h(zn,"isNumber22");m(zn,"isNumber2");d(zn,"isNumber");f(zn,"isNumber");function Nd(e){let t=H.createElement("div");return t.style.position="absolute",t.style.fontFamily=e,t.style.fontSize="44px",t.style.opacity="0.001",t.innerText="X",H.body.appendChild(t),new Promise(i=>{let s=t.getBoundingClientRect(),r=setInterval(()=>{t.getBoundingClientRect().height!=s.height&&(clearInterval(r),H.body.removeChild(t),i())},0)})}h(Nd,"waitFontLoading22");m(Nd,"waitFontLoading2");d(Nd,"waitFontLoading");f(Nd,"waitFontLoading");function Xh(e,t=0,...i){setTimeout(e,t,...i)}h(Xh,"deferCall22");m(Xh,"deferCall2");d(Xh,"deferCall");f(Xh,"deferCall");function Us(e){requestAnimationFrame(e)}h(Us,"asap22");m(Us,"asap2");d(Us,"asap");f(Us,"asap");function Ud(e){if(!e)return"";let t=e.split(`
|
|
8
|
+
`),i="para",s="p",r=[];return t.forEach(n=>{let l=n.trim();if(i=="para"){if(l[0]=="-")l=l.substr(1),r.push("<ul>"),i="list",s="li";else if(l[0]==">")l=l.substr(1),r.push("<blockquote>"),i="quote",s="p";else if(l[0]=="#"){let c=0;do l=l.substr(1),c++;while(l[0]=="#"&&c<5);s="h"+c,i="title"}}else i=="list"?l[0]!="-"?(r.push("</ul>"),i="para",s="p"):l=l.substr(1):i=="quote"&&(l[0]!=">"?(r.push("</blockquote>"),i="para",s="p"):l=l.substr(1));let o=/\*\*([^*]+)\*\*/gi;l=Tn(l,!1),l=l.replace(o,(c,...u)=>"<b>"+c.substr(2,c.length-4)+"</b>");let a=/\*([^*]+)\*/gi;l=l.replace(a,(c,...u)=>"<i>"+c.substr(1,c.length-2)+"</i>"),l==""&&(l=" "),r.push(`<${s}>`+l+`</${s}>`),i=="title"&&(i="para",s="p")}),i=="list"?r.push("</ul>"):i=="quote"&&r.push("</blockquote>"),r.join("")}h(Ud,"markdownToHtml22");m(Ud,"markdownToHtml2");d(Ud,"markdownToHtml");f(Ud,"markdownToHtml");var Yp=d(class extends Error{m_code;constructor(e,t){e instanceof Response?(super(e.statusText),this.m_code=e.status):(super(t),this.m_code=e)}get code(){return this.m_code}},"NetworkError");f(Yp,"NetworkError");function Ji(e,t){let i="offsetX",s="offsetY";if(t&&(i="clientX",s="clientY"),e.type=="mousemove"||e.type=="mousedown"||e.type=="mouseup"){let r=e;return new qi(r[i],r[s])}else if(e.type=="pointermove"||e.type=="pointerdown"||e.type=="pointerup"){let r=e;return new qi(r[i],r[s])}else if(e.type=="touchmove"||e.type=="touchstart"){let r=e;return new qi(r.touches[0][i],r.touches[0][s])}else if(e.type=="contextmenu"){let r=e;return new qi(r[i],r[s])}else return new qi(0,0)}h(Ji,"getMousePos22");m(Ji,"getMousePos2");d(Ji,"getMousePos");f(Ji,"getMousePos");function Mr(e,t,i){return Math.min(Math.max(e,t),i)}h(Mr,"clamp22");m(Mr,"clamp2");d(Mr,"clamp");f(Mr,"clamp");var Ki=d(class extends String{constructor(e){super(e)}static from(e){return new Ki(e)}},"HtmlString");f(Ki,"HtmlString");function Do(e,...t){return Ki.from(String.raw(e,...t))}h(Do,"html22");m(Do,"html2");d(Do,"html");f(Do,"html");function Qi(e){return e instanceof Ki}h(Qi,"isHtmlString22");m(Qi,"isHtmlString2");d(Qi,"isHtmlString");f(Qi,"isHtmlString");var Zw=d(class{static copy(e){navigator.clipboard&&navigator.clipboard.writeText(JSON.stringify(e))}static paste(e){navigator.clipboard?navigator.clipboard.readText().then(t=>e(t)):console.error("no clipboard, are you in https ?")}},"Clipboard");f(Zw,"Clipboard");function $d(e){let t=-1,i=Buffer.from(e),s=0,r=i.length;for(;s<r;)t=t>>>8^Jw[(t^i[s])&255],s++;return(t^-1)>>>0}h($d,"crc3222");m($d,"crc322");d($d,"crc32");f($d,"crc32");var Jw=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]),Qw=d(class{superclass;constructor(e){this.superclass=e}with(...e){return e.reduce((t,i)=>i(t),this.superclass)}},"MixinBuilder");f(Qw,"MixinBuilder");function io(...e){let t="";for(let i of e)if(typeof i=="string")t+=" "+i;else if(i)for(let s in i)i[s]&&(t+=" "+s);return t}h(io,"classNames22");m(io,"classNames2");d(io,"classNames");f(io,"classNames");function qd(e,t){(!e||e==null)&&(e=8),t||(t=[{chars:"abcdefghijklmnopqrstuvwxyz",min:3},{chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",min:2},{chars:"0123456789",min:2},{chars:"!@#$*|%+-_.;",min:2}]);let i="",s=0;t.forEach(function(n){i+=n.chars,s+=n.min}),e<s&&(e=s),t.push({chars:i,min:e-s});let r="";return t.forEach(function(n){n.min>0&&(r+=so(n.chars,n.min))}),so(r)}h(qd,"generatePassword22");m(qd,"generatePassword2");d(qd,"generatePassword");f(qd,"generatePassword");function so(e,t){let i=e.split("").sort(()=>.5-Math.random()).join("");return t>0&&(i=i.substr(0,t)),i}h(so,"shuffle22");m(so,"shuffle2");d(so,"shuffle");f(so,"shuffle");function Kd(e="127.0.0.1",t="9876",i){let s;function r(){document.body.style.visibility="hidden";let a=[].slice.call(document.getElementsByTagName("link")),c=document.getElementsByTagName("head")[0];for(let u=0;u<a.length;++u){let _=a[u];c.removeChild(_);let p=_.rel;if(_.href&&typeof p!="string"||p.length==0||p.toLowerCase()=="stylesheet"){let v=_.href.replace(/(&|\?)_cacheOverride=\d+/,"");_.href=v+(v.indexOf("?")>=0?"&":"?")+"_cacheOverride="+new Date().valueOf()}c.appendChild(_)}s&&clearTimeout(s),s=setTimeout(()=>{document.body.style.visibility="unset"},50)}h(r,"refreshCSS"),m(r,"refreshCSS"),d(r,"refreshCSS"),f(r,"refreshCSS");let l=`${window.location.protocol==="https:"?"wss://":"ws://"}${e}:${t}/ws`,o=new WebSocket(l);o.onmessage=function(a){a.data=="reload"?i?i():window.location.reload():a.data=="refreshcss"&&r()},console.log("Live reload enabled.")}h(Kd,"installHMR22");m(Kd,"installHMR2");d(Kd,"installHMR");f(Kd,"installHMR");var Na=d(class{m_sheet;m_rules=new Map;constructor(){function e(t){for(let i=0;i<H.styleSheets.length;i++){let s=H.styleSheets[i];if(s.title===t)return s}}if(h(e,"getStyleSheet"),m(e,"getStyleSheet"),d(e,"getStyleSheet"),f(e,"getStyleSheet"),this.m_sheet=e("@dynamic-css"),!this.m_sheet){let t=H.createElement("style");t.setAttribute("id","@dynamic-css"),H.head.appendChild(t),this.m_sheet=t.sheet}}setRule(e,t){if(Fe(t)){let i=this.m_rules.get(e);i!==void 0?this.m_sheet.deleteRule(i):i=this.m_sheet.cssRules.length,this.m_rules.set(e,this.m_sheet.insertRule(t,i))}else{let i=1;for(let s in t){let r=s+" { ",n=t[s];for(let l in n){let o=n[l];for(let a=0;a<o.length;a++)r+=l+": "+o[a]+"; "}r+="}",this.setRule(e+"--"+i,r),i++}}}static getVar(e){return Na.doc_style||(Na.doc_style=getComputedStyle(H.documentElement)),e[0]!="-"&&(e="--"+e),Na.doc_style.getPropertyValue(e)}},"_Stylesheet"),Nr=Na;f(Nr,"Stylesheet");fe(Nr,"guid",1);fe(Nr,"doc_style");var Xp=d(class{result={};parse(e){return this.result={},this.parse_json("",e),Xp.mk_string(this.result)}static mk_string(e){let t="";for(let i in e){let s=e[i];t+=i+" { ";for(let r in s){let n=s[r];for(let l=0;l<n.length;l++)t+=r+": "+n[l]+"; "}t+=`}
|
|
9
|
+
`}return t}parse_json(e,t){e&&!this.result[e]&&(this.result[e]={});for(let i in t){let s=t[i];if(Jt(s)){let r=s;for(let n=0;n<r.length;n++)this.addProperty(e,i,r[n])}else switch(typeof s){case"number":{this.addProperty(e,i,s);break}case"string":{this.addProperty(e,i,s);break}case"object":{this.parse_json(this.makeSelectorName(e,i),s);break}default:{console.error("ignoring unknown type "+typeof s+" in property "+i);break}}}}makePropertyName(e){return jr(e)}makeSelectorName(e,t){let i=[],s=t.split(/\s*,\s*/),r=e.split(/\s*,\s*/);for(let n=0;n<r.length;n++){let l=r[n];for(let o=0;o<s.length;o++){let a=s[o],c=!1;a.charAt(0)=="&"&&(a=a.substr(1),c=!0),a.charAt(0)==="%"&&(a=".o-"+a.substr(1)),c?i.push(l+a):i.push(l?l+" "+a:a)}}return i.join(", ")}addProperty(e,t,i){let s=t.split(/\s*,\s*/);for(let r=0;r<s.length;r++){let n=this.makePropertyName(s[r]);this.result[e][n]?this.result[e][n].push(i):this.result[e][n]=[i];let o={"box-shadow":["-moz-box-shadow","-webkit-box-shadow"],"border-radius":["-moz-border-radius","-webkit-border-radius"],"border-radius-topleft":["-moz-border-radius-topleft","-webkit-border-top-left-radius"],"border-radius-topright":["-moz-border-radius-topright","-webkit-border-top-right-radius"],"border-radius-bottomleft":["-moz-border-radius-bottomleft","-webkit-border-bottom-left-radius"],"border-radius-bottomright":["-moz-border-radius-bottomright","-webkit-border-bottom-right-radius"]}[n];for(let a=0;o&&a<o.length;a++)this.addProperty(e,o[a],i)}}},"CSSParser");f(Xp,"CSSParser");var Mu=d(class{m_style;constructor(e){this.m_style=e}value(e){return e=jr(e),this.m_style[e]}parse(e){return e=jr(e),parseInt(this.m_style[e])}get style(){return this.m_style}},"ComputedStyle");f(Mu,"ComputedStyle");var eb="x-",Sr=Symbol(),Li=Symbol(),Zp={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridColumn:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Bf={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,create:2,sizechange:2},tb={touchstart:1,touchmove:1,touchend:1},ib=/^-?\d+(\.\d+)?$/;function Jr(e=null){return Ie({context:e})}h(Jr,"EvDblClick22");m(Jr,"EvDblClick2");d(Jr,"EvDblClick");f(Jr,"EvDblClick");function ro(e=!0,t=null){return Ie({focus:e,context:t})}h(ro,"EvFocus22");m(ro,"EvFocus2");d(ro,"EvFocus");f(ro,"EvFocus");var U=d(class extends tl{m_dom;m_iprops;constructor(e=null){super(e??{}),this.m_iprops={classes:{},dom_events:{},uid:U.__comp_guid++,inrender:!1},this.m_props.cls&&this.addClass(this.m_props.cls)}get uid(){return this.m_iprops.uid}setContent(e,t=!1){this.m_props.content=e??[],!(this.m_iprops.inrender||!this.m_dom)&&(t?this.update():this._updateContent())}getContent(){return this.m_props.content}appendChild(e){if(!e)return;let t=f(i=>{this.m_props.content?Jt(this.m_props.content)||(this.m_props.content=[this.m_props.content]):this.m_props.content=[],this.m_props.content.push(i),this.m_dom&&this._appendChild(i)},"append");Jt(e)?e.forEach(t):t(e)}setTag(e,t){this.m_props.tag=e,t&&(this.m_props.ns=t)}getData(e){if(this.m_props.data!==void 0)return this.m_props.data[e.toString()]}setData(e,t){let i=this.m_props.data;i===void 0&&(i=this.m_props.data={}),i[e.toString()]=t}get dom(){return this.m_dom}show(e){e===void 0||e===!0?this.removeClass("@hidden"):this.addClass("@hidden")}hide(){this.addClass("@hidden")}enable(e){e===void 0||e===!0?(this.removeClass("@disable"),this.removeAttribute("disabled")):this.disable()}disable(){this.addClass("@disable"),this.setAttribute("disabled","")}focus(){console.assert(!!this.m_dom),this.m_dom.focus()}setStyle(e){for(let t in e)this.setStyleValue(t,e[t])}setStyleValue(e,t){let i=this.m_props.style;i||(i=this.m_props.style={}),i[e]=t,this._setDomStyleValue(e,t)}_setDomStyleValue(e,t){this.m_dom&&(t===void 0?t=null:!Zp[e]&&(zn(t)||ib.test(t))&&(t=t+"px"),this.m_dom.style[e]=t)}getComputedStyle(e){return this.dom?new Mu(getComputedStyle(this.dom,e??null)):new Mu(this.m_props.style)}getStyleValue(e){return this.getComputedStyle()[e]}setAttributes(e){for(let t in e)this.setAttribute(t,e[t])}setAttribute(e,t){if(t===!1||t===void 0)this.removeAttribute(e);else{t===!0?t="":zn(t)&&(t=""+t);let i=this.m_props.attrs;i||(i=this.m_props.attrs={}),i[e]=t,this._setDomAttribute(e,t)}}_setDomAttribute(e,t){this.m_dom&&this.m_dom.setAttribute(e,t)}removeAttribute(e){let t=this.m_props.attrs;t&&(delete t[e],this.m_dom&&this.m_dom.removeAttribute(e))}getAttribute(e){return this.m_dom?this.m_dom.getAttribute(e):this.m_props.attrs?this.m_props.attrs[e]:void 0}hasAttribute(e){return this.m_dom?this.m_dom.hasAttribute(e):this.m_props.attrs.hasOwnProperty(e)}addClass(e){if(e==null||(e=e.trim(),e===""))return;let t=f(s=>{s==null||s===""||(s=this._makeCls(s),i[s]=!0,this.m_dom&&this.m_dom.classList.add(s))},"add"),i=this.m_iprops.classes;e.indexOf(" ")<0?t(e):e.split(" ").forEach(r=>t(r))}removeClass(e){if(e===void 0)return;let t=f(i=>{i==null||i===""||(i=this._makeCls(i),delete this.m_iprops.classes[i],this.m_dom&&this.m_dom.classList.remove(i))},"remove");if(e.indexOf(" ")<0)t(e);else{let i=e.trim().split(" ");for(let s of i)s!=null&&s!==""&&t(s)}}setClass(e,t){return t?this.addClass(e):this.removeClass(e),this}toggleClass(e){let t=f(i=>{i===void 0&&i===null&&i===""||(i=this._makeCls(i),this.m_iprops.classes[i]?delete this.m_iprops.classes[i]:this.m_iprops.classes[i]=!0,this.m_dom&&this.m_dom.classList.toggle(i))},"toggle");if(e.indexOf(" ")<0)t(e);else{let i=e.trim().split(" ");for(let s of i)t(s)}}hasClass(e){let t=this._makeCls(e);return this.m_dom?this.dom.classList.contains(t):!!this.m_iprops.classes[t]}clearClasses(){if(this.m_iprops.classes={},this.m_dom)return this.m_dom.classList.value=""}_build(){return this.m_dom?this.m_dom:(this._createDOM(),this.m_dom)}render(e){}_createDOM(){if(this.m_dom)return this.m_dom;let e=this.m_props;if(e.tabIndex!==void 0&&this._setTabIndex(e.tabIndex),this.render(e),e.left!==void 0&&this.setStyleValue("left",e.left),e.top!==void 0&&this.setStyleValue("top",e.top),e.width!==void 0&&this.setStyleValue("width",e.width),e.height!==void 0&&this.setStyleValue("height",e.height),e.flex!==void 0&&(this.addClass("@flex"),e.flex!=1&&this.setStyleValue("flex",e.flex)),e.enabled===!1&&this.disable(),e.tooltip!==void 0&&this.setAttribute("tip",e.tooltip.replace(/\n/gi,"<br/>")),e.dom_events)for(let l in e.dom_events)this._setDomEvent(l,e.dom_events[l]);this._genClassName(),this.m_props.cls=void 0;let t=this.m_iprops;e.ns?this.m_dom=H.createElementNS(e.ns,e.tag??"div"):this.m_dom=H.createElement(e.tag??"div"),this.m_dom[Li]=this,this.m_dom.classList.add(...Object.keys(t.classes));let i=e.style;if(i)for(let l in i)this._setDomStyleValue(l,i[l]);let s=e.attrs;if(s)for(let l in s){let o=s[l];o!==!1&&o!==void 0&&this._setDomAttribute(l,s[l])}this.m_props.id&&this._setDomAttribute("id",this.m_props.id);let r=this.m_iprops.dom_events;if(r)for(let l in r){let o=r[l];for(let a of o)this.createEvent(l,a)}let n=e.content;return n&&(Jt(n)||(n=[n]),n.forEach(l=>{l&&(Fe(l)?this.m_dom.insertAdjacentText("beforeend",l):Qi(l)?this.m_dom.insertAdjacentHTML("beforeend",l):l instanceof U?this.m_dom.append(l._build()):console.log("unknown element type: ",l))})),U.__createObserver||(U.__createObserver=new MutationObserver(U._observeCreation),U.__createObserver.observe(H.body,{childList:!0,subtree:!0})),this.m_dom}_setTabIndex(e,t=0){e===!0?e=0:e===void 0&&(e=t),e!==!1&&e!==void 0&&this.setAttribute("tabindex",e),this.m_props.tabIndex=e}static _observeCreation(e){let t=f(i=>{i.m_iprops.created||(i.dom&&i.m_iprops.dom_events&&i.m_iprops.dom_events.create&&i.dom.dispatchEvent(new Event("create")),i.componentCreated(),i.m_iprops.created=!0)},"notify");for(let i of e)if(i.type=="childList")for(let s=0,r=i.addedNodes.length;s<r;s++){let l=i.addedNodes[s][Li];l&&(l.enumChilds(o=>{t(o)},!0),t(l))}}dispose(){this.m_dom&&this._dispose(!0,!0)}_dispose(e,t){let i=this.m_dom;delete i[Li],delete i[Sr],e&&i.remove(),this.enumChilds(s=>{s._dispose(!1,!0)}),this.m_dom=null,t&&this.disposeTimers(),this.componentDisposed(),this.m_iprops.created=!1}componentDisposed(){}componentCreated(){}update(e=0){if(this.m_dom){let t=f(()=>{let i=this.m_dom;this._dispose(!1,!1);let s=this._build();console.assert(!!i.parentNode,"update in componentCreated is not allowed, use updateContent"),i.parentNode.replaceChild(s,i)},"_update");e?this.singleShot(t,e):t()}}_empty(){let e=this.m_dom;if(e)for(;e.firstChild;)e.removeChild(e.firstChild)}_updateContent(){if(!this.m_dom)return;this._empty();let e=this.m_props.content;e&&(Jt(e)||(e=[e]),e.forEach(t=>{t&&(Qi(t)?this.m_dom.insertAdjacentHTML("beforeend",t):t instanceof U?this.m_dom.append(t._build()):this.m_dom.insertAdjacentText("beforeend",t+""))}))}getBoundingRect(e=!1){console.assert(this.dom!=null,"cannot get bounding rect of an non DOM element");let t=this.dom.getBoundingClientRect(),i=new Wi(t.left,t.top,t.width,t.height);if(e){let s=this.getComputedStyle(),r=s.parse("marginTop"),n=s.parse("marginBottom"),l=s.parse("marginLeft"),o=s.parse("marginRight");i.left-=l,i.width+=l+o,i.top-=r,i.height+=r+n}return i}setDomEvent(e,t){let i=t;this._setDomEvent(e,i)}_setDomEvent(e,t){this.m_iprops.dom_events||(this.m_iprops.dom_events={});let i=this.m_iprops.dom_events[e];i?i.push(t):i=this.m_iprops.dom_events[e]=[t],this.m_dom&&this.createEvent(e,t)}clearDomEvent(e){if(!this.m_iprops.dom_events)return;delete this.m_iprops.dom_events[e];let t=this.m_dom;if(t){let i=t[Sr];i&&delete i[e]}}createEvent(e,t){let i=this.m_dom,s=i[Sr];s||(s=i[Sr]={}),s[e]?s[e].push(t):s[e]=[t],Bf[e]===1?i["on"+e]=U._dispatchUnbubbleEvent:U.__privateEvents[e]||(U.__privateEvents[e]=!0,tb[e]?H.addEventListener(e,U._dispatchEvent,{passive:!1,capture:!0}):H.addEventListener(e,U._dispatchEvent,!0)),e==="sizechange"&&(U.__sizeObserver||(U.__sizeObserver=new ResizeObserver(U._observeSize)),U.__sizeObserver.observe(this.m_dom))}static _dispatchEvent(e){let t=e.target,i=Bf[e.type]===2;for(;t;){if(t[Sr]){let s=t[Sr][e.type];if(s){let r=t[Li],n=r?.root??null;if(s instanceof Array?s.some(l=>{if(l(e,n),!r.dom)return!0}):s(e,n),e.cancelBubble||e.defaultPrevented||i)break}}if(t=t.parentNode,t==document)break}}static _dispatchUnbubbleEvent(e){let t=e.currentTarget||e.target,i=e.type,s=t[Sr],r=s&&s[i];if(r){let l=t[Li]?.root??null;r instanceof Array?r.forEach(o=>{o(e,l)}):r(e,l)}}static _observeSize(e){e.forEach(t=>{let i=t.target;i.offsetParent!==null&&i.dispatchEvent(new Event("sizechange"))})}enumChilds(e,t=!1){if(this.m_dom){let i=this.m_dom.firstChild;for(;i;){let s=i[Li];if(s&&(e(s),t&&s.enumChilds(e,!0)===!0))return!0;i=i.nextSibling}}else{let i=this.m_props.content;if(!i)return;Jt(i)||(i=[i]),i.some(s=>{if(!(!s||Fe(s)||Qi(s))&&(e(s)||t&&s.enumChilds(e,!0)===!0))return!0})}return!1}_appendChild(e){if(Fe(e))this.m_dom.insertAdjacentText("beforeend",e);else if(Qi(e))this.m_dom.insertAdjacentHTML("beforeend",e);else{let t=e;try{t._build(),this.m_dom.appendChild(t.m_dom)}catch(i){console.error(i)}}}_genClassName(){this.addClass("@comp");let e=Object.getPrototypeOf(this);for(;e&&e.constructor!==U;){let t=e.constructor.name;this.addClass("@"+jr(t)),e=Object.getPrototypeOf(e)}}_makeCls(e){return e[0]=="@"?e=eb+e.substring(1):e}static dispatchCaptures(e){U.__capture.handler(e)}static setCapture(e,t){if(console.assert(!U.__capture),U.__capture)debugger;let i=H.querySelectorAll("iframe");i.forEach(l=>{Qt(l).setStyleValue("pointer-events","none")});let s=H.querySelectorAll(":hover"),r=null;if(s.length){let l=s[s.length-1];r=window.getComputedStyle(l).cursor}U.__capture_mask=H.createElement("div");let n=Qt(U.__capture_mask);n.addClass("@capture-mask"),r&&n.setStyleValue("cursor",r),H.body.appendChild(n.dom),H.addEventListener("mousedown",U.dispatchCaptures),H.addEventListener("mousemove",U.dispatchCaptures),H.addEventListener("mouseup",U.dispatchCaptures),H.addEventListener("touchstart",U.dispatchCaptures),H.addEventListener("touchmove",U.dispatchCaptures),H.addEventListener("touchend",U.dispatchCaptures),U.__capture={initiator:e,handler:t,iframes:i}}static releaseCapture(){console.assert(!!U.__capture),H.removeEventListener("touchstart",U.dispatchCaptures),H.removeEventListener("touchmove",U.dispatchCaptures),H.removeEventListener("touchend",U.dispatchCaptures),H.removeEventListener("mousedown",U.dispatchCaptures),H.removeEventListener("mousemove",U.dispatchCaptures),H.removeEventListener("mouseup",U.dispatchCaptures),U.__capture.iframes.forEach(e=>{Qt(e).setStyleValue("pointer-events",null)}),U.__capture=null,U.__capture_mask&&(H.body.removeChild(U.__capture_mask),U.__capture_mask=null)}scrollIntoView(e){if(this.m_dom){let t=new Wi(this.dom.getBoundingClientRect()),i,s,r,n,l=this.dom.parentElement,o=H.body;for(;l&&l!=o;){let a=l.getBoundingClientRect();(i===void 0||i<a.top)&&(i=a.top),(s===void 0||s>a.bottom)&&(s=a.bottom),(r===void 0||r<a.left)&&(r=a.left),(n===void 0||n>a.right)&&(n=a.right),l=l.parentElement}(i===void 0||t.top<i||t.bottom>s||t.left<r||t.right>n)&&this.m_dom.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"})}}queryItem(e){let t=this.dom.querySelector(e);return t?U.getElement(t):null}queryAll(e,t){let i=Array.from(this.m_dom.querySelectorAll(e));return t&&i.forEach(s=>{t(Qt(s))}),i}itemWithId(e){let t=this.dom.querySelector("#"+e);return t?U.getElement(t):null}itemWithRef(e){let t=null;return this.enumChilds(i=>{if(i.m_props.ref===e)return t=i,!0},!0),t}get ref(){return this.m_props.ref}static getCss(){return U.__css||(U.__css=new Nr),U.__css}getParent(){console.assert(!!this.m_dom);let e=this.dom.parentNode;return U.getElement(e)}static getElement(e,t){if(t){let i=Fe(t);for(;e;){let s=e[Li];if(i){if(s&&s.hasClass(t))return s}else if(s instanceof t)return s;e=e.parentElement}return null}else return e?e[Li]:null}static getScrollbarSize(){if(U.__sb_width===void 0){let e=H.createElement("div");e.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px";let t=H.createElement("div");t.style.width="200px",t.style.height="200px",e.appendChild(t),H.body.appendChild(e),U.__sb_width=e.offsetWidth-e.clientWidth,H.body.removeChild(e)}return U.__sb_width}isUserVisible(){return this.m_dom?this.m_dom.offsetParent!==null:!1}},"_Component"),T=U;f(T,"Component");fe(T,"__sb_width");fe(T,"__comp_guid",1e3);fe(T,"__privateEvents",{});fe(T,"__sizeObserver");fe(T,"__createObserver");fe(T,"__capture",null);fe(T,"__capture_mask",null);fe(T,"__css",null);var Hf=null;function Qt(e){if(e[Li])return e[Li];let t=Hf;return t||(t=Hf=new T({})),t.m_dom=e,t}h(Qt,"flyWrap22");m(Qt,"flyWrap2");d(Qt,"flyWrap");f(Qt,"flyWrap");var dh=d(class extends T{constructor(e={}){e.flex||(e.flex=1),super(e)}},"Flex");f(dh,"Flex");var sb=d(class extends T{m_size;constructor(e){super({}),this.m_size=e}componentCreated(){let e=this.dom,t=null;for(;e;){let i=e[Li];if(i.hasClass("@hlayout")){t={width:this.m_size};break}else if(i.hasClass("@vlayout")){t={height:this.m_size};break}e=e.parentElement}t||(t={width:this.m_size,height:this.m_size}),this.setStyle(t)}},"Space");f(sb,"Space");function vt(e,t=null,i=null){return Ie({size:e,mode:t,context:i})}h(vt,"EvSize22");m(vt,"EvSize2");d(vt,"EvSize");f(vt,"EvSize");var Jp=d(class extends T{m_irect;m_delta;m_target;constructor(e){super(e),this.setDomEvent("mousedown",t=>this._mousedown(t)),this.setDomEvent("touchstart",t=>this._mousedown(t)),this.setDomEvent("dblclick",t=>this._collapse(t))}render(){this.addClass(this.m_props.orientation)}_collapse(e){this.m_props.collapsible&&(this._findTarget(),this.m_target&&this.m_target.toggleClass("@collapsed"))}_mousedown(e){if(e.type=="touchstart"){let t=e;t.touches.length==1&&this._startMoving(t.touches[0].pageX,t.touches[0].pageY,e)}else{let t=e;this._startMoving(t.pageX,t.pageY,e)}}_startMoving(e,t,i){this._findTarget(),this.m_target&&(this.m_props.orientation=="horizontal"?this.m_props.sizing=="before"?this.m_delta=e-this.m_irect.right:this.m_delta=e-this.m_irect.left:this.m_props.sizing=="before"?this.m_delta=t-this.m_irect.bottom:this.m_delta=t-this.m_irect.top,i.preventDefault(),i.stopPropagation(),this.m_target.addClass("sizing"),T.setCapture(this,s=>this._pointerMoved(s)))}_pointerMoved(e){let t=f((i,s)=>{if(this.m_props.orientation=="horizontal"){let r;if(this.m_props.sizing=="after"?r=this.m_irect.right-(i-this.m_delta):r=i-this.m_delta-this.m_irect.left,r>0){let n=new Pn(r,0);this.emit("resize",vt(n)),this.m_target.setStyleValue("width",n.width),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}else{let r;if(this.m_props.sizing=="after"?r=this.m_irect.bottom-(s-this.m_delta):r=s-this.m_delta-this.m_irect.top,r>0){let n=new Pn(0,r);this.emit("resize",vt(n)),this.m_target.setStyleValue("height",n.height),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}},"__move");if(e.type=="mousemove"){let i=e;t(i.pageX,i.pageY),e.preventDefault(),e.stopPropagation()}else if(e.type=="touchmove"){let i=e;t(i.touches[0].pageX,i.touches[0].pageY),e.preventDefault(),e.stopPropagation()}else(e.type=="mouseup"||e.type=="touchend")&&(this.m_target.removeClass("sizing"),T.releaseCapture(),e.preventDefault(),e.stopPropagation())}_findTarget(){if(!this.m_target)if(this.m_props.sizing=="before"){let e=this.dom.previousElementSibling,t=e?T.getElement(e):null;this.m_target=t}else{let e=this.dom.nextElementSibling,t=e?T.getElement(e):null;this.m_target=t}this.m_target?this.m_irect=this.m_target.getBoundingRect():this.m_irect=null}},"Separator");f(Jp,"Separator");function Zh(e,t,i=null){return Ie({ui_event:e,sens:t,context:i})}h(Zh,"EvOverlayResize22");m(Zh,"EvOverlayResize2");d(Zh,"EvOverlayResize");f(Zh,"EvOverlayResize");var Jh=d(class extends T{m_delta;m_irect;constructor(e){super(e),this.addClass(e.sens),this.setDomEvent("mousedown",t=>this._mousedown(t)),this.setDomEvent("touchstart",t=>this._mousedown(t)),this.setDomEvent("dblclick",t=>this.resetflex(t)),e.target.appendChild(this),e.resize&&this.on("resize",this.m_props.resize)}resetflex(e){this.m_props.target.addClass("@flex"),this.emit("resize",vt({width:-1,height:0})),e.preventDefault(),e.stopPropagation()}_mousedown(e){e.preventDefault(),e.stopPropagation();let t=Zh(e,this.m_props.sens);if(this.emit("rawresize",t),t.defaultPrevented)return;let i=Ji(e,!0);this.m_irect=this.m_props.target.getBoundingRect(),this.m_props.sens=="right"?this.m_delta=i.x-this.m_irect.right:this.m_props.sens=="left"?this.m_delta=i.x-this.m_irect.left:this.m_props.sens=="bottom"?this.m_delta=i.y-this.m_irect.bottom:this.m_props.sens=="top"&&(this.m_delta=i.y-this.m_irect.top),this.m_props.target.addClass("sizing"),T.setCapture(this,s=>this._handle_mouse(s))}_is_horz(){return this.m_props.sens=="left"||this.m_props.sens=="right"}get sens(){return this.m_props.sens}_handle_mouse(e){let t=f((i,s)=>{if(this._is_horz()){let r;if(this.m_props.sens=="left"?r=this.m_irect.right-(i-this.m_delta):r=i-this.m_delta-this.m_irect.left,r>0){let n={width:r,height:void 0};this.emit("resize",vt(n)),this.m_props.target.setStyleValue("width",n.width),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}else{let r;if(this.m_props.sens=="top"?r=this.m_irect.bottom-(s-this.m_delta):r=s-this.m_delta-this.m_irect.top,r>0){let n=new Pn(0,r);this.emit("resize",vt(n)),this.m_props.target.setStyleValue("height",n.height),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}},"__move");if(e.type=="mousemove"){let i=e;t(i.pageX,i.pageY),e.preventDefault(),e.stopPropagation()}else if(e.type=="touchmove"){let i=e;t(i.touches[0].pageX,i.touches[0].pageY),e.preventDefault(),e.stopPropagation()}else(e.type=="mouseup"||e.type=="touchend")&&(this.m_props.target.removeClass("sizing"),T.releaseCapture(),e.preventDefault(),e.stopPropagation())}},"SizerOverlay");f(Jh,"SizerOverlay");function Qh(e){return Ie({name:e})}h(Qh,"EvShortcut22");m(Qh,"EvShortcut2");d(Qh,"EvShortcut");f(Qh,"EvShortcut");var Rt=d(class extends T{m_shortcuts;constructor(e){Jt(e)?super({content:e}):super(e)}addShortcut(e,t,i=null,s=!1){this.m_shortcuts||(this.m_shortcuts=[],this.setDomEvent("keydown",r=>this._handleKeydown(r))),Jt(e)||(e=[e]),e.forEach(r=>{let n="";r.match(/SHIFT/i)&&(r=r.replace(/SHIFT/i,""),n+="shift+"),r.match(/CTRL/i)&&(r=r.replace(/CTRL/i,""),n+="ctrl+"),r.match(/CMD/i)&&(r=r.replace(/CMD/i,""),n+="cmd+"),r.match(/ALT/i)&&(r=r.replace(/ALT/i,""),n+="alt+"),n+=r.replace("+","").toLowerCase(),this.m_shortcuts.push({sequence:n,name:t,immediate:s,callback:i})})}removeShortcuts(){this.m_shortcuts&&(this.m_shortcuts=[])}_handleKeydown(e){if(!this.m_shortcuts)return;let t="";e.shiftKey&&(t+="shift+"),e.ctrlKey&&(t+="ctrl+"),e.metaKey&&(t+="cmd+"),e.altKey&&(t+="alt+"),t+=e.key.toLowerCase(),this.m_shortcuts.some(i=>{if(i.sequence==t)return i.callback?i.immediate?i.callback(e):Us(()=>{i.callback(e)}):this.emit("shortcut",Qh(i.name)),e.preventDefault(),e.stopPropagation(),!0})}},"Container");f(Rt,"Container");var Qp=d(class{m_data;m_name;constructor(e){this.m_data=null,this.m_name=e??"settings"}set(e,t){this._load(),this.m_data[e]=t,this._save()}get(e,t){return this._load(),this.m_data[e]??t}_save(){let e=JSON.stringify(this.m_data);localStorage.setItem(this.m_name,e)}_load(){if(this.m_data)return;this.m_data={};let e=localStorage.getItem(this.m_name);e!==null&&(e=JSON.parse(e),e?this.m_data=e:console.info("There was an error attempting to read your settings."))}},"Settings");f(Qp,"Settings");var eg=Object.defineProperty,rb=f((e,t,i)=>t in e?eg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,"__defNormalProp"),b=f((e,t)=>eg(e,"name",{value:t,configurable:!0}),"__name"),pe=f((e,t,i)=>(rb(e,typeof t!="symbol"?t+"":t,i),i),"__publicField"),O=document,tg=b(function(){this.propagationStopped=!0},"stopPropagation"),ig=b(function(){this.defaultPrevented=!0},"preventDefault");function ke(e){return{stopPropagation:tg,preventDefault:ig,...e}}h(ke,"BasicEvent222");m(ke,"BasicEvent22");d(ke,"BasicEvent2");f(ke,"BasicEvent");b(ke,"BasicEvent");function ns(e=null){return ke({context:e})}h(ns,"EvClick222");m(ns,"EvClick22");d(ns,"EvClick2");f(ns,"EvClick");b(ns,"EvClick");function Oe(e,t=null){return ke({value:e,context:t})}h(Oe,"EvChange222");m(Oe,"EvChange22");d(Oe,"EvChange2");f(Oe,"EvChange");b(Oe,"EvChange");function ui(e,t=null){return ke({selection:e,context:t})}h(ui,"EvSelectionChange222");m(ui,"EvSelectionChange22");d(ui,"EvSelectionChange2");f(ui,"EvSelectionChange");b(ui,"EvSelectionChange");function xs(e,t=null){return ke({uievent:e,context:t})}h(xs,"EvContextMenu222");m(xs,"EvContextMenu22");d(xs,"EvContextMenu2");f(xs,"EvContextMenu");b(xs,"EvContextMenu");function Io(e,t=0,i=null){return ke({timer:e,time:t,context:i})}h(Io,"EvTimer222");m(Io,"EvTimer22");d(Io,"EvTimer2");f(Io,"EvTimer");b(Io,"EvTimer");function em(e,t,i){return ke({msg:e,params:t,source:i})}h(em,"EvMessage222");m(em,"EvMessage22");d(em,"EvMessage2");f(em,"EvMessage");b(em,"EvMessage");function Ao(e,t,i){return ke({element:e,data:t,context:i})}h(Ao,"EvDrag222");m(Ao,"EvDrag22");d(Ao,"EvDrag2");f(Ao,"EvDrag");b(Ao,"EvDrag");function Mo(e,t){return ke({code:e,message:t})}h(Mo,"EvError222");m(Mo,"EvError22");d(Mo,"EvError2");f(Mo,"EvError");b(Mo,"EvError");var Po=f(class{m_source;m_eventRegistry;m_defaultHandlers;constructor(e=null){this.m_source=e??this}emit(e,t){this._emit(e,t)}_emit(e,t){let i=this.m_eventRegistry?.get(e),s=this.m_defaultHandlers?.get(e);if(t||(t={}),t.source||(t.source=this.m_source),t.type||(t.type=e),i&&i.length)if(t.preventDefault||(t.preventDefault=ig),t.stopPropagation||(t.stopPropagation=tg),i.length==1)i[0](t);else{let r=i.slice();for(let n=0,l=r.length;n<l&&(r[n](t),!t.propagationStopped);n++);}if(s&&s.length&&!t.defaultPrevented)return s[0](t)}signal(e,t,i=-1){this._signal(e,t,i)}_signal(e,t,i=-1){if(!this.m_eventRegistry)return;let s=this.m_eventRegistry.get(e);if(!(!s||!s.length))if(t||(t={}),t.type||(t.type=e),t.source||(t.source=this.m_source),t.preventDefault=t.stopPropagation=()=>{console.error("this event cannot be stopped not default prevented")},s.length==1&&i==-1)s[0](t);else{let r=s.slice(),n=b(()=>{for(let l=0,o=r.length;l<o;l++)r[l](t)},"call");i==-1?n():setTimeout(n,i)}}once(e,t){this._once(e,t)}_once(e,t){let i=b(s=>{this._off(e,i),t(s)},"newCallback");if(this._on(e,i),!t)return new Promise(function(s){t=s})}setDefaultHandler(e,t){let i=this.m_defaultHandlers;i||(i=this.m_defaultHandlers=new Map);let s=i.get(e);if(s){let r=s.indexOf(t);r!=-1&&s.splice(r,1),s.unshift(t)}else i.set(e,[t])}removeDefaultHandler(e,t){let i=this.m_defaultHandlers;if(!i)return;let s=i.get(e);if(s){let r=s.indexOf(t);r!=-1&&s.splice(r,1)}}listen(e){for(let t in e)this._on(t,e[t])}defaults(e){for(let t in e)this.setDefaultHandler(t,e[t])}on(e,t){return this._on(e,t)}_on(e,t,i=!1){this.m_eventRegistry||(this.m_eventRegistry=new Map);let s=this.m_eventRegistry.get(e);return s||(s=[],this.m_eventRegistry.set(e,s)),s.indexOf(t)==-1&&(i?s.unshift(t):s.push(t)),{dispose:()=>{this._off(e,t)}}}off(e,t){return this._off(e,t)}_off(e,t){if(!this.m_eventRegistry)return;let i=this.m_eventRegistry.get(e);if(!i)return;let s=i.indexOf(t);s!==-1&&i.splice(s,1)}removeAllListeners(e){e?(this.m_eventRegistry&&(this.m_eventRegistry[e]=void 0),this.m_defaultHandlers&&(this.m_defaultHandlers[e]=void 0)):this.m_eventRegistry=this.m_defaultHandlers=void 0}},"EventSource");b(Po,"EventSource");var sl=f(class extends Po{m_props;#e;constructor(e){super(),this.m_props=e,e.events&&this.listen(e.events)}startTimer(e,t,i=!0,s=null){this.#e?this.stopTimer(e):this.#e=new Map;let r=(i?setInterval:setTimeout)(n=>{s?s(e,n):this.emit("timer",Io(e,n))},t);this.#e.set(e,()=>{(i?clearInterval:clearTimeout)(r)})}stopTimer(e){let t=this.#e.get(e);t&&t()}disposeTimers(){this.#e?.forEach(e=>e()),this.#e=void 0}singleShot(e,t=0){setTimeout(e,t)}mapPropEvents(e,...t){t.forEach(i=>{let s=i;e[s]&&this._on(s,e[s])})}},"BaseComponent");b(sl,"BaseComponent");var sg=Symbol("i18n"),rl={};function nl(e,t){rl[e]={name:e,base:t,src_translations:{},translations:{}}}h(nl,"createLanguage222");m(nl,"createLanguage22");d(nl,"createLanguage2");f(nl,"createLanguage");b(nl,"createLanguage");function ll(e){return rl[e]!==void 0}h(ll,"isLanguage222");m(ll,"isLanguage22");d(ll,"isLanguage2");f(ll,"isLanguage");b(ll,"isLanguage");function ol(e,...t){if(!ll(e))return;let i=rl[e];t.forEach(s=>{al(i.src_translations,s,i.base)}),i.translations=hl(i.src_translations,i.base,!0)}h(ol,"addTranslation222");m(ol,"addTranslation22");d(ol,"addTranslation2");f(ol,"addTranslation");b(ol,"addTranslation");function al(e,t,i){for(let s in t)e[s]instanceof Object?al(e[s],t[s],i):(e[s]=t[s],e[s]=hl(e[s],i,!1));return e}h(al,"_patch222");m(al,"_patch22");d(al,"_patch2");f(al,"_patch");b(al,"_patch");var _h;function To(e){for(;e;){let t=rl[e],i=t.translations,s;for(let r of _h){if(s=i[r],s===void 0)break;i=s}if(s!==void 0)return i;e=t.base}console.error("I18N error: unable to find","_tr."+_h.join("."))}h(To,"_findBaseTrans222");m(To,"_findBaseTrans22");d(To,"_findBaseTrans2");f(To,"_findBaseTrans");b(To,"_findBaseTrans");function hl(e,t,i){return new Proxy(e,{get:(s,r)=>{i?_h=[r]:_h.push(r);let n=s[r];return n===void 0&&t&&(n=To(t),s[r]=n),n}})}h(hl,"_mk_proxy222");m(hl,"_mk_proxy22");d(hl,"_mk_proxy2");f(hl,"_mk_proxy");b(hl,"_mk_proxy");var ae={};function Fo(e){ll(e)&&(ae=rl[e].translations,ae[sg]=e)}h(Fo,"selectLanguage222");m(Fo,"selectLanguage22");d(Fo,"selectLanguage2");f(Fo,"selectLanguage");b(Fo,"selectLanguage");function tm(){return ae[sg]}h(tm,"getCurrentLanguage222");m(tm,"getCurrentLanguage22");d(tm,"getCurrentLanguage2");f(tm,"getCurrentLanguage");b(tm,"getCurrentLanguage");function im(){return Object.keys(rl)}h(im,"getAvailableLanguages222");m(im,"getAvailableLanguages22");d(im,"getAvailableLanguages2");f(im,"getAvailableLanguages");b(im,"getAvailableLanguages");var nb={global:{ok:"OK",cancel:"Annuler",ignore:"Ignorer",yes:"Oui",no:"Non",open:"Ouvrir",new:"Nouveau",delete:"Supprimer",close:"Fermer",save:"Enregistrer",search:"Rechercher",search_tip:"Saisissez le texte \xE0 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\xE9rique 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\xE9v","mar","avr","mai","jun","jui","ao\xFB","sep","oct","nov","d\xE9c"],month_long:["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"],property:"Propri\xE9t\xE9",value:"Valeur",err_403:"Vous n'avez pas les droits suffisants pour effectuer cette action",copy:"Copier",cut:"Couper",paste:"Coller"}},lb={global:{ok:"OK",cancel:"Cancel",ignore:"Ignore",yes:"Yes",no:"No",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"}};nl("fr",null);ol("fr",nb);nl("en","fr");ol("en",lb);Fo("fr");function ml(){return"ontouchstart"in window}h(ml,"isTouchDevice222");m(ml,"isTouchDevice22");d(ml,"isTouchDevice2");f(ml,"isTouchDevice");b(ml,"isTouchDevice");function ur(e,t){let i=Math.pow(10,t),s=Math.round(e*i)/i;return Object.is(s,-0)&&(s=0),s}h(ur,"roundTo222");m(ur,"roundTo22");d(ur,"roundTo2");f(ur,"roundTo");b(ur,"roundTo");function zo(e){return e=e.replace(/\s*/g,""),e=e.replace(",","."),e.length==0?0:parseFloat(e)}h(zo,"parseIntlFloat222");m(zo,"parseIntlFloat22");d(zo,"parseIntlFloat2");f(zo,"parseIntlFloat");b(zo,"parseIntlFloat");function ar(e){let t=e;return t=t.replace(/([a-z])([A-Z])/g,"$1 $2"),t=t.toLowerCase(),t=t.replace(/[^- a-z0-9]+/g," "),t.indexOf(" ")<0?t:(t=t.trim(),t.replace(/ /g,"-"))}h(ar,"pascalCase222");m(ar,"pascalCase22");d(ar,"pascalCase2");f(ar,"pascalCase");b(ar,"pascalCase");function sm(e){let t=e.toLowerCase();return t=t.replace(/[^a-zA-Z0-9]+(.)/g,(i,s)=>s.toUpperCase()),t}h(sm,"camelCase222");m(sm,"camelCase22");d(sm,"camelCase2");f(sm,"camelCase");b(sm,"camelCase");var Yi=f(class{x;y;constructor(e=0,t=0){this.x=e,this.y=t}},"Point");b(Yi,"Point");var Rn=f(class{width;height;constructor(e=0,t=0){this.width=e,this.height=t}},"Size");b(Rn,"Size");var ji=f(class{left;top;width;height;constructor(e,t,i,s){if(e===void 0)this.left=this.top=this.right=this.bottom=0;else if(e instanceof ji||e instanceof DOMRect){let r=e;this.left=r.left,this.top=r.top,this.width=r.width,this.height=r.height}else this.left=e,this.top=t,this.width=i,this.height=s}set(e,t,i,s){this.left=e,this.top=t,this.width=i,this.height=s}get bottom(){return this.top+this.height}set bottom(e){this.height=e-this.top}get right(){return this.left+this.width}set right(e){this.width=e-this.left}get topLeft(){return new Yi(this.left,this.top)}get bottomRight(){return new Yi(this.right,this.bottom)}get size(){return new Rn(this.width,this.height)}moveTo(e,t){return this.left=e,this.top=t,this}movedTo(e,t){return new ji(e,t,this.width,this.height)}moveBy(e,t){return this.left+=e,this.top+=t,this}movedBy(e,t){return new ji(this.left+e,this.top+t,this.width,this.height)}isEmpty(){return this.width==0&&this.height==0}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}normalized(){let e=new ji(this),t=e.width,i=e.height;return t<0&&(e.left+=t,e.width=-t),i<0&&(e.top+=i,e.height=-i),e}containsPt(e,t){return e>=this.left&&e<=this.right&&t>=this.top&&t<=this.bottom}contains(e){return e instanceof ji?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)}inflate(e,t){t===void 0&&(t=e),this.left-=e,this.top-=t,this.width+=e+e,this.height+=t+t}inflatedBy(e,t){return t===void 0&&(t=e),new ji(this.left-e,this.top-t,this.width+e+e,this.height+t+t)}combine(e){let t=Math.min(this.left,e.left),i=Math.min(this.top,e.top),s=Math.max(this.right,e.right),r=Math.max(this.bottom,e.bottom);this.left=t,this.top=i,this.right=s,this.bottom=r}},"Rect");b(ji,"Rect");function rr(e,...t){return e.replace(/{(\d+)}/g,function(i,s){return typeof t[s]<"u"?t[s]:i})}h(rr,"sprintf222");m(rr,"sprintf22");d(rr,"sprintf2");f(rr,"sprintf");b(rr,"sprintf");function Ur(e,t=!1){if(!e||e.length==0)return"";let i=e.replace(/[<>\&\"\']/g,function(s){return"&#"+s.charCodeAt(0)+";"});return t&&(i=i.replace(/(\r\n|\n\r|\r|\n)/g,"<br/>")),i}h(Ur,"escapeHtml222");m(Ur,"escapeHtml22");d(Ur,"escapeHtml2");f(Ur,"escapeHtml");b(Ur,"escapeHtml");function rm(e,t=!1){if(e==null||!Me(e)||e.length==0)return"";let i="";for(let s=0;s<e.length;s++){let r=e.codePointAt(s);r>127?i+="&#"+r+";":r==60?i+="<":i+=e.charAt(s)}return i}h(rm,"removeHtmlTags222");m(rm,"removeHtmlTags22");d(rm,"removeHtmlTags2");f(rm,"removeHtmlTags");b(rm,"removeHtmlTags");var ob="fr-FR";function nm(e){ob=e}h(nm,"_date_set_locale222");m(nm,"_date_set_locale22");d(nm,"_date_set_locale2");f(nm,"_date_set_locale");b(nm,"_date_set_locale");function lm(e,t){return it(e)}h(lm,"date_format222");m(lm,"date_format22");d(lm,"date_format2");f(lm,"date_format");b(lm,"date_format");function om(e,t,i){var s=(e.getTime()-t.getTime())/1e3;let r=s;if(r<60)return rr(ae.global.diff_date_seconds,Math.round(r));let n=Math.floor(r/60);if(n<60)return rr(ae.global.diff_date_minutes,Math.round(n));let l=Math.floor(n/60);return rr(ae.global.diff_date_hours,l,n%60)}h(om,"date_diff222");m(om,"date_diff22");d(om,"date_diff2");f(om,"date_diff");b(om,"date_diff");function am(e,t){return t?it(e,"Y-M-D H:I:S"):it(e,"Y-M-D")}h(am,"date_to_sql222");m(am,"date_to_sql22");d(am,"date_to_sql2");f(am,"date_to_sql");b(am,"date_to_sql");function hm(e){return new Date(e+" GMT")}h(hm,"date_sql_utc222");m(hm,"date_sql_utc22");d(hm,"date_sql_utc2");f(hm,"date_sql_utc");b(hm,"date_sql_utc");function hr(e){return e.getFullYear()<<16|e.getMonth()<<8|e.getDate()}h(hr,"date_hash222");m(hr,"date_hash22");d(hr,"date_hash2");f(hr,"date_hash");b(hr,"date_hash");Date.prototype.hash=function(){return hr(this)};function nr(e){return new Date(e.getTime())}h(nr,"date_clone222");m(nr,"date_clone22");d(nr,"date_clone2");f(nr,"date_clone");b(nr,"date_clone");function $r(e){let t=new Date(e.getFullYear(),0,1),i=(e.valueOf()-t.valueOf())/864e5;return Math.floor((i+t.getDay()+1)/7)}h($r,"date_calc_weeknum222");m($r,"date_calc_weeknum22");d($r,"date_calc_weeknum2");f($r,"date_calc_weeknum");b($r,"date_calc_weeknum");function Lr(e,t=ae.global.date_input_formats){let i=t.split("|");for(let s of i){let r="";for(let o of s)o=="d"||o=="D"?r+="(?<day>\\d{1,2})":o=="m"||o=="M"?r+="(?<month>\\d{1,2})":o=="y"||o=="Y"?r+="(?<year>\\d{1,4})":o=="h"||o=="H"?r+="(?<hour>\\d{1,2})":o=="i"||o=="I"?r+="(?<min>\\d{1,2})":o=="s"||o=="S"?r+="(?<sec>\\d{1,2})":o==" "?r+="\\s+":r+="\\s*\\"+o+"\\s*";let l=new RegExp("^"+r+"$","m").exec(e);if(l){let o=new Date,a=parseInt(l.groups.day??"1"),c=parseInt(l.groups.month??"1"),u=parseInt(l.groups.year??o.getFullYear()+""),_=parseInt(l.groups.hour??"0"),p=parseInt(l.groups.min??"0"),v=parseInt(l.groups.sec??"0");u>0&&u<100&&(u+=2e3);let g=new Date(u,c-1,a,_,p,v,0),x=g.getFullYear(),E=g.getMonth()+1,y=g.getDate();return x!=u||E!=c||y!=a?null:g}}return null}h(Lr,"parseIntlDate222");m(Lr,"parseIntlDate22");d(Lr,"parseIntlDate2");f(Lr,"parseIntlDate");b(Lr,"parseIntlDate");function it(e,t=ae.global.date_format){if(!e)return"";let i={year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),wday:e.getDay(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milli:e.getMilliseconds()},s="",r=0;for(let n of t){if(n=="{"){if(++r==1)continue}else if(n=="}"&&--r==0)continue;if(r){s+=n;continue}n=="d"?s+=i.day:n=="D"?s+=gi(i.day,-2):n=="j"?s+=ae.global.day_short[i.wday]:n=="J"?s+=ae.global.day_long[i.wday]:n=="w"?s+=$r(e):n=="W"?s+=gi($r(e),-2):n=="m"?s+=i.month:n=="M"?s+=gi(i.month,-2):n=="o"?s+=ae.global.month_short[i.month-1]:n=="O"?s+=ae.global.month_long[i.month-1]:n=="y"||n=="Y"?s+=gi(i.year,-4):n=="a"||n=="A"?s+=i.hours<12?"am":"pm":n=="h"?s+=i.hours:n=="H"?s+=gi(i.hours,-2):n=="i"?s+=i.minutes:n=="I"?s+=gi(i.minutes,-2):n=="s"?s+=i.seconds:n=="S"?s+=gi(i.seconds,-2):n=="l"?s+=i.milli:n=="L"?s+=gi(i.milli,-3):s+=n}return s}h(it,"formatIntlDate222");m(it,"formatIntlDate22");d(it,"formatIntlDate2");f(it,"formatIntlDate");b(it,"formatIntlDate");function mm(e,t){if(t===void 0&&(t=new Date),!e)return 0;let i=t.getFullYear()-e.getFullYear();return(t.getMonth()<e.getMonth()||t.getMonth()==e.getMonth()&&t.getDate()<e.getDate())&&i--,i}h(mm,"calcAge222");m(mm,"calcAge22");d(mm,"calcAge2");f(mm,"calcAge");b(mm,"calcAge");Date.prototype.isSameDay=function(e){return this.getDate()==e.getDate()&&this.getMonth()==e.getMonth()&&this.getFullYear()==e.getFullYear()};Date.prototype.hash=function(){return hr(this)};Date.prototype.clone=function(){return nr(this)};Date.prototype.weekNum=function(){return $r(this)};Date.prototype.format=function(e){return it(this,e)};Date.prototype.addDays=function(e){return this.setDate(this.getDate()+e),this};function Ro(e,t,i){let s=new Blob([e],{type:t}),r=window.URL.createObjectURL(s),n=O.createElement("a");n.style.display="none",n.href=r,n.download=i,O.body.appendChild(n),n.click(),window.URL.revokeObjectURL(r)}h(Ro,"downloadData222");m(Ro,"downloadData22");d(Ro,"downloadData2");f(Ro,"downloadData");b(Ro,"downloadData");function Me(e){return typeof e=="string"}h(Me,"isString222");m(Me,"isString22");d(Me,"isString2");f(Me,"isString");b(Me,"isString");function Wt(e){return e instanceof Array}h(Wt,"isArray222");m(Wt,"isArray22");d(Wt,"isArray2");f(Wt,"isArray");b(Wt,"isArray");function ei(e){return e instanceof Function}h(ei,"isFunction222");m(ei,"isFunction22");d(ei,"isFunction2");f(ei,"isFunction");b(ei,"isFunction");function Lo(e){return!!e&&e.constructor===Object}h(Lo,"isLiteralObject222");m(Lo,"isLiteralObject22");d(Lo,"isLiteralObject2");f(Lo,"isLiteralObject");b(Lo,"isLiteralObject");function gi(e,t,i="0"){let s;return Me(e)?s=e:s=""+e,t>0?s.padEnd(t,i):s.padStart(-t,i)}h(gi,"pad222");m(gi,"pad22");d(gi,"pad2");f(gi,"pad");b(gi,"pad");function qr(e){return typeof e=="number"&&isFinite(e)}h(qr,"isNumber222");m(qr,"isNumber22");d(qr,"isNumber2");f(qr,"isNumber");b(qr,"isNumber");function cm(e){let t=O.createElement("div");return t.style.position="absolute",t.style.fontFamily=e,t.style.fontSize="44px",t.style.opacity="0.001",t.innerText="X",O.body.appendChild(t),new Promise(i=>{let s=t.getBoundingClientRect(),r=setInterval(()=>{t.getBoundingClientRect().height!=s.height&&(clearInterval(r),O.body.removeChild(t),i())},0)})}h(cm,"waitFontLoading222");m(cm,"waitFontLoading22");d(cm,"waitFontLoading2");f(cm,"waitFontLoading");b(cm,"waitFontLoading");function Vo(e,t=0,...i){setTimeout(e,t,...i)}h(Vo,"deferCall222");m(Vo,"deferCall22");d(Vo,"deferCall2");f(Vo,"deferCall");b(Vo,"deferCall");function Cs(e){requestAnimationFrame(e)}h(Cs,"asap222");m(Cs,"asap22");d(Cs,"asap2");f(Cs,"asap");b(Cs,"asap");function um(e){if(!e)return"";let t=e.split(`
|
|
10
|
+
`),i="para",s="p",r=[];return t.forEach(n=>{let l=n.trim();if(i=="para"){if(l[0]=="-")l=l.substr(1),r.push("<ul>"),i="list",s="li";else if(l[0]==">")l=l.substr(1),r.push("<blockquote>"),i="quote",s="p";else if(l[0]=="#"){let c=0;do l=l.substr(1),c++;while(l[0]=="#"&&c<5);s="h"+c,i="title"}}else i=="list"?l[0]!="-"?(r.push("</ul>"),i="para",s="p"):l=l.substr(1):i=="quote"&&(l[0]!=">"?(r.push("</blockquote>"),i="para",s="p"):l=l.substr(1));let o=/\*\*([^*]+)\*\*/gi;l=Ur(l,!1),l=l.replace(o,(c,...u)=>"<b>"+c.substr(2,c.length-4)+"</b>");let a=/\*([^*]+)\*/gi;l=l.replace(a,(c,...u)=>"<i>"+c.substr(1,c.length-2)+"</i>"),l==""&&(l=" "),r.push(`<${s}>`+l+`</${s}>`),i=="title"&&(i="para",s="p")}),i=="list"?r.push("</ul>"):i=="quote"&&r.push("</blockquote>"),r.join("")}h(um,"markdownToHtml222");m(um,"markdownToHtml22");d(um,"markdownToHtml2");f(um,"markdownToHtml");b(um,"markdownToHtml");var rg=f(class extends Error{m_code;constructor(e,t){e instanceof Response?(super(e.statusText),this.m_code=e.status):(super(t),this.m_code=e)}get code(){return this.m_code}},"NetworkError");b(rg,"NetworkError");function xi(e,t){let i="offsetX",s="offsetY";if(t&&(i="clientX",s="clientY"),e.type=="mousemove"||e.type=="mousedown"||e.type=="mouseup"){let r=e;return new Yi(r[i],r[s])}else if(e.type=="pointermove"||e.type=="pointerdown"||e.type=="pointerup"){let r=e;return new Yi(r[i],r[s])}else if(e.type=="touchmove"||e.type=="touchstart"){let r=e;return new Yi(r.touches[0][i],r.touches[0][s])}else if(e.type=="contextmenu"){let r=e;return new Yi(r[i],r[s])}else return new Yi(0,0)}h(xi,"getMousePos222");m(xi,"getMousePos22");d(xi,"getMousePos2");f(xi,"getMousePos");b(xi,"getMousePos");function er(e,t,i){return Math.min(Math.max(e,t),i)}h(er,"clamp222");m(er,"clamp22");d(er,"clamp2");f(er,"clamp");b(er,"clamp");var Xi=f(class extends String{constructor(e){super(e)}static from(e){return new Xi(e)}},"HtmlString");b(Xi,"HtmlString");function cl(e,...t){return Xi.from(String.raw(e,...t))}h(cl,"html222");m(cl,"html22");d(cl,"html2");f(cl,"html");b(cl,"html");function Ci(e){return e instanceof Xi}h(Ci,"isHtmlString222");m(Ci,"isHtmlString22");d(Ci,"isHtmlString2");f(Ci,"isHtmlString");b(Ci,"isHtmlString");var ab=f(class{static copy(e){navigator.clipboard&&navigator.clipboard.writeText(JSON.stringify(e))}static paste(e){navigator.clipboard?navigator.clipboard.readText().then(t=>e(t)):console.error("no clipboard, are you in https ?")}},"Clipboard");b(ab,"Clipboard");function dm(e){let t=-1,i=Buffer.from(e),s=0,r=i.length;for(;s<r;)t=t>>>8^hb[(t^i[s])&255],s++;return(t^-1)>>>0}h(dm,"crc32222");m(dm,"crc3222");d(dm,"crc322");f(dm,"crc32");b(dm,"crc32");var hb=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]),mb=f(class{superclass;constructor(e){this.superclass=e}with(...e){return e.reduce((t,i)=>i(t),this.superclass)}},"MixinBuilder");b(mb,"MixinBuilder");function Ln(...e){let t="";for(let i of e)if(typeof i=="string")t+=" "+i;else if(i)for(let s in i)i[s]&&(t+=" "+s);return t}h(Ln,"classNames222");m(Ln,"classNames22");d(Ln,"classNames2");f(Ln,"classNames");b(Ln,"classNames");function _m(e,t){(!e||e==null)&&(e=8),t||(t=[{chars:"abcdefghijklmnopqrstuvwxyz",min:3},{chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",min:2},{chars:"0123456789",min:2},{chars:"!@#$*|%+-_.;",min:2}]);let i="",s=0;t.forEach(function(n){i+=n.chars,s+=n.min}),e<s&&(e=s),t.push({chars:i,min:e-s});let r="";return t.forEach(function(n){n.min>0&&(r+=Vn(n.chars,n.min))}),Vn(r)}h(_m,"generatePassword222");m(_m,"generatePassword22");d(_m,"generatePassword2");f(_m,"generatePassword");b(_m,"generatePassword");function Vn(e,t){let i=e.split("").sort(()=>.5-Math.random()).join("");return t>0&&(i=i.substr(0,t)),i}h(Vn,"shuffle222");m(Vn,"shuffle22");d(Vn,"shuffle2");f(Vn,"shuffle");b(Vn,"shuffle");function fm(e="127.0.0.1",t="9876",i){let s;function r(){document.body.style.visibility="hidden";let a=[].slice.call(document.getElementsByTagName("link")),c=document.getElementsByTagName("head")[0];for(let u=0;u<a.length;++u){let _=a[u];c.removeChild(_);let p=_.rel;if(_.href&&typeof p!="string"||p.length==0||p.toLowerCase()=="stylesheet"){let v=_.href.replace(/(&|\?)_cacheOverride=\d+/,"");_.href=v+(v.indexOf("?")>=0?"&":"?")+"_cacheOverride="+new Date().valueOf()}c.appendChild(_)}s&&clearTimeout(s),s=setTimeout(()=>{document.body.style.visibility="unset"},50)}h(r,"refreshCSS"),m(r,"refreshCSS"),d(r,"refreshCSS"),f(r,"refreshCSS"),b(r,"refreshCSS");let l=`${window.location.protocol==="https:"?"wss://":"ws://"}${e}:${t}/ws`,o=new WebSocket(l);o.onmessage=function(a){a.data=="reload"?i?i():window.location.reload():a.data=="refreshcss"&&r()},console.log("Live reload enabled.")}h(fm,"installHMR222");m(fm,"installHMR22");d(fm,"installHMR2");f(fm,"installHMR");b(fm,"installHMR");var Ua=f(class{m_sheet;m_rules=new Map;constructor(){function e(t){for(let i=0;i<O.styleSheets.length;i++){let s=O.styleSheets[i];if(s.title===t)return s}}if(h(e,"getStyleSheet"),m(e,"getStyleSheet"),d(e,"getStyleSheet"),f(e,"getStyleSheet"),b(e,"getStyleSheet"),this.m_sheet=e("@dynamic-css"),!this.m_sheet){let t=O.createElement("style");t.setAttribute("id","@dynamic-css"),O.head.appendChild(t),this.m_sheet=t.sheet}}setRule(e,t){if(Me(t)){let i=this.m_rules.get(e);i!==void 0?this.m_sheet.deleteRule(i):i=this.m_sheet.cssRules.length,this.m_rules.set(e,this.m_sheet.insertRule(t,i))}else{let i=1;for(let s in t){let r=s+" { ",n=t[s];for(let l in n){let o=n[l];for(let a=0;a<o.length;a++)r+=l+": "+o[a]+"; "}r+="}",this.setRule(e+"--"+i,r),i++}}}static getVar(e){return Ua.doc_style||(Ua.doc_style=getComputedStyle(O.documentElement)),e[0]!="-"&&(e="--"+e),Ua.doc_style.getPropertyValue(e)}},"_Stylesheet"),Kr=Ua;b(Kr,"Stylesheet");pe(Kr,"guid",1);pe(Kr,"doc_style");var ng=f(class{result={};parse(e){return this.result={},this.parse_json("",e),ng.mk_string(this.result)}static mk_string(e){let t="";for(let i in e){let s=e[i];t+=i+" { ";for(let r in s){let n=s[r];for(let l=0;l<n.length;l++)t+=r+": "+n[l]+"; "}t+=`}
|
|
11
|
+
`}return t}parse_json(e,t){e&&!this.result[e]&&(this.result[e]={});for(let i in t){let s=t[i];if(Wt(s)){let r=s;for(let n=0;n<r.length;n++)this.addProperty(e,i,r[n])}else switch(typeof s){case"number":{this.addProperty(e,i,s);break}case"string":{this.addProperty(e,i,s);break}case"object":{this.parse_json(this.makeSelectorName(e,i),s);break}default:{console.error("ignoring unknown type "+typeof s+" in property "+i);break}}}}makePropertyName(e){return ar(e)}makeSelectorName(e,t){let i=[],s=t.split(/\s*,\s*/),r=e.split(/\s*,\s*/);for(let n=0;n<r.length;n++){let l=r[n];for(let o=0;o<s.length;o++){let a=s[o],c=!1;a.charAt(0)=="&"&&(a=a.substr(1),c=!0),a.charAt(0)==="%"&&(a=".o-"+a.substr(1)),c?i.push(l+a):i.push(l?l+" "+a:a)}}return i.join(", ")}addProperty(e,t,i){let s=t.split(/\s*,\s*/);for(let r=0;r<s.length;r++){let n=this.makePropertyName(s[r]);this.result[e][n]?this.result[e][n].push(i):this.result[e][n]=[i];let o={"box-shadow":["-moz-box-shadow","-webkit-box-shadow"],"border-radius":["-moz-border-radius","-webkit-border-radius"],"border-radius-topleft":["-moz-border-radius-topleft","-webkit-border-top-left-radius"],"border-radius-topright":["-moz-border-radius-topright","-webkit-border-top-right-radius"],"border-radius-bottomleft":["-moz-border-radius-bottomleft","-webkit-border-bottom-left-radius"],"border-radius-bottomright":["-moz-border-radius-bottomright","-webkit-border-bottom-right-radius"]}[n];for(let a=0;o&&a<o.length;a++)this.addProperty(e,o[a],i)}}},"CSSParser");b(ng,"CSSParser");var Pu=f(class{m_style;constructor(e){this.m_style=e}value(e){return e=ar(e),this.m_style[e]}parse(e){return e=ar(e),parseInt(this.m_style[e])}get style(){return this.m_style}},"ComputedStyle");b(Pu,"ComputedStyle");var cb="x-",Dr=Symbol(),Vi=Symbol(),lg={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridColumn:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Of={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,create:2,sizechange:2},ub={touchstart:1,touchmove:1,touchend:1},db=/^-?\d+(\.\d+)?$/;function dr(e=null){return ke({context:e})}h(dr,"EvDblClick222");m(dr,"EvDblClick22");d(dr,"EvDblClick2");f(dr,"EvDblClick");b(dr,"EvDblClick");function Bn(e=!0,t=null){return ke({focus:e,context:t})}h(Bn,"EvFocus222");m(Bn,"EvFocus22");d(Bn,"EvFocus2");f(Bn,"EvFocus");b(Bn,"EvFocus");var $=f(class extends sl{m_dom;m_iprops;constructor(e=null){super(e??{}),this.m_iprops={classes:{},dom_events:{},uid:$.__comp_guid++,inrender:!1},this.m_props.cls&&this.addClass(this.m_props.cls)}get uid(){return this.m_iprops.uid}setContent(e,t=!1){this.m_props.content=e??[],!(this.m_iprops.inrender||!this.m_dom)&&(t?this.update():this._updateContent())}getContent(){return this.m_props.content}appendChild(e){if(!e)return;let t=b(i=>{this.m_props.content?Wt(this.m_props.content)||(this.m_props.content=[this.m_props.content]):this.m_props.content=[],this.m_props.content.push(i),this.m_dom&&this._appendChild(i)},"append");Wt(e)?e.forEach(t):t(e)}setTag(e,t){this.m_props.tag=e,t&&(this.m_props.ns=t)}getData(e){if(this.m_props.data!==void 0)return this.m_props.data[e.toString()]}setData(e,t){let i=this.m_props.data;i===void 0&&(i=this.m_props.data={}),i[e.toString()]=t}get dom(){return this.m_dom}show(e){e===void 0||e===!0?this.removeClass("@hidden"):this.addClass("@hidden")}hide(){this.addClass("@hidden")}enable(e){e===void 0||e===!0?(this.removeClass("@disable"),this.removeAttribute("disabled")):this.disable()}disable(){this.addClass("@disable"),this.setAttribute("disabled","")}focus(){console.assert(!!this.m_dom),this.m_dom.focus()}setStyle(e){for(let t in e)this.setStyleValue(t,e[t])}setStyleValue(e,t){let i=this.m_props.style;i||(i=this.m_props.style={}),i[e]=t,this._setDomStyleValue(e,t)}_setDomStyleValue(e,t){this.m_dom&&(t===void 0?t=null:!lg[e]&&(qr(t)||db.test(t))&&(t=t+"px"),this.m_dom.style[e]=t)}getComputedStyle(e){return this.dom?new Pu(getComputedStyle(this.dom,e??null)):new Pu(this.m_props.style)}getStyleValue(e){return this.getComputedStyle()[e]}setAttributes(e){for(let t in e)this.setAttribute(t,e[t])}setAttribute(e,t){if(t===!1||t===void 0)this.removeAttribute(e);else{t===!0?t="":qr(t)&&(t=""+t);let i=this.m_props.attrs;i||(i=this.m_props.attrs={}),i[e]=t,this._setDomAttribute(e,t)}}_setDomAttribute(e,t){this.m_dom&&this.m_dom.setAttribute(e,t)}removeAttribute(e){let t=this.m_props.attrs;t&&(delete t[e],this.m_dom&&this.m_dom.removeAttribute(e))}getAttribute(e){return this.m_dom?this.m_dom.getAttribute(e):this.m_props.attrs?this.m_props.attrs[e]:void 0}hasAttribute(e){return this.m_dom?this.m_dom.hasAttribute(e):this.m_props.attrs.hasOwnProperty(e)}addClass(e){if(e==null||(e=e.trim(),e===""))return;let t=b(s=>{s==null||s===""||(s=this._makeCls(s),i[s]=!0,this.m_dom&&this.m_dom.classList.add(s))},"add"),i=this.m_iprops.classes;e.indexOf(" ")<0?t(e):e.split(" ").forEach(r=>t(r))}removeClass(e){if(e===void 0)return;let t=b(i=>{i==null||i===""||(i=this._makeCls(i),delete this.m_iprops.classes[i],this.m_dom&&this.m_dom.classList.remove(i))},"remove");if(e.indexOf(" ")<0)t(e);else{let i=e.trim().split(" ");for(let s of i)s!=null&&s!==""&&t(s)}}setClass(e,t){return t?this.addClass(e):this.removeClass(e),this}toggleClass(e){let t=b(i=>{i===void 0&&i===null&&i===""||(i=this._makeCls(i),this.m_iprops.classes[i]?delete this.m_iprops.classes[i]:this.m_iprops.classes[i]=!0,this.m_dom&&this.m_dom.classList.toggle(i))},"toggle");if(e.indexOf(" ")<0)t(e);else{let i=e.trim().split(" ");for(let s of i)t(s)}}hasClass(e){let t=this._makeCls(e);return this.m_dom?this.dom.classList.contains(t):!!this.m_iprops.classes[t]}clearClasses(){if(this.m_iprops.classes={},this.m_dom)return this.m_dom.classList.value=""}_build(){return this.m_dom?this.m_dom:(this._createDOM(),this.m_dom)}render(e){}_createDOM(){if(this.m_dom)return this.m_dom;let e=this.m_props;if(e.tabIndex!==void 0&&this._setTabIndex(e.tabIndex),this.render(e),e.left!==void 0&&this.setStyleValue("left",e.left),e.top!==void 0&&this.setStyleValue("top",e.top),e.width!==void 0&&this.setStyleValue("width",e.width),e.height!==void 0&&this.setStyleValue("height",e.height),e.flex!==void 0&&(this.addClass("@flex"),e.flex!=1&&this.setStyleValue("flex",e.flex)),e.enabled===!1&&this.disable(),e.tooltip!==void 0&&this.setAttribute("tip",e.tooltip.replace(/\n/gi,"<br/>")),e.dom_events)for(let l in e.dom_events)this._setDomEvent(l,e.dom_events[l]);this._genClassName(),this.m_props.cls=void 0;let t=this.m_iprops;e.ns?this.m_dom=O.createElementNS(e.ns,e.tag??"div"):this.m_dom=O.createElement(e.tag??"div"),this.m_dom[Vi]=this,this.m_dom.classList.add(...Object.keys(t.classes));let i=e.style;if(i)for(let l in i)this._setDomStyleValue(l,i[l]);let s=e.attrs;if(s)for(let l in s){let o=s[l];o!==!1&&o!==void 0&&this._setDomAttribute(l,s[l])}this.m_props.id&&this._setDomAttribute("id",this.m_props.id);let r=this.m_iprops.dom_events;if(r)for(let l in r){let o=r[l];for(let a of o)this.createEvent(l,a)}let n=e.content;return n&&(Wt(n)||(n=[n]),n.forEach(l=>{l&&(Me(l)?this.m_dom.insertAdjacentText("beforeend",l):Ci(l)?this.m_dom.insertAdjacentHTML("beforeend",l):l instanceof $?this.m_dom.append(l._build()):console.log("unknown element type: ",l))})),$.__createObserver||($.__createObserver=new MutationObserver($._observeCreation),$.__createObserver.observe(O.body,{childList:!0,subtree:!0})),this.m_dom}_setTabIndex(e,t=0){e===!0?e=0:e===void 0&&(e=t),e!==!1&&e!==void 0&&this.setAttribute("tabindex",e),this.m_props.tabIndex=e}static _observeCreation(e){let t=b(i=>{i.m_iprops.created||(i.dom&&i.m_iprops.dom_events&&i.m_iprops.dom_events.create&&i.dom.dispatchEvent(new Event("create")),i.componentCreated(),i.m_iprops.created=!0)},"notify");for(let i of e)if(i.type=="childList")for(let s=0,r=i.addedNodes.length;s<r;s++){let l=i.addedNodes[s][Vi];l&&(l.enumChilds(o=>{t(o)},!0),t(l))}}dispose(){this.m_dom&&this._dispose(!0,!0)}_dispose(e,t){let i=this.m_dom;delete i[Vi],delete i[Dr],e&&i.remove(),this.enumChilds(s=>{s._dispose(!1,!0)}),this.m_dom=null,t&&this.disposeTimers(),this.componentDisposed(),this.m_iprops.created=!1}componentDisposed(){}componentCreated(){}update(e=0){if(this.m_dom){let t=b(()=>{let i=this.m_dom;this._dispose(!1,!1);let s=this._build();console.assert(!!i.parentNode,"update in componentCreated is not allowed, use updateContent"),i.parentNode.replaceChild(s,i)},"_update");e?this.singleShot(t,e):t()}}_empty(){let e=this.m_dom;if(e)for(;e.firstChild;)e.removeChild(e.firstChild)}_updateContent(){if(!this.m_dom)return;this._empty();let e=this.m_props.content;e&&(Wt(e)||(e=[e]),e.forEach(t=>{t&&(Ci(t)?this.m_dom.insertAdjacentHTML("beforeend",t):t instanceof $?this.m_dom.append(t._build()):this.m_dom.insertAdjacentText("beforeend",t+""))}))}getBoundingRect(e=!1){console.assert(this.dom!=null,"cannot get bounding rect of an non DOM element");let t=this.dom.getBoundingClientRect(),i=new ji(t.left,t.top,t.width,t.height);if(e){let s=this.getComputedStyle(),r=s.parse("marginTop"),n=s.parse("marginBottom"),l=s.parse("marginLeft"),o=s.parse("marginRight");i.left-=l,i.width+=l+o,i.top-=r,i.height+=r+n}return i}setDomEvent(e,t){let i=t;this._setDomEvent(e,i)}_setDomEvent(e,t){this.m_iprops.dom_events||(this.m_iprops.dom_events={});let i=this.m_iprops.dom_events[e];i?i.push(t):i=this.m_iprops.dom_events[e]=[t],this.m_dom&&this.createEvent(e,t)}clearDomEvent(e){if(!this.m_iprops.dom_events)return;delete this.m_iprops.dom_events[e];let t=this.m_dom;if(t){let i=t[Dr];i&&delete i[e]}}createEvent(e,t){let i=this.m_dom,s=i[Dr];s||(s=i[Dr]={}),s[e]?s[e].push(t):s[e]=[t],Of[e]===1?i["on"+e]=$._dispatchUnbubbleEvent:$.__privateEvents[e]||($.__privateEvents[e]=!0,ub[e]?O.addEventListener(e,$._dispatchEvent,{passive:!1,capture:!0}):O.addEventListener(e,$._dispatchEvent,!0)),e==="sizechange"&&($.__sizeObserver||($.__sizeObserver=new ResizeObserver($._observeSize)),$.__sizeObserver.observe(this.m_dom))}static _dispatchEvent(e){let t=e.target,i=Of[e.type]===2;for(;t;){if(t[Dr]){let s=t[Dr][e.type];if(s){let r=t[Vi],n=r?.root??null;if(s instanceof Array?s.some(l=>{if(l(e,n),!r.dom)return!0}):s(e,n),e.cancelBubble||e.defaultPrevented||i)break}}if(t=t.parentNode,t==document)break}}static _dispatchUnbubbleEvent(e){let t=e.currentTarget||e.target,i=e.type,s=t[Dr],r=s&&s[i];if(r){let l=t[Vi]?.root??null;r instanceof Array?r.forEach(o=>{o(e,l)}):r(e,l)}}static _observeSize(e){e.forEach(t=>{let i=t.target;i.offsetParent!==null&&i.dispatchEvent(new Event("sizechange"))})}enumChilds(e,t=!1){if(this.m_dom){let i=this.m_dom.firstChild;for(;i;){let s=i[Vi];if(s&&(e(s),t&&s.enumChilds(e,!0)===!0))return!0;i=i.nextSibling}}else{let i=this.m_props.content;if(!i)return;Wt(i)||(i=[i]),i.some(s=>{if(!(!s||Me(s)||Ci(s))&&(e(s)||t&&s.enumChilds(e,!0)===!0))return!0})}return!1}_appendChild(e){if(Me(e))this.m_dom.insertAdjacentText("beforeend",e);else if(Ci(e))this.m_dom.insertAdjacentHTML("beforeend",e);else{let t=e;try{t._build(),this.m_dom.appendChild(t.m_dom)}catch(i){console.error(i)}}}_genClassName(){this.addClass("@comp");let e=Object.getPrototypeOf(this);for(;e&&e.constructor!==$;){let t=e.constructor.name;this.addClass("@"+ar(t)),e=Object.getPrototypeOf(e)}}_makeCls(e){return e[0]=="@"?e=cb+e.substring(1):e}static dispatchCaptures(e){$.__capture.handler(e)}static setCapture(e,t){if(console.assert(!$.__capture),$.__capture)debugger;let i=O.querySelectorAll("iframe");i.forEach(l=>{jt(l).setStyleValue("pointer-events","none")});let s=O.querySelectorAll(":hover"),r=null;if(s.length){let l=s[s.length-1];r=window.getComputedStyle(l).cursor}$.__capture_mask=O.createElement("div");let n=jt($.__capture_mask);n.addClass("@capture-mask"),r&&n.setStyleValue("cursor",r),O.body.appendChild(n.dom),O.addEventListener("mousedown",$.dispatchCaptures),O.addEventListener("mousemove",$.dispatchCaptures),O.addEventListener("mouseup",$.dispatchCaptures),O.addEventListener("touchstart",$.dispatchCaptures),O.addEventListener("touchmove",$.dispatchCaptures),O.addEventListener("touchend",$.dispatchCaptures),$.__capture={initiator:e,handler:t,iframes:i}}static releaseCapture(){console.assert(!!$.__capture),O.removeEventListener("touchstart",$.dispatchCaptures),O.removeEventListener("touchmove",$.dispatchCaptures),O.removeEventListener("touchend",$.dispatchCaptures),O.removeEventListener("mousedown",$.dispatchCaptures),O.removeEventListener("mousemove",$.dispatchCaptures),O.removeEventListener("mouseup",$.dispatchCaptures),$.__capture.iframes.forEach(e=>{jt(e).setStyleValue("pointer-events",null)}),$.__capture=null,$.__capture_mask&&(O.body.removeChild($.__capture_mask),$.__capture_mask=null)}scrollIntoView(e){if(this.m_dom){let t=new ji(this.dom.getBoundingClientRect()),i,s,r,n,l=this.dom.parentElement,o=O.body;for(;l&&l!=o;){let a=l.getBoundingClientRect();(i===void 0||i<a.top)&&(i=a.top),(s===void 0||s>a.bottom)&&(s=a.bottom),(r===void 0||r<a.left)&&(r=a.left),(n===void 0||n>a.right)&&(n=a.right),l=l.parentElement}(i===void 0||t.top<i||t.bottom>s||t.left<r||t.right>n)&&this.m_dom.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"})}}queryItem(e){let t=this.dom.querySelector(e);return t?$.getElement(t):null}queryAll(e,t){let i=Array.from(this.m_dom.querySelectorAll(e));return t&&i.forEach(s=>{t(jt(s))}),i}itemWithId(e){let t=this.dom.querySelector("#"+e);return t?$.getElement(t):null}itemWithRef(e){let t=null;return this.enumChilds(i=>{if(i.m_props.ref===e)return t=i,!0},!0),t}get ref(){return this.m_props.ref}static getCss(){return $.__css||($.__css=new Kr),$.__css}getParent(){console.assert(!!this.m_dom);let e=this.dom.parentNode;return $.getElement(e)}static getElement(e,t){if(t){let i=Me(t);for(;e;){let s=e[Vi];if(i){if(s&&s.hasClass(t))return s}else if(s instanceof t)return s;e=e.parentElement}return null}else return e?e[Vi]:null}static getScrollbarSize(){if($.__sb_width===void 0){let e=O.createElement("div");e.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px";let t=O.createElement("div");t.style.width="200px",t.style.height="200px",e.appendChild(t),O.body.appendChild(e),$.__sb_width=e.offsetWidth-e.clientWidth,O.body.removeChild(e)}return $.__sb_width}isUserVisible(){return this.m_dom?this.m_dom.offsetParent!==null:!1}},"_Component"),F=$;b(F,"Component");pe(F,"__sb_width");pe(F,"__comp_guid",1e3);pe(F,"__privateEvents",{});pe(F,"__sizeObserver");pe(F,"__createObserver");pe(F,"__capture",null);pe(F,"__capture_mask",null);pe(F,"__css",null);var Wf=null;function jt(e){if(e[Vi])return e[Vi];let t=Wf;return t||(t=Wf=new F({})),t.m_dom=e,t}h(jt,"flyWrap222");m(jt,"flyWrap22");d(jt,"flyWrap2");f(jt,"flyWrap");b(jt,"flyWrap");var fh=f(class extends F{constructor(e={}){e.flex||(e.flex=1),super(e)}},"Flex");b(fh,"Flex");var _b=f(class extends F{m_size;constructor(e){super({}),this.m_size=e}componentCreated(){let e=this.dom,t=null;for(;e;){let i=e[Vi];if(i.hasClass("@hlayout")){t={width:this.m_size};break}else if(i.hasClass("@vlayout")){t={height:this.m_size};break}e=e.parentElement}t||(t={width:this.m_size,height:this.m_size}),this.setStyle(t)}},"Space");b(_b,"Space");function et(e,t=null,i=null){return ke({size:e,mode:t,context:i})}h(et,"EvSize222");m(et,"EvSize22");d(et,"EvSize2");f(et,"EvSize");b(et,"EvSize");var og=f(class extends F{m_irect;m_delta;m_target;constructor(e){super(e),this.setDomEvent("mousedown",t=>this._mousedown(t)),this.setDomEvent("touchstart",t=>this._mousedown(t)),this.setDomEvent("dblclick",t=>this._collapse(t))}render(){this.addClass(this.m_props.orientation)}_collapse(e){this.m_props.collapsible&&(this._findTarget(),this.m_target&&this.m_target.toggleClass("@collapsed"))}_mousedown(e){if(e.type=="touchstart"){let t=e;t.touches.length==1&&this._startMoving(t.touches[0].pageX,t.touches[0].pageY,e)}else{let t=e;this._startMoving(t.pageX,t.pageY,e)}}_startMoving(e,t,i){this._findTarget(),this.m_target&&(this.m_props.orientation=="horizontal"?this.m_props.sizing=="before"?this.m_delta=e-this.m_irect.right:this.m_delta=e-this.m_irect.left:this.m_props.sizing=="before"?this.m_delta=t-this.m_irect.bottom:this.m_delta=t-this.m_irect.top,i.preventDefault(),i.stopPropagation(),this.m_target.addClass("sizing"),F.setCapture(this,s=>this._pointerMoved(s)))}_pointerMoved(e){let t=b((i,s)=>{if(this.m_props.orientation=="horizontal"){let r;if(this.m_props.sizing=="after"?r=this.m_irect.right-(i-this.m_delta):r=i-this.m_delta-this.m_irect.left,r>0){let n=new Rn(r,0);this.emit("resize",et(n)),this.m_target.setStyleValue("width",n.width),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}else{let r;if(this.m_props.sizing=="after"?r=this.m_irect.bottom-(s-this.m_delta):r=s-this.m_delta-this.m_irect.top,r>0){let n=new Rn(0,r);this.emit("resize",et(n)),this.m_target.setStyleValue("height",n.height),this.m_target.setStyleValue("flex",null),this.m_target.removeClass("@flex")}}},"__move");if(e.type=="mousemove"){let i=e;t(i.pageX,i.pageY),e.preventDefault(),e.stopPropagation()}else if(e.type=="touchmove"){let i=e;t(i.touches[0].pageX,i.touches[0].pageY),e.preventDefault(),e.stopPropagation()}else(e.type=="mouseup"||e.type=="touchend")&&(this.m_target.removeClass("sizing"),F.releaseCapture(),e.preventDefault(),e.stopPropagation())}_findTarget(){if(!this.m_target)if(this.m_props.sizing=="before"){let e=this.dom.previousElementSibling,t=e?F.getElement(e):null;this.m_target=t}else{let e=this.dom.nextElementSibling,t=e?F.getElement(e):null;this.m_target=t}this.m_target?this.m_irect=this.m_target.getBoundingRect():this.m_irect=null}},"Separator");b(og,"Separator");function Bo(e,t,i=null){return ke({ui_event:e,sens:t,context:i})}h(Bo,"EvOverlayResize222");m(Bo,"EvOverlayResize22");d(Bo,"EvOverlayResize2");f(Bo,"EvOverlayResize");b(Bo,"EvOverlayResize");var pm=f(class extends F{m_delta;m_irect;constructor(e){super(e),this.addClass(e.sens),this.setDomEvent("mousedown",t=>this._mousedown(t)),this.setDomEvent("touchstart",t=>this._mousedown(t)),this.setDomEvent("dblclick",t=>this.resetflex(t)),e.target.appendChild(this),e.resize&&this.on("resize",this.m_props.resize)}resetflex(e){this.m_props.target.addClass("@flex"),this.emit("resize",et({width:-1,height:0})),e.preventDefault(),e.stopPropagation()}_mousedown(e){e.preventDefault(),e.stopPropagation();let t=Bo(e,this.m_props.sens);if(this.emit("rawresize",t),t.defaultPrevented)return;let i=xi(e,!0);this.m_irect=this.m_props.target.getBoundingRect(),this.m_props.sens=="right"?this.m_delta=i.x-this.m_irect.right:this.m_props.sens=="left"?this.m_delta=i.x-this.m_irect.left:this.m_props.sens=="bottom"?this.m_delta=i.y-this.m_irect.bottom:this.m_props.sens=="top"&&(this.m_delta=i.y-this.m_irect.top),this.m_props.target.addClass("sizing"),F.setCapture(this,s=>this._handle_mouse(s))}_is_horz(){return this.m_props.sens=="left"||this.m_props.sens=="right"}get sens(){return this.m_props.sens}_handle_mouse(e){let t=b((i,s)=>{if(this._is_horz()){let r;if(this.m_props.sens=="left"?r=this.m_irect.right-(i-this.m_delta):r=i-this.m_delta-this.m_irect.left,r>0){let n={width:r,height:void 0};this.emit("resize",et(n)),this.m_props.target.setStyleValue("width",n.width),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}else{let r;if(this.m_props.sens=="top"?r=this.m_irect.bottom-(s-this.m_delta):r=s-this.m_delta-this.m_irect.top,r>0){let n=new Rn(0,r);this.emit("resize",et(n)),this.m_props.target.setStyleValue("height",n.height),this.m_props.target.setStyleValue("flex",null),this.m_props.target.removeClass("@flex")}}},"__move");if(e.type=="mousemove"){let i=e;t(i.pageX,i.pageY),e.preventDefault(),e.stopPropagation()}else if(e.type=="touchmove"){let i=e;t(i.touches[0].pageX,i.touches[0].pageY),e.preventDefault(),e.stopPropagation()}else(e.type=="mouseup"||e.type=="touchend")&&(this.m_props.target.removeClass("sizing"),F.releaseCapture(),e.preventDefault(),e.stopPropagation())}},"SizerOverlay");b(pm,"SizerOverlay");function Ho(e){return ke({name:e})}h(Ho,"EvShortcut222");m(Ho,"EvShortcut22");d(Ho,"EvShortcut2");f(Ho,"EvShortcut");b(Ho,"EvShortcut");var Lt=f(class extends F{m_shortcuts;constructor(e){Wt(e)?super({content:e}):super(e)}addShortcut(e,t,i=null,s=!1){this.m_shortcuts||(this.m_shortcuts=[],this.setDomEvent("keydown",r=>this._handleKeydown(r))),Wt(e)||(e=[e]),e.forEach(r=>{let n="";r.match(/SHIFT/i)&&(r=r.replace(/SHIFT/i,""),n+="shift+"),r.match(/CTRL/i)&&(r=r.replace(/CTRL/i,""),n+="ctrl+"),r.match(/CMD/i)&&(r=r.replace(/CMD/i,""),n+="cmd+"),r.match(/ALT/i)&&(r=r.replace(/ALT/i,""),n+="alt+"),n+=r.replace("+","").toLowerCase(),this.m_shortcuts.push({sequence:n,name:t,immediate:s,callback:i})})}removeShortcuts(){this.m_shortcuts&&(this.m_shortcuts=[])}_handleKeydown(e){if(!this.m_shortcuts)return;let t="";e.shiftKey&&(t+="shift+"),e.ctrlKey&&(t+="ctrl+"),e.metaKey&&(t+="cmd+"),e.altKey&&(t+="alt+"),t+=e.key.toLowerCase(),this.m_shortcuts.some(i=>{if(i.sequence==t)return i.callback?i.immediate?i.callback(e):Cs(()=>{i.callback(e)}):this.emit("shortcut",Ho(i.name)),e.preventDefault(),e.stopPropagation(),!0})}},"Container");b(Lt,"Container");var ag=f(class{m_data;m_name;constructor(e){this.m_data=null,this.m_name=e??"settings"}set(e,t){this._load(),this.m_data[e]=t,this._save()}get(e,t){return this._load(),this.m_data[e]??t}_save(){let e=JSON.stringify(this.m_data);localStorage.setItem(this.m_name,e)}_load(){if(this.m_data)return;this.m_data={};let e=localStorage.getItem(this.m_name);e!==null&&(e=JSON.parse(e),e?this.m_data=e:console.info("There was an error attempting to read your settings."))}},"Settings");b(ag,"Settings");var fC=Symbol(),$a=f(class extends sl{static instance(){return $a.self}m_mainView;m_app_name;m_app_version;m_app_uid;m_local_storage;m_user_data;m_touch_time;m_touch_count;constructor(e){console.assert($a.self===null,"application is a singleton"),super(e),this.m_app_name=e.app_name??"application",this.m_app_version=e.app_version??"1.0",this.m_app_uid=e.app_uid??"application";let t=`${this.m_app_name}.${this.m_app_version}.settings`;this.m_local_storage=new ag(t),this.m_user_data={},this.m_touch_time=0,this.m_touch_count=0,$a.self=this,"onload"in globalThis?globalThis.addEventListener("load",()=>{this.ApplicationCreated()}):this.ApplicationCreated()}ApplicationCreated(){this.setTitle("")}get app_name(){return this.m_app_name}get app_uid(){return this.m_app_uid}get app_version(){return this.m_app_version}get local_storage(){return this.m_local_storage}get user_data(){return this.m_user_data}get history(){debugger;return null}setMainView(e,t){let i=this.m_props.renderTo??O.body,s=jt(i);this.m_props.renderTo||s.setStyleValue("position","absolute"),s.addClass("x4-root-element"),t&&s._empty(),this.m_mainView=e,e.setStyleValue("position","absolute"),e._build(),i.appendChild(e.dom)}set mainView(e){this.setMainView(e,!1)}get mainView(){return this.m_mainView}setTitle(e){O.title=this.m_app_name+(e?" > "+e:"")}disableZoomWheel(){window.addEventListener("wheel",function(e){e.ctrlKey&&e.preventDefault()},{passive:!1,capture:!0})}enterModal(e){}enableTouchDblClick(){O.addEventListener("touchstart",e=>{let t=Date.now();if(t-this.m_touch_time>700?this.m_touch_count=1:this.m_touch_count++,this.m_touch_time=t,this.m_touch_count==2){this.m_touch_count=0;let i=e.touches[0],s={type:"dblclick"};for(let r in i)s[r]=i[r];F._dispatchEvent(s),e.stopPropagation()}})}},"_Application"),no=$a;b(no,"Application");pe(no,"self",null);var fb=f(class extends Lt{},"AbsLayout");b(fb,"AbsLayout");var he=f(class extends Lt{},"HLayout");b(he,"HLayout");var kt=f(class extends Lt{},"VLayout");b(kt,"VLayout");var pb=f(class extends Lt{constructor(e){super(e),this.setDomEvent("sizechange",()=>this._updateLayout())}componentCreated(){super.componentCreated(),this._updateLayout()}_updateLayout(){let e=this.m_props.defaultLayout=="horizontal";if(this.m_props.switchSize<=0&&window.screen.height>window.screen.width)e=!e;else{let t=this.getBoundingRect();(e&&t.width<this.m_props.switchSize||!e&&t.height<this.m_props.switchSize)&&(e=!e)}e?(this.removeClass("@vlayout"),this.addClass("@hlayout")):(this.addClass("@vlayout"),this.removeClass("@hlayout"))}},"AutoLayout");b(pb,"AutoLayout");var gb=f(class extends Lt{constructor(e){super(e)}render(){this.m_props.colSizes&&this.setStyleValue("grid-template-columns",this.m_props.colSizes),this.m_props.rowSizes&&this.setStyleValue("grid-template-rows",this.m_props.rowSizes),this.m_props.colGap&&this.setStyleValue("grid-gap",this.m_props.colGap),this.m_props.template&&this.setStyleValue("grid-template-areas",this.m_props.template.join(`
|
|
12
|
+
`))}},"GridLayout");b(gb,"GridLayout");var vb=f(class extends Lt{m_cells;constructor(e){super(e),this.setTag("table"),this.m_cells=new Map}_getCell(e,t,i=!0){let s=Hs(e,t);return this.m_cells.get(s)??(i?{item:void 0}:null)}_setCell(e,t,i,s=!1){let r=Hs(e,t);this.m_cells.set(r,i),this.dom&&i.item&&s&&(i.item instanceof F?i.item.update():this.enumChilds(n=>{if(n.getData("row")==e&&n.getData("col")==t)return n.setContent(i.item),n.update(),!0}))}setCell(e,t,i){let s=this._getCell(e,t);s.item=i,this._setCell(e,t,s,!0)}setCellData(e,t,i){let s=this._getCell(e,t);s.data=i,this._setCell(e,t,s,!0)}getCellData(e,t){return this._getCell(e,t,!1)?.data}merge(e,t,i,s){let r=this._getCell(e,t);r.rowSpan=i,r.colSpan=s,this._setCell(e,t,r)}setCellWidth(e,t,i){let s=this._getCell(e,t);s.width=i,this._setCell(e,t,s)}setCellHeight(e,t,i){let s=this._getCell(e,t);s.height=i,this._setCell(e,t,s)}setCellClass(e,t,i){let s=this._getCell(e,t);s.cls=i,this._setCell(e,t,s)}setColClass(e,t){let i=this._getCell(-1,e);i.cls=t,this._setCell(-1,e,i)}setRowClass(e,t){let i=this._getCell(e,999);i.cls=t,this._setCell(e,999,i)}getCell(e,t){return this._getCell(e,t)?.item}render(){let e=[],t=[];for(let i=0;i<this.m_props.rows;i++){let s=[];for(let l=0;l<this.m_props.columns;l++){let o=Hs(i,l);if(t.indexOf(o)>=0)continue;let a=this.m_cells.get(o),c=this.m_cells.get(Hs(-1,l)),u="";a&&a.cls&&(u=a.cls),c&&c.cls&&(u+=" "+c.cls);let _=new F({tag:"td",content:a?.item,width:a?.width,height:a?.height,data:{row:i,col:l},cls:u});if(a){let p=a.rowSpan??0,v=a.colSpan??0;if(p>0&&_.setAttribute("rowspan",p+1),v>0&&_.setAttribute("colspan",v+1),p||v)for(let g=0;g<=p;g++)for(let x=0;x<=v;x++)t.push(Hs(g+i,x+l))}s.push(_)}let r=this._getCell(i,999,!1),n=new F({tag:"tr",data:{row:i},content:s,cls:r?.cls});e.push(n)}this.setContent(e)}},"TableLayout");b(vb,"TableLayout");function Hs(e,t){return e*1e3+t}h(Hs,"_mkid");m(Hs,"_mkid");d(Hs,"_mkid");f(Hs,"_mkid");b(Hs,"_mkid");var wb=f(class extends F{constructor(e){super(e),this.setContent(e.content)}setContent(e){if(!e)super.setContent(null);else{let t;Wt(e)?t=new kt({content:e}):t=e,t.addClass("@scroll-container"),super.setContent(t)}}},"ScrollView");b(wb,"ScrollView");var bb=f(class extends Lt{constructor(e){let t=e.items;e.items=void 0,super(e),this.setDomEvent("sizechange",()=>{this.resizeAllItems()}),t&&t.forEach(i=>{this.addItem(i)})}resizeItem(e){let t=this.getComputedStyle(),i=t.parse("grid-auto-rows"),s=t.parse("grid-row-gap"),r=e.queryItem(".content");if(r||(r=e),r&&i+s){let n=r.getBoundingRect(),l=Math.ceil((n.height+s)/(i+s));e.setStyleValue("gridRowEnd","span "+l)}}resizeAllItems(){this.queryAll(".item",e=>{this.resizeItem(e)})}addItem(e){e.addClass("content"),this.appendChild(new Lt({cls:"item",content:e}))}},"Masonry");b(bb,"Masonry");function Oo(e){return ke({pos:e})}h(Oo,"EvMove");m(Oo,"EvMove");d(Oo,"EvMove");f(Oo,"EvMove");b(Oo,"EvMove");var qa=f(class extends Lt{m_ui_mask;m_hasMask=!0;constructor(e){super(e),this.addClass("@hidden")}enableMask(e=!0){this.m_hasMask=e}show(e){if(e!==void 0?this.m_hasMask=!!e:e=this.m_hasMask,this.m_hasMask){let t=O.activeElement;for(t&&t.blur(),this.m_ui_mask=O.body.lastChild;this.m_ui_mask;){if(this.m_ui_mask.nodeType==1){let i=jt(this.m_ui_mask);if(!(i.hasClass("@menu")||i.hasClass("@non-maskable"))){if(!(i.getStyleValue("display")=="none"||!i.isUserVisible())){if(i.hasClass("@comp"))break}}}this.m_ui_mask=this.m_ui_mask.previousSibling}this.m_ui_mask&&jt(this.m_ui_mask).addClass("@mask")}if(e&&no.instance().enterModal(!0),this.setStyle({left:0,top:0}),O.body.appendChild(this._build()),this.removeClass("@hidden"),this.centerOnScreen(),e){let t=O.activeElement;if(!this.dom.contains(t)){let i=this.queryItem("[autofocus]");if(i)i.focus();else{let s=this.queryAll("[tabindex]");s&&(s=s.filter(r=>r.offsetParent!==null),s.length&&s[0].focus())}}qa.modal_stack.push(this.dom)}}centerOnScreen(){let e=this.getBoundingRect(),t=`max( 0px, 50vw - ${e.width/2}px )`,i=`max( 0px, 50vh - ${e.height/2}px )`;this.setStyleValue("left",t),this.setStyleValue("top",i)}displayAt(e,t,i="top left",s,r=!1){this.show(r);let n="l",l="t";i.indexOf("right")>=0&&(n="r"),i.indexOf("bottom")>=0&&(l="b");let o=O.body.getBoundingClientRect(),a=this.getBoundingRect();n=="r"&&(e-=a.width),l=="b"&&(t-=a.height),s&&(e+=s.x,t+=s.y),e<4&&(e=4),e+a.width>o.right-4&&(e=o.right-4-a.width,s?.x<0&&(e+=s.x)),t<4&&(t=4),t+a.height>o.bottom-4&&(t=o.bottom-4-a.height,s?.y<0&&(t+=s.y)),this.setStyle({left:e,top:t})}close(){this.hide(),this.m_hasMask&&this.m_ui_mask&&(jt(this.m_ui_mask).removeClass("@mask"),no.instance().enterModal(!1));let e=qa.modal_stack.indexOf(this.dom);e>=0&&qa.modal_stack.splice(e),this.dispose()}componentCreated(){if(this.m_props.sizable){this.addClass("@size-all");let e=["top","right","bottom","left","topleft","topright","bottomleft","bottomright"];for(let t of e)new pm({target:this,sens:t,events:{rawresize:i=>this._mouseResize(i)}})}}_mouseResize(e){e.preventDefault();let t=this.getBoundingRect(),i=this.getComputedStyle(),s=e.ui_event,r=i.parse("marginTop"),n=i.parse("marginLeft"),l=i.parse("marginRight"),o=i.parse("marginBottom"),a=0,c=0,u=xi(s,!0);switch(e.sens){case"topright":case"bottomright":case"right":a=t.right-l-u.x;break;case"topleft":case"bottomleft":case"left":a=t.left-n-u.x;break}switch(e.sens){case"bottomleft":case"bottomright":case"bottom":c=t.bottom-o-u.y;break;case"topleft":case"topright":case"top":c=t.top-r-u.y;break}t.left-=n,t.top-=r;let _=e.sens;F.setCapture(this,p=>{let v=b((g,x)=>{let E=t.left,y=t.top,k=t.width,A=t.height,S,w,D=g+a,R=x+c;switch(D<0&&(D=0),R<0&&(R=0),_){case"topright":case"bottomright":case"right":k=D-E;break;case"topleft":case"bottomleft":case"left":S=E-D,k+=S,E-=S;break}switch(_){case"bottomleft":case"bottomright":case"bottom":A=R-y;break;case"topleft":case"topright":case"top":w=y-R,A+=w,y-=w;break}let C=new Rn(k,A);this.setStyle({left:E,top:y,width:C.width,height:C.height}),this.emit("size",et(C))},"__move");if(p.type=="mouseup"||p.type=="touchend")F.releaseCapture();else if(p.type=="mousemove"){let g=p;v(g.pageX,g.pageY)}else if(p.type=="touchmove"){let g=p;v(g.touches[0].pageX,g.touches[0].pageY)}})}},"_Popup"),us=qa;b(us,"Popup");pe(us,"modal_stack",[]);function Wo(e){if(e.key=="Tab"||e.key=="Enter"){let t=e.target;if(t.tagName=="TEXTAREA")return;let i=F.getElement(t);if(i&&(i.hasAttribute("wants-tab")||i.hasAttribute("wants-enter")))return;let s=O.body;us.modal_stack.length&&(s=us.modal_stack[us.modal_stack.length-1]),jo(s,e.target,e.shiftKey),e.stopPropagation(),e.preventDefault()}}h(Wo,"x4handleKeyDown");m(Wo,"x4handleKeyDown");d(Wo,"x4handleKeyDown");f(Wo,"x4handleKeyDown");b(Wo,"x4handleKeyDown");function jo(e,t,i){let s=O.activeElement;if(!e.contains(s))return;let r=F.getElement(t),n=Array.from(e.querySelectorAll("[tabindex]"));if(n=n.filter(o=>o.offsetParent!==null),!n.length)return;let l=n.indexOf(t);l<0?l=0:i?l>0?l--:l=n.length-1:l<n.length-1?l++:l=0,n[l].focus()}h(jo,"_nextTab");m(jo,"_nextTab");d(jo,"_nextTab");f(jo,"_nextTab");b(jo,"_nextTab");function Hn(){O.body.addEventListener("keydown",Wo,!0)}h(Hn,"installKBHandler");m(Hn,"installKBHandler");d(Hn,"installKBHandler");f(Hn,"installKBHandler");b(Hn,"installKBHandler");O.body?Hn():window.addEventListener("load",Hn);function Go(e){return ke({source:e})}h(Go,"EvAction");m(Go,"EvAction");d(Go,"EvAction");f(Go,"EvAction");b(Go,"EvAction");var hg=f(class extends sl{constructor(e){super(e),this.mapPropEvents(e,"run")}get props(){return this.m_props}set text(e){this.m_props.text=e,this.emit("change",Oe(this))}set icon(e){this.m_props.icon=e,this.emit("change",Oe(this))}fire(){this.emit("run",Go(this))}},"Action");b(hg,"Action");function tr(e,t,i=null){return ke({url:e,svg:t,context:i})}h(tr,"EvLoaded");m(tr,"EvLoaded");d(tr,"EvLoaded");f(tr,"EvLoaded");b(tr,"EvLoaded");function On(e){let t=e.length;return e[0]=='"'&&e[t-1]=='"'&&(e=e.substring(1,t-1),e=e.replaceAll('\\"',"'")),e}h(On,"trimQuotes");m(On,"trimQuotes");d(On,"trimQuotes");f(On,"trimQuotes");b(On,"trimQuotes");var mg=f(class extends Po{svgs;constructor(){super(),this.svgs=new Map}load(e){if(this.svgs.has(e)){let t=this.svgs.get(e);t&&this.signal("loaded",tr(e,t))}else this.svgs.set(e,null),b(async i=>{if(i.substring(0,24)=="data:image/svg+xml;utf8,"){let s=i.substring(24);this.svgs.set(i,s),this.signal("loaded",tr(i,s))}else{let s=await fetch(i);if(s.ok){let r=await s.text();!r.startsWith("<svg")&&!r.startsWith("<?xml")?(console.error("svg loading error: ",r),this.signal("loaded",tr(i,""))):(this.svgs.set(i,r),this.signal("loaded",tr(i,r)))}}},"_load")(e)}},"Loader");b(mg,"Loader");var hu=new mg,Tu=f(class extends F{m_icon;m_iconName;constructor(e){Me(e)?super({icon:e}):super(e),this._setIcon(this.m_props.icon,!1),this.m_props.size&&this.setStyleValue("fontSize",this.m_props.size)}_setIcon(e,t){if(!e){this.m_iconName="";return}this.removeClass("@svg");let i,s;if(typeof e=="number")e=e.toString(16),i=e,console.error("deprecation error: invalid icon name");else{let l=/\s*var\s*\(\s*(.+)\s*\)\s*/gi,o=l.exec(e);for(;o;){let y=o[1].trim();if(e=Kr.getVar(y).trim(),e==""||e===void 0){console.error(`icon: unable to find variable named '${y}'`);return}else e=On(e);o=l.exec(e)}if(e.startsWith("<svg")){this._setSVG("data:image/svg+xml;utf8,"+e);return}let a=/\s*svg\s*\(\s*(.+)\s*\)\s*/gi,c=/(.*\.svg)$/gi,u=a.exec(e)||c.exec(e);if(u){let y=u[1].trim();this._setSVG(y);return}let p=/^\s*(data\:image\/.+)\s*$/gi.exec(e);if(p){this._setSVG(p[1]);return}let g=/\s*cls\s*\(\s*(.+)\s*\)\s*/gi.exec(e);if(g){let y=g[1].trim();this.addClass(y);return}let E=/\s*url\s*\(\s*(.+)\s*\)\s*/gi.exec(e);if(E){s=On(E[1].trim()),s=s.replaceAll("\\",""),this._setSVG(s);return}else console.error("deprecation error: invalid icon name"),i=e,e=Kr.getVar("icon-"+e),(e==""||e===void 0)&&(e="0")}if(this.m_iconName=i,this.m_icon===e)return;let r=F.getCss(),n;if(t&&this.m_icon&&(n="icon-"+i,this.removeClass(n)),n="icon-"+i,Tu.icon_cache[n]===void 0){Tu.icon_cache[n]=!0;let l;s?l=`display: block; content: ' '; background-image: url(${s}); background-size: contain; width: 100%; height: 100%; background-repeat: no-repeat; color: white;`:l=`content: "\\${e}";`,r.setRule(n,`.${n}::before {${l}}`)}this.addClass(n),this.m_icon=e}set icon(e){this._setIcon(e,!0)}get icon(){return this.m_iconName}_setSVG(e){let t=b(i=>{i.url==e&&(this.addClass("@svg-icon"),this.setContent(Xi.from(i.svg),!1),hu.off("loaded",t))},"set");hu.on("loaded",t),hu.load(e)}_setSVGPath(e){this.addClass("@svg-icon"),this.setContent(Xi.from(`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="${e}/></svg>`),!1)}},"_Icon"),st=Tu;b(st,"Icon");pe(st,"icon_cache",[]);var je=f(class extends F{constructor(e){typeof e=="string"||e instanceof Xi?super({text:e}):super(e)}render(e){let t=this.m_props.text;this.m_props.multiline&&!(t instanceof Xi)&&(t=new Xi(Ur(t,!0))),e.icon?(this.setTag("span"),this.addClass("@hlayout"),this.setContent([new st({icon:e.icon}),new F({content:t,ref:"text"})])):this.setContent(t),this.addClass(e.align??"left")}set text(e){let t=this.m_props;if(t.text!==e){t.text=e;let i=this.m_props.text;if(this.m_props.multiline&&!(i instanceof Xi)&&(i=new Xi(Ur(i,!0))),this.dom){let s=this;this.m_props.icon&&(s=this.itemWithRef("text")),s.setContent(i)}}}get text(){return this.m_props.text}},"Label");b(je,"Label");var xb=f(class extends F{},"MenuSeparator");b(xb,"MenuSeparator");var Cb=f(class extends je{},"MenuTitle");b(Cb,"MenuTitle");var _t=f(class extends us{m_subMenu;m_opener;m_virtual;m_lock;constructor(e,t){super(e),this.addClass("@shadow"),this.m_opener=t,this.m_virtual=!1,this.m_lock=0,this.enableMask(!1)}lock(e){this.m_lock+=e?1:-1}setVirtual(){this.m_virtual=!0}setSubMenu(e){this.m_subMenu=e}hideSubMenu(){this.m_subMenu&&(this.m_subMenu.m_opener._close(),this.m_subMenu.hide(),this.m_subMenu=null)}render(e){this.setContent(e.items)}show(){this.m_virtual||_t._addMenu(this),super.show()}close(){!this.dom&&!this.m_virtual||(this.m_opener&&this.m_opener._close(),this.m_subMenu&&(this.m_subMenu.close(),this.m_subMenu=null),super.close(),_t._removeMenu())}clear(){this.m_props.items=[]}static _addMenu(e){_t.watchCount==0&&(_t.rootMenu=e,O.addEventListener("mousedown",_t._mouseWatcher)),_t.watchCount++}static _removeMenu(){console.assert(_t.watchCount>0),_t.watchCount--,_t.watchCount==0&&O.removeEventListener("mousedown",_t._mouseWatcher)}static _mouseWatcher(e){if(e.defaultPrevented)return;let t=e.target;for(;t;){let i=F.getElement(t);if(i&&i instanceof _t)return;t=t.parentElement}_t._discardAll()}static _discardAll(){_t.rootMenu&&(_t.rootMenu.close(),_t.rootMenu=null)}displayAt(...e){this.m_lock||_t._discardAll();let t,i,s,r;e.length==1?{x:t,y:i}=xi(e[0],!0):[t,i,s,r]=e,s||(s="top left"),super.displayAt(t,i,s,r)}},"_Menu"),ds=_t;b(ds,"Menu");pe(ds,"watchCount",0);pe(ds,"rootMenu",null);var Wn=f(class extends F{m_menu;m_isOpen;m_action;constructor(e,t){e instanceof hg?(super({click:()=>{e.fire()}}),this.m_action=e):Me(e)?super({text:e,click:t}):super(e),this.mapPropEvents(this.m_props,"click"),this.m_menu=null,this.m_isOpen=!1,this.setDomEvent("mousedown",i=>this._mousedown(i)),this.setDomEvent("click",i=>this._click(i))}render(e){let t=e.icon??0,i=e.text;e.checked!==void 0&&(t=e.checked?"var( --x4-icon-check )":0),this.m_action&&(t||(t=this.m_action.props.icon),i===void 0&&(i=this.m_action.props.text));let s=null;this.isPopup&&(this.addClass("@popup-menu-item"),s=new st({icon:"var( --x4-icon-chevron-right )",cls:"pop-mark"})),!i&&!t&&this.addClass("@separator"),e.cls&&this.addClass(e.cls),this.setTag("a"),this.setContent([t<0?null:new st({icon:t}),new je({flex:1,text:i}),s])}get id(){return this.m_props.itemId}get text(){return this.m_props.text}get isPopup(){return!!this.m_props.items}_close(){this.removeClass("@opened"),this.m_isOpen=!1}_click(e){this.isPopup||(this.emit("click",ns()),ds._discardAll())}_mousedown(e){if(this.isPopup){this.m_menu||(this.m_menu=new ds({items:this.m_props.items},this));let t=this.m_isOpen,i=F.getElement(this.dom,ds);if(i&&i.hideSubMenu(),!t){i&&i.setSubMenu(this.m_menu),this.m_isOpen=!0;let s=this.getBoundingRect();this.m_menu.lock(!0),i?this.m_menu.displayAt(s.right,s.top):this.m_menu.displayAt(s.left,s.bottom),this.m_menu.lock(!1),this.addClass("@opened")}e.preventDefault()}}},"MenuItem");b(Wn,"MenuItem");var yb=f(class extends he{m_items;constructor(e,t){super(e),console.assert(!1,"not imp"),this.addClass("@shadow"),this.m_items=e.items}render(){this.setContent(this.m_items)}},"MenuBar");b(yb,"MenuBar");var cg=f(class extends kt{m_selection;m_defer_sel;m_container;m_view;m_topIndex;m_itemHeight;m_cache;constructor(e){super(e),this.setDomEvent("keydown",t=>this.handleKey(t)),this.setDomEvent("click",t=>this._handleClick(t)),this.setDomEvent("dblclick",t=>this._handleClick(t)),this.setDomEvent("contextmenu",t=>this._handleCtxMenu(t)),this._setTabIndex(e.tabIndex,0),this.mapPropEvents(e,"click","dblClick","contextMenu","selectionChange","cancel")}componentCreated(){this.m_props.virtual?this._buildItems():this.m_props.populate&&(this.items=this.m_props.populate(null))}render(e){e.items=e.items||[],e.gadgets=e.gadgets,e.renderItem=e.renderItem,e.virtual=e.virtual??!1,this.m_topIndex=0,e.virtual?(console.assert(e.itemHeight!==void 0),this.m_itemHeight=e.itemHeight,this.m_cache=new Map,this.addClass("virtual")):(this.m_itemHeight=void 0,this.m_cache=void 0),this._buildContent()}set items(e){this.setItems(e)}get items(){return this.m_props.items}setItems(e,t=!0){this.m_props.items=e,t||(this.m_selection=null),this.m_container?this._buildItems():this._buildContent()}handleKey(e){let t=b(i=>{let s;ei(this.m_props.items)?(s=this.m_props.items(),this.m_props.items=s):s=this.m_props.items;let r;if(!this.m_selection)s&&(r=s[0]);else{let l=s.findIndex(o=>o===this.m_selection.item);i>0&&l<s.length-1?r=s[l+1]:i<0&&l>0?r=s[l-1]:r=this.selection}let n=this._findItemWithId(r?.id);this._selectItem(r,n,!0)},"moveSel");switch(e.key){case"ArrowDown":{t(1),e.preventDefault(),e.stopPropagation();break}case"ArrowUp":{t(-1),e.preventDefault(),e.stopPropagation();break}}}_buildContent(){let e=this.m_props;e.virtual?(this.m_container=new Lt({cls:"@scroll-container",content:[]}),this.m_view=new Lt({cls:"@scroll-view",flex:1,content:this.m_container,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)}}),this.setContent([this.m_view,e.gadgets?new he({cls:"gadgets",content:e.gadgets}):null])):(this.m_view=void 0,this.m_container=new kt({cls:"@scroll-container",content:[]}),this.addClass("@scroll-view"),this.setContent(this.m_container,!1)),e.virtual&&this.m_container.setStyleValue("height",e.items.length*this.m_itemHeight),(this.dom||!e.virtual)&&this._buildItems()}_updateScroll(e){let t=b(()=>{let i=Math.floor(this.m_view.dom.scrollTop/this.m_itemHeight);(i!=this.m_topIndex||e)&&(this.m_topIndex=i,this._buildItems())},"update");e?this.startTimer("scroll",10,!1,t):t()}async _buildItems(){let e=this.m_props,t=[],i=e.items;ei(i)&&(i=i());let s=this.m_selection?.item.id,r=!1;if(e.virtual){let n=this.getBoundingRect(),l=100,o=0,a=this.m_topIndex*this.m_itemHeight,c=this.m_topIndex,u=n.height,_=e.items.length,p=[],v=this.m_cache;for(this.m_cache=new Map;o<u&&c<_&&--l>0;){let g=e.items[c],x;v.has(g.id)?(x=v.get(g.id),v.delete(g.id)):(x=this._renderItem(g),p.push(x)),s==g.id&&(x.addClass("@selected"),r=!0),x.setStyleValue("top",a+o),t.push(x),this.m_cache.set(g.id,x),o+=this.m_itemHeight,c++}v.forEach(g=>{g.dispose()}),this.m_container.appendChild(p),this.m_container.setStyleValue("height",_*this.m_itemHeight),r||i.some(g=>s==g.id)||(this.m_selection=null)}else i.forEach(n=>{let l=this._renderItem(n);s==n.id&&(l.addClass("@selected"),r=!0),t.push(l)}),this.m_container.setContent(t,!1),r||(this.m_selection=null);if(this.m_defer_sel){let n=this.m_defer_sel;this.m_defer_sel=void 0,this.selection=n}}_renderItem(e){let t=this.onRenderItem(e);return t.setAttribute("data-id",e.id),t.addClass("@list-item"),t.setData("item-id",e.id),t}onRenderItem(e){return this.m_props.renderItem?this.m_props.renderItem(e):new he({content:e.text})}_handleClick(e){e.stopImmediatePropagation(),e.preventDefault();let t=e.target,i=this.dom,s=this.m_props.items;for(;t&&t!=i;){let r=F.getElement(t),n=r?.getData("item-id");if(n!==void 0){let l=s.find(o=>o.id==n);if(l){let o;e.type=="click"?(o=ns(l),this.emit("click",o)):(o=dr(l),this.emit("dblClick",o)),o.defaultPrevented||this._selectItem(l,r)}else this._selectItem(null,null);return}t=t.parentElement}this._selectItem(null,null)}_handleCtxMenu(e){e.preventDefault();let t=e.target,i=this.dom,s=this.m_props.items;for(;t&&t!=i;){let r=F.getElement(t),n=r?.getData("item-id");if(n){let l=s.find(o=>o.id==n);l&&(this._selectItem(l,r),this.emit("contextMenu",xs(e,l)));return}t=t.parentElement}this.emit("contextMenu",xs(e,null))}_selectItem(e,t,i=!0){this.m_selection&&this.m_selection.citem&&this.m_selection.citem.removeClass("@selected"),this.m_selection=e?{item:e,citem:t}:null,this.m_selection&&this.m_selection.citem&&this.m_selection.citem.addClass("@selected"),i&&this.emit("selectionChange",ui(e))}get selection(){return this.m_selection?this.m_selection.item:null}set selection(e){if(e==null)this._selectItem(null,null);else if(ei(this.m_props.items))this.m_defer_sel=e;else{let t=this.m_props.items.find(s=>s.id==e),i=this._findItemWithId(t.id);this._selectItem(t,i,!1)}}_findItemWithId(e){let t=null;return this.dom&&this.m_container.enumChilds(i=>{if(i.getData("item-id")==e)return i.scrollIntoView(),t=i,!0}),t}appendItem(e,t=!1,i=!0){t?this.m_props.items.unshift(e):this.m_props.items.push(e),i&&(this.selection=null),this.m_container?this._buildItems():this._buildContent(),i&&(this.selection=e.id)}updateItem(e,t){let i=this.m_props.items.findIndex(n=>n.id===e);if(i<0)return;let s=!1;this.m_selection&&this.m_selection.item===this.m_props.items[i]&&(s=!0),this.m_props.items[i]=t;let r=this.queryItem(`[data-id="${t.id}"]`)?.dom;if(r){let n=this._renderItem(t);s&&(n.addClass("@selected"),this.m_selection.citem=n,this.m_selection.item=t);let l=n._build();this.m_container.dom.replaceChild(l,r)}}},"ListView");b(cg,"ListView");function No(e=null){return ke({context:e})}h(No,"EvCancel");m(No,"EvCancel");d(No,"EvCancel");f(No,"EvCancel");b(No,"EvCancel");var Yd=f(class extends us{m_list;constructor(e){super({tabIndex:!1}),this.enableMask(!1),this.addClass("@non-maskable"),e.tabIndex=!1,this.m_list=new cg(e),this.setContent(this.m_list),this.mapPropEvents(e,"cancel")}set items(e){this.m_list.items=e}handleKey(e){this.m_list.handleKey(e)}_handleClick=e=>{if(!this.dom)return;let t=e.target;this.dom.contains(t)||F.getElement(t,Wn)||(this.signal("cancel",No()),this.close())};show(e){O.addEventListener("mousedown",this._handleClick),super.show(e)}hide(){O.removeEventListener("mousedown",this._handleClick),super.hide()}close(){O.removeEventListener("mousedown",this._handleClick),super.close()}get selection(){return this.m_list.selection}set selection(e){this.m_list.selection=e}},"PopupListView");b(Yd,"PopupListView");var es=f(class extends F{constructor(e){super(e)}render(e){this.setTag("input"),this._setTabIndex(e.tabIndex),this.setAttributes({value:e.value,type:e.type||"text",name:e.name,placeholder:e.placeHolder,autofocus:e.autoFocus,readonly:e.readOnly,autocomplete:"new-password",tabIndex:e.tabIndex,spellcheck:e.spellcheck===!1?"false":void 0,min:e.min,max:e.max,...e.attrs}),this.m_props.autosel=e.autosel??!0,e.uppercase&&this.setStyleValue("textTransform","uppercase"),this.m_props.autosel&&this.setDomEvent("focus",()=>{this.selectAll()})}getType(){return this.m_props.type}get value(){if(this.dom&&(this.m_props.value=this.dom.value),this.m_props.uppercase){let e=this.m_props.value.toUpperCase();this.dom&&e!=this.m_props.value&&(this.dom.value=e),this.m_props.value=e}return this.m_props.value}set value(e){this.m_props.value=e,this.dom&&(this.dom.value=e)}getStoreValue(){if(this.m_props.value_hook)return this.m_props.value_hook.get();{let e=this.getAttribute("type");e&&(e=e.toLowerCase());let t,i=this.dom;if(e==="file"){t=[];let s=i.files;for(let r=0;r<s.length;r++)t.push(s[r].name)}else if(e==="checkbox")i.checked?t=1:t=0;else if(e==="radio")i.checked&&(t=this.value);else if(e==="date")debugger;else t=this.value;return t}}setStoreValue(e){if(this.m_props.value_hook)return this.m_props.value_hook.set(e);{let t=this.getAttribute("type"),i=this.dom;if(t&&(t=t.toLowerCase()),t==="checkbox"){let s=e!==null&&e!=="0"&&e!==0&&e!==!1;s!==i.checked&&(i.setAttribute("checked",""+s),i.dispatchEvent(new Event("change")))}else this.value=e}}set readOnly(e){this.setAttribute("readonly",e)}selectAll(){this.dom.select()}select(e,t=9999){this.dom.setSelectionRange(e,e+t)}getSelection(){let e=this.dom;return{start:e.selectionStart,length:e.selectionEnd-e.selectionStart}}},"Input");b(es,"Input");var Xd=f(class extends F{constructor(e){super(e),this.setTag("button"),this.setDomEvent("click",t=>this._handleClick(t)),this.setDomEvent("mousedown",()=>{this._startAutoRep(!0)}),this.setDomEvent("mouseup",()=>{this._startAutoRep(!1)}),this.setDomEvent("keydown",t=>this._handleKeyDown(t)),this.mapPropEvents(e,"click")}render(e){let t=e.action,i=e.icon,s=e.text;t&&(!i&&t.props.icon&&(i=t.props.icon),s===void 0&&t.props.text&&(s=t.props.text));let r=i?new st({icon:i,cls:"left",ref:"l_icon"}):null,n=new je({flex:1,text:s??"",align:e.align,ref:"label"}),l=e.rightIcon?new st({icon:e.rightIcon,cls:"right",ref:"r_icon"}):null;s===void 0&&n.addClass("@hidden"),this.setContent([r,n,l]),this._setTabIndex(e.tabIndex)}_startAutoRep(e){this.m_props.autoRepeat&&(e?this.startTimer("repeat",700,!1,()=>{this.startTimer("repeat",this.m_props.autoRepeat,!0,this._sendClick)}):this.stopTimer("repeat"))}_handleKeyDown(e){!e.ctrlKey&&!e.shiftKey&&!e.altKey&&(e.key=="Enter"||e.key==" ")&&(this._sendClick(),e.preventDefault(),e.stopPropagation())}_handleClick(e){if(this.m_props.menu){let t=new ds({items:ei(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),i=this.getBoundingRect();t.displayAt(i.left,i.bottom,"tl")}else this._sendClick();e.preventDefault(),e.stopPropagation()}_sendClick(){if(this.m_props.menu){let e=new ds({items:ei(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),t=this.getBoundingRect();e.displayAt(t.left,t.bottom,"tl")}else this.emit("click",ns()),this.m_props.action&&this.m_props.action.fire()}set text(e){this.m_props.text=e;let t=this.itemWithRef("label");t&&(t.text=e,t.removeClass("@hidden"))}get text(){return this.itemWithRef("label")?.text}set icon(e){this.m_props.icon=e;let t=this.itemWithRef("l_icon");t?t.icon=e:this.update()}get icon(){return this.itemWithRef("l_icon")?.icon}set rightIcon(e){this.m_props.rightIcon=e;let t=this.itemWithRef("r_icon");t&&(t.icon=e)}get rightIcon(){return this.itemWithRef("l_icon")?.icon}set menu(e){this.m_props.menu=e}},"BaseButton");b(Xd,"BaseButton");var wt=f(class extends Xd{},"Button");b(wt,"Button");var Eb=f(class extends Xd{constructor(e){super(e)}render(e){super.render(e),e.checked&&(this.addClass("checked"),this._updateIcon())}_sendClick(){super._sendClick(),this.m_props.checked=!this.m_props.checked,this.setClass("checked",this.m_props.checked),this.emit("change",Oe(this.m_props.checked)),this._updateIcon()}_updateIcon(){if(this.m_props.checkedIcon){let e=this.m_props.checked?this.m_props.checkedIcon:this.m_props.icon,t=this.itemWithRef("l_icon");t&&(t.icon=e)}}},"ToggleButton");b(Eb,"ToggleButton");var ug=f(class extends kt{m_date;constructor(e){super(e),this.mapPropEvents(e,"change"),this.m_date=e.date?.clone()??new Date}render(e){let t=nr(this.m_date);t.setDate(1);let i=t.getDay();i==0&&(i=7),t.setDate(-i+1+1);let s=nr(t),r=this.m_date.hash(),n=nr(this.m_date);n.setDate(1),n.setMonth(n.getMonth()+1),n.setDate(0);let l=hr(n),o=[],a=new he({cls:"month-sel",content:[new je({cls:"month",text:it(this.m_date,"O"),dom_events:{click:()=>this._choose("month")}}),new je({cls:"year",text:it(this.m_date,"Y"),dom_events:{click:()=>this._choose("year")}}),new fh,new wt({text:"<",click:()=>this._next(!1)}),new wt({text:">",click:()=>this._next(!0)})]});o.push(a);let c=[];c.push(new he({cls:"weeknum cell"}));for(let p=0;p<7;p++)c.push(new je({cls:"cell",flex:1,text:ae.global.day_short[(p+1)%7]}));o.push(new he({cls:"week header",content:c}));let u=this.m_date.getMonth(),_=!0;for(;hr(s)<=l;){let p=[new he({cls:"weeknum cell",content:new F({tag:"span",content:it(s,"w")})})];for(let v=0;v<7;v++){let g="cell day";s.hash()==r&&(g+=" today"),s.getMonth()!=u&&(g+=" out");let x=b(E=>new he({cls:g,flex:1,content:new F({tag:"span",content:it(E,"d")}),dom_events:{click:()=>this.select(E)}}),"mkItem");p.push(x(s.clone())),s.setDate(s.getDate()+1),_=!1}o.push(new he({cls:"week",flex:1,content:p}))}this.setContent(o)}select(e){this.m_date=e,this.emit("change",Oe(e)),this.update()}_next(e){this.m_date.setMonth(this.m_date.getMonth()+(e?1:-1)),this.update()}_choose(e){let t=[];if(e=="month")for(let r=0;r<12;r++)t.push(new Wn({text:ae.global.month_long[r],click:()=>{this.m_date.setMonth(r),this.update()}}));else if(e=="year"){let r=this.m_props.minDate?.getFullYear()??1900,n=this.m_props.maxDate?.getFullYear()??2037;for(let l=r;l<n;l++)t.push(new Wn({text:""+l,click:()=>{this.m_date.setFullYear(l),this.update()}}))}let i=new ds({items:t}),s=this.getBoundingRect();i.displayAt(s.left,s.top)}get date(){return this.m_date}set date(e){this.m_date=e,this.update()}},"Calendar");b(ug,"Calendar");var dg=f(class extends us{m_cal;constructor(e){super({tabIndex:1}),this.enableMask(!1),this.m_cal=new ug(e),this.m_cal.addClass("@fit"),this.setContent(this.m_cal)}_handleClick=e=>{if(!this.dom)return;let t=e.target;this.dom.contains(t)||F.getElement(t,Wn)||this.close()};show(e,t){O.addEventListener("mousedown",this._handleClick),t?super.displayAt(t.x,t.y,"top left",void 0,e):super.show(e)}close(){O.removeEventListener("mousedown",this._handleClick),super.close()}},"PopupCalendar");b(dg,"PopupCalendar");var mu,As,Zd=f(class extends F{m_text;set text(e){this.m_text.text=e}render(){this.setClass("@non-maskable",!0),this.setContent([new st({icon:"var( --x4-icon-tip )"}),this.m_text=new je({text:"help"})])}displayAt(e,t,i="top left"){this.show();let s="l",r="t";i.indexOf("right")>=0&&(s="r"),i.indexOf("bottom")>=0&&(r="b");let n=O.body.getBoundingClientRect(),l=this.getBoundingRect();s=="r"&&(e-=l.width),r=="b"&&(t-=l.height),e+l.width>n.right&&(e=n.right-l.width),t+l.height>n.bottom&&(t=n.bottom-l.height-17),this.setStyle({left:e,top:t})}},"Tooltip");b(Zd,"Tooltip");function gm(e){if(ml())return;let t={target:null,x:0,y:0};function i(n){t.x=n.pageX,t.y=n.pageY}h(i,"handle_mpos"),m(i,"handle_mpos"),d(i,"handle_mpos"),f(i,"handle_mpos"),b(i,"handle_mpos");function s(n){let l=n.target,o=null;for(t.x=n.pageX+10,t.y=n.pageY+15;l&&(o=l.getAttribute("tip"),!o);)l=l.parentElement;if(!(l==t.target||As&&l==As.dom)){if(!l||!o){t.target=null,e?e(null):r();return}t.target=l,e?e(null):r(),e?e(o):mu=setTimeout(()=>{As===void 0&&(As=new Zd({}),O.body.appendChild(As._build())),As.text=o,As.displayAt(t.x+17,t.y+17,"top left")},700)}}h(s,"handle_mouse"),m(s,"handle_mouse"),d(s,"handle_mouse"),f(s,"handle_mouse"),b(s,"handle_mouse");function r(){mu&&clearTimeout(mu),As&&As.hide()}h(r,"_hideTip"),m(r,"_hideTip"),d(r,"_hideTip"),f(r,"_hideTip"),b(r,"_hideTip"),O.body.addEventListener("mouseover",s),O.body.addEventListener("mouseout",s),O.body.addEventListener("mousemove",i)}h(gm,"initTooltips");m(gm,"initTooltips");d(gm,"initTooltips");f(gm,"initTooltips");b(gm,"initTooltips");var kb=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,yi=f(class extends F{m_cal_popup;m_ui_input;m_error_tip;constructor(e){super(e),this.addClass("@hlayout"),this.mapPropEvents(e,"change","click","focus")}componentCreated(){super.componentCreated(),this.m_props.autoFocus&&this.focus()}componentDisposed(){this.m_error_tip&&this.m_error_tip.dispose(),super.componentDisposed()}focus(){this.m_ui_input.focus()}render(e){let t={flex:1,dom_events:{focus:()=>this._focus(),focusout:()=>this._blur(),input:()=>this._change()},value:e.value,name:e.name,type:e.type,placeHolder:e.placeHolder,autoFocus:e.autoFocus,readOnly:e.readOnly,value_hook:e.value_hook,uppercase:e.uppercase,spellcheck:e.spellcheck,tabIndex:e.tabIndex===void 0?!0:e.tabIndex,attrs:e.attrs,min:e.min,max:e.max,autosel:e.autosel};if(e.type=="date"){e.format=e.format??"Y-M-D",t.type="text";let _={get:()=>this._date_get_hook(),set:p=>this._date_set_hook(p)};t.value_hook=e.value_hook??_}this.m_ui_input=new es(t);let i;e.icon?i=new wt({icon:e.icon,click:()=>this._btnClick(),tabIndex:!1}):e.type=="date"&&(i=new wt({cls:"gadget",icon:"var( --x4-icon-calendar-days )",tabIndex:!1,click:()=>this._showDatePicker(i)}),e.validator||(e.validator=this._date_validator));let s=e.gadgets??[];s.forEach(_=>{_.addClass("gadget")});let r=[i,...s];this.setClass("@required",e.required),e.gadgets&&e.gadgets.length&&this.addClass("with-gadgets");let n,l,o=e.labelWidth;o>0&&(n=o),o<0&&(l=-o);let a,c=e.labelAlign,u=!1;e.label&&(c=="top"&&(c="left",u=!0,l=1),a=new je({ref:"label",tag:"label",cls:"label1"+(e.label?"":" @hidden"),text:e.label??"",width:n,flex:l,align:c})),u?(this.removeClass("@hlayout"),this.addClass("@vlayout vertical"),this.setContent([a,new he({width:n,content:[this.m_ui_input,...r]})])):(this.addClass("@hlayout"),this.setContent([a,this.m_ui_input,...r]))}enable(e){e===!0&&this.m_ui_input.enable(),super.enable(e)}disable(){this.m_ui_input.disable(),super.disable()}_btnClick(){this.emit("click",ns(this.value))}setDateStoreFormat(e){this.m_props.format=e}setStoreValue(e){this.m_ui_input.setStoreValue(e)}getStoreValue(){return this.m_ui_input.getStoreValue()}_date_get_hook(){let e=Lr(this.value),t=this.m_props;return t.format=="native"?e:e?it(e,t.format):null}_date_set_hook(e){let t=this.m_props;if(t.format=="native")this.value=it(e);else if(e){let i=Lr(e,t.format);this.value=it(i)}else this.value=""}showError(e){this.m_error_tip||(this.m_error_tip=new Zd({cls:"error"}),O.body.appendChild(this.m_error_tip._build()));let t=this.m_ui_input.getBoundingRect();this.m_error_tip.text=e,this.m_error_tip.displayAt(t.right,t.top,"top left"),this.addClass("@error")}clearError(){this.m_error_tip&&(this.m_error_tip.hide(),this.removeClass("@error"))}get value(){return this.m_ui_input?this.m_ui_input.value:this.m_props.value}set value(e){this.m_ui_input?this.m_ui_input.value=e:this.m_props.value=e}selectAll(){this.m_ui_input.selectAll()}select(e,t=9999){this.m_ui_input.select(e,t)}getSelection(){return this.m_ui_input.getSelection()}set readOnly(e){this.m_ui_input.readOnly=e}get label(){return this.itemWithRef("label")?.text}set label(e){this.itemWithRef("label").text=e}_change(){let e=this.m_ui_input.value;this.emit("change",Oe(e))}_focus(){this.clearError(),this.emit("focus",Bn(!0))}_blur(){this._validate(this.m_ui_input.value),this.emit("focus",Bn(!1))}validate(){return this._validate(this.value)}_validate(e){let t=this.m_props,i=!1;if(t.required&&e.length==0)return this.showError(ae.global.required_field),!1;if(e!=""){let s=this.getAttribute("pattern");if(s){let r=new RegExp(s);if(r&&!r.test(e))return this.showError(ae.global.invalid_format),!1}if(t.type=="email"){if(!kb.test(e.toLowerCase()))return this.showError(ae.global.invalid_email),!1}else if(t.type=="number"){let r=parseFloat(e);if(isNaN(r))return this.showError(ae.global.invalid_number),!1;let n=parseFloat(this.m_ui_input.getAttribute("min"));n!==void 0&&r<n&&(e=""+n,i=!0);let l=parseFloat(this.m_ui_input.getAttribute("max"));l!==void 0&&r>l&&(e=""+l,i=!0)}}if(t.validator)try{this.value=t.validator(e)}catch(s){return this.showError(s instanceof Error?s.message:s),!1}else i&&(this.value=e);return!0}_date_validator(e){if(e=e.trim(),e=="")return"";let t;if(e=="@")t=new Date;else if(t=Lr(e),!t)throw rr(ae.global.invalid_date,ae.global.date_format);return it(t)}_showDatePicker(e){this.m_cal_popup||(this.m_cal_popup=new dg({change:i=>{this.value=it(i.value),this.m_cal_popup.close()}}));let t=this.m_ui_input.getBoundingRect();this.m_cal_popup.displayAt(t.left,t.bottom,"top left")}get input(){return this.m_ui_input}get type(){return this.m_props.type}},"TextEdit");b(yi,"TextEdit");var Sb=f(class extends yi{m_popup;m_popvis;m_needval;m_lockpop;constructor(e){super(e),this.setDomEvent("input",()=>this._onChange()),this.setDomEvent("focusin",()=>this._onFocus()),this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.m_popvis=!1,this.m_needval=!1,this.m_lockpop=!1,this.setDomEvent("keydown",t=>this._onKey(t))}_onKey(e){this.m_popvis?e.key=="ArrowUp"||e.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(e),this.m_lockpop=!1,e.preventDefault(),e.stopPropagation()):e.key=="Escape"&&(this._hidePopup(),e.preventDefault(),e.stopPropagation()):e.key=="ArrowDown"&&(this._onChange(),e.preventDefault(),e.stopPropagation())}_onChange(){let e=this.m_props.enumValues(this.value);this.showPopup(e)}componentDisposed(){this.m_popup&&this._hidePopup(),super.componentDisposed()}showPopup(e){if(this.m_props.readOnly||this.hasClass("@disable"))return;if(!this.m_popup){let s=this.getComputedStyle(),r=s.value("fontFamily"),n=s.value("fontSize");this.m_popup=new Yd({cls:"@combo-popup",attrs:{tabindex:0},selectionChange:l=>{this.value=l.selection.id,this.m_lockpop||(this._hidePopup(),this.focus())},style:{fontFamily:r,fontSize:n}})}this.m_popup.items=e.map(s=>({id:s,text:s}));let i=this.m_ui_input.getBoundingRect();this.m_popup.setStyle({minWidth:i.width}),this.m_popup.displayAt(i.left,i.bottom),this.m_popvis=!0}_validate(e){return!0}validate(){return super._validate(this.value)}_checkFocus(){let e=document.activeElement;this.dom&&this.dom.contains(e)||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(e)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1),this.m_needval&&(this.validate(),this.m_needval=!1)}_onFocus(){this.value.length==0&&this._onChange(),this.m_needval=!0}},"AutoComplete");b(Sb,"AutoComplete");function Uo(e){return ke({ctx:e})}h(Uo,"EvPaint");m(Uo,"EvPaint");d(Uo,"EvPaint");f(Uo,"EvPaint");b(Uo,"EvPaint");function $o(e,t,i){let s=e;return s.width=t,s.height=i,s.smoothLine=qo,s.smoothLineEx=Ko,s.line=Yo,s.roundRect=Xo,s.calcTextSize=Zo,s.setFontSize=Jo,s.circle=Qo,s}h($o,"mkPainter");m($o,"mkPainter");d($o,"mkPainter");f($o,"mkPainter");b($o,"mkPainter");function qo(e,t=null,i=!0){if(e.length<2)return;if(t||(t=this),e.length==2){i!==!1?t.moveTo(e[0].x,e[0].y):t.lineTo(e[0].x,e[0].y),t.lineTo(e[1].x,e[1].y);return}function s(a,c){return{x:a.x+(c.x-a.x)/2,y:a.y+(c.y-a.y)/2}}h(s,"midPointBtw"),m(s,"midPointBtw"),d(s,"midPointBtw"),f(s,"midPointBtw"),b(s,"midPointBtw");function r(a,c,u,_,p,v,g){return{x:(1-a)*(1-a)*c+2*(1-a)*a*_+a*a*v,y:(1-a)*(1-a)*u+2*(1-a)*a*p+a*a*g}}h(r,"getQuadraticXY"),m(r,"getQuadraticXY"),d(r,"getQuadraticXY"),f(r,"getQuadraticXY"),b(r,"getQuadraticXY");let n=e[0],l=e[1],o=n;t.moveTo(n.x,n.y);for(let a=1,c=e.length;a<c;a++){let u=s(n,l);for(let _=0;_<8;_++){let{x:p,y:v}=r(_/8,o.x,o.y,n.x,n.y,u.x,u.y);t.lineTo(p,v)}n=e[a],l=e[a+1],o=u}t.lineTo(n.x,n.y)}h(qo,"smoothLine");m(qo,"smoothLine");d(qo,"smoothLine");f(qo,"smoothLine");b(qo,"smoothLine");function Ko(e,t=.5,i=10,s=null,r=!0,n=!1){let l=[];for(let w=0,D=e.length;w<D;w++)l.push(e[w].x),l.push(e[w].y);let o,a=1,c=l.length,u=0,_=(c-2)*i+2+(n?2*i:0),p=new Float32Array(_),v=new Float32Array((i+2)*4),g=4;for(o=l.slice(0),n?(o.unshift(l[c-1]),o.unshift(l[c-2]),o.push(l[0],l[1])):(o.unshift(l[1]),o.unshift(l[0]),o.push(l[c-2],l[c-1])),v[0]=1;a<i;a++){var x=a/i,E=x*x,y=E*x,k=y*2,A=E*3;v[g++]=k-A+1,v[g++]=A-k,v[g++]=y-2*E+x,v[g++]=y-E}v[g]=1,S(o,v,c),n&&(o=[],o.push(l[c-4],l[c-3],l[c-2],l[c-1]),o.push(l[0],l[1],l[2],l[3]),S(o,v,4));function S(w,D,R){for(var C=2,z;C<R;C+=2){var W=w[C],J=w[C+1],ve=w[C+2],te=w[C+3],ie=(ve-w[C-2])*t,K=(te-w[C-1])*t,Y=(w[C+4]-W)*t,Nt=(w[C+5]-J)*t;for(z=0;z<i;z++){var Te=z<<2,Ut=D[Te],$t=D[Te+1],qt=D[Te+2],Kt=D[Te+3];p[u++]=Ut*W+$t*ve+qt*ie+Kt*Y,p[u++]=Ut*J+$t*te+qt*K+Kt*Nt}}}h(S,"parse"),m(S,"parse"),d(S,"parse"),f(S,"parse"),b(S,"parse"),c=n?0:l.length-2,p[u++]=l[c],p[u]=l[c+1],s||(s=this);for(let w=0,D=p.length;w<D;w+=2)w==0&&r!==!1?s.moveTo(p[w],p[w+1]):s.lineTo(p[w],p[w+1])}h(Ko,"smoothLineEx");m(Ko,"smoothLineEx");d(Ko,"smoothLineEx");f(Ko,"smoothLineEx");b(Ko,"smoothLineEx");function Yo(e,t,i,s,r,n=1){this.save(),this.beginPath(),this.moveTo(e,t),this.lineTo(i,s),this.lineWidth=n,this.strokeStyle=r,this.stroke(),this.restore()}h(Yo,"line");m(Yo,"line");d(Yo,"line");f(Yo,"line");b(Yo,"line");function Xo(e,t,i,s,r){this.moveTo(e+r,t),this.lineTo(e+i-r,t),this.quadraticCurveTo(e+i,t,e+i,t+r),this.lineTo(e+i,t+s-r),this.quadraticCurveTo(e+i,t+s,e+i-r,t+s),this.lineTo(e+r,t+s),this.quadraticCurveTo(e,t+s,e,t+s-r),this.lineTo(e,t+r),this.quadraticCurveTo(e,t,e+r,t),this.closePath()}h(Xo,"roundRect");m(Xo,"roundRect");d(Xo,"roundRect");f(Xo,"roundRect");b(Xo,"roundRect");function Zo(e,t=!1){let i=this.measureText(e),s=i.fontBoundingBoxAscent+i.fontBoundingBoxDescent;return t?{width:Math.round(i.width),height:Math.round(s)}:{width:i.width,height:s}}h(Zo,"calcTextSize");m(Zo,"calcTextSize");d(Zo,"calcTextSize");f(Zo,"calcTextSize");b(Zo,"calcTextSize");function Jo(e){let t=Math.round(e)+"px";this.font=this.font.replace(/\d+px/,t)}h(Jo,"setFontSize");m(Jo,"setFontSize");d(Jo,"setFontSize");f(Jo,"setFontSize");b(Jo,"setFontSize");function Qo(e,t,i){this.moveTo(e+i,t),this.arc(e,t,i,0,Math.PI*2)}h(Qo,"circle");m(Qo,"circle");d(Qo,"circle");f(Qo,"circle");b(Qo,"circle");var Db=f(class extends F{m_iwidth=-1;m_iheight=-1;m_scale=1;m_canvas;constructor(e){super(e),this.setDomEvent("sizechange",()=>{this._paint()}),this.mapPropEvents(e,"paint")}render(){this.m_iwidth=-1,this.m_iheight=-1,this.m_canvas=new F({tag:"canvas"}),this.setContent(this.m_canvas)}update(e=0){this.m_iheight=this.m_iwidth=-1,super.update(e)}scale(e){this.m_scale=e,this.m_iwidth=-1,this.redraw()}get canvas(){return this.m_canvas}$update_rep=0;redraw(e){e!==void 0?++this.$update_rep>=20?(this.stopTimer("update"),this._paint()):this.startTimer("update",e,!1,()=>this._paint()):(this.stopTimer("update"),this._paint())}_paint(){this.$update_rep=0;let e=this.dom;if(!this.isUserVisible())return;let t=this.m_canvas.dom,i=e.clientWidth,s=e.clientHeight,r=t.getContext("2d");if(i!=this.m_iwidth||s!=this.m_iheight){let n=window.devicePixelRatio||1,l=r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1,o=this.canvas;if(n!==l||this.m_scale!=1){let a=n/l,c=i*a,u=s*a;o.setAttribute("width",""+c),o.setAttribute("height",""+u),o.setStyleValue("width",i),o.setStyleValue("height",s),a*=this.m_scale,r.scale(a,a)}else o.setAttribute("width",""+i),o.setAttribute("height",""+s),o.setStyleValue("width",i),o.setStyleValue("height",s),r.scale(1,1);this.m_iwidth=i,this.m_iheight=s}if(i&&s){let n=$o(r,i,s);this.m_props.autoClear&&n.clearRect(0,0,i,s),n.save(),n.translate(-.5,-.5),this.paint(n),n.restore()}}paint(e){try{this.m_props.painter?this.m_props.painter(e):this.emit("paint",Uo(e))}catch(t){console.assert(!1,t)}}},"Canvas");b(Db,"Canvas");var Jd=f(class extends F{m_cards;m_ipage;m_cpage;constructor(e){super(e),this.m_cards=[],this.m_ipage=e.active,this.m_cpage=null,this.singleShot(()=>{this.setPages(e.pages)})}render(){let e=[];this.m_cards.forEach(t=>{t.page&&e.push(t.page)}),this.setContent(e)}switchTo(e){if(this.m_cards.length!=0&&(e===void 0&&(e=this.m_cards[0].name),e!==this.m_cpage?.name)){if(this.m_cpage&&(this.m_cpage.selector&&this.m_cpage.selector.removeClass("@active"),this.m_cpage.page&&!(this.m_cpage.page instanceof Function))){let t=this.m_cpage.page;t.removeClass("@active"),t.addClass("@hidden")}if(this.m_cpage=this.m_cards.find(t=>t.name==e),this.m_cpage){if(this.m_cpage.page){ei(this.m_cpage.page)&&(this.m_cpage.page=this.m_cpage.page(),console.assert(this.m_cpage.page!=null,"You must return a valid component"));let t=this.m_cpage.page;t.addClass("@active"),t.removeClass("@hidden"),t.dom||this._preparePage(t),this.m_cpage.selector&&this.m_cpage.selector.addClass("@active")}this.emit("change",Oe(this.m_cpage.name))}}}setPages(e){let t=this._initTabs(e);t&&Cs(()=>{this.switchTo(t),this.update()})}_initTabs(e){if(!e)return;let t=this.m_ipage;return e.forEach(i=>{if(!i)return;let s={...i};s.selector=this._prepareSelector(i),s.active=!1,this.m_cards.push(s),t||(t=i.name),i.active&&(t=i.name)}),t}_updateSelector(){}_prepareSelector(e){return null}_preparePage(e){e.setStyleValue("flex",1),e.addClass("@tab-page")}},"CardView");b(Jd,"CardView");var ph=f(class extends F{constructor(e){super(e),this.setDomEvent("focus",()=>this._setFocus()),this.mapPropEvents(e,"change"),e.slider&&this.addClass("slider")}render(e){let t=e.labelWidth??-1,i="__cb_"+this.uid;this.setTag("label"),this.addClass("@hlayout"),this.addClass(e.align??"left"),this.setContent([new es({ref:"input",type:"checkbox",name:e.name,id:i,tabIndex:e.tabIndex,value:e.value??"on",attrs:{checked:e.checked?"":void 0},dom_events:{change:this._change.bind(this)}}),e.slider?new F({cls:"@slide-el"}):null,new je({text:e.text??"",width:t<0?void 0:t,flex:t<0?-t:void 0,align:e.labelAlign??"left",style:{order:e.align=="right"?-1:1},attrs:{for:i}})])}_change(){this.emit("change",Oe(this.check))}_setFocus(){this.itemWithRef("input").focus()}get check(){return this.dom?this.itemWithRef("input").dom.checked:this.m_props.checked}set check(e){if(this.dom){let i=this.itemWithRef("input").dom;i&&(i.checked=e)}this.m_props.checked=e}get text(){return this.itemWithRef("label").text}set text(e){this.itemWithRef("label").text=e}toggle(){this.check=!this.check}},"CheckBox");b(ph,"CheckBox");var jf={lightsalmon:4294942842,lightseagreen:4280332970,lightskyblue:4287090426,lightslategray:4286023833,lightsteelblue:4289774814,lightyellow:4294967264,lime:4278255360,limegreen:4281519410,linen:4294635750,magenta:4294902015,maroon:4286578688,mediumaquamarine:4284927402,mediumblue:4278190285,mediumorchid:4290401747,mediumpurple:4287852763,mediumseagreen:4282168177,mediumslateblue:4286277870,mediumspringgreen:4278254234,mediumturquoise:4282962380,mediumvioletred:4291237253,midnightblue:4279834992,mintcream:4294311930,mistyrose:4294960353,moccasin:4294960309,navajowhite:4294958765,navy:4278190208,oldlace:4294833638,olive:4286611456,olivedrab:4285238819,orange:4294944e3,orangered:4294919424,orchid:4292505814,palegoldenrod:4293847210,palegreen:4288215960,paleturquoise:4289720046,palevioletred:4292571283,papayawhip:4294963157,peachpuff:4294957753,peru:4291659071,pink:4294951115,plum:4292714717,powderblue:4289781990,purple:4286578816,red:4294901760,rosybrown:4290547599,royalblue:4282477025,saddlebrown:4287317267,salmon:4294606962,sandybrown:4294616160,seagreen:4281240407,seashell:4294964718,sienna:4288696877,silver:4290822336,skyblue:4287090411,slateblue:4285160141,slategray:4285563024,snow:4294966010,springgreen:4278255487,steelblue:4282811060,tan:4291998860,teal:4278222976,thistle:4292394968,tomato:4294927175,turquoise:4282441936,violet:4293821166,wheat:4294303411,white:4294967295,whitesmoke:4294309365,yellow:4294967040,yellowgreen:4288335154,aliceblue:4293982463,antiquewhite:4294634455,aqua:4278255615,aquamarine:4286578644,azure:4293984255,beige:4294309340,bisque:4294960324,black:4278190080,blanchedalmond:4294962125,blue:4278190335,blueviolet:4287245282,brown:4289014314,burlywood:4292786311,cadetblue:4284456608,chartreuse:4286578432,chocolate:4291979550,coral:4294934352,cornflowerblue:4284782061,cornsilk:4294965468,crimson:4292613180,cyan:4278255615,darkblue:4278190219,darkcyan:4278225803,darkgoldenrod:4290283019,darkgray:4289309097,darkgreen:4278215680,darkkhaki:4290623339,darkmagenta:4287299723,darkolivegreen:4283788079,darkorange:4294937600,darkorchid:4288230092,darkred:4287299584,darksalmon:4293498490,darkseagreen:4287609999,darkslateblue:4282924427,darkslategray:4281290575,darkturquoise:4278243025,darkviolet:4287889619,deeppink:4294907027,deepskyblue:4278239231,dimgray:4285098345,dodgerblue:4280193279,firebrick:4289864226,floralwhite:4294966e3,forestgreen:4280453922,fuchsia:4294902015,gainsboro:4292664540,ghostwhite:4294506751,gold:4294956800,goldenrod:4292519200,gray:4286611584,green:4278222848,greenyellow:4289593135,honeydew:4293984240,hotpink:4294928820,indianred:4291648604,indigo:4283105410,ivory:4294967280,khaki:4293977740,lavender:4293322490,lavenderblush:4294963445,lawngreen:4286381056,lemonchiffon:4294965965,lightblue:4289583334,lightcoral:4293951616,lightcyan:4292935679,lightgoldenrodyellow:4294638290,lightgreen:4287688336,lightgrey:4292072403,lightpink:4294948545,none:0,transparent:0},xe=f(class{m_value;constructor(e,t,i,s){let r=arguments.length,n=this;function l(){if(!r)return 4278190080;if(r==1)return Number.isSafeInteger(e)?4278190080|e&16777215:n._getCustomColor(e);if(r==2){let o,a=((t*255|0)&255)<<24;return Number.isSafeInteger(e)?o=e:o=n._getCustomColor(e),o&16777215|a}else if(r==4&&s!==void 0&&s<=1)return s<=0?0:(s=s*255,s|=0,(s&255)<<24|(e&255)<<16|(t&255)<<8|i&255);return 4278190080|(e&255)<<16|(t&255)<<8|i&255}h(l,"_init"),m(l,"_init"),d(l,"_init"),f(l,"_init"),b(l,"_init"),this.m_value=l()}_shade(e){let t=e<0?0:255,i=e<0?-e:e,s=this._split();return new xe(Math.round((t-s.r)*i)+s.r,Math.round((t-s.g)*i)+s.g,Math.round((t-s.b)*i)+s.b,s.a/255)}darken(e){return e<0&&(e=0),e>100&&(e=100),this._shade(-e/100)}lighten(e){return e<0&&(e=0),e>100&&(e=100),this._shade(e/100)}static mix(e,t,i){let s=e._split(),r=t._split(),n=s.a===r.a?s.a:Math.round(r.a*i+s.a*(1-i)),l=s.r===r.r?s.r:Math.round(r.r*i+s.r*(1-i)),o=s.g===r.g?s.g:Math.round(r.g*i+s.g*(1-i)),a=s.b===r.b?s.b:Math.round(r.b*i+s.b*(1-i));return new xe(l,o,a,n/255)}_split(){let e=this.m_value;return{a:e>>24&255,r:e>>16&255,g:e>>8&255,b:e&255}}fadeout(e){let t=this._split();if(t.a=t.a/255,t.a=t.a-t.a*e/100,t.a>1)t.a=1;else if(t.a<=0)return xe.NONE;return new xe(t.r,t.g,t.b,t.a)}static fromHSV(e,t,i,s=1){let r=Math.min(5,Math.floor(e*6)),n=e*6-r,l=i*(1-t),o=i*(1-n*t),a=i*(1-(1-n)*t),c,u,_;switch(r){case 0:c=i,u=a,_=l;break;case 1:c=o,u=i,_=l;break;case 2:c=l,u=i,_=a;break;case 3:c=l,u=o,_=i;break;case 4:c=a,u=l,_=i;break;case 5:c=i,u=l,_=o;break}return new xe(c*255,u*255,_*255,s)}static toHSV(e){let t=e._split();t.r/=255,t.g/=255,t.b/=255,t.a/=255;let i=Math.max(t.r,t.g,t.b),s=Math.min(t.r,t.g,t.b),r=i-s,n=i===0?0:r/i,l=i,o;if(r===0)o=0;else switch(i){case t.r:o=(t.g-t.b)/r/6+(t.g<t.b?1:0);break;case t.g:o=(t.b-t.r)/r/6+1/3;break;case t.b:o=(t.r-t.g)/r/6+2/3;break}return{h:o,s:n,v:l,a:t.a}}static fromHLS(e,t,i){let s,r,n;if(i==0)s=r=n=t;else{let o=f(function(u,_,p){return p<0&&(p+=1),p>1&&(p-=1),p<.16666666666666666?u+(_-u)*6*p:p<.5?_:p<.6666666666666666?u+(_-u)*(.6666666666666666-p)*6:u},"hue2rgb2");var l=o;b(o,"hue2rgb");let a=t<.5?t*(1+i):t+i-t*i,c=2*t-a;s=o(c,a,e+1/3),r=o(c,a,e),n=o(c,a,e-1/3)}return s=(s*255|0)&255,r=(r*255|0)&255,n=(n*255|0)&255,new xe(s,r,n)}static toHLS(e){let t=e.m_value,i=(t>>16&255)/255,s=(t>>8&255)/255,r=(t&255)/255,n=i,l=i;s<n&&(n=s),r<n&&(n=r),s>l&&(l=s),r>l&&(l=r);let o=0,a=0,c=0,u=l-n,_=l+n,p=.5*_,v,g;if(l!=n)o=(l-i)/u,a=(l-s)/u,c=(l-r)/u;else return{h:0,l:p,s:0};return p<.5?v=u/_:v=u/(2-_),i==l?g=60*(6+c-a):s==l?g=60*(2+o-c):g=60*(4+a-o),g>360&&(g=g-360),{h:g/360,l:p,s:v}}red(){return this.m_value>>16&255}green(){return this.m_value>>8&255}blue(){return this.m_value&255}alpha(){return(this.m_value>>24&255)/255}value(){return this.m_value}toString(){if(this.m_value===0)return"transparent";let t=this._split();if(t.a===255)return`rgb(${t.r},${t.g},${t.b})`;{t.a/=255;let i=t.a.toFixed(3);return`rgba(${t.r},${t.g},${t.b},${i})`}}toHex(e=!0){if(this.m_value===0)return"transparent";let i=this._split();return i.a===255||!e?`#${Bi(i.r)}${Bi(i.g)}${Bi(i.b)}`:`#${Bi(i.r)}${Bi(i.g)}${Bi(i.b)}${Bi(i.a)}`}static addCustomColor(e,t){xe.custom[e]=t}static addCssColor(e){let t=Kr.getVar(e);xe.custom["css:"+e]=xe.parse(t.trim())}static parse(e){let t;if(e[0]=="#"){if((t=/#(?<r>[a-fA-F0-9]{2})(?<g>[a-fA-F0-9]{2})(?<b>[a-fA-F0-9]{2})(?<a>[a-fA-F0-9]{2})?/.exec(e))!==null){let r=t.groups;return new xe(parseInt(r.r,16),parseInt(r.g,16),parseInt(r.b,16),r.a!==void 0?parseInt(r.a,16)/255:1)}if((t=/#(?<r>[a-fA-F0-9])(?<g>[a-fA-F0-9])(?<b>[a-fA-F0-9])/.exec(e))!==null){let r=t.groups,n=parseInt(r.r,16),l=parseInt(r.g,16),o=parseInt(r.b,16);return new xe(n<<4|n,l<<4|l,o<<4|o,1)}}if(e[0]=="r"){if((t=/rgb\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\)/.exec(e))!==null){let r=t.groups;return new xe(parseInt(r.r,10),parseInt(r.g,10),parseInt(r.b,10),1)}if((t=/rgba\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\,\s*(?<a>[0-9.]+)\s*\)/.exec(e))!==null){let r=t.groups;return new xe(parseInt(r.r,10),parseInt(r.g,10),parseInt(r.b,10),parseFloat(r.a))}}return console.log("invalid color value: "+e),new xe(0)}_getCustomColor(e){if(e===null)return 0;let t=jf[e];return t!==void 0?t:xe.custom[e]!==void 0?xe.custom[e].m_value:e.substr(0,4)=="css:"?(xe.addCssColor(e.substr(4)),xe.custom[e].m_value):xe.parse(e).m_value}static contrastColor(e){let t=e._split();return(.299*t.r+.587*t.g+.114*t.b)/255>.5?xe.BLACK:xe.WHITE}static valueFromColorName(e){let t=jf[e];return t?new xe(t):null}static fromCssVar(e){return new xe(e).toString()}},"_Color"),Re=xe;b(Re,"Color");pe(Re,"custom",[]);pe(Re,"WHITE",new xe(255,255,255));pe(Re,"BLACK",new xe(0,0,0));pe(Re,"NONE",new xe(0,0,0,0));function Bi(e){return("00"+e.toString(16)).substr(-2).toUpperCase()}h(Bi,"_hx");m(Bi,"_hx");d(Bi,"_hx");f(Bi,"_hx");b(Bi,"_hx");var Ib=1e4;function ea(e){let t,i=e.url,s=e.method||"GET",r=!1;e.params instanceof FormData?(t=e.params,r=!0):s=="POST"?t=jn(e.params,!1):i+=jn(e.params,!0),i=encodeURI(i);let n=new XMLHttpRequest;if(n.open(s,i),n.upload.addEventListener("progress",l,!1),n.addEventListener("timeout",a),n.addEventListener("error",a),n.addEventListener("load",c),r||n.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8"),s!="POST"&&(n.responseType=e.responseType||"json",n.timeout=e.timeout||Ib),e.headers)for(let u in e.headers)n.setRequestHeader(u,e.headers[u]);function l(u){if(console.log(u),e.progress)try{if(u.lengthComputable){let _=o(u.loaded)+" / "+o(u.total);e.progress(u.loaded,u.total,_)}}catch(_){console.error("unhandled exception:",_)}}h(l,"progress"),m(l,"progress"),d(l,"progress"),f(l,"progress"),b(l,"progress");function o(u){let _,p;return u>=1e9?(_="Gb",p=u/1e9):u>=1e6?(_="Mb",p=u/1e6):u>=1e3?(_="Kb",p=u/1e3):(_="bytes",p=u),p.toFixed(2)+_}h(o,"humanSize"),m(o,"humanSize"),d(o,"humanSize"),f(o,"humanSize"),b(o,"humanSize");function a(){e.failure&&e.failure(n.status,n.statusText,e.userData)}h(a,"failure"),m(a,"failure"),d(a,"failure"),f(a,"failure"),b(a,"failure");function c(){if(n.status>=200&&n.status<300){if(e.success)try{e.success(n.response,e.userData)}catch(u){console.error("unhandled exception:",u)}}else a()}return h(c,"success"),m(c,"success"),d(c,"success"),f(c,"success"),b(c,"success"),r||s=="POST"?n.send(t):n.send(),function(){n.abort()}}h(ea,"ajaxRequest");m(ea,"ajaxRequest");d(ea,"ajaxRequest");f(ea,"ajaxRequest");b(ea,"ajaxRequest");function jn(e,t){if(!e)return"";let i=[];for(let r in e){let n=e[r];if(Wt(n))for(let l=0,o=n.length;l<o;l++)i.push(encodeURIComponent(r)+"[]="+encodeURIComponent(""+n[l]));else n===void 0&&(n=""),i.push(encodeURIComponent(r)+"="+encodeURIComponent(""+n))}let s=i.join("&");return t?"?"+s:s}h(jn,"buildQuery");m(jn,"buildQuery");d(jn,"buildQuery");f(jn,"buildQuery");b(jn,"buildQuery");async function vm(e,t){return(await ul(e,t,"application/json")).json()}h(vm,"ajaxAsJSON");m(vm,"ajaxAsJSON");d(vm,"ajaxAsJSON");f(vm,"ajaxAsJSON");b(vm,"ajaxAsJSON");async function wm(e,t){return(await ul(e,t,"text/plain")).text()}h(wm,"ajaxAsText");m(wm,"ajaxAsText");d(wm,"ajaxAsText");f(wm,"ajaxAsText");b(wm,"ajaxAsText");async function ul(e,t,i){let s={method:"GET",headers:{"X-Requested-With":"XMLHttpRequest"}};if(i&&(s.headers["Content-Type"]=i),t&&(s={...s,...t},t.body&&!Me(t.body))){let n=!1;(Lo(t.body)||!(t.body instanceof Blob)&&!(t.body instanceof ArrayBuffer)&&!(t.body instanceof FormData)&&!(t.body instanceof URLSearchParams)&&!(t.body instanceof ReadableStream))&&(n=!0),n?s.body=JSON.stringify(t.body):s.body=t.body}let r=await fetch(e,s);if(t&&t.noGenX)return r;if(!r.ok)throw new rg(r);return r}h(ul,"ajax");m(ul,"ajax");d(ul,"ajax");f(ul,"ajax");b(ul,"ajax");var _g=f(class extends kt{m_height;m_container;m_buttons;m_dirty;m_watchChanges;constructor(e){let t=e.content;e.content=null;let i=e.height;e.height=void 0,super(e),this.setTag(e.disableSuggestions?"section":"form"),this.mapPropEvents(e,"btnClick"),this.updateContent(t,e.buttons,i),this.m_dirty=!1,this.m_watchChanges=!1}get container(){return this.m_container}componentCreated(){super.componentCreated(),this.m_watchChanges&&this.watchChanges()}updateContent(e,t,i=0){i&&(this.m_height=i),this._makeButtons(t);let s=[this.m_container=new kt({cls:"container",height:this.m_height,content:e}),this.m_buttons];super.setContent(s)}setContent(e,t=!0){this.m_container.setContent(e,t)}setButtons(e){this._makeButtons(e)}enableButton(e,t=!0){let i=this.getButton(e);i&&i.enable(t)}getButton(e){return this.m_buttons?.itemWithRef("@"+e)}_makeButtons(e){this.m_buttons||(this.m_buttons=new he({cls:"footer",ref:"buttons"}));let t=[];if(e)for(let i of e)if(i instanceof F)t.push(i);else switch(i){case"ok":{t.push(new wt({ref:"@"+i,text:ae.global.ok,click:()=>{this._click(i)}}));break}case"cancel":{t.push(new wt({ref:"@"+i,text:ae.global.cancel,click:()=>{this._click(i)}}));break}case"ignore":{t.push(new wt({ref:"@"+i,text:ae.global.ignore,click:()=>{this._click(i)}}));break}case"yes":{t.push(new wt({ref:"@"+i,text:ae.global.yes,click:()=>{this._click(i)}}));break}case"no":{t.push(new wt({ref:"@"+i,text:ae.global.no,click:()=>{this._click(i)}}));break}case"close":{t.push(new wt({ref:"@"+i,text:ae.global.close,click:()=>{this._click(i)}}));break}case"save":{t.push(new wt({ref:"@"+i,text:ae.global.save,click:()=>{this._click(i)}}));break}case"dontsave":{t.push(new wt({ref:"@"+i,text:ae.global.dontsave,click:()=>{this._click(i)}}));break}}t.length==1&&t[0].setAttribute("autofocus",!0),this.m_buttons.setContent(t)}validate(){let e=this.queryAll("input"),t=!0;for(let i=0;i<e.length;i++){let s=F.getElement(e[i],yi);s&&!s.validate()&&(t=!1)}return t}_click(e){this.emit("btnClick",ta(e))}_getElements(){return console.assert(!!this.dom),this.queryAll("[name]")}setValues(e){let t=this._getElements();for(let i=0;i<t.length;i++){let s=t[i],r=F.getElement(s);if(!r.hasAttribute("name"))continue;let n=r.getAttribute("name"),l=r.getAttribute("type");e[n]!==void 0&&r.setStoreValue(e[n])}this.setDirty(!1)}getValues(){let e=this._getElements(),t={};for(let i=0;i<e.length;i++){let s=e[i],r=F.getElement(s);if(!r.hasAttribute("name"))continue;let n=r.getAttribute("name"),l=r.getStoreValue();l!==void 0&&(t[n]=l)}return t}submit(e,t){if(!this.validate())return!1;let i=this.getValues();if(t&&!t(i))return!1;let s=new FormData;for(let r in i)i.hasOwnProperty(r)&&s.append(r,i[r]===void 0?"":i[r]);return e.params=s,ea(e)}watchChanges(){this.dom?(this.queryAll("input[name], textarea[name]").forEach(t=>{jt(t).setDomEvent("input",()=>{this.setDirty()})}),this.m_watchChanges=!1):this.m_watchChanges=!0}setDirty(e=!0){this.m_dirty=e}isDirty(){return this.m_dirty}},"Form");b(_g,"Form");function ta(e){return ke({button:e})}h(ta,"EvBtnClick");m(ta,"EvBtnClick");d(ta,"EvBtnClick");f(ta,"EvBtnClick");b(ta,"EvBtnClick");var bm=f(class extends us{m_icon;m_title;m_form;m_buttons;m_closable;m_movable;m_maximized;m_minimized;m_maximizable;m_minimizable;m_minFormSize;m_rc_max;m_rc_min;m_el_title;m_last_down;m_auto_close;m_ui_title;m_form_cb;constructor(e){let t=e.content;e.content=null;let i=e.width,s=e.height;e.width=void 0,e.height=void 0,super(e),this.m_minFormSize={width:i,height:s},this.enableMask(!0),e.form?ei(e.form)?this.m_form_cb=e.form:(this.m_form=e.form,this.m_form.on("btnClick",r=>this._handleClick(r))):this.m_form=new _g({content:t,buttons:e.buttons,disableSuggestions:e.disableSuggestions,btnClick:r=>this._handleClick(r)}),this.m_movable=e.movable,this.m_auto_close=e.autoClose??!0,this.m_icon=e.icon,this.m_title=e.title,this.m_buttons=e.buttons??null,this.m_closable=e.closable??!1,this.m_last_down=0,this.on("size",r=>{this.addClass("@resized"),this.m_form.setStyleValue("width",null),this.m_form.setStyleValue("height",null)}),this.m_maximized=!1,this.m_minimized=!1,this.m_maximizable=!1,this.m_minimizable=!1,e.maximizable!==void 0&&(this.m_maximizable=e.maximizable),e.minimizable!==void 0&&(this.m_minimizable=e.minimizable),e.maximized==!0&&(this.m_maximizable=!0),e.btnClick&&this.on("btnClick",e.btnClick)}componentCreated(){super.componentCreated(),this.m_minFormSize.width&&this.m_form.setStyle({minWidth:this.m_minFormSize.width,width:this.m_minFormSize.width}),this.m_minFormSize.height&&this.m_form.setStyle({minHeight:this.m_minFormSize.height,height:this.m_minFormSize.height});let e=this.getBoundingRect();this.setStyleValue("min-width",e.width),this.setStyleValue("min-height",e.height),this.setStyleValue("width",e.width),this.setStyleValue("height",e.height),this.m_props.dlgWidth&&this.setStyleValue("width",this.m_props.dlgWidth+"%"),this.m_props.dlgHeight&&this.setStyleValue("height",this.m_props.dlgHeight+"%"),this.addClass("@resized"),this.m_el_title&&this.m_el_title.setStyleValue("width","auto"),this.m_props.maximized?(this._maximize(),this.emit("size",et(null))):this.centerOnScreen()}_handleClick(e){this.emit("btnClick",e),e.defaultPrevented||this.close()}setGeometry(e){e.minimized&&this.m_minimizable?(this._minimize(!1),this.m_rc_min=new ji(e.left,e.top,e.width,e.height),this.displayAt(e.left,e.top,"top-left")):e.maximized&&this.m_maximizable?(this._maximize(!1),this.m_rc_max=new ji(e.left,e.top,e.width,e.height)):(this.setSize(e.width,e.height),this.displayAt(e.left,e.top,"top-left"))}getGeometry(){if(this.m_minimized)return{left:this.m_rc_min.left,top:this.m_rc_min.top,width:this.m_rc_min.width,height:this.m_rc_min.height,minimized:!0,maximized:!1};if(this.m_maximized)return{left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height,minimized:!1,maximized:!0};let e=this.getBoundingRect();return{left:e.left,top:e.top,width:e.width,height:e.height,minimized:!1,maximized:!1}}setSize(e,t){this.setStyle({width:e,height:t}),this.emit("size",et({width:e,height:t}))}render(){this.m_form_cb&&(this.m_form=this.m_form_cb(),this.m_form.on("btnClick",t=>this._handleClick(t)),this.m_form_cb=null);let e=this.m_icon!==void 0||this.m_closable||this.m_title!==void 0||this.m_movable;this.m_el_title=null,e&&(this.m_el_title=new he({cls:"title",content:[this.m_icon?new st({icon:this.m_icon}):null,this.m_ui_title=new je({flex:1,text:this.m_title}),this.m_minimizable?new st({cls:"min-btn",icon:"var( --x4-icon-window-minimize )",dom_events:{click:()=>this._toggleMin()}}):null,this.m_maximizable?new st({cls:"max-btn",icon:"var( --x4-icon-window-maximize )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_maximizable?new st({cls:"res-btn",icon:"var( --x4-icon-window-restore )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_closable?new st({cls:"close-btn",icon:"var( --x4-icon-rectangle-times )",dom_events:{click:()=>this.close()}}):null]}),this.m_movable&&(ml()?this.m_el_title.setDomEvent("touchstart",t=>this._mouseDown(t)):this.m_el_title.setDomEvent("mousedown",t=>this._mouseDown(t)))),super.setContent([this.m_el_title,this.m_form])}setContent(e,t=!0){this.m_form.setContent(e,t)}setButtons(e){this.m_form.setButtons(e)}get form(){return this.m_form}close(){this.emit("close",{}),super.close()}_toggleMax(){this.m_maximizable&&(this.m_maximized?(this.removeClass("maximized"),this.setStyle({left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height}),this.m_maximized=!1,this.emit("size",et(null,"restore"))):(this._maximize(),this.emit("size",et(null,"maximize"))))}_toggleMin(){this.m_minimizable&&(this.m_minimized?(this.removeClass("minimized"),this.setStyle({width:this.m_rc_min.width,height:this.m_rc_min.height}),this.m_minimized=!1,this.emit("size",et(null,"restore"))):(this._minimize(),this.emit("size",et(null,"minimize"))))}_mouseDown(e){let{x:t,y:i}=xi(e,!0),s=jt(O.body).getBoundingRect(),r=this.getBoundingRect(!0),n=t-r.left,l=i-r.top,o=Date.now(),a=o-this.m_last_down;if(this.m_maximizable&&a<700){this._toggleMax();return}if(this.m_last_down=o,this.m_maximized)return;let c=b((u,_)=>{u>s.right?u=s.right:u<s.left&&(u=s.left),_>s.bottom?_=s.bottom:_<s.top&&(_=s.top);let p=u-n,v=_-l;this.setStyle({left:p,top:v})},"__move");F.setCapture(this,u=>{if(u.type=="mousemove"){let _=u;c(_.clientX,_.clientY)}else if(u.type=="touchmove"){let _=u;_.touches.length==1&&c(_.touches[0].clientX,_.touches[0].clientY)}else u.type=="mouseup"||u.type=="touchend"?(F.releaseCapture(),this.emit("move",Oo(null))):u.type=="mousedown"||u.type=="touchstart"})}maximize(){!this.m_maximizable||this.m_maximized||(this._maximize(),this.emit("size",et(null)))}_maximize(e=!0){e&&(this.m_rc_max=this.getBoundingRect(!1)),this.addClass("maximized"),this.m_maximized=!0,this.setStyle({left:void 0,top:void 0,width:void 0,height:void 0})}minimize(){!this.m_minimizable||this.m_minimized||(this._minimize(),this.emit("size",et(null)))}_minimize(e=!0){e&&(this.m_rc_min=this.getBoundingRect(!1)),this.addClass("minimized"),this.m_minimized=!0,this.setStyle({width:void 0,height:void 0})}set title(e){this.m_title=e,this.m_ui_title&&(this.m_ui_title.text=e)}itemWithName(e){let t=this.dom.querySelector(`[name="${e}"]`);return t?F.getElement(t):null}getValues(){return this.m_form.getValues()}validate(){return this.m_form.validate()}},"Dialog");b(bm,"Dialog");var Fu=f(class extends Lt{m_colorSel;m_colorHue;m_colorAlpha;m_sample;m_selMark;m_hueMark;m_alphaMark;m_baseHSV;m_baseColor;m_transpCk;m_colorEdit;m_palmode;constructor(e){super(e),this.m_palmode=Fu.last_palmode,this.setDomEvent("contextmenu",t=>this._showCtx(t))}_showCtx(e){let t=new ds({items:[new Wn({text:"Palette",checked:this.m_palmode,click:()=>{this.m_palmode=!this.m_palmode,Fu.last_palmode=this.m_palmode,this.update()}})]}),i=xi(e,!0);t.displayAt(i.x,i.y)}render(e){if(this.m_baseColor=e.color,this.m_baseHSV=Re.toHSV(this.m_baseColor),this.m_palmode){let i=f(function(a){l=[],a.forEach(c=>{let u=new Re(c.hex),_=u.value()==o,p=Ln("hclr-box xbox",{selected:_}),v=new F({cls:p,style:{backgroundColor:u.toHex(),color:Re.contrastColor(u).toHex()},data:{color:u.value()},content:u.toHex()});l.push(v),_&&(r=v)}),s&&s.itemWithId("vsel").setContent(l)},"fillSubs2");var t=i;b(i,"fillSubs"),this.addClass("pal-mode");let s=null,r=null,n=[],l=[],o=this.m_baseColor.value();Mb.forEach(a=>{let c=a.variations[4].hex,u=c===o;u||(u=a.variations.some(v=>{if(new Re(v.hex).value()===o)return!0}));let _=Ln("clr-box xbox",{selected:u}),p=new F({cls:_,style:{backgroundColor:new Re(c).toHex()},data:{color:c,main:a.variations}});u&&i(a.variations),n.push(p)}),s=new kt({content:[new he({id:"hsel",content:n}),new kt({id:"vsel",flex:1,content:l})]}),this.m_colorEdit=new yi({cls:"hexv",value:"",attrs:{spellcheck:!1},change:a=>{let c=new Re(a.value);c&&(this.m_baseColor=c,this.m_baseHSV=Re.toHSV(c),this._updateColor(!1))}}),this.m_transpCk=new ph({cls:"transp",text:"transparent",change:a=>{this.m_baseHSV.a=a.value?0:1,this._updateColor()}}),this.setContent([s,this.m_transpCk,this.m_colorEdit]),s.setDomEvent("click",a=>{r&&(r.removeClass("selected"),r=null);let c=F.getElement(a.target,"xbox");if(c){let u=c.getData("main");if(u)i(u);else{let _=new Re(c.getData("color"));this.m_baseColor=_,this.m_baseHSV=Re.toHSV(_),this._updateColor(),r=c,c.addClass("selected")}}})}else this.removeClass("pal-mode"),this.m_selMark=new F({cls:"marker"}),this.m_colorSel=new F({cls:"sel",content:[new F({cls:"@fit light"}),new F({cls:"@fit dark"}),this.m_selMark]}),this.m_hueMark=new F({cls:"marker"}),this.m_colorHue=new F({cls:"hue",content:[this.m_hueMark]}),this.m_sample=new F({cls:"sample"}),e.hasAlpha?(this.addClass("with-alpha"),this.m_alphaMark=new F({cls:"marker"}),this.m_colorAlpha=new F({cls:"alpha",content:[new F({cls:"bk @fit",ref:"color"}),this.m_alphaMark]})):(this.removeClass("with-alpha"),this.m_transpCk=new ph({cls:"transp",text:"transparent",change:i=>{this.m_baseHSV.a=i.value?0:1,this._updateColor()}})),this.m_colorEdit=new yi({cls:"hexv",value:"",attrs:{spellcheck:!1},change:i=>{let s=new Re(i.value);s&&(this.m_baseColor=s,this.m_baseHSV=Re.toHSV(s),this._updateColor(!1))}}),this.setContent([this.m_colorSel,this.m_colorHue,this.m_colorAlpha,this.m_transpCk,this.m_colorEdit,this.m_sample]),this.m_colorSel.setDomEvent("mousedown",i=>{F.setCapture(this,s=>this._selChange(s))}),this.m_colorHue.setDomEvent("mousedown",i=>{F.setCapture(this,s=>this._hueChange(s))}),e.hasAlpha&&this.m_colorAlpha.setDomEvent("mousedown",i=>{F.setCapture(this,s=>this._alphaChange(s))}),this._updateColor()}set color(e){this.m_baseColor=e,this.m_baseHSV=Re.toHSV(this.m_baseColor),this._updateColor()}get color(){return this.m_baseColor}_selChange(e){let t=xi(e,!0);console.log(t);let i=this.m_colorSel.getBoundingRect();this.m_props.hasAlpha||(this.m_baseHSV.a=1),this.m_baseHSV.s=er((t.x-i.left)/i.width,0,1),this.m_baseHSV.v=1-er((t.y-i.top)/i.height,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&F.releaseCapture()}_hueChange(e){let t=xi(e,!0),i=this.m_colorHue.getBoundingRect();this.m_baseHSV.h=er((t.y-i.top)/i.height,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&F.releaseCapture()}_alphaChange(e){let t=xi(e,!0),i=this.m_colorAlpha.getBoundingRect();this.m_baseHSV.a=er((t.x-i.left)/i.width,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&F.releaseCapture()}_updateColor(e=!0){let t;if(this.m_palmode)this.m_transpCk.check=this.m_baseHSV.a==0;else{if(t=Re.fromHSV(this.m_baseHSV.h,1,1,1),this.m_colorSel.setStyleValue("backgroundColor",t.toString()),t=Re.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,1),this.m_sample.setStyleValue("backgroundColor",t.toString()),this.m_props.hasAlpha){let i=`linear-gradient(to right, rgba(0,0,0,0) 0%, ${t.toString()} 100%)`;this.m_colorAlpha.itemWithRef("color").setStyleValue("backgroundImage",i)}this.m_selMark.setStyle({left:this.m_baseHSV.s*100+"%",top:100-this.m_baseHSV.v*100+"%"}),this.m_hueMark.setStyle({top:this.m_baseHSV.h*100+"%"}),this.m_props.hasAlpha?this.m_alphaMark.setStyle({left:this.m_baseHSV.a*100+"%"}):this.m_transpCk.check=this.m_baseHSV.a==0}t=Re.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,this.m_baseHSV.a),this.m_baseColor=t,e&&(this.m_colorEdit.value=t.alpha()==1?t.toHex():t.toString()),this._change()}_change(){this.emit("change",Oe(this.m_baseColor))}},"_ColorPicker"),Qd=Fu;b(Qd,"ColorPicker");pe(Qd,"last_palmode",!1);var gh=f(class extends bm{m_picker;constructor(e){e.icon=void 0,e.buttons=void 0,super(e),this.mapPropEvents(e,"change"),this.m_picker=new Qd({color:e.color,hasAlpha:e.hasAlpha,style:{padding:8},width:250,height:250});let t=this._makeCustoms(e.cust_colors);this.form.updateContent([new kt({content:[this.m_picker,t]})],["ok","cancel"]),this.on("btnClick",i=>{i.button=="ok"&&this.emit("change",Oe(this.m_picker.color))})}_makeCustoms(e){let t=null;if(e&&e.length>0){let i=[];for(let s=0;s<e.length;s+=8){let r=[];for(let n=0;n<8;n++){let l=s+n,o=e[l];r.push(new je({cls:"cust-cc",text:"",flex:1,style:{backgroundColor:o?o.toString():"transparent"},tooltip:o?o.toString():void 0,dom_events:{click:()=>{o&&(this.m_picker.color=o,this.emit("change",Oe(o)),this.close())}}}))}i.push(new he({cls:"line",content:r}))}t=new kt({cls:"customs",content:i})}return t}set color(e){this.m_picker.color=e}get color(){return this.m_picker.color}static show(e){let t;return Me(e)?t=new gh({color:new Re(e)}):t=new gh(e),t.show(),t}},"ColorPickerBox");b(gh,"ColorPickerBox");var Ab=f(class extends he{constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){let t=e.color,i;this._isTransp(t)?(t=Re.NONE,i="black"):i=Re.contrastColor(t).toString(),this.setContent([e.label?new je({cls:"label",text:e.label,flex:e.labelWidth<0?-e.labelWidth:void 0,width:e.labelWidth>=0?e.labelWidth:void 0}):null,new F({flex:1,content:[new je({cls:"alpha @fit",text:""}),new je({cls:"value @fit",text:e.displayValue===!1?"":t.toHex(),style:{backgroundColor:t.toString(),color:i},dom_events:{click:()=>this._showPicker()}})]})]),e.displayValue===!1&&this.setStyleValue("background-image","url( 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAEsmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIKICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIKICAgIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIgogICAgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSIKICAgdGlmZjpJbWFnZVdpZHRoPSIxMCIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgeG1wOk1vZGlmeURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiPgogICA8eG1wTU06SGlzdG9yeT4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJwcm9kdWNlZCIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWZmaW5pdHkgRGVzaWduZXIgMS45LjAiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/Pn8+b7YAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRy0tCQRSHv7Qwyh5gRIsWEtZKwwyiNi2UXlAt1CCrjV5fgdrlXiOibdBWKIja9FrUX1DboHUQFEUQ7YLWRW0qbueqoESe4cz55jdzDjNnwBLOKFm93gvZXF4LTvid85EFp+0FK5204sURVXR1JjQepqZ93lNnxluPWav2uX+tOZ7QFahrFB5VVC0vPCk8vZZXTd4R7lDS0bjwmbBbkwsK35l6rMSvJqdK/G2yFg4GwNIu7ExVcayKlbSWFZaX48pmVpXyfcyX2BO5uZDEHvFudIJM4MfJFGMEGGKAEZmH8OCjX1bUyPcW82dZkVxFZpV1NJZJkSaPW9RVqZ6QmBQ9ISPDutn/v33Vk4O+UnW7HxqeDeO9F2zb8FMwjK8jw/g5BusTXOYq+SuHMPwheqGiuQ6gbRPOrypabBcutqDrUY1q0aJkFbckk/B2Ci0RcNxA02KpZ+V9Th4gvCFfdQ17+9An59uWfgF7Hmfv4QYbGAAAAAlwSFlzAAALEwAACxMBAJqcGAAAACdJREFUGJVjbGhoYEAC9fX1yFwmBryAptKM////R+Y3NjbSzW4C0gAo9QeQBmhTIwAAAABJRU5ErkJggg=='"),this._setTabIndex(e.tabIndex)}set value(e){this.m_props.color=e,this.update()}get value(){return this.m_props.color}set custom_colors(e){this.m_props.cust_colors=e}_showPicker(){let e=new gh({color:this.m_props.color,cust_colors:this.m_props.cust_colors,hasAlpha:this.m_props.hasAlpha,events:{change:i=>{this.m_props.color=i.value,this._change(),this.update()}}}),t=this.getBoundingRect();e.displayAt(t.left,t.bottom,"tl")}_change(){this.emit("change",Oe(this.m_props.color))}_isTransp(e){return!e.alpha()}},"ColorPickerEditor");b(Ab,"ColorPickerEditor");var Mb=[{color:"Red",variations:[{weight:50,hex:16772078},{weight:100,hex:16764370},{weight:200,hex:15702682},{weight:300,hex:15037299},{weight:400,hex:15684432},{weight:500,hex:16007990},{weight:600,hex:15022389},{weight:700,hex:13840175},{weight:800,hex:12986408},{weight:900,hex:12000284}]},{color:"Pink",variations:[{weight:50,hex:16573676},{weight:100,hex:16301008},{weight:200,hex:16027569},{weight:300,hex:15753874},{weight:400,hex:15483002},{weight:500,hex:15277667},{weight:600,hex:14162784},{weight:700,hex:12720219},{weight:800,hex:11342935},{weight:900,hex:8916559}]},{color:"Purple",variations:[{weight:50,hex:15984117},{weight:100,hex:14794471},{weight:200,hex:13538264},{weight:300,hex:12216520},{weight:400,hex:11225020},{weight:500,hex:10233776},{weight:600,hex:9315498},{weight:700,hex:8069026},{weight:800,hex:6953882},{weight:900,hex:4854924}]},{color:"Deep Purple",variations:[{weight:50,hex:15591414},{weight:100,hex:13747433},{weight:200,hex:11771355},{weight:300,hex:9795021},{weight:400,hex:8280002},{weight:500,hex:6765239},{weight:600,hex:6174129},{weight:700,hex:5320104},{weight:800,hex:4532128},{weight:900,hex:3218322}]},{color:"Indigo",variations:[{weight:50,hex:15264502},{weight:100,hex:12962537},{weight:200,hex:10463450},{weight:300,hex:7964363},{weight:400,hex:6056896},{weight:500,hex:4149685},{weight:600,hex:3754411},{weight:700,hex:3162015},{weight:800,hex:2635155},{weight:900,hex:1713022}]},{color:"Blue",variations:[{weight:50,hex:14938877},{weight:100,hex:12312315},{weight:200,hex:9489145},{weight:300,hex:6600182},{weight:400,hex:4367861},{weight:500,hex:2201331},{weight:600,hex:2001125},{weight:700,hex:1668818},{weight:800,hex:1402304},{weight:900,hex:870305}]},{color:"Light Blue",variations:[{weight:50,hex:14808574},{weight:100,hex:11789820},{weight:200,hex:8508666},{weight:300,hex:5227511},{weight:400,hex:2733814},{weight:500,hex:240116},{weight:600,hex:236517},{weight:700,hex:166097},{weight:800,hex:161725},{weight:900,hex:87963}]},{color:"Cyan",variations:[{weight:50,hex:14743546},{weight:100,hex:11725810},{weight:200,hex:8445674},{weight:300,hex:5099745},{weight:400,hex:2541274},{weight:500,hex:48340},{weight:600,hex:44225},{weight:700,hex:38823},{weight:800,hex:33679},{weight:900,hex:24676}]},{color:"Teal",variations:[{weight:50,hex:14742257},{weight:100,hex:11722715},{weight:200,hex:8440772},{weight:300,hex:5093036},{weight:400,hex:2533018},{weight:500,hex:38536},{weight:600,hex:35195},{weight:700,hex:31083},{weight:800,hex:26972},{weight:900,hex:19776}]},{color:"Green",variations:[{weight:50,hex:15267305},{weight:100,hex:13166281},{weight:200,hex:10868391},{weight:300,hex:8505220},{weight:400,hex:6732650},{weight:500,hex:5025616},{weight:600,hex:4431943},{weight:700,hex:3706428},{weight:800,hex:3046706},{weight:900,hex:1793568}]},{color:"Light Green",variations:[{weight:50,hex:15857897},{weight:100,hex:14478792},{weight:200,hex:12968357},{weight:300,hex:11457921},{weight:400,hex:10275941},{weight:500,hex:9159498},{weight:600,hex:8172354},{weight:700,hex:6856504},{weight:800,hex:5606191},{weight:900,hex:3369246}]},{color:"Lime",variations:[{weight:50,hex:16382951},{weight:100,hex:15791299},{weight:200,hex:15134364},{weight:300,hex:14477173},{weight:400,hex:13951319},{weight:500,hex:13491257},{weight:600,hex:12634675},{weight:700,hex:11514923},{weight:800,hex:10394916},{weight:900,hex:8550167}]},{color:"Yellow",variations:[{weight:50,hex:16776679},{weight:100,hex:16775620},{weight:200,hex:16774557},{weight:300,hex:16773494},{weight:400,hex:16772696},{weight:500,hex:16771899},{weight:600,hex:16635957},{weight:700,hex:16498733},{weight:800,hex:16361509},{weight:900,hex:16088855}]},{color:"Amber",variations:[{weight:50,hex:16775393},{weight:100,hex:16772275},{weight:200,hex:16769154},{weight:300,hex:16766287},{weight:400,hex:16763432},{weight:500,hex:16761095},{weight:600,hex:16757504},{weight:700,hex:16752640},{weight:800,hex:16748288},{weight:900,hex:16740096}]},{color:"Orange",variations:[{weight:50,hex:16774112},{weight:100,hex:16769202},{weight:200,hex:16764032},{weight:300,hex:16758605},{weight:400,hex:16754470},{weight:500,hex:16750592},{weight:600,hex:16485376},{weight:700,hex:16088064},{weight:800,hex:15690752},{weight:900,hex:15094016}]},{color:"Deep Orange",variations:[{weight:50,hex:16509415},{weight:100,hex:16764092},{weight:200,hex:16755601},{weight:300,hex:16747109},{weight:400,hex:16740419},{weight:500,hex:16733986},{weight:600,hex:16011550},{weight:700,hex:15092249},{weight:800,hex:14172949},{weight:900,hex:12531212}]},{color:"Brown",variations:[{weight:50,hex:15723497},{weight:100,hex:14142664},{weight:200,hex:12364452},{weight:300,hex:10586239},{weight:400,hex:9268835},{weight:500,hex:7951688},{weight:600,hex:7162945},{weight:700,hex:6111287},{weight:800,hex:5125166},{weight:900,hex:4073251}]},{color:"Grey",variations:[{weight:50,hex:16448250},{weight:100,hex:16119285},{weight:200,hex:15658734},{weight:300,hex:14737632},{weight:400,hex:12434877},{weight:500,hex:10395294},{weight:600,hex:7697781},{weight:700,hex:6381921},{weight:800,hex:4342338},{weight:900,hex:2171169}]},{color:"Blue Grey",variations:[{weight:50,hex:15527921},{weight:100,hex:13621468},{weight:200,hex:11583173},{weight:300,hex:9479342},{weight:400,hex:7901340},{weight:500,hex:6323595},{weight:600,hex:5533306},{weight:700,hex:4545124},{weight:800,hex:3622735},{weight:900,hex:2503224}]},{color:"Grey",variations:[{weight:50,hex:16777215},{weight:100,hex:14737632},{weight:200,hex:12895428},{weight:300,hex:11053224},{weight:400,hex:9211020},{weight:500,hex:7368816},{weight:600,hex:5526612},{weight:700,hex:3684408},{weight:800,hex:1842204},{weight:900,hex:0}]}];function Os(e,t){return ke({type:e,id:t})}h(Os,"EvDataChange");m(Os,"EvDataChange");d(Os,"EvDataChange");f(Os,"EvDataChange");b(Os,"EvDataChange");var fg=f(class{name;id;fields;constructor(e){this.name=e,this.id=void 0,this.fields=[]}},"MetaInfos");b(fg,"MetaInfos");var Va=Symbol("metaField");function mr(e,t=!0){let i=e.constructor,s=i.hasOwnProperty(Va)?i[Va]:void 0;if(s===void 0){t||console.assert(s!==void 0),s=new fg(i.name);let r=Object.getPrototypeOf(i);if(r!=xm){let n=r[Va];s.fields=[...n.fields,...s.fields],console.assert(s.id===void 0,"cannot define mutiple record id"),s.id||(s.id=n.id)}e.constructor[Va]=s}return s}h(mr,"_getMetas");m(mr,"_getMetas");d(mr,"_getMetas");f(mr,"_getMetas");b(mr,"_getMetas");var Gf;(e=>{function t(){return(u,_)=>{let p=mr(u);p.fields.push({name:_,type:"any",required:!0}),p.id=_}}h(t,"id"),m(t,"id"),d(t,"id"),f(t,"id"),e.id=t,b(t,"id");function i(u){return(_,p)=>{mr(_).fields.push({name:p,...u})}}h(i,"field"),m(i,"field"),d(i,"field"),f(i,"field"),e.field=i,b(i,"field");function s(u){return i({...u,type:"string"})}h(s,"string"),m(s,"string"),d(s,"string"),f(s,"string"),e.string=s,b(s,"string");function r(u){return i({...u,type:"int"})}h(r,"int"),m(r,"int"),d(r,"int"),f(r,"int"),e.int=r,b(r,"int");function n(u){return i({...u,type:"float"})}h(n,"float"),m(n,"float"),d(n,"float"),f(n,"float"),e.float=n,b(n,"float");function l(u){return i({...u,type:"bool"})}h(l,"bool"),m(l,"bool"),d(l,"bool"),f(l,"bool"),e.bool=l,b(l,"bool");function o(u){return i({...u,type:"date"})}h(o,"date"),m(o,"date"),d(o,"date"),f(o,"date"),e.date=o,b(o,"date");function a(u){return i({...u,type:"calc"})}h(a,"calc"),m(a,"calc"),d(a,"calc"),f(a,"calc"),e.calc=a,b(a,"calc");function c(u,_){return e.field({..._,type:"array",model:new u})}h(c,"array"),m(c,"array"),d(c,"array"),f(c,"array"),e.array=c,b(c,"array")})(Gf||(Gf={}));var xm=f(class{constructor(e,t){e!==void 0&&this.unSerialize(e,t)}clone(e){let t=new this.constructor;return e&&t.unSerialize(e),t}getID(){let e=mr(this,!1);return this[e.id]}getFields(){return mr(this,!1).fields}validate(){let e=null;return this.getFields().forEach(i=>{i.required&&!this.getField(i.name)&&(e&&(e=[]),e.push(new Error(`field ${i.name} is required.`)))}),e}getFieldIndex(e){return this.getFields().findIndex(i=>i.name==e)}serialize(){let e={};return this.getFields().forEach(t=>{t.calc===void 0&&(e[t.name]=e[t.name])}),e}unSerialize(e,t){let i=this.getFields();return i.forEach(s=>{let r=e[s.name];r!==void 0&&(this[s.name]=this._convertField(s,r))}),t!==void 0?this[i[0].name]=t:console.assert(this.getID()!==void 0),this}_convertField(e,t){switch(e.type){case"float":{let i=typeof t=="number"?t:parseFloat(t);if(e.prec!==void 0){let s=Math.pow(10,e.prec);i=Math.round(i*s)/s}return i}case"int":return typeof t=="number"?t:parseInt(t);case"date":return Me(t)?new Date(t):t;case"array":{let i=[];if(e.model)return t.forEach(s=>{i.push(e.model.clone(s))}),i;break}}return t}getRaw(e){let t,i=this.getFields();if(typeof e=="string"){if(t=i.findIndex(r=>r.name==e),t<0){console.assert(!1,"unknown field: "+e);return}}else if(e>=0&&e<i.length)t=e;else{console.assert(!1,"bad field name: "+e);return}let s=i[t];return s.calc!==void 0?s.calc(this):this[s.name]}setRaw(e,t){this[e]=t}getField(e){let t=this.getRaw(e);return t==null?"":""+t}setField(e,t){let i=this.getFields(),s=i.findIndex(n=>n.name==e);if(s<0){console.assert(!1,"unknown field: "+e);return}let r=i[s];if(r.calc!==void 0){console.assert(!1,"cannot set calc field: "+e);return}this.setRaw(r.name,t)}},"Record");b(xm,"Record");var pg=f(class extends xm{m_data;m_fid;constructor(e){super(),this.m_data=e}getID(){if(!this.m_fid){let e=Object.keys(this.m_data);this.m_fid=e[0]}return this.m_data[this.m_fid]}getFields(){return Object.keys(this.m_data).map(i=>({name:i}))}getRaw(e){return this.m_data[e]}setRaw(e,t){this.m_data[e]=t}clone(e){return new pg({...e})}},"AutoRecord");b(pg,"AutoRecord");var gg=f(class extends sl{constructor(e){super(e)}load(e){e&&(this.m_props.url=e),this._refresh()}_refresh(e=0){let t=b(async()=>{let i=this.m_props.url;this.m_props.params&&(i+="?"+this.m_props.params.join("&"));let s=await fetch(i);if(s.ok){let r=await s.json(),n=r;this.m_props.solver&&(n=this.m_props.solver(n)),this.emit("change",Oe(n,r))}},"load");e?setTimeout(t,e):t()}},"DataProxy");b(gg,"DataProxy");var e_=f(class extends Po{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 gg({url:e.url,solver:e.solver,events:{change:t=>{this.setData(t.value)}}}),this.m_proxy.load())}load(e){this.m_proxy.load(e)}reload(){this.m_proxy.load()}setData(e){let t=[];e.forEach(i=>{t.push(this.m_model.clone(i))}),this.setRawData(t)}setRawData(e){this.m_records=e,this._rebuildIndex(),this.emit("data_change",Os("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=e.getID(),i=this.indexOfId(t);return i<0?!1:(this.m_records[this.m_rec_index[i]]=e,this.emit("data_change",Os("update",t)),!0)}append(e){e instanceof xm||(e=this.m_model.clone().unSerialize(e)),console.assert(e.getID()),this.m_records.push(e),this._rebuildIndex(),this.emit("data_change",Os("create",e.getID()))}getMaxId(){let e;return this.m_records.forEach(t=>{let i=t.getID();(e===void 0||e<i)&&(e=i)}),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.emit("data_change",Os("delete",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){for(let t=this.count,i=0;t!=0;t>>=1){let s=i+(t>>1),r=this.m_rec_index[s],n=this.m_records[r].getID();if(n==e)return s;n<e&&(i=s+1,t--)}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){return this.m_records[e]??null}moveTo(e){e.setRawData(this.m_records)}createView(e){let t={...e,store:this};return new vg(t)}createIndex(e){if(e&&e.op==="empty-result")return new Uint32Array(0);let t=new Uint32Array(this.m_records.length),i=0;if(!e)this.forEach((u,_)=>{t[i++]=_});else if(typeof e.op=="function"){let u=e.op;this.forEach((_,p)=>{_&&u(_)&&(t[i++]=p)})}else{let u=f(function(w){return w<k},"_lt2"),_=f(function(w){return w<=k},"_le2"),p=f(function(w){return w==k},"_eq2"),v=f(function(w){return w!=k},"_neq2"),g=f(function(w){return w>=k},"_ge2"),x=f(function(w){return w>k},"_gt2"),E=f(function(w){return S.lastIndex=-1,S.test(w)},"_re2");var s=u,r=_,n=p,l=v,o=g,a=x,c=E;b(u,"_lt"),b(_,"_le"),b(p,"_eq"),b(v,"_neq"),b(g,"_ge"),b(x,"_gt"),b(E,"_re");let y=this.m_model.getFieldIndex(e.field);if(y<0)return console.assert(!1,"unknown field name in filter"),new Uint32Array(0);let k=e.value;Me(k)&&!e.caseSensitive&&(k=k.toUpperCase());let A,S;if(k instanceof RegExp)S=k,A=E;else switch(e.op){case"<":{A=u;break}case"<=":{A=_;break}case"=":{A=p;break}case">=":{A=g;break}case">":{A=x;break}case"<>":{A=v;break}}this.forEach((w,D)=>{if(!w)return;let R=w.getRaw(y);R==null?R="":(R=""+R,e.caseSensitive||(R=R.toUpperCase())),A(R)&&(t[i++]=D)})}return t.slice(0,i)}sortIndex(e,t){let i=0,s=[];if(t===null?s.push({fidx:0,asc:!0}):s=t.map(r=>{let n=this.m_model.getFieldIndex(r.field);return n==-1&&(console.assert(!1,"unknown field name in sort"),i++),{fidx:n,asc:r.ascending}}),i||s.length==0)return e;if(s.length==1){let r=s[0].fidx;e.sort((n,l)=>{let o=this.getByIndex(n).getRaw(r)??"",a=this.getByIndex(l).getRaw(r)??"";return o>a?1:o<a?-1:0}),s[0].asc||e.reverse()}else e.sort((r,n)=>{for(let l=0;l<s.length;l++){let o=s[l].fidx,a=s[l].asc?1:-1,c=this.getByIndex(r).getRaw(o)??"",u=this.getByIndex(n).getRaw(o)??"";if(c>u)return a;if(c<u)return-a}return 0});return e}forEach(e){this.m_rec_index?this.m_rec_index.some((t,i)=>{if(e(this.m_records[t],i))return i}):this.m_records.some((t,i)=>{if(t&&e(t,i))return i})}export(){return this.m_records}changed(){this.emit("data_change",Os("change"))}},"DataStore");b(e_,"DataStore");function ir(e){return ke({action:e})}h(ir,"EvViewChange");m(ir,"EvViewChange");d(ir,"EvViewChange");f(ir,"EvViewChange");b(ir,"EvViewChange");var vg=f(class extends sl{m_index;m_store;m_sort;m_filter;constructor(e){super(e),this.m_store=e.store,this.m_index=null,this.m_filter=null,this.m_sort=null,this.filter(e.filter),e.order?Me(e.order)?this.sort([{field:e.order,ascending:!0}]):Wt(e.order)?this.sort(e.order):this.sort([e.order]):this.sort(null),this.m_store.on("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.emit("view_change",ir("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.emit("view_change",ir("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.emit("view_change",ir("sort"))}get store(){return this.m_store}get count(){return this.m_index.length}indexOfId(e){let t=this.m_store.indexOfId(e);return this.m_index.findIndex(i=>i===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}getById(e){return this.m_store.getById(e)}changed(){this.emit("view_change",ir("change"))}forEach(e){debugger;this.m_index.some(t=>{let i=this.m_store.getByIndex(t);if(i&&e(i,t))return t})}},"DataView");b(vg,"DataView");var zu=f(class extends he{m_ui_input;m_ui_button;m_popup;m_lockpop;m_lockchg;m_popvis;m_selection;constructor(e){super(e),e.editable||this.setDomEvent("keypress",()=>this.showPopup()),this.setDomEvent("click",()=>{this.m_props.editable&&this.m_ui_input.focus(),this.showPopup()}),this.setDomEvent("keydown",t=>this._onKey(t)),this.mapPropEvents(e,"selectionChange"),this.m_popvis=!1,this.m_lockpop=!1,this.m_lockchg=!1}_onKey(e){this.m_popvis&&(e.key=="ArrowUp"||e.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(e),this.m_lockpop=!1,e.preventDefault(),e.stopPropagation()):e.key=="Escape"&&(this._hidePopup(),e.preventDefault(),e.stopPropagation()))}set items(e){this.m_props.items=e,this.m_popup&&(this.m_popup.items=e)}render(e){if(e.renderer)this.m_ui_input=new F({flex:1,cls:"@fake-input @hlayout",tabIndex:1});else{let r=new es({flex:1,readOnly:!this.m_props.editable,tabIndex:0,name:e.name,value_hook:{get:()=>this.value,set:n=>{this.value=n}},dom_events:{focus:()=>{this.m_props.editable&&r.value.length==0&&this.showPopup()},input:()=>{if(this.m_lockchg)return;let n=r.value;this.m_selection={id:void 0,text:n};let l=this.showPopup();l&&l.length&&l[0].text==n&&(this.m_selection={id:l[0].id,text:n})}}});this.m_ui_input=r}let t,i,s=e.labelWidth??0;s>0?t=s:s<0&&(i=-s),this.setContent([new je({cls:"label1"+(e.label?"":" @hidden"),text:e.label,width:t,flex:i,align:e.labelAlign}),new he({flex:1,content:[this.m_ui_input,this.m_ui_button=new wt({cls:"gadget",icon:"var( --x4-icon-angle-down )",tabIndex:!1,click:()=>{this.showPopup(!1)},dom_events:{focus:()=>{this.dom.focus()}}})]})]),e.value!==void 0&&(this.value=e.value)}componentDisposed(){this.m_popup&&this.m_popup.close(),super.componentDisposed()}showPopup(e=!0){let t=this.m_props;if(t.readOnly||this.hasClass("@disable"))return null;let i=t.items;if(ei(i)){let n=e?this.m_ui_input.value:null;i=i(n)}if(i.length==0)return null;if(!this.m_popup){let n=this.getComputedStyle(),l=n.value("fontFamily"),o=n.value("fontSize");this.m_popup=new Yd({cls:"@combo-popup",populate:t.populate,renderItem:this.m_props.renderer,selectionChange:a=>{this._selectItem(a),this.m_lockpop||(this._hidePopup(),this.focus())},cancel:a=>this.signal("cancel",a),style:{fontFamily:l,fontSize:o}})}this.m_popup.items=i;let s=this.m_ui_button.getBoundingRect(),r=this.m_ui_input.getBoundingRect();return this.m_popup.setStyle({minWidth:s.right-r.left}),this.m_popup.displayAt(r.left,r.bottom),this.m_popvis=!0,this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.value!==void 0&&(this.m_popup.selection=this.value),i}_selectItem(e){let t=e.selection;t&&(this.m_lockchg=!0,this._setInput(t,!0),this.m_lockchg=!1,this.m_selection={id:t.id,text:t.text},this.emit("selectionChange",ui(t)),this.emit("change",Oe(t.id)))}_setInput(e,t=!1){e?this.m_ui_input?this.m_ui_input instanceof es?(this.m_ui_input.value=e.text,t&&this.m_ui_input.dom.dispatchEvent(new Event("input"))):this.m_ui_input.setContent(this.m_props.renderer(e)):this.m_props.value=e.id:this.m_ui_input&&this.m_ui_input instanceof es&&(this.m_ui_input.value="")}get value(){return this.m_selection?this.m_selection.id:void 0}get valueText(){return this.m_selection?this.m_selection.text:this.m_props.editable?this.m_ui_input.value:""}set value(e){let t=this.m_props.items;ei(t)&&(t=t(null)),t.some(s=>{if(s.id===e)return this._setInput(s),this.m_selection=s,!0})||(this._setInput(null),this.m_selection=null)}get input(){return this.m_ui_input instanceof es?this.m_ui_input:null}_checkFocus(){let e=document.activeElement;this.dom&&this.dom.contains(e)||e==document.body||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(e)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1,this.stopTimer("focus-check"))}static storeProxy(e){let t=e.store instanceof e_?e.store.createView():e.store;return()=>{let i=new Array(e.store.count);return e.store.forEach((s,r)=>{i[r]={id:s.getID(),text:e.display(s)}}),i}}focus(){this.m_props.editable?this.m_ui_input.focus():super.focus()}},"ComboBox");b(zu,"ComboBox");var cu=Symbol("x-drag-cb"),wg=f(class{dragSource;dragGhost;dropTarget;notified;timer;registerDraggableElement(e){e.setDomEvent("dragstart",t=>{this.dragSource=e,this.dragGhost=e.dom.cloneNode(!0),this.dragGhost.classList.add("dragged"),O.body.appendChild(this.dragGhost),e.addClass("dragging"),t.dataTransfer.setData("text/string","1"),t.dataTransfer.setDragImage(new Image,0,0),t.stopPropagation()}),e.setDomEvent("drag",t=>{this.dragGhost.style.left=t.pageX+"px",this.dragGhost.style.top=t.pageY+"px"}),e.setDomEvent("dragend",t=>{e.removeClass("dragging"),this.dragGhost.remove()}),e.setAttribute("draggable","true")}registerDropTarget(e,t,i){let s=b(o=>{if(i&&!i(this.dragSource)){console.log("reject ",e),o.dataTransfer.dropEffect="none";return}console.log("accepted ",e),o.preventDefault(),o.dataTransfer.dropEffect="copy"},"dragEnter"),r=b(o=>{if(i&&!i(this.dragSource)){console.log("reject ",e),o.dataTransfer.dropEffect="none";return}if(o.preventDefault(),this.dropTarget!=e&&(this.dropTarget=e,this._startCheck()),this.dropTarget){let a={pt:new Yi(o.pageX,o.pageY),data:o.dataTransfer};t("drag",this.dragSource,a)}o.dataTransfer.dropEffect="copy"},"dragOver"),n=b(o=>{this.dropTarget=null,o.preventDefault()},"dragLeave"),l=b(o=>{let a={pt:new Yi(o.pageX,o.pageY),data:o.dataTransfer};t("drop",this.dragSource,a),this.dropTarget=null,e.removeClass("drop-over"),o.preventDefault()},"drop");e.setDomEvent("dragenter",s),e.setDomEvent("dragover",r),e.setDomEvent("dragleave",n),e.setDomEvent("drop",l),e.setData(cu,t)}_startCheck(){this.timer&&(clearInterval(this.timer),this._check()),this.timer=setInterval(()=>this._check(),300)}_check(){let e=b(i=>{i.removeClass("drop-over"),i.getData(cu)("leave",this.dragSource)},"leaving"),t=b(i=>{i.addClass("drop-over"),i.getData(cu)("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))}},"DragManager");b(wg,"DragManager");var pC=new wg,Pb={align:"center",vAlign:"middle",fontSize:14,fontWeight:null,fontStyle:"",fontVariant:"",fontFamily:"Arial",lineHeight:0,clip:!0,columns:1,columnGap:0,lineBreak:!0};function Cm(e,t,i,s){if(i.width<=0||i.height<=0)return;if(s={...Pb,...s},e.save(),s.clip&&(e.beginPath(),e.rect(i.left,i.top,i.width,i.height),e.clip()),s.rotation){let C=new Yi(i.left+i.width/2,i.top+i.height/2),z=s.rotation/180*Math.PI;e.translate(C.x,C.y),e.rotate(z),e.translate(-C.x,-C.y)}e.textBaseline="bottom";let r=ur(s.fontSize,2)??12,n="";s.fontStyle&&(n+=s.fontStyle+" "),s.fontVariant&&(n+=s.fontVariant+" "),s.fontWeight&&(n+=s.fontWeight+" "),n+=r+"px ";let l=s.fontFamily??"sans-serif";l.indexOf(".")>0&&(l='"'+l+'"'),n+=l,e.font=n.trim();let o=[],a=t.split(`
|
|
13
|
+
`),c=s.columns<1?1:s.columns,u=s.columnGap,_=(i.width-u*(c-1))/c,p=i.left,v=_;s.lineBreak||(v=99999999);let g=Vr(e," ");a.forEach(C=>{let z={width:0,words:[],space:0},W=Vr(e,C);if(W<v)z.width=W,z.words.push({width:W,text:C}),o.push(z);else{let ve=C.split(/\s/).filter(K=>K!=="").map(K=>({width:Vr(e,K),text:K})),te=0,ie=0;for(;te<ve.length;){let K=ve[te],Y=z.width;Y&&(Y+=g),Y+=K.width,Y>_&&ie>0?(o.push(z),ie=0,W=0,z={width:0,words:[],space:0}):(z.words.push(K),z.width=Y,te++,ie++)}ie&&(o.push(z),z.last=!0)}});let x=ia(e,"Ag"),E=(s.lineHeight??1.3)*x,y=o.length,k=i.top;if(c==1){let C=E*y;y==1&&(E=x,C=x),s.vAlign==="middle"?(k=i.top+i.height/2-C/2,k+=E/2,e.textBaseline="middle"):s.vAlign==="bottom"?C<i.height&&(k=i.top+i.height-C+E):(k=i.top,e.textBaseline="top")}else k+=x;let A=s.align=="justify",S=c,w=k,D=0;switch(s.align){case"right":D=1;break;case"center":D=2;break}let R=0;return o.some(C=>{C.space=g,A&&!C.last&&sa(C,_,g);let z=p,W=0;if(D==1?z+=_-C.width:D==2&&(z+=_/2-C.width/2),C.words.forEach(J=>{e.fillText(J.text,z,w),z+=J.width+C.space,W+=J.width+C.space}),w+=E,R<W&&(R=W),w>i.bottom+E&&(w=k,p+=_+u,--S==0))return!0}),e.restore(),{width:R,height:(o.length+.3)*E}}h(Cm,"drawText");m(Cm,"drawText");d(Cm,"drawText");f(Cm,"drawText");b(Cm,"drawText");function ia(e,t){let i=e.measureText(t);return i.actualBoundingBoxAscent+i.actualBoundingBoxDescent}h(ia,"_calcTextHeight");m(ia,"_calcTextHeight");d(ia,"_calcTextHeight");f(ia,"_calcTextHeight");b(ia,"_calcTextHeight");function Vr(e,t){return ur(e.measureText(t).width,2)}h(Vr,"_measureText");m(Vr,"_measureText");d(Vr,"_measureText");f(Vr,"_measureText");b(Vr,"_measureText");function sa(e,t,i){let s=(t-e.width)/(e.words.length-1)+i;s<=0||(e.width=t,e.space=s)}h(sa,"_justify");m(sa,"_justify");d(sa,"_justify");f(sa,"_justify");b(sa,"_justify");var uu="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";function Gn(e){return e.substr(0,5)=="data:"}h(Gn,"_isStaticImage");m(Gn,"_isStaticImage");d(Gn,"_isStaticImage");f(Gn,"_isStaticImage");b(Gn,"_isStaticImage");var zs=f(class extends F{m_created;m_lazysrc;constructor(e){super(e),this.m_created=!1,this.m_props.lazy=e.lazy!==!1,this.m_props.alt=e.alt,e.lazy!==!1&&(this.m_lazysrc=e.src,e.src=uu),this.setDomEvent("create",()=>{e.lazy&&this.setImage(this.m_lazysrc,!0)})}render(){let e=this.m_props,t=new F({tag:"img",attrs:{draggable:!1,alt:e.alt??"",decoding:e.lazy?"async":void 0},style:{objectFit:e.alignment?e.alignment:void 0}});this.setContent(t)}setImage(e,t){e||(e=uu),this.m_props.lazy?(t||this.m_lazysrc!=e)&&(Gn(e)?(this.m_props.src=e,this.m_lazysrc=e,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src)):(this.m_props.src=uu,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src),this.m_lazysrc=e,this.dom&&this._update_image())):(this.m_props.src=e,this.m_lazysrc=e,this.dom&&this.dom.firstChild.setAttribute("src",e))}_update_image(){console.assert(!!this.dom),this.m_lazysrc&&!Gn(this.m_lazysrc)&&(zs.lazy_images_waiting.push({dom:this.dom,src:this.m_lazysrc}),zs.lazy_image_timer===void 0&&(zs.lazy_image_timer=setInterval(zs.lazyWatch,10)))}static lazyWatch(){let e=[],t=0;zs.lazy_images_waiting.forEach(i=>{let s=i.dom,r=i.src;if(!s||s.offsetParent===null)return;let n=s.getBoundingClientRect();!t&&s.offsetParent!==null&&n.bottom>=0&&n.right>=0&&n.top<=(window.innerHeight||O.documentElement.clientHeight)&&n.left<=(window.innerWidth||O.documentElement.clientWidth)?(s.firstChild.setAttribute("src",r),t++):e.push(i)}),zs.lazy_images_waiting=e,e.length==0&&(clearInterval(zs.lazy_image_timer),zs.lazy_image_timer=void 0)}},"_Image"),ym=zs;b(ym,"Image");pe(ym,"lazy_images_waiting",[]);pe(ym,"lazy_image_timer");var bg=f(class extends he{constructor(e){super(e)}clear(){this.m_props.value=""}},"FileUpload");b(bg,"FileUpload");var Tb=f(class extends bg{m_path;m_ui_img;m_ui_input;render(e){let t="up"+this.uid;this.setContent([new F({tag:"label",attrs:{for:t},content:[this.m_ui_img=new ym({src:this.m_props.value})]}),this.m_ui_input=new es({cls:"@hidden",id:t,type:"file",name:this.m_props.name,value_hook:{get:()=>this._get_value(),set:i=>{this._set_value(i)}},attrs:{accept:"image/*"},dom_events:{change:i=>{this._handleChange(i)}}})])}clear(){super.clear(),this.m_ui_input.dom.value="",this.m_ui_img.setImage(null,!1)}_get_value(){return this.m_path}_set_value(e){debugger}_handleChange(e){let t=this;function i(l){let o=new FileReader;o.addEventListener("load",a=>{t.m_ui_img.setImage(o.result.toString())}),o.readAsDataURL(l)}h(i,"createThumbnail"),m(i,"createThumbnail"),d(i,"createThumbnail"),f(i,"createThumbnail"),b(i,"createThumbnail");let s=["png","jpg","jpeg","gif"],r=e.target.files,n=r.length;for(let l=0;l<n;l++){let o=r[l].name.split(".");if(o=o[o.length-1],o=o.toLowerCase(),s.indexOf(o)!=-1){i(r[l]),this.m_path=r[l];break}}}},"ImageUpload");b(Tb,"ImageUpload");var zl=null;function dl(){return zl||(zl=new F({tag:"input",style:{display:"none",id:"fileDialog"},attrs:{type:"file"}}),O.body.appendChild(zl._build())),zl.clearDomEvent("change"),zl}h(dl,"_createFileInput");m(dl,"_createFileInput");d(dl,"_createFileInput");f(dl,"_createFileInput");b(dl,"_createFileInput");function Em(e,t,i=!1){let s=dl();s.removeAttribute("nwsaveas"),s.setAttribute("accept",e),s.setAttribute("multiple",i),s.setDomEvent("change",r=>{let n=s.dom.files;t(n)}),s.dom.click()}h(Em,"openFileDialog");m(Em,"openFileDialog");d(Em,"openFileDialog");f(Em,"openFileDialog");b(Em,"openFileDialog");function km(e,t,i){let s=dl();s.setAttribute("nwsaveas",e),s.setAttribute("accept",t),s.setDomEvent("change",r=>{let n=s.dom.files;i(n[0])}),s.dom.click()}h(km,"saveFileDialog");m(km,"saveFileDialog");d(km,"saveFileDialog");f(km,"saveFileDialog");b(km,"saveFileDialog");var Ru,vh;function ra(e){e?vh=new Intl.NumberFormat(Ru,{style:"currency",currency:e}):vh=new Intl.NumberFormat(Ru,{style:"decimal",useGrouping:!0,minimumFractionDigits:2,maximumFractionDigits:2})}h(ra,"setCurrencySymbol");m(ra,"setCurrencySymbol");d(ra,"setCurrencySymbol");f(ra,"setCurrencySymbol");b(ra,"setCurrencySymbol");function Sm(e){if(e==null||e==="")return"";let t=new Date(Date.parse(e)),i={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return t.toLocaleDateString(Ru,i)}h(Sm,"sql_date_formatter");m(Sm,"sql_date_formatter");d(Sm,"sql_date_formatter");f(Sm,"sql_date_formatter");b(Sm,"sql_date_formatter");function Dm(e){if(e==null||e==="")return"";let t=typeof e=="string"?new Date(Date.parse(e)):e;return it(t)}h(Dm,"date_formatter");m(Dm,"date_formatter");d(Dm,"date_formatter");f(Dm,"date_formatter");b(Dm,"date_formatter");function Im(e){if(e==null||e==="")return"";let t=ur(typeof e=="string"?parseFloat(e):e,2);return Object.is(t,-0)&&(t=0),vh.format(t)}h(Im,"money_formatter");m(Im,"money_formatter");d(Im,"money_formatter");f(Im,"money_formatter");b(Im,"money_formatter");function Am(e){if(e==null||e==="")return"";let t=ur(typeof e=="string"?parseFloat(e):e,2);return t?vh.format(t):""}h(Am,"money_formatter_nz");m(Am,"money_formatter_nz");d(Am,"money_formatter_nz");f(Am,"money_formatter_nz");b(Am,"money_formatter_nz");function Mm(e){return e?"oui":"-"}h(Mm,"bool_formatter");m(Mm,"bool_formatter");d(Mm,"bool_formatter");f(Mm,"bool_formatter");b(Mm,"bool_formatter");ra(null);var gC=Symbol("update");function na(e,t){return ke({rec:e,chk:t})}h(na,"EvGridCheck");m(na,"EvGridCheck");d(na,"EvGridCheck");f(na,"EvGridCheck");b(na,"EvGridCheck");var xg=f(class extends F{m_sens;m_sorted;constructor(e,t){super(e),this.m_sorted=!1,this.m_sens="dn",this.setContent([new F({tag:"span",content:t}),new st({ref:"sorter",cls:"@hidden sort",icon:"var( --x4-icon-arrow-down )"})])}get sorted(){return this.m_sorted}sort(e,t){this.m_sorted=e,this.m_sens=t;let i=this.itemWithRef("sorter");i.icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )",i.show(e)}get sens(){return this.m_sens}toggleSens(){this.m_sens=this.m_sens=="up"?"dn":"up",this.itemWithRef("sorter").icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )"}},"ColHeader");b(xg,"ColHeader");var Fb=f(class extends kt{m_dataview;m_data_cx;m_columns;m_view_el;m_container;m_header;m_footer;m_empty_msg;m_empty_text;m_selection;m_itemHeight;m_topIndex;m_visible_rows;m_hasMarks;m_marks;m_recycler;m_rowClassifier;constructor(e){super(e),this.m_columns=e.columns,this.m_hasMarks=e.hasMarks??!1,this.m_marks=new Set,this.m_hasMarks&&this.m_columns.unshift({id:"id",title:"",width:30,renderer:t=>this._renderCheck(t)}),this.setAttribute("tabindex",0),this.m_topIndex=0,this.m_itemHeight=0,this.m_recycler=[],this.m_rowClassifier=e.calcRowClass,this.m_empty_text=e.empty_text??ae.global.empty_list,this.setDomEvent("click",t=>this._itemClick(t)),this.setDomEvent("dblclick",t=>this._itemDblClick(t)),this.setDomEvent("contextmenu",t=>this._itemMenu(t)),this.setDomEvent("keydown",t=>this._handleKey(t)),this.setStore(e.store)}componentCreated(){this._updateScroll(!0)}_moveSel(e,t=!0){let i=this.m_selection,s=null;if(i===void 0)i=this.m_dataview.getByIndex(0).getID();else{let r=this.m_dataview.indexOfId(this.m_selection);e==1?r++:e==-1?r--:e==2?r+=this.m_visible_rows.length-1:e==-2&&(r-=this.m_visible_rows.length-1),e<0?s="start":s="end",r<0?r=0:r>=this.m_dataview.count&&(r=this.m_dataview.count-1),i=this.m_dataview.getByIndex(r).getID()}return this.m_selection!=i&&t&&this._selectItem(i,null,s),i}_handleKey(e){if(!(!this.m_dataview||this.m_dataview.count==0))switch(e.key){case"ArrowDown":case"Down":{this._moveSel(1);break}case"ArrowUp":case"Up":{this._moveSel(-1);break}case"PageUp":{this._moveSel(-2);break}case"PageDown":{this._moveSel(2);break}}}getNextSel(e){return this._moveSel(e,!1)}_scrollIntoView(e,t){let i=this._findItem(e);i?i.scrollIntoView({block:"center"}):(this.m_topIndex=this.m_dataview.indexOfId(e),this.m_view_el.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),this._scrollIntoView(e))}setStore(e){this.m_selection=void 0,e instanceof e_?this.m_dataview=e.createView():this.m_dataview=e,this.m_hasMarks&&this.clearMarks(),this.m_data_cx&&this.m_data_cx.dispose(),this.m_dataview&&(this.m_data_cx=this.m_dataview.on("view_change",t=>{t.action=="change"&&(this.m_selection=void 0),this._updateScroll(!0)}),this._updateScroll(!0))}getView(){return this.m_dataview}getSelection(){return this.m_selection}getSelRec(){return this.m_selection?this.m_dataview.getById(this.m_selection):null}setSelection(e){this._selectItem(e,null,"center")}render(){this.m_recycler=[],this.m_container=new F({cls:"content"}),this.m_empty_msg=new je({cls:"empty-msg",text:""}),this.m_view_el=new F({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let e=!1,t=this.m_columns.map((s,r)=>{let n="@cell";s.cls&&(n+=" "+s.cls);let l=new xg({cls:n,flex:s.flex,sizable:"right",style:{width:s.width},dom_events:{click:a=>{jt(a.target).hasClass("@sizer-overlay")||(this._sortCol(s),a.preventDefault())}}},s.title),o=b(a=>{if(this._on_col_resize(r,a.size.width),this.m_footer){let c=F.getElement(this.m_footer.dom.childNodes[r]);c&&c.setStyleValue("width",a.size.width)}},"resizeCol");return new pm({target:l,sens:"right",events:{resize:a=>o(a)}}),s.flex&&(e=!0),s.$hdr=l,l});t.push(new fh({ref:"flex",cls:e?"@hidden":""}));let i=0;if(this.m_columns.forEach(s=>{i+=s.width??0}),this.m_header=new he({cls:"@header",content:t,style:{minWidth:i}}),this.m_props.hasFooter){let s=this.m_columns.map((r,n)=>{let l="@cell";r.align&&(l+=" "+r.align),r.cls&&(l+=" "+r.cls);let o=new F({cls:l,data:{col:n},flex:r.flex,style:{width:r.width}});return r.$ftr=o,o});s.push(new fh({ref:"flex",cls:e?"@hidden":""})),this.m_footer=new he({cls:"@footer",content:s,style:{minWidth:i}})}else this.m_footer=null;this.setContent([this.m_header,this.m_view_el,this.m_footer,this.m_empty_msg])}_on_col_resize(e,t){let i=this.m_columns[e],s=!1;if(t>=0?(i.width=t,i.flex&&(i.$hdr.removeClass("@flex"),i.$ftr?.removeClass("@flex"),i.flex=void 0,s=!0)):t<0&&!i.flex&&(i.$hdr.addClass("@flex"),i.$ftr?.addClass("@flex"),i.flex=1,s=!0),s){let r=!1;this.m_columns.forEach(n=>{n.flex&&(r=!0)}),this.m_header.itemWithRef("flex")?.show(!r),this.m_footer&&this.m_footer.itemWithRef("flex")?.show(!r)}this._updateScroll(!0)}sortCol(e,t=!0){let i=this.m_columns.find(s=>s.id==e);if(i===void 0){console.assert(!1,"unknown field "+e+" in grid.sortCol");return}this._sortCol(i,t?"dn":"up")}_sortCol(e,t="up"){if(e.sortable===!1)return;this.m_columns.forEach(s=>{s!==e&&s.$hdr.sort(!1,"dn")});let i=e.$hdr;i.sorted?i.toggleSens():i.sort(!0,t),this.m_dataview&&this.m_dataview.sort([{field:e.id,ascending:i.sens!="dn"}])}_computeItemHeight(){let e=O.createElement("div");e.classList.add("x-row");let t=O.createElement("div");t.classList.add("x-grid-view"),t.style.position="absolute",t.style.top="-1000px",t.appendChild(e),this.dom.appendChild(t);let i=e.getBoundingClientRect();this.dom.removeChild(t),this.m_itemHeight=i.height}_createRow(e){let t;if(this.m_recycler.length){t=this.m_recycler.pop(),t.clearClasses(),t.addClass(e.cls),t.setContent(e.content),t.setStyle(e.style);for(let i in e.data)t.setData(i,e.data[i])}else t=new he(e);return t.dom||this.m_container.appendChild(t),t}_buildItems(e=!0){let t=this.getBoundingRect(),i=this.m_header.getBoundingRect(),s=t.height-i.height+this.m_itemHeight;this.m_itemHeight==0&&this._computeItemHeight();let r=this.m_topIndex*this.m_itemHeight,n=0,l=0,o=this.m_topIndex,a=this.m_dataview?this.m_dataview.count:0,c=0,u=!!(this.m_topIndex&1);if(this.m_columns.forEach(g=>{c+=g.width??0}),(a+1)*this.m_itemHeight>=s){let g=F.getScrollbarSize();this.m_header.setStyleValue("paddingRight",g),this.m_footer?.setStyleValue("paddingRight",g)}else this.m_header.setStyleValue("paddingRight",0),this.m_footer?.setStyleValue("paddingRight",0);this.m_visible_rows&&this.m_visible_rows.forEach(g=>{this.m_recycler.push(g)}),this.m_visible_rows=[];let _=100;for(;n<s&&o<a&&--_>0;){let g=this.m_dataview.getByIndex(o),x=g.getID(),E=e?this.m_recycler.findIndex(y=>y.getData("row-id")==x):-1;if(E>=0){let y=this.m_recycler.splice(E,1)[0];y.setStyle({top:n+r,minWidth:c}),this.m_hasMarks&&y.setClass("@marked",this.m_marks.has(x)),y.removeClass("@hidden"),y.setClass("@selected",this.m_selection===x),this.m_visible_rows[l]=y}else{let y=this.m_columns.map(S=>{let w="@cell";S.align&&(w+=" "+S.align),S.cls&&(w+=" "+S.cls);let D;if(S.renderer)D=S.renderer(g),D&&(D.addClass(w),D.setStyleValue("width",S.width),S.flex!==void 0&&(D.addClass("@flex"),D.setStyleValue("flex",S.flex)));else{let R=S.formatter,C;R&&R instanceof Function?C=R(g.getRaw(S.id),g):C=g.getField(S.id),D=new F({cls:w,width:S.width,content:cl`<span>${C}</span>`,flex:S.flex})}return D}),k="@row @hlayout center";this.m_hasMarks&&this.m_marks.has(x)&&(k+=" @marked"),this.m_selection===x&&(k+=" @selected");let A=this.m_visible_rows[l]=this._createRow({cls:k,content:y,style:{top:n+r,minWidth:c},data:{"row-id":x,"row-idx":o}});A.addClass(u?"even":"odd"),u=!u,this.m_rowClassifier&&this.m_rowClassifier(g,A)}n+=this.m_itemHeight,o++,l++}this.m_recycler.forEach(g=>{g.addClass("@hidden")});let p=!a,v=this.m_empty_text instanceof Function?this.m_empty_text():this.m_empty_text;this.m_empty_msg.text=v,p&&v.length==0&&(p=!1),this.m_empty_msg.show(p),c<t.width?(this.m_header.setStyleValue("width",null),this.m_footer?.setStyleValue("width",null),this.m_container.setStyle({height:a*this.m_itemHeight,width:null})):(this.m_header.setStyleValue("width",c+1e3),this.m_footer?.setStyleValue("width",c+1e3),this.m_container.setStyle({height:a*this.m_itemHeight,width:c}))}_updateScroll(e){if(!this.m_view_el||!this.m_view_el.dom)return;let t=b(()=>{if(!this.dom)return;let i=Math.floor(this.m_view_el.dom.scrollTop/(this.m_itemHeight||1));(i!=this.m_topIndex||e)&&(this.m_topIndex=i,this._buildItems(!e));let s=this.m_view_el.dom.scrollLeft;this.m_header.setStyleValue("left",-s),this.m_footer?.setStyleValue("left",-s)},"update");e?this.singleShot(t,10):t()}_rowFromTarget(e){let t=this.dom;for(;e&&e!=t;){let i=F.getElement(e);if(i){let s=i.getData("row-id");if(s!==void 0)return{id:s,itm:i}}e=e.parentElement}}_itemClick(e){let t=this._rowFromTarget(e.target);t?this._selectItem(t.id,t.itm):this._selectItem(void 0,void 0)}_itemDblClick(e){let t=this._rowFromTarget(e.target);if(t){this._selectItem(t.id,t.itm);let i=this.m_dataview.getById(t.id);this.emit("dblClick",dr(i)),this.m_hasMarks&&this._toggleMark(i)}}_itemMenu(e){let t=e.target,i=this.dom;for(;t&&t!=i;){let s=F.getElement(t),r=s?.getData("row-id");if(r!==void 0){this._selectItem(r,s);let n=s.getData("row-idx"),l=this.m_dataview.getByIndex(n);this._showItemContextMenu(e,l),e.preventDefault();return}t=t.parentElement}}_findItem(e){for(let t=0;t<this.m_visible_rows.length;t++){let i=this.m_visible_rows[t];if(i.getData("row-id")===e)return i}return null}_selectItem(e,t,i){if(this.m_selection!==void 0){let s=this._findItem(this.m_selection);s&&s.removeClass("@selected")}if(this.m_selection=e,e){i&&this._scrollIntoView(e,i),t||(t=this._findItem(e)),t&&t.addClass("@selected");let s=this.m_dataview.getById(e);this.emit("selectionChange",ui(s))}else this.emit("selectionChange",ui(null))}_showItemContextMenu(e,t){this.emit("contextMenu",xs(e,t))}clearSelection(){this._selectItem(null,null)}exportData(e){let t="",i=" ",s=`\r
|
|
14
|
+
`,r="";this.m_columns.map(l=>{r.length&&(r+=i),r+=l.title}),t+=r+s;let n=this.m_dataview.count;for(let l=0;l<n;l++){let o=this.m_dataview.getByIndex(l);r="";let a=this.m_columns.map(c=>{let u=o.getField(c.id),_=c.formatter;_&&_ instanceof Function&&(u=_(u,o)),r.length>0&&(r+=i),r+=u});t+=r+s}t=t.replace(/[àâä]/gm,"a"),t=t.replace(/[éèê]/gm,"e"),t=t.replace(/[îï]/gm,"i"),t=t.replace(/[ûüù]/gm,"u"),t=t.replace(/ /gm," "),Ro(t,"text/csv",e)}set empty_text(e){this.m_empty_msg.text=e}_renderCheck(e){let t="--x4-icon-square";return this.m_marks.has(e.getID())&&(t="--x4-icon-square-check"),new st({icon:`var(${t})`})}_toggleMark(e){let t=e.getID(),i=!1;this.m_marks.has(t)?this.m_marks.delete(t):(this.m_marks.add(t),i=!0),this.emit("gridCheck",na(e,i)),this._buildItems(!1)}getMarks(){let e=[];for(let t of this.m_marks.values())e.push(t);return e}clearMarks(){this.m_marks.size&&(this.m_marks=new Set,this._buildItems(!1))}setFooterData(e){this.m_footer&&this.m_footer.enumChilds(t=>{let i=t.getData("col");if(i){let s=this.m_columns[i],r=e[s.id];if(r!==void 0)if(ei(r))r(t);else{let n,l=s.formatter;l&&l instanceof Function?n=l(r,e):n=r,t.setContent(n,!1)}}})}},"GridView");b(Fb,"GridView");var zb=f(class extends F{constructor(e){super(e),this.setDomEvent("click",()=>this._handleClick()),this.mapPropEvents(e,"click")}_handleClick(){this.emit("click",ns())}render(e){let t=e.text??"",i=e.href??"#";this.setTag("a"),this.setAttribute("tabindex",0),this.setAttribute("href",i),this.setAttribute("target",e.target),t&&this.setContent(Ci(t)?t:cl`<span>${t}</span>`)}set text(e){this.m_props.text=e,this.update()}},"Link");b(zb,"Link");var ni=f(class{static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=ni.hexChars,i=ni.hexOut,s,r,n,l;for(l=0;l<4;l+=1)for(r=l*8,s=e[l],n=0;n<8;n+=2)i[r+1+n]=t.charAt(s&15),s>>>=4,i[r+0+n]=t.charAt(s&15),s>>>=4;return i.join("")}static _md5cycle(e,t){let i=e[0],s=e[1],r=e[2],n=e[3];i+=(s&r|~s&n)+t[0]-680876936|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[1]-389564586|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[2]+606105819|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[3]-1044525330|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[4]-176418897|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[5]+1200080426|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[6]-1473231341|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[7]-45705983|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[8]+1770035416|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[9]-1958414417|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[10]-42063|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[11]-1990404162|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[12]+1804603682|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[13]-40341101|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[14]-1502002290|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[15]+1236535329|0,s=(s<<22|s>>>10)+r|0,i+=(s&n|r&~n)+t[1]-165796510|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[6]-1069501632|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[11]+643717713|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[0]-373897302|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[5]-701558691|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[10]+38016083|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[15]-660478335|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[4]-405537848|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[9]+568446438|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[14]-1019803690|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[3]-187363961|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[8]+1163531501|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[13]-1444681467|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[2]-51403784|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[7]+1735328473|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[12]-1926607734|0,s=(s<<20|s>>>12)+r|0,i+=(s^r^n)+t[5]-378558|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[8]-2022574463|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[11]+1839030562|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[14]-35309556|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[1]-1530992060|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[4]+1272893353|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[7]-155497632|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[10]-1094730640|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[13]+681279174|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[0]-358537222|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[3]-722521979|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[6]+76029189|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[9]-640364487|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[12]-421815835|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[15]+530742520|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[2]-995338651|0,s=(s<<23|s>>>9)+r|0,i+=(r^(s|~n))+t[0]-198630844|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[7]+1126891415|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[14]-1416354905|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[5]-57434055|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[12]+1700485571|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[3]-1894986606|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[10]-1051523|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[1]-2054922799|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[8]+1873313359|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[15]-30611744|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[6]-1560198380|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[13]+1309151649|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[4]-145523070|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[11]-1120210379|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[2]+718787259|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[9]-343485551|0,s=(s<<21|s>>>11)+r|0,e[0]=i+e[0]|0,e[1]=s+e[1]|0,e[2]=r+e[2]|0,e[3]=n+e[3]|0}_dataLength;_bufferLength;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(ni.stateIdentity),this}appendStr(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n;for(n=0;n<e.length;n+=1){if(r=e.charCodeAt(n),r<128)t[s++]=r;else if(r<2048)t[s++]=(r>>>6)+192,t[s++]=r&63|128;else if(r<55296||r>56319)t[s++]=(r>>>12)+224,t[s++]=r>>>6&63|128,t[s++]=r&63|128;else{if(r=(r-55296)*1024+(e.charCodeAt(++n)-56320)+65536,r>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[s++]=(r>>>18)+240,t[s++]=r>>>12&63|128,t[s++]=r>>>6&63|128,t[s++]=r&63|128}s>=64&&(this._dataLength+=64,ni._md5cycle(this._state,i),s-=64,i[0]=i[16])}return this._bufferLength=s,this}appendAsciiStr(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n=0;for(;;){for(r=Math.min(e.length-n,64-s);r--;)t[s++]=e.charCodeAt(n++);if(s<64)break;this._dataLength+=64,ni._md5cycle(this._state,i),s=0}return this._bufferLength=s,this}appendByteArray(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n=0;for(;;){for(r=Math.min(e.length-n,64-s);r--;)t[s++]=e[n++];if(s<64)break;this._dataLength+=64,ni._md5cycle(this._state,i),s=0}return this._bufferLength=s,this}getState(){let e=this,t=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[t[0],t[1],t[2],t[3]]}}setState(e){let t=e.buffer,i=e.state,s=this._state,r;for(this._dataLength=e.length,this._bufferLength=e.buflen,s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],r=0;r<t.length;r+=1)this._buffer8[r]=t.charCodeAt(r)}end(e=!1){let t=this._bufferLength,i=this._buffer8,s=this._buffer32,r=(t>>2)+1,n;if(this._dataLength+=t,i[t]=128,i[t+1]=i[t+2]=i[t+3]=0,s.set(ni.buffer32Identity.subarray(r),r),t>55&&(ni._md5cycle(this._state,s),s.set(ni.buffer32Identity)),n=this._dataLength*8,n<=4294967295)s[14]=n;else{let l=n.toString(16).match(/(.*?)(.{0,8})$/);if(l===null)return;let o=parseInt(l[2],16),a=parseInt(l[1],16)||0;s[14]=o,s[15]=a}return ni._md5cycle(this._state,s),e?this._state:ni._hex(this._state)}},"_Md5"),_l=ni;b(_l,"Md5");pe(_l,"stateIdentity",new Int32Array([1732584193,-271733879,-1732584194,271733878]));pe(_l,"buffer32Identity",new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]));pe(_l,"hexChars","0123456789abcdef");pe(_l,"hexOut",[]);pe(_l,"onePassHasher",new ni);var Hl=f(class extends bm{m_label;constructor(e){let t=e.icon??"var( --x4-icon-exclamation )";e.icon=void 0;let i=e.buttons===void 0?["ok"]:e.buttons;e.buttons=void 0,super(e);let s=e.message;this.form.updateContent(new he({style:{padding:8},content:[t?new st({cls:"icon",icon:t}):null,this.m_label=new je({cls:"text",text:s,multiline:!0})]}),i),this.on("btnClick",r=>{this.m_props.click&&Cs(()=>{this.m_props.click(r.button)})})}set text(e){this.m_label.text=e}static show(e){let t;return Me(e)||Ci(e)?t=new Hl({message:e,click:()=>{}}):t=new Hl(e),t.show(),t}static async showAsync(e){return new Promise((t,i)=>{let s,r=b(l=>{t(l)},"cb");Me(e)||Ci(e)?s={message:e,click:r}:s={...e,click:r},new Hl(s).show()})}static alert(e,t=null){new Hl({cls:"warning",title:t,message:e,buttons:["ok"],click:()=>{}}).show()}},"MessageBox");b(Hl,"MessageBox");var Lu=f(class extends bm{m_edit;constructor(e){e.buttons=void 0,e.width=e.width??500,super(e),this.form.updateContent(new he({cls:"panel",content:[this.m_edit=new yi({flex:1,autoFocus:!0,label:e.message,value:e.value})]}),["ok","cancel"]),e.click&&this.on("btnClick",t=>{t.button==="ok"&&Cs(()=>{this.m_props.click(this.m_edit.value)})})}set text(e){this.m_edit.label=e}static show(e,t){let i;return Me(e)||Ci(e)?i=new Lu({message:e,click:t}):i=new Lu(e),i.show(),i}},"PromptDialogBox");b(Lu,"PromptDialogBox");var Rb=f(class extends kt{m_ui_title;m_ui_body;constructor(e){super(e);let t=e?.sens=="horizontal"?"@hlayout":"@vlayout";this.m_ui_title=new je({cls:"title",text:this.m_props.title}),this.m_ui_body=new F({cls:"body "+t,content:this.m_props.content,style:e.bodyStyle})}render(){let e=this.m_props.gadgets??[],t=this.m_props.icon?new st({icon:this.m_props.icon}):null;super.setContent([new he({cls:"title",content:[t,this.m_ui_title,...e]}),this.m_ui_body])}setContent(e){this.m_ui_body.setContent(e)}set title(e){this.m_ui_title.text=e}},"Panel");b(Rb,"Panel");var t_=f(class{text;cls},"CellData");b(t_,"CellData");pe(t_,"empty_cell",{text:""});var Cg=f(class extends kt{m_columns;m_row_limit;m_cells_data;m_rows_data;m_view;m_container;m_header;m_itemHeight;m_topIndex;m_visible_cells;m_row_count;m_selection;m_editor;m_autoedit;m_lockupdate;m_auto_row_count;m_recycler;m_used_cells;constructor(e){super(e),this.m_columns=e.columns,this.m_autoedit=e.autoedit,this.m_lockupdate=0,this.m_cells_data=new Map,this.m_rows_data=new Map,this.m_itemHeight=0,this.m_selection={row:0,col:0},this.m_row_count=0,this.m_auto_row_count=!1,this.m_recycler=[],this.m_used_cells=[],e.maxrows===void 0?(this.m_row_limit=0,this.m_auto_row_count=!0):e.maxrows<0?(this.m_row_limit=0,this.m_auto_row_count=!0):this.m_row_limit=e.maxrows,this.setAttribute("tabindex",0),this.setDomEvent("click",t=>this._itemClick(t)),this.setDomEvent("dblclick",t=>this._itemDblClick(t)),this.setDomEvent("keydown",t=>this._handleKey(t)),this.setDomEvent("keypress",t=>this._keyPress(t)),this.setDomEvent("focus",()=>this._focus(!0)),this.setDomEvent("focusout",()=>this._focus(!1)),this.setDomEvent("contextmenu",t=>this._ctxMenu(t)),this.mapPropEvents(e,"dblClick","selectionChange","contextMenu","change")}componentCreated(){super.componentCreated(),this._updateScroll(!0)}setColWidth(e,t){this._on_col_resize(e,t),this.update(10)}getColWidth(e){if(this.m_columns[e])return this.m_columns[e].width}setColTitle(e,t){console.assert(this.m_columns[e]!==void 0),this.m_columns[e].title=t,this.update(10)}reset(e){e&&(this.m_columns=e),this.m_cells_data=new Map,this.m_rows_data=new Map,this.update(10)}insertRow(e){let t=new Map;this.m_cells_data.forEach((s,r)=>{let{row:n,col:l}=sr(r);n>=e?t.set(Zt(n+1,l),s):t.set(r,s)});let i=new Map;this.m_rows_data.forEach((s,r)=>{r>=e?i.set(r+1,s):i.set(r,s)}),this.m_cells_data=t,this.m_rows_data=i,this._buildItems()}deleteRow(e){let t=new Map,i=new Map;this.m_cells_data.forEach((s,r)=>{let{row:n,col:l}=sr(r);n>e?t.set(Zt(n-1,l),s):n<e&&t.set(r,s)}),this.m_rows_data.forEach((s,r)=>{r>e?i.set(r-1,s):r<e&&i.set(r,s)}),this.m_cells_data=t,this.m_rows_data=i,this._buildItems()}insertCol(e,t){let i=e;if(i<0&&(i=this.m_columns.length+1),this.m_columns.splice(i,0,t),e>=0){let s=new Map;this.m_cells_data.forEach((r,n)=>{let{row:l,col:o}=sr(n);o>=e?s.set(Zt(l,o+1),r):s.set(n,r)}),this.m_cells_data=s}this.update()}deleteCol(e){this.m_columns.splice(e,1);let t=new Map;this.m_cells_data.forEach((i,s)=>{let{row:r,col:n}=sr(s);n>e?t.set(Zt(r,n-1),i):n<e&&t.set(s,i)}),this.m_cells_data=t,this.update()}_getCellData(e,t,i=!1){let s=this.m_cells_data.get(Zt(e,t));return s===void 0?i?null:t_.empty_cell:s}_focus(e){this.setClass("@focus",e)}_ctxMenu(e){let t=e.target,i=this.dom;for(;t&&t!=i;){let s=F.getElement(t),r=s.getData("row-id"),n=s.getData("col-id");if(r!==void 0){this._selectItem(r,n),this.emit("contextMenu",xs(e,{row:r,col:n,item:s})),e.preventDefault();return}t=t.parentElement}}render(){this.m_recycler=[],this.m_container=new F({cls:"content"}),this.m_view=new F({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let e=this.m_columns.map((t,i)=>{let s=new F({cls:"@cell c"+i,content:t.title?t.title:" ",flex:t.width<0?-t.width:void 0,attrs:{title:t.title},style:{width:t.width>=0?t.width:void 0,minWidth:t.min_width}});return new pm({target:s,sens:"right",resize:r=>{this._on_col_resize(i,r.size.width)}}),t.$col=s,s});this.m_header=new he({cls:"@header",content:e}),this.setContent([this.m_header,this.m_view])}_on_col_resize(e,t){this.m_columns[e]&&(t<=0?this.m_columns[e].width=-1:this.m_columns[e].width=t,this._updateScroll(!0))}_computeItemHeight(){let e=O.createElement("div");e.classList.add("x-spreadsheet");let t=O.createElement("div");t.classList.add("content");let i=O.createElement("div");i.classList.add("x-cell"),i.append(" "),t.appendChild(i),e.appendChild(t),this.dom.appendChild(e);let s=i.getBoundingClientRect();this.dom.removeChild(e),this.m_itemHeight=s.height}_calcColWidths(e){let t=0,i=0,s=new Int32Array(this.m_columns.length),r=new Int32Array(this.m_columns.length),n=new Int32Array(this.m_columns.length);if(this.m_columns.forEach((l,o)=>{let a=Math.max(10,l.min_width??0);if(l.width>0){let c=Math.max(l.width,a);t+=c,s[o]=c}else{let c=-l.width;r[o]=c,i+=c}n[o]=a}),i){let l=e-t;for(let o=0;o<this.m_columns.length&&i;o++)if(!s[o]){let a=Math.round(l/i)*r[o];a<n[o]&&(a=n[o]),s[o]=a,l-=a,i-=r[o]}}return s}_createCell(){let e;return this.m_recycler.length?(e=this.m_recycler.pop(),e.clearClasses(),e.addClass("@comp")):e=new F({cls:"@cell"}),e.dom||this.m_container.appendChild(e),e}_buildItems(){let e=this.getBoundingRect(),t=this.m_header.getBoundingRect(),i=e.height-t.height;this.m_itemHeight==0&&this._computeItemHeight();let s=this.m_topIndex*this.m_itemHeight,r=0,n=0,l=this.m_topIndex,o=this.m_row_limit;this.m_auto_row_count&&(this.m_row_limit=o=this.getMaxRowCount());let a=0;if(o*this.m_itemHeight>i){let v=F.getScrollbarSize();e.width-=v,a=v}let c=!!(this.m_topIndex&1);this.m_visible_cells=new Map,this.m_used_cells.forEach(v=>{this.m_recycler.push(v)}),this.m_used_cells=[];let u=this._calcColWidths(e.width),_=0;for(let v=0;v<u.length;v++)_+=u[v];_<=e.width?(this.m_view.setStyleValue("overflow-x","hidden"),this.m_header.setStyleValue("width",e.width),this.m_container.setStyleValue("width",e.width),this.m_container.setStyle({height:o*this.m_itemHeight})):(this.m_header.setStyleValue("width",_),this.m_container.setStyleValue("width",_),this.m_view.setStyleValue("overflow-x","visible"),this.m_container.setStyle({height:o*this.m_itemHeight,width:_})),this.m_view.addClass("@hidden");let p=100;for(;r<i&&l<o&&--p>0;){let v=this.m_rows_data.get(l),g=0,x=this.m_columns.map((E,y)=>{let k="@cell c"+y;E.align&&(k+=" "+E.align),E.cls&&(k+=" "+E.cls);let A,S=this._getCellData(l,y),w=S.text;return E.renderer&&w.length&&(w=E.renderer(w,{row:l,col:y})),k+=c?" even":" odd",v&&(k+=" "+v),A=this._createCell(),this.m_used_cells.push(A),A.setContent(w),A.addClass(k),A.setStyle({left:g,top:s+r,width:u[y],height:this.m_itemHeight}),this.m_selection.row==l&&this.m_selection.col==y&&A.addClass("@selected"),A.setData("row-id",l),A.setData("col-id",y),S.cls&&A.addClass(S.cls),this.m_visible_cells.set(Zt(l,y),A),g+=u[y],A});c=!c,r+=this.m_itemHeight,l++,n++}this.m_recycler.forEach(v=>{v.addClass("@hidden")}),this.m_row_count=n,this.m_view.removeClass("@hidden"),this.setClass("empty",o==0)}_itemClick(e){let t=e.target;if(this.m_editor&&this.m_editor.dom.contains(t))return;let i=F.getElement(t,F);if(!i)return;let s=i.getData("row-id"),r=i.getData("col-id");s===void 0||r===void 0||this._selectItem(s,r)}_itemDblClick(e){let t=e.target;if(this.m_editor&&this.m_editor.dom.contains(t))return;let i=F.getElement(t),s=i.getData("row-id"),r=i.getData("col-id");s===void 0||r===void 0||(this.emit("dblClick",dr({row:s,col:r})),this.editCell(s,r))}_selectItem(e,t,i){e<0&&(e=0),e>this.m_row_limit-1&&(e=this.m_row_limit-1),t<0&&(t=0);let s=this.m_columns.length-1;t>s&&(t=s),!(this.m_selection.row==e&&this.m_selection.col==t)&&this.select(e,t,i)}_scrollIntoView(e,t){let i=b((r,n="nearest")=>{r.scrollIntoView({block:n})},"doscroll"),s=this.m_topIndex+this.m_row_count-1;e<this.m_topIndex?(this.m_topIndex=e,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),i(this._findItem(e,t),"start")):e>s?(this.m_topIndex=e-this.m_row_count+1,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),i(this._findItem(e,t),"end")):i(this._findItem(e,t))}_findItem(e,t){return this.m_visible_cells?this.m_visible_cells.get(Zt(e,t)):null}_updateScroll(e){if(!this?.m_view?.dom)return;let t=Math.floor(this.m_view.dom.scrollTop/(this.m_itemHeight||1));(t!=this.m_topIndex||e)&&(this.m_topIndex=t,this._buildItems());let i=this.m_view.dom.scrollLeft;this.m_header.setStyleValue("left",-i)}_moveSel(e,t){let i=this.m_selection,s=i.row??0,r=i.col??0;if(e==1?s++:e==-1?s--:e==2?s+=this.m_row_count-1:e==-2?s-=this.m_row_count-1:e==3?s=this.m_row_limit-1:e==-3&&(s=0),t==1)r++;else if(t==-1)r--;else if(t==2)r=this.m_columns.length-1;else if(t==-2)r=0;else if(t==3){r++;let n=this.m_columns.length-1;e:for(let l=0;l<2;l++){for(;r<n;){if(this.m_columns[r].createEditor!==null)break e;r++}r>n&&(s++,r=0)}}else if(t==-3){r--;let n=this.m_columns.length-1;e:for(let l=0;l<2;l++){for(;r>=0;){if(this.m_columns[r].createEditor!==null)break e;r--}r<0&&(s--,r=n)}}this._selectItem(s,r,!0)}_handleKey(e){let t=e.target;if(!(this.m_editor&&this.m_editor.dom.contains(t)))switch(e.key){case"ArrowDown":case"Down":{this._moveSel(1,0);break}case"ArrowUp":case"Up":{this._moveSel(-1,0);break}case"PageUp":{this._moveSel(-2,0);break}case"PageDown":{this._moveSel(2,0);break}case"ArrowLeft":case"Left":{this._moveSel(0,-1);break}case"ArrowRight":case"Right":{this._moveSel(0,1);break}case"Home":{e.ctrlKey?this._moveSel(-3,0):this._moveSel(0,-2);break}case"End":{e.ctrlKey?this._moveSel(3,0):this._moveSel(0,2);break}case"Enter":{this.editCurCell(),e.stopPropagation(),e.preventDefault();break}case"Delete":{this.clearCell(this.m_selection.row,this.m_selection.col);break}default:break}}_keyPress(e){let t=e.target;this.m_editor&&this.m_editor.dom.contains(t)||e.ctrlKey||e.altKey||this.editCurCell(e.key)}getSelection(){return this.m_selection}select(e,t,i=!0){if(this.m_selection.row==e&&this.m_selection.col==t)return;let s=this._findItem(this.m_selection.row,this.m_selection.col);s&&s.removeClass("@selected"),this.m_selection={row:e,col:t},i&&this._scrollIntoView(e,t);let r=this._findItem(e,t);r&&r.addClass("@selected"),this.emit("selectionChange",ui({row:e,col:t}))}rowCount(){return this.m_row_limit}getMaxRowCount(){let e=0;return this.m_cells_data.forEach((t,i)=>{let s=Math.round(i/1e3)+1;e<s&&(e=s)}),e}getColCount(){return this.m_columns.length}setRowStyle(e,t){this.m_rows_data.set(e,t),this.m_lockupdate==0&&this._buildItems()}getRowStyle(e){return this.m_rows_data.get(e)}setCellStyle(e,t,i){let s=this._getCellData(e,t,!0);if(s||(s={text:""},this.m_cells_data.set(Zt(e,t),s)),s.cls=i,this.m_lockupdate==0&&this.m_visible_cells){let r=this._findItem(e,t);r?r.setClass(i,!0):this._buildItems()}}getCellText(e,t){return this._getCellData(e,t).text}getCellNumber(e,t){let i=this._getCellData(e,t).text;return zo(i)}clearRow(e){for(let t=0;t<this.m_columns.length;t++)this.clearCell(e,t);this.update(10)}clearCell(e,t){this.setCellText(e,t,null)}editCurCell(e){this.editCell(this.m_selection.row,this.m_selection.col,e)}editCell(e,t,i){if(!this.m_autoedit||this.m_columns[t].createEditor===null)return;this._scrollIntoView(e,t);let r=this._findItem(e,t).dom,n=r.parentElement,l=r.getBoundingClientRect(),o=n.getBoundingClientRect(),a=this._getCellData(e,t,!0),c=b((_,p,v)=>new yi(_),"edtBuilder");this.m_columns[t].createEditor&&(c=this.m_columns[t].createEditor);let u=i||(a?a.text:"");this.m_editor=c({cls:"@editor",style:{left:l.left-o.left,top:l.top-o.top,width:l.width-1,height:l.height-1},tabIndex:!1,value:u,data:{row:e,col:t}},e,t),this.m_editor&&(n.appendChild(this.m_editor._build()),this._setupEditor(),this.m_editor.setData("old-value",u),this.m_editor.focus(),this.m_editor instanceof yi&&this.m_editor.selectAll())}_setupEditor(){let e=b((t,i)=>{Vo(()=>{this.killEditor(!0),this._moveSel(t,i),this.editCurCell()})},"movesel");if(this.m_editor instanceof yi){let i=this.m_editor.input;i.setDomEvent("blur",()=>{this.killEditor(!0)}),i.setDomEvent("keydown",s=>{if(!s.defaultPrevented)switch(s.key){case"Escape":{this.killEditor(!1),s.stopPropagation(),s.preventDefault();break}case"Enter":case"Tab":{let r=3;s.shiftKey&&(r=-3),e(0,r),s.stopPropagation(),s.preventDefault();break}case"ArrowUp":case"Up":{e(-1,0),s.stopPropagation(),s.preventDefault();break}case"ArrowDown":case"Down":{e(1,0),s.stopPropagation(),s.preventDefault();break}}})}else if(this.m_editor instanceof zu){let t=this.m_editor.input;t.setDomEvent("blur",()=>{this.killEditor(!0)}),t.setDomEvent("keydown",i=>{switch(i.key){case"Escape":{this.killEditor(!1),i.stopPropagation(),i.preventDefault();break}case"Enter":case"Tab":{let s=3;i.shiftKey&&(s=-3),e(0,s),i.stopPropagation(),i.preventDefault();break}}}),this.m_editor.showPopup(),this.m_editor.on("change",i=>{this.killEditor(!0)}),this.m_editor.on("cancel",i=>{this.killEditor(!1)})}}killEditor(e){if(this.m_editor){if(e){let i,s;this.m_editor instanceof yi?i=this.m_editor.value:this.m_editor instanceof zu&&(s=this.m_editor.value,i=this.m_editor.valueText);let r=this.m_editor.getData("row"),n=this.m_editor.getData("col"),l=this.m_editor.getData("old-value");this.setCellText(r,n,i);let o=Oe(i,{row:r,col:n,oldValue:l,id:s});this.emit("change",o),o.defaultPrevented&&this.setCellText(r,n,l)}let t=this.m_editor;Cs(()=>{t.dispose()}),this.m_editor=null,this.focus()}}clearData(){this.m_cells_data=new Map,this.m_rows_data=new Map}setCellText(e,t,i){if(i==null||i.length==0)this.m_cells_data.delete(Zt(e,t)),i="";else{let s=this._getCellData(e,t,!0);s||(s={}),s.text=i,this.m_cells_data.set(Zt(e,t),s)}if(this.m_lockupdate==0&&this.m_visible_cells){let s=this._findItem(e,t);s?(this.m_columns[t].renderer&&(i=this.m_columns[t].renderer(i,{row:e,col:t})),s.setContent(i)):this._buildItems()}}lockUpdate(e){e?this.m_lockupdate++:--this.m_lockupdate==0&&this._updateScroll(!0)}},"Spreadsheet");b(Cg,"Spreadsheet");function Zt(e,t){return e*1e3+t}h(Zt,"_mkid2");m(Zt,"_mkid2");d(Zt,"_mkid2");f(Zt,"_mkid2");b(Zt,"_mkid");function sr(e){return{row:Math.floor(e/1e3)|0,col:e%1e3|0}}h(sr,"_getid");m(sr,"_getid");d(sr,"_getid");f(sr,"_getid");b(sr,"_getid");var Lb=f(class extends F{m_fields;m_record;m_sheet;m_label_w;constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){this.m_record=e.record,this.m_fields=e.fields??[],this.m_label_w=e.labelWidth,this.m_sheet=new Cg({cls:"@fit",columns:[{title:ae.global.property,width:this.m_label_w>0?this.m_label_w:-1,cls:"property"},{title:ae.global.value,width:-1,createEditor:(...t)=>this._editCell(...t),renderer:(...t)=>this._renderCell(...t)}],autoedit:!0,change:t=>this._cellChange(t)}),this._updateProperties(),this.setContent(this.m_sheet)}setFields(e){e?(this.m_fields=e,this._updateProperties()):this.m_sheet.clearData()}setRecord(e){this.m_record=e,this._updateProperties()}_updateProperties(){this.m_sheet.lockUpdate(!0),this.m_sheet.clearData(),this.m_fields.forEach((e,t)=>{this.m_sheet.setCellText(t,0,e.title),this.m_record?this.m_sheet.setCellText(t,1,this.m_record.getField(e.id)):this.m_sheet.setCellText(t,1,e.value)}),this.m_sheet.lockUpdate(!1)}_cellChange(e){let t=e.context,i=e.value;if(t.col!=1)return;let s=this.m_fields[t.row];switch(s.type){default:case"string":break;case"number":break;case"password":break;case"boolean":break;case"choice":break}this.m_record?this.m_record.setField(s.id,i):s.value=i,this.emit("change",Oe(i,s))}_renderCell(e,t){switch(this.m_fields[t.row].type){default:case"string":break;case"number":break;case"password":{e="\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF";break}case"boolean":break;case"choice":break}return e}_editCell(e,t,i){let s=this.m_fields[t],r;switch(s.type){default:case"string":{r=new yi(e);break}case"number":{r=new yi(e);break}case"password":{e.type="password",e.value=this.m_record.getField(s.id),r=new es(e);break}case"boolean":{r=new ph(e);break}case"choice":break}return r}_choicesFromArray(e){return e.map(i=>typeof i=="object"?{id:i.id,text:i.value}:{id:i,text:""+i})}_choicesFromStore(e,t){let i=[];for(let s=0,r=e.count;s<r;s++){let n=e.getByIndex(s);i.push({id:n.getID(),text:n.getField(t)})}return i}},"PropertyEditor");b(Lb,"PropertyEditor");var yg=f(class extends F{m_ui_input;constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){let t=e.text??"",i=e.name??e.group,s=e.labelWidth??-1,r=e.checked??!1,n=e.align??"left",l=e.value,o=e.icon;this.setTag("label"),this.addClass("@hlayout"),this.addClass(n),this._setTabIndex(e.tabIndex),r&&this.addClass("checked"),this.setContent([this.m_ui_input=new es({type:"radio",name:i,tabIndex:e.tabIndex,value:l,attrs:{checked:r?"":void 0},dom_events:{change:()=>this._change(),focus:()=>this.m_ui_input.focus()}}),new je({ref:"label",icon:o,text:t,width:s==="flex"?void 0:s,flex:s==="flex"?1:void 0,style:{order:n=="right"?-1:void 0}})])}_change(){let t=".x-input[name="+this.m_props.name+"]";O.querySelectorAll(t).forEach(r=>{F.getElement(r,yg).removeClass("checked")});let s=this.m_ui_input.dom;this.setClass("checked",s.checked),this.emit("change",Oe(!0))}get check(){return this.m_ui_input?this.m_ui_input.dom.checked:this.m_props.checked}set check(e){let t=this.m_ui_input.dom;e?(t&&(t.checked=!0),this.m_props.checked=!0):(t&&(t.checked=!1),this.m_props.checked=!1)}get text(){return this.itemWithRef("label").text}set text(e){this.itemWithRef("label").text=e}},"RadioBtn");b(yg,"RadioBtn");var Vb=f(class extends he{m_els;m_input;constructor(e){super(e),e.steps=e.steps??5}render(e){let t=e.shape??"star",i=e.value??0;this.m_input=new es({cls:"@hidden",name:e.name,value:""+i}),this.addClass(t),this.setDomEvent("click",s=>this._onclick(s)),this.m_els=[];for(let s=0;s<e.steps;s++){let r="item";s+1<=i&&(r+=" checked");let n=new F({tag:"option",cls:r,data:{value:s+1}});this.m_els.push(n)}this.m_els.push(this.m_input),this.setContent(this.m_els)}getValue(){return this.m_props.value??0}set value(e){this.m_props.value=e;for(let t=0;t<this.m_props.steps;t++)this.m_els[t].setClass("checked",this.m_els[t].getData("value")<=e);this.m_input.value=""+this.m_props.value}set steps(e){this.m_props.steps=e,this.update()}set shape(e){this.removeClass(this.m_props.shape),this.m_props.shape=e,this.addClass(this.m_props.shape)}_onclick(e){let t=!0;for(let i=this.dom.firstChild;i;i=i.nextSibling){let s=F.getElement(i);s.setClass("checked",t),i==e.target&&(this.m_input.value=s.getData("value"),t=!1)}this.emit("change",Oe(this.m_props.value))}},"Rating");b(Vb,"Rating");function la(e,t=!1){if(e instanceof RegExp)return{keys:null,pattern:e};let i=e.split("/"),s=[],r="";i[0]==""&&i.shift();for(let n of i){let l=n[0];if(l==="*")s.push("wild"),r+="/(.*)";else if(l===":"){let o=n.indexOf("?",1),a=n.indexOf(".",1);s.push(n.substring(1,o>=0?o:a>=0?a:n.length)),r+=o>=0&&a<0?"(?:/([^/]+?))?":"/([^/]+?)",a>=0&&(r+=(o>=0?"?":"")+"\\"+n.substring(a))}else r+="/"+n}return{keys:s,pattern:new RegExp(`^${r}${t?"(?=$|/)":"/?$"}`,"i")}}h(la,"parseRoute");m(la,"parseRoute");d(la,"parseRoute");f(la,"parseRoute");b(la,"parseRoute");var Eg=f(class extends Po{m_routes;m_useHash;constructor(e=!0){super(),this.m_routes=[],this.m_useHash=e,window.addEventListener("popstate",t=>{let i=this._getLocation(),s=this._find(i);s.handlers.forEach(r=>{r(s.params,i)})})}get(e,t){let{keys:i,pattern:s}=la(e);this.m_routes.push({keys:i,pattern:s,handler:t})}init(){this.navigate(this._getLocation())}_getLocation(){return this.m_useHash?"/"+O.location.hash.substring(1):O.location.pathname}navigate(e,t=!0){let i=this._find(e);if(!i||i.handlers.length==0){console.log("route not found: "+e),this.signal("error",Mo(404,"route not found"));return}if(this.m_useHash){for(;e.startsWith("/");)e=e.substring(1);window.history.pushState({},"","#"+e)}else window.history.pushState({},"",e);t&&i.handlers.forEach(s=>{s(i.params,e)})}_find(e){let t=[],i={},s=[];for(let r of this.m_routes)if(r.keys)if(r.keys.length>0){if(t=r.pattern.exec(e),t===null)continue;for(let n=0;n<r.keys.length;)i[r.keys[n]]=t[++n];s=[...s,r.handler]}else r.pattern.test(e)&&(s=[...s,r.handler]);else{if(t=r.pattern.exec(e),!t)continue;if(t.groups)for(let n in t.groups)i[n]=t.groups[n];s=[...s,r.handler]}return{params:i,handlers:s}}},"Router");b(Eg,"Router");var Bb=f(class extends Jd{m_sidebar;m_content;constructor(e){super(e),this.addClass("@hlayout"),this.m_sidebar=new kt({cls:"@side-bar",width:e.bar_width??void 0}),this.m_content=new he({flex:1,cls:"@tab-container"})}render(){let e=[];this.m_cards.forEach(t=>{e.push(t.selector)}),this.m_sidebar.setContent(new kt({flex:1,cls:"content",content:e})),this.setContent([this.m_sidebar,this.m_props.bar_sizable?new og({orientation:"horizontal",sizing:"before"}):void 0,this.m_content])}_prepareSelector(e){return new wt({text:e.title,icon:e.icon,tooltip:e.title,click:()=>{this.switchTo(e.name)}})}_preparePage(e){super._preparePage(e),e.dom||this.m_content.appendChild(e)}},"SideBarView");b(Bb,"SideBarView");var Hb=/^-?\d+(\.\d+)?$/;function oa(e){return e*Math.PI/180}h(oa,"d2r");m(oa,"d2r");d(oa,"d2r");f(oa,"d2r");b(oa,"d2r");function Nn(e,t,i,s){let r=oa(s);return{x:e+i*Math.cos(r),y:t+i*Math.sin(r)}}h(Nn,"p2c");m(Nn,"p2c");d(Nn,"p2c");f(Nn,"p2c");b(Nn,"p2c");function Ze(e){return Math.round(e*1e3)/1e3}h(Ze,"num");m(Ze,"num");d(Ze,"num");f(Ze,"num");b(Ze,"num");function Br(e,...t){return t=t.map(i=>typeof i=="number"&&isFinite(i)?Ze(i):i),String.raw(e,...t)}h(Br,"clean");m(Br,"clean");d(Br,"clean");f(Br,"clean");b(Br,"clean");var fl=f(class{m_tag;m_attrs;m_style;constructor(e){this.m_tag=e,this.m_attrs=new Map,this.m_style=new Map}render(){return`<${this.m_tag} ${this.renderAttrs()} ${this.renderStyle()}>${this.renderContent()}</${this.m_tag}>`}stroke(e,t){return this.attr("stroke",e),t!==void 0&&this.attr("stroke-width",t+"px"),this}strokeWidth(e){return this.attr("stroke-width",e+"px"),this}fill(e){return this.attr("fill",e),this}attr(e,t){return this.m_attrs.set(e,t),this}style(e,t){if(t===void 0||t===""||t===void 0){this.m_style.delete(e);return}return!lg[e]&&(qr(t)||Hb.test(t))&&(t=t+"px"),this.m_style.set(e,""+t),this}class(e){let t=this.m_attrs.get("class");return this.m_attrs.set("class",(t??" "+e).trim()),this}renderAttrs(){if(!this.m_attrs.size)return"";let e="";return this.m_attrs.forEach((t,i)=>{e+=` ${i} = "${t}"`}),e}renderStyle(){if(!this.m_style.size)return"";let e='style="';return this.m_style.forEach((t,i)=>{e+=`${i}:${t};`}),e+'"'}renderContent(){return""}clip(e){return this.attr("clip-path",`url(#${e})`),this}transform(e){this.attr("transform",e)}rotate(e,t,i){this.transform(`rotate( ${e} ${t} ${i} )`)}translate(e,t){this.transform(`translate( ${e} ${t} )`)}scale(e){this.transform(`scale( ${e} )`)}},"SVGItem");b(fl,"SVGItem");var kg=f(class extends fl{m_path;constructor(){super("path"),this.m_path=""}renderAttrs(){return this.attr("d",this.m_path),super.renderAttrs()}moveTo(e,t){return this.m_path+=Br`M${e},${t}`,this}lineTo(e,t){return this.m_path+=Br`L${e},${t}`,this}closePath(){return this.m_path+="Z",this}arc(e,t,i,s,r){let n=Nn(e,t,i,s-90),l=Nn(e,t,i,r-90),o=r-s<=180?"0":"1";return this.m_path+=Br`M${n.x},${n.y}A${i},${i} 0 ${o} 1 ${l.x},${l.y}`,this}},"SVGPath");b(kg,"SVGPath");var Sg=f(class extends fl{m_text;constructor(e,t,i){super("text"),this.m_text=i,this.attr("x",Ze(e)+""),this.attr("y",Ze(t)+"")}font(e){return this.attr("font-family",e),this}fontSize(e){return this.attr("font-size",e+""),this}fontWeight(e){return this.attr("font-weight",e),this}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.attr("text-anchor",t),this}verticalAlign(e){let t;switch(e){case"top":t="hanging";break;case"center":t="middle";break;case"bottom":t="baseline";break;default:return}return this.attr("alignment-baseline",t),this}renderContent(){return this.m_text}},"SVGText");b(Sg,"SVGText");var Vu=f(class extends fl{constructor(e){super(e)}},"SVGShape");b(Vu,"SVGShape");var Bu=f(class extends fl{m_id;m_stops;constructor(e,t,i,s){super("linearGradient"),this.m_id="gx-"+Bu.g_id,this.attr("id",this.m_id),this.attr("x1",Me(e)?e:Ze(e)+""),this.attr("x2",Me(i)?i:Ze(i)+""),this.attr("y1",Me(t)?t:Ze(t)+""),this.attr("y2",Me(s)?s:Ze(s)+""),this.m_stops=[],Bu.g_id++}get id(){return"url(#"+this.m_id+")"}addStop(e,t){return this.m_stops.push({offset:e,color:t}),this}renderContent(){let e=[];return this.m_stops.forEach(t=>{e.push(`<stop offset="${t.offset}%" stop-color="${t.color}"></stop>`)}),e.join(`
|
|
15
|
+
`)}},"_SVGGradient"),i_=Bu;b(i_,"SVGGradient");pe(i_,"g_id",1);var Hu=f(class extends fl{m_items;constructor(e="g"){super(e),this.m_items=[]}path(){let e=new kg;return this.m_items.push(e),e}text(e,t,i){let s=new Sg(e,t,i);return this.m_items.push(s),s}ellipse(e,t,i,s=i){let r=new Vu("ellipse");return r.attr("cx",Ze(e)+""),r.attr("cy",Ze(t)+""),r.attr("rx",Ze(i)+""),r.attr("ry",Ze(s)+""),this.m_items.push(r),r}rect(e,t,i,s){let r=new Vu("rect");return r.attr("x",Ze(e)+""),r.attr("y",Ze(t)+""),r.attr("width",Ze(i)+""),r.attr("height",Ze(s)+""),this.m_items.push(r),r}linear_gradient(e,t,i,s){let r=new i_(e,t,i,s);return this.m_items.push(r),r}clear(){this.m_items=[]}renderContent(){let e=[];return this.m_items.forEach(t=>{e.push(t.render())}),e.join(`
|
|
16
|
+
`)}},"SVGGroup");b(Hu,"SVGGroup");var Dg=f(class extends Hu{constructor(){super("")}addClip(e,t,i,s){let r="c-"+Dg.g_clip_id++,n=new Hu("clipPath");return n.attr("id",r),n.rect(e,t,i,s),this.m_items.push(n),r}render(){let e=[];return this.m_items.forEach(t=>{e.push(t.render())}),e.join(`
|
|
17
|
+
`)}},"_SVGPathBuilder"),Ig=Dg;b(Ig,"SVGPathBuilder");pe(Ig,"g_clip_id",1);var Ob=f(class extends F{constructor(e){super(e),this.setTag("svg","http://www.w3.org/2000/svg"),this.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.setAttributes({viewBox:e.viewBox}),this.setContent(e.path)}},"SVGComponent");b(Ob,"SVGComponent");var Wb=f(class extends Lt{m_pages;m_curPage;constructor(e){super(e),this.m_pages=[],this.m_curPage=null,this.mapPropEvents(e,"change"),e.vertical?this.addClass("@vlayout"):this.addClass("@hlayout"),this.m_props.pages?.forEach(t=>this.addPage(t))}componentCreated(){this.m_props.default&&this.select(this.m_props.default,!0)}addPage(e){this.m_pages.push({...e}),this._updateContent()}render(){let e=[];this.m_pages.forEach(t=>{t.btn=new wt({cls:t===this.m_curPage?"selected":"",text:t.title,icon:t.icon,click:()=>this._select(t,!0)}),e.push(t.btn)}),this.setContent(e)}select(e,t=!1){if(e){let i=this.m_pages.find(s=>s.id===e);return i?(this._select(i,t),!0):!1}else return this._select(null,t),!0}_select(e,t){if(this.m_curPage!=e){if(!this.dom){this.m_props.default=e.id;return}this.m_curPage&&(this.m_curPage.btn.removeClass("selected"),this.m_curPage.page&&this.m_curPage.page.hide()),this.m_curPage=e,t&&this.signal("change",Oe(e?e.id:null)),this.m_curPage&&(this.m_curPage.btn.addClass("selected"),this.m_curPage.page&&this.m_curPage.page.show())}}get selection(){return this.m_curPage?.page}},"TabBar");b(Wb,"TabBar");var jb=f(class extends Jd{m_tab_selector;m_menu;constructor(e){super(e),this.m_tab_selector=!!e.tab_selector,this.m_menu=e.menu,this.addClass("@vlayout")}render(){let e=[],t=[];this.m_menu&&(this.m_menu.addClass("@button @tab-btn"),this.m_menu.removeClass("@menu-item"),e.push(this.m_menu)),this.m_cards.forEach(i=>{e.push(i.selector),i.page instanceof Function||t.push(i.page)}),this.m_tab_selector&&t.unshift(new he({cls:"@tab-switch",content:e})),this.setContent(t)}_updateSelector(){}_prepareSelector(e){return new wt({cls:"@tab-btn",text:e.title,icon:e.icon,click:()=>{this.switchTo(e.name)}})}_preparePage(e){super._preparePage(e),e.dom||this.appendChild(e)}},"TabView");b(jb,"TabView");var Gb=f(class extends F{constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){e.text=e.text??"",this.setAttribute("tabindex",e.tabIndex??0),e.spellcheck===!1&&this.setAttribute("spellcheck","false"),e.readOnly!==void 0&&this.setAttribute("readonly",e.readOnly),e.rows&&this.setAttribute("rows",e.rows),e.placeHolder&&this.setAttribute("placeholder",e.placeHolder),e.autoFocus&&this.setAttribute("autofocus",e.autoFocus),e.name&&this.setAttribute("name",e.name),e.autoGrow&&(this.m_props.autoGrow=!0,this.setAttribute("rows",this._calcHeight(e.text)),this.setDomEvent("keydown",()=>{Cs(()=>this._updateHeight())})),this.setDomEvent("keydown",t=>{t.stopPropagation()}),this.setTag("textarea"),this.setDomEvent("input",()=>this._change())}_change(){this.emit("change",Oe(this.value))}componentCreated(){this.value=this.m_props.text}get value(){return this.dom?this.dom.value:this.m_props.text}set value(e){this.m_props.text=e??"",this.dom&&(this.dom.value=this.m_props.text,this.m_props.autoGrow&&this.setAttribute("rows",this._calcHeight(this.m_props.text)))}get text(){return this.value}set text(e){this.value=e}_calcHeight(e){return 1+(e.match(/\n/g)||[]).length}_updateHeight(){let e=this.value,t=this._calcHeight(e);this.getData("lines")!=t&&(this.setAttribute("rows",t),this.setData("lines",t))}insertText(e){this.appendText(e)}appendText(e){if(this.dom){let t=this.dom,i=t.selectionEnd;t.setRangeText(e,i,i,"end")}}replaceText(e){this.dom&&this.dom.setRangeText(e)}getSelection(){if(this.dom){let e=this.dom;return{start:e.selectionStart,end:e.selectionEnd}}else return{start:0,end:0}}setSelection(e){if(this.dom){let t=this.dom;e.start!==void 0&&(t.selectionStart=e.start),e.end!==void 0&&(t.selectionEnd=e.end)}}getStoreValue(){return this.value}setStoreValue(e){this.value=e}},"TextArea");b(Gb,"TextArea");var Nb=f(class extends us{m_message;m_icon;constructor(e){super(e),this.m_message=e.message,this.m_icon=e.icon,this.enableMask(!1),this.addClass("@non-maskable")}render(){this.addClass("@hlayout"),this.setContent([new je({icon:this.m_icon,text:this.m_message})])}show(){this.show=super.show,this.displayAt(9999,9999,"br",{x:0,y:-24});let e=1;this.startTimer("fadeout",2e3,!1,()=>{this.startTimer("opacity",100,!0,()=>{this.setStyleValue("opacity",e),e-=.1,e<0&&this.dispose()})})}},"Toaster");b(Nb,"Toaster");function aa(e){return ke({node:e})}h(aa,"EvExpand");m(aa,"EvExpand");d(aa,"EvExpand");f(aa,"EvExpand");b(aa,"EvExpand");var Ub=f(class extends kt{m_view;m_container;m_selection;constructor(e){super(e),e.root=e.root,e.indent=e.indent??8,e.gadgets=e.gadgets,e.sort=e.sort??!1,this.m_selection=null,this.m_container=new Lt({cls:"@scroll-container"}),this.m_view=new Lt({cls:"@scroll-view",flex:1,content:this.m_container}),this.setContent([this.m_view,e.gadgets?new he({cls:"gadgets",content:e.gadgets}):null]),this.setDomEvent("click",t=>this._click(t)),this.setDomEvent("dblclick",t=>this._click(t)),this.setDomEvent("contextmenu",t=>this._handleCtxMenu(t)),e.canDragItems&&(this.setDomEvent("dragstart",t=>{let s=F.getElement(t.target,F)?.getData("node");s?(t.dataTransfer.effectAllowed="move",t.dataTransfer.items.add(JSON.stringify({type:"treeview",id:s.id}),"string")):(t.preventDefault(),t.stopPropagation())}),this.setDomEvent("dragover",t=>this._dragEnter(t)),this.setDomEvent("dragenter",t=>this._dragEnter(t)),this.setDomEvent("dragend",t=>this._dragLeave(t)),this.setDomEvent("dragleave",t=>this._dragLeave(t)),this.setDomEvent("drop",t=>this._dragLeave(t)),this.setDomEvent("drop",t=>this._drop(t))),this.mapPropEvents(e,"dblclick","drag","selectionchange","contextMenu")}_dragEnter(e){e.preventDefault();let t=F.getElement(e.target,F);t?.getData("node")&&(t.addClass("@drag-over"),e.dataTransfer.dropEffect="move")}_dragLeave(e){let t=F.getElement(e.target,F);t?.getData("node")&&t.removeClass("@drag-over")}_drop(e){let t=F.getElement(e.target,F),i=t?.getData("node");if(i||(i=this.m_props.root),i){let s;i.children?s=i:s=t.getData("parent");for(let r=0;r<e.dataTransfer.items.length;r++)e.dataTransfer.items[0].getAsString(n=>{let l=JSON.parse(n);this.emit("drag",Ao(i,l,s))})}}render(){this.__update()}__update(){if(this.m_props.root){let e=[];this._buildBranch(this.m_props.root,-1,e,this.m_props.root),this.m_container.setContent(e)}}updateElement(e){let{node:t,item:i}=this._getNode(e);if(t){let s=t.dom.parentNode,r=this._makeNode(i,t.dom.classList.value,t.getData("icon"),t.getData("level")),n=r._build();s.replaceChild(n,t.dom),this.m_selection?.el===t&&(this.m_selection.el=r)}}set root(e){this.m_props.root=e,this.update()}openAll(e=!0){this.forEach(t=>{t.children&&(t.open=e)}),this.__update()}refreshRoot(e){let t=[];this.forEach(s=>(s.open&&t.push(s.id),!1));let i=this.selection;e&&(this.m_props.root=e),this.forEach(s=>(t.indexOf(s.id)>=0&&(s.open=!0),!1)),this.__update()}_buildBranch(e,t,i,s){let r="@tree-item";e.cls&&(r+=" "+e.cls),!e.open&&e.children&&(r+=" collapsed"),e.children&&(r+=" folder",e.children.length==0&&(r+=" empty"));let n=e.icon;if(n===void 0&&e.children&&(e.open===!0?n="var(--x4-icon-chevron-down)":n="var(--x4-icon-chevron-right)"),t>=0){let l=this._makeNode(e,r,n,t);this.m_selection?.id==e.id&&(this.m_selection.el=l,l.addClass("selected")),i.push(l)}(t==-1||e.open)&&e.children&&(this.m_props.sort&&(e.children=e.children.sort((l,o)=>{let a=(l.children?"0"+l.text:l.text)?.toLocaleLowerCase(),c=(o.children?"0"+o.text:o.text)?.toLocaleLowerCase();return a<c?-1:a>c?1:0})),e.children.forEach(l=>{this._buildBranch(l,t+1,i,e)}))}_renderDef(e){return new je({cls:"tree-label",flex:1,text:e.text})}_makeNode(e,t,i,s){return new he({cls:t,content:[new st({cls:"tree-icon",icon:i}),this.m_props.renderItem?this.m_props.renderItem(e):this._renderDef(e)],data:{node:e,level:s,icon:i},style:{paddingLeft:4+s*this.m_props.indent},attrs:{draggable:this.m_props.canDragItems?!0:void 0}})}forEach(e){let t=null;function i(s){if(e(s)==!0)return!0;if(s.children){for(let r=0;r<s.children.length;r++)if(i(s.children[r]))return!0}}return h(i,"scan"),m(i,"scan"),d(i,"scan"),f(i,"scan"),b(i,"scan"),this.m_props.root&&i(this.m_props.root),t}ensureVisible(e){let{node:t}=this._getNode(e);t&&t.scrollIntoView()}set selection(e){this.select(e,!1)}select(e,t=!0){if(this.m_selection?.el&&this.m_selection.el.removeClass("selected"),this.m_selection=null,e!==void 0){let{node:i}=this._getNode(e);if(i&&(this.m_selection={id:e,el:i},i.addClass("selected"),i.scrollIntoView(),t)){let s=i.getData("node");this.emit("selectionchange",ui(s))}}else t&&this.emit("selectionchange",ui(null))}_getNode(e){let t={node:null,item:null};return this.m_container.enumChilds(i=>{let s=i.getData("node");if(s?.id==e)return t={node:i,item:s},!0}),t}get selection(){return this.m_selection?.id}getNodeWithId(e){return this.forEach(t=>t.id==e)}_click(e){let t=e.target,i=t,s=!1;for(t.tabIndex!==-1&&(s=!0);t!=this.dom;){let r=F.getElement(t),n=r?.getData("node");if(n){if(n.children&&!s){(r.hasClass("selected")||i.classList.contains("tree-icon"))&&(n.open=!n.open),this.m_selection={id:n.id,el:null};let l=this.m_view?.dom?.scrollTop;this.update(),l&&this.m_view.dom.scrollTo(0,l),this.emit("expand",aa(n))}else this.selection=n.id,s||(e.type=="click"?this.emit("click",ns(n)):this.emit("dblclick",dr(n)));this.emit("selectionchange",ui(n));return}t=t.parentElement}e.type=="click"&&(this.m_selection=null,this.update(),this.emit("selectionchange",ui(null)))}_handleCtxMenu(e){e.preventDefault();let t=e.target,i=t;for(;t!=this.dom;){let r=F.getElement(t)?.getData("node");if(r){if(r.children&&i.classList.contains("tree-icon"))return;this.selection=r.id,this.emit("click",ns(r)),this.emit("contextMenu",xs(e,r));return}t=t.parentElement}this.selection=null,this.emit("contextMenu",xs(e,null))}static buildFromStrings(e,t="/"){let i={id:0,text:"<root>",children:[]};function s(r,n){let l=n.indexOf(t),o=n.substr(0,l<0?void 0:l),a;l>=0&&(a=r.find(c=>c.text==o)),a||(a={id:n,text:o},r.push(a)),l>=0&&(a.children||(a.children=[]),s(a.children,n.substr(l+t.length)))}return h(s,"insert"),m(s,"insert"),d(s,"insert"),f(s,"insert"),b(s,"insert"),e.forEach(r=>{s(i.children,r)}),i}static buildFromHierarchy(e,t){let i={id:0,text:"<root>",children:[]},s=[];function r(n){let l,o;n.parent>0?(o=s.find(a=>a.id==n.parent),o||(o={id:n.parent,text:"",children:[]},s.push(o)),o.children||(o.children=[])):o=i,l=s.find(a=>a.id==n.id),l?(l.text=n.name,l.parent=n.parent):(l={id:n.id,text:n.name,parent:n.parent,cls:n.cls,icon:n.icon,data:n.data},n.leaf?l.icon=null:l.children=[]),s.push(l),o.children.push(l)}return h(r,"insert"),m(r,"insert"),d(r,"insert"),f(r,"insert"),b(r,"insert"),e.forEach(r),t&&s.forEach(t),i}},"TreeView");b(Ub,"TreeView");var vC=Symbol("fragment"),$b=f(class extends F{render(e){let t=this.renderTSX(e);t&&this.setContent(t)}},"TSXComponent");b($b,"TSXComponent");var Nf=Symbol("msg_sent");function Pm(e){let t=window.location.protocol==="https:"?"wss://":"ws://",i=new WebSocket(`${t}${window.location.hostname}:${window.location.port}`,"messaging"),s=no.instance();s.on("global",r=>{r[Nf]||i.send(JSON.stringify({msg:r.msg,params:r.params}))}),i.onmessage=r=>{if(r.data!="ping"){let n=JSON.parse(r.data);n[Nf]=!0,s.signal("global",n)}},i.onclose=r=>{console.log("websocket closed:",r),e()},i.onerror=r=>{console.log("websocket error:",r)}}h(Pm,"setupWSMessaging");m(Pm,"setupWSMessaging");d(Pm,"setupWSMessaging");f(Pm,"setupWSMessaging");b(Pm,"setupWSMessaging");var wC=Symbol(),Ka=d(class extends tl{static instance(){return Ka.self}m_mainView;m_app_name;m_app_version;m_app_uid;m_local_storage;m_user_data;m_touch_time;m_touch_count;m_router;constructor(e){console.assert(Ka.self===null,"application is a singleton"),super(e),this.m_app_name=e.app_name??"application",this.m_app_version=e.app_version??"1.0",this.m_app_uid=e.app_uid??"application";let t=`${this.m_app_name}.${this.m_app_version}.settings`;this.m_local_storage=new Qp(t),this.m_user_data={},this.m_touch_time=0,this.m_touch_count=0,this.m_router=null,qb=Ka.self=this,"onload"in globalThis?globalThis.addEventListener("load",()=>{this.ApplicationCreated()}):this.ApplicationCreated()}ApplicationCreated(){this.setTitle("")}get router(){return this.m_router||(this.m_router=new Eg),this.m_router}get app_name(){return this.m_app_name}get app_uid(){return this.m_app_uid}get app_version(){return this.m_app_version}get local_storage(){return this.m_local_storage}get user_data(){return this.m_user_data}get history(){debugger;return null}setMainView(e,t){let i=this.m_props.renderTo??H.body,s=Qt(i);this.m_props.renderTo||s.setStyleValue("position","absolute"),s.addClass("x4-root-element"),t&&s._empty(),this.m_mainView=e,e.setStyleValue("position","absolute"),e._build(),i.appendChild(e.dom)}set mainView(e){this.setMainView(e,!1)}get mainView(){return this.m_mainView}setTitle(e){H.title=this.m_app_name+(e?" > "+e:"")}disableZoomWheel(){window.addEventListener("wheel",function(e){e.ctrlKey&&e.preventDefault()},{passive:!1,capture:!0})}enterModal(e){}enableTouchDblClick(){H.addEventListener("touchstart",e=>{let t=Date.now();if(t-this.m_touch_time>700?this.m_touch_count=1:this.m_touch_count++,this.m_touch_time=t,this.m_touch_count==2){this.m_touch_count=0;let i=e.touches[0],s={type:"dblclick"};for(let r in i)s[r]=i[r];T._dispatchEvent(s),e.stopPropagation()}})}},"_Application2"),lo=Ka;f(lo,"Application");fe(lo,"self",null);var qb,Kb=d(class extends Rt{},"AbsLayout2");f(Kb,"AbsLayout");var me=d(class extends Rt{},"HLayout2");f(me,"HLayout");var St=d(class extends Rt{},"VLayout2");f(St,"VLayout");var Yb=d(class extends Rt{constructor(e){super(e),this.setDomEvent("sizechange",()=>this._updateLayout())}componentCreated(){super.componentCreated(),this._updateLayout()}_updateLayout(){let e=this.m_props.defaultLayout=="horizontal";if(this.m_props.switchSize<=0&&window.screen.height>window.screen.width)e=!e;else{let t=this.getBoundingRect();(e&&t.width<this.m_props.switchSize||!e&&t.height<this.m_props.switchSize)&&(e=!e)}e?(this.removeClass("@vlayout"),this.addClass("@hlayout")):(this.addClass("@vlayout"),this.removeClass("@hlayout"))}},"AutoLayout2");f(Yb,"AutoLayout");var Xb=d(class extends Rt{constructor(e){super(e)}render(){this.m_props.colSizes&&this.setStyleValue("grid-template-columns",this.m_props.colSizes),this.m_props.rowSizes&&this.setStyleValue("grid-template-rows",this.m_props.rowSizes),this.m_props.colGap&&this.setStyleValue("grid-gap",this.m_props.colGap),this.m_props.template&&this.setStyleValue("grid-template-areas",this.m_props.template.join(`
|
|
18
|
+
`))}},"GridLayout2");f(Xb,"GridLayout");var Zb=d(class extends Rt{m_cells;constructor(e){super(e),this.setTag("table"),this.m_cells=new Map}_getCell(e,t,i=!0){let s=Js(e,t);return this.m_cells.get(s)??(i?{item:void 0}:null)}_setCell(e,t,i,s=!1){let r=Js(e,t);this.m_cells.set(r,i),this.dom&&i.item&&s&&(i.item instanceof T?i.item.update():this.enumChilds(n=>{if(n.getData("row")==e&&n.getData("col")==t)return n.setContent(i.item),n.update(),!0}))}setCell(e,t,i){let s=this._getCell(e,t);s.item=i,this._setCell(e,t,s,!0)}setCellData(e,t,i){let s=this._getCell(e,t);s.data=i,this._setCell(e,t,s,!0)}getCellData(e,t){return this._getCell(e,t,!1)?.data}merge(e,t,i,s){let r=this._getCell(e,t);r.rowSpan=i,r.colSpan=s,this._setCell(e,t,r)}setCellWidth(e,t,i){let s=this._getCell(e,t);s.width=i,this._setCell(e,t,s)}setCellHeight(e,t,i){let s=this._getCell(e,t);s.height=i,this._setCell(e,t,s)}setCellClass(e,t,i){let s=this._getCell(e,t);s.cls=i,this._setCell(e,t,s)}setColClass(e,t){let i=this._getCell(-1,e);i.cls=t,this._setCell(-1,e,i)}setRowClass(e,t){let i=this._getCell(e,999);i.cls=t,this._setCell(e,999,i)}getCell(e,t){return this._getCell(e,t)?.item}render(){let e=[],t=[];for(let i=0;i<this.m_props.rows;i++){let s=[];for(let l=0;l<this.m_props.columns;l++){let o=Js(i,l);if(t.indexOf(o)>=0)continue;let a=this.m_cells.get(o),c=this.m_cells.get(Js(-1,l)),u="";a&&a.cls&&(u=a.cls),c&&c.cls&&(u+=" "+c.cls);let _=new T({tag:"td",content:a?.item,width:a?.width,height:a?.height,data:{row:i,col:l},cls:u});if(a){let p=a.rowSpan??0,v=a.colSpan??0;if(p>0&&_.setAttribute("rowspan",p+1),v>0&&_.setAttribute("colspan",v+1),p||v)for(let g=0;g<=p;g++)for(let x=0;x<=v;x++)t.push(Js(g+i,x+l))}s.push(_)}let r=this._getCell(i,999,!1),n=new T({tag:"tr",data:{row:i},content:s,cls:r?.cls});e.push(n)}this.setContent(e)}},"TableLayout2");f(Zb,"TableLayout");function Js(e,t){return e*1e3+t}h(Js,"_mkid3");m(Js,"_mkid3");d(Js,"_mkid3");f(Js,"_mkid");var Jb=d(class extends T{constructor(e){super(e),this.setContent(e.content)}setContent(e){if(!e)super.setContent(null);else{let t;Jt(e)?t=new St({content:e}):t=e,t.addClass("@scroll-container"),super.setContent(t)}}},"ScrollView2");f(Jb,"ScrollView");var Qb=d(class extends Rt{constructor(e){let t=e.items;e.items=void 0,super(e),this.setDomEvent("sizechange",()=>{this.resizeAllItems()}),t&&t.forEach(i=>{this.addItem(i)})}resizeItem(e){let t=this.getComputedStyle(),i=t.parse("grid-auto-rows"),s=t.parse("grid-row-gap"),r=e.queryItem(".content");if(r||(r=e),r&&i+s){let n=r.getBoundingRect(),l=Math.ceil((n.height+s)/(i+s));e.setStyleValue("gridRowEnd","span "+l)}}resizeAllItems(){this.queryAll(".item",e=>{this.resizeItem(e)})}addItem(e){e.addClass("content"),this.appendChild(new Rt({cls:"item",content:e}))}},"Masonry2");f(Qb,"Masonry");function Tm(e){return Ie({pos:e})}h(Tm,"EvMove2");m(Tm,"EvMove2");d(Tm,"EvMove2");f(Tm,"EvMove");var Ya=d(class extends Rt{m_ui_mask;m_hasMask=!0;constructor(e){super(e),this.addClass("@hidden")}enableMask(e=!0){this.m_hasMask=e}show(e){if(e!==void 0?this.m_hasMask=!!e:e=this.m_hasMask,this.m_hasMask){let t=H.activeElement;for(t&&t.blur(),this.m_ui_mask=H.body.lastChild;this.m_ui_mask;){if(this.m_ui_mask.nodeType==1){let i=Qt(this.m_ui_mask);if(!(i.hasClass("@menu")||i.hasClass("@non-maskable"))){if(!(i.getStyleValue("display")=="none"||!i.isUserVisible())){if(i.hasClass("@comp"))break}}}this.m_ui_mask=this.m_ui_mask.previousSibling}this.m_ui_mask&&Qt(this.m_ui_mask).addClass("@mask")}if(e&&lo.instance().enterModal(!0),this.setStyle({left:0,top:0}),H.body.appendChild(this._build()),this.removeClass("@hidden"),this.centerOnScreen(),e){let t=H.activeElement;if(!this.dom.contains(t)){let i=this.queryItem("[autofocus]");if(i)i.focus();else{let s=this.queryAll("[tabindex]");s&&(s=s.filter(r=>r.offsetParent!==null),s.length&&s[0].focus())}}Ya.modal_stack.push(this.dom)}}centerOnScreen(){let e=this.getBoundingRect(),t=`max( 0px, 50vw - ${e.width/2}px )`,i=`max( 0px, 50vh - ${e.height/2}px )`;this.setStyleValue("left",t),this.setStyleValue("top",i)}displayAt(e,t,i="top left",s,r=!1){this.show(r);let n="l",l="t";i.indexOf("right")>=0&&(n="r"),i.indexOf("bottom")>=0&&(l="b");let o=H.body.getBoundingClientRect(),a=this.getBoundingRect();n=="r"&&(e-=a.width),l=="b"&&(t-=a.height),s&&(e+=s.x,t+=s.y),e<4&&(e=4),e+a.width>o.right-4&&(e=o.right-4-a.width,s?.x<0&&(e+=s.x)),t<4&&(t=4),t+a.height>o.bottom-4&&(t=o.bottom-4-a.height,s?.y<0&&(t+=s.y)),this.setStyle({left:e,top:t})}close(){this.hide(),this.m_hasMask&&this.m_ui_mask&&(Qt(this.m_ui_mask).removeClass("@mask"),lo.instance().enterModal(!1));let e=Ya.modal_stack.indexOf(this.dom);e>=0&&Ya.modal_stack.splice(e),this.dispose()}componentCreated(){if(this.m_props.sizable){this.addClass("@size-all");let e=["top","right","bottom","left","topleft","topright","bottomleft","bottomright"];for(let t of e)new Jh({target:this,sens:t,events:{rawresize:i=>this._mouseResize(i)}})}}_mouseResize(e){e.preventDefault();let t=this.getBoundingRect(),i=this.getComputedStyle(),s=e.ui_event,r=i.parse("marginTop"),n=i.parse("marginLeft"),l=i.parse("marginRight"),o=i.parse("marginBottom"),a=0,c=0,u=Ji(s,!0);switch(e.sens){case"topright":case"bottomright":case"right":a=t.right-l-u.x;break;case"topleft":case"bottomleft":case"left":a=t.left-n-u.x;break}switch(e.sens){case"bottomleft":case"bottomright":case"bottom":c=t.bottom-o-u.y;break;case"topleft":case"topright":case"top":c=t.top-r-u.y;break}t.left-=n,t.top-=r;let _=e.sens;T.setCapture(this,p=>{let v=f((g,x)=>{let E=t.left,y=t.top,k=t.width,A=t.height,S,w,D=g+a,R=x+c;switch(D<0&&(D=0),R<0&&(R=0),_){case"topright":case"bottomright":case"right":k=D-E;break;case"topleft":case"bottomleft":case"left":S=E-D,k+=S,E-=S;break}switch(_){case"bottomleft":case"bottomright":case"bottom":A=R-y;break;case"topleft":case"topright":case"top":w=y-R,A+=w,y-=w;break}let C=new Pn(k,A);this.setStyle({left:E,top:y,width:C.width,height:C.height}),this.emit("size",vt(C))},"__move");if(p.type=="mouseup"||p.type=="touchend")T.releaseCapture();else if(p.type=="mousemove"){let g=p;v(g.pageX,g.pageY)}else if(p.type=="touchmove"){let g=p;v(g.touches[0].pageX,g.touches[0].pageY)}})}},"_Popup2"),_s=Ya;f(_s,"Popup");fe(_s,"modal_stack",[]);function Fm(e){if(e.key=="Tab"||e.key=="Enter"){let t=e.target;if(t.tagName=="TEXTAREA")return;let i=T.getElement(t);if(i&&(i.hasAttribute("wants-tab")||i.hasAttribute("wants-enter")))return;let s=H.body;_s.modal_stack.length&&(s=_s.modal_stack[_s.modal_stack.length-1]),zm(s,e.target,e.shiftKey),e.stopPropagation(),e.preventDefault()}}h(Fm,"x4handleKeyDown2");m(Fm,"x4handleKeyDown2");d(Fm,"x4handleKeyDown2");f(Fm,"x4handleKeyDown");function zm(e,t,i){let s=H.activeElement;if(!e.contains(s))return;let r=T.getElement(t),n=Array.from(e.querySelectorAll("[tabindex]"));if(n=n.filter(o=>o.offsetParent!==null),!n.length)return;let l=n.indexOf(t);l<0?l=0:i?l>0?l--:l=n.length-1:l<n.length-1?l++:l=0,n[l].focus()}h(zm,"_nextTab2");m(zm,"_nextTab2");d(zm,"_nextTab2");f(zm,"_nextTab");function oo(){H.body.addEventListener("keydown",Fm,!0)}h(oo,"installKBHandler2");m(oo,"installKBHandler2");d(oo,"installKBHandler2");f(oo,"installKBHandler");H.body?oo():window.addEventListener("load",oo);function Rm(e){return Ie({source:e})}h(Rm,"EvAction2");m(Rm,"EvAction2");d(Rm,"EvAction2");f(Rm,"EvAction");var Ag=d(class extends tl{constructor(e){super(e),this.mapPropEvents(e,"run")}get props(){return this.m_props}set text(e){this.m_props.text=e,this.emit("change",$e(this))}set icon(e){this.m_props.icon=e,this.emit("change",$e(this))}fire(){this.emit("run",Rm(this))}},"Action2");f(Ag,"Action");function Pr(e,t,i=null){return Ie({url:e,svg:t,context:i})}h(Pr,"EvLoaded2");m(Pr,"EvLoaded2");d(Pr,"EvLoaded2");f(Pr,"EvLoaded");function ao(e){let t=e.length;return e[0]=='"'&&e[t-1]=='"'&&(e=e.substring(1,t-1),e=e.replaceAll('\\"',"'")),e}h(ao,"trimQuotes2");m(ao,"trimQuotes2");d(ao,"trimQuotes2");f(ao,"trimQuotes");var Mg=d(class extends bo{svgs;constructor(){super(),this.svgs=new Map}load(e){if(this.svgs.has(e)){let t=this.svgs.get(e);t&&this.signal("loaded",Pr(e,t))}else this.svgs.set(e,null),f(async i=>{if(i.substring(0,24)=="data:image/svg+xml;utf8,"){let s=i.substring(24);this.svgs.set(i,s),this.signal("loaded",Pr(i,s))}else{let s=await fetch(i);if(s.ok){let r=await s.text();!r.startsWith("<svg")&&!r.startsWith("<?xml")?(console.error("svg loading error: ",r),this.signal("loaded",Pr(i,""))):(this.svgs.set(i,r),this.signal("loaded",Pr(i,r)))}}},"_load")(e)}},"Loader2");f(Mg,"Loader");var du=new Mg,Ou=d(class extends T{m_icon;m_iconName;constructor(e){Fe(e)?super({icon:e}):super(e),this._setIcon(this.m_props.icon,!1),this.m_props.size&&this.setStyleValue("fontSize",this.m_props.size)}_setIcon(e,t){if(!e){this.m_iconName="";return}this.removeClass("@svg");let i,s;if(typeof e=="number")e=e.toString(16),i=e,console.error("deprecation error: invalid icon name");else{let l=/\s*var\s*\(\s*(.+)\s*\)\s*/gi,o=l.exec(e);for(;o;){let y=o[1].trim();if(e=Nr.getVar(y).trim(),e==""||e===void 0){console.error(`icon: unable to find variable named '${y}'`);return}else e=ao(e);o=l.exec(e)}if(e.startsWith("<svg")){this._setSVG("data:image/svg+xml;utf8,"+e);return}let a=/\s*svg\s*\(\s*(.+)\s*\)\s*/gi,c=/(.*\.svg)$/gi,u=a.exec(e)||c.exec(e);if(u){let y=u[1].trim();this._setSVG(y);return}let p=/^\s*(data\:image\/.+)\s*$/gi.exec(e);if(p){this._setSVG(p[1]);return}let g=/\s*cls\s*\(\s*(.+)\s*\)\s*/gi.exec(e);if(g){let y=g[1].trim();this.addClass(y);return}let E=/\s*url\s*\(\s*(.+)\s*\)\s*/gi.exec(e);if(E){s=ao(E[1].trim()),s=s.replaceAll("\\",""),this._setSVG(s);return}else console.error("deprecation error: invalid icon name"),i=e,e=Nr.getVar("icon-"+e),(e==""||e===void 0)&&(e="0")}if(this.m_iconName=i,this.m_icon===e)return;let r=T.getCss(),n;if(t&&this.m_icon&&(n="icon-"+i,this.removeClass(n)),n="icon-"+i,Ou.icon_cache[n]===void 0){Ou.icon_cache[n]=!0;let l;s?l=`display: block; content: ' '; background-image: url(${s}); background-size: contain; width: 100%; height: 100%; background-repeat: no-repeat; color: white;`:l=`content: "\\${e}";`,r.setRule(n,`.${n}::before {${l}}`)}this.addClass(n),this.m_icon=e}set icon(e){this._setIcon(e,!0)}get icon(){return this.m_iconName}_setSVG(e){let t=f(i=>{i.url==e&&(this.addClass("@svg-icon"),this.setContent(Ki.from(i.svg),!1),du.off("loaded",t))},"set");du.on("loaded",t),du.load(e)}_setSVGPath(e){this.addClass("@svg-icon"),this.setContent(Ki.from(`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="${e}/></svg>`),!1)}},"_Icon2"),rt=Ou;f(rt,"Icon");fe(rt,"icon_cache",[]);var Ge=d(class extends T{constructor(e){typeof e=="string"||e instanceof Ki?super({text:e}):super(e)}render(e){let t=this.m_props.text;this.m_props.multiline&&!(t instanceof Ki)&&(t=new Ki(Tn(t,!0))),e.icon?(this.setTag("span"),this.addClass("@hlayout"),this.setContent([new rt({icon:e.icon}),new T({content:t,ref:"text"})])):this.setContent(t),this.addClass(e.align??"left")}set text(e){let t=this.m_props;if(t.text!==e){t.text=e;let i=this.m_props.text;if(this.m_props.multiline&&!(i instanceof Ki)&&(i=new Ki(Tn(i,!0))),this.dom){let s=this;this.m_props.icon&&(s=this.itemWithRef("text")),s.setContent(i)}}}get text(){return this.m_props.text}},"Label2");f(Ge,"Label");var ex=d(class extends T{},"MenuSeparator2");f(ex,"MenuSeparator");var tx=d(class extends Ge{},"MenuTitle2");f(tx,"MenuTitle");var ft=d(class extends _s{m_subMenu;m_opener;m_virtual;m_lock;constructor(e,t){super(e),this.addClass("@shadow"),this.m_opener=t,this.m_virtual=!1,this.m_lock=0,this.enableMask(!1)}lock(e){this.m_lock+=e?1:-1}setVirtual(){this.m_virtual=!0}setSubMenu(e){this.m_subMenu=e}hideSubMenu(){this.m_subMenu&&(this.m_subMenu.m_opener._close(),this.m_subMenu.hide(),this.m_subMenu=null)}render(e){this.setContent(e.items)}show(){this.m_virtual||ft._addMenu(this),super.show()}close(){!this.dom&&!this.m_virtual||(this.m_opener&&this.m_opener._close(),this.m_subMenu&&(this.m_subMenu.close(),this.m_subMenu=null),super.close(),ft._removeMenu())}clear(){this.m_props.items=[]}static _addMenu(e){ft.watchCount==0&&(ft.rootMenu=e,H.addEventListener("mousedown",ft._mouseWatcher)),ft.watchCount++}static _removeMenu(){console.assert(ft.watchCount>0),ft.watchCount--,ft.watchCount==0&&H.removeEventListener("mousedown",ft._mouseWatcher)}static _mouseWatcher(e){if(e.defaultPrevented)return;let t=e.target;for(;t;){let i=T.getElement(t);if(i&&i instanceof ft)return;t=t.parentElement}ft._discardAll()}static _discardAll(){ft.rootMenu&&(ft.rootMenu.close(),ft.rootMenu=null)}displayAt(...e){this.m_lock||ft._discardAll();let t,i,s,r;e.length==1?{x:t,y:i}=Ji(e[0],!0):[t,i,s,r]=e,s||(s="top left"),super.displayAt(t,i,s,r)}},"_Menu2"),fs=ft;f(fs,"Menu");fe(fs,"watchCount",0);fe(fs,"rootMenu",null);var Un=d(class extends T{m_menu;m_isOpen;m_action;constructor(e,t){e instanceof Ag?(super({click:()=>{e.fire()}}),this.m_action=e):Fe(e)?super({text:e,click:t}):super(e),this.mapPropEvents(this.m_props,"click"),this.m_menu=null,this.m_isOpen=!1,this.setDomEvent("mousedown",i=>this._mousedown(i)),this.setDomEvent("click",i=>this._click(i))}render(e){let t=e.icon??0,i=e.text;e.checked!==void 0&&(t=e.checked?"var( --x4-icon-check )":0),this.m_action&&(t||(t=this.m_action.props.icon),i===void 0&&(i=this.m_action.props.text));let s=null;this.isPopup&&(this.addClass("@popup-menu-item"),s=new rt({icon:"var( --x4-icon-chevron-right )",cls:"pop-mark"})),!i&&!t&&this.addClass("@separator"),e.cls&&this.addClass(e.cls),this.setTag("a"),this.setContent([t<0?null:new rt({icon:t}),new Ge({flex:1,text:i}),s])}get id(){return this.m_props.itemId}get text(){return this.m_props.text}get isPopup(){return!!this.m_props.items}_close(){this.removeClass("@opened"),this.m_isOpen=!1}_click(e){this.isPopup||(this.emit("click",bs()),fs._discardAll())}_mousedown(e){if(this.isPopup){this.m_menu||(this.m_menu=new fs({items:this.m_props.items},this));let t=this.m_isOpen,i=T.getElement(this.dom,fs);if(i&&i.hideSubMenu(),!t){i&&i.setSubMenu(this.m_menu),this.m_isOpen=!0;let s=this.getBoundingRect();this.m_menu.lock(!0),i?this.m_menu.displayAt(s.right,s.top):this.m_menu.displayAt(s.left,s.bottom),this.m_menu.lock(!1),this.addClass("@opened")}e.preventDefault()}}},"MenuItem2");f(Un,"MenuItem");var ix=d(class extends me{m_items;constructor(e,t){super(e),console.assert(!1,"not imp"),this.addClass("@shadow"),this.m_items=e.items}render(){this.setContent(this.m_items)}},"MenuBar2");f(ix,"MenuBar");var Pg=d(class extends St{m_selection;m_defer_sel;m_container;m_view;m_topIndex;m_itemHeight;m_cache;constructor(e){super(e),this.setDomEvent("keydown",t=>this.handleKey(t)),this.setDomEvent("click",t=>this._handleClick(t)),this.setDomEvent("dblclick",t=>this._handleClick(t)),this.setDomEvent("contextmenu",t=>this._handleCtxMenu(t)),this._setTabIndex(e.tabIndex,0),this.mapPropEvents(e,"click","dblClick","contextMenu","selectionChange","cancel")}componentCreated(){this.m_props.virtual?this._buildItems():this.m_props.populate&&(this.items=this.m_props.populate(null))}render(e){e.items=e.items||[],e.gadgets=e.gadgets,e.renderItem=e.renderItem,e.virtual=e.virtual??!1,this.m_topIndex=0,e.virtual?(console.assert(e.itemHeight!==void 0),this.m_itemHeight=e.itemHeight,this.m_cache=new Map,this.addClass("virtual")):(this.m_itemHeight=void 0,this.m_cache=void 0),this._buildContent()}set items(e){this.setItems(e)}get items(){return this.m_props.items}setItems(e,t=!0){this.m_props.items=e,t||(this.m_selection=null),this.m_container?this._buildItems():this._buildContent()}handleKey(e){let t=f(i=>{let s;di(this.m_props.items)?(s=this.m_props.items(),this.m_props.items=s):s=this.m_props.items;let r;if(!this.m_selection)s&&(r=s[0]);else{let l=s.findIndex(o=>o===this.m_selection.item);i>0&&l<s.length-1?r=s[l+1]:i<0&&l>0?r=s[l-1]:r=this.selection}let n=this._findItemWithId(r?.id);this._selectItem(r,n,!0)},"moveSel");switch(e.key){case"ArrowDown":{t(1),e.preventDefault(),e.stopPropagation();break}case"ArrowUp":{t(-1),e.preventDefault(),e.stopPropagation();break}}}_buildContent(){let e=this.m_props;e.virtual?(this.m_container=new Rt({cls:"@scroll-container",content:[]}),this.m_view=new Rt({cls:"@scroll-view",flex:1,content:this.m_container,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)}}),this.setContent([this.m_view,e.gadgets?new me({cls:"gadgets",content:e.gadgets}):null])):(this.m_view=void 0,this.m_container=new St({cls:"@scroll-container",content:[]}),this.addClass("@scroll-view"),this.setContent(this.m_container,!1)),e.virtual&&this.m_container.setStyleValue("height",e.items.length*this.m_itemHeight),(this.dom||!e.virtual)&&this._buildItems()}_updateScroll(e){let t=f(()=>{let i=Math.floor(this.m_view.dom.scrollTop/this.m_itemHeight);(i!=this.m_topIndex||e)&&(this.m_topIndex=i,this._buildItems())},"update");e?this.startTimer("scroll",10,!1,t):t()}async _buildItems(){let e=this.m_props,t=[],i=e.items;di(i)&&(i=i());let s=this.m_selection?.item.id,r=!1;if(e.virtual){let n=this.getBoundingRect(),l=100,o=0,a=this.m_topIndex*this.m_itemHeight,c=this.m_topIndex,u=n.height,_=e.items.length,p=[],v=this.m_cache;for(this.m_cache=new Map;o<u&&c<_&&--l>0;){let g=e.items[c],x;v.has(g.id)?(x=v.get(g.id),v.delete(g.id)):(x=this._renderItem(g),p.push(x)),s==g.id&&(x.addClass("@selected"),r=!0),x.setStyleValue("top",a+o),t.push(x),this.m_cache.set(g.id,x),o+=this.m_itemHeight,c++}v.forEach(g=>{g.dispose()}),this.m_container.appendChild(p),this.m_container.setStyleValue("height",_*this.m_itemHeight),r||i.some(g=>s==g.id)||(this.m_selection=null)}else i.forEach(n=>{let l=this._renderItem(n);s==n.id&&(l.addClass("@selected"),r=!0),t.push(l)}),this.m_container.setContent(t,!1),r||(this.m_selection=null);if(this.m_defer_sel){let n=this.m_defer_sel;this.m_defer_sel=void 0,this.selection=n}}_renderItem(e){let t=this.onRenderItem(e);return t.setAttribute("data-id",e.id),t.addClass("@list-item"),t.setData("item-id",e.id),t}onRenderItem(e){return this.m_props.renderItem?this.m_props.renderItem(e):new me({content:e.text})}_handleClick(e){e.stopImmediatePropagation(),e.preventDefault();let t=e.target,i=this.dom,s=this.m_props.items;for(;t&&t!=i;){let r=T.getElement(t),n=r?.getData("item-id");if(n!==void 0){let l=s.find(o=>o.id==n);if(l){let o;e.type=="click"?(o=bs(l),this.emit("click",o)):(o=Jr(l),this.emit("dblClick",o)),o.defaultPrevented||this._selectItem(l,r)}else this._selectItem(null,null);return}t=t.parentElement}this._selectItem(null,null)}_handleCtxMenu(e){e.preventDefault();let t=e.target,i=this.dom,s=this.m_props.items;for(;t&&t!=i;){let r=T.getElement(t),n=r?.getData("item-id");if(n){let l=s.find(o=>o.id==n);l&&(this._selectItem(l,r),this.emit("contextMenu",Ns(e,l)));return}t=t.parentElement}this.emit("contextMenu",Ns(e,null))}_selectItem(e,t,i=!0){this.m_selection&&this.m_selection.citem&&this.m_selection.citem.removeClass("@selected"),this.m_selection=e?{item:e,citem:t}:null,this.m_selection&&this.m_selection.citem&&this.m_selection.citem.addClass("@selected"),i&&this.emit("selectionChange",bi(e))}get selection(){return this.m_selection?this.m_selection.item:null}set selection(e){if(e==null)this._selectItem(null,null);else if(di(this.m_props.items))this.m_defer_sel=e;else{let t=this.m_props.items.find(s=>s.id==e),i=this._findItemWithId(t.id);this._selectItem(t,i,!1)}}_findItemWithId(e){let t=null;return this.dom&&this.m_container.enumChilds(i=>{if(i.getData("item-id")==e)return i.scrollIntoView(),t=i,!0}),t}appendItem(e,t=!1,i=!0){t?this.m_props.items.unshift(e):this.m_props.items.push(e),i&&(this.selection=null),this.m_container?this._buildItems():this._buildContent(),i&&(this.selection=e.id)}updateItem(e,t){let i=this.m_props.items.findIndex(n=>n.id===e);if(i<0)return;let s=!1;this.m_selection&&this.m_selection.item===this.m_props.items[i]&&(s=!0),this.m_props.items[i]=t;let r=this.queryItem(`[data-id="${t.id}"]`)?.dom;if(r){let n=this._renderItem(t);s&&(n.addClass("@selected"),this.m_selection.citem=n,this.m_selection.item=t);let l=n._build();this.m_container.dom.replaceChild(l,r)}}},"ListView2");f(Pg,"ListView");function Lm(e=null){return Ie({context:e})}h(Lm,"EvCancel2");m(Lm,"EvCancel2");d(Lm,"EvCancel2");f(Lm,"EvCancel");var s_=d(class extends _s{m_list;constructor(e){super({tabIndex:!1}),this.enableMask(!1),this.addClass("@non-maskable"),e.tabIndex=!1,this.m_list=new Pg(e),this.setContent(this.m_list),this.mapPropEvents(e,"cancel")}set items(e){this.m_list.items=e}handleKey(e){this.m_list.handleKey(e)}_handleClick=e=>{if(!this.dom)return;let t=e.target;this.dom.contains(t)||T.getElement(t,Un)||(this.signal("cancel",Lm()),this.close())};show(e){H.addEventListener("mousedown",this._handleClick),super.show(e)}hide(){H.removeEventListener("mousedown",this._handleClick),super.hide()}close(){H.removeEventListener("mousedown",this._handleClick),super.close()}get selection(){return this.m_list.selection}set selection(e){this.m_list.selection=e}},"PopupListView2");f(s_,"PopupListView");var ts=d(class extends T{constructor(e){super(e)}render(e){this.setTag("input"),this._setTabIndex(e.tabIndex),this.setAttributes({value:e.value,type:e.type||"text",name:e.name,placeholder:e.placeHolder,autofocus:e.autoFocus,readonly:e.readOnly,autocomplete:"new-password",tabIndex:e.tabIndex,spellcheck:e.spellcheck===!1?"false":void 0,min:e.min,max:e.max,...e.attrs}),this.m_props.autosel=e.autosel??!0,e.uppercase&&this.setStyleValue("textTransform","uppercase"),this.m_props.autosel&&this.setDomEvent("focus",()=>{this.selectAll()})}getType(){return this.m_props.type}get value(){if(this.dom&&(this.m_props.value=this.dom.value),this.m_props.uppercase){let e=this.m_props.value.toUpperCase();this.dom&&e!=this.m_props.value&&(this.dom.value=e),this.m_props.value=e}return this.m_props.value}set value(e){this.m_props.value=e,this.dom&&(this.dom.value=e)}getStoreValue(){if(this.m_props.value_hook)return this.m_props.value_hook.get();{let e=this.getAttribute("type");e&&(e=e.toLowerCase());let t,i=this.dom;if(e==="file"){t=[];let s=i.files;for(let r=0;r<s.length;r++)t.push(s[r].name)}else if(e==="checkbox")i.checked?t=1:t=0;else if(e==="radio")i.checked&&(t=this.value);else if(e==="date")debugger;else t=this.value;return t}}setStoreValue(e){if(this.m_props.value_hook)return this.m_props.value_hook.set(e);{let t=this.getAttribute("type"),i=this.dom;if(t&&(t=t.toLowerCase()),t==="checkbox"){let s=e!==null&&e!=="0"&&e!==0&&e!==!1;s!==i.checked&&(i.setAttribute("checked",""+s),i.dispatchEvent(new Event("change")))}else this.value=e}}set readOnly(e){this.setAttribute("readonly",e)}selectAll(){this.dom.select()}select(e,t=9999){this.dom.setSelectionRange(e,e+t)}getSelection(){let e=this.dom;return{start:e.selectionStart,length:e.selectionEnd-e.selectionStart}}},"Input2");f(ts,"Input");var r_=d(class extends T{constructor(e){super(e),this.setTag("button"),this.setDomEvent("click",t=>this._handleClick(t)),this.setDomEvent("mousedown",()=>{this._startAutoRep(!0)}),this.setDomEvent("mouseup",()=>{this._startAutoRep(!1)}),this.setDomEvent("keydown",t=>this._handleKeyDown(t)),this.mapPropEvents(e,"click")}render(e){let t=e.action,i=e.icon,s=e.text;t&&(!i&&t.props.icon&&(i=t.props.icon),s===void 0&&t.props.text&&(s=t.props.text));let r=i?new rt({icon:i,cls:"left",ref:"l_icon"}):null,n=new Ge({flex:1,text:s??"",align:e.align,ref:"label"}),l=e.rightIcon?new rt({icon:e.rightIcon,cls:"right",ref:"r_icon"}):null;s===void 0&&n.addClass("@hidden"),this.setContent([r,n,l]),this._setTabIndex(e.tabIndex)}_startAutoRep(e){this.m_props.autoRepeat&&(e?this.startTimer("repeat",700,!1,()=>{this.startTimer("repeat",this.m_props.autoRepeat,!0,this._sendClick)}):this.stopTimer("repeat"))}_handleKeyDown(e){!e.ctrlKey&&!e.shiftKey&&!e.altKey&&(e.key=="Enter"||e.key==" ")&&(this._sendClick(),e.preventDefault(),e.stopPropagation())}_handleClick(e){if(this.m_props.menu){let t=new fs({items:di(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),i=this.getBoundingRect();t.displayAt(i.left,i.bottom,"tl")}else this._sendClick();e.preventDefault(),e.stopPropagation()}_sendClick(){if(this.m_props.menu){let e=new fs({items:di(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),t=this.getBoundingRect();e.displayAt(t.left,t.bottom,"tl")}else this.emit("click",bs()),this.m_props.action&&this.m_props.action.fire()}set text(e){this.m_props.text=e;let t=this.itemWithRef("label");t&&(t.text=e,t.removeClass("@hidden"))}get text(){return this.itemWithRef("label")?.text}set icon(e){this.m_props.icon=e;let t=this.itemWithRef("l_icon");t?t.icon=e:this.update()}get icon(){return this.itemWithRef("l_icon")?.icon}set rightIcon(e){this.m_props.rightIcon=e;let t=this.itemWithRef("r_icon");t&&(t.icon=e)}get rightIcon(){return this.itemWithRef("l_icon")?.icon}set menu(e){this.m_props.menu=e}},"BaseButton2");f(r_,"BaseButton");var bt=d(class extends r_{},"Button2");f(bt,"Button");var sx=d(class extends r_{constructor(e){super(e)}render(e){super.render(e),e.checked&&(this.addClass("checked"),this._updateIcon())}_sendClick(){super._sendClick(),this.m_props.checked=!this.m_props.checked,this.setClass("checked",this.m_props.checked),this.emit("change",$e(this.m_props.checked)),this._updateIcon()}_updateIcon(){if(this.m_props.checkedIcon){let e=this.m_props.checked?this.m_props.checkedIcon:this.m_props.icon,t=this.itemWithRef("l_icon");t&&(t.icon=e)}}},"ToggleButton2");f(sx,"ToggleButton");var Tg=d(class extends St{m_date;constructor(e){super(e),this.mapPropEvents(e,"change"),this.m_date=e.date?.clone()??new Date}render(e){let t=Rr(this.m_date);t.setDate(1);let i=t.getDay();i==0&&(i=7),t.setDate(-i+1+1);let s=Rr(t),r=this.m_date.hash(),n=Rr(this.m_date);n.setDate(1),n.setMonth(n.getMonth()+1),n.setDate(0);let l=Gr(n),o=[],a=new me({cls:"month-sel",content:[new Ge({cls:"month",text:Et(this.m_date,"O"),dom_events:{click:()=>this._choose("month")}}),new Ge({cls:"year",text:Et(this.m_date,"Y"),dom_events:{click:()=>this._choose("year")}}),new dh,new bt({text:"<",click:()=>this._next(!1)}),new bt({text:">",click:()=>this._next(!0)})]});o.push(a);let c=[];c.push(new me({cls:"weeknum cell"}));for(let p=0;p<7;p++)c.push(new Ge({cls:"cell",flex:1,text:oe.global.day_short[(p+1)%7]}));o.push(new me({cls:"week header",content:c}));let u=this.m_date.getMonth(),_=!0;for(;Gr(s)<=l;){let p=[new me({cls:"weeknum cell",content:new T({tag:"span",content:Et(s,"w")})})];for(let v=0;v<7;v++){let g="cell day";s.hash()==r&&(g+=" today"),s.getMonth()!=u&&(g+=" out");let x=f(E=>new me({cls:g,flex:1,content:new T({tag:"span",content:Et(E,"d")}),dom_events:{click:()=>this.select(E)}}),"mkItem");p.push(x(s.clone())),s.setDate(s.getDate()+1),_=!1}o.push(new me({cls:"week",flex:1,content:p}))}this.setContent(o)}select(e){this.m_date=e,this.emit("change",$e(e)),this.update()}_next(e){this.m_date.setMonth(this.m_date.getMonth()+(e?1:-1)),this.update()}_choose(e){let t=[];if(e=="month")for(let r=0;r<12;r++)t.push(new Un({text:oe.global.month_long[r],click:()=>{this.m_date.setMonth(r),this.update()}}));else if(e=="year"){let r=this.m_props.minDate?.getFullYear()??1900,n=this.m_props.maxDate?.getFullYear()??2037;for(let l=r;l<n;l++)t.push(new Un({text:""+l,click:()=>{this.m_date.setFullYear(l),this.update()}}))}let i=new fs({items:t}),s=this.getBoundingRect();i.displayAt(s.left,s.top)}get date(){return this.m_date}set date(e){this.m_date=e,this.update()}},"Calendar2");f(Tg,"Calendar");var Fg=d(class extends _s{m_cal;constructor(e){super({tabIndex:1}),this.enableMask(!1),this.m_cal=new Tg(e),this.m_cal.addClass("@fit"),this.setContent(this.m_cal)}_handleClick=e=>{if(!this.dom)return;let t=e.target;this.dom.contains(t)||T.getElement(t,Un)||this.close()};show(e,t){H.addEventListener("mousedown",this._handleClick),t?super.displayAt(t.x,t.y,"top left",void 0,e):super.show(e)}close(){H.removeEventListener("mousedown",this._handleClick),super.close()}},"PopupCalendar2");f(Fg,"PopupCalendar");var _u,Ms,n_=d(class extends T{m_text;set text(e){this.m_text.text=e}render(){this.setClass("@non-maskable",!0),this.setContent([new rt({icon:"var( --x4-icon-tip )"}),this.m_text=new Ge({text:"help"})])}displayAt(e,t,i="top left"){this.show();let s="l",r="t";i.indexOf("right")>=0&&(s="r"),i.indexOf("bottom")>=0&&(r="b");let n=H.body.getBoundingClientRect(),l=this.getBoundingRect();s=="r"&&(e-=l.width),r=="b"&&(t-=l.height),e+l.width>n.right&&(e=n.right-l.width),t+l.height>n.bottom&&(t=n.bottom-l.height-17),this.setStyle({left:e,top:t})}},"Tooltip2");f(n_,"Tooltip");function l_(e){if(So())return;let t={target:null,x:0,y:0};function i(n){t.x=n.pageX,t.y=n.pageY}h(i,"handle_mpos"),m(i,"handle_mpos"),d(i,"handle_mpos"),f(i,"handle_mpos");function s(n){let l=n.target,o=null;for(t.x=n.pageX+10,t.y=n.pageY+15;l&&(o=l.getAttribute("tip"),!o);)l=l.parentElement;if(!(l==t.target||Ms&&l==Ms.dom)){if(!l||!o){t.target=null,e?e(null):r();return}t.target=l,e?e(null):r(),e?e(o):_u=setTimeout(()=>{Ms===void 0&&(Ms=new n_({}),H.body.appendChild(Ms._build())),Ms.text=o,Ms.displayAt(t.x+17,t.y+17,"top left")},700)}}h(s,"handle_mouse"),m(s,"handle_mouse"),d(s,"handle_mouse"),f(s,"handle_mouse");function r(){_u&&clearTimeout(_u),Ms&&Ms.hide()}h(r,"_hideTip"),m(r,"_hideTip"),d(r,"_hideTip"),f(r,"_hideTip"),H.body.addEventListener("mouseover",s),H.body.addEventListener("mouseout",s),H.body.addEventListener("mousemove",i)}h(l_,"initTooltips2");m(l_,"initTooltips2");d(l_,"initTooltips2");f(l_,"initTooltips");var rx=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Ei=d(class extends T{m_cal_popup;m_ui_input;m_error_tip;constructor(e){super(e),this.addClass("@hlayout"),this.mapPropEvents(e,"change","click","focus")}componentCreated(){super.componentCreated(),this.m_props.autoFocus&&this.focus()}componentDisposed(){this.m_error_tip&&this.m_error_tip.dispose(),super.componentDisposed()}focus(){this.m_ui_input.focus()}render(e){let t={flex:1,dom_events:{focus:()=>this._focus(),focusout:()=>this._blur(),input:()=>this._change()},value:e.value,name:e.name,type:e.type,placeHolder:e.placeHolder,autoFocus:e.autoFocus,readOnly:e.readOnly,value_hook:e.value_hook,uppercase:e.uppercase,spellcheck:e.spellcheck,tabIndex:e.tabIndex===void 0?!0:e.tabIndex,attrs:e.attrs,min:e.min,max:e.max,autosel:e.autosel};if(e.type=="date"){e.format=e.format??"Y-M-D",t.type="text";let _={get:()=>this._date_get_hook(),set:p=>this._date_set_hook(p)};t.value_hook=e.value_hook??_}this.m_ui_input=new ts(t);let i;e.icon?i=new bt({icon:e.icon,click:()=>this._btnClick(),tabIndex:!1}):e.type=="date"&&(i=new bt({cls:"gadget",icon:"var( --x4-icon-calendar-days )",tabIndex:!1,click:()=>this._showDatePicker(i)}),e.validator||(e.validator=this._date_validator));let s=e.gadgets??[];s.forEach(_=>{_.addClass("gadget")});let r=[i,...s];this.setClass("@required",e.required),e.gadgets&&e.gadgets.length&&this.addClass("with-gadgets");let n,l,o=e.labelWidth;o>0&&(n=o),o<0&&(l=-o);let a,c=e.labelAlign,u=!1;e.label&&(c=="top"&&(c="left",u=!0,l=1),a=new Ge({ref:"label",tag:"label",cls:"label1"+(e.label?"":" @hidden"),text:e.label??"",width:n,flex:l,align:c})),u?(this.removeClass("@hlayout"),this.addClass("@vlayout vertical"),this.setContent([a,new me({width:n,content:[this.m_ui_input,...r]})])):(this.addClass("@hlayout"),this.setContent([a,this.m_ui_input,...r]))}enable(e){e===!0&&this.m_ui_input.enable(),super.enable(e)}disable(){this.m_ui_input.disable(),super.disable()}_btnClick(){this.emit("click",bs(this.value))}setDateStoreFormat(e){this.m_props.format=e}setStoreValue(e){this.m_ui_input.setStoreValue(e)}getStoreValue(){return this.m_ui_input.getStoreValue()}_date_get_hook(){let e=En(this.value),t=this.m_props;return t.format=="native"?e:e?Et(e,t.format):null}_date_set_hook(e){let t=this.m_props;if(t.format=="native")this.value=Et(e);else if(e){let i=En(e,t.format);this.value=Et(i)}else this.value=""}showError(e){this.m_error_tip||(this.m_error_tip=new n_({cls:"error"}),H.body.appendChild(this.m_error_tip._build()));let t=this.m_ui_input.getBoundingRect();this.m_error_tip.text=e,this.m_error_tip.displayAt(t.right,t.top,"top left"),this.addClass("@error")}clearError(){this.m_error_tip&&(this.m_error_tip.hide(),this.removeClass("@error"))}get value(){return this.m_ui_input?this.m_ui_input.value:this.m_props.value}set value(e){this.m_ui_input?this.m_ui_input.value=e:this.m_props.value=e}selectAll(){this.m_ui_input.selectAll()}select(e,t=9999){this.m_ui_input.select(e,t)}getSelection(){return this.m_ui_input.getSelection()}set readOnly(e){this.m_ui_input.readOnly=e}get label(){return this.itemWithRef("label")?.text}set label(e){this.itemWithRef("label").text=e}_change(){let e=this.m_ui_input.value;this.emit("change",$e(e))}_focus(){this.clearError(),this.emit("focus",ro(!0))}_blur(){this._validate(this.m_ui_input.value),this.emit("focus",ro(!1))}validate(){return this._validate(this.value)}_validate(e){let t=this.m_props,i=!1;if(t.required&&e.length==0)return this.showError(oe.global.required_field),!1;if(e!=""){let s=this.getAttribute("pattern");if(s){let r=new RegExp(s);if(r&&!r.test(e))return this.showError(oe.global.invalid_format),!1}if(t.type=="email"){if(!rx.test(e.toLowerCase()))return this.showError(oe.global.invalid_email),!1}else if(t.type=="number"){let r=parseFloat(e);if(isNaN(r))return this.showError(oe.global.invalid_number),!1;let n=parseFloat(this.m_ui_input.getAttribute("min"));n!==void 0&&r<n&&(e=""+n,i=!0);let l=parseFloat(this.m_ui_input.getAttribute("max"));l!==void 0&&r>l&&(e=""+l,i=!0)}}if(t.validator)try{this.value=t.validator(e)}catch(s){return this.showError(s instanceof Error?s.message:s),!1}else i&&(this.value=e);return!0}_date_validator(e){if(e=e.trim(),e=="")return"";let t;if(e=="@")t=new Date;else if(t=En(e),!t)throw zr(oe.global.invalid_date,oe.global.date_format);return Et(t)}_showDatePicker(e){this.m_cal_popup||(this.m_cal_popup=new Fg({change:i=>{this.value=Et(i.value),this.m_cal_popup.close()}}));let t=this.m_ui_input.getBoundingRect();this.m_cal_popup.displayAt(t.left,t.bottom,"top left")}get input(){return this.m_ui_input}get type(){return this.m_props.type}},"TextEdit2");f(Ei,"TextEdit");var nx=d(class extends Ei{m_popup;m_popvis;m_needval;m_lockpop;constructor(e){super(e),this.setDomEvent("input",()=>this._onChange()),this.setDomEvent("focusin",()=>this._onFocus()),this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.m_popvis=!1,this.m_needval=!1,this.m_lockpop=!1,this.setDomEvent("keydown",t=>this._onKey(t))}_onKey(e){this.m_popvis?e.key=="ArrowUp"||e.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(e),this.m_lockpop=!1,e.preventDefault(),e.stopPropagation()):e.key=="Escape"&&(this._hidePopup(),e.preventDefault(),e.stopPropagation()):e.key=="ArrowDown"&&(this._onChange(),e.preventDefault(),e.stopPropagation())}_onChange(){let e=this.m_props.enumValues(this.value);this.showPopup(e)}componentDisposed(){this.m_popup&&this._hidePopup(),super.componentDisposed()}showPopup(e){if(this.m_props.readOnly||this.hasClass("@disable"))return;if(!this.m_popup){let s=this.getComputedStyle(),r=s.value("fontFamily"),n=s.value("fontSize");this.m_popup=new s_({cls:"@combo-popup",attrs:{tabindex:0},selectionChange:l=>{this.value=l.selection.id,this.m_lockpop||(this._hidePopup(),this.focus())},style:{fontFamily:r,fontSize:n}})}this.m_popup.items=e.map(s=>({id:s,text:s}));let i=this.m_ui_input.getBoundingRect();this.m_popup.setStyle({minWidth:i.width}),this.m_popup.displayAt(i.left,i.bottom),this.m_popvis=!0}_validate(e){return!0}validate(){return super._validate(this.value)}_checkFocus(){let e=document.activeElement;this.dom&&this.dom.contains(e)||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(e)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1),this.m_needval&&(this.validate(),this.m_needval=!1)}_onFocus(){this.value.length==0&&this._onChange(),this.m_needval=!0}},"AutoComplete2");f(nx,"AutoComplete");function Vm(e){return Ie({ctx:e})}h(Vm,"EvPaint2");m(Vm,"EvPaint2");d(Vm,"EvPaint2");f(Vm,"EvPaint");function Bm(e,t,i){let s=e;return s.width=t,s.height=i,s.smoothLine=Hm,s.smoothLineEx=Om,s.line=Wm,s.roundRect=jm,s.calcTextSize=Gm,s.setFontSize=Nm,s.circle=Um,s}h(Bm,"mkPainter2");m(Bm,"mkPainter2");d(Bm,"mkPainter2");f(Bm,"mkPainter");function Hm(e,t=null,i=!0){if(e.length<2)return;if(t||(t=this),e.length==2){i!==!1?t.moveTo(e[0].x,e[0].y):t.lineTo(e[0].x,e[0].y),t.lineTo(e[1].x,e[1].y);return}function s(a,c){return{x:a.x+(c.x-a.x)/2,y:a.y+(c.y-a.y)/2}}h(s,"midPointBtw"),m(s,"midPointBtw"),d(s,"midPointBtw"),f(s,"midPointBtw");function r(a,c,u,_,p,v,g){return{x:(1-a)*(1-a)*c+2*(1-a)*a*_+a*a*v,y:(1-a)*(1-a)*u+2*(1-a)*a*p+a*a*g}}h(r,"getQuadraticXY"),m(r,"getQuadraticXY"),d(r,"getQuadraticXY"),f(r,"getQuadraticXY");let n=e[0],l=e[1],o=n;t.moveTo(n.x,n.y);for(let a=1,c=e.length;a<c;a++){let u=s(n,l);for(let _=0;_<8;_++){let{x:p,y:v}=r(_/8,o.x,o.y,n.x,n.y,u.x,u.y);t.lineTo(p,v)}n=e[a],l=e[a+1],o=u}t.lineTo(n.x,n.y)}h(Hm,"smoothLine2");m(Hm,"smoothLine2");d(Hm,"smoothLine2");f(Hm,"smoothLine");function Om(e,t=.5,i=10,s=null,r=!0,n=!1){let l=[];for(let w=0,D=e.length;w<D;w++)l.push(e[w].x),l.push(e[w].y);let o,a=1,c=l.length,u=0,_=(c-2)*i+2+(n?2*i:0),p=new Float32Array(_),v=new Float32Array((i+2)*4),g=4;for(o=l.slice(0),n?(o.unshift(l[c-1]),o.unshift(l[c-2]),o.push(l[0],l[1])):(o.unshift(l[1]),o.unshift(l[0]),o.push(l[c-2],l[c-1])),v[0]=1;a<i;a++){var x=a/i,E=x*x,y=E*x,k=y*2,A=E*3;v[g++]=k-A+1,v[g++]=A-k,v[g++]=y-2*E+x,v[g++]=y-E}v[g]=1,S(o,v,c),n&&(o=[],o.push(l[c-4],l[c-3],l[c-2],l[c-1]),o.push(l[0],l[1],l[2],l[3]),S(o,v,4));function S(w,D,R){for(var C=2,z;C<R;C+=2){var W=w[C],J=w[C+1],ve=w[C+2],te=w[C+3],ie=(ve-w[C-2])*t,K=(te-w[C-1])*t,Y=(w[C+4]-W)*t,Nt=(w[C+5]-J)*t;for(z=0;z<i;z++){var Te=z<<2,Ut=D[Te],$t=D[Te+1],qt=D[Te+2],Kt=D[Te+3];p[u++]=Ut*W+$t*ve+qt*ie+Kt*Y,p[u++]=Ut*J+$t*te+qt*K+Kt*Nt}}}h(S,"parse"),m(S,"parse"),d(S,"parse"),f(S,"parse"),c=n?0:l.length-2,p[u++]=l[c],p[u]=l[c+1],s||(s=this);for(let w=0,D=p.length;w<D;w+=2)w==0&&r!==!1?s.moveTo(p[w],p[w+1]):s.lineTo(p[w],p[w+1])}h(Om,"smoothLineEx2");m(Om,"smoothLineEx2");d(Om,"smoothLineEx2");f(Om,"smoothLineEx");function Wm(e,t,i,s,r,n=1){this.save(),this.beginPath(),this.moveTo(e,t),this.lineTo(i,s),this.lineWidth=n,this.strokeStyle=r,this.stroke(),this.restore()}h(Wm,"line2");m(Wm,"line2");d(Wm,"line2");f(Wm,"line");function jm(e,t,i,s,r){this.moveTo(e+r,t),this.lineTo(e+i-r,t),this.quadraticCurveTo(e+i,t,e+i,t+r),this.lineTo(e+i,t+s-r),this.quadraticCurveTo(e+i,t+s,e+i-r,t+s),this.lineTo(e+r,t+s),this.quadraticCurveTo(e,t+s,e,t+s-r),this.lineTo(e,t+r),this.quadraticCurveTo(e,t,e+r,t),this.closePath()}h(jm,"roundRect2");m(jm,"roundRect2");d(jm,"roundRect2");f(jm,"roundRect");function Gm(e,t=!1){let i=this.measureText(e),s=i.fontBoundingBoxAscent+i.fontBoundingBoxDescent;return t?{width:Math.round(i.width),height:Math.round(s)}:{width:i.width,height:s}}h(Gm,"calcTextSize2");m(Gm,"calcTextSize2");d(Gm,"calcTextSize2");f(Gm,"calcTextSize");function Nm(e){let t=Math.round(e)+"px";this.font=this.font.replace(/\d+px/,t)}h(Nm,"setFontSize2");m(Nm,"setFontSize2");d(Nm,"setFontSize2");f(Nm,"setFontSize");function Um(e,t,i){this.moveTo(e+i,t),this.arc(e,t,i,0,Math.PI*2)}h(Um,"circle2");m(Um,"circle2");d(Um,"circle2");f(Um,"circle");var lx=d(class extends T{m_iwidth=-1;m_iheight=-1;m_scale=1;m_canvas;constructor(e){super(e),this.setDomEvent("sizechange",()=>{this._paint()}),this.mapPropEvents(e,"paint")}render(){this.m_iwidth=-1,this.m_iheight=-1,this.m_canvas=new T({tag:"canvas"}),this.setContent(this.m_canvas)}update(e=0){this.m_iheight=this.m_iwidth=-1,super.update(e)}scale(e){this.m_scale=e,this.m_iwidth=-1,this.redraw()}get canvas(){return this.m_canvas}$update_rep=0;redraw(e){e!==void 0?++this.$update_rep>=20?(this.stopTimer("update"),this._paint()):this.startTimer("update",e,!1,()=>this._paint()):(this.stopTimer("update"),this._paint())}_paint(){this.$update_rep=0;let e=this.dom;if(!this.isUserVisible())return;let t=this.m_canvas.dom,i=e.clientWidth,s=e.clientHeight,r=t.getContext("2d");if(i!=this.m_iwidth||s!=this.m_iheight){let n=window.devicePixelRatio||1,l=r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1,o=this.canvas;if(n!==l||this.m_scale!=1){let a=n/l,c=i*a,u=s*a;o.setAttribute("width",""+c),o.setAttribute("height",""+u),o.setStyleValue("width",i),o.setStyleValue("height",s),a*=this.m_scale,r.scale(a,a)}else o.setAttribute("width",""+i),o.setAttribute("height",""+s),o.setStyleValue("width",i),o.setStyleValue("height",s),r.scale(1,1);this.m_iwidth=i,this.m_iheight=s}if(i&&s){let n=Bm(r,i,s);this.m_props.autoClear&&n.clearRect(0,0,i,s),n.save(),n.translate(-.5,-.5),this.paint(n),n.restore()}}paint(e){try{this.m_props.painter?this.m_props.painter(e):this.emit("paint",Vm(e))}catch(t){console.assert(!1,t)}}},"Canvas2");f(lx,"Canvas");var o_=d(class extends T{m_cards;m_ipage;m_cpage;constructor(e){super(e),this.m_cards=[],this.m_ipage=e.active,this.m_cpage=null,this.singleShot(()=>{this.setPages(e.pages)})}render(){let e=[];this.m_cards.forEach(t=>{t.page&&e.push(t.page)}),this.setContent(e)}switchTo(e){if(this.m_cards.length!=0&&(e===void 0&&(e=this.m_cards[0].name),e!==this.m_cpage?.name)){if(this.m_cpage&&(this.m_cpage.selector&&this.m_cpage.selector.removeClass("@active"),this.m_cpage.page&&!(this.m_cpage.page instanceof Function))){let t=this.m_cpage.page;t.removeClass("@active"),t.addClass("@hidden")}if(this.m_cpage=this.m_cards.find(t=>t.name==e),this.m_cpage){if(this.m_cpage.page){di(this.m_cpage.page)&&(this.m_cpage.page=this.m_cpage.page(),console.assert(this.m_cpage.page!=null,"You must return a valid component"));let t=this.m_cpage.page;t.addClass("@active"),t.removeClass("@hidden"),t.dom||this._preparePage(t),this.m_cpage.selector&&this.m_cpage.selector.addClass("@active")}this.emit("change",$e(this.m_cpage.name))}}}setPages(e){let t=this._initTabs(e);t&&Us(()=>{this.switchTo(t),this.update()})}_initTabs(e){if(!e)return;let t=this.m_ipage;return e.forEach(i=>{if(!i)return;let s={...i};s.selector=this._prepareSelector(i),s.active=!1,this.m_cards.push(s),t||(t=i.name),i.active&&(t=i.name)}),t}_updateSelector(){}_prepareSelector(e){return null}_preparePage(e){e.setStyleValue("flex",1),e.addClass("@tab-page")}},"CardView2");f(o_,"CardView");var wh=d(class extends T{constructor(e){super(e),this.setDomEvent("focus",()=>this._setFocus()),this.mapPropEvents(e,"change"),e.slider&&this.addClass("slider")}render(e){let t=e.labelWidth??-1,i="__cb_"+this.uid;this.setTag("label"),this.addClass("@hlayout"),this.addClass(e.align??"left"),this.setContent([new ts({ref:"input",type:"checkbox",name:e.name,id:i,tabIndex:e.tabIndex,value:e.value??"on",attrs:{checked:e.checked?"":void 0},dom_events:{change:this._change.bind(this)}}),e.slider?new T({cls:"@slide-el"}):null,new Ge({text:e.text??"",width:t<0?void 0:t,flex:t<0?-t:void 0,align:e.labelAlign??"left",style:{order:e.align=="right"?-1:1},attrs:{for:i}})])}_change(){this.emit("change",$e(this.check))}_setFocus(){this.itemWithRef("input").focus()}get check(){return this.dom?this.itemWithRef("input").dom.checked:this.m_props.checked}set check(e){if(this.dom){let i=this.itemWithRef("input").dom;i&&(i.checked=e)}this.m_props.checked=e}get text(){return this.itemWithRef("label").text}set text(e){this.itemWithRef("label").text=e}toggle(){this.check=!this.check}},"CheckBox2");f(wh,"CheckBox");var Uf={lightsalmon:4294942842,lightseagreen:4280332970,lightskyblue:4287090426,lightslategray:4286023833,lightsteelblue:4289774814,lightyellow:4294967264,lime:4278255360,limegreen:4281519410,linen:4294635750,magenta:4294902015,maroon:4286578688,mediumaquamarine:4284927402,mediumblue:4278190285,mediumorchid:4290401747,mediumpurple:4287852763,mediumseagreen:4282168177,mediumslateblue:4286277870,mediumspringgreen:4278254234,mediumturquoise:4282962380,mediumvioletred:4291237253,midnightblue:4279834992,mintcream:4294311930,mistyrose:4294960353,moccasin:4294960309,navajowhite:4294958765,navy:4278190208,oldlace:4294833638,olive:4286611456,olivedrab:4285238819,orange:4294944e3,orangered:4294919424,orchid:4292505814,palegoldenrod:4293847210,palegreen:4288215960,paleturquoise:4289720046,palevioletred:4292571283,papayawhip:4294963157,peachpuff:4294957753,peru:4291659071,pink:4294951115,plum:4292714717,powderblue:4289781990,purple:4286578816,red:4294901760,rosybrown:4290547599,royalblue:4282477025,saddlebrown:4287317267,salmon:4294606962,sandybrown:4294616160,seagreen:4281240407,seashell:4294964718,sienna:4288696877,silver:4290822336,skyblue:4287090411,slateblue:4285160141,slategray:4285563024,snow:4294966010,springgreen:4278255487,steelblue:4282811060,tan:4291998860,teal:4278222976,thistle:4292394968,tomato:4294927175,turquoise:4282441936,violet:4293821166,wheat:4294303411,white:4294967295,whitesmoke:4294309365,yellow:4294967040,yellowgreen:4288335154,aliceblue:4293982463,antiquewhite:4294634455,aqua:4278255615,aquamarine:4286578644,azure:4293984255,beige:4294309340,bisque:4294960324,black:4278190080,blanchedalmond:4294962125,blue:4278190335,blueviolet:4287245282,brown:4289014314,burlywood:4292786311,cadetblue:4284456608,chartreuse:4286578432,chocolate:4291979550,coral:4294934352,cornflowerblue:4284782061,cornsilk:4294965468,crimson:4292613180,cyan:4278255615,darkblue:4278190219,darkcyan:4278225803,darkgoldenrod:4290283019,darkgray:4289309097,darkgreen:4278215680,darkkhaki:4290623339,darkmagenta:4287299723,darkolivegreen:4283788079,darkorange:4294937600,darkorchid:4288230092,darkred:4287299584,darksalmon:4293498490,darkseagreen:4287609999,darkslateblue:4282924427,darkslategray:4281290575,darkturquoise:4278243025,darkviolet:4287889619,deeppink:4294907027,deepskyblue:4278239231,dimgray:4285098345,dodgerblue:4280193279,firebrick:4289864226,floralwhite:4294966e3,forestgreen:4280453922,fuchsia:4294902015,gainsboro:4292664540,ghostwhite:4294506751,gold:4294956800,goldenrod:4292519200,gray:4286611584,green:4278222848,greenyellow:4289593135,honeydew:4293984240,hotpink:4294928820,indianred:4291648604,indigo:4283105410,ivory:4294967280,khaki:4293977740,lavender:4293322490,lavenderblush:4294963445,lawngreen:4286381056,lemonchiffon:4294965965,lightblue:4289583334,lightcoral:4293951616,lightcyan:4292935679,lightgoldenrodyellow:4294638290,lightgreen:4287688336,lightgrey:4292072403,lightpink:4294948545,none:0,transparent:0},Ce=d(class{m_value;constructor(e,t,i,s){let r=arguments.length,n=this;function l(){if(!r)return 4278190080;if(r==1)return Number.isSafeInteger(e)?4278190080|e&16777215:n._getCustomColor(e);if(r==2){let o,a=((t*255|0)&255)<<24;return Number.isSafeInteger(e)?o=e:o=n._getCustomColor(e),o&16777215|a}else if(r==4&&s!==void 0&&s<=1)return s<=0?0:(s=s*255,s|=0,(s&255)<<24|(e&255)<<16|(t&255)<<8|i&255);return 4278190080|(e&255)<<16|(t&255)<<8|i&255}h(l,"_init"),m(l,"_init"),d(l,"_init"),f(l,"_init"),this.m_value=l()}_shade(e){let t=e<0?0:255,i=e<0?-e:e,s=this._split();return new Ce(Math.round((t-s.r)*i)+s.r,Math.round((t-s.g)*i)+s.g,Math.round((t-s.b)*i)+s.b,s.a/255)}darken(e){return e<0&&(e=0),e>100&&(e=100),this._shade(-e/100)}lighten(e){return e<0&&(e=0),e>100&&(e=100),this._shade(e/100)}static mix(e,t,i){let s=e._split(),r=t._split(),n=s.a===r.a?s.a:Math.round(r.a*i+s.a*(1-i)),l=s.r===r.r?s.r:Math.round(r.r*i+s.r*(1-i)),o=s.g===r.g?s.g:Math.round(r.g*i+s.g*(1-i)),a=s.b===r.b?s.b:Math.round(r.b*i+s.b*(1-i));return new Ce(l,o,a,n/255)}_split(){let e=this.m_value;return{a:e>>24&255,r:e>>16&255,g:e>>8&255,b:e&255}}fadeout(e){let t=this._split();if(t.a=t.a/255,t.a=t.a-t.a*e/100,t.a>1)t.a=1;else if(t.a<=0)return Ce.NONE;return new Ce(t.r,t.g,t.b,t.a)}static fromHSV(e,t,i,s=1){let r=Math.min(5,Math.floor(e*6)),n=e*6-r,l=i*(1-t),o=i*(1-n*t),a=i*(1-(1-n)*t),c,u,_;switch(r){case 0:c=i,u=a,_=l;break;case 1:c=o,u=i,_=l;break;case 2:c=l,u=i,_=a;break;case 3:c=l,u=o,_=i;break;case 4:c=a,u=l,_=i;break;case 5:c=i,u=l,_=o;break}return new Ce(c*255,u*255,_*255,s)}static toHSV(e){let t=e._split();t.r/=255,t.g/=255,t.b/=255,t.a/=255;let i=Math.max(t.r,t.g,t.b),s=Math.min(t.r,t.g,t.b),r=i-s,n=i===0?0:r/i,l=i,o;if(r===0)o=0;else switch(i){case t.r:o=(t.g-t.b)/r/6+(t.g<t.b?1:0);break;case t.g:o=(t.b-t.r)/r/6+1/3;break;case t.b:o=(t.r-t.g)/r/6+2/3;break}return{h:o,s:n,v:l,a:t.a}}static fromHLS(e,t,i){let s,r,n;if(i==0)s=r=n=t;else{let o=d(function(u,_,p){return p<0&&(p+=1),p>1&&(p-=1),p<.16666666666666666?u+(_-u)*6*p:p<.5?_:p<.6666666666666666?u+(_-u)*(.6666666666666666-p)*6:u},"hue2rgb2");var l=o;f(o,"hue2rgb");let a=t<.5?t*(1+i):t+i-t*i,c=2*t-a;s=o(c,a,e+1/3),r=o(c,a,e),n=o(c,a,e-1/3)}return s=(s*255|0)&255,r=(r*255|0)&255,n=(n*255|0)&255,new Ce(s,r,n)}static toHLS(e){let t=e.m_value,i=(t>>16&255)/255,s=(t>>8&255)/255,r=(t&255)/255,n=i,l=i;s<n&&(n=s),r<n&&(n=r),s>l&&(l=s),r>l&&(l=r);let o=0,a=0,c=0,u=l-n,_=l+n,p=.5*_,v,g;if(l!=n)o=(l-i)/u,a=(l-s)/u,c=(l-r)/u;else return{h:0,l:p,s:0};return p<.5?v=u/_:v=u/(2-_),i==l?g=60*(6+c-a):s==l?g=60*(2+o-c):g=60*(4+a-o),g>360&&(g=g-360),{h:g/360,l:p,s:v}}red(){return this.m_value>>16&255}green(){return this.m_value>>8&255}blue(){return this.m_value&255}alpha(){return(this.m_value>>24&255)/255}value(){return this.m_value}toString(){if(this.m_value===0)return"transparent";let t=this._split();if(t.a===255)return`rgb(${t.r},${t.g},${t.b})`;{t.a/=255;let i=t.a.toFixed(3);return`rgba(${t.r},${t.g},${t.b},${i})`}}toHex(e=!0){if(this.m_value===0)return"transparent";let i=this._split();return i.a===255||!e?`#${as(i.r)}${as(i.g)}${as(i.b)}`:`#${as(i.r)}${as(i.g)}${as(i.b)}${as(i.a)}`}static addCustomColor(e,t){Ce.custom[e]=t}static addCssColor(e){let t=Nr.getVar(e);Ce.custom["css:"+e]=Ce.parse(t.trim())}static parse(e){let t;if(e[0]=="#"){if((t=/#(?<r>[a-fA-F0-9]{2})(?<g>[a-fA-F0-9]{2})(?<b>[a-fA-F0-9]{2})(?<a>[a-fA-F0-9]{2})?/.exec(e))!==null){let r=t.groups;return new Ce(parseInt(r.r,16),parseInt(r.g,16),parseInt(r.b,16),r.a!==void 0?parseInt(r.a,16)/255:1)}if((t=/#(?<r>[a-fA-F0-9])(?<g>[a-fA-F0-9])(?<b>[a-fA-F0-9])/.exec(e))!==null){let r=t.groups,n=parseInt(r.r,16),l=parseInt(r.g,16),o=parseInt(r.b,16);return new Ce(n<<4|n,l<<4|l,o<<4|o,1)}}if(e[0]=="r"){if((t=/rgb\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\)/.exec(e))!==null){let r=t.groups;return new Ce(parseInt(r.r,10),parseInt(r.g,10),parseInt(r.b,10),1)}if((t=/rgba\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\,\s*(?<a>[0-9.]+)\s*\)/.exec(e))!==null){let r=t.groups;return new Ce(parseInt(r.r,10),parseInt(r.g,10),parseInt(r.b,10),parseFloat(r.a))}}return console.log("invalid color value: "+e),new Ce(0)}_getCustomColor(e){if(e===null)return 0;let t=Uf[e];return t!==void 0?t:Ce.custom[e]!==void 0?Ce.custom[e].m_value:e.substr(0,4)=="css:"?(Ce.addCssColor(e.substr(4)),Ce.custom[e].m_value):Ce.parse(e).m_value}static contrastColor(e){let t=e._split();return(.299*t.r+.587*t.g+.114*t.b)/255>.5?Ce.BLACK:Ce.WHITE}static valueFromColorName(e){let t=Uf[e];return t?new Ce(t):null}static fromCssVar(e){return new Ce(e).toString()}},"_Color2"),Le=Ce;f(Le,"Color");fe(Le,"custom",[]);fe(Le,"WHITE",new Ce(255,255,255));fe(Le,"BLACK",new Ce(0,0,0));fe(Le,"NONE",new Ce(0,0,0,0));function as(e){return("00"+e.toString(16)).substr(-2).toUpperCase()}h(as,"_hx2");m(as,"_hx2");d(as,"_hx2");f(as,"_hx");var ox=1e4;function $m(e){let t,i=e.url,s=e.method||"GET",r=!1;e.params instanceof FormData?(t=e.params,r=!0):s=="POST"?t=ho(e.params,!1):i+=ho(e.params,!0),i=encodeURI(i);let n=new XMLHttpRequest;if(n.open(s,i),n.upload.addEventListener("progress",l,!1),n.addEventListener("timeout",a),n.addEventListener("error",a),n.addEventListener("load",c),r||n.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8"),s!="POST"&&(n.responseType=e.responseType||"json",n.timeout=e.timeout||ox),e.headers)for(let u in e.headers)n.setRequestHeader(u,e.headers[u]);function l(u){if(console.log(u),e.progress)try{if(u.lengthComputable){let _=o(u.loaded)+" / "+o(u.total);e.progress(u.loaded,u.total,_)}}catch(_){console.error("unhandled exception:",_)}}h(l,"progress"),m(l,"progress"),d(l,"progress"),f(l,"progress");function o(u){let _,p;return u>=1e9?(_="Gb",p=u/1e9):u>=1e6?(_="Mb",p=u/1e6):u>=1e3?(_="Kb",p=u/1e3):(_="bytes",p=u),p.toFixed(2)+_}h(o,"humanSize"),m(o,"humanSize"),d(o,"humanSize"),f(o,"humanSize");function a(){e.failure&&e.failure(n.status,n.statusText,e.userData)}h(a,"failure"),m(a,"failure"),d(a,"failure"),f(a,"failure");function c(){if(n.status>=200&&n.status<300){if(e.success)try{e.success(n.response,e.userData)}catch(u){console.error("unhandled exception:",u)}}else a()}return h(c,"success"),m(c,"success"),d(c,"success"),f(c,"success"),r||s=="POST"?n.send(t):n.send(),function(){n.abort()}}h($m,"ajaxRequest2");m($m,"ajaxRequest2");d($m,"ajaxRequest2");f($m,"ajaxRequest");function ho(e,t){if(!e)return"";let i=[];for(let r in e){let n=e[r];if(Jt(n))for(let l=0,o=n.length;l<o;l++)i.push(encodeURIComponent(r)+"[]="+encodeURIComponent(""+n[l]));else n===void 0&&(n=""),i.push(encodeURIComponent(r)+"="+encodeURIComponent(""+n))}let s=i.join("&");return t?"?"+s:s}h(ho,"buildQuery2");m(ho,"buildQuery2");d(ho,"buildQuery2");f(ho,"buildQuery");async function a_(e,t){return(await ha(e,t,"application/json")).json()}h(a_,"ajaxAsJSON2");m(a_,"ajaxAsJSON2");d(a_,"ajaxAsJSON2");f(a_,"ajaxAsJSON");async function h_(e,t){return(await ha(e,t,"text/plain")).text()}h(h_,"ajaxAsText2");m(h_,"ajaxAsText2");d(h_,"ajaxAsText2");f(h_,"ajaxAsText");async function ha(e,t,i){let s={method:"GET",headers:{"X-Requested-With":"XMLHttpRequest"}};if(i&&(s.headers["Content-Type"]=i),t&&(s={...s,...t},t.body&&!Fe(t.body))){let n=!1;(Yh(t.body)||!(t.body instanceof Blob)&&!(t.body instanceof ArrayBuffer)&&!(t.body instanceof FormData)&&!(t.body instanceof URLSearchParams)&&!(t.body instanceof ReadableStream))&&(n=!0),n?s.body=JSON.stringify(t.body):s.body=t.body}let r=await fetch(e,s);if(t&&t.noGenX)return r;if(!r.ok)throw new Yp(r);return r}h(ha,"ajax2");m(ha,"ajax2");d(ha,"ajax2");f(ha,"ajax");var zg=d(class extends St{m_height;m_container;m_buttons;m_dirty;m_watchChanges;constructor(e){let t=e.content;e.content=null;let i=e.height;e.height=void 0,super(e),this.setTag(e.disableSuggestions?"section":"form"),this.mapPropEvents(e,"btnClick"),this.updateContent(t,e.buttons,i),this.m_dirty=!1,this.m_watchChanges=!1}get container(){return this.m_container}componentCreated(){super.componentCreated(),this.m_watchChanges&&this.watchChanges()}updateContent(e,t,i=0){i&&(this.m_height=i),this._makeButtons(t);let s=[this.m_container=new St({cls:"container",height:this.m_height,content:e}),this.m_buttons];super.setContent(s)}setContent(e,t=!0){this.m_container.setContent(e,t)}setButtons(e){this._makeButtons(e)}enableButton(e,t=!0){let i=this.getButton(e);i&&i.enable(t)}getButton(e){return this.m_buttons?.itemWithRef("@"+e)}_makeButtons(e){this.m_buttons||(this.m_buttons=new me({cls:"footer",ref:"buttons"}));let t=[];if(e)for(let i of e)if(i instanceof T)t.push(i);else switch(i){case"ok":{t.push(new bt({ref:"@"+i,text:oe.global.ok,click:()=>{this._click(i)}}));break}case"cancel":{t.push(new bt({ref:"@"+i,text:oe.global.cancel,click:()=>{this._click(i)}}));break}case"ignore":{t.push(new bt({ref:"@"+i,text:oe.global.ignore,click:()=>{this._click(i)}}));break}case"yes":{t.push(new bt({ref:"@"+i,text:oe.global.yes,click:()=>{this._click(i)}}));break}case"no":{t.push(new bt({ref:"@"+i,text:oe.global.no,click:()=>{this._click(i)}}));break}case"close":{t.push(new bt({ref:"@"+i,text:oe.global.close,click:()=>{this._click(i)}}));break}case"save":{t.push(new bt({ref:"@"+i,text:oe.global.save,click:()=>{this._click(i)}}));break}case"dontsave":{t.push(new bt({ref:"@"+i,text:oe.global.dontsave,click:()=>{this._click(i)}}));break}}t.length==1&&t[0].setAttribute("autofocus",!0),this.m_buttons.setContent(t)}validate(){let e=this.queryAll("input"),t=!0;for(let i=0;i<e.length;i++){let s=T.getElement(e[i],Ei);s&&!s.validate()&&(t=!1)}return t}_click(e){this.emit("btnClick",qm(e))}_getElements(){return console.assert(!!this.dom),this.queryAll("[name]")}setValues(e){let t=this._getElements();for(let i=0;i<t.length;i++){let s=t[i],r=T.getElement(s);if(!r.hasAttribute("name"))continue;let n=r.getAttribute("name"),l=r.getAttribute("type");e[n]!==void 0&&r.setStoreValue(e[n])}this.setDirty(!1)}getValues(){let e=this._getElements(),t={};for(let i=0;i<e.length;i++){let s=e[i],r=T.getElement(s);if(!r.hasAttribute("name"))continue;let n=r.getAttribute("name"),l=r.getStoreValue();l!==void 0&&(t[n]=l)}return t}submit(e,t){if(!this.validate())return!1;let i=this.getValues();if(t&&!t(i))return!1;let s=new FormData;for(let r in i)i.hasOwnProperty(r)&&s.append(r,i[r]===void 0?"":i[r]);return e.params=s,$m(e)}watchChanges(){this.dom?(this.queryAll("input[name], textarea[name]").forEach(t=>{Qt(t).setDomEvent("input",()=>{this.setDirty()})}),this.m_watchChanges=!1):this.m_watchChanges=!0}setDirty(e=!0){this.m_dirty=e}isDirty(){return this.m_dirty}},"Form2");f(zg,"Form");function qm(e){return Ie({button:e})}h(qm,"EvBtnClick2");m(qm,"EvBtnClick2");d(qm,"EvBtnClick2");f(qm,"EvBtnClick");var Km=d(class extends _s{m_icon;m_title;m_form;m_buttons;m_closable;m_movable;m_maximized;m_minimized;m_maximizable;m_minimizable;m_minFormSize;m_rc_max;m_rc_min;m_el_title;m_last_down;m_auto_close;m_ui_title;m_form_cb;constructor(e){let t=e.content;e.content=null;let i=e.width,s=e.height;e.width=void 0,e.height=void 0,super(e),this.m_minFormSize={width:i,height:s},this.enableMask(!0),e.form?di(e.form)?this.m_form_cb=e.form:(this.m_form=e.form,this.m_form.on("btnClick",r=>this._handleClick(r))):this.m_form=new zg({content:t,buttons:e.buttons,disableSuggestions:e.disableSuggestions,btnClick:r=>this._handleClick(r)}),this.m_movable=e.movable,this.m_auto_close=e.autoClose??!0,this.m_icon=e.icon,this.m_title=e.title,this.m_buttons=e.buttons??null,this.m_closable=e.closable??!1,this.m_last_down=0,this.on("size",r=>{this.addClass("@resized"),this.m_form.setStyleValue("width",null),this.m_form.setStyleValue("height",null)}),this.m_maximized=!1,this.m_minimized=!1,this.m_maximizable=!1,this.m_minimizable=!1,e.maximizable!==void 0&&(this.m_maximizable=e.maximizable),e.minimizable!==void 0&&(this.m_minimizable=e.minimizable),e.maximized==!0&&(this.m_maximizable=!0),e.btnClick&&this.on("btnClick",e.btnClick)}componentCreated(){super.componentCreated(),this.m_minFormSize.width&&this.m_form.setStyle({minWidth:this.m_minFormSize.width,width:this.m_minFormSize.width}),this.m_minFormSize.height&&this.m_form.setStyle({minHeight:this.m_minFormSize.height,height:this.m_minFormSize.height});let e=this.getBoundingRect();this.setStyleValue("min-width",e.width),this.setStyleValue("min-height",e.height),this.setStyleValue("width",e.width),this.setStyleValue("height",e.height),this.m_props.dlgWidth&&this.setStyleValue("width",this.m_props.dlgWidth+"%"),this.m_props.dlgHeight&&this.setStyleValue("height",this.m_props.dlgHeight+"%"),this.addClass("@resized"),this.m_el_title&&this.m_el_title.setStyleValue("width","auto"),this.m_props.maximized?(this._maximize(),this.emit("size",vt(null))):this.centerOnScreen()}_handleClick(e){this.emit("btnClick",e),e.defaultPrevented||this.close()}setGeometry(e){e.minimized&&this.m_minimizable?(this._minimize(!1),this.m_rc_min=new Wi(e.left,e.top,e.width,e.height),this.displayAt(e.left,e.top,"top-left")):e.maximized&&this.m_maximizable?(this._maximize(!1),this.m_rc_max=new Wi(e.left,e.top,e.width,e.height)):(this.setSize(e.width,e.height),this.displayAt(e.left,e.top,"top-left"))}getGeometry(){if(this.m_minimized)return{left:this.m_rc_min.left,top:this.m_rc_min.top,width:this.m_rc_min.width,height:this.m_rc_min.height,minimized:!0,maximized:!1};if(this.m_maximized)return{left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height,minimized:!1,maximized:!0};let e=this.getBoundingRect();return{left:e.left,top:e.top,width:e.width,height:e.height,minimized:!1,maximized:!1}}setSize(e,t){this.setStyle({width:e,height:t}),this.emit("size",vt({width:e,height:t}))}render(){this.m_form_cb&&(this.m_form=this.m_form_cb(),this.m_form.on("btnClick",t=>this._handleClick(t)),this.m_form_cb=null);let e=this.m_icon!==void 0||this.m_closable||this.m_title!==void 0||this.m_movable;this.m_el_title=null,e&&(this.m_el_title=new me({cls:"title",content:[this.m_icon?new rt({icon:this.m_icon}):null,this.m_ui_title=new Ge({flex:1,text:this.m_title}),this.m_minimizable?new rt({cls:"min-btn",icon:"var( --x4-icon-window-minimize )",dom_events:{click:()=>this._toggleMin()}}):null,this.m_maximizable?new rt({cls:"max-btn",icon:"var( --x4-icon-window-maximize )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_maximizable?new rt({cls:"res-btn",icon:"var( --x4-icon-window-restore )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_closable?new rt({cls:"close-btn",icon:"var( --x4-icon-rectangle-times )",dom_events:{click:()=>this.close()}}):null]}),this.m_movable&&(So()?this.m_el_title.setDomEvent("touchstart",t=>this._mouseDown(t)):this.m_el_title.setDomEvent("mousedown",t=>this._mouseDown(t)))),super.setContent([this.m_el_title,this.m_form])}setContent(e,t=!0){this.m_form.setContent(e,t)}setButtons(e){this.m_form.setButtons(e)}get form(){return this.m_form}close(){this.emit("close",{}),super.close()}_toggleMax(){this.m_maximizable&&(this.m_maximized?(this.removeClass("maximized"),this.setStyle({left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height}),this.m_maximized=!1,this.emit("size",vt(null,"restore"))):(this._maximize(),this.emit("size",vt(null,"maximize"))))}_toggleMin(){this.m_minimizable&&(this.m_minimized?(this.removeClass("minimized"),this.setStyle({width:this.m_rc_min.width,height:this.m_rc_min.height}),this.m_minimized=!1,this.emit("size",vt(null,"restore"))):(this._minimize(),this.emit("size",vt(null,"minimize"))))}_mouseDown(e){let{x:t,y:i}=Ji(e,!0),s=Qt(H.body).getBoundingRect(),r=this.getBoundingRect(!0),n=t-r.left,l=i-r.top,o=Date.now(),a=o-this.m_last_down;if(this.m_maximizable&&a<700){this._toggleMax();return}if(this.m_last_down=o,this.m_maximized)return;let c=f((u,_)=>{u>s.right?u=s.right:u<s.left&&(u=s.left),_>s.bottom?_=s.bottom:_<s.top&&(_=s.top);let p=u-n,v=_-l;this.setStyle({left:p,top:v})},"__move");T.setCapture(this,u=>{if(u.type=="mousemove"){let _=u;c(_.clientX,_.clientY)}else if(u.type=="touchmove"){let _=u;_.touches.length==1&&c(_.touches[0].clientX,_.touches[0].clientY)}else u.type=="mouseup"||u.type=="touchend"?(T.releaseCapture(),this.emit("move",Tm(null))):u.type=="mousedown"||u.type=="touchstart"})}maximize(){!this.m_maximizable||this.m_maximized||(this._maximize(),this.emit("size",vt(null)))}_maximize(e=!0){e&&(this.m_rc_max=this.getBoundingRect(!1)),this.addClass("maximized"),this.m_maximized=!0,this.setStyle({left:void 0,top:void 0,width:void 0,height:void 0})}minimize(){!this.m_minimizable||this.m_minimized||(this._minimize(),this.emit("size",vt(null)))}_minimize(e=!0){e&&(this.m_rc_min=this.getBoundingRect(!1)),this.addClass("minimized"),this.m_minimized=!0,this.setStyle({width:void 0,height:void 0})}set title(e){this.m_title=e,this.m_ui_title&&(this.m_ui_title.text=e)}itemWithName(e){let t=this.dom.querySelector(`[name="${e}"]`);return t?T.getElement(t):null}getValues(){return this.m_form.getValues()}validate(){return this.m_form.validate()}},"Dialog2");f(Km,"Dialog");var Wu=d(class extends Rt{m_colorSel;m_colorHue;m_colorAlpha;m_sample;m_selMark;m_hueMark;m_alphaMark;m_baseHSV;m_baseColor;m_transpCk;m_colorEdit;m_palmode;constructor(e){super(e),this.m_palmode=Wu.last_palmode,this.setDomEvent("contextmenu",t=>this._showCtx(t))}_showCtx(e){let t=new fs({items:[new Un({text:"Palette",checked:this.m_palmode,click:()=>{this.m_palmode=!this.m_palmode,Wu.last_palmode=this.m_palmode,this.update()}})]}),i=Ji(e,!0);t.displayAt(i.x,i.y)}render(e){if(this.m_baseColor=e.color,this.m_baseHSV=Le.toHSV(this.m_baseColor),this.m_palmode){let i=d(function(a){l=[],a.forEach(c=>{let u=new Le(c.hex),_=u.value()==o,p=io("hclr-box xbox",{selected:_}),v=new T({cls:p,style:{backgroundColor:u.toHex(),color:Le.contrastColor(u).toHex()},data:{color:u.value()},content:u.toHex()});l.push(v),_&&(r=v)}),s&&s.itemWithId("vsel").setContent(l)},"fillSubs2");var t=i;f(i,"fillSubs"),this.addClass("pal-mode");let s=null,r=null,n=[],l=[],o=this.m_baseColor.value();hx.forEach(a=>{let c=a.variations[4].hex,u=c===o;u||(u=a.variations.some(v=>{if(new Le(v.hex).value()===o)return!0}));let _=io("clr-box xbox",{selected:u}),p=new T({cls:_,style:{backgroundColor:new Le(c).toHex()},data:{color:c,main:a.variations}});u&&i(a.variations),n.push(p)}),s=new St({content:[new me({id:"hsel",content:n}),new St({id:"vsel",flex:1,content:l})]}),this.m_colorEdit=new Ei({cls:"hexv",value:"",attrs:{spellcheck:!1},change:a=>{let c=new Le(a.value);c&&(this.m_baseColor=c,this.m_baseHSV=Le.toHSV(c),this._updateColor(!1))}}),this.m_transpCk=new wh({cls:"transp",text:"transparent",change:a=>{this.m_baseHSV.a=a.value?0:1,this._updateColor()}}),this.setContent([s,this.m_transpCk,this.m_colorEdit]),s.setDomEvent("click",a=>{r&&(r.removeClass("selected"),r=null);let c=T.getElement(a.target,"xbox");if(c){let u=c.getData("main");if(u)i(u);else{let _=new Le(c.getData("color"));this.m_baseColor=_,this.m_baseHSV=Le.toHSV(_),this._updateColor(),r=c,c.addClass("selected")}}})}else this.removeClass("pal-mode"),this.m_selMark=new T({cls:"marker"}),this.m_colorSel=new T({cls:"sel",content:[new T({cls:"@fit light"}),new T({cls:"@fit dark"}),this.m_selMark]}),this.m_hueMark=new T({cls:"marker"}),this.m_colorHue=new T({cls:"hue",content:[this.m_hueMark]}),this.m_sample=new T({cls:"sample"}),e.hasAlpha?(this.addClass("with-alpha"),this.m_alphaMark=new T({cls:"marker"}),this.m_colorAlpha=new T({cls:"alpha",content:[new T({cls:"bk @fit",ref:"color"}),this.m_alphaMark]})):(this.removeClass("with-alpha"),this.m_transpCk=new wh({cls:"transp",text:"transparent",change:i=>{this.m_baseHSV.a=i.value?0:1,this._updateColor()}})),this.m_colorEdit=new Ei({cls:"hexv",value:"",attrs:{spellcheck:!1},change:i=>{let s=new Le(i.value);s&&(this.m_baseColor=s,this.m_baseHSV=Le.toHSV(s),this._updateColor(!1))}}),this.setContent([this.m_colorSel,this.m_colorHue,this.m_colorAlpha,this.m_transpCk,this.m_colorEdit,this.m_sample]),this.m_colorSel.setDomEvent("mousedown",i=>{T.setCapture(this,s=>this._selChange(s))}),this.m_colorHue.setDomEvent("mousedown",i=>{T.setCapture(this,s=>this._hueChange(s))}),e.hasAlpha&&this.m_colorAlpha.setDomEvent("mousedown",i=>{T.setCapture(this,s=>this._alphaChange(s))}),this._updateColor()}set color(e){this.m_baseColor=e,this.m_baseHSV=Le.toHSV(this.m_baseColor),this._updateColor()}get color(){return this.m_baseColor}_selChange(e){let t=Ji(e,!0);console.log(t);let i=this.m_colorSel.getBoundingRect();this.m_props.hasAlpha||(this.m_baseHSV.a=1),this.m_baseHSV.s=Mr((t.x-i.left)/i.width,0,1),this.m_baseHSV.v=1-Mr((t.y-i.top)/i.height,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&T.releaseCapture()}_hueChange(e){let t=Ji(e,!0),i=this.m_colorHue.getBoundingRect();this.m_baseHSV.h=Mr((t.y-i.top)/i.height,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&T.releaseCapture()}_alphaChange(e){let t=Ji(e,!0),i=this.m_colorAlpha.getBoundingRect();this.m_baseHSV.a=Mr((t.x-i.left)/i.width,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&T.releaseCapture()}_updateColor(e=!0){let t;if(this.m_palmode)this.m_transpCk.check=this.m_baseHSV.a==0;else{if(t=Le.fromHSV(this.m_baseHSV.h,1,1,1),this.m_colorSel.setStyleValue("backgroundColor",t.toString()),t=Le.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,1),this.m_sample.setStyleValue("backgroundColor",t.toString()),this.m_props.hasAlpha){let i=`linear-gradient(to right, rgba(0,0,0,0) 0%, ${t.toString()} 100%)`;this.m_colorAlpha.itemWithRef("color").setStyleValue("backgroundImage",i)}this.m_selMark.setStyle({left:this.m_baseHSV.s*100+"%",top:100-this.m_baseHSV.v*100+"%"}),this.m_hueMark.setStyle({top:this.m_baseHSV.h*100+"%"}),this.m_props.hasAlpha?this.m_alphaMark.setStyle({left:this.m_baseHSV.a*100+"%"}):this.m_transpCk.check=this.m_baseHSV.a==0}t=Le.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,this.m_baseHSV.a),this.m_baseColor=t,e&&(this.m_colorEdit.value=t.alpha()==1?t.toHex():t.toString()),this._change()}_change(){this.emit("change",$e(this.m_baseColor))}},"_ColorPicker2"),m_=Wu;f(m_,"ColorPicker");fe(m_,"last_palmode",!1);var bh=d(class extends Km{m_picker;constructor(e){e.icon=void 0,e.buttons=void 0,super(e),this.mapPropEvents(e,"change"),this.m_picker=new m_({color:e.color,hasAlpha:e.hasAlpha,style:{padding:8},width:250,height:250});let t=this._makeCustoms(e.cust_colors);this.form.updateContent([new St({content:[this.m_picker,t]})],["ok","cancel"]),this.on("btnClick",i=>{i.button=="ok"&&this.emit("change",$e(this.m_picker.color))})}_makeCustoms(e){let t=null;if(e&&e.length>0){let i=[];for(let s=0;s<e.length;s+=8){let r=[];for(let n=0;n<8;n++){let l=s+n,o=e[l];r.push(new Ge({cls:"cust-cc",text:"",flex:1,style:{backgroundColor:o?o.toString():"transparent"},tooltip:o?o.toString():void 0,dom_events:{click:()=>{o&&(this.m_picker.color=o,this.emit("change",$e(o)),this.close())}}}))}i.push(new me({cls:"line",content:r}))}t=new St({cls:"customs",content:i})}return t}set color(e){this.m_picker.color=e}get color(){return this.m_picker.color}static show(e){let t;return Fe(e)?t=new bh({color:new Le(e)}):t=new bh(e),t.show(),t}},"ColorPickerBox2");f(bh,"ColorPickerBox");var ax=d(class extends me{constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){let t=e.color,i;this._isTransp(t)?(t=Le.NONE,i="black"):i=Le.contrastColor(t).toString(),this.setContent([e.label?new Ge({cls:"label",text:e.label,flex:e.labelWidth<0?-e.labelWidth:void 0,width:e.labelWidth>=0?e.labelWidth:void 0}):null,new T({flex:1,content:[new Ge({cls:"alpha @fit",text:""}),new Ge({cls:"value @fit",text:e.displayValue===!1?"":t.toHex(),style:{backgroundColor:t.toString(),color:i},dom_events:{click:()=>this._showPicker()}})]})]),e.displayValue===!1&&this.setStyleValue("background-image","url( 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAEsmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIKICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIKICAgIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIgogICAgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSIKICAgdGlmZjpJbWFnZVdpZHRoPSIxMCIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgeG1wOk1vZGlmeURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiPgogICA8eG1wTU06SGlzdG9yeT4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJwcm9kdWNlZCIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWZmaW5pdHkgRGVzaWduZXIgMS45LjAiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/Pn8+b7YAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRy0tCQRSHv7Qwyh5gRIsWEtZKwwyiNi2UXlAt1CCrjV5fgdrlXiOibdBWKIja9FrUX1DboHUQFEUQ7YLWRW0qbueqoESe4cz55jdzDjNnwBLOKFm93gvZXF4LTvid85EFp+0FK5204sURVXR1JjQepqZ93lNnxluPWav2uX+tOZ7QFahrFB5VVC0vPCk8vZZXTd4R7lDS0bjwmbBbkwsK35l6rMSvJqdK/G2yFg4GwNIu7ExVcayKlbSWFZaX48pmVpXyfcyX2BO5uZDEHvFudIJM4MfJFGMEGGKAEZmH8OCjX1bUyPcW82dZkVxFZpV1NJZJkSaPW9RVqZ6QmBQ9ISPDutn/v33Vk4O+UnW7HxqeDeO9F2zb8FMwjK8jw/g5BusTXOYq+SuHMPwheqGiuQ6gbRPOrypabBcutqDrUY1q0aJkFbckk/B2Ci0RcNxA02KpZ+V9Th4gvCFfdQ17+9An59uWfgF7Hmfv4QYbGAAAAAlwSFlzAAALEwAACxMBAJqcGAAAACdJREFUGJVjbGhoYEAC9fX1yFwmBryAptKM////R+Y3NjbSzW4C0gAo9QeQBmhTIwAAAABJRU5ErkJggg=='"),this._setTabIndex(e.tabIndex)}set value(e){this.m_props.color=e,this.update()}get value(){return this.m_props.color}set custom_colors(e){this.m_props.cust_colors=e}_showPicker(){let e=new bh({color:this.m_props.color,cust_colors:this.m_props.cust_colors,hasAlpha:this.m_props.hasAlpha,events:{change:i=>{this.m_props.color=i.value,this._change(),this.update()}}}),t=this.getBoundingRect();e.displayAt(t.left,t.bottom,"tl")}_change(){this.emit("change",$e(this.m_props.color))}_isTransp(e){return!e.alpha()}},"ColorPickerEditor2");f(ax,"ColorPickerEditor");var hx=[{color:"Red",variations:[{weight:50,hex:16772078},{weight:100,hex:16764370},{weight:200,hex:15702682},{weight:300,hex:15037299},{weight:400,hex:15684432},{weight:500,hex:16007990},{weight:600,hex:15022389},{weight:700,hex:13840175},{weight:800,hex:12986408},{weight:900,hex:12000284}]},{color:"Pink",variations:[{weight:50,hex:16573676},{weight:100,hex:16301008},{weight:200,hex:16027569},{weight:300,hex:15753874},{weight:400,hex:15483002},{weight:500,hex:15277667},{weight:600,hex:14162784},{weight:700,hex:12720219},{weight:800,hex:11342935},{weight:900,hex:8916559}]},{color:"Purple",variations:[{weight:50,hex:15984117},{weight:100,hex:14794471},{weight:200,hex:13538264},{weight:300,hex:12216520},{weight:400,hex:11225020},{weight:500,hex:10233776},{weight:600,hex:9315498},{weight:700,hex:8069026},{weight:800,hex:6953882},{weight:900,hex:4854924}]},{color:"Deep Purple",variations:[{weight:50,hex:15591414},{weight:100,hex:13747433},{weight:200,hex:11771355},{weight:300,hex:9795021},{weight:400,hex:8280002},{weight:500,hex:6765239},{weight:600,hex:6174129},{weight:700,hex:5320104},{weight:800,hex:4532128},{weight:900,hex:3218322}]},{color:"Indigo",variations:[{weight:50,hex:15264502},{weight:100,hex:12962537},{weight:200,hex:10463450},{weight:300,hex:7964363},{weight:400,hex:6056896},{weight:500,hex:4149685},{weight:600,hex:3754411},{weight:700,hex:3162015},{weight:800,hex:2635155},{weight:900,hex:1713022}]},{color:"Blue",variations:[{weight:50,hex:14938877},{weight:100,hex:12312315},{weight:200,hex:9489145},{weight:300,hex:6600182},{weight:400,hex:4367861},{weight:500,hex:2201331},{weight:600,hex:2001125},{weight:700,hex:1668818},{weight:800,hex:1402304},{weight:900,hex:870305}]},{color:"Light Blue",variations:[{weight:50,hex:14808574},{weight:100,hex:11789820},{weight:200,hex:8508666},{weight:300,hex:5227511},{weight:400,hex:2733814},{weight:500,hex:240116},{weight:600,hex:236517},{weight:700,hex:166097},{weight:800,hex:161725},{weight:900,hex:87963}]},{color:"Cyan",variations:[{weight:50,hex:14743546},{weight:100,hex:11725810},{weight:200,hex:8445674},{weight:300,hex:5099745},{weight:400,hex:2541274},{weight:500,hex:48340},{weight:600,hex:44225},{weight:700,hex:38823},{weight:800,hex:33679},{weight:900,hex:24676}]},{color:"Teal",variations:[{weight:50,hex:14742257},{weight:100,hex:11722715},{weight:200,hex:8440772},{weight:300,hex:5093036},{weight:400,hex:2533018},{weight:500,hex:38536},{weight:600,hex:35195},{weight:700,hex:31083},{weight:800,hex:26972},{weight:900,hex:19776}]},{color:"Green",variations:[{weight:50,hex:15267305},{weight:100,hex:13166281},{weight:200,hex:10868391},{weight:300,hex:8505220},{weight:400,hex:6732650},{weight:500,hex:5025616},{weight:600,hex:4431943},{weight:700,hex:3706428},{weight:800,hex:3046706},{weight:900,hex:1793568}]},{color:"Light Green",variations:[{weight:50,hex:15857897},{weight:100,hex:14478792},{weight:200,hex:12968357},{weight:300,hex:11457921},{weight:400,hex:10275941},{weight:500,hex:9159498},{weight:600,hex:8172354},{weight:700,hex:6856504},{weight:800,hex:5606191},{weight:900,hex:3369246}]},{color:"Lime",variations:[{weight:50,hex:16382951},{weight:100,hex:15791299},{weight:200,hex:15134364},{weight:300,hex:14477173},{weight:400,hex:13951319},{weight:500,hex:13491257},{weight:600,hex:12634675},{weight:700,hex:11514923},{weight:800,hex:10394916},{weight:900,hex:8550167}]},{color:"Yellow",variations:[{weight:50,hex:16776679},{weight:100,hex:16775620},{weight:200,hex:16774557},{weight:300,hex:16773494},{weight:400,hex:16772696},{weight:500,hex:16771899},{weight:600,hex:16635957},{weight:700,hex:16498733},{weight:800,hex:16361509},{weight:900,hex:16088855}]},{color:"Amber",variations:[{weight:50,hex:16775393},{weight:100,hex:16772275},{weight:200,hex:16769154},{weight:300,hex:16766287},{weight:400,hex:16763432},{weight:500,hex:16761095},{weight:600,hex:16757504},{weight:700,hex:16752640},{weight:800,hex:16748288},{weight:900,hex:16740096}]},{color:"Orange",variations:[{weight:50,hex:16774112},{weight:100,hex:16769202},{weight:200,hex:16764032},{weight:300,hex:16758605},{weight:400,hex:16754470},{weight:500,hex:16750592},{weight:600,hex:16485376},{weight:700,hex:16088064},{weight:800,hex:15690752},{weight:900,hex:15094016}]},{color:"Deep Orange",variations:[{weight:50,hex:16509415},{weight:100,hex:16764092},{weight:200,hex:16755601},{weight:300,hex:16747109},{weight:400,hex:16740419},{weight:500,hex:16733986},{weight:600,hex:16011550},{weight:700,hex:15092249},{weight:800,hex:14172949},{weight:900,hex:12531212}]},{color:"Brown",variations:[{weight:50,hex:15723497},{weight:100,hex:14142664},{weight:200,hex:12364452},{weight:300,hex:10586239},{weight:400,hex:9268835},{weight:500,hex:7951688},{weight:600,hex:7162945},{weight:700,hex:6111287},{weight:800,hex:5125166},{weight:900,hex:4073251}]},{color:"Grey",variations:[{weight:50,hex:16448250},{weight:100,hex:16119285},{weight:200,hex:15658734},{weight:300,hex:14737632},{weight:400,hex:12434877},{weight:500,hex:10395294},{weight:600,hex:7697781},{weight:700,hex:6381921},{weight:800,hex:4342338},{weight:900,hex:2171169}]},{color:"Blue Grey",variations:[{weight:50,hex:15527921},{weight:100,hex:13621468},{weight:200,hex:11583173},{weight:300,hex:9479342},{weight:400,hex:7901340},{weight:500,hex:6323595},{weight:600,hex:5533306},{weight:700,hex:4545124},{weight:800,hex:3622735},{weight:900,hex:2503224}]},{color:"Grey",variations:[{weight:50,hex:16777215},{weight:100,hex:14737632},{weight:200,hex:12895428},{weight:300,hex:11053224},{weight:400,hex:9211020},{weight:500,hex:7368816},{weight:600,hex:5526612},{weight:700,hex:3684408},{weight:800,hex:1842204},{weight:900,hex:0}]}];function Qs(e,t){return Ie({type:e,id:t})}h(Qs,"EvDataChange2");m(Qs,"EvDataChange2");d(Qs,"EvDataChange2");f(Qs,"EvDataChange");var Rg=d(class{name;id;fields;constructor(e){this.name=e,this.id=void 0,this.fields=[]}},"MetaInfos2");f(Rg,"MetaInfos");var Ba=Symbol("metaField");function Yr(e,t=!0){let i=e.constructor,s=i.hasOwnProperty(Ba)?i[Ba]:void 0;if(s===void 0){t||console.assert(s!==void 0),s=new Rg(i.name);let r=Object.getPrototypeOf(i);if(r!=Ym){let n=r[Ba];s.fields=[...n.fields,...s.fields],console.assert(s.id===void 0,"cannot define mutiple record id"),s.id||(s.id=n.id)}e.constructor[Ba]=s}return s}h(Yr,"_getMetas2");m(Yr,"_getMetas2");d(Yr,"_getMetas2");f(Yr,"_getMetas");var $f;(e=>{function t(){return(u,_)=>{let p=Yr(u);p.fields.push({name:_,type:"any",required:!0}),p.id=_}}h(t,"id"),m(t,"id"),d(t,"id"),e.id=t,f(t,"id");function i(u){return(_,p)=>{Yr(_).fields.push({name:p,...u})}}h(i,"field"),m(i,"field"),d(i,"field"),e.field=i,f(i,"field");function s(u){return i({...u,type:"string"})}h(s,"string"),m(s,"string"),d(s,"string"),e.string=s,f(s,"string");function r(u){return i({...u,type:"int"})}h(r,"int"),m(r,"int"),d(r,"int"),e.int=r,f(r,"int");function n(u){return i({...u,type:"float"})}h(n,"float"),m(n,"float"),d(n,"float"),e.float=n,f(n,"float");function l(u){return i({...u,type:"bool"})}h(l,"bool"),m(l,"bool"),d(l,"bool"),e.bool=l,f(l,"bool");function o(u){return i({...u,type:"date"})}h(o,"date"),m(o,"date"),d(o,"date"),e.date=o,f(o,"date");function a(u){return i({...u,type:"calc"})}h(a,"calc"),m(a,"calc"),d(a,"calc"),e.calc=a,f(a,"calc");function c(u,_){return e.field({..._,type:"array",model:new u})}h(c,"array"),m(c,"array"),d(c,"array"),e.array=c,f(c,"array")})($f||($f={}));var Ym=d(class{constructor(e,t){e!==void 0&&this.unSerialize(e,t)}clone(e){let t=new this.constructor;return e&&t.unSerialize(e),t}getID(){let e=Yr(this,!1);return this[e.id]}getFields(){return Yr(this,!1).fields}validate(){let e=null;return this.getFields().forEach(i=>{i.required&&!this.getField(i.name)&&(e&&(e=[]),e.push(new Error(`field ${i.name} is required.`)))}),e}getFieldIndex(e){return this.getFields().findIndex(i=>i.name==e)}serialize(){let e={};return this.getFields().forEach(t=>{t.calc===void 0&&(e[t.name]=e[t.name])}),e}unSerialize(e,t){let i=this.getFields();return i.forEach(s=>{let r=e[s.name];r!==void 0&&(this[s.name]=this._convertField(s,r))}),t!==void 0?this[i[0].name]=t:console.assert(this.getID()!==void 0),this}_convertField(e,t){switch(e.type){case"float":{let i=typeof t=="number"?t:parseFloat(t);if(e.prec!==void 0){let s=Math.pow(10,e.prec);i=Math.round(i*s)/s}return i}case"int":return typeof t=="number"?t:parseInt(t);case"date":return Fe(t)?new Date(t):t;case"array":{let i=[];if(e.model)return t.forEach(s=>{i.push(e.model.clone(s))}),i;break}}return t}getRaw(e){let t,i=this.getFields();if(typeof e=="string"){if(t=i.findIndex(r=>r.name==e),t<0){console.assert(!1,"unknown field: "+e);return}}else if(e>=0&&e<i.length)t=e;else{console.assert(!1,"bad field name: "+e);return}let s=i[t];return s.calc!==void 0?s.calc(this):this[s.name]}setRaw(e,t){this[e]=t}getField(e){let t=this.getRaw(e);return t==null?"":""+t}setField(e,t){let i=this.getFields(),s=i.findIndex(n=>n.name==e);if(s<0){console.assert(!1,"unknown field: "+e);return}let r=i[s];if(r.calc!==void 0){console.assert(!1,"cannot set calc field: "+e);return}this.setRaw(r.name,t)}},"Record2");f(Ym,"Record");var Lg=d(class extends Ym{m_data;m_fid;constructor(e){super(),this.m_data=e}getID(){if(!this.m_fid){let e=Object.keys(this.m_data);this.m_fid=e[0]}return this.m_data[this.m_fid]}getFields(){return Object.keys(this.m_data).map(i=>({name:i}))}getRaw(e){return this.m_data[e]}setRaw(e,t){this.m_data[e]=t}clone(e){return new Lg({...e})}},"AutoRecord2");f(Lg,"AutoRecord");var Vg=d(class extends tl{constructor(e){super(e)}load(e){e&&(this.m_props.url=e),this._refresh()}_refresh(e=0){let t=f(async()=>{let i=this.m_props.url;this.m_props.params&&(i+="?"+this.m_props.params.join("&"));let s=await fetch(i);if(s.ok){let r=await s.json(),n=r;this.m_props.solver&&(n=this.m_props.solver(n)),this.emit("change",$e(n,r))}},"load");e?setTimeout(t,e):t()}},"DataProxy2");f(Vg,"DataProxy");var c_=d(class extends bo{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 Vg({url:e.url,solver:e.solver,events:{change:t=>{this.setData(t.value)}}}),this.m_proxy.load())}load(e){this.m_proxy.load(e)}reload(){this.m_proxy.load()}setData(e){let t=[];e.forEach(i=>{t.push(this.m_model.clone(i))}),this.setRawData(t)}setRawData(e){this.m_records=e,this._rebuildIndex(),this.emit("data_change",Qs("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=e.getID(),i=this.indexOfId(t);return i<0?!1:(this.m_records[this.m_rec_index[i]]=e,this.emit("data_change",Qs("update",t)),!0)}append(e){e instanceof Ym||(e=this.m_model.clone().unSerialize(e)),console.assert(e.getID()),this.m_records.push(e),this._rebuildIndex(),this.emit("data_change",Qs("create",e.getID()))}getMaxId(){let e;return this.m_records.forEach(t=>{let i=t.getID();(e===void 0||e<i)&&(e=i)}),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.emit("data_change",Qs("delete",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){for(let t=this.count,i=0;t!=0;t>>=1){let s=i+(t>>1),r=this.m_rec_index[s],n=this.m_records[r].getID();if(n==e)return s;n<e&&(i=s+1,t--)}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){return this.m_records[e]??null}moveTo(e){e.setRawData(this.m_records)}createView(e){let t={...e,store:this};return new Bg(t)}createIndex(e){if(e&&e.op==="empty-result")return new Uint32Array(0);let t=new Uint32Array(this.m_records.length),i=0;if(!e)this.forEach((u,_)=>{t[i++]=_});else if(typeof e.op=="function"){let u=e.op;this.forEach((_,p)=>{_&&u(_)&&(t[i++]=p)})}else{let u=d(function(w){return w<k},"_lt2"),_=d(function(w){return w<=k},"_le2"),p=d(function(w){return w==k},"_eq2"),v=d(function(w){return w!=k},"_neq2"),g=d(function(w){return w>=k},"_ge2"),x=d(function(w){return w>k},"_gt2"),E=d(function(w){return S.lastIndex=-1,S.test(w)},"_re2");var s=u,r=_,n=p,l=v,o=g,a=x,c=E;f(u,"_lt"),f(_,"_le"),f(p,"_eq"),f(v,"_neq"),f(g,"_ge"),f(x,"_gt"),f(E,"_re");let y=this.m_model.getFieldIndex(e.field);if(y<0)return console.assert(!1,"unknown field name in filter"),new Uint32Array(0);let k=e.value;Fe(k)&&!e.caseSensitive&&(k=k.toUpperCase());let A,S;if(k instanceof RegExp)S=k,A=E;else switch(e.op){case"<":{A=u;break}case"<=":{A=_;break}case"=":{A=p;break}case">=":{A=g;break}case">":{A=x;break}case"<>":{A=v;break}}this.forEach((w,D)=>{if(!w)return;let R=w.getRaw(y);R==null?R="":(R=""+R,e.caseSensitive||(R=R.toUpperCase())),A(R)&&(t[i++]=D)})}return t.slice(0,i)}sortIndex(e,t){let i=0,s=[];if(t===null?s.push({fidx:0,asc:!0}):s=t.map(r=>{let n=this.m_model.getFieldIndex(r.field);return n==-1&&(console.assert(!1,"unknown field name in sort"),i++),{fidx:n,asc:r.ascending}}),i||s.length==0)return e;if(s.length==1){let r=s[0].fidx;e.sort((n,l)=>{let o=this.getByIndex(n).getRaw(r)??"",a=this.getByIndex(l).getRaw(r)??"";return o>a?1:o<a?-1:0}),s[0].asc||e.reverse()}else e.sort((r,n)=>{for(let l=0;l<s.length;l++){let o=s[l].fidx,a=s[l].asc?1:-1,c=this.getByIndex(r).getRaw(o)??"",u=this.getByIndex(n).getRaw(o)??"";if(c>u)return a;if(c<u)return-a}return 0});return e}forEach(e){this.m_rec_index?this.m_rec_index.some((t,i)=>{if(e(this.m_records[t],i))return i}):this.m_records.some((t,i)=>{if(t&&e(t,i))return i})}export(){return this.m_records}changed(){this.emit("data_change",Qs("change"))}},"DataStore2");f(c_,"DataStore");function Tr(e){return Ie({action:e})}h(Tr,"EvViewChange2");m(Tr,"EvViewChange2");d(Tr,"EvViewChange2");f(Tr,"EvViewChange");var Bg=d(class extends tl{m_index;m_store;m_sort;m_filter;constructor(e){super(e),this.m_store=e.store,this.m_index=null,this.m_filter=null,this.m_sort=null,this.filter(e.filter),e.order?Fe(e.order)?this.sort([{field:e.order,ascending:!0}]):Jt(e.order)?this.sort(e.order):this.sort([e.order]):this.sort(null),this.m_store.on("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.emit("view_change",Tr("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.emit("view_change",Tr("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.emit("view_change",Tr("sort"))}get store(){return this.m_store}get count(){return this.m_index.length}indexOfId(e){let t=this.m_store.indexOfId(e);return this.m_index.findIndex(i=>i===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}getById(e){return this.m_store.getById(e)}changed(){this.emit("view_change",Tr("change"))}forEach(e){debugger;this.m_index.some(t=>{let i=this.m_store.getByIndex(t);if(i&&e(i,t))return t})}},"DataView2");f(Bg,"DataView");var ju=d(class extends me{m_ui_input;m_ui_button;m_popup;m_lockpop;m_lockchg;m_popvis;m_selection;constructor(e){super(e),e.editable||this.setDomEvent("keypress",()=>this.showPopup()),this.setDomEvent("click",()=>{this.m_props.editable&&this.m_ui_input.focus(),this.showPopup()}),this.setDomEvent("keydown",t=>this._onKey(t)),this.mapPropEvents(e,"selectionChange"),this.m_popvis=!1,this.m_lockpop=!1,this.m_lockchg=!1}_onKey(e){this.m_popvis&&(e.key=="ArrowUp"||e.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(e),this.m_lockpop=!1,e.preventDefault(),e.stopPropagation()):e.key=="Escape"&&(this._hidePopup(),e.preventDefault(),e.stopPropagation()))}set items(e){this.m_props.items=e,this.m_popup&&(this.m_popup.items=e)}render(e){if(e.renderer)this.m_ui_input=new T({flex:1,cls:"@fake-input @hlayout",tabIndex:1});else{let r=new ts({flex:1,readOnly:!this.m_props.editable,tabIndex:0,name:e.name,value_hook:{get:()=>this.value,set:n=>{this.value=n}},dom_events:{focus:()=>{this.m_props.editable&&r.value.length==0&&this.showPopup()},input:()=>{if(this.m_lockchg)return;let n=r.value;this.m_selection={id:void 0,text:n};let l=this.showPopup();l&&l.length&&l[0].text==n&&(this.m_selection={id:l[0].id,text:n})}}});this.m_ui_input=r}let t,i,s=e.labelWidth??0;s>0?t=s:s<0&&(i=-s),this.setContent([new Ge({cls:"label1"+(e.label?"":" @hidden"),text:e.label,width:t,flex:i,align:e.labelAlign}),new me({flex:1,content:[this.m_ui_input,this.m_ui_button=new bt({cls:"gadget",icon:"var( --x4-icon-angle-down )",tabIndex:!1,click:()=>{this.showPopup(!1)},dom_events:{focus:()=>{this.dom.focus()}}})]})]),e.value!==void 0&&(this.value=e.value)}componentDisposed(){this.m_popup&&this.m_popup.close(),super.componentDisposed()}showPopup(e=!0){let t=this.m_props;if(t.readOnly||this.hasClass("@disable"))return null;let i=t.items;if(di(i)){let n=e?this.m_ui_input.value:null;i=i(n)}if(i.length==0)return null;if(!this.m_popup){let n=this.getComputedStyle(),l=n.value("fontFamily"),o=n.value("fontSize");this.m_popup=new s_({cls:"@combo-popup",populate:t.populate,renderItem:this.m_props.renderer,selectionChange:a=>{this._selectItem(a),this.m_lockpop||(this._hidePopup(),this.focus())},cancel:a=>this.signal("cancel",a),style:{fontFamily:l,fontSize:o}})}this.m_popup.items=i;let s=this.m_ui_button.getBoundingRect(),r=this.m_ui_input.getBoundingRect();return this.m_popup.setStyle({minWidth:s.right-r.left}),this.m_popup.displayAt(r.left,r.bottom),this.m_popvis=!0,this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.value!==void 0&&(this.m_popup.selection=this.value),i}_selectItem(e){let t=e.selection;t&&(this.m_lockchg=!0,this._setInput(t,!0),this.m_lockchg=!1,this.m_selection={id:t.id,text:t.text},this.emit("selectionChange",bi(t)),this.emit("change",$e(t.id)))}_setInput(e,t=!1){e?this.m_ui_input?this.m_ui_input instanceof ts?(this.m_ui_input.value=e.text,t&&this.m_ui_input.dom.dispatchEvent(new Event("input"))):this.m_ui_input.setContent(this.m_props.renderer(e)):this.m_props.value=e.id:this.m_ui_input&&this.m_ui_input instanceof ts&&(this.m_ui_input.value="")}get value(){return this.m_selection?this.m_selection.id:void 0}get valueText(){return this.m_selection?this.m_selection.text:this.m_props.editable?this.m_ui_input.value:""}set value(e){let t=this.m_props.items;di(t)&&(t=t(null)),t.some(s=>{if(s.id===e)return this._setInput(s),this.m_selection=s,!0})||(this._setInput(null),this.m_selection=null)}get input(){return this.m_ui_input instanceof ts?this.m_ui_input:null}_checkFocus(){let e=document.activeElement;this.dom&&this.dom.contains(e)||e==document.body||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(e)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1,this.stopTimer("focus-check"))}static storeProxy(e){let t=e.store instanceof c_?e.store.createView():e.store;return()=>{let i=new Array(e.store.count);return e.store.forEach((s,r)=>{i[r]={id:s.getID(),text:e.display(s)}}),i}}focus(){this.m_props.editable?this.m_ui_input.focus():super.focus()}},"ComboBox2");f(ju,"ComboBox");var fu=Symbol("x-drag-cb"),Hg=d(class{dragSource;dragGhost;dropTarget;notified;timer;registerDraggableElement(e){e.setDomEvent("dragstart",t=>{this.dragSource=e,this.dragGhost=e.dom.cloneNode(!0),this.dragGhost.classList.add("dragged"),H.body.appendChild(this.dragGhost),e.addClass("dragging"),t.dataTransfer.setData("text/string","1"),t.dataTransfer.setDragImage(new Image,0,0),t.stopPropagation()}),e.setDomEvent("drag",t=>{this.dragGhost.style.left=t.pageX+"px",this.dragGhost.style.top=t.pageY+"px"}),e.setDomEvent("dragend",t=>{e.removeClass("dragging"),this.dragGhost.remove()}),e.setAttribute("draggable","true")}registerDropTarget(e,t,i){let s=f(o=>{if(i&&!i(this.dragSource)){console.log("reject ",e),o.dataTransfer.dropEffect="none";return}console.log("accepted ",e),o.preventDefault(),o.dataTransfer.dropEffect="copy"},"dragEnter"),r=f(o=>{if(i&&!i(this.dragSource)){console.log("reject ",e),o.dataTransfer.dropEffect="none";return}if(o.preventDefault(),this.dropTarget!=e&&(this.dropTarget=e,this._startCheck()),this.dropTarget){let a={pt:new qi(o.pageX,o.pageY),data:o.dataTransfer};t("drag",this.dragSource,a)}o.dataTransfer.dropEffect="copy"},"dragOver"),n=f(o=>{this.dropTarget=null,o.preventDefault()},"dragLeave"),l=f(o=>{let a={pt:new qi(o.pageX,o.pageY),data:o.dataTransfer};t("drop",this.dragSource,a),this.dropTarget=null,e.removeClass("drop-over"),o.preventDefault()},"drop");e.setDomEvent("dragenter",s),e.setDomEvent("dragover",r),e.setDomEvent("dragleave",n),e.setDomEvent("drop",l),e.setData(fu,t)}_startCheck(){this.timer&&(clearInterval(this.timer),this._check()),this.timer=setInterval(()=>this._check(),300)}_check(){let e=f(i=>{i.removeClass("drop-over"),i.getData(fu)("leave",this.dragSource)},"leaving"),t=f(i=>{i.addClass("drop-over"),i.getData(fu)("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))}},"DragManager2");f(Hg,"DragManager");var bC=new Hg,mx={align:"center",vAlign:"middle",fontSize:14,fontWeight:null,fontStyle:"",fontVariant:"",fontFamily:"Arial",lineHeight:0,clip:!0,columns:1,columnGap:0,lineBreak:!0};function u_(e,t,i,s){if(i.width<=0||i.height<=0)return;if(s={...mx,...s},e.save(),s.clip&&(e.beginPath(),e.rect(i.left,i.top,i.width,i.height),e.clip()),s.rotation){let C=new qi(i.left+i.width/2,i.top+i.height/2),z=s.rotation/180*Math.PI;e.translate(C.x,C.y),e.rotate(z),e.translate(-C.x,-C.y)}e.textBaseline="bottom";let r=Zr(s.fontSize,2)??12,n="";s.fontStyle&&(n+=s.fontStyle+" "),s.fontVariant&&(n+=s.fontVariant+" "),s.fontWeight&&(n+=s.fontWeight+" "),n+=r+"px ";let l=s.fontFamily??"sans-serif";l.indexOf(".")>0&&(l='"'+l+'"'),n+=l,e.font=n.trim();let o=[],a=t.split(`
|
|
19
|
+
`),c=s.columns<1?1:s.columns,u=s.columnGap,_=(i.width-u*(c-1))/c,p=i.left,v=_;s.lineBreak||(v=99999999);let g=kn(e," ");a.forEach(C=>{let z={width:0,words:[],space:0},W=kn(e,C);if(W<v)z.width=W,z.words.push({width:W,text:C}),o.push(z);else{let ve=C.split(/\s/).filter(K=>K!=="").map(K=>({width:kn(e,K),text:K})),te=0,ie=0;for(;te<ve.length;){let K=ve[te],Y=z.width;Y&&(Y+=g),Y+=K.width,Y>_&&ie>0?(o.push(z),ie=0,W=0,z={width:0,words:[],space:0}):(z.words.push(K),z.width=Y,te++,ie++)}ie&&(o.push(z),z.last=!0)}});let x=Xm(e,"Ag"),E=(s.lineHeight??1.3)*x,y=o.length,k=i.top;if(c==1){let C=E*y;y==1&&(E=x,C=x),s.vAlign==="middle"?(k=i.top+i.height/2-C/2,k+=E/2,e.textBaseline="middle"):s.vAlign==="bottom"?C<i.height&&(k=i.top+i.height-C+E):(k=i.top,e.textBaseline="top")}else k+=x;let A=s.align=="justify",S=c,w=k,D=0;switch(s.align){case"right":D=1;break;case"center":D=2;break}let R=0;return o.some(C=>{C.space=g,A&&!C.last&&Zm(C,_,g);let z=p,W=0;if(D==1?z+=_-C.width:D==2&&(z+=_/2-C.width/2),C.words.forEach(J=>{e.fillText(J.text,z,w),z+=J.width+C.space,W+=J.width+C.space}),w+=E,R<W&&(R=W),w>i.bottom+E&&(w=k,p+=_+u,--S==0))return!0}),e.restore(),{width:R,height:(o.length+.3)*E}}h(u_,"drawText2");m(u_,"drawText2");d(u_,"drawText2");f(u_,"drawText");function Xm(e,t){let i=e.measureText(t);return i.actualBoundingBoxAscent+i.actualBoundingBoxDescent}h(Xm,"_calcTextHeight2");m(Xm,"_calcTextHeight2");d(Xm,"_calcTextHeight2");f(Xm,"_calcTextHeight");function kn(e,t){return Zr(e.measureText(t).width,2)}h(kn,"_measureText2");m(kn,"_measureText2");d(kn,"_measureText2");f(kn,"_measureText");function Zm(e,t,i){let s=(t-e.width)/(e.words.length-1)+i;s<=0||(e.width=t,e.space=s)}h(Zm,"_justify2");m(Zm,"_justify2");d(Zm,"_justify2");f(Zm,"_justify");var pu="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";function mo(e){return e.substr(0,5)=="data:"}h(mo,"_isStaticImage2");m(mo,"_isStaticImage2");d(mo,"_isStaticImage2");f(mo,"_isStaticImage");var Rs=d(class extends T{m_created;m_lazysrc;constructor(e){super(e),this.m_created=!1,this.m_props.lazy=e.lazy!==!1,this.m_props.alt=e.alt,e.lazy!==!1&&(this.m_lazysrc=e.src,e.src=pu),this.setDomEvent("create",()=>{e.lazy&&this.setImage(this.m_lazysrc,!0)})}render(){let e=this.m_props,t=new T({tag:"img",attrs:{draggable:!1,alt:e.alt??"",decoding:e.lazy?"async":void 0},style:{objectFit:e.alignment?e.alignment:void 0}});this.setContent(t)}setImage(e,t){e||(e=pu),this.m_props.lazy?(t||this.m_lazysrc!=e)&&(mo(e)?(this.m_props.src=e,this.m_lazysrc=e,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src)):(this.m_props.src=pu,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src),this.m_lazysrc=e,this.dom&&this._update_image())):(this.m_props.src=e,this.m_lazysrc=e,this.dom&&this.dom.firstChild.setAttribute("src",e))}_update_image(){console.assert(!!this.dom),this.m_lazysrc&&!mo(this.m_lazysrc)&&(Rs.lazy_images_waiting.push({dom:this.dom,src:this.m_lazysrc}),Rs.lazy_image_timer===void 0&&(Rs.lazy_image_timer=setInterval(Rs.lazyWatch,10)))}static lazyWatch(){let e=[],t=0;Rs.lazy_images_waiting.forEach(i=>{let s=i.dom,r=i.src;if(!s||s.offsetParent===null)return;let n=s.getBoundingClientRect();!t&&s.offsetParent!==null&&n.bottom>=0&&n.right>=0&&n.top<=(window.innerHeight||H.documentElement.clientHeight)&&n.left<=(window.innerWidth||H.documentElement.clientWidth)?(s.firstChild.setAttribute("src",r),t++):e.push(i)}),Rs.lazy_images_waiting=e,e.length==0&&(clearInterval(Rs.lazy_image_timer),Rs.lazy_image_timer=void 0)}},"_Image2"),Jm=Rs;f(Jm,"Image");fe(Jm,"lazy_images_waiting",[]);fe(Jm,"lazy_image_timer");var Og=d(class extends me{constructor(e){super(e)}clear(){this.m_props.value=""}},"FileUpload2");f(Og,"FileUpload");var cx=d(class extends Og{m_path;m_ui_img;m_ui_input;render(e){let t="up"+this.uid;this.setContent([new T({tag:"label",attrs:{for:t},content:[this.m_ui_img=new Jm({src:this.m_props.value})]}),this.m_ui_input=new ts({cls:"@hidden",id:t,type:"file",name:this.m_props.name,value_hook:{get:()=>this._get_value(),set:i=>{this._set_value(i)}},attrs:{accept:"image/*"},dom_events:{change:i=>{this._handleChange(i)}}})])}clear(){super.clear(),this.m_ui_input.dom.value="",this.m_ui_img.setImage(null,!1)}_get_value(){return this.m_path}_set_value(e){debugger}_handleChange(e){let t=this;function i(l){let o=new FileReader;o.addEventListener("load",a=>{t.m_ui_img.setImage(o.result.toString())}),o.readAsDataURL(l)}h(i,"createThumbnail"),m(i,"createThumbnail"),d(i,"createThumbnail"),f(i,"createThumbnail");let s=["png","jpg","jpeg","gif"],r=e.target.files,n=r.length;for(let l=0;l<n;l++){let o=r[l].name.split(".");if(o=o[o.length-1],o=o.toLowerCase(),s.indexOf(o)!=-1){i(r[l]),this.m_path=r[l];break}}}},"ImageUpload2");f(cx,"ImageUpload");var Rl=null;function ma(){return Rl||(Rl=new T({tag:"input",style:{display:"none",id:"fileDialog"},attrs:{type:"file"}}),H.body.appendChild(Rl._build())),Rl.clearDomEvent("change"),Rl}h(ma,"_createFileInput2");m(ma,"_createFileInput2");d(ma,"_createFileInput2");f(ma,"_createFileInput");function d_(e,t,i=!1){let s=ma();s.removeAttribute("nwsaveas"),s.setAttribute("accept",e),s.setAttribute("multiple",i),s.setDomEvent("change",r=>{let n=s.dom.files;t(n)}),s.dom.click()}h(d_,"openFileDialog2");m(d_,"openFileDialog2");d(d_,"openFileDialog2");f(d_,"openFileDialog");function __(e,t,i){let s=ma();s.setAttribute("nwsaveas",e),s.setAttribute("accept",t),s.setDomEvent("change",r=>{let n=s.dom.files;i(n[0])}),s.dom.click()}h(__,"saveFileDialog2");m(__,"saveFileDialog2");d(__,"saveFileDialog2");f(__,"saveFileDialog");var Gu,xh;function Qm(e){e?xh=new Intl.NumberFormat(Gu,{style:"currency",currency:e}):xh=new Intl.NumberFormat(Gu,{style:"decimal",useGrouping:!0,minimumFractionDigits:2,maximumFractionDigits:2})}h(Qm,"setCurrencySymbol2");m(Qm,"setCurrencySymbol2");d(Qm,"setCurrencySymbol2");f(Qm,"setCurrencySymbol");function f_(e){if(e==null||e==="")return"";let t=new Date(Date.parse(e)),i={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return t.toLocaleDateString(Gu,i)}h(f_,"sql_date_formatter2");m(f_,"sql_date_formatter2");d(f_,"sql_date_formatter2");f(f_,"sql_date_formatter");function p_(e){if(e==null||e==="")return"";let t=typeof e=="string"?new Date(Date.parse(e)):e;return Et(t)}h(p_,"date_formatter2");m(p_,"date_formatter2");d(p_,"date_formatter2");f(p_,"date_formatter");function g_(e){if(e==null||e==="")return"";let t=Zr(typeof e=="string"?parseFloat(e):e,2);return Object.is(t,-0)&&(t=0),xh.format(t)}h(g_,"money_formatter2");m(g_,"money_formatter2");d(g_,"money_formatter2");f(g_,"money_formatter");function v_(e){if(e==null||e==="")return"";let t=Zr(typeof e=="string"?parseFloat(e):e,2);return t?xh.format(t):""}h(v_,"money_formatter_nz2");m(v_,"money_formatter_nz2");d(v_,"money_formatter_nz2");f(v_,"money_formatter_nz");function w_(e){return e?"oui":"-"}h(w_,"bool_formatter2");m(w_,"bool_formatter2");d(w_,"bool_formatter2");f(w_,"bool_formatter");Qm(null);var xC=Symbol("update");function ec(e,t){return Ie({rec:e,chk:t})}h(ec,"EvGridCheck2");m(ec,"EvGridCheck2");d(ec,"EvGridCheck2");f(ec,"EvGridCheck");var Wg=d(class extends T{m_sens;m_sorted;constructor(e,t){super(e),this.m_sorted=!1,this.m_sens="dn",this.setContent([new T({tag:"span",content:t}),new rt({ref:"sorter",cls:"@hidden sort",icon:"var( --x4-icon-arrow-down )"})])}get sorted(){return this.m_sorted}sort(e,t){this.m_sorted=e,this.m_sens=t;let i=this.itemWithRef("sorter");i.icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )",i.show(e)}get sens(){return this.m_sens}toggleSens(){this.m_sens=this.m_sens=="up"?"dn":"up",this.itemWithRef("sorter").icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )"}},"ColHeader2");f(Wg,"ColHeader");var ux=d(class extends St{m_dataview;m_data_cx;m_columns;m_view_el;m_container;m_header;m_footer;m_empty_msg;m_empty_text;m_selection;m_itemHeight;m_topIndex;m_visible_rows;m_hasMarks;m_marks;m_recycler;m_rowClassifier;constructor(e){super(e),this.m_columns=e.columns,this.m_hasMarks=e.hasMarks??!1,this.m_marks=new Set,this.m_hasMarks&&this.m_columns.unshift({id:"id",title:"",width:30,renderer:t=>this._renderCheck(t)}),this.setAttribute("tabindex",0),this.m_topIndex=0,this.m_itemHeight=0,this.m_recycler=[],this.m_rowClassifier=e.calcRowClass,this.m_empty_text=e.empty_text??oe.global.empty_list,this.setDomEvent("click",t=>this._itemClick(t)),this.setDomEvent("dblclick",t=>this._itemDblClick(t)),this.setDomEvent("contextmenu",t=>this._itemMenu(t)),this.setDomEvent("keydown",t=>this._handleKey(t)),this.setStore(e.store)}componentCreated(){this._updateScroll(!0)}_moveSel(e,t=!0){let i=this.m_selection,s=null;if(i===void 0)i=this.m_dataview.getByIndex(0).getID();else{let r=this.m_dataview.indexOfId(this.m_selection);e==1?r++:e==-1?r--:e==2?r+=this.m_visible_rows.length-1:e==-2&&(r-=this.m_visible_rows.length-1),e<0?s="start":s="end",r<0?r=0:r>=this.m_dataview.count&&(r=this.m_dataview.count-1),i=this.m_dataview.getByIndex(r).getID()}return this.m_selection!=i&&t&&this._selectItem(i,null,s),i}_handleKey(e){if(!(!this.m_dataview||this.m_dataview.count==0))switch(e.key){case"ArrowDown":case"Down":{this._moveSel(1);break}case"ArrowUp":case"Up":{this._moveSel(-1);break}case"PageUp":{this._moveSel(-2);break}case"PageDown":{this._moveSel(2);break}}}getNextSel(e){return this._moveSel(e,!1)}_scrollIntoView(e,t){let i=this._findItem(e);i?i.scrollIntoView({block:"center"}):(this.m_topIndex=this.m_dataview.indexOfId(e),this.m_view_el.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),this._scrollIntoView(e))}setStore(e){this.m_selection=void 0,e instanceof c_?this.m_dataview=e.createView():this.m_dataview=e,this.m_hasMarks&&this.clearMarks(),this.m_data_cx&&this.m_data_cx.dispose(),this.m_dataview&&(this.m_data_cx=this.m_dataview.on("view_change",t=>{t.action=="change"&&(this.m_selection=void 0),this._updateScroll(!0)}),this._updateScroll(!0))}getView(){return this.m_dataview}getSelection(){return this.m_selection}getSelRec(){return this.m_selection?this.m_dataview.getById(this.m_selection):null}setSelection(e){this._selectItem(e,null,"center")}render(){this.m_recycler=[],this.m_container=new T({cls:"content"}),this.m_empty_msg=new Ge({cls:"empty-msg",text:""}),this.m_view_el=new T({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let e=!1,t=this.m_columns.map((s,r)=>{let n="@cell";s.cls&&(n+=" "+s.cls);let l=new Wg({cls:n,flex:s.flex,sizable:"right",style:{width:s.width},dom_events:{click:a=>{Qt(a.target).hasClass("@sizer-overlay")||(this._sortCol(s),a.preventDefault())}}},s.title),o=f(a=>{if(this._on_col_resize(r,a.size.width),this.m_footer){let c=T.getElement(this.m_footer.dom.childNodes[r]);c&&c.setStyleValue("width",a.size.width)}},"resizeCol");return new Jh({target:l,sens:"right",events:{resize:a=>o(a)}}),s.flex&&(e=!0),s.$hdr=l,l});t.push(new dh({ref:"flex",cls:e?"@hidden":""}));let i=0;if(this.m_columns.forEach(s=>{i+=s.width??0}),this.m_header=new me({cls:"@header",content:t,style:{minWidth:i}}),this.m_props.hasFooter){let s=this.m_columns.map((r,n)=>{let l="@cell";r.align&&(l+=" "+r.align),r.cls&&(l+=" "+r.cls);let o=new T({cls:l,data:{col:n},flex:r.flex,style:{width:r.width}});return r.$ftr=o,o});s.push(new dh({ref:"flex",cls:e?"@hidden":""})),this.m_footer=new me({cls:"@footer",content:s,style:{minWidth:i}})}else this.m_footer=null;this.setContent([this.m_header,this.m_view_el,this.m_footer,this.m_empty_msg])}_on_col_resize(e,t){let i=this.m_columns[e],s=!1;if(t>=0?(i.width=t,i.flex&&(i.$hdr.removeClass("@flex"),i.$ftr?.removeClass("@flex"),i.flex=void 0,s=!0)):t<0&&!i.flex&&(i.$hdr.addClass("@flex"),i.$ftr?.addClass("@flex"),i.flex=1,s=!0),s){let r=!1;this.m_columns.forEach(n=>{n.flex&&(r=!0)}),this.m_header.itemWithRef("flex")?.show(!r),this.m_footer&&this.m_footer.itemWithRef("flex")?.show(!r)}this._updateScroll(!0)}sortCol(e,t=!0){let i=this.m_columns.find(s=>s.id==e);if(i===void 0){console.assert(!1,"unknown field "+e+" in grid.sortCol");return}this._sortCol(i,t?"dn":"up")}_sortCol(e,t="up"){if(e.sortable===!1)return;this.m_columns.forEach(s=>{s!==e&&s.$hdr.sort(!1,"dn")});let i=e.$hdr;i.sorted?i.toggleSens():i.sort(!0,t),this.m_dataview&&this.m_dataview.sort([{field:e.id,ascending:i.sens!="dn"}])}_computeItemHeight(){let e=H.createElement("div");e.classList.add("x-row");let t=H.createElement("div");t.classList.add("x-grid-view"),t.style.position="absolute",t.style.top="-1000px",t.appendChild(e),this.dom.appendChild(t);let i=e.getBoundingClientRect();this.dom.removeChild(t),this.m_itemHeight=i.height}_createRow(e){let t;if(this.m_recycler.length){t=this.m_recycler.pop(),t.clearClasses(),t.addClass(e.cls),t.setContent(e.content),t.setStyle(e.style);for(let i in e.data)t.setData(i,e.data[i])}else t=new me(e);return t.dom||this.m_container.appendChild(t),t}_buildItems(e=!0){let t=this.getBoundingRect(),i=this.m_header.getBoundingRect(),s=t.height-i.height+this.m_itemHeight;this.m_itemHeight==0&&this._computeItemHeight();let r=this.m_topIndex*this.m_itemHeight,n=0,l=0,o=this.m_topIndex,a=this.m_dataview?this.m_dataview.count:0,c=0,u=!!(this.m_topIndex&1);if(this.m_columns.forEach(g=>{c+=g.width??0}),(a+1)*this.m_itemHeight>=s){let g=T.getScrollbarSize();this.m_header.setStyleValue("paddingRight",g),this.m_footer?.setStyleValue("paddingRight",g)}else this.m_header.setStyleValue("paddingRight",0),this.m_footer?.setStyleValue("paddingRight",0);this.m_visible_rows&&this.m_visible_rows.forEach(g=>{this.m_recycler.push(g)}),this.m_visible_rows=[];let _=100;for(;n<s&&o<a&&--_>0;){let g=this.m_dataview.getByIndex(o),x=g.getID(),E=e?this.m_recycler.findIndex(y=>y.getData("row-id")==x):-1;if(E>=0){let y=this.m_recycler.splice(E,1)[0];y.setStyle({top:n+r,minWidth:c}),this.m_hasMarks&&y.setClass("@marked",this.m_marks.has(x)),y.removeClass("@hidden"),y.setClass("@selected",this.m_selection===x),this.m_visible_rows[l]=y}else{let y=this.m_columns.map(S=>{let w="@cell";S.align&&(w+=" "+S.align),S.cls&&(w+=" "+S.cls);let D;if(S.renderer)D=S.renderer(g),D&&(D.addClass(w),D.setStyleValue("width",S.width),S.flex!==void 0&&(D.addClass("@flex"),D.setStyleValue("flex",S.flex)));else{let R=S.formatter,C;R&&R instanceof Function?C=R(g.getRaw(S.id),g):C=g.getField(S.id),D=new T({cls:w,width:S.width,content:Do`<span>${C}</span>`,flex:S.flex})}return D}),k="@row @hlayout center";this.m_hasMarks&&this.m_marks.has(x)&&(k+=" @marked"),this.m_selection===x&&(k+=" @selected");let A=this.m_visible_rows[l]=this._createRow({cls:k,content:y,style:{top:n+r,minWidth:c},data:{"row-id":x,"row-idx":o}});A.addClass(u?"even":"odd"),u=!u,this.m_rowClassifier&&this.m_rowClassifier(g,A)}n+=this.m_itemHeight,o++,l++}this.m_recycler.forEach(g=>{g.addClass("@hidden")});let p=!a,v=this.m_empty_text instanceof Function?this.m_empty_text():this.m_empty_text;this.m_empty_msg.text=v,p&&v.length==0&&(p=!1),this.m_empty_msg.show(p),c<t.width?(this.m_header.setStyleValue("width",null),this.m_footer?.setStyleValue("width",null),this.m_container.setStyle({height:a*this.m_itemHeight,width:null})):(this.m_header.setStyleValue("width",c+1e3),this.m_footer?.setStyleValue("width",c+1e3),this.m_container.setStyle({height:a*this.m_itemHeight,width:c}))}_updateScroll(e){if(!this.m_view_el||!this.m_view_el.dom)return;let t=f(()=>{if(!this.dom)return;let i=Math.floor(this.m_view_el.dom.scrollTop/(this.m_itemHeight||1));(i!=this.m_topIndex||e)&&(this.m_topIndex=i,this._buildItems(!e));let s=this.m_view_el.dom.scrollLeft;this.m_header.setStyleValue("left",-s),this.m_footer?.setStyleValue("left",-s)},"update");e?this.singleShot(t,10):t()}_rowFromTarget(e){let t=this.dom;for(;e&&e!=t;){let i=T.getElement(e);if(i){let s=i.getData("row-id");if(s!==void 0)return{id:s,itm:i}}e=e.parentElement}}_itemClick(e){let t=this._rowFromTarget(e.target);t?this._selectItem(t.id,t.itm):this._selectItem(void 0,void 0)}_itemDblClick(e){let t=this._rowFromTarget(e.target);if(t){this._selectItem(t.id,t.itm);let i=this.m_dataview.getById(t.id);this.emit("dblClick",Jr(i)),this.m_hasMarks&&this._toggleMark(i)}}_itemMenu(e){let t=e.target,i=this.dom;for(;t&&t!=i;){let s=T.getElement(t),r=s?.getData("row-id");if(r!==void 0){this._selectItem(r,s);let n=s.getData("row-idx"),l=this.m_dataview.getByIndex(n);this._showItemContextMenu(e,l),e.preventDefault();return}t=t.parentElement}}_findItem(e){for(let t=0;t<this.m_visible_rows.length;t++){let i=this.m_visible_rows[t];if(i.getData("row-id")===e)return i}return null}_selectItem(e,t,i){if(this.m_selection!==void 0){let s=this._findItem(this.m_selection);s&&s.removeClass("@selected")}if(this.m_selection=e,e){i&&this._scrollIntoView(e,i),t||(t=this._findItem(e)),t&&t.addClass("@selected");let s=this.m_dataview.getById(e);this.emit("selectionChange",bi(s))}else this.emit("selectionChange",bi(null))}_showItemContextMenu(e,t){this.emit("contextMenu",Ns(e,t))}clearSelection(){this._selectItem(null,null)}exportData(e){let t="",i=" ",s=`\r
|
|
20
|
+
`,r="";this.m_columns.map(l=>{r.length&&(r+=i),r+=l.title}),t+=r+s;let n=this.m_dataview.count;for(let l=0;l<n;l++){let o=this.m_dataview.getByIndex(l);r="";let a=this.m_columns.map(c=>{let u=o.getField(c.id),_=c.formatter;_&&_ instanceof Function&&(u=_(u,o)),r.length>0&&(r+=i),r+=u});t+=r+s}t=t.replace(/[àâä]/gm,"a"),t=t.replace(/[éèê]/gm,"e"),t=t.replace(/[îï]/gm,"i"),t=t.replace(/[ûüù]/gm,"u"),t=t.replace(/ /gm," "),Kh(t,"text/csv",e)}set empty_text(e){this.m_empty_msg.text=e}_renderCheck(e){let t="--x4-icon-square";return this.m_marks.has(e.getID())&&(t="--x4-icon-square-check"),new rt({icon:`var(${t})`})}_toggleMark(e){let t=e.getID(),i=!1;this.m_marks.has(t)?this.m_marks.delete(t):(this.m_marks.add(t),i=!0),this.emit("gridCheck",ec(e,i)),this._buildItems(!1)}getMarks(){let e=[];for(let t of this.m_marks.values())e.push(t);return e}clearMarks(){this.m_marks.size&&(this.m_marks=new Set,this._buildItems(!1))}setFooterData(e){this.m_footer&&this.m_footer.enumChilds(t=>{let i=t.getData("col");if(i){let s=this.m_columns[i],r=e[s.id];if(r!==void 0)if(di(r))r(t);else{let n,l=s.formatter;l&&l instanceof Function?n=l(r,e):n=r,t.setContent(n,!1)}}})}},"GridView2");f(ux,"GridView");var dx=d(class extends T{constructor(e){super(e),this.setDomEvent("click",()=>this._handleClick()),this.mapPropEvents(e,"click")}_handleClick(){this.emit("click",bs())}render(e){let t=e.text??"",i=e.href??"#";this.setTag("a"),this.setAttribute("tabindex",0),this.setAttribute("href",i),this.setAttribute("target",e.target),t&&this.setContent(Qi(t)?t:Do`<span>${t}</span>`)}set text(e){this.m_props.text=e,this.update()}},"Link2");f(dx,"Link");var li=d(class{static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=li.hexChars,i=li.hexOut,s,r,n,l;for(l=0;l<4;l+=1)for(r=l*8,s=e[l],n=0;n<8;n+=2)i[r+1+n]=t.charAt(s&15),s>>>=4,i[r+0+n]=t.charAt(s&15),s>>>=4;return i.join("")}static _md5cycle(e,t){let i=e[0],s=e[1],r=e[2],n=e[3];i+=(s&r|~s&n)+t[0]-680876936|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[1]-389564586|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[2]+606105819|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[3]-1044525330|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[4]-176418897|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[5]+1200080426|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[6]-1473231341|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[7]-45705983|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[8]+1770035416|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[9]-1958414417|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[10]-42063|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[11]-1990404162|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[12]+1804603682|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[13]-40341101|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[14]-1502002290|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[15]+1236535329|0,s=(s<<22|s>>>10)+r|0,i+=(s&n|r&~n)+t[1]-165796510|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[6]-1069501632|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[11]+643717713|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[0]-373897302|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[5]-701558691|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[10]+38016083|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[15]-660478335|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[4]-405537848|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[9]+568446438|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[14]-1019803690|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[3]-187363961|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[8]+1163531501|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[13]-1444681467|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[2]-51403784|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[7]+1735328473|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[12]-1926607734|0,s=(s<<20|s>>>12)+r|0,i+=(s^r^n)+t[5]-378558|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[8]-2022574463|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[11]+1839030562|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[14]-35309556|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[1]-1530992060|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[4]+1272893353|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[7]-155497632|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[10]-1094730640|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[13]+681279174|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[0]-358537222|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[3]-722521979|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[6]+76029189|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[9]-640364487|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[12]-421815835|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[15]+530742520|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[2]-995338651|0,s=(s<<23|s>>>9)+r|0,i+=(r^(s|~n))+t[0]-198630844|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[7]+1126891415|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[14]-1416354905|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[5]-57434055|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[12]+1700485571|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[3]-1894986606|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[10]-1051523|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[1]-2054922799|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[8]+1873313359|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[15]-30611744|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[6]-1560198380|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[13]+1309151649|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[4]-145523070|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[11]-1120210379|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[2]+718787259|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[9]-343485551|0,s=(s<<21|s>>>11)+r|0,e[0]=i+e[0]|0,e[1]=s+e[1]|0,e[2]=r+e[2]|0,e[3]=n+e[3]|0}_dataLength;_bufferLength;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(li.stateIdentity),this}appendStr(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n;for(n=0;n<e.length;n+=1){if(r=e.charCodeAt(n),r<128)t[s++]=r;else if(r<2048)t[s++]=(r>>>6)+192,t[s++]=r&63|128;else if(r<55296||r>56319)t[s++]=(r>>>12)+224,t[s++]=r>>>6&63|128,t[s++]=r&63|128;else{if(r=(r-55296)*1024+(e.charCodeAt(++n)-56320)+65536,r>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[s++]=(r>>>18)+240,t[s++]=r>>>12&63|128,t[s++]=r>>>6&63|128,t[s++]=r&63|128}s>=64&&(this._dataLength+=64,li._md5cycle(this._state,i),s-=64,i[0]=i[16])}return this._bufferLength=s,this}appendAsciiStr(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n=0;for(;;){for(r=Math.min(e.length-n,64-s);r--;)t[s++]=e.charCodeAt(n++);if(s<64)break;this._dataLength+=64,li._md5cycle(this._state,i),s=0}return this._bufferLength=s,this}appendByteArray(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n=0;for(;;){for(r=Math.min(e.length-n,64-s);r--;)t[s++]=e[n++];if(s<64)break;this._dataLength+=64,li._md5cycle(this._state,i),s=0}return this._bufferLength=s,this}getState(){let e=this,t=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[t[0],t[1],t[2],t[3]]}}setState(e){let t=e.buffer,i=e.state,s=this._state,r;for(this._dataLength=e.length,this._bufferLength=e.buflen,s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],r=0;r<t.length;r+=1)this._buffer8[r]=t.charCodeAt(r)}end(e=!1){let t=this._bufferLength,i=this._buffer8,s=this._buffer32,r=(t>>2)+1,n;if(this._dataLength+=t,i[t]=128,i[t+1]=i[t+2]=i[t+3]=0,s.set(li.buffer32Identity.subarray(r),r),t>55&&(li._md5cycle(this._state,s),s.set(li.buffer32Identity)),n=this._dataLength*8,n<=4294967295)s[14]=n;else{let l=n.toString(16).match(/(.*?)(.{0,8})$/);if(l===null)return;let o=parseInt(l[2],16),a=parseInt(l[1],16)||0;s[14]=o,s[15]=a}return li._md5cycle(this._state,s),e?this._state:li._hex(this._state)}},"_Md52"),pl=li;f(pl,"Md5");fe(pl,"stateIdentity",new Int32Array([1732584193,-271733879,-1732584194,271733878]));fe(pl,"buffer32Identity",new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]));fe(pl,"hexChars","0123456789abcdef");fe(pl,"hexOut",[]);fe(pl,"onePassHasher",new li);var Ol=d(class extends Km{m_label;constructor(e){let t=e.icon??"var( --x4-icon-exclamation )";e.icon=void 0;let i=e.buttons===void 0?["ok"]:e.buttons;e.buttons=void 0,super(e);let s=e.message;this.form.updateContent(new me({style:{padding:8},content:[t?new rt({cls:"icon",icon:t}):null,this.m_label=new Ge({cls:"text",text:s,multiline:!0})]}),i),this.on("btnClick",r=>{this.m_props.click&&Us(()=>{this.m_props.click(r.button)})})}set text(e){this.m_label.text=e}static show(e){let t;return Fe(e)||Qi(e)?t=new Ol({message:e,click:()=>{}}):t=new Ol(e),t.show(),t}static async showAsync(e){return new Promise((t,i)=>{let s,r=f(l=>{t(l)},"cb");Fe(e)||Qi(e)?s={message:e,click:r}:s={...e,click:r},new Ol(s).show()})}static alert(e,t=null){new Ol({cls:"warning",title:t,message:e,buttons:["ok"],click:()=>{}}).show()}},"MessageBox2");f(Ol,"MessageBox");var Nu=d(class extends Km{m_edit;constructor(e){e.buttons=void 0,e.width=e.width??500,super(e),this.form.updateContent(new me({cls:"panel",content:[this.m_edit=new Ei({flex:1,autoFocus:!0,label:e.message,value:e.value})]}),["ok","cancel"]),e.click&&this.on("btnClick",t=>{t.button==="ok"&&Us(()=>{this.m_props.click(this.m_edit.value)})})}set text(e){this.m_edit.label=e}static show(e,t){let i;return Fe(e)||Qi(e)?i=new Nu({message:e,click:t}):i=new Nu(e),i.show(),i}},"PromptDialogBox2");f(Nu,"PromptDialogBox");var _x=d(class extends St{m_ui_title;m_ui_body;constructor(e){super(e);let t=e?.sens=="horizontal"?"@hlayout":"@vlayout";this.m_ui_title=new Ge({cls:"title",text:this.m_props.title}),this.m_ui_body=new T({cls:"body "+t,content:this.m_props.content,style:e.bodyStyle})}render(){let e=this.m_props.gadgets??[],t=this.m_props.icon?new rt({icon:this.m_props.icon}):null;super.setContent([new me({cls:"title",content:[t,this.m_ui_title,...e]}),this.m_ui_body])}setContent(e){this.m_ui_body.setContent(e)}set title(e){this.m_ui_title.text=e}},"Panel2");f(_x,"Panel");var b_=d(class{text;cls},"CellData2");f(b_,"CellData");fe(b_,"empty_cell",{text:""});var jg=d(class extends St{m_columns;m_row_limit;m_cells_data;m_rows_data;m_view;m_container;m_header;m_itemHeight;m_topIndex;m_visible_cells;m_row_count;m_selection;m_editor;m_autoedit;m_lockupdate;m_auto_row_count;m_recycler;m_used_cells;constructor(e){super(e),this.m_columns=e.columns,this.m_autoedit=e.autoedit,this.m_lockupdate=0,this.m_cells_data=new Map,this.m_rows_data=new Map,this.m_itemHeight=0,this.m_selection={row:0,col:0},this.m_row_count=0,this.m_auto_row_count=!1,this.m_recycler=[],this.m_used_cells=[],e.maxrows===void 0?(this.m_row_limit=0,this.m_auto_row_count=!0):e.maxrows<0?(this.m_row_limit=0,this.m_auto_row_count=!0):this.m_row_limit=e.maxrows,this.setAttribute("tabindex",0),this.setDomEvent("click",t=>this._itemClick(t)),this.setDomEvent("dblclick",t=>this._itemDblClick(t)),this.setDomEvent("keydown",t=>this._handleKey(t)),this.setDomEvent("keypress",t=>this._keyPress(t)),this.setDomEvent("focus",()=>this._focus(!0)),this.setDomEvent("focusout",()=>this._focus(!1)),this.setDomEvent("contextmenu",t=>this._ctxMenu(t)),this.mapPropEvents(e,"dblClick","selectionChange","contextMenu","change")}componentCreated(){super.componentCreated(),this._updateScroll(!0)}setColWidth(e,t){this._on_col_resize(e,t),this.update(10)}getColWidth(e){if(this.m_columns[e])return this.m_columns[e].width}setColTitle(e,t){console.assert(this.m_columns[e]!==void 0),this.m_columns[e].title=t,this.update(10)}reset(e){e&&(this.m_columns=e),this.m_cells_data=new Map,this.m_rows_data=new Map,this.update(10)}insertRow(e){let t=new Map;this.m_cells_data.forEach((s,r)=>{let{row:n,col:l}=Fr(r);n>=e?t.set(hi(n+1,l),s):t.set(r,s)});let i=new Map;this.m_rows_data.forEach((s,r)=>{r>=e?i.set(r+1,s):i.set(r,s)}),this.m_cells_data=t,this.m_rows_data=i,this._buildItems()}deleteRow(e){let t=new Map,i=new Map;this.m_cells_data.forEach((s,r)=>{let{row:n,col:l}=Fr(r);n>e?t.set(hi(n-1,l),s):n<e&&t.set(r,s)}),this.m_rows_data.forEach((s,r)=>{r>e?i.set(r-1,s):r<e&&i.set(r,s)}),this.m_cells_data=t,this.m_rows_data=i,this._buildItems()}insertCol(e,t){let i=e;if(i<0&&(i=this.m_columns.length+1),this.m_columns.splice(i,0,t),e>=0){let s=new Map;this.m_cells_data.forEach((r,n)=>{let{row:l,col:o}=Fr(n);o>=e?s.set(hi(l,o+1),r):s.set(n,r)}),this.m_cells_data=s}this.update()}deleteCol(e){this.m_columns.splice(e,1);let t=new Map;this.m_cells_data.forEach((i,s)=>{let{row:r,col:n}=Fr(s);n>e?t.set(hi(r,n-1),i):n<e&&t.set(s,i)}),this.m_cells_data=t,this.update()}_getCellData(e,t,i=!1){let s=this.m_cells_data.get(hi(e,t));return s===void 0?i?null:b_.empty_cell:s}_focus(e){this.setClass("@focus",e)}_ctxMenu(e){let t=e.target,i=this.dom;for(;t&&t!=i;){let s=T.getElement(t),r=s.getData("row-id"),n=s.getData("col-id");if(r!==void 0){this._selectItem(r,n),this.emit("contextMenu",Ns(e,{row:r,col:n,item:s})),e.preventDefault();return}t=t.parentElement}}render(){this.m_recycler=[],this.m_container=new T({cls:"content"}),this.m_view=new T({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let e=this.m_columns.map((t,i)=>{let s=new T({cls:"@cell c"+i,content:t.title?t.title:" ",flex:t.width<0?-t.width:void 0,attrs:{title:t.title},style:{width:t.width>=0?t.width:void 0,minWidth:t.min_width}});return new Jh({target:s,sens:"right",resize:r=>{this._on_col_resize(i,r.size.width)}}),t.$col=s,s});this.m_header=new me({cls:"@header",content:e}),this.setContent([this.m_header,this.m_view])}_on_col_resize(e,t){this.m_columns[e]&&(t<=0?this.m_columns[e].width=-1:this.m_columns[e].width=t,this._updateScroll(!0))}_computeItemHeight(){let e=H.createElement("div");e.classList.add("x-spreadsheet");let t=H.createElement("div");t.classList.add("content");let i=H.createElement("div");i.classList.add("x-cell"),i.append(" "),t.appendChild(i),e.appendChild(t),this.dom.appendChild(e);let s=i.getBoundingClientRect();this.dom.removeChild(e),this.m_itemHeight=s.height}_calcColWidths(e){let t=0,i=0,s=new Int32Array(this.m_columns.length),r=new Int32Array(this.m_columns.length),n=new Int32Array(this.m_columns.length);if(this.m_columns.forEach((l,o)=>{let a=Math.max(10,l.min_width??0);if(l.width>0){let c=Math.max(l.width,a);t+=c,s[o]=c}else{let c=-l.width;r[o]=c,i+=c}n[o]=a}),i){let l=e-t;for(let o=0;o<this.m_columns.length&&i;o++)if(!s[o]){let a=Math.round(l/i)*r[o];a<n[o]&&(a=n[o]),s[o]=a,l-=a,i-=r[o]}}return s}_createCell(){let e;return this.m_recycler.length?(e=this.m_recycler.pop(),e.clearClasses(),e.addClass("@comp")):e=new T({cls:"@cell"}),e.dom||this.m_container.appendChild(e),e}_buildItems(){let e=this.getBoundingRect(),t=this.m_header.getBoundingRect(),i=e.height-t.height;this.m_itemHeight==0&&this._computeItemHeight();let s=this.m_topIndex*this.m_itemHeight,r=0,n=0,l=this.m_topIndex,o=this.m_row_limit;this.m_auto_row_count&&(this.m_row_limit=o=this.getMaxRowCount());let a=0;if(o*this.m_itemHeight>i){let v=T.getScrollbarSize();e.width-=v,a=v}let c=!!(this.m_topIndex&1);this.m_visible_cells=new Map,this.m_used_cells.forEach(v=>{this.m_recycler.push(v)}),this.m_used_cells=[];let u=this._calcColWidths(e.width),_=0;for(let v=0;v<u.length;v++)_+=u[v];_<=e.width?(this.m_view.setStyleValue("overflow-x","hidden"),this.m_header.setStyleValue("width",e.width),this.m_container.setStyleValue("width",e.width),this.m_container.setStyle({height:o*this.m_itemHeight})):(this.m_header.setStyleValue("width",_),this.m_container.setStyleValue("width",_),this.m_view.setStyleValue("overflow-x","visible"),this.m_container.setStyle({height:o*this.m_itemHeight,width:_})),this.m_view.addClass("@hidden");let p=100;for(;r<i&&l<o&&--p>0;){let v=this.m_rows_data.get(l),g=0,x=this.m_columns.map((E,y)=>{let k="@cell c"+y;E.align&&(k+=" "+E.align),E.cls&&(k+=" "+E.cls);let A,S=this._getCellData(l,y),w=S.text;return E.renderer&&w.length&&(w=E.renderer(w,{row:l,col:y})),k+=c?" even":" odd",v&&(k+=" "+v),A=this._createCell(),this.m_used_cells.push(A),A.setContent(w),A.addClass(k),A.setStyle({left:g,top:s+r,width:u[y],height:this.m_itemHeight}),this.m_selection.row==l&&this.m_selection.col==y&&A.addClass("@selected"),A.setData("row-id",l),A.setData("col-id",y),S.cls&&A.addClass(S.cls),this.m_visible_cells.set(hi(l,y),A),g+=u[y],A});c=!c,r+=this.m_itemHeight,l++,n++}this.m_recycler.forEach(v=>{v.addClass("@hidden")}),this.m_row_count=n,this.m_view.removeClass("@hidden"),this.setClass("empty",o==0)}_itemClick(e){let t=e.target;if(this.m_editor&&this.m_editor.dom.contains(t))return;let i=T.getElement(t,T);if(!i)return;let s=i.getData("row-id"),r=i.getData("col-id");s===void 0||r===void 0||this._selectItem(s,r)}_itemDblClick(e){let t=e.target;if(this.m_editor&&this.m_editor.dom.contains(t))return;let i=T.getElement(t),s=i.getData("row-id"),r=i.getData("col-id");s===void 0||r===void 0||(this.emit("dblClick",Jr({row:s,col:r})),this.editCell(s,r))}_selectItem(e,t,i){e<0&&(e=0),e>this.m_row_limit-1&&(e=this.m_row_limit-1),t<0&&(t=0);let s=this.m_columns.length-1;t>s&&(t=s),!(this.m_selection.row==e&&this.m_selection.col==t)&&this.select(e,t,i)}_scrollIntoView(e,t){let i=f((r,n="nearest")=>{r.scrollIntoView({block:n})},"doscroll"),s=this.m_topIndex+this.m_row_count-1;e<this.m_topIndex?(this.m_topIndex=e,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),i(this._findItem(e,t),"start")):e>s?(this.m_topIndex=e-this.m_row_count+1,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),i(this._findItem(e,t),"end")):i(this._findItem(e,t))}_findItem(e,t){return this.m_visible_cells?this.m_visible_cells.get(hi(e,t)):null}_updateScroll(e){if(!this?.m_view?.dom)return;let t=Math.floor(this.m_view.dom.scrollTop/(this.m_itemHeight||1));(t!=this.m_topIndex||e)&&(this.m_topIndex=t,this._buildItems());let i=this.m_view.dom.scrollLeft;this.m_header.setStyleValue("left",-i)}_moveSel(e,t){let i=this.m_selection,s=i.row??0,r=i.col??0;if(e==1?s++:e==-1?s--:e==2?s+=this.m_row_count-1:e==-2?s-=this.m_row_count-1:e==3?s=this.m_row_limit-1:e==-3&&(s=0),t==1)r++;else if(t==-1)r--;else if(t==2)r=this.m_columns.length-1;else if(t==-2)r=0;else if(t==3){r++;let n=this.m_columns.length-1;e:for(let l=0;l<2;l++){for(;r<n;){if(this.m_columns[r].createEditor!==null)break e;r++}r>n&&(s++,r=0)}}else if(t==-3){r--;let n=this.m_columns.length-1;e:for(let l=0;l<2;l++){for(;r>=0;){if(this.m_columns[r].createEditor!==null)break e;r--}r<0&&(s--,r=n)}}this._selectItem(s,r,!0)}_handleKey(e){let t=e.target;if(!(this.m_editor&&this.m_editor.dom.contains(t)))switch(e.key){case"ArrowDown":case"Down":{this._moveSel(1,0);break}case"ArrowUp":case"Up":{this._moveSel(-1,0);break}case"PageUp":{this._moveSel(-2,0);break}case"PageDown":{this._moveSel(2,0);break}case"ArrowLeft":case"Left":{this._moveSel(0,-1);break}case"ArrowRight":case"Right":{this._moveSel(0,1);break}case"Home":{e.ctrlKey?this._moveSel(-3,0):this._moveSel(0,-2);break}case"End":{e.ctrlKey?this._moveSel(3,0):this._moveSel(0,2);break}case"Enter":{this.editCurCell(),e.stopPropagation(),e.preventDefault();break}case"Delete":{this.clearCell(this.m_selection.row,this.m_selection.col);break}default:break}}_keyPress(e){let t=e.target;this.m_editor&&this.m_editor.dom.contains(t)||e.ctrlKey||e.altKey||this.editCurCell(e.key)}getSelection(){return this.m_selection}select(e,t,i=!0){if(this.m_selection.row==e&&this.m_selection.col==t)return;let s=this._findItem(this.m_selection.row,this.m_selection.col);s&&s.removeClass("@selected"),this.m_selection={row:e,col:t},i&&this._scrollIntoView(e,t);let r=this._findItem(e,t);r&&r.addClass("@selected"),this.emit("selectionChange",bi({row:e,col:t}))}rowCount(){return this.m_row_limit}getMaxRowCount(){let e=0;return this.m_cells_data.forEach((t,i)=>{let s=Math.round(i/1e3)+1;e<s&&(e=s)}),e}getColCount(){return this.m_columns.length}setRowStyle(e,t){this.m_rows_data.set(e,t),this.m_lockupdate==0&&this._buildItems()}getRowStyle(e){return this.m_rows_data.get(e)}setCellStyle(e,t,i){let s=this._getCellData(e,t,!0);if(s||(s={text:""},this.m_cells_data.set(hi(e,t),s)),s.cls=i,this.m_lockupdate==0&&this.m_visible_cells){let r=this._findItem(e,t);r?r.setClass(i,!0):this._buildItems()}}getCellText(e,t){return this._getCellData(e,t).text}getCellNumber(e,t){let i=this._getCellData(e,t).text;return qh(i)}clearRow(e){for(let t=0;t<this.m_columns.length;t++)this.clearCell(e,t);this.update(10)}clearCell(e,t){this.setCellText(e,t,null)}editCurCell(e){this.editCell(this.m_selection.row,this.m_selection.col,e)}editCell(e,t,i){if(!this.m_autoedit||this.m_columns[t].createEditor===null)return;this._scrollIntoView(e,t);let r=this._findItem(e,t).dom,n=r.parentElement,l=r.getBoundingClientRect(),o=n.getBoundingClientRect(),a=this._getCellData(e,t,!0),c=f((_,p,v)=>new Ei(_),"edtBuilder");this.m_columns[t].createEditor&&(c=this.m_columns[t].createEditor);let u=i||(a?a.text:"");this.m_editor=c({cls:"@editor",style:{left:l.left-o.left,top:l.top-o.top,width:l.width-1,height:l.height-1},tabIndex:!1,value:u,data:{row:e,col:t}},e,t),this.m_editor&&(n.appendChild(this.m_editor._build()),this._setupEditor(),this.m_editor.setData("old-value",u),this.m_editor.focus(),this.m_editor instanceof Ei&&this.m_editor.selectAll())}_setupEditor(){let e=f((t,i)=>{Xh(()=>{this.killEditor(!0),this._moveSel(t,i),this.editCurCell()})},"movesel");if(this.m_editor instanceof Ei){let i=this.m_editor.input;i.setDomEvent("blur",()=>{this.killEditor(!0)}),i.setDomEvent("keydown",s=>{if(!s.defaultPrevented)switch(s.key){case"Escape":{this.killEditor(!1),s.stopPropagation(),s.preventDefault();break}case"Enter":case"Tab":{let r=3;s.shiftKey&&(r=-3),e(0,r),s.stopPropagation(),s.preventDefault();break}case"ArrowUp":case"Up":{e(-1,0),s.stopPropagation(),s.preventDefault();break}case"ArrowDown":case"Down":{e(1,0),s.stopPropagation(),s.preventDefault();break}}})}else if(this.m_editor instanceof ju){let t=this.m_editor.input;t.setDomEvent("blur",()=>{this.killEditor(!0)}),t.setDomEvent("keydown",i=>{switch(i.key){case"Escape":{this.killEditor(!1),i.stopPropagation(),i.preventDefault();break}case"Enter":case"Tab":{let s=3;i.shiftKey&&(s=-3),e(0,s),i.stopPropagation(),i.preventDefault();break}}}),this.m_editor.showPopup(),this.m_editor.on("change",i=>{this.killEditor(!0)}),this.m_editor.on("cancel",i=>{this.killEditor(!1)})}}killEditor(e){if(this.m_editor){if(e){let i,s;this.m_editor instanceof Ei?i=this.m_editor.value:this.m_editor instanceof ju&&(s=this.m_editor.value,i=this.m_editor.valueText);let r=this.m_editor.getData("row"),n=this.m_editor.getData("col"),l=this.m_editor.getData("old-value");this.setCellText(r,n,i);let o=$e(i,{row:r,col:n,oldValue:l,id:s});this.emit("change",o),o.defaultPrevented&&this.setCellText(r,n,l)}let t=this.m_editor;Us(()=>{t.dispose()}),this.m_editor=null,this.focus()}}clearData(){this.m_cells_data=new Map,this.m_rows_data=new Map}setCellText(e,t,i){if(i==null||i.length==0)this.m_cells_data.delete(hi(e,t)),i="";else{let s=this._getCellData(e,t,!0);s||(s={}),s.text=i,this.m_cells_data.set(hi(e,t),s)}if(this.m_lockupdate==0&&this.m_visible_cells){let s=this._findItem(e,t);s?(this.m_columns[t].renderer&&(i=this.m_columns[t].renderer(i,{row:e,col:t})),s.setContent(i)):this._buildItems()}}lockUpdate(e){e?this.m_lockupdate++:--this.m_lockupdate==0&&this._updateScroll(!0)}},"Spreadsheet2");f(jg,"Spreadsheet");function hi(e,t){return e*1e3+t}h(hi,"_mkid4");m(hi,"_mkid4");d(hi,"_mkid4");f(hi,"_mkid");function Fr(e){return{row:Math.floor(e/1e3)|0,col:e%1e3|0}}h(Fr,"_getid2");m(Fr,"_getid2");d(Fr,"_getid2");f(Fr,"_getid");var fx=d(class extends T{m_fields;m_record;m_sheet;m_label_w;constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){this.m_record=e.record,this.m_fields=e.fields??[],this.m_label_w=e.labelWidth,this.m_sheet=new jg({cls:"@fit",columns:[{title:oe.global.property,width:this.m_label_w>0?this.m_label_w:-1,cls:"property"},{title:oe.global.value,width:-1,createEditor:(...t)=>this._editCell(...t),renderer:(...t)=>this._renderCell(...t)}],autoedit:!0,change:t=>this._cellChange(t)}),this._updateProperties(),this.setContent(this.m_sheet)}setFields(e){e?(this.m_fields=e,this._updateProperties()):this.m_sheet.clearData()}setRecord(e){this.m_record=e,this._updateProperties()}_updateProperties(){this.m_sheet.lockUpdate(!0),this.m_sheet.clearData(),this.m_fields.forEach((e,t)=>{this.m_sheet.setCellText(t,0,e.title),this.m_record?this.m_sheet.setCellText(t,1,this.m_record.getField(e.id)):this.m_sheet.setCellText(t,1,e.value)}),this.m_sheet.lockUpdate(!1)}_cellChange(e){let t=e.context,i=e.value;if(t.col!=1)return;let s=this.m_fields[t.row];switch(s.type){default:case"string":break;case"number":break;case"password":break;case"boolean":break;case"choice":break}this.m_record?this.m_record.setField(s.id,i):s.value=i,this.emit("change",$e(i,s))}_renderCell(e,t){switch(this.m_fields[t.row].type){default:case"string":break;case"number":break;case"password":{e="\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF";break}case"boolean":break;case"choice":break}return e}_editCell(e,t,i){let s=this.m_fields[t],r;switch(s.type){default:case"string":{r=new Ei(e);break}case"number":{r=new Ei(e);break}case"password":{e.type="password",e.value=this.m_record.getField(s.id),r=new ts(e);break}case"boolean":{r=new wh(e);break}case"choice":break}return r}_choicesFromArray(e){return e.map(i=>typeof i=="object"?{id:i.id,text:i.value}:{id:i,text:""+i})}_choicesFromStore(e,t){let i=[];for(let s=0,r=e.count;s<r;s++){let n=e.getByIndex(s);i.push({id:n.getID(),text:n.getField(t)})}return i}},"PropertyEditor2");f(fx,"PropertyEditor");var Gg=d(class extends T{m_ui_input;constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){let t=e.text??"",i=e.name??e.group,s=e.labelWidth??-1,r=e.checked??!1,n=e.align??"left",l=e.value,o=e.icon;this.setTag("label"),this.addClass("@hlayout"),this.addClass(n),this._setTabIndex(e.tabIndex),r&&this.addClass("checked"),this.setContent([this.m_ui_input=new ts({type:"radio",name:i,tabIndex:e.tabIndex,value:l,attrs:{checked:r?"":void 0},dom_events:{change:()=>this._change(),focus:()=>this.m_ui_input.focus()}}),new Ge({ref:"label",icon:o,text:t,width:s==="flex"?void 0:s,flex:s==="flex"?1:void 0,style:{order:n=="right"?-1:void 0}})])}_change(){let t=".x-input[name="+this.m_props.name+"]";H.querySelectorAll(t).forEach(r=>{T.getElement(r,Gg).removeClass("checked")});let s=this.m_ui_input.dom;this.setClass("checked",s.checked),this.emit("change",$e(!0))}get check(){return this.m_ui_input?this.m_ui_input.dom.checked:this.m_props.checked}set check(e){let t=this.m_ui_input.dom;e?(t&&(t.checked=!0),this.m_props.checked=!0):(t&&(t.checked=!1),this.m_props.checked=!1)}get text(){return this.itemWithRef("label").text}set text(e){this.itemWithRef("label").text=e}},"RadioBtn2");f(Gg,"RadioBtn");var px=d(class extends me{m_els;m_input;constructor(e){super(e),e.steps=e.steps??5}render(e){let t=e.shape??"star",i=e.value??0;this.m_input=new ts({cls:"@hidden",name:e.name,value:""+i}),this.addClass(t),this.setDomEvent("click",s=>this._onclick(s)),this.m_els=[];for(let s=0;s<e.steps;s++){let r="item";s+1<=i&&(r+=" checked");let n=new T({tag:"option",cls:r,data:{value:s+1}});this.m_els.push(n)}this.m_els.push(this.m_input),this.setContent(this.m_els)}getValue(){return this.m_props.value??0}set value(e){this.m_props.value=e;for(let t=0;t<this.m_props.steps;t++)this.m_els[t].setClass("checked",this.m_els[t].getData("value")<=e);this.m_input.value=""+this.m_props.value}set steps(e){this.m_props.steps=e,this.update()}set shape(e){this.removeClass(this.m_props.shape),this.m_props.shape=e,this.addClass(this.m_props.shape)}_onclick(e){let t=!0;for(let i=this.dom.firstChild;i;i=i.nextSibling){let s=T.getElement(i);s.setClass("checked",t),i==e.target&&(this.m_input.value=s.getData("value"),t=!1)}this.emit("change",$e(this.m_props.value))}},"Rating2");f(px,"Rating");function tc(e,t=!1){if(e instanceof RegExp)return{keys:null,pattern:e};let i=e.split("/"),s=[],r="";i[0]==""&&i.shift();for(let n of i){let l=n[0];if(l==="*")s.push("wild"),r+="/(.*)";else if(l===":"){let o=n.indexOf("?",1),a=n.indexOf(".",1);s.push(n.substring(1,o>=0?o:a>=0?a:n.length)),r+=o>=0&&a<0?"(?:/([^/]+?))?":"/([^/]+?)",a>=0&&(r+=(o>=0?"?":"")+"\\"+n.substring(a))}else r+="/"+n}return{keys:s,pattern:new RegExp(`^${r}${t?"(?=$|/)":"/?$"}`,"i")}}h(tc,"parseRoute2");m(tc,"parseRoute2");d(tc,"parseRoute2");f(tc,"parseRoute");var Ng=d(class extends bo{m_routes;m_useHash;constructor(e=!0){super(),this.m_routes=[],this.m_useHash=e,window.addEventListener("popstate",t=>{let i=this._getLocation(),s=this._find(i);s.handlers.forEach(r=>{r(s.params,i)})})}get(e,t){let{keys:i,pattern:s}=tc(e);this.m_routes.push({keys:i,pattern:s,handler:t})}init(){this.navigate(this._getLocation())}_getLocation(){return this.m_useHash?"/"+H.location.hash.substring(1):H.location.pathname}navigate(e,t=!0){let i=this._find(e);if(!i||i.handlers.length==0){console.log("route not found: "+e),this.signal("error",Nh(404,"route not found"));return}if(this.m_useHash){for(;e.startsWith("/");)e=e.substring(1);window.history.pushState({},"","#"+e)}else window.history.pushState({},"",e);t&&i.handlers.forEach(s=>{s(i.params,e)})}_find(e){let t=[],i={},s=[];for(let r of this.m_routes)if(r.keys)if(r.keys.length>0){if(t=r.pattern.exec(e),t===null)continue;for(let n=0;n<r.keys.length;)i[r.keys[n]]=t[++n];s=[...s,r.handler]}else r.pattern.test(e)&&(s=[...s,r.handler]);else{if(t=r.pattern.exec(e),!t)continue;if(t.groups)for(let n in t.groups)i[n]=t.groups[n];s=[...s,r.handler]}return{params:i,handlers:s}}},"Router2");f(Ng,"Router");var gx=d(class extends o_{m_sidebar;m_content;constructor(e){super(e),this.addClass("@hlayout"),this.m_sidebar=new St({cls:"@side-bar",width:e.bar_width??void 0}),this.m_content=new me({flex:1,cls:"@tab-container"})}render(){let e=[];this.m_cards.forEach(t=>{e.push(t.selector)}),this.m_sidebar.setContent(new St({flex:1,cls:"content",content:e})),this.setContent([this.m_sidebar,this.m_props.bar_sizable?new Jp({orientation:"horizontal",sizing:"before"}):void 0,this.m_content])}_prepareSelector(e){return new bt({text:e.title,icon:e.icon,tooltip:e.title,click:()=>{this.switchTo(e.name)}})}_preparePage(e){super._preparePage(e),e.dom||this.m_content.appendChild(e)}},"SideBarView2");f(gx,"SideBarView");var vx=/^-?\d+(\.\d+)?$/;function ic(e){return e*Math.PI/180}h(ic,"d2r2");m(ic,"d2r2");d(ic,"d2r2");f(ic,"d2r");function co(e,t,i,s){let r=ic(s);return{x:e+i*Math.cos(r),y:t+i*Math.sin(r)}}h(co,"p2c2");m(co,"p2c2");d(co,"p2c2");f(co,"p2c");function tt(e){return Math.round(e*1e3)/1e3}h(tt,"num2");m(tt,"num2");d(tt,"num2");f(tt,"num");function Sn(e,...t){return t=t.map(i=>typeof i=="number"&&isFinite(i)?tt(i):i),String.raw(e,...t)}h(Sn,"clean2");m(Sn,"clean2");d(Sn,"clean2");f(Sn,"clean");var gl=d(class{m_tag;m_attrs;m_style;constructor(e){this.m_tag=e,this.m_attrs=new Map,this.m_style=new Map}render(){return`<${this.m_tag} ${this.renderAttrs()} ${this.renderStyle()}>${this.renderContent()}</${this.m_tag}>`}stroke(e,t){return this.attr("stroke",e),t!==void 0&&this.attr("stroke-width",t+"px"),this}strokeWidth(e){return this.attr("stroke-width",e+"px"),this}fill(e){return this.attr("fill",e),this}attr(e,t){return this.m_attrs.set(e,t),this}style(e,t){if(t===void 0||t===""||t===void 0){this.m_style.delete(e);return}return!Zp[e]&&(zn(t)||vx.test(t))&&(t=t+"px"),this.m_style.set(e,""+t),this}class(e){let t=this.m_attrs.get("class");return this.m_attrs.set("class",(t??" "+e).trim()),this}renderAttrs(){if(!this.m_attrs.size)return"";let e="";return this.m_attrs.forEach((t,i)=>{e+=` ${i} = "${t}"`}),e}renderStyle(){if(!this.m_style.size)return"";let e='style="';return this.m_style.forEach((t,i)=>{e+=`${i}:${t};`}),e+'"'}renderContent(){return""}clip(e){return this.attr("clip-path",`url(#${e})`),this}transform(e){this.attr("transform",e)}rotate(e,t,i){this.transform(`rotate( ${e} ${t} ${i} )`)}translate(e,t){this.transform(`translate( ${e} ${t} )`)}scale(e){this.transform(`scale( ${e} )`)}},"SVGItem2");f(gl,"SVGItem");var Ug=d(class extends gl{m_path;constructor(){super("path"),this.m_path=""}renderAttrs(){return this.attr("d",this.m_path),super.renderAttrs()}moveTo(e,t){return this.m_path+=Sn`M${e},${t}`,this}lineTo(e,t){return this.m_path+=Sn`L${e},${t}`,this}closePath(){return this.m_path+="Z",this}arc(e,t,i,s,r){let n=co(e,t,i,s-90),l=co(e,t,i,r-90),o=r-s<=180?"0":"1";return this.m_path+=Sn`M${n.x},${n.y}A${i},${i} 0 ${o} 1 ${l.x},${l.y}`,this}},"SVGPath2");f(Ug,"SVGPath");var $g=d(class extends gl{m_text;constructor(e,t,i){super("text"),this.m_text=i,this.attr("x",tt(e)+""),this.attr("y",tt(t)+"")}font(e){return this.attr("font-family",e),this}fontSize(e){return this.attr("font-size",e+""),this}fontWeight(e){return this.attr("font-weight",e),this}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.attr("text-anchor",t),this}verticalAlign(e){let t;switch(e){case"top":t="hanging";break;case"center":t="middle";break;case"bottom":t="baseline";break;default:return}return this.attr("alignment-baseline",t),this}renderContent(){return this.m_text}},"SVGText2");f($g,"SVGText");var Uu=d(class extends gl{constructor(e){super(e)}},"SVGShape2");f(Uu,"SVGShape");var $u=d(class extends gl{m_id;m_stops;constructor(e,t,i,s){super("linearGradient"),this.m_id="gx-"+$u.g_id,this.attr("id",this.m_id),this.attr("x1",Fe(e)?e:tt(e)+""),this.attr("x2",Fe(i)?i:tt(i)+""),this.attr("y1",Fe(t)?t:tt(t)+""),this.attr("y2",Fe(s)?s:tt(s)+""),this.m_stops=[],$u.g_id++}get id(){return"url(#"+this.m_id+")"}addStop(e,t){return this.m_stops.push({offset:e,color:t}),this}renderContent(){let e=[];return this.m_stops.forEach(t=>{e.push(`<stop offset="${t.offset}%" stop-color="${t.color}"></stop>`)}),e.join(`
|
|
21
|
+
`)}},"_SVGGradient2"),x_=$u;f(x_,"SVGGradient");fe(x_,"g_id",1);var qu=d(class extends gl{m_items;constructor(e="g"){super(e),this.m_items=[]}path(){let e=new Ug;return this.m_items.push(e),e}text(e,t,i){let s=new $g(e,t,i);return this.m_items.push(s),s}ellipse(e,t,i,s=i){let r=new Uu("ellipse");return r.attr("cx",tt(e)+""),r.attr("cy",tt(t)+""),r.attr("rx",tt(i)+""),r.attr("ry",tt(s)+""),this.m_items.push(r),r}rect(e,t,i,s){let r=new Uu("rect");return r.attr("x",tt(e)+""),r.attr("y",tt(t)+""),r.attr("width",tt(i)+""),r.attr("height",tt(s)+""),this.m_items.push(r),r}linear_gradient(e,t,i,s){let r=new x_(e,t,i,s);return this.m_items.push(r),r}clear(){this.m_items=[]}renderContent(){let e=[];return this.m_items.forEach(t=>{e.push(t.render())}),e.join(`
|
|
22
|
+
`)}},"SVGGroup2");f(qu,"SVGGroup");var qg=d(class extends qu{constructor(){super("")}addClip(e,t,i,s){let r="c-"+qg.g_clip_id++,n=new qu("clipPath");return n.attr("id",r),n.rect(e,t,i,s),this.m_items.push(n),r}render(){let e=[];return this.m_items.forEach(t=>{e.push(t.render())}),e.join(`
|
|
23
|
+
`)}},"_SVGPathBuilder2"),Kg=qg;f(Kg,"SVGPathBuilder");fe(Kg,"g_clip_id",1);var wx=d(class extends T{constructor(e){super(e),this.setTag("svg","http://www.w3.org/2000/svg"),this.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.setAttributes({viewBox:e.viewBox}),this.setContent(e.path)}},"SVGComponent2");f(wx,"SVGComponent");var bx=d(class extends Rt{m_pages;m_curPage;constructor(e){super(e),this.m_pages=[],this.m_curPage=null,this.mapPropEvents(e,"change"),e.vertical?this.addClass("@vlayout"):this.addClass("@hlayout"),this.m_props.pages?.forEach(t=>this.addPage(t))}componentCreated(){this.m_props.default&&this.select(this.m_props.default,!0)}addPage(e){this.m_pages.push({...e}),this._updateContent()}render(){let e=[];this.m_pages.forEach(t=>{t.btn=new bt({cls:t===this.m_curPage?"selected":"",text:t.title,icon:t.icon,click:()=>this._select(t,!0)}),e.push(t.btn)}),this.setContent(e)}select(e,t=!1){if(e){let i=this.m_pages.find(s=>s.id===e);return i?(this._select(i,t),!0):!1}else return this._select(null,t),!0}_select(e,t){if(this.m_curPage!=e){if(!this.dom){this.m_props.default=e.id;return}this.m_curPage&&(this.m_curPage.btn.removeClass("selected"),this.m_curPage.page&&this.m_curPage.page.hide()),this.m_curPage=e,t&&this.signal("change",$e(e?e.id:null)),this.m_curPage&&(this.m_curPage.btn.addClass("selected"),this.m_curPage.page&&this.m_curPage.page.show())}}get selection(){return this.m_curPage?.page}},"TabBar2");f(bx,"TabBar");var xx=d(class extends o_{m_tab_selector;m_menu;constructor(e){super(e),this.m_tab_selector=!!e.tab_selector,this.m_menu=e.menu,this.addClass("@vlayout")}render(){let e=[],t=[];this.m_menu&&(this.m_menu.addClass("@button @tab-btn"),this.m_menu.removeClass("@menu-item"),e.push(this.m_menu)),this.m_cards.forEach(i=>{e.push(i.selector),i.page instanceof Function||t.push(i.page)}),this.m_tab_selector&&t.unshift(new me({cls:"@tab-switch",content:e})),this.setContent(t)}_updateSelector(){}_prepareSelector(e){return new bt({cls:"@tab-btn",text:e.title,icon:e.icon,click:()=>{this.switchTo(e.name)}})}_preparePage(e){super._preparePage(e),e.dom||this.appendChild(e)}},"TabView2");f(xx,"TabView");var Cx=d(class extends T{constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){e.text=e.text??"",this.setAttribute("tabindex",e.tabIndex??0),e.spellcheck===!1&&this.setAttribute("spellcheck","false"),e.readOnly!==void 0&&this.setAttribute("readonly",e.readOnly),e.rows&&this.setAttribute("rows",e.rows),e.placeHolder&&this.setAttribute("placeholder",e.placeHolder),e.autoFocus&&this.setAttribute("autofocus",e.autoFocus),e.name&&this.setAttribute("name",e.name),e.autoGrow&&(this.m_props.autoGrow=!0,this.setAttribute("rows",this._calcHeight(e.text)),this.setDomEvent("keydown",()=>{Us(()=>this._updateHeight())})),this.setDomEvent("keydown",t=>{t.stopPropagation()}),this.setTag("textarea"),this.setDomEvent("input",()=>this._change())}_change(){this.emit("change",$e(this.value))}componentCreated(){this.value=this.m_props.text}get value(){return this.dom?this.dom.value:this.m_props.text}set value(e){this.m_props.text=e??"",this.dom&&(this.dom.value=this.m_props.text,this.m_props.autoGrow&&this.setAttribute("rows",this._calcHeight(this.m_props.text)))}get text(){return this.value}set text(e){this.value=e}_calcHeight(e){return 1+(e.match(/\n/g)||[]).length}_updateHeight(){let e=this.value,t=this._calcHeight(e);this.getData("lines")!=t&&(this.setAttribute("rows",t),this.setData("lines",t))}insertText(e){this.appendText(e)}appendText(e){if(this.dom){let t=this.dom,i=t.selectionEnd;t.setRangeText(e,i,i,"end")}}replaceText(e){this.dom&&this.dom.setRangeText(e)}getSelection(){if(this.dom){let e=this.dom;return{start:e.selectionStart,end:e.selectionEnd}}else return{start:0,end:0}}setSelection(e){if(this.dom){let t=this.dom;e.start!==void 0&&(t.selectionStart=e.start),e.end!==void 0&&(t.selectionEnd=e.end)}}getStoreValue(){return this.value}setStoreValue(e){this.value=e}},"TextArea2");f(Cx,"TextArea");var yx=d(class extends _s{m_message;m_icon;constructor(e){super(e),this.m_message=e.message,this.m_icon=e.icon,this.enableMask(!1),this.addClass("@non-maskable")}render(){this.addClass("@hlayout"),this.setContent([new Ge({icon:this.m_icon,text:this.m_message})])}show(){this.show=super.show,this.displayAt(9999,9999,"br",{x:0,y:-24});let e=1;this.startTimer("fadeout",2e3,!1,()=>{this.startTimer("opacity",100,!0,()=>{this.setStyleValue("opacity",e),e-=.1,e<0&&this.dispose()})})}},"Toaster2");f(yx,"Toaster");function sc(e){return Ie({node:e})}h(sc,"EvExpand2");m(sc,"EvExpand2");d(sc,"EvExpand2");f(sc,"EvExpand");var Ex=d(class extends St{m_view;m_container;m_selection;constructor(e){super(e),e.root=e.root,e.indent=e.indent??8,e.gadgets=e.gadgets,e.sort=e.sort??!1,this.m_selection=null,this.m_container=new Rt({cls:"@scroll-container"}),this.m_view=new Rt({cls:"@scroll-view",flex:1,content:this.m_container}),this.setContent([this.m_view,e.gadgets?new me({cls:"gadgets",content:e.gadgets}):null]),this.setDomEvent("click",t=>this._click(t)),this.setDomEvent("dblclick",t=>this._click(t)),this.setDomEvent("contextmenu",t=>this._handleCtxMenu(t)),e.canDragItems&&(this.setDomEvent("dragstart",t=>{let s=T.getElement(t.target,T)?.getData("node");s?(t.dataTransfer.effectAllowed="move",t.dataTransfer.items.add(JSON.stringify({type:"treeview",id:s.id}),"string")):(t.preventDefault(),t.stopPropagation())}),this.setDomEvent("dragover",t=>this._dragEnter(t)),this.setDomEvent("dragenter",t=>this._dragEnter(t)),this.setDomEvent("dragend",t=>this._dragLeave(t)),this.setDomEvent("dragleave",t=>this._dragLeave(t)),this.setDomEvent("drop",t=>this._dragLeave(t)),this.setDomEvent("drop",t=>this._drop(t))),this.mapPropEvents(e,"dblclick","drag","selectionchange","contextMenu")}_dragEnter(e){e.preventDefault();let t=T.getElement(e.target,T);t?.getData("node")&&(t.addClass("@drag-over"),e.dataTransfer.dropEffect="move")}_dragLeave(e){let t=T.getElement(e.target,T);t?.getData("node")&&t.removeClass("@drag-over")}_drop(e){let t=T.getElement(e.target,T),i=t?.getData("node");if(i||(i=this.m_props.root),i){let s;i.children?s=i:s=t.getData("parent");for(let r=0;r<e.dataTransfer.items.length;r++)e.dataTransfer.items[0].getAsString(n=>{let l=JSON.parse(n);this.emit("drag",Gh(i,l,s))})}}render(){this.__update()}__update(){if(this.m_props.root){let e=[];this._buildBranch(this.m_props.root,-1,e,this.m_props.root),this.m_container.setContent(e)}}updateElement(e){let{node:t,item:i}=this._getNode(e);if(t){let s=t.dom.parentNode,r=this._makeNode(i,t.dom.classList.value,t.getData("icon"),t.getData("level")),n=r._build();s.replaceChild(n,t.dom),this.m_selection?.el===t&&(this.m_selection.el=r)}}set root(e){this.m_props.root=e,this.update()}openAll(e=!0){this.forEach(t=>{t.children&&(t.open=e)}),this.__update()}refreshRoot(e){let t=[];this.forEach(s=>(s.open&&t.push(s.id),!1));let i=this.selection;e&&(this.m_props.root=e),this.forEach(s=>(t.indexOf(s.id)>=0&&(s.open=!0),!1)),this.__update()}_buildBranch(e,t,i,s){let r="@tree-item";e.cls&&(r+=" "+e.cls),!e.open&&e.children&&(r+=" collapsed"),e.children&&(r+=" folder",e.children.length==0&&(r+=" empty"));let n=e.icon;if(n===void 0&&e.children&&(e.open===!0?n="var(--x4-icon-chevron-down)":n="var(--x4-icon-chevron-right)"),t>=0){let l=this._makeNode(e,r,n,t);this.m_selection?.id==e.id&&(this.m_selection.el=l,l.addClass("selected")),i.push(l)}(t==-1||e.open)&&e.children&&(this.m_props.sort&&(e.children=e.children.sort((l,o)=>{let a=(l.children?"0"+l.text:l.text)?.toLocaleLowerCase(),c=(o.children?"0"+o.text:o.text)?.toLocaleLowerCase();return a<c?-1:a>c?1:0})),e.children.forEach(l=>{this._buildBranch(l,t+1,i,e)}))}_renderDef(e){return new Ge({cls:"tree-label",flex:1,text:e.text})}_makeNode(e,t,i,s){return new me({cls:t,content:[new rt({cls:"tree-icon",icon:i}),this.m_props.renderItem?this.m_props.renderItem(e):this._renderDef(e)],data:{node:e,level:s,icon:i},style:{paddingLeft:4+s*this.m_props.indent},attrs:{draggable:this.m_props.canDragItems?!0:void 0}})}forEach(e){let t=null;function i(s){if(e(s)==!0)return!0;if(s.children){for(let r=0;r<s.children.length;r++)if(i(s.children[r]))return!0}}return h(i,"scan"),m(i,"scan"),d(i,"scan"),f(i,"scan"),this.m_props.root&&i(this.m_props.root),t}ensureVisible(e){let{node:t}=this._getNode(e);t&&t.scrollIntoView()}set selection(e){this.select(e,!1)}select(e,t=!0){if(this.m_selection?.el&&this.m_selection.el.removeClass("selected"),this.m_selection=null,e!==void 0){let{node:i}=this._getNode(e);if(i&&(this.m_selection={id:e,el:i},i.addClass("selected"),i.scrollIntoView(),t)){let s=i.getData("node");this.emit("selectionchange",bi(s))}}else t&&this.emit("selectionchange",bi(null))}_getNode(e){let t={node:null,item:null};return this.m_container.enumChilds(i=>{let s=i.getData("node");if(s?.id==e)return t={node:i,item:s},!0}),t}get selection(){return this.m_selection?.id}getNodeWithId(e){return this.forEach(t=>t.id==e)}_click(e){let t=e.target,i=t,s=!1;for(t.tabIndex!==-1&&(s=!0);t!=this.dom;){let r=T.getElement(t),n=r?.getData("node");if(n){if(n.children&&!s){(r.hasClass("selected")||i.classList.contains("tree-icon"))&&(n.open=!n.open),this.m_selection={id:n.id,el:null};let l=this.m_view?.dom?.scrollTop;this.update(),l&&this.m_view.dom.scrollTo(0,l),this.emit("expand",sc(n))}else this.selection=n.id,s||(e.type=="click"?this.emit("click",bs(n)):this.emit("dblclick",Jr(n)));this.emit("selectionchange",bi(n));return}t=t.parentElement}e.type=="click"&&(this.m_selection=null,this.update(),this.emit("selectionchange",bi(null)))}_handleCtxMenu(e){e.preventDefault();let t=e.target,i=t;for(;t!=this.dom;){let r=T.getElement(t)?.getData("node");if(r){if(r.children&&i.classList.contains("tree-icon"))return;this.selection=r.id,this.emit("click",bs(r)),this.emit("contextMenu",Ns(e,r));return}t=t.parentElement}this.selection=null,this.emit("contextMenu",Ns(e,null))}static buildFromStrings(e,t="/"){let i={id:0,text:"<root>",children:[]};function s(r,n){let l=n.indexOf(t),o=n.substr(0,l<0?void 0:l),a;l>=0&&(a=r.find(c=>c.text==o)),a||(a={id:n,text:o},r.push(a)),l>=0&&(a.children||(a.children=[]),s(a.children,n.substr(l+t.length)))}return h(s,"insert"),m(s,"insert"),d(s,"insert"),f(s,"insert"),e.forEach(r=>{s(i.children,r)}),i}static buildFromHierarchy(e,t){let i={id:0,text:"<root>",children:[]},s=[];function r(n){let l,o;n.parent>0?(o=s.find(a=>a.id==n.parent),o||(o={id:n.parent,text:"",children:[]},s.push(o)),o.children||(o.children=[])):o=i,l=s.find(a=>a.id==n.id),l?(l.text=n.name,l.parent=n.parent):(l={id:n.id,text:n.name,parent:n.parent,cls:n.cls,icon:n.icon,data:n.data},n.leaf?l.icon=null:l.children=[]),s.push(l),o.children.push(l)}return h(r,"insert"),m(r,"insert"),d(r,"insert"),f(r,"insert"),e.forEach(r),t&&s.forEach(t),i}},"TreeView2");f(Ex,"TreeView");var CC=Symbol("fragment"),kx=d(class extends T{render(e){let t=this.renderTSX(e);t&&this.setContent(t)}},"TSXComponent2");f(kx,"TSXComponent");var qf=Symbol("msg_sent");function C_(e){let t=window.location.protocol==="https:"?"wss://":"ws://",i=new WebSocket(`${t}${window.location.hostname}:${window.location.port}`,"messaging"),s=lo.instance();s.on("global",r=>{r[qf]||i.send(JSON.stringify({msg:r.msg,params:r.params}))}),i.onmessage=r=>{if(r.data!="ping"){let n=JSON.parse(r.data);n[qf]=!0,s.signal("global",n)}},i.onclose=r=>{console.log("websocket closed:",r),e()},i.onerror=r=>{console.log("websocket error:",r)}}h(C_,"setupWSMessaging2");m(C_,"setupWSMessaging2");d(C_,"setupWSMessaging2");f(C_,"setupWSMessaging");var yC=Symbol(),Xa=m(class extends Zn{static instance(){return Xa.self}m_mainView;m_app_name;m_app_version;m_app_uid;m_local_storage;m_user_data;m_touch_time;m_touch_count;m_router;constructor(e){console.assert(Xa.self===null,"application is a singleton"),super(e),this.m_app_name=e.app_name??"application",this.m_app_version=e.app_version??"1.0",this.m_app_uid=e.app_uid??"application";let t=`${this.m_app_name}.${this.m_app_version}.settings`;this.m_local_storage=new Np(t),this.m_user_data={},this.m_touch_time=0,this.m_touch_count=0,this.m_router=null,Sx=Xa.self=this,"onload"in globalThis?globalThis.addEventListener("load",()=>{this.ApplicationCreated()}):this.ApplicationCreated()}ApplicationCreated(){this.setTitle("")}get router(){return this.m_router||(this.m_router=new Ng),this.m_router}get app_name(){return this.m_app_name}get app_uid(){return this.m_app_uid}get app_version(){return this.m_app_version}get local_storage(){return this.m_local_storage}get user_data(){return this.m_user_data}get history(){debugger;return null}setMainView(e,t){let i=this.m_props.renderTo??B.body,s=ci(i);this.m_props.renderTo||s.setStyleValue("position","absolute"),s.addClass("x4-root-element"),t&&s._empty(),this.m_mainView=e,e.setStyleValue("position","absolute"),e._build(),i.appendChild(e.dom)}set mainView(e){this.setMainView(e,!1)}get mainView(){return this.m_mainView}setTitle(e){B.title=this.m_app_name+(e?" > "+e:"")}disableZoomWheel(){window.addEventListener("wheel",function(e){e.ctrlKey&&e.preventDefault()},{passive:!1,capture:!0})}enterModal(e){}enableTouchDblClick(){B.addEventListener("touchstart",e=>{let t=Date.now();if(t-this.m_touch_time>700?this.m_touch_count=1:this.m_touch_count++,this.m_touch_time=t,this.m_touch_count==2){this.m_touch_count=0;let i=e.touches[0],s={type:"dblclick"};for(let r in i)s[r]=i[r];P._dispatchEvent(s),e.stopPropagation()}})}},"_Application3"),uo=Xa;d(uo,"Application");_e(uo,"self",null);var Sx,Dx=m(class extends zt{},"AbsLayout3");d(Dx,"AbsLayout");var ce=m(class extends zt{},"HLayout3");d(ce,"HLayout");var Dt=m(class extends zt{},"VLayout3");d(Dt,"VLayout");var Ix=m(class extends zt{constructor(e){super(e),this.setDomEvent("sizechange",()=>this._updateLayout())}componentCreated(){super.componentCreated(),this._updateLayout()}_updateLayout(){let e=this.m_props.defaultLayout=="horizontal";if(this.m_props.switchSize<=0&&window.screen.height>window.screen.width)e=!e;else{let t=this.getBoundingRect();(e&&t.width<this.m_props.switchSize||!e&&t.height<this.m_props.switchSize)&&(e=!e)}e?(this.removeClass("@vlayout"),this.addClass("@hlayout")):(this.addClass("@vlayout"),this.removeClass("@hlayout"))}},"AutoLayout3");d(Ix,"AutoLayout");var Ax=m(class extends zt{constructor(e){super(e)}render(){this.m_props.colSizes&&this.setStyleValue("grid-template-columns",this.m_props.colSizes),this.m_props.rowSizes&&this.setStyleValue("grid-template-rows",this.m_props.rowSizes),this.m_props.colGap&&this.setStyleValue("grid-gap",this.m_props.colGap),this.m_props.template&&this.setStyleValue("grid-template-areas",this.m_props.template.join(`
|
|
24
|
+
`))}},"GridLayout3");d(Ax,"GridLayout");var Mx=m(class extends zt{m_cells;constructor(e){super(e),this.setTag("table"),this.m_cells=new Map}_getCell(e,t,i=!0){let s=Ir(e,t);return this.m_cells.get(s)??(i?{item:void 0}:null)}_setCell(e,t,i,s=!1){let r=Ir(e,t);this.m_cells.set(r,i),this.dom&&i.item&&s&&(i.item instanceof P?i.item.update():this.enumChilds(n=>{if(n.getData("row")==e&&n.getData("col")==t)return n.setContent(i.item),n.update(),!0}))}setCell(e,t,i){let s=this._getCell(e,t);s.item=i,this._setCell(e,t,s,!0)}setCellData(e,t,i){let s=this._getCell(e,t);s.data=i,this._setCell(e,t,s,!0)}getCellData(e,t){return this._getCell(e,t,!1)?.data}merge(e,t,i,s){let r=this._getCell(e,t);r.rowSpan=i,r.colSpan=s,this._setCell(e,t,r)}setCellWidth(e,t,i){let s=this._getCell(e,t);s.width=i,this._setCell(e,t,s)}setCellHeight(e,t,i){let s=this._getCell(e,t);s.height=i,this._setCell(e,t,s)}setCellClass(e,t,i){let s=this._getCell(e,t);s.cls=i,this._setCell(e,t,s)}setColClass(e,t){let i=this._getCell(-1,e);i.cls=t,this._setCell(-1,e,i)}setRowClass(e,t){let i=this._getCell(e,999);i.cls=t,this._setCell(e,999,i)}getCell(e,t){return this._getCell(e,t)?.item}render(){let e=[],t=[];for(let i=0;i<this.m_props.rows;i++){let s=[];for(let l=0;l<this.m_props.columns;l++){let o=Ir(i,l);if(t.indexOf(o)>=0)continue;let a=this.m_cells.get(o),c=this.m_cells.get(Ir(-1,l)),u="";a&&a.cls&&(u=a.cls),c&&c.cls&&(u+=" "+c.cls);let _=new P({tag:"td",content:a?.item,width:a?.width,height:a?.height,data:{row:i,col:l},cls:u});if(a){let p=a.rowSpan??0,v=a.colSpan??0;if(p>0&&_.setAttribute("rowspan",p+1),v>0&&_.setAttribute("colspan",v+1),p||v)for(let g=0;g<=p;g++)for(let x=0;x<=v;x++)t.push(Ir(g+i,x+l))}s.push(_)}let r=this._getCell(i,999,!1),n=new P({tag:"tr",data:{row:i},content:s,cls:r?.cls});e.push(n)}this.setContent(e)}},"TableLayout3");d(Mx,"TableLayout");function Ir(e,t){return e*1e3+t}h(Ir,"_mkid5");m(Ir,"_mkid5");d(Ir,"_mkid");var Px=m(class extends P{constructor(e){super(e),this.setContent(e.content)}setContent(e){if(!e)super.setContent(null);else{let t;mi(e)?t=new Dt({content:e}):t=e,t.addClass("@scroll-container"),super.setContent(t)}}},"ScrollView3");d(Px,"ScrollView");var Tx=m(class extends zt{constructor(e){let t=e.items;e.items=void 0,super(e),this.setDomEvent("sizechange",()=>{this.resizeAllItems()}),t&&t.forEach(i=>{this.addItem(i)})}resizeItem(e){let t=this.getComputedStyle(),i=t.parse("grid-auto-rows"),s=t.parse("grid-row-gap"),r=e.queryItem(".content");if(r||(r=e),r&&i+s){let n=r.getBoundingRect(),l=Math.ceil((n.height+s)/(i+s));e.setStyleValue("gridRowEnd","span "+l)}}resizeAllItems(){this.queryAll(".item",e=>{this.resizeItem(e)})}addItem(e){e.addClass("content"),this.appendChild(new zt({cls:"item",content:e}))}},"Masonry3");d(Tx,"Masonry");function y_(e){return Pe({pos:e})}h(y_,"EvMove3");m(y_,"EvMove3");d(y_,"EvMove");var Za=m(class extends zt{m_ui_mask;m_hasMask=!0;constructor(e){super(e),this.addClass("@hidden")}enableMask(e=!0){this.m_hasMask=e}show(e){if(e!==void 0?this.m_hasMask=!!e:e=this.m_hasMask,this.m_hasMask){let t=B.activeElement;for(t&&t.blur(),this.m_ui_mask=B.body.lastChild;this.m_ui_mask;){if(this.m_ui_mask.nodeType==1){let i=ci(this.m_ui_mask);if(!(i.hasClass("@menu")||i.hasClass("@non-maskable"))){if(!(i.getStyleValue("display")=="none"||!i.isUserVisible())){if(i.hasClass("@comp"))break}}}this.m_ui_mask=this.m_ui_mask.previousSibling}this.m_ui_mask&&ci(this.m_ui_mask).addClass("@mask")}if(e&&uo.instance().enterModal(!0),this.setStyle({left:0,top:0}),B.body.appendChild(this._build()),this.removeClass("@hidden"),this.centerOnScreen(),e){let t=B.activeElement;if(!this.dom.contains(t)){let i=this.queryItem("[autofocus]");if(i)i.focus();else{let s=this.queryAll("[tabindex]");s&&(s=s.filter(r=>r.offsetParent!==null),s.length&&s[0].focus())}}Za.modal_stack.push(this.dom)}}centerOnScreen(){let e=this.getBoundingRect(),t=`max( 0px, 50vw - ${e.width/2}px )`,i=`max( 0px, 50vh - ${e.height/2}px )`;this.setStyleValue("left",t),this.setStyleValue("top",i)}displayAt(e,t,i="top left",s,r=!1){this.show(r);let n="l",l="t";i.indexOf("right")>=0&&(n="r"),i.indexOf("bottom")>=0&&(l="b");let o=B.body.getBoundingClientRect(),a=this.getBoundingRect();n=="r"&&(e-=a.width),l=="b"&&(t-=a.height),s&&(e+=s.x,t+=s.y),e<4&&(e=4),e+a.width>o.right-4&&(e=o.right-4-a.width,s?.x<0&&(e+=s.x)),t<4&&(t=4),t+a.height>o.bottom-4&&(t=o.bottom-4-a.height,s?.y<0&&(t+=s.y)),this.setStyle({left:e,top:t})}close(){this.hide(),this.m_hasMask&&this.m_ui_mask&&(ci(this.m_ui_mask).removeClass("@mask"),uo.instance().enterModal(!1));let e=Za.modal_stack.indexOf(this.dom);e>=0&&Za.modal_stack.splice(e),this.dispose()}componentCreated(){if(this.m_props.sizable){this.addClass("@size-all");let e=["top","right","bottom","left","topleft","topright","bottomleft","bottomright"];for(let t of e)new Wh({target:this,sens:t,events:{rawresize:i=>this._mouseResize(i)}})}}_mouseResize(e){e.preventDefault();let t=this.getBoundingRect(),i=this.getComputedStyle(),s=e.ui_event,r=i.parse("marginTop"),n=i.parse("marginLeft"),l=i.parse("marginRight"),o=i.parse("marginBottom"),a=0,c=0,u=ms(s,!0);switch(e.sens){case"topright":case"bottomright":case"right":a=t.right-l-u.x;break;case"topleft":case"bottomleft":case"left":a=t.left-n-u.x;break}switch(e.sens){case"bottomleft":case"bottomright":case"bottom":c=t.bottom-o-u.y;break;case"topleft":case"topright":case"top":c=t.top-r-u.y;break}t.left-=n,t.top-=r;let _=e.sens;P.setCapture(this,p=>{let v=d((g,x)=>{let E=t.left,y=t.top,k=t.width,A=t.height,S,w,D=g+a,R=x+c;switch(D<0&&(D=0),R<0&&(R=0),_){case"topright":case"bottomright":case"right":k=D-E;break;case"topleft":case"bottomleft":case"left":S=E-D,k+=S,E-=S;break}switch(_){case"bottomleft":case"bottomright":case"bottom":A=R-y;break;case"topleft":case"topright":case"top":w=y-R,A+=w,y-=w;break}let C=new An(k,A);this.setStyle({left:E,top:y,width:C.width,height:C.height}),this.emit("size",Mt(C))},"__move");if(p.type=="mouseup"||p.type=="touchend")P.releaseCapture();else if(p.type=="mousemove"){let g=p;v(g.pageX,g.pageY)}else if(p.type=="touchmove"){let g=p;v(g.touches[0].pageX,g.touches[0].pageY)}})}},"_Popup3"),ps=Za;d(ps,"Popup");_e(ps,"modal_stack",[]);function E_(e){if(e.key=="Tab"||e.key=="Enter"){let t=e.target;if(t.tagName=="TEXTAREA")return;let i=P.getElement(t);if(i&&(i.hasAttribute("wants-tab")||i.hasAttribute("wants-enter")))return;let s=B.body;ps.modal_stack.length&&(s=ps.modal_stack[ps.modal_stack.length-1]),k_(s,e.target,e.shiftKey),e.stopPropagation(),e.preventDefault()}}h(E_,"x4handleKeyDown3");m(E_,"x4handleKeyDown3");d(E_,"x4handleKeyDown");function k_(e,t,i){let s=B.activeElement;if(!e.contains(s))return;let r=P.getElement(t),n=Array.from(e.querySelectorAll("[tabindex]"));if(n=n.filter(o=>o.offsetParent!==null),!n.length)return;let l=n.indexOf(t);l<0?l=0:i?l>0?l--:l=n.length-1:l<n.length-1?l++:l=0,n[l].focus()}h(k_,"_nextTab3");m(k_,"_nextTab3");d(k_,"_nextTab");function Ch(){B.body.addEventListener("keydown",E_,!0)}h(Ch,"installKBHandler3");m(Ch,"installKBHandler3");d(Ch,"installKBHandler");B.body?Ch():window.addEventListener("load",Ch);function S_(e){return Pe({source:e})}h(S_,"EvAction3");m(S_,"EvAction3");d(S_,"EvAction");var Yg=m(class extends Zn{constructor(e){super(e),this.mapPropEvents(e,"run")}get props(){return this.m_props}set text(e){this.m_props.text=e,this.emit("change",qe(this))}set icon(e){this.m_props.icon=e,this.emit("change",qe(this))}fire(){this.emit("run",S_(this))}},"Action3");d(Yg,"Action");function wn(e,t,i=null){return Pe({url:e,svg:t,context:i})}h(wn,"EvLoaded3");m(wn,"EvLoaded3");d(wn,"EvLoaded");function yh(e){let t=e.length;return e[0]=='"'&&e[t-1]=='"'&&(e=e.substring(1,t-1),e=e.replaceAll('\\"',"'")),e}h(yh,"trimQuotes3");m(yh,"trimQuotes3");d(yh,"trimQuotes");var Xg=m(class extends wo{svgs;constructor(){super(),this.svgs=new Map}load(e){if(this.svgs.has(e)){let t=this.svgs.get(e);t&&this.signal("loaded",wn(e,t))}else this.svgs.set(e,null),d(async i=>{if(i.substring(0,24)=="data:image/svg+xml;utf8,"){let s=i.substring(24);this.svgs.set(i,s),this.signal("loaded",wn(i,s))}else{let s=await fetch(i);if(s.ok){let r=await s.text();!r.startsWith("<svg")&&!r.startsWith("<?xml")?(console.error("svg loading error: ",r),this.signal("loaded",wn(i,""))):(this.svgs.set(i,r),this.signal("loaded",wn(i,r)))}}},"_load")(e)}},"Loader3");d(Xg,"Loader");var gu=new Xg,Ku=m(class extends P{m_icon;m_iconName;constructor(e){He(e)?super({icon:e}):super(e),this._setIcon(this.m_props.icon,!1),this.m_props.size&&this.setStyleValue("fontSize",this.m_props.size)}_setIcon(e,t){if(!e){this.m_iconName="";return}this.removeClass("@svg");let i,s;if(typeof e=="number")e=e.toString(16),i=e,console.error("deprecation error: invalid icon name");else{let l=/\s*var\s*\(\s*(.+)\s*\)\s*/gi,o=l.exec(e);for(;o;){let y=o[1].trim();if(e=Wr.getVar(y).trim(),e==""||e===void 0){console.error(`icon: unable to find variable named '${y}'`);return}else e=yh(e);o=l.exec(e)}if(e.startsWith("<svg")){this._setSVG("data:image/svg+xml;utf8,"+e);return}let a=/\s*svg\s*\(\s*(.+)\s*\)\s*/gi,c=/(.*\.svg)$/gi,u=a.exec(e)||c.exec(e);if(u){let y=u[1].trim();this._setSVG(y);return}let p=/^\s*(data\:image\/.+)\s*$/gi.exec(e);if(p){this._setSVG(p[1]);return}let g=/\s*cls\s*\(\s*(.+)\s*\)\s*/gi.exec(e);if(g){let y=g[1].trim();this.addClass(y);return}let E=/\s*url\s*\(\s*(.+)\s*\)\s*/gi.exec(e);if(E){s=yh(E[1].trim()),s=s.replaceAll("\\",""),this._setSVG(s);return}else console.error("deprecation error: invalid icon name"),i=e,e=Wr.getVar("icon-"+e),(e==""||e===void 0)&&(e="0")}if(this.m_iconName=i,this.m_icon===e)return;let r=P.getCss(),n;if(t&&this.m_icon&&(n="icon-"+i,this.removeClass(n)),n="icon-"+i,Ku.icon_cache[n]===void 0){Ku.icon_cache[n]=!0;let l;s?l=`display: block; content: ' '; background-image: url(${s}); background-size: contain; width: 100%; height: 100%; background-repeat: no-repeat; color: white;`:l=`content: "\\${e}";`,r.setRule(n,`.${n}::before {${l}}`)}this.addClass(n),this.m_icon=e}set icon(e){this._setIcon(e,!0)}get icon(){return this.m_iconName}_setSVG(e){let t=d(i=>{i.url==e&&(this.addClass("@svg-icon"),this.setContent($i.from(i.svg),!1),gu.off("loaded",t))},"set");gu.on("loaded",t),gu.load(e)}_setSVGPath(e){this.addClass("@svg-icon"),this.setContent($i.from(`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="${e}/></svg>`),!1)}},"_Icon3"),nt=Ku;d(nt,"Icon");_e(nt,"icon_cache",[]);var Ne=m(class extends P{constructor(e){typeof e=="string"||e instanceof $i?super({text:e}):super(e)}render(e){let t=this.m_props.text;this.m_props.multiline&&!(t instanceof $i)&&(t=new $i(Ql(t,!0))),e.icon?(this.setTag("span"),this.addClass("@hlayout"),this.setContent([new nt({icon:e.icon}),new P({content:t,ref:"text"})])):this.setContent(t),this.addClass(e.align??"left")}set text(e){let t=this.m_props;if(t.text!==e){t.text=e;let i=this.m_props.text;if(this.m_props.multiline&&!(i instanceof $i)&&(i=new $i(Ql(i,!0))),this.dom){let s=this;this.m_props.icon&&(s=this.itemWithRef("text")),s.setContent(i)}}}get text(){return this.m_props.text}},"Label3");d(Ne,"Label");var Fx=m(class extends P{},"MenuSeparator3");d(Fx,"MenuSeparator");var zx=m(class extends Ne{},"MenuTitle3");d(zx,"MenuTitle");var pt=m(class extends ps{m_subMenu;m_opener;m_virtual;m_lock;constructor(e,t){super(e),this.addClass("@shadow"),this.m_opener=t,this.m_virtual=!1,this.m_lock=0,this.enableMask(!1)}lock(e){this.m_lock+=e?1:-1}setVirtual(){this.m_virtual=!0}setSubMenu(e){this.m_subMenu=e}hideSubMenu(){this.m_subMenu&&(this.m_subMenu.m_opener._close(),this.m_subMenu.hide(),this.m_subMenu=null)}render(e){this.setContent(e.items)}show(){this.m_virtual||pt._addMenu(this),super.show()}close(){!this.dom&&!this.m_virtual||(this.m_opener&&this.m_opener._close(),this.m_subMenu&&(this.m_subMenu.close(),this.m_subMenu=null),super.close(),pt._removeMenu())}clear(){this.m_props.items=[]}static _addMenu(e){pt.watchCount==0&&(pt.rootMenu=e,B.addEventListener("mousedown",pt._mouseWatcher)),pt.watchCount++}static _removeMenu(){console.assert(pt.watchCount>0),pt.watchCount--,pt.watchCount==0&&B.removeEventListener("mousedown",pt._mouseWatcher)}static _mouseWatcher(e){if(e.defaultPrevented)return;let t=e.target;for(;t;){let i=P.getElement(t);if(i&&i instanceof pt)return;t=t.parentElement}pt._discardAll()}static _discardAll(){pt.rootMenu&&(pt.rootMenu.close(),pt.rootMenu=null)}displayAt(...e){this.m_lock||pt._discardAll();let t,i,s,r;e.length==1?{x:t,y:i}=ms(e[0],!0):[t,i,s,r]=e,s||(s="top left"),super.displayAt(t,i,s,r)}},"_Menu3"),gs=pt;d(gs,"Menu");_e(gs,"watchCount",0);_e(gs,"rootMenu",null);var $n=m(class extends P{m_menu;m_isOpen;m_action;constructor(e,t){e instanceof Yg?(super({click:()=>{e.fire()}}),this.m_action=e):He(e)?super({text:e,click:t}):super(e),this.mapPropEvents(this.m_props,"click"),this.m_menu=null,this.m_isOpen=!1,this.setDomEvent("mousedown",i=>this._mousedown(i)),this.setDomEvent("click",i=>this._click(i))}render(e){let t=e.icon??0,i=e.text;e.checked!==void 0&&(t=e.checked?"var( --x4-icon-check )":0),this.m_action&&(t||(t=this.m_action.props.icon),i===void 0&&(i=this.m_action.props.text));let s=null;this.isPopup&&(this.addClass("@popup-menu-item"),s=new nt({icon:"var( --x4-icon-chevron-right )",cls:"pop-mark"})),!i&&!t&&this.addClass("@separator"),e.cls&&this.addClass(e.cls),this.setTag("a"),this.setContent([t<0?null:new nt({icon:t}),new Ne({flex:1,text:i}),s])}get id(){return this.m_props.itemId}get text(){return this.m_props.text}get isPopup(){return!!this.m_props.items}_close(){this.removeClass("@opened"),this.m_isOpen=!1}_click(e){this.isPopup||(this.emit("click",Gs()),gs._discardAll())}_mousedown(e){if(this.isPopup){this.m_menu||(this.m_menu=new gs({items:this.m_props.items},this));let t=this.m_isOpen,i=P.getElement(this.dom,gs);if(i&&i.hideSubMenu(),!t){i&&i.setSubMenu(this.m_menu),this.m_isOpen=!0;let s=this.getBoundingRect();this.m_menu.lock(!0),i?this.m_menu.displayAt(s.right,s.top):this.m_menu.displayAt(s.left,s.bottom),this.m_menu.lock(!1),this.addClass("@opened")}e.preventDefault()}}},"MenuItem3");d($n,"MenuItem");var Rx=m(class extends ce{m_items;constructor(e,t){super(e),console.assert(!1,"not imp"),this.addClass("@shadow"),this.m_items=e.items}render(){this.setContent(this.m_items)}},"MenuBar3");d(Rx,"MenuBar");var Zg=m(class extends Dt{m_selection;m_defer_sel;m_container;m_view;m_topIndex;m_itemHeight;m_cache;constructor(e){super(e),this.setDomEvent("keydown",t=>this.handleKey(t)),this.setDomEvent("click",t=>this._handleClick(t)),this.setDomEvent("dblclick",t=>this._handleClick(t)),this.setDomEvent("contextmenu",t=>this._handleCtxMenu(t)),this._setTabIndex(e.tabIndex,0),this.mapPropEvents(e,"click","dblClick","contextMenu","selectionChange","cancel")}componentCreated(){this.m_props.virtual?this._buildItems():this.m_props.populate&&(this.items=this.m_props.populate(null))}render(e){e.items=e.items||[],e.gadgets=e.gadgets,e.renderItem=e.renderItem,e.virtual=e.virtual??!1,this.m_topIndex=0,e.virtual?(console.assert(e.itemHeight!==void 0),this.m_itemHeight=e.itemHeight,this.m_cache=new Map,this.addClass("virtual")):(this.m_itemHeight=void 0,this.m_cache=void 0),this._buildContent()}set items(e){this.setItems(e)}get items(){return this.m_props.items}setItems(e,t=!0){this.m_props.items=e,t||(this.m_selection=null),this.m_container?this._buildItems():this._buildContent()}handleKey(e){let t=d(i=>{let s;Di(this.m_props.items)?(s=this.m_props.items(),this.m_props.items=s):s=this.m_props.items;let r;if(!this.m_selection)s&&(r=s[0]);else{let l=s.findIndex(o=>o===this.m_selection.item);i>0&&l<s.length-1?r=s[l+1]:i<0&&l>0?r=s[l-1]:r=this.selection}let n=this._findItemWithId(r?.id);this._selectItem(r,n,!0)},"moveSel");switch(e.key){case"ArrowDown":{t(1),e.preventDefault(),e.stopPropagation();break}case"ArrowUp":{t(-1),e.preventDefault(),e.stopPropagation();break}}}_buildContent(){let e=this.m_props;e.virtual?(this.m_container=new zt({cls:"@scroll-container",content:[]}),this.m_view=new zt({cls:"@scroll-view",flex:1,content:this.m_container,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)}}),this.setContent([this.m_view,e.gadgets?new ce({cls:"gadgets",content:e.gadgets}):null])):(this.m_view=void 0,this.m_container=new Dt({cls:"@scroll-container",content:[]}),this.addClass("@scroll-view"),this.setContent(this.m_container,!1)),e.virtual&&this.m_container.setStyleValue("height",e.items.length*this.m_itemHeight),(this.dom||!e.virtual)&&this._buildItems()}_updateScroll(e){let t=d(()=>{let i=Math.floor(this.m_view.dom.scrollTop/this.m_itemHeight);(i!=this.m_topIndex||e)&&(this.m_topIndex=i,this._buildItems())},"update");e?this.startTimer("scroll",10,!1,t):t()}async _buildItems(){let e=this.m_props,t=[],i=e.items;Di(i)&&(i=i());let s=this.m_selection?.item.id,r=!1;if(e.virtual){let n=this.getBoundingRect(),l=100,o=0,a=this.m_topIndex*this.m_itemHeight,c=this.m_topIndex,u=n.height,_=e.items.length,p=[],v=this.m_cache;for(this.m_cache=new Map;o<u&&c<_&&--l>0;){let g=e.items[c],x;v.has(g.id)?(x=v.get(g.id),v.delete(g.id)):(x=this._renderItem(g),p.push(x)),s==g.id&&(x.addClass("@selected"),r=!0),x.setStyleValue("top",a+o),t.push(x),this.m_cache.set(g.id,x),o+=this.m_itemHeight,c++}v.forEach(g=>{g.dispose()}),this.m_container.appendChild(p),this.m_container.setStyleValue("height",_*this.m_itemHeight),r||i.some(g=>s==g.id)||(this.m_selection=null)}else i.forEach(n=>{let l=this._renderItem(n);s==n.id&&(l.addClass("@selected"),r=!0),t.push(l)}),this.m_container.setContent(t,!1),r||(this.m_selection=null);if(this.m_defer_sel){let n=this.m_defer_sel;this.m_defer_sel=void 0,this.selection=n}}_renderItem(e){let t=this.onRenderItem(e);return t.setAttribute("data-id",e.id),t.addClass("@list-item"),t.setData("item-id",e.id),t}onRenderItem(e){return this.m_props.renderItem?this.m_props.renderItem(e):new ce({content:e.text})}_handleClick(e){e.stopImmediatePropagation(),e.preventDefault();let t=e.target,i=this.dom,s=this.m_props.items;for(;t&&t!=i;){let r=P.getElement(t),n=r?.getData("item-id");if(n!==void 0){let l=s.find(o=>o.id==n);if(l){let o;e.type=="click"?(o=Gs(l),this.emit("click",o)):(o=el(l),this.emit("dblClick",o)),o.defaultPrevented||this._selectItem(l,r)}else this._selectItem(null,null);return}t=t.parentElement}this._selectItem(null,null)}_handleCtxMenu(e){e.preventDefault();let t=e.target,i=this.dom,s=this.m_props.items;for(;t&&t!=i;){let r=P.getElement(t),n=r?.getData("item-id");if(n){let l=s.find(o=>o.id==n);l&&(this._selectItem(l,r),this.emit("contextMenu",or(e,l)));return}t=t.parentElement}this.emit("contextMenu",or(e,null))}_selectItem(e,t,i=!0){this.m_selection&&this.m_selection.citem&&this.m_selection.citem.removeClass("@selected"),this.m_selection=e?{item:e,citem:t}:null,this.m_selection&&this.m_selection.citem&&this.m_selection.citem.addClass("@selected"),i&&this.emit("selectionChange",Zi(e))}get selection(){return this.m_selection?this.m_selection.item:null}set selection(e){if(e==null)this._selectItem(null,null);else if(Di(this.m_props.items))this.m_defer_sel=e;else{let t=this.m_props.items.find(s=>s.id==e),i=this._findItemWithId(t.id);this._selectItem(t,i,!1)}}_findItemWithId(e){let t=null;return this.dom&&this.m_container.enumChilds(i=>{if(i.getData("item-id")==e)return i.scrollIntoView(),t=i,!0}),t}appendItem(e,t=!1,i=!0){t?this.m_props.items.unshift(e):this.m_props.items.push(e),i&&(this.selection=null),this.m_container?this._buildItems():this._buildContent(),i&&(this.selection=e.id)}updateItem(e,t){let i=this.m_props.items.findIndex(n=>n.id===e);if(i<0)return;let s=!1;this.m_selection&&this.m_selection.item===this.m_props.items[i]&&(s=!0),this.m_props.items[i]=t;let r=this.queryItem(`[data-id="${t.id}"]`)?.dom;if(r){let n=this._renderItem(t);s&&(n.addClass("@selected"),this.m_selection.citem=n,this.m_selection.item=t);let l=n._build();this.m_container.dom.replaceChild(l,r)}}},"ListView3");d(Zg,"ListView");function D_(e=null){return Pe({context:e})}h(D_,"EvCancel3");m(D_,"EvCancel3");d(D_,"EvCancel");var I_=m(class extends ps{m_list;constructor(e){super({tabIndex:!1}),this.enableMask(!1),this.addClass("@non-maskable"),e.tabIndex=!1,this.m_list=new Zg(e),this.setContent(this.m_list),this.mapPropEvents(e,"cancel")}set items(e){this.m_list.items=e}handleKey(e){this.m_list.handleKey(e)}_handleClick=e=>{if(!this.dom)return;let t=e.target;this.dom.contains(t)||P.getElement(t,$n)||(this.signal("cancel",D_()),this.close())};show(e){B.addEventListener("mousedown",this._handleClick),super.show(e)}hide(){B.removeEventListener("mousedown",this._handleClick),super.hide()}close(){B.removeEventListener("mousedown",this._handleClick),super.close()}get selection(){return this.m_list.selection}set selection(e){this.m_list.selection=e}},"PopupListView3");d(I_,"PopupListView");var is=m(class extends P{constructor(e){super(e)}render(e){this.setTag("input"),this._setTabIndex(e.tabIndex),this.setAttributes({value:e.value,type:e.type||"text",name:e.name,placeholder:e.placeHolder,autofocus:e.autoFocus,readonly:e.readOnly,autocomplete:"new-password",tabIndex:e.tabIndex,spellcheck:e.spellcheck===!1?"false":void 0,min:e.min,max:e.max,...e.attrs}),this.m_props.autosel=e.autosel??!0,e.uppercase&&this.setStyleValue("textTransform","uppercase"),this.m_props.autosel&&this.setDomEvent("focus",()=>{this.selectAll()})}getType(){return this.m_props.type}get value(){if(this.dom&&(this.m_props.value=this.dom.value),this.m_props.uppercase){let e=this.m_props.value.toUpperCase();this.dom&&e!=this.m_props.value&&(this.dom.value=e),this.m_props.value=e}return this.m_props.value}set value(e){this.m_props.value=e,this.dom&&(this.dom.value=e)}getStoreValue(){if(this.m_props.value_hook)return this.m_props.value_hook.get();{let e=this.getAttribute("type");e&&(e=e.toLowerCase());let t,i=this.dom;if(e==="file"){t=[];let s=i.files;for(let r=0;r<s.length;r++)t.push(s[r].name)}else if(e==="checkbox")i.checked?t=1:t=0;else if(e==="radio")i.checked&&(t=this.value);else if(e==="date")debugger;else t=this.value;return t}}setStoreValue(e){if(this.m_props.value_hook)return this.m_props.value_hook.set(e);{let t=this.getAttribute("type"),i=this.dom;if(t&&(t=t.toLowerCase()),t==="checkbox"){let s=e!==null&&e!=="0"&&e!==0&&e!==!1;s!==i.checked&&(i.setAttribute("checked",""+s),i.dispatchEvent(new Event("change")))}else this.value=e}}set readOnly(e){this.setAttribute("readonly",e)}selectAll(){this.dom.select()}select(e,t=9999){this.dom.setSelectionRange(e,e+t)}getSelection(){let e=this.dom;return{start:e.selectionStart,length:e.selectionEnd-e.selectionStart}}},"Input3");d(is,"Input");var A_=m(class extends P{constructor(e){super(e),this.setTag("button"),this.setDomEvent("click",t=>this._handleClick(t)),this.setDomEvent("mousedown",()=>{this._startAutoRep(!0)}),this.setDomEvent("mouseup",()=>{this._startAutoRep(!1)}),this.setDomEvent("keydown",t=>this._handleKeyDown(t)),this.mapPropEvents(e,"click")}render(e){let t=e.action,i=e.icon,s=e.text;t&&(!i&&t.props.icon&&(i=t.props.icon),s===void 0&&t.props.text&&(s=t.props.text));let r=i?new nt({icon:i,cls:"left",ref:"l_icon"}):null,n=new Ne({flex:1,text:s??"",align:e.align,ref:"label"}),l=e.rightIcon?new nt({icon:e.rightIcon,cls:"right",ref:"r_icon"}):null;s===void 0&&n.addClass("@hidden"),this.setContent([r,n,l]),this._setTabIndex(e.tabIndex)}_startAutoRep(e){this.m_props.autoRepeat&&(e?this.startTimer("repeat",700,!1,()=>{this.startTimer("repeat",this.m_props.autoRepeat,!0,this._sendClick)}):this.stopTimer("repeat"))}_handleKeyDown(e){!e.ctrlKey&&!e.shiftKey&&!e.altKey&&(e.key=="Enter"||e.key==" ")&&(this._sendClick(),e.preventDefault(),e.stopPropagation())}_handleClick(e){if(this.m_props.menu){let t=new gs({items:Di(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),i=this.getBoundingRect();t.displayAt(i.left,i.bottom,"tl")}else this._sendClick();e.preventDefault(),e.stopPropagation()}_sendClick(){if(this.m_props.menu){let e=new gs({items:Di(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),t=this.getBoundingRect();e.displayAt(t.left,t.bottom,"tl")}else this.emit("click",Gs()),this.m_props.action&&this.m_props.action.fire()}set text(e){this.m_props.text=e;let t=this.itemWithRef("label");t&&(t.text=e,t.removeClass("@hidden"))}get text(){return this.itemWithRef("label")?.text}set icon(e){this.m_props.icon=e;let t=this.itemWithRef("l_icon");t?t.icon=e:this.update()}get icon(){return this.itemWithRef("l_icon")?.icon}set rightIcon(e){this.m_props.rightIcon=e;let t=this.itemWithRef("r_icon");t&&(t.icon=e)}get rightIcon(){return this.itemWithRef("l_icon")?.icon}set menu(e){this.m_props.menu=e}},"BaseButton3");d(A_,"BaseButton");var xt=m(class extends A_{},"Button3");d(xt,"Button");var Lx=m(class extends A_{constructor(e){super(e)}render(e){super.render(e),e.checked&&(this.addClass("checked"),this._updateIcon())}_sendClick(){super._sendClick(),this.m_props.checked=!this.m_props.checked,this.setClass("checked",this.m_props.checked),this.emit("change",qe(this.m_props.checked)),this._updateIcon()}_updateIcon(){if(this.m_props.checkedIcon){let e=this.m_props.checked?this.m_props.checkedIcon:this.m_props.icon,t=this.itemWithRef("l_icon");t&&(t.icon=e)}}},"ToggleButton3");d(Lx,"ToggleButton");var Jg=m(class extends Dt{m_date;constructor(e){super(e),this.mapPropEvents(e,"change"),this.m_date=e.date?.clone()??new Date}render(e){let t=yn(this.m_date);t.setDate(1);let i=t.getDay();i==0&&(i=7),t.setDate(-i+1+1);let s=yn(t),r=this.m_date.hash(),n=yn(this.m_date);n.setDate(1),n.setMonth(n.getMonth()+1),n.setDate(0);let l=Mn(n),o=[],a=new ce({cls:"month-sel",content:[new Ne({cls:"month",text:Tt(this.m_date,"O"),dom_events:{click:()=>this._choose("month")}}),new Ne({cls:"year",text:Tt(this.m_date,"Y"),dom_events:{click:()=>this._choose("year")}}),new ch,new xt({text:"<",click:()=>this._next(!1)}),new xt({text:">",click:()=>this._next(!0)})]});o.push(a);let c=[];c.push(new ce({cls:"weeknum cell"}));for(let p=0;p<7;p++)c.push(new Ne({cls:"cell",flex:1,text:le.global.day_short[(p+1)%7]}));o.push(new ce({cls:"week header",content:c}));let u=this.m_date.getMonth(),_=!0;for(;Mn(s)<=l;){let p=[new ce({cls:"weeknum cell",content:new P({tag:"span",content:Tt(s,"w")})})];for(let v=0;v<7;v++){let g="cell day";s.hash()==r&&(g+=" today"),s.getMonth()!=u&&(g+=" out");let x=d(E=>new ce({cls:g,flex:1,content:new P({tag:"span",content:Tt(E,"d")}),dom_events:{click:()=>this.select(E)}}),"mkItem");p.push(x(s.clone())),s.setDate(s.getDate()+1),_=!1}o.push(new ce({cls:"week",flex:1,content:p}))}this.setContent(o)}select(e){this.m_date=e,this.emit("change",qe(e)),this.update()}_next(e){this.m_date.setMonth(this.m_date.getMonth()+(e?1:-1)),this.update()}_choose(e){let t=[];if(e=="month")for(let r=0;r<12;r++)t.push(new $n({text:le.global.month_long[r],click:()=>{this.m_date.setMonth(r),this.update()}}));else if(e=="year"){let r=this.m_props.minDate?.getFullYear()??1900,n=this.m_props.maxDate?.getFullYear()??2037;for(let l=r;l<n;l++)t.push(new $n({text:""+l,click:()=>{this.m_date.setFullYear(l),this.update()}}))}let i=new gs({items:t}),s=this.getBoundingRect();i.displayAt(s.left,s.top)}get date(){return this.m_date}set date(e){this.m_date=e,this.update()}},"Calendar3");d(Jg,"Calendar");var Qg=m(class extends ps{m_cal;constructor(e){super({tabIndex:1}),this.enableMask(!1),this.m_cal=new Jg(e),this.m_cal.addClass("@fit"),this.setContent(this.m_cal)}_handleClick=e=>{if(!this.dom)return;let t=e.target;this.dom.contains(t)||P.getElement(t,$n)||this.close()};show(e,t){B.addEventListener("mousedown",this._handleClick),t?super.displayAt(t.x,t.y,"top left",void 0,e):super.show(e)}close(){B.removeEventListener("mousedown",this._handleClick),super.close()}},"PopupCalendar3");d(Qg,"PopupCalendar");var vu,Ps,M_=m(class extends P{m_text;set text(e){this.m_text.text=e}render(){this.setClass("@non-maskable",!0),this.setContent([new nt({icon:"var( --x4-icon-tip )"}),this.m_text=new Ne({text:"help"})])}displayAt(e,t,i="top left"){this.show();let s="l",r="t";i.indexOf("right")>=0&&(s="r"),i.indexOf("bottom")>=0&&(r="b");let n=B.body.getBoundingClientRect(),l=this.getBoundingRect();s=="r"&&(e-=l.width),r=="b"&&(t-=l.height),e+l.width>n.right&&(e=n.right-l.width),t+l.height>n.bottom&&(t=n.bottom-l.height-17),this.setStyle({left:e,top:t})}},"Tooltip3");d(M_,"Tooltip");function e0(e){if(Hh())return;let t={target:null,x:0,y:0};function i(n){t.x=n.pageX,t.y=n.pageY}h(i,"handle_mpos"),m(i,"handle_mpos"),d(i,"handle_mpos");function s(n){let l=n.target,o=null;for(t.x=n.pageX+10,t.y=n.pageY+15;l&&(o=l.getAttribute("tip"),!o);)l=l.parentElement;if(!(l==t.target||Ps&&l==Ps.dom)){if(!l||!o){t.target=null,e?e(null):r();return}t.target=l,e?e(null):r(),e?e(o):vu=setTimeout(()=>{Ps===void 0&&(Ps=new M_({}),B.body.appendChild(Ps._build())),Ps.text=o,Ps.displayAt(t.x+17,t.y+17,"top left")},700)}}h(s,"handle_mouse"),m(s,"handle_mouse"),d(s,"handle_mouse");function r(){vu&&clearTimeout(vu),Ps&&Ps.hide()}h(r,"_hideTip"),m(r,"_hideTip"),d(r,"_hideTip"),B.body.addEventListener("mouseover",s),B.body.addEventListener("mouseout",s),B.body.addEventListener("mousemove",i)}h(e0,"initTooltips3");m(e0,"initTooltips3");d(e0,"initTooltips");var Vx=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,ki=m(class extends P{m_cal_popup;m_ui_input;m_error_tip;constructor(e){super(e),this.addClass("@hlayout"),this.mapPropEvents(e,"change","click","focus")}componentCreated(){super.componentCreated(),this.m_props.autoFocus&&this.focus()}componentDisposed(){this.m_error_tip&&this.m_error_tip.dispose(),super.componentDisposed()}focus(){this.m_ui_input.focus()}render(e){let t={flex:1,dom_events:{focus:()=>this._focus(),focusout:()=>this._blur(),input:()=>this._change()},value:e.value,name:e.name,type:e.type,placeHolder:e.placeHolder,autoFocus:e.autoFocus,readOnly:e.readOnly,value_hook:e.value_hook,uppercase:e.uppercase,spellcheck:e.spellcheck,tabIndex:e.tabIndex===void 0?!0:e.tabIndex,attrs:e.attrs,min:e.min,max:e.max,autosel:e.autosel};if(e.type=="date"){e.format=e.format??"Y-M-D",t.type="text";let _={get:()=>this._date_get_hook(),set:p=>this._date_set_hook(p)};t.value_hook=e.value_hook??_}this.m_ui_input=new is(t);let i;e.icon?i=new xt({icon:e.icon,click:()=>this._btnClick(),tabIndex:!1}):e.type=="date"&&(i=new xt({cls:"gadget",icon:"var( --x4-icon-calendar-days )",tabIndex:!1,click:()=>this._showDatePicker(i)}),e.validator||(e.validator=this._date_validator));let s=e.gadgets??[];s.forEach(_=>{_.addClass("gadget")});let r=[i,...s];this.setClass("@required",e.required),e.gadgets&&e.gadgets.length&&this.addClass("with-gadgets");let n,l,o=e.labelWidth;o>0&&(n=o),o<0&&(l=-o);let a,c=e.labelAlign,u=!1;e.label&&(c=="top"&&(c="left",u=!0,l=1),a=new Ne({ref:"label",tag:"label",cls:"label1"+(e.label?"":" @hidden"),text:e.label??"",width:n,flex:l,align:c})),u?(this.removeClass("@hlayout"),this.addClass("@vlayout vertical"),this.setContent([a,new ce({width:n,content:[this.m_ui_input,...r]})])):(this.addClass("@hlayout"),this.setContent([a,this.m_ui_input,...r]))}enable(e){e===!0&&this.m_ui_input.enable(),super.enable(e)}disable(){this.m_ui_input.disable(),super.disable()}_btnClick(){this.emit("click",Gs(this.value))}setDateStoreFormat(e){this.m_props.format=e}setStoreValue(e){this.m_ui_input.setStoreValue(e)}getStoreValue(){return this.m_ui_input.getStoreValue()}_date_get_hook(){let e=Kl(this.value),t=this.m_props;return t.format=="native"?e:e?Tt(e,t.format):null}_date_set_hook(e){let t=this.m_props;if(t.format=="native")this.value=Tt(e);else if(e){let i=Kl(e,t.format);this.value=Tt(i)}else this.value=""}showError(e){this.m_error_tip||(this.m_error_tip=new M_({cls:"error"}),B.body.appendChild(this.m_error_tip._build()));let t=this.m_ui_input.getBoundingRect();this.m_error_tip.text=e,this.m_error_tip.displayAt(t.right,t.top,"top left"),this.addClass("@error")}clearError(){this.m_error_tip&&(this.m_error_tip.hide(),this.removeClass("@error"))}get value(){return this.m_ui_input?this.m_ui_input.value:this.m_props.value}set value(e){this.m_ui_input?this.m_ui_input.value=e:this.m_props.value=e}selectAll(){this.m_ui_input.selectAll()}select(e,t=9999){this.m_ui_input.select(e,t)}getSelection(){return this.m_ui_input.getSelection()}set readOnly(e){this.m_ui_input.readOnly=e}get label(){return this.itemWithRef("label")?.text}set label(e){this.itemWithRef("label").text=e}_change(){let e=this.m_ui_input.value;this.emit("change",qe(e))}_focus(){this.clearError(),this.emit("focus",mh(!0))}_blur(){this._validate(this.m_ui_input.value),this.emit("focus",mh(!1))}validate(){return this._validate(this.value)}_validate(e){let t=this.m_props,i=!1;if(t.required&&e.length==0)return this.showError(le.global.required_field),!1;if(e!=""){let s=this.getAttribute("pattern");if(s){let r=new RegExp(s);if(r&&!r.test(e))return this.showError(le.global.invalid_format),!1}if(t.type=="email"){if(!Vx.test(e.toLowerCase()))return this.showError(le.global.invalid_email),!1}else if(t.type=="number"){let r=parseFloat(e);if(isNaN(r))return this.showError(le.global.invalid_number),!1;let n=parseFloat(this.m_ui_input.getAttribute("min"));n!==void 0&&r<n&&(e=""+n,i=!0);let l=parseFloat(this.m_ui_input.getAttribute("max"));l!==void 0&&r>l&&(e=""+l,i=!0)}}if(t.validator)try{this.value=t.validator(e)}catch(s){return this.showError(s instanceof Error?s.message:s),!1}else i&&(this.value=e);return!0}_date_validator(e){if(e=e.trim(),e=="")return"";let t;if(e=="@")t=new Date;else if(t=Kl(e),!t)throw Cn(le.global.invalid_date,le.global.date_format);return Tt(t)}_showDatePicker(e){this.m_cal_popup||(this.m_cal_popup=new Qg({change:i=>{this.value=Tt(i.value),this.m_cal_popup.close()}}));let t=this.m_ui_input.getBoundingRect();this.m_cal_popup.displayAt(t.left,t.bottom,"top left")}get input(){return this.m_ui_input}get type(){return this.m_props.type}},"TextEdit3");d(ki,"TextEdit");var Bx=m(class extends ki{m_popup;m_popvis;m_needval;m_lockpop;constructor(e){super(e),this.setDomEvent("input",()=>this._onChange()),this.setDomEvent("focusin",()=>this._onFocus()),this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.m_popvis=!1,this.m_needval=!1,this.m_lockpop=!1,this.setDomEvent("keydown",t=>this._onKey(t))}_onKey(e){this.m_popvis?e.key=="ArrowUp"||e.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(e),this.m_lockpop=!1,e.preventDefault(),e.stopPropagation()):e.key=="Escape"&&(this._hidePopup(),e.preventDefault(),e.stopPropagation()):e.key=="ArrowDown"&&(this._onChange(),e.preventDefault(),e.stopPropagation())}_onChange(){let e=this.m_props.enumValues(this.value);this.showPopup(e)}componentDisposed(){this.m_popup&&this._hidePopup(),super.componentDisposed()}showPopup(e){if(this.m_props.readOnly||this.hasClass("@disable"))return;if(!this.m_popup){let s=this.getComputedStyle(),r=s.value("fontFamily"),n=s.value("fontSize");this.m_popup=new I_({cls:"@combo-popup",attrs:{tabindex:0},selectionChange:l=>{this.value=l.selection.id,this.m_lockpop||(this._hidePopup(),this.focus())},style:{fontFamily:r,fontSize:n}})}this.m_popup.items=e.map(s=>({id:s,text:s}));let i=this.m_ui_input.getBoundingRect();this.m_popup.setStyle({minWidth:i.width}),this.m_popup.displayAt(i.left,i.bottom),this.m_popvis=!0}_validate(e){return!0}validate(){return super._validate(this.value)}_checkFocus(){let e=document.activeElement;this.dom&&this.dom.contains(e)||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(e)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1),this.m_needval&&(this.validate(),this.m_needval=!1)}_onFocus(){this.value.length==0&&this._onChange(),this.m_needval=!0}},"AutoComplete3");d(Bx,"AutoComplete");function P_(e){return Pe({ctx:e})}h(P_,"EvPaint3");m(P_,"EvPaint3");d(P_,"EvPaint");function T_(e,t,i){let s=e;return s.width=t,s.height=i,s.smoothLine=F_,s.smoothLineEx=z_,s.line=R_,s.roundRect=L_,s.calcTextSize=V_,s.setFontSize=B_,s.circle=H_,s}h(T_,"mkPainter3");m(T_,"mkPainter3");d(T_,"mkPainter");function F_(e,t=null,i=!0){if(e.length<2)return;if(t||(t=this),e.length==2){i!==!1?t.moveTo(e[0].x,e[0].y):t.lineTo(e[0].x,e[0].y),t.lineTo(e[1].x,e[1].y);return}function s(a,c){return{x:a.x+(c.x-a.x)/2,y:a.y+(c.y-a.y)/2}}h(s,"midPointBtw"),m(s,"midPointBtw"),d(s,"midPointBtw");function r(a,c,u,_,p,v,g){return{x:(1-a)*(1-a)*c+2*(1-a)*a*_+a*a*v,y:(1-a)*(1-a)*u+2*(1-a)*a*p+a*a*g}}h(r,"getQuadraticXY"),m(r,"getQuadraticXY"),d(r,"getQuadraticXY");let n=e[0],l=e[1],o=n;t.moveTo(n.x,n.y);for(let a=1,c=e.length;a<c;a++){let u=s(n,l);for(let _=0;_<8;_++){let{x:p,y:v}=r(_/8,o.x,o.y,n.x,n.y,u.x,u.y);t.lineTo(p,v)}n=e[a],l=e[a+1],o=u}t.lineTo(n.x,n.y)}h(F_,"smoothLine3");m(F_,"smoothLine3");d(F_,"smoothLine");function z_(e,t=.5,i=10,s=null,r=!0,n=!1){let l=[];for(let w=0,D=e.length;w<D;w++)l.push(e[w].x),l.push(e[w].y);let o,a=1,c=l.length,u=0,_=(c-2)*i+2+(n?2*i:0),p=new Float32Array(_),v=new Float32Array((i+2)*4),g=4;for(o=l.slice(0),n?(o.unshift(l[c-1]),o.unshift(l[c-2]),o.push(l[0],l[1])):(o.unshift(l[1]),o.unshift(l[0]),o.push(l[c-2],l[c-1])),v[0]=1;a<i;a++){var x=a/i,E=x*x,y=E*x,k=y*2,A=E*3;v[g++]=k-A+1,v[g++]=A-k,v[g++]=y-2*E+x,v[g++]=y-E}v[g]=1,S(o,v,c),n&&(o=[],o.push(l[c-4],l[c-3],l[c-2],l[c-1]),o.push(l[0],l[1],l[2],l[3]),S(o,v,4));function S(w,D,R){for(var C=2,z;C<R;C+=2){var W=w[C],J=w[C+1],ve=w[C+2],te=w[C+3],ie=(ve-w[C-2])*t,K=(te-w[C-1])*t,Y=(w[C+4]-W)*t,Nt=(w[C+5]-J)*t;for(z=0;z<i;z++){var Te=z<<2,Ut=D[Te],$t=D[Te+1],qt=D[Te+2],Kt=D[Te+3];p[u++]=Ut*W+$t*ve+qt*ie+Kt*Y,p[u++]=Ut*J+$t*te+qt*K+Kt*Nt}}}h(S,"parse"),m(S,"parse"),d(S,"parse"),c=n?0:l.length-2,p[u++]=l[c],p[u]=l[c+1],s||(s=this);for(let w=0,D=p.length;w<D;w+=2)w==0&&r!==!1?s.moveTo(p[w],p[w+1]):s.lineTo(p[w],p[w+1])}h(z_,"smoothLineEx3");m(z_,"smoothLineEx3");d(z_,"smoothLineEx");function R_(e,t,i,s,r,n=1){this.save(),this.beginPath(),this.moveTo(e,t),this.lineTo(i,s),this.lineWidth=n,this.strokeStyle=r,this.stroke(),this.restore()}h(R_,"line3");m(R_,"line3");d(R_,"line");function L_(e,t,i,s,r){this.moveTo(e+r,t),this.lineTo(e+i-r,t),this.quadraticCurveTo(e+i,t,e+i,t+r),this.lineTo(e+i,t+s-r),this.quadraticCurveTo(e+i,t+s,e+i-r,t+s),this.lineTo(e+r,t+s),this.quadraticCurveTo(e,t+s,e,t+s-r),this.lineTo(e,t+r),this.quadraticCurveTo(e,t,e+r,t),this.closePath()}h(L_,"roundRect3");m(L_,"roundRect3");d(L_,"roundRect");function V_(e,t=!1){let i=this.measureText(e),s=i.fontBoundingBoxAscent+i.fontBoundingBoxDescent;return t?{width:Math.round(i.width),height:Math.round(s)}:{width:i.width,height:s}}h(V_,"calcTextSize3");m(V_,"calcTextSize3");d(V_,"calcTextSize");function B_(e){let t=Math.round(e)+"px";this.font=this.font.replace(/\d+px/,t)}h(B_,"setFontSize3");m(B_,"setFontSize3");d(B_,"setFontSize");function H_(e,t,i){this.moveTo(e+i,t),this.arc(e,t,i,0,Math.PI*2)}h(H_,"circle3");m(H_,"circle3");d(H_,"circle");var Hx=m(class extends P{m_iwidth=-1;m_iheight=-1;m_scale=1;m_canvas;constructor(e){super(e),this.setDomEvent("sizechange",()=>{this._paint()}),this.mapPropEvents(e,"paint")}render(){this.m_iwidth=-1,this.m_iheight=-1,this.m_canvas=new P({tag:"canvas"}),this.setContent(this.m_canvas)}update(e=0){this.m_iheight=this.m_iwidth=-1,super.update(e)}scale(e){this.m_scale=e,this.m_iwidth=-1,this.redraw()}get canvas(){return this.m_canvas}$update_rep=0;redraw(e){e!==void 0?++this.$update_rep>=20?(this.stopTimer("update"),this._paint()):this.startTimer("update",e,!1,()=>this._paint()):(this.stopTimer("update"),this._paint())}_paint(){this.$update_rep=0;let e=this.dom;if(!this.isUserVisible())return;let t=this.m_canvas.dom,i=e.clientWidth,s=e.clientHeight,r=t.getContext("2d");if(i!=this.m_iwidth||s!=this.m_iheight){let n=window.devicePixelRatio||1,l=r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1,o=this.canvas;if(n!==l||this.m_scale!=1){let a=n/l,c=i*a,u=s*a;o.setAttribute("width",""+c),o.setAttribute("height",""+u),o.setStyleValue("width",i),o.setStyleValue("height",s),a*=this.m_scale,r.scale(a,a)}else o.setAttribute("width",""+i),o.setAttribute("height",""+s),o.setStyleValue("width",i),o.setStyleValue("height",s),r.scale(1,1);this.m_iwidth=i,this.m_iheight=s}if(i&&s){let n=T_(r,i,s);this.m_props.autoClear&&n.clearRect(0,0,i,s),n.save(),n.translate(-.5,-.5),this.paint(n),n.restore()}}paint(e){try{this.m_props.painter?this.m_props.painter(e):this.emit("paint",P_(e))}catch(t){console.assert(!1,t)}}},"Canvas3");d(Hx,"Canvas");var O_=m(class extends P{m_cards;m_ipage;m_cpage;constructor(e){super(e),this.m_cards=[],this.m_ipage=e.active,this.m_cpage=null,this.singleShot(()=>{this.setPages(e.pages)})}render(){let e=[];this.m_cards.forEach(t=>{t.page&&e.push(t.page)}),this.setContent(e)}switchTo(e){if(this.m_cards.length!=0&&(e===void 0&&(e=this.m_cards[0].name),e!==this.m_cpage?.name)){if(this.m_cpage&&(this.m_cpage.selector&&this.m_cpage.selector.removeClass("@active"),this.m_cpage.page&&!(this.m_cpage.page instanceof Function))){let t=this.m_cpage.page;t.removeClass("@active"),t.addClass("@hidden")}if(this.m_cpage=this.m_cards.find(t=>t.name==e),this.m_cpage){if(this.m_cpage.page){Di(this.m_cpage.page)&&(this.m_cpage.page=this.m_cpage.page(),console.assert(this.m_cpage.page!=null,"You must return a valid component"));let t=this.m_cpage.page;t.addClass("@active"),t.removeClass("@hidden"),t.dom||this._preparePage(t),this.m_cpage.selector&&this.m_cpage.selector.addClass("@active")}this.emit("change",qe(this.m_cpage.name))}}}setPages(e){let t=this._initTabs(e);t&&cr(()=>{this.switchTo(t),this.update()})}_initTabs(e){if(!e)return;let t=this.m_ipage;return e.forEach(i=>{if(!i)return;let s={...i};s.selector=this._prepareSelector(i),s.active=!1,this.m_cards.push(s),t||(t=i.name),i.active&&(t=i.name)}),t}_updateSelector(){}_prepareSelector(e){return null}_preparePage(e){e.setStyleValue("flex",1),e.addClass("@tab-page")}},"CardView3");d(O_,"CardView");var Eh=m(class extends P{constructor(e){super(e),this.setDomEvent("focus",()=>this._setFocus()),this.mapPropEvents(e,"change"),e.slider&&this.addClass("slider")}render(e){let t=e.labelWidth??-1,i="__cb_"+this.uid;this.setTag("label"),this.addClass("@hlayout"),this.addClass(e.align??"left"),this.setContent([new is({ref:"input",type:"checkbox",name:e.name,id:i,tabIndex:e.tabIndex,value:e.value??"on",attrs:{checked:e.checked?"":void 0},dom_events:{change:this._change.bind(this)}}),e.slider?new P({cls:"@slide-el"}):null,new Ne({text:e.text??"",width:t<0?void 0:t,flex:t<0?-t:void 0,align:e.labelAlign??"left",style:{order:e.align=="right"?-1:1},attrs:{for:i}})])}_change(){this.emit("change",qe(this.check))}_setFocus(){this.itemWithRef("input").focus()}get check(){return this.dom?this.itemWithRef("input").dom.checked:this.m_props.checked}set check(e){if(this.dom){let i=this.itemWithRef("input").dom;i&&(i.checked=e)}this.m_props.checked=e}get text(){return this.itemWithRef("label").text}set text(e){this.itemWithRef("label").text=e}toggle(){this.check=!this.check}},"CheckBox3");d(Eh,"CheckBox");var Kf={lightsalmon:4294942842,lightseagreen:4280332970,lightskyblue:4287090426,lightslategray:4286023833,lightsteelblue:4289774814,lightyellow:4294967264,lime:4278255360,limegreen:4281519410,linen:4294635750,magenta:4294902015,maroon:4286578688,mediumaquamarine:4284927402,mediumblue:4278190285,mediumorchid:4290401747,mediumpurple:4287852763,mediumseagreen:4282168177,mediumslateblue:4286277870,mediumspringgreen:4278254234,mediumturquoise:4282962380,mediumvioletred:4291237253,midnightblue:4279834992,mintcream:4294311930,mistyrose:4294960353,moccasin:4294960309,navajowhite:4294958765,navy:4278190208,oldlace:4294833638,olive:4286611456,olivedrab:4285238819,orange:4294944e3,orangered:4294919424,orchid:4292505814,palegoldenrod:4293847210,palegreen:4288215960,paleturquoise:4289720046,palevioletred:4292571283,papayawhip:4294963157,peachpuff:4294957753,peru:4291659071,pink:4294951115,plum:4292714717,powderblue:4289781990,purple:4286578816,red:4294901760,rosybrown:4290547599,royalblue:4282477025,saddlebrown:4287317267,salmon:4294606962,sandybrown:4294616160,seagreen:4281240407,seashell:4294964718,sienna:4288696877,silver:4290822336,skyblue:4287090411,slateblue:4285160141,slategray:4285563024,snow:4294966010,springgreen:4278255487,steelblue:4282811060,tan:4291998860,teal:4278222976,thistle:4292394968,tomato:4294927175,turquoise:4282441936,violet:4293821166,wheat:4294303411,white:4294967295,whitesmoke:4294309365,yellow:4294967040,yellowgreen:4288335154,aliceblue:4293982463,antiquewhite:4294634455,aqua:4278255615,aquamarine:4286578644,azure:4293984255,beige:4294309340,bisque:4294960324,black:4278190080,blanchedalmond:4294962125,blue:4278190335,blueviolet:4287245282,brown:4289014314,burlywood:4292786311,cadetblue:4284456608,chartreuse:4286578432,chocolate:4291979550,coral:4294934352,cornflowerblue:4284782061,cornsilk:4294965468,crimson:4292613180,cyan:4278255615,darkblue:4278190219,darkcyan:4278225803,darkgoldenrod:4290283019,darkgray:4289309097,darkgreen:4278215680,darkkhaki:4290623339,darkmagenta:4287299723,darkolivegreen:4283788079,darkorange:4294937600,darkorchid:4288230092,darkred:4287299584,darksalmon:4293498490,darkseagreen:4287609999,darkslateblue:4282924427,darkslategray:4281290575,darkturquoise:4278243025,darkviolet:4287889619,deeppink:4294907027,deepskyblue:4278239231,dimgray:4285098345,dodgerblue:4280193279,firebrick:4289864226,floralwhite:4294966e3,forestgreen:4280453922,fuchsia:4294902015,gainsboro:4292664540,ghostwhite:4294506751,gold:4294956800,goldenrod:4292519200,gray:4286611584,green:4278222848,greenyellow:4289593135,honeydew:4293984240,hotpink:4294928820,indianred:4291648604,indigo:4283105410,ivory:4294967280,khaki:4293977740,lavender:4293322490,lavenderblush:4294963445,lawngreen:4286381056,lemonchiffon:4294965965,lightblue:4289583334,lightcoral:4293951616,lightcyan:4292935679,lightgoldenrodyellow:4294638290,lightgreen:4287688336,lightgrey:4292072403,lightpink:4294948545,none:0,transparent:0},ye=m(class{m_value;constructor(e,t,i,s){let r=arguments.length,n=this;function l(){if(!r)return 4278190080;if(r==1)return Number.isSafeInteger(e)?4278190080|e&16777215:n._getCustomColor(e);if(r==2){let o,a=((t*255|0)&255)<<24;return Number.isSafeInteger(e)?o=e:o=n._getCustomColor(e),o&16777215|a}else if(r==4&&s!==void 0&&s<=1)return s<=0?0:(s=s*255,s|=0,(s&255)<<24|(e&255)<<16|(t&255)<<8|i&255);return 4278190080|(e&255)<<16|(t&255)<<8|i&255}h(l,"_init"),m(l,"_init"),d(l,"_init"),this.m_value=l()}_shade(e){let t=e<0?0:255,i=e<0?-e:e,s=this._split();return new ye(Math.round((t-s.r)*i)+s.r,Math.round((t-s.g)*i)+s.g,Math.round((t-s.b)*i)+s.b,s.a/255)}darken(e){return e<0&&(e=0),e>100&&(e=100),this._shade(-e/100)}lighten(e){return e<0&&(e=0),e>100&&(e=100),this._shade(e/100)}static mix(e,t,i){let s=e._split(),r=t._split(),n=s.a===r.a?s.a:Math.round(r.a*i+s.a*(1-i)),l=s.r===r.r?s.r:Math.round(r.r*i+s.r*(1-i)),o=s.g===r.g?s.g:Math.round(r.g*i+s.g*(1-i)),a=s.b===r.b?s.b:Math.round(r.b*i+s.b*(1-i));return new ye(l,o,a,n/255)}_split(){let e=this.m_value;return{a:e>>24&255,r:e>>16&255,g:e>>8&255,b:e&255}}fadeout(e){let t=this._split();if(t.a=t.a/255,t.a=t.a-t.a*e/100,t.a>1)t.a=1;else if(t.a<=0)return ye.NONE;return new ye(t.r,t.g,t.b,t.a)}static fromHSV(e,t,i,s=1){let r=Math.min(5,Math.floor(e*6)),n=e*6-r,l=i*(1-t),o=i*(1-n*t),a=i*(1-(1-n)*t),c,u,_;switch(r){case 0:c=i,u=a,_=l;break;case 1:c=o,u=i,_=l;break;case 2:c=l,u=i,_=a;break;case 3:c=l,u=o,_=i;break;case 4:c=a,u=l,_=i;break;case 5:c=i,u=l,_=o;break}return new ye(c*255,u*255,_*255,s)}static toHSV(e){let t=e._split();t.r/=255,t.g/=255,t.b/=255,t.a/=255;let i=Math.max(t.r,t.g,t.b),s=Math.min(t.r,t.g,t.b),r=i-s,n=i===0?0:r/i,l=i,o;if(r===0)o=0;else switch(i){case t.r:o=(t.g-t.b)/r/6+(t.g<t.b?1:0);break;case t.g:o=(t.b-t.r)/r/6+1/3;break;case t.b:o=(t.r-t.g)/r/6+2/3;break}return{h:o,s:n,v:l,a:t.a}}static fromHLS(e,t,i){let s,r,n;if(i==0)s=r=n=t;else{let o=m(function(u,_,p){return p<0&&(p+=1),p>1&&(p-=1),p<.16666666666666666?u+(_-u)*6*p:p<.5?_:p<.6666666666666666?u+(_-u)*(.6666666666666666-p)*6:u},"hue2rgb2");var l=o;d(o,"hue2rgb");let a=t<.5?t*(1+i):t+i-t*i,c=2*t-a;s=o(c,a,e+1/3),r=o(c,a,e),n=o(c,a,e-1/3)}return s=(s*255|0)&255,r=(r*255|0)&255,n=(n*255|0)&255,new ye(s,r,n)}static toHLS(e){let t=e.m_value,i=(t>>16&255)/255,s=(t>>8&255)/255,r=(t&255)/255,n=i,l=i;s<n&&(n=s),r<n&&(n=r),s>l&&(l=s),r>l&&(l=r);let o=0,a=0,c=0,u=l-n,_=l+n,p=.5*_,v,g;if(l!=n)o=(l-i)/u,a=(l-s)/u,c=(l-r)/u;else return{h:0,l:p,s:0};return p<.5?v=u/_:v=u/(2-_),i==l?g=60*(6+c-a):s==l?g=60*(2+o-c):g=60*(4+a-o),g>360&&(g=g-360),{h:g/360,l:p,s:v}}red(){return this.m_value>>16&255}green(){return this.m_value>>8&255}blue(){return this.m_value&255}alpha(){return(this.m_value>>24&255)/255}value(){return this.m_value}toString(){if(this.m_value===0)return"transparent";let t=this._split();if(t.a===255)return`rgb(${t.r},${t.g},${t.b})`;{t.a/=255;let i=t.a.toFixed(3);return`rgba(${t.r},${t.g},${t.b},${i})`}}toHex(e=!0){if(this.m_value===0)return"transparent";let i=this._split();return i.a===255||!e?`#${Bs(i.r)}${Bs(i.g)}${Bs(i.b)}`:`#${Bs(i.r)}${Bs(i.g)}${Bs(i.b)}${Bs(i.a)}`}static addCustomColor(e,t){ye.custom[e]=t}static addCssColor(e){let t=Wr.getVar(e);ye.custom["css:"+e]=ye.parse(t.trim())}static parse(e){let t;if(e[0]=="#"){if((t=/#(?<r>[a-fA-F0-9]{2})(?<g>[a-fA-F0-9]{2})(?<b>[a-fA-F0-9]{2})(?<a>[a-fA-F0-9]{2})?/.exec(e))!==null){let r=t.groups;return new ye(parseInt(r.r,16),parseInt(r.g,16),parseInt(r.b,16),r.a!==void 0?parseInt(r.a,16)/255:1)}if((t=/#(?<r>[a-fA-F0-9])(?<g>[a-fA-F0-9])(?<b>[a-fA-F0-9])/.exec(e))!==null){let r=t.groups,n=parseInt(r.r,16),l=parseInt(r.g,16),o=parseInt(r.b,16);return new ye(n<<4|n,l<<4|l,o<<4|o,1)}}if(e[0]=="r"){if((t=/rgb\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\)/.exec(e))!==null){let r=t.groups;return new ye(parseInt(r.r,10),parseInt(r.g,10),parseInt(r.b,10),1)}if((t=/rgba\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\,\s*(?<a>[0-9.]+)\s*\)/.exec(e))!==null){let r=t.groups;return new ye(parseInt(r.r,10),parseInt(r.g,10),parseInt(r.b,10),parseFloat(r.a))}}return console.log("invalid color value: "+e),new ye(0)}_getCustomColor(e){if(e===null)return 0;let t=Kf[e];return t!==void 0?t:ye.custom[e]!==void 0?ye.custom[e].m_value:e.substr(0,4)=="css:"?(ye.addCssColor(e.substr(4)),ye.custom[e].m_value):ye.parse(e).m_value}static contrastColor(e){let t=e._split();return(.299*t.r+.587*t.g+.114*t.b)/255>.5?ye.BLACK:ye.WHITE}static valueFromColorName(e){let t=Kf[e];return t?new ye(t):null}static fromCssVar(e){return new ye(e).toString()}},"_Color3"),Ve=ye;d(Ve,"Color");_e(Ve,"custom",[]);_e(Ve,"WHITE",new ye(255,255,255));_e(Ve,"BLACK",new ye(0,0,0));_e(Ve,"NONE",new ye(0,0,0,0));function Bs(e){return("00"+e.toString(16)).substr(-2).toUpperCase()}h(Bs,"_hx3");m(Bs,"_hx3");d(Bs,"_hx");var Ox=1e4;function W_(e){let t,i=e.url,s=e.method||"GET",r=!1;e.params instanceof FormData?(t=e.params,r=!0):s=="POST"?t=kh(e.params,!1):i+=kh(e.params,!0),i=encodeURI(i);let n=new XMLHttpRequest;if(n.open(s,i),n.upload.addEventListener("progress",l,!1),n.addEventListener("timeout",a),n.addEventListener("error",a),n.addEventListener("load",c),r||n.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8"),s!="POST"&&(n.responseType=e.responseType||"json",n.timeout=e.timeout||Ox),e.headers)for(let u in e.headers)n.setRequestHeader(u,e.headers[u]);function l(u){if(console.log(u),e.progress)try{if(u.lengthComputable){let _=o(u.loaded)+" / "+o(u.total);e.progress(u.loaded,u.total,_)}}catch(_){console.error("unhandled exception:",_)}}h(l,"progress"),m(l,"progress"),d(l,"progress");function o(u){let _,p;return u>=1e9?(_="Gb",p=u/1e9):u>=1e6?(_="Mb",p=u/1e6):u>=1e3?(_="Kb",p=u/1e3):(_="bytes",p=u),p.toFixed(2)+_}h(o,"humanSize"),m(o,"humanSize"),d(o,"humanSize");function a(){e.failure&&e.failure(n.status,n.statusText,e.userData)}h(a,"failure"),m(a,"failure"),d(a,"failure");function c(){if(n.status>=200&&n.status<300){if(e.success)try{e.success(n.response,e.userData)}catch(u){console.error("unhandled exception:",u)}}else a()}return h(c,"success"),m(c,"success"),d(c,"success"),r||s=="POST"?n.send(t):n.send(),function(){n.abort()}}h(W_,"ajaxRequest3");m(W_,"ajaxRequest3");d(W_,"ajaxRequest");function kh(e,t){if(!e)return"";let i=[];for(let r in e){let n=e[r];if(mi(n))for(let l=0,o=n.length;l<o;l++)i.push(encodeURIComponent(r)+"[]="+encodeURIComponent(""+n[l]));else n===void 0&&(n=""),i.push(encodeURIComponent(r)+"="+encodeURIComponent(""+n))}let s=i.join("&");return t?"?"+s:s}h(kh,"buildQuery3");m(kh,"buildQuery3");d(kh,"buildQuery");async function t0(e,t){return(await rc(e,t,"application/json")).json()}h(t0,"ajaxAsJSON3");m(t0,"ajaxAsJSON3");d(t0,"ajaxAsJSON");async function i0(e,t){return(await rc(e,t,"text/plain")).text()}h(i0,"ajaxAsText3");m(i0,"ajaxAsText3");d(i0,"ajaxAsText");async function rc(e,t,i){let s={method:"GET",headers:{"X-Requested-With":"XMLHttpRequest"}};if(i&&(s.headers["Content-Type"]=i),t&&(s={...s,...t},t.body&&!He(t.body))){let n=!1;(Ad(t.body)||!(t.body instanceof Blob)&&!(t.body instanceof ArrayBuffer)&&!(t.body instanceof FormData)&&!(t.body instanceof URLSearchParams)&&!(t.body instanceof ReadableStream))&&(n=!0),n?s.body=JSON.stringify(t.body):s.body=t.body}let r=await fetch(e,s);if(t&&t.noGenX)return r;if(!r.ok)throw new Vp(r);return r}h(rc,"ajax3");m(rc,"ajax3");d(rc,"ajax");var s0=m(class extends Dt{m_height;m_container;m_buttons;m_dirty;m_watchChanges;constructor(e){let t=e.content;e.content=null;let i=e.height;e.height=void 0,super(e),this.setTag(e.disableSuggestions?"section":"form"),this.mapPropEvents(e,"btnClick"),this.updateContent(t,e.buttons,i),this.m_dirty=!1,this.m_watchChanges=!1}get container(){return this.m_container}componentCreated(){super.componentCreated(),this.m_watchChanges&&this.watchChanges()}updateContent(e,t,i=0){i&&(this.m_height=i),this._makeButtons(t);let s=[this.m_container=new Dt({cls:"container",height:this.m_height,content:e}),this.m_buttons];super.setContent(s)}setContent(e,t=!0){this.m_container.setContent(e,t)}setButtons(e){this._makeButtons(e)}enableButton(e,t=!0){let i=this.getButton(e);i&&i.enable(t)}getButton(e){return this.m_buttons?.itemWithRef("@"+e)}_makeButtons(e){this.m_buttons||(this.m_buttons=new ce({cls:"footer",ref:"buttons"}));let t=[];if(e)for(let i of e)if(i instanceof P)t.push(i);else switch(i){case"ok":{t.push(new xt({ref:"@"+i,text:le.global.ok,click:()=>{this._click(i)}}));break}case"cancel":{t.push(new xt({ref:"@"+i,text:le.global.cancel,click:()=>{this._click(i)}}));break}case"ignore":{t.push(new xt({ref:"@"+i,text:le.global.ignore,click:()=>{this._click(i)}}));break}case"yes":{t.push(new xt({ref:"@"+i,text:le.global.yes,click:()=>{this._click(i)}}));break}case"no":{t.push(new xt({ref:"@"+i,text:le.global.no,click:()=>{this._click(i)}}));break}case"close":{t.push(new xt({ref:"@"+i,text:le.global.close,click:()=>{this._click(i)}}));break}case"save":{t.push(new xt({ref:"@"+i,text:le.global.save,click:()=>{this._click(i)}}));break}case"dontsave":{t.push(new xt({ref:"@"+i,text:le.global.dontsave,click:()=>{this._click(i)}}));break}}t.length==1&&t[0].setAttribute("autofocus",!0),this.m_buttons.setContent(t)}validate(){let e=this.queryAll("input"),t=!0;for(let i=0;i<e.length;i++){let s=P.getElement(e[i],ki);s&&!s.validate()&&(t=!1)}return t}_click(e){this.emit("btnClick",j_(e))}_getElements(){return console.assert(!!this.dom),this.queryAll("[name]")}setValues(e){let t=this._getElements();for(let i=0;i<t.length;i++){let s=t[i],r=P.getElement(s);if(!r.hasAttribute("name"))continue;let n=r.getAttribute("name"),l=r.getAttribute("type");e[n]!==void 0&&r.setStoreValue(e[n])}this.setDirty(!1)}getValues(){let e=this._getElements(),t={};for(let i=0;i<e.length;i++){let s=e[i],r=P.getElement(s);if(!r.hasAttribute("name"))continue;let n=r.getAttribute("name"),l=r.getStoreValue();l!==void 0&&(t[n]=l)}return t}submit(e,t){if(!this.validate())return!1;let i=this.getValues();if(t&&!t(i))return!1;let s=new FormData;for(let r in i)i.hasOwnProperty(r)&&s.append(r,i[r]===void 0?"":i[r]);return e.params=s,W_(e)}watchChanges(){this.dom?(this.queryAll("input[name], textarea[name]").forEach(t=>{ci(t).setDomEvent("input",()=>{this.setDirty()})}),this.m_watchChanges=!1):this.m_watchChanges=!0}setDirty(e=!0){this.m_dirty=e}isDirty(){return this.m_dirty}},"Form3");d(s0,"Form");function j_(e){return Pe({button:e})}h(j_,"EvBtnClick3");m(j_,"EvBtnClick3");d(j_,"EvBtnClick");var nc=m(class extends ps{m_icon;m_title;m_form;m_buttons;m_closable;m_movable;m_maximized;m_minimized;m_maximizable;m_minimizable;m_minFormSize;m_rc_max;m_rc_min;m_el_title;m_last_down;m_auto_close;m_ui_title;m_form_cb;constructor(e){let t=e.content;e.content=null;let i=e.width,s=e.height;e.width=void 0,e.height=void 0,super(e),this.m_minFormSize={width:i,height:s},this.enableMask(!0),e.form?Di(e.form)?this.m_form_cb=e.form:(this.m_form=e.form,this.m_form.on("btnClick",r=>this._handleClick(r))):this.m_form=new s0({content:t,buttons:e.buttons,disableSuggestions:e.disableSuggestions,btnClick:r=>this._handleClick(r)}),this.m_movable=e.movable,this.m_auto_close=e.autoClose??!0,this.m_icon=e.icon,this.m_title=e.title,this.m_buttons=e.buttons??null,this.m_closable=e.closable??!1,this.m_last_down=0,this.on("size",r=>{this.addClass("@resized"),this.m_form.setStyleValue("width",null),this.m_form.setStyleValue("height",null)}),this.m_maximized=!1,this.m_minimized=!1,this.m_maximizable=!1,this.m_minimizable=!1,e.maximizable!==void 0&&(this.m_maximizable=e.maximizable),e.minimizable!==void 0&&(this.m_minimizable=e.minimizable),e.maximized==!0&&(this.m_maximizable=!0),e.btnClick&&this.on("btnClick",e.btnClick)}componentCreated(){super.componentCreated(),this.m_minFormSize.width&&this.m_form.setStyle({minWidth:this.m_minFormSize.width,width:this.m_minFormSize.width}),this.m_minFormSize.height&&this.m_form.setStyle({minHeight:this.m_minFormSize.height,height:this.m_minFormSize.height});let e=this.getBoundingRect();this.setStyleValue("min-width",e.width),this.setStyleValue("min-height",e.height),this.setStyleValue("width",e.width),this.setStyleValue("height",e.height),this.m_props.dlgWidth&&this.setStyleValue("width",this.m_props.dlgWidth+"%"),this.m_props.dlgHeight&&this.setStyleValue("height",this.m_props.dlgHeight+"%"),this.addClass("@resized"),this.m_el_title&&this.m_el_title.setStyleValue("width","auto"),this.m_props.maximized?(this._maximize(),this.emit("size",Mt(null))):this.centerOnScreen()}_handleClick(e){this.emit("btnClick",e),e.defaultPrevented||this.close()}setGeometry(e){e.minimized&&this.m_minimizable?(this._minimize(!1),this.m_rc_min=new Oi(e.left,e.top,e.width,e.height),this.displayAt(e.left,e.top,"top-left")):e.maximized&&this.m_maximizable?(this._maximize(!1),this.m_rc_max=new Oi(e.left,e.top,e.width,e.height)):(this.setSize(e.width,e.height),this.displayAt(e.left,e.top,"top-left"))}getGeometry(){if(this.m_minimized)return{left:this.m_rc_min.left,top:this.m_rc_min.top,width:this.m_rc_min.width,height:this.m_rc_min.height,minimized:!0,maximized:!1};if(this.m_maximized)return{left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height,minimized:!1,maximized:!0};let e=this.getBoundingRect();return{left:e.left,top:e.top,width:e.width,height:e.height,minimized:!1,maximized:!1}}setSize(e,t){this.setStyle({width:e,height:t}),this.emit("size",Mt({width:e,height:t}))}render(){this.m_form_cb&&(this.m_form=this.m_form_cb(),this.m_form.on("btnClick",t=>this._handleClick(t)),this.m_form_cb=null);let e=this.m_icon!==void 0||this.m_closable||this.m_title!==void 0||this.m_movable;this.m_el_title=null,e&&(this.m_el_title=new ce({cls:"title",content:[this.m_icon?new nt({icon:this.m_icon}):null,this.m_ui_title=new Ne({flex:1,text:this.m_title}),this.m_minimizable?new nt({cls:"min-btn",icon:"var( --x4-icon-window-minimize )",dom_events:{click:()=>this._toggleMin()}}):null,this.m_maximizable?new nt({cls:"max-btn",icon:"var( --x4-icon-window-maximize )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_maximizable?new nt({cls:"res-btn",icon:"var( --x4-icon-window-restore )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_closable?new nt({cls:"close-btn",icon:"var( --x4-icon-rectangle-times )",dom_events:{click:()=>this.close()}}):null]}),this.m_movable&&(Hh()?this.m_el_title.setDomEvent("touchstart",t=>this._mouseDown(t)):this.m_el_title.setDomEvent("mousedown",t=>this._mouseDown(t)))),super.setContent([this.m_el_title,this.m_form])}setContent(e,t=!0){this.m_form.setContent(e,t)}setButtons(e){this.m_form.setButtons(e)}get form(){return this.m_form}close(){this.emit("close",{}),super.close()}_toggleMax(){this.m_maximizable&&(this.m_maximized?(this.removeClass("maximized"),this.setStyle({left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height}),this.m_maximized=!1,this.emit("size",Mt(null,"restore"))):(this._maximize(),this.emit("size",Mt(null,"maximize"))))}_toggleMin(){this.m_minimizable&&(this.m_minimized?(this.removeClass("minimized"),this.setStyle({width:this.m_rc_min.width,height:this.m_rc_min.height}),this.m_minimized=!1,this.emit("size",Mt(null,"restore"))):(this._minimize(),this.emit("size",Mt(null,"minimize"))))}_mouseDown(e){let{x:t,y:i}=ms(e,!0),s=ci(B.body).getBoundingRect(),r=this.getBoundingRect(!0),n=t-r.left,l=i-r.top,o=Date.now(),a=o-this.m_last_down;if(this.m_maximizable&&a<700){this._toggleMax();return}if(this.m_last_down=o,this.m_maximized)return;let c=d((u,_)=>{u>s.right?u=s.right:u<s.left&&(u=s.left),_>s.bottom?_=s.bottom:_<s.top&&(_=s.top);let p=u-n,v=_-l;this.setStyle({left:p,top:v})},"__move");P.setCapture(this,u=>{if(u.type=="mousemove"){let _=u;c(_.clientX,_.clientY)}else if(u.type=="touchmove"){let _=u;_.touches.length==1&&c(_.touches[0].clientX,_.touches[0].clientY)}else u.type=="mouseup"||u.type=="touchend"?(P.releaseCapture(),this.emit("move",y_(null))):u.type=="mousedown"||u.type=="touchstart"})}maximize(){!this.m_maximizable||this.m_maximized||(this._maximize(),this.emit("size",Mt(null)))}_maximize(e=!0){e&&(this.m_rc_max=this.getBoundingRect(!1)),this.addClass("maximized"),this.m_maximized=!0,this.setStyle({left:void 0,top:void 0,width:void 0,height:void 0})}minimize(){!this.m_minimizable||this.m_minimized||(this._minimize(),this.emit("size",Mt(null)))}_minimize(e=!0){e&&(this.m_rc_min=this.getBoundingRect(!1)),this.addClass("minimized"),this.m_minimized=!0,this.setStyle({width:void 0,height:void 0})}set title(e){this.m_title=e,this.m_ui_title&&(this.m_ui_title.text=e)}itemWithName(e){let t=this.dom.querySelector(`[name="${e}"]`);return t?P.getElement(t):null}getValues(){return this.m_form.getValues()}validate(){return this.m_form.validate()}},"Dialog3");d(nc,"Dialog");var Yu=m(class extends zt{m_colorSel;m_colorHue;m_colorAlpha;m_sample;m_selMark;m_hueMark;m_alphaMark;m_baseHSV;m_baseColor;m_transpCk;m_colorEdit;m_palmode;constructor(e){super(e),this.m_palmode=Yu.last_palmode,this.setDomEvent("contextmenu",t=>this._showCtx(t))}_showCtx(e){let t=new gs({items:[new $n({text:"Palette",checked:this.m_palmode,click:()=>{this.m_palmode=!this.m_palmode,Yu.last_palmode=this.m_palmode,this.update()}})]}),i=ms(e,!0);t.displayAt(i.x,i.y)}render(e){if(this.m_baseColor=e.color,this.m_baseHSV=Ve.toHSV(this.m_baseColor),this.m_palmode){let i=m(function(a){l=[],a.forEach(c=>{let u=new Ve(c.hex),_=u.value()==o,p=ah("hclr-box xbox",{selected:_}),v=new P({cls:p,style:{backgroundColor:u.toHex(),color:Ve.contrastColor(u).toHex()},data:{color:u.value()},content:u.toHex()});l.push(v),_&&(r=v)}),s&&s.itemWithId("vsel").setContent(l)},"fillSubs2");var t=i;d(i,"fillSubs"),this.addClass("pal-mode");let s=null,r=null,n=[],l=[],o=this.m_baseColor.value();jx.forEach(a=>{let c=a.variations[4].hex,u=c===o;u||(u=a.variations.some(v=>{if(new Ve(v.hex).value()===o)return!0}));let _=ah("clr-box xbox",{selected:u}),p=new P({cls:_,style:{backgroundColor:new Ve(c).toHex()},data:{color:c,main:a.variations}});u&&i(a.variations),n.push(p)}),s=new Dt({content:[new ce({id:"hsel",content:n}),new Dt({id:"vsel",flex:1,content:l})]}),this.m_colorEdit=new ki({cls:"hexv",value:"",attrs:{spellcheck:!1},change:a=>{let c=new Ve(a.value);c&&(this.m_baseColor=c,this.m_baseHSV=Ve.toHSV(c),this._updateColor(!1))}}),this.m_transpCk=new Eh({cls:"transp",text:"transparent",change:a=>{this.m_baseHSV.a=a.value?0:1,this._updateColor()}}),this.setContent([s,this.m_transpCk,this.m_colorEdit]),s.setDomEvent("click",a=>{r&&(r.removeClass("selected"),r=null);let c=P.getElement(a.target,"xbox");if(c){let u=c.getData("main");if(u)i(u);else{let _=new Ve(c.getData("color"));this.m_baseColor=_,this.m_baseHSV=Ve.toHSV(_),this._updateColor(),r=c,c.addClass("selected")}}})}else this.removeClass("pal-mode"),this.m_selMark=new P({cls:"marker"}),this.m_colorSel=new P({cls:"sel",content:[new P({cls:"@fit light"}),new P({cls:"@fit dark"}),this.m_selMark]}),this.m_hueMark=new P({cls:"marker"}),this.m_colorHue=new P({cls:"hue",content:[this.m_hueMark]}),this.m_sample=new P({cls:"sample"}),e.hasAlpha?(this.addClass("with-alpha"),this.m_alphaMark=new P({cls:"marker"}),this.m_colorAlpha=new P({cls:"alpha",content:[new P({cls:"bk @fit",ref:"color"}),this.m_alphaMark]})):(this.removeClass("with-alpha"),this.m_transpCk=new Eh({cls:"transp",text:"transparent",change:i=>{this.m_baseHSV.a=i.value?0:1,this._updateColor()}})),this.m_colorEdit=new ki({cls:"hexv",value:"",attrs:{spellcheck:!1},change:i=>{let s=new Ve(i.value);s&&(this.m_baseColor=s,this.m_baseHSV=Ve.toHSV(s),this._updateColor(!1))}}),this.setContent([this.m_colorSel,this.m_colorHue,this.m_colorAlpha,this.m_transpCk,this.m_colorEdit,this.m_sample]),this.m_colorSel.setDomEvent("mousedown",i=>{P.setCapture(this,s=>this._selChange(s))}),this.m_colorHue.setDomEvent("mousedown",i=>{P.setCapture(this,s=>this._hueChange(s))}),e.hasAlpha&&this.m_colorAlpha.setDomEvent("mousedown",i=>{P.setCapture(this,s=>this._alphaChange(s))}),this._updateColor()}set color(e){this.m_baseColor=e,this.m_baseHSV=Ve.toHSV(this.m_baseColor),this._updateColor()}get color(){return this.m_baseColor}_selChange(e){let t=ms(e,!0);console.log(t);let i=this.m_colorSel.getBoundingRect();this.m_props.hasAlpha||(this.m_baseHSV.a=1),this.m_baseHSV.s=vn((t.x-i.left)/i.width,0,1),this.m_baseHSV.v=1-vn((t.y-i.top)/i.height,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&P.releaseCapture()}_hueChange(e){let t=ms(e,!0),i=this.m_colorHue.getBoundingRect();this.m_baseHSV.h=vn((t.y-i.top)/i.height,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&P.releaseCapture()}_alphaChange(e){let t=ms(e,!0),i=this.m_colorAlpha.getBoundingRect();this.m_baseHSV.a=vn((t.x-i.left)/i.width,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&P.releaseCapture()}_updateColor(e=!0){let t;if(this.m_palmode)this.m_transpCk.check=this.m_baseHSV.a==0;else{if(t=Ve.fromHSV(this.m_baseHSV.h,1,1,1),this.m_colorSel.setStyleValue("backgroundColor",t.toString()),t=Ve.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,1),this.m_sample.setStyleValue("backgroundColor",t.toString()),this.m_props.hasAlpha){let i=`linear-gradient(to right, rgba(0,0,0,0) 0%, ${t.toString()} 100%)`;this.m_colorAlpha.itemWithRef("color").setStyleValue("backgroundImage",i)}this.m_selMark.setStyle({left:this.m_baseHSV.s*100+"%",top:100-this.m_baseHSV.v*100+"%"}),this.m_hueMark.setStyle({top:this.m_baseHSV.h*100+"%"}),this.m_props.hasAlpha?this.m_alphaMark.setStyle({left:this.m_baseHSV.a*100+"%"}):this.m_transpCk.check=this.m_baseHSV.a==0}t=Ve.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,this.m_baseHSV.a),this.m_baseColor=t,e&&(this.m_colorEdit.value=t.alpha()==1?t.toHex():t.toString()),this._change()}_change(){this.emit("change",qe(this.m_baseColor))}},"_ColorPicker3"),G_=Yu;d(G_,"ColorPicker");_e(G_,"last_palmode",!1);var Sh=m(class extends nc{m_picker;constructor(e){e.icon=void 0,e.buttons=void 0,super(e),this.mapPropEvents(e,"change"),this.m_picker=new G_({color:e.color,hasAlpha:e.hasAlpha,style:{padding:8},width:250,height:250});let t=this._makeCustoms(e.cust_colors);this.form.updateContent([new Dt({content:[this.m_picker,t]})],["ok","cancel"]),this.on("btnClick",i=>{i.button=="ok"&&this.emit("change",qe(this.m_picker.color))})}_makeCustoms(e){let t=null;if(e&&e.length>0){let i=[];for(let s=0;s<e.length;s+=8){let r=[];for(let n=0;n<8;n++){let l=s+n,o=e[l];r.push(new Ne({cls:"cust-cc",text:"",flex:1,style:{backgroundColor:o?o.toString():"transparent"},tooltip:o?o.toString():void 0,dom_events:{click:()=>{o&&(this.m_picker.color=o,this.emit("change",qe(o)),this.close())}}}))}i.push(new ce({cls:"line",content:r}))}t=new Dt({cls:"customs",content:i})}return t}set color(e){this.m_picker.color=e}get color(){return this.m_picker.color}static show(e){let t;return He(e)?t=new Sh({color:new Ve(e)}):t=new Sh(e),t.show(),t}},"ColorPickerBox3");d(Sh,"ColorPickerBox");var Wx=m(class extends ce{constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){let t=e.color,i;this._isTransp(t)?(t=Ve.NONE,i="black"):i=Ve.contrastColor(t).toString(),this.setContent([e.label?new Ne({cls:"label",text:e.label,flex:e.labelWidth<0?-e.labelWidth:void 0,width:e.labelWidth>=0?e.labelWidth:void 0}):null,new P({flex:1,content:[new Ne({cls:"alpha @fit",text:""}),new Ne({cls:"value @fit",text:e.displayValue===!1?"":t.toHex(),style:{backgroundColor:t.toString(),color:i},dom_events:{click:()=>this._showPicker()}})]})]),e.displayValue===!1&&this.setStyleValue("background-image","url( 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAEsmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIKICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIKICAgIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIgogICAgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSIKICAgdGlmZjpJbWFnZVdpZHRoPSIxMCIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgeG1wOk1vZGlmeURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiPgogICA8eG1wTU06SGlzdG9yeT4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJwcm9kdWNlZCIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWZmaW5pdHkgRGVzaWduZXIgMS45LjAiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/Pn8+b7YAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRy0tCQRSHv7Qwyh5gRIsWEtZKwwyiNi2UXlAt1CCrjV5fgdrlXiOibdBWKIja9FrUX1DboHUQFEUQ7YLWRW0qbueqoESe4cz55jdzDjNnwBLOKFm93gvZXF4LTvid85EFp+0FK5204sURVXR1JjQepqZ93lNnxluPWav2uX+tOZ7QFahrFB5VVC0vPCk8vZZXTd4R7lDS0bjwmbBbkwsK35l6rMSvJqdK/G2yFg4GwNIu7ExVcayKlbSWFZaX48pmVpXyfcyX2BO5uZDEHvFudIJM4MfJFGMEGGKAEZmH8OCjX1bUyPcW82dZkVxFZpV1NJZJkSaPW9RVqZ6QmBQ9ISPDutn/v33Vk4O+UnW7HxqeDeO9F2zb8FMwjK8jw/g5BusTXOYq+SuHMPwheqGiuQ6gbRPOrypabBcutqDrUY1q0aJkFbckk/B2Ci0RcNxA02KpZ+V9Th4gvCFfdQ17+9An59uWfgF7Hmfv4QYbGAAAAAlwSFlzAAALEwAACxMBAJqcGAAAACdJREFUGJVjbGhoYEAC9fX1yFwmBryAptKM////R+Y3NjbSzW4C0gAo9QeQBmhTIwAAAABJRU5ErkJggg=='"),this._setTabIndex(e.tabIndex)}set value(e){this.m_props.color=e,this.update()}get value(){return this.m_props.color}set custom_colors(e){this.m_props.cust_colors=e}_showPicker(){let e=new Sh({color:this.m_props.color,cust_colors:this.m_props.cust_colors,hasAlpha:this.m_props.hasAlpha,events:{change:i=>{this.m_props.color=i.value,this._change(),this.update()}}}),t=this.getBoundingRect();e.displayAt(t.left,t.bottom,"tl")}_change(){this.emit("change",qe(this.m_props.color))}_isTransp(e){return!e.alpha()}},"ColorPickerEditor3");d(Wx,"ColorPickerEditor");var jx=[{color:"Red",variations:[{weight:50,hex:16772078},{weight:100,hex:16764370},{weight:200,hex:15702682},{weight:300,hex:15037299},{weight:400,hex:15684432},{weight:500,hex:16007990},{weight:600,hex:15022389},{weight:700,hex:13840175},{weight:800,hex:12986408},{weight:900,hex:12000284}]},{color:"Pink",variations:[{weight:50,hex:16573676},{weight:100,hex:16301008},{weight:200,hex:16027569},{weight:300,hex:15753874},{weight:400,hex:15483002},{weight:500,hex:15277667},{weight:600,hex:14162784},{weight:700,hex:12720219},{weight:800,hex:11342935},{weight:900,hex:8916559}]},{color:"Purple",variations:[{weight:50,hex:15984117},{weight:100,hex:14794471},{weight:200,hex:13538264},{weight:300,hex:12216520},{weight:400,hex:11225020},{weight:500,hex:10233776},{weight:600,hex:9315498},{weight:700,hex:8069026},{weight:800,hex:6953882},{weight:900,hex:4854924}]},{color:"Deep Purple",variations:[{weight:50,hex:15591414},{weight:100,hex:13747433},{weight:200,hex:11771355},{weight:300,hex:9795021},{weight:400,hex:8280002},{weight:500,hex:6765239},{weight:600,hex:6174129},{weight:700,hex:5320104},{weight:800,hex:4532128},{weight:900,hex:3218322}]},{color:"Indigo",variations:[{weight:50,hex:15264502},{weight:100,hex:12962537},{weight:200,hex:10463450},{weight:300,hex:7964363},{weight:400,hex:6056896},{weight:500,hex:4149685},{weight:600,hex:3754411},{weight:700,hex:3162015},{weight:800,hex:2635155},{weight:900,hex:1713022}]},{color:"Blue",variations:[{weight:50,hex:14938877},{weight:100,hex:12312315},{weight:200,hex:9489145},{weight:300,hex:6600182},{weight:400,hex:4367861},{weight:500,hex:2201331},{weight:600,hex:2001125},{weight:700,hex:1668818},{weight:800,hex:1402304},{weight:900,hex:870305}]},{color:"Light Blue",variations:[{weight:50,hex:14808574},{weight:100,hex:11789820},{weight:200,hex:8508666},{weight:300,hex:5227511},{weight:400,hex:2733814},{weight:500,hex:240116},{weight:600,hex:236517},{weight:700,hex:166097},{weight:800,hex:161725},{weight:900,hex:87963}]},{color:"Cyan",variations:[{weight:50,hex:14743546},{weight:100,hex:11725810},{weight:200,hex:8445674},{weight:300,hex:5099745},{weight:400,hex:2541274},{weight:500,hex:48340},{weight:600,hex:44225},{weight:700,hex:38823},{weight:800,hex:33679},{weight:900,hex:24676}]},{color:"Teal",variations:[{weight:50,hex:14742257},{weight:100,hex:11722715},{weight:200,hex:8440772},{weight:300,hex:5093036},{weight:400,hex:2533018},{weight:500,hex:38536},{weight:600,hex:35195},{weight:700,hex:31083},{weight:800,hex:26972},{weight:900,hex:19776}]},{color:"Green",variations:[{weight:50,hex:15267305},{weight:100,hex:13166281},{weight:200,hex:10868391},{weight:300,hex:8505220},{weight:400,hex:6732650},{weight:500,hex:5025616},{weight:600,hex:4431943},{weight:700,hex:3706428},{weight:800,hex:3046706},{weight:900,hex:1793568}]},{color:"Light Green",variations:[{weight:50,hex:15857897},{weight:100,hex:14478792},{weight:200,hex:12968357},{weight:300,hex:11457921},{weight:400,hex:10275941},{weight:500,hex:9159498},{weight:600,hex:8172354},{weight:700,hex:6856504},{weight:800,hex:5606191},{weight:900,hex:3369246}]},{color:"Lime",variations:[{weight:50,hex:16382951},{weight:100,hex:15791299},{weight:200,hex:15134364},{weight:300,hex:14477173},{weight:400,hex:13951319},{weight:500,hex:13491257},{weight:600,hex:12634675},{weight:700,hex:11514923},{weight:800,hex:10394916},{weight:900,hex:8550167}]},{color:"Yellow",variations:[{weight:50,hex:16776679},{weight:100,hex:16775620},{weight:200,hex:16774557},{weight:300,hex:16773494},{weight:400,hex:16772696},{weight:500,hex:16771899},{weight:600,hex:16635957},{weight:700,hex:16498733},{weight:800,hex:16361509},{weight:900,hex:16088855}]},{color:"Amber",variations:[{weight:50,hex:16775393},{weight:100,hex:16772275},{weight:200,hex:16769154},{weight:300,hex:16766287},{weight:400,hex:16763432},{weight:500,hex:16761095},{weight:600,hex:16757504},{weight:700,hex:16752640},{weight:800,hex:16748288},{weight:900,hex:16740096}]},{color:"Orange",variations:[{weight:50,hex:16774112},{weight:100,hex:16769202},{weight:200,hex:16764032},{weight:300,hex:16758605},{weight:400,hex:16754470},{weight:500,hex:16750592},{weight:600,hex:16485376},{weight:700,hex:16088064},{weight:800,hex:15690752},{weight:900,hex:15094016}]},{color:"Deep Orange",variations:[{weight:50,hex:16509415},{weight:100,hex:16764092},{weight:200,hex:16755601},{weight:300,hex:16747109},{weight:400,hex:16740419},{weight:500,hex:16733986},{weight:600,hex:16011550},{weight:700,hex:15092249},{weight:800,hex:14172949},{weight:900,hex:12531212}]},{color:"Brown",variations:[{weight:50,hex:15723497},{weight:100,hex:14142664},{weight:200,hex:12364452},{weight:300,hex:10586239},{weight:400,hex:9268835},{weight:500,hex:7951688},{weight:600,hex:7162945},{weight:700,hex:6111287},{weight:800,hex:5125166},{weight:900,hex:4073251}]},{color:"Grey",variations:[{weight:50,hex:16448250},{weight:100,hex:16119285},{weight:200,hex:15658734},{weight:300,hex:14737632},{weight:400,hex:12434877},{weight:500,hex:10395294},{weight:600,hex:7697781},{weight:700,hex:6381921},{weight:800,hex:4342338},{weight:900,hex:2171169}]},{color:"Blue Grey",variations:[{weight:50,hex:15527921},{weight:100,hex:13621468},{weight:200,hex:11583173},{weight:300,hex:9479342},{weight:400,hex:7901340},{weight:500,hex:6323595},{weight:600,hex:5533306},{weight:700,hex:4545124},{weight:800,hex:3622735},{weight:900,hex:2503224}]},{color:"Grey",variations:[{weight:50,hex:16777215},{weight:100,hex:14737632},{weight:200,hex:12895428},{weight:300,hex:11053224},{weight:400,hex:9211020},{weight:500,hex:7368816},{weight:600,hex:5526612},{weight:700,hex:3684408},{weight:800,hex:1842204},{weight:900,hex:0}]}];function Ar(e,t){return Pe({type:e,id:t})}h(Ar,"EvDataChange3");m(Ar,"EvDataChange3");d(Ar,"EvDataChange");var r0=m(class{name;id;fields;constructor(e){this.name=e,this.id=void 0,this.fields=[]}},"MetaInfos3");d(r0,"MetaInfos");var Ha=Symbol("metaField");function qn(e,t=!0){let i=e.constructor,s=i.hasOwnProperty(Ha)?i[Ha]:void 0;if(s===void 0){t||console.assert(s!==void 0),s=new r0(i.name);let r=Object.getPrototypeOf(i);if(r!=lc){let n=r[Ha];s.fields=[...n.fields,...s.fields],console.assert(s.id===void 0,"cannot define mutiple record id"),s.id||(s.id=n.id)}e.constructor[Ha]=s}return s}h(qn,"_getMetas3");m(qn,"_getMetas3");d(qn,"_getMetas");var Yf;(e=>{function t(){return(u,_)=>{let p=qn(u);p.fields.push({name:_,type:"any",required:!0}),p.id=_}}h(t,"id"),m(t,"id"),e.id=t,d(t,"id");function i(u){return(_,p)=>{qn(_).fields.push({name:p,...u})}}h(i,"field"),m(i,"field"),e.field=i,d(i,"field");function s(u){return i({...u,type:"string"})}h(s,"string"),m(s,"string"),e.string=s,d(s,"string");function r(u){return i({...u,type:"int"})}h(r,"int"),m(r,"int"),e.int=r,d(r,"int");function n(u){return i({...u,type:"float"})}h(n,"float"),m(n,"float"),e.float=n,d(n,"float");function l(u){return i({...u,type:"bool"})}h(l,"bool"),m(l,"bool"),e.bool=l,d(l,"bool");function o(u){return i({...u,type:"date"})}h(o,"date"),m(o,"date"),e.date=o,d(o,"date");function a(u){return i({...u,type:"calc"})}h(a,"calc"),m(a,"calc"),e.calc=a,d(a,"calc");function c(u,_){return e.field({..._,type:"array",model:new u})}h(c,"array"),m(c,"array"),e.array=c,d(c,"array")})(Yf||(Yf={}));var lc=m(class{constructor(e,t){e!==void 0&&this.unSerialize(e,t)}clone(e){let t=new this.constructor;return e&&t.unSerialize(e),t}getID(){let e=qn(this,!1);return this[e.id]}getFields(){return qn(this,!1).fields}validate(){let e=null;return this.getFields().forEach(i=>{i.required&&!this.getField(i.name)&&(e&&(e=[]),e.push(new Error(`field ${i.name} is required.`)))}),e}getFieldIndex(e){return this.getFields().findIndex(i=>i.name==e)}serialize(){let e={};return this.getFields().forEach(t=>{t.calc===void 0&&(e[t.name]=e[t.name])}),e}unSerialize(e,t){let i=this.getFields();return i.forEach(s=>{let r=e[s.name];r!==void 0&&(this[s.name]=this._convertField(s,r))}),t!==void 0?this[i[0].name]=t:console.assert(this.getID()!==void 0),this}_convertField(e,t){switch(e.type){case"float":{let i=typeof t=="number"?t:parseFloat(t);if(e.prec!==void 0){let s=Math.pow(10,e.prec);i=Math.round(i*s)/s}return i}case"int":return typeof t=="number"?t:parseInt(t);case"date":return He(t)?new Date(t):t;case"array":{let i=[];if(e.model)return t.forEach(s=>{i.push(e.model.clone(s))}),i;break}}return t}getRaw(e){let t,i=this.getFields();if(typeof e=="string"){if(t=i.findIndex(r=>r.name==e),t<0){console.assert(!1,"unknown field: "+e);return}}else if(e>=0&&e<i.length)t=e;else{console.assert(!1,"bad field name: "+e);return}let s=i[t];return s.calc!==void 0?s.calc(this):this[s.name]}setRaw(e,t){this[e]=t}getField(e){let t=this.getRaw(e);return t==null?"":""+t}setField(e,t){let i=this.getFields(),s=i.findIndex(n=>n.name==e);if(s<0){console.assert(!1,"unknown field: "+e);return}let r=i[s];if(r.calc!==void 0){console.assert(!1,"cannot set calc field: "+e);return}this.setRaw(r.name,t)}},"Record3");d(lc,"Record");var n0=m(class extends lc{m_data;m_fid;constructor(e){super(),this.m_data=e}getID(){if(!this.m_fid){let e=Object.keys(this.m_data);this.m_fid=e[0]}return this.m_data[this.m_fid]}getFields(){return Object.keys(this.m_data).map(i=>({name:i}))}getRaw(e){return this.m_data[e]}setRaw(e,t){this.m_data[e]=t}clone(e){return new n0({...e})}},"AutoRecord3");d(n0,"AutoRecord");var l0=m(class extends Zn{constructor(e){super(e)}load(e){e&&(this.m_props.url=e),this._refresh()}_refresh(e=0){let t=d(async()=>{let i=this.m_props.url;this.m_props.params&&(i+="?"+this.m_props.params.join("&"));let s=await fetch(i);if(s.ok){let r=await s.json(),n=r;this.m_props.solver&&(n=this.m_props.solver(n)),this.emit("change",qe(n,r))}},"load");e?setTimeout(t,e):t()}},"DataProxy3");d(l0,"DataProxy");var N_=m(class extends wo{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 l0({url:e.url,solver:e.solver,events:{change:t=>{this.setData(t.value)}}}),this.m_proxy.load())}load(e){this.m_proxy.load(e)}reload(){this.m_proxy.load()}setData(e){let t=[];e.forEach(i=>{t.push(this.m_model.clone(i))}),this.setRawData(t)}setRawData(e){this.m_records=e,this._rebuildIndex(),this.emit("data_change",Ar("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=e.getID(),i=this.indexOfId(t);return i<0?!1:(this.m_records[this.m_rec_index[i]]=e,this.emit("data_change",Ar("update",t)),!0)}append(e){e instanceof lc||(e=this.m_model.clone().unSerialize(e)),console.assert(e.getID()),this.m_records.push(e),this._rebuildIndex(),this.emit("data_change",Ar("create",e.getID()))}getMaxId(){let e;return this.m_records.forEach(t=>{let i=t.getID();(e===void 0||e<i)&&(e=i)}),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.emit("data_change",Ar("delete",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){for(let t=this.count,i=0;t!=0;t>>=1){let s=i+(t>>1),r=this.m_rec_index[s],n=this.m_records[r].getID();if(n==e)return s;n<e&&(i=s+1,t--)}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){return this.m_records[e]??null}moveTo(e){e.setRawData(this.m_records)}createView(e){let t={...e,store:this};return new o0(t)}createIndex(e){if(e&&e.op==="empty-result")return new Uint32Array(0);let t=new Uint32Array(this.m_records.length),i=0;if(!e)this.forEach((u,_)=>{t[i++]=_});else if(typeof e.op=="function"){let u=e.op;this.forEach((_,p)=>{_&&u(_)&&(t[i++]=p)})}else{let u=m(function(w){return w<k},"_lt2"),_=m(function(w){return w<=k},"_le2"),p=m(function(w){return w==k},"_eq2"),v=m(function(w){return w!=k},"_neq2"),g=m(function(w){return w>=k},"_ge2"),x=m(function(w){return w>k},"_gt2"),E=m(function(w){return S.lastIndex=-1,S.test(w)},"_re2");var s=u,r=_,n=p,l=v,o=g,a=x,c=E;d(u,"_lt"),d(_,"_le"),d(p,"_eq"),d(v,"_neq"),d(g,"_ge"),d(x,"_gt"),d(E,"_re");let y=this.m_model.getFieldIndex(e.field);if(y<0)return console.assert(!1,"unknown field name in filter"),new Uint32Array(0);let k=e.value;He(k)&&!e.caseSensitive&&(k=k.toUpperCase());let A,S;if(k instanceof RegExp)S=k,A=E;else switch(e.op){case"<":{A=u;break}case"<=":{A=_;break}case"=":{A=p;break}case">=":{A=g;break}case">":{A=x;break}case"<>":{A=v;break}}this.forEach((w,D)=>{if(!w)return;let R=w.getRaw(y);R==null?R="":(R=""+R,e.caseSensitive||(R=R.toUpperCase())),A(R)&&(t[i++]=D)})}return t.slice(0,i)}sortIndex(e,t){let i=0,s=[];if(t===null?s.push({fidx:0,asc:!0}):s=t.map(r=>{let n=this.m_model.getFieldIndex(r.field);return n==-1&&(console.assert(!1,"unknown field name in sort"),i++),{fidx:n,asc:r.ascending}}),i||s.length==0)return e;if(s.length==1){let r=s[0].fidx;e.sort((n,l)=>{let o=this.getByIndex(n).getRaw(r)??"",a=this.getByIndex(l).getRaw(r)??"";return o>a?1:o<a?-1:0}),s[0].asc||e.reverse()}else e.sort((r,n)=>{for(let l=0;l<s.length;l++){let o=s[l].fidx,a=s[l].asc?1:-1,c=this.getByIndex(r).getRaw(o)??"",u=this.getByIndex(n).getRaw(o)??"";if(c>u)return a;if(c<u)return-a}return 0});return e}forEach(e){this.m_rec_index?this.m_rec_index.some((t,i)=>{if(e(this.m_records[t],i))return i}):this.m_records.some((t,i)=>{if(t&&e(t,i))return i})}export(){return this.m_records}changed(){this.emit("data_change",Ar("change"))}},"DataStore3");d(N_,"DataStore");function bn(e){return Pe({action:e})}h(bn,"EvViewChange3");m(bn,"EvViewChange3");d(bn,"EvViewChange");var o0=m(class extends Zn{m_index;m_store;m_sort;m_filter;constructor(e){super(e),this.m_store=e.store,this.m_index=null,this.m_filter=null,this.m_sort=null,this.filter(e.filter),e.order?He(e.order)?this.sort([{field:e.order,ascending:!0}]):mi(e.order)?this.sort(e.order):this.sort([e.order]):this.sort(null),this.m_store.on("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.emit("view_change",bn("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.emit("view_change",bn("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.emit("view_change",bn("sort"))}get store(){return this.m_store}get count(){return this.m_index.length}indexOfId(e){let t=this.m_store.indexOfId(e);return this.m_index.findIndex(i=>i===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}getById(e){return this.m_store.getById(e)}changed(){this.emit("view_change",bn("change"))}forEach(e){debugger;this.m_index.some(t=>{let i=this.m_store.getByIndex(t);if(i&&e(i,t))return t})}},"DataView3");d(o0,"DataView");var Xu=m(class extends ce{m_ui_input;m_ui_button;m_popup;m_lockpop;m_lockchg;m_popvis;m_selection;constructor(e){super(e),e.editable||this.setDomEvent("keypress",()=>this.showPopup()),this.setDomEvent("click",()=>{this.m_props.editable&&this.m_ui_input.focus(),this.showPopup()}),this.setDomEvent("keydown",t=>this._onKey(t)),this.mapPropEvents(e,"selectionChange"),this.m_popvis=!1,this.m_lockpop=!1,this.m_lockchg=!1}_onKey(e){this.m_popvis&&(e.key=="ArrowUp"||e.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(e),this.m_lockpop=!1,e.preventDefault(),e.stopPropagation()):e.key=="Escape"&&(this._hidePopup(),e.preventDefault(),e.stopPropagation()))}set items(e){this.m_props.items=e,this.m_popup&&(this.m_popup.items=e)}render(e){if(e.renderer)this.m_ui_input=new P({flex:1,cls:"@fake-input @hlayout",tabIndex:1});else{let r=new is({flex:1,readOnly:!this.m_props.editable,tabIndex:0,name:e.name,value_hook:{get:()=>this.value,set:n=>{this.value=n}},dom_events:{focus:()=>{this.m_props.editable&&r.value.length==0&&this.showPopup()},input:()=>{if(this.m_lockchg)return;let n=r.value;this.m_selection={id:void 0,text:n};let l=this.showPopup();l&&l.length&&l[0].text==n&&(this.m_selection={id:l[0].id,text:n})}}});this.m_ui_input=r}let t,i,s=e.labelWidth??0;s>0?t=s:s<0&&(i=-s),this.setContent([new Ne({cls:"label1"+(e.label?"":" @hidden"),text:e.label,width:t,flex:i,align:e.labelAlign}),new ce({flex:1,content:[this.m_ui_input,this.m_ui_button=new xt({cls:"gadget",icon:"var( --x4-icon-angle-down )",tabIndex:!1,click:()=>{this.showPopup(!1)},dom_events:{focus:()=>{this.dom.focus()}}})]})]),e.value!==void 0&&(this.value=e.value)}componentDisposed(){this.m_popup&&this.m_popup.close(),super.componentDisposed()}showPopup(e=!0){let t=this.m_props;if(t.readOnly||this.hasClass("@disable"))return null;let i=t.items;if(Di(i)){let n=e?this.m_ui_input.value:null;i=i(n)}if(i.length==0)return null;if(!this.m_popup){let n=this.getComputedStyle(),l=n.value("fontFamily"),o=n.value("fontSize");this.m_popup=new I_({cls:"@combo-popup",populate:t.populate,renderItem:this.m_props.renderer,selectionChange:a=>{this._selectItem(a),this.m_lockpop||(this._hidePopup(),this.focus())},cancel:a=>this.signal("cancel",a),style:{fontFamily:l,fontSize:o}})}this.m_popup.items=i;let s=this.m_ui_button.getBoundingRect(),r=this.m_ui_input.getBoundingRect();return this.m_popup.setStyle({minWidth:s.right-r.left}),this.m_popup.displayAt(r.left,r.bottom),this.m_popvis=!0,this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.value!==void 0&&(this.m_popup.selection=this.value),i}_selectItem(e){let t=e.selection;t&&(this.m_lockchg=!0,this._setInput(t,!0),this.m_lockchg=!1,this.m_selection={id:t.id,text:t.text},this.emit("selectionChange",Zi(t)),this.emit("change",qe(t.id)))}_setInput(e,t=!1){e?this.m_ui_input?this.m_ui_input instanceof is?(this.m_ui_input.value=e.text,t&&this.m_ui_input.dom.dispatchEvent(new Event("input"))):this.m_ui_input.setContent(this.m_props.renderer(e)):this.m_props.value=e.id:this.m_ui_input&&this.m_ui_input instanceof is&&(this.m_ui_input.value="")}get value(){return this.m_selection?this.m_selection.id:void 0}get valueText(){return this.m_selection?this.m_selection.text:this.m_props.editable?this.m_ui_input.value:""}set value(e){let t=this.m_props.items;Di(t)&&(t=t(null)),t.some(s=>{if(s.id===e)return this._setInput(s),this.m_selection=s,!0})||(this._setInput(null),this.m_selection=null)}get input(){return this.m_ui_input instanceof is?this.m_ui_input:null}_checkFocus(){let e=document.activeElement;this.dom&&this.dom.contains(e)||e==document.body||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(e)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1,this.stopTimer("focus-check"))}static storeProxy(e){let t=e.store instanceof N_?e.store.createView():e.store;return()=>{let i=new Array(e.store.count);return e.store.forEach((s,r)=>{i[r]={id:s.getID(),text:e.display(s)}}),i}}focus(){this.m_props.editable?this.m_ui_input.focus():super.focus()}},"ComboBox3");d(Xu,"ComboBox");var wu=Symbol("x-drag-cb"),a0=m(class{dragSource;dragGhost;dropTarget;notified;timer;registerDraggableElement(e){e.setDomEvent("dragstart",t=>{this.dragSource=e,this.dragGhost=e.dom.cloneNode(!0),this.dragGhost.classList.add("dragged"),B.body.appendChild(this.dragGhost),e.addClass("dragging"),t.dataTransfer.setData("text/string","1"),t.dataTransfer.setDragImage(new Image,0,0),t.stopPropagation()}),e.setDomEvent("drag",t=>{this.dragGhost.style.left=t.pageX+"px",this.dragGhost.style.top=t.pageY+"px"}),e.setDomEvent("dragend",t=>{e.removeClass("dragging"),this.dragGhost.remove()}),e.setAttribute("draggable","true")}registerDropTarget(e,t,i){let s=d(o=>{if(i&&!i(this.dragSource)){console.log("reject ",e),o.dataTransfer.dropEffect="none";return}console.log("accepted ",e),o.preventDefault(),o.dataTransfer.dropEffect="copy"},"dragEnter"),r=d(o=>{if(i&&!i(this.dragSource)){console.log("reject ",e),o.dataTransfer.dropEffect="none";return}if(o.preventDefault(),this.dropTarget!=e&&(this.dropTarget=e,this._startCheck()),this.dropTarget){let a={pt:new Ui(o.pageX,o.pageY),data:o.dataTransfer};t("drag",this.dragSource,a)}o.dataTransfer.dropEffect="copy"},"dragOver"),n=d(o=>{this.dropTarget=null,o.preventDefault()},"dragLeave"),l=d(o=>{let a={pt:new Ui(o.pageX,o.pageY),data:o.dataTransfer};t("drop",this.dragSource,a),this.dropTarget=null,e.removeClass("drop-over"),o.preventDefault()},"drop");e.setDomEvent("dragenter",s),e.setDomEvent("dragover",r),e.setDomEvent("dragleave",n),e.setDomEvent("drop",l),e.setData(wu,t)}_startCheck(){this.timer&&(clearInterval(this.timer),this._check()),this.timer=setInterval(()=>this._check(),300)}_check(){let e=d(i=>{i.removeClass("drop-over"),i.getData(wu)("leave",this.dragSource)},"leaving"),t=d(i=>{i.addClass("drop-over"),i.getData(wu)("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))}},"DragManager3");d(a0,"DragManager");var EC=new a0,Gx={align:"center",vAlign:"middle",fontSize:14,fontWeight:null,fontStyle:"",fontVariant:"",fontFamily:"Arial",lineHeight:0,clip:!0,columns:1,columnGap:0,lineBreak:!0};function h0(e,t,i,s){if(i.width<=0||i.height<=0)return;if(s={...Gx,...s},e.save(),s.clip&&(e.beginPath(),e.rect(i.left,i.top,i.width,i.height),e.clip()),s.rotation){let C=new Ui(i.left+i.width/2,i.top+i.height/2),z=s.rotation/180*Math.PI;e.translate(C.x,C.y),e.rotate(z),e.translate(-C.x,-C.y)}e.textBaseline="bottom";let r=Qn(s.fontSize,2)??12,n="";s.fontStyle&&(n+=s.fontStyle+" "),s.fontVariant&&(n+=s.fontVariant+" "),s.fontWeight&&(n+=s.fontWeight+" "),n+=r+"px ";let l=s.fontFamily??"sans-serif";l.indexOf(".")>0&&(l='"'+l+'"'),n+=l,e.font=n.trim();let o=[],a=t.split(`
|
|
25
|
+
`),c=s.columns<1?1:s.columns,u=s.columnGap,_=(i.width-u*(c-1))/c,p=i.left,v=_;s.lineBreak||(v=99999999);let g=Yl(e," ");a.forEach(C=>{let z={width:0,words:[],space:0},W=Yl(e,C);if(W<v)z.width=W,z.words.push({width:W,text:C}),o.push(z);else{let ve=C.split(/\s/).filter(K=>K!=="").map(K=>({width:Yl(e,K),text:K})),te=0,ie=0;for(;te<ve.length;){let K=ve[te],Y=z.width;Y&&(Y+=g),Y+=K.width,Y>_&&ie>0?(o.push(z),ie=0,W=0,z={width:0,words:[],space:0}):(z.words.push(K),z.width=Y,te++,ie++)}ie&&(o.push(z),z.last=!0)}});let x=U_(e,"Ag"),E=(s.lineHeight??1.3)*x,y=o.length,k=i.top;if(c==1){let C=E*y;y==1&&(E=x,C=x),s.vAlign==="middle"?(k=i.top+i.height/2-C/2,k+=E/2,e.textBaseline="middle"):s.vAlign==="bottom"?C<i.height&&(k=i.top+i.height-C+E):(k=i.top,e.textBaseline="top")}else k+=x;let A=s.align=="justify",S=c,w=k,D=0;switch(s.align){case"right":D=1;break;case"center":D=2;break}let R=0;return o.some(C=>{C.space=g,A&&!C.last&&$_(C,_,g);let z=p,W=0;if(D==1?z+=_-C.width:D==2&&(z+=_/2-C.width/2),C.words.forEach(J=>{e.fillText(J.text,z,w),z+=J.width+C.space,W+=J.width+C.space}),w+=E,R<W&&(R=W),w>i.bottom+E&&(w=k,p+=_+u,--S==0))return!0}),e.restore(),{width:R,height:(o.length+.3)*E}}h(h0,"drawText3");m(h0,"drawText3");d(h0,"drawText");function U_(e,t){let i=e.measureText(t);return i.actualBoundingBoxAscent+i.actualBoundingBoxDescent}h(U_,"_calcTextHeight3");m(U_,"_calcTextHeight3");d(U_,"_calcTextHeight");function Yl(e,t){return Qn(e.measureText(t).width,2)}h(Yl,"_measureText3");m(Yl,"_measureText3");d(Yl,"_measureText");function $_(e,t,i){let s=(t-e.width)/(e.words.length-1)+i;s<=0||(e.width=t,e.space=s)}h($_,"_justify3");m($_,"_justify3");d($_,"_justify");var bu="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";function Dh(e){return e.substr(0,5)=="data:"}h(Dh,"_isStaticImage3");m(Dh,"_isStaticImage3");d(Dh,"_isStaticImage");var Ls=m(class extends P{m_created;m_lazysrc;constructor(e){super(e),this.m_created=!1,this.m_props.lazy=e.lazy!==!1,this.m_props.alt=e.alt,e.lazy!==!1&&(this.m_lazysrc=e.src,e.src=bu),this.setDomEvent("create",()=>{e.lazy&&this.setImage(this.m_lazysrc,!0)})}render(){let e=this.m_props,t=new P({tag:"img",attrs:{draggable:!1,alt:e.alt??"",decoding:e.lazy?"async":void 0},style:{objectFit:e.alignment?e.alignment:void 0}});this.setContent(t)}setImage(e,t){e||(e=bu),this.m_props.lazy?(t||this.m_lazysrc!=e)&&(Dh(e)?(this.m_props.src=e,this.m_lazysrc=e,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src)):(this.m_props.src=bu,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src),this.m_lazysrc=e,this.dom&&this._update_image())):(this.m_props.src=e,this.m_lazysrc=e,this.dom&&this.dom.firstChild.setAttribute("src",e))}_update_image(){console.assert(!!this.dom),this.m_lazysrc&&!Dh(this.m_lazysrc)&&(Ls.lazy_images_waiting.push({dom:this.dom,src:this.m_lazysrc}),Ls.lazy_image_timer===void 0&&(Ls.lazy_image_timer=setInterval(Ls.lazyWatch,10)))}static lazyWatch(){let e=[],t=0;Ls.lazy_images_waiting.forEach(i=>{let s=i.dom,r=i.src;if(!s||s.offsetParent===null)return;let n=s.getBoundingClientRect();!t&&s.offsetParent!==null&&n.bottom>=0&&n.right>=0&&n.top<=(window.innerHeight||B.documentElement.clientHeight)&&n.left<=(window.innerWidth||B.documentElement.clientWidth)?(s.firstChild.setAttribute("src",r),t++):e.push(i)}),Ls.lazy_images_waiting=e,e.length==0&&(clearInterval(Ls.lazy_image_timer),Ls.lazy_image_timer=void 0)}},"_Image3"),oc=Ls;d(oc,"Image");_e(oc,"lazy_images_waiting",[]);_e(oc,"lazy_image_timer");var m0=m(class extends ce{constructor(e){super(e)}clear(){this.m_props.value=""}},"FileUpload3");d(m0,"FileUpload");var Nx=m(class extends m0{m_path;m_ui_img;m_ui_input;render(e){let t="up"+this.uid;this.setContent([new P({tag:"label",attrs:{for:t},content:[this.m_ui_img=new oc({src:this.m_props.value})]}),this.m_ui_input=new is({cls:"@hidden",id:t,type:"file",name:this.m_props.name,value_hook:{get:()=>this._get_value(),set:i=>{this._set_value(i)}},attrs:{accept:"image/*"},dom_events:{change:i=>{this._handleChange(i)}}})])}clear(){super.clear(),this.m_ui_input.dom.value="",this.m_ui_img.setImage(null,!1)}_get_value(){return this.m_path}_set_value(e){debugger}_handleChange(e){let t=this;function i(l){let o=new FileReader;o.addEventListener("load",a=>{t.m_ui_img.setImage(o.result.toString())}),o.readAsDataURL(l)}h(i,"createThumbnail"),m(i,"createThumbnail"),d(i,"createThumbnail");let s=["png","jpg","jpeg","gif"],r=e.target.files,n=r.length;for(let l=0;l<n;l++){let o=r[l].name.split(".");if(o=o[o.length-1],o=o.toLowerCase(),s.indexOf(o)!=-1){i(r[l]),this.m_path=r[l];break}}}},"ImageUpload3");d(Nx,"ImageUpload");var Ll=null;function ac(){return Ll||(Ll=new P({tag:"input",style:{display:"none",id:"fileDialog"},attrs:{type:"file"}}),B.body.appendChild(Ll._build())),Ll.clearDomEvent("change"),Ll}h(ac,"_createFileInput3");m(ac,"_createFileInput3");d(ac,"_createFileInput");function c0(e,t,i=!1){let s=ac();s.removeAttribute("nwsaveas"),s.setAttribute("accept",e),s.setAttribute("multiple",i),s.setDomEvent("change",r=>{let n=s.dom.files;t(n)}),s.dom.click()}h(c0,"openFileDialog3");m(c0,"openFileDialog3");d(c0,"openFileDialog");function u0(e,t,i){let s=ac();s.setAttribute("nwsaveas",e),s.setAttribute("accept",t),s.setDomEvent("change",r=>{let n=s.dom.files;i(n[0])}),s.dom.click()}h(u0,"saveFileDialog3");m(u0,"saveFileDialog3");d(u0,"saveFileDialog");var Zu,Ih;function q_(e){e?Ih=new Intl.NumberFormat(Zu,{style:"currency",currency:e}):Ih=new Intl.NumberFormat(Zu,{style:"decimal",useGrouping:!0,minimumFractionDigits:2,maximumFractionDigits:2})}h(q_,"setCurrencySymbol3");m(q_,"setCurrencySymbol3");d(q_,"setCurrencySymbol");function d0(e){if(e==null||e==="")return"";let t=new Date(Date.parse(e)),i={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return t.toLocaleDateString(Zu,i)}h(d0,"sql_date_formatter3");m(d0,"sql_date_formatter3");d(d0,"sql_date_formatter");function _0(e){if(e==null||e==="")return"";let t=typeof e=="string"?new Date(Date.parse(e)):e;return Tt(t)}h(_0,"date_formatter3");m(_0,"date_formatter3");d(_0,"date_formatter");function f0(e){if(e==null||e==="")return"";let t=Qn(typeof e=="string"?parseFloat(e):e,2);return Object.is(t,-0)&&(t=0),Ih.format(t)}h(f0,"money_formatter3");m(f0,"money_formatter3");d(f0,"money_formatter");function p0(e){if(e==null||e==="")return"";let t=Qn(typeof e=="string"?parseFloat(e):e,2);return t?Ih.format(t):""}h(p0,"money_formatter_nz3");m(p0,"money_formatter_nz3");d(p0,"money_formatter_nz");function g0(e){return e?"oui":"-"}h(g0,"bool_formatter3");m(g0,"bool_formatter3");d(g0,"bool_formatter");q_(null);var kC=Symbol("update");function K_(e,t){return Pe({rec:e,chk:t})}h(K_,"EvGridCheck3");m(K_,"EvGridCheck3");d(K_,"EvGridCheck");var v0=m(class extends P{m_sens;m_sorted;constructor(e,t){super(e),this.m_sorted=!1,this.m_sens="dn",this.setContent([new P({tag:"span",content:t}),new nt({ref:"sorter",cls:"@hidden sort",icon:"var( --x4-icon-arrow-down )"})])}get sorted(){return this.m_sorted}sort(e,t){this.m_sorted=e,this.m_sens=t;let i=this.itemWithRef("sorter");i.icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )",i.show(e)}get sens(){return this.m_sens}toggleSens(){this.m_sens=this.m_sens=="up"?"dn":"up",this.itemWithRef("sorter").icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )"}},"ColHeader3");d(v0,"ColHeader");var Ux=m(class extends Dt{m_dataview;m_data_cx;m_columns;m_view_el;m_container;m_header;m_footer;m_empty_msg;m_empty_text;m_selection;m_itemHeight;m_topIndex;m_visible_rows;m_hasMarks;m_marks;m_recycler;m_rowClassifier;constructor(e){super(e),this.m_columns=e.columns,this.m_hasMarks=e.hasMarks??!1,this.m_marks=new Set,this.m_hasMarks&&this.m_columns.unshift({id:"id",title:"",width:30,renderer:t=>this._renderCheck(t)}),this.setAttribute("tabindex",0),this.m_topIndex=0,this.m_itemHeight=0,this.m_recycler=[],this.m_rowClassifier=e.calcRowClass,this.m_empty_text=e.empty_text??le.global.empty_list,this.setDomEvent("click",t=>this._itemClick(t)),this.setDomEvent("dblclick",t=>this._itemDblClick(t)),this.setDomEvent("contextmenu",t=>this._itemMenu(t)),this.setDomEvent("keydown",t=>this._handleKey(t)),this.setStore(e.store)}componentCreated(){this._updateScroll(!0)}_moveSel(e,t=!0){let i=this.m_selection,s=null;if(i===void 0)i=this.m_dataview.getByIndex(0).getID();else{let r=this.m_dataview.indexOfId(this.m_selection);e==1?r++:e==-1?r--:e==2?r+=this.m_visible_rows.length-1:e==-2&&(r-=this.m_visible_rows.length-1),e<0?s="start":s="end",r<0?r=0:r>=this.m_dataview.count&&(r=this.m_dataview.count-1),i=this.m_dataview.getByIndex(r).getID()}return this.m_selection!=i&&t&&this._selectItem(i,null,s),i}_handleKey(e){if(!(!this.m_dataview||this.m_dataview.count==0))switch(e.key){case"ArrowDown":case"Down":{this._moveSel(1);break}case"ArrowUp":case"Up":{this._moveSel(-1);break}case"PageUp":{this._moveSel(-2);break}case"PageDown":{this._moveSel(2);break}}}getNextSel(e){return this._moveSel(e,!1)}_scrollIntoView(e,t){let i=this._findItem(e);i?i.scrollIntoView({block:"center"}):(this.m_topIndex=this.m_dataview.indexOfId(e),this.m_view_el.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),this._scrollIntoView(e))}setStore(e){this.m_selection=void 0,e instanceof N_?this.m_dataview=e.createView():this.m_dataview=e,this.m_hasMarks&&this.clearMarks(),this.m_data_cx&&this.m_data_cx.dispose(),this.m_dataview&&(this.m_data_cx=this.m_dataview.on("view_change",t=>{t.action=="change"&&(this.m_selection=void 0),this._updateScroll(!0)}),this._updateScroll(!0))}getView(){return this.m_dataview}getSelection(){return this.m_selection}getSelRec(){return this.m_selection?this.m_dataview.getById(this.m_selection):null}setSelection(e){this._selectItem(e,null,"center")}render(){this.m_recycler=[],this.m_container=new P({cls:"content"}),this.m_empty_msg=new Ne({cls:"empty-msg",text:""}),this.m_view_el=new P({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let e=!1,t=this.m_columns.map((s,r)=>{let n="@cell";s.cls&&(n+=" "+s.cls);let l=new v0({cls:n,flex:s.flex,sizable:"right",style:{width:s.width},dom_events:{click:a=>{ci(a.target).hasClass("@sizer-overlay")||(this._sortCol(s),a.preventDefault())}}},s.title),o=d(a=>{if(this._on_col_resize(r,a.size.width),this.m_footer){let c=P.getElement(this.m_footer.dom.childNodes[r]);c&&c.setStyleValue("width",a.size.width)}},"resizeCol");return new Wh({target:l,sens:"right",events:{resize:a=>o(a)}}),s.flex&&(e=!0),s.$hdr=l,l});t.push(new ch({ref:"flex",cls:e?"@hidden":""}));let i=0;if(this.m_columns.forEach(s=>{i+=s.width??0}),this.m_header=new ce({cls:"@header",content:t,style:{minWidth:i}}),this.m_props.hasFooter){let s=this.m_columns.map((r,n)=>{let l="@cell";r.align&&(l+=" "+r.align),r.cls&&(l+=" "+r.cls);let o=new P({cls:l,data:{col:n},flex:r.flex,style:{width:r.width}});return r.$ftr=o,o});s.push(new ch({ref:"flex",cls:e?"@hidden":""})),this.m_footer=new ce({cls:"@footer",content:s,style:{minWidth:i}})}else this.m_footer=null;this.setContent([this.m_header,this.m_view_el,this.m_footer,this.m_empty_msg])}_on_col_resize(e,t){let i=this.m_columns[e],s=!1;if(t>=0?(i.width=t,i.flex&&(i.$hdr.removeClass("@flex"),i.$ftr?.removeClass("@flex"),i.flex=void 0,s=!0)):t<0&&!i.flex&&(i.$hdr.addClass("@flex"),i.$ftr?.addClass("@flex"),i.flex=1,s=!0),s){let r=!1;this.m_columns.forEach(n=>{n.flex&&(r=!0)}),this.m_header.itemWithRef("flex")?.show(!r),this.m_footer&&this.m_footer.itemWithRef("flex")?.show(!r)}this._updateScroll(!0)}sortCol(e,t=!0){let i=this.m_columns.find(s=>s.id==e);if(i===void 0){console.assert(!1,"unknown field "+e+" in grid.sortCol");return}this._sortCol(i,t?"dn":"up")}_sortCol(e,t="up"){if(e.sortable===!1)return;this.m_columns.forEach(s=>{s!==e&&s.$hdr.sort(!1,"dn")});let i=e.$hdr;i.sorted?i.toggleSens():i.sort(!0,t),this.m_dataview&&this.m_dataview.sort([{field:e.id,ascending:i.sens!="dn"}])}_computeItemHeight(){let e=B.createElement("div");e.classList.add("x-row");let t=B.createElement("div");t.classList.add("x-grid-view"),t.style.position="absolute",t.style.top="-1000px",t.appendChild(e),this.dom.appendChild(t);let i=e.getBoundingClientRect();this.dom.removeChild(t),this.m_itemHeight=i.height}_createRow(e){let t;if(this.m_recycler.length){t=this.m_recycler.pop(),t.clearClasses(),t.addClass(e.cls),t.setContent(e.content),t.setStyle(e.style);for(let i in e.data)t.setData(i,e.data[i])}else t=new ce(e);return t.dom||this.m_container.appendChild(t),t}_buildItems(e=!0){let t=this.getBoundingRect(),i=this.m_header.getBoundingRect(),s=t.height-i.height+this.m_itemHeight;this.m_itemHeight==0&&this._computeItemHeight();let r=this.m_topIndex*this.m_itemHeight,n=0,l=0,o=this.m_topIndex,a=this.m_dataview?this.m_dataview.count:0,c=0,u=!!(this.m_topIndex&1);if(this.m_columns.forEach(g=>{c+=g.width??0}),(a+1)*this.m_itemHeight>=s){let g=P.getScrollbarSize();this.m_header.setStyleValue("paddingRight",g),this.m_footer?.setStyleValue("paddingRight",g)}else this.m_header.setStyleValue("paddingRight",0),this.m_footer?.setStyleValue("paddingRight",0);this.m_visible_rows&&this.m_visible_rows.forEach(g=>{this.m_recycler.push(g)}),this.m_visible_rows=[];let _=100;for(;n<s&&o<a&&--_>0;){let g=this.m_dataview.getByIndex(o),x=g.getID(),E=e?this.m_recycler.findIndex(y=>y.getData("row-id")==x):-1;if(E>=0){let y=this.m_recycler.splice(E,1)[0];y.setStyle({top:n+r,minWidth:c}),this.m_hasMarks&&y.setClass("@marked",this.m_marks.has(x)),y.removeClass("@hidden"),y.setClass("@selected",this.m_selection===x),this.m_visible_rows[l]=y}else{let y=this.m_columns.map(S=>{let w="@cell";S.align&&(w+=" "+S.align),S.cls&&(w+=" "+S.cls);let D;if(S.renderer)D=S.renderer(g),D&&(D.addClass(w),D.setStyleValue("width",S.width),S.flex!==void 0&&(D.addClass("@flex"),D.setStyleValue("flex",S.flex)));else{let R=S.formatter,C;R&&R instanceof Function?C=R(g.getRaw(S.id),g):C=g.getField(S.id),D=new P({cls:w,width:S.width,content:Oh`<span>${C}</span>`,flex:S.flex})}return D}),k="@row @hlayout center";this.m_hasMarks&&this.m_marks.has(x)&&(k+=" @marked"),this.m_selection===x&&(k+=" @selected");let A=this.m_visible_rows[l]=this._createRow({cls:k,content:y,style:{top:n+r,minWidth:c},data:{"row-id":x,"row-idx":o}});A.addClass(u?"even":"odd"),u=!u,this.m_rowClassifier&&this.m_rowClassifier(g,A)}n+=this.m_itemHeight,o++,l++}this.m_recycler.forEach(g=>{g.addClass("@hidden")});let p=!a,v=this.m_empty_text instanceof Function?this.m_empty_text():this.m_empty_text;this.m_empty_msg.text=v,p&&v.length==0&&(p=!1),this.m_empty_msg.show(p),c<t.width?(this.m_header.setStyleValue("width",null),this.m_footer?.setStyleValue("width",null),this.m_container.setStyle({height:a*this.m_itemHeight,width:null})):(this.m_header.setStyleValue("width",c+1e3),this.m_footer?.setStyleValue("width",c+1e3),this.m_container.setStyle({height:a*this.m_itemHeight,width:c}))}_updateScroll(e){if(!this.m_view_el||!this.m_view_el.dom)return;let t=d(()=>{if(!this.dom)return;let i=Math.floor(this.m_view_el.dom.scrollTop/(this.m_itemHeight||1));(i!=this.m_topIndex||e)&&(this.m_topIndex=i,this._buildItems(!e));let s=this.m_view_el.dom.scrollLeft;this.m_header.setStyleValue("left",-s),this.m_footer?.setStyleValue("left",-s)},"update");e?this.singleShot(t,10):t()}_rowFromTarget(e){let t=this.dom;for(;e&&e!=t;){let i=P.getElement(e);if(i){let s=i.getData("row-id");if(s!==void 0)return{id:s,itm:i}}e=e.parentElement}}_itemClick(e){let t=this._rowFromTarget(e.target);t?this._selectItem(t.id,t.itm):this._selectItem(void 0,void 0)}_itemDblClick(e){let t=this._rowFromTarget(e.target);if(t){this._selectItem(t.id,t.itm);let i=this.m_dataview.getById(t.id);this.emit("dblClick",el(i)),this.m_hasMarks&&this._toggleMark(i)}}_itemMenu(e){let t=e.target,i=this.dom;for(;t&&t!=i;){let s=P.getElement(t),r=s?.getData("row-id");if(r!==void 0){this._selectItem(r,s);let n=s.getData("row-idx"),l=this.m_dataview.getByIndex(n);this._showItemContextMenu(e,l),e.preventDefault();return}t=t.parentElement}}_findItem(e){for(let t=0;t<this.m_visible_rows.length;t++){let i=this.m_visible_rows[t];if(i.getData("row-id")===e)return i}return null}_selectItem(e,t,i){if(this.m_selection!==void 0){let s=this._findItem(this.m_selection);s&&s.removeClass("@selected")}if(this.m_selection=e,e){i&&this._scrollIntoView(e,i),t||(t=this._findItem(e)),t&&t.addClass("@selected");let s=this.m_dataview.getById(e);this.emit("selectionChange",Zi(s))}else this.emit("selectionChange",Zi(null))}_showItemContextMenu(e,t){this.emit("contextMenu",or(e,t))}clearSelection(){this._selectItem(null,null)}exportData(e){let t="",i=" ",s=`\r
|
|
26
|
+
`,r="";this.m_columns.map(l=>{r.length&&(r+=i),r+=l.title}),t+=r+s;let n=this.m_dataview.count;for(let l=0;l<n;l++){let o=this.m_dataview.getByIndex(l);r="";let a=this.m_columns.map(c=>{let u=o.getField(c.id),_=c.formatter;_&&_ instanceof Function&&(u=_(u,o)),r.length>0&&(r+=i),r+=u});t+=r+s}t=t.replace(/[àâä]/gm,"a"),t=t.replace(/[éèê]/gm,"e"),t=t.replace(/[îï]/gm,"i"),t=t.replace(/[ûüù]/gm,"u"),t=t.replace(/ /gm," "),Id(t,"text/csv",e)}set empty_text(e){this.m_empty_msg.text=e}_renderCheck(e){let t="--x4-icon-square";return this.m_marks.has(e.getID())&&(t="--x4-icon-square-check"),new nt({icon:`var(${t})`})}_toggleMark(e){let t=e.getID(),i=!1;this.m_marks.has(t)?this.m_marks.delete(t):(this.m_marks.add(t),i=!0),this.emit("gridCheck",K_(e,i)),this._buildItems(!1)}getMarks(){let e=[];for(let t of this.m_marks.values())e.push(t);return e}clearMarks(){this.m_marks.size&&(this.m_marks=new Set,this._buildItems(!1))}setFooterData(e){this.m_footer&&this.m_footer.enumChilds(t=>{let i=t.getData("col");if(i){let s=this.m_columns[i],r=e[s.id];if(r!==void 0)if(Di(r))r(t);else{let n,l=s.formatter;l&&l instanceof Function?n=l(r,e):n=r,t.setContent(n,!1)}}})}},"GridView3");d(Ux,"GridView");var $x=m(class extends P{constructor(e){super(e),this.setDomEvent("click",()=>this._handleClick()),this.mapPropEvents(e,"click")}_handleClick(){this.emit("click",Gs())}render(e){let t=e.text??"",i=e.href??"#";this.setTag("a"),this.setAttribute("tabindex",0),this.setAttribute("href",i),this.setAttribute("target",e.target),t&&this.setContent(cs(t)?t:Oh`<span>${t}</span>`)}set text(e){this.m_props.text=e,this.update()}},"Link3");d($x,"Link");var oi=m(class{static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=oi.hexChars,i=oi.hexOut,s,r,n,l;for(l=0;l<4;l+=1)for(r=l*8,s=e[l],n=0;n<8;n+=2)i[r+1+n]=t.charAt(s&15),s>>>=4,i[r+0+n]=t.charAt(s&15),s>>>=4;return i.join("")}static _md5cycle(e,t){let i=e[0],s=e[1],r=e[2],n=e[3];i+=(s&r|~s&n)+t[0]-680876936|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[1]-389564586|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[2]+606105819|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[3]-1044525330|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[4]-176418897|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[5]+1200080426|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[6]-1473231341|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[7]-45705983|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[8]+1770035416|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[9]-1958414417|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[10]-42063|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[11]-1990404162|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[12]+1804603682|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[13]-40341101|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[14]-1502002290|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[15]+1236535329|0,s=(s<<22|s>>>10)+r|0,i+=(s&n|r&~n)+t[1]-165796510|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[6]-1069501632|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[11]+643717713|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[0]-373897302|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[5]-701558691|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[10]+38016083|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[15]-660478335|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[4]-405537848|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[9]+568446438|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[14]-1019803690|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[3]-187363961|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[8]+1163531501|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[13]-1444681467|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[2]-51403784|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[7]+1735328473|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[12]-1926607734|0,s=(s<<20|s>>>12)+r|0,i+=(s^r^n)+t[5]-378558|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[8]-2022574463|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[11]+1839030562|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[14]-35309556|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[1]-1530992060|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[4]+1272893353|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[7]-155497632|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[10]-1094730640|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[13]+681279174|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[0]-358537222|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[3]-722521979|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[6]+76029189|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[9]-640364487|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[12]-421815835|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[15]+530742520|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[2]-995338651|0,s=(s<<23|s>>>9)+r|0,i+=(r^(s|~n))+t[0]-198630844|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[7]+1126891415|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[14]-1416354905|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[5]-57434055|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[12]+1700485571|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[3]-1894986606|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[10]-1051523|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[1]-2054922799|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[8]+1873313359|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[15]-30611744|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[6]-1560198380|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[13]+1309151649|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[4]-145523070|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[11]-1120210379|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[2]+718787259|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[9]-343485551|0,s=(s<<21|s>>>11)+r|0,e[0]=i+e[0]|0,e[1]=s+e[1]|0,e[2]=r+e[2]|0,e[3]=n+e[3]|0}_dataLength;_bufferLength;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(oi.stateIdentity),this}appendStr(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n;for(n=0;n<e.length;n+=1){if(r=e.charCodeAt(n),r<128)t[s++]=r;else if(r<2048)t[s++]=(r>>>6)+192,t[s++]=r&63|128;else if(r<55296||r>56319)t[s++]=(r>>>12)+224,t[s++]=r>>>6&63|128,t[s++]=r&63|128;else{if(r=(r-55296)*1024+(e.charCodeAt(++n)-56320)+65536,r>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[s++]=(r>>>18)+240,t[s++]=r>>>12&63|128,t[s++]=r>>>6&63|128,t[s++]=r&63|128}s>=64&&(this._dataLength+=64,oi._md5cycle(this._state,i),s-=64,i[0]=i[16])}return this._bufferLength=s,this}appendAsciiStr(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n=0;for(;;){for(r=Math.min(e.length-n,64-s);r--;)t[s++]=e.charCodeAt(n++);if(s<64)break;this._dataLength+=64,oi._md5cycle(this._state,i),s=0}return this._bufferLength=s,this}appendByteArray(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n=0;for(;;){for(r=Math.min(e.length-n,64-s);r--;)t[s++]=e[n++];if(s<64)break;this._dataLength+=64,oi._md5cycle(this._state,i),s=0}return this._bufferLength=s,this}getState(){let e=this,t=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[t[0],t[1],t[2],t[3]]}}setState(e){let t=e.buffer,i=e.state,s=this._state,r;for(this._dataLength=e.length,this._bufferLength=e.buflen,s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],r=0;r<t.length;r+=1)this._buffer8[r]=t.charCodeAt(r)}end(e=!1){let t=this._bufferLength,i=this._buffer8,s=this._buffer32,r=(t>>2)+1,n;if(this._dataLength+=t,i[t]=128,i[t+1]=i[t+2]=i[t+3]=0,s.set(oi.buffer32Identity.subarray(r),r),t>55&&(oi._md5cycle(this._state,s),s.set(oi.buffer32Identity)),n=this._dataLength*8,n<=4294967295)s[14]=n;else{let l=n.toString(16).match(/(.*?)(.{0,8})$/);if(l===null)return;let o=parseInt(l[2],16),a=parseInt(l[1],16)||0;s[14]=o,s[15]=a}return oi._md5cycle(this._state,s),e?this._state:oi._hex(this._state)}},"_Md53"),vl=oi;d(vl,"Md5");_e(vl,"stateIdentity",new Int32Array([1732584193,-271733879,-1732584194,271733878]));_e(vl,"buffer32Identity",new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]));_e(vl,"hexChars","0123456789abcdef");_e(vl,"hexOut",[]);_e(vl,"onePassHasher",new oi);var Wl=m(class extends nc{m_label;constructor(e){let t=e.icon??"var( --x4-icon-exclamation )";e.icon=void 0;let i=e.buttons===void 0?["ok"]:e.buttons;e.buttons=void 0,super(e);let s=e.message;this.form.updateContent(new ce({style:{padding:8},content:[t?new nt({cls:"icon",icon:t}):null,this.m_label=new Ne({cls:"text",text:s,multiline:!0})]}),i),this.on("btnClick",r=>{this.m_props.click&&cr(()=>{this.m_props.click(r.button)})})}set text(e){this.m_label.text=e}static show(e){let t;return He(e)||cs(e)?t=new Wl({message:e,click:()=>{}}):t=new Wl(e),t.show(),t}static async showAsync(e){return new Promise((t,i)=>{let s,r=d(l=>{t(l)},"cb");He(e)||cs(e)?s={message:e,click:r}:s={...e,click:r},new Wl(s).show()})}static alert(e,t=null){new Wl({cls:"warning",title:t,message:e,buttons:["ok"],click:()=>{}}).show()}},"MessageBox3");d(Wl,"MessageBox");var Ju=m(class extends nc{m_edit;constructor(e){e.buttons=void 0,e.width=e.width??500,super(e),this.form.updateContent(new ce({cls:"panel",content:[this.m_edit=new ki({flex:1,autoFocus:!0,label:e.message,value:e.value})]}),["ok","cancel"]),e.click&&this.on("btnClick",t=>{t.button==="ok"&&cr(()=>{this.m_props.click(this.m_edit.value)})})}set text(e){this.m_edit.label=e}static show(e,t){let i;return He(e)||cs(e)?i=new Ju({message:e,click:t}):i=new Ju(e),i.show(),i}},"PromptDialogBox3");d(Ju,"PromptDialogBox");var qx=m(class extends Dt{m_ui_title;m_ui_body;constructor(e){super(e);let t=e?.sens=="horizontal"?"@hlayout":"@vlayout";this.m_ui_title=new Ne({cls:"title",text:this.m_props.title}),this.m_ui_body=new P({cls:"body "+t,content:this.m_props.content,style:e.bodyStyle})}render(){let e=this.m_props.gadgets??[],t=this.m_props.icon?new nt({icon:this.m_props.icon}):null;super.setContent([new ce({cls:"title",content:[t,this.m_ui_title,...e]}),this.m_ui_body])}setContent(e){this.m_ui_body.setContent(e)}set title(e){this.m_ui_title.text=e}},"Panel3");d(qx,"Panel");var Y_=m(class{text;cls},"CellData3");d(Y_,"CellData");_e(Y_,"empty_cell",{text:""});var w0=m(class extends Dt{m_columns;m_row_limit;m_cells_data;m_rows_data;m_view;m_container;m_header;m_itemHeight;m_topIndex;m_visible_cells;m_row_count;m_selection;m_editor;m_autoedit;m_lockupdate;m_auto_row_count;m_recycler;m_used_cells;constructor(e){super(e),this.m_columns=e.columns,this.m_autoedit=e.autoedit,this.m_lockupdate=0,this.m_cells_data=new Map,this.m_rows_data=new Map,this.m_itemHeight=0,this.m_selection={row:0,col:0},this.m_row_count=0,this.m_auto_row_count=!1,this.m_recycler=[],this.m_used_cells=[],e.maxrows===void 0?(this.m_row_limit=0,this.m_auto_row_count=!0):e.maxrows<0?(this.m_row_limit=0,this.m_auto_row_count=!0):this.m_row_limit=e.maxrows,this.setAttribute("tabindex",0),this.setDomEvent("click",t=>this._itemClick(t)),this.setDomEvent("dblclick",t=>this._itemDblClick(t)),this.setDomEvent("keydown",t=>this._handleKey(t)),this.setDomEvent("keypress",t=>this._keyPress(t)),this.setDomEvent("focus",()=>this._focus(!0)),this.setDomEvent("focusout",()=>this._focus(!1)),this.setDomEvent("contextmenu",t=>this._ctxMenu(t)),this.mapPropEvents(e,"dblClick","selectionChange","contextMenu","change")}componentCreated(){super.componentCreated(),this._updateScroll(!0)}setColWidth(e,t){this._on_col_resize(e,t),this.update(10)}getColWidth(e){if(this.m_columns[e])return this.m_columns[e].width}setColTitle(e,t){console.assert(this.m_columns[e]!==void 0),this.m_columns[e].title=t,this.update(10)}reset(e){e&&(this.m_columns=e),this.m_cells_data=new Map,this.m_rows_data=new Map,this.update(10)}insertRow(e){let t=new Map;this.m_cells_data.forEach((s,r)=>{let{row:n,col:l}=xn(r);n>=e?t.set(pi(n+1,l),s):t.set(r,s)});let i=new Map;this.m_rows_data.forEach((s,r)=>{r>=e?i.set(r+1,s):i.set(r,s)}),this.m_cells_data=t,this.m_rows_data=i,this._buildItems()}deleteRow(e){let t=new Map,i=new Map;this.m_cells_data.forEach((s,r)=>{let{row:n,col:l}=xn(r);n>e?t.set(pi(n-1,l),s):n<e&&t.set(r,s)}),this.m_rows_data.forEach((s,r)=>{r>e?i.set(r-1,s):r<e&&i.set(r,s)}),this.m_cells_data=t,this.m_rows_data=i,this._buildItems()}insertCol(e,t){let i=e;if(i<0&&(i=this.m_columns.length+1),this.m_columns.splice(i,0,t),e>=0){let s=new Map;this.m_cells_data.forEach((r,n)=>{let{row:l,col:o}=xn(n);o>=e?s.set(pi(l,o+1),r):s.set(n,r)}),this.m_cells_data=s}this.update()}deleteCol(e){this.m_columns.splice(e,1);let t=new Map;this.m_cells_data.forEach((i,s)=>{let{row:r,col:n}=xn(s);n>e?t.set(pi(r,n-1),i):n<e&&t.set(s,i)}),this.m_cells_data=t,this.update()}_getCellData(e,t,i=!1){let s=this.m_cells_data.get(pi(e,t));return s===void 0?i?null:Y_.empty_cell:s}_focus(e){this.setClass("@focus",e)}_ctxMenu(e){let t=e.target,i=this.dom;for(;t&&t!=i;){let s=P.getElement(t),r=s.getData("row-id"),n=s.getData("col-id");if(r!==void 0){this._selectItem(r,n),this.emit("contextMenu",or(e,{row:r,col:n,item:s})),e.preventDefault();return}t=t.parentElement}}render(){this.m_recycler=[],this.m_container=new P({cls:"content"}),this.m_view=new P({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let e=this.m_columns.map((t,i)=>{let s=new P({cls:"@cell c"+i,content:t.title?t.title:" ",flex:t.width<0?-t.width:void 0,attrs:{title:t.title},style:{width:t.width>=0?t.width:void 0,minWidth:t.min_width}});return new Wh({target:s,sens:"right",resize:r=>{this._on_col_resize(i,r.size.width)}}),t.$col=s,s});this.m_header=new ce({cls:"@header",content:e}),this.setContent([this.m_header,this.m_view])}_on_col_resize(e,t){this.m_columns[e]&&(t<=0?this.m_columns[e].width=-1:this.m_columns[e].width=t,this._updateScroll(!0))}_computeItemHeight(){let e=B.createElement("div");e.classList.add("x-spreadsheet");let t=B.createElement("div");t.classList.add("content");let i=B.createElement("div");i.classList.add("x-cell"),i.append(" "),t.appendChild(i),e.appendChild(t),this.dom.appendChild(e);let s=i.getBoundingClientRect();this.dom.removeChild(e),this.m_itemHeight=s.height}_calcColWidths(e){let t=0,i=0,s=new Int32Array(this.m_columns.length),r=new Int32Array(this.m_columns.length),n=new Int32Array(this.m_columns.length);if(this.m_columns.forEach((l,o)=>{let a=Math.max(10,l.min_width??0);if(l.width>0){let c=Math.max(l.width,a);t+=c,s[o]=c}else{let c=-l.width;r[o]=c,i+=c}n[o]=a}),i){let l=e-t;for(let o=0;o<this.m_columns.length&&i;o++)if(!s[o]){let a=Math.round(l/i)*r[o];a<n[o]&&(a=n[o]),s[o]=a,l-=a,i-=r[o]}}return s}_createCell(){let e;return this.m_recycler.length?(e=this.m_recycler.pop(),e.clearClasses(),e.addClass("@comp")):e=new P({cls:"@cell"}),e.dom||this.m_container.appendChild(e),e}_buildItems(){let e=this.getBoundingRect(),t=this.m_header.getBoundingRect(),i=e.height-t.height;this.m_itemHeight==0&&this._computeItemHeight();let s=this.m_topIndex*this.m_itemHeight,r=0,n=0,l=this.m_topIndex,o=this.m_row_limit;this.m_auto_row_count&&(this.m_row_limit=o=this.getMaxRowCount());let a=0;if(o*this.m_itemHeight>i){let v=P.getScrollbarSize();e.width-=v,a=v}let c=!!(this.m_topIndex&1);this.m_visible_cells=new Map,this.m_used_cells.forEach(v=>{this.m_recycler.push(v)}),this.m_used_cells=[];let u=this._calcColWidths(e.width),_=0;for(let v=0;v<u.length;v++)_+=u[v];_<=e.width?(this.m_view.setStyleValue("overflow-x","hidden"),this.m_header.setStyleValue("width",e.width),this.m_container.setStyleValue("width",e.width),this.m_container.setStyle({height:o*this.m_itemHeight})):(this.m_header.setStyleValue("width",_),this.m_container.setStyleValue("width",_),this.m_view.setStyleValue("overflow-x","visible"),this.m_container.setStyle({height:o*this.m_itemHeight,width:_})),this.m_view.addClass("@hidden");let p=100;for(;r<i&&l<o&&--p>0;){let v=this.m_rows_data.get(l),g=0,x=this.m_columns.map((E,y)=>{let k="@cell c"+y;E.align&&(k+=" "+E.align),E.cls&&(k+=" "+E.cls);let A,S=this._getCellData(l,y),w=S.text;return E.renderer&&w.length&&(w=E.renderer(w,{row:l,col:y})),k+=c?" even":" odd",v&&(k+=" "+v),A=this._createCell(),this.m_used_cells.push(A),A.setContent(w),A.addClass(k),A.setStyle({left:g,top:s+r,width:u[y],height:this.m_itemHeight}),this.m_selection.row==l&&this.m_selection.col==y&&A.addClass("@selected"),A.setData("row-id",l),A.setData("col-id",y),S.cls&&A.addClass(S.cls),this.m_visible_cells.set(pi(l,y),A),g+=u[y],A});c=!c,r+=this.m_itemHeight,l++,n++}this.m_recycler.forEach(v=>{v.addClass("@hidden")}),this.m_row_count=n,this.m_view.removeClass("@hidden"),this.setClass("empty",o==0)}_itemClick(e){let t=e.target;if(this.m_editor&&this.m_editor.dom.contains(t))return;let i=P.getElement(t,P);if(!i)return;let s=i.getData("row-id"),r=i.getData("col-id");s===void 0||r===void 0||this._selectItem(s,r)}_itemDblClick(e){let t=e.target;if(this.m_editor&&this.m_editor.dom.contains(t))return;let i=P.getElement(t),s=i.getData("row-id"),r=i.getData("col-id");s===void 0||r===void 0||(this.emit("dblClick",el({row:s,col:r})),this.editCell(s,r))}_selectItem(e,t,i){e<0&&(e=0),e>this.m_row_limit-1&&(e=this.m_row_limit-1),t<0&&(t=0);let s=this.m_columns.length-1;t>s&&(t=s),!(this.m_selection.row==e&&this.m_selection.col==t)&&this.select(e,t,i)}_scrollIntoView(e,t){let i=d((r,n="nearest")=>{r.scrollIntoView({block:n})},"doscroll"),s=this.m_topIndex+this.m_row_count-1;e<this.m_topIndex?(this.m_topIndex=e,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),i(this._findItem(e,t),"start")):e>s?(this.m_topIndex=e-this.m_row_count+1,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),i(this._findItem(e,t),"end")):i(this._findItem(e,t))}_findItem(e,t){return this.m_visible_cells?this.m_visible_cells.get(pi(e,t)):null}_updateScroll(e){if(!this?.m_view?.dom)return;let t=Math.floor(this.m_view.dom.scrollTop/(this.m_itemHeight||1));(t!=this.m_topIndex||e)&&(this.m_topIndex=t,this._buildItems());let i=this.m_view.dom.scrollLeft;this.m_header.setStyleValue("left",-i)}_moveSel(e,t){let i=this.m_selection,s=i.row??0,r=i.col??0;if(e==1?s++:e==-1?s--:e==2?s+=this.m_row_count-1:e==-2?s-=this.m_row_count-1:e==3?s=this.m_row_limit-1:e==-3&&(s=0),t==1)r++;else if(t==-1)r--;else if(t==2)r=this.m_columns.length-1;else if(t==-2)r=0;else if(t==3){r++;let n=this.m_columns.length-1;e:for(let l=0;l<2;l++){for(;r<n;){if(this.m_columns[r].createEditor!==null)break e;r++}r>n&&(s++,r=0)}}else if(t==-3){r--;let n=this.m_columns.length-1;e:for(let l=0;l<2;l++){for(;r>=0;){if(this.m_columns[r].createEditor!==null)break e;r--}r<0&&(s--,r=n)}}this._selectItem(s,r,!0)}_handleKey(e){let t=e.target;if(!(this.m_editor&&this.m_editor.dom.contains(t)))switch(e.key){case"ArrowDown":case"Down":{this._moveSel(1,0);break}case"ArrowUp":case"Up":{this._moveSel(-1,0);break}case"PageUp":{this._moveSel(-2,0);break}case"PageDown":{this._moveSel(2,0);break}case"ArrowLeft":case"Left":{this._moveSel(0,-1);break}case"ArrowRight":case"Right":{this._moveSel(0,1);break}case"Home":{e.ctrlKey?this._moveSel(-3,0):this._moveSel(0,-2);break}case"End":{e.ctrlKey?this._moveSel(3,0):this._moveSel(0,2);break}case"Enter":{this.editCurCell(),e.stopPropagation(),e.preventDefault();break}case"Delete":{this.clearCell(this.m_selection.row,this.m_selection.col);break}default:break}}_keyPress(e){let t=e.target;this.m_editor&&this.m_editor.dom.contains(t)||e.ctrlKey||e.altKey||this.editCurCell(e.key)}getSelection(){return this.m_selection}select(e,t,i=!0){if(this.m_selection.row==e&&this.m_selection.col==t)return;let s=this._findItem(this.m_selection.row,this.m_selection.col);s&&s.removeClass("@selected"),this.m_selection={row:e,col:t},i&&this._scrollIntoView(e,t);let r=this._findItem(e,t);r&&r.addClass("@selected"),this.emit("selectionChange",Zi({row:e,col:t}))}rowCount(){return this.m_row_limit}getMaxRowCount(){let e=0;return this.m_cells_data.forEach((t,i)=>{let s=Math.round(i/1e3)+1;e<s&&(e=s)}),e}getColCount(){return this.m_columns.length}setRowStyle(e,t){this.m_rows_data.set(e,t),this.m_lockupdate==0&&this._buildItems()}getRowStyle(e){return this.m_rows_data.get(e)}setCellStyle(e,t,i){let s=this._getCellData(e,t,!0);if(s||(s={text:""},this.m_cells_data.set(pi(e,t),s)),s.cls=i,this.m_lockupdate==0&&this.m_visible_cells){let r=this._findItem(e,t);r?r.setClass(i,!0):this._buildItems()}}getCellText(e,t){return this._getCellData(e,t).text}getCellNumber(e,t){let i=this._getCellData(e,t).text;return Dd(i)}clearRow(e){for(let t=0;t<this.m_columns.length;t++)this.clearCell(e,t);this.update(10)}clearCell(e,t){this.setCellText(e,t,null)}editCurCell(e){this.editCell(this.m_selection.row,this.m_selection.col,e)}editCell(e,t,i){if(!this.m_autoedit||this.m_columns[t].createEditor===null)return;this._scrollIntoView(e,t);let r=this._findItem(e,t).dom,n=r.parentElement,l=r.getBoundingClientRect(),o=n.getBoundingClientRect(),a=this._getCellData(e,t,!0),c=d((_,p,v)=>new ki(_),"edtBuilder");this.m_columns[t].createEditor&&(c=this.m_columns[t].createEditor);let u=i||(a?a.text:"");this.m_editor=c({cls:"@editor",style:{left:l.left-o.left,top:l.top-o.top,width:l.width-1,height:l.height-1},tabIndex:!1,value:u,data:{row:e,col:t}},e,t),this.m_editor&&(n.appendChild(this.m_editor._build()),this._setupEditor(),this.m_editor.setData("old-value",u),this.m_editor.focus(),this.m_editor instanceof ki&&this.m_editor.selectAll())}_setupEditor(){let e=d((t,i)=>{Md(()=>{this.killEditor(!0),this._moveSel(t,i),this.editCurCell()})},"movesel");if(this.m_editor instanceof ki){let i=this.m_editor.input;i.setDomEvent("blur",()=>{this.killEditor(!0)}),i.setDomEvent("keydown",s=>{if(!s.defaultPrevented)switch(s.key){case"Escape":{this.killEditor(!1),s.stopPropagation(),s.preventDefault();break}case"Enter":case"Tab":{let r=3;s.shiftKey&&(r=-3),e(0,r),s.stopPropagation(),s.preventDefault();break}case"ArrowUp":case"Up":{e(-1,0),s.stopPropagation(),s.preventDefault();break}case"ArrowDown":case"Down":{e(1,0),s.stopPropagation(),s.preventDefault();break}}})}else if(this.m_editor instanceof Xu){let t=this.m_editor.input;t.setDomEvent("blur",()=>{this.killEditor(!0)}),t.setDomEvent("keydown",i=>{switch(i.key){case"Escape":{this.killEditor(!1),i.stopPropagation(),i.preventDefault();break}case"Enter":case"Tab":{let s=3;i.shiftKey&&(s=-3),e(0,s),i.stopPropagation(),i.preventDefault();break}}}),this.m_editor.showPopup(),this.m_editor.on("change",i=>{this.killEditor(!0)}),this.m_editor.on("cancel",i=>{this.killEditor(!1)})}}killEditor(e){if(this.m_editor){if(e){let i,s;this.m_editor instanceof ki?i=this.m_editor.value:this.m_editor instanceof Xu&&(s=this.m_editor.value,i=this.m_editor.valueText);let r=this.m_editor.getData("row"),n=this.m_editor.getData("col"),l=this.m_editor.getData("old-value");this.setCellText(r,n,i);let o=qe(i,{row:r,col:n,oldValue:l,id:s});this.emit("change",o),o.defaultPrevented&&this.setCellText(r,n,l)}let t=this.m_editor;cr(()=>{t.dispose()}),this.m_editor=null,this.focus()}}clearData(){this.m_cells_data=new Map,this.m_rows_data=new Map}setCellText(e,t,i){if(i==null||i.length==0)this.m_cells_data.delete(pi(e,t)),i="";else{let s=this._getCellData(e,t,!0);s||(s={}),s.text=i,this.m_cells_data.set(pi(e,t),s)}if(this.m_lockupdate==0&&this.m_visible_cells){let s=this._findItem(e,t);s?(this.m_columns[t].renderer&&(i=this.m_columns[t].renderer(i,{row:e,col:t})),s.setContent(i)):this._buildItems()}}lockUpdate(e){e?this.m_lockupdate++:--this.m_lockupdate==0&&this._updateScroll(!0)}},"Spreadsheet3");d(w0,"Spreadsheet");function pi(e,t){return e*1e3+t}h(pi,"_mkid6");m(pi,"_mkid6");d(pi,"_mkid");function xn(e){return{row:Math.floor(e/1e3)|0,col:e%1e3|0}}h(xn,"_getid3");m(xn,"_getid3");d(xn,"_getid");var Kx=m(class extends P{m_fields;m_record;m_sheet;m_label_w;constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){this.m_record=e.record,this.m_fields=e.fields??[],this.m_label_w=e.labelWidth,this.m_sheet=new w0({cls:"@fit",columns:[{title:le.global.property,width:this.m_label_w>0?this.m_label_w:-1,cls:"property"},{title:le.global.value,width:-1,createEditor:(...t)=>this._editCell(...t),renderer:(...t)=>this._renderCell(...t)}],autoedit:!0,change:t=>this._cellChange(t)}),this._updateProperties(),this.setContent(this.m_sheet)}setFields(e){e?(this.m_fields=e,this._updateProperties()):this.m_sheet.clearData()}setRecord(e){this.m_record=e,this._updateProperties()}_updateProperties(){this.m_sheet.lockUpdate(!0),this.m_sheet.clearData(),this.m_fields.forEach((e,t)=>{this.m_sheet.setCellText(t,0,e.title),this.m_record?this.m_sheet.setCellText(t,1,this.m_record.getField(e.id)):this.m_sheet.setCellText(t,1,e.value)}),this.m_sheet.lockUpdate(!1)}_cellChange(e){let t=e.context,i=e.value;if(t.col!=1)return;let s=this.m_fields[t.row];switch(s.type){default:case"string":break;case"number":break;case"password":break;case"boolean":break;case"choice":break}this.m_record?this.m_record.setField(s.id,i):s.value=i,this.emit("change",qe(i,s))}_renderCell(e,t){switch(this.m_fields[t.row].type){default:case"string":break;case"number":break;case"password":{e="\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF";break}case"boolean":break;case"choice":break}return e}_editCell(e,t,i){let s=this.m_fields[t],r;switch(s.type){default:case"string":{r=new ki(e);break}case"number":{r=new ki(e);break}case"password":{e.type="password",e.value=this.m_record.getField(s.id),r=new is(e);break}case"boolean":{r=new Eh(e);break}case"choice":break}return r}_choicesFromArray(e){return e.map(i=>typeof i=="object"?{id:i.id,text:i.value}:{id:i,text:""+i})}_choicesFromStore(e,t){let i=[];for(let s=0,r=e.count;s<r;s++){let n=e.getByIndex(s);i.push({id:n.getID(),text:n.getField(t)})}return i}},"PropertyEditor3");d(Kx,"PropertyEditor");var b0=m(class extends P{m_ui_input;constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){let t=e.text??"",i=e.name??e.group,s=e.labelWidth??-1,r=e.checked??!1,n=e.align??"left",l=e.value,o=e.icon;this.setTag("label"),this.addClass("@hlayout"),this.addClass(n),this._setTabIndex(e.tabIndex),r&&this.addClass("checked"),this.setContent([this.m_ui_input=new is({type:"radio",name:i,tabIndex:e.tabIndex,value:l,attrs:{checked:r?"":void 0},dom_events:{change:()=>this._change(),focus:()=>this.m_ui_input.focus()}}),new Ne({ref:"label",icon:o,text:t,width:s==="flex"?void 0:s,flex:s==="flex"?1:void 0,style:{order:n=="right"?-1:void 0}})])}_change(){let t=".x-input[name="+this.m_props.name+"]";B.querySelectorAll(t).forEach(r=>{P.getElement(r,b0).removeClass("checked")});let s=this.m_ui_input.dom;this.setClass("checked",s.checked),this.emit("change",qe(!0))}get check(){return this.m_ui_input?this.m_ui_input.dom.checked:this.m_props.checked}set check(e){let t=this.m_ui_input.dom;e?(t&&(t.checked=!0),this.m_props.checked=!0):(t&&(t.checked=!1),this.m_props.checked=!1)}get text(){return this.itemWithRef("label").text}set text(e){this.itemWithRef("label").text=e}},"RadioBtn3");d(b0,"RadioBtn");var Yx=m(class extends ce{m_els;m_input;constructor(e){super(e),e.steps=e.steps??5}render(e){let t=e.shape??"star",i=e.value??0;this.m_input=new is({cls:"@hidden",name:e.name,value:""+i}),this.addClass(t),this.setDomEvent("click",s=>this._onclick(s)),this.m_els=[];for(let s=0;s<e.steps;s++){let r="item";s+1<=i&&(r+=" checked");let n=new P({tag:"option",cls:r,data:{value:s+1}});this.m_els.push(n)}this.m_els.push(this.m_input),this.setContent(this.m_els)}getValue(){return this.m_props.value??0}set value(e){this.m_props.value=e;for(let t=0;t<this.m_props.steps;t++)this.m_els[t].setClass("checked",this.m_els[t].getData("value")<=e);this.m_input.value=""+this.m_props.value}set steps(e){this.m_props.steps=e,this.update()}set shape(e){this.removeClass(this.m_props.shape),this.m_props.shape=e,this.addClass(this.m_props.shape)}_onclick(e){let t=!0;for(let i=this.dom.firstChild;i;i=i.nextSibling){let s=P.getElement(i);s.setClass("checked",t),i==e.target&&(this.m_input.value=s.getData("value"),t=!1)}this.emit("change",qe(this.m_props.value))}},"Rating3");d(Yx,"Rating");function X_(e,t=!1){if(e instanceof RegExp)return{keys:null,pattern:e};let i=e.split("/"),s=[],r="";i[0]==""&&i.shift();for(let n of i){let l=n[0];if(l==="*")s.push("wild"),r+="/(.*)";else if(l===":"){let o=n.indexOf("?",1),a=n.indexOf(".",1);s.push(n.substring(1,o>=0?o:a>=0?a:n.length)),r+=o>=0&&a<0?"(?:/([^/]+?))?":"/([^/]+?)",a>=0&&(r+=(o>=0?"?":"")+"\\"+n.substring(a))}else r+="/"+n}return{keys:s,pattern:new RegExp(`^${r}${t?"(?=$|/)":"/?$"}`,"i")}}h(X_,"parseRoute3");m(X_,"parseRoute3");d(X_,"parseRoute");var x0=m(class extends wo{m_routes;m_useHash;constructor(e=!0){super(),this.m_routes=[],this.m_useHash=e,window.addEventListener("popstate",t=>{let i=this._getLocation(),s=this._find(i);s.handlers.forEach(r=>{r(s.params,i)})})}get(e,t){let{keys:i,pattern:s}=X_(e);this.m_routes.push({keys:i,pattern:s,handler:t})}init(){this.navigate(this._getLocation())}_getLocation(){return this.m_useHash?"/"+B.location.hash.substring(1):B.location.pathname}navigate(e,t=!0){e.startsWith("/")||(e="/"+e);let i=this._find(e);if(!i||i.handlers.length==0){console.log("route not found: "+e),this.signal("error",Ed(404,"route not found"));return}if(this.m_useHash){for(;e.startsWith("/");)e=e.substring(1);window.history.pushState({},"","#"+e)}else window.history.pushState({},"",e);t&&i.handlers.forEach(s=>{s(i.params,e)})}_find(e){let t=[],i={},s=[];for(let r of this.m_routes)if(r.keys)if(r.keys.length>0){if(t=r.pattern.exec(e),t===null)continue;for(let n=0;n<r.keys.length;)i[r.keys[n]]=t[++n];s=[...s,r.handler]}else r.pattern.test(e)&&(s=[...s,r.handler]);else{if(t=r.pattern.exec(e),!t)continue;if(t.groups)for(let n in t.groups)i[n]=t.groups[n];s=[...s,r.handler]}return{params:i,handlers:s}}},"Router3");d(x0,"Router");var Xx=m(class extends O_{m_sidebar;m_content;constructor(e){super(e),this.addClass("@hlayout"),this.m_sidebar=new Dt({cls:"@side-bar",width:e.bar_width??void 0}),this.m_content=new ce({flex:1,cls:"@tab-container"})}render(){let e=[];this.m_cards.forEach(t=>{e.push(t.selector)}),this.m_sidebar.setContent(new Dt({flex:1,cls:"content",content:e})),this.setContent([this.m_sidebar,this.m_props.bar_sizable?new Gp({orientation:"horizontal",sizing:"before"}):void 0,this.m_content])}_prepareSelector(e){return new xt({text:e.title,icon:e.icon,tooltip:e.title,click:()=>{this.switchTo(e.name)}})}_preparePage(e){super._preparePage(e),e.dom||this.m_content.appendChild(e)}},"SideBarView3");d(Xx,"SideBarView");var Zx=/^-?\d+(\.\d+)?$/;function Z_(e){return e*Math.PI/180}h(Z_,"d2r3");m(Z_,"d2r3");d(Z_,"d2r");function Ah(e,t,i,s){let r=Z_(s);return{x:e+i*Math.cos(r),y:t+i*Math.sin(r)}}h(Ah,"p2c3");m(Ah,"p2c3");d(Ah,"p2c");function Ct(e){return Math.round(e*1e3)/1e3}h(Ct,"num3");m(Ct,"num3");d(Ct,"num");function Xl(e,...t){return t=t.map(i=>typeof i=="number"&&isFinite(i)?Ct(i):i),String.raw(e,...t)}h(Xl,"clean3");m(Xl,"clean3");d(Xl,"clean");var wl=m(class{m_tag;m_attrs;m_style;constructor(e){this.m_tag=e,this.m_attrs=new Map,this.m_style=new Map}render(){return`<${this.m_tag} ${this.renderAttrs()} ${this.renderStyle()}>${this.renderContent()}</${this.m_tag}>`}stroke(e,t){return this.attr("stroke",e),t!==void 0&&this.attr("stroke-width",t+"px"),this}strokeWidth(e){return this.attr("stroke-width",e+"px"),this}fill(e){return this.attr("fill",e),this}attr(e,t){return this.m_attrs.set(e,t),this}style(e,t){if(t===void 0||t===""||t===void 0){this.m_style.delete(e);return}return!jp[e]&&(to(t)||Zx.test(t))&&(t=t+"px"),this.m_style.set(e,""+t),this}class(e){let t=this.m_attrs.get("class");return this.m_attrs.set("class",(t??" "+e).trim()),this}renderAttrs(){if(!this.m_attrs.size)return"";let e="";return this.m_attrs.forEach((t,i)=>{e+=` ${i} = "${t}"`}),e}renderStyle(){if(!this.m_style.size)return"";let e='style="';return this.m_style.forEach((t,i)=>{e+=`${i}:${t};`}),e+'"'}renderContent(){return""}clip(e){return this.attr("clip-path",`url(#${e})`),this}transform(e){this.attr("transform",e)}rotate(e,t,i){this.transform(`rotate( ${e} ${t} ${i} )`)}translate(e,t){this.transform(`translate( ${e} ${t} )`)}scale(e){this.transform(`scale( ${e} )`)}},"SVGItem3");d(wl,"SVGItem");var C0=m(class extends wl{m_path;constructor(){super("path"),this.m_path=""}renderAttrs(){return this.attr("d",this.m_path),super.renderAttrs()}moveTo(e,t){return this.m_path+=Xl`M${e},${t}`,this}lineTo(e,t){return this.m_path+=Xl`L${e},${t}`,this}closePath(){return this.m_path+="Z",this}arc(e,t,i,s,r){let n=Ah(e,t,i,s-90),l=Ah(e,t,i,r-90),o=r-s<=180?"0":"1";return this.m_path+=Xl`M${n.x},${n.y}A${i},${i} 0 ${o} 1 ${l.x},${l.y}`,this}},"SVGPath3");d(C0,"SVGPath");var y0=m(class extends wl{m_text;constructor(e,t,i){super("text"),this.m_text=i,this.attr("x",Ct(e)+""),this.attr("y",Ct(t)+"")}font(e){return this.attr("font-family",e),this}fontSize(e){return this.attr("font-size",e+""),this}fontWeight(e){return this.attr("font-weight",e),this}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.attr("text-anchor",t),this}verticalAlign(e){let t;switch(e){case"top":t="hanging";break;case"center":t="middle";break;case"bottom":t="baseline";break;default:return}return this.attr("alignment-baseline",t),this}renderContent(){return this.m_text}},"SVGText3");d(y0,"SVGText");var Qu=m(class extends wl{constructor(e){super(e)}},"SVGShape3");d(Qu,"SVGShape");var ed=m(class extends wl{m_id;m_stops;constructor(e,t,i,s){super("linearGradient"),this.m_id="gx-"+ed.g_id,this.attr("id",this.m_id),this.attr("x1",He(e)?e:Ct(e)+""),this.attr("x2",He(i)?i:Ct(i)+""),this.attr("y1",He(t)?t:Ct(t)+""),this.attr("y2",He(s)?s:Ct(s)+""),this.m_stops=[],ed.g_id++}get id(){return"url(#"+this.m_id+")"}addStop(e,t){return this.m_stops.push({offset:e,color:t}),this}renderContent(){let e=[];return this.m_stops.forEach(t=>{e.push(`<stop offset="${t.offset}%" stop-color="${t.color}"></stop>`)}),e.join(`
|
|
27
|
+
`)}},"_SVGGradient3"),J_=ed;d(J_,"SVGGradient");_e(J_,"g_id",1);var td=m(class extends wl{m_items;constructor(e="g"){super(e),this.m_items=[]}path(){let e=new C0;return this.m_items.push(e),e}text(e,t,i){let s=new y0(e,t,i);return this.m_items.push(s),s}ellipse(e,t,i,s=i){let r=new Qu("ellipse");return r.attr("cx",Ct(e)+""),r.attr("cy",Ct(t)+""),r.attr("rx",Ct(i)+""),r.attr("ry",Ct(s)+""),this.m_items.push(r),r}rect(e,t,i,s){let r=new Qu("rect");return r.attr("x",Ct(e)+""),r.attr("y",Ct(t)+""),r.attr("width",Ct(i)+""),r.attr("height",Ct(s)+""),this.m_items.push(r),r}linear_gradient(e,t,i,s){let r=new J_(e,t,i,s);return this.m_items.push(r),r}clear(){this.m_items=[]}renderContent(){let e=[];return this.m_items.forEach(t=>{e.push(t.render())}),e.join(`
|
|
28
|
+
`)}},"SVGGroup3");d(td,"SVGGroup");var E0=m(class extends td{constructor(){super("")}addClip(e,t,i,s){let r="c-"+E0.g_clip_id++,n=new td("clipPath");return n.attr("id",r),n.rect(e,t,i,s),this.m_items.push(n),r}render(){let e=[];return this.m_items.forEach(t=>{e.push(t.render())}),e.join(`
|
|
29
|
+
`)}},"_SVGPathBuilder3"),k0=E0;d(k0,"SVGPathBuilder");_e(k0,"g_clip_id",1);var Jx=m(class extends P{constructor(e){super(e),this.setTag("svg","http://www.w3.org/2000/svg"),this.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.setAttributes({viewBox:e.viewBox}),this.setContent(e.path)}},"SVGComponent3");d(Jx,"SVGComponent");var Qx=m(class extends zt{m_pages;m_curPage;constructor(e){super(e),this.m_pages=[],this.m_curPage=null,this.mapPropEvents(e,"change"),e.vertical?this.addClass("@vlayout"):this.addClass("@hlayout"),this.m_props.pages?.forEach(t=>this.addPage(t))}componentCreated(){this.m_props.default&&this.select(this.m_props.default,!0)}addPage(e){this.m_pages.push({...e}),this._updateContent()}render(){let e=[];this.m_pages.forEach(t=>{t.btn=new xt({cls:t===this.m_curPage?"selected":"",text:t.title,icon:t.icon,click:()=>this._select(t,!0)}),e.push(t.btn)}),this.setContent(e)}select(e,t=!1){if(e){let i=this.m_pages.find(s=>s.id===e);return i?(this._select(i,t),!0):!1}else return this._select(null,t),!0}_select(e,t){if(this.m_curPage!=e){if(!this.dom){this.m_props.default=e.id;return}this.m_curPage&&(this.m_curPage.btn.removeClass("selected"),this.m_curPage.page&&this.m_curPage.page.hide()),this.m_curPage=e,t&&this.signal("change",qe(e?e.id:null)),this.m_curPage&&(this.m_curPage.btn.addClass("selected"),this.m_curPage.page&&this.m_curPage.page.show())}}get selection(){return this.m_curPage?.page}},"TabBar3");d(Qx,"TabBar");var e1=m(class extends O_{m_tab_selector;m_menu;constructor(e){super(e),this.m_tab_selector=!!e.tab_selector,this.m_menu=e.menu,this.addClass("@vlayout")}render(){let e=[],t=[];this.m_menu&&(this.m_menu.addClass("@button @tab-btn"),this.m_menu.removeClass("@menu-item"),e.push(this.m_menu)),this.m_cards.forEach(i=>{e.push(i.selector),i.page instanceof Function||t.push(i.page)}),this.m_tab_selector&&t.unshift(new ce({cls:"@tab-switch",content:e})),this.setContent(t)}_updateSelector(){}_prepareSelector(e){return new xt({cls:"@tab-btn",text:e.title,icon:e.icon,click:()=>{this.switchTo(e.name)}})}_preparePage(e){super._preparePage(e),e.dom||this.appendChild(e)}},"TabView3");d(e1,"TabView");var t1=m(class extends P{constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){e.text=e.text??"",this.setAttribute("tabindex",e.tabIndex??0),e.spellcheck===!1&&this.setAttribute("spellcheck","false"),e.readOnly!==void 0&&this.setAttribute("readonly",e.readOnly),e.rows&&this.setAttribute("rows",e.rows),e.placeHolder&&this.setAttribute("placeholder",e.placeHolder),e.autoFocus&&this.setAttribute("autofocus",e.autoFocus),e.name&&this.setAttribute("name",e.name),e.autoGrow&&(this.m_props.autoGrow=!0,this.setAttribute("rows",this._calcHeight(e.text)),this.setDomEvent("keydown",()=>{cr(()=>this._updateHeight())})),this.setDomEvent("keydown",t=>{t.stopPropagation()}),this.setTag("textarea"),this.setDomEvent("input",()=>this._change())}_change(){this.emit("change",qe(this.value))}componentCreated(){this.value=this.m_props.text}get value(){return this.dom?this.dom.value:this.m_props.text}set value(e){this.m_props.text=e??"",this.dom&&(this.dom.value=this.m_props.text,this.m_props.autoGrow&&this.setAttribute("rows",this._calcHeight(this.m_props.text)))}get text(){return this.value}set text(e){this.value=e}_calcHeight(e){return 1+(e.match(/\n/g)||[]).length}_updateHeight(){let e=this.value,t=this._calcHeight(e);this.getData("lines")!=t&&(this.setAttribute("rows",t),this.setData("lines",t))}insertText(e){this.appendText(e)}appendText(e){if(this.dom){let t=this.dom,i=t.selectionEnd;t.setRangeText(e,i,i,"end")}}replaceText(e){this.dom&&this.dom.setRangeText(e)}getSelection(){if(this.dom){let e=this.dom;return{start:e.selectionStart,end:e.selectionEnd}}else return{start:0,end:0}}setSelection(e){if(this.dom){let t=this.dom;e.start!==void 0&&(t.selectionStart=e.start),e.end!==void 0&&(t.selectionEnd=e.end)}}getStoreValue(){return this.value}setStoreValue(e){this.value=e}},"TextArea3");d(t1,"TextArea");var i1=m(class extends ps{m_message;m_icon;constructor(e){super(e),this.m_message=e.message,this.m_icon=e.icon,this.enableMask(!1),this.addClass("@non-maskable")}render(){this.addClass("@hlayout"),this.setContent([new Ne({icon:this.m_icon,text:this.m_message})])}show(){this.show=super.show,this.displayAt(9999,9999,"br",{x:0,y:-24});let e=1;this.startTimer("fadeout",2e3,!1,()=>{this.startTimer("opacity",100,!0,()=>{this.setStyleValue("opacity",e),e-=.1,e<0&&this.dispose()})})}},"Toaster3");d(i1,"Toaster");function Q_(e){return Pe({node:e})}h(Q_,"EvExpand3");m(Q_,"EvExpand3");d(Q_,"EvExpand");var s1=m(class extends Dt{m_view;m_container;m_selection;constructor(e){super(e),e.root=e.root,e.indent=e.indent??8,e.gadgets=e.gadgets,e.sort=e.sort??!1,this.m_selection=null,this.m_container=new zt({cls:"@scroll-container"}),this.m_view=new zt({cls:"@scroll-view",flex:1,content:this.m_container}),this.setContent([this.m_view,e.gadgets?new ce({cls:"gadgets",content:e.gadgets}):null]),this.setDomEvent("click",t=>this._click(t)),this.setDomEvent("dblclick",t=>this._click(t)),this.setDomEvent("contextmenu",t=>this._handleCtxMenu(t)),e.canDragItems&&(this.setDomEvent("dragstart",t=>{let s=P.getElement(t.target,P)?.getData("node");s?(t.dataTransfer.effectAllowed="move",t.dataTransfer.items.add(JSON.stringify({type:"treeview",id:s.id}),"string")):(t.preventDefault(),t.stopPropagation())}),this.setDomEvent("dragover",t=>this._dragEnter(t)),this.setDomEvent("dragenter",t=>this._dragEnter(t)),this.setDomEvent("dragend",t=>this._dragLeave(t)),this.setDomEvent("dragleave",t=>this._dragLeave(t)),this.setDomEvent("drop",t=>this._dragLeave(t)),this.setDomEvent("drop",t=>this._drop(t))),this.mapPropEvents(e,"dblclick","drag","selectionchange","contextMenu")}_dragEnter(e){e.preventDefault();let t=P.getElement(e.target,P);t?.getData("node")&&(t.addClass("@drag-over"),e.dataTransfer.dropEffect="move")}_dragLeave(e){let t=P.getElement(e.target,P);t?.getData("node")&&t.removeClass("@drag-over")}_drop(e){let t=P.getElement(e.target,P),i=t?.getData("node");if(i||(i=this.m_props.root),i){let s;i.children?s=i:s=t.getData("parent");for(let r=0;r<e.dataTransfer.items.length;r++)e.dataTransfer.items[0].getAsString(n=>{let l=JSON.parse(n);this.emit("drag",yd(i,l,s))})}}render(){this.__update()}__update(){if(this.m_props.root){let e=[];this._buildBranch(this.m_props.root,-1,e,this.m_props.root),this.m_container.setContent(e)}}updateElement(e){let{node:t,item:i}=this._getNode(e);if(t){let s=t.dom.parentNode,r=this._makeNode(i,t.dom.classList.value,t.getData("icon"),t.getData("level")),n=r._build();s.replaceChild(n,t.dom),this.m_selection?.el===t&&(this.m_selection.el=r)}}set root(e){this.m_props.root=e,this.update()}openAll(e=!0){this.forEach(t=>{t.children&&(t.open=e)}),this.__update()}refreshRoot(e){let t=[];this.forEach(s=>(s.open&&t.push(s.id),!1));let i=this.selection;e&&(this.m_props.root=e),this.forEach(s=>(t.indexOf(s.id)>=0&&(s.open=!0),!1)),this.__update()}_buildBranch(e,t,i,s){let r="@tree-item";e.cls&&(r+=" "+e.cls),!e.open&&e.children&&(r+=" collapsed"),e.children&&(r+=" folder",e.children.length==0&&(r+=" empty"));let n=e.icon;if(n===void 0&&e.children&&(e.open===!0?n="var(--x4-icon-chevron-down)":n="var(--x4-icon-chevron-right)"),t>=0){let l=this._makeNode(e,r,n,t);this.m_selection?.id==e.id&&(this.m_selection.el=l,l.addClass("selected")),i.push(l)}(t==-1||e.open)&&e.children&&(this.m_props.sort&&(e.children=e.children.sort((l,o)=>{let a=(l.children?"0"+l.text:l.text)?.toLocaleLowerCase(),c=(o.children?"0"+o.text:o.text)?.toLocaleLowerCase();return a<c?-1:a>c?1:0})),e.children.forEach(l=>{this._buildBranch(l,t+1,i,e)}))}_renderDef(e){return new Ne({cls:"tree-label",flex:1,text:e.text})}_makeNode(e,t,i,s){return new ce({cls:t,content:[new nt({cls:"tree-icon",icon:i}),this.m_props.renderItem?this.m_props.renderItem(e):this._renderDef(e)],data:{node:e,level:s,icon:i},style:{paddingLeft:4+s*this.m_props.indent},attrs:{draggable:this.m_props.canDragItems?!0:void 0}})}forEach(e){let t=null;function i(s){if(e(s)==!0)return!0;if(s.children){for(let r=0;r<s.children.length;r++)if(i(s.children[r]))return!0}}return h(i,"scan"),m(i,"scan"),d(i,"scan"),this.m_props.root&&i(this.m_props.root),t}ensureVisible(e){let{node:t}=this._getNode(e);t&&t.scrollIntoView()}set selection(e){this.select(e,!1)}select(e,t=!0){if(this.m_selection?.el&&this.m_selection.el.removeClass("selected"),this.m_selection=null,e!==void 0){let{node:i}=this._getNode(e);if(i&&(this.m_selection={id:e,el:i},i.addClass("selected"),i.scrollIntoView(),t)){let s=i.getData("node");this.emit("selectionchange",Zi(s))}}else t&&this.emit("selectionchange",Zi(null))}_getNode(e){let t={node:null,item:null};return this.m_container.enumChilds(i=>{let s=i.getData("node");if(s?.id==e)return t={node:i,item:s},!0}),t}get selection(){return this.m_selection?.id}getNodeWithId(e){return this.forEach(t=>t.id==e)}_click(e){let t=e.target,i=t,s=!1;for(t.tabIndex!==-1&&(s=!0);t!=this.dom;){let r=P.getElement(t),n=r?.getData("node");if(n){if(n.children&&!s){(r.hasClass("selected")||i.classList.contains("tree-icon"))&&(n.open=!n.open),this.m_selection={id:n.id,el:null};let l=this.m_view?.dom?.scrollTop;this.update(),l&&this.m_view.dom.scrollTo(0,l),this.emit("expand",Q_(n))}else this.selection=n.id,s||(e.type=="click"?this.emit("click",Gs(n)):this.emit("dblclick",el(n)));this.emit("selectionchange",Zi(n));return}t=t.parentElement}e.type=="click"&&(this.m_selection=null,this.update(),this.emit("selectionchange",Zi(null)))}_handleCtxMenu(e){e.preventDefault();let t=e.target,i=t;for(;t!=this.dom;){let r=P.getElement(t)?.getData("node");if(r){if(r.children&&i.classList.contains("tree-icon"))return;this.selection=r.id,this.emit("click",Gs(r)),this.emit("contextMenu",or(e,r));return}t=t.parentElement}this.selection=null,this.emit("contextMenu",or(e,null))}static buildFromStrings(e,t="/"){let i={id:0,text:"<root>",children:[]};function s(r,n){let l=n.indexOf(t),o=n.substr(0,l<0?void 0:l),a;l>=0&&(a=r.find(c=>c.text==o)),a||(a={id:n,text:o},r.push(a)),l>=0&&(a.children||(a.children=[]),s(a.children,n.substr(l+t.length)))}return h(s,"insert"),m(s,"insert"),d(s,"insert"),e.forEach(r=>{s(i.children,r)}),i}static buildFromHierarchy(e,t){let i={id:0,text:"<root>",children:[]},s=[];function r(n){let l,o;n.parent>0?(o=s.find(a=>a.id==n.parent),o||(o={id:n.parent,text:"",children:[]},s.push(o)),o.children||(o.children=[])):o=i,l=s.find(a=>a.id==n.id),l?(l.text=n.name,l.parent=n.parent):(l={id:n.id,text:n.name,parent:n.parent,cls:n.cls,icon:n.icon,data:n.data},n.leaf?l.icon=null:l.children=[]),s.push(l),o.children.push(l)}return h(r,"insert"),m(r,"insert"),d(r,"insert"),e.forEach(r),t&&s.forEach(t),i}},"TreeView3");d(s1,"TreeView");var SC=Symbol("fragment"),r1=m(class extends P{render(e){let t=this.renderTSX(e);t&&this.setContent(t)}},"TSXComponent3");d(r1,"TSXComponent");var Xf=Symbol("msg_sent");function S0(e){let t=window.location.protocol==="https:"?"wss://":"ws://",i=new WebSocket(`${t}${window.location.hostname}:${window.location.port}`,"messaging"),s=uo.instance();s.on("global",r=>{r[Xf]||i.send(JSON.stringify({msg:r.msg,params:r.params}))}),i.onmessage=r=>{if(r.data!="ping"){let n=JSON.parse(r.data);n[Xf]=!0,s.signal("global",n)}},i.onclose=r=>{console.log("websocket closed:",r),e()},i.onerror=r=>{console.log("websocket error:",r)}}h(S0,"setupWSMessaging3");m(S0,"setupWSMessaging3");d(S0,"setupWSMessaging");var DC=Symbol(),Ja=h(class extends Yn{static instance(){return Ja.self}m_mainView;m_app_name;m_app_version;m_app_uid;m_local_storage;m_user_data;m_touch_time;m_touch_count;m_router;constructor(e){console.assert(Ja.self===null,"application is a singleton"),super(e),this.m_app_name=e.app_name??"application",this.m_app_version=e.app_version??"1.0",this.m_app_uid=e.app_uid??"application";let t=`${this.m_app_name}.${this.m_app_version}.settings`;this.m_local_storage=new wp(t),this.m_user_data={},this.m_touch_time=0,this.m_touch_count=0,this.m_router=null,n1=Ja.self=this,"onload"in globalThis?globalThis.addEventListener("load",()=>{this.ApplicationCreated()}):this.ApplicationCreated()}ApplicationCreated(){this.setTitle("")}get router(){return this.m_router||(this.m_router=new x0),this.m_router}get app_name(){return this.m_app_name}get app_uid(){return this.m_app_uid}get app_version(){return this.m_app_version}get local_storage(){return this.m_local_storage}get user_data(){return this.m_user_data}get history(){debugger;return null}setMainView(e,t){let i=this.m_props.renderTo??V.body,s=wi(i);this.m_props.renderTo||s.setStyleValue("position","absolute"),s.addClass("x4-root-element"),t&&s._empty(),this.m_mainView=e,e.setStyleValue("position","absolute"),e._build(),i.appendChild(e.dom)}set mainView(e){this.setMainView(e,!1)}get mainView(){return this.m_mainView}setTitle(e){V.title=this.m_app_name+(e?" > "+e:"")}disableZoomWheel(){window.addEventListener("wheel",function(e){e.ctrlKey&&e.preventDefault()},{passive:!1,capture:!0})}enterModal(e){}enableTouchDblClick(){V.addEventListener("touchstart",e=>{let t=Date.now();if(t-this.m_touch_time>700?this.m_touch_count=1:this.m_touch_count++,this.m_touch_time=t,this.m_touch_count==2){this.m_touch_count=0;let i=e.touches[0],s={type:"dblclick"};for(let r in i)s[r]=i[r];M._dispatchEvent(s),e.stopPropagation()}})}},"_Application4"),_o=Ja;m(_o,"Application");de(_o,"self",null);var n1,l1=h(class extends Ft{},"AbsLayout4");m(l1,"AbsLayout");var ue=h(class extends Ft{},"HLayout4");m(ue,"HLayout");var It=h(class extends Ft{},"VLayout4");m(It,"VLayout");var o1=h(class extends Ft{constructor(e){super(e),this.setDomEvent("sizechange",()=>this._updateLayout())}componentCreated(){super.componentCreated(),this._updateLayout()}_updateLayout(){let e=this.m_props.defaultLayout=="horizontal";if(this.m_props.switchSize<=0&&window.screen.height>window.screen.width)e=!e;else{let t=this.getBoundingRect();(e&&t.width<this.m_props.switchSize||!e&&t.height<this.m_props.switchSize)&&(e=!e)}e?(this.removeClass("@vlayout"),this.addClass("@hlayout")):(this.addClass("@vlayout"),this.removeClass("@hlayout"))}},"AutoLayout4");m(o1,"AutoLayout");var a1=h(class extends Ft{constructor(e){super(e)}render(){this.m_props.colSizes&&this.setStyleValue("grid-template-columns",this.m_props.colSizes),this.m_props.rowSizes&&this.setStyleValue("grid-template-rows",this.m_props.rowSizes),this.m_props.colGap&&this.setStyleValue("grid-gap",this.m_props.colGap),this.m_props.template&&this.setStyleValue("grid-template-areas",this.m_props.template.join(`
|
|
30
|
+
`))}},"GridLayout4");m(a1,"GridLayout");var h1=h(class extends Ft{m_cells;constructor(e){super(e),this.setTag("table"),this.m_cells=new Map}_getCell(e,t,i=!0){let s=pn(e,t);return this.m_cells.get(s)??(i?{item:void 0}:null)}_setCell(e,t,i,s=!1){let r=pn(e,t);this.m_cells.set(r,i),this.dom&&i.item&&s&&(i.item instanceof M?i.item.update():this.enumChilds(n=>{if(n.getData("row")==e&&n.getData("col")==t)return n.setContent(i.item),n.update(),!0}))}setCell(e,t,i){let s=this._getCell(e,t);s.item=i,this._setCell(e,t,s,!0)}setCellData(e,t,i){let s=this._getCell(e,t);s.data=i,this._setCell(e,t,s,!0)}getCellData(e,t){return this._getCell(e,t,!1)?.data}merge(e,t,i,s){let r=this._getCell(e,t);r.rowSpan=i,r.colSpan=s,this._setCell(e,t,r)}setCellWidth(e,t,i){let s=this._getCell(e,t);s.width=i,this._setCell(e,t,s)}setCellHeight(e,t,i){let s=this._getCell(e,t);s.height=i,this._setCell(e,t,s)}setCellClass(e,t,i){let s=this._getCell(e,t);s.cls=i,this._setCell(e,t,s)}setColClass(e,t){let i=this._getCell(-1,e);i.cls=t,this._setCell(-1,e,i)}setRowClass(e,t){let i=this._getCell(e,999);i.cls=t,this._setCell(e,999,i)}getCell(e,t){return this._getCell(e,t)?.item}render(){let e=[],t=[];for(let i=0;i<this.m_props.rows;i++){let s=[];for(let l=0;l<this.m_props.columns;l++){let o=pn(i,l);if(t.indexOf(o)>=0)continue;let a=this.m_cells.get(o),c=this.m_cells.get(pn(-1,l)),u="";a&&a.cls&&(u=a.cls),c&&c.cls&&(u+=" "+c.cls);let _=new M({tag:"td",content:a?.item,width:a?.width,height:a?.height,data:{row:i,col:l},cls:u});if(a){let p=a.rowSpan??0,v=a.colSpan??0;if(p>0&&_.setAttribute("rowspan",p+1),v>0&&_.setAttribute("colspan",v+1),p||v)for(let g=0;g<=p;g++)for(let x=0;x<=v;x++)t.push(pn(g+i,x+l))}s.push(_)}let r=this._getCell(i,999,!1),n=new M({tag:"tr",data:{row:i},content:s,cls:r?.cls});e.push(n)}this.setContent(e)}},"TableLayout4");m(h1,"TableLayout");function pn(e,t){return e*1e3+t}h(pn,"_mkid7");m(pn,"_mkid");var m1=h(class extends M{constructor(e){super(e),this.setContent(e.content)}setContent(e){if(!e)super.setContent(null);else{let t;vi(e)?t=new It({content:e}):t=e,t.addClass("@scroll-container"),super.setContent(t)}}},"ScrollView4");m(m1,"ScrollView");var c1=h(class extends Ft{constructor(e){let t=e.items;e.items=void 0,super(e),this.setDomEvent("sizechange",()=>{this.resizeAllItems()}),t&&t.forEach(i=>{this.addItem(i)})}resizeItem(e){let t=this.getComputedStyle(),i=t.parse("grid-auto-rows"),s=t.parse("grid-row-gap"),r=e.queryItem(".content");if(r||(r=e),r&&i+s){let n=r.getBoundingRect(),l=Math.ceil((n.height+s)/(i+s));e.setStyleValue("gridRowEnd","span "+l)}}resizeAllItems(){this.queryAll(".item",e=>{this.resizeItem(e)})}addItem(e){e.addClass("content"),this.appendChild(new Ft({cls:"item",content:e}))}},"Masonry4");m(c1,"Masonry");function D0(e){return ze({pos:e})}h(D0,"EvMove4");m(D0,"EvMove");var Qa=h(class extends Ft{m_ui_mask;m_hasMask=!0;constructor(e){super(e),this.addClass("@hidden")}enableMask(e=!0){this.m_hasMask=e}show(e){if(e!==void 0?this.m_hasMask=!!e:e=this.m_hasMask,this.m_hasMask){let t=V.activeElement;for(t&&t.blur(),this.m_ui_mask=V.body.lastChild;this.m_ui_mask;){if(this.m_ui_mask.nodeType==1){let i=wi(this.m_ui_mask);if(!(i.hasClass("@menu")||i.hasClass("@non-maskable"))){if(!(i.getStyleValue("display")=="none"||!i.isUserVisible())){if(i.hasClass("@comp"))break}}}this.m_ui_mask=this.m_ui_mask.previousSibling}this.m_ui_mask&&wi(this.m_ui_mask).addClass("@mask")}if(e&&_o.instance().enterModal(!0),this.setStyle({left:0,top:0}),V.body.appendChild(this._build()),this.removeClass("@hidden"),this.centerOnScreen(),e){let t=V.activeElement;if(!this.dom.contains(t)){let i=this.queryItem("[autofocus]");if(i)i.focus();else{let s=this.queryAll("[tabindex]");s&&(s=s.filter(r=>r.offsetParent!==null),s.length&&s[0].focus())}}Qa.modal_stack.push(this.dom)}}centerOnScreen(){let e=this.getBoundingRect(),t=`max( 0px, 50vw - ${e.width/2}px )`,i=`max( 0px, 50vh - ${e.height/2}px )`;this.setStyleValue("left",t),this.setStyleValue("top",i)}displayAt(e,t,i="top left",s,r=!1){this.show(r);let n="l",l="t";i.indexOf("right")>=0&&(n="r"),i.indexOf("bottom")>=0&&(l="b");let o=V.body.getBoundingClientRect(),a=this.getBoundingRect();n=="r"&&(e-=a.width),l=="b"&&(t-=a.height),s&&(e+=s.x,t+=s.y),e<4&&(e=4),e+a.width>o.right-4&&(e=o.right-4-a.width,s?.x<0&&(e+=s.x)),t<4&&(t=4),t+a.height>o.bottom-4&&(t=o.bottom-4-a.height,s?.y<0&&(t+=s.y)),this.setStyle({left:e,top:t})}close(){this.hide(),this.m_hasMask&&this.m_ui_mask&&(wi(this.m_ui_mask).removeClass("@mask"),_o.instance().enterModal(!1));let e=Qa.modal_stack.indexOf(this.dom);e>=0&&Qa.modal_stack.splice(e),this.dispose()}componentCreated(){if(this.m_props.sizable){this.addClass("@size-all");let e=["top","right","bottom","left","topleft","topright","bottomleft","bottomright"];for(let t of e)new Fh({target:this,sens:t,events:{rawresize:i=>this._mouseResize(i)}})}}_mouseResize(e){e.preventDefault();let t=this.getBoundingRect(),i=this.getComputedStyle(),s=e.ui_event,r=i.parse("marginTop"),n=i.parse("marginLeft"),l=i.parse("marginRight"),o=i.parse("marginBottom"),a=0,c=0,u=Ws(s,!0);switch(e.sens){case"topright":case"bottomright":case"right":a=t.right-l-u.x;break;case"topleft":case"bottomleft":case"left":a=t.left-n-u.x;break}switch(e.sens){case"bottomleft":case"bottomright":case"bottom":c=t.bottom-o-u.y;break;case"topleft":case"topright":case"top":c=t.top-r-u.y;break}t.left-=n,t.top-=r;let _=e.sens;M.setCapture(this,p=>{let v=m((g,x)=>{let E=t.left,y=t.top,k=t.width,A=t.height,S,w,D=g+a,R=x+c;switch(D<0&&(D=0),R<0&&(R=0),_){case"topright":case"bottomright":case"right":k=D-E;break;case"topleft":case"bottomleft":case"left":S=E-D,k+=S,E-=S;break}switch(_){case"bottomleft":case"bottomright":case"bottom":A=R-y;break;case"topleft":case"topright":case"top":w=y-R,A+=w,y-=w;break}let C=new Dn(k,A);this.setStyle({left:E,top:y,width:C.width,height:C.height}),this.emit("size",Ht(C))},"__move");if(p.type=="mouseup"||p.type=="touchend")M.releaseCapture();else if(p.type=="mousemove"){let g=p;v(g.pageX,g.pageY)}else if(p.type=="touchmove"){let g=p;v(g.touches[0].pageX,g.touches[0].pageY)}})}},"_Popup4"),vs=Qa;m(vs,"Popup");de(vs,"modal_stack",[]);function I0(e){if(e.key=="Tab"||e.key=="Enter"){let t=e.target;if(t.tagName=="TEXTAREA")return;let i=M.getElement(t);if(i&&(i.hasAttribute("wants-tab")||i.hasAttribute("wants-enter")))return;let s=V.body;vs.modal_stack.length&&(s=vs.modal_stack[vs.modal_stack.length-1]),A0(s,e.target,e.shiftKey),e.stopPropagation(),e.preventDefault()}}h(I0,"x4handleKeyDown4");m(I0,"x4handleKeyDown");function A0(e,t,i){let s=V.activeElement;if(!e.contains(s))return;let r=M.getElement(t),n=Array.from(e.querySelectorAll("[tabindex]"));if(n=n.filter(o=>o.offsetParent!==null),!n.length)return;let l=n.indexOf(t);l<0?l=0:i?l>0?l--:l=n.length-1:l<n.length-1?l++:l=0,n[l].focus()}h(A0,"_nextTab4");m(A0,"_nextTab");function id(){V.body.addEventListener("keydown",I0,!0)}h(id,"installKBHandler4");m(id,"installKBHandler");V.body?id():window.addEventListener("load",id);function M0(e){return ze({source:e})}h(M0,"EvAction4");m(M0,"EvAction");var P0=h(class extends Yn{constructor(e){super(e),this.mapPropEvents(e,"run")}get props(){return this.m_props}set text(e){this.m_props.text=e,this.emit("change",Xe(this))}set icon(e){this.m_props.icon=e,this.emit("change",Xe(this))}fire(){this.emit("run",M0(this))}},"Action4");m(P0,"Action");function jl(e,t,i=null){return ze({url:e,svg:t,context:i})}h(jl,"EvLoaded4");m(jl,"EvLoaded");function sd(e){let t=e.length;return e[0]=='"'&&e[t-1]=='"'&&(e=e.substring(1,t-1),e=e.replaceAll('\\"',"'")),e}h(sd,"trimQuotes4");m(sd,"trimQuotes");var T0=h(class extends po{svgs;constructor(){super(),this.svgs=new Map}load(e){if(this.svgs.has(e)){let t=this.svgs.get(e);t&&this.signal("loaded",jl(e,t))}else this.svgs.set(e,null),m(async i=>{if(i.substring(0,24)=="data:image/svg+xml;utf8,"){let s=i.substring(24);this.svgs.set(i,s),this.signal("loaded",jl(i,s))}else{let s=await fetch(i);if(s.ok){let r=await s.text();!r.startsWith("<svg")&&!r.startsWith("<?xml")?(console.error("svg loading error: ",r),this.signal("loaded",jl(i,""))):(this.svgs.set(i,r),this.signal("loaded",jl(i,r)))}}},"_load")(e)}},"Loader4");m(T0,"Loader");var xu=new T0,rd=h(class extends M{m_icon;m_iconName;constructor(e){We(e)?super({icon:e}):super(e),this._setIcon(this.m_props.icon,!1),this.m_props.size&&this.setStyleValue("fontSize",this.m_props.size)}_setIcon(e,t){if(!e){this.m_iconName="";return}this.removeClass("@svg");let i,s;if(typeof e=="number")e=e.toString(16),i=e,console.error("deprecation error: invalid icon name");else{let l=/\s*var\s*\(\s*(.+)\s*\)\s*/gi,o=l.exec(e);for(;o;){let y=o[1].trim();if(e=Or.getVar(y).trim(),e==""||e===void 0){console.error(`icon: unable to find variable named '${y}'`);return}else e=sd(e);o=l.exec(e)}if(e.startsWith("<svg")){this._setSVG("data:image/svg+xml;utf8,"+e);return}let a=/\s*svg\s*\(\s*(.+)\s*\)\s*/gi,c=/(.*\.svg)$/gi,u=a.exec(e)||c.exec(e);if(u){let y=u[1].trim();this._setSVG(y);return}let p=/^\s*(data\:image\/.+)\s*$/gi.exec(e);if(p){this._setSVG(p[1]);return}let g=/\s*cls\s*\(\s*(.+)\s*\)\s*/gi.exec(e);if(g){let y=g[1].trim();this.addClass(y);return}let E=/\s*url\s*\(\s*(.+)\s*\)\s*/gi.exec(e);if(E){s=sd(E[1].trim()),s=s.replaceAll("\\",""),this._setSVG(s);return}else console.error("deprecation error: invalid icon name"),i=e,e=Or.getVar("icon-"+e),(e==""||e===void 0)&&(e="0")}if(this.m_iconName=i,this.m_icon===e)return;let r=M.getCss(),n;if(t&&this.m_icon&&(n="icon-"+i,this.removeClass(n)),n="icon-"+i,rd.icon_cache[n]===void 0){rd.icon_cache[n]=!0;let l;s?l=`display: block; content: ' '; background-image: url(${s}); background-size: contain; width: 100%; height: 100%; background-repeat: no-repeat; color: white;`:l=`content: "\\${e}";`,r.setRule(n,`.${n}::before {${l}}`)}this.addClass(n),this.m_icon=e}set icon(e){this._setIcon(e,!0)}get icon(){return this.m_iconName}_setSVG(e){let t=m(i=>{i.url==e&&(this.addClass("@svg-icon"),this.setContent(Ni.from(i.svg),!1),xu.off("loaded",t))},"set");xu.on("loaded",t),xu.load(e)}_setSVGPath(e){this.addClass("@svg-icon"),this.setContent(Ni.from(`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="${e}/></svg>`),!1)}},"_Icon4"),lt=rd;m(lt,"Icon");de(lt,"icon_cache",[]);var Ue=h(class extends M{constructor(e){typeof e=="string"||e instanceof Ni?super({text:e}):super(e)}render(e){let t=this.m_props.text;this.m_props.multiline&&!(t instanceof Ni)&&(t=new Ni(sh(t,!0))),e.icon?(this.setTag("span"),this.addClass("@hlayout"),this.setContent([new lt({icon:e.icon}),new M({content:t,ref:"text"})])):this.setContent(t),this.addClass(e.align??"left")}set text(e){let t=this.m_props;if(t.text!==e){t.text=e;let i=this.m_props.text;if(this.m_props.multiline&&!(i instanceof Ni)&&(i=new Ni(sh(i,!0))),this.dom){let s=this;this.m_props.icon&&(s=this.itemWithRef("text")),s.setContent(i)}}}get text(){return this.m_props.text}},"Label4");m(Ue,"Label");var u1=h(class extends M{},"MenuSeparator4");m(u1,"MenuSeparator");var d1=h(class extends Ue{},"MenuTitle4");m(d1,"MenuTitle");var gt=h(class extends vs{m_subMenu;m_opener;m_virtual;m_lock;constructor(e,t){super(e),this.addClass("@shadow"),this.m_opener=t,this.m_virtual=!1,this.m_lock=0,this.enableMask(!1)}lock(e){this.m_lock+=e?1:-1}setVirtual(){this.m_virtual=!0}setSubMenu(e){this.m_subMenu=e}hideSubMenu(){this.m_subMenu&&(this.m_subMenu.m_opener._close(),this.m_subMenu.hide(),this.m_subMenu=null)}render(e){this.setContent(e.items)}show(){this.m_virtual||gt._addMenu(this),super.show()}close(){!this.dom&&!this.m_virtual||(this.m_opener&&this.m_opener._close(),this.m_subMenu&&(this.m_subMenu.close(),this.m_subMenu=null),super.close(),gt._removeMenu())}clear(){this.m_props.items=[]}static _addMenu(e){gt.watchCount==0&&(gt.rootMenu=e,V.addEventListener("mousedown",gt._mouseWatcher)),gt.watchCount++}static _removeMenu(){console.assert(gt.watchCount>0),gt.watchCount--,gt.watchCount==0&&V.removeEventListener("mousedown",gt._mouseWatcher)}static _mouseWatcher(e){if(e.defaultPrevented)return;let t=e.target;for(;t;){let i=M.getElement(t);if(i&&i instanceof gt)return;t=t.parentElement}gt._discardAll()}static _discardAll(){gt.rootMenu&&(gt.rootMenu.close(),gt.rootMenu=null)}displayAt(...e){this.m_lock||gt._discardAll();let t,i,s,r;e.length==1?{x:t,y:i}=Ws(e[0],!0):[t,i,s,r]=e,s||(s="top left"),super.displayAt(t,i,s,r)}},"_Menu4"),ws=gt;m(ws,"Menu");de(ws,"watchCount",0);de(ws,"rootMenu",null);var Kn=h(class extends M{m_menu;m_isOpen;m_action;constructor(e,t){e instanceof P0?(super({click:()=>{e.fire()}}),this.m_action=e):We(e)?super({text:e,click:t}):super(e),this.mapPropEvents(this.m_props,"click"),this.m_menu=null,this.m_isOpen=!1,this.setDomEvent("mousedown",i=>this._mousedown(i)),this.setDomEvent("click",i=>this._click(i))}render(e){let t=e.icon??0,i=e.text;e.checked!==void 0&&(t=e.checked?"var( --x4-icon-check )":0),this.m_action&&(t||(t=this.m_action.props.icon),i===void 0&&(i=this.m_action.props.text));let s=null;this.isPopup&&(this.addClass("@popup-menu-item"),s=new lt({icon:"var( --x4-icon-chevron-right )",cls:"pop-mark"})),!i&&!t&&this.addClass("@separator"),e.cls&&this.addClass(e.cls),this.setTag("a"),this.setContent([t<0?null:new lt({icon:t}),new Ue({flex:1,text:i}),s])}get id(){return this.m_props.itemId}get text(){return this.m_props.text}get isPopup(){return!!this.m_props.items}_close(){this.removeClass("@opened"),this.m_isOpen=!1}_click(e){this.isPopup||(this.emit("click",lr()),ws._discardAll())}_mousedown(e){if(this.isPopup){this.m_menu||(this.m_menu=new ws({items:this.m_props.items},this));let t=this.m_isOpen,i=M.getElement(this.dom,ws);if(i&&i.hideSubMenu(),!t){i&&i.setSubMenu(this.m_menu),this.m_isOpen=!0;let s=this.getBoundingRect();this.m_menu.lock(!0),i?this.m_menu.displayAt(s.right,s.top):this.m_menu.displayAt(s.left,s.bottom),this.m_menu.lock(!1),this.addClass("@opened")}e.preventDefault()}}},"MenuItem4");m(Kn,"MenuItem");var _1=h(class extends ue{m_items;constructor(e,t){super(e),console.assert(!1,"not imp"),this.addClass("@shadow"),this.m_items=e.items}render(){this.setContent(this.m_items)}},"MenuBar4");m(_1,"MenuBar");var F0=h(class extends It{m_selection;m_defer_sel;m_container;m_view;m_topIndex;m_itemHeight;m_cache;constructor(e){super(e),this.setDomEvent("keydown",t=>this.handleKey(t)),this.setDomEvent("click",t=>this._handleClick(t)),this.setDomEvent("dblclick",t=>this._handleClick(t)),this.setDomEvent("contextmenu",t=>this._handleCtxMenu(t)),this._setTabIndex(e.tabIndex,0),this.mapPropEvents(e,"click","dblClick","contextMenu","selectionChange","cancel")}componentCreated(){this.m_props.virtual?this._buildItems():this.m_props.populate&&(this.items=this.m_props.populate(null))}render(e){e.items=e.items||[],e.gadgets=e.gadgets,e.renderItem=e.renderItem,e.virtual=e.virtual??!1,this.m_topIndex=0,e.virtual?(console.assert(e.itemHeight!==void 0),this.m_itemHeight=e.itemHeight,this.m_cache=new Map,this.addClass("virtual")):(this.m_itemHeight=void 0,this.m_cache=void 0),this._buildContent()}set items(e){this.setItems(e)}get items(){return this.m_props.items}setItems(e,t=!0){this.m_props.items=e,t||(this.m_selection=null),this.m_container?this._buildItems():this._buildContent()}handleKey(e){let t=m(i=>{let s;rs(this.m_props.items)?(s=this.m_props.items(),this.m_props.items=s):s=this.m_props.items;let r;if(!this.m_selection)s&&(r=s[0]);else{let l=s.findIndex(o=>o===this.m_selection.item);i>0&&l<s.length-1?r=s[l+1]:i<0&&l>0?r=s[l-1]:r=this.selection}let n=this._findItemWithId(r?.id);this._selectItem(r,n,!0)},"moveSel");switch(e.key){case"ArrowDown":{t(1),e.preventDefault(),e.stopPropagation();break}case"ArrowUp":{t(-1),e.preventDefault(),e.stopPropagation();break}}}_buildContent(){let e=this.m_props;e.virtual?(this.m_container=new Ft({cls:"@scroll-container",content:[]}),this.m_view=new Ft({cls:"@scroll-view",flex:1,content:this.m_container,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)}}),this.setContent([this.m_view,e.gadgets?new ue({cls:"gadgets",content:e.gadgets}):null])):(this.m_view=void 0,this.m_container=new It({cls:"@scroll-container",content:[]}),this.addClass("@scroll-view"),this.setContent(this.m_container,!1)),e.virtual&&this.m_container.setStyleValue("height",e.items.length*this.m_itemHeight),(this.dom||!e.virtual)&&this._buildItems()}_updateScroll(e){let t=m(()=>{let i=Math.floor(this.m_view.dom.scrollTop/this.m_itemHeight);(i!=this.m_topIndex||e)&&(this.m_topIndex=i,this._buildItems())},"update");e?this.startTimer("scroll",10,!1,t):t()}async _buildItems(){let e=this.m_props,t=[],i=e.items;rs(i)&&(i=i());let s=this.m_selection?.item.id,r=!1;if(e.virtual){let n=this.getBoundingRect(),l=100,o=0,a=this.m_topIndex*this.m_itemHeight,c=this.m_topIndex,u=n.height,_=e.items.length,p=[],v=this.m_cache;for(this.m_cache=new Map;o<u&&c<_&&--l>0;){let g=e.items[c],x;v.has(g.id)?(x=v.get(g.id),v.delete(g.id)):(x=this._renderItem(g),p.push(x)),s==g.id&&(x.addClass("@selected"),r=!0),x.setStyleValue("top",a+o),t.push(x),this.m_cache.set(g.id,x),o+=this.m_itemHeight,c++}v.forEach(g=>{g.dispose()}),this.m_container.appendChild(p),this.m_container.setStyleValue("height",_*this.m_itemHeight),r||i.some(g=>s==g.id)||(this.m_selection=null)}else i.forEach(n=>{let l=this._renderItem(n);s==n.id&&(l.addClass("@selected"),r=!0),t.push(l)}),this.m_container.setContent(t,!1),r||(this.m_selection=null);if(this.m_defer_sel){let n=this.m_defer_sel;this.m_defer_sel=void 0,this.selection=n}}_renderItem(e){let t=this.onRenderItem(e);return t.setAttribute("data-id",e.id),t.addClass("@list-item"),t.setData("item-id",e.id),t}onRenderItem(e){return this.m_props.renderItem?this.m_props.renderItem(e):new ue({content:e.text})}_handleClick(e){e.stopImmediatePropagation(),e.preventDefault();let t=e.target,i=this.dom,s=this.m_props.items;for(;t&&t!=i;){let r=M.getElement(t),n=r?.getData("item-id");if(n!==void 0){let l=s.find(o=>o.id==n);if(l){let o;e.type=="click"?(o=lr(l),this.emit("click",o)):(o=vo(l),this.emit("dblClick",o)),o.defaultPrevented||this._selectItem(l,r)}else this._selectItem(null,null);return}t=t.parentElement}this._selectItem(null,null)}_handleCtxMenu(e){e.preventDefault();let t=e.target,i=this.dom,s=this.m_props.items;for(;t&&t!=i;){let r=M.getElement(t),n=r?.getData("item-id");if(n){let l=s.find(o=>o.id==n);l&&(this._selectItem(l,r),this.emit("contextMenu",Hr(e,l)));return}t=t.parentElement}this.emit("contextMenu",Hr(e,null))}_selectItem(e,t,i=!0){this.m_selection&&this.m_selection.citem&&this.m_selection.citem.removeClass("@selected"),this.m_selection=e?{item:e,citem:t}:null,this.m_selection&&this.m_selection.citem&&this.m_selection.citem.addClass("@selected"),i&&this.emit("selectionChange",hs(e))}get selection(){return this.m_selection?this.m_selection.item:null}set selection(e){if(e==null)this._selectItem(null,null);else if(rs(this.m_props.items))this.m_defer_sel=e;else{let t=this.m_props.items.find(s=>s.id==e),i=this._findItemWithId(t.id);this._selectItem(t,i,!1)}}_findItemWithId(e){let t=null;return this.dom&&this.m_container.enumChilds(i=>{if(i.getData("item-id")==e)return i.scrollIntoView(),t=i,!0}),t}appendItem(e,t=!1,i=!0){t?this.m_props.items.unshift(e):this.m_props.items.push(e),i&&(this.selection=null),this.m_container?this._buildItems():this._buildContent(),i&&(this.selection=e.id)}updateItem(e,t){let i=this.m_props.items.findIndex(n=>n.id===e);if(i<0)return;let s=!1;this.m_selection&&this.m_selection.item===this.m_props.items[i]&&(s=!0),this.m_props.items[i]=t;let r=this.queryItem(`[data-id="${t.id}"]`)?.dom;if(r){let n=this._renderItem(t);s&&(n.addClass("@selected"),this.m_selection.citem=n,this.m_selection.item=t);let l=n._build();this.m_container.dom.replaceChild(l,r)}}},"ListView4");m(F0,"ListView");function z0(e=null){return ze({context:e})}h(z0,"EvCancel4");m(z0,"EvCancel");var ef=h(class extends vs{m_list;constructor(e){super({tabIndex:!1}),this.enableMask(!1),this.addClass("@non-maskable"),e.tabIndex=!1,this.m_list=new F0(e),this.setContent(this.m_list),this.mapPropEvents(e,"cancel")}set items(e){this.m_list.items=e}handleKey(e){this.m_list.handleKey(e)}_handleClick=e=>{if(!this.dom)return;let t=e.target;this.dom.contains(t)||M.getElement(t,Kn)||(this.signal("cancel",z0()),this.close())};show(e){V.addEventListener("mousedown",this._handleClick),super.show(e)}hide(){V.removeEventListener("mousedown",this._handleClick),super.hide()}close(){V.removeEventListener("mousedown",this._handleClick),super.close()}get selection(){return this.m_list.selection}set selection(e){this.m_list.selection=e}},"PopupListView4");m(ef,"PopupListView");var ss=h(class extends M{constructor(e){super(e)}render(e){this.setTag("input"),this._setTabIndex(e.tabIndex),this.setAttributes({value:e.value,type:e.type||"text",name:e.name,placeholder:e.placeHolder,autofocus:e.autoFocus,readonly:e.readOnly,autocomplete:"new-password",tabIndex:e.tabIndex,spellcheck:e.spellcheck===!1?"false":void 0,min:e.min,max:e.max,...e.attrs}),this.m_props.autosel=e.autosel??!0,e.uppercase&&this.setStyleValue("textTransform","uppercase"),this.m_props.autosel&&this.setDomEvent("focus",()=>{this.selectAll()})}getType(){return this.m_props.type}get value(){if(this.dom&&(this.m_props.value=this.dom.value),this.m_props.uppercase){let e=this.m_props.value.toUpperCase();this.dom&&e!=this.m_props.value&&(this.dom.value=e),this.m_props.value=e}return this.m_props.value}set value(e){this.m_props.value=e,this.dom&&(this.dom.value=e)}getStoreValue(){if(this.m_props.value_hook)return this.m_props.value_hook.get();{let e=this.getAttribute("type");e&&(e=e.toLowerCase());let t,i=this.dom;if(e==="file"){t=[];let s=i.files;for(let r=0;r<s.length;r++)t.push(s[r].name)}else if(e==="checkbox")i.checked?t=1:t=0;else if(e==="radio")i.checked&&(t=this.value);else if(e==="date")debugger;else t=this.value;return t}}setStoreValue(e){if(this.m_props.value_hook)return this.m_props.value_hook.set(e);{let t=this.getAttribute("type"),i=this.dom;if(t&&(t=t.toLowerCase()),t==="checkbox"){let s=e!==null&&e!=="0"&&e!==0&&e!==!1;s!==i.checked&&(i.setAttribute("checked",""+s),i.dispatchEvent(new Event("change")))}else this.value=e}}set readOnly(e){this.setAttribute("readonly",e)}selectAll(){this.dom.select()}select(e,t=9999){this.dom.setSelectionRange(e,e+t)}getSelection(){let e=this.dom;return{start:e.selectionStart,length:e.selectionEnd-e.selectionStart}}},"Input4");m(ss,"Input");var tf=h(class extends M{constructor(e){super(e),this.setTag("button"),this.setDomEvent("click",t=>this._handleClick(t)),this.setDomEvent("mousedown",()=>{this._startAutoRep(!0)}),this.setDomEvent("mouseup",()=>{this._startAutoRep(!1)}),this.setDomEvent("keydown",t=>this._handleKeyDown(t)),this.mapPropEvents(e,"click")}render(e){let t=e.action,i=e.icon,s=e.text;t&&(!i&&t.props.icon&&(i=t.props.icon),s===void 0&&t.props.text&&(s=t.props.text));let r=i?new lt({icon:i,cls:"left",ref:"l_icon"}):null,n=new Ue({flex:1,text:s??"",align:e.align,ref:"label"}),l=e.rightIcon?new lt({icon:e.rightIcon,cls:"right",ref:"r_icon"}):null;s===void 0&&n.addClass("@hidden"),this.setContent([r,n,l]),this._setTabIndex(e.tabIndex)}_startAutoRep(e){this.m_props.autoRepeat&&(e?this.startTimer("repeat",700,!1,()=>{this.startTimer("repeat",this.m_props.autoRepeat,!0,this._sendClick)}):this.stopTimer("repeat"))}_handleKeyDown(e){!e.ctrlKey&&!e.shiftKey&&!e.altKey&&(e.key=="Enter"||e.key==" ")&&(this._sendClick(),e.preventDefault(),e.stopPropagation())}_handleClick(e){if(this.m_props.menu){let t=new ws({items:rs(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),i=this.getBoundingRect();t.displayAt(i.left,i.bottom,"tl")}else this._sendClick();e.preventDefault(),e.stopPropagation()}_sendClick(){if(this.m_props.menu){let e=new ws({items:rs(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),t=this.getBoundingRect();e.displayAt(t.left,t.bottom,"tl")}else this.emit("click",lr()),this.m_props.action&&this.m_props.action.fire()}set text(e){this.m_props.text=e;let t=this.itemWithRef("label");t&&(t.text=e,t.removeClass("@hidden"))}get text(){return this.itemWithRef("label")?.text}set icon(e){this.m_props.icon=e;let t=this.itemWithRef("l_icon");t?t.icon=e:this.update()}get icon(){return this.itemWithRef("l_icon")?.icon}set rightIcon(e){this.m_props.rightIcon=e;let t=this.itemWithRef("r_icon");t&&(t.icon=e)}get rightIcon(){return this.itemWithRef("l_icon")?.icon}set menu(e){this.m_props.menu=e}},"BaseButton4");m(tf,"BaseButton");var yt=h(class extends tf{},"Button4");m(yt,"Button");var f1=h(class extends tf{constructor(e){super(e)}render(e){super.render(e),e.checked&&(this.addClass("checked"),this._updateIcon())}_sendClick(){super._sendClick(),this.m_props.checked=!this.m_props.checked,this.setClass("checked",this.m_props.checked),this.emit("change",Xe(this.m_props.checked)),this._updateIcon()}_updateIcon(){if(this.m_props.checkedIcon){let e=this.m_props.checked?this.m_props.checkedIcon:this.m_props.icon,t=this.itemWithRef("l_icon");t&&(t.icon=e)}}},"ToggleButton4");m(f1,"ToggleButton");var R0=h(class extends It{m_date;constructor(e){super(e),this.mapPropEvents(e,"change"),this.m_date=e.date?.clone()??new Date}render(e){let t=ql(this.m_date);t.setDate(1);let i=t.getDay();i==0&&(i=7),t.setDate(-i+1+1);let s=ql(t),r=this.m_date.hash(),n=ql(this.m_date);n.setDate(1),n.setMonth(n.getMonth()+1),n.setDate(0);let l=Jl(n),o=[],a=new ue({cls:"month-sel",content:[new Ue({cls:"month",text:Ot(this.m_date,"O"),dom_events:{click:()=>this._choose("month")}}),new Ue({cls:"year",text:Ot(this.m_date,"Y"),dom_events:{click:()=>this._choose("year")}}),new lh,new yt({text:"<",click:()=>this._next(!1)}),new yt({text:">",click:()=>this._next(!0)})]});o.push(a);let c=[];c.push(new ue({cls:"weeknum cell"}));for(let p=0;p<7;p++)c.push(new Ue({cls:"cell",flex:1,text:ne.global.day_short[(p+1)%7]}));o.push(new ue({cls:"week header",content:c}));let u=this.m_date.getMonth(),_=!0;for(;Jl(s)<=l;){let p=[new ue({cls:"weeknum cell",content:new M({tag:"span",content:Ot(s,"w")})})];for(let v=0;v<7;v++){let g="cell day";s.hash()==r&&(g+=" today"),s.getMonth()!=u&&(g+=" out");let x=m(E=>new ue({cls:g,flex:1,content:new M({tag:"span",content:Ot(E,"d")}),dom_events:{click:()=>this.select(E)}}),"mkItem");p.push(x(s.clone())),s.setDate(s.getDate()+1),_=!1}o.push(new ue({cls:"week",flex:1,content:p}))}this.setContent(o)}select(e){this.m_date=e,this.emit("change",Xe(e)),this.update()}_next(e){this.m_date.setMonth(this.m_date.getMonth()+(e?1:-1)),this.update()}_choose(e){let t=[];if(e=="month")for(let r=0;r<12;r++)t.push(new Kn({text:ne.global.month_long[r],click:()=>{this.m_date.setMonth(r),this.update()}}));else if(e=="year"){let r=this.m_props.minDate?.getFullYear()??1900,n=this.m_props.maxDate?.getFullYear()??2037;for(let l=r;l<n;l++)t.push(new Kn({text:""+l,click:()=>{this.m_date.setFullYear(l),this.update()}}))}let i=new ws({items:t}),s=this.getBoundingRect();i.displayAt(s.left,s.top)}get date(){return this.m_date}set date(e){this.m_date=e,this.update()}},"Calendar4");m(R0,"Calendar");var L0=h(class extends vs{m_cal;constructor(e){super({tabIndex:1}),this.enableMask(!1),this.m_cal=new R0(e),this.m_cal.addClass("@fit"),this.setContent(this.m_cal)}_handleClick=e=>{if(!this.dom)return;let t=e.target;this.dom.contains(t)||M.getElement(t,Kn)||this.close()};show(e,t){V.addEventListener("mousedown",this._handleClick),t?super.displayAt(t.x,t.y,"top left",void 0,e):super.show(e)}close(){V.removeEventListener("mousedown",this._handleClick),super.close()}},"PopupCalendar4");m(L0,"PopupCalendar");var Cu,Ts,sf=h(class extends M{m_text;set text(e){this.m_text.text=e}render(){this.setClass("@non-maskable",!0),this.setContent([new lt({icon:"var( --x4-icon-tip )"}),this.m_text=new Ue({text:"help"})])}displayAt(e,t,i="top left"){this.show();let s="l",r="t";i.indexOf("right")>=0&&(s="r"),i.indexOf("bottom")>=0&&(r="b");let n=V.body.getBoundingClientRect(),l=this.getBoundingRect();s=="r"&&(e-=l.width),r=="b"&&(t-=l.height),e+l.width>n.right&&(e=n.right-l.width),t+l.height>n.bottom&&(t=n.bottom-l.height-17),this.setStyle({left:e,top:t})}},"Tooltip4");m(sf,"Tooltip");function p1(e){if(bd())return;let t={target:null,x:0,y:0};function i(n){t.x=n.pageX,t.y=n.pageY}h(i,"handle_mpos"),m(i,"handle_mpos");function s(n){let l=n.target,o=null;for(t.x=n.pageX+10,t.y=n.pageY+15;l&&(o=l.getAttribute("tip"),!o);)l=l.parentElement;if(!(l==t.target||Ts&&l==Ts.dom)){if(!l||!o){t.target=null,e?e(null):r();return}t.target=l,e?e(null):r(),e?e(o):Cu=setTimeout(()=>{Ts===void 0&&(Ts=new sf({}),V.body.appendChild(Ts._build())),Ts.text=o,Ts.displayAt(t.x+17,t.y+17,"top left")},700)}}h(s,"handle_mouse"),m(s,"handle_mouse");function r(){Cu&&clearTimeout(Cu),Ts&&Ts.hide()}h(r,"_hideTip"),m(r,"_hideTip"),V.body.addEventListener("mouseover",s),V.body.addEventListener("mouseout",s),V.body.addEventListener("mousemove",i)}h(p1,"initTooltips4");m(p1,"initTooltips");var g1=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Si=h(class extends M{m_cal_popup;m_ui_input;m_error_tip;constructor(e){super(e),this.addClass("@hlayout"),this.mapPropEvents(e,"change","click","focus")}componentCreated(){super.componentCreated(),this.m_props.autoFocus&&this.focus()}componentDisposed(){this.m_error_tip&&this.m_error_tip.dispose(),super.componentDisposed()}focus(){this.m_ui_input.focus()}render(e){let t={flex:1,dom_events:{focus:()=>this._focus(),focusout:()=>this._blur(),input:()=>this._change()},value:e.value,name:e.name,type:e.type,placeHolder:e.placeHolder,autoFocus:e.autoFocus,readOnly:e.readOnly,value_hook:e.value_hook,uppercase:e.uppercase,spellcheck:e.spellcheck,tabIndex:e.tabIndex===void 0?!0:e.tabIndex,attrs:e.attrs,min:e.min,max:e.max,autosel:e.autosel};if(e.type=="date"){e.format=e.format??"Y-M-D",t.type="text";let _={get:()=>this._date_get_hook(),set:p=>this._date_set_hook(p)};t.value_hook=e.value_hook??_}this.m_ui_input=new ss(t);let i;e.icon?i=new yt({icon:e.icon,click:()=>this._btnClick(),tabIndex:!1}):e.type=="date"&&(i=new yt({cls:"gadget",icon:"var( --x4-icon-calendar-days )",tabIndex:!1,click:()=>this._showDatePicker(i)}),e.validator||(e.validator=this._date_validator));let s=e.gadgets??[];s.forEach(_=>{_.addClass("gadget")});let r=[i,...s];this.setClass("@required",e.required),e.gadgets&&e.gadgets.length&&this.addClass("with-gadgets");let n,l,o=e.labelWidth;o>0&&(n=o),o<0&&(l=-o);let a,c=e.labelAlign,u=!1;e.label&&(c=="top"&&(c="left",u=!0,l=1),a=new Ue({ref:"label",tag:"label",cls:"label1"+(e.label?"":" @hidden"),text:e.label??"",width:n,flex:l,align:c})),u?(this.removeClass("@hlayout"),this.addClass("@vlayout vertical"),this.setContent([a,new ue({width:n,content:[this.m_ui_input,...r]})])):(this.addClass("@hlayout"),this.setContent([a,this.m_ui_input,...r]))}enable(e){e===!0&&this.m_ui_input.enable(),super.enable(e)}disable(){this.m_ui_input.disable(),super.disable()}_btnClick(){this.emit("click",lr(this.value))}setDateStoreFormat(e){this.m_props.format=e}setStoreValue(e){this.m_ui_input.setStoreValue(e)}getStoreValue(){return this.m_ui_input.getStoreValue()}_date_get_hook(){let e=Wa(this.value),t=this.m_props;return t.format=="native"?e:e?Ot(e,t.format):null}_date_set_hook(e){let t=this.m_props;if(t.format=="native")this.value=Ot(e);else if(e){let i=Wa(e,t.format);this.value=Ot(i)}else this.value=""}showError(e){this.m_error_tip||(this.m_error_tip=new sf({cls:"error"}),V.body.appendChild(this.m_error_tip._build()));let t=this.m_ui_input.getBoundingRect();this.m_error_tip.text=e,this.m_error_tip.displayAt(t.right,t.top,"top left"),this.addClass("@error")}clearError(){this.m_error_tip&&(this.m_error_tip.hide(),this.removeClass("@error"))}get value(){return this.m_ui_input?this.m_ui_input.value:this.m_props.value}set value(e){this.m_ui_input?this.m_ui_input.value=e:this.m_props.value=e}selectAll(){this.m_ui_input.selectAll()}select(e,t=9999){this.m_ui_input.select(e,t)}getSelection(){return this.m_ui_input.getSelection()}set readOnly(e){this.m_ui_input.readOnly=e}get label(){return this.itemWithRef("label")?.text}set label(e){this.itemWithRef("label").text=e}_change(){let e=this.m_ui_input.value;this.emit("change",Xe(e))}_focus(){this.clearError(),this.emit("focus",Iu(!0))}_blur(){this._validate(this.m_ui_input.value),this.emit("focus",Iu(!1))}validate(){return this._validate(this.value)}_validate(e){let t=this.m_props,i=!1;if(t.required&&e.length==0)return this.showError(ne.global.required_field),!1;if(e!=""){let s=this.getAttribute("pattern");if(s){let r=new RegExp(s);if(r&&!r.test(e))return this.showError(ne.global.invalid_format),!1}if(t.type=="email"){if(!g1.test(e.toLowerCase()))return this.showError(ne.global.invalid_email),!1}else if(t.type=="number"){let r=parseFloat(e);if(isNaN(r))return this.showError(ne.global.invalid_number),!1;let n=parseFloat(this.m_ui_input.getAttribute("min"));n!==void 0&&r<n&&(e=""+n,i=!0);let l=parseFloat(this.m_ui_input.getAttribute("max"));l!==void 0&&r>l&&(e=""+l,i=!0)}}if(t.validator)try{this.value=t.validator(e)}catch(s){return this.showError(s instanceof Error?s.message:s),!1}else i&&(this.value=e);return!0}_date_validator(e){if(e=e.trim(),e=="")return"";let t;if(e=="@")t=new Date;else if(t=Wa(e),!t)throw $l(ne.global.invalid_date,ne.global.date_format);return Ot(t)}_showDatePicker(e){this.m_cal_popup||(this.m_cal_popup=new L0({change:i=>{this.value=Ot(i.value),this.m_cal_popup.close()}}));let t=this.m_ui_input.getBoundingRect();this.m_cal_popup.displayAt(t.left,t.bottom,"top left")}get input(){return this.m_ui_input}get type(){return this.m_props.type}},"TextEdit4");m(Si,"TextEdit");var v1=h(class extends Si{m_popup;m_popvis;m_needval;m_lockpop;constructor(e){super(e),this.setDomEvent("input",()=>this._onChange()),this.setDomEvent("focusin",()=>this._onFocus()),this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.m_popvis=!1,this.m_needval=!1,this.m_lockpop=!1,this.setDomEvent("keydown",t=>this._onKey(t))}_onKey(e){this.m_popvis?e.key=="ArrowUp"||e.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(e),this.m_lockpop=!1,e.preventDefault(),e.stopPropagation()):e.key=="Escape"&&(this._hidePopup(),e.preventDefault(),e.stopPropagation()):e.key=="ArrowDown"&&(this._onChange(),e.preventDefault(),e.stopPropagation())}_onChange(){let e=this.m_props.enumValues(this.value);this.showPopup(e)}componentDisposed(){this.m_popup&&this._hidePopup(),super.componentDisposed()}showPopup(e){if(this.m_props.readOnly||this.hasClass("@disable"))return;if(!this.m_popup){let s=this.getComputedStyle(),r=s.value("fontFamily"),n=s.value("fontSize");this.m_popup=new ef({cls:"@combo-popup",attrs:{tabindex:0},selectionChange:l=>{this.value=l.selection.id,this.m_lockpop||(this._hidePopup(),this.focus())},style:{fontFamily:r,fontSize:n}})}this.m_popup.items=e.map(s=>({id:s,text:s}));let i=this.m_ui_input.getBoundingRect();this.m_popup.setStyle({minWidth:i.width}),this.m_popup.displayAt(i.left,i.bottom),this.m_popvis=!0}_validate(e){return!0}validate(){return super._validate(this.value)}_checkFocus(){let e=document.activeElement;this.dom&&this.dom.contains(e)||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(e)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1),this.m_needval&&(this.validate(),this.m_needval=!1)}_onFocus(){this.value.length==0&&this._onChange(),this.m_needval=!0}},"AutoComplete4");m(v1,"AutoComplete");function V0(e){return ze({ctx:e})}h(V0,"EvPaint4");m(V0,"EvPaint");function B0(e,t,i){let s=e;return s.width=t,s.height=i,s.smoothLine=H0,s.smoothLineEx=O0,s.line=W0,s.roundRect=j0,s.calcTextSize=G0,s.setFontSize=N0,s.circle=U0,s}h(B0,"mkPainter4");m(B0,"mkPainter");function H0(e,t=null,i=!0){if(e.length<2)return;if(t||(t=this),e.length==2){i!==!1?t.moveTo(e[0].x,e[0].y):t.lineTo(e[0].x,e[0].y),t.lineTo(e[1].x,e[1].y);return}function s(a,c){return{x:a.x+(c.x-a.x)/2,y:a.y+(c.y-a.y)/2}}h(s,"midPointBtw"),m(s,"midPointBtw");function r(a,c,u,_,p,v,g){return{x:(1-a)*(1-a)*c+2*(1-a)*a*_+a*a*v,y:(1-a)*(1-a)*u+2*(1-a)*a*p+a*a*g}}h(r,"getQuadraticXY"),m(r,"getQuadraticXY");let n=e[0],l=e[1],o=n;t.moveTo(n.x,n.y);for(let a=1,c=e.length;a<c;a++){let u=s(n,l);for(let _=0;_<8;_++){let{x:p,y:v}=r(_/8,o.x,o.y,n.x,n.y,u.x,u.y);t.lineTo(p,v)}n=e[a],l=e[a+1],o=u}t.lineTo(n.x,n.y)}h(H0,"smoothLine4");m(H0,"smoothLine");function O0(e,t=.5,i=10,s=null,r=!0,n=!1){let l=[];for(let w=0,D=e.length;w<D;w++)l.push(e[w].x),l.push(e[w].y);let o,a=1,c=l.length,u=0,_=(c-2)*i+2+(n?2*i:0),p=new Float32Array(_),v=new Float32Array((i+2)*4),g=4;for(o=l.slice(0),n?(o.unshift(l[c-1]),o.unshift(l[c-2]),o.push(l[0],l[1])):(o.unshift(l[1]),o.unshift(l[0]),o.push(l[c-2],l[c-1])),v[0]=1;a<i;a++){var x=a/i,E=x*x,y=E*x,k=y*2,A=E*3;v[g++]=k-A+1,v[g++]=A-k,v[g++]=y-2*E+x,v[g++]=y-E}v[g]=1,S(o,v,c),n&&(o=[],o.push(l[c-4],l[c-3],l[c-2],l[c-1]),o.push(l[0],l[1],l[2],l[3]),S(o,v,4));function S(w,D,R){for(var C=2,z;C<R;C+=2){var W=w[C],J=w[C+1],ve=w[C+2],te=w[C+3],ie=(ve-w[C-2])*t,K=(te-w[C-1])*t,Y=(w[C+4]-W)*t,Nt=(w[C+5]-J)*t;for(z=0;z<i;z++){var Te=z<<2,Ut=D[Te],$t=D[Te+1],qt=D[Te+2],Kt=D[Te+3];p[u++]=Ut*W+$t*ve+qt*ie+Kt*Y,p[u++]=Ut*J+$t*te+qt*K+Kt*Nt}}}h(S,"parse"),m(S,"parse"),c=n?0:l.length-2,p[u++]=l[c],p[u]=l[c+1],s||(s=this);for(let w=0,D=p.length;w<D;w+=2)w==0&&r!==!1?s.moveTo(p[w],p[w+1]):s.lineTo(p[w],p[w+1])}h(O0,"smoothLineEx4");m(O0,"smoothLineEx");function W0(e,t,i,s,r,n=1){this.save(),this.beginPath(),this.moveTo(e,t),this.lineTo(i,s),this.lineWidth=n,this.strokeStyle=r,this.stroke(),this.restore()}h(W0,"line4");m(W0,"line");function j0(e,t,i,s,r){this.moveTo(e+r,t),this.lineTo(e+i-r,t),this.quadraticCurveTo(e+i,t,e+i,t+r),this.lineTo(e+i,t+s-r),this.quadraticCurveTo(e+i,t+s,e+i-r,t+s),this.lineTo(e+r,t+s),this.quadraticCurveTo(e,t+s,e,t+s-r),this.lineTo(e,t+r),this.quadraticCurveTo(e,t,e+r,t),this.closePath()}h(j0,"roundRect4");m(j0,"roundRect");function G0(e,t=!1){let i=this.measureText(e),s=i.fontBoundingBoxAscent+i.fontBoundingBoxDescent;return t?{width:Math.round(i.width),height:Math.round(s)}:{width:i.width,height:s}}h(G0,"calcTextSize4");m(G0,"calcTextSize");function N0(e){let t=Math.round(e)+"px";this.font=this.font.replace(/\d+px/,t)}h(N0,"setFontSize4");m(N0,"setFontSize");function U0(e,t,i){this.moveTo(e+i,t),this.arc(e,t,i,0,Math.PI*2)}h(U0,"circle4");m(U0,"circle");var w1=h(class extends M{m_iwidth=-1;m_iheight=-1;m_scale=1;m_canvas;constructor(e){super(e),this.setDomEvent("sizechange",()=>{this._paint()}),this.mapPropEvents(e,"paint")}render(){this.m_iwidth=-1,this.m_iheight=-1,this.m_canvas=new M({tag:"canvas"}),this.setContent(this.m_canvas)}update(e=0){this.m_iheight=this.m_iwidth=-1,super.update(e)}scale(e){this.m_scale=e,this.m_iwidth=-1,this.redraw()}get canvas(){return this.m_canvas}$update_rep=0;redraw(e){e!==void 0?++this.$update_rep>=20?(this.stopTimer("update"),this._paint()):this.startTimer("update",e,!1,()=>this._paint()):(this.stopTimer("update"),this._paint())}_paint(){this.$update_rep=0;let e=this.dom;if(!this.isUserVisible())return;let t=this.m_canvas.dom,i=e.clientWidth,s=e.clientHeight,r=t.getContext("2d");if(i!=this.m_iwidth||s!=this.m_iheight){let n=window.devicePixelRatio||1,l=r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1,o=this.canvas;if(n!==l||this.m_scale!=1){let a=n/l,c=i*a,u=s*a;o.setAttribute("width",""+c),o.setAttribute("height",""+u),o.setStyleValue("width",i),o.setStyleValue("height",s),a*=this.m_scale,r.scale(a,a)}else o.setAttribute("width",""+i),o.setAttribute("height",""+s),o.setStyleValue("width",i),o.setStyleValue("height",s),r.scale(1,1);this.m_iwidth=i,this.m_iheight=s}if(i&&s){let n=B0(r,i,s);this.m_props.autoClear&&n.clearRect(0,0,i,s),n.save(),n.translate(-.5,-.5),this.paint(n),n.restore()}}paint(e){try{this.m_props.painter?this.m_props.painter(e):this.emit("paint",V0(e))}catch(t){console.assert(!1,t)}}},"Canvas4");m(w1,"Canvas");var rf=h(class extends M{m_cards;m_ipage;m_cpage;constructor(e){super(e),this.m_cards=[],this.m_ipage=e.active,this.m_cpage=null,this.singleShot(()=>{this.setPages(e.pages)})}render(){let e=[];this.m_cards.forEach(t=>{t.page&&e.push(t.page)}),this.setContent(e)}switchTo(e){if(this.m_cards.length!=0&&(e===void 0&&(e=this.m_cards[0].name),e!==this.m_cpage?.name)){if(this.m_cpage&&(this.m_cpage.selector&&this.m_cpage.selector.removeClass("@active"),this.m_cpage.page&&!(this.m_cpage.page instanceof Function))){let t=this.m_cpage.page;t.removeClass("@active"),t.addClass("@hidden")}if(this.m_cpage=this.m_cards.find(t=>t.name==e),this.m_cpage){if(this.m_cpage.page){rs(this.m_cpage.page)&&(this.m_cpage.page=this.m_cpage.page(),console.assert(this.m_cpage.page!=null,"You must return a valid component"));let t=this.m_cpage.page;t.addClass("@active"),t.removeClass("@hidden"),t.dom||this._preparePage(t),this.m_cpage.selector&&this.m_cpage.selector.addClass("@active")}this.emit("change",Xe(this.m_cpage.name))}}}setPages(e){let t=this._initTabs(e);t&&Xr(()=>{this.switchTo(t),this.update()})}_initTabs(e){if(!e)return;let t=this.m_ipage;return e.forEach(i=>{if(!i)return;let s={...i};s.selector=this._prepareSelector(i),s.active=!1,this.m_cards.push(s),t||(t=i.name),i.active&&(t=i.name)}),t}_updateSelector(){}_prepareSelector(e){return null}_preparePage(e){e.setStyleValue("flex",1),e.addClass("@tab-page")}},"CardView4");m(rf,"CardView");var Mh=h(class extends M{constructor(e){super(e),this.setDomEvent("focus",()=>this._setFocus()),this.mapPropEvents(e,"change"),e.slider&&this.addClass("slider")}render(e){let t=e.labelWidth??-1,i="__cb_"+this.uid;this.setTag("label"),this.addClass("@hlayout"),this.addClass(e.align??"left"),this.setContent([new ss({ref:"input",type:"checkbox",name:e.name,id:i,tabIndex:e.tabIndex,value:e.value??"on",attrs:{checked:e.checked?"":void 0},dom_events:{change:this._change.bind(this)}}),e.slider?new M({cls:"@slide-el"}):null,new Ue({text:e.text??"",width:t<0?void 0:t,flex:t<0?-t:void 0,align:e.labelAlign??"left",style:{order:e.align=="right"?-1:1},attrs:{for:i}})])}_change(){this.emit("change",Xe(this.check))}_setFocus(){this.itemWithRef("input").focus()}get check(){return this.dom?this.itemWithRef("input").dom.checked:this.m_props.checked}set check(e){if(this.dom){let i=this.itemWithRef("input").dom;i&&(i.checked=e)}this.m_props.checked=e}get text(){return this.itemWithRef("label").text}set text(e){this.itemWithRef("label").text=e}toggle(){this.check=!this.check}},"CheckBox4");m(Mh,"CheckBox");var Zf={lightsalmon:4294942842,lightseagreen:4280332970,lightskyblue:4287090426,lightslategray:4286023833,lightsteelblue:4289774814,lightyellow:4294967264,lime:4278255360,limegreen:4281519410,linen:4294635750,magenta:4294902015,maroon:4286578688,mediumaquamarine:4284927402,mediumblue:4278190285,mediumorchid:4290401747,mediumpurple:4287852763,mediumseagreen:4282168177,mediumslateblue:4286277870,mediumspringgreen:4278254234,mediumturquoise:4282962380,mediumvioletred:4291237253,midnightblue:4279834992,mintcream:4294311930,mistyrose:4294960353,moccasin:4294960309,navajowhite:4294958765,navy:4278190208,oldlace:4294833638,olive:4286611456,olivedrab:4285238819,orange:4294944e3,orangered:4294919424,orchid:4292505814,palegoldenrod:4293847210,palegreen:4288215960,paleturquoise:4289720046,palevioletred:4292571283,papayawhip:4294963157,peachpuff:4294957753,peru:4291659071,pink:4294951115,plum:4292714717,powderblue:4289781990,purple:4286578816,red:4294901760,rosybrown:4290547599,royalblue:4282477025,saddlebrown:4287317267,salmon:4294606962,sandybrown:4294616160,seagreen:4281240407,seashell:4294964718,sienna:4288696877,silver:4290822336,skyblue:4287090411,slateblue:4285160141,slategray:4285563024,snow:4294966010,springgreen:4278255487,steelblue:4282811060,tan:4291998860,teal:4278222976,thistle:4292394968,tomato:4294927175,turquoise:4282441936,violet:4293821166,wheat:4294303411,white:4294967295,whitesmoke:4294309365,yellow:4294967040,yellowgreen:4288335154,aliceblue:4293982463,antiquewhite:4294634455,aqua:4278255615,aquamarine:4286578644,azure:4293984255,beige:4294309340,bisque:4294960324,black:4278190080,blanchedalmond:4294962125,blue:4278190335,blueviolet:4287245282,brown:4289014314,burlywood:4292786311,cadetblue:4284456608,chartreuse:4286578432,chocolate:4291979550,coral:4294934352,cornflowerblue:4284782061,cornsilk:4294965468,crimson:4292613180,cyan:4278255615,darkblue:4278190219,darkcyan:4278225803,darkgoldenrod:4290283019,darkgray:4289309097,darkgreen:4278215680,darkkhaki:4290623339,darkmagenta:4287299723,darkolivegreen:4283788079,darkorange:4294937600,darkorchid:4288230092,darkred:4287299584,darksalmon:4293498490,darkseagreen:4287609999,darkslateblue:4282924427,darkslategray:4281290575,darkturquoise:4278243025,darkviolet:4287889619,deeppink:4294907027,deepskyblue:4278239231,dimgray:4285098345,dodgerblue:4280193279,firebrick:4289864226,floralwhite:4294966e3,forestgreen:4280453922,fuchsia:4294902015,gainsboro:4292664540,ghostwhite:4294506751,gold:4294956800,goldenrod:4292519200,gray:4286611584,green:4278222848,greenyellow:4289593135,honeydew:4293984240,hotpink:4294928820,indianred:4291648604,indigo:4283105410,ivory:4294967280,khaki:4293977740,lavender:4293322490,lavenderblush:4294963445,lawngreen:4286381056,lemonchiffon:4294965965,lightblue:4289583334,lightcoral:4293951616,lightcyan:4292935679,lightgoldenrodyellow:4294638290,lightgreen:4287688336,lightgrey:4292072403,lightpink:4294948545,none:0,transparent:0},Ee=h(class{m_value;constructor(e,t,i,s){let r=arguments.length,n=this;function l(){if(!r)return 4278190080;if(r==1)return Number.isSafeInteger(e)?4278190080|e&16777215:n._getCustomColor(e);if(r==2){let o,a=((t*255|0)&255)<<24;return Number.isSafeInteger(e)?o=e:o=n._getCustomColor(e),o&16777215|a}else if(r==4&&s!==void 0&&s<=1)return s<=0?0:(s=s*255,s|=0,(s&255)<<24|(e&255)<<16|(t&255)<<8|i&255);return 4278190080|(e&255)<<16|(t&255)<<8|i&255}h(l,"_init"),m(l,"_init"),this.m_value=l()}_shade(e){let t=e<0?0:255,i=e<0?-e:e,s=this._split();return new Ee(Math.round((t-s.r)*i)+s.r,Math.round((t-s.g)*i)+s.g,Math.round((t-s.b)*i)+s.b,s.a/255)}darken(e){return e<0&&(e=0),e>100&&(e=100),this._shade(-e/100)}lighten(e){return e<0&&(e=0),e>100&&(e=100),this._shade(e/100)}static mix(e,t,i){let s=e._split(),r=t._split(),n=s.a===r.a?s.a:Math.round(r.a*i+s.a*(1-i)),l=s.r===r.r?s.r:Math.round(r.r*i+s.r*(1-i)),o=s.g===r.g?s.g:Math.round(r.g*i+s.g*(1-i)),a=s.b===r.b?s.b:Math.round(r.b*i+s.b*(1-i));return new Ee(l,o,a,n/255)}_split(){let e=this.m_value;return{a:e>>24&255,r:e>>16&255,g:e>>8&255,b:e&255}}fadeout(e){let t=this._split();if(t.a=t.a/255,t.a=t.a-t.a*e/100,t.a>1)t.a=1;else if(t.a<=0)return Ee.NONE;return new Ee(t.r,t.g,t.b,t.a)}static fromHSV(e,t,i,s=1){let r=Math.min(5,Math.floor(e*6)),n=e*6-r,l=i*(1-t),o=i*(1-n*t),a=i*(1-(1-n)*t),c,u,_;switch(r){case 0:c=i,u=a,_=l;break;case 1:c=o,u=i,_=l;break;case 2:c=l,u=i,_=a;break;case 3:c=l,u=o,_=i;break;case 4:c=a,u=l,_=i;break;case 5:c=i,u=l,_=o;break}return new Ee(c*255,u*255,_*255,s)}static toHSV(e){let t=e._split();t.r/=255,t.g/=255,t.b/=255,t.a/=255;let i=Math.max(t.r,t.g,t.b),s=Math.min(t.r,t.g,t.b),r=i-s,n=i===0?0:r/i,l=i,o;if(r===0)o=0;else switch(i){case t.r:o=(t.g-t.b)/r/6+(t.g<t.b?1:0);break;case t.g:o=(t.b-t.r)/r/6+1/3;break;case t.b:o=(t.r-t.g)/r/6+2/3;break}return{h:o,s:n,v:l,a:t.a}}static fromHLS(e,t,i){let s,r,n;if(i==0)s=r=n=t;else{let o=h(function(u,_,p){return p<0&&(p+=1),p>1&&(p-=1),p<.16666666666666666?u+(_-u)*6*p:p<.5?_:p<.6666666666666666?u+(_-u)*(.6666666666666666-p)*6:u},"hue2rgb2");var l=o;m(o,"hue2rgb");let a=t<.5?t*(1+i):t+i-t*i,c=2*t-a;s=o(c,a,e+1/3),r=o(c,a,e),n=o(c,a,e-1/3)}return s=(s*255|0)&255,r=(r*255|0)&255,n=(n*255|0)&255,new Ee(s,r,n)}static toHLS(e){let t=e.m_value,i=(t>>16&255)/255,s=(t>>8&255)/255,r=(t&255)/255,n=i,l=i;s<n&&(n=s),r<n&&(n=r),s>l&&(l=s),r>l&&(l=r);let o=0,a=0,c=0,u=l-n,_=l+n,p=.5*_,v,g;if(l!=n)o=(l-i)/u,a=(l-s)/u,c=(l-r)/u;else return{h:0,l:p,s:0};return p<.5?v=u/_:v=u/(2-_),i==l?g=60*(6+c-a):s==l?g=60*(2+o-c):g=60*(4+a-o),g>360&&(g=g-360),{h:g/360,l:p,s:v}}red(){return this.m_value>>16&255}green(){return this.m_value>>8&255}blue(){return this.m_value&255}alpha(){return(this.m_value>>24&255)/255}value(){return this.m_value}toString(){if(this.m_value===0)return"transparent";let t=this._split();if(t.a===255)return`rgb(${t.r},${t.g},${t.b})`;{t.a/=255;let i=t.a.toFixed(3);return`rgba(${t.r},${t.g},${t.b},${i})`}}toHex(e=!0){if(this.m_value===0)return"transparent";let i=this._split();return i.a===255||!e?`#${Zs(i.r)}${Zs(i.g)}${Zs(i.b)}`:`#${Zs(i.r)}${Zs(i.g)}${Zs(i.b)}${Zs(i.a)}`}static addCustomColor(e,t){Ee.custom[e]=t}static addCssColor(e){let t=Or.getVar(e);Ee.custom["css:"+e]=Ee.parse(t.trim())}static parse(e){let t;if(e[0]=="#"){if((t=/#(?<r>[a-fA-F0-9]{2})(?<g>[a-fA-F0-9]{2})(?<b>[a-fA-F0-9]{2})(?<a>[a-fA-F0-9]{2})?/.exec(e))!==null){let r=t.groups;return new Ee(parseInt(r.r,16),parseInt(r.g,16),parseInt(r.b,16),r.a!==void 0?parseInt(r.a,16)/255:1)}if((t=/#(?<r>[a-fA-F0-9])(?<g>[a-fA-F0-9])(?<b>[a-fA-F0-9])/.exec(e))!==null){let r=t.groups,n=parseInt(r.r,16),l=parseInt(r.g,16),o=parseInt(r.b,16);return new Ee(n<<4|n,l<<4|l,o<<4|o,1)}}if(e[0]=="r"){if((t=/rgb\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\)/.exec(e))!==null){let r=t.groups;return new Ee(parseInt(r.r,10),parseInt(r.g,10),parseInt(r.b,10),1)}if((t=/rgba\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\,\s*(?<a>[0-9.]+)\s*\)/.exec(e))!==null){let r=t.groups;return new Ee(parseInt(r.r,10),parseInt(r.g,10),parseInt(r.b,10),parseFloat(r.a))}}return console.log("invalid color value: "+e),new Ee(0)}_getCustomColor(e){if(e===null)return 0;let t=Zf[e];return t!==void 0?t:Ee.custom[e]!==void 0?Ee.custom[e].m_value:e.substr(0,4)=="css:"?(Ee.addCssColor(e.substr(4)),Ee.custom[e].m_value):Ee.parse(e).m_value}static contrastColor(e){let t=e._split();return(.299*t.r+.587*t.g+.114*t.b)/255>.5?Ee.BLACK:Ee.WHITE}static valueFromColorName(e){let t=Zf[e];return t?new Ee(t):null}static fromCssVar(e){return new Ee(e).toString()}},"_Color4"),Be=Ee;m(Be,"Color");de(Be,"custom",[]);de(Be,"WHITE",new Ee(255,255,255));de(Be,"BLACK",new Ee(0,0,0));de(Be,"NONE",new Ee(0,0,0,0));function Zs(e){return("00"+e.toString(16)).substr(-2).toUpperCase()}h(Zs,"_hx4");m(Zs,"_hx");var b1=1e4;function $0(e){let t,i=e.url,s=e.method||"GET",r=!1;e.params instanceof FormData?(t=e.params,r=!0):s=="POST"?t=nd(e.params,!1):i+=nd(e.params,!0),i=encodeURI(i);let n=new XMLHttpRequest;if(n.open(s,i),n.upload.addEventListener("progress",l,!1),n.addEventListener("timeout",a),n.addEventListener("error",a),n.addEventListener("load",c),r||n.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8"),s!="POST"&&(n.responseType=e.responseType||"json",n.timeout=e.timeout||b1),e.headers)for(let u in e.headers)n.setRequestHeader(u,e.headers[u]);function l(u){if(console.log(u),e.progress)try{if(u.lengthComputable){let _=o(u.loaded)+" / "+o(u.total);e.progress(u.loaded,u.total,_)}}catch(_){console.error("unhandled exception:",_)}}h(l,"progress"),m(l,"progress");function o(u){let _,p;return u>=1e9?(_="Gb",p=u/1e9):u>=1e6?(_="Mb",p=u/1e6):u>=1e3?(_="Kb",p=u/1e3):(_="bytes",p=u),p.toFixed(2)+_}h(o,"humanSize"),m(o,"humanSize");function a(){e.failure&&e.failure(n.status,n.statusText,e.userData)}h(a,"failure"),m(a,"failure");function c(){if(n.status>=200&&n.status<300){if(e.success)try{e.success(n.response,e.userData)}catch(u){console.error("unhandled exception:",u)}}else a()}return h(c,"success"),m(c,"success"),r||s=="POST"?n.send(t):n.send(),function(){n.abort()}}h($0,"ajaxRequest4");m($0,"ajaxRequest");function nd(e,t){if(!e)return"";let i=[];for(let r in e){let n=e[r];if(vi(n))for(let l=0,o=n.length;l<o;l++)i.push(encodeURIComponent(r)+"[]="+encodeURIComponent(""+n[l]));else n===void 0&&(n=""),i.push(encodeURIComponent(r)+"="+encodeURIComponent(""+n))}let s=i.join("&");return t?"?"+s:s}h(nd,"buildQuery4");m(nd,"buildQuery");async function x1(e,t){return(await nf(e,t,"application/json")).json()}h(x1,"ajaxAsJSON4");m(x1,"ajaxAsJSON");async function C1(e,t){return(await nf(e,t,"text/plain")).text()}h(C1,"ajaxAsText4");m(C1,"ajaxAsText");async function nf(e,t,i){let s={method:"GET",headers:{"X-Requested-With":"XMLHttpRequest"}};if(i&&(s.headers["Content-Type"]=i),t&&(s={...s,...t},t.body&&!We(t.body))){let n=!1;(cp(t.body)||!(t.body instanceof Blob)&&!(t.body instanceof ArrayBuffer)&&!(t.body instanceof FormData)&&!(t.body instanceof URLSearchParams)&&!(t.body instanceof ReadableStream))&&(n=!0),n?s.body=JSON.stringify(t.body):s.body=t.body}let r=await fetch(e,s);if(t&&t.noGenX)return r;if(!r.ok)throw new dp(r);return r}h(nf,"ajax4");m(nf,"ajax");var q0=h(class extends It{m_height;m_container;m_buttons;m_dirty;m_watchChanges;constructor(e){let t=e.content;e.content=null;let i=e.height;e.height=void 0,super(e),this.setTag(e.disableSuggestions?"section":"form"),this.mapPropEvents(e,"btnClick"),this.updateContent(t,e.buttons,i),this.m_dirty=!1,this.m_watchChanges=!1}get container(){return this.m_container}componentCreated(){super.componentCreated(),this.m_watchChanges&&this.watchChanges()}updateContent(e,t,i=0){i&&(this.m_height=i),this._makeButtons(t);let s=[this.m_container=new It({cls:"container",height:this.m_height,content:e}),this.m_buttons];super.setContent(s)}setContent(e,t=!0){this.m_container.setContent(e,t)}setButtons(e){this._makeButtons(e)}enableButton(e,t=!0){let i=this.getButton(e);i&&i.enable(t)}getButton(e){return this.m_buttons?.itemWithRef("@"+e)}_makeButtons(e){this.m_buttons||(this.m_buttons=new ue({cls:"footer",ref:"buttons"}));let t=[];if(e)for(let i of e)if(i instanceof M)t.push(i);else switch(i){case"ok":{t.push(new yt({ref:"@"+i,text:ne.global.ok,click:()=>{this._click(i)}}));break}case"cancel":{t.push(new yt({ref:"@"+i,text:ne.global.cancel,click:()=>{this._click(i)}}));break}case"ignore":{t.push(new yt({ref:"@"+i,text:ne.global.ignore,click:()=>{this._click(i)}}));break}case"yes":{t.push(new yt({ref:"@"+i,text:ne.global.yes,click:()=>{this._click(i)}}));break}case"no":{t.push(new yt({ref:"@"+i,text:ne.global.no,click:()=>{this._click(i)}}));break}case"close":{t.push(new yt({ref:"@"+i,text:ne.global.close,click:()=>{this._click(i)}}));break}case"save":{t.push(new yt({ref:"@"+i,text:ne.global.save,click:()=>{this._click(i)}}));break}case"dontsave":{t.push(new yt({ref:"@"+i,text:ne.global.dontsave,click:()=>{this._click(i)}}));break}}t.length==1&&t[0].setAttribute("autofocus",!0),this.m_buttons.setContent(t)}validate(){let e=this.queryAll("input"),t=!0;for(let i=0;i<e.length;i++){let s=M.getElement(e[i],Si);s&&!s.validate()&&(t=!1)}return t}_click(e){this.emit("btnClick",K0(e))}_getElements(){return console.assert(!!this.dom),this.queryAll("[name]")}setValues(e){let t=this._getElements();for(let i=0;i<t.length;i++){let s=t[i],r=M.getElement(s);if(!r.hasAttribute("name"))continue;let n=r.getAttribute("name"),l=r.getAttribute("type");e[n]!==void 0&&r.setStoreValue(e[n])}this.setDirty(!1)}getValues(){let e=this._getElements(),t={};for(let i=0;i<e.length;i++){let s=e[i],r=M.getElement(s);if(!r.hasAttribute("name"))continue;let n=r.getAttribute("name"),l=r.getStoreValue();l!==void 0&&(t[n]=l)}return t}submit(e,t){if(!this.validate())return!1;let i=this.getValues();if(t&&!t(i))return!1;let s=new FormData;for(let r in i)i.hasOwnProperty(r)&&s.append(r,i[r]===void 0?"":i[r]);return e.params=s,$0(e)}watchChanges(){this.dom?(this.queryAll("input[name], textarea[name]").forEach(t=>{wi(t).setDomEvent("input",()=>{this.setDirty()})}),this.m_watchChanges=!1):this.m_watchChanges=!0}setDirty(e=!0){this.m_dirty=e}isDirty(){return this.m_dirty}},"Form4");m(q0,"Form");function K0(e){return ze({button:e})}h(K0,"EvBtnClick4");m(K0,"EvBtnClick");var hc=h(class extends vs{m_icon;m_title;m_form;m_buttons;m_closable;m_movable;m_maximized;m_minimized;m_maximizable;m_minimizable;m_minFormSize;m_rc_max;m_rc_min;m_el_title;m_last_down;m_auto_close;m_ui_title;m_form_cb;constructor(e){let t=e.content;e.content=null;let i=e.width,s=e.height;e.width=void 0,e.height=void 0,super(e),this.m_minFormSize={width:i,height:s},this.enableMask(!0),e.form?rs(e.form)?this.m_form_cb=e.form:(this.m_form=e.form,this.m_form.on("btnClick",r=>this._handleClick(r))):this.m_form=new q0({content:t,buttons:e.buttons,disableSuggestions:e.disableSuggestions,btnClick:r=>this._handleClick(r)}),this.m_movable=e.movable,this.m_auto_close=e.autoClose??!0,this.m_icon=e.icon,this.m_title=e.title,this.m_buttons=e.buttons??null,this.m_closable=e.closable??!1,this.m_last_down=0,this.on("size",r=>{this.addClass("@resized"),this.m_form.setStyleValue("width",null),this.m_form.setStyleValue("height",null)}),this.m_maximized=!1,this.m_minimized=!1,this.m_maximizable=!1,this.m_minimizable=!1,e.maximizable!==void 0&&(this.m_maximizable=e.maximizable),e.minimizable!==void 0&&(this.m_minimizable=e.minimizable),e.maximized==!0&&(this.m_maximizable=!0),e.btnClick&&this.on("btnClick",e.btnClick)}componentCreated(){super.componentCreated(),this.m_minFormSize.width&&this.m_form.setStyle({minWidth:this.m_minFormSize.width,width:this.m_minFormSize.width}),this.m_minFormSize.height&&this.m_form.setStyle({minHeight:this.m_minFormSize.height,height:this.m_minFormSize.height});let e=this.getBoundingRect();this.setStyleValue("min-width",e.width),this.setStyleValue("min-height",e.height),this.setStyleValue("width",e.width),this.setStyleValue("height",e.height),this.m_props.dlgWidth&&this.setStyleValue("width",this.m_props.dlgWidth+"%"),this.m_props.dlgHeight&&this.setStyleValue("height",this.m_props.dlgHeight+"%"),this.addClass("@resized"),this.m_el_title&&this.m_el_title.setStyleValue("width","auto"),this.m_props.maximized?(this._maximize(),this.emit("size",Ht(null))):this.centerOnScreen()}_handleClick(e){this.emit("btnClick",e),e.defaultPrevented||this.close()}setGeometry(e){e.minimized&&this.m_minimizable?(this._minimize(!1),this.m_rc_min=new Hi(e.left,e.top,e.width,e.height),this.displayAt(e.left,e.top,"top-left")):e.maximized&&this.m_maximizable?(this._maximize(!1),this.m_rc_max=new Hi(e.left,e.top,e.width,e.height)):(this.setSize(e.width,e.height),this.displayAt(e.left,e.top,"top-left"))}getGeometry(){if(this.m_minimized)return{left:this.m_rc_min.left,top:this.m_rc_min.top,width:this.m_rc_min.width,height:this.m_rc_min.height,minimized:!0,maximized:!1};if(this.m_maximized)return{left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height,minimized:!1,maximized:!0};let e=this.getBoundingRect();return{left:e.left,top:e.top,width:e.width,height:e.height,minimized:!1,maximized:!1}}setSize(e,t){this.setStyle({width:e,height:t}),this.emit("size",Ht({width:e,height:t}))}render(){this.m_form_cb&&(this.m_form=this.m_form_cb(),this.m_form.on("btnClick",t=>this._handleClick(t)),this.m_form_cb=null);let e=this.m_icon!==void 0||this.m_closable||this.m_title!==void 0||this.m_movable;this.m_el_title=null,e&&(this.m_el_title=new ue({cls:"title",content:[this.m_icon?new lt({icon:this.m_icon}):null,this.m_ui_title=new Ue({flex:1,text:this.m_title}),this.m_minimizable?new lt({cls:"min-btn",icon:"var( --x4-icon-window-minimize )",dom_events:{click:()=>this._toggleMin()}}):null,this.m_maximizable?new lt({cls:"max-btn",icon:"var( --x4-icon-window-maximize )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_maximizable?new lt({cls:"res-btn",icon:"var( --x4-icon-window-restore )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_closable?new lt({cls:"close-btn",icon:"var( --x4-icon-rectangle-times )",dom_events:{click:()=>this.close()}}):null]}),this.m_movable&&(bd()?this.m_el_title.setDomEvent("touchstart",t=>this._mouseDown(t)):this.m_el_title.setDomEvent("mousedown",t=>this._mouseDown(t)))),super.setContent([this.m_el_title,this.m_form])}setContent(e,t=!0){this.m_form.setContent(e,t)}setButtons(e){this.m_form.setButtons(e)}get form(){return this.m_form}close(){this.emit("close",{}),super.close()}_toggleMax(){this.m_maximizable&&(this.m_maximized?(this.removeClass("maximized"),this.setStyle({left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height}),this.m_maximized=!1,this.emit("size",Ht(null,"restore"))):(this._maximize(),this.emit("size",Ht(null,"maximize"))))}_toggleMin(){this.m_minimizable&&(this.m_minimized?(this.removeClass("minimized"),this.setStyle({width:this.m_rc_min.width,height:this.m_rc_min.height}),this.m_minimized=!1,this.emit("size",Ht(null,"restore"))):(this._minimize(),this.emit("size",Ht(null,"minimize"))))}_mouseDown(e){let{x:t,y:i}=Ws(e,!0),s=wi(V.body).getBoundingRect(),r=this.getBoundingRect(!0),n=t-r.left,l=i-r.top,o=Date.now(),a=o-this.m_last_down;if(this.m_maximizable&&a<700){this._toggleMax();return}if(this.m_last_down=o,this.m_maximized)return;let c=m((u,_)=>{u>s.right?u=s.right:u<s.left&&(u=s.left),_>s.bottom?_=s.bottom:_<s.top&&(_=s.top);let p=u-n,v=_-l;this.setStyle({left:p,top:v})},"__move");M.setCapture(this,u=>{if(u.type=="mousemove"){let _=u;c(_.clientX,_.clientY)}else if(u.type=="touchmove"){let _=u;_.touches.length==1&&c(_.touches[0].clientX,_.touches[0].clientY)}else u.type=="mouseup"||u.type=="touchend"?(M.releaseCapture(),this.emit("move",D0(null))):u.type=="mousedown"||u.type=="touchstart"})}maximize(){!this.m_maximizable||this.m_maximized||(this._maximize(),this.emit("size",Ht(null)))}_maximize(e=!0){e&&(this.m_rc_max=this.getBoundingRect(!1)),this.addClass("maximized"),this.m_maximized=!0,this.setStyle({left:void 0,top:void 0,width:void 0,height:void 0})}minimize(){!this.m_minimizable||this.m_minimized||(this._minimize(),this.emit("size",Ht(null)))}_minimize(e=!0){e&&(this.m_rc_min=this.getBoundingRect(!1)),this.addClass("minimized"),this.m_minimized=!0,this.setStyle({width:void 0,height:void 0})}set title(e){this.m_title=e,this.m_ui_title&&(this.m_ui_title.text=e)}itemWithName(e){let t=this.dom.querySelector(`[name="${e}"]`);return t?M.getElement(t):null}getValues(){return this.m_form.getValues()}validate(){return this.m_form.validate()}},"Dialog4");m(hc,"Dialog");var ld=h(class extends Ft{m_colorSel;m_colorHue;m_colorAlpha;m_sample;m_selMark;m_hueMark;m_alphaMark;m_baseHSV;m_baseColor;m_transpCk;m_colorEdit;m_palmode;constructor(e){super(e),this.m_palmode=ld.last_palmode,this.setDomEvent("contextmenu",t=>this._showCtx(t))}_showCtx(e){let t=new ws({items:[new Kn({text:"Palette",checked:this.m_palmode,click:()=>{this.m_palmode=!this.m_palmode,ld.last_palmode=this.m_palmode,this.update()}})]}),i=Ws(e,!0);t.displayAt(i.x,i.y)}render(e){if(this.m_baseColor=e.color,this.m_baseHSV=Be.toHSV(this.m_baseColor),this.m_palmode){let i=h(function(a){l=[],a.forEach(c=>{let u=new Be(c.hex),_=u.value()==o,p=ku("hclr-box xbox",{selected:_}),v=new M({cls:p,style:{backgroundColor:u.toHex(),color:Be.contrastColor(u).toHex()},data:{color:u.value()},content:u.toHex()});l.push(v),_&&(r=v)}),s&&s.itemWithId("vsel").setContent(l)},"fillSubs2");var t=i;m(i,"fillSubs"),this.addClass("pal-mode");let s=null,r=null,n=[],l=[],o=this.m_baseColor.value();E1.forEach(a=>{let c=a.variations[4].hex,u=c===o;u||(u=a.variations.some(v=>{if(new Be(v.hex).value()===o)return!0}));let _=ku("clr-box xbox",{selected:u}),p=new M({cls:_,style:{backgroundColor:new Be(c).toHex()},data:{color:c,main:a.variations}});u&&i(a.variations),n.push(p)}),s=new It({content:[new ue({id:"hsel",content:n}),new It({id:"vsel",flex:1,content:l})]}),this.m_colorEdit=new Si({cls:"hexv",value:"",attrs:{spellcheck:!1},change:a=>{let c=new Be(a.value);c&&(this.m_baseColor=c,this.m_baseHSV=Be.toHSV(c),this._updateColor(!1))}}),this.m_transpCk=new Mh({cls:"transp",text:"transparent",change:a=>{this.m_baseHSV.a=a.value?0:1,this._updateColor()}}),this.setContent([s,this.m_transpCk,this.m_colorEdit]),s.setDomEvent("click",a=>{r&&(r.removeClass("selected"),r=null);let c=M.getElement(a.target,"xbox");if(c){let u=c.getData("main");if(u)i(u);else{let _=new Be(c.getData("color"));this.m_baseColor=_,this.m_baseHSV=Be.toHSV(_),this._updateColor(),r=c,c.addClass("selected")}}})}else this.removeClass("pal-mode"),this.m_selMark=new M({cls:"marker"}),this.m_colorSel=new M({cls:"sel",content:[new M({cls:"@fit light"}),new M({cls:"@fit dark"}),this.m_selMark]}),this.m_hueMark=new M({cls:"marker"}),this.m_colorHue=new M({cls:"hue",content:[this.m_hueMark]}),this.m_sample=new M({cls:"sample"}),e.hasAlpha?(this.addClass("with-alpha"),this.m_alphaMark=new M({cls:"marker"}),this.m_colorAlpha=new M({cls:"alpha",content:[new M({cls:"bk @fit",ref:"color"}),this.m_alphaMark]})):(this.removeClass("with-alpha"),this.m_transpCk=new Mh({cls:"transp",text:"transparent",change:i=>{this.m_baseHSV.a=i.value?0:1,this._updateColor()}})),this.m_colorEdit=new Si({cls:"hexv",value:"",attrs:{spellcheck:!1},change:i=>{let s=new Be(i.value);s&&(this.m_baseColor=s,this.m_baseHSV=Be.toHSV(s),this._updateColor(!1))}}),this.setContent([this.m_colorSel,this.m_colorHue,this.m_colorAlpha,this.m_transpCk,this.m_colorEdit,this.m_sample]),this.m_colorSel.setDomEvent("mousedown",i=>{M.setCapture(this,s=>this._selChange(s))}),this.m_colorHue.setDomEvent("mousedown",i=>{M.setCapture(this,s=>this._hueChange(s))}),e.hasAlpha&&this.m_colorAlpha.setDomEvent("mousedown",i=>{M.setCapture(this,s=>this._alphaChange(s))}),this._updateColor()}set color(e){this.m_baseColor=e,this.m_baseHSV=Be.toHSV(this.m_baseColor),this._updateColor()}get color(){return this.m_baseColor}_selChange(e){let t=Ws(e,!0);console.log(t);let i=this.m_colorSel.getBoundingRect();this.m_props.hasAlpha||(this.m_baseHSV.a=1),this.m_baseHSV.s=Bl((t.x-i.left)/i.width,0,1),this.m_baseHSV.v=1-Bl((t.y-i.top)/i.height,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&M.releaseCapture()}_hueChange(e){let t=Ws(e,!0),i=this.m_colorHue.getBoundingRect();this.m_baseHSV.h=Bl((t.y-i.top)/i.height,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&M.releaseCapture()}_alphaChange(e){let t=Ws(e,!0),i=this.m_colorAlpha.getBoundingRect();this.m_baseHSV.a=Bl((t.x-i.left)/i.width,0,1),this._updateColor(),(e.type=="mouseup"||e.type=="touchend")&&M.releaseCapture()}_updateColor(e=!0){let t;if(this.m_palmode)this.m_transpCk.check=this.m_baseHSV.a==0;else{if(t=Be.fromHSV(this.m_baseHSV.h,1,1,1),this.m_colorSel.setStyleValue("backgroundColor",t.toString()),t=Be.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,1),this.m_sample.setStyleValue("backgroundColor",t.toString()),this.m_props.hasAlpha){let i=`linear-gradient(to right, rgba(0,0,0,0) 0%, ${t.toString()} 100%)`;this.m_colorAlpha.itemWithRef("color").setStyleValue("backgroundImage",i)}this.m_selMark.setStyle({left:this.m_baseHSV.s*100+"%",top:100-this.m_baseHSV.v*100+"%"}),this.m_hueMark.setStyle({top:this.m_baseHSV.h*100+"%"}),this.m_props.hasAlpha?this.m_alphaMark.setStyle({left:this.m_baseHSV.a*100+"%"}):this.m_transpCk.check=this.m_baseHSV.a==0}t=Be.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,this.m_baseHSV.a),this.m_baseColor=t,e&&(this.m_colorEdit.value=t.alpha()==1?t.toHex():t.toString()),this._change()}_change(){this.emit("change",Xe(this.m_baseColor))}},"_ColorPicker4"),lf=ld;m(lf,"ColorPicker");de(lf,"last_palmode",!1);var Ph=h(class extends hc{m_picker;constructor(e){e.icon=void 0,e.buttons=void 0,super(e),this.mapPropEvents(e,"change"),this.m_picker=new lf({color:e.color,hasAlpha:e.hasAlpha,style:{padding:8},width:250,height:250});let t=this._makeCustoms(e.cust_colors);this.form.updateContent([new It({content:[this.m_picker,t]})],["ok","cancel"]),this.on("btnClick",i=>{i.button=="ok"&&this.emit("change",Xe(this.m_picker.color))})}_makeCustoms(e){let t=null;if(e&&e.length>0){let i=[];for(let s=0;s<e.length;s+=8){let r=[];for(let n=0;n<8;n++){let l=s+n,o=e[l];r.push(new Ue({cls:"cust-cc",text:"",flex:1,style:{backgroundColor:o?o.toString():"transparent"},tooltip:o?o.toString():void 0,dom_events:{click:()=>{o&&(this.m_picker.color=o,this.emit("change",Xe(o)),this.close())}}}))}i.push(new ue({cls:"line",content:r}))}t=new It({cls:"customs",content:i})}return t}set color(e){this.m_picker.color=e}get color(){return this.m_picker.color}static show(e){let t;return We(e)?t=new Ph({color:new Be(e)}):t=new Ph(e),t.show(),t}},"ColorPickerBox4");m(Ph,"ColorPickerBox");var y1=h(class extends ue{constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){let t=e.color,i;this._isTransp(t)?(t=Be.NONE,i="black"):i=Be.contrastColor(t).toString(),this.setContent([e.label?new Ue({cls:"label",text:e.label,flex:e.labelWidth<0?-e.labelWidth:void 0,width:e.labelWidth>=0?e.labelWidth:void 0}):null,new M({flex:1,content:[new Ue({cls:"alpha @fit",text:""}),new Ue({cls:"value @fit",text:e.displayValue===!1?"":t.toHex(),style:{backgroundColor:t.toString(),color:i},dom_events:{click:()=>this._showPicker()}})]})]),e.displayValue===!1&&this.setStyleValue("background-image","url( 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAEsmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIKICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIKICAgIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIgogICAgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSIKICAgdGlmZjpJbWFnZVdpZHRoPSIxMCIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgeG1wOk1vZGlmeURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiPgogICA8eG1wTU06SGlzdG9yeT4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJwcm9kdWNlZCIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWZmaW5pdHkgRGVzaWduZXIgMS45LjAiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/Pn8+b7YAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRy0tCQRSHv7Qwyh5gRIsWEtZKwwyiNi2UXlAt1CCrjV5fgdrlXiOibdBWKIja9FrUX1DboHUQFEUQ7YLWRW0qbueqoESe4cz55jdzDjNnwBLOKFm93gvZXF4LTvid85EFp+0FK5204sURVXR1JjQepqZ93lNnxluPWav2uX+tOZ7QFahrFB5VVC0vPCk8vZZXTd4R7lDS0bjwmbBbkwsK35l6rMSvJqdK/G2yFg4GwNIu7ExVcayKlbSWFZaX48pmVpXyfcyX2BO5uZDEHvFudIJM4MfJFGMEGGKAEZmH8OCjX1bUyPcW82dZkVxFZpV1NJZJkSaPW9RVqZ6QmBQ9ISPDutn/v33Vk4O+UnW7HxqeDeO9F2zb8FMwjK8jw/g5BusTXOYq+SuHMPwheqGiuQ6gbRPOrypabBcutqDrUY1q0aJkFbckk/B2Ci0RcNxA02KpZ+V9Th4gvCFfdQ17+9An59uWfgF7Hmfv4QYbGAAAAAlwSFlzAAALEwAACxMBAJqcGAAAACdJREFUGJVjbGhoYEAC9fX1yFwmBryAptKM////R+Y3NjbSzW4C0gAo9QeQBmhTIwAAAABJRU5ErkJggg=='"),this._setTabIndex(e.tabIndex)}set value(e){this.m_props.color=e,this.update()}get value(){return this.m_props.color}set custom_colors(e){this.m_props.cust_colors=e}_showPicker(){let e=new Ph({color:this.m_props.color,cust_colors:this.m_props.cust_colors,hasAlpha:this.m_props.hasAlpha,events:{change:i=>{this.m_props.color=i.value,this._change(),this.update()}}}),t=this.getBoundingRect();e.displayAt(t.left,t.bottom,"tl")}_change(){this.emit("change",Xe(this.m_props.color))}_isTransp(e){return!e.alpha()}},"ColorPickerEditor4");m(y1,"ColorPickerEditor");var E1=[{color:"Red",variations:[{weight:50,hex:16772078},{weight:100,hex:16764370},{weight:200,hex:15702682},{weight:300,hex:15037299},{weight:400,hex:15684432},{weight:500,hex:16007990},{weight:600,hex:15022389},{weight:700,hex:13840175},{weight:800,hex:12986408},{weight:900,hex:12000284}]},{color:"Pink",variations:[{weight:50,hex:16573676},{weight:100,hex:16301008},{weight:200,hex:16027569},{weight:300,hex:15753874},{weight:400,hex:15483002},{weight:500,hex:15277667},{weight:600,hex:14162784},{weight:700,hex:12720219},{weight:800,hex:11342935},{weight:900,hex:8916559}]},{color:"Purple",variations:[{weight:50,hex:15984117},{weight:100,hex:14794471},{weight:200,hex:13538264},{weight:300,hex:12216520},{weight:400,hex:11225020},{weight:500,hex:10233776},{weight:600,hex:9315498},{weight:700,hex:8069026},{weight:800,hex:6953882},{weight:900,hex:4854924}]},{color:"Deep Purple",variations:[{weight:50,hex:15591414},{weight:100,hex:13747433},{weight:200,hex:11771355},{weight:300,hex:9795021},{weight:400,hex:8280002},{weight:500,hex:6765239},{weight:600,hex:6174129},{weight:700,hex:5320104},{weight:800,hex:4532128},{weight:900,hex:3218322}]},{color:"Indigo",variations:[{weight:50,hex:15264502},{weight:100,hex:12962537},{weight:200,hex:10463450},{weight:300,hex:7964363},{weight:400,hex:6056896},{weight:500,hex:4149685},{weight:600,hex:3754411},{weight:700,hex:3162015},{weight:800,hex:2635155},{weight:900,hex:1713022}]},{color:"Blue",variations:[{weight:50,hex:14938877},{weight:100,hex:12312315},{weight:200,hex:9489145},{weight:300,hex:6600182},{weight:400,hex:4367861},{weight:500,hex:2201331},{weight:600,hex:2001125},{weight:700,hex:1668818},{weight:800,hex:1402304},{weight:900,hex:870305}]},{color:"Light Blue",variations:[{weight:50,hex:14808574},{weight:100,hex:11789820},{weight:200,hex:8508666},{weight:300,hex:5227511},{weight:400,hex:2733814},{weight:500,hex:240116},{weight:600,hex:236517},{weight:700,hex:166097},{weight:800,hex:161725},{weight:900,hex:87963}]},{color:"Cyan",variations:[{weight:50,hex:14743546},{weight:100,hex:11725810},{weight:200,hex:8445674},{weight:300,hex:5099745},{weight:400,hex:2541274},{weight:500,hex:48340},{weight:600,hex:44225},{weight:700,hex:38823},{weight:800,hex:33679},{weight:900,hex:24676}]},{color:"Teal",variations:[{weight:50,hex:14742257},{weight:100,hex:11722715},{weight:200,hex:8440772},{weight:300,hex:5093036},{weight:400,hex:2533018},{weight:500,hex:38536},{weight:600,hex:35195},{weight:700,hex:31083},{weight:800,hex:26972},{weight:900,hex:19776}]},{color:"Green",variations:[{weight:50,hex:15267305},{weight:100,hex:13166281},{weight:200,hex:10868391},{weight:300,hex:8505220},{weight:400,hex:6732650},{weight:500,hex:5025616},{weight:600,hex:4431943},{weight:700,hex:3706428},{weight:800,hex:3046706},{weight:900,hex:1793568}]},{color:"Light Green",variations:[{weight:50,hex:15857897},{weight:100,hex:14478792},{weight:200,hex:12968357},{weight:300,hex:11457921},{weight:400,hex:10275941},{weight:500,hex:9159498},{weight:600,hex:8172354},{weight:700,hex:6856504},{weight:800,hex:5606191},{weight:900,hex:3369246}]},{color:"Lime",variations:[{weight:50,hex:16382951},{weight:100,hex:15791299},{weight:200,hex:15134364},{weight:300,hex:14477173},{weight:400,hex:13951319},{weight:500,hex:13491257},{weight:600,hex:12634675},{weight:700,hex:11514923},{weight:800,hex:10394916},{weight:900,hex:8550167}]},{color:"Yellow",variations:[{weight:50,hex:16776679},{weight:100,hex:16775620},{weight:200,hex:16774557},{weight:300,hex:16773494},{weight:400,hex:16772696},{weight:500,hex:16771899},{weight:600,hex:16635957},{weight:700,hex:16498733},{weight:800,hex:16361509},{weight:900,hex:16088855}]},{color:"Amber",variations:[{weight:50,hex:16775393},{weight:100,hex:16772275},{weight:200,hex:16769154},{weight:300,hex:16766287},{weight:400,hex:16763432},{weight:500,hex:16761095},{weight:600,hex:16757504},{weight:700,hex:16752640},{weight:800,hex:16748288},{weight:900,hex:16740096}]},{color:"Orange",variations:[{weight:50,hex:16774112},{weight:100,hex:16769202},{weight:200,hex:16764032},{weight:300,hex:16758605},{weight:400,hex:16754470},{weight:500,hex:16750592},{weight:600,hex:16485376},{weight:700,hex:16088064},{weight:800,hex:15690752},{weight:900,hex:15094016}]},{color:"Deep Orange",variations:[{weight:50,hex:16509415},{weight:100,hex:16764092},{weight:200,hex:16755601},{weight:300,hex:16747109},{weight:400,hex:16740419},{weight:500,hex:16733986},{weight:600,hex:16011550},{weight:700,hex:15092249},{weight:800,hex:14172949},{weight:900,hex:12531212}]},{color:"Brown",variations:[{weight:50,hex:15723497},{weight:100,hex:14142664},{weight:200,hex:12364452},{weight:300,hex:10586239},{weight:400,hex:9268835},{weight:500,hex:7951688},{weight:600,hex:7162945},{weight:700,hex:6111287},{weight:800,hex:5125166},{weight:900,hex:4073251}]},{color:"Grey",variations:[{weight:50,hex:16448250},{weight:100,hex:16119285},{weight:200,hex:15658734},{weight:300,hex:14737632},{weight:400,hex:12434877},{weight:500,hex:10395294},{weight:600,hex:7697781},{weight:700,hex:6381921},{weight:800,hex:4342338},{weight:900,hex:2171169}]},{color:"Blue Grey",variations:[{weight:50,hex:15527921},{weight:100,hex:13621468},{weight:200,hex:11583173},{weight:300,hex:9479342},{weight:400,hex:7901340},{weight:500,hex:6323595},{weight:600,hex:5533306},{weight:700,hex:4545124},{weight:800,hex:3622735},{weight:900,hex:2503224}]},{color:"Grey",variations:[{weight:50,hex:16777215},{weight:100,hex:14737632},{weight:200,hex:12895428},{weight:300,hex:11053224},{weight:400,hex:9211020},{weight:500,hex:7368816},{weight:600,hex:5526612},{weight:700,hex:3684408},{weight:800,hex:1842204},{weight:900,hex:0}]}];function gn(e,t){return ze({type:e,id:t})}h(gn,"EvDataChange4");m(gn,"EvDataChange");var Y0=h(class{name;id;fields;constructor(e){this.name=e,this.id=void 0,this.fields=[]}},"MetaInfos4");m(Y0,"MetaInfos");var Oa=Symbol("metaField");function fo(e,t=!0){let i=e.constructor,s=i.hasOwnProperty(Oa)?i[Oa]:void 0;if(s===void 0){t||console.assert(s!==void 0),s=new Y0(i.name);let r=Object.getPrototypeOf(i);if(r!=mc){let n=r[Oa];s.fields=[...n.fields,...s.fields],console.assert(s.id===void 0,"cannot define mutiple record id"),s.id||(s.id=n.id)}e.constructor[Oa]=s}return s}h(fo,"_getMetas4");m(fo,"_getMetas");var Jf;(e=>{function t(){return(u,_)=>{let p=fo(u);p.fields.push({name:_,type:"any",required:!0}),p.id=_}}h(t,"id"),e.id=t,m(t,"id");function i(u){return(_,p)=>{fo(_).fields.push({name:p,...u})}}h(i,"field"),e.field=i,m(i,"field");function s(u){return i({...u,type:"string"})}h(s,"string"),e.string=s,m(s,"string");function r(u){return i({...u,type:"int"})}h(r,"int"),e.int=r,m(r,"int");function n(u){return i({...u,type:"float"})}h(n,"float"),e.float=n,m(n,"float");function l(u){return i({...u,type:"bool"})}h(l,"bool"),e.bool=l,m(l,"bool");function o(u){return i({...u,type:"date"})}h(o,"date"),e.date=o,m(o,"date");function a(u){return i({...u,type:"calc"})}h(a,"calc"),e.calc=a,m(a,"calc");function c(u,_){return e.field({..._,type:"array",model:new u})}h(c,"array"),e.array=c,m(c,"array")})(Jf||(Jf={}));var mc=h(class{constructor(e,t){e!==void 0&&this.unSerialize(e,t)}clone(e){let t=new this.constructor;return e&&t.unSerialize(e),t}getID(){let e=fo(this,!1);return this[e.id]}getFields(){return fo(this,!1).fields}validate(){let e=null;return this.getFields().forEach(i=>{i.required&&!this.getField(i.name)&&(e&&(e=[]),e.push(new Error(`field ${i.name} is required.`)))}),e}getFieldIndex(e){return this.getFields().findIndex(i=>i.name==e)}serialize(){let e={};return this.getFields().forEach(t=>{t.calc===void 0&&(e[t.name]=e[t.name])}),e}unSerialize(e,t){let i=this.getFields();return i.forEach(s=>{let r=e[s.name];r!==void 0&&(this[s.name]=this._convertField(s,r))}),t!==void 0?this[i[0].name]=t:console.assert(this.getID()!==void 0),this}_convertField(e,t){switch(e.type){case"float":{let i=typeof t=="number"?t:parseFloat(t);if(e.prec!==void 0){let s=Math.pow(10,e.prec);i=Math.round(i*s)/s}return i}case"int":return typeof t=="number"?t:parseInt(t);case"date":return We(t)?new Date(t):t;case"array":{let i=[];if(e.model)return t.forEach(s=>{i.push(e.model.clone(s))}),i;break}}return t}getRaw(e){let t,i=this.getFields();if(typeof e=="string"){if(t=i.findIndex(r=>r.name==e),t<0){console.assert(!1,"unknown field: "+e);return}}else if(e>=0&&e<i.length)t=e;else{console.assert(!1,"bad field name: "+e);return}let s=i[t];return s.calc!==void 0?s.calc(this):this[s.name]}setRaw(e,t){this[e]=t}getField(e){let t=this.getRaw(e);return t==null?"":""+t}setField(e,t){let i=this.getFields(),s=i.findIndex(n=>n.name==e);if(s<0){console.assert(!1,"unknown field: "+e);return}let r=i[s];if(r.calc!==void 0){console.assert(!1,"cannot set calc field: "+e);return}this.setRaw(r.name,t)}},"Record4");m(mc,"Record");var X0=h(class extends mc{m_data;m_fid;constructor(e){super(),this.m_data=e}getID(){if(!this.m_fid){let e=Object.keys(this.m_data);this.m_fid=e[0]}return this.m_data[this.m_fid]}getFields(){return Object.keys(this.m_data).map(i=>({name:i}))}getRaw(e){return this.m_data[e]}setRaw(e,t){this.m_data[e]=t}clone(e){return new X0({...e})}},"AutoRecord4");m(X0,"AutoRecord");var Z0=h(class extends Yn{constructor(e){super(e)}load(e){e&&(this.m_props.url=e),this._refresh()}_refresh(e=0){let t=m(async()=>{let i=this.m_props.url;this.m_props.params&&(i+="?"+this.m_props.params.join("&"));let s=await fetch(i);if(s.ok){let r=await s.json(),n=r;this.m_props.solver&&(n=this.m_props.solver(n)),this.emit("change",Xe(n,r))}},"load");e?setTimeout(t,e):t()}},"DataProxy4");m(Z0,"DataProxy");var of=h(class extends po{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 Z0({url:e.url,solver:e.solver,events:{change:t=>{this.setData(t.value)}}}),this.m_proxy.load())}load(e){this.m_proxy.load(e)}reload(){this.m_proxy.load()}setData(e){let t=[];e.forEach(i=>{t.push(this.m_model.clone(i))}),this.setRawData(t)}setRawData(e){this.m_records=e,this._rebuildIndex(),this.emit("data_change",gn("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=e.getID(),i=this.indexOfId(t);return i<0?!1:(this.m_records[this.m_rec_index[i]]=e,this.emit("data_change",gn("update",t)),!0)}append(e){e instanceof mc||(e=this.m_model.clone().unSerialize(e)),console.assert(e.getID()),this.m_records.push(e),this._rebuildIndex(),this.emit("data_change",gn("create",e.getID()))}getMaxId(){let e;return this.m_records.forEach(t=>{let i=t.getID();(e===void 0||e<i)&&(e=i)}),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.emit("data_change",gn("delete",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){for(let t=this.count,i=0;t!=0;t>>=1){let s=i+(t>>1),r=this.m_rec_index[s],n=this.m_records[r].getID();if(n==e)return s;n<e&&(i=s+1,t--)}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){return this.m_records[e]??null}moveTo(e){e.setRawData(this.m_records)}createView(e){let t={...e,store:this};return new J0(t)}createIndex(e){if(e&&e.op==="empty-result")return new Uint32Array(0);let t=new Uint32Array(this.m_records.length),i=0;if(!e)this.forEach((u,_)=>{t[i++]=_});else if(typeof e.op=="function"){let u=e.op;this.forEach((_,p)=>{_&&u(_)&&(t[i++]=p)})}else{let u=h(function(w){return w<k},"_lt2"),_=h(function(w){return w<=k},"_le2"),p=h(function(w){return w==k},"_eq2"),v=h(function(w){return w!=k},"_neq2"),g=h(function(w){return w>=k},"_ge2"),x=h(function(w){return w>k},"_gt2"),E=h(function(w){return S.lastIndex=-1,S.test(w)},"_re2");var s=u,r=_,n=p,l=v,o=g,a=x,c=E;m(u,"_lt"),m(_,"_le"),m(p,"_eq"),m(v,"_neq"),m(g,"_ge"),m(x,"_gt"),m(E,"_re");let y=this.m_model.getFieldIndex(e.field);if(y<0)return console.assert(!1,"unknown field name in filter"),new Uint32Array(0);let k=e.value;We(k)&&!e.caseSensitive&&(k=k.toUpperCase());let A,S;if(k instanceof RegExp)S=k,A=E;else switch(e.op){case"<":{A=u;break}case"<=":{A=_;break}case"=":{A=p;break}case">=":{A=g;break}case">":{A=x;break}case"<>":{A=v;break}}this.forEach((w,D)=>{if(!w)return;let R=w.getRaw(y);R==null?R="":(R=""+R,e.caseSensitive||(R=R.toUpperCase())),A(R)&&(t[i++]=D)})}return t.slice(0,i)}sortIndex(e,t){let i=0,s=[];if(t===null?s.push({fidx:0,asc:!0}):s=t.map(r=>{let n=this.m_model.getFieldIndex(r.field);return n==-1&&(console.assert(!1,"unknown field name in sort"),i++),{fidx:n,asc:r.ascending}}),i||s.length==0)return e;if(s.length==1){let r=s[0].fidx;e.sort((n,l)=>{let o=this.getByIndex(n).getRaw(r)??"",a=this.getByIndex(l).getRaw(r)??"";return o>a?1:o<a?-1:0}),s[0].asc||e.reverse()}else e.sort((r,n)=>{for(let l=0;l<s.length;l++){let o=s[l].fidx,a=s[l].asc?1:-1,c=this.getByIndex(r).getRaw(o)??"",u=this.getByIndex(n).getRaw(o)??"";if(c>u)return a;if(c<u)return-a}return 0});return e}forEach(e){this.m_rec_index?this.m_rec_index.some((t,i)=>{if(e(this.m_records[t],i))return i}):this.m_records.some((t,i)=>{if(t&&e(t,i))return i})}export(){return this.m_records}changed(){this.emit("data_change",gn("change"))}},"DataStore4");m(of,"DataStore");function Gl(e){return ze({action:e})}h(Gl,"EvViewChange4");m(Gl,"EvViewChange");var J0=h(class extends Yn{m_index;m_store;m_sort;m_filter;constructor(e){super(e),this.m_store=e.store,this.m_index=null,this.m_filter=null,this.m_sort=null,this.filter(e.filter),e.order?We(e.order)?this.sort([{field:e.order,ascending:!0}]):vi(e.order)?this.sort(e.order):this.sort([e.order]):this.sort(null),this.m_store.on("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.emit("view_change",Gl("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.emit("view_change",Gl("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.emit("view_change",Gl("sort"))}get store(){return this.m_store}get count(){return this.m_index.length}indexOfId(e){let t=this.m_store.indexOfId(e);return this.m_index.findIndex(i=>i===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}getById(e){return this.m_store.getById(e)}changed(){this.emit("view_change",Gl("change"))}forEach(e){debugger;this.m_index.some(t=>{let i=this.m_store.getByIndex(t);if(i&&e(i,t))return t})}},"DataView4");m(J0,"DataView");var od=h(class extends ue{m_ui_input;m_ui_button;m_popup;m_lockpop;m_lockchg;m_popvis;m_selection;constructor(e){super(e),e.editable||this.setDomEvent("keypress",()=>this.showPopup()),this.setDomEvent("click",()=>{this.m_props.editable&&this.m_ui_input.focus(),this.showPopup()}),this.setDomEvent("keydown",t=>this._onKey(t)),this.mapPropEvents(e,"selectionChange"),this.m_popvis=!1,this.m_lockpop=!1,this.m_lockchg=!1}_onKey(e){this.m_popvis&&(e.key=="ArrowUp"||e.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(e),this.m_lockpop=!1,e.preventDefault(),e.stopPropagation()):e.key=="Escape"&&(this._hidePopup(),e.preventDefault(),e.stopPropagation()))}set items(e){this.m_props.items=e,this.m_popup&&(this.m_popup.items=e)}render(e){if(e.renderer)this.m_ui_input=new M({flex:1,cls:"@fake-input @hlayout",tabIndex:1});else{let r=new ss({flex:1,readOnly:!this.m_props.editable,tabIndex:0,name:e.name,value_hook:{get:()=>this.value,set:n=>{this.value=n}},dom_events:{focus:()=>{this.m_props.editable&&r.value.length==0&&this.showPopup()},input:()=>{if(this.m_lockchg)return;let n=r.value;this.m_selection={id:void 0,text:n};let l=this.showPopup();l&&l.length&&l[0].text==n&&(this.m_selection={id:l[0].id,text:n})}}});this.m_ui_input=r}let t,i,s=e.labelWidth??0;s>0?t=s:s<0&&(i=-s),this.setContent([new Ue({cls:"label1"+(e.label?"":" @hidden"),text:e.label,width:t,flex:i,align:e.labelAlign}),new ue({flex:1,content:[this.m_ui_input,this.m_ui_button=new yt({cls:"gadget",icon:"var( --x4-icon-angle-down )",tabIndex:!1,click:()=>{this.showPopup(!1)},dom_events:{focus:()=>{this.dom.focus()}}})]})]),e.value!==void 0&&(this.value=e.value)}componentDisposed(){this.m_popup&&this.m_popup.close(),super.componentDisposed()}showPopup(e=!0){let t=this.m_props;if(t.readOnly||this.hasClass("@disable"))return null;let i=t.items;if(rs(i)){let n=e?this.m_ui_input.value:null;i=i(n)}if(i.length==0)return null;if(!this.m_popup){let n=this.getComputedStyle(),l=n.value("fontFamily"),o=n.value("fontSize");this.m_popup=new ef({cls:"@combo-popup",populate:t.populate,renderItem:this.m_props.renderer,selectionChange:a=>{this._selectItem(a),this.m_lockpop||(this._hidePopup(),this.focus())},cancel:a=>this.signal("cancel",a),style:{fontFamily:l,fontSize:o}})}this.m_popup.items=i;let s=this.m_ui_button.getBoundingRect(),r=this.m_ui_input.getBoundingRect();return this.m_popup.setStyle({minWidth:s.right-r.left}),this.m_popup.displayAt(r.left,r.bottom),this.m_popvis=!0,this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.value!==void 0&&(this.m_popup.selection=this.value),i}_selectItem(e){let t=e.selection;t&&(this.m_lockchg=!0,this._setInput(t,!0),this.m_lockchg=!1,this.m_selection={id:t.id,text:t.text},this.emit("selectionChange",hs(t)),this.emit("change",Xe(t.id)))}_setInput(e,t=!1){e?this.m_ui_input?this.m_ui_input instanceof ss?(this.m_ui_input.value=e.text,t&&this.m_ui_input.dom.dispatchEvent(new Event("input"))):this.m_ui_input.setContent(this.m_props.renderer(e)):this.m_props.value=e.id:this.m_ui_input&&this.m_ui_input instanceof ss&&(this.m_ui_input.value="")}get value(){return this.m_selection?this.m_selection.id:void 0}get valueText(){return this.m_selection?this.m_selection.text:this.m_props.editable?this.m_ui_input.value:""}set value(e){let t=this.m_props.items;rs(t)&&(t=t(null)),t.some(s=>{if(s.id===e)return this._setInput(s),this.m_selection=s,!0})||(this._setInput(null),this.m_selection=null)}get input(){return this.m_ui_input instanceof ss?this.m_ui_input:null}_checkFocus(){let e=document.activeElement;this.dom&&this.dom.contains(e)||e==document.body||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(e)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1,this.stopTimer("focus-check"))}static storeProxy(e){let t=e.store instanceof of?e.store.createView():e.store;return()=>{let i=new Array(e.store.count);return e.store.forEach((s,r)=>{i[r]={id:s.getID(),text:e.display(s)}}),i}}focus(){this.m_props.editable?this.m_ui_input.focus():super.focus()}},"ComboBox4");m(od,"ComboBox");var yu=Symbol("x-drag-cb"),Q0=h(class{dragSource;dragGhost;dropTarget;notified;timer;registerDraggableElement(e){e.setDomEvent("dragstart",t=>{this.dragSource=e,this.dragGhost=e.dom.cloneNode(!0),this.dragGhost.classList.add("dragged"),V.body.appendChild(this.dragGhost),e.addClass("dragging"),t.dataTransfer.setData("text/string","1"),t.dataTransfer.setDragImage(new Image,0,0),t.stopPropagation()}),e.setDomEvent("drag",t=>{this.dragGhost.style.left=t.pageX+"px",this.dragGhost.style.top=t.pageY+"px"}),e.setDomEvent("dragend",t=>{e.removeClass("dragging"),this.dragGhost.remove()}),e.setAttribute("draggable","true")}registerDropTarget(e,t,i){let s=m(o=>{if(i&&!i(this.dragSource)){console.log("reject ",e),o.dataTransfer.dropEffect="none";return}console.log("accepted ",e),o.preventDefault(),o.dataTransfer.dropEffect="copy"},"dragEnter"),r=m(o=>{if(i&&!i(this.dragSource)){console.log("reject ",e),o.dataTransfer.dropEffect="none";return}if(o.preventDefault(),this.dropTarget!=e&&(this.dropTarget=e,this._startCheck()),this.dropTarget){let a={pt:new Gi(o.pageX,o.pageY),data:o.dataTransfer};t("drag",this.dragSource,a)}o.dataTransfer.dropEffect="copy"},"dragOver"),n=m(o=>{this.dropTarget=null,o.preventDefault()},"dragLeave"),l=m(o=>{let a={pt:new Gi(o.pageX,o.pageY),data:o.dataTransfer};t("drop",this.dragSource,a),this.dropTarget=null,e.removeClass("drop-over"),o.preventDefault()},"drop");e.setDomEvent("dragenter",s),e.setDomEvent("dragover",r),e.setDomEvent("dragleave",n),e.setDomEvent("drop",l),e.setData(yu,t)}_startCheck(){this.timer&&(clearInterval(this.timer),this._check()),this.timer=setInterval(()=>this._check(),300)}_check(){let e=m(i=>{i.removeClass("drop-over"),i.getData(yu)("leave",this.dragSource)},"leaving"),t=m(i=>{i.addClass("drop-over"),i.getData(yu)("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))}},"DragManager4");m(Q0,"DragManager");var IC=new Q0,k1={align:"center",vAlign:"middle",fontSize:14,fontWeight:null,fontStyle:"",fontVariant:"",fontFamily:"Arial",lineHeight:0,clip:!0,columns:1,columnGap:0,lineBreak:!0};function S1(e,t,i,s){if(i.width<=0||i.height<=0)return;if(s={...k1,...s},e.save(),s.clip&&(e.beginPath(),e.rect(i.left,i.top,i.width,i.height),e.clip()),s.rotation){let C=new Gi(i.left+i.width/2,i.top+i.height/2),z=s.rotation/180*Math.PI;e.translate(C.x,C.y),e.rotate(z),e.translate(-C.x,-C.y)}e.textBaseline="bottom";let r=go(s.fontSize,2)??12,n="";s.fontStyle&&(n+=s.fontStyle+" "),s.fontVariant&&(n+=s.fontVariant+" "),s.fontWeight&&(n+=s.fontWeight+" "),n+=r+"px ";let l=s.fontFamily??"sans-serif";l.indexOf(".")>0&&(l='"'+l+'"'),n+=l,e.font=n.trim();let o=[],a=t.split(`
|
|
31
|
+
`),c=s.columns<1?1:s.columns,u=s.columnGap,_=(i.width-u*(c-1))/c,p=i.left,v=_;s.lineBreak||(v=99999999);let g=eh(e," ");a.forEach(C=>{let z={width:0,words:[],space:0},W=eh(e,C);if(W<v)z.width=W,z.words.push({width:W,text:C}),o.push(z);else{let ve=C.split(/\s/).filter(K=>K!=="").map(K=>({width:eh(e,K),text:K})),te=0,ie=0;for(;te<ve.length;){let K=ve[te],Y=z.width;Y&&(Y+=g),Y+=K.width,Y>_&&ie>0?(o.push(z),ie=0,W=0,z={width:0,words:[],space:0}):(z.words.push(K),z.width=Y,te++,ie++)}ie&&(o.push(z),z.last=!0)}});let x=ev(e,"Ag"),E=(s.lineHeight??1.3)*x,y=o.length,k=i.top;if(c==1){let C=E*y;y==1&&(E=x,C=x),s.vAlign==="middle"?(k=i.top+i.height/2-C/2,k+=E/2,e.textBaseline="middle"):s.vAlign==="bottom"?C<i.height&&(k=i.top+i.height-C+E):(k=i.top,e.textBaseline="top")}else k+=x;let A=s.align=="justify",S=c,w=k,D=0;switch(s.align){case"right":D=1;break;case"center":D=2;break}let R=0;return o.some(C=>{C.space=g,A&&!C.last&&tv(C,_,g);let z=p,W=0;if(D==1?z+=_-C.width:D==2&&(z+=_/2-C.width/2),C.words.forEach(J=>{e.fillText(J.text,z,w),z+=J.width+C.space,W+=J.width+C.space}),w+=E,R<W&&(R=W),w>i.bottom+E&&(w=k,p+=_+u,--S==0))return!0}),e.restore(),{width:R,height:(o.length+.3)*E}}h(S1,"drawText4");m(S1,"drawText");function ev(e,t){let i=e.measureText(t);return i.actualBoundingBoxAscent+i.actualBoundingBoxDescent}h(ev,"_calcTextHeight4");m(ev,"_calcTextHeight");function eh(e,t){return go(e.measureText(t).width,2)}h(eh,"_measureText4");m(eh,"_measureText");function tv(e,t,i){let s=(t-e.width)/(e.words.length-1)+i;s<=0||(e.width=t,e.space=s)}h(tv,"_justify4");m(tv,"_justify");var Eu="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";function ad(e){return e.substr(0,5)=="data:"}h(ad,"_isStaticImage4");m(ad,"_isStaticImage");var Vs=h(class extends M{m_created;m_lazysrc;constructor(e){super(e),this.m_created=!1,this.m_props.lazy=e.lazy!==!1,this.m_props.alt=e.alt,e.lazy!==!1&&(this.m_lazysrc=e.src,e.src=Eu),this.setDomEvent("create",()=>{e.lazy&&this.setImage(this.m_lazysrc,!0)})}render(){let e=this.m_props,t=new M({tag:"img",attrs:{draggable:!1,alt:e.alt??"",decoding:e.lazy?"async":void 0},style:{objectFit:e.alignment?e.alignment:void 0}});this.setContent(t)}setImage(e,t){e||(e=Eu),this.m_props.lazy?(t||this.m_lazysrc!=e)&&(ad(e)?(this.m_props.src=e,this.m_lazysrc=e,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src)):(this.m_props.src=Eu,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src),this.m_lazysrc=e,this.dom&&this._update_image())):(this.m_props.src=e,this.m_lazysrc=e,this.dom&&this.dom.firstChild.setAttribute("src",e))}_update_image(){console.assert(!!this.dom),this.m_lazysrc&&!ad(this.m_lazysrc)&&(Vs.lazy_images_waiting.push({dom:this.dom,src:this.m_lazysrc}),Vs.lazy_image_timer===void 0&&(Vs.lazy_image_timer=setInterval(Vs.lazyWatch,10)))}static lazyWatch(){let e=[],t=0;Vs.lazy_images_waiting.forEach(i=>{let s=i.dom,r=i.src;if(!s||s.offsetParent===null)return;let n=s.getBoundingClientRect();!t&&s.offsetParent!==null&&n.bottom>=0&&n.right>=0&&n.top<=(window.innerHeight||V.documentElement.clientHeight)&&n.left<=(window.innerWidth||V.documentElement.clientWidth)?(s.firstChild.setAttribute("src",r),t++):e.push(i)}),Vs.lazy_images_waiting=e,e.length==0&&(clearInterval(Vs.lazy_image_timer),Vs.lazy_image_timer=void 0)}},"_Image4"),cc=Vs;m(cc,"Image");de(cc,"lazy_images_waiting",[]);de(cc,"lazy_image_timer");var iv=h(class extends ue{constructor(e){super(e)}clear(){this.m_props.value=""}},"FileUpload4");m(iv,"FileUpload");var D1=h(class extends iv{m_path;m_ui_img;m_ui_input;render(e){let t="up"+this.uid;this.setContent([new M({tag:"label",attrs:{for:t},content:[this.m_ui_img=new cc({src:this.m_props.value})]}),this.m_ui_input=new ss({cls:"@hidden",id:t,type:"file",name:this.m_props.name,value_hook:{get:()=>this._get_value(),set:i=>{this._set_value(i)}},attrs:{accept:"image/*"},dom_events:{change:i=>{this._handleChange(i)}}})])}clear(){super.clear(),this.m_ui_input.dom.value="",this.m_ui_img.setImage(null,!1)}_get_value(){return this.m_path}_set_value(e){debugger}_handleChange(e){let t=this;function i(l){let o=new FileReader;o.addEventListener("load",a=>{t.m_ui_img.setImage(o.result.toString())}),o.readAsDataURL(l)}h(i,"createThumbnail"),m(i,"createThumbnail");let s=["png","jpg","jpeg","gif"],r=e.target.files,n=r.length;for(let l=0;l<n;l++){let o=r[l].name.split(".");if(o=o[o.length-1],o=o.toLowerCase(),s.indexOf(o)!=-1){i(r[l]),this.m_path=r[l];break}}}},"ImageUpload4");m(D1,"ImageUpload");var Vl=null;function af(){return Vl||(Vl=new M({tag:"input",style:{display:"none",id:"fileDialog"},attrs:{type:"file"}}),V.body.appendChild(Vl._build())),Vl.clearDomEvent("change"),Vl}h(af,"_createFileInput4");m(af,"_createFileInput");function I1(e,t,i=!1){let s=af();s.removeAttribute("nwsaveas"),s.setAttribute("accept",e),s.setAttribute("multiple",i),s.setDomEvent("change",r=>{let n=s.dom.files;t(n)}),s.dom.click()}h(I1,"openFileDialog4");m(I1,"openFileDialog");function A1(e,t,i){let s=af();s.setAttribute("nwsaveas",e),s.setAttribute("accept",t),s.setDomEvent("change",r=>{let n=s.dom.files;i(n[0])}),s.dom.click()}h(A1,"saveFileDialog4");m(A1,"saveFileDialog");var hd,Th;function sv(e){e?Th=new Intl.NumberFormat(hd,{style:"currency",currency:e}):Th=new Intl.NumberFormat(hd,{style:"decimal",useGrouping:!0,minimumFractionDigits:2,maximumFractionDigits:2})}h(sv,"setCurrencySymbol4");m(sv,"setCurrencySymbol");function M1(e){if(e==null||e==="")return"";let t=new Date(Date.parse(e)),i={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return t.toLocaleDateString(hd,i)}h(M1,"sql_date_formatter4");m(M1,"sql_date_formatter");function P1(e){if(e==null||e==="")return"";let t=typeof e=="string"?new Date(Date.parse(e)):e;return Ot(t)}h(P1,"date_formatter4");m(P1,"date_formatter");function T1(e){if(e==null||e==="")return"";let t=go(typeof e=="string"?parseFloat(e):e,2);return Object.is(t,-0)&&(t=0),Th.format(t)}h(T1,"money_formatter4");m(T1,"money_formatter");function F1(e){if(e==null||e==="")return"";let t=go(typeof e=="string"?parseFloat(e):e,2);return t?Th.format(t):""}h(F1,"money_formatter_nz4");m(F1,"money_formatter_nz");function z1(e){return e?"oui":"-"}h(z1,"bool_formatter4");m(z1,"bool_formatter");sv(null);var AC=Symbol("update");function rv(e,t){return ze({rec:e,chk:t})}h(rv,"EvGridCheck4");m(rv,"EvGridCheck");var nv=h(class extends M{m_sens;m_sorted;constructor(e,t){super(e),this.m_sorted=!1,this.m_sens="dn",this.setContent([new M({tag:"span",content:t}),new lt({ref:"sorter",cls:"@hidden sort",icon:"var( --x4-icon-arrow-down )"})])}get sorted(){return this.m_sorted}sort(e,t){this.m_sorted=e,this.m_sens=t;let i=this.itemWithRef("sorter");i.icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )",i.show(e)}get sens(){return this.m_sens}toggleSens(){this.m_sens=this.m_sens=="up"?"dn":"up",this.itemWithRef("sorter").icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )"}},"ColHeader4");m(nv,"ColHeader");var R1=h(class extends It{m_dataview;m_data_cx;m_columns;m_view_el;m_container;m_header;m_footer;m_empty_msg;m_empty_text;m_selection;m_itemHeight;m_topIndex;m_visible_rows;m_hasMarks;m_marks;m_recycler;m_rowClassifier;constructor(e){super(e),this.m_columns=e.columns,this.m_hasMarks=e.hasMarks??!1,this.m_marks=new Set,this.m_hasMarks&&this.m_columns.unshift({id:"id",title:"",width:30,renderer:t=>this._renderCheck(t)}),this.setAttribute("tabindex",0),this.m_topIndex=0,this.m_itemHeight=0,this.m_recycler=[],this.m_rowClassifier=e.calcRowClass,this.m_empty_text=e.empty_text??ne.global.empty_list,this.setDomEvent("click",t=>this._itemClick(t)),this.setDomEvent("dblclick",t=>this._itemDblClick(t)),this.setDomEvent("contextmenu",t=>this._itemMenu(t)),this.setDomEvent("keydown",t=>this._handleKey(t)),this.setStore(e.store)}componentCreated(){this._updateScroll(!0)}_moveSel(e,t=!0){let i=this.m_selection,s=null;if(i===void 0)i=this.m_dataview.getByIndex(0).getID();else{let r=this.m_dataview.indexOfId(this.m_selection);e==1?r++:e==-1?r--:e==2?r+=this.m_visible_rows.length-1:e==-2&&(r-=this.m_visible_rows.length-1),e<0?s="start":s="end",r<0?r=0:r>=this.m_dataview.count&&(r=this.m_dataview.count-1),i=this.m_dataview.getByIndex(r).getID()}return this.m_selection!=i&&t&&this._selectItem(i,null,s),i}_handleKey(e){if(!(!this.m_dataview||this.m_dataview.count==0))switch(e.key){case"ArrowDown":case"Down":{this._moveSel(1);break}case"ArrowUp":case"Up":{this._moveSel(-1);break}case"PageUp":{this._moveSel(-2);break}case"PageDown":{this._moveSel(2);break}}}getNextSel(e){return this._moveSel(e,!1)}_scrollIntoView(e,t){let i=this._findItem(e);i?i.scrollIntoView({block:"center"}):(this.m_topIndex=this.m_dataview.indexOfId(e),this.m_view_el.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),this._scrollIntoView(e))}setStore(e){this.m_selection=void 0,e instanceof of?this.m_dataview=e.createView():this.m_dataview=e,this.m_hasMarks&&this.clearMarks(),this.m_data_cx&&this.m_data_cx.dispose(),this.m_dataview&&(this.m_data_cx=this.m_dataview.on("view_change",t=>{t.action=="change"&&(this.m_selection=void 0),this._updateScroll(!0)}),this._updateScroll(!0))}getView(){return this.m_dataview}getSelection(){return this.m_selection}getSelRec(){return this.m_selection?this.m_dataview.getById(this.m_selection):null}setSelection(e){this._selectItem(e,null,"center")}render(){this.m_recycler=[],this.m_container=new M({cls:"content"}),this.m_empty_msg=new Ue({cls:"empty-msg",text:""}),this.m_view_el=new M({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let e=!1,t=this.m_columns.map((s,r)=>{let n="@cell";s.cls&&(n+=" "+s.cls);let l=new nv({cls:n,flex:s.flex,sizable:"right",style:{width:s.width},dom_events:{click:a=>{wi(a.target).hasClass("@sizer-overlay")||(this._sortCol(s),a.preventDefault())}}},s.title),o=m(a=>{if(this._on_col_resize(r,a.size.width),this.m_footer){let c=M.getElement(this.m_footer.dom.childNodes[r]);c&&c.setStyleValue("width",a.size.width)}},"resizeCol");return new Fh({target:l,sens:"right",events:{resize:a=>o(a)}}),s.flex&&(e=!0),s.$hdr=l,l});t.push(new lh({ref:"flex",cls:e?"@hidden":""}));let i=0;if(this.m_columns.forEach(s=>{i+=s.width??0}),this.m_header=new ue({cls:"@header",content:t,style:{minWidth:i}}),this.m_props.hasFooter){let s=this.m_columns.map((r,n)=>{let l="@cell";r.align&&(l+=" "+r.align),r.cls&&(l+=" "+r.cls);let o=new M({cls:l,data:{col:n},flex:r.flex,style:{width:r.width}});return r.$ftr=o,o});s.push(new lh({ref:"flex",cls:e?"@hidden":""})),this.m_footer=new ue({cls:"@footer",content:s,style:{minWidth:i}})}else this.m_footer=null;this.setContent([this.m_header,this.m_view_el,this.m_footer,this.m_empty_msg])}_on_col_resize(e,t){let i=this.m_columns[e],s=!1;if(t>=0?(i.width=t,i.flex&&(i.$hdr.removeClass("@flex"),i.$ftr?.removeClass("@flex"),i.flex=void 0,s=!0)):t<0&&!i.flex&&(i.$hdr.addClass("@flex"),i.$ftr?.addClass("@flex"),i.flex=1,s=!0),s){let r=!1;this.m_columns.forEach(n=>{n.flex&&(r=!0)}),this.m_header.itemWithRef("flex")?.show(!r),this.m_footer&&this.m_footer.itemWithRef("flex")?.show(!r)}this._updateScroll(!0)}sortCol(e,t=!0){let i=this.m_columns.find(s=>s.id==e);if(i===void 0){console.assert(!1,"unknown field "+e+" in grid.sortCol");return}this._sortCol(i,t?"dn":"up")}_sortCol(e,t="up"){if(e.sortable===!1)return;this.m_columns.forEach(s=>{s!==e&&s.$hdr.sort(!1,"dn")});let i=e.$hdr;i.sorted?i.toggleSens():i.sort(!0,t),this.m_dataview&&this.m_dataview.sort([{field:e.id,ascending:i.sens!="dn"}])}_computeItemHeight(){let e=V.createElement("div");e.classList.add("x-row");let t=V.createElement("div");t.classList.add("x-grid-view"),t.style.position="absolute",t.style.top="-1000px",t.appendChild(e),this.dom.appendChild(t);let i=e.getBoundingClientRect();this.dom.removeChild(t),this.m_itemHeight=i.height}_createRow(e){let t;if(this.m_recycler.length){t=this.m_recycler.pop(),t.clearClasses(),t.addClass(e.cls),t.setContent(e.content),t.setStyle(e.style);for(let i in e.data)t.setData(i,e.data[i])}else t=new ue(e);return t.dom||this.m_container.appendChild(t),t}_buildItems(e=!0){let t=this.getBoundingRect(),i=this.m_header.getBoundingRect(),s=t.height-i.height+this.m_itemHeight;this.m_itemHeight==0&&this._computeItemHeight();let r=this.m_topIndex*this.m_itemHeight,n=0,l=0,o=this.m_topIndex,a=this.m_dataview?this.m_dataview.count:0,c=0,u=!!(this.m_topIndex&1);if(this.m_columns.forEach(g=>{c+=g.width??0}),(a+1)*this.m_itemHeight>=s){let g=M.getScrollbarSize();this.m_header.setStyleValue("paddingRight",g),this.m_footer?.setStyleValue("paddingRight",g)}else this.m_header.setStyleValue("paddingRight",0),this.m_footer?.setStyleValue("paddingRight",0);this.m_visible_rows&&this.m_visible_rows.forEach(g=>{this.m_recycler.push(g)}),this.m_visible_rows=[];let _=100;for(;n<s&&o<a&&--_>0;){let g=this.m_dataview.getByIndex(o),x=g.getID(),E=e?this.m_recycler.findIndex(y=>y.getData("row-id")==x):-1;if(E>=0){let y=this.m_recycler.splice(E,1)[0];y.setStyle({top:n+r,minWidth:c}),this.m_hasMarks&&y.setClass("@marked",this.m_marks.has(x)),y.removeClass("@hidden"),y.setClass("@selected",this.m_selection===x),this.m_visible_rows[l]=y}else{let y=this.m_columns.map(S=>{let w="@cell";S.align&&(w+=" "+S.align),S.cls&&(w+=" "+S.cls);let D;if(S.renderer)D=S.renderer(g),D&&(D.addClass(w),D.setStyleValue("width",S.width),S.flex!==void 0&&(D.addClass("@flex"),D.setStyleValue("flex",S.flex)));else{let R=S.formatter,C;R&&R instanceof Function?C=R(g.getRaw(S.id),g):C=g.getField(S.id),D=new M({cls:w,width:S.width,content:xd`<span>${C}</span>`,flex:S.flex})}return D}),k="@row @hlayout center";this.m_hasMarks&&this.m_marks.has(x)&&(k+=" @marked"),this.m_selection===x&&(k+=" @selected");let A=this.m_visible_rows[l]=this._createRow({cls:k,content:y,style:{top:n+r,minWidth:c},data:{"row-id":x,"row-idx":o}});A.addClass(u?"even":"odd"),u=!u,this.m_rowClassifier&&this.m_rowClassifier(g,A)}n+=this.m_itemHeight,o++,l++}this.m_recycler.forEach(g=>{g.addClass("@hidden")});let p=!a,v=this.m_empty_text instanceof Function?this.m_empty_text():this.m_empty_text;this.m_empty_msg.text=v,p&&v.length==0&&(p=!1),this.m_empty_msg.show(p),c<t.width?(this.m_header.setStyleValue("width",null),this.m_footer?.setStyleValue("width",null),this.m_container.setStyle({height:a*this.m_itemHeight,width:null})):(this.m_header.setStyleValue("width",c+1e3),this.m_footer?.setStyleValue("width",c+1e3),this.m_container.setStyle({height:a*this.m_itemHeight,width:c}))}_updateScroll(e){if(!this.m_view_el||!this.m_view_el.dom)return;let t=m(()=>{if(!this.dom)return;let i=Math.floor(this.m_view_el.dom.scrollTop/(this.m_itemHeight||1));(i!=this.m_topIndex||e)&&(this.m_topIndex=i,this._buildItems(!e));let s=this.m_view_el.dom.scrollLeft;this.m_header.setStyleValue("left",-s),this.m_footer?.setStyleValue("left",-s)},"update");e?this.singleShot(t,10):t()}_rowFromTarget(e){let t=this.dom;for(;e&&e!=t;){let i=M.getElement(e);if(i){let s=i.getData("row-id");if(s!==void 0)return{id:s,itm:i}}e=e.parentElement}}_itemClick(e){let t=this._rowFromTarget(e.target);t?this._selectItem(t.id,t.itm):this._selectItem(void 0,void 0)}_itemDblClick(e){let t=this._rowFromTarget(e.target);if(t){this._selectItem(t.id,t.itm);let i=this.m_dataview.getById(t.id);this.emit("dblClick",vo(i)),this.m_hasMarks&&this._toggleMark(i)}}_itemMenu(e){let t=e.target,i=this.dom;for(;t&&t!=i;){let s=M.getElement(t),r=s?.getData("row-id");if(r!==void 0){this._selectItem(r,s);let n=s.getData("row-idx"),l=this.m_dataview.getByIndex(n);this._showItemContextMenu(e,l),e.preventDefault();return}t=t.parentElement}}_findItem(e){for(let t=0;t<this.m_visible_rows.length;t++){let i=this.m_visible_rows[t];if(i.getData("row-id")===e)return i}return null}_selectItem(e,t,i){if(this.m_selection!==void 0){let s=this._findItem(this.m_selection);s&&s.removeClass("@selected")}if(this.m_selection=e,e){i&&this._scrollIntoView(e,i),t||(t=this._findItem(e)),t&&t.addClass("@selected");let s=this.m_dataview.getById(e);this.emit("selectionChange",hs(s))}else this.emit("selectionChange",hs(null))}_showItemContextMenu(e,t){this.emit("contextMenu",Hr(e,t))}clearSelection(){this._selectItem(null,null)}exportData(e){let t="",i=" ",s=`\r
|
|
32
|
+
`,r="";this.m_columns.map(l=>{r.length&&(r+=i),r+=l.title}),t+=r+s;let n=this.m_dataview.count;for(let l=0;l<n;l++){let o=this.m_dataview.getByIndex(l);r="";let a=this.m_columns.map(c=>{let u=o.getField(c.id),_=c.formatter;_&&_ instanceof Function&&(u=_(u,o)),r.length>0&&(r+=i),r+=u});t+=r+s}t=t.replace(/[àâä]/gm,"a"),t=t.replace(/[éèê]/gm,"e"),t=t.replace(/[îï]/gm,"i"),t=t.replace(/[ûüù]/gm,"u"),t=t.replace(/ /gm," "),mp(t,"text/csv",e)}set empty_text(e){this.m_empty_msg.text=e}_renderCheck(e){let t="--x4-icon-square";return this.m_marks.has(e.getID())&&(t="--x4-icon-square-check"),new lt({icon:`var(${t})`})}_toggleMark(e){let t=e.getID(),i=!1;this.m_marks.has(t)?this.m_marks.delete(t):(this.m_marks.add(t),i=!0),this.emit("gridCheck",rv(e,i)),this._buildItems(!1)}getMarks(){let e=[];for(let t of this.m_marks.values())e.push(t);return e}clearMarks(){this.m_marks.size&&(this.m_marks=new Set,this._buildItems(!1))}setFooterData(e){this.m_footer&&this.m_footer.enumChilds(t=>{let i=t.getData("col");if(i){let s=this.m_columns[i],r=e[s.id];if(r!==void 0)if(rs(r))r(t);else{let n,l=s.formatter;l&&l instanceof Function?n=l(r,e):n=r,t.setContent(n,!1)}}})}},"GridView4");m(R1,"GridView");var L1=h(class extends M{constructor(e){super(e),this.setDomEvent("click",()=>this._handleClick()),this.mapPropEvents(e,"click")}_handleClick(){this.emit("click",lr())}render(e){let t=e.text??"",i=e.href??"#";this.setTag("a"),this.setAttribute("tabindex",0),this.setAttribute("href",i),this.setAttribute("target",e.target),t&&this.setContent(js(t)?t:xd`<span>${t}</span>`)}set text(e){this.m_props.text=e,this.update()}},"Link4");m(L1,"Link");var ai=h(class{static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=ai.hexChars,i=ai.hexOut,s,r,n,l;for(l=0;l<4;l+=1)for(r=l*8,s=e[l],n=0;n<8;n+=2)i[r+1+n]=t.charAt(s&15),s>>>=4,i[r+0+n]=t.charAt(s&15),s>>>=4;return i.join("")}static _md5cycle(e,t){let i=e[0],s=e[1],r=e[2],n=e[3];i+=(s&r|~s&n)+t[0]-680876936|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[1]-389564586|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[2]+606105819|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[3]-1044525330|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[4]-176418897|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[5]+1200080426|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[6]-1473231341|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[7]-45705983|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[8]+1770035416|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[9]-1958414417|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[10]-42063|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[11]-1990404162|0,s=(s<<22|s>>>10)+r|0,i+=(s&r|~s&n)+t[12]+1804603682|0,i=(i<<7|i>>>25)+s|0,n+=(i&s|~i&r)+t[13]-40341101|0,n=(n<<12|n>>>20)+i|0,r+=(n&i|~n&s)+t[14]-1502002290|0,r=(r<<17|r>>>15)+n|0,s+=(r&n|~r&i)+t[15]+1236535329|0,s=(s<<22|s>>>10)+r|0,i+=(s&n|r&~n)+t[1]-165796510|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[6]-1069501632|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[11]+643717713|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[0]-373897302|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[5]-701558691|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[10]+38016083|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[15]-660478335|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[4]-405537848|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[9]+568446438|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[14]-1019803690|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[3]-187363961|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[8]+1163531501|0,s=(s<<20|s>>>12)+r|0,i+=(s&n|r&~n)+t[13]-1444681467|0,i=(i<<5|i>>>27)+s|0,n+=(i&r|s&~r)+t[2]-51403784|0,n=(n<<9|n>>>23)+i|0,r+=(n&s|i&~s)+t[7]+1735328473|0,r=(r<<14|r>>>18)+n|0,s+=(r&i|n&~i)+t[12]-1926607734|0,s=(s<<20|s>>>12)+r|0,i+=(s^r^n)+t[5]-378558|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[8]-2022574463|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[11]+1839030562|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[14]-35309556|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[1]-1530992060|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[4]+1272893353|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[7]-155497632|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[10]-1094730640|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[13]+681279174|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[0]-358537222|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[3]-722521979|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[6]+76029189|0,s=(s<<23|s>>>9)+r|0,i+=(s^r^n)+t[9]-640364487|0,i=(i<<4|i>>>28)+s|0,n+=(i^s^r)+t[12]-421815835|0,n=(n<<11|n>>>21)+i|0,r+=(n^i^s)+t[15]+530742520|0,r=(r<<16|r>>>16)+n|0,s+=(r^n^i)+t[2]-995338651|0,s=(s<<23|s>>>9)+r|0,i+=(r^(s|~n))+t[0]-198630844|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[7]+1126891415|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[14]-1416354905|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[5]-57434055|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[12]+1700485571|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[3]-1894986606|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[10]-1051523|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[1]-2054922799|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[8]+1873313359|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[15]-30611744|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[6]-1560198380|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[13]+1309151649|0,s=(s<<21|s>>>11)+r|0,i+=(r^(s|~n))+t[4]-145523070|0,i=(i<<6|i>>>26)+s|0,n+=(s^(i|~r))+t[11]-1120210379|0,n=(n<<10|n>>>22)+i|0,r+=(i^(n|~s))+t[2]+718787259|0,r=(r<<15|r>>>17)+n|0,s+=(n^(r|~i))+t[9]-343485551|0,s=(s<<21|s>>>11)+r|0,e[0]=i+e[0]|0,e[1]=s+e[1]|0,e[2]=r+e[2]|0,e[3]=n+e[3]|0}_dataLength;_bufferLength;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(ai.stateIdentity),this}appendStr(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n;for(n=0;n<e.length;n+=1){if(r=e.charCodeAt(n),r<128)t[s++]=r;else if(r<2048)t[s++]=(r>>>6)+192,t[s++]=r&63|128;else if(r<55296||r>56319)t[s++]=(r>>>12)+224,t[s++]=r>>>6&63|128,t[s++]=r&63|128;else{if(r=(r-55296)*1024+(e.charCodeAt(++n)-56320)+65536,r>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[s++]=(r>>>18)+240,t[s++]=r>>>12&63|128,t[s++]=r>>>6&63|128,t[s++]=r&63|128}s>=64&&(this._dataLength+=64,ai._md5cycle(this._state,i),s-=64,i[0]=i[16])}return this._bufferLength=s,this}appendAsciiStr(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n=0;for(;;){for(r=Math.min(e.length-n,64-s);r--;)t[s++]=e.charCodeAt(n++);if(s<64)break;this._dataLength+=64,ai._md5cycle(this._state,i),s=0}return this._bufferLength=s,this}appendByteArray(e){let t=this._buffer8,i=this._buffer32,s=this._bufferLength,r,n=0;for(;;){for(r=Math.min(e.length-n,64-s);r--;)t[s++]=e[n++];if(s<64)break;this._dataLength+=64,ai._md5cycle(this._state,i),s=0}return this._bufferLength=s,this}getState(){let e=this,t=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[t[0],t[1],t[2],t[3]]}}setState(e){let t=e.buffer,i=e.state,s=this._state,r;for(this._dataLength=e.length,this._bufferLength=e.buflen,s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],r=0;r<t.length;r+=1)this._buffer8[r]=t.charCodeAt(r)}end(e=!1){let t=this._bufferLength,i=this._buffer8,s=this._buffer32,r=(t>>2)+1,n;if(this._dataLength+=t,i[t]=128,i[t+1]=i[t+2]=i[t+3]=0,s.set(ai.buffer32Identity.subarray(r),r),t>55&&(ai._md5cycle(this._state,s),s.set(ai.buffer32Identity)),n=this._dataLength*8,n<=4294967295)s[14]=n;else{let l=n.toString(16).match(/(.*?)(.{0,8})$/);if(l===null)return;let o=parseInt(l[2],16),a=parseInt(l[1],16)||0;s[14]=o,s[15]=a}return ai._md5cycle(this._state,s),e?this._state:ai._hex(this._state)}},"_Md54"),bl=ai;m(bl,"Md5");de(bl,"stateIdentity",new Int32Array([1732584193,-271733879,-1732584194,271733878]));de(bl,"buffer32Identity",new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]));de(bl,"hexChars","0123456789abcdef");de(bl,"hexOut",[]);de(bl,"onePassHasher",new ai);var Nl=h(class extends hc{m_label;constructor(e){let t=e.icon??"var( --x4-icon-exclamation )";e.icon=void 0;let i=e.buttons===void 0?["ok"]:e.buttons;e.buttons=void 0,super(e);let s=e.message;this.form.updateContent(new ue({style:{padding:8},content:[t?new lt({cls:"icon",icon:t}):null,this.m_label=new Ue({cls:"text",text:s,multiline:!0})]}),i),this.on("btnClick",r=>{this.m_props.click&&Xr(()=>{this.m_props.click(r.button)})})}set text(e){this.m_label.text=e}static show(e){let t;return We(e)||js(e)?t=new Nl({message:e,click:()=>{}}):t=new Nl(e),t.show(),t}static async showAsync(e){return new Promise((t,i)=>{let s,r=m(l=>{t(l)},"cb");We(e)||js(e)?s={message:e,click:r}:s={...e,click:r},new Nl(s).show()})}static alert(e,t=null){new Nl({cls:"warning",title:t,message:e,buttons:["ok"],click:()=>{}}).show()}},"MessageBox4");m(Nl,"MessageBox");var md=h(class extends hc{m_edit;constructor(e){e.buttons=void 0,e.width=e.width??500,super(e),this.form.updateContent(new ue({cls:"panel",content:[this.m_edit=new Si({flex:1,autoFocus:!0,label:e.message,value:e.value})]}),["ok","cancel"]),e.click&&this.on("btnClick",t=>{t.button==="ok"&&Xr(()=>{this.m_props.click(this.m_edit.value)})})}set text(e){this.m_edit.label=e}static show(e,t){let i;return We(e)||js(e)?i=new md({message:e,click:t}):i=new md(e),i.show(),i}},"PromptDialogBox4");m(md,"PromptDialogBox");var V1=h(class extends It{m_ui_title;m_ui_body;constructor(e){super(e);let t=e?.sens=="horizontal"?"@hlayout":"@vlayout";this.m_ui_title=new Ue({cls:"title",text:this.m_props.title}),this.m_ui_body=new M({cls:"body "+t,content:this.m_props.content,style:e.bodyStyle})}render(){let e=this.m_props.gadgets??[],t=this.m_props.icon?new lt({icon:this.m_props.icon}):null;super.setContent([new ue({cls:"title",content:[t,this.m_ui_title,...e]}),this.m_ui_body])}setContent(e){this.m_ui_body.setContent(e)}set title(e){this.m_ui_title.text=e}},"Panel4");m(V1,"Panel");var hf=h(class{text;cls},"CellData4");m(hf,"CellData");de(hf,"empty_cell",{text:""});var lv=h(class extends It{m_columns;m_row_limit;m_cells_data;m_rows_data;m_view;m_container;m_header;m_itemHeight;m_topIndex;m_visible_cells;m_row_count;m_selection;m_editor;m_autoedit;m_lockupdate;m_auto_row_count;m_recycler;m_used_cells;constructor(e){super(e),this.m_columns=e.columns,this.m_autoedit=e.autoedit,this.m_lockupdate=0,this.m_cells_data=new Map,this.m_rows_data=new Map,this.m_itemHeight=0,this.m_selection={row:0,col:0},this.m_row_count=0,this.m_auto_row_count=!1,this.m_recycler=[],this.m_used_cells=[],e.maxrows===void 0?(this.m_row_limit=0,this.m_auto_row_count=!0):e.maxrows<0?(this.m_row_limit=0,this.m_auto_row_count=!0):this.m_row_limit=e.maxrows,this.setAttribute("tabindex",0),this.setDomEvent("click",t=>this._itemClick(t)),this.setDomEvent("dblclick",t=>this._itemDblClick(t)),this.setDomEvent("keydown",t=>this._handleKey(t)),this.setDomEvent("keypress",t=>this._keyPress(t)),this.setDomEvent("focus",()=>this._focus(!0)),this.setDomEvent("focusout",()=>this._focus(!1)),this.setDomEvent("contextmenu",t=>this._ctxMenu(t)),this.mapPropEvents(e,"dblClick","selectionChange","contextMenu","change")}componentCreated(){super.componentCreated(),this._updateScroll(!0)}setColWidth(e,t){this._on_col_resize(e,t),this.update(10)}getColWidth(e){if(this.m_columns[e])return this.m_columns[e].width}setColTitle(e,t){console.assert(this.m_columns[e]!==void 0),this.m_columns[e].title=t,this.update(10)}reset(e){e&&(this.m_columns=e),this.m_cells_data=new Map,this.m_rows_data=new Map,this.update(10)}insertRow(e){let t=new Map;this.m_cells_data.forEach((s,r)=>{let{row:n,col:l}=Ul(r);n>=e?t.set(Ti(n+1,l),s):t.set(r,s)});let i=new Map;this.m_rows_data.forEach((s,r)=>{r>=e?i.set(r+1,s):i.set(r,s)}),this.m_cells_data=t,this.m_rows_data=i,this._buildItems()}deleteRow(e){let t=new Map,i=new Map;this.m_cells_data.forEach((s,r)=>{let{row:n,col:l}=Ul(r);n>e?t.set(Ti(n-1,l),s):n<e&&t.set(r,s)}),this.m_rows_data.forEach((s,r)=>{r>e?i.set(r-1,s):r<e&&i.set(r,s)}),this.m_cells_data=t,this.m_rows_data=i,this._buildItems()}insertCol(e,t){let i=e;if(i<0&&(i=this.m_columns.length+1),this.m_columns.splice(i,0,t),e>=0){let s=new Map;this.m_cells_data.forEach((r,n)=>{let{row:l,col:o}=Ul(n);o>=e?s.set(Ti(l,o+1),r):s.set(n,r)}),this.m_cells_data=s}this.update()}deleteCol(e){this.m_columns.splice(e,1);let t=new Map;this.m_cells_data.forEach((i,s)=>{let{row:r,col:n}=Ul(s);n>e?t.set(Ti(r,n-1),i):n<e&&t.set(s,i)}),this.m_cells_data=t,this.update()}_getCellData(e,t,i=!1){let s=this.m_cells_data.get(Ti(e,t));return s===void 0?i?null:hf.empty_cell:s}_focus(e){this.setClass("@focus",e)}_ctxMenu(e){let t=e.target,i=this.dom;for(;t&&t!=i;){let s=M.getElement(t),r=s.getData("row-id"),n=s.getData("col-id");if(r!==void 0){this._selectItem(r,n),this.emit("contextMenu",Hr(e,{row:r,col:n,item:s})),e.preventDefault();return}t=t.parentElement}}render(){this.m_recycler=[],this.m_container=new M({cls:"content"}),this.m_view=new M({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let e=this.m_columns.map((t,i)=>{let s=new M({cls:"@cell c"+i,content:t.title?t.title:" ",flex:t.width<0?-t.width:void 0,attrs:{title:t.title},style:{width:t.width>=0?t.width:void 0,minWidth:t.min_width}});return new Fh({target:s,sens:"right",resize:r=>{this._on_col_resize(i,r.size.width)}}),t.$col=s,s});this.m_header=new ue({cls:"@header",content:e}),this.setContent([this.m_header,this.m_view])}_on_col_resize(e,t){this.m_columns[e]&&(t<=0?this.m_columns[e].width=-1:this.m_columns[e].width=t,this._updateScroll(!0))}_computeItemHeight(){let e=V.createElement("div");e.classList.add("x-spreadsheet");let t=V.createElement("div");t.classList.add("content");let i=V.createElement("div");i.classList.add("x-cell"),i.append(" "),t.appendChild(i),e.appendChild(t),this.dom.appendChild(e);let s=i.getBoundingClientRect();this.dom.removeChild(e),this.m_itemHeight=s.height}_calcColWidths(e){let t=0,i=0,s=new Int32Array(this.m_columns.length),r=new Int32Array(this.m_columns.length),n=new Int32Array(this.m_columns.length);if(this.m_columns.forEach((l,o)=>{let a=Math.max(10,l.min_width??0);if(l.width>0){let c=Math.max(l.width,a);t+=c,s[o]=c}else{let c=-l.width;r[o]=c,i+=c}n[o]=a}),i){let l=e-t;for(let o=0;o<this.m_columns.length&&i;o++)if(!s[o]){let a=Math.round(l/i)*r[o];a<n[o]&&(a=n[o]),s[o]=a,l-=a,i-=r[o]}}return s}_createCell(){let e;return this.m_recycler.length?(e=this.m_recycler.pop(),e.clearClasses(),e.addClass("@comp")):e=new M({cls:"@cell"}),e.dom||this.m_container.appendChild(e),e}_buildItems(){let e=this.getBoundingRect(),t=this.m_header.getBoundingRect(),i=e.height-t.height;this.m_itemHeight==0&&this._computeItemHeight();let s=this.m_topIndex*this.m_itemHeight,r=0,n=0,l=this.m_topIndex,o=this.m_row_limit;this.m_auto_row_count&&(this.m_row_limit=o=this.getMaxRowCount());let a=0;if(o*this.m_itemHeight>i){let v=M.getScrollbarSize();e.width-=v,a=v}let c=!!(this.m_topIndex&1);this.m_visible_cells=new Map,this.m_used_cells.forEach(v=>{this.m_recycler.push(v)}),this.m_used_cells=[];let u=this._calcColWidths(e.width),_=0;for(let v=0;v<u.length;v++)_+=u[v];_<=e.width?(this.m_view.setStyleValue("overflow-x","hidden"),this.m_header.setStyleValue("width",e.width),this.m_container.setStyleValue("width",e.width),this.m_container.setStyle({height:o*this.m_itemHeight})):(this.m_header.setStyleValue("width",_),this.m_container.setStyleValue("width",_),this.m_view.setStyleValue("overflow-x","visible"),this.m_container.setStyle({height:o*this.m_itemHeight,width:_})),this.m_view.addClass("@hidden");let p=100;for(;r<i&&l<o&&--p>0;){let v=this.m_rows_data.get(l),g=0,x=this.m_columns.map((E,y)=>{let k="@cell c"+y;E.align&&(k+=" "+E.align),E.cls&&(k+=" "+E.cls);let A,S=this._getCellData(l,y),w=S.text;return E.renderer&&w.length&&(w=E.renderer(w,{row:l,col:y})),k+=c?" even":" odd",v&&(k+=" "+v),A=this._createCell(),this.m_used_cells.push(A),A.setContent(w),A.addClass(k),A.setStyle({left:g,top:s+r,width:u[y],height:this.m_itemHeight}),this.m_selection.row==l&&this.m_selection.col==y&&A.addClass("@selected"),A.setData("row-id",l),A.setData("col-id",y),S.cls&&A.addClass(S.cls),this.m_visible_cells.set(Ti(l,y),A),g+=u[y],A});c=!c,r+=this.m_itemHeight,l++,n++}this.m_recycler.forEach(v=>{v.addClass("@hidden")}),this.m_row_count=n,this.m_view.removeClass("@hidden"),this.setClass("empty",o==0)}_itemClick(e){let t=e.target;if(this.m_editor&&this.m_editor.dom.contains(t))return;let i=M.getElement(t,M);if(!i)return;let s=i.getData("row-id"),r=i.getData("col-id");s===void 0||r===void 0||this._selectItem(s,r)}_itemDblClick(e){let t=e.target;if(this.m_editor&&this.m_editor.dom.contains(t))return;let i=M.getElement(t),s=i.getData("row-id"),r=i.getData("col-id");s===void 0||r===void 0||(this.emit("dblClick",vo({row:s,col:r})),this.editCell(s,r))}_selectItem(e,t,i){e<0&&(e=0),e>this.m_row_limit-1&&(e=this.m_row_limit-1),t<0&&(t=0);let s=this.m_columns.length-1;t>s&&(t=s),!(this.m_selection.row==e&&this.m_selection.col==t)&&this.select(e,t,i)}_scrollIntoView(e,t){let i=m((r,n="nearest")=>{r.scrollIntoView({block:n})},"doscroll"),s=this.m_topIndex+this.m_row_count-1;e<this.m_topIndex?(this.m_topIndex=e,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),i(this._findItem(e,t),"start")):e>s?(this.m_topIndex=e-this.m_row_count+1,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),i(this._findItem(e,t),"end")):i(this._findItem(e,t))}_findItem(e,t){return this.m_visible_cells?this.m_visible_cells.get(Ti(e,t)):null}_updateScroll(e){if(!this?.m_view?.dom)return;let t=Math.floor(this.m_view.dom.scrollTop/(this.m_itemHeight||1));(t!=this.m_topIndex||e)&&(this.m_topIndex=t,this._buildItems());let i=this.m_view.dom.scrollLeft;this.m_header.setStyleValue("left",-i)}_moveSel(e,t){let i=this.m_selection,s=i.row??0,r=i.col??0;if(e==1?s++:e==-1?s--:e==2?s+=this.m_row_count-1:e==-2?s-=this.m_row_count-1:e==3?s=this.m_row_limit-1:e==-3&&(s=0),t==1)r++;else if(t==-1)r--;else if(t==2)r=this.m_columns.length-1;else if(t==-2)r=0;else if(t==3){r++;let n=this.m_columns.length-1;e:for(let l=0;l<2;l++){for(;r<n;){if(this.m_columns[r].createEditor!==null)break e;r++}r>n&&(s++,r=0)}}else if(t==-3){r--;let n=this.m_columns.length-1;e:for(let l=0;l<2;l++){for(;r>=0;){if(this.m_columns[r].createEditor!==null)break e;r--}r<0&&(s--,r=n)}}this._selectItem(s,r,!0)}_handleKey(e){let t=e.target;if(!(this.m_editor&&this.m_editor.dom.contains(t)))switch(e.key){case"ArrowDown":case"Down":{this._moveSel(1,0);break}case"ArrowUp":case"Up":{this._moveSel(-1,0);break}case"PageUp":{this._moveSel(-2,0);break}case"PageDown":{this._moveSel(2,0);break}case"ArrowLeft":case"Left":{this._moveSel(0,-1);break}case"ArrowRight":case"Right":{this._moveSel(0,1);break}case"Home":{e.ctrlKey?this._moveSel(-3,0):this._moveSel(0,-2);break}case"End":{e.ctrlKey?this._moveSel(3,0):this._moveSel(0,2);break}case"Enter":{this.editCurCell(),e.stopPropagation(),e.preventDefault();break}case"Delete":{this.clearCell(this.m_selection.row,this.m_selection.col);break}default:break}}_keyPress(e){let t=e.target;this.m_editor&&this.m_editor.dom.contains(t)||e.ctrlKey||e.altKey||this.editCurCell(e.key)}getSelection(){return this.m_selection}select(e,t,i=!0){if(this.m_selection.row==e&&this.m_selection.col==t)return;let s=this._findItem(this.m_selection.row,this.m_selection.col);s&&s.removeClass("@selected"),this.m_selection={row:e,col:t},i&&this._scrollIntoView(e,t);let r=this._findItem(e,t);r&&r.addClass("@selected"),this.emit("selectionChange",hs({row:e,col:t}))}rowCount(){return this.m_row_limit}getMaxRowCount(){let e=0;return this.m_cells_data.forEach((t,i)=>{let s=Math.round(i/1e3)+1;e<s&&(e=s)}),e}getColCount(){return this.m_columns.length}setRowStyle(e,t){this.m_rows_data.set(e,t),this.m_lockupdate==0&&this._buildItems()}getRowStyle(e){return this.m_rows_data.get(e)}setCellStyle(e,t,i){let s=this._getCellData(e,t,!0);if(s||(s={text:""},this.m_cells_data.set(Ti(e,t),s)),s.cls=i,this.m_lockupdate==0&&this.m_visible_cells){let r=this._findItem(e,t);r?r.setClass(i,!0):this._buildItems()}}getCellText(e,t){return this._getCellData(e,t).text}getCellNumber(e,t){let i=this._getCellData(e,t).text;return hp(i)}clearRow(e){for(let t=0;t<this.m_columns.length;t++)this.clearCell(e,t);this.update(10)}clearCell(e,t){this.setCellText(e,t,null)}editCurCell(e){this.editCell(this.m_selection.row,this.m_selection.col,e)}editCell(e,t,i){if(!this.m_autoedit||this.m_columns[t].createEditor===null)return;this._scrollIntoView(e,t);let r=this._findItem(e,t).dom,n=r.parentElement,l=r.getBoundingClientRect(),o=n.getBoundingClientRect(),a=this._getCellData(e,t,!0),c=m((_,p,v)=>new Si(_),"edtBuilder");this.m_columns[t].createEditor&&(c=this.m_columns[t].createEditor);let u=i||(a?a.text:"");this.m_editor=c({cls:"@editor",style:{left:l.left-o.left,top:l.top-o.top,width:l.width-1,height:l.height-1},tabIndex:!1,value:u,data:{row:e,col:t}},e,t),this.m_editor&&(n.appendChild(this.m_editor._build()),this._setupEditor(),this.m_editor.setData("old-value",u),this.m_editor.focus(),this.m_editor instanceof Si&&this.m_editor.selectAll())}_setupEditor(){let e=m((t,i)=>{up(()=>{this.killEditor(!0),this._moveSel(t,i),this.editCurCell()})},"movesel");if(this.m_editor instanceof Si){let i=this.m_editor.input;i.setDomEvent("blur",()=>{this.killEditor(!0)}),i.setDomEvent("keydown",s=>{if(!s.defaultPrevented)switch(s.key){case"Escape":{this.killEditor(!1),s.stopPropagation(),s.preventDefault();break}case"Enter":case"Tab":{let r=3;s.shiftKey&&(r=-3),e(0,r),s.stopPropagation(),s.preventDefault();break}case"ArrowUp":case"Up":{e(-1,0),s.stopPropagation(),s.preventDefault();break}case"ArrowDown":case"Down":{e(1,0),s.stopPropagation(),s.preventDefault();break}}})}else if(this.m_editor instanceof od){let t=this.m_editor.input;t.setDomEvent("blur",()=>{this.killEditor(!0)}),t.setDomEvent("keydown",i=>{switch(i.key){case"Escape":{this.killEditor(!1),i.stopPropagation(),i.preventDefault();break}case"Enter":case"Tab":{let s=3;i.shiftKey&&(s=-3),e(0,s),i.stopPropagation(),i.preventDefault();break}}}),this.m_editor.showPopup(),this.m_editor.on("change",i=>{this.killEditor(!0)}),this.m_editor.on("cancel",i=>{this.killEditor(!1)})}}killEditor(e){if(this.m_editor){if(e){let i,s;this.m_editor instanceof Si?i=this.m_editor.value:this.m_editor instanceof od&&(s=this.m_editor.value,i=this.m_editor.valueText);let r=this.m_editor.getData("row"),n=this.m_editor.getData("col"),l=this.m_editor.getData("old-value");this.setCellText(r,n,i);let o=Xe(i,{row:r,col:n,oldValue:l,id:s});this.emit("change",o),o.defaultPrevented&&this.setCellText(r,n,l)}let t=this.m_editor;Xr(()=>{t.dispose()}),this.m_editor=null,this.focus()}}clearData(){this.m_cells_data=new Map,this.m_rows_data=new Map}setCellText(e,t,i){if(i==null||i.length==0)this.m_cells_data.delete(Ti(e,t)),i="";else{let s=this._getCellData(e,t,!0);s||(s={}),s.text=i,this.m_cells_data.set(Ti(e,t),s)}if(this.m_lockupdate==0&&this.m_visible_cells){let s=this._findItem(e,t);s?(this.m_columns[t].renderer&&(i=this.m_columns[t].renderer(i,{row:e,col:t})),s.setContent(i)):this._buildItems()}}lockUpdate(e){e?this.m_lockupdate++:--this.m_lockupdate==0&&this._updateScroll(!0)}},"Spreadsheet4");m(lv,"Spreadsheet");function Ti(e,t){return e*1e3+t}h(Ti,"_mkid8");m(Ti,"_mkid");function Ul(e){return{row:Math.floor(e/1e3)|0,col:e%1e3|0}}h(Ul,"_getid4");m(Ul,"_getid");var B1=h(class extends M{m_fields;m_record;m_sheet;m_label_w;constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){this.m_record=e.record,this.m_fields=e.fields??[],this.m_label_w=e.labelWidth,this.m_sheet=new lv({cls:"@fit",columns:[{title:ne.global.property,width:this.m_label_w>0?this.m_label_w:-1,cls:"property"},{title:ne.global.value,width:-1,createEditor:(...t)=>this._editCell(...t),renderer:(...t)=>this._renderCell(...t)}],autoedit:!0,change:t=>this._cellChange(t)}),this._updateProperties(),this.setContent(this.m_sheet)}setFields(e){e?(this.m_fields=e,this._updateProperties()):this.m_sheet.clearData()}setRecord(e){this.m_record=e,this._updateProperties()}_updateProperties(){this.m_sheet.lockUpdate(!0),this.m_sheet.clearData(),this.m_fields.forEach((e,t)=>{this.m_sheet.setCellText(t,0,e.title),this.m_record?this.m_sheet.setCellText(t,1,this.m_record.getField(e.id)):this.m_sheet.setCellText(t,1,e.value)}),this.m_sheet.lockUpdate(!1)}_cellChange(e){let t=e.context,i=e.value;if(t.col!=1)return;let s=this.m_fields[t.row];switch(s.type){default:case"string":break;case"number":break;case"password":break;case"boolean":break;case"choice":break}this.m_record?this.m_record.setField(s.id,i):s.value=i,this.emit("change",Xe(i,s))}_renderCell(e,t){switch(this.m_fields[t.row].type){default:case"string":break;case"number":break;case"password":{e="\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF";break}case"boolean":break;case"choice":break}return e}_editCell(e,t,i){let s=this.m_fields[t],r;switch(s.type){default:case"string":{r=new Si(e);break}case"number":{r=new Si(e);break}case"password":{e.type="password",e.value=this.m_record.getField(s.id),r=new ss(e);break}case"boolean":{r=new Mh(e);break}case"choice":break}return r}_choicesFromArray(e){return e.map(i=>typeof i=="object"?{id:i.id,text:i.value}:{id:i,text:""+i})}_choicesFromStore(e,t){let i=[];for(let s=0,r=e.count;s<r;s++){let n=e.getByIndex(s);i.push({id:n.getID(),text:n.getField(t)})}return i}},"PropertyEditor4");m(B1,"PropertyEditor");var ov=h(class extends M{m_ui_input;constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){let t=e.text??"",i=e.name??e.group,s=e.labelWidth??-1,r=e.checked??!1,n=e.align??"left",l=e.value,o=e.icon;this.setTag("label"),this.addClass("@hlayout"),this.addClass(n),this._setTabIndex(e.tabIndex),r&&this.addClass("checked"),this.setContent([this.m_ui_input=new ss({type:"radio",name:i,tabIndex:e.tabIndex,value:l,attrs:{checked:r?"":void 0},dom_events:{change:()=>this._change(),focus:()=>this.m_ui_input.focus()}}),new Ue({ref:"label",icon:o,text:t,width:s==="flex"?void 0:s,flex:s==="flex"?1:void 0,style:{order:n=="right"?-1:void 0}})])}_change(){let t=".x-input[name="+this.m_props.name+"]";V.querySelectorAll(t).forEach(r=>{M.getElement(r,ov).removeClass("checked")});let s=this.m_ui_input.dom;this.setClass("checked",s.checked),this.emit("change",Xe(!0))}get check(){return this.m_ui_input?this.m_ui_input.dom.checked:this.m_props.checked}set check(e){let t=this.m_ui_input.dom;e?(t&&(t.checked=!0),this.m_props.checked=!0):(t&&(t.checked=!1),this.m_props.checked=!1)}get text(){return this.itemWithRef("label").text}set text(e){this.itemWithRef("label").text=e}},"RadioBtn4");m(ov,"RadioBtn");var H1=h(class extends ue{m_els;m_input;constructor(e){super(e),e.steps=e.steps??5}render(e){let t=e.shape??"star",i=e.value??0;this.m_input=new ss({cls:"@hidden",name:e.name,value:""+i}),this.addClass(t),this.setDomEvent("click",s=>this._onclick(s)),this.m_els=[];for(let s=0;s<e.steps;s++){let r="item";s+1<=i&&(r+=" checked");let n=new M({tag:"option",cls:r,data:{value:s+1}});this.m_els.push(n)}this.m_els.push(this.m_input),this.setContent(this.m_els)}getValue(){return this.m_props.value??0}set value(e){this.m_props.value=e;for(let t=0;t<this.m_props.steps;t++)this.m_els[t].setClass("checked",this.m_els[t].getData("value")<=e);this.m_input.value=""+this.m_props.value}set steps(e){this.m_props.steps=e,this.update()}set shape(e){this.removeClass(this.m_props.shape),this.m_props.shape=e,this.addClass(this.m_props.shape)}_onclick(e){let t=!0;for(let i=this.dom.firstChild;i;i=i.nextSibling){let s=M.getElement(i);s.setClass("checked",t),i==e.target&&(this.m_input.value=s.getData("value"),t=!1)}this.emit("change",Xe(this.m_props.value))}},"Rating4");m(H1,"Rating");function av(e,t=!1){if(e instanceof RegExp)return{keys:null,pattern:e};let i=e.split("/"),s=[],r="";i[0]==""&&i.shift();for(let n of i){let l=n[0];if(l==="*")s.push("wild"),r+="/(.*)";else if(l===":"){let o=n.indexOf("?",1),a=n.indexOf(".",1);s.push(n.substring(1,o>=0?o:a>=0?a:n.length)),r+=o>=0&&a<0?"(?:/([^/]+?))?":"/([^/]+?)",a>=0&&(r+=(o>=0?"?":"")+"\\"+n.substring(a))}else r+="/"+n}return{keys:s,pattern:new RegExp(`^${r}${t?"(?=$|/)":"/?$"}`,"i")}}h(av,"parseRoute4");m(av,"parseRoute");var mf=h(class extends po{m_routes;m_useHash;constructor(e=!0){super(),this.m_routes=[],this.m_useHash=e,window.addEventListener("popstate",t=>{let i=this._getLocation(),s=this._find(i);s.handlers.forEach(r=>{r(s.params,i)})})}get(e,t){let{keys:i,pattern:s}=av(e);this.m_routes.push({keys:i,pattern:s,handler:t})}init(){this.navigate(this._getLocation())}_getLocation(){return this.m_useHash?"/"+V.location.hash.substring(1):V.location.pathname}navigate(e,t=!0){e.startsWith("/")||(e="/"+e);let i=this._find(e);if(!i||i.handlers.length==0){console.log("route not found: "+e),this.signal("error",np(404,"route not found"));return}if(this.m_useHash){for(;e.startsWith("/");)e=e.substring(1);window.history.pushState({},"","#"+e)}else window.history.pushState({},"",e);t&&i.handlers.forEach(s=>{s(i.params,e)})}_find(e){let t=[],i={},s=[];for(let r of this.m_routes)if(r.keys)if(r.keys.length>0){if(t=r.pattern.exec(e),t===null)continue;for(let n=0;n<r.keys.length;)i[r.keys[n]]=t[++n];s=[...s,r.handler]}else r.pattern.test(e)&&(s=[...s,r.handler]);else{if(t=r.pattern.exec(e),!t)continue;if(t.groups)for(let n in t.groups)i[n]=t.groups[n];s=[...s,r.handler]}return{params:i,handlers:s}}},"Router4");m(mf,"Router");var O1=h(class extends rf{m_sidebar;m_content;constructor(e){super(e),this.addClass("@hlayout"),this.m_sidebar=new It({cls:"@side-bar",width:e.bar_width??void 0}),this.m_content=new ue({flex:1,cls:"@tab-container"})}render(){let e=[];this.m_cards.forEach(t=>{e.push(t.selector)}),this.m_sidebar.setContent(new It({flex:1,cls:"content",content:e})),this.setContent([this.m_sidebar,this.m_props.bar_sizable?new pp({orientation:"horizontal",sizing:"before"}):void 0,this.m_content])}_prepareSelector(e){return new yt({text:e.title,icon:e.icon,tooltip:e.title,click:()=>{this.switchTo(e.name)}})}_preparePage(e){super._preparePage(e),e.dom||this.m_content.appendChild(e)}},"SideBarView4");m(O1,"SideBarView");var W1=/^-?\d+(\.\d+)?$/;function hv(e){return e*Math.PI/180}h(hv,"d2r4");m(hv,"d2r");function cd(e,t,i,s){let r=hv(s);return{x:e+i*Math.cos(r),y:t+i*Math.sin(r)}}h(cd,"p2c4");m(cd,"p2c");function Pt(e){return Math.round(e*1e3)/1e3}h(Pt,"num4");m(Pt,"num");function th(e,...t){return t=t.map(i=>typeof i=="number"&&isFinite(i)?Pt(i):i),String.raw(e,...t)}h(th,"clean4");m(th,"clean");var xl=h(class{m_tag;m_attrs;m_style;constructor(e){this.m_tag=e,this.m_attrs=new Map,this.m_style=new Map}render(){return`<${this.m_tag} ${this.renderAttrs()} ${this.renderStyle()}>${this.renderContent()}</${this.m_tag}>`}stroke(e,t){return this.attr("stroke",e),t!==void 0&&this.attr("stroke-width",t+"px"),this}strokeWidth(e){return this.attr("stroke-width",e+"px"),this}fill(e){return this.attr("fill",e),this}attr(e,t){return this.m_attrs.set(e,t),this}style(e,t){if(t===void 0||t===""||t===void 0){this.m_style.delete(e);return}return!fp[e]&&(nh(t)||W1.test(t))&&(t=t+"px"),this.m_style.set(e,""+t),this}class(e){let t=this.m_attrs.get("class");return this.m_attrs.set("class",(t??" "+e).trim()),this}renderAttrs(){if(!this.m_attrs.size)return"";let e="";return this.m_attrs.forEach((t,i)=>{e+=` ${i} = "${t}"`}),e}renderStyle(){if(!this.m_style.size)return"";let e='style="';return this.m_style.forEach((t,i)=>{e+=`${i}:${t};`}),e+'"'}renderContent(){return""}clip(e){return this.attr("clip-path",`url(#${e})`),this}transform(e){this.attr("transform",e)}rotate(e,t,i){this.transform(`rotate( ${e} ${t} ${i} )`)}translate(e,t){this.transform(`translate( ${e} ${t} )`)}scale(e){this.transform(`scale( ${e} )`)}},"SVGItem4");m(xl,"SVGItem");var mv=h(class extends xl{m_path;constructor(){super("path"),this.m_path=""}renderAttrs(){return this.attr("d",this.m_path),super.renderAttrs()}moveTo(e,t){return this.m_path+=th`M${e},${t}`,this}lineTo(e,t){return this.m_path+=th`L${e},${t}`,this}closePath(){return this.m_path+="Z",this}arc(e,t,i,s,r){let n=cd(e,t,i,s-90),l=cd(e,t,i,r-90),o=r-s<=180?"0":"1";return this.m_path+=th`M${n.x},${n.y}A${i},${i} 0 ${o} 1 ${l.x},${l.y}`,this}},"SVGPath4");m(mv,"SVGPath");var cv=h(class extends xl{m_text;constructor(e,t,i){super("text"),this.m_text=i,this.attr("x",Pt(e)+""),this.attr("y",Pt(t)+"")}font(e){return this.attr("font-family",e),this}fontSize(e){return this.attr("font-size",e+""),this}fontWeight(e){return this.attr("font-weight",e),this}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.attr("text-anchor",t),this}verticalAlign(e){let t;switch(e){case"top":t="hanging";break;case"center":t="middle";break;case"bottom":t="baseline";break;default:return}return this.attr("alignment-baseline",t),this}renderContent(){return this.m_text}},"SVGText4");m(cv,"SVGText");var ud=h(class extends xl{constructor(e){super(e)}},"SVGShape4");m(ud,"SVGShape");var dd=h(class extends xl{m_id;m_stops;constructor(e,t,i,s){super("linearGradient"),this.m_id="gx-"+dd.g_id,this.attr("id",this.m_id),this.attr("x1",We(e)?e:Pt(e)+""),this.attr("x2",We(i)?i:Pt(i)+""),this.attr("y1",We(t)?t:Pt(t)+""),this.attr("y2",We(s)?s:Pt(s)+""),this.m_stops=[],dd.g_id++}get id(){return"url(#"+this.m_id+")"}addStop(e,t){return this.m_stops.push({offset:e,color:t}),this}renderContent(){let e=[];return this.m_stops.forEach(t=>{e.push(`<stop offset="${t.offset}%" stop-color="${t.color}"></stop>`)}),e.join(`
|
|
33
|
+
`)}},"_SVGGradient4"),cf=dd;m(cf,"SVGGradient");de(cf,"g_id",1);var _d=h(class extends xl{m_items;constructor(e="g"){super(e),this.m_items=[]}path(){let e=new mv;return this.m_items.push(e),e}text(e,t,i){let s=new cv(e,t,i);return this.m_items.push(s),s}ellipse(e,t,i,s=i){let r=new ud("ellipse");return r.attr("cx",Pt(e)+""),r.attr("cy",Pt(t)+""),r.attr("rx",Pt(i)+""),r.attr("ry",Pt(s)+""),this.m_items.push(r),r}rect(e,t,i,s){let r=new ud("rect");return r.attr("x",Pt(e)+""),r.attr("y",Pt(t)+""),r.attr("width",Pt(i)+""),r.attr("height",Pt(s)+""),this.m_items.push(r),r}linear_gradient(e,t,i,s){let r=new cf(e,t,i,s);return this.m_items.push(r),r}clear(){this.m_items=[]}renderContent(){let e=[];return this.m_items.forEach(t=>{e.push(t.render())}),e.join(`
|
|
34
|
+
`)}},"SVGGroup4");m(_d,"SVGGroup");var uv=h(class extends _d{constructor(){super("")}addClip(e,t,i,s){let r="c-"+uv.g_clip_id++,n=new _d("clipPath");return n.attr("id",r),n.rect(e,t,i,s),this.m_items.push(n),r}render(){let e=[];return this.m_items.forEach(t=>{e.push(t.render())}),e.join(`
|
|
35
|
+
`)}},"_SVGPathBuilder4"),dv=uv;m(dv,"SVGPathBuilder");de(dv,"g_clip_id",1);var j1=h(class extends M{constructor(e){super(e),this.setTag("svg","http://www.w3.org/2000/svg"),this.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.setAttributes({viewBox:e.viewBox}),this.setContent(e.path)}},"SVGComponent4");m(j1,"SVGComponent");var G1=h(class extends Ft{m_pages;m_curPage;constructor(e){super(e),this.m_pages=[],this.m_curPage=null,this.mapPropEvents(e,"change"),e.vertical?this.addClass("@vlayout"):this.addClass("@hlayout"),this.m_props.pages?.forEach(t=>this.addPage(t))}componentCreated(){this.m_props.default&&this.select(this.m_props.default,!0)}addPage(e){this.m_pages.push({...e}),this._updateContent()}render(){let e=[];this.m_pages.forEach(t=>{t.btn=new yt({cls:t===this.m_curPage?"selected":"",text:t.title,icon:t.icon,click:()=>this._select(t,!0)}),e.push(t.btn)}),this.setContent(e)}select(e,t=!1){if(e){let i=this.m_pages.find(s=>s.id===e);return i?(this._select(i,t),!0):!1}else return this._select(null,t),!0}_select(e,t){if(this.m_curPage!=e){if(!this.dom){this.m_props.default=e.id;return}this.m_curPage&&(this.m_curPage.btn.removeClass("selected"),this.m_curPage.page&&this.m_curPage.page.hide()),this.m_curPage=e,t&&this.signal("change",Xe(e?e.id:null)),this.m_curPage&&(this.m_curPage.btn.addClass("selected"),this.m_curPage.page&&this.m_curPage.page.show())}}get selection(){return this.m_curPage?.page}},"TabBar4");m(G1,"TabBar");var N1=h(class extends rf{m_tab_selector;m_menu;constructor(e){super(e),this.m_tab_selector=!!e.tab_selector,this.m_menu=e.menu,this.addClass("@vlayout")}render(){let e=[],t=[];this.m_menu&&(this.m_menu.addClass("@button @tab-btn"),this.m_menu.removeClass("@menu-item"),e.push(this.m_menu)),this.m_cards.forEach(i=>{e.push(i.selector),i.page instanceof Function||t.push(i.page)}),this.m_tab_selector&&t.unshift(new ue({cls:"@tab-switch",content:e})),this.setContent(t)}_updateSelector(){}_prepareSelector(e){return new yt({cls:"@tab-btn",text:e.title,icon:e.icon,click:()=>{this.switchTo(e.name)}})}_preparePage(e){super._preparePage(e),e.dom||this.appendChild(e)}},"TabView4");m(N1,"TabView");var U1=h(class extends M{constructor(e){super(e),this.mapPropEvents(e,"change")}render(e){e.text=e.text??"",this.setAttribute("tabindex",e.tabIndex??0),e.spellcheck===!1&&this.setAttribute("spellcheck","false"),e.readOnly!==void 0&&this.setAttribute("readonly",e.readOnly),e.rows&&this.setAttribute("rows",e.rows),e.placeHolder&&this.setAttribute("placeholder",e.placeHolder),e.autoFocus&&this.setAttribute("autofocus",e.autoFocus),e.name&&this.setAttribute("name",e.name),e.autoGrow&&(this.m_props.autoGrow=!0,this.setAttribute("rows",this._calcHeight(e.text)),this.setDomEvent("keydown",()=>{Xr(()=>this._updateHeight())})),this.setDomEvent("keydown",t=>{t.stopPropagation()}),this.setTag("textarea"),this.setDomEvent("input",()=>this._change())}_change(){this.emit("change",Xe(this.value))}componentCreated(){this.value=this.m_props.text}get value(){return this.dom?this.dom.value:this.m_props.text}set value(e){this.m_props.text=e??"",this.dom&&(this.dom.value=this.m_props.text,this.m_props.autoGrow&&this.setAttribute("rows",this._calcHeight(this.m_props.text)))}get text(){return this.value}set text(e){this.value=e}_calcHeight(e){return 1+(e.match(/\n/g)||[]).length}_updateHeight(){let e=this.value,t=this._calcHeight(e);this.getData("lines")!=t&&(this.setAttribute("rows",t),this.setData("lines",t))}insertText(e){this.appendText(e)}appendText(e){if(this.dom){let t=this.dom,i=t.selectionEnd;t.setRangeText(e,i,i,"end")}}replaceText(e){this.dom&&this.dom.setRangeText(e)}getSelection(){if(this.dom){let e=this.dom;return{start:e.selectionStart,end:e.selectionEnd}}else return{start:0,end:0}}setSelection(e){if(this.dom){let t=this.dom;e.start!==void 0&&(t.selectionStart=e.start),e.end!==void 0&&(t.selectionEnd=e.end)}}getStoreValue(){return this.value}setStoreValue(e){this.value=e}},"TextArea4");m(U1,"TextArea");var $1=h(class extends vs{m_message;m_icon;constructor(e){super(e),this.m_message=e.message,this.m_icon=e.icon,this.enableMask(!1),this.addClass("@non-maskable")}render(){this.addClass("@hlayout"),this.setContent([new Ue({icon:this.m_icon,text:this.m_message})])}show(){this.show=super.show,this.displayAt(9999,9999,"br",{x:0,y:-24});let e=1;this.startTimer("fadeout",2e3,!1,()=>{this.startTimer("opacity",100,!0,()=>{this.setStyleValue("opacity",e),e-=.1,e<0&&this.dispose()})})}},"Toaster4");m($1,"Toaster");function _v(e){return ze({node:e})}h(_v,"EvExpand4");m(_v,"EvExpand");var q1=h(class extends It{m_view;m_container;m_selection;constructor(e){super(e),e.root=e.root,e.indent=e.indent??8,e.gadgets=e.gadgets,e.sort=e.sort??!1,this.m_selection=null,this.m_container=new Ft({cls:"@scroll-container"}),this.m_view=new Ft({cls:"@scroll-view",flex:1,content:this.m_container}),this.setContent([this.m_view,e.gadgets?new ue({cls:"gadgets",content:e.gadgets}):null]),this.setDomEvent("click",t=>this._click(t)),this.setDomEvent("dblclick",t=>this._click(t)),this.setDomEvent("contextmenu",t=>this._handleCtxMenu(t)),e.canDragItems&&(this.setDomEvent("dragstart",t=>{let s=M.getElement(t.target,M)?.getData("node");s?(t.dataTransfer.effectAllowed="move",t.dataTransfer.items.add(JSON.stringify({type:"treeview",id:s.id}),"string")):(t.preventDefault(),t.stopPropagation())}),this.setDomEvent("dragover",t=>this._dragEnter(t)),this.setDomEvent("dragenter",t=>this._dragEnter(t)),this.setDomEvent("dragend",t=>this._dragLeave(t)),this.setDomEvent("dragleave",t=>this._dragLeave(t)),this.setDomEvent("drop",t=>this._dragLeave(t)),this.setDomEvent("drop",t=>this._drop(t))),this.mapPropEvents(e,"dblclick","drag","selectionchange","contextMenu")}_dragEnter(e){e.preventDefault();let t=M.getElement(e.target,M);t?.getData("node")&&(t.addClass("@drag-over"),e.dataTransfer.dropEffect="move")}_dragLeave(e){let t=M.getElement(e.target,M);t?.getData("node")&&t.removeClass("@drag-over")}_drop(e){let t=M.getElement(e.target,M),i=t?.getData("node");if(i||(i=this.m_props.root),i){let s;i.children?s=i:s=t.getData("parent");for(let r=0;r<e.dataTransfer.items.length;r++)e.dataTransfer.items[0].getAsString(n=>{let l=JSON.parse(n);this.emit("drag",rp(i,l,s))})}}render(){this.__update()}__update(){if(this.m_props.root){let e=[];this._buildBranch(this.m_props.root,-1,e,this.m_props.root),this.m_container.setContent(e)}}updateElement(e){let{node:t,item:i}=this._getNode(e);if(t){let s=t.dom.parentNode,r=this._makeNode(i,t.dom.classList.value,t.getData("icon"),t.getData("level")),n=r._build();s.replaceChild(n,t.dom),this.m_selection?.el===t&&(this.m_selection.el=r)}}set root(e){this.m_props.root=e,this.update()}openAll(e=!0){this.forEach(t=>{t.children&&(t.open=e)}),this.__update()}refreshRoot(e){let t=[];this.forEach(s=>(s.open&&t.push(s.id),!1));let i=this.selection;e&&(this.m_props.root=e),this.forEach(s=>(t.indexOf(s.id)>=0&&(s.open=!0),!1)),this.__update()}_buildBranch(e,t,i,s){let r="@tree-item";e.cls&&(r+=" "+e.cls),!e.open&&e.children&&(r+=" collapsed"),e.children&&(r+=" folder",e.children.length==0&&(r+=" empty"));let n=e.icon;if(n===void 0&&e.children&&(e.open===!0?n="var(--x4-icon-chevron-down)":n="var(--x4-icon-chevron-right)"),t>=0){let l=this._makeNode(e,r,n,t);this.m_selection?.id==e.id&&(this.m_selection.el=l,l.addClass("selected")),i.push(l)}(t==-1||e.open)&&e.children&&(this.m_props.sort&&(e.children=e.children.sort((l,o)=>{let a=(l.children?"0"+l.text:l.text)?.toLocaleLowerCase(),c=(o.children?"0"+o.text:o.text)?.toLocaleLowerCase();return a<c?-1:a>c?1:0})),e.children.forEach(l=>{this._buildBranch(l,t+1,i,e)}))}_renderDef(e){return new Ue({cls:"tree-label",flex:1,text:e.text})}_makeNode(e,t,i,s){return new ue({cls:t,content:[new lt({cls:"tree-icon",icon:i}),this.m_props.renderItem?this.m_props.renderItem(e):this._renderDef(e)],data:{node:e,level:s,icon:i},style:{paddingLeft:4+s*this.m_props.indent},attrs:{draggable:this.m_props.canDragItems?!0:void 0}})}forEach(e){let t=null;function i(s){if(e(s)==!0)return!0;if(s.children){for(let r=0;r<s.children.length;r++)if(i(s.children[r]))return!0}}return h(i,"scan"),m(i,"scan"),this.m_props.root&&i(this.m_props.root),t}ensureVisible(e){let{node:t}=this._getNode(e);t&&t.scrollIntoView()}set selection(e){this.select(e,!1)}select(e,t=!0){if(this.m_selection?.el&&this.m_selection.el.removeClass("selected"),this.m_selection=null,e!==void 0){let{node:i}=this._getNode(e);if(i&&(this.m_selection={id:e,el:i},i.addClass("selected"),i.scrollIntoView(),t)){let s=i.getData("node");this.emit("selectionchange",hs(s))}}else t&&this.emit("selectionchange",hs(null))}_getNode(e){let t={node:null,item:null};return this.m_container.enumChilds(i=>{let s=i.getData("node");if(s?.id==e)return t={node:i,item:s},!0}),t}get selection(){return this.m_selection?.id}getNodeWithId(e){return this.forEach(t=>t.id==e)}_click(e){let t=e.target,i=t,s=!1;for(t.tabIndex!==-1&&(s=!0);t!=this.dom;){let r=M.getElement(t),n=r?.getData("node");if(n){if(n.children&&!s){(r.hasClass("selected")||i.classList.contains("tree-icon"))&&(n.open=!n.open),this.m_selection={id:n.id,el:null};let l=this.m_view?.dom?.scrollTop;this.update(),l&&this.m_view.dom.scrollTo(0,l),this.emit("expand",_v(n))}else this.selection=n.id,s||(e.type=="click"?this.emit("click",lr(n)):this.emit("dblclick",vo(n)));this.emit("selectionchange",hs(n));return}t=t.parentElement}e.type=="click"&&(this.m_selection=null,this.update(),this.emit("selectionchange",hs(null)))}_handleCtxMenu(e){e.preventDefault();let t=e.target,i=t;for(;t!=this.dom;){let r=M.getElement(t)?.getData("node");if(r){if(r.children&&i.classList.contains("tree-icon"))return;this.selection=r.id,this.emit("click",lr(r)),this.emit("contextMenu",Hr(e,r));return}t=t.parentElement}this.selection=null,this.emit("contextMenu",Hr(e,null))}static buildFromStrings(e,t="/"){let i={id:0,text:"<root>",children:[]};function s(r,n){let l=n.indexOf(t),o=n.substr(0,l<0?void 0:l),a;l>=0&&(a=r.find(c=>c.text==o)),a||(a={id:n,text:o},r.push(a)),l>=0&&(a.children||(a.children=[]),s(a.children,n.substr(l+t.length)))}return h(s,"insert"),m(s,"insert"),e.forEach(r=>{s(i.children,r)}),i}static buildFromHierarchy(e,t){let i={id:0,text:"<root>",children:[]},s=[];function r(n){let l,o;n.parent>0?(o=s.find(a=>a.id==n.parent),o||(o={id:n.parent,text:"",children:[]},s.push(o)),o.children||(o.children=[])):o=i,l=s.find(a=>a.id==n.id),l?(l.text=n.name,l.parent=n.parent):(l={id:n.id,text:n.name,parent:n.parent,cls:n.cls,icon:n.icon,data:n.data},n.leaf?l.icon=null:l.children=[]),s.push(l),o.children.push(l)}return h(r,"insert"),m(r,"insert"),e.forEach(r),t&&s.forEach(t),i}},"TreeView4");m(q1,"TreeView");var MC=Symbol("fragment");var K1=h(class extends M{render(e){let t=this.renderTSX(e);t&&this.setContent(t)}},"TSXComponent4");m(K1,"TSXComponent");var Qf=Symbol("msg_sent");function Y1(e){let t=window.location.protocol==="https:"?"wss://":"ws://",i=new WebSocket(`${t}${window.location.hostname}:${window.location.port}`,"messaging"),s=_o.instance();s.on("global",r=>{r[Qf]||i.send(JSON.stringify({msg:r.msg,params:r.params}))}),i.onmessage=r=>{if(r.data!="ping"){let n=JSON.parse(r.data);n[Qf]=!0,s.signal("global",n)}},i.onclose=r=>{console.log("websocket closed:",r),e()},i.onerror=r=>{console.log("websocket error:",r)}}h(Y1,"setupWSMessaging4");m(Y1,"setupWSMessaging");var X6=Symbol(),ca=class extends ii{static instance(){return ca.self}m_mainView;m_app_name;m_app_version;m_app_uid;m_local_storage;m_user_data;m_touch_time;m_touch_count;m_router;constructor(t){console.assert(ca.self===null,"application is a singleton"),super(t),this.m_app_name=t.app_name??"application",this.m_app_version=t.app_version??"1.0",this.m_app_uid=t.app_uid??"application";let i=`${this.m_app_name}.${this.m_app_version}.settings`;this.m_local_storage=new fn(i),this.m_user_data={},this.m_touch_time=0,this.m_touch_count=0,this.m_router=null,fv=ca.self=this,"onload"in globalThis?globalThis.addEventListener("load",()=>{this.ApplicationCreated()}):this.ApplicationCreated()}ApplicationCreated(){this.setTitle("")}get router(){return this.m_router||(this.m_router=new mf),this.m_router}get app_name(){return this.m_app_name}get app_uid(){return this.m_app_uid}get app_version(){return this.m_app_version}get local_storage(){return this.m_local_storage}get user_data(){return this.m_user_data}get history(){debugger;return null}setMainView(t,i){let s=this.m_props.renderTo??L.body,r=ut(s);this.m_props.renderTo||r.setStyleValue("position","absolute"),r.addClass("x4-root-element"),i&&r._empty(),this.m_mainView=t,t.setStyleValue("position","absolute"),t._build(),s.appendChild(t.dom)}set mainView(t){this.setMainView(t,!1)}get mainView(){return this.m_mainView}setTitle(t){L.title=this.m_app_name+(t?" > "+t:"")}disableZoomWheel(){window.addEventListener("wheel",function(t){t.ctrlKey&&t.preventDefault()},{passive:!1,capture:!0})}enterModal(t){}enableTouchDblClick(){L.addEventListener("touchstart",t=>{let i=Date.now();if(i-this.m_touch_time>700?this.m_touch_count=1:this.m_touch_count++,this.m_touch_time=i,this.m_touch_count==2){this.m_touch_count=0;let s=t.touches[0],r={type:"dblclick"};for(let n in s)r[n]=s[n];I._dispatchEvent(r),t.stopPropagation()}})}},ys=ca;h(ys,"Application"),X(ys,"self",null);var fv;var uc=class extends Ae{};h(uc,"AbsLayout");var q=class extends Ae{};h(q,"HLayout");var we=class extends Ae{};h(we,"VLayout");var dc=class extends Ae{constructor(t){super(t),this.setDomEvent("sizechange",()=>this._updateLayout())}componentCreated(){super.componentCreated(),this._updateLayout()}_updateLayout(){let t=this.m_props.defaultLayout=="horizontal";if(this.m_props.switchSize<=0&&window.screen.height>window.screen.width)t=!t;else{let i=this.getBoundingRect();(t&&i.width<this.m_props.switchSize||!t&&i.height<this.m_props.switchSize)&&(t=!t)}t?(this.removeClass("@vlayout"),this.addClass("@hlayout")):(this.addClass("@vlayout"),this.removeClass("@hlayout"))}};h(dc,"AutoLayout");var _c=class extends Ae{constructor(t){super(t)}render(){this.m_props.colSizes&&this.setStyleValue("grid-template-columns",this.m_props.colSizes),this.m_props.rowSizes&&this.setStyleValue("grid-template-rows",this.m_props.rowSizes),this.m_props.colGap&&this.setStyleValue("grid-gap",this.m_props.colGap),this.m_props.template&&this.setStyleValue("grid-template-areas",this.m_props.template.join(`
|
|
36
|
+
`))}};h(_c,"GridLayout");var fc=class extends Ae{m_cells;constructor(t){super(t),this.setTag("table"),this.m_cells=new Map}_getCell(t,i,s=!0){let r=ua(t,i);return this.m_cells.get(r)??(s?{item:void 0}:null)}_setCell(t,i,s,r=!1){let n=ua(t,i);this.m_cells.set(n,s),this.dom&&s.item&&r&&(s.item instanceof I?s.item.update():this.enumChilds(l=>{if(l.getData("row")==t&&l.getData("col")==i)return l.setContent(s.item),l.update(),!0}))}setCell(t,i,s){let r=this._getCell(t,i);r.item=s,this._setCell(t,i,r,!0)}setCellData(t,i,s){let r=this._getCell(t,i);r.data=s,this._setCell(t,i,r,!0)}getCellData(t,i){return this._getCell(t,i,!1)?.data}merge(t,i,s,r){let n=this._getCell(t,i);n.rowSpan=s,n.colSpan=r,this._setCell(t,i,n)}setCellWidth(t,i,s){let r=this._getCell(t,i);r.width=s,this._setCell(t,i,r)}setCellHeight(t,i,s){let r=this._getCell(t,i);r.height=s,this._setCell(t,i,r)}setCellClass(t,i,s){let r=this._getCell(t,i);r.cls=s,this._setCell(t,i,r)}setColClass(t,i){let s=this._getCell(-1,t);s.cls=i,this._setCell(-1,t,s)}setRowClass(t,i){let s=this._getCell(t,999);s.cls=i,this._setCell(t,999,s)}getCell(t,i){return this._getCell(t,i)?.item}render(){let t=[],i=[];for(let s=0;s<this.m_props.rows;s++){let r=[];for(let o=0;o<this.m_props.columns;o++){let a=ua(s,o);if(i.indexOf(a)>=0)continue;let c=this.m_cells.get(a),u=this.m_cells.get(ua(-1,o)),_="";c&&c.cls&&(_=c.cls),u&&u.cls&&(_+=" "+u.cls);let p=new I({tag:"td",content:c?.item,width:c?.width,height:c?.height,data:{row:s,col:o},cls:_});if(c){let v=c.rowSpan??0,g=c.colSpan??0;if(v>0&&p.setAttribute("rowspan",v+1),g>0&&p.setAttribute("colspan",g+1),v||g)for(let x=0;x<=v;x++)for(let E=0;E<=g;E++)i.push(ua(x+s,E+o))}r.push(p)}let n=this._getCell(s,999,!1),l=new I({tag:"tr",data:{row:s},content:r,cls:n?.cls});t.push(l)}this.setContent(t)}};h(fc,"TableLayout");function ua(e,t){return e*1e3+t}h(ua,"_mkid");var pc=class extends I{constructor(t){super(t),this.setContent(t.content)}setContent(t){if(!t)super.setContent(null);else{let i;mt(t)?i=new we({content:t}):i=t,i.addClass("@scroll-container"),super.setContent(i)}}};h(pc,"ScrollView");var gc=class extends Ae{constructor(t){let i=t.items;t.items=void 0,super(t),this.setDomEvent("sizechange",()=>{this.resizeAllItems()}),i&&i.forEach(s=>{this.addItem(s)})}resizeItem(t){let i=this.getComputedStyle(),s=i.parse("grid-auto-rows"),r=i.parse("grid-row-gap"),n=t.queryItem(".content");if(n||(n=t),n&&s+r){let l=n.getBoundingRect(),o=Math.ceil((l.height+r)/(s+r));t.setStyleValue("gridRowEnd","span "+o)}}resizeAllItems(){this.queryAll(".item",t=>{this.resizeItem(t)})}addItem(t){t.addClass("content"),this.appendChild(new Ae({cls:"item",content:t}))}};h(gc,"Masonry");function uf(e){return se({pos:e})}h(uf,"EvMove");var da=class extends Ae{m_ui_mask;m_hasMask=!0;constructor(t){super(t),this.addClass("@hidden")}enableMask(t=!0){this.m_hasMask=t}show(t){if(t!==void 0?this.m_hasMask=!!t:t=this.m_hasMask,this.m_hasMask){let i=L.activeElement;for(i&&i.blur(),this.m_ui_mask=L.body.lastChild;this.m_ui_mask;){if(this.m_ui_mask.nodeType==1){let s=ut(this.m_ui_mask);if(!(s.hasClass("@menu")||s.hasClass("@non-maskable"))){if(!(s.getStyleValue("display")=="none"||!s.isUserVisible())){if(s.hasClass("@comp"))break}}}this.m_ui_mask=this.m_ui_mask.previousSibling}this.m_ui_mask&&ut(this.m_ui_mask).addClass("@mask")}if(t&&ys.instance().enterModal(!0),this.setStyle({left:0,top:0}),L.body.appendChild(this._build()),this.removeClass("@hidden"),this.centerOnScreen(),t){let i=L.activeElement;if(!this.dom.contains(i)){let s=this.queryItem("[autofocus]");if(s)s.focus();else{let r=this.queryAll("[tabindex]");r&&(r=r.filter(n=>n.offsetParent!==null),r.length&&r[0].focus())}}da.modal_stack.push(this.dom)}}centerOnScreen(){let t=this.getBoundingRect(),i=`max( 0px, 50vw - ${t.width/2}px )`,s=`max( 0px, 50vh - ${t.height/2}px )`;this.setStyleValue("left",i),this.setStyleValue("top",s)}displayAt(t,i,s="top left",r,n=!1){this.show(n);let l="l",o="t";s.indexOf("right")>=0&&(l="r"),s.indexOf("bottom")>=0&&(o="b");let a=L.body.getBoundingClientRect(),c=this.getBoundingRect();l=="r"&&(t-=c.width),o=="b"&&(i-=c.height),r&&(t+=r.x,i+=r.y),t<4&&(t=4),t+c.width>a.right-4&&(t=a.right-4-c.width,r?.x<0&&(t+=r.x)),i<4&&(i=4),i+c.height>a.bottom-4&&(i=a.bottom-4-c.height,r?.y<0&&(i+=r.y)),this.setStyle({left:t,top:i})}close(){this.hide(),this.m_hasMask&&this.m_ui_mask&&(ut(this.m_ui_mask).removeClass("@mask"),ys.instance().enterModal(!1));let t=da.modal_stack.indexOf(this.dom);t>=0&&da.modal_stack.splice(t),this.dispose()}componentCreated(){if(this.m_props.sizable){this.addClass("@size-all");let t=["top","right","bottom","left","topleft","topright","bottomleft","bottomright"];for(let i of t)new ls({target:this,sens:i,events:{rawresize:s=>this._mouseResize(s)}})}}_mouseResize(t){t.preventDefault();let i=this.getBoundingRect(),s=this.getComputedStyle(),r=t.ui_event,n=s.parse("marginTop"),l=s.parse("marginLeft"),o=s.parse("marginRight"),a=s.parse("marginBottom"),c=0,u=0,_=Xt(r,!0);switch(t.sens){case"topright":case"bottomright":case"right":c=i.right-o-_.x;break;case"topleft":case"bottomleft":case"left":c=i.left-l-_.x;break}switch(t.sens){case"bottomleft":case"bottomright":case"bottom":u=i.bottom-a-_.y;break;case"topleft":case"topright":case"top":u=i.top-n-_.y;break}i.left-=l,i.top-=n;let p=t.sens;I.setCapture(this,v=>{let g=h((x,E)=>{let y=i.left,k=i.top,A=i.width,S=i.height,w,D,R=x+c,C=E+u;switch(R<0&&(R=0),C<0&&(C=0),p){case"topright":case"bottomright":case"right":A=R-y;break;case"topleft":case"bottomleft":case"left":w=y-R,A+=w,y-=w;break}switch(p){case"bottomleft":case"bottomright":case"bottom":S=C-k;break;case"topleft":case"topright":case"top":D=k-C,S+=D,k-=D;break}let z=new Mi(A,S);this.setStyle({left:y,top:k,width:z.width,height:z.height}),this.emit("size",dt(z))},"__move");if(v.type=="mouseup"||v.type=="touchend")I.releaseCapture();else if(v.type=="mousemove"){let x=v;g(x.pageX,x.pageY)}else if(v.type=="touchmove"){let x=v;g(x.touches[0].pageX,x.touches[0].pageY)}})}},ot=da;h(ot,"Popup"),X(ot,"modal_stack",[]);function X1(e){if(e.key=="Tab"||e.key=="Enter"){let t=e.target;if(t.tagName=="TEXTAREA")return;let i=I.getElement(t);if(i&&(i.hasAttribute("wants-tab")||i.hasAttribute("wants-enter")))return;let s=L.body;ot.modal_stack.length&&(s=ot.modal_stack[ot.modal_stack.length-1]),Z1(s,e.target,e.shiftKey),e.stopPropagation(),e.preventDefault()}}h(X1,"x4handleKeyDown");function Z1(e,t,i){let s=L.activeElement;if(!e.contains(s))return;let r=I.getElement(t),n=Array.from(e.querySelectorAll("[tabindex]"));if(n=n.filter(o=>o.offsetParent!==null),!n.length)return;let l=n.indexOf(t);l<0?l=0:i?l>0?l--:l=n.length-1:l<n.length-1?l++:l=0,n[l].focus()}h(Z1,"_nextTab");function pv(){L.body.addEventListener("keydown",X1,!0)}h(pv,"installKBHandler");L.body?pv():window.addEventListener("load",pv);function J1(e){return se({source:e})}h(J1,"EvAction");var _a=class extends ii{constructor(t){super(t),this.mapPropEvents(t,"run")}get props(){return this.m_props}set text(t){this.m_props.text=t,this.emit("change",ee(this))}set icon(t){this.m_props.icon=t,this.emit("change",ee(this))}fire(){this.emit("run",J1(this))}};h(_a,"Action");function fa(e,t,i=null){return se({url:e,svg:t,context:i})}h(fa,"EvLoaded");function gv(e){let t=e.length;return e[0]=='"'&&e[t-1]=='"'&&(e=e.substring(1,t-1),e=e.replaceAll('\\"',"'")),e}h(gv,"trimQuotes");var vc=class extends _i{svgs;constructor(){super(),this.svgs=new Map}load(t){if(this.svgs.has(t)){let i=this.svgs.get(t);i&&this.signal("loaded",fa(t,i))}else this.svgs.set(t,null),h(async s=>{if(s.substring(0,24)=="data:image/svg+xml;utf8,"){let r=s.substring(24);this.svgs.set(s,r),this.signal("loaded",fa(s,r))}else{let r=await fetch(s);if(r.ok){let n=await r.text();!n.startsWith("<svg")&&!n.startsWith("<?xml")?(console.error("svg loading error: ",n),this.signal("loaded",fa(s,""))):(this.svgs.set(s,n),this.signal("loaded",fa(s,n)))}}},"_load")(t)}};h(vc,"Loader");var df=new vc,wc=class extends I{m_icon;m_iconName;constructor(t){re(t)?super({icon:t}):super(t),this._setIcon(this.m_props.icon,!1),this.m_props.size&&this.setStyleValue("fontSize",this.m_props.size)}_setIcon(t,i){if(!t){this.m_iconName="";return}this.removeClass("@svg");let s,r;if(typeof t=="number")t=t.toString(16),s=t,console.error("deprecation error: invalid icon name");else{let o=/\s*var\s*\(\s*(.+)\s*\)\s*/gi,a=o.exec(t);for(;a;){let k=a[1].trim();if(t=ri.getVar(k).trim(),t==""||t===void 0){console.error(`icon: unable to find variable named '${k}'`);return}else t=gv(t);a=o.exec(t)}if(t.startsWith("<svg")){this._setSVG("data:image/svg+xml;utf8,"+t);return}let c=/\s*svg\s*\(\s*(.+)\s*\)\s*/gi,u=/(.*\.svg)$/gi,_=c.exec(t)||u.exec(t);if(_){let k=_[1].trim();this._setSVG(k);return}let v=/^\s*(data\:image\/.+)\s*$/gi.exec(t);if(v){this._setSVG(v[1]);return}let x=/\s*cls\s*\(\s*(.+)\s*\)\s*/gi.exec(t);if(x){let k=x[1].trim();this.addClass(k);return}let y=/\s*url\s*\(\s*(.+)\s*\)\s*/gi.exec(t);if(y){r=gv(y[1].trim()),r=r.replaceAll("\\",""),this._setSVG(r);return}else console.error("deprecation error: invalid icon name"),s=t,t=ri.getVar("icon-"+t),(t==""||t===void 0)&&(t="0")}if(this.m_iconName=s,this.m_icon===t)return;let n=I.getCss(),l;if(i&&this.m_icon&&(l="icon-"+s,this.removeClass(l)),l="icon-"+s,wc.icon_cache[l]===void 0){wc.icon_cache[l]=!0;let o;r?o=`display: block; content: ' '; background-image: url(${r}); background-size: contain; width: 100%; height: 100%; background-repeat: no-repeat; color: white;`:o=`content: "\\${t}";`,n.setRule(l,`.${l}::before {${o}}`)}this.addClass(l),this.m_icon=t}set icon(t){this._setIcon(t,!0)}get icon(){return this.m_iconName}_setSVG(t){let i=h(s=>{s.url==t&&(this.addClass("@svg-icon"),this.setContent(Je.from(s.svg),!1),df.off("loaded",i))},"set");df.on("loaded",i),df.load(t)}_setSVGPath(t){this.addClass("@svg-icon"),this.setContent(Je.from(`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="${t}/></svg>`),!1)}},ge=wc;h(ge,"Icon"),X(ge,"icon_cache",[]);var Z=class extends I{constructor(t){typeof t=="string"||t instanceof Je?super({text:t}):super(t)}render(t){let i=this.m_props.text;this.m_props.multiline&&!(i instanceof Je)&&(i=new Je(Pl(i,!0))),t.icon?(this.setTag("span"),this.addClass("@hlayout"),this.setContent([new ge({icon:t.icon}),new I({content:i,ref:"text"})])):this.setContent(i),this.addClass(t.align??"left")}set text(t){let i=this.m_props;if(i.text!==t){i.text=t;let s=this.m_props.text;if(this.m_props.multiline&&!(s instanceof Je)&&(s=new Je(Pl(s,!0))),this.dom){let r=this;this.m_props.icon&&(r=this.itemWithRef("text")),r.setContent(s)}}}get text(){return this.m_props.text}};h(Z,"Label");var bc=class extends I{};h(bc,"MenuSeparator");var xc=class extends Z{};h(xc,"MenuTitle");var at=class extends ot{m_subMenu;m_opener;m_virtual;m_lock;constructor(t,i){super(t),this.addClass("@shadow"),this.m_opener=i,this.m_virtual=!1,this.m_lock=0,this.enableMask(!1)}lock(t){this.m_lock+=t?1:-1}setVirtual(){this.m_virtual=!0}setSubMenu(t){this.m_subMenu=t}hideSubMenu(){this.m_subMenu&&(this.m_subMenu.m_opener._close(),this.m_subMenu.hide(),this.m_subMenu=null)}render(t){this.setContent(t.items)}show(){this.m_virtual||at._addMenu(this),super.show()}close(){!this.dom&&!this.m_virtual||(this.m_opener&&this.m_opener._close(),this.m_subMenu&&(this.m_subMenu.close(),this.m_subMenu=null),super.close(),at._removeMenu())}clear(){this.m_props.items=[]}static _addMenu(t){at.watchCount==0&&(at.rootMenu=t,L.addEventListener("mousedown",at._mouseWatcher)),at.watchCount++}static _removeMenu(){console.assert(at.watchCount>0),at.watchCount--,at.watchCount==0&&L.removeEventListener("mousedown",at._mouseWatcher)}static _mouseWatcher(t){if(t.defaultPrevented)return;let i=t.target;for(;i;){let s=I.getElement(i);if(s&&s instanceof at)return;i=i.parentElement}at._discardAll()}static _discardAll(){at.rootMenu&&(at.rootMenu.close(),at.rootMenu=null)}displayAt(...t){this.m_lock||at._discardAll();let i,s,r,n;t.length==1?{x:i,y:s}=Xt(t[0],!0):[i,s,r,n]=t,r||(r="top left"),super.displayAt(i,s,r,n)}},Vt=at;h(Vt,"Menu"),X(Vt,"watchCount",0),X(Vt,"rootMenu",null);var Ii=class extends I{m_menu;m_isOpen;m_action;constructor(t,i){t instanceof _a?(super({click:()=>{t.fire()}}),this.m_action=t):re(t)?super({text:t,click:i}):super(t),this.mapPropEvents(this.m_props,"click"),this.m_menu=null,this.m_isOpen=!1,this.setDomEvent("mousedown",s=>this._mousedown(s)),this.setDomEvent("click",s=>this._click(s))}render(t){let i=t.icon??0,s=t.text;t.checked!==void 0&&(i=t.checked?"var( --x4-icon-check )":0),this.m_action&&(i||(i=this.m_action.props.icon),s===void 0&&(s=this.m_action.props.text));let r=null;this.isPopup&&(this.addClass("@popup-menu-item"),r=new ge({icon:"var( --x4-icon-chevron-right )",cls:"pop-mark"})),!s&&!i&&this.addClass("@separator"),t.cls&&this.addClass(t.cls),this.setTag("a"),this.setContent([i<0?null:new ge({icon:i}),new Z({flex:1,text:s}),r])}get id(){return this.m_props.itemId}get text(){return this.m_props.text}get isPopup(){return!!this.m_props.items}_close(){this.removeClass("@opened"),this.m_isOpen=!1}_click(t){this.isPopup||(this.emit("click",Yt()),Vt._discardAll())}_mousedown(t){if(this.isPopup){this.m_menu||(this.m_menu=new Vt({items:this.m_props.items},this));let i=this.m_isOpen,s=I.getElement(this.dom,Vt);if(s&&s.hideSubMenu(),!i){s&&s.setSubMenu(this.m_menu),this.m_isOpen=!0;let r=this.getBoundingRect();this.m_menu.lock(!0),s?this.m_menu.displayAt(r.right,r.top):this.m_menu.displayAt(r.left,r.bottom),this.m_menu.lock(!1),this.addClass("@opened")}t.preventDefault()}}};h(Ii,"MenuItem");var Cc=class extends q{m_items;constructor(t,i){super(t),console.assert(!1,"not imp"),this.addClass("@shadow"),this.m_items=t.items}render(){this.setContent(this.m_items)}};h(Cc,"MenuBar");var pa=class extends we{m_selection;m_defer_sel;m_container;m_view;m_topIndex;m_itemHeight;m_cache;constructor(t){super(t),this.setDomEvent("keydown",i=>this.handleKey(i)),this.setDomEvent("click",i=>this._handleClick(i)),this.setDomEvent("dblclick",i=>this._handleClick(i)),this.setDomEvent("contextmenu",i=>this._handleCtxMenu(i)),this._setTabIndex(t.tabIndex,0),this.mapPropEvents(t,"click","dblClick","contextMenu","selectionChange","cancel")}componentCreated(){this.m_props.virtual?this._buildItems():this.m_props.populate&&(this.items=this.m_props.populate(null))}render(t){t.items=t.items||[],t.gadgets=t.gadgets,t.renderItem=t.renderItem,t.virtual=t.virtual??!1,this.m_topIndex=0,t.virtual?(console.assert(t.itemHeight!==void 0),this.m_itemHeight=t.itemHeight,this.m_cache=new Map,this.addClass("virtual")):(this.m_itemHeight=void 0,this.m_cache=void 0),this._buildContent()}set items(t){this.setItems(t)}get items(){return this.m_props.items}setItems(t,i=!0){this.m_props.items=t,i||(this.m_selection=null),this.m_container?this._buildItems():this._buildContent()}handleKey(t){let i=h(s=>{let r;ct(this.m_props.items)?(r=this.m_props.items(),this.m_props.items=r):r=this.m_props.items;let n;if(!this.m_selection)r&&(n=r[0]);else{let o=r.findIndex(a=>a===this.m_selection.item);s>0&&o<r.length-1?n=r[o+1]:s<0&&o>0?n=r[o-1]:n=this.selection}let l=this._findItemWithId(n?.id);this._selectItem(n,l,!0)},"moveSel");switch(t.key){case"ArrowDown":{i(1),t.preventDefault(),t.stopPropagation();break}case"ArrowUp":{i(-1),t.preventDefault(),t.stopPropagation();break}}}_buildContent(){let t=this.m_props;t.virtual?(this.m_container=new Ae({cls:"@scroll-container",content:[]}),this.m_view=new Ae({cls:"@scroll-view",flex:1,content:this.m_container,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)}}),this.setContent([this.m_view,t.gadgets?new q({cls:"gadgets",content:t.gadgets}):null])):(this.m_view=void 0,this.m_container=new we({cls:"@scroll-container",content:[]}),this.addClass("@scroll-view"),this.setContent(this.m_container,!1)),t.virtual&&this.m_container.setStyleValue("height",t.items.length*this.m_itemHeight),(this.dom||!t.virtual)&&this._buildItems()}_updateScroll(t){let i=h(()=>{let s=Math.floor(this.m_view.dom.scrollTop/this.m_itemHeight);(s!=this.m_topIndex||t)&&(this.m_topIndex=s,this._buildItems())},"update");t?this.startTimer("scroll",10,!1,i):i()}async _buildItems(){let t=this.m_props,i=[],s=t.items;ct(s)&&(s=s());let r=this.m_selection?.item.id,n=!1;if(t.virtual){let l=this.getBoundingRect(),o=100,a=0,c=this.m_topIndex*this.m_itemHeight,u=this.m_topIndex,_=l.height,p=t.items.length,v=[],g=this.m_cache;for(this.m_cache=new Map;a<_&&u<p&&--o>0;){let x=t.items[u],E;g.has(x.id)?(E=g.get(x.id),g.delete(x.id)):(E=this._renderItem(x),v.push(E)),r==x.id&&(E.addClass("@selected"),n=!0),E.setStyleValue("top",c+a),i.push(E),this.m_cache.set(x.id,E),a+=this.m_itemHeight,u++}g.forEach(x=>{x.dispose()}),this.m_container.appendChild(v),this.m_container.setStyleValue("height",p*this.m_itemHeight),n||s.some(x=>r==x.id)||(this.m_selection=null)}else s.forEach(l=>{let o=this._renderItem(l);r==l.id&&(o.addClass("@selected"),n=!0),i.push(o)}),this.m_container.setContent(i,!1),n||(this.m_selection=null);if(this.m_defer_sel){let l=this.m_defer_sel;this.m_defer_sel=void 0,this.selection=l}}_renderItem(t){let i=this.onRenderItem(t);return i.setAttribute("data-id",t.id),i.addClass("@list-item"),i.setData("item-id",t.id),i}onRenderItem(t){return this.m_props.renderItem?this.m_props.renderItem(t):new q({content:t.text})}_handleClick(t){t.stopImmediatePropagation(),t.preventDefault();let i=t.target,s=this.dom,r=this.m_props.items;for(;i&&i!=s;){let n=I.getElement(i),l=n?.getData("item-id");if(l!==void 0){let o=r.find(a=>a.id==l);if(o){let a;t.type=="click"?(a=Yt(o),this.emit("click",a)):(a=Is(o),this.emit("dblClick",a)),a.defaultPrevented||this._selectItem(o,n)}else this._selectItem(null,null);return}i=i.parentElement}this._selectItem(null,null)}_handleCtxMenu(t){t.preventDefault();let i=t.target,s=this.dom,r=this.m_props.items;for(;i&&i!=s;){let n=I.getElement(i),l=n?.getData("item-id");if(l){let o=r.find(a=>a.id==l);o&&(this._selectItem(o,n),this.emit("contextMenu",Ai(t,o)));return}i=i.parentElement}this.emit("contextMenu",Ai(t,null))}_selectItem(t,i,s=!0){this.m_selection&&this.m_selection.citem&&this.m_selection.citem.removeClass("@selected"),this.m_selection=t?{item:t,citem:i}:null,this.m_selection&&this.m_selection.citem&&this.m_selection.citem.addClass("@selected"),s&&this.emit("selectionChange",Bt(t))}get selection(){return this.m_selection?this.m_selection.item:null}set selection(t){if(t==null)this._selectItem(null,null);else if(ct(this.m_props.items))this.m_defer_sel=t;else{let i=this.m_props.items.find(r=>r.id==t),s=this._findItemWithId(i.id);this._selectItem(i,s,!1)}}_findItemWithId(t){let i=null;return this.dom&&this.m_container.enumChilds(s=>{if(s.getData("item-id")==t)return s.scrollIntoView(),i=s,!0}),i}appendItem(t,i=!1,s=!0){i?this.m_props.items.unshift(t):this.m_props.items.push(t),s&&(this.selection=null),this.m_container?this._buildItems():this._buildContent(),s&&(this.selection=t.id)}updateItem(t,i){let s=this.m_props.items.findIndex(l=>l.id===t);if(s<0)return;let r=!1;this.m_selection&&this.m_selection.item===this.m_props.items[s]&&(r=!0),this.m_props.items[s]=i;let n=this.queryItem(`[data-id="${i.id}"]`)?.dom;if(n){let l=this._renderItem(i);r&&(l.addClass("@selected"),this.m_selection.citem=l,this.m_selection.item=i);let o=l._build();this.m_container.dom.replaceChild(o,n)}}};h(pa,"ListView");function vv(e=null){return se({context:e})}h(vv,"EvCancel");var _r=class extends ot{m_list;constructor(t){super({tabIndex:!1}),this.enableMask(!1),this.addClass("@non-maskable"),t.tabIndex=!1,this.m_list=new pa(t),this.setContent(this.m_list),this.mapPropEvents(t,"cancel")}set items(t){this.m_list.items=t}handleKey(t){this.m_list.handleKey(t)}_handleClick=t=>{if(!this.dom)return;let i=t.target;this.dom.contains(i)||I.getElement(i,Ii)||(this.signal("cancel",vv()),this.close())};show(t){L.addEventListener("mousedown",this._handleClick),super.show(t)}hide(){L.removeEventListener("mousedown",this._handleClick),super.hide()}close(){L.removeEventListener("mousedown",this._handleClick),super.close()}get selection(){return this.m_list.selection}set selection(t){this.m_list.selection=t}};h(_r,"PopupListView");var Ke=class extends I{constructor(t){super(t)}render(t){this.setTag("input"),this._setTabIndex(t.tabIndex),this.setAttributes({value:t.value,type:t.type||"text",name:t.name,placeholder:t.placeHolder,autofocus:t.autoFocus,readonly:t.readOnly,autocomplete:"new-password",tabIndex:t.tabIndex,spellcheck:t.spellcheck===!1?"false":void 0,min:t.min,max:t.max,...t.attrs}),this.m_props.autosel=t.autosel??!0,t.uppercase&&this.setStyleValue("textTransform","uppercase"),this.m_props.autosel&&this.setDomEvent("focus",()=>{this.selectAll()})}getType(){return this.m_props.type}get value(){if(this.dom&&(this.m_props.value=this.dom.value),this.m_props.uppercase){let t=this.m_props.value.toUpperCase();this.dom&&t!=this.m_props.value&&(this.dom.value=t),this.m_props.value=t}return this.m_props.value}set value(t){this.m_props.value=t,this.dom&&(this.dom.value=t)}getStoreValue(){if(this.m_props.value_hook)return this.m_props.value_hook.get();{let t=this.getAttribute("type");t&&(t=t.toLowerCase());let i,s=this.dom;if(t==="file"){i=[];let r=s.files;for(let n=0;n<r.length;n++)i.push(r[n].name)}else if(t==="checkbox")s.checked?i=1:i=0;else if(t==="radio")s.checked&&(i=this.value);else if(t==="date")debugger;else i=this.value;return i}}setStoreValue(t){if(this.m_props.value_hook)return this.m_props.value_hook.set(t);{let i=this.getAttribute("type"),s=this.dom;if(i&&(i=i.toLowerCase()),i==="checkbox"){let r=t!==null&&t!=="0"&&t!==0&&t!==!1;r!==s.checked&&(s.setAttribute("checked",""+r),s.dispatchEvent(new Event("change")))}else this.value=t}}set readOnly(t){this.setAttribute("readonly",t)}selectAll(){this.dom.select()}select(t,i=9999){this.dom.setSelectionRange(t,t+i)}getSelection(){let t=this.dom;return{start:t.selectionStart,length:t.selectionEnd-t.selectionStart}}};h(Ke,"Input");var Cl=class extends I{constructor(t){super(t),this.setTag("button"),this.setDomEvent("click",i=>this._handleClick(i)),this.setDomEvent("mousedown",()=>{this._startAutoRep(!0)}),this.setDomEvent("mouseup",()=>{this._startAutoRep(!1)}),this.setDomEvent("keydown",i=>this._handleKeyDown(i)),this.mapPropEvents(t,"click")}render(t){let i=t.action,s=t.icon,r=t.text;i&&(!s&&i.props.icon&&(s=i.props.icon),r===void 0&&i.props.text&&(r=i.props.text));let n=s?new ge({icon:s,cls:"left",ref:"l_icon"}):null,l=new Z({flex:1,text:r??"",align:t.align,ref:"label"}),o=t.rightIcon?new ge({icon:t.rightIcon,cls:"right",ref:"r_icon"}):null;r===void 0&&l.addClass("@hidden"),this.setContent([n,l,o]),this._setTabIndex(t.tabIndex)}_startAutoRep(t){this.m_props.autoRepeat&&(t?this.startTimer("repeat",700,!1,()=>{this.startTimer("repeat",this.m_props.autoRepeat,!0,this._sendClick)}):this.stopTimer("repeat"))}_handleKeyDown(t){!t.ctrlKey&&!t.shiftKey&&!t.altKey&&(t.key=="Enter"||t.key==" ")&&(this._sendClick(),t.preventDefault(),t.stopPropagation())}_handleClick(t){if(this.m_props.menu){let i=new Vt({items:ct(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),s=this.getBoundingRect();i.displayAt(s.left,s.bottom,"tl")}else this._sendClick();t.preventDefault(),t.stopPropagation()}_sendClick(){if(this.m_props.menu){let t=new Vt({items:ct(this.m_props.menu)?this.m_props.menu():this.m_props.menu}),i=this.getBoundingRect();t.displayAt(i.left,i.bottom,"tl")}else this.emit("click",Yt()),this.m_props.action&&this.m_props.action.fire()}set text(t){this.m_props.text=t;let i=this.itemWithRef("label");i&&(i.text=t,i.removeClass("@hidden"))}get text(){return this.itemWithRef("label")?.text}set icon(t){this.m_props.icon=t;let i=this.itemWithRef("l_icon");i?i.icon=t:this.update()}get icon(){return this.itemWithRef("l_icon")?.icon}set rightIcon(t){this.m_props.rightIcon=t;let i=this.itemWithRef("r_icon");i&&(i.icon=t)}get rightIcon(){return this.itemWithRef("l_icon")?.icon}set menu(t){this.m_props.menu=t}};h(Cl,"BaseButton");var Se=class extends Cl{};h(Se,"Button");var yc=class extends Cl{constructor(t){super(t)}render(t){super.render(t),t.checked&&(this.addClass("checked"),this._updateIcon())}_sendClick(){super._sendClick(),this.m_props.checked=!this.m_props.checked,this.setClass("checked",this.m_props.checked),this.emit("change",ee(this.m_props.checked)),this._updateIcon()}_updateIcon(){if(this.m_props.checkedIcon){let t=this.m_props.checked?this.m_props.checkedIcon:this.m_props.icon,i=this.itemWithRef("l_icon");i&&(i.icon=t)}}};h(yc,"ToggleButton");var ga=class extends we{m_date;constructor(t){super(t),this.mapPropEvents(t,"change"),this.m_date=t.date?.clone()??new Date}render(t){let i=hn(this.m_date);i.setDate(1);let s=i.getDay();s==0&&(s=7),i.setDate(-s+1+1);let r=hn(i),n=this.m_date.hash(),l=hn(this.m_date);l.setDate(1),l.setMonth(l.getMonth()+1),l.setDate(0);let o=an(l),a=[],c=new q({cls:"month-sel",content:[new Z({cls:"month",text:Qe(this.m_date,"O"),dom_events:{click:()=>this._choose("month")}}),new Z({cls:"year",text:Qe(this.m_date,"Y"),dom_events:{click:()=>this._choose("year")}}),new Ds,new Se({text:"<",click:()=>this._next(!1)}),new Se({text:">",click:()=>this._next(!0)})]});a.push(c);let u=[];u.push(new q({cls:"weeknum cell"}));for(let v=0;v<7;v++)u.push(new Z({cls:"cell",flex:1,text:Q.global.day_short[(v+1)%7]}));a.push(new q({cls:"week header",content:u}));let _=this.m_date.getMonth(),p=!0;for(;an(r)<=o;){let v=[new q({cls:"weeknum cell",content:new I({tag:"span",content:Qe(r,"w")})})];for(let g=0;g<7;g++){let x="cell day";r.hash()==n&&(x+=" today"),r.getMonth()!=_&&(x+=" out");let E=h(y=>new q({cls:x,flex:1,content:new I({tag:"span",content:Qe(y,"d")}),dom_events:{click:()=>this.select(y)}}),"mkItem");v.push(E(r.clone())),r.setDate(r.getDate()+1),p=!1}a.push(new q({cls:"week",flex:1,content:v}))}this.setContent(a)}select(t){this.m_date=t,this.emit("change",ee(t)),this.update()}_next(t){this.m_date.setMonth(this.m_date.getMonth()+(t?1:-1)),this.update()}_choose(t){let i=[];if(t=="month")for(let n=0;n<12;n++)i.push(new Ii({text:Q.global.month_long[n],click:()=>{this.m_date.setMonth(n),this.update()}}));else if(t=="year"){let n=this.m_props.minDate?.getFullYear()??1900,l=this.m_props.maxDate?.getFullYear()??2037;for(let o=n;o<l;o++)i.push(new Ii({text:""+o,click:()=>{this.m_date.setFullYear(o),this.update()}}))}let s=new Vt({items:i}),r=this.getBoundingRect();s.displayAt(r.left,r.top)}get date(){return this.m_date}set date(t){this.m_date=t,this.update()}};h(ga,"Calendar");var yl=class extends ot{m_cal;constructor(t){super({tabIndex:1}),this.enableMask(!1),this.m_cal=new ga(t),this.m_cal.addClass("@fit"),this.setContent(this.m_cal)}_handleClick=t=>{if(!this.dom)return;let i=t.target;this.dom.contains(i)||I.getElement(i,Ii)||this.close()};show(t,i){L.addEventListener("mousedown",this._handleClick),i?super.displayAt(i.x,i.y,"top left",void 0,t):super.show(t)}close(){L.removeEventListener("mousedown",this._handleClick),super.close()}};h(yl,"PopupCalendar");var _f,$s,Qr=class extends I{m_text;set text(t){this.m_text.text=t}render(){this.setClass("@non-maskable",!0),this.setContent([new ge({icon:"var( --x4-icon-tip )"}),this.m_text=new Z({text:"help"})])}displayAt(t,i,s="top left"){this.show();let r="l",n="t";s.indexOf("right")>=0&&(r="r"),s.indexOf("bottom")>=0&&(n="b");let l=L.body.getBoundingClientRect(),o=this.getBoundingRect();r=="r"&&(t-=o.width),n=="b"&&(i-=o.height),t+o.width>l.right&&(t=l.right-o.width),i+o.height>l.bottom&&(i=l.bottom-o.height-17),this.setStyle({left:t,top:i})}};h(Qr,"Tooltip");function Q1(e){if(Ml())return;let t={target:null,x:0,y:0};function i(n){t.x=n.pageX,t.y=n.pageY}h(i,"handle_mpos");function s(n){let l=n.target,o=null;for(t.x=n.pageX+10,t.y=n.pageY+15;l&&(o=l.getAttribute("tip"),!o);)l=l.parentElement;if(!(l==t.target||$s&&l==$s.dom)){if(!l||!o){t.target=null,e?e(null):r();return}t.target=l,e?e(null):r(),e?e(o):_f=setTimeout(()=>{$s===void 0&&($s=new Qr({}),L.body.appendChild($s._build())),$s.text=o,$s.displayAt(t.x+17,t.y+17,"top left")},700)}}h(s,"handle_mouse");function r(){_f&&clearTimeout(_f),$s&&$s.hide()}h(r,"_hideTip"),L.body.addEventListener("mouseover",s),L.body.addEventListener("mouseout",s),L.body.addEventListener("mousemove",i)}h(Q1,"initTooltips");var e2=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Ye=class extends I{m_cal_popup;m_ui_input;m_error_tip;constructor(t){super(t),this.addClass("@hlayout"),this.mapPropEvents(t,"change","click","focus")}componentCreated(){super.componentCreated(),this.m_props.autoFocus&&this.focus()}componentDisposed(){this.m_error_tip&&this.m_error_tip.dispose(),super.componentDisposed()}focus(){this.m_ui_input.focus()}render(t){let i={flex:1,dom_events:{focus:()=>this._focus(),focusout:()=>this._blur(),input:()=>this._change()},value:t.value,name:t.name,type:t.type,placeHolder:t.placeHolder,autoFocus:t.autoFocus,readOnly:t.readOnly,value_hook:t.value_hook,uppercase:t.uppercase,spellcheck:t.spellcheck,tabIndex:t.tabIndex===void 0?!0:t.tabIndex,attrs:t.attrs,min:t.min,max:t.max,autosel:t.autosel};if(t.type=="date"){t.format=t.format??"Y-M-D",i.type="text";let p={get:()=>this._date_get_hook(),set:v=>this._date_set_hook(v)};i.value_hook=t.value_hook??p}this.m_ui_input=new Ke(i);let s;t.icon?s=new Se({icon:t.icon,click:()=>this._btnClick(),tabIndex:!1}):t.type=="date"&&(s=new Se({cls:"gadget",icon:"var( --x4-icon-calendar-days )",tabIndex:!1,click:()=>this._showDatePicker(s)}),t.validator||(t.validator=this._date_validator));let r=t.gadgets??[];r.forEach(p=>{p.addClass("gadget")});let n=[s,...r];this.setClass("@required",t.required),t.gadgets&&t.gadgets.length&&this.addClass("with-gadgets");let l,o,a=t.labelWidth;a>0&&(l=a),a<0&&(o=-a);let c,u=t.labelAlign,_=!1;t.label&&(u=="top"&&(u="left",_=!0,o=1),c=new Z({ref:"label",tag:"label",cls:"label1"+(t.label?"":" @hidden"),text:t.label??"",width:l,flex:o,align:u})),_?(this.removeClass("@hlayout"),this.addClass("@vlayout vertical"),this.setContent([c,new q({width:l,content:[this.m_ui_input,...n]})])):(this.addClass("@hlayout"),this.setContent([c,this.m_ui_input,...n]))}enable(t){t===!0&&this.m_ui_input.enable(),super.enable(t)}disable(){this.m_ui_input.disable(),super.disable()}_btnClick(){this.emit("click",Yt(this.value))}setDateStoreFormat(t){this.m_props.format=t}setStoreValue(t){this.m_ui_input.setStoreValue(t)}getStoreValue(){return this.m_ui_input.getStoreValue()}_date_get_hook(){let t=Tl(this.value),i=this.m_props;return i.format=="native"?t:t?Qe(t,i.format):null}_date_set_hook(t){let i=this.m_props;if(i.format=="native")this.value=Qe(t);else if(t){let s=Tl(t,i.format);this.value=Qe(s)}else this.value=""}showError(t){this.m_error_tip||(this.m_error_tip=new Qr({cls:"error"}),L.body.appendChild(this.m_error_tip._build()));let i=this.m_ui_input.getBoundingRect();this.m_error_tip.text=t,this.m_error_tip.displayAt(i.right,i.top,"top left"),this.addClass("@error")}clearError(){this.m_error_tip&&(this.m_error_tip.hide(),this.removeClass("@error"))}get value(){return this.m_ui_input?this.m_ui_input.value:this.m_props.value}set value(t){this.m_ui_input?this.m_ui_input.value=t:this.m_props.value=t}selectAll(){this.m_ui_input.selectAll()}select(t,i=9999){this.m_ui_input.select(t,i)}getSelection(){return this.m_ui_input.getSelection()}set readOnly(t){this.m_ui_input.readOnly=t}get label(){return this.itemWithRef("label")?.text}set label(t){this.itemWithRef("label").text=t}_change(){let t=this.m_ui_input.value;this.emit("change",ee(t))}_focus(){this.clearError(),this.emit("focus",La(!0))}_blur(){this._validate(this.m_ui_input.value),this.emit("focus",La(!1))}validate(){return this._validate(this.value)}_validate(t){let i=this.m_props,s=!1;if(i.required&&t.length==0)return this.showError(Q.global.required_field),!1;if(t!=""){let r=this.getAttribute("pattern");if(r){let n=new RegExp(r);if(n&&!n.test(t))return this.showError(Q.global.invalid_format),!1}if(i.type=="email"){if(!e2.test(t.toLowerCase()))return this.showError(Q.global.invalid_email),!1}else if(i.type=="number"){let n=parseFloat(t);if(isNaN(n))return this.showError(Q.global.invalid_number),!1;let l=parseFloat(this.m_ui_input.getAttribute("min"));l!==void 0&&n<l&&(t=""+l,s=!0);let o=parseFloat(this.m_ui_input.getAttribute("max"));o!==void 0&&n>o&&(t=""+o,s=!0)}}if(i.validator)try{this.value=i.validator(t)}catch(r){return this.showError(r instanceof Error?r.message:r),!1}else s&&(this.value=t);return!0}_date_validator(t){if(t=t.trim(),t=="")return"";let i;if(t=="@")i=new Date;else if(i=Tl(t),!i)throw ln(Q.global.invalid_date,Q.global.date_format);return Qe(i)}_showDatePicker(t){this.m_cal_popup||(this.m_cal_popup=new yl({change:s=>{this.value=Qe(s.value),this.m_cal_popup.close()}}));let i=this.m_ui_input.getBoundingRect();this.m_cal_popup.displayAt(i.left,i.bottom,"top left")}get input(){return this.m_ui_input}get type(){return this.m_props.type}};h(Ye,"TextEdit");var Ec=class extends Ye{m_popup;m_popvis;m_needval;m_lockpop;constructor(t){super(t),this.setDomEvent("input",()=>this._onChange()),this.setDomEvent("focusin",()=>this._onFocus()),this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.m_popvis=!1,this.m_needval=!1,this.m_lockpop=!1,this.setDomEvent("keydown",i=>this._onKey(i))}_onKey(t){this.m_popvis?t.key=="ArrowUp"||t.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(t),this.m_lockpop=!1,t.preventDefault(),t.stopPropagation()):t.key=="Escape"&&(this._hidePopup(),t.preventDefault(),t.stopPropagation()):t.key=="ArrowDown"&&(this._onChange(),t.preventDefault(),t.stopPropagation())}_onChange(){let t=this.m_props.enumValues(this.value);this.showPopup(t)}componentDisposed(){this.m_popup&&this._hidePopup(),super.componentDisposed()}showPopup(t){if(this.m_props.readOnly||this.hasClass("@disable"))return;if(!this.m_popup){let r=this.getComputedStyle(),n=r.value("fontFamily"),l=r.value("fontSize");this.m_popup=new _r({cls:"@combo-popup",attrs:{tabindex:0},selectionChange:o=>{this.value=o.selection.id,this.m_lockpop||(this._hidePopup(),this.focus())},style:{fontFamily:n,fontSize:l}})}this.m_popup.items=t.map(r=>({id:r,text:r}));let s=this.m_ui_input.getBoundingRect();this.m_popup.setStyle({minWidth:s.width}),this.m_popup.displayAt(s.left,s.bottom),this.m_popvis=!0}_validate(t){return!0}validate(){return super._validate(this.value)}_checkFocus(){let t=document.activeElement;this.dom&&this.dom.contains(t)||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(t)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1),this.m_needval&&(this.validate(),this.m_needval=!1)}_onFocus(){this.value.length==0&&this._onChange(),this.m_needval=!0}};h(Ec,"AutoComplete");function t2(e){return se({ctx:e})}h(t2,"EvPaint");function i2(e,t,i){let s=e;return s.width=t,s.height=i,s.smoothLine=s2,s.smoothLineEx=r2,s.line=n2,s.roundRect=l2,s.calcTextSize=o2,s.setFontSize=a2,s.circle=h2,s}h(i2,"mkPainter");function s2(e,t=null,i=!0){if(e.length<2)return;if(t||(t=this),e.length==2){i!==!1?t.moveTo(e[0].x,e[0].y):t.lineTo(e[0].x,e[0].y),t.lineTo(e[1].x,e[1].y);return}function s(a,c){return{x:a.x+(c.x-a.x)/2,y:a.y+(c.y-a.y)/2}}h(s,"midPointBtw");function r(a,c,u,_,p,v,g){return{x:(1-a)*(1-a)*c+2*(1-a)*a*_+a*a*v,y:(1-a)*(1-a)*u+2*(1-a)*a*p+a*a*g}}h(r,"getQuadraticXY");let n=e[0],l=e[1],o=n;t.moveTo(n.x,n.y);for(let a=1,c=e.length;a<c;a++){let u=s(n,l);for(let _=0;_<8;_++){let{x:p,y:v}=r(_/8,o.x,o.y,n.x,n.y,u.x,u.y);t.lineTo(p,v)}n=e[a],l=e[a+1],o=u}t.lineTo(n.x,n.y)}h(s2,"smoothLine");function r2(e,t=.5,i=10,s=null,r=!0,n=!1){let l=[];for(let w=0,D=e.length;w<D;w++)l.push(e[w].x),l.push(e[w].y);let o,a=1,c=l.length,u=0,_=(c-2)*i+2+(n?2*i:0),p=new Float32Array(_),v=new Float32Array((i+2)*4),g=4;for(o=l.slice(0),n?(o.unshift(l[c-1]),o.unshift(l[c-2]),o.push(l[0],l[1])):(o.unshift(l[1]),o.unshift(l[0]),o.push(l[c-2],l[c-1])),v[0]=1;a<i;a++){var x=a/i,E=x*x,y=E*x,k=y*2,A=E*3;v[g++]=k-A+1,v[g++]=A-k,v[g++]=y-2*E+x,v[g++]=y-E}v[g]=1,S(o,v,c),n&&(o=[],o.push(l[c-4],l[c-3],l[c-2],l[c-1]),o.push(l[0],l[1],l[2],l[3]),S(o,v,4));function S(w,D,R){for(var C=2,z;C<R;C+=2){var W=w[C],J=w[C+1],ve=w[C+2],te=w[C+3],ie=(ve-w[C-2])*t,K=(te-w[C-1])*t,Y=(w[C+4]-W)*t,Nt=(w[C+5]-J)*t;for(z=0;z<i;z++){var Te=z<<2,Ut=D[Te],$t=D[Te+1],qt=D[Te+2],Kt=D[Te+3];p[u++]=Ut*W+$t*ve+qt*ie+Kt*Y,p[u++]=Ut*J+$t*te+qt*K+Kt*Nt}}}h(S,"parse"),c=n?0:l.length-2,p[u++]=l[c],p[u]=l[c+1],s||(s=this);for(let w=0,D=p.length;w<D;w+=2)w==0&&r!==!1?s.moveTo(p[w],p[w+1]):s.lineTo(p[w],p[w+1])}h(r2,"smoothLineEx");function n2(e,t,i,s,r,n=1){this.save(),this.beginPath(),this.moveTo(e,t),this.lineTo(i,s),this.lineWidth=n,this.strokeStyle=r,this.stroke(),this.restore()}h(n2,"line");function l2(e,t,i,s,r){this.moveTo(e+r,t),this.lineTo(e+i-r,t),this.quadraticCurveTo(e+i,t,e+i,t+r),this.lineTo(e+i,t+s-r),this.quadraticCurveTo(e+i,t+s,e+i-r,t+s),this.lineTo(e+r,t+s),this.quadraticCurveTo(e,t+s,e,t+s-r),this.lineTo(e,t+r),this.quadraticCurveTo(e,t,e+r,t),this.closePath()}h(l2,"roundRect");function o2(e,t=!1){let i=this.measureText(e),s=i.fontBoundingBoxAscent+i.fontBoundingBoxDescent;return t?{width:Math.round(i.width),height:Math.round(s)}:{width:i.width,height:s}}h(o2,"calcTextSize");function a2(e){let t=Math.round(e)+"px";this.font=this.font.replace(/\d+px/,t)}h(a2,"setFontSize");function h2(e,t,i){this.moveTo(e+i,t),this.arc(e,t,i,0,Math.PI*2)}h(h2,"circle");var kc=class extends I{m_iwidth=-1;m_iheight=-1;m_scale=1;m_canvas;constructor(t){super(t),this.setDomEvent("sizechange",()=>{this._paint()}),this.mapPropEvents(t,"paint")}render(){this.m_iwidth=-1,this.m_iheight=-1,this.m_canvas=new I({tag:"canvas"}),this.setContent(this.m_canvas)}update(t=0){this.m_iheight=this.m_iwidth=-1,super.update(t)}scale(t){this.m_scale=t,this.m_iwidth=-1,this.redraw()}get canvas(){return this.m_canvas}$update_rep=0;redraw(t){t!==void 0?++this.$update_rep>=20?(this.stopTimer("update"),this._paint()):this.startTimer("update",t,!1,()=>this._paint()):(this.stopTimer("update"),this._paint())}_paint(){this.$update_rep=0;let t=this.dom;if(!this.isUserVisible())return;let i=this.m_canvas.dom,s=t.clientWidth,r=t.clientHeight,n=i.getContext("2d");if(s!=this.m_iwidth||r!=this.m_iheight){let l=window.devicePixelRatio||1,o=n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1,a=this.canvas;if(l!==o||this.m_scale!=1){let c=l/o,u=s*c,_=r*c;a.setAttribute("width",""+u),a.setAttribute("height",""+_),a.setStyleValue("width",s),a.setStyleValue("height",r),c*=this.m_scale,n.scale(c,c)}else a.setAttribute("width",""+s),a.setAttribute("height",""+r),a.setStyleValue("width",s),a.setStyleValue("height",r),n.scale(1,1);this.m_iwidth=s,this.m_iheight=r}if(s&&r){let l=i2(n,s,r);this.m_props.autoClear&&l.clearRect(0,0,s,r),l.save(),l.translate(-.5,-.5),this.paint(l),l.restore()}}paint(t){try{this.m_props.painter?this.m_props.painter(t):this.emit("paint",t2(t))}catch(i){console.assert(!1,i)}}};h(kc,"Canvas");var fr=class extends I{m_cards;m_ipage;m_cpage;constructor(t){super(t),this.m_cards=[],this.m_ipage=t.active,this.m_cpage=null,this.singleShot(()=>{this.setPages(t.pages)})}render(){let t=[];this.m_cards.forEach(i=>{i.page&&t.push(i.page)}),this.setContent(t)}switchTo(t){if(this.m_cards.length!=0&&(t===void 0&&(t=this.m_cards[0].name),t!==this.m_cpage?.name)){if(this.m_cpage&&(this.m_cpage.selector&&this.m_cpage.selector.removeClass("@active"),this.m_cpage.page&&!(this.m_cpage.page instanceof Function))){let i=this.m_cpage.page;i.removeClass("@active"),i.addClass("@hidden")}if(this.m_cpage=this.m_cards.find(i=>i.name==t),this.m_cpage){if(this.m_cpage.page){ct(this.m_cpage.page)&&(this.m_cpage.page=this.m_cpage.page(),console.assert(this.m_cpage.page!=null,"You must return a valid component"));let i=this.m_cpage.page;i.addClass("@active"),i.removeClass("@hidden"),i.dom||this._preparePage(i),this.m_cpage.selector&&this.m_cpage.selector.addClass("@active")}this.emit("change",ee(this.m_cpage.name))}}}setPages(t){let i=this._initTabs(t);i&&fi(()=>{this.switchTo(i),this.update()})}_initTabs(t){if(!t)return;let i=this.m_ipage;return t.forEach(s=>{if(!s)return;let r={...s};r.selector=this._prepareSelector(s),r.active=!1,this.m_cards.push(r),i||(i=s.name),s.active&&(i=s.name)}),i}_updateSelector(){}_prepareSelector(t){return null}_preparePage(t){t.setStyleValue("flex",1),t.addClass("@tab-page")}};h(fr,"CardView");var qs=class extends I{constructor(t){super(t),this.setDomEvent("focus",()=>this._setFocus()),this.mapPropEvents(t,"change"),t.slider&&this.addClass("slider")}render(t){let i=t.labelWidth??-1,s="__cb_"+this.uid;this.setTag("label"),this.addClass("@hlayout"),this.addClass(t.align??"left"),this.setContent([new Ke({ref:"input",type:"checkbox",name:t.name,id:s,tabIndex:t.tabIndex,value:t.value??"on",attrs:{checked:t.checked?"":void 0},dom_events:{change:this._change.bind(this)}}),t.slider?new I({cls:"@slide-el"}):null,new Z({text:t.text??"",width:i<0?void 0:i,flex:i<0?-i:void 0,align:t.labelAlign??"left",style:{order:t.align=="right"?-1:1},attrs:{for:s}})])}_change(){this.emit("change",ee(this.check))}_setFocus(){this.itemWithRef("input").focus()}get check(){return this.dom?this.itemWithRef("input").dom.checked:this.m_props.checked}set check(t){if(this.dom){let s=this.itemWithRef("input").dom;s&&(s.checked=t)}this.m_props.checked=t}get text(){return this.itemWithRef("label").text}set text(t){this.itemWithRef("label").text=t}toggle(){this.check=!this.check}};h(qs,"CheckBox");var wv={lightsalmon:4294942842,lightseagreen:4280332970,lightskyblue:4287090426,lightslategray:4286023833,lightsteelblue:4289774814,lightyellow:4294967264,lime:4278255360,limegreen:4281519410,linen:4294635750,magenta:4294902015,maroon:4286578688,mediumaquamarine:4284927402,mediumblue:4278190285,mediumorchid:4290401747,mediumpurple:4287852763,mediumseagreen:4282168177,mediumslateblue:4286277870,mediumspringgreen:4278254234,mediumturquoise:4282962380,mediumvioletred:4291237253,midnightblue:4279834992,mintcream:4294311930,mistyrose:4294960353,moccasin:4294960309,navajowhite:4294958765,navy:4278190208,oldlace:4294833638,olive:4286611456,olivedrab:4285238819,orange:4294944e3,orangered:4294919424,orchid:4292505814,palegoldenrod:4293847210,palegreen:4288215960,paleturquoise:4289720046,palevioletred:4292571283,papayawhip:4294963157,peachpuff:4294957753,peru:4291659071,pink:4294951115,plum:4292714717,powderblue:4289781990,purple:4286578816,red:4294901760,rosybrown:4290547599,royalblue:4282477025,saddlebrown:4287317267,salmon:4294606962,sandybrown:4294616160,seagreen:4281240407,seashell:4294964718,sienna:4288696877,silver:4290822336,skyblue:4287090411,slateblue:4285160141,slategray:4285563024,snow:4294966010,springgreen:4278255487,steelblue:4282811060,tan:4291998860,teal:4278222976,thistle:4292394968,tomato:4294927175,turquoise:4282441936,violet:4293821166,wheat:4294303411,white:4294967295,whitesmoke:4294309365,yellow:4294967040,yellowgreen:4288335154,aliceblue:4293982463,antiquewhite:4294634455,aqua:4278255615,aquamarine:4286578644,azure:4293984255,beige:4294309340,bisque:4294960324,black:4278190080,blanchedalmond:4294962125,blue:4278190335,blueviolet:4287245282,brown:4289014314,burlywood:4292786311,cadetblue:4284456608,chartreuse:4286578432,chocolate:4291979550,coral:4294934352,cornflowerblue:4284782061,cornsilk:4294965468,crimson:4292613180,cyan:4278255615,darkblue:4278190219,darkcyan:4278225803,darkgoldenrod:4290283019,darkgray:4289309097,darkgreen:4278215680,darkkhaki:4290623339,darkmagenta:4287299723,darkolivegreen:4283788079,darkorange:4294937600,darkorchid:4288230092,darkred:4287299584,darksalmon:4293498490,darkseagreen:4287609999,darkslateblue:4282924427,darkslategray:4281290575,darkturquoise:4278243025,darkviolet:4287889619,deeppink:4294907027,deepskyblue:4278239231,dimgray:4285098345,dodgerblue:4280193279,firebrick:4289864226,floralwhite:4294966e3,forestgreen:4280453922,fuchsia:4294902015,gainsboro:4292664540,ghostwhite:4294506751,gold:4294956800,goldenrod:4292519200,gray:4286611584,green:4278222848,greenyellow:4289593135,honeydew:4293984240,hotpink:4294928820,indianred:4291648604,indigo:4283105410,ivory:4294967280,khaki:4293977740,lavender:4293322490,lavenderblush:4294963445,lawngreen:4286381056,lemonchiffon:4294965965,lightblue:4289583334,lightcoral:4293951616,lightcyan:4292935679,lightgoldenrodyellow:4294638290,lightgreen:4287688336,lightgrey:4292072403,lightpink:4294948545,none:0,transparent:0},be=class{m_value;constructor(t,i,s,r){let n=arguments.length,l=this;function o(){if(!n)return 4278190080;if(n==1)return Number.isSafeInteger(t)?4278190080|t&16777215:l._getCustomColor(t);if(n==2){let a,c=((i*255|0)&255)<<24;return Number.isSafeInteger(t)?a=t:a=l._getCustomColor(t),a&16777215|c}else if(n==4&&r!==void 0&&r<=1)return r<=0?0:(r=r*255,r|=0,(r&255)<<24|(t&255)<<16|(i&255)<<8|s&255);return 4278190080|(t&255)<<16|(i&255)<<8|s&255}h(o,"_init"),this.m_value=o()}_shade(t){let i=t<0?0:255,s=t<0?-t:t,r=this._split();return new be(Math.round((i-r.r)*s)+r.r,Math.round((i-r.g)*s)+r.g,Math.round((i-r.b)*s)+r.b,r.a/255)}darken(t){return t<0&&(t=0),t>100&&(t=100),this._shade(-t/100)}lighten(t){return t<0&&(t=0),t>100&&(t=100),this._shade(t/100)}static mix(t,i,s){let r=t._split(),n=i._split(),l=r.a===n.a?r.a:Math.round(n.a*s+r.a*(1-s)),o=r.r===n.r?r.r:Math.round(n.r*s+r.r*(1-s)),a=r.g===n.g?r.g:Math.round(n.g*s+r.g*(1-s)),c=r.b===n.b?r.b:Math.round(n.b*s+r.b*(1-s));return new be(o,a,c,l/255)}_split(){let t=this.m_value;return{a:t>>24&255,r:t>>16&255,g:t>>8&255,b:t&255}}fadeout(t){let i=this._split();if(i.a=i.a/255,i.a=i.a-i.a*t/100,i.a>1)i.a=1;else if(i.a<=0)return be.NONE;return new be(i.r,i.g,i.b,i.a)}static fromHSV(t,i,s,r=1){let n=Math.min(5,Math.floor(t*6)),l=t*6-n,o=s*(1-i),a=s*(1-l*i),c=s*(1-(1-l)*i),u,_,p;switch(n){case 0:u=s,_=c,p=o;break;case 1:u=a,_=s,p=o;break;case 2:u=o,_=s,p=c;break;case 3:u=o,_=a,p=s;break;case 4:u=c,_=o,p=s;break;case 5:u=s,_=o,p=a;break}return new be(u*255,_*255,p*255,r)}static toHSV(t){let i=t._split();i.r/=255,i.g/=255,i.b/=255,i.a/=255;let s=Math.max(i.r,i.g,i.b),r=Math.min(i.r,i.g,i.b),n=s-r,l=s===0?0:n/s,o=s,a;if(n===0)a=0;else switch(s){case i.r:a=(i.g-i.b)/n/6+(i.g<i.b?1:0);break;case i.g:a=(i.b-i.r)/n/6+1/3;break;case i.b:a=(i.r-i.g)/n/6+2/3;break}return{h:a,s:l,v:o,a:i.a}}static fromHLS(t,i,s){let r,n,l;if(s==0)r=n=l=i;else{let a=function(_,p,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?_+(p-_)*6*v:v<1/2?p:v<2/3?_+(p-_)*(2/3-v)*6:_};var o=a;h(a,"hue2rgb");let c=i<.5?i*(1+s):i+s-i*s,u=2*i-c;r=a(u,c,t+1/3),n=a(u,c,t),l=a(u,c,t-1/3)}return r=(r*255|0)&255,n=(n*255|0)&255,l=(l*255|0)&255,new be(r,n,l)}static toHLS(t){let i=t.m_value,s=(i>>16&255)/255,r=(i>>8&255)/255,n=(i&255)/255,l=s,o=s;r<l&&(l=r),n<l&&(l=n),r>o&&(o=r),n>o&&(o=n);let a=0,c=0,u=0,_=o-l,p=o+l,v=.5*p,g,x;if(o!=l)a=(o-s)/_,c=(o-r)/_,u=(o-n)/_;else return{h:0,l:v,s:0};return v<.5?g=_/p:g=_/(2-p),s==o?x=60*(6+u-c):r==o?x=60*(2+a-u):x=60*(4+c-a),x>360&&(x=x-360),{h:x/360,l:v,s:g}}red(){return this.m_value>>16&255}green(){return this.m_value>>8&255}blue(){return this.m_value&255}alpha(){return(this.m_value>>24&255)/255}value(){return this.m_value}toString(){if(this.m_value===0)return"transparent";let i=this._split();if(i.a===255)return`rgb(${i.r},${i.g},${i.b})`;{i.a/=255;let s=i.a.toFixed(3);return`rgba(${i.r},${i.g},${i.b},${s})`}}toHex(t=!0){if(this.m_value===0)return"transparent";let s=this._split();return s.a===255||!t?`#${en(s.r)}${en(s.g)}${en(s.b)}`:`#${en(s.r)}${en(s.g)}${en(s.b)}${en(s.a)}`}static addCustomColor(t,i){be.custom[t]=i}static addCssColor(t){let i=ri.getVar(t);be.custom["css:"+t]=be.parse(i.trim())}static parse(t){let i;if(t[0]=="#"){if((i=/#(?<r>[a-fA-F0-9]{2})(?<g>[a-fA-F0-9]{2})(?<b>[a-fA-F0-9]{2})(?<a>[a-fA-F0-9]{2})?/.exec(t))!==null){let n=i.groups;return new be(parseInt(n.r,16),parseInt(n.g,16),parseInt(n.b,16),n.a!==void 0?parseInt(n.a,16)/255:1)}if((i=/#(?<r>[a-fA-F0-9])(?<g>[a-fA-F0-9])(?<b>[a-fA-F0-9])/.exec(t))!==null){let n=i.groups,l=parseInt(n.r,16),o=parseInt(n.g,16),a=parseInt(n.b,16);return new be(l<<4|l,o<<4|o,a<<4|a,1)}}if(t[0]=="r"){if((i=/rgb\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\)/.exec(t))!==null){let n=i.groups;return new be(parseInt(n.r,10),parseInt(n.g,10),parseInt(n.b,10),1)}if((i=/rgba\(\s*(?<r>\d+)\s*\,\s*(?<g>\d+)\s*\,\s*(?<b>\d+)\s*\,\s*(?<a>[0-9.]+)\s*\)/.exec(t))!==null){let n=i.groups;return new be(parseInt(n.r,10),parseInt(n.g,10),parseInt(n.b,10),parseFloat(n.a))}}return console.log("invalid color value: "+t),new be(0)}_getCustomColor(t){if(t===null)return 0;let i=wv[t];return i!==void 0?i:be.custom[t]!==void 0?be.custom[t].m_value:t.substr(0,4)=="css:"?(be.addCssColor(t.substr(4)),be.custom[t].m_value):be.parse(t).m_value}static contrastColor(t){let i=t._split();return(.299*i.r+.587*i.g+.114*i.b)/255>.5?be.BLACK:be.WHITE}static valueFromColorName(t){let i=wv[t];return i?new be(i):null}static fromCssVar(t){return new be(t).toString()}},De=be;h(De,"Color"),X(De,"custom",[]),X(De,"WHITE",new be(255,255,255)),X(De,"BLACK",new be(0,0,0)),X(De,"NONE",new be(0,0,0,0));function en(e){return("00"+e.toString(16)).substr(-2).toUpperCase()}h(en,"_hx");var m2=1e4;function ff(e){let t,i=e.url,s=e.method||"GET",r=!1;e.params instanceof FormData?(t=e.params,r=!0):s=="POST"?t=bv(e.params,!1):i+=bv(e.params,!0),i=encodeURI(i);let n=new XMLHttpRequest;if(n.open(s,i),n.upload.addEventListener("progress",l,!1),n.addEventListener("timeout",a),n.addEventListener("error",a),n.addEventListener("load",c),r||n.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8"),s!="POST"&&(n.responseType=e.responseType||"json",n.timeout=e.timeout||m2),e.headers)for(let u in e.headers)n.setRequestHeader(u,e.headers[u]);function l(u){if(console.log(u),e.progress)try{if(u.lengthComputable){let _=o(u.loaded)+" / "+o(u.total);e.progress(u.loaded,u.total,_)}}catch(_){console.error("unhandled exception:",_)}}h(l,"progress");function o(u){let _,p;return u>=1e9?(_="Gb",p=u/1e9):u>=1e6?(_="Mb",p=u/1e6):u>=1e3?(_="Kb",p=u/1e3):(_="bytes",p=u),p.toFixed(2)+_}h(o,"humanSize");function a(){e.failure&&e.failure(n.status,n.statusText,e.userData)}h(a,"failure");function c(){if(n.status>=200&&n.status<300){if(e.success)try{e.success(n.response,e.userData)}catch(u){console.error("unhandled exception:",u)}}else a()}return h(c,"success"),r||s=="POST"?n.send(t):n.send(),function(){n.abort()}}h(ff,"ajaxRequest");function bv(e,t){if(!e)return"";let i=[];for(let r in e){let n=e[r];if(mt(n))for(let l=0,o=n.length;l<o;l++)i.push(encodeURIComponent(r)+"[]="+encodeURIComponent(""+n[l]));else n===void 0&&(n=""),i.push(encodeURIComponent(r)+"="+encodeURIComponent(""+n))}let s=i.join("&");return t?"?"+s:s}h(bv,"buildQuery");async function c2(e,t){return(await pf(e,t,"application/json")).json()}h(c2,"ajaxAsJSON");async function u2(e,t){return(await pf(e,t,"text/plain")).text()}h(u2,"ajaxAsText");async function pf(e,t,i){let s={method:"GET",headers:{"X-Requested-With":"XMLHttpRequest"}};if(i&&(s.headers["Content-Type"]=i),t&&(s={...s,...t},t.body&&!re(t.body))){let n=!1;(ou(t.body)||!(t.body instanceof Blob)&&!(t.body instanceof ArrayBuffer)&&!(t.body instanceof FormData)&&!(t.body instanceof URLSearchParams)&&!(t.body instanceof ReadableStream))&&(n=!0),n?s.body=JSON.stringify(t.body):s.body=t.body}let r=await fetch(e,s);if(t&&t.noGenX)return r;if(!r.ok)throw new on(r);return r}h(pf,"ajax");var El=class extends we{m_height;m_container;m_buttons;m_dirty;m_watchChanges;constructor(t){let i=t.content;t.content=null;let s=t.height;t.height=void 0,super(t),this.setTag(t.disableSuggestions?"section":"form"),this.mapPropEvents(t,"btnClick"),this.updateContent(i,t.buttons,s),this.m_dirty=!1,this.m_watchChanges=!1}get container(){return this.m_container}componentCreated(){super.componentCreated(),this.m_watchChanges&&this.watchChanges()}updateContent(t,i,s=0){s&&(this.m_height=s),this._makeButtons(i);let r=[this.m_container=new we({cls:"container",height:this.m_height,content:t}),this.m_buttons];super.setContent(r)}setContent(t,i=!0){this.m_container.setContent(t,i)}setButtons(t){this._makeButtons(t)}enableButton(t,i=!0){let s=this.getButton(t);s&&s.enable(i)}getButton(t){return this.m_buttons?.itemWithRef("@"+t)}_makeButtons(t){this.m_buttons||(this.m_buttons=new q({cls:"footer",ref:"buttons"}));let i=[];if(t)for(let s of t)if(s instanceof I)i.push(s);else switch(s){case"ok":{i.push(new Se({ref:"@"+s,text:Q.global.ok,click:()=>{this._click(s)}}));break}case"cancel":{i.push(new Se({ref:"@"+s,text:Q.global.cancel,click:()=>{this._click(s)}}));break}case"ignore":{i.push(new Se({ref:"@"+s,text:Q.global.ignore,click:()=>{this._click(s)}}));break}case"yes":{i.push(new Se({ref:"@"+s,text:Q.global.yes,click:()=>{this._click(s)}}));break}case"no":{i.push(new Se({ref:"@"+s,text:Q.global.no,click:()=>{this._click(s)}}));break}case"close":{i.push(new Se({ref:"@"+s,text:Q.global.close,click:()=>{this._click(s)}}));break}case"save":{i.push(new Se({ref:"@"+s,text:Q.global.save,click:()=>{this._click(s)}}));break}case"dontsave":{i.push(new Se({ref:"@"+s,text:Q.global.dontsave,click:()=>{this._click(s)}}));break}}i.length==1&&i[0].setAttribute("autofocus",!0),this.m_buttons.setContent(i)}validate(){let t=this.queryAll("input"),i=!0;for(let s=0;s<t.length;s++){let r=I.getElement(t[s],Ye);r&&!r.validate()&&(i=!1)}return i}_click(t){this.emit("btnClick",gf(t))}_getElements(){return console.assert(!!this.dom),this.queryAll("[name]")}setValues(t){let i=this._getElements();for(let s=0;s<i.length;s++){let r=i[s],n=I.getElement(r);if(!n.hasAttribute("name"))continue;let l=n.getAttribute("name"),o=n.getAttribute("type");t[l]!==void 0&&n.setStoreValue(t[l])}this.setDirty(!1)}getValues(){let t=this._getElements(),i={};for(let s=0;s<t.length;s++){let r=t[s],n=I.getElement(r);if(!n.hasAttribute("name"))continue;let l=n.getAttribute("name"),o=n.getStoreValue();o!==void 0&&(i[l]=o)}return i}submit(t,i){if(!this.validate())return!1;let s=this.getValues();if(i&&!i(s))return!1;let r=new FormData;for(let n in s)s.hasOwnProperty(n)&&r.append(n,s[n]===void 0?"":s[n]);return t.params=r,ff(t)}watchChanges(){this.dom?(this.queryAll("input[name], textarea[name]").forEach(i=>{ut(i).setDomEvent("input",()=>{this.setDirty()})}),this.m_watchChanges=!1):this.m_watchChanges=!0}setDirty(t=!0){this.m_dirty=t}isDirty(){return this.m_dirty}};h(El,"Form");function gf(e){return se({button:e})}h(gf,"EvBtnClick");var Ks=class extends ot{m_icon;m_title;m_form;m_buttons;m_closable;m_movable;m_maximized;m_minimized;m_maximizable;m_minimizable;m_minFormSize;m_rc_max;m_rc_min;m_el_title;m_last_down;m_auto_close;m_ui_title;m_form_cb;constructor(t){let i=t.content;t.content=null;let s=t.width,r=t.height;t.width=void 0,t.height=void 0,super(t),this.m_minFormSize={width:s,height:r},this.enableMask(!0),t.form?ct(t.form)?this.m_form_cb=t.form:(this.m_form=t.form,this.m_form.on("btnClick",n=>this._handleClick(n))):this.m_form=new El({content:i,buttons:t.buttons,disableSuggestions:t.disableSuggestions,btnClick:n=>this._handleClick(n)}),this.m_movable=t.movable,this.m_auto_close=t.autoClose??!0,this.m_icon=t.icon,this.m_title=t.title,this.m_buttons=t.buttons??null,this.m_closable=t.closable??!1,this.m_last_down=0,this.on("size",n=>{this.addClass("@resized"),this.m_form.setStyleValue("width",null),this.m_form.setStyleValue("height",null)}),this.m_maximized=!1,this.m_minimized=!1,this.m_maximizable=!1,this.m_minimizable=!1,t.maximizable!==void 0&&(this.m_maximizable=t.maximizable),t.minimizable!==void 0&&(this.m_minimizable=t.minimizable),t.maximized==!0&&(this.m_maximizable=!0),t.btnClick&&this.on("btnClick",t.btnClick)}componentCreated(){super.componentCreated(),this.m_minFormSize.width&&this.m_form.setStyle({minWidth:this.m_minFormSize.width,width:this.m_minFormSize.width}),this.m_minFormSize.height&&this.m_form.setStyle({minHeight:this.m_minFormSize.height,height:this.m_minFormSize.height});let t=this.getBoundingRect();this.setStyleValue("min-width",t.width),this.setStyleValue("min-height",t.height),this.setStyleValue("width",t.width),this.setStyleValue("height",t.height),this.m_props.dlgWidth&&this.setStyleValue("width",this.m_props.dlgWidth+"%"),this.m_props.dlgHeight&&this.setStyleValue("height",this.m_props.dlgHeight+"%"),this.addClass("@resized"),this.m_el_title&&this.m_el_title.setStyleValue("width","auto"),this.m_props.maximized?(this._maximize(),this.emit("size",dt(null))):this.centerOnScreen()}_handleClick(t){this.emit("btnClick",t),t.defaultPrevented||this.close()}setGeometry(t){t.minimized&&this.m_minimizable?(this._minimize(!1),this.m_rc_min=new ht(t.left,t.top,t.width,t.height),this.displayAt(t.left,t.top,"top-left")):t.maximized&&this.m_maximizable?(this._maximize(!1),this.m_rc_max=new ht(t.left,t.top,t.width,t.height)):(this.setSize(t.width,t.height),this.displayAt(t.left,t.top,"top-left"))}getGeometry(){if(this.m_minimized)return{left:this.m_rc_min.left,top:this.m_rc_min.top,width:this.m_rc_min.width,height:this.m_rc_min.height,minimized:!0,maximized:!1};if(this.m_maximized)return{left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height,minimized:!1,maximized:!0};let t=this.getBoundingRect();return{left:t.left,top:t.top,width:t.width,height:t.height,minimized:!1,maximized:!1}}setSize(t,i){this.setStyle({width:t,height:i}),this.emit("size",dt({width:t,height:i}))}render(){this.m_form_cb&&(this.m_form=this.m_form_cb(),this.m_form.on("btnClick",i=>this._handleClick(i)),this.m_form_cb=null);let t=this.m_icon!==void 0||this.m_closable||this.m_title!==void 0||this.m_movable;this.m_el_title=null,t&&(this.m_el_title=new q({cls:"title",content:[this.m_icon?new ge({icon:this.m_icon}):null,this.m_ui_title=new Z({flex:1,text:this.m_title}),this.m_minimizable?new ge({cls:"min-btn",icon:"var( --x4-icon-window-minimize )",dom_events:{click:()=>this._toggleMin()}}):null,this.m_maximizable?new ge({cls:"max-btn",icon:"var( --x4-icon-window-maximize )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_maximizable?new ge({cls:"res-btn",icon:"var( --x4-icon-window-restore )",dom_events:{click:()=>this._toggleMax()}}):null,this.m_closable?new ge({cls:"close-btn",icon:"var( --x4-icon-rectangle-times )",dom_events:{click:()=>this.close()}}):null]}),this.m_movable&&(Ml()?this.m_el_title.setDomEvent("touchstart",i=>this._mouseDown(i)):this.m_el_title.setDomEvent("mousedown",i=>this._mouseDown(i)))),super.setContent([this.m_el_title,this.m_form])}setContent(t,i=!0){this.m_form.setContent(t,i)}setButtons(t){this.m_form.setButtons(t)}get form(){return this.m_form}close(){this.emit("close",{}),super.close()}_toggleMax(){this.m_maximizable&&(this.m_maximized?(this.removeClass("maximized"),this.setStyle({left:this.m_rc_max.left,top:this.m_rc_max.top,width:this.m_rc_max.width,height:this.m_rc_max.height}),this.m_maximized=!1,this.emit("size",dt(null,"restore"))):(this._maximize(),this.emit("size",dt(null,"maximize"))))}_toggleMin(){this.m_minimizable&&(this.m_minimized?(this.removeClass("minimized"),this.setStyle({width:this.m_rc_min.width,height:this.m_rc_min.height}),this.m_minimized=!1,this.emit("size",dt(null,"restore"))):(this._minimize(),this.emit("size",dt(null,"minimize"))))}_mouseDown(t){let{x:i,y:s}=Xt(t,!0),r=ut(L.body).getBoundingRect(),n=this.getBoundingRect(!0),l=i-n.left,o=s-n.top,a=Date.now(),c=a-this.m_last_down;if(this.m_maximizable&&c<700){this._toggleMax();return}if(this.m_last_down=a,this.m_maximized)return;let u=h((_,p)=>{_>r.right?_=r.right:_<r.left&&(_=r.left),p>r.bottom?p=r.bottom:p<r.top&&(p=r.top);let v=_-l,g=p-o;this.setStyle({left:v,top:g})},"__move");I.setCapture(this,_=>{if(_.type=="mousemove"){let p=_;u(p.clientX,p.clientY)}else if(_.type=="touchmove"){let p=_;p.touches.length==1&&u(p.touches[0].clientX,p.touches[0].clientY)}else _.type=="mouseup"||_.type=="touchend"?(I.releaseCapture(),this.emit("move",uf(null))):_.type=="mousedown"||_.type=="touchstart"})}maximize(){!this.m_maximizable||this.m_maximized||(this._maximize(),this.emit("size",dt(null)))}_maximize(t=!0){t&&(this.m_rc_max=this.getBoundingRect(!1)),this.addClass("maximized"),this.m_maximized=!0,this.setStyle({left:void 0,top:void 0,width:void 0,height:void 0})}minimize(){!this.m_minimizable||this.m_minimized||(this._minimize(),this.emit("size",dt(null)))}_minimize(t=!0){t&&(this.m_rc_min=this.getBoundingRect(!1)),this.addClass("minimized"),this.m_minimized=!0,this.setStyle({width:void 0,height:void 0})}set title(t){this.m_title=t,this.m_ui_title&&(this.m_ui_title.text=t)}itemWithName(t){let i=this.dom.querySelector(`[name="${t}"]`);return i?I.getElement(i):null}getValues(){return this.m_form.getValues()}validate(){return this.m_form.validate()}};h(Ks,"Dialog");var Dc=class extends Ae{m_colorSel;m_colorHue;m_colorAlpha;m_sample;m_selMark;m_hueMark;m_alphaMark;m_baseHSV;m_baseColor;m_transpCk;m_colorEdit;m_palmode;constructor(t){super(t),this.m_palmode=Dc.last_palmode,this.setDomEvent("contextmenu",i=>this._showCtx(i))}_showCtx(t){let i=new Vt({items:[new Ii({text:"Palette",checked:this.m_palmode,click:()=>{this.m_palmode=!this.m_palmode,Dc.last_palmode=this.m_palmode,this.update()}})]}),s=Xt(t,!0);i.displayAt(s.x,s.y)}render(t){if(this.m_baseColor=t.color,this.m_baseHSV=De.toHSV(this.m_baseColor),this.m_palmode){let a=function(c){l=[],c.forEach(u=>{let _=new De(u.hex),p=_.value()==o,v=Fa("hclr-box xbox",{selected:p}),g=new I({cls:v,style:{backgroundColor:_.toHex(),color:De.contrastColor(_).toHex()},data:{color:_.value()},content:_.toHex()});l.push(g),p&&(r=g)}),s&&s.itemWithId("vsel").setContent(l)};var i=a;h(a,"fillSubs"),this.addClass("pal-mode");let s=null,r=null,n=[],l=[],o=this.m_baseColor.value();d2.forEach(c=>{let u=c.variations[4].hex,_=u===o;_||(_=c.variations.some(g=>{if(new De(g.hex).value()===o)return!0}));let p=Fa("clr-box xbox",{selected:_}),v=new I({cls:p,style:{backgroundColor:new De(u).toHex()},data:{color:u,main:c.variations}});_&&a(c.variations),n.push(v)}),s=new we({content:[new q({id:"hsel",content:n}),new we({id:"vsel",flex:1,content:l})]}),this.m_colorEdit=new Ye({cls:"hexv",value:"",attrs:{spellcheck:!1},change:c=>{let u=new De(c.value);u&&(this.m_baseColor=u,this.m_baseHSV=De.toHSV(u),this._updateColor(!1))}}),this.m_transpCk=new qs({cls:"transp",text:"transparent",change:c=>{this.m_baseHSV.a=c.value?0:1,this._updateColor()}}),this.setContent([s,this.m_transpCk,this.m_colorEdit]),s.setDomEvent("click",c=>{r&&(r.removeClass("selected"),r=null);let u=I.getElement(c.target,"xbox");if(u){let _=u.getData("main");if(_)a(_);else{let p=new De(u.getData("color"));this.m_baseColor=p,this.m_baseHSV=De.toHSV(p),this._updateColor(),r=u,u.addClass("selected")}}})}else this.removeClass("pal-mode"),this.m_selMark=new I({cls:"marker"}),this.m_colorSel=new I({cls:"sel",content:[new I({cls:"@fit light"}),new I({cls:"@fit dark"}),this.m_selMark]}),this.m_hueMark=new I({cls:"marker"}),this.m_colorHue=new I({cls:"hue",content:[this.m_hueMark]}),this.m_sample=new I({cls:"sample"}),t.hasAlpha?(this.addClass("with-alpha"),this.m_alphaMark=new I({cls:"marker"}),this.m_colorAlpha=new I({cls:"alpha",content:[new I({cls:"bk @fit",ref:"color"}),this.m_alphaMark]})):(this.removeClass("with-alpha"),this.m_transpCk=new qs({cls:"transp",text:"transparent",change:s=>{this.m_baseHSV.a=s.value?0:1,this._updateColor()}})),this.m_colorEdit=new Ye({cls:"hexv",value:"",attrs:{spellcheck:!1},change:s=>{let r=new De(s.value);r&&(this.m_baseColor=r,this.m_baseHSV=De.toHSV(r),this._updateColor(!1))}}),this.setContent([this.m_colorSel,this.m_colorHue,this.m_colorAlpha,this.m_transpCk,this.m_colorEdit,this.m_sample]),this.m_colorSel.setDomEvent("mousedown",s=>{I.setCapture(this,r=>this._selChange(r))}),this.m_colorHue.setDomEvent("mousedown",s=>{I.setCapture(this,r=>this._hueChange(r))}),t.hasAlpha&&this.m_colorAlpha.setDomEvent("mousedown",s=>{I.setCapture(this,r=>this._alphaChange(r))}),this._updateColor()}set color(t){this.m_baseColor=t,this.m_baseHSV=De.toHSV(this.m_baseColor),this._updateColor()}get color(){return this.m_baseColor}_selChange(t){let i=Xt(t,!0);console.log(i);let s=this.m_colorSel.getBoundingRect();this.m_props.hasAlpha||(this.m_baseHSV.a=1),this.m_baseHSV.s=cn((i.x-s.left)/s.width,0,1),this.m_baseHSV.v=1-cn((i.y-s.top)/s.height,0,1),this._updateColor(),(t.type=="mouseup"||t.type=="touchend")&&I.releaseCapture()}_hueChange(t){let i=Xt(t,!0),s=this.m_colorHue.getBoundingRect();this.m_baseHSV.h=cn((i.y-s.top)/s.height,0,1),this._updateColor(),(t.type=="mouseup"||t.type=="touchend")&&I.releaseCapture()}_alphaChange(t){let i=Xt(t,!0),s=this.m_colorAlpha.getBoundingRect();this.m_baseHSV.a=cn((i.x-s.left)/s.width,0,1),this._updateColor(),(t.type=="mouseup"||t.type=="touchend")&&I.releaseCapture()}_updateColor(t=!0){let i;if(this.m_palmode)this.m_transpCk.check=this.m_baseHSV.a==0;else{if(i=De.fromHSV(this.m_baseHSV.h,1,1,1),this.m_colorSel.setStyleValue("backgroundColor",i.toString()),i=De.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,1),this.m_sample.setStyleValue("backgroundColor",i.toString()),this.m_props.hasAlpha){let s=`linear-gradient(to right, rgba(0,0,0,0) 0%, ${i.toString()} 100%)`;this.m_colorAlpha.itemWithRef("color").setStyleValue("backgroundImage",s)}this.m_selMark.setStyle({left:this.m_baseHSV.s*100+"%",top:100-this.m_baseHSV.v*100+"%"}),this.m_hueMark.setStyle({top:this.m_baseHSV.h*100+"%"}),this.m_props.hasAlpha?this.m_alphaMark.setStyle({left:this.m_baseHSV.a*100+"%"}):this.m_transpCk.check=this.m_baseHSV.a==0}i=De.fromHSV(this.m_baseHSV.h,this.m_baseHSV.s,this.m_baseHSV.v,this.m_baseHSV.a),this.m_baseColor=i,t&&(this.m_colorEdit.value=i.alpha()==1?i.toHex():i.toString()),this._change()}_change(){this.emit("change",ee(this.m_baseColor))}},kl=Dc;h(kl,"ColorPicker"),X(kl,"last_palmode",!1);var pr=class extends Ks{m_picker;constructor(t){t.icon=void 0,t.buttons=void 0,super(t),this.mapPropEvents(t,"change"),this.m_picker=new kl({color:t.color,hasAlpha:t.hasAlpha,style:{padding:8},width:250,height:250});let i=this._makeCustoms(t.cust_colors);this.form.updateContent([new we({content:[this.m_picker,i]})],["ok","cancel"]),this.on("btnClick",s=>{s.button=="ok"&&this.emit("change",ee(this.m_picker.color))})}_makeCustoms(t){let i=null;if(t&&t.length>0){let s=[];for(let r=0;r<t.length;r+=8){let n=[];for(let l=0;l<8;l++){let o=r+l,a=t[o];n.push(new Z({cls:"cust-cc",text:"",flex:1,style:{backgroundColor:a?a.toString():"transparent"},tooltip:a?a.toString():void 0,dom_events:{click:()=>{a&&(this.m_picker.color=a,this.emit("change",ee(a)),this.close())}}}))}s.push(new q({cls:"line",content:n}))}i=new we({cls:"customs",content:s})}return i}set color(t){this.m_picker.color=t}get color(){return this.m_picker.color}static show(t){let i;return re(t)?i=new pr({color:new De(t)}):i=new pr(t),i.show(),i}};h(pr,"ColorPickerBox");var Sc=class extends q{constructor(t){super(t),this.mapPropEvents(t,"change")}render(t){let i=t.color,s;this._isTransp(i)?(i=De.NONE,s="black"):s=De.contrastColor(i).toString(),this.setContent([t.label?new Z({cls:"label",text:t.label,flex:t.labelWidth<0?-t.labelWidth:void 0,width:t.labelWidth>=0?t.labelWidth:void 0}):null,new I({flex:1,content:[new Z({cls:"alpha @fit",text:""}),new Z({cls:"value @fit",text:t.displayValue===!1?"":i.toHex(),style:{backgroundColor:i.toString(),color:s},dom_events:{click:()=>this._showPicker()}})]})]),t.displayValue===!1&&this.setStyleValue("background-image","url( 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAEsmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIKICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIKICAgIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIgogICAgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSIKICAgdGlmZjpJbWFnZVdpZHRoPSIxMCIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgeG1wOk1vZGlmeURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiPgogICA8eG1wTU06SGlzdG9yeT4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJwcm9kdWNlZCIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWZmaW5pdHkgRGVzaWduZXIgMS45LjAiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/Pn8+b7YAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRy0tCQRSHv7Qwyh5gRIsWEtZKwwyiNi2UXlAt1CCrjV5fgdrlXiOibdBWKIja9FrUX1DboHUQFEUQ7YLWRW0qbueqoESe4cz55jdzDjNnwBLOKFm93gvZXF4LTvid85EFp+0FK5204sURVXR1JjQepqZ93lNnxluPWav2uX+tOZ7QFahrFB5VVC0vPCk8vZZXTd4R7lDS0bjwmbBbkwsK35l6rMSvJqdK/G2yFg4GwNIu7ExVcayKlbSWFZaX48pmVpXyfcyX2BO5uZDEHvFudIJM4MfJFGMEGGKAEZmH8OCjX1bUyPcW82dZkVxFZpV1NJZJkSaPW9RVqZ6QmBQ9ISPDutn/v33Vk4O+UnW7HxqeDeO9F2zb8FMwjK8jw/g5BusTXOYq+SuHMPwheqGiuQ6gbRPOrypabBcutqDrUY1q0aJkFbckk/B2Ci0RcNxA02KpZ+V9Th4gvCFfdQ17+9An59uWfgF7Hmfv4QYbGAAAAAlwSFlzAAALEwAACxMBAJqcGAAAACdJREFUGJVjbGhoYEAC9fX1yFwmBryAptKM////R+Y3NjbSzW4C0gAo9QeQBmhTIwAAAABJRU5ErkJggg=='"),this._setTabIndex(t.tabIndex)}set value(t){this.m_props.color=t,this.update()}get value(){return this.m_props.color}set custom_colors(t){this.m_props.cust_colors=t}_showPicker(){let t=new pr({color:this.m_props.color,cust_colors:this.m_props.cust_colors,hasAlpha:this.m_props.hasAlpha,events:{change:s=>{this.m_props.color=s.value,this._change(),this.update()}}}),i=this.getBoundingRect();t.displayAt(i.left,i.bottom,"tl")}_change(){this.emit("change",ee(this.m_props.color))}_isTransp(t){return!t.alpha()}};h(Sc,"ColorPickerEditor");var d2=[{color:"Red",variations:[{weight:50,hex:16772078},{weight:100,hex:16764370},{weight:200,hex:15702682},{weight:300,hex:15037299},{weight:400,hex:15684432},{weight:500,hex:16007990},{weight:600,hex:15022389},{weight:700,hex:13840175},{weight:800,hex:12986408},{weight:900,hex:12000284}]},{color:"Pink",variations:[{weight:50,hex:16573676},{weight:100,hex:16301008},{weight:200,hex:16027569},{weight:300,hex:15753874},{weight:400,hex:15483002},{weight:500,hex:15277667},{weight:600,hex:14162784},{weight:700,hex:12720219},{weight:800,hex:11342935},{weight:900,hex:8916559}]},{color:"Purple",variations:[{weight:50,hex:15984117},{weight:100,hex:14794471},{weight:200,hex:13538264},{weight:300,hex:12216520},{weight:400,hex:11225020},{weight:500,hex:10233776},{weight:600,hex:9315498},{weight:700,hex:8069026},{weight:800,hex:6953882},{weight:900,hex:4854924}]},{color:"Deep Purple",variations:[{weight:50,hex:15591414},{weight:100,hex:13747433},{weight:200,hex:11771355},{weight:300,hex:9795021},{weight:400,hex:8280002},{weight:500,hex:6765239},{weight:600,hex:6174129},{weight:700,hex:5320104},{weight:800,hex:4532128},{weight:900,hex:3218322}]},{color:"Indigo",variations:[{weight:50,hex:15264502},{weight:100,hex:12962537},{weight:200,hex:10463450},{weight:300,hex:7964363},{weight:400,hex:6056896},{weight:500,hex:4149685},{weight:600,hex:3754411},{weight:700,hex:3162015},{weight:800,hex:2635155},{weight:900,hex:1713022}]},{color:"Blue",variations:[{weight:50,hex:14938877},{weight:100,hex:12312315},{weight:200,hex:9489145},{weight:300,hex:6600182},{weight:400,hex:4367861},{weight:500,hex:2201331},{weight:600,hex:2001125},{weight:700,hex:1668818},{weight:800,hex:1402304},{weight:900,hex:870305}]},{color:"Light Blue",variations:[{weight:50,hex:14808574},{weight:100,hex:11789820},{weight:200,hex:8508666},{weight:300,hex:5227511},{weight:400,hex:2733814},{weight:500,hex:240116},{weight:600,hex:236517},{weight:700,hex:166097},{weight:800,hex:161725},{weight:900,hex:87963}]},{color:"Cyan",variations:[{weight:50,hex:14743546},{weight:100,hex:11725810},{weight:200,hex:8445674},{weight:300,hex:5099745},{weight:400,hex:2541274},{weight:500,hex:48340},{weight:600,hex:44225},{weight:700,hex:38823},{weight:800,hex:33679},{weight:900,hex:24676}]},{color:"Teal",variations:[{weight:50,hex:14742257},{weight:100,hex:11722715},{weight:200,hex:8440772},{weight:300,hex:5093036},{weight:400,hex:2533018},{weight:500,hex:38536},{weight:600,hex:35195},{weight:700,hex:31083},{weight:800,hex:26972},{weight:900,hex:19776}]},{color:"Green",variations:[{weight:50,hex:15267305},{weight:100,hex:13166281},{weight:200,hex:10868391},{weight:300,hex:8505220},{weight:400,hex:6732650},{weight:500,hex:5025616},{weight:600,hex:4431943},{weight:700,hex:3706428},{weight:800,hex:3046706},{weight:900,hex:1793568}]},{color:"Light Green",variations:[{weight:50,hex:15857897},{weight:100,hex:14478792},{weight:200,hex:12968357},{weight:300,hex:11457921},{weight:400,hex:10275941},{weight:500,hex:9159498},{weight:600,hex:8172354},{weight:700,hex:6856504},{weight:800,hex:5606191},{weight:900,hex:3369246}]},{color:"Lime",variations:[{weight:50,hex:16382951},{weight:100,hex:15791299},{weight:200,hex:15134364},{weight:300,hex:14477173},{weight:400,hex:13951319},{weight:500,hex:13491257},{weight:600,hex:12634675},{weight:700,hex:11514923},{weight:800,hex:10394916},{weight:900,hex:8550167}]},{color:"Yellow",variations:[{weight:50,hex:16776679},{weight:100,hex:16775620},{weight:200,hex:16774557},{weight:300,hex:16773494},{weight:400,hex:16772696},{weight:500,hex:16771899},{weight:600,hex:16635957},{weight:700,hex:16498733},{weight:800,hex:16361509},{weight:900,hex:16088855}]},{color:"Amber",variations:[{weight:50,hex:16775393},{weight:100,hex:16772275},{weight:200,hex:16769154},{weight:300,hex:16766287},{weight:400,hex:16763432},{weight:500,hex:16761095},{weight:600,hex:16757504},{weight:700,hex:16752640},{weight:800,hex:16748288},{weight:900,hex:16740096}]},{color:"Orange",variations:[{weight:50,hex:16774112},{weight:100,hex:16769202},{weight:200,hex:16764032},{weight:300,hex:16758605},{weight:400,hex:16754470},{weight:500,hex:16750592},{weight:600,hex:16485376},{weight:700,hex:16088064},{weight:800,hex:15690752},{weight:900,hex:15094016}]},{color:"Deep Orange",variations:[{weight:50,hex:16509415},{weight:100,hex:16764092},{weight:200,hex:16755601},{weight:300,hex:16747109},{weight:400,hex:16740419},{weight:500,hex:16733986},{weight:600,hex:16011550},{weight:700,hex:15092249},{weight:800,hex:14172949},{weight:900,hex:12531212}]},{color:"Brown",variations:[{weight:50,hex:15723497},{weight:100,hex:14142664},{weight:200,hex:12364452},{weight:300,hex:10586239},{weight:400,hex:9268835},{weight:500,hex:7951688},{weight:600,hex:7162945},{weight:700,hex:6111287},{weight:800,hex:5125166},{weight:900,hex:4073251}]},{color:"Grey",variations:[{weight:50,hex:16448250},{weight:100,hex:16119285},{weight:200,hex:15658734},{weight:300,hex:14737632},{weight:400,hex:12434877},{weight:500,hex:10395294},{weight:600,hex:7697781},{weight:700,hex:6381921},{weight:800,hex:4342338},{weight:900,hex:2171169}]},{color:"Blue Grey",variations:[{weight:50,hex:15527921},{weight:100,hex:13621468},{weight:200,hex:11583173},{weight:300,hex:9479342},{weight:400,hex:7901340},{weight:500,hex:6323595},{weight:600,hex:5533306},{weight:700,hex:4545124},{weight:800,hex:3622735},{weight:900,hex:2503224}]},{color:"Grey",variations:[{weight:50,hex:16777215},{weight:100,hex:14737632},{weight:200,hex:12895428},{weight:300,hex:11053224},{weight:400,hex:9211020},{weight:500,hex:7368816},{weight:600,hex:5526612},{weight:700,hex:3684408},{weight:800,hex:1842204},{weight:900,hex:0}]}];function va(e,t){return se({type:e,id:t})}h(va,"EvDataChange");var Ac=class{name;id;fields;constructor(t){this.name=t,this.id=void 0,this.fields=[]}};h(Ac,"MetaInfos");var Ic=Symbol("metaField");function Mc(e,t=!0){let i=e.constructor,s=i.hasOwnProperty(Ic)?i[Ic]:void 0;if(s===void 0){t||console.assert(s!==void 0),s=new Ac(i.name);let r=Object.getPrototypeOf(i);if(r!=tn){let n=r[Ic];s.fields=[...n.fields,...s.fields],console.assert(s.id===void 0,"cannot define mutiple record id"),s.id||(s.id=n.id)}e.constructor[Ic]=s}return s}h(Mc,"_getMetas");var xv;(c=>{function e(){return(u,_)=>{let p=Mc(u);p.fields.push({name:_,type:"any",required:!0}),p.id=_}}c.id=e,h(e,"id");function t(u){return(_,p)=>{Mc(_).fields.push({name:p,...u})}}c.field=t,h(t,"field");function i(u){return t({...u,type:"string"})}c.string=i,h(i,"string");function s(u){return t({...u,type:"int"})}c.int=s,h(s,"int");function r(u){return t({...u,type:"float"})}c.float=r,h(r,"float");function n(u){return t({...u,type:"bool"})}c.bool=n,h(n,"bool");function l(u){return t({...u,type:"date"})}c.date=l,h(l,"date");function o(u){return t({...u,type:"calc"})}c.calc=o,h(o,"calc");function a(u,_){return c.field({..._,type:"array",model:new u})}c.array=a,h(a,"array")})(xv||={});var tn=class{constructor(t,i){t!==void 0&&this.unSerialize(t,i)}clone(t){let i=new this.constructor;return t&&i.unSerialize(t),i}getID(){let t=Mc(this,!1);return this[t.id]}getFields(){return Mc(this,!1).fields}validate(){let t=null;return this.getFields().forEach(s=>{s.required&&!this.getField(s.name)&&(t&&(t=[]),t.push(new Error(`field ${s.name} is required.`)))}),t}getFieldIndex(t){return this.getFields().findIndex(s=>s.name==t)}serialize(){let t={};return this.getFields().forEach(i=>{i.calc===void 0&&(t[i.name]=t[i.name])}),t}unSerialize(t,i){let s=this.getFields();return s.forEach(r=>{let n=t[r.name];n!==void 0&&(this[r.name]=this._convertField(r,n))}),i!==void 0?this[s[0].name]=i:console.assert(this.getID()!==void 0),this}_convertField(t,i){switch(t.type){case"float":{let s=typeof i=="number"?i:parseFloat(i);if(t.prec!==void 0){let r=Math.pow(10,t.prec);s=Math.round(s*r)/r}return s}case"int":return typeof i=="number"?i:parseInt(i);case"date":return re(i)?new Date(i):i;case"array":{let s=[];if(t.model)return i.forEach(r=>{s.push(t.model.clone(r))}),s;break}}return i}getRaw(t){let i,s=this.getFields();if(typeof t=="string"){if(i=s.findIndex(n=>n.name==t),i<0){console.assert(!1,"unknown field: "+t);return}}else if(t>=0&&t<s.length)i=t;else{console.assert(!1,"bad field name: "+t);return}let r=s[i];return r.calc!==void 0?r.calc(this):this[r.name]}setRaw(t,i){this[t]=i}getField(t){let i=this.getRaw(t);return i==null?"":""+i}setField(t,i){let s=this.getFields(),r=s.findIndex(l=>l.name==t);if(r<0){console.assert(!1,"unknown field: "+t);return}let n=s[r];if(n.calc!==void 0){console.assert(!1,"cannot set calc field: "+t);return}this.setRaw(n.name,i)}};h(tn,"Record");var Sl=class extends tn{m_data;m_fid;constructor(t){super(),this.m_data=t}getID(){if(!this.m_fid){let t=Object.keys(this.m_data);this.m_fid=t[0]}return this.m_data[this.m_fid]}getFields(){return Object.keys(this.m_data).map(s=>({name:s}))}getRaw(t){return this.m_data[t]}setRaw(t,i){this.m_data[t]=i}clone(t){return new Sl({...t})}};h(Sl,"AutoRecord");var ba=class extends ii{constructor(t){super(t)}load(t){t&&(this.m_props.url=t),this._refresh()}_refresh(t=0){let i=h(async()=>{let s=this.m_props.url;this.m_props.params&&(s+="?"+this.m_props.params.join("&"));let r=await fetch(s);if(r.ok){let n=await r.json(),l=n;this.m_props.solver&&(l=this.m_props.solver(l)),this.emit("change",ee(l,n))}},"load");t?setTimeout(i,t):i()}};h(ba,"DataProxy");var gr=class extends _i{m_model;m_fields;m_records;m_proxy;m_rec_index;constructor(t){super(),this.m_fields=void 0,this.m_records=[],this.m_rec_index=null,this.m_model=t.model,this.m_fields=t.model.getFields(),t.data?this.setRawData(t.data):t.url&&(this.m_proxy=new ba({url:t.url,solver:t.solver,events:{change:i=>{this.setData(i.value)}}}),this.m_proxy.load())}load(t){this.m_proxy.load(t)}reload(){this.m_proxy.load()}setData(t){let i=[];t.forEach(s=>{i.push(this.m_model.clone(s))}),this.setRawData(i)}setRawData(t){this.m_records=t,this._rebuildIndex(),this.emit("data_change",va("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(t){let i=t.getID(),s=this.indexOfId(i);return s<0?!1:(this.m_records[this.m_rec_index[s]]=t,this.emit("data_change",va("update",i)),!0)}append(t){t instanceof tn||(t=this.m_model.clone().unSerialize(t)),console.assert(t.getID()),this.m_records.push(t),this._rebuildIndex(),this.emit("data_change",va("create",t.getID()))}getMaxId(){let t;return this.m_records.forEach(i=>{let s=i.getID();(t===void 0||t<s)&&(t=s)}),t}delete(t){let i=this.indexOfId(t);return i<0?!1:(i=this.m_rec_index[i],this.m_records.splice(i,1),this._rebuildIndex(),this.emit("data_change",va("delete",t)),!0)}get count(){return this.m_rec_index?this.m_rec_index.length:this.m_records.length}get fields(){return this.m_fields}indexOfId(t){for(let i=this.count,s=0;i!=0;i>>=1){let r=s+(i>>1),n=this.m_rec_index[r],l=this.m_records[n].getID();if(l==t)return r;l<t&&(s=r+1,i--)}return-1}getById(t){let i=this.indexOfId(t);return i<0?null:(i=this.m_rec_index[i],this.m_records[i])}getByIndex(t){let i=this.m_rec_index[t];return this._getRecord(i)}_getRecord(t){return this.m_records[t]??null}moveTo(t){t.setRawData(this.m_records)}createView(t){let i={...t,store:this};return new xa(i)}createIndex(t){if(t&&t.op==="empty-result")return new Uint32Array(0);let i=new Uint32Array(this.m_records.length),s=0;if(!t)this.forEach((_,p)=>{i[s++]=p});else if(typeof t.op=="function"){let _=t.op;this.forEach((p,v)=>{p&&_(p)&&(i[s++]=v)})}else{let v=function(D){return D<p},g=function(D){return D<=p},x=function(D){return D==p},E=function(D){return D!=p},y=function(D){return D>=p},k=function(D){return D>p},A=function(D){return w.lastIndex=-1,w.test(D)};var r=v,n=g,l=x,o=E,a=y,c=k,u=A;h(v,"_lt"),h(g,"_le"),h(x,"_eq"),h(E,"_neq"),h(y,"_ge"),h(k,"_gt"),h(A,"_re");let _=this.m_model.getFieldIndex(t.field);if(_<0)return console.assert(!1,"unknown field name in filter"),new Uint32Array(0);let p=t.value;re(p)&&!t.caseSensitive&&(p=p.toUpperCase());let S,w;if(p instanceof RegExp)w=p,S=A;else switch(t.op){case"<":{S=v;break}case"<=":{S=g;break}case"=":{S=x;break}case">=":{S=y;break}case">":{S=k;break}case"<>":{S=E;break}}this.forEach((D,R)=>{if(!D)return;let C=D.getRaw(_);C==null?C="":(C=""+C,t.caseSensitive||(C=C.toUpperCase())),S(C)&&(i[s++]=R)})}return i.slice(0,s)}sortIndex(t,i){let s=0,r=[];if(i===null?r.push({fidx:0,asc:!0}):r=i.map(n=>{let l=this.m_model.getFieldIndex(n.field);return l==-1&&(console.assert(!1,"unknown field name in sort"),s++),{fidx:l,asc:n.ascending}}),s||r.length==0)return t;if(r.length==1){let n=r[0].fidx;t.sort((l,o)=>{let a=this.getByIndex(l).getRaw(n)??"",c=this.getByIndex(o).getRaw(n)??"";return a>c?1:a<c?-1:0}),r[0].asc||t.reverse()}else t.sort((n,l)=>{for(let o=0;o<r.length;o++){let a=r[o].fidx,c=r[o].asc?1:-1,u=this.getByIndex(n).getRaw(a)??"",_=this.getByIndex(l).getRaw(a)??"";if(u>_)return c;if(u<_)return-c}return 0});return t}forEach(t){this.m_rec_index?this.m_rec_index.some((i,s)=>{if(t(this.m_records[i],s))return s}):this.m_records.some((i,s)=>{if(i&&t(i,s))return s})}export(){return this.m_records}changed(){this.emit("data_change",va("change"))}};h(gr,"DataStore");function wa(e){return se({action:e})}h(wa,"EvViewChange");var xa=class extends ii{m_index;m_store;m_sort;m_filter;constructor(t){super(t),this.m_store=t.store,this.m_index=null,this.m_filter=null,this.m_sort=null,this.filter(t.filter),t.order?re(t.order)?this.sort([{field:t.order,ascending:!0}]):mt(t.order)?this.sort(t.order):this.sort([t.order]):this.sort(null),this.m_store.on("data_change",i=>this._storeChange(i))}_storeChange(t){this._filter(this.m_filter,t.type!="change"),this._sort(this.m_sort,t.type!="change"),this.emit("view_change",wa("change"))}filter(t){return this.m_index=null,this._filter(t,!0)}_filter(t,i){return this.m_index=this.m_store.createIndex(t),this.m_filter=t,this.m_sort&&this.sort(this.m_sort),i&&this.emit("view_change",wa("filter")),this.m_index.length}sort(t){this._sort(t,!0)}_sort(t,i){this.m_index=this.m_store.sortIndex(this.m_index,t),this.m_sort=t,i&&this.emit("view_change",wa("sort"))}get store(){return this.m_store}get count(){return this.m_index.length}indexOfId(t){let i=this.m_store.indexOfId(t);return this.m_index.findIndex(s=>s===i)}getByIndex(t){if(t>=0&&t<this.m_index.length){let i=this.m_index[t];return this.m_store.getByIndex(i)}return null}getById(t){return this.m_store.getById(t)}changed(){this.emit("view_change",wa("change"))}forEach(t){debugger;this.m_index.some(i=>{let s=this.m_store.getByIndex(i);if(s&&t(s,i))return i})}};h(xa,"DataView");var sn=class extends q{m_ui_input;m_ui_button;m_popup;m_lockpop;m_lockchg;m_popvis;m_selection;constructor(t){super(t),t.editable||this.setDomEvent("keypress",()=>this.showPopup()),this.setDomEvent("click",()=>{this.m_props.editable&&this.m_ui_input.focus(),this.showPopup()}),this.setDomEvent("keydown",i=>this._onKey(i)),this.mapPropEvents(t,"selectionChange"),this.m_popvis=!1,this.m_lockpop=!1,this.m_lockchg=!1}_onKey(t){this.m_popvis&&(t.key=="ArrowUp"||t.key=="ArrowDown"?(this.m_lockpop=!0,this.m_popup.handleKey(t),this.m_lockpop=!1,t.preventDefault(),t.stopPropagation()):t.key=="Escape"&&(this._hidePopup(),t.preventDefault(),t.stopPropagation()))}set items(t){this.m_props.items=t,this.m_popup&&(this.m_popup.items=t)}render(t){if(t.renderer)this.m_ui_input=new I({flex:1,cls:"@fake-input @hlayout",tabIndex:1});else{let n=new Ke({flex:1,readOnly:!this.m_props.editable,tabIndex:0,name:t.name,value_hook:{get:()=>this.value,set:l=>{this.value=l}},dom_events:{focus:()=>{this.m_props.editable&&n.value.length==0&&this.showPopup()},input:()=>{if(this.m_lockchg)return;let l=n.value;this.m_selection={id:void 0,text:l};let o=this.showPopup();o&&o.length&&o[0].text==l&&(this.m_selection={id:o[0].id,text:l})}}});this.m_ui_input=n}let i,s,r=t.labelWidth??0;r>0?i=r:r<0&&(s=-r),this.setContent([new Z({cls:"label1"+(t.label?"":" @hidden"),text:t.label,width:i,flex:s,align:t.labelAlign}),new q({flex:1,content:[this.m_ui_input,this.m_ui_button=new Se({cls:"gadget",icon:"var( --x4-icon-angle-down )",tabIndex:!1,click:()=>{this.showPopup(!1)},dom_events:{focus:()=>{this.dom.focus()}}})]})]),t.value!==void 0&&(this.value=t.value)}componentDisposed(){this.m_popup&&this.m_popup.close(),super.componentDisposed()}showPopup(t=!0){let i=this.m_props;if(i.readOnly||this.hasClass("@disable"))return null;let s=i.items;if(ct(s)){let l=t?this.m_ui_input.value:null;s=s(l)}if(s.length==0)return null;if(!this.m_popup){let l=this.getComputedStyle(),o=l.value("fontFamily"),a=l.value("fontSize");this.m_popup=new _r({cls:"@combo-popup",populate:i.populate,renderItem:this.m_props.renderer,selectionChange:c=>{this._selectItem(c),this.m_lockpop||(this._hidePopup(),this.focus())},cancel:c=>this.signal("cancel",c),style:{fontFamily:o,fontSize:a}})}this.m_popup.items=s;let r=this.m_ui_button.getBoundingRect(),n=this.m_ui_input.getBoundingRect();return this.m_popup.setStyle({minWidth:r.right-n.left}),this.m_popup.displayAt(n.left,n.bottom),this.m_popvis=!0,this.startTimer("focus-check",100,!0,()=>this._checkFocus()),this.value!==void 0&&(this.m_popup.selection=this.value),s}_selectItem(t){let i=t.selection;i&&(this.m_lockchg=!0,this._setInput(i,!0),this.m_lockchg=!1,this.m_selection={id:i.id,text:i.text},this.emit("selectionChange",Bt(i)),this.emit("change",ee(i.id)))}_setInput(t,i=!1){t?this.m_ui_input?this.m_ui_input instanceof Ke?(this.m_ui_input.value=t.text,i&&this.m_ui_input.dom.dispatchEvent(new Event("input"))):this.m_ui_input.setContent(this.m_props.renderer(t)):this.m_props.value=t.id:this.m_ui_input&&this.m_ui_input instanceof Ke&&(this.m_ui_input.value="")}get value(){return this.m_selection?this.m_selection.id:void 0}get valueText(){return this.m_selection?this.m_selection.text:this.m_props.editable?this.m_ui_input.value:""}set value(t){let i=this.m_props.items;ct(i)&&(i=i(null)),i.some(r=>{if(r.id===t)return this._setInput(r),this.m_selection=r,!0})||(this._setInput(null),this.m_selection=null)}get input(){return this.m_ui_input instanceof Ke?this.m_ui_input:null}_checkFocus(){let t=document.activeElement;this.dom&&this.dom.contains(t)||t==document.body||this.m_popup&&this.m_popup.dom&&this.m_popup.dom.contains(t)||this._hidePopup()}_hidePopup(){this.m_popvis&&(this.m_popup.close(),this.m_popvis=!1,this.stopTimer("focus-check"))}static storeProxy(t){let i=t.store instanceof gr?t.store.createView():t.store;return()=>{let s=new Array(t.store.count);return t.store.forEach((r,n)=>{s[n]={id:r.getID(),text:t.display(r)}}),s}}focus(){this.m_props.editable?this.m_ui_input.focus():super.focus()}};h(sn,"ComboBox");var vf=Symbol("x-drag-cb"),Pc=class{dragSource;dragGhost;dropTarget;notified;timer;registerDraggableElement(t){t.setDomEvent("dragstart",i=>{this.dragSource=t,this.dragGhost=t.dom.cloneNode(!0),this.dragGhost.classList.add("dragged"),L.body.appendChild(this.dragGhost),t.addClass("dragging"),i.dataTransfer.setData("text/string","1"),i.dataTransfer.setDragImage(new Image,0,0),i.stopPropagation()}),t.setDomEvent("drag",i=>{this.dragGhost.style.left=i.pageX+"px",this.dragGhost.style.top=i.pageY+"px"}),t.setDomEvent("dragend",i=>{t.removeClass("dragging"),this.dragGhost.remove()}),t.setAttribute("draggable","true")}registerDropTarget(t,i,s){let r=h(a=>{if(s&&!s(this.dragSource)){console.log("reject ",t),a.dataTransfer.dropEffect="none";return}console.log("accepted ",t),a.preventDefault(),a.dataTransfer.dropEffect="copy"},"dragEnter"),n=h(a=>{if(s&&!s(this.dragSource)){console.log("reject ",t),a.dataTransfer.dropEffect="none";return}if(a.preventDefault(),this.dropTarget!=t&&(this.dropTarget=t,this._startCheck()),this.dropTarget){let c={pt:new At(a.pageX,a.pageY),data:a.dataTransfer};i("drag",this.dragSource,c)}a.dataTransfer.dropEffect="copy"},"dragOver"),l=h(a=>{this.dropTarget=null,a.preventDefault()},"dragLeave"),o=h(a=>{let c={pt:new At(a.pageX,a.pageY),data:a.dataTransfer};i("drop",this.dragSource,c),this.dropTarget=null,t.removeClass("drop-over"),a.preventDefault()},"drop");t.setDomEvent("dragenter",r),t.setDomEvent("dragover",n),t.setDomEvent("dragleave",l),t.setDomEvent("drop",o),t.setData(vf,i)}_startCheck(){this.timer&&(clearInterval(this.timer),this._check()),this.timer=setInterval(()=>this._check(),300)}_check(){let t=h(s=>{s.removeClass("drop-over"),s.getData(vf)("leave",this.dragSource)},"leaving"),i=h(s=>{s.addClass("drop-over"),s.getData(vf)("enter",this.dragSource)},"entering");this.dropTarget?(!this.notified||this.notified!=this.dropTarget)&&(this.notified&&t(this.notified),this.notified=this.dropTarget,i(this.notified)):this.notified&&(t(this.notified),this.notified=null,clearInterval(this.timer))}};h(Pc,"DragManager");var _2=new Pc;var f2={align:"center",vAlign:"middle",fontSize:14,fontWeight:null,fontStyle:"",fontVariant:"",fontFamily:"Arial",lineHeight:0,clip:!0,columns:1,columnGap:0,lineBreak:!0};function p2(e,t,i,s){if(i.width<=0||i.height<=0)return;if(s={...f2,...s},e.save(),s.clip&&(e.beginPath(),e.rect(i.left,i.top,i.width,i.height),e.clip()),s.rotation){let C=new At(i.left+i.width/2,i.top+i.height/2),z=s.rotation/180*Math.PI;e.translate(C.x,C.y),e.rotate(z),e.translate(-C.x,-C.y)}e.textBaseline="bottom";let r=br(s.fontSize,2)??12,n="";s.fontStyle&&(n+=s.fontStyle+" "),s.fontVariant&&(n+=s.fontVariant+" "),s.fontWeight&&(n+=s.fontWeight+" "),n+=r+"px ";let l=s.fontFamily??"sans-serif";l.indexOf(".")>0&&(l='"'+l+'"'),n+=l,e.font=n.trim();let o=[],a=t.split(`
|
|
37
|
+
`),c=s.columns<1?1:s.columns,u=s.columnGap,_=(i.width-u*(c-1))/c,p=i.left,v=_;s.lineBreak||(v=99999999);let g=wf(e," ");a.forEach(C=>{let z={width:0,words:[],space:0},W=wf(e,C);if(W<v)z.width=W,z.words.push({width:W,text:C}),o.push(z);else{let ve=C.split(/\s/).filter(K=>K!=="").map(K=>({width:wf(e,K),text:K})),te=0,ie=0;for(;te<ve.length;){let K=ve[te],Y=z.width;Y&&(Y+=g),Y+=K.width,Y>_&&ie>0?(o.push(z),ie=0,W=0,z={width:0,words:[],space:0}):(z.words.push(K),z.width=Y,te++,ie++)}ie&&(o.push(z),z.last=!0)}});let x=g2(e,"Ag"),E=(s.lineHeight??1.3)*x,y=o.length,k=i.top;if(c==1){let C=E*y;y==1&&(E=x,C=x),s.vAlign==="middle"?(k=i.top+i.height/2-C/2,k+=E/2,e.textBaseline="middle"):s.vAlign==="bottom"?C<i.height&&(k=i.top+i.height-C+E):(k=i.top,e.textBaseline="top")}else k+=x;let A=s.align=="justify",S=c,w=k,D=0;switch(s.align){case"right":D=1;break;case"center":D=2;break}let R=0;return o.some(C=>{C.space=g,A&&!C.last&&v2(C,_,g);let z=p,W=0;if(D==1?z+=_-C.width:D==2&&(z+=_/2-C.width/2),C.words.forEach(J=>{e.fillText(J.text,z,w),z+=J.width+C.space,W+=J.width+C.space}),w+=E,R<W&&(R=W),w>i.bottom+E&&(w=k,p+=_+u,--S==0))return!0}),e.restore(),{width:R,height:(o.length+.3)*E}}h(p2,"drawText");function g2(e,t){let i=e.measureText(t);return i.actualBoundingBoxAscent+i.actualBoundingBoxDescent}h(g2,"_calcTextHeight");function wf(e,t){return br(e.measureText(t).width,2)}h(wf,"_measureText");function v2(e,t,i){let s=(t-e.width)/(e.words.length-1)+i;s<=0||(e.width=t,e.space=s)}h(v2,"_justify");var bf="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";function Cv(e){return e.substr(0,5)=="data:"}h(Cv,"_isStaticImage");var Es=class extends I{m_created;m_lazysrc;constructor(t){super(t),this.m_created=!1,this.m_props.lazy=t.lazy!==!1,this.m_props.alt=t.alt,t.lazy!==!1&&(this.m_lazysrc=t.src,t.src=bf),this.setDomEvent("create",()=>{t.lazy&&this.setImage(this.m_lazysrc,!0)})}render(){let t=this.m_props,i=new I({tag:"img",attrs:{draggable:!1,alt:t.alt??"",decoding:t.lazy?"async":void 0},style:{objectFit:t.alignment?t.alignment:void 0}});this.setContent(i)}setImage(t,i){t||(t=bf),this.m_props.lazy?(i||this.m_lazysrc!=t)&&(Cv(t)?(this.m_props.src=t,this.m_lazysrc=t,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src)):(this.m_props.src=bf,this.dom&&this.dom.firstChild.setAttribute("src",this.m_props.src),this.m_lazysrc=t,this.dom&&this._update_image())):(this.m_props.src=t,this.m_lazysrc=t,this.dom&&this.dom.firstChild.setAttribute("src",t))}_update_image(){console.assert(!!this.dom),this.m_lazysrc&&!Cv(this.m_lazysrc)&&(Es.lazy_images_waiting.push({dom:this.dom,src:this.m_lazysrc}),Es.lazy_image_timer===void 0&&(Es.lazy_image_timer=setInterval(Es.lazyWatch,10)))}static lazyWatch(){let t=[],i=0;Es.lazy_images_waiting.forEach(s=>{let r=s.dom,n=s.src;if(!r||r.offsetParent===null)return;let l=r.getBoundingClientRect();!i&&r.offsetParent!==null&&l.bottom>=0&&l.right>=0&&l.top<=(window.innerHeight||L.documentElement.clientHeight)&&l.left<=(window.innerWidth||L.documentElement.clientWidth)?(r.firstChild.setAttribute("src",n),i++):t.push(s)}),Es.lazy_images_waiting=t,t.length==0&&(clearInterval(Es.lazy_image_timer),Es.lazy_image_timer=void 0)}},vr=Es;h(vr,"Image"),X(vr,"lazy_images_waiting",[]),X(vr,"lazy_image_timer");var ya=class extends q{constructor(t){super(t)}clear(){this.m_props.value=""}};h(ya,"FileUpload");var Tc=class extends ya{m_path;m_ui_img;m_ui_input;render(t){let i="up"+this.uid;this.setContent([new I({tag:"label",attrs:{for:i},content:[this.m_ui_img=new vr({src:this.m_props.value})]}),this.m_ui_input=new Ke({cls:"@hidden",id:i,type:"file",name:this.m_props.name,value_hook:{get:()=>this._get_value(),set:s=>{this._set_value(s)}},attrs:{accept:"image/*"},dom_events:{change:s=>{this._handleChange(s)}}})])}clear(){super.clear(),this.m_ui_input.dom.value="",this.m_ui_img.setImage(null,!1)}_get_value(){return this.m_path}_set_value(t){debugger}_handleChange(t){let i=this;function s(o){let a=new FileReader;a.addEventListener("load",c=>{i.m_ui_img.setImage(a.result.toString())}),a.readAsDataURL(o)}h(s,"createThumbnail");let r=["png","jpg","jpeg","gif"],n=t.target.files,l=n.length;for(let o=0;o<l;o++){let a=n[o].name.split(".");if(a=a[a.length-1],a=a.toLowerCase(),r.indexOf(a)!=-1){s(n[o]),this.m_path=n[o];break}}}};h(Tc,"ImageUpload");var Ca=null;function yv(){return Ca||(Ca=new I({tag:"input",style:{display:"none",id:"fileDialog"},attrs:{type:"file"}}),L.body.appendChild(Ca._build())),Ca.clearDomEvent("change"),Ca}h(yv,"_createFileInput");function w2(e,t,i=!1){let s=yv();s.removeAttribute("nwsaveas"),s.setAttribute("accept",e),s.setAttribute("multiple",i),s.setDomEvent("change",r=>{let n=s.dom.files;t(n)}),s.dom.click()}h(w2,"openFileDialog");function b2(e,t,i){let s=yv();s.setAttribute("nwsaveas",e),s.setAttribute("accept",t),s.setDomEvent("change",r=>{let n=s.dom.files;i(n[0])}),s.dom.click()}h(b2,"saveFileDialog");var xf,Fc;function Ev(e){e?Fc=new Intl.NumberFormat(xf,{style:"currency",currency:e}):Fc=new Intl.NumberFormat(xf,{style:"decimal",useGrouping:!0,minimumFractionDigits:2,maximumFractionDigits:2})}h(Ev,"setCurrencySymbol");function x2(e){if(e==null||e==="")return"";let t=new Date(Date.parse(e)),i={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return t.toLocaleDateString(xf,i)}h(x2,"sql_date_formatter");function C2(e){if(e==null||e==="")return"";let t=typeof e=="string"?new Date(Date.parse(e)):e;return Qe(t)}h(C2,"date_formatter");function y2(e){if(e==null||e==="")return"";let t=br(typeof e=="string"?parseFloat(e):e,2);return Object.is(t,-0)&&(t=0),Fc.format(t)}h(y2,"money_formatter");function E2(e){if(e==null||e==="")return"";let t=br(typeof e=="string"?parseFloat(e):e,2);return t?Fc.format(t):""}h(E2,"money_formatter_nz");function k2(e){return e?"oui":"-"}h(k2,"bool_formatter");Ev(null);var lI=Symbol("update");function kv(e,t){return se({rec:e,chk:t})}h(kv,"EvGridCheck");var zc=class extends I{m_sens;m_sorted;constructor(t,i){super(t),this.m_sorted=!1,this.m_sens="dn",this.setContent([new I({tag:"span",content:i}),new ge({ref:"sorter",cls:"@hidden sort",icon:"var( --x4-icon-arrow-down )"})])}get sorted(){return this.m_sorted}sort(t,i){this.m_sorted=t,this.m_sens=i;let s=this.itemWithRef("sorter");s.icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )",s.show(t)}get sens(){return this.m_sens}toggleSens(){this.m_sens=this.m_sens=="up"?"dn":"up",this.itemWithRef("sorter").icon=this.m_sens=="up"?"var( --x4-icon-arrow-down )":"var( --x4-icon-arrow-up )"}};h(zc,"ColHeader");var Rc=class extends we{m_dataview;m_data_cx;m_columns;m_view_el;m_container;m_header;m_footer;m_empty_msg;m_empty_text;m_selection;m_itemHeight;m_topIndex;m_visible_rows;m_hasMarks;m_marks;m_recycler;m_rowClassifier;constructor(t){super(t),this.m_columns=t.columns,this.m_hasMarks=t.hasMarks??!1,this.m_marks=new Set,this.m_hasMarks&&this.m_columns.unshift({id:"id",title:"",width:30,renderer:i=>this._renderCheck(i)}),this.setAttribute("tabindex",0),this.m_topIndex=0,this.m_itemHeight=0,this.m_recycler=[],this.m_rowClassifier=t.calcRowClass,this.m_empty_text=t.empty_text??Q.global.empty_list,this.setDomEvent("click",i=>this._itemClick(i)),this.setDomEvent("dblclick",i=>this._itemDblClick(i)),this.setDomEvent("contextmenu",i=>this._itemMenu(i)),this.setDomEvent("keydown",i=>this._handleKey(i)),this.setStore(t.store)}componentCreated(){this._updateScroll(!0)}_moveSel(t,i=!0){let s=this.m_selection,r=null;if(s===void 0)s=this.m_dataview.getByIndex(0).getID();else{let n=this.m_dataview.indexOfId(this.m_selection);t==1?n++:t==-1?n--:t==2?n+=this.m_visible_rows.length-1:t==-2&&(n-=this.m_visible_rows.length-1),t<0?r="start":r="end",n<0?n=0:n>=this.m_dataview.count&&(n=this.m_dataview.count-1),s=this.m_dataview.getByIndex(n).getID()}return this.m_selection!=s&&i&&this._selectItem(s,null,r),s}_handleKey(t){if(!(!this.m_dataview||this.m_dataview.count==0))switch(t.key){case"ArrowDown":case"Down":{this._moveSel(1);break}case"ArrowUp":case"Up":{this._moveSel(-1);break}case"PageUp":{this._moveSel(-2);break}case"PageDown":{this._moveSel(2);break}}}getNextSel(t){return this._moveSel(t,!1)}_scrollIntoView(t,i){let s=this._findItem(t);s?s.scrollIntoView({block:"center"}):(this.m_topIndex=this.m_dataview.indexOfId(t),this.m_view_el.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),this._scrollIntoView(t))}setStore(t){this.m_selection=void 0,t instanceof gr?this.m_dataview=t.createView():this.m_dataview=t,this.m_hasMarks&&this.clearMarks(),this.m_data_cx&&this.m_data_cx.dispose(),this.m_dataview&&(this.m_data_cx=this.m_dataview.on("view_change",i=>{i.action=="change"&&(this.m_selection=void 0),this._updateScroll(!0)}),this._updateScroll(!0))}getView(){return this.m_dataview}getSelection(){return this.m_selection}getSelRec(){return this.m_selection?this.m_dataview.getById(this.m_selection):null}setSelection(t){this._selectItem(t,null,"center")}render(){this.m_recycler=[],this.m_container=new I({cls:"content"}),this.m_empty_msg=new Z({cls:"empty-msg",text:""}),this.m_view_el=new I({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let t=!1,i=this.m_columns.map((r,n)=>{let l="@cell";r.cls&&(l+=" "+r.cls);let o=new zc({cls:l,flex:r.flex,sizable:"right",style:{width:r.width},dom_events:{click:c=>{ut(c.target).hasClass("@sizer-overlay")||(this._sortCol(r),c.preventDefault())}}},r.title),a=h(c=>{if(this._on_col_resize(n,c.size.width),this.m_footer){let u=I.getElement(this.m_footer.dom.childNodes[n]);u&&u.setStyleValue("width",c.size.width)}},"resizeCol");return new ls({target:o,sens:"right",events:{resize:c=>a(c)}}),r.flex&&(t=!0),r.$hdr=o,o});i.push(new Ds({ref:"flex",cls:t?"@hidden":""}));let s=0;if(this.m_columns.forEach(r=>{s+=r.width??0}),this.m_header=new q({cls:"@header",content:i,style:{minWidth:s}}),this.m_props.hasFooter){let r=this.m_columns.map((n,l)=>{let o="@cell";n.align&&(o+=" "+n.align),n.cls&&(o+=" "+n.cls);let a=new I({cls:o,data:{col:l},flex:n.flex,style:{width:n.width}});return n.$ftr=a,a});r.push(new Ds({ref:"flex",cls:t?"@hidden":""})),this.m_footer=new q({cls:"@footer",content:r,style:{minWidth:s}})}else this.m_footer=null;this.setContent([this.m_header,this.m_view_el,this.m_footer,this.m_empty_msg])}_on_col_resize(t,i){let s=this.m_columns[t],r=!1;if(i>=0?(s.width=i,s.flex&&(s.$hdr.removeClass("@flex"),s.$ftr?.removeClass("@flex"),s.flex=void 0,r=!0)):i<0&&!s.flex&&(s.$hdr.addClass("@flex"),s.$ftr?.addClass("@flex"),s.flex=1,r=!0),r){let n=!1;this.m_columns.forEach(l=>{l.flex&&(n=!0)}),this.m_header.itemWithRef("flex")?.show(!n),this.m_footer&&this.m_footer.itemWithRef("flex")?.show(!n)}this._updateScroll(!0)}sortCol(t,i=!0){let s=this.m_columns.find(r=>r.id==t);if(s===void 0){console.assert(!1,"unknown field "+t+" in grid.sortCol");return}this._sortCol(s,i?"dn":"up")}_sortCol(t,i="up"){if(t.sortable===!1)return;this.m_columns.forEach(r=>{r!==t&&r.$hdr.sort(!1,"dn")});let s=t.$hdr;s.sorted?s.toggleSens():s.sort(!0,i),this.m_dataview&&this.m_dataview.sort([{field:t.id,ascending:s.sens!="dn"}])}_computeItemHeight(){let t=L.createElement("div");t.classList.add("x-row");let i=L.createElement("div");i.classList.add("x-grid-view"),i.style.position="absolute",i.style.top="-1000px",i.appendChild(t),this.dom.appendChild(i);let s=t.getBoundingClientRect();this.dom.removeChild(i),this.m_itemHeight=s.height}_createRow(t){let i;if(this.m_recycler.length){i=this.m_recycler.pop(),i.clearClasses(),i.addClass(t.cls),i.setContent(t.content),i.setStyle(t.style);for(let s in t.data)i.setData(s,t.data[s])}else i=new q(t);return i.dom||this.m_container.appendChild(i),i}_buildItems(t=!0){let i=this.getBoundingRect(),s=this.m_header.getBoundingRect(),r=i.height-s.height+this.m_itemHeight;this.m_itemHeight==0&&this._computeItemHeight();let n=this.m_topIndex*this.m_itemHeight,l=0,o=0,a=this.m_topIndex,c=this.m_dataview?this.m_dataview.count:0,u=0,_=!!(this.m_topIndex&1);if(this.m_columns.forEach(x=>{u+=x.width??0}),(c+1)*this.m_itemHeight>=r){let x=I.getScrollbarSize();this.m_header.setStyleValue("paddingRight",x),this.m_footer?.setStyleValue("paddingRight",x)}else this.m_header.setStyleValue("paddingRight",0),this.m_footer?.setStyleValue("paddingRight",0);this.m_visible_rows&&this.m_visible_rows.forEach(x=>{this.m_recycler.push(x)}),this.m_visible_rows=[];let p=100;for(;l<r&&a<c&&--p>0;){let x=this.m_dataview.getByIndex(a),E=x.getID(),y=t?this.m_recycler.findIndex(k=>k.getData("row-id")==E):-1;if(y>=0){let k=this.m_recycler.splice(y,1)[0];k.setStyle({top:l+n,minWidth:u}),this.m_hasMarks&&k.setClass("@marked",this.m_marks.has(E)),k.removeClass("@hidden"),k.setClass("@selected",this.m_selection===E),this.m_visible_rows[o]=k}else{let k=this.m_columns.map(w=>{let D="@cell";w.align&&(D+=" "+w.align),w.cls&&(D+=" "+w.cls);let R;if(w.renderer)R=w.renderer(x),R&&(R.addClass(D),R.setStyleValue("width",w.width),w.flex!==void 0&&(R.addClass("@flex"),R.setStyleValue("flex",w.flex)));else{let C=w.formatter,z;C&&C instanceof Function?z=C(x.getRaw(w.id),x):z=x.getField(w.id),R=new I({cls:D,width:w.width,content:un`<span>${z}</span>`,flex:w.flex})}return R}),A="@row @hlayout center";this.m_hasMarks&&this.m_marks.has(E)&&(A+=" @marked"),this.m_selection===E&&(A+=" @selected");let S=this.m_visible_rows[o]=this._createRow({cls:A,content:k,style:{top:l+n,minWidth:u},data:{"row-id":E,"row-idx":a}});S.addClass(_?"even":"odd"),_=!_,this.m_rowClassifier&&this.m_rowClassifier(x,S)}l+=this.m_itemHeight,a++,o++}this.m_recycler.forEach(x=>{x.addClass("@hidden")});let v=!c,g=this.m_empty_text instanceof Function?this.m_empty_text():this.m_empty_text;this.m_empty_msg.text=g,v&&g.length==0&&(v=!1),this.m_empty_msg.show(v),u<i.width?(this.m_header.setStyleValue("width",null),this.m_footer?.setStyleValue("width",null),this.m_container.setStyle({height:c*this.m_itemHeight,width:null})):(this.m_header.setStyleValue("width",u+1e3),this.m_footer?.setStyleValue("width",u+1e3),this.m_container.setStyle({height:c*this.m_itemHeight,width:u}))}_updateScroll(t){if(!this.m_view_el||!this.m_view_el.dom)return;let i=h(()=>{if(!this.dom)return;let s=Math.floor(this.m_view_el.dom.scrollTop/(this.m_itemHeight||1));(s!=this.m_topIndex||t)&&(this.m_topIndex=s,this._buildItems(!t));let r=this.m_view_el.dom.scrollLeft;this.m_header.setStyleValue("left",-r),this.m_footer?.setStyleValue("left",-r)},"update");t?this.singleShot(i,10):i()}_rowFromTarget(t){let i=this.dom;for(;t&&t!=i;){let s=I.getElement(t);if(s){let r=s.getData("row-id");if(r!==void 0)return{id:r,itm:s}}t=t.parentElement}}_itemClick(t){let i=this._rowFromTarget(t.target);i?this._selectItem(i.id,i.itm):this._selectItem(void 0,void 0)}_itemDblClick(t){let i=this._rowFromTarget(t.target);if(i){this._selectItem(i.id,i.itm);let s=this.m_dataview.getById(i.id);this.emit("dblClick",Is(s)),this.m_hasMarks&&this._toggleMark(s)}}_itemMenu(t){let i=t.target,s=this.dom;for(;i&&i!=s;){let r=I.getElement(i),n=r?.getData("row-id");if(n!==void 0){this._selectItem(n,r);let l=r.getData("row-idx"),o=this.m_dataview.getByIndex(l);this._showItemContextMenu(t,o),t.preventDefault();return}i=i.parentElement}}_findItem(t){for(let i=0;i<this.m_visible_rows.length;i++){let s=this.m_visible_rows[i];if(s.getData("row-id")===t)return s}return null}_selectItem(t,i,s){if(this.m_selection!==void 0){let r=this._findItem(this.m_selection);r&&r.removeClass("@selected")}if(this.m_selection=t,t){s&&this._scrollIntoView(t,s),i||(i=this._findItem(t)),i&&i.addClass("@selected");let r=this.m_dataview.getById(t);this.emit("selectionChange",Bt(r))}else this.emit("selectionChange",Bt(null))}_showItemContextMenu(t,i){this.emit("contextMenu",Ai(t,i))}clearSelection(){this._selectItem(null,null)}exportData(t){let i="",s=" ",r=`\r
|
|
38
|
+
`,n="";this.m_columns.map(o=>{n.length&&(n+=s),n+=o.title}),i+=n+r;let l=this.m_dataview.count;for(let o=0;o<l;o++){let a=this.m_dataview.getByIndex(o);n="";let c=this.m_columns.map(u=>{let _=a.getField(u.id),p=u.formatter;p&&p instanceof Function&&(_=p(_,a)),n.length>0&&(n+=s),n+=_});i+=n+r}i=i.replace(/[àâä]/gm,"a"),i=i.replace(/[éèê]/gm,"e"),i=i.replace(/[îï]/gm,"i"),i=i.replace(/[ûüù]/gm,"u"),i=i.replace(/ /gm," "),lu(i,"text/csv",t)}set empty_text(t){this.m_empty_msg.text=t}_renderCheck(t){let i="--x4-icon-square";return this.m_marks.has(t.getID())&&(i="--x4-icon-square-check"),new ge({icon:`var(${i})`})}_toggleMark(t){let i=t.getID(),s=!1;this.m_marks.has(i)?this.m_marks.delete(i):(this.m_marks.add(i),s=!0),this.emit("gridCheck",kv(t,s)),this._buildItems(!1)}getMarks(){let t=[];for(let i of this.m_marks.values())t.push(i);return t}clearMarks(){this.m_marks.size&&(this.m_marks=new Set,this._buildItems(!1))}setFooterData(t){this.m_footer&&this.m_footer.enumChilds(i=>{let s=i.getData("col");if(s){let r=this.m_columns[s],n=t[r.id];if(n!==void 0)if(ct(n))n(i);else{let l,o=r.formatter;o&&o instanceof Function?l=o(n,t):l=n,i.setContent(l,!1)}}})}};h(Rc,"GridView");var Lc=class extends I{constructor(t){super(t),this.setDomEvent("click",()=>this._handleClick()),this.mapPropEvents(t,"click")}_handleClick(){this.emit("click",Yt())}render(t){let i=t.text??"",s=t.href??"#";this.setTag("a"),this.setAttribute("tabindex",0),this.setAttribute("href",s),this.setAttribute("target",t.target),i&&this.setContent(si(i)?i:un`<span>${i}</span>`)}set text(t){this.m_props.text=t,this.update()}};h(Lc,"Link");var ti=class{static hashStr(t,i=!1){return this.onePassHasher.start().appendStr(t).end(i)}static hashAsciiStr(t,i=!1){return this.onePassHasher.start().appendAsciiStr(t).end(i)}static _hex(t){let i=ti.hexChars,s=ti.hexOut,r,n,l,o;for(o=0;o<4;o+=1)for(n=o*8,r=t[o],l=0;l<8;l+=2)s[n+1+l]=i.charAt(r&15),r>>>=4,s[n+0+l]=i.charAt(r&15),r>>>=4;return s.join("")}static _md5cycle(t,i){let s=t[0],r=t[1],n=t[2],l=t[3];s+=(r&n|~r&l)+i[0]-680876936|0,s=(s<<7|s>>>25)+r|0,l+=(s&r|~s&n)+i[1]-389564586|0,l=(l<<12|l>>>20)+s|0,n+=(l&s|~l&r)+i[2]+606105819|0,n=(n<<17|n>>>15)+l|0,r+=(n&l|~n&s)+i[3]-1044525330|0,r=(r<<22|r>>>10)+n|0,s+=(r&n|~r&l)+i[4]-176418897|0,s=(s<<7|s>>>25)+r|0,l+=(s&r|~s&n)+i[5]+1200080426|0,l=(l<<12|l>>>20)+s|0,n+=(l&s|~l&r)+i[6]-1473231341|0,n=(n<<17|n>>>15)+l|0,r+=(n&l|~n&s)+i[7]-45705983|0,r=(r<<22|r>>>10)+n|0,s+=(r&n|~r&l)+i[8]+1770035416|0,s=(s<<7|s>>>25)+r|0,l+=(s&r|~s&n)+i[9]-1958414417|0,l=(l<<12|l>>>20)+s|0,n+=(l&s|~l&r)+i[10]-42063|0,n=(n<<17|n>>>15)+l|0,r+=(n&l|~n&s)+i[11]-1990404162|0,r=(r<<22|r>>>10)+n|0,s+=(r&n|~r&l)+i[12]+1804603682|0,s=(s<<7|s>>>25)+r|0,l+=(s&r|~s&n)+i[13]-40341101|0,l=(l<<12|l>>>20)+s|0,n+=(l&s|~l&r)+i[14]-1502002290|0,n=(n<<17|n>>>15)+l|0,r+=(n&l|~n&s)+i[15]+1236535329|0,r=(r<<22|r>>>10)+n|0,s+=(r&l|n&~l)+i[1]-165796510|0,s=(s<<5|s>>>27)+r|0,l+=(s&n|r&~n)+i[6]-1069501632|0,l=(l<<9|l>>>23)+s|0,n+=(l&r|s&~r)+i[11]+643717713|0,n=(n<<14|n>>>18)+l|0,r+=(n&s|l&~s)+i[0]-373897302|0,r=(r<<20|r>>>12)+n|0,s+=(r&l|n&~l)+i[5]-701558691|0,s=(s<<5|s>>>27)+r|0,l+=(s&n|r&~n)+i[10]+38016083|0,l=(l<<9|l>>>23)+s|0,n+=(l&r|s&~r)+i[15]-660478335|0,n=(n<<14|n>>>18)+l|0,r+=(n&s|l&~s)+i[4]-405537848|0,r=(r<<20|r>>>12)+n|0,s+=(r&l|n&~l)+i[9]+568446438|0,s=(s<<5|s>>>27)+r|0,l+=(s&n|r&~n)+i[14]-1019803690|0,l=(l<<9|l>>>23)+s|0,n+=(l&r|s&~r)+i[3]-187363961|0,n=(n<<14|n>>>18)+l|0,r+=(n&s|l&~s)+i[8]+1163531501|0,r=(r<<20|r>>>12)+n|0,s+=(r&l|n&~l)+i[13]-1444681467|0,s=(s<<5|s>>>27)+r|0,l+=(s&n|r&~n)+i[2]-51403784|0,l=(l<<9|l>>>23)+s|0,n+=(l&r|s&~r)+i[7]+1735328473|0,n=(n<<14|n>>>18)+l|0,r+=(n&s|l&~s)+i[12]-1926607734|0,r=(r<<20|r>>>12)+n|0,s+=(r^n^l)+i[5]-378558|0,s=(s<<4|s>>>28)+r|0,l+=(s^r^n)+i[8]-2022574463|0,l=(l<<11|l>>>21)+s|0,n+=(l^s^r)+i[11]+1839030562|0,n=(n<<16|n>>>16)+l|0,r+=(n^l^s)+i[14]-35309556|0,r=(r<<23|r>>>9)+n|0,s+=(r^n^l)+i[1]-1530992060|0,s=(s<<4|s>>>28)+r|0,l+=(s^r^n)+i[4]+1272893353|0,l=(l<<11|l>>>21)+s|0,n+=(l^s^r)+i[7]-155497632|0,n=(n<<16|n>>>16)+l|0,r+=(n^l^s)+i[10]-1094730640|0,r=(r<<23|r>>>9)+n|0,s+=(r^n^l)+i[13]+681279174|0,s=(s<<4|s>>>28)+r|0,l+=(s^r^n)+i[0]-358537222|0,l=(l<<11|l>>>21)+s|0,n+=(l^s^r)+i[3]-722521979|0,n=(n<<16|n>>>16)+l|0,r+=(n^l^s)+i[6]+76029189|0,r=(r<<23|r>>>9)+n|0,s+=(r^n^l)+i[9]-640364487|0,s=(s<<4|s>>>28)+r|0,l+=(s^r^n)+i[12]-421815835|0,l=(l<<11|l>>>21)+s|0,n+=(l^s^r)+i[15]+530742520|0,n=(n<<16|n>>>16)+l|0,r+=(n^l^s)+i[2]-995338651|0,r=(r<<23|r>>>9)+n|0,s+=(n^(r|~l))+i[0]-198630844|0,s=(s<<6|s>>>26)+r|0,l+=(r^(s|~n))+i[7]+1126891415|0,l=(l<<10|l>>>22)+s|0,n+=(s^(l|~r))+i[14]-1416354905|0,n=(n<<15|n>>>17)+l|0,r+=(l^(n|~s))+i[5]-57434055|0,r=(r<<21|r>>>11)+n|0,s+=(n^(r|~l))+i[12]+1700485571|0,s=(s<<6|s>>>26)+r|0,l+=(r^(s|~n))+i[3]-1894986606|0,l=(l<<10|l>>>22)+s|0,n+=(s^(l|~r))+i[10]-1051523|0,n=(n<<15|n>>>17)+l|0,r+=(l^(n|~s))+i[1]-2054922799|0,r=(r<<21|r>>>11)+n|0,s+=(n^(r|~l))+i[8]+1873313359|0,s=(s<<6|s>>>26)+r|0,l+=(r^(s|~n))+i[15]-30611744|0,l=(l<<10|l>>>22)+s|0,n+=(s^(l|~r))+i[6]-1560198380|0,n=(n<<15|n>>>17)+l|0,r+=(l^(n|~s))+i[13]+1309151649|0,r=(r<<21|r>>>11)+n|0,s+=(n^(r|~l))+i[4]-145523070|0,s=(s<<6|s>>>26)+r|0,l+=(r^(s|~n))+i[11]-1120210379|0,l=(l<<10|l>>>22)+s|0,n+=(s^(l|~r))+i[2]+718787259|0,n=(n<<15|n>>>17)+l|0,r+=(l^(n|~s))+i[9]-343485551|0,r=(r<<21|r>>>11)+n|0,t[0]=s+t[0]|0,t[1]=r+t[1]|0,t[2]=n+t[2]|0,t[3]=l+t[3]|0}_dataLength;_bufferLength;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(ti.stateIdentity),this}appendStr(t){let i=this._buffer8,s=this._buffer32,r=this._bufferLength,n,l;for(l=0;l<t.length;l+=1){if(n=t.charCodeAt(l),n<128)i[r++]=n;else if(n<2048)i[r++]=(n>>>6)+192,i[r++]=n&63|128;else if(n<55296||n>56319)i[r++]=(n>>>12)+224,i[r++]=n>>>6&63|128,i[r++]=n&63|128;else{if(n=(n-55296)*1024+(t.charCodeAt(++l)-56320)+65536,n>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");i[r++]=(n>>>18)+240,i[r++]=n>>>12&63|128,i[r++]=n>>>6&63|128,i[r++]=n&63|128}r>=64&&(this._dataLength+=64,ti._md5cycle(this._state,s),r-=64,s[0]=s[16])}return this._bufferLength=r,this}appendAsciiStr(t){let i=this._buffer8,s=this._buffer32,r=this._bufferLength,n,l=0;for(;;){for(n=Math.min(t.length-l,64-r);n--;)i[r++]=t.charCodeAt(l++);if(r<64)break;this._dataLength+=64,ti._md5cycle(this._state,s),r=0}return this._bufferLength=r,this}appendByteArray(t){let i=this._buffer8,s=this._buffer32,r=this._bufferLength,n,l=0;for(;;){for(n=Math.min(t.length-l,64-r);n--;)i[r++]=t[l++];if(r<64)break;this._dataLength+=64,ti._md5cycle(this._state,s),r=0}return this._bufferLength=r,this}getState(){let t=this,i=t._state;return{buffer:String.fromCharCode.apply(null,t._buffer8),buflen:t._bufferLength,length:t._dataLength,state:[i[0],i[1],i[2],i[3]]}}setState(t){let i=t.buffer,s=t.state,r=this._state,n;for(this._dataLength=t.length,this._bufferLength=t.buflen,r[0]=s[0],r[1]=s[1],r[2]=s[2],r[3]=s[3],n=0;n<i.length;n+=1)this._buffer8[n]=i.charCodeAt(n)}end(t=!1){let i=this._bufferLength,s=this._buffer8,r=this._buffer32,n=(i>>2)+1,l;if(this._dataLength+=i,s[i]=128,s[i+1]=s[i+2]=s[i+3]=0,r.set(ti.buffer32Identity.subarray(n),n),i>55&&(ti._md5cycle(this._state,r),r.set(ti.buffer32Identity)),l=this._dataLength*8,l<=4294967295)r[14]=l;else{let o=l.toString(16).match(/(.*?)(.{0,8})$/);if(o===null)return;let a=parseInt(o[2],16),c=parseInt(o[1],16)||0;r[14]=a,r[15]=c}return ti._md5cycle(this._state,r),t?this._state:ti._hex(this._state)}},Ys=ti;h(Ys,"Md5"),X(Ys,"stateIdentity",new Int32Array([1732584193,-271733879,-1732584194,271733878])),X(Ys,"buffer32Identity",new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),X(Ys,"hexChars","0123456789abcdef"),X(Ys,"hexOut",[]),X(Ys,"onePassHasher",new ti);var Xs=class extends Ks{m_label;constructor(t){let i=t.icon??"var( --x4-icon-exclamation )";t.icon=void 0;let s=t.buttons===void 0?["ok"]:t.buttons;t.buttons=void 0,super(t);let r=t.message;this.form.updateContent(new q({style:{padding:8},content:[i?new ge({cls:"icon",icon:i}):null,this.m_label=new Z({cls:"text",text:r,multiline:!0})]}),s),this.on("btnClick",n=>{this.m_props.click&&fi(()=>{this.m_props.click(n.button)})})}set text(t){this.m_label.text=t}static show(t){let i;return re(t)||si(t)?i=new Xs({message:t,click:()=>{}}):i=new Xs(t),i.show(),i}static async showAsync(t){return new Promise((i,s)=>{let r,n=h(o=>{i(o)},"cb");re(t)||si(t)?r={message:t,click:n}:r={...t,click:n},new Xs(r).show()})}static alert(t,i=null){new Xs({cls:"warning",title:i,message:t,buttons:["ok"],click:()=>{}}).show()}};h(Xs,"MessageBox");var rn=class extends Ks{m_edit;constructor(t){t.buttons=void 0,t.width=t.width??500,super(t),this.form.updateContent(new q({cls:"panel",content:[this.m_edit=new Ye({flex:1,autoFocus:!0,label:t.message,value:t.value})]}),["ok","cancel"]),t.click&&this.on("btnClick",i=>{i.button==="ok"&&fi(()=>{this.m_props.click(this.m_edit.value)})})}set text(t){this.m_edit.label=t}static show(t,i){let s;return re(t)||si(t)?s=new rn({message:t,click:i}):s=new rn(t),s.show(),s}};h(rn,"PromptDialogBox");var Vc=class extends we{m_ui_title;m_ui_body;constructor(t){super(t);let i=t?.sens=="horizontal"?"@hlayout":"@vlayout";this.m_ui_title=new Z({cls:"title",text:this.m_props.title}),this.m_ui_body=new I({cls:"body "+i,content:this.m_props.content,style:t.bodyStyle})}render(){let t=this.m_props.gadgets??[],i=this.m_props.icon?new ge({icon:this.m_props.icon}):null;super.setContent([new q({cls:"title",content:[i,this.m_ui_title,...t]}),this.m_ui_body])}setContent(t){this.m_ui_body.setContent(t)}set title(t){this.m_ui_title.text=t}};h(Vc,"Panel");var Ea=class{text;cls};h(Ea,"CellData"),X(Ea,"empty_cell",{text:""});var Dl=class extends we{m_columns;m_row_limit;m_cells_data;m_rows_data;m_view;m_container;m_header;m_itemHeight;m_topIndex;m_visible_cells;m_row_count;m_selection;m_editor;m_autoedit;m_lockupdate;m_auto_row_count;m_recycler;m_used_cells;constructor(t){super(t),this.m_columns=t.columns,this.m_autoedit=t.autoedit,this.m_lockupdate=0,this.m_cells_data=new Map,this.m_rows_data=new Map,this.m_itemHeight=0,this.m_selection={row:0,col:0},this.m_row_count=0,this.m_auto_row_count=!1,this.m_recycler=[],this.m_used_cells=[],t.maxrows===void 0?(this.m_row_limit=0,this.m_auto_row_count=!0):t.maxrows<0?(this.m_row_limit=0,this.m_auto_row_count=!0):this.m_row_limit=t.maxrows,this.setAttribute("tabindex",0),this.setDomEvent("click",i=>this._itemClick(i)),this.setDomEvent("dblclick",i=>this._itemDblClick(i)),this.setDomEvent("keydown",i=>this._handleKey(i)),this.setDomEvent("keypress",i=>this._keyPress(i)),this.setDomEvent("focus",()=>this._focus(!0)),this.setDomEvent("focusout",()=>this._focus(!1)),this.setDomEvent("contextmenu",i=>this._ctxMenu(i)),this.mapPropEvents(t,"dblClick","selectionChange","contextMenu","change")}componentCreated(){super.componentCreated(),this._updateScroll(!0)}setColWidth(t,i){this._on_col_resize(t,i),this.update(10)}getColWidth(t){if(this.m_columns[t])return this.m_columns[t].width}setColTitle(t,i){console.assert(this.m_columns[t]!==void 0),this.m_columns[t].title=i,this.update(10)}reset(t){t&&(this.m_columns=t),this.m_cells_data=new Map,this.m_rows_data=new Map,this.update(10)}insertRow(t){let i=new Map;this.m_cells_data.forEach((r,n)=>{let{row:l,col:o}=Bc(n);l>=t?i.set(ks(l+1,o),r):i.set(n,r)});let s=new Map;this.m_rows_data.forEach((r,n)=>{n>=t?s.set(n+1,r):s.set(n,r)}),this.m_cells_data=i,this.m_rows_data=s,this._buildItems()}deleteRow(t){let i=new Map,s=new Map;this.m_cells_data.forEach((r,n)=>{let{row:l,col:o}=Bc(n);l>t?i.set(ks(l-1,o),r):l<t&&i.set(n,r)}),this.m_rows_data.forEach((r,n)=>{n>t?s.set(n-1,r):n<t&&s.set(n,r)}),this.m_cells_data=i,this.m_rows_data=s,this._buildItems()}insertCol(t,i){let s=t;if(s<0&&(s=this.m_columns.length+1),this.m_columns.splice(s,0,i),t>=0){let r=new Map;this.m_cells_data.forEach((n,l)=>{let{row:o,col:a}=Bc(l);a>=t?r.set(ks(o,a+1),n):r.set(l,n)}),this.m_cells_data=r}this.update()}deleteCol(t){this.m_columns.splice(t,1);let i=new Map;this.m_cells_data.forEach((s,r)=>{let{row:n,col:l}=Bc(r);l>t?i.set(ks(n,l-1),s):l<t&&i.set(r,s)}),this.m_cells_data=i,this.update()}_getCellData(t,i,s=!1){let r=this.m_cells_data.get(ks(t,i));return r===void 0?s?null:Ea.empty_cell:r}_focus(t){this.setClass("@focus",t)}_ctxMenu(t){let i=t.target,s=this.dom;for(;i&&i!=s;){let r=I.getElement(i),n=r.getData("row-id"),l=r.getData("col-id");if(n!==void 0){this._selectItem(n,l),this.emit("contextMenu",Ai(t,{row:n,col:l,item:r})),t.preventDefault();return}i=i.parentElement}}render(){this.m_recycler=[],this.m_container=new I({cls:"content"}),this.m_view=new I({cls:"@scroll-view",flex:1,dom_events:{sizechange:()=>this._updateScroll(!0),scroll:()=>this._updateScroll(!1)},content:this.m_container});let t=this.m_columns.map((i,s)=>{let r=new I({cls:"@cell c"+s,content:i.title?i.title:" ",flex:i.width<0?-i.width:void 0,attrs:{title:i.title},style:{width:i.width>=0?i.width:void 0,minWidth:i.min_width}});return new ls({target:r,sens:"right",resize:n=>{this._on_col_resize(s,n.size.width)}}),i.$col=r,r});this.m_header=new q({cls:"@header",content:t}),this.setContent([this.m_header,this.m_view])}_on_col_resize(t,i){this.m_columns[t]&&(i<=0?this.m_columns[t].width=-1:this.m_columns[t].width=i,this._updateScroll(!0))}_computeItemHeight(){let t=L.createElement("div");t.classList.add("x-spreadsheet");let i=L.createElement("div");i.classList.add("content");let s=L.createElement("div");s.classList.add("x-cell"),s.append(" "),i.appendChild(s),t.appendChild(i),this.dom.appendChild(t);let r=s.getBoundingClientRect();this.dom.removeChild(t),this.m_itemHeight=r.height}_calcColWidths(t){let i=0,s=0,r=new Int32Array(this.m_columns.length),n=new Int32Array(this.m_columns.length),l=new Int32Array(this.m_columns.length);if(this.m_columns.forEach((o,a)=>{let c=Math.max(10,o.min_width??0);if(o.width>0){let u=Math.max(o.width,c);i+=u,r[a]=u}else{let u=-o.width;n[a]=u,s+=u}l[a]=c}),s){let o=t-i;for(let a=0;a<this.m_columns.length&&s;a++)if(!r[a]){let c=Math.round(o/s)*n[a];c<l[a]&&(c=l[a]),r[a]=c,o-=c,s-=n[a]}}return r}_createCell(){let t;return this.m_recycler.length?(t=this.m_recycler.pop(),t.clearClasses(),t.addClass("@comp")):t=new I({cls:"@cell"}),t.dom||this.m_container.appendChild(t),t}_buildItems(){let t=this.getBoundingRect(),i=this.m_header.getBoundingRect(),s=t.height-i.height;this.m_itemHeight==0&&this._computeItemHeight();let r=this.m_topIndex*this.m_itemHeight,n=0,l=0,o=this.m_topIndex,a=this.m_row_limit;this.m_auto_row_count&&(this.m_row_limit=a=this.getMaxRowCount());let c=0;if(a*this.m_itemHeight>s){let g=I.getScrollbarSize();t.width-=g,c=g}let u=!!(this.m_topIndex&1);this.m_visible_cells=new Map,this.m_used_cells.forEach(g=>{this.m_recycler.push(g)}),this.m_used_cells=[];let _=this._calcColWidths(t.width),p=0;for(let g=0;g<_.length;g++)p+=_[g];p<=t.width?(this.m_view.setStyleValue("overflow-x","hidden"),this.m_header.setStyleValue("width",t.width),this.m_container.setStyleValue("width",t.width),this.m_container.setStyle({height:a*this.m_itemHeight})):(this.m_header.setStyleValue("width",p),this.m_container.setStyleValue("width",p),this.m_view.setStyleValue("overflow-x","visible"),this.m_container.setStyle({height:a*this.m_itemHeight,width:p})),this.m_view.addClass("@hidden");let v=100;for(;n<s&&o<a&&--v>0;){let g=this.m_rows_data.get(o),x=0,E=this.m_columns.map((y,k)=>{let A="@cell c"+k;y.align&&(A+=" "+y.align),y.cls&&(A+=" "+y.cls);let S,w=this._getCellData(o,k),D=w.text;return y.renderer&&D.length&&(D=y.renderer(D,{row:o,col:k})),A+=u?" even":" odd",g&&(A+=" "+g),S=this._createCell(),this.m_used_cells.push(S),S.setContent(D),S.addClass(A),S.setStyle({left:x,top:r+n,width:_[k],height:this.m_itemHeight}),this.m_selection.row==o&&this.m_selection.col==k&&S.addClass("@selected"),S.setData("row-id",o),S.setData("col-id",k),w.cls&&S.addClass(w.cls),this.m_visible_cells.set(ks(o,k),S),x+=_[k],S});u=!u,n+=this.m_itemHeight,o++,l++}this.m_recycler.forEach(g=>{g.addClass("@hidden")}),this.m_row_count=l,this.m_view.removeClass("@hidden"),this.setClass("empty",a==0)}_itemClick(t){let i=t.target;if(this.m_editor&&this.m_editor.dom.contains(i))return;let s=I.getElement(i,I);if(!s)return;let r=s.getData("row-id"),n=s.getData("col-id");r===void 0||n===void 0||this._selectItem(r,n)}_itemDblClick(t){let i=t.target;if(this.m_editor&&this.m_editor.dom.contains(i))return;let s=I.getElement(i),r=s.getData("row-id"),n=s.getData("col-id");r===void 0||n===void 0||(this.emit("dblClick",Is({row:r,col:n})),this.editCell(r,n))}_selectItem(t,i,s){t<0&&(t=0),t>this.m_row_limit-1&&(t=this.m_row_limit-1),i<0&&(i=0);let r=this.m_columns.length-1;i>r&&(i=r),!(this.m_selection.row==t&&this.m_selection.col==i)&&this.select(t,i,s)}_scrollIntoView(t,i){let s=h((n,l="nearest")=>{n.scrollIntoView({block:l})},"doscroll"),r=this.m_topIndex+this.m_row_count-1;t<this.m_topIndex?(this.m_topIndex=t,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),s(this._findItem(t,i),"start")):t>r?(this.m_topIndex=t-this.m_row_count+1,this.m_view.dom.scrollTop=this.m_topIndex*this.m_itemHeight,this._buildItems(),s(this._findItem(t,i),"end")):s(this._findItem(t,i))}_findItem(t,i){return this.m_visible_cells?this.m_visible_cells.get(ks(t,i)):null}_updateScroll(t){if(!this?.m_view?.dom)return;let i=Math.floor(this.m_view.dom.scrollTop/(this.m_itemHeight||1));(i!=this.m_topIndex||t)&&(this.m_topIndex=i,this._buildItems());let s=this.m_view.dom.scrollLeft;this.m_header.setStyleValue("left",-s)}_moveSel(t,i){let s=this.m_selection,r=s.row??0,n=s.col??0;if(t==1?r++:t==-1?r--:t==2?r+=this.m_row_count-1:t==-2?r-=this.m_row_count-1:t==3?r=this.m_row_limit-1:t==-3&&(r=0),i==1)n++;else if(i==-1)n--;else if(i==2)n=this.m_columns.length-1;else if(i==-2)n=0;else if(i==3){n++;let l=this.m_columns.length-1;e:for(let o=0;o<2;o++){for(;n<l;){if(this.m_columns[n].createEditor!==null)break e;n++}n>l&&(r++,n=0)}}else if(i==-3){n--;let l=this.m_columns.length-1;e:for(let o=0;o<2;o++){for(;n>=0;){if(this.m_columns[n].createEditor!==null)break e;n--}n<0&&(r--,n=l)}}this._selectItem(r,n,!0)}_handleKey(t){let i=t.target;if(!(this.m_editor&&this.m_editor.dom.contains(i)))switch(t.key){case"ArrowDown":case"Down":{this._moveSel(1,0);break}case"ArrowUp":case"Up":{this._moveSel(-1,0);break}case"PageUp":{this._moveSel(-2,0);break}case"PageDown":{this._moveSel(2,0);break}case"ArrowLeft":case"Left":{this._moveSel(0,-1);break}case"ArrowRight":case"Right":{this._moveSel(0,1);break}case"Home":{t.ctrlKey?this._moveSel(-3,0):this._moveSel(0,-2);break}case"End":{t.ctrlKey?this._moveSel(3,0):this._moveSel(0,2);break}case"Enter":{this.editCurCell(),t.stopPropagation(),t.preventDefault();break}case"Delete":{this.clearCell(this.m_selection.row,this.m_selection.col);break}default:break}}_keyPress(t){let i=t.target;this.m_editor&&this.m_editor.dom.contains(i)||t.ctrlKey||t.altKey||this.editCurCell(t.key)}getSelection(){return this.m_selection}select(t,i,s=!0){if(this.m_selection.row==t&&this.m_selection.col==i)return;let r=this._findItem(this.m_selection.row,this.m_selection.col);r&&r.removeClass("@selected"),this.m_selection={row:t,col:i},s&&this._scrollIntoView(t,i);let n=this._findItem(t,i);n&&n.addClass("@selected"),this.emit("selectionChange",Bt({row:t,col:i}))}rowCount(){return this.m_row_limit}getMaxRowCount(){let t=0;return this.m_cells_data.forEach((i,s)=>{let r=Math.round(s/1e3)+1;t<r&&(t=r)}),t}getColCount(){return this.m_columns.length}setRowStyle(t,i){this.m_rows_data.set(t,i),this.m_lockupdate==0&&this._buildItems()}getRowStyle(t){return this.m_rows_data.get(t)}setCellStyle(t,i,s){let r=this._getCellData(t,i,!0);if(r||(r={text:""},this.m_cells_data.set(ks(t,i),r)),r.cls=s,this.m_lockupdate==0&&this.m_visible_cells){let n=this._findItem(t,i);n?n.setClass(s,!0):this._buildItems()}}getCellText(t,i){return this._getCellData(t,i).text}getCellNumber(t,i){let s=this._getCellData(t,i).text;return nu(s)}clearRow(t){for(let i=0;i<this.m_columns.length;i++)this.clearCell(t,i);this.update(10)}clearCell(t,i){this.setCellText(t,i,null)}editCurCell(t){this.editCell(this.m_selection.row,this.m_selection.col,t)}editCell(t,i,s){if(!this.m_autoedit||this.m_columns[i].createEditor===null)return;this._scrollIntoView(t,i);let n=this._findItem(t,i).dom,l=n.parentElement,o=n.getBoundingClientRect(),a=l.getBoundingClientRect(),c=this._getCellData(t,i,!0),u=h((p,v,g)=>new Ye(p),"edtBuilder");this.m_columns[i].createEditor&&(u=this.m_columns[i].createEditor);let _=s||(c?c.text:"");this.m_editor=u({cls:"@editor",style:{left:o.left-a.left,top:o.top-a.top,width:o.width-1,height:o.height-1},tabIndex:!1,value:_,data:{row:t,col:i}},t,i),this.m_editor&&(l.appendChild(this.m_editor._build()),this._setupEditor(),this.m_editor.setData("old-value",_),this.m_editor.focus(),this.m_editor instanceof Ye&&this.m_editor.selectAll())}_setupEditor(){let t=h((i,s)=>{au(()=>{this.killEditor(!0),this._moveSel(i,s),this.editCurCell()})},"movesel");if(this.m_editor instanceof Ye){let s=this.m_editor.input;s.setDomEvent("blur",()=>{this.killEditor(!0)}),s.setDomEvent("keydown",r=>{if(!r.defaultPrevented)switch(r.key){case"Escape":{this.killEditor(!1),r.stopPropagation(),r.preventDefault();break}case"Enter":case"Tab":{let n=3;r.shiftKey&&(n=-3),t(0,n),r.stopPropagation(),r.preventDefault();break}case"ArrowUp":case"Up":{t(-1,0),r.stopPropagation(),r.preventDefault();break}case"ArrowDown":case"Down":{t(1,0),r.stopPropagation(),r.preventDefault();break}}})}else if(this.m_editor instanceof sn){let i=this.m_editor.input;i.setDomEvent("blur",()=>{this.killEditor(!0)}),i.setDomEvent("keydown",s=>{switch(s.key){case"Escape":{this.killEditor(!1),s.stopPropagation(),s.preventDefault();break}case"Enter":case"Tab":{let r=3;s.shiftKey&&(r=-3),t(0,r),s.stopPropagation(),s.preventDefault();break}}}),this.m_editor.showPopup(),this.m_editor.on("change",s=>{this.killEditor(!0)}),this.m_editor.on("cancel",s=>{this.killEditor(!1)})}}killEditor(t){if(this.m_editor){if(t){let s,r;this.m_editor instanceof Ye?s=this.m_editor.value:this.m_editor instanceof sn&&(r=this.m_editor.value,s=this.m_editor.valueText);let n=this.m_editor.getData("row"),l=this.m_editor.getData("col"),o=this.m_editor.getData("old-value");this.setCellText(n,l,s);let a=ee(s,{row:n,col:l,oldValue:o,id:r});this.emit("change",a),a.defaultPrevented&&this.setCellText(n,l,o)}let i=this.m_editor;fi(()=>{i.dispose()}),this.m_editor=null,this.focus()}}clearData(){this.m_cells_data=new Map,this.m_rows_data=new Map}setCellText(t,i,s){if(s==null||s.length==0)this.m_cells_data.delete(ks(t,i)),s="";else{let r=this._getCellData(t,i,!0);r||(r={}),r.text=s,this.m_cells_data.set(ks(t,i),r)}if(this.m_lockupdate==0&&this.m_visible_cells){let r=this._findItem(t,i);r?(this.m_columns[i].renderer&&(s=this.m_columns[i].renderer(s,{row:t,col:i})),r.setContent(s)):this._buildItems()}}lockUpdate(t){t?this.m_lockupdate++:--this.m_lockupdate==0&&this._updateScroll(!0)}};h(Dl,"Spreadsheet");function ks(e,t){return e*1e3+t}h(ks,"_mkid");function Bc(e){return{row:Math.floor(e/1e3)|0,col:e%1e3|0}}h(Bc,"_getid");var Hc=class extends I{m_fields;m_record;m_sheet;m_label_w;constructor(t){super(t),this.mapPropEvents(t,"change")}render(t){this.m_record=t.record,this.m_fields=t.fields??[],this.m_label_w=t.labelWidth,this.m_sheet=new Dl({cls:"@fit",columns:[{title:Q.global.property,width:this.m_label_w>0?this.m_label_w:-1,cls:"property"},{title:Q.global.value,width:-1,createEditor:(...i)=>this._editCell(...i),renderer:(...i)=>this._renderCell(...i)}],autoedit:!0,change:i=>this._cellChange(i)}),this._updateProperties(),this.setContent(this.m_sheet)}setFields(t){t?(this.m_fields=t,this._updateProperties()):this.m_sheet.clearData()}setRecord(t){this.m_record=t,this._updateProperties()}_updateProperties(){this.m_sheet.lockUpdate(!0),this.m_sheet.clearData(),this.m_fields.forEach((t,i)=>{this.m_sheet.setCellText(i,0,t.title),this.m_record?this.m_sheet.setCellText(i,1,this.m_record.getField(t.id)):this.m_sheet.setCellText(i,1,t.value)}),this.m_sheet.lockUpdate(!1)}_cellChange(t){let i=t.context,s=t.value;if(i.col!=1)return;let r=this.m_fields[i.row];switch(r.type){default:case"string":break;case"number":break;case"password":break;case"boolean":break;case"choice":break}this.m_record?this.m_record.setField(r.id,s):r.value=s,this.emit("change",ee(s,r))}_renderCell(t,i){switch(this.m_fields[i.row].type){default:case"string":break;case"number":break;case"password":{t="\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF";break}case"boolean":break;case"choice":break}return t}_editCell(t,i,s){let r=this.m_fields[i],n;switch(r.type){default:case"string":{n=new Ye(t);break}case"number":{n=new Ye(t);break}case"password":{t.type="password",t.value=this.m_record.getField(r.id),n=new Ke(t);break}case"boolean":{n=new qs(t);break}case"choice":break}return n}_choicesFromArray(t){return t.map(s=>typeof s=="object"?{id:s.id,text:s.value}:{id:s,text:""+s})}_choicesFromStore(t,i){let s=[];for(let r=0,n=t.count;r<n;r++){let l=t.getByIndex(r);s.push({id:l.getID(),text:l.getField(i)})}return s}};h(Hc,"PropertyEditor");var Il=class extends I{m_ui_input;constructor(t){super(t),this.mapPropEvents(t,"change")}render(t){let i=t.text??"",s=t.name??t.group,r=t.labelWidth??-1,n=t.checked??!1,l=t.align??"left",o=t.value,a=t.icon;this.setTag("label"),this.addClass("@hlayout"),this.addClass(l),this._setTabIndex(t.tabIndex),n&&this.addClass("checked"),this.setContent([this.m_ui_input=new Ke({type:"radio",name:s,tabIndex:t.tabIndex,value:o,attrs:{checked:n?"":void 0},dom_events:{change:()=>this._change(),focus:()=>this.m_ui_input.focus()}}),new Z({ref:"label",icon:a,text:i,width:r==="flex"?void 0:r,flex:r==="flex"?1:void 0,style:{order:l=="right"?-1:void 0}})])}_change(){let i=".x-input[name="+this.m_props.name+"]";L.querySelectorAll(i).forEach(n=>{I.getElement(n,Il).removeClass("checked")});let r=this.m_ui_input.dom;this.setClass("checked",r.checked),this.emit("change",ee(!0))}get check(){return this.m_ui_input?this.m_ui_input.dom.checked:this.m_props.checked}set check(t){let i=this.m_ui_input.dom;t?(i&&(i.checked=!0),this.m_props.checked=!0):(i&&(i.checked=!1),this.m_props.checked=!1)}get text(){return this.itemWithRef("label").text}set text(t){this.itemWithRef("label").text=t}};h(Il,"RadioBtn");var Oc=class extends q{m_els;m_input;constructor(t){super(t),t.steps=t.steps??5}render(t){let i=t.shape??"star",s=t.value??0;this.m_input=new Ke({cls:"@hidden",name:t.name,value:""+s}),this.addClass(i),this.setDomEvent("click",r=>this._onclick(r)),this.m_els=[];for(let r=0;r<t.steps;r++){let n="item";r+1<=s&&(n+=" checked");let l=new I({tag:"option",cls:n,data:{value:r+1}});this.m_els.push(l)}this.m_els.push(this.m_input),this.setContent(this.m_els)}getValue(){return this.m_props.value??0}set value(t){this.m_props.value=t;for(let i=0;i<this.m_props.steps;i++)this.m_els[i].setClass("checked",this.m_els[i].getData("value")<=t);this.m_input.value=""+this.m_props.value}set steps(t){this.m_props.steps=t,this.update()}set shape(t){this.removeClass(this.m_props.shape),this.m_props.shape=t,this.addClass(this.m_props.shape)}_onclick(t){let i=!0;for(let s=this.dom.firstChild;s;s=s.nextSibling){let r=I.getElement(s);r.setClass("checked",i),s==t.target&&(this.m_input.value=r.getData("value"),i=!1)}this.emit("change",ee(this.m_props.value))}};h(Oc,"Rating");function S2(e,t=!1){if(e instanceof RegExp)return{keys:null,pattern:e};let i=e.split("/"),s=[],r="";i[0]==""&&i.shift();for(let n of i){let l=n[0];if(l==="*")s.push("wild"),r+="/(.*)";else if(l===":"){let o=n.indexOf("?",1),a=n.indexOf(".",1);s.push(n.substring(1,o>=0?o:a>=0?a:n.length)),r+=o>=0&&a<0?"(?:/([^/]+?))?":"/([^/]+?)",a>=0&&(r+=(o>=0?"?":"")+"\\"+n.substring(a))}else r+="/"+n}return{keys:s,pattern:new RegExp(`^${r}${t?"(?=$|/)":"/?$"}`,"i")}}h(S2,"parseRoute");var Wc=class extends _i{m_routes;m_useHash;constructor(t=!0){super(),this.m_routes=[],this.m_useHash=t,window.addEventListener("popstate",i=>{let s=this._getLocation(),r=this._find(s);r.handlers.forEach(n=>{n(r.params,s)})})}get(t,i){let{keys:s,pattern:r}=S2(t);this.m_routes.push({keys:s,pattern:r,handler:i})}init(){this.navigate(this._getLocation())}_getLocation(){return this.m_useHash?"/"+L.location.hash.substring(1):L.location.pathname}navigate(t,i=!0){t.startsWith("/")||(t="/"+t);let s=this._find(t);if(!s||s.handlers.length==0){console.log("route not found: "+t),this.signal("error",tu(404,"route not found"));return}if(this.m_useHash){for(;t.startsWith("/");)t=t.substring(1);window.history.pushState({},"","#"+t)}else window.history.pushState({},"",t);i&&s.handlers.forEach(r=>{r(s.params,t)})}_find(t){let i=[],s={},r=[];for(let n of this.m_routes)if(n.keys)if(n.keys.length>0){if(i=n.pattern.exec(t),i===null)continue;for(let l=0;l<n.keys.length;)s[n.keys[l]]=i[++l];r=[...r,n.handler]}else n.pattern.test(t)&&(r=[...r,n.handler]);else{if(i=n.pattern.exec(t),!i)continue;if(i.groups)for(let l in i.groups)s[l]=i.groups[l];r=[...r,n.handler]}return{params:s,handlers:r}}};h(Wc,"Router");var jc=class extends fr{m_sidebar;m_content;constructor(t){super(t),this.addClass("@hlayout"),this.m_sidebar=new we({cls:"@side-bar",width:t.bar_width??void 0}),this.m_content=new q({flex:1,cls:"@tab-container"})}render(){let t=[];this.m_cards.forEach(i=>{t.push(i.selector)}),this.m_sidebar.setContent(new we({flex:1,cls:"content",content:t})),this.setContent([this.m_sidebar,this.m_props.bar_sizable?new _n({orientation:"horizontal",sizing:"before"}):void 0,this.m_content])}_prepareSelector(t){return new Se({text:t.title,icon:t.icon,tooltip:t.title,click:()=>{this.switchTo(t.name)}})}_preparePage(t){super._preparePage(t),t.dom||this.m_content.appendChild(t)}};h(jc,"SideBarView");var D2=/^-?\d+(\.\d+)?$/;function I2(e){return e*Math.PI/180}h(I2,"d2r");function Sv(e,t,i,s){let r=I2(s);return{x:e+i*Math.cos(r),y:t+i*Math.sin(r)}}h(Sv,"p2c");function Gt(e){return Math.round(e*1e3)/1e3}h(Gt,"num");function Cf(e,...t){return t=t.map(i=>typeof i=="number"&&isFinite(i)?Gt(i):i),String.raw(e,...t)}h(Cf,"clean");var wr=class{m_tag;m_attrs;m_style;constructor(t){this.m_tag=t,this.m_attrs=new Map,this.m_style=new Map}render(){return`<${this.m_tag} ${this.renderAttrs()} ${this.renderStyle()}>${this.renderContent()}</${this.m_tag}>`}stroke(t,i){return this.attr("stroke",t),i!==void 0&&this.attr("stroke-width",i+"px"),this}strokeWidth(t){return this.attr("stroke-width",t+"px"),this}fill(t){return this.attr("fill",t),this}attr(t,i){return this.m_attrs.set(t,i),this}style(t,i){if(i===void 0||i===""||i===void 0){this.m_style.delete(t);return}return!Ra[t]&&(mn(i)||D2.test(i))&&(i=i+"px"),this.m_style.set(t,""+i),this}class(t){let i=this.m_attrs.get("class");return this.m_attrs.set("class",(i??" "+t).trim()),this}renderAttrs(){if(!this.m_attrs.size)return"";let t="";return this.m_attrs.forEach((i,s)=>{t+=` ${s} = "${i}"`}),t}renderStyle(){if(!this.m_style.size)return"";let t='style="';return this.m_style.forEach((i,s)=>{t+=`${s}:${i};`}),t+'"'}renderContent(){return""}clip(t){return this.attr("clip-path",`url(#${t})`),this}transform(t){this.attr("transform",t)}rotate(t,i,s){this.transform(`rotate( ${t} ${i} ${s} )`)}translate(t,i){this.transform(`translate( ${t} ${i} )`)}scale(t){this.transform(`scale( ${t} )`)}};h(wr,"SVGItem");var Gc=class extends wr{m_path;constructor(){super("path"),this.m_path=""}renderAttrs(){return this.attr("d",this.m_path),super.renderAttrs()}moveTo(t,i){return this.m_path+=Cf`M${t},${i}`,this}lineTo(t,i){return this.m_path+=Cf`L${t},${i}`,this}closePath(){return this.m_path+="Z",this}arc(t,i,s,r,n){let l=Sv(t,i,s,r-90),o=Sv(t,i,s,n-90),a=n-r<=180?"0":"1";return this.m_path+=Cf`M${l.x},${l.y}A${s},${s} 0 ${a} 1 ${o.x},${o.y}`,this}};h(Gc,"SVGPath");var Nc=class extends wr{m_text;constructor(t,i,s){super("text"),this.m_text=s,this.attr("x",Gt(t)+""),this.attr("y",Gt(i)+"")}font(t){return this.attr("font-family",t),this}fontSize(t){return this.attr("font-size",t+""),this}fontWeight(t){return this.attr("font-weight",t),this}textAlign(t){let i;switch(t){case"left":i="start";break;case"center":i="middle";break;case"right":i="end";break;default:return this}return this.attr("text-anchor",i),this}verticalAlign(t){let i;switch(t){case"top":i="hanging";break;case"center":i="middle";break;case"bottom":i="baseline";break;default:return}return this.attr("alignment-baseline",i),this}renderContent(){return this.m_text}};h(Nc,"SVGText");var Da=class extends wr{constructor(t){super(t)}};h(Da,"SVGShape");var $c=class extends wr{m_id;m_stops;constructor(t,i,s,r){super("linearGradient"),this.m_id="gx-"+$c.g_id,this.attr("id",this.m_id),this.attr("x1",re(t)?t:Gt(t)+""),this.attr("x2",re(s)?s:Gt(s)+""),this.attr("y1",re(i)?i:Gt(i)+""),this.attr("y2",re(r)?r:Gt(r)+""),this.m_stops=[],$c.g_id++}get id(){return"url(#"+this.m_id+")"}addStop(t,i){return this.m_stops.push({offset:t,color:i}),this}renderContent(){let t=[];return this.m_stops.forEach(i=>{t.push(`<stop offset="${i.offset}%" stop-color="${i.color}"></stop>`)}),t.join(`
|
|
39
|
+
`)}},ka=$c;h(ka,"SVGGradient"),X(ka,"g_id",1);var Ia=class extends wr{m_items;constructor(t="g"){super(t),this.m_items=[]}path(){let t=new Gc;return this.m_items.push(t),t}text(t,i,s){let r=new Nc(t,i,s);return this.m_items.push(r),r}ellipse(t,i,s,r=s){let n=new Da("ellipse");return n.attr("cx",Gt(t)+""),n.attr("cy",Gt(i)+""),n.attr("rx",Gt(s)+""),n.attr("ry",Gt(r)+""),this.m_items.push(n),n}rect(t,i,s,r){let n=new Da("rect");return n.attr("x",Gt(t)+""),n.attr("y",Gt(i)+""),n.attr("width",Gt(s)+""),n.attr("height",Gt(r)+""),this.m_items.push(n),n}linear_gradient(t,i,s,r){let n=new ka(t,i,s,r);return this.m_items.push(n),n}clear(){this.m_items=[]}renderContent(){let t=[];return this.m_items.forEach(i=>{t.push(i.render())}),t.join(`
|
|
40
|
+
`)}};h(Ia,"SVGGroup");var yf=class extends Ia{constructor(){super("")}addClip(t,i,s,r){let n="c-"+yf.g_clip_id++,l=new Ia("clipPath");return l.attr("id",n),l.rect(t,i,s,r),this.m_items.push(l),n}render(){let t=[];return this.m_items.forEach(i=>{t.push(i.render())}),t.join(`
|
|
41
|
+
`)}},Sa=yf;h(Sa,"SVGPathBuilder"),X(Sa,"g_clip_id",1);var Uc=class extends I{constructor(t){super(t),this.setTag("svg","http://www.w3.org/2000/svg"),this.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.setAttributes({viewBox:t.viewBox}),this.setContent(t.path)}};h(Uc,"SVGComponent");var qc=class extends Ae{m_pages;m_curPage;constructor(t){super(t),this.m_pages=[],this.m_curPage=null,this.mapPropEvents(t,"change"),t.vertical?this.addClass("@vlayout"):this.addClass("@hlayout"),this.m_props.pages?.forEach(i=>this.addPage(i))}componentCreated(){this.m_props.default&&this.select(this.m_props.default,!0)}addPage(t){this.m_pages.push({...t}),this._updateContent()}render(){let t=[];this.m_pages.forEach(i=>{i.btn=new Se({cls:i===this.m_curPage?"selected":"",text:i.title,icon:i.icon,click:()=>this._select(i,!0)}),t.push(i.btn)}),this.setContent(t)}select(t,i=!1){if(t){let s=this.m_pages.find(r=>r.id===t);return s?(this._select(s,i),!0):!1}else return this._select(null,i),!0}_select(t,i){if(this.m_curPage!=t){if(!this.dom){this.m_props.default=t.id;return}this.m_curPage&&(this.m_curPage.btn.removeClass("selected"),this.m_curPage.page&&this.m_curPage.page.hide()),this.m_curPage=t,i&&this.signal("change",ee(t?t.id:null)),this.m_curPage&&(this.m_curPage.btn.addClass("selected"),this.m_curPage.page&&this.m_curPage.page.show())}}get selection(){return this.m_curPage?.page}};h(qc,"TabBar");var Kc=class extends fr{m_tab_selector;m_menu;constructor(t){super(t),this.m_tab_selector=!!t.tab_selector,this.m_menu=t.menu,this.addClass("@vlayout")}render(){let t=[],i=[];this.m_menu&&(this.m_menu.addClass("@button @tab-btn"),this.m_menu.removeClass("@menu-item"),t.push(this.m_menu)),this.m_cards.forEach(s=>{t.push(s.selector),s.page instanceof Function||i.push(s.page)}),this.m_tab_selector&&i.unshift(new q({cls:"@tab-switch",content:t})),this.setContent(i)}_updateSelector(){}_prepareSelector(t){return new Se({cls:"@tab-btn",text:t.title,icon:t.icon,click:()=>{this.switchTo(t.name)}})}_preparePage(t){super._preparePage(t),t.dom||this.appendChild(t)}};h(Kc,"TabView");var Yc=class extends I{constructor(t){super(t),this.mapPropEvents(t,"change")}render(t){t.text=t.text??"",this.setAttribute("tabindex",t.tabIndex??0),t.spellcheck===!1&&this.setAttribute("spellcheck","false"),t.readOnly!==void 0&&this.setAttribute("readonly",t.readOnly),t.rows&&this.setAttribute("rows",t.rows),t.placeHolder&&this.setAttribute("placeholder",t.placeHolder),t.autoFocus&&this.setAttribute("autofocus",t.autoFocus),t.name&&this.setAttribute("name",t.name),t.autoGrow&&(this.m_props.autoGrow=!0,this.setAttribute("rows",this._calcHeight(t.text)),this.setDomEvent("keydown",()=>{fi(()=>this._updateHeight())})),this.setDomEvent("keydown",i=>{i.stopPropagation()}),this.setTag("textarea"),this.setDomEvent("input",()=>this._change())}_change(){this.emit("change",ee(this.value))}componentCreated(){this.value=this.m_props.text}get value(){return this.dom?this.dom.value:this.m_props.text}set value(t){this.m_props.text=t??"",this.dom&&(this.dom.value=this.m_props.text,this.m_props.autoGrow&&this.setAttribute("rows",this._calcHeight(this.m_props.text)))}get text(){return this.value}set text(t){this.value=t}_calcHeight(t){return 1+(t.match(/\n/g)||[]).length}_updateHeight(){let t=this.value,i=this._calcHeight(t);this.getData("lines")!=i&&(this.setAttribute("rows",i),this.setData("lines",i))}insertText(t){this.appendText(t)}appendText(t){if(this.dom){let i=this.dom,s=i.selectionEnd;i.setRangeText(t,s,s,"end")}}replaceText(t){this.dom&&this.dom.setRangeText(t)}getSelection(){if(this.dom){let t=this.dom;return{start:t.selectionStart,end:t.selectionEnd}}else return{start:0,end:0}}setSelection(t){if(this.dom){let i=this.dom;t.start!==void 0&&(i.selectionStart=t.start),t.end!==void 0&&(i.selectionEnd=t.end)}}getStoreValue(){return this.value}setStoreValue(t){this.value=t}};h(Yc,"TextArea");var Xc=class extends ot{m_message;m_icon;constructor(t){super(t),this.m_message=t.message,this.m_icon=t.icon,this.enableMask(!1),this.addClass("@non-maskable")}render(){this.addClass("@hlayout"),this.setContent([new Z({icon:this.m_icon,text:this.m_message})])}show(){this.show=super.show,this.displayAt(9999,9999,"br",{x:0,y:-24});let t=1;this.startTimer("fadeout",2e3,!1,()=>{this.startTimer("opacity",100,!0,()=>{this.setStyleValue("opacity",t),t-=.1,t<0&&this.dispose()})})}};h(Xc,"Toaster");function A2(e){return se({node:e})}h(A2,"EvExpand");var Zc=class extends we{m_view;m_container;m_selection;constructor(t){super(t),t.root=t.root,t.indent=t.indent??8,t.gadgets=t.gadgets,t.sort=t.sort??!1,this.m_selection=null,this.m_container=new Ae({cls:"@scroll-container"}),this.m_view=new Ae({cls:"@scroll-view",flex:1,content:this.m_container}),this.setContent([this.m_view,t.gadgets?new q({cls:"gadgets",content:t.gadgets}):null]),this.setDomEvent("click",i=>this._click(i)),this.setDomEvent("dblclick",i=>this._click(i)),this.setDomEvent("contextmenu",i=>this._handleCtxMenu(i)),t.canDragItems&&(this.setDomEvent("dragstart",i=>{let r=I.getElement(i.target,I)?.getData("node");r?(i.dataTransfer.effectAllowed="move",i.dataTransfer.items.add(JSON.stringify({type:"treeview",id:r.id}),"string")):(i.preventDefault(),i.stopPropagation())}),this.setDomEvent("dragover",i=>this._dragEnter(i)),this.setDomEvent("dragenter",i=>this._dragEnter(i)),this.setDomEvent("dragend",i=>this._dragLeave(i)),this.setDomEvent("dragleave",i=>this._dragLeave(i)),this.setDomEvent("drop",i=>this._dragLeave(i)),this.setDomEvent("drop",i=>this._drop(i))),this.mapPropEvents(t,"dblclick","drag","selectionchange","contextMenu")}_dragEnter(t){t.preventDefault();let i=I.getElement(t.target,I);i?.getData("node")&&(i.addClass("@drag-over"),t.dataTransfer.dropEffect="move")}_dragLeave(t){let i=I.getElement(t.target,I);i?.getData("node")&&i.removeClass("@drag-over")}_drop(t){let i=I.getElement(t.target,I),s=i?.getData("node");if(s||(s=this.m_props.root),s){let r;s.children?r=s:r=i.getData("parent");for(let n=0;n<t.dataTransfer.items.length;n++)t.dataTransfer.items[0].getAsString(l=>{let o=JSON.parse(l);this.emit("drag",eu(s,o,r))})}}render(){this.__update()}__update(){if(this.m_props.root){let t=[];this._buildBranch(this.m_props.root,-1,t,this.m_props.root),this.m_container.setContent(t)}}updateElement(t){let{node:i,item:s}=this._getNode(t);if(i){let r=i.dom.parentNode,n=this._makeNode(s,i.dom.classList.value,i.getData("icon"),i.getData("level")),l=n._build();r.replaceChild(l,i.dom),this.m_selection?.el===i&&(this.m_selection.el=n)}}set root(t){this.m_props.root=t,this.update()}openAll(t=!0){this.forEach(i=>{i.children&&(i.open=t)}),this.__update()}refreshRoot(t){let i=[];this.forEach(r=>(r.open&&i.push(r.id),!1));let s=this.selection;t&&(this.m_props.root=t),this.forEach(r=>(i.indexOf(r.id)>=0&&(r.open=!0),!1)),this.__update()}_buildBranch(t,i,s,r){let n="@tree-item";t.cls&&(n+=" "+t.cls),!t.open&&t.children&&(n+=" collapsed"),t.children&&(n+=" folder",t.children.length==0&&(n+=" empty"));let l=t.icon;if(l===void 0&&t.children&&(t.open===!0?l="var(--x4-icon-chevron-down)":l="var(--x4-icon-chevron-right)"),i>=0){let o=this._makeNode(t,n,l,i);this.m_selection?.id==t.id&&(this.m_selection.el=o,o.addClass("selected")),s.push(o)}(i==-1||t.open)&&t.children&&(this.m_props.sort&&(t.children=t.children.sort((o,a)=>{let c=(o.children?"0"+o.text:o.text)?.toLocaleLowerCase(),u=(a.children?"0"+a.text:a.text)?.toLocaleLowerCase();return c<u?-1:c>u?1:0})),t.children.forEach(o=>{this._buildBranch(o,i+1,s,t)}))}_renderDef(t){return new Z({cls:"tree-label",flex:1,text:t.text})}_makeNode(t,i,s,r){return new q({cls:i,content:[new ge({cls:"tree-icon",icon:s}),this.m_props.renderItem?this.m_props.renderItem(t):this._renderDef(t)],data:{node:t,level:r,icon:s},style:{paddingLeft:4+r*this.m_props.indent},attrs:{draggable:this.m_props.canDragItems?!0:void 0}})}forEach(t){let i=null;function s(r){if(t(r)==!0)return!0;if(r.children){for(let n=0;n<r.children.length;n++)if(s(r.children[n]))return!0}}return h(s,"scan"),this.m_props.root&&s(this.m_props.root),i}ensureVisible(t){let{node:i}=this._getNode(t);i&&i.scrollIntoView()}set selection(t){this.select(t,!1)}select(t,i=!0){if(this.m_selection?.el&&this.m_selection.el.removeClass("selected"),this.m_selection=null,t!==void 0){let{node:s}=this._getNode(t);if(s&&(this.m_selection={id:t,el:s},s.addClass("selected"),s.scrollIntoView(),i)){let r=s.getData("node");this.emit("selectionchange",Bt(r))}}else i&&this.emit("selectionchange",Bt(null))}_getNode(t){let i={node:null,item:null};return this.m_container.enumChilds(s=>{let r=s.getData("node");if(r?.id==t)return i={node:s,item:r},!0}),i}get selection(){return this.m_selection?.id}getNodeWithId(t){return this.forEach(i=>i.id==t)}_click(t){let i=t.target,s=i,r=!1;for(i.tabIndex!==-1&&(r=!0);i!=this.dom;){let n=I.getElement(i),l=n?.getData("node");if(l){if(l.children&&!r){(n.hasClass("selected")||s.classList.contains("tree-icon"))&&(l.open=!l.open),this.m_selection={id:l.id,el:null};let o=this.m_view?.dom?.scrollTop;this.update(),o&&this.m_view.dom.scrollTo(0,o),this.emit("expand",A2(l))}else this.selection=l.id,r||(t.type=="click"?this.emit("click",Yt(l)):this.emit("dblclick",Is(l)));this.emit("selectionchange",Bt(l));return}i=i.parentElement}t.type=="click"&&(this.m_selection=null,this.update(),this.emit("selectionchange",Bt(null)))}_handleCtxMenu(t){t.preventDefault();let i=t.target,s=i;for(;i!=this.dom;){let n=I.getElement(i)?.getData("node");if(n){if(n.children&&s.classList.contains("tree-icon"))return;this.selection=n.id,this.emit("click",Yt(n)),this.emit("contextMenu",Ai(t,n));return}i=i.parentElement}this.selection=null,this.emit("contextMenu",Ai(t,null))}static buildFromStrings(t,i="/"){let s={id:0,text:"<root>",children:[]};function r(n,l){let o=l.indexOf(i),a=l.substr(0,o<0?void 0:o),c;o>=0&&(c=n.find(u=>u.text==a)),c||(c={id:l,text:a},n.push(c)),o>=0&&(c.children||(c.children=[]),r(c.children,l.substr(o+i.length)))}return h(r,"insert"),t.forEach(n=>{r(s.children,n)}),s}static buildFromHierarchy(t,i){let s={id:0,text:"<root>",children:[]},r=[];function n(l){let o,a;l.parent>0?(a=r.find(c=>c.id==l.parent),a||(a={id:l.parent,text:"",children:[]},r.push(a)),a.children||(a.children=[])):a=s,o=r.find(c=>c.id==l.id),o?(o.text=l.name,o.parent=l.parent):(o={id:l.id,text:l.name,parent:l.parent,cls:l.cls,icon:l.icon,data:l.data},l.leaf?o.icon=null:o.children=[]),r.push(o),a.children.push(o)}return h(n,"insert"),t.forEach(n),i&&r.forEach(i),s}};h(Zc,"TreeView");var M2=h((e,t,...i)=>{let s;return e==Iv||e==Dv?i:(e instanceof Function?s=new e(t):s=new I({tag:e,...t}),i&&i.length&&s.setContent(i),s)},"createElement"),Dv=Symbol("fragment"),Iv=h(()=>null,"createFragment"),P2={createElement:M2,createFragment:Iv,Fragment:Dv},Jc=class extends I{render(t){let i=this.renderTSX(t);i&&this.setContent(i)}};h(Jc,"TSXComponent");var Av=Symbol("msg_sent");function T2(e){let t=window.location.protocol==="https:"?"wss://":"ws://",i=new WebSocket(`${t}${window.location.hostname}:${window.location.port}`,"messaging"),s=ys.instance();s.on("global",r=>{r[Av]||i.send(JSON.stringify({msg:r.msg,params:r.params}))}),i.onmessage=r=>{if(r.data!="ping"){let n=JSON.parse(r.data);n[Av]=!0,s.signal("global",n)}},i.onclose=r=>{console.log("websocket closed:",r),e()},i.onerror=r=>{console.log("websocket error:",r)}}h(T2,"setupWSMessaging");var F2="1.5.25";
|
|
10
42
|
/**
|
|
11
43
|
* ___ ___ __
|
|
12
44
|
* \ \_/ / / _
|