(function($,Drupal,Bootstrap,Attributes){if(!Drupal.icon)Drupal.icon={bundles:{}};if(!Drupal.theme.icon||Drupal.theme.prototype.icon)$.extend(Drupal.theme,{icon:function(bundle,icon,attributes){if(!Drupal.icon.bundles[bundle])return'';attributes=Attributes.create(attributes).addClass('icon').set('aria-hidden','true');icon=Drupal.icon.bundles[bundle](icon,attributes);return''}});Drupal.icon.bundles.bootstrap=function(icon,attributes){attributes.addClass(['glyphicon','glyphicon-'+icon])};$.extend(Drupal.theme,{ajaxThrobber:function(){return Drupal.theme('bootstrapIcon','refresh',{'class':['ajax-throbber','glyphicon-spin']})},button:function(attributes){attributes=Attributes.create(attributes).addClass('btn');var context=attributes.get('context','default'),label=attributes.get('value','');attributes.remove('context').remove('value');if(!attributes.hasClass(['btn-default','btn-primary','btn-success','btn-info','btn-warning','btn-danger','btn-link']))attributes.addClass('btn-'+Bootstrap.checkPlain(context));if(!attributes.exists('type'))attributes.set('type',attributes.hasClass('form-submit')?'submit':'button');return''+label+''},btn:function(attributes){return Drupal.theme('button',attributes)},'btn-block':function(attributes){return Drupal.theme('button',Attributes.create(attributes).addClass('btn-block'))},'btn-lg':function(attributes){return Drupal.theme('button',Attributes.create(attributes).addClass('btn-lg'))},'btn-sm':function(attributes){return Drupal.theme('button',Attributes.create(attributes).addClass('btn-sm'))},'btn-xs':function(attributes){return Drupal.theme('button',Attributes.create(attributes).addClass('btn-xs'))},bootstrapIcon:function(name,attributes){return Drupal.theme('icon','bootstrap',name,attributes)}})})(window.jQuery,window.Drupal,window.Drupal.bootstrap,window.Attributes); (function($,Drupal){Drupal.theme.progressBar=function(id){return'
 
 
'};Drupal.ProgressBar=function(id,updateCallback,method,errorCallback){this.id=id;this.method=method||'GET';this.updateCallback=updateCallback;this.errorCallback=errorCallback;this.element=$(Drupal.theme('progressBar',id))};$.extend(Drupal.ProgressBar.prototype,{setProgress:function setProgress(percentage,message,label){if(percentage>=0&&percentage<=100){$(this.element).find('div.progress__bar').css('width',percentage+'%');$(this.element).find('div.progress__percentage').html(percentage+'%')};$('div.progress__description',this.element).html(message);$('div.progress__label',this.element).html(label);if(this.updateCallback)this.updateCallback(percentage,message,this)},startMonitoring:function startMonitoring(uri,delay){this.delay=delay;this.uri=uri;this.sendPing()},stopMonitoring:function stopMonitoring(){clearTimeout(this.timer);this.uri=null},sendPing:function sendPing(){if(this.timer)clearTimeout(this.timer);if(this.uri){var pb=this,uri=this.uri;if(uri.indexOf('?')===-1){uri+='?'}else uri+='&';uri+='_format=json';$.ajax({type:this.method,url:uri,data:'',dataType:'json',success:function success(progress){if(progress.status===0){pb.displayError(progress.data);return};pb.setProgress(progress.percentage,progress.message,progress.label);pb.timer=setTimeout(function(){pb.sendPing()},pb.delay)},error:function error(xmlhttp){var e=new Drupal.AjaxError(xmlhttp,pb.uri);pb.displayError('
'+e.message+'
')}})}},displayError:function displayError(string){var error=$('
').html(string);$(this.element).before(error).hide();if(this.errorCallback)this.errorCallback(this)}})})(jQuery,Drupal); (function($,Drupal){'use strict';Drupal.theme.progressBar=function(id){return'
'};$.extend(Drupal.ProgressBar.prototype,{setProgress:function(percentage,message,label){if(percentage>=0&&percentage<=100){$(this.element).find('.progress-bar').css('width',percentage+'%').attr('aria-valuenow',percentage);$(this.element).find('.percentage').html(percentage+'%')};if(message){message=message.replace(/ |\s*$/,'');$('.message',this.element).html(message)};if(label)$('.progress-label',this.element).html(label);if(this.updateCallback)this.updateCallback(percentage,message,this)},displayError:function(string){var error=$('

'+Drupal.t('Error message')+'

').append(string);$(this.element).before(error).hide();if(this.errorCallback)this.errorCallback(this)}})})(jQuery,Drupal); (function(Drupal){Drupal.behaviors.responsiveImageAJAX={attach:function attach(){if(window.picturefill)window.picturefill()}}})(Drupal); function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i])*>/gi,'');responseText=responseText.replace(/[\n]+\s+/g,'\n');var readyStateText=xmlhttp.status===0?'\n'+Drupal.t('ReadyState: !readyState',{'!readyState':xmlhttp.readyState}):'';customMessage=customMessage?'\n'+Drupal.t('CustomMessage: !customMessage',{'!customMessage':customMessage}):'';this.message=statusCode+pathText+statusText+customMessage+responseText+readyStateText;this.name='AjaxError'};Drupal.AjaxError.prototype=new Error();Drupal.AjaxError.prototype.constructor=Drupal.AjaxError;Drupal.ajax=function(settings){if(arguments.length!==1)throw new Error('Drupal.ajax() function must be called with one configuration object only');var base=settings.base||false,element=settings.element||false;delete settings.base;delete settings.element;if(!settings.progress&&!element)settings.progress=false;var ajax=new Drupal.Ajax(base,element,settings);ajax.instanceIndex=Drupal.ajax.instances.length;Drupal.ajax.instances.push(ajax);return ajax};Drupal.ajax.instances=[];Drupal.ajax.expired=function(){return Drupal.ajax.instances.filter(function(instance){return instance&&instance.element!==false&&!document.body.contains(instance.element)})};Drupal.ajax.bindAjaxLinks=function(element){$(element).find('.use-ajax').once('ajax').each(function(i,ajaxLink){var $linkElement=$(ajaxLink),elementSettings={progress:{type:'throbber'},dialogType:$linkElement.data('dialog-type'),dialog:$linkElement.data('dialog-options'),dialogRenderer:$linkElement.data('dialog-renderer'),base:$linkElement.attr('id'),element:ajaxLink},href=$linkElement.attr('href');if(href){elementSettings.url=href;elementSettings.event='click'};Drupal.ajax(elementSettings)})};Drupal.Ajax=function(base,element,elementSettings){var defaults={event:element?'mousedown':null,keypress:true,selector:base?'#'+base:null,effect:'none',speed:'none',method:'replaceWith',progress:{type:'throbber',message:Drupal.t('Please wait...')},submit:{js:true}};$.extend(this,defaults,elementSettings);this.commands=new Drupal.AjaxCommands();this.instanceIndex=false;if(this.wrapper)this.wrapper='#'+this.wrapper;this.element=element;this.element_settings=elementSettings;this.elementSettings=elementSettings;if(this.element&&this.element.form)this.$form=$(this.element.form);if(!this.url){var $element=$(this.element);if($element.is('a')){this.url=$element.attr('href')}else if(this.element&&element.form)this.url=this.$form.attr('action')};var originalUrl=this.url;this.url=this.url.replace(/\/nojs(\/|$|\?|#)/,'/ajax$1');if(drupalSettings.ajaxTrustedUrl[originalUrl])drupalSettings.ajaxTrustedUrl[this.url]=true;var ajax=this;ajax.options={url:ajax.url,data:ajax.submit,beforeSerialize:function beforeSerialize(elementSettings,options){return ajax.beforeSerialize(elementSettings,options)},beforeSubmit:function beforeSubmit(formValues,elementSettings,options){ajax.ajaxing=true;return ajax.beforeSubmit(formValues,elementSettings,options)},beforeSend:function beforeSend(xmlhttprequest,options){ajax.ajaxing=true;return ajax.beforeSend(xmlhttprequest,options)},success:function success(response,status,xmlhttprequest){if(typeof response==='string')response=$.parseJSON(response);if(response!==null&&!drupalSettings.ajaxTrustedUrl[ajax.url])if(xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token')!=='1'){var customMessage=Drupal.t('The response failed verification so will not be processed.');return ajax.error(xmlhttprequest,ajax.url,customMessage)};return ajax.success(response,status)},complete:function complete(xmlhttprequest,status){ajax.ajaxing=false;if(status==='error'||status==='parsererror')return ajax.error(xmlhttprequest,ajax.url)},dataType:'json',type:'POST'};if(elementSettings.dialog)ajax.options.data.dialogOptions=elementSettings.dialog;if(ajax.options.url.indexOf('?')===-1){ajax.options.url+='?'}else ajax.options.url+='&';var wrapper='drupal_'+(elementSettings.dialogType||'ajax');if(elementSettings.dialogRenderer)wrapper+='.'+elementSettings.dialogRenderer;ajax.options.url+=Drupal.ajax.WRAPPER_FORMAT+'='+wrapper;$(ajax.element).on(elementSettings.event,function(event){if(!drupalSettings.ajaxTrustedUrl[ajax.url]&&!Drupal.url.isLocal(ajax.url))throw new Error(Drupal.t('The callback URL is not local and not trusted: !url',{'!url':ajax.url}));return ajax.eventResponse(this,event)});if(elementSettings.keypress)$(ajax.element).on('keypress',function(event){return ajax.keypressResponse(this,event)});if(elementSettings.prevent)$(ajax.element).on(elementSettings.prevent,false)};Drupal.ajax.WRAPPER_FORMAT='_wrapper_format';Drupal.Ajax.AJAX_REQUEST_PARAMETER='_drupal_ajax';Drupal.Ajax.prototype.execute=function(){if(this.ajaxing)return;try{this.beforeSerialize(this.element,this.options);return $.ajax(this.options)}catch(e){this.ajaxing=false;window.alert('An error occurred while attempting to process '+this.options.url+': '+e.message);return $.Deferred().reject()}};Drupal.Ajax.prototype.keypressResponse=function(element,event){var ajax=this;if(event.which===13||event.which===32&&element.type!=='text'&&element.type!=='textarea'&&element.type!=='tel'&&element.type!=='number'){event.preventDefault();event.stopPropagation();$(element).trigger(ajax.elementSettings.event)}};Drupal.Ajax.prototype.eventResponse=function(element,event){event.preventDefault();event.stopPropagation();var ajax=this;if(ajax.ajaxing)return;try{if(ajax.$form){if(ajax.setClick)element.form.clk=element;ajax.$form.ajaxSubmit(ajax.options)}else{ajax.beforeSerialize(ajax.element,ajax.options);$.ajax(ajax.options)}}catch(e){ajax.ajaxing=false;window.alert('An error occurred while attempting to process '+ajax.options.url+': '+e.message)}};Drupal.Ajax.prototype.beforeSerialize=function(element,options){if(this.$form&&document.body.contains(this.$form.get(0))){var settings=this.settings||drupalSettings;Drupal.detachBehaviors(this.$form.get(0),settings,'serialize')};options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER]=1;var pageState=drupalSettings.ajaxPageState;options.data['ajax_page_state[theme]']=pageState.theme;options.data['ajax_page_state[theme_token]']=pageState.theme_token;options.data['ajax_page_state[libraries]']=pageState.libraries};Drupal.Ajax.prototype.beforeSubmit=function(formValues,element,options){};Drupal.Ajax.prototype.beforeSend=function(xmlhttprequest,options){if(this.$form){options.extraData=options.extraData||{};options.extraData.ajax_iframe_upload='1';var v=$.fieldValue(this.element);if(v!==null)options.extraData[this.element.name]=v};$(this.element).prop('disabled',true);if(!this.progress||!this.progress.type)return;var progressIndicatorMethod='setProgressIndicator'+this.progress.type.slice(0,1).toUpperCase()+this.progress.type.slice(1).toLowerCase();if(progressIndicatorMethod in this&&typeof this[progressIndicatorMethod]==='function')this[progressIndicatorMethod].call(this)};Drupal.theme.ajaxProgressThrobber=function(message){var messageMarkup=typeof message==='string'?Drupal.theme('ajaxProgressMessage',message):'',throbber='
 
';return'
'+throbber+messageMarkup+'
'};Drupal.theme.ajaxProgressIndicatorFullscreen=function(){return'
 
'};Drupal.theme.ajaxProgressMessage=function(message){return'
'+message+'
'};Drupal.theme.ajaxProgressBar=function($element){return $('
').append($element)};Drupal.Ajax.prototype.setProgressIndicatorBar=function(){var progressBar=new Drupal.ProgressBar('ajax-progress-'+this.element.id,$.noop,this.progress.method,$.noop);if(this.progress.message)progressBar.setProgress(-1,this.progress.message);if(this.progress.url)progressBar.startMonitoring(this.progress.url,this.progress.interval||1500);this.progress.element=$(Drupal.theme('ajaxProgressBar',progressBar.element));this.progress.object=progressBar;$(this.element).after(this.progress.element)};Drupal.Ajax.prototype.setProgressIndicatorThrobber=function(){this.progress.element=$(Drupal.theme('ajaxProgressThrobber',this.progress.message));$(this.element).after(this.progress.element)};Drupal.Ajax.prototype.setProgressIndicatorFullscreen=function(){this.progress.element=$(Drupal.theme('ajaxProgressIndicatorFullscreen'));$('body').append(this.progress.element)};Drupal.Ajax.prototype.success=function(response,status){var _this=this;if(this.progress.element)$(this.progress.element).remove();if(this.progress.object)this.progress.object.stopMonitoring();$(this.element).prop('disabled',false);var elementParents=$(this.element).parents('[data-drupal-selector]').addBack().toArray(),focusChanged=false;Object.keys(response||{}).forEach(function(i){if(response[i].command&&_this.commands[response[i].command]){_this.commands[response[i].command](_this,response[i],status);if(response[i].command==='invoke'&&response[i].method==='focus')focusChanged=true}});if(!focusChanged&&this.element&&!$(this.element).data('disable-refocus')){var target=false;for(var n=elementParents.length-1;!target&&n>=0;n--)target=document.querySelector('[data-drupal-selector="'+elementParents[n].getAttribute('data-drupal-selector')+'"]');if(target)$(target).trigger('focus')};if(this.$form&&document.body.contains(this.$form.get(0))){var settings=this.settings||drupalSettings;Drupal.attachBehaviors(this.$form.get(0),settings)};this.settings=null};Drupal.Ajax.prototype.getEffect=function(response){var type=response.effect||this.effect,speed=response.speed||this.speed,effect={};if(type==='none'){effect.showEffect='show';effect.hideEffect='hide';effect.showSpeed=''}else if(type==='fade'){effect.showEffect='fadeIn';effect.hideEffect='fadeOut';effect.showSpeed=speed}else{effect.showEffect=type+'Toggle';effect.hideEffect=type+'Toggle';effect.showSpeed=speed};return effect};Drupal.Ajax.prototype.error=function(xmlhttprequest,uri,customMessage){if(this.progress.element)$(this.progress.element).remove();if(this.progress.object)this.progress.object.stopMonitoring();$(this.wrapper).show();$(this.element).prop('disabled',false);if(this.$form&&document.body.contains(this.$form.get(0))){var settings=this.settings||drupalSettings;Drupal.attachBehaviors(this.$form.get(0),settings)};throw new Drupal.AjaxError(xmlhttprequest,uri,customMessage)};Drupal.theme.ajaxWrapperNewContent=function($newContent,ajax,response){return(response.effect||ajax.effect)!=='none'&&$newContent.filter(function(i){return!($newContent[i].nodeName==='#comment'||$newContent[i].nodeName==='#text'&&/^(\s|\n|\r)*$/.test($newContent[i].textContent))}).length>1?Drupal.theme('ajaxWrapperMultipleRootElements',$newContent):$newContent};Drupal.theme.ajaxWrapperMultipleRootElements=function($elements){return $('
').append($elements)};Drupal.AjaxCommands=function(){};Drupal.AjaxCommands.prototype={insert:function insert(ajax,response){var $wrapper=response.selector?$(response.selector):$(ajax.wrapper),method=response.method||ajax.method,effect=ajax.getEffect(response),settings=response.settings||ajax.settings||drupalSettings,$newContent=$($.parseHTML(response.data,document,true));$newContent=Drupal.theme('ajaxWrapperNewContent',$newContent,ajax,response);switch(method){case'html':case'replaceWith':case'replaceAll':case'empty':case'remove':Drupal.detachBehaviors($wrapper.get(0),settings);break;default:break};$wrapper[method]($newContent);if(effect.showEffect!=='show')$newContent.hide();var $ajaxNewContent=$newContent.find('.ajax-new-content');if($ajaxNewContent.length){$ajaxNewContent.hide();$newContent.show();$ajaxNewContent[effect.showEffect](effect.showSpeed)}else if(effect.showEffect!=='show')$newContent[effect.showEffect](effect.showSpeed);if($newContent.parents('html').length)$newContent.each(function(index,element){if(element.nodeType===Node.ELEMENT_NODE)Drupal.attachBehaviors(element,settings)})},remove:function remove(ajax,response,status){var settings=response.settings||ajax.settings||drupalSettings;$(response.selector).each(function(){Drupal.detachBehaviors(this,settings)}).remove()},changed:function changed(ajax,response,status){var $element=$(response.selector);if(!$element.hasClass('ajax-changed')){$element.addClass('ajax-changed');if(response.asterisk)$element.find(response.asterisk).append(' * ')}},alert:function alert(ajax,response,status){window.alert(response.text,response.title)},announce:function announce(ajax,response){if(response.priority){Drupal.announce(response.text,response.priority)}else Drupal.announce(response.text)},redirect:function redirect(ajax,response,status){window.location=response.url},css:function css(ajax,response,status){$(response.selector).css(response.argument)},settings:function settings(ajax,response,status){var ajaxSettings=drupalSettings.ajax;if(ajaxSettings)Drupal.ajax.expired().forEach(function(instance){if(instance.selector){var selector=instance.selector.replace('#','');if(selector in ajaxSettings)delete ajaxSettings[selector]}});if(response.merge){$.extend(true,drupalSettings,response.settings)}else ajax.settings=response.settings},data:function data(ajax,response,status){$(response.selector).data(response.name,response.value)},invoke:function invoke(ajax,response,status){var $element=$(response.selector);$element[response.method].apply($element,_toConsumableArray(response.args))},restripe:function restripe(ajax,response,status){$(response.selector).find('> tbody > tr:visible, > tr:visible').removeClass('odd even').filter(':even').addClass('odd').end().filter(':odd').addClass('even')},update_build_id:function update_build_id(ajax,response,status){$('input[name="form_build_id"][value="'+response.old+'"]').val(response.new)},add_css:function add_css(ajax,response,status){$('head').prepend(response.data)},message:function message(ajax,response){var messages=new Drupal.Message(document.querySelector(response.messageWrapperQuerySelector));if(response.clearPrevious)messages.clear();messages.add(response.message,response.messageOptions)}}})(jQuery,window,Drupal,drupalSettings); (function($,window,Drupal,drupalSettings){Drupal.Ajax.prototype.findGlyphicon=function(element){return $(element).closest('.form-item').find('.ajax-progress.glyphicon')};Drupal.Ajax.prototype.glyphiconStart=function(element,message){var $glyphicon=this.findGlyphicon(element);if($glyphicon[0]){$glyphicon.addClass('glyphicon-spin');if($.fn.tooltip&&drupalSettings.bootstrap.tooltip_enabled){$glyphicon.removeAttr('data-toggle').removeAttr('data-original-title').removeAttr('title').tooltip('destroy');if(message)$glyphicon.attr('data-toggle','tooltip').attr('title',message).tooltip()};if(message)$glyphicon.parent().append('
'+message+'
')};return $glyphicon};Drupal.Ajax.prototype.glyphiconStop=function(element){var $glyphicon=this.findGlyphicon(element);if($glyphicon[0]){$glyphicon.removeClass('glyphicon-spin');if($.fn.tooltip&&drupalSettings.bootstrap.tooltip_enabled)$glyphicon.removeAttr('data-toggle').removeAttr('data-original-title').removeAttr('title').tooltip('destroy')}};Drupal.Ajax.prototype.setProgressIndicatorThrobber=function(){var $element=$(this.element),$glyphicon=this.glyphiconStart($element,this.progress.message);if($glyphicon[0]){this.progress.element=$glyphicon.parent();this.progress.glyphicon=true;return};if(!this.progress.element)this.progress.element=$(Drupal.theme('ajaxThrobber'));if(this.progress.message)this.progress.element.after('
'+this.progress.message+'
');if($element.is('input')){$element.after(this.progress.element)}else $element.append(this.progress.element)};Drupal.Ajax.prototype.success=function(response,status){if(this.progress.element){if(this.progress.glyphicon){this.glyphiconStop(this.progress.element)}else this.progress.element.remove();this.progress.element.parent().find('.message').remove()};if(this.progress.object)this.progress.object.stopMonitoring();$(this.element).prop('disabled',false);var elementParents=$(this.element).parents('[data-drupal-selector]').addBack().toArray(),focusChanged=false;for(var i in response)if(response.hasOwnProperty(i)&&response[i].command&&this.commands[response[i].command]){this.commands[response[i].command](this,response[i],status);if(response[i].command==='invoke'&&response[i].method==='focus')focusChanged=true};if(!focusChanged&&this.element&&!$(this.element).data('disable-refocus')){var target=false;for(var n=elementParents.length-1;!target&&n>0;n--)target=document.querySelector('[data-drupal-selector="'+elementParents[n].getAttribute('data-drupal-selector')+'"]');if(target)$(target).trigger('focus')};if(this.$form){var settings=this.settings||drupalSettings;Drupal.attachBehaviors(this.$form.get(0),settings)};this.settings=null}})(jQuery,this,Drupal,drupalSettings); /*! jQuery UI - v1.12.1 - 2017-03-31 * http://jqueryui.com * Copyright jQuery Foundation and other contributors; Licensed */ !function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){return function(){function b(a,b,c){return[parseFloat(a[0])*(l.test(a[0])?b/100:1),parseFloat(a[1])*(l.test(a[1])?c/100:1)]}function c(b,c){return parseInt(a.css(b,c),10)||0}function d(b){var c=b[0];return 9===c.nodeType?{width:b.width(),height:b.height(),offset:{top:0,left:0}}:a.isWindow(c)?{width:b.width(),height:b.height(),offset:{top:b.scrollTop(),left:b.scrollLeft()}}:c.preventDefault?{width:0,height:0,offset:{top:c.pageY,left:c.pageX}}:{width:b.outerWidth(),height:b.outerHeight(),offset:b.offset()}}var e,f=Math.max,g=Math.abs,h=/left|center|right/,i=/top|center|bottom/,j=/[\+\-]\d+(\.[\d]+)?%?/,k=/^\w+/,l=/%$/,m=a.fn.position;a.position={scrollbarWidth:function(){if(void 0!==e)return e;var b,c,d=a("
"),f=d.children()[0];return a("body").append(d),b=f.offsetWidth,d.css("overflow","scroll"),c=f.offsetWidth,b===c&&(c=d[0].clientWidth),d.remove(),e=b-c},getScrollInfo:function(b){var c=b.isWindow||b.isDocument?"":b.element.css("overflow-x"),d=b.isWindow||b.isDocument?"":b.element.css("overflow-y"),e="scroll"===c||"auto"===c&&b.width0?"right":"center",vertical:h<0?"top":d>0?"bottom":"middle"};nf(g(d),g(h))?l.important="horizontal":l.important="vertical",e.using.call(this,a,l)}),i.offset(a.extend(z,{using:h}))})},a.ui.position={fit:{left:function(a,b){var c,d=b.within,e=d.isWindow?d.scrollLeft:d.offset.left,g=d.width,h=a.left-b.collisionPosition.marginLeft,i=e-h,j=h+b.collisionWidth-g-e;b.collisionWidth>g?i>0&&j<=0?(c=a.left+i+b.collisionWidth-g-e,a.left+=i-c):j>0&&i<=0?a.left=e:i>j?a.left=e+g-b.collisionWidth:a.left=e:i>0?a.left+=i:j>0?a.left-=j:a.left=f(a.left-h,a.left)},top:function(a,b){var c,d=b.within,e=d.isWindow?d.scrollTop:d.offset.top,g=b.within.height,h=a.top-b.collisionPosition.marginTop,i=e-h,j=h+b.collisionHeight-g-e;b.collisionHeight>g?i>0&&j<=0?(c=a.top+i+b.collisionHeight-g-e,a.top+=i-c):j>0&&i<=0?a.top=e:i>j?a.top=e+g-b.collisionHeight:a.top=e:i>0?a.top+=i:j>0?a.top-=j:a.top=f(a.top-h,a.top)}},flip:{left:function(a,b){var c,d,e=b.within,f=e.offset.left+e.scrollLeft,h=e.width,i=e.isWindow?e.scrollLeft:e.offset.left,j=a.left-b.collisionPosition.marginLeft,k=j-i,l=j+b.collisionWidth-h-i,m="left"===b.my[0]?-b.elemWidth:"right"===b.my[0]?b.elemWidth:0,n="left"===b.at[0]?b.targetWidth:"right"===b.at[0]?-b.targetWidth:0,o=-2*b.offset[0];k<0?(c=a.left+m+n+o+b.collisionWidth-h-f,(c<0||c0&&(d=a.left-b.collisionPosition.marginLeft+m+n+o-i,(d>0||g(d)0&&(c=a.top-b.collisionPosition.marginTop+n+o+p-i,(c>0||g(c)",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(a){a.preventDefault()},"click .ui-menu-item":function(b){var c=a(b.target),d=a(a.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&c.not(".ui-state-disabled").length&&(this.select(b),b.isPropagationStopped()||(this.mouseHandled=!0),c.has(".ui-menu").length?this.expand(b):!this.element.is(":focus")&&d.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(b){if(!this.previousFilter){var c=a(b.target).closest(".ui-menu-item"),d=a(b.currentTarget);c[0]===d[0]&&(this._removeClass(d.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(b,d))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(a,b){var c=this.active||this.element.find(this.options.items).eq(0);b||this.focus(a,c)},blur:function(b){this._delay(function(){var c=!a.contains(this.element[0],a.ui.safeActiveElement(this.document[0]));c&&this.collapseAll(b)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(a){this._closeOnDocumentClick(a)&&this.collapseAll(a),this.mouseHandled=!1}})},_destroy:function(){var b=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),c=b.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),c.children().each(function(){var b=a(this);b.data("ui-menu-submenu-caret")&&b.remove()})},_keydown:function(b){var c,d,e,f,g=!0;switch(b.keyCode){case a.ui.keyCode.PAGE_UP:this.previousPage(b);break;case a.ui.keyCode.PAGE_DOWN:this.nextPage(b);break;case a.ui.keyCode.HOME:this._move("first","first",b);break;case a.ui.keyCode.END:this._move("last","last",b);break;case a.ui.keyCode.UP:this.previous(b);break;case a.ui.keyCode.DOWN:this.next(b);break;case a.ui.keyCode.LEFT:this.collapse(b);break;case a.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(b);break;case a.ui.keyCode.ENTER:case a.ui.keyCode.SPACE:this._activate(b);break;case a.ui.keyCode.ESCAPE:this.collapse(b);break;default:g=!1,d=this.previousFilter||"",f=!1,e=b.keyCode>=96&&b.keyCode<=105?(b.keyCode-96).toString():String.fromCharCode(b.keyCode),clearTimeout(this.filterTimer),e===d?f=!0:e=d+e,c=this._filterMenuItems(e),c=f&&c.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):c,c.length||(e=String.fromCharCode(b.keyCode),c=this._filterMenuItems(e)),c.length?(this.focus(b,c),this.previousFilter=e,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}g&&b.preventDefault()},_activate:function(a){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(a):this.select(a))},refresh:function(){var b,c,d,e,f,g=this,h=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),d=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var b=a(this),c=b.prev(),d=a("").data("ui-menu-submenu-caret",!0);g._addClass(d,"ui-menu-icon","ui-icon "+h),c.attr("aria-haspopup","true").prepend(d),b.attr("aria-labelledby",c.attr("id"))}),this._addClass(d,"ui-menu","ui-widget ui-widget-content ui-front"),b=i.add(this.element),c=b.find(this.options.items),c.not(".ui-menu-item").each(function(){var b=a(this);g._isDivider(b)&&g._addClass(b,"ui-menu-divider","ui-widget-content")}),e=c.not(".ui-menu-item, .ui-menu-divider"),f=e.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(e,"ui-menu-item")._addClass(f,"ui-menu-item-wrapper"),c.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!a.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(a,b){if("icons"===a){var c=this.element.find(".ui-menu-icon");this._removeClass(c,null,this.options.icons.submenu)._addClass(c,null,b.submenu)}this._super(a,b)},_setOptionDisabled:function(a){this._super(a),this.element.attr("aria-disabled",String(a)),this._toggleClass(null,"ui-state-disabled",!!a)},focus:function(a,b){var c,d,e;this.blur(a,a&&"focus"===a.type),this._scrollIntoView(b),this.active=b.first(),d=this.active.children(".ui-menu-item-wrapper"),this._addClass(d,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",d.attr("id")),e=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(e,null,"ui-state-active"),a&&"keydown"===a.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),c=b.children(".ui-menu"),c.length&&a&&/^mouse/.test(a.type)&&this._startOpening(c),this.activeMenu=b.parent(),this._trigger("focus",a,{item:b})},_scrollIntoView:function(b){var c,d,e,f,g,h;this._hasScroll()&&(c=parseFloat(a.css(this.activeMenu[0],"borderTopWidth"))||0,d=parseFloat(a.css(this.activeMenu[0],"paddingTop"))||0,e=b.offset().top-this.activeMenu.offset().top-c-d,f=this.activeMenu.scrollTop(),g=this.activeMenu.height(),h=b.outerHeight(),e<0?this.activeMenu.scrollTop(f+e):e+h>g&&this.activeMenu.scrollTop(f+e-g+h))},blur:function(a,b){b||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",a,{item:this.active}),this.active=null)},_startOpening:function(a){clearTimeout(this.timer),"true"===a.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(a)},this.delay))},_open:function(b){var c=a.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(b.parents(".ui-menu")).hide().attr("aria-hidden","true"),b.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(c)},collapseAll:function(b,c){clearTimeout(this.timer),this.timer=this._delay(function(){var d=c?this.element:a(b&&b.target).closest(this.element.find(".ui-menu"));d.length||(d=this.element),this._close(d),this.blur(b),this._removeClass(d.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=d},this.delay)},_close:function(a){a||(a=this.active?this.active.parent():this.element),a.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(b){return!a(b.target).closest(".ui-menu").length},_isDivider:function(a){return!/[^\-\u2014\u2013\s]/.test(a.text())},collapse:function(a){var b=this.active&&this.active.parent().closest(".ui-menu-item",this.element);b&&b.length&&(this._close(),this.focus(a,b))},expand:function(a){var b=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();b&&b.length&&(this._open(b.parent()),this._delay(function(){this.focus(a,b)}))},next:function(a){this._move("next","first",a)},previous:function(a){this._move("prev","last",a)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(a,b,c){var d;this.active&&(d="first"===a||"last"===a?this.active["first"===a?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[a+"All"](".ui-menu-item").eq(0)),d&&d.length&&this.active||(d=this.activeMenu.find(this.options.items)[b]()),this.focus(c,d)},nextPage:function(b){var c,d,e;return this.active?void(this.isLastItem()||(this._hasScroll()?(d=this.active.offset().top,e=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return c=a(this),c.offset().top-d-e<0}),this.focus(b,c)):this.focus(b,this.activeMenu.find(this.options.items)[this.active?"last":"first"]()))):void this.next(b)},previousPage:function(b){var c,d,e;return this.active?void(this.isFirstItem()||(this._hasScroll()?(d=this.active.offset().top,e=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return c=a(this),c.offset().top-d+e>0}),this.focus(b,c)):this.focus(b,this.activeMenu.find(this.options.items).first()))):void this.next(b)},_hasScroll:function(){return this.element.outerHeight()",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var b,c,d,e=this.element[0].nodeName.toLowerCase(),f="textarea"===e,g="input"===e;this.isMultiLine=f||!g&&this._isContentEditable(this.element),this.valueMethod=this.element[f||g?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(e){if(this.element.prop("readOnly"))return b=!0,d=!0,void(c=!0);b=!1,d=!1,c=!1;var f=a.ui.keyCode;switch(e.keyCode){case f.PAGE_UP:b=!0,this._move("previousPage",e);break;case f.PAGE_DOWN:b=!0,this._move("nextPage",e);break;case f.UP:b=!0,this._keyEvent("previous",e);break;case f.DOWN:b=!0,this._keyEvent("next",e);break;case f.ENTER:this.menu.active&&(b=!0,e.preventDefault(),this.menu.select(e));break;case f.TAB:this.menu.active&&this.menu.select(e);break;case f.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(e),e.preventDefault());break;default:c=!0,this._searchTimeout(e)}},keypress:function(d){if(b)return b=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||d.preventDefault());if(!c){var e=a.ui.keyCode;switch(d.keyCode){case e.PAGE_UP:this._move("previousPage",d);break;case e.PAGE_DOWN:this._move("nextPage",d);break;case e.UP:this._keyEvent("previous",d);break;case e.DOWN:this._keyEvent("next",d)}}},input:function(a){return d?(d=!1,void a.preventDefault()):void this._searchTimeout(a)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(a){return this.cancelBlur?void delete this.cancelBlur:(clearTimeout(this.searching),this.close(a),void this._change(a))}}),this._initSource(),this.menu=a("