(function(){var n=function(){for(var n=3,t=document.createElement("b"),i=t.all||[];t.innerHTML="<!--[if gt IE "+ ++n+"]><i><![endif]-->",i[0];);return n>4?n:document.documentMode}();typeof n!="undefined"&&(document.documentElement.className+=" ie ie"+n,typeof Modernizr!="undefined"?(Modernizr.ie=n,window.ie=n):window.ie=n)})(),function(n){"use strict";var r=window.console||function(){},o={defaults:{debug:!1,RODom:!1,patternLibrary:{phone:/([\+][0-9]{1,3}([ \.\-])?)?([\(][0-9]{1,6}[\)])?([0-9A-Za-z \.\-]{1,32})(([A-Za-z \:]{1,11})?[0-9]{1,4}?)/,email:/((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?/,url:/(https?|ftp):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?/,number:/-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?/,dateISO:/\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,alpha:/[a-zA-Z]+/,alphaNumeric:/\w+/,integer:/-?\d+/},classPrefix:"h5-",errorClass:"ui-state-error",validClass:"ui-state-valid",activeClass:"active",requiredClass:"required",requiredAttribute:"required",patternAttribute:"pattern",errorAttribute:"data-h5-errorid",customEvents:{validate:!0},kbSelectors:":input:not(:button):not(:disabled):not(.novalidate)",focusout:!0,focusin:!1,change:!0,keyup:!1,activeKeyup:!0,mSelectors:'[type="range"]:not(:disabled):not(.novalidate), :radio:not(:disabled):not(.novalidate), :checkbox:not(:disabled):not(.novalidate), select:not(:disabled):not(.novalidate), option:not(:disabled):not(.novalidate)',click:!0,requiredVar:"h5-required",patternVar:"h5-pattern",stripMarkup:!0,submit:!0,focusFirstInvalidElementOnSubmit:!0,validateOnSubmit:!0,invalidCallback:function(){},validCallback:function(){},allValidSelectors:":input:visible:not(:button):not(:disabled):not(.novalidate)",markInvalid:function(t){var i=n(t.element),r=n(t.errorID);return i.addClass(t.errorClass).removeClass(t.validClass),i.addClass(t.settings.activeClass),r.length&&(i.attr("title")&&r.text(i.attr("title")),r.show()),i.data("valid",!1),t.settings.invalidCallback.call(t.element,t.validity),i},markValid:function(t){var i=n(t.element),r=n(t.errorID);return i.addClass(t.validClass).removeClass(t.errorClass),r.length&&r.hide(),i.data("valid",!0),t.settings.validCallback.call(t.element,t.validity),i},unmark:function(t){var i=n(t.element);return i.removeClass(t.errorClass).removeClass(t.validClass),i.form.find("#"+t.element.id).removeClass(t.errorClass).removeClass(t.validClass),i}}},t=o.defaults,s=t.patternLibrary,h=function(t){return n.extend({customError:t.customError||!1,patternMismatch:t.patternMismatch||!1,rangeOverflow:t.rangeOverflow||!1,rangeUnderflow:t.rangeUnderflow||!1,stepMismatch:t.stepMismatch||!1,tooLong:t.tooLong||!1,typeMismatch:t.typeMismatch||!1,valid:t.valid||!0,valueMissing:t.valueMissing||!1},t)},i={isValid:function(t,i){var r=n(this);return i=t&&i||{},i.revalidate!==!1&&r.trigger("validate"),r.data("valid")},allValid:function(t,i){var u=!0,e=[],r=n(this),o,s,h=[],c=function(n,t){t.e=n;e.push(t)},f=n.extend({},t,i);return i=i||{},r.trigger("formValidate",{settings:n.extend(!0,{},f)}),r.undelegate(f.allValidSelectors,".allValid",c),r.delegate(f.allValidSelectors,"validated.allValid",c),o=r.find(f.allValidSelectors),s=o.filter(function(){var n;if(this.tagName==="INPUT"&&this.type==="radio"){if(n=this.name,h[n]===!0)return!1;h[n]=!0}return!0}),s.each(function(){var t=n(this);u=t.h5Validate("isValid",i)&&u}),r.trigger("formValidated",{valid:u,elements:e}),u},validate:function(t){var i=n(this),e=i.filter("[pattern]")[0]?i.attr("pattern"):!1,o=new RegExp("^(?:"+e+")$"),s=null,f=i.is("[type=checkbox]")?i.is(":checked"):i.is("[type=radio]")?(s=i.parents("form").find('input[name="'+i.attr("name")+'"]')).filter(":checked").length>0:i.val(),a=t.errorClass,v=t.validClass,y=i.attr(t.errorAttribute)||!1,p=y?"#"+y.replace(/(:|\.|\[|\])/g,"\\$1"):!1,c=!1,u=h({element:this,valid:!0}),w=n("<input required>"),l;c=w.filter("[required]")&&w.filter("[required]").length?i.filter("[required]").length&&i.attr("required")!=="false":i.attr("required")!==undefined;t.debug&&window.console&&(r.log('Validate called on "'+f+'" with regex "'+o+'". Required: '+c),r.log("Regex test: "+o.test(f)+", Pattern: "+e));l=parseInt(i.attr("maxlength"),10);!isNaN(l)&&f.length>l&&(u.valid=!1,u.tooLong=!0);c&&!f?(u.valid=!1,u.valueMissing=!0):e&&!o.test(f)&&f?(u.valid=!1,u.patternMismatch=!0):t.RODom||t.markValid({element:this,validity:u,errorClass:a,validClass:v,errorID:p,settings:t});u.valid||t.RODom||t.markInvalid({element:this,validity:u,errorClass:a,validClass:v,errorID:p,settings:t});i.trigger("validated",u);s!==null&&t.alreadyCheckingRelatedRadioButtons!==!0&&(t.alreadyCheckingRelatedRadioButtons=!0,s.not(i).trigger("validate"),t.alreadyCheckingRelatedRadioButtons=!1)},delegateEvents:function(t,i,r,u){var f={},e=0,o=function(){u.validate.call(this,u)};n.each(i,function(n,t){t&&(f[n]=n)});for(e in f)f.hasOwnProperty(e)&&n(r).delegate(t,f[e]+".h5Validate",o);return r},bindDelegation:function(t){var i=n(this),r;return n.each(s,function(i,r){var u=r.toString();u=u.substring(1,u.length-1);n("."+t.classPrefix+i).attr("pattern",u)}),r=i.filter("form").add(i.find("form")).add(i.parents("form")),r.attr("novalidate","novalidate").submit(u),r.find("input[formnovalidate][type='submit']").click(function(){n(this).closest("form").unbind("submit",u)}),this.each(function(){var n={focusout:t.focusout,focusin:t.focusin,change:t.change,keyup:t.keyup},i={click:t.click},r={keyup:t.activeKeyup};t.delegateEvents(":input",t.customEvents,this,t);t.delegateEvents(t.kbSelectors,n,this,t);t.delegateEvents(t.mSelectors,i,this,t);t.delegateEvents(t.activeClassSelector,r,this,t);t.delegateEvents("textarea[maxlength]",{keyup:!0},this,t)})}},u=function(t){var r,i=e.call(this),u,f;if(i.submit===!0)return r=n(this),u=r.h5Validate("allValid",{revalidate:i.validateOnSubmit===!0}),u!==!0&&(t.preventDefault(),i.focusFirstInvalidElementOnSubmit===!0&&(f=n(i.allValidSelectors,r).filter(function(){return n(this).h5Validate("isValid",{revalidate:!1})!==!0}),f.first().focus())),u},f=[],c=function(r){var u=n.extend({},t,r,i),f=u.classPrefix+u.activeClass;return n.extend(u,{activeClass:f,activeClassSelector:"."+f,requiredClass:u.classPrefix+u.requiredClass,el:this})},e=function(){var t=n(this).closest("[data-h5-instanceId]");return f[t.attr("data-h5-instanceId")]},l=function(t){var i=f.push(t)-1;t.RODom!==!0&&n(this).attr("data-h5-instanceId",i);n(this).trigger("instance",{"data-h5-instanceId":i})};n.h5Validate={addPatterns:function(n){var r=t.patternLibrary;for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i]);return r},validValues:function(t,i){for(var r=0,e=i.length,u="",f,r=0;r<e;r+=1)u=u?u+"|"+i[r]:i[r];f=new RegExp("^(?:"+u+")$");n(t).data("regex",f)}};n.fn.h5Validate=function(t){var f,u,r;return typeof t=="string"&&typeof i[t]=="function"?(r=e.call(this),u=[].slice.call(arguments,0),f=t,u.shift(),u=n.merge([r],u),r[f].apply(this,u)):(r=c.call(this,t),l.call(this,r),i.bindDelegation.call(this,r))}}(jQuery),function(n){var t={},r={mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,wrapperClass:"bx-wrapper",touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",autoHover:!1,autoDelay:0,autoSlideForOnePage:!1,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,onSliderLoad:function(){},onSlideBefore:function(){},onSlideAfter:function(){},onSlideNext:function(){},onSlidePrev:function(){},onSliderResize:function(){}};n.fn.bxSlider=function(u){var f,e;if(this.length==0)return this;if(this.length>1)return this.each(function(){n(this).bxSlider(u)}),this;f={};e=this;t.el=this;var w=n(window).width(),b=n(window).height(),k=function(){f.settings=n.extend({},r,u);f.settings.slideWidth=parseInt(f.settings.slideWidth);f.children=e.children(f.settings.slideSelector);f.children.length<f.settings.minSlides&&(f.settings.minSlides=f.children.length);f.children.length<f.settings.maxSlides&&(f.settings.maxSlides=f.children.length);f.settings.randomStart&&(f.settings.startSlide=Math.floor(Math.random()*f.children.length));f.active={index:f.settings.startSlide};f.carousel=f.settings.minSlides>1||f.settings.maxSlides>1;f.carousel&&(f.settings.preloadImages="all");f.minThreshold=f.settings.minSlides*f.settings.slideWidth+(f.settings.minSlides-1)*f.settings.slideMargin;f.maxThreshold=f.settings.maxSlides*f.settings.slideWidth+(f.settings.maxSlides-1)*f.settings.slideMargin;f.working=!1;f.controls={};f.interval=null;f.animProp=f.settings.mode=="vertical"?"top":"left";f.usingCSS=f.settings.useCSS&&f.settings.mode!="fade"&&function(){var i=document.createElement("div"),n=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var t in n)if(i.style[n[t]]!==undefined)return f.cssPrefix=n[t].replace("Perspective","").toLowerCase(),f.animProp="-"+f.cssPrefix+"-transform",!0;return!1}();f.settings.mode=="vertical"&&(f.settings.maxSlides=f.settings.minSlides);e.data("origStyle",e.attr("style"));e.children(f.settings.slideSelector).each(function(){n(this).data("origStyle",n(this).attr("style"))});ft()},ft=function(){var i,t;e.wrap('<div class="'+f.settings.wrapperClass+'"><div class="bx-viewport"><\/div><\/div>');f.viewport=e.parent();f.loader=n('<div class="bx-loading" />');f.viewport.prepend(f.loader);e.css({width:f.settings.mode=="horizontal"?f.children.length*100+215+"%":"auto",position:"relative"});f.usingCSS&&f.settings.easing?e.css("-"+f.cssPrefix+"-transition-timing-function",f.settings.easing):f.settings.easing||(f.settings.easing="swing");i=h();f.viewport.css({width:"100%",overflow:"hidden",position:"relative"});f.viewport.parent().css({maxWidth:st()});f.settings.pager||f.viewport.parent().css({margin:"0 auto 0px"});f.children.css({float:f.settings.mode=="horizontal"?"left":"none",listStyle:"none",position:"relative"});f.children.css("width",d());f.settings.mode=="horizontal"&&f.settings.slideMargin>0&&f.children.css("marginRight",f.settings.slideMargin);f.settings.mode=="vertical"&&f.settings.slideMargin>0&&f.children.css("marginBottom",f.settings.slideMargin);f.settings.mode=="fade"&&(f.children.css({position:"absolute",zIndex:0,display:"none"}),f.children.eq(f.settings.startSlide).css({zIndex:f.settings.slideZIndex,display:"block"}));f.controls.el=n('<div class="bx-controls" />');f.settings.captions&&at();f.active.last=f.settings.startSlide==o()-1;f.settings.video&&e.fitVids();t=f.children.eq(f.settings.startSlide);f.settings.preloadImages=="all"&&(t=f.children);f.settings.ticker?f.settings.pager=!1:(f.settings.pager&&ht(),f.settings.controls&&ct(),f.settings.auto&&f.settings.autoControls&&lt(),(f.settings.controls||f.settings.autoControls||f.settings.pager)&&f.viewport.after(f.controls.el));et(t,ot)},et=function(t,i){var r=t.find("img, iframe").length,u;if(r==0){i();return}u=0;t.find("img, iframe").each(function(){n(this).one("load",function(){++u==r&&i()}).each(function(){this.complete&&n(this).load()})})},ot=function(){if(f.settings.infiniteLoop&&f.settings.mode!="fade"&&!f.settings.ticker){var t=f.settings.mode=="vertical"?f.settings.minSlides:f.settings.maxSlides,i=f.children.slice(0,t).clone().addClass("bx-clone"),r=f.children.slice(-t).clone().addClass("bx-clone");e.append(i).prepend(r)}f.loader.remove();g();f.settings.mode=="vertical"&&(f.settings.adaptiveHeight=!0);f.viewport.height(l());e.redrawSlider();f.settings.onSliderLoad(f.active.index);f.initialized=!0;f.settings.responsive&&n(window).bind("resize",ut);f.settings.auto&&f.settings.autoStart&&(o()>1||f.settings.autoSlideForOnePage)&&kt();f.settings.ticker&&dt();f.settings.pager&&v(f.settings.startSlide);f.settings.controls&&tt();f.settings.touchEnabled&&!f.settings.ticker&&gt()},l=function(){var r=0,t=n(),u;if(f.settings.mode=="vertical"||f.settings.adaptiveHeight)if(f.carousel)for(u=f.settings.moveSlides==1?f.active.index:f.active.index*c(),t=f.children.eq(u),i=1;i<=f.settings.maxSlides-1;i++)t=u+i>=f.children.length?t.add(f.children.eq(i-1)):t.add(f.children.eq(u+i));else t=f.children.eq(f.active.index);else t=f.children;return f.settings.mode=="vertical"?(t.each(function(){r+=n(this).outerHeight()}),f.settings.slideMargin>0&&(r+=f.settings.slideMargin*(f.settings.minSlides-1))):r=Math.max.apply(Math,t.map(function(){return n(this).outerHeight(!1)}).get()),f.viewport.css("box-sizing")=="border-box"?r+=parseFloat(f.viewport.css("padding-top"))+parseFloat(f.viewport.css("padding-bottom"))+parseFloat(f.viewport.css("border-top-width"))+parseFloat(f.viewport.css("border-bottom-width")):f.viewport.css("box-sizing")=="padding-box"&&(r+=parseFloat(f.viewport.css("padding-top"))+parseFloat(f.viewport.css("padding-bottom"))),r},st=function(){var n="100%";return f.settings.slideWidth>0&&(n=f.settings.mode=="horizontal"?f.settings.maxSlides*f.settings.slideWidth+(f.settings.maxSlides-1)*f.settings.slideMargin:f.settings.slideWidth),n},d=function(){var t=f.settings.slideWidth,n=f.viewport.width();return f.settings.slideWidth==0||f.settings.slideWidth>n&&!f.carousel||f.settings.mode=="vertical"?t=n:f.settings.maxSlides>1&&f.settings.mode=="horizontal"&&(n>f.maxThreshold||n<f.minThreshold&&(t=(n-f.settings.slideMargin*(f.settings.minSlides-1))/f.settings.minSlides)),t},h=function(){var n=1,t;return f.settings.mode=="horizontal"&&f.settings.slideWidth>0?f.viewport.width()<f.minThreshold?n=f.settings.minSlides:f.viewport.width()>f.maxThreshold?n=f.settings.maxSlides:(t=f.children.first().width()+f.settings.slideMargin,n=Math.floor((f.viewport.width()+f.settings.slideMargin)/t)):f.settings.mode=="vertical"&&(n=f.settings.minSlides),n},o=function(){var n=0,t,i;if(f.settings.moveSlides>0)if(f.settings.infiniteLoop)n=Math.ceil(f.children.length/c());else for(t=0,i=0;t<f.children.length;)++n,t=i+h(),i+=f.settings.moveSlides<=h()?f.settings.moveSlides:h();else n=Math.ceil(f.children.length/h());return n},c=function(){return f.settings.moveSlides>0&&f.settings.moveSlides<=h()?f.settings.moveSlides:h()},g=function(){var t,i,n;f.children.length>f.settings.maxSlides&&f.active.last&&!f.settings.infiniteLoop?f.settings.mode=="horizontal"?(t=f.children.last(),n=t.position(),s(-(n.left-(f.viewport.width()-t.outerWidth())),"reset",0)):f.settings.mode=="vertical"&&(i=f.children.length-f.settings.minSlides,n=f.children.eq(i).position(),s(-n.top,"reset",0)):(n=f.children.eq(f.active.index*c()).position(),f.active.index==o()-1&&(f.active.last=!0),n!=undefined&&(f.settings.mode=="horizontal"?s(-n.left,"reset",0):f.settings.mode=="vertical"&&s(-n.top,"reset",0)))},s=function(n,t,i,r){var u,o;f.usingCSS?(u=f.settings.mode=="vertical"?"translate3d(0, "+n+"px, 0)":"translate3d("+n+"px, 0, 0)",e.css("-"+f.cssPrefix+"-transition-duration",i/1e3+"s"),t=="slide"?(e.css(f.animProp,u),e.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){e.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd");y()})):t=="reset"?e.css(f.animProp,u):t=="ticker"&&(e.css("-"+f.cssPrefix+"-transition-timing-function","linear"),e.css(f.animProp,u),e.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){e.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd");s(r.resetValue,"reset",0);a()}))):(o={},o[f.animProp]=n,t=="slide"?e.animate(o,i,f.settings.easing,function(){y()}):t=="reset"?e.css(f.animProp,n):t=="ticker"&&e.animate(o,speed,"linear",function(){s(r.resetValue,"reset",0);a()}))},nt=function(){for(var i,r="",u=o(),t=0;t<u;t++)i="",f.settings.buildPager&&n.isFunction(f.settings.buildPager)?(i=f.settings.buildPager(t),f.pagerEl.addClass("bx-custom-pager")):(i=t+1,f.pagerEl.addClass("bx-default-pager")),r+='<div class="bx-pager-item"><a href="" data-slide-index="'+t+'" class="bx-pager-link">'+i+"<\/a><\/div>";f.pagerEl.html(r)},ht=function(){f.settings.pagerCustom?f.pagerEl=n(f.settings.pagerCustom):(f.pagerEl=n('<div class="bx-pager" />'),f.settings.pagerSelector?n(f.settings.pagerSelector).html(f.pagerEl):f.controls.el.addClass("bx-has-pager").append(f.pagerEl),nt());f.pagerEl.on("click","a",bt)},ct=function(){f.controls.next=n('<a class="bx-next" href="">'+f.settings.nextText+"<\/a>");f.controls.prev=n('<a class="bx-prev" href="">'+f.settings.prevText+"<\/a>");f.controls.next.bind("click",vt);f.controls.prev.bind("click",yt);f.settings.nextSelector&&n(f.settings.nextSelector).append(f.controls.next);f.settings.prevSelector&&n(f.settings.prevSelector).append(f.controls.prev);f.settings.nextSelector||f.settings.prevSelector||(f.controls.directionEl=n('<div class="bx-controls-direction" />'),f.controls.directionEl.append(f.controls.prev).append(f.controls.next),f.controls.el.addClass("bx-has-controls-direction").append(f.controls.directionEl))},lt=function(){f.controls.start=n('<div class="bx-controls-auto-item"><a class="bx-start" href="">'+f.settings.startText+"<\/a><\/div>");f.controls.stop=n('<div class="bx-controls-auto-item"><a class="bx-stop" href="">'+f.settings.stopText+"<\/a><\/div>");f.controls.autoEl=n('<div class="bx-controls-auto" />');f.controls.autoEl.on("click",".bx-start",pt);f.controls.autoEl.on("click",".bx-stop",wt);f.settings.autoControlsCombine?f.controls.autoEl.append(f.controls.start):f.controls.autoEl.append(f.controls.start).append(f.controls.stop);f.settings.autoControlsSelector?n(f.settings.autoControlsSelector).html(f.controls.autoEl):f.controls.el.addClass("bx-has-controls-auto").append(f.controls.autoEl);p(f.settings.autoStart?"stop":"start")},at=function(){f.children.each(function(){var t=n(this).find("img:first").attr("title");t!=undefined&&(""+t).length&&n(this).append('<div class="bx-caption"><span>'+t+"<\/span><\/div>")})},vt=function(n){f.settings.auto&&e.stopAuto();e.goToNextSlide();n.preventDefault()},yt=function(n){f.settings.auto&&e.stopAuto();e.goToPrevSlide();n.preventDefault()},pt=function(n){e.startAuto();n.preventDefault()},wt=function(n){e.stopAuto();n.preventDefault()},bt=function(t){var i,r;f.settings.auto&&e.stopAuto();i=n(t.currentTarget);i.attr("data-slide-index")!==undefined&&(r=parseInt(i.attr("data-slide-index")),r!=f.active.index&&e.goToSlide(r),t.preventDefault())},v=function(t){var i=f.children.length;if(f.settings.pagerType=="short"){f.settings.maxSlides>1&&(i=Math.ceil(f.children.length/f.settings.maxSlides));f.pagerEl.html(t+1+f.settings.pagerShortSeparator+i);return}f.pagerEl.find("a").removeClass("active");f.pagerEl.each(function(i,r){n(r).find("a").eq(t).addClass("active")})},y=function(){if(f.settings.infiniteLoop){var n="";f.active.index==0?n=f.children.eq(0).position():f.active.index==o()-1&&f.carousel?n=f.children.eq((o()-1)*c()).position():f.active.index==f.children.length-1&&(n=f.children.eq(f.children.length-1).position());n&&(f.settings.mode=="horizontal"?s(-n.left,"reset",0):f.settings.mode=="vertical"&&s(-n.top,"reset",0))}f.working=!1;f.settings.onSlideAfter(f.children.eq(f.active.index),f.oldIndex,f.active.index)},p=function(n){f.settings.autoControlsCombine?f.controls.autoEl.html(f.controls[n]):(f.controls.autoEl.find("a").removeClass("active"),f.controls.autoEl.find("a:not(.bx-"+n+")").addClass("active"))},tt=function(){o()==1?(f.controls.prev.addClass("disabled"),f.controls.next.addClass("disabled")):!f.settings.infiniteLoop&&f.settings.hideControlOnEnd&&(f.active.index==0?(f.controls.prev.addClass("disabled"),f.controls.next.removeClass("disabled")):f.active.index==o()-1?(f.controls.next.addClass("disabled"),f.controls.prev.removeClass("disabled")):(f.controls.prev.removeClass("disabled"),f.controls.next.removeClass("disabled")))},kt=function(){if(f.settings.autoDelay>0)var n=setTimeout(e.startAuto,f.settings.autoDelay);else e.startAuto();f.settings.autoHover&&e.hover(function(){f.interval&&(e.stopAuto(!0),f.autoPaused=!0)},function(){f.autoPaused&&(e.startAuto(!0),f.autoPaused=null)})},dt=function(){var i=0,t;f.settings.autoDirection=="next"?e.append(f.children.clone().addClass("bx-clone")):(e.prepend(f.children.clone().addClass("bx-clone")),t=f.children.first().position(),i=f.settings.mode=="horizontal"?-t.left:-t.top);s(i,"reset",0);f.settings.pager=!1;f.settings.controls=!1;f.settings.autoControls=!1;f.settings.tickerHover&&!f.usingCSS&&f.viewport.hover(function(){e.stop()},function(){var t=0;f.children.each(function(){t+=f.settings.mode=="horizontal"?n(this).outerWidth(!0):n(this).outerHeight(!0)});var i=f.settings.speed/t,r=f.settings.mode=="horizontal"?"left":"top",u=i*(t-Math.abs(parseInt(e.css(r))));a(u)});a()},a=function(n){var t,i;speed=n?n:f.settings.speed;t={left:0,top:0};i={left:0,top:0};f.settings.autoDirection=="next"?t=e.find(".bx-clone").first().position():i=f.children.first().position();var r=f.settings.mode=="horizontal"?-t.left:-t.top,u=f.settings.mode=="horizontal"?-i.left:-i.top,o={resetValue:u};s(r,"ticker",speed,o)},gt=function(){f.touch={start:{x:0,y:0},end:{x:0,y:0}};f.viewport.bind("touchstart",ni)},ni=function(n){if(f.working)n.preventDefault();else{f.touch.originalPos=e.position();var t=n.originalEvent;f.touch.start.x=t.changedTouches[0].pageX;f.touch.start.y=t.changedTouches[0].pageY;f.viewport.bind("touchmove",it);f.viewport.bind("touchend",rt)}},it=function(n){var t=n.originalEvent,u=Math.abs(t.changedTouches[0].pageX-f.touch.start.x),e=Math.abs(t.changedTouches[0].pageY-f.touch.start.y),i,r;u*3>e&&f.settings.preventDefaultSwipeX?n.preventDefault():e*3>u&&f.settings.preventDefaultSwipeY&&n.preventDefault();f.settings.mode!="fade"&&f.settings.oneToOneTouch&&(i=0,f.settings.mode=="horizontal"?(r=t.changedTouches[0].pageX-f.touch.start.x,i=f.touch.originalPos.left+r):(r=t.changedTouches[0].pageY-f.touch.start.y,i=f.touch.originalPos.top+r),s(i,"reset",0))},rt=function(n){var r,i,t;f.viewport.unbind("touchmove",it);r=n.originalEvent;i=0;f.touch.end.x=r.changedTouches[0].pageX;f.touch.end.y=r.changedTouches[0].pageY;f.settings.mode=="fade"?(t=Math.abs(f.touch.start.x-f.touch.end.x),t>=f.settings.swipeThreshold&&(f.touch.start.x>f.touch.end.x?e.goToNextSlide():e.goToPrevSlide(),e.stopAuto())):(t=0,f.settings.mode=="horizontal"?(t=f.touch.end.x-f.touch.start.x,i=f.touch.originalPos.left):(t=f.touch.end.y-f.touch.start.y,i=f.touch.originalPos.top),!f.settings.infiniteLoop&&(f.active.index==0&&t>0||f.active.last&&t<0)?s(i,"reset",200):Math.abs(t)>=f.settings.swipeThreshold?(t<0?e.goToNextSlide():e.goToPrevSlide(),e.stopAuto()):s(i,"reset",200));f.viewport.unbind("touchend",rt)},ut=function(){if(f.initialized){var t=n(window).width(),i=n(window).height();(w!=t||b!=i)&&(w=t,b=i,e.redrawSlider(),f.settings.onSliderResize.call(e,f.active.index))}};return e.goToSlide=function(t,i){var h,r,a,p,u,w,b;if(!f.working&&f.active.index!=t){f.working=!0;f.oldIndex=f.active.index;f.active.index=t<0?o()-1:t>=o()?0:t;f.settings.onSlideBefore(f.children.eq(f.active.index),f.oldIndex,f.active.index);if(i=="next")f.settings.onSlideNext(f.children.eq(f.active.index),f.oldIndex,f.active.index);else if(i=="prev")f.settings.onSlidePrev(f.children.eq(f.active.index),f.oldIndex,f.active.index);f.active.last=f.active.index>=o()-1;f.settings.pager&&v(f.active.index);f.settings.controls&&tt();f.settings.mode=="fade"?(f.settings.adaptiveHeight&&f.viewport.height()!=l()&&f.viewport.animate({height:l()},f.settings.adaptiveHeightSpeed),f.children.filter(":visible").fadeOut(f.settings.speed).css({zIndex:0}),f.children.eq(f.active.index).css("zIndex",f.settings.slideZIndex+1).fadeIn(f.settings.speed,function(){n(this).css("zIndex",f.settings.slideZIndex);y()})):(f.settings.adaptiveHeight&&f.viewport.height()!=l()&&f.viewport.animate({height:l()},f.settings.adaptiveHeightSpeed),h=0,r={left:0,top:0},!f.settings.infiniteLoop&&f.carousel&&f.active.last?f.settings.mode=="horizontal"?(u=f.children.eq(f.children.length-1),r=u.position(),h=f.viewport.width()-u.outerWidth()):(a=f.children.length-f.settings.minSlides,r=f.children.eq(a).position()):f.carousel&&f.active.last&&i=="prev"?(p=f.settings.moveSlides==1?f.settings.maxSlides-c():(o()-1)*c()-(f.children.length-f.settings.maxSlides),u=e.children(".bx-clone").eq(p),r=u.position()):i=="next"&&f.active.index==0?(r=e.find("> .bx-clone").eq(f.settings.maxSlides).position(),f.active.last=!1):t>=0&&(w=t*c(),r=f.children.eq(w).position()),"undefined"!=typeof r&&(b=f.settings.mode=="horizontal"?-(r.left-h):-r.top,s(b,"slide",f.settings.speed)))}},e.goToNextSlide=function(){if(f.settings.infiniteLoop||!f.active.last){var n=parseInt(f.active.index)+1;e.goToSlide(n,"next")}},e.goToPrevSlide=function(){if(f.settings.infiniteLoop||f.active.index!=0){var n=parseInt(f.active.index)-1;e.goToSlide(n,"prev")}},e.startAuto=function(n){f.interval||(f.interval=setInterval(function(){f.settings.autoDirection=="next"?e.goToNextSlide():e.goToPrevSlide()},f.settings.pause),f.settings.autoControls&&n!=!0&&p("stop"))},e.stopAuto=function(n){f.interval&&(clearInterval(f.interval),f.interval=null,f.settings.autoControls&&n!=!0&&p("start"))},e.getCurrentSlide=function(){return f.active.index},e.getCurrentSlideElement=function(){return f.children.eq(f.active.index)},e.getSlideCount=function(){return f.children.length},e.redrawSlider=function(){f.children.add(e.find(".bx-clone")).width(d());f.viewport.css("height",l());f.settings.ticker||g();f.active.last&&(f.active.index=o()-1);f.active.index>=o()&&(f.active.last=!0);f.settings.pager&&!f.settings.pagerCustom&&(nt(),v(f.active.index))},e.destroySlider=function(){f.initialized&&(f.initialized=!1,n(".bx-clone",this).remove(),f.children.each(function(){n(this).data("origStyle")!=undefined?n(this).attr("style",n(this).data("origStyle")):n(this).removeAttr("style")}),n(this).data("origStyle")!=undefined?this.attr("style",n(this).data("origStyle")):n(this).removeAttr("style"),n(this).unwrap().unwrap(),f.controls.el&&f.controls.el.remove(),f.controls.next&&f.controls.next.remove(),f.controls.prev&&f.controls.prev.remove(),f.pagerEl&&f.settings.controls&&f.pagerEl.remove(),n(".bx-caption",this).remove(),f.controls.autoEl&&f.controls.autoEl.remove(),clearInterval(f.interval),f.settings.responsive&&n(window).unbind("resize",ut))},e.reloadSlider=function(n){n!=undefined&&(u=n);e.destroySlider();k()},k(),this}}(jQuery),function(n,t){"use strict";function r(n){var o,t,u,r,f,s=n||{},e,h;for(o=s.elements||i.getAllElements(),e=0,h=o.length;e<h;e++)if(t=o[e],u=t.parentNode,r=undefined,f=undefined,t[i.ns]||(t[i.ns]={}),s.reevaluate||!t[i.ns].evaluated){if(u.nodeName.toUpperCase()==="PICTURE"){if(i.removeVideoShim(u),r=i.getMatch(t,u),r===!1)continue}else r=undefined;(u.nodeName.toUpperCase()==="PICTURE"||t.srcset&&!i.srcsetSupported||!i.sizesSupported&&t.srcset&&t.srcset.indexOf("w")>-1)&&i.dodgeSrcset(t);r?(f=i.processSourceSet(r),i.applyBestCandidate(f,t)):(f=i.processSourceSet(t),(t.srcset===undefined||t[i.ns].srcset)&&i.applyBestCandidate(f,t));t[i.ns].evaluated=!0}}function u(){var i,u;r();i=setInterval(function(){if(r(),/^loaded|^i|^c/.test(t.readyState)){clearInterval(i);return}},250);n.addEventListener&&n.addEventListener("resize",function(){n._picturefillWorking||(n._picturefillWorking=!0,n.clearTimeout(u),u=n.setTimeout(function(){r({reevaluate:!0});n._picturefillWorking=!1},60))},!1)}if(n.HTMLPictureElement){n.picturefill=function(){};return}t.createElement("picture");var i={};i.ns="picturefill",function(){var n=t.createElement("img");i.srcsetSupported="srcset"in n;i.sizesSupported="sizes"in n}();i.trim=function(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")};i.endsWith=function(n,t){return n.endsWith?n.endsWith(t):n.indexOf(t,n.length-t.length)!==-1};i.restrictsMixedContent=function(){return n.location.protocol==="https:"};i.matchesMedia=function(t){return n.matchMedia&&n.matchMedia(t).matches};i.getDpr=function(){return n.devicePixelRatio||1};i.getWidthFromLength=function(n){return n=n&&n.indexOf("%")>-1==!1&&(parseFloat(n)>0||n.indexOf("calc(")>-1)?n:"100vw",n=n.replace("vw","%"),i.lengthEl||(i.lengthEl=t.createElement("div"),t.documentElement.insertBefore(i.lengthEl,t.documentElement.firstChild)),i.lengthEl.style.cssText="position: absolute; left: 0; width: "+n+";",i.lengthEl.offsetWidth<=0&&(i.lengthEl.style.cssText="width: 100%;"),i.lengthEl.offsetWidth};i.types={};i.types["image/jpeg"]=!0;i.types["image/gif"]=!0;i.types["image/png"]=!0;i.types["image/svg+xml"]=t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1");i.types["image/webp"]=function(){var t=new n.Image,u="image/webp";t.onerror=function(){i.types[u]=!1;r()};t.onload=function(){i.types[u]=t.width===1;r()};t.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="};i.verifyTypeSupport=function(n){var t=n.getAttribute("type");return t===null||t===""?!0:typeof i.types[t]=="function"?(i.types[t](),"pending"):i.types[t]};i.parseSize=function(n){var t=/(\([^)]+\))?\s*(.+)/g.exec(n);return{media:t&&t[1],length:t&&t[2]}};i.findWidthFromSourceSize=function(n){for(var r=i.trim(n).split(/\s*,\s*/),u,t=0,s=r.length;t<s;t++){var h=r[t],f=i.parseSize(h),e=f.length,o=f.media;if(e&&(!o||i.matchesMedia(o))){u=e;break}}return i.getWidthFromLength(u)};i.parseSrcset=function(n){for(var f=[],r,t,i,e,u;n!=="";)n=n.replace(/^\s+/g,""),r=n.search(/\s/g),i=null,r!==-1?(t=n.slice(0,r),e=t[t.length-1],(e===","||t==="")&&(t=t.replace(/,+$/,""),i=""),n=n.slice(r+1),i===null&&(u=n.indexOf(","),u!==-1?(i=n.slice(0,u),n=n.slice(u+1)):(i=n,n=""))):(t=n,n=""),(t||i)&&f.push({url:t,descriptor:i});return f};i.parseDescriptor=function(n,t){var c=t||"100vw",h=n&&n.replace(/(^\s+|\s+$)/g,""),l=i.findWidthFromSourceSize(c),s,f,u,r,e,o;if(h)for(f=h.split(" "),u=f.length+1;u>=0;u--)f[u]!==undefined&&(r=f[u],e=r&&r.slice(r.length-1),e!=="h"&&e!=="w"||i.sizesSupported?e==="x"&&(o=r&&parseFloat(r,10),s=o&&!isNaN(o)?o:1):s=parseFloat(parseInt(r,10)/l));return s||1};i.getCandidatesFromSourceSet=function(n,t){for(var u,f=i.parseSrcset(n),e=[],r=0,o=f.length;r<o;r++)u=f[r],e.push({url:u.url,resolution:i.parseDescriptor(u.descriptor,t)});return e};i.dodgeSrcset=function(n){n.srcset&&(n[i.ns].srcset=n.srcset,n.removeAttribute("srcset"))};i.processSourceSet=function(n){var t=n.getAttribute("srcset"),u=n.getAttribute("sizes"),r=[];return n.nodeName.toUpperCase()==="IMG"&&n[i.ns]&&n[i.ns].srcset&&(t=n[i.ns].srcset),t&&(r=i.getCandidatesFromSourceSet(t,u)),r};i.applyBestCandidate=function(n,t){var f,e,r,u;for(n.sort(i.ascendingSort),e=n.length,r=n[e-1],u=0;u<e;u++)if(f=n[u],f.resolution>=i.getDpr()){r=f;break}r&&!i.endsWith(t.src,r.url)&&(i.restrictsMixedContent()&&r.url.substr(0,5).toLowerCase()==="http:"?typeof console!==undefined&&console.warn("Blocked mixed content image "+r.url):(t.src=r.url,t.currentSrc=t.src))};i.ascendingSort=function(n,t){return n.resolution-t.resolution};i.removeVideoShim=function(n){var r=n.getElementsByTagName("video"),t,i;if(r.length){for(t=r[0],i=t.getElementsByTagName("source");i.length;)n.insertBefore(i[0],t);t.parentNode.removeChild(t)}};i.getAllElements=function(){for(var n,u=[],f=t.getElementsByTagName("img"),r=0,e=f.length;r<e;r++)n=f[r],(n.parentNode.nodeName.toUpperCase()==="PICTURE"||n.getAttribute("srcset")!==null||n[i.ns]&&n[i.ns].srcset!==null)&&u.push(n);return u};i.getMatch=function(n,t){for(var r,e,o,s=t.childNodes,u,f=0,h=s.length;f<h;f++)if(r=s[f],r.nodeType===1){if(r===n)return u;if(r.nodeName.toUpperCase()==="SOURCE"&&(r.getAttribute("src")!==null&&typeof console!==undefined&&console.warn("The `src` attribute is invalid on `picture` `source` element; instead, use `srcset`."),e=r.getAttribute("media"),r.getAttribute("srcset"))&&(!e||i.matchesMedia(e)))if(o=i.verifyTypeSupport(r),o===!0){u=r;break}else if(o==="pending")return!1}return u};u();r._=i;typeof module=="object"&&typeof module.exports=="object"?module.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):typeof n=="object"&&(n.picturefill=r)}(this,this.document),function(n){var h="Close",wt="BeforeClose",ii="AfterClose",ri="BeforeAppend",rt="MarkupParse",ut="Open",bt="Change",ft="mfp",u="."+ft,w="mfp-ready",kt="mfp-removing",et="mfp-prevent-close",t,b=function(){},ot=!!window.jQuery,st,f=n(window),c,o,k,l,dt,r=function(n,i){t.ev.on(ft+n+u,i)},e=function(t,i,r,u){var f=document.createElement("div");return f.className="mfp-"+t,r&&(f.innerHTML=r),u?i&&i.appendChild(f):(f=n(f),i&&f.appendTo(i)),f},i=function(i,r){t.ev.triggerHandler(ft+i,r);t.st.callbacks&&(i=i.charAt(0).toLowerCase()+i.slice(1),t.st.callbacks[i]&&t.st.callbacks[i].apply(t,n.isArray(r)?r:[r]))},ht=function(i){return i===dt&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=n(t.st.closeMarkup.replace("%title%",t.st.tClose)),dt=i),t.currTemplate.closeBtn},ct=function(){n.magnificPopup.instance||(t=new b,t.init(),n.magnificPopup.instance=t)},ui=function(){var n=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(n.transition!==undefined)return!0;while(t.length)if(t.pop()+"Transition"in n)return!0;return!1},d,v,g,nt,lt,s,ni,vt,ti,tt,pt,it;b.prototype={constructor:b,init:function(){var i=navigator.appVersion;t.isIE7=i.indexOf("MSIE 7.")!==-1;t.isIE8=i.indexOf("MSIE 8.")!==-1;t.isLowIE=t.isIE7||t.isIE8;t.isAndroid=/android/gi.test(i);t.isIOS=/iphone|ipad|ipod/gi.test(i);t.supportsTransition=ui();t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent);o=n(document);t.popupsCache={}},open:function(s){var h,b,a,k,v,d,y,g,p;if(c||(c=n(document.body)),s.isObj===!1){for(t.items=s.items.toArray(),t.index=0,b=s.items,h=0;h<b.length;h++)if(a=b[h],a.parsed&&(a=a.el[0]),a===s.el[0]){t.index=h;break}}else t.items=n.isArray(s.items)?s.items:[s.items],t.index=s.index||0;if(t.isOpen){t.updateItemHTML();return}for(t.types=[],l="",t.ev=s.mainEl&&s.mainEl.length?s.mainEl.eq(0):o,s.key?(t.popupsCache[s.key]||(t.popupsCache[s.key]={}),t.currTemplate=t.popupsCache[s.key]):t.currTemplate={},t.st=n.extend(!0,{},n.magnificPopup.defaults,s),t.fixedContentPos=t.st.fixedContentPos==="auto"?!t.probablyMobile:t.st.fixedContentPos,t.st.modal&&(t.st.closeOnContentClick=!1,t.st.closeOnBgClick=!1,t.st.showCloseBtn=!1,t.st.enableEscapeKey=!1),t.bgOverlay||(t.bgOverlay=e("bg").on("click"+u,function(){t.close()}),t.wrap=e("wrap").attr("tabindex",-1).on("click"+u,function(n){t._checkIfClose(n.target)&&t.close()}),t.container=e("container",t.wrap)),t.contentContainer=e("content"),t.st.preloader&&(t.preloader=e("preloader",t.container,t.st.tLoading)),k=n.magnificPopup.modules,h=0;h<k.length;h++)v=k[h],v=v.charAt(0).toUpperCase()+v.slice(1),t["init"+v].call(t);return i("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(r(rt,function(n,t,i,r){i.close_replaceWith=ht(r.type)}),l+=" mfp-close-btn-in"):t.wrap.append(ht())),t.st.alignTop&&(l+=" mfp-align-top"),t.fixedContentPos?t.wrap.css({overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}):t.wrap.css({top:f.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||t.st.fixedBgPos==="auto"&&!t.fixedContentPos)&&t.bgOverlay.css({height:o.height(),position:"absolute"}),t.st.enableEscapeKey&&o.on("keyup"+u,function(n){n.keyCode===27&&t.close()}),f.on("resize"+u,function(){t.updateSize()}),t.st.closeOnContentClick||(l+=" mfp-auto-cursor"),l&&t.wrap.addClass(l),d=t.wH=f.height(),y={},t.fixedContentPos&&t._hasScrollBar(d)&&(g=t._getScrollbarSize(),g&&(y.marginRight=g)),t.fixedContentPos&&(t.isIE7?n("body, html").css("overflow","hidden"):y.overflow="hidden"),p=t.st.mainClass,t.isIE7&&(p+=" mfp-ie7"),p&&t._addClassToMFP(p),t.updateItemHTML(),i("BuildControls"),n("html").css(y),t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo||c),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(w),t._setFocus()):t.bgOverlay.addClass(w);o.on("focusin"+u,t._onFocusIn)},16),t.isOpen=!0,t.updateSize(d),i(ut),s},close:function(){t.isOpen&&(i(wt),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(kt),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){var r,f;i(h);r=kt+" "+w+" ";t.bgOverlay.detach();t.wrap.detach();t.container.empty();t.st.mainClass&&(r+=t.st.mainClass+" ");t._removeClassFromMFP(r);t.fixedContentPos&&(f={marginRight:""},t.isIE7?n("body, html").css("overflow",""):f.overflow="",n("html").css(f));o.off("keyup"+u+" focusin"+u);t.ev.off(u);t.wrap.attr("class","mfp-wrap").removeAttr("style");t.bgOverlay.attr("class","mfp-bg");t.container.attr("class","mfp-container");t.st.showCloseBtn&&(!t.st.closeBtnInside||t.currTemplate[t.currItem.type]===!0)&&t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach();t._lastFocusedEl&&n(t._lastFocusedEl).focus();t.currItem=null;t.content=null;t.currTemplate=null;t.prevHeight=0;i(ii)},updateSize:function(n){if(t.isIOS){var u=document.documentElement.clientWidth/window.innerWidth,r=window.innerHeight*u;t.wrap.css("height",r);t.wH=r}else t.wH=n||f.height();t.fixedContentPos||t.wrap.css("height",t.wH);i("Resize")},updateItemHTML:function(){var u=t.items[t.index],r,f,e;t.contentContainer.detach();t.content&&t.content.detach();u.parsed||(u=t.parseEl(t.index));r=u.type;i("BeforeChange",[t.currItem?t.currItem.type:"",r]);t.currItem=u;t.currTemplate[r]||(f=t.st[r]?t.st[r].markup:!1,i("FirstMarkupParse",f),t.currTemplate[r]=f?n(f):!0);k&&k!==u.type&&t.container.removeClass("mfp-"+k+"-holder");e=t["get"+r.charAt(0).toUpperCase()+r.slice(1)](u,t.currTemplate[r]);t.appendContent(e,r);u.preloaded=!0;i(bt,u);k=u.type;t.container.prepend(t.contentContainer);i("AfterChange")},appendContent:function(n,r){t.content=n;n?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[r]===!0?t.content.find(".mfp-close").length||t.content.append(ht()):t.content=n:t.content="";i(ri);t.container.addClass("mfp-"+r+"-holder");t.contentContainer.append(t.content)},parseEl:function(r){var u=t.items[r],o,e,f;if(u.tagName?u={el:n(u)}:(o=u.type,u={data:u,src:u.src}),u.el){for(e=t.types,f=0;f<e.length;f++)if(u.el.hasClass("mfp-"+e[f])){o=e[f];break}u.src=u.el.attr("data-mfp-src");u.src||(u.src=u.el.attr("href"))}return u.type=o||t.st.type||"inline",u.index=r,u.parsed=!0,t.items[r]=u,i("ElementParse",u),t.items[r]},addGroup:function(n,i){var u=function(r){r.mfpEl=this;t._openClick(r,n,i)},r;i||(i={});r="click.magnificPopup";i.mainEl=n;i.items?(i.isObj=!0,n.off(r).on(r,u)):(i.isObj=!1,i.delegate?n.off(r).on(r,i.delegate,u):(i.items=n,n.off(r).on(r,u)))},_openClick:function(i,r,u){var o=u.midClick!==undefined?u.midClick:n.magnificPopup.defaults.midClick,e;if(o||!(i.which===2||i.ctrlKey||i.metaKey)){if(e=u.disableOn!==undefined?u.disableOn:n.magnificPopup.defaults.disableOn,e)if(n.isFunction(e)){if(!e.call(t))return!0}else if(f.width()<e)return!0;i.type&&(i.preventDefault(),t.isOpen&&i.stopPropagation());u.el=n(i.mfpEl);u.delegate&&(u.items=r.find(u.delegate));t.open(u)}},updateStatus:function(n,r){if(t.preloader){st!==n&&t.container.removeClass("mfp-s-"+st);r||n!=="loading"||(r=t.st.tLoading);var u={status:n,text:r};i("UpdateStatus",u);n=u.status;r=u.text;t.preloader.html(r);t.preloader.find("a").on("click",function(n){n.stopImmediatePropagation()});t.container.addClass("mfp-s-"+n);st=n}},_checkIfClose:function(i){if(!n(i).hasClass(et)){var r=t.st.closeOnContentClick,u=t.st.closeOnBgClick;if(r&&u||!t.content||n(i).hasClass("mfp-close")||t.preloader&&i===t.preloader[0])return!0;if(i===t.content[0]||n.contains(t.content[0],i)){if(r)return!0}else if(u&&n.contains(document,i))return!0;return!1}},_addClassToMFP:function(n){t.bgOverlay.addClass(n);t.wrap.addClass(n)},_removeClassFromMFP:function(n){this.bgOverlay.removeClass(n);t.wrap.removeClass(n)},_hasScrollBar:function(n){return(t.isIE7?o.height():document.body.scrollHeight)>(n||f.height())},_setFocus:function(){(t.st.focus?t.content.find(t.st.focus).eq(0):t.wrap).focus()},_onFocusIn:function(i){if(i.target!==t.wrap[0]&&!n.contains(t.wrap[0],i.target))return t._setFocus(),!1},_parseMarkup:function(t,r,f){var e;f.data&&(r=n.extend(f.data,r));i(rt,[t,r,f]);n.each(r,function(n,i){var r,f;if(i===undefined||i===!1)return!0;e=n.split("_");e.length>1?(r=t.find(u+"-"+e[0]),r.length>0&&(f=e[1],f==="replaceWith"?r[0]!==i[0]&&r.replaceWith(i):f==="img"?r.is("img")?r.attr("src",i):r.replaceWith('<img src="'+i+'" class="'+r.attr("class")+'" />'):r.attr(e[1],i))):t.find(u+"-"+n).html(i)})},_getScrollbarSize:function(){if(t.scrollbarSize===undefined){var n=document.createElement("div");n.id="mfp-sbm";n.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;";document.body.appendChild(n);t.scrollbarSize=n.offsetWidth-n.clientWidth;document.body.removeChild(n)}return t.scrollbarSize}};n.magnificPopup={instance:null,proto:b.prototype,modules:[],open:function(t,i){return ct(),t=t?n.extend(!0,{},t):{},t.isObj=!0,t.index=i||0,this.instance.open(t)},close:function(){return n.magnificPopup.instance&&n.magnificPopup.instance.close()},registerModule:function(t,i){i.options&&(n.magnificPopup.defaults[t]=i.options);n.extend(this.proto,i.proto);this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&times;<\/button>',tClose:"Close (Esc)",tLoading:"Loading..."}};n.fn.magnificPopup=function(i){var r,u,f,e;return ct(),r=n(this),typeof i=="string"?i==="open"?(f=ot?r.data("magnificPopup"):r[0].magnificPopup,e=parseInt(arguments[1],10)||0,f.items?u=f.items[e]:(u=r,f.delegate&&(u=u.find(f.delegate)),u=u.eq(e)),t._openClick({mfpEl:u},r,f)):t.isOpen&&t[i].apply(t,Array.prototype.slice.call(arguments,1)):(i=n.extend(!0,{},i),ot?r.data("magnificPopup",i):r[0].magnificPopup=i,t.addGroup(r,i)),r};d="inline";lt=function(){nt&&(g.after(nt.addClass(v)).detach(),nt=null)};n.magnificPopup.registerModule(d,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(d);r(h+"."+d,function(){lt()})},getInline:function(i,r){var f,u,o;return(lt(),i.src)?(f=t.st.inline,u=n(i.src),u.length?(o=u[0].parentNode,o&&o.tagName&&(g||(v=f.hiddenClass,g=e(v),v="mfp-"+v),nt=u.after(g).detach().removeClass(v)),t.updateStatus("ready")):(t.updateStatus("error",f.tNotFound),u=n("<div>")),i.inlineElement=u,u):(t.updateStatus("ready"),t._parseMarkup(r,{},i),r)}}});var y="ajax",p,at=function(){p&&c.removeClass(p)},gt=function(){at();t.req&&t.req.abort()};n.magnificPopup.registerModule(y,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content<\/a> could not be loaded.'},proto:{initAjax:function(){t.types.push(y);p=t.st.ajax.cursor;r(h+"."+y,gt);r("BeforeChange."+y,gt)},getAjax:function(r){p&&c.addClass(p);t.updateStatus("loading");var u=n.extend({url:r.src,success:function(u,f,e){var o={data:u,xhr:e};i("ParseAjax",o);t.appendContent(n(o.data),y);r.finished=!0;at();t._setFocus();setTimeout(function(){t.wrap.addClass(w)},16);t.updateStatus("ready");i("AjaxContentAdded")},error:function(){at();r.finished=r.loadError=!0;t.updateStatus("error",t.st.ajax.tError.replace("%url%",r.src))}},t.st.ajax.settings);return t.req=n.ajax(u),""}}});ni=function(i){if(i.data&&i.data.title!==undefined)return i.data.title;var r=t.st.image.titleSrc;if(r){if(n.isFunction(r))return r.call(t,i);if(i.el)return i.el.attr(r)||""}return""};n.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"><\/div><figure><div class="mfp-img"><\/div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"><\/div><div class="mfp-counter"><\/div><\/div><\/figcaption><\/figure><\/div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image<\/a> could not be loaded.'},proto:{initImage:function(){var n=t.st.image,i=".image";t.types.push("image");r(ut+i,function(){t.currItem.type==="image"&&n.cursor&&c.addClass(n.cursor)});r(h+i,function(){n.cursor&&c.removeClass(n.cursor);f.off("resize"+u)});r("Resize"+i,t.resizeImage);t.isLowIE&&r("AfterChange",t.resizeImage)},resizeImage:function(){var n=t.currItem,i;n&&n.img&&t.st.image.verticalFit&&(i=0,t.isLowIE&&(i=parseInt(n.img.css("padding-top"),10)+parseInt(n.img.css("padding-bottom"),10)),n.img.css("max-height",t.wH-i))},_onImageHasSize:function(n){n.img&&(n.hasSize=!0,s&&clearInterval(s),n.isCheckingImgSize=!1,i("ImageHasSize",n),n.imgHidden&&(t.content&&t.content.removeClass("mfp-loading"),n.imgHidden=!1))},findImageSize:function(n){var i=0,u=n.img[0],r=function(f){s&&clearInterval(s);s=setInterval(function(){if(u.naturalWidth>0){t._onImageHasSize(n);return}i>200&&clearInterval(s);i++;i===3?r(10):i===40?r(50):i===100&&r(500)},f)};r(1)},getImage:function(r,u){var e=0,o=function(){r&&(r.img[0].complete?(r.img.off(".mfploader"),r===t.currItem&&(t._onImageHasSize(r),t.updateStatus("ready")),r.hasSize=!0,r.loaded=!0,i("ImageLoadComplete")):(e++,e<200?setTimeout(o,100):h()))},h=function(){r&&(r.img.off(".mfploader"),r===t.currItem&&(t._onImageHasSize(r),t.updateStatus("error",c.tError.replace("%url%",r.src))),r.hasSize=!0,r.loaded=!0,r.loadError=!0)},c=t.st.image,l=u.find(".mfp-img"),f;return l.length&&(f=document.createElement("img"),f.className="mfp-img",r.img=n(f).on("load.mfploader",o).on("error.mfploader",h),f.src=r.src,l.is("img")&&(r.img=r.img.clone()),f=r.img[0],f.naturalWidth>0?r.hasSize=!0:f.width||(r.hasSize=!1)),t._parseMarkup(u,{title:ni(r),img_replaceWith:r.img},r),t.resizeImage(),r.hasSize?(s&&clearInterval(s),r.loadError?(u.addClass("mfp-loading"),t.updateStatus("error",c.tError.replace("%url%",r.src))):(u.removeClass("mfp-loading"),t.updateStatus("ready")),u):(t.updateStatus("loading"),r.loading=!0,r.hasSize||(r.imgHidden=!0,u.addClass("mfp-loading"),t.findImageSize(r)),u)}}});ti=function(){return vt===undefined&&(vt=document.createElement("p").style.MozTransform!==undefined),vt};n.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(n){return n.is("img")?n:n.find("img")}},proto:{initZoom:function(){var f=t.st.zoom,o=".zoom",u;if(f.enabled&&t.supportsTransition){var c=f.duration,l=function(n){var r=n.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),u="all "+f.duration/1e3+"s "+f.easing,t={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},i="transition";return t["-webkit-"+i]=t["-moz-"+i]=t["-o-"+i]=t[i]=u,r.css(t),r},s=function(){t.content.css("visibility","visible")},e,n;r("BuildControls"+o,function(){if(t._allowZoom()){if(clearTimeout(e),t.content.css("visibility","hidden"),u=t._getItemToZoom(),!u){s();return}n=l(u);n.css(t._getOffset());t.wrap.append(n);e=setTimeout(function(){n.css(t._getOffset(!0));e=setTimeout(function(){s();setTimeout(function(){n.remove();u=n=null;i("ZoomAnimationEnded")},16)},c)},16)}});r(wt+o,function(){if(t._allowZoom()){if(clearTimeout(e),t.st.removalDelay=c,!u){if(u=t._getItemToZoom(),!u)return;n=l(u)}n.css(t._getOffset(!0));t.wrap.append(n);t.content.css("visibility","hidden");setTimeout(function(){n.css(t._getOffset())},16)}});r(h+o,function(){t._allowZoom()&&(s(),n&&n.remove(),u=null)})}},_allowZoom:function(){return t.currItem.type==="image"},_getItemToZoom:function(){return t.currItem.hasSize?t.currItem.img:!1},_getOffset:function(i){var r,u;r=i?t.currItem.img:t.st.zoom.opener(t.currItem.el||t.currItem);var f=r.offset(),e=parseInt(r.css("padding-top"),10),o=parseInt(r.css("padding-bottom"),10);return f.top-=n(window).scrollTop()-e,u={width:r.width(),height:(ot?r.innerHeight():r[0].offsetHeight)-o-e},ti()?u["-moz-transform"]=u.transform="translate("+f.left+"px,"+f.top+"px)":(u.left=f.left,u.top=f.top),u}}});var a="iframe",fi="//about:blank",yt=function(n){if(t.currTemplate[a]){var i=t.currTemplate[a].find("iframe");i.length&&(n||(i[0].src=fi),t.isIE8&&i.css("display",n?"block":"none"))}};n.magnificPopup.registerModule(a,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"><\/div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen><\/iframe><\/div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(a);r("BeforeChange",function(n,t,i){t!==i&&(t===a?yt():i===a&&yt(!0))});r(h+"."+a,function(){yt()})},getIframe:function(i,r){var u=i.src,f=t.st.iframe,e;return n.each(f.patterns,function(){if(u.indexOf(this.index)>-1)return this.id&&(u=typeof this.id=="string"?u.substr(u.lastIndexOf(this.id)+this.id.length,u.length):this.id.call(this,u)),u=this.src.replace("%id%",u),!1}),e={},f.srcAction&&(e[f.srcAction]=u),t._parseMarkup(r,e,i),t.updateStatus("ready"),r}}});tt=function(n){var i=t.items.length;return n>i-1?n-i:n<0?i+n:n};pt=function(n,t,i){return n.replace(/%curr%/gi,t+1).replace(/%total%/gi,i)};n.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"><\/button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var u=t.st.gallery,i=".mfp-gallery",f=Boolean(n.fn.mfpFastClick);if(t.direction=!0,!u||!u.enabled)return!1;l+=" mfp-gallery";r(ut+i,function(){u.navigateByImgClick&&t.wrap.on("click"+i,".mfp-img",function(){if(t.items.length>1)return t.next(),!1});o.on("keydown"+i,function(n){n.keyCode===37?t.prev():n.keyCode===39&&t.next()})});r("UpdateStatus"+i,function(n,i){i.text&&(i.text=pt(i.text,t.currItem.index,t.items.length))});r(rt+i,function(n,i,r,f){var e=t.items.length;r.counter=e>1?pt(u.tCounter,f.index,e):""});r("BuildControls"+i,function(){if(t.items.length>1&&u.arrows&&!t.arrowLeft){var o=u.arrowMarkup,i=t.arrowLeft=n(o.replace(/%title%/gi,u.tPrev).replace(/%dir%/gi,"left")).addClass(et),r=t.arrowRight=n(o.replace(/%title%/gi,u.tNext).replace(/%dir%/gi,"right")).addClass(et),s=f?"mfpFastClick":"click";i[s](function(){t.prev()});r[s](function(){t.next()});t.isIE7&&(e("b",i[0],!1,!0),e("a",i[0],!1,!0),e("b",r[0],!1,!0),e("a",r[0],!1,!0));t.container.append(i.add(r))}});r(bt+i,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout);t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages();t._preloadTimeout=null},16)});r(h+i,function(){o.off(i);t.wrap.off("click"+i);t.arrowLeft&&f&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick();t.arrowRight=t.arrowLeft=null})},next:function(){t.direction=!0;t.index=tt(t.index+1);t.updateItemHTML()},prev:function(){t.direction=!1;t.index=tt(t.index-1);t.updateItemHTML()},goTo:function(n){t.direction=n>=t.index;t.index=n;t.updateItemHTML()},preloadNearbyImages:function(){for(var i=t.st.gallery.preload,r=Math.min(i[0],t.items.length),u=Math.min(i[1],t.items.length),n=1;n<=(t.direction?u:r);n++)t._preloadItem(t.index+n);for(n=1;n<=(t.direction?r:u);n++)t._preloadItem(t.index-n)},_preloadItem:function(r){if(r=tt(r),!t.items[r].preloaded){var u=t.items[r];u.parsed||(u=t.parseEl(r));i("LazyLoad",u);u.type==="image"&&(u.img=n('<img class="mfp-img" />').on("load.mfploader",function(){u.hasSize=!0}).on("error.mfploader",function(){u.hasSize=!0;u.loadError=!0;i("LazyLoadError",u)}).attr("src",u.src));u.preloaded=!0}}}});it="retina";n.magnificPopup.registerModule(it,{options:{replaceSrc:function(n){return n.src.replace(/\.\w+$/,function(n){return"@2x"+n})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var i=t.st.retina,n=i.ratio;n=isNaN(n)?n():n;n>1&&(r("ImageHasSize."+it,function(t,i){i.img.css({"max-width":i.img[0].naturalWidth/n,width:"100%"})}),r("ElementParse."+it,function(t,r){r.src=i.replaceSrc(r,n)}))}}}}),function(){var u=1e3,i="ontouchstart"in window,r=function(){f.off("touchmove"+t+" touchend"+t)},t=".mfpFastClick";n.fn.mfpFastClick=function(e){return n(this).each(function(){var l=n(this),s,a,v,y,h,o,c;if(i)l.on("touchstart"+t,function(n){h=!1;c=1;o=n.originalEvent?n.originalEvent.touches[0]:n.touches[0];v=o.clientX;y=o.clientY;f.on("touchmove"+t,function(n){o=n.originalEvent?n.originalEvent.touches:n.touches;c=o.length;o=o[0];(Math.abs(o.clientX-v)>10||Math.abs(o.clientY-y)>10)&&(h=!0,r())}).on("touchend"+t,function(n){(r(),h||c>1)||(s=!0,n.preventDefault(),clearTimeout(a),a=setTimeout(function(){s=!1},u),e())})});l.on("click"+t,function(){s||e()})})};n.fn.destroyMfpFastClick=function(){n(this).off("touchstart"+t+" click"+t);i&&f.off("touchmove"+t+" touchend"+t)}}();ct()}(window.jQuery||window.Zepto),function(n){"use strict";n.fn.fitVids=function(t){var i={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var u=document.head||document.getElementsByTagName("head")[0],r=document.createElement("div");r.innerHTML='<p>x<\/p><style id="fit-vids-style">.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}<\/style>';u.appendChild(r.childNodes[1])}return t&&n.extend(i,t),this.each(function(){var u=["iframe[src*='player.vimeo.com']","iframe[src*='youtube.com']","iframe[src*='youtube-nocookie.com']","iframe[src*='kickstarter.com'][src*='video.html']","object","embed"],r,t;i.customSelector&&u.push(i.customSelector);r=".fitvidsignore";i.ignore&&(r=r+", "+i.ignore);t=n(this).find(u.join(","));t=t.not("object object");t=t.not(r);t.each(function(){var t=n(this),i;if(!(t.parents(r).length>0)&&(this.tagName.toLowerCase()!=="embed"||!t.parent("object").length)&&!t.parent(".fluid-width-video-wrapper").length){t.css("height")||t.css("width")||!(isNaN(t.attr("height"))||isNaN(t.attr("width")))||(t.attr("height",9),t.attr("width",16));var u=this.tagName.toLowerCase()==="object"||t.attr("height")&&!isNaN(parseInt(t.attr("height"),10))?parseInt(t.attr("height"),10):t.height(),f=isNaN(parseInt(t.attr("width"),10))?t.width():parseInt(t.attr("width"),10),e=u/f;t.attr("id")||(i="fitvid"+Math.floor(Math.random()*999999),t.attr("id",i));t.wrap('<div class="fluid-width-video-wrapper"><\/div>').parent(".fluid-width-video-wrapper").css("padding-top",e*100+"%");t.removeAttr("height").removeAttr("width")}})})}}(window.jQuery||window.Zepto),function(n){n.fn.textfill=function(t){function r(){i.debug&&typeof console!="undefined"&&typeof console.debug!="undefined"&&console.debug.apply(console,arguments)}function e(){typeof console!="undefined"&&typeof console.warn!="undefined"&&console.warn.apply(console,arguments)}function u(n,t,i,u,f,e){function o(n,t){var i=" / ";return n>t?i=" > ":n==t&&(i=" = "),i}r("[TextFill] "+n+" { font-size: "+t.css("font-size")+",Height: "+t.height()+"px "+o(t.height(),i)+i+"px,Width: "+t.width()+o(t.width(),u)+u+",minFontPixels: "+f+"px, maxFontPixels: "+e+"px }")}function f(n,t,i,r,f,e,o,s){for(u(n,t,f,e,o,s);o<s-1;){var h=Math.floor((o+s)/2);if(t.css("font-size",h),i.call(t)<=r){if(o=h,i.call(t)==r)break}else s=h;u(n,t,f,e,o,s)}return t.css("font-size",s),i.call(t)<=r&&(o=s,u(n+"* ",t,f,e,o,s)),o}var i=n.extend({debug:!1,maxFontPixels:40,minFontPixels:4,innerTag:"span",widthOnly:!1,success:null,callback:null,fail:null,complete:null,explicitWidth:null,explicitHeight:null,changeLineHeight:!1},t);return r("[TextFill] Start Debug"),this.each(function(){var t=n(i.innerTag+":visible:first",this),u=i.explicitHeight||n(this).height(),o=i.explicitWidth||n(this).width(),h=t.css("font-size"),l=parseFloat(t.css("line-height"))/parseFloat(h),s,c;r("[TextFill] Inner text: "+t.text());r("[TextFill] All options: ",i);r("[TextFill] Maximum sizes: { Height: "+u+"px, Width: "+o+"px }");var a=i.minFontPixels,v=i.maxFontPixels<=0?u:i.maxFontPixels,y=undefined;i.widthOnly||(y=f("Height",t,n.fn.height,u,u,o,a,v));s=undefined;s=f("Width",t,n.fn.width,o,u,o,a,v);i.widthOnly?(t.css({"font-size":s,"white-space":"nowrap"}),i.changeLineHeight&&t.parent().css("line-height",l*s+"px")):(c=Math.min(y,s),t.css("font-size",c),i.changeLineHeight&&t.parent().css("line-height",l*c+"px"));r("[TextFill] Finished { Old font-size: "+h+", New font-size: "+t.css("font-size")+" }");t.width()>o||t.height()>u&&!i.widthOnly?(t.css("font-size",h),i.fail&&i.fail(this),r("[TextFill] Failure { Current Width: "+t.width()+", Maximum Width: "+o+", Current Height: "+t.height()+", Maximum Height: "+u+" }")):i.success?i.success(this):i.callback&&(e("callback is deprecated, use success, instead"),i.callback(this))}),i.complete&&i.complete(this),r("[TextFill] End Debug"),this}}(window.jQuery),function(n){"use strict";var t={i18n:{ar:{months:["كانون الثاني","شباط","آذار","نيسان","مايو","حزيران","تموز","آب","أيلول","تشرين الأول","تشرين الثاني","كانون الأول"],dayOfWeek:["ن","ث","ع","خ","ج","س","ح"]},ro:{months:["ianuarie","februarie","martie","aprilie","mai","iunie","iulie","august","septembrie","octombrie","noiembrie","decembrie"],dayOfWeek:["l","ma","mi","j","v","s","d"]},id:{months:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],dayOfWeek:["Sen","Sel","Rab","Kam","Jum","Sab","Min"]},bg:{months:["Януари","Февруари","Март","Април","Май","Юни","Юли","Август","Септември","Октомври","Ноември","Декември"],dayOfWeek:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"]},fa:{months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],dayOfWeek:["یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"]},ru:{months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],dayOfWeek:["Вск","Пн","Вт","Ср","Чт","Пт","Сб"]},uk:{months:["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"],dayOfWeek:["Ндл","Пнд","Втр","Срд","Чтв","Птн","Сбт"]},en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],dayOfWeek:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},el:{months:["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"],dayOfWeek:["Κυρ","Δευ","Τρι","Τετ","Πεμ","Παρ","Σαβ"]},de:{months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],dayOfWeek:["So","Mo","Di","Mi","Do","Fr","Sa"]},nl:{months:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],dayOfWeek:["zo","ma","di","wo","do","vr","za"]},tr:{months:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],dayOfWeek:["Paz","Pts","Sal","Çar","Per","Cum","Cts"]},fr:{months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],dayOfWeek:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"]},es:{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],dayOfWeek:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"]},th:{months:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],dayOfWeek:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},pl:{months:["styczeń","luty","marzec","kwiecień","maj","czerwiec","lipiec","sierpień","wrzesień","październik","listopad","grudzień"],dayOfWeek:["nd","pn","wt","śr","cz","pt","sb"]},pt:{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],dayOfWeek:["Dom","Seg","Ter","Qua","Qui","Sex","Sab"]},ch:{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeek:["日","一","二","三","四","五","六"]},se:{months:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],dayOfWeek:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"]},kr:{months:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dayOfWeek:["일","월","화","수","목","금","토"]},it:{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],dayOfWeek:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"]},da:{months:["January","Februar","Marts","April","Maj","Juni","July","August","September","Oktober","November","December"],dayOfWeek:["Søn","Man","Tir","Ons","Tor","Fre","Lør"]},no:{months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],dayOfWeek:["Søn","Man","Tir","Ons","Tor","Fre","Lør"]},ja:{months:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["日","月","火","水","木","金","土"]},vi:{months:["Tháng 1","Tháng 2","Tháng 3","Tháng 4","Tháng 5","Tháng 6","Tháng 7","Tháng 8","Tháng 9","Tháng 10","Tháng 11","Tháng 12"],dayOfWeek:["CN","T2","T3","T4","T5","T6","T7"]},sl:{months:["Januar","Februar","Marec","April","Maj","Junij","Julij","Avgust","September","Oktober","November","December"],dayOfWeek:["Ned","Pon","Tor","Sre","Čet","Pet","Sob"]},cs:{months:["Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"],dayOfWeek:["Ne","Po","Út","St","Čt","Pá","So"]},hu:{months:["Január","Február","Március","Április","Május","Június","Július","Augusztus","Szeptember","Október","November","December"],dayOfWeek:["Va","Hé","Ke","Sze","Cs","Pé","Szo"]}},value:"",lang:"en",format:"Y/m/d H:i",formatTime:"H:i",formatDate:"Y/m/d",startDate:!1,step:60,monthChangeSpinner:!0,closeOnDateSelect:!1,closeOnWithoutClick:!0,closeOnInputClick:!0,timepicker:!0,datepicker:!0,weeks:!1,defaultTime:!1,defaultDate:!1,minDate:!1,maxDate:!1,minTime:!1,maxTime:!1,allowTimes:[],opened:!1,initTime:!0,inline:!1,theme:"",onSelectDate:function(){},onSelectTime:function(){},onChangeMonth:function(){},onChangeYear:function(){},onChangeDateTime:function(){},onShow:function(){},onClose:function(){},onGenerate:function(){},withoutCopyright:!0,inverseButton:!1,hours12:!1,next:"xdsoft_next",prev:"xdsoft_prev",dayOfWeekStart:0,parentID:"body",timeHeightInTimePicker:25,timepickerScrollbar:!0,todayButton:!0,defaultSelect:!0,scrollMonth:!0,scrollTime:!0,scrollInput:!0,lazyInit:!1,mask:!1,validateOnBlur:!0,allowBlank:!0,yearStart:1950,yearEnd:2050,style:"",id:"",fixed:!1,roundTime:"round",className:"",weekends:[],yearOffset:0,beforeShowDay:null};Array.prototype.indexOf||(Array.prototype.indexOf=function(n,t){for(var i=t||0,r=this.length;i<r;i++)if(this[i]===n)return i;return-1});Date.prototype.countDaysInMonth=function(){return new Date(this.getFullYear(),this.getMonth()+1,0).getDate()};n.fn.xdsoftScroller=function(t){return this.each(function(){var i=n(this);if(!n(this).hasClass("xdsoft_scroller_box")){var c=function(n){var t={x:0,y:0},i;return n.type=="touchstart"||n.type=="touchmove"||n.type=="touchend"||n.type=="touchcancel"?(i=n.originalEvent.touches[0]||n.originalEvent.changedTouches[0],t.x=i.pageX,t.y=i.pageY):(n.type=="mousedown"||n.type=="mouseup"||n.type=="mousemove"||n.type=="mouseover"||n.type=="mouseout"||n.type=="mouseenter"||n.type=="mouseleave")&&(t.x=n.pageX,t.y=n.pageY),t},l=0,f=i.children().eq(0),u=i[0].clientHeight,e=f[0].offsetHeight,o=n('<div class="xdsoft_scrollbar"><\/div>'),r=n('<div class="xdsoft_scroller"><\/div>'),h=100,s=!1;o.append(r);i.addClass("xdsoft_scroller_box").append(o);r.on("mousedown.xdsoft_scroller",function(f){u||i.trigger("resize_scroll.xdsoft_scroller",[t]);var s=f.pageY,c=parseInt(r.css("margin-top")),e=o[0].offsetHeight;n(document.body).addClass("xdsoft_noselect");n([document.body,window]).on("mouseup.xdsoft_scroller",function a(){n([document.body,window]).off("mouseup.xdsoft_scroller",a).off("mousemove.xdsoft_scroller",l).removeClass("xdsoft_noselect")});n(document.body).on("mousemove.xdsoft_scroller",l=function(n){var t=n.pageY-s+c;t<0&&(t=0);t+r[0].offsetHeight>e&&(t=e-r[0].offsetHeight);i.trigger("scroll_element.xdsoft_scroller",[h?t/h:0])})});i.on("scroll_element.xdsoft_scroller",function(n,t){u||i.trigger("resize_scroll.xdsoft_scroller",[t,!0]);t=t>1?1:t<0||isNaN(t)?0:t;r.css("margin-top",h*t);setTimeout(function(){f.css("marginTop",-parseInt((f[0].offsetHeight-u)*t))},10)}).on("resize_scroll.xdsoft_scroller",function(n,t,s){u=i[0].clientHeight;e=f[0].offsetHeight;var c=u/e,l=c*o[0].offsetHeight;c>1?r.hide():(r.show(),r.css("height",parseInt(l>10?l:10)),h=o[0].offsetHeight-r[0].offsetHeight,s!==!0&&i.trigger("scroll_element.xdsoft_scroller",[t?t:Math.abs(parseInt(f.css("marginTop")))/(e-u)]))});i.mousewheel&&i.mousewheel(function(n,t){var r=Math.abs(parseInt(f.css("marginTop")));return i.trigger("scroll_element.xdsoft_scroller",[(r-t*20)/(e-u)]),n.stopPropagation(),!1});i.on("touchstart",function(n){s=c(n)});i.on("touchmove",function(n){if(s){var t=c(n),r=Math.abs(parseInt(f.css("marginTop")));i.trigger("scroll_element.xdsoft_scroller",[(r-(t.y-s.y))/(e-u)]);n.stopPropagation();n.preventDefault();s=c(n)}});i.on("touchend touchcancel",function(){s=!1})}i.trigger("resize_scroll.xdsoft_scroller",[t])})};n.fn.datetimepicker=function(i){var s=48,p=57,h=96,c=105,e=17,u=46,l=13,w=27,f=8,b=37,k=38,d=39,g=40,a=9,nt=116,tt=65,it=67,rt=86,ut=90,ft=89,o=!1,r=n.isPlainObject(i)||!i?n.extend(!0,{},t,i):n.extend(!0,{},t),v=0,et=function(n){n.on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function t(){n.is(":disabled")||n.is(":hidden")||!n.is(":visible")||n.data("xdsoft_datetimepicker")||(clearTimeout(v),v=setTimeout(function(){n.data("xdsoft_datetimepicker")||y(n);n.off("open.xdsoft focusin.xdsoft mousedown.xdsoft",t).trigger("open.xdsoft")},100))})},y=function(t){function gt(){var n=!1,u;return r.startDate?n=v.strToDate(r.startDate):(n=r.value?r.value:t&&t.val&&t.val()?t.val():"",n?n=v.strToDateTime(n):r.defaultDate&&(n=v.strToDate(r.defaultDate),r.defaultTime&&(u=v.strtotime(r.defaultTime),n.setHours(u.getHours()),n.setMinutes(u.getMinutes())))),n&&v.isValidDate(n)?i.data("changed",!0):n="",n?n:0}var i=n("<div "+(r.id?'id="'+r.id+'"':"")+" "+(r.style?'style="'+r.style+'"':"")+' class="xdsoft_datetimepicker xdsoft_'+r.theme+" xdsoft_noselect "+(r.weeks?" xdsoft_showweeks":"")+r.className+'"><\/div>'),ni=n('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net<\/a><\/div>'),ht=n('<div class="xdsoft_datepicker active"><\/div>'),et=n('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"><\/button><button type="button" class="xdsoft_today_button"><\/button><div class="xdsoft_label xdsoft_month"><span><\/span><i><\/i><\/div><div class="xdsoft_label xdsoft_year"><span><\/span><i><\/i><\/div><button type="button" class="xdsoft_next"><\/button><\/div>'),pt=n('<div class="xdsoft_calendar"><\/div>'),ct=n('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"><\/button><div class="xdsoft_time_box"><\/div><button type="button" class="xdsoft_next"><\/button><\/div>'),ot=ct.find(".xdsoft_time_box").eq(0),y=n('<div class="xdsoft_time_variant"><\/div>'),ti=n('<div class="xdsoft_scrollbar"><\/div>'),ri=n('<div class="xdsoft_scroller"><\/div>'),wt=n('<div class="xdsoft_select xdsoft_monthselect"><div><\/div><\/div>'),bt=n('<div class="xdsoft_select xdsoft_yearselect"><div><\/div><\/div>'),at,v,kt,vt,lt,st,yt,dt,ii;et.find(".xdsoft_month span").after(wt);et.find(".xdsoft_year span").after(bt);et.find(".xdsoft_month,.xdsoft_year").on("mousedown.xdsoft",function(t){var i=n(this).find(".xdsoft_select").eq(0),f=0,e=0,o=i.is(":visible"),r,u;for(et.find(".xdsoft_select").hide(),v.currentTime&&(f=v.currentTime[n(this).hasClass("xdsoft_month")?"getMonth":"getFullYear"]()),i[o?"hide":"show"](),r=i.find("div.xdsoft_option"),u=0;u<r.length;u++)if(r.eq(u).data("value")==f)break;else e+=r[0].offsetHeight;return i.xdsoftScroller(e/(i.children()[0].offsetHeight-i[0].clientHeight)),t.stopPropagation(),!1});et.find(".xdsoft_select").xdsoftScroller().on("mousedown.xdsoft",function(n){n.stopPropagation();n.preventDefault()}).on("mousedown.xdsoft",".xdsoft_option",function(){var t=v.currentTime.getFullYear();v&&v.currentTime&&v.currentTime[n(this).parent().parent().hasClass("xdsoft_monthselect")?"setMonth":"setFullYear"](n(this).data("value"));n(this).parent().parent().hide();i.trigger("xchange.xdsoft");r.onChangeMonth&&r.onChangeMonth.call&&r.onChangeMonth.call(i,v.currentTime,i.data("input"));t!=v.currentTime.getFullYear()&&n.isFunction(r.onChangeYear)&&r.onChangeYear.call(i,v.currentTime,i.data("input"))});i.setOptions=function(y){if(r=n.extend(!0,{},r,y),y.allowTimes&&n.isArray(y.allowTimes)&&y.allowTimes.length&&(r.allowTimes=n.extend(!0,[],y.allowTimes)),y.weekends&&n.isArray(y.weekends)&&y.weekends.length&&(r.weekends=n.extend(!0,[],y.weekends)),(r.open||r.opened)&&!r.inline&&t.trigger("open.xdsoft"),r.inline&&(lt=!0,i.addClass("xdsoft_inline"),t.after(i).hide()),r.inverseButton&&(r.next="xdsoft_prev",r.prev="xdsoft_next"),r.datepicker?ht.addClass("active"):ht.removeClass("active"),r.timepicker?ct.addClass("active"):ct.removeClass("active"),r.value&&(t&&t.val&&t.val(r.value),v.setCurrentTime(r.value)),r.dayOfWeekStart=isNaN(r.dayOfWeekStart)?0:parseInt(r.dayOfWeekStart)%7,r.timepickerScrollbar||ti.hide(),r.minDate&&/^-(.*)$/.test(r.minDate)&&(r.minDate=v.strToDateTime(r.minDate).dateFormat(r.formatDate)),r.maxDate&&/^\+(.*)$/.test(r.maxDate)&&(r.maxDate=v.strToDateTime(r.maxDate).dateFormat(r.formatDate)),et.find(".xdsoft_today_button").css("visibility",r.todayButton?"visible":"hidden"),r.mask){var st=function(n){try{if(document.selection&&document.selection.createRange){var t=document.selection.createRange();return t.getBookmark().charCodeAt(2)-2}if(n.setSelectionRange)return n.selectionStart}catch(i){return 0}},at=function(n,t){if(n=typeof n=="string"||n instanceof String?document.getElementById(n):n,n){if(n.createTextRange){var i=n.createTextRange();return i.collapse(!0),i.moveEnd(t),i.moveStart(t),i.select(),!0}if(n.setSelectionRange)return n.setSelectionRange(t,t),!0}else return!1;return!1},ot=function(n,t){var i=n.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g,"\\$1").replace(/_/g,"{digit+}").replace(/([0-9]{1})/g,"{digit$1}").replace(/\{digit([0-9]{1})\}/g,"[0-$1_]{1}").replace(/\{digit[\+]\}/g,"[0-9_]{1}");return RegExp(i).test(t)};t.off("keydown.xdsoft");switch(!0){case r.mask===!0:r.mask=r.format.replace(/Y/g,"9999").replace(/F/g,"9999").replace(/m/g,"19").replace(/d/g,"39").replace(/H/g,"29").replace(/i/g,"59").replace(/s/g,"59");case n.type(r.mask)=="string":ot(r.mask,t.val())||t.val(r.mask.replace(/[0-9]/g,"_"));t.on("keydown.xdsoft",function(i){var et=this.value,v=i.which,y,ht;switch(!0){case v>=s&&v<=p||v>=h&&v<=c||v==f||v==u:for(y=st(this),ht=v!=f&&v!=u?String.fromCharCode(h<=v&&v<=c?v-s:v):"_",(v==f||v==u)&&y&&(y--,ht="_");/[^0-9_]/.test(r.mask.substr(y,1))&&y<r.mask.length&&y>0;)y+=v==f||v==u?-1:1;if(et=et.substr(0,y)+ht+et.substr(y+1),n.trim(et)=="")et=r.mask.replace(/[0-9]/g,"_");else if(y==r.mask.length)break;for(y+=v==f||v==u?0:1;/[^0-9_]/.test(r.mask.substr(y,1))&&y<r.mask.length&&y>0;)y+=v==f||v==u?-1:1;ot(r.mask,et)?(this.value=et,at(this,y)):n.trim(et)==""?this.value=r.mask.replace(/[0-9]/g,"_"):t.trigger("error_input.xdsoft");break;case!!~[tt,it,rt,ut,ft].indexOf(v)&&o:case!!~[w,k,g,b,d,nt,e,a,l].indexOf(v):return!0}return i.preventDefault(),!1})}}if(r.validateOnBlur)t.off("blur.xdsoft").on("blur.xdsoft",function(){r.allowBlank&&!n.trim(n(this).val()).length?(n(this).val(null),i.data("xdsoft_datetime").empty()):Date.parseDate(n(this).val(),r.format)?i.data("xdsoft_datetime").setCurrentTime(n(this).val()):(n(this).val(v.now().dateFormat(r.format)),i.data("xdsoft_datetime").setCurrentTime(n(this).val()));i.trigger("changedatetime.xdsoft")});r.dayOfWeekStartPrev=r.dayOfWeekStart==0?6:r.dayOfWeekStart-1;i.trigger("xchange.xdsoft").trigger("afterOpen.xdsoft")};i.data("options",r).on("mousedown.xdsoft",function(n){return n.stopPropagation(),n.preventDefault(),bt.hide(),wt.hide(),!1});at=ct.find(".xdsoft_time_box");at.append(y);at.xdsoftScroller();i.on("afterOpen.xdsoft",function(){at.xdsoftScroller()});i.append(ht).append(ct);r.withoutCopyright!==!0&&i.append(ni);ht.append(et).append(pt);n(r.parentID).append(i);v=new function(){var t=this;t.now=function(n){var i=new Date,u,f;return!n&&r.defaultDate&&(u=t.strToDate(r.defaultDate),i.setFullYear(u.getFullYear()),i.setMonth(u.getMonth()),i.setDate(u.getDate())),r.yearOffset&&i.setFullYear(i.getFullYear()+r.yearOffset),!n&&r.defaultTime&&(f=t.strtotime(r.defaultTime),i.setHours(f.getHours()),i.setMinutes(f.getMinutes())),i};t.isValidDate=function(n){return Object.prototype.toString.call(n)!=="[object Date]"?!1:!isNaN(n.getTime())};t.setCurrentTime=function(n){t.currentTime=typeof n=="string"?t.strToDateTime(n):t.isValidDate(n)?n:t.now();i.trigger("xchange.xdsoft")};t.empty=function(){t.currentTime=null};t.getCurrentTime=function(){return t.currentTime};t.nextMonth=function(){var u=t.currentTime.getMonth()+1,f;return u==12&&(t.currentTime.setFullYear(t.currentTime.getFullYear()+1),u=0),f=t.currentTime.getFullYear(),t.currentTime.setDate(Math.min(new Date(t.currentTime.getFullYear(),u+1,0).getDate(),t.currentTime.getDate())),t.currentTime.setMonth(u),r.onChangeMonth&&r.onChangeMonth.call&&r.onChangeMonth.call(i,v.currentTime,i.data("input")),f!=t.currentTime.getFullYear()&&n.isFunction(r.onChangeYear)&&r.onChangeYear.call(i,v.currentTime,i.data("input")),i.trigger("xchange.xdsoft"),u};t.prevMonth=function(){var n=t.currentTime.getMonth()-1;return n==-1&&(t.currentTime.setFullYear(t.currentTime.getFullYear()-1),n=11),t.currentTime.setDate(Math.min(new Date(t.currentTime.getFullYear(),n+1,0).getDate(),t.currentTime.getDate())),t.currentTime.setMonth(n),r.onChangeMonth&&r.onChangeMonth.call&&r.onChangeMonth.call(i,v.currentTime,i.data("input")),i.trigger("xchange.xdsoft"),n};t.getWeekOfYear=function(n){var t=new Date(n.getFullYear(),0,1);return Math.ceil(((n-t)/864e5+t.getDay()+1)/7)};t.strToDateTime=function(n){if(n&&n instanceof Date&&t.isValidDate(n))return n;var i=[],f,u;return(i=/^(\+|\-)(.*)$/.exec(n))&&(i[2]=Date.parseDate(i[2],r.formatDate))?(f=i[2].getTime()-i[2].getTimezoneOffset()*6e4,u=new Date(v.now().getTime()+parseInt(i[1]+"1")*f)):u=n?Date.parseDate(n,r.format):t.now(),t.isValidDate(u)||(u=t.now()),u};t.strToDate=function(n){if(n&&n instanceof Date&&t.isValidDate(n))return n;var i=n?Date.parseDate(n,r.formatDate):t.now(!0);return t.isValidDate(i)||(i=t.now(!0)),i};t.strtotime=function(n){if(n&&n instanceof Date&&t.isValidDate(n))return n;var i=n?Date.parseDate(n,r.formatTime):t.now(!0);return t.isValidDate(i)||(i=t.now(!0)),i};t.str=function(){return t.currentTime.dateFormat(r.format)};t.currentTime=this.now()};et.find(".xdsoft_today_button").on("mousedown.xdsoft",function(){i.data("changed",!0);v.setCurrentTime(0);i.trigger("afterOpen.xdsoft")}).on("dblclick.xdsoft",function(){t.val(v.str());i.trigger("close.xdsoft")});et.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var t=n(this),i=0,u=!1;(function f(n){var e=v.currentTime.getMonth();t.hasClass(r.next)?v.nextMonth():t.hasClass(r.prev)&&v.prevMonth();r.monthChangeSpinner&&(u||(i=setTimeout(f,n?n:100)))})(500);n([document.body,window]).on("mouseup.xdsoft",function e(){clearTimeout(i);u=!0;n([document.body,window]).off("mouseup.xdsoft",e)})});ct.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var i=n(this),u=0,f=!1,t=110;(function e(n){var s=ot[0].clientHeight,h=y[0].offsetHeight,o=Math.abs(parseInt(y.css("marginTop")));i.hasClass(r.next)&&h-s-r.timeHeightInTimePicker>=o?y.css("marginTop","-"+(o+r.timeHeightInTimePicker)+"px"):i.hasClass(r.prev)&&o-r.timeHeightInTimePicker>=0&&y.css("marginTop","-"+(o-r.timeHeightInTimePicker)+"px");ot.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(y.css("marginTop"))/(h-s))]);t=t>10?10:t-10;f||(u=setTimeout(e,n?n:t))})(500);n([document.body,window]).on("mouseup.xdsoft",function o(){clearTimeout(u);f=!0;n([document.body,window]).off("mouseup.xdsoft",o)})});kt=0;i.on("xchange.xdsoft",function(t){clearTimeout(kt);kt=setTimeout(function(){for(var e="",u=new Date(v.currentTime.getFullYear(),v.currentTime.getMonth(),1,12,0,0),t=0,k=v.now(),s,h,p,d,c,g,f,l,w,o,a;u.getDay()!=r.dayOfWeekStart;)u.setDate(u.getDate()-1);for(e+="<table><thead><tr>",r.weeks&&(e+="<th><\/th>"),o=0;o<7;o++)e+="<th>"+r.i18n[r.lang].dayOfWeek[(o+r.dayOfWeekStart)%7]+"<\/th>";for(e+="<\/tr><\/thead>",e+="<tbody>",s=!1,h=!1,r.maxDate!==!1&&(s=v.strToDate(r.maxDate),s=new Date(s.getFullYear(),s.getMonth(),s.getDate(),23,59,59,999)),r.minDate!==!1&&(h=v.strToDate(r.minDate),h=new Date(h.getFullYear(),h.getMonth(),h.getDate())),f=[],w=!0;t<v.currentTime.countDaysInMonth()||u.getDay()!=r.dayOfWeekStart||v.currentTime.getMonth()==u.getMonth();)f=[],t++,p=u.getDate(),d=u.getFullYear(),c=u.getMonth(),g=v.getWeekOfYear(u),f.push("xdsoft_date"),l=r.beforeShowDay&&r.beforeShowDay.call?r.beforeShowDay.call(i,u):null,(s!==!1&&u>s||h!==!1&&u<h||l&&l[0]===!1)&&f.push("xdsoft_disabled"),l&&l[1]!=""&&f.push(l[1]),v.currentTime.getMonth()!=c&&f.push("xdsoft_other_month"),(r.defaultSelect||i.data("changed"))&&v.currentTime.dateFormat(r.formatDate)==u.dateFormat(r.formatDate)&&f.push("xdsoft_current"),k.dateFormat(r.formatDate)==u.dateFormat(r.formatDate)&&f.push("xdsoft_today"),(u.getDay()==0||u.getDay()==6||~r.weekends.indexOf(u.dateFormat(r.formatDate)))&&f.push("xdsoft_weekend"),r.beforeShowDay&&typeof r.beforeShowDay=="function"&&f.push(r.beforeShowDay(u)),w&&(e+="<tr>",w=!1,r.weeks&&(e+="<th>"+g+"<\/th>")),e+='<td data-date="'+p+'" data-month="'+c+'" data-year="'+d+'" class="xdsoft_date xdsoft_day_of_week'+u.getDay()+" "+f.join(" ")+'"><div>'+p+"<\/div><\/td>",u.getDay()==r.dayOfWeekStartPrev&&(e+="<\/tr>",w=!0),u.setDate(p+1);e+="<\/tbody><\/table>";pt.html(e);et.find(".xdsoft_label span").eq(0).text(r.i18n[r.lang].months[v.currentTime.getMonth()]);et.find(".xdsoft_label span").eq(1).text(v.currentTime.getFullYear());var nt="",b="",c="",tt=function(n,t){var u=v.now();u.setHours(n);n=parseInt(u.getHours());u.setMinutes(t);t=parseInt(u.getMinutes());f=[];(r.maxTime!==!1&&v.strtotime(r.maxTime).getTime()<u.getTime()||r.minTime!==!1&&v.strtotime(r.minTime).getTime()>u.getTime())&&f.push("xdsoft_disabled");(r.initTime||r.defaultSelect||i.data("changed"))&&parseInt(v.currentTime.getHours())==parseInt(n)&&(r.step>59||Math[r.roundTime](v.currentTime.getMinutes()/r.step)*r.step==parseInt(t))&&(r.defaultSelect||i.data("changed")?f.push("xdsoft_current"):r.initTime&&f.push("xdsoft_init_time"));parseInt(k.getHours())==parseInt(n)&&parseInt(k.getMinutes())==parseInt(t)&&f.push("xdsoft_today");nt+='<div class="xdsoft_time '+f.join(" ")+'" data-hour="'+n+'" data-minute="'+t+'">'+u.dateFormat(r.formatTime)+"<\/div>"};if(r.allowTimes&&n.isArray(r.allowTimes)&&r.allowTimes.length)for(t=0;t<r.allowTimes.length;t++)b=v.strtotime(r.allowTimes[t]).getHours(),c=v.strtotime(r.allowTimes[t]).getMinutes(),tt(b,c);else for(t=0,o=0;t<(r.hours12?12:24);t++)for(o=0;o<60;o+=r.step)b=(t<10?"0":"")+t,c=(o<10?"0":"")+o,tt(b,c);for(y.html(nt),a="",t=0,t=parseInt(r.yearStart,10)+r.yearOffset;t<=parseInt(r.yearEnd,10)+r.yearOffset;t++)a+='<div class="xdsoft_option '+(v.currentTime.getFullYear()==t?"xdsoft_current":"")+'" data-value="'+t+'">'+t+"<\/div>";for(bt.children().eq(0).html(a),t=0,a="";t<=11;t++)a+='<div class="xdsoft_option '+(v.currentTime.getMonth()==t?"xdsoft_current":"")+'" data-value="'+t+'">'+r.i18n[r.lang].months[t]+"<\/div>";wt.children().eq(0).html(a);n(i).trigger("generate.xdsoft")},10);t.stopPropagation()}).on("afterOpen.xdsoft",function(){var n;if(r.timepicker)if(y.find(".xdsoft_current").length?n=".xdsoft_current":y.find(".xdsoft_init_time").length&&(n=".xdsoft_init_time"),n){var t=ot[0].clientHeight,i=y[0].offsetHeight,u=y.find(n).index()*r.timeHeightInTimePicker+1;i-t<u&&(u=i-t);ot.trigger("scroll_element.xdsoft_scroller",[parseInt(u)/(i-t)])}else ot.trigger("scroll_element.xdsoft_scroller",[0])});vt=0;pt.on("click.xdsoft","td",function(u){u.stopPropagation();vt++;var e=n(this),f=v.currentTime;if((f===undefined||f===null)&&(v.currentTime=v.now(),f=v.currentTime),e.hasClass("xdsoft_disabled"))return!1;f.setDate(1);f.setFullYear(e.data("year"));f.setMonth(e.data("month"));f.setDate(e.data("date"));i.trigger("select.xdsoft",[f]);t.val(v.str());(vt>1||r.closeOnDateSelect===!0||r.closeOnDateSelect===0&&!r.timepicker)&&!r.inline&&i.trigger("close.xdsoft");r.onSelectDate&&r.onSelectDate.call&&r.onSelectDate.call(i,v.currentTime,i.data("input"));i.data("changed",!0);i.trigger("xchange.xdsoft");i.trigger("changedatetime.xdsoft");setTimeout(function(){vt=0},200)});y.on("click.xdsoft","div",function(t){t.stopPropagation();var f=n(this),u=v.currentTime;if((u===undefined||u===null)&&(v.currentTime=v.now(),u=v.currentTime),f.hasClass("xdsoft_disabled"))return!1;u.setHours(f.data("hour"));u.setMinutes(f.data("minute"));i.trigger("select.xdsoft",[u]);i.data("input").val(v.str());r.inline||i.trigger("close.xdsoft");r.onSelectTime&&r.onSelectTime.call&&r.onSelectTime.call(i,v.currentTime,i.data("input"));i.data("changed",!0);i.trigger("xchange.xdsoft");i.trigger("changedatetime.xdsoft")});i.mousewheel&&ht.mousewheel(function(n,t){return r.scrollMonth?(t<0?v.nextMonth():v.prevMonth(),!1):!0});i.mousewheel&&ot.unmousewheel().mousewheel(function(n,t){if(!r.scrollTime)return!0;var f=ot[0].clientHeight,e=y[0].offsetHeight,i=Math.abs(parseInt(y.css("marginTop"))),u=!0;return t<0&&e-f-r.timeHeightInTimePicker>=i?(y.css("marginTop","-"+(i+r.timeHeightInTimePicker)+"px"),u=!1):t>0&&i-r.timeHeightInTimePicker>=0&&(y.css("marginTop","-"+(i-r.timeHeightInTimePicker)+"px"),u=!1),ot.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(y.css("marginTop"))/(e-f))]),n.stopPropagation(),u});lt=!1;i.on("changedatetime.xdsoft",function(){if(r.onChangeDateTime&&r.onChangeDateTime.call){var n=i.data("input");r.onChangeDateTime.call(i,v.currentTime,n);delete r.value;n.trigger("change")}}).on("generate.xdsoft",function(){r.onGenerate&&r.onGenerate.call&&r.onGenerate.call(i,v.currentTime,i.data("input"));lt&&(i.trigger("afterOpen.xdsoft"),lt=!1)}).on("click.xdsoft",function(n){n.stopPropagation()});st=0;t.mousewheel&&t.mousewheel(function(n,u,f,e){return r.scrollInput?!r.datepicker&&r.timepicker?(st=y.find(".xdsoft_current").length?y.find(".xdsoft_current").eq(0).index():0,st+u>=0&&st+u<y.children().length&&(st+=u),y.children().eq(st).length&&y.children().eq(st).trigger("mousedown"),!1):r.datepicker&&!r.timepicker?(ht.trigger(n,[u,f,e]),t.val&&t.val(v.str()),i.trigger("changedatetime.xdsoft"),!1):void 0:!0});yt=function(){var f=i.data("input").offset(),t=f.top+i.data("input")[0].offsetHeight-1,u=f.left,e="absolute";r.fixed?(t-=n(window).scrollTop(),u-=n(window).scrollLeft(),e="fixed"):(t+i[0].offsetHeight>n(window).height()+n(window).scrollTop()&&(t=f.top-i[0].offsetHeight+1),t<0&&(t=0),u+i[0].offsetWidth>n(window).width()&&(u=n(window).width()-i[0].offsetWidth));i.css({left:u,top:t,position:e})};i.on("open.xdsoft",function(){var t=!0;if(r.onShow&&r.onShow.call&&(t=r.onShow.call(i,v.currentTime,i.data("input"))),t!==!1){i.show();yt();n(window).off("resize.xdsoft",yt).on("resize.xdsoft",yt);if(r.closeOnWithoutClick)n([document.body,window]).on("mousedown.xdsoft",function u(){i.trigger("close.xdsoft");n([document.body,window]).off("mousedown.xdsoft",u)})}}).on("close.xdsoft",function(n){var t=!0;et.find(".xdsoft_month,.xdsoft_year").find(".xdsoft_select").hide();r.onClose&&r.onClose.call&&(t=r.onClose.call(i,v.currentTime,i.data("input")));t===!1||r.opened||r.inline||i.hide();n.stopPropagation()}).data("input",t);dt=0;ii=0;i.data("xdsoft_datetime",v);i.setOptions(r);v.setCurrentTime(gt());t.data("xdsoft_datetimepicker",i).on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function(){t.is(":disabled")||t.is(":hidden")||!t.is(":visible")||t.data("xdsoft_datetimepicker").is(":visible")&&r.closeOnInputClick||(clearTimeout(dt),dt=setTimeout(function(){t.is(":disabled")||t.is(":hidden")||!t.is(":visible")||(lt=!0,v.setCurrentTime(gt()),i.trigger("open.xdsoft"))},100))}).on("keydown.xdsoft",function(t){var f=this.value,u=t.which,r;switch(!0){case!!~[l].indexOf(u):return r=n("input:visible,textarea:visible"),i.trigger("close.xdsoft"),r.eq(r.index(this)+1).focus(),!1;case!!~[a].indexOf(u):return i.trigger("close.xdsoft"),!0}})},ot=function(t){var i=t.data("xdsoft_datetimepicker");i&&(i.data("xdsoft_datetime",null),i.remove(),t.data("xdsoft_datetimepicker",null).off("open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft blur.xdsoft keydown.xdsoft"),n(window).off("resize.xdsoft"),n([window,document.body]).off("mousedown.xdsoft"),t.unmousewheel&&t.unmousewheel())};n(document).off("keydown.xdsoftctrl keyup.xdsoftctrl").on("keydown.xdsoftctrl",function(n){n.keyCode==e&&(o=!0)}).on("keyup.xdsoftctrl",function(n){n.keyCode==e&&(o=!1)});return this.each(function(){var t;if(t=n(this).data("xdsoft_datetimepicker")){if(n.type(i)==="string")switch(i){case"show":n(this).select().focus();t.trigger("open.xdsoft");break;case"hide":t.trigger("close.xdsoft");break;case"destroy":ot(n(this));break;case"reset":this.value=this.defaultValue;this.value&&t.data("xdsoft_datetime").isValidDate(Date.parseDate(this.value,r.format))||t.data("changed",!1);t.data("xdsoft_datetime").setCurrentTime(this.value)}else t.setOptions(i);return 0}n.type(i)!=="string"&&(!r.lazyInit||r.open||r.inline?y(n(this)):et(n(this)))})};n.fn.datetimepicker.defaults=t}(jQuery),function(n){typeof define=="function"&&define.amd?define(["jquery"],n):typeof exports=="object"?module.exports=n:n(jQuery)}(function(n){function f(i){var u=i||window.event,l=[].slice.call(arguments,1),f=0,e=0,o=0,h=0,c=0,s;return i=n.event.fix(u),i.type="mousewheel",u.wheelDelta&&(f=u.wheelDelta),u.detail&&(f=u.detail*-1),u.deltaY&&(o=u.deltaY*-1,f=o),u.deltaX&&(e=u.deltaX,f=e*-1),u.wheelDeltaY!==undefined&&(o=u.wheelDeltaY),u.wheelDeltaX!==undefined&&(e=u.wheelDeltaX*-1),h=Math.abs(f),(!r||h<r)&&(r=h),c=Math.max(Math.abs(o),Math.abs(e)),(!t||c<t)&&(t=c),s=f>0?"floor":"ceil",f=Math[s](f/r),e=Math[s](e/t),o=Math[s](o/t),l.unshift(i,f,e,o),(n.event.dispatch||n.event.handle).apply(this,l)}var e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],i="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],r,t,u;if(n.event.fixHooks)for(u=e.length;u;)n.event.fixHooks[e[--u]]=n.event.mouseHooks;n.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var n=i.length;n;)this.addEventListener(i[--n],f,!1);else this.onmousewheel=f},teardown:function(){if(this.removeEventListener)for(var n=i.length;n;)this.removeEventListener(i[--n],f,!1);else this.onmousewheel=null}};n.fn.extend({mousewheel:function(n){return n?this.bind("mousewheel",n):this.trigger("mousewheel")},unmousewheel:function(n){return this.unbind("mousewheel",n)}})});Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(n){if(n=="unixtime")return parseInt(this.getTime()/1e3);Date.formatFunctions[n]==null&&Date.createNewFormat(n);var t=Date.formatFunctions[n];return this[t]()};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++,i;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function() {return ",special=!1,ch="";for(i=0;i<format.length;++i)ch=format.charAt(i),special||ch!="\\"?special?(special=!1,code+="'"+String.escape(ch)+"' + "):code+=Date.getFormatCode(ch):special=!0;eval(code.substring(0,code.length-3)+";}")};Date.getFormatCode=function(n){switch(n){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(n)+"' + "}};Date.parseDate=function(n,t){if(t=="unixtime")return new Date(isNaN(parseInt(n))?0:parseInt(n)*1e3);Date.parseFunctions[t]==null&&Date.createParser(t);var i=Date.parseFunctions[t];return Date[i](n)};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++,regexNum=Date.parseRegexes.length,currentGroup=1,i;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {",regex="",special=!1,ch="";for(i=0;i<format.length;++i)ch=format.charAt(i),special||ch!="\\"?special?(special=!1,regex+=String.escape(ch)):(obj=Date.formatCodeToRegex(ch,currentGroup),currentGroup+=obj.g,regex+=obj.s,obj.g&&obj.c&&(code+=obj.c)):special=!0;code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code)};Date.formatCodeToRegex=function(n,t){switch(n){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+t+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+t+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+t+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+t+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+t+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+t+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+t+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+t+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+t+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+t+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+t+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+t+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(n)}}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0")};Date.prototype.getDayOfYear=function(){var t=0,n;for(Date.daysInMonth[1]=this.isLeapYear()?29:28,n=0;n<this.getMonth();++n)t+=Date.daysInMonth[n];return t+this.getDate()};Date.prototype.getWeekOfYear=function(){var n=this.getDayOfYear()+(4-this.getDay()),t=new Date(this.getFullYear(),0,1),i=11-t.getDay();return String.leftPad(Math.ceil((n-i)/7)+1,2,"0")};Date.prototype.isLeapYear=function(){var n=this.getFullYear();return(n&3)==0&&(n%100||n%400==0&&n)};Date.prototype.getFirstDayOfMonth=function(){var n=(this.getDay()-(this.getDate()-1))%7;return n<0?n+7:n};Date.prototype.getLastDayOfMonth=function(){var n=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return n<0?n+7:n};Date.prototype.getDaysInMonth=function(){return Date.daysInMonth[1]=this.isLeapYear()?29:28,Date.daysInMonth[this.getMonth()]};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};String.escape=function(n){return n.replace(/('|\\)/g,"\\$1")};String.leftPad=function(n,t,i){var r=new String(n);for(i==null&&(i=" ");r.length<t;)r=i+r;return r};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};var Kinetic={};if(!function(n){var t=Math.PI/180;Kinetic={version:"5.1.0",stages:[],idCounter:0,ids:{},names:{},shapes:{},listenClickTap:!1,inDblClickWindow:!1,enableTrace:!1,traceArrMax:100,dblClickWindow:400,pixelRatio:void 0,dragDistance:0,angleDeg:!0,UA:function(){var i=n.navigator&&n.navigator.userAgent||"",t=i.toLowerCase(),r=/(chrome)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[],u=!!i.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i);return{browser:r[1]||"",version:r[2]||"0",mobile:u}}(),Filters:{},Node:function(n){this._init(n)},Shape:function(n){this.__init(n)},Container:function(n){this.__init(n)},Stage:function(n){this.___init(n)},BaseLayer:function(n){this.___init(n)},Layer:function(n){this.____init(n)},FastLayer:function(n){this.____init(n)},Group:function(n){this.___init(n)},isDragging:function(){var n=Kinetic.DD;return n?n.isDragging:!1},isDragReady:function(){var n=Kinetic.DD;return n?!!n.node:!1},_addId:function(n,t){void 0!==t&&(this.ids[t]=n)},_removeId:function(n){void 0!==n&&delete this.ids[n]},_addName:function(n,t){void 0!==t&&(void 0===this.names[t]&&(this.names[t]=[]),this.names[t].push(n))},_removeName:function(n,t){var i,r,u;if(void 0!==n&&(i=this.names[n],void 0!==i)){for(r=0;r<i.length;r++)u=i[r],u._id===t&&i.splice(r,1);0===i.length&&delete this.names[n]}},getAngle:function(n){return this.angleDeg?n*t:n}}}(this),function(n,t){if("object"==typeof exports){var i=require("canvas"),r=require("jsdom").jsdom,u=r("<!DOCTYPE html><html><head><\/head><body><\/body><\/html>"),f=t();return Kinetic.document=u,Kinetic.window=Kinetic.document.createWindow(),Kinetic.window.Image=i.Image,Kinetic.root=n,Kinetic._nodeCanvas=i,void(module.exports=f)}"function"==typeof define&&define.amd&&define(t);Kinetic.document=document;Kinetic.window=window;Kinetic.root=n}(eval("this"),function(){return Kinetic}),function(){Kinetic.Collection=function(){var t=[].slice.call(arguments),i=t.length,n=0;for(this.length=i;i>n;n++)this[n]=t[n];return this};Kinetic.Collection.prototype=[];Kinetic.Collection.prototype.each=function(n){for(var t=0;t<this.length;t++)n(this[t],t)};Kinetic.Collection.prototype.toArray=function(){for(var t=[],i=this.length,n=0;i>n;n++)t.push(this[n]);return t};Kinetic.Collection.toCollection=function(n){for(var i=new Kinetic.Collection,r=n.length,t=0;r>t;t++)i.push(n[t]);return i};Kinetic.Collection._mapMethod=function(n){Kinetic.Collection.prototype[n]=function(){for(var i=this.length,r=[].slice.call(arguments),t=0;i>t;t++)this[t][n].apply(this[t],r);return this}};Kinetic.Collection.mapMethods=function(n){var t=n.prototype;for(var i in t)Kinetic.Collection._mapMethod(i)};Kinetic.Transform=function(n){this.m=n&&n.slice()||[1,0,0,1,0,0]};Kinetic.Transform.prototype={copy:function(){return new Kinetic.Transform(this.m)},point:function(n){var t=this.m;return{x:t[0]*n.x+t[2]*n.y+t[4],y:t[1]*n.x+t[3]*n.y+t[5]}},translate:function(n,t){return this.m[4]+=this.m[0]*n+this.m[2]*t,this.m[5]+=this.m[1]*n+this.m[3]*t,this},scale:function(n,t){return this.m[0]*=n,this.m[1]*=n,this.m[2]*=t,this.m[3]*=t,this},rotate:function(n){var t=Math.cos(n),i=Math.sin(n),r=this.m[0]*t+this.m[2]*i,u=this.m[1]*t+this.m[3]*i,f=this.m[0]*-i+this.m[2]*t,e=this.m[1]*-i+this.m[3]*t;return this.m[0]=r,this.m[1]=u,this.m[2]=f,this.m[3]=e,this},getTranslation:function(){return{x:this.m[4],y:this.m[5]}},skew:function(n,t){var i=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,u=this.m[2]+this.m[0]*n,f=this.m[3]+this.m[1]*n;return this.m[0]=i,this.m[1]=r,this.m[2]=u,this.m[3]=f,this},multiply:function(n){var t=this.m[0]*n.m[0]+this.m[2]*n.m[1],i=this.m[1]*n.m[0]+this.m[3]*n.m[1],r=this.m[0]*n.m[2]+this.m[2]*n.m[3],u=this.m[1]*n.m[2]+this.m[3]*n.m[3],f=this.m[0]*n.m[4]+this.m[2]*n.m[5]+this.m[4],e=this.m[1]*n.m[4]+this.m[3]*n.m[5]+this.m[5];return this.m[0]=t,this.m[1]=i,this.m[2]=r,this.m[3]=u,this.m[4]=f,this.m[5]=e,this},invert:function(){var n=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*n,i=-this.m[1]*n,r=-this.m[2]*n,u=this.m[0]*n,f=n*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),e=n*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=i,this.m[2]=r,this.m[3]=u,this.m[4]=f,this.m[5]=e,this},getMatrix:function(){return this.m},setAbsolutePosition:function(n,t){var i=this.m[0],r=this.m[1],u=this.m[2],o=this.m[3],f=this.m[4],s=this.m[5],e=(i*(t-s)-r*(n-f))/(i*o-r*u),h=(n-f-u*e)/i;return this.translate(h,e)}};var r="2d",u="[object Array]",f="[object Number]",e="[object String]",o=Math.PI/180,s=180/Math.PI,n="#",t="",h="0",c="Kinetic warning: ",l="Kinetic error: ",a="rgb(",i={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],fuchsia:[255,0,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},v=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;Kinetic.Util={_isElement:function(n){return!(!n||1!=n.nodeType)},_isFunction:function(n){return!!(n&&n.constructor&&n.call&&n.apply)},_isObject:function(n){return!!n&&n.constructor==Object},_isArray:function(n){return Object.prototype.toString.call(n)==u},_isNumber:function(n){return Object.prototype.toString.call(n)==f},_isString:function(n){return Object.prototype.toString.call(n)==e},_throttle:function(n,t,i){var r,u,o,f=null,e=0,s;return i||(i={}),s=function(){e=i.leading===!1?0:(new Date).getTime();f=null;o=n.apply(r,u);r=u=null},function(){var h=(new Date).getTime(),c;return e||i.leading!==!1||(e=h),c=t-(h-e),r=this,u=arguments,0>=c?(clearTimeout(f),f=null,e=h,o=n.apply(r,u),r=u=null):f||i.trailing===!1||(f=setTimeout(s,c)),o}},_hasMethods:function(n){var t,i=[];for(t in n)this._isFunction(n[t])&&i.push(t);return i.length>0},createCanvasElement:function(){var n=Kinetic.document.createElement("canvas");return n.style=n.style||{},n},isBrowser:function(){return"object"!=typeof exports},_isInDocument:function(n){for(;n=n.parentNode;)if(n==Kinetic.document)return!0;return!1},_simplifyArray:function(n){for(var t,r=[],f=n.length,u=Kinetic.Util,i=0;f>i;i++)t=n[i],u._isNumber(t)?t=Math.round(1e3*t)/1e3:u._isString(t)||(t=t.toString()),r.push(t);return r},_getImage:function(n,t){var u,i,f;n?this._isElement(n)?t(n):this._isString(n)?(u=new Kinetic.window.Image,u.onload=function(){t(u)},u.src=n):n.data?(i=Kinetic.Util.createCanvasElement(),i.width=n.width,i.height=n.height,f=i.getContext(r),f.putImageData(n,0,0),this._getImage(i.toDataURL(),t)):t(null):t(null)},_getRGBAString:function(n){var i=n.red||0,r=n.green||0,u=n.blue||0,f=n.alpha||1;return["rgba(",i,",",r,",",u,",",f,")"].join(t)},_rgbToHex:function(n,t,i){return(16777216+(n<<16)+(t<<8)+i).toString(16).slice(1)},_hexToRgb:function(i){i=i.replace(n,t);var r=parseInt(i,16);return{r:r>>16&255,g:r>>8&255,b:255&r}},getRandomColor:function(){for(var t=(16777215*Math.random()<<0).toString(16);t.length<6;)t=h+t;return n+t},get:function(n,t){return void 0===n?t:n},getRGB:function(t){var r;return t in i?(r=i[t],{r:r[0],g:r[1],b:r[2]}):t[0]===n?this._hexToRgb(t.substring(1)):t.substr(0,4)===a?(r=v.exec(t.replace(/ /g,"")),{r:parseInt(r[1],10),g:parseInt(r[2],10),b:parseInt(r[3],10)}):{r:0,g:0,b:0}},_merge:function(n,t){var r=this._clone(t);for(var i in n)r[i]=this._isObject(n[i])?this._merge(n[i],r[i]):n[i];return r},cloneObject:function(n){var i={};for(var t in n)i[t]=this._isObject(n[t])?this.cloneObject(n[t]):this._isArray(n[t])?this.cloneArray(n[t]):n[t];return i},cloneArray:function(n){return n.slice(0)},_degToRad:function(n){return n*o},_radToDeg:function(n){return n*s},_capitalize:function(n){return n.charAt(0).toUpperCase()+n.slice(1)},error:function(n){throw new Error(l+n);},warn:function(n){Kinetic.root.console&&console.warn&&console.warn(c+n)},extend:function(n,t){for(var i in t.prototype)i in n.prototype||(n.prototype[i]=t.prototype[i])},addMethods:function(n,t){for(var i in t)n.prototype[i]=t[i]},_getControlPoints:function(n,t,i,r,u,f,e){var o=Math.sqrt(Math.pow(i-n,2)+Math.pow(r-t,2)),s=Math.sqrt(Math.pow(u-i,2)+Math.pow(f-r,2)),h=e*o/(o+s),c=e*s/(o+s),l=i-h*(u-n),a=r-h*(f-t),v=i+c*(u-n),y=r+c*(f-t);return[l,a,v,y]},_expandPoints:function(n,t){for(var u,f=n.length,r=[],i=2;f-2>i;i+=2)u=Kinetic.Util._getControlPoints(n[i-2],n[i-1],n[i],n[i+1],n[i+2],n[i+3],t),r.push(u[0]),r.push(u[1]),r.push(n[i]),r.push(n[i+1]),r.push(u[2]),r.push(u[3]);return r},_removeLastLetter:function(n){return n.substring(0,n.length-1)}}}(),function(){var t=Kinetic.Util.createCanvasElement(),n=t.getContext("2d"),i=Kinetic.UA.mobile?function(){var t=window.devicePixelRatio||1,i=n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1;return t/i}():1;Kinetic.Canvas=function(n){this.init(n)};Kinetic.Canvas.prototype={init:function(n){n=n||{};var t=n.pixelRatio||Kinetic.pixelRatio||i;this.pixelRatio=t;this._canvas=Kinetic.Util.createCanvasElement();this._canvas.style.padding=0;this._canvas.style.margin=0;this._canvas.style.border=0;this._canvas.style.background="transparent";this._canvas.style.position="absolute";this._canvas.style.top=0;this._canvas.style.left=0},getContext:function(){return this.context},getPixelRatio:function(){return this.pixelRatio},setPixelRatio:function(n){this.pixelRatio=n;this.setSize(this.getWidth(),this.getHeight())},setWidth:function(n){this.width=this._canvas.width=n*this.pixelRatio;this._canvas.style.width=n+"px"},setHeight:function(n){this.height=this._canvas.height=n*this.pixelRatio;this._canvas.style.height=n+"px"},getWidth:function(){return this.width},getHeight:function(){return this.height},setSize:function(n,t){this.setWidth(n);this.setHeight(t)},toDataURL:function(n,t){try{return this._canvas.toDataURL(n,t)}catch(r){try{return this._canvas.toDataURL()}catch(i){return Kinetic.Util.warn("Unable to get data URL. "+i.message),""}}}};Kinetic.SceneCanvas=function(n){n=n||{};var t=n.width||0,i=n.height||0;Kinetic.Canvas.call(this,n);this.context=new Kinetic.SceneContext(this);this.setSize(t,i)};Kinetic.SceneCanvas.prototype={setWidth:function(n){var t=this.pixelRatio,i=this.getContext()._context;Kinetic.Canvas.prototype.setWidth.call(this,n);i.scale(t,t)},setHeight:function(n){var t=this.pixelRatio,i=this.getContext()._context;Kinetic.Canvas.prototype.setHeight.call(this,n);i.scale(t,t)}};Kinetic.Util.extend(Kinetic.SceneCanvas,Kinetic.Canvas);Kinetic.HitCanvas=function(n){n=n||{};var t=n.width||0,i=n.height||0;Kinetic.Canvas.call(this,n);this.context=new Kinetic.HitContext(this);this.setSize(t,i)};Kinetic.Util.extend(Kinetic.HitCanvas,Kinetic.Canvas)}(),function(){var n=",",i="(",r=")",u="([",f="])",e=";",o="()",s="=",t=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];Kinetic.Context=function(n){this.init(n)};Kinetic.Context.prototype={init:function(n){this.canvas=n;this._context=n._canvas.getContext("2d");Kinetic.enableTrace&&(this.traceArr=[],this._enableTrace())},fillShape:function(n){n.getFillEnabled()&&this._fill(n)},strokeShape:function(n){n.getStrokeEnabled()&&this._stroke(n)},fillStrokeShape:function(n){var t=n.getFillEnabled();t&&this._fill(n);n.getStrokeEnabled()&&this._stroke(n)},getTrace:function(t){for(var c,v,a,y=this.traceArr,p=y.length,h="",l=0;p>l;l++)c=y[l],v=c.method,v?(a=c.args,h+=v,h+=t?o:Kinetic.Util._isArray(a[0])?u+a.join(n)+f:i+a.join(n)+r):(h+=c.property,t||(h+=s+c.val)),h+=e;return h},clearTrace:function(){this.traceArr=[]},_trace:function(n){var i,t=this.traceArr;t.push(n);i=t.length;i>=Kinetic.traceArrMax&&t.shift()},reset:function(){var n=this.getCanvas().getPixelRatio();this.setTransform(1*n,0,0,1*n,0,0)},getCanvas:function(){return this.canvas},clear:function(n){var t=this.getCanvas();n?this.clearRect(n.x||0,n.y||0,n.width||0,n.height||0):this.clearRect(0,0,t.getWidth(),t.getHeight())},_applyLineCap:function(n){var t=n.getLineCap();t&&this.setAttr("lineCap",t)},_applyOpacity:function(n){var t=n.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)},_applyLineJoin:function(n){var t=n.getLineJoin();t&&this.setAttr("lineJoin",t)},setAttr:function(n,t){this._context[n]=t},arc:function(){var n=arguments;this._context.arc(n[0],n[1],n[2],n[3],n[4],n[5])},beginPath:function(){this._context.beginPath()},bezierCurveTo:function(){var n=arguments;this._context.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5])},clearRect:function(){var n=arguments;this._context.clearRect(n[0],n[1],n[2],n[3])},clip:function(){this._context.clip()},closePath:function(){this._context.closePath()},createImageData:function(){var n=arguments;return 2===n.length?this._context.createImageData(n[0],n[1]):1===n.length?this._context.createImageData(n[0]):void 0},createLinearGradient:function(){var n=arguments;return this._context.createLinearGradient(n[0],n[1],n[2],n[3])},createPattern:function(){var n=arguments;return this._context.createPattern(n[0],n[1])},createRadialGradient:function(){var n=arguments;return this._context.createRadialGradient(n[0],n[1],n[2],n[3],n[4],n[5])},drawImage:function(){var n=arguments,t=this._context;3===n.length?t.drawImage(n[0],n[1],n[2]):5===n.length?t.drawImage(n[0],n[1],n[2],n[3],n[4]):9===n.length&&t.drawImage(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},fill:function(){this._context.fill()},fillText:function(){var n=arguments;this._context.fillText(n[0],n[1],n[2])},getImageData:function(){var n=arguments;return this._context.getImageData(n[0],n[1],n[2],n[3])},lineTo:function(){var n=arguments;this._context.lineTo(n[0],n[1])},moveTo:function(){var n=arguments;this._context.moveTo(n[0],n[1])},rect:function(){var n=arguments;this._context.rect(n[0],n[1],n[2],n[3])},putImageData:function(){var n=arguments;this._context.putImageData(n[0],n[1],n[2])},quadraticCurveTo:function(){var n=arguments;this._context.quadraticCurveTo(n[0],n[1],n[2],n[3])},restore:function(){this._context.restore()},rotate:function(){var n=arguments;this._context.rotate(n[0])},save:function(){this._context.save()},scale:function(){var n=arguments;this._context.scale(n[0],n[1])},setLineDash:function(){var t=arguments,n=this._context;this._context.setLineDash?n.setLineDash(t[0]):"mozDash"in n?n.mozDash=t[0]:"webkitLineDash"in n&&(n.webkitLineDash=t[0])},setTransform:function(){var n=arguments;this._context.setTransform(n[0],n[1],n[2],n[3],n[4],n[5])},stroke:function(){this._context.stroke()},strokeText:function(){var n=arguments;this._context.strokeText(n[0],n[1],n[2])},transform:function(){var n=arguments;this._context.transform(n[0],n[1],n[2],n[3],n[4],n[5])},translate:function(){var n=arguments;this._context.translate(n[0],n[1])},_enableTrace:function(){for(var r,n=this,u=t.length,f=Kinetic.Util._simplifyArray,e=this.setAttr,o=function(t){var i,u=n[t];n[t]=function(){return r=f(Array.prototype.slice.call(arguments,0)),i=u.apply(n,arguments),n._trace({method:t,args:r}),i}},i=0;u>i;i++)o(t[i]);n.setAttr=function(){e.apply(n,arguments);n._trace({property:arguments[0],val:arguments[1]})}}};Kinetic.SceneContext=function(n){Kinetic.Context.call(this,n)};Kinetic.SceneContext.prototype={_fillColor:function(n){var t=n.fill()||Kinetic.Util._getRGBAString({red:n.fillRed(),green:n.fillGreen(),blue:n.fillBlue(),alpha:n.fillAlpha()});this.setAttr("fillStyle",t);n._fillFunc(this)},_fillPattern:function(n){var e=n.getFillPatternImage(),r=n.getFillPatternX(),u=n.getFillPatternY(),t=n.getFillPatternScale(),f=Kinetic.getAngle(n.getFillPatternRotation()),i=n.getFillPatternOffset(),o=n.getFillPatternRepeat();(r||u)&&this.translate(r||0,u||0);f&&this.rotate(f);t&&this.scale(t.x,t.y);i&&this.translate(-1*i.x,-1*i.y);this.setAttr("fillStyle",this.createPattern(e,o||"repeat"));this.fill()},_fillLinearGradient:function(n){var r=n.getFillLinearGradientStartPoint(),u=n.getFillLinearGradientEndPoint(),i=n.getFillLinearGradientColorStops(),f=this.createLinearGradient(r.x,r.y,u.x,u.y),t;if(i){for(t=0;t<i.length;t+=2)f.addColorStop(i[t],i[t+1]);this.setAttr("fillStyle",f);this.fill()}},_fillRadialGradient:function(n){for(var r=n.getFillRadialGradientStartPoint(),u=n.getFillRadialGradientEndPoint(),e=n.getFillRadialGradientStartRadius(),o=n.getFillRadialGradientEndRadius(),i=n.getFillRadialGradientColorStops(),f=this.createRadialGradient(r.x,r.y,e,u.x,u.y,o),t=0;t<i.length;t+=2)f.addColorStop(i[t],i[t+1]);this.setAttr("fillStyle",f);this.fill()},_fill:function(n){var i=n.fill()||n.fillRed()||n.fillGreen()||n.fillBlue(),r=n.getFillPatternImage(),u=n.getFillLinearGradientColorStops(),f=n.getFillRadialGradientColorStops(),t=n.getFillPriority();i&&"color"===t?this._fillColor(n):r&&"pattern"===t?this._fillPattern(n):u&&"linear-gradient"===t?this._fillLinearGradient(n):f&&"radial-gradient"===t?this._fillRadialGradient(n):i?this._fillColor(n):r?this._fillPattern(n):u?this._fillLinearGradient(n):f&&this._fillRadialGradient(n)},_stroke:function(n){var t=n.dash(),i=n.getStrokeScaleEnabled();n.hasStroke()&&(i||(this.save(),this.setTransform(1,0,0,1,0,0)),this._applyLineCap(n),t&&n.dashEnabled()&&this.setLineDash(t),this.setAttr("lineWidth",n.strokeWidth()),this.setAttr("strokeStyle",n.stroke()||Kinetic.Util._getRGBAString({red:n.strokeRed(),green:n.strokeGreen(),blue:n.strokeBlue(),alpha:n.strokeAlpha()})),n._strokeFunc(this),i||this.restore())},_applyShadow:function(n){var t=Kinetic.Util,u=n.getAbsoluteOpacity(),f=t.get(n.getShadowColor(),"black"),e=t.get(n.getShadowBlur(),5),i=t.get(n.getShadowOpacity(),1),r=t.get(n.getShadowOffset(),{x:0,y:0});i&&this.setAttr("globalAlpha",i*u);this.setAttr("shadowColor",f);this.setAttr("shadowBlur",e);this.setAttr("shadowOffsetX",r.x);this.setAttr("shadowOffsetY",r.y)}};Kinetic.Util.extend(Kinetic.SceneContext,Kinetic.Context);Kinetic.HitContext=function(n){Kinetic.Context.call(this,n)};Kinetic.HitContext.prototype={_fill:function(n){this.save();this.setAttr("fillStyle",n.colorKey);n._fillFuncHit(this);this.restore()},_stroke:function(n){n.hasStroke()&&(this._applyLineCap(n),this.setAttr("lineWidth",n.strokeWidth()),this.setAttr("strokeStyle",n.colorKey),n._strokeFuncHit(this))}};Kinetic.Util.extend(Kinetic.HitContext,Kinetic.Context)}(),function(){var n="get",t="set";Kinetic.Factory={addGetterSetter:function(n,t,i,r,u){this.addGetter(n,t,i);this.addSetter(n,t,r,u);this.addOverloadedGetterSetter(n,t)},addGetter:function(t,i,r){var u=n+Kinetic.Util._capitalize(i);t.prototype[u]=function(){var n=this.attrs[i];return void 0===n?r:n}},addSetter:function(n,i,r,u){var f=t+Kinetic.Util._capitalize(i);n.prototype[f]=function(n){return r&&(n=r.call(this,n)),this._setAttr(i,n),u&&u.call(this),this}},addComponentsGetterSetter:function(i,r,u,f,e){var o,h,c=u.length,s=Kinetic.Util._capitalize,l=n+s(r),a=t+s(r);i.prototype[l]=function(){var n={};for(o=0;c>o;o++)h=u[o],n[h]=this.getAttr(r+s(h));return n};i.prototype[a]=function(n){var t,i=this.attrs[r];f&&(n=f.call(this,n));for(t in n)this._setAttr(r+s(t),n[t]);return this._fireChangeEvent(r,i,n),e&&e.call(this),this};this.addOverloadedGetterSetter(i,r)},addOverloadedGetterSetter:function(i,r){var u=Kinetic.Util._capitalize(r),f=t+u,e=n+u;i.prototype[r]=function(){return arguments.length?(this[f](arguments[0]),this):this[e]()}},backCompat:function(n,t){for(var i in t)n.prototype[i]=n.prototype[t[i]]},afterSetFilter:function(){this._filterUpToDate=!1}};Kinetic.Validators={RGBComponent:function(n){return n>255?255:0>n?0:Math.round(n)},alphaComponent:function(n){return n>1?1:.0001>n?.0001:n}}}(),function(){var i="absoluteOpacity",n="absoluteTransform",l="Change",a="children",e=".",v="",y="get",p="id",w="kinetic",r="listening",b="mouseenter",k="mouseleave",d="name",o="set",s="Shape",u=" ",h="stage",t="transform",g="Stage",f="visible",c=["id"],nt=["xChange.kinetic","yChange.kinetic","scaleXChange.kinetic","scaleYChange.kinetic","skewXChange.kinetic","skewYChange.kinetic","rotationChange.kinetic","offsetXChange.kinetic","offsetYChange.kinetic","transformsEnabledChange.kinetic"].join(u);Kinetic.Util.addMethods(Kinetic.Node,{_init:function(u){var e=this;this._id=Kinetic.idCounter++;this.eventListeners={};this.attrs={};this._cache={};this._filterUpToDate=!1;this.setAttrs(u);this.on(nt,function(){this._clearCache(t);e._clearSelfAndDescendantCache(n)});this.on("visibleChange.kinetic",function(){e._clearSelfAndDescendantCache(f)});this.on("listeningChange.kinetic",function(){e._clearSelfAndDescendantCache(r)});this.on("opacityChange.kinetic",function(){e._clearSelfAndDescendantCache(i)})},_clearCache:function(n){n?delete this._cache[n]:this._cache={}},_getCache:function(n,t){var i=this._cache[n];return void 0===i&&(this._cache[n]=t.call(this)),this._cache[n]},_clearSelfAndDescendantCache:function(n){this._clearCache(n);this.children&&this.getChildren().each(function(t){t._clearSelfAndDescendantCache(n)})},clearCache:function(){return delete this._cache.canvas,this._filterUpToDate=!1,this},cache:function(n){var i=n||{},s=i.x||0,h=i.y||0,r=i.width||this.width(),u=i.height||this.height(),c=i.drawBorder||!1;if(this.getLayer(),0===r||0===u)return void Kinetic.Util.warn("Width or height of caching configuration equals 0. Cache is ignored.");var e=new Kinetic.SceneCanvas({pixelRatio:1,width:r,height:u}),l=new Kinetic.SceneCanvas({pixelRatio:1,width:r,height:u}),o=new Kinetic.HitCanvas({width:r,height:u}),t=(this.transformsEnabled(),this.x(),this.y(),e.getContext()),f=o.getContext();return this.clearCache(),t.save(),f.save(),c&&(t.save(),t.beginPath(),t.rect(0,0,r,u),t.closePath(),t.setAttr("strokeStyle","red"),t.setAttr("lineWidth",5),t.stroke(),t.restore()),t.translate(-1*s,-1*h),f.translate(-1*s,-1*h),"Shape"===this.nodeType&&(t.translate(-1*this.x(),-1*this.y()),f.translate(-1*this.x(),-1*this.y())),this.drawScene(e,this),this.drawHit(o,this),t.restore(),f.restore(),this._cache.canvas={scene:e,filter:l,hit:o},this},_drawCachedSceneCanvas:function(n){n.save();this.getLayer()._applyTransform(this,n);n.drawImage(this._getCachedSceneCanvas()._canvas,0,0);n.restore()},_getCachedSceneCanvas:function(){var f,r,n,e,u=this.filters(),o=this._cache.canvas,s=o.scene,t=o.filter,i=t.getContext();if(u){if(!this._filterUpToDate){try{for(f=u.length,i.clear(),i.drawImage(s._canvas,0,0),r=i.getImageData(0,0,t.getWidth(),t.getHeight()),n=0;f>n;n++)e=u[n],e.call(this,r),i.putImageData(r,0,0)}catch(h){Kinetic.Util.warn("Unable to apply filter. "+h.message)}this._filterUpToDate=!0}return t}return s},_drawCachedHitCanvas:function(n){var t=this._cache.canvas,i=t.hit;n.save();this.getLayer()._applyTransform(this,n);n.drawImage(i._canvas,0,0);n.restore()},on:function(n,t){for(var o,f,r,s,h=n.split(u),c=h.length,i=0;c>i;i++)o=h[i],f=o.split(e),r=f[0],s=f[1]||v,this.eventListeners[r]||(this.eventListeners[r]=[]),this.eventListeners[r].push({name:s,handler:t});return this},off:function(n){for(var o,s,r,i,f,h=n.split(u),c=h.length,t=0;c>t;t++)if(s=h[t],r=s.split(e),i=r[0],f=r[1],i)this.eventListeners[i]&&this._off(i,f);else for(o in this.eventListeners)this._off(o,f);return this},dispatchEvent:function(n){var t={target:this,type:n.type,evt:n};this.fire(n.type,t)},addEventListener:function(n,t){this.on(n,function(n){t.call(this,n.evt)})},remove:function(){var t=this.getParent();return t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),delete this.parent),this._clearSelfAndDescendantCache(h),this._clearSelfAndDescendantCache(n),this._clearSelfAndDescendantCache(f),this._clearSelfAndDescendantCache(r),this._clearSelfAndDescendantCache(i),this},destroy:function(){Kinetic._removeId(this.getId());Kinetic._removeName(this.getName(),this._id);this.remove()},getAttr:function(n){var t=y+Kinetic.Util._capitalize(n);return Kinetic.Util._isFunction(this[t])?this[t]():this.attrs[n]},getAncestors:function(){for(var n=this.getParent(),t=new Kinetic.Collection;n;)t.push(n),n=n.getParent();return t},getAttrs:function(){return this.attrs||{}},setAttrs:function(n){var t,i;if(n)for(t in n)t===a||(i=o+Kinetic.Util._capitalize(t),Kinetic.Util._isFunction(this[i])?this[i](n[t]):this._setAttr(t,n[t]));return this},isListening:function(){return this._getCache(r,this._isListening)},_isListening:function(){var n=this.getListening(),t=this.getParent();return"inherit"===n?t?t.isListening():!0:n},isVisible:function(){return this._getCache(f,this._isVisible)},_isVisible:function(){var n=this.getVisible(),t=this.getParent();return"inherit"===n?t?t.isVisible():!0:n},shouldDrawHit:function(){var n=this.getLayer();return n&&n.hitGraphEnabled()&&this.isListening()&&this.isVisible()&&!Kinetic.isDragging()},show:function(){return this.setVisible(!0),this},hide:function(){return this.setVisible(!1),this},getZIndex:function(){return this.index||0},getAbsoluteZIndex:function(){function f(h){for(n=[],r=h.length,t=0;r>t;t++)i=h[t],e++,i.nodeType!==s&&(n=n.concat(i.getChildren().toArray())),i._id===u._id&&(t=r);n.length>0&&n[0].getDepth()<=o&&f(n)}var n,r,t,i,o=this.getDepth(),u=this,e=0;return u.nodeType!==g&&f(u.getStage().getChildren()),e},getDepth:function(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t},setPosition:function(n){return this.setX(n.x),this.setY(n.y),this},getPosition:function(){return{x:this.getX(),y:this.getY()}},getAbsolutePosition:function(){var i=this.getAbsoluteTransform().getMatrix(),n=new Kinetic.Transform,t=this.offset();return n.m=i.slice(),n.translate(t.x,t.y),n.getTranslation()},setAbsolutePosition:function(n){var t,i=this._clearTransform();return this.attrs.x=i.x,this.attrs.y=i.y,delete i.x,delete i.y,t=this.getAbsoluteTransform(),t.invert(),t.translate(n.x,n.y),n={x:this.attrs.x+t.getTranslation().x,y:this.attrs.y+t.getTranslation().y},this.setPosition({x:n.x,y:n.y}),this._setTransform(i),this},_setTransform:function(i){for(var r in i)this.attrs[r]=i[r];this._clearCache(t);this._clearSelfAndDescendantCache(n)},_clearTransform:function(){var i={x:this.getX(),y:this.getY(),rotation:this.getRotation(),scaleX:this.getScaleX(),scaleY:this.getScaleY(),offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),skewX:this.getSkewX(),skewY:this.getSkewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,this._clearCache(t),this._clearSelfAndDescendantCache(n),i},move:function(n){var t=n.x,i=n.y,r=this.getX(),u=this.getY();return void 0!==t&&(r+=t),void 0!==i&&(u+=i),this.setPosition({x:r,y:u}),this},_eachAncestorReverse:function(n,t){var f,r,u=[],i=this.getParent();if(t&&t._id===this._id)return n(this),!0;for(u.unshift(this);i&&(!t||i._id!==t._id);)u.unshift(i),i=i.parent;for(f=u.length,r=0;f>r;r++)n(u[r])},rotate:function(n){return this.setRotation(this.getRotation()+n),this},moveToTop:function(){if(!this.parent)return void Kinetic.Util.warn("Node has no parent. moveToTop function is ignored.");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0},moveUp:function(){if(!this.parent)return void Kinetic.Util.warn("Node has no parent. moveUp function is ignored.");var n=this.index,t=this.parent.getChildren().length;return t-1>n?(this.parent.children.splice(n,1),this.parent.children.splice(n+1,0,this),this.parent._setChildrenIndices(),!0):!1},moveDown:function(){if(!this.parent)return void Kinetic.Util.warn("Node has no parent. moveDown function is ignored.");var n=this.index;return n>0?(this.parent.children.splice(n,1),this.parent.children.splice(n-1,0,this),this.parent._setChildrenIndices(),!0):!1},moveToBottom:function(){if(!this.parent)return void Kinetic.Util.warn("Node has no parent. moveToBottom function is ignored.");var n=this.index;return n>0?(this.parent.children.splice(n,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1},setZIndex:function(n){if(!this.parent)return void Kinetic.Util.warn("Node has no parent. zIndex parameter is ignored.");var t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(n,0,this),this.parent._setChildrenIndices(),this},getAbsoluteOpacity:function(){return this._getCache(i,this._getAbsoluteOpacity)},_getAbsoluteOpacity:function(){var n=this.getOpacity();return this.getParent()&&(n*=this.getParent().getAbsoluteOpacity()),n},moveTo:function(n){return Kinetic.Node.prototype.remove.call(this),n.add(this),this},toObject:function(){var t,n,f,e,i=Kinetic.Util,r={},u=this.getAttrs();r.attrs={};for(t in u)n=u[t],i._isFunction(n)||i._isElement(n)||i._isObject(n)&&i._hasMethods(n)||(f=this[t],delete u[t],e=f?f.call(this):null,u[t]=n,e!==n&&(r.attrs[t]=n));return r.className=this.getClassName(),r},toJSON:function(){return JSON.stringify(this.toObject())},getParent:function(){return this.parent},getLayer:function(){var n=this.getParent();return n?n.getLayer():null},getStage:function(){return this._getCache(h,this._getStage)},_getStage:function(){var n=this.getParent();if(n)return n.getStage()},fire:function(n,t,i){return i?this._fireAndBubble(n,t||{}):this._fire(n,t||{}),this},getAbsoluteTransform:function(t){return t?this._getAbsoluteTransform(t):this._getCache(n,this._getAbsoluteTransform)},_getAbsoluteTransform:function(n){var t,r,i=new Kinetic.Transform;return this._eachAncestorReverse(function(n){t=n.transformsEnabled();r=n.getTransform();"all"===t?i.multiply(r):"position"===t&&i.translate(n.x(),n.y())},n),i},getTransform:function(){return this._getCache(t,this._getTransform)},_getTransform:function(){var n=new Kinetic.Transform,t=this.getX(),i=this.getY(),r=Kinetic.getAngle(this.getRotation()),u=this.getScaleX(),f=this.getScaleY(),e=this.getSkewX(),o=this.getSkewY(),s=this.getOffsetX(),h=this.getOffsetY();return(0!==t||0!==i)&&n.translate(t,i),0!==r&&n.rotate(r),(0!==e||0!==o)&&n.skew(e,o),(1!==u||1!==f)&&n.scale(u,f),(0!==s||0!==h)&&n.translate(-1*s,-1*h),n},clone:function(n){var t,u,o,r,f,l=this.getClassName(),e=Kinetic.Util.cloneObject(this.attrs),s,h,i;for(s in c)h=c[s],delete e[h];for(t in n)e[t]=n[t];i=new Kinetic[l](e);for(t in this.eventListeners)for(u=this.eventListeners[t],o=u.length,r=0;o>r;r++)f=u[r],f.name.indexOf(w)<0&&(i.eventListeners[t]||(i.eventListeners[t]=[]),i.eventListeners[t].push(f));return i},toDataURL:function(n){n=n||{};var e=n.mimeType||null,o=n.quality||null,t=this.getStage(),u=n.x||0,f=n.y||0,i=new Kinetic.SceneCanvas({width:n.width||this.getWidth()||(t?t.getWidth():0),height:n.height||this.getHeight()||(t?t.getHeight():0),pixelRatio:1}),r=i.getContext();return r.save(),(u||f)&&r.translate(-1*u,-1*f),this.drawScene(i),r.restore(),i.toDataURL(e,o)},toImage:function(n){Kinetic.Util._getImage(this.toDataURL(n),function(t){n.callback(t)})},setSize:function(n){return this.setWidth(n.width),this.setHeight(n.height),this},getSize:function(){return{width:this.getWidth(),height:this.getHeight()}},getWidth:function(){return this.attrs.width||0},getHeight:function(){return this.attrs.height||0},getClassName:function(){return this.className||this.nodeType},getType:function(){return this.nodeType},getDragDistance:function(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Kinetic.dragDistance},_get:function(n){return this.nodeType===n?[this]:[]},_off:function(n,t){for(var u,r=this.eventListeners[n],i=0;i<r.length;i++)if(u=r[i].name,!("kinetic"===u&&"kinetic"!==t||t&&u!==t)){if(r.splice(i,1),0===r.length){delete this.eventListeners[n];break}i--}},_fireChangeEvent:function(n,t,i){this._fire(n+l,{oldVal:t,newVal:i})},setId:function(n){var t=this.getId();return Kinetic._removeId(t),Kinetic._addId(this,n),this._setAttr(p,n),this},setName:function(n){var t=this.getName();return Kinetic._removeName(t,this._id),Kinetic._addName(this,n),this._setAttr(d,n),this},setAttr:function(){var n=Array.prototype.slice.call(arguments),t=n[0],i=n[1],u=o+Kinetic.Util._capitalize(t),r=this[u];return Kinetic.Util._isFunction(r)?r.call(this,i):this._setAttr(t,i),this},_setAttr:function(n,t){var i;void 0!==t&&(i=this.attrs[n],this.attrs[n]=t,this._fireChangeEvent(n,i,t))},_setComponentAttr:function(n,t,i){var r;void 0!==i&&(r=this.attrs[n],r||(this.attrs[n]=this.getAttr(n)),this.attrs[n][t]=i,this._fireChangeEvent(n,r,i))},_fireAndBubble:function(n,t,i){var r=!0;t&&this.nodeType===s&&(t.target=this);n===b&&i&&this._id===i._id?r=!1:n===k&&i&&this._id===i._id&&(r=!1);r&&(this._fire(n,t),t&&!t.cancelBubble&&this.parent&&(i&&i.parent?this._fireAndBubble.call(this.parent,n,t,i.parent):this._fireAndBubble.call(this.parent,n,t)))},_fire:function(n,t){var i,r=this.eventListeners[n];if(t.type=n,r)for(i=0;i<r.length;i++)r[i].handler.call(this,t)},draw:function(){return this.drawScene(),this.drawHit(),this}});Kinetic.Node.create=function(n,t){return this._createNode(JSON.parse(n),t)};Kinetic.Node._createNode=function(n,t){var r,f,i,e=Kinetic.Node.prototype.getClassName.call(n),u=n.children;if(t&&(n.attrs.container=t),r=new Kinetic[e](n.attrs),u)for(f=u.length,i=0;f>i;i++)r.add(this._createNode(u[i]));return r};Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,"position");Kinetic.Factory.addGetterSetter(Kinetic.Node,"x",0);Kinetic.Factory.addGetterSetter(Kinetic.Node,"y",0);Kinetic.Factory.addGetterSetter(Kinetic.Node,"opacity",1);Kinetic.Factory.addGetter(Kinetic.Node,"name");Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,"name");Kinetic.Factory.addGetter(Kinetic.Node,"id");Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,"id");Kinetic.Factory.addGetterSetter(Kinetic.Node,"rotation",0);Kinetic.Factory.addComponentsGetterSetter(Kinetic.Node,"scale",["x","y"]);Kinetic.Factory.addGetterSetter(Kinetic.Node,"scaleX",1);Kinetic.Factory.addGetterSetter(Kinetic.Node,"scaleY",1);Kinetic.Factory.addComponentsGetterSetter(Kinetic.Node,"skew",["x","y"]);Kinetic.Factory.addGetterSetter(Kinetic.Node,"skewX",0);Kinetic.Factory.addGetterSetter(Kinetic.Node,"skewY",0);Kinetic.Factory.addComponentsGetterSetter(Kinetic.Node,"offset",["x","y"]);Kinetic.Factory.addGetterSetter(Kinetic.Node,"offsetX",0);Kinetic.Factory.addGetterSetter(Kinetic.Node,"offsetY",0);Kinetic.Factory.addSetter(Kinetic.Node,"dragDistance");Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,"dragDistance");Kinetic.Factory.addSetter(Kinetic.Node,"width",0);Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,"width");Kinetic.Factory.addSetter(Kinetic.Node,"height",0);Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,"height");Kinetic.Factory.addGetterSetter(Kinetic.Node,"listening","inherit");Kinetic.Factory.addGetterSetter(Kinetic.Node,"filters",void 0,function(n){return this._filterUpToDate=!1,n});Kinetic.Factory.addGetterSetter(Kinetic.Node,"visible","inherit");Kinetic.Factory.addGetterSetter(Kinetic.Node,"transformsEnabled","all");Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,"size");Kinetic.Factory.backCompat(Kinetic.Node,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});Kinetic.Collection.mapMethods(Kinetic.Node)}(),function(){Kinetic.Filters.Grayscale=function(n){for(var r,i=n.data,u=i.length,t=0;u>t;t+=4)r=.34*i[t]+.5*i[t+1]+.16*i[t+2],i[t]=r,i[t+1]=r,i[t+2]=r}}(),function(){Kinetic.Filters.Brighten=function(n){for(var r=255*this.brightness(),i=n.data,u=i.length,t=0;u>t;t+=4)i[t]+=r,i[t+1]+=r,i[t+2]+=r};Kinetic.Factory.addGetterSetter(Kinetic.Node,"brightness",0,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.Invert=function(n){for(var i=n.data,r=i.length,t=0;r>t;t+=4)i[t]=255-i[t],i[t+1]=255-i[t+1],i[t+2]=255-i[t+2]}}(),function(){function n(){this.r=0;this.g=0;this.b=0;this.a=0;this.next=null}function t(t,u){for(var nt,yt,s,bt,h,kt,b,k,d,g,ft,et,ot,st,tt,it,rt,ut,v,y,p,o,ht,f=t.data,ct=t.width,dt=t.height,ti=u+u+1,wt=ct-1,gt=dt-1,a=u+1,lt=a*(a+1)/2,pt=new n,ni=null,e=pt,c=null,w=null,at=i[u],vt=r[u],l=1;ti>l;l++)e=e.next=new n,l==a&&(ni=e);for(e.next=pt,kt=h=0,yt=0;dt>yt;yt++){for(tt=it=rt=ut=b=k=d=g=0,ft=a*(v=f[h]),et=a*(y=f[h+1]),ot=a*(p=f[h+2]),st=a*(o=f[h+3]),b+=lt*v,k+=lt*y,d+=lt*p,g+=lt*o,e=pt,l=0;a>l;l++)e.r=v,e.g=y,e.b=p,e.a=o,e=e.next;for(l=1;a>l;l++)s=h+((l>wt?wt:l)<<2),b+=(e.r=v=f[s])*(ht=a-l),k+=(e.g=y=f[s+1])*ht,d+=(e.b=p=f[s+2])*ht,g+=(e.a=o=f[s+3])*ht,tt+=v,it+=y,rt+=p,ut+=o,e=e.next;for(c=pt,w=ni,nt=0;ct>nt;nt++)f[h+3]=o=g*at>>vt,0!==o?(o=255/o,f[h]=(b*at>>vt)*o,f[h+1]=(k*at>>vt)*o,f[h+2]=(d*at>>vt)*o):f[h]=f[h+1]=f[h+2]=0,b-=ft,k-=et,d-=ot,g-=st,ft-=c.r,et-=c.g,ot-=c.b,st-=c.a,s=kt+((s=nt+u+1)<wt?s:wt)<<2,tt+=c.r=f[s],it+=c.g=f[s+1],rt+=c.b=f[s+2],ut+=c.a=f[s+3],b+=tt,k+=it,d+=rt,g+=ut,c=c.next,ft+=v=w.r,et+=y=w.g,ot+=p=w.b,st+=o=w.a,tt-=v,it-=y,rt-=p,ut-=o,w=w.next,h+=4;kt+=ct}for(nt=0;ct>nt;nt++){for(it=rt=ut=tt=k=d=g=b=0,h=nt<<2,ft=a*(v=f[h]),et=a*(y=f[h+1]),ot=a*(p=f[h+2]),st=a*(o=f[h+3]),b+=lt*v,k+=lt*y,d+=lt*p,g+=lt*o,e=pt,l=0;a>l;l++)e.r=v,e.g=y,e.b=p,e.a=o,e=e.next;for(bt=ct,l=1;u>=l;l++)h=bt+nt<<2,b+=(e.r=v=f[h])*(ht=a-l),k+=(e.g=y=f[h+1])*ht,d+=(e.b=p=f[h+2])*ht,g+=(e.a=o=f[h+3])*ht,tt+=v,it+=y,rt+=p,ut+=o,e=e.next,gt>l&&(bt+=ct);for(h=nt,c=pt,w=ni,yt=0;dt>yt;yt++)s=h<<2,f[s+3]=o=g*at>>vt,o>0?(o=255/o,f[s]=(b*at>>vt)*o,f[s+1]=(k*at>>vt)*o,f[s+2]=(d*at>>vt)*o):f[s]=f[s+1]=f[s+2]=0,b-=ft,k-=et,d-=ot,g-=st,ft-=c.r,et-=c.g,ot-=c.b,st-=c.a,s=nt+((s=yt+a)<gt?s:gt)*ct<<2,b+=tt+=c.r=f[s],k+=it+=c.g=f[s+1],d+=rt+=c.b=f[s+2],g+=ut+=c.a=f[s+3],c=c.next,ft+=v=w.r,et+=y=w.g,ot+=p=w.b,st+=o=w.a,tt-=v,it-=y,rt-=p,ut-=o,w=w.next,h+=ct}}var i=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],r=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];Kinetic.Filters.Blur=function(n){var i=Math.round(this.blurRadius());i>0&&t(n,i)};Kinetic.Factory.addGetterSetter(Kinetic.Node,"blurRadius",0,null,Kinetic.Factory.afterSetFilter)}(),function(){function t(n,t,i){var r=4*(i*n.width+t),u=[];return u.push(n.data[r++],n.data[r++],n.data[r++],n.data[r++]),u}function n(n,t){return Math.sqrt(Math.pow(n[0]-t[0],2)+Math.pow(n[1]-t[1],2)+Math.pow(n[2]-t[2],2))}function i(n){for(var t=[0,0,0],i=0;i<n.length;i++)t[0]+=n[i][0],t[1]+=n[i][1],t[2]+=n[i][2];return t[0]/=n.length,t[1]/=n.length,t[2]/=n.length,t}function r(r,u){var o=t(r,0,0),s=t(r,r.width-1,0),h=t(r,0,r.height-1),c=t(r,r.width-1,r.height-1),e=u||10,a;if(n(o,s)<e&&n(s,c)<e&&n(c,h)<e&&n(h,o)<e){for(var v=i([s,o,c,h]),l=[],f=0;f<r.width*r.height;f++)a=n(v,[r.data[4*f],r.data[4*f+1],r.data[4*f+2]]),l[f]=e>a?0:255;return l}}function u(n,t){for(var i=0;i<n.width*n.height;i++)n.data[4*i+3]=t[i]}function f(n,t,i){for(var r,u,s,h,y,p,c=[1,1,1,1,0,1,1,1,1],f=Math.round(Math.sqrt(c.length)),l=Math.floor(f/2),a=[],e=0;i>e;e++)for(r=0;t>r;r++){for(var w=e*t+r,v=0,o=0;f>o;o++)for(u=0;f>u;u++)s=e+o-l,h=r+u-l,s>=0&&i>s&&h>=0&&t>h&&(y=s*t+h,p=c[o*f+u],v+=n[y]*p);a[w]=2040===v?255:0}return a}function e(n,t,i){for(var r,u,s,h,y,p,c=[1,1,1,1,1,1,1,1,1],f=Math.round(Math.sqrt(c.length)),l=Math.floor(f/2),a=[],e=0;i>e;e++)for(r=0;t>r;r++){for(var w=e*t+r,v=0,o=0;f>o;o++)for(u=0;f>u;u++)s=e+o-l,h=r+u-l,s>=0&&i>s&&h>=0&&t>h&&(y=s*t+h,p=c[o*f+u],v+=n[y]*p);a[w]=v>=1020?255:0}return a}function o(n,t,i){for(var r,u,s,h,y,p,c=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],f=Math.round(Math.sqrt(c.length)),l=Math.floor(f/2),a=[],e=0;i>e;e++)for(r=0;t>r;r++){for(var w=e*t+r,v=0,o=0;f>o;o++)for(u=0;f>u;u++)s=e+o-l,h=r+u-l,s>=0&&i>s&&h>=0&&t>h&&(y=s*t+h,p=c[o*f+u],v+=n[y]*p);a[w]=v}return a}Kinetic.Filters.Mask=function(n){var i=this.threshold(),t=r(n,i);return t&&(t=f(t,n.width,n.height),t=e(t,n.width,n.height),t=o(t,n.width,n.height),u(n,t)),n};Kinetic.Factory.addGetterSetter(Kinetic.Node,"threshold",0,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.RGB=function(n){for(var r,i=n.data,u=i.length,f=this.red(),e=this.green(),o=this.blue(),t=0;u>t;t+=4)r=(.34*i[t]+.5*i[t+1]+.16*i[t+2])/255,i[t]=r*f,i[t+1]=r*e,i[t+2]=r*o,i[t+3]=i[t+3]};Kinetic.Factory.addGetterSetter(Kinetic.Node,"red",0,function(n){return this._filterUpToDate=!1,n>255?255:0>n?0:Math.round(n)});Kinetic.Factory.addGetterSetter(Kinetic.Node,"green",0,function(n){return this._filterUpToDate=!1,n>255?255:0>n?0:Math.round(n)});Kinetic.Factory.addGetterSetter(Kinetic.Node,"blue",0,Kinetic.Validators.RGBComponent,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.HSV=function(n){for(var e,o,s,h,r=n.data,a=r.length,i=Math.pow(2,this.value()),c=Math.pow(2,this.saturation()),l=Math.abs(this.hue()+360)%360,u=i*c*Math.cos(l*Math.PI/180),f=i*c*Math.sin(l*Math.PI/180),v=.299*i+.701*u+.167*f,y=.587*i-.587*u+.33*f,p=.114*i-.114*u-.497*f,w=.299*i-.299*u-.328*f,b=.587*i+.413*u+.035*f,k=.114*i-.114*u+.293*f,d=.299*i-.3*u+1.25*f,g=.587*i-.586*u-1.05*f,nt=.114*i+.886*u-.2*f,t=0;a>t;t+=4)e=r[t+0],o=r[t+1],s=r[t+2],h=r[t+3],r[t+0]=v*e+y*o+p*s,r[t+1]=w*e+b*o+k*s,r[t+2]=d*e+g*o+nt*s,r[t+3]=h};Kinetic.Factory.addGetterSetter(Kinetic.Node,"hue",0,null,Kinetic.Factory.afterSetFilter);Kinetic.Factory.addGetterSetter(Kinetic.Node,"saturation",0,null,Kinetic.Factory.afterSetFilter);Kinetic.Factory.addGetterSetter(Kinetic.Node,"value",0,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Factory.addGetterSetter(Kinetic.Node,"hue",0,null,Kinetic.Factory.afterSetFilter);Kinetic.Factory.addGetterSetter(Kinetic.Node,"saturation",0,null,Kinetic.Factory.afterSetFilter);Kinetic.Factory.addGetterSetter(Kinetic.Node,"luminance",0,null,Kinetic.Factory.afterSetFilter);Kinetic.Filters.HSL=function(n){for(var e,o,s,c,r=n.data,v=r.length,i=1,l=Math.pow(2,this.saturation()),a=Math.abs(this.hue()+360)%360,h=127*this.luminance(),u=i*l*Math.cos(a*Math.PI/180),f=i*l*Math.sin(a*Math.PI/180),y=.299*i+.701*u+.167*f,p=.587*i-.587*u+.33*f,w=.114*i-.114*u-.497*f,b=.299*i-.299*u-.328*f,k=.587*i+.413*u+.035*f,d=.114*i-.114*u+.293*f,g=.299*i-.3*u+1.25*f,nt=.587*i-.586*u-1.05*f,tt=.114*i+.886*u-.2*f,t=0;v>t;t+=4)e=r[t+0],o=r[t+1],s=r[t+2],c=r[t+3],r[t+0]=y*e+p*o+w*s+h,r[t+1]=b*e+k*o+d*s+h,r[t+2]=g*e+nt*o+tt*s+h,r[t+3]=c}}(),function(){Kinetic.Filters.Emboss=function(n){var tt=10*this.embossStrength(),it=255*this.embossWhiteLevel(),rt=this.embossDirection(),ut=this.embossBlend(),u=0,f=0,t=n.data,l=n.width,k=n.height,ft=4*l,c=k,d,e,g,o,i,s,h;switch(rt){case"top-left":u=-1;f=-1;break;case"top":u=-1;f=0;break;case"top-right":u=-1;f=1;break;case"right":u=0;f=1;break;case"bottom-right":u=1;f=1;break;case"bottom":u=1;f=0;break;case"bottom-left":u=1;f=-1;break;case"left":u=0;f=-1}do{d=(c-1)*ft;e=u;1>c+e&&(e=0);c+e>k&&(e=0);g=(c-1+e)*l*4;o=l;do{i=d+4*(o-1);s=f;1>o+s&&(s=0);o+s>l&&(s=0);var y=g+4*(o-1+s),et=t[i]-t[y],a=t[i+1]-t[y+1],v=t[i+2]-t[y+2],r=et,nt=r>0?r:-r,ot=a>0?a:-a,st=v>0?v:-v;if(ot>nt&&(r=a),st>nt&&(r=v),r*=tt,ut){var p=t[i]+r,w=t[i+1]+r,b=t[i+2]+r;t[i]=p>255?255:0>p?0:p;t[i+1]=w>255?255:0>w?0:w;t[i+2]=b>255?255:0>b?0:b}else h=it-r,0>h?h=0:h>255&&(h=255),t[i]=t[i+1]=t[i+2]=h}while(--o)}while(--c)};Kinetic.Factory.addGetterSetter(Kinetic.Node,"embossStrength",.5,null,Kinetic.Factory.afterSetFilter);Kinetic.Factory.addGetterSetter(Kinetic.Node,"embossWhiteLevel",.5,null,Kinetic.Factory.afterSetFilter);Kinetic.Factory.addGetterSetter(Kinetic.Node,"embossDirection","top-left",null,Kinetic.Factory.afterSetFilter);Kinetic.Factory.addGetterSetter(Kinetic.Node,"embossBlend",!1,null,Kinetic.Factory.afterSetFilter)}(),function(){function n(n,t,i,r,u){var f,o=i-t,e=u-r;return 0===o?r+e/2:0===e?r:(f=(n-t)/o,f=e*f+r)}Kinetic.Filters.Enhance=function(t){var v,y,p,r,u=t.data,ft=u.length,f=u[0],s=f,e=u[1],h=e,o=u[2],c=o,l=u[3],a=l,i=this.enhance(),w,b,k,d,g,nt,tt,it,et,rt,ot,ut;if(0!==i){for(r=0;ft>r;r+=4)v=u[r+0],f>v?f=v:v>s&&(s=v),y=u[r+1],e>y?e=y:y>h&&(h=y),p=u[r+2],o>p?o=p:p>c&&(c=p);for(s===f&&(s=255,f=0),h===e&&(h=255,e=0),c===o&&(c=255,o=0),a===l&&(a=255,l=0),i>0?(b=s+i*(255-s),k=f-i*(+f),g=h+i*(255-h),nt=e-i*(+e),it=c+i*(255-c),ut=o-i*(+o),ot=a+i*(255-a),et=l-i*(+l)):(w=.5*(s+f),b=s+i*(s-w),k=f+i*(f-w),d=.5*(h+e),g=h+i*(h-d),nt=e+i*(e-d),tt=.5*(c+o),it=c+i*(c-tt),ut=o+i*(o-tt),rt=.5*(a+l),ot=a+i*(a-rt),et=l+i*(l-rt)),r=0;ft>r;r+=4)u[r+0]=n(u[r+0],f,s,k,b),u[r+1]=n(u[r+1],e,h,nt,g),u[r+2]=n(u[r+2],o,c,ut,it)}};Kinetic.Factory.addGetterSetter(Kinetic.Node,"enhance",0,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.Posterize=function(n){for(var u=Math.round(254*this.levels())+1,i=n.data,f=i.length,r=255/u,t=0;f>t;t+=1)i[t]=Math.floor(i[t]/r)*r};Kinetic.Factory.addGetterSetter(Kinetic.Node,"levels",.5,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.Noise=function(n){for(var u=255*this.noise(),r=n.data,f=r.length,i=u/2,t=0;f>t;t+=4)r[t+0]+=i-2*i*Math.random(),r[t+1]+=i-2*i*Math.random(),r[t+2]+=i-2*i*Math.random()};Kinetic.Factory.addGetterSetter(Kinetic.Node,"noise",.2,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.Pixelate=function(n){var t,i,r,o,s,h,y,c,p,l,w,a,v,f,u=Math.ceil(this.pixelSize()),e=n.width,b=n.height,k=Math.ceil(e/u),d=Math.ceil(b/u);for(n=n.data,a=0;k>a;a+=1)for(v=0;d>v;v+=1){for(o=0,s=0,h=0,y=0,c=a*u,p=c+u,l=v*u,w=l+u,f=0,t=c;p>t;t+=1)if(!(t>=e))for(i=l;w>i;i+=1)i>=b||(r=4*(e*i+t),o+=n[r+0],s+=n[r+1],h+=n[r+2],y+=n[r+3],f+=1);for(o/=f,s/=f,h/=f,t=c;p>t;t+=1)if(!(t>=e))for(i=l;w>i;i+=1)i>=b||(r=4*(e*i+t),n[r+0]=o,n[r+1]=s,n[r+2]=h,n[r+3]=y)}};Kinetic.Factory.addGetterSetter(Kinetic.Node,"pixelSize",8,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.Threshold=function(n){for(var r=255*this.threshold(),i=n.data,u=i.length,t=0;u>t;t+=1)i[t]=i[t]<r?0:255};Kinetic.Factory.addGetterSetter(Kinetic.Node,"threshold",.5,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.Sepia=function(n){var c,e,t,r,u,f,o,s,h,i=n.data,l=n.width,a=n.height,v=4*l;do{c=(a-1)*v;e=l;do t=c+4*(e-1),r=i[t],u=i[t+1],f=i[t+2],o=.393*r+.769*u+.189*f,s=.349*r+.686*u+.168*f,h=.272*r+.534*u+.131*f,i[t]=o>255?255:o,i[t+1]=s>255?255:s,i[t+2]=h>255?255:h,i[t+3]=i[t+3];while(--e)}while(--a)}}(),function(){Kinetic.Filters.Solarize=function(n){var t=n.data,o=n.width,c=n.height,l=4*o,s=c,h,e;do{h=(s-1)*l;e=o;do{var i=h+4*(e-1),r=t[i],u=t[i+1],f=t[i+2];r>127&&(r=255-r);u>127&&(u=255-u);f>127&&(f=255-f);t[i]=r;t[i+1]=u;t[i+2]=f}while(--e)}while(--s)}}(),function(){var t=function(n,t,i){var r,e,o,y,c=n.data,l=t.data,s=n.width,p=n.height,a=i.polarCenterX||s/2,v=i.polarCenterY||p/2,b=0,k=0,d=0,g=0,h=Math.sqrt(a*a+v*v);e=s-a;o=p-v;y=Math.sqrt(e*e+o*o);h=y>h?y:h;for(var u,nt,tt,w=p,it=s,rt=360/it*Math.PI/180,f=0;it>f;f+=1)for(nt=Math.sin(f*rt),tt=Math.cos(f*rt),u=0;w>u;u+=1)e=Math.floor(a+h*u/w*tt),o=Math.floor(v+h*u/w*nt),r=4*(o*s+e),b=c[r+0],k=c[r+1],d=c[r+2],g=c[r+3],r=4*(f+u*s),l[r+0]=b,l[r+1]=k,l[r+2]=d,l[r+3]=g},i=function(n,t,i){var r,u,f,o,s,w,h=n.data,c=t.data,e=n.width,l=n.height,a=i.polarCenterX||e/2,v=i.polarCenterY||l/2,b=0,k=0,d=0,g=0,y=Math.sqrt(a*a+v*v);u=e-a;f=l-v;w=Math.sqrt(u*u+f*f);y=w>y?w:y;var nt,p,tt,it,rt=l,ut=e,ft=i.polarRotation||0;for(u=0;e>u;u+=1)for(f=0;l>f;f+=1)o=u-a,s=f-v,nt=Math.sqrt(o*o+s*s)*rt/y,p=(180*Math.atan2(s,o)/Math.PI+360+ft)%360,p=p*ut/360,tt=Math.floor(p),it=Math.floor(nt),r=4*(it*e+tt),b=h[r+0],k=h[r+1],d=h[r+2],g=h[r+3],r=4*(f*e+u),c[r+0]=b,c[r+1]=k,c[r+2]=d,c[r+3]=g},n=Kinetic.Util.createCanvasElement();Kinetic.Filters.Kaleidoscope=function(r){var e,o,d,k,v,y,p,w,s,h,f=r.width,a=r.height,b=Math.round(this.kaleidoscopePower()),rt=Math.round(this.kaleidoscopeAngle()),g=Math.floor(f*(rt%360)/360),u,c;if(!(1>b)){for(n.width=f,n.height=a,u=n.getContext("2d").getImageData(0,0,f,a),t(r,u,{polarCenterX:f/2,polarCenterY:a/2}),c=f/Math.pow(2,b);8>=c;)c=2*c,b-=1;c=Math.ceil(c);var l=c,nt=0,tt=l,it=1;for(g+c>f&&(nt=l,tt=0,it=-1),o=0;a>o;o+=1)for(e=nt;e!==tt;e+=it)d=Math.round(e+g)%f,s=4*(f*o+d),v=u.data[s+0],y=u.data[s+1],p=u.data[s+2],w=u.data[s+3],h=4*(f*o+e),u.data[h+0]=v,u.data[h+1]=y,u.data[h+2]=p,u.data[h+3]=w;for(o=0;a>o;o+=1)for(l=Math.floor(c),k=0;b>k;k+=1){for(e=0;l+1>e;e+=1)s=4*(f*o+e),v=u.data[s+0],y=u.data[s+1],p=u.data[s+2],w=u.data[s+3],h=4*(f*o+2*l-e-1),u.data[h+0]=v,u.data[h+1]=y,u.data[h+2]=p,u.data[h+3]=w;l*=2}i(u,r,{polarRotation:0})}};Kinetic.Factory.addGetterSetter(Kinetic.Node,"kaleidoscopePower",2,null,Kinetic.Factory.afterSetFilter);Kinetic.Factory.addGetterSetter(Kinetic.Node,"kaleidoscopeAngle",0,null,Kinetic.Factory.afterSetFilter)}(),function(){function i(n){Kinetic.root.setTimeout(n,1e3/60)}function r(){return f.apply(Kinetic.root,arguments)}var u=500,n=function(){return Kinetic.root.performance&&Kinetic.root.performance.now?function(){return Kinetic.root.performance.now()}:function(){return(new Date).getTime()}}(),f=function(){return Kinetic.root.requestAnimationFrame||Kinetic.root.webkitRequestAnimationFrame||Kinetic.root.mozRequestAnimationFrame||Kinetic.root.oRequestAnimationFrame||Kinetic.root.msRequestAnimationFrame||i}(),t;Kinetic.Animation=function(t,i){var r=Kinetic.Animation;this.func=t;this.setLayers(i);this.id=r.animIdCounter++;this.frame={time:0,timeDiff:0,lastTime:n()}};Kinetic.Animation.prototype={setLayers:function(n){var t=[];t=n?n.length>0?n:[n]:[];this.layers=t},getLayers:function(){return this.layers},addLayer:function(n){var r,t,i=this.layers;if(i){for(r=i.length,t=0;r>t;t++)if(i[t]._id===n._id)return!1}else this.layers=[];return this.layers.push(n),!0},isRunning:function(){for(var i=Kinetic.Animation,t=i.animations,r=t.length,n=0;r>n;n++)if(t[n].id===this.id)return!0;return!1},start:function(){var t=Kinetic.Animation;this.stop();this.frame.timeDiff=0;this.frame.lastTime=n();t._addAnimation(this)},stop:function(){Kinetic.Animation._removeAnimation(this)},_updateFrameObject:function(n){this.frame.timeDiff=n-this.frame.lastTime;this.frame.lastTime=n;this.frame.time+=this.frame.timeDiff;this.frame.frameRate=1e3/this.frame.timeDiff}};Kinetic.Animation.animations=[];Kinetic.Animation.animIdCounter=0;Kinetic.Animation.animRunning=!1;Kinetic.Animation._addAnimation=function(n){this.animations.push(n);this._handleAnimation()};Kinetic.Animation._removeAnimation=function(n){for(var r=n.id,i=this.animations,u=i.length,t=0;u>t;t++)if(i[t].id===r){this.animations.splice(t,1);break}};Kinetic.Animation._runFrames=function(){for(var t,f,e,r,s,u,h,o={},c=this.animations,i=0;i<c.length;i++){for(t=c[i],f=t.layers,e=t.func,t._updateFrameObject(n()),s=f.length,r=0;s>r;r++)u=f[r],void 0!==u._id&&(o[u._id]=u);e&&e.call(t,t.frame)}for(h in o)o[h].draw()};Kinetic.Animation._animationLoop=function(){var n=Kinetic.Animation;n.animations.length?(r(n._animationLoop),n._runFrames()):n.animRunning=!1};Kinetic.Animation._handleAnimation=function(){var n=this;this.animRunning||(this.animRunning=!0,n._animationLoop())};t=Kinetic.Node.prototype.moveTo;Kinetic.Node.prototype.moveTo=function(n){t.call(this,n)};Kinetic.Layer.prototype.batchDraw=function(){var t=this,i=Kinetic.Animation;this.batchAnim||(this.batchAnim=new i(function(){t.lastBatchDrawTime&&n()-t.lastBatchDrawTime>u&&t.batchAnim.stop()},this));this.lastBatchDrawTime=n();this.batchAnim.isRunning()||(this.draw(),this.batchAnim.start())};Kinetic.Stage.prototype.batchDraw=function(){this.getChildren().each(function(n){n.batchDraw()})}}(eval("this")),function(){var r={node:1,duration:1,easing:1,onFinish:1,yoyo:1},u=1,t=2,i=3,f=0,n;Kinetic.Tween=function(t){var u,o=this,e=t.node,i=e._id,s=t.duration||1,h=t.easing||Kinetic.Easings.Linear,c=!!t.yoyo;this.node=e;this._id=f++;this.anim=new Kinetic.Animation(function(){o.tween.onEnterFrame()},e.getLayer());this.tween=new n(u,function(n){o._tweenFunc(n)},h,0,1,1e3*s,c);this._addListeners();Kinetic.Tween.attrs[i]||(Kinetic.Tween.attrs[i]={});Kinetic.Tween.attrs[i][this._id]||(Kinetic.Tween.attrs[i][this._id]={});Kinetic.Tween.tweens[i]||(Kinetic.Tween.tweens[i]={});for(u in t)void 0===r[u]&&this._addAttr(u,t[u]);this.reset();this.onFinish=t.onFinish;this.onReset=t.onReset};Kinetic.Tween.attrs={};Kinetic.Tween.tweens={};Kinetic.Tween.prototype={_addAttr:function(n,t){var r,u,e,i,o,s=this.node,f=s._id;if(e=Kinetic.Tween.tweens[f][n],e&&delete Kinetic.Tween.attrs[f][e][n],r=s.getAttr(n),Kinetic.Util._isArray(t))for(u=[],o=t.length,i=0;o>i;i++)u.push(t[i]-r[i]);else u=t-r;Kinetic.Tween.attrs[f][this._id][n]={start:r,diff:u};Kinetic.Tween.tweens[f][n]=this._id},_tweenFunc:function(n){var u,f,t,e,r,i,o,s=this.node,h=Kinetic.Tween.attrs[s._id][this._id];for(u in h){if(f=h[u],t=f.start,e=f.diff,Kinetic.Util._isArray(t))for(r=[],o=t.length,i=0;o>i;i++)r.push(t[i]+e[i]*n);else r=t+e*n;s.setAttr(u,r)}},_addListeners:function(){var n=this;this.tween.onPlay=function(){n.anim.start()};this.tween.onReverse=function(){n.anim.start()};this.tween.onPause=function(){n.anim.stop()};this.tween.onFinish=function(){n.onFinish&&n.onFinish()};this.tween.onReset=function(){n.onReset&&n.onReset()}},play:function(){return this.tween.play(),this},reverse:function(){return this.tween.reverse(),this},reset:function(){return this.node,this.tween.reset(),this},seek:function(n){return this.node,this.tween.seek(1e3*n),this},pause:function(){return this.tween.pause(),this},finish:function(){return this.node,this.tween.finish(),this},destroy:function(){var t,n=this.node._id,i=this._id,r=Kinetic.Tween.tweens[n];this.pause();for(t in r)delete Kinetic.Tween.tweens[n][t];delete Kinetic.Tween.attrs[n][i]}};n=function(n,t,i,r,u,f,e){this.prop=n;this.propFunc=t;this.begin=r;this._pos=r;this.duration=f;this._change=0;this.prevPos=0;this.yoyo=e;this._time=0;this._position=0;this._startTime=0;this._finish=0;this.func=i;this._change=u-this.begin;this.pause()};n.prototype={fire:function(n){var t=this[n];t&&t()},setTime:function(n){n>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():0>n?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=n,this.update())},getTime:function(){return this._time},setPosition:function(n){this.prevPos=this._pos;this.propFunc(n);this._pos=n},getPosition:function(n){return void 0===n&&(n=this._time),this.func(n,this.begin,this._change,this.duration)},play:function(){this.state=t;this._startTime=this.getTimer()-this._time;this.onEnterFrame();this.fire("onPlay")},reverse:function(){this.state=i;this._time=this.duration-this._time;this._startTime=this.getTimer()-this._time;this.onEnterFrame();this.fire("onReverse")},seek:function(n){this.pause();this._time=n;this.update();this.fire("onSeek")},reset:function(){this.pause();this._time=0;this.update();this.fire("onReset")},finish:function(){this.pause();this._time=this.duration;this.update();this.fire("onFinish")},update:function(){this.setPosition(this.getPosition(this._time))},onEnterFrame:function(){var n=this.getTimer()-this._startTime;this.state===t?this.setTime(n):this.state===i&&this.setTime(this.duration-n)},pause:function(){this.state=u;this.fire("onPause")},getTimer:function(){return(new Date).getTime()}};Kinetic.Easings={BackEaseIn:function(n,t,i,r){var u=1.70158;return i*(n/=r)*n*((u+1)*n-u)+t},BackEaseOut:function(n,t,i,r){var u=1.70158;return i*((n=n/r-1)*n*((u+1)*n+u)+1)+t},BackEaseInOut:function(n,t,i,r){var u=1.70158;return(n/=r/2)<1?i/2*n*n*(((u*=1.525)+1)*n-u)+t:i/2*((n-=2)*n*(((u*=1.525)+1)*n+u)+2)+t},ElasticEaseIn:function(n,t,i,r,u,f){var e=0;return 0===n?t:1==(n/=r)?t+i:(f||(f=.3*r),!u||u<Math.abs(i)?(u=i,e=f/4):e=f/(2*Math.PI)*Math.asin(i/u),-(u*Math.pow(2,10*(n-=1))*Math.sin(2*(n*r-e)*Math.PI/f))+t)},ElasticEaseOut:function(n,t,i,r,u,f){var e=0;return 0===n?t:1==(n/=r)?t+i:(f||(f=.3*r),!u||u<Math.abs(i)?(u=i,e=f/4):e=f/(2*Math.PI)*Math.asin(i/u),u*Math.pow(2,-10*n)*Math.sin(2*(n*r-e)*Math.PI/f)+i+t)},ElasticEaseInOut:function(n,t,i,r,u,f){var e=0;return 0===n?t:2==(n/=r/2)?t+i:(f||(f=.3*r*1.5),!u||u<Math.abs(i)?(u=i,e=f/4):e=f/(2*Math.PI)*Math.asin(i/u),1>n?-.5*u*Math.pow(2,10*(n-=1))*Math.sin(2*(n*r-e)*Math.PI/f)+t:u*Math.pow(2,-10*(n-=1))*Math.sin(2*(n*r-e)*Math.PI/f)*.5+i+t)},BounceEaseOut:function(n,t,i,r){return(n/=r)<1/2.75?7.5625*i*n*n+t:2/2.75>n?i*(7.5625*(n-=1.5/2.75)*n+.75)+t:2.5/2.75>n?i*(7.5625*(n-=2.25/2.75)*n+.9375)+t:i*(7.5625*(n-=2.625/2.75)*n+.984375)+t},BounceEaseIn:function(n,t,i,r){return i-Kinetic.Easings.BounceEaseOut(r-n,0,i,r)+t},BounceEaseInOut:function(n,t,i,r){return r/2>n?.5*Kinetic.Easings.BounceEaseIn(2*n,0,i,r)+t:.5*Kinetic.Easings.BounceEaseOut(2*n-r,0,i,r)+.5*i+t},EaseIn:function(n,t,i,r){return i*(n/=r)*n+t},EaseOut:function(n,t,i,r){return-i*(n/=r)*(n-2)+t},EaseInOut:function(n,t,i,r){return(n/=r/2)<1?i/2*n*n+t:-i/2*(--n*(n-2)-1)+t},StrongEaseIn:function(n,t,i,r){return i*(n/=r)*n*n*n*n+t},StrongEaseOut:function(n,t,i,r){return i*((n=n/r-1)*n*n*n*n+1)+t},StrongEaseInOut:function(n,t,i,r){return(n/=r/2)<1?i/2*n*n*n*n*n+t:i/2*((n-=2)*n*n*n*n+2)+t},Linear:function(n,t,i,r){return i*n/r+t}}}(),function(){var t,n;Kinetic.DD={anim:new Kinetic.Animation,isDragging:!1,offset:{x:0,y:0},node:null,_drag:function(n){var i=Kinetic.DD,t=i.node;if(t){if(!i.isDragging){var r=t.getStage().getPointerPosition(),u=t.dragDistance(),f=Math.max(Math.abs(r.x-i.startPointerPos.x),Math.abs(r.y-i.startPointerPos.y));if(u>f)return}t._setDragPosition(n);i.isDragging||(i.isDragging=!0,t.fire("dragstart",{type:"dragstart",target:t,evt:n},!0));t.fire("dragmove",{type:"dragmove",target:t,evt:n},!0)}},_endDragBefore:function(n){var u,r,t=Kinetic.DD,i=t.node;i&&(u=i.nodeType,r=i.getLayer(),t.anim.stop(),t.isDragging&&(t.isDragging=!1,Kinetic.listenClickTap=!1,n&&(n.dragEndNode=i)),delete t.node,(r||i).draw())},_endDragAfter:function(n){n=n||{};var t=n.dragEndNode;n&&t&&t.fire("dragend",{type:"dragend",target:t,evt:n},!0)}};Kinetic.Node.prototype.startDrag=function(){var n=Kinetic.DD,r=this.getStage(),u=this.getLayer(),t=r.getPointerPosition(),i=this.getAbsolutePosition();t&&(n.node&&n.node.stopDrag(),n.node=this,n.startPointerPos=t,n.offset.x=t.x-i.x,n.offset.y=t.y-i.y,n.anim.setLayers(u||this.getLayers()),n.anim.start(),this._setDragPosition())};Kinetic.Node.prototype._setDragPosition=function(n){var r=Kinetic.DD,i=this.getStage().getPointerPosition(),u=this.getDragBoundFunc(),t;i&&(t={x:i.x-r.offset.x,y:i.y-r.offset.y},void 0!==u&&(t=u.call(this,t,n)),this.setAbsolutePosition(t))};Kinetic.Node.prototype.stopDrag=function(){var n=Kinetic.DD,t={};n._endDragBefore(t);n._endDragAfter(t)};Kinetic.Node.prototype.setDraggable=function(n){this._setAttr("draggable",n);this._dragChange()};t=Kinetic.Node.prototype.destroy;Kinetic.Node.prototype.destroy=function(){var n=Kinetic.DD;n.node&&n.node._id===this._id&&this.stopDrag();t.call(this)};Kinetic.Node.prototype.isDragging=function(){var n=Kinetic.DD;return n.node&&n.node._id===this._id&&n.isDragging};Kinetic.Node.prototype._listenDrag=function(){var n=this;this._dragCleanup();"Stage"===this.getClassName()?this.on("contentMousedown.kinetic contentTouchstart.kinetic",function(t){Kinetic.DD.node||n.startDrag(t)}):this.on("mousedown.kinetic touchstart.kinetic",function(t){Kinetic.DD.node||n.startDrag(t)})};Kinetic.Node.prototype._dragChange=function(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage(),n=Kinetic.DD;t&&n.node&&n.node._id===this._id&&n.node.stopDrag()}};Kinetic.Node.prototype._dragCleanup=function(){"Stage"===this.getClassName()?(this.off("contentMousedown.kinetic"),this.off("contentTouchstart.kinetic")):(this.off("mousedown.kinetic"),this.off("touchstart.kinetic"))};Kinetic.Factory.addGetterSetter(Kinetic.Node,"dragBoundFunc");Kinetic.Factory.addGetter(Kinetic.Node,"draggable",!1);Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,"draggable");n=Kinetic.document.documentElement;n.addEventListener("mouseup",Kinetic.DD._endDragBefore,!0);n.addEventListener("touchend",Kinetic.DD._endDragBefore,!0);n.addEventListener("mouseup",Kinetic.DD._endDragAfter,!1);n.addEventListener("touchend",Kinetic.DD._endDragAfter,!1)}(),function(){Kinetic.Util.addMethods(Kinetic.Container,{__init:function(n){this.children=new Kinetic.Collection;Kinetic.Node.call(this,n)},getChildren:function(n){if(n){var t=new Kinetic.Collection;return this.children.each(function(i){n(i)&&t.push(i)}),t}return this.children},hasChildren:function(){return this.getChildren().length>0},removeChildren:function(){for(var n,t=Kinetic.Collection.toCollection(this.children),i=0;i<t.length;i++)n=t[i],delete n.parent,n.index=0,n.hasChildren()&&n.removeChildren(),n.remove();return t=null,this.children=new Kinetic.Collection,this},destroyChildren:function(){for(var n,t=Kinetic.Collection.toCollection(this.children),i=0;i<t.length;i++)n=t[i],delete n.parent,n.index=0,n.destroy();return t=null,this.children=new Kinetic.Collection,this},add:function(n){var i,t;if(!(arguments.length>1))return n.getParent()?void n.moveTo(this):(i=this.children,this._validateAdd(n),n.index=i.length,n.parent=this,i.push(n),this._fire("add",{child:n}),this);for(t=0;t<arguments.length;t++)this.add(arguments[t])},destroy:function(){this.hasChildren()&&this.destroyChildren();Kinetic.Node.prototype.destroy.call(this)},find:function(n){for(var u,t,o,f,e,s,i=[],h=n.replace(/ /g,"").split(","),c=h.length,r=0;c>r;r++)if(t=h[r],"#"===t.charAt(0))f=this._getNodeById(t.slice(1)),f&&i.push(f);else if("."===t.charAt(0))o=this._getNodesByName(t.slice(1)),i=i.concat(o);else for(e=this.getChildren(),s=e.length,u=0;s>u;u++)i=i.concat(e[u]._get(t));return Kinetic.Collection.toCollection(i)},_getNodeById:function(n){var t=Kinetic.ids[n];return void 0!==t&&this.isAncestorOf(t)?t:null},_getNodesByName:function(n){var t=Kinetic.names[n]||[];return this._getDescendants(t)},_get:function(n){for(var t=Kinetic.Node.prototype._get.call(this,n),r=this.getChildren(),u=r.length,i=0;u>i;i++)t=t.concat(r[i]._get(n));return t},toObject:function(){var n=Kinetic.Node.prototype.toObject.call(this),r;n.children=[];for(var i=this.getChildren(),u=i.length,t=0;u>t;t++)r=i[t],n.children.push(r.toObject());return n},_getDescendants:function(n){for(var i,r=[],u=n.length,t=0;u>t;t++)i=n[t],this.isAncestorOf(i)&&r.push(i);return r},isAncestorOf:function(n){for(var t=n.getParent();t;){if(t._id===this._id)return!0;t=t.getParent()}return!1},clone:function(n){var t=Kinetic.Node.prototype.clone.call(this,n);return this.getChildren().each(function(n){t.add(n.clone())}),t},getAllIntersections:function(n){var t=[];return this.find("Shape").each(function(i){i.isVisible()&&i.intersects(n)&&t.push(i)}),t},_setChildrenIndices:function(){this.children.each(function(n,t){n.index=t})},drawScene:function(n,t){var r=this.getLayer(),i=n||r&&r.getCanvas(),f=i&&i.getContext(),u=this._cache.canvas,e=u&&u.scene;return this.isVisible()&&(e?this._drawCachedSceneCanvas(f):this._drawChildren(i,"drawScene",t)),this},drawHit:function(n,t){var r=this.getLayer(),i=n||r&&r.hitCanvas,f=i&&i.getContext(),u=this._cache.canvas,e=u&&u.hit;return this.shouldDrawHit()&&(e?this._drawCachedHitCanvas(f):this._drawChildren(i,"drawHit",t)),this},_drawChildren:function(n,t,i){var u,f,e=this.getLayer(),r=n&&n.getContext(),o=this.getClipWidth(),s=this.getClipHeight(),h=o&&s;h&&e&&(u=this.getClipX(),f=this.getClipY(),r.save(),e._applyTransform(this,r),r.beginPath(),r.rect(u,f,o,s),r.clip(),r.reset());this.children.each(function(r){r[t](n,i)});h&&r.restore()}});Kinetic.Util.extend(Kinetic.Container,Kinetic.Node);Kinetic.Container.prototype.get=Kinetic.Container.prototype.find;Kinetic.Factory.addComponentsGetterSetter(Kinetic.Container,"clip",["x","y","width","height"]);Kinetic.Factory.addGetterSetter(Kinetic.Container,"clipX");Kinetic.Factory.addGetterSetter(Kinetic.Container,"clipY");Kinetic.Factory.addGetterSetter(Kinetic.Container,"clipWidth");Kinetic.Factory.addGetterSetter(Kinetic.Container,"clipHeight");Kinetic.Collection.mapMethods(Kinetic.Container)}(),function(){function t(n){n.fill()}function i(n){n.stroke()}function r(n){n.fill()}function u(n){n.stroke()}function f(){this._clearCache(n)}var n="hasShadow";Kinetic.Util.addMethods(Kinetic.Shape,{__init:function(n){this.nodeType="Shape";this._fillFunc=t;this._strokeFunc=i;this._fillFuncHit=r;this._strokeFuncHit=u;for(var e,o=Kinetic.shapes;;)if(e=Kinetic.Util.getRandomColor(),e&&!(e in o))break;this.colorKey=e;o[e]=this;Kinetic.Node.call(this,n);this.on("shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChange.kinetic",f)},hasChildren:function(){return!1},getChildren:function(){return[]},getContext:function(){return this.getLayer().getContext()},getCanvas:function(){return this.getLayer().getCanvas()},hasShadow:function(){return this._getCache(n,this._hasShadow)},_hasShadow:function(){return this.getShadowEnabled()&&0!==this.getShadowOpacity()&&!!(this.getShadowColor()||this.getShadowBlur()||this.getShadowOffsetX()||this.getShadowOffsetY())},hasFill:function(){return!!(this.getFill()||this.getFillPatternImage()||this.getFillLinearGradientColorStops()||this.getFillRadialGradientColorStops())},hasStroke:function(){return!!(this.stroke()||this.strokeRed()||this.strokeGreen()||this.strokeBlue())},_get:function(n){return this.className===n||this.nodeType===n?[this]:[]},intersects:function(n){var i,r=this.getStage(),t=r.bufferHitCanvas;return t.getContext().clear(),this.drawScene(t),i=t.context.getImageData(Math.round(n.x),Math.round(n.y),1,1).data,i[3]>0},destroy:function(){Kinetic.Node.prototype.destroy.call(this);delete Kinetic.shapes[this.colorKey]},_useBufferCanvas:function(){return(this.hasShadow()||1!==this.getAbsoluteOpacity())&&this.hasFill()&&this.hasStroke()&&this.getStage()},drawScene:function(n,t){var o,u,r,e=this.getLayer(),h=n||e.getCanvas(),i=h.getContext(),c=this._cache.canvas,f=this.sceneFunc(),s=this.hasShadow();return this.isVisible()&&(c?this._drawCachedSceneCanvas(i):f&&(i.save(),this._useBufferCanvas()?(o=this.getStage(),u=o.bufferCanvas,r=u.getContext(),r.clear(),r.save(),r._applyLineJoin(this),e._applyTransform(this,r,t),f.call(this,r),r.restore(),s&&(i.save(),i._applyShadow(this),i.drawImage(u._canvas,0,0),i.restore()),i._applyOpacity(this),i.drawImage(u._canvas,0,0)):(i._applyLineJoin(this),e._applyTransform(this,i,t),s&&(i.save(),i._applyShadow(this),f.call(this,i),i.restore()),i._applyOpacity(this),f.call(this,i)),i.restore())),this},drawHit:function(n,t){var r=this.getLayer(),e=n||r.hitCanvas,i=e.getContext(),u=this.hitFunc()||this.sceneFunc(),f=this._cache.canvas,o=f&&f.hit;return this.shouldDrawHit()&&(o?this._drawCachedHitCanvas(i):u&&(i.save(),i._applyLineJoin(this),r._applyTransform(this,i,t),u.call(this,i),i.restore())),this},drawHitFromCache:function(n){var s,u,f,i,h,r,t,c,v=n||0,y=this._cache.canvas,e=this._getCachedSceneCanvas(),p=e.getContext(),w=y.hit,o=w.getContext(),l=e.getWidth(),a=e.getHeight();o.clear();try{for(s=p.getImageData(0,0,l,a),u=s.data,f=o.getImageData(0,0,l,a),i=f.data,h=u.length,r=Kinetic.Util._hexToRgb(this.colorKey),t=0;h>t;t+=4)c=u[t+3],c>v&&(i[t]=r.r,i[t+1]=r.g,i[t+2]=r.b,i[t+3]=255);o.putImageData(f,0,0)}catch(b){Kinetic.Util.warn("Unable to draw hit graph from cached scene canvas. "+b.message)}return this}});Kinetic.Util.extend(Kinetic.Shape,Kinetic.Node);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"stroke");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"strokeRed",0,Kinetic.Validators.RGBComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"strokeGreen",0,Kinetic.Validators.RGBComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"strokeBlue",0,Kinetic.Validators.RGBComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"strokeAlpha",1,Kinetic.Validators.alphaComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"strokeWidth",2);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"lineJoin");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"lineCap");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"sceneFunc");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"hitFunc");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"dash");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"shadowColor");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"shadowRed",0,Kinetic.Validators.RGBComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"shadowGreen",0,Kinetic.Validators.RGBComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"shadowBlue",0,Kinetic.Validators.RGBComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"shadowAlpha",1,Kinetic.Validators.alphaComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"shadowBlur");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"shadowOpacity");Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,"shadowOffset",["x","y"]);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"shadowOffsetX",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"shadowOffsetY",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillPatternImage");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fill");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillRed",0,Kinetic.Validators.RGBComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillGreen",0,Kinetic.Validators.RGBComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillBlue",0,Kinetic.Validators.RGBComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillAlpha",1,Kinetic.Validators.alphaComponent);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillPatternX",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillPatternY",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillLinearGradientColorStops");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillRadialGradientStartRadius",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillRadialGradientEndRadius",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillRadialGradientColorStops");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillPatternRepeat","repeat");Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillEnabled",!0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"strokeEnabled",!0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"shadowEnabled",!0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"dashEnabled",!0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"strokeScaleEnabled",!0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillPriority","color");Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,"fillPatternOffset",["x","y"]);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillPatternOffsetX",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillPatternOffsetY",0);Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,"fillPatternScale",["x","y"]);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillPatternScaleX",1);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillPatternScaleY",1);Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,"fillLinearGradientStartPoint",["x","y"]);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillLinearGradientStartPointX",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillLinearGradientStartPointY",0);Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,"fillLinearGradientEndPoint",["x","y"]);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillLinearGradientEndPointX",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillLinearGradientEndPointY",0);Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,"fillRadialGradientStartPoint",["x","y"]);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillRadialGradientStartPointX",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillRadialGradientStartPointY",0);Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,"fillRadialGradientEndPoint",["x","y"]);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillRadialGradientEndPointX",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillRadialGradientEndPointY",0);Kinetic.Factory.addGetterSetter(Kinetic.Shape,"fillPatternRotation",0);Kinetic.Factory.backCompat(Kinetic.Shape,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});Kinetic.Collection.mapMethods(Kinetic.Shape)}(),function(){function a(n,t){n.content.addEventListener(t,function(i){n[yt+t](i)},!1)}var v="Stage",y="string",r="px",n="mouseout",t="mouseleave",u="mouseover",p="mouseenter",f="mousemove",e="mousedown",o="mouseup",w="click",b="dblclick",s="touchstart",h="touchend",k="tap",d="dbltap",c="touchmove",g="contentMouseout",nt="contentMouseover",tt="contentMousemove",it="contentMousedown",rt="contentMouseup",ut="contentClick",ft="contentDblclick",et="contentTouchstart",ot="contentTouchend",st="contentDbltap",ht="contentTouchmove",i="div",ct="relative",lt="inline-block",at="kineticjs-content",vt=" ",yt="_",pt="container",wt="",l=[e,f,o,n,s,c,h,u],bt=l.length;Kinetic.Util.addMethods(Kinetic.Stage,{___init:function(n){this.nodeType=v;Kinetic.Container.call(this,n);this._id=Kinetic.idCounter++;this._buildDOM();this._bindContentEvents();this._enableNestedTransforms=!1;Kinetic.stages.push(this)},_validateAdd:function(n){"Layer"!==n.getType()&&Kinetic.Util.error("You may only add layers to the stage.")},setContainer:function(n){if(typeof n===y){var t=n;if(n=Kinetic.document.getElementById(n),!n)throw"Can not find container in document with id "+t;}return this._setAttr(pt,n),this},shouldDrawHit:function(){return!0},draw:function(){return Kinetic.Node.prototype.draw.call(this),this},setHeight:function(n){return Kinetic.Node.prototype.setHeight.call(this,n),this._resizeDOM(),this},setWidth:function(n){return Kinetic.Node.prototype.setWidth.call(this,n),this._resizeDOM(),this},clear:function(){for(var t=this.children,i=t.length,n=0;i>n;n++)t[n].clear();return this},clone:function(n){return n||(n={}),n.container=Kinetic.document.createElement(i),Kinetic.Container.prototype.clone.call(this,n)},destroy:function(){var n=this.content,t;Kinetic.Container.prototype.destroy.call(this);n&&Kinetic.Util._isInDocument(n)&&this.getContainer().removeChild(n);t=Kinetic.stages.indexOf(this);t>-1&&Kinetic.stages.splice(t,1)},getPointerPosition:function(){return this.pointerPos},getStage:function(){return this},getContent:function(){return this.content},toDataURL:function(n){function t(i){var h=e[i],c=h.toDataURL(),r=new Kinetic.window.Image;r.onload=function(){f.drawImage(r,0,0);i<e.length-1?t(i+1):n.callback(u.toDataURL(o,s))};r.src=c}n=n||{};var o=n.mimeType||null,s=n.quality||null,i=n.x||0,r=n.y||0,u=new Kinetic.SceneCanvas({width:n.width||this.getWidth(),height:n.height||this.getHeight(),pixelRatio:1}),f=u.getContext()._context,e=this.children;(i||r)&&f.translate(-1*i,-1*r);t(0)},toImage:function(n){var t=n.callback;n.callback=function(n){Kinetic.Util._getImage(n,function(n){t(n)})};this.toDataURL(n)},getIntersection:function(n){for(var i,r=this.getChildren(),u=r.length,f=u-1,t=f;t>=0;t--)if(i=r[t].getIntersection(n))return i;return null},_resizeDOM:function(){if(this.content){var i,u,n=this.getWidth(),t=this.getHeight(),f=this.getChildren(),e=f.length;for(this.content.style.width=n+r,this.content.style.height=t+r,this.bufferCanvas.setSize(n,t),this.bufferHitCanvas.setSize(n,t),i=0;e>i;i++)u=f[i],u.getCanvas().setSize(n,t),u.hitCanvas.setSize(n,t),u.draw()}},add:function(n){if(!(arguments.length>1))return Kinetic.Container.prototype.add.call(this,n),n._setCanvasSize(this.width(),this.height()),n.draw(),this.content.appendChild(n.canvas._canvas),this;for(var t=0;t<arguments.length;t++)this.add(arguments[t])},getParent:function(){return null},getLayer:function(){return null},getLayers:function(){return this.getChildren()},_bindContentEvents:function(){for(var n=0;bt>n;n++)a(this,l[n])},_mouseover:function(n){Kinetic.UA.mobile||(this._setPointerPosition(n),this._fire(nt,{evt:n}))},_mouseout:function(i){if(!Kinetic.UA.mobile){this._setPointerPosition(i);var r=this.targetShape;r&&!Kinetic.isDragging()&&(r._fireAndBubble(n,{evt:i}),r._fireAndBubble(t,{evt:i}),this.targetShape=null);this.pointerPos=void 0;this._fire(g,{evt:i})}},_mousemove:function(i){if(!Kinetic.UA.mobile){this._setPointerPosition(i);var e=Kinetic.DD,r=this.getIntersection(this.getPointerPosition());r&&r.isListening()?Kinetic.isDragging()||this.targetShape&&this.targetShape._id===r._id?r._fireAndBubble(f,{evt:i}):(this.targetShape&&(this.targetShape._fireAndBubble(n,{evt:i},r),this.targetShape._fireAndBubble(t,{evt:i},r)),r._fireAndBubble(u,{evt:i},this.targetShape),r._fireAndBubble(p,{evt:i},this.targetShape),this.targetShape=r):this.targetShape&&!Kinetic.isDragging()&&(this.targetShape._fireAndBubble(n,{evt:i}),this.targetShape._fireAndBubble(t,{evt:i}),this.targetShape=null);this._fire(tt,{evt:i});e&&e._drag(i)}i.preventDefault&&i.preventDefault()},_mousedown:function(n){if(!Kinetic.UA.mobile){this._setPointerPosition(n);var t=this.getIntersection(this.getPointerPosition());Kinetic.listenClickTap=!0;t&&t.isListening()&&(this.clickStartShape=t,t._fireAndBubble(e,{evt:n}));this._fire(it,{evt:n})}n.preventDefault&&n.preventDefault()},_mouseup:function(n){if(!Kinetic.UA.mobile){this._setPointerPosition(n);var t=this.getIntersection(this.getPointerPosition()),r=this.clickStartShape,i=!1;Kinetic.inDblClickWindow?(i=!0,Kinetic.inDblClickWindow=!1):Kinetic.inDblClickWindow=!0;setTimeout(function(){Kinetic.inDblClickWindow=!1},Kinetic.dblClickWindow);t&&t.isListening()&&(t._fireAndBubble(o,{evt:n}),Kinetic.listenClickTap&&r&&r._id===t._id&&(t._fireAndBubble(w,{evt:n}),i&&t._fireAndBubble(b,{evt:n})));this._fire(rt,{evt:n});Kinetic.listenClickTap&&(this._fire(ut,{evt:n}),i&&this._fire(ft,{evt:n}));Kinetic.listenClickTap=!1}n.preventDefault&&n.preventDefault()},_touchstart:function(n){this._setPointerPosition(n);var t=this.getIntersection(this.getPointerPosition());Kinetic.listenClickTap=!0;t&&t.isListening()&&(this.tapStartShape=t,t._fireAndBubble(s,{evt:n}),t.isListening()&&n.preventDefault&&n.preventDefault());this._fire(et,{evt:n})},_touchend:function(n){this._setPointerPosition(n);var t=this.getIntersection(this.getPointerPosition()),i=!1;Kinetic.inDblClickWindow?(i=!0,Kinetic.inDblClickWindow=!1):Kinetic.inDblClickWindow=!0;setTimeout(function(){Kinetic.inDblClickWindow=!1},Kinetic.dblClickWindow);t&&t.isListening()&&(t._fireAndBubble(h,{evt:n}),Kinetic.listenClickTap&&t._id===this.tapStartShape._id&&(t._fireAndBubble(k,{evt:n}),i&&t._fireAndBubble(d,{evt:n})),t.isListening()&&n.preventDefault&&n.preventDefault());Kinetic.listenClickTap&&(this._fire(ot,{evt:n}),i&&this._fire(st,{evt:n}));Kinetic.listenClickTap=!1},_touchmove:function(n){this._setPointerPosition(n);var i=Kinetic.DD,t=this.getIntersection(this.getPointerPosition());t&&t.isListening()&&(t._fireAndBubble(c,{evt:n}),t.isListening()&&n.preventDefault&&n.preventDefault());this._fire(ht,{evt:n});i&&i._drag(n)},_setPointerPosition:function(n){var u,r=this._getContentPosition(),f=n.offsetX,e=n.clientX,t=null,i=null;n=n?n:window.event;void 0!==n.touches?n.touches.length>0&&(u=n.touches[0],t=u.clientX-r.left,i=u.clientY-r.top):void 0!==f?(t=f,i=n.offsetY):"mozilla"===Kinetic.UA.browser?(t=n.layerX,i=n.layerY):void 0!==e&&r&&(t=e-r.left,i=n.clientY-r.top);null!==t&&null!==i&&(this.pointerPos={x:t,y:i})},_getContentPosition:function(){var n=this.content.getBoundingClientRect?this.content.getBoundingClientRect():{top:0,left:0};return{top:n.top,left:n.left}},_buildDOM:function(){var n=this.getContainer();if(!n){if(Kinetic.Util.isBrowser())throw"Stage has not container. But container is required";n=Kinetic.document.createElement(i)}n.innerHTML=wt;this.content=Kinetic.document.createElement(i);this.content.style.position=ct;this.content.style.display=lt;this.content.className=at;this.content.setAttribute("role","presentation");n.appendChild(this.content);this.bufferCanvas=new Kinetic.SceneCanvas({pixelRatio:1});this.bufferHitCanvas=new Kinetic.HitCanvas;this._resizeDOM()},_onContent:function(n,t){for(var r,u=n.split(vt),f=u.length,i=0;f>i;i++)r=u[i],this.content.addEventListener(r,t,!1)},cache:function(){Kinetic.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes.")},clearCache:function(){}});Kinetic.Util.extend(Kinetic.Stage,Kinetic.Container);Kinetic.Factory.addGetter(Kinetic.Stage,"container");Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Stage,"container")}(),function(){Kinetic.Util.addMethods(Kinetic.BaseLayer,{___init:function(n){this.nodeType="Layer";Kinetic.Container.call(this,n)},createPNGStream:function(){return this.canvas._canvas.createPNGStream()},getCanvas:function(){return this.canvas},getHitCanvas:function(){return this.hitCanvas},getContext:function(){return this.getCanvas().getContext()},clear:function(n){return this.getContext().clear(n),this.getHitCanvas().getContext().clear(n),this},setZIndex:function(n){Kinetic.Node.prototype.setZIndex.call(this,n);var t=this.getStage();return t&&(t.content.removeChild(this.getCanvas()._canvas),n<t.getChildren().length-1?t.content.insertBefore(this.getCanvas()._canvas,t.getChildren()[n+1].getCanvas()._canvas):t.content.appendChild(this.getCanvas()._canvas)),this},moveToTop:function(){Kinetic.Node.prototype.moveToTop.call(this);var n=this.getStage();n&&(n.content.removeChild(this.getCanvas()._canvas),n.content.appendChild(this.getCanvas()._canvas))},moveUp:function(){if(Kinetic.Node.prototype.moveUp.call(this)){var n=this.getStage();n&&(n.content.removeChild(this.getCanvas()._canvas),this.index<n.getChildren().length-1?n.content.insertBefore(this.getCanvas()._canvas,n.getChildren()[this.index+1].getCanvas()._canvas):n.content.appendChild(this.getCanvas()._canvas))}},moveDown:function(){var n,t;Kinetic.Node.prototype.moveDown.call(this)&&(n=this.getStage(),n&&(t=n.getChildren(),n.content.removeChild(this.getCanvas()._canvas),n.content.insertBefore(this.getCanvas()._canvas,t[this.index+1].getCanvas()._canvas)))},moveToBottom:function(){var n,t;Kinetic.Node.prototype.moveToBottom.call(this)&&(n=this.getStage(),n&&(t=n.getChildren(),n.content.removeChild(this.getCanvas()._canvas),n.content.insertBefore(this.getCanvas()._canvas,t[1].getCanvas()._canvas)))},getLayer:function(){return this},remove:function(){var n=this.getCanvas()._canvas;return Kinetic.Node.prototype.remove.call(this),n&&n.parentNode&&Kinetic.Util._isInDocument(n)&&n.parentNode.removeChild(n),this},getStage:function(){return this.parent}});Kinetic.Util.extend(Kinetic.BaseLayer,Kinetic.Container);Kinetic.Factory.addGetterSetter(Kinetic.BaseLayer,"clearBeforeDraw",!0);Kinetic.Collection.mapMethods(Kinetic.BaseLayer)}(),function(){var t="#",i="beforeDraw",r="draw",n=[{x:0,y:0},{x:-1,y:0},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:1,y:0},{x:1,y:1},{x:0,y:1},{x:-1,y:1}],u=n.length;Kinetic.Util.addMethods(Kinetic.Layer,{____init:function(n){this.nodeType="Layer";this.canvas=new Kinetic.SceneCanvas;this.hitCanvas=new Kinetic.HitCanvas;Kinetic.BaseLayer.call(this,n)},_setCanvasSize:function(n,t){this.canvas.setSize(n,t);this.hitCanvas.setSize(n,t)},_validateAdd:function(n){var t=n.getType();"Group"!==t&&"Shape"!==t&&Kinetic.Util.error("You may only add groups and shapes to a layer.")},getIntersection:function(t){var r,i,f,e;if(!this.hitGraphEnabled()||!this.isVisible())return null;for(i=0;u>i;i++){if(f=n[i],r=this._getIntersection({x:t.x+f.x,y:t.y+f.y}),e=r.shape)return e;if(!r.antialiased)return null}},_getIntersection:function(n){var r,u,i=this.hitCanvas.context._context.getImageData(n.x,n.y,1,1).data,f=i[3];return 255===f?(r=Kinetic.Util._rgbToHex(i[0],i[1],i[2]),u=Kinetic.shapes[t+r],{shape:u}):f>0?{antialiased:!0}:{}},drawScene:function(n,t){var u=this.getLayer(),f=n||u&&u.getCanvas();return this._fire(i,{node:this}),this.getClearBeforeDraw()&&f.getContext().clear(),Kinetic.Container.prototype.drawScene.call(this,f,t),this._fire(r,{node:this}),this},_applyTransform:function(n,t,i){var r=n.getAbsoluteTransform(i).getMatrix();t.transform(r[0],r[1],r[2],r[3],r[4],r[5])},drawHit:function(n,t){var i=this.getLayer(),r=n||i&&i.hitCanvas;return i&&i.getClearBeforeDraw()&&i.getHitCanvas().getContext().clear(),Kinetic.Container.prototype.drawHit.call(this,r,t),this},clear:function(n){return this.getContext().clear(n),this.getHitCanvas().getContext().clear(n),this},setVisible:function(n){return Kinetic.Node.prototype.setVisible.call(this,n),n?(this.getCanvas()._canvas.style.display="block",this.hitCanvas._canvas.style.display="block"):(this.getCanvas()._canvas.style.display="none",this.hitCanvas._canvas.style.display="none"),this},enableHitGraph:function(){return this.setHitGraphEnabled(!0),this},disableHitGraph:function(){return this.setHitGraphEnabled(!1),this}});Kinetic.Util.extend(Kinetic.Layer,Kinetic.BaseLayer);Kinetic.Factory.addGetterSetter(Kinetic.Layer,"hitGraphEnabled",!0);Kinetic.Collection.mapMethods(Kinetic.Layer)}(),function(){Kinetic.Util.addMethods(Kinetic.FastLayer,{____init:function(n){this.nodeType="Layer";this.canvas=new Kinetic.SceneCanvas;Kinetic.BaseLayer.call(this,n)},_validateAdd:function(n){var t=n.getType();"Shape"!==t&&Kinetic.Util.error("You may only add shapes to a fast layer.")},_setCanvasSize:function(n,t){this.canvas.setSize(n,t)},hitGraphEnabled:function(){return!1},getIntersection:function(){return null},drawScene:function(n){var t=this.getLayer(),i=n||t&&t.getCanvas();return this.getClearBeforeDraw()&&i.getContext().clear(),Kinetic.Container.prototype.drawScene.call(this,i),this},_applyTransform:function(n,t,i){if(!i||i._id!==this._id){var r=n.getTransform().getMatrix();t.transform(r[0],r[1],r[2],r[3],r[4],r[5])}},draw:function(){return this.drawScene(),this},clear:function(n){return this.getContext().clear(n),this},setVisible:function(n){return Kinetic.Node.prototype.setVisible.call(this,n),this.getCanvas()._canvas.style.display=n?"block":"none",this}});Kinetic.Util.extend(Kinetic.FastLayer,Kinetic.BaseLayer);Kinetic.Collection.mapMethods(Kinetic.FastLayer)}(),function(){Kinetic.Util.addMethods(Kinetic.Group,{___init:function(n){this.nodeType="Group";Kinetic.Container.call(this,n)},_validateAdd:function(n){var t=n.getType();"Group"!==t&&"Shape"!==t&&Kinetic.Util.error("You may only add groups and shapes to groups.")}});Kinetic.Util.extend(Kinetic.Group,Kinetic.Container);Kinetic.Collection.mapMethods(Kinetic.Group)}(),function(){Kinetic.Rect=function(n){this.___init(n)};Kinetic.Rect.prototype={___init:function(n){Kinetic.Shape.call(this,n);this.className="Rect";this.sceneFunc(this._sceneFunc)},_sceneFunc:function(n){var t=this.getCornerRadius(),i=this.getWidth(),r=this.getHeight();n.beginPath();t?(n.moveTo(t,0),n.lineTo(i-t,0),n.arc(i-t,t,t,3*Math.PI/2,0,!1),n.lineTo(i,r-t),n.arc(i-t,r-t,t,0,Math.PI/2,!1),n.lineTo(t,r),n.arc(t,r-t,t,Math.PI/2,Math.PI,!1),n.lineTo(0,t),n.arc(t,t,t,Math.PI,3*Math.PI/2,!1)):n.rect(0,0,i,r);n.closePath();n.fillStrokeShape(this)}};Kinetic.Util.extend(Kinetic.Rect,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.Rect,"cornerRadius",0);Kinetic.Collection.mapMethods(Kinetic.Rect)}(),function(){var n=2*Math.PI-.0001,t="Circle";Kinetic.Circle=function(n){this.___init(n)};Kinetic.Circle.prototype={___init:function(n){Kinetic.Shape.call(this,n);this.className=t;this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){t.beginPath();t.arc(0,0,this.getRadius(),0,n,!1);t.closePath();t.fillStrokeShape(this)},getWidth:function(){return 2*this.getRadius()},getHeight:function(){return 2*this.getRadius()},setWidth:function(n){Kinetic.Node.prototype.setWidth.call(this,n);this.setRadius(n/2)},setHeight:function(n){Kinetic.Node.prototype.setHeight.call(this,n);this.setRadius(n/2)}};Kinetic.Util.extend(Kinetic.Circle,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.Circle,"radius",0);Kinetic.Collection.mapMethods(Kinetic.Circle)}(),function(){var n=2*Math.PI-.0001,t="Ellipse";Kinetic.Ellipse=function(n){this.___init(n)};Kinetic.Ellipse.prototype={___init:function(n){Kinetic.Shape.call(this,n);this.className=t;this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var r=this.getRadius(),i=r.x,u=r.y;t.beginPath();t.save();i!==u&&t.scale(1,u/i);t.arc(0,0,i,0,n,!1);t.restore();t.closePath();t.fillStrokeShape(this)},getWidth:function(){return 2*this.getRadius().x},getHeight:function(){return 2*this.getRadius().y},setWidth:function(n){Kinetic.Node.prototype.setWidth.call(this,n);this.setRadius({x:n/2})},setHeight:function(n){Kinetic.Node.prototype.setHeight.call(this,n);this.setRadius({y:n/2})}};Kinetic.Util.extend(Kinetic.Ellipse,Kinetic.Shape);Kinetic.Factory.addComponentsGetterSetter(Kinetic.Ellipse,"radius",["x","y"]);Kinetic.Factory.addGetterSetter(Kinetic.Ellipse,"radiusX",0);Kinetic.Factory.addGetterSetter(Kinetic.Ellipse,"radiusY",0);Kinetic.Collection.mapMethods(Kinetic.Ellipse)}(),function(){var n=2*Math.PI-.0001;Kinetic.Ring=function(n){this.___init(n)};Kinetic.Ring.prototype={___init:function(n){Kinetic.Shape.call(this,n);this.className="Ring";this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){t.beginPath();t.arc(0,0,this.getInnerRadius(),0,n,!1);t.moveTo(this.getOuterRadius(),0);t.arc(0,0,this.getOuterRadius(),n,0,!0);t.closePath();t.fillStrokeShape(this)},getWidth:function(){return 2*this.getOuterRadius()},getHeight:function(){return 2*this.getOuterRadius()},setWidth:function(n){Kinetic.Node.prototype.setWidth.call(this,n);this.setOuterRadius(n/2)},setHeight:function(n){Kinetic.Node.prototype.setHeight.call(this,n);this.setOuterRadius(n/2)}};Kinetic.Util.extend(Kinetic.Ring,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.Ring,"innerRadius",0);Kinetic.Factory.addGetterSetter(Kinetic.Ring,"outerRadius",0);Kinetic.Collection.mapMethods(Kinetic.Ring)}(),function(){Kinetic.Wedge=function(n){this.___init(n)};Kinetic.Wedge.prototype={___init:function(n){Kinetic.Shape.call(this,n);this.className="Wedge";this.sceneFunc(this._sceneFunc)},_sceneFunc:function(n){n.beginPath();n.arc(0,0,this.getRadius(),0,Kinetic.getAngle(this.getAngle()),this.getClockwise());n.lineTo(0,0);n.closePath();n.fillStrokeShape(this)}};Kinetic.Util.extend(Kinetic.Wedge,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.Wedge,"radius",0);Kinetic.Factory.addGetterSetter(Kinetic.Wedge,"angle",0);Kinetic.Factory.addGetterSetter(Kinetic.Wedge,"clockwise",!1);Kinetic.Factory.backCompat(Kinetic.Wedge,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});Kinetic.Collection.mapMethods(Kinetic.Wedge)}(),function(){Math.PI/180;Kinetic.Arc=function(n){this.___init(n)};Kinetic.Arc.prototype={___init:function(n){Kinetic.Shape.call(this,n);this.className="Arc";this.sceneFunc(this._sceneFunc)},_sceneFunc:function(n){var t=Kinetic.getAngle(this.angle()),i=this.clockwise();n.beginPath();n.arc(0,0,this.getOuterRadius(),0,t,i);n.arc(0,0,this.getInnerRadius(),t,0,!i);n.closePath();n.fillStrokeShape(this)}};Kinetic.Util.extend(Kinetic.Arc,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.Arc,"innerRadius",0);Kinetic.Factory.addGetterSetter(Kinetic.Arc,"outerRadius",0);Kinetic.Factory.addGetterSetter(Kinetic.Arc,"angle",0);Kinetic.Factory.addGetterSetter(Kinetic.Arc,"clockwise",!1);Kinetic.Collection.mapMethods(Kinetic.Arc)}(),function(){var n="Image";Kinetic.Image=function(n){this.___init(n)};Kinetic.Image.prototype={___init:function(t){Kinetic.Shape.call(this,t);this.className=n;this.sceneFunc(this._sceneFunc);this.hitFunc(this._hitFunc)},_useBufferCanvas:function(){return(this.hasShadow()||1!==this.getAbsoluteOpacity())&&this.hasStroke()},_sceneFunc:function(n){var t,r,u,o,f=this.getWidth(),e=this.getHeight(),i=this.getImage();i&&(t=this.getCrop(),r=t.width,u=t.height,o=r&&u?[i,t.x,t.y,r,u,0,0,f,e]:[i,0,0,f,e]);n.beginPath();n.rect(0,0,f,e);n.closePath();n.fillStrokeShape(this);i&&n.drawImage.apply(n,o)},_hitFunc:function(n){var t=this.getWidth(),i=this.getHeight();n.beginPath();n.rect(0,0,t,i);n.closePath();n.fillStrokeShape(this)},getWidth:function(){var n=this.getImage();return this.attrs.width||(n?n.width:0)},getHeight:function(){var n=this.getImage();return this.attrs.height||(n?n.height:0)}};Kinetic.Util.extend(Kinetic.Image,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.Image,"image");Kinetic.Factory.addComponentsGetterSetter(Kinetic.Image,"crop",["x","y","width","height"]);Kinetic.Factory.addGetterSetter(Kinetic.Image,"cropX",0);Kinetic.Factory.addGetterSetter(Kinetic.Image,"cropY",0);Kinetic.Factory.addGetterSetter(Kinetic.Image,"cropWidth",0);Kinetic.Factory.addGetterSetter(Kinetic.Image,"cropHeight",0);Kinetic.Collection.mapMethods(Kinetic.Image)}(),function(){function e(n){n.fillText(this.partialText,0,0)}function o(n){n.strokeText(this.partialText,0,0)}var n="auto",s="center",h="Change.kinetic",c="-",r="left",l="text",a="Text",v="middle",u="normal",y="px ",i=" ",p="right",w="char",b="none",f=["fontFamily","fontSize","fontStyle","fontVariant","padding","align","lineHeight","text","width","height","wrap"],k=f.length,t=Kinetic.Util.createCanvasElement().getContext("2d");Kinetic.Text=function(n){this.___init(n)};Kinetic.Text.prototype={___init:function(t){var r=this,i;for(void 0===t.width&&(t.width=n),void 0===t.height&&(t.height=n),Kinetic.Shape.call(this,t),this._fillFunc=e,this._strokeFunc=o,this.className=a,i=0;k>i;i++)this.on(f[i]+h,r._setTextData);this._setTextData();this.sceneFunc(this._sceneFunc);this.hitFunc(this._hitFunc)},_sceneFunc:function(n){var t,i=this.getPadding(),u=this.getTextHeight(),c=this.getLineHeight()*u,f=this.textArr,l=f.length,e=this.getWidth();for(n.setAttr("font",this._getContextFont()),n.setAttr("textBaseline",v),n.setAttr("textAlign",r),n.save(),n.translate(i,0),n.translate(0,i+u/2),t=0;l>t;t++){var o=f[t],a=o.text,h=o.width;n.save();this.getAlign()===p?n.translate(e-h-2*i,0):this.getAlign()===s&&n.translate((e-h-2*i)/2,0);this.partialText=a;n.fillStrokeShape(this);n.restore();n.translate(0,c)}n.restore()},_hitFunc:function(n){var t=this.getWidth(),i=this.getHeight();n.beginPath();n.rect(0,0,t,i);n.closePath();n.fillStrokeShape(this)},setText:function(n){var t=Kinetic.Util._isString(n)?n:n.toString();return this._setAttr(l,t),this},getWidth:function(){return this.attrs.width===n?this.getTextWidth()+2*this.getPadding():this.attrs.width},getHeight:function(){return this.attrs.height===n?this.getTextHeight()*this.textArr.length*this.getLineHeight()+2*this.getPadding():this.attrs.height},getTextWidth:function(){return this.textWidth},getTextHeight:function(){return this.textHeight},_getTextSize:function(n){var r,i=t,u=this.getFontSize();return i.save(),i.font=this._getContextFont(),r=i.measureText(n),i.restore(),{width:r.width,height:parseInt(u,10)}},_getContextFont:function(){return this.getFontStyle()+i+this.getFontVariant()+i+this.getFontSize()+y+this.getFontFamily()},_addTextLine:function(n,t){return this.textArr.push({text:n,width:t})},_getTextWidth:function(n){return t.measureText(n).width},_setTextData:function(){var d=this.getText().split("\n"),g=+this.getFontSize(),e=0,s=this.getLineHeight()*g,nt=this.attrs.width,tt=this.attrs.height,ct=nt!==n,it=tt!==n,rt=this.getPadding(),v=nt-2*rt,ut=tt-2*rt,h=0,ft=this.getWrap(),et=ft!==b,lt=ft!==w&&et,l,ot,r,u,k;for(this.textArr=[],t.save(),t.font=this._getContextFont(),l=0,ot=d.length;ot>l;++l){if(r=d[l],u=this._getTextWidth(r),ct&&u>v)for(;r.length>0;){for(var o=0,y=r.length,f="",a=0;y>o;){var p=o+y>>>1,st=r.slice(0,p+1),ht=this._getTextWidth(st);v>=ht?(o=p+1,f=st,a=ht):y=p}if(!f)break;if(lt&&(k=Math.max(f.lastIndexOf(i),f.lastIndexOf(c))+1,k>0&&(o=k,f=f.slice(0,o),a=this._getTextWidth(f))),this._addTextLine(f,a),e=Math.max(e,a),h+=s,!et||it&&h+s>ut)break;if(r=r.slice(o),r.length>0&&(u=this._getTextWidth(r),v>=u)){this._addTextLine(r,u);h+=s;e=Math.max(e,u);break}}else this._addTextLine(r,u),h+=s,e=Math.max(e,u);if(it&&h+s>ut)break}t.restore();this.textHeight=g;this.textWidth=e}};Kinetic.Util.extend(Kinetic.Text,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.Text,"fontFamily","Arial");Kinetic.Factory.addGetterSetter(Kinetic.Text,"fontSize",12);Kinetic.Factory.addGetterSetter(Kinetic.Text,"fontStyle",u);Kinetic.Factory.addGetterSetter(Kinetic.Text,"fontVariant",u);Kinetic.Factory.addGetterSetter(Kinetic.Text,"padding",0);Kinetic.Factory.addGetterSetter(Kinetic.Text,"align",r);Kinetic.Factory.addGetterSetter(Kinetic.Text,"lineHeight",1);Kinetic.Factory.addGetterSetter(Kinetic.Text,"wrap","word");Kinetic.Factory.addGetter(Kinetic.Text,"text","");Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Text,"text");Kinetic.Collection.mapMethods(Kinetic.Text)}(),function(){Kinetic.Line=function(n){this.___init(n)};Kinetic.Line.prototype={___init:function(n){Kinetic.Shape.call(this,n);this.className="Line";this.on("pointsChange.kinetic tensionChange.kinetic closedChange.kinetic",function(){this._clearCache("tensionPoints")});this.sceneFunc(this._sceneFunc)},_sceneFunc:function(n){var t,u,i,r=this.getPoints(),f=r.length,o=this.getTension(),e=this.getClosed();if(n.beginPath(),n.moveTo(r[0],r[1]),0!==o&&f>4){for(t=this.getTensionPoints(),u=t.length,i=e?0:4,e||n.quadraticCurveTo(t[0],t[1],t[2],t[3]);u-2>i;)n.bezierCurveTo(t[i++],t[i++],t[i++],t[i++],t[i++],t[i++]);e||n.quadraticCurveTo(t[u-2],t[u-1],r[f-2],r[f-1])}else for(i=2;f>i;i+=2)n.lineTo(r[i],r[i+1]);e?(n.closePath(),n.fillStrokeShape(this)):n.strokeShape(this)},getTensionPoints:function(){return this._getCache("tensionPoints",this._getTensionPoints)},_getTensionPoints:function(){return this.getClosed()?this._getTensionPointsClosed():Kinetic.Util._expandPoints(this.getPoints(),this.getTension())},_getTensionPointsClosed:function(){var n=this.getPoints(),t=n.length,u=this.getTension(),f=Kinetic.Util,i=f._getControlPoints(n[t-2],n[t-1],n[0],n[1],n[2],n[3],u),r=f._getControlPoints(n[t-4],n[t-3],n[t-2],n[t-1],n[0],n[1],u),e=Kinetic.Util._expandPoints(n,u);return[i[2],i[3]].concat(e).concat([r[0],r[1],n[t-2],n[t-1],r[2],r[3],i[0],i[1],n[0],n[1]])}};Kinetic.Util.extend(Kinetic.Line,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.Line,"closed",!1);Kinetic.Factory.addGetterSetter(Kinetic.Line,"tension",0);Kinetic.Factory.addGetterSetter(Kinetic.Line,"points");Kinetic.Collection.mapMethods(Kinetic.Line)}(),function(){Kinetic.Sprite=function(n){this.___init(n)};Kinetic.Sprite.prototype={___init:function(n){Kinetic.Shape.call(this,n);this.className="Sprite";this.anim=new Kinetic.Animation;this.on("animationChange.kinetic",function(){this.frameIndex(0)});this.on("frameRateChange.kinetic",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())});this.sceneFunc(this._sceneFunc);this.hitFunc(this._hitFunc)},_sceneFunc:function(n){var e=this.getAnimation(),o=this.frameIndex(),t=4*o,i=this.getAnimations()[e],s=i[t+0],h=i[t+1],r=i[t+2],u=i[t+3],f=this.getImage();f&&n.drawImage(f,s,h,r,u,0,0,r,u)},_hitFunc:function(n){var r=this.getAnimation(),u=this.frameIndex(),t=4*u,i=this.getAnimations()[r],f=i[t+2],e=i[t+3];n.beginPath();n.rect(0,0,f,e);n.closePath();n.fillShape(this)},_useBufferCanvas:function(){return(this.hasShadow()||1!==this.getAbsoluteOpacity())&&this.hasStroke()},_setInterval:function(){var n=this;this.interval=setInterval(function(){n._updateIndex()},1e3/this.getFrameRate())},start:function(){var n=this.getLayer();this.anim.setLayers(n);this._setInterval();this.anim.start()},stop:function(){this.anim.stop();clearInterval(this.interval)},isRunning:function(){return this.anim.isRunning()},_updateIndex:function(){var n=this.frameIndex(),t=this.getAnimation(),i=this.getAnimations(),r=i[t],u=r.length/4;this.frameIndex(u-1>n?n+1:0)}};Kinetic.Util.extend(Kinetic.Sprite,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.Sprite,"animation");Kinetic.Factory.addGetterSetter(Kinetic.Sprite,"animations");Kinetic.Factory.addGetterSetter(Kinetic.Sprite,"image");Kinetic.Factory.addGetterSetter(Kinetic.Sprite,"frameIndex",0);Kinetic.Factory.addGetterSetter(Kinetic.Sprite,"frameRate",17);Kinetic.Factory.backCompat(Kinetic.Sprite,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});Kinetic.Collection.mapMethods(Kinetic.Sprite)}(),function(){Kinetic.Path=function(n){this.___init(n)};Kinetic.Path.prototype={___init:function(n){this.dataArray=[];var t=this;Kinetic.Shape.call(this,n);this.className="Path";this.dataArray=Kinetic.Path.parsePathData(this.getData());this.on("dataChange.kinetic",function(){t.dataArray=Kinetic.Path.parsePathData(this.getData())});this.sceneFunc(this._sceneFunc)},_sceneFunc:function(n){var f=this.dataArray,e=!1,u,o,t;for(n.beginPath(),u=0;u<f.length;u++){o=f[u].command;t=f[u].points;switch(o){case"L":n.lineTo(t[0],t[1]);break;case"M":n.moveTo(t[0],t[1]);break;case"C":n.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]);break;case"Q":n.quadraticCurveTo(t[0],t[1],t[2],t[3]);break;case"A":var s=t[0],h=t[1],i=t[2],r=t[3],c=t[4],y=t[5],l=t[6],p=t[7],w=i>r?i:r,a=i>r?1:i/r,v=i>r?r/i:1;n.translate(s,h);n.rotate(l);n.scale(a,v);n.arc(0,0,w,c,c+y,1-p);n.scale(1/a,1/v);n.rotate(-l);n.translate(-s,-h);break;case"z":n.closePath();e=!0}}e?n.fillStrokeShape(this):n.strokeShape(this)}};Kinetic.Util.extend(Kinetic.Path,Kinetic.Shape);Kinetic.Path.getLineLength=function(n,t,i,r){return Math.sqrt((i-n)*(i-n)+(r-t)*(r-t))};Kinetic.Path.getPointOnLine=function(n,t,i,r,u,f,e){var o,s,c,h,v,y,l,a,p,w;if(void 0===f&&(f=t),void 0===e&&(e=i),o=(u-i)/(r-t+1e-8),s=Math.sqrt(n*n/(1+o*o)),t>r&&(s*=-1),h=o*s,r===t)c={x:f,y:e+h};else if((e-i)/(f-t+1e-8)===o)c={x:f+s,y:e+h};else{if(l=this.getLineLength(t,i,r,u),1e-8>l)return void 0;a=(f-t)*(r-t)+(e-i)*(u-i);a/=l*l;v=t+a*(r-t);y=i+a*(u-i);p=this.getLineLength(f,e,v,y);w=Math.sqrt(n*n-p*p);s=Math.sqrt(w*w/(1+o*o));t>r&&(s*=-1);h=o*s;c={x:v+s,y:y+h}}return c};Kinetic.Path.getPointOnCubicBezier=function(n,t,i,r,u,f,e,o,s){function h(n){return n*n*n}function c(n){return 3*n*n*(1-n)}function l(n){return 3*n*(1-n)*(1-n)}function a(n){return(1-n)*(1-n)*(1-n)}var v=o*h(n)+f*c(n)+r*l(n)+t*a(n),y=s*h(n)+e*c(n)+u*l(n)+i*a(n);return{x:v,y:y}};Kinetic.Path.getPointOnQuadraticBezier=function(n,t,i,r,u,f,e){function o(n){return n*n}function s(n){return 2*n*(1-n)}function h(n){return(1-n)*(1-n)}var c=f*o(n)+r*s(n)+t*h(n),l=e*o(n)+u*s(n)+i*h(n);return{x:c,y:l}};Kinetic.Path.getPointOnEllipticalArc=function(n,t,i,r,u,f){var o=Math.cos(f),s=Math.sin(f),e={x:i*Math.cos(u),y:r*Math.sin(u)};return{x:n+(e.x*o-e.y*s),y:t+(e.x*s+e.y*o)}};Kinetic.Path.parsePathData=function(n){var v,w,l,c,a,t,p,rt,ut,y;if(!n)return[];for(v=n,w=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"],v=v.replace(new RegExp(" ","g"),","),l=0;l<w.length;l++)v=v.replace(new RegExp(w[l],"g"),"|"+w[l]);var ft=v.split("|"),f=[],i=0,r=0;for(l=1;l<ft.length;l++){for(c=ft[l],a=c.charAt(0),c=c.slice(1),c=c.replace(new RegExp(",-","g"),"-"),c=c.replace(new RegExp("-","g"),",-"),c=c.replace(new RegExp("e,-","g"),"e-"),t=c.split(","),t.length>0&&""===t[0]&&t.shift(),p=0;p<t.length;p++)t[p]=parseFloat(t[p]);for(;t.length>0&&!isNaN(t[0]);){var o,s,h,b,k,d,g,nt,tt,it,e=null,u=[],et=i,ot=r;switch(a){case"l":i+=t.shift();r+=t.shift();e="L";u.push(i,r);break;case"L":i=t.shift();r=t.shift();u.push(i,r);break;case"m":if(rt=t.shift(),ut=t.shift(),i+=rt,r+=ut,e="M",f.length>2&&"z"===f[f.length-1].command)for(y=f.length-2;y>=0;y--)if("M"===f[y].command){i=f[y].points[0]+rt;r=f[y].points[1]+ut;break}u.push(i,r);a="l";break;case"M":i=t.shift();r=t.shift();e="M";u.push(i,r);a="L";break;case"h":i+=t.shift();e="L";u.push(i,r);break;case"H":i=t.shift();e="L";u.push(i,r);break;case"v":r+=t.shift();e="L";u.push(i,r);break;case"V":r=t.shift();e="L";u.push(i,r);break;case"C":u.push(t.shift(),t.shift(),t.shift(),t.shift());i=t.shift();r=t.shift();u.push(i,r);break;case"c":u.push(i+t.shift(),r+t.shift(),i+t.shift(),r+t.shift());i+=t.shift();r+=t.shift();e="C";u.push(i,r);break;case"S":s=i;h=r;o=f[f.length-1];"C"===o.command&&(s=i+(i-o.points[2]),h=r+(r-o.points[3]));u.push(s,h,t.shift(),t.shift());i=t.shift();r=t.shift();e="C";u.push(i,r);break;case"s":s=i;h=r;o=f[f.length-1];"C"===o.command&&(s=i+(i-o.points[2]),h=r+(r-o.points[3]));u.push(s,h,i+t.shift(),r+t.shift());i+=t.shift();r+=t.shift();e="C";u.push(i,r);break;case"Q":u.push(t.shift(),t.shift());i=t.shift();r=t.shift();u.push(i,r);break;case"q":u.push(i+t.shift(),r+t.shift());i+=t.shift();r+=t.shift();e="Q";u.push(i,r);break;case"T":s=i;h=r;o=f[f.length-1];"Q"===o.command&&(s=i+(i-o.points[0]),h=r+(r-o.points[1]));i=t.shift();r=t.shift();e="Q";u.push(s,h,i,r);break;case"t":s=i;h=r;o=f[f.length-1];"Q"===o.command&&(s=i+(i-o.points[0]),h=r+(r-o.points[1]));i+=t.shift();r+=t.shift();e="Q";u.push(s,h,i,r);break;case"A":b=t.shift();k=t.shift();d=t.shift();g=t.shift();nt=t.shift();tt=i;it=r;i=t.shift();r=t.shift();e="A";u=this.convertEndpointToCenterParameterization(tt,it,i,r,g,nt,b,k,d);break;case"a":b=t.shift();k=t.shift();d=t.shift();g=t.shift();nt=t.shift();tt=i;it=r;i+=t.shift();r+=t.shift();e="A";u=this.convertEndpointToCenterParameterization(tt,it,i,r,g,nt,b,k,d)}f.push({command:e||a,points:u,start:{x:et,y:ot},pathLength:this.calcLength(et,ot,e||a,u)})}("z"===a||"Z"===a)&&f.push({command:"z",points:[],start:void 0,pathLength:0})}return f};Kinetic.Path.calcLength=function(n,t,i,r){var s,f,u,e,o=Kinetic.Path;switch(i){case"L":return o.getLineLength(n,t,r[0],r[1]);case"C":for(s=0,f=o.getPointOnCubicBezier(0,n,t,r[0],r[1],r[2],r[3],r[4],r[5]),e=.01;1>=e;e+=.01)u=o.getPointOnCubicBezier(e,n,t,r[0],r[1],r[2],r[3],r[4],r[5]),s+=o.getLineLength(f.x,f.y,u.x,u.y),f=u;return s;case"Q":for(s=0,f=o.getPointOnQuadraticBezier(0,n,t,r[0],r[1],r[2],r[3]),e=.01;1>=e;e+=.01)u=o.getPointOnQuadraticBezier(e,n,t,r[0],r[1],r[2],r[3]),s+=o.getLineLength(f.x,f.y,u.x,u.y),f=u;return s;case"A":s=0;var c=r[4],a=r[5],l=r[4]+a,h=Math.PI/180;if(Math.abs(c-l)<h&&(h=Math.abs(c-l)),f=o.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],c,0),0>a)for(e=c-h;e>l;e-=h)u=o.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],e,0),s+=o.getLineLength(f.x,f.y,u.x,u.y),f=u;else for(e=c+h;l>e;e+=h)u=o.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],e,0),s+=o.getLineLength(f.x,f.y,u.x,u.y),f=u;return u=o.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),s+o.getLineLength(f.x,f.y,u.x,u.y)}return 0};Kinetic.Path.convertEndpointToCenterParameterization=function(n,t,i,r,u,f,e,o,s){var l=s*(Math.PI/180),h=Math.cos(l)*(n-i)/2+Math.sin(l)*(t-r)/2,c=-1*Math.sin(l)*(n-i)/2+Math.cos(l)*(t-r)/2,w=h*h/(e*e)+c*c/(o*o),v;w>1&&(e*=Math.sqrt(w),o*=Math.sqrt(w));v=Math.sqrt((e*e*o*o-e*e*c*c-o*o*h*h)/(e*e*c*c+o*o*h*h));u===f&&(v*=-1);isNaN(v)&&(v=0);var y=v*e*c/o,p=v*-o*h/e,tt=(n+i)/2+Math.cos(l)*y-Math.sin(l)*p,it=(t+r)/2+Math.sin(l)*y+Math.cos(l)*p,g=function(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])},b=function(n,t){return(n[0]*t[0]+n[1]*t[1])/(g(n)*g(t))},nt=function(n,t){return(n[0]*t[1]<n[1]*t[0]?-1:1)*Math.acos(b(n,t))},rt=nt([1,0],[(h-y)/e,(c-p)/o]),k=[(h-y)/e,(c-p)/o],d=[(-1*h-y)/e,(-1*c-p)/o],a=nt(k,d);return b(k,d)<=-1&&(a=Math.PI),b(k,d)>=1&&(a=0),0===f&&a>0&&(a-=2*Math.PI),1===f&&0>a&&(a+=2*Math.PI),[tt,it,e,o,rt,a,l,f]};Kinetic.Factory.addGetterSetter(Kinetic.Path,"data");Kinetic.Collection.mapMethods(Kinetic.Path)}(),function(){function n(n){n.fillText(this.partialText,0,0)}function t(n){n.strokeText(this.partialText,0,0)}var i="normal";Kinetic.TextPath=function(n){this.___init(n)};Kinetic.TextPath.prototype={___init:function(i){var r=this;this.dummyCanvas=Kinetic.Util.createCanvasElement();this.dataArray=[];Kinetic.Shape.call(this,i);this._fillFunc=n;this._strokeFunc=t;this._fillFuncHit=n;this._strokeFuncHit=t;this.className="TextPath";this.dataArray=Kinetic.Path.parsePathData(this.attrs.data);this.on("dataChange.kinetic",function(){r.dataArray=Kinetic.Path.parsePathData(this.attrs.data)});this.on("textChange.kinetic textStroke.kinetic textStrokeWidth.kinetic",r._setTextData);r._setTextData();this.sceneFunc(this._sceneFunc)},_sceneFunc:function(n){var i,t,r;for(n.setAttr("font",this._getContextFont()),n.setAttr("textBaseline","middle"),n.setAttr("textAlign","left"),n.save(),i=this.glyphInfo,t=0;t<i.length;t++)n.save(),r=i[t].p0,n.translate(r.x,r.y),n.rotate(i[t].rotation),this.partialText=i[t].text,n.fillStrokeShape(this),n.restore();n.restore()},getTextWidth:function(){return this.textWidth},getTextHeight:function(){return this.textHeight},setText:function(n){Kinetic.Text.prototype.setText.call(this,n)},_getTextSize:function(n){var r=this.dummyCanvas,t=r.getContext("2d"),i;return t.save(),t.font=this._getContextFont(),i=t.measureText(n),t.restore(),{width:i.width,height:parseInt(this.attrs.fontSize,10)}},_setTextData:function(){var e=this,o=this._getTextSize(this.attrs.text);this.textWidth=o.width;this.textHeight=o.height;this.glyphInfo=[];for(var i,r,n,f=this.attrs.text.split(""),s=-1,t=0,c=function(){t=0;for(var r=e.dataArray,n=s+1;n<r.length;n++){if(r[n].pathLength>0)return s=n,r[n];"M"==r[n].command&&(i={x:r[n].points[0],y:r[n].points[1]})}return{}},l=function(u){var f=e._getTextSize(u).width,o=0,v=0,l,h;for(r=void 0;Math.abs(f-o)/f>.01&&25>v;){for(v++,l=o;void 0===n;)n=c(),n&&l+n.pathLength<f&&(l+=n.pathLength,n=void 0);if(n==={}||void 0===i)return void 0;h=!1;switch(n.command){case"L":Kinetic.Path.getLineLength(i.x,i.y,n.points[0],n.points[1])>f?r=Kinetic.Path.getPointOnLine(f,i.x,i.y,n.points[0],n.points[1],i.x,i.y):n=void 0;break;case"A":var y=n.points[4],s=n.points[5],a=n.points[4]+s;0===t?t=y+1e-8:f>o?t+=Math.PI/180*s/Math.abs(s):t-=Math.PI/360*s/Math.abs(s);(0>s&&a>t||s>=0&&t>a)&&(t=a,h=!0);r=Kinetic.Path.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],t,n.points[6]);break;case"C":0===t?t=f>n.pathLength?1e-8:f/n.pathLength:f>o?t+=(f-o)/n.pathLength:t-=(o-f)/n.pathLength;t>1&&(t=1,h=!0);r=Kinetic.Path.getPointOnCubicBezier(t,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3],n.points[4],n.points[5]);break;case"Q":0===t?t=f/n.pathLength:f>o?t+=(f-o)/n.pathLength:t-=(o-f)/n.pathLength;t>1&&(t=1,h=!0);r=Kinetic.Path.getPointOnQuadraticBezier(t,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3])}void 0!==r&&(o=Kinetic.Path.getLineLength(i.x,i.y,r.x,r.y));h&&(h=!1,n=void 0)}},u=0;u<f.length&&(l(f[u]),void 0!==i&&void 0!==r);u++){var a=Kinetic.Path.getLineLength(i.x,i.y,r.x,r.y),h=Kinetic.Path.getPointOnLine(0+a/2,i.x,i.y,r.x,r.y),v=Math.atan2(r.y-i.y,r.x-i.x);this.glyphInfo.push({transposeX:h.x,transposeY:h.y,text:f[u],rotation:v,p0:i,p1:r});i=r}}};Kinetic.TextPath.prototype._getContextFont=Kinetic.Text.prototype._getContextFont;Kinetic.Util.extend(Kinetic.TextPath,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.TextPath,"fontFamily","Arial");Kinetic.Factory.addGetterSetter(Kinetic.TextPath,"fontSize",12);Kinetic.Factory.addGetterSetter(Kinetic.TextPath,"fontStyle",i);Kinetic.Factory.addGetterSetter(Kinetic.TextPath,"fontVariant",i);Kinetic.Factory.addGetter(Kinetic.TextPath,"text","");Kinetic.Collection.mapMethods(Kinetic.TextPath)}(),function(){Kinetic.RegularPolygon=function(n){this.___init(n)};Kinetic.RegularPolygon.prototype={___init:function(n){Kinetic.Shape.call(this,n);this.className="RegularPolygon";this.sceneFunc(this._sceneFunc)},_sceneFunc:function(n){var t,u,f,i=this.attrs.sides,r=this.attrs.radius;for(n.beginPath(),n.moveTo(0,0-r),t=1;i>t;t++)u=r*Math.sin(2*t*Math.PI/i),f=-1*r*Math.cos(2*t*Math.PI/i),n.lineTo(u,f);n.closePath();n.fillStrokeShape(this)}};Kinetic.Util.extend(Kinetic.RegularPolygon,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.RegularPolygon,"radius",0);Kinetic.Factory.addGetterSetter(Kinetic.RegularPolygon,"sides",0);Kinetic.Collection.mapMethods(Kinetic.RegularPolygon)}(),function(){Kinetic.Star=function(n){this.___init(n)};Kinetic.Star.prototype={___init:function(n){Kinetic.Shape.call(this,n);this.className="Star";this.sceneFunc(this._sceneFunc)},_sceneFunc:function(n){var f=this.innerRadius(),r=this.outerRadius(),i=this.numPoints(),t;for(n.beginPath(),n.moveTo(0,0-r),t=1;2*i>t;t++){var u=t%2==0?r:f,e=u*Math.sin(t*Math.PI/i),o=-1*u*Math.cos(t*Math.PI/i);n.lineTo(e,o)}n.closePath();n.fillStrokeShape(this)}};Kinetic.Util.extend(Kinetic.Star,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.Star,"numPoints",5);Kinetic.Factory.addGetterSetter(Kinetic.Star,"innerRadius",0);Kinetic.Factory.addGetterSetter(Kinetic.Star,"outerRadius",0);Kinetic.Collection.mapMethods(Kinetic.Star)}(),function(){var n=["fontFamily","fontSize","fontStyle","padding","lineHeight","text"],f="Change.kinetic",t="up",i="right",r="down",u="left",e="Label",o=n.length;Kinetic.Label=function(n){this.____init(n)};Kinetic.Label.prototype={____init:function(n){var t=this;this.className=e;Kinetic.Group.call(this,n);this.on("add.kinetic",function(n){t._addListeners(n.child);t._sync()})},getText:function(){return this.find("Text")[0]},getTag:function(){return this.find("Tag")[0]},_addListeners:function(t){for(var r=this,u=function(){r._sync()},i=0;o>i;i++)t.on(n[i]+f,u)},getWidth:function(){return this.getText().getWidth()},getHeight:function(){return this.getText().getHeight()},_sync:function(){var e,o,a,c,n,f,l,h=this.getText(),s=this.getTag();if(h&&s){switch(e=h.getWidth(),o=h.getHeight(),a=s.getPointerDirection(),c=s.getPointerWidth(),l=s.getPointerHeight(),n=0,f=0,a){case t:n=e/2;f=-1*l;break;case i:n=e+c;f=o/2;break;case r:n=e/2;f=o+l;break;case u:n=-1*c;f=o/2}s.setAttrs({x:-1*n,y:-1*f,width:e,height:o});h.setAttrs({x:-1*n,y:-1*f})}}};Kinetic.Util.extend(Kinetic.Label,Kinetic.Group);Kinetic.Collection.mapMethods(Kinetic.Label);Kinetic.Tag=function(n){this.___init(n)};Kinetic.Tag.prototype={___init:function(n){Kinetic.Shape.call(this,n);this.className="Tag";this.sceneFunc(this._sceneFunc)},_sceneFunc:function(n){var f=this.getWidth(),e=this.getHeight(),h=this.getPointerDirection(),o=this.getPointerWidth(),s=this.getPointerHeight();n.beginPath();n.moveTo(0,0);h===t&&(n.lineTo((f-o)/2,0),n.lineTo(f/2,-1*s),n.lineTo((f+o)/2,0));n.lineTo(f,0);h===i&&(n.lineTo(f,(e-s)/2),n.lineTo(f+o,e/2),n.lineTo(f,(e+s)/2));n.lineTo(f,e);h===r&&(n.lineTo((f+o)/2,e),n.lineTo(f/2,e+s),n.lineTo((f-o)/2,e));n.lineTo(0,e);h===u&&(n.lineTo(0,(e+s)/2),n.lineTo(-1*o,e/2),n.lineTo(0,(e-s)/2));n.closePath();n.fillStrokeShape(this)}};Kinetic.Util.extend(Kinetic.Tag,Kinetic.Shape);Kinetic.Factory.addGetterSetter(Kinetic.Tag,"pointerDirection","none");Kinetic.Factory.addGetterSetter(Kinetic.Tag,"pointerWidth",0);Kinetic.Factory.addGetterSetter(Kinetic.Tag,"pointerHeight",0);Kinetic.Factory.addGetterSetter(Kinetic.Tag,"cornerRadius",0);Kinetic.Collection.mapMethods(Kinetic.Tag)}(),function(n,t,i,r){"use strict";function nt(t){t=t||"";n.error("Not implemented: "+t)}function u(t,i){t||(i=i?": "+i:"",n.error("Fancytree assertion failed"+i))}function f(n,i){var r,f,u=t.console?t.console[n]:null;if(u)if(u.apply)u.apply(t.console,i);else{for(f="",r=0;r<i.length;r++)f+=i[r];u(f)}}function tt(n){return!!(n.tree&&n.statusNodeType!==r)}function it(t){for(var r,u,e=n.map(n.trim(t).split("."),function(n){return parseInt(n,10)}),f=n.map(Array.prototype.slice.call(arguments,1),function(n){return parseInt(n,10)}),i=0;i<f.length;i++)if(r=e[i]||0,u=f[i]||0,r!==u)return r>u;return!0}function w(n,t,i,r,u){return function(){var i=t[n],f=r[n],e=t.ext[u],o=function(){return i.apply(t,arguments)};return function(){var n=t._local,i=t._super;try{return t._local=e,t._super=o,f.apply(t,arguments)}finally{t._local=n;t._super=i}}}()}function rt(t,i,r,u){for(var f in r)typeof r[f]=="function"?typeof t[f]=="function"?t[f]=w(f,t,i,r,u):f.charAt(0)==="_"?t.ext[u][f]=w(f,t,i,r,u):n.error("Could not override tree."+f+". Use prefix '_' to create tree."+u+"._"+f):f!=="options"&&(t.ext[u][f]=r[f])}function e(t,i){return t===r?n.Deferred(function(){this.resolve()}).promise():n.Deferred(function(){this.resolveWith(t,i)}).promise()}function y(t,i){return t===r?n.Deferred(function(){this.reject()}).promise():n.Deferred(function(){this.rejectWith(t,i)}).promise()}function b(n,t){return function(){n.resolveWith(t)}}function p(t){var i=n.extend({},t.data()),r=i.json;return delete i.fancytree,r&&(delete i.json,i=n.extend(i,r)),i}function k(n){return n=n.toLowerCase(),function(t){return t.title.toLowerCase().indexOf(n)>=0}}function c(t,i){var f,o,r,e;for(this.parent=t,this.tree=t.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},f=0,o=s.length;f<o;f++)r=s[f],this[r]=i[r];i.data&&n.extend(this.data,i.data);for(r in i)a[r]||n.isFunction(i[r])||g[r]||(this.data[r]=i[r]);this.key==null?this.tree.options.defaultKey?(this.key=this.tree.options.defaultKey(this),u(this.key,"defaultKey() must return a unique key")):this.key="_"+h._nextNodeKey++:this.key=""+this.key;i.active&&(u(this.tree.activeNode===null,"only one active node allowed"),this.tree.activeNode=this);i.selected&&(this.tree.lastSelectedNode=this);this.children=null;e=i.children;e&&e.length&&this._setChildren(e);this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function v(t){this.widget=t;this.$div=t.element;this.options=t.options;this.options&&n.isFunction(this.options.lazyload)&&(n.isFunction(this.options.lazyLoad)||(this.options.lazyLoad=function(){h.warn("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead.");t.options.lazyload.apply(this,arguments)}));this.options&&n.isFunction(this.options.loaderror)&&n.error("The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead.");this.ext={};this.data=p(this.$div);this._id=this.options.id==null?n.ui.fancytree._nextId++:this.options.id;this._ns=".fancytree-"+this._id;this.activeNode=null;this.focusNode=null;this._hasFocus=null;this.lastSelectedNode=null;this.systemFocusElement=null;this.statusClassPropName="span";this.ariaPropName="li";this.nodeContainerAttrName="li";this.$div.find(">ul.fancytree-container").remove();var r={tree:this},i;this.rootNode=new c(r,{title:"root",key:"root_"+this._id,children:null,expanded:!0});this.rootNode.parent=null;i=n("<ul>",{"class":"ui-fancytree fancytree-container"}).appendTo(this.$div);this.$container=i;this.rootNode.ul=i[0];this.options.debugLevel==null&&(this.options.debugLevel=h.debugLevel);this.$container.attr("tabindex",this.options.tabbable?"0":"-1");this.options.aria&&this.$container.attr("role","tree").attr("aria-multiselectable",!0)}if(n.ui.fancytree&&n.ui.fancytree.version){n.ui.fancytree.warn("Fancytree: ignored duplicate include");return}for(var h=null,ut={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},l="active expanded focus folder hideCheckbox lazy selected unselectable".split(" "),d={},s="expanded extraClasses folder hideCheckbox key lazy refKey selected title tooltip unselectable".split(" "),a={},g={active:!0,children:!0,data:!0,focus:!0},o=0;o<l.length;o++)d[l[o]]=!0;for(o=0;o<s.length;o++)a[s[o]]=!0;c.prototype={_findDirectChild:function(n){var t,r,i=this.children;if(i)if(typeof n=="string"){for(t=0,r=i.length;t<r;t++)if(i[t].key===n)return i[t]}else{if(typeof n=="number")return this.children[n];if(n.parent===this)return n}return null},_setChildren:function(n){u(n&&(!this.children||this.children.length===0),"only init supported");this.children=[];for(var t=0,i=n.length;t<i;t++)this.children.push(new c(this,n[t]))},addChildren:function(t,i){var r,o,e,s=null,f=[];for(n.isPlainObject(t)&&(t=[t]),this.children||(this.children=[]),r=0,o=t.length;r<o;r++)f.push(new c(this,t[r]));return s=f[0],i==null?this.children=this.children.concat(f):(i=this._findDirectChild(i),e=n.inArray(i,this.children),u(e>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[e,0].concat(f))),(!this.parent||this.parent.ul||this.tr)&&this.render(),this.tree.options.selectMode===3&&this.fixSelection3FromEndNodes(),s},addNode:function(n,t){(t===r||t==="over")&&(t="child");switch(t){case"after":return this.getParent().addChildren(n,this.getNextSibling());case"before":return this.getParent().addChildren(n,this);case"child":case"over":return this.addChildren(n)}u(!1,"Invalid mode: "+t)},appendSibling:function(n){return this.addNode(n,"after")},applyPatch:function(t){if(t===null)return this.remove(),e(this);var i,r,u={children:!0,expanded:!0,parent:!0};for(i in t)r=t[i],u[i]||n.isFunction(r)||(a[i]?this[i]=r:this.data[i]=r);return t.hasOwnProperty("children")&&(this.removeChildren(),t.children&&this._setChildren(t.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),t.hasOwnProperty("expanded")?this.setExpanded(t.expanded):e(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(n,t,i){return n.addNode(this.toDict(!0,i),t)},countChildren:function(n){var r=this.children,t,u,i;if(!r)return 0;if(i=r.length,n!==!1)for(t=0,u=i;t<u;t++)i+=r[t].countChildren();return i},debug:function(){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),f("debug",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},findAll:function(t){t=n.isFunction(t)?t:k(t);var i=[];return this.visit(function(n){t(n)&&i.push(n)}),i},findFirst:function(t){t=n.isFunction(t)?t:k(t);var i=null;return this.visit(function(n){if(t(n))return i=n,!1}),i},_changeSelectStatusAttrs:function(n){var t=!1;switch(n){case!1:t=this.selected||this.partsel;this.selected=!1;this.partsel=!1;break;case!0:t=!this.selected||!this.partsel;this.selected=!0;this.partsel=!0;break;case r:t=this.selected||!this.partsel;this.selected=!1;this.partsel=!0;break;default:u(!1,"invalid state: "+n)}return t&&this.renderStatus(),t},fixSelection3AfterClick:function(){var n=this.isSelected();this.visit(function(t){t._changeSelectStatusAttrs(n)});this.fixSelection3FromEndNodes()},fixSelection3FromEndNodes:function(){function n(t){var i,h,c,e,u,o,s,f=t.children;if(f&&f.length){for(o=!0,s=!1,i=0,h=f.length;i<h;i++)c=f[i],e=n(c),e!==!1&&(s=!0),e!==!0&&(o=!1);u=o?!0:s?r:!1}else u=!!t.selected;return t._changeSelectStatusAttrs(u),u}u(this.tree.options.selectMode===3,"expected selectMode 3");n(this);this.visitParents(function(n){for(var t,f,e=n.children,o=!0,s=!1,i=0,u=e.length;i<u;i++)t=e[i],(t.selected||t.partsel)&&(s=!0),t.unselectable||t.selected||(o=!1);f=o?!0:s?r:!1;n._changeSelectStatusAttrs(f)})},fromDict:function(t){for(var i in t)a[i]?this[i]=t[i]:i==="data"?n.extend(this.data,t.data):n.isFunction(t[i])||g[i]||(this.data[i]=t[i]);t.children&&(this.removeChildren(),this.addChildren(t.children));this.renderTitle()},getChildren:function(){return this.hasChildren()===r?r:this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return n.inArray(this,this.parent.children)},getIndexHier:function(t){t=t||".";var i=[];return n.each(this.getParentList(!1,!0),function(n,t){i.push(t.getIndex()+1)}),i.join(t)},getKeyPath:function(n){var t=[],i=this.tree.options.keyPathSeparator;return this.visitParents(function(n){n.parent&&t.unshift(n.key)},!n),i+t.join(i)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t},getNextSibling:function(){if(this.parent)for(var t=this.parent.children,n=0,i=t.length-1;n<i;n++)if(t[n]===this)return t[n+1];return null},getParent:function(){return this.parent},getParentList:function(n,t){for(var r=[],i=t?this:this.parent;i;)(n||i.parent)&&r.unshift(i),i=i.parent;return r},getPrevSibling:function(){if(this.parent)for(var t=this.parent.children,n=1,i=t.length;n<i;n++)if(t[n]===this)return t[n-1];return null},hasChildren:function(){return this.lazy?this.children==null?r:this.children.length===0?!1:this.children.length===1&&this.children[0].isStatusNode()?r:!0:!!(this.children&&this.children.length)},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(){this.tree.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),f("info",arguments))},isActive:function(){return this.tree.activeNode===this},isChildOf:function(n){return this.parent&&this.parent===n},isDescendantOf:function(n){if(!n||n.tree!==this.tree)return!1;for(var t=this.parent;t;){if(t===n)return!0;t=t.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var n=this.parent;return!n||n.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var n=this.parent;return!n||n.children[n.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||this.hasChildren()!==r},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return this.hasChildren()===r},isVisible:function(){for(var i=this.getParentList(!1,!1),n=0,t=i.length;n<t;n++)if(!i[n].expanded)return!1;return!0},lazyLoad:function(n){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(n)},load:function(n){var i,t,r=this;return!n&&!this.isUndefined()?e(this):(this.isLoaded()&&this.resetLazy(),t=this.tree._triggerNodeEvent("lazyLoad",this),t===!1)?e(this):(u(typeof t!="boolean","lazyLoad event must return source in data.result"),i=this.tree._callHook("nodeLoadChildren",this,t),this.expanded&&i.always(function(){r.render()}),i)},makeVisible:function(t){for(var e=this,u=[],r=new n.Deferred,f=this.getParentList(!1,!1),o=f.length,s=!(t&&t.noAnimation===!0),h=!(t&&t.scrollIntoView===!1),i=o-1;i>=0;i--)u.push(f[i].setExpanded(!0,t));return n.when.apply(n,u).done(function(){h?e.scrollIntoView(s).done(function(){r.resolve()}):r.resolve()}),r.promise()},moveTo:function(t,i,f){(i===r||i==="over")&&(i="child");var o,s=this.parent,e=i==="child"?t:t.parent;if(this!==t){if(this.parent){if(e.isDescendantOf(this))throw"Cannot move a node to its own descendant";}else throw"Cannot move system root";if(this.parent.children.length===1){if(this.parent===e)return;this.parent.children=this.parent.lazy?[]:null;this.parent.expanded=!1}else o=n.inArray(this,this.parent.children),u(o>=0),this.parent.children.splice(o,1);if(this.parent=e,e.hasChildren())switch(i){case"child":e.children.push(this);break;case"before":o=n.inArray(t,e.children);u(o>=0);e.children.splice(o,0,this);break;case"after":o=n.inArray(t,e.children);u(o>=0);e.children.splice(o+1,0,this);break;default:throw"Invalid mode "+i;}else e.children=[this];f&&t.visit(f,!0);this.tree!==t.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(n){n.tree=t.tree},!0));s.isDescendantOf(e)||s.render();e.isDescendantOf(s)||e===s||e.render()}},navigate:function(t,i){function u(r){if(r){try{r.makeVisible()}catch(u){}if(!n(r.span).is(":visible")){r.debug("Navigate: skipping hidden node");r.navigate(t,i);return}return i===!1?r.setFocus():r.setActive()}}var e,o,s=!0,f=n.ui.keyCode,r=null;switch(t){case f.BACKSPACE:this.parent&&this.parent.parent&&u(this.parent);break;case f.LEFT:this.expanded?(this.setExpanded(!1),u(this)):this.parent&&this.parent.parent&&u(this.parent);break;case f.RIGHT:!this.expanded&&(this.children||this.lazy)?(this.setExpanded(),u(this)):this.children&&this.children.length&&u(this.children[0]);break;case f.UP:for(r=this.getPrevSibling();r&&r.expanded&&r.children&&r.children.length;)r=r.children[r.children.length-1];!r&&this.parent&&this.parent.parent&&(r=this.parent);u(r);break;case f.DOWN:if(this.expanded&&this.children&&this.children.length)r=this.children[0];else for(o=this.getParentList(!1,!0),e=o.length-1;e>=0;e--)if(r=o[e].getNextSibling(),r)break;u(r);break;default:s=!1}},remove:function(){return this.parent.removeChild(this)},removeChild:function(n){return this.tree._callHook("nodeRemoveChild",this,n)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},render:function(n,t){return this.tree._callHook("nodeRender",this,n,t)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},resetLazy:function(){this.removeChildren();this.expanded=!1;this.lazy=!0;this.children=r;this.renderStatus()},scheduleAction:function(n,t){this.tree.timer&&clearTimeout(this.tree.timer);this.tree.timer=null;var i=this;switch(n){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){i.tree.debug("setTimeout: trigger expand");i.setExpanded(!0)},t);break;case"activate":this.tree.timer=setTimeout(function(){i.tree.debug("setTimeout: trigger activate");i.setActive(!0)},t);break;default:throw"Invalid mode "+n;}},scrollIntoView:function(f,e){e!==r&&tt(e)&&(this.warn("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead."),e={topNode:e});var a,l,d,p,h=n.extend({effects:f===!0?{duration:200,queue:!1}:f,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent||this.tree.$container,topNode:null},e),v=new n.Deferred,it=this,g=n(this.span).height(),o=n(h.scrollParent),w=h.scrollOfs.top||0,nt=h.scrollOfs.bottom||0,b=o.height(),y=o.scrollTop(),k=o,rt=o[0]===t,s=h.topNode||null,c=null;return u(n(this.span).is(":visible"),"scrollIntoView node is invisible"),rt?(l=n(this.span).offset().top,a=s&&s.span?n(s.span).offset().top:0,k=n("html,body")):(u(o[0]!==i&&o[0]!==i.body,"scrollParent should be an simple element or `window`, not document or body."),p=o.offset().top,l=n(this.span).offset().top-p+y,a=s?n(s.span).offset().top-p+y:0,d=Math.max(0,o.innerHeight()-o[0].clientHeight),b-=d),l<y+w?c=l-w:l+g>y+b-nt&&(c=l+g-b+nt,s&&(u(s.isRoot()||n(s.span).is(":visible"),"topNode must be visible"),a<c&&(c=a-w))),c!==null?h.effects?(h.effects.complete=function(){v.resolveWith(it)},k.stop(!0).animate({scrollTop:c},h.effects)):(k[0].scrollTop=c,v.resolveWith(this)):v.resolveWith(this),v.promise()},setActive:function(n,t){return this.tree._callHook("nodeSetActive",this,n,t)},setExpanded:function(n,t){return this.tree._callHook("nodeSetExpanded",this,n,t)},setFocus:function(n){return this.tree._callHook("nodeSetFocus",this,n)},setSelected:function(n){return this.tree._callHook("nodeSetSelected",this,n)},setStatus:function(n,t,i){return this.tree._callHook("nodeSetStatus",this,n,t,i)},setTitle:function(n){this.title=n;this.renderTitle()},sortChildren:function(n,t){var i,u,r=this.children;if(r){if(n=n||function(n,t){var i=n.title.toLowerCase(),r=t.title.toLowerCase();return i===r?0:i>r?1:-1},r.sort(n),t)for(i=0,u=r.length;i<u;i++)r[i].children&&r[i].sortChildren(n,"$norender$");t!=="$norender$"&&this.render()}},toDict:function(t,i){var u,o,f,r={},e=this;if(n.each(s,function(n,t){(e[t]||e[t]===!1)&&(r[t]=e[t])}),n.isEmptyObject(this.data)||(r.data=n.extend({},this.data),n.isEmptyObject(r.data)&&delete r.data),i&&i(r),t&&this.hasChildren())for(r.children=[],u=0,o=this.children.length;u<o;u++)f=this.children[u],f.isStatusNode()||r.children.push(f.toDict(!0,i));return r},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"<FancytreeNode(#"+this.key+", '"+this.title+"')>"},visit:function(n,t){var r,f,i=!0,u=this.children;if(t===!0&&(i=n(this),i===!1||i==="skip"))return i;if(u)for(r=0,f=u.length;r<f;r++)if(i=u[r].visit(n,!0),i===!1)break;return i},visitAndLoad:function(t,i,r){var o,u,s,f=this;return t&&i===!0&&(u=t(f),u===!1||u==="skip")?r?u:e():!f.children&&!f.lazy?e():(o=new n.Deferred,s=[],f.load().done(function(){for(var i=0,r=f.children.length;i<r;i++)if(u=f.children[i].visitAndLoad(t,!0,!0),u===!1){o.reject();break}else u!=="skip"&&s.push(u);n.when.apply(this,s).then(function(){o.resolve()})}),o.promise())},visitParents:function(n,t){if(t&&n(this)===!1)return!1;for(var i=this.parent;i;){if(n(i)===!1)return!1;i=i.parent}return!0},warn:function(){Array.prototype.unshift.call(arguments,this.toString());f("warn",arguments)}};v.prototype={_makeHookContext:function(t,i,u){var f,e;return t.node!==r?(i&&t.originalEvent!==i&&n.error("invalid args"),f=t):t.tree?(e=t.tree,f={node:t,tree:e,widget:e.widget,options:e.widget.options,originalEvent:i}):t.widget?f={node:null,tree:t,widget:t.widget,options:t.widget.options,originalEvent:i}:n.error("invalid args"),u&&n.extend(f,u),f},_callHook:function(t,i){var f=this._makeHookContext(i),r=this[t],u=Array.prototype.slice.call(arguments,2);return n.isFunction(r)||n.error("_callHook('"+t+"') is not a function"),u.unshift(f),r.apply(this,u)},_requireExtension:function(t,i,r,f){r=!!r;var e=this._local.name,s=this.options.extensions,c=n.inArray(t,s)<n.inArray(e,s),o=i&&this.ext[t]==null,h=!o&&r!=null&&r!==c;return(u(e&&e!==t),o||h)?(f||(o||i?(f="'"+e+"' extension requires '"+t+"'",h&&(f+=" to be registered "+(r?"before":"after")+" itself")):f="If used together, `"+t+"` must be registered "+(r?"before":"after")+" `"+e+"`"),n.error(f),!1):!0},activateKey:function(n){var t=this.getNodeByKey(n);return t?t.setActive():this.activeNode&&this.activeNode.setActive(!1),t},applyPatch:function(t){for(var o,r,f,s,e,c=t.length,h=[],i=0;i<c;i++)r=t[i],u(r.length===2,"patchList must be an array of length-2-arrays"),f=r[0],s=r[1],e=f===null?this.rootNode:this.getNodeByKey(f),e?(o=new n.Deferred,h.push(o),e.applyPatch(s).always(b(o,e))):this.warn("could not find node with key '"+f+"'");return n.when.apply(n,h).promise()},count:function(){return this.rootNode.countChildren()},debug:function(){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),f("debug",arguments))},generateFormElements:function(t,i,r){var f,e=t!==!1?"ft_"+this._id+"[]":t,o=i!==!1?"ft_"+this._id+"_active":i,s="fancytree_result_"+this._id,u=n("#"+s);r=typeof r=="boolean"?r:this.options.selectMode===3;u.length?u.empty():u=n("<div>",{id:s}).hide().insertAfter(this.$container);e&&(f=this.getSelectedNodes(r),n.each(f,function(t,i){u.append(n("<input>",{type:"checkbox",name:e,value:i.key,checked:!0}))}));o&&this.activeNode&&u.append(n("<input>",{type:"radio",name:o,value:this.activeNode.key,checked:!0}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getNodeByKey:function(n,t){var r,u;return!t&&(r=i.getElementById(this.options.idPrefix+n),r)?r.ftnode?r.ftnode:null:(t=t||this.rootNode,u=null,t.visit(function(t){if(t.key===n)return u=t,!1},!0),u)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(n){var t=[];return this.rootNode.visit(function(i){if(i.selected&&(t.push(i),n===!0))return"skip"}),t},hasFocus:function(){return!!this._hasFocus},info:function(){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),f("info",arguments))},loadKeyPath:function(t,i,u){function w(n,t,r){i.call(c,t,"loading");t.load().done(function(){c.loadKeyPath.call(c,o[n],i,t).always(b(r,c))}).fail(function(){c.warn("loadKeyPath: error loading: "+n+" (parent: "+s+")");i.call(c,t,"error");r.reject()})}var y,p,a,l,f,o,e,s,h,v=this.options.keyPathSeparator,c=this;for(n.isArray(t)||(t=[t]),o={},a=0;a<t.length;a++)for(s=u||this.rootNode,l=t[a],l.charAt(0)===v&&(l=l.substr(1)),h=l.split(v);h.length;)if(f=h.shift(),e=s._findDirectChild(f),e)if(h.length===0){i.call(this,e,"ok");break}else if(e.lazy&&e.hasChildren()===r){i.call(this,e,"loaded");o[f]?o[f].push(h.join(v)):o[f]=[h.join(v)];break}else i.call(this,e,"loaded"),s=e;else{this.warn("loadKeyPath: key not found: "+f+" (parent: "+s+")");i.call(this,f,"error");break}y=[];for(f in o)e=s._findDirectChild(f),p=new n.Deferred,y.push(p),w(f,e,p);return n.when.apply(n,y).promise()},reactivate:function(n){var t=this.activeNode;t&&(this.activeNode=null,t.setActive(),n&&t.setFocus())},reload:function(n){return this._callHook("treeClear",this),this._callHook("treeLoad",this,n)},render:function(n,t){return this.rootNode.render(n,t)},setFocus:function(n){return this._callHook("treeSetFocus",this,n)},toDict:function(n,t){var i=this.rootNode.toDict(!0,t);return n?i:i.children},toString:function(){return"<Fancytree(#"+this._id+")>"},_triggerNodeEvent:function(n,t,i,u){var f=this._makeHookContext(t,i,u),e=this.widget._trigger(n,i,f);return e!==!1&&f.result!==r?f.result:e},_triggerTreeEvent:function(n,t){var i=this._makeHookContext(this,t),u=this.widget._trigger(n,t,i);return u!==!1&&i.result!==r?i.result:u},visit:function(n){return this.rootNode.visit(n,!1)},warn:function(){Array.prototype.unshift.call(arguments,this.toString());f("warn",arguments)}};n.extend(v.prototype,{nodeClick:function(n){var t,i,r=n.originalEvent,u=n.targetType,f=n.node;if(u==="expander")this._callHook("nodeToggleExpanded",n);else if(u==="checkbox")this._callHook("nodeToggleSelected",n),this._callHook("nodeSetFocus",n,!0);else{if(i=!1,t=!0,f.folder)switch(n.options.clickFolderMode){case 2:i=!0;t=!1;break;case 3:t=!0;i=!0}t&&(this.nodeSetFocus(n),this._callHook("nodeSetActive",n,!0));i&&(!t,this._callHook("nodeToggleExpanded",n))}r.target.localName==="a"&&r.target.className==="fancytree-title"&&r.preventDefault()},nodeCollapseSiblings:function(n,t){var r,i,f,u=n.node;if(u.parent)for(r=u.parent.children,i=0,f=r.length;i<f;i++)r[i]!==u&&r[i].expanded&&this._callHook("nodeSetExpanded",r[i],!1,t)},nodeDblclick:function(n){n.targetType==="title"&&n.options.clickFolderMode===4&&this._callHook("nodeToggleExpanded",n);n.targetType==="title"&&n.originalEvent.preventDefault()},nodeKeydown:function(t){var s,u=t.originalEvent,f=t.node,r=t.tree,e=t.options,o=!0,h=!(u.ctrlKey||!e.autoActivate),i=n.ui.keyCode;f||(this.rootNode.getFirstChild().setFocus(),f=t.node=this.focusNode,f.debug("Keydown force focus on first node"));switch(u.which){case i.NUMPAD_ADD:case 187:r.nodeSetExpanded(t,!0);break;case i.NUMPAD_SUBTRACT:case 189:r.nodeSetExpanded(t,!1);break;case i.SPACE:e.checkbox?r.nodeToggleSelected(t):r.nodeSetActive(t,!0);break;case i.ENTER:r.nodeSetActive(t,!0);break;case i.BACKSPACE:case i.LEFT:case i.RIGHT:case i.UP:case i.DOWN:s=f.navigate(u.which,h);break;default:o=!1}o&&u.preventDefault()},nodeLoadChildren:function(t,i){var o,f,s,r=t.tree,e=t.node;return n.isFunction(i)&&(i=i()),i.url&&(o=n.extend({},t.options.ajax,i),o.debugDelay?(f=o.debugDelay,n.isArray(f)&&(f=f[0]+Math.random()*(f[1]-f[0])),e.debug("nodeLoadChildren waiting debug delay "+Math.round(f)+"ms"),o.debugDelay=!1,s=n.Deferred(function(t){setTimeout(function(){n.ajax(o).done(function(){t.resolveWith(this,arguments)}).fail(function(){t.rejectWith(this,arguments)})},f)})):s=n.ajax(o),i=new n.Deferred,s.done(function(u){var o,f;if(typeof u=="string"&&n.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),t.options.postProcess){if(f=r._triggerNodeEvent("postProcess",t,t.originalEvent,{response:u,error:null,dataType:this.dataType}),f.error){o=n.isPlainObject(f.error)?f.error:{message:f.error};o=r._makeHookContext(e,null,o);i.rejectWith(this,[o]);return}u=n.isArray(f)?f:u}else u&&u.hasOwnProperty("d")&&t.options.enableAspx&&(u=typeof u.d=="string"?n.parseJSON(u.d):u.d);i.resolveWith(this,[u])}).fail(function(n,t,u){var f=r._makeHookContext(e,null,{error:n,args:Array.prototype.slice.call(arguments),message:u,details:n.status+": "+u});i.rejectWith(this,[f])})),n.isFunction(i.promise)&&(u(!e.isLoading()),r.nodeSetStatus(t,"loading"),i.done(function(){r.nodeSetStatus(t,"ok")}).fail(function(n){var i;i=n.node&&n.error&&n.message?n:r._makeHookContext(e,null,{error:n,args:Array.prototype.slice.call(arguments),message:n?n.message||n.toString():""});r._triggerNodeEvent("loadError",i,null)!==!1&&r.nodeSetStatus(t,"error",i.message,i.details)})),n.when(i).done(function(t){var i;n.isPlainObject(t)&&(u(n.isArray(t.children),"source must contain (or be) an array of children"),u(e.isRoot(),"source may only be an object for root nodes"),i=t,t=t.children,delete i.children,n.extend(r.data,i));u(n.isArray(t),"expected array of children");e._setChildren(t);r._triggerNodeEvent("loadChildren",e)})},nodeLoadKeyPath:function(){},nodeRemoveChild:function(t,i){var f,s=t.node,o=t.options,e=n.extend({},t,{node:i}),r=s.children;if(r.length===1)return u(i===r[0]),this.nodeRemoveChildren(t);this.activeNode&&(i===this.activeNode||this.activeNode.isDescendantOf(i))&&this.activeNode.setActive(!1);this.focusNode&&(i===this.focusNode||this.focusNode.isDescendantOf(i))&&(this.focusNode=null);this.nodeRemoveMarkup(e);this.nodeRemoveChildren(e);f=n.inArray(i,r);u(f>=0);i.visit(function(n){n.parent=null},!0);this._callHook("treeRegisterNode",this,!1,i);o.removeNode&&o.removeNode.call(t.tree,{type:"removeNode"},e);r.splice(f,1)},nodeRemoveChildMarkup:function(t){var i=t.node;i.ul&&(i.isRoot()?n(i.ul).empty():(n(i.ul).remove(),i.ul=null),i.visit(function(n){n.li=n.ul=null}))},nodeRemoveChildren:function(t){var r,u=t.tree,i=t.node,e=i.children,f=t.options;e&&(this.activeNode&&this.activeNode.isDescendantOf(i)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(i)&&(this.focusNode=null),this.nodeRemoveChildMarkup(t),r=n.extend({},t),i.visit(function(n){n.parent=null;u._callHook("treeRegisterNode",u,!1,n);f.removeNode&&(r.node=n,f.removeNode.call(t.tree,{type:"removeNode"},r))}),i.children=i.lazy?[]:null,this.nodeRenderStatus(t))},nodeRemoveMarkup:function(t){var i=t.node;i.li&&(n(i.li).remove(),i.li=null);this.nodeRemoveChildMarkup(t)},nodeRender:function(t,r,f,e,o){var h,b,l,c,p,d,g,s=t.node,nt=t.tree,a=t.options,k=a.aria,tt=!1,w=s.parent,v=!w,y=s.children;if(v||w.ul){if(u(v||w.ul,"parent UL must exist"),v||(s.li&&(r||s.li.parentNode!==s.parent.ul)&&(s.li.parentNode!==s.parent.ul&&this.warn("unlink "+s+" (must be child of "+s.parent+")"),this.nodeRemoveMarkup(t)),s.li?this.nodeRenderStatus(t):(tt=!0,s.li=i.createElement("li"),s.li.ftnode=s,k,s.key&&a.generateIds&&(s.li.id=a.idPrefix+s.key),s.span=i.createElement("span"),s.span.className="fancytree-node",k&&n(s.span).attr("aria-labelledby","ftal_"+s.key),s.li.appendChild(s.span),this.nodeRenderTitle(t),a.createNode&&a.createNode.call(nt,{type:"createNode"},t)),a.renderNode&&a.renderNode.call(nt,{type:"renderNode"},t)),y){if(v||s.expanded||f===!0){for(s.ul||(s.ul=i.createElement("ul"),(e!==!0||o)&&s.expanded||(s.ul.style.display="none"),k&&n(s.ul).attr("role","group"),s.li?s.li.appendChild(s.ul):s.tree.$div.append(s.ul)),c=0,p=y.length;c<p;c++)g=n.extend({},t,{node:y[c]}),this.nodeRender(g,r,f,!1,!0);for(h=s.ul.firstChild;h;)l=h.ftnode,l&&l.parent!==s?(s.debug("_fixParent: remove missing "+l,h),d=h.nextSibling,h.parentNode.removeChild(h),h=d):h=h.nextSibling;for(h=s.ul.firstChild,c=0,p=y.length-1;c<p;c++)b=y[c],l=h.ftnode,b!==l?s.ul.insertBefore(b.li,l.li):h=h.nextSibling}}else s.ul&&(this.warn("remove child markup for "+s),this.nodeRemoveChildMarkup(t));v||tt&&w.ul.appendChild(s.li)}},nodeRenderTitle:function(n,t){var l,c,s,h,a,v,i=n.node,y=n.tree,f=n.options,o=f.aria,p=i.getLevel(),u=[],e=i.data.icon;(t!==r&&(i.title=t),i.span)&&(p<f.minExpandLevel?p>1&&(i.lazy||(i.expanded=!0),o?u.push("<span role='button' class='fancytree-expander fancytree-expander-fixed'><\/span>"):u.push("<span class='fancytree-expander fancytree-expander-fixed''><\/span>")):o?u.push("<span role='button' class='fancytree-expander'><\/span>"):u.push("<span class='fancytree-expander'><\/span>"),f.checkbox&&i.hideCheckbox!==!0&&!i.isStatusNode()&&(o?u.push("<span role='checkbox' class='fancytree-checkbox'><\/span>"):u.push("<span class='fancytree-checkbox'><\/span>")),h=o?" role='img'":"",(e===!0||e!==!1&&f.icons!==!1)&&(e&&typeof e=="string"?(e=e.charAt(0)==="/"?e:(f.imagePath||"")+e,u.push("<img src='"+e+"' class='fancytree-icon' alt='' />")):(c=f.iconClass&&f.iconClass.call(y,i,n)||i.data.iconclass||null,c?u.push("<span "+h+" class='fancytree-custom-icon "+c+"'><\/span>"):u.push("<span "+h+" class='fancytree-icon'><\/span>"))),s="",f.renderTitle&&(s=f.renderTitle.call(y,{type:"renderTitle"},n)||""),s||(v=i.tooltip?" title='"+i.tooltip.replace("'","&apos;")+"'":"",l=o?" id='ftal_"+i.key+"'":"",h=o?" role='treeitem'":"",a=f.titlesTabbable?" tabindex='0'":"",s="<span "+h+" class='fancytree-title'"+l+v+a+">"+i.title+"<\/span>"),u.push(s),i.span.innerHTML=u.join(""),this.nodeRenderStatus(n))},nodeRenderStatus:function(t){var i=t.node,s=t.tree,h=t.options,c=i.hasChildren(),o=i.isLastSibling(),f=h.aria,e=n(i.span).find(".fancytree-title"),u=h._classNames,r=[],l=i[s.statusClassPropName];l&&(r.push(u.node),s.activeNode===i&&r.push(u.active),s.focusNode===i?(r.push(u.focused),f&&e.attr("aria-activedescendant",!0)):f&&e.removeAttr("aria-activedescendant"),i.expanded?(r.push(u.expanded),f&&e.attr("aria-expanded",!0)):f&&e.removeAttr("aria-expanded"),i.folder&&r.push(u.folder),c!==!1&&r.push(u.hasChildren),o&&r.push(u.lastsib),i.lazy&&i.children==null&&r.push(u.lazy),i.partsel&&r.push(u.partsel),i._isLoading&&r.push(u.loading),i._error&&r.push(u.error),i.selected?(r.push(u.selected),f&&e.attr("aria-selected",!0)):f&&e.attr("aria-selected",!1),i.extraClasses&&r.push(i.extraClasses),c===!1?r.push(u.combinedExpanderPrefix+"n"+(o?"l":"")):r.push(u.combinedExpanderPrefix+(i.expanded?"e":"c")+(i.lazy&&i.children==null?"d":"")+(o?"l":"")),r.push(u.combinedIconPrefix+(i.expanded?"e":"c")+(i.folder?"f":"")),l.className=r.join(" "),i.li&&(i.li.className=o?u.lastsib:""))},nodeSetActive:function(t,i,r){r=r||{};var h,o=t.node,f=t.tree,c=t.options,s=r.noEvents===!0,l=o===f.activeNode;if(i=i!==!1,l===i)return e(o);if(i&&!s&&this._triggerNodeEvent("beforeActivate",o,t.originalEvent)===!1)return y(o,["rejected"]);i?(f.activeNode&&(u(f.activeNode!==o,"node was active (inconsistency)"),h=n.extend({},t,{node:f.activeNode}),f.nodeSetActive(h,!1),u(f.activeNode===null,"deactivate was out of sync?")),c.activeVisible&&o.makeVisible({scrollIntoView:!1}),f.activeNode=o,f.nodeRenderStatus(t),f.nodeSetFocus(t),s||f._triggerNodeEvent("activate",o,t.originalEvent)):(u(f.activeNode===o,"node was not active (inconsistency)"),f.activeNode=null,this.nodeRenderStatus(t),s||t.tree._triggerNodeEvent("deactivate",o,t.originalEvent))},nodeSetExpanded:function(t,i,u){u=u||{};var h,s,c,p,a,w,f=t.node,b=t.tree,o=t.options,l=u.noAnimation===!0,v=u.noEvents===!0;if(i=i!==!1,f.expanded&&i||!f.expanded&&!i)return e(f);if(!i||f.lazy||f.hasChildren()){if(!i&&f.getLevel()<o.minExpandLevel)return y(f,["locked"]);if(!v&&this._triggerNodeEvent("beforeExpand",f,t.originalEvent)===!1)return y(f,["rejected"])}else return e(f);if(l||f.isVisible()||(l=u.noAnimation=!0),s=new n.Deferred,i&&!f.expanded&&o.autoCollapse){a=f.getParentList(!1,!0);w=o.autoCollapse;try{for(o.autoCollapse=!1,c=0,p=a.length;c<p;c++)this._callHook("nodeCollapseSiblings",a[c],u)}finally{o.autoCollapse=w}}return s.done(function(){i&&o.autoScroll&&!l?f.getLastChild().scrollIntoView(!0,{topNode:f}).always(function(){v||t.tree._triggerNodeEvent(i?"expand":"collapse",t)}):v||t.tree._triggerNodeEvent(i?"expand":"collapse",t)}),h=function(r){var u,e,s,h;if(f.expanded=i,b._callHook("nodeRender",t,!1,!1,!0),f.ul)if(s=f.ul.style.display!=="none",h=!!f.expanded,s===h)f.warn("nodeSetExpanded: UL.style.display already set");else if(!o.fx||l)f.ul.style.display=f.expanded||!parent?"":"none";else{u=o.fx.duration||200;e=o.fx.easing;n(f.ul).animate(o.fx,u,e,function(){r()});return}r()},i&&f.lazy&&f.hasChildren()===r?f.load().done(function(){s.notifyWith&&s.notifyWith(f,["loaded"]);h(function(){s.resolveWith(f)})}).fail(function(n){h(function(){s.rejectWith(f,["load failed ("+n+")"])})}):h(function(){s.resolveWith(f)}),s.promise()},nodeSetFocus:function(t,i){var f,r=t.tree,u=t.node;if(i=i!==!1,r.focusNode){if(r.focusNode===u&&i)return;f=n.extend({},t,{node:r.focusNode});r.focusNode=null;this._triggerNodeEvent("blur",f);this._callHook("nodeRenderStatus",f)}i&&(this.hasFocus()||(u.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",t,!0,!0)),u.makeVisible({scrollIntoView:!1}),r.focusNode=u,this._triggerNodeEvent("focus",t),t.options.autoScroll&&u.scrollIntoView(),this._callHook("nodeRenderStatus",t))},nodeSetSelected:function(n,t){var i=n.node,r=n.tree,u=n.options;if(t=t!==!1,i.debug("nodeSetSelected("+t+")",n),!i.unselectable){if(i.selected&&t||!i.selected&&!t||this._triggerNodeEvent("beforeSelect",i,n.originalEvent)===!1)return!!i.selected;t&&u.selectMode===1?r.lastSelectedNode&&r.lastSelectedNode.setSelected(!1):u.selectMode===3&&(i.selected=t,i.fixSelection3AfterClick());i.selected=t;this.nodeRenderStatus(n);r.lastSelectedNode=t?i:null;r._triggerNodeEvent("select",n)}},nodeSetStatus:function(t,i,r,u){function s(){var n=f.children?f.children[0]:null;if(n&&n.isStatusNode()){try{f.ul&&(f.ul.removeChild(n.li),n.li=null)}catch(t){}f.children.length===1?f.children=[]:f.children.shift()}}function o(t,i){var r=f.children?f.children[0]:null;return r&&r.isStatusNode()?(n.extend(r,t),r.statusNodeType=i,e._callHook("nodeRender",r),e._callHook("nodeRenderTitle",r)):(t.key="_statusNode",f._setChildren([t]),f.children[0].statusNodeType=i,e.render()),f.children[0]}var f=t.node,e=t.tree;switch(i){case"ok":s();f._isLoading=!1;f._error=null;f.renderStatus();break;case"loading":f.parent||o({title:e.options.strings.loading+(r?" ("+r+") ":""),tooltip:u,extraClasses:"fancytree-statusnode-wait"},i);f._isLoading=!0;f._error=null;f.renderStatus();break;case"error":o({title:e.options.strings.loadError+(r?" ("+r+") ":""),tooltip:u,extraClasses:"fancytree-statusnode-error"},i);f._isLoading=!1;f._error={message:r,details:u};f.renderStatus();break;default:n.error("invalid node status "+i)}},nodeToggleExpanded:function(n){return this.nodeSetExpanded(n,!n.node.expanded)},nodeToggleSelected:function(n){return this.nodeSetSelected(n,!n.node.selected)},treeClear:function(n){var t=n.tree;t.activeNode=null;t.focusNode=null;t.$div.find(">ul.fancytree-container").empty();t.rootNode.children=null},treeCreate:function(){},treeDestroy:function(){},treeInit:function(n){this.treeLoad(n)},treeLoad:function(t,i){var f,u,r=t.tree,e=t.widget.element,o=n.extend({},t,{node:this.rootNode});if(r.rootNode.children&&this.treeClear(t),i=i||this.options.source,i)typeof i=="string"&&nt();else{f=e.data("type")||"html";switch(f){case"html":u=e.find(">ul:first");u.addClass("ui-fancytree-source ui-helper-hidden");i=n.ui.fancytree.parseHtml(u);this.data=n.extend(this.data,p(u));break;case"json":i=n.parseJSON(e.text());i.children&&(i.title&&(r.title=i.title),i=i.children);break;default:n.error("Invalid data-type: "+f)}}return this.nodeLoadChildren(o,i).done(function(){r.render();t.options.selectMode===3&&r.rootNode.fixSelection3FromEndNodes();r._triggerTreeEvent("init",!0)}).fail(function(){r.render();r._triggerTreeEvent("init",!1)})},treeRegisterNode:function(){},treeSetFocus:function(n,t){t=t!==!1;t!==this.hasFocus()&&(this._hasFocus=t,this.$container.toggleClass("fancytree-treefocus",t),this._triggerTreeEvent(t?"focusTree":"blurTree"))}});n.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!1,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,extensions:[],fx:{height:"toggle",duration:200},generateIds:!1,icons:!0,id:null,idPrefix:"ft_",keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,scrollOfs:{top:0,bottom:0},scrollParent:null,selectMode:2,strings:{loading:"Loading&#8230;",loadError:"Load error!"},tabbable:!0,titlesTabbable:!1,_classNames:{node:"fancytree-node",folder:"fancytree-folder",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused",partsel:"fancytree-partsel",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error"},lazyLoad:null,postProcess:null},_create:function(){this.tree=new v(this);this.$source=this.source||this.element.data("type")==="json"?this.element:this.element.find(">ul:first");for(var i,t,e=this.options.extensions,o=this.tree,f=0;f<e.length;f++)t=e[f],i=n.ui.fancytree._extensions[t],i||n.error("Could not apply extension '"+t+"' (it is not registered, did you forget to include it?)"),this.tree.options[t]=n.extend(!0,{},i.options,this.tree.options[t]),u(this.tree.ext[t]===r,"Extension name must not exist as Fancytree.ext attribute: '"+t+"'"),this.tree.ext[t]={},rt(this.tree,o,i,t),o=i;this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree);this._bind()},_setOption:function(t,i){var r=!0,u=!1;switch(t){case"aria":case"checkbox":case"icons":case"minExpandLevel":case"tabbable":this.tree._callHook("treeCreate",this.tree);u=!0;break;case"source":r=!1;this.tree._callHook("treeLoad",this.tree,i)}this.tree.debug("set option "+t+"="+i+" <"+typeof i+">");r&&n.Widget.prototype._setOption.apply(this,arguments);u&&this.tree.render(!0,!1)},destroy:function(){this._unbind();this.tree._callHook("treeDestroy",this.tree);this.tree.$div.find(">ul.fancytree-container").remove();this.$source&&this.$source.removeClass("ui-helper-hidden");n.Widget.prototype.destroy.call(this)},_unbind:function(){var t=this.tree._ns;this.element.unbind(t);this.tree.$container.unbind(t);n(i).unbind(t)},_bind:function(){var r=this,i=this.options,n=this.tree,t=n._ns;this._unbind();n.$container.on("focusin"+t+" focusout"+t,function(t){var i=h.getNode(t),r=t.type==="focusin";i?n._callHook("nodeSetFocus",i,r):n._callHook("treeSetFocus",n,r)}).on("selectstart"+t,"span.fancytree-title",function(n){n.preventDefault()}).on("keydown"+t,function(t){if(i.disabled||i.keyboard===!1)return!0;var r,u=n.focusNode,f=n._makeHookContext(u||n,t),e=n.phase;try{return n.phase="userEvent",r=u?n._triggerNodeEvent("keydown",u,t):n._triggerTreeEvent("keydown",t),r==="preventNav"?r=!0:r!==!1&&(r=n._callHook("nodeKeydown",f)),r}finally{n.phase=e}}).on("click"+t+" dblclick"+t,function(n){if(i.disabled)return!0;var u,f=h.getEventTarget(n),e=f.node,t=r.tree,o=t.phase;if(!e)return!0;u=t._makeHookContext(e,n);try{t.phase="userEvent";switch(n.type){case"click":return u.targetType=f.type,t._triggerNodeEvent("click",u,n)===!1?!1:t._callHook("nodeClick",u);case"dblclick":return u.targetType=f.type,t._triggerNodeEvent("dblclick",u,n)===!1?!1:t._callHook("nodeDblclick",u)}}finally{t.phase=o}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(n){return this.tree.getNodeByKey(""+n)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}});h=n.ui.fancytree;n.extend(n.ui.fancytree,{version:"2.4.1",buildType:"production",debugLevel:1,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:v,_FancytreeNodeClass:c,jquerySupports:{positionMyOfs:it(n.ui.version,1,9)},assert:function(n,t){return u(n,t)},debounce:function(n,t,i,r){var u;return arguments.length===3&&typeof i!="boolean"&&(r=i,i=!1),function(){var f=arguments;r=r||this;i&&!u&&t.apply(r,f);clearTimeout(u);u=setTimeout(function(){i||t.apply(r,f);u=null},n)}},debug:function(){n.ui.fancytree.debugLevel>=2&&f("log",arguments)},error:function(){f("error",arguments)},escapeHtml:function(n){return(""+n).replace(/[&<>"'\/]/g,function(n){return ut[n]})},unescapeHtml:function(n){var t=i.createElement("div");return t.innerHTML=n,t.childNodes.length===0?"":t.childNodes[0].nodeValue},getEventTargetType:function(n){return this.getEventTarget(n).type},getEventTarget:function(t){var u=t&&t.target?t.target.className:"",i={node:this.getNode(t.target),type:r};return/\bfancytree-title\b/.test(u)?i.type="title":/\bfancytree-expander\b/.test(u)?i.type=i.node.hasChildren()===!1?"prefix":"expander":/\bfancytree-checkbox\b/.test(u)||/\bfancytree-radio\b/.test(u)?i.type="checkbox":/\bfancytree-icon\b/.test(u)?i.type="icon":/\bfancytree-node\b/.test(u)?i.type="title":t&&t.target&&n(t.target).closest(".fancytree-title").length&&(i.type="title"),i},getNode:function(n){if(n instanceof c)return n;for(n.selector!==r?n=n[0]:n.originalEvent!==r&&(n=n.target);n;){if(n.ftnode)return n.ftnode;n=n.parentNode}return null},info:function(){n.ui.fancytree.debugLevel>=1&&f("info",arguments)},parseHtml:function(t){var o,i,f,h,u,c,a,e,y=t.find(">li"),v=[];return y.each(function(){var b,w=n(this),g=w.find(">span:first",this),k=g.length?null:w.find(">a:first"),y={tooltip:null,data:{}};for(g.length?y.title=g.html():k&&k.length?(y.title=k.html(),y.data.href=k.attr("href"),y.data.target=k.attr("target"),y.tooltip=k.attr("title")):(y.title=w.html(),h=y.title.search(/<ul/i),h>=0&&(y.title=y.title.substring(0,h))),y.title=n.trim(y.title),i=0,f=l.length;i<f;i++)y[l[i]]=r;for(a=this.className.split(" "),o=[],i=0,f=a.length;i<f;i++)e=a[i],d[e]?y[e]=!0:o.push(e);if(y.extraClasses=o.join(" "),u=w.attr("title"),u&&(y.tooltip=u),u=w.attr("id"),u&&(y.key=u),b=p(w),b&&!n.isEmptyObject(b)){for(i=0,f=s.length;i<f;i++)u=s[i],c=b[u],c!=null&&(delete b[u],y[u]=c);n.extend(y.data,b)}t=w.find(">ul:first");y.children=t.length?n.ui.fancytree.parseHtml(t):y.lazy?r:null;v.push(y)}),v},registerExtension:function(t){u(t.name!=null,"extensions must have a `name` property.");u(t.version!=null,"extensions must have a `version` property.");n.ui.fancytree._extensions[t.name]=t},warn:function(){f("warn",arguments)}})}(jQuery,window,document),function(n){"use strict";n.ui.fancytree._FancytreeClass.prototype.countSelected=function(n){var t=this,i=t.options;return t.getSelectedNodes(n).length};n.ui.fancytree._FancytreeNodeClass.prototype.toUpper=function(){var n=this;return n.setTitle(n.title.toUpperCase())};n.ui.fancytree.prototype.widgetMethod1=function(n){var t=this.tree;return n};n.ui.fancytree.registerExtension({name:"childcounter",version:"1.0.0",options:{deep:!0,hideZeros:!0,hideExpanded:!1},foo:42,_appendCounter:function(){var n=this},treeInit:function(n){var t=this,i=n.options,r=n.options.childcounter;this._super(n);this.$container.addClass("fancytree-ext-childcounter")},treeDestroy:function(n){this._super(n)},nodeRenderTitle:function(t,i){var r=t.node,u=t.options.childcounter,f=r.data.childCounter==null?r.countChildren(u.deep):+r.data.childCounter;this._super(t,i);!f&&u.hideZeros||r.isExpanded()&&u.hideExpanded||n("span.fancytree-icon",r.span).append(n("<span class='fancytree-childcounter'/>").text(f))},nodeSetExpanded:function(n,t,i){var r=n.tree,u=n.node;return this._super(n,t,i).always(function(){r.nodeRenderTitle(n)})}})}(jQuery),function(n){"use strict";function i(n,t){for(var i=n.length-1;i>=0;i--)if(n[i]===t)return n.splice(i,1),!0;return!1}function r(n,t,i){for(var s,r,h=n.length&3,c=n.length-h,u=i,e=3432918353,o=461845907,f=0;f<c;)r=n.charCodeAt(f)&255|(n.charCodeAt(++f)&255)<<8|(n.charCodeAt(++f)&255)<<16|(n.charCodeAt(++f)&255)<<24,++f,r=(r&65535)*e+(((r>>>16)*e&65535)<<16)&4294967295,r=r<<15|r>>>17,r=(r&65535)*o+(((r>>>16)*o&65535)<<16)&4294967295,u^=r,u=u<<13|u>>>19,s=(u&65535)*5+(((u>>>16)*5&65535)<<16)&4294967295,u=(s&65535)+27492+(((s>>>16)+58964&65535)<<16);r=0;switch(h){case 3:r^=(n.charCodeAt(f+2)&255)<<16;case 2:r^=(n.charCodeAt(f+1)&255)<<8;case 1:r^=n.charCodeAt(f)&255;r=(r&65535)*e+(((r>>>16)*e&65535)<<16)&4294967295;r=r<<15|r>>>17;r=(r&65535)*o+(((r>>>16)*o&65535)<<16)&4294967295;u^=r}return(u^=n.length,u^=u>>>16,u=(u&65535)*2246822507+(((u>>>16)*2246822507&65535)<<16)&4294967295,u^=u>>>13,u=(u&65535)*3266489909+(((u>>>16)*3266489909&65535)<<16)&4294967295,u^=u>>>16,t)?("0000000"+(u>>>0).toString(16)).substr(-8):u>>>0}function u(t){var u,i=n.map(t.getParentList(!1,!0),function(n){return n.refKey||n.key});return i=i.join("/"),u="id_"+r(i,!0),t.debug(i+" -> "+u),u}var t=n.ui.fancytree.assert;n.ui.fancytree._FancytreeNodeClass.prototype.getCloneList=function(t){var r,u=this.tree,i=u.refMap[this.refKey]||null,f=u.keyMap;return i&&(r=this.key,t?i=n.map(i,function(n){return f[n]}):(i=n.map(i,function(n){return n===r?null:f[n]}),i.length<1&&(i=null))),i};n.ui.fancytree._FancytreeNodeClass.prototype.isClone=function(){var n=this.refKey||null,t=n&&this.tree.refMap[n]||null;return!!(t&&t.length>1)};n.ui.fancytree._FancytreeNodeClass.prototype.reRegister=function(t,i){t=t==null?null:""+t;i=i==null?null:""+i;this.debug("reRegister",t,i);var h=this.tree,e=this.key,f=this.refKey,o=h.keyMap,r=h.refMap,u=r[f]||null,s=!1;return t!=null&&t!==this.key&&(o[t]&&n.error("[ext-clones] reRegister("+t+"): already exists: "+this),delete o[e],o[t]=this,u&&(r[f]=n.map(u,function(n){return n===e?t:n})),this.key=t,s=!0),i!=null&&i!==this.refKey&&(u&&(u.length===1?delete r[f]:r[f]=n.map(u,function(n){return n===e?null:n})),r[i]?r[i].append(t):r[i]=[this.key],this.refKey=i,s=!0),s};n.ui.fancytree._FancytreeClass.prototype.getNodesByRef=function(t,i){var u=this.keyMap,r=this.refMap[t]||null;return r&&(r=i?n.map(r,function(n){var t=u[n];return t.isDescendantOf(i)?t:null}):n.map(r,function(n){return u[n]}),r.length<1&&(r=null)),r};n.ui.fancytree._FancytreeClass.prototype.changeRefKey=function(n,t){var i,u,f=this.keyMap,r=this.refMap[n]||null;if(r){for(i=0;i<r.length;i++)u=f[r[i]],u.refKey=t;delete this.refMap[n];this.refMap[t]=r}};n.ui.fancytree.registerExtension({name:"clones",version:"0.0.3",options:{highlightActiveClones:!0,highlightClones:!1},treeCreate:function(n){this._super(n);n.tree.refMap={};n.tree.keyMap={}},treeInit:function(n){this.$container.addClass("fancytree-ext-clones");t(n.options.defaultKey==null);n.options.defaultKey=function(n){return u(n)};this._super(n)},treeClear:function(n){return n.tree.refMap={},n.tree.keyMap={},this._super(n)},treeRegisterNode:function(r,u,f){var e,l,a=r.tree,c=a.keyMap,h=a.refMap,s=f.key,o=f&&f.refKey!=null?""+f.refKey:null;return s==="_statusNode"?this._super(r,u,f):(u?(c[f.key]!=null&&n.error("clones.treeRegisterNode: node.key already exists: "+f),c[s]=f,o&&(e=h[o],e?(e.push(s),e.length===2&&r.options.clones.highlightClones&&c[e[0]].renderStatus()):h[o]=[s],f.debug("clones.treeRegisterNode: add clone =>",h[o]))):(c[s]==null&&n.error("clones.treeRegisterNode: node.key not registered: "+f.key),delete c[s],o&&(e=h[o],f.debug("clones.treeRegisterNode: remove clone BEFORE =>",h[o]),e&&(l=e.length,l<=1?(t(l===1),t(e[0]===s),delete h[o]):(i(e,s),l===2&&r.options.clones.highlightClones&&c[e[0]].renderStatus()),f.debug("clones.treeRegisterNode: remove clone =>",h[o])))),this._super(r,u,f))},nodeRenderStatus:function(t){var i,r,u=t.node;return r=this._super(t),t.options.clones.highlightClones&&(i=n(u[t.tree.statusClassPropName]),i.length&&u.isClone()&&i.addClass("fancytree-clone")),r},nodeSetActive:function(t,i){var r,f=t.tree.statusClassPropName,u=t.node;return r=this._super(t,i),t.options.clones.highlightActiveClones&&u.isClone()&&n.each(u.getCloneList(!0),function(t,r){r.debug("clones.nodeSetActive: ",i!==!1);n(r[f]).toggleClass("fancytree-active-clone",i!==!1)}),r}})}(jQuery,window,document),function(n,t,i,r){"use strict";function e(n){return n===0?"":n>0?"+"+n:""+n}function o(t){var i=t.options.dnd||null;i&&s();i&&i.dragStart&&t.widget.element.draggable(n.extend({addClasses:!1,appendTo:"body",containment:!1,delay:0,distance:4,revert:!1,scroll:!0,scrollSpeed:7,scrollSensitivity:10,connectToFancytree:!0,helper:function(t){var i=n.ui.fancytree.getNode(t.target);return i?i.tree.ext.dnd._onDragEvent("helper",i,null,t,null,null):"<div>ERROR?: helper requested but sourceNode not found<\/div>"},start:function(n,t){var i=t.helper.data("ftSourceNode");return!!i}},t.options.dnd.draggable));i&&i.dragDrop&&t.widget.element.droppable(n.extend({addClasses:!1,tolerance:"intersect",greedy:!1},t.options.dnd.droppable))}function s(){f||(n.ui.plugin.add("draggable","connectToFancytree",{start:function(t,i){var r=n(this).data("ui-draggable")||n(this).data("draggable"),u=i.helper.data("ftSourceNode")||null;if(u)return r.offset.click.top=-2,r.offset.click.left=16,u.tree.ext.dnd._onDragEvent("start",u,null,t,i,r)},drag:function(t,i){var s,e=n(this).data("ui-draggable")||n(this).data("draggable"),o=i.helper.data("ftSourceNode")||null,f=i.helper.data("ftTargetNode")||null,r=n.ui.fancytree.getNode(t.target);if(t.target&&!r&&(s=n(t.target).closest("div.fancytree-drag-helper,#fancytree-drop-marker").length>0,s)){u("Drag event over helper: ignored.");return}i.helper.data("ftTargetNode",r);f&&f!==r&&f.tree.ext.dnd._onDragEvent("leave",f,o,t,i,e);r&&r.tree.options.dnd.dragDrop&&(r===f?r.tree.ext.dnd._onDragEvent("over",r,o,t,i,e):r.tree.ext.dnd._onDragEvent("enter",r,o,t,i,e))},stop:function(t,i){var e=n(this).data("ui-draggable")||n(this).data("draggable"),r=i.helper.data("ftSourceNode")||null,f=i.helper.data("ftTargetNode")||null,s=t.type,o=s==="mouseup"&&t.which===1;o||u("Drag was cancelled");f&&(o&&f.tree.ext.dnd._onDragEvent("drop",f,r,t,i,e),f.tree.ext.dnd._onDragEvent("leave",f,r,t,i,e));r&&r.tree.ext.dnd._onDragEvent("stop",r,null,t,i,e)}}),f=!0)}var u=n.ui.fancytree.debug,f=!1;n.ui.fancytree.registerExtension({name:"dnd",version:"0.1.0",options:{dragStart:null,dragStop:null,autoExpandMS:1e3,preventVoidMoves:!0,preventRecursiveMoves:!0,focusOnClick:!1,dragEnter:null,dragOver:null,dragDrop:null,dragLeave:null,draggable:null,droppable:null},treeInit:function(t){var i=t.tree;if(this._super(t),i.options.dnd.dragStart)i.$container.on("mousedown",function(r){if(!i.hasFocus()&&t.options.dnd.focusOnClick){var u=n.ui.fancytree.getNode(r);u.debug("Re-enable focus that was prevented by jQuery UI draggable.");n(r.target).closest(":tabbable").focus()}});o(i)},nodeKeydown:function(t){var i=t.originalEvent;return i.which===n.ui.keyCode.ESCAPE&&this._local._cancelDrag(),this._super(t)},nodeClick:function(n){return this._super(n)},_setDndStatus:function(t,i,r,u,f){var a,l=0,c="center",h=this._local,s=t?n(t.span):null,o=n(i.span);if(h.$dropMarker||(h.$dropMarker=n("<div id='fancytree-drop-marker'><\/div>").hide().css({"z-index":1e3}).prependTo(n(this.$div).parent())),u==="after"||u==="before"||u==="over"){switch(u){case"before":h.$dropMarker.removeClass("fancytree-drop-after fancytree-drop-over").addClass("fancytree-drop-before");c="top";break;case"after":h.$dropMarker.removeClass("fancytree-drop-before fancytree-drop-over").addClass("fancytree-drop-after");c="bottom";break;default:h.$dropMarker.removeClass("fancytree-drop-after fancytree-drop-before").addClass("fancytree-drop-over");o.addClass("fancytree-drop-target");l=8}a=n.ui.fancytree.jquerySupports.positionMyOfs?{my:"left"+e(l)+" center",at:"left "+c,of:o}:{my:"left center",at:"left "+c,of:o,offset:""+l+" 0"};h.$dropMarker.show().position(a)}else o.removeClass("fancytree-drop-target"),h.$dropMarker.hide();u==="after"?o.addClass("fancytree-drop-after"):o.removeClass("fancytree-drop-after");u==="before"?o.addClass("fancytree-drop-before"):o.removeClass("fancytree-drop-before");f===!0?(s&&s.addClass("fancytree-drop-accept"),o.addClass("fancytree-drop-accept"),r.addClass("fancytree-drop-accept")):(s&&s.removeClass("fancytree-drop-accept"),o.removeClass("fancytree-drop-accept"),r.removeClass("fancytree-drop-accept"));f===!1?(s&&s.addClass("fancytree-drop-reject"),o.addClass("fancytree-drop-reject"),r.addClass("fancytree-drop-reject")):(s&&s.removeClass("fancytree-drop-reject"),o.removeClass("fancytree-drop-reject"),r.removeClass("fancytree-drop-reject"))},_onDragEvent:function(t,i,f,e,o,s){t!=="over"&&u("tree.ext.dnd._onDragEvent(%s, %o, %o) - %o",t,i,f,this);var b,k,d,w,a,h,l,g=this.options,c=g.dnd,y=this._makeHookContext(i,e,{otherNode:f,ui:o,draggable:s}),v=null,p=n(i.span);switch(t){case"helper":b=n("<div class='fancytree-drag-helper'><span class='fancytree-drag-helper-img' /><\/div>").css({zIndex:3,position:"relative"}).append(p.find("span.fancytree-title").clone());n("ul.fancytree-container",i.tree.$div).append(b);b.data("ftSourceNode",i);v=b;break;case"start":i.isStatusNode()?v=!1:c.dragStart&&(v=c.dragStart(i,y));v===!1?(this.debug("tree.dragStart() cancelled"),o.helper.trigger("mouseup").hide()):p.addClass("fancytree-drag-source");break;case"enter":l=c.preventRecursiveMoves&&i.isDescendantOf(f)?!1:c.dragEnter?c.dragEnter(i,y):null;v=l?n.isArray(l)?{over:n.inArray("over",l)>=0,before:n.inArray("before",l)>=0,after:n.inArray("after",l)>=0}:{over:l===!0||l==="over",before:l===!0||l==="before",after:l===!0||l==="after"}:!1;o.helper.data("enterResponse",v);u("helper.enterResponse: %o",v);break;case"over":a=o.helper.data("enterResponse");h=null;a===!1||(typeof a=="string"?h=a:(k=p.offset(),d={x:e.pageX-k.left,y:e.pageY-k.top},w={x:d.x/p.width(),y:d.y/p.height()},a.after&&w.y>.75?h="after":!a.over&&a.after&&w.y>.5?h="after":a.before&&w.y<=.25?h="before":!a.over&&a.before&&w.y<=.5?h="before":a.over&&(h="over"),c.preventVoidMoves&&(i===f?(u("    drop over source node prevented"),h=null):h==="before"&&f&&i===f.getNextSibling()?(u("    drop after source node prevented"),h=null):h==="after"&&f&&i===f.getPrevSibling()?(u("    drop before source node prevented"),h=null):h==="over"&&f&&f.parent===i&&f.isLastSibling()&&(u("    drop last child over own parent prevented"),h=null)),o.helper.data("hitMode",h)));h==="over"&&c.autoExpandMS&&i.hasChildren()!==!1&&!i.expanded&&i.scheduleAction("expand",c.autoExpandMS);h&&c.dragOver&&(y.hitMode=h,v=c.dragOver(i,y));this._local._setDndStatus(f,i,o.helper,h,v!==!1&&h!==null);break;case"drop":h=o.helper.data("hitMode");h&&c.dragDrop&&(y.hitMode=h,c.dragDrop(i,y));break;case"leave":i.scheduleAction("cancel");o.helper.data("enterResponse",null);o.helper.data("hitMode",null);this._local._setDndStatus(f,i,o.helper,"out",r);c.dragLeave&&c.dragLeave(i,y);break;case"stop":p.removeClass("fancytree-drag-source");c.dragStop&&c.dragStop(i,y);break;default:n.error("Unsupported drag event: "+t)}return v},_cancelDrag:function(){var t=n.ui.ddmanager.current;t&&t.cancel()}})}(jQuery,window,document),function(n,t,i){"use strict";var r=/Mac/.test(navigator.platform),u=n.ui.fancytree.escapeHtml,f=n.ui.fancytree.unescapeHtml;n.ui.fancytree._FancytreeNodeClass.prototype.editStart=function(){var r,t=this,e=this.tree,o=e.ext.edit,u=e.options.edit,h=n(".fancytree-title",t.span),s={node:t,tree:e,options:e.options,isNew:n(t.span).hasClass("fancytree-edit-new"),orgTitle:t.title,input:null,dirty:!1};if(n.ui.fancytree.assert(!o.currentNode,"recursive edit"),o.currentNode=this,o.eventData=s,u.beforeEdit.call(t,{type:"beforeEdit"},s)===!1)return!1;e.widget._unbind();n(i).on("mousedown.fancytree-edit",function(i){n(i.target).hasClass("fancytree-edit-input")||t.editEnd(!0,i)});r=n("<input />",{"class":"fancytree-edit-input",value:f(s.orgTitle)});o.eventData.input=r;u.adjustWidthOfs!=null&&r.width(h.width()+u.adjustWidthOfs);u.inputCss!=null&&r.css(u.inputCss);h.html(r);r.focus().change(function(){r.addClass("fancytree-edit-dirty")}).keydown(function(i){switch(i.which){case n.ui.keyCode.ESCAPE:t.editEnd(!1,i);break;case n.ui.keyCode.ENTER:return t.editEnd(!0,i),!1}i.stopPropagation()}).blur(function(n){return t.editEnd(!0,n)});u.edit.call(t,{type:"edit"},s)};n.ui.fancytree._FancytreeNodeClass.prototype.editEnd=function(t){var e,f=this,s=this.tree,o=s.ext.edit,r=o.eventData,h=s.options.edit,l=n(".fancytree-title",f.span),c=l.find("input.fancytree-edit-input");return(h.trim&&c.val(n.trim(c.val())),e=c.val(),r.dirty=e!==f.title,r.save=t===!1?!1:r.isNew?e!=="":r.dirty&&e!=="",h.beforeClose.call(f,{type:"beforeClose"},r)===!1)?!1:r.save&&h.save.call(f,{type:"save"},r)===!1?!1:(c.removeClass("fancytree-edit-dirty").unbind(),n(i).off(".fancytree-edit"),r.save?(f.setTitle(u(e)),f.setFocus()):r.isNew?(f.remove(),f=r.node=null,o.relatedNode.setFocus()):(f.renderTitle(),f.setFocus()),o.eventData=null,o.currentNode=null,o.relatedNode=null,s.widget._bind(),n(s.$container).focus(),r.input=null,h.close.call(f,{type:"close"},r),!0)};n.ui.fancytree._FancytreeNodeClass.prototype.editCreateNode=function(t,i){var r,u=this;if(t=t||"child",i==null?i={title:""}:typeof i=="string"?i={title:i}:n.ui.fancytree.assert(n.isPlainObject(i)),t==="child"&&!this.isExpanded()&&this.hasChildren()!==!1){this.setExpanded().done(function(){u.editCreateNode(t,i)});return}r=this.addNode(i,t);r.makeVisible();n(r.span).addClass("fancytree-edit-new");this.tree.ext.edit.relatedNode=this;r.editStart()};n.ui.fancytree._FancytreeClass.prototype.isEditing=function(){return this.ext.edit.currentNode};n.ui.fancytree._FancytreeNodeClass.prototype.isEditing=function(){return this.tree.ext.edit.currentNode===this};n.ui.fancytree.registerExtension({name:"edit",version:"0.2.0",options:{adjustWidthOfs:4,allowEmpty:!1,inputCss:{minWidth:"3em"},triggerCancel:["esc","tab","click"],triggerStart:["f2","shift+click","mac+enter"],trim:!0,beforeClose:n.noop,beforeEdit:n.noop,close:n.noop,edit:n.noop,save:n.noop},currentNode:null,treeInit:function(n){this._super(n);this.$container.addClass("fancytree-ext-edit")},nodeClick:function(t){return n.inArray("shift+click",t.options.edit.triggerStart)>=0&&t.originalEvent.shiftKey?(t.node.editStart(),!1):this._super(t)},nodeDblclick:function(t){return n.inArray("dblclick",t.options.edit.triggerStart)>=0?(t.node.editStart(),!1):this._super(t)},nodeKeydown:function(t){switch(t.originalEvent.which){case 113:if(n.inArray("f2",t.options.edit.triggerStart)>=0)return t.node.editStart(),!1;break;case n.ui.keyCode.ENTER:if(n.inArray("mac+enter",t.options.edit.triggerStart)>=0&&r)return t.node.editStart(),!1}return this._super(t)}})}(jQuery,window,document),function(n){"use strict";function t(n){return(n+"").replace(/([.?*+\^\$\[\]\\(){}|-])/g,"\\$1")}n.ui.fancytree._FancytreeClass.prototype._applyFilterImpl=function(n,i,r){var u,f,e=0,o=this.options.filter.mode==="hide";return r=!!r&&!i,typeof n=="string"&&(u=t(n),f=new RegExp(".*"+u+".*","i"),n=function(n){return!!f.exec(n.title)}),this.enableFilter=!0,this.$div.addClass("fancytree-ext-filter"),o?this.$div.addClass("fancytree-ext-filter-hide"):this.$div.addClass("fancytree-ext-filter-dimm"),this.visit(function(n){delete n.match;delete n.subMatch}),this.visit(function(t){if((!r||t.children==null)&&n(t)&&(e++,t.match=!0,t.visitParents(function(n){n.subMatch=!0}),i))return t.visit(function(n){n.match=!0}),"skip"}),this.render(),e};n.ui.fancytree._FancytreeClass.prototype.filterNodes=function(n,t){return this._applyFilterImpl(n,!1,t)};n.ui.fancytree._FancytreeClass.prototype.applyFilter=function(){return this.warn("Fancytree.applyFilter() is deprecated since 2014-05-10. Use .filterNodes() instead."),this.filterNodes.apply(this,arguments)};n.ui.fancytree._FancytreeClass.prototype.filterBranches=function(n){return this._applyFilterImpl(n,!0,null)};n.ui.fancytree._FancytreeClass.prototype.clearFilter=function(){this.visit(function(n){delete n.match;delete n.subMatch});this.enableFilter=!1;this.$div.removeClass("fancytree-ext-filter fancytree-ext-filter-dimm fancytree-ext-filter-hide");this.render()};n.ui.fancytree.registerExtension({name:"filter",version:"0.2.0",options:{mode:"dimm"},treeInit:function(n){this._super(n)},nodeRenderStatus:function(t){var r,i=t.node,u=t.tree,f=n(i[u.statusClassPropName]);return(r=this._super(t),!f.length||!u.enableFilter)?r:(f.toggleClass("fancytree-match",!!i.match).toggleClass("fancytree-submatch",!!i.subMatch).toggleClass("fancytree-hide",!(i.match||i.subMatch)),r)}})}(jQuery,window,document),function(n){"use strict";function t(n,t){return n.map[t]}n.ui.fancytree.registerExtension({name:"glyph",version:"0.2.0",options:{map:{checkbox:"icon-check-empty",checkboxSelected:"icon-check",checkboxUnknown:"icon-check icon-muted",error:"icon-exclamation-sign",expanderClosed:"icon-caret-right",expanderLazy:"icon-angle-right",expanderOpen:"icon-caret-down",doc:"icon-file-alt",noExpander:"",docOpen:"icon-file-alt",loading:"icon-refresh icon-spin",folder:"icon-folder-close-alt",folderOpen:"icon-folder-open-alt"}},treeInit:function(n){var t=n.tree;this._super(n);t.$container.addClass("fancytree-ext-glyph")},nodeRenderStatus:function(i){var f,u,r=i.node,o=n(r.span),e=i.options.glyph,s=e.map;(this._super(i),r.isRoot())||(u=o.children("span.fancytree-expander").get(0),u&&(f=r.isLoading()?"loading":r.expanded?"expanderOpen":r.isUndefined()?"expanderLazy":r.hasChildren()?"expanderClosed":"noExpander",u.className="fancytree-expander "+s[f]),u=r.tr?n("td",r.tr).children("span.fancytree-checkbox").get(0):o.children("span.fancytree-checkbox").get(0),u&&(f=r.selected?"checkboxSelected":r.partsel?"checkboxUnknown":"checkbox",u.className="fancytree-checkbox "+s[f]),u=o.children("span.fancytree-icon").get(0),u&&(f=r.folder?r.expanded?t(e,"folderOpen"):t(e,"folder"):r.expanded?t(e,"docOpen"):t(e,"doc"),u.className="fancytree-icon "+f))},nodeSetStatus:function(i,r,u,f){var e,s=i.options.glyph,o=i.node;this._super(i,r,u,f);e=o.parent?n("span.fancytree-expander",o.span).get(0):n(".fancytree-statusnode-wait, .fancytree-statusnode-error",o[this.nodeContainerAttrName]).find("span.fancytree-expander").get(0);r==="loading"?e.className="fancytree-expander "+t(s,"loading"):r==="error"&&(e.className="fancytree-expander "+t(s,"error"))}})}(jQuery,window,document),function(n){"use strict";function r(t,i){var r,f=i.get(0),u=0;return t.children().each(function(){if(this===f)return!1;r=n(this).prop("colspan");u+=r?r:1}),u}function u(t,i){var r,u=null,f=0;return t.children().each(function(){if(f>=i)return u=n(this),!1;r=n(this).prop("colspan");f+=r?r:1}),u}function f(n,i){var f,s,o=n.closest("td"),e=null;switch(i){case t.LEFT:e=o.prev();break;case t.RIGHT:e=o.next();break;case t.UP:case t.DOWN:for(f=o.parent(),s=r(f,o);;){if(f=i===t.UP?f.prev():f.next(),!f.length)break;if(!f.is(":hidden")&&(e=u(f,s),e&&e.find(":input").length))break}}return e}var t=n.ui.keyCode,i={text:[t.UP,t.DOWN],checkbox:[t.UP,t.DOWN,t.LEFT,t.RIGHT],radiobutton:[t.UP,t.DOWN,t.LEFT,t.RIGHT],"select-one":[t.LEFT,t.RIGHT],"select-multiple":[t.LEFT,t.RIGHT]};n.ui.fancytree.registerExtension({name:"gridnav",version:"0.0.1",options:{autofocusInput:!1,handleCursorKeys:!0},treeInit:function(t){this._requireExtension("table",!0,!0);this._super(t);this.$container.addClass("fancytree-ext-gridnav");this.$container.on("focusin",function(i){var u,r=n.ui.fancytree.getNode(i.target);r&&!r.isActive()&&(u=t.tree._makeHookContext(r,i),t.tree._callHook("nodeSetActive",u,!0))})},nodeSetActive:function(t,i){var u,e=t.options.gridnav,r=t.node,o=t.originalEvent||{},f=n(o.target).is(":input");i=i!==!1;this._super(t,i);i&&(t.options.titlesTabbable?(f||(n(r.span).find("span.fancytree-title").focus(),r.setFocus()),t.tree.$container.attr("tabindex","-1")):e.autofocusInput&&!f&&(u=n(r.tr||r.span),u.find(":input:enabled:first").focus()))},nodeKeydown:function(t){var r,o,u,h=t.options.gridnav,e=t.originalEvent,s=n(e.target);return(r=s.is(":input:enabled")?s.prop("type"):null,r&&h.handleCursorKeys)?(o=i[r],o&&n.inArray(e.which,o)>=0&&(u=f(s,e.which),u&&u.length))?(u.find(":input:enabled").focus(),!1):!0:(t.tree.debug("ext-gridnav NOT HANDLED",e,r),this._super(t))}})}(jQuery,window,document),function(n,t,i,r){"use strict";function s(t,i,r,f,e){var o,l,a,h,y=!1,v=[],c=[];for(r=r||[],e=e||n.Deferred(),o=0,a=r.length;o<a;o++)l=r[o],h=t.getNodeByKey(l),h?f&&h.isUndefined()?(y=!0,t.debug("_loadLazyNodes: "+h+" is lazy: loading..."),f==="expand"?v.push(h.setExpanded()):v.push(h.load())):(t.debug("_loadLazyNodes: "+h+" already loaded."),h.setExpanded()):(c.push(l),t.debug("_loadLazyNodes: "+h+" was not yet found."));return n.when.apply(n,v).always(function(){if(y&&c.length>0)s(t,i,c,f,e);else{if(c.length)for(t.warn("_loadLazyNodes: could not load those keys: ",c),o=0,a=c.length;o<a;o++)l=r[o],i._appendKey(u,r[o],!1);e.resolve()}}),e}var h=n.ui.fancytree.assert,e="active",u="expanded",o="focus",f="selected";n.ui.fancytree._FancytreeClass.prototype.clearCookies=function(n){var t=this.ext.persist,i=t.cookiePrefix;n=n||"active expanded focus selected";n.indexOf(e)>=0&&t._data(i+e,null);n.indexOf(u)>=0&&t._data(i+u,null);n.indexOf(o)>=0&&t._data(i+o,null);n.indexOf(f)>=0&&t._data(i+f,null)};n.ui.fancytree._FancytreeClass.prototype.getPersistData=function(){var n=this.ext.persist,i=n.cookiePrefix,r=n.cookieDelimiter,t={};return t[e]=n._data(i+e),t[u]=(n._data(i+u)||"").split(r),t[f]=(n._data(i+f)||"").split(r),t[o]=n._data(i+o),t};n.ui.fancytree.registerExtension({name:"persist",version:"0.3.0",options:{cookieDelimiter:"~",cookiePrefix:r,cookie:{raw:!1,expires:"",path:"",domain:"",secure:!1},expandLazy:!1,overrideSource:!1,store:"auto",types:"active expanded focus selected"},_data:function(t,i){var u=this._local.localStorage;if(i===r)return u?u.getItem(t):n.cookie(t);i===null?u?u.removeItem(t):n.removeCookie(t):u?u.setItem(t,i):n.cookie(t,i,this.options.persist.cookie)},_appendKey:function(t,i,r){i=""+i;var f=this._local,c=this.options.persist,e=c.cookieDelimiter,o=f.cookiePrefix+t,s=f._data(o),u=s?s.split(e):[],h=n.inArray(i,u);h>=0&&u.splice(h,1);r&&u.push(i);f._data(o,u.join(e))},treeInit:function(c){var v=c.tree,y=c.options,l=this._local,a=this.options.persist;return h(a.store==="localStore"||n.cookie,"Missing required plugin for 'persist' extension: jquery.cookie.js"),l.cookiePrefix=a.cookiePrefix||"fancytree-"+v._id+"-",l.storeActive=a.types.indexOf(e)>=0,l.storeExpanded=a.types.indexOf(u)>=0,l.storeSelected=a.types.indexOf(f)>=0,l.storeFocus=a.types.indexOf(o)>=0,l.localStorage=a.store!=="cookie"&&t.localStorage?a.store==="local"?t.localStorage:t.sessionStorage:null,v.$div.bind("fancytreeinit",function(){var h,w,p,c,t,b=n.cookie(l.cookiePrefix+o);v.debug("COOKIE "+i.cookie);h=l._data(l.cookiePrefix+u);c=h&&h.split(a.cookieDelimiter);w=l.storeExpanded?s(v,l,c,a.expandLazy?"expand":!1,null):(new n.Deferred).resolve();w.done(function(){if(l.storeSelected&&(h=l._data(l.cookiePrefix+f),h))for(c=h.split(a.cookieDelimiter),p=0;p<c.length;p++)t=v.getNodeByKey(c[p]),t?(t.selected===r||a.overrideSource&&t.selected===!1)&&(t.selected=!0,t.renderStatus()):l._appendKey(f,c[p],!1);l.storeActive&&(h=l._data(l.cookiePrefix+e),h&&(y.persist.overrideSource||!v.activeNode)&&(t=v.getNodeByKey(h),t&&t.setActive()));l.storeFocus&&b&&(t=v.getNodeByKey(b),t&&t.setFocus())})}),this._super(c)},nodeSetActive:function(n,t,i){var u,r=this._local;return t=t!==!1,u=this._super(n,t,i),r.storeActive&&r._data(r.cookiePrefix+e,this.activeNode?this.activeNode.key:null),u},nodeSetExpanded:function(n,t,i){var r,e=n.node,f=this._local;return t=t!==!1,r=this._super(n,t,i),f.storeExpanded&&f._appendKey(u,e.key,t),r},nodeSetFocus:function(n,t){var r,i=this._local;return t=t!==!1,r=this._super(n,t),t&&i.storeFocus&&i._data(i.cookiePrefix+o,this.focusNode?this.focusNode.key:null),r},nodeSetSelected:function(n,t){var i,u=n.node,r=this._local;return t=t!==!1,i=this._super(n,t),r.storeSelected&&r._appendKey(f,u.key,t),i}})}(jQuery,window,document),function(n,t,i){"use strict";function f(n,t){n.parentNode.insertBefore(t,n.nextSibling)}function u(n,t){n.visit(function(n){var i=n.tr;return i&&(i.style.display=n.hide||!t?"none":""),n.expanded?void 0:"skip"})}function e(t){var o,f,i,e=t.parent,u=e?e.children:null;if(u&&u.length>1&&u[0]!==t)for(o=n.inArray(t,u),i=u[o-1],r(i.tr);i.children;){if(f=i.children[i.children.length-1],!f.tr)break;i=f}else i=e;return i}var r=n.ui.fancytree.assert;n.ui.fancytree.registerExtension({name:"table",version:"0.2.0",options:{checkboxColumnIdx:null,customStatus:!1,indentation:16,nodeColumnIdx:0},treeInit:function(t){var f,u,e,r=t.tree,o=r.widget.element;for(o.addClass("fancytree-container fancytree-ext-table"),r.tbody=o.find("> tbody")[0],r.columnCount=n("thead >tr >th",o).length,n(r.tbody).empty(),r.rowFragment=i.createDocumentFragment(),u=n("<tr />"),e="",t.options.aria&&(u.attr("role","row"),e=" role='gridcell'"),f=0;f<r.columnCount;f++)t.options.table.nodeColumnIdx===f?u.append("<td"+e+"><span class='fancytree-node' /><\/td>"):u.append("<td"+e+" />");r.rowFragment.appendChild(u.get(0));r.statusClassPropName="tr";r.ariaPropName="tr";this.nodeContainerAttrName="tr";this._super(t);n(r.rootNode.ul).remove();r.rootNode.ul=null;r.$container=o;this.$container.attr("tabindex",this.options.tabbable?"0":"-1");this.options.aria&&r.$container.attr("role","treegrid").attr("aria-readonly",!0)},nodeRemoveChildMarkup:function(t){var i=t.node;i.visit(function(t){t.tr&&(n(t.tr).remove(),t.tr=null)})},nodeRemoveMarkup:function(t){var i=t.node;i.tr&&(n(i.tr).remove(),i.tr=null);this.nodeRemoveChildMarkup(t)},nodeRender:function(t,i,o,s,h){var y,d,b,g,a,p,w,k,v=t.tree,c=t.node,l=t.options,nt=!c.parent;if(h||(t.hasCollapsedParents=c.parent&&!c.parent.expanded),!nt)if(c.tr)i?this.nodeRenderTitle(t):this.nodeRenderStatus(t);else{if(t.hasCollapsedParents){c.debug("nodeRender ignored due to unrendered parent");return}a=v.rowFragment.firstChild.cloneNode(!0);p=e(c);r(p);s===!0&&h?a.style.display="none":o&&t.hasCollapsedParents&&(a.style.display="none");p.tr?f(p.tr,a):(r(!p.parent,"prev. row must have a tr, or is system root"),v.tbody.appendChild(a));c.tr=a;c.key&&l.generateIds&&(c.tr.id=l.idPrefix+c.key);c.tr.ftnode=c;l.aria&&n(c.tr).attr("aria-labelledby","ftal_"+c.key);c.span=n("span.fancytree-node",c.tr).get(0);this.nodeRenderTitle(t);l.createNode&&l.createNode.call(v,{type:"createNode"},t)}if(l.renderNode&&l.renderNode.call(v,{type:"renderNode"},t),y=c.children,y&&(nt||o||c.expanded))for(b=0,g=y.length;b<g;b++)k=n.extend({},t,{node:y[b]}),k.hasCollapsedParents=k.hasCollapsedParents||!c.expanded,this.nodeRender(k,i,o,s,!0);y&&!h&&(w=c.tr||null,d=v.tbody.firstChild,c.visit(function(n){if(n.tr){if(n.parent.expanded||n.tr.style.display==="none"||(n.tr.style.display="none",u(n,!1)),n.tr.previousSibling!==w){c.debug("_fixOrder: mismatch at node: "+n);var t=w?w.nextSibling:d;v.tbody.insertBefore(n.tr,t)}w=n.tr}}))},nodeRenderTitle:function(t){var u,r=t.node,i=t.options;this._super(t);i.checkbox&&i.table.checkboxColumnIdx!=null&&(u=n("span.fancytree-checkbox",r.span).detach(),n(r.tr).find("td:first").html(u));r.isRoot()||this.nodeRenderStatus(t);!i.table.customStatus&&r.isStatusNode()||i.renderColumns&&i.renderColumns.call(t.tree,{type:"renderColumns"},t)},nodeRenderStatus:function(t){var r,i=t.node,u=t.options;this._super(t);n(i.tr).removeClass("fancytree-node");r=(i.getLevel()-1)*u.table.indentation;n(i.span).css({marginLeft:r+"px"})},nodeSetExpanded:function(t,i,r){function e(n){i=i!==!1;u(t.node,i);n?i&&t.options.autoScroll&&!r.noAnimation&&t.node.hasChildren()?t.node.getLastChild().scrollIntoView(!0,{topNode:t.node}).always(function(){r.noEvents||t.tree._triggerNodeEvent(i?"expand":"collapse",t);f.resolveWith(t.node)}):(r.noEvents||t.tree._triggerNodeEvent(i?"expand":"collapse",t),f.resolveWith(t.node)):(r.noEvents||t.tree._triggerNodeEvent(i?"expand":"collapse",t),f.rejectWith(t.node))}var f=new n.Deferred,o=n.extend({},r,{noEvents:!0,noAnimation:!0});return r=r||{},this._super(t,i,o).done(function(){e(!0)}).fail(function(){e(!1)}),f.promise()},nodeSetStatus:function(t,i,r,u){if(i==="ok"){var e=t.node,f=e.children?e.children[0]:null;f&&f.isStatusNode()&&n(f.tr).remove()}this._super(t,i,r,u)},treeClear:function(n){return this.nodeRemoveChildMarkup(this._makeHookContext(this.rootNode)),this._super(n)}})}(jQuery,window,document),function(n){"use strict";n.ui.fancytree.registerExtension({name:"themeroller",version:"0.0.1",options:{activeClass:"ui-state-active",foccusClass:"ui-state-focus",hoverClass:"ui-state-hover",selectedClass:"ui-state-highlight"},treeInit:function(t){this._super(t);var i=t.widget.element;i[0].nodeName==="TABLE"?(i.addClass("ui-widget ui-corner-all"),i.find(">thead tr").addClass("ui-widget-header"),i.find(">tbody").addClass("ui-widget-conent")):i.addClass("ui-widget ui-widget-content ui-corner-all");i.delegate(".fancytree-node","mouseenter mouseleave",function(t){var i=n.ui.fancytree.getNode(t.target),r=t.type==="mouseenter";i.debug("hover: "+r);n(i.span).toggleClass("ui-state-hover ui-corner-all",r)})},treeDestroy:function(n){this._super(n);n.widget.element.removeClass("ui-widget ui-widget-content ui-corner-all")},nodeRenderStatus:function(t){var i=t.node,r=n(i.span);this._super(t);r.toggleClass("ui-state-active",i.isActive());r.toggleClass("ui-state-focus",i.hasFocus());r.toggleClass("ui-state-highlight",i.isSelected())}})}(jQuery,window,document),function(){function d(n,t,i){for(var r=(i||0)-1,u=n?n.length:0;++r<u;)if(n[r]===t)return r;return-1}function ft(n,t){var i=typeof t,r;return(n=n.cache,i=="boolean"||t==null)?n[t]?0:-1:(i!="number"&&i!="string"&&(i="object"),r=i=="number"?t:ht+t,n=(n=n[i])&&n[r],i=="object"?n&&d(n,t)>-1?0:-1:n?0:-1)}function pi(n){var u=this.cache,t=typeof n,i,r;t=="boolean"||n==null?u[n]=!0:(t!="number"&&t!="string"&&(t="object"),i=t=="number"?n:ht+n,r=u[t]||(u[t]={}),t=="object"?(r[i]||(r[i]=[])).push(n):r[i]=!0)}function ni(n){return n.charCodeAt(0)}function wi(n,t){for(var f=n.criteria,e=t.criteria,u=-1,o=f.length,i,r;++u<o;)if(i=f[u],r=e[u],i!==r){if(i>r||typeof i=="undefined")return 1;if(i<r||typeof r=="undefined")return-1}return n.index-t.index}function at(n){var u=-1,r=n.length,f=n[0],e=n[r/2|0],o=n[r-1],t,i;if(f&&typeof f=="object"&&e&&typeof e=="object"&&o&&typeof o=="object")return!1;for(t=vt(),t["false"]=t["null"]=t["true"]=t.undefined=!1,i=vt(),i.array=n,i.cache=t,i.push=pi;++u<r;)i.push(n[u]);return i}function bi(n){return"\\"+vi[n]}function f(){return ot.pop()||[]}function vt(){return st.pop()||{array:null,cache:null,criteria:null,"false":!1,index:0,"null":!1,number:null,object:null,push:null,string:null,"true":!1,undefined:!1,value:null}}function et(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function i(n){n.length=0;ot.length<pt&&ot.push(n)}function g(n){var t=n.cache;t&&g(t);n.array=n.cache=n.criteria=n.object=n.number=n.string=n.value=null;st.length<pt&&st.push(n)}function n(n,t,i){t||(t=0);typeof i=="undefined"&&(i=n?n.length:0);for(var r=-1,u=i-t||0,f=Array(u<0?0:u);++r<u;)f[r]=n[t+r];return f}function yt(b){function rt(n){return n&&typeof n=="object"&&!ot(n)&&vi.call(n,"__wrapped__")?n:new ar(n)}function ar(n,t){this.__chain__=!!t;this.__wrapped__=n}function us(t){function r(){var t,e,o;return(u&&(t=n(u),iu.apply(t,arguments)),this instanceof r)?(e=fu(i.prototype),o=i.apply(e,t||arguments),ki(o)?o:e):i.apply(f,t||arguments)}var i=t[0],u=t[2],f=t[4];return pu(r,t),r}function sf(t,r,e,o,s){var c,d,b,l,w,g,k;if(e&&(c=e(t),typeof c!="undefined"))return c;if(d=ki(t),d){if(b=pt.call(t),!u[b]||!ut.nodeClass&&et(t))return t;l=cr[b];switch(b){case a:case v:return new l(+t);case y:case h:return new l(t);case p:return c=l(t.source,oi.exec(t)),c.lastIndex=t.lastIndex,c}}else return t;if(w=ot(t),r){for(g=!o,o||(o=f()),s||(s=f()),k=o.length;k--;)if(o[k]==t)return s[k];c=w?l(t.length):{}}else c=w?n(t):bu({},t);return(w&&(vi.call(t,"index")&&(c.index=t.index),vi.call(t,"input")&&(c.input=t.input)),!r)?c:(o.push(t),s.push(c),(w?yi:er)(t,function(n,t){c[t]=sf(n,r,e,o,s)}),g&&(i(o),i(s)),c)}function fu(n){return ki(n)?au(n):{}}function ur(n,t,i){var r,u;if(typeof n!="function")return kf;if(typeof t=="undefined"||!("prototype"in n)||(r=n.__bindData__,typeof r=="undefined"&&(ut.funcNames&&(r=!n.name),r=r||!ut.funcDecomp,r||(u=ns.call(n),ut.funcNames||(r=!si.test(u)),r||(r=kt.test(u),pu(n,r)))),r===!1||r!==!0&&r[1]&1))return n;switch(i){case 1:return function(i){return n.call(t,i)};case 2:return function(i,r){return n.call(t,i,r)};case 3:return function(i,r,u){return n.call(t,i,r,u)};case 4:return function(i,r,u,f){return n.call(t,i,r,u,f)}}return eo(n,t)}function re(t){function f(){var y=c?o:this,t,p;return(e&&(t=n(e),iu.apply(t,arguments)),(u||h)&&(t||(t=n(arguments)),u&&iu.apply(t,u),h&&t.length<s))?(i|=16,re([r,a?i:i&-4,t,null,o,s])):(t||(t=arguments),l&&(r=y[v]),this instanceof f)?(y=fu(r.prototype),p=r.apply(y,t),ki(p)?p:y):r.apply(y,t)}var r=t[0],i=t[1],e=t[2],u=t[3],o=t[4],s=t[5],c=i&1,l=i&2,h=i&4,a=i&8,v=r;return pu(f,t),f}function eu(n,t){var e=-1,i=yu(),o=n?n.length:0,r=o>=ct&&i===d,s=[],u,f;for(r&&(u=at(t),u?(i=ft,t=u):r=!1);++e<o;)f=n[e],i(t,f)<0&&s.push(f);return r&&g(t),s}function vr(n,t,i,r){for(var e=(r||0)-1,h=n?n.length:0,f=[],u;++e<h;)if(u=n[e],u&&typeof u=="object"&&typeof u.length=="number"&&(ot(u)||nr(u))){t||(u=vr(u,t,i));var o=-1,s=u.length,c=f.length;for(f.length+=s;++o<s;)f[c++]=u[o]}else i||f.push(u);return f}function kr(n,t,u,o,s,w){var b,lt,at,d,it,rt,ft,ot,nt,tt,vt,g,k,ht,ct;if(u&&(b=u(n,t),typeof b!="undefined"))return!!b;if(n===t)return n!==0||1/n==1/t;if(lt=typeof n,at=typeof t,n===n&&!(n&&e[lt])&&!(t&&e[at]))return!1;if(n==null||t==null)return n===t;if(d=pt.call(n),it=pt.call(t),d==c&&(d=r),it==c&&(it=r),d!=it)return!1;switch(d){case a:case v:return+n==+t;case y:return n!=+n?t!=+t:n==0?1/n==1/t:n==+t;case p:case h:return n==sr(t)}if(rt=d==l,!rt){if(ft=vi.call(n,"__wrapped__"),ot=vi.call(t,"__wrapped__"),ft||ot)return kr(ft?n.__wrapped__:n,ot?t.__wrapped__:t,u,o,s,w);if(d!=r||!ut.nodeClass&&(et(n)||et(t))||(nt=!ut.argsObject&&nr(n)?rr:n.constructor,tt=!ut.argsObject&&nr(t)?rr:t.constructor,nt!=tt&&!(st(nt)&&nt instanceof nt&&st(tt)&&tt instanceof tt)&&"constructor"in n&&"constructor"in t))return!1}for(vt=!s,s||(s=f()),w||(w=f()),g=s.length;g--;)if(s[g]==n)return w[g]==t;if(k=0,b=!0,s.push(n),w.push(t),rt){if(g=n.length,k=t.length,b=k==g,b||o)while(k--)if(ht=g,ct=t[k],o){while(ht--)if(b=kr(n[ht],ct,u,o,s,w))break}else if(!(b=kr(n[k],ct,u,o,s,w)))break}else ir(t,function(t,i,r){if(vi.call(r,i))return k++,b=vi.call(n,i)&&kr(n[i],t,u,o,s,w)}),b&&!o&&ir(n,function(n,t,i){if(vi.call(i,t))return b=--k>-1});return s.pop(),w.pop(),vt&&(i(s),i(w)),b}function ue(n,t,i,r,u){(ot(t)?wr:er)(t,function(t,f){var c,l,o=t,e=n[f],s,h;if(t&&((l=ot(t))||du(t))){for(s=r.length;s--;)if(c=r[s]==t){e=u[s];break}c||(i&&(o=i(e,t),(h=typeof o!="undefined")&&(e=o)),h||(e=l?ot(e)?e:[]:du(e)?e:{}),r.push(t),u.push(e),h||ue(e,t,i,r,u))}else i&&(o=i(e,t),typeof o=="undefined"&&(o=t)),typeof o!="undefined"&&(e=o);n[f]=e})}function hf(n,t){return n+go(te()*(t-n+1))}function cf(n,t,r){var e=-1,c=yu(),a=n?n.length:0,l=[],o=!t&&a>=ct&&c===d,u=r||o?f():l,v,s,h;for(o&&(v=at(u),c=ft,u=v);++e<a;)s=n[e],h=r?r(s,e,n):s,(t?!e||u[u.length-1]!==h:c(u,h)<0)&&((r||o)&&u.push(h),l.push(s));return o?(i(u.array),g(u)):r&&i(u),l}function lf(n){return function(t,i,r){var f={},u,o,e;if(i=rt.createCallback(i,r,3),ot(t))for(u=-1,o=t.length;++u<o;)e=t[u],n(f,e,i(e,u,t),t);else yi(t,function(t,r,u){n(f,t,i(t,r,u),u)});return f}}function fr(t,i,r,u,f,e){var c=i&1,a=i&2,v=i&4,y=i&8,s=i&16,h=i&32,o,l;if(!a&&!st(t))throw new hr;return(s&&!r.length&&(i&=-17,s=r=!1),h&&!u.length&&(i&=-33,h=u=!1),o=t&&t.__bindData__,o&&o!==!0)?(o=n(o),o[2]&&(o[2]=n(o[2])),o[3]&&(o[3]=n(o[3])),!c||o[1]&1||(o[4]=f),!c&&o[1]&1&&(i|=8),!v||o[1]&4||(o[5]=e),s&&iu.apply(o[2]||(o[2]=[]),r),h&&ts.apply(o[3]||(o[3]=[]),u),o[1]|=i,fr.apply(null,o)):(l=i==1||i===17?us:re,l([t,i,r,u,f,e]))}function dr(){var n,i,r,u,f;for(t.shadowedProps=lt,t.array=t.bottom=t.loop=t.top="",t.init="iterable",t.useHas=!0,i=0;n=arguments[i];i++)for(r in n)t[r]=n[r];return u=t.args,t.firstArg=/^[^,]+/.exec(u)[0],f=gr("baseCreateCallback, errorClass, errorProto, hasOwnProperty, indicatorObject, isArguments, isArray, isString, keys, objectProto, objectTypes, nonEnumProps, stringClass, stringProto, toString","return function("+u+") {\n"+ie(t)+"\n}"),f(ur,dt,ff,vi,ii,nr,ot,or,t.keys,hu,e,pi,h,po,pt)}function fs(n){return vf[n]}function yu(){var n=(n=rt.indexOf)===to?d:n;return n}function yr(n){return typeof n=="function"&&bo.test(n)}function fe(n){var i,t;return!(n&&pt.call(n)==r)||(i=n.constructor,st(i)&&!(i instanceof i))||!ut.argsClass&&nr(n)||!ut.nodeClass&&et(n)?!1:ut.ownLast?(ir(n,function(n,i,r){return t=vi.call(r,i),!1}),t!==!1):(ir(n,function(n,i){t=i}),typeof t=="undefined"||vi.call(n,t))}function es(n){return se[n]}function nr(n){return n&&typeof n=="object"&&typeof n.length=="number"&&pt.call(n)==c||!1}function hs(n,t,i,r){return typeof t!="boolean"&&t!=null&&(r=i,i=t,t=!1),sf(n,t,typeof i=="function"&&ur(i,r,1))}function cs(n,t,i){return sf(n,!0,typeof t=="function"&&ur(t,i,1))}function ls(n,t){var i=fu(n);return t?bu(i,t):i}function as(n,t,i){var r;return t=rt.createCallback(t,i,3),er(n,function(n,i,u){if(t(n,i,u))return r=i,!1}),r}function vs(n,t,i){var r;return t=rt.createCallback(t,i,3),he(n,function(n,i,u){if(t(n,i,u))return r=i,!1}),r}function ys(n,t,i){var r=[],u;for(ir(n,function(n,t){r.push(t,n)}),u=r.length,t=ur(t,i,3);u--;)if(t(r[u--],r[u],n)===!1)break;return n}function he(n,t,i){var u=gi(n),f=u.length,r;for(t=ur(t,i,3);f--;)if(r=u[f],t(n[r],r,n)===!1)break;return n}function ou(n){var t=[];return ir(n,function(n,i){st(n)&&t.push(i)}),t.sort()}function ps(n,t){return n?vi.call(n,t):!1}function ce(n){for(var i=-1,r=gi(n),f=r.length,u={},t;++i<f;)t=r[i],u[n[t]]=t;return u}function ws(n){return n===!0||n===!1||n&&typeof n=="object"&&pt.call(n)==a||!1}function bs(n){return n&&typeof n=="object"&&pt.call(n)==v||!1}function ks(n){return n&&n.nodeType===1||!1}function ds(n){var i=!0,t,u;return n?(t=pt.call(n),u=n.length,t==l||t==h||(ut.argsClass?t==c:nr(n))||t==r&&typeof u=="number"&&st(n.splice))?!u:(er(n,function(){return i=!1}),i):i}function gs(n,t,i,r){return kr(n,t,typeof i=="function"&&ur(i,r,2))}function nh(n){return is(n)&&!rs(parseFloat(n))}function st(n){return typeof n=="function"}function ki(n){return!!(n&&e[typeof n])}function th(n){return le(n)&&n!=+n}function ih(n){return n===null}function le(n){return typeof n=="number"||n&&typeof n=="object"&&pt.call(n)==y||!1}function rh(n){return n&&e[typeof n]&&pt.call(n)==p||!1}function or(n){return typeof n=="string"||n&&typeof n=="object"&&pt.call(n)==h||!1}function uh(n){return typeof n=="undefined"}function fh(n,t,i){var r={};return t=rt.createCallback(t,i,3),er(n,function(n,i,u){r[i]=t(n,i,u)}),r}function eh(t){var u=arguments,r=2,e;if(!ki(t))return t;typeof u[2]!="number"&&(r=u.length);r>3&&typeof u[r-2]=="function"?e=ur(u[--r-1],u[r--],2):r>2&&typeof u[r-1]=="function"&&(e=u[--r]);for(var c=n(arguments,1,r),o=-1,s=f(),h=f();++o<r;)ue(t,c[o],e,s,h);return i(s),i(h),t}function oh(n,t,i){var u={},r,f,o,e;if(typeof t!="function")for(r=[],ir(n,function(n,t){r.push(t)}),r=eu(r,vr(arguments,!0,!1,1)),f=-1,o=r.length;++f<o;)e=r[f],u[e]=n[e];else t=rt.createCallback(t,i,3),ir(n,function(n,i,r){t(n,i,r)||(u[i]=n)});return u}function sh(n){for(var t=-1,r=gi(n),u=r.length,f=di(u),i;++t<u;)i=r[t],f[t]=[i,n[i]];return f}function hh(n,t,i){var u={},r;if(typeof t!="function")for(var f=-1,e=vr(arguments,!0,!1,1),o=ki(n)?e.length:0;++f<o;)r=e[f],r in n&&(u[r]=n[r]);else t=rt.createCallback(t,i,3),ir(n,function(n,i,r){t(n,i,r)&&(u[i]=n)});return u}function ch(n,t,i,r){var f=ot(n),u,e;return i==null&&(f?i=[]:(u=n&&n.constructor,e=u&&u.prototype,i=fu(e))),t&&(t=rt.createCallback(t,r,4),(f?yi:er)(n,function(n,r,u){return t(i,n,r,u)})),i}function gu(n){for(var t=-1,i=gi(n),r=i.length,u=di(r);++t<r;)u[t]=n[i[t]];return u}function lh(n){var t=arguments,i=-1,r=vr(t,!0,!1,1),u=t[2]&&t[2][t[1]]===n?1:r.length,f=di(u);for(ut.unindexedChars&&or(n)&&(n=n.split(""));++i<u;)f[i]=n[r[i]];return f}function ae(n,t,i){var e=-1,u=yu(),f=n?n.length:0,r=!1;return i=(i<0?tr(0,f+i):i)||0,ot(n)?r=u(n,t,i)>-1:typeof f=="number"?r=(or(n)?n.indexOf(t,i):u(n,t,i))>-1:yi(n,function(n){if(++e>=i)return!(r=n===t)}),r}function ye(n,t,i){var u=!0,r,f;if(t=rt.createCallback(t,i,3),ot(n)){for(r=-1,f=n.length;++r<f;)if(!(u=!!t(n[r],r,n)))break}else yi(n,function(n,i,r){return u=!!t(n,i,r)});return u}function nf(n,t,i){var u=[],r,e,f;if(t=rt.createCallback(t,i,3),ot(n))for(r=-1,e=n.length;++r<e;)f=n[r],t(f,r,n)&&u.push(f);else yi(n,function(n,i,r){t(n,i,r)&&u.push(n)});return u}function yf(n,t,i){var r,f,u,e;if(t=rt.createCallback(t,i,3),ot(n)){for(r=-1,f=n.length;++r<f;)if(u=n[r],t(u,r,n))return u}else return yi(n,function(n,i,r){if(t(n,i,r))return e=n,!1}),e}function ah(n,t,i){var r;return t=rt.createCallback(t,i,3),tf(n,function(n,i,u){if(t(n,i,u))return r=n,!1}),r}function wr(n,t,i){if(t&&typeof i=="undefined"&&ot(n)){for(var r=-1,u=n.length;++r<u;)if(t(n[r],r,n)===!1)break}else yi(n,t,i);return n}function tf(n,t,i){var f=n,r=n?n.length:0,u;if(t=t&&typeof i=="undefined"?t:ur(t,i,3),ot(n)){while(r--)if(t(n[r],r,n)===!1)break}else typeof r!="number"?(u=gi(n),r=u.length):ut.unindexedChars&&or(n)&&(f=n.split("")),yi(n,function(n,i,e){return i=u?u[--r]:--r,t(f[i],i,e)});return n}function vh(t,i){var f=n(arguments,2),e=-1,o=typeof i=="function",r=t?t.length:0,u=di(typeof r=="number"?r:0);return wr(t,function(n){u[++e]=(o?i:n[i]).apply(n,f)}),u}function su(n,t,i){var r=-1,u=n?n.length:0,f=di(typeof u=="number"?u:0);if(t=rt.createCallback(t,i,3),ot(n))while(++r<u)f[r]=t(n[r],r,n);else yi(n,function(n,i,u){f[++r]=t(n,i,u)});return f}function be(n,t,i){var u=-Infinity,r=u,f,o,e;if(typeof t!="function"&&i&&i[t]===n&&(t=null),t==null&&ot(n))for(f=-1,o=n.length;++f<o;)e=n[f],e>r&&(r=e);else t=t==null&&or(n)?ni:rt.createCallback(t,i,3),yi(n,function(n,i,f){var e=t(n,i,f);e>u&&(u=e,r=n)});return r}function yh(n,t,i){var u=Infinity,r=u,f,o,e;if(typeof t!="function"&&i&&i[t]===n&&(t=null),t==null&&ot(n))for(f=-1,o=n.length;++f<o;)e=n[f],e<r&&(r=e);else t=t==null&&or(n)?ni:rt.createCallback(t,i,3),yi(n,function(n,i,f){var e=t(n,i,f);e<u&&(u=e,r=n)});return r}function pf(n,t,i,r){var f=arguments.length<3,u,e;if(t=rt.createCallback(t,r,4),ot(n))for(u=-1,e=n.length,f&&(i=n[++u]);++u<e;)i=t(i,n[u],u,n);else yi(n,function(n,r,u){i=f?(f=!1,n):t(i,n,r,u)});return i}function ke(n,t,i,r){var u=arguments.length<3;return t=rt.createCallback(t,r,4),tf(n,function(n,r,f){i=u?(u=!1,n):t(i,n,r,f)}),i}function ph(n,t,i){return t=rt.createCallback(t,i,3),nf(n,function(n,i,r){return!t(n,i,r)})}function wh(n,t,i){if(n&&typeof n.length!="number"?n=gu(n):ut.unindexedChars&&or(n)&&(n=n.split("")),t==null||i)return n?n[hf(0,n.length-1)]:s;var r=de(n);return r.length=uu(tr(0,t),r.length),r}function de(n){var i=-1,r=n?n.length:0,t=di(typeof r=="number"?r:0);return wr(n,function(n){var r=hf(0,++i);t[i]=t[r];t[r]=n}),t}function bh(n){var t=n?n.length:0;return typeof t=="number"?t:gi(n).length}function ge(n,t,i){var u,r,f;if(t=rt.createCallback(t,i,3),ot(n)){for(r=-1,f=n.length;++r<f;)if(u=t(n[r],r,n))break}else yi(n,function(n,i,r){return!(u=t(n,i,r))});return!!u}function kh(n,t,r){var h=-1,s=ot(t),u=n?n.length:0,e=di(typeof u=="number"?u:0),o;for(s||(t=rt.createCallback(t,r,3)),wr(n,function(n,i,r){var u=e[++h]=vt();s?u.criteria=su(t,function(t){return n[t]}):(u.criteria=f())[0]=t(n,i,r);u.index=h;u.value=n}),u=e.length,e.sort(wi);u--;)o=e[u],e[u]=o.value,s||i(o.criteria),g(o);return e}function dh(t){return t&&typeof t.length=="number"?ut.unindexedChars&&or(t)?t.split(""):n(t):gu(t)}function gh(n){for(var i=-1,u=n?n.length:0,r=[],t;++i<u;)t=n[i],t&&r.push(t);return r}function nc(n){return eu(n,vr(arguments,!0,!0,1))}function tc(n,t,i){var r=-1,u=n?n.length:0;for(t=rt.createCallback(t,i,3);++r<u;)if(t(n[r],r,n))return r;return-1}function ic(n,t,i){var r=n?n.length:0;for(t=rt.createCallback(t,i,3);r--;)if(t(n[r],r,n))return r;return-1}function wf(t,i,r){var u=0,e=t?t.length:0,f;if(typeof i!="number"&&i!=null)for(f=-1,i=rt.createCallback(i,r,3);++f<e&&i(t[f],f,t);)u++;else if(u=i,u==null||r)return t?t[0]:s;return n(t,0,uu(tr(0,u),e))}function rc(n,t,i,r){return typeof t!="boolean"&&t!=null&&(r=i,i=typeof t!="function"&&r&&r[t]===n?null:t,t=!1),i!=null&&(n=su(n,i,r)),vr(n,t)}function to(n,t,i){var u,r;if(typeof i=="number")u=n?n.length:0,i=i<0?tr(0,u+i):i||0;else if(i)return r=io(n,t),n[r]===t?r:-1;return d(n,t,i)}function uc(t,i,r){var u=0,e=t?t.length:0,f;if(typeof i!="number"&&i!=null)for(f=e,i=rt.createCallback(i,r,3);f--&&i(t[f],f,t);)u++;else u=i==null||r?1:i||u;return n(t,0,uu(tr(0,e-u),e))}function fc(){for(var e=[],r=-1,o=arguments.length,u=f(),h=yu(),v=h===d,s=f(),n,t;++r<o;)n=arguments[r],(ot(n)||nr(n))&&(e.push(n),u.push(v&&n.length>=ct&&at(r?e[r]:s)));var c=e[0],l=-1,y=c?c.length:0,a=[];n:while(++l<y)if(t=u[0],n=c[l],(t?ft(t,n):h(s,n))<0){for(r=o,(t||s).push(n);--r;)if(t=u[r],(t?ft(t,n):h(e[r],n))<0)continue n;a.push(n)}while(o--)t=u[o],t&&g(t);return i(u),i(s),a}function ec(t,i,r){var u=0,e=t?t.length:0,f;if(typeof i!="number"&&i!=null)for(f=e,i=rt.createCallback(i,r,3);f--&&i(t[f],f,t);)u++;else if(u=i,u==null||r)return t?t[e-1]:s;return n(t,tr(0,e-u))}function oc(n,t,i){var r=n?n.length:0;for(typeof i=="number"&&(r=(i<0?tr(0,r+i):uu(i,r-1))+1);r--;)if(n[r]===t)return r;return-1}function sc(n){for(var i=arguments,r=0,e=i.length,u=n?n.length:0,t,f;++r<e;)for(t=-1,f=i[r];++t<u;)n[t]===f&&(gf.call(n,t--,1),u--);return n}function hc(n,t,i){n=+n||0;i=typeof i=="number"?i:+i||1;t==null&&(t=n,n=0);for(var r=-1,u=tr(0,ko((t-n)/(i||1))),f=di(u);++r<u;)f[r]=n,n+=i;return f}function cc(n,t,i){var r=-1,f=n?n.length:0,e=[],u;for(t=rt.createCallback(t,i,3);++r<f;)u=n[r],t(u,r,n)&&(e.push(u),gf.call(n,r--,1),f--);return e}function bf(t,i,r){if(typeof i!="number"&&i!=null){var u=0,f=-1,e=t?t.length:0;for(i=rt.createCallback(i,r,3);++f<e&&i(t[f],f,t);)u++}else u=i==null||r?1:tr(0,i);return n(t,u)}function io(n,t,i,r){var u=0,e=n?n.length:u,f;for(i=i?rt.createCallback(i,r,1):kf,t=i(t);u<e;)f=u+e>>>1,i(n[f])<t?u=f+1:e=f;return u}function lc(){return cf(vr(arguments,!0,!0))}function ro(n,t,i,r){return typeof t!="boolean"&&t!=null&&(r=i,i=typeof t!="function"&&r&&r[t]===n?null:t,t=!1),i!=null&&(i=rt.createCallback(i,r,3)),cf(n,t,i)}function ac(t){return eu(t,n(arguments,1))}function vc(){for(var i=-1,r=arguments.length,n,t;++i<r;)n=arguments[i],(ot(n)||nr(n))&&(t=t?cf(eu(t,n).concat(eu(n,t))):n);return t||[]}function uo(){for(var n=arguments.length>1?arguments:arguments[0],t=-1,i=n?be(rf(n,"length")):0,r=di(i<0?0:i);++t<i;)r[t]=rf(n,t);return r}function fo(n,t){var r=-1,f=n?n.length:0,u={},i;for(t||!f||ot(n[0])||(t=[]);++r<f;)i=n[r],t?u[i]=t[r]:i&&(u[i[0]]=i[1]);return u}function yc(n,t){if(!st(t))throw new hr;return function(){if(--n<1)return t.apply(this,arguments)}}function eo(t,i){return arguments.length>2?fr(t,17,n(arguments,2),null,i):fr(t,1,null,null,i)}function pc(n){for(var i=arguments.length>1?vr(arguments,!0,!1,1):ou(n),r=-1,u=i.length,t;++r<u;)t=i[r],n[t]=fr(n[t],1,null,null,n);return n}function wc(t,i){return arguments.length>2?fr(i,19,n(arguments,2),null,t):fr(i,3,null,null,t)}function bc(){for(var n=arguments,t=n.length;t--;)if(!st(n[t]))throw new hr;return function(){for(var t=arguments,i=n.length;i--;)t=[n[i].apply(this,t)];return t[0]}}function kc(n,t){return t=typeof t=="number"?t:+t||n.length,fr(n,4,null,null,null,t)}function oo(n,t,i){var f,u,o,h,e,r,y,c=0,l=!1,a=!0,v,p,w;if(!st(n))throw new hr;return t=tr(0,t)||0,i===!0?(v=!0,a=!1):ki(i)&&(v=i.leading,l="maxWait"in i&&(tr(t,i.maxWait)||0),a="trailing"in i?i.trailing:a),p=function(){var i=t-(pr()-h),l;i<=0?(u&&cu(u),l=y,u=r=y=s,l&&(c=pr(),o=n.apply(e,f),r||u||(f=e=null))):r=ru(p,i)},w=function(){r&&cu(r);u=r=y=s;(a||l!==t)&&(c=pr(),o=n.apply(e,f),r||u||(f=e=null))},function(){var b,s,i;return f=arguments,h=pr(),e=this,y=a&&(r||!v),l===!1?b=v&&!r:(u||v||(c=h),s=l-(h-c),i=s<=0,i?(u&&(u=cu(u)),c=h,o=n.apply(e,f)):u||(u=ru(w,s))),i&&r?r=cu(r):r||t===l||(r=ru(p,t)),b&&(i=!0,o=n.apply(e,f)),!i||r||u||(f=e=null),o}}function dc(t){if(!st(t))throw new hr;var i=n(arguments,1);return ru(function(){t.apply(s,i)},1)}function gc(t,i){if(!st(t))throw new hr;var r=n(arguments,2);return ru(function(){t.apply(s,r)},i)}function nl(n,t){if(!st(n))throw new hr;var i=function(){var r=i.cache,u=t?t.apply(this,arguments):ht+arguments[0];return vi.call(r,u)?r[u]:r[u]=n.apply(this,arguments)};return i.cache={},i}function tl(n){var i,t;if(!st(n))throw new hr;return function(){return i?t:(i=!0,t=n.apply(this,arguments),n=null,t)}}function il(t){return fr(t,16,n(arguments,1))}function rl(t){return fr(t,32,null,n(arguments,1))}function ul(n,t,i){var r=!0,u=!0;if(!st(n))throw new hr;return i===!1?r=!1:ki(i)&&(r="leading"in i?i.leading:r,u="trailing"in i?i.trailing:u),it.leading=r,it.maxWait=t,it.trailing=u,oo(n,t,it)}function fl(n,t){return fr(t,16,[n])}function el(n){return function(){return n}}function ol(n,t,i){var f=typeof n;if(n==null||f=="function")return ur(n,t,i);if(f!="object")return co(n);var u=gi(n),e=u[0],r=n[e];return u.length==1&&r===r&&!ki(r)?function(n){var t=n[e];return r===t&&(r!==0||1/r==1/t)}:function(t){for(var i=u.length,r=!1;i--;)if(!(r=kr(t[u[i]],n[u[i]],null,!0)))break;return r}}function sl(n){return n==null?"":sr(n).replace(ss,fs)}function kf(n){return n}function df(n,t,i){var u=!0,f=t&&ou(t),r,e;t&&(i||f.length)||(i==null&&(i=t),r=ar,t=n,n=rt,f=ou(t));i===!1?u=!1:ki(i)&&"chain"in i&&(u=i.chain);r=n;e=st(r);wr(f,function(i){var f=n[i]=t[i];e&&(r.prototype[i]=function(){var i=this.__chain__,e=this.__wrapped__,o=[e],t;if(iu.apply(o,arguments),t=f.apply(n,o),u||i){if(e===t&&ki(t))return this;t=new r(t);t.__chain__=i}return t})})}function hl(){return b._=wo,this}function so(){}function co(n){return function(t){return t[n]}}function cl(n,t,i){var f=n==null,r=t==null,u;return(i==null&&(typeof n=="boolean"&&r?(i=n,n=1):r||typeof t!="boolean"||(i=t,r=!0)),f&&r&&(t=1),n=+n||0,r?(t=n,n=0):t=+t||0,i||n%1||t%1)?(u=te(),uu(n+u*(t-n+parseFloat("1e-"+((u+"").length-1))),t)):hf(n,t)}function ll(n,t){if(n){var i=n[t];return st(i)?n[t]():i}}function al(n,t,i){var h=rt.templateSettings,u,o,v,f;n=sr(n||"");i=ku({},i,h);var c=ku({},i.imports,h.imports),p=gi(c),w=gu(c),e,l=0,a=i.interpolate||nt,r="__p += '",b=tu((i.escape||nt).source+"|"+a.source+"|"+(a===bt?ei:nt).source+"|"+(i.evaluate||nt).source+"|$","g");n.replace(b,function(t,i,u,f,o,s){return u||(u=f),r+=n.slice(l,s).replace(ci,bi),i&&(r+="' +\n__e("+i+") +\n'"),o&&(e=!0,r+="';\n"+o+";\n__p += '"),u&&(r+="' +\n((__t = ("+u+")) == null ? '' : __t) +\n'"),l=s+t.length,t});r+="';\n";u=i.variable;o=u;o||(u="obj",r="with ("+u+") {\n"+r+"\n}\n");r=(e?r.replace(ri,""):r).replace(ui,"$1").replace(fi,"$1;");r="function("+u+") {\n"+(o?"":u+" || ("+u+" = {});\n")+"var __t, __p = '', __e = _.escape"+(e?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+r+"return __p\n}";v="\n/*\n//# sourceURL="+(i.sourceURL||"/lodash/template/source["+ai+++"]")+"\n*/";try{f=gr(p,"return "+r+v).apply(s,w)}catch(y){y.source=r;throw y;}return t?f(t):(f.source=r,f)}function vl(n,t,i){n=(n=+n)>-1?n:0;var r=-1,u=di(n);for(t=ur(t,i,1);++r<n;)u[r]=t(r);return u}function yl(n){return n==null?"":sr(n).replace(os,es)}function pl(n){var t=++ti;return sr(n==null?"":n)+t}function wl(n){return n=new ar(n),n.__chain__=!0,n}function bl(n,t){return t(n),n}function kl(){return this.__chain__=!0,this}function dl(){return sr(this.__wrapped__)}function lo(){return this.__wrapped__}var pi,ut,ie,pu,ku,ir,er,du,ve,pe,we,rf,no,pr,ho;b=b?o.defaults(w.Object(),b,o.pick(w,li)):w;var di=b.Array,ao=b.Boolean,uf=b.Date,vo=b.Error,gr=b.Function,nu=b.Math,yo=b.Number,rr=b.Object,tu=b.RegExp,sr=b.String,hr=b.TypeError,lr=[],ff=vo.prototype,hu=rr.prototype,po=sr.prototype,wo=b._,pt=hu.toString,bo=tu("^"+sr(pt).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),ko=nu.ceil,cu=b.clearTimeout,go=nu.floor,ns=gr.prototype.toString,br=yr(br=rr.getPrototypeOf)&&br,vi=hu.hasOwnProperty,iu=lr.push,lu=hu.propertyIsEnumerable,ru=b.setTimeout,gf=lr.splice,ts=lr.unshift,ne=function(){try{var t={},n=yr(n=rr.defineProperty)&&n,i=n(t,t,t)&&n}catch(r){}return i}(),au=yr(au=rr.create)&&au,ef=yr(ef=di.isArray)&&ef,is=b.isFinite,rs=b.isNaN,vu=yr(vu=rr.keys)&&vu,tr=nu.max,uu=nu.min,of=b.parseInt,te=nu.random,cr={};cr[l]=di;cr[a]=ao;cr[v]=uf;cr[tt]=gr;cr[r]=rr;cr[y]=yo;cr[p]=tu;cr[h]=sr;pi={};pi[l]=pi[v]=pi[y]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0};pi[a]=pi[h]={constructor:!0,toString:!0,valueOf:!0};pi[dt]=pi[tt]=pi[p]={constructor:!0,toString:!0};pi[r]={constructor:!0},function(){for(var i=lt.length,t,n;i--;){t=lt[i];for(n in pi)vi.call(pi,n)&&!vi.call(pi[n],t)&&(pi[n][t]=!1)}}();ar.prototype=rt.prototype;ut=rt.support={},function(){var t=function(){this.x=1},u={"0":1,length:1},i=[],n;t.prototype={valueOf:1,y:1};for(n in new t)i.push(n);for(n in arguments);ut.argsClass=pt.call(arguments)==c;ut.argsObject=arguments.constructor==rr&&!(arguments instanceof di);ut.enumErrorProps=lu.call(ff,"message")||lu.call(ff,"name");ut.enumPrototypes=lu.call(t,"prototype");ut.funcDecomp=!yr(b.WinRTError)&&kt.test(yt);ut.funcNames=typeof gr.name=="string";ut.nonEnumArgs=n!=0;ut.nonEnumShadows=!/valueOf/.test(i);ut.ownLast=i[0]!="x";ut.spliceObjects=(lr.splice.call(u,0,1),!u[0]);ut.unindexedChars="x"[0]+rr("x")[0]!="xx";try{ut.nodeClass=!(pt.call(document)==r&&!({toString:0}+""))}catch(f){ut.nodeClass=!0}}(1);rt.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:bt,variable:"",imports:{_:rt}};ie=function(n){var t="var index, iterable = "+n.firstArg+", result = "+n.init+";\nif (!iterable) return result;\n"+n.top+";",i;if(n.array?(t+="\nvar length = iterable.length; index = -1;\nif ("+n.array+") {  ",ut.unindexedChars&&(t+="\n  if (isString(iterable)) {\n    iterable = iterable.split('')\n  }  "),t+="\n  while (++index < length) {\n    "+n.loop+";\n  }\n}\nelse {  "):ut.nonEnumArgs&&(t+="\n  var length = iterable.length; index = -1;\n  if (length && isArguments(iterable)) {\n    while (++index < length) {\n      index += '';\n      "+n.loop+";\n    }\n  } else {  "),ut.enumPrototypes&&(t+="\n  var skipProto = typeof iterable == 'function';\n  "),ut.enumErrorProps&&(t+="\n  var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n  "),i=[],ut.enumPrototypes&&i.push('!(skipProto && index == "prototype")'),ut.enumErrorProps&&i.push('!(skipErrorProps && (index == "message" || index == "name"))'),n.useHas&&n.keys)t+="\n  var ownIndex = -1,\n      ownProps = objectTypes[typeof iterable] && keys(iterable),\n      length = ownProps ? ownProps.length : 0;\n\n  while (++ownIndex < length) {\n    index = ownProps[ownIndex];\n",i.length&&(t+="    if ("+i.join(" && ")+") {\n  "),t+=n.loop+";    ",i.length&&(t+="\n    }"),t+="\n  }  ";else if(t+="\n  for (index in iterable) {\n",n.useHas&&i.push("hasOwnProperty.call(iterable, index)"),i.length&&(t+="    if ("+i.join(" && ")+") {\n  "),t+=n.loop+";    ",i.length&&(t+="\n    }"),t+="\n  }    ",ut.nonEnumShadows){for(t+="\n\n  if (iterable !== objectProto) {\n    var ctor = iterable.constructor,\n        isProto = iterable === (ctor && ctor.prototype),\n        className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n        nonEnum = nonEnumProps[className];\n      ",k=0;k<7;k++)t+="\n    index = '"+n.shadowedProps[k]+"';\n    if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))",n.useHas||(t+=" || (!nonEnum[index] && iterable[index] !== objectProto[index])"),t+=") {\n      "+n.loop+";\n    }      ";t+="\n  }    "}return(n.array||ut.nonEnumArgs)&&(t+="\n}"),t+(n.bottom+";\nreturn result")};au||(fu=function(){function n(){}return function(t){if(ki(t)){n.prototype=t;n.prototype=null}return{}||b.Object()}}());pu=ne?function(n,t){gt.value=t;ne(n,"__bindData__",gt)}:so;ut.argsClass||(nr=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&vi.call(n,"callee")&&!lu.call(n,"callee")||!1});var ot=ef||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&pt.call(n)==l||!1},ee=dr({args:"object",init:"[]",top:"if (!(objectTypes[typeof object])) return result",loop:"result.push(index)"}),gi=vu?function(n){return ki(n)?ut.enumPrototypes&&typeof n=="function"||ut.nonEnumArgs&&n.length&&nr(n)?ee(n):vu(n):[]}:ee,wu={args:"collection, callback, thisArg",top:"callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)",array:"typeof length == 'number'",keys:gi,loop:"if (callback(iterable[index], index, collection) === false) return result"},af={args:"object, source, guard",top:"var args = arguments,\n    argsIndex = 0,\n    argsLength = typeof guard == 'number' ? 2 : args.length;\nwhile (++argsIndex < argsLength) {\n  iterable = args[argsIndex];\n  if (iterable && objectTypes[typeof iterable]) {",keys:gi,loop:"if (typeof result[index] == 'undefined') result[index] = iterable[index]",bottom:"  }\n}"},oe={top:"if (!objectTypes[typeof iterable]) return result;\n"+wu.top,array:!1},vf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},se=ce(vf),os=tu("("+gi(se).join("|")+")","g"),ss=tu("["+gi(vf).join("")+"]","g"),yi=dr(wu),bu=dr(af,{top:af.top.replace(";",";\nif (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n  var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n  callback = args[--argsLength];\n}"),loop:"result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]"});return ku=dr(af),ir=dr(wu,oe,{useHas:!1}),er=dr(wu,oe),st(/x/)&&(st=function(n){return typeof n=="function"&&pt.call(n)==tt}),du=br?function(n){if(!(n&&pt.call(n)==r)||!ut.argsClass&&nr(n))return!1;var i=n.valueOf,t=yr(i)&&(t=br(i))&&br(t);return t?n==t||br(n)==t:fe(n)}:fe,ve=lf(function(n,t,i){vi.call(n,i)?n[i]++:n[i]=1}),pe=lf(function(n,t,i){(vi.call(n,i)?n[i]:n[i]=[]).push(t)}),we=lf(function(n,t,i){n[i]=t}),rf=su,no=nf,pr=yr(pr=uf.now)&&pr||function(){return(new uf).getTime()},ho=of(wt+"08")==8?of:function(n,t){return of(or(n)?n.replace(hi,""):n,t||0)},rt.after=yc,rt.assign=bu,rt.at=lh,rt.bind=eo,rt.bindAll=pc,rt.bindKey=wc,rt.chain=wl,rt.compact=gh,rt.compose=bc,rt.constant=el,rt.countBy=ve,rt.create=ls,rt.createCallback=ol,rt.curry=kc,rt.debounce=oo,rt.defaults=ku,rt.defer=dc,rt.delay=gc,rt.difference=nc,rt.filter=nf,rt.flatten=rc,rt.forEach=wr,rt.forEachRight=tf,rt.forIn=ir,rt.forInRight=ys,rt.forOwn=er,rt.forOwnRight=he,rt.functions=ou,rt.groupBy=pe,rt.indexBy=we,rt.initial=uc,rt.intersection=fc,rt.invert=ce,rt.invoke=vh,rt.keys=gi,rt.map=su,rt.mapValues=fh,rt.max=be,rt.memoize=nl,rt.merge=eh,rt.min=yh,rt.omit=oh,rt.once=tl,rt.pairs=sh,rt.partial=il,rt.partialRight=rl,rt.pick=hh,rt.pluck=rf,rt.property=co,rt.pull=sc,rt.range=hc,rt.reject=ph,rt.remove=cc,rt.rest=bf,rt.shuffle=de,rt.sortBy=kh,rt.tap=bl,rt.throttle=ul,rt.times=vl,rt.toArray=dh,rt.transform=ch,rt.union=lc,rt.uniq=ro,rt.values=gu,rt.where=no,rt.without=ac,rt.wrap=fl,rt.xor=vc,rt.zip=uo,rt.zipObject=fo,rt.collect=su,rt.drop=bf,rt.each=wr,rt.eachRight=tf,rt.extend=bu,rt.methods=ou,rt.object=fo,rt.select=nf,rt.tail=bf,rt.unique=ro,rt.unzip=uo,df(rt),rt.clone=hs,rt.cloneDeep=cs,rt.contains=ae,rt.escape=sl,rt.every=ye,rt.find=yf,rt.findIndex=tc,rt.findKey=as,rt.findLast=ah,rt.findLastIndex=ic,rt.findLastKey=vs,rt.has=ps,rt.identity=kf,rt.indexOf=to,rt.isArguments=nr,rt.isArray=ot,rt.isBoolean=ws,rt.isDate=bs,rt.isElement=ks,rt.isEmpty=ds,rt.isEqual=gs,rt.isFinite=nh,rt.isFunction=st,rt.isNaN=th,rt.isNull=ih,rt.isNumber=le,rt.isObject=ki,rt.isPlainObject=du,rt.isRegExp=rh,rt.isString=or,rt.isUndefined=uh,rt.lastIndexOf=oc,rt.mixin=df,rt.noConflict=hl,rt.noop=so,rt.now=pr,rt.parseInt=ho,rt.random=cl,rt.reduce=pf,rt.reduceRight=ke,rt.result=ll,rt.runInContext=yt,rt.size=bh,rt.some=ge,rt.sortedIndex=io,rt.template=al,rt.unescape=yl,rt.uniqueId=pl,rt.all=ye,rt.any=ge,rt.detect=yf,rt.findWhere=yf,rt.foldl=pf,rt.foldr=ke,rt.include=ae,rt.inject=pf,df(function(){var n={};return er(rt,function(t,i){rt.prototype[i]||(n[i]=t)}),n}(),!1),rt.first=wf,rt.last=ec,rt.sample=wh,rt.take=wf,rt.head=wf,er(rt,function(n,t){var i=t!=="sample";rt.prototype[t]||(rt.prototype[t]=function(t,r){var u=this.__chain__,f=n(this.__wrapped__,t,r);return!u&&(t==null||r&&!(i&&typeof t=="function"))?f:new ar(f,u)})}),rt.VERSION="2.4.1",rt.prototype.chain=kl,rt.prototype.toString=dl,rt.prototype.value=lo,rt.prototype.valueOf=lo,yi(["join","pop","shift"],function(n){var t=lr[n];rt.prototype[n]=function(){var n=this.__chain__,i=t.apply(this.__wrapped__,arguments);return n?new ar(i,n):i}}),yi(["push","reverse","sort","unshift"],function(n){var t=lr[n];rt.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),yi(["concat","slice","splice"],function(n){var t=lr[n];rt.prototype[n]=function(){return new ar(t.apply(this.__wrapped__,arguments),this.__chain__)}}),ut.spliceObjects||yi(["pop","shift","splice"],function(n){var t=lr[n],i=n=="splice";rt.prototype[n]=function(){var r=this.__chain__,n=this.__wrapped__,u=t.apply(n,arguments);return n.length===0&&delete n[0],r||i?new ar(u,r):u}}),rt}var s,ot=[],st=[],ti=0,ii={},ht=+new Date+"",ct=75,pt=40,wt=" \t\x0b\f ﻿\n\r\u2028\u2029 ᠎             　",ri=/\b__p \+= '';/g,ui=/\b(__p \+=) '' \+/g,fi=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ei=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,oi=/\w*$/,si=/^\s*function[ \n\r\t]+\w/,bt=/<%=([\s\S]+?)%>/g,hi=RegExp("^["+wt+"]*0+(?=.$)"),nt=/($^)/,kt=/\bthis\b/,ci=/['\n\r\t\u2028\u2029\\]/g,li=["Array","Boolean","Date","Error","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"],lt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ai=0,c="[object Arguments]",l="[object Array]",a="[object Boolean]",v="[object Date]",dt="[object Error]",tt="[object Function]",y="[object Number]",r="[object Object]",p="[object RegExp]",h="[object String]",u={},o;u[tt]=!1;u[c]=u[l]=u[a]=u[v]=u[y]=u[r]=u[p]=u[h]=!0;var it={leading:!1,maxWait:0,trailing:!1},gt={configurable:!1,enumerable:!1,value:null,writable:!1},t={args:"",array:null,bottom:"",firstArg:"",init:"",keys:null,loop:"",shadowedProps:null,support:null,top:"",useHas:!1},e={boolean:!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},vi={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},w=e[typeof window]&&window||this,rt=e[typeof exports]&&exports&&!exports.nodeType&&exports,ut=e[typeof module]&&module&&!module.nodeType&&module,yi=ut&&ut.exports===rt&&rt,b=e[typeof global]&&global;b&&(b.global===b||b.window===b)&&(w=b);o=yt();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(w._=o,define(function(){return o})):rt&&ut?yi?(ut.exports=o)._=o:rt._=o:w._=o}.call(this),"undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(n){"use strict";var t=n.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||1==t[0]&&9==t[1]&&t[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher");}(jQuery);+function(n){"use strict";function t(){var i=document.createElement("bootstrap"),n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var t in n)if(void 0!==i.style[t])return{end:n[t]};return!1}n.fn.emulateTransitionEnd=function(t){var i=!1,u=this,r;n(this).one("bsTransitionEnd",function(){i=!0});return r=function(){i||n(u).trigger(n.support.transition.end)},setTimeout(r,t),this};n(function(){n.support.transition=t();n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery);+function(n){"use strict";function u(i){return this.each(function(){var r=n(this),u=r.data("bs.alert");u||r.data("bs.alert",u=new t(this));"string"==typeof i&&u[i].call(r)})}var i='[data-dismiss="alert"]',t=function(t){n(t).on("click",i,this.close)},r;t.VERSION="3.3.2";t.TRANSITION_DURATION=150;t.prototype.close=function(i){function e(){r.detach().trigger("closed.bs.alert").remove()}var f=n(this),u=f.attr("data-target"),r;u||(u=f.attr("href"),u=u&&u.replace(/.*(?=#[^\s]*$)/,""));r=n(u);i&&i.preventDefault();r.length||(r=f.closest(".alert"));r.trigger(i=n.Event("close.bs.alert"));i.isDefaultPrevented()||(r.removeClass("in"),n.support.transition&&r.hasClass("fade")?r.one("bsTransitionEnd",e).emulateTransitionEnd(t.TRANSITION_DURATION):e())};r=n.fn.alert;n.fn.alert=u;n.fn.alert.Constructor=t;n.fn.alert.noConflict=function(){return n.fn.alert=r,this};n(document).on("click.bs.alert.data-api",i,t.prototype.close)}(jQuery);+function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.button"),f="object"==typeof i&&i;r||u.data("bs.button",r=new t(this,f));"toggle"==i?r.toggle():i&&r.setState(i)})}var t=function(i,r){this.$element=n(i);this.options=n.extend({},t.DEFAULTS,r);this.isLoading=!1},r;t.VERSION="3.3.2";t.DEFAULTS={loadingText:"loading..."};t.prototype.setState=function(t){var r="disabled",i=this.$element,f=i.is("input")?"val":"html",u=i.data();t+="Text";null==u.resetText&&i.data("resetText",i[f]());setTimeout(n.proxy(function(){i[f](null==u[t]?this.options[t]:u[t]);"loadingText"==t?(this.isLoading=!0,i.addClass(r).attr(r,r)):this.isLoading&&(this.isLoading=!1,i.removeClass(r).removeAttr(r))},this),0)};t.prototype.toggle=function(){var t=!0,i=this.$element.closest('[data-toggle="buttons"]'),n;i.length?(n=this.$element.find("input"),"radio"==n.prop("type")&&(n.prop("checked")&&this.$element.hasClass("active")?t=!1:i.find(".active").removeClass("active")),t&&n.prop("checked",!this.$element.hasClass("active")).trigger("change")):this.$element.attr("aria-pressed",!this.$element.hasClass("active"));t&&this.$element.toggleClass("active")};r=n.fn.button;n.fn.button=i;n.fn.button.Constructor=t;n.fn.button.noConflict=function(){return n.fn.button=r,this};n(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var r=n(t.target);r.hasClass("btn")||(r=r.closest(".btn"));i.call(r,"toggle");t.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){n(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery);+function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.carousel"),f=n.extend({},t.DEFAULTS,u.data(),"object"==typeof i&&i),e="string"==typeof i?i:f.slide;r||u.data("bs.carousel",r=new t(this,f));"number"==typeof i?r.to(i):e?r[e]():f.interval&&r.pause().cycle()})}var t=function(t,i){this.$element=n(t);this.$indicators=this.$element.find(".carousel-indicators");this.options=i;this.paused=this.sliding=this.interval=this.$active=this.$items=null;this.options.keyboard&&this.$element.on("keydown.bs.carousel",n.proxy(this.keydown,this));"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",n.proxy(this.pause,this)).on("mouseleave.bs.carousel",n.proxy(this.cycle,this))},u,r;t.VERSION="3.3.2";t.TRANSITION_DURATION=600;t.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0};t.prototype.keydown=function(n){if(!/input|textarea/i.test(n.target.tagName)){switch(n.which){case 37:this.prev();break;case 39:this.next();break;default:return}n.preventDefault()}};t.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(n.proxy(this.next,this),this.options.interval)),this};t.prototype.getItemIndex=function(n){return this.$items=n.parent().children(".item"),this.$items.index(n||this.$active)};t.prototype.getItemForDirection=function(n,t){var i=this.getItemIndex(t),f="prev"==n&&0===i||"next"==n&&i==this.$items.length-1,r,u;return f&&!this.options.wrap?t:(r="prev"==n?-1:1,u=(i+r)%this.$items.length,this.$items.eq(u))};t.prototype.to=function(n){var i=this,t=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(n>this.$items.length-1)&&!(0>n))return this.sliding?this.$element.one("slid.bs.carousel",function(){i.to(n)}):t==n?this.pause().cycle():this.slide(n>t?"next":"prev",this.$items.eq(n))};t.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&n.support.transition&&(this.$element.trigger(n.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this};t.prototype.next=function(){if(!this.sliding)return this.slide("next")};t.prototype.prev=function(){if(!this.sliding)return this.slide("prev")};t.prototype.slide=function(i,r){var e=this.$element.find(".item.active"),u=r||this.getItemForDirection(i,e),l=this.interval,f="next"==i?"left":"right",a=this,o,s,h,c;return u.hasClass("active")?this.sliding=!1:(o=u[0],s=n.Event("slide.bs.carousel",{relatedTarget:o,direction:f}),(this.$element.trigger(s),!s.isDefaultPrevented())?((this.sliding=!0,l&&this.pause(),this.$indicators.length)&&(this.$indicators.find(".active").removeClass("active"),h=n(this.$indicators.children()[this.getItemIndex(u)]),h&&h.addClass("active")),c=n.Event("slid.bs.carousel",{relatedTarget:o,direction:f}),n.support.transition&&this.$element.hasClass("slide")?(u.addClass(i),u[0].offsetWidth,e.addClass(f),u.addClass(f),e.one("bsTransitionEnd",function(){u.removeClass([i,f].join(" ")).addClass("active");e.removeClass(["active",f].join(" "));a.sliding=!1;setTimeout(function(){a.$element.trigger(c)},0)}).emulateTransitionEnd(t.TRANSITION_DURATION)):(e.removeClass("active"),u.addClass("active"),this.sliding=!1,this.$element.trigger(c)),l&&this.cycle(),this):void 0)};u=n.fn.carousel;n.fn.carousel=i;n.fn.carousel.Constructor=t;n.fn.carousel.noConflict=function(){return n.fn.carousel=u,this};r=function(t){var o,r=n(this),u=n(r.attr("data-target")||(o=r.attr("href"))&&o.replace(/.*(?=#[^\s]+$)/,"")),e,f;u.hasClass("carousel")&&(e=n.extend({},u.data(),r.data()),f=r.attr("data-slide-to"),f&&(e.interval=!1),i.call(u,e),f&&u.data("bs.carousel").to(f),t.preventDefault())};n(document).on("click.bs.carousel.data-api","[data-slide]",r).on("click.bs.carousel.data-api","[data-slide-to]",r);n(window).on("load",function(){n('[data-ride="carousel"]').each(function(){var t=n(this);i.call(t,t.data())})})}(jQuery);+function(n){"use strict";function r(t){var i,r=t.attr("data-target")||(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"");return n(r)}function i(i){return this.each(function(){var u=n(this),r=u.data("bs.collapse"),f=n.extend({},t.DEFAULTS,u.data(),"object"==typeof i&&i);!r&&f.toggle&&"show"==i&&(f.toggle=!1);r||u.data("bs.collapse",r=new t(this,f));"string"==typeof i&&r[i]()})}var t=function(i,r){this.$element=n(i);this.options=n.extend({},t.DEFAULTS,r);this.$trigger=n(this.options.trigger).filter('[href="#'+i.id+'"], [data-target="#'+i.id+'"]');this.transitioning=null;this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger);this.options.toggle&&this.toggle()},u;t.VERSION="3.3.2";t.TRANSITION_DURATION=350;t.DEFAULTS={toggle:!0,trigger:'[data-toggle="collapse"]'};t.prototype.dimension=function(){var n=this.$element.hasClass("width");return n?"width":"height"};t.prototype.show=function(){var f,r,e,u,o,s;if(!this.transitioning&&!this.$element.hasClass("in")&&(r=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing"),!(r&&r.length&&(f=r.data("bs.collapse"),f&&f.transitioning))&&(e=n.Event("show.bs.collapse"),this.$element.trigger(e),!e.isDefaultPrevented()))){if(r&&r.length&&(i.call(r,"hide"),f||r.data("bs.collapse",null)),u=this.dimension(),this.$element.removeClass("collapse").addClass("collapsing")[u](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1,o=function(){this.$element.removeClass("collapsing").addClass("collapse in")[u]("");this.transitioning=0;this.$element.trigger("shown.bs.collapse")},!n.support.transition)return o.call(this);s=n.camelCase(["scroll",u].join("-"));this.$element.one("bsTransitionEnd",n.proxy(o,this)).emulateTransitionEnd(t.TRANSITION_DURATION)[u](this.$element[0][s])}};t.prototype.hide=function(){var r,i,u;if(!this.transitioning&&this.$element.hasClass("in")&&(r=n.Event("hide.bs.collapse"),this.$element.trigger(r),!r.isDefaultPrevented()))return i=this.dimension(),this.$element[i](this.$element[i]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1,u=function(){this.transitioning=0;this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")},n.support.transition?void this.$element[i](0).one("bsTransitionEnd",n.proxy(u,this)).emulateTransitionEnd(t.TRANSITION_DURATION):u.call(this)};t.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};t.prototype.getParent=function(){return n(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(n.proxy(function(t,i){var u=n(i);this.addAriaAndCollapsedClass(r(u),u)},this)).end()};t.prototype.addAriaAndCollapsedClass=function(n,t){var i=n.hasClass("in");n.attr("aria-expanded",i);t.toggleClass("collapsed",!i).attr("aria-expanded",i)};u=n.fn.collapse;n.fn.collapse=i;n.fn.collapse.Constructor=t;n.fn.collapse.noConflict=function(){return n.fn.collapse=u,this};n(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var u=n(this);u.attr("data-target")||t.preventDefault();var f=r(u),e=f.data("bs.collapse"),o=e?"toggle":n.extend({},u.data(),{trigger:this});i.call(f,o)})}(jQuery);+function(n){"use strict";function r(t){t&&3===t.which||(n(o).remove(),n(i).each(function(){var r=n(this),i=u(r),f={relatedTarget:this};i.hasClass("open")&&(i.trigger(t=n.Event("hide.bs.dropdown",f)),t.isDefaultPrevented()||(r.attr("aria-expanded","false"),i.removeClass("open").trigger("hidden.bs.dropdown",f)))}))}function u(t){var i=t.attr("data-target"),r;return i||(i=t.attr("href"),i=i&&/#[A-Za-z]/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,"")),r=i&&n(i),r&&r.length?r:t.parent()}function e(i){return this.each(function(){var r=n(this),u=r.data("bs.dropdown");u||r.data("bs.dropdown",u=new t(this));"string"==typeof i&&u[i].call(r)})}var o=".dropdown-backdrop",i='[data-toggle="dropdown"]',t=function(t){n(t).on("click.bs.dropdown",this.toggle)},f;t.VERSION="3.3.2";t.prototype.toggle=function(t){var f=n(this),i,o,e;if(!f.is(".disabled, :disabled")){if(i=u(f),o=i.hasClass("open"),r(),!o){if("ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&n('<div class="dropdown-backdrop"/>').insertAfter(n(this)).on("click",r),e={relatedTarget:this},i.trigger(t=n.Event("show.bs.dropdown",e)),t.isDefaultPrevented())return;f.trigger("focus").attr("aria-expanded","true");i.toggleClass("open").trigger("shown.bs.dropdown",e)}return!1}};t.prototype.keydown=function(t){var e,o,s,h,f,r;if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)&&(e=n(this),t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled"))){if(o=u(e),s=o.hasClass("open"),!s&&27!=t.which||s&&27==t.which)return 27==t.which&&o.find(i).trigger("focus"),e.trigger("click");h=" li:not(.divider):visible a";f=o.find('[role="menu"]'+h+', [role="listbox"]'+h);f.length&&(r=f.index(t.target),38==t.which&&r>0&&r--,40==t.which&&r<f.length-1&&r++,~r||(r=0),f.eq(r).trigger("focus"))}};f=n.fn.dropdown;n.fn.dropdown=e;n.fn.dropdown.Constructor=t;n.fn.dropdown.noConflict=function(){return n.fn.dropdown=f,this};n(document).on("click.bs.dropdown.data-api",r).on("click.bs.dropdown.data-api",".dropdown form",function(n){n.stopPropagation()}).on("click.bs.dropdown.data-api",i,t.prototype.toggle).on("keydown.bs.dropdown.data-api",i,t.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="menu"]',t.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="listbox"]',t.prototype.keydown)}(jQuery);+function(n){"use strict";function i(i,r){return this.each(function(){var f=n(this),u=f.data("bs.modal"),e=n.extend({},t.DEFAULTS,f.data(),"object"==typeof i&&i);u||f.data("bs.modal",u=new t(this,e));"string"==typeof i?u[i](r):e.show&&u.show(r)})}var t=function(t,i){this.options=i;this.$body=n(document.body);this.$element=n(t);this.$backdrop=this.isShown=null;this.scrollbarWidth=0;this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,n.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))},r;t.VERSION="3.3.2";t.TRANSITION_DURATION=300;t.BACKDROP_TRANSITION_DURATION=150;t.DEFAULTS={backdrop:!0,keyboard:!0,show:!0};t.prototype.toggle=function(n){return this.isShown?this.hide():this.show(n)};t.prototype.show=function(i){var r=this,u=n.Event("show.bs.modal",{relatedTarget:i});this.$element.trigger(u);this.isShown||u.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',n.proxy(this.hide,this)),this.backdrop(function(){var f=n.support.transition&&r.$element.hasClass("fade"),u;r.$element.parent().length||r.$element.appendTo(r.$body);r.$element.show().scrollTop(0);r.options.backdrop&&r.adjustBackdrop();r.adjustDialog();f&&r.$element[0].offsetWidth;r.$element.addClass("in").attr("aria-hidden",!1);r.enforceFocus();u=n.Event("shown.bs.modal",{relatedTarget:i});f?r.$element.find(".modal-dialog").one("bsTransitionEnd",function(){r.$element.trigger("focus").trigger(u)}).emulateTransitionEnd(t.TRANSITION_DURATION):r.$element.trigger("focus").trigger(u)}))};t.prototype.hide=function(i){i&&i.preventDefault();i=n.Event("hide.bs.modal");this.$element.trigger(i);this.isShown&&!i.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),n(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),n.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",n.proxy(this.hideModal,this)).emulateTransitionEnd(t.TRANSITION_DURATION):this.hideModal())};t.prototype.enforceFocus=function(){n(document).off("focusin.bs.modal").on("focusin.bs.modal",n.proxy(function(n){this.$element[0]===n.target||this.$element.has(n.target).length||this.$element.trigger("focus")},this))};t.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",n.proxy(function(n){27==n.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")};t.prototype.resize=function(){this.isShown?n(window).on("resize.bs.modal",n.proxy(this.handleUpdate,this)):n(window).off("resize.bs.modal")};t.prototype.hideModal=function(){var n=this;this.$element.hide();this.backdrop(function(){n.$body.removeClass("modal-open");n.resetAdjustments();n.resetScrollbar();n.$element.trigger("hidden.bs.modal")})};t.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove();this.$backdrop=null};t.prototype.backdrop=function(i){var e=this,f=this.$element.hasClass("fade")?"fade":"",r,u;if(this.isShown&&this.options.backdrop){if(r=n.support.transition&&f,this.$backdrop=n('<div class="modal-backdrop '+f+'" />').prependTo(this.$element).on("click.dismiss.bs.modal",n.proxy(function(n){n.target===n.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!i)return;r?this.$backdrop.one("bsTransitionEnd",i).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):i()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),u=function(){e.removeBackdrop();i&&i()},n.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",u).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):u()):i&&i()};t.prototype.handleUpdate=function(){this.options.backdrop&&this.adjustBackdrop();this.adjustDialog()};t.prototype.adjustBackdrop=function(){this.$backdrop.css("height",0).css("height",this.$element[0].scrollHeight)};t.prototype.adjustDialog=function(){var n=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&n?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!n?this.scrollbarWidth:""})};t.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})};t.prototype.checkScrollbar=function(){this.bodyIsOverflowing=document.body.scrollHeight>document.documentElement.clientHeight;this.scrollbarWidth=this.measureScrollbar()};t.prototype.setScrollbar=function(){var n=parseInt(this.$body.css("padding-right")||0,10);this.bodyIsOverflowing&&this.$body.css("padding-right",n+this.scrollbarWidth)};t.prototype.resetScrollbar=function(){this.$body.css("padding-right","")};t.prototype.measureScrollbar=function(){var n=document.createElement("div"),t;return n.className="modal-scrollbar-measure",this.$body.append(n),t=n.offsetWidth-n.clientWidth,this.$body[0].removeChild(n),t};r=n.fn.modal;n.fn.modal=i;n.fn.modal.Constructor=t;n.fn.modal.noConflict=function(){return n.fn.modal=r,this};n(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var r=n(this),f=r.attr("href"),u=n(r.attr("data-target")||f&&f.replace(/.*(?=#[^\s]+$)/,"")),e=u.data("bs.modal")?"toggle":n.extend({remote:!/#/.test(f)&&f},u.data(),r.data());r.is("a")&&t.preventDefault();u.one("show.bs.modal",function(n){n.isDefaultPrevented()||u.one("hidden.bs.modal",function(){r.is(":visible")&&r.trigger("focus")})});i.call(u,e,this)})}(jQuery);+function(n){"use strict";function r(i){return this.each(function(){var u=n(this),r=u.data("bs.tooltip"),f="object"==typeof i&&i;(r||"destroy"!=i)&&(r||u.data("bs.tooltip",r=new t(this,f)),"string"==typeof i&&r[i]())})}var t=function(n,t){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null;this.init("tooltip",n,t)},i;t.VERSION="3.3.2";t.TRANSITION_DURATION=150;t.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"><\/div><div class="tooltip-inner"><\/div><\/div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}};t.prototype.init=function(t,i,r){var f,e,u,o,s;for(this.enabled=!0,this.type=t,this.$element=n(i),this.options=this.getOptions(r),this.$viewport=this.options.viewport&&n(this.options.viewport.selector||this.options.viewport),f=this.options.trigger.split(" "),e=f.length;e--;)if(u=f[e],"click"==u)this.$element.on("click."+this.type,this.options.selector,n.proxy(this.toggle,this));else"manual"!=u&&(o="hover"==u?"mouseenter":"focusin",s="hover"==u?"mouseleave":"focusout",this.$element.on(o+"."+this.type,this.options.selector,n.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,n.proxy(this.leave,this)));this.options.selector?this._options=n.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()};t.prototype.getDefaults=function(){return t.DEFAULTS};t.prototype.getOptions=function(t){return t=n.extend({},this.getDefaults(),this.$element.data(),t),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t};t.prototype.getDelegateOptions=function(){var t={},i=this.getDefaults();return this._options&&n.each(this._options,function(n,r){i[n]!=r&&(t[n]=r)}),t};t.prototype.enter=function(t){var i=t instanceof this.constructor?t:n(t.currentTarget).data("bs."+this.type);return i&&i.$tip&&i.$tip.is(":visible")?void(i.hoverState="in"):(i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)),clearTimeout(i.timeout),i.hoverState="in",i.options.delay&&i.options.delay.show?void(i.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show)):i.show())};t.prototype.leave=function(t){var i=t instanceof this.constructor?t:n(t.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)),clearTimeout(i.timeout),i.hoverState="out",i.options.delay&&i.options.delay.hide?void(i.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide)):i.hide()};t.prototype.show=function(){var c=n.Event("show.bs."+this.type),l,p,h;if(this.hasContent()&&this.enabled){if(this.$element.trigger(c),l=n.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]),c.isDefaultPrevented()||!l)return;var u=this,r=this.tip(),a=this.getUID(this.type);this.setContent();r.attr("id",a);this.$element.attr("aria-describedby",a);this.options.animation&&r.addClass("fade");var i="function"==typeof this.options.placement?this.options.placement.call(this,r[0],this.$element[0]):this.options.placement,v=/\s?auto?\s?/i,y=v.test(i);y&&(i=i.replace(v,"")||"top");r.detach().css({top:0,left:0,display:"block"}).addClass(i).data("bs."+this.type,this);this.options.container?r.appendTo(this.options.container):r.insertAfter(this.$element);var f=this.getPosition(),o=r[0].offsetWidth,s=r[0].offsetHeight;if(y){var w=i,b=this.options.container?n(this.options.container):this.$element.parent(),e=this.getPosition(b);i="bottom"==i&&f.bottom+s>e.bottom?"top":"top"==i&&f.top-s<e.top?"bottom":"right"==i&&f.right+o>e.width?"left":"left"==i&&f.left-o<e.left?"right":i;r.removeClass(w).addClass(i)}p=this.getCalculatedOffset(i,f,o,s);this.applyPlacement(p,i);h=function(){var n=u.hoverState;u.$element.trigger("shown.bs."+u.type);u.hoverState=null;"out"==n&&u.leave(u)};n.support.transition&&this.$tip.hasClass("fade")?r.one("bsTransitionEnd",h).emulateTransitionEnd(t.TRANSITION_DURATION):h()}};t.prototype.applyPlacement=function(t,i){var r=this.tip(),l=r[0].offsetWidth,e=r[0].offsetHeight,o=parseInt(r.css("margin-top"),10),s=parseInt(r.css("margin-left"),10),h,f,u;isNaN(o)&&(o=0);isNaN(s)&&(s=0);t.top=t.top+o;t.left=t.left+s;n.offset.setOffset(r[0],n.extend({using:function(n){r.css({top:Math.round(n.top),left:Math.round(n.left)})}},t),0);r.addClass("in");h=r[0].offsetWidth;f=r[0].offsetHeight;"top"==i&&f!=e&&(t.top=t.top+e-f);u=this.getViewportAdjustedDelta(i,t,h,f);u.left?t.left+=u.left:t.top+=u.top;var c=/top|bottom/.test(i),a=c?2*u.left-l+h:2*u.top-e+f,v=c?"offsetWidth":"offsetHeight";r.offset(t);this.replaceArrow(a,r[0][v],c)};t.prototype.replaceArrow=function(n,t,i){this.arrow().css(i?"left":"top",50*(1-n/t)+"%").css(i?"top":"left","")};t.prototype.setContent=function(){var n=this.tip(),t=this.getTitle();n.find(".tooltip-inner")[this.options.html?"html":"text"](t);n.removeClass("fade in top bottom left right")};t.prototype.hide=function(i){function f(){"in"!=r.hoverState&&u.detach();r.$element.removeAttr("aria-describedby").trigger("hidden.bs."+r.type);i&&i()}var r=this,u=this.tip(),e=n.Event("hide.bs."+this.type);return this.$element.trigger(e),e.isDefaultPrevented()?void 0:(u.removeClass("in"),n.support.transition&&this.$tip.hasClass("fade")?u.one("bsTransitionEnd",f).emulateTransitionEnd(t.TRANSITION_DURATION):f(),this.hoverState=null,this)};t.prototype.fixTitle=function(){var n=this.$element;(n.attr("title")||"string"!=typeof n.attr("data-original-title"))&&n.attr("data-original-title",n.attr("title")||"").attr("title","")};t.prototype.hasContent=function(){return this.getTitle()};t.prototype.getPosition=function(t){t=t||this.$element;var u=t[0],r="BODY"==u.tagName,i=u.getBoundingClientRect();null==i.width&&(i=n.extend({},i,{width:i.right-i.left,height:i.bottom-i.top}));var f=r?{top:0,left:0}:t.offset(),e={scroll:r?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},o=r?{width:n(window).width(),height:n(window).height()}:null;return n.extend({},i,e,o,f)};t.prototype.getCalculatedOffset=function(n,t,i,r){return"bottom"==n?{top:t.top+t.height,left:t.left+t.width/2-i/2}:"top"==n?{top:t.top-r,left:t.left+t.width/2-i/2}:"left"==n?{top:t.top+t.height/2-r/2,left:t.left-i}:{top:t.top+t.height/2-r/2,left:t.left+t.width}};t.prototype.getViewportAdjustedDelta=function(n,t,i,r){var f={top:0,left:0},e,u,o,s,h,c;return this.$viewport?(e=this.options.viewport&&this.options.viewport.padding||0,u=this.getPosition(this.$viewport),/right|left/.test(n)?(o=t.top-e-u.scroll,s=t.top+e-u.scroll+r,o<u.top?f.top=u.top-o:s>u.top+u.height&&(f.top=u.top+u.height-s)):(h=t.left-e,c=t.left+e+i,h<u.left?f.left=u.left-h:c>u.width&&(f.left=u.left+u.width-c)),f):f};t.prototype.getTitle=function(){var t=this.$element,n=this.options;return t.attr("data-original-title")||("function"==typeof n.title?n.title.call(t[0]):n.title)};t.prototype.getUID=function(n){do n+=~~(1e6*Math.random());while(document.getElementById(n));return n};t.prototype.tip=function(){return this.$tip=this.$tip||n(this.options.template)};t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")};t.prototype.enable=function(){this.enabled=!0};t.prototype.disable=function(){this.enabled=!1};t.prototype.toggleEnabled=function(){this.enabled=!this.enabled};t.prototype.toggle=function(t){var i=this;t&&(i=n(t.currentTarget).data("bs."+this.type),i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)));i.tip().hasClass("in")?i.leave(i):i.enter(i)};t.prototype.destroy=function(){var n=this;clearTimeout(this.timeout);this.hide(function(){n.$element.off("."+n.type).removeData("bs."+n.type)})};i=n.fn.tooltip;n.fn.tooltip=r;n.fn.tooltip.Constructor=t;n.fn.tooltip.noConflict=function(){return n.fn.tooltip=i,this}}(jQuery);+function(n){"use strict";function r(i){return this.each(function(){var u=n(this),r=u.data("bs.popover"),f="object"==typeof i&&i;(r||"destroy"!=i)&&(r||u.data("bs.popover",r=new t(this,f)),"string"==typeof i&&r[i]())})}var t=function(n,t){this.init("popover",n,t)},i;if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");t.VERSION="3.3.2";t.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"><\/div><h3 class="popover-title"><\/h3><div class="popover-content"><\/div><\/div>'});t.prototype=n.extend({},n.fn.tooltip.Constructor.prototype);t.prototype.constructor=t;t.prototype.getDefaults=function(){return t.DEFAULTS};t.prototype.setContent=function(){var n=this.tip(),i=this.getTitle(),t=this.getContent();n.find(".popover-title")[this.options.html?"html":"text"](i);n.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof t?"html":"append":"text"](t);n.removeClass("fade top bottom left right in");n.find(".popover-title").html()||n.find(".popover-title").hide()};t.prototype.hasContent=function(){return this.getTitle()||this.getContent()};t.prototype.getContent=function(){var t=this.$element,n=this.options;return t.attr("data-content")||("function"==typeof n.content?n.content.call(t[0]):n.content)};t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};t.prototype.tip=function(){return this.$tip||(this.$tip=n(this.options.template)),this.$tip};i=n.fn.popover;n.fn.popover=r;n.fn.popover.Constructor=t;n.fn.popover.noConflict=function(){return n.fn.popover=i,this}}(jQuery);+function(n){"use strict";function t(i,r){var u=n.proxy(this.process,this);this.$body=n("body");this.$scrollElement=n(n(i).is("body")?window:i);this.options=n.extend({},t.DEFAULTS,r);this.selector=(this.options.target||"")+" .nav li > a";this.offsets=[];this.targets=[];this.activeTarget=null;this.scrollHeight=0;this.$scrollElement.on("scroll.bs.scrollspy",u);this.refresh();this.process()}function i(i){return this.each(function(){var u=n(this),r=u.data("bs.scrollspy"),f="object"==typeof i&&i;r||u.data("bs.scrollspy",r=new t(this,f));"string"==typeof i&&r[i]()})}t.VERSION="3.3.2";t.DEFAULTS={offset:10};t.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)};t.prototype.refresh=function(){var i="offset",r=0,t;n.isWindow(this.$scrollElement[0])||(i="position",r=this.$scrollElement.scrollTop());this.offsets=[];this.targets=[];this.scrollHeight=this.getScrollHeight();t=this;this.$body.find(this.selector).map(function(){var f=n(this),u=f.data("target")||f.attr("href"),t=/^#./.test(u)&&n(u);return t&&t.length&&t.is(":visible")&&[[t[i]().top+r,u]]||null}).sort(function(n,t){return n[0]-t[0]}).each(function(){t.offsets.push(this[0]);t.targets.push(this[1])})};t.prototype.process=function(){var n,i=this.$scrollElement.scrollTop()+this.options.offset,f=this.getScrollHeight(),e=this.options.offset+f-this.$scrollElement.height(),t=this.offsets,r=this.targets,u=this.activeTarget;if(this.scrollHeight!=f&&this.refresh(),i>=e)return u!=(n=r[r.length-1])&&this.activate(n);if(u&&i<t[0])return this.activeTarget=null,this.clear();for(n=t.length;n--;)u!=r[n]&&i>=t[n]&&(!t[n+1]||i<=t[n+1])&&this.activate(r[n])};t.prototype.activate=function(t){this.activeTarget=t;this.clear();var r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=n(r).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active"));i.trigger("activate.bs.scrollspy")};t.prototype.clear=function(){n(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var r=n.fn.scrollspy;n.fn.scrollspy=i;n.fn.scrollspy.Constructor=t;n.fn.scrollspy.noConflict=function(){return n.fn.scrollspy=r,this};n(window).on("load.bs.scrollspy.data-api",function(){n('[data-spy="scroll"]').each(function(){var t=n(this);i.call(t,t.data())})})}(jQuery);+function(n){"use strict";function r(i){return this.each(function(){var u=n(this),r=u.data("bs.tab");r||u.data("bs.tab",r=new t(this));"string"==typeof i&&r[i]()})}var t=function(t){this.element=n(t)},u,i;t.VERSION="3.3.2";t.TRANSITION_DURATION=150;t.prototype.show=function(){var t=this.element,f=t.closest("ul:not(.dropdown-menu)"),i=t.data("target"),u;if(i||(i=t.attr("href"),i=i&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var r=f.find(".active:last a"),e=n.Event("hide.bs.tab",{relatedTarget:t[0]}),o=n.Event("show.bs.tab",{relatedTarget:r[0]});(r.trigger(e),t.trigger(o),o.isDefaultPrevented()||e.isDefaultPrevented())||(u=n(i),this.activate(t.closest("li"),f),this.activate(u,u.parent(),function(){r.trigger({type:"hidden.bs.tab",relatedTarget:t[0]});t.trigger({type:"shown.bs.tab",relatedTarget:r[0]})}))}};t.prototype.activate=function(i,r,u){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1);i.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0);o?(i[0].offsetWidth,i.addClass("in")):i.removeClass("fade");i.parent(".dropdown-menu")&&i.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0);u&&u()}var f=r.find("> .active"),o=u&&n.support.transition&&(f.length&&f.hasClass("fade")||!!r.find("> .fade").length);f.length&&o?f.one("bsTransitionEnd",e).emulateTransitionEnd(t.TRANSITION_DURATION):e();f.removeClass("in")};u=n.fn.tab;n.fn.tab=r;n.fn.tab.Constructor=t;n.fn.tab.noConflict=function(){return n.fn.tab=u,this};i=function(t){t.preventDefault();r.call(n(this),"show")};n(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery);+function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.affix"),f="object"==typeof i&&i;r||u.data("bs.affix",r=new t(this,f));"string"==typeof i&&r[i]()})}var t=function(i,r){this.options=n.extend({},t.DEFAULTS,r);this.$target=n(this.options.target).on("scroll.bs.affix.data-api",n.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",n.proxy(this.checkPositionWithEventLoop,this));this.$element=n(i);this.affixed=this.unpin=this.pinnedOffset=null;this.checkPosition()},r;t.VERSION="3.3.2";t.RESET="affix affix-top affix-bottom";t.DEFAULTS={offset:0,target:window};t.prototype.getState=function(n,t,i,r){var u=this.$target.scrollTop(),f=this.$element.offset(),e=this.$target.height();if(null!=i&&"top"==this.affixed)return i>u?"top":!1;if("bottom"==this.affixed)return null!=i?u+this.unpin<=f.top?!1:"bottom":n-r>=u+e?!1:"bottom";var o=null==this.affixed,s=o?u:f.top,h=o?e:t;return null!=i&&i>=u?"top":null!=r&&s+h>=n-r?"bottom":!1};t.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(t.RESET).addClass("affix");var n=this.$target.scrollTop(),i=this.$element.offset();return this.pinnedOffset=i.top-n};t.prototype.checkPositionWithEventLoop=function(){setTimeout(n.proxy(this.checkPosition,this),1)};t.prototype.checkPosition=function(){var i,e,o;if(this.$element.is(":visible")){var s=this.$element.height(),r=this.options.offset,f=r.top,u=r.bottom,h=n("body").height();if("object"!=typeof r&&(u=f=r),"function"==typeof f&&(f=r.top(this.$element)),"function"==typeof u&&(u=r.bottom(this.$element)),i=this.getState(h,s,f,u),this.affixed!=i){if(null!=this.unpin&&this.$element.css("top",""),e="affix"+(i?"-"+i:""),o=n.Event(e+".bs.affix"),this.$element.trigger(o),o.isDefaultPrevented())return;this.affixed=i;this.unpin="bottom"==i?this.getPinnedOffset():null;this.$element.removeClass(t.RESET).addClass(e).trigger(e.replace("affix","affixed")+".bs.affix")}"bottom"==i&&this.$element.offset({top:h-s-u})}};r=n.fn.affix;n.fn.affix=i;n.fn.affix.Constructor=t;n.fn.affix.noConflict=function(){return n.fn.affix=r,this};n(window).on("load",function(){n('[data-spy="affix"]').each(function(){var r=n(this),t=r.data();t.offset=t.offset||{};null!=t.offsetBottom&&(t.offset.bottom=t.offsetBottom);null!=t.offsetTop&&(t.offset.top=t.offsetTop);i.call(r,t)})})}(jQuery)