!function(g,O){"use strict";var D="ht",m=g[D],Y="px",q="left",_="top",x="bottom",C="right",R="innerHTML",S="className",L="",B="width",T="height",r="string",E="position",j="absolute",y="0",u="opacity",F="background",h=m.Default,K=h.getInternal(),Z=m.Color,P=h.animate,i=h.isTouchable,H=h.isTouchEvent,n=null,w=(Math.sqrt,g.parseInt),A=g.setTimeout,M=(Math.round,Z.titleIconBackground),p=function(J){return typeof J===r||J instanceof String},z=function(){return document},v=function(Y){return z().createElement(Y)},G=function(){var E=v("div");return E.tabIndex=-1,E.style.outline="none",E},c=function(){return v("canvas")},N=function(b,J){X(b,"-webkit-transform",J),X(b,"-ms-transform",J),X(b,"transform",J)},X=function(Z,$,Y){Z.style.setProperty($,Y,n)},J=function(c,g,P){h.def(m.widget[c],g,P)},b=function(u,p){u.appendChild(p)},Q=function(){return z().documentElement},W=function(){return Q().clientWidth},k=function(){return Q().clientHeight},s=K.addEventListener,U=K.removeEventListener,I=function(B){var E=B.touches[0];return E?E:B.changedTouches[0]};K.addMethod(h,{dialogCloseIcon:{width:100,height:100,comps:[{type:"shape",points:[10,10,90,90],segments:[1,2],borderWidth:8,borderColor:M},{type:"shape",points:[90,10,10,90],segments:[1,2],borderWidth:8,borderColor:M}]},dialogMaximizeIcon:{width:100,height:100,comps:[{type:"rect",rect:[10,15,80,75],borderWidth:6,borderColor:M},{type:"rect",rect:[10,10,80,20],background:M}]},dialogRestoreIcon:{width:100,height:100,comps:[{type:"rect",rect:[10,34,56,56],borderWidth:8,borderColor:M},{type:"rect",rect:[10,34,56,14],background:M},{type:"rect",rect:[34,10,56,14],background:M},{type:"rect",rect:[82,10,8,56],background:M},{type:"rect",rect:[66,62,24,8],background:M}]},dialogTitleLabelColor:h.labelSelectColor,dialogTitleLabelFont:(i?"18":"14")+"px arial, sans-serif",dialogContentLabelFont:h.labelFont,dialogTitleBackground:Z.titleBackground,dialogHeaderBackground:Z.headerBackground,dialogButtonBackground:"#1ABC9C",dialogButtonSelectBackground:"#16A085",dialogButtonLabelColor:"#fff"},!0);var t=function(T){var N=this;N.$1d=T,N.addListeners()};h.def(t,O,{ms_listener:1,getView:function(){return this.$1d.getView()},clear:function(){delete this.$2d,delete this.$3d,delete this.$4d,delete this.$5d},handle_touchstart:function(l){var s=this,f=s.$1d,x=f.$6d,X=f._config,W=f.$7d,M=l,Z=l.target;if(W.contains(Z)||h.preventDefault(l),h.isLeftButton(l)){H(l)&&(M=I(l));var G=s.$8d={x:M.pageX,y:M.pageY};s.$9d={x:G.x,y:G.y},!X.maximized&&X.draggable&&x.contains(Z)&&(s.$4d=!0,h.startDragging(s,l)),s.handle_mousemove(l)&&(s.$2d=!0,h.startDragging(s,l)),W.contains(Z)||Z.focus()}},handle_mousedown:function(z){this.handle_touchstart(z)},handle_touchend:function($){if(h.isLeftButton($)&&!this.$5d&&!this.$3d){var u=this,o=u.$1d,C=$.target,r=o._config,j=o.$18d,n=o.$16d;for(r.closable&&j.contains(C)&&o.hide(),r.maximizable&&n.contains(C)&&(r.maximized?o.restore():o.maximize());C&&(C.className||"").indexOf("dialog-button")<0;)C=C.parentNode;C&&C.buttonItem&&o.action&&o.action(C.buttonItem,$),delete u.$8d,delete u.$9d}},handle_mouseup:function(E){this.handle_touchend(E)},handleWindowTouchEnd:function(U){var z=this,X=z.$1d,J=X.$10d;z.$2d&&z.$3d?J.fire({kind:"endResize",target:X,originEvent:U}):z.$4d&&z.$5d&&J.fire({kind:"endMove",target:X,originEvent:U}),this.clear()},handleWindowMouseUp:function(W){this.handleWindowTouchEnd(W)},handle_mousemove:function(J){var b=this.$1d._config;if(b.maximized)return!1;if("w"!==b.resizeMode&&"h"!==b.resizeMode&&"wh"!==b.resizeMode)return!1;var N=this,v=N.getView(),B=v.querySelector(".resize-area"),S=B.getBoundingClientRect(),a={x:S.left,y:S.top,width:S.width,height:S.height};J=H(J)?I(J):J;var f=J.clientX,m=J.clientY,l={x:f,y:m};return h.containsPoint(a,l)?(X(v,"cursor","nwse-resize"),!0):(X(v,"cursor",L),void 0)},handleWindowTouchMove:function(P){P.preventDefault();var v=P;H(P)&&(v=I(P));var T=this,E=T.$8d,K=T.$9d;if(!(K.x==E.x&&K.y==E.y&&h.getDistance(K,{x:v.pageX,y:v.pageY})<=1)){var Q=T.$1d,f=Q._config,j=Q.$21d,Z=f.resizeMode||"wh",D=v.pageX-E.x,B=v.pageY-E.y;if(T.$2d){var R=j.offsetWidth,p=j.offsetHeight,t=R+D,G=p+B;if(t=Math.max(t,50),G=Math.max(G,50),"center"===f.position||f.position==n){var l={},y=j.getBoundingClientRect();l.x=y.left,l.y=y.top,f.position=l}"w"===Z?(Q.setSize(t,p),E.x+=t-R):"h"===Z?(Q.setSize(R,G),E.y+=G-p):"wh"===Z&&(Q.setSize(t,G),E.x+=t-R,E.y+=G-p),T.$3d?Q.$10d.fire({kind:"betweenResize",target:Q,originEvent:P}):(T.$3d=!0,Q.$10d.fire({kind:"beginResize",target:Q,originEvent:P}))}else if(T.$4d){var x=j.getBoundingClientRect(),m=x.width,b=x.height,s=W(),r=k(),V=w(j.style.left)||0,O=w(j.style.top)||0,g=V+D,u=O+B,U=Q.adjustPosition({x:g,y:u},{width:m,height:b},{width:s,height:r});U&&(g=U.x,u=U.y);var L=g-V,o=u-O;X(j,q,g+Y),X(j,_,u+Y),E.x+=L,E.y+=o,f.position={x:g,y:u},T.$5d?Q.$10d.fire({kind:"betweenMove",target:Q,originEvent:P}):(T.$5d=!0,Q.$10d.fire({kind:"beginMove",target:Q,originEvent:P}))}}},handleWindowMouseMove:function(n){this.handleWindowTouchMove(n)},handleWindowResize:function(){var N=this,u=N,x=u._config,l=u.$21d,A=W(),o=k(),I=x.width,H=x.height,n=x.position||"center";x.maximized?(X(l,B,A+Y),X(l,T,o+Y),X(l,_,y),X(l,q,y)):(X(l,B,I+Y),X(l,T,H+Y),"center"===n?(X(l,q,(A-I)/2+Y),X(l,_,(o-H)/2+Y)):(X(l,q,n.x+Y),X(l,_,n.y+Y))),u.iv()},handle_mousewheel:function(y){y.stopPropagation()},handle_DOMMouseScroll:function(I){I.stopPropagation()}}),m.widget.Dialog=function(c){var F=this,$=F._view=K.createView(null,F);$[S]="ht-widget-dialog",X($,E,j),X($,_,y),X($,x,y),X($,q,y),X($,C,y),X($,B,"auto"),X($,T,"auto"),h.baseZIndex!=n&&X($,"z-index",h.baseZIndex+"");var s=F.$11d=new t(F);F.bindingHandleWindowResize=s.handleWindowResize.bind(F),F.$10d=new m.Notifier,c&&F.setConfig(c)},J("Dialog",O,{ms_v:1,ms_fire:1,_modal:!0,setTitle:function(Q){this._config.title=Q,this.getView().querySelector(".dialog-container-title span").innerHTML=Q},clearNodes:function(Q){if(Q)for(;Q.firstChild;)Q.removeChild(Q.firstChild)},$31d:function(){var V=this,A=V.$6d=G(),k=V._config,f=V.$12d=V.$13d();A[S]="dialog-container-title",X(A,"cursor","default"),X(A,"white-space","nowrap"),X(A,"overflow","hidden"),X(A,"font",h.dialogTitleLabelFont),X(A,F,k.titleBackground||h.dialogTitleBackground),X(A,"color",k.titleColor||h.dialogTitleLabelColor);var T=v("span"),C=V.$25d();if(k.titleAlign&&X(A,"text-align",k.titleAlign),k.titleIcon){var e=V.$14d=V.$15d();b(A,e)}if(k.title&&k.title.trim&&(k.title=k.title.trim()),T[R]=k.title||" ",b(A,T),k.maximizable){var B=V.$16d=V.$17d();b(f,B)}if(k.closable){var $=V.$18d=V.$19d();b(f,$)}return b(A,f),X(A,"display","block"),X(A,"line-height",C+Y),A},$13d:function(){var v=G();return X(v,E,j),X(v,q,y),X(v,C,5+Y),X(v,_,y),X(v,x,y),X(v,"text-align",C),X(v,"white-space","nowrap"),v[S]="dialog-title-controls",v},$20d:function(){var H=this.$21d=G(),I=this._config,n=I.borderWidth;return X(H,E,"fixed"),X(H,"box-shadow","rgba(0, 0, 0, 0.2) 0px 5px 10px 0px"),X(H,"padding",y+" "+n+Y+" "+n+Y+" "+n+Y),X(H,"box-sizing","border-box"),X(H,"-moz-box-sizing","border-box"),H[S]="dialog-container",X(H,F,I.titleBackground||h.dialogTitleBackground),H},$22d:function(){var l,K=this,Q=K._config,F=K.$7d=G(),g=Q.content,I=0,s=Q.contentPadding||0;Q.buttons!=n&&Q.buttons.length>0&&(I=32),p(g)?F[R]=g:g.getView?(l=g.getView(),b(F,l)):(l=g,b(F,l)),X(F,E,j),X(F,"font",h.dialogContentLabelFont),Q.width&&X(F,B,Q.width-10-2*s+Y),m.Default.appendToScreen(F);var y=F.offsetWidth+1,P=F.offsetHeight,M=K.$25d();return Q.width==n?Q.width=y+10+2*s:X(F,B,"auto"),Q.height==n&&(Q.height=P+M+I+5+2*s),m.Default.removeHTML(F),l&&(X(l,"box-sizing","border-box"),X(l,"-moz-box-sizing","border-box"),X(l,B,"100%"),X(l,T,"100%")),F[S]="dialog-content",X(F,_,M+s+Y),X(F,x,I+s+Y),X(F,q,s+Y),X(F,C,s+Y),X(F,"overflow","hidden"),F},getOverlayDiv:function(){return this.$41d},$23d:function(){if(this.$41d)return this.$41d;var l=this.$41d=G();return l[S]="dialog-overlay",X(l,E,j),X(l,_,y),X(l,x,y),X(l,q,y),X(l,C,y),X(l,F,"rgba(235, 235, 235, 0.7)"),l},_config:n,setSize:function(W,l){var B=this,w=B._config;w&&(w.width=W,w.height=l,B.isShowing()&&(B.bindingHandleWindowResize(),B.iv()))},getConfig:function(){return this._config},$24d:function(){var n=this._config,R=n.titleIconSize||16;return i&&(R*=1.2),R},$25d:function(){var u=this._config,O=u.titleHeight||h.widgetTitleHeight;return O},$26d:function(a){var c=this._config;X(a,"margin-right",(c.titleIconGap||(i?8:4))+Y),X(a,"cursor","pointer"),X(a,"display","inline-block"),X(a,"vertical-align",_)},$27d:function(){var P=this.$30d=G(),F=10;return i&&(F=20),X(P,B,F+Y),X(P,T,F+Y),X(P,E,j),X(P,x,y),X(P,C,y),P[S]="resize-area",P},$15d:function(){var x=this,s=c();s[S]="dialog-title-control dialog-title-control-icon";var p=x.$25d(),Q=x.$24d();return x.$26d(s),K.setCanvas(s,Q,p),s},$17d:function(){var Y=c();Y[S]="dialog-title-control dialog-title-control-maximize";var p=this.$25d(),o=this.$24d();return this.$26d(Y),K.setCanvas(Y,o,p),Y},$19d:function(){var T=c();T[S]="dialog-title-control dialog-title-control-close";var X=this.$25d(),w=this.$24d();return this.$26d(T),K.setCanvas(T,w,X),T},$28d:function(){var l=G();return X(l,F,h.dialogContentBackground||"white"),X(l,B,"100%"),X(l,T,"100%"),X(l,E,"relative"),l},$29d:function(){var J=this,A=G();X(A,"line-height",32+Y),X(A,"font-size",0+Y),X(A,E,j),X(A,x,y),X(A,q,y),X(A,"white-space","nowrap"),X(A,"overflow","hidden"),X(A,C,y),X(A,F,h.dialogHeaderBackground),A[S]="dialog-container-buttons";var g=this._config,$=g.buttonsAlign||C,T=0;return X(A,"text-align",$),J.$42d=[],g.buttons.forEach(function(N){var j={};for(var x in N)j[x]=N[x];N.background||(j.background=h.dialogButtonBackground),N.selectBackground||(j.selectBackground=h.dialogButtonSelectBackground),N.labelColor||(j.labelColor=h.dialogButtonLabelColor);var p=h.createObject(m.widget.Button,j),L=p.getView();L[S]="dialog-button "+N.className,L.buttonItem=N,J.$42d.push(p),X(L,E,"relative"),X(L,"display","inline-block"),X(L,"text-align",q),X(L,"height",24+Y);var y=i?10:5;$===q||$===C?X(L,"margin-"+$,y+Y):0===T||X(L,"margin-"+q,y+Y),X(L,"vertical-align","middle");var K=h.getTextSize(p.getLabelFont(),N.label).width+10;p.onClicked=function(S){N.action&&N.action.call(J,N,S)},X(L,B,K+Y),b(A,p.getView()),T++}),A},setConfig:function(t){if(t){var A=this,M=A._view;A._config=t,A.action=t.action,A.clearNodes(M),t.borderWidth==n&&(t.borderWidth=5);var k=A.$23d(),C=A.$28d(),D=A.$31d(),l=A.$22d(),T=A.$20d(),x=A.$30d=A.$27d();if(b(M,k),b(M,T),b(T,C),b(C,D),b(C,l),t.buttons!=n&&t.buttons.length>0){var p=A.$29d();b(C,p)}b(T,x),t.maximized?(t.maximized=!1,A.bindingHandleWindowResize(),A.maximize(!0)):A.bindingHandleWindowResize(),A.isShowing()&&A.iv()}},hide:function(){var I=this,K=I.$21d,f=I.$41d,_=I._view;_[S]="ht-widget-dialog",P(K).duration(200).scale(.7).set(u,y).end(function(){I.onHidden&&I.onHidden(),m.Default.removeHTML(_),I.$10d.fire({kind:"hide",target:I})}),P(f).duration(200).set(u,y).end(),U(g,"resize",I.bindingHandleWindowResize)},isShowing:function(){return!!this._view.parentNode},setModal:function(e){this._modal=e;var E=this.$23d();E.style.display=e?"block":"none";var S=this._view;X(S,B,e?"auto":y),X(S,T,e?"auto":y)},isModal:function(){return this._modal},$32d:function(){var k=this,q=k._config,u=k.$21d;N(u,L),k.iv(),q.maximized?k.$10d.fire({kind:"maximize",target:k}):k.$10d.fire({kind:"restore",target:k})},maximize:function(v){var F=this,g=F.$21d,G=F._config;if(!G.maximized){G.maximized=!0,F.$33d(),F.$16d[S]="dialog-title-control dialog-title-control-minimize";var M=G.width,p=G.height,A=w(g.style.left)||0,V=w(g.style.top)||0;F.$36d=M,F.$37d=p,F.$34d=A,F.$35d=V;var k,i=v?0:200,y=this._view.parentNode;k=y&&y!==document.body?this._view.parentNode.getBoundingClientRect():h.getWindowInfo(),P(g).duration(i).set(q,k.left+Y).set(_,k.top+Y).set(B,k.width+Y).set(T,k.height+Y).end(function(){F.$32d()})}},restore:function(){var i=this,w=i.$34d,M=i.$35d,R=i.$36d,F=i.$37d,H=i._config;if(H.maximized&&(H.maximized=!1,i.$33d(),i.$16d[S]="dialog-title-control dialog-title-control-maximize",i.isShowing()&&w!=n&&M!=n&&R!=n&&F!=n)){var k=i.$21d;P(k).duration(200).set(q,w+Y).set(_,M+Y).set(B,R+Y).set(T,F+Y).end(function(){i.$32d()})}delete i.$34d,delete i.$35d,delete i.$36d,delete i.$37d},show:function(f){var O=this,I=O._view,o=O._config,V=O.$21d,J=O.$41d;f=f||o.parentDOM,o&&o.zIndex!=n&&X(I,"z-index",o.zIndex+L),f?m.Default.appendChild(f,I):m.Default.appendToScreen(I),N(V,"scale(0.7)"),X(V,u,y),O.iv(),O.validate(),O._view[S]+=" dialog-show",A(function(){P(V).duration(200).scale(1).set(u,"1").end(function(){X(V,B,V.clientWidth+Y),X(V,T,V.clientHeight+Y),O.onShown&&O.onShown(),O.$10d.fire({kind:"show",target:O});var t=o&&o.content;t&&t.iv&&t.iv()}),P(J).duration(200).set(u,"1").end(),s(g,"resize",O.bindingHandleWindowResize)},30)},setPosition:function(r){var S=this.$21d;S.style.left=r.x+"px",S.style.top=r.y+"px"},addEventListener:function(m,d,W){this.$10d.add(m,d,W)},removeEventListener:function(i,y){this.$10d.remove(i,y)},$38d:function(A,w,R,z){var D=K.initContext(A);K.translateAndScale(D,0,0,1),D.clearRect(0,0,R,R);var y=(R-z)/2;h.drawStretchImage(D,h.getImage(w),"fill",0,y,z,z),D.restore()},$33d:function(){var T=this,Q=T._config,l=T.$16d,p=Q.maximized?h.dialogRestoreIcon:h.dialogMaximizeIcon;if(l&&p){var W=T.$25d(),c=T.$24d();T.$38d(l,h.getImage(p),W,c)}},$39d:function(){var D=this,y=D._config,L=D.$14d,F=y.titleIcon;if(L&&F){var P=D.$25d(),N=D.$24d();D.$38d(L,h.getImage(F),P,N)}},$40d:function(){var e=this,m=e.$18d,l=h.dialogCloseIcon;if(m&&l){var f=e.$25d(),Q=e.$24d();e.$38d(m,h.getImage(l),f,Q)}},invalidate:function(a){var y=this,f=y.$42d;y._68I||(y._68I=1,h.callLater(y.validate,y,n,a),y.onInvalidated&&y.onInvalidated(),y.fireViewEvent("invalidate"));var s=y._config.content;s.invalidate&&s.invalidate(),f&&f.forEach(function(m){m.iv()})},validateImpl:function(){var I=this;I.$40d(),I.$33d(),I.$39d();var k=I._config.content;k.initView&&(k.setX(0),k.setY(0),k.setWidth(I.$7d.clientWidth),k.setHeight(I.$7d.clientHeight))},adjustPosition:function(W,A,j){var C=A.width,H=A.height,f=j.width,X=j.height,b=W.x,P=W.y,o=this._config,k=o.minDragSize||20;return"inside"===o.dragMode?(b+C>f&&(b=f-C),P+H>X&&(P=X-H),0>b&&(b=0),0>P&&(P=0)):(null==o.dragMode||"none"===o.dragMode)&&(-C+k>b&&(b=-C+k),b>f-k&&(b=f-k),P>X-k&&(P=X-k),0>P&&(P=0)),{x:b,y:P}}})}("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:(0,eval)("this"),Object);