/*
 Eloquence WEBDLG v2
 (C) Copyright Marxmeier Software AG, 2020-2025
 Version: 2.1.3
 $Id: 00-base.js,v 29.23 2025/07/28 09:26:00 rhg Exp $
 $Id: 05-api-comm.js,v 29.5 2025/07/03 14:16:08 rhg Exp $
 $Id: 05-api-dlg.js,v 29.8 2025/07/07 11:26:27 rhg Exp $
 $Id: 05-const.js,v 29.10 2025/07/03 14:15:50 rhg Exp $
 $Id: 10-api-checkbox.js,v 29.2 2025/01/28 12:13:35 rhg Exp $
 $Id: 10-api-combobox.js,v 29.7 2025/07/07 11:26:27 rhg Exp $
 $Id: 10-api-dialog.js,v 29.2 2024/07/17 11:08:20 rhg Exp $
 $Id: 10-api-edittext.js,v 29.4 2025/07/07 11:26:27 rhg Exp $
 $Id: 10-api-groupbox.js,v 29.1 2023/06/07 08:47:33 rhg Exp $
 $Id: 10-api-htmlview.js,v 29.1 2023/06/07 08:47:33 rhg Exp $
 $Id: 10-api-image.js,v 29.1 2023/06/07 08:47:33 rhg Exp $
 $Id: 10-api-listbox.js,v 29.5 2024/09/09 13:33:34 rhg Exp $
 $Id: 10-api-menubar.js,v 29.2 2023/11/21 15:10:37 rhg Exp $
 $Id: 10-api-menuitem.js,v 29.1 2023/06/07 08:47:33 rhg Exp $
 $Id: 10-api-menu.js,v 29.2 2023/11/21 15:10:23 rhg Exp $
 $Id: 10-api-plugin.js,v 29.6 2025/03/05 09:28:41 rhg Exp $
 $Id: 10-api-poptext.js,v 29.3 2025/02/12 12:51:07 rhg Exp $
 $Id: 10-api-progressbar.js,v 29.1 2023/06/07 08:47:33 rhg Exp $
 $Id: 10-api-pushbutton.js,v 29.2 2025/01/28 12:13:35 rhg Exp $
 $Id: 10-api-radiobutton.js,v 29.2 2025/01/28 12:13:35 rhg Exp $
 $Id: 10-api-separator.js,v 29.1 2023/06/07 08:47:33 rhg Exp $
 $Id: 10-api-splitter.js,v 29.1 2023/06/07 08:47:33 rhg Exp $
 $Id: 10-api-statictext.js,v 29.1 2023/06/07 08:47:33 rhg Exp $
 $Id: 10-api-statusbar.js,v 29.1 2023/06/07 08:47:34 rhg Exp $
 $Id: 10-api-tabbox.js,v 29.2 2023/10/11 13:48:01 rhg Exp $
 $Id: 10-api-toolbar.js,v 29.1 2023/06/07 08:47:34 rhg Exp $
 $Id: 10-api-tree.js,v 29.1 2023/06/07 08:47:34 rhg Exp $
 $Id: 10-api-windowmenu.js,v 29.1 2023/06/07 08:47:34 rhg Exp $
 $Id: 99-api-worker.js,v 29.12 2025/07/07 11:26:27 rhg Exp $
*/
var eq=eq||{};eq.c=eq.c||{};eq.p=eq.p||{};eq.p.version=20103;eq.c.Obj=function(){};(eq.c.Obj.setClassName=function(c,b){var d=Object.getOwnPropertyDescriptor(b.prototype.constructor,"name");void 0!==d?d.value=c:d={value:c,configurable:!0,enumerable:!1,writable:!1};Object.defineProperty(b.prototype.constructor,"name",d)})("Obj",eq.c.Obj);
eq.c.Obj.subClass=function(c,b){var d=this;b.prototype=Object.create(d.prototype);Object.defineProperty(b.prototype,"constructor",{value:b,configurable:!1,enumerable:!1,writable:!0});eq.c.Obj.setClassName(c,b);b.subClass=function(a,e){return d.subClass.call(this,a,e)};return eq.c[c]=b};eq.c.Obj.subClass("Rq",function(){eq.c.Obj.call(this)});eq.c.Rq.prototype.dispose=function(){this.bfLength=this.bfOffset=this.bf=void 0};
eq.c.Rq.prototype.assign=function(c){this.bf=new Uint8Array(c);this.bfOffset=0;this.bfLength=this.bf.length};
eq.c.Rq.prototype.acquire=function(){if(void 0==this.bf)throw Error("DLG buffer undefined");if(this.bfOffset>this.bfLength)throw Error("DLG buffer invalid offset "+this.bfOffset+"max: "+this.bfLength);this.bf=new Uint8Array(this.bf.buffer.slice(this.bfOffset));this.bfLength-=this.bfOffset;this.bfOffset=0;if(this.bfLength!==this.bf.length)throw Error("DLG buffer invalid length "+this.bfLength+"expected: "+this.bf.length);};
eq.c.Rq.prototype.decodeUi32=function(){for(var c=0,b=0,d,a=0;;){if(this.bfOffset>=this.bfLength)throw Error("DLG buffer offset exceeded: "+(this.bfOffset+1)+", max: "+this.bfLength);if(5<++a)throw Error("DLG buffer varint overflow, offset: "+this.bfOffset);d=this.bf[this.bfOffset++];if(!(d&128))break;c|=(d&127)<<b;b+=7}return c|d<<b};eq.c.Rq.prototype.decodeUint=function(){var c=this.bfOffset,b=this.decodeUi32();if(0>b)throw Error("DLG buffer UINT out of range: "+b+", offset: "+c);return b};
eq.c.Rq.prototype.decodeInt=function(){var c=this.decodeUi32();return c&1?c>>>1^-1:c>>>1};eq.c.Rq.decodeStringFailed=function(c,b,d){throw Error("DLG buffer invalid STRING UTF-8 encoding, offset: "+c+", len: "+b+", min: "+d);};
eq.c.Rq.prototype.decodeString=function(){var c=this.decodeUint(),b=this.bfOffset;this.bfOffset+=c;if(this.bfOffset>this.bfLength)throw Error("DLG buffer offset exceeded: "+this.bfOffset+", max: "+this.bfLength);for(var d="";c;){var a=this.bf[b];128>a?(d+=String.fromCharCode(a),b+=1,--c):191<a&&224>a?(2>c&&eq.c.Rq.decodeStringFailed(b,c,2),d+=String.fromCharCode((a&31)<<6|this.bf[b+1]&63),b+=2,c-=2):223<a&&240>a?(3>c&&eq.c.Rq.decodeStringFailed(b,c,3),d+=String.fromCharCode((a&15)<<12|(this.bf[b+
1]&63)<<6|this.bf[b+2]&63),b+=3,c-=3):(4>c&&eq.c.Rq.decodeStringFailed(b,c,4),a=((a&7)<<18|(this.bf[b+1]&63)<<12|(this.bf[b+2]&63)<<6|this.bf[b+3]&63)-65536,d+=String.fromCharCode(a>>10|55296,a&1023|56320),b+=4,c-=4)}return d};eq.c.Rq.prototype.decodeData=function(){var c=this.decodeUint(),b=this.bfOffset;this.bfOffset+=c;if(this.bfOffset>this.bfLength)throw Error("DLG buffer offset exceeded: "+this.bfOffset+", max: "+this.bfLength);return this.bf.subarray(b,b+c)};
eq.c.Rq.subClass("DlgRq",function(){eq.c.Rq.call(this);this.next=null});eq.c.DlgRq.mode={ssnNew:1,ssnResume:2,message:3,login:4,global:5,rootFont:6,add:7,modify:8,del:9,cancel:10,invalidate:11,DLG_DRAW:12,DLG_DO:13,POPUP_BOX:14,update:15,updated:16};eq.c.DlgRq.prototype.dispose=function(){eq.c.Rq.prototype.dispose.call(this);this.msg=void 0;if(this.next){var c=this.next;this.next=null;c.dispose()}};eq.c.DlgRq.prototype.assign=function(c){eq.c.Rq.prototype.assign.call(this,c);this.msg=[]};
eq.c.Obj.subClass("Rs",function(){eq.c.Obj.call(this);this.bf=[]});eq.c.Rs.prototype.dispose=function(){this.bf.length=0};eq.c.Rs.prototype.buffer=function(){var c=new Uint8Array(this.bf);this.bf.length=0;return c.buffer};eq.c.Rs.prototype.takeBuffer=function(){var c=this.bf;this.bf=[];return c};eq.c.Rs.prototype.putBuffer=function(c){this.bf=c};eq.c.Rs.prototype.encodeUint=function(c){for(var b=this.bf,d=0;c&-128;){if(5===++d)throw Error("Varint value overflow");b.push(c&127|128);c>>>=7}b.push(c)};
eq.c.Rs.prototype.encodeInt=function(c){this.encodeUint(0>c?c<<1^-1:c<<1)};
eq.c.Rs.prototype.encodeString=function(c){var b=this.bf,d,a=0,e=c.length;for(d=0;d<e;d++){var f=c.charCodeAt(d);if(128>f)a+=1;else if(2048>f)a+=2;else if(55296>f||57344<=f)a+=3;else{if(++d===e)throw Error("Incomplete STRING surrogate pair, offset: "+d);a+=4}}this.encodeUint(a);var g=b.length;b.length+=a;for(d=0;d<e;d++)f=c.charCodeAt(d),128>f?b[g++]=f:(2048>f?b[g++]=192|f>>6:(55296>f||57344<=f?b[g++]=224|f>>12:(f=65536+((f&1023)<<10|c.charCodeAt(++d)&1023),b[g++]=240|f>>18,b[g++]=128|f>>12&63),b[g++]=
128|f>>6&63),b[g++]=128|f&63)};eq.c.Rs.prototype.encodeData=function(c){var b=this.bf,d,a=c.length;this.encodeUint(a);var e=b.length;b.length+=a;for(d=0;d<a;d++)b[e++]=c[d]};eq.c.Rs.subClass("DlgRs",function(){eq.c.Rs.call(this)});eq.c.DlgRs.op={start:1,resume:2,synced:3,event:4,popup:5,invalidate:6,update:7,updated:8,canceled:9,logError:10};eq.d=eq.d||[];eq.c.Obj.subClass("Dlg",function(c){eq.c.Obj.call(this);this.id=c;this.root=null;this.grid={};this.tabOrder=[];this.tabOrderValid=!1});
eq.c.Dlg.prototype.temp=!1;eq.c.Dlg.prototype.close=function(){this.root&&(this.root.del(),this.root=null);this.tabOrder.length=0;this.tabOrderValid=!1};
eq.c.Dlg.prototype.addChild=function(c,b,d){var a=new (eq.d[c.decodeUint()-1]);a.id=c.decodeString();var e;b?(b.addChild(a),a.focusable&&!a.containerFocusable()&&(a.focusable=!1)):(e=c.mode===eq.c.DlgRq.mode.updated)||(this.root&&this.root.del(),this.root=a);var f={id:a.id,dcn:a.constructor.name};d?(d.ch=d.ch||[],d.ch.push(f)):e||(b?f.pa=b.id:this.temp&&(f.pa="eq-temp"),this.temp&&!a.tempUi||c.msg.push({o:eq.MainOp.addControl,i:this.id,d:f}));a.setup(this,c,f);a.focusable&&a.visible&&(f.cla=f.cla||
[]).push("eq-focus");e&&a.del();return f};eq.c.Dlg.prototype.findById=function(c,b){if(this.root){var d=this.root.findById(c);if(d)return d}if(b)throw Error("Dlg.findById("+c+") failed: not found");return null};eq.c.Dlg.prototype.gridWidth=function(c){return c&&this.grid.wp?Math.round(c/this.grid.wp):0};eq.c.Dlg.prototype.gridHeight=function(c){return c&&this.grid.hp?Math.round(c/this.grid.hp):0};eq.c.Dlg.prototype.pxWidth=function(c){return c?Math.round(c*this.grid.wp*1E3)/1E3:0};
eq.c.Dlg.prototype.pxHeight=function(c){return c?Math.round(c*this.grid.hp*1E3)/1E3:0};eq.c.Dlg.prototype.cssWidth=function(c){return c?Math.round(c*this.grid.wf*1E3)/1E3+"ch":0};eq.c.Dlg.prototype.cssHeight=function(c){return c?Math.round(c*this.grid.hf*1E3)/1E3+"em":0};eq.c.Dlg.prototype.updateTabOrder=function(){this.tabOrder.length=0;(this.tabOrderValid=null!==this.root)&&this.root.updateTabOrder(this.tabOrder)};eq.c.Obj.subClass("DlgControl",function(){eq.c.Obj.call(this)});
eq.c.DlgControl.prototype.posRaster=!0;eq.c.DlgControl.prototype.sizeRaster=!0;eq.c.DlgControl.prototype.defaultHeight=!0;eq.c.DlgControl.prototype.focusable=!0;eq.c.DlgControl.prototype.visible=!0;eq.c.DlgControl.prototype.sensitive=!0;eq.c.DlgControl.prototype.border=!0;eq.c.DlgControl.addClass=function(c,b){this.subClass(c,b);eq.d.push(b);return b};eq.c.DlgControl.prototype.del=function(c){this.id=void 0;return this.parent?(c||this.parent.childDeleted(this),this.parent=void 0,!1):!0};
eq.c.DlgControl.prototype.setup=function(c,b,d){for(var a;a=b.decodeUint();)this.setAttr(c,b,a,d)};eq.c.DlgControl.isSetup=function(c,b,d){for(var a,e=!1,f=2;f<=d;f++,b=b.et)if(void 0===b.et){void 0===a&&(a=c.mode===eq.c.DlgRq.mode.modify);if(!a)throw Error("DlgControl.isSetup: missing level "+f);b.et={};e=!0}return e};
eq.c.DlgControl.prototype.modify=function(c,b,d){for(var a,e=this.focusable,f=this.visible;a=b.decodeUint();)this.setAttr(c,b,a,d);c=this.focusable;b=this.visible;!!e===!!c&&!!f===!!b||(c&&b?d.cla=d.cla||[]:d.clr=d.clr||[]).push("eq-focus")};
eq.c.DlgControl.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.cssid:this.id=a.id=b.decodeString();break;case e.cssclsDel:for(a=a.clr=a.clr||[];(c=b.decodeString()).length;)a.push(c);break;case e.cssclsAdd:for(a=a.cla=a.cla||[];(c=b.decodeString()).length;)a.push(c);break;case e.font:var f=eq.api;f=f.fixupFont({fc:b.decodeString(),sz:f.fixupFontSize(b.decodeUint()),st:b.decodeUint()});d=f.fc;e=f.sz;var g=f.st,h=eq.FontStyle;if(d||e||g&(h.bold|h.italic)){var k="{";d&&(k+="font-family:"+
d+";");e&&(k+="font-size:"+e+";");g&h.bold&&(k+="font-weight:bold;");g&h.italic&&(k+="font-style:italic;");k+="}"}a=this.setFontAttr(c,b,a,f,k)&&k?a.cla=a.cla||[]:a.clr=a.clr||[];a.push("eq-font");break;case e.raster:f=b.decodeUint();b=eq.DialogRaster;this.posRaster=!!(f&b.pos);this.sizeRaster=!!(f&b.size);break;case e.posSize:k=a.st=a.st||{};switch(b.decodeInt()){case -1:f=b.decodeInt();k.right=this.posRaster?c.cssWidth(f):f?f+"px":0;(f=b.decodeInt())?k.width=this.sizeRaster?c.cssWidth(f):f+"px":
k.width=this.defaultWidth?c.cssWidth(1):null;k.left=null;break;case 0:f=b.decodeInt();k.left=this.posRaster?c.cssWidth(f):f?f+"px":0;f=b.decodeInt();k.right=this.posRaster?c.cssWidth(f):f?f+"px":0;k.width=null;break;case 1:f=b.decodeInt(),k.left=this.posRaster?c.cssWidth(f):f?f+"px":0,(f=b.decodeInt())?k.width=this.sizeRaster?c.cssWidth(f):f+"px":k.width=this.defaultWidth?c.cssWidth(1):null,k.right=null}switch(b.decodeInt()){case -1:f=b.decodeInt();k.bottom=this.posRaster?c.cssHeight(f):f?f+"px":
0;(f=b.decodeInt())?(k.height=this.sizeRaster?c.cssHeight(f):f+"px",k["min-height"]=null):this.defaultHeight?(k.height=c.cssHeight(1),k["min-height"]=null):(k.height=null,k["min-height"]=c.cssHeight(1));k.top=null;break;case 0:f=b.decodeInt();k.top=this.posRaster?c.cssHeight(f):f?f+"px":0;f=b.decodeInt();k.bottom=this.posRaster?c.cssHeight(f):f?f+"px":0;k.height=null;k["min-height"]=null;break;case 1:f=b.decodeInt(),k.top=this.posRaster?c.cssHeight(f):f?f+"px":0,(f=b.decodeInt())?(k.height=this.sizeRaster?
c.cssHeight(f):f+"px",k["min-height"]=null):this.defaultHeight?(k.height=c.cssHeight(1),k["min-height"]=null):(k.height=null,k["min-height"]=c.cssHeight(1)),k.bottom=null}break;case e.size:k=a.st=a.st||{};(f=b.decodeInt())?k.width=this.sizeRaster?c.cssWidth(f):f?f+"px":0:k.width=this.defaultWidth?c.cssWidth(1):null;(f=b.decodeInt())?(k.height=this.sizeRaster?c.cssHeight(f):f?f+"px":0,k["min-height"]=null):this.defaultHeight?(k.height=c.cssHeight(1),k["min-height"]=null):(k.height=null,k["min-height"]=
c.cssHeight(1));break;case e.border:f=b.decodeUint();this.border&&(a=f?a.cla=a.cla||[]:a.clr=a.clr||[],a.push("eq-border"));break;case e.rule:(k=b.decodeInt())?this.rule=k:delete this.rule;this.setRuleAttr(c,b,a,k);-1===k?(a=a.cla=a.cla||[],this.focusable=!1,c.tabOrderValid=!1):(a=a.clr=a.clr||[],Object.prototype.hasOwnProperty.call(this,"focusable")&&(this.containerFocusable()?delete this.focusable:this.focusable=!1,c.tabOrderValid=!1));void 0!==a&&a.push("eq-help");break;case e.tabOnEnter:a=b.decodeUint()?
a.clr=a.clr||[]:a.cla=a.cla||[];a.push("eq-noenter");break;case e.visible:k=a.st=a.st||{};b.decodeUint()?(a=a.clr=a.clr||[],k.display=null,delete this.visible):(a=a.cla=a.cla||[],k.display="none",this.visible=!1);a.push("eq-hidden");c.tabOrderValid=!1;break;case e.sensitive:b=b.decodeUint();k=a.rtd=a.rtd||[];k.push({t:eq.RqTag.sensitive,v:b});b?(a=a.clr=a.clr||[],delete this.sensitive):(a=a.cla=a.cla||[],this.sensitive=!1);a.push("eq-disabled");c.tabOrderValid=!1;break;case e.inactive:b.decodeUint()?
this.inactive=!0:delete this.inactive;c.tabOrderValid=!1;break;case e.tabStop:a=b.decodeUint()?a.clr=a.clr||[]:a.cla=a.cla||[];a.push("eq-notab");break;case e.bgColor:c=b.decodeString();k=a.st=a.st||{};k["background-color"]=c.length?c:null;break;case e.fgColor:c=b.decodeString();k=a.st=a.st||{};k.color=c.length?c:null;break;case e.focusColor:b.decodeString();break;case e.btnMask:c=a.ds=a.ds||{};f=b.decodeUint();b=0;f&1&&(b|=1);f&2&&(b|=4);f&4&&(b|=2);c.mask=b||null;break;case e.contextMenu:this.contextMenu=
b.decodeUint()?!0:void 0;break;case e.clipboardMenu:b=b.decodeString();this.clipboardMenu=b.length?b:void 0;break;case e.help:this.help=b.decodeString();break;case e.toolTip:k=a.rtd=a.rtd||[];k.push({t:d,v:b.decodeString()});break;default:throw Error(this.constructor.name+".setAttr("+this.id+") failed: tag "+d);}};eq.c.DlgControl.prototype.setFontAttr=function(c,b,d,a,e){return!1};eq.c.DlgControl.prototype.setRuleAttr=function(c,b,d,a){};
eq.c.DlgControl.prototype.findById=function(c){return c===this.id?this:null};eq.c.DlgControl.prototype.containerFocusable=function(){return this.parent?this.parent.containerFocusable():!0};eq.c.DlgControl.prototype.updateTabOrder=function(c){this.visible&&this.sensitive&&!this.inactive&&this.focusable&&c.push(this.id)};
eq.c.DlgControl.prototype.onHelp=function(){for(var c=this,b="",d=eq.api.helpBaseUrl,a=eq.c.Api.reIsAbsoluteUrl,e;c;){if(e=c.help)if(b=e+b,a.test(b))return b;c=c.parent}return b.length&&null!==d&&!a.test(b)?d+b:b};eq.c.DlgControl.prototype.onMouseButton2=function(c,b,d,a,e,f){for(var g=this;g;){0<f&&!(b&2)&&(f=0);if(!(f||!g.contextMenu&&!g.ruleButton2||b&d))break;if(0<f||g.contextMenu||g.ruleButton2){postMessage([{o:eq.MainOp.onMouseButton2,d:c.id,i:this.id,x:a,y:e,c:f}]);break}g=g.parent}};
eq.c.DlgControl.prototype.onUpdate=function(c,b,d){var a=eq.UpdateTag;switch(b){case a.changed:a=eq.api;var e=a.dlgRs;try{e.encodeUint(eq.c.DlgRs.op.update),e.encodeUint(c.id),e.encodeString(""),e.encodeUint(b),eq.c.Api.packElements(c,e,d.c),e.encodeUint(0),a.ws.send(e.buffer())}catch(h){if(e.dispose(),void 0!==a.ws)throw h;}break;case a.mouseButton2:for(var f=this,g=d.c;f;){if(0<g||f.contextMenu){a=eq.api;e=a.dlgRs;try{e.encodeUint(eq.c.DlgRs.op.update),e.encodeUint(c.id),e.encodeString(f.id),e.encodeUint(eq.UpdateTag.ctxMenuOpen),
e.encodeString(this.id),e.encodeInt(d.x),e.encodeInt(d.y),e.encodeUint(0<g?g:0),e.encodeUint(0),a.ws.send(e.buffer())}catch(h){if(e.dispose(),void 0!==a.ws)throw h;}return!0}if(f.ruleButton2)return d.rule=f.ruleButton2,this.notifyUpdated(c,b,d);f=f.parent}break;case a.ctxMenuAct:c=d.i;if(void 0!==c){a=eq.api;e=a.dlgRs;try{e.encodeUint(eq.c.DlgRs.op.update),e.encodeUint(0),e.encodeString(""),e.encodeUint(b),e.encodeString(c),e.encodeUint(0),a.ws.send(e.buffer())}catch(h){if(e.dispose(),void 0!==a.ws)throw h;
}}break;default:throw Error(this.constructor.name+".onUpdate("+this.id+") failed: tag "+b);}return!0};eq.c.DlgControl.prototype.updated=function(c,b,d,a,e){switch(b){case eq.UpdateTag.ctxMenuOpen:this.notifyUpdated(c,b,{id:d.decodeString(),x:d.decodeInt(),y:d.decodeInt(),c:d.decodeUint(),et:c.addChild(d)});break;default:throw Error(this.constructor.name+".updated("+this.id+") failed: tag "+b);}};
eq.c.DlgControl.prototype.notifyUpdated=function(c,b,d){postMessage([{o:eq.MainOp.updated,d:c.id,i:this.id,t:b,a:d}]);return!0};eq.c.DlgControl.prototype.getClipboardMenu=function(){for(var c=this,b;c;){if(void 0!==(b=c.clipboardMenu))return b;c=c.parent}return eq.api.clipboardMenu};eq.c.DlgControl.subClass("DlgContainer",function(){eq.c.DlgControl.call(this);this.ch=[]});eq.c.DlgContainer.prototype.focusable=!1;
eq.c.DlgContainer.addClass=function(c,b){return eq.c.DlgControl.addClass.call(this,c,b)};eq.c.DlgContainer.prototype.addChild=function(c){this.ch.push(c);c.parent=this};eq.c.DlgContainer.prototype.childDeleted=function(c){var b=this.ch.indexOf(c);if(-1===b)throw Error(this.constructor.name+".childDeleted("+this.id+", "+c.id+") failed: not found");this.ch.splice(b,1)};
eq.c.DlgContainer.prototype.del=function(c){void 0===c&&(c=0);for(var b=this.ch.length;0<=--b;)this.ch[b].del(c+1);this.ch.length=0;return eq.c.DlgControl.prototype.del.call(this,c)};eq.c.DlgContainer.prototype.setup=function(c,b,d){for(var a;a=b.decodeUint();)if(a===eq.RqTag.child){for(a=d;void 0!==a.et;)a=a.et;c.addChild(b,this,a)}else this.setAttr(c,b,a,d)};
eq.c.DlgContainer.prototype.findById=function(c){if(c===this.id)return this;for(var b=0,d=this.ch.length;b<d;b++){var a=this.ch[b].findById(c);if(a)return a}return null};eq.c.DlgContainer.prototype.updateTabOrder=function(c){if(this.visible&&this.sensitive&&!this.inactive){this.focusable&&c.push(this.id);for(var b=0,d=this.ch.length;b<d;b++)this.ch[b].updateTabOrder(c)}};
eq.MainOp={apiThreadStarted:1,ssnNewOrResume:2,inject:3,message:4,login:5,applicationStopped:6,applicationFailed:7,popupPos:8,warnLeavingPage:9,windowFeature:10,windowFeatures:11,grid:12,layout:13,notifyBusy:14,typeAhead:15,cancelCurrentCall:16,update:17,updated:18,synced:19,openUrl:20,beep:21,playSound:22,startApp:23,activate:24,clipboard:25,resume:26,addControl:27,modifyControl:28,deleteControl:29,invalidate:30,onMouseButton2:31,onClipboardMenu:32,dlg_DRAW:33,dlg_DO:34,dlg_POPUP_BOX:35};
eq.ApiOp={documentComplete:1,installPlugins:2,injectDone:3,openWebSocket:4,closeWebSocket:5,onLoginEvent:6,onEvent:7,onPopupEvent:8,onSynced:9,onDo:10,onHelp:11,onMouseButton2:12,invalidate:13,update:14,updated:15,canceled:16,grid:17,logError:18};eq.UpdateTag={changed:1,dialogDo:2,mouseButton2:3,ctxMenuOpen:4,ctxMenuAct:5,tabOrder:6,colResized:7,colMoved:8,sortSequence:9,lineOrder:10,plgUpdate:11,plgGetVal:12,screenSize:13,clipboard:14};
eq.RqTag={child:1,cssid:2,cssclsDel:3,cssclsAdd:4,font:5,raster:6,posSize:7,size:8,border:9,rule:10,ruleMode:11,tabOnEnter:12,visible:13,sensitive:14,inactive:15,tabStop:16,bgColor:17,fgColor:18,focusColor:19,btnMask:20,contextMenu:21,clipboardMenu:22,url:23,help:24,toolTip:25,dndMode:27,dropRule:28,globalDropRule:29,dialogState:30,dialogPosSize:31,logoIcon:32,fKey:33,dialogTimer:34,ruleButton2:35,dialogDo:36,margin:37,bgImage:38,vx:39,vy:40,vWidth:41,vHeight:42,accel:43,text:45,textPos:46,align:47,
active:48,radioGroup:49,icon:50,iconActive:51,type:52,itemId:53,objId:54,scrollable:55,multiline:56,readonly:57,wrapmode:58,maxchars:59,content:60,ispassword:61,fitfont:62,autocomplete:63,autotab:64,vcRule:65,columns:66,colOrder:67,colState:68,colTitle:69,lineOrder:70,activeLine:71,vActiveLine:72,topItem:73,rowHeight:74,status:75,bgColor2:76,fgColor2:77,gridColor:78,colToolTip:79,lineToolTip:80,emptyNode:81,separator:82,tabs:83,selectedTab:84,panes:85,vertical:86,position:87,quickExpand:88,value:89,
items:94,boxSize:95,open:96,scaling:97,plgInt:98,plgString:99,plgBinary:100,popupPos:101,baseUrl:102,helpBaseUrl:103,windowFeature:104,layout:105,notifyBusy:106,typeAhead:107,openUrl:108,openHelpUrl:109,startApp:110,activate:111,beep:112,soundUrl:113,clipboard:114};
eq.RsValType={idFocus:1,ruleOnce:2,textValue:3,buttonChecked:4,caretPos:5,activeLine:6,activeLineCol:7,topItem:8,selectedTab:9,splitterPos:10,scrollPos:11,status:12,colOrder:13,colWidth:14,lineOrder:15,emptyNode:16,ruleKey:17,mouseBtns:18,mouseCnt:19,mouseMods:20,dialogMax:21,dialogPos:22,dialogSize:23,screenSize:24,dragFrom:25,dragContent:26,dropContent:27,dropAction:28,dropPos:29,dropColumn:30,dropLine:31,dropElement:32,plgVoid:33,plgInt:34,plgString:35,plgBinary:36};
eq.PopupPos={top:1,left:2,login:4,message:8,box:16};eq.DlgCall={set:6};eq.DlgValType={tInt:1,tString:2};eq.LayoutMode={inline:1,maximized:2,dialog:4};eq.DialogMode={none:0,layout:1,scale:2,inline:3,modeMask:3,stateShift:2};eq.DialogState={maximized:1};eq.DialogRaster={pos:1,size:2};eq.Margin={top:1,right:2,bottom:4,left:8};eq.BgFill={tile:0,topLeft:1,center:2,scale:3};eq.FontStyle={bold:1,italic:2};eq.TextPos={right:1,left:2,bottom:3,top:4};
eq.ColState={alignMask:3,visible:4,raster:8,movable:16,sizable:32,sortable:64,userHide:128};eq.ColType={colAlphaNofold:0,colNumeric:1,colBoolean:2,colBarGraph:3,colAlphaFold:5,colDate:6};eq.MenuType={item:0,sep:1,radio:2,check:3};eq.TabState={visible:1,sensitive:2};eq.RuleType={bgColor:1,bgColor2:2,bgImage:3,childFont:4,fgColor:5,fgColor2:6,focusColor:7,font:8,gridColor:9,height:10,width:11};eq.atrGET=1;eq.atrSET=2;eq.atrIDX=4;eq.atrINT=8;eq.atrSTR=16;eq.atrBIN=32;eq.atrPRI=64;eq.atrNOC=128;
eq.atrLST=256;eq.atrSYN=512;eq.PluginFlags={focusable:4,tabOnEnter:8};eq.KeyMod={shift:1,ctrl:2,alt:4,meta:8};eq.Dnd={local:1,global:2,move:4,copy:8,link:16,all:28,dropExact:32};eq.c.DlgControl.addClass("CheckBox",function(){eq.c.DlgControl.call(this)});delete eq.c.CheckBox.subClass;eq.c.CheckBox.prototype.setup=function(c,b,d){d.cla=["eq-checkbox","eq-control"];d.et={ch:[{id:"*"},{id:"*"}]};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.CheckBox.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.fgColor:case e.focusColor:break;case e.textPos:case e.active:case e.text:eq.c.DlgControl.isSetup(b,a,2)&&(a.et.ch=a.et.ch||[{},{}]);break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a);return}switch(d){case e.textPos:this.iBtn=b.decodeUint();c=a.et.ch[this.iBtn];c.tg="INPUT";c.at={type:"checkbox"};c.ev={c:["click"]};c=a.et.ch[this.iBtn?0:1];c.tg="LABEL";c.at={"for":a.id+"-"+(this.iBtn+1)};c.cla=["eq-fn"];
break;case e.active:c=a.et.ch[this.iBtn];c.at=c.at||{};c.at.checked=0!==b.decodeUint();break;case e.text:c=a.et.ch[this.iBtn?0:1];c.hca=b.decodeString();break;case e.fgColor:a=a.cr=a.cr||[];b=b.decodeString();c={ty:eq.RuleType.fgColor};b.length&&(c.rl=">*>label{color:"+b+"}");a.push(c);break;case e.focusColor:a=a.cr=a.cr||[],b=b.decodeString(),c={ty:eq.RuleType.focusColor},b.length&&(c.rl=".eq-focused>*>label{color:"+b+"}"),a.push(c)}};
eq.c.CheckBox.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-checkbox>*>label.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};eq.c.CheckBox.prototype.setRuleAttr=function(c,b,d,a){eq.c.DlgControl.isSetup(b,d,2)&&(d.et.ch=d.et.ch||[{},{}]);c=d.et.ch[this.iBtn];(c.ev=c.ev||{}).a=a?["mousedown"]:null};eq.c.DlgControl.addClass("ComboBox",function(){eq.c.DlgControl.call(this);this.defaultHeight=8});delete eq.c.ComboBox.subClass;
eq.c.ComboBox.prototype.setup=function(c,b,d){var a=this.defaultHeight;this.defaultPxHeight=c.pxHeight(a);this.defaultCssHeight=c.cssHeight(a);d.cla=["eq-combobox","eq-control","eq-border","eq-dn"];d.et={tg:"INPUT",at:{type:"text",autocomplete:"off",autocorrect:"off",spellcheck:!1},cla:["eq-fn"],ev:{c:["input","mousedown","dnd"]}};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.ComboBox.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.items:case e.boxSize:case e.open:case e.bgColor:case e.focusColor:case e.autocomplete:case e.dndMode:case e.dropRule:case e.globalDropRule:break;case e.readonly:case e.maxchars:case e.content:case e.align:eq.c.DlgControl.isSetup(b,a,2);break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a);return}switch(d){case e.items:c=b.decodeUint();e=a.rtd=a.rtd||[];var f=[];f.length=c;for(a=0;a<c;a++)f[a]=b.decodeString();
e.push({t:d,v:f});break;case e.boxSize:f=b.decodeUint();b=b.decodeUint();e=a.rtd=a.rtd||[];var g;this.sizeRaster?(f&&(g=c.pxWidth(f)+"px"),b=b&&b>this.defaultHeight?c.cssHeight(b):this.defaultCssHeight):(f&&(g=f+"px"),b=b&&b>this.defaultPxHeight?b+"px":this.defaultCssHeight);e.push({t:d,w:g,h:b});break;case e.readonly:d=a.et.at=a.et.at||{};b.decodeUint()?(b=a.cla=a.cla||[],d.readonly=!0,this.focusable=!1):(b=a.clr=a.clr||[],d.readonly=null,delete this.focusable);b.push("eq-readonly");c.tabOrderValid=
!1;break;case e.maxchars:b=b.decodeUint();d=a.et.at=a.et.at||{};d.maxlength=b?b:null;break;case e.content:b=b.decodeString();e=a.rt=a.rt||[];a.et.ec=b;e.push({t:d,l:b.length});break;case e.align:d=a.et.st=a.et.st||{};switch(b.decodeUint()){case 0:d["text-align"]=null;break;case 1:d["text-align"]="center";break;case 2:d["text-align"]="right"}break;case e.open:b=b.decodeUint()?a.cla=a.cla||[]:a.clr=a.clr||[];b.push("eq-auto");break;case e.bgColor:d=a.cr=a.cr||[];b=b.decodeString();a={ty:eq.RuleType.bgColor};
b.length&&(a.rl="{background-color:"+b+"}");d.push(a);break;case e.focusColor:d=a.cr=a.cr||[];b=b.decodeString();a={ty:eq.RuleType.focusColor};b.length&&(a.rl=".eq-focused{background-color:"+b+"}");d.push(a);break;case e.autocomplete:c=b.decodeUint();e=a.rtd=a.rtd||[];c&&(f={r:c,d:b.decodeUint(),m:b.decodeUint()});e.push({t:d,v:f});break;case e.dndMode:e=a.rtd=a.rtd||[];e.push({t:d,i:b.decodeUint()});break;case e.dropRule:case e.globalDropRule:e=a.rtd=a.rtd||[],e.push({t:d,i:b.decodeInt()})}};
eq.c.ComboBox.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-combobox>input.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};eq.c.ComboBox.prototype.setRuleAttr=function(c,b,d,a){eq.c.DlgControl.isSetup(b,d,2);c=d.et.ev=d.et.ev||{};a?(d=d.cla=d.cla||[],c.a=["blur"]):(d=d.clr=d.clr||[],c.a=null);d.push("eq-rule")};eq.c.ComboBox.prototype.containerFocusable=function(){return!0};
eq.c.ComboBox.prototype.onMouseButton2=function(c,b,d,a,e,f){0<f||this.contextMenu||!(b&2)?eq.c.DlgControl.prototype.onMouseButton2.call(this,c,b,d,a,e,f):postMessage([{o:eq.MainOp.onClipboardMenu,d:c.id,i:this.id,x:a,y:e,c:f,m:this.getClipboardMenu()}])};eq.c.DlgContainer.addClass("Dialog",function(){eq.c.DlgContainer.call(this)});delete eq.c.Dialog.subClass;
eq.c.Dialog.prototype.setup=function(c,b,d){d.cla=["eq-dialog","eq-control","eq-border"];d.ev={c:["dnd"]};d.et={cla:["eq-pane"],et:{cla:["eq-view"],et:{cla:["eq-container"]}}};eq.c.DlgContainer.prototype.setup.call(this,c,b,d)};
eq.c.Dialog.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag,f=eq.DialogMode;switch(d){case e.dialogState:d=a.dlg=a.dlg||{};e=d.l=d.l||{};var g=b.decodeUint();this.mode=e.mode=g&f.modeMask;this.state=e.state=g>>f.stateShift;break;case e.dialogPosSize:eq.c.DlgControl.isSetup(b,a,3);d=a.dlg=a.dlg||{};e=d.l=d.l||{};var h=a.st=a.st||{},k=a.et.et.st=a.et.et.st||{};-1===(g=b.decodeInt())?e.x=-1:e.x=this.posRaster?c.cssWidth(g):g?g+"px":0;-1===(g=b.decodeInt())?e.y=-1:e.y=this.posRaster?c.cssHeight(g):
g?g+"px":0;0<(g=b.decodeInt())&&(e.w=this.sizeRaster?c.cssWidth(g):g+"px");0<(g=b.decodeInt())&&(e.h=this.sizeRaster?c.cssHeight(g):g+"px");h.bottom=null;h.right=null;k.width=e.w||null;k.height=e.h||null;this.mode!==f.inline&&(e.x||e.y||e.w||e.h)?(g=a.clr=a.clr||[],g.push("eq-inline")):(e.mode=f.inline,g=a.cla=a.cla||[],g.push("eq-inline"),this.state&eq.DialogState.maximized||!e.w&&!e.h||(g=a.clr=a.clr||[]));g.push("eq-max");break;case e.posSize:eq.c.DlgControl.isSetup(b,a,3);d=a.dlg=a.dlg||{};h=
a.st=a.st||{};k=a.et.et.st=a.et.et.st||{};g=a.clr=a.clr||[];d.l=null;g.push("eq-inline");g.push("eq-max");switch(b.decodeInt()){case -1:g=b.decodeInt();h.right=this.posRaster?c.cssWidth(g):g?g+"px":0;(g=b.decodeInt())?k.width=this.sizeRaster?c.cssWidth(g):g+"px":this.defaultWidth&&(k.width=c.cssWidth(1));h.left=null;break;case 0:g=b.decodeInt(),h.left=this.posRaster?c.cssWidth(g):g?g+"px":0,g=b.decodeInt(),h.right=this.posRaster?c.cssWidth(g):g?g+"px":0,k.width=null}switch(b.decodeInt()){case -1:g=
b.decodeInt();h.bottom=this.posRaster?c.cssHeight(g):g?g+"px":0;(g=b.decodeInt())?k.height=this.sizeRaster?c.cssHeight(g):g+"px":k.height=c.cssHeight(1);h.top=null;break;case 0:g=b.decodeInt(),h.top=this.posRaster?c.cssHeight(g):g?g+"px":0,g=b.decodeInt(),h.bottom=this.posRaster?c.cssHeight(g):g?g+"px":0,k.height=null}break;case e.margin:eq.c.DlgControl.isSetup(b,a,4);g=b.decodeUint();h=a.et.et.et.st=a.et.et.et.st||{};g?(b=eq.Margin,g&(b.top|b.bottom)?(d=c.cssHeight(.5),h.top=g&b.top?d:null,h.bottom=
g&b.bottom?d:null):(h.top=null,h.bottom=null),g&(b.right|b.left)?(d=c.cssWidth(.5),h.right=g&b.right?d:null,h.left=g&b.left?d:null):(h.right=null,h.left=null)):(h.top=null,h.right=null,h.bottom=null,h.left=null);break;case e.logoIcon:d=a.dlg=a.dlg||{};c=eq.api.makeUrl(b.decodeString());d.ic=c.length?c:null;break;case e.fKey:d=a.dlg=a.dlg||{};c=[];e=b.decodeUint();c.length=e;for(g=0;g<e;g++)c[g]=b.decodeInt();d.f=c;break;case e.dialogTimer:d=a.dlg=a.dlg||{};c=b.decodeUint();d.tm=c?{delay:c,rule:b.decodeInt()}:
null;break;case e.ruleButton2:this.ruleButton2=b.decodeInt();break;case e.vcRule:d=a.dlg=a.dlg||{};d.vc=b.decodeInt();break;case e.dialogDo:d=a.dlg=a.dlg||{};b.decodeUint()?(d.d={hide:b.decodeString(),show:b.decodeString(),f:b.decodeString()},c.tabOrderValid||(c.updateTabOrder(),d.d.t=c.tabOrder)):d.d=null;break;case e.text:d=a.dlg=a.dlg||{};d.t=b.decodeString();break;case e.fgColor:b.decodeString();break;case e.bgImage:d=a.cr=a.cr||[];g={ty:eq.RuleType.bgImage};c=eq.api.makeUrl(b.decodeString());
b=b.decodeUint();if(c.length){a=eq.BgFill;switch(b){case a.topLeft:b="";break;case a.center:b="background-position:center;";break;case a.scale:b="background-size:cover;";break;default:b="background-repeat:repeat;"}g.rl=[">.eq-pane>.eq-view{background-image:url('"+c+"');"+b+"}"]}d.push(g);break;case e.dropRule:case e.globalDropRule:(a.rt=a.rt||[]).push({t:d,i:b.decodeInt()});break;default:eq.c.DlgContainer.prototype.setAttr.call(this,c,b,d,a)}};
eq.c.Dialog.prototype.setRuleAttr=function(c,b,d,a){(a?d.cla=d.cla||[]:d.clr=d.clr||[]).push("eq-rule")};eq.c.DlgControl.addClass("EditText",function(){eq.c.DlgControl.call(this)});delete eq.c.EditText.subClass;eq.c.EditText.prototype.setup=function(c,b,d){d.cla=["eq-edittext","eq-control"];d.et={cla:["eq-fn"],ev:{c:["input","blur","dnd"]}};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.EditText.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.bgColor:case e.focusColor:case e.fitfont:case e.autocomplete:case e.autotab:case e.dndMode:case e.dropRule:case e.globalDropRule:break;case e.multiline:case e.readonly:case e.wrapmode:case e.maxchars:case e.content:case e.ispassword:case e.align:case e.fgColor:eq.c.DlgControl.isSetup(b,a,2);break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a);return}switch(d){case e.multiline:var f=a.et,g=f.at=f.at||{};
c=a.rt=a.rt||[];(this.multiline=b.decodeUint())?(f.tg="TEXTAREA",b=a.cla=a.cla||[],g.wrap="off",g.autocapitalize="none"):(f.tg="INPUT",b=a.clr=a.clr||[],g.type=this.ispassword?"password":"text");g.autocomplete="off";g.autocorrect="off";g.spellcheck=!1;b.push("eq-enter");c.push({t:d});break;case e.readonly:g=a.et.at=a.et.at||{};b.decodeUint()?(b=a.cla=a.cla||[],g.readonly=!0,this.focusable=!1):(b=a.clr=a.clr||[],g.readonly=null,delete this.focusable);b.push("eq-readonly");b.push("eq-md");c.tabOrderValid=
!1;break;case e.wrapmode:e=b.decodeUint();b=e&3;f=a.et;g=f.at=f.at||{};c=a.rtd=a.rtd||[];if(!this.multiline)throw Error("EditText.setAttr("+this.id+") wrapmode:"+e+" multi-line:false");c.push({t:d,b:2==b});b?(g.wrap=2==b?"hard":"soft",b=a.cla=a.cla||[],b.push("eq-wrap"),e&4||(b=a.clr=a.clr||[])):(g.wrap="off",b=a.clr=a.clr||[],b.push("eq-wrap"));b.push("eq-char");break;case e.maxchars:d=b.decodeUint();g=a.et.at=a.et.at||{};g.maxlength=d?d:null;break;case e.content:b=b.decodeString();c=a.rt=a.rt||
[];a.et.ec=b;c.push({t:d,l:b.length});break;case e.ispassword:this.ispassword=b.decodeUint();this.multiline||(g=a.et.at=a.et.at||{},g.type=this.ispassword?"password":"text");break;case e.align:a=a.et.st=a.et.st||{};switch(b.decodeUint()){case 0:a["text-align"]=null;break;case 1:a["text-align"]="center";break;case 2:a["text-align"]="right"}break;case e.bgColor:a=a.cr=a.cr||[];b=b.decodeString();d={ty:eq.RuleType.bgColor};b.length&&(d.rl="{background-color:"+b+"}");a.push(d);break;case e.focusColor:a=
a.cr=a.cr||[];b=b.decodeString();d={ty:eq.RuleType.focusColor};b.length&&(d.rl=".eq-focused{background-color:"+b+"}");a.push(d);break;case e.fgColor:b=b.decodeString();a=a.et.st=a.et.st||{};a.color=b.length?b:null;break;case e.fitfont:e=b.decodeUint();c=a.rtd=a.rtd||[];e&&(g={},e&1&&(g.w=b.decodeUint()),e&2&&(g.h=b.decodeUint()));c.push({t:d,ff:g});break;case e.autocomplete:e=b.decodeUint();c=a.rtd=a.rtd||[];e&&(f={r:e,d:b.decodeUint(),m:b.decodeUint()});c.push({t:d,v:f});break;case e.autotab:e=b.decodeUint();
c=a.rt=a.rt||[];if(this.multiline)throw Error("EditText.setAttr("+this.id+") autotab:"+e+" multi-line:true");c.push({t:d,i:e});break;case e.dndMode:c=a.rtd=a.rtd||[];c.push({t:d,i:b.decodeUint()});break;case e.dropRule:case e.globalDropRule:c=a.rtd=a.rtd||[],c.push({t:d,i:b.decodeInt()})}};eq.c.EditText.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-edittext>.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};
eq.c.EditText.prototype.setRuleAttr=function(c,b,d,a){eq.c.DlgControl.isSetup(b,d,2);(d.et.ev=d.et.ev||{}).a=a?["blur"]:null};eq.c.EditText.prototype.containerFocusable=function(){return!0};eq.c.EditText.prototype.onMouseButton2=function(c,b,d,a,e,f){0<f||this.contextMenu||!(b&2)?eq.c.DlgControl.prototype.onMouseButton2.call(this,c,b,d,a,e,f):postMessage([{o:eq.MainOp.onClipboardMenu,d:c.id,i:this.id,x:a,y:e,c:f,m:this.getClipboardMenu()}])};eq.c.DlgContainer.addClass("GroupBox",function(){eq.c.DlgContainer.call(this)});
delete eq.c.GroupBox.subClass;eq.c.GroupBox.prototype.setup=function(c,b,d){d.cla=["eq-groupbox","eq-control","eq-border"];d.et={cla:["eq-pane"],ev:{c:["scroll"]},et:{cla:["eq-view"],et:{cla:["eq-container"]}}};eq.c.DlgContainer.prototype.setup.call(this,c,b,d)};
eq.c.GroupBox.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.vx:case e.vy:case e.text:case e.accel:case e.bgColor:case e.fgColor:case e.bgImage:case e.dropRule:case e.globalDropRule:break;case e.vWidth:case e.vHeight:eq.c.DlgControl.isSetup(b,a,3);break;case e.margin:eq.c.DlgControl.isSetup(b,a,4);break;default:eq.c.DlgContainer.prototype.setAttr.call(this,c,b,d,a);return}switch(d){case e.vx:b=b.decodeUint();a=a.rtd=a.rtd||[];a.push({t:d,i:this.sizeRaster?c.pxWidth(b):b});break;
case e.vy:b=b.decodeUint();a=a.rtd=a.rtd||[];a.push({t:d,i:this.sizeRaster?c.pxHeight(b):b});break;case e.vWidth:b=b.decodeUint();e=a.et.et.st=a.et.et.st||{};a=a.rtd=a.rtd||[];b?(e.width=this.sizeRaster?c.cssWidth(b):b+"px",this.vWidth=b):(e.width="",this.vWidth=void 0);a.push({t:d,s:!(!this.vWidth&&!this.vHeight)});break;case e.vHeight:b=b.decodeUint();e=a.et.et.st=a.et.et.st||{};a=a.rtd=a.rtd||[];b?(e.height=this.sizeRaster?c.cssHeight(b):b+"px",this.vHeight=b):(e.height="",this.vHeight=void 0);
a.push({t:d,s:!(!this.vWidth&&!this.vHeight)});break;case e.margin:b=b.decodeUint();e=a.et.et.et.st=a.et.et.et.st||{};b?(d=eq.Margin,b&(d.top|d.bottom)?(a=c.cssHeight(.5),e.top=b&d.top?a:null,e.bottom=b&d.bottom?a:null):(e.top=null,e.bottom=null),b&(d.right|d.left)?(a=c.cssWidth(.5),e.right=b&d.right?a:null,e.left=b&d.left?a:null):(e.right=null,e.left=null)):(e.top=null,e.right=null,e.bottom=null,e.left=null);break;case e.text:a=a.rt=a.rt||[];a.push({t:d,v:b.decodeString()});break;case e.accel:a=
a.rt=a.rt||[];a.push({t:d,v:b.decodeString()});break;case e.bgColor:c=a.cr=a.cr||[];d=b.decodeString();e={ty:eq.RuleType.bgColor};d.length&&(e.rl=">.eq-pane{background-color:"+d+"}");c.push(e);break;case e.fgColor:c=a.cr=a.cr||[];d=b.decodeString();e={ty:eq.RuleType.fgColor};d.length&&(e.rl=">.eq-title{color:"+d+"}");c.push(e);break;case e.bgImage:c=a.cr=a.cr||[];e={ty:eq.RuleType.bgImage};d=eq.api.makeUrl(b.decodeString());b=b.decodeUint();if(d.length){a=eq.BgFill;switch(b){case a.topLeft:b="";break;
case a.center:b="background-position:center;";break;case a.scale:b="background-size:cover;";break;default:b="background-repeat:repeat;"}e.rl=[">.eq-pane>.eq-view{background-image:url('"+d+"');"+b+"}"]}c.push(e);break;case e.dropRule:case e.globalDropRule:a=a.rtd=a.rtd||[],a.push({t:d,i:b.decodeInt()})}};eq.c.GroupBox.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-groupbox>.eq-title>span.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};
eq.c.GroupBox.prototype.setRuleAttr=function(c,b,d,a){(a?d.cla=d.cla||[]:d.clr=d.clr||[]).push("eq-rule")};eq.c.DlgControl.addClass("HtmlView",function(){eq.c.DlgControl.call(this)});delete eq.c.HtmlView.subClass;eq.c.HtmlView.prototype.focusable=!1;eq.c.HtmlView.prototype.setup=function(c,b,d){d.cla=["eq-htmlview","eq-control","eq-border","eq-md"];d.ev={c:["change","dnd"]};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.HtmlView.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.url:a=a.rt=a.rt||[];a.push({t:d,v:eq.api.makeUrl(b.decodeString())});break;case e.content:a=a.rt=a.rt||[];a.push({t:d,ty:b.decodeUint(),v:b.decodeString()});break;case e.bgColor:b=b.decodeString();d=a.cr=a.cr||[];a={ty:eq.RuleType.bgColor};b.length&&(a.rl=">textarea{background-color:"+b+"}");d.push(a);break;case e.fgColor:b=b.decodeString();d=a.cr=a.cr||[];a={ty:eq.RuleType.fgColor};b.length&&(a.rl=">textarea{color:"+
b+"}");d.push(a);break;case e.dndMode:a=a.rt=a.rt||[];a.push({t:d,i:b.decodeUint()});break;case e.dropRule:case e.globalDropRule:a=a.rt=a.rt||[];a.push({t:d,i:b.decodeInt()});break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a)}};eq.c.HtmlView.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-htmlview>textarea.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};eq.c.HtmlView.prototype.setRuleAttr=function(c,b,d,a){(a?d.cla=d.cla||[]:d.clr=d.clr||[]).push("eq-rule")};
eq.c.DlgControl.addClass("Image",function(){eq.c.DlgControl.call(this)});delete eq.c.Image.subClass;eq.c.Image.prototype.focusable=!1;eq.c.Image.prototype.setup=function(c,b,d){d.cla=["eq-image","eq-control","eq-border"];eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.Image.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.url:b=eq.api.makeUrl(b.decodeString());a=a.st=a.st||{};a["background-image"]=b.length?'url("'+b+'")':"none";break;case e.scaling:c=b.decodeInt();b=b.decodeInt();a=a.st=a.st||{};0<c&&0<b?(a["background-position"]="top left",a["background-size"]=c+"px "+b+"px"):-2===c&&-2===b?(a["background-position"]="center",a["background-size"]="contain"):-1===c&&-1===b?(a["background-position"]="top left",a["background-size"]="100% 100%"):
(a["background-position"]="center",a["background-size"]="auto");break;case e.fgColor:b.decodeString();break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a)}};eq.c.Image.prototype.setRuleAttr=function(c,b,d,a){(d.ev=d.ev||{}).a=a?["mousedown"]:null};
eq.c.DlgControl.addClass("ListBox",function(){eq.c.DlgControl.call(this);this.nCols=0;this.colContent=[];this.colVisible=[];this.colOrder=[];this.colState=[];this.colType=[];this.colWidth=[];this.colTitle=[];this.colFormat=[];this.colFont=[];this.colBgColor=[];this.colFgColor=[];this.colToolTip=[];this.lineSeq=[];this.lineOrder=[]});delete eq.c.ListBox.subClass;eq.c.ListBox.prototype.focusable=!0;
eq.c.ListBox.prototype.setup=function(c,b,d){d.cla=["eq-listbox","eq-control","eq-border"];d.ev={c:"mousedown scroll resize move sort dnd".split(" ")};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.ListBox.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.columns:this.nCols=e=b.decodeUint();this.colContent.length=this.colVisible.length=this.colOrder.length=this.colState.length=this.colType.length=this.colWidth.length=this.colToolTip.length=this.colFormat.length=this.colFont.length=this.colBgColor.length=this.colFgColor.length=this.colTitle.length=this.lineSeq.length=this.lineOrder.length=0;c.temp||(a=a.rt=a.rt||[],a.push({t:d,l:e}));break;case e.colOrder:var f=this.colVisible,
g=this.colOrder,h=0;e=this.nCols;for(g.length=e;h<e;){var k=b.decodeUint();if(k>=e)throw Error("ListBox.setAttr("+this.id+") invalid colOrder vi:"+k+" i:"+h+" l:"+e);g[k]=h++}if(!c.temp&&f.length){b=[];b.length=f.length;for(h=c=0;h<e;h++)-1!==(k=f.indexOf(g[h]))&&(f.splice(c,0,f.splice(k,1)[0]),b[c++]=k);a=a.rt=a.rt||[];a.push({t:d,m:b})}break;case e.colState:d=this.constructor;var l=this.colState;f=this.colType;var m=this.colWidth,p=this.colFormat,n=this.colFont,q=this.colBgColor,x=this.colFgColor;
h=0;e=this.nCols;var t=l.length,z=eq.api,u;g=b.decodeUint();for(l.length=f.length=m.length=p.length=n.length=q.length=x.length=e;h<e;){l[h]=b.decodeUint();var r=b.decodeUint();h<t&&r!==f[h]&&(u=!0);f[h]=r;m[h]=b.decodeUint();r=d.getFormatMethod(r,b.decodeString());h<t&&r!==p[h]&&(u=!0);p[h]=r;n[h]=z.fixupFont({fc:b.decodeString(),sz:z.fixupFontSize(b.decodeUint()),st:b.decodeUint()});q[h]=b.decodeString();x[h++]=b.decodeString()}if(c.temp)for(g=this.colOrder,f=this.colVisible,b=eq.ColState,h=f.length=
0;h<e;)l[k=g[h++]]&b.visible&&f.push(k);else this.updateColState(c,a.rt=a.rt||[],u,g);break;case e.colTitle:k=this.colTitle;h=0;e=this.nCols;for(k.length=e;h<e;)k[h++]=b.decodeString();c.temp||this.updateColTitle(a.rt=a.rt||[]);break;case e.lineOrder:d=this.constructor;u=this.lineSeq;f=this.colType;l=this.colContent;h=0;e=b.decodeUint();g=b.decodeUint();for(u.length=e;h<e;)k=b.decodeUint(),m=b.decodeUint(),u[h++]={i:k,d:m,c:d.getCompareMethod(f[k])};if(g&&l.length){k=this.lineOrder;if(e){k.length=
d=l[0].length;for(h=0;h<d;h++)k[h]=h;d&&this.sort()}else k.length=0;c.temp||(a=a.rt=a.rt||[],this.updateLineOrder(a),this.updateContent(a))}break;case e.colToolTip:c=this.colToolTip;a.rt=a.rt||[];h=0;e=b.decodeUint();for(c.length=e;h<e;)c[h++]=b.decodeString();this.updateColToolTip(a.rt=a.rt||[]);break;case e.content:a=a.rt=a.rt||[];e=b.decodeUint();l=this.colContent;f=this.nCols;if(0===f){h=0;l.length=1;l[0]=g=[];for(g.length=e;h<e;)g[h++]=b.decodeString();c.temp||a.push({t:d,c:l})}else{m=b.decodeString();
u=this.lineSeq;k=this.lineOrder;l.length=f;for(p=0;p<f;p++)l[p]=g=[],g.length=e;k.length=d=u.length?e:0;for(h=0;h<e;h++){g=b.decodeString();u=(g=g.split(m)).length;for(p=0;p<f;p++)p<u&&(l[p][h]=g[p]);d&&(k[h]=h)}d&&this.sort();c.temp||(this.updateLineOrder(a),this.updateContent(a))}break;case e.lineToolTip:a=a.rt=a.rt||[];e=b.decodeUint();if(0===e)a.push({t:d,ltt:null});else{k=[];k.length=e;for(h=0;h<e;h++)c=b.decodeString(),k[h]=c.length?c:null;a.push({t:d,ltt:k})}break;case e.activeLine:case e.vActiveLine:case e.topItem:h=
b.decodeUint();c.temp||(a=a.rtd=a.rtd||[],a.push({t:d,i:h}));break;case e.rowHeight:h=b.decodeUint();c.temp||(h=0<h?h+"px":c.cssHeight(1),e=a.cr=a.cr||[],e.push({ty:eq.RuleType.height,rl:" .eq-column>*{height:"+h+"}"}));break;case e.ruleMode:this.ruleMode=b.decodeUint();break;case e.vcRule:e=b.decodeInt();c.temp||((a.ds=a.ds||{}).rule=e?e:null);break;case e.bgColor:g=b.decodeString();c.temp||(e=a.cr=a.cr||[],h={ty:eq.RuleType.bgColor},g.length&&(h.rl=[">.eq-caption>.eq-space>*,",">.eq-pane{background-color:"+
g+"}"]),e.push(h));break;case e.focusColor:g=b.decodeString();c.temp||(e=a.cr=a.cr||[],h={ty:eq.RuleType.focusColor},g.length&&(h.rl=[".eq-focused>.eq-caption>.eq-space>*,",".eq-focused>.eq-pane{background-color:"+g+"}"]),e.push(h));break;case e.fgColor:g=b.decodeString();c.temp||(e=a.cr=a.cr||[],h={ty:eq.RuleType.fgColor},g.length&&(h.rl=">.eq-pane{color:"+g+"}"),e.push(h));break;case e.bgColor2:g=b.decodeString();c.temp||(e=a.cr=a.cr||[],h={ty:eq.RuleType.bgColor2},g.length&&(h.rl=" .eq-column>:nth-child(2n){background-color:"+
g+"}"),e.push(h));break;case e.fgColor2:g=b.decodeString();c.temp||(e=a.cr=a.cr||[],h={ty:eq.RuleType.fgColor2},g.length&&(h.rl=" .eq-column>:nth-child(2n){color:"+g+"}"),e.push(h));break;case e.gridColor:g=b.decodeString();c.temp||(e=a.cr=a.cr||[],h={ty:eq.RuleType.gridColor},g.length&&(h.rl=[".eq-multi>.eq-pane>.eq-column>*,.eq-overlay>",".eq-multi>.eq-pane{border-color:"+g+"}"]),e.push(h));break;case e.dndMode:a=a.rtd=a.rtd||[];a.push({t:d,i:b.decodeUint()});break;case e.dropRule:case e.globalDropRule:a=
a.rtd=a.rtd||[];a.push({t:d,i:b.decodeInt()});break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a)}};eq.c.ListBox.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-listbox .eq-column>.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};
eq.c.ListBox.prototype.setRuleAttr=function(c,b,d,a){if(!c.temp)if(c=d.ev=d.ev||{},a)switch(c.a=["mousedown","keydown"],this.ruleMode){case 1:c.m=1;c.f=null;break;case 2:c.m=2;c.f=1;break;case 3:c.m=1;c.f=1;break;default:c.m=2,c.f=null}else c.a=null,c.m=null,c.f=null};
eq.c.ListBox.prototype.onUpdate=function(c,b,d){var a=eq.UpdateTag,e=null;switch(b){case a.colResized:var f=this.colVisible[d.col];d=d.width;this.colWidth[f]=this.colState[f]&eq.ColState.raster?c.gridWidth(d):d;break;case a.colMoved:a=this.colVisible;var g=this.colOrder;f=d.from;var h=g.indexOf(a[f]);d=d.to;var k=g.indexOf(a[d]);a.splice(d,0,a.splice(f,1)[0]);g.splice(k,0,g.splice(h,1)[0]);break;case a.sortSequence:f=this.colVisible[d.col];k=this.lineSeq;e=this.lineOrder;var l=[];a=0;for(g=k.length;a<
g&&(h=k[a]).i!==f;a++);a<g?(d.add||(k=this.lineSeq=[h],a=0),h.d?k.splice(a,1):h.d=1):(a=this.constructor.getCompareMethod(this.colType[f]),d.add||(k.length=0),k.push({i:f,d:0,c:a}));e.length=g=this.colContent[0].length;for(a=0;a<g;a++)e[a]=a;g&&this.sort();this.updateLineOrder(l);this.updateContent(l);e={rt:l};break;case a.lineOrder:d=d.rs;e=this.lineOrder;a=0;g=e.length;for(d.encodeUint(g);a<g;)d.encodeUint(e[a++]);return!0;case a.ctxMenuAct:f=d.c;if(void 0!==f){a=eq.api;d=a.dlgRs;h=this.colState;
k=eq.ColState;try{d.encodeUint(eq.c.DlgRs.op.update),d.encodeUint(c.id),d.encodeString(this.id),d.encodeUint(b),d.encodeUint(f),d.encodeUint(0),a.ws.send(d.buffer())}catch(m){if(d.dispose(),void 0!==a.ws)throw m;}a=0;for(g=this.nCols;a<g;a++)if(h[a]&k.userHide&&0===f--){h[a]^=k.visible;this.updateColState(c,l=[],!0,!0);e={rt:l};break}}break;case a.mouseButton2:f=d.c,0<f&&(d.c=this.colVisible[f-1]+1);default:return eq.c.DlgControl.prototype.onUpdate.call(this,c,b,d)}return this.notifyUpdated(c,b,e)};
eq.c.ListBox.prototype.packValue=function(c,b,d){var a=eq.RsValType;switch(b){case a.colOrder:a=this.colOrder;var e=[];d=this.nCols;e.length=d;for(b=0;b<d;b++)e[a[b]]=b;for(b=0;b<d;)c.encodeUint(e[b++]);break;case a.colWidth:a=this.colWidth;b=0;for(d=this.nCols;b<d;)c.encodeInt(a[b++]);break;case a.lineOrder:a=this.lineSeq;e=this.lineOrder;c.encodeUint(d=a.length);for(b=0;b<d;){var f=a[b++];c.encodeUint(f.i);c.encodeUint(f.d)}c.encodeUint(d=e.length);for(b=0;b<d;)c.encodeUint(e[b++]);break;case a.activeLineCol:a=
d.i1;d=d.i2;if(void 0===a||void 0===d)throw Error("ListBox.packValue: "+b+" i1/i2 expected");c.encodeUint(a);0<d&&(d=this.colVisible[d-1]+1);c.encodeUint(d);break;case a.dropColumn:d=d.iv;if(void 0===d)throw Error("ListBox.packValue: "+b+" iv expected");0<=d&&(d=this.colVisible[d]);c.encodeInt(d);break;default:throw Error("ListBox.packValue("+this.id+") failed: type "+b);}};
eq.c.ListBox.prototype.updateColState=function(c,b,d,a){for(var e=this.colVisible,f=this.colOrder,g=this.colState,h=this.colType,k=this.colWidth,l=this.colFont,m=this.colBgColor,p=this.colFgColor,n=[],q=[],x=!1,t=eq.ColState,z=0,u=this.nCols,r,y,A,F,B;z<u;)(y=g[r=f[z++]])&t.visible?(n.push(r),A=0==(A=k[r])?null:y&t.raster?c.cssWidth(A):A+"px",B=m[r],F=p[r],q.push({type:h[r],align:y&t.alignMask,movable:!!(y&t.movable),sizable:!!(y&t.sizable),sortable:!!(y&t.sortable),w:A,fn:l[r],bc:B.length?B:null,
fc:F.length?F:null}),y&t.userHide&&(x=!0),e.length&&-1===e.indexOf(r)&&(d=!0)):-1!==e.indexOf(r)&&q.push(null);this.colVisible=n;b.push({t:eq.RqTag.colState,s:q,uh:x});d&&(this.updateColTitle(b),this.updateColToolTip(b),a&&(this.updateLineOrder(b),this.updateContent(b)))};eq.c.ListBox.prototype.updateColTitle=function(c){var b=this.colVisible,d=this.colTitle,a=b.length,e=[];e.length=a;for(var f=0,g=0;f<a;f++)e[g++]=d[b[f]];c.push({t:eq.RqTag.colTitle,ct:e})};
eq.c.ListBox.prototype.updateLineOrder=function(c){for(var b=this.colVisible,d=this.lineSeq,a=[],e,f,g=0,h=d.length;g<h;g++)-1!==(f=b.indexOf((e=d[g]).i))&&a.push({i:f,d:e.d});c.push({t:eq.RqTag.lineOrder,s:a,o:this.lineOrder})};
eq.c.ListBox.prototype.updateColToolTip=function(c){var b=this.colToolTip,d=b.length;if(0===d)c.push({t:eq.RqTag.colToolTip,ctt:null});else{var a=this.colVisible,e=a.length,f=[],g=0,h,k;for(f.length=e;g<e;)f[g++]=null;for(g=0;g<d;g++)(k=b[g]).length&&-1!==(h=a.indexOf(g))&&(f[h]=k);c.push({t:eq.RqTag.colToolTip,ctt:f})}};
eq.c.ListBox.prototype.updateContent=function(c){var b=this.colVisible,d=this.colFormat,a=this.colContent,e=b.length,f=[],g,h,k,l,m,p;f.length=e;for(g=h=0;g<e;g++){var n=b[g];if((k=a[n])&&(l=d[n])){n=[];n.length=m=k.length;for(p=0;p<m;p++)n[p]=l(k[p]);f[h++]=n}else f[h++]=k}c.push({t:eq.RqTag.content,c:f})};eq.c.ListBox.trimHtml=function(c){var b=eq.c.ListBox,d=b.reIsHtml.exec(c);return d?d[1].replace(b.reTrimHtml,""):c};eq.c.ListBox.reIsHtml=/^<html>(.*?)(<\/html>)?$/i;eq.c.ListBox.reTrimHtml=/<[^>]*>/g;
eq.c.ListBox.getFormatMethod=function(c,b){var d=eq.ColType;switch(c){case d.colNumeric:return this.formatNumber(b);case d.colBoolean:return this.formatBoolean;case d.colBarGraph:return this.formatBarGraph;case d.colDate:return this.formatDate(b)}return null};eq.c.ListBox.IsEscape=/'/g;eq.c.ListBox.UnEscape=/'[^']*'/g;eq.c.ListBox.ScanNumber=/((([0#]*),)?([0#]+))(\.([0#]*))?/g;
eq.c.ListBox.formatNumber=function(c){if(c&&c.length){var b=this.ScanNumber;var d=this.IsEscape;for(var a=this.UnEscape,e={maximumFractionDigits:20,useGrouping:!1},f=0,g=0,h=[],k=h[0]=[],l,m,p,n;l=b.exec(c);){if(2>g){if((m=l.index)>f){if((p=(n=c.substring(f,m)).match(d))&&p.length&1)continue;k[0]=n}f=m+l[0].length;if(0===g){void 0!==l[2]&&(e.useGrouping=!0);void 0===(l=l[6])?e.maximumFractionDigits=0:(e.maximumFractionDigits=l.length,m=l.indexOf("#"),e.minimumFractionDigits=-1!==m?m:l.length);for(l=
f;-1!==(m=(n=c.substring(l)).indexOf(";"))&&(p=(n=c.substring(f,l+=m)).match(d))&&0!==(p.length&1);l++);if(-1===m){g=2;continue}n.length&&(k[1]=n);k=h[1]=[];f=l+1}}g++}f<c.length&&(k[1]=c.substring(f));for(m=0;2>m;m++)if(k=h[m])for(c=void 0,l=0;2>l;l++)if(k[l]&&(void 0===c&&(-1===(c=k[l].indexOf("%"))||0<c&&(p=k[l].substring(0,c).match(d))&&p.length&1)&&(c=void 0),(k[l]=k[l].replace(a,function(u){return 2===u.length?"'":u.substring(1,u.length-1)})).length))if(m){var q=k;var x=c}else{var t=k;var z=
c}d=new Intl.NumberFormat(eq.api.locale.tag,e)}else void 0===(d=this.defaultNumberFormat)&&(this.defaultNumberFormat=d=new Intl.NumberFormat(eq.api.locale.tag,{maximumFractionDigits:20,useGrouping:!1}));return this.getNumberFormatMethod(d,t,q,0<=z,0<=x)};
eq.c.ListBox.getNumberFormatMethod=function(c,b,d,a,e){var f=/<[^>]*>([^<]+)/g,g=c.format;return function(h){var k,l,m,p,n;if(k=f.exec(h)){do if(void 0===m&&(p=(l=k[1]).length)){var q=Number(l);q===q&&(m=f.lastIndex-p)}while(k=f.exec(h));if(void 0===m)return h}else{if(!h)return"";q=Number(h);if(q!==q)return h}if((k=d)&&0>q)if(e&&(q*=100),q=g(-q),l=k[0])q=(n=k[1])?l+q+n:l+q;else{if(n=k[1])q+=n}else if(a&&(q*=100),q=g(q),k=b)if(l=k[0])q=(n=k[1])?l+q+n:l+q;else if(n=k[1])q+=n;if(void 0!==m){if(m)return h.length>
m+p?h.substring(0,m)+q+h.substring(m+p):h.substring(0,m)+q;if(h.length>m+p)return q+h.substring(m+p)}return q}};eq.c.ListBox.formatBoolean=function(){var c=eq.c.ListBox.trimHtml;return function(b){if(void 0===b)return"0";b=c(b);return b.length&&"0"!==b&&"false"!==b.toLowerCase()?"1":"0"}}();
eq.c.ListBox.scanBarGraph=function(){var c=/([0-9]+)(;([0-9]+))?/;return function(b){var d=c.exec(b);return d&&(b=Number(d[1]),b===b)?(void 0!==(d=d[3])&&(d=Number(d),b=d===d&&0!==d?100*b/d:0),100<b?100:Math.round(1E3*b)/1E3):0}}();eq.c.ListBox.formatBarGraph=function(){var c=eq.c.ListBox.scanBarGraph,b=eq.c.ListBox.trimHtml;return function(d){return void 0!==d?c(b(d)).toString():"0"}}();
eq.c.ListBox.formatDate=function(c){var b=this.formatDate;if(c&&c.length&&!b.invalid.test(c)){var d;var a={year:"numeric",month:"2-digit",day:"2-digit"};-1===c.indexOf("yyyy")&&(a.year="2-digit");-1!==c.indexOf("MMM")?a.month="short":-1===c.indexOf("MM")&&(a.month="numeric");-1===c.indexOf("dd")&&(a.day="numeric");-1!==c.indexOf("EE")&&(a.weekday="short");a=new Intl.DateTimeFormat(eq.api.locale.tag,a);if("function"===typeof a.formatToParts){if(d=b.sep.exec(c)){var e=[];do e.push(d[1]);while(d=b.sep.exec(c))}void 0===
e&&(e=[""])}}else void 0===(a=b.defaultDateFormat)&&(b.defaultDateFormat=a=new Intl.DateTimeFormat(eq.api.locale.tag,{year:"numeric",month:"2-digit",day:"2-digit"}));return this.getDateFormatMethod(a,e)};eq.c.ListBox.formatDate.invalid=/([A-DF-LN-Za-ce-xz]+)/;eq.c.ListBox.formatDate.sep=/([^A-Z]+)/gi;
eq.c.ListBox.getDateFormatMethod=function(c,b){var d=/([0-9]{4})([0-9]{2})([0-9]{2})/,a=c.format;return function(e){if(void 0===e||0===e.length)return"";var f=d.exec(e);if(f){var g=new Date(Number(f[1]),Number(f[2])-1,Number(f[3]));if(void 0!==b){var h=c.formatToParts(g),k,l=0,m=b.length;g="";var p=0;for(k=h.length;p<k;p++)"literal"===h[p].type?(g+=b[l],l<m-1&&l++):g+=h[p].value.replace(/\.$/,"")}else g=a(g);return f.index?e.length>f.index+8?e.substring(0,f.index)+g+e.substring(f.index+8):e.substring(0,
f.index)+g:8<e.length?g+e.substring(8):g}return e}};eq.c.ListBox.prototype.sort=function(){var c=this.lineSeq,b=this.colContent,d=this.constructor.trimHtml;this.lineOrder.sort(function(a,e){for(var f=0,g=c.length;f<g;){var h=c[f++],k=h.i;if(h.d){var l=b[k][e];k=b[k][a]}else l=b[k][a],k=b[k][e];void 0!==l&&(l=d(l));void 0!==k&&(k=d(k));if(l!==k)return void 0===l?-1:void 0===k?1:h.c(l,k)}return a-e})};
eq.c.ListBox.getCompareMethod=function(c){var b=eq.ColType;switch(c){case b.colAlphaNofold:return this.compareAlphaNoFold;case b.colNumeric:return this.compareNumber;case b.colBoolean:return this.compareBoolean;case b.colBarGraph:return this.compareBarGraph;case b.colAlphaFold:return this.compareAlphaFold}return this.comparePlain};eq.c.ListBox.comparePlain=function(c,b){return c===b?0:c>b?1:-1};
eq.c.ListBox.compareAlphaNoFold=function(){var c,b;return function(d,a){void 0===c&&(c=(new Intl.Collator(eq.api.locale.tag)).compare,b=0<c("A","a"));var e=d.length,f=a.length,g=0;e=e<f?e:f;for(var h,k;g<e&&(h=d[g])===(k=a[g]);)g++;if(g<e){g=h.toLowerCase();e=k.toLowerCase();if(h!==g&&k===e)return b?1:-1;if(k!==e&&h===g)return b?-1:1}return c(d,a)}}();eq.c.ListBox.compareAlphaFold=function(){var c;return function(b,d){void 0===c&&(c=(new Intl.Collator(eq.api.locale.tag)).compare);return c(b,d)}}();
eq.c.ListBox.compareNumber=function(c,b){c=Number(c);b=Number(b);return c!==c?b===b?-1:0:b!==b?c===c?1:0:c===b?0:c>b?1:-1};eq.c.ListBox.compareBoolean=function(c,b){c=c.length&&"0"!==c&&"false"!==c.toLowerCase();b=b.length&&"0"!==b&&"false"!==b.toLowerCase();return c!==b?c?1:-1:0};eq.c.ListBox.compareBarGraph=function(){var c=eq.c.ListBox.scanBarGraph;return function(b,d){b=c(b);d=c(d);return b!==d?b>d?1:-1:0}}();eq.c.DlgContainer.addClass("MenuBar",function(){eq.c.DlgContainer.call(this)});delete eq.c.MenuBar.subClass;
eq.c.MenuBar.prototype.border=!1;eq.c.MenuBar.prototype.setup=function(c,b,d){d.tg="UL";d.cla=["eq-menubar","eq-control","eq-container"];this.parent&&(d.cr=[{ty:eq.RuleType.height,rl:">li{height:"+c.cssHeight(1)+"}"}]);eq.c.DlgContainer.prototype.setup.call(this,c,b,d)};
eq.c.MenuBar.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.bgColor:c=a.cr=a.cr||[];b=b.decodeString();d={ty:eq.RuleType.bgColor};b.length&&(d.rl=[","," ul{background-color:"+b+"}"]);c.push(d);break;case e.scrollable:(a.cla=a.cla||[]).push("eq-scroll");break;default:eq.c.DlgContainer.prototype.setAttr.call(this,c,b,d,a)}};eq.c.MenuBar.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-menubar li>label.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};
eq.c.DlgControl.addClass("MenuItem",function(){eq.c.DlgControl.call(this)});delete eq.c.MenuItem.subClass;eq.c.MenuItem.prototype.focusable=!1;eq.c.MenuItem.prototype.border=!1;eq.c.MenuItem.prototype.setup=function(c,b,d){d.tg="LI";d.cla=["eq-item","eq-control"];d.ev={c:["mousedown","click","input"]};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.MenuItem.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.textPos:c=a.rt=a.rt||[];c.push({t:d,v:b.decodeUint()});break;case e.type:case e.active:c=a.rtd=a.rtd||[];c.push({t:d,v:b.decodeUint()});break;case e.text:c=a.rtd=a.rtd||[];c.push({t:d,v:b.decodeString()});break;case e.accel:c=a.rtd=a.rtd||[];c.push({t:d,v:b.decodeString()});break;case e.icon:c=a.rtd=a.rtd||[];c.push({t:d,v:eq.api.makeUrl(b.decodeString())});break;case e.itemId:d=a.ds=a.ds||{};d.item=b.decodeString()||
null;break;case e.objId:d=a.ds=a.ds||{};d.obj=b.decodeString()||null;break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a)}};eq.c.MenuItem.prototype.setRuleAttr=function(c,b,d,a){c=d.ev=d.ev||{};b.mode===eq.c.DlgRq.mode.updated?(b=d.ds=d.ds||{},a?(c.a=["mousedown"],b.rule=a):(c.a=null,b.rule=null)):c.a=a?["click"]:null};eq.c.MenuItem.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-item.eq-font>label.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};
eq.c.DlgContainer.addClass("Menu",function(){eq.c.DlgContainer.call(this)});delete eq.c.Menu.subClass;eq.c.Menu.prototype.border=!1;eq.c.Menu.prototype.setup=function(c,b,d){d.tg="LI";d.cla=["eq-menu","eq-control"];d.ev={c:["mousedown"]};d.et={tg:"UL",cla:["eq-container"]};eq.c.DlgContainer.prototype.setup.call(this,c,b,d)};
eq.c.Menu.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.textPos:c=a.rtd=a.rtd||[];c.push({t:d,v:b.decodeUint()});break;case e.align:c=a.rtd=a.rtd||[];c.push({t:d,v:b.decodeUint()});break;case e.text:c=a.rtd=a.rtd||[];c.push({t:d,v:b.decodeString()});break;case e.icon:c=a.rtd=a.rtd||[];c.push({t:d,v:eq.api.makeUrl(b.decodeString())});break;case e.bgColor:d=a.cr=a.cr||[];b=b.decodeString();c={ty:eq.RuleType.fgColor};b.length&&(c.rl=this.parent instanceof eq.c.MenuBar?[","," ul{background-color:"+
b+"}"]:"{background-color:"+b+"}");d.push(c);break;default:eq.c.DlgContainer.prototype.setAttr.call(this,c,b,d,a)}};eq.c.Menu.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];var f;e&&(f=[".eq-menu>label.eq-fn,",".eq-menu li>label.eq-fn"+e]);c.push({ty:eq.RuleType.font,rl:f});return!0};
eq.installPlugins=function(c){var b=eq.api.plg,d=c.length,a;b=eq.api.plg=void 0!==b?b.concat(c):c;for(b=0;b<d;b++){var e="plg"+(a=c[b]).n;e=eq.c.Plugin.subClass(e,function(){eq.c.Plugin.call(this)});delete e.subClass;if(a=a.p){var f=e.prototype;for(var g in a)f[g]=a[g]}eq.d.push(e)}};eq.c.DlgControl.subClass("Plugin",function(){eq.c.DlgControl.call(this)});eq.c.Plugin.prototype.border=!1;eq.c.Plugin.prototype.tempUi=!0;
eq.c.Plugin.prototype.setup=function(c,b,d){var a=d.cla=["eq-plugin","eq-control"],e=this.classList;e&&(d.cla=a.concat(e.split(" ")));if(e=this.changeEvent)(d.ev=d.ev||{}).c=e.split(" ");eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.Plugin.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.plgInt:case e.plgString:case e.plgBinary:c=a.rt=a.rt||[];var f=b.decodeString(),g=b.decodeString();a={};f={t:d,a:f,i:g.length?g:null,v:a};d==e.plgInt?a.i=b.decodeInt():d==e.plgString?a.s=b.decodeString():a.b=b.decodeData();c.push(f);break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a)}};
eq.c.Plugin.prototype.setFontAttr=function(c,b,d,a,e){(d.rt=d.rt||[]).push({t:eq.RqTag.font,a:"font",i:null,v:{font:a,fontRules:e}});return!0};eq.c.Plugin.prototype.setRuleAttr=function(c,b,d,a){if(c=this.actionEvent)(d.ev=d.ev||{}).a=a?c.split(" "):null;(a?d.cla=d.cla||[]:d.clr=d.clr||[]).push("eq-rule")};eq.c.Plugin.prototype.onUpdate=function(c,b,d){var a=eq.UpdateTag;return b===a.plgUpdate||b===a.plgGetVal?!1:eq.c.DlgControl.prototype.onUpdate.call(this,c,b,d)};
eq.c.Plugin.prototype.updated=function(c,b,d,a,e){c=eq.UpdateTag;switch(b){case c.plgUpdate:break;case c.plgGetVal:if(void 0!==e){if(void 0!==e.i){a.encodeUint(eq.RsValType.plgInt);a.encodeInt(e.i);break}if(void 0!==e.s){a.encodeUint(eq.RsValType.plgString);a.encodeString(e.s);break}if(void 0!==e.b){a.encodeUint(eq.RsValType.plgBinary);a.encodeData(e.b);break}}a.encodeUint(eq.RsValType.plgVoid);break;default:throw Error(this.constructor.name+".updated("+this.id+") failed: tag "+b);}};
eq.c.DlgControl.addClass("PopText",function(){eq.c.DlgControl.call(this);this.defaultHeight=8});delete eq.c.PopText.subClass;eq.c.PopText.prototype.setup=function(c,b,d){var a=this.defaultHeight;this.defaultPxHeight=c.pxHeight(a);this.defaultCssHeight=c.cssHeight(a);d.cla=["eq-poptext","eq-control","eq-border","eq-dn"];d.ev={c:["input","mousedown"]};d.et={tg:"SPAN",cla:["eq-fn"]};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.PopText.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.content:var f=b.decodeUint();a=a.rtd=a.rtd||[];c=[];c.length=f;for(e=0;e<f;e++)c[e]=b.decodeString();a.push({t:d,v:c});break;case e.activeLine:a=a.rtd=a.rtd||[];a.push({t:d,v:b.decodeUint()});break;case e.boxSize:e=b.decodeUint();b=b.decodeUint();a=a.rtd=a.rtd||[];this.sizeRaster?(e&&(f=c.pxWidth(e)+"px"),b=b&&b>this.defaultHeight?c.cssHeight(b):this.defaultCssHeight):(e&&(f=e+"px"),b=b&&b>this.defaultPxHeight?b+"px":
this.defaultCssHeight);a.push({t:d,w:f,h:b});break;case e.bgColor:d=a.cr=a.cr||[];b=b.decodeString();a={ty:eq.RuleType.bgColor};b.length&&(a.rl="{background-color:"+b+"}");d.push(a);break;case e.focusColor:d=a.cr=a.cr||[];b=b.decodeString();a={ty:eq.RuleType.focusColor};b.length&&(a.rl=".eq-focused{background-color:"+b+"}");d.push(a);break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a)}};
eq.c.PopText.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-poptext>span.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};eq.c.PopText.prototype.setRuleAttr=function(c,b,d,a){(d.ev=d.ev||{}).a=a?["input"]:null};eq.c.DlgControl.addClass("ProgressBar",function(){eq.c.DlgControl.call(this)});delete eq.c.ProgressBar.subClass;eq.c.ProgressBar.prototype.focusable=!1;
eq.c.ProgressBar.prototype.setup=function(c,b,d){d.cla=["eq-progressbar","eq-control","eq-border"];eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.ProgressBar.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.vertical:c=a.rt=a.rt||[];c.push({t:d,v:b.decodeUint()});break;case e.value:case e.text:c=a.rt=a.rt||[];c.push({t:d,v:b.decodeString()});break;case e.fgColor:d=a.cr=a.cr||[];b=b.decodeString();c={ty:eq.RuleType.fgColor};b.length&&(c.rl=">div{background-color:"+b+"}");d.push(c);break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a)}};
eq.c.ProgressBar.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];var f;e&&(f=[".eq-progressbar>span.eq-fn,",".eq-progressbar>div>span.eq-fn"+e]);c.push({ty:eq.RuleType.font,rl:f});return!0};eq.c.DlgControl.addClass("PushButton",function(){eq.c.DlgControl.call(this)});delete eq.c.PushButton.subClass;eq.c.PushButton.prototype.textPos=0;eq.c.PushButton.prototype.icon=null;
eq.c.PushButton.prototype.setup=function(c,b,d){d.cla=["eq-pushbutton","eq-control","eq-border"];d.et={tg:"BUTTON",at:{type:"button"},cla:["eq-fn"],ev:{a:["mousedown"]}};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.PushButton.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.bgColor:case e.focusColor:break;case e.textPos:case e.text:case e.icon:case e.iconActive:case e.fgColor:eq.c.DlgControl.isSetup(b,a,2);break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a);return}switch(d){case e.textPos:c=a.clr=a.clr||[];if(this.textPos=b.decodeUint()){b=eq.TextPos;d=a.et.ch=[{tg:"DIV"}];e=a.cla=a.cla||[];d=d[0].ch=[{},{},{}];switch(this.textPos){case b.right:d[0].tg="IMG";d[1].tg="IMG";
d[2].tg="SPAN";c.push("eq-vert");e.push("eq-horz");break;case b.left:d[0].tg="SPAN";d[1].tg="IMG";d[2].tg="IMG";c.push("eq-vert");e.push("eq-horz");break;case b.bottom:d[0].tg="IMG";d[1].tg="IMG";d[2].tg="SPAN";c.push("eq-horz");e.push("eq-vert");break;case b.top:d[0].tg="SPAN";d[1].tg="IMG";d[2].tg="IMG";c.push("eq-horz");e.push("eq-vert");break;default:throw Error("PushButton.setAttr("+this.id+") invalid textPos "+this.textPos);}d=d[1];e=d.cla=d.cla||[];e.push("eq-active");a.et.hc="";this.defaultHeight=
!1}else c.push("eq-horz"),c.push("eq-vert"),this.parent instanceof eq.c.ToolBar?this.defaultHeight=!1:delete this.defaultHeight;break;case e.text:c=b.decodeString();if(this.textPos)switch(b=eq.TextPos,d=a.et.ch=a.et.ch||[{tg:"DIV"}],a=d[0],d=a.ch=a.ch||[{},{},{}],this.textPos){case b.right:case b.bottom:a=d[2];break;default:a=d[0]}else a=a.et;a.hca=c;break;case e.icon:c=eq.api.makeUrl(b.decodeString());if(this.textPos){b=eq.TextPos;d=a.et.ch=a.et.ch||[{tg:"DIV"}];a=d[0];d=a.ch=a.ch||[{},{},{}];switch(this.textPos){case b.right:case b.bottom:a=
d[0];break;default:a=d[2]}a.at=a.at||{};a.at.src=this.icon=c.length?c:null}else this.icon=null;break;case e.iconActive:c=eq.api.makeUrl(b.decodeString());this.textPos&&(d=a.et.ch=a.et.ch||[{tg:"DIV"}],a=d[0],d=a.ch=a.ch||[{},{}],a=d[1],a.at=a.at||{},a.at.src=c.length?c:this.icon);break;case e.bgColor:a=a.cr=a.cr||[];c=b.decodeString();b={ty:eq.RuleType.bgColor};c.length&&(b.rl=">button{background-color:"+c+"}");a.push(b);break;case e.focusColor:a=a.cr=a.cr||[];c=b.decodeString();b={ty:eq.RuleType.focusColor};
c.length&&(b.rl=".eq-focused>button{background-color:"+c+"}");a.push(b);break;case e.fgColor:c=b.decodeString(),(a.et.st=a.et.st||{}).color=c.length?c:null}};eq.c.PushButton.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-pushbutton>button.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};eq.c.DlgControl.addClass("RadioButton",function(){eq.c.DlgControl.call(this)});delete eq.c.RadioButton.subClass;
eq.c.RadioButton.prototype.setup=function(c,b,d){d.cla=["eq-radiobutton","eq-control"];d.et={ch:[{id:"*"},{id:"*"}]};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.RadioButton.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.fgColor:case e.focusColor:break;case e.textPos:case e.radioGroup:case e.active:case e.text:eq.c.DlgControl.isSetup(b,a,2)&&(a.et.ch=a.et.ch||[{},{}]);break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a);return}switch(d){case e.textPos:this.iBtn=b.decodeUint();c=a.et.ch[this.iBtn];c.tg="INPUT";c.at={type:"radio"};c.ev={c:["click"]};c=a.et.ch[this.iBtn?0:1];c.tg="LABEL";c.at={"for":a.id+"-"+(this.iBtn+
1)};c.cla=["eq-fn"];break;case e.radioGroup:c=a.et.ch[this.iBtn];c.at=c.at||{};c.at.name=b.decodeString();break;case e.active:c=a.et.ch[this.iBtn];c.at=c.at||{};c.at.checked=0!==b.decodeUint();break;case e.text:c=a.et.ch[this.iBtn?0:1];c.hca=b.decodeString();break;case e.fgColor:a=a.cr=a.cr||[];b=b.decodeString();c={ty:eq.RuleType.fgColor};b.length&&(c.rl=">*>label{color:"+b+"}");a.push(c);break;case e.focusColor:a=a.cr=a.cr||[],b=b.decodeString(),c={ty:eq.RuleType.focusColor},b.length&&(c.rl=".eq-focused>*>label{color:"+
b+"}"),a.push(c)}};eq.c.RadioButton.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-radiobutton>*>label.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};eq.c.RadioButton.prototype.setRuleAttr=function(c,b,d,a){eq.c.DlgControl.isSetup(b,d,2)&&(d.et.ch=d.et.ch||[{},{}]);c=d.et.ch[this.iBtn];(c.ev=c.ev||{}).a=a?["mousedown"]:null};eq.c.DlgControl.addClass("Separator",function(){eq.c.DlgControl.call(this)});delete eq.c.Separator.subClass;
eq.c.Separator.prototype.defaultWidth=!0;eq.c.Separator.prototype.focusable=!1;eq.c.Separator.prototype.border=!1;eq.c.Separator.prototype.setup=function(c,b,d){d.cla=["eq-separator","eq-control"];eq.c.DlgControl.prototype.setup.call(this,c,b,d)};eq.c.Separator.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.fgColor:b.decodeString();break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a)}};eq.c.DlgContainer.addClass("Splitter",function(){eq.c.DlgContainer.call(this)});
delete eq.c.Splitter.subClass;eq.c.Splitter.prototype.vertical=!1;eq.c.Splitter.prototype.setup=function(c,b,d){d.cla=["eq-splitter","eq-control","eq-container","eq-border"];d.ev={c:["mousedown","change"]};eq.c.DlgContainer.prototype.setup.call(this,c,b,d)};
eq.c.Splitter.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.panes:a=a.rtd=a.rtd||[];a.push({t:d});break;case e.vertical:b.decodeUint()?(this.vertical=!0,c=a.clr=a.clr||[],d=a.cla=a.cla||[]):(this.vertical=!1,c=a.cla=a.cla||[],d=a.clr=a.clr||[]);c.push("eq-horz");d.push("eq-vert");break;case e.position:b=b.decodeInt();a=a.rtd=a.rtd||[];0<b&&this.sizeRaster&&(b=this.vertical?c.pxHeight(b):c.pxWidth(b));a.push({t:d,v:b});break;case e.quickExpand:(b.decodeUint()?a.cla=a.cla||[]:
a.clr=a.clr||[]).push("eq-quick");break;case e.bgColor:case e.fgColor:b.decodeString();break;default:eq.c.DlgContainer.prototype.setAttr.call(this,c,b,d,a)}};eq.c.Splitter.prototype.setRuleAttr=function(c,b,d,a){(a?d.cla=d.cla||[]:d.clr=d.clr||[]).push("eq-rule")};eq.c.DlgControl.addClass("StaticText",function(){eq.c.DlgControl.call(this)});delete eq.c.StaticText.subClass;eq.c.StaticText.prototype.focusable=!1;eq.c.StaticText.prototype.border=!1;
eq.c.StaticText.prototype.setup=function(c,b,d){d.cla=["eq-statictext","eq-control"];d.et={tg:"SPAN",cla:["eq-fn"]};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.StaticText.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.text:case e.align:eq.c.DlgControl.isSetup(b,a,2);break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,b,d,a);return}switch(d){case e.text:a.et.hca=b.decodeString();break;case e.align:switch(c=a.et.st=a.et.st||{},b.decodeUint()){case 0:c["text-align"]=null;break;case 1:c["text-align"]="center";break;case 2:c["text-align"]="right"}}};
eq.c.StaticText.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-statictext>span.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};eq.c.DlgContainer.addClass("StatusBar",function(){eq.c.DlgContainer.call(this)});delete eq.c.StatusBar.subClass;eq.c.StatusBar.prototype.border=!1;eq.c.StatusBar.prototype.setup=function(c,b,d){d.cla=["eq-statusbar","eq-control","eq-container"];eq.c.DlgContainer.prototype.setup.call(this,c,b,d)};
eq.c.StatusBar.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.posSize:d=a.st=a.st||{};a=b.decodeUint();this.sizeRaster=!!(a&eq.DialogRaster.size);(a=b.decodeInt())?d.height=this.sizeRaster?c.cssHeight(a):a+"px":d.height=c.cssHeight(1);break;case e.fgColor:b.decodeString();break;case e.dropRule:case e.globalDropRule:(a.rt=a.rt||[]).push({t:d,i:b.decodeInt()});break;default:eq.c.DlgContainer.prototype.setAttr.call(this,c,b,d,a)}};eq.c.DlgContainer.addClass("TabBox",function(){eq.c.DlgContainer.call(this)});
delete eq.c.TabBox.subClass;eq.c.TabBox.prototype.focusable=!0;eq.c.TabBox.prototype.setup=function(c,b,d){d.cla=["eq-tabbox","eq-control","eq-border"];d.ev={c:["mousedown"]};d.et={cla:["eq-container"]};eq.c.DlgContainer.prototype.setup.call(this,c,b,d)};
eq.c.TabBox.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.tabs:c=eq.api;a=a.rt=a.rt||[];e=eq.TabState;var f=[],g=b.decodeUint(),h,k,l;f.length=g;for(h=0;h<g;h++)(k=b.decodeUint())&e.visible?f[h]={s:k,t:(l=b.decodeString()).length?l:null,i:c.makeUrl(b.decodeString()),f:c.fixupFont({fc:b.decodeString(),sz:c.fixupFontSize(b.decodeUint()),st:b.decodeUint()}),tt:(l=b.decodeString()).length?l:null}:f[h]={s:k};a.push({t:d,v:f});break;case e.selectedTab:a=a.rtd=a.rtd||[];a.push({t:d,
v:b.decodeUint()});break;case e.bgColor:d=a.cr=a.cr||[];l=b.decodeString();b={ty:eq.RuleType.bgColor};l.length&&(b.rl=">.eq-tabs>*{background-color:"+l+"}");d.push(b);break;case e.focusColor:d=a.cr=a.cr||[];l=b.decodeString();b={ty:eq.RuleType.focusColor};l.length&&(b.rl=".eq-focused>.eq-tabs>.eq-selected{background-color:"+l+"}");d.push(b);break;case e.fgColor:d=a.cr=a.cr||[];l=b.decodeString();b={ty:eq.RuleType.fgColor};l.length&&(b.rl=">.eq-tabs>*{color:"+l+"}");d.push(b);break;default:eq.c.DlgContainer.prototype.setAttr.call(this,
c,b,d,a)}};eq.c.TabBox.prototype.setRuleAttr=function(c,b,d,a){(a?d.cla=d.cla||[]:d.clr=d.clr||[]).push("eq-rule")};eq.c.TabBox.prototype.onUpdate=function(c,b,d){if(b!==eq.UpdateTag.tabOrder)return eq.c.DlgContainer.prototype.onUpdate.call(this,c,b,d);for(var a=0,e=this.ch.length;a<e;a++){var f=this.ch[a];f.visible&&f.sensitive&&0===d--?delete f.inactive:f.inactive=!0}c.updateTabOrder();return this.notifyUpdated(c,b,c.tabOrder)};eq.c.DlgContainer.addClass("ToolBar",function(){eq.c.DlgContainer.call(this)});
delete eq.c.ToolBar.subClass;eq.c.ToolBar.prototype.border=!1;eq.c.ToolBar.prototype.setup=function(c,b,d){d.cla=["eq-toolbar","eq-control","eq-container"];eq.c.DlgContainer.prototype.setup.call(this,c,b,d)};
eq.c.ToolBar.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.posSize:c=a.cla=a.cla||[];a=a.clr=a.clr||[];switch(b.decodeUint()){case 1:c.push("eq-bottom");a.push("eq-top");a.push("eq-left");a.push("eq-right");break;case 2:c.push("eq-left");a.push("eq-top");a.push("eq-bottom");a.push("eq-right");break;case 3:c.push("eq-right");a.push("eq-top");a.push("eq-bottom");a.push("eq-left");break;default:c.push("eq-top"),a.push("eq-bottom"),a.push("eq-left"),a.push("eq-right")}break;case e.fgColor:b.decodeString();
break;case e.dropRule:case e.globalDropRule:(a.rt=a.rt||[]).push({t:d,i:b.decodeInt()});break;default:eq.c.DlgContainer.prototype.setAttr.call(this,c,b,d,a)}};eq.c.ToolBar.prototype.addChild=function(c){c.defaultHeight=!1;eq.c.DlgContainer.prototype.addChild.call(this,c)};eq.c.ToolBar.prototype.containerFocusable=function(){return!1};eq.c.ToolBar.prototype.updateTabOrder=function(c){};eq.c.DlgControl.addClass("Tree",function(){eq.c.DlgControl.call(this)});delete eq.c.Tree.subClass;
eq.c.Tree.prototype.setup=function(c,b,d){d.cla=["eq-tree","eq-control","eq-border"];d.ev={c:["mousedown","change","status","emptynode","dnd"]};d.et={cla:["eq-pane","eq-fn"]};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.Tree.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.content:a=a.rtd=a.rtd||[];e=[];this.setContent(b,e);a.push({t:d,v:e});break;case e.activeLine:a=a.rtd=a.rtd||[];a.push({t:d,v:b.decodeUint()});break;case e.emptyNode:d=a.ds=a.ds||{};b=b.decodeInt();0<=b?(d.rule=b?b:null,b=a.clr=a.clr||[]):(d.rule=-b,b=a.cla=a.cla||[]);b.push("eq-auto");break;case e.status:c=b.decodeUint();a=a.rtd=a.rtd||[];e=[];e.length=c;for(var f=0;f<c;f++)e[f]=b.decodeUint();a.push({t:d,v:e});break;case e.ruleMode:this.ruleMode=
b.decodeUint();break;case e.bgColor:d=a.cr=a.cr||[];b=b.decodeString();a={ty:eq.RuleType.bgColor};b.length&&(a.rl="{background-color:"+b+"}");d.push(a);break;case e.focusColor:d=a.cr=a.cr||[];b=b.decodeString();a={ty:eq.RuleType.focusColor};b.length&&(a.rl=".eq-focused{background-color:"+b+"}");d.push(a);break;case e.dndMode:a=a.rtd=a.rtd||[];a.push({t:d,i:b.decodeUint()});break;case e.dropRule:case e.globalDropRule:a=a.rt=a.rt||[];a.push({t:d,i:b.decodeInt()});break;default:eq.c.DlgControl.prototype.setAttr.call(this,
c,b,d,a)}};eq.c.Tree.prototype.setContent=function(c,b){var d=c.decodeUint();b.length=d;for(var a=0;a<d;a++){var e=c.decodeUint(),f=c.decodeString();if(0===e)b[a]=f;else{var g=[];this.setContent(c,g);b[a]={f:e,hc:f,ch:g}}}};eq.c.Tree.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];e&&(e=".eq-tree>.eq-pane.eq-fn"+e);c.push({ty:eq.RuleType.font,rl:e});return!0};
eq.c.Tree.prototype.setRuleAttr=function(c,b,d,a){c=d.ev=d.ev||{};if(a)switch(c.a=["mousedown","keydown"],this.ruleMode){case 1:c.m=1;c.f=null;break;case 2:c.m=2;c.f=1;break;case 3:c.m=1;c.f=1;break;default:c.m=2,c.f=null}else c.a=null,c.m=null,c.f=null};eq.c.DlgControl.addClass("WindowMenu",function(){eq.c.DlgControl.call(this)});delete eq.c.WindowMenu.subClass;eq.c.WindowMenu.prototype.focusable=!1;eq.c.WindowMenu.prototype.border=!1;
eq.c.WindowMenu.prototype.setup=function(c,b,d){d.tg="LI";d.cla=["eq-windowmenu","eq-menu","eq-control"];d.ev={c:["mousedown"]};d.et={tg:"UL"};eq.c.DlgControl.prototype.setup.call(this,c,b,d)};
eq.c.WindowMenu.prototype.setAttr=function(c,b,d,a){var e=eq.RqTag;switch(d){case e.textPos:c=a.rtd=a.rtd||[];c.push({t:d,v:b.decodeUint()});break;case e.text:c=a.rtd=a.rtd||[];c.push({t:d,v:b.decodeString()});break;case e.icon:c=a.rtd=a.rtd||[];c.push({t:d,v:eq.api.makeUrl(b.decodeString())});break;case e.bgColor:d=a.cr=a.cr||[];b=b.decodeString();c={ty:eq.RuleType.fgColor};b.length&&(c.rl=[","," ul{background-color:"+b+"}"]);d.push(c);break;default:eq.c.DlgControl.prototype.setAttr.call(this,c,
b,d,a)}};eq.c.WindowMenu.prototype.setFontAttr=function(c,b,d,a,e){c=d.cr=d.cr||[];var f;e&&(f=[".eq-windowmenu>label.eq-fn,",".eq-windowmenu li>label.eq-fn"+e]);c.push({ty:eq.RuleType.font,rl:f});return!0};eq.c.Obj.subClass("Api",function(){eq.c.Obj.call(this);this.reset();this.locale=this.dlg=this.sid=this.uat=this.appBaseUrl=null;this.reconnectTimeout=60});delete eq.c.Api.subClass;
eq.c.Api.prototype.reset=function(){this.dlgRq=new eq.c.DlgRq;this.dlgRs=new eq.c.DlgRs;this.currDlg=this.pendingCallCanceled=this.pendingCall=void 0;this.helpBaseUrl=this.baseUrl=null;this.clipboardMenu=void 0;this.fnDefault=null;this.fnSizeFactor=void 0};eq.c.Api.prototype.resetDlg=function(){this.dlg&&(this.dlg.forEach(this.constructor.cbCloseDlg),this.dlg.clear(),this.dlg=null)};eq.c.Api.cbCloseDlg=function(c){c.close()};
eq.c.Api.prototype.invalidateThenResume=function(){var c=this.dlg,b=[];c.forEach(this.constructor.cbInvalidateThenResume,{d:b});c.clear();postMessage([{o:eq.MainOp.invalidate,d:b},{o:eq.MainOp.resume}])};eq.c.Api.cbInvalidateThenResume=function(c){this.d.push(c.id);c.close()};eq.c.Api.prototype.instanceName=function(c){if(!this.sid)throw Error("instanceName: sid undefined");return this.sid+"."+c};
eq.c.Api.prototype.makeUrl=function(c){var b=this.constructor;c.length&&null!==this.baseUrl&&!b.reIsAbsoluteUrl.test(c)&&(c=this.baseUrl+c);return b.reIsJdlgLogo.test(c)?this.appBaseUrl+"eq-webdlg-logo-109x64.png":c};eq.c.Api.reIsAbsoluteUrl=/^(\/|[A-Z0-9_]+:)/i;eq.c.Api.reIsJdlgLogo=/^jar:.+\.gif/i;eq.c.Api.prototype.fixupFont=function(c){var b=c.fc;if(b){var d=this.constructor;d.reFnLeaveAlone.test(b)?c.fc=b.replace(d.reFnFixQuotes,'"'):d.reFnIsIdent.test(b)||(c.fc='"'+b+'"')}return c};
eq.c.Api.prototype.fixupFontSize=function(c){if(c){var b=this.fnSizeFactor;return b&&1!==b?Math.round(c*b*1E3)/1E3+"pt":c+"pt"}return""};eq.c.Api.reFnLeaveAlone=/['",]/;eq.c.Api.reFnFixQuotes=/[']/;eq.c.Api.reFnIsIdent=/^[A-Z][A-Z0-9-]*$/i;eq.c.Api.prototype.setDefaultFont=function(c,b,d){this.fnDefault=this.fixupFont({fc:c,sz:this.constructor.reFnIsNumber.test(b)?b+"pt":b,st:0});if(d&&(c=Number(d),c===c)){this.fnSizeFactor=c;return}this.fnSizeFactor=void 0};eq.c.Api.reFnIsNumber=/^[0-9.]+$/;
eq.c.Api.mainReceived=function(c){var b=eq.api,d=b.constructor,a=eq.ApiOp;switch(c.data.o){case a.documentComplete:if(c.data.v!==eq.p.version)throw Error("mainReceived documentComplete: main thread version "+c.data.v+", expected: "+eq.p.version);b.appBaseUrl=c.data.b;b.documentComplete=!0;b.startOrResumeApplication();break;case a.installPlugins:eq.installPlugins(c.data.p);break;case a.injectDone:if(!b.pendingInject)throw Error("mainReceived injectDone: invalid, plugin injection not pending");b.pendingInject=
void 0;b.startOrResumeApplication();break;case a.openWebSocket:if(c.data.v!==eq.p.version)throw Error("mainReceived openWebSocket: main thread version "+c.data.v+", expected: "+eq.p.version);b.app=c.data.app;b.webdURL=c.data.url;b.sid=c.data.sid?c.data.sid:null;b.args=c.data.args?c.data.args:void 0;b.webdOpen();break;case a.closeWebSocket:b.ws&&b.ws.close(1E3);break;case a.onLoginEvent:var e,f,g;if(void 0===b.ws)b.pendingLogin=void 0;else if(void 0===(e=b.pendingLogin))throw Error("mainReceived: unexpected login event");
(f=c.data.l)&&(g=c.data.p)?(e.login=f,e.pswd=g,e.save=c.data.s,b.startOrResumeApplication()):b.ws&&b.ws.close(1E3);break;case a.onEvent:if(void 0===b.pendingCall){if(b.pendingCallCanceled)break;throw Error("mainReceived onEvent: invalid, no pending call");}e=b.currDlg;if(void 0===e)throw Error("mainReceived onEvent: invalid, no current DLG");if(!e.root)throw Error("mainReceived onEvent: invalid, no DLG root object");g=b.dlgRs;try{g.encodeUint(eq.c.DlgRs.op.event);g.encodeUint(b.pendingCall);b.pendingCall=
void 0;var h=c.data.d;f=h.id;var k;f||(f=k=e.root.id);g.encodeString(f);void 0!==h.ev?((f=h.ev.id)||(f=void 0!==k?k:k=e.root.id),g.encodeString(f)):g.encodeUint(0);d.packElements(e,g,h.changed,k);g.encodeUint(0);b.ws.send(g.buffer());b.currDlg=void 0}catch(n){if(b.currDlg=void 0,g.dispose(),void 0!==b.ws)throw n;}break;case a.onPopupEvent:if(void 0===b.pendingCall){if(b.pendingCallCanceled)break;throw Error("mainReceived onPopupEvent: invalid, no pending call");}g=b.dlgRs;try{g.encodeUint(eq.c.DlgRs.op.popup),
g.encodeUint(b.pendingCall),b.pendingCall=void 0,g.encodeInt(c.data.d),g.encodeUint(0),b.ws.send(g.buffer())}catch(n){if(g.dispose(),void 0!==b.ws)throw n;}break;case a.onSynced:if(void 0===b.pendingCall){if(b.pendingCallCanceled)break;throw Error("mainReceived onSynced: invalid, no pending call");}postMessage([{o:eq.MainOp.synced}]);b.currDlg=void 0;g=b.dlgRs;try{g.encodeUint(eq.c.DlgRs.op.synced),g.encodeUint(b.pendingCall),b.pendingCall=void 0,g.encodeUint(0),b.ws.send(g.buffer())}catch(n){if(g.dispose(),
void 0!==b.ws)throw n;}break;case a.onDo:f=c.data.i;e=b.dlg.get(f);if(void 0===e)throw Error("mainReceived onDo: DLG "+f+" does not exist");g=b.dlgRs;try{g.encodeUint(eq.c.DlgRs.op.update),g.encodeUint(f),g.encodeString(c.data.f),g.encodeUint(eq.UpdateTag.dialogDo),g.encodeUint(0),b.ws.send(g.buffer())}catch(n){if(g.dispose(),void 0!==b.ws)throw n;}break;case a.onHelp:if(void 0===b.pendingCall){if(b.pendingCallCanceled)break;throw Error("mainReceived onHelp: invalid, no pending call");}e=b.currDlg;
if(void 0===e)throw Error("mainReceived onHelp: invalid, no current DLG");if(!e.root)throw Error("mainReceived onHelp: invalid, no DLG root object");d=c.data.d?e.findById(c.data.d,!0):e.root;f=d.onHelp();f.length&&postMessage([{o:eq.MainOp.openUrl,d:{u:f,t:b.instanceName("help"),k:"help"}}]);break;case a.onMouseButton2:f=c.data.d;e=b.dlg.get(f);if(void 0===e)throw Error("mainReceived onMouseButton2: DLG "+f+" does not exist");e.findById(c.data.i,!0).onMouseButton2(e,c.data.b,c.data.m,c.data.x,c.data.y,
c.data.c);break;case a.invalidate:f=c.data.d;e=b.dlg.get(f);void 0!==e&&(e.close(),b.dlg.delete(f));g=b.dlgRs;try{g.encodeUint(eq.c.DlgRs.op.invalidate),g.encodeUint(f),g.encodeUint(0),b.ws.send(g.buffer())}catch(n){if(g.dispose(),void 0!==b.ws)throw n;}break;case a.update:f=c.data.d;e=b.dlg.get(f);if(void 0===e)throw Error("mainReceived update: DLG "+f+" does not exist");e.findById(c.data.i||e.root.id,!0).onUpdate(e,c.data.t,c.data.a);break;case a.updated:c=c.data;f=c.i;d=c.c;g=b.dlgRs;if(d.length){if(void 0===
(e=b.dlg.get(f)))throw Error("mainReceived updated: DLG "+f+" does not exist");d=e.findById(d,!0)}else e=d=void 0;try{g.putBuffer(c.b);if(void 0!==d)d.updated(e,c.t,null,g,c.d);else{var l=c.d,m;c=0;for(var p=l.length;c<p;c++)null===(m=l[c])||void 0===m?g.encodeUint(0):"number"===typeof m?g.encodeInt(m):g.encodeString(m)}g.encodeUint(0);b.ws.send(g.buffer());void 0!==e&&e.temp&&(e.close(),b.dlg.delete(f))}catch(n){if(g.dispose(),void 0!==b.ws)throw n;}break;case a.canceled:f=c.data.i;e=b.dlg.get(f);
if(void 0===e)throw Error("mainReceived canceled: DLG "+f+" does not exist");g=b.dlgRs;try{g.encodeUint(eq.c.DlgRs.op.canceled),g.encodeUint(f),g.encodeUint(0),b.ws.send(g.buffer())}catch(n){if(g.dispose(),void 0!==b.ws)throw n;}break;case a.grid:f=c.data.d;e=b.dlg.get(f);if(void 0===e)throw Error("mainReceived grid: DLG "+f+" does not exist");e.grid=c.data.g;d.webdReceived();break;case a.logError:if(b.logErrorEnabled){g=b.dlgRs;try{g.encodeUint(eq.c.DlgRs.op.logError),g.encodeString(c.data.msg),
g.encodeUint(0),b.ws.send(g.buffer())}catch(n){g.dispose()}}break;default:throw Error("mainReceived invalid op: "+c.data.o);}};eq.c.Api.packElements=function(c,b,d,a){for(var e=this.packValue,f,g,h=0,k=d.length;h<k;h++){var l=d[h];(f=l.id)||(f=void 0!==a?a:a=c.root.id);f!==g&&(void 0!==g&&b.encodeUint(0),b.encodeString(f),g=f);if(void 0===l.v)e(c,b,f,l);else for(var m=0,p=l.v.length;m<p;m++)e(c,b,f,l.v[m])}void 0!==g&&b.encodeUint(0);b.encodeUint(0)};
eq.c.Api.packValue=function(c,b,d,a){var e=eq.RsValType,f=a.ty;b.encodeUint(f);switch(f){case e.idFocus:case e.textValue:case e.dragFrom:case e.dragContent:case e.dropContent:case e.dropElement:a=a.sv;if(void 0===a)throw Error("packValue: "+f+" sv expected");b.encodeString(a);break;case e.ruleOnce:case e.dropLine:a=a.iv;if(void 0===a)throw Error("packValue: "+f+" iv expected");b.encodeInt(a);break;case e.buttonChecked:case e.caretPos:case e.activeLine:case e.topItem:case e.selectedTab:case e.emptyNode:case e.ruleKey:case e.mouseBtns:case e.mouseCnt:case e.mouseMods:case e.dialogMax:case e.dropAction:case e.dropPos:a=
a.iv;if(void 0===a)throw Error("packValue: "+f+" iv expected");b.encodeUint(a);break;case e.splitterPos:f=c.findById(d,!0);a=a.iv;if(void 0===a)throw Error("packValue: splitterPos iv expected");f.sizeRaster&&(a=f.vertical?c.gridHeight(a):c.gridWidth(a));b.encodeUint(a);break;case e.scrollPos:f=c.findById(d,!0);d=a.x;a=a.y;if(void 0===d||void 0===a)throw Error("packValue: scrollPos x/y expected");f.sizeRaster&&(d=c.gridWidth(d),a=c.gridHeight(a));b.encodeUint(d);b.encodeUint(a);break;case e.status:c=
a.vv;if(void 0===c)throw Error("packValue: status vv expected");b.encodeUint(a=c.length);for(f=0;f<a;f++)b.encodeUint(c[f]);break;case e.colOrder:case e.colWidth:case e.lineOrder:case e.activeLineCol:case e.dropColumn:c.findById(d,!0).packValue(b,f,a);break;case e.screenSize:d=a.w;a=a.h;if(void 0===d||void 0===a)throw Error("packValue: screenSize w/h expected");b.encodeInt(d);b.encodeInt(a);break;case e.dialogPos:f=c.root;d=a.x;a=a.y;if(void 0===d||void 0===a)throw Error("packValue: dialogPos x/y expected");
f.posRaster&&(d=c.gridWidth(d),a=c.gridHeight(a));b.encodeInt(d);b.encodeInt(a);break;case e.dialogSize:f=c.root;d=a.w;a=a.h;if(void 0===d||void 0===a)throw Error("packValue: dialogSize w/h expected");f.sizeRaster&&(d=c.gridWidth(d),a=c.gridHeight(a));b.encodeInt(d);b.encodeInt(a);break;case e.plgInt:c=a.a;f=a.i;a=a.iv;if(void 0===c)throw Error("packValue: plgInt atr expected");if(void 0===a)throw Error("packValue: plgInt iv expected");b.encodeString(c);b.encodeString(f?f:"");b.encodeInt(a);break;
case e.plgString:c=a.a;f=a.i;a=a.sv;if(void 0===c)throw Error("packValue: plgString atr expected");if(void 0===a)throw Error("packValue: plgString sv expected");b.encodeString(c);b.encodeString(void 0!==f&&null!==f?f:"");b.encodeString(a);break;case e.plgBinary:c=a.a;f=a.i;a=a.bv;if(void 0===c)throw Error("packValue: plgBinary atr expected");if(void 0===a)throw Error("packValue: plgString bv expected");b.encodeString(c);b.encodeString(void 0!==f&&null!==f?f:"");b.encodeData(a);break;default:throw Error("packValue: unknown type "+
f);}};
eq.c.Api.prototype.startOrResumeApplication=function(c){if(this.webdOpened&&this.documentComplete&&!this.pendingInject){var b=this.pendingLogin;if(b&&void 0===b.pswd)b.open&&(b.open=!1,b={o:eq.MainOp.login,login:b.login,save:b.save},c?c.push(b):postMessage([b]));else if(this.pendingLogin=void 0,this.startSession){this.startSession=void 0;this.resetDlg();this.dlg=new Map;c=this.dlgRs;try{c.encodeUint(eq.c.DlgRs.op.start);b&&b.login&&b.pswd?(c.encodeString(b.login),c.encodeString(b.pswd),c.encodeUint(b.save?1:
0)):(c.encodeUint(0),c.encodeUint(0),c.encodeUint(0));var d=eq.PluginFlags,a=this.plg;b=a?a.length:0;var e,f,g,h,k,l,m;c.encodeUint(b);for(e=0;e<b;e++){c.encodeString("plugin."+(f=a[e]).n);var p=d.focusable|d.tabOnEnter;if(g=f.p)!1===g.focusable&&(p&=~d.focusable),!1===g.tabOnEnter&&(p&=~d.tabOnEnter);c.encodeUint(p);c.encodeUint(k=(h=f.a).length);for(l=0;l<k;l++)c.encodeString((m=h[l])[0]),c.encodeUint(m[1])}var n=eq.d.length-b;for(e=0;e<n;e++)c.encodeString(eq.d[e].name);for(e=0;e<b;e++)c.encodeString("plugin."+
a[e].n);c.encodeUint(0);var q=this.args;if(q)for(var x in q)c.encodeString(x),c.encodeString(q[x]);c.encodeUint(0);c.encodeUint(0);this.ws.send(c.buffer())}catch(t){if(c.dispose(),void 0!==this.ws)throw t;}}else{if(!this.resumeSession)throw Error("BUG: startApplication command expected");null===this.dlg&&(this.dlg=new Map);c=this.dlgRs;try{c.encodeUint(eq.c.DlgRs.op.resume),c.encodeUint(0),this.ws.send(c.buffer())}catch(t){if(c.dispose(),void 0!==this.ws)throw t;}}}};
eq.c.Api.prototype.webdOpen=function(){var c=this.constructor;if(void 0!==this.webdHandshakeTimer)throw Error("BUG: webdOpen pending handshake");var b="eloquence.webdlg."+eq.p.version;this.sid&&(b+="."+this.sid);this.ws=new WebSocket(this.webdURL+this.app,b);this.ws.binaryType="arraybuffer";this.ws.onopen=c.webdOpened;this.ws.onmessage=c.webdReceived;this.ws.onclose=c.webdClosed;this.ws.onerror=c.webdFailed};
eq.c.Api.webdReceived=function(c){var b=eq.api,d=b.constructor,a=b.dlgRq,e=eq.c.DlgRq.mode;if(void 0!==c){if(void 0!==a.msg){for(;a.next;)a=a.next;a=a.next=new eq.c.DlgRq;a.assign(c.data);a.acquire();return}a.assign(c.data)}else if(void 0===a.msg)throw Error("webdReceived BUG: dlgRq not assigned");for(;a;)try{for(;a.mode=a.decodeUint();){switch(a.mode){case e.cancel:var f=a.decodeUint(),g;if(f){if(void 0===(g=b.dlg.get(f)))throw Error("webdReceived: DLG "+f+" does not exist, mode: "+a.mode);if(g!==
b.currDlg)continue}b.pendingCall=void 0;b.pendingCallCanceled=!0;b.currDlg=void 0;a.msg.push({o:eq.MainOp.cancelCurrentCall,i:f});continue;case e.message:a.msg.push({o:eq.MainOp.message,s:a.decodeString()});continue;case e.update:var h=a.decodeUint();f=a.decodeUint();var k=a.decodeUint(),l=a.decodeString(),m=a.decodeUint(),p;if(!l.length)g=p=void 0;else if(void 0===(g=b.dlg.get(f))||null===(p=g.findById(l,!1))){a.dispose();return}var n=b.dlgRs;try{var q,x,t,z;n.encodeUint(eq.c.DlgRs.op.updated);n.encodeUint(h);
n.encodeUint(k);n.encodeString(l);n.encodeUint(m);n.encodeString(a.decodeString());n.encodeUint(q=a.decodeUint());n.encodeUint(x=a.decodeUint());n.encodeString(t=a.decodeString());if(q===eq.DlgCall.set){var u=eq.DlgValType;n.encodeUint(a.decodeUint());n.encodeUint(z=a.decodeUint());switch(z){case u.tInt:n.encodeInt(a.decodeInt());break;case u.tString:n.encodeString(a.decodeString());break;default:throw Error("webdReceived update: invalid value type: "+z);}}void 0!==p&&p.onUpdate(g,m,{rs:n})?(n.encodeUint(0),
b.ws.send(n.buffer()),g.temp&&(g.close(),b.dlg.delete(f))):a.msg.push({o:eq.MainOp.update,i:f,c:l,t:m,a:x,x:t,b:n.takeBuffer()})}catch(K){if(n.dispose(),void 0!==g&&g.temp&&(g.close(),b.dlg.delete(f)),void 0!==b.ws)throw K;}continue;case e.updated:g=b.dlg.get(a.decodeUint());l=a.decodeString();m=a.decodeUint();if(void 0===g||null===(p=g.findById(l,!1))){a.dispose();return}p.updated(g,m,a,null,null);continue}if(void 0!==b.currDlg)throw Error("webdReceived: invalid request "+a.mode+" during DLG call");
if(void 0!==b.pendingCall)throw Error("webdReceived: invalid request "+a.mode+" while call pending");if(b.resumeSession)switch(a.mode){case e.global:case e.rootFont:case e.add:case e.POPUP_BOX:break;default:throw Error("webdReceived: invalid request "+a.mode+" while resuming session");}switch(a.mode){case e.ssnNew:case e.ssnResume:d.webdStopHandshakeTimer();b.uat=a.decodeString();b.sid=a.decodeString();var r=a.decodeString(),y=a.decodeString(),A=a.decodeString(),F=a.decodeString(),B=a.decodeString(),
H=a.decodeString(),U=a.decodeString();a.msg.push({o:eq.MainOp.popupPos,d:a.decodeUint()});a.msg.push({o:eq.MainOp.warnLeavingPage,d:a.decodeUint()});b.reconnectTimeout=a.decodeUint();b.logErrorEnabled=a.decodeUint();if(a.decodeUint()){if(void 0!==b.pendingLogin)throw Error("webdReceived: invalid request "+a.mode+": pending login unexpected");}else b.pendingLogin={};var L=a.decodeUint(),N=a.decodeUint();c=[];var M=[],O;c.length=L;for(var D=0;D<L;D++)c[D]=a.decodeString();(O=L)&&a.msg.push({o:eq.MainOp.inject,
inj:c});M.length=N;for(D=0;D<N;D++)M[D]={k:a.decodeString(),v:a.decodeString()};a.msg.push({o:eq.MainOp.windowFeatures,d:M});var P;for(c=[];(P=a.decodeString()).length;)c.push(P);0===A.length&&(A=(new Intl.NumberFormat).resolvedOptions().locale);b.locale={tag:A};b.setDefaultFont(B,H,F);if(0===b.uat.length)throw Error("webdReceived: invalid request "+a.mode+": user agent tag undefined");if(0===b.sid.length)throw Error("webdReceived: invalid request "+a.mode+": session id undefined");if(void 0===b.app)throw Error("webdReceived: invalid request "+
a.mode+": app undefined, expected: '"+r+"'");if(b.app!==r){if(b.app.toUpperCase()!==r.toUpperCase())throw Error("webdReceived: invalid request "+a.mode+": expected app: '"+b.app+"', received: '"+r+"'");b.app=r}if(void 0!==b.startSession)throw Error("webdReceived: invalid request "+a.mode+": startSession unexpected, app: '"+r+"'");if(void 0!==b.resumeSession)throw Error("webdReceived: invalid request "+a.mode+": resumeSession unexpected, app: '"+r+"'");b.pendingInject=0!==O;a.mode===e.ssnNew?b.startSession=
!0:b.resumeSession=!0;a.msg.push({o:eq.MainOp.ssnNewOrResume,d:{uat:b.uat,sid:b.sid,title:y,locale:b.locale,fn:b.fnDefault,sf:b.fnSizeFactor,icon:U,css:c}});b.startOrResumeApplication(a.msg);continue;case e.login:var G=b.pendingLogin;if(void 0===G)throw Error("webdReceived: invalid login");G.login=a.decodeString();switch(a.decodeInt()){case 0:G.save=!1;break;case 1:G.save=!0}G.open=!0;b.startOrResumeApplication();continue}if(null===b.dlg)throw Error("webdReceived: invalid request "+a.mode+": DLG session closed");
switch(a.mode){case e.global:for(var w=eq.RqTag;m=a.decodeUint();)switch(m){case w.popupPos:a.msg.push({o:eq.MainOp.popupPos,d:a.decodeUint()});break;case w.baseUrl:var v=a.decodeString();b.baseUrl=v.length?v:null;break;case w.helpBaseUrl:v=a.decodeString();b.helpBaseUrl=v.length?v:null;break;case w.clipboardMenu:var Q=a.decodeString();b.clipboardMenu=Q.length?Q:void 0;break;case w.windowFeature:a.msg.push({o:eq.MainOp.windowFeature,k:a.decodeString(),v:a.decodeString()});break;case w.layout:a.msg.push({o:eq.MainOp.layout,
d:a.decodeUint()});break;case w.notifyBusy:a.msg.push({o:eq.MainOp.notifyBusy,d:a.decodeUint()});break;case w.typeAhead:a.msg.push({o:eq.MainOp.typeAhead,d:a.decodeUint()});break;case w.openUrl:v=b.makeUrl(a.decodeString());var C=a.decodeString();if(C)var R=C;else C="doc",R=b.instanceName(C);v.length&&a.msg.push({o:eq.MainOp.openUrl,d:{u:v,t:R,k:C}});break;case w.openHelpUrl:v=a.decodeString();null===b.helpBaseUrl||d.reIsAbsoluteUrl.test(v)||(v=b.helpBaseUrl+v);v.length&&(C="help",a.msg.push({o:eq.MainOp.openUrl,
d:{u:v,t:b.instanceName(C),k:C}}));break;case w.beep:a.msg.push({o:eq.MainOp.beep});break;case w.soundUrl:v=b.makeUrl(a.decodeString());v.length&&a.msg.push({o:eq.MainOp.playSound,d:{url:v}});break;case w.startApp:r=a.decodeString();var V=a.decodeString();r.length&&a.msg.push({o:eq.MainOp.startApp,d:{app:r,wf:V}});break;case w.activate:y=a.decodeString();y.length&&a.msg.push({o:eq.MainOp.activate,d:y});break;case w.clipboard:a.msg.push({o:eq.MainOp.clipboard,d:a.decodeString()});break;default:throw Error("webdReceived global: invalid tag "+
m);}break;case e.rootFont:b.resumeSession&&(b.resumeSession=void 0,b.invalidateThenResume());f=a.decodeUint();g=b.dlg.get(f);B=a.decodeString();H=a.decodeUint();var W=a.decodeUint(),I=b.fnDefault;if(void 0===g)b.dlg.set(f,new eq.c.Dlg(f));else if(g.temp)throw Error("webdReceived: DLG "+f+" is temporary, mode: "+a.mode);var X=b.fixupFont({fc:B?B:I?I.fc:"",sz:H?H+"pt":I?I.sz:"",st:W});postMessage([{o:eq.MainOp.grid,i:f,f:X}]);a.acquire();return;case e.add:b.resumeSession&&(b.resumeSession=void 0,b.invalidateThenResume());
f=a.decodeUint();g=b.dlg.get(f);var J=a.decodeString();if(void 0===g){if("eq-temp"!==J)throw Error("webdReceived: DLG "+f+" does not exist, mode: "+a.mode);b.dlg.set(f,g=new eq.c.Dlg(f))}if("eq-temp"===J)g.temp=!0;else if(J){if(g.temp)throw Error("webdReceived: DLG "+f+" is temporary, mode: "+a.mode);p=g.findById(J,!0)}g.addChild(a,p);g.tabOrderValid=!1;break;case e.modify:f=a.decodeUint();g=b.dlg.get(f);l=a.decodeString();if(void 0===g)throw Error("webdReceived: DLG "+f+" does not exist, mode: "+
a.mode);if(g.temp)throw Error("webdReceived: DLG "+f+" is temporary, mode: "+a.mode);p=g.findById(l,!0);var S={id:p.id};a.msg.push({o:eq.MainOp.modifyControl,i:f,d:S});p.modify(g,a,S);break;case e.del:f=a.decodeUint();g=b.dlg.get(f);l=a.decodeString();if(void 0===g)throw Error("webdReceived: DLG "+f+" does not exist, mode: "+a.mode);if(g.temp)throw Error("webdReceived: DLG "+f+" is temporary, mode: "+a.mode);p=g.findById(l,!0);a.msg.push({o:eq.MainOp.deleteControl,i:f,d:p.id});p.del()?(g.root=null,
g.close(),b.dlg.delete(f)):g.tabOrderValid=!1;break;case e.invalidate:for(var E=[];f=a.decodeUint();)void 0!==(g=b.dlg.get(f))&&(g.temp||E.push(f),g.close(),b.dlg.delete(f));E.length&&a.msg.push({o:eq.MainOp.invalidate,d:E});break;case e.DLG_DRAW:h=a.decodeUint();f=a.decodeUint();g=b.dlg.get(f);if(void 0===g)throw Error("webdReceived: DLG "+f+" does not exist, mode: "+a.mode);if(g.temp)throw Error("webdReceived: DLG "+f+" is temporary, mode: "+a.mode);b.pendingCall=h;b.pendingCallCanceled=void 0;
a.msg.push({o:eq.MainOp.dlg_DRAW,i:f});break;case e.DLG_DO:h=a.decodeUint();f=a.decodeUint();g=b.dlg.get(f);E={f:a.decodeString()};if(void 0===g)throw Error("webdReceived: DLG "+f+" does not exist, mode: "+a.mode);if(g.temp)throw Error("webdReceived: DLG "+f+" is temporary, mode: "+a.mode);g.tabOrderValid||(g.updateTabOrder(),E.t=g.tabOrder);b.currDlg=g;b.pendingCall=h;b.pendingCallCanceled=void 0;a.msg.push({o:eq.MainOp.dlg_DO,i:f,d:E});break;case e.POPUP_BOX:b.resumeSession&&(b.resumeSession=void 0,
b.invalidateThenResume());h=a.decodeUint();c={btn:[]};var T;c.x=a.decodeInt();c.y=a.decodeInt();c.title=a.decodeString();c.msg=a.decodeString();for(c.btnDefault=a.decodeInt();T=a.decodeString();)c.btn.push(T);b.pendingCall=h;b.pendingCallCanceled=void 0;a.msg.push({o:eq.MainOp.dlg_POPUP_BOX,d:c});break;default:throw Error("webdReceived: invalid mode: "+a.mode);}}a.msg.length&&postMessage(a.msg);var Y=a.next;a.next=null;a.dispose();a=Y}catch(K){throw a.dispose(),K;}};
eq.c.Api.webdOpened=function(c){c=eq.api;var b=c.constructor;if(void 0!==c.webdHandshakeTimer)throw Error("BUG: webdOpened pending handshake");c.webdOpened=!0;b.webdStopRetry();c.webdHandshakeTimer=setTimeout(b.webdHandshakeFailed,3E4)};eq.c.Api.webdHandshakeFailed=function(){console.log("WebSocket handshake failed");eq.c.Api.webdStopHandshakeTimer();eq.api.ws.close(1002)};
eq.c.Api.webdStopHandshakeTimer=function(){var c=eq.api;void 0!==c.webdHandshakeTimer&&(clearTimeout(c.webdHandshakeTimer),c.webdHandshakeTimer=void 0)};
eq.c.Api.webdClosed=function(c){var b=eq.api,d=b.constructor,a=b.webdRetryTimer,e=!1,f=!1,g=!1;switch(c.code){case 1006:b.pendingLogin?g=f=!0:e=!0;break;case 1E3:case 1005:f=!0;default:g=!0}b.ws=void 0;void 0===a||e||(d.webdStopRetry(),a=void 0);b.startSession=void 0;b.resumeSession=void 0;b.pendingLogin=void 0;b.pendingInject=void 0;d.webdStopHandshakeTimer();if(void 0===a&&(b.webdOpened=void 0,g)){b.reset();b.resetDlg();postMessage([{o:eq.MainOp.applicationStopped,d:f}]);for(var h in eq.c)c=eq.c[h],
c.dispose&&c.dispose()}};eq.c.Api.webdFailed=function(c){c=eq.api;var b=c.constructor;void 0===c.webdRetryTimer&&0<(c.webdRetryCnt=c.reconnectTimeout)?(c.webdRetryTimer=setInterval(b.webdRetry,1E3),console.log("WebSocket connection failed, retry: "+c.webdRetryCnt+" seconds"),c.pendingCall=void 0,c.pendingCallCanceled=!0,c.currDlg=void 0,postMessage([{o:eq.MainOp.cancelCurrentCall,i:0}])):0>=c.webdRetryCnt&&(b.webdStopRetry(),console.log("WebSocket connection failed"),postMessage([{o:eq.MainOp.applicationFailed}]))};
eq.c.Api.webdRetry=function(){var c=eq.api;0<c.webdRetryCnt&&0===--c.webdRetryCnt%10&&c.webdRetryCnt&&console.log("WebSocket connection failed, retry: "+c.webdRetryCnt+" seconds");void 0===c.ws&&c.webdOpen()};eq.c.Api.webdStopRetry=function(){var c=eq.api;void 0!==c.webdRetryTimer&&(clearInterval(c.webdRetryTimer),c.webdRetryTimer=void 0,c.webdRetryCnt=void 0)};eq.api=new eq.c.Api;self.onmessage=eq.c.Api.mainReceived;postMessage([{o:eq.MainOp.apiThreadStarted}]);
//# sourceMappingURL=eq-webdlg-api.src.map
