/*! OOjs UI v0.9.3 | http://oojs.mit-license.org */ !function(a){"use strict";a.ui={},a.ui.bind=$.proxy,a.ui.Keys={UNDEFINED:0,BACKSPACE:8,DELETE:46,LEFT:37,RIGHT:39,UP:38,DOWN:40,ENTER:13,END:35,HOME:36,TAB:9,PAGEUP:33,PAGEDOWN:34,ESCAPE:27,SHIFT:16,SPACE:32},a.ui.getUserLanguages=function(){return["en"]},a.ui.getLocalValue=function(b,c,d){var e,f,g;if(b[c])return b[c];for(g=a.ui.getUserLanguages(),e=0,f=g.length;f>e;e++)if(c=g[e],b[c])return b[c];if(b[d])return b[d];for(c in b)return b[c];return void 0},a.ui.contains=function(a,b,c){var d;for(Array.isArray(a)||(a=[a]),d=a.length-1;d>=0;d--)if(c&&b===a[d]||$.contains(a[d],b))return!0;return!1},a.ui.infuse=function(b){return a.ui.Element["static"].infuse(b)},function(){var b={"ooui-outline-control-move-down":"Move item down","ooui-outline-control-move-up":"Move item up","ooui-outline-control-remove":"Remove item","ooui-toolbar-more":"More","ooui-toolgroup-expand":"More","ooui-toolgroup-collapse":"Fewer","ooui-dialog-message-accept":"OK","ooui-dialog-message-reject":"Cancel","ooui-dialog-process-error":"Something went wrong","ooui-dialog-process-dismiss":"Dismiss","ooui-dialog-process-retry":"Try again","ooui-dialog-process-continue":"Continue"};a.ui.msg=function(a){var c=b[a],d=Array.prototype.slice.call(arguments,1);return c="string"==typeof c?c.replace(/\$(\d+)/g,function(a,b){var c=parseInt(b,10);return void 0!==d[c-1]?d[c-1]:"$"+b}):"["+a+"]"},a.ui.deferMsg=function(){var b=arguments;return function(){return a.ui.msg.apply(a.ui,b)}},a.ui.resolveMsg=function(a){return $.isFunction(a)?a():a}}(),a.ui.PendingElement=function(a){a=a||{},this.pending=0,this.$pending=null,this.setPendingElement(a.$pending||this.$element)},a.initClass(a.ui.PendingElement),a.ui.PendingElement.prototype.setPendingElement=function(a){this.$pending&&this.$pending.removeClass("oo-ui-pendingElement-pending"),this.$pending=a,this.pending>0&&this.$pending.addClass("oo-ui-pendingElement-pending")},a.ui.PendingElement.prototype.isPending=function(){return!!this.pending},a.ui.PendingElement.prototype.pushPending=function(){return 0===this.pending&&(this.$pending.addClass("oo-ui-pendingElement-pending"),this.updateThemeClasses()),this.pending++,this},a.ui.PendingElement.prototype.popPending=function(){return 1===this.pending&&(this.$pending.removeClass("oo-ui-pendingElement-pending"),this.updateThemeClasses()),this.pending=Math.max(0,this.pending-1),this},a.ui.ActionSet=function(b){b=b||{},a.EventEmitter.call(this),this.list=[],this.categories={actions:"getAction",flags:"getFlags",modes:"getModes"},this.categorized={},this.special={},this.others=[],this.organized=!1,this.changing=!1,this.changed=!1},a.mixinClass(a.ui.ActionSet,a.EventEmitter),a.ui.ActionSet["static"].specialFlags=["safe","primary"],a.ui.ActionSet.prototype.onActionChange=function(){this.organized=!1,this.changing?this.changed=!0:this.emit("change")},a.ui.ActionSet.prototype.isSpecial=function(a){var b;for(b in this.special)if(a===this.special[b])return!0;return!1},a.ui.ActionSet.prototype.get=function(a){var b,c,d,e,f,g,h,i;if(a){this.organize(),i=[];for(e in this.categorized)if(d=a[e])for(Array.isArray(d)||(d=[d]),b=0,c=d.length;c>b;b++)f=this.categorized[e][d[b]],Array.isArray(f)&&i.push.apply(i,f);for(b=0,c=i.length;c>b;b++)h=i[b],(void 0!==a.visible&&h.isVisible()!==a.visible||void 0!==a.disabled&&h.isDisabled()!==a.disabled)&&(i.splice(b,1),c--,b--);for(b=0,c=i.length;c>b;b++)for(h=i[b],g=i.lastIndexOf(h);g!==b;)i.splice(g,1),c--,g=i.lastIndexOf(h);return i}return this.list.slice()},a.ui.ActionSet.prototype.getSpecial=function(){return this.organize(),$.extend({},this.special)},a.ui.ActionSet.prototype.getOthers=function(){return this.organize(),this.others.slice()},a.ui.ActionSet.prototype.setMode=function(a){var b,c,d;for(this.changing=!0,b=0,c=this.list.length;c>b;b++)d=this.list[b],d.toggle(d.hasMode(a));return this.organized=!1,this.changing=!1,this.emit("change"),this},a.ui.ActionSet.prototype.setAbilities=function(a){var b,c,d,e;for(b=0,c=this.list.length;c>b;b++)e=this.list[b],d=e.getAction(),void 0!==a[d]&&e.setDisabled(!a[d]);return this},a.ui.ActionSet.prototype.forEach=function(a,b){return this.changed=!1,this.changing=!0,this.get(a).forEach(b),this.changing=!1,this.changed&&this.emit("change"),this},a.ui.ActionSet.prototype.add=function(a){var b,c,d;for(this.changing=!0,b=0,c=a.length;c>b;b++)d=a[b],d.connect(this,{click:["emit","click",d],resize:["emit","resize",d],toggle:["onActionChange"]}),this.list.push(d);return this.organized=!1,this.emit("add",a),this.changing=!1,this.emit("change"),this},a.ui.ActionSet.prototype.remove=function(a){var b,c,d,e;for(this.changing=!0,b=0,c=a.length;c>b;b++)e=a[b],d=this.list.indexOf(e),-1!==d&&(e.disconnect(this),this.list.splice(d,1));return this.organized=!1,this.emit("remove",a),this.changing=!1,this.emit("change"),this},a.ui.ActionSet.prototype.clear=function(){var a,b,c,d=this.list.slice();for(this.changing=!0,a=0,b=this.list.length;b>a;a++)c=this.list[a],c.disconnect(this);return this.list=[],this.organized=!1,this.emit("remove",d),this.changing=!1,this.emit("change"),this},a.ui.ActionSet.prototype.organize=function(){var a,b,c,d,e,f,g,h,i,j,k=this.constructor["static"].specialFlags;if(!this.organized){for(this.categorized={},this.special={},this.others=[],a=0,b=this.list.length;b>a;a++)if(f=this.list[a],f.isVisible()){for(g in this.categories)for(this.categorized[g]||(this.categorized[g]={}),h=f[this.categories[g]](),Array.isArray(h)||(h=[h]),c=0,d=h.length;d>c;c++)i=h[c],this.categorized[g][i]||(this.categorized[g][i]=[]),this.categorized[g][i].push(f);for(j=!1,c=0,d=k.length;d>c;c++)if(e=k[c],!this.special[e]&&f.hasFlag(e)){this.special[e]=f,j=!0;break}j||this.others.push(f)}this.organized=!0}return this},a.ui.Element=function(b){b=b||{},this.$=$,this.visible=!0,this.data=b.data,this.$element=b.$element||$(document.createElement(this.getTagName())),this.elementGroup=null,this.debouncedUpdateThemeClassesHandler=this.debouncedUpdateThemeClasses.bind(this),this.updateThemeClassesPending=!1,Array.isArray(b.classes)&&this.$element.addClass(b.classes.join(" ")),b.id&&this.$element.attr("id",b.id),b.text&&this.$element.text(b.text),b.content&&this.$element.append(b.content.map(function(b){return"string"==typeof b?document.createTextNode(b):b instanceof a.ui.HtmlSnippet?b.toString():b instanceof a.ui.Element?b.$element:b})),b.$content&&this.$element.append(b.$content)},a.initClass(a.ui.Element),a.ui.Element["static"].tagName="div",a.ui.Element["static"].infuse=function(b){var c=a.ui.Element["static"].unsafeInfuse(b,!0);return c},a.ui.Element["static"].unsafeInfuse=function(b,c){var d,e,f,g,h;if("string"==typeof b?(d=b,e=$(document.getElementById(d))):(e=$(b),d=e.attr("id")),f=e.data("ooui-infused")){if(f===!0)throw new Error("Circular dependency! "+d);return f}if(!e.length)throw new Error("Widget not found: "+d);if(f=e.attr("data-ooui"),!f)throw new Error("No infusion data found: "+d);try{f=$.parseJSON(f)}catch(i){f=null}if(!f||!f._)throw new Error("No valid infusion data found: "+d);if("Tag"===f._)return new a.ui.Element({$element:e});if(g=a.ui[f._],!g)throw new Error("Unknown widget type: "+d);return e.data("ooui-infused",!0),f.id=d,f=a.copy(f,null,function(b){if(a.isPlainObject(b)){if(b.tag)return a.ui.Element["static"].unsafeInfuse(b.tag,!1);if(b.html)return new a.ui.HtmlSnippet(b.html)}}),h=new g(f),c&&e.replaceWith(h.$element),h.$element.data("ooui-infused",h),h.$element.attr("data-ooui",""),h},a.ui.Element["static"].getJQuery=function(a,b){function c(a){return $(a,c.context)}return c.context=this.getDocument(a),b&&(c.$iframe=b),c},a.ui.Element["static"].getDocument=function(a){return a[0]&&a[0].ownerDocument||a.context||a.ownerDocument||a.document||9===a.nodeType&&a||null},a.ui.Element["static"].getWindow=function(a){var b=this.getDocument(a);return b.parentWindow||b.defaultView},a.ui.Element["static"].getDir=function(a){var b,c;return a instanceof jQuery&&(a=a[0]),b=9===a.nodeType,c=void 0!==a.document,(b||c)&&(c&&(a=a.document),a=a.body),$(a).css("direction")},a.ui.Element["static"].getFrameOffset=function(a,b,c){var d,e,f,g,h;if(b||(b=window),c||(c={top:0,left:0}),a.parent===a)return c;for(f=a.parent.document.getElementsByTagName("iframe"),d=0,e=f.length;e>d;d++)if(f[d].contentWindow===a){g=f[d];break}return g&&(h=g.getBoundingClientRect(),c.left+=h.left,c.top+=h.top,a!==b&&this.getFrameOffset(a.parent,c)),c},a.ui.Element["static"].getRelativePosition=function(a,b){for(var c,d,e=a.offset(),f=b.offset(),g=this.getDocument(a),h=this.getDocument(b);g!==h;){if(c=g.defaultView.frameElement,!c)throw new Error("$element frame is not contained in $anchor frame");d=$(c).offset(),e.left+=d.left,e.top+=d.top,g=c.ownerDocument}return e.left-=f.left,e.top-=f.top,e},a.ui.Element["static"].getBorders=function(a){var b=a.ownerDocument,c=b.parentWindow||b.defaultView,d=c&&c.getComputedStyle?c.getComputedStyle(a,null):a.currentStyle,e=$(a),f=parseFloat(d?d.borderTopWidth:e.css("borderTopWidth"))||0,g=parseFloat(d?d.borderLeftWidth:e.css("borderLeftWidth"))||0,h=parseFloat(d?d.borderBottomWidth:e.css("borderBottomWidth"))||0,i=parseFloat(d?d.borderRightWidth:e.css("borderRightWidth"))||0;return{top:f,left:g,bottom:h,right:i}},a.ui.Element["static"].getDimensions=function(a){var b,c,d=a.ownerDocument||a.document,e=d.parentWindow||d.defaultView;return e===a||a===d.documentElement?(c=$(e),{borders:{top:0,left:0,bottom:0,right:0},scroll:{top:c.scrollTop(),left:c.scrollLeft()},scrollbar:{right:0,bottom:0},rect:{top:0,left:0,bottom:c.innerHeight(),right:c.innerWidth()}}):(b=$(a),{borders:this.getBorders(a),scroll:{top:b.scrollTop(),left:b.scrollLeft()},scrollbar:{right:b.innerWidth()-a.clientWidth,bottom:b.innerHeight()-a.clientHeight},rect:a.getBoundingClientRect()})},a.ui.Element["static"].getRootScrollableElement=function(b){var c,d;return void 0===a.ui.scrollableElement&&(d=b.ownerDocument.body,c=d.scrollTop,d.scrollTop=1,1===d.scrollTop?(d.scrollTop=c,a.ui.scrollableElement="body"):a.ui.scrollableElement="documentElement"),b.ownerDocument[a.ui.scrollableElement]},a.ui.Element["static"].getClosestScrollableContainer=function(a,b){var c,d,e=["overflow"],f=$(a).parent();for(("x"===b||"y"===b)&&e.push("overflow-"+b);f.length;){if(f[0]===this.getRootScrollableElement(a))return f[0];for(c=e.length;c--;)if(d=f.css(e[c]),"auto"===d||"scroll"===d)return f[0];f=f.parent()}return this.getDocument(a).body},a.ui.Element["static"].scrollIntoView=function(a,b){b=b||{};var c,d={},e="function"==typeof b.complete&&b.complete,f=this.getClosestScrollableContainer(a,b.direction),g=$(f),h=this.getDimensions(a),i=this.getDimensions(f),j=$(this.getWindow(a));c=g.is("html, body")?{top:h.rect.top,bottom:j.innerHeight()-h.rect.bottom,left:h.rect.left,right:j.innerWidth()-h.rect.right}:{top:h.rect.top-(i.rect.top+i.borders.top),bottom:i.rect.bottom-i.borders.bottom-i.scrollbar.bottom-h.rect.bottom,left:h.rect.left-(i.rect.left+i.borders.left),right:i.rect.right-i.borders.right-i.scrollbar.right-h.rect.right},b.direction&&"y"!==b.direction||(c.top<0?d.scrollTop=i.scroll.top+c.top:c.top>0&&c.bottom<0&&(d.scrollTop=i.scroll.top+Math.min(c.top,-c.bottom))),b.direction&&"x"!==b.direction||(c.left<0?d.scrollLeft=i.scroll.left+c.left:c.left>0&&c.right<0&&(d.scrollLeft=i.scroll.left+Math.min(c.left,-c.right))),$.isEmptyObject(d)?e&&e():(g.stop(!0).animate(d,b.duration||"fast"),e&&g.queue(function(a){e(),a()}))},a.ui.Element["static"].reconsiderScrollbars=function(a){for(var b,c,d=[];a.firstChild;)d.push(a.firstChild),a.removeChild(a.firstChild);for(void a.offsetHeight,b=0,c=d.length;c>b;b++)a.appendChild(d[b])},a.ui.Element.prototype.toggle=function(a){return a=void 0===a?!this.visible:!!a,a!==this.isVisible()&&(this.visible=a,this.$element.toggleClass("oo-ui-element-hidden",!this.visible),this.emit("toggle",a)),this},a.ui.Element.prototype.isVisible=function(){return this.visible},a.ui.Element.prototype.getData=function(){return this.data},a.ui.Element.prototype.setData=function(a){return this.data=a,this},a.ui.Element.prototype.supports=function(a){var b,c,d=0;for(a=Array.isArray(a)?a:[a],b=0,c=a.length;c>b;b++)$.isFunction(this[a[b]])&&d++;return a.length===d},a.ui.Element.prototype.updateThemeClasses=function(){this.updateThemeClassesPending||(this.updateThemeClassesPending=!0,setTimeout(this.debouncedUpdateThemeClassesHandler))},a.ui.Element.prototype.debouncedUpdateThemeClasses=function(){a.ui.theme.updateElementClasses(this),this.updateThemeClassesPending=!1},a.ui.Element.prototype.getTagName=function(){return this.constructor["static"].tagName},a.ui.Element.prototype.isElementAttached=function(){return $.contains(this.getElementDocument(),this.$element[0])},a.ui.Element.prototype.getElementDocument=function(){return a.ui.Element["static"].getDocument(this.$element)},a.ui.Element.prototype.getElementWindow=function(){return a.ui.Element["static"].getWindow(this.$element)},a.ui.Element.prototype.getClosestScrollableElementContainer=function(){return a.ui.Element["static"].getClosestScrollableContainer(this.$element[0])},a.ui.Element.prototype.getElementGroup=function(){return this.elementGroup},a.ui.Element.prototype.setElementGroup=function(a){return this.elementGroup=a,this},a.ui.Element.prototype.scrollElementIntoView=function(b){return a.ui.Element["static"].scrollIntoView(this.$element[0],b)},a.ui.Layout=function(b){b=b||{},a.ui.Layout["super"].call(this,b),a.EventEmitter.call(this),this.$element.addClass("oo-ui-layout")},a.inheritClass(a.ui.Layout,a.ui.Element),a.mixinClass(a.ui.Layout,a.EventEmitter),a.ui.Widget=function(b){b=$.extend({disabled:!1},b),a.ui.Widget["super"].call(this,b),a.EventEmitter.call(this),this.disabled=null,this.wasDisabled=null,this.$element.addClass("oo-ui-widget"),this.setDisabled(!!b.disabled)},a.inheritClass(a.ui.Widget,a.ui.Element),a.mixinClass(a.ui.Widget,a.EventEmitter),a.ui.Widget.prototype.isDisabled=function(){return this.disabled},a.ui.Widget.prototype.setDisabled=function(a){var b;return this.disabled=!!a,b=this.isDisabled(),b!==this.wasDisabled&&(this.$element.toggleClass("oo-ui-widget-disabled",b),this.$element.toggleClass("oo-ui-widget-enabled",!b),this.$element.attr("aria-disabled",b.toString()),this.emit("disable",b),this.updateThemeClasses()),this.wasDisabled=b,this},a.ui.Widget.prototype.updateDisabled=function(){return this.setDisabled(this.disabled),this},a.ui.Window=function(b){b=b||{},a.ui.Window["super"].call(this,b),a.EventEmitter.call(this),this.manager=null,this.size=b.size||this.constructor["static"].size,this.$frame=$("