/* @license Copyright (C) Exontrol. All rights reserved. */ !function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):(t="undefined"!=typeof globalThis?globalThis:t||self,o(t.exontrol||{}))}(this,function(t){"use strict";function o(t){return function(t,o,e){for(;~t.indexOf(o);)t=t.repAll(o,e);return t}(t,d,f).trim()}function e(t){return null!=t}function i(t){return null==t}function n(t,e){return o(r(t,e)+f+e)}function r(t,e){return o(t.repAll(e,""))}function s(t,o,e){e=e||this;var i=l.CC.c2CC(t);return i&&i.rgC.forEachU(function(t){if(t=function(t){return t.oT||t}(t))return o.call(e,t)})}function h(t){return t.oB&&t.oB.oHE||t.oHE}function c(t){return s(h(t),function(t){return t})}var l=l||window.exontrol,u=l.G,p="exd2-hide",a="exd2-show",f=" ",d=" ",y=Math.round,C=Math.max,g=Math.min,v=1234;l.Def.ComboBox={},l.Shapes.ComboBox={},l.Mrg(l,function(){function t(t,o){this.init(t,o)}return t.version="3.0",t.type="ComboBox",t.XML=function(){function t(t){return e(t)?t.toLowerCase():t}function o(e){var i,n,r="^"==e.charAt(0);r&&(e=e.substr(1)),~(i=e.indexOf("/"))&&(n=e.substr(i+1),e=e.substr(0,i));for(var s,h=function(o){o=t(o);for(var e,i=[],n=0,r=this.getElementsByTagName("*"),s=r.length;n>=8))+",",n+=(255&(t>>=8))+")"),n||o}}}(),t.allowRurPart=function(t,o,e){return!e||!o||o.indexOf(t)>=0&&(!function(t){return t.split(",").forEachU(function(t){return this.has(t)},this)}.call(e,o)||e.has(t))},t.Options={tfi:null,locked:null,readOnly:null,readOnly:!1,shapes:null,cursors:null,zoom:null,formatText:null,pad:null,allowActions:null,toolTipDelay:null,toolTipPopDelay:null,toolTipWidth:null,label:null,host:null,allowDrop:null,align:null,dropDown:null,allowResize:null,showClearButton:null},t.bSCTX=function(t,o,i,n){var r;return o&&(t.drawShape(i,o,n),r=l.TFI.bCTX(t,o.tfi),e(o.opacity)&&((r=r||{}).opacity=t.globalAlpha,t.globalAlpha=o.opacity)),r},t.eSCTX=function(t,o){e(o.opacity)&&(t.globalAlpha=o.opacity),o instanceof l.TFI&&l.TFI.eCTX(t,o)},t.prototype.init=function(o,e){this.lnt=this.lnt||0,this.lnt++,this.oD2B=null,this.oCB=null,this.oCV=null,this.rgCV=[],this.iLts(),this.oCW=new l.CW(o,{AllowXChg:0}),this.oCW.oT=this,this.Shortcuts=this.oCW.oSts,this.initCW(),this.import(),l.expO(t.Options,this,this.oCV),this.cwbU(),this.SetOptions(e,!0),this.cweU(),l.DPR.Reg(this),--this.lnt},t.prototype.GetCanvas=function(){return this.oCW.GetCanvas()},t.prototype.defAA=function(){return"d2,d2(double)"},t.prototype.roAA=function(){return""},t.prototype.allP=function(){return"view(ComboBox.CV)"},t.prototype.lRA=function(t){this.oCW.lRA(t)},t.prototype.feCV=function(t,o){l.ComboBox.CV.prototype[t]?this.rgCV.forEach(function(o){o[t].call(o)},this):this.rgCV.forEach(t,o)},t.prototype.feCVU=function(t,o){return l.ComboBox.CV.prototype[t]?this.rgCV.forEachU(function(o){o[t].call(o)},this):this.rgCV.forEachU(t,o)},t.prototype.BeginUpdate=function(){this.oCW.CWs().forEach(function(t){t.bU()})},t.prototype.bU=t.prototype.cwbU=t.prototype.BeginUpdate,t.prototype.EndUpdate=function(){1==this.oCW.lR&&this.fU(),this.oCW.CWs().forEach(function(t){t.eU()})},t.prototype.eU=t.prototype.cweU=t.prototype.EndUpdate,t.prototype.Update=function(t,o){this.bU(),t&&t.call(o||this),this.eU()},t.prototype.fU=function(){},t.prototype.Refresh=function(){this.bU(),this.onRL(),this.eU()},t.prototype.onRL=function(){},t.prototype.iLts=function(){this.Listeners=this.oLts=new l.Lts,this.oLts.add("onclick"),this.oLts.add("onanchorclick"),this.oLts.add("ond2"),this.oLts.add("onclear")},t.prototype.on=function(t,o,e){},t.prototype.off=function(t,o,e){},l.Lts.Onf(t.prototype),t.prototype.addCV=function(t,o){var e=null;if(!i(t)&&t.trim().length||(t="combobox"+this.rgCV.length),!this.oCW.W(t)){var n=!this.rgCV.length,r=(this.oCW.W("main")||this.oCW).Add(t,l.Mrg({Dock:n?5:4,Size:256},o));e=new l.ComboBox.CV(this),this.rgCV.push(e),this.oCV=this.oCV||e,!(r.GetDock()%2)&&r.SetPosition(this.oCW.W("combobox").GetPosition()+1),r.Add("client",{Dock:5,Control:e})}return e},t.prototype.delCV=function(t){!i(t)&&t.trim().length||(t=this.rgCV[this.rgCV.length-1].oW.opW.GetName());var o=!1,e=this.oCW.W(t);if(e){var n=null,r=this.oCW.W(e.GetName()+".client");if(r&&(n=r.GetC())instanceof l.ComboBox.CV&&n!=this.oCV){var s=this.rgCV.indexOf(n);(o=s>=0)&&(this.rgCV.splice(s,1),this.oCW.Remove(e))}}return o},t.prototype.initCW=function(){var t,o=this,e=this.oCW;this.oCW.canvas.addEventListener("dragover",this.localdragover=function(t){return o.ondragover(t)}),this.oCW.canvas.addEventListener("drop",this.localdrop=function(t){return o.ondrop(t)}),this.oCW.SetClientRect=function(t){return function(){t.apply(this,arguments)}}(this.oCW.SetClientRect),(e=e.Add("control",{Dock:5})).Add("d2b",{Dock:4,Size:24,Resizable:!1,DrawWindowFrame:!1,Control:this.oD2B=new l.ComboBox.D2B(this)}),t=e.Add("cb",{Dock:4,Size:24,Resizable:!1,DrawWindowFrame:!1,Control:this.oCB=new l.ComboBox.CB(this)}),e.Add("main",{Dock:5,HoverExtends:"control,cb"}),this.addCV("combobox"),t.GetVisible=this.oCV.showCB.bind(this.oCV),this.oD2B.import(),this.oCB.import()},t.prototype.w2P=function(t){function o(){function t(t){var o=[];return l.B.split(t).forEach(function(t){t.caption&&t.subText&&o.push({n:t.caption,p:function(t){var o=l;return t.split(".").forEach(function(t){o=o[t]}),o.prototype}(t.subText)})}),o}return this._allP||(this._allP=t.call(this,this.allP()))}var e,i=t&&t.oC&&Object.getPrototypeOf(t.oC);if(i)for(var n,r=o.call(this),s=0,h=r.length;!e&&se?0:(o[3]-u)/2),~~(c+1),u]||null})}.call(this),onpaint:function(t,o){this.ctxTfi(function(t){n(r,t,o,s)},this,t)},thisArg:this}},{thisArg:this,ttO:r.o,ttD:this.getToolTipDelay(),ttP:this.getToolTipPopDelay()})}},t.prototype.xA=function(){l.A.Cancel("ss*")},t.prototype.ondown=function(t){return this.isSelectable()&&(this.xA(),this.gAA().Do(this,t),!l.RUR.Rng()&&this.doRUR(t,function(t){switch(t.drag.status){case 4:case 5:this.rurActionClick(null,t)}},this)),!0},t.prototype.doRUR=function(t,o,e,i){var n,r,s=this.gAA(),h=this.oT.lRA.bind(this.oT);return l.RUR.Do(t,function(t){switch(r=t.drag.status){case 1:h(7),n=this.oT.oRUR=this.e2RUR(t),this.lRURLong&&t.drag.setCursor(l.GP.Get("long",this.getCursors()));break;case 3:s.CanDo(t,1)&&(l.RUR.Cancel(),this.norurAction(t,1)||(this.lRURLong=(this.lRURLong||0)+1,s.Do(this,t,1),--this.lRURLong));break;case 5:this.norurAction(t,2);break;case 2:case 6:h(4)}!(n&&n.c&&n.c.bRUR&&n.c.bRUR(t))&&o.call(e,t),n&&n.c&&n.c.eRUR&&n.c.eRUR(t),7==r&&(n&&(n=this.oT.oRUR=null),h(t.drag.click||t.drag.long?46:62))},this,i)},t.toClick=function(t){return{dblClick:t.drag&&(t.drag.long||1!=t.drag.click)||!1,button:l.e2B(t),modifiers:l.ModK(t)}},t.prototype.toClick=function(t,o){},t.prototype.onA=function(t,o){if(t){l.H.VisitA(this,t),this.inv();var e=c(this.getHost());e&&e.Refresh&&e.Refresh(),this.onanchorclick(t)}},t.prototype.onClick=function(o){var e=t.toClick(o),i=this.e2V(o),n=this.gPtr(o);i&&(e.view=i,i.toClick&&i.toClick(o,e)),this.onA(this.p2A(n),e),this.onclick(e)},t.prototype.onclick=function(t){this.oLts.onclick.do(t)},t.prototype.onanchorclick=function(t){this.oLts.onanchorclick.do(t)},t.prototype.onDblClk=function(t){this.gAA().CanDo(t,2,"d2")&&this.setTimeout(function(){this.d2(!0)})},t.prototype.ond2=function(){this.oLts.ond2.do()},t.prototype.isD2V=function(){var t=this.getHost().oHE;return t&&~t.className.indexOf(a)||!1},t.prototype.d2=function(t){function o(t){for(var o=l.CSSzom(t),e=l.Ert(t),i=0;i<4;i++)e[i]*=o;return e}function e(t){var e,i,s,h,c=this.getHost(),u=c.oHE;u&&(t=!!t,!!this.isD2V(t)!=t&&(this.grtD2(c),u.className=t?function(t){return n(r(t,p),a)}(u.className):function(t){return n(r(t,a),p)}(u.className),t&&(e=o(this.GetCanvas()),i=o(u),s=this.getAlign(),i=l.G.C2R(l.G.R2C(e,s[0]),i[2],i[3],s[1]),l.FRt(i,l.pgrt()),(h=u.style).left=l.toU(i[0]),h.top=l.toU(i[1]))))}!t||!(v?0:v=1+l.Tick()%3321)&&!function(){var t="pmgi",o=l[t+="rwi"].call(l);return!(l.iL()&&(!o||!o.k))}()||(v+=v>>2)%4||(t=!1),e.call(this,t)},t.prototype.onclear=function(){this.d2(!1),this.oLts.onclear.do()},t.prototype.clear=function(){var t=this.getHost();this.bU(),this.SetLabel(""),t.sCB&&t.sCB(!0,this),this.eU()},t.prototype.e2RUR=function(t){var o=this.gPtr(t),e=this.e2W(t)||this.oW,i=e.GetClientRect();return{w:e,c:e.oC,x:u.X(o)-i[0],y:u.Y(o)-i[1]}},t.prototype.allowRur=function(t,o){return e(t)},t.prototype.rurAction=function(t,o,e){var i={rurName:t,rurFlags:o,rurOnlyW:this.e2W(e),rurStatus:function(o){this.rurActionClick(t,o)}};if(this.allowRur(e,i)){var n="rur"+l.getP(function(t){for(var o,e="",i=0,n=t.length;i=o[e])for(;t>=o[e+1]&&e"+t+":"+(y(this.gCtx().fontHeight())+2)+" "+o),o},t.prototype.isDef=function(){return this==this.oT.oCV},t.prototype.GetAllowDrop=function(){return this.oO.allowDrop},t.prototype.SetAllowDrop=function(t){this.oO.allowDrop=t},t.prototype.getAllowDrop=function(){return this.opt("allowDrop",!1)},t.prototype.GetTfi=function(){return this.oO.tfi},t.prototype.SetTfi=function(t){this.cwbU(),this.oO.tfi=t||null,this.nFH=0,this.onRL(),this.cweU()},t.prototype.getTfi=function(){return this.opt("tfi")},t.prototype.getFH=function(){return this.nFH||(this.nFH=function(){return this.ctxTfi(function(t){return t.fontHeight()})}.call(this))},t.prototype.ctxTfi=function(t,o,e){var i,n;return(e=e||this.gCtx())&&(i=l.TFI.bCTX(e,this.getTfi()),n=t.call(o||this,e),l.TFI.eCTX(e,i)),n},t.prototype.getFont=function(){return this.ctxTfi(function(t){return l.GetFont(t)})},t.prototype.GetLocked=function(){return this.oO.locked},t.prototype.SetLocked=function(t){this.cwbU(),this.oO.locked=t,this.onRL(),this.cweU()},t.prototype.getLocked=function(){return this.opt("locked",!1)},t.prototype.GetReadOnly=function(){return this.oO.readOnly},t.prototype.SetReadOnly=function(t){this.cwbU(),this.oAA=null,this.oO.readOnly=t,this.onRL(),this.uH(),this.cweU()},t.prototype.isReadOnly=function(){return this.opt("readOnly",!1)},t.prototype.GetShapes=function(){return this.oO.shapes},t.prototype.SetShapes=function(t){this.cwbU(),this.sShs=null,this.oO.shapes=t,this.onRL(),this.cweU()},t.prototype.defShp=function(){return'Button(button),{"normal":{"text":"▼"},"hover":{"fillColor":"#B2B2B2"}}(button),{"normal":{"text":"✖"}}(clear)'},t.prototype.getShapes=function(){var t=this.sShs;return i(t)&&(i(t=this.GetShapes())&&(t=l.Def.ComboBox.shapes),t=l.ToS(t,this.defShp()),this.sShs=t),t},t.prototype.toShapes=function(o){return o&&l.S.GetOf(o.GetShape&&o.GetShape()||t.typeOf(o),this.getShapes(),"ComboBox")||null},t.prototype.toShape=function(t,o){var e=this.toShapes(t),i=e&&e.normal||e;return i&&o&&e&&e.disabled&&(i=l.Inh(e.disabled,i)),i},t.prototype.GetCursors=function(){return this.oO.cursors},t.prototype.SetCursors=function(t){this.cwbU(),this.sCrs=null,this.oO.cursors=t,this.onRL(),this.cweU()},t.prototype.defCrs=function(){return"pointer(drag-drop,button,clear,anchor)"},t.prototype.getCursors=function(){var t=this.sCrs;return i(t)&&(i(t=this.GetCursors())&&(t=l.Def.ComboBox.cursors),t=l.ToS(t,this.defCrs()),this.sCrs=t),t},t.prototype.GetFormatText=function(){return this.oO.formatText},t.prototype.SetFormatText=function(t){this.cwbU(),this.nFT=null,this.oO.formatText=t,this.onRL(),this.cweU()},t.prototype.getFormatText=function(){return i(this.nFT)&&(this.nFT=function(t,o,e){return i(t)?~~e:l.s2F(t,o)}(this.opt("formatText"),l.DrawTextFormatEnum,l.DrawTextFormatEnum.exTextAlignLeft|l.DrawTextFormatEnum.exTextAlignVCenter|l.DrawTextFormatEnum.exTextWordBreak|l.DrawTextFormatEnum.exTextWordEllipsis)),this.nFT},t.prototype.GetPad=function(){return this.oO.pad},t.prototype.SetPad=function(t){this.cwbU(),this.rgPad=null,this.oO.pad=t,this.onRL(),this.cweU()},t.prototype.getPad=function(){return i(this.rgPad)&&(this.rgPad=l.pad2A(this.opt("pad",[2,2]))),this.rgPad},t.prototype.GetAllowActions=function(){return this.oO.allowActions},t.prototype.SetAllowActions=function(t){this.cwbU(),this.oAA=null,this.oO.allowActions=t,this.cweU()},t.prototype.gAA=function(){return this.oAA||(this.oAA=new l.AA(this.opt("allowActions",this.oT.defAA()),this.isReadOnly()?this.oT.roAA():"")),this.oAA},t.prototype.GetToolTipDelay=function(){return this.oO.toolTipDelay},t.prototype.SetToolTipDelay=function(t){this.oO.toolTipDelay=t},t.prototype.getToolTipDelay=function(){return this.opt("toolTipDelay",500)},t.prototype.GetToolTipPopDelay=function(){return this.oO.toolTipPopDelay},t.prototype.SetToolTipPopDelay=function(t){this.oO.toolTipPopDelay=t},t.prototype.getToolTipPopDelay=function(){return this.opt("toolTipPopDelay",5e3)},t.prototype.GetToolTipWidth=function(){return this.oO.toolTipWidth},t.prototype.SetToolTipWidth=function(t){this.oO.toolTipWidth=t},t.prototype.getToolTipWidth=function(){return this.opt("toolTipWidth",-1)},t.prototype.allowTT=function(){return l.TT&&this.getToolTipWidth()&&this.getToolTipPopDelay()},t.prototype.GetLabel=function(){return this.oO.label},t.prototype.SetLabel=function(t){this.bU(),this.oO.label=t,this.eU()},t.prototype.getLabel=function(){var t=this.getHost().oHE;return l.ToS(this.opt("label"))||!t&&"no host is set"||""},t.prototype.GetHost=function(){return this.oO.host},t.prototype.SetHost=function(t){function o(){var t,o,r,u=this.getHost();(t=u.oHE)&&(this.grtD2(u,!0),o=h(u),u.hed=function(t){i=e.call(this,t)}.bind(this),l.win.addEventListener("pointerdown",u.hed),l.win.addEventListener("mousedown",u.hed),u.heu=function(t){if(this.isD2V()){var o,n=e.call(this,t),r=this.getHost();(o=(!i||2!=i.h)&&n.h<0)||(o=!i||i.h<1)||(o=!i||2==i.h&&!l.ModK(t)&&i.x==n.x&&i.y==n.y&&n.s0&&1&this.getShowClearButton()},t.prototype.sCBh=function(){return this.getShowClearButton()>0&&2&this.getShowClearButton()},t.prototype.showCB=function(){var t,o=this.getShowClearButton();return this.isCBr()&&(o=(t=this.getHost()).sCB&&t.sCB(!1,this)),!!o},o.prototype.init=function(t){this.oT=t,this.oLts=t.oLts,this.lI=0},l.SB.addProto(o.prototype),l.SB.addProto(o.prototype,t.prototype,"import,GetClientRect,SetClientRect,onmousemove"),o.prototype.n={s:"button",c:"button"},o.prototype.onSetAO=function(t){if(this.isSelectable()&&!t.hasOf(this)){function o(t,o){return l.PInR(t,o,e.rtB())&&e.isAP(t,o)}var e=this,i=this,n=l.Def.ScrollBar.SmoothScroll,r=n.duration,s=n.transition,h=e.toShapes(this.n.s);h&&(!l.EyO(h.hover)&&t.set({owner:e,id:i.idAOH||(i.idAOH={}),inv:e.inv,hitTest:o,duration:r,transition:s}),!l.EyO(h.click)&&t.set({owner:e,id:i.idAOC||(i.idAOC={}),inv:e.inv,hitTest:o,actOn:4,duration:r,transition:s}))}},o.prototype.draw=function(t,o,e){this.drawB(t,this.rtB(),this.gAO())},o.prototype.drawB=function(t,o,e){var i,n=this,r=this.toShapes(this.n.s)||{},s=r.normal||r;!this.isSelectable()?l.EyO(r.disabled)||(s=l.Inh(r.disabled,s)):e&&(l.EyO(r.hover)||(i=e.get(this,n.idAOH))&&(s=l.R.Shape(i.state,i.range,{from:s,to:r.hover})),l.EyO(r.click)||(i=e.get(this,n.idAOC))&&(s=l.R.Shape(i.state,i.range,{from:s,to:r.click})));var h=l.ComboBox.bSCTX(t,s,o);h&&l.ComboBox.eSCTX(t,h)},o.prototype.rtB=function(){var t=this.GetClientRect(),o=g(t[2],t[3])-2;return l.G.C2R(l.G.R2C(t),o,o)},o.prototype.isSelectable=function(){return l.SB.prototype.isSelectable.call(this)&&this.gAA().Has("d2")},o.prototype.getCursor=function(t){return this.isSelectable()&&l.PInR(u.X(t),u.Y(t),this.rtB())&&l.GP.Get(this.n.c,this.getCursors())||null},o.prototype.allowTT=function(){},o.prototype.dCV=function(){return this.oT.oCV},o.prototype.ondown=function(t){return this.dCV().ondown(t)},o.prototype.rurD2=function(t,o){var e,i,n=this.gPtr(t);l.PInR(u.X(n),u.Y(n),this.rtB())&&l.RUC(t,function(t){t.drag.click&&(i=this.dCV(),e=!i.isD2V(),i.d2(e),e&&i.ond2())},this)},Object.addPrototypeOf(f.prototype,o.prototype),f.prototype.n={s:"clear",c:"clear"},f.prototype.isSelectable=function(){return l.SB.prototype.isSelectable.call(this)},f.prototype.ondown=function(t){var o,e=this.gPtr(t);l.PInR(u.X(e),u.Y(e),this.rtB())&&l.RUC(t,function(t){t.drag.click&&((o=this.dCV()).clear(),o.getHost().sel=-1,o.Refresh(),o.onclear())},this)},{CV:t,D2B:o,CB:f}}()),t.ComboBox=l.ComboBox});