jQuery.cookie=function(name, value, options){
if(typeof value!='undefined'){
options=options||{};
if(value===null){
value='';
options=$.extend({}, options);
options.expires=-1;
}
var expires='';
if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){
var date;
if(typeof options.expires=='number'){
date=new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
}else{
date=options.expires;
}
expires='; expires=' + date.toUTCString();
}
var path=options.path ? '; path=' + (options.path):'';
var domain=options.domain ? '; domain=' + (options.domain):'';
var secure=options.secure ? '; secure':'';
document.cookie=[name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
}else{
var cookieValue=null;
if(document.cookie&&document.cookie!=''){
var cookies=document.cookie.split(';');
for (var i=0; i < cookies.length; i++){
var cookie=jQuery.trim(cookies[i]);
if(cookie.substring(0, name.length + 1)==(name + '=')){
cookieValue=decodeURIComponent(cookie.substring(name.length + 1));
break;
}}
}
return cookieValue;
}};
jQuery.fn.fontresizermanager=function (){
var fontResizer_value=jQuery('#fontResizer_value').val();
var fontResizer_ownid=jQuery('#fontResizer_ownid').val();
var fontResizer_ownelement=jQuery('#fontResizer_ownelement').val();
var fontResizer_resizeSteps=jQuery('#fontResizer_resizeSteps').val();
var fontResizer_cookieTime=jQuery('#fontResizer_cookieTime').val();
var fontResizer_maxFontsize=jQuery('#fontResizer_maxFontsize').val();
var fontResizer_minFontsize=jQuery('#fontResizer_minFontsize').val();
var fontResizer_element=fontResizer_value;
if(fontResizer_value=="innerbody"){
fontResizer_element="div#innerbody";
}else if(fontResizer_value=="ownid"){
fontResizer_element="div#" + fontResizer_ownid;
}else if(fontResizer_value=="ownelement"){
fontResizer_element=fontResizer_ownelement;
}
var startFontSize=parseFloat(jQuery(fontResizer_element+"").css("font-size"));
var savedSize=jQuery.cookie('fontSize');
if(savedSize > 4){
jQuery(fontResizer_element).css("font-size", savedSize + "px");
}
jQuery('.fontResizer_add').css("cursor","pointer");
jQuery('.fontResizer_minus').css("cursor","pointer");
jQuery('.fontResizer_reset').css("cursor","pointer");
jQuery('.fontResizer_add').click(function(event){
event.preventDefault();
var newFontSize=parseFloat(jQuery(fontResizer_element+"").css("font-size"));
newFontSize=newFontSize+parseFloat(fontResizer_resizeSteps);
if(newFontSize <=fontResizer_maxFontsize||fontResizer_maxFontsize==0||fontResizer_maxFontsize==''){
jQuery(fontResizer_element+"").css("font-size",newFontSize+"px");
jQuery.cookie('fontSize', newFontSize, {expires: parseInt(fontResizer_cookieTime), path: '/'});
}});
jQuery('.fontResizer_minus').click(function(event){
event.preventDefault();
var newFontSize=parseFloat(jQuery(fontResizer_element+"").css("font-size"))
newFontSize=newFontSize-fontResizer_resizeSteps;
if(newFontSize >=fontResizer_minFontsize||fontResizer_minFontsize==0||fontResizer_minFontsize==''){
jQuery(""+fontResizer_element+"").css("font-size",newFontSize+"px");
jQuery.cookie('fontSize', newFontSize, {expires: parseInt(fontResizer_cookieTime), path: '/'});
}});
jQuery('.fontResizer_reset').click(function(event){
event.preventDefault();
jQuery(""+fontResizer_element+"").css("font-size",startFontSize);
jQuery.cookie('fontSize', startFontSize, {expires: parseInt(fontResizer_cookieTime), path: '/'});
});
jQuery('.fontResizer_minus, .fontResizer_reset, .fontResizer_add').keypress(function (e){
var key=e.which;
if(key==13){
$(this).click();
return false;
}});
};
jQuery(document).ready(function(){
jQuery(".fontResizer").fontresizermanager();
});
if(!jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(window.jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]');if(a.length){var b=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");"radio"===b.prop("type")&&a.find(".active").removeClass("active")}this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(window.jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b),f.trigger(d=a.Event("show.bs.dropdown")),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown"),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=a("[role=menu] li:not(.divider):visible a",f);if(h.length){var i=h.index(h.filter(":focus"));38==b.keyCode&&i>0&&i--,40==b.keyCode&&i<h.length-1&&i++,~i||(i=0),h.eq(i).focus()}}}};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("dropdown");d||c.data("dropdown",d=new f(this)),"string"==typeof b&&d[b].call(c)})},a.fn.dropdown.Constructor=f,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",e,f.prototype.toggle).on("keydown.bs.dropdown.data-api",e+", [role=menu]",f.prototype.keydown)}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.load(this.options.remote)};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show(),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)}))},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var d=a.support.transition&&c;if(this.$backdrop=a('<div class="modal-backdrop '+c+'" />').appendTo(document.body),this.$element.on("click.dismiss.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focus",i="hover"==g?"mouseleave":"blur";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show),void 0):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide),void 0):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this.tip();this.setContent(),this.options.animation&&c.addClass("fade");var d="function"==typeof this.options.placement?this.options.placement.call(this,c[0],this.$element[0]):this.options.placement,e=/\s?auto?\s?/i,f=e.test(d);f&&(d=d.replace(e,"")||"top"),c.detach().css({top:0,left:0,display:"block"}).addClass(d),this.options.container?c.appendTo(this.options.container):c.insertAfter(this.$element);var g=this.getPosition(),h=c[0].offsetWidth,i=c[0].offsetHeight;if(f){var j=this.$element.parent(),k=d,l=document.documentElement.scrollTop||document.body.scrollTop,m="body"==this.options.container?window.innerWidth:j.outerWidth(),n="body"==this.options.container?window.innerHeight:j.outerHeight(),o="body"==this.options.container?0:j.offset().left;d="bottom"==d&&g.top+g.height+i-l>n?"top":"top"==d&&g.top-l-i<0?"bottom":"right"==d&&g.right+h>m?"left":"left"==d&&g.left-h<o?"right":d,c.removeClass(k).addClass(d)}var p=this.getCalculatedOffset(d,g,h,i);this.applyPlacement(p,d),this.$element.trigger("shown.bs."+this.type)}},b.prototype.applyPlacement=function(a,b){var c,d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),a.top=a.top+g,a.left=a.left+h,d.offset(a).addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;if("top"==b&&j!=f&&(c=!0,a.top=a.top+f-j),/bottom|top/.test(b)){var k=0;a.left<0&&(k=-2*a.left,a.left=0,d.offset(a),i=d[0].offsetWidth,j=d[0].offsetHeight),this.replaceArrow(k-e+i,i,"left")}else this.replaceArrow(j-f,j,"top");c&&d.offset(a)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach()}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,b).emulateTransitionEnd(150):b(),this.$element.trigger("hidden.bs."+this.type),this)},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},"function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof c&&c;e||d.data("bs.tooltip",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(window.jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(window.jQuery);
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox"  aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><label class="search_label">gd<input class="select2-search__field" id="search_label" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></label></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","Ｂ":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","Ｃ":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","Ｄ":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","Ǳ":"DZ","Ǆ":"DZ","ǲ":"Dz","ǅ":"Dz","Ⓔ":"E","Ｅ":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","Ｆ":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","Ｇ":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","Ｈ":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","Ｉ":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","Ｊ":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","Ｋ":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","Ｌ":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","Ǉ":"LJ","ǈ":"Lj","Ⓜ":"M","Ｍ":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","Ｎ":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","Ǌ":"NJ","ǋ":"Nj","Ⓞ":"O","Ｏ":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","Ｐ":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Ｑ":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","Ｒ":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","Ｓ":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","Ｔ":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","Ｕ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","Ｖ":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");
if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b),d=g.$element.find("option").filter(function(){return a(this).val()===c.id});if(!d.length){var e=g.option(c);e.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([e])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null;
},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
if(!jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(window.jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]');if(a.length){var b=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");"radio"===b.prop("type")&&a.find(".active").removeClass("active")}this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(window.jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b),f.trigger(d=a.Event("show.bs.dropdown")),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown"),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=a("[role=menu] li:not(.divider):visible a",f);if(h.length){var i=h.index(h.filter(":focus"));38==b.keyCode&&i>0&&i--,40==b.keyCode&&i<h.length-1&&i++,~i||(i=0),h.eq(i).focus()}}}};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("dropdown");d||c.data("dropdown",d=new f(this)),"string"==typeof b&&d[b].call(c)})},a.fn.dropdown.Constructor=f,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",e,f.prototype.toggle).on("keydown.bs.dropdown.data-api",e+", [role=menu]",f.prototype.keydown)}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.load(this.options.remote)};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show(),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)}))},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var d=a.support.transition&&c;if(this.$backdrop=a('<div class="modal-backdrop '+c+'" />').appendTo(document.body),this.$element.on("click.dismiss.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focus",i="hover"==g?"mouseleave":"blur";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show),void 0):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide),void 0):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this.tip();this.setContent(),this.options.animation&&c.addClass("fade");var d="function"==typeof this.options.placement?this.options.placement.call(this,c[0],this.$element[0]):this.options.placement,e=/\s?auto?\s?/i,f=e.test(d);f&&(d=d.replace(e,"")||"top"),c.detach().css({top:0,left:0,display:"block"}).addClass(d),this.options.container?c.appendTo(this.options.container):c.insertAfter(this.$element);var g=this.getPosition(),h=c[0].offsetWidth,i=c[0].offsetHeight;if(f){var j=this.$element.parent(),k=d,l=document.documentElement.scrollTop||document.body.scrollTop,m="body"==this.options.container?window.innerWidth:j.outerWidth(),n="body"==this.options.container?window.innerHeight:j.outerHeight(),o="body"==this.options.container?0:j.offset().left;d="bottom"==d&&g.top+g.height+i-l>n?"top":"top"==d&&g.top-l-i<0?"bottom":"right"==d&&g.right+h>m?"left":"left"==d&&g.left-h<o?"right":d,c.removeClass(k).addClass(d)}var p=this.getCalculatedOffset(d,g,h,i);this.applyPlacement(p,d),this.$element.trigger("shown.bs."+this.type)}},b.prototype.applyPlacement=function(a,b){var c,d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),a.top=a.top+g,a.left=a.left+h,d.offset(a).addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;if("top"==b&&j!=f&&(c=!0,a.top=a.top+f-j),/bottom|top/.test(b)){var k=0;a.left<0&&(k=-2*a.left,a.left=0,d.offset(a),i=d[0].offsetWidth,j=d[0].offsetHeight),this.replaceArrow(k-e+i,i,"left")}else this.replaceArrow(j-f,j,"top");c&&d.offset(a)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach()}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,b).emulateTransitionEnd(150):b(),this.$element.trigger("hidden.bs."+this.type),this)},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},"function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof c&&c;e||d.data("bs.tooltip",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(window.jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(window.jQuery);
(function(h){"function"===typeof define&&define.amd?define(["jquery"],function(D){return h(D,window,document)}):"object"===typeof exports?module.exports=function(D,I){D||(D=window);I||(I="undefined"!==typeof window?require("jquery"):require("jquery")(D));return h(I,D,D.document)}:h(jQuery,window,document)})(function(h,D,I,k){function X(a){var b,c,d={};h.each(a,function(e){if((b=e.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" "))c=e.replace(b[0],b[2].toLowerCase()),
d[c]=e,"o"===b[1]&&X(a[e])});a._hungarianMap=d}function K(a,b,c){a._hungarianMap||X(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))"o"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),K(a[d],b[d],c)):b[d]=b[e]})}function Da(a){var b=m.defaults.oLanguage,c=a.sZeroRecords;!a.sEmptyTable&&(c&&"No data available in table"===b.sEmptyTable)&&E(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(c&&"Loading..."===b.sLoadingRecords)&&E(a,a,"sZeroRecords","sLoadingRecords");
a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&db(a)}function eb(a){A(a,"ordering","bSort");A(a,"orderMulti","bSortMulti");A(a,"orderClasses","bSortClasses");A(a,"orderCellsTop","bSortCellsTop");A(a,"order","aaSorting");A(a,"orderFixed","aaSortingFixed");A(a,"paging","bPaginate");A(a,"pagingType","sPaginationType");A(a,"pageLength","iDisplayLength");A(a,"searching","bFilter");"boolean"===typeof a.sScrollX&&(a.sScrollX=a.sScrollX?"100%":"");"boolean"===typeof a.scrollX&&(a.scrollX=
a.scrollX?"100%":"");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&K(m.models.oSearch,a[b])}function fb(a){A(a,"orderable","bSortable");A(a,"orderData","aDataSort");A(a,"orderSequence","asSorting");A(a,"orderDataType","sortDataType");var b=a.aDataSort;b&&!h.isArray(b)&&(a.aDataSort=[b])}function gb(a){if(!m.__browser){var b={};m.__browser=b;var c=h("<div/>").css({position:"fixed",top:0,left:0,height:1,width:1,overflow:"hidden"}).append(h("<div/>").css({position:"absolute",top:1,left:1,
width:100,overflow:"scroll"}).append(h("<div/>").css({width:"100%",height:10}))).appendTo("body"),d=c.children(),e=d.children();b.barWidth=d[0].offsetWidth-d[0].clientWidth;b.bScrollOversize=100===e[0].offsetWidth&&100!==d[0].clientWidth;b.bScrollbarLeft=1!==Math.round(e.offset().left);b.bBounding=c[0].getBoundingClientRect().width?!0:!1;c.remove()}h.extend(a.oBrowser,m.__browser);a.oScroll.iBarWidth=m.__browser.barWidth}function hb(a,b,c,d,e,f){var g,j=!1;c!==k&&(g=c,j=!0);for(;d!==e;)a.hasOwnProperty(d)&&
(g=j?b(g,a[d],d,a):a[d],j=!0,d+=f);return g}function Ea(a,b){var c=m.defaults.column,d=a.aoColumns.length,c=h.extend({},m.models.oColumn,c,{nTh:b?b:I.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=h.extend({},m.models.oSearch,c[d]);ja(a,d,h(b).data())}function ja(a,b,c){var b=a.aoColumns[b],d=a.oClasses,e=h(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=e.attr("width")||null;var f=
(e.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==k&&null!==c&&(fb(c),K(m.defaults.column,c),c.mDataProp!==k&&!c.mData&&(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),h.extend(b,c),E(b,c,"sWidth","sWidthOrig"),c.iDataSort!==k&&(b.aDataSort=[c.iDataSort]),E(b,c,"aDataSort"));var g=b.mData,j=Q(g),i=b.mRender?Q(b.mRender):null,c=function(a){return"string"===typeof a&&-1!==a.indexOf("@")};b._bAttrSrc=h.isPlainObject(g)&&
(c(g.sort)||c(g.type)||c(g.filter));b._setter=null;b.fnGetData=function(a,b,c){var d=j(a,b,k,c);return i&&b?i(d,b,a,c):d};b.fnSetData=function(a,b,c){return R(g)(a,b,c)};"number"!==typeof g&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==h.inArray("asc",b.asSorting);c=-1!==h.inArray("desc",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=d.sSortableNone,b.sSortingClassJUI=""):a&&!c?(b.sSortingClass=d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):
!a&&c?(b.sSortingClass=d.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI)}function Y(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;Fa(a);for(var c=0,d=b.length;c<d;c++)b[c].nTh.style.width=b[c].sWidth}b=a.oScroll;(""!==b.sY||""!==b.sX)&&ka(a);u(a,null,"column-sizing",[a])}function Z(a,b){var c=la(a,"bVisible");return"number"===typeof c[b]?c[b]:null}function $(a,b){var c=la(a,"bVisible"),c=h.inArray(b,c);return-1!==c?c:null}
function aa(a){var b=0;h.each(a.aoColumns,function(a,d){d.bVisible&&"none"!==h(d.nTh).css("display")&&b++});return b}function la(a,b){var c=[];h.map(a.aoColumns,function(a,e){a[b]&&c.push(e)});return c}function Ga(a){var b=a.aoColumns,c=a.aoData,d=m.ext.type.detect,e,f,g,j,i,h,l,q,t;e=0;for(f=b.length;e<f;e++)if(l=b[e],t=[],!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){g=0;for(j=d.length;g<j;g++){i=0;for(h=c.length;i<h;i++){t[i]===k&&(t[i]=B(a,i,e,"type"));q=d[g](t[i],a);if(!q&&
g!==d.length-1)break;if("html"===q)break}if(q){l.sType=q;break}}l.sType||(l.sType="string")}}function ib(a,b,c,d){var e,f,g,j,i,n,l=a.aoColumns;if(b)for(e=b.length-1;0<=e;e--){n=b[e];var q=n.targets!==k?n.targets:n.aTargets;h.isArray(q)||(q=[q]);f=0;for(g=q.length;f<g;f++)if("number"===typeof q[f]&&0<=q[f]){for(;l.length<=q[f];)Ea(a);d(q[f],n)}else if("number"===typeof q[f]&&0>q[f])d(l.length+q[f],n);else if("string"===typeof q[f]){j=0;for(i=l.length;j<i;j++)("_all"==q[f]||h(l[j].nTh).hasClass(q[f]))&&
d(j,n)}}if(c){e=0;for(a=c.length;e<a;e++)d(e,c[e])}}function N(a,b,c,d){var e=a.aoData.length,f=h.extend(!0,{},m.models.oRow,{src:c?"dom":"data",idx:e});f._aData=b;a.aoData.push(f);for(var g=a.aoColumns,j=0,i=g.length;j<i;j++)g[j].sType=null;a.aiDisplayMaster.push(e);b=a.rowIdFn(b);b!==k&&(a.aIds[b]=f);(c||!a.oFeatures.bDeferRender)&&Ha(a,e,c,d);return e}function ma(a,b){var c;b instanceof h||(b=h(b));return b.map(function(b,e){c=Ia(a,e);return N(a,c.data,e,c.cells)})}function B(a,b,c,d){var e=a.iDraw,
f=a.aoColumns[c],g=a.aoData[b]._aData,j=f.sDefaultContent,i=f.fnGetData(g,d,{settings:a,row:b,col:c});if(i===k)return a.iDrawError!=e&&null===j&&(L(a,0,"Requested unknown parameter "+("function"==typeof f.mData?"{function}":"'"+f.mData+"'")+" for row "+b+", column "+c,4),a.iDrawError=e),j;if((i===g||null===i)&&null!==j&&d!==k)i=j;else if("function"===typeof i)return i.call(g);return null===i&&"display"==d?"":i}function jb(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d,{settings:a,row:b,col:c})}
function Ja(a){return h.map(a.match(/(\\.|[^\.])+/g)||[""],function(a){return a.replace(/\\./g,".")})}function Q(a){if(h.isPlainObject(a)){var b={};h.each(a,function(a,c){c&&(b[a]=Q(c))});return function(a,c,f,g){var j=b[c]||b._;return j!==k?j(a,c,f,g):a}}if(null===a)return function(a){return a};if("function"===typeof a)return function(b,c,f,g){return a(b,c,f,g)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var c=function(a,b,f){var g,j;if(""!==f){j=Ja(f);
for(var i=0,n=j.length;i<n;i++){f=j[i].match(ba);g=j[i].match(U);if(f){j[i]=j[i].replace(ba,"");""!==j[i]&&(a=a[j[i]]);g=[];j.splice(0,i+1);j=j.join(".");if(h.isArray(a)){i=0;for(n=a.length;i<n;i++)g.push(c(a[i],b,j))}a=f[0].substring(1,f[0].length-1);a=""===a?g:g.join(a);break}else if(g){j[i]=j[i].replace(U,"");a=a[j[i]]();continue}if(null===a||a[j[i]]===k)return k;a=a[j[i]]}}return a};return function(b,e){return c(b,e,a)}}return function(b){return b[a]}}function R(a){if(h.isPlainObject(a))return R(a._);
if(null===a)return function(){};if("function"===typeof a)return function(b,d,e){a(b,"set",d,e)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var b=function(a,d,e){var e=Ja(e),f;f=e[e.length-1];for(var g,j,i=0,n=e.length-1;i<n;i++){g=e[i].match(ba);j=e[i].match(U);if(g){e[i]=e[i].replace(ba,"");a[e[i]]=[];f=e.slice();f.splice(0,i+1);g=f.join(".");if(h.isArray(d)){j=0;for(n=d.length;j<n;j++)f={},b(f,d[j],g),a[e[i]].push(f)}else a[e[i]]=d;return}j&&(e[i]=e[i].replace(U,
""),a=a[e[i]](d));if(null===a[e[i]]||a[e[i]]===k)a[e[i]]={};a=a[e[i]]}if(f.match(U))a[f.replace(U,"")](d);else a[f.replace(ba,"")]=d};return function(c,d){return b(c,d,a)}}return function(b,d){b[a]=d}}function Ka(a){return G(a.aoData,"_aData")}function na(a){a.aoData.length=0;a.aiDisplayMaster.length=0;a.aiDisplay.length=0;a.aIds={}}function oa(a,b,c){for(var d=-1,e=0,f=a.length;e<f;e++)a[e]==b?d=e:a[e]>b&&a[e]--; -1!=d&&c===k&&a.splice(d,1)}function ca(a,b,c,d){var e=a.aoData[b],f,g=function(c,d){for(;c.childNodes.length;)c.removeChild(c.firstChild);
c.innerHTML=B(a,b,d,"display")};if("dom"===c||(!c||"auto"===c)&&"dom"===e.src)e._aData=Ia(a,e,d,d===k?k:e._aData).data;else{var j=e.anCells;if(j)if(d!==k)g(j[d],d);else{c=0;for(f=j.length;c<f;c++)g(j[c],c)}}e._aSortData=null;e._aFilterData=null;g=a.aoColumns;if(d!==k)g[d].sType=null;else{c=0;for(f=g.length;c<f;c++)g[c].sType=null;La(a,e)}}function Ia(a,b,c,d){var e=[],f=b.firstChild,g,j,i=0,n,l=a.aoColumns,q=a._rowReadObject,d=d!==k?d:q?{}:[],t=function(a,b){if("string"===typeof a){var c=a.indexOf("@");
-1!==c&&(c=a.substring(c+1),R(a)(d,b.getAttribute(c)))}},S=function(a){if(c===k||c===i)j=l[i],n=h.trim(a.innerHTML),j&&j._bAttrSrc?(R(j.mData._)(d,n),t(j.mData.sort,a),t(j.mData.type,a),t(j.mData.filter,a)):q?(j._setter||(j._setter=R(j.mData)),j._setter(d,n)):d[i]=n;i++};if(f)for(;f;){g=f.nodeName.toUpperCase();if("TD"==g||"TH"==g)S(f),e.push(f);f=f.nextSibling}else{e=b.anCells;f=0;for(g=e.length;f<g;f++)S(e[f])}if(b=b.firstChild?b:b.nTr)(b=b.getAttribute("id"))&&R(a.rowId)(d,b);return{data:d,cells:e}}
function Ha(a,b,c,d){var e=a.aoData[b],f=e._aData,g=[],j,i,n,l,q;if(null===e.nTr){j=c||I.createElement("tr");e.nTr=j;e.anCells=g;j._DT_RowIndex=b;La(a,e);l=0;for(q=a.aoColumns.length;l<q;l++){n=a.aoColumns[l];i=c?d[l]:I.createElement(n.sCellType);i._DT_CellIndex={row:b,column:l};g.push(i);if((!c||n.mRender||n.mData!==l)&&(!h.isPlainObject(n.mData)||n.mData._!==l+".display"))i.innerHTML=B(a,b,l,"display");n.sClass&&(i.className+=" "+n.sClass);n.bVisible&&!c?j.appendChild(i):!n.bVisible&&c&&i.parentNode.removeChild(i);
n.fnCreatedCell&&n.fnCreatedCell.call(a.oInstance,i,B(a,b,l),f,b,l)}u(a,"aoRowCreatedCallback",null,[j,f,b])}e.nTr.setAttribute("role","row")}function La(a,b){var c=b.nTr,d=b._aData;if(c){var e=a.rowIdFn(d);e&&(c.id=e);d.DT_RowClass&&(e=d.DT_RowClass.split(" "),b.__rowc=b.__rowc?pa(b.__rowc.concat(e)):e,h(c).removeClass(b.__rowc.join(" ")).addClass(d.DT_RowClass));d.DT_RowAttr&&h(c).attr(d.DT_RowAttr);d.DT_RowData&&h(c).data(d.DT_RowData)}}function kb(a){var b,c,d,e,f,g=a.nTHead,j=a.nTFoot,i=0===h("th, td",g).length,n=a.oClasses,l=a.aoColumns;i&&(e=h("<tr/>").appendTo(g));b=0;for(c=l.length;b<c;b++)f=l[b],d=h(f.nTh).addClass(f.sClass),i&&d.appendTo(e),a.oFeatures.bSort&&(d.addClass(f.sSortingClass),!1!==f.bSortable&&(d.attr("tabindex",a.iTabIndex).attr("aria-controls",a.sTableId),Ma(a,f.nTh,b))),f.sTitle!=d[0].innerHTML&&d.html(f.sTitle),Na(a,"header")(a,d,f,n);i&&da(a.aoHeader,g);h(g).find(">tr").attr("role","row");h(g).find(">tr>th, >tr>td").addClass(n.sHeaderTH);h(j).find(">tr>th, >tr>td").addClass(n.sFooterTH);
if(null!==j){a=a.aoFooter[0];b=0;for(c=a.length;b<c;b++)f=l[b],f.nTf=a[b].cell,f.sClass&&h(f.nTf).addClass(f.sClass)}}function ea(a,b,c){var d,e,f,g=[],j=[],i=a.aoColumns.length,n;if(b){c===k&&(c=!1);d=0;for(e=b.length;d<e;d++){g[d]=b[d].slice();g[d].nTr=b[d].nTr;for(f=i-1;0<=f;f--)!a.aoColumns[f].bVisible&&!c&&g[d].splice(f,1);j.push([])}d=0;for(e=g.length;d<e;d++){if(a=g[d].nTr)for(;f=a.firstChild;)a.removeChild(f);f=0;for(b=g[d].length;f<b;f++)if(n=i=1,j[d][f]===k){a.appendChild(g[d][f].cell);
for(j[d][f]=1;g[d+i]!==k&&g[d][f].cell==g[d+i][f].cell;)j[d+i][f]=1,i++;for(;g[d][f+n]!==k&&g[d][f].cell==g[d][f+n].cell;){for(c=0;c<i;c++)j[d+c][f+n]=1;n++}h(g[d][f].cell).attr("rowspan",i).attr("colspan",n)}}}}function O(a){var b=u(a,"aoPreDrawCallback","preDraw",[a]);if(-1!==h.inArray(!1,b))C(a,!1);else{var b=[],c=0,d=a.asStripeClasses,e=d.length,f=a.oLanguage,g=a.iInitDisplayStart,j="ssp"==y(a),i=a.aiDisplay;a.bDrawing=!0;g!==k&&-1!==g&&(a._iDisplayStart=j?g:g>=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=
-1);var g=a._iDisplayStart,n=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,C(a,!1);else if(j){if(!a.bDestroying&&!lb(a))return}else a.iDraw++;if(0!==i.length){f=j?a.aoData.length:n;for(j=j?0:g;j<f;j++){var l=i[j],q=a.aoData[l];null===q.nTr&&Ha(a,l);l=q.nTr;if(0!==e){var t=d[c%e];q._sRowStripe!=t&&(h(l).removeClass(q._sRowStripe).addClass(t),q._sRowStripe=t)}u(a,"aoRowCallback",null,[l,q._aData,c,j]);b.push(l);c++}}else c=f.sZeroRecords,1==a.iDraw&&"ajax"==y(a)?c=f.sLoadingRecords:
f.sEmptyTable&&0===a.fnRecordsTotal()&&(c=f.sEmptyTable),b[0]=h("<tr/>",{"class":e?d[0]:""}).append(h("<td />",{valign:"top",colSpan:aa(a),"class":a.oClasses.sRowEmpty}).html(c))[0];u(a,"aoHeaderCallback","header",[h(a.nTHead).children("tr")[0],Ka(a),g,n,i]);u(a,"aoFooterCallback","footer",[h(a.nTFoot).children("tr")[0],Ka(a),g,n,i]);d=h(a.nTBody);d.children().detach();d.append(h(b));u(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1}}function T(a,b){var c=a.oFeatures,d=c.bFilter;
c.bSort&&mb(a);d?fa(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;O(a);a._drawHold=!1}function nb(a){var b=a.oClasses,c=h(a.nTable),c=h("<div/>").insertBefore(c),d=a.oFeatures,e=h("<div/>",{id:a.sTableId+"_wrapper","class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var f=a.sDom.split(""),g,j,i,n,l,q,t=0;t<f.length;t++){g=null;j=f[t];if("<"==j){i=h("<div/>")[0];
n=f[t+1];if("'"==n||'"'==n){l="";for(q=2;f[t+q]!=n;)l+=f[t+q],q++;"H"==l?l=b.sJUIHeader:"F"==l&&(l=b.sJUIFooter);-1!=l.indexOf(".")?(n=l.split("."),i.id=n[0].substr(1,n[0].length-1),i.className=n[1]):"#"==l.charAt(0)?i.id=l.substr(1,l.length-1):i.className=l;t+=q}e.append(i);e=h(i)}else if(">"==j)e=e.parent();else if("l"==j&&d.bPaginate&&d.bLengthChange)g=ob(a);else if("f"==j&&d.bFilter)g=pb(a);else if("r"==j&&d.bProcessing)g=qb(a);else if("t"==j)g=rb(a);else if("i"==j&&d.bInfo)g=sb(a);else if("p"==j&&d.bPaginate)g=tb(a);else if(0!==m.ext.feature.length){i=m.ext.feature;q=0;for(n=i.length;q<n;q++)if(j==i[q].cFeature){g=i[q].fnInit(a);break}}g&&(i=a.aanFeatures,i[j]||(i[j]=[]),i[j].push(g),e.append(g))}c.replaceWith(e);a.nHolding=null}function da(a,b){var c=h(b).children("tr"),d,e,f,g,j,i,n,l,q,t;a.splice(0,a.length);f=0;for(i=c.length;f<i;f++)a.push([]);f=0;for(i=c.length;f<i;f++){d=c[f];for(e=d.firstChild;e;){if("TD"==e.nodeName.toUpperCase()||"TH"==e.nodeName.toUpperCase()){l=1*e.getAttribute("colspan");
q=1*e.getAttribute("rowspan");l=!l||0===l||1===l?1:l;q=!q||0===q||1===q?1:q;g=0;for(j=a[f];j[g];)g++;n=g;t=1===l?!0:!1;for(j=0;j<l;j++)for(g=0;g<q;g++)a[f+g][n+j]={cell:e,unique:t},a[f+g].nTr=d}e=e.nextSibling}}}function qa(a,b,c){var d=[];c||(c=a.aoHeader,b&&(c=[],da(c,b)));for(var b=0,e=c.length;b<e;b++)for(var f=0,g=c[b].length;f<g;f++)if(c[b][f].unique&&(!d[f]||!a.bSortCellsTop))d[f]=c[b][f].cell;return d}function ra(a,b,c){u(a,"aoServerParams","serverParams",[b]);if(b&&h.isArray(b)){var d={},
e=/(.*?)\[\]$/;h.each(b,function(a,b){var c=b.name.match(e);c?(c=c[0],d[c]||(d[c]=[]),d[c].push(b.value)):d[b.name]=b.value});b=d}var f,g=a.ajax,j=a.oInstance,i=function(b){u(a,null,"xhr",[a,b,a.jqXHR]);c(b)};if(h.isPlainObject(g)&&g.data){f=g.data;var n=h.isFunction(f)?f(b,a):f,b=h.isFunction(f)&&n?n:h.extend(!0,b,n);delete g.data}n={data:b,success:function(b){var c=b.error||b.sError;c&&L(a,0,c);a.json=b;i(b)},dataType:"json",cache:!1,type:a.sServerMethod,error:function(b,c){var d=u(a,null,"xhr",
[a,null,a.jqXHR]);-1===h.inArray(!0,d)&&("parsererror"==c?L(a,0,"Invalid JSON response",1):4===b.readyState&&L(a,0,"Ajax error",7));C(a,!1)}};a.oAjaxData=b;u(a,null,"preXhr",[a,b]);a.fnServerData?a.fnServerData.call(j,a.sAjaxSource,h.map(b,function(a,b){return{name:b,value:a}}),i,a):a.sAjaxSource||"string"===typeof g?a.jqXHR=h.ajax(h.extend(n,{url:g||a.sAjaxSource})):h.isFunction(g)?a.jqXHR=g.call(j,b,i,a):(a.jqXHR=h.ajax(h.extend(n,g)),g.data=f)}function lb(a){return a.bAjaxDataGet?(a.iDraw++,C(a,
!0),ra(a,ub(a),function(b){vb(a,b)}),!1):!0}function ub(a){var b=a.aoColumns,c=b.length,d=a.oFeatures,e=a.oPreviousSearch,f=a.aoPreSearchCols,g,j=[],i,n,l,q=V(a);g=a._iDisplayStart;i=!1!==d.bPaginate?a._iDisplayLength:-1;var k=function(a,b){j.push({name:a,value:b})};k("sEcho",a.iDraw);k("iColumns",c);k("sColumns",G(b,"sName").join(","));k("iDisplayStart",g);k("iDisplayLength",i);var S={draw:a.iDraw,columns:[],order:[],start:g,length:i,search:{value:e.sSearch,regex:e.bRegex}};for(g=0;g<c;g++)n=b[g],
l=f[g],i="function"==typeof n.mData?"function":n.mData,S.columns.push({data:i,name:n.sName,searchable:n.bSearchable,orderable:n.bSortable,search:{value:l.sSearch,regex:l.bRegex}}),k("mDataProp_"+g,i),d.bFilter&&(k("sSearch_"+g,l.sSearch),k("bRegex_"+g,l.bRegex),k("bSearchable_"+g,n.bSearchable)),d.bSort&&k("bSortable_"+g,n.bSortable);d.bFilter&&(k("sSearch",e.sSearch),k("bRegex",e.bRegex));d.bSort&&(h.each(q,function(a,b){S.order.push({column:b.col,dir:b.dir});k("iSortCol_"+a,b.col);k("sSortDir_"+
a,b.dir)}),k("iSortingCols",q.length));b=m.ext.legacy.ajax;return null===b?a.sAjaxSource?j:S:b?j:S}function vb(a,b){var c=sa(a,b),d=b.sEcho!==k?b.sEcho:b.draw,e=b.iTotalRecords!==k?b.iTotalRecords:b.recordsTotal,f=b.iTotalDisplayRecords!==k?b.iTotalDisplayRecords:b.recordsFiltered;if(d){if(1*d<a.iDraw)return;a.iDraw=1*d}na(a);a._iRecordsTotal=parseInt(e,10);a._iRecordsDisplay=parseInt(f,10);d=0;for(e=c.length;d<e;d++)N(a,c[d]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;O(a);a._bInitComplete||
ta(a,b);a.bAjaxDataGet=!0;C(a,!1)}function sa(a,b){var c=h.isPlainObject(a.ajax)&&a.ajax.dataSrc!==k?a.ajax.dataSrc:a.sAjaxDataProp;return"data"===c?b.aaData||b[c]:""!==c?Q(c)(b):b}function pb(a){var b=a.oClasses,c=a.sTableId,d=a.oLanguage,e=a.oPreviousSearch,f=a.aanFeatures,g='<input type="search" class="'+b.sFilterInput+'"/>',j=d.sSearch,j=j.match(/_INPUT_/)?j.replace("_INPUT_",g):j+g,b=h("<div/>",{id:!f.f?c+"_filter":null,"class":b.sFilter}).append(h("<label/>").append(j)),f=function(){var b=!this.value?
"":this.value;b!=e.sSearch&&(fa(a,{sSearch:b,bRegex:e.bRegex,bSmart:e.bSmart,bCaseInsensitive:e.bCaseInsensitive}),a._iDisplayStart=0,O(a))},g=null!==a.searchDelay?a.searchDelay:"ssp"===y(a)?400:0,i=h("input",b).val(e.sSearch).attr("placeholder",d.sSearchPlaceholder).bind("keyup.DT search.DT input.DT paste.DT cut.DT",g?Oa(f,g):f).bind("keypress.DT",function(a){if(13==a.keyCode)return!1}).attr("aria-controls",c);h(a.nTable).on("search.dt.DT",function(b,c){if(a===c)try{i[0]!==I.activeElement&&i.val(e.sSearch)}catch(d){}});
return b[0]}function fa(a,b,c){var d=a.oPreviousSearch,e=a.aoPreSearchCols,f=function(a){d.sSearch=a.sSearch;d.bRegex=a.bRegex;d.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive};Ga(a);if("ssp"!=y(a)){wb(a,b.sSearch,c,b.bEscapeRegex!==k?!b.bEscapeRegex:b.bRegex,b.bSmart,b.bCaseInsensitive);f(b);for(b=0;b<e.length;b++)xb(a,e[b].sSearch,b,e[b].bEscapeRegex!==k?!e[b].bEscapeRegex:e[b].bRegex,e[b].bSmart,e[b].bCaseInsensitive);yb(a)}else f(b);a.bFiltered=!0;u(a,null,"search",[a])}function yb(a){for(var b=
m.ext.search,c=a.aiDisplay,d,e,f=0,g=b.length;f<g;f++){for(var j=[],i=0,n=c.length;i<n;i++)e=c[i],d=a.aoData[e],b[f](a,d._aFilterData,e,d._aData,i)&&j.push(e);c.length=0;h.merge(c,j)}}function xb(a,b,c,d,e,f){if(""!==b)for(var g=a.aiDisplay,d=Pa(b,d,e,f),e=g.length-1;0<=e;e--)b=a.aoData[g[e]]._aFilterData[c],d.test(b)||g.splice(e,1)}function wb(a,b,c,d,e,f){var d=Pa(b,d,e,f),e=a.oPreviousSearch.sSearch,f=a.aiDisplayMaster,g;0!==m.ext.search.length&&(c=!0);g=zb(a);if(0>=b.length)a.aiDisplay=f.slice();
else{if(g||c||e.length>b.length||0!==b.indexOf(e)||a.bSorted)a.aiDisplay=f.slice();b=a.aiDisplay;for(c=b.length-1;0<=c;c--)d.test(a.aoData[b[c]]._sFilterRow)||b.splice(c,1)}}function Pa(a,b,c,d){a=b?a:Qa(a);c&&(a="^(?=.*?"+h.map(a.match(/"[^"]+"|[^ ]+/g)||[""],function(a){if('"'===a.charAt(0))var b=a.match(/^"(.*)"$/),a=b?b[1]:a;return a.replace('"',"")}).join(")(?=.*?")+").*$");return RegExp(a,d?"i":"")}function zb(a){var b=a.aoColumns,c,d,e,f,g,j,i,h,l=m.ext.type.search;c=!1;d=0;for(f=a.aoData.length;d<
f;d++)if(h=a.aoData[d],!h._aFilterData){j=[];e=0;for(g=b.length;e<g;e++)c=b[e],c.bSearchable?(i=B(a,d,e,"filter"),l[c.sType]&&(i=l[c.sType](i)),null===i&&(i=""),"string"!==typeof i&&i.toString&&(i=i.toString())):i="",i.indexOf&&-1!==i.indexOf("&")&&(ua.innerHTML=i,i=Zb?ua.textContent:ua.innerText),i.replace&&(i=i.replace(/[\r\n]/g,"")),j.push(i);h._aFilterData=j;h._sFilterRow=j.join("  ");c=!0}return c}function Ab(a){return{search:a.sSearch,smart:a.bSmart,regex:a.bRegex,caseInsensitive:a.bCaseInsensitive}}
function Bb(a){return{sSearch:a.search,bSmart:a.smart,bRegex:a.regex,bCaseInsensitive:a.caseInsensitive}}function sb(a){var b=a.sTableId,c=a.aanFeatures.i,d=h("<div/>",{"class":a.oClasses.sInfo,id:!c?b+"_info":null});c||(a.aoDrawCallback.push({fn:Cb,sName:"information"}),d.attr("role","status").attr("aria-live","polite"),h(a.nTable).attr("aria-describedby",b+"_info"));return d[0]}function Cb(a){var b=a.aanFeatures.i;if(0!==b.length){var c=a.oLanguage,d=a._iDisplayStart+1,e=a.fnDisplayEnd(),f=a.fnRecordsTotal(),
g=a.fnRecordsDisplay(),j=g?c.sInfo:c.sInfoEmpty;g!==f&&(j+=" "+c.sInfoFiltered);j+=c.sInfoPostFix;j=Db(a,j);c=c.fnInfoCallback;null!==c&&(j=c.call(a.oInstance,a,d,e,f,g,j));h(b).html(j)}}function Db(a,b){var c=a.fnFormatNumber,d=a._iDisplayStart+1,e=a._iDisplayLength,f=a.fnRecordsDisplay(),g=-1===e;return b.replace(/_START_/g,c.call(a,d)).replace(/_END_/g,c.call(a,a.fnDisplayEnd())).replace(/_MAX_/g,c.call(a,a.fnRecordsTotal())).replace(/_TOTAL_/g,c.call(a,f)).replace(/_PAGE_/g,c.call(a,g?1:Math.ceil(d/
e))).replace(/_PAGES_/g,c.call(a,g?1:Math.ceil(f/e)))}function ga(a){var b,c,d=a.iInitDisplayStart,e=a.aoColumns,f;c=a.oFeatures;var g=a.bDeferLoading;if(a.bInitialised){nb(a);kb(a);ea(a,a.aoHeader);ea(a,a.aoFooter);C(a,!0);c.bAutoWidth&&Fa(a);b=0;for(c=e.length;b<c;b++)f=e[b],f.sWidth&&(f.nTh.style.width=x(f.sWidth));u(a,null,"preInit",[a]);T(a);e=y(a);if("ssp"!=e||g)"ajax"==e?ra(a,[],function(c){var f=sa(a,c);for(b=0;b<f.length;b++)N(a,f[b]);a.iInitDisplayStart=d;T(a);C(a,!1);ta(a,c)},a):(C(a,!1),
ta(a))}else setTimeout(function(){ga(a)},200)}function ta(a,b){a._bInitComplete=!0;(b||a.oInit.aaData)&&Y(a);u(a,null,"plugin-init",[a,b]);u(a,"aoInitComplete","init",[a,b])}function Ra(a,b){var c=parseInt(b,10);a._iDisplayLength=c;Sa(a);u(a,null,"length",[a,c])}function ob(a){for(var b=a.oClasses,c=a.sTableId,d=a.aLengthMenu,e=h.isArray(d[0]),f=e?d[0]:d,d=e?d[1]:d,e=h("<select/>",{name:c+"_length","aria-controls":c,"class":b.sLengthSelect}),g=0,j=f.length;g<j;g++)e[0][g]=new Option(d[g],f[g]);var i=
h("<div><label/></div>").addClass(b.sLength);a.aanFeatures.l||(i[0].id=c+"_length");i.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",e[0].outerHTML));h("select",i).val(a._iDisplayLength).bind("change.DT",function(){Ra(a,h(this).val());O(a)});h(a.nTable).bind("length.dt.DT",function(b,c,d){a===c&&h("select",i).val(d)});return i[0]}function tb(a){var b=a.sPaginationType,c=m.ext.pager[b],d="function"===typeof c,e=function(a){O(a)},b=h("<div/>").addClass(a.oClasses.sPaging+b)[0],f=a.aanFeatures;
d||c.fnInit(a,b,e);f.p||(b.id=a.sTableId+"_paginate",a.aoDrawCallback.push({fn:function(a){if(d){var b=a._iDisplayStart,i=a._iDisplayLength,h=a.fnRecordsDisplay(),l=-1===i,b=l?0:Math.ceil(b/i),i=l?1:Math.ceil(h/i),h=c(b,i),k,l=0;for(k=f.p.length;l<k;l++)Na(a,"pageButton")(a,f.p[l],l,h,b,i)}else c.fnUpdate(a,e)},sName:"pagination"}));return b}function Ta(a,b,c){var d=a._iDisplayStart,e=a._iDisplayLength,f=a.fnRecordsDisplay();0===f||-1===e?d=0:"number"===typeof b?(d=b*e,d>f&&(d=0)):"first"==b?d=0:
"previous"==b?(d=0<=e?d-e:0,0>d&&(d=0)):"next"==b?d+e<f&&(d+=e):"last"==b?d=Math.floor((f-1)/e)*e:L(a,0,"Unknown paging action: "+b,5);b=a._iDisplayStart!==d;a._iDisplayStart=d;b&&(u(a,null,"page",[a]),c&&O(a));return b}function qb(a){return h("<div/>",{id:!a.aanFeatures.r?a.sTableId+"_processing":null,"class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}function C(a,b){a.oFeatures.bProcessing&&h(a.aanFeatures.r).css("display",b?"block":"none");u(a,null,"processing",
[a,b])}function rb(a){var b=h(a.nTable);b.attr("role","grid");var c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var d=c.sX,e=c.sY,f=a.oClasses,g=b.children("caption"),j=g.length?g[0]._captionSide:null,i=h(b[0].cloneNode(!1)),n=h(b[0].cloneNode(!1)),l=b.children("tfoot");l.length||(l=null);i=h("<div/>",{"class":f.sScrollWrapper}).append(h("<div/>",{"class":f.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:d?!d?null:x(d):"100%"}).append(h("<div/>",{"class":f.sScrollHeadInner}).css({"box-sizing":"content-box",
width:c.sXInner||"100%"}).append(i.removeAttr("id").css("margin-left",0).append("top"===j?g:null).append(b.children("thead"))))).append(h("<div/>",{"class":f.sScrollBody}).css({position:"relative",overflow:"auto",width:!d?null:x(d)}).append(b));l&&i.append(h("<div/>",{"class":f.sScrollFoot}).css({overflow:"hidden",border:0,width:d?!d?null:x(d):"100%"}).append(h("<div/>",{"class":f.sScrollFootInner}).append(n.removeAttr("id").css("margin-left",0).append("bottom"===j?g:null).append(b.children("tfoot")))));
var b=i.children(),k=b[0],f=b[1],t=l?b[2]:null;if(d)h(f).on("scroll.DT",function(){var a=this.scrollLeft;k.scrollLeft=a;l&&(t.scrollLeft=a)});h(f).css(e&&c.bCollapse?"max-height":"height",e);a.nScrollHead=k;a.nScrollBody=f;a.nScrollFoot=t;a.aoDrawCallback.push({fn:ka,sName:"scrolling"});return i[0]}function ka(a){var b=a.oScroll,c=b.sX,d=b.sXInner,e=b.sY,b=b.iBarWidth,f=h(a.nScrollHead),g=f[0].style,j=f.children("div"),i=j[0].style,n=j.children("table"),j=a.nScrollBody,l=h(j),q=j.style,t=h(a.nScrollFoot).children("div"),
m=t.children("table"),o=h(a.nTHead),F=h(a.nTable),p=F[0],r=p.style,u=a.nTFoot?h(a.nTFoot):null,Eb=a.oBrowser,Ua=Eb.bScrollOversize,s=G(a.aoColumns,"nTh"),P,v,w,y,z=[],A=[],B=[],C=[],D,E=function(a){a=a.style;a.paddingTop="0";a.paddingBottom="0";a.borderTopWidth="0";a.borderBottomWidth="0";a.height=0};v=j.scrollHeight>j.clientHeight;if(a.scrollBarVis!==v&&a.scrollBarVis!==k)a.scrollBarVis=v,Y(a);else{a.scrollBarVis=v;F.children("thead, tfoot").remove();u&&(w=u.clone().prependTo(F),P=u.find("tr"),w=
w.find("tr"));y=o.clone().prependTo(F);o=o.find("tr");v=y.find("tr");y.find("th, td").removeAttr("tabindex");c||(q.width="100%",f[0].style.width="100%");h.each(qa(a,y),function(b,c){D=Z(a,b);c.style.width=a.aoColumns[D].sWidth});u&&J(function(a){a.style.width=""},w);f=F.outerWidth();if(""===c){r.width="100%";if(Ua&&(F.find("tbody").height()>j.offsetHeight||"scroll"==l.css("overflow-y")))r.width=x(F.outerWidth()-b);f=F.outerWidth()}else""!==d&&(r.width=x(d),f=F.outerWidth());J(E,v);J(function(a){B.push(a.innerHTML);
z.push(x(h(a).css("width")))},v);J(function(a,b){if(h.inArray(a,s)!==-1)a.style.width=z[b]},o);h(v).height(0);u&&(J(E,w),J(function(a){C.push(a.innerHTML);A.push(x(h(a).css("width")))},w),J(function(a,b){a.style.width=A[b]},P),h(w).height(0));J(function(a,b){a.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+B[b]+"</div>";a.style.width=z[b]},v);u&&J(function(a,b){a.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+C[b]+"</div>";a.style.width=
A[b]},w);if(F.outerWidth()<f){P=j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")?f+b:f;if(Ua&&(j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")))r.width=x(P-b);(""===c||""!==d)&&L(a,1,"Possible column misalignment",6)}else P="100%";q.width=x(P);g.width=x(P);u&&(a.nScrollFoot.style.width=x(P));!e&&Ua&&(q.height=x(p.offsetHeight+b));c=F.outerWidth();n[0].style.width=x(c);i.width=x(c);d=F.height()>j.clientHeight||"scroll"==l.css("overflow-y");e="padding"+(Eb.bScrollbarLeft?"Left":
"Right");i[e]=d?b+"px":"0px";u&&(m[0].style.width=x(c),t[0].style.width=x(c),t[0].style[e]=d?b+"px":"0px");F.children("colgroup").insertBefore(F.children("thead"));l.scroll();if((a.bSorted||a.bFiltered)&&!a._drawHold)j.scrollTop=0}}function J(a,b,c){for(var d=0,e=0,f=b.length,g,j;e<f;){g=b[e].firstChild;for(j=c?c[e].firstChild:null;g;)1===g.nodeType&&(c?a(g,j,d):a(g,d),d++),g=g.nextSibling,j=c?j.nextSibling:null;e++}}function Fa(a){var b=a.nTable,c=a.aoColumns,d=a.oScroll,e=d.sY,f=d.sX,g=d.sXInner,
j=c.length,i=la(a,"bVisible"),n=h("th",a.nTHead),l=b.getAttribute("width"),k=b.parentNode,t=!1,m,o,p=a.oBrowser,d=p.bScrollOversize;(m=b.style.width)&&-1!==m.indexOf("%")&&(l=m);for(m=0;m<i.length;m++)o=c[i[m]],null!==o.sWidth&&(o.sWidth=Fb(o.sWidthOrig,k),t=!0);if(d||!t&&!f&&!e&&j==aa(a)&&j==n.length)for(m=0;m<j;m++)i=Z(a,m),null!==i&&(c[i].sWidth=x(n.eq(m).width()));else{j=h(b).clone().css("visibility","hidden").removeAttr("id");j.find("tbody tr").remove();var r=h("<tr/>").appendTo(j.find("tbody"));
j.find("thead, tfoot").remove();j.append(h(a.nTHead).clone()).append(h(a.nTFoot).clone());j.find("tfoot th, tfoot td").css("width","");n=qa(a,j.find("thead")[0]);for(m=0;m<i.length;m++)o=c[i[m]],n[m].style.width=null!==o.sWidthOrig&&""!==o.sWidthOrig?x(o.sWidthOrig):"",o.sWidthOrig&&f&&h(n[m]).append(h("<div/>").css({width:o.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(a.aoData.length)for(m=0;m<i.length;m++)t=i[m],o=c[t],h(Gb(a,t)).clone(!1).append(o.sContentPadding).appendTo(r);h("[name]",
j).removeAttr("name");o=h("<div/>").css(f||e?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(j).appendTo(k);f&&g?j.width(g):f?(j.css("width","auto"),j.removeAttr("width"),j.width()<k.clientWidth&&l&&j.width(k.clientWidth)):e?j.width(k.clientWidth):l&&j.width(l);for(m=e=0;m<i.length;m++)k=h(n[m]),g=k.outerWidth()-k.width(),k=p.bBounding?Math.ceil(n[m].getBoundingClientRect().width):k.outerWidth(),e+=k,c[i[m]].sWidth=x(k-g);b.style.width=x(e);o.remove()}l&&(b.style.width=
x(l));if((l||f)&&!a._reszEvt)b=function(){h(D).bind("resize.DT-"+a.sInstance,Oa(function(){Y(a)}))},d?setTimeout(b,1E3):b(),a._reszEvt=!0}function Fb(a,b){if(!a)return 0;var c=h("<div/>").css("width",x(a)).appendTo(b||I.body),d=c[0].offsetWidth;c.remove();return d}function Gb(a,b){var c=Hb(a,b);if(0>c)return null;var d=a.aoData[c];return!d.nTr?h("<td/>").html(B(a,c,b,"display"))[0]:d.anCells[b]}function Hb(a,b){for(var c,d=-1,e=-1,f=0,g=a.aoData.length;f<g;f++)c=B(a,f,b,"display")+"",c=c.replace($b,
""),c=c.replace(/&nbsp;/g," "),c.length>d&&(d=c.length,e=f);return e}function x(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function V(a){var b,c,d=[],e=a.aoColumns,f,g,j,i;b=a.aaSortingFixed;c=h.isPlainObject(b);var n=[];f=function(a){a.length&&!h.isArray(a[0])?n.push(a):h.merge(n,a)};h.isArray(b)&&f(b);c&&b.pre&&f(b.pre);f(a.aaSorting);c&&b.post&&f(b.post);for(a=0;a<n.length;a++){i=n[a][0];f=e[i].aDataSort;b=0;for(c=f.length;b<c;b++)g=f[b],j=e[g].sType||
"string",n[a]._idx===k&&(n[a]._idx=h.inArray(n[a][1],e[g].asSorting)),d.push({src:i,col:g,dir:n[a][1],index:n[a]._idx,type:j,formatter:m.ext.type.order[j+"-pre"]})}return d}function mb(a){var b,c,d=[],e=m.ext.type.order,f=a.aoData,g=0,j,i=a.aiDisplayMaster,h;Ga(a);h=V(a);b=0;for(c=h.length;b<c;b++)j=h[b],j.formatter&&g++,Ib(a,j.col);if("ssp"!=y(a)&&0!==h.length){b=0;for(c=i.length;b<c;b++)d[i[b]]=b;g===h.length?i.sort(function(a,b){var c,e,g,j,i=h.length,k=f[a]._aSortData,m=f[b]._aSortData;for(g=
0;g<i;g++)if(j=h[g],c=k[j.col],e=m[j.col],c=c<e?-1:c>e?1:0,0!==c)return"asc"===j.dir?c:-c;c=d[a];e=d[b];return c<e?-1:c>e?1:0}):i.sort(function(a,b){var c,g,j,i,k=h.length,m=f[a]._aSortData,p=f[b]._aSortData;for(j=0;j<k;j++)if(i=h[j],c=m[i.col],g=p[i.col],i=e[i.type+"-"+i.dir]||e["string-"+i.dir],c=i(c,g),0!==c)return c;c=d[a];g=d[b];return c<g?-1:c>g?1:0})}a.bSorted=!0}function Jb(a){for(var b,c,d=a.aoColumns,e=V(a),a=a.oLanguage.oAria,f=0,g=d.length;f<g;f++){c=d[f];var j=c.asSorting;b=c.sTitle.replace(/<.*?>/g,
"");var i=c.nTh;i.removeAttribute("aria-sort");c.bSortable&&(0<e.length&&e[0].col==f?(i.setAttribute("aria-sort","asc"==e[0].dir?"ascending":"descending"),c=j[e[0].index+1]||j[0]):c=j[0],b+="asc"===c?a.sSortAscending:a.sSortDescending);i.setAttribute("aria-label",b)}}function Va(a,b,c,d){var e=a.aaSorting,f=a.aoColumns[b].asSorting,g=function(a,b){var c=a._idx;c===k&&(c=h.inArray(a[1],f));return c+1<f.length?c+1:b?null:0};"number"===typeof e[0]&&(e=a.aaSorting=[e]);c&&a.oFeatures.bSortMulti?(c=h.inArray(b,
G(e,"0")),-1!==c?(b=g(e[c],!0),null===b&&1===e.length&&(b=0),null===b?e.splice(c,1):(e[c][1]=f[b],e[c]._idx=b)):(e.push([b,f[0],0]),e[e.length-1]._idx=0)):e.length&&e[0][0]==b?(b=g(e[0]),e.length=1,e[0][1]=f[b],e[0]._idx=b):(e.length=0,e.push([b,f[0]]),e[0]._idx=0);T(a);"function"==typeof d&&d(a)}function Ma(a,b,c,d){var e=a.aoColumns[c];Wa(b,{},function(b){!1!==e.bSortable&&(a.oFeatures.bProcessing?(C(a,!0),setTimeout(function(){Va(a,c,b.shiftKey,d);"ssp"!==y(a)&&C(a,!1)},0)):Va(a,c,b.shiftKey,d))})}
function va(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,d=V(a),e=a.oFeatures,f,g;if(e.bSort&&e.bSortClasses){e=0;for(f=b.length;e<f;e++)g=b[e].src,h(G(a.aoData,"anCells",g)).removeClass(c+(2>e?e+1:3));e=0;for(f=d.length;e<f;e++)g=d[e].src,h(G(a.aoData,"anCells",g)).addClass(c+(2>e?e+1:3))}a.aLastSort=d}function Ib(a,b){var c=a.aoColumns[b],d=m.ext.order[c.sSortDataType],e;d&&(e=d.call(a.oInstance,a,b,$(a,b)));for(var f,g=m.ext.type.order[c.sType+"-pre"],j=0,i=a.aoData.length;j<i;j++)if(c=a.aoData[j],
c._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function wa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:Ab(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:Ab(a.aoPreSearchCols[d])}})};u(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,
b)}}function Kb(a){var b,c,d=a.aoColumns;if(a.oFeatures.bStateSave){var e=a.fnStateLoadCallback.call(a.oInstance,a);if(e&&e.time&&(b=u(a,"aoStateLoadParams","stateLoadParams",[a,e]),-1===h.inArray(!1,b)&&(b=a.iStateDuration,!(0<b&&e.time<+new Date-1E3*b)&&d.length===e.columns.length))){a.oLoadedState=h.extend(!0,{},e);e.start!==k&&(a._iDisplayStart=e.start,a.iInitDisplayStart=e.start);e.length!==k&&(a._iDisplayLength=e.length);e.order!==k&&(a.aaSorting=[],h.each(e.order,function(b,c){a.aaSorting.push(c[0]>=
d.length?[0,c[1]]:c)}));e.search!==k&&h.extend(a.oPreviousSearch,Bb(e.search));b=0;for(c=e.columns.length;b<c;b++){var f=e.columns[b];f.visible!==k&&(d[b].bVisible=f.visible);f.search!==k&&h.extend(a.aoPreSearchCols[b],Bb(f.search))}u(a,"aoStateLoaded","stateLoaded",[a,e])}}}function xa(a){var b=m.settings,a=h.inArray(a,G(b,"nTable"));return-1!==a?b[a]:null}function L(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+" - ":"")+c;d&&(c+=". For more information about this error, please see http://datatables.net/tn/"+
d);if(b)D.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,a&&u(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function E(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?E(a,b,d[0],d[1]):E(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Lb(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==e&&h.isArray(d)?d.slice():d);return a}function Wa(a,b,c){h(a).bind("click.DT",b,function(b){a.blur();c(b)}).bind("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).bind("selectstart.DT",function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function u(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+".dt"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Sa(a){var b=a._iDisplayStart,
c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Na(a,b){var c=a.renderer,d=m.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ya(a,b){var c=[],c=Mb.numbers_length,d=Math.floor(c/2);b<=c?c=W(0,b):a<=d?(c=W(0,c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=W(b-(c-2),b):(c=W(a-d+2,a+d-1),c.push("ellipsis"),
c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function db(a){h.each({num:function(b){return za(b,a)},"num-fmt":function(b){return za(b,a,Xa)},"html-num":function(b){return za(b,a,Aa)},"html-num-fmt":function(b){return za(b,a,Aa,Xa)}},function(b,c){v.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(v.type.search[b+a]=v.type.search.html)})}function Nb(a){return function(){var b=[xa(this[m.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return m.ext.internal[a].apply(this,
b)}}var m=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,b).data()};this.api=function(a){return a?new r(xa(this[v.iApiIndex])):new r(this)};this.fnAddData=function(a,b){var c=this.api(!0),d=h.isArray(a)&&(h.isArray(a[0])||h.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===k||b)&&c.draw();return d.flatten().toArray()};this.fnAdjustColumnSizing=function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],d=c.oScroll;a===k||a?b.draw(!1):
(""!==d.sX||""!==d.sY)&&ka(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===k||a)&&b.draw()};this.fnClose=function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,b,c){var d=this.api(!0),a=d.rows(a),e=a.settings()[0],h=e.aoData[a[0][0]];a.remove();b&&b.call(this,e,h);(c===k||c)&&d.draw();return h};this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(a)};this.fnFilter=function(a,b,c,d,e,h){e=this.api(!0);null===b||b===k?e.search(a,
c,d,h):e.column(b).search(a,c,d,h);e.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==k){var d=a.nodeName?a.nodeName.toLowerCase():"";return b!==k||"td"==d||"th"==d?c.cell(a,b).data():c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==k?b.row(a).node():b.rows().nodes().flatten().toArray()};this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase();return"TR"==c?b.row(a).index():"TD"==c||"TH"==c?(a=b.cell(a).index(),
[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};this.fnPageChange=function(a,b){var c=this.api(!0).page(a);(b===k||b)&&c.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===k||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return xa(this[v.iApiIndex])};this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=
function(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,d,e){var h=this.api(!0);c===k||null===c?h.row(b).data(a):h.cell(b,c).data(a);(e===k||e)&&h.columns.adjust();(d===k||d)&&h.draw();return 0};this.fnVersionCheck=v.fnVersionCheck;var b=this,c=a===k,d=this.length;c&&(a={});this.oApi=this.internal=v.internal;for(var e in m.ext.internal)e&&(this[e]=Nb(e));this.each(function(){var e={},e=1<d?Lb(e,a,!0):a,g=0,j,i=this.getAttribute("id"),n=!1,l=m.defaults,q=h(this);if("table"!=this.nodeName.toLowerCase())L(null,0,"Non-table node initialisation ("+this.nodeName+")",2);else{eb(l);fb(l.column);K(l,l,!0);K(l.column,l.column,!0);K(l,h.extend(e,q.data()));var t=m.settings,g=0;for(j=t.length;g<j;g++){var p=t[g];if(p.nTable==this||p.nTHead.parentNode==this||p.nTFoot&&p.nTFoot.parentNode==this){g=e.bRetrieve!==k?e.bRetrieve:l.bRetrieve;if(c||g)return p.oInstance;if(e.bDestroy!==k?e.bDestroy:l.bDestroy){p.oInstance.fnDestroy();break}else{L(p,0,"Cannot reinitialise DataTable",3);
return}}if(p.sTableId==this.id){t.splice(g,1);break}}if(null===i||""===i)this.id=i="DataTables_Table_"+m.ext._unique++;var o=h.extend(!0,{},m.models.oSettings,{sDestroyWidth:q[0].style.width,sInstance:i,sTableId:i});o.nTable=this;o.oApi=b.internal;o.oInit=e;t.push(o);o.oInstance=1===b.length?b:q.dataTable();eb(e);e.oLanguage&&Da(e.oLanguage);e.aLengthMenu&&!e.iDisplayLength&&(e.iDisplayLength=h.isArray(e.aLengthMenu[0])?e.aLengthMenu[0][0]:e.aLengthMenu[0]);e=Lb(h.extend(!0,{},l),e);E(o.oFeatures,
e,"bPaginate bLengthChange bFilter bSort bSortMulti bInfo bProcessing bAutoWidth bSortClasses bServerSide bDeferRender".split(" "));E(o,e,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer","searchDelay","rowId",["iCookieDuration","iStateDuration"],["oSearch","oPreviousSearch"],["aoSearchCols",
"aoPreSearchCols"],["iDisplayLength","_iDisplayLength"],["bJQueryUI","bJUI"]]);E(o.oScroll,e,[["sScrollX","sX"],["sScrollXInner","sXInner"],["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);E(o.oLanguage,e,"fnInfoCallback");z(o,"aoDrawCallback",e.fnDrawCallback,"user");z(o,"aoServerParams",e.fnServerParams,"user");z(o,"aoStateSaveParams",e.fnStateSaveParams,"user");z(o,"aoStateLoadParams",e.fnStateLoadParams,"user");z(o,"aoStateLoaded",e.fnStateLoaded,"user");z(o,"aoRowCallback",e.fnRowCallback,
"user");z(o,"aoRowCreatedCallback",e.fnCreatedRow,"user");z(o,"aoHeaderCallback",e.fnHeaderCallback,"user");z(o,"aoFooterCallback",e.fnFooterCallback,"user");z(o,"aoInitComplete",e.fnInitComplete,"user");z(o,"aoPreDrawCallback",e.fnPreDrawCallback,"user");o.rowIdFn=Q(e.rowId);gb(o);i=o.oClasses;e.bJQueryUI?(h.extend(i,m.ext.oJUIClasses,e.oClasses),e.sDom===l.sDom&&"lfrtip"===l.sDom&&(o.sDom='<"H"lfr>t<"F"ip>'),o.renderer)?h.isPlainObject(o.renderer)&&!o.renderer.header&&(o.renderer.header="jqueryui"):
o.renderer="jqueryui":h.extend(i,m.ext.classes,e.oClasses);q.addClass(i.sTable);o.iInitDisplayStart===k&&(o.iInitDisplayStart=e.iDisplayStart,o._iDisplayStart=e.iDisplayStart);null!==e.iDeferLoading&&(o.bDeferLoading=!0,g=h.isArray(e.iDeferLoading),o._iRecordsDisplay=g?e.iDeferLoading[0]:e.iDeferLoading,o._iRecordsTotal=g?e.iDeferLoading[1]:e.iDeferLoading);var r=o.oLanguage;h.extend(!0,r,e.oLanguage);""!==r.sUrl&&(h.ajax({dataType:"json",url:r.sUrl,success:function(a){Da(a);K(l.oLanguage,a);h.extend(true,
r,a);ga(o)},error:function(){ga(o)}}),n=!0);null===e.asStripeClasses&&(o.asStripeClasses=[i.sStripeOdd,i.sStripeEven]);var g=o.asStripeClasses,v=q.children("tbody").find("tr").eq(0);-1!==h.inArray(!0,h.map(g,function(a){return v.hasClass(a)}))&&(h("tbody tr",this).removeClass(g.join(" ")),o.asDestroyStripes=g.slice());t=[];g=this.getElementsByTagName("thead");0!==g.length&&(da(o.aoHeader,g[0]),t=qa(o));if(null===e.aoColumns){p=[];g=0;for(j=t.length;g<j;g++)p.push(null)}else p=e.aoColumns;g=0;for(j=
p.length;g<j;g++)Ea(o,t?t[g]:null);ib(o,e.aoColumnDefs,p,function(a,b){ja(o,a,b)});if(v.length){var s=function(a,b){return a.getAttribute("data-"+b)!==null?b:null};h(v[0]).children("th, td").each(function(a,b){var c=o.aoColumns[a];if(c.mData===a){var d=s(b,"sort")||s(b,"order"),e=s(b,"filter")||s(b,"search");if(d!==null||e!==null){c.mData={_:a+".display",sort:d!==null?a+".@data-"+d:k,type:d!==null?a+".@data-"+d:k,filter:e!==null?a+".@data-"+e:k};ja(o,a)}}})}var w=o.oFeatures;e.bStateSave&&(w.bStateSave=
!0,Kb(o,e),z(o,"aoDrawCallback",wa,"state_save"));if(e.aaSorting===k){t=o.aaSorting;g=0;for(j=t.length;g<j;g++)t[g][1]=o.aoColumns[g].asSorting[0]}va(o);w.bSort&&z(o,"aoDrawCallback",function(){if(o.bSorted){var a=V(o),b={};h.each(a,function(a,c){b[c.src]=c.dir});u(o,null,"order",[o,a,b]);Jb(o)}});z(o,"aoDrawCallback",function(){(o.bSorted||y(o)==="ssp"||w.bDeferRender)&&va(o)},"sc");g=q.children("caption").each(function(){this._captionSide=q.css("caption-side")});j=q.children("thead");0===j.length&&
(j=h("<thead/>").appendTo(this));o.nTHead=j[0];j=q.children("tbody");0===j.length&&(j=h("<tbody/>").appendTo(this));o.nTBody=j[0];j=q.children("tfoot");if(0===j.length&&0<g.length&&(""!==o.oScroll.sX||""!==o.oScroll.sY))j=h("<tfoot/>").appendTo(this);0===j.length||0===j.children().length?q.addClass(i.sNoFooter):0<j.length&&(o.nTFoot=j[0],da(o.aoFooter,o.nTFoot));if(e.aaData)for(g=0;g<e.aaData.length;g++)N(o,e.aaData[g]);else(o.bDeferLoading||"dom"==y(o))&&ma(o,h(o.nTBody).children("tr"));o.aiDisplay=
o.aiDisplayMaster.slice();o.bInitialised=!0;!1===n&&ga(o)}});b=null;return this},v,r,p,s,Ya={},Ob=/[\r\n]/g,Aa=/<.*?>/g,ac=/^[\w\+\-]/,bc=/[\w\+\-]$/,cc=RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^|\\-)","g"),Xa=/[',$Â£â‚¬Â¥%\u2009\u202F\u20BD\u20a9\u20BArfk]/gi,M=function(a){return!a||!0===a||"-"===a?!0:!1},Pb=function(a){var b=parseInt(a,10);return!isNaN(b)&&isFinite(a)?b:null},Qb=function(a,b){Ya[b]||(Ya[b]=RegExp(Qa(b),"g"));return"string"===typeof a&&"."!==b?a.replace(/\./g,
"").replace(Ya[b],"."):a},Za=function(a,b,c){var d="string"===typeof a;if(M(a))return!0;b&&d&&(a=Qb(a,b));c&&d&&(a=a.replace(Xa,""));return!isNaN(parseFloat(a))&&isFinite(a)},Rb=function(a,b,c){return M(a)?!0:!(M(a)||"string"===typeof a)?null:Za(a.replace(Aa,""),b,c)?!0:null},G=function(a,b,c){var d=[],e=0,f=a.length;if(c!==k)for(;e<f;e++)a[e]&&a[e][b]&&d.push(a[e][b][c]);else for(;e<f;e++)a[e]&&d.push(a[e][b]);return d},ha=function(a,b,c,d){var e=[],f=0,g=b.length;if(d!==k)for(;f<g;f++)a[b[f]][c]&&
e.push(a[b[f]][c][d]);else for(;f<g;f++)e.push(a[b[f]][c]);return e},W=function(a,b){var c=[],d;b===k?(b=0,d=a):(d=b,b=a);for(var e=b;e<d;e++)c.push(e);return c},Sb=function(a){for(var b=[],c=0,d=a.length;c<d;c++)a[c]&&b.push(a[c]);return b},pa=function(a){var b=[],c,d,e=a.length,f,g=0;d=0;a:for(;d<e;d++){c=a[d];for(f=0;f<g;f++)if(b[f]===c)continue a;b.push(c);g++}return b};m.util={throttle:function(a,b){var c=b!==k?b:200,d,e;return function(){var b=this,g=+new Date,h=arguments;d&&g<d+c?(clearTimeout(e),
e=setTimeout(function(){d=k;a.apply(b,h)},c)):(d=g,a.apply(b,h))}},escapeRegex:function(a){return a.replace(cc,"\\$1")}};var A=function(a,b,c){a[b]!==k&&(a[c]=a[b])},ba=/\[.*?\]$/,U=/\(\)$/,Qa=m.util.escapeRegex,ua=h("<div>")[0],Zb=ua.textContent!==k,$b=/<.*?>/g,Oa=m.util.throttle,Tb=[],w=Array.prototype,dc=function(a){var b,c,d=m.settings,e=h.map(d,function(a){return a.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&"table"===a.nodeName.toLowerCase())return b=h.inArray(a,e),-1!==b?[d[b]]:
null;if(a&&"function"===typeof a.settings)return a.settings().toArray();"string"===typeof a?c=h(a):a instanceof h&&(c=a)}else return[];if(c)return c.map(function(){b=h.inArray(this,e);return-1!==b?d[b]:null}).toArray()};r=function(a,b){if(!(this instanceof r))return new r(a,b);var c=[],d=function(a){(a=dc(a))&&(c=c.concat(a))};if(h.isArray(a))for(var e=0,f=a.length;e<f;e++)d(a[e]);else d(a);this.context=pa(c);b&&h.merge(this,b);this.selector={rows:null,cols:null,opts:null};r.extend(this,this,Tb)};
m.Api=r;h.extend(r.prototype,{any:function(){return 0!==this.count()},concat:w.concat,context:[],count:function(){return this.flatten().length},each:function(a){for(var b=0,c=this.length;b<c;b++)a.call(this,this[b],b,this);return this},eq:function(a){var b=this.context;return b.length>a?new r(b[a],this[a]):null},filter:function(a){var b=[];if(w.filter)b=w.filter.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)a.call(this,this[c],c,this)&&b.push(this[c]);return new r(this.context,b)},flatten:function(){var a=
[];return new r(this.context,a.concat.apply(a,this.toArray()))},join:w.join,indexOf:w.indexOf||function(a,b){for(var c=b||0,d=this.length;c<d;c++)if(this[c]===a)return c;return-1},iterator:function(a,b,c,d){var e=[],f,g,h,i,n,l=this.context,m,t,p=this.selector;"string"===typeof a&&(d=c,c=b,b=a,a=!1);g=0;for(h=l.length;g<h;g++){var o=new r(l[g]);if("table"===b)f=c.call(o,l[g],g),f!==k&&e.push(f);else if("columns"===b||"rows"===b)f=c.call(o,l[g],this[g],g),f!==k&&e.push(f);else if("column"===b||"column-rows"===b||"row"===b||"cell"===b){t=this[g];"column-rows"===b&&(m=Ba(l[g],p.opts));i=0;for(n=t.length;i<n;i++)f=t[i],f="cell"===b?c.call(o,l[g],f.row,f.column,g,i):c.call(o,l[g],f,g,i,m),f!==k&&e.push(f)}}return e.length||d?(a=new r(l,a?e.concat.apply([],e):e),b=a.selector,b.rows=p.rows,b.cols=p.cols,b.opts=p.opts,a):this},lastIndexOf:w.lastIndexOf||function(a,b){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(a){var b=[];if(w.map)b=w.map.call(this,a,this);else for(var c=
0,d=this.length;c<d;c++)b.push(a.call(this,this[c],c));return new r(this.context,b)},pluck:function(a){return this.map(function(b){return b[a]})},pop:w.pop,push:w.push,reduce:w.reduce||function(a,b){return hb(this,a,b,0,this.length,1)},reduceRight:w.reduceRight||function(a,b){return hb(this,a,b,this.length-1,-1,-1)},reverse:w.reverse,selector:null,shift:w.shift,sort:w.sort,splice:w.splice,toArray:function(){return w.slice.call(this)},to$:function(){return h(this)},toJQuery:function(){return h(this)},
unique:function(){return new r(this.context,pa(this))},unshift:w.unshift});r.extend=function(a,b,c){if(c.length&&b&&(b instanceof r||b.__dt_wrapper)){var d,e,f,g=function(a,b,c){return function(){var d=b.apply(a,arguments);r.extend(d,d,c.methodExt);return d}};d=0;for(e=c.length;d<e;d++)f=c[d],b[f.name]="function"===typeof f.val?g(a,f.val,f):h.isPlainObject(f.val)?{}:f.val,b[f.name].__dt_wrapper=!0,r.extend(a,b[f.name],f.propExt)}};r.register=p=function(a,b){if(h.isArray(a))for(var c=0,d=a.length;c<
d;c++)r.register(a[c],b);else for(var e=a.split("."),f=Tb,g,j,c=0,d=e.length;c<d;c++){g=(j=-1!==e[c].indexOf("()"))?e[c].replace("()",""):e[c];var i;a:{i=0;for(var n=f.length;i<n;i++)if(f[i].name===g){i=f[i];break a}i=null}i||(i={name:g,val:{},methodExt:[],propExt:[]},f.push(i));c===d-1?i.val=b:f=j?i.methodExt:i.propExt}};r.registerPlural=s=function(a,b,c){r.register(a,c);r.register(b,function(){var a=c.apply(this,arguments);return a===this?this:a instanceof r?a.length?h.isArray(a[0])?new r(a.context,
a[0]):a[0]:k:a})};p("tables()",function(a){var b;if(a){b=r;var c=this.context;if("number"===typeof a)a=[c[a]];else var d=h.map(c,function(a){return a.nTable}),a=h(d).filter(a).map(function(){var a=h.inArray(this,d);return c[a]}).toArray();b=new b(a)}else b=this;return b});p("table()",function(a){var a=this.tables(a),b=a.context;return b.length?new r(b[0]):a});s("tables().nodes()","table().node()",function(){return this.iterator("table",function(a){return a.nTable},1)});s("tables().body()","table().body()",
function(){return this.iterator("table",function(a){return a.nTBody},1)});s("tables().header()","table().header()",function(){return this.iterator("table",function(a){return a.nTHead},1)});s("tables().footer()","table().footer()",function(){return this.iterator("table",function(a){return a.nTFoot},1)});s("tables().containers()","table().container()",function(){return this.iterator("table",function(a){return a.nTableWrapper},1)});p("draw()",function(a){return this.iterator("table",function(b){"page"===a?O(b):("string"===typeof a&&(a="full-hold"===a?!1:!0),T(b,!1===a))})});p("page()",function(a){return a===k?this.page.info().page:this.iterator("table",function(b){Ta(b,a)})});p("page.info()",function(){if(0===this.context.length)return k;var a=this.context[0],b=a._iDisplayStart,c=a.oFeatures.bPaginate?a._iDisplayLength:-1,d=a.fnRecordsDisplay(),e=-1===c;return{page:e?0:Math.floor(b/c),pages:e?1:Math.ceil(d/c),start:b,end:a.fnDisplayEnd(),length:c,recordsTotal:a.fnRecordsTotal(),recordsDisplay:d,
serverSide:"ssp"===y(a)}});p("page.len()",function(a){return a===k?0!==this.context.length?this.context[0]._iDisplayLength:k:this.iterator("table",function(b){Ra(b,a)})});var Ub=function(a,b,c){if(c){var d=new r(a);d.one("draw",function(){c(d.ajax.json())})}if("ssp"==y(a))T(a,b);else{C(a,!0);var e=a.jqXHR;e&&4!==e.readyState&&e.abort();ra(a,[],function(c){na(a);for(var c=sa(a,c),d=0,e=c.length;d<e;d++)N(a,c[d]);T(a,b);C(a,!1)})}};p("ajax.json()",function(){var a=this.context;if(0<a.length)return a[0].json});
p("ajax.params()",function(){var a=this.context;if(0<a.length)return a[0].oAjaxData});p("ajax.reload()",function(a,b){return this.iterator("table",function(c){Ub(c,!1===b,a)})});p("ajax.url()",function(a){var b=this.context;if(a===k){if(0===b.length)return k;b=b[0];return b.ajax?h.isPlainObject(b.ajax)?b.ajax.url:b.ajax:b.sAjaxSource}return this.iterator("table",function(b){h.isPlainObject(b.ajax)?b.ajax.url=a:b.ajax=a})});p("ajax.url().load()",function(a,b){return this.iterator("table",function(c){Ub(c,
!1===b,a)})});var $a=function(a,b,c,d,e){var f=[],g,j,i,n,l,m;i=typeof b;if(!b||"string"===i||"function"===i||b.length===k)b=[b];i=0;for(n=b.length;i<n;i++){j=b[i]&&b[i].split?b[i].split(","):[b[i]];l=0;for(m=j.length;l<m;l++)(g=c("string"===typeof j[l]?h.trim(j[l]):j[l]))&&g.length&&(f=f.concat(g))}a=v.selector[a];if(a.length){i=0;for(n=a.length;i<n;i++)f=a[i](d,e,f)}return pa(f)},ab=function(a){a||(a={});a.filter&&a.search===k&&(a.search=a.filter);return h.extend({search:"none",order:"current",
page:"all"},a)},bb=function(a){for(var b=0,c=a.length;b<c;b++)if(0<a[b].length)return a[0]=a[b],a[0].length=1,a.length=1,a.context=[a.context[b]],a;a.length=0;return a},Ba=function(a,b){var c,d,e,f=[],g=a.aiDisplay;c=a.aiDisplayMaster;var j=b.search;d=b.order;e=b.page;if("ssp"==y(a))return"removed"===j?[]:W(0,c.length);if("current"==e){c=a._iDisplayStart;for(d=a.fnDisplayEnd();c<d;c++)f.push(g[c])}else if("current"==d||"applied"==d)f="none"==j?c.slice():"applied"==j?g.slice():h.map(c,function(a){return-1===h.inArray(a,g)?a:null});else if("index"==d||"original"==d){c=0;for(d=a.aoData.length;c<d;c++)"none"==j?f.push(c):(e=h.inArray(c,g),(-1===e&&"removed"==j||0<=e&&"applied"==j)&&f.push(c))}return f};p("rows()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=ab(b),c=this.iterator("table",function(c){var e=b;return $a("row",a,function(a){var b=Pb(a);if(b!==null&&!e)return[b];var j=Ba(c,e);if(b!==null&&h.inArray(b,j)!==-1)return[b];if(!a)return j;if(typeof a==="function")return h.map(j,function(b){var e=
c.aoData[b];return a(b,e._aData,e.nTr)?b:null});b=Sb(ha(c.aoData,j,"nTr"));if(a.nodeName){if(a._DT_RowIndex!==k)return[a._DT_RowIndex];if(a._DT_CellIndex)return[a._DT_CellIndex.row];b=h(a).closest("*[data-dt-row]");return b.length?[b.data("dt-row")]:[]}if(typeof a==="string"&&a.charAt(0)==="#"){j=c.aIds[a.replace(/^#/,"")];if(j!==k)return[j.idx]}return h(b).filter(a).map(function(){return this._DT_RowIndex}).toArray()},c,e)},1);c.selector.rows=a;c.selector.opts=b;return c});p("rows().nodes()",function(){return this.iterator("row",
function(a,b){return a.aoData[b].nTr||k},1)});p("rows().data()",function(){return this.iterator(!0,"rows",function(a,b){return ha(a.aoData,b,"_aData")},1)});s("rows().cache()","row().cache()",function(a){return this.iterator("row",function(b,c){var d=b.aoData[c];return"search"===a?d._aFilterData:d._aSortData},1)});s("rows().invalidate()","row().invalidate()",function(a){return this.iterator("row",function(b,c){ca(b,c,a)})});s("rows().indexes()","row().index()",function(){return this.iterator("row",
function(a,b){return b},1)});s("rows().ids()","row().id()",function(a){for(var b=[],c=this.context,d=0,e=c.length;d<e;d++)for(var f=0,g=this[d].length;f<g;f++){var h=c[d].rowIdFn(c[d].aoData[this[d][f]]._aData);b.push((!0===a?"#":"")+h)}return new r(c,b)});s("rows().remove()","row().remove()",function(){var a=this;this.iterator("row",function(b,c,d){var e=b.aoData,f=e[c],g,h,i,n,l;e.splice(c,1);g=0;for(h=e.length;g<h;g++)if(i=e[g],l=i.anCells,null!==i.nTr&&(i.nTr._DT_RowIndex=g),null!==l){i=0;for(n=
l.length;i<n;i++)l[i]._DT_CellIndex.row=g}oa(b.aiDisplayMaster,c);oa(b.aiDisplay,c);oa(a[d],c,!1);Sa(b);c=b.rowIdFn(f._aData);c!==k&&delete b.aIds[c]});this.iterator("table",function(a){for(var c=0,d=a.aoData.length;c<d;c++)a.aoData[c].idx=c});return this});p("rows.add()",function(a){var b=this.iterator("table",function(b){var c,f,g,h=[];f=0;for(g=a.length;f<g;f++)c=a[f],c.nodeName&&"TR"===c.nodeName.toUpperCase()?h.push(ma(b,c)[0]):h.push(N(b,c));return h},1),c=this.rows(-1);c.pop();h.merge(c,b);
return c});p("row()",function(a,b){return bb(this.rows(a,b))});p("row().data()",function(a){var b=this.context;if(a===k)return b.length&&this.length?b[0].aoData[this[0]]._aData:k;b[0].aoData[this[0]]._aData=a;ca(b[0],this[0],"data");return this});p("row().node()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]].nTr||null:null});p("row.add()",function(a){a instanceof h&&a.length&&(a=a[0]);var b=this.iterator("table",function(b){return a.nodeName&&"TR"===a.nodeName.toUpperCase()?
ma(b,a)[0]:N(b,a)});return this.row(b[0])});var cb=function(a,b){var c=a.context;if(c.length&&(c=c[0].aoData[b!==k?b:a[0]])&&c._details)c._details.remove(),c._detailsShow=k,c._details=k},Vb=function(a,b){var c=a.context;if(c.length&&a.length){var d=c[0].aoData[a[0]];if(d._details){(d._detailsShow=b)?d._details.insertAfter(d.nTr):d._details.detach();var e=c[0],f=new r(e),g=e.aoData;f.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");0<G(g,"_details").length&&(f.on("draw.dt.DT_details",
function(a,b){e===b&&f.rows({page:"current"}).eq(0).each(function(a){a=g[a];a._detailsShow&&a._details.insertAfter(a.nTr)})}),f.on("column-visibility.dt.DT_details",function(a,b){if(e===b)for(var c,d=aa(b),f=0,h=g.length;f<h;f++)c=g[f],c._details&&c._details.children("td[colspan]").attr("colspan",d)}),f.on("destroy.dt.DT_details",function(a,b){if(e===b)for(var c=0,d=g.length;c<d;c++)g[c]._details&&cb(f,c)}))}}};p("row().child()",function(a,b){var c=this.context;if(a===k)return c.length&&this.length?
c[0].aoData[this[0]]._details:k;if(!0===a)this.child.show();else if(!1===a)cb(this);else if(c.length&&this.length){var d=c[0],c=c[0].aoData[this[0]],e=[],f=function(a,b){if(h.isArray(a)||a instanceof h)for(var c=0,k=a.length;c<k;c++)f(a[c],b);else a.nodeName&&"tr"===a.nodeName.toLowerCase()?e.push(a):(c=h("<tr><td/></tr>").addClass(b),h("td",c).addClass(b).html(a)[0].colSpan=aa(d),e.push(c[0]))};f(a,b);c._details&&c._details.remove();c._details=h(e);c._detailsShow&&c._details.insertAfter(c.nTr)}return this});
p(["row().child.show()","row().child().show()"],function(){Vb(this,!0);return this});p(["row().child.hide()","row().child().hide()"],function(){Vb(this,!1);return this});p(["row().child.remove()","row().child().remove()"],function(){cb(this);return this});p("row().child.isShown()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]]._detailsShow||!1:!1});var ec=/^(.+):(name|visIdx|visible)$/,Wb=function(a,b,c,d,e){for(var c=[],d=0,f=e.length;d<f;d++)c.push(B(a,e[d],b));
return c};p("columns()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=ab(b),c=this.iterator("table",function(c){var e=a,f=b,g=c.aoColumns,j=G(g,"sName"),i=G(g,"nTh");return $a("column",e,function(a){var b=Pb(a);if(a==="")return W(g.length);if(b!==null)return[b>=0?b:g.length+b];if(typeof a==="function"){var e=Ba(c,f);return h.map(g,function(b,f){return a(f,Wb(c,f,0,0,e),i[f])?f:null})}var k=typeof a==="string"?a.match(ec):"";if(k)switch(k[2]){case "visIdx":case "visible":b=parseInt(k[1],
10);if(b<0){var m=h.map(g,function(a,b){return a.bVisible?b:null});return[m[m.length+b]]}return[Z(c,b)];case "name":return h.map(j,function(a,b){return a===k[1]?b:null});default:return[]}if(a.nodeName&&a._DT_CellIndex)return[a._DT_CellIndex.column];b=h(i).filter(a).map(function(){return h.inArray(this,i)}).toArray();if(b.length||!a.nodeName)return b;b=h(a).closest("*[data-dt-column]");return b.length?[b.data("dt-column")]:[]},c,f)},1);c.selector.cols=a;c.selector.opts=b;return c});s("columns().header()",
"column().header()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTh},1)});s("columns().footer()","column().footer()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTf},1)});s("columns().data()","column().data()",function(){return this.iterator("column-rows",Wb,1)});s("columns().dataSrc()","column().dataSrc()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].mData},1)});s("columns().cache()","column().cache()",
function(a){return this.iterator("column-rows",function(b,c,d,e,f){return ha(b.aoData,f,"search"===a?"_aFilterData":"_aSortData",c)},1)});s("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(a,b,c,d,e){return ha(a.aoData,e,"anCells",b)},1)});s("columns().visible()","column().visible()",function(a,b){var c=this.iterator("column",function(b,c){if(a===k)return b.aoColumns[c].bVisible;var f=b.aoColumns,g=f[c],j=b.aoData,i,n,l;if(a!==k&&g.bVisible!==a){if(a){var m=
h.inArray(!0,G(f,"bVisible"),c+1);i=0;for(n=j.length;i<n;i++)l=j[i].nTr,f=j[i].anCells,l&&l.insertBefore(f[c],f[m]||null)}else h(G(b.aoData,"anCells",c)).detach();g.bVisible=a;ea(b,b.aoHeader);ea(b,b.aoFooter);wa(b)}});a!==k&&(this.iterator("column",function(c,e){u(c,null,"column-visibility",[c,e,a,b])}),(b===k||b)&&this.columns.adjust());return c});s("columns().indexes()","column().index()",function(a){return this.iterator("column",function(b,c){return"visible"===a?$(b,c):c},1)});p("columns.adjust()",
function(){return this.iterator("table",function(a){Y(a)},1)});p("column.index()",function(a,b){if(0!==this.context.length){var c=this.context[0];if("fromVisible"===a||"toData"===a)return Z(c,b);if("fromData"===a||"toVisible"===a)return $(c,b)}});p("column()",function(a,b){return bb(this.columns(a,b))});p("cells()",function(a,b,c){h.isPlainObject(a)&&(a.row===k?(c=a,a=null):(c=b,b=null));h.isPlainObject(b)&&(c=b,b=null);if(null===b||b===k)return this.iterator("table",function(b){var d=a,e=ab(c),f=
b.aoData,g=Ba(b,e),j=Sb(ha(f,g,"anCells")),i=h([].concat.apply([],j)),l,n=b.aoColumns.length,m,p,r,u,v,s;return $a("cell",d,function(a){var c=typeof a==="function";if(a===null||a===k||c){m=[];p=0;for(r=g.length;p<r;p++){l=g[p];for(u=0;u<n;u++){v={row:l,column:u};if(c){s=f[l];a(v,B(b,l,u),s.anCells?s.anCells[u]:null)&&m.push(v)}else m.push(v)}}return m}if(h.isPlainObject(a))return[a];c=i.filter(a).map(function(a,b){return{row:b._DT_CellIndex.row,column:b._DT_CellIndex.column}}).toArray();if(c.length||
!a.nodeName)return c;s=h(a).closest("*[data-dt-row]");return s.length?[{row:s.data("dt-row"),column:s.data("dt-column")}]:[]},b,e)});var d=this.columns(b,c),e=this.rows(a,c),f,g,j,i,n,l=this.iterator("table",function(a,b){f=[];g=0;for(j=e[b].length;g<j;g++){i=0;for(n=d[b].length;i<n;i++)f.push({row:e[b][g],column:d[b][i]})}return f},1);h.extend(l.selector,{cols:b,rows:a,opts:c});return l});s("cells().nodes()","cell().node()",function(){return this.iterator("cell",function(a,b,c){return(a=a.aoData[b])&&
a.anCells?a.anCells[c]:k},1)});p("cells().data()",function(){return this.iterator("cell",function(a,b,c){return B(a,b,c)},1)});s("cells().cache()","cell().cache()",function(a){a="search"===a?"_aFilterData":"_aSortData";return this.iterator("cell",function(b,c,d){return b.aoData[c][a][d]},1)});s("cells().render()","cell().render()",function(a){return this.iterator("cell",function(b,c,d){return B(b,c,d,a)},1)});s("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(a,
b,c){return{row:b,column:c,columnVisible:$(a,c)}},1)});s("cells().invalidate()","cell().invalidate()",function(a){return this.iterator("cell",function(b,c,d){ca(b,c,a,d)})});p("cell()",function(a,b,c){return bb(this.cells(a,b,c))});p("cell().data()",function(a){var b=this.context,c=this[0];if(a===k)return b.length&&c.length?B(b[0],c[0].row,c[0].column):k;jb(b[0],c[0].row,c[0].column,a);ca(b[0],c[0].row,"data",c[0].column);return this});p("order()",function(a,b){var c=this.context;if(a===k)return 0!==c.length?c[0].aaSorting:k;"number"===typeof a?a=[[a,b]]:a.length&&!h.isArray(a[0])&&(a=Array.prototype.slice.call(arguments));return this.iterator("table",function(b){b.aaSorting=a.slice()})});p("order.listener()",function(a,b,c){return this.iterator("table",function(d){Ma(d,a,b,c)})});p("order.fixed()",function(a){if(!a){var b=this.context,b=b.length?b[0].aaSortingFixed:k;return h.isArray(b)?{pre:b}:b}return this.iterator("table",function(b){b.aaSortingFixed=h.extend(!0,{},a)})});p(["columns().order()",
"column().order()"],function(a){var b=this;return this.iterator("table",function(c,d){var e=[];h.each(b[d],function(b,c){e.push([c,a])});c.aaSorting=e})});p("search()",function(a,b,c,d){var e=this.context;return a===k?0!==e.length?e[0].oPreviousSearch.sSearch:k:this.iterator("table",function(e){e.oFeatures.bFilter&&fa(e,h.extend({},e.oPreviousSearch,{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),1)})});s("columns().search()","column().search()",function(a,
b,c,d){return this.iterator("column",function(e,f){var g=e.aoPreSearchCols;if(a===k)return g[f].sSearch;e.oFeatures.bFilter&&(h.extend(g[f],{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),fa(e,e.oPreviousSearch,1))})});p("state()",function(){return this.context.length?this.context[0].oSavedState:null});p("state.clear()",function(){return this.iterator("table",function(a){a.fnStateSaveCallback.call(a.oInstance,a,{})})});p("state.loaded()",function(){return this.context.length?
this.context[0].oLoadedState:null});p("state.save()",function(){return this.iterator("table",function(a){wa(a)})});m.versionCheck=m.fnVersionCheck=function(a){for(var b=m.version.split("."),a=a.split("."),c,d,e=0,f=a.length;e<f;e++)if(c=parseInt(b[e],10)||0,d=parseInt(a[e],10)||0,c!==d)return c>d;return!0};m.isDataTable=m.fnIsDataTable=function(a){var b=h(a).get(0),c=!1;h.each(m.settings,function(a,e){var f=e.nScrollHead?h("table",e.nScrollHead)[0]:null,g=e.nScrollFoot?h("table",e.nScrollFoot)[0]:
null;if(e.nTable===b||f===b||g===b)c=!0});return c};m.tables=m.fnTables=function(a){var b=!1;h.isPlainObject(a)&&(b=a.api,a=a.visible);var c=h.map(m.settings,function(b){if(!a||a&&h(b.nTable).is(":visible"))return b.nTable});return b?new r(c):c};m.camelToHungarian=K;p("$()",function(a,b){var c=this.rows(b).nodes(),c=h(c);return h([].concat(c.filter(a).toArray(),c.find(a).toArray()))});h.each(["on","one","off"],function(a,b){p(b+"()",function(){var a=Array.prototype.slice.call(arguments);a[0].match(/\.dt\b/)||
(a[0]+=".dt");var d=h(this.tables().nodes());d[b].apply(d,a);return this})});p("clear()",function(){return this.iterator("table",function(a){na(a)})});p("settings()",function(){return new r(this.context,this.context)});p("init()",function(){var a=this.context;return a.length?a[0].oInit:null});p("data()",function(){return this.iterator("table",function(a){return G(a.aoData,"_aData")}).flatten()});p("destroy()",function(a){a=a||!1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,
d=b.oClasses,e=b.nTable,f=b.nTBody,g=b.nTHead,j=b.nTFoot,i=h(e),f=h(f),k=h(b.nTableWrapper),l=h.map(b.aoData,function(a){return a.nTr}),p;b.bDestroying=!0;u(b,"aoDestroyCallback","destroy",[b]);a||(new r(b)).columns().visible(!0);k.unbind(".DT").find(":not(tbody *)").unbind(".DT");h(D).unbind(".DT-"+b.sInstance);e!=g.parentNode&&(i.children("thead").detach(),i.append(g));j&&e!=j.parentNode&&(i.children("tfoot").detach(),i.append(j));b.aaSorting=[];b.aaSortingFixed=[];va(b);h(l).removeClass(b.asStripeClasses.join(" "));
h("th, td",g).removeClass(d.sSortable+" "+d.sSortableAsc+" "+d.sSortableDesc+" "+d.sSortableNone);b.bJUI&&(h("th span."+d.sSortIcon+", td span."+d.sSortIcon,g).detach(),h("th, td",g).each(function(){var a=h("div."+d.sSortJUIWrapper,this);h(this).append(a.contents());a.detach()}));f.children().detach();f.append(l);g=a?"remove":"detach";i[g]();k[g]();!a&&c&&(c.insertBefore(e,b.nTableReinsertBefore),i.css("width",b.sDestroyWidth).removeClass(d.sTable),(p=b.asDestroyStripes.length)&&f.children().each(function(a){h(this).addClass(b.asDestroyStripes[a%
p])}));c=h.inArray(b,m.settings);-1!==c&&m.settings.splice(c,1)})});h.each(["column","row","cell"],function(a,b){p(b+"s().every()",function(a){var d=this.selector.opts,e=this;return this.iterator(b,function(f,g,h,i,n){a.call(e[b](g,"cell"===b?h:d,"cell"===b?d:k),g,h,i,n)})})});p("i18n()",function(a,b,c){var d=this.context[0],a=Q(a)(d.oLanguage);a===k&&(a=b);c!==k&&h.isPlainObject(a)&&(a=a[c]!==k?a[c]:a._);return a.replace("%d",c)});m.version="1.10.12";m.settings=[];m.models={};m.models.oSearch={bCaseInsensitive:!0,
sSearch:"",bRegex:!1,bSmart:!0};m.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null,idx:-1};m.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,
sTitle:null,sType:null,sWidth:null,sWidthOrig:null};m.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,
fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+a.sInstance+"_"+location.pathname))}catch(b){}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",
sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:h.extend({},m.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",
renderer:null,rowId:"DT_RowId"};X(m.defaults);m.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};X(m.defaults.column);m.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,
bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],
aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:k,oAjaxData:k,
fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==y(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==y(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=
this._iDisplayLength,b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,f=e.bPaginate;return e.bServerSide?!1===f||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!f||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null};m.ext=v={buttons:{},classes:{},builder:"-source-",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},
header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:m.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:m.version};h.extend(v,{afnFiltering:v.search,aTypes:v.type.detect,ofnSearch:v.type.search,oSort:v.type.order,afnSortData:v.order,aoFeatures:v.feature,oApi:v.internal,oStdClasses:v.classes,oPagination:v.pager});h.extend(m.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",
sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",
sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""});var Ca="",Ca="",H=Ca+"ui-state-default",ia=Ca+"css_right ui-icon ui-icon-",Xb=Ca+"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix";h.extend(m.ext.oJUIClasses,
m.ext.classes,{sPageButton:"fg-button ui-button "+H,sPageButtonActive:"ui-state-disabled",sPageButtonDisabled:"ui-state-disabled",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:H+" sorting_asc",sSortDesc:H+" sorting_desc",sSortable:H+" sorting",sSortableAsc:H+" sorting_asc_disabled",sSortableDesc:H+" sorting_desc_disabled",sSortableNone:H+" sorting_disabled",sSortJUIAsc:ia+"triangle-1-n",sSortJUIDesc:ia+"triangle-1-s",sSortJUI:ia+"carat-2-n-s",
sSortJUIAscAllowed:ia+"carat-1-n",sSortJUIDescAllowed:ia+"carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollHead:"dataTables_scrollHead "+H,sScrollFoot:"dataTables_scrollFoot "+H,sHeaderTH:H,sFooterTH:H,sJUIHeader:Xb+" ui-corner-tl ui-corner-tr",sJUIFooter:Xb+" ui-corner-bl ui-corner-br"});var Mb=m.ext.pager;h.extend(Mb,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},numbers:function(a,b){return[ya(a,
b)]},simple_numbers:function(a,b){return["previous",ya(a,b),"next"]},full_numbers:function(a,b){return["first","previous",ya(a,b),"next","last"]},_numbers:ya,numbers_length:7});h.extend(!0,m.ext.renderer,{pageButton:{_:function(a,b,c,d,e,f){var g=a.oClasses,j=a.oLanguage.oPaginate,i=a.oLanguage.oAria.paginate||{},k,l,m=0,p=function(b,d){var o,r,u,s,v=function(b){Ta(a,b.data.action,true)};o=0;for(r=d.length;o<r;o++){s=d[o];if(h.isArray(s)){u=h("<"+(s.DT_el||"div")+"/>").appendTo(b);p(u,s)}else{k=null;
l="";switch(s){case "ellipsis":b.append('<span class="ellipsis">&#x2026;</span>');break;case "first":k=j.sFirst;l=s+(e>0?"":" "+g.sPageButtonDisabled);break;case "previous":k=j.sPrevious;l=s+(e>0?"":" "+g.sPageButtonDisabled);break;case "next":k=j.sNext;l=s+(e<f-1?"":" "+g.sPageButtonDisabled);break;case "last":k=j.sLast;l=s+(e<f-1?"":" "+g.sPageButtonDisabled);break;default:k=s+1;l=e===s?g.sPageButtonActive:""}if(k!==null){u=h("<a>",{"class":g.sPageButton+" "+l,"aria-controls":a.sTableId,"aria-label":i[s],
"data-dt-idx":m,tabindex:a.iTabIndex,id:c===0&&typeof s==="string"?a.sTableId+"_"+s:null}).html(k).appendTo(b);Wa(u,{action:s},v);m++}}}},r;try{r=h(b).find(I.activeElement).data("dt-idx")}catch(o){}p(h(b).empty(),d);r&&h(b).find("[data-dt-idx="+r+"]").focus()}}});h.extend(m.ext.type.detect,[function(a,b){var c=b.oLanguage.sDecimal;return Za(a,c)?"num"+c:null},function(a){if(a&&!(a instanceof Date)&&(!ac.test(a)||!bc.test(a)))return null;var b=Date.parse(a);return null!==b&&!isNaN(b)||M(a)?"date":
null},function(a,b){var c=b.oLanguage.sDecimal;return Za(a,c,!0)?"num-fmt"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Rb(a,c)?"html-num"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Rb(a,c,!0)?"html-num-fmt"+c:null},function(a){return M(a)||"string"===typeof a&&-1!==a.indexOf("<")?"html":null}]);h.extend(m.ext.type.search,{html:function(a){return M(a)?a:"string"===typeof a?a.replace(Ob," ").replace(Aa,""):""},string:function(a){return M(a)?a:"string"===typeof a?a.replace(Ob,
" "):a}});var za=function(a,b,c,d){if(0!==a&&(!a||"-"===a))return-Infinity;b&&(a=Qb(a,b));a.replace&&(c&&(a=a.replace(c,"")),d&&(a=a.replace(d,"")));return 1*a};h.extend(v.type.order,{"date-pre":function(a){return Date.parse(a)||0},"html-pre":function(a){return M(a)?"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return M(a)?"":"string"===typeof a?a.toLowerCase():!a.toString?"":a.toString()},"string-asc":function(a,b){return a<b?-1:a>b?1:0},"string-desc":function(a,
b){return a<b?1:a>b?-1:0}});db("");h.extend(!0,m.ext.renderer,{header:{_:function(a,b,c,d){h(a.nTable).on("order.dt.DT",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(c.sSortingClass+" "+d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:c.sSortingClass)}})},jqueryui:function(a,b,c,d){h("<div/>").addClass(d.sSortJUIWrapper).append(b.contents()).append(h("<span/>").addClass(d.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);h(a.nTable).on("order.dt.DT",function(e,
f,g,h){if(a===f){e=c.idx;b.removeClass(d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:c.sSortingClass);b.find("span."+d.sSortIcon).removeClass(d.sSortJUIAsc+" "+d.sSortJUIDesc+" "+d.sSortJUI+" "+d.sSortJUIAscAllowed+" "+d.sSortJUIDescAllowed).addClass(h[e]=="asc"?d.sSortJUIAsc:h[e]=="desc"?d.sSortJUIDesc:c.sSortingClassJUI)}})}}});var Yb=function(a){return"string"===typeof a?a.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):a};m.render={number:function(a,
b,c,d,e){return{display:function(f){if("number"!==typeof f&&"string"!==typeof f)return f;var g=0>f?"-":"",h=parseFloat(f);if(isNaN(h))return Yb(f);f=Math.abs(h);h=parseInt(f,10);f=c?b+(f-h).toFixed(c).substring(2):"";return g+(d||"")+h.toString().replace(/\B(?=(\d{3})+(?!\d))/g,a)+f+(e||"")}}},text:function(){return{display:Yb}}};h.extend(m.ext.internal,{_fnExternApiFunc:Nb,_fnBuildAjax:ra,_fnAjaxUpdate:lb,_fnAjaxParameters:ub,_fnAjaxUpdateDraw:vb,_fnAjaxDataSrc:sa,_fnAddColumn:Ea,_fnColumnOptions:ja,
_fnAdjustColumnSizing:Y,_fnVisibleToColumnIndex:Z,_fnColumnIndexToVisible:$,_fnVisbleColumns:aa,_fnGetColumns:la,_fnColumnTypes:Ga,_fnApplyColumnDefs:ib,_fnHungarianMap:X,_fnCamelToHungarian:K,_fnLanguageCompat:Da,_fnBrowserDetect:gb,_fnAddData:N,_fnAddTr:ma,_fnNodeToDataIndex:function(a,b){return b._DT_RowIndex!==k?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,c){return h.inArray(c,a.aoData[b].anCells)},_fnGetCellData:B,_fnSetCellData:jb,_fnSplitObjNotation:Ja,_fnGetObjectDataFn:Q,_fnSetObjectDataFn:R,
_fnGetDataMaster:Ka,_fnClearTable:na,_fnDeleteIndex:oa,_fnInvalidate:ca,_fnGetRowElements:Ia,_fnCreateTr:Ha,_fnBuildHead:kb,_fnDrawHead:ea,_fnDraw:O,_fnReDraw:T,_fnAddOptionsHtml:nb,_fnDetectHeader:da,_fnGetUniqueThs:qa,_fnFeatureHtmlFilter:pb,_fnFilterComplete:fa,_fnFilterCustom:yb,_fnFilterColumn:xb,_fnFilter:wb,_fnFilterCreateSearch:Pa,_fnEscapeRegex:Qa,_fnFilterData:zb,_fnFeatureHtmlInfo:sb,_fnUpdateInfo:Cb,_fnInfoMacros:Db,_fnInitialise:ga,_fnInitComplete:ta,_fnLengthChange:Ra,_fnFeatureHtmlLength:ob,
_fnFeatureHtmlPaginate:tb,_fnPageChange:Ta,_fnFeatureHtmlProcessing:qb,_fnProcessingDisplay:C,_fnFeatureHtmlTable:rb,_fnScrollDraw:ka,_fnApplyToChildren:J,_fnCalculateColumnWidths:Fa,_fnThrottle:Oa,_fnConvertToWidth:Fb,_fnGetWidestNode:Gb,_fnGetMaxLenString:Hb,_fnStringToCss:x,_fnSortFlatten:V,_fnSort:mb,_fnSortAria:Jb,_fnSortListener:Va,_fnSortAttachListener:Ma,_fnSortingClasses:va,_fnSortData:Ib,_fnSaveState:wa,_fnLoadState:Kb,_fnSettingsFromNode:xa,_fnLog:L,_fnMap:E,_fnBindAction:Wa,_fnCallbackReg:z,
_fnCallbackFire:u,_fnLengthOverflow:Sa,_fnRenderer:Na,_fnDataSource:y,_fnRowAttributes:La,_fnCalculateEnd:function(){}});h.fn.dataTable=m;m.$=h;h.fn.dataTableSettings=m.settings;h.fn.dataTableExt=m.ext;h.fn.DataTable=function(a){return h(this).dataTable(a).api()};h.each(m,function(a,b){h.fn.DataTable[a]=b});return h.fn.dataTable});
(function(window, document, undefined){
var factory=function($, DataTable){
"use strict";
var Responsive=function(settings, opts){
if(! DataTable.versionCheck||! DataTable.versionCheck('1.10.1') ){
throw 'DataTables Responsive requires DataTables 1.10.1 or newer';
}
else if(settings.responsive){
return;
}
this.s={
dt: new DataTable.Api(settings),
columns: []
};
if(opts&&typeof opts.details==='string'){
opts.details={ type: opts.details };}
this.c=$.extend(true, {}, Responsive.defaults, opts);
settings.responsive=this;
this._constructor();
};
Responsive.prototype={
_constructor: function (){
var that=this;
var dt=this.s.dt;
dt.settings()[0]._responsive=this;
$(window).on('resize.dtr orientationchange.dtr', dt.settings()[0].oApi._fnThrottle(function (){
that._resize();
}) );
dt.on('destroy.dtr', function (){
$(window).off('resize.dtr orientationchange.dtr');
});
this.c.breakpoints.sort(function (a, b){
return a.width < b.width ? 1 :
a.width > b.width ? -1:0;
});
this._classLogic();
this._resizeAuto();
this._resize();
var details=this.c.details;
if(details.type){
that._detailsInit();
this._detailsVis();
dt.on('column-visibility.dtr', function (){
that._detailsVis();
});
$(dt.table().node()).addClass('dtr-'+details.type);
}},
_columnsVisiblity: function(breakpoint){
var dt=this.s.dt;
var columns=this.s.columns;
var i, ien;
var display=$.map(columns, function(col){
return col.auto&&col.minWidth===null ?
false :
col.auto===true ?
'-' :
col.includeIn.indexOf(breakpoint)!==-1;
});
var requiredWidth=0;
for(i=0, ien=display.length ; i<ien ; i++){
if(display[i]===true){
requiredWidth +=columns[i].minWidth;
}}
var widthAvailable=dt.table().container().offsetWidth;
var usedWidth=widthAvailable - requiredWidth;
for(i=0, ien=display.length ; i<ien ; i++){
if(columns[i].control){
usedWidth -=columns[i].minWidth;
}
else if(display[i]==='-'){
display[i]=usedWidth - columns[i].minWidth < 0 ?
false :
true;
usedWidth -=columns[i].minWidth;
}}
var showControl=false;
for(i=0, ien=columns.length ; i<ien ; i++){
if(! columns[i].control&&! display[i]){
showControl=true;
break;
}}
for(i=0, ien=columns.length ; i<ien ; i++){
if(columns[i].control){
display[i]=showControl;
}}
return display;
},
_classLogic: function (){
var that=this;
var calc={};
var breakpoints=this.c.breakpoints;
var columns=this.s.dt.columns().eq(0).map(function (i){
return {
className: this.column(i).header().className,
includeIn: [],
auto:      false,
control:   false
};});
var add=function(colIdx, name){
var includeIn=columns[ colIdx ].includeIn;
if(includeIn.indexOf(name)===-1){
includeIn.push(name);
}};
var column=function(colIdx, name, operator, matched){
var size, i, ien;
if(! operator){
columns[ colIdx ].includeIn.push(name);
}
else if(operator==='max-'){
size=that._find(name).width;
for(i=0, ien=breakpoints.length ; i<ien ; i++){
if(breakpoints[i].width <=size){
add(colIdx, breakpoints[i].name);
}}
}
else if(operator==='min-'){
size=that._find(name).width;
for(i=0, ien=breakpoints.length ; i<ien ; i++){
if(breakpoints[i].width >=size){
add(colIdx, breakpoints[i].name);
}}
}
else if(operator==='not-'){
for(i=0, ien=breakpoints.length ; i<ien ; i++){
if(breakpoints[i].name.indexOf(matched)===-1){
add(colIdx, breakpoints[i].name);
}}
}};
columns.each(function(col, i){
var classNames=col.className.split(' ');
var hasClass=false;
for(var k=0, ken=classNames.length ; k<ken ; k++){
var className=$.trim(classNames[k]);
if(className==='all'){
hasClass=true;
col.includeIn=$.map(breakpoints, function (a){
return a.name;
});
return;
}
else if(className==='none'){
hasClass=true;
return;
}
else if(className==='control'){
hasClass=true;
col.control=true;
return;
}
$.each(breakpoints, function(j, breakpoint){
var brokenPoint=breakpoint.name.split('-');
var re=new RegExp('(min\\-|max\\-|not\\-)?('+brokenPoint[0]+')(\\-[_a-zA-Z0-9])?');
var match=className.match(re);
if(match){
hasClass=true;
if(match[2]===brokenPoint[0]&&match[3]==='-'+brokenPoint[1]){
column(i, breakpoint.name, match[1], match[2]+match[3]);
}
else if(match[2]===brokenPoint[0]&&! match[3]){
column(i, breakpoint.name, match[1], match[2]);
}}
});
}
if(! hasClass){
col.auto=true;
}});
this.s.columns=columns;
},
_detailsInit: function (){
var that=this;
var dt=this.s.dt;
var details=this.c.details;
if(details.type==='inline'){
details.target='td:first-child';
}
var target=details.target;
var selector=typeof target==='string' ? target:'td';
$(dt.table().body()).on('click', selector, function (e){
if(! $(dt.table().node()).hasClass('collapsed') ){
return;
}
if(typeof target==='number'){
var targetIdx=target < 0 ?
dt.columns().eq(0).length + target :
target;
if(dt.cell(this).index().column!==targetIdx){
return;
}}
var row=dt.row($(this).closest('tr'));
if(row.child.isShown()){
row.child(false);
$(row.node()).removeClass('parent');
}else{
var info=that.c.details.renderer(dt, row[0]);
row.child(info, 'child').show();
$(row.node()).addClass('parent');
}});
},
_detailsVis: function (){
var that=this;
var dt=this.s.dt;
var hiddenColumns=dt.columns(':hidden').indexes().flatten();
var haveHidden=true;
if(hiddenColumns.length===0||(hiddenColumns.length===1&&this.s.columns[ hiddenColumns[0] ].control) ){
haveHidden=false;
}
if(haveHidden){
$(dt.table().node()).addClass('collapsed');
dt.rows().eq(0).each(function (idx){
var row=dt.row(idx);
if(row.child()){
var info=that.c.details.renderer(dt, row[0]);
if(info===false){
row.child.hide();
}else{
row.child(info, 'child').show();
}}
});
}else{
$(dt.table().node()).removeClass('collapsed');
dt.rows().eq(0).each(function (idx){
dt.row(idx).child.hide();
});
}},
_find: function(name){
var breakpoints=this.c.breakpoints;
for(var i=0, ien=breakpoints.length ; i<ien ; i++){
if(breakpoints[i].name===name){
return breakpoints[i];
}}
},
_resize: function (){
var dt=this.s.dt;
var width=$(window).width();
var breakpoints=this.c.breakpoints;
var breakpoint=breakpoints[0].name;
for(var i=breakpoints.length-1 ; i>=0 ; i--){
if(width <=breakpoints[i].width){
breakpoint=breakpoints[i].name;
break;
}}
var columns=this._columnsVisiblity(breakpoint);
dt.columns().eq(0).each(function(colIdx, i){
dt.column(colIdx).visible(columns[i]);
});
},
_resizeAuto: function (){
var dt=this.s.dt;
var columns=this.s.columns;
if(! this.c.auto){
return;
}
if($.inArray(true, $.map(columns, function (c){ return c.auto; }) )===-1){
return;
}
var tableWidth=dt.table().node().offsetWidth;
var columnWidths=dt.columns;
var clonedTable=dt.table().node().cloneNode(false);
var clonedHeader=$(dt.table().header().cloneNode(false) ).appendTo(clonedTable);
var clonedBody=$(dt.table().body().cloneNode(false) ).appendTo(clonedTable);
dt.rows({ page: 'current' }).indexes().each(function(idx){
var clone=dt.row(idx).node().cloneNode(true);
if(dt.columns(':hidden').flatten().length){
$(clone).append(dt.cells(idx, ':hidden').nodes().to$().clone());
}
$(clone).appendTo(clonedBody);
});
var cells=dt.columns().header().to$().clone(false).wrapAll('tr').appendTo(clonedHeader);
var inserted=$('<div/>')
.css({
width: 1,
height: 1,
overflow: 'hidden'
})
.append(clonedTable)
.insertBefore(dt.table().node());
dt.columns().eq(0).each(function(idx){
columns[idx].minWidth=cells[ idx ].offsetWidth||0;
});
inserted.remove();
}};
Responsive.breakpoints=[
{ name: 'desktop',  width: Infinity },
{ name: 'tablet-l', width: 1024 },
{ name: 'tablet-p', width: 768 },
{ name: 'mobile-l', width: 480 },
{ name: 'mobile-p', width: 320 }
];
Responsive.defaults={
breakpoints: Responsive.breakpoints,
auto: true,
details: {
renderer: function(api, rowIdx){
var data=api.cells(rowIdx, ':hidden').eq(0).map(function(cell){
var header=$(api.column(cell.column).header());
if(header.hasClass('control') ){
return '';
}
return '<li>'+
'<span class="dtr-title">'+
header.text()+':'+
'</span> '+
'<span class="dtr-data">'+
api.cell(cell).data()+
'</span>'+
'</li>';
}).toArray().join('');
return data ?
$('<ul/>').append(data) :
false;
},
target: 0,
type: 'inline'
}};
var Api=$.fn.dataTable.Api;
Api.register('responsive()', function (){
return this;
});
Api.register('responsive.recalc()', function(rowIdx, intParse, virtual){
this.iterator('table', function(ctx){
if(ctx._responsive){
ctx._responsive._resizeAuto();
ctx._responsive._resize();
}});
});
Responsive.version='1.0.1';
$.fn.dataTable.Responsive=Responsive;
$.fn.DataTable.Responsive=Responsive;
$(document).on('init.dt.dtr', function (e, settings, json){
if($(settings.nTable).hasClass('responsive') ||
$(settings.nTable).hasClass('dt-responsive') ||
settings.oInit.responsive
){
var init=settings.oInit.responsive;
if(init!==false){
new Responsive(settings, $.isPlainObject(init) ? init:{});
}}
});
return Responsive;
};
if(typeof define==='function'&&define.amd){
define(['jquery', 'datatables'], factory);
}
else if(typeof exports==='object'){
factory(require('jquery'), require('datatables'));
}
else if(jQuery&&!jQuery.fn.dataTable.Responsive){
factory(jQuery, jQuery.fn.dataTable);
}})(window, document);
(function(m,o){var k=function(c,k){var h=function(e,a){if(!k.versionCheck||!k.versionCheck("1.10.1"))throw"DataTables Responsive requires DataTables 1.10.1 or newer";e.responsive||(this.s={dt:new k.Api(e),columns:[]},a&&"string"===typeof a.details&&(a.details={type:a.details}),this.c=c.extend(!0,{},h.defaults,a),e.responsive=this,this._constructor())};h.prototype={_constructor:function(){var e=this,a=this.s.dt;a.settings()[0]._responsive=this;c(m).on("resize.dtr orientationchange.dtr",a.settings()[0].oApi._fnThrottle(function(){e._resize()}));
a.on("destroy.dtr",function(){c(m).off("resize.dtr orientationchange.dtr")});this.c.breakpoints.sort(function(a,b){return a.width<b.width?1:a.width>b.width?-1:0});this._classLogic();this._resizeAuto();this._resize();var b=this.c.details;b.type&&(e._detailsInit(),this._detailsVis(),a.on("column-visibility.dtr",function(){e._detailsVis()}),c(a.table().node()).addClass("dtr-"+b.type))},_columnsVisiblity:function(e){var a=this.s.dt,b=this.s.columns,d,f,j=c.map(b,function(a){return a.auto&&null===a.minWidth?
!1:!0===a.auto?"-":-1!==a.includeIn.indexOf(e)}),g=0;d=0;for(f=j.length;d<f;d++)!0===j[d]&&(g+=b[d].minWidth);a=a.table().container().offsetWidth-g;d=0;for(f=j.length;d<f;d++)b[d].control?a-=b[d].minWidth:"-"===j[d]&&(j[d]=0>a-b[d].minWidth?!1:!0,a-=b[d].minWidth);a=!1;d=0;for(f=b.length;d<f;d++)if(!b[d].control&&!j[d]){a=!0;break}d=0;for(f=b.length;d<f;d++)b[d].control&&(j[d]=a);return j},_classLogic:function(){var e=this,a=this.c.breakpoints,b=this.s.dt.columns().eq(0).map(function(a){return{className:this.column(a).header().className,
includeIn:[],auto:!1,control:!1}}),d=function(a,d){var e=b[a].includeIn;-1===e.indexOf(d)&&e.push(d)},f=function(f,g,c,i){if(c)if("max-"===c){i=e._find(g).width;g=0;for(c=a.length;g<c;g++)a[g].width<=i&&d(f,a[g].name)}else if("min-"===c){i=e._find(g).width;g=0;for(c=a.length;g<c;g++)a[g].width>=i&&d(f,a[g].name)}else{if("not-"===c){g=0;for(c=a.length;g<c;g++)-1===a[g].name.indexOf(i)&&d(f,a[g].name)}}else b[f].includeIn.push(g)};b.each(function(b,d){for(var e=b.className.split(" "),i=!1,h=0,k=e.length;h<
k;h++){var l=c.trim(e[h]);if("all"===l){i=!0;b.includeIn=c.map(a,function(a){return a.name});return}if("none"===l){i=!0;return}if("control"===l){i=!0;b.control=!0;return}c.each(a,function(a,b){var e=b.name.split("-"),c=l.match(RegExp("(min\\-|max\\-|not\\-)?("+e[0]+")(\\-[_a-zA-Z0-9])?"));c&&(i=!0,c[2]===e[0]&&c[3]==="-"+e[1]?f(d,b.name,c[1],c[2]+c[3]):c[2]===e[0]&&!c[3]&&f(d,b.name,c[1],c[2]))})}i||(b.auto=!0)});this.s.columns=b},_detailsInit:function(){var e=this,a=this.s.dt,b=this.c.details;"inline"===b.type&&(b.target="td:first-child");var d=b.target;c(a.table().body()).on("click","string"===typeof d?d:"td",function(){if(c(a.table().node()).hasClass("collapsed")){if(typeof d==="number"){var b=d<0?a.columns().eq(0).length+d:d;if(a.cell(this).index().column!==b)return}b=a.row(c(this).closest("tr"));if(b.child.isShown()){b.child(false);c(b.node()).removeClass("parent")}else{var j=e.c.details.renderer(a,b[0]);b.child(j,"child").show();c(b.node()).addClass("parent")}}})},_detailsVis:function(){var e=
this,a=this.s.dt,b=a.columns(":hidden").indexes().flatten(),d=!0;if(0===b.length||1===b.length&&this.s.columns[b[0]].control)d=!1;d?(c(a.table().node()).addClass("collapsed"),a.rows().eq(0).each(function(b){b=a.row(b);if(b.child()){var c=e.c.details.renderer(a,b[0]);!1===c?b.child.hide():b.child(c,"child").show()}})):(c(a.table().node()).removeClass("collapsed"),a.rows().eq(0).each(function(b){a.row(b).child.hide()}))},_find:function(c){for(var a=this.c.breakpoints,b=0,d=a.length;b<d;b++)if(a[b].name===c)return a[b]},_resize:function(){for(var e=this.s.dt,a=c(m).width(),b=this.c.breakpoints,d=b[0].name,f=b.length-1;0<=f;f--)if(a<=b[f].width){d=b[f].name;break}var h=this._columnsVisiblity(d);e.columns().eq(0).each(function(a,b){e.column(a).visible(h[b])})},_resizeAuto:function(){var e=this.s.dt,a=this.s.columns;if(this.c.auto&&-1!==c.inArray(!0,c.map(a,function(a){return a.auto}))){e.table().node();var b=e.table().node().cloneNode(!1),d=c(e.table().header().cloneNode(!1)).appendTo(b),f=c(e.table().body().cloneNode(!1)).appendTo(b);
e.rows({page:"current"}).indexes().each(function(a){var b=e.row(a).node().cloneNode(!0);e.columns(":hidden").flatten().length&&c(b).append(e.cells(a,":hidden").nodes().to$().clone());c(b).appendTo(f)});var h=e.columns().header().to$().clone(!1).wrapAll("tr").appendTo(d),b=c("<div/>").css({width:1,height:1,overflow:"hidden"}).append(b).insertBefore(e.table().node());e.columns().eq(0).each(function(b){a[b].minWidth=h[b].offsetWidth||0});b.remove()}}};h.breakpoints=[{name:"desktop",width:Infinity},{name:"tablet-l",
width:1024},{name:"tablet-p",width:768},{name:"mobile-l",width:480},{name:"mobile-p",width:320}];h.defaults={breakpoints:h.breakpoints,auto:!0,details:{renderer:function(e,a){var b=e.cells(a,":hidden").eq(0).map(function(a){var b=c(e.column(a.column).header());return b.hasClass("control")?"":'<li><span class="dtr-title">'+b.text()+':</span> <span class="dtr-data">'+e.cell(a).data()+"</span></li>"}).toArray().join("");return b?c("<ul/>").append(b):!1},target:0,type:"inline"}};var n=c.fn.dataTable.Api;
n.register("responsive()",function(){return this});n.register("responsive.recalc()",function(){this.iterator("table",function(c){c._responsive&&(c._responsive._resizeAuto(),c._responsive._resize())})});h.version="1.0.1";c.fn.dataTable.Responsive=h;c.fn.DataTable.Responsive=h;c(o).on("init.dt.dtr",function(e,a){if(c(a.nTable).hasClass("responsive")||c(a.nTable).hasClass("dt-responsive")||a.oInit.responsive){var b=a.oInit.responsive;!1!==b&&new h(a,c.isPlainObject(b)?b:{})}});return h};"function"===typeof define&&define.amd?define(["jquery","datatables"],k):"object"===typeof exports?k(require("jquery"),require("datatables")):jQuery&&!jQuery.fn.dataTable.Responsive&&k(jQuery,jQuery.fn.dataTable)})(window,document);
/*
* Parameters:
*
*
* -------------
* column_number
Required:			true
Type:				int
Description:		The number of the column to which the filter will be applied
* filter_type
Required:			false
Type:				String
Default value:		select
Possible values:	select / multi_select / auto_complete / text / date / range_number / range_number_slider / range_date / custom_func / multi_select_custom_func
Description:		The type of the filter to be used in the column
* custom_func
Required:			true (when filter_type is custom_func / multi_select_custom_func)
Type:				function
Default value:		undefined
Description:		should be pointing to a function with the following signature myCustomFilterFunction(filterVal, columnVal, rowValues) , where filterVal is the value from the select box and
columnVal is the value from the relevant row column, rowValues is an array that holds the values of the entire row, this function should return true if the row matches your condition and the row should be displayed) and false otherwise
Note:				When using multi_select_custom_func as filter_type filterVal will hold an array of selected values from the multi select element
* data
Required:			false
Type:				Array (of string or objects)
Description:		When the need of predefined data for filter is needed just use an array of strings ["value1","value2"....] (supported in select / multi_select / auto_complete filters) or
array of objects [{value: 'Some Data 1', label: 'One'}, {value: 'Some Data 3', label: 'Three'}] (supported in select / multi_select filters)
Note:				that when filter_type is custom_func / multi_select_custom_func this array will populate the custom filter select element
* data_as_is
Required:			false
Type:				boolean
Default value:		false
Description:		When set to true, the value of the data attribute will be fed into the filter as is (without any modification/decoration).
Perfect to use when you want to define your own <option></option> for the filter
Note:				Currently supported by the select / multi_select filters
* append_data_to_table_data
Required:			false
Type:				string
Default value:		undefined
Possible values:	before / sorted
Description:		Use 'before' to place your data array before the values that yadcf grabs from the table
use 'sorted' to place the data array sorted along with the values that yadcf grabs from the table
Note:				'sorted' option will have affect only if you data is an array of primitives (not objects)
* column_data_type
Required:			false
Type:				String
Default value:		text
Possible values:	text / html	/ rendered_html
Description:		The type of data in column , use "html" when you have some html code in the column (support parsing of multiple elements per cell),
use rendered_html when you are using render function of columnDefs or similar, that produces a html code, note that both types rendered_html and html have a fallback for simple text parsing
* text_data_delimiter
Required:			false
Type:				String
Description:		Delimiter that seperates text in table column, for example text_data_delimiter: ","
* html_data_type
Required:			false
Type:				String
Default value:		text
Possible values:	text / value / id / selector
Description:		When using "html" for column_data_type argument you can choose how exactly to parse your html element/s in column , for example use "text" for the following <span class="someClass">Some text</span>
Special notes:		when using selector you must provide a valid selector string for the html_data_selector property
* html_data_selector
Required:			false
Type:				String
Default value:		undefined
Possible values:	any valid selector string, for example 'li:eq(1)'
Description:		allows for advanced text value selection within the html located in the td element
Special notes:		know that the selector string "begin is search" from (and not outside) the first element of the html inside the td
(supported by range_number_slider / select / auto_complete)
* html5_data
Required:			false
Type:				String
Default value:		undefined
Possible values:	data-filter / data-search / anything that is supported by datatables
Description:		Allows to filter based on data-filter / data-search attributes of the <td> element, read more: http://www.datatables.net/examples/advanced_init/html5-data-attributes.html
* filter_container_id
Required:			false
Type:				String
Description:		In case that user don't want to place the filter in column header , he can pass an id of the desired container for the column filter
* filter_container_selector
Required:			false
Type:				String
Description:		In case that user don't want to place the filter in column header , he can pass a (jquery) selector of the desired container for the column filter
* filter_default_label
Required:			false
Type:				String / Array of string in case of range_number filter (first entry is for the first input and the second entry is for the second input
Default value:		Select value
Description:		The label that will appear in the select menu filter when no value is selected from the filter
* filter_reset_button_text
Required:			false
Type:				String / boolean
Default value:		x
Description:		The text that will appear inside the reset button next to the select drop down (set this to false (boolean) in order to hide it from that column filter)
* enable_auto_complete (this attribute is deprecated , and will become obsolete in the future , so you better start using filter_type: "auto_complete")
Required:			false
Type:				boolean
Default value:		false
Description:		Turns the filter into an autocomplete input - make use of the jQuery UI Autocomplete widget (with some enhancements)
* sort_as
Required:			false
Type:				String
Default value:		alpha
Possible values:	alpha / num / alphaNum / none
Description:		Defines how the values in the filter will be sorted, alphabetically / numerically / alphanumeric / custom / not sorted at all (none is useful to preserve
the order of the data attribute as is)
Note:				When custom value is set you must provide a custom sorting function for the sort_as_custom_func property
* sort_as_custom_func
Required:			false
Type:				function
Default value:		undefined
Description:		Allows to provide a custom sorting function for the filter elements
* sort_order
Required:			false
Type:				String
Default value:		asc
Possible values:	asc / desc
Description:		Defines the order in which the values in the filter will be sorted, ascending or descending
* date_format
Required:			false
Type:				String
Default value:		mm/dd/yyyy
Possible values:	mm/dd/yyyy / dd/mm/yyyy / hh:mm (when using datepicker_type: 'bootstrap-datetimepicker')
Description:		Defines the format in which the date values are being parsed into Date object
Note:				You can replace the / separator with other one , for example mm-dd-yy
* ignore_char
Required:			false
Type:				String
Description:		Tells the range_number and range_number_slide to ignore specific char while filtering (that char can used as number separator)
Note:				Use double escape for regex chars , e.g \\$ , also you can use multiple ignore chars with | , e.g '_|\\.|\\$'
* filter_match_mode
Required:			false
Type:				String
Default value:		contains
Possible values:	contains / exact / startsWith / regex
Description:		Allows to control the matching mode of the filter (supported in select / auto_complete / text filters)
* exclude
Required:			false
Type:				boolean
Default value:		undefined
Description:		Adds a checkbox next to the filter that allows to do a "not/exclude" filtering (acts the same  all filter_match_mode)
Note:				Currently available for the text filter
* exclude_label
Required:			false
Type:				string
Default value:		exclude
Description:		The label that will appear above the exclude checkbox
* select_type
Required:			false
Type:				String
Default value:		undefined
Possible values:	chosen / select2 / custom_select
Description:		Turns the simple select element into Chosen / Select2 (make use of the Chosen / Select2 select jQuery plugins)
Note:				When using custom_select , make sure to call the initSelectPluginCustomTriggers,
before calling yadcf constructor / init function
* select_type_options
Required:			false
Type:				Object
Default value:		{}
Description:		This parameter will be passed "as is" to the Chosen/Select2 plugin constructor
* filter_plugin_options
Required:			false
Type:				Object
Default value:		undefined
Description:		This parameter will be passed to the jQuery Autocomplete / jQuery Slider / Bootstrap Datetimepicker
* case_insensitive
Required:			false
Type:				boolean
Default value:		true
Description:		Do case-insensitive filtering (supported in select / auto_complete / text filters)
* filter_delay
Required:			false
Type:				integer
Default value:		undefined
Description:		Delay filter execution for a XXX milliseconds - filter will fire XXX milliseconds after the last keyup.
Special notes:		Currently supported in text / range_number / range_date filters / range_number_slider
* datepicker_type
Required:			false
Type:				string
Default value:		'jquery-ui'
Possible values:    'jquery-ui', 'bootstrap-datetimepicker'
Description:		You can choose datapicker library from defined in special notes
Special notes:		Currently supported only jQueryUI datepicker (datepicker) and Bootstrap datepicker (eonasdan-bootstrap-datetimepicker)
Bootstrap datepicker depends moment library. This plugin depends moment too.
* Global Parameters (per table rather than per column)
*
* Usage example yadcf.init(oTable,[{column_number:0}, {column_number: 3}],{cumulative_filtering: true});
* -------------
* externally_triggered
Required:			false
Type:				boolean
Default value:		false
Description:		Filters will filter only when yadcf.exFilterExternallyTriggered(table_arg) is called
Special notes:		Useful when you want to build some form with filters and you want to trigger the filter when that form
"submit" button is clicked (instead of filtering per filter input change)
* cumulative_filtering
Required:			false
Type:				boolean
Default value:		false
Description:		Change the default behaviour of the filters so its options will be populated from the filtered rows (remaining
table data after filtering) only, unlike the normal behaviour in which the options of the filters are from all the table data
*
*
*
*
* External API functions:
*
*
* -------------
* exFilterColumn
Description:		Allows to trigger filter/s externally/programmatically (support ALL filter types!!!) , perfect for showing table with pre filtered columns
Arguments:			table_arg: (variable of the datatable),
array of pairs: column number String/Object with from and to, filter_value (the actual string value that we want to filter by)
Usage example:		yadcf.exFilterColumn(oTable, [[0, 'Some Data 2']]);
yadcf.exFilterColumn(oTable, [[0, 'Some Data 1'], [1, {from: 111, to: 1110}], [2, {from: "", to: "11/25/2014"}]]);
yadcf.exFilterColumn(oTable, [[0, ['Some Data 1','Some Data 2']]]);
* exGetColumnFilterVal
Description:		Allows to retrieve  column current filtered value (support ALL filter types!!!)
Arguments:			table_arg: (variable of the datatable),
column number:  column number from which we want the value
Usage example:		yadcf.exGetColumnFilterVal(oTable,1);
Return value:		String (for simple filter) / Object (for range filter) with from and to properties / Array of strings for multi_select filter
* exResetAllFilters
Description:		Allows to reset all filters externally/programmatically (support ALL filter types!!!) , perfect for adding a "reset all" button to your page!
Arguments:			table_arg: (variable of the datatable)
noRedraw:	(boolean) , use it if you don't want your table to be reloaded after the filter reset,
for example if you planning to call exFilterColumn function right after the exResetAllFilters (to avoid two AJAX requests)
Usage example:		yadcf.exResetAllFilters(oTable);
* exResetFilters
Description:		Allows to reset specific filters externally/programmatically (support ALL filter types!!!) , can be used for resetting one or more filters
Arguments:			table_arg: (variable of the datatable)
array with columns numbers
noRedraw:	(boolean) , use it if you don't want your table to be reloaded after the filter reset,
for example if you planning to call exFilterColumn function right after the exResetFilters (to avoid two AJAX requests)
Usage example:		yadcf.exResetAllFilters(oTable, [1,2]);
* initSelectPluginCustomTriggers
Description:		Allows to set any select jquery plugin initialize and refresh functions. jQuery selector will be passed to the user defined function to initialize and refresh the plugin.
Great for integrating any jquey select plugin  (Selectize / MultiSelect / etc)
Arguments:			initFunc:function which will initialize the plugin
refreshFunc:function that will refresh the plugin.
destroyFunc:function that will destroy the plugin (upon table destroy even trigger).
Usage example:		yadcf.initSelectPluginCustomTriggers(function($filterSelector){$filterSelector.multiselect({});}, function($filterSelector){$filterSelector.multiselect("refresh")}, , function($filterSelector){$filterSelector.multiselect("destroy")});
* exFilterExternallyTriggered
Description:		Triggers all the available filters, should be used only when the externally_triggered option used
Arguments:			table_arg: (variable of the datatable)
Usage example:		yadcf.exResetAllFilters(table_arg);
*
*
*
* Server-side processing API (see more on showcase):
*
* From server to client:
* In order to populate the filters with data from server (select / auto_complete / range_number_slider (min and max values), you should add to your current json respond the following properties:
* lets say for first column you add yadcf_data_0 filled with array of values, for column second column yadcf_data_1 and so on...
*
* From client to server:
* Read the filtered value like this (for first column) req.getParameter("columns[0][search][value]"); <- java code , php/.Net/etc you just need to get it from the request
* Range filter value will arrive delimited by  -yadcf_delim- , so just split it into an array or something like this: String[] minMax=sSearch_0.split("-yadcf_delim-");
*
*
* Filters position
*
*
* -------------
* Filters can be placed in the header (thead) or in the footer (tfoot) , it is defined by the second argument of yadcf constructor
or third argument of init function. Header location is the default position, use 'footer' in order to place the filters in the tfoot position
*
*
*
* Working with filters for multiple tables:
*
*
* -------------
* initMultipleTables
Description:		Allows to create filter that will affect multiple tables / multiple column(s) in multiple tables
Arguments:			Array of tables,
Array of objects with properties for each filter
Usage example:		yadcf.initMultipleTables([oTable, oTable2], [{
column_number: [0, 1], filter_container_id: 'multi-table-filter-0', filter_default_label: 'Filter all tables columns 1 and 2!'
},
{
column_number: [2], filter_container_id: 'multi-table-filter-1', filter_default_label: 'Filter all tables column 3!'
}]);
Valid properties:	filter_type: 'text' (default) / 'select' / 'multi_select',
column_number: not required (in that case the filter will be global)
can be either number(single column filter) or array of numbers(multiple columns filter)
filter_container_id: '' (required),
Note:				All the usual properties of yadcf should be supported in initMultipleTables too!
* initMultipleColumns
Description:		Allows to create filter that will affect multiple column(s) in in a particular table
Arguments:			Table variable,
Array of objects with properties for each filter
Usage example:		yadcf.initMultipleColumns(oTable, [{
column_number: [0, 1], filter_container_id: 'multi-table-filter-0', filter_default_label: 'Filter columns 1 and 2!'
},
{
column_number: [2, 3], filter_container_id: 'multi-table-filter-1', filter_default_label: 'Filter column 3 and 4!'
}]);
Valid properties:	filter_type: 'text' (default) / 'select' / 'multi_select',
column_number: not required (in that case the filter will be global)
can be either number(single column filter) or array of numbers(multiple columns filter)
filter_container_id: '' (required),
Note:				All the usual properties of yadcf should be supported in initMultipleColumns too!
*/
var yadcf=(function ($){
'use strict';
var tablesDT={},
oTables={},
oTablesIndex={},
options={},
plugins={},
exFilterColumnQueue=[],
yadcfDelay,
reA=/[^a-zA-Z]/g,
reN=/[^0-9]/g,
selectElementCustomInitFunc,
selectElementCustomRefreshFunc,
selectElementCustomDestroyFunc;
function getSettingsObjFromTable(dt){
var oDTSettings;
if($.fn.dataTable.Api){
oDTSettings=new $.fn.dataTable.Api(dt).settings()[0];
}else if(dt.fnSettings){
oDTSettings=dt.fnSettings();
}else if(typeof dt==='string'){
if($.fn.dataTable.fnIsDataTable($(dt)[0])){
oDTSettings=$(dt).eq(0).dataTable().fnSettings();
}}else if(dt.nodeName&&dt.nodeName.toLowerCase()==='table'){
if($.fn.dataTable.fnIsDataTable(dt.nodeName)){
oDTSettings=$(dt.nodeName).dataTable().fnSettings();
}}else if(dt instanceof jQuery){
if($.fn.dataTable.fnIsDataTable(dt[0])){
oDTSettings=dt.eq(0).dataTable().fnSettings();
}}else{
oDTSettings=dt;
}
return oDTSettings;
}
function arraySwapValueWithIndex(pArray){
var tmp=[],
i;
for (i=0; i < pArray.length; i++){
tmp[pArray[i]]=i;
}
return tmp;
}
function arraySwapValueWithIndex2(pArray){
var tmp=[],
i;
for (i=0; i < pArray.length; i++){
tmp[pArray[i]._ColReorder_iOrigCol]=i;
}
return tmp;
}
function initColReorder2(settingsDt, table_selector_jq_friendly){
if(settingsDt.oSavedState!=undefined&&settingsDt.oSavedState.ColReorder!==undefined){
if(plugins[table_selector_jq_friendly]===undefined){
plugins[table_selector_jq_friendly]={};
plugins[table_selector_jq_friendly].ColReorder=arraySwapValueWithIndex(settingsDt.oSavedState.ColReorder);
}}else if(settingsDt.aoColumns[0]._ColReorder_iOrigCol!==undefined){
if(plugins[table_selector_jq_friendly]===undefined){
plugins[table_selector_jq_friendly]={};
plugins[table_selector_jq_friendly].ColReorder=arraySwapValueWithIndex2(settingsDt.aoColumns);
}}
}
function initColReorderFromEvent(table_selector_jq_friendly){
plugins[table_selector_jq_friendly]=undefined;
}
function columnsArrayToString(column_number){
var column_number_obj={};
if(column_number!==undefined){
if(column_number instanceof Array){
column_number_obj.column_number_str=column_number.join('_');
}else{
column_number_obj.column_number_str=column_number;
column_number=[];
column_number.push(column_number_obj.column_number_str);
}}else{
column_number_obj.column_number_str='global';
}
column_number_obj.column_number=column_number;
return column_number_obj;
}
function getOptions(selector){
return options[selector];
}
function eventTargetFixUp(pEvent){
if(pEvent.target===undefined){
pEvent.target=pEvent.srcElement;
}
return pEvent;
}
function dot2obj(tmpObj, dot_refs){
var i=0;
dot_refs=dot_refs.split(".");
for (i=0; i < dot_refs.length; i++){
tmpObj=tmpObj[dot_refs[i]];
}
return tmpObj;
}
function setOptions(selector_arg, options_arg, params){
var tmpOptions={},
i,
j,
col_num_as_int,
default_options={
filter_type:"select",
enable_auto_complete:false,
sort_as:"alpha",
sort_order:"asc",
date_format:"mm/dd/yyyy",
ignore_char:undefined,
filter_match_mode:"contains",
select_type:undefined,
select_type_options:{},
case_insensitive:true,
column_data_type: 'text',
html_data_type: 'text',
exclude_label: 'exclude',
style_class: '',
datepicker_type: 'jquery-ui',
range_data_type: 'single',
range_data_type_delim: '-'
},
adaptContainerCssClassImpl=function (dummy){ return ''; };
$.extend(true, default_options, params);
if(options_arg.length===undefined){
options[selector_arg]=options_arg;
return;
}
for (i=0; i < options_arg.length; i++){
if(options_arg[i].select_type==='select2'){
default_options.select_type_options={
adaptContainerCssClass: adaptContainerCssClassImpl
};}
if(default_options.externally_triggered===true){
options_arg[i].filter_reset_button_text=false;
}
if(options_arg[i].filter_type!==undefined&&options_arg[i].filter_type.indexOf('custom_func')!==-1){
if(options_arg[i].custom_func===undefined){
console.log('Error: You are trying to use filter_type: "custom_func / multi_select_custom_func" for column ' + options_arg[i].column_number + ' but there is no such custom_func attribute provided (custom_func: \"function reference goes here...\")');
return;
}}
col_num_as_int=+options_arg[i].column_number;
if(isNaN(col_num_as_int)){
tmpOptions[options_arg[i].column_number_str]=$.extend(true, {}, default_options, options_arg[i]);
}else{
tmpOptions[col_num_as_int]=$.extend(true, {}, default_options, options_arg[i]);
}}
options[selector_arg]=tmpOptions;
}
function yadcfVersionCheck(version){
var aThis=$.fn.dataTable.ext.sVersion.split('.'),
aThat=version.split('.'),
iThis,
iThat,
i,
iLen;
for (i=0, iLen=aThat.length; i < iLen; i++){
iThis=parseInt(aThis[i], 10)||0;
iThat=parseInt(aThat[i], 10)||0;
if(iThis===iThat){
continue;
}
return iThis > iThat;
}
return true;
}
function calculateColumnNumber(column_number, pTable){
var col_num_visible_iter,
col_num_visible=column_number;
for (col_num_visible_iter=0; col_num_visible_iter < pTable.fnSettings().aoColumns.length&&col_num_visible_iter < column_number; col_num_visible_iter++){
if(pTable.fnSettings().aoColumns[col_num_visible_iter].bVisible===false){
col_num_visible++;
}}
return col_num_visible;
}
function resetIApiIndex(){
$.fn.dataTableExt.iApiIndex=0;
}
function escapeRegExp(string){
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
function replaceAll(string, find, replace){
return string.replace(new RegExp(escapeRegExp(find), 'g'), replace);
}
function generateTableSelectorJQFriendly(tmpStr){
tmpStr=replaceAll(tmpStr, ".", "-");
tmpStr=replaceAll(tmpStr, ' ', '');
return tmpStr.replace(":", "-").replace("(", "").replace(")", "").replace("#", "-");
}
function generateTableSelectorJQFriendlyNew(tmpStr){
tmpStr=replaceAll(tmpStr, ":", "-");
tmpStr=replaceAll(tmpStr, "(", "");
tmpStr=replaceAll(tmpStr, ")", "");
tmpStr=replaceAll(tmpStr, ",", "");
tmpStr=replaceAll(tmpStr, ".", "-");
tmpStr=replaceAll(tmpStr, "#", "-");
return tmpStr;
}
yadcfDelay=(function (){
var timer=0;
return function (callback, ms, param){
clearTimeout(timer);
timer=setTimeout(function (){
callback(param);
}, ms);
return timer;
};}());
function initializeSelectPlugin(selectType, $selectObject, select_type_options){
if(selectType==='chosen'){
$selectObject.chosen(select_type_options);
$selectObject.next().attr("onclick", "yadcf.stopPropagation(event);").attr("onmousedown", "yadcf.stopPropagation(event);");
}else if(selectType==='select2'){
$selectObject.select2(select_type_options);
if($selectObject.next().hasClass('select2-container')){
$selectObject.next().attr("onclick", "yadcf.stopPropagation(event);").attr("onmousedown", "yadcf.stopPropagation(event);");
}}else if(selectType==='custom_select'){
selectElementCustomInitFunc($selectObject);
$selectObject.next().attr("onclick", "yadcf.stopPropagation(event);").attr("onmousedown", "yadcf.stopPropagation(event);");
}}
function refreshSelectPlugin(columnObj, $selectObject, val){
var selectType=columnObj.select_type,
select_type_options=columnObj.select_type_options;
if(selectType==='chosen'){
$selectObject.trigger("chosen:updated");
}else if(selectType==='select2'){
$selectObject.select2(select_type_options);
$selectObject.val(val);
}else if(selectType==='custom_select'){
selectElementCustomRefreshFunc($selectObject);
}}
function initSelectPluginCustomTriggers(initFunc, refreshFunc, destroyFunc){
selectElementCustomInitFunc=initFunc;
selectElementCustomRefreshFunc=refreshFunc;
selectElementCustomDestroyFunc=destroyFunc;
}
function yadcfMatchFilterString(table_arg, column_number, selected_value, filter_match_mode, multiple, exclude){
var case_insensitive=yadcf.getOptions(table_arg.selector)[column_number].case_insensitive,
ret_val;
table_arg.fnSettings().aoPreSearchCols[column_number].bSmart=false;
table_arg.fnSettings().aoPreSearchCols[column_number].bRegex=true;
table_arg.fnSettings().aoPreSearchCols[column_number].bCaseInsensitive=case_insensitive;
if(multiple===undefined||multiple===false){
if(exclude!==true){
if(filter_match_mode==="contains"){
table_arg.fnSettings().aoPreSearchCols[column_number].bSmart=true;
table_arg.fnSettings().aoPreSearchCols[column_number].bRegex=false;
ret_val=selected_value;
}else if(filter_match_mode==="exact"){
ret_val="^" + selected_value + "$";
}else if(filter_match_mode==="startsWith"){
ret_val="^" + selected_value;
}else if(filter_match_mode==="regex"){
ret_val=selected_value;
}}else{
ret_val="^((?!" + selected_value + ").)*$";
}}else{
if(filter_match_mode==="contains"){
ret_val=selected_value.join("|");
}else if(filter_match_mode==="exact"){
ret_val="^(" + selected_value.join("|") + ")$";
}else if(filter_match_mode==="startsWith"){
ret_val="^(" + selected_value.join("|") + ")";
}else if(filter_match_mode==="regex"){
ret_val=selected_value;
}}
return ret_val;
}
function yadcfMatchFilter(oTable, selected_value, filter_match_mode, column_number, exclude){
var case_insensitive=yadcf.getOptions(oTable.selector)[column_number].case_insensitive;
if(exclude!==true){
if(filter_match_mode==="contains"){
oTable.fnFilter(selected_value, column_number, false, true, true, case_insensitive);
}else if(filter_match_mode==="exact"){
selected_value=escapeRegExp(selected_value);
oTable.fnFilter("^" + selected_value + "$", column_number, true, false, true, case_insensitive);
}else if(filter_match_mode==="startsWith"){
selected_value=escapeRegExp(selected_value);
oTable.fnFilter("^" + selected_value, column_number, true, false, true, case_insensitive);
}else if(filter_match_mode==="regex"){
try {
new RegExp(selected_value);
} catch (error){
return;
}
oTable.fnFilter(selected_value, column_number, true, false, true, case_insensitive);
}}else{
oTable.fnFilter("^((?!" + selected_value + ").)*$", column_number, true, false, true, case_insensitive);
}}
function yadcfParseMatchFilter(tmpStr, filter_match_mode){
var retVal;
if(filter_match_mode==="contains"){
retVal=tmpStr;
}else if(filter_match_mode==="exact"){
retVal=tmpStr.substring(1, tmpStr.length - 1);
retVal=retVal.replace(/([\\])/g, '');
}else if(filter_match_mode==="startsWith"){
retVal=tmpStr.substring(1, tmpStr.length);
retVal=retVal.replace(/([\\])/g, '');
}else if(filter_match_mode==="regex"){
retVal=tmpStr;
}
return retVal;
}
function doFilterCustomDateFunc(arg, table_selector_jq_friendly, column_number){
var oTable=oTables[table_selector_jq_friendly],
yadcfState,
columnObj=getOptions(oTable.selector)[column_number];
if(arg==='clear'&&exGetColumnFilterVal(oTable, column_number)===''){
return;
}
if(arg.value!==undefined&&arg.value!=="-1"){
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).addClass("inuse");
}else{
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).val('-1').focus();
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse");
refreshSelectPlugin(columnObj, $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number), '-1');
}
if(!oTable.fnSettings().oLoadedState){
oTable.fnSettings().oLoadedState={};
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}
if(oTable.fnSettings().oFeatures.bStateSave===true){
if(oTable.fnSettings().oLoadedState.yadcfState!==undefined&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly]!==undefined){
oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number] =
{
'from':arg.value
};}else{
yadcfState={};
yadcfState[table_selector_jq_friendly]=[];
yadcfState[table_selector_jq_friendly][column_number]={
'from':arg.value
};
oTable.fnSettings().oLoadedState.yadcfState=yadcfState;
}
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}
oTable.fnDraw();
}
function calcColumnNumberFilter(settingsDt, column_number, table_selector_jq_friendly){
var column_number_filter;
if((settingsDt.oSavedState!=undefined&&settingsDt.oSavedState.ColReorder!==undefined)
|| settingsDt._colReorder!=undefined
|| (plugins[table_selector_jq_friendly]!==undefined&&plugins[table_selector_jq_friendly].ColReorder!==undefined)){
initColReorder2(settingsDt, table_selector_jq_friendly);
column_number_filter=plugins[table_selector_jq_friendly].ColReorder[column_number];
}else{
column_number_filter=column_number;
}
return column_number_filter;
}
function doFilter(arg, table_selector_jq_friendly, column_number, filter_match_mode){
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
var oTable=oTables[table_selector_jq_friendly],
selected_value,
column_number_filter,
columnObj,
settingsDt=getSettingsObjFromTable(oTable);
column_number_filter=calcColumnNumberFilter(settingsDt, column_number, table_selector_jq_friendly);
columnObj=getOptions(oTable.selector)[column_number];
if(arg==="clear"){
if(exGetColumnFilterVal(oTable, column_number)===''){
return;
}
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).val("-1").focus();
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse");
$(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val", "-1");
oTable.fnFilter("", column_number_filter);
resetIApiIndex();
refreshSelectPlugin(columnObj, $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number), '-1');
return;
}
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).addClass("inuse");
$(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val", arg.value);
selected_value=$.trim($(arg).find('option:selected').val());
if(arg.value!=="-1"){
yadcfMatchFilter(oTable, selected_value, filter_match_mode, column_number_filter);
}else{
oTable.fnFilter("", column_number_filter);
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse");
}
resetIApiIndex();
}
function doFilterMultiSelect(arg, table_selector_jq_friendly, column_number, filter_match_mode){
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
var oTable=oTables[table_selector_jq_friendly],
selected_values=$(arg).val(),
selected_values_trimmed=[],
i,
stringForSearch,
column_number_filter,
settingsDt=getSettingsObjFromTable(oTable);
column_number_filter=calcColumnNumberFilter(settingsDt, column_number, table_selector_jq_friendly);
$(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val", selected_values);
if(selected_values!==null){
for (i=selected_values.length - 1; i >=0; i--){
if(selected_values[i]==="-1"){
selected_values.splice(i, 1);
break;
}}
for (i=0; i < selected_values.length; i++){
selected_values_trimmed.push($.trim(selected_values[i]));
}
if(selected_values_trimmed.length!==0){
stringForSearch=selected_values_trimmed.join('narutouzomaki');
stringForSearch=stringForSearch.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
stringForSearch=stringForSearch.split('narutouzomaki').join('|');
if(filter_match_mode==="contains"){
oTable.fnFilter(stringForSearch, column_number_filter, true, false, true);
}else if(filter_match_mode==="exact"){
oTable.fnFilter("^(" + stringForSearch + ")$", column_number_filter, true, false, true);
}else if(filter_match_mode==="startsWith"){
oTable.fnFilter("^(" + stringForSearch + ")", column_number_filter, true, false, true);
}else if(filter_match_mode==="regex"){
oTable.fnFilter(stringForSearch, column_number_filter, true, false, true);
}}else{
oTable.fnFilter("", column_number_filter);
}}else{
oTable.fnFilter("", column_number_filter);
}
resetIApiIndex();
}
function yadcfParseMatchFilterMultiSelect(tmpStr, filter_match_mode){
var retVal;
if(filter_match_mode==="contains"){
retVal=tmpStr;
}else if(filter_match_mode==="exact"){
retVal=tmpStr.substring(1, tmpStr.length - 1);
retVal=retVal.substring(1, retVal.length - 1);
}else if(filter_match_mode==="startsWith"){
retVal=tmpStr.substring(1, tmpStr.length);
retVal=retVal.substring(1, retVal.length - 1);
}else if(filter_match_mode==="regex"){
retVal=tmpStr;
}
return retVal;
}
function doFilterAutocomplete(arg, table_selector_jq_friendly, column_number, filter_match_mode){
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
var oTable=oTables[table_selector_jq_friendly],
column_number_filter,
settingsDt=getSettingsObjFromTable(oTable);
column_number_filter=calcColumnNumberFilter(settingsDt, column_number, table_selector_jq_friendly);
if(arg==="clear"){
if(exGetColumnFilterVal(oTable, column_number)===''){
return;
}
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).val("").focus();
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse");
$(document).removeData("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val");
oTable.fnFilter("", column_number_filter);
resetIApiIndex();
return;
}
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).addClass("inuse");
$(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val", arg.value);
yadcfMatchFilter(oTable, arg.value, filter_match_mode, column_number_filter);
resetIApiIndex();
}
function autocompleteSelect(event, ui){
event=eventTargetFixUp(event);
var table_column=event.target.id.replace("yadcf-filter-", ""),
dashIndex=table_column.lastIndexOf("-"),
table_selector_jq_friendly=table_column.substring(0, dashIndex),
col_num=parseInt(table_column.substring(dashIndex + 1), 10),
filter_match_mode=$(event.target).attr("filter_match_mode");
doFilterAutocomplete(ui.item, table_selector_jq_friendly, col_num, filter_match_mode);
}
function sortNumAsc(a, b){
return a - b;
}
function sortNumDesc(a, b){
return b - a;
}
function findMinInArray(array, columnObj){
var narray=[], i, num;
for (i=0; i < array.length; i++){
if(array[i]!==null){
if(columnObj.ignore_char!==undefined){
array[i]=array[i].toString().replace(columnObj.ignore_char, "");
}
if(columnObj.range_data_type==='single'){
num=+array[i];
}else{
num=array[i].split(columnObj.range_data_type_delim);
num=num[0];
}
if(!isNaN(num)){
narray.push(num);
}}
}
return Math.min.apply(Math, narray);
}
function findMaxInArray(array, columnObj){
var narray=[], i, num;
for (i=0; i < array.length; i++){
if(array[i]!==null){
if(columnObj.ignore_char!==undefined){
array[i]=array[i].toString().replace(columnObj.ignore_char, "");
}
if(columnObj.range_data_type==='single'){
num=+array[i];
}else{
num=array[i].split(columnObj.range_data_type_delim);
num=num[1];
}
if(!isNaN(num)){
narray.push(num);
}}
}
return Math.max.apply(Math, narray);
}
function addRangeNumberAndSliderFilterCapability(table_selector_jq_friendly, fromId, toId, col_num, ignore_char, sliderMaxMin){
$.fn.dataTableExt.afnFiltering.push(function (settingsDt, aData, iDataIndex, rowData){
var min,
max,
val,
retVal=false,
table_selector_jq_friendly_local=table_selector_jq_friendly,
current_table_selector_jq_friendly=yadcf.generateTableSelectorJQFriendly(settingsDt.oInstance.selector),
ignore_char_local=ignore_char,
column_data_type,
html_data_type,
i,
columnObjKey,
columnObj,
column_number_filter,
valFrom,
valTo;
if(table_selector_jq_friendly_local!==current_table_selector_jq_friendly){
return true;
}
columnObj=getOptions(settingsDt.oInstance.selector)[col_num];
if(columnObj.filter_type==='range_number_slider'){
min=$('#' + fromId).text();
max=$('#' + toId).text();
}else{
min=$('#' + fromId).val();
max=$('#' + toId).val();
}
column_number_filter=calcColumnNumberFilter(settingsDt, col_num, table_selector_jq_friendly);
if(rowData!==undefined){
aData=rowData;
if(columnObj.column_number_data!==undefined){
column_number_filter=columnObj.column_number_data;
val=dot2obj(aData, column_number_filter);
}else{
val=aData[column_number_filter];
}}else{
val=aData[column_number_filter];
}
if(!isFinite(min)||!isFinite(max)){
return true;
}
column_data_type=columnObj.column_data_type;
html_data_type=columnObj.html_data_type;
if(column_data_type==="html"||column_data_type==="rendered_html"){
if(html_data_type===undefined){
html_data_type="text";
}
if($(val).length!==0){
switch (html_data_type){
case "text":
val=$(val).text();
break;
case "value":
val=$(val).val();
break;
case "id":
val=val.id;
break;
case "selector":
val=$(val).find(columnObj.html_data_selector).text();
break;
}}
}else{
if(typeof val==='object'){
if(columnObj.html5_data!==undefined){
val=val['@' + columnObj.html5_data];
}}
}
if(ignore_char_local!==undefined){
min=min.replace(ignore_char_local, "");
max=max.replace(ignore_char_local, "");
if(val){
val=val.toString().replace(ignore_char_local, "");
}else{
val="";
}}
if(columnObj.filter_type==='range_number_slider'){
if(val===''&&((+min)!==sliderMaxMin.min||(+max)!==sliderMaxMin.max)){
return false;
}}else{
if(val===''&&(min!==''||max!=='')){
return false;
}}
min=(min!=="") ? (+min):min;
max=(max!=="") ? (+max):max;
if(columnObj.range_data_type==='single'){
val=(val!=="") ? (+val):val;
if(min===""&&max===""){
retVal=true;
}else if(min===""&&val <=max){
retVal=true;
}else if(min <=val&&""===max){
retVal=true;
}else if(min <=val&&val <=max){
retVal=true;
}else if(val===''||isNaN(val)){
retVal=true;
}}else if(columnObj.range_data_type==='range'){
val=val.split(columnObj.range_data_type_delim);
valFrom=(val[0]!=="") ? (+val[0]):val[0];
valTo=(val[1]!=="") ? (+val[1]):val[1];
if(min===""&&max===""){
retVal=true;
}else if(min===""&&valTo <=max){
retVal=true;
}else if(min <=valFrom&&""===max){
retVal=true;
}else if(min <=valFrom&&valTo <=max){
retVal=true;
}else if((valFrom===''||isNaN(valFrom))&&(valTo===''||isNaN(valTo))){
retVal=true;
}}
return retVal;
}
);
}
function addCustomFunctionFilterCapability(table_selector_jq_friendly, filterId, col_num){
$.fn.dataTableExt.afnFiltering.push(function (settingsDt, aData, iDataIndex, stateVal){
var filterVal=$('#' + filterId).val(),
columnVal,
retVal=false,
table_selector_jq_friendly_local=table_selector_jq_friendly,
current_table_selector_jq_friendly=yadcf.generateTableSelectorJQFriendly(settingsDt.oInstance.selector),
custom_func,
column_number_filter;
if(table_selector_jq_friendly_local!==current_table_selector_jq_friendly||filterVal==='-1'){
return true;
}
column_number_filter=calcColumnNumberFilter(settingsDt, col_num, table_selector_jq_friendly);
columnVal=aData[column_number_filter]==="-" ? 0:aData[column_number_filter];
custom_func=getOptions(settingsDt.oInstance.selector)[col_num].custom_func;
retVal=custom_func(filterVal, columnVal, aData);
return retVal;
}
);
}
function addRangeDateFilterCapability(table_selector_jq_friendly, fromId, toId, col_num, date_format){
$.fn.dataTableExt.afnFiltering.push(function (settingsDt, aData, iDataIndex, rowData){
var min=document.getElementById(fromId)!==null ? document.getElementById(fromId).value:"",
max=document.getElementById(toId)!==null ? document.getElementById(toId).value:"",
val,
retVal=false,
table_selector_jq_friendly_local=table_selector_jq_friendly,
current_table_selector_jq_friendly=yadcf.generateTableSelectorJQFriendly(settingsDt.oInstance.selector),
column_data_type,
html_data_type,
i,
columnObjKey,
columnObj,
column_number_filter,
min_time,
max_time,
dataRenderFunc;
if(table_selector_jq_friendly_local!==current_table_selector_jq_friendly){
return true;
}
columnObj=getOptions(settingsDt.oInstance.selector)[col_num];
column_number_filter=calcColumnNumberFilter(settingsDt, col_num, table_selector_jq_friendly);
if(typeof columnObj.column_number_data==='function'||typeof columnObj.column_number_render==='function'){
dataRenderFunc=true;
}
if(rowData!==undefined&&dataRenderFunc!==true){
if(columnObj.column_number_data!==undefined){
column_number_filter=columnObj.column_number_data;
val=dot2obj(rowData, column_number_filter);
}else{
val=rowData[column_number_filter];
}}else{
val=aData[column_number_filter];
}
column_data_type=columnObj.column_data_type;
html_data_type=columnObj.html_data_type;
if(column_data_type==="html"||column_data_type==="rendered_html"){
if(html_data_type===undefined){
html_data_type="text";
}
if($(val).length!==0){
switch (html_data_type){
case "text":
val=$(val).text();
break;
case "value":
val=$(val).val();
break;
case "id":
val=val.id;
break;
case "selector":
val=$(val).find(columnObj.html_data_selector).text();
break;
}}
}else{
if(typeof val==='object'){
if(columnObj.html5_data!==undefined){
val=val['@' + columnObj.html5_data];
}}
}
if(val===''&&(min!==''||max!=='')){
return false;
}
try {
if(min.length===(date_format.length + 2)||columnObj.datepicker_type==='bootstrap-datetimepicker'){
if(columnObj.datepicker_type==='jquery-ui'){
min=(min!=="") ? $.datepicker.parseDate(date_format, min):min;
}else if(columnObj.datepicker_type==='bootstrap-datetimepicker'){
min=(min!=="") ? moment(min, date_format).toDate():min;
}}
} catch (err1){}
try {
if(max.length===(date_format.length + 2)||columnObj.datepicker_type==='bootstrap-datetimepicker'){
if(columnObj.datepicker_type==='jquery-ui'){
max=(max!=="") ? $.datepicker.parseDate(date_format, max):max;
}else if(columnObj.datepicker_type==='bootstrap-datetimepicker'){
max=(max!=="") ? moment(max, date_format).toDate():max;
}}
} catch (err2){}
try {
if(columnObj.datepicker_type==='jquery-ui'){
val=(val!=="") ? $.datepicker.parseDate(date_format, val):val;
}else if(columnObj.datepicker_type==='bootstrap-datetimepicker'){
val=(val!=="") ? moment(val, date_format).toDate():val;
}} catch (err3){}
if(date_format.toLowerCase()!=='hh:mm'){
if((min===""||!(min instanceof Date))&&(max===""||!(max instanceof Date))){
retVal=true;
}else if(min===""&&val <=max){
retVal=true;
}else if(min <=val&&""===max){
retVal=true;
}else if(min <=val&&val <=max){
retVal=true;
}}else{
min_time=moment(min);
min_time=min_time.minutes() + min_time.hours() * 60;
if(isNaN(min_time)){
min_time='';
}
max_time=moment(max);
max_time=max_time.minutes() + max_time.hours() * 60;
if(isNaN(max_time)){
max_time='';
}
val=moment(val);
val=val.minutes() + val.hours() * 60;
if((min===""||!(moment(min, date_format).isValid()))&&(max===""||!(moment(max, date_format).isValid()))){
retVal=true;
}else if(min_time===""&&val <=max_time){
retVal=true;
}else if(min_time <=val&&""===max_time){
retVal=true;
}else if(min_time <=val&&val <=max_time){
retVal=true;
}}
return retVal;
}
);
}
function addRangeNumberFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, ignore_char){
var fromId="yadcf-filter-" + table_selector_jq_friendly + "-from-" + column_number,
toId="yadcf-filter-" + table_selector_jq_friendly + "-to-" + column_number,
filter_selector_string_tmp,
filter_wrapper_id,
oTable,
columnObj,
filterActionStr;
filter_wrapper_id="yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number;
if($("#" + filter_wrapper_id).length > 0){
return;
}
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
oTable=oTables[table_selector_jq_friendly];
columnObj=getOptions(oTable.selector)[column_number];
$(filter_selector_string).append("<div onmousedown=\"yadcf.stopPropagation(event);\" onclick=\"yadcf.stopPropagation(event);\"  id=\"" + filter_wrapper_id + "\" class=\"yadcf-filter-wrapper\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-filter-wrapper";
filter_selector_string_tmp=filter_selector_string;
$(filter_selector_string).append("<div id=\"yadcf-filter-wrapper-inner-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter-wrapper-inner\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-filter-wrapper-inner";
filterActionStr='onkeyup="yadcf.rangeNumberKeyUP(\'' + table_selector_jq_friendly + '\',event);"';
if(columnObj.externally_triggered===true){
filterActionStr='';
}
$(filter_selector_string).append("<input onkeydown=\"yadcf.preventDefaultForEnter(event);\" placeholder=\"" + filter_default_label[0] + "\" id=\"" + fromId + "\" class=\"yadcf-filter-range-number yadcf-filter-range\" " + filterActionStr + "></input>");
$(filter_selector_string).append("<span class=\"yadcf-filter-range-number-seperator\" >" +
"</span>");
$(filter_selector_string).append("<input onkeydown=\"yadcf.preventDefaultForEnter(event);\" placeholder=\"" + filter_default_label[1] + "\" id=\"" + toId + "\" class=\"yadcf-filter-range-number yadcf-filter-range\" " + filterActionStr + "></input>");
if(filter_reset_button_text!==false){
$(filter_selector_string_tmp).append("<button type=\"button\" onmousedown=\"yadcf.stopPropagation(event);\" " +
"onclick=\"yadcf.stopPropagation(event);yadcf.rangeClear('" + table_selector_jq_friendly + "',event," + column_number + "); return false;\" class=\"yadcf-filter-reset-button\">" + filter_reset_button_text + "</button>");
}
if(oTable.fnSettings().oFeatures.bStateSave===true&&oTable.fnSettings().oLoadedState){
if(oTable.fnSettings().oLoadedState.yadcfState&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly]&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number]){
$('#' + fromId).val(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from);
if(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from!==""){
$('#' + fromId).addClass("inuse");
}
$('#' + toId).val(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to);
if(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to!==""){
$('#' + toId).addClass("inuse");
}}
}
resetIApiIndex();
if(oTable.fnSettings().oFeatures.bServerSide!==true){
addRangeNumberAndSliderFilterCapability(table_selector_jq_friendly, fromId, toId, column_number, ignore_char);
}}
function dateSelectSingle(pDate, pEvent, clear){
var oTable,
date,
event,
column_number,
dashIndex,
table_selector_jq_friendly,
date_str,
column_number_filter,
settingsDt,
columnObj;
if(pDate.type==='dp'){
event=pDate.target;
}else{
date=pDate;
event=pEvent;
}
column_number=$(event).attr('id').replace('yadcf-filter-', '').replace('-date', '').replace('-reset', '');
dashIndex=column_number.lastIndexOf("-");
table_selector_jq_friendly=column_number.substring(0, dashIndex);
column_number=column_number.substring(dashIndex + 1);
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
oTable=oTables[table_selector_jq_friendly];
settingsDt=getSettingsObjFromTable(oTable);
columnObj=getOptions(oTable.selector)[column_number];
if(pDate.type==='dp'){
if(moment($(event).val(), columnObj.date_format).isValid()){
date=$(event).val();
}else{
clear='clear';
}
$(event).blur();
}
column_number_filter=calcColumnNumberFilter(settingsDt, column_number, table_selector_jq_friendly);
if(clear===undefined){
oTable.fnFilter(date, column_number_filter);
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).addClass("inuse");
}else if(clear==='clear'){
if(exGetColumnFilterVal(oTable, column_number)===''){
return;
}
oTable.fnFilter('', column_number_filter);
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val('').removeClass("inuse");
}
resetIApiIndex();
}
function dateSelect(pDate, pEvent){
var oTable,
column_number,
dashIndex,
table_selector_jq_friendly,
yadcfState,
from,
to,
date,
event,
columnObj;
if(pDate.type==='dp'){
event=pDate.target;
}else{
date=pDate;
event=pEvent;
}
column_number=$(event).attr("id").replace("yadcf-filter-", "").replace("-from-date", "").replace("-to-date", "");
dashIndex=column_number.lastIndexOf("-");
table_selector_jq_friendly=column_number.substring(0, dashIndex);
column_number=column_number.substring(dashIndex + 1);
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
oTable=oTables[table_selector_jq_friendly];
columnObj=getOptions(oTable.selector)[column_number];
if(pDate.type==='dp'){
event=pDate.target;
if(pDate.date===false||!moment($(event).val(), columnObj.date_format).isValid()){
$(event).removeClass("inuse");
$(event).data("DateTimePicker").minDate(false);
}else{
$(event).addClass("inuse");
}
$(event).blur();
}else{
$(event).addClass("inuse");
}
if($(event).attr("id").indexOf("-from-")!==-1){
from=document.getElementById($(event).attr("id")).value;
to=document.getElementById($(event).attr("id").replace("-from-", "-to-")).value;
}else{
to=document.getElementById($(event).attr("id")).value;
from=document.getElementById($(event).attr("id").replace("-to-", "-from-")).value;
}
if(oTable.fnSettings().oFeatures.bServerSide!==true){
oTable.fnDraw();
}else{
oTable.fnFilter(from + '-yadcf_delim-' + to, column_number);
}
if(!oTable.fnSettings().oLoadedState){
oTable.fnSettings().oLoadedState={};
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}
if(oTable.fnSettings().oFeatures.bStateSave===true){
if(oTable.fnSettings().oLoadedState.yadcfState!==undefined&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly]!==undefined){
oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number] =
{
'from':from,
'to':to
};}else{
yadcfState={};
yadcfState[table_selector_jq_friendly]=[];
yadcfState[table_selector_jq_friendly][column_number]={
'from':from,
'to':to
};
oTable.fnSettings().oLoadedState.yadcfState=yadcfState;
}
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}
resetIApiIndex();
}
function addRangeDateFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, date_format){
var fromId="yadcf-filter-" + table_selector_jq_friendly + "-from-date-" + column_number,
toId="yadcf-filter-" + table_selector_jq_friendly + "-to-date-" + column_number,
filter_selector_string_tmp,
filter_wrapper_id,
oTable,
columnObj,
datepickerObj={},
filterActionStr,
filterClass='',
$fromInput,
$toInput,
innerWrapperAdditionalClass='';
filter_wrapper_id="yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number;
if($("#" + filter_wrapper_id).length > 0){
return;
}
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
oTable=oTables[table_selector_jq_friendly];
columnObj=getOptions(oTable.selector)[column_number];
if(columnObj.datepicker_type==='bootstrap-datepicker'){
innerWrapperAdditionalClass='input-daterange';
}
$(filter_selector_string).append("<div onmousedown=\"yadcf.stopPropagation(event);\" onclick=\"yadcf.stopPropagation(event);\"  id=\"" + filter_wrapper_id + "\" class=\"yadcf-filter-wrapper\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-filter-wrapper";
filter_selector_string_tmp=filter_selector_string;
$(filter_selector_string).append("<div id=\"yadcf-filter-wrapper-inner-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter-wrapper-inner " + innerWrapperAdditionalClass + "\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-filter-wrapper-inner";
filterActionStr='onkeyup="yadcf.rangeDateKeyUP(\'' + table_selector_jq_friendly + '\',\'' + date_format + '\',event);"';
if(columnObj.externally_triggered===true){
filterActionStr='';
}
$(filter_selector_string).append("<input onkeydown=\"yadcf.preventDefaultForEnter(event);\" placeholder=\"" + filter_default_label[0] + "\" id=\"" + fromId + "\" class=\"yadcf-filter-range-date yadcf-filter-range\" " + filterActionStr + "></input>");
$(filter_selector_string).append("<span class=\"yadcf-filter-range-date-seperator\" >" +
"</span>");
$(filter_selector_string).append("<input onkeydown=\"yadcf.preventDefaultForEnter(event);\" placeholder=\"" + filter_default_label[1] + "\" id=\"" + toId + "\" class=\"yadcf-filter-range-date yadcf-filter-range\" " + filterActionStr + "></input>");
$fromInput=$("#" + fromId);
$toInput=$("#" + toId);
if(filter_reset_button_text!==false){
$(filter_selector_string_tmp).append("<button type=\"button\" onmousedown=\"yadcf.stopPropagation(event);\" " +
"onclick=\"yadcf.stopPropagation(event);yadcf.rangeClear('" + table_selector_jq_friendly + "',event," + column_number + "); return false;\" class=\"yadcf-filter-reset-button\">" + filter_reset_button_text + "</button>");
}
if(columnObj.datepicker_type==='jquery-ui'){
datepickerObj.dateFormat=date_format;
}else if(columnObj.datepicker_type==='bootstrap-datetimepicker'){
datepickerObj.format=date_format;
}
if(columnObj.externally_triggered!==true){
if(columnObj.datepicker_type==='jquery-ui'){
datepickerObj.onSelect=dateSelect;
}}
datepickerObj=$.extend({}, datepickerObj, columnObj.filter_plugin_options);
if(columnObj.datepicker_type==='jquery-ui'){
$fromInput.datepicker($.extend(datepickerObj, {onClose: function (selectedDate){
$toInput.datepicker('option', 'minDate', selectedDate);
}}));
$toInput.datepicker($.extend(datepickerObj, {onClose: function (selectedDate){
$fromInput.datepicker('option', 'maxDate', selectedDate);
}}));
}else if(columnObj.datepicker_type==='bootstrap-datetimepicker'){
datepickerObj.useCurrent=false;
$fromInput.datetimepicker(datepickerObj);
$toInput.datetimepicker(datepickerObj);
if(datepickerObj.format.toLowerCase()!=='hh:mm'){
$fromInput.on("dp.change", function (e){
$toInput.data("DateTimePicker").minDate(e.date);
});
$toInput.on("dp.change", function (e){
$fromInput.data("DateTimePicker").maxDate(e.date);
});
if(columnObj.externally_triggered!==true){
$fromInput.add($toInput).on('dp.change', dateSelect);
}}else{
if(columnObj.externally_triggered!==true){
$fromInput.add($toInput).on('dp.hide', dateSelect);
}}
}else if(columnObj.datepicker_type==='bootstrap-datepicker'){
}
if(oTable.fnSettings().oFeatures.bStateSave===true&&oTable.fnSettings().oLoadedState){
if(oTable.fnSettings().oLoadedState.yadcfState&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly]&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number]){
$('#' + fromId).val(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from);
if(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from!==""){
$('#' + fromId).addClass("inuse");
}
$('#' + toId).val(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to);
if(oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to!==""){
$('#' + toId).addClass("inuse");
}}
}
if(oTable.fnSettings().oFeatures.bServerSide!==true){
addRangeDateFilterCapability(table_selector_jq_friendly, fromId, toId, column_number, date_format);
}
resetIApiIndex();
}
function addDateFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, date_format){
var dateId="yadcf-filter-" + table_selector_jq_friendly + "-" + column_number,
filter_selector_string_tmp,
filter_wrapper_id,
oTable,
columnObj,
datepickerObj={},
filterActionStr;
filter_wrapper_id="yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number;
if($("#" + filter_wrapper_id).length > 0){
return;
}
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
oTable=oTables[table_selector_jq_friendly];
columnObj=getOptions(oTable.selector)[column_number];
$(filter_selector_string).append("<div onmousedown=\"yadcf.stopPropagation(event);\" onclick=\"yadcf.stopPropagation(event);\"  id=\"" + filter_wrapper_id + "\" class=\"yadcf-filter-wrapper\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-filter-wrapper";
filter_selector_string_tmp=filter_selector_string;
filterActionStr='onkeyup="yadcf.dateKeyUP(\'' + table_selector_jq_friendly + '\',\'' + date_format + '\',event);"';
if(columnObj.externally_triggered===true){
filterActionStr='';
}
$(filter_selector_string).append("<input onkeydown=\"yadcf.preventDefaultForEnter(event);\" placeholder=\"" + filter_default_label + "\" id=\"" + dateId + "\" class=\"yadcf-filter-date\" " + filterActionStr + "></input>");
if(filter_reset_button_text!==false){
$(filter_selector_string_tmp).append('<button type="button" id="' + dateId + '-reset" ' + 'onmousedown="yadcf.stopPropagation(event);" ' +
'onclick="yadcf.stopPropagation(event);yadcf.dateSelectSingle(\'' + table_selector_jq_friendly + '\',yadcf.eventTargetFixUp(event).target, \'clear\'); return false;" class="yadcf-filter-reset-button">' + filter_reset_button_text + '</button>');
}
if(columnObj.datepicker_type==='jquery-ui'){
datepickerObj.dateFormat=date_format;
}else if(columnObj.datepicker_type==='bootstrap-datetimepicker'){
datepickerObj.format=date_format;
}
if(columnObj.externally_triggered!==true){
if(columnObj.datepicker_type==='jquery-ui'){
datepickerObj.onSelect=dateSelectSingle;
}}
datepickerObj=$.extend({}, datepickerObj, columnObj.filter_plugin_options);
if(columnObj.datepicker_type==='jquery-ui'){
$("#" + dateId).datepicker(datepickerObj);
}else if(columnObj.datepicker_type==='bootstrap-datetimepicker'){
datepickerObj.useCurrent=false;
$("#" + dateId).datetimepicker(datepickerObj);
if(columnObj.externally_triggered!==true){
if(datepickerObj.format.toLowerCase()!=='hh:mm'){
$("#" + dateId).on('dp.change', dateSelectSingle);
}else{
$("#" + dateId).on('dp.hide', dateSelectSingle);
}}
}else if(columnObj.datepicker_type==='bootstrap-datepicker'){
$("#" + dateId).datepicker({});
}
if(oTable.fnSettings().aoPreSearchCols[column_number].sSearch!==''){
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(oTable.fnSettings().aoPreSearchCols[column_number].sSearch).addClass("inuse");
}
resetIApiIndex();
}
function rangeNumberSldierDrawTips(min_tip_val, max_tip_val, min_tip_id, max_tip_id, table_selector_jq_friendly, column_number){
var first_handle=$("#yadcf-filter-wrapper-inner-" + table_selector_jq_friendly + "-" + column_number + " .ui-slider-handle:first"),
last_handle=$("#yadcf-filter-wrapper-inner-" + table_selector_jq_friendly + "-" + column_number + " .ui-slider-handle:last"),
min_tip_inner,
max_tip_inner;
min_tip_inner="<div id=\"" + min_tip_id + "\" class=\"yadcf-filter-range-number-slider-min-tip-inner\">" + min_tip_val + "</div>";
max_tip_inner="<div id=\"" + max_tip_id + "\" class=\"yadcf-filter-range-number-slider-max-tip-inner\">" + max_tip_val + "</div>";
$(first_handle).addClass("yadcf-filter-range-number-slider-min-tip").html(min_tip_inner);
$(last_handle).addClass("yadcf-filter-range-number-slider-max-tip").html(max_tip_inner);
}
function rangeNumberSliderChange(table_selector_jq_friendly, event, ui){
event=eventTargetFixUp(event);
var oTable,
min_val,
max_val,
slider_inuse,
yadcfState,
column_number=$(event.target).attr('id').replace("yadcf-filter-", "").replace(table_selector_jq_friendly, "").replace("-slider-", ""),
columnObj,
keyUp;
oTable=oTables[table_selector_jq_friendly];
columnObj=getOptions(oTable.selector)[column_number];
keyUp=function (){
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
if(oTable.fnSettings().oFeatures.bServerSide!==true){
oTable.fnDraw();
}else{
oTable.fnFilter(ui.values[0] + '-yadcf_delim-' + ui.values[1], column_number);
}
min_val=+$($(event.target).parent().find(".yadcf-filter-range-number-slider-min-tip-hidden")).text();
max_val=+$($(event.target).parent().find(".yadcf-filter-range-number-slider-max-tip-hidden")).text();
if(min_val!==ui.values[0]){
$($(event.target).find(".ui-slider-handle")[0]).addClass("inuse");
slider_inuse=true;
}else{
$($(event.target).find(".ui-slider-handle")[0]).removeClass("inuse");
}
if(max_val!==ui.values[1]){
$($(event.target).find(".ui-slider-handle")[1]).addClass("inuse");
slider_inuse=true;
}else{
$($(event.target).find(".ui-slider-handle")[1]).removeClass("inuse");
}
if(slider_inuse===true){
$(event.target).find(".ui-slider-range").addClass("inuse");
}else{
$(event.target).find(".ui-slider-range").removeClass("inuse");
}
if(!oTable.fnSettings().oLoadedState){
oTable.fnSettings().oLoadedState={};
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}
if(oTable.fnSettings().oFeatures.bStateSave===true){
if(oTable.fnSettings().oLoadedState.yadcfState!==undefined&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly]!==undefined){
oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number] =
{
'from':ui.values[0],
'to':ui.values[1]
};}else{
yadcfState={};
yadcfState[table_selector_jq_friendly]=[];
yadcfState[table_selector_jq_friendly][column_number]={
'from':ui.values[0],
'to':ui.values[1]
};
oTable.fnSettings().oLoadedState.yadcfState=yadcfState;
}
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}
resetIApiIndex();
};
if(columnObj.filter_delay===undefined){
keyUp();
}else{
yadcfDelay(function (){
keyUp();
}, columnObj.filter_delay);
}}
function addRangeNumberSliderFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, min_val, max_val, ignore_char){
var sliderId="yadcf-filter-" + table_selector_jq_friendly + "-slider-" + column_number,
min_tip_id="yadcf-filter-" + table_selector_jq_friendly + "-min_tip-" + column_number,
max_tip_id="yadcf-filter-" + table_selector_jq_friendly + "-max_tip-" + column_number,
filter_selector_string_tmp,
filter_wrapper_id,
oTable,
min_state_val=min_val,
max_state_val=max_val,
columnObj,
slideFunc,
changeFunc,
sliderObj,
sliderMaxMin={
min: min_val,
max: max_val
};
filter_wrapper_id="yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number;
if($("#" + filter_wrapper_id).length > 0){
return;
}
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
oTable=oTables[table_selector_jq_friendly];
columnObj=getOptions(oTable.selector)[column_number];
if(oTable.fnSettings().oFeatures.bStateSave===true&&oTable.fnSettings().oLoadedState){
if(oTable.fnSettings().oLoadedState.yadcfState&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly]&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number]){
if(min_val!==oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from){
min_state_val=oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from;
}
if(max_val!==oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to){
max_state_val=oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to;
}}
}
if(isFinite(min_val)&&isFinite(max_val)&&isFinite(min_state_val)&&isFinite(max_state_val)){
$(filter_selector_string).append("<div onmousedown=\"yadcf.stopPropagation(event);\" onclick=\"yadcf.stopPropagation(event);\"  id=\"" + filter_wrapper_id + "\" class=\"yadcf-filter-wrapper\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-filter-wrapper";
filter_selector_string_tmp=filter_selector_string;
$(filter_selector_string).append("<div id=\"yadcf-filter-wrapper-inner-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-number-slider-filter-wrapper-inner\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-number-slider-filter-wrapper-inner";
$(filter_selector_string).append("<div id=\"" + sliderId + "\" class=\"yadcf-filter-range-number-slider\"></div>");
filter_selector_string=filter_selector_string + " #" + sliderId;
$(filter_selector_string).append("<span class=\"yadcf-filter-range-number-slider-min-tip-hidden hide\">" + min_val + "</span>");
$(filter_selector_string).append("<span class=\"yadcf-filter-range-number-slider-max-tip-hidden hide\">" + max_val + "</span>");
if(columnObj.externally_triggered!==true){
slideFunc=function (event, ui){
rangeNumberSldierDrawTips(ui.values[0], ui.values[1], min_tip_id, max_tip_id, table_selector_jq_friendly, column_number);
rangeNumberSliderChange(table_selector_jq_friendly, event, ui);
};
changeFunc=function (event, ui){
rangeNumberSldierDrawTips(ui.values[0], ui.values[1], min_tip_id, max_tip_id, table_selector_jq_friendly, column_number);
if(event.originalEvent||$(event.target).slider("option", "yadcf-reset")===true){
$(event.target).slider("option", "yadcf-reset", false);
rangeNumberSliderChange(table_selector_jq_friendly, event, ui);
}};}else{
slideFunc=function (event, ui){
rangeNumberSldierDrawTips(ui.values[0], ui.values[1], min_tip_id, max_tip_id, table_selector_jq_friendly, column_number);
};
changeFunc=function (event, ui){
rangeNumberSldierDrawTips(ui.values[0], ui.values[1], min_tip_id, max_tip_id, table_selector_jq_friendly, column_number);
};}
sliderObj={
range: true,
min: min_val,
max: max_val,
values: [min_state_val, max_state_val],
create: function (event, ui){
rangeNumberSldierDrawTips(min_state_val, max_state_val, min_tip_id, max_tip_id, table_selector_jq_friendly, column_number);
},
slide: slideFunc,
change: changeFunc
};
if(columnObj.filter_plugin_options!==undefined){
$.extend(sliderObj, columnObj.filter_plugin_options);
}
$("#" + sliderId).slider(sliderObj);
if(filter_reset_button_text!==false){
$(filter_selector_string_tmp).append("<button type=\"button\" onmousedown=\"yadcf.stopPropagation(event);\" " +
"onclick=\"yadcf.stopPropagation(event);yadcf.rangeNumberSliderClear('" + table_selector_jq_friendly + "',event); return false;\" class=\"yadcf-filter-reset-button range-number-slider-reset-button\">" + filter_reset_button_text + "</button>");
}}
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
oTable=oTables[table_selector_jq_friendly];
if(oTable.fnSettings().oFeatures.bStateSave===true&&oTable.fnSettings().oLoadedState){
if(oTable.fnSettings().oLoadedState.yadcfState&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly]&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number]){
if(isFinite(min_val)&&min_val!==oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from){
$($(filter_selector_string).find(".ui-slider-handle")[0]).addClass("inuse");
}
if(isFinite(max_val)&&max_val!==oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to){
$($(filter_selector_string).find(".ui-slider-handle")[1]).addClass("inuse");
}
if((isFinite(min_val)&&isFinite(max_val))&&(min_val!==oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from||max_val!==oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number].to)){
$($(filter_selector_string).find(".ui-slider-range")).addClass("inuse");
}}
}
resetIApiIndex();
if(oTable.fnSettings().oFeatures.bServerSide!==true){
addRangeNumberAndSliderFilterCapability(table_selector_jq_friendly, min_tip_id, max_tip_id, column_number, ignore_char, sliderMaxMin);
}}
function destroyThirdPartyPlugins(table_arg){
var tableOptions,
table_selector_jq_friendly,
settingsDt,
columnObjKey,
column_number,
optionsObj,
fromId,
toId;
if(table_arg.settings!==undefined){
table_arg=table_arg.settings()[0].oInstance;
}
tableOptions=getOptions(table_arg.selector);
table_selector_jq_friendly=yadcf.generateTableSelectorJQFriendly(table_arg.selector);
settingsDt=getSettingsObjFromTable(table_arg);
for (columnObjKey in tableOptions){
if(tableOptions.hasOwnProperty(columnObjKey)){
optionsObj=tableOptions[columnObjKey];
column_number=optionsObj.column_number;
switch (optionsObj.filter_type){
case 'multi_select':
case 'multi_select_custom_func':
case 'select':
case 'custom_func':
switch (optionsObj.select_type){
case 'chosen':
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).chosen('destroy');
break;
case 'select2':
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).select2('destroy');
break;
case 'custom_select':
if(selectElementCustomDestroyFunc!==undefined){
selectElementCustomDestroyFunc($("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number));
}
break;
}
break;
case 'auto_complete':
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).autocomplete("destroy");
break;
case 'date':
switch (optionsObj.select_type){
case 'jquery-ui':
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).datepicker("destroy");
break;
case 'bootstrap-datetimepicker':
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).destroy();
break;
}
break;
case 'range_date':
fromId="yadcf-filter-" + table_selector_jq_friendly + "-from-date-" + column_number;
toId="yadcf-filter-" + table_selector_jq_friendly + "-to-date-" + column_number;
switch (optionsObj.select_type){
case 'jquery-ui':
$("#" + fromId).datepicker("destroy");
$("#" + toId).datepicker("destroy");
break;
case 'bootstrap-datetimepicker':
$("#" + fromId).destroy();
$("#" + toId).destroy();
break;
}
break;
case 'range_number_slider':
$("#yadcf-filter-" + table_selector_jq_friendly + "-slider-" + column_number).slider("destroy");
break;
}}
}}
function removeFilters(oTable, args, table_selector){
$('.yadcf-filter-wrapper').remove();
if(yadcfVersionCheck('1.10')){
$(document).off('draw.dt', oTable.selector);
$(document).off('xhr.dt', oTable.selector);
$(document).off('column-visibility.dt', oTable.selector);
$(document).off('destroy.dt', oTable.selector);
}else{
$(document).off('draw', oTable.selector);
$(document).off('destroy', oTable.selector);
}
destroyThirdPartyPlugins(oTable);
}
function sortAlphaNum(a, b){
var aA=a.replace(reA, ""),
bA=b.replace(reA, ""),
aN,
bN;
if(aA===bA){
aN=parseInt(a.replace(reN, ""), 10);
bN=parseInt(b.replace(reN, ""), 10);
return aN===bN ? 0:aN > bN ? 1:-1;
}
return aA > bA ? 1:-1;
}
function sortColumnData(column_data, columnObj){
var numArray=[],
alphaArray=[];
if(columnObj.filter_type==="select"||columnObj.filter_type==="auto_complete"||columnObj.filter_type==="multi_select"||columnObj.filter_type==='multi_select_custom_func'||columnObj.filter_type==="custom_func"){
if(columnObj.sort_as==="alpha"){
if(columnObj.sort_order==="asc"){
column_data.sort();
}else if(columnObj.sort_order==="desc"){
column_data.sort();
column_data.reverse();
}}else if(columnObj.sort_as==="num"){
if(columnObj.sort_order==="asc"){
column_data.sort(sortNumAsc);
}else if(columnObj.sort_order==="desc"){
column_data.sort(sortNumDesc);
}}else if(columnObj.sort_as==="alphaNum"){
if(columnObj.sort_order==="asc"){
column_data.sort(sortAlphaNum);
}else if(columnObj.sort_order==="desc"){
column_data.sort(sortAlphaNum);
column_data.reverse();
}}else if(columnObj.sort_as==="custom"){
column_data.sort(columnObj.sort_as_custom_func);
}}
return column_data;
}
function getFilteredRows(table){
var dataTmp,
data=[],
i;
if(yadcfVersionCheck('1.10')){
dataTmp=table._('tr', {filter: 'applied' });
}else{
dataTmp=table.rows({filter: 'applied'}).data().toArray();
}
for (i=0; i < dataTmp.length; i++){
data.push({
_aData: dataTmp[i]
});
}
return data;
}
function parseTableColumn(pTable, columnObj, table_selector_jq_friendly){
var col_inner_elements,
col_inner_data,
j,
k,
col_filter_array={},
column_data=[],
data,
data_length,
settingsDt,
column_number_filter;
settingsDt=getSettingsObjFromTable(pTable);
if(columnObj.cumulative_filtering!==true){
data=settingsDt.aoData;
data_length=data.length;
}else{
data=getFilteredRows(pTable);
data_length=data.length;
}
if(columnObj.col_filter_array!==undefined){
col_filter_array=columnObj.col_filter_array;
}
column_number_filter=calcColumnNumberFilter(settingsDt, columnObj.column_number, table_selector_jq_friendly);
if(isNaN(settingsDt.aoColumns[column_number_filter].mData)&&typeof settingsDt.aoColumns[column_number_filter].mData!=='object'){
columnObj.column_number_data=settingsDt.aoColumns[column_number_filter].mData;
}
if(isNaN(settingsDt.aoColumns[column_number_filter].mRender)&&typeof settingsDt.aoColumns[column_number_filter].mRender!=='object'){
columnObj.column_number_render=settingsDt.aoColumns[column_number_filter].mRender;
}
for (j=0; j < data_length; j++){
if(columnObj.column_data_type==="html"){
if(columnObj.column_number_data===undefined){
col_inner_elements=$(data[j]._aData[column_number_filter]);
}else{
col_inner_elements=dot2obj(data[j]._aData, columnObj.column_number_data);
col_inner_elements=$(col_inner_elements);
}
if(col_inner_elements.length > 0){
for (k=0; k < col_inner_elements.length; k++){
switch (columnObj.html_data_type){
case "text":
col_inner_data=$(col_inner_elements[k]).text();
break;
case "value":
col_inner_data=$(col_inner_elements[k]).val();
break;
case "id":
col_inner_data=col_inner_elements[k].id;
break;
case "selector":
col_inner_data=$(col_inner_elements[k]).find(columnObj.html_data_selector).text();
break;
}
if($.trim(col_inner_data)!==''&&!(col_filter_array.hasOwnProperty(col_inner_data))){
col_filter_array[col_inner_data]=col_inner_data;
column_data.push(col_inner_data);
}}
}else{
col_inner_data=col_inner_elements.selector;
if($.trim(col_inner_data)!==''&&!(col_filter_array.hasOwnProperty(col_inner_data))){
col_filter_array[col_inner_data]=col_inner_data;
column_data.push(col_inner_data);
}}
}else if(columnObj.column_data_type==="text"){
if(columnObj.text_data_delimiter!==undefined){
if(columnObj.column_number_data===undefined){
col_inner_elements=data[j]._aData[column_number_filter].split(columnObj.text_data_delimiter);
}else{
col_inner_elements=dot2obj(data[j]._aData, columnObj.column_number_data);
col_inner_elements=(col_inner_elements + '').split(columnObj.text_data_delimiter);
}
for (k=0; k < col_inner_elements.length; k++){
col_inner_data=col_inner_elements[k];
if($.trim(col_inner_data)!==''&&!(col_filter_array.hasOwnProperty(col_inner_data))){
col_filter_array[col_inner_data]=col_inner_data;
column_data.push(col_inner_data);
}}
}else{
if(columnObj.column_number_data===undefined){
col_inner_data=data[j]._aData[column_number_filter];
if(typeof col_inner_data==='object'){
if(columnObj.html5_data!==undefined){
col_inner_data=col_inner_data['@' + columnObj.html5_data];
}else{
console.log('Warning: Looks like you have forgot to define the html5_data attribute for the ' + columnObj.column_number + ' column');
return;
}}
}else if(data[j]._aFilterData!==undefined&&data[j]._aFilterData!==null){
col_inner_data=data[j]._aFilterData[column_number_filter];
}else{
col_inner_data=dot2obj(data[j]._aData, columnObj.column_number_data);
}
if($.trim(col_inner_data)!==''&&!(col_filter_array.hasOwnProperty(col_inner_data))){
col_filter_array[col_inner_data]=col_inner_data;
column_data.push(col_inner_data);
}}
}else if(columnObj.column_data_type==="rendered_html"){
col_inner_elements=data[j]._aFilterData[column_number_filter];
col_inner_elements=$(col_inner_elements);
if(col_inner_elements.length > 0){
for (k=0; k < col_inner_elements.length; k++){
switch (columnObj.html_data_type){
case "text":
col_inner_data=$(col_inner_elements[k]).text();
break;
case "value":
col_inner_data=$(col_inner_elements[k]).val();
break;
case "id":
col_inner_data=col_inner_elements[k].id;
break;
case "selector":
col_inner_data=$(col_inner_elements[k]).find(columnObj.html_data_selector).text();
break;
}}
}else{
col_inner_data=col_inner_elements.selector;
}
if($.trim(col_inner_data)!==''&&!(col_filter_array.hasOwnProperty(col_inner_data))){
col_filter_array[col_inner_data]=col_inner_data;
column_data.push(col_inner_data);
}}
}
columnObj.col_filter_array=col_filter_array;
return column_data;
}
function appendFilters(oTable, args, table_selector){
var i=0,
$filter_selector,
filter_selector_string,
data,
filter_container_id,
column_number_data,
column_number,
column_position,
column_data_type,
html_data_type,
text_data_delimiter,
filter_default_label,
filter_reset_button_text,
enable_auto_complete,
sort_as,
sort_order,
date_format,
ignore_char,
filter_match_mode,
column_data,
column_data_temp,
options_tmp,
j,
k,
data_length,
col_inner_elements,
col_inner_data,
ii,
table_selector_jq_friendly,
min_val,
max_val,
col_num_visible,
col_num_visible_iter,
tmpStr,
columnObjKey,
columnObj,
filters_position,
unique_th,
settingsDt,
filterActionStr,
custom_func_filter_value_holder,
exclude_str,
tableDT,
columnFilterVal;
settingsDt=getSettingsObjFromTable(oTable);
table_selector_jq_friendly=yadcf.generateTableSelectorJQFriendly(table_selector);
tableDT=tablesDT[table_selector_jq_friendly];
initColReorder2(settingsDt, table_selector_jq_friendly);
filters_position=$(document).data(table_selector + "_filters_position");
if(settingsDt.oScroll.sX!==''||settingsDt.oScroll.sY!==''){
table_selector='.yadcf-datatables-table-' + table_selector_jq_friendly;
}
if(oTable._fnGetUniqueThs()!==undefined){
unique_th=oTable._fnGetUniqueThs();
}
for (columnObjKey in args){
if(args.hasOwnProperty(columnObjKey)){
columnObj=args[columnObjKey];
options_tmp='';
tmpStr='';
data=columnObj.data;
column_data=[];
column_data_temp=[];
filter_container_id=columnObj.filter_container_id;
column_number=columnObj.column_number;
column_number=+column_number;
column_position=column_number;
if(plugins[table_selector_jq_friendly]!==undefined&&(plugins[table_selector_jq_friendly]!==undefined&&plugins[table_selector_jq_friendly].ColReorder!==undefined)){
column_position=plugins[table_selector_jq_friendly].ColReorder[column_number];
}
columnObj.column_number=column_number;
column_number_data=undefined;
if(isNaN(settingsDt.aoColumns[column_position].mData)&&typeof settingsDt.aoColumns[column_position].mData!=='object'){
column_number_data=settingsDt.aoColumns[column_position].mData;
columnObj.column_number_data=column_number_data;
}
if(isNaN(settingsDt.aoColumns[column_position].mRender)&&typeof settingsDt.aoColumns[column_position].mRender!=='object'){
columnObj.column_number_render=settingsDt.aoColumns[column_position].mRender;
}
column_data_type=columnObj.column_data_type;
html_data_type=columnObj.html_data_type;
text_data_delimiter=columnObj.text_data_delimiter;
filter_default_label=columnObj.filter_default_label;
filter_reset_button_text=columnObj.filter_reset_button_text;
enable_auto_complete=columnObj.enable_auto_complete;
sort_as=columnObj.sort_as;
sort_order=columnObj.sort_order;
date_format=columnObj.date_format;
date_format=date_format.replace("yyyy", "yy");
if(columnObj.datepicker_type==='bootstrap-datetimepicker'&&columnObj.filter_plugin_options!==undefined&&columnObj.filter_plugin_options.format!==undefined){
date_format=columnObj.filter_plugin_options.format;
}
columnObj.date_format=date_format;
if(columnObj.ignore_char!==undefined&&!(columnObj.ignore_char instanceof RegExp)){
ignore_char=new RegExp(columnObj.ignore_char, "g");
columnObj.ignore_char=ignore_char;
}
filter_match_mode=columnObj.filter_match_mode;
if(column_number===undefined){
alert("You must specify column number");
return;
}
if(enable_auto_complete===true){
columnObj.filter_type="auto_complete";
}
if(filter_default_label===undefined){
if(columnObj.filter_type==="select"||columnObj.filter_type==='custom_func'){
filter_default_label="Select value";
}else if(columnObj.filter_type==="multi_select"||columnObj.filter_type==='multi_select_custom_func'){
filter_default_label="Select values";
}else if(columnObj.filter_type==="auto_complete"||columnObj.filter_type==="text"){
filter_default_label='Type to filter';
}else if(columnObj.filter_type==="range_number"||columnObj.filter_type==="range_date"){
filter_default_label=["from", "to"];
}else if(columnObj.filter_type==="date"){
filter_default_label="Select a date";
}
columnObj.filter_default_label=filter_default_label;
}
if(filter_reset_button_text===undefined){
filter_reset_button_text="x";
}
if(data!==undefined){
for (ii=0; ii < data.length; ii++){
column_data.push(data[ii]);
}}
if(data===undefined||columnObj.append_data_to_table_data!==undefined){
columnObj.col_filter_array=undefined;
column_data_temp=parseTableColumn(oTable, columnObj, table_selector_jq_friendly);
if(columnObj.append_data_to_table_data!=='before'){
column_data=column_data.concat(column_data_temp);
}else{
column_data_temp=sortColumnData(column_data_temp, columnObj);
column_data=column_data.concat(column_data_temp);
}}
if(columnObj.append_data_to_table_data===undefined||columnObj.append_data_to_table_data==='sorted'){
column_data=sortColumnData(column_data, columnObj);
}
if(columnObj.filter_type==="range_number_slider"){
min_val=findMinInArray(column_data, columnObj);
max_val=findMaxInArray(column_data, columnObj);
}
if(filter_container_id===undefined&&columnObj.filter_container_selector===undefined){
if(settingsDt.aoColumns[column_position].bVisible===false){
continue;
}
if(filters_position!=='thead'){
if(unique_th===undefined){
col_num_visible=column_position;
for (col_num_visible_iter=0; col_num_visible_iter < settingsDt.aoColumns.length&&col_num_visible_iter < column_position; col_num_visible_iter++){
if(settingsDt.aoColumns[col_num_visible_iter].bVisible===false){
col_num_visible--;
}}
column_position=col_num_visible;
filter_selector_string=table_selector + ' ' + filters_position + ' th:eq(' + column_position + ')';
}else{
filter_selector_string=table_selector + ' ' + filters_position + ' th:eq(' + $(unique_th[column_position]).index() + ')';
}}else{
filter_selector_string=table_selector + ' ' + filters_position + ' tr:eq(' + $(unique_th[column_position]).parent().index() + ') th:eq(' + $(unique_th[column_position]).index() + ')';
}
$filter_selector=$(filter_selector_string).find(".yadcf-filter");
}else{
if(filter_container_id!==undefined){
columnObj.filter_container_selector="#" + filter_container_id;
}
if($(columnObj.filter_container_selector).length===0){
console.log("ERROR: Filter container could not be found.");
return;
}
filter_selector_string=columnObj.filter_container_selector;
$filter_selector=$(filter_selector_string).find(".yadcf-filter");
}
if(columnObj.filter_type==="select"||columnObj.filter_type==='custom_func'||columnObj.filter_type==="multi_select"||columnObj.filter_type==='multi_select_custom_func'){
if(columnObj.data_as_is!==true){
if(columnObj.filter_type==="select"||columnObj.filter_type==='custom_func'){
options_tmp="<option value=\"" + "-1" + "\">" + filter_default_label + "</option>";
if(columnObj.select_type==='select2'&&columnObj.select_type_options.placeholder!==undefined&&columnObj.select_type_options.allowClear===true){
options_tmp="<option value=\"\"></option>";
}}else if(columnObj.filter_type==="multi_select"||columnObj.filter_type==='multi_select_custom_func'){
if(columnObj.select_type===undefined){
options_tmp="<option data-placeholder=\"true\" value=\"" + "-1" + "\">" + filter_default_label + "</option>";
}else{
options_tmp="";
}}
if(columnObj.append_data_to_table_data===undefined){
if(typeof column_data[0]==='object'){
for (ii=0; ii < column_data.length; ii++){
options_tmp +="<option value=\"" + column_data[ii].value + "\">" + column_data[ii].label + "</option>";
}}else{
for (ii=0; ii < column_data.length; ii++){
options_tmp +="<option value=\"" + column_data[ii] + "\">" + column_data[ii] + "</option>";
}}
}else{
for (ii=0; ii < column_data.length; ii++){
if(typeof column_data[ii]==='object'){
options_tmp +="<option value=\"" + column_data[ii].value + "\">" + column_data[ii].label + "</option>";
}else{
options_tmp +="<option value=\"" + column_data[ii] + "\">" + column_data[ii] + "</option>";
}}
}}else{
options_tmp=columnObj.data;
}
column_data=options_tmp;
}
if($filter_selector.length===1){
if(columnObj.filter_type==="select"||columnObj.filter_type==="multi_select"||columnObj.filter_type==='custom_func'||columnObj.filter_type==='multi_select_custom_func'){
if(columnObj.filter_type==='custom_func'||columnObj.filter_type==='multi_select_custom_func'){
custom_func_filter_value_holder=$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val();
}
$filter_selector.empty();
$filter_selector.append(column_data);
if(settingsDt.aoPreSearchCols[column_position].sSearch!==''){
tmpStr=settingsDt.aoPreSearchCols[column_position].sSearch;
if(columnObj.filter_type==="select"){
tmpStr=yadcfParseMatchFilter(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode);
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr).addClass("inuse");
}else if(columnObj.filter_type==="multi_select"){
tmpStr=yadcfParseMatchFilterMultiSelect(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode);
tmpStr=tmpStr.replace(/\\/g, "");
tmpStr=tmpStr.split("|");
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr);
}}
if(columnObj.filter_type==='custom_func'||columnObj.filter_type==='multi_select_custom_func'){
tmpStr=custom_func_filter_value_holder;
if(tmpStr==='-1'||tmpStr===undefined){
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr);
}else{
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr).addClass("inuse");
}}
initializeSelectPlugin(columnObj.select_type, $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number), columnObj.select_type_options);
}else if(columnObj.filter_type==="auto_complete"){
$(document).data("yadcf-filter-" + table_selector_jq_friendly + "-" + column_number, column_data);
}}else{
if(filter_container_id===undefined&&columnObj.filter_container_selector===undefined){
if($(filter_selector_string + " div.DataTables_sort_wrapper").length > 0){
$(filter_selector_string + " div.DataTables_sort_wrapper").css("display", "inline-block");
}}else{
if(filter_container_id!==undefined){
columnObj.filter_container_selector="#" + filter_container_id;
}
if($("#yadcf-filter-wrapper-" + columnObj.filter_container_selector).length===0){
$(columnObj.filter_container_selector).append("<div id=\"yadcf-filter-wrapper-" + generateTableSelectorJQFriendly(columnObj.filter_container_selector) + "\"></div>");
}
filter_selector_string="#yadcf-filter-wrapper-" + generateTableSelectorJQFriendly(columnObj.filter_container_selector);
}
if(columnObj.filter_type==="select"||columnObj.filter_type==='custom_func'){
$(filter_selector_string).append("<div id=\"yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter-wrapper\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-filter-wrapper";
if(columnObj.filter_type==="select"){
filterActionStr='onchange="yadcf.doFilter(this, \'' + table_selector_jq_friendly + '\', ' + column_number + ', \'' + filter_match_mode + '\');"';
if(columnObj.externally_triggered===true){
filterActionStr='';
}
$(filter_selector_string).append("<select id=\"yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter " + columnObj.style_class + "\" " +
filterActionStr + " onkeydown=\"yadcf.preventDefaultForEnter(event);\" onmousedown=\"yadcf.stopPropagation(event);\" onclick='yadcf.stopPropagation(event);'>" + column_data + "</select>");
if(filter_reset_button_text!==false){
$(filter_selector_string).find(".yadcf-filter").after("<button type=\"button\" " +
"id=\"yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "-reset\" onmousedown=\"yadcf.stopPropagation(event);\" onclick=\"yadcf.stopPropagation(event);yadcf.doFilter('clear', '" + table_selector_jq_friendly + "', " + column_number + "); return false;\" class=\"yadcf-filter-reset-button\">" + filter_reset_button_text + "</button>");
}}else{
filterActionStr='onchange="yadcf.doFilterCustomDateFunc(this, \'' + table_selector_jq_friendly  + '\', ' +  column_number + ');"';
if(columnObj.externally_triggered===true){
filterActionStr='';
}
$(filter_selector_string).append("<select id=\"yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter " + columnObj.style_class + "\" " +
filterActionStr	+ " onkeydown=\"yadcf.preventDefaultForEnter(event);\" onmousedown=\"yadcf.stopPropagation(event);\" onclick='yadcf.stopPropagation(event);'>" + column_data + "</select>");
if(filter_reset_button_text!==false){
$(filter_selector_string).find(".yadcf-filter").after("<button type=\"button\" onmousedown=\"yadcf.stopPropagation(event);\" " +
"onclick=\"yadcf.stopPropagation(event);yadcf.doFilterCustomDateFunc('clear', '" + table_selector_jq_friendly + "', " + column_number + "); return false;\" class=\"yadcf-filter-reset-button\">" + filter_reset_button_text + "</button>");
}
if(settingsDt.oFeatures.bStateSave===true&&settingsDt.oLoadedState){
if(settingsDt.oLoadedState.yadcfState&&settingsDt.oLoadedState.yadcfState[table_selector_jq_friendly]&&settingsDt.oLoadedState.yadcfState[table_selector_jq_friendly][column_number]){
tmpStr=settingsDt.oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from;
if(tmpStr==='-1'||tmpStr===undefined){
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr);
}else{
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr).addClass("inuse");
}}
}
if(settingsDt.oFeatures.bServerSide!==true){
addCustomFunctionFilterCapability(table_selector_jq_friendly, "yadcf-filter-" + table_selector_jq_friendly + "-" + column_number, column_number);
}}
if(settingsDt.aoPreSearchCols[column_position].sSearch!==''){
tmpStr=settingsDt.aoPreSearchCols[column_position].sSearch;
tmpStr=yadcfParseMatchFilter(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode);
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr).addClass("inuse");
}
if(columnObj.select_type!==undefined){
initializeSelectPlugin(columnObj.select_type, $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number), columnObj.select_type_options);
}}else if(columnObj.filter_type==="multi_select"||columnObj.filter_type==='multi_select_custom_func'){
$(filter_selector_string).append("<div id=\"yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter-wrapper\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-filter-wrapper";
if(columnObj.filter_type==="multi_select"){
filterActionStr='onchange="yadcf.doFilterMultiSelect(this, \'' + table_selector_jq_friendly + '\', ' + column_number + ', \'' + filter_match_mode + '\');"';
if(columnObj.externally_triggered===true){
filterActionStr='';
}
$(filter_selector_string).append("<select multiple data-placeholder=\"" + filter_default_label + "\" id=\"yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter " + columnObj.style_class + "\" " +
filterActionStr	+ " onkeydown=\"yadcf.preventDefaultForEnter(event);\" onmousedown=\"yadcf.stopPropagation(event);\" onclick='yadcf.stopPropagation(event);'>" + column_data + "</select>");
if(filter_reset_button_text!==false){
$(filter_selector_string).find(".yadcf-filter").after("<button type=\"button\" onmousedown=\"yadcf.stopPropagation(event);\" " +
"onclick=\"yadcf.stopPropagation(event);yadcf.doFilter('clear', '" + table_selector_jq_friendly + "', " + column_number + "); return false;\" class=\"yadcf-filter-reset-button\">" + filter_reset_button_text + "</button>");
}
if(settingsDt.aoPreSearchCols[column_position].sSearch!==''){
tmpStr=settingsDt.aoPreSearchCols[column_position].sSearch;
tmpStr=yadcfParseMatchFilterMultiSelect(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode);
tmpStr=tmpStr.replace(/\\/g, "");
tmpStr=tmpStr.split("|");
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr);
}}else{
filterActionStr='onchange="yadcf.doFilterCustomDateFunc(this, \'' + table_selector_jq_friendly + '\', ' + column_number + ');"';
if(columnObj.externally_triggered===true){
filterActionStr='';
}
$(filter_selector_string).append("<select multiple data-placeholder=\"" + filter_default_label + "\" id=\"yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter " + columnObj.style_class + "\" " +
filterActionStr	+ " onkeydown=\"yadcf.preventDefaultForEnter(event);\" onmousedown=\"yadcf.stopPropagation(event);\" onclick='yadcf.stopPropagation(event);'>" + column_data + "</select>");
if(filter_reset_button_text!==false){
$(filter_selector_string).find(".yadcf-filter").after("<button type=\"button\" onmousedown=\"yadcf.stopPropagation(event);\" " +
"onclick=\"yadcf.stopPropagation(event);yadcf.doFilterCustomDateFunc('clear', '" + table_selector_jq_friendly + "', " + column_number + "); return false;\" class=\"yadcf-filter-reset-button\">" + filter_reset_button_text + "</button>");
}
if(settingsDt.oFeatures.bStateSave===true&&settingsDt.oLoadedState){
if(settingsDt.oLoadedState.yadcfState&&settingsDt.oLoadedState.yadcfState[table_selector_jq_friendly]&&settingsDt.oLoadedState.yadcfState[table_selector_jq_friendly][column_number]){
tmpStr=settingsDt.oLoadedState.yadcfState[table_selector_jq_friendly][column_number].from;
if(tmpStr==='-1'||tmpStr===undefined){
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr);
}else{
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr).addClass("inuse");
}}
}
if(settingsDt.oFeatures.bServerSide!==true){
addCustomFunctionFilterCapability(table_selector_jq_friendly, "yadcf-filter-" + table_selector_jq_friendly + "-" + column_number, column_number);
}}
if(columnObj.filter_container_selector===undefined&&columnObj.select_type_options.width===undefined){
columnObj.select_type_options=$.extend(columnObj.select_type_options, {width: $(filter_selector_string).closest("th").width() + "px"});
}
if(columnObj.filter_container_selector!==undefined&&columnObj.select_type_options.width===undefined){
columnObj.select_type_options=$.extend(columnObj.select_type_options, {width: $(filter_selector_string).closest(columnObj.filter_container_selector).width() + "px"});
}
if(columnObj.select_type!==undefined){
initializeSelectPlugin(columnObj.select_type, $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number), columnObj.select_type_options);
}}else if(columnObj.filter_type==="auto_complete"){
$(filter_selector_string).append("<div id=\"yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter-wrapper\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-filter-wrapper";
filterActionStr='onkeyup="yadcf.autocompleteKeyUP(\'' + table_selector_jq_friendly + '\',event);"';
if(columnObj.externally_triggered===true){
filterActionStr='';
}
$(filter_selector_string).append("<input onkeydown=\"yadcf.preventDefaultForEnter(event);\" id=\"yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter\" onmousedown=\"yadcf.stopPropagation(event);\" onclick='yadcf.stopPropagation(event);"
+ "' placeholder='" + filter_default_label + "'" + " filter_match_mode='" + filter_match_mode + "' " + filterActionStr + "></input>");
$(document).data("yadcf-filter-" + table_selector_jq_friendly + "-" + column_number, column_data);
if(filter_reset_button_text!==false){
$(filter_selector_string).find(".yadcf-filter").after("<button type=\"button\" onmousedown=\"yadcf.stopPropagation(event);\" " +
"onclick=\"yadcf.stopPropagation(event);yadcf.doFilterAutocomplete('clear', '" + table_selector_jq_friendly + "', " + column_number + "); return false;\" class=\"yadcf-filter-reset-button\">" + filter_reset_button_text + "</button>");
}}else if(columnObj.filter_type==="text"){
$(filter_selector_string).append("<div id=\"yadcf-filter-wrapper-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter-wrapper\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-filter-wrapper";
filterActionStr='onkeyup="yadcf.textKeyUP(event,\'' + table_selector_jq_friendly + '\', ' + column_number + ');"';
if(columnObj.externally_triggered===true){
filterActionStr='';
}
exclude_str='';
if(columnObj.exclude===true){
if(columnObj.externally_triggered!==true){
exclude_str='<span class="yadcf-exclude-wrapper" onmousedown="yadcf.stopPropagation(event);" onclick="yadcf.stopPropagation(event);">' +
'<div class="yadcf-label small">' + columnObj.exclude_label + '</div><input type="checkbox" title="' + columnObj.exclude_label + '" onclick="yadcf.stopPropagation(event);yadcf.textKeyUP(event,\'' + table_selector_jq_friendly + '\',' + column_number + ');"></span>';
}else{
exclude_str='<span class="yadcf-exclude-wrapper" onmousedown="yadcf.stopPropagation(event);" onclick="yadcf.stopPropagation(event);">' +
'<div class="yadcf-label small">' + columnObj.exclude_label + '</div><input type="checkbox" title="' + columnObj.exclude_label + '" onclick="yadcf.stopPropagation(event);"></span>';
}}
$(filter_selector_string).append(exclude_str + "<input type=\"text\" onkeydown=\"yadcf.preventDefaultForEnter(event);\" id=\"yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "\" class=\"yadcf-filter " + columnObj.style_class + "\" onmousedown=\"yadcf.stopPropagation(event);\" onclick='yadcf.stopPropagation(event);"
+ "' placeholder='" + filter_default_label + "'" + " filter_match_mode='" + filter_match_mode + "' " + filterActionStr + "></input>");
if(filter_reset_button_text!==false){
$(filter_selector_string).find(".yadcf-filter").after("<button type=\"button\" " + " id=\"yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "-reset\" onmousedown=\"yadcf.stopPropagation(event);\" " +
"onclick=\"yadcf.stopPropagation(event);yadcf.textKeyUP(event,'" + table_selector_jq_friendly + "', '" + column_number + "', 'clear'); return false;\" class=\"yadcf-filter-reset-button\">" + filter_reset_button_text + "</button>");
}
if(settingsDt.aoPreSearchCols[column_position].sSearch!==''){
tmpStr=settingsDt.aoPreSearchCols[column_position].sSearch;
if(columnObj.exclude===true){
if(tmpStr.indexOf('^((?!')!==-1){
$('#yadcf-filter-wrapper-' + table_selector_jq_friendly + '-' + column_number).find(':checkbox').prop('checked', true);
}
tmpStr=tmpStr.substring(5, tmpStr.indexOf(').)'));
}
tmpStr=yadcfParseMatchFilter(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode);
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr).addClass("inuse");
}}else if(columnObj.filter_type==="date"){
addDateFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, date_format);
}else if(columnObj.filter_type==="range_number"){
addRangeNumberFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, ignore_char);
}else if(columnObj.filter_type==="range_number_slider"){
addRangeNumberSliderFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, min_val, max_val, ignore_char);
}else if(columnObj.filter_type==="range_date"){
addRangeDateFilter(filter_selector_string, table_selector_jq_friendly, column_number, filter_reset_button_text, filter_default_label, date_format);
}}
if($(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val")!==undefined&&$(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val")!=="-1"){
$(filter_selector_string).find(".yadcf-filter").val($(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val"));
}
if(columnObj.filter_type==="auto_complete"){
if(columnObj.filter_plugin_options!==undefined){
if(columnObj.filter_plugin_options.source===undefined){
columnObj.filter_plugin_options.source=$(document).data("yadcf-filter-" + table_selector_jq_friendly + "-" + column_number);
}
columnObj.filter_plugin_options.select=autocompleteSelect;
}else{
columnObj.filter_plugin_options={
source: $(document).data("yadcf-filter-" + table_selector_jq_friendly + "-" + column_number),
select: autocompleteSelect
};}
if(columnObj.externally_triggered===true){
delete columnObj.filter_plugin_options.select;
}
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).autocomplete(columnObj.filter_plugin_options);
if(settingsDt.aoPreSearchCols[column_position].sSearch!==''){
tmpStr=settingsDt.aoPreSearchCols[column_position].sSearch;
tmpStr=yadcfParseMatchFilter(tmpStr, getOptions(oTable.selector)[column_number].filter_match_mode);
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(tmpStr).addClass("inuse");
}}
}}
if(exFilterColumnQueue.length > 0){
(exFilterColumnQueue.shift())();
}}
function endsWith(str, suffix){
return str.indexOf(suffix, str.length - suffix.length)!==-1;
}
function rangeClear(table_selector_jq_friendly, event, column_number){
event=eventTargetFixUp(event);
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
var oTable=oTables[table_selector_jq_friendly],
yadcfState,
settingsDt,
column_number_filter,
currentFilterValues,
columnObj;
settingsDt=getSettingsObjFromTable(oTable);
column_number_filter=calcColumnNumberFilter(settingsDt, column_number, table_selector_jq_friendly);
currentFilterValues=exGetColumnFilterVal(oTable, column_number);
if(currentFilterValues.from===''&&currentFilterValues.to===''){
return;
}
columnObj=getOptions(oTable.selector)[column_number];
if(columnObj.filter_type==='range_date'&&columnObj.datepicker_type==='bootstrap-datetimepicker'){
$($(event.target).parent().find(".yadcf-filter-range")[0]).data("DateTimePicker").maxDate(false);
$($(event.target).parent().find(".yadcf-filter-range")[1]).data("DateTimePicker").minDate(false);
}
$(event.target).parent().find(".yadcf-filter-range").val("");
if($(event.target).parent().find(".yadcf-filter-range-number").length > 0){
$($(event.target).parent().find(".yadcf-filter-range")[0]).focus();
}
if(oTable.fnSettings().oFeatures.bServerSide!==true){
oTable.fnDraw();
}else{
oTable.fnFilter('-yadcf_delim-', column_number_filter);
}
if(!oTable.fnSettings().oLoadedState){
oTable.fnSettings().oLoadedState={};
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}
if(oTable.fnSettings().oFeatures.bStateSave===true){
if(oTable.fnSettings().oLoadedState.yadcfState!==undefined&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly]!==undefined){
oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number] =
{
'from':"",
'to':""
};}else{
yadcfState={};
yadcfState[table_selector_jq_friendly]=[];
yadcfState[table_selector_jq_friendly][column_number]={
'from':"",
'to':""
};
oTable.fnSettings().oLoadedState.yadcfState=yadcfState;
}
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}
resetIApiIndex();
$(event.target).parent().find(".yadcf-filter-range").removeClass("inuse");
return;
}
function rangeNumberSliderClear(table_selector_jq_friendly, event){
event=eventTargetFixUp(event);
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
var oTable=oTables[table_selector_jq_friendly],
min_val,
max_val,
currentFilterValues,
column_number;
column_number=parseInt($(event.target).prev().find(".yadcf-filter-range-number-slider").attr("id").replace("yadcf-filter-" + table_selector_jq_friendly + "-slider-", ""), 10);
min_val=+$($(event.target).parent().find(".yadcf-filter-range-number-slider-min-tip-hidden")).text();
max_val=+$($(event.target).parent().find(".yadcf-filter-range-number-slider-max-tip-hidden")).text();
currentFilterValues=exGetColumnFilterVal(oTable, column_number);
if(+currentFilterValues.from===min_val&&+currentFilterValues.to===max_val){
return;
}
$("#" + $(event.target).prev().find(".yadcf-filter-range-number-slider").attr("id")).slider("option", "yadcf-reset", true);
$("#" + $(event.target).prev().find(".yadcf-filter-range-number-slider").attr("id")).slider("option", "values", [min_val, max_val]);
$($(event.target).prev().find(".ui-slider-handle")[0]).attr("tabindex", -1).focus();
$($(event.target).prev().find(".ui-slider-handle")[0]).removeClass("inuse");
$($(event.target).prev().find(".ui-slider-handle")[1]).removeClass("inuse");
$(event.target).prev().find(".ui-slider-range").removeClass("inuse");
oTable.fnDraw();
resetIApiIndex();
return;
}
function dateKeyUP(table_selector_jq_friendly, date_format, event){
var oTable,
date,
dateId,
column_number,
columnObj;
event=eventTargetFixUp(event);
dateId=event.target.id;
date=document.getElementById(dateId).value;
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
oTable=oTables[table_selector_jq_friendly];
column_number=parseInt(dateId.replace("yadcf-filter-" + table_selector_jq_friendly + "-", ""), 10);
columnObj=getOptions(oTable.selector)[column_number];
try {
if(columnObj.datepicker_type==='jquery-ui'){
if(date.length===(date_format.length + 2)){
date=(date!=="") ? $.datepicker.parseDate(date_format, date):date;
}}
} catch (err1){}
if(date instanceof Date||moment(date, columnObj.date_format).isValid()){
$("#" + dateId).addClass('inuse');
oTable.fnFilter(document.getElementById(dateId).value, column_number);
resetIApiIndex();
}else if(date===""||$.trim(event.target.value)===''){
$("#" + dateId).removeClass('inuse');
$('#' + event.target.id).removeClass('inuse');
oTable.fnFilter('', column_number);
resetIApiIndex();
}}
function rangeDateKeyUP(table_selector_jq_friendly, date_format, event){
event=eventTargetFixUp(event);
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
var oTable=oTables[table_selector_jq_friendly],
min,
max,
fromId,
toId,
column_number,
options,
keyUp,
settingsDt,
column_number_filter;
column_number=parseInt($(event.target).attr("id").replace('-from-date-', '').replace('-to-date-', '').replace('yadcf-filter-' + table_selector_jq_friendly, ''), 10);
options=getOptions(oTable.selector)[column_number];
settingsDt=getSettingsObjFromTable(oTable);
column_number_filter=calcColumnNumberFilter(settingsDt, column_number, table_selector_jq_friendly);
keyUp=function (){
if(event.target.id.indexOf("-from-")!==-1){
fromId=event.target.id;
toId=event.target.id.replace("-from-", "-to-");
min=document.getElementById(fromId).value;
max=document.getElementById(toId).value;
}else{
toId=event.target.id;
fromId=event.target.id.replace("-to-", "-from-");
max=document.getElementById(toId).value;
min=document.getElementById(fromId).value;
}
try {
if(min.length===(date_format.length + 2)){
min=(min!=="") ? $.datepicker.parseDate(date_format, min):min;
}} catch (err1){}
try {
if(max.length===(date_format.length + 2)){
max=(max!=="") ? $.datepicker.parseDate(date_format, max):max;
}} catch (err2){}
if(((max instanceof Date)&&(min instanceof Date)&&(max >=min))||min===""||max===""){
if(oTable.fnSettings().oFeatures.bServerSide!==true){
oTable.fnDraw();
}else{
oTable.fnFilter(document.getElementById(fromId).value + '-yadcf_delim-' + document.getElementById(toId).value, column_number_filter);
}
if(min instanceof Date){
$("#" + fromId).addClass("inuse");
}else{
$("#" + fromId).removeClass("inuse");
}
if(max instanceof Date){
$("#" + toId).addClass("inuse");
}else{
$("#" + toId).removeClass("inuse");
}
if($.trim(event.target.value)===""&&$(event.target).hasClass("inuse")){
$("#" + event.target.id).removeClass("inuse");
}}
resetIApiIndex();
};
if(options.filter_delay===undefined){
keyUp(table_selector_jq_friendly, event);
}else{
yadcfDelay(function (){
keyUp(table_selector_jq_friendly, event);
}, options.filter_delay);
}}
function rangeNumberKeyUP(table_selector_jq_friendly, event){
event=eventTargetFixUp(event);
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
var oTable=oTables[table_selector_jq_friendly],
min,
max,
fromId,
toId,
yadcfState,
column_number,
options,
keyUp;
column_number=parseInt($(event.target).attr("id").replace('-from-', '').replace('-to-', '').replace('yadcf-filter-' + table_selector_jq_friendly, ''), 10);
options=getOptions(oTable.selector)[column_number];
keyUp=function (){
if(event.target.id.indexOf("-from-")!==-1){
fromId=event.target.id;
toId=event.target.id.replace("-from-", "-to-");
min=document.getElementById(fromId).value;
max=document.getElementById(toId).value;
}else{
toId=event.target.id;
fromId=event.target.id.replace("-to-", "-from-");
max=document.getElementById(toId).value;
min=document.getElementById(fromId).value;
}
min=(min!=="") ? (+min):min;
max=(max!=="") ? (+max):max;
if((!isNaN(max)&&!isNaN(min)&&(max >=min))||min===""||max===""){
if(oTable.fnSettings().oFeatures.bServerSide!==true){
oTable.fnDraw();
}else{
oTable.fnFilter(min + '-yadcf_delim-' + max, column_number);
}
if(document.getElementById(fromId).value!==""){
$("#" + fromId).addClass("inuse");
}
if(document.getElementById(toId).value!==""){
$("#" + toId).addClass("inuse");
}
if($.trim(event.target.value)===""&&$(event.target).hasClass("inuse")){
$("#" + event.target.id).removeClass("inuse");
}
if(!oTable.fnSettings().oLoadedState){
oTable.fnSettings().oLoadedState={};
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}
if(oTable.fnSettings().oFeatures.bStateSave===true){
if(oTable.fnSettings().oLoadedState.yadcfState!==undefined&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly]!==undefined){
oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number] =
{
'from':min,
'to':max
};}else{
yadcfState={};
yadcfState[table_selector_jq_friendly]=[];
yadcfState[table_selector_jq_friendly][column_number]={
'from':min,
'to':max
};
oTable.fnSettings().oLoadedState.yadcfState=yadcfState;
}
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}}
resetIApiIndex();
};
if(options.filter_delay===undefined){
keyUp();
}else{
yadcfDelay(function (){
keyUp();
}, options.filter_delay);
}}
function doFilterMultiTablesMultiSelect(tablesSelectors, event, column_number_str, clear){
var columnsObj=getOptions(tablesSelectors + '_' + column_number_str)[column_number_str],
regex=false,
smart=true,
caseInsen=true,
tablesAsOne,
tablesArray=oTables[tablesSelectors],
selected_values=$(event.target).val(),
i;
event=eventTargetFixUp(event);
tablesAsOne=new $.fn.dataTable.Api(tablesArray);
if(clear!==undefined||selected_values==undefined||selected_values.length===0){
if(clear!==undefined){
$(event.target).parent().find('select').val('-1').focus();
$(event.target).parent().find('selectn ').removeClass("inuse");
}
if(columnsObj.column_number instanceof Array){
tablesAsOne.columns(columnsObj.column_number).search('').draw();
}else{
tablesAsOne.search('').draw();
}
refreshSelectPlugin(columnsObj, $('#' + columnsObj.filter_container_id + ' select'), '-1');
return;
}
$(event.target).addClass("inuse");
regex=true;
smart=false;
caseInsen=columnsObj.case_insensitive;
if(selected_values!==null){
for (i=selected_values.length - 1; i >=0; i--){
if(selected_values[i]==="-1"){
selected_values.splice(i, 1);
break;
}}
if(selected_values.length!==0){
selected_values=selected_values.join('narutouzomaki');
selected_values=selected_values.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
selected_values=selected_values.split('narutouzomaki').join('|');
}}
if(columnsObj.filter_match_mode==="exact"){
selected_values="^" + selected_values + "$";
}else if(columnsObj.filter_match_mode==="startsWith"){
selected_values="^" + selected_values;
}
if(columnsObj.column_number instanceof Array){
tablesAsOne.columns(columnsObj.column_number).search(selected_values, regex, smart, caseInsen).draw();
}else{
tablesAsOne.search(selected_values, regex, smart, caseInsen).draw();
}}
function doFilterMultiTables(tablesSelectors, event, column_number_str, clear){
var columnsObj=getOptions(tablesSelectors + '_' + column_number_str)[column_number_str],
regex=false,
smart=true,
caseInsen=true,
serachVal,
tablesAsOne,
tablesArray=oTables[tablesSelectors];
event=eventTargetFixUp(event);
tablesAsOne=new $.fn.dataTable.Api(tablesArray);
if(clear!==undefined||event.target.value==='-1'){
if(clear!==undefined){
$(event.target).parent().find('select').val('-1').focus();
$(event.target).parent().find('select').removeClass("inuse");
}
if(columnsObj.column_number instanceof Array){
tablesAsOne.columns(columnsObj.column_number).search('').draw();
}else{
tablesAsOne.search('').draw();
}
refreshSelectPlugin(columnsObj, $('#' + columnsObj.filter_container_id + ' select'), '-1');
return;
}
$(event.target).addClass("inuse");
serachVal=event.target.value;
smart=false;
caseInsen=columnsObj.case_insensitive;
if(columnsObj.column_number instanceof Array){
tablesAsOne.columns(columnsObj.column_number).search(serachVal, regex, smart, caseInsen).draw();
}else{
tablesAsOne.search(serachVal, regex, smart, caseInsen).draw();
}}
function textKeyUpMultiTables(tablesSelectors, event, column_number_str, clear){
var keyUp,
columnsObj=getOptions(tablesSelectors + '_' + column_number_str)[column_number_str],
regex=false,
smart=true,
caseInsen=true,
serachVal,
tablesAsOne,
tablesArray=oTables[tablesSelectors];
event=eventTargetFixUp(event);
tablesAsOne=new $.fn.dataTable.Api(tablesArray);
keyUp=function (tablesAsOne, event, clear){
if(clear!==undefined||event.target.value===''){
if(clear!==undefined){
$(event.target).prev().val("").focus();
$(event.target).prev().removeClass("inuse");
}else{
$(event.target).val("").focus();
$(event.target).removeClass("inuse");
}
if(columnsObj.column_number instanceof Array){
tablesAsOne.columns(columnsObj.column_number).search('').draw();
}else{
tablesAsOne.search('').draw();
}
return;
}
$(event.target).addClass("inuse");
serachVal=event.target.value;
smart=false;
caseInsen=columnsObj.case_insensitive;
if(columnsObj.column_number instanceof Array){
tablesAsOne.columns(columnsObj.column_number).search(serachVal, regex, smart, caseInsen).draw();
}else{
tablesAsOne.search(serachVal, regex, smart, caseInsen).draw();
}};
if(columnsObj.filter_delay===undefined){
keyUp(tablesAsOne, event, clear);
}else{
yadcfDelay(function (){
keyUp(tablesAsOne, event, clear);
}, columnsObj.filter_delay);
}}
function textKeyUP(ev, table_selector_jq_friendly, column_number, clear){
var column_number_filter,
oTable=oTables[table_selector_jq_friendly],
keyUp,
columnObj,
settingsDt=getSettingsObjFromTable(oTable),
exclude,
keyCodes=[37, 38, 39, 40];
if(keyCodes.indexOf(ev.keyCode)!==-1){
return;
}
column_number_filter=calcColumnNumberFilter(settingsDt, column_number, table_selector_jq_friendly);
columnObj=getOptions(oTable.selector)[column_number];
keyUp=function (table_selector_jq_friendly, column_number, clear){
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
if(clear==='clear'||$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).val()===''){
if(clear==='clear'&&exGetColumnFilterVal(oTable, column_number)===''){
return;
}
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).val("").focus();
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse");
oTable.fnFilter("", column_number_filter);
resetIApiIndex();
return;
}
if(columnObj.exclude===true){
exclude=$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).closest('.yadcf-filter-wrapper').find('.yadcf-exclude-wrapper :checkbox').prop('checked');
}
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).addClass("inuse");
yadcfMatchFilter(oTable, $("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).val(), columnObj.filter_match_mode, column_number_filter, exclude);
resetIApiIndex();
};
if(columnObj.filter_delay===undefined){
keyUp(table_selector_jq_friendly, column_number, clear);
}else{
yadcfDelay(function (){
keyUp(table_selector_jq_friendly, column_number, clear);
}, columnObj.filter_delay);
}}
function autocompleteKeyUP(table_selector_jq_friendly, event){
var oTable,
column_number,
keyCodes=[37, 38, 39, 40];
event=eventTargetFixUp(event);
if(keyCodes.indexOf(event.keyCode)!==-1){
return;
}
if(event.target.value===""&&event.keyCode===8&&$(event.target).hasClass("inuse")){
$.fn.dataTableExt.iApiIndex=oTablesIndex[table_selector_jq_friendly];
oTable=oTables[table_selector_jq_friendly];
column_number=parseInt($(event.target).attr("id").replace("yadcf-filter-" + table_selector_jq_friendly + "-", ""), 10);
$("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number).removeClass("inuse");
$(document).removeData("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val");
oTable.fnFilter("", column_number);
resetIApiIndex();
}}
function isDOMSource(tableVar){
var settingsDt;
settingsDt=getSettingsObjFromTable(tableVar);
if(settingsDt.sAjaxSource==undefined&&settingsDt.ajax==undefined){
return true;
}
return false;
}
function scrollXYHandler(oTable, table_selector){
var $tmpSelector,
filters_position=$(document).data(table_selector + "_filters_position"),
table_selector_jq_friendly=yadcf.generateTableSelectorJQFriendly(table_selector);
if(filters_position==='thead'){
filters_position='.dataTables_scrollHead';
}else{
filters_position='.dataTables_scrollFoot';
}
if(oTable.fnSettings().oScroll.sX!==''||oTable.fnSettings().oScroll.sY!==''){
$tmpSelector=$(table_selector).closest('.dataTables_scroll').find(filters_position + ' table');
$tmpSelector.addClass('yadcf-datatables-table-' + table_selector_jq_friendly);
}}
function firstFromObject(obj){
var key;
for (key in obj){
if(obj.hasOwnProperty(key)){
return key;
}}
}
function initAndBindTable(oTable, table_selector, index, pTableDT){
var table_selector_jq_friendly=yadcf.generateTableSelectorJQFriendly(table_selector),
table_selector_tmp;
oTables[table_selector_jq_friendly]=oTable;
tablesDT[table_selector_jq_friendly]=pTableDT;
oTablesIndex[table_selector_jq_friendly]=index;
scrollXYHandler(oTable, table_selector);
if(isDOMSource(oTable)){
table_selector_tmp=table_selector;
if(table_selector.indexOf(":eq")!==-1){
table_selector_tmp=table_selector.substring(0, table_selector.lastIndexOf(":eq"));
}
appendFilters(oTable, getOptions(table_selector_tmp), table_selector);
if(getOptions(table_selector_tmp)[firstFromObject(getOptions(table_selector_tmp))].cumulative_filtering===true){
$(document).off('search.dt', oTable.selector).on('search.dt', oTable.selector, function (e, settings, json){
var table_selector_tmp=oTable.selector;
if(table_selector.indexOf(":eq")!==-1){
table_selector_tmp=table_selector.substring(0, table_selector.lastIndexOf(":eq"));
}
appendFilters(oTable, getOptions(table_selector_tmp), oTable.selector);
});
}}else{
appendFilters(oTable, getOptions(table_selector), table_selector);
if(yadcfVersionCheck('1.10')){
$(document).off('xhr.dt', oTable.selector).on('xhr.dt', oTable.selector, function (e, settings, json){
var col_num,
column_number_filter,
table_selector_jq_friendly=generateTableSelectorJQFriendly(oTable.selector);
if(json==undefined){
console.log('datatables xhr.dt event came back with null as data (nothing for yadcf to do with it).');
return;
}
if(settings.oSavedState!==null){
initColReorder2(settings, table_selector_jq_friendly);
}
for (col_num in yadcf.getOptions(settings.oInstance.selector)){
if(yadcf.getOptions(settings.oInstance.selector).hasOwnProperty(col_num)){
if(json['yadcf_data_' + col_num]!==undefined){
column_number_filter=col_num;
if(settings.oSavedState!==null&&plugins[table_selector_jq_friendly]!==undefined){
column_number_filter=plugins[table_selector_jq_friendly].ColReorder[col_num];
}
yadcf.getOptions(settings.oInstance.selector)[col_num].data=json['yadcf_data_' + column_number_filter];
}}
}});
}}
if(yadcfVersionCheck('1.10')){
$(document).off('draw.dt', oTable.selector).on('draw.dt', oTable.selector, function (event, settings){
appendFilters(oTable, yadcf.getOptions(settings.oInstance.selector), settings.oInstance.selector);
});
$(document).off('column-visibility.dt', oTable.selector).on('column-visibility.dt', oTable.selector, function (e, settings, col_num, state){
var obj={},
columnsObj=getOptions(settings.oInstance.selector);
if(state===true&&settings._oFixedColumns===undefined){
if((plugins[table_selector_jq_friendly]!==undefined&&plugins[table_selector_jq_friendly].ColReorder!==undefined)){
col_num=plugins[table_selector_jq_friendly].ColReorder[col_num];
}else if(settings.oSavedState!=undefined&&settings.oSavedState.ColReorder!==undefined){
col_num=settings.oSavedState.ColReorder[col_num];
}
obj[col_num]=yadcf.getOptions(settings.oInstance.selector)[col_num];
if(obj[col_num]!==undefined){
obj[col_num].column_number=col_num;
if(obj[col_num]!==undefined){
appendFilters(oTables[yadcf.generateTableSelectorJQFriendly(settings.oInstance.selector)],
obj,
settings.oInstance.selector);
}}
}else if(settings._oFixedColumns!==undefined){
appendFilters(oTables[yadcf.generateTableSelectorJQFriendly(settings.oInstance.selector)],
columnsObj,
settings.oInstance.selector);
}});
$(document).off('column-reorder.dt', oTable.selector).on('column-reorder.dt', oTable.selector, function (e, settings, json){
var table_selector_jq_friendly=generateTableSelectorJQFriendly(oTable.selector);
initColReorderFromEvent(table_selector_jq_friendly);
});
$(document).off('destroy.dt', oTable.selector).on('destroy.dt', oTable.selector, function (event, ui){
removeFilters(oTable, yadcf.getOptions(ui.oInstance.selector), ui.oInstance.selector);
});
}else{
$(document).off('draw', oTable.selector).on('draw', oTable.selector, function (event, ui){
appendFilters(oTable, yadcf.getOptions(ui.oInstance.selector), ui.oInstance.selector);
});
$(document).off('destroy', oTable.selector).on('destroy', oTable.selector, function (event, ui){
removeFilters(oTable, yadcf.getOptions(ui.oInstance.selector), ui.oInstance.selector);
});
}
if(oTable.fnSettings().oFeatures.bStateSave===true){
if(yadcfVersionCheck('1.10')){
$(oTable.selector).off('stateSaveParams.dt').on('stateSaveParams.dt', function (e, settings, data){
if(settings.oLoadedState&&settings.oLoadedState.yadcfState!==undefined){
data.yadcfState=settings.oLoadedState.yadcfState;
}else{
data.naruto='kurama';
}});
}else{
$(oTable.selector).off('stateSaveParams').on('stateSaveParams', function (e, settings, data){
if(settings.oLoadedState&&settings.oLoadedState.yadcfState!==undefined){
data.yadcfState=settings.oLoadedState.yadcfState;
}else{
data.naruto='kurama';
}});
}
if(isDOMSource(oTable)){
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
oTable.fnDraw(false);
}}
}
$.fn.yadcf=function (options_arg, params){
var tmpParams,
i=0,
selector;
if(params===undefined){
params={};}
if(typeof params==='string'){
tmpParams=params;
params={};
params.filters_position=tmpParams;
}
if(params.filters_position===undefined||params.filters_position==='header'){
params.filters_position='thead';
}else{
params.filters_position='tfoot';
}
$(document).data(this.selector + "_filters_position", params.filters_position);
if($(this.selector).length===1){
setOptions(this.selector, options_arg, params);
initAndBindTable(this, this.selector, 0);
}else{
for (i; i < $(this.selector).length; i++){
$.fn.dataTableExt.iApiIndex=i;
selector=this.selector + ":eq(" + i + ")";
setOptions(this.selector, options_arg, params);
initAndBindTable(this, selector, i);
}
$.fn.dataTableExt.iApiIndex=0;
}
return this;
};
function init(oTable, options_arg, params){
var instance=oTable.settings()[0].oInstance,
i=0,
selector,
tmpParams;
if(params===undefined){
params={};}
if(typeof params==='string'){
tmpParams=params;
params={};
params.filters_position=tmpParams;
}
if(params.filters_position===undefined||params.filters_position==='header'){
params.filters_position='thead';
}else{
params.filters_position='tfoot';
}
$(document).data(instance.selector + "_filters_position", params.filters_position);
if($(instance.selector).length===1){
setOptions(instance.selector, options_arg, params);
initAndBindTable(instance, instance.selector, 0, oTable);
}else{
for (i; i < $(instance.selector).length; i++){
$.fn.dataTableExt.iApiIndex=i;
selector=instance.selector + ":eq(" + i + ")";
setOptions(instance.selector, options_arg, params);
initAndBindTable(instance, selector, i, oTable);
}
$.fn.dataTableExt.iApiIndex=0;
}}
function appendFiltersMultipleTables(tablesArray, tablesSelectors, colObjDummy){
var filter_selector_string="#" + colObjDummy.filter_container_id,
$filter_selector=$(filter_selector_string).find(".yadcf-filter"),
table_selector_jq_friendly=yadcf.generateTableSelectorJQFriendlyNew(tablesSelectors),
options_tmp,
ii,
column_number_str=columnsArrayToString(colObjDummy.column_number).column_number_str,
tableTmp,
tableTmpArr,
tableTmpArrIndex,
filterOptions=getOptions(tablesSelectors + '_' + column_number_str)[column_number_str],
column_number_index,
columnsTmpArr,
settingsDt,
tmpStr,
columnForStateSaving;
$(filter_selector_string).append("<div id=\"yadcf-filter-wrapper-" + table_selector_jq_friendly + '-' + column_number_str + "\" class=\"yadcf-filter-wrapper\"></div>");
filter_selector_string=filter_selector_string + " div.yadcf-filter-wrapper";
if(column_number_str.indexOf('_')!==-1){
columnForStateSaving=column_number_str.split('_')[0];
}else{
columnForStateSaving=column_number_str;
}
switch (filterOptions.filter_type){
case 'text':
$(filter_selector_string).append("<input type=\"text\" id=\"yadcf-filter-" + table_selector_jq_friendly + '-' + column_number_str + "\" class=\"yadcf-filter\" onmousedown=\"yadcf.stopPropagation(event);\" onclick='yadcf.stopPropagation(event);"
+ "' placeholder='" + filterOptions.filter_default_label + "'" + " onkeyup=\"yadcf.textKeyUpMultiTables('" + tablesSelectors + "',event,'" + column_number_str + "');\"></input>");
if(filterOptions.filter_reset_button_text!==false){
$(filter_selector_string).find(".yadcf-filter").after("<button type=\"button\" " + " id=\"yadcf-filter-" + table_selector_jq_friendly + '-' + column_number_str + "-reset\" onmousedown=\"yadcf.stopPropagation(event);\" " +
"onclick=\"yadcf.stopPropagation(event);yadcf.textKeyUpMultiTables('" + tablesSelectors + "', event,'" + column_number_str + "','clear'); return false;\" class=\"yadcf-filter-reset-button\">" + filterOptions.filter_reset_button_text + "</button>");
}
if(tablesArray[0].table!==undefined){
tableTmp=$('#' + tablesArray[0].table().node().id).dataTable();
}else{
tableTmp=tablesArray[0];
}
settingsDt=getSettingsObjFromTable(tableTmp);
if(settingsDt.aoPreSearchCols[columnForStateSaving].sSearch!==''){
tmpStr=settingsDt.aoPreSearchCols[columnForStateSaving].sSearch;
tmpStr=yadcfParseMatchFilter(tmpStr, filterOptions.filter_match_mode);
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number_str).val(tmpStr).addClass("inuse");
}
break;
case 'select':
case 'multi_select':
if(filterOptions.select_type===undefined){
options_tmp="<option data-placeholder=\"true\" value=\"" + "-1" + "\">" + filterOptions.filter_default_label + "</option>";
}else{
options_tmp="";
}
if(filterOptions.select_type==='select2'&&filterOptions.select_type_options.placeholder!==undefined&&filterOptions.select_type_options.allowClear===true){
options_tmp="<option value=\"\"></option>";
}
if(filterOptions.data===undefined){
filterOptions.data=[];
tableTmpArr=tablesSelectors.split(',');
for (tableTmpArrIndex=0; tableTmpArrIndex < tableTmpArr.length; tableTmpArrIndex++){
if(tablesArray[tableTmpArrIndex].table!==undefined){
tableTmp=$('#' + tablesArray[tableTmpArrIndex].table().node().id).dataTable();
}else{
tableTmp=tablesArray[tableTmpArrIndex];
}
if(isDOMSource(tableTmp)){
columnsTmpArr=filterOptions.column_number;
for (column_number_index=0; column_number_index < columnsTmpArr.length; column_number_index++){
filterOptions.column_number=columnsTmpArr[column_number_index];
filterOptions.data=filterOptions.data.concat(parseTableColumn(tableTmp, filterOptions, table_selector_jq_friendly));
}
filterOptions.column_number=columnsTmpArr;
}else{
$(document).off('draw.dt', '#' + tablesArray[tableTmpArrIndex].table().node().id).on('draw.dt', '#' + tablesArray[tableTmpArrIndex].table().node().id, function (event, ui){
var options_tmp='',
ii;
columnsTmpArr=filterOptions.column_number;
for (column_number_index=0; column_number_index < columnsTmpArr.length; column_number_index++){
filterOptions.column_number=columnsTmpArr[column_number_index];
filterOptions.data=filterOptions.data.concat(parseTableColumn(tableTmp, filterOptions, table_selector_jq_friendly));
}
filterOptions.column_number=columnsTmpArr;
filterOptions.data=sortColumnData(filterOptions.data, filterOptions);
for (ii=0; ii < filterOptions.data.length; ii++){
options_tmp +="<option value=\"" + filterOptions.data[ii] + "\">" + filterOptions.data[ii] + "</option>";
}
$('#' + filterOptions.filter_container_id + ' select').empty().append(options_tmp);
if(filterOptions.select_type!==undefined){
initializeSelectPlugin(filterOptions.select_type, $('#' + filterOptions.filter_container_id + ' select'), filterOptions.select_type_options);
}});
}}
}
filterOptions.data=sortColumnData(filterOptions.data, filterOptions);
if(tablesArray[0].table!==undefined){
tableTmp=$('#' + tablesArray[0].table().node().id).dataTable();
}else{
tableTmp=tablesArray[0];
}
settingsDt=getSettingsObjFromTable(tableTmp);
if(typeof filterOptions.data[0]==='object'){
for (ii=0; ii < filterOptions.data.length; ii++){
options_tmp +="<option value=\"" + filterOptions.data[ii].value + "\">" + filterOptions.data[ii].label + "</option>";
}}else{
for (ii=0; ii < filterOptions.data.length; ii++){
options_tmp +="<option value=\"" + filterOptions.data[ii] + "\">" + filterOptions.data[ii] + "</option>";
}}
if(filterOptions.filter_type==='select'){
$(filter_selector_string).append("<select id=\"yadcf-filter-" + table_selector_jq_friendly + '-' + column_number_str + "\" class=\"yadcf-filter\" " +
"onchange=\"yadcf.doFilterMultiTables('" + tablesSelectors + "',event,'" + column_number_str + "')\" onmousedown=\"yadcf.stopPropagation(event);\" onclick='yadcf.stopPropagation(event);'>" + options_tmp + "</select>");
if(settingsDt.aoPreSearchCols[columnForStateSaving].sSearch!==''){
tmpStr=settingsDt.aoPreSearchCols[columnForStateSaving].sSearch;
tmpStr=yadcfParseMatchFilter(tmpStr, filterOptions.filter_match_mode);
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number_str).val(tmpStr).addClass("inuse");
}}else if(filterOptions.filter_type==='multi_select'){
$(filter_selector_string).append("<select multiple data-placeholder=\"" + filterOptions.filter_default_label + "\" id=\"yadcf-filter-" + table_selector_jq_friendly + '-' + column_number_str + "\" class=\"yadcf-filter\" " +
"onchange=\"yadcf.doFilterMultiTablesMultiSelect('" + tablesSelectors + "',event,'" + column_number_str + "')\" onmousedown=\"yadcf.stopPropagation(event);\" onclick='yadcf.stopPropagation(event);'>" + options_tmp + "</select>");
if(settingsDt.aoPreSearchCols[columnForStateSaving].sSearch!==''){
tmpStr=settingsDt.aoPreSearchCols[columnForStateSaving].sSearch;
tmpStr=yadcfParseMatchFilterMultiSelect(tmpStr, filterOptions.filter_match_mode);
tmpStr=tmpStr.replace(/\\/g, "");
tmpStr=tmpStr.split("|");
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number_str).val(tmpStr);
}}
if(filterOptions.filter_type==='select'){
if(filterOptions.filter_reset_button_text!==false){
$(filter_selector_string).find(".yadcf-filter").after("<button type=\"button\" " + " id=\"yadcf-filter-" + table_selector_jq_friendly  + '-' + column_number_str + "-reset\" onmousedown=\"yadcf.stopPropagation(event);\" " +
"onclick=\"yadcf.stopPropagation(event);yadcf.doFilterMultiTables('" + tablesSelectors + "', event,'" + column_number_str + "','clear'); return false;\" class=\"yadcf-filter-reset-button\">" + filterOptions.filter_reset_button_text + "</button>");
}}else if(filterOptions.filter_type==='multi_select'){
if(filterOptions.filter_reset_button_text!==false){
$(filter_selector_string).find(".yadcf-filter").after("<button type=\"button\" " + " id=\"yadcf-filter-" + table_selector_jq_friendly + '-' + column_number_str + "-reset\" onmousedown=\"yadcf.stopPropagation(event);\" " +
"onclick=\"yadcf.stopPropagation(event);yadcf.doFilterMultiTablesMultiSelect('" + tablesSelectors + "', event,'" + column_number_str + "','clear'); return false;\" class=\"yadcf-filter-reset-button\">" + filterOptions.filter_reset_button_text + "</button>");
}}
if(filterOptions.select_type!==undefined){
initializeSelectPlugin(filterOptions.select_type, $("#yadcf-filter-" + table_selector_jq_friendly + '-' + column_number_str), filterOptions.select_type_options);
}
break;
default:
alert('Filters Multiple Tables does not support ' + filterOptions.filter_type);
}}
function initMultipleTables(tablesArray, filtersOptions){
var i,
tablesSelectors='',
default_options={
filter_type:"text",
filter_container_id: '',
filter_reset_button_text: 'x',
case_insensitive: true
},
columnsObjKey,
columnsObj,
columnsArrIndex,
column_number_str,
dummyArr;
for (columnsArrIndex=0; columnsArrIndex < filtersOptions.length; columnsArrIndex++){
dummyArr=[];
columnsObj=filtersOptions[columnsArrIndex];
if(columnsObj.filter_default_label===undefined){
if(columnsObj.filter_type==="select"||columnsObj.filter_type==='custom_func'){
columnsObj.filter_default_label="Select value";
}else if(columnsObj.filter_type==="multi_select"||columnsObj.filter_type==='multi_select_custom_func'){
columnsObj.filter_default_label="Select values";
}else if(columnsObj.filter_type==="auto_complete"||columnsObj.filter_type==="text"){
columnsObj.filter_default_label='Type to filter';
}else if(columnsObj.filter_type==="range_number"||columnsObj.filter_type==="range_date"){
columnsObj.filter_default_label=["from", "to"];
}else if(columnsObj.filter_type==="date"){
columnsObj.filter_default_label="Select a date";
}}
columnsObj=$.extend({}, default_options, columnsObj);
column_number_str=columnsArrayToString(columnsObj.column_number).column_number_str;
columnsObj.column_number_str=column_number_str;
dummyArr.push(columnsObj);
tablesSelectors='';
for (i=0; i < tablesArray.length; i++){
if(tablesArray[i].table!==undefined){
tablesSelectors +=tablesArray[i].table().node().id + ',';
}else{
tablesSelectors +=getSettingsObjFromTable(tablesArray[i]).sTableId;
}}
tablesSelectors=tablesSelectors.substring(0, tablesSelectors.length - 1);
setOptions(tablesSelectors + '_' + column_number_str, dummyArr);
oTables[tablesSelectors]=tablesArray;
appendFiltersMultipleTables(tablesArray, tablesSelectors, columnsObj);
}}
function initMultipleColumns(table, filtersOptions){
var tablesArray=[];
tablesArray.push(table);
initMultipleTables(tablesArray, filtersOptions);
}
function stopPropagation(evt){
if(evt.stopPropagation!==undefined){
evt.stopPropagation();
}else{
evt.cancelBubble=true;
}}
function preventDefaultForEnter(evt){
if(evt.keyCode===13){
if(evt.preventDefault){
evt.preventDefault();
}else{
evt.returnValue=false;
}}
}
function exInternalFilterColumnAJAXQueue(table_arg, col_filter_arr){
return function (){
exFilterColumn(table_arg, col_filter_arr, true);
};}
function exFilterColumn(table_arg, col_filter_arr, ajaxSource){
var table_selector_jq_friendly,
j,
tmpStr,
column_number,
column_position,
filter_value,
fromId,
toId,
sliderId,
optionsObj,
min,
max,
exclude=false;
if(table_arg.settings!==undefined){
table_arg=table_arg.settings()[0].oInstance;
}
table_selector_jq_friendly=yadcf.generateTableSelectorJQFriendly(table_arg.selector);
if(isDOMSource(table_arg)||ajaxSource===true){
for (j=0; j < col_filter_arr.length; j++){
column_number=col_filter_arr[j][0];
column_position=column_number;
exclude=false;
if(plugins[table_selector_jq_friendly]!==undefined&&(plugins[table_selector_jq_friendly]!==undefined&&plugins[table_selector_jq_friendly].ColReorder!==undefined)){
column_position=plugins[table_selector_jq_friendly].ColReorder[column_number];
}
optionsObj=getOptions(table_arg.selector)[column_number];
filter_value=col_filter_arr[j][1];
switch (optionsObj.filter_type){
case 'auto_complete':
case 'text':
case 'date':
if(filter_value!==undefined&&filter_value.indexOf('_exclude_')!==-1){
exclude=true;
filter_value=filter_value.replace('_exclude_', '');
}
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(filter_value);
if(filter_value!==''){
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).addClass('inuse');
}else{
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).removeClass('inuse');
}
tmpStr=yadcfMatchFilterString(table_arg, column_position, filter_value, optionsObj.filter_match_mode, false, exclude);
table_arg.fnSettings().aoPreSearchCols[column_position].sSearch=tmpStr;
break;
case 'select':
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(filter_value);
if(filter_value!==''){
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).addClass('inuse');
}else{
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).removeClass('inuse');
}
tmpStr=yadcfMatchFilterString(table_arg, column_position, filter_value, optionsObj.filter_match_mode, false);
table_arg.fnSettings().aoPreSearchCols[column_position].sSearch=tmpStr;
if(optionsObj.select_type!==undefined){
refreshSelectPlugin(optionsObj, $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number), '-1');
}
break;
case 'multi_select':
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(filter_value);
tmpStr=yadcfMatchFilterString(table_arg, column_position, filter_value, optionsObj.filter_match_mode, true);
table_arg.fnSettings().aoPreSearchCols[column_position].sSearch=tmpStr;
if(optionsObj.select_type!==undefined){
refreshSelectPlugin(optionsObj, $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number), '-1');
}
break;
case 'range_date':
fromId='yadcf-filter-' + table_selector_jq_friendly + '-from-date-' + column_number;
toId='yadcf-filter-' + table_selector_jq_friendly + '-to-date-' + column_number;
$('#' + fromId).val(filter_value.from);
if(filter_value.from!==''){
$('#' + fromId).addClass('inuse');
}else{
$('#' + fromId).removeClass('inuse');
}
$('#' + toId).val(filter_value.to);
if(filter_value.to!==''){
$('#' + toId).addClass('inuse');
}else{
$('#' + toId).removeClass('inuse');
}
if(table_arg.fnSettings().oFeatures.bServerSide===true){
min=filter_value.from;
max=filter_value.to;
table_arg.fnSettings().aoPreSearchCols[column_position].sSearch=min + '-yadcf_delim-' + max;
}
saveStateSave(table_arg, column_number, table_selector_jq_friendly, filter_value.from, filter_value.to);
break;
case 'range_number':
fromId='yadcf-filter-' + table_selector_jq_friendly + '-from-' + column_number;
toId='yadcf-filter-' + table_selector_jq_friendly + '-to-' + column_number;
$('#' + fromId).val(filter_value.from);
if(filter_value.from!==''){
$('#' + fromId).addClass('inuse');
}else{
$('#' + fromId).removeClass('inuse');
}
$('#' + toId).val(filter_value.to);
if(filter_value.to!==''){
$('#' + toId).addClass('inuse');
}else{
$('#' + toId).removeClass('inuse');
}
if(table_arg.fnSettings().oFeatures.bServerSide===true){
table_arg.fnSettings().aoPreSearchCols[column_position].sSearch=filter_value.from + '-yadcf_delim-' + filter_value.to;
}
saveStateSave(table_arg, column_number, table_selector_jq_friendly, filter_value.from, filter_value.to);
break;
case 'range_number_slider':
sliderId='yadcf-filter-' + table_selector_jq_friendly + '-slider-' + column_number;
fromId='yadcf-filter-' + table_selector_jq_friendly + '-min_tip-' + column_number;
toId='yadcf-filter-' + table_selector_jq_friendly + '-max_tip-' + column_number;
if(filter_value.from!==''){
min=$('#' + fromId).closest('.yadcf-filter-range-number-slider').find(".yadcf-filter-range-number-slider-min-tip-hidden").text();
max=$('#' + fromId).closest('.yadcf-filter-range-number-slider').find(".yadcf-filter-range-number-slider-max-tip-hidden").text();
$('#' + fromId).text(filter_value.from);
if(min!==filter_value.from){
$('#' + fromId).parent().addClass('inuse');
$('#' + fromId).parent().parent().find('ui-slider-range').addClass('inuse');
}else{
$('#' + fromId).parent().removeClass('inuse');
$('#' + fromId).parent().parent().find('ui-slider-range').removeClass('inuse');
}
$('#' + sliderId).slider('values', 0, filter_value.from);
}
if(filter_value.to!==''){
$('#' + toId).text(filter_value.to);
if(max!==filter_value.to){
$('#' + toId).parent().addClass('inuse');
$('#' + toId).parent().parent().find('.ui-slider-range').addClass('inuse');
}else{
$('#' + toId).parent().removeClass('inuse');
$('#' + toId).parent().parent().find('.ui-slider-range').removeClass('inuse');
}
$('#' + sliderId).slider('values', 1, filter_value.to);
}
if(table_arg.fnSettings().oFeatures.bServerSide===true){
table_arg.fnSettings().aoPreSearchCols[column_position].sSearch=filter_value.from + '-yadcf_delim-' + filter_value.to;
}
saveStateSave(table_arg, column_number, table_selector_jq_friendly, filter_value.from, filter_value.to);
break;
case 'custom_func':
case 'multi_select_custom_func':
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).val(filter_value);
if(filter_value!==''){
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).addClass('inuse');
}else{
$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number).removeClass('inuse');
}
if(table_arg.fnSettings().oFeatures.bServerSide===true){
table_arg.fnSettings().aoPreSearchCols[column_position].sSearch=filter_value;
}
if(optionsObj.select_type!==undefined){
refreshSelectPlugin(optionsObj, $('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number), filter_value);
}
saveStateSave(table_arg, column_number, table_selector_jq_friendly, filter_value, '');
break;
}}
if(table_arg.fnSettings().oFeatures.bServerSide!==true){
table_arg.fnDraw();
}else{
setTimeout(function (){
table_arg.fnDraw();
}, 10);
}}else{
exFilterColumnQueue.push(exInternalFilterColumnAJAXQueue(table_arg, col_filter_arr));
}}
function exGetColumnFilterVal(table_arg, column_number){
var retVal,
fromId,
toId,
table_selector_jq_friendly,
optionsObj,
$filterElement;
if(table_arg.settings!==undefined){
table_arg=table_arg.settings()[0].oInstance;
}
optionsObj=getOptions(table_arg.selector)[column_number];
table_selector_jq_friendly=yadcf.generateTableSelectorJQFriendly(table_arg.selector);
$filterElement=$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number);
switch (optionsObj.filter_type){
case 'select':
case 'custom_func':
retVal=$filterElement.val();
if(retVal==='-1'){
retVal='';
}
break;
case 'auto_complete':
case 'text':
case 'date':
retVal=$filterElement.val();
if($filterElement.prev().hasClass('yadcf-exclude-wrapper')&&$filterElement.prev().find('input').prop('checked')===true){
retVal='_exclude_' + retVal;
}
break;
case 'multi_select':
retVal=$filterElement.val();
if(retVal===null){
retVal='';
}
break;
case 'range_date':
retVal={};
fromId='yadcf-filter-' + table_selector_jq_friendly + '-from-date-' + column_number;
toId='yadcf-filter-' + table_selector_jq_friendly + '-to-date-' + column_number;
retVal.from=$('#' + fromId).val();
retVal.to=$('#' + toId).val();
break;
case 'range_number':
retVal={};
fromId='yadcf-filter-' + table_selector_jq_friendly + '-from-' + column_number;
toId='yadcf-filter-' + table_selector_jq_friendly + '-to-' + column_number;
retVal.from=$('#' + fromId).val();
retVal.to=$('#' + toId).val();
break;
case 'range_number_slider':
retVal={};
fromId='yadcf-filter-' + table_selector_jq_friendly + '-min_tip-' + column_number;
toId='yadcf-filter-' + table_selector_jq_friendly + '-max_tip-' + column_number;
retVal.from=$('#' + fromId).text();
retVal.to=$('#' + toId).text();
break;
default:
console.log('exGetColumnFilterVal error: no such filter_type: ' + optionsObj.filter_type);
}
return retVal;
}
function clearStateSave(oTable, column_number, table_selector_jq_friendly){
var yadcfState;
if(oTable.fnSettings().oFeatures.bStateSave===true){
if(!oTable.fnSettings().oLoadedState){
oTable.fnSettings().oLoadedState={};
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}
if(oTable.fnSettings().oLoadedState.yadcfState!==undefined&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly]!==undefined){
oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number]=undefined;
}else{
yadcfState={};
yadcfState[table_selector_jq_friendly]=[];
yadcfState[table_selector_jq_friendly][column_number]=undefined;
oTable.fnSettings().oLoadedState.yadcfState=yadcfState;
}
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}}
function saveStateSave(oTable, column_number, table_selector_jq_friendly, from, to){
var yadcfState;
if(oTable.fnSettings().oFeatures.bStateSave===true){
if(!oTable.fnSettings().oLoadedState){
oTable.fnSettings().oLoadedState={};}
if(oTable.fnSettings().oLoadedState.yadcfState!==undefined&&oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly]!==undefined){
oTable.fnSettings().oLoadedState.yadcfState[table_selector_jq_friendly][column_number]={
'from':from,
'to':to
};}else{
yadcfState={};
yadcfState[table_selector_jq_friendly]=[];
yadcfState[table_selector_jq_friendly][column_number]={
'from':from,
'to':to
};
oTable.fnSettings().oLoadedState.yadcfState=yadcfState;
}
oTable.fnSettings().oApi._fnSaveState(oTable.fnSettings());
}}
function exResetAllFilters(table_arg, noRedraw, columns){
var table_selector_jq_friendly,
column_number,
fromId,
toId,
sliderId,
tableOptions,
optionsObj,
columnObjKey,
settingsDt=getSettingsObjFromTable(table_arg),
i,
$filterElement;
if(table_arg.settings!==undefined){
table_arg=table_arg.settings()[0].oInstance;
}
tableOptions=getOptions(table_arg.selector);
table_selector_jq_friendly=yadcf.generateTableSelectorJQFriendly(table_arg.selector);
settingsDt=getSettingsObjFromTable(table_arg);
for (columnObjKey in tableOptions){
if(tableOptions.hasOwnProperty(columnObjKey)){
optionsObj=tableOptions[columnObjKey];
column_number=optionsObj.column_number;
if(columns!==undefined&&$.inArray(column_number, columns)===-1){
continue;
}
$(document).removeData("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val");
$filterElement=$('#yadcf-filter-' + table_selector_jq_friendly + '-' + column_number);
switch (optionsObj.filter_type){
case 'select':
case 'custom_func':
$filterElement.val('-1').removeClass('inuse');
table_arg.fnSettings().aoPreSearchCols[column_number].sSearch='';
if(optionsObj.select_type!==undefined){
refreshSelectPlugin(optionsObj, $filterElement, '-1');
}
break;
case 'auto_complete':
case 'text':
case 'date':
$filterElement.val('').removeClass('inuse');
table_arg.fnSettings().aoPreSearchCols[column_number].sSearch='';
if($filterElement.prev().hasClass('yadcf-exclude-wrapper')){
$filterElement.prev().find('input').prop('checked', false);
}
break;
case 'multi_select':
case 'multi_select_custom_func':
$filterElement.val('-1');
$(document).data("#yadcf-filter-" + table_selector_jq_friendly + "-" + column_number + "_val", undefined);
table_arg.fnSettings().aoPreSearchCols[column_number].sSearch='';
if(optionsObj.select_type!==undefined){
refreshSelectPlugin(optionsObj, $filterElement, '-1');
}
break;
case 'range_date':
fromId='yadcf-filter-' + table_selector_jq_friendly + '-from-date-' + column_number;
toId='yadcf-filter-' + table_selector_jq_friendly + '-to-date-' + column_number;
$('#' + fromId).val('');
$('#' + fromId).removeClass('inuse');
$('#' + toId).val('');
$('#' + toId).removeClass('inuse');
if(table_arg.fnSettings().oFeatures.bServerSide===true){
table_arg.fnSettings().aoPreSearchCols[column_number].sSearch='';
}
clearStateSave(table_arg, column_number, table_selector_jq_friendly);
break;
case 'range_number':
fromId='yadcf-filter-' + table_selector_jq_friendly + '-from-' + column_number;
toId='yadcf-filter-' + table_selector_jq_friendly + '-to-' + column_number;
$('#' + fromId).val('');
$('#' + fromId).removeClass('inuse');
$('#' + toId).val('');
$('#' + toId).removeClass('inuse');
if(table_arg.fnSettings().oFeatures.bServerSide===true){
table_arg.fnSettings().aoPreSearchCols[column_number].sSearch='';
}
clearStateSave(table_arg, column_number, table_selector_jq_friendly);
break;
case 'range_number_slider':
sliderId='yadcf-filter-' + table_selector_jq_friendly + '-slider-' + column_number;
fromId='yadcf-filter-' + table_selector_jq_friendly + '-min_tip-' + column_number;
toId='yadcf-filter-' + table_selector_jq_friendly + '-max_tip-' + column_number;
$('#' + fromId).text('');
$('#' + fromId).parent().removeClass('inuse');
$('#' + fromId).parent().parent().find('ui-slider-range').removeClass('inuse');
$('#' + toId).text('');
$('#' + toId).parent().removeClass('inuse');
$('#' + toId).parent().parent().find('.ui-slider-range').removeClass('inuse');
$('#' + sliderId).slider("option", "values", [$('#' + fromId).parent().parent().find('.yadcf-filter-range-number-slider-min-tip-hidden').text(), $('#' + fromId).parent().parent().find('.yadcf-filter-range-number-slider-max-tip-hidden').text()]);
if(table_arg.fnSettings().oFeatures.bServerSide===true){
table_arg.fnSettings().aoPreSearchCols[column_number].sSearch='';
}
clearStateSave(table_arg, column_number, table_selector_jq_friendly);
break;
}}
}
if(noRedraw!==true){
settingsDt.oPreviousSearch.sSearch='';
if(settingsDt.aanFeatures.f!==undefined){
for (i=0; i < settingsDt.aanFeatures.f.length; i++){
$('input', settingsDt.aanFeatures.f[i]).val('');
}}
table_arg.fnDraw(settingsDt);
}}
function exResetFilters(table_arg, columns, noRedraw){
exResetAllFilters(table_arg, noRedraw, columns);
}
function exFilterExternallyTriggered(table_arg){
var columnsObj,
columnObjKey,
columnObj,
filterValue,
filtersValuesSingleElem,
filtersValuesArr=[];
if(table_arg.settings!==undefined){
table_arg=table_arg.settings()[0].oInstance;
}
columnsObj=getOptions(table_arg.selector);
for (columnObjKey in columnsObj){
if(columnsObj.hasOwnProperty(columnObjKey)){
columnObj=columnsObj[columnObjKey];
filterValue=exGetColumnFilterVal(table_arg, columnObj.column_number);
filtersValuesSingleElem=[];
filtersValuesSingleElem.push(columnObj.column_number);
filtersValuesSingleElem.push(filterValue);
filtersValuesArr.push(filtersValuesSingleElem);
}}
exFilterColumn(table_arg, filtersValuesArr, true);
}
return {
init:init,
doFilter:doFilter,
doFilterMultiSelect:doFilterMultiSelect,
doFilterAutocomplete:doFilterAutocomplete,
autocompleteKeyUP:autocompleteKeyUP,
getOptions:getOptions,
rangeNumberKeyUP:rangeNumberKeyUP,
rangeDateKeyUP:rangeDateKeyUP,
rangeClear:rangeClear,
rangeNumberSliderClear:rangeNumberSliderClear,
stopPropagation:stopPropagation,
generateTableSelectorJQFriendly:generateTableSelectorJQFriendly,
exFilterColumn:exFilterColumn,
exGetColumnFilterVal:exGetColumnFilterVal,
exResetAllFilters: exResetAllFilters,
dateKeyUP:dateKeyUP,
dateSelectSingle:dateSelectSingle,
textKeyUP:textKeyUP,
doFilterCustomDateFunc:doFilterCustomDateFunc,
eventTargetFixUp:eventTargetFixUp,
initMultipleTables: initMultipleTables,
initMultipleColumns: initMultipleColumns,
textKeyUpMultiTables: textKeyUpMultiTables,
doFilterMultiTables: doFilterMultiTables,
doFilterMultiTablesMultiSelect: doFilterMultiTablesMultiSelect,
generateTableSelectorJQFriendlyNew: generateTableSelectorJQFriendlyNew,
exFilterExternallyTriggered: exFilterExternallyTriggered,
exResetFilters: exResetFilters,
initSelectPluginCustomTriggers: initSelectPluginCustomTriggers,
preventDefaultForEnter: preventDefaultForEnter
};}(jQuery));
(function(factory){
if(typeof define==="function"&&define.amd){
define([ "jquery" ], factory);
}else{
factory(jQuery);
}}(function($){
$.ui=$.ui||{};
var version=$.ui.version="1.12.0";
var widgetUuid=0;
var widgetSlice=Array.prototype.slice;
$.cleanData=(function(orig){
return function(elems){
var events, elem, i;
for(i=0;(elem=elems[ i ])!=null; i++){
try {
events=$._data(elem, "events");
if(events&&events.remove){
$(elem).triggerHandler("remove");
}} catch(e){}}
orig(elems);
};})($.cleanData);
$.widget=function(name, base, prototype){
var existingConstructor, constructor, basePrototype;
var proxiedPrototype={};
var namespace=name.split(".")[ 0 ];
name=name.split(".")[ 1 ];
var fullName=namespace + "-" + name;
if(!prototype){
prototype=base;
base=$.Widget;
}
if($.isArray(prototype) ){
prototype=$.extend.apply(null, [ {} ].concat(prototype) );
}
$.expr[ ":" ][ fullName.toLowerCase() ]=function(elem){
return !!$.data(elem, fullName);
};
$[ namespace ]=$[ namespace ]||{};
existingConstructor=$[ namespace ][ name ];
constructor=$[ namespace ][ name ]=function(options, element){
if(!this._createWidget){
return new constructor(options, element);
}
if(arguments.length){
this._createWidget(options, element);
}};
$.extend(constructor, existingConstructor, {
version: prototype.version,
_proto: $.extend({}, prototype),
_childConstructors: []
});
basePrototype=new base();
basePrototype.options=$.widget.extend({}, basePrototype.options);
$.each(prototype, function(prop, value){
if(!$.isFunction(value) ){
proxiedPrototype[ prop ]=value;
return;
}
proxiedPrototype[ prop ]=(function(){
function _super(){
return base.prototype[ prop ].apply(this, arguments);
}
function _superApply(args){
return base.prototype[ prop ].apply(this, args);
}
return function(){
var __super=this._super;
var __superApply=this._superApply;
var returnValue;
this._super=_super;
this._superApply=_superApply;
returnValue=value.apply(this, arguments);
this._super=__super;
this._superApply=__superApply;
return returnValue;
};})();
});
constructor.prototype=$.widget.extend(basePrototype, {
widgetEventPrefix: existingConstructor ?(basePrototype.widgetEventPrefix||name):name
}, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
widgetFullName: fullName
});
if(existingConstructor){
$.each(existingConstructor._childConstructors, function(i, child){
var childPrototype=child.prototype;
$.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor,
child._proto);
});
delete existingConstructor._childConstructors;
}else{
base._childConstructors.push(constructor);
}
$.widget.bridge(name, constructor);
return constructor;
};
$.widget.extend=function(target){
var input=widgetSlice.call(arguments, 1);
var inputIndex=0;
var inputLength=input.length;
var key;
var value;
for(; inputIndex < inputLength; inputIndex++){
for(key in input[ inputIndex ]){
value=input[ inputIndex ][ key ];
if(input[ inputIndex ].hasOwnProperty(key)&&value!==undefined){
if($.isPlainObject(value) ){
target[ key ]=$.isPlainObject(target[ key ]) ?
$.widget.extend({}, target[ key ], value) :
$.widget.extend({}, value);
}else{
target[ key ]=value;
}}
}}
return target;
};
$.widget.bridge=function(name, object){
var fullName=object.prototype.widgetFullName||name;
$.fn[ name ]=function(options){
var isMethodCall=typeof options==="string";
var args=widgetSlice.call(arguments, 1);
var returnValue=this;
if(isMethodCall){
this.each(function(){
var methodValue;
var instance=$.data(this, fullName);
if(options==="instance"){
returnValue=instance;
return false;
}
if(!instance){
return $.error("cannot call methods on " + name +
" prior to initialization; " +
"attempted to call method '" + options + "'");
}
if(!$.isFunction(instance[ options ])||options.charAt(0)==="_"){
return $.error("no such method '" + options + "' for " + name +
" widget instance");
}
methodValue=instance[ options ].apply(instance, args);
if(methodValue!==instance&&methodValue!==undefined){
returnValue=methodValue&&methodValue.jquery ?
returnValue.pushStack(methodValue.get()) :
methodValue;
return false;
}});
}else{
if(args.length){
options=$.widget.extend.apply(null, [ options ].concat(args) );
}
this.each(function(){
var instance=$.data(this, fullName);
if(instance){
instance.option(options||{});
if(instance._init){
instance._init();
}}else{
$.data(this, fullName, new object(options, this) );
}});
}
return returnValue;
};};
$.Widget=function(){};
$.Widget._childConstructors=[];
$.Widget.prototype={
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
classes: {},
disabled: false,
create: null
},
_createWidget: function(options, element){
element=$(element||this.defaultElement||this)[ 0 ];
this.element=$(element);
this.uuid=widgetUuid++;
this.eventNamespace="." + this.widgetName + this.uuid;
this.bindings=$();
this.hoverable=$();
this.focusable=$();
this.classesElementLookup={};
if(element!==this){
$.data(element, this.widgetFullName, this);
this._on(true, this.element, {
remove: function(event){
if(event.target===element){
this.destroy();
}}
});
this.document=$(element.style ?
element.ownerDocument :
element.document||element);
this.window=$(this.document[ 0 ].defaultView||this.document[ 0 ].parentWindow);
}
this.options=$.widget.extend({},
this.options,
this._getCreateOptions(),
options);
this._create();
if(this.options.disabled){
this._setOptionDisabled(this.options.disabled);
}
this._trigger("create", null, this._getCreateEventData());
this._init();
},
_getCreateOptions: function(){
return {};},
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,
destroy: function(){
var that=this;
this._destroy();
$.each(this.classesElementLookup, function(key, value){
that._removeClass(value, key);
});
this.element
.off(this.eventNamespace)
.removeData(this.widgetFullName);
this.widget()
.off(this.eventNamespace)
.removeAttr("aria-disabled");
this.bindings.off(this.eventNamespace);
},
_destroy: $.noop,
widget: function(){
return this.element;
},
option: function(key, value){
var options=key;
var parts;
var curOption;
var i;
if(arguments.length===0){
return $.widget.extend({}, this.options);
}
if(typeof key==="string"){
options={};
parts=key.split(".");
key=parts.shift();
if(parts.length){
curOption=options[ key ]=$.widget.extend({}, this.options[ key ]);
for(i=0; i < parts.length - 1; i++){
curOption[ parts[ i ] ]=curOption[ parts[ i ] ]||{};
curOption=curOption[ parts[ i ] ];
}
key=parts.pop();
if(arguments.length===1){
return curOption[ key ]===undefined ? null:curOption[ key ];
}
curOption[ key ]=value;
}else{
if(arguments.length===1){
return this.options[ key ]===undefined ? null:this.options[ key ];
}
options[ key ]=value;
}}
this._setOptions(options);
return this;
},
_setOptions: function(options){
var key;
for(key in options){
this._setOption(key, options[ key ]);
}
return this;
},
_setOption: function(key, value){
if(key==="classes"){
this._setOptionClasses(value);
}
this.options[ key ]=value;
if(key==="disabled"){
this._setOptionDisabled(value);
}
return this;
},
_setOptionClasses: function(value){
var classKey, elements, currentElements;
for(classKey in value){
currentElements=this.classesElementLookup[ classKey ];
if(value[ classKey ]===this.options.classes[ classKey ] ||
!currentElements ||
!currentElements.length){
continue;
}
elements=$(currentElements.get());
this._removeClass(currentElements, classKey);
elements.addClass(this._classes({
element: elements,
keys: classKey,
classes: value,
add: true
}) );
}},
_setOptionDisabled: function(value){
this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value);
if(value){
this._removeClass(this.hoverable, null, "ui-state-hover");
this._removeClass(this.focusable, null, "ui-state-focus");
}},
enable: function(){
return this._setOptions({ disabled: false });
},
disable: function(){
return this._setOptions({ disabled: true });
},
_classes: function(options){
var full=[];
var that=this;
options=$.extend({
element: this.element,
classes: this.options.classes||{}}, options);
function processClassString(classes, checkOption){
var current, i;
for(i=0; i < classes.length; i++){
current=that.classesElementLookup[ classes[ i ] ]||$();
if(options.add){
current=$($.unique(current.get().concat(options.element.get()) ));
}else{
current=$(current.not(options.element).get());
}
that.classesElementLookup[ classes[ i ] ]=current;
full.push(classes[ i ]);
if(checkOption&&options.classes[ classes[ i ] ]){
full.push(options.classes[ classes[ i ] ]);
}}
}
if(options.keys){
processClassString(options.keys.match(/\S+/g)||[], true);
}
if(options.extra){
processClassString(options.extra.match(/\S+/g)||[]);
}
return full.join(" ");
},
_removeClass: function(element, keys, extra){
return this._toggleClass(element, keys, extra, false);
},
_addClass: function(element, keys, extra){
return this._toggleClass(element, keys, extra, true);
},
_toggleClass: function(element, keys, extra, add){
add=(typeof add==="boolean") ? add:extra;
var shift=(typeof element==="string"||element===null),
options={
extra: shift ? keys:extra,
keys: shift ? element:keys,
element: shift ? this.element:element,
add: add
};
options.element.toggleClass(this._classes(options), add);
return this;
},
_on: function(suppressDisabledCheck, element, handlers){
var delegateElement;
var instance=this;
if(typeof suppressDisabledCheck!=="boolean"){
handlers=element;
element=suppressDisabledCheck;
suppressDisabledCheck=false;
}
if(!handlers){
handlers=element;
element=this.element;
delegateElement=this.widget();
}else{
element=delegateElement=$(element);
this.bindings=this.bindings.add(element);
}
$.each(handlers, function(event, handler){
function handlerProxy(){
if(!suppressDisabledCheck &&
(instance.options.disabled===true ||
$(this).hasClass("ui-state-disabled") )){
return;
}
return(typeof handler==="string" ? instance[ handler ]:handler)
.apply(instance, arguments);
}
if(typeof handler!=="string"){
handlerProxy.guid=handler.guid =
handler.guid||handlerProxy.guid||$.guid++;
}
var match=event.match(/^([\w:-]*)\s*(.*)$/);
var eventName=match[ 1 ] + instance.eventNamespace;
var selector=match[ 2 ];
if(selector){
delegateElement.on(eventName, selector, handlerProxy);
}else{
element.on(eventName, handlerProxy);
}});
},
_off: function(element, eventName){
eventName=(eventName||"").split(" ").join(this.eventNamespace + " ") +
this.eventNamespace;
element.off(eventName).off(eventName);
this.bindings=$(this.bindings.not(element).get());
this.focusable=$(this.focusable.not(element).get());
this.hoverable=$(this.hoverable.not(element).get());
},
_delay: function(handler, delay){
function handlerProxy(){
return(typeof handler==="string" ? instance[ handler ]:handler)
.apply(instance, arguments);
}
var instance=this;
return setTimeout(handlerProxy, delay||0);
},
_hoverable: function(element){
this.hoverable=this.hoverable.add(element);
this._on(element, {
mouseenter: function(event){
this._addClass($(event.currentTarget), null, "ui-state-hover");
},
mouseleave: function(event){
this._removeClass($(event.currentTarget), null, "ui-state-hover");
}});
},
_focusable: function(element){
this.focusable=this.focusable.add(element);
this._on(element, {
focusin: function(event){
this._addClass($(event.currentTarget), null, "ui-state-focus");
},
focusout: function(event){
this._removeClass($(event.currentTarget), null, "ui-state-focus");
}});
},
_trigger: function(type, event, data){
var prop, orig;
var callback=this.options[ type ];
data=data||{};
event=$.Event(event);
event.type=(type===this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type).toLowerCase();
event.target=this.element[ 0 ];
orig=event.originalEvent;
if(orig){
for(prop in orig){
if(!(prop in event) ){
event[ prop ]=orig[ prop ];
}}
}
this.element.trigger(event, data);
return !($.isFunction(callback) &&
callback.apply(this.element[ 0 ], [ event ].concat(data) )===false ||
event.isDefaultPrevented());
}};
$.each({ show: "fadeIn", hide: "fadeOut" }, function(method, defaultEffect){
$.Widget.prototype[ "_" + method ]=function(element, options, callback){
if(typeof options==="string"){
options={ effect: options };}
var hasOptions;
var effectName = !options ?
method :
options===true||typeof options==="number" ?
defaultEffect :
options.effect||defaultEffect;
options=options||{};
if(typeof options==="number"){
options={ duration: options };}
hasOptions = !$.isEmptyObject(options);
options.complete=callback;
if(options.delay){
element.delay(options.delay);
}
if(hasOptions&&$.effects&&$.effects.effect[ effectName ]){
element[ method ](options);
}else if(effectName!==method&&element[ effectName ]){
element[ effectName ](options.duration, options.easing, callback);
}else{
element.queue(function(next){
$(this)[ method ]();
if(callback){
callback.call(element[ 0 ]);
}
next();
});
}};});
var widget=$.widget;
(function(){
var cachedScrollbarWidth, supportsOffsetFractions,
max=Math.max,
abs=Math.abs,
round=Math.round,
rhorizontal=/left|center|right/,
rvertical=/top|center|bottom/,
roffset=/[\+\-]\d+(\.[\d]+)?%?/,
rposition=/^\w+/,
rpercent=/%$/,
_position=$.fn.position;
supportsOffsetFractions=function(){
var element=$("<div>")
.css("position", "absolute")
.appendTo("body")
.offset({
top: 1.5,
left: 1.5
}),
support=element.offset().top===1.5;
element.remove();
supportsOffsetFractions=function(){
return support;
};
return support;
};
function getOffsets(offsets, width, height){
return [
parseFloat(offsets[ 0 ]) *(rpercent.test(offsets[ 0 ]) ? width / 100:1),
parseFloat(offsets[ 1 ]) *(rpercent.test(offsets[ 1 ]) ? height / 100:1)
];
}
function parseCss(element, property){
return parseInt($.css(element, property), 10)||0;
}
function getDimensions(elem){
var raw=elem[ 0 ];
if(raw.nodeType===9){
return {
width: elem.width(),
height: elem.height(),
offset: { top: 0, left: 0 }};}
if($.isWindow(raw) ){
return {
width: elem.width(),
height: elem.height(),
offset: { top: elem.scrollTop(), left: elem.scrollLeft() }};}
if(raw.preventDefault){
return {
width: 0,
height: 0,
offset: { top: raw.pageY, left: raw.pageX }};}
return {
width: elem.outerWidth(),
height: elem.outerHeight(),
offset: elem.offset()
};}
$.position={
scrollbarWidth: function(){
if(cachedScrollbarWidth!==undefined){
return cachedScrollbarWidth;
}
var w1, w2,
div=$("<div " +
"style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
"<div style='height:100px;width:auto;'></div></div>"),
innerDiv=div.children()[ 0 ];
$("body").append(div);
w1=innerDiv.offsetWidth;
div.css("overflow", "scroll");
w2=innerDiv.offsetWidth;
if(w1===w2){
w2=div[ 0 ].clientWidth;
}
div.remove();
return(cachedScrollbarWidth=w1 - w2);
},
getScrollInfo: function(within){
var overflowX=within.isWindow||within.isDocument ? "" :
within.element.css("overflow-x"),
overflowY=within.isWindow||within.isDocument ? "" :
within.element.css("overflow-y"),
hasOverflowX=overflowX==="scroll" ||
(overflowX==="auto"&&within.width < within.element[ 0 ].scrollWidth),
hasOverflowY=overflowY==="scroll" ||
(overflowY==="auto"&&within.height < within.element[ 0 ].scrollHeight);
return {
width: hasOverflowY ? $.position.scrollbarWidth():0,
height: hasOverflowX ? $.position.scrollbarWidth():0
};},
getWithinInfo: function(element){
var withinElement=$(element||window),
isWindow=$.isWindow(withinElement[ 0 ]),
isDocument = !!withinElement[ 0 ]&&withinElement[ 0 ].nodeType===9,
hasOffset = !isWindow&&!isDocument;
return {
element: withinElement,
isWindow: isWindow,
isDocument: isDocument,
offset: hasOffset ? $(element).offset():{ left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(),
scrollTop: withinElement.scrollTop(),
width: withinElement.outerWidth(),
height: withinElement.outerHeight()
};}};
$.fn.position=function(options){
if(!options||!options.of){
return _position.apply(this, arguments);
}
options=$.extend({}, options);
var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
target=$(options.of),
within=$.position.getWithinInfo(options.within),
scrollInfo=$.position.getScrollInfo(within),
collision=(options.collision||"flip").split(" "),
offsets={};
dimensions=getDimensions(target);
if(target[ 0 ].preventDefault){
options.at="left top";
}
targetWidth=dimensions.width;
targetHeight=dimensions.height;
targetOffset=dimensions.offset;
basePosition=$.extend({}, targetOffset);
$.each([ "my", "at" ], function(){
var pos=(options[ this ]||"").split(" "),
horizontalOffset,
verticalOffset;
if(pos.length===1){
pos=rhorizontal.test(pos[ 0 ]) ?
pos.concat([ "center" ]) :
rvertical.test(pos[ 0 ]) ?
[ "center" ].concat(pos) :
[ "center", "center" ];
}
pos[ 0 ]=rhorizontal.test(pos[ 0 ]) ? pos[ 0 ]:"center";
pos[ 1 ]=rvertical.test(pos[ 1 ]) ? pos[ 1 ]:"center";
horizontalOffset=roffset.exec(pos[ 0 ]);
verticalOffset=roffset.exec(pos[ 1 ]);
offsets[ this ]=[
horizontalOffset ? horizontalOffset[ 0 ]:0,
verticalOffset ? verticalOffset[ 0 ]:0
];
options[ this ]=[
rposition.exec(pos[ 0 ])[ 0 ],
rposition.exec(pos[ 1 ])[ 0 ]
];
});
if(collision.length===1){
collision[ 1 ]=collision[ 0 ];
}
if(options.at[ 0 ]==="right"){
basePosition.left +=targetWidth;
}else if(options.at[ 0 ]==="center"){
basePosition.left +=targetWidth / 2;
}
if(options.at[ 1 ]==="bottom"){
basePosition.top +=targetHeight;
}else if(options.at[ 1 ]==="center"){
basePosition.top +=targetHeight / 2;
}
atOffset=getOffsets(offsets.at, targetWidth, targetHeight);
basePosition.left +=atOffset[ 0 ];
basePosition.top +=atOffset[ 1 ];
return this.each(function(){
var collisionPosition, using,
elem=$(this),
elemWidth=elem.outerWidth(),
elemHeight=elem.outerHeight(),
marginLeft=parseCss(this, "marginLeft"),
marginTop=parseCss(this, "marginTop"),
collisionWidth=elemWidth + marginLeft + parseCss(this, "marginRight") +
scrollInfo.width,
collisionHeight=elemHeight + marginTop + parseCss(this, "marginBottom") +
scrollInfo.height,
position=$.extend({}, basePosition),
myOffset=getOffsets(offsets.my, elem.outerWidth(), elem.outerHeight());
if(options.my[ 0 ]==="right"){
position.left -=elemWidth;
}else if(options.my[ 0 ]==="center"){
position.left -=elemWidth / 2;
}
if(options.my[ 1 ]==="bottom"){
position.top -=elemHeight;
}else if(options.my[ 1 ]==="center"){
position.top -=elemHeight / 2;
}
position.left +=myOffset[ 0 ];
position.top +=myOffset[ 1 ];
if(!supportsOffsetFractions()){
position.left=round(position.left);
position.top=round(position.top);
}
collisionPosition={
marginLeft: marginLeft,
marginTop: marginTop
};
$.each([ "left", "top" ], function(i, dir){
if($.ui.position[ collision[ i ] ]){
$.ui.position[ collision[ i ] ][ dir ](position, {
targetWidth: targetWidth,
targetHeight: targetHeight,
elemWidth: elemWidth,
elemHeight: elemHeight,
collisionPosition: collisionPosition,
collisionWidth: collisionWidth,
collisionHeight: collisionHeight,
offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
my: options.my,
at: options.at,
within: within,
elem: elem
});
}});
if(options.using){
using=function(props){
var left=targetOffset.left - position.left,
right=left + targetWidth - elemWidth,
top=targetOffset.top - position.top,
bottom=top + targetHeight - elemHeight,
feedback={
target: {
element: target,
left: targetOffset.left,
top: targetOffset.top,
width: targetWidth,
height: targetHeight
},
element: {
element: elem,
left: position.left,
top: position.top,
width: elemWidth,
height: elemHeight
},
horizontal: right < 0 ? "left":left > 0 ? "right":"center",
vertical: bottom < 0 ? "top":top > 0 ? "bottom":"middle"
};
if(targetWidth < elemWidth&&abs(left + right) < targetWidth){
feedback.horizontal="center";
}
if(targetHeight < elemHeight&&abs(top + bottom) < targetHeight){
feedback.vertical="middle";
}
if(max(abs(left), abs(right) ) > max(abs(top), abs(bottom) )){
feedback.important="horizontal";
}else{
feedback.important="vertical";
}
options.using.call(this, props, feedback);
};}
elem.offset($.extend(position, { using: using }) );
});
};
$.ui.position={
fit: {
left: function(position, data){
var within=data.within,
withinOffset=within.isWindow ? within.scrollLeft:within.offset.left,
outerWidth=within.width,
collisionPosLeft=position.left - data.collisionPosition.marginLeft,
overLeft=withinOffset - collisionPosLeft,
overRight=collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
newOverRight;
if(data.collisionWidth > outerWidth){
if(overLeft > 0&&overRight <=0){
newOverRight=position.left + overLeft + data.collisionWidth - outerWidth -
withinOffset;
position.left +=overLeft - newOverRight;
}else if(overRight > 0&&overLeft <=0){
position.left=withinOffset;
}else{
if(overLeft > overRight){
position.left=withinOffset + outerWidth - data.collisionWidth;
}else{
position.left=withinOffset;
}}
}else if(overLeft > 0){
position.left +=overLeft;
}else if(overRight > 0){
position.left -=overRight;
}else{
position.left=max(position.left - collisionPosLeft, position.left);
}},
top: function(position, data){
var within=data.within,
withinOffset=within.isWindow ? within.scrollTop:within.offset.top,
outerHeight=data.within.height,
collisionPosTop=position.top - data.collisionPosition.marginTop,
overTop=withinOffset - collisionPosTop,
overBottom=collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
newOverBottom;
if(data.collisionHeight > outerHeight){
if(overTop > 0&&overBottom <=0){
newOverBottom=position.top + overTop + data.collisionHeight - outerHeight -
withinOffset;
position.top +=overTop - newOverBottom;
}else if(overBottom > 0&&overTop <=0){
position.top=withinOffset;
}else{
if(overTop > overBottom){
position.top=withinOffset + outerHeight - data.collisionHeight;
}else{
position.top=withinOffset;
}}
}else if(overTop > 0){
position.top +=overTop;
}else if(overBottom > 0){
position.top -=overBottom;
}else{
position.top=max(position.top - collisionPosTop, position.top);
}}
},
flip: {
left: function(position, data){
var within=data.within,
withinOffset=within.offset.left + within.scrollLeft,
outerWidth=within.width,
offsetLeft=within.isWindow ? within.scrollLeft:within.offset.left,
collisionPosLeft=position.left - data.collisionPosition.marginLeft,
overLeft=collisionPosLeft - offsetLeft,
overRight=collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
myOffset=data.my[ 0 ]==="left" ?
-data.elemWidth :
data.my[ 0 ]==="right" ?
data.elemWidth :
0,
atOffset=data.at[ 0 ]==="left" ?
data.targetWidth :
data.at[ 0 ]==="right" ?
-data.targetWidth :
0,
offset=-2 * data.offset[ 0 ],
newOverRight,
newOverLeft;
if(overLeft < 0){
newOverRight=position.left + myOffset + atOffset + offset + data.collisionWidth -
outerWidth - withinOffset;
if(newOverRight < 0||newOverRight < abs(overLeft) ){
position.left +=myOffset + atOffset + offset;
}}else if(overRight > 0){
newOverLeft=position.left - data.collisionPosition.marginLeft + myOffset +
atOffset + offset - offsetLeft;
if(newOverLeft > 0||abs(newOverLeft) < overRight){
position.left +=myOffset + atOffset + offset;
}}
},
top: function(position, data){
var within=data.within,
withinOffset=within.offset.top + within.scrollTop,
outerHeight=within.height,
offsetTop=within.isWindow ? within.scrollTop:within.offset.top,
collisionPosTop=position.top - data.collisionPosition.marginTop,
overTop=collisionPosTop - offsetTop,
overBottom=collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
top=data.my[ 1 ]==="top",
myOffset=top ?
-data.elemHeight :
data.my[ 1 ]==="bottom" ?
data.elemHeight :
0,
atOffset=data.at[ 1 ]==="top" ?
data.targetHeight :
data.at[ 1 ]==="bottom" ?
-data.targetHeight :
0,
offset=-2 * data.offset[ 1 ],
newOverTop,
newOverBottom;
if(overTop < 0){
newOverBottom=position.top + myOffset + atOffset + offset + data.collisionHeight -
outerHeight - withinOffset;
if(newOverBottom < 0||newOverBottom < abs(overTop) ){
position.top +=myOffset + atOffset + offset;
}}else if(overBottom > 0){
newOverTop=position.top - data.collisionPosition.marginTop + myOffset + atOffset +
offset - offsetTop;
if(newOverTop > 0||abs(newOverTop) < overBottom){
position.top +=myOffset + atOffset + offset;
}}
}},
flipfit: {
left: function(){
$.ui.position.flip.left.apply(this, arguments);
$.ui.position.fit.left.apply(this, arguments);
},
top: function(){
$.ui.position.flip.top.apply(this, arguments);
$.ui.position.fit.top.apply(this, arguments);
}}
};})();
var position=$.ui.position;
var data=$.extend($.expr[ ":" ], {
data: $.expr.createPseudo ?
$.expr.createPseudo(function(dataName){
return function(elem){
return !!$.data(elem, dataName);
};}) :
function(elem, i, match){
return !!$.data(elem, match[ 3 ]);
}});
var disableSelection=$.fn.extend({
disableSelection:(function(){
var eventType="onselectstart" in document.createElement("div") ?
"selectstart" :
"mousedown";
return function(){
return this.on(eventType + ".ui-disableSelection", function(event){
event.preventDefault();
});
};})(),
enableSelection: function(){
return this.off(".ui-disableSelection");
}});
var dataSpace="ui-effects-",
dataSpaceStyle="ui-effects-style",
dataSpaceAnimated="ui-effects-animated",
jQuery=$;
$.effects={
effect: {}};
(function(jQuery, undefined){
var stepHooks="backgroundColor borderBottomColor borderLeftColor borderRightColor " +
"borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
rplusequals=/^([\-+])=\s*(\d+\.?\d*)/,
stringParsers=[ {
re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
parse: function(execResult){
return [
execResult[ 1 ],
execResult[ 2 ],
execResult[ 3 ],
execResult[ 4 ]
];
}}, {
re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
parse: function(execResult){
return [
execResult[ 1 ] * 2.55,
execResult[ 2 ] * 2.55,
execResult[ 3 ] * 2.55,
execResult[ 4 ]
];
}}, {
re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
parse: function(execResult){
return [
parseInt(execResult[ 1 ], 16),
parseInt(execResult[ 2 ], 16),
parseInt(execResult[ 3 ], 16)
];
}}, {
re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
parse: function(execResult){
return [
parseInt(execResult[ 1 ] + execResult[ 1 ], 16),
parseInt(execResult[ 2 ] + execResult[ 2 ], 16),
parseInt(execResult[ 3 ] + execResult[ 3 ], 16)
];
}}, {
re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
space: "hsla",
parse: function(execResult){
return [
execResult[ 1 ],
execResult[ 2 ] / 100,
execResult[ 3 ] / 100,
execResult[ 4 ]
];
}} ],
color=jQuery.Color=function(color, green, blue, alpha){
return new jQuery.Color.fn.parse(color, green, blue, alpha);
},
spaces={
rgba: {
props: {
red: {
idx: 0,
type: "byte"
},
green: {
idx: 1,
type: "byte"
},
blue: {
idx: 2,
type: "byte"
}}
},
hsla: {
props: {
hue: {
idx: 0,
type: "degrees"
},
saturation: {
idx: 1,
type: "percent"
},
lightness: {
idx: 2,
type: "percent"
}}
}},
propTypes={
"byte": {
floor: true,
max: 255
},
"percent": {
max: 1
},
"degrees": {
mod: 360,
floor: true
}},
support=color.support={},
supportElem=jQuery("<p>")[ 0 ],
colors,
each=jQuery.each;
supportElem.style.cssText="background-color:rgba(1,1,1,.5)";
support.rgba=supportElem.style.backgroundColor.indexOf("rgba") > -1;
each(spaces, function(spaceName, space){
space.cache="_" + spaceName;
space.props.alpha={
idx: 3,
type: "percent",
def: 1
};});
function clamp(value, prop, allowEmpty){
var type=propTypes[ prop.type ]||{};
if(value==null){
return(allowEmpty||!prop.def) ? null:prop.def;
}
value=type.floor ? ~~value:parseFloat(value);
if(isNaN(value) ){
return prop.def;
}
if(type.mod){
return(value + type.mod) % type.mod;
}
return 0 > value ? 0:type.max < value ? type.max:value;
}
function stringParse(string){
var inst=color(),
rgba=inst._rgba=[];
string=string.toLowerCase();
each(stringParsers, function(i, parser){
var parsed,
match=parser.re.exec(string),
values=match&&parser.parse(match),
spaceName=parser.space||"rgba";
if(values){
parsed=inst[ spaceName ](values);
inst[ spaces[ spaceName ].cache ]=parsed[ spaces[ spaceName ].cache ];
rgba=inst._rgba=parsed._rgba;
return false;
}});
if(rgba.length){
if(rgba.join()==="0,0,0,0"){
jQuery.extend(rgba, colors.transparent);
}
return inst;
}
return colors[ string ];
}
color.fn=jQuery.extend(color.prototype, {
parse: function(red, green, blue, alpha){
if(red===undefined){
this._rgba=[ null, null, null, null ];
return this;
}
if(red.jquery||red.nodeType){
red=jQuery(red).css(green);
green=undefined;
}
var inst=this,
type=jQuery.type(red),
rgba=this._rgba=[];
if(green!==undefined){
red=[ red, green, blue, alpha ];
type="array";
}
if(type==="string"){
return this.parse(stringParse(red)||colors._default);
}
if(type==="array"){
each(spaces.rgba.props, function(key, prop){
rgba[ prop.idx ]=clamp(red[ prop.idx ], prop);
});
return this;
}
if(type==="object"){
if(red instanceof color){
each(spaces, function(spaceName, space){
if(red[ space.cache ]){
inst[ space.cache ]=red[ space.cache ].slice();
}});
}else{
each(spaces, function(spaceName, space){
var cache=space.cache;
each(space.props, function(key, prop){
if(!inst[ cache ]&&space.to){
if(key==="alpha"||red[ key ]==null){
return;
}
inst[ cache ]=space.to(inst._rgba);
}
inst[ cache ][ prop.idx ]=clamp(red[ key ], prop, true);
});
if(inst[ cache ] &&
jQuery.inArray(null, inst[ cache ].slice(0, 3) ) < 0){
inst[ cache ][ 3 ]=1;
if(space.from){
inst._rgba=space.from(inst[ cache ]);
}}
});
}
return this;
}},
is: function(compare){
var is=color(compare),
same=true,
inst=this;
each(spaces, function(_, space){
var localCache,
isCache=is[ space.cache ];
if(isCache){
localCache=inst[ space.cache ]||space.to&&space.to(inst._rgba)||[];
each(space.props, function(_, prop){
if(isCache[ prop.idx ]!=null){
same=(isCache[ prop.idx ]===localCache[ prop.idx ]);
return same;
}});
}
return same;
});
return same;
},
_space: function(){
var used=[],
inst=this;
each(spaces, function(spaceName, space){
if(inst[ space.cache ]){
used.push(spaceName);
}});
return used.pop();
},
transition: function(other, distance){
var end=color(other),
spaceName=end._space(),
space=spaces[ spaceName ],
startColor=this.alpha()===0 ? color("transparent"):this,
start=startColor[ space.cache ]||space.to(startColor._rgba),
result=start.slice();
end=end[ space.cache ];
each(space.props, function(key, prop){
var index=prop.idx,
startValue=start[ index ],
endValue=end[ index ],
type=propTypes[ prop.type ]||{};
if(endValue===null){
return;
}
if(startValue===null){
result[ index ]=endValue;
}else{
if(type.mod){
if(endValue - startValue > type.mod / 2){
startValue +=type.mod;
}else if(startValue - endValue > type.mod / 2){
startValue -=type.mod;
}}
result[ index ]=clamp(( endValue - startValue) * distance + startValue, prop);
}});
return this[ spaceName ](result);
},
blend: function(opaque){
if(this._rgba[ 3 ]===1){
return this;
}
var rgb=this._rgba.slice(),
a=rgb.pop(),
blend=color(opaque)._rgba;
return color(jQuery.map(rgb, function(v, i){
return(1 - a) * blend[ i ] + a * v;
}) );
},
toRgbaString: function(){
var prefix="rgba(",
rgba=jQuery.map(this._rgba, function(v, i){
return v==null ?(i > 2 ? 1:0):v;
});
if(rgba[ 3 ]===1){
rgba.pop();
prefix="rgb(";
}
return prefix + rgba.join() + ")";
},
toHslaString: function(){
var prefix="hsla(",
hsla=jQuery.map(this.hsla(), function(v, i){
if(v==null){
v=i > 2 ? 1:0;
}
if(i&&i < 3){
v=Math.round(v * 100) + "%";
}
return v;
});
if(hsla[ 3 ]===1){
hsla.pop();
prefix="hsl(";
}
return prefix + hsla.join() + ")";
},
toHexString: function(includeAlpha){
var rgba=this._rgba.slice(),
alpha=rgba.pop();
if(includeAlpha){
rgba.push(~~(alpha * 255) );
}
return "#" + jQuery.map(rgba, function(v){
v=(v||0).toString(16);
return v.length===1 ? "0" + v:v;
}).join("");
},
toString: function(){
return this._rgba[ 3 ]===0 ? "transparent":this.toRgbaString();
}});
color.fn.parse.prototype=color.fn;
function hue2rgb(p, q, h){
h=(h + 1) % 1;
if(h * 6 < 1){
return p +(q - p) * h * 6;
}
if(h * 2 < 1){
return q;
}
if(h * 3 < 2){
return p +(q - p) *(( 2 / 3) - h) * 6;
}
return p;
}
spaces.hsla.to=function(rgba){
if(rgba[ 0 ]==null||rgba[ 1 ]==null||rgba[ 2 ]==null){
return [ null, null, null, rgba[ 3 ] ];
}
var r=rgba[ 0 ] / 255,
g=rgba[ 1 ] / 255,
b=rgba[ 2 ] / 255,
a=rgba[ 3 ],
max=Math.max(r, g, b),
min=Math.min(r, g, b),
diff=max - min,
add=max + min,
l=add * 0.5,
h, s;
if(min===max){
h=0;
}else if(r===max){
h=(60 *(g - b) / diff) + 360;
}else if(g===max){
h=(60 *(b - r) / diff) + 120;
}else{
h=(60 *(r - g) / diff) + 240;
}
if(diff===0){
s=0;
}else if(l <=0.5){
s=diff / add;
}else{
s=diff /(2 - add);
}
return [ Math.round(h) % 360, s, l, a==null ? 1:a ];
};
spaces.hsla.from=function(hsla){
if(hsla[ 0 ]==null||hsla[ 1 ]==null||hsla[ 2 ]==null){
return [ null, null, null, hsla[ 3 ] ];
}
var h=hsla[ 0 ] / 360,
s=hsla[ 1 ],
l=hsla[ 2 ],
a=hsla[ 3 ],
q=l <=0.5 ? l *(1 + s):l + s - l * s,
p=2 * l - q;
return [
Math.round(hue2rgb(p, q, h +(1 / 3) ) * 255),
Math.round(hue2rgb(p, q, h) * 255),
Math.round(hue2rgb(p, q, h -(1 / 3) ) * 255),
a
];
};
each(spaces, function(spaceName, space){
var props=space.props,
cache=space.cache,
to=space.to,
from=space.from;
color.fn[ spaceName ]=function(value){
if(to&&!this[ cache ]){
this[ cache ]=to(this._rgba);
}
if(value===undefined){
return this[ cache ].slice();
}
var ret,
type=jQuery.type(value),
arr=(type==="array"||type==="object") ? value:arguments,
local=this[ cache ].slice();
each(props, function(key, prop){
var val=arr[ type==="object" ? key:prop.idx ];
if(val==null){
val=local[ prop.idx ];
}
local[ prop.idx ]=clamp(val, prop);
});
if(from){
ret=color(from(local) );
ret[ cache ]=local;
return ret;
}else{
return color(local);
}};
each(props, function(key, prop){
if(color.fn[ key ]){
return;
}
color.fn[ key ]=function(value){
var vtype=jQuery.type(value),
fn=(key==="alpha" ?(this._hsla ? "hsla":"rgba"):spaceName),
local=this[ fn ](),
cur=local[ prop.idx ],
match;
if(vtype==="undefined"){
return cur;
}
if(vtype==="function"){
value=value.call(this, cur);
vtype=jQuery.type(value);
}
if(value==null&&prop.empty){
return this;
}
if(vtype==="string"){
match=rplusequals.exec(value);
if(match){
value=cur + parseFloat(match[ 2 ]) *(match[ 1 ]==="+" ? 1:-1);
}}
local[ prop.idx ]=value;
return this[ fn ](local);
};});
});
color.hook=function(hook){
var hooks=hook.split(" ");
each(hooks, function(i, hook){
jQuery.cssHooks[ hook ]={
set: function(elem, value){
var parsed, curElem,
backgroundColor="";
if(value!=="transparent"&&(jQuery.type(value)!=="string" ||
(parsed=stringParse(value) )) ){
value=color(parsed||value);
if(!support.rgba&&value._rgba[ 3 ]!==1){
curElem=hook==="backgroundColor" ? elem.parentNode:elem;
while (
(backgroundColor===""||backgroundColor==="transparent") &&
curElem&&curElem.style
){
try {
backgroundColor=jQuery.css(curElem, "backgroundColor");
curElem=curElem.parentNode;
} catch(e){
}}
value=value.blend(backgroundColor&&backgroundColor!=="transparent" ?
backgroundColor :
"_default");
}
value=value.toRgbaString();
}
try {
elem.style[ hook ]=value;
} catch(e){
}}
};
jQuery.fx.step[ hook ]=function(fx){
if(!fx.colorInit){
fx.start=color(fx.elem, hook);
fx.end=color(fx.end);
fx.colorInit=true;
}
jQuery.cssHooks[ hook ].set(fx.elem, fx.start.transition(fx.end, fx.pos) );
};});
};
color.hook(stepHooks);
jQuery.cssHooks.borderColor={
expand: function(value){
var expanded={};
each([ "Top", "Right", "Bottom", "Left" ], function(i, part){
expanded[ "border" + part + "Color" ]=value;
});
return expanded;
}};
colors=jQuery.Color.names={
aqua: "#00ffff",
black: "#000000",
blue: "#0000ff",
fuchsia: "#ff00ff",
gray: "#808080",
green: "#008000",
lime: "#00ff00",
maroon: "#800000",
navy: "#000080",
olive: "#808000",
purple: "#800080",
red: "#ff0000",
silver: "#c0c0c0",
teal: "#008080",
white: "#ffffff",
yellow: "#ffff00",
transparent: [ null, null, null, 0 ],
_default: "#ffffff"
};})(jQuery);
(function(){
var classAnimationActions=[ "add", "remove", "toggle" ],
shorthandStyles={
border: 1,
borderBottom: 1,
borderColor: 1,
borderLeft: 1,
borderRight: 1,
borderTop: 1,
borderWidth: 1,
margin: 1,
padding: 1
};
$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ],
function(_, prop){
$.fx.step[ prop ]=function(fx){
if(fx.end!=="none"&&!fx.setAttr||fx.pos===1&&!fx.setAttr){
jQuery.style(fx.elem, prop, fx.end);
fx.setAttr=true;
}};}
);
function getElementStyles(elem){
var key, len,
style=elem.ownerDocument.defaultView ?
elem.ownerDocument.defaultView.getComputedStyle(elem, null) :
elem.currentStyle,
styles={};
if(style&&style.length&&style[ 0 ]&&style[ style[ 0 ] ]){
len=style.length;
while(len--){
key=style[ len ];
if(typeof style[ key ]==="string"){
styles[ $.camelCase(key) ]=style[ key ];
}}
}else{
for(key in style){
if(typeof style[ key ]==="string"){
styles[ key ]=style[ key ];
}}
}
return styles;
}
function styleDifference(oldStyle, newStyle){
var diff={},
name, value;
for(name in newStyle){
value=newStyle[ name ];
if(oldStyle[ name ]!==value){
if(!shorthandStyles[ name ]){
if($.fx.step[ name ]||!isNaN(parseFloat(value) )){
diff[ name ]=value;
}}
}}
return diff;
}
if(!$.fn.addBack){
$.fn.addBack=function(selector){
return this.add(selector==null ?
this.prevObject:this.prevObject.filter(selector)
);
};}
$.effects.animateClass=function(value, duration, easing, callback){
var o=$.speed(duration, easing, callback);
return this.queue(function(){
var animated=$(this),
baseClass=animated.attr("class")||"",
applyClassChange,
allAnimations=o.children ? animated.find("*").addBack():animated;
allAnimations=allAnimations.map(function(){
var el=$(this);
return {
el: el,
start: getElementStyles(this)
};});
applyClassChange=function(){
$.each(classAnimationActions, function(i, action){
if(value[ action ]){
animated[ action + "Class" ](value[ action ]);
}});
};
applyClassChange();
allAnimations=allAnimations.map(function(){
this.end=getElementStyles(this.el[ 0 ]);
this.diff=styleDifference(this.start, this.end);
return this;
});
animated.attr("class", baseClass);
allAnimations=allAnimations.map(function(){
var styleInfo=this,
dfd=$.Deferred(),
opts=$.extend({}, o, {
queue: false,
complete: function(){
dfd.resolve(styleInfo);
}});
this.el.animate(this.diff, opts);
return dfd.promise();
});
$.when.apply($, allAnimations.get()).done(function(){
applyClassChange();
$.each(arguments, function(){
var el=this.el;
$.each(this.diff, function(key){
el.css(key, "");
});
});
o.complete.call(animated[ 0 ]);
});
});
};
$.fn.extend({
addClass:(function(orig){
return function(classNames, speed, easing, callback){
return speed ?
$.effects.animateClass.call(this,
{ add: classNames }, speed, easing, callback) :
orig.apply(this, arguments);
};})($.fn.addClass),
removeClass:(function(orig){
return function(classNames, speed, easing, callback){
return arguments.length > 1 ?
$.effects.animateClass.call(this,
{ remove: classNames }, speed, easing, callback) :
orig.apply(this, arguments);
};})($.fn.removeClass),
toggleClass:(function(orig){
return function(classNames, force, speed, easing, callback){
if(typeof force==="boolean"||force===undefined){
if(!speed){
return orig.apply(this, arguments);
}else{
return $.effects.animateClass.call(this,
(force ? { add: classNames }:{ remove: classNames }),
speed, easing, callback);
}}else{
return $.effects.animateClass.call(this,
{ toggle: classNames }, force, speed, easing);
}};})($.fn.toggleClass),
switchClass: function(remove, add, speed, easing, callback){
return $.effects.animateClass.call(this, {
add: add,
remove: remove
}, speed, easing, callback);
}});
})();
(function(){
if($.expr&&$.expr.filters&&$.expr.filters.animated){
$.expr.filters.animated=(function(orig){
return function(elem){
return !!$(elem).data(dataSpaceAnimated)||orig(elem);
};})($.expr.filters.animated);
}
if($.uiBackCompat!==false){
$.extend($.effects, {
save: function(element, set){
var i=0, length=set.length;
for(; i < length; i++){
if(set[ i ]!==null){
element.data(dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ]);
}}
},
restore: function(element, set){
var val, i=0, length=set.length;
for(; i < length; i++){
if(set[ i ]!==null){
val=element.data(dataSpace + set[ i ]);
element.css(set[ i ], val);
}}
},
setMode: function(el, mode){
if(mode==="toggle"){
mode=el.is(":hidden") ? "show":"hide";
}
return mode;
},
createWrapper: function(element){
if(element.parent().is(".ui-effects-wrapper") ){
return element.parent();
}
var props={
width: element.outerWidth(true),
height: element.outerHeight(true),
"float": element.css("float")
},
wrapper=$("<div></div>")
.addClass("ui-effects-wrapper")
.css({
fontSize: "100%",
background: "transparent",
border: "none",
margin: 0,
padding: 0
}),
size={
width: element.width(),
height: element.height()
},
active=document.activeElement;
try {
active.id;
} catch(e){
active=document.body;
}
element.wrap(wrapper);
if(element[ 0 ]===active||$.contains(element[ 0 ], active) ){
$(active).trigger("focus");
}
wrapper=element.parent();
if(element.css("position")==="static"){
wrapper.css({ position: "relative" });
element.css({ position: "relative" });
}else{
$.extend(props, {
position: element.css("position"),
zIndex: element.css("z-index")
});
$.each([ "top", "left", "bottom", "right" ], function(i, pos){
props[ pos ]=element.css(pos);
if(isNaN(parseInt(props[ pos ], 10) )){
props[ pos ]="auto";
}});
element.css({
position: "relative",
top: 0,
left: 0,
right: "auto",
bottom: "auto"
});
}
element.css(size);
return wrapper.css(props).show();
},
removeWrapper: function(element){
var active=document.activeElement;
if(element.parent().is(".ui-effects-wrapper") ){
element.parent().replaceWith(element);
if(element[ 0 ]===active||$.contains(element[ 0 ], active) ){
$(active).trigger("focus");
}}
return element;
}});
}
$.extend($.effects, {
version: "1.12.0",
define: function(name, mode, effect){
if(!effect){
effect=mode;
mode="effect";
}
$.effects.effect[ name ]=effect;
$.effects.effect[ name ].mode=mode;
return effect;
},
scaledDimensions: function(element, percent, direction){
if(percent===0){
return {
height: 0,
width: 0,
outerHeight: 0,
outerWidth: 0
};}
var x=direction!=="horizontal" ?(( percent||100) / 100):1,
y=direction!=="vertical" ?(( percent||100) / 100):1;
return {
height: element.height() * y,
width: element.width() * x,
outerHeight: element.outerHeight() * y,
outerWidth: element.outerWidth() * x
};},
clipToBox: function(animation){
return {
width: animation.clip.right - animation.clip.left,
height: animation.clip.bottom - animation.clip.top,
left: animation.clip.left,
top: animation.clip.top
};},
unshift: function(element, queueLength, count){
var queue=element.queue();
if(queueLength > 1){
queue.splice.apply(queue,
[ 1, 0 ].concat(queue.splice(queueLength, count) ));
}
element.dequeue();
},
saveStyle: function(element){
element.data(dataSpaceStyle, element[ 0 ].style.cssText);
},
restoreStyle: function(element){
element[ 0 ].style.cssText=element.data(dataSpaceStyle)||"";
element.removeData(dataSpaceStyle);
},
mode: function(element, mode){
var hidden=element.is(":hidden");
if(mode==="toggle"){
mode=hidden ? "show":"hide";
}
if(hidden ? mode==="hide":mode==="show"){
mode="none";
}
return mode;
},
getBaseline: function(origin, original){
var y, x;
switch(origin[ 0 ]){
case "top":
y=0;
break;
case "middle":
y=0.5;
break;
case "bottom":
y=1;
break;
default:
y=origin[ 0 ] / original.height;
}
switch(origin[ 1 ]){
case "left":
x=0;
break;
case "center":
x=0.5;
break;
case "right":
x=1;
break;
default:
x=origin[ 1 ] / original.width;
}
return {
x: x,
y: y
};},
createPlaceholder: function(element){
var placeholder,
cssPosition=element.css("position"),
position=element.position();
element.css({
marginTop: element.css("marginTop"),
marginBottom: element.css("marginBottom"),
marginLeft: element.css("marginLeft"),
marginRight: element.css("marginRight")
})
.outerWidth(element.outerWidth())
.outerHeight(element.outerHeight());
if(/^(static|relative)/.test(cssPosition) ){
cssPosition="absolute";
placeholder=$("<" + element[ 0 ].nodeName + ">").insertAfter(element).css({
display: /^(inline|ruby)/.test(element.css("display") ) ?
"inline-block" :
"block",
visibility: "hidden",
marginTop: element.css("marginTop"),
marginBottom: element.css("marginBottom"),
marginLeft: element.css("marginLeft"),
marginRight: element.css("marginRight"),
"float": element.css("float")
})
.outerWidth(element.outerWidth())
.outerHeight(element.outerHeight())
.addClass("ui-effects-placeholder");
element.data(dataSpace + "placeholder", placeholder);
}
element.css({
position: cssPosition,
left: position.left,
top: position.top
});
return placeholder;
},
removePlaceholder: function(element){
var dataKey=dataSpace + "placeholder",
placeholder=element.data(dataKey);
if(placeholder){
placeholder.remove();
element.removeData(dataKey);
}},
cleanUp: function(element){
$.effects.restoreStyle(element);
$.effects.removePlaceholder(element);
},
setTransition: function(element, list, factor, value){
value=value||{};
$.each(list, function(i, x){
var unit=element.cssUnit(x);
if(unit[ 0 ] > 0){
value[ x ]=unit[ 0 ] * factor + unit[ 1 ];
}});
return value;
}});
function _normalizeArguments(effect, options, speed, callback){
if($.isPlainObject(effect) ){
options=effect;
effect=effect.effect;
}
effect={ effect: effect };
if(options==null){
options={};}
if($.isFunction(options) ){
callback=options;
speed=null;
options={};}
if(typeof options==="number"||$.fx.speeds[ options ]){
callback=speed;
speed=options;
options={};}
if($.isFunction(speed) ){
callback=speed;
speed=null;
}
if(options){
$.extend(effect, options);
}
speed=speed||options.duration;
effect.duration=$.fx.off ? 0 :
typeof speed==="number" ? speed :
speed in $.fx.speeds ? $.fx.speeds[ speed ] :
$.fx.speeds._default;
effect.complete=callback||options.complete;
return effect;
}
function standardAnimationOption(option){
if(!option||typeof option==="number"||$.fx.speeds[ option ]){
return true;
}
if(typeof option==="string"&&!$.effects.effect[ option ]){
return true;
}
if($.isFunction(option) ){
return true;
}
if(typeof option==="object"&&!option.effect){
return true;
}
return false;
}
$.fn.extend({
effect: function(){
var args=_normalizeArguments.apply(this, arguments),
effectMethod=$.effects.effect[ args.effect ],
defaultMode=effectMethod.mode,
queue=args.queue,
queueName=queue||"fx",
complete=args.complete,
mode=args.mode,
modes=[],
prefilter=function(next){
var el=$(this),
normalizedMode=$.effects.mode(el, mode)||defaultMode;
el.data(dataSpaceAnimated, true);
modes.push(normalizedMode);
if(defaultMode&&(normalizedMode==="show" ||
(normalizedMode===defaultMode&&normalizedMode==="hide") )){
el.show();
}
if(!defaultMode||normalizedMode!=="none"){
$.effects.saveStyle(el);
}
if($.isFunction(next) ){
next();
}};
if($.fx.off||!effectMethod){
if(mode){
return this[ mode ](args.duration, complete);
}else{
return this.each(function(){
if(complete){
complete.call(this);
}});
}}
function run(next){
var elem=$(this);
function cleanup(){
elem.removeData(dataSpaceAnimated);
$.effects.cleanUp(elem);
if(args.mode==="hide"){
elem.hide();
}
done();
}
function done(){
if($.isFunction(complete) ){
complete.call(elem[ 0 ]);
}
if($.isFunction(next) ){
next();
}}
args.mode=modes.shift();
if($.uiBackCompat!==false&&!defaultMode){
if(elem.is(":hidden") ? mode==="hide":mode==="show"){
elem[ mode ]();
done();
}else{
effectMethod.call(elem[ 0 ], args, done);
}}else{
if(args.mode==="none"){
elem[ mode ]();
done();
}else{
effectMethod.call(elem[ 0 ], args, cleanup);
}}
}
return queue===false ?
this.each(prefilter).each(run) :
this.queue(queueName, prefilter).queue(queueName, run);
},
show:(function(orig){
return function(option){
if(standardAnimationOption(option) ){
return orig.apply(this, arguments);
}else{
var args=_normalizeArguments.apply(this, arguments);
args.mode="show";
return this.effect.call(this, args);
}};})($.fn.show),
hide:(function(orig){
return function(option){
if(standardAnimationOption(option) ){
return orig.apply(this, arguments);
}else{
var args=_normalizeArguments.apply(this, arguments);
args.mode="hide";
return this.effect.call(this, args);
}};})($.fn.hide),
toggle:(function(orig){
return function(option){
if(standardAnimationOption(option)||typeof option==="boolean"){
return orig.apply(this, arguments);
}else{
var args=_normalizeArguments.apply(this, arguments);
args.mode="toggle";
return this.effect.call(this, args);
}};})($.fn.toggle),
cssUnit: function(key){
var style=this.css(key),
val=[];
$.each([ "em", "px", "%", "pt" ], function(i, unit){
if(style.indexOf(unit) > 0){
val=[ parseFloat(style), unit ];
}});
return val;
},
cssClip: function(clipObj){
if(clipObj){
return this.css("clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
clipObj.bottom + "px " + clipObj.left + "px)");
}
return parseClip(this.css("clip"), this);
},
transfer: function(options, done){
var element=$(this),
target=$(options.to),
targetFixed=target.css("position")==="fixed",
body=$("body"),
fixTop=targetFixed ? body.scrollTop():0,
fixLeft=targetFixed ? body.scrollLeft():0,
endPosition=target.offset(),
animation={
top: endPosition.top - fixTop,
left: endPosition.left - fixLeft,
height: target.innerHeight(),
width: target.innerWidth()
},
startPosition=element.offset(),
transfer=$("<div class='ui-effects-transfer'></div>")
.appendTo("body")
.addClass(options.className)
.css({
top: startPosition.top - fixTop,
left: startPosition.left - fixLeft,
height: element.innerHeight(),
width: element.innerWidth(),
position: targetFixed ? "fixed":"absolute"
})
.animate(animation, options.duration, options.easing, function(){
transfer.remove();
if($.isFunction(done) ){
done();
}});
}});
function parseClip(str, element){
var outerWidth=element.outerWidth(),
outerHeight=element.outerHeight(),
clipRegex=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,
values=clipRegex.exec(str)||[ "", 0, outerWidth, outerHeight, 0 ];
return {
top: parseFloat(values[ 1 ])||0,
right: values[ 2 ]==="auto" ? outerWidth:parseFloat(values[ 2 ]),
bottom: values[ 3 ]==="auto" ? outerHeight:parseFloat(values[ 3 ]),
left: parseFloat(values[ 4 ])||0
};}
$.fx.step.clip=function(fx){
if(!fx.clipInit){
fx.start=$(fx.elem).cssClip();
if(typeof fx.end==="string"){
fx.end=parseClip(fx.end, fx.elem);
}
fx.clipInit=true;
}
$(fx.elem).cssClip({
top: fx.pos *(fx.end.top - fx.start.top) + fx.start.top,
right: fx.pos *(fx.end.right - fx.start.right) + fx.start.right,
bottom: fx.pos *(fx.end.bottom - fx.start.bottom) + fx.start.bottom,
left: fx.pos *(fx.end.left - fx.start.left) + fx.start.left
});
};})();
(function(){
var baseEasings={};
$.each([ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function(i, name){
baseEasings[ name ]=function(p){
return Math.pow(p, i + 2);
};});
$.extend(baseEasings, {
Sine: function(p){
return 1 - Math.cos(p * Math.PI / 2);
},
Circ: function(p){
return 1 - Math.sqrt(1 - p * p);
},
Elastic: function(p){
return p===0||p===1 ? p :
-Math.pow(2, 8 *(p - 1) ) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15);
},
Back: function(p){
return p * p *(3 * p - 2);
},
Bounce: function(p){
var pow2,
bounce=4;
while(p <(( pow2=Math.pow(2, --bounce) ) - 1) / 11){}
return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow(( pow2 * 3 - 2) / 22 - p, 2);
}});
$.each(baseEasings, function(name, easeIn){
$.easing[ "easeIn" + name ]=easeIn;
$.easing[ "easeOut" + name ]=function(p){
return 1 - easeIn(1 - p);
};
$.easing[ "easeInOut" + name ]=function(p){
return p < 0.5 ?
easeIn(p * 2) / 2 :
1 - easeIn(p * -2 + 2) / 2;
};});
})();
var effect=$.effects;
var effectsEffectBlind=$.effects.define("blind", "hide", function(options, done){
var map={
up: [ "bottom", "top" ],
vertical: [ "bottom", "top" ],
down: [ "top", "bottom" ],
left: [ "right", "left" ],
horizontal: [ "right", "left" ],
right: [ "left", "right" ]
},
element=$(this),
direction=options.direction||"up",
start=element.cssClip(),
animate={ clip: $.extend({}, start) },
placeholder=$.effects.createPlaceholder(element);
animate.clip[ map[ direction ][ 0 ] ]=animate.clip[ map[ direction ][ 1 ] ];
if(options.mode==="show"){
element.cssClip(animate.clip);
if(placeholder){
placeholder.css($.effects.clipToBox(animate) );
}
animate.clip=start;
}
if(placeholder){
placeholder.animate($.effects.clipToBox(animate), options.duration, options.easing);
}
element.animate(animate, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
});
});
var effectsEffectBounce=$.effects.define("bounce", function(options, done){
var upAnim, downAnim, refValue,
element=$(this),
mode=options.mode,
hide=mode==="hide",
show=mode==="show",
direction=options.direction||"up",
distance=options.distance,
times=options.times||5,
anims=times * 2 +(show||hide ? 1:0),
speed=options.duration / anims,
easing=options.easing,
ref=(direction==="up"||direction==="down") ? "top":"left",
motion=(direction==="up"||direction==="left"),
i=0,
queuelen=element.queue().length;
$.effects.createPlaceholder(element);
refValue=element.css(ref);
if(!distance){
distance=element[ ref==="top" ? "outerHeight":"outerWidth" ]() / 3;
}
if(show){
downAnim={ opacity: 1 };
downAnim[ ref ]=refValue;
element
.css("opacity", 0)
.css(ref, motion ? -distance * 2:distance * 2)
.animate(downAnim, speed, easing);
}
if(hide){
distance=distance / Math.pow(2, times - 1);
}
downAnim={};
downAnim[ ref ]=refValue;
for(; i < times; i++){
upAnim={};
upAnim[ ref ]=(motion ? "-=":"+=") + distance;
element
.animate(upAnim, speed, easing)
.animate(downAnim, speed, easing);
distance=hide ? distance * 2:distance / 2;
}
if(hide){
upAnim={ opacity: 0 };
upAnim[ ref ]=(motion ? "-=":"+=") + distance;
element.animate(upAnim, speed, easing);
}
element.queue(done);
$.effects.unshift(element, queuelen, anims + 1);
});
var effectsEffectClip=$.effects.define("clip", "hide", function(options, done){
var start,
animate={},
element=$(this),
direction=options.direction||"vertical",
both=direction==="both",
horizontal=both||direction==="horizontal",
vertical=both||direction==="vertical";
start=element.cssClip();
animate.clip={
top: vertical ?(start.bottom - start.top) / 2:start.top,
right: horizontal ?(start.right - start.left) / 2:start.right,
bottom: vertical ?(start.bottom - start.top) / 2:start.bottom,
left: horizontal ?(start.right - start.left) / 2:start.left
};
$.effects.createPlaceholder(element);
if(options.mode==="show"){
element.cssClip(animate.clip);
animate.clip=start;
}
element.animate(animate, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
});
});
var effectsEffectDrop=$.effects.define("drop", "hide", function(options, done){
var distance,
element=$(this),
mode=options.mode,
show=mode==="show",
direction=options.direction||"left",
ref=(direction==="up"||direction==="down") ? "top":"left",
motion=(direction==="up"||direction==="left") ? "-=":"+=",
oppositeMotion=(motion==="+=") ? "-=":"+=",
animation={
opacity: 0
};
$.effects.createPlaceholder(element);
distance=options.distance ||
element[ ref==="top" ? "outerHeight":"outerWidth" ](true) / 2;
animation[ ref ]=motion + distance;
if(show){
element.css(animation);
animation[ ref ]=oppositeMotion + distance;
animation.opacity=1;
}
element.animate(animation, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
});
});
var effectsEffectExplode=$.effects.define("explode", "hide", function(options, done){
var i, j, left, top, mx, my,
rows=options.pieces ? Math.round(Math.sqrt(options.pieces) ):3,
cells=rows,
element=$(this),
mode=options.mode,
show=mode==="show",
offset=element.show().css("visibility", "hidden").offset(),
width=Math.ceil(element.outerWidth() / cells),
height=Math.ceil(element.outerHeight() / rows),
pieces=[];
function childComplete(){
pieces.push(this);
if(pieces.length===rows * cells){
animComplete();
}}
for(i=0; i < rows; i++){
top=offset.top + i * height;
my=i -(rows - 1) / 2;
for(j=0; j < cells; j++){
left=offset.left + j * width;
mx=j -(cells - 1) / 2;
element
.clone()
.appendTo("body")
.wrap("<div></div>")
.css({
position: "absolute",
visibility: "visible",
left: -j * width,
top: -i * height
})
.parent()
.addClass("ui-effects-explode")
.css({
position: "absolute",
overflow: "hidden",
width: width,
height: height,
left: left +(show ? mx * width:0),
top: top +(show ? my * height:0),
opacity: show ? 0:1
})
.animate({
left: left +(show ? 0:mx * width),
top: top +(show ? 0:my * height),
opacity: show ? 1:0
}, options.duration||500, options.easing, childComplete);
}}
function animComplete(){
element.css({
visibility: "visible"
});
$(pieces).remove();
done();
}});
var effectsEffectFade=$.effects.define("fade", "toggle", function(options, done){
var show=options.mode==="show";
$(this)
.css("opacity", show ? 0:1)
.animate({
opacity: show ? 1:0
}, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
});
});
var effectsEffectFold=$.effects.define("fold", "hide", function(options, done){
var element=$(this),
mode=options.mode,
show=mode==="show",
hide=mode==="hide",
size=options.size||15,
percent=/([0-9]+)%/.exec(size),
horizFirst = !!options.horizFirst,
ref=horizFirst ? [ "right", "bottom" ]:[ "bottom", "right" ],
duration=options.duration / 2,
placeholder=$.effects.createPlaceholder(element),
start=element.cssClip(),
animation1={ clip: $.extend({}, start) },
animation2={ clip: $.extend({}, start) },
distance=[ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ],
queuelen=element.queue().length;
if(percent){
size=parseInt(percent[ 1 ], 10) / 100 * distance[ hide ? 0:1 ];
}
animation1.clip[ ref[ 0 ] ]=size;
animation2.clip[ ref[ 0 ] ]=size;
animation2.clip[ ref[ 1 ] ]=0;
if(show){
element.cssClip(animation2.clip);
if(placeholder){
placeholder.css($.effects.clipToBox(animation2) );
}
animation2.clip=start;
}
element
.queue(function(next){
if(placeholder){
placeholder
.animate($.effects.clipToBox(animation1), duration, options.easing)
.animate($.effects.clipToBox(animation2), duration, options.easing);
}
next();
})
.animate(animation1, duration, options.easing)
.animate(animation2, duration, options.easing)
.queue(done);
$.effects.unshift(element, queuelen, 4);
});
var effectsEffectHighlight=$.effects.define("highlight", "show", function(options, done){
var element=$(this),
animation={
backgroundColor: element.css("backgroundColor")
};
if(options.mode==="hide"){
animation.opacity=0;
}
$.effects.saveStyle(element);
element
.css({
backgroundImage: "none",
backgroundColor: options.color||"#ffff99"
})
.animate(animation, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
});
});
var effectsEffectSize=$.effects.define("size", function(options, done){
var baseline, factor, temp,
element=$(this),
cProps=[ "fontSize" ],
vProps=[ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
hProps=[ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
mode=options.mode,
restore=mode!=="effect",
scale=options.scale||"both",
origin=options.origin||[ "middle", "center" ],
position=element.css("position"),
pos=element.position(),
original=$.effects.scaledDimensions(element),
from=options.from||original,
to=options.to||$.effects.scaledDimensions(element, 0);
$.effects.createPlaceholder(element);
if(mode==="show"){
temp=from;
from=to;
to=temp;
}
factor={
from: {
y: from.height / original.height,
x: from.width / original.width
},
to: {
y: to.height / original.height,
x: to.width / original.width
}};
if(scale==="box"||scale==="both"){
if(factor.from.y!==factor.to.y){
from=$.effects.setTransition(element, vProps, factor.from.y, from);
to=$.effects.setTransition(element, vProps, factor.to.y, to);
}
if(factor.from.x!==factor.to.x){
from=$.effects.setTransition(element, hProps, factor.from.x, from);
to=$.effects.setTransition(element, hProps, factor.to.x, to);
}}
if(scale==="content"||scale==="both"){
if(factor.from.y!==factor.to.y){
from=$.effects.setTransition(element, cProps, factor.from.y, from);
to=$.effects.setTransition(element, cProps, factor.to.y, to);
}}
if(origin){
baseline=$.effects.getBaseline(origin, original);
from.top=(original.outerHeight - from.outerHeight) * baseline.y + pos.top;
from.left=(original.outerWidth - from.outerWidth) * baseline.x + pos.left;
to.top=(original.outerHeight - to.outerHeight) * baseline.y + pos.top;
to.left=(original.outerWidth - to.outerWidth) * baseline.x + pos.left;
}
element.css(from);
if(scale==="content"||scale==="both"){
vProps=vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
hProps=hProps.concat([ "marginLeft", "marginRight" ]);
element.find("*[width]").each(function(){
var child=$(this),
childOriginal=$.effects.scaledDimensions(child),
childFrom={
height: childOriginal.height * factor.from.y,
width: childOriginal.width * factor.from.x,
outerHeight: childOriginal.outerHeight * factor.from.y,
outerWidth: childOriginal.outerWidth * factor.from.x
},
childTo={
height: childOriginal.height * factor.to.y,
width: childOriginal.width * factor.to.x,
outerHeight: childOriginal.height * factor.to.y,
outerWidth: childOriginal.width * factor.to.x
};
if(factor.from.y!==factor.to.y){
childFrom=$.effects.setTransition(child, vProps, factor.from.y, childFrom);
childTo=$.effects.setTransition(child, vProps, factor.to.y, childTo);
}
if(factor.from.x!==factor.to.x){
childFrom=$.effects.setTransition(child, hProps, factor.from.x, childFrom);
childTo=$.effects.setTransition(child, hProps, factor.to.x, childTo);
}
if(restore){
$.effects.saveStyle(child);
}
child.css(childFrom);
child.animate(childTo, options.duration, options.easing, function(){
if(restore){
$.effects.restoreStyle(child);
}});
});
}
element.animate(to, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: function(){
var offset=element.offset();
if(to.opacity===0){
element.css("opacity", from.opacity);
}
if(!restore){
element
.css("position", position==="static" ? "relative":position)
.offset(offset);
$.effects.saveStyle(element);
}
done();
}});
});
var effectsEffectScale=$.effects.define("scale", function(options, done){
var el=$(this),
mode=options.mode,
percent=parseInt(options.percent, 10) ||
(parseInt(options.percent, 10)===0 ? 0:(mode!=="effect" ? 0:100) ),
newOptions=$.extend(true, {
from: $.effects.scaledDimensions(el),
to: $.effects.scaledDimensions(el, percent, options.direction||"both"),
origin: options.origin||[ "middle", "center" ]
}, options);
if(options.fade){
newOptions.from.opacity=1;
newOptions.to.opacity=0;
}
$.effects.effect.size.call(this, newOptions, done);
});
var effectsEffectPuff=$.effects.define("puff", "hide", function(options, done){
var newOptions=$.extend(true, {}, options, {
fade: true,
percent: parseInt(options.percent, 10)||150
});
$.effects.effect.scale.call(this, newOptions, done);
});
var effectsEffectPulsate=$.effects.define("pulsate", "show", function(options, done){
var element=$(this),
mode=options.mode,
show=mode==="show",
hide=mode==="hide",
showhide=show||hide,
anims=(( options.times||5) * 2) +(showhide ? 1:0),
duration=options.duration / anims,
animateTo=0,
i=1,
queuelen=element.queue().length;
if(show||!element.is(":visible") ){
element.css("opacity", 0).show();
animateTo=1;
}
for(; i < anims; i++){
element.animate({ opacity: animateTo }, duration, options.easing);
animateTo=1 - animateTo;
}
element.animate({ opacity: animateTo }, duration, options.easing);
element.queue(done);
$.effects.unshift(element, queuelen, anims + 1);
});
var effectsEffectShake=$.effects.define("shake", function(options, done){
var i=1,
element=$(this),
direction=options.direction||"left",
distance=options.distance||20,
times=options.times||3,
anims=times * 2 + 1,
speed=Math.round(options.duration / anims),
ref=(direction==="up"||direction==="down") ? "top":"left",
positiveMotion=(direction==="up"||direction==="left"),
animation={},
animation1={},
animation2={},
queuelen=element.queue().length;
$.effects.createPlaceholder(element);
animation[ ref ]=(positiveMotion ? "-=":"+=") + distance;
animation1[ ref ]=(positiveMotion ? "+=":"-=") + distance * 2;
animation2[ ref ]=(positiveMotion ? "-=":"+=") + distance * 2;
element.animate(animation, speed, options.easing);
for(; i < times; i++){
element
.animate(animation1, speed, options.easing)
.animate(animation2, speed, options.easing);
}
element
.animate(animation1, speed, options.easing)
.animate(animation, speed / 2, options.easing)
.queue(done);
$.effects.unshift(element, queuelen, anims + 1);
});
var effectsEffectSlide=$.effects.define("slide", "show", function(options, done){
var startClip, startRef,
element=$(this),
map={
up: [ "bottom", "top" ],
down: [ "top", "bottom" ],
left: [ "right", "left" ],
right: [ "left", "right" ]
},
mode=options.mode,
direction=options.direction||"left",
ref=(direction==="up"||direction==="down") ? "top":"left",
positiveMotion=(direction==="up"||direction==="left"),
distance=options.distance ||
element[ ref==="top" ? "outerHeight":"outerWidth" ](true),
animation={};
$.effects.createPlaceholder(element);
startClip=element.cssClip();
startRef=element.position()[ ref ];
animation[ ref ]=(positiveMotion ? -1:1) * distance + startRef;
animation.clip=element.cssClip();
animation.clip[ map[ direction ][ 1 ] ]=animation.clip[ map[ direction ][ 0 ] ];
if(mode==="show"){
element.cssClip(animation.clip);
element.css(ref, animation[ ref ]);
animation.clip=startClip;
animation[ ref ]=startRef;
}
element.animate(animation, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
});
});
var effect;
if($.uiBackCompat!==false){
effect=$.effects.define("transfer", function(options, done){
$(this).transfer(options, done);
});
}
var effectsEffectTransfer=effect;
$.ui.focusable=function(element, hasTabindex){
var map, mapName, img, focusableIfVisible, fieldset,
nodeName=element.nodeName.toLowerCase();
if("area"===nodeName){
map=element.parentNode;
mapName=map.name;
if(!element.href||!mapName||map.nodeName.toLowerCase()!=="map"){
return false;
}
img=$("img[usemap='#" + mapName + "']");
return img.length > 0&&img.is(":visible");
}
if(/^(input|select|textarea|button|object)$/.test(nodeName) ){
focusableIfVisible = !element.disabled;
if(focusableIfVisible){
fieldset=$(element).closest("fieldset")[ 0 ];
if(fieldset){
focusableIfVisible = !fieldset.disabled;
}}
}else if("a"===nodeName){
focusableIfVisible=element.href||hasTabindex;
}else{
focusableIfVisible=hasTabindex;
}
return focusableIfVisible&&$(element).is(":visible")&&visible($(element) );
};
function visible(element){
var visibility=element.css("visibility");
while(visibility==="inherit"){
element=element.parent();
visibility=element.css("visibility");
}
return visibility!=="hidden";
}
$.extend($.expr[ ":" ], {
focusable: function(element){
return $.ui.focusable(element, $.attr(element, "tabindex")!=null);
}});
var focusable=$.ui.focusable;
var form=$.fn.form=function(){
return typeof this[ 0 ].form==="string" ? this.closest("form"):$(this[ 0 ].form);
};
var formResetMixin=$.ui.formResetMixin={
_formResetHandler: function(){
var form=$(this);
setTimeout(function(){
var instances=form.data("ui-form-reset-instances");
$.each(instances, function(){
this.refresh();
});
});
},
_bindFormResetHandler: function(){
this.form=this.element.form();
if(!this.form.length){
return;
}
var instances=this.form.data("ui-form-reset-instances")||[];
if(!instances.length){
this.form.on("reset.ui-form-reset", this._formResetHandler);
}
instances.push(this);
this.form.data("ui-form-reset-instances", instances);
},
_unbindFormResetHandler: function(){
if(!this.form.length){
return;
}
var instances=this.form.data("ui-form-reset-instances");
instances.splice($.inArray(this, instances), 1);
if(instances.length){
this.form.data("ui-form-reset-instances", instances);
}else{
this.form
.removeData("ui-form-reset-instances")
.off("reset.ui-form-reset");
}}
};
if($.fn.jquery.substring(0, 3)==="1.7"){
$.each([ "Width", "Height" ], function(i, name){
var side=name==="Width" ? [ "Left", "Right" ]:[ "Top", "Bottom" ],
type=name.toLowerCase(),
orig={
innerWidth: $.fn.innerWidth,
innerHeight: $.fn.innerHeight,
outerWidth: $.fn.outerWidth,
outerHeight: $.fn.outerHeight
};
function reduce(elem, size, border, margin){
$.each(side, function(){
size -=parseFloat($.css(elem, "padding" + this) )||0;
if(border){
size -=parseFloat($.css(elem, "border" + this + "Width") )||0;
}
if(margin){
size -=parseFloat($.css(elem, "margin" + this) )||0;
}});
return size;
}
$.fn[ "inner" + name ]=function(size){
if(size===undefined){
return orig[ "inner" + name ].call(this);
}
return this.each(function(){
$(this).css(type, reduce(this, size) + "px");
});
};
$.fn[ "outer" + name ]=function(size, margin){
if(typeof size!=="number"){
return orig[ "outer" + name ].call(this, size);
}
return this.each(function(){
$(this).css(type, reduce(this, size, true, margin) + "px");
});
};});
$.fn.addBack=function(selector){
return this.add(selector==null ?
this.prevObject:this.prevObject.filter(selector)
);
};}
;
var keycode=$.ui.keyCode={
BACKSPACE: 8,
COMMA: 188,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
LEFT: 37,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SPACE: 32,
TAB: 9,
UP: 38
};
var escapeSelector=$.ui.escapeSelector=(function(){
var selectorEscape=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
return function(selector){
return selector.replace(selectorEscape, "\\$1");
};})();
var labels=$.fn.labels=function(){
var ancestor, selector, id, labels, ancestors;
if(this[ 0 ].labels&&this[ 0 ].labels.length){
return this.pushStack(this[ 0 ].labels);
}
labels=this.eq(0).parents("label");
id=this.attr("id");
if(id){
ancestor=this.eq(0).parents().last();
ancestors=ancestor.add(ancestor.length ? ancestor.siblings():this.siblings());
selector="label[for='" + $.ui.escapeSelector(id) + "']";
labels=labels.add(ancestors.find(selector).addBack(selector) );
}
return this.pushStack(labels);
};
var scrollParent=$.fn.scrollParent=function(includeHidden){
var position=this.css("position"),
excludeStaticParent=position==="absolute",
overflowRegex=includeHidden ? /(auto|scroll|hidden)/:/(auto|scroll)/,
scrollParent=this.parents().filter(function(){
var parent=$(this);
if(excludeStaticParent&&parent.css("position")==="static"){
return false;
}
return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") +
parent.css("overflow-x") );
}).eq(0);
return position==="fixed"||!scrollParent.length ?
$(this[ 0 ].ownerDocument||document) :
scrollParent;
};
var tabbable=$.extend($.expr[ ":" ], {
tabbable: function(element){
var tabIndex=$.attr(element, "tabindex"),
hasTabindex=tabIndex!=null;
return(!hasTabindex||tabIndex >=0)&&$.ui.focusable(element, hasTabindex);
}});
var uniqueId=$.fn.extend({
uniqueId:(function(){
var uuid=0;
return function(){
return this.each(function(){
if(!this.id){
this.id="ui-id-" + ( ++uuid);
}});
};})(),
removeUniqueId: function(){
return this.each(function(){
if(/^ui-id-\d+$/.test(this.id) ){
$(this).removeAttr("id");
}});
}});
var widgetsAccordion=$.widget("ui.accordion", {
version: "1.12.0",
options: {
active: 0,
animate: {},
classes: {
"ui-accordion-header": "ui-corner-top",
"ui-accordion-header-collapsed": "ui-corner-all",
"ui-accordion-content": "ui-corner-bottom"
},
collapsible: false,
event: "click",
header: "> li > :first-child, > :not(li):even",
heightStyle: "auto",
icons: {
activeHeader: "ui-icon-triangle-1-s",
header: "ui-icon-triangle-1-e"
},
activate: null,
beforeActivate: null
},
hideProps: {
borderTopWidth: "hide",
borderBottomWidth: "hide",
paddingTop: "hide",
paddingBottom: "hide",
height: "hide"
},
showProps: {
borderTopWidth: "show",
borderBottomWidth: "show",
paddingTop: "show",
paddingBottom: "show",
height: "show"
},
_create: function(){
var options=this.options;
this.prevShow=this.prevHide=$();
this._addClass("ui-accordion", "ui-widget ui-helper-reset");
this.element.attr("role", "tablist");
if(!options.collapsible&&(options.active===false||options.active==null) ){
options.active=0;
}
this._processPanels();
if(options.active < 0){
options.active +=this.headers.length;
}
this._refresh();
},
_getCreateEventData: function(){
return {
header: this.active,
panel: !this.active.length ? $():this.active.next()
};},
_createIcons: function(){
var icon, children,
icons=this.options.icons;
if(icons){
icon=$("<span>");
this._addClass(icon, "ui-accordion-header-icon", "ui-icon " + icons.header);
icon.prependTo(this.headers);
children=this.active.children(".ui-accordion-header-icon");
this._removeClass(children, icons.header)
._addClass(children, null, icons.activeHeader)
._addClass(this.headers, "ui-accordion-icons");
}},
_destroyIcons: function(){
this._removeClass(this.headers, "ui-accordion-icons");
this.headers.children(".ui-accordion-header-icon").remove();
},
_destroy: function(){
var contents;
this.element.removeAttr("role");
this.headers
.removeAttr("role aria-expanded aria-selected aria-controls tabIndex")
.removeUniqueId();
this._destroyIcons();
contents=this.headers.next()
.css("display", "")
.removeAttr("role aria-hidden aria-labelledby")
.removeUniqueId();
if(this.options.heightStyle!=="content"){
contents.css("height", "");
}},
_setOption: function(key, value){
if(key==="active"){
this._activate(value);
return;
}
if(key==="event"){
if(this.options.event){
this._off(this.headers, this.options.event);
}
this._setupEvents(value);
}
this._super(key, value);
if(key==="collapsible"&&!value&&this.options.active===false){
this._activate(0);
}
if(key==="icons"){
this._destroyIcons();
if(value){
this._createIcons();
}}
},
_setOptionDisabled: function(value){
this._super(value);
this.element.attr("aria-disabled", value);
this._toggleClass(null, "ui-state-disabled", !!value);
this._toggleClass(this.headers.add(this.headers.next()), null, "ui-state-disabled",
!!value);
},
_keydown: function(event){
if(event.altKey||event.ctrlKey){
return;
}
var keyCode=$.ui.keyCode,
length=this.headers.length,
currentIndex=this.headers.index(event.target),
toFocus=false;
switch(event.keyCode){
case keyCode.RIGHT:
case keyCode.DOWN:
toFocus=this.headers[(currentIndex + 1) % length ];
break;
case keyCode.LEFT:
case keyCode.UP:
toFocus=this.headers[(currentIndex - 1 + length) % length ];
break;
case keyCode.SPACE:
case keyCode.ENTER:
this._eventHandler(event);
break;
case keyCode.HOME:
toFocus=this.headers[ 0 ];
break;
case keyCode.END:
toFocus=this.headers[ length - 1 ];
break;
}
if(toFocus){
$(event.target).attr("tabIndex", -1);
$(toFocus).attr("tabIndex", 0);
$(toFocus).trigger("focus");
event.preventDefault();
}},
_panelKeyDown: function(event){
if(event.keyCode===$.ui.keyCode.UP&&event.ctrlKey){
$(event.currentTarget).prev().trigger("focus");
}},
refresh: function(){
var options=this.options;
this._processPanels();
if(( options.active===false&&options.collapsible===true) ||
!this.headers.length){
options.active=false;
this.active=$();
}else if(options.active===false){
this._activate(0);
}else if(this.active.length&&!$.contains(this.element[ 0 ], this.active[ 0 ]) ){
if(this.headers.length===this.headers.find(".ui-state-disabled").length){
options.active=false;
this.active=$();
}else{
this._activate(Math.max(0, options.active - 1) );
}}else{
options.active=this.headers.index(this.active);
}
this._destroyIcons();
this._refresh();
},
_processPanels: function(){
var prevHeaders=this.headers,
prevPanels=this.panels;
this.headers=this.element.find(this.options.header);
this._addClass(this.headers, "ui-accordion-header ui-accordion-header-collapsed",
"ui-state-default");
this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide();
this._addClass(this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content");
if(prevPanels){
this._off(prevHeaders.not(this.headers) );
this._off(prevPanels.not(this.panels) );
}},
_refresh: function(){
var maxHeight,
options=this.options,
heightStyle=options.heightStyle,
parent=this.element.parent();
this.active=this._findActive(options.active);
this._addClass(this.active, "ui-accordion-header-active", "ui-state-active")
._removeClass(this.active, "ui-accordion-header-collapsed");
this._addClass(this.active.next(), "ui-accordion-content-active");
this.active.next().show();
this.headers
.attr("role", "tab")
.each(function(){
var header=$(this),
headerId=header.uniqueId().attr("id"),
panel=header.next(),
panelId=panel.uniqueId().attr("id");
header.attr("aria-controls", panelId);
panel.attr("aria-labelledby", headerId);
})
.next()
.attr("role", "tabpanel");
this.headers
.not(this.active)
.attr({
"aria-selected": "false",
"aria-expanded": "false",
tabIndex: -1
})
.next()
.attr({
"aria-hidden": "true"
})
.hide();
if(!this.active.length){
this.headers.eq(0).attr("tabIndex", 0);
}else{
this.active.attr({
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
})
.next()
.attr({
"aria-hidden": "false"
});
}
this._createIcons();
this._setupEvents(options.event);
if(heightStyle==="fill"){
maxHeight=parent.height();
this.element.siblings(":visible").each(function(){
var elem=$(this),
position=elem.css("position");
if(position==="absolute"||position==="fixed"){
return;
}
maxHeight -=elem.outerHeight(true);
});
this.headers.each(function(){
maxHeight -=$(this).outerHeight(true);
});
this.headers.next()
.each(function(){
$(this).height(Math.max(0, maxHeight -
$(this).innerHeight() + $(this).height()) );
})
.css("overflow", "auto");
}else if(heightStyle==="auto"){
maxHeight=0;
this.headers.next()
.each(function(){
var isVisible=$(this).is(":visible");
if(!isVisible){
$(this).show();
}
maxHeight=Math.max(maxHeight, $(this).css("height", "").height());
if(!isVisible){
$(this).hide();
}})
.height(maxHeight);
}},
_activate: function(index){
var active=this._findActive(index)[ 0 ];
if(active===this.active[ 0 ]){
return;
}
active=active||this.active[ 0 ];
this._eventHandler({
target: active,
currentTarget: active,
preventDefault: $.noop
});
},
_findActive: function(selector){
return typeof selector==="number" ? this.headers.eq(selector):$();
},
_setupEvents: function(event){
var events={
keydown: "_keydown"
};
if(event){
$.each(event.split(" "), function(index, eventName){
events[ eventName ]="_eventHandler";
});
}
this._off(this.headers.add(this.headers.next()) );
this._on(this.headers, events);
this._on(this.headers.next(), { keydown: "_panelKeyDown" });
this._hoverable(this.headers);
this._focusable(this.headers);
},
_eventHandler: function(event){
var activeChildren, clickedChildren,
options=this.options,
active=this.active,
clicked=$(event.currentTarget),
clickedIsActive=clicked[ 0 ]===active[ 0 ],
collapsing=clickedIsActive&&options.collapsible,
toShow=collapsing ? $():clicked.next(),
toHide=active.next(),
eventData={
oldHeader: active,
oldPanel: toHide,
newHeader: collapsing ? $():clicked,
newPanel: toShow
};
event.preventDefault();
if((clickedIsActive&&!options.collapsible) ||
(this._trigger("beforeActivate", event, eventData)===false) ){
return;
}
options.active=collapsing ? false:this.headers.index(clicked);
this.active=clickedIsActive ? $():clicked;
this._toggle(eventData);
this._removeClass(active, "ui-accordion-header-active", "ui-state-active");
if(options.icons){
activeChildren=active.children(".ui-accordion-header-icon");
this._removeClass(activeChildren, null, options.icons.activeHeader)
._addClass(activeChildren, null, options.icons.header);
}
if(!clickedIsActive){
this._removeClass(clicked, "ui-accordion-header-collapsed")
._addClass(clicked, "ui-accordion-header-active", "ui-state-active");
if(options.icons){
clickedChildren=clicked.children(".ui-accordion-header-icon");
this._removeClass(clickedChildren, null, options.icons.header)
._addClass(clickedChildren, null, options.icons.activeHeader);
}
this._addClass(clicked.next(), "ui-accordion-content-active");
}},
_toggle: function(data){
var toShow=data.newPanel,
toHide=this.prevShow.length ? this.prevShow:data.oldPanel;
this.prevShow.add(this.prevHide).stop(true, true);
this.prevShow=toShow;
this.prevHide=toHide;
if(this.options.animate){
this._animate(toShow, toHide, data);
}else{
toHide.hide();
toShow.show();
this._toggleComplete(data);
}
toHide.attr({
"aria-hidden": "true"
});
toHide.prev().attr({
"aria-selected": "false",
"aria-expanded": "false"
});
if(toShow.length&&toHide.length){
toHide.prev().attr({
"tabIndex": -1,
"aria-expanded": "false"
});
}else if(toShow.length){
this.headers.filter(function(){
return parseInt($(this).attr("tabIndex"), 10)===0;
})
.attr("tabIndex", -1);
}
toShow
.attr("aria-hidden", "false")
.prev()
.attr({
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
});
},
_animate: function(toShow, toHide, data){
var total, easing, duration,
that=this,
adjust=0,
boxSizing=toShow.css("box-sizing"),
down=toShow.length &&
(!toHide.length||(toShow.index() < toHide.index()) ),
animate=this.options.animate||{},
options=down&&animate.down||animate,
complete=function(){
that._toggleComplete(data);
};
if(typeof options==="number"){
duration=options;
}
if(typeof options==="string"){
easing=options;
}
easing=easing||options.easing||animate.easing;
duration=duration||options.duration||animate.duration;
if(!toHide.length){
return toShow.animate(this.showProps, duration, easing, complete);
}
if(!toShow.length){
return toHide.animate(this.hideProps, duration, easing, complete);
}
total=toShow.show().outerHeight();
toHide.animate(this.hideProps, {
duration: duration,
easing: easing,
step: function(now, fx){
fx.now=Math.round(now);
}});
toShow
.hide()
.animate(this.showProps, {
duration: duration,
easing: easing,
complete: complete,
step: function(now, fx){
fx.now=Math.round(now);
if(fx.prop!=="height"){
if(boxSizing==="content-box"){
adjust +=fx.now;
}}else if(that.options.heightStyle!=="content"){
fx.now=Math.round(total - toHide.outerHeight() - adjust);
adjust=0;
}}
});
},
_toggleComplete: function(data){
var toHide=data.oldPanel,
prev=toHide.prev();
this._removeClass(toHide, "ui-accordion-content-active");
this._removeClass(prev, "ui-accordion-header-active")
._addClass(prev, "ui-accordion-header-collapsed");
if(toHide.length){
toHide.parent()[ 0 ].className=toHide.parent()[ 0 ].className;
}
this._trigger("activate", null, data);
}});
var safeActiveElement=$.ui.safeActiveElement=function(document){
var activeElement;
try {
activeElement=document.activeElement;
} catch(error){
activeElement=document.body;
}
if(!activeElement){
activeElement=document.body;
}
if(!activeElement.nodeName){
activeElement=document.body;
}
return activeElement;
};
var widgetsMenu=$.widget("ui.menu", {
version: "1.12.0",
defaultElement: "<ul>",
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=false;
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(event){
event.preventDefault();
},
"click .ui-menu-item": function(event){
var target=$(event.target);
var active=$($.ui.safeActiveElement(this.document[ 0 ]) );
if(!this.mouseHandled&&target.not(".ui-state-disabled").length){
this.select(event);
if(!event.isPropagationStopped()){
this.mouseHandled=true;
}
if(target.has(".ui-menu").length){
this.expand (event);
}else if(!this.element.is(":focus") &&
active.closest(".ui-menu").length){
this.element.trigger("focus", [ true ]);
if(this.active&&this.active.parents(".ui-menu").length===1){
clearTimeout(this.timer);
}}
}},
"mouseenter .ui-menu-item": function(event){
if(this.previousFilter){
return;
}
var actualTarget=$(event.target).closest(".ui-menu-item"),
target=$(event.currentTarget);
if(actualTarget[ 0 ]!==target[ 0 ]){
return;
}
this._removeClass(target.siblings().children(".ui-state-active"),
null, "ui-state-active");
this.focus(event, target);
},
mouseleave: "collapseAll",
"mouseleave .ui-menu": "collapseAll",
focus: function(event, keepActiveItem){
var item=this.active||this.element.find(this.options.items).eq(0);
if(!keepActiveItem){
this.focus(event, item);
}},
blur: function(event){
this._delay(function(){
var notContained = !$.contains(this.element[ 0 ],
$.ui.safeActiveElement(this.document[ 0 ])
);
if(notContained){
this.collapseAll(event);
}});
},
keydown: "_keydown"
});
this.refresh();
this._on(this.document, {
click: function(event){
if(this._closeOnDocumentClick(event) ){
this.collapseAll(event);
}
this.mouseHandled=false;
}});
},
_destroy: function(){
var items=this.element.find(".ui-menu-item")
.removeAttr("role aria-disabled"),
submenus=items.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();
submenus.children().each(function(){
var elem=$(this);
if(elem.data("ui-menu-submenu-caret") ){
elem.remove();
}});
},
_keydown: function(event){
var match, prev, character, skip,
preventDefault=true;
switch(event.keyCode){
case $.ui.keyCode.PAGE_UP:
this.previousPage(event);
break;
case $.ui.keyCode.PAGE_DOWN:
this.nextPage(event);
break;
case $.ui.keyCode.HOME:
this._move("first", "first", event);
break;
case $.ui.keyCode.END:
this._move("last", "last", event);
break;
case $.ui.keyCode.UP:
this.previous(event);
break;
case $.ui.keyCode.DOWN:
this.next(event);
break;
case $.ui.keyCode.LEFT:
this.collapse(event);
break;
case $.ui.keyCode.RIGHT:
if(this.active&&!this.active.is(".ui-state-disabled") ){
this.expand (event);
}
break;
case $.ui.keyCode.ENTER:
case $.ui.keyCode.SPACE:
this._activate(event);
break;
case $.ui.keyCode.ESCAPE:
this.collapse(event);
break;
default:
preventDefault=false;
prev=this.previousFilter||"";
character=String.fromCharCode(event.keyCode);
skip=false;
clearTimeout(this.filterTimer);
if(character===prev){
skip=true;
}else{
character=prev + character;
}
match=this._filterMenuItems(character);
match=skip&&match.index(this.active.next())!==-1 ?
this.active.nextAll(".ui-menu-item") :
match;
if(!match.length){
character=String.fromCharCode(event.keyCode);
match=this._filterMenuItems(character);
}
if(match.length){
this.focus(event, match);
this.previousFilter=character;
this.filterTimer=this._delay(function(){
delete this.previousFilter;
}, 1000);
}else{
delete this.previousFilter;
}}
if(preventDefault){
event.preventDefault();
}},
_activate: function(event){
if(this.active&&!this.active.is(".ui-state-disabled") ){
if(this.active.children("[aria-haspopup='true']").length){
this.expand (event);
}else{
this.select(event);
}}
},
refresh: function(){
var menus, items, newSubmenus, newItems, newWrappers,
that=this,
icon=this.options.icons.submenu,
submenus=this.element.find(this.options.menus);
this._toggleClass("ui-menu-icons", null, !!this.element.find(".ui-icon").length);
newSubmenus=submenus.filter(":not(.ui-menu)")
.hide()
.attr({
role: this.options.role,
"aria-hidden": "true",
"aria-expanded": "false"
})
.each(function(){
var menu=$(this),
item=menu.prev(),
submenuCaret=$("<span>").data("ui-menu-submenu-caret", true);
that._addClass(submenuCaret, "ui-menu-icon", "ui-icon " + icon);
item
.attr("aria-haspopup", "true")
.prepend(submenuCaret);
menu.attr("aria-labelledby", item.attr("id") );
});
this._addClass(newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front");
menus=submenus.add(this.element);
items=menus.find(this.options.items);
items.not(".ui-menu-item").each(function(){
var item=$(this);
if(that._isDivider(item) ){
that._addClass(item, "ui-menu-divider", "ui-widget-content");
}});
newItems=items.not(".ui-menu-item, .ui-menu-divider");
newWrappers=newItems.children()
.not(".ui-menu")
.uniqueId()
.attr({
tabIndex: -1,
role: this._itemRole()
});
this._addClass(newItems, "ui-menu-item")
._addClass(newWrappers, "ui-menu-item-wrapper");
items.filter(".ui-state-disabled").attr("aria-disabled", "true");
if(this.active&&!$.contains(this.element[ 0 ], this.active[ 0 ]) ){
this.blur();
}},
_itemRole: function(){
return {
menu: "menuitem",
listbox: "option"
}[ this.options.role ];
},
_setOption: function(key, value){
if(key==="icons"){
var icons=this.element.find(".ui-menu-icon");
this._removeClass(icons, null, this.options.icons.submenu)
._addClass(icons, null, value.submenu);
}
this._super(key, value);
},
_setOptionDisabled: function(value){
this._super(value);
this.element.attr("aria-disabled", String(value) );
this._toggleClass(null, "ui-state-disabled", !!value);
},
focus: function(event, item){
var nested, focused, activeParent;
this.blur(event, event&&event.type==="focus");
this._scrollIntoView(item);
this.active=item.first();
focused=this.active.children(".ui-menu-item-wrapper");
this._addClass(focused, null, "ui-state-active");
if(this.options.role){
this.element.attr("aria-activedescendant", focused.attr("id") );
}
activeParent=this.active
.parent()
.closest(".ui-menu-item")
.children(".ui-menu-item-wrapper");
this._addClass(activeParent, null, "ui-state-active");
if(event&&event.type==="keydown"){
this._close();
}else{
this.timer=this._delay(function(){
this._close();
}, this.delay);
}
nested=item.children(".ui-menu");
if(nested.length&&event&&(/^mouse/.test(event.type) )){
this._startOpening(nested);
}
this.activeMenu=item.parent();
this._trigger("focus", event, { item: item });
},
_scrollIntoView: function(item){
var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
if(this._hasScroll()){
borderTop=parseFloat($.css(this.activeMenu[ 0 ], "borderTopWidth") )||0;
paddingTop=parseFloat($.css(this.activeMenu[ 0 ], "paddingTop") )||0;
offset=item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
scroll=this.activeMenu.scrollTop();
elementHeight=this.activeMenu.height();
itemHeight=item.outerHeight();
if(offset < 0){
this.activeMenu.scrollTop(scroll + offset);
}else if(offset + itemHeight > elementHeight){
this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight);
}}
},
blur: function(event, fromFocus){
if(!fromFocus){
clearTimeout(this.timer);
}
if(!this.active){
return;
}
this._removeClass(this.active.children(".ui-menu-item-wrapper"),
null, "ui-state-active");
this._trigger("blur", event, { item: this.active });
this.active=null;
},
_startOpening: function(submenu){
clearTimeout(this.timer);
if(submenu.attr("aria-hidden")!=="true"){
return;
}
this.timer=this._delay(function(){
this._close();
this._open(submenu);
}, this.delay);
},
_open: function(submenu){
var position=$.extend({
of: this.active
}, this.options.position);
clearTimeout(this.timer);
this.element.find(".ui-menu").not(submenu.parents(".ui-menu") )
.hide()
.attr("aria-hidden", "true");
submenu
.show()
.removeAttr("aria-hidden")
.attr("aria-expanded", "true")
.position(position);
},
collapseAll: function(event, all){
clearTimeout(this.timer);
this.timer=this._delay(function(){
var currentMenu=all ? this.element :
$(event&&event.target).closest(this.element.find(".ui-menu") );
if(!currentMenu.length){
currentMenu=this.element;
}
this._close(currentMenu);
this.blur(event);
this._removeClass(currentMenu.find(".ui-state-active"), null, "ui-state-active");
this.activeMenu=currentMenu;
}, this.delay);
},
_close: function(startMenu){
if(!startMenu){
startMenu=this.active ? this.active.parent():this.element;
}
startMenu.find(".ui-menu")
.hide()
.attr("aria-hidden", "true")
.attr("aria-expanded", "false");
},
_closeOnDocumentClick: function(event){
return !$(event.target).closest(".ui-menu").length;
},
_isDivider: function(item){
return !/[^\-\u2014\u2013\s]/.test(item.text());
},
collapse: function(event){
var newItem=this.active &&
this.active.parent().closest(".ui-menu-item", this.element);
if(newItem&&newItem.length){
this._close();
this.focus(event, newItem);
}},
expand: function(event){
var newItem=this.active &&
this.active
.children(".ui-menu ")
.find(this.options.items)
.first();
if(newItem&&newItem.length){
this._open(newItem.parent());
this._delay(function(){
this.focus(event, newItem);
});
}},
next: function(event){
this._move("next", "first", event);
},
previous: function(event){
this._move("prev", "last", event);
},
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(direction, filter, event){
var next;
if(this.active){
if(direction==="first"||direction==="last"){
next=this.active
[ direction==="first" ? "prevAll":"nextAll" ](".ui-menu-item")
.eq(-1);
}else{
next=this.active
[ direction + "All" ](".ui-menu-item")
.eq(0);
}}
if(!next||!next.length||!this.active){
next=this.activeMenu.find(this.options.items)[ filter ]();
}
this.focus(event, next);
},
nextPage: function(event){
var item, base, height;
if(!this.active){
this.next(event);
return;
}
if(this.isLastItem()){
return;
}
if(this._hasScroll()){
base=this.active.offset().top;
height=this.element.height();
this.active.nextAll(".ui-menu-item").each(function(){
item=$(this);
return item.offset().top - base - height < 0;
});
this.focus(event, item);
}else{
this.focus(event, this.activeMenu.find(this.options.items)
[ !this.active ? "first":"last" ]());
}},
previousPage: function(event){
var item, base, height;
if(!this.active){
this.next(event);
return;
}
if(this.isFirstItem()){
return;
}
if(this._hasScroll()){
base=this.active.offset().top;
height=this.element.height();
this.active.prevAll(".ui-menu-item").each(function(){
item=$(this);
return item.offset().top - base + height > 0;
});
this.focus(event, item);
}else{
this.focus(event, this.activeMenu.find(this.options.items).first());
}},
_hasScroll: function(){
return this.element.outerHeight() < this.element.prop("scrollHeight");
},
select: function(event){
this.active=this.active||$(event.target).closest(".ui-menu-item");
var ui={ item: this.active };
if(!this.active.has(".ui-menu").length){
this.collapseAll(event, true);
}
this._trigger("select", event, ui);
},
_filterMenuItems: function(character){
var escapedCharacter=character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"),
regex=new RegExp("^" + escapedCharacter, "i");
return this.activeMenu
.find(this.options.items)
.filter(".ui-menu-item")
.filter(function(){
return regex.test($.trim($(this).children(".ui-menu-item-wrapper").text()) );
});
}});
$.widget("ui.autocomplete", {
version: "1.12.0",
defaultElement: "<input>",
options: {
appendTo: null,
autoFocus: false,
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 suppressKeyPress, suppressKeyPressRepeat, suppressInput,
nodeName=this.element[ 0 ].nodeName.toLowerCase(),
isTextarea=nodeName==="textarea",
isInput=nodeName==="input";
this.isMultiLine=isTextarea||!isInput&&this._isContentEditable(this.element);
this.valueMethod=this.element[ isTextarea||isInput ? "val":"text" ];
this.isNewMenu=true;
this._addClass("ui-autocomplete-input");
this.element.attr("autocomplete", "off");
this._on(this.element, {
keydown: function(event){
if(this.element.prop("readOnly") ){
suppressKeyPress=true;
suppressInput=true;
suppressKeyPressRepeat=true;
return;
}
suppressKeyPress=false;
suppressInput=false;
suppressKeyPressRepeat=false;
var keyCode=$.ui.keyCode;
switch(event.keyCode){
case keyCode.PAGE_UP:
suppressKeyPress=true;
this._move("previousPage", event);
break;
case keyCode.PAGE_DOWN:
suppressKeyPress=true;
this._move("nextPage", event);
break;
case keyCode.UP:
suppressKeyPress=true;
this._keyEvent("previous", event);
break;
case keyCode.DOWN:
suppressKeyPress=true;
this._keyEvent("next", event);
break;
case keyCode.ENTER:
if(this.menu.active){
suppressKeyPress=true;
event.preventDefault();
this.menu.select(event);
}
break;
case keyCode.TAB:
if(this.menu.active){
this.menu.select(event);
}
break;
case keyCode.ESCAPE:
if(this.menu.element.is(":visible") ){
if(!this.isMultiLine){
this._value(this.term);
}
this.close(event);
event.preventDefault();
}
break;
default:
suppressKeyPressRepeat=true;
this._searchTimeout(event);
break;
}},
keypress: function(event){
if(suppressKeyPress){
suppressKeyPress=false;
if(!this.isMultiLine||this.menu.element.is(":visible") ){
event.preventDefault();
}
return;
}
if(suppressKeyPressRepeat){
return;
}
var keyCode=$.ui.keyCode;
switch(event.keyCode){
case keyCode.PAGE_UP:
this._move("previousPage", event);
break;
case keyCode.PAGE_DOWN:
this._move("nextPage", event);
break;
case keyCode.UP:
this._keyEvent("previous", event);
break;
case keyCode.DOWN:
this._keyEvent("next", event);
break;
}},
input: function(event){
if(suppressInput){
suppressInput=false;
event.preventDefault();
return;
}
this._searchTimeout(event);
},
focus: function(){
this.selectedItem=null;
this.previous=this._value();
},
blur: function(event){
if(this.cancelBlur){
delete this.cancelBlur;
return;
}
clearTimeout(this.searching);
this.close(event);
this._change(event);
}});
this._initSource();
this.menu=$("<ul>")
.appendTo(this._appendTo())
.menu({
role: null
})
.hide()
.menu("instance");
this._addClass(this.menu.element, "ui-autocomplete", "ui-front");
this._on(this.menu.element, {
mousedown: function(event){
event.preventDefault();
this.cancelBlur=true;
this._delay(function(){
delete this.cancelBlur;
if(this.element[ 0 ]!==$.ui.safeActiveElement(this.document[ 0 ]) ){
this.element.trigger("focus");
}});
},
menufocus: function(event, ui){
var label, item;
if(this.isNewMenu){
this.isNewMenu=false;
if(event.originalEvent&&/^mouse/.test(event.originalEvent.type) ){
this.menu.blur();
this.document.one("mousemove", function(){
$(event.target).trigger(event.originalEvent);
});
return;
}}
item=ui.item.data("ui-autocomplete-item");
if(false!==this._trigger("focus", event, { item: item }) ){
if(event.originalEvent&&/^key/.test(event.originalEvent.type) ){
this._value(item.value);
}}
label=ui.item.attr("aria-label")||item.value;
if(label&&$.trim(label).length){
this.liveRegion.children().hide();
$("<div>").text(label).appendTo(this.liveRegion);
}},
menuselect: function(event, ui){
var item=ui.item.data("ui-autocomplete-item"),
previous=this.previous;
if(this.element[ 0 ]!==$.ui.safeActiveElement(this.document[ 0 ]) ){
this.element.trigger("focus");
this.previous=previous;
this._delay(function(){
this.previous=previous;
this.selectedItem=item;
});
}
if(false!==this._trigger("select", event, { item: item }) ){
this._value(item.value);
}
this.term=this._value();
this.close(event);
this.selectedItem=item;
}});
this.liveRegion=$("<div>", {
role: "status",
"aria-live": "assertive",
"aria-relevant": "additions"
})
.appendTo(this.document[ 0 ].body);
this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible");
this._on(this.window, {
beforeunload: function(){
this.element.removeAttr("autocomplete");
}});
},
_destroy: function(){
clearTimeout(this.searching);
this.element.removeAttr("autocomplete");
this.menu.element.remove();
this.liveRegion.remove();
},
_setOption: function(key, value){
this._super(key, value);
if(key==="source"){
this._initSource();
}
if(key==="appendTo"){
this.menu.element.appendTo(this._appendTo());
}
if(key==="disabled"&&value&&this.xhr){
this.xhr.abort();
}},
_isEventTargetInWidget: function(event){
var menuElement=this.menu.element[ 0 ];
return event.target===this.element[ 0 ] ||
event.target===menuElement ||
$.contains(menuElement, event.target);
},
_closeOnClickOutside: function(event){
if(!this._isEventTargetInWidget(event) ){
this.close();
}},
_appendTo: function(){
var element=this.options.appendTo;
if(element){
element=element.jquery||element.nodeType ?
$(element) :
this.document.find(element).eq(0);
}
if(!element||!element[ 0 ]){
element=this.element.closest(".ui-front, dialog");
}
if(!element.length){
element=this.document[ 0 ].body;
}
return element;
},
_initSource: function(){
var array, url,
that=this;
if($.isArray(this.options.source) ){
array=this.options.source;
this.source=function(request, response){
response($.ui.autocomplete.filter(array, request.term) );
};}else if(typeof this.options.source==="string"){
url=this.options.source;
this.source=function(request, response){
if(that.xhr){
that.xhr.abort();
}
that.xhr=$.ajax({
url: url,
data: request,
dataType: "json",
success: function(data){
response(data);
},
error: function(){
response([]);
}});
};}else{
this.source=this.options.source;
}},
_searchTimeout: function(event){
clearTimeout(this.searching);
this.searching=this._delay(function(){
var equalValues=this.term===this._value(),
menuVisible=this.menu.element.is(":visible"),
modifierKey=event.altKey||event.ctrlKey||event.metaKey||event.shiftKey;
if(!equalValues||(equalValues&&!menuVisible&&!modifierKey) ){
this.selectedItem=null;
this.search(null, event);
}}, this.options.delay);
},
search: function(value, event){
value=value!=null ? value:this._value();
this.term=this._value();
if(value.length < this.options.minLength){
return this.close(event);
}
if(this._trigger("search", event)===false){
return;
}
return this._search(value);
},
_search: function(value){
this.pending++;
this._addClass("ui-autocomplete-loading");
this.cancelSearch=false;
this.source({ term: value }, this._response());
},
_response: function(){
var index=++this.requestIndex;
return $.proxy(function(content){
if(index===this.requestIndex){
this.__response(content);
}
this.pending--;
if(!this.pending){
this._removeClass("ui-autocomplete-loading");
}}, this);
},
__response: function(content){
if(content){
content=this._normalize(content);
}
this._trigger("response", null, { content: content });
if(!this.options.disabled&&content&&content.length&&!this.cancelSearch){
this._suggest(content);
this._trigger("open");
}else{
this._close();
}},
close: function(event){
this.cancelSearch=true;
this._close(event);
},
_close: function(event){
this._off(this.document, "mousedown");
if(this.menu.element.is(":visible") ){
this.menu.element.hide();
this.menu.blur();
this.isNewMenu=true;
this._trigger("close", event);
}},
_change: function(event){
if(this.previous!==this._value()){
this._trigger("change", event, { item: this.selectedItem });
}},
_normalize: function(items){
if(items.length&&items[ 0 ].label&&items[ 0 ].value){
return items;
}
return $.map(items, function(item){
if(typeof item==="string"){
return {
label: item,
value: item
};}
return $.extend({}, item, {
label: item.label||item.value,
value: item.value||item.label
});
});
},
_suggest: function(items){
var ul=this.menu.element.empty();
this._renderMenu(ul, items);
this.isNewMenu=true;
this.menu.refresh();
ul.show();
this._resizeMenu();
ul.position($.extend({
of: this.element
}, this.options.position) );
if(this.options.autoFocus){
this.menu.next();
}
this._on(this.document, {
mousedown: "_closeOnClickOutside"
});
},
_resizeMenu: function(){
var ul=this.menu.element;
ul.outerWidth(Math.max(ul.width("").outerWidth() + 1,
this.element.outerWidth()
));
},
_renderMenu: function(ul, items){
var that=this;
$.each(items, function(index, item){
that._renderItemData(ul, item);
});
},
_renderItemData: function(ul, item){
return this._renderItem(ul, item).data("ui-autocomplete-item", item);
},
_renderItem: function(ul, item){
return $("<li>")
.append($("<div>").text(item.label) )
.appendTo(ul);
},
_move: function(direction, event){
if(!this.menu.element.is(":visible") ){
this.search(null, event);
return;
}
if(this.menu.isFirstItem()&&/^previous/.test(direction) ||
this.menu.isLastItem()&&/^next/.test(direction) ){
if(!this.isMultiLine){
this._value(this.term);
}
this.menu.blur();
return;
}
this.menu[ direction ](event);
},
widget: function(){
return this.menu.element;
},
_value: function(){
return this.valueMethod.apply(this.element, arguments);
},
_keyEvent: function(keyEvent, event){
if(!this.isMultiLine||this.menu.element.is(":visible") ){
this._move(keyEvent, event);
event.preventDefault();
}},
_isContentEditable: function(element){
if(!element.length){
return false;
}
var editable=element.prop("contentEditable");
if(editable==="inherit"){
return this._isContentEditable(element.parent());
}
return editable==="true";
}});
$.extend($.ui.autocomplete, {
escapeRegex: function(value){
return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
},
filter: function(array, term){
var matcher=new RegExp($.ui.autocomplete.escapeRegex(term), "i");
return $.grep(array, function(value){
return matcher.test(value.label||value.value||value);
});
}});
$.widget("ui.autocomplete", $.ui.autocomplete, {
options: {
messages: {
noResults: "No search results.",
results: function(amount){
return amount +(amount > 1 ? " results are":" result is") +
" available, use up and down arrow keys to navigate.";
}}
},
__response: function(content){
var message;
this._superApply(arguments);
if(this.options.disabled||this.cancelSearch){
return;
}
if(content&&content.length){
message=this.options.messages.results(content.length);
}else{
message=this.options.messages.noResults;
}
this.liveRegion.children().hide();
$("<div>").text(message).appendTo(this.liveRegion);
}});
var widgetsAutocomplete=$.ui.autocomplete;
var controlgroupCornerRegex=/ui-corner-([a-z]){2,6}/g;
var widgetsControlgroup=$.widget("ui.controlgroup", {
version: "1.12.0",
defaultElement: "<div>",
options: {
direction: "horizontal",
disabled: null,
onlyVisible: true,
items: {
"button": "input[type=button], input[type=submit], input[type=reset], button, a",
"controlgroupLabel": ".ui-controlgroup-label",
"checkboxradio": "input[type='checkbox'], input[type='radio']",
"selectmenu": "select",
"spinner": ".ui-spinner-input"
}},
_create: function(){
this._enhance();
},
_enhance: function(){
this.element.attr("role", "toolbar");
this.refresh();
},
_destroy: function(){
this._callChildMethod("destroy");
this.childWidgets.removeData("ui-controlgroup-data");
this.element.removeAttr("role");
if(this.options.items.controlgroupLabel){
this.element
.find(this.options.items.controlgroupLabel)
.find(".ui-controlgroup-label-contents")
.contents().unwrap();
}},
_initWidgets: function(){
var that=this,
childWidgets=[];
$.each(this.options.items, function(widget, selector){
var labels;
var options={};
if(!selector){
return;
}
if(widget==="controlgroupLabel"){
labels=that.element.find(selector);
labels.each(function(){
var element=$(this);
if(element.children(".ui-controlgroup-label-contents").length){
return;
}
element.contents()
.wrapAll("<span class='ui-controlgroup-label-contents'></span>");
});
that._addClass(labels, null, "ui-widget ui-widget-content ui-state-default");
childWidgets=childWidgets.concat(labels.get());
return;
}
if(!$.fn[ widget ]){
return;
}
if(that[ "_" + widget + "Options" ]){
options=that[ "_" + widget + "Options" ]("middle");
}
that.element
.find(selector)
.each(function(){
var element=$(this);
var instance=element[ widget ]("instance");
var instanceOptions=$.widget.extend({}, options);
if(widget==="button"&&element.parent(".ui-spinner").length){
return;
}
if(!instance){
instance=element[ widget ]()[ widget ]("instance");
}
if(instance){
instanceOptions.classes =
that._resolveClassesValues(instanceOptions.classes, instance);
}
element[ widget ](instanceOptions);
var widgetElement=element[ widget ]("widget");
$.data(widgetElement[ 0 ], "ui-controlgroup-data",
instance ? instance:element[ widget ]("instance") );
childWidgets.push(widgetElement[ 0 ]);
});
});
this.childWidgets=$($.unique(childWidgets) );
this._addClass(this.childWidgets, "ui-controlgroup-item");
},
_callChildMethod: function(method){
this.childWidgets.each(function(){
var element=$(this),
data=element.data("ui-controlgroup-data");
if(data&&data[ method ]){
data[ method ]();
}});
},
_updateCornerClass: function(element, position){
var remove="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
var add=this._buildSimpleOptions(position, "label").classes.label;
this._removeClass(element, null, remove);
this._addClass(element, null, add);
},
_buildSimpleOptions: function(position, key){
var direction=this.options.direction==="vertical";
var result={
classes: {}};
result.classes[ key ]={
"middle": "",
"first": "ui-corner-" +(direction ? "top":"left"),
"last": "ui-corner-" +(direction ? "bottom":"right"),
"only": "ui-corner-all"
}[ position ];
return result;
},
_spinnerOptions: function(position){
var options=this._buildSimpleOptions(position, "ui-spinner");
options.classes[ "ui-spinner-up" ]="";
options.classes[ "ui-spinner-down" ]="";
return options;
},
_buttonOptions: function(position){
return this._buildSimpleOptions(position, "ui-button");
},
_checkboxradioOptions: function(position){
return this._buildSimpleOptions(position, "ui-checkboxradio-label");
},
_selectmenuOptions: function(position){
var direction=this.options.direction==="vertical";
return {
width: direction ? "auto":false,
classes: {
middle: {
"ui-selectmenu-button-open": "",
"ui-selectmenu-button-closed": ""
},
first: {
"ui-selectmenu-button-open": "ui-corner-" +(direction ? "top":"tl"),
"ui-selectmenu-button-closed": "ui-corner-" +(direction ? "top":"left")
},
last: {
"ui-selectmenu-button-open": direction ? "":"ui-corner-tr",
"ui-selectmenu-button-closed": "ui-corner-" +(direction ? "bottom":"right")
},
only: {
"ui-selectmenu-button-open": "ui-corner-top",
"ui-selectmenu-button-closed": "ui-corner-all"
}}[ position ]
};},
_resolveClassesValues: function(classes, instance){
var result={};
$.each(classes, function(key){
var current=instance.options.classes[ key ]||"";
current=current.replace(controlgroupCornerRegex, "").trim();
result[ key ]=(current + " " + classes[ key ]).replace(/\s+/g, " ");
});
return result;
},
_setOption: function(key, value){
if(key==="direction"){
this._removeClass("ui-controlgroup-" + this.options.direction);
}
this._super(key, value);
if(key==="disabled"){
this._callChildMethod(value ? "disable":"enable");
return;
}
this.refresh();
},
refresh: function(){
var children,
that=this;
this._addClass("ui-controlgroup ui-controlgroup-" + this.options.direction);
if(this.options.direction==="horizontal"){
this._addClass(null, "ui-helper-clearfix");
}
this._initWidgets();
children=this.childWidgets;
if(this.options.onlyVisible){
children=children.filter(":visible");
}
if(children.length){
$.each([ "first", "last" ], function(index, value){
var instance=children[ value ]().data("ui-controlgroup-data");
if(instance&&that[ "_" + instance.widgetName + "Options" ]){
var options=that[ "_" + instance.widgetName + "Options" ](
children.length===1 ? "only":value
);
options.classes=that._resolveClassesValues(options.classes, instance);
instance.element[ instance.widgetName ](options);
}else{
that._updateCornerClass(children[ value ](), value);
}});
this._callChildMethod("refresh");
}}
});
$.widget("ui.checkboxradio", [ $.ui.formResetMixin, {
version: "1.12.0",
options: {
disabled: null,
label: null,
icon: true,
classes: {
"ui-checkboxradio-label": "ui-corner-all",
"ui-checkboxradio-icon": "ui-corner-all"
}},
_getCreateOptions: function(){
var disabled, labels;
var that=this;
var options=this._super()||{};
this._readType();
labels=this.element.labels();
this.label=$(labels[ labels.length - 1 ]);
if(!this.label.length){
$.error("No label found for checkboxradio widget");
}
this.originalLabel="";
this.label.contents().not(this.element).each(function(){
that.originalLabel +=this.nodeType===3 ? $(this).text():this.outerHTML;
});
if(this.originalLabel){
options.label=this.originalLabel;
}
disabled=this.element[ 0 ].disabled;
if(disabled!=null){
options.disabled=disabled;
}
return options;
},
_create: function(){
var checked=this.element[ 0 ].checked;
this._bindFormResetHandler();
if(this.options.disabled==null){
this.options.disabled=this.element[ 0 ].disabled;
}
this._setOption("disabled", this.options.disabled);
this._addClass("ui-checkboxradio", "ui-helper-hidden-accessible");
this._addClass(this.label, "ui-checkboxradio-label", "ui-button ui-widget");
if(this.type==="radio"){
this._addClass(this.label, "ui-checkboxradio-radio-label");
}
if(this.options.label&&this.options.label!==this.originalLabel){
this._updateLabel();
}else if(this.originalLabel){
this.options.label=this.originalLabel;
}
this._enhance();
if(checked){
this._addClass(this.label, "ui-checkboxradio-checked", "ui-state-active");
if(this.icon){
this._addClass(this.icon, null, "ui-state-hover");
}}
this._on({
change: "_toggleClasses",
focus: function(){
this._addClass(this.label, null, "ui-state-focus ui-visual-focus");
},
blur: function(){
this._removeClass(this.label, null, "ui-state-focus ui-visual-focus");
}});
},
_readType: function(){
var nodeName=this.element[ 0 ].nodeName.toLowerCase();
this.type=this.element[ 0 ].type;
if(nodeName!=="input"||!/radio|checkbox/.test(this.type) ){
$.error("Can't create checkboxradio on element.nodeName=" + nodeName +
" and element.type=" + this.type);
}},
_enhance: function(){
this._updateIcon(this.element[ 0 ].checked);
},
widget: function(){
return this.label;
},
_getRadioGroup: function(){
var group;
var name=this.element[ 0 ].name;
var nameSelector="input[name='" + $.ui.escapeSelector(name) + "']";
if(!name){
return $([]);
}
if(this.form.length){
group=$(this.form[ 0 ].elements).filter(nameSelector);
}else{
group=$(nameSelector).filter(function(){
return $(this).form().length===0;
});
}
return group.not(this.element);
},
_toggleClasses: function(){
var checked=this.element[ 0 ].checked;
this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked);
if(this.options.icon&&this.type==="checkbox"){
this._toggleClass(this.icon, null, "ui-icon-check ui-state-checked", checked)
._toggleClass(this.icon, null, "ui-icon-blank", !checked);
}
if(this.type==="radio"){
this._getRadioGroup()
.each(function(){
var instance=$(this).checkboxradio("instance");
if(instance){
instance._removeClass(instance.label,
"ui-checkboxradio-checked", "ui-state-active");
}});
}},
_destroy: function(){
this._unbindFormResetHandler();
if(this.icon){
this.icon.remove();
this.iconSpace.remove();
}},
_setOption: function(key, value){
if(key==="label"&&!value){
return;
}
this._super(key, value);
if(key==="disabled"){
this._toggleClass(this.label, null, "ui-state-disabled", value);
this.element[ 0 ].disabled=value;
return;
}
this.refresh();
},
_updateIcon: function(checked){
var toAdd="ui-icon ui-icon-background ";
if(this.options.icon){
if(!this.icon){
this.icon=$("<span>");
this.iconSpace=$("<span> </span>");
this._addClass(this.iconSpace, "ui-checkboxradio-icon-space");
}
if(this.type==="checkbox"){
toAdd +=checked ? "ui-icon-check ui-state-checked":"ui-icon-blank";
this._removeClass(this.icon, null, checked ? "ui-icon-blank":"ui-icon-check");
}else{
toAdd +="ui-icon-blank";
}
this._addClass(this.icon, "ui-checkboxradio-icon", toAdd);
if(!checked){
this._removeClass(this.icon, null, "ui-icon-check ui-state-checked");
}
this.icon.prependTo(this.label).after(this.iconSpace);
}else if(this.icon!==undefined){
this.icon.remove();
this.iconSpace.remove();
delete this.icon;
}},
_updateLabel: function(){
this.label.contents().not(this.element.add(this.icon).add(this.iconSpace) ).remove();
this.label.append(this.options.label);
},
refresh: function(){
var checked=this.element[ 0 ].checked,
isDisabled=this.element[ 0 ].disabled;
this._updateIcon(checked);
this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked);
if(this.options.label!==null){
this._updateLabel();
}
if(isDisabled!==this.options.disabled){
this._setOptions({ "disabled": isDisabled });
}}
} ]);
var widgetsCheckboxradio=$.ui.checkboxradio;
$.widget("ui.button", {
version: "1.12.0",
defaultElement: "<button>",
options: {
classes: {
"ui-button": "ui-corner-all"
},
disabled: null,
icon: null,
iconPosition: "beginning",
label: null,
showLabel: true
},
_getCreateOptions: function(){
var disabled,
options=this._super()||{};
this.isInput=this.element.is("input");
disabled=this.element[ 0 ].disabled;
if(disabled!=null){
options.disabled=disabled;
}
this.originalLabel=this.isInput ? this.element.val():this.element.html();
if(this.originalLabel){
options.label=this.originalLabel;
}
return options;
},
_create: function(){
if(!this.option.showLabel & !this.options.icon){
this.options.showLabel=true;
}
if(this.options.disabled==null){
this.options.disabled=this.element[ 0 ].disabled||false;
}
this.hasTitle = !!this.element.attr("title");
if(this.options.label&&this.options.label!==this.originalLabel){
if(this.isInput){
this.element.val(this.options.label);
}else{
this.element.html(this.options.label);
}}
this._addClass("ui-button", "ui-widget");
this._setOption("disabled", this.options.disabled);
this._enhance();
if(this.element.is("a") ){
this._on({
"keyup": function(event){
if(event.keyCode===$.ui.keyCode.SPACE){
event.preventDefault();
if(this.element[ 0 ].click){
this.element[ 0 ].click();
}else{
this.element.trigger("click");
}}
}});
}},
_enhance: function(){
if(!this.element.is("button") ){
this.element.attr("role", "button");
}
if(this.options.icon){
this._updateIcon("icon", this.options.icon);
this._updateTooltip();
}},
_updateTooltip: function(){
this.title=this.element.attr("title");
if(!this.options.showLabel&&!this.title){
this.element.attr("title", this.options.label);
}},
_updateIcon: function(option, value){
var icon=option!=="iconPosition",
position=icon ? this.options.iconPosition:value,
displayBlock=position==="top"||position==="bottom";
if(!this.icon){
this.icon=$("<span>");
this._addClass(this.icon, "ui-button-icon", "ui-icon");
if(!this.options.showLabel){
this._addClass("ui-button-icon-only");
}}else if(icon){
this._removeClass(this.icon, null, this.options.icon);
}
if(icon){
this._addClass(this.icon, null, value);
}
this._attachIcon(position);
if(displayBlock){
this._addClass(this.icon, null, "ui-widget-icon-block");
if(this.iconSpace){
this.iconSpace.remove();
}}else{
if(!this.iconSpace){
this.iconSpace=$("<span> </span>");
this._addClass(this.iconSpace, "ui-button-icon-space");
}
this._removeClass(this.icon, null, "ui-wiget-icon-block");
this._attachIconSpace(position);
}},
_destroy: function(){
this.element.removeAttr("role");
if(this.icon){
this.icon.remove();
}
if(this.iconSpace){
this.iconSpace.remove();
}
if(!this.hasTitle){
this.element.removeAttr("title");
}},
_attachIconSpace: function(iconPosition){
this.icon[ /^(?:end|bottom)/.test(iconPosition) ? "before":"after" ](this.iconSpace);
},
_attachIcon: function(iconPosition){
this.element[ /^(?:end|bottom)/.test(iconPosition) ? "append":"prepend" ](this.icon);
},
_setOptions: function(options){
var newShowLabel=options.showLabel===undefined ?
this.options.showLabel :
options.showLabel,
newIcon=options.icon===undefined ? this.options.icon:options.icon;
if(!newShowLabel&&!newIcon){
options.showLabel=true;
}
this._super(options);
},
_setOption: function(key, value){
if(key==="icon"){
if(value){
this._updateIcon(key, value);
}else if(this.icon){
this.icon.remove();
if(this.iconSpace){
this.iconSpace.remove();
}}
}
if(key==="iconPosition"){
this._updateIcon(key, value);
}
if(key==="showLabel"){
this._toggleClass("ui-button-icon-only", null, !value);
this._updateTooltip();
}
if(key==="label"){
if(this.isInput){
this.element.val(value);
}else{
this.element.html(value);
if(this.icon){
this._attachIcon(this.options.iconPosition);
this._attachIconSpace(this.options.iconPosition);
}}
}
this._super(key, value);
if(key==="disabled"){
this._toggleClass(null, "ui-state-disabled", value);
this.element[ 0 ].disabled=value;
if(value){
this.element.blur();
}}
},
refresh: function(){
var isDisabled=this.element.is("input, button") ?
this.element[ 0 ].disabled:this.element.hasClass("ui-button-disabled");
if(isDisabled!==this.options.disabled){
this._setOptions({ disabled: isDisabled });
}
this._updateTooltip();
}});
if($.uiBackCompat!==false){
$.widget("ui.button", $.ui.button, {
options: {
text: true,
icons: {
primary: null,
secondary: null
}},
_create: function(){
if(this.options.showLabel&&!this.options.text){
this.options.showLabel=this.options.text;
}
if(!this.options.showLabel&&this.options.text){
this.options.text=this.options.showLabel;
}
if(!this.options.icon&&(this.options.icons.primary ||
this.options.icons.secondary) ){
if(this.options.icons.primary){
this.options.icon=this.options.icons.primary;
}else{
this.options.icon=this.options.icons.secondary;
this.options.iconPosition="end";
}}else if(this.options.icon){
this.options.icons.primary=this.options.icon;
}
this._super();
},
_setOption: function(key, value){
if(key==="text"){
this._super("showLabel", value);
return;
}
if(key==="showLabel"){
this.options.text=value;
}
if(key==="icon"){
this.options.icons.primary=value;
}
if(key==="icons"){
if(value.primary){
this._super("icon", value.primary);
this._super("iconPosition", "beginning");
}else if(value.secondary){
this._super("icon", value.secondary);
this._super("iconPosition", "end");
}}
this._superApply(arguments);
}});
$.fn.button=(function(orig){
return function(){
if(!this.length||(this.length&&this[ 0 ].tagName!=="INPUT") ||
(this.length&&this[ 0 ].tagName==="INPUT"&&(
this.attr("type")!=="checkbox"&&this.attr("type")!=="radio"
)) ){
return orig.apply(this, arguments);
}
if(!$.ui.checkboxradio){
$.error("Checkboxradio widget missing");
}
if(arguments.length===0){
return this.checkboxradio({
"icon": false
});
}
return this.checkboxradio.apply(this, arguments);
};})($.fn.button);
$.fn.buttonset=function(){
if(!$.ui.controlgroup){
$.error("Controlgroup widget missing");
}
if(arguments[ 0 ]==="option"&&arguments[ 1 ]==="items"&&arguments[ 2 ]){
return this.controlgroup.apply(this,
[ arguments[ 0 ], "items.button", arguments[ 2 ] ]);
}
if(arguments[ 0 ]==="option"&&arguments[ 1 ]==="items"){
return this.controlgroup.apply(this, [ arguments[ 0 ], "items.button" ]);
}
if(typeof arguments[ 0 ]==="object"&&arguments[ 0 ].items){
arguments[ 0 ].items={
button: arguments[ 0 ].items
};}
return this.controlgroup.apply(this, arguments);
};}
var widgetsButton=$.ui.button;
$.extend($.ui, { datepicker: { version: "1.12.0" }});
var datepicker_instActive;
function datepicker_getZindex(elem){
var position, value;
while(elem.length&&elem[ 0 ]!==document){
position=elem.css("position");
if(position==="absolute"||position==="relative"||position==="fixed"){
value=parseInt(elem.css("zIndex"), 10);
if(!isNaN(value)&&value!==0){
return value;
}}
elem=elem.parent();
}
return 0;
}
function Datepicker(){
this._curInst=null;
this._keyEvent=false;
this._disabledInputs=[];
this._datepickerShowing=false;
this._inDialog=false;
this._mainDivId="ui-datepicker-div";
this._inlineClass="ui-datepicker-inline";
this._appendClass="ui-datepicker-append";
this._triggerClass="ui-datepicker-trigger";
this._dialogClass="ui-datepicker-dialog";
this._disableClass="ui-datepicker-disabled";
this._unselectableClass="ui-datepicker-unselectable";
this._currentClass="ui-datepicker-current-day";
this._dayOverClass="ui-datepicker-days-cell-over";
this.regional=[];
this.regional[ "" ]={
closeText: "Done",
prevText: "Prev",
nextText: "Next",
currentText: "Today",
monthNames: [ "January","February","March","April","May","June",
"July","August","September","October","November","December" ],
monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ],
dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ],
dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ],
dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ],
weekHeader: "Wk",
dateFormat: "mm/dd/yy",
firstDay: 0,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ""
};
this._defaults={
showOn: "focus", // "focus" for popup on focus,
showAnim: "fadeIn",
showOptions: {},
defaultDate: null,
appendText: "",
buttonText: "...",
buttonImage: "",
buttonImageOnly: false,
hideIfNoPrevNext: false,
navigationAsDateFormat: false,
gotoCurrent: false,
changeMonth: false,
changeYear: false,
yearRange: "c-10:c+10",
showOtherMonths: false,
selectOtherMonths: false,
showWeek: false,
calculateWeek: this.iso8601Week,
shortYearCutoff: "+10",
minDate: null,
maxDate: null,
duration: "fast",
beforeShowDay: null,
beforeShow: null,
onSelect: null,
onChangeMonthYear: null,
onClose: null,
numberOfMonths: 1,
showCurrentAtPos: 0,
stepMonths: 1,
stepBigMonths: 12,
altField: "",
altFormat: "",
constrainInput: true,
showButtonPanel: false,
autoSize: false,
disabled: false
};
$.extend(this._defaults, this.regional[ "" ]);
this.regional.en=$.extend(true, {}, this.regional[ "" ]);
this.regional[ "en-US" ]=$.extend(true, {}, this.regional.en);
this.dpDiv=datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>") );
}
$.extend(Datepicker.prototype, {
markerClassName: "hasDatepicker",
maxRows: 4,
_widgetDatepicker: function(){
return this.dpDiv;
},
setDefaults: function(settings){
datepicker_extendRemove(this._defaults, settings||{});
return this;
},
_attachDatepicker: function(target, settings){
var nodeName, inline, inst;
nodeName=target.nodeName.toLowerCase();
inline=(nodeName==="div"||nodeName==="span");
if(!target.id){
this.uuid +=1;
target.id="dp" + this.uuid;
}
inst=this._newInst($(target), inline);
inst.settings=$.extend({}, settings||{});
if(nodeName==="input"){
this._connectDatepicker(target, inst);
}else if(inline){
this._inlineDatepicker(target, inst);
}},
_newInst: function(target, inline){
var id=target[ 0 ].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1");
return { id: id, input: target,
selectedDay: 0, selectedMonth: 0, selectedYear: 0,
drawMonth: 0, drawYear: 0,
inline: inline,
dpDiv:(!inline ? this.dpDiv :
datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>") )) };},
_connectDatepicker: function(target, inst){
var input=$(target);
inst.append=$([]);
inst.trigger=$([]);
if(input.hasClass(this.markerClassName) ){
return;
}
this._attachments(input, inst);
input.addClass(this.markerClassName).on("keydown", this._doKeyDown).
on("keypress", this._doKeyPress).on("keyup", this._doKeyUp);
this._autoSize(inst);
$.data(target, "datepicker", inst);
if(inst.settings.disabled){
this._disableDatepicker(target);
}},
_attachments: function(input, inst){
var showOn, buttonText, buttonImage,
appendText=this._get(inst, "appendText"),
isRTL=this._get(inst, "isRTL");
if(inst.append){
inst.append.remove();
}
if(appendText){
inst.append=$("<span class='" + this._appendClass + "'>" + appendText + "</span>");
input[ isRTL ? "before":"after" ](inst.append);
}
input.off("focus", this._showDatepicker);
if(inst.trigger){
inst.trigger.remove();
}
showOn=this._get(inst, "showOn");
if(showOn==="focus"||showOn==="both"){
input.on("focus", this._showDatepicker);
}
if(showOn==="button"||showOn==="both"){
buttonText=this._get(inst, "buttonText");
buttonImage=this._get(inst, "buttonImage");
inst.trigger=$(this._get(inst, "buttonImageOnly") ?
$("<img/>").addClass(this._triggerClass).
attr( { src: buttonImage, alt: buttonText, title: buttonText }) :
$("<button type='button'></button>").addClass(this._triggerClass).
html(!buttonImage ? buttonText:$("<img/>").attr({ src:buttonImage, alt:buttonText, title:buttonText }) ));
input[ isRTL ? "before":"after" ](inst.trigger);
inst.trigger.on("click", function(){
if($.datepicker._datepickerShowing&&$.datepicker._lastInput===input[ 0 ]){
$.datepicker._hideDatepicker();
}else if($.datepicker._datepickerShowing&&$.datepicker._lastInput!==input[ 0 ]){
$.datepicker._hideDatepicker();
$.datepicker._showDatepicker(input[ 0 ]);
}else{
$.datepicker._showDatepicker(input[ 0 ]);
}
return false;
});
}},
_autoSize: function(inst){
if(this._get(inst, "autoSize")&&!inst.inline){
var findMax, max, maxI, i,
date=new Date(2009, 12 - 1, 20),
dateFormat=this._get(inst, "dateFormat");
if(dateFormat.match(/[DM]/) ){
findMax=function(names){
max=0;
maxI=0;
for(i=0; i < names.length; i++){
if(names[ i ].length > max){
max=names[ i ].length;
maxI=i;
}}
return maxI;
};
date.setMonth(findMax(this._get(inst,(dateFormat.match(/MM/) ?
"monthNames":"monthNamesShort") )) );
date.setDate(findMax(this._get(inst,(dateFormat.match(/DD/) ?
"dayNames":"dayNamesShort") )) + 20 - date.getDay());
}
inst.input.attr("size", this._formatDate(inst, date).length);
}},
_inlineDatepicker: function(target, inst){
var divSpan=$(target);
if(divSpan.hasClass(this.markerClassName) ){
return;
}
divSpan.addClass(this.markerClassName).append(inst.dpDiv);
$.data(target, "datepicker", inst);
this._setDate(inst, this._getDefaultDate(inst), true);
this._updateDatepicker(inst);
this._updateAlternate(inst);
if(inst.settings.disabled){
this._disableDatepicker(target);
}
inst.dpDiv.css("display", "block");
},
_dialogDatepicker: function(input, date, onSelect, settings, pos){
var id, browserWidth, browserHeight, scrollX, scrollY,
inst=this._dialogInst;
if(!inst){
this.uuid +=1;
id="dp" + this.uuid;
this._dialogInput=$("<input type='text' id='" + id +
"' style='position: absolute; top: -100px; width: 0px;'/>");
this._dialogInput.on("keydown", this._doKeyDown);
$("body").append(this._dialogInput);
inst=this._dialogInst=this._newInst(this._dialogInput, false);
inst.settings={};
$.data(this._dialogInput[ 0 ], "datepicker", inst);
}
datepicker_extendRemove(inst.settings, settings||{});
date=(date&&date.constructor===Date ? this._formatDate(inst, date):date);
this._dialogInput.val(date);
this._pos=(pos ?(pos.length ? pos:[ pos.pageX, pos.pageY ]):null);
if(!this._pos){
browserWidth=document.documentElement.clientWidth;
browserHeight=document.documentElement.clientHeight;
scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;
scrollY=document.documentElement.scrollTop||document.body.scrollTop;
this._pos =
[(browserWidth / 2) - 100 + scrollX,(browserHeight / 2) - 150 + scrollY ];
}
this._dialogInput.css("left",(this._pos[ 0 ] + 20) + "px").css("top", this._pos[ 1 ] + "px");
inst.settings.onSelect=onSelect;
this._inDialog=true;
this.dpDiv.addClass(this._dialogClass);
this._showDatepicker(this._dialogInput[ 0 ]);
if($.blockUI){
$.blockUI(this.dpDiv);
}
$.data(this._dialogInput[ 0 ], "datepicker", inst);
return this;
},
_destroyDatepicker: function(target){
var nodeName,
$target=$(target),
inst=$.data(target, "datepicker");
if(!$target.hasClass(this.markerClassName) ){
return;
}
nodeName=target.nodeName.toLowerCase();
$.removeData(target, "datepicker");
if(nodeName==="input"){
inst.append.remove();
inst.trigger.remove();
$target.removeClass(this.markerClassName).
off("focus", this._showDatepicker).
off("keydown", this._doKeyDown).
off("keypress", this._doKeyPress).
off("keyup", this._doKeyUp);
}else if(nodeName==="div"||nodeName==="span"){
$target.removeClass(this.markerClassName).empty();
}
if(datepicker_instActive===inst){
datepicker_instActive=null;
}},
_enableDatepicker: function(target){
var nodeName, inline,
$target=$(target),
inst=$.data(target, "datepicker");
if(!$target.hasClass(this.markerClassName) ){
return;
}
nodeName=target.nodeName.toLowerCase();
if(nodeName==="input"){
target.disabled=false;
inst.trigger.filter("button").
each(function(){ this.disabled=false; }).end().
filter("img").css({ opacity: "1.0", cursor: "" });
}else if(nodeName==="div"||nodeName==="span"){
inline=$target.children("." + this._inlineClass);
inline.children().removeClass("ui-state-disabled");
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
prop("disabled", false);
}
this._disabledInputs=$.map(this._disabledInputs,
function(value){ return(value===target ? null:value); });
},
_disableDatepicker: function(target){
var nodeName, inline,
$target=$(target),
inst=$.data(target, "datepicker");
if(!$target.hasClass(this.markerClassName) ){
return;
}
nodeName=target.nodeName.toLowerCase();
if(nodeName==="input"){
target.disabled=true;
inst.trigger.filter("button").
each(function(){ this.disabled=true; }).end().
filter("img").css({ opacity: "0.5", cursor: "default" });
}else if(nodeName==="div"||nodeName==="span"){
inline=$target.children("." + this._inlineClass);
inline.children().addClass("ui-state-disabled");
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
prop("disabled", true);
}
this._disabledInputs=$.map(this._disabledInputs,
function(value){ return(value===target ? null:value); });
this._disabledInputs[ this._disabledInputs.length ]=target;
},
_isDisabledDatepicker: function(target){
if(!target){
return false;
}
for(var i=0; i < this._disabledInputs.length; i++){
if(this._disabledInputs[ i ]===target){
return true;
}}
return false;
},
_getInst: function(target){
try {
return $.data(target, "datepicker");
}
catch(err){
throw "Missing instance data for this datepicker";
}},
_optionDatepicker: function(target, name, value){
var settings, date, minDate, maxDate,
inst=this._getInst(target);
if(arguments.length===2&&typeof name==="string"){
return(name==="defaults" ? $.extend({}, $.datepicker._defaults) :
(inst ?(name==="all" ? $.extend({}, inst.settings) :
this._get(inst, name) ):null) );
}
settings=name||{};
if(typeof name==="string"){
settings={};
settings[ name ]=value;
}
if(inst){
if(this._curInst===inst){
this._hideDatepicker();
}
date=this._getDateDatepicker(target, true);
minDate=this._getMinMaxDate(inst, "min");
maxDate=this._getMinMaxDate(inst, "max");
datepicker_extendRemove(inst.settings, settings);
if(minDate!==null&&settings.dateFormat!==undefined&&settings.minDate===undefined){
inst.settings.minDate=this._formatDate(inst, minDate);
}
if(maxDate!==null&&settings.dateFormat!==undefined&&settings.maxDate===undefined){
inst.settings.maxDate=this._formatDate(inst, maxDate);
}
if("disabled" in settings){
if(settings.disabled){
this._disableDatepicker(target);
}else{
this._enableDatepicker(target);
}}
this._attachments($(target), inst);
this._autoSize(inst);
this._setDate(inst, date);
this._updateAlternate(inst);
this._updateDatepicker(inst);
}},
_changeDatepicker: function(target, name, value){
this._optionDatepicker(target, name, value);
},
_refreshDatepicker: function(target){
var inst=this._getInst(target);
if(inst){
this._updateDatepicker(inst);
}},
_setDateDatepicker: function(target, date){
var inst=this._getInst(target);
if(inst){
this._setDate(inst, date);
this._updateDatepicker(inst);
this._updateAlternate(inst);
}},
_getDateDatepicker: function(target, noDefault){
var inst=this._getInst(target);
if(inst&&!inst.inline){
this._setDateFromField(inst, noDefault);
}
return(inst ? this._getDate(inst):null);
},
_doKeyDown: function(event){
var onSelect, dateStr, sel,
inst=$.datepicker._getInst(event.target),
handled=true,
isRTL=inst.dpDiv.is(".ui-datepicker-rtl");
inst._keyEvent=true;
if($.datepicker._datepickerShowing){
switch(event.keyCode){
case 9: $.datepicker._hideDatepicker();
handled=false;
break;
case 13: sel=$("td." + $.datepicker._dayOverClass + ":not(." +
$.datepicker._currentClass + ")", inst.dpDiv);
if(sel[ 0 ]){
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ]);
}
onSelect=$.datepicker._get(inst, "onSelect");
if(onSelect){
dateStr=$.datepicker._formatDate(inst);
onSelect.apply(( inst.input ? inst.input[ 0 ]:null), [ dateStr, inst ]);
}else{
$.datepicker._hideDatepicker();
}
return false;
case 27: $.datepicker._hideDatepicker();
break;
case 33: $.datepicker._adjustDate(event.target,(event.ctrlKey ?
-$.datepicker._get(inst, "stepBigMonths") :
-$.datepicker._get(inst, "stepMonths") ), "M");
break;
case 34: $.datepicker._adjustDate(event.target,(event.ctrlKey ?
+$.datepicker._get(inst, "stepBigMonths") :
+$.datepicker._get(inst, "stepMonths") ), "M");
break;
case 35: if(event.ctrlKey||event.metaKey){
$.datepicker._clearDate(event.target);
}
handled=event.ctrlKey||event.metaKey;
break;
case 36: if(event.ctrlKey||event.metaKey){
$.datepicker._gotoToday(event.target);
}
handled=event.ctrlKey||event.metaKey;
break;
case 37: if(event.ctrlKey||event.metaKey){
$.datepicker._adjustDate(event.target,(isRTL ? +1:-1), "D");
}
handled=event.ctrlKey||event.metaKey;
if(event.originalEvent.altKey){
$.datepicker._adjustDate(event.target,(event.ctrlKey ?
-$.datepicker._get(inst, "stepBigMonths") :
-$.datepicker._get(inst, "stepMonths") ), "M");
}
break;
case 38: if(event.ctrlKey||event.metaKey){
$.datepicker._adjustDate(event.target, -7, "D");
}
handled=event.ctrlKey||event.metaKey;
break;
case 39: if(event.ctrlKey||event.metaKey){
$.datepicker._adjustDate(event.target,(isRTL ? -1:+1), "D");
}
handled=event.ctrlKey||event.metaKey;
if(event.originalEvent.altKey){
$.datepicker._adjustDate(event.target,(event.ctrlKey ?
+$.datepicker._get(inst, "stepBigMonths") :
+$.datepicker._get(inst, "stepMonths") ), "M");
}
break;
case 40: if(event.ctrlKey||event.metaKey){
$.datepicker._adjustDate(event.target, +7, "D");
}
handled=event.ctrlKey||event.metaKey;
break;
default: handled=false;
}}else if(event.keyCode===36&&event.ctrlKey){
$.datepicker._showDatepicker(this);
}else{
handled=false;
}
if(handled){
event.preventDefault();
event.stopPropagation();
}},
_doKeyPress: function(event){
var chars, chr,
inst=$.datepicker._getInst(event.target);
if($.datepicker._get(inst, "constrainInput") ){
chars=$.datepicker._possibleChars($.datepicker._get(inst, "dateFormat") );
chr=String.fromCharCode(event.charCode==null ? event.keyCode:event.charCode);
return event.ctrlKey||event.metaKey||(chr < " "||!chars||chars.indexOf(chr) > -1);
}},
_doKeyUp: function(event){
var date,
inst=$.datepicker._getInst(event.target);
if(inst.input.val()!==inst.lastVal){
try {
date=$.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
(inst.input ? inst.input.val():null),
$.datepicker._getFormatConfig(inst) );
if(date){
$.datepicker._setDateFromField(inst);
$.datepicker._updateAlternate(inst);
$.datepicker._updateDatepicker(inst);
}}
catch(err){
}}
return true;
},
_showDatepicker: function(input){
input=input.target||input;
if(input.nodeName.toLowerCase()!=="input"){
input=$("input", input.parentNode)[ 0 ];
}
if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput===input){
return;
}
var inst, beforeShow, beforeShowSettings, isFixed,
offset, showAnim, duration;
inst=$.datepicker._getInst(input);
if($.datepicker._curInst&&$.datepicker._curInst!==inst){
$.datepicker._curInst.dpDiv.stop(true, true);
if(inst&&$.datepicker._datepickerShowing){
$.datepicker._hideDatepicker($.datepicker._curInst.input[ 0 ]);
}}
beforeShow=$.datepicker._get(inst, "beforeShow");
beforeShowSettings=beforeShow ? beforeShow.apply(input, [ input, inst ]):{};
if(beforeShowSettings===false){
return;
}
datepicker_extendRemove(inst.settings, beforeShowSettings);
inst.lastVal=null;
$.datepicker._lastInput=input;
$.datepicker._setDateFromField(inst);
if($.datepicker._inDialog){
input.value="";
}
if(!$.datepicker._pos){
$.datepicker._pos=$.datepicker._findPos(input);
$.datepicker._pos[ 1 ] +=input.offsetHeight;
}
isFixed=false;
$(input).parents().each(function(){
isFixed |=$(this).css("position")==="fixed";
return !isFixed;
});
offset={ left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] };
$.datepicker._pos=null;
inst.dpDiv.empty();
inst.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" });
$.datepicker._updateDatepicker(inst);
offset=$.datepicker._checkOffset(inst, offset, isFixed);
inst.dpDiv.css({ position:($.datepicker._inDialog&&$.blockUI ?
"static":(isFixed ? "fixed":"absolute") ), display: "none",
left: offset.left + "px", top: offset.top + "px" });
if(!inst.inline){
showAnim=$.datepicker._get(inst, "showAnim");
duration=$.datepicker._get(inst, "duration");
inst.dpDiv.css("z-index", datepicker_getZindex($(input) ) + 1);
$.datepicker._datepickerShowing=true;
if($.effects&&$.effects.effect[ showAnim ]){
inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
}else{
inst.dpDiv[ showAnim||"show" ](showAnim ? duration:null);
}
if($.datepicker._shouldFocusInput(inst) ){
inst.input.trigger("focus");
}
$.datepicker._curInst=inst;
}},
_updateDatepicker: function(inst){
this.maxRows=4;
datepicker_instActive=inst;
inst.dpDiv.empty().append(this._generateHTML(inst) );
this._attachHandlers(inst);
var origyearshtml,
numMonths=this._getNumberOfMonths(inst),
cols=numMonths[ 1 ],
width=17,
activeCell=inst.dpDiv.find("." + this._dayOverClass + " a");
if(activeCell.length > 0){
datepicker_handleMouseover.apply(activeCell.get(0) );
}
inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
if(cols > 1){
inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width",(width * cols) + "em");
}
inst.dpDiv[(numMonths[ 0 ]!==1||numMonths[ 1 ]!==1 ? "add":"remove") +
"Class" ]("ui-datepicker-multi");
inst.dpDiv[(this._get(inst, "isRTL") ? "add":"remove") +
"Class" ]("ui-datepicker-rtl");
if(inst===$.datepicker._curInst&&$.datepicker._datepickerShowing&&$.datepicker._shouldFocusInput(inst) ){
inst.input.trigger("focus");
}
if(inst.yearshtml){
origyearshtml=inst.yearshtml;
setTimeout(function(){
if(origyearshtml===inst.yearshtml&&inst.yearshtml){
inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
}
origyearshtml=inst.yearshtml=null;
}, 0);
}},
_shouldFocusInput: function(inst){
return inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")&&!inst.input.is(":focus");
},
_checkOffset: function(inst, offset, isFixed){
var dpWidth=inst.dpDiv.outerWidth(),
dpHeight=inst.dpDiv.outerHeight(),
inputWidth=inst.input ? inst.input.outerWidth():0,
inputHeight=inst.input ? inst.input.outerHeight():0,
viewWidth=document.documentElement.clientWidth +(isFixed ? 0:$(document).scrollLeft()),
viewHeight=document.documentElement.clientHeight +(isFixed ? 0:$(document).scrollTop());
offset.left -=(this._get(inst, "isRTL") ?(dpWidth - inputWidth):0);
offset.left -=(isFixed&&offset.left===inst.input.offset().left) ? $(document).scrollLeft():0;
offset.top -=(isFixed&&offset.top===(inst.input.offset().top + inputHeight) ) ? $(document).scrollTop():0;
offset.left -=Math.min(offset.left,(offset.left + dpWidth > viewWidth&&viewWidth > dpWidth) ?
Math.abs(offset.left + dpWidth - viewWidth):0);
offset.top -=Math.min(offset.top,(offset.top + dpHeight > viewHeight&&viewHeight > dpHeight) ?
Math.abs(dpHeight + inputHeight):0);
return offset;
},
_findPos: function(obj){
var position,
inst=this._getInst(obj),
isRTL=this._get(inst, "isRTL");
while(obj&&(obj.type==="hidden"||obj.nodeType!==1||$.expr.filters.hidden(obj) )){
obj=obj[ isRTL ? "previousSibling":"nextSibling" ];
}
position=$(obj).offset();
return [ position.left, position.top ];
},
_hideDatepicker: function(input){
var showAnim, duration, postProcess, onClose,
inst=this._curInst;
if(!inst||(input&&inst!==$.data(input, "datepicker") )){
return;
}
if(this._datepickerShowing){
showAnim=this._get(inst, "showAnim");
duration=this._get(inst, "duration");
postProcess=function(){
$.datepicker._tidyDialog(inst);
};
if($.effects&&($.effects.effect[ showAnim ]||$.effects[ showAnim ]) ){
inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
}else{
inst.dpDiv[(showAnim==="slideDown" ? "slideUp" :
(showAnim==="fadeIn" ? "fadeOut":"hide") ) ](( showAnim ? duration:null), postProcess);
}
if(!showAnim){
postProcess();
}
this._datepickerShowing=false;
onClose=this._get(inst, "onClose");
if(onClose){
onClose.apply(( inst.input ? inst.input[ 0 ]:null), [(inst.input ? inst.input.val():""), inst ]);
}
this._lastInput=null;
if(this._inDialog){
this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" });
if($.blockUI){
$.unblockUI();
$("body").append(this.dpDiv);
}}
this._inDialog=false;
}},
_tidyDialog: function(inst){
inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar");
},
_checkExternalClick: function(event){
if(!$.datepicker._curInst){
return;
}
var $target=$(event.target),
inst=$.datepicker._getInst($target[ 0 ]);
if((($target[ 0 ].id!==$.datepicker._mainDivId &&
$target.parents("#" + $.datepicker._mainDivId).length===0 &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.closest("." + $.datepicker._triggerClass).length &&
$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI) )) ||
($target.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!==inst) ){
$.datepicker._hideDatepicker();
}},
_adjustDate: function(id, offset, period){
var target=$(id),
inst=this._getInst(target[ 0 ]);
if(this._isDisabledDatepicker(target[ 0 ]) ){
return;
}
this._adjustInstDate(inst, offset +
(period==="M" ? this._get(inst, "showCurrentAtPos"):0),
period);
this._updateDatepicker(inst);
},
_gotoToday: function(id){
var date,
target=$(id),
inst=this._getInst(target[ 0 ]);
if(this._get(inst, "gotoCurrent")&&inst.currentDay){
inst.selectedDay=inst.currentDay;
inst.drawMonth=inst.selectedMonth=inst.currentMonth;
inst.drawYear=inst.selectedYear=inst.currentYear;
}else{
date=new Date();
inst.selectedDay=date.getDate();
inst.drawMonth=inst.selectedMonth=date.getMonth();
inst.drawYear=inst.selectedYear=date.getFullYear();
}
this._notifyChange(inst);
this._adjustDate(target);
},
_selectMonthYear: function(id, select, period){
var target=$(id),
inst=this._getInst(target[ 0 ]);
inst[ "selected" +(period==="M" ? "Month":"Year") ] =
inst[ "draw" +(period==="M" ? "Month":"Year") ] =
parseInt(select.options[ select.selectedIndex ].value, 10);
this._notifyChange(inst);
this._adjustDate(target);
},
_selectDay: function(id, month, year, td){
var inst,
target=$(id);
if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[ 0 ]) ){
return;
}
inst=this._getInst(target[ 0 ]);
inst.selectedDay=inst.currentDay=$("a", td).html();
inst.selectedMonth=inst.currentMonth=month;
inst.selectedYear=inst.currentYear=year;
this._selectDate(id, this._formatDate(inst,
inst.currentDay, inst.currentMonth, inst.currentYear) );
},
_clearDate: function(id){
var target=$(id);
this._selectDate(target, "");
},
_selectDate: function(id, dateStr){
var onSelect,
target=$(id),
inst=this._getInst(target[ 0 ]);
dateStr=(dateStr!=null ? dateStr:this._formatDate(inst) );
if(inst.input){
inst.input.val(dateStr);
}
this._updateAlternate(inst);
onSelect=this._get(inst, "onSelect");
if(onSelect){
onSelect.apply(( inst.input ? inst.input[ 0 ]:null), [ dateStr, inst ]);
}else if(inst.input){
inst.input.trigger("change");
}
if(inst.inline){
this._updateDatepicker(inst);
}else{
this._hideDatepicker();
this._lastInput=inst.input[ 0 ];
if(typeof(inst.input[ 0 ])!=="object"){
inst.input.trigger("focus");
}
this._lastInput=null;
}},
_updateAlternate: function(inst){
var altFormat, date, dateStr,
altField=this._get(inst, "altField");
if(altField){
altFormat=this._get(inst, "altFormat")||this._get(inst, "dateFormat");
date=this._getDate(inst);
dateStr=this.formatDate(altFormat, date, this._getFormatConfig(inst) );
$(altField).val(dateStr);
}},
noWeekends: function(date){
var day=date.getDay();
return [(day > 0&&day < 6), "" ];
},
iso8601Week: function(date){
var time,
checkDate=new Date(date.getTime());
checkDate.setDate(checkDate.getDate() + 4 -(checkDate.getDay()||7) );
time=checkDate.getTime();
checkDate.setMonth(0);
checkDate.setDate(1);
return Math.floor(Math.round(( time - checkDate) / 86400000) / 7) + 1;
},
parseDate: function(format, value, settings){
if(format==null||value==null){
throw "Invalid arguments";
}
value=(typeof value==="object" ? value.toString():value + "");
if(value===""){
return null;
}
var iFormat, dim, extra,
iValue=0,
shortYearCutoffTemp=(settings ? settings.shortYearCutoff:null)||this._defaults.shortYearCutoff,
shortYearCutoff=(typeof shortYearCutoffTemp!=="string" ? shortYearCutoffTemp :
new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10) ),
dayNamesShort=(settings ? settings.dayNamesShort:null)||this._defaults.dayNamesShort,
dayNames=(settings ? settings.dayNames:null)||this._defaults.dayNames,
monthNamesShort=(settings ? settings.monthNamesShort:null)||this._defaults.monthNamesShort,
monthNames=(settings ? settings.monthNames:null)||this._defaults.monthNames,
year=-1,
month=-1,
day=-1,
doy=-1,
literal=false,
date,
lookAhead=function(match){
var matches=(iFormat + 1 < format.length&&format.charAt(iFormat + 1)===match);
if(matches){
iFormat++;
}
return matches;
},
getNumber=function(match){
var isDoubled=lookAhead(match),
size=(match==="@" ? 14:(match==="!" ? 20 :
(match==="y"&&isDoubled ? 4:(match==="o" ? 3:2) )) ),
minSize=(match==="y" ? size:1),
digits=new RegExp("^\\d{" + minSize + "," + size + "}"),
num=value.substring(iValue).match(digits);
if(!num){
throw "Missing number at position " + iValue;
}
iValue +=num[ 0 ].length;
return parseInt(num[ 0 ], 10);
},
getName=function(match, shortNames, longNames){
var index=-1,
names=$.map(lookAhead(match) ? longNames:shortNames, function(v, k){
return [ [ k, v ] ];
}).sort(function(a, b){
return -(a[ 1 ].length - b[ 1 ].length);
});
$.each(names, function(i, pair){
var name=pair[ 1 ];
if(value.substr(iValue, name.length).toLowerCase()===name.toLowerCase()){
index=pair[ 0 ];
iValue +=name.length;
return false;
}});
if(index!==-1){
return index + 1;
}else{
throw "Unknown name at position " + iValue;
}},
checkLiteral=function(){
if(value.charAt(iValue)!==format.charAt(iFormat) ){
throw "Unexpected literal at position " + iValue;
}
iValue++;
};
for(iFormat=0; iFormat < format.length; iFormat++){
if(literal){
if(format.charAt(iFormat)==="'"&&!lookAhead("'") ){
literal=false;
}else{
checkLiteral();
}}else{
switch(format.charAt(iFormat) ){
case "d":
day=getNumber("d");
break;
case "D":
getName("D", dayNamesShort, dayNames);
break;
case "o":
doy=getNumber("o");
break;
case "m":
month=getNumber("m");
break;
case "M":
month=getName("M", monthNamesShort, monthNames);
break;
case "y":
year=getNumber("y");
break;
case "@":
date=new Date(getNumber("@") );
year=date.getFullYear();
month=date.getMonth() + 1;
day=date.getDate();
break;
case "!":
date=new Date(( getNumber("!") - this._ticksTo1970) / 10000);
year=date.getFullYear();
month=date.getMonth() + 1;
day=date.getDate();
break;
case "'":
if(lookAhead("'") ){
checkLiteral();
}else{
literal=true;
}
break;
default:
checkLiteral();
}}
}
if(iValue < value.length){
extra=value.substr(iValue);
if(!/^\s+/.test(extra) ){
throw "Extra/unparsed characters found in date: " + extra;
}}
if(year===-1){
year=new Date().getFullYear();
}else if(year < 100){
year +=new Date().getFullYear() - new Date().getFullYear() % 100 +
(year <=shortYearCutoff ? 0:-100);
}
if(doy > -1){
month=1;
day=doy;
do {
dim=this._getDaysInMonth(year, month - 1);
if(day <=dim){
break;
}
month++;
day -=dim;
} while(true);
}
date=this._daylightSavingAdjust(new Date(year, month - 1, day) );
if(date.getFullYear()!==year||date.getMonth() + 1!==month||date.getDate()!==day){
throw "Invalid date";
}
return date;
},
ATOM: "yy-mm-dd",
COOKIE: "D, dd M yy",
ISO_8601: "yy-mm-dd",
RFC_822: "D, d M y",
RFC_850: "DD, dd-M-y",
RFC_1036: "D, d M y",
RFC_1123: "D, d M yy",
RFC_2822: "D, d M yy",
RSS: "D, d M y",
TICKS: "!",
TIMESTAMP: "@",
W3C: "yy-mm-dd",
_ticksTo1970:(((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
Math.floor(1970 / 400) ) * 24 * 60 * 60 * 10000000),
formatDate: function(format, date, settings){
if(!date){
return "";
}
var iFormat,
dayNamesShort=(settings ? settings.dayNamesShort:null)||this._defaults.dayNamesShort,
dayNames=(settings ? settings.dayNames:null)||this._defaults.dayNames,
monthNamesShort=(settings ? settings.monthNamesShort:null)||this._defaults.monthNamesShort,
monthNames=(settings ? settings.monthNames:null)||this._defaults.monthNames,
lookAhead=function(match){
var matches=(iFormat + 1 < format.length&&format.charAt(iFormat + 1)===match);
if(matches){
iFormat++;
}
return matches;
},
formatNumber=function(match, value, len){
var num="" + value;
if(lookAhead(match) ){
while(num.length < len){
num="0" + num;
}}
return num;
},
formatName=function(match, value, shortNames, longNames){
return(lookAhead(match) ? longNames[ value ]:shortNames[ value ]);
},
output="",
literal=false;
if(date){
for(iFormat=0; iFormat < format.length; iFormat++){
if(literal){
if(format.charAt(iFormat)==="'"&&!lookAhead("'") ){
literal=false;
}else{
output +=format.charAt(iFormat);
}}else{
switch(format.charAt(iFormat) ){
case "d":
output +=formatNumber("d", date.getDate(), 2);
break;
case "D":
output +=formatName("D", date.getDay(), dayNamesShort, dayNames);
break;
case "o":
output +=formatNumber("o",
Math.round(( new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
break;
case "m":
output +=formatNumber("m", date.getMonth() + 1, 2);
break;
case "M":
output +=formatName("M", date.getMonth(), monthNamesShort, monthNames);
break;
case "y":
output +=(lookAhead("y") ? date.getFullYear() :
(date.getFullYear() % 100 < 10 ? "0":"") + date.getFullYear() % 100);
break;
case "@":
output +=date.getTime();
break;
case "!":
output +=date.getTime() * 10000 + this._ticksTo1970;
break;
case "'":
if(lookAhead("'") ){
output +="'";
}else{
literal=true;
}
break;
default:
output +=format.charAt(iFormat);
}}
}}
return output;
},
_possibleChars: function(format){
var iFormat,
chars="",
literal=false,
lookAhead=function(match){
var matches=(iFormat + 1 < format.length&&format.charAt(iFormat + 1)===match);
if(matches){
iFormat++;
}
return matches;
};
for(iFormat=0; iFormat < format.length; iFormat++){
if(literal){
if(format.charAt(iFormat)==="'"&&!lookAhead("'") ){
literal=false;
}else{
chars +=format.charAt(iFormat);
}}else{
switch(format.charAt(iFormat) ){
case "d": case "m": case "y": case "@":
chars +="0123456789";
break;
case "D": case "M":
return null;
case "'":
if(lookAhead("'") ){
chars +="'";
}else{
literal=true;
}
break;
default:
chars +=format.charAt(iFormat);
}}
}
return chars;
},
_get: function(inst, name){
return inst.settings[ name ]!==undefined ?
inst.settings[ name ]:this._defaults[ name ];
},
_setDateFromField: function(inst, noDefault){
if(inst.input.val()===inst.lastVal){
return;
}
var dateFormat=this._get(inst, "dateFormat"),
dates=inst.lastVal=inst.input ? inst.input.val():null,
defaultDate=this._getDefaultDate(inst),
date=defaultDate,
settings=this._getFormatConfig(inst);
try {
date=this.parseDate(dateFormat, dates, settings)||defaultDate;
} catch(event){
dates=(noDefault ? "":dates);
}
inst.selectedDay=date.getDate();
inst.drawMonth=inst.selectedMonth=date.getMonth();
inst.drawYear=inst.selectedYear=date.getFullYear();
inst.currentDay=(dates ? date.getDate():0);
inst.currentMonth=(dates ? date.getMonth():0);
inst.currentYear=(dates ? date.getFullYear():0);
this._adjustInstDate(inst);
},
_getDefaultDate: function(inst){
return this._restrictMinMax(inst,
this._determineDate(inst, this._get(inst, "defaultDate"), new Date()) );
},
_determineDate: function(inst, date, defaultDate){
var offsetNumeric=function(offset){
var date=new Date();
date.setDate(date.getDate() + offset);
return date;
},
offsetString=function(offset){
try {
return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
offset, $.datepicker._getFormatConfig(inst) );
}
catch(e){
}
var date=(offset.toLowerCase().match(/^c/) ?
$.datepicker._getDate(inst):null)||new Date(),
year=date.getFullYear(),
month=date.getMonth(),
day=date.getDate(),
pattern=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
matches=pattern.exec(offset);
while(matches){
switch(matches[ 2 ]||"d"){
case "d":case "D" :
day +=parseInt(matches[ 1 ], 10); break;
case "w":case "W" :
day +=parseInt(matches[ 1 ], 10) * 7; break;
case "m":case "M" :
month +=parseInt(matches[ 1 ], 10);
day=Math.min(day, $.datepicker._getDaysInMonth(year, month) );
break;
case "y": case "Y" :
year +=parseInt(matches[ 1 ], 10);
day=Math.min(day, $.datepicker._getDaysInMonth(year, month) );
break;
}
matches=pattern.exec(offset);
}
return new Date(year, month, day);
},
newDate=(date==null||date==="" ? defaultDate:(typeof date==="string" ? offsetString(date) :
(typeof date==="number" ?(isNaN(date) ? defaultDate:offsetNumeric(date) ):new Date(date.getTime()) )) );
newDate=(newDate&&newDate.toString()==="Invalid Date" ? defaultDate:newDate);
if(newDate){
newDate.setHours(0);
newDate.setMinutes(0);
newDate.setSeconds(0);
newDate.setMilliseconds(0);
}
return this._daylightSavingAdjust(newDate);
},
_daylightSavingAdjust: function(date){
if(!date){
return null;
}
date.setHours(date.getHours() > 12 ? date.getHours() + 2:0);
return date;
},
_setDate: function(inst, date, noChange){
var clear = !date,
origMonth=inst.selectedMonth,
origYear=inst.selectedYear,
newDate=this._restrictMinMax(inst, this._determineDate(inst, date, new Date()) );
inst.selectedDay=inst.currentDay=newDate.getDate();
inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth();
inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear();
if(( origMonth!==inst.selectedMonth||origYear!==inst.selectedYear)&&!noChange){
this._notifyChange(inst);
}
this._adjustInstDate(inst);
if(inst.input){
inst.input.val(clear ? "":this._formatDate(inst) );
}},
_getDate: function(inst){
var startDate=(!inst.currentYear||(inst.input&&inst.input.val()==="") ? null :
this._daylightSavingAdjust(new Date(
inst.currentYear, inst.currentMonth, inst.currentDay) ));
return startDate;
},
_attachHandlers: function(inst){
var stepMonths=this._get(inst, "stepMonths"),
id="#" + inst.id.replace(/\\\\/g, "\\");
inst.dpDiv.find("[data-handler]").map(function(){
var handler={
prev: function(){
$.datepicker._adjustDate(id, -stepMonths, "M");
},
next: function(){
$.datepicker._adjustDate(id, +stepMonths, "M");
},
hide: function(){
$.datepicker._hideDatepicker();
},
today: function(){
$.datepicker._gotoToday(id);
},
selectDay: function(){
$.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
return false;
},
selectMonth: function(){
$.datepicker._selectMonthYear(id, this, "M");
return false;
},
selectYear: function(){
$.datepicker._selectMonthYear(id, this, "Y");
return false;
}};
$(this).on(this.getAttribute("data-event"), handler[ this.getAttribute("data-handler") ]);
});
},
_generateHTML: function(inst){
var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
printDate, dRow, tbody, daySettings, otherMonth, unselectable,
tempDate=new Date(),
today=this._daylightSavingAdjust(new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate()) ),
isRTL=this._get(inst, "isRTL"),
showButtonPanel=this._get(inst, "showButtonPanel"),
hideIfNoPrevNext=this._get(inst, "hideIfNoPrevNext"),
navigationAsDateFormat=this._get(inst, "navigationAsDateFormat"),
numMonths=this._getNumberOfMonths(inst),
showCurrentAtPos=this._get(inst, "showCurrentAtPos"),
stepMonths=this._get(inst, "stepMonths"),
isMultiMonth=(numMonths[ 0 ]!==1||numMonths[ 1 ]!==1),
currentDate=this._daylightSavingAdjust(( !inst.currentDay ? new Date(9999, 9, 9) :
new Date(inst.currentYear, inst.currentMonth, inst.currentDay) )),
minDate=this._getMinMaxDate(inst, "min"),
maxDate=this._getMinMaxDate(inst, "max"),
drawMonth=inst.drawMonth - showCurrentAtPos,
drawYear=inst.drawYear;
if(drawMonth < 0){
drawMonth +=12;
drawYear--;
}
if(maxDate){
maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
maxDate.getMonth() -(numMonths[ 0 ] * numMonths[ 1 ]) + 1, maxDate.getDate()) );
maxDraw=(minDate&&maxDraw < minDate ? minDate:maxDraw);
while(this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1) ) > maxDraw){
drawMonth--;
if(drawMonth < 0){
drawMonth=11;
drawYear--;
}}
}
inst.drawMonth=drawMonth;
inst.drawYear=drawYear;
prevText=this._get(inst, "prevText");
prevText=(!navigationAsDateFormat ? prevText:this.formatDate(prevText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1) ),
this._getFormatConfig(inst) ));
prev=(this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
" title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" +(isRTL ? "e":"w") + "'>" + prevText + "</span></a>" :
(hideIfNoPrevNext ? "":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" +(isRTL ? "e":"w") + "'>" + prevText + "</span></a>") );
nextText=this._get(inst, "nextText");
nextText=(!navigationAsDateFormat ? nextText:this.formatDate(nextText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1) ),
this._getFormatConfig(inst) ));
next=(this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
" title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" +(isRTL ? "w":"e") + "'>" + nextText + "</span></a>" :
(hideIfNoPrevNext ? "":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" +(isRTL ? "w":"e") + "'>" + nextText + "</span></a>") );
currentText=this._get(inst, "currentText");
gotoDate=(this._get(inst, "gotoCurrent")&&inst.currentDay ? currentDate:today);
currentText=(!navigationAsDateFormat ? currentText :
this.formatDate(currentText, gotoDate, this._getFormatConfig(inst) ));
controls=(!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
this._get(inst, "closeText") + "</button>":"");
buttonPanel=(showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" +(isRTL ? controls:"") +
(this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
">" + currentText + "</button>":"") +(isRTL ? "":controls) + "</div>":"";
firstDay=parseInt(this._get(inst, "firstDay"), 10);
firstDay=(isNaN(firstDay) ? 0:firstDay);
showWeek=this._get(inst, "showWeek");
dayNames=this._get(inst, "dayNames");
dayNamesMin=this._get(inst, "dayNamesMin");
monthNames=this._get(inst, "monthNames");
monthNamesShort=this._get(inst, "monthNamesShort");
beforeShowDay=this._get(inst, "beforeShowDay");
showOtherMonths=this._get(inst, "showOtherMonths");
selectOtherMonths=this._get(inst, "selectOtherMonths");
defaultDate=this._getDefaultDate(inst);
html="";
for(row=0; row < numMonths[ 0 ]; row++){
group="";
this.maxRows=4;
for(col=0; col < numMonths[ 1 ]; col++){
selectedDate=this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay) );
cornerClass=" ui-corner-all";
calender="";
if(isMultiMonth){
calender +="<div class='ui-datepicker-group";
if(numMonths[ 1 ] > 1){
switch(col){
case 0: calender +=" ui-datepicker-group-first";
cornerClass=" ui-corner-" +(isRTL ? "right":"left"); break;
case numMonths[ 1 ] - 1: calender +=" ui-datepicker-group-last";
cornerClass=" ui-corner-" +(isRTL ? "left":"right"); break;
default: calender +=" ui-datepicker-group-middle"; cornerClass=""; break;
}}
calender +="'>";
}
calender +="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
(/all|left/.test(cornerClass)&&row===0 ?(isRTL ? next:prev):"") +
(/all|right/.test(cornerClass)&&row===0 ?(isRTL ? prev:next):"") +
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
row > 0||col > 0, monthNames, monthNamesShort) +
"</div><table class='ui-datepicker-calendar'><thead>" +
"<tr>";
thead=(showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>":"");
for(dow=0; dow < 7; dow++){
day=(dow + firstDay) % 7;
thead +="<th scope='col'" +(( dow + firstDay + 6) % 7 >=5 ? " class='ui-datepicker-week-end'":"") + ">" +
"<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>";
}
calender +=thead + "</tr></thead><tbody>";
daysInMonth=this._getDaysInMonth(drawYear, drawMonth);
if(drawYear===inst.selectedYear&&drawMonth===inst.selectedMonth){
inst.selectedDay=Math.min(inst.selectedDay, daysInMonth);
}
leadDays=(this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
curRows=Math.ceil(( leadDays + daysInMonth) / 7);
numRows=(isMultiMonth ? this.maxRows > curRows ? this.maxRows:curRows:curRows);
this.maxRows=numRows;
printDate=this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays) );
for(dRow=0; dRow < numRows; dRow++){
calender +="<tr>";
tbody=(!showWeek ? "":"<td class='ui-datepicker-week-col'>" +
this._get(inst, "calculateWeek")(printDate) + "</td>");
for(dow=0; dow < 7; dow++){
daySettings=(beforeShowDay ?
beforeShowDay.apply(( inst.input ? inst.input[ 0 ]:null), [ printDate ]):[ true, "" ]);
otherMonth=(printDate.getMonth()!==drawMonth);
unselectable=(otherMonth&&!selectOtherMonths)||!daySettings[ 0 ] ||
(minDate&&printDate < minDate)||(maxDate&&printDate > maxDate);
tbody +="<td class='" +
(( dow + firstDay + 6) % 7 >=5 ? " ui-datepicker-week-end":"") +
(otherMonth ? " ui-datepicker-other-month":"") +
(( printDate.getTime()===selectedDate.getTime()&&drawMonth===inst.selectedMonth&&inst._keyEvent) ||
(defaultDate.getTime()===printDate.getTime()&&defaultDate.getTime()===selectedDate.getTime()) ?
" " + this._dayOverClass:"") +
(unselectable ? " " + this._unselectableClass + " ui-state-disabled":"") +
(otherMonth&&!showOtherMonths ? "":" " + daySettings[ 1 ] +
(printDate.getTime()===currentDate.getTime() ? " " + this._currentClass:"") +
(printDate.getTime()===today.getTime() ? " ui-datepicker-today":"") ) + "'" +
(( !otherMonth||showOtherMonths)&&daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace(/'/g, "&#39;") + "'":"") +
(unselectable ? "":" data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" +
(otherMonth&&!showOtherMonths ? "&#xa0;" :
(unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>":"<a class='ui-state-default" +
(printDate.getTime()===today.getTime() ? " ui-state-highlight":"") +
(printDate.getTime()===currentDate.getTime() ? " ui-state-active":"") +
(otherMonth ? " ui-priority-secondary":"") +
"' href='#'>" + printDate.getDate() + "</a>") ) + "</td>";
printDate.setDate(printDate.getDate() + 1);
printDate=this._daylightSavingAdjust(printDate);
}
calender +=tbody + "</tr>";
}
drawMonth++;
if(drawMonth > 11){
drawMonth=0;
drawYear++;
}
calender +="</tbody></table>" +(isMultiMonth ? "</div>" +
(( numMonths[ 0 ] > 0&&col===numMonths[ 1 ] - 1) ? "<div class='ui-datepicker-row-break'></div>":""):"");
group +=calender;
}
html +=group;
}
html +=buttonPanel;
inst._keyEvent=false;
return html;
},
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
secondary, monthNames, monthNamesShort){
var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
changeMonth=this._get(inst, "changeMonth"),
changeYear=this._get(inst, "changeYear"),
showMonthAfterYear=this._get(inst, "showMonthAfterYear"),
html="<div class='ui-datepicker-title'>",
monthHtml="";
if(secondary||!changeMonth){
monthHtml +="<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>";
}else{
inMinYear=(minDate&&minDate.getFullYear()===drawYear);
inMaxYear=(maxDate&&maxDate.getFullYear()===drawYear);
monthHtml +="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
for(month=0; month < 12; month++){
if(( !inMinYear||month >=minDate.getMonth())&&(!inMaxYear||month <=maxDate.getMonth()) ){
monthHtml +="<option value='" + month + "'" +
(month===drawMonth ? " selected='selected'":"") +
">" + monthNamesShort[ month ] + "</option>";
}}
monthHtml +="</select>";
}
if(!showMonthAfterYear){
html +=monthHtml +(secondary||!(changeMonth&&changeYear) ? "&#xa0;":"");
}
if(!inst.yearshtml){
inst.yearshtml="";
if(secondary||!changeYear){
html +="<span class='ui-datepicker-year'>" + drawYear + "</span>";
}else{
years=this._get(inst, "yearRange").split(":");
thisYear=new Date().getFullYear();
determineYear=function(value){
var year=(value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
(value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
parseInt(value, 10) ));
return(isNaN(year) ? thisYear:year);
};
year=determineYear(years[ 0 ]);
endYear=Math.max(year, determineYear(years[ 1 ]||"") );
year=(minDate ? Math.max(year, minDate.getFullYear()):year);
endYear=(maxDate ? Math.min(endYear, maxDate.getFullYear()):endYear);
inst.yearshtml +="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
for(; year <=endYear; year++){
inst.yearshtml +="<option value='" + year + "'" +
(year===drawYear ? " selected='selected'":"") +
">" + year + "</option>";
}
inst.yearshtml +="</select>";
html +=inst.yearshtml;
inst.yearshtml=null;
}}
html +=this._get(inst, "yearSuffix");
if(showMonthAfterYear){
html +=(secondary||!(changeMonth&&changeYear) ? "&#xa0;":"") + monthHtml;
}
html +="</div>";
return html;
},
_adjustInstDate: function(inst, offset, period){
var year=inst.selectedYear +(period==="Y" ? offset:0),
month=inst.selectedMonth +(period==="M" ? offset:0),
day=Math.min(inst.selectedDay, this._getDaysInMonth(year, month) ) +(period==="D" ? offset:0),
date=this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day) ));
inst.selectedDay=date.getDate();
inst.drawMonth=inst.selectedMonth=date.getMonth();
inst.drawYear=inst.selectedYear=date.getFullYear();
if(period==="M"||period==="Y"){
this._notifyChange(inst);
}},
_restrictMinMax: function(inst, date){
var minDate=this._getMinMaxDate(inst, "min"),
maxDate=this._getMinMaxDate(inst, "max"),
newDate=(minDate&&date < minDate ? minDate:date);
return(maxDate&&newDate > maxDate ? maxDate:newDate);
},
_notifyChange: function(inst){
var onChange=this._get(inst, "onChangeMonthYear");
if(onChange){
onChange.apply(( inst.input ? inst.input[ 0 ]:null),
[ inst.selectedYear, inst.selectedMonth + 1, inst ]);
}},
_getNumberOfMonths: function(inst){
var numMonths=this._get(inst, "numberOfMonths");
return(numMonths==null ? [ 1, 1 ]:(typeof numMonths==="number" ? [ 1, numMonths ]:numMonths) );
},
_getMinMaxDate: function(inst, minMax){
return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
},
_getDaysInMonth: function(year, month){
return 32 - this._daylightSavingAdjust(new Date(year, month, 32) ).getDate();
},
_getFirstDayOfMonth: function(year, month){
return new Date(year, month, 1).getDay();
},
_canAdjustMonth: function(inst, offset, curYear, curMonth){
var numMonths=this._getNumberOfMonths(inst),
date=this._daylightSavingAdjust(new Date(curYear,
curMonth +(offset < 0 ? offset:numMonths[ 0 ] * numMonths[ 1 ]), 1) );
if(offset < 0){
date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()) );
}
return this._isInRange(inst, date);
},
_isInRange: function(inst, date){
var yearSplit, currentYear,
minDate=this._getMinMaxDate(inst, "min"),
maxDate=this._getMinMaxDate(inst, "max"),
minYear=null,
maxYear=null,
years=this._get(inst, "yearRange");
if(years){
yearSplit=years.split(":");
currentYear=new Date().getFullYear();
minYear=parseInt(yearSplit[ 0 ], 10);
maxYear=parseInt(yearSplit[ 1 ], 10);
if(yearSplit[ 0 ].match(/[+\-].*/) ){
minYear +=currentYear;
}
if(yearSplit[ 1 ].match(/[+\-].*/) ){
maxYear +=currentYear;
}}
return(( !minDate||date.getTime() >=minDate.getTime()) &&
(!maxDate||date.getTime() <=maxDate.getTime()) &&
(!minYear||date.getFullYear() >=minYear) &&
(!maxYear||date.getFullYear() <=maxYear) );
},
_getFormatConfig: function(inst){
var shortYearCutoff=this._get(inst, "shortYearCutoff");
shortYearCutoff=(typeof shortYearCutoff!=="string" ? shortYearCutoff :
new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10) );
return { shortYearCutoff: shortYearCutoff,
dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames") };},
_formatDate: function(inst, day, month, year){
if(!day){
inst.currentDay=inst.selectedDay;
inst.currentMonth=inst.selectedMonth;
inst.currentYear=inst.selectedYear;
}
var date=(day ?(typeof day==="object" ? day :
this._daylightSavingAdjust(new Date(year, month, day) )) :
this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay) ));
return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst) );
}});
function datepicker_bindHover(dpDiv){
var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
return dpDiv.on("mouseout", selector, function(){
$(this).removeClass("ui-state-hover");
if(this.className.indexOf("ui-datepicker-prev")!==-1){
$(this).removeClass("ui-datepicker-prev-hover");
}
if(this.className.indexOf("ui-datepicker-next")!==-1){
$(this).removeClass("ui-datepicker-next-hover");
}})
.on("mouseover", selector, datepicker_handleMouseover);
}
function datepicker_handleMouseover(){
if(!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ]:datepicker_instActive.input[ 0 ]) ){
$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
$(this).addClass("ui-state-hover");
if(this.className.indexOf("ui-datepicker-prev")!==-1){
$(this).addClass("ui-datepicker-prev-hover");
}
if(this.className.indexOf("ui-datepicker-next")!==-1){
$(this).addClass("ui-datepicker-next-hover");
}}
}
function datepicker_extendRemove(target, props){
$.extend(target, props);
for(var name in props){
if(props[ name ]==null){
target[ name ]=props[ name ];
}}
return target;
}
$.fn.datepicker=function(options){
if(!this.length){
return this;
}
if(!$.datepicker.initialized){
$(document).on("mousedown", $.datepicker._checkExternalClick);
$.datepicker.initialized=true;
}
if($("#" + $.datepicker._mainDivId).length===0){
$("body").append($.datepicker.dpDiv);
}
var otherArgs=Array.prototype.slice.call(arguments, 1);
if(typeof options==="string"&&(options==="isDisabled"||options==="getDate"||options==="widget") ){
return $.datepicker[ "_" + options + "Datepicker" ].
apply($.datepicker, [ this[ 0 ] ].concat(otherArgs) );
}
if(options==="option"&&arguments.length===2&&typeof arguments[ 1 ]==="string"){
return $.datepicker[ "_" + options + "Datepicker" ].
apply($.datepicker, [ this[ 0 ] ].concat(otherArgs) );
}
return this.each(function(){
typeof options==="string" ?
$.datepicker[ "_" + options + "Datepicker" ].
apply($.datepicker, [ this ].concat(otherArgs) ) :
$.datepicker._attachDatepicker(this, options);
});
};
$.datepicker=new Datepicker();
$.datepicker.initialized=false;
$.datepicker.uuid=new Date().getTime();
$.datepicker.version="1.12.0";
var widgetsDatepicker=$.datepicker;
var ie=$.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
var mouseHandled=false;
$(document).on("mouseup", function(){
mouseHandled=false;
});
var widgetsMouse=$.widget("ui.mouse", {
version: "1.12.0",
options: {
cancel: "input, textarea, button, select, option",
distance: 1,
delay: 0
},
_mouseInit: function(){
var that=this;
this.element
.on("mousedown." + this.widgetName, function(event){
return that._mouseDown(event);
})
.on("click." + this.widgetName, function(event){
if(true===$.data(event.target, that.widgetName + ".preventClickEvent") ){
$.removeData(event.target, that.widgetName + ".preventClickEvent");
event.stopImmediatePropagation();
return false;
}});
this.started=false;
},
_mouseDestroy: function(){
this.element.off("." + this.widgetName);
if(this._mouseMoveDelegate){
this.document
.off("mousemove." + this.widgetName, this._mouseMoveDelegate)
.off("mouseup." + this.widgetName, this._mouseUpDelegate);
}},
_mouseDown: function(event){
if(mouseHandled){
return;
}
this._mouseMoved=false;
(this._mouseStarted&&this._mouseUp(event) );
this._mouseDownEvent=event;
var that=this,
btnIsLeft=(event.which===1),
elIsCancel=(typeof this.options.cancel==="string"&&event.target.nodeName ?
$(event.target).closest(this.options.cancel).length:false);
if(!btnIsLeft||elIsCancel||!this._mouseCapture(event) ){
return true;
}
this.mouseDelayMet = !this.options.delay;
if(!this.mouseDelayMet){
this._mouseDelayTimer=setTimeout(function(){
that.mouseDelayMet=true;
}, this.options.delay);
}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event) ){
this._mouseStarted=(this._mouseStart(event)!==false);
if(!this._mouseStarted){
event.preventDefault();
return true;
}}
if(true===$.data(event.target, this.widgetName + ".preventClickEvent") ){
$.removeData(event.target, this.widgetName + ".preventClickEvent");
}
this._mouseMoveDelegate=function(event){
return that._mouseMove(event);
};
this._mouseUpDelegate=function(event){
return that._mouseUp(event);
};
this.document
.on("mousemove." + this.widgetName, this._mouseMoveDelegate)
.on("mouseup." + this.widgetName, this._mouseUpDelegate);
event.preventDefault();
mouseHandled=true;
return true;
},
_mouseMove: function(event){
if(this._mouseMoved){
if($.ui.ie&&(!document.documentMode||document.documentMode < 9) &&
!event.button){
return this._mouseUp(event);
}else if(!event.which){
if(event.originalEvent.altKey||event.originalEvent.ctrlKey ||
event.originalEvent.metaKey||event.originalEvent.shiftKey){
this.ignoreMissingWhich=true;
}else if(!this.ignoreMissingWhich){
return this._mouseUp(event);
}}
}
if(event.which||event.button){
this._mouseMoved=true;
}
if(this._mouseStarted){
this._mouseDrag(event);
return event.preventDefault();
}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event) ){
this._mouseStarted =
(this._mouseStart(this._mouseDownEvent, event)!==false);
(this._mouseStarted ? this._mouseDrag(event):this._mouseUp(event) );
}
return !this._mouseStarted;
},
_mouseUp: function(event){
this.document
.off("mousemove." + this.widgetName, this._mouseMoveDelegate)
.off("mouseup." + this.widgetName, this._mouseUpDelegate);
if(this._mouseStarted){
this._mouseStarted=false;
if(event.target===this._mouseDownEvent.target){
$.data(event.target, this.widgetName + ".preventClickEvent", true);
}
this._mouseStop(event);
}
if(this._mouseDelayTimer){
clearTimeout(this._mouseDelayTimer);
delete this._mouseDelayTimer;
}
this.ignoreMissingWhich=false;
mouseHandled=false;
event.preventDefault();
},
_mouseDistanceMet: function(event){
return(Math.max(Math.abs(this._mouseDownEvent.pageX - event.pageX),
Math.abs(this._mouseDownEvent.pageY - event.pageY)
) >=this.options.distance
);
},
_mouseDelayMet: function(){
return this.mouseDelayMet;
},
_mouseStart: function(){},
_mouseDrag: function(){},
_mouseStop: function(){},
_mouseCapture: function(){ return true; }});
var plugin=$.ui.plugin={
add: function(module, option, set){
var i,
proto=$.ui[ module ].prototype;
for(i in set){
proto.plugins[ i ]=proto.plugins[ i ]||[];
proto.plugins[ i ].push([ option, set[ i ] ]);
}},
call: function(instance, name, args, allowDisconnected){
var i,
set=instance.plugins[ name ];
if(!set){
return;
}
if(!allowDisconnected&&(!instance.element[ 0 ].parentNode ||
instance.element[ 0 ].parentNode.nodeType===11) ){
return;
}
for(i=0; i < set.length; i++){
if(instance.options[ set[ i ][ 0 ] ]){
set[ i ][ 1 ].apply(instance.element, args);
}}
}};
var safeBlur=$.ui.safeBlur=function(element){
if(element&&element.nodeName.toLowerCase()!=="body"){
$(element).trigger("blur");
}};
$.widget("ui.draggable", $.ui.mouse, {
version: "1.12.0",
widgetEventPrefix: "drag",
options: {
addClasses: true,
appendTo: "parent",
axis: false,
connectToSortable: false,
containment: false,
cursor: "auto",
cursorAt: false,
grid: false,
handle: false,
helper: "original",
iframeFix: false,
opacity: false,
refreshPositions: false,
revert: false,
revertDuration: 500,
scope: "default",
scroll: true,
scrollSensitivity: 20,
scrollSpeed: 20,
snap: false,
snapMode: "both",
snapTolerance: 20,
stack: false,
zIndex: false,
drag: null,
start: null,
stop: null
},
_create: function(){
if(this.options.helper==="original"){
this._setPositionRelative();
}
if(this.options.addClasses){
this._addClass("ui-draggable");
}
this._setHandleClassName();
this._mouseInit();
},
_setOption: function(key, value){
this._super(key, value);
if(key==="handle"){
this._removeHandleClassName();
this._setHandleClassName();
}},
_destroy: function(){
if(( this.helper||this.element).is(".ui-draggable-dragging") ){
this.destroyOnClear=true;
return;
}
this._removeHandleClassName();
this._mouseDestroy();
},
_mouseCapture: function(event){
var o=this.options;
this._blurActiveElement(event);
if(this.helper||o.disabled ||
$(event.target).closest(".ui-resizable-handle").length > 0){
return false;
}
this.handle=this._getHandle(event);
if(!this.handle){
return false;
}
this._blockFrames(o.iframeFix===true ? "iframe":o.iframeFix);
return true;
},
_blockFrames: function(selector){
this.iframeBlocks=this.document.find(selector).map(function(){
var iframe=$(this);
return $("<div>")
.css("position", "absolute")
.appendTo(iframe.parent())
.outerWidth(iframe.outerWidth())
.outerHeight(iframe.outerHeight())
.offset(iframe.offset())[ 0 ];
});
},
_unblockFrames: function(){
if(this.iframeBlocks){
this.iframeBlocks.remove();
delete this.iframeBlocks;
}},
_blurActiveElement: function(event){
var activeElement=$.ui.safeActiveElement(this.document[ 0 ]),
target=$(event.target);
if(this._getHandle(event)&&target.closest(activeElement).length){
return;
}
$.ui.safeBlur(activeElement);
},
_mouseStart: function(event){
var o=this.options;
this.helper=this._createHelper(event);
this._addClass(this.helper, "ui-draggable-dragging");
this._cacheHelperProportions();
if($.ui.ddmanager){
$.ui.ddmanager.current=this;
}
this._cacheMargins();
this.cssPosition=this.helper.css("position");
this.scrollParent=this.helper.scrollParent(true);
this.offsetParent=this.helper.offsetParent();
this.hasFixedAncestor=this.helper.parents().filter(function(){
return $(this).css("position")==="fixed";
}).length > 0;
this.positionAbs=this.element.offset();
this._refreshOffsets(event);
this.originalPosition=this.position=this._generatePosition(event, false);
this.originalPageX=event.pageX;
this.originalPageY=event.pageY;
(o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt) );
this._setContainment();
if(this._trigger("start", event)===false){
this._clear();
return false;
}
this._cacheHelperProportions();
if($.ui.ddmanager&&!o.dropBehaviour){
$.ui.ddmanager.prepareOffsets(this, event);
}
this._mouseDrag(event, true);
if($.ui.ddmanager){
$.ui.ddmanager.dragStart(this, event);
}
return true;
},
_refreshOffsets: function(event){
this.offset={
top: this.positionAbs.top - this.margins.top,
left: this.positionAbs.left - this.margins.left,
scroll: false,
parent: this._getParentOffset(),
relative: this._getRelativeOffset()
};
this.offset.click={
left: event.pageX - this.offset.left,
top: event.pageY - this.offset.top
};},
_mouseDrag: function(event, noPropagation){
if(this.hasFixedAncestor){
this.offset.parent=this._getParentOffset();
}
this.position=this._generatePosition(event, true);
this.positionAbs=this._convertPositionTo("absolute");
if(!noPropagation){
var ui=this._uiHash();
if(this._trigger("drag", event, ui)===false){
this._mouseUp(new $.Event("mouseup", event) );
return false;
}
this.position=ui.position;
}
this.helper[ 0 ].style.left=this.position.left + "px";
this.helper[ 0 ].style.top=this.position.top + "px";
if($.ui.ddmanager){
$.ui.ddmanager.drag(this, event);
}
return false;
},
_mouseStop: function(event){
var that=this,
dropped=false;
if($.ui.ddmanager&&!this.options.dropBehaviour){
dropped=$.ui.ddmanager.drop(this, event);
}
if(this.dropped){
dropped=this.dropped;
this.dropped=false;
}
if(( this.options.revert==="invalid"&&!dropped) ||
(this.options.revert==="valid"&&dropped) ||
this.options.revert===true||($.isFunction(this.options.revert) &&
this.options.revert.call(this.element, dropped) )
){
$(this.helper).animate(this.originalPosition,
parseInt(this.options.revertDuration, 10),
function(){
if(that._trigger("stop", event)!==false){
that._clear();
}}
);
}else{
if(this._trigger("stop", event)!==false){
this._clear();
}}
return false;
},
_mouseUp: function(event){
this._unblockFrames();
if($.ui.ddmanager){
$.ui.ddmanager.dragStop(this, event);
}
if(this.handleElement.is(event.target) ){
this.element.trigger("focus");
}
return $.ui.mouse.prototype._mouseUp.call(this, event);
},
cancel: function(){
if(this.helper.is(".ui-draggable-dragging") ){
this._mouseUp(new $.Event("mouseup", { target: this.element[ 0 ] }) );
}else{
this._clear();
}
return this;
},
_getHandle: function(event){
return this.options.handle ?
!!$(event.target).closest(this.element.find(this.options.handle) ).length :
true;
},
_setHandleClassName: function(){
this.handleElement=this.options.handle ?
this.element.find(this.options.handle):this.element;
this._addClass(this.handleElement, "ui-draggable-handle");
},
_removeHandleClassName: function(){
this._removeClass(this.handleElement, "ui-draggable-handle");
},
_createHelper: function(event){
var o=this.options,
helperIsFunction=$.isFunction(o.helper),
helper=helperIsFunction ?
$(o.helper.apply(this.element[ 0 ], [ event ]) ) :
(o.helper==="clone" ?
this.element.clone().removeAttr("id") :
this.element);
if(!helper.parents("body").length){
helper.appendTo(( o.appendTo==="parent" ?
this.element[ 0 ].parentNode :
o.appendTo) );
}
if(helperIsFunction&&helper[ 0 ]===this.element[ 0 ]){
this._setPositionRelative();
}
if(helper[ 0 ]!==this.element[ 0 ] &&
!(/(fixed|absolute)/).test(helper.css("position") )){
helper.css("position", "absolute");
}
return helper;
},
_setPositionRelative: function(){
if(!(/^(?:r|a|f)/).test(this.element.css("position") )){
this.element[ 0 ].style.position="relative";
}},
_adjustOffsetFromHelper: function(obj){
if(typeof obj==="string"){
obj=obj.split(" ");
}
if($.isArray(obj) ){
obj={ left: +obj[ 0 ], top: +obj[ 1 ]||0 };}
if("left" in obj){
this.offset.click.left=obj.left + this.margins.left;
}
if("right" in obj){
this.offset.click.left=this.helperProportions.width - obj.right + this.margins.left;
}
if("top" in obj){
this.offset.click.top=obj.top + this.margins.top;
}
if("bottom" in obj){
this.offset.click.top=this.helperProportions.height - obj.bottom + this.margins.top;
}},
_isRootNode: function(element){
return(/(html|body)/i).test(element.tagName)||element===this.document[ 0 ];
},
_getParentOffset: function(){
var po=this.offsetParent.offset(),
document=this.document[ 0 ];
if(this.cssPosition==="absolute"&&this.scrollParent[ 0 ]!==document &&
$.contains(this.scrollParent[ 0 ], this.offsetParent[ 0 ]) ){
po.left +=this.scrollParent.scrollLeft();
po.top +=this.scrollParent.scrollTop();
}
if(this._isRootNode(this.offsetParent[ 0 ]) ){
po={ top: 0, left: 0 };}
return {
top: po.top +(parseInt(this.offsetParent.css("borderTopWidth"), 10)||0),
left: po.left +(parseInt(this.offsetParent.css("borderLeftWidth"), 10)||0)
};},
_getRelativeOffset: function(){
if(this.cssPosition!=="relative"){
return { top: 0, left: 0 };}
var p=this.element.position(),
scrollIsRootNode=this._isRootNode(this.scrollParent[ 0 ]);
return {
top: p.top -(parseInt(this.helper.css("top"), 10)||0) +
(!scrollIsRootNode ? this.scrollParent.scrollTop():0),
left: p.left -(parseInt(this.helper.css("left"), 10)||0) +
(!scrollIsRootNode ? this.scrollParent.scrollLeft():0)
};},
_cacheMargins: function(){
this.margins={
left:(parseInt(this.element.css("marginLeft"), 10)||0),
top:(parseInt(this.element.css("marginTop"), 10)||0),
right:(parseInt(this.element.css("marginRight"), 10)||0),
bottom:(parseInt(this.element.css("marginBottom"), 10)||0)
};},
_cacheHelperProportions: function(){
this.helperProportions={
width: this.helper.outerWidth(),
height: this.helper.outerHeight()
};},
_setContainment: function(){
var isUserScrollable, c, ce,
o=this.options,
document=this.document[ 0 ];
this.relativeContainer=null;
if(!o.containment){
this.containment=null;
return;
}
if(o.containment==="window"){
this.containment=[
$(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
$(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
$(window).scrollLeft() + $(window).width() -
this.helperProportions.width - this.margins.left,
$(window).scrollTop() +
($(window).height()||document.body.parentNode.scrollHeight) -
this.helperProportions.height - this.margins.top
];
return;
}
if(o.containment==="document"){
this.containment=[
0,
0,
$(document).width() - this.helperProportions.width - this.margins.left,
($(document).height()||document.body.parentNode.scrollHeight) -
this.helperProportions.height - this.margins.top
];
return;
}
if(o.containment.constructor===Array){
this.containment=o.containment;
return;
}
if(o.containment==="parent"){
o.containment=this.helper[ 0 ].parentNode;
}
c=$(o.containment);
ce=c[ 0 ];
if(!ce){
return;
}
isUserScrollable=/(scroll|auto)/.test(c.css("overflow") );
this.containment=[
(parseInt(c.css("borderLeftWidth"), 10)||0) +
(parseInt(c.css("paddingLeft"), 10)||0),
(parseInt(c.css("borderTopWidth"), 10)||0) +
(parseInt(c.css("paddingTop"), 10)||0),
(isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth):ce.offsetWidth) -
(parseInt(c.css("borderRightWidth"), 10)||0) -
(parseInt(c.css("paddingRight"), 10)||0) -
this.helperProportions.width -
this.margins.left -
this.margins.right,
(isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight):ce.offsetHeight) -
(parseInt(c.css("borderBottomWidth"), 10)||0) -
(parseInt(c.css("paddingBottom"), 10)||0) -
this.helperProportions.height -
this.margins.top -
this.margins.bottom
];
this.relativeContainer=c;
},
_convertPositionTo: function(d, pos){
if(!pos){
pos=this.position;
}
var mod=d==="absolute" ? 1:-1,
scrollIsRootNode=this._isRootNode(this.scrollParent[ 0 ]);
return {
top: (
pos.top	+
this.offset.relative.top * mod +
this.offset.parent.top * mod -
(( this.cssPosition==="fixed" ?
-this.offset.scroll.top :
(scrollIsRootNode ? 0:this.offset.scroll.top) ) * mod)
),
left: (
pos.left +
this.offset.relative.left * mod +
this.offset.parent.left * mod	-
(( this.cssPosition==="fixed" ?
-this.offset.scroll.left :
(scrollIsRootNode ? 0:this.offset.scroll.left) ) * mod)
)
};},
_generatePosition: function(event, constrainPosition){
var containment, co, top, left,
o=this.options,
scrollIsRootNode=this._isRootNode(this.scrollParent[ 0 ]),
pageX=event.pageX,
pageY=event.pageY;
if(!scrollIsRootNode||!this.offset.scroll){
this.offset.scroll={
top: this.scrollParent.scrollTop(),
left: this.scrollParent.scrollLeft()
};}
if(constrainPosition){
if(this.containment){
if(this.relativeContainer){
co=this.relativeContainer.offset();
containment=[
this.containment[ 0 ] + co.left,
this.containment[ 1 ] + co.top,
this.containment[ 2 ] + co.left,
this.containment[ 3 ] + co.top
];
}else{
containment=this.containment;
}
if(event.pageX - this.offset.click.left < containment[ 0 ]){
pageX=containment[ 0 ] + this.offset.click.left;
}
if(event.pageY - this.offset.click.top < containment[ 1 ]){
pageY=containment[ 1 ] + this.offset.click.top;
}
if(event.pageX - this.offset.click.left > containment[ 2 ]){
pageX=containment[ 2 ] + this.offset.click.left;
}
if(event.pageY - this.offset.click.top > containment[ 3 ]){
pageY=containment[ 3 ] + this.offset.click.top;
}}
if(o.grid){
top=o.grid[ 1 ] ? this.originalPageY + Math.round(( pageY -
this.originalPageY) / o.grid[ 1 ]) * o.grid[ 1 ]:this.originalPageY;
pageY=containment ?(( top - this.offset.click.top >=containment[ 1 ] ||
top - this.offset.click.top > containment[ 3 ]) ?
top :
(( top - this.offset.click.top >=containment[ 1 ]) ?
top - o.grid[ 1 ]:top + o.grid[ 1 ]) ):top;
left=o.grid[ 0 ] ? this.originalPageX +
Math.round(( pageX - this.originalPageX) / o.grid[ 0 ]) * o.grid[ 0 ] :
this.originalPageX;
pageX=containment ?(( left - this.offset.click.left >=containment[ 0 ] ||
left - this.offset.click.left > containment[ 2 ]) ?
left :
(( left - this.offset.click.left >=containment[ 0 ]) ?
left - o.grid[ 0 ]:left + o.grid[ 0 ]) ):left;
}
if(o.axis==="y"){
pageX=this.originalPageX;
}
if(o.axis==="x"){
pageY=this.originalPageY;
}}
return {
top: (
pageY -
this.offset.click.top -
this.offset.relative.top -
this.offset.parent.top +
(this.cssPosition==="fixed" ?
-this.offset.scroll.top :
(scrollIsRootNode ? 0:this.offset.scroll.top) )
),
left: (
pageX -
this.offset.click.left -
this.offset.relative.left -
this.offset.parent.left +
(this.cssPosition==="fixed" ?
-this.offset.scroll.left :
(scrollIsRootNode ? 0:this.offset.scroll.left) )
)
};},
_clear: function(){
this._removeClass(this.helper, "ui-draggable-dragging");
if(this.helper[ 0 ]!==this.element[ 0 ]&&!this.cancelHelperRemoval){
this.helper.remove();
}
this.helper=null;
this.cancelHelperRemoval=false;
if(this.destroyOnClear){
this.destroy();
}},
_trigger: function(type, event, ui){
ui=ui||this._uiHash();
$.ui.plugin.call(this, type, [ event, ui, this ], true);
if(/^(drag|start|stop)/.test(type) ){
this.positionAbs=this._convertPositionTo("absolute");
ui.offset=this.positionAbs;
}
return $.Widget.prototype._trigger.call(this, type, event, ui);
},
plugins: {},
_uiHash: function(){
return {
helper: this.helper,
position: this.position,
originalPosition: this.originalPosition,
offset: this.positionAbs
};}});
$.ui.plugin.add("draggable", "connectToSortable", {
start: function(event, ui, draggable){
var uiSortable=$.extend({}, ui, {
item: draggable.element
});
draggable.sortables=[];
$(draggable.options.connectToSortable).each(function(){
var sortable=$(this).sortable("instance");
if(sortable&&!sortable.options.disabled){
draggable.sortables.push(sortable);
sortable.refreshPositions();
sortable._trigger("activate", event, uiSortable);
}});
},
stop: function(event, ui, draggable){
var uiSortable=$.extend({}, ui, {
item: draggable.element
});
draggable.cancelHelperRemoval=false;
$.each(draggable.sortables, function(){
var sortable=this;
if(sortable.isOver){
sortable.isOver=0;
draggable.cancelHelperRemoval=true;
sortable.cancelHelperRemoval=false;
sortable._storedCSS={
position: sortable.placeholder.css("position"),
top: sortable.placeholder.css("top"),
left: sortable.placeholder.css("left")
};
sortable._mouseStop(event);
sortable.options.helper=sortable.options._helper;
}else{
sortable.cancelHelperRemoval=true;
sortable._trigger("deactivate", event, uiSortable);
}});
},
drag: function(event, ui, draggable){
$.each(draggable.sortables, function(){
var innermostIntersecting=false,
sortable=this;
sortable.positionAbs=draggable.positionAbs;
sortable.helperProportions=draggable.helperProportions;
sortable.offset.click=draggable.offset.click;
if(sortable._intersectsWith(sortable.containerCache) ){
innermostIntersecting=true;
$.each(draggable.sortables, function(){
this.positionAbs=draggable.positionAbs;
this.helperProportions=draggable.helperProportions;
this.offset.click=draggable.offset.click;
if(this!==sortable &&
this._intersectsWith(this.containerCache) &&
$.contains(sortable.element[ 0 ], this.element[ 0 ]) ){
innermostIntersecting=false;
}
return innermostIntersecting;
});
}
if(innermostIntersecting){
if(!sortable.isOver){
sortable.isOver=1;
draggable._parent=ui.helper.parent();
sortable.currentItem=ui.helper
.appendTo(sortable.element)
.data("ui-sortable-item", true);
sortable.options._helper=sortable.options.helper;
sortable.options.helper=function(){
return ui.helper[ 0 ];
};
event.target=sortable.currentItem[ 0 ];
sortable._mouseCapture(event, true);
sortable._mouseStart(event, true, true);
sortable.offset.click.top=draggable.offset.click.top;
sortable.offset.click.left=draggable.offset.click.left;
sortable.offset.parent.left -=draggable.offset.parent.left -
sortable.offset.parent.left;
sortable.offset.parent.top -=draggable.offset.parent.top -
sortable.offset.parent.top;
draggable._trigger("toSortable", event);
draggable.dropped=sortable.element;
$.each(draggable.sortables, function(){
this.refreshPositions();
});
draggable.currentItem=draggable.element;
sortable.fromOutside=draggable;
}
if(sortable.currentItem){
sortable._mouseDrag(event);
ui.position=sortable.position;
}}else{
if(sortable.isOver){
sortable.isOver=0;
sortable.cancelHelperRemoval=true;
sortable.options._revert=sortable.options.revert;
sortable.options.revert=false;
sortable._trigger("out", event, sortable._uiHash(sortable) );
sortable._mouseStop(event, true);
sortable.options.revert=sortable.options._revert;
sortable.options.helper=sortable.options._helper;
if(sortable.placeholder){
sortable.placeholder.remove();
}
ui.helper.appendTo(draggable._parent);
draggable._refreshOffsets(event);
ui.position=draggable._generatePosition(event, true);
draggable._trigger("fromSortable", event);
draggable.dropped=false;
$.each(draggable.sortables, function(){
this.refreshPositions();
});
}}
});
}});
$.ui.plugin.add("draggable", "cursor", {
start: function(event, ui, instance){
var t=$("body"),
o=instance.options;
if(t.css("cursor") ){
o._cursor=t.css("cursor");
}
t.css("cursor", o.cursor);
},
stop: function(event, ui, instance){
var o=instance.options;
if(o._cursor){
$("body").css("cursor", o._cursor);
}}
});
$.ui.plugin.add("draggable", "opacity", {
start: function(event, ui, instance){
var t=$(ui.helper),
o=instance.options;
if(t.css("opacity") ){
o._opacity=t.css("opacity");
}
t.css("opacity", o.opacity);
},
stop: function(event, ui, instance){
var o=instance.options;
if(o._opacity){
$(ui.helper).css("opacity", o._opacity);
}}
});
$.ui.plugin.add("draggable", "scroll", {
start: function(event, ui, i){
if(!i.scrollParentNotHidden){
i.scrollParentNotHidden=i.helper.scrollParent(false);
}
if(i.scrollParentNotHidden[ 0 ]!==i.document[ 0 ] &&
i.scrollParentNotHidden[ 0 ].tagName!=="HTML"){
i.overflowOffset=i.scrollParentNotHidden.offset();
}},
drag: function(event, ui, i){
var o=i.options,
scrolled=false,
scrollParent=i.scrollParentNotHidden[ 0 ],
document=i.document[ 0 ];
if(scrollParent!==document&&scrollParent.tagName!=="HTML"){
if(!o.axis||o.axis!=="x"){
if(( i.overflowOffset.top + scrollParent.offsetHeight) - event.pageY <
o.scrollSensitivity){
scrollParent.scrollTop=scrolled=scrollParent.scrollTop + o.scrollSpeed;
}else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity){
scrollParent.scrollTop=scrolled=scrollParent.scrollTop - o.scrollSpeed;
}}
if(!o.axis||o.axis!=="y"){
if(( i.overflowOffset.left + scrollParent.offsetWidth) - event.pageX <
o.scrollSensitivity){
scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft + o.scrollSpeed;
}else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity){
scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft - o.scrollSpeed;
}}
}else{
if(!o.axis||o.axis!=="x"){
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity){
scrolled=$(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
}else if($(window).height() -(event.pageY - $(document).scrollTop()) <
o.scrollSensitivity){
scrolled=$(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
}}
if(!o.axis||o.axis!=="y"){
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity){
scrolled=$(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed
);
}else if($(window).width() -(event.pageX - $(document).scrollLeft()) <
o.scrollSensitivity){
scrolled=$(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed
);
}}
}
if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){
$.ui.ddmanager.prepareOffsets(i, event);
}}
});
$.ui.plugin.add("draggable", "snap", {
start: function(event, ui, i){
var o=i.options;
i.snapElements=[];
$(o.snap.constructor!==String ?(o.snap.items||":data(ui-draggable)"):o.snap)
.each(function(){
var $t=$(this),
$o=$t.offset();
if(this!==i.element[ 0 ]){
i.snapElements.push({
item: this,
width: $t.outerWidth(), height: $t.outerHeight(),
top: $o.top, left: $o.left
});
}});
},
drag: function(event, ui, inst){
var ts, bs, ls, rs, l, r, t, b, i, first,
o=inst.options,
d=o.snapTolerance,
x1=ui.offset.left, x2=x1 + inst.helperProportions.width,
y1=ui.offset.top, y2=y1 + inst.helperProportions.height;
for(i=inst.snapElements.length - 1; i >=0; i--){
l=inst.snapElements[ i ].left - inst.margins.left;
r=l + inst.snapElements[ i ].width;
t=inst.snapElements[ i ].top - inst.margins.top;
b=t + inst.snapElements[ i ].height;
if(x2 < l - d||x1 > r + d||y2 < t - d||y1 > b + d ||
!$.contains(inst.snapElements[ i ].item.ownerDocument,
inst.snapElements[ i ].item) ){
if(inst.snapElements[ i ].snapping){
(inst.options.snap.release &&
inst.options.snap.release.call(inst.element,
event,
$.extend(inst._uiHash(), { snapItem: inst.snapElements[ i ].item })
));
}
inst.snapElements[ i ].snapping=false;
continue;
}
if(o.snapMode!=="inner"){
ts=Math.abs(t - y2) <=d;
bs=Math.abs(b - y1) <=d;
ls=Math.abs(l - x2) <=d;
rs=Math.abs(r - x1) <=d;
if(ts){
ui.position.top=inst._convertPositionTo("relative", {
top: t - inst.helperProportions.height,
left: 0
}).top;
}
if(bs){
ui.position.top=inst._convertPositionTo("relative", {
top: b,
left: 0
}).top;
}
if(ls){
ui.position.left=inst._convertPositionTo("relative", {
top: 0,
left: l - inst.helperProportions.width
}).left;
}
if(rs){
ui.position.left=inst._convertPositionTo("relative", {
top: 0,
left: r
}).left;
}}
first=(ts||bs||ls||rs);
if(o.snapMode!=="outer"){
ts=Math.abs(t - y1) <=d;
bs=Math.abs(b - y2) <=d;
ls=Math.abs(l - x1) <=d;
rs=Math.abs(r - x2) <=d;
if(ts){
ui.position.top=inst._convertPositionTo("relative", {
top: t,
left: 0
}).top;
}
if(bs){
ui.position.top=inst._convertPositionTo("relative", {
top: b - inst.helperProportions.height,
left: 0
}).top;
}
if(ls){
ui.position.left=inst._convertPositionTo("relative", {
top: 0,
left: l
}).left;
}
if(rs){
ui.position.left=inst._convertPositionTo("relative", {
top: 0,
left: r - inst.helperProportions.width
}).left;
}}
if(!inst.snapElements[ i ].snapping&&(ts||bs||ls||rs||first) ){
(inst.options.snap.snap &&
inst.options.snap.snap.call(inst.element,
event,
$.extend(inst._uiHash(), {
snapItem: inst.snapElements[ i ].item
}) ));
}
inst.snapElements[ i ].snapping=(ts||bs||ls||rs||first);
}}
});
$.ui.plugin.add("draggable", "stack", {
start: function(event, ui, instance){
var min,
o=instance.options,
group=$.makeArray($(o.stack) ).sort(function(a, b){
return(parseInt($(a).css("zIndex"), 10)||0) -
(parseInt($(b).css("zIndex"), 10)||0);
});
if(!group.length){ return; }
min=parseInt($(group[ 0 ]).css("zIndex"), 10)||0;
$(group).each(function(i){
$(this).css("zIndex", min + i);
});
this.css("zIndex",(min + group.length) );
}});
$.ui.plugin.add("draggable", "zIndex", {
start: function(event, ui, instance){
var t=$(ui.helper),
o=instance.options;
if(t.css("zIndex") ){
o._zIndex=t.css("zIndex");
}
t.css("zIndex", o.zIndex);
},
stop: function(event, ui, instance){
var o=instance.options;
if(o._zIndex){
$(ui.helper).css("zIndex", o._zIndex);
}}
});
var widgetsDraggable=$.ui.draggable;
$.widget("ui.resizable", $.ui.mouse, {
version: "1.12.0",
widgetEventPrefix: "resize",
options: {
alsoResize: false,
animate: false,
animateDuration: "slow",
animateEasing: "swing",
aspectRatio: false,
autoHide: false,
classes: {
"ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
},
containment: false,
ghost: false,
grid: false,
handles: "e,s,se",
helper: false,
maxHeight: null,
maxWidth: null,
minHeight: 10,
minWidth: 10,
zIndex: 90,
resize: null,
start: null,
stop: null
},
_num: function(value){
return parseFloat(value)||0;
},
_isNumber: function(value){
return !isNaN(parseFloat(value) );
},
_hasScroll: function(el, a){
if($(el).css("overflow")==="hidden"){
return false;
}
var scroll=(a&&a==="left") ? "scrollLeft":"scrollTop",
has=false;
if(el[ scroll ] > 0){
return true;
}
el[ scroll ]=1;
has=(el[ scroll ] > 0);
el[ scroll ]=0;
return has;
},
_create: function(){
var margins,
o=this.options,
that=this;
this._addClass("ui-resizable");
$.extend(this, {
_aspectRatio: !!(o.aspectRatio),
aspectRatio: o.aspectRatio,
originalElement: this.element,
_proportionallyResizeElements: [],
_helper: o.helper||o.ghost||o.animate ? o.helper||"ui-resizable-helper":null
});
if(this.element[ 0 ].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i) ){
this.element.wrap($("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
position: this.element.css("position"),
width: this.element.outerWidth(),
height: this.element.outerHeight(),
top: this.element.css("top"),
left: this.element.css("left")
})
);
this.element=this.element.parent().data("ui-resizable", this.element.resizable("instance")
);
this.elementIsWrapper=true;
margins={
marginTop: this.originalElement.css("marginTop"),
marginRight: this.originalElement.css("marginRight"),
marginBottom: this.originalElement.css("marginBottom"),
marginLeft: this.originalElement.css("marginLeft")
};
this.element.css(margins);
this.originalElement.css("margin", 0);
this.originalResizeStyle=this.originalElement.css("resize");
this.originalElement.css("resize", "none");
this._proportionallyResizeElements.push(this.originalElement.css({
position: "static",
zoom: 1,
display: "block"
}) );
this.originalElement.css(margins);
this._proportionallyResize();
}
this._setupHandles();
if(o.autoHide){
$(this.element)
.on("mouseenter", function(){
if(o.disabled){
return;
}
that._removeClass("ui-resizable-autohide");
that._handles.show();
})
.on("mouseleave", function(){
if(o.disabled){
return;
}
if(!that.resizing){
that._addClass("ui-resizable-autohide");
that._handles.hide();
}});
}
this._mouseInit();
},
_destroy: function(){
this._mouseDestroy();
var wrapper,
_destroy=function(exp){
$(exp)
.removeData("resizable")
.removeData("ui-resizable")
.off(".resizable")
.find(".ui-resizable-handle")
.remove();
};
if(this.elementIsWrapper){
_destroy(this.element);
wrapper=this.element;
this.originalElement.css({
position: wrapper.css("position"),
width: wrapper.outerWidth(),
height: wrapper.outerHeight(),
top: wrapper.css("top"),
left: wrapper.css("left")
}).insertAfter(wrapper);
wrapper.remove();
}
this.originalElement.css("resize", this.originalResizeStyle);
_destroy(this.originalElement);
return this;
},
_setOption: function(key, value){
this._super(key, value);
switch(key){
case "handles":
this._removeHandles();
this._setupHandles();
break;
default:
break;
}},
_setupHandles: function(){
var o=this.options, handle, i, n, hname, axis, that=this;
this.handles=o.handles ||
(!$(".ui-resizable-handle", this.element).length ?
"e,s,se":{
n: ".ui-resizable-n",
e: ".ui-resizable-e",
s: ".ui-resizable-s",
w: ".ui-resizable-w",
se: ".ui-resizable-se",
sw: ".ui-resizable-sw",
ne: ".ui-resizable-ne",
nw: ".ui-resizable-nw"
});
this._handles=$();
if(this.handles.constructor===String){
if(this.handles==="all"){
this.handles="n,e,s,w,se,sw,ne,nw";
}
n=this.handles.split(",");
this.handles={};
for(i=0; i < n.length; i++){
handle=$.trim(n[ i ]);
hname="ui-resizable-" + handle;
axis=$("<div>");
this._addClass(axis, "ui-resizable-handle " + hname);
axis.css({ zIndex: o.zIndex });
this.handles[ handle ]=".ui-resizable-" + handle;
this.element.append(axis);
}}
this._renderAxis=function(target){
var i, axis, padPos, padWrapper;
target=target||this.element;
for(i in this.handles){
if(this.handles[ i ].constructor===String){
this.handles[ i ]=this.element.children(this.handles[ i ]).first().show();
}else if(this.handles[ i ].jquery||this.handles[ i ].nodeType){
this.handles[ i ]=$(this.handles[ i ]);
this._on(this.handles[ i ], { "mousedown": that._mouseDown });
}
if(this.elementIsWrapper &&
this.originalElement[ 0 ]
.nodeName
.match(/^(textarea|input|select|button)$/i) ){
axis=$(this.handles[ i ], this.element);
padWrapper=/sw|ne|nw|se|n|s/.test(i) ?
axis.outerHeight() :
axis.outerWidth();
padPos=[ "padding",
/ne|nw|n/.test(i) ? "Top" :
/se|sw|s/.test(i) ? "Bottom" :
/^e$/.test(i) ? "Right":"Left" ].join("");
target.css(padPos, padWrapper);
this._proportionallyResize();
}
this._handles=this._handles.add(this.handles[ i ]);
}};
this._renderAxis(this.element);
this._handles=this._handles.add(this.element.find(".ui-resizable-handle") );
this._handles.disableSelection();
this._handles.on("mouseover", function(){
if(!that.resizing){
if(this.className){
axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
}
that.axis=axis&&axis[ 1 ] ? axis[ 1 ]:"se";
}});
if(o.autoHide){
this._handles.hide();
this._addClass("ui-resizable-autohide");
}},
_removeHandles: function(){
this._handles.remove();
},
_mouseCapture: function(event){
var i, handle,
capture=false;
for(i in this.handles){
handle=$(this.handles[ i ])[ 0 ];
if(handle===event.target||$.contains(handle, event.target) ){
capture=true;
}}
return !this.options.disabled&&capture;
},
_mouseStart: function(event){
var curleft, curtop, cursor,
o=this.options,
el=this.element;
this.resizing=true;
this._renderProxy();
curleft=this._num(this.helper.css("left") );
curtop=this._num(this.helper.css("top") );
if(o.containment){
curleft +=$(o.containment).scrollLeft()||0;
curtop +=$(o.containment).scrollTop()||0;
}
this.offset=this.helper.offset();
this.position={ left: curleft, top: curtop };
this.size=this._helper ? {
width: this.helper.width(),
height: this.helper.height()
}:{
width: el.width(),
height: el.height()
};
this.originalSize=this._helper ? {
width: el.outerWidth(),
height: el.outerHeight()
}:{
width: el.width(),
height: el.height()
};
this.sizeDiff={
width: el.outerWidth() - el.width(),
height: el.outerHeight() - el.height()
};
this.originalPosition={ left: curleft, top: curtop };
this.originalMousePosition={ left: event.pageX, top: event.pageY };
this.aspectRatio=(typeof o.aspectRatio==="number") ?
o.aspectRatio :
(( this.originalSize.width / this.originalSize.height)||1);
cursor=$(".ui-resizable-" + this.axis).css("cursor");
$("body").css("cursor", cursor==="auto" ? this.axis + "-resize":cursor);
this._addClass("ui-resizable-resizing");
this._propagate("start", event);
return true;
},
_mouseDrag: function(event){
var data, props,
smp=this.originalMousePosition,
a=this.axis,
dx=(event.pageX - smp.left)||0,
dy=(event.pageY - smp.top)||0,
trigger=this._change[ a ];
this._updatePrevProperties();
if(!trigger){
return false;
}
data=trigger.apply(this, [ event, dx, dy ]);
this._updateVirtualBoundaries(event.shiftKey);
if(this._aspectRatio||event.shiftKey){
data=this._updateRatio(data, event);
}
data=this._respectSize(data, event);
this._updateCache(data);
this._propagate("resize", event);
props=this._applyChanges();
if(!this._helper&&this._proportionallyResizeElements.length){
this._proportionallyResize();
}
if(!$.isEmptyObject(props) ){
this._updatePrevProperties();
this._trigger("resize", event, this.ui());
this._applyChanges();
}
return false;
},
_mouseStop: function(event){
this.resizing=false;
var pr, ista, soffseth, soffsetw, s, left, top,
o=this.options, that=this;
if(this._helper){
pr=this._proportionallyResizeElements;
ista=pr.length&&(/textarea/i).test(pr[ 0 ].nodeName);
soffseth=ista&&this._hasScroll(pr[ 0 ], "left") ? 0:that.sizeDiff.height;
soffsetw=ista ? 0:that.sizeDiff.width;
s={
width:(that.helper.width()  - soffsetw),
height:(that.helper.height() - soffseth)
};
left=(parseFloat(that.element.css("left") ) +
(that.position.left - that.originalPosition.left) )||null;
top=(parseFloat(that.element.css("top") ) +
(that.position.top - that.originalPosition.top) )||null;
if(!o.animate){
this.element.css($.extend(s, { top: top, left: left }) );
}
that.helper.height(that.size.height);
that.helper.width(that.size.width);
if(this._helper&&!o.animate){
this._proportionallyResize();
}}
$("body").css("cursor", "auto");
this._removeClass("ui-resizable-resizing");
this._propagate("stop", event);
if(this._helper){
this.helper.remove();
}
return false;
},
_updatePrevProperties: function(){
this.prevPosition={
top: this.position.top,
left: this.position.left
};
this.prevSize={
width: this.size.width,
height: this.size.height
};},
_applyChanges: function(){
var props={};
if(this.position.top!==this.prevPosition.top){
props.top=this.position.top + "px";
}
if(this.position.left!==this.prevPosition.left){
props.left=this.position.left + "px";
}
if(this.size.width!==this.prevSize.width){
props.width=this.size.width + "px";
}
if(this.size.height!==this.prevSize.height){
props.height=this.size.height + "px";
}
this.helper.css(props);
return props;
},
_updateVirtualBoundaries: function(forceAspectRatio){
var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
o=this.options;
b={
minWidth: this._isNumber(o.minWidth) ? o.minWidth:0,
maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth:Infinity,
minHeight: this._isNumber(o.minHeight) ? o.minHeight:0,
maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight:Infinity
};
if(this._aspectRatio||forceAspectRatio){
pMinWidth=b.minHeight * this.aspectRatio;
pMinHeight=b.minWidth / this.aspectRatio;
pMaxWidth=b.maxHeight * this.aspectRatio;
pMaxHeight=b.maxWidth / this.aspectRatio;
if(pMinWidth > b.minWidth){
b.minWidth=pMinWidth;
}
if(pMinHeight > b.minHeight){
b.minHeight=pMinHeight;
}
if(pMaxWidth < b.maxWidth){
b.maxWidth=pMaxWidth;
}
if(pMaxHeight < b.maxHeight){
b.maxHeight=pMaxHeight;
}}
this._vBoundaries=b;
},
_updateCache: function(data){
this.offset=this.helper.offset();
if(this._isNumber(data.left) ){
this.position.left=data.left;
}
if(this._isNumber(data.top) ){
this.position.top=data.top;
}
if(this._isNumber(data.height) ){
this.size.height=data.height;
}
if(this._isNumber(data.width) ){
this.size.width=data.width;
}},
_updateRatio: function(data){
var cpos=this.position,
csize=this.size,
a=this.axis;
if(this._isNumber(data.height) ){
data.width=(data.height * this.aspectRatio);
}else if(this._isNumber(data.width) ){
data.height=(data.width / this.aspectRatio);
}
if(a==="sw"){
data.left=cpos.left +(csize.width - data.width);
data.top=null;
}
if(a==="nw"){
data.top=cpos.top +(csize.height - data.height);
data.left=cpos.left +(csize.width - data.width);
}
return data;
},
_respectSize: function(data){
var o=this._vBoundaries,
a=this.axis,
ismaxw=this._isNumber(data.width)&&o.maxWidth&&(o.maxWidth < data.width),
ismaxh=this._isNumber(data.height)&&o.maxHeight&&(o.maxHeight < data.height),
isminw=this._isNumber(data.width)&&o.minWidth&&(o.minWidth > data.width),
isminh=this._isNumber(data.height)&&o.minHeight&&(o.minHeight > data.height),
dw=this.originalPosition.left + this.originalSize.width,
dh=this.originalPosition.top + this.originalSize.height,
cw=/sw|nw|w/.test(a), ch=/nw|ne|n/.test(a);
if(isminw){
data.width=o.minWidth;
}
if(isminh){
data.height=o.minHeight;
}
if(ismaxw){
data.width=o.maxWidth;
}
if(ismaxh){
data.height=o.maxHeight;
}
if(isminw&&cw){
data.left=dw - o.minWidth;
}
if(ismaxw&&cw){
data.left=dw - o.maxWidth;
}
if(isminh&&ch){
data.top=dh - o.minHeight;
}
if(ismaxh&&ch){
data.top=dh - o.maxHeight;
}
if(!data.width&&!data.height&&!data.left&&data.top){
data.top=null;
}else if(!data.width&&!data.height&&!data.top&&data.left){
data.left=null;
}
return data;
},
_getPaddingPlusBorderDimensions: function(element){
var i=0,
widths=[],
borders=[
element.css("borderTopWidth"),
element.css("borderRightWidth"),
element.css("borderBottomWidth"),
element.css("borderLeftWidth")
],
paddings=[
element.css("paddingTop"),
element.css("paddingRight"),
element.css("paddingBottom"),
element.css("paddingLeft")
];
for(; i < 4; i++){
widths[ i ]=(parseFloat(borders[ i ])||0);
widths[ i ] +=(parseFloat(paddings[ i ])||0);
}
return {
height: widths[ 0 ] + widths[ 2 ],
width: widths[ 1 ] + widths[ 3 ]
};},
_proportionallyResize: function(){
if(!this._proportionallyResizeElements.length){
return;
}
var prel,
i=0,
element=this.helper||this.element;
for(; i < this._proportionallyResizeElements.length; i++){
prel=this._proportionallyResizeElements[ i ];
if(!this.outerDimensions){
this.outerDimensions=this._getPaddingPlusBorderDimensions(prel);
}
prel.css({
height:(element.height() - this.outerDimensions.height)||0,
width:(element.width() - this.outerDimensions.width)||0
});
}},
_renderProxy: function(){
var el=this.element, o=this.options;
this.elementOffset=el.offset();
if(this._helper){
this.helper=this.helper||$("<div style='overflow:hidden;'></div>");
this._addClass(this.helper, this._helper);
this.helper.css({
width: this.element.outerWidth(),
height: this.element.outerHeight(),
position: "absolute",
left: this.elementOffset.left + "px",
top: this.elementOffset.top + "px",
zIndex: ++o.zIndex
});
this.helper
.appendTo("body")
.disableSelection();
}else{
this.helper=this.element;
}},
_change: {
e: function(event, dx){
return { width: this.originalSize.width + dx };},
w: function(event, dx){
var cs=this.originalSize, sp=this.originalPosition;
return { left: sp.left + dx, width: cs.width - dx };},
n: function(event, dx, dy){
var cs=this.originalSize, sp=this.originalPosition;
return { top: sp.top + dy, height: cs.height - dy };},
s: function(event, dx, dy){
return { height: this.originalSize.height + dy };},
se: function(event, dx, dy){
return $.extend(this._change.s.apply(this, arguments),
this._change.e.apply(this, [ event, dx, dy ]) );
},
sw: function(event, dx, dy){
return $.extend(this._change.s.apply(this, arguments),
this._change.w.apply(this, [ event, dx, dy ]) );
},
ne: function(event, dx, dy){
return $.extend(this._change.n.apply(this, arguments),
this._change.e.apply(this, [ event, dx, dy ]) );
},
nw: function(event, dx, dy){
return $.extend(this._change.n.apply(this, arguments),
this._change.w.apply(this, [ event, dx, dy ]) );
}},
_propagate: function(n, event){
$.ui.plugin.call(this, n, [ event, this.ui() ]);
(n!=="resize"&&this._trigger(n, event, this.ui()) );
},
plugins: {},
ui: function(){
return {
originalElement: this.originalElement,
element: this.element,
helper: this.helper,
position: this.position,
size: this.size,
originalSize: this.originalSize,
originalPosition: this.originalPosition
};}});
$.ui.plugin.add("resizable", "animate", {
stop: function(event){
var that=$(this).resizable("instance"),
o=that.options,
pr=that._proportionallyResizeElements,
ista=pr.length&&(/textarea/i).test(pr[ 0 ].nodeName),
soffseth=ista&&that._hasScroll(pr[ 0 ], "left") ? 0:that.sizeDiff.height,
soffsetw=ista ? 0:that.sizeDiff.width,
style={
width:(that.size.width - soffsetw),
height:(that.size.height - soffseth)
},
left=(parseFloat(that.element.css("left") ) +
(that.position.left - that.originalPosition.left) )||null,
top=(parseFloat(that.element.css("top") ) +
(that.position.top - that.originalPosition.top) )||null;
that.element.animate($.extend(style, top&&left ? { top: top, left: left }:{}), {
duration: o.animateDuration,
easing: o.animateEasing,
step: function(){
var data={
width: parseFloat(that.element.css("width") ),
height: parseFloat(that.element.css("height") ),
top: parseFloat(that.element.css("top") ),
left: parseFloat(that.element.css("left") )
};
if(pr&&pr.length){
$(pr[ 0 ]).css({ width: data.width, height: data.height });
}
that._updateCache(data);
that._propagate("resize", event);
}}
);
}});
$.ui.plugin.add("resizable", "containment", {
start: function(){
var element, p, co, ch, cw, width, height,
that=$(this).resizable("instance"),
o=that.options,
el=that.element,
oc=o.containment,
ce=(oc instanceof $) ?
oc.get(0) :
(/parent/.test(oc) ) ? el.parent().get(0):oc;
if(!ce){
return;
}
that.containerElement=$(ce);
if(/document/.test(oc)||oc===document){
that.containerOffset={
left: 0,
top: 0
};
that.containerPosition={
left: 0,
top: 0
};
that.parentData={
element: $(document),
left: 0,
top: 0,
width: $(document).width(),
height: $(document).height()||document.body.parentNode.scrollHeight
};}else{
element=$(ce);
p=[];
$([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name){
p[ i ]=that._num(element.css("padding" + name) );
});
that.containerOffset=element.offset();
that.containerPosition=element.position();
that.containerSize={
height:(element.innerHeight() - p[ 3 ]),
width:(element.innerWidth() - p[ 1 ])
};
co=that.containerOffset;
ch=that.containerSize.height;
cw=that.containerSize.width;
width=(that._hasScroll(ce, "left") ? ce.scrollWidth:cw);
height=(that._hasScroll(ce) ? ce.scrollHeight:ch) ;
that.parentData={
element: ce,
left: co.left,
top: co.top,
width: width,
height: height
};}},
resize: function(event){
var woset, hoset, isParent, isOffsetRelative,
that=$(this).resizable("instance"),
o=that.options,
co=that.containerOffset,
cp=that.position,
pRatio=that._aspectRatio||event.shiftKey,
cop={
top: 0,
left: 0
},
ce=that.containerElement,
continueResize=true;
if(ce[ 0 ]!==document&&(/static/).test(ce.css("position") )){
cop=co;
}
if(cp.left <(that._helper ? co.left:0) ){
that.size.width=that.size.width +
(that._helper ?
(that.position.left - co.left) :
(that.position.left - cop.left) );
if(pRatio){
that.size.height=that.size.width / that.aspectRatio;
continueResize=false;
}
that.position.left=o.helper ? co.left:0;
}
if(cp.top <(that._helper ? co.top:0) ){
that.size.height=that.size.height +
(that._helper ?
(that.position.top - co.top) :
that.position.top);
if(pRatio){
that.size.width=that.size.height * that.aspectRatio;
continueResize=false;
}
that.position.top=that._helper ? co.top:0;
}
isParent=that.containerElement.get(0)===that.element.parent().get(0);
isOffsetRelative=/relative|absolute/.test(that.containerElement.css("position") );
if(isParent&&isOffsetRelative){
that.offset.left=that.parentData.left + that.position.left;
that.offset.top=that.parentData.top + that.position.top;
}else{
that.offset.left=that.element.offset().left;
that.offset.top=that.element.offset().top;
}
woset=Math.abs(that.sizeDiff.width +
(that._helper ?
that.offset.left - cop.left :
(that.offset.left - co.left) ));
hoset=Math.abs(that.sizeDiff.height +
(that._helper ?
that.offset.top - cop.top :
(that.offset.top - co.top) ));
if(woset + that.size.width >=that.parentData.width){
that.size.width=that.parentData.width - woset;
if(pRatio){
that.size.height=that.size.width / that.aspectRatio;
continueResize=false;
}}
if(hoset + that.size.height >=that.parentData.height){
that.size.height=that.parentData.height - hoset;
if(pRatio){
that.size.width=that.size.height * that.aspectRatio;
continueResize=false;
}}
if(!continueResize){
that.position.left=that.prevPosition.left;
that.position.top=that.prevPosition.top;
that.size.width=that.prevSize.width;
that.size.height=that.prevSize.height;
}},
stop: function(){
var that=$(this).resizable("instance"),
o=that.options,
co=that.containerOffset,
cop=that.containerPosition,
ce=that.containerElement,
helper=$(that.helper),
ho=helper.offset(),
w=helper.outerWidth() - that.sizeDiff.width,
h=helper.outerHeight() - that.sizeDiff.height;
if(that._helper&&!o.animate&&(/relative/).test(ce.css("position") )){
$(this).css({
left: ho.left - cop.left - co.left,
width: w,
height: h
});
}
if(that._helper&&!o.animate&&(/static/).test(ce.css("position") )){
$(this).css({
left: ho.left - cop.left - co.left,
width: w,
height: h
});
}}
});
$.ui.plugin.add("resizable", "alsoResize", {
start: function(){
var that=$(this).resizable("instance"),
o=that.options;
$(o.alsoResize).each(function(){
var el=$(this);
el.data("ui-resizable-alsoresize", {
width: parseFloat(el.width()), height: parseFloat(el.height()),
left: parseFloat(el.css("left") ), top: parseFloat(el.css("top") )
});
});
},
resize: function(event, ui){
var that=$(this).resizable("instance"),
o=that.options,
os=that.originalSize,
op=that.originalPosition,
delta={
height:(that.size.height - os.height)||0,
width:(that.size.width - os.width)||0,
top:(that.position.top - op.top)||0,
left:(that.position.left - op.left)||0
};
$(o.alsoResize).each(function(){
var el=$(this), start=$(this).data("ui-resizable-alsoresize"), style={},
css=el.parents(ui.originalElement[ 0 ]).length ?
[ "width", "height" ] :
[ "width", "height", "top", "left" ];
$.each(css, function(i, prop){
var sum=(start[ prop ]||0) +(delta[ prop ]||0);
if(sum&&sum >=0){
style[ prop ]=sum||null;
}});
el.css(style);
});
},
stop: function(){
$(this).removeData("ui-resizable-alsoresize");
}});
$.ui.plugin.add("resizable", "ghost", {
start: function(){
var that=$(this).resizable("instance"), cs=that.size;
that.ghost=that.originalElement.clone();
that.ghost.css({
opacity: 0.25,
display: "block",
position: "relative",
height: cs.height,
width: cs.width,
margin: 0,
left: 0,
top: 0
});
that._addClass(that.ghost, "ui-resizable-ghost");
if($.uiBackCompat!==false&&typeof that.options.ghost==="string"){
that.ghost.addClass(this.options.ghost);
}
that.ghost.appendTo(that.helper);
},
resize: function(){
var that=$(this).resizable("instance");
if(that.ghost){
that.ghost.css({
position: "relative",
height: that.size.height,
width: that.size.width
});
}},
stop: function(){
var that=$(this).resizable("instance");
if(that.ghost&&that.helper){
that.helper.get(0).removeChild(that.ghost.get(0) );
}}
});
$.ui.plugin.add("resizable", "grid", {
resize: function(){
var outerDimensions,
that=$(this).resizable("instance"),
o=that.options,
cs=that.size,
os=that.originalSize,
op=that.originalPosition,
a=that.axis,
grid=typeof o.grid==="number" ? [ o.grid, o.grid ]:o.grid,
gridX=(grid[ 0 ]||1),
gridY=(grid[ 1 ]||1),
ox=Math.round(( cs.width - os.width) / gridX) * gridX,
oy=Math.round(( cs.height - os.height) / gridY) * gridY,
newWidth=os.width + ox,
newHeight=os.height + oy,
isMaxWidth=o.maxWidth&&(o.maxWidth < newWidth),
isMaxHeight=o.maxHeight&&(o.maxHeight < newHeight),
isMinWidth=o.minWidth&&(o.minWidth > newWidth),
isMinHeight=o.minHeight&&(o.minHeight > newHeight);
o.grid=grid;
if(isMinWidth){
newWidth +=gridX;
}
if(isMinHeight){
newHeight +=gridY;
}
if(isMaxWidth){
newWidth -=gridX;
}
if(isMaxHeight){
newHeight -=gridY;
}
if(/^(se|s|e)$/.test(a) ){
that.size.width=newWidth;
that.size.height=newHeight;
}else if(/^(ne)$/.test(a) ){
that.size.width=newWidth;
that.size.height=newHeight;
that.position.top=op.top - oy;
}else if(/^(sw)$/.test(a) ){
that.size.width=newWidth;
that.size.height=newHeight;
that.position.left=op.left - ox;
}else{
if(newHeight - gridY <=0||newWidth - gridX <=0){
outerDimensions=that._getPaddingPlusBorderDimensions(this);
}
if(newHeight - gridY > 0){
that.size.height=newHeight;
that.position.top=op.top - oy;
}else{
newHeight=gridY - outerDimensions.height;
that.size.height=newHeight;
that.position.top=op.top + os.height - newHeight;
}
if(newWidth - gridX > 0){
that.size.width=newWidth;
that.position.left=op.left - ox;
}else{
newWidth=gridX - outerDimensions.width;
that.size.width=newWidth;
that.position.left=op.left + os.width - newWidth;
}}
}});
var widgetsResizable=$.ui.resizable;
$.widget("ui.dialog", {
version: "1.12.0",
options: {
appendTo: "body",
autoOpen: true,
buttons: [],
classes: {
"ui-dialog": "ui-corner-all",
"ui-dialog-titlebar": "ui-corner-all"
},
closeOnEscape: true,
closeText: "Close",
draggable: true,
hide: null,
height: "auto",
maxHeight: null,
maxWidth: null,
minHeight: 150,
minWidth: 150,
modal: false,
position: {
my: "center",
at: "center",
of: window,
collision: "fit",
using: function(pos){
var topOffset=$(this).css(pos).offset().top;
if(topOffset < 0){
$(this).css("top", pos.top - topOffset);
}}
},
resizable: true,
show: null,
title: null,
width: 300,
beforeClose: null,
close: null,
drag: null,
dragStart: null,
dragStop: null,
focus: null,
open: null,
resize: null,
resizeStart: null,
resizeStop: null
},
sizeRelatedOptions: {
buttons: true,
height: true,
maxHeight: true,
maxWidth: true,
minHeight: true,
minWidth: true,
width: true
},
resizableRelatedOptions: {
maxHeight: true,
maxWidth: true,
minHeight: true,
minWidth: true
},
_create: function(){
this.originalCss={
display: this.element[ 0 ].style.display,
width: this.element[ 0 ].style.width,
minHeight: this.element[ 0 ].style.minHeight,
maxHeight: this.element[ 0 ].style.maxHeight,
height: this.element[ 0 ].style.height
};
this.originalPosition={
parent: this.element.parent(),
index: this.element.parent().children().index(this.element)
};
this.originalTitle=this.element.attr("title");
if(this.options.title==null&&this.originalTitle!=null){
this.options.title=this.originalTitle;
}
if(this.options.disabled){
this.options.disabled=false;
}
this._createWrapper();
this.element
.show()
.removeAttr("title")
.appendTo(this.uiDialog);
this._addClass("ui-dialog-content", "ui-widget-content");
this._createTitlebar();
this._createButtonPane();
if(this.options.draggable&&$.fn.draggable){
this._makeDraggable();
}
if(this.options.resizable&&$.fn.resizable){
this._makeResizable();
}
this._isOpen=false;
this._trackFocus();
},
_init: function(){
if(this.options.autoOpen){
this.open();
}},
_appendTo: function(){
var element=this.options.appendTo;
if(element&&(element.jquery||element.nodeType) ){
return $(element);
}
return this.document.find(element||"body").eq(0);
},
_destroy: function(){
var next,
originalPosition=this.originalPosition;
this._untrackInstance();
this._destroyOverlay();
this.element
.removeUniqueId()
.css(this.originalCss)
.detach();
this.uiDialog.remove();
if(this.originalTitle){
this.element.attr("title", this.originalTitle);
}
next=originalPosition.parent.children().eq(originalPosition.index);
if(next.length&&next[ 0 ]!==this.element[ 0 ]){
next.before(this.element);
}else{
originalPosition.parent.append(this.element);
}},
widget: function(){
return this.uiDialog;
},
disable: $.noop,
enable: $.noop,
close: function(event){
var that=this;
if(!this._isOpen||this._trigger("beforeClose", event)===false){
return;
}
this._isOpen=false;
this._focusedElement=null;
this._destroyOverlay();
this._untrackInstance();
if(!this.opener.filter(":focusable").trigger("focus").length){
$.ui.safeBlur($.ui.safeActiveElement(this.document[ 0 ]) );
}
this._hide(this.uiDialog, this.options.hide, function(){
that._trigger("close", event);
});
},
isOpen: function(){
return this._isOpen;
},
moveToTop: function(){
this._moveToTop();
},
_moveToTop: function(event, silent){
var moved=false,
zIndices=this.uiDialog.siblings(".ui-front:visible").map(function(){
return +$(this).css("z-index");
}).get(),
zIndexMax=Math.max.apply(null, zIndices);
if(zIndexMax >=+this.uiDialog.css("z-index") ){
this.uiDialog.css("z-index", zIndexMax + 1);
moved=true;
}
if(moved&&!silent){
this._trigger("focus", event);
}
return moved;
},
open: function(){
var that=this;
if(this._isOpen){
if(this._moveToTop()){
this._focusTabbable();
}
return;
}
this._isOpen=true;
this.opener=$($.ui.safeActiveElement(this.document[ 0 ]) );
this._size();
this._position();
this._createOverlay();
this._moveToTop(null, true);
if(this.overlay){
this.overlay.css("z-index", this.uiDialog.css("z-index") - 1);
}
this._show(this.uiDialog, this.options.show, function(){
that._focusTabbable();
that._trigger("focus");
});
this._makeFocusTarget();
this._trigger("open");
},
_focusTabbable: function(){
var hasFocus=this._focusedElement;
if(!hasFocus){
hasFocus=this.element.find("[autofocus]");
}
if(!hasFocus.length){
hasFocus=this.element.find(":tabbable");
}
if(!hasFocus.length){
hasFocus=this.uiDialogButtonPane.find(":tabbable");
}
if(!hasFocus.length){
hasFocus=this.uiDialogTitlebarClose.filter(":tabbable");
}
if(!hasFocus.length){
hasFocus=this.uiDialog;
}
hasFocus.eq(0).trigger("focus");
},
_keepFocus: function(event){
function checkFocus(){
var activeElement=$.ui.safeActiveElement(this.document[ 0 ]),
isActive=this.uiDialog[ 0 ]===activeElement ||
$.contains(this.uiDialog[ 0 ], activeElement);
if(!isActive){
this._focusTabbable();
}}
event.preventDefault();
checkFocus.call(this);
this._delay(checkFocus);
},
_createWrapper: function(){
this.uiDialog=$("<div>")
.hide()
.attr({
tabIndex: -1,
role: "dialog"
})
.appendTo(this._appendTo());
this._addClass(this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front");
this._on(this.uiDialog, {
keydown: function(event){
if(this.options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode &&
event.keyCode===$.ui.keyCode.ESCAPE){
event.preventDefault();
this.close(event);
return;
}
if(event.keyCode!==$.ui.keyCode.TAB||event.isDefaultPrevented()){
return;
}
var tabbables=this.uiDialog.find(":tabbable"),
first=tabbables.filter(":first"),
last=tabbables.filter(":last");
if(( event.target===last[ 0 ]||event.target===this.uiDialog[ 0 ]) &&
!event.shiftKey){
this._delay(function(){
first.trigger("focus");
});
event.preventDefault();
}else if(( event.target===first[ 0 ] ||
event.target===this.uiDialog[ 0 ])&&event.shiftKey){
this._delay(function(){
last.trigger("focus");
});
event.preventDefault();
}},
mousedown: function(event){
if(this._moveToTop(event) ){
this._focusTabbable();
}}
});
if(!this.element.find("[aria-describedby]").length){
this.uiDialog.attr({
"aria-describedby": this.element.uniqueId().attr("id")
});
}},
_createTitlebar: function(){
var uiDialogTitle;
this.uiDialogTitlebar=$("<div>");
this._addClass(this.uiDialogTitlebar,
"ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix");
this._on(this.uiDialogTitlebar, {
mousedown: function(event){
if(!$(event.target).closest(".ui-dialog-titlebar-close") ){
this.uiDialog.trigger("focus");
}}
});
this.uiDialogTitlebarClose=$("<button type='button'></button>")
.button({
label: $("<a>").text(this.options.closeText).html(),
icon: "ui-icon-closethick",
showLabel: false
})
.appendTo(this.uiDialogTitlebar);
this._addClass(this.uiDialogTitlebarClose, "ui-dialog-titlebar-close");
this._on(this.uiDialogTitlebarClose, {
click: function(event){
event.preventDefault();
this.close(event);
}});
uiDialogTitle=$("<span>").uniqueId().prependTo(this.uiDialogTitlebar);
this._addClass(uiDialogTitle, "ui-dialog-title");
this._title(uiDialogTitle);
this.uiDialogTitlebar.prependTo(this.uiDialog);
this.uiDialog.attr({
"aria-labelledby": uiDialogTitle.attr("id")
});
},
_title: function(title){
if(this.options.title){
title.text(this.options.title);
}else{
title.html("&#160;");
}},
_createButtonPane: function(){
this.uiDialogButtonPane=$("<div>");
this._addClass(this.uiDialogButtonPane, "ui-dialog-buttonpane",
"ui-widget-content ui-helper-clearfix");
this.uiButtonSet=$("<div>")
.appendTo(this.uiDialogButtonPane);
this._addClass(this.uiButtonSet, "ui-dialog-buttonset");
this._createButtons();
},
_createButtons: function(){
var that=this,
buttons=this.options.buttons;
this.uiDialogButtonPane.remove();
this.uiButtonSet.empty();
if($.isEmptyObject(buttons)||($.isArray(buttons)&&!buttons.length) ){
this._removeClass(this.uiDialog, "ui-dialog-buttons");
return;
}
$.each(buttons, function(name, props){
var click, buttonOptions;
props=$.isFunction(props) ?
{ click: props, text: name } :
props;
props=$.extend({ type: "button" }, props);
click=props.click;
buttonOptions={
icon: props.icon,
iconPosition: props.iconPosition,
showLabel: props.showLabel
};
delete props.click;
delete props.icon;
delete props.iconPosition;
delete props.showLabel;
$("<button></button>", props)
.button(buttonOptions)
.appendTo(that.uiButtonSet)
.on("click", function(){
click.apply(that.element[ 0 ], arguments);
});
});
this._addClass(this.uiDialog, "ui-dialog-buttons");
this.uiDialogButtonPane.appendTo(this.uiDialog);
},
_makeDraggable: function(){
var that=this,
options=this.options;
function filteredUi(ui){
return {
position: ui.position,
offset: ui.offset
};}
this.uiDialog.draggable({
cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
handle: ".ui-dialog-titlebar",
containment: "document",
start: function(event, ui){
that._addClass($(this), "ui-dialog-dragging");
that._blockFrames();
that._trigger("dragStart", event, filteredUi(ui) );
},
drag: function(event, ui){
that._trigger("drag", event, filteredUi(ui) );
},
stop: function(event, ui){
var left=ui.offset.left - that.document.scrollLeft(),
top=ui.offset.top - that.document.scrollTop();
options.position={
my: "left top",
at: "left" +(left >=0 ? "+":"") + left + " " +
"top" +(top >=0 ? "+":"") + top,
of: that.window
};
that._removeClass($(this), "ui-dialog-dragging");
that._unblockFrames();
that._trigger("dragStop", event, filteredUi(ui) );
}});
},
_makeResizable: function(){
var that=this,
options=this.options,
handles=options.resizable,
position=this.uiDialog.css("position"),
resizeHandles=typeof handles==="string" ?
handles :
"n,e,s,w,se,sw,ne,nw";
function filteredUi(ui){
return {
originalPosition: ui.originalPosition,
originalSize: ui.originalSize,
position: ui.position,
size: ui.size
};}
this.uiDialog.resizable({
cancel: ".ui-dialog-content",
containment: "document",
alsoResize: this.element,
maxWidth: options.maxWidth,
maxHeight: options.maxHeight,
minWidth: options.minWidth,
minHeight: this._minHeight(),
handles: resizeHandles,
start: function(event, ui){
that._addClass($(this), "ui-dialog-resizing");
that._blockFrames();
that._trigger("resizeStart", event, filteredUi(ui) );
},
resize: function(event, ui){
that._trigger("resize", event, filteredUi(ui) );
},
stop: function(event, ui){
var offset=that.uiDialog.offset(),
left=offset.left - that.document.scrollLeft(),
top=offset.top - that.document.scrollTop();
options.height=that.uiDialog.height();
options.width=that.uiDialog.width();
options.position={
my: "left top",
at: "left" +(left >=0 ? "+":"") + left + " " +
"top" +(top >=0 ? "+":"") + top,
of: that.window
};
that._removeClass($(this), "ui-dialog-resizing");
that._unblockFrames();
that._trigger("resizeStop", event, filteredUi(ui) );
}})
.css("position", position);
},
_trackFocus: function(){
this._on(this.widget(), {
focusin: function(event){
this._makeFocusTarget();
this._focusedElement=$(event.target);
}});
},
_makeFocusTarget: function(){
this._untrackInstance();
this._trackingInstances().unshift(this);
},
_untrackInstance: function(){
var instances=this._trackingInstances(),
exists=$.inArray(this, instances);
if(exists!==-1){
instances.splice(exists, 1);
}},
_trackingInstances: function(){
var instances=this.document.data("ui-dialog-instances");
if(!instances){
instances=[];
this.document.data("ui-dialog-instances", instances);
}
return instances;
},
_minHeight: function(){
var options=this.options;
return options.height==="auto" ?
options.minHeight :
Math.min(options.minHeight, options.height);
},
_position: function(){
var isVisible=this.uiDialog.is(":visible");
if(!isVisible){
this.uiDialog.show();
}
this.uiDialog.position(this.options.position);
if(!isVisible){
this.uiDialog.hide();
}},
_setOptions: function(options){
var that=this,
resize=false,
resizableOptions={};
$.each(options, function(key, value){
that._setOption(key, value);
if(key in that.sizeRelatedOptions){
resize=true;
}
if(key in that.resizableRelatedOptions){
resizableOptions[ key ]=value;
}});
if(resize){
this._size();
this._position();
}
if(this.uiDialog.is(":data(ui-resizable)") ){
this.uiDialog.resizable("option", resizableOptions);
}},
_setOption: function(key, value){
var isDraggable, isResizable,
uiDialog=this.uiDialog;
if(key==="disabled"){
return;
}
this._super(key, value);
if(key==="appendTo"){
this.uiDialog.appendTo(this._appendTo());
}
if(key==="buttons"){
this._createButtons();
}
if(key==="closeText"){
this.uiDialogTitlebarClose.button({
label: $("<a>").text("" + this.options.closeText).html()
});
}
if(key==="draggable"){
isDraggable=uiDialog.is(":data(ui-draggable)");
if(isDraggable&&!value){
uiDialog.draggable("destroy");
}
if(!isDraggable&&value){
this._makeDraggable();
}}
if(key==="position"){
this._position();
}
if(key==="resizable"){
isResizable=uiDialog.is(":data(ui-resizable)");
if(isResizable&&!value){
uiDialog.resizable("destroy");
}
if(isResizable&&typeof value==="string"){
uiDialog.resizable("option", "handles", value);
}
if(!isResizable&&value!==false){
this._makeResizable();
}}
if(key==="title"){
this._title(this.uiDialogTitlebar.find(".ui-dialog-title") );
}},
_size: function(){
var nonContentHeight, minContentHeight, maxContentHeight,
options=this.options;
this.element.show().css({
width: "auto",
minHeight: 0,
maxHeight: "none",
height: 0
});
if(options.minWidth > options.width){
options.width=options.minWidth;
}
nonContentHeight=this.uiDialog.css({
height: "auto",
width: options.width
})
.outerHeight();
minContentHeight=Math.max(0, options.minHeight - nonContentHeight);
maxContentHeight=typeof options.maxHeight==="number" ?
Math.max(0, options.maxHeight - nonContentHeight) :
"none";
if(options.height==="auto"){
this.element.css({
minHeight: minContentHeight,
maxHeight: maxContentHeight,
height: "auto"
});
}else{
this.element.height(Math.max(0, options.height - nonContentHeight) );
}
if(this.uiDialog.is(":data(ui-resizable)") ){
this.uiDialog.resizable("option", "minHeight", this._minHeight());
}},
_blockFrames: function(){
this.iframeBlocks=this.document.find("iframe").map(function(){
var iframe=$(this);
return $("<div>")
.css({
position: "absolute",
width: iframe.outerWidth(),
height: iframe.outerHeight()
})
.appendTo(iframe.parent())
.offset(iframe.offset())[ 0 ];
});
},
_unblockFrames: function(){
if(this.iframeBlocks){
this.iframeBlocks.remove();
delete this.iframeBlocks;
}},
_allowInteraction: function(event){
if($(event.target).closest(".ui-dialog").length){
return true;
}
return !!$(event.target).closest(".ui-datepicker").length;
},
_createOverlay: function(){
if(!this.options.modal){
return;
}
var isOpening=true;
this._delay(function(){
isOpening=false;
});
if(!this.document.data("ui-dialog-overlays") ){
this._on(this.document, {
focusin: function(event){
if(isOpening){
return;
}
if(!this._allowInteraction(event) ){
event.preventDefault();
this._trackingInstances()[ 0 ]._focusTabbable();
}}
});
}
this.overlay=$("<div>")
.appendTo(this._appendTo());
this._addClass(this.overlay, null, "ui-widget-overlay ui-front");
this._on(this.overlay, {
mousedown: "_keepFocus"
});
this.document.data("ui-dialog-overlays",
(this.document.data("ui-dialog-overlays")||0) + 1);
},
_destroyOverlay: function(){
if(!this.options.modal){
return;
}
if(this.overlay){
var overlays=this.document.data("ui-dialog-overlays") - 1;
if(!overlays){
this._off(this.document, "focusin");
this.document.removeData("ui-dialog-overlays");
}else{
this.document.data("ui-dialog-overlays", overlays);
}
this.overlay.remove();
this.overlay=null;
}}
});
if($.uiBackCompat!==false){
$.widget("ui.dialog", $.ui.dialog, {
options: {
dialogClass: ""
},
_createWrapper: function(){
this._super();
this.uiDialog.addClass(this.options.dialogClass);
},
_setOption: function(key, value){
if(key==="dialogClass"){
this.uiDialog
.removeClass(this.options.dialogClass)
.addClass(value);
}
this._superApply(arguments);
}});
}
var widgetsDialog=$.ui.dialog;
$.widget("ui.droppable", {
version: "1.12.0",
widgetEventPrefix: "drop",
options: {
accept: "*",
addClasses: true,
greedy: false,
scope: "default",
tolerance: "intersect",
activate: null,
deactivate: null,
drop: null,
out: null,
over: null
},
_create: function(){
var proportions,
o=this.options,
accept=o.accept;
this.isover=false;
this.isout=true;
this.accept=$.isFunction(accept) ? accept:function(d){
return d.is(accept);
};
this.proportions=function(){
if(arguments.length){
proportions=arguments[ 0 ];
}else{
return proportions ?
proportions :
proportions={
width: this.element[ 0 ].offsetWidth,
height: this.element[ 0 ].offsetHeight
};}};
this._addToManager(o.scope);
o.addClasses&&this._addClass("ui-droppable");
},
_addToManager: function(scope){
$.ui.ddmanager.droppables[ scope ]=$.ui.ddmanager.droppables[ scope ]||[];
$.ui.ddmanager.droppables[ scope ].push(this);
},
_splice: function(drop){
var i=0;
for(; i < drop.length; i++){
if(drop[ i ]===this){
drop.splice(i, 1);
}}
},
_destroy: function(){
var drop=$.ui.ddmanager.droppables[ this.options.scope ];
this._splice(drop);
},
_setOption: function(key, value){
if(key==="accept"){
this.accept=$.isFunction(value) ? value:function(d){
return d.is(value);
};}else if(key==="scope"){
var drop=$.ui.ddmanager.droppables[ this.options.scope ];
this._splice(drop);
this._addToManager(value);
}
this._super(key, value);
},
_activate: function(event){
var draggable=$.ui.ddmanager.current;
this._addActiveClass();
if(draggable){
this._trigger("activate", event, this.ui(draggable) );
}},
_deactivate: function(event){
var draggable=$.ui.ddmanager.current;
this._removeActiveClass();
if(draggable){
this._trigger("deactivate", event, this.ui(draggable) );
}},
_over: function(event){
var draggable=$.ui.ddmanager.current;
if(!draggable||(draggable.currentItem ||
draggable.element)[ 0 ]===this.element[ 0 ]){
return;
}
if(this.accept.call(this.element[ 0 ],(draggable.currentItem ||
draggable.element) )){
this._addHoverClass();
this._trigger("over", event, this.ui(draggable) );
}},
_out: function(event){
var draggable=$.ui.ddmanager.current;
if(!draggable||(draggable.currentItem ||
draggable.element)[ 0 ]===this.element[ 0 ]){
return;
}
if(this.accept.call(this.element[ 0 ],(draggable.currentItem ||
draggable.element) )){
this._removeHoverClass();
this._trigger("out", event, this.ui(draggable) );
}},
_drop: function(event, custom){
var draggable=custom||$.ui.ddmanager.current,
childrenIntersection=false;
if(!draggable||(draggable.currentItem ||
draggable.element)[ 0 ]===this.element[ 0 ]){
return false;
}
this.element
.find(":data(ui-droppable)")
.not(".ui-draggable-dragging")
.each(function(){
var inst=$(this).droppable("instance");
if(inst.options.greedy &&
!inst.options.disabled &&
inst.options.scope===draggable.options.scope &&
inst.accept.call(inst.element[ 0 ],(draggable.currentItem||draggable.element)
) &&
intersect(
draggable,
$.extend(inst, { offset: inst.element.offset() }),
inst.options.tolerance, event
)
){
childrenIntersection=true;
return false; }});
if(childrenIntersection){
return false;
}
if(this.accept.call(this.element[ 0 ],
(draggable.currentItem||draggable.element) )){
this._removeActiveClass();
this._removeHoverClass();
this._trigger("drop", event, this.ui(draggable) );
return this.element;
}
return false;
},
ui: function(c){
return {
draggable:(c.currentItem||c.element),
helper: c.helper,
position: c.position,
offset: c.positionAbs
};},
_addHoverClass: function(){
this._addClass("ui-droppable-hover");
},
_removeHoverClass: function(){
this._removeClass("ui-droppable-hover");
},
_addActiveClass: function(){
this._addClass("ui-droppable-active");
},
_removeActiveClass: function(){
this._removeClass("ui-droppable-active");
}});
var intersect=$.ui.intersect=(function(){
function isOverAxis(x, reference, size){
return(x >=reference)&&(x <(reference + size) );
}
return function(draggable, droppable, toleranceMode, event){
if(!droppable.offset){
return false;
}
var x1=(draggable.positionAbs ||
draggable.position.absolute).left + draggable.margins.left,
y1=(draggable.positionAbs ||
draggable.position.absolute).top + draggable.margins.top,
x2=x1 + draggable.helperProportions.width,
y2=y1 + draggable.helperProportions.height,
l=droppable.offset.left,
t=droppable.offset.top,
r=l + droppable.proportions().width,
b=t + droppable.proportions().height;
switch(toleranceMode){
case "fit":
return(l <=x1&&x2 <=r&&t <=y1&&y2 <=b);
case "intersect":
return(l < x1 +(draggable.helperProportions.width / 2) &&
x2 -(draggable.helperProportions.width / 2) < r &&
t < y1 +(draggable.helperProportions.height / 2) &&
y2 -(draggable.helperProportions.height / 2) < b);
case "pointer":
return isOverAxis(event.pageY, t, droppable.proportions().height) &&
isOverAxis(event.pageX, l, droppable.proportions().width);
case "touch":
return (
(y1 >=t&&y1 <=b) ||
(y2 >=t&&y2 <=b) ||
(y1 < t&&y2 > b)
)&&(
(x1 >=l&&x1 <=r) ||
(x2 >=l&&x2 <=r) ||
(x1 < l&&x2 > r)
);
default:
return false;
}};})();
$.ui.ddmanager={
current: null,
droppables: { "default": [] },
prepareOffsets: function(t, event){
var i, j,
m=$.ui.ddmanager.droppables[ t.options.scope ]||[],
type=event ? event.type:null,
list=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();
droppablesLoop: for(i=0; i < m.length; i++){
if(m[ i ].options.disabled||(t&&!m[ i ].accept.call(m[ i ].element[ 0 ],
(t.currentItem||t.element) )) ){
continue;
}
for(j=0; j < list.length; j++){
if(list[ j ]===m[ i ].element[ 0 ]){
m[ i ].proportions().height=0;
continue droppablesLoop;
}}
m[ i ].visible=m[ i ].element.css("display")!=="none";
if(!m[ i ].visible){
continue;
}
if(type==="mousedown"){
m[ i ]._activate.call(m[ i ], event);
}
m[ i ].offset=m[ i ].element.offset();
m[ i ].proportions({
width: m[ i ].element[ 0 ].offsetWidth,
height: m[ i ].element[ 0 ].offsetHeight
});
}},
drop: function(draggable, event){
var dropped=false;
$.each(( $.ui.ddmanager.droppables[ draggable.options.scope ]||[]).slice(), function(){
if(!this.options){
return;
}
if(!this.options.disabled&&this.visible &&
intersect(draggable, this, this.options.tolerance, event) ){
dropped=this._drop.call(this, event)||dropped;
}
if(!this.options.disabled&&this.visible&&this.accept.call(this.element[ 0 ],
(draggable.currentItem||draggable.element) )){
this.isout=true;
this.isover=false;
this._deactivate.call(this, event);
}});
return dropped;
},
dragStart: function(draggable, event){
draggable.element.parentsUntil("body").on("scroll.droppable", function(){
if(!draggable.options.refreshPositions){
$.ui.ddmanager.prepareOffsets(draggable, event);
}});
},
drag: function(draggable, event){
if(draggable.options.refreshPositions){
$.ui.ddmanager.prepareOffsets(draggable, event);
}
$.each($.ui.ddmanager.droppables[ draggable.options.scope ]||[], function(){
if(this.options.disabled||this.greedyChild||!this.visible){
return;
}
var parentInstance, scope, parent,
intersects=intersect(draggable, this, this.options.tolerance, event),
c = !intersects&&this.isover ?
"isout" :
(intersects&&!this.isover ? "isover":null);
if(!c){
return;
}
if(this.options.greedy){
scope=this.options.scope;
parent=this.element.parents(":data(ui-droppable)").filter(function(){
return $(this).droppable("instance").options.scope===scope;
});
if(parent.length){
parentInstance=$(parent[ 0 ]).droppable("instance");
parentInstance.greedyChild=(c==="isover");
}}
if(parentInstance&&c==="isover"){
parentInstance.isover=false;
parentInstance.isout=true;
parentInstance._out.call(parentInstance, event);
}
this[ c ]=true;
this[ c==="isout" ? "isover":"isout" ]=false;
this[ c==="isover" ? "_over":"_out" ].call(this, event);
if(parentInstance&&c==="isout"){
parentInstance.isout=false;
parentInstance.isover=true;
parentInstance._over.call(parentInstance, event);
}});
},
dragStop: function(draggable, event){
draggable.element.parentsUntil("body").off("scroll.droppable");
if(!draggable.options.refreshPositions){
$.ui.ddmanager.prepareOffsets(draggable, event);
}}
};
if($.uiBackCompat!==false){
$.widget("ui.droppable", $.ui.droppable, {
options: {
hoverClass: false,
activeClass: false
},
_addActiveClass: function(){
this._super();
if(this.options.activeClass){
this.element.addClass(this.options.activeClass);
}},
_removeActiveClass: function(){
this._super();
if(this.options.activeClass){
this.element.removeClass(this.options.activeClass);
}},
_addHoverClass: function(){
this._super();
if(this.options.hoverClass){
this.element.addClass(this.options.hoverClass);
}},
_removeHoverClass: function(){
this._super();
if(this.options.hoverClass){
this.element.removeClass(this.options.hoverClass);
}}
});
}
var widgetsDroppable=$.ui.droppable;
var widgetsProgressbar=$.widget("ui.progressbar", {
version: "1.12.0",
options: {
classes: {
"ui-progressbar": "ui-corner-all",
"ui-progressbar-value": "ui-corner-left",
"ui-progressbar-complete": "ui-corner-right"
},
max: 100,
value: 0,
change: null,
complete: null
},
min: 0,
_create: function(){
this.oldValue=this.options.value=this._constrainedValue();
this.element.attr({
role: "progressbar",
"aria-valuemin": this.min
});
this._addClass("ui-progressbar", "ui-widget ui-widget-content");
this.valueDiv=$("<div>").appendTo(this.element);
this._addClass(this.valueDiv, "ui-progressbar-value", "ui-widget-header");
this._refreshValue();
},
_destroy: function(){
this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow");
this.valueDiv.remove();
},
value: function(newValue){
if(newValue===undefined){
return this.options.value;
}
this.options.value=this._constrainedValue(newValue);
this._refreshValue();
},
_constrainedValue: function(newValue){
if(newValue===undefined){
newValue=this.options.value;
}
this.indeterminate=newValue===false;
if(typeof newValue!=="number"){
newValue=0;
}
return this.indeterminate ? false :
Math.min(this.options.max, Math.max(this.min, newValue) );
},
_setOptions: function(options){
var value=options.value;
delete options.value;
this._super(options);
this.options.value=this._constrainedValue(value);
this._refreshValue();
},
_setOption: function(key, value){
if(key==="max"){
value=Math.max(this.min, value);
}
this._super(key, value);
},
_setOptionDisabled: function(value){
this._super(value);
this.element.attr("aria-disabled", value);
this._toggleClass(null, "ui-state-disabled", !!value);
},
_percentage: function(){
return this.indeterminate ?
100 :
100 *(this.options.value - this.min) /(this.options.max - this.min);
},
_refreshValue: function(){
var value=this.options.value,
percentage=this._percentage();
this.valueDiv
.toggle(this.indeterminate||value > this.min)
.width(percentage.toFixed(0) + "%");
this
._toggleClass(this.valueDiv, "ui-progressbar-complete", null,
value===this.options.max)
._toggleClass("ui-progressbar-indeterminate", null, this.indeterminate);
if(this.indeterminate){
this.element.removeAttr("aria-valuenow");
if(!this.overlayDiv){
this.overlayDiv=$("<div>").appendTo(this.valueDiv);
this._addClass(this.overlayDiv, "ui-progressbar-overlay");
}}else{
this.element.attr({
"aria-valuemax": this.options.max,
"aria-valuenow": value
});
if(this.overlayDiv){
this.overlayDiv.remove();
this.overlayDiv=null;
}}
if(this.oldValue!==value){
this.oldValue=value;
this._trigger("change");
}
if(value===this.options.max){
this._trigger("complete");
}}
});
var widgetsSelectable=$.widget("ui.selectable", $.ui.mouse, {
version: "1.12.0",
options: {
appendTo: "body",
autoRefresh: true,
distance: 0,
filter: "*",
tolerance: "touch",
selected: null,
selecting: null,
start: null,
stop: null,
unselected: null,
unselecting: null
},
_create: function(){
var that=this;
this._addClass("ui-selectable");
this.dragged=false;
this.refresh=function(){
that.elementPos=$(that.element[ 0 ]).offset();
that.selectees=$(that.options.filter, that.element[ 0 ]);
that._addClass(that.selectees, "ui-selectee");
that.selectees.each(function(){
var $this=$(this),
selecteeOffset=$this.offset(),
pos={
left: selecteeOffset.left - that.elementPos.left,
top: selecteeOffset.top - that.elementPos.top
};
$.data(this, "selectable-item", {
element: this,
$element: $this,
left: pos.left,
top: pos.top,
right: pos.left + $this.outerWidth(),
bottom: pos.top + $this.outerHeight(),
startselected: false,
selected: $this.hasClass("ui-selected"),
selecting: $this.hasClass("ui-selecting"),
unselecting: $this.hasClass("ui-unselecting")
});
});
};
this.refresh();
this._mouseInit();
this.helper=$("<div>");
this._addClass(this.helper, "ui-selectable-helper");
},
_destroy: function(){
this.selectees.removeData("selectable-item");
this._mouseDestroy();
},
_mouseStart: function(event){
var that=this,
options=this.options;
this.opos=[ event.pageX, event.pageY ];
this.elementPos=$(this.element[ 0 ]).offset();
if(this.options.disabled){
return;
}
this.selectees=$(options.filter, this.element[ 0 ]);
this._trigger("start", event);
$(options.appendTo).append(this.helper);
this.helper.css({
"left": event.pageX,
"top": event.pageY,
"width": 0,
"height": 0
});
if(options.autoRefresh){
this.refresh();
}
this.selectees.filter(".ui-selected").each(function(){
var selectee=$.data(this, "selectable-item");
selectee.startselected=true;
if(!event.metaKey&&!event.ctrlKey){
that._removeClass(selectee.$element, "ui-selected");
selectee.selected=false;
that._addClass(selectee.$element, "ui-unselecting");
selectee.unselecting=true;
that._trigger("unselecting", event, {
unselecting: selectee.element
});
}});
$(event.target).parents().addBack().each(function(){
var doSelect,
selectee=$.data(this, "selectable-item");
if(selectee){
doSelect=(!event.metaKey&&!event.ctrlKey) ||
!selectee.$element.hasClass("ui-selected");
that._removeClass(selectee.$element, doSelect ? "ui-unselecting":"ui-selected")
._addClass(selectee.$element, doSelect ? "ui-selecting":"ui-unselecting");
selectee.unselecting = !doSelect;
selectee.selecting=doSelect;
selectee.selected=doSelect;
if(doSelect){
that._trigger("selecting", event, {
selecting: selectee.element
});
}else{
that._trigger("unselecting", event, {
unselecting: selectee.element
});
}
return false;
}});
},
_mouseDrag: function(event){
this.dragged=true;
if(this.options.disabled){
return;
}
var tmp,
that=this,
options=this.options,
x1=this.opos[ 0 ],
y1=this.opos[ 1 ],
x2=event.pageX,
y2=event.pageY;
if(x1 > x2){ tmp=x2; x2=x1; x1=tmp; }
if(y1 > y2){ tmp=y2; y2=y1; y1=tmp; }
this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
this.selectees.each(function(){
var selectee=$.data(this, "selectable-item"),
hit=false,
offset={};
if(!selectee||selectee.element===that.element[ 0 ]){
return;
}
offset.left=selectee.left   + that.elementPos.left;
offset.right=selectee.right  + that.elementPos.left;
offset.top=selectee.top    + that.elementPos.top;
offset.bottom=selectee.bottom + that.elementPos.top;
if(options.tolerance==="touch"){
hit=(!(offset.left > x2||offset.right < x1||offset.top > y2 ||
offset.bottom < y1) );
}else if(options.tolerance==="fit"){
hit=(offset.left > x1&&offset.right < x2&&offset.top > y1 &&
offset.bottom < y2);
}
if(hit){
if(selectee.selected){
that._removeClass(selectee.$element, "ui-selected");
selectee.selected=false;
}
if(selectee.unselecting){
that._removeClass(selectee.$element, "ui-unselecting");
selectee.unselecting=false;
}
if(!selectee.selecting){
that._addClass(selectee.$element, "ui-selecting");
selectee.selecting=true;
that._trigger("selecting", event, {
selecting: selectee.element
});
}}else{
if(selectee.selecting){
if(( event.metaKey||event.ctrlKey)&&selectee.startselected){
that._removeClass(selectee.$element, "ui-selecting");
selectee.selecting=false;
that._addClass(selectee.$element, "ui-selected");
selectee.selected=true;
}else{
that._removeClass(selectee.$element, "ui-selecting");
selectee.selecting=false;
if(selectee.startselected){
that._addClass(selectee.$element, "ui-unselecting");
selectee.unselecting=true;
}
that._trigger("unselecting", event, {
unselecting: selectee.element
});
}}
if(selectee.selected){
if(!event.metaKey&&!event.ctrlKey&&!selectee.startselected){
that._removeClass(selectee.$element, "ui-selected");
selectee.selected=false;
that._addClass(selectee.$element, "ui-unselecting");
selectee.unselecting=true;
that._trigger("unselecting", event, {
unselecting: selectee.element
});
}}
}});
return false;
},
_mouseStop: function(event){
var that=this;
this.dragged=false;
$(".ui-unselecting", this.element[ 0 ]).each(function(){
var selectee=$.data(this, "selectable-item");
that._removeClass(selectee.$element, "ui-unselecting");
selectee.unselecting=false;
selectee.startselected=false;
that._trigger("unselected", event, {
unselected: selectee.element
});
});
$(".ui-selecting", this.element[ 0 ]).each(function(){
var selectee=$.data(this, "selectable-item");
that._removeClass(selectee.$element, "ui-selecting")
._addClass(selectee.$element, "ui-selected");
selectee.selecting=false;
selectee.selected=true;
selectee.startselected=true;
that._trigger("selected", event, {
selected: selectee.element
});
});
this._trigger("stop", event);
this.helper.remove();
return false;
}});
var widgetsSelectmenu=$.widget("ui.selectmenu", [ $.ui.formResetMixin, {
version: "1.12.0",
defaultElement: "<select>",
options: {
appendTo: null,
classes: {
"ui-selectmenu-button-open": "ui-corner-top",
"ui-selectmenu-button-closed": "ui-corner-all"
},
disabled: null,
icons: {
button: "ui-icon-triangle-1-s"
},
position: {
my: "left top",
at: "left bottom",
collision: "none"
},
width: false,
change: null,
close: null,
focus: null,
open: null,
select: null
},
_create: function(){
var selectmenuId=this.element.uniqueId().attr("id");
this.ids={
element: selectmenuId,
button: selectmenuId + "-button",
menu: selectmenuId + "-menu"
};
this._drawButton();
this._drawMenu();
this._bindFormResetHandler();
this._rendered=false;
this.menuItems=$();
},
_drawButton: function(){
var icon,
that=this,
item=this._parseOption(this.element.find("option:selected"),
this.element[ 0 ].selectedIndex
);
this.labels=this.element.labels().attr("for", this.ids.button);
this._on(this.labels, {
click: function(event){
this.button.focus();
event.preventDefault();
}});
this.element.hide();
this.button=$("<span>", {
tabindex: this.options.disabled ? -1:0,
id: this.ids.button,
role: "combobox",
"aria-expanded": "false",
"aria-autocomplete": "list",
"aria-owns": this.ids.menu,
"aria-haspopup": "true",
title: this.element.attr("title")
})
.insertAfter(this.element);
this._addClass(this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
"ui-button ui-widget");
icon=$("<span>").appendTo(this.button);
this._addClass(icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button);
this.buttonItem=this._renderButtonItem(item)
.appendTo(this.button);
if(this.options.width!==false){
this._resizeButton();
}
this._on(this.button, this._buttonEvents);
this.button.one("focusin", function(){
if(!that._rendered){
that._refreshMenu();
}});
},
_drawMenu: function(){
var that=this;
this.menu=$("<ul>", {
"aria-hidden": "true",
"aria-labelledby": this.ids.button,
id: this.ids.menu
});
this.menuWrap=$("<div>").append(this.menu);
this._addClass(this.menuWrap, "ui-selectmenu-menu", "ui-front");
this.menuWrap.appendTo(this._appendTo());
this.menuInstance=this.menu
.menu({
classes: {
"ui-menu": "ui-corner-bottom"
},
role: "listbox",
select: function(event, ui){
event.preventDefault();
that._setSelection();
that._select(ui.item.data("ui-selectmenu-item"), event);
},
focus: function(event, ui){
var item=ui.item.data("ui-selectmenu-item");
if(that.focusIndex!=null&&item.index!==that.focusIndex){
that._trigger("focus", event, { item: item });
if(!that.isOpen){
that._select(item, event);
}}
that.focusIndex=item.index;
that.button.attr("aria-activedescendant",
that.menuItems.eq(item.index).attr("id") );
}})
.menu("instance");
this.menuInstance._off(this.menu, "mouseleave");
this.menuInstance._closeOnDocumentClick=function(){
return false;
};
this.menuInstance._isDivider=function(){
return false;
};},
refresh: function(){
this._refreshMenu();
this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{}
)
);
if(this.options.width===null){
this._resizeButton();
}},
_refreshMenu: function(){
var item,
options=this.element.find("option");
this.menu.empty();
this._parseOptions(options);
this._renderMenu(this.menu, this.items);
this.menuInstance.refresh();
this.menuItems=this.menu.find("li")
.not(".ui-selectmenu-optgroup")
.find(".ui-menu-item-wrapper");
this._rendered=true;
if(!options.length){
return;
}
item=this._getSelectedItem();
this.menuInstance.focus(null, item);
this._setAria(item.data("ui-selectmenu-item") );
this._setOption("disabled", this.element.prop("disabled") );
},
open: function(event){
if(this.options.disabled){
return;
}
if(!this._rendered){
this._refreshMenu();
}else{
this._removeClass(this.menu.find(".ui-state-active"), null, "ui-state-active");
this.menuInstance.focus(null, this._getSelectedItem());
}
if(!this.menuItems.length){
return;
}
this.isOpen=true;
this._toggleAttr();
this._resizeMenu();
this._position();
this._on(this.document, this._documentClick);
this._trigger("open", event);
},
_position: function(){
this.menuWrap.position($.extend({ of: this.button }, this.options.position) );
},
close: function(event){
if(!this.isOpen){
return;
}
this.isOpen=false;
this._toggleAttr();
this.range=null;
this._off(this.document);
this._trigger("close", event);
},
widget: function(){
return this.button;
},
menuWidget: function(){
return this.menu;
},
_renderButtonItem: function(item){
var buttonItem=$("<span>");
this._setText(buttonItem, item.label);
this._addClass(buttonItem, "ui-selectmenu-text");
return buttonItem;
},
_renderMenu: function(ul, items){
var that=this,
currentOptgroup="";
$.each(items, function(index, item){
var li;
if(item.optgroup!==currentOptgroup){
li=$("<li>", {
text: item.optgroup
});
that._addClass(li, "ui-selectmenu-optgroup", "ui-menu-divider" +
(item.element.parent("optgroup").prop("disabled") ?
" ui-state-disabled" :
"") );
li.appendTo(ul);
currentOptgroup=item.optgroup;
}
that._renderItemData(ul, item);
});
},
_renderItemData: function(ul, item){
return this._renderItem(ul, item).data("ui-selectmenu-item", item);
},
_renderItem: function(ul, item){
var li=$("<li>"),
wrapper=$("<div>", {
title: item.element.attr("title")
});
if(item.disabled){
this._addClass(li, null, "ui-state-disabled");
}
this._setText(wrapper, item.label);
return li.append(wrapper).appendTo(ul);
},
_setText: function(element, value){
if(value){
element.text(value);
}else{
element.html("&#160;");
}},
_move: function(direction, event){
var item, next,
filter=".ui-menu-item";
if(this.isOpen){
item=this.menuItems.eq(this.focusIndex).parent("li");
}else{
item=this.menuItems.eq(this.element[ 0 ].selectedIndex).parent("li");
filter +=":not(.ui-state-disabled)";
}
if(direction==="first"||direction==="last"){
next=item[ direction==="first" ? "prevAll":"nextAll" ](filter).eq(-1);
}else{
next=item[ direction + "All" ](filter).eq(0);
}
if(next.length){
this.menuInstance.focus(event, next);
}},
_getSelectedItem: function(){
return this.menuItems.eq(this.element[ 0 ].selectedIndex).parent("li");
},
_toggle: function(event){
this[ this.isOpen ? "close":"open" ](event);
},
_setSelection: function(){
var selection;
if(!this.range){
return;
}
if(window.getSelection){
selection=window.getSelection();
selection.removeAllRanges();
selection.addRange(this.range);
}else{
this.range.select();
}
this.button.focus();
},
_documentClick: {
mousedown: function(event){
if(!this.isOpen){
return;
}
if(!$(event.target).closest(".ui-selectmenu-menu, #" +
$.ui.escapeSelector(this.ids.button) ).length){
this.close(event);
}}
},
_buttonEvents: {
mousedown: function(){
var selection;
if(window.getSelection){
selection=window.getSelection();
if(selection.rangeCount){
this.range=selection.getRangeAt(0);
}}else{
this.range=document.selection.createRange();
}},
click: function(event){
this._setSelection();
this._toggle(event);
},
keydown: function(event){
var preventDefault=true;
switch(event.keyCode){
case $.ui.keyCode.TAB:
case $.ui.keyCode.ESCAPE:
this.close(event);
preventDefault=false;
break;
case $.ui.keyCode.ENTER:
if(this.isOpen){
this._selectFocusedItem(event);
}
break;
case $.ui.keyCode.UP:
if(event.altKey){
this._toggle(event);
}else{
this._move("prev", event);
}
break;
case $.ui.keyCode.DOWN:
if(event.altKey){
this._toggle(event);
}else{
this._move("next", event);
}
break;
case $.ui.keyCode.SPACE:
if(this.isOpen){
this._selectFocusedItem(event);
}else{
this._toggle(event);
}
break;
case $.ui.keyCode.LEFT:
this._move("prev", event);
break;
case $.ui.keyCode.RIGHT:
this._move("next", event);
break;
case $.ui.keyCode.HOME:
case $.ui.keyCode.PAGE_UP:
this._move("first", event);
break;
case $.ui.keyCode.END:
case $.ui.keyCode.PAGE_DOWN:
this._move("last", event);
break;
default:
this.menu.trigger(event);
preventDefault=false;
}
if(preventDefault){
event.preventDefault();
}}
},
_selectFocusedItem: function(event){
var item=this.menuItems.eq(this.focusIndex).parent("li");
if(!item.hasClass("ui-state-disabled") ){
this._select(item.data("ui-selectmenu-item"), event);
}},
_select: function(item, event){
var oldIndex=this.element[ 0 ].selectedIndex;
this.element[ 0 ].selectedIndex=item.index;
this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(item) );
this._setAria(item);
this._trigger("select", event, { item: item });
if(item.index!==oldIndex){
this._trigger("change", event, { item: item });
}
this.close(event);
},
_setAria: function(item){
var id=this.menuItems.eq(item.index).attr("id");
this.button.attr({
"aria-labelledby": id,
"aria-activedescendant": id
});
this.menu.attr("aria-activedescendant", id);
},
_setOption: function(key, value){
if(key==="icons"){
var icon=this.button.find("span.ui-icon");
this._removeClass(icon, null, this.options.icons.button)
._addClass(icon, null, value.button);
}
this._super(key, value);
if(key==="appendTo"){
this.menuWrap.appendTo(this._appendTo());
}
if(key==="width"){
this._resizeButton();
}},
_setOptionDisabled: function(value){
this._super(value);
this.menuInstance.option("disabled", value);
this.button.attr("aria-disabled", value);
this._toggleClass(this.button, null, "ui-state-disabled", value);
this.element.prop("disabled", value);
if(value){
this.button.attr("tabindex", -1);
this.close();
}else{
this.button.attr("tabindex", 0);
}},
_appendTo: function(){
var element=this.options.appendTo;
if(element){
element=element.jquery||element.nodeType ?
$(element) :
this.document.find(element).eq(0);
}
if(!element||!element[ 0 ]){
element=this.element.closest(".ui-front, dialog");
}
if(!element.length){
element=this.document[ 0 ].body;
}
return element;
},
_toggleAttr: function(){
this.button.attr("aria-expanded", this.isOpen);
this._removeClass(this.button, "ui-selectmenu-button-" +
(this.isOpen ? "closed":"open") )
._addClass(this.button, "ui-selectmenu-button-" +
(this.isOpen ? "open":"closed") )
._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen);
this.menu.attr("aria-hidden", !this.isOpen);
},
_resizeButton: function(){
var width=this.options.width;
if(width===false){
this.button.css("width", "");
return;
}
if(width===null){
width=this.element.show().outerWidth();
this.element.hide();
}
this.button.outerWidth(width);
},
_resizeMenu: function(){
this.menu.outerWidth(Math.max(this.button.outerWidth(),
this.menu.width("").outerWidth() + 1
));
},
_getCreateOptions: function(){
var options=this._super();
options.disabled=this.element.prop("disabled");
return options;
},
_parseOptions: function(options){
var that=this,
data=[];
options.each(function(index, item){
data.push(that._parseOption($(item), index) );
});
this.items=data;
},
_parseOption: function(option, index){
var optgroup=option.parent("optgroup");
return {
element: option,
index: index,
value: option.val(),
label: option.text(),
optgroup: optgroup.attr("label")||"",
disabled: optgroup.prop("disabled")||option.prop("disabled")
};},
_destroy: function(){
this._unbindFormResetHandler();
this.menuWrap.remove();
this.button.remove();
this.element.show();
this.element.removeUniqueId();
this.labels.attr("for", this.ids.element);
}} ]);
var widgetsSlider=$.widget("ui.slider", $.ui.mouse, {
version: "1.12.0",
widgetEventPrefix: "slide",
options: {
animate: false,
classes: {
"ui-slider": "ui-corner-all",
"ui-slider-handle": "ui-corner-all",
"ui-slider-range": "ui-corner-all ui-widget-header"
},
distance: 0,
max: 100,
min: 0,
orientation: "horizontal",
range: false,
step: 1,
value: 0,
values: null,
change: null,
slide: null,
start: null,
stop: null
},
numPages: 5,
_create: function(){
this._keySliding=false;
this._mouseSliding=false;
this._animateOff=true;
this._handleIndex=null;
this._detectOrientation();
this._mouseInit();
this._calculateNewMax();
this._addClass("ui-slider ui-slider-" + this.orientation,
"ui-widget ui-widget-content");
this._refresh();
this._animateOff=false;
},
_refresh: function(){
this._createRange();
this._createHandles();
this._setupEvents();
this._refreshValue();
},
_createHandles: function(){
var i, handleCount,
options=this.options,
existingHandles=this.element.find(".ui-slider-handle"),
handle="<span tabindex='0'></span>",
handles=[];
handleCount=(options.values&&options.values.length)||1;
if(existingHandles.length > handleCount){
existingHandles.slice(handleCount).remove();
existingHandles=existingHandles.slice(0, handleCount);
}
for(i=existingHandles.length; i < handleCount; i++){
handles.push(handle);
}
this.handles=existingHandles.add($(handles.join("") ).appendTo(this.element) );
this._addClass(this.handles, "ui-slider-handle", "ui-state-default");
this.handle=this.handles.eq(0);
this.handles.each(function(i){
$(this).data("ui-slider-handle-index", i);
});
},
_createRange: function(){
var options=this.options;
if(options.range){
if(options.range===true){
if(!options.values){
options.values=[ this._valueMin(), this._valueMin() ];
}else if(options.values.length&&options.values.length!==2){
options.values=[ options.values[ 0 ], options.values[ 0 ] ];
}else if($.isArray(options.values) ){
options.values=options.values.slice(0);
}}
if(!this.range||!this.range.length){
this.range=$("<div>")
.appendTo(this.element);
this._addClass(this.range, "ui-slider-range");
}else{
this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max");
this.range.css({
"left": "",
"bottom": ""
});
}
if(options.range==="min"||options.range==="max"){
this._addClass(this.range, "ui-slider-range-" + options.range);
}}else{
if(this.range){
this.range.remove();
}
this.range=null;
}},
_setupEvents: function(){
this._off(this.handles);
this._on(this.handles, this._handleEvents);
this._hoverable(this.handles);
this._focusable(this.handles);
},
_destroy: function(){
this.handles.remove();
if(this.range){
this.range.remove();
}
this._mouseDestroy();
},
_mouseCapture: function(event){
var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
that=this,
o=this.options;
if(o.disabled){
return false;
}
this.elementSize={
width: this.element.outerWidth(),
height: this.element.outerHeight()
};
this.elementOffset=this.element.offset();
position={ x: event.pageX, y: event.pageY };
normValue=this._normValueFromMouse(position);
distance=this._valueMax() - this._valueMin() + 1;
this.handles.each(function(i){
var thisDistance=Math.abs(normValue - that.values(i) );
if(( distance > thisDistance) ||
(distance===thisDistance &&
(i===that._lastChangedValue||that.values(i)===o.min) )){
distance=thisDistance;
closestHandle=$(this);
index=i;
}});
allowed=this._start(event, index);
if(allowed===false){
return false;
}
this._mouseSliding=true;
this._handleIndex=index;
this._addClass(closestHandle, null, "ui-state-active");
closestHandle.trigger("focus");
offset=closestHandle.offset();
mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle");
this._clickOffset=mouseOverHandle ? { left: 0, top: 0 }:{
left: event.pageX - offset.left -(closestHandle.width() / 2),
top: event.pageY - offset.top -
(closestHandle.height() / 2) -
(parseInt(closestHandle.css("borderTopWidth"), 10)||0) -
(parseInt(closestHandle.css("borderBottomWidth"), 10)||0) +
(parseInt(closestHandle.css("marginTop"), 10)||0)
};
if(!this.handles.hasClass("ui-state-hover") ){
this._slide(event, index, normValue);
}
this._animateOff=true;
return true;
},
_mouseStart: function(){
return true;
},
_mouseDrag: function(event){
var position={ x: event.pageX, y: event.pageY },
normValue=this._normValueFromMouse(position);
this._slide(event, this._handleIndex, normValue);
return false;
},
_mouseStop: function(event){
this._removeClass(this.handles, null, "ui-state-active");
this._mouseSliding=false;
this._stop(event, this._handleIndex);
this._change(event, this._handleIndex);
this._handleIndex=null;
this._clickOffset=null;
this._animateOff=false;
return false;
},
_detectOrientation: function(){
this.orientation=(this.options.orientation==="vertical") ? "vertical":"horizontal";
},
_normValueFromMouse: function(position){
var pixelTotal,
pixelMouse,
percentMouse,
valueTotal,
valueMouse;
if(this.orientation==="horizontal"){
pixelTotal=this.elementSize.width;
pixelMouse=position.x - this.elementOffset.left -
(this._clickOffset ? this._clickOffset.left:0);
}else{
pixelTotal=this.elementSize.height;
pixelMouse=position.y - this.elementOffset.top -
(this._clickOffset ? this._clickOffset.top:0);
}
percentMouse=(pixelMouse / pixelTotal);
if(percentMouse > 1){
percentMouse=1;
}
if(percentMouse < 0){
percentMouse=0;
}
if(this.orientation==="vertical"){
percentMouse=1 - percentMouse;
}
valueTotal=this._valueMax() - this._valueMin();
valueMouse=this._valueMin() + percentMouse * valueTotal;
return this._trimAlignValue(valueMouse);
},
_uiHash: function(index, value, values){
var uiHash={
handle: this.handles[ index ],
handleIndex: index,
value: value!==undefined ? value:this.value()
};
if(this._hasMultipleValues()){
uiHash.value=value!==undefined ? value:this.values(index);
uiHash.values=values||this.values();
}
return uiHash;
},
_hasMultipleValues: function(){
return this.options.values&&this.options.values.length;
},
_start: function(event, index){
return this._trigger("start", event, this._uiHash(index) );
},
_slide: function(event, index, newVal){
var allowed, otherVal,
currentValue=this.value(),
newValues=this.values();
if(this._hasMultipleValues()){
otherVal=this.values(index ? 0:1);
currentValue=this.values(index);
if(this.options.values.length===2&&this.options.range===true){
newVal=index===0 ? Math.min(otherVal, newVal):Math.max(otherVal, newVal);
}
newValues[ index ]=newVal;
}
if(newVal===currentValue){
return;
}
allowed=this._trigger("slide", event, this._uiHash(index, newVal, newValues) );
if(allowed===false){
return;
}
if(this._hasMultipleValues()){
this.values(index, newVal);
}else{
this.value(newVal);
}},
_stop: function(event, index){
this._trigger("stop", event, this._uiHash(index) );
},
_change: function(event, index){
if(!this._keySliding&&!this._mouseSliding){
this._lastChangedValue=index;
this._trigger("change", event, this._uiHash(index) );
}},
value: function(newValue){
if(arguments.length){
this.options.value=this._trimAlignValue(newValue);
this._refreshValue();
this._change(null, 0);
return;
}
return this._value();
},
values: function(index, newValue){
var vals,
newValues,
i;
if(arguments.length > 1){
this.options.values[ index ]=this._trimAlignValue(newValue);
this._refreshValue();
this._change(null, index);
return;
}
if(arguments.length){
if($.isArray(arguments[ 0 ]) ){
vals=this.options.values;
newValues=arguments[ 0 ];
for(i=0; i < vals.length; i +=1){
vals[ i ]=this._trimAlignValue(newValues[ i ]);
this._change(null, i);
}
this._refreshValue();
}else{
if(this._hasMultipleValues()){
return this._values(index);
}else{
return this.value();
}}
}else{
return this._values();
}},
_setOption: function(key, value){
var i,
valsLength=0;
if(key==="range"&&this.options.range===true){
if(value==="min"){
this.options.value=this._values(0);
this.options.values=null;
}else if(value==="max"){
this.options.value=this._values(this.options.values.length - 1);
this.options.values=null;
}}
if($.isArray(this.options.values) ){
valsLength=this.options.values.length;
}
this._super(key, value);
switch(key){
case "orientation":
this._detectOrientation();
this._removeClass("ui-slider-horizontal ui-slider-vertical")
._addClass("ui-slider-" + this.orientation);
this._refreshValue();
if(this.options.range){
this._refreshRange(value);
}
this.handles.css(value==="horizontal" ? "bottom":"left", "");
break;
case "value":
this._animateOff=true;
this._refreshValue();
this._change(null, 0);
this._animateOff=false;
break;
case "values":
this._animateOff=true;
this._refreshValue();
for(i=valsLength - 1; i >=0; i--){
this._change(null, i);
}
this._animateOff=false;
break;
case "step":
case "min":
case "max":
this._animateOff=true;
this._calculateNewMax();
this._refreshValue();
this._animateOff=false;
break;
case "range":
this._animateOff=true;
this._refresh();
this._animateOff=false;
break;
}},
_setOptionDisabled: function(value){
this._super(value);
this._toggleClass(null, "ui-state-disabled", !!value);
},
_value: function(){
var val=this.options.value;
val=this._trimAlignValue(val);
return val;
},
_values: function(index){
var val,
vals,
i;
if(arguments.length){
val=this.options.values[ index ];
val=this._trimAlignValue(val);
return val;
}else if(this._hasMultipleValues()){
vals=this.options.values.slice();
for(i=0; i < vals.length; i +=1){
vals[ i ]=this._trimAlignValue(vals[ i ]);
}
return vals;
}else{
return [];
}},
_trimAlignValue: function(val){
if(val <=this._valueMin()){
return this._valueMin();
}
if(val >=this._valueMax()){
return this._valueMax();
}
var step=(this.options.step > 0) ? this.options.step:1,
valModStep=(val - this._valueMin()) % step,
alignValue=val - valModStep;
if(Math.abs(valModStep) * 2 >=step){
alignValue +=(valModStep > 0) ? step:(-step);
}
return parseFloat(alignValue.toFixed(5) );
},
_calculateNewMax: function(){
var max=this.options.max,
min=this._valueMin(),
step=this.options.step,
aboveMin=Math.round(( max - min) / step) * step;
max=aboveMin + min;
if(max > this.options.max){
max -=step;
}
this.max=parseFloat(max.toFixed(this._precision()) );
},
_precision: function(){
var precision=this._precisionOf(this.options.step);
if(this.options.min!==null){
precision=Math.max(precision, this._precisionOf(this.options.min) );
}
return precision;
},
_precisionOf: function(num){
var str=num.toString(),
decimal=str.indexOf(".");
return decimal===-1 ? 0:str.length - decimal - 1;
},
_valueMin: function(){
return this.options.min;
},
_valueMax: function(){
return this.max;
},
_refreshRange: function(orientation){
if(orientation==="vertical"){
this.range.css({ "width": "", "left": "" });
}
if(orientation==="horizontal"){
this.range.css({ "height": "", "bottom": "" });
}},
_refreshValue: function(){
var lastValPercent, valPercent, value, valueMin, valueMax,
oRange=this.options.range,
o=this.options,
that=this,
animate=(!this._animateOff) ? o.animate:false,
_set={};
if(this._hasMultipleValues()){
this.handles.each(function(i){
valPercent=(that.values(i) - that._valueMin()) /(that._valueMax() -
that._valueMin()) * 100;
_set[ that.orientation==="horizontal" ? "left":"bottom" ]=valPercent + "%";
$(this).stop(1, 1)[ animate ? "animate":"css" ](_set, o.animate);
if(that.options.range===true){
if(that.orientation==="horizontal"){
if(i===0){
that.range.stop(1, 1)[ animate ? "animate":"css" ]( {
left: valPercent + "%"
}, o.animate);
}
if(i===1){
that.range[ animate ? "animate":"css" ]( {
width:(valPercent - lastValPercent) + "%"
}, {
queue: false,
duration: o.animate
});
}}else{
if(i===0){
that.range.stop(1, 1)[ animate ? "animate":"css" ]( {
bottom:(valPercent) + "%"
}, o.animate);
}
if(i===1){
that.range[ animate ? "animate":"css" ]( {
height:(valPercent - lastValPercent) + "%"
}, {
queue: false,
duration: o.animate
});
}}
}
lastValPercent=valPercent;
});
}else{
value=this.value();
valueMin=this._valueMin();
valueMax=this._valueMax();
valPercent=(valueMax!==valueMin) ?
(value - valueMin) /(valueMax - valueMin) * 100 :
0;
_set[ this.orientation==="horizontal" ? "left":"bottom" ]=valPercent + "%";
this.handle.stop(1, 1)[ animate ? "animate":"css" ](_set, o.animate);
if(oRange==="min"&&this.orientation==="horizontal"){
this.range.stop(1, 1)[ animate ? "animate":"css" ]( {
width: valPercent + "%"
}, o.animate);
}
if(oRange==="max"&&this.orientation==="horizontal"){
this.range.stop(1, 1)[ animate ? "animate":"css" ]( {
width:(100 - valPercent) + "%"
}, o.animate);
}
if(oRange==="min"&&this.orientation==="vertical"){
this.range.stop(1, 1)[ animate ? "animate":"css" ]( {
height: valPercent + "%"
}, o.animate);
}
if(oRange==="max"&&this.orientation==="vertical"){
this.range.stop(1, 1)[ animate ? "animate":"css" ]( {
height:(100 - valPercent) + "%"
}, o.animate);
}}
},
_handleEvents: {
keydown: function(event){
var allowed, curVal, newVal, step,
index=$(event.target).data("ui-slider-handle-index");
switch(event.keyCode){
case $.ui.keyCode.HOME:
case $.ui.keyCode.END:
case $.ui.keyCode.PAGE_UP:
case $.ui.keyCode.PAGE_DOWN:
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
case $.ui.keyCode.LEFT:
event.preventDefault();
if(!this._keySliding){
this._keySliding=true;
this._addClass($(event.target), null, "ui-state-active");
allowed=this._start(event, index);
if(allowed===false){
return;
}}
break;
}
step=this.options.step;
if(this._hasMultipleValues()){
curVal=newVal=this.values(index);
}else{
curVal=newVal=this.value();
}
switch(event.keyCode){
case $.ui.keyCode.HOME:
newVal=this._valueMin();
break;
case $.ui.keyCode.END:
newVal=this._valueMax();
break;
case $.ui.keyCode.PAGE_UP:
newVal=this._trimAlignValue(curVal +(( this._valueMax() - this._valueMin()) / this.numPages)
);
break;
case $.ui.keyCode.PAGE_DOWN:
newVal=this._trimAlignValue(curVal -(( this._valueMax() - this._valueMin()) / this.numPages) );
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
if(curVal===this._valueMax()){
return;
}
newVal=this._trimAlignValue(curVal + step);
break;
case $.ui.keyCode.DOWN:
case $.ui.keyCode.LEFT:
if(curVal===this._valueMin()){
return;
}
newVal=this._trimAlignValue(curVal - step);
break;
}
this._slide(event, index, newVal);
},
keyup: function(event){
var index=$(event.target).data("ui-slider-handle-index");
if(this._keySliding){
this._keySliding=false;
this._stop(event, index);
this._change(event, index);
this._removeClass($(event.target), null, "ui-state-active");
}}
}});
var widgetsSortable=$.widget("ui.sortable", $.ui.mouse, {
version: "1.12.0",
widgetEventPrefix: "sort",
ready: false,
options: {
appendTo: "parent",
axis: false,
connectWith: false,
containment: false,
cursor: "auto",
cursorAt: false,
dropOnEmpty: true,
forcePlaceholderSize: false,
forceHelperSize: false,
grid: false,
handle: false,
helper: "original",
items: "> *",
opacity: false,
placeholder: false,
revert: false,
scroll: true,
scrollSensitivity: 20,
scrollSpeed: 20,
scope: "default",
tolerance: "intersect",
zIndex: 1000,
activate: null,
beforeStop: null,
change: null,
deactivate: null,
out: null,
over: null,
receive: null,
remove: null,
sort: null,
start: null,
stop: null,
update: null
},
_isOverAxis: function(x, reference, size){
return(x >=reference)&&(x <(reference + size) );
},
_isFloating: function(item){
return(/left|right/).test(item.css("float") ) ||
(/inline|table-cell/).test(item.css("display") );
},
_create: function(){
this.containerCache={};
this._addClass("ui-sortable");
this.refresh();
this.offset=this.element.offset();
this._mouseInit();
this._setHandleClassName();
this.ready=true;
},
_setOption: function(key, value){
this._super(key, value);
if(key==="handle"){
this._setHandleClassName();
}},
_setHandleClassName: function(){
var that=this;
this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle");
$.each(this.items, function(){
that._addClass(this.instance.options.handle ?
this.item.find(this.instance.options.handle) :
this.item,
"ui-sortable-handle"
);
});
},
_destroy: function(){
this._mouseDestroy();
for(var i=this.items.length - 1; i >=0; i--){
this.items[ i ].item.removeData(this.widgetName + "-item");
}
return this;
},
_mouseCapture: function(event, overrideHandle){
var currentItem=null,
validHandle=false,
that=this;
if(this.reverting){
return false;
}
if(this.options.disabled||this.options.type==="static"){
return false;
}
this._refreshItems(event);
$(event.target).parents().each(function(){
if($.data(this, that.widgetName + "-item")===that){
currentItem=$(this);
return false;
}});
if($.data(event.target, that.widgetName + "-item")===that){
currentItem=$(event.target);
}
if(!currentItem){
return false;
}
if(this.options.handle&&!overrideHandle){
$(this.options.handle, currentItem).find("*").addBack().each(function(){
if(this===event.target){
validHandle=true;
}});
if(!validHandle){
return false;
}}
this.currentItem=currentItem;
this._removeCurrentsFromItems();
return true;
},
_mouseStart: function(event, overrideHandle, noActivation){
var i, body,
o=this.options;
this.currentContainer=this;
this.refreshPositions();
this.helper=this._createHelper(event);
this._cacheHelperProportions();
this._cacheMargins();
this.scrollParent=this.helper.scrollParent();
this.offset=this.currentItem.offset();
this.offset={
top: this.offset.top - this.margins.top,
left: this.offset.left - this.margins.left
};
$.extend(this.offset, {
click: {
left: event.pageX - this.offset.left,
top: event.pageY - this.offset.top
},
parent: this._getParentOffset(),
relative: this._getRelativeOffset()
});
this.helper.css("position", "absolute");
this.cssPosition=this.helper.css("position");
this.originalPosition=this._generatePosition(event);
this.originalPageX=event.pageX;
this.originalPageY=event.pageY;
(o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt) );
this.domPosition={
prev: this.currentItem.prev()[ 0 ],
parent: this.currentItem.parent()[ 0 ]
};
if(this.helper[ 0 ]!==this.currentItem[ 0 ]){
this.currentItem.hide();
}
this._createPlaceholder();
if(o.containment){
this._setContainment();
}
if(o.cursor&&o.cursor!=="auto"){
body=this.document.find("body");
this.storedCursor=body.css("cursor");
body.css("cursor", o.cursor);
this.storedStylesheet =
$("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body);
}
if(o.opacity){
if(this.helper.css("opacity") ){
this._storedOpacity=this.helper.css("opacity");
}
this.helper.css("opacity", o.opacity);
}
if(o.zIndex){
if(this.helper.css("zIndex") ){
this._storedZIndex=this.helper.css("zIndex");
}
this.helper.css("zIndex", o.zIndex);
}
if(this.scrollParent[ 0 ]!==this.document[ 0 ] &&
this.scrollParent[ 0 ].tagName!=="HTML"){
this.overflowOffset=this.scrollParent.offset();
}
this._trigger("start", event, this._uiHash());
if(!this._preserveHelperProportions){
this._cacheHelperProportions();
}
if(!noActivation){
for(i=this.containers.length - 1; i >=0; i--){
this.containers[ i ]._trigger("activate", event, this._uiHash(this) );
}}
if($.ui.ddmanager){
$.ui.ddmanager.current=this;
}
if($.ui.ddmanager&&!o.dropBehaviour){
$.ui.ddmanager.prepareOffsets(this, event);
}
this.dragging=true;
this._addClass(this.helper, "ui-sortable-helper");
this._mouseDrag(event);
return true;
},
_mouseDrag: function(event){
var i, item, itemElement, intersection,
o=this.options,
scrolled=false;
this.position=this._generatePosition(event);
this.positionAbs=this._convertPositionTo("absolute");
if(!this.lastPositionAbs){
this.lastPositionAbs=this.positionAbs;
}
if(this.options.scroll){
if(this.scrollParent[ 0 ]!==this.document[ 0 ] &&
this.scrollParent[ 0 ].tagName!=="HTML"){
if(( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight) -
event.pageY < o.scrollSensitivity){
this.scrollParent[ 0 ].scrollTop =
scrolled=this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
}else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity){
this.scrollParent[ 0 ].scrollTop =
scrolled=this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
}
if(( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth) -
event.pageX < o.scrollSensitivity){
this.scrollParent[ 0 ].scrollLeft=scrolled =
this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
}else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity){
this.scrollParent[ 0 ].scrollLeft=scrolled =
this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
}}else{
if(event.pageY - this.document.scrollTop() < o.scrollSensitivity){
scrolled=this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
}else if(this.window.height() -(event.pageY - this.document.scrollTop()) <
o.scrollSensitivity){
scrolled=this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
}
if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity){
scrolled=this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed
);
}else if(this.window.width() -(event.pageX - this.document.scrollLeft()) <
o.scrollSensitivity){
scrolled=this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed
);
}}
if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){
$.ui.ddmanager.prepareOffsets(this, event);
}}
this.positionAbs=this._convertPositionTo("absolute");
if(!this.options.axis||this.options.axis!=="y"){
this.helper[ 0 ].style.left=this.position.left + "px";
}
if(!this.options.axis||this.options.axis!=="x"){
this.helper[ 0 ].style.top=this.position.top + "px";
}
for(i=this.items.length - 1; i >=0; i--){
item=this.items[ i ];
itemElement=item.item[ 0 ];
intersection=this._intersectsWithPointer(item);
if(!intersection){
continue;
}
if(item.instance!==this.currentContainer){
continue;
}
if(itemElement!==this.currentItem[ 0 ] &&
this.placeholder[ intersection===1 ? "next":"prev" ]()[ 0 ]!==itemElement &&
!$.contains(this.placeholder[ 0 ], itemElement) &&
(this.options.type==="semi-dynamic" ?
!$.contains(this.element[ 0 ], itemElement) :
true
)
){
this.direction=intersection===1 ? "down":"up";
if(this.options.tolerance==="pointer"||this._intersectsWithSides(item) ){
this._rearrange(event, item);
}else{
break;
}
this._trigger("change", event, this._uiHash());
break;
}}
this._contactContainers(event);
if($.ui.ddmanager){
$.ui.ddmanager.drag(this, event);
}
this._trigger("sort", event, this._uiHash());
this.lastPositionAbs=this.positionAbs;
return false;
},
_mouseStop: function(event, noPropagation){
if(!event){
return;
}
if($.ui.ddmanager&&!this.options.dropBehaviour){
$.ui.ddmanager.drop(this, event);
}
if(this.options.revert){
var that=this,
cur=this.placeholder.offset(),
axis=this.options.axis,
animation={};
if(!axis||axis==="x"){
animation.left=cur.left - this.offset.parent.left - this.margins.left +
(this.offsetParent[ 0 ]===this.document[ 0 ].body ?
0 :
this.offsetParent[ 0 ].scrollLeft
);
}
if(!axis||axis==="y"){
animation.top=cur.top - this.offset.parent.top - this.margins.top +
(this.offsetParent[ 0 ]===this.document[ 0 ].body ?
0 :
this.offsetParent[ 0 ].scrollTop
);
}
this.reverting=true;
$(this.helper).animate(animation,
parseInt(this.options.revert, 10)||500,
function(){
that._clear(event);
}
);
}else{
this._clear(event, noPropagation);
}
return false;
},
cancel: function(){
if(this.dragging){
this._mouseUp({ target: null });
if(this.options.helper==="original"){
this.currentItem.css(this._storedCSS);
this._removeClass(this.currentItem, "ui-sortable-helper");
}else{
this.currentItem.show();
}
for(var i=this.containers.length - 1; i >=0; i--){
this.containers[ i ]._trigger("deactivate", null, this._uiHash(this) );
if(this.containers[ i ].containerCache.over){
this.containers[ i ]._trigger("out", null, this._uiHash(this) );
this.containers[ i ].containerCache.over=0;
}}
}
if(this.placeholder){
if(this.placeholder[ 0 ].parentNode){
this.placeholder[ 0 ].parentNode.removeChild(this.placeholder[ 0 ]);
}
if(this.options.helper!=="original"&&this.helper &&
this.helper[ 0 ].parentNode){
this.helper.remove();
}
$.extend(this, {
helper: null,
dragging: false,
reverting: false,
_noFinalSort: null
});
if(this.domPosition.prev){
$(this.domPosition.prev).after(this.currentItem);
}else{
$(this.domPosition.parent).prepend(this.currentItem);
}}
return this;
},
serialize: function(o){
var items=this._getItemsAsjQuery(o&&o.connected),
str=[];
o=o||{};
$(items).each(function(){
var res=($(o.item||this).attr(o.attribute||"id")||"")
.match(o.expression||(/(.+)[\-=_](.+)/) );
if(res){
str.push((o.key||res[ 1 ] + "[]") +
"=" +(o.key&&o.expression ? res[ 1 ]:res[ 2 ]) );
}});
if(!str.length&&o.key){
str.push(o.key + "=");
}
return str.join("&");
},
toArray: function(o){
var items=this._getItemsAsjQuery(o&&o.connected),
ret=[];
o=o||{};
items.each(function(){
ret.push($(o.item||this).attr(o.attribute||"id")||"");
});
return ret;
},
_intersectsWith: function(item){
var x1=this.positionAbs.left,
x2=x1 + this.helperProportions.width,
y1=this.positionAbs.top,
y2=y1 + this.helperProportions.height,
l=item.left,
r=l + item.width,
t=item.top,
b=t + item.height,
dyClick=this.offset.click.top,
dxClick=this.offset.click.left,
isOverElementHeight=(this.options.axis==="x")||(( y1 + dyClick) > t &&
(y1 + dyClick) < b),
isOverElementWidth=(this.options.axis==="y")||(( x1 + dxClick) > l &&
(x1 + dxClick) < r),
isOverElement=isOverElementHeight&&isOverElementWidth;
if(this.options.tolerance==="pointer" ||
this.options.forcePointerForContainers ||
(this.options.tolerance!=="pointer" &&
this.helperProportions[ this.floating ? "width":"height" ] >
item[ this.floating ? "width":"height" ])
){
return isOverElement;
}else{
return(l < x1 +(this.helperProportions.width / 2) &&
x2 -(this.helperProportions.width / 2) < r &&
t < y1 +(this.helperProportions.height / 2) &&
y2 -(this.helperProportions.height / 2) < b);
}},
_intersectsWithPointer: function(item){
var verticalDirection, horizontalDirection,
isOverElementHeight=(this.options.axis==="x") ||
this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
isOverElementWidth=(this.options.axis==="y") ||
this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
isOverElement=isOverElementHeight&&isOverElementWidth;
if(!isOverElement){
return false;
}
verticalDirection=this._getDragVerticalDirection();
horizontalDirection=this._getDragHorizontalDirection();
return this.floating ?
(( horizontalDirection==="right"||verticalDirection==="down") ? 2:1)
:(verticalDirection&&(verticalDirection==="down" ? 2:1) );
},
_intersectsWithSides: function(item){
var isOverBottomHalf=this._isOverAxis(this.positionAbs.top +
this.offset.click.top, item.top +(item.height / 2), item.height),
isOverRightHalf=this._isOverAxis(this.positionAbs.left +
this.offset.click.left, item.left +(item.width / 2), item.width),
verticalDirection=this._getDragVerticalDirection(),
horizontalDirection=this._getDragHorizontalDirection();
if(this.floating&&horizontalDirection){
return(( horizontalDirection==="right"&&isOverRightHalf) ||
(horizontalDirection==="left"&&!isOverRightHalf) );
}else{
return verticalDirection&&(( verticalDirection==="down"&&isOverBottomHalf) ||
(verticalDirection==="up"&&!isOverBottomHalf) );
}},
_getDragVerticalDirection: function(){
var delta=this.positionAbs.top - this.lastPositionAbs.top;
return delta!==0&&(delta > 0 ? "down":"up");
},
_getDragHorizontalDirection: function(){
var delta=this.positionAbs.left - this.lastPositionAbs.left;
return delta!==0&&(delta > 0 ? "right":"left");
},
refresh: function(event){
this._refreshItems(event);
this._setHandleClassName();
this.refreshPositions();
return this;
},
_connectWith: function(){
var options=this.options;
return options.connectWith.constructor===String ?
[ options.connectWith ] :
options.connectWith;
},
_getItemsAsjQuery: function(connected){
var i, j, cur, inst,
items=[],
queries=[],
connectWith=this._connectWith();
if(connectWith&&connected){
for(i=connectWith.length - 1; i >=0; i--){
cur=$(connectWith[ i ], this.document[ 0 ]);
for(j=cur.length - 1; j >=0; j--){
inst=$.data(cur[ j ], this.widgetFullName);
if(inst&&inst!==this&&!inst.options.disabled){
queries.push([ $.isFunction(inst.options.items) ?
inst.options.items.call(inst.element) :
$(inst.options.items, inst.element)
.not(".ui-sortable-helper")
.not(".ui-sortable-placeholder"), inst ]);
}}
}}
queries.push([ $.isFunction(this.options.items) ?
this.options.items
.call(this.element, null, { options: this.options, item: this.currentItem }) :
$(this.options.items, this.element)
.not(".ui-sortable-helper")
.not(".ui-sortable-placeholder"), this ]);
function addItems(){
items.push(this);
}
for(i=queries.length - 1; i >=0; i--){
queries[ i ][ 0 ].each(addItems);
}
return $(items);
},
_removeCurrentsFromItems: function(){
var list=this.currentItem.find(":data(" + this.widgetName + "-item)");
this.items=$.grep(this.items, function(item){
for(var j=0; j < list.length; j++){
if(list[ j ]===item.item[ 0 ]){
return false;
}}
return true;
});
},
_refreshItems: function(event){
this.items=[];
this.containers=[ this ];
var i, j, cur, inst, targetData, _queries, item, queriesLength,
items=this.items,
queries=[ [ $.isFunction(this.options.items) ?
this.options.items.call(this.element[ 0 ], event, { item: this.currentItem }) :
$(this.options.items, this.element), this ] ],
connectWith=this._connectWith();
if(connectWith&&this.ready){
for(i=connectWith.length - 1; i >=0; i--){
cur=$(connectWith[ i ], this.document[ 0 ]);
for(j=cur.length - 1; j >=0; j--){
inst=$.data(cur[ j ], this.widgetFullName);
if(inst&&inst!==this&&!inst.options.disabled){
queries.push([ $.isFunction(inst.options.items) ?
inst.options.items
.call(inst.element[ 0 ], event, { item: this.currentItem }) :
$(inst.options.items, inst.element), inst ]);
this.containers.push(inst);
}}
}}
for(i=queries.length - 1; i >=0; i--){
targetData=queries[ i ][ 1 ];
_queries=queries[ i ][ 0 ];
for(j=0, queriesLength=_queries.length; j < queriesLength; j++){
item=$(_queries[ j ]);
item.data(this.widgetName + "-item", targetData);
items.push({
item: item,
instance: targetData,
width: 0, height: 0,
left: 0, top: 0
});
}}
},
refreshPositions: function(fast){
this.floating=this.items.length ?
this.options.axis==="x"||this._isFloating(this.items[ 0 ].item) :
false;
if(this.offsetParent&&this.helper){
this.offset.parent=this._getParentOffset();
}
var i, item, t, p;
for(i=this.items.length - 1; i >=0; i--){
item=this.items[ i ];
if(item.instance!==this.currentContainer&&this.currentContainer &&
item.item[ 0 ]!==this.currentItem[ 0 ]){
continue;
}
t=this.options.toleranceElement ?
$(this.options.toleranceElement, item.item) :
item.item;
if(!fast){
item.width=t.outerWidth();
item.height=t.outerHeight();
}
p=t.offset();
item.left=p.left;
item.top=p.top;
}
if(this.options.custom&&this.options.custom.refreshContainers){
this.options.custom.refreshContainers.call(this);
}else{
for(i=this.containers.length - 1; i >=0; i--){
p=this.containers[ i ].element.offset();
this.containers[ i ].containerCache.left=p.left;
this.containers[ i ].containerCache.top=p.top;
this.containers[ i ].containerCache.width =
this.containers[ i ].element.outerWidth();
this.containers[ i ].containerCache.height =
this.containers[ i ].element.outerHeight();
}}
return this;
},
_createPlaceholder: function(that){
that=that||this;
var className,
o=that.options;
if(!o.placeholder||o.placeholder.constructor===String){
className=o.placeholder;
o.placeholder={
element: function(){
var nodeName=that.currentItem[ 0 ].nodeName.toLowerCase(),
element=$("<" + nodeName + ">", that.document[ 0 ]);
that._addClass(element, "ui-sortable-placeholder",
className||that.currentItem[ 0 ].className)
._removeClass(element, "ui-sortable-helper");
if(nodeName==="tbody"){
that._createTrPlaceholder(that.currentItem.find("tr").eq(0),
$("<tr>", that.document[ 0 ]).appendTo(element)
);
}else if(nodeName==="tr"){
that._createTrPlaceholder(that.currentItem, element);
}else if(nodeName==="img"){
element.attr("src", that.currentItem.attr("src") );
}
if(!className){
element.css("visibility", "hidden");
}
return element;
},
update: function(container, p){
if(className&&!o.forcePlaceholderSize){
return;
}
if(!p.height()){
p.height(that.currentItem.innerHeight() -
parseInt(that.currentItem.css("paddingTop")||0, 10) -
parseInt(that.currentItem.css("paddingBottom")||0, 10) );
}
if(!p.width()){
p.width(that.currentItem.innerWidth() -
parseInt(that.currentItem.css("paddingLeft")||0, 10) -
parseInt(that.currentItem.css("paddingRight")||0, 10) );
}}
};}
that.placeholder=$(o.placeholder.element.call(that.element, that.currentItem) );
that.currentItem.after(that.placeholder);
o.placeholder.update(that, that.placeholder);
},
_createTrPlaceholder: function(sourceTr, targetTr){
var that=this;
sourceTr.children().each(function(){
$("<td>&#160;</td>", that.document[ 0 ])
.attr("colspan", $(this).attr("colspan")||1)
.appendTo(targetTr);
});
},
_contactContainers: function(event){
var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
floating, axis,
innermostContainer=null,
innermostIndex=null;
for(i=this.containers.length - 1; i >=0; i--){
if($.contains(this.currentItem[ 0 ], this.containers[ i ].element[ 0 ]) ){
continue;
}
if(this._intersectsWith(this.containers[ i ].containerCache) ){
if(innermostContainer &&
$.contains(this.containers[ i ].element[ 0 ],
innermostContainer.element[ 0 ]) ){
continue;
}
innermostContainer=this.containers[ i ];
innermostIndex=i;
}else{
if(this.containers[ i ].containerCache.over){
this.containers[ i ]._trigger("out", event, this._uiHash(this) );
this.containers[ i ].containerCache.over=0;
}}
}
if(!innermostContainer){
return;
}
if(this.containers.length===1){
if(!this.containers[ innermostIndex ].containerCache.over){
this.containers[ innermostIndex ]._trigger("over", event, this._uiHash(this) );
this.containers[ innermostIndex ].containerCache.over=1;
}}else{
dist=10000;
itemWithLeastDistance=null;
floating=innermostContainer.floating||this._isFloating(this.currentItem);
posProperty=floating ? "left":"top";
sizeProperty=floating ? "width":"height";
axis=floating ? "pageX":"pageY";
for(j=this.items.length - 1; j >=0; j--){
if(!$.contains(this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ])
){
continue;
}
if(this.items[ j ].item[ 0 ]===this.currentItem[ 0 ]){
continue;
}
cur=this.items[ j ].item.offset()[ posProperty ];
nearBottom=false;
if(event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2){
nearBottom=true;
}
if(Math.abs(event[ axis ] - cur) < dist){
dist=Math.abs(event[ axis ] - cur);
itemWithLeastDistance=this.items[ j ];
this.direction=nearBottom ? "up":"down";
}}
if(!itemWithLeastDistance&&!this.options.dropOnEmpty){
return;
}
if(this.currentContainer===this.containers[ innermostIndex ]){
if(!this.currentContainer.containerCache.over){
this.containers[ innermostIndex ]._trigger("over", event, this._uiHash());
this.currentContainer.containerCache.over=1;
}
return;
}
itemWithLeastDistance ?
this._rearrange(event, itemWithLeastDistance, null, true) :
this._rearrange(event, null, this.containers[ innermostIndex ].element, true);
this._trigger("change", event, this._uiHash());
this.containers[ innermostIndex ]._trigger("change", event, this._uiHash(this) );
this.currentContainer=this.containers[ innermostIndex ];
this.options.placeholder.update(this.currentContainer, this.placeholder);
this.containers[ innermostIndex ]._trigger("over", event, this._uiHash(this) );
this.containers[ innermostIndex ].containerCache.over=1;
}},
_createHelper: function(event){
var o=this.options,
helper=$.isFunction(o.helper) ?
$(o.helper.apply(this.element[ 0 ], [ event, this.currentItem ]) ) :
(o.helper==="clone" ? this.currentItem.clone():this.currentItem);
if(!helper.parents("body").length){
$(o.appendTo!=="parent" ?
o.appendTo :
this.currentItem[ 0 ].parentNode)[ 0 ].appendChild(helper[ 0 ]);
}
if(helper[ 0 ]===this.currentItem[ 0 ]){
this._storedCSS={
width: this.currentItem[ 0 ].style.width,
height: this.currentItem[ 0 ].style.height,
position: this.currentItem.css("position"),
top: this.currentItem.css("top"),
left: this.currentItem.css("left")
};}
if(!helper[ 0 ].style.width||o.forceHelperSize){
helper.width(this.currentItem.width());
}
if(!helper[ 0 ].style.height||o.forceHelperSize){
helper.height(this.currentItem.height());
}
return helper;
},
_adjustOffsetFromHelper: function(obj){
if(typeof obj==="string"){
obj=obj.split(" ");
}
if($.isArray(obj) ){
obj={ left: +obj[ 0 ], top: +obj[ 1 ]||0 };}
if("left" in obj){
this.offset.click.left=obj.left + this.margins.left;
}
if("right" in obj){
this.offset.click.left=this.helperProportions.width - obj.right + this.margins.left;
}
if("top" in obj){
this.offset.click.top=obj.top + this.margins.top;
}
if("bottom" in obj){
this.offset.click.top=this.helperProportions.height - obj.bottom + this.margins.top;
}},
_getParentOffset: function(){
this.offsetParent=this.helper.offsetParent();
var po=this.offsetParent.offset();
if(this.cssPosition==="absolute"&&this.scrollParent[ 0 ]!==this.document[ 0 ] &&
$.contains(this.scrollParent[ 0 ], this.offsetParent[ 0 ]) ){
po.left +=this.scrollParent.scrollLeft();
po.top +=this.scrollParent.scrollTop();
}
if(this.offsetParent[ 0 ]===this.document[ 0 ].body ||
(this.offsetParent[ 0 ].tagName &&
this.offsetParent[ 0 ].tagName.toLowerCase()==="html"&&$.ui.ie) ){
po={ top: 0, left: 0 };}
return {
top: po.top +(parseInt(this.offsetParent.css("borderTopWidth"), 10)||0),
left: po.left +(parseInt(this.offsetParent.css("borderLeftWidth"), 10)||0)
};},
_getRelativeOffset: function(){
if(this.cssPosition==="relative"){
var p=this.currentItem.position();
return {
top: p.top -(parseInt(this.helper.css("top"), 10)||0) +
this.scrollParent.scrollTop(),
left: p.left -(parseInt(this.helper.css("left"), 10)||0) +
this.scrollParent.scrollLeft()
};}else{
return { top: 0, left: 0 };}},
_cacheMargins: function(){
this.margins={
left:(parseInt(this.currentItem.css("marginLeft"), 10)||0),
top:(parseInt(this.currentItem.css("marginTop"), 10)||0)
};},
_cacheHelperProportions: function(){
this.helperProportions={
width: this.helper.outerWidth(),
height: this.helper.outerHeight()
};},
_setContainment: function(){
var ce, co, over,
o=this.options;
if(o.containment==="parent"){
o.containment=this.helper[ 0 ].parentNode;
}
if(o.containment==="document"||o.containment==="window"){
this.containment=[
0 - this.offset.relative.left - this.offset.parent.left,
0 - this.offset.relative.top - this.offset.parent.top,
o.containment==="document" ?
this.document.width() :
this.window.width() - this.helperProportions.width - this.margins.left,
(o.containment==="document" ?
(this.document.height()||document.body.parentNode.scrollHeight) :
this.window.height()||this.document[ 0 ].body.parentNode.scrollHeight
) - this.helperProportions.height - this.margins.top
];
}
if(!(/^(document|window|parent)$/).test(o.containment) ){
ce=$(o.containment)[ 0 ];
co=$(o.containment).offset();
over=($(ce).css("overflow")!=="hidden");
this.containment=[
co.left +(parseInt($(ce).css("borderLeftWidth"), 10)||0) +
(parseInt($(ce).css("paddingLeft"), 10)||0) - this.margins.left,
co.top +(parseInt($(ce).css("borderTopWidth"), 10)||0) +
(parseInt($(ce).css("paddingTop"), 10)||0) - this.margins.top,
co.left +(over ? Math.max(ce.scrollWidth, ce.offsetWidth):ce.offsetWidth) -
(parseInt($(ce).css("borderLeftWidth"), 10)||0) -
(parseInt($(ce).css("paddingRight"), 10)||0) -
this.helperProportions.width - this.margins.left,
co.top +(over ? Math.max(ce.scrollHeight, ce.offsetHeight):ce.offsetHeight) -
(parseInt($(ce).css("borderTopWidth"), 10)||0) -
(parseInt($(ce).css("paddingBottom"), 10)||0) -
this.helperProportions.height - this.margins.top
];
}},
_convertPositionTo: function(d, pos){
if(!pos){
pos=this.position;
}
var mod=d==="absolute" ? 1:-1,
scroll=this.cssPosition==="absolute" &&
!(this.scrollParent[ 0 ]!==this.document[ 0 ] &&
$.contains(this.scrollParent[ 0 ], this.offsetParent[ 0 ]) ) ?
this.offsetParent :
this.scrollParent,
scrollIsRootNode=(/(html|body)/i).test(scroll[ 0 ].tagName);
return {
top: (
pos.top	+
this.offset.relative.top * mod +
this.offset.parent.top * mod -
(( this.cssPosition==="fixed" ?
-this.scrollParent.scrollTop() :
(scrollIsRootNode ? 0:scroll.scrollTop()) ) * mod)
),
left: (
pos.left +
this.offset.relative.left * mod +
this.offset.parent.left * mod	-
(( this.cssPosition==="fixed" ?
-this.scrollParent.scrollLeft():scrollIsRootNode ? 0 :
scroll.scrollLeft()) * mod)
)
};},
_generatePosition: function(event){
var top, left,
o=this.options,
pageX=event.pageX,
pageY=event.pageY,
scroll=this.cssPosition==="absolute" &&
!(this.scrollParent[ 0 ]!==this.document[ 0 ] &&
$.contains(this.scrollParent[ 0 ], this.offsetParent[ 0 ]) ) ?
this.offsetParent :
this.scrollParent,
scrollIsRootNode=(/(html|body)/i).test(scroll[ 0 ].tagName);
if(this.cssPosition==="relative"&&!(this.scrollParent[ 0 ]!==this.document[ 0 ] &&
this.scrollParent[ 0 ]!==this.offsetParent[ 0 ]) ){
this.offset.relative=this._getRelativeOffset();
}
if(this.originalPosition){
if(this.containment){
if(event.pageX - this.offset.click.left < this.containment[ 0 ]){
pageX=this.containment[ 0 ] + this.offset.click.left;
}
if(event.pageY - this.offset.click.top < this.containment[ 1 ]){
pageY=this.containment[ 1 ] + this.offset.click.top;
}
if(event.pageX - this.offset.click.left > this.containment[ 2 ]){
pageX=this.containment[ 2 ] + this.offset.click.left;
}
if(event.pageY - this.offset.click.top > this.containment[ 3 ]){
pageY=this.containment[ 3 ] + this.offset.click.top;
}}
if(o.grid){
top=this.originalPageY + Math.round(( pageY - this.originalPageY) /
o.grid[ 1 ]) * o.grid[ 1 ];
pageY=this.containment ?
(( top - this.offset.click.top >=this.containment[ 1 ] &&
top - this.offset.click.top <=this.containment[ 3 ]) ?
top :
(( top - this.offset.click.top >=this.containment[ 1 ]) ?
top - o.grid[ 1 ]:top + o.grid[ 1 ]) ) :
top;
left=this.originalPageX + Math.round(( pageX - this.originalPageX) /
o.grid[ 0 ]) * o.grid[ 0 ];
pageX=this.containment ?
(( left - this.offset.click.left >=this.containment[ 0 ] &&
left - this.offset.click.left <=this.containment[ 2 ]) ?
left :
(( left - this.offset.click.left >=this.containment[ 0 ]) ?
left - o.grid[ 0 ]:left + o.grid[ 0 ]) ) :
left;
}}
return {
top: (
pageY -
this.offset.click.top -
this.offset.relative.top -
this.offset.parent.top +
(( this.cssPosition==="fixed" ?
-this.scrollParent.scrollTop() :
(scrollIsRootNode ? 0:scroll.scrollTop()) ))
),
left: (
pageX -
this.offset.click.left -
this.offset.relative.left -
this.offset.parent.left +
(( this.cssPosition==="fixed" ?
-this.scrollParent.scrollLeft() :
scrollIsRootNode ? 0:scroll.scrollLeft()) )
)
};},
_rearrange: function(event, i, a, hardRefresh){
a ? a[ 0 ].appendChild(this.placeholder[ 0 ]) :
i.item[ 0 ].parentNode.insertBefore(this.placeholder[ 0 ],
(this.direction==="down" ? i.item[ 0 ]:i.item[ 0 ].nextSibling) );
this.counter=this.counter ? ++this.counter:1;
var counter=this.counter;
this._delay(function(){
if(counter===this.counter){
this.refreshPositions(!hardRefresh);
}});
},
_clear: function(event, noPropagation){
this.reverting=false;
var i,
delayedTriggers=[];
if(!this._noFinalSort&&this.currentItem.parent().length){
this.placeholder.before(this.currentItem);
}
this._noFinalSort=null;
if(this.helper[ 0 ]===this.currentItem[ 0 ]){
for(i in this._storedCSS){
if(this._storedCSS[ i ]==="auto"||this._storedCSS[ i ]==="static"){
this._storedCSS[ i ]="";
}}
this.currentItem.css(this._storedCSS);
this._removeClass(this.currentItem, "ui-sortable-helper");
}else{
this.currentItem.show();
}
if(this.fromOutside&&!noPropagation){
delayedTriggers.push(function(event){
this._trigger("receive", event, this._uiHash(this.fromOutside) );
});
}
if(( this.fromOutside ||
this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[ 0 ] ||
this.domPosition.parent!==this.currentItem.parent()[ 0 ])&&!noPropagation){
delayedTriggers.push(function(event){
this._trigger("update", event, this._uiHash());
});
}
if(this!==this.currentContainer){
if(!noPropagation){
delayedTriggers.push(function(event){
this._trigger("remove", event, this._uiHash());
});
delayedTriggers.push(( function(c){
return function(event){
c._trigger("receive", event, this._uiHash(this) );
};}).call(this, this.currentContainer) );
delayedTriggers.push(( function(c){
return function(event){
c._trigger("update", event, this._uiHash(this) );
};}).call(this, this.currentContainer) );
}}
function delayEvent(type, instance, container){
return function(event){
container._trigger(type, event, instance._uiHash(instance) );
};}
for(i=this.containers.length - 1; i >=0; i--){
if(!noPropagation){
delayedTriggers.push(delayEvent("deactivate", this, this.containers[ i ]) );
}
if(this.containers[ i ].containerCache.over){
delayedTriggers.push(delayEvent("out", this, this.containers[ i ]) );
this.containers[ i ].containerCache.over=0;
}}
if(this.storedCursor){
this.document.find("body").css("cursor", this.storedCursor);
this.storedStylesheet.remove();
}
if(this._storedOpacity){
this.helper.css("opacity", this._storedOpacity);
}
if(this._storedZIndex){
this.helper.css("zIndex", this._storedZIndex==="auto" ? "":this._storedZIndex);
}
this.dragging=false;
if(!noPropagation){
this._trigger("beforeStop", event, this._uiHash());
}
this.placeholder[ 0 ].parentNode.removeChild(this.placeholder[ 0 ]);
if(!this.cancelHelperRemoval){
if(this.helper[ 0 ]!==this.currentItem[ 0 ]){
this.helper.remove();
}
this.helper=null;
}
if(!noPropagation){
for(i=0; i < delayedTriggers.length; i++){
delayedTriggers[ i ].call(this, event);
}
this._trigger("stop", event, this._uiHash());
}
this.fromOutside=false;
return !this.cancelHelperRemoval;
},
_trigger: function(){
if($.Widget.prototype._trigger.apply(this, arguments)===false){
this.cancel();
}},
_uiHash: function(_inst){
var inst=_inst||this;
return {
helper: inst.helper,
placeholder: inst.placeholder||$([]),
position: inst.position,
originalPosition: inst.originalPosition,
offset: inst.positionAbs,
item: inst.currentItem,
sender: _inst ? _inst.element:null
};}});
function spinnerModifer(fn){
return function(){
var previous=this.element.val();
fn.apply(this, arguments);
this._refresh();
if(previous!==this.element.val()){
this._trigger("change");
}};}
$.widget("ui.spinner", {
version: "1.12.0",
defaultElement: "<input>",
widgetEventPrefix: "spin",
options: {
classes: {
"ui-spinner": "ui-corner-all",
"ui-spinner-down": "ui-corner-br",
"ui-spinner-up": "ui-corner-tr"
},
culture: null,
icons: {
down: "ui-icon-triangle-1-s",
up: "ui-icon-triangle-1-n"
},
incremental: true,
max: null,
min: null,
numberFormat: null,
page: 10,
step: 1,
change: null,
spin: null,
start: null,
stop: null
},
_create: function(){
this._setOption("max", this.options.max);
this._setOption("min", this.options.min);
this._setOption("step", this.options.step);
if(this.value()!==""){
this._value(this.element.val(), true);
}
this._draw();
this._on(this._events);
this._refresh();
this._on(this.window, {
beforeunload: function(){
this.element.removeAttr("autocomplete");
}});
},
_getCreateOptions: function(){
var options=this._super();
var element=this.element;
$.each([ "min", "max", "step" ], function(i, option){
var value=element.attr(option);
if(value!=null&&value.length){
options[ option ]=value;
}});
return options;
},
_events: {
keydown: function(event){
if(this._start(event)&&this._keydown(event) ){
event.preventDefault();
}},
keyup: "_stop",
focus: function(){
this.previous=this.element.val();
},
blur: function(event){
if(this.cancelBlur){
delete this.cancelBlur;
return;
}
this._stop();
this._refresh();
if(this.previous!==this.element.val()){
this._trigger("change", event);
}},
mousewheel: function(event, delta){
if(!delta){
return;
}
if(!this.spinning&&!this._start(event) ){
return false;
}
this._spin(( delta > 0 ? 1:-1) * this.options.step, event);
clearTimeout(this.mousewheelTimer);
this.mousewheelTimer=this._delay(function(){
if(this.spinning){
this._stop(event);
}}, 100);
event.preventDefault();
},
"mousedown .ui-spinner-button": function(event){
var previous;
previous=this.element[ 0 ]===$.ui.safeActiveElement(this.document[ 0 ]) ?
this.previous:this.element.val();
function checkFocus(){
var isActive=this.element[ 0 ]===$.ui.safeActiveElement(this.document[ 0 ]);
if(!isActive){
this.element.trigger("focus");
this.previous=previous;
this._delay(function(){
this.previous=previous;
});
}}
event.preventDefault();
checkFocus.call(this);
this.cancelBlur=true;
this._delay(function(){
delete this.cancelBlur;
checkFocus.call(this);
});
if(this._start(event)===false){
return;
}
this._repeat(null, $(event.currentTarget)
.hasClass("ui-spinner-up") ? 1:-1, event);
},
"mouseup .ui-spinner-button": "_stop",
"mouseenter .ui-spinner-button": function(event){
if(!$(event.currentTarget).hasClass("ui-state-active") ){
return;
}
if(this._start(event)===false){
return false;
}
this._repeat(null, $(event.currentTarget)
.hasClass("ui-spinner-up") ? 1:-1, event);
},
"mouseleave .ui-spinner-button": "_stop"
},
_enhance: function(){
this.uiSpinner=this.element
.attr("autocomplete", "off")
.wrap("<span>")
.parent()
.append("<a></a><a></a>"
);
},
_draw: function(){
this._enhance();
this._addClass(this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content");
this._addClass("ui-spinner-input");
this.element.attr("role", "spinbutton");
this.buttons=this.uiSpinner.children("a")
.attr("tabIndex", -1)
.attr("aria-hidden", true)
.button({
classes: {
"ui-button": ""
}});
this._removeClass(this.buttons, "ui-corner-all");
this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up");
this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down");
this.buttons.first().button({
"icon": this.options.icons.up,
"showLabel": false
});
this.buttons.last().button({
"icon": this.options.icons.down,
"showLabel": false
});
if(this.buttons.height() > Math.ceil(this.uiSpinner.height() * 0.5) &&
this.uiSpinner.height() > 0){
this.uiSpinner.height(this.uiSpinner.height());
}},
_keydown: function(event){
var options=this.options,
keyCode=$.ui.keyCode;
switch(event.keyCode){
case keyCode.UP:
this._repeat(null, 1, event);
return true;
case keyCode.DOWN:
this._repeat(null, -1, event);
return true;
case keyCode.PAGE_UP:
this._repeat(null, options.page, event);
return true;
case keyCode.PAGE_DOWN:
this._repeat(null, -options.page, event);
return true;
}
return false;
},
_start: function(event){
if(!this.spinning&&this._trigger("start", event)===false){
return false;
}
if(!this.counter){
this.counter=1;
}
this.spinning=true;
return true;
},
_repeat: function(i, steps, event){
i=i||500;
clearTimeout(this.timer);
this.timer=this._delay(function(){
this._repeat(40, steps, event);
}, i);
this._spin(steps * this.options.step, event);
},
_spin: function(step, event){
var value=this.value()||0;
if(!this.counter){
this.counter=1;
}
value=this._adjustValue(value + step * this._increment(this.counter) );
if(!this.spinning||this._trigger("spin", event, { value: value })!==false){
this._value(value);
this.counter++;
}},
_increment: function(i){
var incremental=this.options.incremental;
if(incremental){
return $.isFunction(incremental) ?
incremental(i) :
Math.floor(i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1);
}
return 1;
},
_precision: function(){
var precision=this._precisionOf(this.options.step);
if(this.options.min!==null){
precision=Math.max(precision, this._precisionOf(this.options.min) );
}
return precision;
},
_precisionOf: function(num){
var str=num.toString(),
decimal=str.indexOf(".");
return decimal===-1 ? 0:str.length - decimal - 1;
},
_adjustValue: function(value){
var base, aboveMin,
options=this.options;
base=options.min!==null ? options.min:0;
aboveMin=value - base;
aboveMin=Math.round(aboveMin / options.step) * options.step;
value=base + aboveMin;
value=parseFloat(value.toFixed(this._precision()) );
if(options.max!==null&&value > options.max){
return options.max;
}
if(options.min!==null&&value < options.min){
return options.min;
}
return value;
},
_stop: function(event){
if(!this.spinning){
return;
}
clearTimeout(this.timer);
clearTimeout(this.mousewheelTimer);
this.counter=0;
this.spinning=false;
this._trigger("stop", event);
},
_setOption: function(key, value){
var prevValue, first, last;
if(key==="culture"||key==="numberFormat"){
prevValue=this._parse(this.element.val());
this.options[ key ]=value;
this.element.val(this._format(prevValue) );
return;
}
if(key==="max"||key==="min"||key==="step"){
if(typeof value==="string"){
value=this._parse(value);
}}
if(key==="icons"){
first=this.buttons.first().find(".ui-icon");
this._removeClass(first, null, this.options.icons.up);
this._addClass(first, null, value.up);
last=this.buttons.last().find(".ui-icon");
this._removeClass(last, null, this.options.icons.down);
this._addClass(last, null, value.down);
}
this._super(key, value);
},
_setOptionDisabled: function(value){
this._super(value);
this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!value);
this.element.prop("disabled", !!value);
this.buttons.button(value ? "disable":"enable");
},
_setOptions: spinnerModifer(function(options){
this._super(options);
}),
_parse: function(val){
if(typeof val==="string"&&val!==""){
val=window.Globalize&&this.options.numberFormat ?
Globalize.parseFloat(val, 10, this.options.culture):+val;
}
return val===""||isNaN(val) ? null:val;
},
_format: function(value){
if(value===""){
return "";
}
return window.Globalize&&this.options.numberFormat ?
Globalize.format(value, this.options.numberFormat, this.options.culture) :
value;
},
_refresh: function(){
this.element.attr({
"aria-valuemin": this.options.min,
"aria-valuemax": this.options.max,
"aria-valuenow": this._parse(this.element.val())
});
},
isValid: function(){
var value=this.value();
if(value===null){
return false;
}
return value===this._adjustValue(value);
},
_value: function(value, allowAny){
var parsed;
if(value!==""){
parsed=this._parse(value);
if(parsed!==null){
if(!allowAny){
parsed=this._adjustValue(parsed);
}
value=this._format(parsed);
}}
this.element.val(value);
this._refresh();
},
_destroy: function(){
this.element
.prop("disabled", false)
.removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow");
this.uiSpinner.replaceWith(this.element);
},
stepUp: spinnerModifer(function(steps){
this._stepUp(steps);
}),
_stepUp: function(steps){
if(this._start()){
this._spin(( steps||1) * this.options.step);
this._stop();
}},
stepDown: spinnerModifer(function(steps){
this._stepDown(steps);
}),
_stepDown: function(steps){
if(this._start()){
this._spin(( steps||1) * -this.options.step);
this._stop();
}},
pageUp: spinnerModifer(function(pages){
this._stepUp(( pages||1) * this.options.page);
}),
pageDown: spinnerModifer(function(pages){
this._stepDown(( pages||1) * this.options.page);
}),
value: function(newVal){
if(!arguments.length){
return this._parse(this.element.val());
}
spinnerModifer(this._value).call(this, newVal);
},
widget: function(){
return this.uiSpinner;
}});
if($.uiBackCompat!==false){
$.widget("ui.spinner", $.ui.spinner, {
_enhance: function(){
this.uiSpinner=this.element
.attr("autocomplete", "off")
.wrap(this._uiSpinnerHtml())
.parent()
.append(this._buttonHtml());
},
_uiSpinnerHtml: function(){
return "<span>";
},
_buttonHtml: function(){
return "<a></a><a></a>";
}});
}
var widgetsSpinner=$.ui.spinner;
$.widget("ui.tabs", {
version: "1.12.0",
delay: 300,
options: {
active: null,
classes: {
"ui-tabs": "ui-corner-all",
"ui-tabs-nav": "ui-corner-all",
"ui-tabs-panel": "ui-corner-bottom",
"ui-tabs-tab": "ui-corner-top"
},
collapsible: false,
event: "click",
heightStyle: "content",
hide: null,
show: null,
activate: null,
beforeActivate: null,
beforeLoad: null,
load: null
},
_isLocal:(function(){
var rhash=/#.*$/;
return function(anchor){
var anchorUrl, locationUrl;
anchorUrl=anchor.href.replace(rhash, "");
locationUrl=location.href.replace(rhash, "");
try {
anchorUrl=decodeURIComponent(anchorUrl);
} catch(error){}
try {
locationUrl=decodeURIComponent(locationUrl);
} catch(error){}
return anchor.hash.length > 1&&anchorUrl===locationUrl;
};})(),
_create: function(){
var that=this,
options=this.options;
this.running=false;
this._addClass("ui-tabs", "ui-widget ui-widget-content");
this._toggleClass("ui-tabs-collapsible", null, options.collapsible);
this._processTabs();
options.active=this._initialActive();
if($.isArray(options.disabled) ){
options.disabled=$.unique(options.disabled.concat($.map(this.tabs.filter(".ui-state-disabled"), function(li){
return that.tabs.index(li);
})
)).sort();
}
if(this.options.active!==false&&this.anchors.length){
this.active=this._findActive(options.active);
}else{
this.active=$();
}
this._refresh();
if(this.active.length){
this.load(options.active);
}},
_initialActive: function(){
var active=this.options.active,
collapsible=this.options.collapsible,
locationHash=location.hash.substring(1);
if(active===null){
if(locationHash){
this.tabs.each(function(i, tab){
if($(tab).attr("aria-controls")===locationHash){
active=i;
return false;
}});
}
if(active===null){
active=this.tabs.index(this.tabs.filter(".ui-tabs-active") );
}
if(active===null||active===-1){
active=this.tabs.length ? 0:false;
}}
if(active!==false){
active=this.tabs.index(this.tabs.eq(active) );
if(active===-1){
active=collapsible ? false:0;
}}
if(!collapsible&&active===false&&this.anchors.length){
active=0;
}
return active;
},
_getCreateEventData: function(){
return {
tab: this.active,
panel: !this.active.length ? $():this._getPanelForTab(this.active)
};},
_tabKeydown: function(event){
var focusedTab=$($.ui.safeActiveElement(this.document[ 0 ]) ).closest("li"),
selectedIndex=this.tabs.index(focusedTab),
goingForward=true;
if(this._handlePageNav(event) ){
return;
}
switch(event.keyCode){
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
selectedIndex++;
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.LEFT:
goingForward=false;
selectedIndex--;
break;
case $.ui.keyCode.END:
selectedIndex=this.anchors.length - 1;
break;
case $.ui.keyCode.HOME:
selectedIndex=0;
break;
case $.ui.keyCode.SPACE:
event.preventDefault();
clearTimeout(this.activating);
this._activate(selectedIndex);
return;
case $.ui.keyCode.ENTER:
event.preventDefault();
clearTimeout(this.activating);
this._activate(selectedIndex===this.options.active ? false:selectedIndex);
return;
default:
return;
}
event.preventDefault();
clearTimeout(this.activating);
selectedIndex=this._focusNextTab(selectedIndex, goingForward);
if(!event.ctrlKey&&!event.metaKey){
focusedTab.attr("aria-selected", "false");
this.tabs.eq(selectedIndex).attr("aria-selected", "true");
this.activating=this._delay(function(){
this.option("active", selectedIndex);
}, this.delay);
}},
_panelKeydown: function(event){
if(this._handlePageNav(event) ){
return;
}
if(event.ctrlKey&&event.keyCode===$.ui.keyCode.UP){
event.preventDefault();
this.active.trigger("focus");
}},
_handlePageNav: function(event){
if(event.altKey&&event.keyCode===$.ui.keyCode.PAGE_UP){
this._activate(this._focusNextTab(this.options.active - 1, false) );
return true;
}
if(event.altKey&&event.keyCode===$.ui.keyCode.PAGE_DOWN){
this._activate(this._focusNextTab(this.options.active + 1, true) );
return true;
}},
_findNextTab: function(index, goingForward){
var lastTabIndex=this.tabs.length - 1;
function constrain(){
if(index > lastTabIndex){
index=0;
}
if(index < 0){
index=lastTabIndex;
}
return index;
}
while($.inArray(constrain(), this.options.disabled)!==-1){
index=goingForward ? index + 1:index - 1;
}
return index;
},
_focusNextTab: function(index, goingForward){
index=this._findNextTab(index, goingForward);
this.tabs.eq(index).trigger("focus");
return index;
},
_setOption: function(key, value){
if(key==="active"){
this._activate(value);
return;
}
this._super(key, value);
if(key==="collapsible"){
this._toggleClass("ui-tabs-collapsible", null, value);
if(!value&&this.options.active===false){
this._activate(0);
}}
if(key==="event"){
this._setupEvents(value);
}
if(key==="heightStyle"){
this._setupHeightStyle(value);
}},
_sanitizeSelector: function(hash){
return hash ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&"):"";
},
refresh: function(){
var options=this.options,
lis=this.tablist.children(":has(a[href])");
options.disabled=$.map(lis.filter(".ui-state-disabled"), function(tab){
return lis.index(tab);
});
this._processTabs();
if(options.active===false||!this.anchors.length){
options.active=false;
this.active=$();
}else if(this.active.length&&!$.contains(this.tablist[ 0 ], this.active[ 0 ]) ){
if(this.tabs.length===options.disabled.length){
options.active=false;
this.active=$();
}else{
this._activate(this._findNextTab(Math.max(0, options.active - 1), false) );
}}else{
options.active=this.tabs.index(this.active);
}
this._refresh();
},
_refresh: function(){
this._setOptionDisabled(this.options.disabled);
this._setupEvents(this.options.event);
this._setupHeightStyle(this.options.heightStyle);
this.tabs.not(this.active).attr({
"aria-selected": "false",
"aria-expanded": "false",
tabIndex: -1
});
this.panels.not(this._getPanelForTab(this.active) )
.hide()
.attr({
"aria-hidden": "true"
});
if(!this.active.length){
this.tabs.eq(0).attr("tabIndex", 0);
}else{
this.active
.attr({
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
});
this._addClass(this.active, "ui-tabs-active", "ui-state-active");
this._getPanelForTab(this.active)
.show()
.attr({
"aria-hidden": "false"
});
}},
_processTabs: function(){
var that=this,
prevTabs=this.tabs,
prevAnchors=this.anchors,
prevPanels=this.panels;
this.tablist=this._getList().attr("role", "tablist");
this._addClass(this.tablist, "ui-tabs-nav",
"ui-helper-reset ui-helper-clearfix ui-widget-header");
this.tablist
.on("mousedown" + this.eventNamespace, "> li", function(event){
if($(this).is(".ui-state-disabled") ){
event.preventDefault();
}})
.on("focus" + this.eventNamespace, ".ui-tabs-anchor", function(){
if($(this).closest("li").is(".ui-state-disabled") ){
this.blur();
}});
this.tabs=this.tablist.find("> li:has(a[href])")
.attr({
role: "tab",
tabIndex: -1
});
this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default");
this.anchors=this.tabs.map(function(){
return $("a", this)[ 0 ];
})
.attr({
role: "presentation",
tabIndex: -1
});
this._addClass(this.anchors, "ui-tabs-anchor");
this.panels=$();
this.anchors.each(function(i, anchor){
var selector, panel, panelId,
anchorId=$(anchor).uniqueId().attr("id"),
tab=$(anchor).closest("li"),
originalAriaControls=tab.attr("aria-controls");
if(that._isLocal(anchor) ){
selector=anchor.hash;
panelId=selector.substring(1);
panel=that.element.find(that._sanitizeSelector(selector) );
}else{
panelId=tab.attr("aria-controls")||$( {}).uniqueId()[ 0 ].id;
selector="#" + panelId;
panel=that.element.find(selector);
if(!panel.length){
panel=that._createPanel(panelId);
panel.insertAfter(that.panels[ i - 1 ]||that.tablist);
}
panel.attr("aria-live", "polite");
}
if(panel.length){
that.panels=that.panels.add(panel);
}
if(originalAriaControls){
tab.data("ui-tabs-aria-controls", originalAriaControls);
}
tab.attr({
"aria-controls": panelId,
"aria-labelledby": anchorId
});
panel.attr("aria-labelledby", anchorId);
});
this.panels.attr("role", "tabpanel");
this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content");
if(prevTabs){
this._off(prevTabs.not(this.tabs) );
this._off(prevAnchors.not(this.anchors) );
this._off(prevPanels.not(this.panels) );
}},
_getList: function(){
return this.tablist||this.element.find("ol, ul").eq(0);
},
_createPanel: function(id){
return $("<div>")
.attr("id", id)
.data("ui-tabs-destroy", true);
},
_setOptionDisabled: function(disabled){
var currentItem, li, i;
if($.isArray(disabled) ){
if(!disabled.length){
disabled=false;
}else if(disabled.length===this.anchors.length){
disabled=true;
}}
for(i=0;(li=this.tabs[ i ]); i++){
currentItem=$(li);
if(disabled===true||$.inArray(i, disabled)!==-1){
currentItem.attr("aria-disabled", "true");
this._addClass(currentItem, null, "ui-state-disabled");
}else{
currentItem.removeAttr("aria-disabled");
this._removeClass(currentItem, null, "ui-state-disabled");
}}
this.options.disabled=disabled;
this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null,
disabled===true);
},
_setupEvents: function(event){
var events={};
if(event){
$.each(event.split(" "), function(index, eventName){
events[ eventName ]="_eventHandler";
});
}
this._off(this.anchors.add(this.tabs).add(this.panels) );
this._on(true, this.anchors, {
click: function(event){
event.preventDefault();
}});
this._on(this.anchors, events);
this._on(this.tabs, { keydown: "_tabKeydown" });
this._on(this.panels, { keydown: "_panelKeydown" });
this._focusable(this.tabs);
this._hoverable(this.tabs);
},
_setupHeightStyle: function(heightStyle){
var maxHeight,
parent=this.element.parent();
if(heightStyle==="fill"){
maxHeight=parent.height();
maxHeight -=this.element.outerHeight() - this.element.height();
this.element.siblings(":visible").each(function(){
var elem=$(this),
position=elem.css("position");
if(position==="absolute"||position==="fixed"){
return;
}
maxHeight -=elem.outerHeight(true);
});
this.element.children().not(this.panels).each(function(){
maxHeight -=$(this).outerHeight(true);
});
this.panels.each(function(){
$(this).height(Math.max(0, maxHeight -
$(this).innerHeight() + $(this).height()) );
})
.css("overflow", "auto");
}else if(heightStyle==="auto"){
maxHeight=0;
this.panels.each(function(){
maxHeight=Math.max(maxHeight, $(this).height("").height());
}).height(maxHeight);
}},
_eventHandler: function(event){
var options=this.options,
active=this.active,
anchor=$(event.currentTarget),
tab=anchor.closest("li"),
clickedIsActive=tab[ 0 ]===active[ 0 ],
collapsing=clickedIsActive&&options.collapsible,
toShow=collapsing ? $():this._getPanelForTab(tab),
toHide = !active.length ? $():this._getPanelForTab(active),
eventData={
oldTab: active,
oldPanel: toHide,
newTab: collapsing ? $():tab,
newPanel: toShow
};
event.preventDefault();
if(tab.hasClass("ui-state-disabled") ||
tab.hasClass("ui-tabs-loading") ||
this.running ||
(clickedIsActive&&!options.collapsible) ||
(this._trigger("beforeActivate", event, eventData)===false) ){
return;
}
options.active=collapsing ? false:this.tabs.index(tab);
this.active=clickedIsActive ? $():tab;
if(this.xhr){
this.xhr.abort();
}
if(!toHide.length&&!toShow.length){
$.error("jQuery UI Tabs: Mismatching fragment identifier.");
}
if(toShow.length){
this.load(this.tabs.index(tab), event);
}
this._toggle(event, eventData);
},
_toggle: function(event, eventData){
var that=this,
toShow=eventData.newPanel,
toHide=eventData.oldPanel;
this.running=true;
function complete(){
that.running=false;
that._trigger("activate", event, eventData);
}
function show(){
that._addClass(eventData.newTab.closest("li"), "ui-tabs-active", "ui-state-active");
if(toShow.length&&that.options.show){
that._show(toShow, that.options.show, complete);
}else{
toShow.show();
complete();
}}
if(toHide.length&&this.options.hide){
this._hide(toHide, this.options.hide, function(){
that._removeClass(eventData.oldTab.closest("li"),
"ui-tabs-active", "ui-state-active");
show();
});
}else{
this._removeClass(eventData.oldTab.closest("li"),
"ui-tabs-active", "ui-state-active");
toHide.hide();
show();
}
toHide.attr("aria-hidden", "true");
eventData.oldTab.attr({
"aria-selected": "false",
"aria-expanded": "false"
});
if(toShow.length&&toHide.length){
eventData.oldTab.attr("tabIndex", -1);
}else if(toShow.length){
this.tabs.filter(function(){
return $(this).attr("tabIndex")===0;
})
.attr("tabIndex", -1);
}
toShow.attr("aria-hidden", "false");
eventData.newTab.attr({
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
});
},
_activate: function(index){
var anchor,
active=this._findActive(index);
if(active[ 0 ]===this.active[ 0 ]){
return;
}
if(!active.length){
active=this.active;
}
anchor=active.find(".ui-tabs-anchor")[ 0 ];
this._eventHandler({
target: anchor,
currentTarget: anchor,
preventDefault: $.noop
});
},
_findActive: function(index){
return index===false ? $():this.tabs.eq(index);
},
_getIndex: function(index){
if(typeof index==="string"){
index=this.anchors.index(this.anchors.filter("[href$='" +
$.ui.escapeSelector(index) + "']") );
}
return index;
},
_destroy: function(){
if(this.xhr){
this.xhr.abort();
}
this.tablist
.removeAttr("role")
.off(this.eventNamespace);
this.anchors
.removeAttr("role tabIndex")
.removeUniqueId();
this.tabs.add(this.panels).each(function(){
if($.data(this, "ui-tabs-destroy") ){
$(this).remove();
}else{
$(this).removeAttr("role tabIndex " +
"aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded");
}});
this.tabs.each(function(){
var li=$(this),
prev=li.data("ui-tabs-aria-controls");
if(prev){
li
.attr("aria-controls", prev)
.removeData("ui-tabs-aria-controls");
}else{
li.removeAttr("aria-controls");
}});
this.panels.show();
if(this.options.heightStyle!=="content"){
this.panels.css("height", "");
}},
enable: function(index){
var disabled=this.options.disabled;
if(disabled===false){
return;
}
if(index===undefined){
disabled=false;
}else{
index=this._getIndex(index);
if($.isArray(disabled) ){
disabled=$.map(disabled, function(num){
return num!==index ? num:null;
});
}else{
disabled=$.map(this.tabs, function(li, num){
return num!==index ? num:null;
});
}}
this._setOptionDisabled(disabled);
},
disable: function(index){
var disabled=this.options.disabled;
if(disabled===true){
return;
}
if(index===undefined){
disabled=true;
}else{
index=this._getIndex(index);
if($.inArray(index, disabled)!==-1){
return;
}
if($.isArray(disabled) ){
disabled=$.merge([ index ], disabled).sort();
}else{
disabled=[ index ];
}}
this._setOptionDisabled(disabled);
},
load: function(index, event){
index=this._getIndex(index);
var that=this,
tab=this.tabs.eq(index),
anchor=tab.find(".ui-tabs-anchor"),
panel=this._getPanelForTab(tab),
eventData={
tab: tab,
panel: panel
},
complete=function(jqXHR, status){
if(status==="abort"){
that.panels.stop(false, true);
}
that._removeClass(tab, "ui-tabs-loading");
panel.removeAttr("aria-busy");
if(jqXHR===that.xhr){
delete that.xhr;
}};
if(this._isLocal(anchor[ 0 ]) ){
return;
}
this.xhr=$.ajax(this._ajaxSettings(anchor, event, eventData) );
if(this.xhr&&this.xhr.statusText!=="canceled"){
this._addClass(tab, "ui-tabs-loading");
panel.attr("aria-busy", "true");
this.xhr
.done(function(response, status, jqXHR){
setTimeout(function(){
panel.html(response);
that._trigger("load", event, eventData);
complete(jqXHR, status);
}, 1);
})
.fail(function(jqXHR, status){
setTimeout(function(){
complete(jqXHR, status);
}, 1);
});
}},
_ajaxSettings: function(anchor, event, eventData){
var that=this;
return {
url: anchor.attr("href"),
beforeSend: function(jqXHR, settings){
return that._trigger("beforeLoad", event,
$.extend({ jqXHR: jqXHR, ajaxSettings: settings }, eventData) );
}};},
_getPanelForTab: function(tab){
var id=$(tab).attr("aria-controls");
return this.element.find(this._sanitizeSelector("#" + id) );
}});
if($.uiBackCompat!==false){
$.widget("ui.tabs", $.ui.tabs, {
_processTabs: function(){
this._superApply(arguments);
this._addClass(this.tabs, "ui-tab");
}});
}
var widgetsTabs=$.ui.tabs;
$.widget("ui.tooltip", {
version: "1.12.0",
options: {
classes: {
"ui-tooltip": "ui-corner-all ui-widget-shadow"
},
content: function(){
var title=$(this).attr("title")||"";
return $("<a>").text(title).html();
},
hide: true,
items: "[title]:not([disabled])",
position: {
my: "left top+15",
at: "left bottom",
collision: "flipfit flip"
},
show: true,
track: false,
close: null,
open: null
},
_addDescribedBy: function(elem, id){
var describedby=(elem.attr("aria-describedby")||"").split(/\s+/);
describedby.push(id);
elem
.data("ui-tooltip-id", id)
.attr("aria-describedby", $.trim(describedby.join(" ") ));
},
_removeDescribedBy: function(elem){
var id=elem.data("ui-tooltip-id"),
describedby=(elem.attr("aria-describedby")||"").split(/\s+/),
index=$.inArray(id, describedby);
if(index!==-1){
describedby.splice(index, 1);
}
elem.removeData("ui-tooltip-id");
describedby=$.trim(describedby.join(" ") );
if(describedby){
elem.attr("aria-describedby", describedby);
}else{
elem.removeAttr("aria-describedby");
}},
_create: function(){
this._on({
mouseover: "open",
focusin: "open"
});
this.tooltips={};
this.parents={};
this.liveRegion=$("<div>")
.attr({
role: "log",
"aria-live": "assertive",
"aria-relevant": "additions"
})
.appendTo(this.document[ 0 ].body);
this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible");
this.disabledTitles=$([]);
},
_setOption: function(key, value){
var that=this;
this._super(key, value);
if(key==="content"){
$.each(this.tooltips, function(id, tooltipData){
that._updateContent(tooltipData.element);
});
}},
_setOptionDisabled: function(value){
this[ value ? "_disable":"_enable" ]();
},
_disable: function(){
var that=this;
$.each(this.tooltips, function(id, tooltipData){
var event=$.Event("blur");
event.target=event.currentTarget=tooltipData.element[ 0 ];
that.close(event, true);
});
this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack()
.filter(function(){
var element=$(this);
if(element.is("[title]") ){
return element
.data("ui-tooltip-title", element.attr("title") )
.removeAttr("title");
}})
);
},
_enable: function(){
this.disabledTitles.each(function(){
var element=$(this);
if(element.data("ui-tooltip-title") ){
element.attr("title", element.data("ui-tooltip-title") );
}});
this.disabledTitles=$([]);
},
open: function(event){
var that=this,
target=$(event ? event.target:this.element)
.closest(this.options.items);
if(!target.length||target.data("ui-tooltip-id") ){
return;
}
if(target.attr("title") ){
target.data("ui-tooltip-title", target.attr("title") );
}
target.data("ui-tooltip-open", true);
if(event&&event.type==="mouseover"){
target.parents().each(function(){
var parent=$(this),
blurEvent;
if(parent.data("ui-tooltip-open") ){
blurEvent=$.Event("blur");
blurEvent.target=blurEvent.currentTarget=this;
that.close(blurEvent, true);
}
if(parent.attr("title") ){
parent.uniqueId();
that.parents[ this.id ]={
element: this,
title: parent.attr("title")
};
parent.attr("title", "");
}});
}
this._registerCloseHandlers(event, target);
this._updateContent(target, event);
},
_updateContent: function(target, event){
var content,
contentOption=this.options.content,
that=this,
eventType=event ? event.type:null;
if(typeof contentOption==="string"||contentOption.nodeType ||
contentOption.jquery){
return this._open(event, target, contentOption);
}
content=contentOption.call(target[ 0 ], function(response){
that._delay(function(){
if(!target.data("ui-tooltip-open") ){
return;
}
if(event){
event.type=eventType;
}
this._open(event, target, response);
});
});
if(content){
this._open(event, target, content);
}},
_open: function(event, target, content){
var tooltipData, tooltip, delayedShow, a11yContent,
positionOption=$.extend({}, this.options.position);
if(!content){
return;
}
tooltipData=this._find(target);
if(tooltipData){
tooltipData.tooltip.find(".ui-tooltip-content").html(content);
return;
}
if(target.is("[title]") ){
if(event&&event.type==="mouseover"){
target.attr("title", "");
}else{
target.removeAttr("title");
}}
tooltipData=this._tooltip(target);
tooltip=tooltipData.tooltip;
this._addDescribedBy(target, tooltip.attr("id") );
tooltip.find(".ui-tooltip-content").html(content);
this.liveRegion.children().hide();
a11yContent=$("<div>").html(tooltip.find(".ui-tooltip-content").html());
a11yContent.removeAttr("name").find("[name]").removeAttr("name");
a11yContent.removeAttr("id").find("[id]").removeAttr("id");
a11yContent.appendTo(this.liveRegion);
function position(event){
positionOption.of=event;
if(tooltip.is(":hidden") ){
return;
}
tooltip.position(positionOption);
}
if(this.options.track&&event&&/^mouse/.test(event.type) ){
this._on(this.document, {
mousemove: position
});
position(event);
}else{
tooltip.position($.extend({
of: target
}, this.options.position) );
}
tooltip.hide();
this._show(tooltip, this.options.show);
if(this.options.track&&this.options.show&&this.options.show.delay){
delayedShow=this.delayedShow=setInterval(function(){
if(tooltip.is(":visible") ){
position(positionOption.of);
clearInterval(delayedShow);
}}, $.fx.interval);
}
this._trigger("open", event, { tooltip: tooltip });
},
_registerCloseHandlers: function(event, target){
var events={
keyup: function(event){
if(event.keyCode===$.ui.keyCode.ESCAPE){
var fakeEvent=$.Event(event);
fakeEvent.currentTarget=target[ 0 ];
this.close(fakeEvent, true);
}}
};
if(target[ 0 ]!==this.element[ 0 ]){
events.remove=function(){
this._removeTooltip(this._find(target).tooltip);
};}
if(!event||event.type==="mouseover"){
events.mouseleave="close";
}
if(!event||event.type==="focusin"){
events.focusout="close";
}
this._on(true, target, events);
},
close: function(event){
var tooltip,
that=this,
target=$(event ? event.currentTarget:this.element),
tooltipData=this._find(target);
if(!tooltipData){
target.removeData("ui-tooltip-open");
return;
}
tooltip=tooltipData.tooltip;
if(tooltipData.closing){
return;
}
clearInterval(this.delayedShow);
if(target.data("ui-tooltip-title")&&!target.attr("title") ){
target.attr("title", target.data("ui-tooltip-title") );
}
this._removeDescribedBy(target);
tooltipData.hiding=true;
tooltip.stop(true);
this._hide(tooltip, this.options.hide, function(){
that._removeTooltip($(this) );
});
target.removeData("ui-tooltip-open");
this._off(target, "mouseleave focusout keyup");
if(target[ 0 ]!==this.element[ 0 ]){
this._off(target, "remove");
}
this._off(this.document, "mousemove");
if(event&&event.type==="mouseleave"){
$.each(this.parents, function(id, parent){
$(parent.element).attr("title", parent.title);
delete that.parents[ id ];
});
}
tooltipData.closing=true;
this._trigger("close", event, { tooltip: tooltip });
if(!tooltipData.hiding){
tooltipData.closing=false;
}},
_tooltip: function(element){
var tooltip=$("<div>").attr("role", "tooltip"),
content=$("<div>").appendTo(tooltip),
id=tooltip.uniqueId().attr("id");
this._addClass(content, "ui-tooltip-content");
this._addClass(tooltip, "ui-tooltip", "ui-widget ui-widget-content");
tooltip.appendTo(this._appendTo(element) );
return this.tooltips[ id ]={
element: element,
tooltip: tooltip
};},
_find: function(target){
var id=target.data("ui-tooltip-id");
return id ? this.tooltips[ id ]:null;
},
_removeTooltip: function(tooltip){
tooltip.remove();
delete this.tooltips[ tooltip.attr("id") ];
},
_appendTo: function(target){
var element=target.closest(".ui-front, dialog");
if(!element.length){
element=this.document[ 0 ].body;
}
return element;
},
_destroy: function(){
var that=this;
$.each(this.tooltips, function(id, tooltipData){
var event=$.Event("blur"),
element=tooltipData.element;
event.target=event.currentTarget=element[ 0 ];
that.close(event, true);
$("#" + id).remove();
if(element.data("ui-tooltip-title") ){
if(!element.attr("title") ){
element.attr("title", element.data("ui-tooltip-title") );
}
element.removeData("ui-tooltip-title");
}});
this.liveRegion.remove();
}});
if($.uiBackCompat!==false){
$.widget("ui.tooltip", $.ui.tooltip, {
options: {
tooltipClass: null
},
_tooltip: function(){
var tooltipData=this._superApply(arguments);
if(this.options.tooltipClass){
tooltipData.tooltip.addClass(this.options.tooltipClass);
}
return tooltipData;
}});
}
var widgetsTooltip=$.ui.tooltip;
}));
if(!jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(window.jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]');if(a.length){var b=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");"radio"===b.prop("type")&&a.find(".active").removeClass("active")}this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(window.jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b),f.trigger(d=a.Event("show.bs.dropdown")),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown"),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=a("[role=menu] li:not(.divider):visible a",f);if(h.length){var i=h.index(h.filter(":focus"));38==b.keyCode&&i>0&&i--,40==b.keyCode&&i<h.length-1&&i++,~i||(i=0),h.eq(i).focus()}}}};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("dropdown");d||c.data("dropdown",d=new f(this)),"string"==typeof b&&d[b].call(c)})},a.fn.dropdown.Constructor=f,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",e,f.prototype.toggle).on("keydown.bs.dropdown.data-api",e+", [role=menu]",f.prototype.keydown)}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.load(this.options.remote)};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show(),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)}))},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var d=a.support.transition&&c;if(this.$backdrop=a('<div class="modal-backdrop '+c+'" />').appendTo(document.body),this.$element.on("click.dismiss.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focus",i="hover"==g?"mouseleave":"blur";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show),void 0):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide),void 0):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this.tip();this.setContent(),this.options.animation&&c.addClass("fade");var d="function"==typeof this.options.placement?this.options.placement.call(this,c[0],this.$element[0]):this.options.placement,e=/\s?auto?\s?/i,f=e.test(d);f&&(d=d.replace(e,"")||"top"),c.detach().css({top:0,left:0,display:"block"}).addClass(d),this.options.container?c.appendTo(this.options.container):c.insertAfter(this.$element);var g=this.getPosition(),h=c[0].offsetWidth,i=c[0].offsetHeight;if(f){var j=this.$element.parent(),k=d,l=document.documentElement.scrollTop||document.body.scrollTop,m="body"==this.options.container?window.innerWidth:j.outerWidth(),n="body"==this.options.container?window.innerHeight:j.outerHeight(),o="body"==this.options.container?0:j.offset().left;d="bottom"==d&&g.top+g.height+i-l>n?"top":"top"==d&&g.top-l-i<0?"bottom":"right"==d&&g.right+h>m?"left":"left"==d&&g.left-h<o?"right":d,c.removeClass(k).addClass(d)}var p=this.getCalculatedOffset(d,g,h,i);this.applyPlacement(p,d),this.$element.trigger("shown.bs."+this.type)}},b.prototype.applyPlacement=function(a,b){var c,d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),a.top=a.top+g,a.left=a.left+h,d.offset(a).addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;if("top"==b&&j!=f&&(c=!0,a.top=a.top+f-j),/bottom|top/.test(b)){var k=0;a.left<0&&(k=-2*a.left,a.left=0,d.offset(a),i=d[0].offsetWidth,j=d[0].offsetHeight),this.replaceArrow(k-e+i,i,"left")}else this.replaceArrow(j-f,j,"top");c&&d.offset(a)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach()}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,b).emulateTransitionEnd(150):b(),this.$element.trigger("hidden.bs."+this.type),this)},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},"function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof c&&c;e||d.data("bs.tooltip",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(window.jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(window.jQuery);
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox"  aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><label class="search_label">gd<input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></label></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","Ｂ":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","Ｃ":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","Ｄ":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","Ǳ":"DZ","Ǆ":"DZ","ǲ":"Dz","ǅ":"Dz","Ⓔ":"E","Ｅ":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","Ｆ":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","Ｇ":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","Ｈ":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","Ｉ":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","Ｊ":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","Ｋ":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","Ｌ":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","Ǉ":"LJ","ǈ":"Lj","Ⓜ":"M","Ｍ":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","Ｎ":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","Ǌ":"NJ","ǋ":"Nj","Ⓞ":"O","Ｏ":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","Ｐ":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Ｑ":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","Ｒ":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","Ｓ":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","Ｔ":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","Ｕ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","Ｖ":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");
if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b),d=g.$element.find("option").filter(function(){return a(this).val()===c.id});if(!d.length){var e=g.option(c);e.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([e])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null;
},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
(function(window){
'use strict';
function classReg(className){
return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
}
var hasClass, addClass, removeClass;
if('classList' in document.documentElement){
hasClass=function(elem, c){
return elem.classList.contains(c);
};
addClass=function(elem, c){
elem.classList.add(c);
};
removeClass=function(elem, c){
elem.classList.remove(c);
};}else{
hasClass=function(elem, c){
return classReg(c).test(elem.className);
};
addClass=function(elem, c){
if(!hasClass(elem, c) ){
elem.className=elem.className + ' ' + c;
}};
removeClass=function(elem, c){
elem.className=elem.className.replace(classReg(c), ' ');
};}
function toggleClass(elem, c){
var fn=hasClass(elem, c) ? removeClass:addClass;
fn(elem, c);
}
var classie={
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
toggleClass: toggleClass,
has: hasClass,
add: addClass,
remove: removeClass,
toggle: toggleClass
};
if(typeof define==='function'&&define.amd){
define(classie);
}else{
window.classie=classie;
}})(window);
jQuery(document).ready(function(){
jQuery('.list_post').click(function (){
jQuery(this).children('div.tribe-events-content').slideToggle();
return false;
});
});
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a<g.placeholder.length?a:0)}function q(a){for(;++a<n&&!j[a];);return a}function r(a){for(;--a>=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(o&&o.length&&o.length>a.length){for(A(!0);b.begin>0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.begin<l&&!j[b.begin];)b.begin++;B.caret(b.begin,b.begin)}else{for(A(!0);b.begin<n&&!j[b.begin];)b.begin++;B.caret(b.begin,b.begin)}h()}function v(){A(),B.val()!=E&&B.change()}function w(a){if(!B.prop("readonly")){var b,c,e,f=a.which||a.keyCode;o=B.val(),8===f||46===f||d&&127===f?(b=B.caret(),c=b.begin,e=b.end,e-c===0&&(c=46!==f?r(c):e=q(c-1),e=46===f?q(e):e),y(c,e),s(c,e-1),a.preventDefault()):13===f?v.call(this,a):27===f&&(B.val(E),B.caret(0,A()),a.preventDefault())}}function x(b){if(!B.prop("readonly")){var c,d,e,g=b.which||b.keyCode,i=B.caret();if(!(b.ctrlKey||b.altKey||b.metaKey||32>g)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++<e.length;)if(c=e.charAt(d-1),j[b].test(c)){C[b]=c,f=b;break}if(d>e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){B.get(0)===document.activeElement&&(z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a))},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})});
!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(z)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(z,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return L(b.options[a]||K,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a('<span id="MonthPicker_Button_'+this.id+'" class="month-picker-open-button">'+b.i18n.buttonText+"</span>").jqueryUIButton({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.jqueryUIButton("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b,c){function d(){j=setTimeout(e,175)}function e(){j=null,l=a("span",b).animate({opacity:.45},k,f)}function f(){i=l.text(),l.animate({opacity:1},k).text(c)}function g(){j?clearTimeout(j):l=a("span",b).animate({opacity:.45},k,h)}function h(){l.text(i).animate({opacity:1},k)}var i,j,k=125,l=a();b.on("mouseenter"+t+"h",d),b.on("mouseleave"+t+"h",g),b.data(v,function(){clearTimeout(j),l.stop().css({opacity:1}),b.off(t+"h")})}function q(a,b){var c=a.data("ui-button");c.option("disabled")!==b&&c.option("disabled",b)}var r="MonthPicker Error: ";if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(r+"The jQuery UI button and datepicker plug-ins must be loaded.");a.widget.bridge("jqueryUIButton",a.ui.button);var s=a.fx.speeds,t=".MonthPicker",u="month-year-input",v="month-picker-clear-hint",w=".ui-button-icon-primary",x="month-picker-disabled",y="ui-state-highlight",z="ui-state-active",A="ui-state-default",B={my:"left top+1",at:"left bottom"},C={my:"right top+1",at:"right bottom"},D=r+"The jQuery UI position plug-in must be loaded.",E=r+"Unsupported % option value, supported values are: ",F=r+'"_" is not a valid %Month value.',G=null,H=!!a.ui.position,I={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},J={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},K=a.noop,L=a.proxy,M=a.datepicker,N="click"+t;a.MonthPicker={VERSION:"3.0.3",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next12Years:"Jump Forward 12 Years",prev12Years:"Jump Back 12 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",backTo:"Back to",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var O='<div class="ui-widget-header month-picker-header ui-corner-all"><table class="month-picker-year-table"><tr><td class="month-picker-previous"><a /></td><td class="month-picker-title"><a /></td><td class="month-picker-next"><a /></td></tr></table></div><div><table class="month-picker-month-table" /></div>';a.widget("KidSysco.MonthPicker",{options:{i18n:{},IsRTL:!1,Position:null,StartYear:null,ShowIcon:!0,UseInputMask:!1,ValidationErrorMessage:null,Disabled:!1,MonthFormat:"mm/yy",Animation:"fadeToggle",ShowAnim:null,HideAnim:null,ShowOn:null,MinMonth:null,MaxMonth:null,Duration:"normal",Button:m,ButtonIcon:"ui-icon-calculator"},_monthPickerButton:a(),_validationMessage:a(),_selectedBtn:a(),_destroy:function(){var b=this.element;a.mask&&this.options.UseInputMask&&(b.unmask(),this.GetSelectedDate()||b.val("")),b.removeClass(u).off(t),a(c).off(t+this.uuid),this._monthPickerMenu.remove();var d=this._monthPickerButton.off(N);this._removeOldBtn&&d.remove(),this._validationMessage.remove(),G===this&&(G=null)},_setOption:function(b,c){switch(b){case"i18n":c=a.extend({},c);break;case"Position":if(!H)return void alert(D);break;case"MonthFormat":var d=this.GetSelectedDate();d&&this.element.val(this.FormatMonth(d,c))}return b in I&&-1===a.inArray(c,I[b])?void alert(E.replace(/%/,b)+I[b]):(this._super(b,c),void(J[b]?this[J[b]](c):0))},_create:function(){var b=this.element,e=this.options,g=b.attr("type");if(!b.is("input,div,span")||"text"!==g&&"month"!==g&&void 0!==g){var h=r+"MonthPicker can only be called on text or month inputs.";return alert(h+" \n\nSee (developer tools) for more details."),console.error(h+"\n Caused by:"),console.log(b[0]),!1}if(!a.mask&&e.UseInputMask)return alert(r+"The UseInputMask option requires the Input Mask Plugin. Get it from digitalbush.com"),!1;if(null!==e.Position&&!H)return alert(D),!1;for(var i in I)if(null!==e[i]&&-1===a.inArray(e[i],I[i]))return alert(E.replace(/%/,i)+I[i]),!1;this._isMonthInputType="month"===b.attr("type"),this._isMonthInputType&&(this.options.MonthFormat=this.MonthInputFormat,b.css("width","auto"));var k=this._monthPickerMenu=a('<div id="MonthPicker_'+b[0].id+'" class="month-picker ui-widget ui-widget-content ui-corner-all"></div>').hide(),l=o(b);a(O).appendTo(k),k.appendTo(l?b:c.body),this._titleButton=a(".month-picker-title",k).click(L(this._showYearsClickHandler,this)).find("a").jqueryUIButton().removeClass(A),this._applyJumpYearsHint(),this._createValidationMessage(),this._prevButton=a(".month-picker-previous>a",k).jqueryUIButton({text:!1}).removeClass(A),this._nextButton=a(".month-picker-next>a",k).jqueryUIButton({text:!1}).removeClass(A),this._setRTL(e.IsRTL),a(w,this._nextButton).text(this._i18n("nextLabel")),a(w,this._prevButton).text(this._i18n("prevLabel"));for(var m=a(".month-picker-month-table",k),n=0;12>n;n++){var p=n%3?p:a("<tr />").appendTo(m);p.append('<td><a class="button-'+(n+1)+'" /></td>')}this._buttons=a("a",m).jqueryUIButton(),k.on("mousedown"+t,function(a){a.preventDefault()});var q=this,s="Month";a.each(["Min","Max"],function(a,b){q["_set"+b+s]=function(a){(q["_"+b+s]=j(q,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},q._setOption(b+s,q.options[b+s])});var v=e.SelectedMonth;if(void 0!==v){var x=j(this,v);b.val(this._formatMonth(new d(f(x),x%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,l?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),a(this.options.AltField).val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on("mousedown"+t+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._backToYear&&(this._applyJumpYearsHint(),this._backToYear=0),this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off("mousedown"+t+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;if(b){var e=new d(f(b),b%12,1);c.val(this._formatMonth(e)),this._updateAlt(0,e),this._validationMessage.hide()}else this.Clear();this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._titleButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,{},a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)).on("mousedown"+t,function(a){a.preventDefault()}),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a('<span id="MonthPicker_Validation_'+c[0].id+'" class="month-picker-invalid-message">'+b+"</span>"),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._titleButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),this._applyJumpYearsHint(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{this._backToYear=this._getPickerYear(),this._showYears();var a=this._i18n("backTo")+" "+this._getPickerYear();this._titleButton.jqueryUIButton({label:a}).data(v)(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);