/* Minification failed. Returning unminified contents.
(5149,2865-2872): run-time error JS1019: Can't have 'break' outside of loop: break a
(5179,213-220): run-time error JS1019: Can't have 'break' outside of loop: break a
 */
/*!
 * Bootstrap v3.3.6 (http://getbootstrap.com)
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under the MIT license
 */
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>2)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.6",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.6",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),a(c.target).is('input[type="radio"]')||a(c.target).is('input[type="checkbox"]')||c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.6",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.6",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.6",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.6",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.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"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.6",c.TRANSITION_DURATION=150,c.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}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),c.isInStateTrue()?void 0:(clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide())},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);return this.$element.trigger(g),g.isDefaultPrevented()?void 0:(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset(),g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},h=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,g,h,f)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.6",c.DEFAULTS=a.extend({},a.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>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.6",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");
d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.6",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.6",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);;
/*!
 * SmartMenus jQuery Plugin - v1.0.0 - January 27, 2016
 * http://www.smartmenus.org/
 *
 * Copyright Vasil Dinkov, Vadikom Web Ltd.
 * http://vadikom.com
 *
 * Licensed MIT
 */

(function (factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD
        define(['jquery'], factory);
    } else if (typeof module === 'object' && typeof module.exports === 'object') {
        // CommonJS
        module.exports = factory(require('jquery'));
    } else {
        // Global jQuery
        factory(jQuery);
    }
}(function ($) {

    var menuTrees = [],
		IE = !!window.createPopup, // detect it for the iframe shim
		mouse = false, // optimize for touch by default - we will detect for mouse input
		touchEvents = 'ontouchstart' in window, // we use this just to choose between toucn and pointer events, not for touch screen detection
		mouseDetectionEnabled = false,
		requestAnimationFrame = window.requestAnimationFrame || function (callback) { return setTimeout(callback, 1000 / 60); },
		cancelAnimationFrame = window.cancelAnimationFrame || function (id) { clearTimeout(id); };

    // Handle detection for mouse input (i.e. desktop browsers, tablets with a mouse, etc.)
    function initMouseDetection(disable) {
        var eNS = '.smartmenus_mouse';
        if (!mouseDetectionEnabled && !disable) {
            // if we get two consecutive mousemoves within 2 pixels from each other and within 300ms, we assume a real mouse/cursor is present
            // in practice, this seems like impossible to trick unintentianally with a real mouse and a pretty safe detection on touch devices (even with older browsers that do not support touch events)
            var firstTime = true,
				lastMove = null;
            $(document).bind(getEventsNS([
				['mousemove', function (e) {
				    var thisMove = { x: e.pageX, y: e.pageY, timeStamp: new Date().getTime() };
				    if (lastMove) {
				        var deltaX = Math.abs(lastMove.x - thisMove.x),
							deltaY = Math.abs(lastMove.y - thisMove.y);
				        if ((deltaX > 0 || deltaY > 0) && deltaX <= 2 && deltaY <= 2 && thisMove.timeStamp - lastMove.timeStamp <= 300) {
				            mouse = true;
				            // if this is the first check after page load, check if we are not over some item by chance and call the mouseenter handler if yes
				            if (firstTime) {
				                var $a = $(e.target).closest('a');
				                if ($a.is('a')) {
				                    $.each(menuTrees, function () {
				                        if ($.contains(this.$root[0], $a[0])) {
				                            this.itemEnter({ currentTarget: $a[0] });
				                            return false;
				                        }
				                    });
				                }
				                firstTime = false;
				            }
				        }
				    }
				    lastMove = thisMove;
				}],
				[touchEvents ? 'touchstart' : 'pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut', function (e) {
				    if (isTouchEvent(e.originalEvent)) {
				        mouse = false;
				    }
				}]
            ], eNS));
            mouseDetectionEnabled = true;
        } else if (mouseDetectionEnabled && disable) {
            $(document).unbind(eNS);
            mouseDetectionEnabled = false;
        }
    }

    function isTouchEvent(e) {
        return !/^(4|mouse)$/.test(e.pointerType);
    }

    // returns a jQuery bind() ready object
    function getEventsNS(defArr, eNS) {
        if (!eNS) {
            eNS = '';
        }
        var obj = {};
        $.each(defArr, function (index, value) {
            obj[value[0].split(' ').join(eNS + ' ') + eNS] = value[1];
        });
        return obj;
    }

    $.SmartMenus = function (elm, options) {
        this.$root = $(elm);
        this.opts = options;
        this.rootId = ''; // internal
        this.accessIdPrefix = '';
        this.$subArrow = null;
        this.activatedItems = []; // stores last activated A's for each level
        this.visibleSubMenus = []; // stores visible sub menus UL's (might be in no particular order)
        this.showTimeout = 0;
        this.hideTimeout = 0;
        this.scrollTimeout = 0;
        this.clickActivated = false;
        this.focusActivated = false;
        this.zIndexInc = 0;
        this.idInc = 0;
        this.$firstLink = null; // we'll use these for some tests
        this.$firstSub = null; // at runtime so we'll cache them
        this.disabled = false;
        this.$disableOverlay = null;
        this.$touchScrollingSub = null;
        this.cssTransforms3d = 'perspective' in elm.style || 'webkitPerspective' in elm.style;
        this.wasCollapsible = false;
        this.init();
    };

    $.extend($.SmartMenus, {
        hideAll: function () {
            $.each(menuTrees, function () {
                this.menuHideAll();
            });
        },
        destroy: function () {
            while (menuTrees.length) {
                menuTrees[0].destroy();
            }
            initMouseDetection(true);
        },
        prototype: {
            init: function (refresh) {
                var self = this;

                if (!refresh) {
                    menuTrees.push(this);

                    this.rootId = (new Date().getTime() + Math.random() + '').replace(/\D/g, '');
                    this.accessIdPrefix = 'sm-' + this.rootId + '-';

                    if (this.$root.hasClass('sm-rtl')) {
                        this.opts.rightToLeftSubMenus = true;
                    }

                    // init root (main menu)
                    var eNS = '.smartmenus';
                    this.$root
						.data('smartmenus', this)
						.attr('data-smartmenus-id', this.rootId)
						.dataSM('level', 1)
						.bind(getEventsNS([
							['mouseover focusin', $.proxy(this.rootOver, this)],
							['mouseout focusout', $.proxy(this.rootOut, this)],
							['keydown', $.proxy(this.rootKeyDown, this)]
						], eNS))
						.delegate('a', getEventsNS([
							['mouseenter', $.proxy(this.itemEnter, this)],
							['mouseleave', $.proxy(this.itemLeave, this)],
							['mousedown', $.proxy(this.itemDown, this)],
							['focus', $.proxy(this.itemFocus, this)],
							['blur', $.proxy(this.itemBlur, this)],
							['click', $.proxy(this.itemClick, this)]
						], eNS));

                    // hide menus on tap or click outside the root UL
                    eNS += this.rootId;
                    if (this.opts.hideOnClick) {
                        $(document).bind(getEventsNS([
							['touchstart', $.proxy(this.docTouchStart, this)],
							['touchmove', $.proxy(this.docTouchMove, this)],
							['touchend', $.proxy(this.docTouchEnd, this)],
							// for Opera Mobile < 11.5, webOS browser, etc. we'll check click too
							['click', $.proxy(this.docClick, this)]
                        ], eNS));
                    }
                    // hide sub menus on resize
                    $(window).bind(getEventsNS([['resize orientationchange', $.proxy(this.winResize, this)]], eNS));

                    if (this.opts.subIndicators) {
                        this.$subArrow = $('<span/>').addClass('sub-arrow');
                        if (this.opts.subIndicatorsText) {
                            this.$subArrow.html(this.opts.subIndicatorsText);
                        }
                    }

                    // make sure mouse detection is enabled
                    initMouseDetection();
                }

                // init sub menus
                this.$firstSub = this.$root.find('ul').each(function () { self.menuInit($(this)); }).eq(0);

                this.$firstLink = this.$root.find('a').eq(0);

                // find current item
                if (this.opts.markCurrentItem) {
                    var reDefaultDoc = /(index|default)\.[^#\?\/]*/i,
						reHash = /#.*/,
						locHref = window.location.href.replace(reDefaultDoc, ''),
						locHrefNoHash = locHref.replace(reHash, '');
                    this.$root.find('a').each(function () {
                        var href = this.href.replace(reDefaultDoc, ''),
							$this = $(this);
                        if (href == locHref || href == locHrefNoHash) {
                            $this.addClass('current');
                            if (self.opts.markCurrentTree) {
                                $this.parentsUntil('[data-smartmenus-id]', 'ul').each(function () {
                                    $(this).dataSM('parent-a').addClass('current');
                                });
                            }
                        }
                    });
                }

                // save initial state
                this.wasCollapsible = this.isCollapsible();
            },
            destroy: function (refresh) {
                if (!refresh) {
                    var eNS = '.smartmenus';
                    this.$root
						.removeData('smartmenus')
						.removeAttr('data-smartmenus-id')
						.removeDataSM('level')
						.unbind(eNS)
						.undelegate(eNS);
                    eNS += this.rootId;
                    $(document).unbind(eNS);
                    $(window).unbind(eNS);
                    if (this.opts.subIndicators) {
                        this.$subArrow = null;
                    }
                }
                this.menuHideAll();
                var self = this;
                this.$root.find('ul').each(function () {
                    var $this = $(this);
                    if ($this.dataSM('scroll-arrows')) {
                        $this.dataSM('scroll-arrows').remove();
                    }
                    if ($this.dataSM('shown-before')) {
                        if (self.opts.subMenusMinWidth || self.opts.subMenusMaxWidth) {
                            $this.css({ width: '', minWidth: '', maxWidth: '' }).removeClass('sm-nowrap');
                        }
                        if ($this.dataSM('scroll-arrows')) {
                            $this.dataSM('scroll-arrows').remove();
                        }
                        $this.css({ zIndex: '', top: '', left: '', marginLeft: '', marginTop: '', display: '' });
                    }
                    if (($this.attr('id') || '').indexOf(self.accessIdPrefix) == 0) {
                        $this.removeAttr('id');
                    }
                })
					.removeDataSM('in-mega')
					.removeDataSM('shown-before')
					.removeDataSM('ie-shim')
					.removeDataSM('scroll-arrows')
					.removeDataSM('parent-a')
					.removeDataSM('level')
					.removeDataSM('beforefirstshowfired')
					.removeAttr('role')
					.removeAttr('aria-hidden')
					.removeAttr('aria-labelledby')
					.removeAttr('aria-expanded');
                this.$root.find('a.has-submenu').each(function () {
                    var $this = $(this);
                    if ($this.attr('id').indexOf(self.accessIdPrefix) == 0) {
                        $this.removeAttr('id');
                    }
                })
					.removeClass('has-submenu')
					.removeDataSM('sub')
					.removeAttr('aria-haspopup')
					.removeAttr('aria-controls')
					.removeAttr('aria-expanded')
					.closest('li').removeDataSM('sub');
                if (this.opts.subIndicators) {
                    this.$root.find('span.sub-arrow').remove();
                }
                if (this.opts.markCurrentItem) {
                    this.$root.find('a.current').removeClass('current');
                }
                if (!refresh) {
                    this.$root = null;
                    this.$firstLink = null;
                    this.$firstSub = null;
                    if (this.$disableOverlay) {
                        this.$disableOverlay.remove();
                        this.$disableOverlay = null;
                    }
                    menuTrees.splice($.inArray(this, menuTrees), 1);
                }
            },
            disable: function (noOverlay) {
                if (!this.disabled) {
                    this.menuHideAll();
                    // display overlay over the menu to prevent interaction
                    if (!noOverlay && !this.opts.isPopup && this.$root.is(':visible')) {
                        var pos = this.$root.offset();
                        this.$disableOverlay = $('<div class="sm-jquery-disable-overlay"/>').css({
                            position: 'absolute',
                            top: pos.top,
                            left: pos.left,
                            width: this.$root.outerWidth(),
                            height: this.$root.outerHeight(),
                            zIndex: this.getStartZIndex(true),
                            opacity: 0
                        }).appendTo(document.body);
                    }
                    this.disabled = true;
                }
            },
            docClick: function (e) {
                if (this.$touchScrollingSub) {
                    this.$touchScrollingSub = null;
                    return;
                }
                // hide on any click outside the menu or on a menu link
                if (this.visibleSubMenus.length && !$.contains(this.$root[0], e.target) || $(e.target).is('a')) {
                    this.menuHideAll();
                }
            },
            docTouchEnd: function (e) {
                if (!this.lastTouch) {
                    return;
                }
                if (this.visibleSubMenus.length && (this.lastTouch.x2 === undefined || this.lastTouch.x1 == this.lastTouch.x2) && (this.lastTouch.y2 === undefined || this.lastTouch.y1 == this.lastTouch.y2) && (!this.lastTouch.target || !$.contains(this.$root[0], this.lastTouch.target))) {
                    if (this.hideTimeout) {
                        clearTimeout(this.hideTimeout);
                        this.hideTimeout = 0;
                    }
                    // hide with a delay to prevent triggering accidental unwanted click on some page element
                    var self = this;
                    this.hideTimeout = setTimeout(function () { self.menuHideAll(); }, 350);
                }
                this.lastTouch = null;
            },
            docTouchMove: function (e) {
                if (!this.lastTouch) {
                    return;
                }
                var touchPoint = e.originalEvent.touches[0];
                this.lastTouch.x2 = touchPoint.pageX;
                this.lastTouch.y2 = touchPoint.pageY;
            },
            docTouchStart: function (e) {
                var touchPoint = e.originalEvent.touches[0];
                this.lastTouch = { x1: touchPoint.pageX, y1: touchPoint.pageY, target: touchPoint.target };
            },
            enable: function () {
                if (this.disabled) {
                    if (this.$disableOverlay) {
                        this.$disableOverlay.remove();
                        this.$disableOverlay = null;
                    }
                    this.disabled = false;
                }
            },
            getClosestMenu: function (elm) {
                var $closestMenu = $(elm).closest('ul');
                while ($closestMenu.dataSM('in-mega')) {
                    $closestMenu = $closestMenu.parent().closest('ul');
                }
                return $closestMenu[0] || null;
            },
            getHeight: function ($elm) {
                return this.getOffset($elm, true);
            },
            // returns precise width/height float values
            getOffset: function ($elm, height) {
                var old;
                if ($elm.css('display') == 'none') {
                    old = { position: $elm[0].style.position, visibility: $elm[0].style.visibility };
                    $elm.css({ position: 'absolute', visibility: 'hidden' }).show();
                }
                var box = $elm[0].getBoundingClientRect && $elm[0].getBoundingClientRect(),
					val = box && (height ? box.height || box.bottom - box.top : box.width || box.right - box.left);
                if (!val && val !== 0) {
                    val = height ? $elm[0].offsetHeight : $elm[0].offsetWidth;
                }
                if (old) {
                    $elm.hide().css(old);
                }
                return val;
            },
            getStartZIndex: function (root) {
                var zIndex = parseInt(this[root ? '$root' : '$firstSub'].css('z-index'));
                if (!root && isNaN(zIndex)) {
                    zIndex = parseInt(this.$root.css('z-index'));
                }
                return !isNaN(zIndex) ? zIndex : 1;
            },
            getTouchPoint: function (e) {
                return e.touches && e.touches[0] || e.changedTouches && e.changedTouches[0] || e;
            },
            getViewport: function (height) {
                var name = height ? 'Height' : 'Width',
					val = document.documentElement['client' + name],
					val2 = window['inner' + name];
                if (val2) {
                    val = Math.min(val, val2);
                }
                return val;
            },
            getViewportHeight: function () {
                return this.getViewport(true);
            },
            getViewportWidth: function () {
                return this.getViewport();
            },
            getWidth: function ($elm) {
                return this.getOffset($elm);
            },
            handleEvents: function () {
                return !this.disabled && this.isCSSOn();
            },
            handleItemEvents: function ($a) {
                return this.handleEvents() && !this.isLinkInMegaMenu($a);
            },
            isCollapsible: function () {
                return this.$firstSub.css('position') == 'static';
            },
            isCSSOn: function () {
                return this.$firstLink.css('display') == 'block';
            },
            isFixed: function () {
                var isFixed = this.$root.css('position') == 'fixed';
                if (!isFixed) {
                    this.$root.parentsUntil('body').each(function () {
                        if ($(this).css('position') == 'fixed') {
                            isFixed = true;
                            return false;
                        }
                    });
                }
                return isFixed;
            },
            isLinkInMegaMenu: function ($a) {
                return $(this.getClosestMenu($a[0])).hasClass('mega-menu');
            },
            isTouchMode: function () {
                return !mouse || this.opts.noMouseOver || this.isCollapsible();
            },
            itemActivate: function ($a, focus) {
                var $ul = $a.closest('ul'),
					level = $ul.dataSM('level');
                // if for some reason the parent item is not activated (e.g. this is an API call to activate the item), activate all parent items first
                if (level > 1 && (!this.activatedItems[level - 2] || this.activatedItems[level - 2][0] != $ul.dataSM('parent-a')[0])) {
                    var self = this;
                    $($ul.parentsUntil('[data-smartmenus-id]', 'ul').get().reverse()).add($ul).each(function () {
                        self.itemActivate($(this).dataSM('parent-a'));
                    });
                }
                // hide any visible deeper level sub menus
                if (!this.isCollapsible() || focus) {
                    this.menuHideSubMenus(!this.activatedItems[level - 1] || this.activatedItems[level - 1][0] != $a[0] ? level - 1 : level);
                }
                // save new active item for this level
                this.activatedItems[level - 1] = $a;
                if (this.$root.triggerHandler('activate.smapi', $a[0]) === false) {
                    return;
                }
                // show the sub menu if this item has one
                var $sub = $a.dataSM('sub');
                if ($sub && (this.isTouchMode() || (!this.opts.showOnClick || this.clickActivated))) {
                    this.menuShow($sub);
                }
            },
            itemBlur: function (e) {
                var $a = $(e.currentTarget);
                if (!this.handleItemEvents($a)) {
                    return;
                }
                this.$root.triggerHandler('blur.smapi', $a[0]);
            },
            itemClick: function (e) {
                var $a = $(e.currentTarget);
                if (!this.handleItemEvents($a)) {
                    return;
                }
                if (this.$touchScrollingSub && this.$touchScrollingSub[0] == $a.closest('ul')[0]) {
                    this.$touchScrollingSub = null;
                    e.stopPropagation();
                    return false;
                }
                if (this.$root.triggerHandler('click.smapi', $a[0]) === false) {
                    return false;
                }
                var subArrowClicked = $(e.target).is('span.sub-arrow'),
					$sub = $a.dataSM('sub'),
					firstLevelSub = $sub ? $sub.dataSM('level') == 2 : false;
                // if the sub is not visible
                if ($sub && !$sub.is(':visible')) {
                    if (this.opts.showOnClick && firstLevelSub) {
                        this.clickActivated = true;
                    }
                    // try to activate the item and show the sub
                    this.itemActivate($a);
                    // if "itemActivate" showed the sub, prevent the click so that the link is not loaded
                    // if it couldn't show it, then the sub menus are disabled with an !important declaration (e.g. via mobile styles) so let the link get loaded
                    if ($sub.is(':visible')) {
                        this.focusActivated = true;
                        return false;
                    }
                } else if (this.isCollapsible() && subArrowClicked) {
                    this.itemActivate($a);
                    this.menuHide($sub);
                    return false;
                }
                if (this.opts.showOnClick && firstLevelSub || $a.hasClass('disabled') || this.$root.triggerHandler('select.smapi', $a[0]) === false) {
                    return false;
                }
            },
            itemDown: function (e) {
                var $a = $(e.currentTarget);
                if (!this.handleItemEvents($a)) {
                    return;
                }
                $a.dataSM('mousedown', true);
            },
            itemEnter: function (e) {
                var $a = $(e.currentTarget);
                if (!this.handleItemEvents($a)) {
                    return;
                }
                if (!this.isTouchMode()) {
                    if (this.showTimeout) {
                        clearTimeout(this.showTimeout);
                        this.showTimeout = 0;
                    }
                    var self = this;
                    this.showTimeout = setTimeout(function () { self.itemActivate($a); }, this.opts.showOnClick && $a.closest('ul').dataSM('level') == 1 ? 1 : this.opts.showTimeout);
                }
                this.$root.triggerHandler('mouseenter.smapi', $a[0]);
            },
            itemFocus: function (e) {
                var $a = $(e.currentTarget);
                if (!this.handleItemEvents($a)) {
                    return;
                }
                // fix (the mousedown check): in some browsers a tap/click produces consecutive focus + click events so we don't need to activate the item on focus
                if (this.focusActivated && (!this.isTouchMode() || !$a.dataSM('mousedown')) && (!this.activatedItems.length || this.activatedItems[this.activatedItems.length - 1][0] != $a[0])) {
                    this.itemActivate($a, true);
                }
                this.$root.triggerHandler('focus.smapi', $a[0]);
            },
            itemLeave: function (e) {
                var $a = $(e.currentTarget);
                if (!this.handleItemEvents($a)) {
                    return;
                }
                if (!this.isTouchMode()) {
                    $a[0].blur();
                    if (this.showTimeout) {
                        clearTimeout(this.showTimeout);
                        this.showTimeout = 0;
                    }
                }
                $a.removeDataSM('mousedown');
                this.$root.triggerHandler('mouseleave.smapi', $a[0]);
            },
            menuHide: function ($sub) {
                if (this.$root.triggerHandler('beforehide.smapi', $sub[0]) === false) {
                    return;
                }
                $sub.stop(true, true);
                if ($sub.css('display') != 'none') {
                    var complete = function () {
                        // unset z-index
                        $sub.css('z-index', '');
                    };
                    // if sub is collapsible (mobile view)
                    if (this.isCollapsible()) {
                        if (this.opts.collapsibleHideFunction) {
                            this.opts.collapsibleHideFunction.call(this, $sub, complete);
                        } else {
                            $sub.hide(this.opts.collapsibleHideDuration, complete);
                        }
                    } else {
                        if (this.opts.hideFunction) {
                            this.opts.hideFunction.call(this, $sub, complete);
                        } else {
                            $sub.hide(this.opts.hideDuration, complete);
                        }
                    }
                    // remove IE iframe shim
                    if ($sub.dataSM('ie-shim')) {
                        $sub.dataSM('ie-shim').remove().css({ '-webkit-transform': '', transform: '' });
                    }
                    // deactivate scrolling if it is activated for this sub
                    if ($sub.dataSM('scroll')) {
                        this.menuScrollStop($sub);
                        $sub.css({ 'touch-action': '', '-ms-touch-action': '', '-webkit-transform': '', transform: '' })
							.unbind('.smartmenus_scroll').removeDataSM('scroll').dataSM('scroll-arrows').hide();
                    }
                    // unhighlight parent item + accessibility
                    $sub.dataSM('parent-a').removeClass('highlighted').attr('aria-expanded', 'false');
                    $sub.attr({
                        'aria-expanded': 'false',
                        'aria-hidden': 'true'
                    });
                    var level = $sub.dataSM('level');
                    this.activatedItems.splice(level - 1, 1);
                    this.visibleSubMenus.splice($.inArray($sub, this.visibleSubMenus), 1);
                    this.$root.triggerHandler('hide.smapi', $sub[0]);
                }
            },
            menuHideAll: function () {
                if (this.showTimeout) {
                    clearTimeout(this.showTimeout);
                    this.showTimeout = 0;
                }
                // hide all subs
                // if it's a popup, this.visibleSubMenus[0] is the root UL
                var level = this.opts.isPopup ? 1 : 0;
                for (var i = this.visibleSubMenus.length - 1; i >= level; i--) {
                    this.menuHide(this.visibleSubMenus[i]);
                }
                // hide root if it's popup
                if (this.opts.isPopup) {
                    this.$root.stop(true, true);
                    if (this.$root.is(':visible')) {
                        if (this.opts.hideFunction) {
                            this.opts.hideFunction.call(this, this.$root);
                        } else {
                            this.$root.hide(this.opts.hideDuration);
                        }
                        // remove IE iframe shim
                        if (this.$root.dataSM('ie-shim')) {
                            this.$root.dataSM('ie-shim').remove();
                        }
                    }
                }
                this.activatedItems = [];
                this.visibleSubMenus = [];
                this.clickActivated = false;
                this.focusActivated = false;
                // reset z-index increment
                this.zIndexInc = 0;
                this.$root.triggerHandler('hideAll.smapi');
            },
            menuHideSubMenus: function (level) {
                for (var i = this.activatedItems.length - 1; i >= level; i--) {
                    var $sub = this.activatedItems[i].dataSM('sub');
                    if ($sub) {
                        this.menuHide($sub);
                    }
                }
            },
            menuIframeShim: function ($ul) {
                // create iframe shim for the menu
                if (IE && this.opts.overlapControlsInIE && !$ul.dataSM('ie-shim')) {
                    $ul.dataSM('ie-shim', $('<iframe/>').attr({ src: 'javascript:0', tabindex: -9 })
						.css({ position: 'absolute', top: 'auto', left: '0', opacity: 0, border: '0' })
					);
                }
            },
            menuInit: function ($ul) {
                if (!$ul.dataSM('in-mega')) {
                    // mark UL's in mega drop downs (if any) so we can neglect them
                    if ($ul.hasClass('mega-menu')) {
                        $ul.find('ul').dataSM('in-mega', true);
                    }
                    // get level (much faster than, for example, using parentsUntil)
                    var level = 2,
						par = $ul[0];
                    while ((par = par.parentNode.parentNode) != this.$root[0]) {
                        level++;
                    }
                    // cache stuff for quick access
                    var $a = $ul.prevAll('a').eq(-1);
                    // if the link is nested (e.g. in a heading)
                    if (!$a.length) {
                        $a = $ul.prevAll().find('a').eq(-1);
                    }
                    $a.addClass('has-submenu').dataSM('sub', $ul);
                    $ul.dataSM('parent-a', $a)
						.dataSM('level', level)
						.parent().dataSM('sub', $ul);
                    // accessibility
                    var aId = $a.attr('id') || this.accessIdPrefix + (++this.idInc),
						ulId = $ul.attr('id') || this.accessIdPrefix + (++this.idInc);
                    $a.attr({
                        id: aId,
                        'aria-haspopup': 'true',
                        'aria-controls': ulId,
                        'aria-expanded': 'false'
                    });
                    $ul.attr({
                        id: ulId,
                        'role': 'group',
                        'aria-hidden': 'true',
                        'aria-labelledby': aId,
                        'aria-expanded': 'false'
                    });
                    // add sub indicator to parent item
                    if (this.opts.subIndicators) {
                        $a[this.opts.subIndicatorsPos](this.$subArrow.clone());
                    }
                }
            },
            menuPosition: function ($sub) {
                var $a = $sub.dataSM('parent-a'),
					$li = $a.closest('li'),
					$ul = $li.parent(),
					level = $sub.dataSM('level'),
					subW = this.getWidth($sub),
					subH = this.getHeight($sub),
					itemOffset = $a.offset(),
					itemX = itemOffset.left,
					itemY = itemOffset.top,
					itemW = this.getWidth($a),
					itemH = this.getHeight($a),
					$win = $(window),
					winX = $win.scrollLeft(),
					winY = $win.scrollTop(),
					winW = this.getViewportWidth(),
					winH = this.getViewportHeight(),
					horizontalParent = $ul.parent().is('[data-sm-horizontal-sub]') || level == 2 && !$ul.hasClass('sm-vertical'),
					rightToLeft = this.opts.rightToLeftSubMenus && !$li.is('[data-sm-reverse]') || !this.opts.rightToLeftSubMenus && $li.is('[data-sm-reverse]'),
					subOffsetX = level == 2 ? this.opts.mainMenuSubOffsetX : this.opts.subMenusSubOffsetX,
					subOffsetY = level == 2 ? this.opts.mainMenuSubOffsetY : this.opts.subMenusSubOffsetY,
					x, y;
                if (horizontalParent) {
                    x = rightToLeft ? itemW - subW - subOffsetX : subOffsetX;
                    y = this.opts.bottomToTopSubMenus ? -subH - subOffsetY : itemH + subOffsetY;
                } else {
                    x = rightToLeft ? subOffsetX - subW : itemW - subOffsetX;
                    y = this.opts.bottomToTopSubMenus ? itemH - subOffsetY - subH : subOffsetY;
                }
                if (this.opts.keepInViewport) {
                    var absX = itemX + x,
						absY = itemY + y;
                    if (rightToLeft && absX < winX) {
                        x = horizontalParent ? winX - absX + x : itemW - subOffsetX;
                    } else if (!rightToLeft && absX + subW > winX + winW) {
                        x = horizontalParent ? winX + winW - subW - absX + x : subOffsetX - subW;
                    }
                    if (!horizontalParent) {
                        if (subH < winH && absY + subH > winY + winH) {
                            y += winY + winH - subH - absY;
                        } else if (subH >= winH || absY < winY) {
                            y += winY - absY;
                        }
                    }
                    // do we need scrolling?
                    // 0.49 used for better precision when dealing with float values
                    if (horizontalParent && (absY + subH > winY + winH + 0.49 || absY < winY) || !horizontalParent && subH > winH + 0.49) {
                        var self = this;
                        if (!$sub.dataSM('scroll-arrows')) {
                            $sub.dataSM('scroll-arrows', $([$('<span class="scroll-up"><span class="scroll-up-arrow"></span></span>')[0], $('<span class="scroll-down"><span class="scroll-down-arrow"></span></span>')[0]])
								.bind({
								    mouseenter: function () {
								        $sub.dataSM('scroll').up = $(this).hasClass('scroll-up');
								        self.menuScroll($sub);
								    },
								    mouseleave: function (e) {
								        self.menuScrollStop($sub);
								        self.menuScrollOut($sub, e);
								    },
								    'mousewheel DOMMouseScroll': function (e) { e.preventDefault(); }
								})
								.insertAfter($sub)
							);
                        }
                        // bind scroll events and save scroll data for this sub
                        var eNS = '.smartmenus_scroll';
                        $sub.dataSM('scroll', {
                            y: this.cssTransforms3d ? 0 : y - itemH,
                            step: 1,
                            // cache stuff for faster recalcs later
                            itemH: itemH,
                            subH: subH,
                            arrowDownH: this.getHeight($sub.dataSM('scroll-arrows').eq(1))
                        })
							.bind(getEventsNS([
								['mouseover', function (e) { self.menuScrollOver($sub, e); }],
								['mouseout', function (e) { self.menuScrollOut($sub, e); }],
								['mousewheel DOMMouseScroll', function (e) { self.menuScrollMousewheel($sub, e); }]
							], eNS))
							.dataSM('scroll-arrows').css({ top: 'auto', left: '0', marginLeft: x + (parseInt($sub.css('border-left-width')) || 0), width: subW - (parseInt($sub.css('border-left-width')) || 0) - (parseInt($sub.css('border-right-width')) || 0), zIndex: $sub.css('z-index') })
								.eq(horizontalParent && this.opts.bottomToTopSubMenus ? 0 : 1).show();
                        // when a menu tree is fixed positioned we allow scrolling via touch too
                        // since there is no other way to access such long sub menus if no mouse is present
                        if (this.isFixed()) {
                            $sub.css({ 'touch-action': 'none', '-ms-touch-action': 'none' })
								.bind(getEventsNS([
									[touchEvents ? 'touchstart touchmove touchend' : 'pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp', function (e) {
									    self.menuScrollTouch($sub, e);
									}]
								], eNS));
                        }
                    }
                }
                $sub.css({ top: 'auto', left: '0', marginLeft: x, marginTop: y - itemH });
                // IE iframe shim
                this.menuIframeShim($sub);
                if ($sub.dataSM('ie-shim')) {
                    $sub.dataSM('ie-shim').css({ zIndex: $sub.css('z-index'), width: subW, height: subH, marginLeft: x, marginTop: y - itemH });
                }
            },
            menuScroll: function ($sub, once, step) {
                var data = $sub.dataSM('scroll'),
					$arrows = $sub.dataSM('scroll-arrows'),
					end = data.up ? data.upEnd : data.downEnd,
					diff;
                if (!once && data.momentum) {
                    data.momentum *= 0.92;
                    diff = data.momentum;
                    if (diff < 0.5) {
                        this.menuScrollStop($sub);
                        return;
                    }
                } else {
                    diff = step || (once || !this.opts.scrollAccelerate ? this.opts.scrollStep : Math.floor(data.step));
                }
                // hide any visible deeper level sub menus
                var level = $sub.dataSM('level');
                if (this.activatedItems[level - 1] && this.activatedItems[level - 1].dataSM('sub') && this.activatedItems[level - 1].dataSM('sub').is(':visible')) {
                    this.menuHideSubMenus(level - 1);
                }
                data.y = data.up && end <= data.y || !data.up && end >= data.y ? data.y : (Math.abs(end - data.y) > diff ? data.y + (data.up ? diff : -diff) : end);
                $sub.add($sub.dataSM('ie-shim')).css(this.cssTransforms3d ? { '-webkit-transform': 'translate3d(0, ' + data.y + 'px, 0)', transform: 'translate3d(0, ' + data.y + 'px, 0)' } : { marginTop: data.y });
                // show opposite arrow if appropriate
                if (mouse && (data.up && data.y > data.downEnd || !data.up && data.y < data.upEnd)) {
                    $arrows.eq(data.up ? 1 : 0).show();
                }
                // if we've reached the end
                if (data.y == end) {
                    if (mouse) {
                        $arrows.eq(data.up ? 0 : 1).hide();
                    }
                    this.menuScrollStop($sub);
                } else if (!once) {
                    if (this.opts.scrollAccelerate && data.step < this.opts.scrollStep) {
                        data.step += 0.2;
                    }
                    var self = this;
                    this.scrollTimeout = requestAnimationFrame(function () { self.menuScroll($sub); });
                }
            },
            menuScrollMousewheel: function ($sub, e) {
                if (this.getClosestMenu(e.target) == $sub[0]) {
                    e = e.originalEvent;
                    var up = (e.wheelDelta || -e.detail) > 0;
                    if ($sub.dataSM('scroll-arrows').eq(up ? 0 : 1).is(':visible')) {
                        $sub.dataSM('scroll').up = up;
                        this.menuScroll($sub, true);
                    }
                }
                e.preventDefault();
            },
            menuScrollOut: function ($sub, e) {
                if (mouse) {
                    if (!/^scroll-(up|down)/.test((e.relatedTarget || '').className) && ($sub[0] != e.relatedTarget && !$.contains($sub[0], e.relatedTarget) || this.getClosestMenu(e.relatedTarget) != $sub[0])) {
                        $sub.dataSM('scroll-arrows').css('visibility', 'hidden');
                    }
                }
            },
            menuScrollOver: function ($sub, e) {
                if (mouse) {
                    if (!/^scroll-(up|down)/.test(e.target.className) && this.getClosestMenu(e.target) == $sub[0]) {
                        this.menuScrollRefreshData($sub);
                        var data = $sub.dataSM('scroll'),
							upEnd = $(window).scrollTop() - $sub.dataSM('parent-a').offset().top - data.itemH;
                        $sub.dataSM('scroll-arrows').eq(0).css('margin-top', upEnd).end()
							.eq(1).css('margin-top', upEnd + this.getViewportHeight() - data.arrowDownH).end()
							.css('visibility', 'visible');
                    }
                }
            },
            menuScrollRefreshData: function ($sub) {
                var data = $sub.dataSM('scroll'),
					upEnd = $(window).scrollTop() - $sub.dataSM('parent-a').offset().top - data.itemH;
                if (this.cssTransforms3d) {
                    upEnd = -(parseFloat($sub.css('margin-top')) - upEnd);
                }
                $.extend(data, {
                    upEnd: upEnd,
                    downEnd: upEnd + this.getViewportHeight() - data.subH
                });
            },
            menuScrollStop: function ($sub) {
                if (this.scrollTimeout) {
                    cancelAnimationFrame(this.scrollTimeout);
                    this.scrollTimeout = 0;
                    $sub.dataSM('scroll').step = 1;
                    return true;
                }
            },
            menuScrollTouch: function ($sub, e) {
                e = e.originalEvent;
                if (isTouchEvent(e)) {
                    var touchPoint = this.getTouchPoint(e);
                    // neglect event if we touched a visible deeper level sub menu
                    if (this.getClosestMenu(touchPoint.target) == $sub[0]) {
                        var data = $sub.dataSM('scroll');
                        if (/(start|down)$/i.test(e.type)) {
                            if (this.menuScrollStop($sub)) {
                                // if we were scrolling, just stop and don't activate any link on the first touch
                                e.preventDefault();
                                this.$touchScrollingSub = $sub;
                            } else {
                                this.$touchScrollingSub = null;
                            }
                            // update scroll data since the user might have zoomed, etc.
                            this.menuScrollRefreshData($sub);
                            // extend it with the touch properties
                            $.extend(data, {
                                touchStartY: touchPoint.pageY,
                                touchStartTime: e.timeStamp
                            });
                        } else if (/move$/i.test(e.type)) {
                            var prevY = data.touchY !== undefined ? data.touchY : data.touchStartY;
                            if (prevY !== undefined && prevY != touchPoint.pageY) {
                                this.$touchScrollingSub = $sub;
                                var up = prevY < touchPoint.pageY;
                                // changed direction? reset...
                                if (data.up !== undefined && data.up != up) {
                                    $.extend(data, {
                                        touchStartY: touchPoint.pageY,
                                        touchStartTime: e.timeStamp
                                    });
                                }
                                $.extend(data, {
                                    up: up,
                                    touchY: touchPoint.pageY
                                });
                                this.menuScroll($sub, true, Math.abs(touchPoint.pageY - prevY));
                            }
                            e.preventDefault();
                        } else { // touchend/pointerup
                            if (data.touchY !== undefined) {
                                if (data.momentum = Math.pow(Math.abs(touchPoint.pageY - data.touchStartY) / (e.timeStamp - data.touchStartTime), 2) * 15) {
                                    this.menuScrollStop($sub);
                                    this.menuScroll($sub);
                                    e.preventDefault();
                                }
                                delete data.touchY;
                            }
                        }
                    }
                }
            },
            menuShow: function ($sub) {
                if (!$sub.dataSM('beforefirstshowfired')) {
                    $sub.dataSM('beforefirstshowfired', true);
                    if (this.$root.triggerHandler('beforefirstshow.smapi', $sub[0]) === false) {
                        return;
                    }
                }
                if (this.$root.triggerHandler('beforeshow.smapi', $sub[0]) === false) {
                    return;
                }
                $sub.dataSM('shown-before', true)
					.stop(true, true);
                if (!$sub.is(':visible')) {
                    // highlight parent item
                    var $a = $sub.dataSM('parent-a');
                    if (this.opts.keepHighlighted || this.isCollapsible()) {
                        $a.addClass('highlighted');
                    }
                    if (this.isCollapsible()) {
                        $sub.removeClass('sm-nowrap').css({ zIndex: '', width: 'auto', minWidth: '', maxWidth: '', top: '', left: '', marginLeft: '', marginTop: '' });
                    } else {
                        // set z-index
                        $sub.css('z-index', this.zIndexInc = (this.zIndexInc || this.getStartZIndex()) + 1);
                        // min/max-width fix - no way to rely purely on CSS as all UL's are nested
                        if (this.opts.subMenusMinWidth || this.opts.subMenusMaxWidth) {
                            $sub.css({ width: 'auto', minWidth: '', maxWidth: '' }).addClass('sm-nowrap');
                            if (this.opts.subMenusMinWidth) {
                                $sub.css('min-width', this.opts.subMenusMinWidth);
                            }
                            if (this.opts.subMenusMaxWidth) {
                                var noMaxWidth = this.getWidth($sub);
                                $sub.css('max-width', this.opts.subMenusMaxWidth);
                                if (noMaxWidth > this.getWidth($sub)) {
                                    $sub.removeClass('sm-nowrap').css('width', this.opts.subMenusMaxWidth);
                                }
                            }
                        }
                        this.menuPosition($sub);
                        // insert IE iframe shim
                        if ($sub.dataSM('ie-shim')) {
                            $sub.dataSM('ie-shim').insertBefore($sub);
                        }
                    }
                    var complete = function () {
                        // fix: "overflow: hidden;" is not reset on animation complete in jQuery < 1.9.0 in Chrome when global "box-sizing: border-box;" is used
                        $sub.css('overflow', '');
                    };
                    // if sub is collapsible (mobile view)
                    if (this.isCollapsible()) {
                        if (this.opts.collapsibleShowFunction) {
                            this.opts.collapsibleShowFunction.call(this, $sub, complete);
                        } else {
                            $sub.show(this.opts.collapsibleShowDuration, complete);
                        }
                    } else {
                        if (this.opts.showFunction) {
                            this.opts.showFunction.call(this, $sub, complete);
                        } else {
                            $sub.show(this.opts.showDuration, complete);
                        }
                    }
                    // accessibility
                    $a.attr('aria-expanded', 'true');
                    $sub.attr({
                        'aria-expanded': 'true',
                        'aria-hidden': 'false'
                    });
                    // store sub menu in visible array
                    this.visibleSubMenus.push($sub);
                    this.$root.triggerHandler('show.smapi', $sub[0]);
                }
            },
            popupHide: function (noHideTimeout) {
                if (this.hideTimeout) {
                    clearTimeout(this.hideTimeout);
                    this.hideTimeout = 0;
                }
                var self = this;
                this.hideTimeout = setTimeout(function () {
                    self.menuHideAll();
                }, noHideTimeout ? 1 : this.opts.hideTimeout);
            },
            popupShow: function (left, top) {
                if (!this.opts.isPopup) {
                    alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.');
                    return;
                }
                if (this.hideTimeout) {
                    clearTimeout(this.hideTimeout);
                    this.hideTimeout = 0;
                }
                this.$root.dataSM('shown-before', true)
					.stop(true, true);
                if (!this.$root.is(':visible')) {
                    this.$root.css({ left: left, top: top });
                    // IE iframe shim
                    this.menuIframeShim(this.$root);
                    if (this.$root.dataSM('ie-shim')) {
                        this.$root.dataSM('ie-shim').css({ zIndex: this.$root.css('z-index'), width: this.getWidth(this.$root), height: this.getHeight(this.$root), left: left, top: top }).insertBefore(this.$root);
                    }
                    // show menu
                    var self = this,
						complete = function () {
						    self.$root.css('overflow', '');
						};
                    if (this.opts.showFunction) {
                        this.opts.showFunction.call(this, this.$root, complete);
                    } else {
                        this.$root.show(this.opts.showDuration, complete);
                    }
                    this.visibleSubMenus[0] = this.$root;
                }
            },
            refresh: function () {
                this.destroy(true);
                this.init(true);
            },
            rootKeyDown: function (e) {
                if (!this.handleEvents()) {
                    return;
                }
                switch (e.keyCode) {
                    case 27: // reset on Esc
                        var $activeTopItem = this.activatedItems[0];
                        if ($activeTopItem) {
                            this.menuHideAll();
                            $activeTopItem[0].focus();
                            var $sub = $activeTopItem.dataSM('sub');
                            if ($sub) {
                                this.menuHide($sub);
                            }
                        }
                        break;
                    case 32: // activate item's sub on Space
                        var $target = $(e.target);
                        if ($target.is('a') && this.handleItemEvents($target)) {
                            var $sub = $target.dataSM('sub');
                            if ($sub && !$sub.is(':visible')) {
                                this.itemClick({ currentTarget: e.target });
                                e.preventDefault();
                            }
                        }
                        break;
                }
            },
            rootOut: function (e) {
                if (!this.handleEvents() || this.isTouchMode() || e.target == this.$root[0]) {
                    return;
                }
                if (this.hideTimeout) {
                    clearTimeout(this.hideTimeout);
                    this.hideTimeout = 0;
                }
                if (!this.opts.showOnClick || !this.opts.hideOnClick) {
                    var self = this;
                    this.hideTimeout = setTimeout(function () { self.menuHideAll(); }, this.opts.hideTimeout);
                }
            },
            rootOver: function (e) {
                if (!this.handleEvents() || this.isTouchMode() || e.target == this.$root[0]) {
                    return;
                }
                if (this.hideTimeout) {
                    clearTimeout(this.hideTimeout);
                    this.hideTimeout = 0;
                }
            },
            winResize: function (e) {
                if (!this.handleEvents()) {
                    // we still need to resize the disable overlay if it's visible
                    if (this.$disableOverlay) {
                        var pos = this.$root.offset();
                        this.$disableOverlay.css({
                            top: pos.top,
                            left: pos.left,
                            width: this.$root.outerWidth(),
                            height: this.$root.outerHeight()
                        });
                    }
                    return;
                }
                // hide sub menus on resize - on mobile do it only on orientation change
                if (!('onorientationchange' in window) || e.type == 'orientationchange') {
                    var isCollapsible = this.isCollapsible();
                    // if it was collapsible before resize and still is, don't do it
                    if (!(this.wasCollapsible && isCollapsible)) {
                        if (this.activatedItems.length) {
                            this.activatedItems[this.activatedItems.length - 1][0].blur();
                        }
                        this.menuHideAll();
                    }
                    this.wasCollapsible = isCollapsible;
                }
            }
        }
    });

    $.fn.dataSM = function (key, val) {
        if (val) {
            return this.data(key + '_smartmenus', val);
        }
        return this.data(key + '_smartmenus');
    }

    $.fn.removeDataSM = function (key) {
        return this.removeData(key + '_smartmenus');
    }

    $.fn.smartmenus = function (options) {
        if (typeof options == 'string') {
            var args = arguments,
				method = options;
            Array.prototype.shift.call(args);
            return this.each(function () {
                var smartmenus = $(this).data('smartmenus');
                if (smartmenus && smartmenus[method]) {
                    smartmenus[method].apply(smartmenus, args);
                }
            });
        }
        var opts = $.extend({}, $.fn.smartmenus.defaults, options);
        return this.each(function () {
            new $.SmartMenus(this, opts);
        });
    }

    // default settings
    $.fn.smartmenus.defaults = {
        isPopup: false,		// is this a popup menu (can be shown via the popupShow/popupHide methods) or a permanent menu bar
        mainMenuSubOffsetX: 0,		// pixels offset from default position
        mainMenuSubOffsetY: 0,		// pixels offset from default position
        subMenusSubOffsetX: 0,		// pixels offset from default position
        subMenusSubOffsetY: 0,		// pixels offset from default position
        subMenusMinWidth: '15em',		// min-width for the sub menus (any CSS unit) - if set, the fixed width set in CSS will be ignored
        subMenusMaxWidth: '20em',		// max-width for the sub menus (any CSS unit) - if set, the fixed width set in CSS will be ignored
        subIndicators: true,		// create sub menu indicators - creates a SPAN and inserts it in the A
        subIndicatorsPos: 'prepend',	// position of the SPAN relative to the menu item content ('prepend', 'append')
        subIndicatorsText: '+',		// [optionally] add text in the SPAN (e.g. '+') (you may want to check the CSS for the sub indicators too)
        scrollStep: 30,		// pixels step when scrolling long sub menus that do not fit in the viewport height
        scrollAccelerate: true,		// accelerate scrolling or use a fixed step
        showTimeout: 250,		// timeout before showing the sub menus
        hideTimeout: 500,		// timeout before hiding the sub menus
        showDuration: 0,		// duration for show animation - set to 0 for no animation - matters only if showFunction:null
        showFunction: null,		// custom function to use when showing a sub menu (the default is the jQuery 'show')
        // don't forget to call complete() at the end of whatever you do
        // e.g.: function($ul, complete) { $ul.fadeIn(250, complete); }
        hideDuration: 0,		// duration for hide animation - set to 0 for no animation - matters only if hideFunction:null
        hideFunction: function ($ul, complete) { $ul.fadeOut(200, complete); },	// custom function to use when hiding a sub menu (the default is the jQuery 'hide')
        // don't forget to call complete() at the end of whatever you do
        // e.g.: function($ul, complete) { $ul.fadeOut(250, complete); }
        collapsibleShowDuration: 0,		// duration for show animation for collapsible sub menus - matters only if collapsibleShowFunction:null
        collapsibleShowFunction: function ($ul, complete) { $ul.slideDown(200, complete); },	// custom function to use when showing a collapsible sub menu
        // (i.e. when mobile styles are used to make the sub menus collapsible)
        collapsibleHideDuration: 0,		// duration for hide animation for collapsible sub menus - matters only if collapsibleHideFunction:null
        collapsibleHideFunction: function ($ul, complete) { $ul.slideUp(200, complete); },	// custom function to use when hiding a collapsible sub menu
        // (i.e. when mobile styles are used to make the sub menus collapsible)
        showOnClick: false,		// show the first-level sub menus onclick instead of onmouseover (i.e. mimic desktop app menus) (matters only for mouse input)
        hideOnClick: true,		// hide the sub menus on click/tap anywhere on the page
        noMouseOver: false,		// disable sub menus activation onmouseover (i.e. behave like in touch mode - use just mouse clicks) (matters only for mouse input)
        keepInViewport: true,		// reposition the sub menus if needed to make sure they always appear inside the viewport
        keepHighlighted: true,		// keep all ancestor items of the current sub menu highlighted (adds the 'highlighted' class to the A's)
        markCurrentItem: false,		// automatically add the 'current' class to the A element of the item linking to the current URL
        markCurrentTree: true,		// add the 'current' class also to the A elements of all ancestor items of the current item
        rightToLeftSubMenus: false,		// right to left display of the sub menus (check the CSS for the sub indicators' position)
        bottomToTopSubMenus: false,		// bottom to top display of the sub menus
        overlapControlsInIE: true		// make sure sub menus appear on top of special OS controls in IE (i.e. SELECT, OBJECT, EMBED, etc.)
    };

    return $;
}));;
/*!
 * SmartMenus jQuery Plugin Bootstrap Addon - v0.3.0 - January 27, 2016
 * http://www.smartmenus.org/
 *
 * Copyright Vasil Dinkov, Vadikom Web Ltd.
 * http://vadikom.com
 *
 * Licensed MIT
 */

(function (factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD
        define(['jquery', 'jquery.smartmenus'], factory);
    } else if (typeof module === 'object' && typeof module.exports === 'object') {
        // CommonJS
        module.exports = factory(require('jquery'));
    } else {
        // Global jQuery
        factory(jQuery);
    }
}(function ($) {

    $.extend($.SmartMenus.Bootstrap = {}, {
        keydownFix: false,
        init: function () {
            // init all navbars that don't have the "data-sm-skip" attribute set
            var $navbars = $('ul.navbar-nav:not([data-sm-skip])');
            $navbars.each(function () {
                var $this = $(this),
					obj = $this.data('smartmenus');
                // if this navbar is not initialized
                if (!obj) {
                    $this.smartmenus({

                        // these are some good default options that should work for all
                        // you can, of course, tweak these as you like
                        subMenusSubOffsetX: 0, // set the margin left in the submenus
                        subMenusSubOffsetY: 0,
                        subIndicators: false,
                        collapsibleShowFunction: null,
                        collapsibleHideFunction: null,
                        rightToLeftSubMenus: $this.hasClass('navbar-right'),
                        bottomToTopSubMenus: $this.closest('.navbar').hasClass('navbar-fixed-bottom')
                    })
						.bind({
						    // set/unset proper Bootstrap classes for some menu elements
						    'show.smapi': function (e, menu) {
						        var $menu = $(menu),
									$scrollArrows = $menu.dataSM('scroll-arrows');
						        if ($scrollArrows) {
						            // they inherit border-color from body, so we can use its background-color too
						            $scrollArrows.css('background-color', $(document.body).css('background-color'));
						        }
						        $menu.parent().addClass('open');
						    },
						    'hide.smapi': function (e, menu) {
						        $(menu).parent().removeClass('open');
						    }
						});

                    function onInit() {
                        // set Bootstrap's "active" class to SmartMenus "current" items (should someone decide to enable markCurrentItem: true)
                        $this.find('a.current').parent().addClass('active');
                        // remove any Bootstrap required attributes that might cause conflicting issues with the SmartMenus script
                        $this.find('a.has-submenu').each(function () {
                            var $this = $(this);
                            if ($this.is('[data-toggle="dropdown"]')) {
                                $this.dataSM('bs-data-toggle-dropdown', true).removeAttr('data-toggle');
                            }
                            if ($this.is('[role="button"]')) {
                                $this.dataSM('bs-role-button', true).removeAttr('role');
                            }
                        });
                    }

                    onInit();

                    function onBeforeDestroy() {
                        $this.find('a.current').parent().removeClass('active');
                        $this.find('a.has-submenu').each(function () {
                            var $this = $(this);
                            if ($this.dataSM('bs-data-toggle-dropdown')) {
                                $this.attr('data-toggle', 'dropdown').removeDataSM('bs-data-toggle-dropdown');
                            }
                            if ($this.dataSM('bs-role-button')) {
                                $this.attr('role', 'button').removeDataSM('bs-role-button');
                            }
                        });
                    }

                    obj = $this.data('smartmenus');

                    // custom "isCollapsible" method for Bootstrap
                    obj.isCollapsible = function () {
                        return !/^(left|right)$/.test(this.$firstLink.parent().css('float'));
                    };

                    // custom "refresh" method for Bootstrap
                    obj.refresh = function () {
                        $.SmartMenus.prototype.refresh.call(this);
                        onInit();
                        // update collapsible detection
                        detectCollapsible(true);
                    }

                    // custom "destroy" method for Bootstrap
                    obj.destroy = function (refresh) {
                        onBeforeDestroy();
                        $.SmartMenus.prototype.destroy.call(this, refresh);
                    }

                    // keep Bootstrap's default behavior for parent items when the "data-sm-skip-collapsible-behavior" attribute is set to the ul.navbar-nav
                    // i.e. use the whole item area just as a sub menu toggle and don't customize the carets
                    if ($this.is('[data-sm-skip-collapsible-behavior]')) {
                        $this.bind({
                            // click the parent item to toggle the sub menus (and reset deeper levels and other branches on click)
                            'click.smapi': function (e, item) {
                                if (obj.isCollapsible()) {
                                    var $item = $(item),
										$sub = $item.parent().dataSM('sub');
                                    if ($sub && $sub.dataSM('shown-before') && $sub.is(':visible')) {
                                        obj.itemActivate($item);
                                        obj.menuHide($sub);
                                        return false;
                                    }
                                }
                            }
                        });
                    }

                    // onresize detect when the navbar becomes collapsible and add it the "sm-collapsible" class
                    var winW;
                    function detectCollapsible(force) {
                        var newW = obj.getViewportWidth();
                        if (newW != winW || force) {
                            var $carets = $this.find('.caret');
                            if (obj.isCollapsible()) {
                                $this.addClass('sm-collapsible');
                                // set "navbar-toggle" class to carets (so they look like a button) if the "data-sm-skip-collapsible-behavior" attribute is not set to the ul.navbar-nav
                                if (!$this.is('[data-sm-skip-collapsible-behavior]')) {
                                    $carets.addClass('navbar-toggle sub-arrow');
                                }
                            } else {
                                $this.removeClass('sm-collapsible');
                                if (!$this.is('[data-sm-skip-collapsible-behavior]')) {
                                    $carets.removeClass('navbar-toggle sub-arrow');
                                }
                            }
                            winW = newW;
                        }
                    };
                    detectCollapsible();
                    $(window).bind('resize.smartmenus' + obj.rootId, detectCollapsible);
                }
            });
            // keydown fix for Bootstrap 3.3.5+ conflict
            if ($navbars.length && !$.SmartMenus.Bootstrap.keydownFix) {
                // unhook BS keydown handler for all dropdowns
                $(document).off('keydown.bs.dropdown.data-api', '.dropdown-menu');
                // restore BS keydown handler for dropdowns that are not inside SmartMenus navbars
                if ($.fn.dropdown && $.fn.dropdown.Constructor) {
                    $(document).on('keydown.bs.dropdown.data-api', '.dropdown-menu:not([id^="sm-"])', $.fn.dropdown.Constructor.prototype.keydown);
                }
                $.SmartMenus.Bootstrap.keydownFix = true;
            }
        }
    });

    // init ondomready
    $($.SmartMenus.Bootstrap.init);

    return $;
}));;
/*!
 * jQuery Mousewheel 3.1.13
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 */

(function (factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(['jquery'], factory);
    } else if (typeof exports === 'object') {
        // Node/CommonJS style for Browserify
        module.exports = factory;
    } else {
        // Browser globals
        factory(jQuery);
    }
}(function ($) {

    var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
        toBind = ('onwheel' in document || document.documentMode >= 9) ?
                    ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
        slice = Array.prototype.slice,
        nullLowestDeltaTimeout, lowestDelta;

    if ($.event.fixHooks) {
        for (var i = toFix.length; i;) {
            $.event.fixHooks[toFix[--i]] = $.event.mouseHooks;
        }
    }

    var special = $.event.special.mousewheel = {
        version: '3.1.12',

        setup: function () {
            if (this.addEventListener) {
                for (var i = toBind.length; i;) {
                    this.addEventListener(toBind[--i], handler, false);
                }
            } else {
                this.onmousewheel = handler;
            }
            // Store the line height and page height for this particular element
            $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
            $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
        },

        teardown: function () {
            if (this.removeEventListener) {
                for (var i = toBind.length; i;) {
                    this.removeEventListener(toBind[--i], handler, false);
                }
            } else {
                this.onmousewheel = null;
            }
            // Clean up the data we added to the element
            $.removeData(this, 'mousewheel-line-height');
            $.removeData(this, 'mousewheel-page-height');
        },

        getLineHeight: function (elem) {
            var $elem = $(elem),
                $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
            if (!$parent.length) {
                $parent = $('body');
            }
            return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
        },

        getPageHeight: function (elem) {
            return $(elem).height();
        },

        settings: {
            adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
            normalizeOffset: true  // calls getBoundingClientRect for each event
        }
    };

    $.fn.extend({
        mousewheel: function (fn) {
            return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
        },

        unmousewheel: function (fn) {
            return this.unbind('mousewheel', fn);
        }
    });


    function handler(event) {
        var orgEvent = event || window.event,
            args = slice.call(arguments, 1),
            delta = 0,
            deltaX = 0,
            deltaY = 0,
            absDelta = 0,
            offsetX = 0,
            offsetY = 0;
        event = $.event.fix(orgEvent);
        event.type = 'mousewheel';

        // Old school scrollwheel delta
        if ('detail' in orgEvent) { deltaY = orgEvent.detail * -1; }
        if ('wheelDelta' in orgEvent) { deltaY = orgEvent.wheelDelta; }
        if ('wheelDeltaY' in orgEvent) { deltaY = orgEvent.wheelDeltaY; }
        if ('wheelDeltaX' in orgEvent) { deltaX = orgEvent.wheelDeltaX * -1; }

        // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
        if ('axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS) {
            deltaX = deltaY * -1;
            deltaY = 0;
        }

        // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
        delta = deltaY === 0 ? deltaX : deltaY;

        // New school wheel delta (wheel event)
        if ('deltaY' in orgEvent) {
            deltaY = orgEvent.deltaY * -1;
            delta = deltaY;
        }
        if ('deltaX' in orgEvent) {
            deltaX = orgEvent.deltaX;
            if (deltaY === 0) { delta = deltaX * -1; }
        }

        // No change actually happened, no reason to go any further
        if (deltaY === 0 && deltaX === 0) { return; }

        // Need to convert lines and pages to pixels if we aren't already in pixels
        // There are three delta modes:
        //   * deltaMode 0 is by pixels, nothing to do
        //   * deltaMode 1 is by lines
        //   * deltaMode 2 is by pages
        if (orgEvent.deltaMode === 1) {
            var lineHeight = $.data(this, 'mousewheel-line-height');
            delta *= lineHeight;
            deltaY *= lineHeight;
            deltaX *= lineHeight;
        } else if (orgEvent.deltaMode === 2) {
            var pageHeight = $.data(this, 'mousewheel-page-height');
            delta *= pageHeight;
            deltaY *= pageHeight;
            deltaX *= pageHeight;
        }

        // Store lowest absolute delta to normalize the delta values
        absDelta = Math.max(Math.abs(deltaY), Math.abs(deltaX));

        if (!lowestDelta || absDelta < lowestDelta) {
            lowestDelta = absDelta;

            // Adjust older deltas if necessary
            if (shouldAdjustOldDeltas(orgEvent, absDelta)) {
                lowestDelta /= 40;
            }
        }

        // Adjust older deltas if necessary
        if (shouldAdjustOldDeltas(orgEvent, absDelta)) {
            // Divide all the things by 40!
            delta /= 40;
            deltaX /= 40;
            deltaY /= 40;
        }

        // Get a whole, normalized value for the deltas
        delta = Math[delta >= 1 ? 'floor' : 'ceil'](delta / lowestDelta);
        deltaX = Math[deltaX >= 1 ? 'floor' : 'ceil'](deltaX / lowestDelta);
        deltaY = Math[deltaY >= 1 ? 'floor' : 'ceil'](deltaY / lowestDelta);

        // Normalise offsetX and offsetY properties
        if (special.settings.normalizeOffset && this.getBoundingClientRect) {
            var boundingRect = this.getBoundingClientRect();
            offsetX = event.clientX - boundingRect.left;
            offsetY = event.clientY - boundingRect.top;
        }

        // Add information to the event object
        event.deltaX = deltaX;
        event.deltaY = deltaY;
        event.deltaFactor = lowestDelta;
        event.offsetX = offsetX;
        event.offsetY = offsetY;
        // Go ahead and set deltaMode to 0 since we converted to pixels
        // Although this is a little odd since we overwrite the deltaX/Y
        // properties with normalized deltas.
        event.deltaMode = 0;

        // Add event and delta to the front of the arguments
        args.unshift(event, delta, deltaX, deltaY);

        // Clearout lowestDelta after sometime to better
        // handle multiple device types that give different
        // a different lowestDelta
        // Ex: trackpad = 3 and mouse wheel = 120
        if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
        nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);

        return ($.event.dispatch || $.event.handle).apply(this, args);
    }

    function nullLowestDelta() {
        lowestDelta = null;
    }

    function shouldAdjustOldDeltas(orgEvent, absDelta) {
        // If this is an older event and the delta is divisable by 120,
        // then we are assuming that the browser is treating this as an
        // older mouse wheel event and that we should divide the deltas
        // by 40 to try and get a more usable deltaFactor.
        // Side note, this actually impacts the reported scroll distance
        // in older browsers and can cause scrolling to be slower than native.
        // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
        return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
    }

}));
;
/*! =======================================================
                      VERSION  7.0.3              
========================================================= */
"use strict";

function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }

/*! =========================================================
 * bootstrap-slider.js
 *
 * Maintainers:
 *		Kyle Kemp
 *			- Twitter: @seiyria
 *			- Github:  seiyria
 *		Rohit Kalkur
 *			- Twitter: @Rovolutionary
 *			- Github:  rovolution
 *
 * =========================================================
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================= */

/**
 * Bridget makes jQuery widgets
 * v1.0.1
 * MIT license
 */

(function (factory) {
	if (typeof define === "function" && define.amd) {
		define(["jquery"], factory);
	} else if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object" && module.exports) {
		var jQuery;
		try {
			jQuery = require("jquery");
		} catch (err) {
			jQuery = null;
		}
		module.exports = factory(jQuery);
	} else if (window) {
		window.Slider = factory(window.jQuery);
	}
})(function ($) {
	// Reference to Slider constructor
	var Slider;

	(function ($) {

		'use strict';

		// -------------------------- utils -------------------------- //

		var slice = Array.prototype.slice;

		function noop() {}

		// -------------------------- definition -------------------------- //

		function defineBridget($) {

			// bail if no jQuery
			if (!$) {
				return;
			}

			// -------------------------- addOptionMethod -------------------------- //

			/**
    * adds option method -> $().plugin('option', {...})
    * @param {Function} PluginClass - constructor class
    */
			function addOptionMethod(PluginClass) {
				// don't overwrite original option method
				if (PluginClass.prototype.option) {
					return;
				}

				// option setter
				PluginClass.prototype.option = function (opts) {
					// bail out if not an object
					if (!$.isPlainObject(opts)) {
						return;
					}
					this.options = $.extend(true, this.options, opts);
				};
			}

			// -------------------------- plugin bridge -------------------------- //

			// helper function for logging errors
			// $.error breaks jQuery chaining
			var logError = typeof console === 'undefined' ? noop : function (message) {
				console.error(message);
			};

			/**
    * jQuery plugin bridge, access methods like $elem.plugin('method')
    * @param {String} namespace - plugin name
    * @param {Function} PluginClass - constructor class
    */
			function bridge(namespace, PluginClass) {
				// add to jQuery fn namespace
				$.fn[namespace] = function (options) {
					if (typeof options === 'string') {
						// call plugin method when first argument is a string
						// get arguments for method
						var args = slice.call(arguments, 1);

						for (var i = 0, len = this.length; i < len; i++) {
							var elem = this[i];
							var instance = $.data(elem, namespace);
							if (!instance) {
								logError("cannot call methods on " + namespace + " prior to initialization; " + "attempted to call '" + options + "'");
								continue;
							}
							if (!$.isFunction(instance[options]) || options.charAt(0) === '_') {
								logError("no such method '" + options + "' for " + namespace + " instance");
								continue;
							}

							// trigger method with arguments
							var returnValue = instance[options].apply(instance, args);

							// break look and return first value if provided
							if (returnValue !== undefined && returnValue !== instance) {
								return returnValue;
							}
						}
						// return this if no return value
						return this;
					} else {
						var objects = this.map(function () {
							var instance = $.data(this, namespace);
							if (instance) {
								// apply options & init
								instance.option(options);
								instance._init();
							} else {
								// initialize new instance
								instance = new PluginClass(this, options);
								$.data(this, namespace, instance);
							}
							return $(this);
						});

						if (!objects || objects.length > 1) {
							return objects;
						} else {
							return objects[0];
						}
					}
				};
			}

			// -------------------------- bridget -------------------------- //

			/**
    * converts a Prototypical class into a proper jQuery plugin
    *   the class must have a ._init method
    * @param {String} namespace - plugin name, used in $().pluginName
    * @param {Function} PluginClass - constructor class
    */
			$.bridget = function (namespace, PluginClass) {
				addOptionMethod(PluginClass);
				bridge(namespace, PluginClass);
			};

			return $.bridget;
		}

		// get jquery from browser global
		defineBridget($);
	})($);

	/*************************************************
 			BOOTSTRAP-SLIDER SOURCE CODE
 	**************************************************/

	(function ($) {

		var ErrorMsgs = {
			formatInvalidInputErrorMsg: function formatInvalidInputErrorMsg(input) {
				return "Invalid input value '" + input + "' passed in";
			},
			callingContextNotSliderInstance: "Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method"
		};

		var SliderScale = {
			linear: {
				toValue: function toValue(percentage) {
					var rawValue = percentage / 100 * (this.options.max - this.options.min);
					var shouldAdjustWithBase = true;
					if (this.options.ticks_positions.length > 0) {
						var minv,
						    maxv,
						    minp,
						    maxp = 0;
						for (var i = 1; i < this.options.ticks_positions.length; i++) {
							if (percentage <= this.options.ticks_positions[i]) {
								minv = this.options.ticks[i - 1];
								minp = this.options.ticks_positions[i - 1];
								maxv = this.options.ticks[i];
								maxp = this.options.ticks_positions[i];

								break;
							}
						}
						var partialPercentage = (percentage - minp) / (maxp - minp);
						rawValue = minv + partialPercentage * (maxv - minv);
						shouldAdjustWithBase = false;
					}

					var adjustment = shouldAdjustWithBase ? this.options.min : 0;
					var value = adjustment + Math.round(rawValue / this.options.step) * this.options.step;
					if (value < this.options.min) {
						return this.options.min;
					} else if (value > this.options.max) {
						return this.options.max;
					} else {
						return value;
					}
				},
				toPercentage: function toPercentage(value) {
					if (this.options.max === this.options.min) {
						return 0;
					}

					if (this.options.ticks_positions.length > 0) {
						var minv,
						    maxv,
						    minp,
						    maxp = 0;
						for (var i = 0; i < this.options.ticks.length; i++) {
							if (value <= this.options.ticks[i]) {
								minv = i > 0 ? this.options.ticks[i - 1] : 0;
								minp = i > 0 ? this.options.ticks_positions[i - 1] : 0;
								maxv = this.options.ticks[i];
								maxp = this.options.ticks_positions[i];

								break;
							}
						}
						if (i > 0) {
							var partialPercentage = (value - minv) / (maxv - minv);
							return minp + partialPercentage * (maxp - minp);
						}
					}

					return 100 * (value - this.options.min) / (this.options.max - this.options.min);
				}
			},

			logarithmic: {
				/* Based on http://stackoverflow.com/questions/846221/logarithmic-slider */
				toValue: function toValue(percentage) {
					var min = this.options.min === 0 ? 0 : Math.log(this.options.min);
					var max = Math.log(this.options.max);
					var value = Math.exp(min + (max - min) * percentage / 100);
					value = this.options.min + Math.round((value - this.options.min) / this.options.step) * this.options.step;
					/* Rounding to the nearest step could exceed the min or
      * max, so clip to those values. */
					if (value < this.options.min) {
						return this.options.min;
					} else if (value > this.options.max) {
						return this.options.max;
					} else {
						return value;
					}
				},
				toPercentage: function toPercentage(value) {
					if (this.options.max === this.options.min) {
						return 0;
					} else {
						var max = Math.log(this.options.max);
						var min = this.options.min === 0 ? 0 : Math.log(this.options.min);
						var v = value === 0 ? 0 : Math.log(value);
						return 100 * (v - min) / (max - min);
					}
				}
			}
		};

		/*************************************************
  						CONSTRUCTOR
  	**************************************************/
		Slider = function (element, options) {
			createNewSlider.call(this, element, options);
			return this;
		};

		function createNewSlider(element, options) {

			/*
   	The internal state object is used to store data about the current 'state' of slider.
   		This includes values such as the `value`, `enabled`, etc...
   */
			this._state = {
				value: null,
				enabled: null,
				offset: null,
				size: null,
				percentage: null,
				inDrag: false,
				over: false
			};

			if (typeof element === "string") {
				this.element = document.querySelector(element);
			} else if (element instanceof HTMLElement) {
				this.element = element;
			}

			/*************************************************
   					Process Options
   	**************************************************/
			options = options ? options : {};
			var optionTypes = Object.keys(this.defaultOptions);

			for (var i = 0; i < optionTypes.length; i++) {
				var optName = optionTypes[i];

				// First check if an option was passed in via the constructor
				var val = options[optName];
				// If no data attrib, then check data atrributes
				val = typeof val !== 'undefined' ? val : getDataAttrib(this.element, optName);
				// Finally, if nothing was specified, use the defaults
				val = val !== null ? val : this.defaultOptions[optName];

				// Set all options on the instance of the Slider
				if (!this.options) {
					this.options = {};
				}
				this.options[optName] = val;
			}

			/*
   	Validate `tooltip_position` against 'orientation`
   	- if `tooltip_position` is incompatible with orientation, swith it to a default compatible with specified `orientation`
   		-- default for "vertical" -> "right"
   		-- default for "horizontal" -> "left"
   */
			if (this.options.orientation === "vertical" && (this.options.tooltip_position === "top" || this.options.tooltip_position === "bottom")) {

				this.options.tooltip_position = "right";
			} else if (this.options.orientation === "horizontal" && (this.options.tooltip_position === "left" || this.options.tooltip_position === "right")) {

				this.options.tooltip_position = "top";
			}

			function getDataAttrib(element, optName) {
				var dataName = "data-slider-" + optName.replace(/_/g, '-');
				var dataValString = element.getAttribute(dataName);

				try {
					return JSON.parse(dataValString);
				} catch (err) {
					return dataValString;
				}
			}

			/*************************************************
   					Create Markup
   	**************************************************/

			var origWidth = this.element.style.width;
			var updateSlider = false;
			var parent = this.element.parentNode;
			var sliderTrackSelection;
			var sliderTrackLow, sliderTrackHigh;
			var sliderMinHandle;
			var sliderMaxHandle;

			if (this.sliderElem) {
				updateSlider = true;
			} else {
				/* Create elements needed for slider */
				this.sliderElem = document.createElement("div");
				this.sliderElem.className = "slider";

				/* Create slider track elements */
				var sliderTrack = document.createElement("div");
				sliderTrack.className = "slider-track";

				sliderTrackLow = document.createElement("div");
				sliderTrackLow.className = "slider-track-low";

				sliderTrackSelection = document.createElement("div");
				sliderTrackSelection.className = "slider-selection";

				sliderTrackHigh = document.createElement("div");
				sliderTrackHigh.className = "slider-track-high";

				sliderMinHandle = document.createElement("div");
				sliderMinHandle.className = "slider-handle min-slider-handle";
				sliderMinHandle.setAttribute('role', 'slider');
				sliderMinHandle.setAttribute('aria-valuemin', this.options.min);
				sliderMinHandle.setAttribute('aria-valuemax', this.options.max);

				sliderMaxHandle = document.createElement("div");
				sliderMaxHandle.className = "slider-handle max-slider-handle";
				sliderMaxHandle.setAttribute('role', 'slider');
				sliderMaxHandle.setAttribute('aria-valuemin', this.options.min);
				sliderMaxHandle.setAttribute('aria-valuemax', this.options.max);

				sliderTrack.appendChild(sliderTrackLow);
				sliderTrack.appendChild(sliderTrackSelection);
				sliderTrack.appendChild(sliderTrackHigh);

				/* Add aria-labelledby to handle's */
				var isLabelledbyArray = Array.isArray(this.options.labelledby);
				if (isLabelledbyArray && this.options.labelledby[0]) {
					sliderMinHandle.setAttribute('aria-labelledby', this.options.labelledby[0]);
				}
				if (isLabelledbyArray && this.options.labelledby[1]) {
					sliderMaxHandle.setAttribute('aria-labelledby', this.options.labelledby[1]);
				}
				if (!isLabelledbyArray && this.options.labelledby) {
					sliderMinHandle.setAttribute('aria-labelledby', this.options.labelledby);
					sliderMaxHandle.setAttribute('aria-labelledby', this.options.labelledby);
				}

				/* Create ticks */
				this.ticks = [];
				if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) {
					for (i = 0; i < this.options.ticks.length; i++) {
						var tick = document.createElement('div');
						tick.className = 'slider-tick';

						this.ticks.push(tick);
						sliderTrack.appendChild(tick);
					}

					sliderTrackSelection.className += " tick-slider-selection";
				}

				sliderTrack.appendChild(sliderMinHandle);
				sliderTrack.appendChild(sliderMaxHandle);

				this.tickLabels = [];
				if (Array.isArray(this.options.ticks_labels) && this.options.ticks_labels.length > 0) {
					this.tickLabelContainer = document.createElement('div');
					this.tickLabelContainer.className = 'slider-tick-label-container';

					for (i = 0; i < this.options.ticks_labels.length; i++) {
						var label = document.createElement('div');
						var noTickPositionsSpecified = this.options.ticks_positions.length === 0;
						var tickLabelsIndex = this.options.reversed && noTickPositionsSpecified ? this.options.ticks_labels.length - (i + 1) : i;
						label.className = 'slider-tick-label';
						label.innerHTML = this.options.ticks_labels[tickLabelsIndex];

						this.tickLabels.push(label);
						this.tickLabelContainer.appendChild(label);
					}
				}

				var createAndAppendTooltipSubElements = function createAndAppendTooltipSubElements(tooltipElem) {
					var arrow = document.createElement("div");
					arrow.className = "tooltip-arrow";

					var inner = document.createElement("div");
					inner.className = "tooltip-inner";

					tooltipElem.appendChild(arrow);
					tooltipElem.appendChild(inner);
				};

				/* Create tooltip elements */
				var sliderTooltip = document.createElement("div");
				sliderTooltip.className = "tooltip tooltip-main";
				sliderTooltip.setAttribute('role', 'presentation');
				createAndAppendTooltipSubElements(sliderTooltip);

				var sliderTooltipMin = document.createElement("div");
				sliderTooltipMin.className = "tooltip tooltip-min";
				sliderTooltipMin.setAttribute('role', 'presentation');
				createAndAppendTooltipSubElements(sliderTooltipMin);

				var sliderTooltipMax = document.createElement("div");
				sliderTooltipMax.className = "tooltip tooltip-max";
				sliderTooltipMax.setAttribute('role', 'presentation');
				createAndAppendTooltipSubElements(sliderTooltipMax);

				/* Append components to sliderElem */
				this.sliderElem.appendChild(sliderTrack);
				this.sliderElem.appendChild(sliderTooltip);
				this.sliderElem.appendChild(sliderTooltipMin);
				this.sliderElem.appendChild(sliderTooltipMax);

				if (this.tickLabelContainer) {
					this.sliderElem.appendChild(this.tickLabelContainer);
				}

				/* Append slider element to parent container, right before the original <input> element */
				parent.insertBefore(this.sliderElem, this.element);

				/* Hide original <input> element */
				this.element.style.display = "none";
			}
			/* If JQuery exists, cache JQ references */
			if ($) {
				this.$element = $(this.element);
				this.$sliderElem = $(this.sliderElem);
			}

			/*************************************************
   						Setup
   	**************************************************/
			this.eventToCallbackMap = {};
			this.sliderElem.id = this.options.id;

			this.touchCapable = 'ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch;

			this.touchX = 0;
			this.touchY = 0;

			this.tooltip = this.sliderElem.querySelector('.tooltip-main');
			this.tooltipInner = this.tooltip.querySelector('.tooltip-inner');

			this.tooltip_min = this.sliderElem.querySelector('.tooltip-min');
			this.tooltipInner_min = this.tooltip_min.querySelector('.tooltip-inner');

			this.tooltip_max = this.sliderElem.querySelector('.tooltip-max');
			this.tooltipInner_max = this.tooltip_max.querySelector('.tooltip-inner');

			if (SliderScale[this.options.scale]) {
				this.options.scale = SliderScale[this.options.scale];
			}

			if (updateSlider === true) {
				// Reset classes
				this._removeClass(this.sliderElem, 'slider-horizontal');
				this._removeClass(this.sliderElem, 'slider-vertical');
				this._removeClass(this.tooltip, 'hide');
				this._removeClass(this.tooltip_min, 'hide');
				this._removeClass(this.tooltip_max, 'hide');

				// Undo existing inline styles for track
				["left", "top", "width", "height"].forEach(function (prop) {
					this._removeProperty(this.trackLow, prop);
					this._removeProperty(this.trackSelection, prop);
					this._removeProperty(this.trackHigh, prop);
				}, this);

				// Undo inline styles on handles
				[this.handle1, this.handle2].forEach(function (handle) {
					this._removeProperty(handle, 'left');
					this._removeProperty(handle, 'top');
				}, this);

				// Undo inline styles and classes on tooltips
				[this.tooltip, this.tooltip_min, this.tooltip_max].forEach(function (tooltip) {
					this._removeProperty(tooltip, 'left');
					this._removeProperty(tooltip, 'top');
					this._removeProperty(tooltip, 'margin-left');
					this._removeProperty(tooltip, 'margin-top');

					this._removeClass(tooltip, 'right');
					this._removeClass(tooltip, 'top');
				}, this);
			}

			if (this.options.orientation === 'vertical') {
				this._addClass(this.sliderElem, 'slider-vertical');
				this.stylePos = 'top';
				this.mousePos = 'pageY';
				this.sizePos = 'offsetHeight';
			} else {
				this._addClass(this.sliderElem, 'slider-horizontal');
				this.sliderElem.style.width = origWidth;
				this.options.orientation = 'horizontal';
				this.stylePos = 'left';
				this.mousePos = 'pageX';
				this.sizePos = 'offsetWidth';
			}
			this._setTooltipPosition();
			/* In case ticks are specified, overwrite the min and max bounds */
			if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) {
				this.options.max = Math.max.apply(Math, this.options.ticks);
				this.options.min = Math.min.apply(Math, this.options.ticks);
			}

			if (Array.isArray(this.options.value)) {
				this.options.range = true;
				this._state.value = this.options.value;
			} else if (this.options.range) {
				// User wants a range, but value is not an array
				this._state.value = [this.options.value, this.options.max];
			} else {
				this._state.value = this.options.value;
			}

			this.trackLow = sliderTrackLow || this.trackLow;
			this.trackSelection = sliderTrackSelection || this.trackSelection;
			this.trackHigh = sliderTrackHigh || this.trackHigh;

			if (this.options.selection === 'none') {
				this._addClass(this.trackLow, 'hide');
				this._addClass(this.trackSelection, 'hide');
				this._addClass(this.trackHigh, 'hide');
			}

			this.handle1 = sliderMinHandle || this.handle1;
			this.handle2 = sliderMaxHandle || this.handle2;

			if (updateSlider === true) {
				// Reset classes
				this._removeClass(this.handle1, 'round triangle');
				this._removeClass(this.handle2, 'round triangle hide');

				for (i = 0; i < this.ticks.length; i++) {
					this._removeClass(this.ticks[i], 'round triangle hide');
				}
			}

			var availableHandleModifiers = ['round', 'triangle', 'custom'];
			var isValidHandleType = availableHandleModifiers.indexOf(this.options.handle) !== -1;
			if (isValidHandleType) {
				this._addClass(this.handle1, this.options.handle);
				this._addClass(this.handle2, this.options.handle);

				for (i = 0; i < this.ticks.length; i++) {
					this._addClass(this.ticks[i], this.options.handle);
				}
			}

			this._state.offset = this._offset(this.sliderElem);
			this._state.size = this.sliderElem[this.sizePos];
			this.setValue(this._state.value);

			/******************************************
   				Bind Event Listeners
   	******************************************/

			// Bind keyboard handlers
			this.handle1Keydown = this._keydown.bind(this, 0);
			this.handle1.addEventListener("keydown", this.handle1Keydown, false);

			this.handle2Keydown = this._keydown.bind(this, 1);
			this.handle2.addEventListener("keydown", this.handle2Keydown, false);

			this.mousedown = this._mousedown.bind(this);
			this.touchstart = this._touchstart.bind(this);
			this.touchmove = this._touchmove.bind(this);

			if (this.touchCapable) {
				// Bind touch handlers
				this.sliderElem.addEventListener("touchstart", this.touchstart, false);
				this.sliderElem.addEventListener("touchmove", this.touchmove, false);
			}
			this.sliderElem.addEventListener("mousedown", this.mousedown, false);

			// Bind window handlers
			this.resize = this._resize.bind(this);
			window.addEventListener("resize", this.resize, false);

			// Bind tooltip-related handlers
			if (this.options.tooltip === 'hide') {
				this._addClass(this.tooltip, 'hide');
				this._addClass(this.tooltip_min, 'hide');
				this._addClass(this.tooltip_max, 'hide');
			} else if (this.options.tooltip === 'always') {
				this._showTooltip();
				this._alwaysShowTooltip = true;
			} else {
				this.showTooltip = this._showTooltip.bind(this);
				this.hideTooltip = this._hideTooltip.bind(this);

				this.sliderElem.addEventListener("mouseenter", this.showTooltip, false);
				this.sliderElem.addEventListener("mouseleave", this.hideTooltip, false);

				this.handle1.addEventListener("focus", this.showTooltip, false);
				this.handle1.addEventListener("blur", this.hideTooltip, false);

				this.handle2.addEventListener("focus", this.showTooltip, false);
				this.handle2.addEventListener("blur", this.hideTooltip, false);
			}

			if (this.options.enabled) {
				this.enable();
			} else {
				this.disable();
			}
		}

		/*************************************************
  				INSTANCE PROPERTIES/METHODS
  	- Any methods bound to the prototype are considered
  part of the plugin's `public` interface
  	**************************************************/
		Slider.prototype = {
			_init: function _init() {}, // NOTE: Must exist to support bridget

			constructor: Slider,

			defaultOptions: {
				id: "",
				min: 0,
				max: 10,
				step: 1,
				precision: 0,
				orientation: 'horizontal',
				value: 5,
				range: false,
				selection: 'before',
				tooltip: 'show',
				tooltip_split: false,
				handle: 'round',
				reversed: false,
				enabled: true,
				formatter: function formatter(val) {
					if (Array.isArray(val)) {
						return val[0] + " : " + val[1];
					} else {
						return val;
					}
				},
				natural_arrow_keys: false,
				ticks: [],
				ticks_positions: [],
				ticks_labels: [],
				ticks_snap_bounds: 0,
				scale: 'linear',
				focus: false,
				tooltip_position: null,
				labelledby: null
			},

			getElement: function getElement() {
				return this.sliderElem;
			},

			getValue: function getValue() {
				if (this.options.range) {
					return this._state.value;
				} else {
					return this._state.value[0];
				}
			},

			setValue: function setValue(val, triggerSlideEvent, triggerChangeEvent) {
				if (!val) {
					val = 0;
				}
				var oldValue = this.getValue();
				this._state.value = this._validateInputValue(val);
				var applyPrecision = this._applyPrecision.bind(this);

				if (this.options.range) {
					this._state.value[0] = applyPrecision(this._state.value[0]);
					this._state.value[1] = applyPrecision(this._state.value[1]);

					this._state.value[0] = Math.max(this.options.min, Math.min(this.options.max, this._state.value[0]));
					this._state.value[1] = Math.max(this.options.min, Math.min(this.options.max, this._state.value[1]));
				} else {
					this._state.value = applyPrecision(this._state.value);
					this._state.value = [Math.max(this.options.min, Math.min(this.options.max, this._state.value))];
					this._addClass(this.handle2, 'hide');
					if (this.options.selection === 'after') {
						this._state.value[1] = this.options.max;
					} else {
						this._state.value[1] = this.options.min;
					}
				}

				if (this.options.max > this.options.min) {
					this._state.percentage = [this._toPercentage(this._state.value[0]), this._toPercentage(this._state.value[1]), this.options.step * 100 / (this.options.max - this.options.min)];
				} else {
					this._state.percentage = [0, 0, 100];
				}

				this._layout();
				var newValue = this.options.range ? this._state.value : this._state.value[0];

				this._setDataVal(newValue);
				if (triggerSlideEvent === true) {
					this._trigger('slide', newValue);
				}
				if (oldValue !== newValue && triggerChangeEvent === true) {
					this._trigger('change', {
						oldValue: oldValue,
						newValue: newValue
					});
				}

				return this;
			},

			destroy: function destroy() {
				// Remove event handlers on slider elements
				this._removeSliderEventHandlers();

				// Remove the slider from the DOM
				this.sliderElem.parentNode.removeChild(this.sliderElem);
				/* Show original <input> element */
				this.element.style.display = "";

				// Clear out custom event bindings
				this._cleanUpEventCallbacksMap();

				// Remove data values
				this.element.removeAttribute("data");

				// Remove JQuery handlers/data
				if ($) {
					this._unbindJQueryEventHandlers();
					this.$element.removeData('slider');
				}
			},

			disable: function disable() {
				this._state.enabled = false;
				this.handle1.removeAttribute("tabindex");
				this.handle2.removeAttribute("tabindex");
				this._addClass(this.sliderElem, 'slider-disabled');
				this._trigger('slideDisabled');

				return this;
			},

			enable: function enable() {
				this._state.enabled = true;
				this.handle1.setAttribute("tabindex", 0);
				this.handle2.setAttribute("tabindex", 0);
				this._removeClass(this.sliderElem, 'slider-disabled');
				this._trigger('slideEnabled');

				return this;
			},

			toggle: function toggle() {
				if (this._state.enabled) {
					this.disable();
				} else {
					this.enable();
				}
				return this;
			},

			isEnabled: function isEnabled() {
				return this._state.enabled;
			},

			on: function on(evt, callback) {
				this._bindNonQueryEventHandler(evt, callback);
				return this;
			},

			off: function off(evt, callback) {
				if ($) {
					this.$element.off(evt, callback);
					this.$sliderElem.off(evt, callback);
				} else {
					this._unbindNonQueryEventHandler(evt, callback);
				}
			},

			getAttribute: function getAttribute(attribute) {
				if (attribute) {
					return this.options[attribute];
				} else {
					return this.options;
				}
			},

			setAttribute: function setAttribute(attribute, value) {
				this.options[attribute] = value;
				return this;
			},

			refresh: function refresh() {
				this._removeSliderEventHandlers();
				createNewSlider.call(this, this.element, this.options);
				if ($) {
					// Bind new instance of slider to the element
					$.data(this.element, 'slider', this);
				}
				return this;
			},

			relayout: function relayout() {
				this._resize();
				this._layout();
				return this;
			},

			/******************************+
   				HELPERS
   	- Any method that is not part of the public interface.
   - Place it underneath this comment block and write its signature like so:
   	  					_fnName : function() {...}
   	********************************/
			_removeSliderEventHandlers: function _removeSliderEventHandlers() {
				// Remove keydown event listeners
				this.handle1.removeEventListener("keydown", this.handle1Keydown, false);
				this.handle2.removeEventListener("keydown", this.handle2Keydown, false);

				if (this.showTooltip) {
					this.handle1.removeEventListener("focus", this.showTooltip, false);
					this.handle2.removeEventListener("focus", this.showTooltip, false);
				}
				if (this.hideTooltip) {
					this.handle1.removeEventListener("blur", this.hideTooltip, false);
					this.handle2.removeEventListener("blur", this.hideTooltip, false);
				}

				// Remove event listeners from sliderElem
				if (this.showTooltip) {
					this.sliderElem.removeEventListener("mouseenter", this.showTooltip, false);
				}
				if (this.hideTooltip) {
					this.sliderElem.removeEventListener("mouseleave", this.hideTooltip, false);
				}
				this.sliderElem.removeEventListener("touchstart", this.touchstart, false);
				this.sliderElem.removeEventListener("touchmove", this.touchmove, false);
				this.sliderElem.removeEventListener("mousedown", this.mousedown, false);

				// Remove window event listener
				window.removeEventListener("resize", this.resize, false);
			},
			_bindNonQueryEventHandler: function _bindNonQueryEventHandler(evt, callback) {
				if (this.eventToCallbackMap[evt] === undefined) {
					this.eventToCallbackMap[evt] = [];
				}
				this.eventToCallbackMap[evt].push(callback);
			},
			_unbindNonQueryEventHandler: function _unbindNonQueryEventHandler(evt, callback) {
				var callbacks = this.eventToCallbackMap[evt];
				if (callbacks !== undefined) {
					for (var i = 0; i < callbacks.length; i++) {
						if (callbacks[i] === callback) {
							callbacks.splice(i, 1);
							break;
						}
					}
				}
			},
			_cleanUpEventCallbacksMap: function _cleanUpEventCallbacksMap() {
				var eventNames = Object.keys(this.eventToCallbackMap);
				for (var i = 0; i < eventNames.length; i++) {
					var eventName = eventNames[i];
					this.eventToCallbackMap[eventName] = null;
				}
			},
			_showTooltip: function _showTooltip() {
				if (this.options.tooltip_split === false) {
					this._addClass(this.tooltip, 'in');
					this.tooltip_min.style.display = 'none';
					this.tooltip_max.style.display = 'none';
				} else {
					this._addClass(this.tooltip_min, 'in');
					this._addClass(this.tooltip_max, 'in');
					this.tooltip.style.display = 'none';
				}
				this._state.over = true;
			},
			_hideTooltip: function _hideTooltip() {
				if (this._state.inDrag === false && this.alwaysShowTooltip !== true) {
					this._removeClass(this.tooltip, 'in');
					this._removeClass(this.tooltip_min, 'in');
					this._removeClass(this.tooltip_max, 'in');
				}
				this._state.over = false;
			},
			_layout: function _layout() {
				var positionPercentages;

				if (this.options.reversed) {
					positionPercentages = [100 - this._state.percentage[0], this.options.range ? 100 - this._state.percentage[1] : this._state.percentage[1]];
				} else {
					positionPercentages = [this._state.percentage[0], this._state.percentage[1]];
				}

				this.handle1.style[this.stylePos] = positionPercentages[0] + '%';
				this.handle1.setAttribute('aria-valuenow', this._state.value[0]);

				this.handle2.style[this.stylePos] = positionPercentages[1] + '%';
				this.handle2.setAttribute('aria-valuenow', this._state.value[1]);

				/* Position ticks and labels */
				if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) {

					var styleSize = this.options.orientation === 'vertical' ? 'height' : 'width';
					var styleMargin = this.options.orientation === 'vertical' ? 'marginTop' : 'marginLeft';
					var labelSize = this._state.size / (this.options.ticks.length - 1);

					if (this.tickLabelContainer) {
						var extraMargin = 0;
						if (this.options.ticks_positions.length === 0) {
							if (this.options.orientation !== 'vertical') {
								this.tickLabelContainer.style[styleMargin] = -labelSize / 2 + 'px';
							}

							extraMargin = this.tickLabelContainer.offsetHeight;
						} else {
							/* Chidren are position absolute, calculate height by finding the max offsetHeight of a child */
							for (i = 0; i < this.tickLabelContainer.childNodes.length; i++) {
								if (this.tickLabelContainer.childNodes[i].offsetHeight > extraMargin) {
									extraMargin = this.tickLabelContainer.childNodes[i].offsetHeight;
								}
							}
						}
						if (this.options.orientation === 'horizontal') {
							this.sliderElem.style.marginBottom = extraMargin + 'px';
						}
					}
					for (var i = 0; i < this.options.ticks.length; i++) {

						var percentage = this.options.ticks_positions[i] || this._toPercentage(this.options.ticks[i]);

						if (this.options.reversed) {
							percentage = 100 - percentage;
						}

						this.ticks[i].style[this.stylePos] = percentage + '%';

						/* Set class labels to denote whether ticks are in the selection */
						this._removeClass(this.ticks[i], 'in-selection');
						if (!this.options.range) {
							if (this.options.selection === 'after' && percentage >= positionPercentages[0]) {
								this._addClass(this.ticks[i], 'in-selection');
							} else if (this.options.selection === 'before' && percentage <= positionPercentages[0]) {
								this._addClass(this.ticks[i], 'in-selection');
							}
						} else if (percentage >= positionPercentages[0] && percentage <= positionPercentages[1]) {
							this._addClass(this.ticks[i], 'in-selection');
						}

						if (this.tickLabels[i]) {
							this.tickLabels[i].style[styleSize] = labelSize + 'px';

							if (this.options.orientation !== 'vertical' && this.options.ticks_positions[i] !== undefined) {
								this.tickLabels[i].style.position = 'absolute';
								this.tickLabels[i].style[this.stylePos] = percentage + '%';
								this.tickLabels[i].style[styleMargin] = -labelSize / 2 + 'px';
							} else if (this.options.orientation === 'vertical') {
								this.tickLabels[i].style['marginLeft'] = this.sliderElem.offsetWidth + 'px';
								this.tickLabelContainer.style['marginTop'] = this.sliderElem.offsetWidth / 2 * -1 + 'px';
							}
						}
					}
				}

				var formattedTooltipVal;

				if (this.options.range) {
					formattedTooltipVal = this.options.formatter(this._state.value);
					this._setText(this.tooltipInner, formattedTooltipVal);
					this.tooltip.style[this.stylePos] = (positionPercentages[1] + positionPercentages[0]) / 2 + '%';

					if (this.options.orientation === 'vertical') {
						this._css(this.tooltip, 'margin-top', -this.tooltip.offsetHeight / 2 + 'px');
					} else {
						this._css(this.tooltip, 'margin-left', -this.tooltip.offsetWidth / 2 + 'px');
					}

					if (this.options.orientation === 'vertical') {
						this._css(this.tooltip, 'margin-top', -this.tooltip.offsetHeight / 2 + 'px');
					} else {
						this._css(this.tooltip, 'margin-left', -this.tooltip.offsetWidth / 2 + 'px');
					}

					var innerTooltipMinText = this.options.formatter(this._state.value[0]);
					this._setText(this.tooltipInner_min, innerTooltipMinText);

					var innerTooltipMaxText = this.options.formatter(this._state.value[1]);
					this._setText(this.tooltipInner_max, innerTooltipMaxText);

					this.tooltip_min.style[this.stylePos] = positionPercentages[0] + '%';

					if (this.options.orientation === 'vertical') {
						this._css(this.tooltip_min, 'margin-top', -this.tooltip_min.offsetHeight / 2 + 'px');
					} else {
						this._css(this.tooltip_min, 'margin-left', -this.tooltip_min.offsetWidth / 2 + 'px');
					}

					this.tooltip_max.style[this.stylePos] = positionPercentages[1] + '%';

					if (this.options.orientation === 'vertical') {
						this._css(this.tooltip_max, 'margin-top', -this.tooltip_max.offsetHeight / 2 + 'px');
					} else {
						this._css(this.tooltip_max, 'margin-left', -this.tooltip_max.offsetWidth / 2 + 'px');
					}
				} else {
					formattedTooltipVal = this.options.formatter(this._state.value[0]);
					this._setText(this.tooltipInner, formattedTooltipVal);

					this.tooltip.style[this.stylePos] = positionPercentages[0] + '%';
					if (this.options.orientation === 'vertical') {
						this._css(this.tooltip, 'margin-top', -this.tooltip.offsetHeight / 2 + 'px');
					} else {
						this._css(this.tooltip, 'margin-left', -this.tooltip.offsetWidth / 2 + 'px');
					}
				}

				if (this.options.orientation === 'vertical') {
					this.trackLow.style.top = '0';
					this.trackLow.style.height = Math.min(positionPercentages[0], positionPercentages[1]) + '%';

					this.trackSelection.style.top = Math.min(positionPercentages[0], positionPercentages[1]) + '%';
					this.trackSelection.style.height = Math.abs(positionPercentages[0] - positionPercentages[1]) + '%';

					this.trackHigh.style.bottom = '0';
					this.trackHigh.style.height = 100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1]) + '%';
				} else {
					this.trackLow.style.left = '0';
					this.trackLow.style.width = Math.min(positionPercentages[0], positionPercentages[1]) + '%';

					this.trackSelection.style.left = Math.min(positionPercentages[0], positionPercentages[1]) + '%';
					this.trackSelection.style.width = Math.abs(positionPercentages[0] - positionPercentages[1]) + '%';

					this.trackHigh.style.right = '0';
					this.trackHigh.style.width = 100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1]) + '%';

					var offset_min = this.tooltip_min.getBoundingClientRect();
					var offset_max = this.tooltip_max.getBoundingClientRect();

					if (this.options.tooltip_position === 'bottom') {
						if (offset_min.right > offset_max.left) {
							this._removeClass(this.tooltip_max, 'bottom');
							this._addClass(this.tooltip_max, 'top');
							this.tooltip_max.style.top = '';
							this.tooltip_max.style.bottom = 22 + 'px';
						} else {
							this._removeClass(this.tooltip_max, 'top');
							this._addClass(this.tooltip_max, 'bottom');
							this.tooltip_max.style.top = this.tooltip_min.style.top;
							this.tooltip_max.style.bottom = '';
						}
					} else {
						if (offset_min.right > offset_max.left) {
							this._removeClass(this.tooltip_max, 'top');
							this._addClass(this.tooltip_max, 'bottom');
							this.tooltip_max.style.top = 18 + 'px';
						} else {
							this._removeClass(this.tooltip_max, 'bottom');
							this._addClass(this.tooltip_max, 'top');
							this.tooltip_max.style.top = this.tooltip_min.style.top;
						}
					}
				}
			},
			_resize: function _resize(ev) {
				/*jshint unused:false*/
				this._state.offset = this._offset(this.sliderElem);
				this._state.size = this.sliderElem[this.sizePos];
				this._layout();
			},
			_removeProperty: function _removeProperty(element, prop) {
				if (element.style.removeProperty) {
					element.style.removeProperty(prop);
				} else {
					element.style.removeAttribute(prop);
				}
			},
			_mousedown: function _mousedown(ev) {
				if (!this._state.enabled) {
					return false;
				}

				this._state.offset = this._offset(this.sliderElem);
				this._state.size = this.sliderElem[this.sizePos];

				var percentage = this._getPercentage(ev);

				if (this.options.range) {
					var diff1 = Math.abs(this._state.percentage[0] - percentage);
					var diff2 = Math.abs(this._state.percentage[1] - percentage);
					this._state.dragged = diff1 < diff2 ? 0 : 1;
					this._adjustPercentageForRangeSliders(percentage);
				} else {
					this._state.dragged = 0;
				}

				this._state.percentage[this._state.dragged] = percentage;
				this._layout();

				if (this.touchCapable) {
					document.removeEventListener("touchmove", this.mousemove, false);
					document.removeEventListener("touchend", this.mouseup, false);
				}

				if (this.mousemove) {
					document.removeEventListener("mousemove", this.mousemove, false);
				}
				if (this.mouseup) {
					document.removeEventListener("mouseup", this.mouseup, false);
				}

				this.mousemove = this._mousemove.bind(this);
				this.mouseup = this._mouseup.bind(this);

				if (this.touchCapable) {
					// Touch: Bind touch events:
					document.addEventListener("touchmove", this.mousemove, false);
					document.addEventListener("touchend", this.mouseup, false);
				}
				// Bind mouse events:
				document.addEventListener("mousemove", this.mousemove, false);
				document.addEventListener("mouseup", this.mouseup, false);

				this._state.inDrag = true;
				var newValue = this._calculateValue();

				this._trigger('slideStart', newValue);

				this._setDataVal(newValue);
				this.setValue(newValue, false, true);

				this._pauseEvent(ev);

				if (this.options.focus) {
					this._triggerFocusOnHandle(this._state.dragged);
				}

				return true;
			},
			_touchstart: function _touchstart(ev) {
				if (ev.changedTouches === undefined) {
					this._mousedown(ev);
					return;
				}

				var touch = ev.changedTouches[0];
				this.touchX = touch.pageX;
				this.touchY = touch.pageY;
			},
			_triggerFocusOnHandle: function _triggerFocusOnHandle(handleIdx) {
				if (handleIdx === 0) {
					this.handle1.focus();
				}
				if (handleIdx === 1) {
					this.handle2.focus();
				}
			},
			_keydown: function _keydown(handleIdx, ev) {
				if (!this._state.enabled) {
					return false;
				}

				var dir;
				switch (ev.keyCode) {
					case 37: // left
					case 40:
						// down
						dir = -1;
						break;
					case 39: // right
					case 38:
						// up
						dir = 1;
						break;
				}
				if (!dir) {
					return;
				}

				// use natural arrow keys instead of from min to max
				if (this.options.natural_arrow_keys) {
					var ifVerticalAndNotReversed = this.options.orientation === 'vertical' && !this.options.reversed;
					var ifHorizontalAndReversed = this.options.orientation === 'horizontal' && this.options.reversed;

					if (ifVerticalAndNotReversed || ifHorizontalAndReversed) {
						dir = -dir;
					}
				}

				var val = this._state.value[handleIdx] + dir * this.options.step;
				if (this.options.range) {
					val = [!handleIdx ? val : this._state.value[0], handleIdx ? val : this._state.value[1]];
				}

				this._trigger('slideStart', val);
				this._setDataVal(val);
				this.setValue(val, true, true);

				this._setDataVal(val);
				this._trigger('slideStop', val);
				this._layout();

				this._pauseEvent(ev);

				return false;
			},
			_pauseEvent: function _pauseEvent(ev) {
				if (ev.stopPropagation) {
					ev.stopPropagation();
				}
				if (ev.preventDefault) {
					ev.preventDefault();
				}
				ev.cancelBubble = true;
				ev.returnValue = false;
			},
			_mousemove: function _mousemove(ev) {
				if (!this._state.enabled) {
					return false;
				}

				var percentage = this._getPercentage(ev);
				this._adjustPercentageForRangeSliders(percentage);
				this._state.percentage[this._state.dragged] = percentage;
				this._layout();

				var val = this._calculateValue(true);
				this.setValue(val, true, true);

				return false;
			},
			_touchmove: function _touchmove(ev) {
				if (ev.changedTouches === undefined) {
					return;
				}

				var touch = ev.changedTouches[0];

				var xDiff = touch.pageX - this.touchX;
				var yDiff = touch.pageY - this.touchY;

				if (!this._state.inDrag) {
					// Vertical Slider
					if (this.options.orientation === 'vertical' && xDiff <= 5 && xDiff >= -5 && (yDiff >= 15 || yDiff <= -15)) {
						this._mousedown(ev);
					}
					// Horizontal slider.
					else if (yDiff <= 5 && yDiff >= -5 && (xDiff >= 15 || xDiff <= -15)) {
							this._mousedown(ev);
						}
				}
			},
			_adjustPercentageForRangeSliders: function _adjustPercentageForRangeSliders(percentage) {
				if (this.options.range) {
					var precision = this._getNumDigitsAfterDecimalPlace(percentage);
					precision = precision ? precision - 1 : 0;
					var percentageWithAdjustedPrecision = this._applyToFixedAndParseFloat(percentage, precision);
					if (this._state.dragged === 0 && this._applyToFixedAndParseFloat(this._state.percentage[1], precision) < percentageWithAdjustedPrecision) {
						this._state.percentage[0] = this._state.percentage[1];
						this._state.dragged = 1;
					} else if (this._state.dragged === 1 && this._applyToFixedAndParseFloat(this._state.percentage[0], precision) > percentageWithAdjustedPrecision) {
						this._state.percentage[1] = this._state.percentage[0];
						this._state.dragged = 0;
					}
				}
			},
			_mouseup: function _mouseup() {
				if (!this._state.enabled) {
					return false;
				}
				if (this.touchCapable) {
					// Touch: Unbind touch event handlers:
					document.removeEventListener("touchmove", this.mousemove, false);
					document.removeEventListener("touchend", this.mouseup, false);
				}
				// Unbind mouse event handlers:
				document.removeEventListener("mousemove", this.mousemove, false);
				document.removeEventListener("mouseup", this.mouseup, false);

				this._state.inDrag = false;
				if (this._state.over === false) {
					this._hideTooltip();
				}
				var val = this._calculateValue(true);

				this._layout();
				this._setDataVal(val);
				this._trigger('slideStop', val);

				return false;
			},
			_calculateValue: function _calculateValue(snapToClosestTick) {
				var val;
				if (this.options.range) {
					val = [this.options.min, this.options.max];
					if (this._state.percentage[0] !== 0) {
						val[0] = this._toValue(this._state.percentage[0]);
						val[0] = this._applyPrecision(val[0]);
					}
					if (this._state.percentage[1] !== 100) {
						val[1] = this._toValue(this._state.percentage[1]);
						val[1] = this._applyPrecision(val[1]);
					}
				} else {
					val = this._toValue(this._state.percentage[0]);
					val = parseFloat(val);
					val = this._applyPrecision(val);
				}

				if (snapToClosestTick) {
					var min = [val, Infinity];
					for (var i = 0; i < this.options.ticks.length; i++) {
						var diff = Math.abs(this.options.ticks[i] - val);
						if (diff <= min[1]) {
							min = [this.options.ticks[i], diff];
						}
					}
					if (min[1] <= this.options.ticks_snap_bounds) {
						return min[0];
					}
				}

				return val;
			},
			_applyPrecision: function _applyPrecision(val) {
				var precision = this.options.precision || this._getNumDigitsAfterDecimalPlace(this.options.step);
				return this._applyToFixedAndParseFloat(val, precision);
			},
			_getNumDigitsAfterDecimalPlace: function _getNumDigitsAfterDecimalPlace(num) {
				var match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
				if (!match) {
					return 0;
				}
				return Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0));
			},
			_applyToFixedAndParseFloat: function _applyToFixedAndParseFloat(num, toFixedInput) {
				var truncatedNum = num.toFixed(toFixedInput);
				return parseFloat(truncatedNum);
			},
			/*
   	Credits to Mike Samuel for the following method!
   	Source: http://stackoverflow.com/questions/10454518/javascript-how-to-retrieve-the-number-of-decimals-of-a-string-number
   */
			_getPercentage: function _getPercentage(ev) {
				if (this.touchCapable && (ev.type === 'touchstart' || ev.type === 'touchmove')) {
					ev = ev.touches[0];
				}

				var eventPosition = ev[this.mousePos];
				var sliderOffset = this._state.offset[this.stylePos];
				var distanceToSlide = eventPosition - sliderOffset;
				// Calculate what percent of the length the slider handle has slid
				var percentage = distanceToSlide / this._state.size * 100;
				percentage = Math.round(percentage / this._state.percentage[2]) * this._state.percentage[2];
				if (this.options.reversed) {
					percentage = 100 - percentage;
				}

				// Make sure the percent is within the bounds of the slider.
				// 0% corresponds to the 'min' value of the slide
				// 100% corresponds to the 'max' value of the slide
				return Math.max(0, Math.min(100, percentage));
			},
			_validateInputValue: function _validateInputValue(val) {
				if (typeof val === 'number') {
					return val;
				} else if (Array.isArray(val)) {
					this._validateArray(val);
					return val;
				} else {
					throw new Error(ErrorMsgs.formatInvalidInputErrorMsg(val));
				}
			},
			_validateArray: function _validateArray(val) {
				for (var i = 0; i < val.length; i++) {
					var input = val[i];
					if (typeof input !== 'number') {
						throw new Error(ErrorMsgs.formatInvalidInputErrorMsg(input));
					}
				}
			},
			_setDataVal: function _setDataVal(val) {
				this.element.setAttribute('data-value', val);
				this.element.setAttribute('value', val);
				this.element.value = val;
			},
			_trigger: function _trigger(evt, val) {
				val = val || val === 0 ? val : undefined;

				var callbackFnArray = this.eventToCallbackMap[evt];
				if (callbackFnArray && callbackFnArray.length) {
					for (var i = 0; i < callbackFnArray.length; i++) {
						var callbackFn = callbackFnArray[i];
						callbackFn(val);
					}
				}

				/* If JQuery exists, trigger JQuery events */
				if ($) {
					this._triggerJQueryEvent(evt, val);
				}
			},
			_triggerJQueryEvent: function _triggerJQueryEvent(evt, val) {
				var eventData = {
					type: evt,
					value: val
				};
				this.$element.trigger(eventData);
				this.$sliderElem.trigger(eventData);
			},
			_unbindJQueryEventHandlers: function _unbindJQueryEventHandlers() {
				this.$element.off();
				this.$sliderElem.off();
			},
			_setText: function _setText(element, text) {
				if (typeof element.textContent !== "undefined") {
					element.textContent = text;
				} else if (typeof element.innerText !== "undefined") {
					element.innerText = text;
				}
			},
			_removeClass: function _removeClass(element, classString) {
				var classes = classString.split(" ");
				var newClasses = element.className;

				for (var i = 0; i < classes.length; i++) {
					var classTag = classes[i];
					var regex = new RegExp("(?:\\s|^)" + classTag + "(?:\\s|$)");
					newClasses = newClasses.replace(regex, " ");
				}

				element.className = newClasses.trim();
			},
			_addClass: function _addClass(element, classString) {
				var classes = classString.split(" ");
				var newClasses = element.className;

				for (var i = 0; i < classes.length; i++) {
					var classTag = classes[i];
					var regex = new RegExp("(?:\\s|^)" + classTag + "(?:\\s|$)");
					var ifClassExists = regex.test(newClasses);

					if (!ifClassExists) {
						newClasses += " " + classTag;
					}
				}

				element.className = newClasses.trim();
			},
			_offsetLeft: function _offsetLeft(obj) {
				return obj.getBoundingClientRect().left;
			},
			_offsetTop: function _offsetTop(obj) {
				var offsetTop = obj.offsetTop;
				while ((obj = obj.offsetParent) && !isNaN(obj.offsetTop)) {
					offsetTop += obj.offsetTop;
					if (obj.tagName !== 'BODY') {
						offsetTop -= obj.scrollTop;
					}
				}
				return offsetTop;
			},
			_offset: function _offset(obj) {
				return {
					left: this._offsetLeft(obj),
					top: this._offsetTop(obj)
				};
			},
			_css: function _css(elementRef, styleName, value) {
				if ($) {
					$.style(elementRef, styleName, value);
				} else {
					var style = styleName.replace(/^-ms-/, "ms-").replace(/-([\da-z])/gi, function (all, letter) {
						return letter.toUpperCase();
					});
					elementRef.style[style] = value;
				}
			},
			_toValue: function _toValue(percentage) {
				return this.options.scale.toValue.apply(this, [percentage]);
			},
			_toPercentage: function _toPercentage(value) {
				return this.options.scale.toPercentage.apply(this, [value]);
			},
			_setTooltipPosition: function _setTooltipPosition() {
				var tooltips = [this.tooltip, this.tooltip_min, this.tooltip_max];
				if (this.options.orientation === 'vertical') {
					var tooltipPos = this.options.tooltip_position || 'right';
					var oppositeSide = tooltipPos === 'left' ? 'right' : 'left';
					tooltips.forEach((function (tooltip) {
						this._addClass(tooltip, tooltipPos);
						tooltip.style[oppositeSide] = '100%';
					}).bind(this));
				} else if (this.options.tooltip_position === 'bottom') {
					tooltips.forEach((function (tooltip) {
						this._addClass(tooltip, 'bottom');
						tooltip.style.top = 22 + 'px';
					}).bind(this));
				} else {
					tooltips.forEach((function (tooltip) {
						this._addClass(tooltip, 'top');
						tooltip.style.top = -this.tooltip.outerHeight - 14 + 'px';
					}).bind(this));
				}
			}
		};

		/*********************************
  		Attach to global namespace
  	*********************************/
		if ($) {
			var namespace = $.fn.slider ? 'bootstrapSlider' : 'slider';
			$.bridget(namespace, Slider);

			// Auto-Register data-provide="slider" Elements
			$(function () {
				$("input[data-provide=slider]")[namespace]();
			});
		}
	})($);

	return Slider;
});
;
/*!
 * Original Lightbox v2.8.1 * by Lokesh Dhakar
 * Additional Changes for GRUX by R Pargeter/Geronimo
 *
 * More info:
 * http://lokeshdhakar.com/projects/lightbox2/
 *
 * Copyright 2007, 2015 Lokesh Dhakar
 * Released under the MIT license
 * https://github.com/lokesh/lightbox2/blob/master/LICENSE
 */
!function (t, i) { "function" == typeof define && define.amd ? define(["jquery"], i) : "object" == typeof exports ? module.exports = i(require("jquery")) : t.lightbox = i(t.jQuery) }(this, function (t) { function i(i) { this.album = [], this.currentImageIndex = void 0, this.init(), this.options = t.extend({}, this.constructor.defaults), this.option(i) } return i.defaults = { albumLabel: "Image %1 of %2", alwaysShowNavOnTouchDevices: !1, fadeDuration: 500, fitImagesInViewport: !0, positionFromTop: 50, resizeDuration: 700, showImageNumberLabel: !0, wrapAround: !1 }, i.prototype.option = function (i) { t.extend(this.options, i) }, i.prototype.imageCountLabel = function (t, i) { return this.options.albumLabel.replace(/%1/g, t).replace(/%2/g, i) }, i.prototype.init = function () { this.enable(), this.build() }, i.prototype.enable = function () { var i = this; t("body").on("click", "a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]", function (e) { return i.start(t(e.currentTarget)), !1 }) }, i.prototype.build = function () { var i = this; t('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-loader"><a class="lb-cancel"></a></div><div id="GalleryCtrlPanelOuter"><div id="GalleryCtrlPanel" class="pull-right"><div id="GalleryCtrlPanelWrap" class="center-block"><div class="text-center arrowGlyph lb-next" id="rightArw"><span class="gruxIcon gw-grux-right01 " aria-hidden="true"></span></div><div class="text-center arrowGlyph lb-prev" id="leftArw"><span class="gruxIcon gw-grux-left01" aria-hidden="true"></span></div></div></div></div></div></div></div>').appendTo(t("body")), this.$lightbox = t("#lightbox"), this.$overlay = t("#lightboxOverlay"), this.$outerContainer = this.$lightbox.find(".lb-outerContainer"), this.$container = this.$lightbox.find(".lb-container"), this.containerTopPadding = parseInt(this.$container.css("padding-top"), 10), this.containerRightPadding = parseInt(this.$container.css("padding-right"), 10), this.containerBottomPadding = parseInt(this.$container.css("padding-bottom"), 10), this.containerLeftPadding = parseInt(this.$container.css("padding-left"), 10), this.$overlay.hide().on("click", function () { return i.end(), !1 }), this.$lightbox.hide().on("click", function (e) { return "lightbox" === t(e.target).attr("id") && i.end(), !1 }), this.$outerContainer.on("click", function (e) { return "lightbox" === t(e.target).attr("id") && i.end(), !1 }), this.$lightbox.find(".lb-prev").on("click", function () { return i.changeImage(0 === i.currentImageIndex ? i.album.length - 1 : i.currentImageIndex - 1), !1 }), this.$lightbox.find(".lb-next").on("click", function () { return i.changeImage(i.currentImageIndex === i.album.length - 1 ? 0 : i.currentImageIndex + 1), !1 }), this.$lightbox.find(".lb-loader, .lb-close").on("click", function () { return i.end(), !1 }) }, i.prototype.start = function (i) { function e(t) { n.album.push({ link: t.attr("href"), title: t.attr("data-title") || t.attr("title") }) } var n = this, a = t(window); a.on("resize", t.proxy(this.sizeOverlay, this)), t("select, object, embed").css({ visibility: "hidden" }), this.sizeOverlay(), this.album = []; var o, r = 0, s = i.attr("data-lightbox"); if (s) { o = t(i.prop("tagName") + '[data-lightbox="' + s + '"]'); for (var h = 0; h < o.length; h = ++h) e(t(o[h])), o[h] === i[0] && (r = h) } else if ("lightbox" === i.attr("rel")) e(i); else { o = t(i.prop("tagName") + '[rel="' + i.attr("rel") + '"]'); for (var l = 0; l < o.length; l = ++l) e(t(o[l])), o[l] === i[0] && (r = l) } var d = a.scrollTop() + this.options.positionFromTop, c = a.scrollLeft(); this.$lightbox.css({ top: d + "px", left: c + "px" }).fadeIn(this.options.fadeDuration), this.changeImage(r) }, i.prototype.changeImage = function (i) { var e = this; this.disableKeyboardNav(); var n = this.$lightbox.find(".lb-image"); this.$overlay.fadeIn(this.options.fadeDuration), t(".lb-loader").fadeIn("slow"), this.$lightbox.find(".lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption").hide(), this.$outerContainer.addClass("animating"); var a = new Image; a.onload = function () { var o, r, s, h, l, d, c; n.attr("src", e.album[i].link), o = t(a), n.width(a.width), n.height(a.height), e.options.fitImagesInViewport && (c = t(window).width(), d = t(window).height(), l = c - e.containerLeftPadding - e.containerRightPadding - 20, h = d - e.containerTopPadding - e.containerBottomPadding - 120, e.options.maxWidth && e.options.maxWidth < l && (l = e.options.maxWidth), e.options.maxHeight && e.options.maxHeight < l && (h = e.options.maxHeight), (a.width > l || a.height > h) && (a.width / l > a.height / h ? (s = l, r = parseInt(a.height / (a.width / s), 10), n.width(s), n.height(r)) : (r = h, s = parseInt(a.width / (a.height / r), 10), n.width(s), n.height(r)))), e.sizeContainer(n.width(), n.height()) }, a.src = this.album[i].link, this.currentImageIndex = i }, i.prototype.sizeOverlay = function () { this.$overlay.width(t(window).width()).height(t(document).height()) }, i.prototype.sizeContainer = function (t, i) { function e() { n.$lightbox.find(".lb-dataContainer").width(r), n.$lightbox.find(".lb-prevLink").height(s), n.$lightbox.find(".lb-nextLink").height(s), n.showImage() } var n = this, a = this.$outerContainer.outerWidth(), o = this.$outerContainer.outerHeight(), r = t + this.containerLeftPadding + this.containerRightPadding, s = i + this.containerTopPadding + this.containerBottomPadding; a !== r || o !== s ? this.$outerContainer.animate({ width: r, height: s }, this.options.resizeDuration, "swing", function () { e() }) : e() }, i.prototype.showImage = function () { this.$lightbox.find(".lb-loader").stop(!0).hide(), this.$lightbox.find(".lb-image").fadeIn("slow"), this.updateNav(), this.updateDetails(), this.preloadNeighboringImages(), this.enableKeyboardNav() }, i.prototype.updateNav = function () { var t = !1; try { document.createEvent("TouchEvent"), t = this.options.alwaysShowNavOnTouchDevices ? !0 : !1 } catch (i) { } this.$lightbox.find(".lb-nav").show(), this.album.length > 1 && (this.options.wrapAround ? (t && this.$lightbox.find(".lb-prev, .lb-next").css("opacity", "1"), this.$lightbox.find(".lb-prev, .lb-next").show()) : (this.currentImageIndex > 0 && (this.$lightbox.find(".lb-prev").show(), t && this.$lightbox.find(".lb-prev").css("opacity", "1")), this.currentImageIndex < this.album.length - 1 && (this.$lightbox.find(".lb-next").show(), t && this.$lightbox.find(".lb-next").css("opacity", "1")))) }, i.prototype.updateDetails = function () { var i = this; if ("undefined" != typeof this.album[this.currentImageIndex].title && "" !== this.album[this.currentImageIndex].title && this.$lightbox.find(".lb-caption").html(this.album[this.currentImageIndex].title).fadeIn("fast").find("a").on("click", function () { void 0 !== t(this).attr("target") ? window.open(t(this).attr("href"), t(this).attr("target")) : location.href = t(this).attr("href") }), this.album.length > 1 && this.options.showImageNumberLabel) { var e = this.imageCountLabel(this.currentImageIndex + 1, this.album.length); this.$lightbox.find(".lb-number").text(e).fadeIn("fast") } else this.$lightbox.find(".lb-number").hide(); this.$outerContainer.removeClass("animating"), this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration, function () { return i.sizeOverlay() }) }, i.prototype.preloadNeighboringImages = function () { if (this.album.length > this.currentImageIndex + 1) { var t = new Image; t.src = this.album[this.currentImageIndex + 1].link } if (this.currentImageIndex > 0) { var i = new Image; i.src = this.album[this.currentImageIndex - 1].link } }, i.prototype.enableKeyboardNav = function () { t(document).on("keyup.keyboard", t.proxy(this.keyboardAction, this)) }, i.prototype.disableKeyboardNav = function () { t(document).off(".keyboard") }, i.prototype.keyboardAction = function (t) { var i = 27, e = 37, n = 39, a = t.keyCode, o = String.fromCharCode(a).toLowerCase(); a === i || o.match(/x|o|c/) ? this.end() : "p" === o || a === e ? 0 !== this.currentImageIndex ? this.changeImage(this.currentImageIndex - 1) : this.options.wrapAround && this.album.length > 1 && this.changeImage(this.album.length - 1) : ("n" === o || a === n) && (this.currentImageIndex !== this.album.length - 1 ? this.changeImage(this.currentImageIndex + 1) : this.options.wrapAround && this.album.length > 1 && this.changeImage(0)) }, i.prototype.end = function () { this.disableKeyboardNav(), t(window).off("resize", this.sizeOverlay), this.$lightbox.fadeOut(this.options.fadeDuration), this.$overlay.fadeOut(this.options.fadeDuration), t("select, object, embed").css({ visibility: "visible" }) }, new i });
;
/**
 * bxSlider v4.2.5
 * Copyright 2013-2015 Steven Wanderski
 * Written while drinking Belgian ales and listening to jazz

 * Licensed under MIT (http://opensource.org/licenses/MIT)
 */

!function (a) { var b = { 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, ariaLive: !0, ariaHidden: !0, keyboardEnabled: !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", stopAutoOnClick: !1, autoHover: !1, autoDelay: 0, autoSlideForOnePage: !1, minSlides: 1, maxSlides: 1, moveSlides: 0, slideWidth: 0, shrinkItems: !1, onSliderLoad: function () { return !0 }, onSlideBefore: function () { return !0 }, onSlideAfter: function () { return !0 }, onSlideNext: function () { return !0 }, onSlidePrev: function () { return !0 }, onSliderResize: function () { return !0 } }; a.fn.bxSlider = function (c) { if (0 === this.length) return this; if (this.length > 1) return this.each(function () { a(this).bxSlider(c) }), this; var d = {}, e = this, f = a(window).width(), g = a(window).height(); if (!a(e).data("bxSlider")) { var h = function () { a(e).data("bxSlider") || (d.settings = a.extend({}, b, c), d.settings.slideWidth = parseInt(d.settings.slideWidth), d.children = e.children(d.settings.slideSelector), d.children.length < d.settings.minSlides && (d.settings.minSlides = d.children.length), d.children.length < d.settings.maxSlides && (d.settings.maxSlides = d.children.length), d.settings.randomStart && (d.settings.startSlide = Math.floor(Math.random() * d.children.length)), d.active = { index: d.settings.startSlide }, d.carousel = d.settings.minSlides > 1 || d.settings.maxSlides > 1 ? !0 : !1, d.carousel && (d.settings.preloadImages = "all"), d.minThreshold = d.settings.minSlides * d.settings.slideWidth + (d.settings.minSlides - 1) * d.settings.slideMargin, d.maxThreshold = d.settings.maxSlides * d.settings.slideWidth + (d.settings.maxSlides - 1) * d.settings.slideMargin, d.working = !1, d.controls = {}, d.interval = null, d.animProp = "vertical" === d.settings.mode ? "top" : "left", d.usingCSS = d.settings.useCSS && "fade" !== d.settings.mode && function () { for (var a = document.createElement("div"), b = ["WebkitPerspective", "MozPerspective", "OPerspective", "msPerspective"], c = 0; c < b.length; c++) if (void 0 !== a.style[b[c]]) return d.cssPrefix = b[c].replace("Perspective", "").toLowerCase(), d.animProp = "-" + d.cssPrefix + "-transform", !0; return !1 }(), "vertical" === d.settings.mode && (d.settings.maxSlides = d.settings.minSlides), e.data("origStyle", e.attr("style")), e.children(d.settings.slideSelector).each(function () { a(this).data("origStyle", a(this).attr("style")) }), j()) }, j = function () { var b = d.children.eq(d.settings.startSlide); e.wrap('<div class="' + d.settings.wrapperClass + '"><div class="bx-viewport"></div></div>'), d.viewport = e.parent(), d.settings.ariaLive && !d.settings.ticker && d.viewport.attr("aria-live", "polite"), d.loader = a('<div class="bx-loading" />'), d.viewport.prepend(d.loader), e.css({ width: "horizontal" === d.settings.mode ? 1e3 * d.children.length + 215 + "%" : "auto", position: "relative" }), d.usingCSS && d.settings.easing ? e.css("-" + d.cssPrefix + "-transition-timing-function", d.settings.easing) : d.settings.easing || (d.settings.easing = "swing"), d.viewport.css({ width: "100%", overflow: "hidden", position: "relative" }), d.viewport.parent().css({ maxWidth: n() }), d.settings.pager || d.settings.controls || d.viewport.parent().css({ margin: "0 auto 0px" }), d.children.css({ "float": "horizontal" === d.settings.mode ? "left" : "none", listStyle: "none", position: "relative" }), d.children.css("width", o()), "horizontal" === d.settings.mode && d.settings.slideMargin > 0 && d.children.css("marginRight", d.settings.slideMargin), "vertical" === d.settings.mode && d.settings.slideMargin > 0 && d.children.css("marginBottom", d.settings.slideMargin), "fade" === d.settings.mode && (d.children.css({ position: "absolute", zIndex: 0, display: "none" }), d.children.eq(d.settings.startSlide).css({ zIndex: d.settings.slideZIndex, display: "block" })), d.controls.el = a('<div class="bx-controls" />'), d.settings.captions && y(), d.active.last = d.settings.startSlide === q() - 1, d.settings.video && e.fitVids(), ("all" === d.settings.preloadImages || d.settings.ticker) && (b = d.children), d.settings.ticker ? d.settings.pager = !1 : (d.settings.controls && w(), d.settings.auto && d.settings.autoControls && x(), d.settings.pager && v(), (d.settings.controls || d.settings.autoControls || d.settings.pager) && d.viewport.after(d.controls.el)), k(b, l) }, k = function (b, c) { var d = b.find('img:not([src=""]), iframe').length, e = 0; return 0 === d ? void c() : void b.find('img:not([src=""]), iframe').each(function () { a(this).one("load error", function () { ++e === d && c() }).each(function () { this.complete && a(this).load() }) }) }, l = function () { if (d.settings.infiniteLoop && "fade" !== d.settings.mode && !d.settings.ticker) { var b = "vertical" === d.settings.mode ? d.settings.minSlides : d.settings.maxSlides, c = d.children.slice(0, b).clone(!0).addClass("bx-clone"), f = d.children.slice(-b).clone(!0).addClass("bx-clone"); d.settings.ariaHidden && (c.attr("aria-hidden", !0), f.attr("aria-hidden", !0)), e.append(c).prepend(f) } d.loader.remove(), s(), "vertical" === d.settings.mode && (d.settings.adaptiveHeight = !0), d.viewport.height(m()), e.redrawSlider(), d.settings.onSliderLoad.call(e, d.active.index), d.initialized = !0, d.settings.responsive && a(window).bind("resize", S), d.settings.auto && d.settings.autoStart && (q() > 1 || d.settings.autoSlideForOnePage) && I(), d.settings.ticker && J(), d.settings.pager && E(d.settings.startSlide), d.settings.controls && H(), d.settings.touchEnabled && !d.settings.ticker && N(), d.settings.keyboardEnabled && !d.settings.ticker && a(document).keydown(M) }, m = function () { var b = 0, c = a(); if ("vertical" === d.settings.mode || d.settings.adaptiveHeight) if (d.carousel) { var e = 1 === d.settings.moveSlides ? d.active.index : d.active.index * r(); for (c = d.children.eq(e), i = 1; i <= d.settings.maxSlides - 1; i++) c = e + i >= d.children.length ? c.add(d.children.eq(i - 1)) : c.add(d.children.eq(e + i)) } else c = d.children.eq(d.active.index); else c = d.children; return "vertical" === d.settings.mode ? (c.each(function (c) { b += a(this).outerHeight() }), d.settings.slideMargin > 0 && (b += d.settings.slideMargin * (d.settings.minSlides - 1))) : b = Math.max.apply(Math, c.map(function () { return a(this).outerHeight(!1) }).get()), "border-box" === d.viewport.css("box-sizing") ? b += parseFloat(d.viewport.css("padding-top")) + parseFloat(d.viewport.css("padding-bottom")) + parseFloat(d.viewport.css("border-top-width")) + parseFloat(d.viewport.css("border-bottom-width")) : "padding-box" === d.viewport.css("box-sizing") && (b += parseFloat(d.viewport.css("padding-top")) + parseFloat(d.viewport.css("padding-bottom"))), b }, n = function () { var a = "100%"; return d.settings.slideWidth > 0 && (a = "horizontal" === d.settings.mode ? d.settings.maxSlides * d.settings.slideWidth + (d.settings.maxSlides - 1) * d.settings.slideMargin : d.settings.slideWidth), a }, o = function () { var a = d.settings.slideWidth, b = d.viewport.width(); if (0 === d.settings.slideWidth || d.settings.slideWidth > b && !d.carousel || "vertical" === d.settings.mode) a = b; else if (d.settings.maxSlides > 1 && "horizontal" === d.settings.mode) { if (b > d.maxThreshold) return a; b < d.minThreshold ? a = (b - d.settings.slideMargin * (d.settings.minSlides - 1)) / d.settings.minSlides : d.settings.shrinkItems && (a = Math.floor((b + d.settings.slideMargin) / Math.ceil((b + d.settings.slideMargin) / (a + d.settings.slideMargin)) - d.settings.slideMargin)) } return a }, p = function () { var a = 1, b = null; return "horizontal" === d.settings.mode && d.settings.slideWidth > 0 ? d.viewport.width() < d.minThreshold ? a = d.settings.minSlides : d.viewport.width() > d.maxThreshold ? a = d.settings.maxSlides : (b = d.children.first().width() + d.settings.slideMargin, a = Math.floor((d.viewport.width() + d.settings.slideMargin) / b)) : "vertical" === d.settings.mode && (a = d.settings.minSlides), a }, q = function () { var a = 0, b = 0, c = 0; if (d.settings.moveSlides > 0) if (d.settings.infiniteLoop) a = Math.ceil(d.children.length / r()); else for (; b < d.children.length;)++a, b = c + p(), c += d.settings.moveSlides <= p() ? d.settings.moveSlides : p(); else a = Math.ceil(d.children.length / p()); return a }, r = function () { return d.settings.moveSlides > 0 && d.settings.moveSlides <= p() ? d.settings.moveSlides : p() }, s = function () { var a, b, c; d.children.length > d.settings.maxSlides && d.active.last && !d.settings.infiniteLoop ? "horizontal" === d.settings.mode ? (b = d.children.last(), a = b.position(), t(-(a.left - (d.viewport.width() - b.outerWidth())), "reset", 0)) : "vertical" === d.settings.mode && (c = d.children.length - d.settings.minSlides, a = d.children.eq(c).position(), t(-a.top, "reset", 0)) : (a = d.children.eq(d.active.index * r()).position(), d.active.index === q() - 1 && (d.active.last = !0), void 0 !== a && ("horizontal" === d.settings.mode ? t(-a.left, "reset", 0) : "vertical" === d.settings.mode && t(-a.top, "reset", 0))) }, t = function (b, c, f, g) { var h, i; d.usingCSS ? (i = "vertical" === d.settings.mode ? "translate3d(0, " + b + "px, 0)" : "translate3d(" + b + "px, 0, 0)", e.css("-" + d.cssPrefix + "-transition-duration", f / 1e3 + "s"), "slide" === c ? (e.css(d.animProp, i), 0 !== f ? e.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function (b) { a(b.target).is(e) && (e.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"), F()) }) : F()) : "reset" === c ? e.css(d.animProp, i) : "ticker" === c && (e.css("-" + d.cssPrefix + "-transition-timing-function", "linear"), e.css(d.animProp, i), 0 !== f ? e.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function (b) { a(b.target).is(e) && (e.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"), t(g.resetValue, "reset", 0), K()) }) : (t(g.resetValue, "reset", 0), K()))) : (h = {}, h[d.animProp] = b, "slide" === c ? e.animate(h, f, d.settings.easing, function () { F() }) : "reset" === c ? e.css(d.animProp, b) : "ticker" === c && e.animate(h, f, "linear", function () { t(g.resetValue, "reset", 0), K() })) }, u = function () { for (var b = "", c = "", e = q(), f = 0; e > f; f++) c = "", d.settings.buildPager && a.isFunction(d.settings.buildPager) || d.settings.pagerCustom ? (c = d.settings.buildPager(f), d.pagerEl.addClass("bx-custom-pager")) : (c = f + 1, d.pagerEl.addClass("bx-default-pager")), b += '<div class="bx-pager-item"><a href="" data-slide-index="' + f + '" class="bx-pager-link">' + c + "</a></div>"; d.pagerEl.html(b) }, v = function () { d.settings.pagerCustom ? d.pagerEl = a(d.settings.pagerCustom) : (d.pagerEl = a('<div class="bx-pager" />'), d.settings.pagerSelector ? a(d.settings.pagerSelector).html(d.pagerEl) : d.controls.el.addClass("bx-has-pager").append(d.pagerEl), u()), d.pagerEl.on("click touchend", "a", D) }, w = function () { d.controls.next = a('<a class="bx-next" href="">' + d.settings.nextText + "</a>"), d.controls.prev = a('<a class="bx-prev" href="">' + d.settings.prevText + "</a>"), d.controls.next.bind("click touchend", z), d.controls.prev.bind("click touchend", A), d.settings.nextSelector && a(d.settings.nextSelector).append(d.controls.next), d.settings.prevSelector && a(d.settings.prevSelector).append(d.controls.prev), d.settings.nextSelector || d.settings.prevSelector || (d.controls.directionEl = a('<div class="bx-controls-direction" />'), d.controls.directionEl.append(d.controls.prev).append(d.controls.next), d.controls.el.addClass("bx-has-controls-direction").append(d.controls.directionEl)) }, x = function () { d.controls.start = a('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + d.settings.startText + "</a></div>"), d.controls.stop = a('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + d.settings.stopText + "</a></div>"), d.controls.autoEl = a('<div class="bx-controls-auto" />'), d.controls.autoEl.on("click", ".bx-start", B), d.controls.autoEl.on("click", ".bx-stop", C), d.settings.autoControlsCombine ? d.controls.autoEl.append(d.controls.start) : d.controls.autoEl.append(d.controls.start).append(d.controls.stop), d.settings.autoControlsSelector ? a(d.settings.autoControlsSelector).html(d.controls.autoEl) : d.controls.el.addClass("bx-has-controls-auto").append(d.controls.autoEl), G(d.settings.autoStart ? "stop" : "start") }, y = function () { d.children.each(function (b) { var c = a(this).find("img:first").attr("title"); void 0 !== c && ("" + c).length && a(this).append('<div class="bx-caption"><span>' + c + "</span></div>") }) }, z = function (a) { a.preventDefault(), d.controls.el.hasClass("disabled") || (d.settings.auto && d.settings.stopAutoOnClick && e.stopAuto(), e.goToNextSlide()) }, A = function (a) { a.preventDefault(), d.controls.el.hasClass("disabled") || (d.settings.auto && d.settings.stopAutoOnClick && e.stopAuto(), e.goToPrevSlide()) }, B = function (a) { e.startAuto(), a.preventDefault() }, C = function (a) { e.stopAuto(), a.preventDefault() }, D = function (b) { var c, f; b.preventDefault(), d.controls.el.hasClass("disabled") || (d.settings.auto && d.settings.stopAutoOnClick && e.stopAuto(), c = a(b.currentTarget), void 0 !== c.attr("data-slide-index") && (f = parseInt(c.attr("data-slide-index")), f !== d.active.index && e.goToSlide(f))) }, E = function (b) { var c = d.children.length; return "short" === d.settings.pagerType ? (d.settings.maxSlides > 1 && (c = Math.ceil(d.children.length / d.settings.maxSlides)), void d.pagerEl.html(b + 1 + d.settings.pagerShortSeparator + c)) : (d.pagerEl.find("a").removeClass("active"), void d.pagerEl.each(function (c, d) { a(d).find("a").eq(b).addClass("active") })) }, F = function () { if (d.settings.infiniteLoop) { var a = ""; 0 === d.active.index ? a = d.children.eq(0).position() : d.active.index === q() - 1 && d.carousel ? a = d.children.eq((q() - 1) * r()).position() : d.active.index === d.children.length - 1 && (a = d.children.eq(d.children.length - 1).position()), a && ("horizontal" === d.settings.mode ? t(-a.left, "reset", 0) : "vertical" === d.settings.mode && t(-a.top, "reset", 0)) } d.working = !1, d.settings.onSlideAfter.call(e, d.children.eq(d.active.index), d.oldIndex, d.active.index) }, G = function (a) { d.settings.autoControlsCombine ? d.controls.autoEl.html(d.controls[a]) : (d.controls.autoEl.find("a").removeClass("active"), d.controls.autoEl.find("a:not(.bx-" + a + ")").addClass("active")) }, H = function () { 1 === q() ? (d.controls.prev.addClass("disabled"), d.controls.next.addClass("disabled")) : !d.settings.infiniteLoop && d.settings.hideControlOnEnd && (0 === d.active.index ? (d.controls.prev.addClass("disabled"), d.controls.next.removeClass("disabled")) : d.active.index === q() - 1 ? (d.controls.next.addClass("disabled"), d.controls.prev.removeClass("disabled")) : (d.controls.prev.removeClass("disabled"), d.controls.next.removeClass("disabled"))) }, I = function () { if (d.settings.autoDelay > 0) { setTimeout(e.startAuto, d.settings.autoDelay) } else e.startAuto(), a(window).focus(function () { e.startAuto() }).blur(function () { e.stopAuto() }); d.settings.autoHover && e.hover(function () { d.interval && (e.stopAuto(!0), d.autoPaused = !0) }, function () { d.autoPaused && (e.startAuto(!0), d.autoPaused = null) }) }, J = function () { var b, c, f, g, h, i, j, k, l = 0; "next" === d.settings.autoDirection ? e.append(d.children.clone().addClass("bx-clone")) : (e.prepend(d.children.clone().addClass("bx-clone")), b = d.children.first().position(), l = "horizontal" === d.settings.mode ? -b.left : -b.top), t(l, "reset", 0), d.settings.pager = !1, d.settings.controls = !1, d.settings.autoControls = !1, d.settings.tickerHover && (d.usingCSS ? (g = "horizontal" === d.settings.mode ? 4 : 5, d.viewport.hover(function () { c = e.css("-" + d.cssPrefix + "-transform"), f = parseFloat(c.split(",")[g]), t(f, "reset", 0) }, function () { k = 0, d.children.each(function (b) { k += "horizontal" === d.settings.mode ? a(this).outerWidth(!0) : a(this).outerHeight(!0) }), h = d.settings.speed / k, i = "horizontal" === d.settings.mode ? "left" : "top", j = h * (k - Math.abs(parseInt(f))), K(j) })) : d.viewport.hover(function () { e.stop() }, function () { k = 0, d.children.each(function (b) { k += "horizontal" === d.settings.mode ? a(this).outerWidth(!0) : a(this).outerHeight(!0) }), h = d.settings.speed / k, i = "horizontal" === d.settings.mode ? "left" : "top", j = h * (k - Math.abs(parseInt(e.css(i)))), K(j) })), K() }, K = function (a) { var b, c, f, g = a ? a : d.settings.speed, h = { left: 0, top: 0 }, i = { left: 0, top: 0 }; "next" === d.settings.autoDirection ? h = e.find(".bx-clone").first().position() : i = d.children.first().position(), b = "horizontal" === d.settings.mode ? -h.left : -h.top, c = "horizontal" === d.settings.mode ? -i.left : -i.top, f = { resetValue: c }, t(b, "ticker", g, f) }, L = function (b) { var c = a(window), d = { top: c.scrollTop(), left: c.scrollLeft() }, e = b.offset(); return d.right = d.left + c.width(), d.bottom = d.top + c.height(), e.right = e.left + b.outerWidth(), e.bottom = e.top + b.outerHeight(), !(d.right < e.left || d.left > e.right || d.bottom < e.top || d.top > e.bottom) }, M = function (a) { var b = document.activeElement.tagName.toLowerCase(), c = "input|textarea", d = new RegExp(b, ["i"]), f = d.exec(c); if (null == f && L(e)) { if (39 === a.keyCode) return z(a), !1; if (37 === a.keyCode) return A(a), !1 } }, N = function () { d.touch = { start: { x: 0, y: 0 }, end: { x: 0, y: 0 } }, d.viewport.bind("touchstart MSPointerDown pointerdown", O), d.viewport.on("click", ".bxslider a", function (a) { d.viewport.hasClass("click-disabled") && (a.preventDefault(), d.viewport.removeClass("click-disabled")) }) }, O = function (a) { if (d.controls.el.addClass("disabled"), d.working) a.preventDefault(), d.controls.el.removeClass("disabled"); else { d.touch.originalPos = e.position(); var b = a.originalEvent, c = "undefined" != typeof b.changedTouches ? b.changedTouches : [b]; d.touch.start.x = c[0].pageX, d.touch.start.y = c[0].pageY, d.viewport.get(0).setPointerCapture && (d.pointerId = b.pointerId, d.viewport.get(0).setPointerCapture(d.pointerId)), d.viewport.bind("touchmove MSPointerMove pointermove", Q), d.viewport.bind("touchend MSPointerUp pointerup", R), d.viewport.bind("MSPointerCancel pointercancel", P) } }, P = function (a) { t(d.touch.originalPos.left, "reset", 0), d.controls.el.removeClass("disabled"), d.viewport.unbind("MSPointerCancel pointercancel", P), d.viewport.unbind("touchmove MSPointerMove pointermove", Q), d.viewport.unbind("touchend MSPointerUp pointerup", R), d.viewport.get(0).releasePointerCapture && d.viewport.get(0).releasePointerCapture(d.pointerId) }, Q = function (a) { var b = a.originalEvent, c = "undefined" != typeof b.changedTouches ? b.changedTouches : [b], e = Math.abs(c[0].pageX - d.touch.start.x), f = Math.abs(c[0].pageY - d.touch.start.y), g = 0, h = 0; 3 * e > f && d.settings.preventDefaultSwipeX ? a.preventDefault() : 3 * f > e && d.settings.preventDefaultSwipeY && a.preventDefault(), "fade" !== d.settings.mode && d.settings.oneToOneTouch && ("horizontal" === d.settings.mode ? (h = c[0].pageX - d.touch.start.x, g = d.touch.originalPos.left + h) : (h = c[0].pageY - d.touch.start.y, g = d.touch.originalPos.top + h), t(g, "reset", 0)) }, R = function (a) { d.viewport.unbind("touchmove MSPointerMove pointermove", Q), d.controls.el.removeClass("disabled"); var b = a.originalEvent, c = "undefined" != typeof b.changedTouches ? b.changedTouches : [b], f = 0, g = 0; d.touch.end.x = c[0].pageX, d.touch.end.y = c[0].pageY, "fade" === d.settings.mode ? (g = Math.abs(d.touch.start.x - d.touch.end.x), g >= d.settings.swipeThreshold && (d.touch.start.x > d.touch.end.x ? e.goToNextSlide() : e.goToPrevSlide(), e.stopAuto())) : ("horizontal" === d.settings.mode ? (g = d.touch.end.x - d.touch.start.x, f = d.touch.originalPos.left) : (g = d.touch.end.y - d.touch.start.y, f = d.touch.originalPos.top), !d.settings.infiniteLoop && (0 === d.active.index && g > 0 || d.active.last && 0 > g) ? t(f, "reset", 200) : Math.abs(g) >= d.settings.swipeThreshold ? (0 > g ? e.goToNextSlide() : e.goToPrevSlide(), e.stopAuto()) : t(f, "reset", 200)), d.viewport.unbind("touchend MSPointerUp pointerup", R), d.viewport.get(0).releasePointerCapture && d.viewport.get(0).releasePointerCapture(d.pointerId) }, S = function (b) { if (d.initialized) if (d.working) window.setTimeout(S, 10); else { var c = a(window).width(), h = a(window).height(); (f !== c || g !== h) && (f = c, g = h, e.redrawSlider(), d.settings.onSliderResize.call(e, d.active.index)) } }, T = function (a) { var b = p(); d.settings.ariaHidden && !d.settings.ticker && (d.children.attr("aria-hidden", "true"), d.children.slice(a, a + b).attr("aria-hidden", "false")) }, U = function (a) { return 0 > a ? d.settings.infiniteLoop ? q() - 1 : d.active.index : a >= q() ? d.settings.infiniteLoop ? 0 : d.active.index : a }; return e.goToSlide = function (b, c) { var f, g, h, i, j = !0, k = 0, l = { left: 0, top: 0 }, n = null; if (d.oldIndex = d.active.index, d.active.index = U(b), !d.working && d.active.index !== d.oldIndex) { if (d.working = !0, j = d.settings.onSlideBefore.call(e, d.children.eq(d.active.index), d.oldIndex, d.active.index), "undefined" != typeof j && !j) return d.active.index = d.oldIndex, void (d.working = !1); "next" === c ? d.settings.onSlideNext.call(e, d.children.eq(d.active.index), d.oldIndex, d.active.index) || (j = !1) : "prev" === c && (d.settings.onSlidePrev.call(e, d.children.eq(d.active.index), d.oldIndex, d.active.index) || (j = !1)), d.active.last = d.active.index >= q() - 1, (d.settings.pager || d.settings.pagerCustom) && E(d.active.index), d.settings.controls && H(), "fade" === d.settings.mode ? (d.settings.adaptiveHeight && d.viewport.height() !== m() && d.viewport.animate({ height: m() }, d.settings.adaptiveHeightSpeed), d.children.filter(":visible").fadeOut(d.settings.speed).css({ zIndex: 0 }), d.children.eq(d.active.index).css("zIndex", d.settings.slideZIndex + 1).fadeIn(d.settings.speed, function () { a(this).css("zIndex", d.settings.slideZIndex), F() })) : (d.settings.adaptiveHeight && d.viewport.height() !== m() && d.viewport.animate({ height: m() }, d.settings.adaptiveHeightSpeed), !d.settings.infiniteLoop && d.carousel && d.active.last ? "horizontal" === d.settings.mode ? (n = d.children.eq(d.children.length - 1), l = n.position(), k = d.viewport.width() - n.outerWidth()) : (f = d.children.length - d.settings.minSlides, l = d.children.eq(f).position()) : d.carousel && d.active.last && "prev" === c ? (g = 1 === d.settings.moveSlides ? d.settings.maxSlides - r() : (q() - 1) * r() - (d.children.length - d.settings.maxSlides), n = e.children(".bx-clone").eq(g), l = n.position()) : "next" === c && 0 === d.active.index ? (l = e.find("> .bx-clone").eq(d.settings.maxSlides).position(), d.active.last = !1) : b >= 0 && (i = b * parseInt(r()), l = d.children.eq(i).position()), "undefined" != typeof l ? (h = "horizontal" === d.settings.mode ? -(l.left - k) : -l.top, t(h, "slide", d.settings.speed)) : d.working = !1), d.settings.ariaHidden && T(d.active.index * r()) } }, e.goToNextSlide = function () { if (d.settings.infiniteLoop || !d.active.last) { var a = parseInt(d.active.index) + 1; e.goToSlide(a, "next") } }, e.goToPrevSlide = function () { if (d.settings.infiniteLoop || 0 !== d.active.index) { var a = parseInt(d.active.index) - 1; e.goToSlide(a, "prev") } }, e.startAuto = function (a) { d.interval || (d.interval = setInterval(function () { "next" === d.settings.autoDirection ? e.goToNextSlide() : e.goToPrevSlide() }, d.settings.pause), d.settings.autoControls && a !== !0 && G("stop")) }, e.stopAuto = function (a) { d.interval && (clearInterval(d.interval), d.interval = null, d.settings.autoControls && a !== !0 && G("start")) }, e.getCurrentSlide = function () { return d.active.index }, e.getCurrentSlideElement = function () { return d.children.eq(d.active.index) }, e.getSlideElement = function (a) { return d.children.eq(a) }, e.getSlideCount = function () { return d.children.length }, e.isWorking = function () { return d.working }, e.redrawSlider = function () { d.children.add(e.find(".bx-clone")).outerWidth(o()), d.viewport.css("height", m()), d.settings.ticker || s(), d.active.last && (d.active.index = q() - 1), d.active.index >= q() && (d.active.last = !0), d.settings.pager && !d.settings.pagerCustom && (u(), E(d.active.index)), d.settings.ariaHidden && T(d.active.index * r()) }, e.destroySlider = function () { d.initialized && (d.initialized = !1, a(".bx-clone", this).remove(), d.children.each(function () { void 0 !== a(this).data("origStyle") ? a(this).attr("style", a(this).data("origStyle")) : a(this).removeAttr("style") }), void 0 !== a(this).data("origStyle") ? this.attr("style", a(this).data("origStyle")) : a(this).removeAttr("style"), a(this).unwrap().unwrap(), d.controls.el && d.controls.el.remove(), d.controls.next && d.controls.next.remove(), d.controls.prev && d.controls.prev.remove(), d.pagerEl && d.settings.controls && !d.settings.pagerCustom && d.pagerEl.remove(), a(".bx-caption", this).remove(), d.controls.autoEl && d.controls.autoEl.remove(), clearInterval(d.interval), d.settings.responsive && a(window).unbind("resize", S), d.settings.keyboardEnabled && a(document).unbind("keydown", M), a(this).removeData("bxSlider")) }, e.reloadSlider = function (b) { void 0 !== b && (c = b), e.destroySlider(), h(), a(e).data("bxSlider", this) }, h(), a(e).data("bxSlider", this), this } } }(jQuery);;
/*
    jQuery Glider Plugin
    by Steve Fenton
    https://github.com/Steve-Fenton/jquery-glider
 */

(function ($) {
    var resizeTimer;
    var $window = $(window);
    $window.on('resize', function () {
        clearTimeout(resizeTimer);
        resizeTimer = setTimeout(function () {
            $window.trigger('gliderResizeDone');
        }, 100);
    });

    var idIndex = 0;
    
    function Glider($this, settings) {

        this.id = 'glider-' + idIndex++;
        this.settings = settings;
        
        // Default link function
        this.linkFunction = function (idx) {
            return '<span class="glider-circle-icon">&nbsp;</span>';
        };

        // Direction
        this.direction = $this.attr('dir') || 'ltr';

        this.container = $this.attr('data-glider-id', this.id).addClass('glider glider-' + this.direction + ' ' + settings.animation);
        this.list = $(settings.list, $this).first().addClass('glider-list');
        this.items = $(settings.item, this.list).addClass('glider-item');

        this.currentSlide = 0;

        // Boolean attributes
        this.hasMultiple = $this[0].hasAttribute('data-glider-multiple');
        this.hasAutoplay = $this[0].hasAttribute('data-glider-autoplay');
        this.hasControls = $this[0].hasAttribute('data-glider-controls');
        this.hasLinks = $this[0].hasAttribute('data-glider-links');

        // Place controls at the bottom by default, or use the attribute
        this.controlLocation = $this.attr('data-glider-controls') || 'glider-bottom';

        // Place links at the bottom by default, or use the attribute
        this.linkLocation = $this.attr('data-glider-links') || 'glider-bottom';

        // Show one slide by default, or use the attribute
        this.fixedSlideWidth = "100%";
        this.widthInfo = [];
        this.slidesToShow = 1;

        var multipleAttribute = $this.attr('data-glider-multiple') || '1';

        if (multipleAttribute.indexOf('%') > -1 || multipleAttribute.indexOf('px') > -1) {
            this.fixedSlideWidth = multipleAttribute;
            this.setWidthInformation();
        } else {
            var multipleValue = parseInt(multipleAttribute, 10);
            this.slidesToShow = (isNaN(multipleValue)) ? 1 : multipleValue;
        }

        this.interval = null;
        this.classTimer = null;

        // Determine where controls should be placed        
        this.controlElement = $this;
        if (this.settings.controls) {
            this.controlElement = $this.parent().closest(this.settings.controls).css('position', 'relative').attr('dir', this.direction);
        }

        this.controlElement.addClass('glider-controls-' + this.direction);

        if (this.hasControls) {
            this.controlElement.append(this.getBackControl(this.controlLocation, this.settings.backIcon));
            this.controlElement.append(this.getNextControl(this.controlLocation, this.settings.nextIcon));
        }

        if (this.hasLinks) {
            this.controlElement.append($('<div>').append(this.getLinkControl(this.linkLocation, this.linkFunction)));
        }

        var _this = this;
        $window.on('gliderResizeDone', function () { _this.resize() });

        this.setUp();
    }

    Glider.prototype = {
        constructor: Glider,
        setUp: function () {
            var _this = this;
            if (this.hasAutoplay) {
                this.start();
            }

            this.goto(0);
            this.resize();
        },
        setWidthInformation: function () {
            if (this.fixedSlideWidth.charAt(0) === '[') {
                // Parses DSL for responsive sizes, i.e. [1200:300px,0:200px]
                var data = this.fixedSlideWidth.replace(/[\[\]]/g, '').split(',');
                for (var i = 0; i < data.length; i++) {
                    var info = data[i].split(':');
                    this.widthInfo.push({
                        p: parseInt(info[0], 10),
                        w: info[1]
                    });
                }

                this.widthInfo.sort(function (a, b) {
                    return (b.p - a.p);
                });
            } else {
                this.widthInfo = [{ p: 0, w: this.fixedSlideWidth }];
            }
        },
        getParentWidth: function () {
            var width = this.container.width();

            if (width <= 0) {
                var $parent = this.container.parent();
                var w = parseInt($parent.css('max-width'), 10);
                var mw = $parent.width();

                width = Math.min(w, mw);
            }

            return (width > 0) ? width : 0;
        },
        getPhysicalSize: function (rawValue) {
            // Converts % or px values into plain pixel number
            if (rawValue.indexOf('%') > -1) {
                var parentWidth = this.getParentWidth();
                return (parentWidth / 100) * parseInt(rawValue);
            } else {
                return parseInt(rawValue.replace('px', ''));
            }
        },
        getSlideWidth: function () {
            var parentWidth = this.getParentWidth();

            // Take into account the number of slides
            var slideWidth = parentWidth / this.slidesToShow;

            if (this.fixedSlideWidth !== '100%') {
                // Multiple Attribute specified widths
                for (var i = 0; i < this.widthInfo.length; i++) {
                    if (parentWidth >= this.widthInfo[i].p) {
                        slideWidth = this.getPhysicalSize(this.widthInfo[i].w);
                        break;
                    }
                }
            }

            return Math.floor(slideWidth);
        },
        positionSlider: function () {
            var parentWidth = this.getParentWidth();
            var slideWidth = this.getSlideWidth();

            $('.glider-link', this.container).removeClass('selected');
            $('.glider-link-' + this.currentSlide, this.container).addClass('selected');

            if (this.direction === 'ltr') {
                this.list.css({ 'left': '-' + (slideWidth * this.currentSlide) + 'px' });
            } else {
                this.list.css({ 'right': '-' + (slideWidth * this.currentSlide) + 'px' });
            }

            // For multi-slide layouts, hide the next control if the last slide is visible
            if (this.hasMultiple && this.settings.navigationMode === 'stop') {
                var visibility = 'visible';
                if (((this.items.length - this.currentSlide) * slideWidth) <= parentWidth) {
                    visibility = 'hidden'
                }

                $('.glider-control-next', this.controlElement).css({ 'visibility': visibility });
            }
        },
        resize: function () {
            var parentWidth = this.getParentWidth();
            var slideWidth = this.getSlideWidth();

            // Set width of slider and items
            this.list.css({ width: (slideWidth * (this.items.length + this.slidesToShow)) + 'px' });
            this.items.css({ width: slideWidth + 'px' });

            // Don't show controls if all slides are visible
            var visibility = 'visible';
            if ((slideWidth * this.items.length) <= parentWidth) {
                visibility = 'hidden';
            }

            $('.glider-control-back, .glider-control-next, .glider-control-link', this.controlElement).css({ 'visibility': visibility });

            // Set controls and links placed in the middle to half way vertically
            var slideHeight = this.items.eq(0).height();
            if (slideHeight > 200) {
                $('.glider-middle', this.controlElement).each(function () {
                    var $control = $(this);
                    var height = $control.height();

                    var h = (slideHeight - height) / 2;
                    $control.css('top', h + 'px');
                });
            }

            this.positionSlider();
        },
        start: function () {
            this.stop();
            var _this = this;
            this.interval = window.setInterval(function () {
                _this.next();
            }, 5000);
        },
        stop: function () {
            window.clearInterval(this.interval);
        },
        next: function () {
            return this.goto(this.currentSlide + this.slidesToShow);
        },
        back: function () {
            return this.goto(this.currentSlide - this.slidesToShow);
        },
        goto: function (index) {
            window.clearTimeout(this.classTimer);

            var oldSlide = this.currentSlide;
            this.currentSlide = index;

            if (this.currentSlide >= this.items.length) {
                this.currentSlide = 0;
            }

            if (this.currentSlide < 0) {
                this.currentSlide = this.items.length - 1;
            }

            // Determine whether to show the back button based on index
            if (this.settings.navigationMode === 'stop' && this.currentSlide === 0) {
                $('.glider-control-back', this.controlElement).hide();
            } else {
                $('.glider-control-back', this.controlElement).show();
            }

            // Determine whether to show the next button based on index
            if (this.settings.navigationMode === 'stop' && this.currentSlide === (this.items.length - 1)) {
                $('.glider-control-next', this.controlElement).hide();
            } else {
                $('.glider-control-next', this.controlElement).show();
            }

            var parentWidth = this.getParentWidth();
            var slideWidth = this.getSlideWidth();

            var selectedGroup = [];
            var leavingGroup = [];
            var arrivingGroup = [];

            var oldStart = slideWidth * oldSlide;
            var newStart = slideWidth * this.currentSlide;

            this.items.removeClass('selected leaving arriving');

            for (var i = 0; i < this.items.length; i++) {
                var slideStartPosition = i * slideWidth;

                var isVisibleBefore = (slideStartPosition >= oldStart && slideStartPosition < (oldStart + parentWidth));
                var isVisibleAfter = (slideStartPosition >= newStart && slideStartPosition < (newStart + parentWidth));

                if (isVisibleBefore && isVisibleAfter) {
                    selectedGroup.push(this.items.eq(i));
                }

                if (isVisibleBefore && !isVisibleAfter) {
                    leavingGroup.push(this.items.eq(i));
                }

                if (!isVisibleBefore && isVisibleAfter) {
                    arrivingGroup.push(this.items.eq(i));
                }
            }

            var _this = this;

            for (var i = 0; i < leavingGroup.length; i++) {
                leavingGroup[i].removeClass('selected leaving arriving').addClass('leaving');
                $window.trigger('gliderSlideLeaving', [_this, leavingGroup[i]]);
            }

            for (var i = 0; i < arrivingGroup.length; i++) {
                arrivingGroup[i].removeClass('selected leaving arriving').addClass('arriving');
                $window.trigger('gliderSlideArriving', [_this, arrivingGroup[i]]);
            }

            this.positionSlider();

            this.classTimer = window.setTimeout(function () {
                for (var i = 0; i < leavingGroup.length; i++) {
                    leavingGroup[i].removeClass('selected leaving arriving');
                }

                for (var i = 0; i < arrivingGroup.length; i++) {
                    arrivingGroup[i].removeClass('selected leaving arriving').addClass('selected');
                    $window.trigger('gliderSlideSelected', [_this, arrivingGroup[i]]);
                }

                for (var i = 0; i < selectedGroup.length; i++) {
                    selectedGroup[i].removeClass('leaving arriving').addClass('selected');
                    //$window.trigger('gliderSlideSelected', [_this, arrivingGroup[i]]);
                }
            }, 500);

            return false;
        },
        getBackControl: function (location, text) {
            var _this = this;
            return $('<div>')
                .addClass('glider-control-back')
                .addClass(location)
                .click(function () {
                    window.clearInterval(_this.interval);
                    _this.back();
                })
                .html(text);
        },
        getNextControl: function (location, text) {
            var _this = this;
            return $('<div>')
                .addClass('glider-control-next')
                .addClass(location)
                .click(function () {
                    window.clearInterval(_this.interval);
                    _this.next();
                })
                .html(text);
        },
        getLinkControl: function (location, textFunction) {
            var _this = this;
            var linkControl = $('<ul>')
                .addClass('glider-control-link')
                .addClass(location);

            var getListItem = function (idx) {
                return $('<li>')
                    .addClass('glider-link glider-link-' + idx)
                    .click(function () {
                        window.clearInterval(_this.interval)
                        _this.goto(idx);
                    })
                    .html(textFunction(idx));
            }

            for (var i = 0; i < this.items.length; i++) {
                linkControl.append(getListItem(i));
            }

            return linkControl;
        }
    };  

    $.fn.glider = function (options) {
        var settings = $.extend({
            list: 'ul',
            item: 'li',
            controls: '',
            animation: 'ease',
            nextIcon: '&gt;',
            backIcon: '&lt;',
            navigationMode: 'cycle'
        }, options);

        var gliders = [];

        this.each(function () {
            gliders.push(new Glider($(this), settings));
        });

        return gliders;
    };
}(jQuery));;
(function () {

    var menuTrees = [],
            IE = !!window.createPopup, // detect it for the iframe shim
            mouse = false, // optimize for touch by default - we will detect for mouse input
            touchEvents = 'ontouchstart' in window, // we use this just to choose between toucn and pointer events, not for touch screen detection
            mouseDetectionEnabled = false,
            requestAnimationFrame = window.requestAnimationFrame || function (callback) { return setTimeout(callback, 1000 / 60); },
            cancelAnimationFrame = window.cancelAnimationFrame || function (id) { clearTimeout(id); };

    function getEventsNS(defArr, eNS) {
        if (!eNS) {
            eNS = '';
        }
        var obj = {};
        $.each(defArr, function (index, value) {
            obj[value[0].split(' ').join(eNS + ' ') + eNS] = value[1];
        });
        return obj;
    }

    $.SmartMenus.prototype.menuPosition = function ($sub) {
        var $a = $sub.dataSM('parent-a'),
            $li = $a.closest('li'),
            $ul = $li.parent(),
            level = $sub.dataSM('level'),
            subW = this.getWidth($sub),
            subH = this.getHeight($sub),
            itemOffset = $a.offset(),
            itemX = itemOffset.left,
            itemY = itemOffset.top,
            itemW = this.getWidth($a),
            itemH = this.getHeight($a),
            $win = $(window),
            winX = $win.scrollLeft(),
            winY = $win.scrollTop(),
            winW = this.getViewportWidth(),
            winH = this.getViewportHeight(),
            horizontalParent = $ul.parent().is('[data-sm-horizontal-sub]') || level == 2 && !$ul.hasClass('sm-vertical'),
            rightToLeft = this.opts.rightToLeftSubMenus && !$li.is('[data-sm-reverse]') || !this.opts.rightToLeftSubMenus && $li.is('[data-sm-reverse]'),
            subOffsetX = level == 2 ? this.opts.mainMenuSubOffsetX : this.opts.subMenusSubOffsetX,
            subOffsetY = level == 2 ? this.opts.mainMenuSubOffsetY : this.opts.subMenusSubOffsetY,
            x, y;
        if (horizontalParent) {
            x = subOffsetX;
            y = this.opts.bottomToTopSubMenus ? -subH - subOffsetY : itemH + subOffsetY;
        } else {
            x = rightToLeft ? itemW - subOffsetX : itemW - subOffsetX;
            y = this.opts.bottomToTopSubMenus ? itemH - subOffsetY - subH : subOffsetY;
        }
        if (this.opts.keepInViewport) {
            var absX = itemX + x,
                absY = itemY + y;
            if (rightToLeft && absX < winX) {
                x = horizontalParent ? winX - absX + x : itemW - subOffsetX;
            } else if (!rightToLeft && absX + subW > winX + winW) {
                x = horizontalParent ? winX + winW - subW - absX + x : subOffsetX - subW;
            }
            if (!horizontalParent) {
                if (subH < winH && absY + subH > winY + winH) {
                    y += winY + winH - subH - absY;
                } else if (subH >= winH || absY < winY) {
                    y += winY - absY;
                }
            }

            // 0.49 used for better precision when dealing with float values
            if (horizontalParent && (absY + subH > winY + winH + 0.49 || absY < winY) || !horizontalParent && subH > winH + 0.49) {
                var self = this;
                if (!$sub.dataSM('scroll-arrows')) {
                    $sub.dataSM('scroll-arrows', $([$('<span class="scroll-up"><span class="scroll-up-arrow"></span></span>')[0], $('<span class="scroll-down"><span class="scroll-down-arrow"></span></span>')[0]])
                        .bind({
                            mouseenter: function () {
                                $sub.dataSM('scroll').up = $(this).hasClass('scroll-up');
                                self.menuScroll($sub);
                            },
                            mouseleave: function (e) {
                                self.menuScrollStop($sub);
                                self.menuScrollOut($sub, e);
                            },
                            'mousewheel DOMMouseScroll': function (e) { e.preventDefault(); }
                        })
                        .insertAfter($sub)
                    );
                }
                // bind scroll events and save scroll data for this sub
                var eNS = '.smartmenus_scroll';
                $sub.dataSM('scroll', {
                    y: this.cssTransforms3d ? 0 : y - itemH,
                    step: 1,
                    // cache stuff for faster recalcs later
                    itemH: itemH,
                    subH: subH,
                    arrowDownH: this.getHeight($sub.dataSM('scroll-arrows').eq(1))
                })
                    .bind(getEventsNS([
                        ['mouseover', function (e) { self.menuScrollOver($sub, e); }],
                        ['mouseout', function (e) { self.menuScrollOut($sub, e); }],
                        ['mousewheel DOMMouseScroll', function (e) { self.menuScrollMousewheel($sub, e); }]
                    ], eNS))
                    .dataSM('scroll-arrows').css({ top: 'auto', left: '0', marginLeft: x + (parseInt($sub.css('border-left-width')) || 0), width: subW - (parseInt($sub.css('border-left-width')) || 0) - (parseInt($sub.css('border-right-width')) || 0), zIndex: $sub.css('z-index') })
                        .eq(horizontalParent && this.opts.bottomToTopSubMenus ? 0 : 1).show();
                // when a menu tree is fixed positioned we allow scrolling via touch too
                // since there is no other way to access such long sub menus if no mouse is present

                $sub.css({ 'touch-action': 'none', '-ms-touch-action': 'none' })
                    .bind(getEventsNS([
                        [touchEvents ? 'touchstart touchmove touchend' : 'pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp', function (e) {
                            self.menuScrollTouch($sub, e);
                        }]
                    ], eNS));

            }
        }
        y = y - itemH;

        if ($sub.hasClass('car')) {
            var ancestorTop = $a.parents('.navLev1').offset().top;
            var myTop = $li.offset().top;

            var y = ((myTop - ancestorTop) * -1) - itemH;
        }

        if (rightToLeft) {
            $sub.css({ top: 'auto', left: 'auto', marginRight: x, marginTop: y });
        } else {
            $sub.css({ top: 'auto', left: '0', marginLeft: x, marginTop: y });
        }

        // IE iframe shim
        this.menuIframeShim($sub);
        if ($sub.dataSM('ie-shim')) {
            $sub.dataSM('ie-shim').css({ zIndex: $sub.css('z-index'), width: subW, height: subH, marginLeft: x, marginTop: y });
        }

    };

    $.SmartMenus.prototype.rootOut = function (e) {
        if (!this.handleEvents() || this.isTouchMode() || e.target == this.$root[0]) {
            return;
        }
        if (this.hideTimeout) {
            clearTimeout(this.hideTimeout);
            this.hideTimeout = 0;
        }

        if (!$('ul.car').is(':visible')) {
            if (!this.opts.showOnClick || !this.opts.hideOnClick) {
                var self = this;
                this.hideTimeout = setTimeout(function () { self.menuHideAll(); }, this.opts.hideTimeout);
            }
        }
    };

    $.SmartMenus.prototype.itemClick = function (e) {
        var $a = $(e.currentTarget);
        if (!this.handleItemEvents($a)) {
            return;
        }
        if (this.$touchScrollingSub && this.$touchScrollingSub[0] == $a.closest('ul')[0]) {
            this.$touchScrollingSub = null;
            e.stopPropagation();
            return false;
        }
        if (this.$root.triggerHandler('click.smapi', $a[0]) === false) {
            return false;
        }
        var subArrowClicked = $(e.target).is('span.sub-arrow'),
            $sub = $a.dataSM('sub'),
            firstLevelSub = $sub ? $sub.dataSM('level') == 2 : false;
        // if the sub is not visible
        if ($sub && !$sub.is(':visible')) {
            //added part 
            var $parentItemOpened = $a.closest('li.open');
            if ($parentItemOpened.length == 1 || ($parentItemOpened.length == 0 && $sub.dataSM('level') == 2)) {
                this.menuHideAll();
            }
            //end added part 
            if (this.opts.showOnClick && firstLevelSub) {
                this.clickActivated = true;
            }
            // try to activate the item and show the sub
            this.itemActivate($a);
            // if "itemActivate" showed the sub, prevent the click so that the link is not loaded
            // if it couldn't show it, then the sub menus are disabled with an !important declaration (e.g. via mobile styles) so let the link get loaded
            if ($sub.is(':visible') && window.innerWidth <= 992) {
                this.focusActivated = true;
                $('html,body').animate({
                    scrollTop: $a.offset().top
                }, 500);
                return false;
            }
        } else if (this.isCollapsible() && subArrowClicked) {
            this.itemActivate($a);
            this.menuHide($sub);
            return false;
        }
        if (this.opts.showOnClick && firstLevelSub || $a.hasClass('disabled') || this.$root.triggerHandler('select.smapi', $a[0]) === false) {
            return false;
        }
    };

    $.SmartMenus.prototype.isCollapsible = function (e) {
        return window.innerWidth <= 992;
    };

    $.SmartMenus.prototype.menuShow = function ($sub) {
        if (!$sub.dataSM('beforefirstshowfired')) {
            $sub.dataSM('beforefirstshowfired', true);
            if (this.$root.triggerHandler('beforefirstshow.smapi', $sub[0]) === false) {
                return;
            }
        }
        if (this.$root.triggerHandler('beforeshow.smapi', $sub[0]) === false) {
            return;
        }
        $sub.dataSM('shown-before', true)
            .stop(true, true);
        if (!$sub.is(':visible')) {
            // highlight parent item
            var $a = $sub.dataSM('parent-a');
            if (this.opts.keepHighlighted || this.isCollapsible()) {
                $a.addClass('highlighted');
            }
            if (this.isCollapsible()) {
                $sub.removeClass('sm-nowrap').css({ zIndex: '', width: 'auto', minWidth: '', maxWidth: '', top: '', left: '', marginLeft: '', marginTop: '' });
            } else {
                // set z-index
                $sub.css('z-index', this.zIndexInc = (this.zIndexInc || this.getStartZIndex()) + 1);
                // min/max-width fix - no way to rely purely on CSS as all UL's are nested
                if (this.opts.subMenusMinWidth || this.opts.subMenusMaxWidth) {
                    $sub.css({ width: 'auto', minWidth: '', maxWidth: '' }).addClass('sm-nowrap');
                    if (this.opts.subMenusMinWidth) {
                        $sub.css('min-width', this.opts.subMenusMinWidth);
                    }
                    if (this.opts.subMenusMaxWidth) {
                        var noMaxWidth = this.getWidth($sub);
                        $sub.css('max-width', this.opts.subMenusMaxWidth);
                        if (noMaxWidth > this.getWidth($sub)) {
                            $sub.removeClass('sm-nowrap').css('width', this.opts.subMenusMaxWidth);
                        }
                    }
                }
                this.menuPosition($sub);
            }
            var complete = function () {
                // fix: "overflow: hidden;" is not reset on animation complete in jQuery < 1.9.0 in Chrome when global "box-sizing: border-box;" is used
                $sub.css('overflow', '');
            };
            // if sub is collapsible (mobile view)
            if (this.isCollapsible()) {
                if (this.opts.collapsibleShowFunction) {
                    this.opts.collapsibleShowFunction.call(this, $sub, complete);
                } else {
                    $sub.show(this.opts.collapsibleShowDuration, complete);
                }
            } else {
                if (this.opts.showFunction) {
                    this.opts.showFunction.call(this, $sub, complete);
                } else {
                    $sub.show(this.opts.showDuration, complete);
                }
            }
            // accessibility
            $a.attr('aria-expanded', 'true');
            $sub.attr({
                'aria-expanded': 'true',
                'aria-hidden': 'false'
            });
            // store sub menu in visible array
            this.visibleSubMenus.push($sub);
            this.$root.triggerHandler('show.smapi', $sub[0]);
        }
    };

    $(document).ready(function () {
        var $smartMaxi = $('#SmartMaxi');
        var $smartMaxiSticky = $('#SmartMaxiSticky');

        if ($smartMaxi.length > 0) {
            setSmartMenu($smartMaxi);

            $smartMaxi.data('smartmenus').isCollapsible = function () {
                return (window.innerWidth <= 992);
            };
        }

        if ($smartMaxiSticky.length > 0) {
            setSmartMenu($smartMaxiSticky);

            $smartMaxiSticky.data('smartmenus').isCollapsible = function () {
                return (window.innerWidth <= 992);
            };
        }

        loadAsyncSubMenu();
    });
}());;
/*
 * File: iframeResizer.js
 * Desc: Force iframes to size to content.
 * Requires: iframeResizer.contentWindow.js to be loaded into the target frame.
 * Doc: https://github.com/davidjbradshaw/iframe-resizer
 * Author: David J. Bradshaw - dave@bradshaw.net
 * Contributor: Jure Mav - jure.mav@gmail.com
 * Contributor: Reed Dadoune - reed@dadoune.com
 */


;(function(window) {
	'use strict';

	var
		count                 = 0,
		logEnabled            = false,
		hiddenCheckEnabled    = false,
		msgHeader             = 'message',
		msgHeaderLen          = msgHeader.length,
		msgId                 = '[iFrameSizer]', //Must match iframe msg ID
		msgIdLen              = msgId.length,
		pagePosition          = null,
		requestAnimationFrame = window.requestAnimationFrame,
		resetRequiredMethods  = {max:1,scroll:1,bodyScroll:1,documentElementScroll:1},
		settings              = {},
		timer                 = null,
		logId                 = 'Host Page',

		defaults              = {
			autoResize                : true,
			bodyBackground            : null,
			bodyMargin                : null,
			bodyMarginV1              : 8,
			bodyPadding               : null,
			checkOrigin               : true,
			inPageLinks               : false,
			enablePublicMethods       : true,
			heightCalculationMethod   : 'bodyOffset',
			id                        : 'iFrameResizer',
			interval                  : 32,
			log                       : false,
			maxHeight                 : Infinity,
			maxWidth                  : Infinity,
			minHeight                 : 0,
			minWidth                  : 0,
			resizeFrom                : 'parent',
			scrolling                 : false,
			sizeHeight                : true,
			sizeWidth                 : false,
			tolerance                 : 0,
			widthCalculationMethod    : 'scroll',
			closedCallback            : function(){},
			initCallback              : function(){},
			messageCallback           : function(){warn('MessageCallback function not defined');},
			resizedCallback           : function(){},
			scrollCallback            : function(){return true;}
		};

	function addEventListener(obj,evt,func){
		/* istanbul ignore else */ // Not testable in PhantonJS
		if ('addEventListener' in window){
			obj.addEventListener(evt,func, false);
		} else if ('attachEvent' in window){//IE
			obj.attachEvent('on'+evt,func);
		}
	}

	function removeEventListener(el,evt,func){
		/* istanbul ignore else */ // Not testable in phantonJS
		if ('removeEventListener' in window){
			el.removeEventListener(evt,func, false);
		} else if ('detachEvent' in window){ //IE
			el.detachEvent('on'+evt,func);
		}
	}

	function setupRequestAnimationFrame(){
		var
			vendors = ['moz', 'webkit', 'o', 'ms'],
			x;

		// Remove vendor prefixing if prefixed and break early if not
		for (x = 0; x < vendors.length && !requestAnimationFrame; x += 1) {
			requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
		}

		if (!(requestAnimationFrame)){
			log('setup','RequestAnimationFrame not supported');
		}
	}

	function getMyID(iframeId){
		var retStr = 'Host page: '+iframeId;

		if (window.top!==window.self){
			if (window.parentIFrame && window.parentIFrame.getId){
				retStr = window.parentIFrame.getId()+': '+iframeId;
			} else {
				retStr = 'Nested host page: '+iframeId;
			}
		}

		return retStr;
	}

	function formatLogHeader(iframeId){
		return msgId + '[' + getMyID(iframeId) + ']';
	}

	function isLogEnabled(iframeId){
		return settings[iframeId] ? settings[iframeId].log : logEnabled;
	}

	function log(iframeId,msg){
		output('log',iframeId,msg,isLogEnabled(iframeId));
	}

	function info(iframeId,msg){
		output('info',iframeId,msg,isLogEnabled(iframeId));
	}

	function warn(iframeId,msg){
		output('warn',iframeId,msg,true);
	}

	function output(type,iframeId,msg,enabled){
		if (true === enabled && 'object' === typeof window.console){
			console[type](formatLogHeader(iframeId),msg);
		}
	}

	function iFrameListener(event){
		function resizeIFrame(){
			function resize(){
				setSize(messageData);
				setPagePosition(iframeId);
			}

			ensureInRange('Height');
			ensureInRange('Width');

			syncResize(resize,messageData,'init');
		}

		function processMsg(){
			var data = msg.substr(msgIdLen).split(':');

			return {
				iframe: settings[data[0]].iframe,
				id:     data[0],
				height: data[1],
				width:  data[2],
				type:   data[3]
			};
		}

		function ensureInRange(Dimension){
			var
				max  = Number(settings[iframeId]['max' + Dimension]),
				min  = Number(settings[iframeId]['min' + Dimension]),
				dimension = Dimension.toLowerCase(),
				size = Number(messageData[dimension]);

			log(iframeId,'Checking ' + dimension + ' is in range ' + min + '-' + max);

			if (size<min) {
				size=min;
				log(iframeId,'Set ' + dimension + ' to min value');
			}

			if (size>max) {
				size=max;
				log(iframeId,'Set ' + dimension + ' to max value');
			}

			messageData[dimension] = '' + size;
		}


		function isMessageFromIFrame(){
			function checkAllowedOrigin(){
				function checkList(){
					var
						i = 0,
						retCode = false;

					log(iframeId,'Checking connection is from allowed list of origins: ' + checkOrigin);

					for (; i < checkOrigin.length; i++) {
						if (checkOrigin[i] === origin) {
							retCode = true;
							break;
						}
					}
					return retCode;
				}

				function checkSingle(){
					var remoteHost  = settings[iframeId].remoteHost;
					log(iframeId,'Checking connection is from: '+remoteHost);
					return origin === remoteHost;
				}

				return checkOrigin.constructor === Array ? checkList() : checkSingle();
			}

			var
				origin      = event.origin,
				checkOrigin = settings[iframeId].checkOrigin;

			if (checkOrigin && (''+origin !== 'null') && !checkAllowedOrigin()) {
				throw new Error(
					'Unexpected message received from: ' + origin +
					' for ' + messageData.iframe.id +
					'. Message was: ' + event.data +
					'. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.'
				);
			}

			return true;
		}

		function isMessageForUs(){
			return msgId === (('' + msg).substr(0,msgIdLen)) && (msg.substr(msgIdLen).split(':')[0] in settings); //''+Protects against non-string msg
		}

		function isMessageFromMetaParent(){
			//Test if this message is from a parent above us. This is an ugly test, however, updating
			//the message format would break backwards compatibity.
			var retCode = messageData.type in {'true':1,'false':1,'undefined':1};

			if (retCode){
				log(iframeId,'Ignoring init message from meta parent page');
			}

			return retCode;
		}

		function getMsgBody(offset){
			return msg.substr(msg.indexOf(':')+msgHeaderLen+offset);
		}

		function forwardMsgFromIFrame(msgBody){
			log(iframeId,'MessageCallback passed: {iframe: '+ messageData.iframe.id + ', message: ' + msgBody + '}');
			callback('messageCallback',{
				iframe: messageData.iframe,
				message: JSON.parse(msgBody)
			});
			log(iframeId,'--');
		}

		function getPageInfo(){
			var
				bodyPosition   = document.body.getBoundingClientRect(),
				iFramePosition = messageData.iframe.getBoundingClientRect();

			return JSON.stringify({
				iframeHeight: iFramePosition.height,
				iframeWidth:  iFramePosition.width,
				clientHeight: Math.max(document.documentElement.clientHeight, window.innerHeight || 0),
				clientWidth:  Math.max(document.documentElement.clientWidth,  window.innerWidth  || 0),
				offsetTop:    parseInt(iFramePosition.top  - bodyPosition.top,  10),
				offsetLeft:   parseInt(iFramePosition.left - bodyPosition.left, 10),
				scrollTop:    window.pageYOffset,
				scrollLeft:   window.pageXOffset
			});
		}

		function sendPageInfoToIframe(iframe,iframeId){
			function debouncedTrigger(){
				trigger(
					'Send Page Info',
					'pageInfo:' + getPageInfo(), 
					iframe, 
					iframeId
				);
			}

			debouce(debouncedTrigger,32);
		}


		function startPageInfoMonitor(){
			function setListener(type,func){
				function sendPageInfo(){
					if (settings[id]){
						sendPageInfoToIframe(settings[id].iframe,id);
					} else {
						stop();
					}
				}

				['scroll','resize'].forEach(function(evt){
					log(id, type +  evt + ' listener for sendPageInfo');
					func(window,evt,sendPageInfo);
				});
			}

			function stop(){
				setListener('Remove ', removeEventListener);
			}

			function start(){
				setListener('Add ', addEventListener);
			}
			
			var id = iframeId; //Create locally scoped copy of iFrame ID

			start();

			settings[id].stopPageInfo = stop;
		}

		function stopPageInfoMonitor(){
			if (settings[iframeId] && settings[iframeId].stopPageInfo){
				settings[iframeId].stopPageInfo();
				delete settings[iframeId].stopPageInfo;
			}
		}

		function checkIFrameExists(){
			var retBool = true;

			if (null === messageData.iframe) {
				warn(iframeId,'IFrame ('+messageData.id+') not found');
				retBool = false;
			}
			return retBool;
		}

		function getElementPosition(target){
			var iFramePosition = target.getBoundingClientRect();

			getPagePosition(iframeId);

			return {
				x: Math.floor( Number(iFramePosition.left) + Number(pagePosition.x) ),
				y: Math.floor( Number(iFramePosition.top)  + Number(pagePosition.y) )
			};
		}

		function scrollRequestFromChild(addOffset){
			/* istanbul ignore next */  //Not testable in Karma
			function reposition(){
				pagePosition = newPosition;
				scrollTo();
				log(iframeId,'--');
			}

			function calcOffset(){
				return {
					x: Number(messageData.width) + offset.x,
					y: Number(messageData.height) + offset.y
				};
			}

			function scrollParent(){
				if (window.parentIFrame){
					window.parentIFrame['scrollTo'+(addOffset?'Offset':'')](newPosition.x,newPosition.y);
				} else {
					warn(iframeId,'Unable to scroll to requested position, window.parentIFrame not found');
				}
			}

			var
				offset = addOffset ? getElementPosition(messageData.iframe) : {x:0,y:0},
				newPosition = calcOffset();

			log(iframeId,'Reposition requested from iFrame (offset x:'+offset.x+' y:'+offset.y+')');

			if(window.top!==window.self){
				scrollParent();
			} else {
				reposition();
			}
		}

		function scrollTo(){
			if (false !== callback('scrollCallback',pagePosition)){
				setPagePosition(iframeId);
			} else {
				unsetPagePosition();
			}
		}

		function findTarget(location){
			function jumpToTarget(){
				var jumpPosition = getElementPosition(target);

				log(iframeId,'Moving to in page link (#'+hash+') at x: '+jumpPosition.x+' y: '+jumpPosition.y);
				pagePosition = {
					x: jumpPosition.x,
					y: jumpPosition.y
				};

				scrollTo();
				log(iframeId,'--');
			}

			function jumpToParent(){
				if (window.parentIFrame){
					window.parentIFrame.moveToAnchor(hash);
				} else {
					log(iframeId,'In page link #'+hash+' not found and window.parentIFrame not found');
				}
			}

			var
				hash     = location.split('#')[1] || '',
				hashData = decodeURIComponent(hash),
				target   = document.getElementById(hashData) || document.getElementsByName(hashData)[0];

			if (target){
				jumpToTarget();
			} else if(window.top!==window.self){
				jumpToParent();
			} else {
				log(iframeId,'In page link #'+hash+' not found');
			}
		}

		function callback(funcName,val){
			return chkCallback(iframeId,funcName,val);
		}

		function actionMsg(){

			if(settings[iframeId].firstRun) firstRun();

			switch(messageData.type){
			case 'close':
				closeIFrame(messageData.iframe);
				break;
			case 'message':
				forwardMsgFromIFrame(getMsgBody(6));
				break;
			case 'scrollTo':
				scrollRequestFromChild(false);
				break;
			case 'scrollToOffset':
				scrollRequestFromChild(true);
				break;
			case 'pageInfo':
				sendPageInfoToIframe(settings[iframeId].iframe,iframeId);
				startPageInfoMonitor();
				break;
			case 'pageInfoStop':
				stopPageInfoMonitor();
				break;
			case 'inPageLink':
				findTarget(getMsgBody(9));
				break;
			case 'reset':
				resetIFrame(messageData);
				break;
			case 'init':
				resizeIFrame();
				callback('initCallback',messageData.iframe);
				callback('resizedCallback',messageData);
				break;
			default:
				resizeIFrame();
				callback('resizedCallback',messageData);
			}
		}

		function hasSettings(iframeId){
			var retBool = true;

			if (!settings[iframeId]){
				retBool = false;
				warn(messageData.type + ' No settings for ' + iframeId + '. Message was: ' + msg);
			}

			return retBool;
		}

		function iFrameReadyMsgReceived(){
			for (var iframeId in settings){
				trigger('iFrame requested init',createOutgoingMsg(iframeId),document.getElementById(iframeId),iframeId);
			}
		}

		function firstRun() {
			settings[iframeId].firstRun = false;
		}

		var
			msg = event.data,
			messageData = {},
			iframeId = null;

		if('[iFrameResizerChild]Ready' === msg){
			iFrameReadyMsgReceived();
		} else if (isMessageForUs()){
			messageData = processMsg();
			iframeId    = logId = messageData.id;

			if (!isMessageFromMetaParent() && hasSettings(iframeId)){
				log(iframeId,'Received: '+msg);

				if ( checkIFrameExists() && isMessageFromIFrame() ){
					actionMsg();
				}
			}
		} else {
			info(iframeId,'Ignored: '+msg);
		}

	}


	function chkCallback(iframeId,funcName,val){
		var
			func = null,
			retVal = null;

		if(settings[iframeId]){
			func = settings[iframeId][funcName];

			if( 'function' === typeof func){
				retVal = func(val);
			} else {
				throw new TypeError(funcName+' on iFrame['+iframeId+'] is not a function');
			}
		}

		return retVal;
	}

	function closeIFrame(iframe){
		var iframeId = iframe.id;

		log(iframeId,'Removing iFrame: '+iframeId);
		iframe.parentNode.removeChild(iframe);
		chkCallback(iframeId,'closedCallback',iframeId);
		log(iframeId,'--');
		delete settings[iframeId];
	}

	function getPagePosition(iframeId){
		if(null === pagePosition){
			pagePosition = {
				x: (window.pageXOffset !== undefined) ? window.pageXOffset : document.documentElement.scrollLeft,
				y: (window.pageYOffset !== undefined) ? window.pageYOffset : document.documentElement.scrollTop
			};
			log(iframeId,'Get page position: '+pagePosition.x+','+pagePosition.y);
		}
	}

	function setPagePosition(iframeId){
		if(null !== pagePosition){
			window.scrollTo(pagePosition.x,pagePosition.y);
			log(iframeId,'Set page position: '+pagePosition.x+','+pagePosition.y);
			unsetPagePosition();
		}
	}

	function unsetPagePosition(){
		pagePosition = null;
	}

	function resetIFrame(messageData){
		function reset(){
			setSize(messageData);
			trigger('reset','reset',messageData.iframe,messageData.id);
		}

		log(messageData.id,'Size reset requested by '+('init'===messageData.type?'host page':'iFrame'));
		getPagePosition(messageData.id);
		syncResize(reset,messageData,'reset');
	}

	function setSize(messageData){
		function setDimension(dimension){
			messageData.iframe.style[dimension] = messageData[dimension] + 'px';
			log(
				messageData.id,
				'IFrame (' + iframeId +
				') ' + dimension +
				' set to ' + messageData[dimension] + 'px'
			);
		}

		function chkZero(dimension){
			//FireFox sets dimension of hidden iFrames to zero.
			//So if we detect that set up an event to check for
			//when iFrame becomes visible.

			/* istanbul ignore next */  //Not testable in PhantomJS
			if (!hiddenCheckEnabled && '0' === messageData[dimension]){
				hiddenCheckEnabled = true;
				log(iframeId,'Hidden iFrame detected, creating visibility listener');
				fixHiddenIFrames();
			}
		}

		function processDimension(dimension){
			setDimension(dimension);
			chkZero(dimension);
		}

		var iframeId = messageData.iframe.id;

		if(settings[iframeId]){
			if( settings[iframeId].sizeHeight) { processDimension('height'); }
			if( settings[iframeId].sizeWidth ) { processDimension('width'); }
		}
	}

	function syncResize(func,messageData,doNotSync){
		/* istanbul ignore if */  //Not testable in PhantomJS
		if(doNotSync!==messageData.type && requestAnimationFrame){
			log(messageData.id,'Requesting animation frame');
			requestAnimationFrame(func);
		} else {
			func();
		}
	}

	function trigger(calleeMsg,msg,iframe,id){
		function postMessageToIFrame(){
			var target = settings[id].targetOrigin;
			log(id,'[' + calleeMsg + '] Sending msg to iframe['+id+'] ('+msg+') targetOrigin: '+target);
			iframe.contentWindow.postMessage( msgId + msg, target );
		}

		function iFrameNotFound(){
			info(id,'[' + calleeMsg + '] IFrame('+id+') not found');
			if(settings[id]) {
				delete settings[id];
			}
		}

		function chkAndSend(){
			if(iframe && 'contentWindow' in iframe && (null !== iframe.contentWindow)){ //Null test for PhantomJS
				postMessageToIFrame();
			} else {
				iFrameNotFound();
			}
		}

		id = id || iframe.id;

		if(settings[id]) {
			chkAndSend();
		}

	}

	function createOutgoingMsg(iframeId){
		return iframeId +
			':' + settings[iframeId].bodyMarginV1 +
			':' + settings[iframeId].sizeWidth +
			':' + settings[iframeId].log +
			':' + settings[iframeId].interval +
			':' + settings[iframeId].enablePublicMethods +
			':' + settings[iframeId].autoResize +
			':' + settings[iframeId].bodyMargin +
			':' + settings[iframeId].heightCalculationMethod +
			':' + settings[iframeId].bodyBackground +
			':' + settings[iframeId].bodyPadding +
			':' + settings[iframeId].tolerance +
			':' + settings[iframeId].inPageLinks +
			':' + settings[iframeId].resizeFrom +
			':' + settings[iframeId].widthCalculationMethod;
	}

	function setupIFrame(iframe,options){
		function setLimits(){
			function addStyle(style){
				if ((Infinity !== settings[iframeId][style]) && (0 !== settings[iframeId][style])){
					iframe.style[style] = settings[iframeId][style] + 'px';
					log(iframeId,'Set '+style+' = '+settings[iframeId][style]+'px');
				}
			}

			function chkMinMax(dimension){
				if (settings[iframeId]['min'+dimension]>settings[iframeId]['max'+dimension]){
					throw new Error('Value for min'+dimension+' can not be greater than max'+dimension);
				}
			}

			chkMinMax('Height');
			chkMinMax('Width');

			addStyle('maxHeight');
			addStyle('minHeight');
			addStyle('maxWidth');
			addStyle('minWidth');
		}

		function newId(){
			var id = ((options && options.id) || defaults.id + count++);
			if  (null!==document.getElementById(id)){
				id = id + count++;
			}
			return id;
		}

		function ensureHasId(iframeId){
			logId=iframeId;
			if (''===iframeId){
				iframe.id = iframeId =  newId();
				logEnabled = (options || {}).log;
				logId=iframeId;
				log(iframeId,'Added missing iframe ID: '+ iframeId +' (' + iframe.src + ')');
			}


			return iframeId;
		}

		function setScrolling(){
			log(iframeId,'IFrame scrolling ' + (settings[iframeId].scrolling ? 'enabled' : 'disabled') + ' for ' + iframeId);
			iframe.style.overflow = false === settings[iframeId].scrolling ? 'hidden' : 'auto';
			iframe.scrolling      = false === settings[iframeId].scrolling ? 'no' : 'yes';
		}

		//The V1 iFrame script expects an int, where as in V2 expects a CSS
		//string value such as '1px 3em', so if we have an int for V2, set V1=V2
		//and then convert V2 to a string PX value.
		function setupBodyMarginValues(){
			if (('number'===typeof(settings[iframeId].bodyMargin)) || ('0'===settings[iframeId].bodyMargin)){
				settings[iframeId].bodyMarginV1 = settings[iframeId].bodyMargin;
				settings[iframeId].bodyMargin   = '' + settings[iframeId].bodyMargin + 'px';
			}
		}

		function checkReset(){
			// Reduce scope of firstRun to function, because IE8's JS execution
			// context stack is borked and this value gets externally
			// changed midway through running this function!!!
			var
				firstRun           = settings[iframeId].firstRun,
				resetRequertMethod = settings[iframeId].heightCalculationMethod in resetRequiredMethods;

			if (!firstRun && resetRequertMethod){
				resetIFrame({iframe:iframe, height:0, width:0, type:'init'});
			}
		}

		function setupIFrameObject(){
			if(Function.prototype.bind){ //Ignore unpolyfilled IE8.
				settings[iframeId].iframe.iFrameResizer = {

					close        : closeIFrame.bind(null,settings[iframeId].iframe),

					resize       : trigger.bind(null,'Window resize', 'resize', settings[iframeId].iframe),

					moveToAnchor : function(anchor){
						trigger('Move to anchor','inPageLink:'+anchor, settings[iframeId].iframe,iframeId);
					},

					sendMessage  : function(message){
						message = JSON.stringify(message);
						trigger('Send Message','message:'+message, settings[iframeId].iframe,iframeId);
					}
				};
			}
		}

		//We have to call trigger twice, as we can not be sure if all
		//iframes have completed loading when this code runs. The
		//event listener also catches the page changing in the iFrame.
		function init(msg){
			function iFrameLoaded(){
				trigger('iFrame.onload',msg,iframe);
				checkReset();
			}

			addEventListener(iframe,'load',iFrameLoaded);
			trigger('init',msg,iframe);
		}

		function checkOptions(options){
			if ('object' !== typeof options){
				throw new TypeError('Options is not an object');
			}
		}

		function copyOptions(options){
			for (var option in defaults) {
				if (defaults.hasOwnProperty(option)){
					settings[iframeId][option] = options.hasOwnProperty(option) ? options[option] : defaults[option];
				}
			}
		}

		function getTargetOrigin (remoteHost){
			return ('' === remoteHost || 'file://' === remoteHost) ? '*' : remoteHost;
		}

		function processOptions(options){
			options = options || {};
			settings[iframeId] = {
				firstRun	: true,
				iframe		: iframe,
				remoteHost	: iframe.src.split('/').slice(0,3).join('/')
			};

			checkOptions(options);
			copyOptions(options);

			settings[iframeId].targetOrigin = true === settings[iframeId].checkOrigin ? getTargetOrigin(settings[iframeId].remoteHost) : '*';
		}

		function beenHere(){
			return (iframeId in settings && 'iFrameResizer' in iframe);
		}

		var iframeId = ensureHasId(iframe.id);

		if (!beenHere()){
			processOptions(options);
			setScrolling();
			setLimits();
			setupBodyMarginValues();
			init(createOutgoingMsg(iframeId));
			setupIFrameObject();
		} else {
			warn(iframeId,'Ignored iFrame, already setup.');
		}
	}

	function debouce(fn,time){
		if (null === timer){
			timer = setTimeout(function(){
				timer = null;
				fn();
			}, time);
		}
	}

	/* istanbul ignore next */  //Not testable in PhantomJS
	function fixHiddenIFrames(){
		function checkIFrames(){
			function checkIFrame(settingId){
				function chkDimension(dimension){
					return '0px' === settings[settingId].iframe.style[dimension];
				}

				function isVisible(el) {
					return (null !== el.offsetParent);
				}

				if (isVisible(settings[settingId].iframe) && (chkDimension('height') || chkDimension('width'))){
					trigger('Visibility change', 'resize', settings[settingId].iframe,settingId);
				}
			}

			for (var settingId in settings){
				checkIFrame(settingId);
			}
		}

		function mutationObserved(mutations){
			log('window','Mutation observed: ' + mutations[0].target + ' ' + mutations[0].type);
			debouce(checkIFrames,16);
		}

		function createMutationObserver(){
			var
				target = document.querySelector('body'),

				config = {
					attributes            : true,
					attributeOldValue     : false,
					characterData         : true,
					characterDataOldValue : false,
					childList             : true,
					subtree               : true
				},

				observer = new MutationObserver(mutationObserved);

			observer.observe(target, config);
		}

		var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;

		if (MutationObserver) createMutationObserver();
	}


	function resizeIFrames(event){
		function resize(){
			sendTriggerMsg('Window '+event,'resize');
		}

		log('window','Trigger event: '+event);
		debouce(resize,16);
	}

	/* istanbul ignore next */  //Not testable in PhantomJS
	function tabVisible() {
		function resize(){
			sendTriggerMsg('Tab Visable','resize');
		}

		if('hidden' !== document.visibilityState) {
			log('document','Trigger event: Visiblity change');
			debouce(resize,16);
		}
	}

	function sendTriggerMsg(eventName,event){
		function isIFrameResizeEnabled(iframeId) {
			return	'parent' === settings[iframeId].resizeFrom &&
					settings[iframeId].autoResize &&
					!settings[iframeId].firstRun;
		}

		for (var iframeId in settings){
			if(isIFrameResizeEnabled(iframeId)){
				trigger(eventName,event,document.getElementById(iframeId),iframeId);
			}
		}
	}

	function setupEventListeners(){
		addEventListener(window,'message',iFrameListener);

		addEventListener(window,'resize', function(){resizeIFrames('resize');});

		addEventListener(document,'visibilitychange',tabVisible);
		addEventListener(document,'-webkit-visibilitychange',tabVisible); //Andriod 4.4
		addEventListener(window,'focusin',function(){resizeIFrames('focus');}); //IE8-9
		addEventListener(window,'focus',function(){resizeIFrames('focus');});
	}


	function factory(){
		function init(options,element){
			function chkType(){
				if(!element.tagName) {
					throw new TypeError('Object is not a valid DOM element');
				} else if ('IFRAME' !== element.tagName.toUpperCase()) {
					throw new TypeError('Expected <IFRAME> tag, found <'+element.tagName+'>');
				}
			}

			if(element) {
				chkType();
				setupIFrame(element, options);
				iFrames.push(element);
			}
		}

		var iFrames;

		setupRequestAnimationFrame();
		setupEventListeners();

		return function iFrameResizeF(options,target){
			iFrames = []; //Only return iFrames past in on this call

			switch (typeof(target)){
			case 'undefined':
			case 'string':
				Array.prototype.forEach.call(
					document.querySelectorAll( target || 'iframe' ),
					init.bind(undefined, options)
				);
				break;
			case 'object':
				init(options,target);
				break;
			default:
				throw new TypeError('Unexpected data type ('+typeof(target)+')');
			}

			return iFrames;
		};
	}

	function createJQueryPublicMethod($){
		$.fn.iFrameResize = function $iFrameResizeF(options) {
			return this.filter('iframe').each(function (index, element) {
				setupIFrame(element, options);
			}).end();
		};
	}

	if (window.jQuery) { createJQueryPublicMethod(jQuery); }

	if (typeof define === 'function' && define.amd) {
		define([],factory);
	} else if (typeof module === 'object' && typeof module.exports === 'object') { //Node for browserfy
		module.exports = factory();
	} else {
		window.iFrameResize = window.iFrameResize || factory();
	}

})(window || {});
;
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox"  aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","Ｂ":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","Ｃ":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","Ｄ":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","Ǳ":"DZ","Ǆ":"DZ","ǲ":"Dz","ǅ":"Dz","Ⓔ":"E","Ｅ":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","Ｆ":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","Ｇ":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","Ｈ":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","Ｉ":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","Ｊ":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","Ｋ":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","Ｌ":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","Ǉ":"LJ","ǈ":"Lj","Ⓜ":"M","Ｍ":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","Ｎ":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","Ǌ":"NJ","ǋ":"Nj","Ⓞ":"O","Ｏ":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","Ｐ":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Ｑ":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","Ｒ":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","Ｓ":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","Ｔ":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","Ｕ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","Ｖ":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");
if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b),d=g.$element.find("option").filter(function(){return a(this).val()===c.id});if(!d.length){var e=g.option(c);e.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([e])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null;
},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});;
// maximize-select2-height v1.0.2
// (c) Panorama Education 2015
// MIT License

// This jQuery/Select2 plugin expands a Select2 dropdown to take up as much
// height as possible given its position on the page and the current viewport
// size. The plugin correctly handles:
//   - Dynamic window resizing.
//   - The effects of scroll bars on the viewport.
//   - Select2 rendering dropdowns both upwards and downwards.

// NOTE: The original <select> element that is $().select2()'d *must* have a
// unique ID for this code to work. (Ex: <select id="my-unique-id"></select>)

(function ($) {
    "use strict";

    // We can find these elements now, since the properties we check on them are
    // all via methods that are recalculated each time.
    var $window = $(window);
    var $document = $(document);

    // @param {Object} options The options object passed in when this plugin is
    //   initialized
    // @param {Boolean} dropdownDownwards True iff the dropdown is rendered
    //   downwards (Select2 sometimes renders the options upwards to better fit on
    //   a page)
    // @return {Object} The options passed in, combined with defaults. Keys are:
    //   - cushion: The number of pixels between the edge of the dropdown and the
    //              edge of the viewable window. [Default: 10, except when a
    //              horizontal scroll bar would interfere, in which case it's 30.]
    //              NOTE: If a value is passed in, no adjustments for possible
    //              scroll bars are made.
    var settings = function (options, dropdownDownwards) {
        return $.extend({
            cushion: (
              dropdownDownwards && $document.width() > $window.width()
            ) ? 30 : 10
        }, options);
    };

    // @param {String} id The DOM element ID for the original <select> node
    // @param {jQuery object} $select2Results The DOM element with class
    //   "select2-results"
    // @param {jQuery object} $grandparent The grandparent object of the
    //   $select2Results object
    // @param {Object} options The options object passed in when this plugin is
    //   initialized
    // @param {Boolean} dropdownDownwards True iff the dropdown is rendered
    //   downwards (Select2 sometimes renders the options upwards to better fit on
    //   a page)
    // @return {Number} the maximum height of the Select2 results box to display
    var computeMaxHeight = function (
      id, $select2Results, $grandparent, options, dropdownDownwards
    ) {
        var height;
        var resultsBoxMiscellaniaHeight;
        var widgetBoxOffset;

        if (dropdownDownwards) {
            // When the dropdown appears downwards, the formula is:
            //   visible window size
            // + out-of-window pixels we've scrolled past
            // - size of content (including offscreen content) above results box
            // ------------------------------------------
            //   total height available to us

            // innerHeight is more accurate across browsers than $(window).height().
            height = window.innerHeight +
                     $window.scrollTop() -
                     $select2Results.offset().top;
        } else {
            // When the dropdown appears upwards, the formula is:
            //   vertical position of the widget (clickable) dropdown box
            // - out-of-window pixels we've scrolled past
            // - height of the search box and other content above the actual results
            //   but in the results box
            // ------------------------------------------
            //   total height available to us

            // Compute the global vertical offset of the widget box (the one with the
            // downward arrow that the user clicks on to expose options).
            //widgetBoxOffset = $("#select2-" + id + "-container").
            //                  parent().parent().parent().offset().top;

            // As the above code is for the plugin, we customized it to our select2 container's id name.
            widgetBoxOffset = $("#" + id).offset().top;

            // Compute the height, if any, of search box and other content in the
            // results box but not part of the results.
            resultsBoxMiscellaniaHeight = $grandparent.height() -
                                          $select2Results.height();
            height = widgetBoxOffset -
                     $window.scrollTop() -
                resultsBoxMiscellaniaHeight;
        }

        // Leave a little cushion to prevent the dropdown from
        // rendering off the edge of the viewport.
        return height - settings(options, dropdownDownwards).cushion;
    };

    // Call on a jQuery Select2 element to maximize the height of the dropdown
    // every time it is opened.
    // @param {Object} options The options object passed in when this plugin is
    //   initialized
    $.fn.maximizeSelect2Height = function (options) {
        return this.each(function (_, el) {
            // Each time the Select2 is opened, resize it to take up as much vertical
            // space as possible given its position and the current viewport size.
            $(el).on("select2:open", function () {
                // We have to put this code block inside a timeout because we determine
                // whether the dropdown is rendered upwards or downwards via a hack that
                // looks at the CSS classes, and these aren't set until Select2 has a
                // chance to render the box, which occurs after this event fires.

                // The alternative solution that avoids using a timeout would be to
                // directly modify the document's stylesheets (instead of the styles for
                // individual elements), but that is both ugly/dangerous and actually
                // impossible for us because we need to modify the styles of a parent
                // node of a given DOM node when the parent has no unique ID, which CSS
                // doesn't have the ability to do.
                setTimeout(function () {
                    var $select2Results = $("#select2-" + el.id + "-results");
                    var $parent = $select2Results.parent();
                    var $grandparent = $parent.parent();
                    var dropdownDownwards = $grandparent
                                            .hasClass("select2-dropdown--below");

                    var maxHeight = computeMaxHeight(
                      el.id,
                      $select2Results,
                      $grandparent,
                      options,
                      dropdownDownwards
                    );

                    // Set the max height of the relevant DOM elements. We use max-height
                    // instead of height directly to correctly handle cases in which there
                    // are only a few elements (we don't want a giant empty dropdown box).
                    $parent.css("max-height", maxHeight);
                    $select2Results.css("max-height", maxHeight);

                    // Select2 corrects the positioning of the results box on scroll, so
                    // we trigger that event here to let it auto-correct. This is done for
                    // the case where the dropdown appears upwards; we adjust its max
                    // height but we also want to move it up further, lest it cover up the
                    // initial dropdown box.
                    $(document).trigger("scroll");
                });
            });
        });
    };
})(jQuery);;
// ==================================================
// fancyBox v3.1.25
//
// Licensed GPLv3 for open source use
// or fancyBox Commercial License for commercial use
//
// http://fancyapps.com/fancybox/
// Copyright 2017 fancyApps
//
// ==================================================
!function(t,e,n,o){"use strict";function i(t){var e=t.currentTarget,o=t.data?t.data.options:{},i=o.selector?n(o.selector):t.data?t.data.items:[],a=n(e).attr("data-fancybox")||"",s=0,r=n.fancybox.getInstance();t.preventDefault(),t.stopPropagation(),r&&r.current.opts.$orig.is(e)||(a?(i=i.length?i.filter('[data-fancybox="'+a+'"]'):n('[data-fancybox="'+a+'"]'),s=i.index(e),s<0&&(s=0)):i=[e],n.fancybox.open(i,o,s))}if(n){if(n.fn.fancybox)return void n.error("fancyBox already initialized");var a={loop:!1,margin:[44,0],gutter:50,keyboard:!0,arrows:!0,infobar:!1,toolbar:!0,buttons:["slideShow","fullScreen","thumbs","close"],idleTime:4,smallBtn:"auto",protect:!1,modal:!1,image:{preload:"auto"},ajax:{settings:{data:{fancybox:!0}}},iframe:{tpl:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen allowtransparency="true" src=""></iframe>',preload:!0,css:{},attr:{scrolling:"auto"}},animationEffect:"zoom",animationDuration:366,zoomOpacity:"auto",transitionEffect:"fade",transitionDuration:366,slideClass:"",baseClass:"",baseTpl:'<div class="fancybox-container" role="dialog" tabindex="-1"><div class="fancybox-bg"></div><div class="fancybox-inner"><div class="fancybox-infobar"><button data-fancybox-prev title="{{PREV}}" class="fancybox-button fancybox-button--left"></button><div class="fancybox-infobar__body"><span data-fancybox-index></span>&nbsp;/&nbsp;<span data-fancybox-count></span></div><button data-fancybox-next title="{{NEXT}}" class="fancybox-button fancybox-button--right"></button></div><div class="fancybox-toolbar">{{BUTTONS}}</div><div class="fancybox-navigation"><button data-fancybox-prev title="{{PREV}}" class="fancybox-arrow fancybox-arrow--left" /><button data-fancybox-next title="{{NEXT}}" class="fancybox-arrow fancybox-arrow--right" /></div><div class="fancybox-stage"></div><div class="fancybox-caption-wrap"><div class="fancybox-caption"></div></div></div></div>',spinnerTpl:'<div class="fancybox-loading"></div>',errorTpl:'<div class="fancybox-error"><p>{{ERROR}}<p></div>',btnTpl:{slideShow:'<button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}"></button>',fullScreen:'<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fullscreen" title="{{FULL_SCREEN}}"></button>',thumbs:'<button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}"></button>',close:'<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}"></button>',smallBtn:'<button data-fancybox-close class="fancybox-close-small" title="{{CLOSE}}"></button>'},parentEl:"body",autoFocus:!0,backFocus:!0,trapFocus:!0,fullScreen:{autoStart:!1},touch:{vertical:!0,momentum:!0},hash:null,media:{},slideShow:{autoStart:!1,speed:4e3},thumbs:{autoStart:!1,hideOnClose:!0},onInit:n.noop,beforeLoad:n.noop,afterLoad:n.noop,beforeShow:n.noop,afterShow:n.noop,beforeClose:n.noop,afterClose:n.noop,onActivate:n.noop,onDeactivate:n.noop,clickContent:function(t,e){return"image"===t.type&&"zoom"},clickSlide:"close",clickOutside:"close",dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1,mobile:{clickContent:function(t,e){return"image"===t.type&&"toggleControls"},clickSlide:function(t,e){return"image"===t.type?"toggleControls":"close"},dblclickContent:function(t,e){return"image"===t.type&&"zoom"},dblclickSlide:function(t,e){return"image"===t.type&&"zoom"}},lang:"en",i18n:{en:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded. <br/> Please try again later.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",THUMBS:"Thumbnails"},de:{CLOSE:"Schliessen",NEXT:"Weiter",PREV:"Zurück",ERROR:"Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es später nochmal.",PLAY_START:"Diaschau starten",PLAY_STOP:"Diaschau beenden",FULL_SCREEN:"Vollbild",THUMBS:"Vorschaubilder"}}},s=n(t),r=n(e),c=0,l=function(t){return t&&t.hasOwnProperty&&t instanceof n},u=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),d=function(){var t,n=e.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(t in i)if(n.style[t]!==o)return i[t]}(),f=function(t){return t&&t.length&&t[0].offsetHeight},h=function(t,o,i){var s=this;s.opts=n.extend(!0,{index:i},a,o||{}),o&&n.isArray(o.buttons)&&(s.opts.buttons=o.buttons),s.id=s.opts.id||++c,s.group=[],s.currIndex=parseInt(s.opts.index,10)||0,s.prevIndex=null,s.prevPos=null,s.currPos=0,s.firstRun=null,s.createGroup(t),s.group.length&&(s.$lastFocus=n(e.activeElement).blur(),s.slides={},s.init(t))};n.extend(h.prototype,{init:function(){var t,e,o,i=this,a=i.group[i.currIndex].opts;i.scrollTop=r.scrollTop(),i.scrollLeft=r.scrollLeft(),n.fancybox.getInstance()||n.fancybox.isMobile||"hidden"===n("body").css("overflow")||(t=n("body").width(),n("html").addClass("fancybox-enabled"),t=n("body").width()-t,t>1&&n("head").append('<style id="fancybox-style-noscroll" type="text/css">.compensate-for-scrollbar, .fancybox-enabled body { margin-right: '+t+"px; }</style>")),o="",n.each(a.buttons,function(t,e){o+=a.btnTpl[e]||""}),e=n(i.translate(i,a.baseTpl.replace("{{BUTTONS}}",o))).addClass("fancybox-is-hidden").attr("id","fancybox-container-"+i.id).addClass(a.baseClass).data("FancyBox",i).prependTo(a.parentEl),i.$refs={container:e},["bg","inner","infobar","toolbar","stage","caption"].forEach(function(t){i.$refs[t]=e.find(".fancybox-"+t)}),(!a.arrows||i.group.length<2)&&e.find(".fancybox-navigation").remove(),a.infobar||i.$refs.infobar.remove(),a.toolbar||i.$refs.toolbar.remove(),i.trigger("onInit"),i.activate(),i.jumpTo(i.currIndex)},translate:function(t,e){var n=t.opts.i18n[t.opts.lang];return e.replace(/\{\{(\w+)\}\}/g,function(t,e){var i=n[e];return i===o?t:i})},createGroup:function(t){var e=this,i=n.makeArray(t);n.each(i,function(t,i){var a,s,r,c,l={},u={},d=[];n.isPlainObject(i)?(l=i,u=i.opts||i):"object"===n.type(i)&&n(i).length?(a=n(i),d=a.data(),u="options"in d?d.options:{},u="object"===n.type(u)?u:{},l.src="src"in d?d.src:u.src||a.attr("href"),["width","height","thumb","type","filter"].forEach(function(t){t in d&&(u[t]=d[t])}),"srcset"in d&&(u.image={srcset:d.srcset}),u.$orig=a,l.type||l.src||(l.type="inline",l.src=i)):l={type:"html",src:i+""},l.opts=n.extend(!0,{},e.opts,u),n.fancybox.isMobile&&(l.opts=n.extend(!0,{},l.opts,l.opts.mobile)),s=l.type||l.opts.type,r=l.src||"",!s&&r&&(r.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?s="image":r.match(/\.(pdf)((\?|#).*)?$/i)?s="pdf":"#"===r.charAt(0)&&(s="inline")),l.type=s,l.index=e.group.length,l.opts.$orig&&!l.opts.$orig.length&&delete l.opts.$orig,!l.opts.$thumb&&l.opts.$orig&&(l.opts.$thumb=l.opts.$orig.find("img:first")),l.opts.$thumb&&!l.opts.$thumb.length&&delete l.opts.$thumb,"function"===n.type(l.opts.caption)?l.opts.caption=l.opts.caption.apply(i,[e,l]):"caption"in d&&(l.opts.caption=d.caption),l.opts.caption=l.opts.caption===o?"":l.opts.caption+"","ajax"===s&&(c=r.split(/\s+/,2),c.length>1&&(l.src=c.shift(),l.opts.filter=c.shift())),"auto"==l.opts.smallBtn&&(n.inArray(s,["html","inline","ajax"])>-1?(l.opts.toolbar=!1,l.opts.smallBtn=!0):l.opts.smallBtn=!1),"pdf"===s&&(l.type="iframe",l.opts.iframe.preload=!1),l.opts.modal&&(l.opts=n.extend(!0,l.opts,{infobar:0,toolbar:0,smallBtn:0,keyboard:0,slideShow:0,fullScreen:0,thumbs:0,touch:0,clickContent:!1,clickSlide:!1,clickOutside:!1,dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1})),e.group.push(l)})},addEvents:function(){var o=this;o.removeEvents(),o.$refs.container.on("click.fb-close","[data-fancybox-close]",function(t){t.stopPropagation(),t.preventDefault(),o.close(t)}).on("click.fb-prev touchend.fb-prev","[data-fancybox-prev]",function(t){t.stopPropagation(),t.preventDefault(),o.previous()}).on("click.fb-next touchend.fb-next","[data-fancybox-next]",function(t){t.stopPropagation(),t.preventDefault(),o.next()}),s.on("orientationchange.fb resize.fb",function(t){t&&t.originalEvent&&"resize"===t.originalEvent.type?u(function(){o.update()}):(o.$refs.stage.hide(),setTimeout(function(){o.$refs.stage.show(),o.update()},500))}),r.on("focusin.fb",function(t){var i=n.fancybox?n.fancybox.getInstance():null;i.isClosing||!i.current||!i.current.opts.trapFocus||n(t.target).hasClass("fancybox-container")||n(t.target).is(e)||i&&"fixed"!==n(t.target).css("position")&&!i.$refs.container.has(t.target).length&&(t.stopPropagation(),i.focus(),s.scrollTop(o.scrollTop).scrollLeft(o.scrollLeft))}),r.on("keydown.fb",function(t){var e=o.current,i=t.keyCode||t.which;if(e&&e.opts.keyboard&&!n(t.target).is("input")&&!n(t.target).is("textarea"))return 8===i||27===i?(t.preventDefault(),void o.close(t)):37===i||38===i?(t.preventDefault(),void o.previous()):39===i||40===i?(t.preventDefault(),void o.next()):void o.trigger("afterKeydown",t,i)}),o.group[o.currIndex].opts.idleTime&&(o.idleSecondsCounter=0,r.on("mousemove.fb-idle mouseenter.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",function(){o.idleSecondsCounter=0,o.isIdle&&o.showControls(),o.isIdle=!1}),o.idleInterval=t.setInterval(function(){o.idleSecondsCounter++,o.idleSecondsCounter>=o.group[o.currIndex].opts.idleTime&&(o.isIdle=!0,o.idleSecondsCounter=0,o.hideControls())},1e3))},removeEvents:function(){var e=this;s.off("orientationchange.fb resize.fb"),r.off("focusin.fb keydown.fb .fb-idle"),this.$refs.container.off(".fb-close .fb-prev .fb-next"),e.idleInterval&&(t.clearInterval(e.idleInterval),e.idleInterval=null)},previous:function(t){return this.jumpTo(this.currPos-1,t)},next:function(t){return this.jumpTo(this.currPos+1,t)},jumpTo:function(t,e,i){var a,s,r,c,l,u,d,h=this,p=h.group.length;if(!(h.isSliding||h.isClosing||h.isAnimating&&h.firstRun)){if(t=parseInt(t,10),s=h.current?h.current.opts.loop:h.opts.loop,!s&&(t<0||t>=p))return!1;if(a=h.firstRun=null===h.firstRun,!(p<2&&!a&&h.isSliding)){if(c=h.current,h.prevIndex=h.currIndex,h.prevPos=h.currPos,r=h.createSlide(t),p>1&&((s||r.index>0)&&h.createSlide(t-1),(s||r.index<p-1)&&h.createSlide(t+1)),h.current=r,h.currIndex=r.index,h.currPos=r.pos,h.trigger("beforeShow",a),h.updateControls(),u=n.fancybox.getTranslate(r.$slide),r.isMoved=(0!==u.left||0!==u.top)&&!r.$slide.hasClass("fancybox-animated"),r.forcedDuration=o,n.isNumeric(e)?r.forcedDuration=e:e=r.opts[a?"animationDuration":"transitionDuration"],e=parseInt(e,10),a)return r.opts.animationEffect&&e&&h.$refs.container.css("transition-duration",e+"ms"),h.$refs.container.removeClass("fancybox-is-hidden"),f(h.$refs.container),h.$refs.container.addClass("fancybox-is-open"),r.$slide.addClass("fancybox-slide--current"),h.loadSlide(r),void h.preload();n.each(h.slides,function(t,e){n.fancybox.stop(e.$slide)}),r.$slide.removeClass("fancybox-slide--next fancybox-slide--previous").addClass("fancybox-slide--current"),r.isMoved?(l=Math.round(r.$slide.width()),n.each(h.slides,function(t,o){var i=o.pos-r.pos;n.fancybox.animate(o.$slide,{top:0,left:i*l+i*o.opts.gutter},e,function(){o.$slide.removeAttr("style").removeClass("fancybox-slide--next fancybox-slide--previous"),o.pos===h.currPos&&(r.isMoved=!1,h.complete())})})):h.$refs.stage.children().removeAttr("style"),r.isLoaded?h.revealContent(r):h.loadSlide(r),h.preload(),c.pos!==r.pos&&(d="fancybox-slide--"+(c.pos>r.pos?"next":"previous"),c.$slide.removeClass("fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous"),c.isComplete=!1,e&&(r.isMoved||r.opts.transitionEffect)&&(r.isMoved?c.$slide.addClass(d):(d="fancybox-animated "+d+" fancybox-fx-"+r.opts.transitionEffect,n.fancybox.animate(c.$slide,d,e,function(){c.$slide.removeClass(d).removeAttr("style")}))))}}},createSlide:function(t){var e,o,i=this;return o=t%i.group.length,o=o<0?i.group.length+o:o,!i.slides[t]&&i.group[o]&&(e=n('<div class="fancybox-slide"></div>').appendTo(i.$refs.stage),i.slides[t]=n.extend(!0,{},i.group[o],{pos:t,$slide:e,isLoaded:!1}),i.updateSlide(i.slides[t])),i.slides[t]},scaleToActual:function(t,e,i){var a,s,r,c,l,u=this,d=u.current,f=d.$content,h=parseInt(d.$slide.width(),10),p=parseInt(d.$slide.height(),10),g=d.width,b=d.height;"image"!=d.type||d.hasError||!f||u.isAnimating||(n.fancybox.stop(f),u.isAnimating=!0,t=t===o?.5*h:t,e=e===o?.5*p:e,a=n.fancybox.getTranslate(f),c=g/a.width,l=b/a.height,s=.5*h-.5*g,r=.5*p-.5*b,g>h&&(s=a.left*c-(t*c-t),s>0&&(s=0),s<h-g&&(s=h-g)),b>p&&(r=a.top*l-(e*l-e),r>0&&(r=0),r<p-b&&(r=p-b)),u.updateCursor(g,b),n.fancybox.animate(f,{top:r,left:s,scaleX:c,scaleY:l},i||330,function(){u.isAnimating=!1}),u.SlideShow&&u.SlideShow.isActive&&u.SlideShow.stop())},scaleToFit:function(t){var e,o=this,i=o.current,a=i.$content;"image"!=i.type||i.hasError||!a||o.isAnimating||(n.fancybox.stop(a),o.isAnimating=!0,e=o.getFitPos(i),o.updateCursor(e.width,e.height),n.fancybox.animate(a,{top:e.top,left:e.left,scaleX:e.width/a.width(),scaleY:e.height/a.height()},t||330,function(){o.isAnimating=!1}))},getFitPos:function(t){var e,o,i,a,r,c=this,l=t.$content,u=t.width,d=t.height,f=t.opts.margin;return!(!l||!l.length||!u&&!d)&&("number"===n.type(f)&&(f=[f,f]),2==f.length&&(f=[f[0],f[1],f[0],f[1]]),s.width()<800&&(f=[0,0,0,0]),e=parseInt(c.$refs.stage.width(),10)-(f[1]+f[3]),o=parseInt(c.$refs.stage.height(),10)-(f[0]+f[2]),i=Math.min(1,e/u,o/d),a=Math.floor(i*u),r=Math.floor(i*d),{top:Math.floor(.5*(o-r))+f[0],left:Math.floor(.5*(e-a))+f[3],width:a,height:r})},update:function(){var t=this;n.each(t.slides,function(e,n){t.updateSlide(n)})},updateSlide:function(t){var e=this,o=t.$content;o&&(t.width||t.height)&&(n.fancybox.stop(o),n.fancybox.setTranslate(o,e.getFitPos(t)),t.pos===e.currPos&&e.updateCursor()),t.$slide.trigger("refresh"),e.trigger("onUpdate",t)},updateCursor:function(t,e){var n,i=this,a=i.$refs.container.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-drag fancybox-can-zoomOut");i.current&&!i.isClosing&&(i.isZoomable()?(a.addClass("fancybox-is-zoomable"),n=t!==o&&e!==o?t<i.current.width&&e<i.current.height:i.isScaledDown(),n?a.addClass("fancybox-can-zoomIn"):i.current.opts.touch?a.addClass("fancybox-can-drag"):a.addClass("fancybox-can-zoomOut")):i.current.opts.touch&&a.addClass("fancybox-can-drag"))},isZoomable:function(){var t,e=this,o=e.current;if(o&&!e.isClosing)return!!("image"===o.type&&o.isLoaded&&!o.hasError&&("zoom"===o.opts.clickContent||n.isFunction(o.opts.clickContent)&&"zoom"===o.opts.clickContent(o))&&(t=e.getFitPos(o),o.width>t.width||o.height>t.height))},isScaledDown:function(){var t=this,e=t.current,o=e.$content,i=!1;return o&&(i=n.fancybox.getTranslate(o),i=i.width<e.width||i.height<e.height),i},canPan:function(){var t=this,e=t.current,n=e.$content,o=!1;return n&&(o=t.getFitPos(e),o=Math.abs(n.width()-o.width)>1||Math.abs(n.height()-o.height)>1),o},loadSlide:function(t){var e,o,i,a=this;if(!t.isLoading&&!t.isLoaded){switch(t.isLoading=!0,a.trigger("beforeLoad",t),e=t.type,o=t.$slide,o.off("refresh").trigger("onReset").addClass("fancybox-slide--"+(e||"unknown")).addClass(t.opts.slideClass),e){case"image":a.setImage(t);break;case"iframe":a.setIframe(t);break;case"html":a.setContent(t,t.src||t.content);break;case"inline":n(t.src).length?a.setContent(t,n(t.src)):a.setError(t);break;case"ajax":a.showLoading(t),i=n.ajax(n.extend({},t.opts.ajax.settings,{url:t.src,success:function(e,n){"success"===n&&a.setContent(t,e)},error:function(e,n){e&&"abort"!==n&&a.setError(t)}})),o.one("onReset",function(){i.abort()});break;default:a.setError(t)}return!0}},setImage:function(e){var o,i,a,s,r=this,c=e.opts.image.srcset;if(c){a=t.devicePixelRatio||1,s=t.innerWidth*a,i=c.split(",").map(function(t){var e={};return t.trim().split(/\s+/).forEach(function(t,n){var o=parseInt(t.substring(0,t.length-1),10);return 0===n?e.url=t:void(o&&(e.value=o,e.postfix=t[t.length-1]))}),e}),i.sort(function(t,e){return t.value-e.value});for(var l=0;l<i.length;l++){var u=i[l];if("w"===u.postfix&&u.value>=s||"x"===u.postfix&&u.value>=a){o=u;break}}!o&&i.length&&(o=i[i.length-1]),o&&(e.src=o.url,e.width&&e.height&&"w"==o.postfix&&(e.height=e.width/e.height*o.value,e.width=o.value))}e.$content=n('<div class="fancybox-image-wrap"></div>').addClass("fancybox-is-hidden").appendTo(e.$slide),e.opts.preload!==!1&&e.opts.width&&e.opts.height&&(e.opts.thumb||e.opts.$thumb)?(e.width=e.opts.width,e.height=e.opts.height,e.$ghost=n("<img />").one("error",function(){n(this).remove(),e.$ghost=null,r.setBigImage(e)}).one("load",function(){r.afterLoad(e),r.setBigImage(e)}).addClass("fancybox-image").appendTo(e.$content).attr("src",e.opts.thumb||e.opts.$thumb.attr("src"))):r.setBigImage(e)},setBigImage:function(t){var e=this,o=n("<img />");t.$image=o.one("error",function(){e.setError(t)}).one("load",function(){clearTimeout(t.timouts),t.timouts=null,e.isClosing||(t.width=this.naturalWidth,t.height=this.naturalHeight,t.opts.image.srcset&&o.attr("sizes","100vw").attr("srcset",t.opts.image.srcset),e.hideLoading(t),t.$ghost?t.timouts=setTimeout(function(){t.timouts=null,t.$ghost.hide()},Math.min(300,Math.max(1e3,t.height/1600))):e.afterLoad(t))}).addClass("fancybox-image").attr("src",t.src).appendTo(t.$content),o[0].complete?o.trigger("load"):o[0].error?o.trigger("error"):t.timouts=setTimeout(function(){o[0].complete||t.hasError||e.showLoading(t)},100)},setIframe:function(t){var e,i=this,a=t.opts.iframe,s=t.$slide;t.$content=n('<div class="fancybox-content'+(a.preload?" fancybox-is-hidden":"")+'"></div>').css(a.css).appendTo(s),e=n(a.tpl.replace(/\{rnd\}/g,(new Date).getTime())).attr(a.attr).appendTo(t.$content),a.preload?(i.showLoading(t),e.on("load.fb error.fb",function(e){this.isReady=1,t.$slide.trigger("refresh"),i.afterLoad(t)}),s.on("refresh.fb",function(){var n,i,s,r,c,l=t.$content;if(1===e[0].isReady){try{n=e.contents(),i=n.find("body")}catch(t){}i&&i.length&&(a.css.width===o||a.css.height===o)&&(s=e[0].contentWindow.document.documentElement.scrollWidth,r=Math.ceil(i.outerWidth(!0)+(l.width()-s)),c=Math.ceil(i.outerHeight(!0)),l.css({width:a.css.width===o?r+(l.outerWidth()-l.innerWidth()):a.css.width,height:a.css.height===o?c+(l.outerHeight()-l.innerHeight()):a.css.height})),l.removeClass("fancybox-is-hidden")}})):this.afterLoad(t),e.attr("src",t.src),t.opts.smallBtn===!0&&t.$content.prepend(i.translate(t,t.opts.btnTpl.smallBtn)),s.one("onReset",function(){try{n(this).find("iframe").hide().attr("src","//about:blank")}catch(t){}n(this).empty(),t.isLoaded=!1})},setContent:function(t,e){var o=this;o.isClosing||(o.hideLoading(t),t.$slide.empty(),l(e)&&e.parent().length?(e.parent(".fancybox-slide--inline").trigger("onReset"),t.$placeholder=n("<div></div>").hide().insertAfter(e),e.css("display","inline-block")):t.hasError||("string"===n.type(e)&&(e=n("<div>").append(n.trim(e)).contents(),3===e[0].nodeType&&(e=n("<div>").html(e))),t.opts.filter&&(e=n("<div>").html(e).find(t.opts.filter))),t.$slide.one("onReset",function(){t.$placeholder&&(t.$placeholder.after(e.hide()).remove(),t.$placeholder=null),t.$smallBtn&&(t.$smallBtn.remove(),t.$smallBtn=null),t.hasError||(n(this).empty(),t.isLoaded=!1)}),t.$content=n(e).appendTo(t.$slide),t.opts.smallBtn&&!t.$smallBtn&&(t.$smallBtn=n(o.translate(t,t.opts.btnTpl.smallBtn)).appendTo(t.$content.filter("div").first())),this.afterLoad(t))},setError:function(t){t.hasError=!0,t.$slide.removeClass("fancybox-slide--"+t.type),this.setContent(t,this.translate(t,t.opts.errorTpl))},showLoading:function(t){var e=this;t=t||e.current,t&&!t.$spinner&&(t.$spinner=n(e.opts.spinnerTpl).appendTo(t.$slide))},hideLoading:function(t){var e=this;t=t||e.current,t&&t.$spinner&&(t.$spinner.remove(),delete t.$spinner)},afterLoad:function(t){var e=this;e.isClosing||(t.isLoading=!1,t.isLoaded=!0,e.trigger("afterLoad",t),e.hideLoading(t),t.opts.protect&&t.$content&&!t.hasError&&(t.$content.on("contextmenu.fb",function(t){return 2==t.button&&t.preventDefault(),!0}),"image"===t.type&&n('<div class="fancybox-spaceball"></div>').appendTo(t.$content)),e.revealContent(t))},revealContent:function(t){var e,i,a,s,r,c=this,l=t.$slide,u=!1;return e=t.opts[c.firstRun?"animationEffect":"transitionEffect"],a=t.opts[c.firstRun?"animationDuration":"transitionDuration"],a=parseInt(t.forcedDuration===o?a:t.forcedDuration,10),!t.isMoved&&t.pos===c.currPos&&a||(e=!1),"zoom"!==e||t.pos===c.currPos&&a&&"image"===t.type&&!t.hasError&&(u=c.getThumbPos(t))||(e="fade"),"zoom"===e?(r=c.getFitPos(t),r.scaleX=r.width/u.width,r.scaleY=r.height/u.height,delete r.width,delete r.height,s=t.opts.zoomOpacity,"auto"==s&&(s=Math.abs(t.width/t.height-u.width/u.height)>.1),s&&(u.opacity=.1,r.opacity=1),n.fancybox.setTranslate(t.$content.removeClass("fancybox-is-hidden"),u),f(t.$content),void n.fancybox.animate(t.$content,r,a,function(){c.complete()})):(c.updateSlide(t),e?(n.fancybox.stop(l),i="fancybox-animated fancybox-slide--"+(t.pos>c.prevPos?"next":"previous")+" fancybox-fx-"+e,l.removeAttr("style").removeClass("fancybox-slide--current fancybox-slide--next fancybox-slide--previous").addClass(i),t.$content.removeClass("fancybox-is-hidden"),f(l),void n.fancybox.animate(l,"fancybox-slide--current",a,function(e){l.removeClass(i).removeAttr("style"),t.pos===c.currPos&&c.complete()},!0)):(f(l),t.$content.removeClass("fancybox-is-hidden"),void(t.pos===c.currPos&&c.complete())))},getThumbPos:function(o){var i,a=this,s=!1,r=function(e){for(var o,i=e[0],a=i.getBoundingClientRect(),s=[];null!==i.parentElement;)"hidden"!==n(i.parentElement).css("overflow")&&"auto"!==n(i.parentElement).css("overflow")||s.push(i.parentElement.getBoundingClientRect()),i=i.parentElement;return o=s.every(function(t){var e=Math.min(a.right,t.right)-Math.max(a.left,t.left),n=Math.min(a.bottom,t.bottom)-Math.max(a.top,t.top);return e>0&&n>0}),o&&a.bottom>0&&a.right>0&&a.left<n(t).width()&&a.top<n(t).height()},c=o.opts.$thumb,l=c?c.offset():0;return l&&c[0].ownerDocument===e&&r(c)&&(i=a.$refs.stage.offset(),s={top:l.top-i.top+parseFloat(c.css("border-top-width")||0),left:l.left-i.left+parseFloat(c.css("border-left-width")||0),width:c.width(),height:c.height(),scaleX:1,scaleY:1}),s},complete:function(){var t=this,o=t.current,i={};o.isMoved||!o.isLoaded||o.isComplete||(o.isComplete=!0,o.$slide.siblings().trigger("onReset"),f(o.$slide),o.$slide.addClass("fancybox-slide--complete"),n.each(t.slides,function(e,o){o.pos>=t.currPos-1&&o.pos<=t.currPos+1?i[o.pos]=o:o&&(n.fancybox.stop(o.$slide),o.$slide.unbind().remove())}),t.slides=i,t.updateCursor(),t.trigger("afterShow"),(n(e.activeElement).is("[disabled]")||o.opts.autoFocus&&"image"!=o.type&&"iframe"!==o.type)&&t.focus())},preload:function(){var t,e,n=this;n.group.length<2||(t=n.slides[n.currPos+1],e=n.slides[n.currPos-1],t&&"image"===t.type&&n.loadSlide(t),e&&"image"===e.type&&n.loadSlide(e))},focus:function(){var t,e=this.current;this.isClosing||(t=e&&e.isComplete?e.$slide.find("button,:input,[tabindex],a").filter(":not([disabled]):visible:first"):null,t=t&&t.length?t:this.$refs.container,t.focus())},activate:function(){var t=this;n(".fancybox-container").each(function(){var e=n(this).data("FancyBox");e&&e.uid!==t.uid&&!e.isClosing&&e.trigger("onDeactivate")}),t.current&&(t.$refs.container.index()>0&&t.$refs.container.prependTo(e.body),t.updateControls()),t.trigger("onActivate"),t.addEvents()},close:function(t,e){var o,i,a,s,r,c,l=this,f=l.current,h=function(){l.cleanUp(t)};return!l.isClosing&&(l.isClosing=!0,l.trigger("beforeClose",t)===!1?(l.isClosing=!1,u(function(){l.update()}),!1):(l.removeEvents(),f.timouts&&clearTimeout(f.timouts),a=f.$content,o=f.opts.animationEffect,i=n.isNumeric(e)?e:o?f.opts.animationDuration:0,f.$slide.off(d).removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated"),f.$slide.siblings().trigger("onReset").remove(),i&&l.$refs.container.removeClass("fancybox-is-open").addClass("fancybox-is-closing"),l.hideLoading(f),l.hideControls(),l.updateCursor(),"zoom"!==o||t!==!0&&a&&i&&"image"===f.type&&!f.hasError&&(c=l.getThumbPos(f))||(o="fade"),"zoom"===o?(n.fancybox.stop(a),r=n.fancybox.getTranslate(a),r.width=r.width*r.scaleX,r.height=r.height*r.scaleY,s=f.opts.zoomOpacity,"auto"==s&&(s=Math.abs(f.width/f.height-c.width/c.height)>.1),s&&(c.opacity=0),r.scaleX=r.width/c.width,r.scaleY=r.height/c.height,r.width=c.width,r.height=c.height,n.fancybox.setTranslate(f.$content,r),n.fancybox.animate(f.$content,c,i,h),!0):(o&&i?t===!0?setTimeout(h,i):n.fancybox.animate(f.$slide.removeClass("fancybox-slide--current"),"fancybox-animated fancybox-slide--previous fancybox-fx-"+o,i,h):h(),!0)))},cleanUp:function(t){var e,o=this;o.current.$slide.trigger("onReset"),o.$refs.container.empty().remove(),o.trigger("afterClose",t),o.$lastFocus&&o.current.opts.backFocus&&o.$lastFocus.focus(),o.current=null,e=n.fancybox.getInstance(),e?e.activate():(s.scrollTop(o.scrollTop).scrollLeft(o.scrollLeft),n("html").removeClass("fancybox-enabled"),n("#fancybox-style-noscroll").remove())},trigger:function(t,e){var o,i=Array.prototype.slice.call(arguments,1),a=this,s=e&&e.opts?e:a.current;return s?i.unshift(s):s=a,i.unshift(a),n.isFunction(s.opts[t])&&(o=s.opts[t].apply(s,i)),o===!1?o:void("afterClose"===t?r.trigger(t+".fb",i):a.$refs.container.trigger(t+".fb",i))},updateControls:function(t){var e=this,o=e.current,i=o.index,a=o.opts,s=a.caption,r=e.$refs.caption;o.$slide.trigger("refresh"),e.$caption=s&&s.length?r.html(s):null,e.isHiddenControls||e.showControls(),n("[data-fancybox-count]").html(e.group.length),n("[data-fancybox-index]").html(i+1),n("[data-fancybox-prev]").prop("disabled",!a.loop&&i<=0),n("[data-fancybox-next]").prop("disabled",!a.loop&&i>=e.group.length-1)},hideControls:function(){this.isHiddenControls=!0,this.$refs.container.removeClass("fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav")},showControls:function(){var t=this,e=t.current?t.current.opts:t.opts,n=t.$refs.container;t.isHiddenControls=!1,t.idleSecondsCounter=0,n.toggleClass("fancybox-show-toolbar",!(!e.toolbar||!e.buttons)).toggleClass("fancybox-show-infobar",!!(e.infobar&&t.group.length>1)).toggleClass("fancybox-show-nav",!!(e.arrows&&t.group.length>1)).toggleClass("fancybox-is-modal",!!e.modal),t.$caption?n.addClass("fancybox-show-caption "):n.removeClass("fancybox-show-caption")},toggleControls:function(){this.isHiddenControls?this.showControls():this.hideControls()}}),n.fancybox={version:"3.1.25",defaults:a,getInstance:function(t){var e=n('.fancybox-container:not(".fancybox-is-closing"):first').data("FancyBox"),o=Array.prototype.slice.call(arguments,1);return e instanceof h&&("string"===n.type(t)?e[t].apply(e,o):"function"===n.type(t)&&t.apply(e,o),e)},open:function(t,e,n){return new h(t,e,n)},close:function(t){var e=this.getInstance();e&&(e.close(),t===!0&&this.close())},destroy:function(){this.close(!0),r.off("click.fb-start")},isMobile:e.createTouch!==o&&/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent),use3d:function(){var n=e.createElement("div");return t.getComputedStyle&&t.getComputedStyle(n).getPropertyValue("transform")&&!(e.documentMode&&e.documentMode<11)}(),getTranslate:function(t){var e;if(!t||!t.length)return!1;if(e=t.eq(0).css("transform"),e&&e.indexOf("matrix")!==-1?(e=e.split("(")[1],e=e.split(")")[0],e=e.split(",")):e=[],e.length)e=e.length>10?[e[13],e[12],e[0],e[5]]:[e[5],e[4],e[0],e[3]],e=e.map(parseFloat);else{e=[0,0,1,1];var n=/\.*translate\((.*)px,(.*)px\)/i,o=n.exec(t.eq(0).attr("style"));o&&(e[0]=parseFloat(o[2]),e[1]=parseFloat(o[1]))}return{top:e[0],left:e[1],scaleX:e[2],scaleY:e[3],opacity:parseFloat(t.css("opacity")),width:t.width(),height:t.height()}},setTranslate:function(t,e){var n="",i={};if(t&&e)return e.left===o&&e.top===o||(n=(e.left===o?t.position().left:e.left)+"px, "+(e.top===o?t.position().top:e.top)+"px",n=this.use3d?"translate3d("+n+", 0px)":"translate("+n+")"),e.scaleX!==o&&e.scaleY!==o&&(n=(n.length?n+" ":"")+"scale("+e.scaleX+", "+e.scaleY+")"),n.length&&(i.transform=n),e.opacity!==o&&(i.opacity=e.opacity),e.width!==o&&(i.width=e.width),e.height!==o&&(i.height=e.height),t.css(i)},animate:function(t,e,i,a,s){var r=d||"transitionend";n.isFunction(i)&&(a=i,i=null),n.isPlainObject(e)||t.removeAttr("style"),t.on(r,function(i){(!i||!i.originalEvent||t.is(i.originalEvent.target)&&"z-index"!=i.originalEvent.propertyName)&&(t.off(r),n.isPlainObject(e)?e.scaleX!==o&&e.scaleY!==o&&(t.css("transition-duration","0ms"),e.width=Math.round(t.width()*e.scaleX),e.height=Math.round(t.height()*e.scaleY),e.scaleX=1,e.scaleY=1,n.fancybox.setTranslate(t,e)):s!==!0&&t.removeClass(e),n.isFunction(a)&&a(i))}),n.isNumeric(i)&&t.css("transition-duration",i+"ms"),n.isPlainObject(e)?n.fancybox.setTranslate(t,e):t.addClass(e),t.data("timer",setTimeout(function(){t.trigger("transitionend")},i+16))},stop:function(t){clearTimeout(t.data("timer")),t.off(d)}},n.fn.fancybox=function(t){var e;return t=t||{},e=t.selector||!1,e?n("body").off("click.fb-start",e).on("click.fb-start",e,{options:t},i):this.off("click.fb-start").on("click.fb-start",{items:this,options:t},i),this},r.on("click.fb-start","[data-fancybox]",i)}}(window,document,window.jQuery||jQuery),function(t){"use strict";var e=function(e,n,o){if(e)return o=o||"","object"===t.type(o)&&(o=t.param(o,!0)),t.each(n,function(t,n){e=e.replace("$"+t,n||"")}),o.length&&(e+=(e.indexOf("?")>0?"&":"?")+o),e},n={youtube:{matcher:/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramPlace:8,type:"iframe",url:"//www.youtube.com/embed/$4",thumb:"//img.youtube.com/vi/$4/hqdefault.jpg"},vimeo:{matcher:/^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1,api:1},paramPlace:3,type:"iframe",url:"//player.vimeo.com/video/$2"},metacafe:{matcher:/metacafe.com\/watch\/(\d+)\/(.*)?/,type:"iframe",url:"//www.metacafe.com/embed/$1/?ap=1"},dailymotion:{matcher:/dailymotion.com\/video\/(.*)\/?(.*)/,params:{additionalInfos:0,autoStart:1},type:"iframe",url:"//www.dailymotion.com/embed/video/$1"},vine:{matcher:/vine.co\/v\/([a-zA-Z0-9\?\=\-]+)/,type:"iframe",url:"//vine.co/v/$1/embed/simple"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},gmap_place:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/?ll="+(t[9]?t[9]+"&z="+Math.floor(t[10])+(t[12]?t[12].replace(/^\//,"&"):""):t[12])+"&output="+(t[12]&&t[12].indexOf("layer=c")>0?"svembed":"embed")}},gmap_search:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/maps?q="+t[5].replace("query=","q=").replace("api=1","")+"&output=embed"}}};t(document).on("onInit.fb",function(o,i){t.each(i.group,function(o,i){var a,s,r,c,l,u,d,f=i.src||"",h=!1;i.type||(a=t.extend(!0,{},n,i.opts.media),t.each(a,function(n,o){if(r=f.match(o.matcher),u={},d=n,r){if(h=o.type,o.paramPlace&&r[o.paramPlace]){l=r[o.paramPlace],"?"==l[0]&&(l=l.substring(1)),l=l.split("&");for(var a=0;a<l.length;++a){var p=l[a].split("=",2);2==p.length&&(u[p[0]]=decodeURIComponent(p[1].replace(/\+/g," ")))}}return c=t.extend(!0,{},o.params,i.opts[n],u),f="function"===t.type(o.url)?o.url.call(this,r,c,i):e(o.url,r,c),s="function"===t.type(o.thumb)?o.thumb.call(this,r,c,i):e(o.thumb,r),"vimeo"===d&&(f=f.replace("&%23","#")),!1}}),h?(i.src=f,i.type=h,i.opts.thumb||i.opts.$thumb&&i.opts.$thumb.length||(i.opts.thumb=s),"iframe"===h&&(t.extend(!0,i.opts,{iframe:{preload:!1,attr:{scrolling:"no"
}}}),i.contentProvider=d,i.opts.slideClass+=" fancybox-slide--"+("gmap_place"==d||"gmap_search"==d?"map":"video"))):i.type="image")})})}(window.jQuery),function(t,e,n){"use strict";var o=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),i=function(){return t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.mozCancelAnimationFrame||t.oCancelAnimationFrame||function(e){t.clearTimeout(e)}}(),a=function(e){var n=[];e=e.originalEvent||e||t.e,e=e.touches&&e.touches.length?e.touches:e.changedTouches&&e.changedTouches.length?e.changedTouches:[e];for(var o in e)e[o].pageX?n.push({x:e[o].pageX,y:e[o].pageY}):e[o].clientX&&n.push({x:e[o].clientX,y:e[o].clientY});return n},s=function(t,e,n){return e&&t?"x"===n?t.x-e.x:"y"===n?t.y-e.y:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)):0},r=function(t){if(t.is("a,button,input,select,textarea")||n.isFunction(t.get(0).onclick)||t.data("selectable"))return!0;for(var e=0,o=t[0].attributes,i=o.length;e<i;e++)if("data-fancybox-"===o[e].nodeName.substr(0,14))return!0;return!1},c=function(e){var n=t.getComputedStyle(e)["overflow-y"],o=t.getComputedStyle(e)["overflow-x"],i=("scroll"===n||"auto"===n)&&e.scrollHeight>e.clientHeight,a=("scroll"===o||"auto"===o)&&e.scrollWidth>e.clientWidth;return i||a},l=function(t){for(var e=!1;;){if(e=c(t.get(0)))break;if(t=t.parent(),!t.length||t.hasClass("fancybox-stage")||t.is("body"))break}return e},u=function(t){var e=this;e.instance=t,e.$bg=t.$refs.bg,e.$stage=t.$refs.stage,e.$container=t.$refs.container,e.destroy(),e.$container.on("touchstart.fb.touch mousedown.fb.touch",n.proxy(e,"ontouchstart"))};u.prototype.destroy=function(){this.$container.off(".fb.touch")},u.prototype.ontouchstart=function(o){var i=this,c=n(o.target),u=i.instance,d=u.current,f=d.$content,h="touchstart"==o.type;if(h&&i.$container.off("mousedown.fb.touch"),!d||i.instance.isAnimating||i.instance.isClosing)return o.stopPropagation(),void o.preventDefault();if((!o.originalEvent||2!=o.originalEvent.button)&&c.length&&!r(c)&&!r(c.parent())&&!(o.originalEvent.clientX>c[0].clientWidth+c.offset().left)&&(i.startPoints=a(o),i.startPoints&&!(i.startPoints.length>1&&u.isSliding))){if(i.$target=c,i.$content=f,i.canTap=!0,n(e).off(".fb.touch"),n(e).on(h?"touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch",n.proxy(i,"ontouchend")),n(e).on(h?"touchmove.fb.touch":"mousemove.fb.touch",n.proxy(i,"ontouchmove")),!u.current.opts.touch&&!u.canPan()||!c.is(i.$stage)&&!i.$stage.find(c).length)return void(c.is("img")&&o.preventDefault());o.stopPropagation(),n.fancybox.isMobile&&(l(i.$target)||l(i.$target.parent()))||o.preventDefault(),i.canvasWidth=Math.round(d.$slide[0].clientWidth),i.canvasHeight=Math.round(d.$slide[0].clientHeight),i.startTime=(new Date).getTime(),i.distanceX=i.distanceY=i.distance=0,i.isPanning=!1,i.isSwiping=!1,i.isZooming=!1,i.sliderStartPos=i.sliderLastPos||{top:0,left:0},i.contentStartPos=n.fancybox.getTranslate(i.$content),i.contentLastPos=null,1!==i.startPoints.length||i.isZooming||(i.canTap=!u.isSliding,"image"===d.type&&(i.contentStartPos.width>i.canvasWidth+1||i.contentStartPos.height>i.canvasHeight+1)?(n.fancybox.stop(i.$content),i.$content.css("transition-duration","0ms"),i.isPanning=!0):i.isSwiping=!0,i.$container.addClass("fancybox-controls--isGrabbing")),2!==i.startPoints.length||u.isAnimating||d.hasError||"image"!==d.type||!d.isLoaded&&!d.$ghost||(i.isZooming=!0,i.isSwiping=!1,i.isPanning=!1,n.fancybox.stop(i.$content),i.$content.css("transition-duration","0ms"),i.centerPointStartX=.5*(i.startPoints[0].x+i.startPoints[1].x)-n(t).scrollLeft(),i.centerPointStartY=.5*(i.startPoints[0].y+i.startPoints[1].y)-n(t).scrollTop(),i.percentageOfImageAtPinchPointX=(i.centerPointStartX-i.contentStartPos.left)/i.contentStartPos.width,i.percentageOfImageAtPinchPointY=(i.centerPointStartY-i.contentStartPos.top)/i.contentStartPos.height,i.startDistanceBetweenFingers=s(i.startPoints[0],i.startPoints[1]))}},u.prototype.ontouchmove=function(t){var e=this;if(e.newPoints=a(t),n.fancybox.isMobile&&(l(e.$target)||l(e.$target.parent())))return t.stopPropagation(),void(e.canTap=!1);if((e.instance.current.opts.touch||e.instance.canPan())&&e.newPoints&&e.newPoints.length&&(e.distanceX=s(e.newPoints[0],e.startPoints[0],"x"),e.distanceY=s(e.newPoints[0],e.startPoints[0],"y"),e.distance=s(e.newPoints[0],e.startPoints[0]),e.distance>0)){if(!e.$target.is(e.$stage)&&!e.$stage.find(e.$target).length)return;t.stopPropagation(),t.preventDefault(),e.isSwiping?e.onSwipe():e.isPanning?e.onPan():e.isZooming&&e.onZoom()}},u.prototype.onSwipe=function(){var e,a=this,s=a.isSwiping,r=a.sliderStartPos.left||0;s===!0?Math.abs(a.distance)>10&&(a.canTap=!1,a.instance.group.length<2&&a.instance.opts.touch.vertical?a.isSwiping="y":a.instance.isSliding||a.instance.opts.touch.vertical===!1||"auto"===a.instance.opts.touch.vertical&&n(t).width()>800?a.isSwiping="x":(e=Math.abs(180*Math.atan2(a.distanceY,a.distanceX)/Math.PI),a.isSwiping=e>45&&e<135?"y":"x"),a.instance.isSliding=a.isSwiping,a.startPoints=a.newPoints,n.each(a.instance.slides,function(t,e){n.fancybox.stop(e.$slide),e.$slide.css("transition-duration","0ms"),e.inTransition=!1,e.pos===a.instance.current.pos&&(a.sliderStartPos.left=n.fancybox.getTranslate(e.$slide).left)}),a.instance.SlideShow&&a.instance.SlideShow.isActive&&a.instance.SlideShow.stop()):("x"==s&&(a.distanceX>0&&(a.instance.group.length<2||0===a.instance.current.index&&!a.instance.current.opts.loop)?r+=Math.pow(a.distanceX,.8):a.distanceX<0&&(a.instance.group.length<2||a.instance.current.index===a.instance.group.length-1&&!a.instance.current.opts.loop)?r-=Math.pow(-a.distanceX,.8):r+=a.distanceX),a.sliderLastPos={top:"x"==s?0:a.sliderStartPos.top+a.distanceY,left:r},a.requestId&&(i(a.requestId),a.requestId=null),a.requestId=o(function(){a.sliderLastPos&&(n.each(a.instance.slides,function(t,e){var o=e.pos-a.instance.currPos;n.fancybox.setTranslate(e.$slide,{top:a.sliderLastPos.top,left:a.sliderLastPos.left+o*a.canvasWidth+o*e.opts.gutter})}),a.$container.addClass("fancybox-is-sliding"))}))},u.prototype.onPan=function(){var t,e,a,s=this;s.canTap=!1,t=s.contentStartPos.width>s.canvasWidth?s.contentStartPos.left+s.distanceX:s.contentStartPos.left,e=s.contentStartPos.top+s.distanceY,a=s.limitMovement(t,e,s.contentStartPos.width,s.contentStartPos.height),a.scaleX=s.contentStartPos.scaleX,a.scaleY=s.contentStartPos.scaleY,s.contentLastPos=a,s.requestId&&(i(s.requestId),s.requestId=null),s.requestId=o(function(){n.fancybox.setTranslate(s.$content,s.contentLastPos)})},u.prototype.limitMovement=function(t,e,n,o){var i,a,s,r,c=this,l=c.canvasWidth,u=c.canvasHeight,d=c.contentStartPos.left,f=c.contentStartPos.top,h=c.distanceX,p=c.distanceY;return i=Math.max(0,.5*l-.5*n),a=Math.max(0,.5*u-.5*o),s=Math.min(l-n,.5*l-.5*n),r=Math.min(u-o,.5*u-.5*o),n>l&&(h>0&&t>i&&(t=i-1+Math.pow(-i+d+h,.8)||0),h<0&&t<s&&(t=s+1-Math.pow(s-d-h,.8)||0)),o>u&&(p>0&&e>a&&(e=a-1+Math.pow(-a+f+p,.8)||0),p<0&&e<r&&(e=r+1-Math.pow(r-f-p,.8)||0)),{top:e,left:t}},u.prototype.limitPosition=function(t,e,n,o){var i=this,a=i.canvasWidth,s=i.canvasHeight;return n>a?(t=t>0?0:t,t=t<a-n?a-n:t):t=Math.max(0,a/2-n/2),o>s?(e=e>0?0:e,e=e<s-o?s-o:e):e=Math.max(0,s/2-o/2),{top:e,left:t}},u.prototype.onZoom=function(){var e=this,a=e.contentStartPos.width,r=e.contentStartPos.height,c=e.contentStartPos.left,l=e.contentStartPos.top,u=s(e.newPoints[0],e.newPoints[1]),d=u/e.startDistanceBetweenFingers,f=Math.floor(a*d),h=Math.floor(r*d),p=(a-f)*e.percentageOfImageAtPinchPointX,g=(r-h)*e.percentageOfImageAtPinchPointY,b=(e.newPoints[0].x+e.newPoints[1].x)/2-n(t).scrollLeft(),m=(e.newPoints[0].y+e.newPoints[1].y)/2-n(t).scrollTop(),y=b-e.centerPointStartX,v=m-e.centerPointStartY,x=c+(p+y),w=l+(g+v),$={top:w,left:x,scaleX:e.contentStartPos.scaleX*d,scaleY:e.contentStartPos.scaleY*d};e.canTap=!1,e.newWidth=f,e.newHeight=h,e.contentLastPos=$,e.requestId&&(i(e.requestId),e.requestId=null),e.requestId=o(function(){n.fancybox.setTranslate(e.$content,e.contentLastPos)})},u.prototype.ontouchend=function(t){var o=this,s=Math.max((new Date).getTime()-o.startTime,1),r=o.isSwiping,c=o.isPanning,l=o.isZooming;return o.endPoints=a(t),o.$container.removeClass("fancybox-controls--isGrabbing"),n(e).off(".fb.touch"),o.requestId&&(i(o.requestId),o.requestId=null),o.isSwiping=!1,o.isPanning=!1,o.isZooming=!1,o.canTap?o.onTap(t):(o.speed=366,o.velocityX=o.distanceX/s*.5,o.velocityY=o.distanceY/s*.5,o.speedX=Math.max(.5*o.speed,Math.min(1.5*o.speed,1/Math.abs(o.velocityX)*o.speed)),void(c?o.endPanning():l?o.endZooming():o.endSwiping(r)))},u.prototype.endSwiping=function(t){var e=this,o=!1;e.instance.isSliding=!1,e.sliderLastPos=null,"y"==t&&Math.abs(e.distanceY)>50?(n.fancybox.animate(e.instance.current.$slide,{top:e.sliderStartPos.top+e.distanceY+150*e.velocityY,opacity:0},150),o=e.instance.close(!0,300)):"x"==t&&e.distanceX>50&&e.instance.group.length>1?o=e.instance.previous(e.speedX):"x"==t&&e.distanceX<-50&&e.instance.group.length>1&&(o=e.instance.next(e.speedX)),o!==!1||"x"!=t&&"y"!=t||e.instance.jumpTo(e.instance.current.index,150),e.$container.removeClass("fancybox-is-sliding")},u.prototype.endPanning=function(){var t,e,o,i=this;i.contentLastPos&&(i.instance.current.opts.touch.momentum===!1?(t=i.contentLastPos.left,e=i.contentLastPos.top):(t=i.contentLastPos.left+i.velocityX*i.speed,e=i.contentLastPos.top+i.velocityY*i.speed),o=i.limitPosition(t,e,i.contentStartPos.width,i.contentStartPos.height),o.width=i.contentStartPos.width,o.height=i.contentStartPos.height,n.fancybox.animate(i.$content,o,330))},u.prototype.endZooming=function(){var t,e,o,i,a=this,s=a.instance.current,r=a.newWidth,c=a.newHeight;a.contentLastPos&&(t=a.contentLastPos.left,e=a.contentLastPos.top,i={top:e,left:t,width:r,height:c,scaleX:1,scaleY:1},n.fancybox.setTranslate(a.$content,i),r<a.canvasWidth&&c<a.canvasHeight?a.instance.scaleToFit(150):r>s.width||c>s.height?a.instance.scaleToActual(a.centerPointStartX,a.centerPointStartY,150):(o=a.limitPosition(t,e,r,c),n.fancybox.setTranslate(a.content,n.fancybox.getTranslate(a.$content)),n.fancybox.animate(a.$content,o,150)))},u.prototype.onTap=function(t){var e,o=this,i=n(t.target),s=o.instance,r=s.current,c=t&&a(t)||o.startPoints,l=c[0]?c[0].x-o.$stage.offset().left:0,u=c[0]?c[0].y-o.$stage.offset().top:0,d=function(e){var i=r.opts[e];if(n.isFunction(i)&&(i=i.apply(s,[r,t])),i)switch(i){case"close":s.close(o.startEvent);break;case"toggleControls":s.toggleControls(!0);break;case"next":s.next();break;case"nextOrClose":s.group.length>1?s.next():s.close(o.startEvent);break;case"zoom":"image"==r.type&&(r.isLoaded||r.$ghost)&&(s.canPan()?s.scaleToFit():s.isScaledDown()?s.scaleToActual(l,u):s.group.length<2&&s.close(o.startEvent))}};if(!(t.originalEvent&&2==t.originalEvent.button||s.isSliding||l>i[0].clientWidth+i.offset().left)){if(i.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container"))e="Outside";else if(i.is(".fancybox-slide"))e="Slide";else{if(!s.current.$content||!s.current.$content.has(t.target).length)return;e="Content"}if(o.tapped){if(clearTimeout(o.tapped),o.tapped=null,Math.abs(l-o.tapX)>50||Math.abs(u-o.tapY)>50||s.isSliding)return this;d("dblclick"+e)}else o.tapX=l,o.tapY=u,r.opts["dblclick"+e]&&r.opts["dblclick"+e]!==r.opts["click"+e]?o.tapped=setTimeout(function(){o.tapped=null,d("click"+e)},300):d("click"+e);return this}},n(e).on("onActivate.fb",function(t,e){e&&!e.Guestures&&(e.Guestures=new u(e))}),n(e).on("beforeClose.fb",function(t,e){e&&e.Guestures&&e.Guestures.destroy()})}(window,document,window.jQuery),function(t,e){"use strict";var n=function(t){this.instance=t,this.init()};e.extend(n.prototype,{timer:null,isActive:!1,$button:null,speed:3e3,init:function(){var t=this;t.$button=t.instance.$refs.toolbar.find("[data-fancybox-play]").on("click",function(){t.toggle()}),(t.instance.group.length<2||!t.instance.group[t.instance.currIndex].opts.slideShow)&&t.$button.hide()},set:function(){var t=this;t.instance&&t.instance.current&&(t.instance.current.opts.loop||t.instance.currIndex<t.instance.group.length-1)?t.timer=setTimeout(function(){t.instance.next()},t.instance.current.opts.slideShow.speed||t.speed):(t.stop(),t.instance.idleSecondsCounter=0,t.instance.showControls())},clear:function(){var t=this;clearTimeout(t.timer),t.timer=null},start:function(){var t=this,e=t.instance.current;t.instance&&e&&(e.opts.loop||e.index<t.instance.group.length-1)&&(t.isActive=!0,t.$button.attr("title",e.opts.i18n[e.opts.lang].PLAY_STOP).addClass("fancybox-button--pause"),e.isComplete&&t.set())},stop:function(){var t=this,e=t.instance.current;t.clear(),t.$button.attr("title",e.opts.i18n[e.opts.lang].PLAY_START).removeClass("fancybox-button--pause"),t.isActive=!1},toggle:function(){var t=this;t.isActive?t.stop():t.start()}}),e(t).on({"onInit.fb":function(t,e){e&&!e.SlideShow&&(e.SlideShow=new n(e))},"beforeShow.fb":function(t,e,n,o){var i=e&&e.SlideShow;o?i&&n.opts.slideShow.autoStart&&i.start():i&&i.isActive&&i.clear()},"afterShow.fb":function(t,e,n){var o=e&&e.SlideShow;o&&o.isActive&&o.set()},"afterKeydown.fb":function(n,o,i,a,s){var r=o&&o.SlideShow;!r||!i.opts.slideShow||80!==s&&32!==s||e(t.activeElement).is("button,a,input")||(a.preventDefault(),r.toggle())},"beforeClose.fb onDeactivate.fb":function(t,e){var n=e&&e.SlideShow;n&&n.stop()}}),e(t).on("visibilitychange",function(){var n=e.fancybox.getInstance(),o=n&&n.SlideShow;o&&o.isActive&&(t.hidden?o.clear():o.set())})}(document,window.jQuery),function(t,e){"use strict";var n=function(){var e,n,o,i=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],a={};for(n=0;n<i.length;n++)if(e=i[n],e&&e[1]in t){for(o=0;o<e.length;o++)a[i[0][o]]=e[o];return a}return!1}();if(!n)return void(e&&e.fancybox&&(e.fancybox.defaults.btnTpl.fullScreen=!1));var o={request:function(e){e=e||t.documentElement,e[n.requestFullscreen](e.ALLOW_KEYBOARD_INPUT)},exit:function(){t[n.exitFullscreen]()},toggle:function(e){e=e||t.documentElement,this.isFullscreen()?this.exit():this.request(e)},isFullscreen:function(){return Boolean(t[n.fullscreenElement])},enabled:function(){return Boolean(t[n.fullscreenEnabled])}};e(t).on({"onInit.fb":function(t,e){var n,i=e.$refs.toolbar.find("[data-fancybox-fullscreen]");e&&!e.FullScreen&&e.group[e.currIndex].opts.fullScreen?(n=e.$refs.container,n.on("click.fb-fullscreen","[data-fancybox-fullscreen]",function(t){t.stopPropagation(),t.preventDefault(),o.toggle(n[0])}),e.opts.fullScreen&&e.opts.fullScreen.autoStart===!0&&o.request(n[0]),e.FullScreen=o):i.hide()},"afterKeydown.fb":function(t,e,n,o,i){e&&e.FullScreen&&70===i&&(o.preventDefault(),e.FullScreen.toggle(e.$refs.container[0]))},"beforeClose.fb":function(t){t&&t.FullScreen&&o.exit()}}),e(t).on(n.fullscreenchange,function(){var t=e.fancybox.getInstance();t.current&&"image"===t.current.type&&t.isAnimating&&(t.current.$content.css("transition","none"),t.isAnimating=!1,t.update(!0,!0,0)),t.trigger("onFullscreenChange",o.isFullscreen())})}(document,window.jQuery),function(t,e){"use strict";var n=function(t){this.instance=t,this.init()};e.extend(n.prototype,{$button:null,$grid:null,$list:null,isVisible:!1,init:function(){var t=this,e=t.instance.group[0],n=t.instance.group[1];t.$button=t.instance.$refs.toolbar.find("[data-fancybox-thumbs]"),t.instance.group.length>1&&t.instance.group[t.instance.currIndex].opts.thumbs&&("image"==e.type||e.opts.thumb||e.opts.$thumb)&&("image"==n.type||n.opts.thumb||n.opts.$thumb)?(t.$button.on("click",function(){t.toggle()}),t.isActive=!0):(t.$button.hide(),t.isActive=!1)},create:function(){var t,n,o=this.instance;this.$grid=e('<div class="fancybox-thumbs"></div>').appendTo(o.$refs.container),t="<ul>",e.each(o.group,function(e,o){n=o.opts.thumb||(o.opts.$thumb?o.opts.$thumb.attr("src"):null),n||"image"!==o.type||(n=o.src),n&&n.length&&(t+='<li data-index="'+e+'"  tabindex="0" class="fancybox-thumbs-loading"><img data-src="'+n+'" /></li>')}),t+="</ul>",this.$list=e(t).appendTo(this.$grid).on("click","li",function(){o.jumpTo(e(this).data("index"))}),this.$list.find("img").hide().one("load",function(){var t,n,o,i,a=e(this).parent().removeClass("fancybox-thumbs-loading"),s=a.outerWidth(),r=a.outerHeight();t=this.naturalWidth||this.width,n=this.naturalHeight||this.height,o=t/s,i=n/r,o>=1&&i>=1&&(o>i?(t/=i,n=r):(t=s,n/=o)),e(this).css({width:Math.floor(t),height:Math.floor(n),"margin-top":Math.min(0,Math.floor(.3*r-.3*n)),"margin-left":Math.min(0,Math.floor(.5*s-.5*t))}).show()}).each(function(){this.src=e(this).data("src")})},focus:function(){this.instance.current&&this.$list.children().removeClass("fancybox-thumbs-active").filter('[data-index="'+this.instance.current.index+'"]').addClass("fancybox-thumbs-active").focus()},close:function(){this.$grid.hide()},update:function(){this.instance.$refs.container.toggleClass("fancybox-show-thumbs",this.isVisible),this.isVisible?(this.$grid||this.create(),this.instance.trigger("onThumbsShow"),this.focus()):this.$grid&&this.instance.trigger("onThumbsHide"),this.instance.update()},hide:function(){this.isVisible=!1,this.update()},show:function(){this.isVisible=!0,this.update()},toggle:function(){this.isVisible=!this.isVisible,this.update()}}),e(t).on({"onInit.fb":function(t,e){e&&!e.Thumbs&&(e.Thumbs=new n(e))},"beforeShow.fb":function(t,e,n,o){var i=e&&e.Thumbs;if(i&&i.isActive){if(n.modal)return i.$button.hide(),void i.hide();o&&e.opts.thumbs.autoStart===!0&&i.show(),i.isVisible&&i.focus()}},"afterKeydown.fb":function(t,e,n,o,i){var a=e&&e.Thumbs;a&&a.isActive&&71===i&&(o.preventDefault(),a.toggle())},"beforeClose.fb":function(t,e){var n=e&&e.Thumbs;n&&n.isVisible&&e.opts.thumbs.hideOnClose!==!1&&n.close()}})}(document,window.jQuery),function(t,e,n){"use strict";function o(){var t=e.location.hash.substr(1),n=t.split("-"),o=n.length>1&&/^\+?\d+$/.test(n[n.length-1])?parseInt(n.pop(-1),10)||1:1,i=n.join("-");return o<1&&(o=1),{hash:t,index:o,gallery:i}}function i(t){var e;""!==t.gallery&&(e=n("[data-fancybox='"+n.escapeSelector(t.gallery)+"']").eq(t.index-1),e.length||(e=n("#"+n.escapeSelector(t.gallery))),e.length&&(s=!1,e.trigger("click")))}function a(t){var e;return!!t&&(e=t.current?t.current.opts:t.opts,e.hash||(e.$orig?e.$orig.data("fancybox"):""))}n.escapeSelector||(n.escapeSelector=function(t){var e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,n=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t};return(t+"").replace(e,n)});var s=!0,r=null,c=null;n(function(){setTimeout(function(){n.fancybox.defaults.hash!==!1&&(n(t).on({"onInit.fb":function(t,e){var n,i;e.group[e.currIndex].opts.hash!==!1&&(n=o(),i=a(e),i&&n.gallery&&i==n.gallery&&(e.currIndex=n.index-1))},"beforeShow.fb":function(n,o,i){var l;i&&i.opts.hash!==!1&&(l=a(o),l&&""!==l&&(e.location.hash.indexOf(l)<0&&(o.opts.origHash=e.location.hash),r=l+(o.group.length>1?"-"+(i.index+1):""),"replaceState"in e.history?(c&&clearTimeout(c),c=setTimeout(function(){e.history[s?"pushState":"replaceState"]({},t.title,e.location.pathname+e.location.search+"#"+r),c=null,s=!1},300)):e.location.hash=r))},"beforeClose.fb":function(o,i,s){var l,u;c&&clearTimeout(c),s.opts.hash!==!1&&(l=a(i),u=i&&i.opts.origHash?i.opts.origHash:"",l&&""!==l&&("replaceState"in history?e.history.replaceState({},t.title,e.location.pathname+e.location.search+u):(e.location.hash=u,n(e).scrollTop(i.scrollTop).scrollLeft(i.scrollLeft))),r=null)}}),n(e).on("hashchange.fb",function(){var t=o();n.fancybox.getInstance()?!r||r===t.gallery+"-"+t.index||1===t.index&&r==t.gallery||(r=null,n.fancybox.close()):""!==t.gallery&&i(t)}),i(o()))},50)})}(document,window,window.jQuery);;
/*!
 * @fileOverview TouchSwipe - jQuery Plugin
 * @version 1.6.18
 *
 * @author Matt Bryson http://www.github.com/mattbryson
 * @see https://github.com/mattbryson/TouchSwipe-Jquery-Plugin
 * @see http://labs.rampinteractive.co.uk/touchSwipe/
 * @see http://plugins.jquery.com/project/touchSwipe
 * @license
 * Copyright (c) 2010-2015 Matt Bryson
 * Dual licensed under the MIT or GPL Version 2 licenses.
 *
 */
!function(factory){"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],factory):factory("undefined"!=typeof module&&module.exports?require("jquery"):jQuery)}(function($){"use strict";function init(options){return!options||void 0!==options.allowPageScroll||void 0===options.swipe&&void 0===options.swipeStatus||(options.allowPageScroll=NONE),void 0!==options.click&&void 0===options.tap&&(options.tap=options.click),options||(options={}),options=$.extend({},$.fn.swipe.defaults,options),this.each(function(){var $this=$(this),plugin=$this.data(PLUGIN_NS);plugin||(plugin=new TouchSwipe(this,options),$this.data(PLUGIN_NS,plugin))})}function TouchSwipe(element,options){function touchStart(jqEvent){if(!(getTouchInProgress()||$(jqEvent.target).closest(options.excludedElements,$element).length>0)){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;if(!event.pointerType||"mouse"!=event.pointerType||0!=options.fallbackToMouseEvents){var ret,touches=event.touches,evt=touches?touches[0]:event;return phase=PHASE_START,touches?fingerCount=touches.length:options.preventDefaultEvents!==!1&&jqEvent.preventDefault(),distance=0,direction=null,currentDirection=null,pinchDirection=null,duration=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,pinchDistance=0,maximumsMap=createMaximumsData(),cancelMultiFingerRelease(),createFingerData(0,evt),!touches||fingerCount===options.fingers||options.fingers===ALL_FINGERS||hasPinches()?(startTime=getTimeStamp(),2==fingerCount&&(createFingerData(1,touches[1]),startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start,fingerData[1].start)),(options.swipeStatus||options.pinchStatus)&&(ret=triggerHandler(event,phase))):ret=!1,ret===!1?(phase=PHASE_CANCEL,triggerHandler(event,phase),ret):(options.hold&&(holdTimeout=setTimeout($.proxy(function(){$element.trigger("hold",[event.target]),options.hold&&(ret=options.hold.call($element,event,event.target))},this),options.longTapThreshold)),setTouchInProgress(!0),null)}}}function touchMove(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;if(phase!==PHASE_END&&phase!==PHASE_CANCEL&&!inMultiFingerRelease()){var ret,touches=event.touches,evt=touches?touches[0]:event,currentFinger=updateFingerData(evt);if(endTime=getTimeStamp(),touches&&(fingerCount=touches.length),options.hold&&clearTimeout(holdTimeout),phase=PHASE_MOVE,2==fingerCount&&(0==startTouchesDistance?(createFingerData(1,touches[1]),startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start,fingerData[1].start)):(updateFingerData(touches[1]),endTouchesDistance=calculateTouchesDistance(fingerData[0].end,fingerData[1].end),pinchDirection=calculatePinchDirection(fingerData[0].end,fingerData[1].end)),pinchZoom=calculatePinchZoom(startTouchesDistance,endTouchesDistance),pinchDistance=Math.abs(startTouchesDistance-endTouchesDistance)),fingerCount===options.fingers||options.fingers===ALL_FINGERS||!touches||hasPinches()){if(direction=calculateDirection(currentFinger.start,currentFinger.end),currentDirection=calculateDirection(currentFinger.last,currentFinger.end),validateDefaultEvent(jqEvent,currentDirection),distance=calculateDistance(currentFinger.start,currentFinger.end),duration=calculateDuration(),setMaxDistance(direction,distance),ret=triggerHandler(event,phase),!options.triggerOnTouchEnd||options.triggerOnTouchLeave){var inBounds=!0;if(options.triggerOnTouchLeave){var bounds=getbounds(this);inBounds=isInBounds(currentFinger.end,bounds)}!options.triggerOnTouchEnd&&inBounds?phase=getNextPhase(PHASE_MOVE):options.triggerOnTouchLeave&&!inBounds&&(phase=getNextPhase(PHASE_END)),phase!=PHASE_CANCEL&&phase!=PHASE_END||triggerHandler(event,phase)}}else phase=PHASE_CANCEL,triggerHandler(event,phase);ret===!1&&(phase=PHASE_CANCEL,triggerHandler(event,phase))}}function touchEnd(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent,touches=event.touches;if(touches){if(touches.length&&!inMultiFingerRelease())return startMultiFingerRelease(event),!0;if(touches.length&&inMultiFingerRelease())return!0}return inMultiFingerRelease()&&(fingerCount=fingerCountAtRelease),endTime=getTimeStamp(),duration=calculateDuration(),didSwipeBackToCancel()||!validateSwipeDistance()?(phase=PHASE_CANCEL,triggerHandler(event,phase)):options.triggerOnTouchEnd||options.triggerOnTouchEnd===!1&&phase===PHASE_MOVE?(options.preventDefaultEvents!==!1&&jqEvent.cancelable!==!1&&jqEvent.preventDefault(),phase=PHASE_END,triggerHandler(event,phase)):!options.triggerOnTouchEnd&&hasTap()?(phase=PHASE_END,triggerHandlerForGesture(event,phase,TAP)):phase===PHASE_MOVE&&(phase=PHASE_CANCEL,triggerHandler(event,phase)),setTouchInProgress(!1),null}function touchCancel(){fingerCount=0,endTime=0,startTime=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,cancelMultiFingerRelease(),setTouchInProgress(!1)}function touchLeave(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;options.triggerOnTouchLeave&&(phase=getNextPhase(PHASE_END),triggerHandler(event,phase))}function removeListeners(){$element.unbind(START_EV,touchStart),$element.unbind(CANCEL_EV,touchCancel),$element.unbind(MOVE_EV,touchMove),$element.unbind(END_EV,touchEnd),LEAVE_EV&&$element.unbind(LEAVE_EV,touchLeave),setTouchInProgress(!1)}function getNextPhase(currentPhase){var nextPhase=currentPhase,validTime=validateSwipeTime(),validDistance=validateSwipeDistance(),didCancel=didSwipeBackToCancel();return!validTime||didCancel?nextPhase=PHASE_CANCEL:!validDistance||currentPhase!=PHASE_MOVE||options.triggerOnTouchEnd&&!options.triggerOnTouchLeave?!validDistance&&currentPhase==PHASE_END&&options.triggerOnTouchLeave&&(nextPhase=PHASE_CANCEL):nextPhase=PHASE_END,nextPhase}function triggerHandler(event,phase){var ret,touches=event.touches;return(didSwipe()||hasSwipes())&&(ret=triggerHandlerForGesture(event,phase,SWIPE)),(didPinch()||hasPinches())&&ret!==!1&&(ret=triggerHandlerForGesture(event,phase,PINCH)),didDoubleTap()&&ret!==!1?ret=triggerHandlerForGesture(event,phase,DOUBLE_TAP):didLongTap()&&ret!==!1?ret=triggerHandlerForGesture(event,phase,LONG_TAP):didTap()&&ret!==!1&&(ret=triggerHandlerForGesture(event,phase,TAP)),phase===PHASE_CANCEL&&touchCancel(event),phase===PHASE_END&&(touches?touches.length||touchCancel(event):touchCancel(event)),ret}function triggerHandlerForGesture(event,phase,gesture){var ret;if(gesture==SWIPE){if($element.trigger("swipeStatus",[phase,direction||null,distance||0,duration||0,fingerCount,fingerData,currentDirection]),options.swipeStatus&&(ret=options.swipeStatus.call($element,event,phase,direction||null,distance||0,duration||0,fingerCount,fingerData,currentDirection),ret===!1))return!1;if(phase==PHASE_END&&validateSwipe()){if(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),$element.trigger("swipe",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipe&&(ret=options.swipe.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection),ret===!1))return!1;switch(direction){case LEFT:$element.trigger("swipeLeft",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeLeft&&(ret=options.swipeLeft.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case RIGHT:$element.trigger("swipeRight",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeRight&&(ret=options.swipeRight.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case UP:$element.trigger("swipeUp",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeUp&&(ret=options.swipeUp.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case DOWN:$element.trigger("swipeDown",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeDown&&(ret=options.swipeDown.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection))}}}if(gesture==PINCH){if($element.trigger("pinchStatus",[phase,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchStatus&&(ret=options.pinchStatus.call($element,event,phase,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData),ret===!1))return!1;if(phase==PHASE_END&&validatePinch())switch(pinchDirection){case IN:$element.trigger("pinchIn",[pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchIn&&(ret=options.pinchIn.call($element,event,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData));break;case OUT:$element.trigger("pinchOut",[pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchOut&&(ret=options.pinchOut.call($element,event,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData))}}return gesture==TAP?phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),hasDoubleTap()&&!inDoubleTap()?(doubleTapStartTime=getTimeStamp(),singleTapTimeout=setTimeout($.proxy(function(){doubleTapStartTime=null,$element.trigger("tap",[event.target]),options.tap&&(ret=options.tap.call($element,event,event.target))},this),options.doubleTapThreshold)):(doubleTapStartTime=null,$element.trigger("tap",[event.target]),options.tap&&(ret=options.tap.call($element,event,event.target)))):gesture==DOUBLE_TAP?phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),doubleTapStartTime=null,$element.trigger("doubletap",[event.target]),options.doubleTap&&(ret=options.doubleTap.call($element,event,event.target))):gesture==LONG_TAP&&(phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),doubleTapStartTime=null,$element.trigger("longtap",[event.target]),options.longTap&&(ret=options.longTap.call($element,event,event.target)))),ret}function validateSwipeDistance(){var valid=!0;return null!==options.threshold&&(valid=distance>=options.threshold),valid}function didSwipeBackToCancel(){var cancelled=!1;return null!==options.cancelThreshold&&null!==direction&&(cancelled=getMaxDistance(direction)-distance>=options.cancelThreshold),cancelled}function validatePinchDistance(){return null===options.pinchThreshold||pinchDistance>=options.pinchThreshold}function validateSwipeTime(){var result;return result=!options.maxTimeThreshold||!(duration>=options.maxTimeThreshold)}function validateDefaultEvent(jqEvent,direction){if(options.preventDefaultEvents!==!1)if(options.allowPageScroll===NONE)jqEvent.preventDefault();else{var auto=options.allowPageScroll===AUTO;switch(direction){case LEFT:(options.swipeLeft&&auto||!auto&&options.allowPageScroll!=HORIZONTAL)&&jqEvent.preventDefault();break;case RIGHT:(options.swipeRight&&auto||!auto&&options.allowPageScroll!=HORIZONTAL)&&jqEvent.preventDefault();break;case UP:(options.swipeUp&&auto||!auto&&options.allowPageScroll!=VERTICAL)&&jqEvent.preventDefault();break;case DOWN:(options.swipeDown&&auto||!auto&&options.allowPageScroll!=VERTICAL)&&jqEvent.preventDefault();break;case NONE:}}}function validatePinch(){var hasCorrectFingerCount=validateFingers(),hasEndPoint=validateEndPoint(),hasCorrectDistance=validatePinchDistance();return hasCorrectFingerCount&&hasEndPoint&&hasCorrectDistance}function hasPinches(){return!!(options.pinchStatus||options.pinchIn||options.pinchOut)}function didPinch(){return!(!validatePinch()||!hasPinches())}function validateSwipe(){var hasValidTime=validateSwipeTime(),hasValidDistance=validateSwipeDistance(),hasCorrectFingerCount=validateFingers(),hasEndPoint=validateEndPoint(),didCancel=didSwipeBackToCancel(),valid=!didCancel&&hasEndPoint&&hasCorrectFingerCount&&hasValidDistance&&hasValidTime;return valid}function hasSwipes(){return!!(options.swipe||options.swipeStatus||options.swipeLeft||options.swipeRight||options.swipeUp||options.swipeDown)}function didSwipe(){return!(!validateSwipe()||!hasSwipes())}function validateFingers(){return fingerCount===options.fingers||options.fingers===ALL_FINGERS||!SUPPORTS_TOUCH}function validateEndPoint(){return 0!==fingerData[0].end.x}function hasTap(){return!!options.tap}function hasDoubleTap(){return!!options.doubleTap}function hasLongTap(){return!!options.longTap}function validateDoubleTap(){if(null==doubleTapStartTime)return!1;var now=getTimeStamp();return hasDoubleTap()&&now-doubleTapStartTime<=options.doubleTapThreshold}function inDoubleTap(){return validateDoubleTap()}function validateTap(){return(1===fingerCount||!SUPPORTS_TOUCH)&&(isNaN(distance)||distance<options.threshold)}function validateLongTap(){return duration>options.longTapThreshold&&distance<DOUBLE_TAP_THRESHOLD}function didTap(){return!(!validateTap()||!hasTap())}function didDoubleTap(){return!(!validateDoubleTap()||!hasDoubleTap())}function didLongTap(){return!(!validateLongTap()||!hasLongTap())}function startMultiFingerRelease(event){previousTouchEndTime=getTimeStamp(),fingerCountAtRelease=event.touches.length+1}function cancelMultiFingerRelease(){previousTouchEndTime=0,fingerCountAtRelease=0}function inMultiFingerRelease(){var withinThreshold=!1;if(previousTouchEndTime){var diff=getTimeStamp()-previousTouchEndTime;diff<=options.fingerReleaseThreshold&&(withinThreshold=!0)}return withinThreshold}function getTouchInProgress(){return!($element.data(PLUGIN_NS+"_intouch")!==!0)}function setTouchInProgress(val){$element&&(val===!0?($element.bind(MOVE_EV,touchMove),$element.bind(END_EV,touchEnd),LEAVE_EV&&$element.bind(LEAVE_EV,touchLeave)):($element.unbind(MOVE_EV,touchMove,!1),$element.unbind(END_EV,touchEnd,!1),LEAVE_EV&&$element.unbind(LEAVE_EV,touchLeave,!1)),$element.data(PLUGIN_NS+"_intouch",val===!0))}function createFingerData(id,evt){var f={start:{x:0,y:0},last:{x:0,y:0},end:{x:0,y:0}};return f.start.x=f.last.x=f.end.x=evt.pageX||evt.clientX,f.start.y=f.last.y=f.end.y=evt.pageY||evt.clientY,fingerData[id]=f,f}function updateFingerData(evt){var id=void 0!==evt.identifier?evt.identifier:0,f=getFingerData(id);return null===f&&(f=createFingerData(id,evt)),f.last.x=f.end.x,f.last.y=f.end.y,f.end.x=evt.pageX||evt.clientX,f.end.y=evt.pageY||evt.clientY,f}function getFingerData(id){return fingerData[id]||null}function setMaxDistance(direction,distance){direction!=NONE&&(distance=Math.max(distance,getMaxDistance(direction)),maximumsMap[direction].distance=distance)}function getMaxDistance(direction){if(maximumsMap[direction])return maximumsMap[direction].distance}function createMaximumsData(){var maxData={};return maxData[LEFT]=createMaximumVO(LEFT),maxData[RIGHT]=createMaximumVO(RIGHT),maxData[UP]=createMaximumVO(UP),maxData[DOWN]=createMaximumVO(DOWN),maxData}function createMaximumVO(dir){return{direction:dir,distance:0}}function calculateDuration(){return endTime-startTime}function calculateTouchesDistance(startPoint,endPoint){var diffX=Math.abs(startPoint.x-endPoint.x),diffY=Math.abs(startPoint.y-endPoint.y);return Math.round(Math.sqrt(diffX*diffX+diffY*diffY))}function calculatePinchZoom(startDistance,endDistance){var percent=endDistance/startDistance*1;return percent.toFixed(2)}function calculatePinchDirection(){return pinchZoom<1?OUT:IN}function calculateDistance(startPoint,endPoint){return Math.round(Math.sqrt(Math.pow(endPoint.x-startPoint.x,2)+Math.pow(endPoint.y-startPoint.y,2)))}function calculateAngle(startPoint,endPoint){var x=startPoint.x-endPoint.x,y=endPoint.y-startPoint.y,r=Math.atan2(y,x),angle=Math.round(180*r/Math.PI);return angle<0&&(angle=360-Math.abs(angle)),angle}function calculateDirection(startPoint,endPoint){if(comparePoints(startPoint,endPoint))return NONE;var angle=calculateAngle(startPoint,endPoint);return angle<=45&&angle>=0?LEFT:angle<=360&&angle>=315?LEFT:angle>=135&&angle<=225?RIGHT:angle>45&&angle<135?DOWN:UP}function getTimeStamp(){var now=new Date;return now.getTime()}function getbounds(el){el=$(el);var offset=el.offset(),bounds={left:offset.left,right:offset.left+el.outerWidth(),top:offset.top,bottom:offset.top+el.outerHeight()};return bounds}function isInBounds(point,bounds){return point.x>bounds.left&&point.x<bounds.right&&point.y>bounds.top&&point.y<bounds.bottom}function comparePoints(pointA,pointB){return pointA.x==pointB.x&&pointA.y==pointB.y}var options=$.extend({},options),useTouchEvents=SUPPORTS_TOUCH||SUPPORTS_POINTER||!options.fallbackToMouseEvents,START_EV=useTouchEvents?SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerDown":"pointerdown":"touchstart":"mousedown",MOVE_EV=useTouchEvents?SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerMove":"pointermove":"touchmove":"mousemove",END_EV=useTouchEvents?SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerUp":"pointerup":"touchend":"mouseup",LEAVE_EV=useTouchEvents?SUPPORTS_POINTER?"mouseleave":null:"mouseleave",CANCEL_EV=SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerCancel":"pointercancel":"touchcancel",distance=0,direction=null,currentDirection=null,duration=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,pinchDistance=0,pinchDirection=0,maximumsMap=null,$element=$(element),phase="start",fingerCount=0,fingerData={},startTime=0,endTime=0,previousTouchEndTime=0,fingerCountAtRelease=0,doubleTapStartTime=0,singleTapTimeout=null,holdTimeout=null;try{$element.bind(START_EV,touchStart),$element.bind(CANCEL_EV,touchCancel)}catch(e){$.error("events not supported "+START_EV+","+CANCEL_EV+" on jQuery.swipe")}this.enable=function(){return this.disable(),$element.bind(START_EV,touchStart),$element.bind(CANCEL_EV,touchCancel),$element},this.disable=function(){return removeListeners(),$element},this.destroy=function(){removeListeners(),$element.data(PLUGIN_NS,null),$element=null},this.option=function(property,value){if("object"==typeof property)options=$.extend(options,property);else if(void 0!==options[property]){if(void 0===value)return options[property];options[property]=value}else{if(!property)return options;$.error("Option "+property+" does not exist on jQuery.swipe.options")}return null}}var VERSION="1.6.18",LEFT="left",RIGHT="right",UP="up",DOWN="down",IN="in",OUT="out",NONE="none",AUTO="auto",SWIPE="swipe",PINCH="pinch",TAP="tap",DOUBLE_TAP="doubletap",LONG_TAP="longtap",HORIZONTAL="horizontal",VERTICAL="vertical",ALL_FINGERS="all",DOUBLE_TAP_THRESHOLD=10,PHASE_START="start",PHASE_MOVE="move",PHASE_END="end",PHASE_CANCEL="cancel",SUPPORTS_TOUCH="ontouchstart"in window,SUPPORTS_POINTER_IE10=window.navigator.msPointerEnabled&&!window.navigator.pointerEnabled&&!SUPPORTS_TOUCH,SUPPORTS_POINTER=(window.navigator.pointerEnabled||window.navigator.msPointerEnabled)&&!SUPPORTS_TOUCH,PLUGIN_NS="TouchSwipe",defaults={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,hold:null,triggerOnTouchEnd:!0,triggerOnTouchLeave:!1,allowPageScroll:"auto",fallbackToMouseEvents:!0,excludedElements:".noSwipe",preventDefaultEvents:!0};$.fn.swipe=function(method){var $this=$(this),plugin=$this.data(PLUGIN_NS);if(plugin&&"string"==typeof method){if(plugin[method])return plugin[method].apply(plugin,Array.prototype.slice.call(arguments,1));$.error("Method "+method+" does not exist on jQuery.swipe")}else if(plugin&&"object"==typeof method)plugin.option.apply(plugin,arguments);else if(!(plugin||"object"!=typeof method&&method))return init.apply(this,arguments);return $this},$.fn.swipe.version=VERSION,$.fn.swipe.defaults=defaults,$.fn.swipe.phases={PHASE_START:PHASE_START,PHASE_MOVE:PHASE_MOVE,PHASE_END:PHASE_END,PHASE_CANCEL:PHASE_CANCEL},$.fn.swipe.directions={LEFT:LEFT,RIGHT:RIGHT,UP:UP,DOWN:DOWN,IN:IN,OUT:OUT},$.fn.swipe.pageScroll={NONE:NONE,HORIZONTAL:HORIZONTAL,VERTICAL:VERTICAL,AUTO:AUTO},$.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,FOUR:4,FIVE:5,ALL:ALL_FINGERS}});;
(function () {
    var p, aa = []; function ba(a) { return function () { return aa[a].apply(this, arguments) } } function ca(a, b) { return aa[a] = b } var da = da || {}, fa = this; function ga(a) { return void 0 !== a } function ha(a, b, c) { a = a.split("."); c = c || fa; a[0] in c || !c.execScript || c.execScript("var " + a[0]); for (var d; a.length && (d = a.shift());)!a.length && ga(b) ? c[d] = b : c[d] ? c = c[d] : c = c[d] = {} } function ja(a) { a = a.split("."); for (var b = fa, c; c = a.shift();)if (null != b[c]) b = b[c]; else return null; return b } function ka() { }
    function ma() { throw Error("unimplemented abstract method"); }
    function oa(a) {
        var b = typeof a; if ("object" == b) if (a) { if (a instanceof Array) return "array"; if (a instanceof Object) return b; var c = Object.prototype.toString.call(a); if ("[object Window]" == c) return "object"; if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) return "array"; if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) return "function" } else return "null";
        else if ("function" == b && "undefined" == typeof a.call) return "object"; return b
    } function pa(a) { return "array" == oa(a) } function qa(a) { var b = oa(a); return "array" == b || "object" == b && "number" == typeof a.length } function ra(a) { return "string" == typeof a } function sa(a) { return "function" == oa(a) } function ta(a) { var b = typeof a; return "object" == b && null != a || "function" == b } var ua = "closure_uid_" + (1E9 * Math.random() >>> 0), va = 0; function wa(a, b, c) { return a.call.apply(a.bind, arguments) }
    function xa(a, b, c) { if (!a) throw Error(); if (2 < arguments.length) { var d = Array.prototype.slice.call(arguments, 2); return function () { var c = Array.prototype.slice.call(arguments); Array.prototype.unshift.apply(c, d); return a.apply(b, c) } } return function () { return a.apply(b, arguments) } } function ya(a, b, c) { ya = Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? wa : xa; return ya.apply(null, arguments) }
    function za(a, b) { var c = Array.prototype.slice.call(arguments, 1); return function () { var b = c.slice(); b.push.apply(b, arguments); return a.apply(this, b) } } var Aa = Date.now || function () { return +new Date }; function r(a, b) { ha(a, b, void 0) } function v(a, b) { function c() { } c.prototype = b.prototype; a.u = b.prototype; a.prototype = new c; a.prototype.constructor = a; a.Si = function (a, c, f) { for (var g = Array(arguments.length - 2), h = 2; h < arguments.length; h++)g[h - 2] = arguments[h]; return b.prototype[c].apply(a, g) } }; var Ba = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "); function Ca(a, b) { for (var c, d, e = 1; e < arguments.length; e++) { d = arguments[e]; for (c in d) a[c] = d[c]; for (var f = 0; f < Ba.length; f++)c = Ba[f], Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c]) } }; var w = function () { return this }(); function Da(a) { if (Error.captureStackTrace) Error.captureStackTrace(this, Da); else { var b = Error().stack; b && (this.stack = b) } a && (this.message = String(a)) } v(Da, Error); Da.prototype.name = "CustomError"; var Ea = String.prototype.trim ? function (a) { return a.trim() } : function (a) { return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "") }; function Fa(a, b) { return a < b ? -1 : a > b ? 1 : 0 }; var Ga = Array.prototype, Ha = Ga.indexOf ? function (a, b, c) { return Ga.indexOf.call(a, b, c) } : function (a, b, c) { c = null == c ? 0 : 0 > c ? Math.max(0, a.length + c) : c; if (ra(a)) return ra(b) && 1 == b.length ? a.indexOf(b, c) : -1; for (; c < a.length; c++)if (c in a && a[c] === b) return c; return -1 }, Ia = Ga.forEach ? function (a, b, c) { Ga.forEach.call(a, b, c) } : function (a, b, c) { for (var d = a.length, e = ra(a) ? a.split("") : a, f = 0; f < d; f++)f in e && b.call(c, e[f], f, a) }; function Ka() { return Object.create(x, void 0) } var z = ya, La = String; function Ma(a) { return eval("" + a) } var Na = w.Object.freeze || function (a) { return a }; function Oa(a) { for (var b = Object.keys(a), c = b.length, d; c--;)d = a[b[c]], Pa(d) && Oa(d); return Na(a) } function Qa(a) { var b = {}, c; for (c in a) b[c] = a[c]; return b } var A = Ma(), x = Ma(null); function Ra(a, b) { return La(a).split(b !== A ? b : " ") } var Sa = "prototype constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
    function B(a, b, c, d, e) { if (!(b = a instanceof b) && c) throw new C(c, d, Ta(e) ? e : a); return b } function Ua(a, b) { if (!0 === (B(a, b) && a.constructor === b)) throw new TypeError("Illegal constructor " + Va(b)); } var Pa = ta; r("H.lang.isObject", Pa); function Wa(a) { for (var b in a) return !1; return !0 } r("H.lang.isEmptyObject", Wa); function Xa(a, b, c, d, e) { if (!(b = Ya(a) === b) && c) throw new C(c, d, Ta(e) ? e : a); return b } function Za(a, b, c, d) { return Xa(a, "Array", b, c, d) } r("H.lang.isArray", Za); function Ta(a) { return a !== A }
    r("H.lang.isString", ra); var $a = parseFloat, D = isNaN; function ab(a) { return a === +a } r("H.lang.isNumber", ab); function bb(a) { return !D(+a) } function Ya(a) { var b = Object[Sa[0]][Sa[6]].call(a).match(/^\[object (\w+)\]$/); return b ? b[1] : typeof a }
    function Va(a, b, c, d) { var e = "", f = 2 > arguments.length; f && (b = { H: w.H }, c = "", d = []); cb(b, !0, function (b, f) { try { var k = b[f]; f = db(b, k); var l; if (l = !(Pa(k) && k.window === k && k.self === k)) l = !(Pa(k) && 0 < k.nodeType && sa(k.cloneNode)); if (l && Pa(k)) { if (k === a) return e = c + "." + f, !0; if (0 > d.indexOf(k) && (d.push(k), e = Va(a, k, c + "." + f, d))) return !0 } } catch (m) { } }); f && (e = e ? e.substr(1).replace("." + Sa[0] + ".", "#") : "~" + (sa(a) ? eb(a) + "()" : Ya(a))); return e }
    function db(a, b) { var c = []; cb(a, !1, function (a, e) { a[e] === b && c.push(e) }); return c.sort(fb)[0] } function fb(a, b) { return b.length - a.length } var gb = Object[Sa[0]][Sa[2]]; function cb(a, b, c) { var d, e; if (a) { for (d in a) if ((!b || gb.call(a, d)) && c(a, d, !0)) return; for (e = Sa.length; e-- && (d = Sa[e], b && !gb.call(a, d) || !c(a, d, !1));); } } function eb(a) { return (a = /^\s*function ([^\( ]+)/.exec(a)) ? a[1] : "anonymous" } function hb(a, b, c) { c[b] = "#" + b } var ib = "[object Undefined]" !== {}.toString.call(void 0);
    function jb(a, b) { var c = w.console, d; !ib && c && c.warn && (d = Va(a) + " is deprecated and will be removed soon. ", b && (d += b), c.warn(d)) }; function C(a, b, c) { var d = arguments.length, e; b = 1 < d ? +b : b; d = 2 < d ? La(c) : ""; b !== A && (e = (e = /^.*?\(([^\)]+)/.exec(("" + a).replace(/(\/\*([\s\S]*?)\*\/)|(\/\/(.*)$)/gm, ""))) ? Ra(e[1].replace(/\s+/g, ""), ",") : [], e.forEach(hb), e = e[b] || "#" + b); this.message = (a ? Va(a) : "") + (e || d ? " (" : "") + (e ? "Argument " + e : "") + (d ? (e ? " " : "") + d : "") + (e || d ? ")" : ""); this.stack = Error().stack } r("H.lang.InvalidArgumentError", C); C.prototype = Error(); C.prototype.name = "InvalidArgumentError"; var kb = Math, lb = kb.min, mb = kb.max, nb = kb.round, pb = kb.floor, qb = kb.ceil, rb = kb.abs, sb = kb.log, tb = kb.sqrt, ub = kb.pow, vb = kb.exp, wb = kb.sin, xb = kb.asin, yb = kb.cos, zb = kb.tan, Ab = kb.atan, Bb = kb.atan2, Cb = kb.LN2, Db = kb.PI, Eb = Db / 2, Fb = Db / 4, Gb = 2 * Db, Hb = 3 * Db, Ib = Db / 180, Kb = 180 / Db, Lb = 1 / 0, Mb = ub(-2, 53), Nb = Nb || function (a) { return sb(a) / Cb }; function Ob(a, b) { var c; return 0 > (c = a % b) === 0 > b ? c : c + b } function Pb(a, b, c) { b -= c = c || 0; a -= c; return a - pb(a / b) * b + c } r("H.math.normalize", Pb); function Qb(a, b, c) { return (a -= 0) > c ? c : a < b ? b : a }
    r("H.math.clamp", Qb); function Rb(a, b, c, d) { (d -= 0) || (d = 0); return b < c ? a >= b - d && a <= c + d : a >= c - d && a <= b + d } function Sb(a, b, c, d, e, f) { return tb(ub((a - e) * (d - f) - (b - f) * (c - e), 2) / (ub(c - e, 2) + ub(d - f, 2))) } var Tb = { NONE: 0, Ri: 1, Li: 2, Qi: 3 };
    function Ub(a, b, c, d, e) {
        for (var f = c.length, g = f, h, k, l, m = c[0], n = 0, q = 0, t = 0, u = d / 2 || 0, y = e ? 1 : 3; 1 != n && g > y;) { h = c[--g]; d = c[--g]; l = c[g ? g - 1 : (f + (g - 1)) % f]; k = c[g ? g - 2 : (f + (g - 2)) % f]; if (d >= a - u && d <= a + u && h >= b - u && h <= b + u || k >= a - u && k <= a + u && l >= b - u && l <= b + u) n = 1; else if (!n && d === a) k === a && (h < b && l > b || h > b && l < b) || (m <= a && k > a || m >= a && k < a) && (h >= b ? ++q : ++t), n = Rb(b, h, l, u) && Sb(a, b, d, h, k, l) <= u ? 2 : 0; else if (!n && Rb(a, d, k, u)) { if (d < a && k > a || d > a && k < a) m = h + (a - d) / (k - d) * (l - h), q += m > b, t += m < b; n = Rb(b, h, l, u) && Sb(a, b, d, h, k, l) <= u ? 2 : 0 } m = d } !n && e && 0 !== t && 0 !==
            q % 2 && (n = 3); return n
    }; var Vb = { undefined: "GL", GL: "GL", OL: "OL", SL: "SL", SB: "SB", WE: "WE", WG: "WG" }; r("H.geo.AltitudeContext", Vb); function Wb(a, b, c) { var d = Qb(+a, -90, 90); if (b && D(d)) throw new C(b, c, a); return d } function Xb(a, b, c) { var d = +a; if (-180 > d || 180 < d) d = Ob(d + 180, 360) - 180; if (b && D(d)) throw new C(b, c, a); return d } function Yb(a, b, c) { var d; if (a !== A && D(d = +a) && b) throw new C(b, c, a); return d } function Zb(a, b, c) { var d = !Vb[a]; if (b && d) throw new C(b, c, a); return !d } function $b(a) { return !a || D(a.lat) || D(a.lng) ? !1 : !0 }
    function ac(a, b) { return 0 !== (0 > a ^ 0 > b) && 180 < rb(b - a) } r("H.geo.isDBC", ac); function bc() { Ua(this, bc) } r("H.geo.AbstractGeometry", bc); bc.prototype.getBounds = bc.prototype.S; bc.prototype.equals = bc.prototype.pa; bc.prototype.toString = function () { return this.Lb([this.qd, " "]).join("") }; bc.prototype.toString = bc.prototype.toString; function E(a, b) { var c; E.u.constructor.call(this); B(a, F, E, 0); if (b !== A && Za(b, E, 1)) { for (c = 0; c < b.length; c++)B(b[c], F, E, 1, "index " + c); this.lb = b } else this.lb = []; this.$a = a; this.a = [] } v(E, bc); r("H.geo.Polygon", E); var cc = { NORTH: 90, SOUTH: -90 }; E.Direction = cc; E.prototype.hc = cc.NORTH; E.prototype.i = function (a) { this.hc !== a && (this.c = x, this.a.length = 0, this.hc = a); return this }; E.prototype.setPoleCovering = E.prototype.i; E.prototype.o = function () { return this.hc }; E.prototype.getPoleCovering = E.prototype.o;
    E.prototype.l = function () { return this.$a }; E.prototype.getExterior = E.prototype.l; E.prototype.g = function (a) { if (!B(a, F)) throw new C(this.g, 0, a); this.$a = a; this.c = x }; E.prototype.setExterior = E.prototype.g; E.prototype.j = function () { return this.lb }; E.prototype.getInteriors = E.prototype.j; E.prototype.b = function (a, b, c) { var d = arguments.length, e, f; for (e = 2; e < d; e++)B(arguments[e], F, this.b, e); f = this.lb.splice.apply(this.lb, arguments); for (e = 2; e < d; e++)arguments[e] = A; this.a.splice.apply(this.a, arguments); return f };
    E.prototype.spliceInteriors = E.prototype.b; E.prototype.v = function (a) { return this.b(a, 1)[0] }; E.prototype.removeInteriorAt = E.prototype.v; E.prototype.m = function (a) { a = this.lb.indexOf(a); return 0 > a ? A : this.b(a, 1)[0] }; E.prototype.removeInterior = E.prototype.m; E.prototype.f = function (a) { if (!B(a, F)) throw new C(this.f, 0, a); this.lb.push(a) }; E.prototype.pushInterior = E.prototype.f; E.prototype.S = function () { var a = this.c; a || (this.c = a = dc(this.$a, this.hc)); return a }; E.prototype.getBounds = E.prototype.S; p = E.prototype;
    p.ig = function (a) { var b = this.lb.length; if (0 > a || a >= b) throw new ec(this.ig, a, [0, b - 1]); (b = this.a[a]) || (this.a[a] = b = dc(this.lb[a], this.hc)); return b }; p.$a = x; p.lb = []; p.qd = "POLYGON"; p.Lb = function (a) { var b = this.lb, c = b.length, d; if (this.$a.f()) { a.push("("); this.$a.Lb(a); for (d = 0; d < c; d++)b[d].f() && (a.push(","), b[d].Lb(a)); a.push(")") } else a.push("EMPTY"); return a }; function dc(a, b) { var c, d, e; if (e = a.S()) (c = a.l(!0)) && (d = a.f()) && (e = e.wb(fc([a.g(0), a.g(d - 1)], !0), !0)), 360 === e.ab() && 1 === c % 2 && (e = e.b(b, 0)); return e }; function gc(a, b, c, d) { this.lat = Wb(a, gc, 0); this.lng = Xb(b, gc, 1); c !== A && (this.alt = Yb(c, gc, 2)); d !== A && Zb(d, gc, 3) && (this.ctx = d) } v(gc, bc); r("H.geo.Point", gc); gc.prototype.pa = function (a) { return this === a || !!a && this.lat === a.lat && this.lng === a.lng && Vb[this.ctx] === Vb[a.ctx] && (this.alt || 0) === (a.alt || 0) }; gc.prototype.equals = gc.prototype.pa;
    gc.prototype.distance = function (a) { var b, c; this === a || this.lat === a.lat && this.lng === a.lng ? a = 0 : (b = this.lat * Ib, c = a.lat * Ib, a = 1.274200158E7 * xb(lb(1, tb(ub(wb((b - c) / 2), 2) + yb(b) * yb(c) * ub(wb((this.lng * Ib - a.lng * Ib) / 2), 2))))); return a }; gc.prototype.distance = gc.prototype.distance;
    gc.prototype.Gf = function (a, b, c) {
        var d, e, f, g, h, k; if (c) { if (b /= 6371000.79) { a *= Ib; d = Ib * this.lat; f = wb(d); g = wb(b); h = yb(b); e = Ib * this.lng; var l = yb(d); d = xb(l * yb(a) * g + f * h); a = Bb(wb(a) * l * g, h - f * wb(d)); l = ((e + a + Db) % (2 * Db) - Db) * Kb } return b ? new gc(d * Kb, (l + 540) % 360 - 180) : this } a = (a % 360 + 360) % 360; if (0 === (a + 90) % 180) return d = this.lng + b / (6371000.79 * Gb * yb(this.lat * Ib)) * (270 === a ? -360 : 360), new gc(this.lat, (d + 540) % 360 - 180); if (b /= 6371000.79) a *= Ib, e = this.lat * Ib, f = this.lng * Ib, g = e + b * yb(a), h = g - e, d = sb(zb(g / 2 + Fb) / zb(e / 2 + Fb)), d = D(h / d) ?
            yb(e) : h / d, k = b * wb(a) / d, rb(g) > Eb && (g = 0 < g ? Db - g : -(Db + g)); return b ? new gc(g * Kb, ((f + k + Hb + (rb(e + h) > Eb ? Db : 0)) % Gb - Db) * Kb) : this
    }; gc.prototype.walk = gc.prototype.Gf; gc.prototype.S = function () { return new G(this.lat, this.lng, this.lat, this.lng) }; gc.prototype.getBounds = gc.prototype.S; function hc(a, b, c) { var d = !!a && !(D(a.lat = Wb(a.lat)) || D(a.lng = Xb(a.lng)) || a.alt !== A && D(a.alt = Yb(a.alt)) || a.ctx !== A && !Zb(a.ctx)); if (!d && b) throw new C(b, c, a); return d } gc.validate = hc;
    function ic(a) { if (!a) throw new C(ic, 0, a); return new gc(a.lat, a.lng, a.alt, a.ctx) } gc.fromIPoint = ic; gc.prototype.qd = "POINT"; gc.prototype.Lb = function (a) { a.push("(", this.lng, " ", this.lat, ")"); return a }; var jc; function kc(a, b) { var c = []; a && c.push(Va(a)); 1 < arguments.length && c.push(b); this.message = c.join(" "); this.stack = Error().stack } v(kc, Error); r("H.lang.IllegalOperationError", kc); kc.prototype = Error(); kc.prototype.name = "IllegalOperationError"; function lc(a) { if (!ra(a)) throw new C(this.constructor, 0); this.g = w.indexedDB || w.webkitIndexedDB || w.mozIndexedDB || w.msIndexedDB; if (!this.g) throw new kc(this.constructor, "This browser does not support IndexedDB"); this.l = a; this.a = []; this.c = []; this.pf = z(this.pf, this) } var mc, nc; r("H.util.IndexedDBStorage", lc); p = lc.prototype; p.gd = function (a, b, c, d) { if (!oc(a)) throw new C(this.gd, 0); if (!pc(b)) throw new C(this.gd, 1); qc(this, function (e) { rc(e.put(b, a), c, d) }, d) };
    p.get = function (a, b, c) { var d; if (!oc(a)) throw new C(this.get, 0); if (!sa(b)) throw new C(this.get, 1); qc(this, function (e) { d = e.get(a); rc(d, b, c) }, c); return { cancel: function () { d && (d.onsuccess = sc) } } }; p.remove = function (a, b, c) { if (!oc(a)) throw new C(this.remove, 0); qc(this, function (d) { rc(d["delete"](a), b, c) }, c) }; p.clear = function (a, b) { qc(this, function (c) { rc(c.clear(), a, b) }, b) }; p.Gh = w.IDBTransaction && w.IDBTransaction.READ_WRITE || "readwrite";
    p.pf = function () { var a = this.b.result; a.objectStoreNames.contains("data") || a.createObjectStore("data") };
    function tc(a, b, c) { var d; a.b ? a.a ? (a.a.push(b), c && a.c.push(c)) : a.f ? c && c(a.f) : b(a.b.result) : (a.b = a.g.open(uc + a.l, 1), a.b.onupgradeneeded = a.pf, d = a.b.onerror = function () { clearTimeout(a.i); a.f = this.error; a.c.forEach(function (b) { b(a.f) }); a.a = a.c = null }, a.i = setTimeout(function () { d.call({ error: Error("DbOpenTimeoutError") }) }, 500), a.b.onsuccess = function () { clearTimeout(a.i); a.a ? (a.a.forEach(function (a) { a(this.result) }, this), a.a = a.c = null) : (a.b = a.f = null, a.a = [], a.c = []) }, a.a.push(b), c && a.c.push(c)) }
    function qc(a, b, c) { tc(a, function (c) { c = c.transaction(["data"], a.Gh); b(c.objectStore("data")) }, c) } function rc(a, b, c) { b && (a.onsuccess = function () { b(this.result) }); c && (a.onerror = function () { c(this.error) }) } function pc(a) { var b = Object.prototype.toString.call(a); return "[object Blob]" === b || "[object ArrayBuffer]" === b || ra(a) || Pa(a) } function oc(a) { return ra(a) || ab(a) } function vc() { mc || (mc = new lc("STATIC_DB")); return mc } lc.getInstance = vc; var uc = "H_";
    function wc() { var a, b, c; if (!Ta(nc)) if ("file:" === window.location.protocol && -1 < navigator.userAgent.toLowerCase().indexOf("firefox") && 128 <= window.location.href.length) nc = !1; else { a = w.indexedDB || w.webkitIndexedDB || w.mozIndexedDB || w.msIndexedDB; c = uc + "TEST_DB"; try { b = a && a.open(c, 1) } catch (d) { } nc = !!b && null === b.onupgradeneeded; b && a.deleteDatabase && a.deleteDatabase(c) } return nc } lc.isSupported = wc; function xc() { 0 != yc && (zc[this[ua] || (this[ua] = ++va)] = this); this.pb = this.pb; this.Ta = this.Ta } var yc = 0, zc = {}; xc.prototype.pb = !1; xc.prototype.J = function () { if (!this.pb && (this.pb = !0, this.D(), 0 != yc)) { var a = this[ua] || (this[ua] = ++va); delete zc[a] } }; xc.prototype.Eb = function (a, b) { this.pb ? a.call(b) : (this.Ta || (this.Ta = []), this.Ta.push(ga(b) ? ya(a, b) : a)) }; xc.prototype.D = function () { if (this.Ta) for (; this.Ta.length;)this.Ta.shift()() }; function Ac(a) { a && "function" == typeof a.J && a.J() }; function Bc(a, b) { this.type = a; this.currentTarget = this.target = b; this.a = !1; this.ah = !0 } Bc.prototype.stopPropagation = function () { this.a = !0 }; Bc.prototype.preventDefault = function () { this.ah = !1 }; r("H.util.Event", Bc); Bc.prototype.stopPropagation = Bc.prototype.stopPropagation; Bc.prototype.stopPropagation = Bc.prototype.stopPropagation; Bc.prototype.j = 1; Bc.prototype.CAPTURING_PHASE = Bc.prototype.j; Bc.prototype.i = 2; Bc.prototype.AT_TARGET = Bc.prototype.i; Bc.prototype.l = 3; Bc.prototype.BUBBLING_PHASE = Bc.prototype.l; Bc.prototype.o = 0; Bc.prototype.eventPhase = Bc.prototype.o; function Cc(a, b, c) { Cc.u.constructor.call(this, a, c); this.data = b } v(Cc, Bc); r("H.util.DataEvent", Cc); function Dc(a, b, c) { Dc.u.constructor.call(this, a, c); this.message = b } v(Dc, Bc); r("H.util.ErrorEvent", Dc); function Ec(a, b, c) { this.g = c; this.c = a; this.f = b; this.b = 0; this.a = null } Ec.prototype.get = function () { var a; 0 < this.b ? (this.b-- , a = this.a, this.a = a.next, a.next = null) : a = this.c(); return a }; function Fc(a, b) { a.f(b); a.b < a.g && (a.b++ , b.next = a.a, a.a = b) }; function Gc() { this.b = this.a = null } var Ic = new Ec(function () { return new Hc }, function (a) { a.reset() }, 100); Gc.prototype.add = function (a, b) { var c = Ic.get(); c.set(a, b); this.b ? this.b.next = c : this.a = c; this.b = c }; Gc.prototype.remove = function () { var a = null; this.a && (a = this.a, this.a = this.a.next, this.a || (this.b = null), a.next = null); return a }; function Hc() { this.next = this.b = this.a = null } Hc.prototype.set = function (a, b) { this.a = a; this.b = b; this.next = null }; Hc.prototype.reset = function () { this.next = this.b = this.a = null }; var Jc; a: { var Kc = fa.navigator; if (Kc) { var Lc = Kc.userAgent; if (Lc) { Jc = Lc; break a } } Jc = "" }; function Mc() { return -1 != Jc.indexOf("Edge") || -1 != Jc.indexOf("Trident") || -1 != Jc.indexOf("MSIE") }; function Nc() { return -1 != Jc.indexOf("Edge") }; function Oc(a) { fa.setTimeout(function () { throw a; }, 0) } var Pc;
    function Qc() {
        var a = fa.MessageChannel; "undefined" === typeof a && "undefined" !== typeof window && window.postMessage && window.addEventListener && -1 == Jc.indexOf("Presto") && (a = function () {
            var a = document.createElement("IFRAME"); a.style.display = "none"; a.src = ""; document.documentElement.appendChild(a); var b = a.contentWindow, a = b.document; a.open(); a.write(""); a.close(); var c = "callImmediate" + Math.random(), d = "file:" == b.location.protocol ? "*" : b.location.protocol + "//" + b.location.host, a = ya(function (a) {
                if (("*" == d || a.origin ==
                    d) && a.data == c) this.port1.onmessage()
            }, this); b.addEventListener("message", a, !1); this.port1 = {}; this.port2 = { postMessage: function () { b.postMessage(c, d) } }
        }); if ("undefined" !== typeof a && !Mc()) { var b = new a, c = {}, d = c; b.port1.onmessage = function () { if (ga(c.next)) { c = c.next; var a = c.$f; c.$f = null; a() } }; return function (a) { d.next = { $f: a }; d = d.next; b.port2.postMessage(0) } } return "undefined" !== typeof document && "onreadystatechange" in document.createElement("SCRIPT") ? function (a) {
            var b = document.createElement("SCRIPT"); b.onreadystatechange =
                function () { b.onreadystatechange = null; b.parentNode.removeChild(b); b = null; a(); a = null }; document.documentElement.appendChild(b)
        } : function (a) { fa.setTimeout(a, 0) }
    }; function Rc(a, b) { Sc || Tc(); Uc || (Sc(), Uc = !0); Vc.add(a, b) } var Sc; function Tc() { if (fa.Promise && fa.Promise.resolve) { var a = fa.Promise.resolve(); Sc = function () { a.then(Wc) } } else Sc = function () { var a = Wc; !sa(fa.setImmediate) || fa.Window && fa.Window.prototype && fa.Window.prototype.setImmediate == fa.setImmediate ? (Pc || (Pc = Qc()), Pc(a)) : fa.setImmediate(a) } } var Uc = !1, Vc = new Gc; function Wc() { for (var a = null; a = Vc.remove();) { try { a.a.call(a.b) } catch (b) { Oc(b) } Fc(Ic, a) } Uc = !1 }; function Xc(a, b) { this.G = Yc; this.i = void 0; this.c = this.a = this.b = null; this.f = this.g = !1; if (a == Zc) $c(this, ad, b); else try { var c = this; a.call(b, function (a) { $c(c, ad, a) }, function (a) { $c(c, bd, a) }) } catch (d) { $c(this, bd, d) } } var Yc = 0, ad = 2, bd = 3; function cd() { this.next = this.c = this.b = this.f = this.a = null; this.g = !1 } cd.prototype.reset = function () { this.c = this.b = this.f = this.a = null; this.g = !1 }; var dd = new Ec(function () { return new cd }, function (a) { a.reset() }, 100); function ed(a, b, c) { var d = dd.get(); d.f = a; d.b = b; d.c = c; return d }
    function Zc() { } function fd(a) { return new Xc(function (b, c) { c(a) }) } function gd() { var a, b, c = new Xc(function (c, e) { a = c; b = e }); return new hd(c, a, b) } Xc.prototype.then = function (a, b, c) { return id(this, sa(a) ? a : null, sa(b) ? b : null, c) }; Xc.prototype.then = Xc.prototype.then; Xc.prototype.$goog_Thenable = !0; Xc.prototype.cancel = function (a) { this.G == Yc && Rc(function () { var b = new jd(a); kd(this, b) }, this) };
    function kd(a, b) { if (a.G == Yc) if (a.b) { var c = a.b; if (c.a) { for (var d = 0, e = null, f = null, g = c.a; g && (g.g || (d++ , g.a == a && (e = g), !(e && 1 < d))); g = g.next)e || (f = g); e && (c.G == Yc && 1 == d ? kd(c, b) : (f ? (d = f, d.next == c.c && (c.c = d), d.next = d.next.next) : ld(c), md(c, e, bd, b))) } a.b = null } else $c(a, bd, b) } function nd(a, b) { a.a || a.G != ad && a.G != bd || od(a); a.c ? a.c.next = b : a.a = b; a.c = b }
    function id(a, b, c, d) { var e = ed(null, null, null); e.a = new Xc(function (a, g) { e.f = b ? function (c) { try { var e = b.call(d, c); a(e) } catch (l) { g(l) } } : a; e.b = c ? function (b) { try { var e = c.call(d, b); !ga(e) && b instanceof jd ? g(b) : a(e) } catch (l) { g(l) } } : g }); e.a.b = a; nd(a, e); return e.a } Xc.prototype.l = function (a) { this.G = Yc; $c(this, ad, a) }; Xc.prototype.j = function (a) { this.G = Yc; $c(this, bd, a) };
    function $c(a, b, c) { if (a.G == Yc) { if (a == c) b = bd, c = new TypeError("Promise cannot resolve to itself"); else { var d; if (c) try { d = !!c.$goog_Thenable } catch (e) { d = !1 } else d = !1; if (d) { a.G = 1; b = c; c = a.l; d = a.j; b instanceof Xc ? nd(b, ed(c || ka, d || null, a)) : b.then(c, d, a); return } if (ta(c)) try { var f = c.then; if (sa(f)) { pd(a, c, f); return } } catch (g) { b = bd, c = g } } a.i = c; a.G = b; a.b = null; od(a); b != bd || c instanceof jd || qd(a, c) } }
    function pd(a, b, c) { function d(b) { f || (f = !0, a.j(b)) } function e(b) { f || (f = !0, a.l(b)) } a.G = 1; var f = !1; try { c.call(b, e, d) } catch (g) { d(g) } } function od(a) { a.g || (a.g = !0, Rc(a.o, a)) } function ld(a) { var b = null; a.a && (b = a.a, a.a = b.next, b.next = null); a.a || (a.c = null); return b } Xc.prototype.o = function () { for (var a = null; a = ld(this);)md(this, a, this.G, this.i); this.g = !1 };
    function md(a, b, c, d) { if (c == bd && b.b && !b.g) for (; a && a.f; a = a.b)a.f = !1; if (b.a) b.a.b = null, rd(b, c, d); else try { b.g ? b.f.call(b.c) : rd(b, c, d) } catch (e) { sd.call(null, e) } Fc(dd, b) } function rd(a, b, c) { b == ad ? a.f.call(a.c, c) : a.b && a.b.call(a.c, c) } function qd(a, b) { a.f = !0; Rc(function () { a.f && sd.call(null, b) }) } var sd = Oc; function jd(a) { Da.call(this, a) } v(jd, Da); jd.prototype.name = "cancel"; function hd(a, b, c) { this.sf = a; this.resolve = b; this.reject = c }; function td(a, b, c) { this.type = a; this.data = b; this.$d = gd(); this.resolve = z(this.resolve, this); this.reject = z(this.reject, this); this.c = ud; c !== A && (this.c = c); this.Fe().add(this) } var ud = 1, vd = { Ni: 0, NORMAL: ud, Mi: 2 }; td.prototype.then = function (a, b, c) { return this.$d.sf.then(a, b, c) };
    Ca(td.prototype, { resolve: function (a) { this.state = 3; this.$d.resolve(a) }, reject: function (a) { this.state = 5; this.$d.reject(a) }, state: 0, cancel: function () { this.$d.sf.cancel(); 3 > this.state && (this.Sc(), this.Fe().remove(this), this.state = 4) }, Sc: ma, De: ma, Th: function (a) { this.state = this.De(a) ? 1 : 5 } }); function wd(a) { this.kc = {}; for (var b in vd) this.kc[vd[b]] = []; this.ae = a; this.ae.addEventListener("allocatable", z(this.eg, this)) } r("H.util.JobManager", wd); var xd = Object.keys(vd).map(function (a) { return vd[a] }).sort().reverse();
    Ca(wd.prototype, { add: function (a) { B(a, td, this.add, 0); this.kc[a.c].push(a); this.eg() }, contains: function (a) { return -1 < this.kc[a.c].indexOf(a) }, remove: function (a) { var b = a.c; a = this.kc[b].indexOf(a); return -1 < a ? (this.kc[b].splice(a, 1), !0) : !1 }, eg: function () { xd.forEach(function (a) { this.kc[a] = this.kc[a].filter(function (a) { var c, d; if ((c = this.ae.se(a)) !== x) d = z(this.ae.ye, this.ae, c, a), a.then(d, d), a.Th(c); else return !0 }, this) }, this) } }); function ec(a, b, c) { var d = []; 1 < arguments.length && d.push(b); 2 < arguments.length && d.push("out of [" + c[0] + "..." + c[1] + "]"); this.message = (a ? Va(a) : "") + (d.length ? " (" + d.join(" ") + ")" : ""); this.stack = Error().stack } r("H.lang.OutOfRangeError", ec); ec.prototype = Error(); ec.prototype.name = "OutOfRangeError"; var yd = "closure_listenable_" + (1E6 * Math.random() | 0); function zd(a) { return !(!a || !a[yd]) } var Ad = 0; function Bd(a, b, c, d, e) { this.listener = a; this.a = null; this.src = b; this.type = c; this.ya = !!d; this.Dd = e; this.key = ++Ad; this.Hc = this.wd = !1 } function Cd(a) { a.Hc = !0; a.listener = null; a.a = null; a.src = null; a.Dd = null }; function Dd(a) { this.src = a; this.a = {}; this.b = 0 } Dd.prototype.add = function (a, b, c, d, e) { var f = a.toString(); a = this.a[f]; a || (a = this.a[f] = [], this.b++); var g = Ed(a, b, d, e); -1 < g ? (b = a[g], c || (b.wd = !1)) : (b = new Bd(b, this.src, f, !!d, e), b.wd = c, a.push(b)); return b }; Dd.prototype.remove = function (a, b, c, d) { a = a.toString(); if (!(a in this.a)) return !1; var e = this.a[a]; b = Ed(e, b, c, d); return -1 < b ? (Cd(e[b]), Ga.splice.call(e, b, 1), 0 == e.length && (delete this.a[a], this.b--), !0) : !1 };
    function Fd(a, b) { var c = b.type; if (!(c in a.a)) return !1; var d = a.a[c], e = Ha(d, b), f; (f = 0 <= e) && Ga.splice.call(d, e, 1); f && (Cd(b), 0 == a.a[c].length && (delete a.a[c], a.b--)); return f } Dd.prototype.Ea = function (a) { a = a && a.toString(); var b = 0, c; for (c in this.a) if (!a || c == a) { for (var d = this.a[c], e = 0; e < d.length; e++)++b, Cd(d[e]); delete this.a[c]; this.b-- } return b }; function Ed(a, b, c, d) { for (var e = 0; e < a.length; ++e) { var f = a[e]; if (!f.Hc && f.listener == b && f.ya == !!c && f.Dd == d) return e } return -1 }; var Gd = -1 != Jc.indexOf("Opera") || -1 != Jc.indexOf("OPR"), Hd = Mc(), Id = -1 != Jc.indexOf("Gecko") && !(-1 != Jc.toLowerCase().indexOf("webkit") && !Nc()) && !(-1 != Jc.indexOf("Trident") || -1 != Jc.indexOf("MSIE")) && !Nc(), Jd = -1 != Jc.toLowerCase().indexOf("webkit") && !Nc(); function Kd() { var a = Jc; if (Id) return /rv\:([^\);]+)(\)|;)/.exec(a); if (Hd && Nc()) return /Edge\/([\d\.]+)/.exec(a); if (Hd) return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a); if (Jd) return /WebKit\/(\S+)/.exec(a) }
    function Ld() { var a = fa.document; return a ? a.documentMode : void 0 } var Md = function () { if (Gd && fa.opera) { var a = fa.opera.version; return sa(a) ? a() : a } var a = "", b = Kd(); b && (a = b ? b[1] : ""); return Hd && !Nc() && (b = Ld(), b > parseFloat(a)) ? String(b) : a }(), Nd = {};
    function Od(a) { var b; if (!(b = Nd[a])) { b = 0; for (var c = Ea(String(Md)).split("."), d = Ea(String(a)).split("."), e = Math.max(c.length, d.length), f = 0; 0 == b && f < e; f++) { var g = c[f] || "", h = d[f] || "", k = /(\d*)(\D*)/g, l = /(\d*)(\D*)/g; do { var m = k.exec(g) || ["", "", ""], n = l.exec(h) || ["", "", ""]; if (0 == m[0].length && 0 == n[0].length) break; b = Fa(0 == m[1].length ? 0 : parseInt(m[1], 10), 0 == n[1].length ? 0 : parseInt(n[1], 10)) || Fa(0 == m[2].length, 0 == n[2].length) || Fa(m[2], n[2]) } while (0 == b) } b = Nd[a] = 0 <= b } return b }
    var Pd = fa.document, Qd = Ld(), Rd = !Pd || !Hd || !Qd && Nc() ? void 0 : Qd || ("CSS1Compat" == Pd.compatMode ? parseInt(Md, 10) : 5); var Td; (Td = !Hd) || (Td = Hd && (Nc() || 9 <= Rd)); var Ud = Td, Vd = Hd && !Od("9"); !Jd || Od("528"); Id && Od("1.9b") || Hd && Od("8") || Gd && Od("9.5") || Jd && Od("528"); Id && !Od("8") || Hd && Od("9"); function Wd(a) { Wd[" "](a); return a } Wd[" "] = ka; function Xd(a, b) { Bc.call(this, a ? a.type : ""); this.currentTarget = this.target = null; this.keyCode = 0; this.b = this.state = null; if (a) { this.type = a.type; this.target = a.target || a.srcElement; this.currentTarget = b; var c = a.relatedTarget; if (c && Id) try { Wd(c.nodeName) } catch (d) { } this.keyCode = a.keyCode || 0; this.state = a.state; this.b = a; a.defaultPrevented && this.preventDefault() } } v(Xd, Bc);
    Xd.prototype.stopPropagation = function () { Xd.u.stopPropagation.call(this); this.b.stopPropagation ? this.b.stopPropagation() : this.b.cancelBubble = !0 }; Xd.prototype.preventDefault = function () { Xd.u.preventDefault.call(this); var a = this.b; if (a.preventDefault) a.preventDefault(); else if (a.returnValue = !1, Vd) try { if (a.ctrlKey || 112 <= a.keyCode && 123 >= a.keyCode) a.keyCode = -1 } catch (b) { } }; var Yd = "closure_lm_" + (1E6 * Math.random() | 0), Zd = {}, $d = 0; function ae(a, b, c, d, e) { if (pa(b)) { for (var f = 0; f < b.length; f++)ae(a, b[f], c, d, e); return null } c = be(c); return zd(a) ? a.Ob.add(String(b), c, !1, d, e) : ce(a, b, c, !1, d, e) } function ce(a, b, c, d, e, f) { if (!b) throw Error("Invalid event type"); var g = !!e, h = de(a); h || (a[Yd] = h = new Dd(a)); c = h.add(b, c, d, e, f); if (c.a) return c; d = ee(); c.a = d; d.src = a; d.listener = c; a.addEventListener ? a.addEventListener(b.toString(), d, g) : a.attachEvent(fe(b.toString()), d); $d++; return c }
    function ee() { var a = ge, b = Ud ? function (c) { return a.call(b.src, b.listener, c) } : function (c) { c = a.call(b.src, b.listener, c); if (!c) return c }; return b } function he(a, b, c, d, e) { if (pa(b)) { for (var f = 0; f < b.length; f++)he(a, b[f], c, d, e); return null } c = be(c); return zd(a) ? a.Ob.add(String(b), c, !0, d, e) : ce(a, b, c, !0, d, e) }
    function ie(a, b, c, d, e) { if (pa(b)) { for (var f = 0; f < b.length; f++)ie(a, b[f], c, d, e); return null } c = be(c); if (zd(a)) return a.Ob.remove(String(b), c, d, e); if (!a) return !1; if (a = de(a)) if (b = a.a[b.toString()], a = -1, b && (a = Ed(b, c, !!d, e)), c = -1 < a ? b[a] : null) return je(c); return !1 }
    function je(a) { if ("number" == typeof a || !a || a.Hc) return !1; var b = a.src; if (zd(b)) return Fd(b.Ob, a); var c = a.type, d = a.a; b.removeEventListener ? b.removeEventListener(c, d, a.ya) : b.detachEvent && b.detachEvent(fe(c), d); $d--; (c = de(b)) ? (Fd(c, a), 0 == c.b && (c.src = null, b[Yd] = null)) : Cd(a); return !0 } function fe(a) { return a in Zd ? Zd[a] : Zd[a] = "on" + a } function ke(a, b, c, d) { var e = !0; if (a = de(a)) if (b = a.a[b.toString()]) for (b = b.concat(), a = 0; a < b.length; a++) { var f = b[a]; f && f.ya == c && !f.Hc && (f = le(f, d), e = e && !1 !== f) } return e }
    function le(a, b) { var c = a.listener, d = a.Dd || a.src; a.wd && je(a); return c.call(d, b) }
    function ge(a, b) {
        if (a.Hc) return !0; if (!Ud) { var c = b || ja("window.event"), d = new Xd(c, this), e = !0; if (!(0 > c.keyCode || void 0 != c.returnValue)) { a: { var f = !1; if (0 == c.keyCode) try { c.keyCode = -1; break a } catch (g) { f = !0 } if (f || void 0 == c.returnValue) c.returnValue = !0 } c = []; for (f = d.currentTarget; f; f = f.parentNode)c.push(f); for (var f = a.type, h = c.length - 1; !d.a && 0 <= h; h--) { d.currentTarget = c[h]; var k = ke(c[h], f, !0, d), e = e && k } for (h = 0; !d.a && h < c.length; h++)d.currentTarget = c[h], k = ke(c[h], f, !1, d), e = e && k } return e } return le(a, new Xd(b,
            this))
    } function de(a) { a = a[Yd]; return a instanceof Dd ? a : null } var me = "__closure_events_fn_" + (1E9 * Math.random() >>> 0); function be(a) { if (sa(a)) return a; a[me] || (a[me] = function (b) { return a.handleEvent(b) }); return a[me] }; function I() { xc.call(this); this.Ob = new Dd(this); this.ph = this; this.Me = null } v(I, xc); I.prototype[yd] = !0; p = I.prototype; p.jb = function () { return this.Me }; p.ia = function (a) { this.Me = a }; p.addEventListener = function (a, b, c, d) { ae(this, a, b, c, d) }; p.removeEventListener = function (a, b, c, d) { ie(this, a, b, c, d) };
    p.dispatchEvent = function (a) { var b, c = this.jb(); if (c) for (b = []; c; c = c.jb())b.push(c); var c = this.ph, d = a.type || a; if (ra(a)) a = new Bc(a, c); else if (a instanceof Bc) a.target = a.target || c; else { var e = a; a = new Bc(d, c); Ca(a, e) } var e = !0, f; if (b) for (var g = b.length - 1; !a.a && 0 <= g; g--)f = a.currentTarget = b[g], e = f.dc(d, !0, a) && e; a.a || (f = a.currentTarget = c, e = f.dc(d, !0, a) && e, a.a || (e = f.dc(d, !1, a) && e)); if (b) for (g = 0; !a.a && g < b.length; g++)f = a.currentTarget = b[g], e = f.dc(d, !1, a) && e; return e };
    p.D = function () { I.u.D.call(this); this.Ob && this.Ob.Ea(void 0); this.Me = null }; p.dc = function (a, b, c) { a = this.Ob.a[String(a)]; if (!a) return !0; a = a.concat(); for (var d = !0, e = 0; e < a.length; ++e) { var f = a[e]; if (f && !f.Hc && f.ya == b) { var g = f.listener, h = f.Dd || f.src; f.wd && Fd(this.Ob, f); d = !1 !== g.call(h, c) && d } } return d && 0 != c.ah }; r("H.util.EventTarget", I); I.prototype.ia = I.prototype.ia; I.prototype.setParentEventTarget = I.prototype.ia; I.prototype.jb = I.prototype.jb; I.prototype.getParentEventTarget = I.prototype.jb; I.prototype.addEventListener = I.prototype.addEventListener; I.prototype.addEventListener = I.prototype.addEventListener; I.prototype.removeEventListener = I.prototype.removeEventListener; I.prototype.removeEventListener = I.prototype.removeEventListener; I.prototype.dispatchEvent = I.prototype.dispatchEvent;
    I.prototype.dispatchEvent = I.prototype.dispatchEvent; I.prototype.J = I.prototype.J; I.prototype.dispose = I.prototype.J; I.prototype.Eb = I.prototype.Eb; I.prototype.addOnDisposeCallback = I.prototype.Eb; I.prototype.th = I.prototype.dc;
    I.prototype.dc = function (a, b, c) { var d, e, f, g = !0; d = c[c.currentTarget === c.target ? "AT_TARGET" : b ? "CAPTURING_PHASE" : (e = !0, "BUBBLING_PHASE")]; if (!e || "pointerenter" !== (f = c.type) && "pointerleave" !== f) c.eventPhase = d, g = I.prototype.th.apply(this, arguments), e && this.jb && null === this.jb() && delete c.eventPhase; return g }; function ne(a) { a = a || {}; var b = a.callback; this.a = a.label; sa(b) && (this.callback = b); this.g = !!a.disabled; ne.u.constructor.call(this) } v(ne, I); r("H.util.ContextItem", ne); ne.prototype.b = function () { return this.a }; ne.prototype.getLabel = ne.prototype.b; ne.prototype.Sa = function (a) { this.a !== a && (this.a = a, this.dispatchEvent("update")); return this }; ne.prototype.setLabel = ne.prototype.Sa; ne.prototype.c = function () { return this.g }; ne.prototype.isDisabled = ne.prototype.c;
    ne.prototype.qa = function (a) { a ^ this.g && (this.g = a, this.dispatchEvent("update")); return this }; ne.prototype.setDisabled = ne.prototype.qa; var oe = new ne; ne.SEPARATOR = oe; function pe() { if (w.document) { var a = document.createElement("canvas"); a.width = a.height = 1; return a.getContext("2d") } return null } var qe = /^rgba\(([^,]+),([^,]+),([^,]+),([^)]+)\)$/;
    function re(a) { var b = se[a], c = w.RegExp; b || (w.Uint8ClampedArray || (w.Uint8ClampedArray = function (a) { return a instanceof Number ? Array(a) : a.map(function (a) { return Qb(nb(a), 0, 255) }) }), "none" === a ? b = new Uint8ClampedArray([0, 0, 0, 0]) : (te.fillStyle = "black", te.fillStyle = a, qe.test(te.fillStyle) ? b = new Uint8ClampedArray([c.$1, c.$2, c.$3, 255 * c.$4]) : (te.clearRect(0, 0, 1, 1), te.fillRect(0, 0, 1, 1), b = te.getImageData(0, 0, 1, 1).data)), se[a] = b); return b } function ue(a) { return "none" !== a && 0 < re(a)[3] } var se = Ka(), ve = !!w.VBArray;
    r("H.util.eval", function (a) { return eval(a) }); function we(a, b) { return a !== A ? a : b } function xe(a) { return /^<svg/.test(a) ? "data:image/svg+xml;charset=utf-8," + encodeURIComponent(a) : a } r("H.util.provide", function (a) { ha(a, void 0) }); function ye() { this.xb = 0 } ye.prototype.next = function (a) { if (4294967295 === this.xb) throw new ec(a, this.xb, [0, 4294967295]); return this.xb++ }; var ze = new ye, Ae = z(ze.next, ze); function Be() { return !0 } function Ce() { return !1 } function sc() { } var De = Na([]);
    function Ee(a) { return "CANVAS" === a.tagName ? [a] : a.getElementsByTagName("CANVAS") } function Fe(a, b, c) { var d; b = a.ownerDocument === b ? a.cloneNode(!0) : b.importNode(a, !0); if (c) for (a = Ee(a), c = Ee(b), d = c.length; d--;)c[d].getContext("2d").drawImage(a[d], 0, 0); return b } function Ge(a) { a.parentNode.removeChild(a) } var te = pe(), He = pe(); function Ie(a) { var b = a.complete, c = 0 < a.naturalWidth; if (b && !c && ve) try { He.drawImage(a, 0, 0), c = !0 } catch (d) { } return b && c } var Je = w.BlobBuilder || w.WebKitBlobBuilder || w.MozBlobBuilder;
    function Ke(a, b) { var c = b || "", d; Je ? (d = new Je, d.append(a), c = d.getBlob(c)) : c = new Blob([a], { type: c }); return c }; function Le() { } r("H.map.provider.Invalidations", Le); Le.MARK_INITIAL = Mb; Le.prototype.c = function (a, b) { b !== Me.NONE && (this.a = a, b & Me.SPATIAL && (this.m = a), b & Me.VISUAL && (this.v = a), b & Me.ADD && (this.l = a), b & Me.REMOVE && (this.o = a), b & Me.Z_ORDER && (this.s = a)) }; Le.prototype.update = Le.prototype.c; Le.prototype.B = function () { return this.a }; Le.prototype.getMark = Le.prototype.B; Le.prototype.a = Mb; Le.prototype.A = function (a) { return this.a > a }; Le.prototype.isAny = Le.prototype.A; Le.prototype.v = Mb;
    Le.prototype.b = function (a) { return this.v > a }; Le.prototype.isVisual = Le.prototype.b; Le.prototype.m = Mb; Le.prototype.g = function (a) { return this.m > a }; Le.prototype.isSpatial = Le.prototype.g; Le.prototype.l = Mb; Le.prototype.j = function (a) { return this.l > a }; Le.prototype.isAdd = Le.prototype.j; Le.prototype.o = Mb; Le.prototype.f = function (a) { return this.o > a }; Le.prototype.isRemove = Le.prototype.f; Le.prototype.s = Mb; Le.prototype.i = function (a) { return this.s > a }; Le.prototype.isZOrder = Le.prototype.i;
    var Me = { NONE: 0, VISUAL: 1, SPATIAL: 2, ADD: 4, REMOVE: 8, Z_ORDER: 16 }; Le.Flag = Me; function Ne(a, b, c) { Ne.u.constructor.call(this, a); this.oldValue = c; this.newValue = b } v(Ne, Bc); r("H.util.ChangeEvent", Ne); function K(a) { var b; Ua(this, K); K.u.constructor.call(this); this.zb = Oe.next(); a && (b = "min", ab(a[b]) && (this.Ga = a[b]), b = "max", ab(a[b]) && (this.ea = a[b]), b = "visibility", b in a && (this.T = !!a[b]), b = "zIndex", b in a && (this.I = +a[b] || 0), b = "provider", b in a && (this.l = a[b], this.ua(Me.ADD)), b = "data", b in a && this.g(a[b])) } v(K, I); r("H.map.Object", K); var Oe = new ye, Pe = { ANY: 0, OVERLAY: 1, SPATIAL: 2, MARKER: 3, DOM_MARKER: 4, GROUP: 5 }; K.Type = Pe; K.prototype.yb = { Hh: "visibilitychange", Ih: "zindexchange" }; K.prototype.ta = function () { return this.zb };
    K.prototype.getId = K.prototype.ta; K.prototype.Ga = -1 / 0; K.prototype.ea = 1 / 0; K.prototype.Ld = function () { return this.ea }; K.prototype.getMax = K.prototype.Ld; K.prototype.Xd = function () { return this.Ga }; K.prototype.getMin = K.prototype.Xd; K.prototype.T = !0; K.prototype.setVisibility = function (a) { var b = this.T; (a = !!a) ^ b && (this.T = a, this.invalidate(Me.VISUAL), this.dispatchEvent(new Ne(this.yb.Hh, a, b))); return this }; K.prototype.setVisibility = K.prototype.setVisibility;
    K.prototype.getVisibility = function (a) { for (var b = this, c; (c = b.T) && a && (b = b.Da);); return c }; K.prototype.getVisibility = K.prototype.getVisibility; K.prototype.I = A; K.prototype.he = function () { return this.I }; K.prototype.getZIndex = K.prototype.he; K.prototype.Ha = function (a) { var b = this.I; a !== b && (this.K(), this.I = a, this.invalidate(Me.Z_ORDER), this.dispatchEvent(new Ne(this.yb.Ih, a, b))); return this }; K.prototype.setZIndex = K.prototype.Ha; K.prototype.U = A;
    function Qe(a) { var b = a.U, c, d, e; b || (c = (d = a.I) !== A, (b = a.Da) ? (b = Qe(b).slice(), b[0] |= c) : b = [c | 0], b.push(d || 0, (e = a.fh) !== A ? e : a.zb), a.U = b); return b } K.prototype.K = function () { this.U = A }; function Re(a, b, c) { if (!c || a[0] | b[0]) for (var d = a.length, e = b.length, f = lb(d, e), g, h = 1, k = 1 + c; h < f; h += k)if (g = a[h] - b[h]) return g; return c ? 0 : d - e } function Se(a, b) { return a.Xa(b) } K.compareZOrder = Se; K.prototype.Xa = function (a) { return this.je - a.je || Re(Qe(this), Qe(a), !1) }; K.prototype.compareZOrder = K.prototype.Xa; p = K.prototype;
    p.previousSibling = x; p.nextSibling = x; p.fh = A; p.Da = x; p.Zh = function () { return this.Da }; K.prototype.getParentGroup = K.prototype.Zh; K.prototype.ee = function () { for (var a = this, b; b = a.Da;)a = b; return a }; K.prototype.getRootGroup = K.prototype.ee; K.prototype.contains = function (a) { return this === a }; K.prototype.contains = K.prototype.contains; K.prototype.ia = function (a) { if (this.Da) throw new kc(this.ia, "Not allowed for a child of a group"); K.u.ia.call(this, a) }; K.prototype.setParentEventTarget = K.prototype.ia;
    K.prototype.l = x; K.prototype.Pa = function () { return this.l }; K.prototype.getProvider = K.prototype.Pa; K.prototype.F = function (a, b) { var c = this.l, d, e; if (d = c !== a) { if (b && (c && !B(c, L) || a && !B(a, L))) throw new kc(b, "Only LocalObjectProvider allows an object transfers"); e = this.type !== Pe.GROUP; c && (this.invalidate(Me.REMOVE), e && c.a(this)); if (this.l = a) e && a.V(this), this.Fb = x, this.invalidate(Me.ADD) } return d }; K.prototype.j = function () { return this.Fb || (this.Fb = new Le) }; K.prototype.getInvalidations = K.prototype.j;
    K.prototype.ua = function (a) { var b = this.Pa(), c; (c = !!b) && b.invalidateObject(this, a); return c }; K.prototype.invalidate = K.prototype.ua; K.prototype.D = function () { this.Da && this.Da.a(this); K.u.D.call(this) }; K.prototype.getData = function () { return this.P }; K.prototype.getData = K.prototype.getData; K.prototype.g = function (a) { this.P = a; return this }; K.prototype.setData = K.prototype.g; function G(a, b, c, d) { Te(this, Wb(a, G, 0), Xb(b, G, 1), Wb(c, G, 2), Xb(d, G, 3)) } v(G, bc); r("H.geo.Rect", G); G.prototype.qd = "POLYGON"; G.prototype.Lb = function (a) { var b = this.ka, c = this.ga, d = this.ja, e = this.ha; a.push("(", c, " ", b, ",", e, " ", b, ",", e, " ", d, ",", c, " ", d, ",", c, " ", b, ")"); return a }; G.prototype.pa = function (a) { return this === a || !!a && this.ka === a.ka && this.ga === a.ga && this.ja === a.ja && this.ha === a.ha }; G.prototype.equals = G.prototype.pa; G.prototype.clone = function () { return new G(this.ka, this.ga, this.ja, this.ha) };
    G.prototype.clone = G.prototype.clone; function Te(a, b, c, d, e) { a.ga = c; a.ha = e; b < d && (c = b, b = d, d = c); a.ka = b; a.ja = d; a.i = a.f = a.o = null; return a } G.prototype.tb = function () { this.i || (this.i = new gc(this.ka, this.ga)); return this.i }; G.prototype.getTopLeft = G.prototype.tb; G.prototype.rb = function () { this.f || (this.f = new gc(this.ja, this.ha)); return this.f }; G.prototype.getBottomRight = G.prototype.rb; G.prototype.F = function () { return this.ka }; G.prototype.getTop = G.prototype.F; G.prototype.s = function () { return this.ja };
    G.prototype.getBottom = G.prototype.s; G.prototype.B = function () { return this.ga }; G.prototype.getLeft = G.prototype.B; G.prototype.A = function () { return this.ha }; G.prototype.getRight = G.prototype.A; G.prototype.Oa = function () { this.o || (this.o = new gc(this.ja + (this.ka - this.ja) / 2, Ue(this.ga, this.ab()))); return this.o }; G.prototype.getCenter = G.prototype.Oa; G.prototype.ab = function () { return Ve(this.ga, this.ha) }; G.prototype.getWidth = G.prototype.ab; G.prototype.c = function () { return this.ka - this.ja };
    G.prototype.getHeight = G.prototype.c; G.prototype.g = function () { return this.ga > this.ha }; G.prototype.isCDB = G.prototype.g; G.prototype.ed = function () { return !this.ab() && !this.c() }; G.prototype.isEmpty = G.prototype.ed; G.prototype.S = function () { return new G(this.ka, this.ga, this.ja, this.ha) }; G.prototype.l = function (a, b, c) { var d = this.Oa(); c || (a = Wb(a, this.l, 0), b = Xb(b, this.l, 1)); b = this.b(a, b, c); a = b.Oa(); return a.lat === d.lat && a.lng === d.lng && this.c() === b.c() && this.ab() === b.ab() }; G.prototype.containsLatLng = G.prototype.l;
    G.prototype.Vc = function (a, b) { b || hc(a, this.Vc, 0); return this.l(a.lat, a.lng, b) }; G.prototype.containsPoint = G.prototype.Vc; G.prototype.j = function (a, b) { var c = this.Oa(), d, e; if (!b && !B(a, G)) throw new C(this.j, 0, a); e = this.wb(a, b); d = e.Oa(); return d.lat === c.lat && d.lng === c.lng && this.c() === e.c() && this.ab() === e.ab() }; G.prototype.containsRect = G.prototype.j;
    G.prototype.b = function (a, b, c, d) { if (!c) { if (D(a = Wb(a))) throw new C(this.b, 0, a); if (D(b = Xb(b))) throw new C(this.b, 1, b); } return We(this.ka, this.ga, this.ja, this.ha, a, b, a, b, d) }; G.prototype.mergeLatLng = G.prototype.b; G.prototype.m = function (a, b, c) { b || hc(a, this.m, 0); return this.b(a.lat, a.lng, b, c) }; G.prototype.mergePoint = G.prototype.m; G.prototype.wb = function (a, b, c) { if (!b && !B(a, G)) throw new C(this.wb, 0, a); return We(this.ka, this.ga, this.ja, this.ha, a.ka, a.ga, a.ja, a.ha, c) }; G.prototype.mergeRect = G.prototype.wb;
    G.prototype.a = function (a, b, c, d, e, f) { e || (a = Wb(a, this.a, 0), b = Xb(b, this.a, 1), c = Wb(c, this.a, 2), d = Xb(d, this.a, 3)); return We(this.ka, this.ga, this.ja, this.ha, a, b, c, d, f) }; G.prototype.mergeTopLeftBottomRight = G.prototype.a; G.prototype.xc = function (a, b) { if (!b && !B(a, G)) throw new C(this.xc, 0, a); var c = this.ga <= this.ha, d = a.ga <= a.ha, e = this.ga < a.ha, f = a.ga < this.ha; return this.ja <= a.ka && a.ja <= this.ka && (!c && (!d || e || f) || !d && (e || f) || e && f) }; G.prototype.intersects = G.prototype.xc;
    function Ve(a, b) { var c = b - a; return c + (0 > c ? 360 : 0) } function Ue(a, b) { var c = a + b / 2; return c - (180 < c ? 360 : 0) } function We(a, b, c, d, e, f, g, h, k) { var l, m, n; c = lb(c, g); a = mb(a, e); e = Ve(b, d); l = Ue(b, e); g = Ve(f, h); n = Ue(f, g) - l; n += 0 > n - 1E-6 ? 360 : 0; 180 > n - 1E-6 ? (l = b, m = h) : (n = 360 - n, l = f, m = d); n = n + e / 2 + g / 2; 360 <= n + 5E-7 ? (l = -180, m = 180) : n - 5E-7 < e ? (l = b, m = d) : n - 5E-7 < g && (l = f, m = h); return k ? Te(k, a, l, c, m) : new G(a, l, c, m) } G.merge = We; function Xe(a, b, c) { c || (hc(a, Xe, 0), hc(b, Xe, 1)); return new G(a.lat, a.lng, b.lat, b.lng) } G.fromPoints = Xe;
    function fc(a, b) { if (!qa(a)) throw new C(fc, 0, a); var c = 1, d = a.length, e, f = null; if (0 < d) for (e = a[0], f = Xe(e, e, b); c < d; c++)e = a[c], f.b(e.lat, e.lng, b, f); return f } G.coverPoints = fc; function Ye(a, b) { if (!(b || a && null != a.length)) throw new C(Ye, 0, a); var c = 3, d = a.length, e; if (0 < d) for (e = new G(a[0], a[1], a[0], a[1]); c < d; c += 3)e.b(a[c], a[c + 1], b, e); return e } G.coverLatLngAlts = Ye;
    function Ze(a, b) { if (b && (!a || null == a.length)) throw new C(Ze, 0, a); var c = 1, d = a.length, e; if (0 < d) for (e = new G(a[0].ka, a[0].ga, a[0].ja, a[0].ha); c < d; c++)e.wb(a[c], b, e); return e } G.coverRects = Ze;
    G.prototype.v = function (a, b) { hc(a, this.v, 0); var c = this.ga, d = this.ka, e = this.ha, f = this.ja, g = this.Oa().lng, h = a.lat - f - (d - f) / 2, k = a.lng - g, k = 180 < k || -180 > k ? -(g + a.lng) : k, c = c + (0 > k ? 2 * k : 0), c = -180 > c ? 360 + c : c, e = e + (0 < k ? 2 * k : 0), e = 180 < e ? e - 360 : e, d = 0 < h ? d + 2 * h : d; 90 <= d && (d = 90); f = 0 > h ? f + 2 * h : f; -90 >= f && (f = -90); return b ? Te(b, d, c, f, e) : new G(d, c, f, e) }; G.prototype.resizeToCenter = G.prototype.v; function $e(a, b, c, d, e) { this.j = a || 10; this.a = this.b = this.l = null; this.c = d || 0; this.f = e || 0; this.g = b || 1; this.i = c || 1; this.a = this.l = new af(null, 0, this.c - this.g, this.f - this.i, this.c + this.g, this.f + this.i); this.b = null } function bf(a, b) { for (var c, d, e, f, g, h, k, l = 0, m, n, q = 4, t; q--;) { t = q + 4; g = []; c = +!(q % 3); h = b[q]; for (m = (d = a[q]).length; m--;) { e = d[m]; if (f = e.Y) for (n = f.length; n--;)((k = f[n][q]) > h) - c && (h = k); for (n = 4; n--;)if (f = e[n]) c ? f[t] < h && g.push(f) : f[t] > h && g.push(f) } l += g.length; b[q] = h; a[q] = g } l && (b = bf(a, b)); return b }
    $e.prototype.remove = function (a) { var b, c = a.a, d = c.Y; if (d && (b = d.indexOf(a), -1 !== b && (d.splice(b, 1), !d.length))) { delete c.Y; for (var e = this.a; (d = c.a) && !(c.Y || c[0] || c[1] || c[2] || c[3]);)c === e && (e = d), delete c.a, delete d[c.b], c = d; this.a = e; cf(this) } (b = 0 <= b) && df(this, a, !1); return b }; function df(a, b, c) { var d, e; if (d = a.b) for (e = 4; e--;)if (e % 3 ? b[e] >= d[e] : b[e] <= d[e]) if (c) d[e] = b[e]; else { a.b = null; break } }
    function ef(a, b, c, d, e, f, g) { var h = b[8], k = b[9]; if (g && (e < h || e < b[5] && c >= h) && (f < k || f < b[6] && d >= k)) { var l = ef, h = (d >= k ? 2 : 0) | c >= h; b = b[h] || (b[h] = new af(b, h)); c = l(a, b, c, d, e, f, g - 1) } else c = new ff(b, c, d, e, f), (b.Y || (b.Y = [])).push(c), df(a, c, !0), cf(a, b); return c } function cf(a, b) { var c = a.a, d; if (b) { if (d = b, d !== c) for (c = d; d = d.a;)if (d.Y || 3 > !d[0] + !d[1] + !d[2] + !d[3]) c = d } else for (; !c.Y && 2 < !c[0] + !c[1] + !c[2] + !c[3];)if (d = c[0] || c[1] || c[2] || c[3]) c = d; else break; a.a = c }
    $e.prototype.bb = function (a, b, c, d) { var e = []; gf(this, this.a, e, a, b, c, d); return e }; function gf(a, b, c, d, e, f, g) { var h, k, l = b.Y; k = b[7]; var m = b[8], n = b[5], q = b[4], t = b[9], u = b[6], y; if (l) if (h = l.length, d > k || f < n || e > q || g < u) for (; h--;)k = l[h], n = k[3], q = k[0], u = k[1], y = k[2], n > f || u < d || q > g || y < e || c.push(k); else for (; h--;)c.push(l[h]); f >= m && (e <= t && b[1] && gf(a, b[1], c, d, e, f, g), g >= t && b[3] && gf(a, b[3], c, d, e, f, g)); d <= m && (e <= t && b[0] && gf(a, b[0], c, d, e, f, g), g >= t && b[2] && gf(a, b[2], c, d, e, f, g)) }
    function af(a, b, c, d, e, f) { a ? (this.a = a, this.b = b, b & 1 ? (c = a[8], e = a[5]) : (c = a[7], e = a[8]), b & 2 ? (d = a[9], f = a[6]) : (d = a[4], f = a[9])) : this.b = this.a = null; this[7] = c; this[5] = e; this[8] = (c + e) / 2; this[4] = d; this[6] = f; this[9] = (d + f) / 2 } function ff(a, b, c, d, e) { this.id = ++hf; this.a = a; this[0] = c; this[1] = d; this[2] = e; this[3] = b } var hf = 0; function jf(a) { this.i = new $e(+a || 10, 180, 90, 0, 0); this.g = []; this.b = this.f = this.a = null } jf.prototype.c = 0;
    jf.prototype.S = function () { var a, b, c; if (!this.a) { c = []; var d; if (d = !this.f) { a = this.i; var e; !(e = a.b) && (d = a.a, d.Y || d[0] || d[1] || d[2] || d[3]) && (e = [d], e = bf([e, e, e, e], [d[6], d[7], d[4], d[5]]), a.b = e); d = a = e } d && (this.f = new G(-a[0], a[3], -a[2], a[1])); (b = this.f) && c.push(b); var f, g, h, k; if (!this.b && (k = (g = this.g).length)) { a = 90; d = 360; e = -90; for (f = 0; k--;)h = g[k], a = lb(a, h[0]), d = lb(d, h[3]), e = mb(e, h[2]), f = mb(f, h[1]); this.b = new G(-a, d, -e, f - 360) } (b = this.b) && c.push(b); if (b = c[0]) c[1] && (b = b.wb(c[1], !0)), this.a = b } return this.a };
    function kf(a, b, c, d, e, f) { f ? (f = new ff(null, e, -b, c + 360, -d), a.g.push(f), a.b && a.b.a(b, c, d, e, !0, a.b)) : (f = a.i, f = ef(f, f.l, c, -b, e, -d, f.j), a.f && a.f.a(b, c, d, e, !0, a.f)); ++a.c; a.a = null; return f } jf.prototype.remove = function (a) { var b, c = !1; if (a.a) c = this.i.remove(a), this.f = null; else if (a = (b = this.g).indexOf(a), c = 0 <= a) b.splice(a, 1), this.b = null; c && (--this.c, this.a = null); return c };
    function lf(a, b, c, d, e) { a = a.g; var f = a.length, g, h = [], k, l; if (f) for (k = c + 360, l = e + 360; f--;)g = a[f], mf(g, b, c, d, e) ? h.push(g) : mf(g, b, k, d, l) && h.push(g); return h } function mf(a, b, c, d, e) { var f = a[0], g = a[1], h = a[2]; return !(a[3] > e || g < c || f > d || h < b) } function nf(a, b) { var c, d, e, f; if (d = b.length) { c = a.length; for (e = {}; c--;)e[a[c].id] = 1; for (; d--;)(f = b[d]).id in e || a.push(f) } }
    function of(a, b) { var c = a.i, d = b.tb(), e = b.rb(), f = -d.lat, d = d.lng, g = -e.lat, e = e.lng, h; b.g() ? (h = c.bb(-180, f, e, g), nf(h, c.bb(d, f, 180, g)), nf(h, lf(a, f, e, g, d + 360))) : (h = c.bb(d, f, e, g), nf(h, lf(a, f, d, g, e))); return h }; function F(a, b) { F.u.constructor.call(this); a && pf(a, F, 0); this.na = a || []; this.j = b; this.b = qf(this, 0, this.na.length) } v(F, bc); r("H.geo.LineString", F); function qf(a, b, c) { a = a.na; var d = 0; b = mb(b, 0); c = lb(c, a.length); c -= 2; for (b += 1; b < c;)d += tf(a[b], a[b += 3]); return d } F.prototype.o = function (a, b, c) { uf(this, a, b, c, this.o) }; F.prototype.pushLatLngAlt = F.prototype.o;
    function uf(a, b, c, d, e) { var f = a.na.length; b = Wb(b, e); c = Xb(c, e); a.na.push(Wb(b, e), Xb(c, e), d === A ? 0 : Yb(d, e)); f && (a.b += tf(a.na[f - 2], c)); delete a.a; delete a.m } F.prototype.i = function (a, b, c) { c && pf(c, this.i, 2); var d; void 0 === b && (b = this.na.length); b && (this.b -= qf(this, a - 3, a + b + 3)); d = c ? this.na.splice.apply(this.na, [a, b].concat(c)) : this.na.splice(a, b); c && (this.b += qf(this, a - 3, a + c.length + 3)); b && !c && (this.b += qf(this, a - 3, a - 3)); delete this.a; delete this.m; return d }; F.prototype.spliceLatLngAlts = F.prototype.i;
    F.prototype.v = function (a, b, c, d) { this.i(a, 0, [b, c, d]) }; F.prototype.insertLatLngAlt = F.prototype.v; F.prototype.s = function (a) { this.i(a, 3) }; F.prototype.removeLatLngAlt = F.prototype.s; F.prototype.c = function (a) { uf(this, a.lat, a.lng, a.alt, this.c) }; F.prototype.pushPoint = F.prototype.c; F.prototype.C = function (a, b) { this.v(3 * a, b.lat, b.lng, b.alt) }; F.prototype.insertPoint = F.prototype.C; F.prototype.N = function (a) { this.s(3 * a) }; F.prototype.removePoint = F.prototype.N;
    F.prototype.g = function (a, b) { var c = this.na, d = 3 * a, e = c[d], f = c[d + 1], c = c[d + 2]; b && (b.lat = e, b.lng = f, b.alt = c, void 0 !== c && this.j && (b.ctx = this.j)); return b || new gc(e, f, c, null != c ? this.j : void 0) }; F.prototype.extractPoint = F.prototype.g; F.prototype.B = function (a, b, c) { var d = this.na; b = b || 0; c = we(c, d.length / 3); for (var e = 3 * b; b < c;)a(d[e++], d[e++], d[e++], b++) }; F.prototype.eachLatLngAlt = F.prototype.B; var tf = ac; F.isDBC = tf; F.prototype.l = function (a) { var b = this.b; a && (a = this.na, b += ac(a[a.length - 2], a[1])); return b };
    F.prototype.getDBCs = F.prototype.l; F.prototype.f = function () { return this.na.length / 3 }; F.prototype.getPointCount = F.prototype.f; F.prototype.A = function () { return this.na }; F.prototype.getLatLngAltArray = F.prototype.A; F.prototype.a = x;
    F.prototype.S = function () { var a; if (!(a = this.a)) { a = this.na; var b = a.length, c = 3, d, e, f, g, h, k = x, l = We; if (3 <= b) for (d = e = a[0], f = g = a[1], k = new G(d, f, e, g); c < b; c += 3) { d = a[c - 3]; f = a[c - 2]; e = a[c]; g = a[c + 1]; if (f > g && 180 < g - f || f < g && -180 > f - g || g < f && 180 > rb(g - f)) h = f, f = g, g = h; d < e && (h = d, d = e, e = h); l(k.ka, k.ga, k.ja, k.ha, d, f, e, g, k) } a = this.a = k } return a }; F.prototype.getBounds = F.prototype.S; F.prototype.F = function () { return this.a !== x }; F.prototype.hasBounds = F.prototype.F;
    function pf(a, b, c) { for (var d = a.length, e = !(d % 3), f; e && d;)e = !(D(a[--d] = Yb((f = a[d]) === A ? 0 : f)) || D(a[--d] = Xb(a[d])) || D(a[--d] = Wb(a[d]))); if (!e && b) throw new C(b, c, a); } function vf(a) { var b = new F, c = 0, d = a.length; if (d % 2) throw new C(vf, 0, a); for (; c < d;)uf(b, a[c++], a[c++], 0, vf); return b } F.fromLatLngArray = vf; F.prototype.pa = function (a) { var b = this === a, c, d; if (!b && (b = B(a, F))) for (c = this.na, a = a.na, b = (d = c.length) === a.length; b && d--;)b = c[d] == a[d]; return b }; F.prototype.equals = F.prototype.pa;
    function wf(a, b) { return a.ke - b.ke } function xf(a) { var b = a.m, c, d, e, f, g, h, k; if (!b) for (b = a.m = new jf, c = 0, a = a.na, d = a.length, e = 0; e < d; e += 3) { f = a[e]; g = a[e + 1]; if (e) { var l = void 0, m = void 0, n = void 0, q = void 0; k < g ? (l = k, n = g) : (l = g, n = k); h < f ? (m = f, q = h) : (m = h, q = f); h = kf(b, m, l, q, n, 180 < n - l); h.ke = c++ } h = f; k = g } return b }
    function yf(a, b) { var c, d, e = a.na, f, g, h, k = -2, l = [], m, n, q; c = of(xf(a), b).sort(wf); f = c.length; for (g = 0; g < f; g++)d = c[g], d = d.ke, h = 3 * d, d > k + 1 && (m = [e[h], e[h + 1]], l.push(m)), k = d, m.push(e[h + 3], e[h + 4]); if (a.b) { e = []; f = l.length; for (g = 0; g < f; g++)if (m = l[g], k = m.length) { d = []; for (c = 0; c < k; c += 2)h = m[c], n = m[c + 1], d.push(h, n), q = m[c - 1], c && ac(n, q) && (e.push(d), d = [], q += 0 > q ? 360 : -360, d.push(m[c - 2], q, h, n)); e.push(d) } l = e } return l } F.prototype.qd = "LINESTRING";
    F.prototype.Lb = function (a) { var b = this.na, c = b.length, d; if (c) { a.push("("); for (d = 0; d < c; d += 3)d && a.push(","), a.push(b[d + 1], " ", b[d]); a.push(")") } else a.push("EMPTY"); return a }; r("H.geo.Strip", F); function zf(a) { var b, c, d, e; if (a) { b = Af; for (e = B(a, zf); b--;)if (c = Bf[b], a.hasOwnProperty(c)) if (d = a[c], e) this[c] = d; else { if ((d = Cf[b](d)) === Df) throw new C(zf, 0, c + ": " + a[c]); d !== this[c] && d !== A && (this[c] = d) } b = e ? a.b : this.lineWidth && ue(this.strokeColor); b || (this.b = b); b = e ? a.c : ue(this.fillColor); b || (this.c = b); b = e ? a.a : "none" !== this.strokeColor && this.lineWidth; b || (this.a = b) } Na(this) } r("H.map.SpatialStyle", zf); zf.prototype.c = !0; zf.prototype.b = !0; zf.prototype.a = !0; var Bf = [];
    zf.prototype[Bf[0] = "strokeColor"] = "rgba(0,85,170,.6)"; zf.prototype[Bf[1] = "fillColor"] = "rgba(0,85,170,.4)"; zf.prototype[Bf[2] = "lineWidth"] = 2; zf.prototype[Bf[3] = "lineCap"] = "round"; zf.prototype[Bf[4] = "lineJoin"] = "miter"; zf.prototype[Bf[5] = "miterLimit"] = 10; zf.prototype[Bf[6] = "lineDash"] = De; zf.prototype[Bf[7] = "lineDashOffset"] = 0; var Af = Bf.length; zf.prototype.pa = function (a) { var b, c; b = this === a; if (!b && a) { for (b = 0; b < Af && (c = Bf[b], this[c] === a[c]); b++); b = b === Af } return b }; zf.prototype.equals = zf.prototype.pa;
    zf.prototype.f = function (a) { var b; a ? (b = {}, Ca(b, this, a)) : b = this; return new zf(b) }; zf.prototype.getCopy = zf.prototype.f; var Df = Na({}), Cf = [function (a) { return a ? La(a) : Df }, function (a) { return a ? La(a) : Df }, function (a) { return 0 <= a && 100 >= a ? +a : Df }, function (a) { return "butt" === (a = La(a)) || "square" === a || "round" === a ? a : Df }, function (a) { return "round" === a || "bevel" === a || "miter" === a ? a : Df }, function (a) { return 0 < a && 100 >= a ? +a : Df }, function (a) { return a && a.every && a.every(bb) ? a : Df }, function (a) { return D(+a) ? Df : +a }];
    zf.MAX_LINE_WIDTH = 100; var Ef = new zf; zf.DEFAULT_STYLE = Ef; function Ff(a) { var b, c, d; if (a) { b = B(a, Ff); for (c in a) c in this && (d = a[c], d !== this[c] && ("fillColor" === c || 0 < (d = +d)) && (this[c] = d)); a = b ? a.fd : !!(ue(this.fillColor) && this.width && this.width); a || (this.fd = a) } Na(this) } r("H.map.ArrowStyle", Ff); Ff.prototype.fd = !0; Ca(Ff.prototype, { fillColor: "rgba(255,255,255,.75)", width: 1.2, length: 1.6, frequency: 5 }); Ff.prototype.pa = function (a) { var b = this === a; !b && a && (b = a.width === this.width && a.fillColor === this.fillColor && a.length === this.length && a.frequency === this.frequency); return b };
    Ff.prototype.equals = Ff.prototype.pa; function Gf(a, b) { var c; Gf.u.constructor.call(this, b); b && this.O(b.style); a && (this.B = !0); b && (c = b.arrows) && this.Vb(c) } v(Gf, K); r("H.map.Spatial", Gf); Gf.prototype.type = Pe.SPATIAL; Gf.prototype.je = 0; Gf.prototype.style = Ef; Gf.prototype.Na = function () { return this.style }; Gf.prototype.getStyle = Gf.prototype.Na;
    Gf.prototype.O = function (a) { var b = this.style, c = !0; a ? this.style = B(a, zf) ? a : new zf(a) : this.style ? delete this.style : c = !1; c && (this.dispatchEvent(new Ne("stylechange", this.style, b)), this.invalidate(Me.VISUAL)); return this }; Gf.prototype.setStyle = Gf.prototype.O; Gf.prototype.jc = function () { return this.s }; Gf.prototype.getArrows = Gf.prototype.jc; Gf.prototype.Vb = function (a) { var b = this.s, c = !1; !a && b ? (delete this.s, c = !0) : !a || b && b.pa(a) || (this.s = new Ff(a), c = !0); c && "none" !== this.style.strokeColor && this.ua(1); return this };
    Gf.prototype.setArrows = Gf.prototype.Vb; function Hf(a, b) { var c = !1, d = !1, e; if (b.length) { for (c = 0; c < b.length; c++)if (b[c] !== If) { d = !0; break } c = a.style; c = d ? c.b || c.c && a.B || (e = a.s || !1) && c.a && e.fd : c.c } return c && a.getVisibility(!0) } Gf.prototype.B = !1; Gf.prototype.be = function () { return this.B }; Gf.prototype.isClosed = Gf.prototype.be; Gf.prototype.getGeometriesForTile = Gf.prototype.ec; Gf.prototype.ba = function () { return x }; Gf.prototype.getLabels = Gf.prototype.ba; function Jf(a, b) { Jf.u.constructor.call(this, a, b) } v(Jf, Gf); r("H.map.GeoShape", Jf); Jf.prototype.getStrip = Jf.prototype.b; Jf.prototype.setStrip = Jf.prototype.f; Jf.prototype.getBounds = Jf.prototype.S; function Kf(a, b, c, d) { var e = [], f = b.length, g, h; for (g = 0; g < f; g++)h = b[g], h.length && e.push(Lf(a, h, c, d)); return e } function Lf(a, b, c, d) { var e, f = [], g = b.length, h = 0; a.Va = 0; for (e = e || 0; h < g;)f.push(Mf(a, b[h++], b[h++], e, d)); c && f.push(Mf(a, b[0], b[1], e, d)); return f }
    function Mf(a, b, c, d, e) { var f = a.Va; f && 180 < rb(f - c) && (c += 0 > f ? -360 : 360); a.Va = c; return e.f(b, c + d) } function Nf(a, b, c) { for (var d = b, e, f = a.length + b, g, h; d--;) { b = a[d]; g = b.length; for (e = Array(g); g--;)h = b[g], e[g] = new M(h.x + c, h.y); a[--f] = e } } var Of = new F([0, 0, 0, 0, 0, 0, 0, 0, 0]); function Pf(a) { Ua(this, Pf); Pf.u.constructor.call(this); this.ma = Qf(this, a, this.constructor, 0) } v(Pf, bc); r("H.geo.MultiGeometry", Pf); Pf.prototype.splice = function (a, b, c) { a = [a]; b !== A && a.push(b); c && (b = Qf(this, c, this.splice, 2), a = a.concat(b)); this.a = x; return this.ma.splice.apply(this.ma, a) }; Pf.prototype.splice = Pf.prototype.splice; Pf.prototype.f = function (a) { var b = this.ma.length; if (!(0 <= a && a < b)) throw new ec(this.f, a, [0, b - 1]); this.a = x; return this.ma.splice(a, 1)[0] }; Pf.prototype.removeAt = Pf.prototype.f;
    Pf.prototype.remove = function (a) { a = this.ma.indexOf(a); var b; 0 <= a && (b = this.ma.splice(a, 1)[0], this.a = x); return b || x }; Pf.prototype.remove = Pf.prototype.remove; Pf.prototype.j = function () { return this.ma }; Pf.prototype.getGeometries = Pf.prototype.j; Pf.prototype.push = function (a) { var b = Qf(this, [a], this.push, 0)[0]; this.a && (this.a = this.a.wb(a.S())); this.ma.push(b) }; Pf.prototype.push = Pf.prototype.push;
    Pf.prototype.S = function () { var a; if (!(a = this.a)) { a = x; var b, c; if (this.ma.length) for (a = this.ma[0].S(), c = 1; c < this.ma.length; c++)if (b = this.ma[c].S()) a = a ? a.wb(b) : b } return this.a = a }; Pf.prototype.getBounds = Pf.prototype.S; Pf.prototype.a = x; function Qf(a, b, c, d) { var e, f = []; if (!Za(b)) throw new C(c, d); for (e = 0; e < b.length; e++)if (a.c(b[e])) f.push(a.l(b[e])); else throw new C(c, d); return f } Pf.prototype.c = function (a) { return B(a, this.b) }; Pf.prototype.l = function (a) { return a };
    Pf.prototype.pa = function (a) { var b = this === a, c, d; if (!b && (b = B(a, this.constructor))) for (c = this.ma, a = a.ma, b = (d = c.length) === a.length; b && d--;)b = c[d].pa(a[d]); return b }; Pf.prototype.equals = Pf.prototype.pa; Pf.prototype.Lb = function (a) { var b = this.ma, c = b.length, d, e, f = !1; if (c) { a.push("("); for (d = 0; d < c; d++)(e = 0 < d && f) && a.push(","), b[d].Lb(a), "EMPTY" === a[a.length - 1] ? a.splice(-1 - e, 1 + e) : f = !0; f ? a.push(")") : a.splice(-1, 1, "EMPTY") } else a.push("EMPTY"); return a };
    Pf.prototype.toString = function () { return this.Lb(["MULTI", this.b.prototype.qd, " "]).join("") }; function Rf(a) { Rf.u.constructor.call(this, a) } v(Rf, Pf); r("H.geo.MultiPolygon", Rf); Rf.prototype.b = E; function Sf(a, b, c) { this.Ra = a; b !== A && (this.a = b); c !== A && (this.b = c) } Sf.prototype.a = Lb; Sf.prototype.b = Lb; var If = Oa(new Sf([])), Tf = Na([]); function Uf(a, b) { Uf.u.constructor.call(this, !0, b); B(a, F) ? this.c(new E(a)) : this.c(a) } v(Uf, Jf); r("H.map.Polygon", Uf); Uf.prototype.i = x; Uf.prototype.Ca = function () { return this.i }; Uf.prototype.getGeometry = Uf.prototype.Ca; Uf.prototype.c = function (a) { var b; a === x || B(a, E) ? b = !1 : (B(a, Rf, this.c, 0), b = !0); this.m = b; b = this.i; this.i = a; b !== x && this.ua(Me.SPATIAL); return this }; Uf.prototype.setGeometry = Uf.prototype.c;
    Uf.prototype.b = function () { var a = B(this.i, E) ? this.i : this.i.ma[0]; jb(this.b, "See H.map.Polygon#getGeometry"); return a.$a }; Uf.prototype.getStrip = Uf.prototype.b; Uf.prototype.f = function (a) { var b; jb(this.f, "See H.map.Polygon#setGeometry"); B(a, F, this.f, 0); if (3 > a.f()) throw new C(this.f, 0); b = this.b(); this.c(new E(a)); this.dispatchEvent(new Ne("stripchange", this.b(), b)); return this }; Uf.prototype.setStrip = Uf.prototype.f; Uf.prototype.S = function () { return this.Ca().S() }; Uf.prototype.getBounds = Uf.prototype.S;
    Uf.prototype.ec = function (a) { var b, c = this.Ca(), d, e, f; if (this.m) for (c = c.ma, f = 0, e = c.length; f < e; f++) { if (d = Vf(this, c[f], a, c[f].hc)) b || (b = []), b.push(d) } else (d = Vf(this, c, a, Wf(this))) && (b = [d]); return b }; Uf.prototype.getGeometriesForTile = Uf.prototype.ec;
    function Vf(a, b, c, d) { var e, f, g, h, k = 0, l = !0; if (e = Xf(a, b.$a, c, d, b.S())) { f = new Sf(e); g = b.lb; if (h = g.length) for (f.a = f.Ra.length; k < h; k++)if (e = Xf(a, g[k], c, d, b.ig(k))) f.Ra = f.Ra.concat(e); h = f.Ra.length; for (k = 0; k < h; k++)if (f.Ra[k] !== Tf) { l = !1; break } l && (f = k % 2 ? If : A) } return f }
    function Xf(a, b, c, d, e) {
        var f = c.j(), g, h = Yf(b, e); g = c.B(); a = Kf(a, h, !0, g); if (360 === e.ab() && 1 === b.l(!0) % 2) { b = a; a = c.j(); var k, l, m; b[0][1].x > b[0][b[0].length - 1].x && (b[0] = b[0].reverse()); l = []; k = b[0].length - 1; for (h = 0; h < k; h++)m = b[0][h], l[h] = new M(m.x - 2 * g.w, m.y), l[h + k] = new M(m.x - g.w, m.y), l[h + 2 * k] = new M(m.x, m.y), l[h + 3 * k] = new M(m.x + g.w, m.y), l[h + 4 * k] = new M(m.x + 2 * g.w, m.y); b[0] = l; g = g.f(d, 0); g.y = 2 * a[d === cc.NORTH ? "top" : "bottom"]; d = g.clone(); g.x = b[0][b[0].length - 1].x + 1; d.x = b[0][0].x - 1; b[0].push(g, d); a = b } b = a; d = f.left;
        g = f.top; a = f.right; f = f.bottom; if (Zf(b, d, g, a, f, !0).length) {
            if (!c.s().j(e)) {
                c = b; e = [new M(d, g), new M(a, g), new M(a, f), new M(d, f)]; f = []; for (d = c.length; d--;) {
                    b = c[d]; l = h = void 0; g = $f(e); b = $f(b); var n = m = void 0, q = void 0, t = void 0, u = void 0, y = void 0, J = q = a = void 0; k = a = void 0; a = {}; k = h = 1; l = 0; l = ~~(1 * l); switch (l) { case 1: k = h = 0; break; case 2: h = 0; k = 1; break; case 3: h = 1, k = 0 }l = k; k = h; var T = t = void 0, q = m = h = void 0; if (b && g) {
                    b.zd = ag(b.x, b.y, null, bg(b)); g.zd = ag(g.x, g.y, null, bg(g)); for (m = b; m.next; m = m.next)if (!m.bb) for (n = g; n.next; n =
                        n.next)!n.bb && (t = cg(m.next), T = cg(n.next), q = dg(m, t, n, T, a)) && (q = a.Kh, J = a.Zf, u = a.Hi, y = a.Ii, q = ag(u, y, null, null, null, null, 1, 0, 0, q), eg(q, m, t), t = ag(u, y, null, null, null, null, 1, 0, 0, J), eg(t, n, T), q.df = t, t.df = q); a = fg(b, g); k && (a = 1 - a); for (m = b; m; m = m.next)m.bb && (m.Ce = a, a = 1 - a); a = fg(g, b); l && (a = 1 - a); for (n = g; n.next; n = n.next)n.bb && (n.Ce = a, a = 1 - a); gg(b); for (gg(g); (a = hg(b)) != b;) { for (m = null; !a.ie; a = a.df) { for (k = a.Ce; ;) { m = ag(a.x, a.y, m); a.ie = 1; a = k ? a.next : a.nb; if (!a) break; if (a.bb) { a.ie = 1; break } } if (!a) break } m.ef = h; h = m } g = h
                    } else g =
                        void 0; if (g) for (b = ig(g), f.push(b); g.ef;)g = g.ef, b = ig(g), f.push(b)
                } b = f
            }
        } else c = jg(d, g, b[0]), b[1] && (c ^= jg(d, g, b[1])), b = c ? [Tf] : A; return b
    } function jg(a, b, c) { var d, e, f, g, h, k, l, m; e = g = c[0].x; f = h = c[0].y; d = 1; for (m = c.length; d < m; d++)k = c[d].x, l = c[d].y, k > g ? g = k : k < e && (e = k), l > h ? h = l : l < f && (f = l); return e <= a && a <= g && f <= b && b <= h ? 1 === fg({ x: a, y: b }, c.concat(c[0])) : !1 }
    function ig(a) { var b = [], c, d = a, e, f; do { e = nb(100 * (d.ti ? d.ti : d.x)) / 100; f = nb(100 * (d.ui ? d.ui : d.y)) / 100; if (!c || .01 < tb(ub(c.x - e, 2) + ub(c.y - f, 2))) c = new M(e, f), b.push(c); d = d.next } while (d && d !== a); return b } Uf.prototype.kb = x; Uf.prototype.A = function (a) { a = a ? cc.NORTH : cc.SOUTH; jb(this.A, "See H.geo.Polygon#setPoleCovering"); this.Ub !== a && (this.Ub = a, this.m || this.ua(Me.SPATIAL)); return this }; Uf.prototype.setNorthPoleCovering = Uf.prototype.A;
    Uf.prototype.Ya = function () { jb(this.Ya, "See H.geo.Polygon#getPoleCovering"); return Wf(this) === cc.NORTH }; Uf.prototype.getNorthPoleCovering = Uf.prototype.Ya; function Wf(a) { var b = a.Ub; b === A && (b = a.m ? cc.NORTH : a.Ca().hc); return b }
    function Yf(a, b) {
        var c, d, e = b.ab(); c = [[]]; d = a.na; var f = [], g = d.length, h, k, l, m = !1; for (h = 0; h < g; h += 3)k = d[h], l = d[h + 1], m || 180 != rb(l) || (f.push(k), f.push(l), f.push(k), f.push(-l), m = !0), f.push(k), f.push(l); d = f; 360 > e && -180 == b.ga && (b = new G(b.ka, 180, b.ja, b.ha)); 360 > e && 180 == b.ha && (b = new G(b.ka, b.ga, b.ja, -180)); if (b.g()) {
            e = d; k = e.length; d = -1; for (f = 0; f < k - 2; f += 2)if (ac(e[f + 1], e[f + 3])) { d = f + 2; break } -1 === d && ac(e[k - 1], e[1]) && (d = k); -1 !== d && (g = e[d - 2], f = e[d - 1], h = e[d % k], m = e[(d + 1) % k], 180 !== rb(g) && 180 !== rb(h) && (l = rb(h - g), k = rb(m -
                f), k += 180 < k ? -360 : 0, m = rb(180 - m), m += 180 < m ? -360 : 0, k && m && (l /= rb(k) / rb(m), g = h + (h > g ? -l : l), f = 0 < f ? 180 : -180, e.splice(d, 0, g, f, g, -f)))); d = e
        } c[0] = kg([].concat(d), b.ga); 360 > b.ab() && b.Vc(new gc(b.ka, 180)) && (d = kg([].concat(d), b.ha), c.push(d)); return c
    } Uf.prototype.Tb = function () { var a = this.Ca(), b, c, d; jb(Uf.prototype.Tb); if (this.m) for (b = a.ma, d = b.length, a = [], c = 0; c < d; c++)a = a.concat(Yf(b[c].$a, b[c].S())); else a = Yf(a.$a, a.S()); return a }; Uf.prototype.clip = Uf.prototype.Tb;
    function kg(a, b) { for (var c = [], d = Number.POSITIVE_INFINITY, e = -1, f, g = a.length, c = 0; c < g; c += 2)f = rb(a[c + 1] - b), f += 180 < f ? 360 - f : f, f < d && (d = f, e = c); return 0 < c ? (c = a.splice(e, a.length - e), c.concat(a)) : a }; function lg(a, b, c) { lg.u.constructor.call(this, Of, c); this.Za(a); this.wa(b); c && "precision" in c && this.sa(c.precision) } v(lg, Uf); r("H.map.Circle", lg); lg.prototype.Za = function (a) { (a = ic(a)).pa(this.o) || (this.o = a, mg(this)) }; lg.prototype.setCenter = lg.prototype.Za; lg.prototype.Oa = function () { return this.o }; lg.prototype.getCenter = lg.prototype.Oa; lg.prototype.wa = function (a) { if (D(a = Qb(a, 0, 6371000.79 * Db / 2))) throw new C(this.wa, 0, a); this.Ba !== a && (this.Ba = a, mg(this)) }; lg.prototype.setRadius = lg.prototype.wa;
    lg.prototype.Zd = function () { return this.Ba }; lg.prototype.getRadius = lg.prototype.Zd; lg.prototype.a = 60; lg.prototype.sa = function (a) { if (!ab(a)) throw new C(this.sa, 0, a); this.a !== (a = Qb(nb(a), 4, 360)) && (this.a = a, mg(this)) }; lg.prototype.setPrecision = lg.prototype.sa; lg.prototype.Yd = function () { return this.a }; lg.prototype.getPrecision = lg.prototype.Yd; lg.prototype.A = function () { return this }; lg.prototype.setNorthPoleCovering = lg.prototype.A; lg.prototype.c = function () { return this }; lg.prototype.setGeometry = lg.prototype.c;
    lg.prototype.Ca = function () { this.i || lg.u.c.call(this, ng(this)); return this.i }; lg.prototype.getGeometry = lg.prototype.Ca; lg.prototype.f = function () { return this }; lg.prototype.setStrip = lg.prototype.f; lg.prototype.b = function () { return this.Ca().$a }; lg.prototype.getStrip = lg.prototype.b; function mg(a) { a.i !== x && lg.u.c.call(a, ng(a)) }
    function ng(a) { var b = a.o, c = b.lat, d = a.Ba, e = 0, f = new F; if (90 === rb(c)) for (c = b.Gf(0, d, !0).lat; 360 > e; e += 120)f.o(c, e - 180, A); else for (a = a.a, a = 360 / a; 360 > e; e += a)f.c(b.Gf(e, d, !0)); b = new E(f); 0 > c && b.i(cc.SOUTH); return b }; function og(a) { og.u.constructor.call(this, a) } v(og, Pf); r("H.geo.MultiLineString", og); og.prototype.b = F; function pg(a, b) { pg.u.constructor.call(this, !1, b); this.c(a) } v(pg, Jf); r("H.map.Polyline", pg); pg.prototype.S = function () { return this.a.S() }; pg.prototype.getBounds = pg.prototype.S; pg.prototype.f = function (a) { var b; jb(this.f, "See H.map.Polyline#setGeometry"); qg(a, this.f); b = this.b(); this.c(a); this.dispatchEvent(new Ne("stripchange", this.b(), b)); return this }; pg.prototype.setStrip = pg.prototype.f; pg.prototype.b = function () { jb(this.b, "See H.map.Polyline#getGeometry"); return B(this.a, F) ? this.a : this.a.ma[0] };
    pg.prototype.getStrip = pg.prototype.b; pg.prototype.a = x; pg.prototype.c = function (a) { var b = this.c, c, d, e; if (B(a, og)) if (c = a.ma, d = c.length) for (e = 0; e < d; e++)qg(c[e], b); else throw new C(b, 0); else qg(a, b); this.m = !!c; this.a = a; this.ua(Me.SPATIAL); return this }; pg.prototype.setGeometry = pg.prototype.c; pg.prototype.Ca = function () { return this.a }; pg.prototype.getGeometry = pg.prototype.Ca; pg.prototype.i = function (a) { var b = this.a; return yf(this.m ? b.ma[0] : b, a) }; pg.prototype.clip = pg.prototype.i;
    pg.prototype.ec = function (a) { var b; b = this.a; var c, d = []; if (this.m) for (b = b.ma, c = b.length; c--;)rg(this, b[c], a, d); else rg(this, b, a, d); return d.length ? d : A }; pg.prototype.getGeometriesForTile = pg.prototype.ec; function qg(a, b) { if (!B(a, F) || 2 > a.f()) throw new C(b, 0); } function rg(a, b, c, d) { var e = yf(b, c.s()), f; e.length && (b = c.B(), a = Kf(a, e, !1, b), e = a.length) && (f = c.j(), b = b.w, c.x || Nf(a, e, -b), c.x === (1 << c.z) - 1 && Nf(a, e, b), c = Zf(a, f.left, f.top, f.right, f.bottom, !1), c.length && d.push(new Sf(c))) }; function sg(a) { sg.u.constructor.call(this, a) } v(sg, Pf); r("H.geo.MultiPoint", sg); sg.prototype.c = function (a) { return hc(a) }; sg.prototype.l = function (a) { return B(a, gc) ? a : ic(a) }; sg.prototype.b = gc; function tg(a, b, c) { var d, e = 6; if (b) { for (d = ' expected close to: "' + b; e--;)b = a.a.next(), -1 !== b && (d += String.fromCharCode(b)); d += '"' } throw new C(ug, 0, "- Malformed WKT: " + (d ? c + d : "unexpected end of stream")); } var vg = { Eh: " ", Ch: "(", Dh: ")", sh: ",", wh: "" }; Object.keys(vg).reduce(function (a, b) { a[vg[b]] = !0; return a }, Ka()); function wg(a, b) { var c = a.next(), d = b ? ")" : "("; c !== d && tg(a, c, '"' + d + '"') } function xg(a) { return "," === yg(a) ? (a.next(), !0) : !1 }
    function zg(a, b, c, d, e) { var f, g, h = 2 + b + c; for (g = 1; g <= h; g++)(c = a.next()) ? (f = +c) !== f ? tg(a, c, "number") : 1 === g ? d[e + 1] = f : 2 === g ? d[e + 0] = f : 3 === g && (d[e + 2] = f) : tg(a, c); b || (d[e + 2] = 0) } var Ag = []; function Bg(a, b, c, d) { d || wg(a, 0); zg(a, b, c, Ag, 0); d || wg(a, 1); return new gc(Ag[0], Ag[1], b ? Ag[2] : A) } function Cg(a, b, c) { var d = []; wg(a, 0); do zg(a, b, c, d, d.length); while (xg(a)); wg(a, 1); return new F(d) } function Dg(a, b, c) { var d, e; wg(a, 0); d = Cg(a, b, c); if (xg(a)) { e = []; do e.push(Cg(a, b, c)); while (xg(a)) } wg(a, 1); return new E(d, e) }
    var Eg = [], Fg = [Dg], Gg = [Bg], Hg = { POINT: Gg, LINESTRING: [Cg], POLYGON: Fg, MULTIPOINT: [Bg, sg], MULTILINESTRING: [Cg, og], MULTIPOLYGON: [Dg, Rf], GEOMETRY: Eg, GEOMETRYCOLLECTION: Eg, CIRCULARSTRING: Eg, COMPOUNDCURVE: Eg, CURVEPOLYGON: Eg, MULTICURVE: Eg, MULTISURFACE: Eg, CURVE: Eg, SURFACE: Eg, POLYHEDRALSURFACE: Eg, TIN: Eg, TRIANGLE: Eg }, Ig = { Z: 1, M: 2, ZM: 3 };
    function ug(a) {
        a = new Jg(a); var b, c, d, e, f; c = a.next(); (b = Hg[c.toUpperCase()]) || tg(a, c, "type name"); if (b !== Eg) {
            c = yg(a); c = Ig[c.toUpperCase()]; d = c & 1; e = c >> 1; d | e && a.next(); c = yg(a); if ("EMPTY" === c) a.next(), (d = b[1]) ? f = new d([]) : b !== Gg && (f = new F([]), b === Fg && (f = new E(f))); else if ("(" === c) { f = b[0]; b = b[1]; var g, h; if (b) { g = []; wg(a, 0); if (f === Bg) { h = "(" !== yg(a); do g.push(f(a, d, e, h)); while (xg(a)) } else { do g.push(f(a, d, e)); while (xg(a)) } wg(a, 1); d = new b(g) } else d = f(a, d, e); f = d } else tg(a, c, '"Z", "M", "ZM", "(" or "EMPTY"');
            a.next() && tg(a, c, "end of stream")
        } return f || x
    } function Jg(a) { this.a = a } function yg(a) { var b = a.b; if (b === A) { for (b = a.a; b.a() === Kg;)b.next(); if (Lg[b.a()]) b = b.next(), b = b === Mg ? "" : String.fromCharCode(b); else { b.m(); do b.next(); while (!Lg[b.a()]); b = String.fromCharCode.apply(null, b.l()) } a.b = b } return b } Jg.prototype.next = function () { var a = yg(this); "" !== a && delete this.b; return a }; var Kg = 32, Mg = -1, Ng = { Eh: Kg, Ch: 40, Dh: 41, sh: 44, wh: Mg }, Lg = Object.keys(Ng).reduce(function (a, b) { a[Ng[b]] = !0; return a }, Ka()); function Og() { } r("H.util.ICharStream", Og); Og.prototype.next = function () { }; Og.prototype.m = function () { }; Og.prototype.l = function () { }; Og.prototype.a = function () { }; function Pg(a) { this.f = String(a); this.g = 0; this.b = []; this.c = !1 } r("H.util.CharStream", Pg); Pg.prototype.next = function () { var a = this.f.charCodeAt(this.g++), a = isNaN(a) ? -1 : a; this.c && this.b.push(a); return a }; Pg.prototype.m = function () { this.c = !0; this.b = [] }; Pg.prototype.l = function () { var a = this.b.slice(); this.c = !1; this.b = []; return a }; Pg.prototype.a = function (a) { a = this.f.charCodeAt(this.g + (a || 0)); return isNaN(a) ? -1 : a }; r("H.util.wkt.toGeometry", function (a) { return ug(new Pg(a)) }); function Qg(a) { var b = "" + Ae(), c; a = a || {}; this.min = a.min || 0; this.max = a.max || 22; if (c = a.uri) { if (/_/.test(c)) throw new C(Qg, 0, "uri " + c); } else c = b; this.uri = c || b; this.uid = b; a.getCopyrights && Xa(a.getCopyrights, "Function", Qg) && (this.getCopyrights = a.getCopyrights); Qg.u.constructor.call(this) } v(Qg, I); r("H.map.provider.Provider", Qg); Qg.prototype.F = { la: "update" }; function Rg(a, b) { a.dispatchEvent(new Bc(a.F.la, b)) } Qg.prototype.D = function () { I.prototype.D.call(this) }; Qg.prototype.Ia = function () { return null };
    Qg.prototype.getCopyrights = Qg.prototype.Ia; Qg.prototype.s = Ce; Qg.prototype.providesSpatials = Qg.prototype.s; Qg.prototype.ba = Ce; Qg.prototype.providesOverlays = Qg.prototype.ba; Qg.prototype.l = Ce; Qg.prototype.providesMarkers = Qg.prototype.l; Qg.prototype.i = Ce; Qg.prototype.providesDomMarkers = Qg.prototype.i; function Sg(a) { var b; Ua(this, Sg); Sg.u.constructor.call(this, a); if (a && "tileSize" in a) { b = sb(+a.tileSize) / Cb; if (isNaN(b) || b % 1 || 0 > b || 30 < b) throw new C(Sg, 0, "tileSize: " + a.tileSize); this.tileSize = +a.tileSize } } v(Sg, Qg); r("H.map.provider.TileProvider", Sg); function Tg(a, b) { return Nb(a) - 8 - nb(Nb(b)) } Sg.getZoomLevelOffset = Tg; Sg.prototype.A = function (a, b, c) { return this.uri.concat("_", a, "_", b, "_", c) }; Sg.prototype.getTileKey = Sg.prototype.A; Sg.prototype.Va = 256; Sg.prototype.tileSize = Sg.prototype.Va; function Ug() { } r("H.util.ICache", Ug); Ug.prototype.add = function () { }; Ug.prototype.add = Ug.prototype.add; Ug.prototype.get = function () { }; Ug.prototype.get = Ug.prototype.get; Ug.prototype.g = function () { }; Ug.prototype.drop = Ug.prototype.g; Ug.prototype.forEach = function () { }; Ug.prototype.forEach = Ug.prototype.forEach; Ug.prototype.Ea = function () { }; Ug.prototype.removeAll = Ug.prototype.Ea; Ug.prototype.c = function () { }; Ug.prototype.registerOnDrop = Ug.prototype.c; function Vg(a, b, c) { b && this.c(b); if (c && !sa(c)) throw new C(Vg, 2, c); this.a = 0; this.filter = c; this.Y = {}; this.f = this.b = null; this.i(a) } r("H.util.Cache", Vg); Vg.prototype.add = function (a, b, c) { var d, e; c = +c; if (!ab(c) || 0 > c) throw new C(this.add, 2, c); a = String(a); d = this.Y[a]; e = !0; this.filter && (e = this.filter(a, b, c)); d ? e ? (this.a += c - d.size, d.size = c, d.data = b, Wg(this, d)) : Xg(this, d, !0) : e && (this.Y[a] = Yg(this, { id: a, data: b, size: c, xb: null, Xb: null }, this.b)); Zg(this); return e }; Vg.prototype.add = Vg.prototype.add;
    Vg.prototype.c = function (a) { if (!sa(a)) throw new C(this.c, 0, a); this.j = a }; Vg.prototype.registerOnDrop = Vg.prototype.c; Vg.prototype.get = function (a, b) { var c = b ? this.Y[a] : Wg(this, this.Y[a]); return c && c.data }; Vg.prototype.get = Vg.prototype.get; Vg.prototype.g = function (a) { var b; (b = this.Y[a]) && Xg(this, b, !0) }; Vg.prototype.drop = Vg.prototype.g; Vg.prototype.forEach = function (a, b, c) { var d, e; for (e in this.Y) d = this.Y[e], (c ? c(e, d.data, d.size) : 1) && a.call(b, e, d.data, d.size) }; Vg.prototype.forEach = Vg.prototype.forEach;
    Vg.prototype.Ea = function (a) { var b, c; for (c in this.Y) b = this.Y[c], (a ? a(c, b.data, b.size) : 1) && Xg(this, this.Y[c], !0) }; Vg.prototype.removeAll = Vg.prototype.Ea; Vg.prototype.i = function (a) { if (!(0 < +a)) throw new C(Vg.prototype.i, 0, a); this.l = +a; Zg(this); return this }; Vg.prototype.setMaxSize = Vg.prototype.i; Vg.prototype.m = function () { return this.l }; Vg.prototype.getMaxSize = Vg.prototype.m; Vg.prototype.o = function () { return this.a }; Vg.prototype.getCurrentSize = Vg.prototype.o;
    function Wg(a, b) { b && (a.b = Yg(a, b, a.b)); return b } function Zg(a) { for (; a.a > a.l && a.f;)Xg(a, a.f, !0) } function Yg(a, b, c) { if (c !== b) { (b.xb || b.Xb) && Xg(a, b); if (b.xb = c) b.Xb = c.Xb, c.Xb = b; b.Xb || (a.b = b); b.xb || (a.f = b); a.a += b.size } return b } function Xg(a, b, c) { var d = b.Xb, e = b.xb; if (d || e || b == a.b && b == a.f) d ? d.xb = e : a.b = e, e ? e.Xb = d : a.f = d, a.a -= b.size, c && (a.j && a.j(b.id, b.data, b.size), delete a.Y[b.id]); b.xb = b.Xb = null }; function $g(a, b, c, d) { this.key = ""; this.x = a; this.y = b; this.z = c; this.data = d; this.valid = !0 } r("H.map.provider.Tile", $g); function N(a) { Ua(this, N); N.u.constructor.call(this, a); this.a = {}; this.Ha = new ah; this.m = z(this.m, this); this.g = bh } v(N, Sg); r("H.map.provider.RemoteTileProvider", N); N.prototype.v = function () { return 1 }; N.prototype.getEntryWeight = N.prototype.v; var bh = new Vg(65536); N.prototype.Ba = function () { return this.g }; N.prototype.getCache = N.prototype.Ba; N.prototype.N = ba(0); N.prototype.m = function (a) { var b = this.uri; return !a.indexOf(b) && "_" === a.charAt(b.length) }; N.prototype.cacheFilter = N.prototype.m;
    N.prototype.sa = function (a, b) { b.valid = !1 }; N.prototype.j = function (a) { var b, c = this.getCache(); a ? c.Ea(this.m) : c.forEach(this.sa, this, this.m); for (b in this.a) this.a[b].cancel(); this.a = {}; Rg(this) }; N.prototype.reload = N.prototype.j; N.prototype.Rc = function () { return !1 }; N.prototype.canStore = N.prototype.Rc; N.prototype.MAX_STORE_TIME = Infinity; N.prototype.B = function () { return this.Ha }; N.prototype.getStorage = N.prototype.B; N.prototype.Ga = function (a, b) { b(a) };
    function ch(a, b, c, d, e, f) { var g = a.B(); d = ~~d; return a.requestInternal(b, c, d, function (h, k) { g.gd(a.A(b, c, d), k && { raw: k.zi, timestamp: w.Date.now() }, e, f) }, f, 0) } N.prototype.requestInternal = N.prototype.c;
    N.prototype.o = function (a, b, c, d) {
        var e = this, f, g, h, k = this.getCache(), l, m = this.a, n = this.B(); if (D(a = +a)) throw new C(this.o, 0, a); if (D(b = +b)) throw new C(this.o, 0, b); if (D(c = +c)) throw new C(this.o, 0, c); c = ~~c; f = this.getTileKey(a, b, c); g = k.get(f); g && g.valid || d || this.a[f] || (m[f] = dh, h = function (d) {
            var h; d && (h = w.Date.now() - d.timestamp); d && h < e.MAX_STORE_TIME ? e.Ga(d.raw, function (h) { delete e.a[f]; g = e.createTileInternal(a, b, c, h, {}); g.key = f; k.add(f, g, e.v(d)); Rg(e, g) }) : (h && n.remove(f), g = void 0, e.a[f] = e.requestInternal(a,
                b, c, function (d, h) { g = e.createTileInternal(a, b, c, d, h); g.key = f; k.add(f, g, e.v(d)); delete e.a[f]; Rg(e, g) }, function () { delete e.a[f] }), g && delete e.a[f])
        }, (l = n.get(f, h, function () { l = e.Ha.get(f, h) })) && m[f] === dh && (m[f] = l)); return g
    }; N.prototype.requestTile = N.prototype.o; var dh = { cancel: function () { } }; N.prototype.createTileInternal = function (a, b, c, d) { return new $g(a, b, c, d) }; N.prototype.K = function (a) { var b = this.a[a]; b && (b.cancel(), delete this.a[a]) }; N.prototype.cancelTileByKey = N.prototype.K;
    N.prototype.T = function (a, b, c) { this.cancelTileByKey(this.getTileKey(a, b, c)) }; N.prototype.cancelTile = N.prototype.T; N.prototype.D = function () { var a; N.u.D.call(this); this.getCache().Ea(this.m); for (a in this.a) this.a[a].cancel(), delete this.a[a] }; function ah() { } N.NullStorage = ah; ah.prototype.get = function (a, b) { b(); return dh }; ah.prototype.get = ah.prototype.get; ah.prototype.gd = function (a, b, c) { c && c() }; ah.prototype.put = ah.prototype.gd; ah.prototype.clear = function (a) { a && a() }; ah.prototype.clear = ah.prototype.clear;
    ah.prototype.remove = function (a, b) { b && b() }; ah.prototype.remove = ah.prototype.remove; function eh(a) { if (!a || !sa(a.requestData)) throw new C(eh, 0, "options.requestData"); eh.u.constructor.call(this, a); this.ea = a.requestData; this.O = !!a.providesDomMarkers } v(eh, N); r("H.map.provider.MarkerTileProvider", eh); eh.prototype.v = function (a) { return a ? a.length + 1 : 1 }; eh.prototype.getEntryWeight = eh.prototype.v;
    eh.prototype.c = function (a, b, c, d, e) { var f = this; return this.ea(a, b, c, function (e) { for (var h = [], k, l, m = e.length; m--;)l = e[m], l.Di = f.getTileKey(a, b, c), l.ia(f), k = l.sb(), (B(l, fh) || k.getState() === k.Pc.READY) && h.push(e[m]); d(h) }, e) }; eh.prototype.requestInternal = eh.prototype.c; eh.prototype.C = function (a, b) { var c; b !== Me.NONE && ((c = this.g.get(a.Di)) && (c.valid = !1), Rg(this, c)) }; eh.prototype.invalidateObject = eh.prototype.C; eh.prototype.i = function () { return this.O }; eh.prototype.providesDomMarkers = eh.prototype.i;
    eh.prototype.l = Be; eh.prototype.providesMarkers = eh.prototype.l; function M(a, b) { this.x = +a; this.y = +b } r("H.math.Point", M); M.prototype.set = M; M.prototype.set = M.prototype.set; M.prototype.clone = function (a) { a ? (a.x = this.x, a.y = this.y) : a = new M(this.x, this.y); return a }; M.prototype.clone = M.prototype.clone; M.prototype.add = function (a) { this.x += a.x; this.y += a.y; return this }; M.prototype.add = M.prototype.add; M.prototype.b = function (a) { this.x -= a.x; this.y -= a.y; return this }; M.prototype.sub = M.prototype.b; M.prototype.scale = function (a, b) { this.x *= a; this.y *= void 0 === b ? a : b; return this };
    M.prototype.scale = M.prototype.scale; M.prototype.round = function () { this.x = nb(this.x); this.y = nb(this.y); return this }; M.prototype.round = M.prototype.round; M.prototype.floor = function () { this.x = pb(this.x); this.y = pb(this.y); return this }; M.prototype.floor = M.prototype.floor; M.prototype.ceil = function () { this.x = qb(this.x); this.y = qb(this.y); return this }; M.prototype.ceil = M.prototype.ceil; M.prototype.pa = function (a) { return !(!a || this.x !== a.x || this.y !== a.y) }; M.prototype.equals = M.prototype.pa;
    M.prototype.a = function (a, b) { var c = b.x - a.x, d = b.y - a.y, e, f = a; if (c || d) e = ((this.x - a.x) * c + (this.y - a.y) * d) / (c * c + d * d), 0 >= e ? f = a : 1 <= e ? f = b : f = new M(a.x + e * c, a.y + e * d); return f }; M.prototype.getNearest = M.prototype.a; M.prototype.distance = function (a) { return tb(ub(this.x - a.x, 2) + ub(this.y - a.y, 2)) }; M.prototype.distance = M.prototype.distance; function gh(a) { if (!a) throw new C(gh, 0, a); return B(a, M) ? a : new M(a.x, a.y) } M.fromIPoint = gh; function hh() { } hh.prototype.zc = function () { }; r("H.geo.IProjection.prototype.latLngToPoint", hh.prototype.zc); hh.prototype.Aa = function () { }; r("H.geo.IProjection.prototype.xyToGeo", hh.prototype.Aa); hh.prototype.Fc = function () { }; r("H.geo.IProjection.prototype.pointToGeo", hh.prototype.Fc); hh.prototype.qb = function () { }; r("H.geo.IProjection.prototype.geoToPoint", hh.prototype.qb); var ih = {}; r("H.geo.mercator", ih); ih.a = function (a) { return lb(1, mb(0, .5 - sb(zb(Fb + Eb * a / 180)) / Db / 2)) }; ih.b = function (a) { return a / 360 + .5 }; ih.zc = function (a, b, c) { c ? (c.x = ih.b(b), c.y = ih.a(a)) : c = new M(ih.b(b), ih.a(a)); return c }; ih.latLngToPoint = ih.zc; ih.qb = function (a, b) { return ih.zc(a.lat, a.lng, b) }; ih.geoToPoint = ih.qb; ih.f = function (a) { return 0 >= a ? 90 : 1 <= a ? -90 : Kb * (2 * Ab(vb(Db * (1 - 2 * a))) - Eb) }; ih.c = function (a, b) { return b ? 0 >= a ? -180 : 1 <= a ? 180 : 360 * Ob(a, 1) - 180 : 360 * (1 === a ? 1 : Ob(a, 1)) - 180 };
    ih.Aa = function (a, b, c, d) { c ? (c.lat = ih.f(b), c.lng = ih.c(a, d)) : c = new gc(ih.f(b), ih.c(a, d)); return c }; ih.xyToGeo = ih.Aa; ih.Fc = function (a, b, c) { return ih.Aa(a.x, a.y, b, c) }; ih.pointToGeo = ih.Fc; function jh(a, b) { this.projection = a || ih; this.g = 0; this.c = this.exp = sb(b || 256) / Cb; kh(this); this.y = this.x = 0 } r("H.geo.PixelProjection", jh); var lh = rb(28) + rb(-8); jh.prototype.Ja = function (a) { if (D(a)) throw new C(this.Ja, 0, a); var b = this.x / this.w, c = this.y / this.h; this.g = a; this.c = this.exp + a; kh(this); this.x = b * this.w; this.y = c * this.h }; jh.prototype.rescale = jh.prototype.Ja; function kh(a) { a.c > lh && (a.c = lh); a.w = ub(2, a.c); a.h = ub(2, a.c) } jh.prototype.mg = function () { return this.g || 0 }; jh.prototype.getZoomScale = jh.prototype.mg;
    jh.prototype.geoToPixel = function (a, b) { var c = this.projection.zc(a.lat, a.lng, b); c.x = c.x * this.w - this.x; c.y = c.y * this.h - this.y; return c }; jh.prototype.geoToPixel = jh.prototype.geoToPixel; jh.prototype.a = function (a, b, c) { return this.projection.Aa((a.x + this.x) / this.w, (a.y + this.y) / this.h, b, c) }; jh.prototype.pixelToGeo = jh.prototype.a; jh.prototype.Aa = function (a, b, c, d) { return this.projection.Aa((a + this.x) / this.w, (b + this.y) / this.h, c, d) }; jh.prototype.xyToGeo = jh.prototype.Aa;
    jh.prototype.f = function (a, b, c) { a = this.projection.zc(a, b, c); a.x = a.x * this.w - this.x; a.y = a.y * this.h - this.y; return a }; jh.prototype.latLngToPixel = jh.prototype.f; jh.prototype.b = function (a) { return new M(a.x * this.w - this.x, a.y * this.h - this.y) }; jh.prototype.pointToPixel = jh.prototype.b; function mh(a) { mh.u.constructor.call(this); a = a || {}; this.min = 0; this.max = 22; this.Oh = !!a.dark; a.min && this.B(a.min); a.max && this.s(a.max); this.pixelProjection = new jh(a.projection, a.minWorldSize) } v(mh, I); r("H.map.layer.Layer", mh); mh.prototype.a = { la: "update", Uf: "minchange", Tf: "maxchange" }; mh.prototype.K = function (a) { return this.min <= a && a <= this.max }; mh.prototype.isValid = mh.prototype.K;
    mh.prototype.B = function (a) { var b = this.min; if (a !== b) { if (D(a)) throw new C(mh.prototype.B, 0, "min is NaN"); if (a <= this.max) this.min = a, this.dispatchEvent(new Ne(this.a.Uf, a, b)), this.l(); else throw new C(mh.prototype.B, 0, "min > max"); } return this }; mh.prototype.setMin = mh.prototype.B;
    mh.prototype.s = function (a) { var b = this.max; if (a !== b) { if (D(a)) throw new C(mh.prototype.s, 0, "max is NaN"); if (a >= this.min) this.max = a, this.dispatchEvent(new Ne(this.a.Tf, a, b)), this.l(); else throw new C(mh.prototype.s, 0, "max < min"); } return this }; mh.prototype.setMax = mh.prototype.s; mh.prototype.l = function () { this.dispatchEvent(this.a.la) }; mh.prototype.D = function () { mh.u.D.call(this) }; mh.prototype.Ia = function () { return null }; mh.prototype.getCopyrights = mh.prototype.Ia; function nh(a, b) { var c = b || {}; if (!a) throw new C(oh, 0, a); this.l = z(this.l, this); this.f = a; a.addEventListener(Qg.prototype.F.la, this.l, !1, this); this.tileSize = a.tileSize; this.N = {}; mh.call(this, { min: a.min, max: a.max, minWorldSize: this.tileSize, projection: c.bj, dark: c.dark }) } v(nh, mh); r("H.map.layer.BaseTileLayer", nh); nh.prototype.Pa = function () { return this.f }; nh.prototype.getProvider = nh.prototype.Pa;
    nh.prototype.j = function (a, b) { var c, d = this.pixelProjection, e; if (!B(a, G)) throw new C(this.j, 0, a); D(b) || (c = d.mg(), d.Ja(b)); e = ph(d.geoToPixel(a.tb()), d.geoToPixel(a.rb())); !D(c) && d.Ja(c); return e }; nh.prototype.geoRectToRect = nh.prototype.j; nh.prototype.i = function (a, b) { if (!B(a, qh)) throw new C(this.i, 0, a); if (D(b = +b)) throw new C(this.i, 1, b); var c = ub(2, pb(b)), d = this.tileSize, e, f; e = pb(a.left / d); e === c && --e; f = pb(a.right / d); f === c && --f; return new qh(e, Qb(pb(a.top / d), 0, c - 1), f, Qb(pb(a.bottom / d), 0, c - 1)) };
    nh.prototype.getTileBounds = nh.prototype.i; nh.prototype.A = function (a, b, c, d) { return this.f.requestTile(a, b, c, d) }; nh.prototype.m = function (a, b, c) { this.f.cancelTile(a, b, c) }; nh.prototype.cancelTile = nh.prototype.m; nh.prototype.Ia = function (a, b) { return this.f.getCopyrights ? this.f.getCopyrights(a, b) : null }; nh.prototype.getCopyrights = nh.prototype.Ia;
    function rh(a, b, c, d, e) { d = pb(d); var f = ub(2, d), g = b.left, h = b.top, k = b.right; c = k + (c ? f + (k === b.left ? 0 : 1) : 1); var l = b.bottom, m = [], n, q; e && (n = g + (1 + k - g) / 2 + e.x / a.tileSize - .5, q = h + (1 + l - h) / 2 + e.y / a.tileSize - .5); for (; g < c;) { for (h = b.top; h <= l;)a = g % f, m.push([a, h, d, e ? rb(n - g) + rb(q - h) : 0]), h++; g++ } return m } function sh(a, b, c) { var d; c = pb(c); a.pixelProjection.Ja(c); b = a.j(b); d = a.i(b, c); return rh(a, d, b.left > b.right, c) }
    nh.prototype.o = function (a, b, c, d, e, f) { if (!B(a, qh)) throw new C(this.o, 0, a); if (D(c = +c)) throw new C(this.o, 1, c); var g, h = [], k, l = this.f; f = null != f ? f : "__default__"; var m = l.requestTile; d || (g = {}); b = rh(this, a, b, c, e); if (a = b.length) for (d || b.sort(th), c = a; c--;)e = b[c], d || (g[l.A.apply(l, e)] = !0), e[3] = +d, (k = m.apply(l, e)) && h.push(k); if (!d) { d = g; var n; g = this.N[f] || {}; for (n in g) g.hasOwnProperty(n) && g[n] && !d[n] && this.f.cancelTileByKey(n); this.N[f] = d } return { total: a, tiles: h } }; nh.prototype.getProviderTiles = nh.prototype.o;
    function th(a, b) { return b[3] - a[3] }; function uh(a, b) { this.opacity = 1; uh.u.constructor.call(this, a, b) } v(uh, nh); r("H.map.layer.MarkerTileLayer", uh); var vh = { markers: [], total: 0, requested: 0 }; function wh(a, b, c, d, e) { var f; f = pb(c); a.pixelProjection.Ja(f); b = a.j(b); f = a.i(b, f); c = a.o(f, f.left > f.right, ~~c, d, e); a = c.tiles; c = c.total; d = a.length; e = []; var g; for (g = 0; g < d; g++)for (f = a[g], b = f.data.length; b--;)e.push(f.data[b]); return { markers: e, total: a.length, requested: c } }
    uh.prototype.c = function (a, b, c, d) { return this.f.providesDomMarkers() ? vh : wh(this, a, b, c, d) }; uh.prototype.requestMarkers = uh.prototype.c; uh.prototype.b = function (a, b, c, d) { return this.f.providesDomMarkers() ? wh(this, a, b, c, d) : vh }; uh.prototype.requestDomMarkers = uh.prototype.b; function xh(a, b) { xh.u.constructor.call(this, Of, b); this.o(a) } v(xh, Uf); r("H.map.Rect", xh); xh.prototype.o = function (a) { if (!B(a, G)) throw new C(this.o, 0, a); a.pa(this.kb) || (this.kb = this.a = a, this.i !== x && xh.u.c.call(this, yh(this))) }; xh.prototype.setBounds = xh.prototype.o; xh.prototype.S = function () { return this.a }; xh.prototype.getBounds = xh.prototype.S; xh.prototype.A = function () { return this }; xh.prototype.setNorthPoleCovering = xh.prototype.A; xh.prototype.c = function () { return this }; xh.prototype.setGeometry = xh.prototype.c;
    xh.prototype.Ca = function () { this.i || xh.u.c.call(this, yh(this)); return this.i }; xh.prototype.getGeometry = xh.prototype.Ca; xh.prototype.f = function () { return this }; xh.prototype.setStrip = xh.prototype.f; xh.prototype.b = function () { return this.Ca().$a }; xh.prototype.getStrip = xh.prototype.b; function yh(a) { var b = a.a, c, d, e, f; a = [c = b.ka, d = b.ga, A, c, f = b.ha, A, e = b.ja, f, A, e, d, A]; 180 <= b.ab() && (a.splice(9, 0, e, d = b.Oa().lng, A), a.splice(3, 0, c, d, A)); return new E(new F(a)) }; function zh(a, b, c) { if (!a || !b || !c) throw new C(zh, null, "Must specify name, version and revision parameter"); this.name = a; this.version = b; this.revision = c } r("H.util.BuildInfo", zh); zh.prototype.toString = function () { return this.name + ";" + this.version + ";" + this.revision }; var Ah = {}; function Bh(a, b, c) { if (!a) throw new C(Bh, 1, "Must specify a name parameter"); return Ah[a] || (Ah[a] = new zh(a, b, c)) } zh.get = Bh; function Ch() { Ch.u.constructor.call(this); this.a = Dh(this); this.f = Ka(); this.c = z(this.c, this); this.a.addEventListener("message", this.c) } v(Ch, I); Ch.prototype.D = function () { this.a.terminate() }; Ch.prototype.i = function (a) { var b = a.type, c = !!this.f[b], d = a.data, e = Eh++, f = d && d.Ei ? d.Ei : A, g = !0; c ? (this.b[e] = a, Fh(this, b, e, d && d.message, f)) : (a.reject(new C(this.i, 0, "processor_not_found")), g = !1); return g };
    Ch.prototype.c = function (a) { a = a.data; var b = this.b[a.taskId], c = a.taskId, d = a.data, e = this; if (2 === a.type) (new Gh(Hh, d)).then(function (a) { e.a.postMessage(["3", c, [a]], [a]) }, function () { e.a.postMessage(["3", c, [null, "ERROR"]]) }); else { if (b) { switch (a.type) { case 1: b.resolve(d); break; case 0: b.reject(d) }delete this.b[c] } this.dispatchEvent(new Bc(this.g.IDLE)) } }; Ch.prototype.b = {}; var Eh = 0; function Ih(a, b, c) { var d = Eh++, e; a.b[d] = e = gd(); Fh(a, b, d, c); return e.sf }
    function Fh(a, b, c, d, e) { d === A || qa(d) || (d = [d]); try { a.a.postMessage([b, c, d], e) } catch (f) { a = a.b[c], a.reject(f.message) } } Ch.prototype.g = { IDLE: "idle", ERROR: "error" }; Ch.prototype.l = function (a, b) { var c = this.j || (this.j = new Bc(this.g.ERROR)); c.data = b; delete this.f[a]; this.dispatchEvent(c) }; Ch.prototype.importScripts = function (a) { Ih(this, "0", a) };
    function Dh(a) { var b = w.H.__bootstrap__, c, b = sa(b) ? ("" + b).replace(/^[^{]+{((.|[\r\n])+?)}\s*$/, "$1") : "" + b; if (w.Worker && w.URL) try { c = new w.Worker(w.URL.createObjectURL(Ke(b, "application/javascript"))) } catch (d) { } c || (a = new Jh(a), function () { eval("var self = arguments[0];" + b) }(a), c = new Kh(a)); return c } function Kh(a) { I.call(this); this.a = a } v(Kh, I); Kh.prototype.postMessage = function (a) { w.setTimeout(z(this.b, this, a), 0) }; Kh.prototype.b = function (a) { var b = new Bc("message"); b.data = a; this.a.dispatchEvent(b) };
    Kh.prototype.terminate = function () { this.a.J(); this.J() }; function Jh(a) { I.call(this); this.a = a; this.addEventListener = z(this.addEventListener, this); this.removeEventListener = z(this.removeEventListener, this); this.postMessage = z(this.postMessage, this); this.eval = z(eval, this) } v(Jh, I); Jh.prototype.postMessage = function (a) { var b = new Bc("message"); b.data = a; w.setTimeout(z(this.a.c, this.a, b), 0) }; function Lh() { var a = Mh; a || (a = Mh = this, I.call(a), this.b()); return a } var Mh; v(Lh, I); Lh.prototype.D = function () { Lh.u.D.call(this); this.b() };
    Ca(Lh.prototype, {
        b: function () { var a = this.Hf, b; if (a) for (b = a.length; b--;)a[b].J(); this.Hf = []; this.Ed = Ka(); this.Zg = Ka() }, se: function (a) { var b, c, d; a = a.type; if (d = this.Zg[a]) b = this.Hf, c = b[0], c || (c = b[0] = new Ch, this.Eb(za(Ac, c)), Wa(this.Ed) || c.importScripts(w.Object.keys(this.Ed))), b = c, b.f[a] || (b.f[a] = d, Ih(b, "1", [a, sa(d) ? d + "" : d]).then(sc, z(b.l, b, a))); else throw new kc(this.se, 'Unknown type "' + a + '"'); return c }, ye: function () { }, md: function (a, b) {
            var c = this.Zg, d = c[a]; if (d) {
                if (b !== d) throw new kc(this.md, 'Type "' +
                    a + '" is already registered');
            } else c[a] = b
        }, importScripts: function (a) { [].concat(a).forEach(function (a) { this.Ed[a] || (this.Ed[a] = !0, this.Hf.forEach(function (c) { c.importScripts(a) })) }, this) }
    }); function Nh(a, b, c) { td.call(this, a, b, c) } v(Nh, td); Ca(Nh.prototype, { Fe: function () { var a = new wd(new Lh); return function () { return a } }(), Sc: sc, De: function (a) { return a.i(this) } }); function Oh(a, b) { var c = b || {}, d = c.contextType, c = c.contextAttributes; Oh.u.constructor.call(this, b); B(a, Function, Oh, 0, "invalid render callback"); if (d) { if (-1 === Ph.indexOf(d)) throw new C(Oh, 1, "invalid context type"); this.v = d } c && (this.F = c); this.g = a } v(Oh, mh); r("H.map.layer.CanvasLayer", Oh); var Ph = Ra("2d webgl webgl2 experimental-webgl"); Oh.prototype.v = "2d"; Oh.prototype.ca = function (a, b) { this.f && this.f.canvas === a || (this.f = a.getContext(this.v, this.F)); return this.g(this.f, b) };
    Oh.prototype.D = function () { Oh.u.D.call(this); this.f = A }; function Qh(a, b) { Qh.u.constructor.call(this, b); B(a, Function, Qh, 0, "invalid render callback"); this.f = a } v(Qh, mh); r("H.map.layer.DomLayer", Qh); Qh.prototype.ca = function (a, b) { return this.f(a, b) }; function Rh(a, b) { var c, d = a; if (!B(d, Element)) { Sh.innerHTML = d; d = Sh.firstElementChild; if (!d) throw new C(Rh, 0, "No element data"); Sh.removeChild(d); c = !0; Sh.innerHTML = "" } this.c = 0 !== Ee(d).length; this.i = c ? d : Fe(d, w.document, this.c); b && (c = "onAttach", c in b && Xa(d = b[c], "Function", Rh, 1, c) && (this.ff = d), c = "onDetach", c in b && Xa(d = b[c], "Function", Rh, 1, c) && (this.f = d)) } r("H.map.DomIcon", Rh); var Sh = document.createElement("DIV"); Rh.prototype.ff = null; Rh.prototype.f = null; Rh.prototype.c = !1; function Th(a, b) { this.w = +a; this.h = +b } r("H.math.Size", Th); function Uh(a, b) { var c, d, e, f, g, h, k; f = a; var l = b || []; if (a !== Vh.NONE) { c = d = l.length; if (-1 === this.c.indexOf(f)) throw new C(Uh, 0, a); if (!l) throw new C(Uh, 1, l); for (; d--;)if (D(l[d])) throw new C(Uh, 1, l); f === Vh.RECT && 3 < c && (l = [l[0], l[1], l[2], l[1], l[2], l[3], l[0], l[3]], f = Vh.POLYGON); if (f === Vh.CIRCLE && 2 < c && (e = l[2], 0 < e)) { f = l[0]; g = l[1]; d = lb(2 * qb(e), 40); h = 360 / d; for (l = []; d--;)k = h * d * Ib, l.push(f + wb(k) * e, g + yb(k) * e); f = Vh.POLYGON } if (f !== Vh.POLYGON || !c || l.length % 2) throw new C(Uh, 1, l); this.b = l } } r("H.map.HitArea", Uh);
    var Vh = { NONE: 0, RECT: 1, CIRCLE: 2, POLYGON: 3 }; Uh.ShapeType = Vh; Uh.prototype.c = [Vh.RECT, Vh.CIRCLE, Vh.POLYGON]; Uh.prototype.a = function (a, b, c) { return this.b ? Ub(a, b, this.b, c, !0) : Tb.NONE }; Uh.prototype.hitTest = Uh.prototype.a; function Wh(a, b) { var c; Ua(this, Wh); Wh.u.constructor.call(this, b); this.a(a); b && "icon" in b && (c = b.icon); this.$b(c || Xh(this)) } v(Wh, K); r("H.map.AbstractMarker", Wh); Wh.prototype.getPosition = function () { return B(this.b, sg) ? this.b.ma[0] : this.b }; Wh.prototype.getPosition = Wh.prototype.getPosition; Wh.prototype.f = function (a) { hc(a, this.f, 0); this.a(a); return this }; Wh.prototype.setPosition = Wh.prototype.f; Wh.prototype.Ca = function () { return this.b }; Wh.prototype.getGeometry = Wh.prototype.Ca;
    Wh.prototype.a = function (a) { var b = this.b; B(a, gc) || B(a, sg) ? this.b = a : (hc(a, this.a, 0), this.b = ic(a)); b && this.ua(Me.SPATIAL); return this }; Wh.prototype.setGeometry = Wh.prototype.a; Wh.prototype.S = function () { return this.b.S() }; Wh.prototype.sb = function () { return this.icon }; Wh.prototype.getIcon = Wh.prototype.sb; Wh.prototype.$b = function (a) { var b = this.icon, c = !b; if (b !== a) { if (!B(a, this.pg)) throw C.apply(b = new C, c ? [this.constructor, 1, "icon"] : [this.a, 0, a]), b; this.icon = a; c || this.ua(Me.VISUAL) } return this };
    Wh.prototype.setIcon = Wh.prototype.$b; function Xh(a) { var b = a.i; b || (b = a.constructor.prototype.i = a.c(Yh)); return b }
    var Yh = {
        svg: '<svg xmlns="http://www.w3.org/2000/svg" width="28px" height="36px"><path d="M 19 31 C 19 32.7 16.3 34 13 34 C 9.7 34 7 32.7 7 31 C 7 29.3 9.7 28 13 28 C 16.3 28 19 29.3 19 31 Z" fill="#000" fill-opacity=".2"/><path d="M 13 0 C 9.5 0 6.3 1.3 3.8 3.8 C 1.4 7.8 0 9.4 0 12.8 C 0 16.3 1.4 19.5 3.8 21.9 L 13 31 L 22.2 21.9 C 24.6 19.5 25.9 16.3 25.9 12.8 C 25.9 9.4 24.6 6.1 22.1 3.8 C 19.7 1.3 16.5 0 13 0 Z" fill="#fff"/><path d="M 13 2.2 C 6 2.2 2.3 7.2 2.1 12.8 C 2.1 16.1 3.1 18.4 5.2 20.5 L 13 28.2 L 20.8 20.5 C 22.9 18.4 23.8 16.2 23.8 12.8 C 23.6 7.07 20 2.2 13 2.2 Z" fill="#18d"/></svg>', size: new Th(28,
            36), anchor: new M(14, 32), hitArea: new Uh(3, [0, 16, 0, 7, 8, 0, 18, 0, 26, 7, 26, 16, 18, 34, 8, 34])
    }; function fh(a, b) { fh.u.constructor.call(this, a, b) } v(fh, Wh); r("H.map.DomMarker", fh); fh.prototype.type = Pe.DOM_MARKER; fh.prototype.je = 2; fh.prototype.c = function (a) { var b = new Rh(a.svg, a); a = a.anchor; b.i.style.margin = -a.y + "px 0 0 -" + a.x + "px"; return b }; fh.prototype.pg = Rh; function Zh(a, b) { var c = b || {}; "status" in c && (this.status = +c.status); "statusText" in c && (this.statusText = c.statusText); this.ok = 200 <= this.status && 300 > this.status; this.b = !1; a ? "string" === typeof a && (this.a = a) : this.a = "" } r("H.net.Response", Zh); Zh.prototype.type = "default"; Zh.prototype.type = Zh.prototype.type; Zh.prototype.status = 200; Zh.prototype.status = Zh.prototype.status; Zh.prototype.statusText = "OK"; Zh.prototype.statusText = Zh.prototype.statusText;
    Zh.b = function (a) { if (a.b) return fd(new TypeError("Already read")); a.b = !0 }; Zh.error = function () { Zh.a || (Zh.a = new Zh(null, { status: 0, statusText: "" }), Zh.a.type = "error"); return Zh.a }; Zh.error = Zh.error; Zh.prototype.text = function () { var a = Zh.b(this); a || (a = this.a ? new Xc(Zc, this.a) : fd("Unsupported response body")); return a }; Zh.prototype.json = function () { return this.text().then(w.JSON.parse) }; w.Response && w.Response.error && (Zh = w.Response); function $h(a, b, c) {
        function d() { var a = z(l.b, l), b = +k.timeout || 0; ai ? (bi(l, "timeout", a), e.timeout = b) : b && (l.f = setTimeout(function () { e.abort(); l.b({ type: "timeout" }) }, b)); bi(l, "error", a); bi(l, "load", a); e.send(k.data) } var e, f, g, h = c && c.headers || {}, k = {}, l = this; if (!sa(b)) throw new C($h, 1, "function required"); a += ""; Ca(h, ci.headers, h); Ca(k, ci, c || {}); k.headers = h; this.c = b; this.a = e = new XMLHttpRequest; b = k.method; try {
            e.open(b, a, !0); for (f in h) h.hasOwnProperty(f) && (g = h[f]) && e.setRequestHeader(f, g); e.withCredentials =
                !!k.withCredentials; d()
        } catch (m) { if (di) this.b({ type: "cors" }); else { this.a = e = new XDomainRequest; try { e.open(b, a), e.onprogress = function () { }, d() } catch (n) { this.b({ type: "cors" }) } } }
    } r("H.net.Xhr", $h); var ci = { method: "GET", headers: {}, data: null }, di = "withCredentials" in new XMLHttpRequest, ai = "timeout" in new XMLHttpRequest; function bi(a, b, c) { di ? a.a.addEventListener(b, c) : a.a["on" + b] = c } function ei(a, b, c) { di ? a.a.removeEventListener(b, c) : a.a["on" + b] = null }
    $h.prototype.g = function () { this.a && (this.a.abort(), this.a && this.b({ type: "abort" })) }; $h.prototype.abort = $h.prototype.g;
    $h.prototype.b = function (a) { var b = a.type; a = this.a; var c, d; this.f && clearTimeout(this.f); "load" === b ? a instanceof XMLHttpRequest && 200 !== a.status && (c = "network") : c = 4 === a.readyState && 0 === a.status && "error" == b ? "cors" : "error" != b ? b : "network"; b = this.b; ei(this, "timeout", b); ei(this, "error", b); ei(this, "load", b); 0 === a.status || c && "network" !== c ? d = Zh.error() : d = new Zh(a.responseText, a); c = this.c; delete this.b; delete this.c; delete this.a; c(d) }; function fi() { var a = fi.a; a || (a = this, fi.a = a, I.call(a), this.a()); return a } v(fi, I); fi.prototype.D = function () { fi.u.D.call(this); this.a() };
    Ca(fi.prototype, { a: function () { this.oi = 10; this.pi = 6; this.Jc = Ka(); this.uf = Ka(); this.xf = 0 }, se: function (a) { a = a.type; var b = this.Jc[a] || 0, c; return this.xf < this.oi && b < this.pi ? (c = this.Fi(), this.xf++ , this.Jc[a] = b + 1, this.uf[c] = a, c) : x }, ye: function (a) { var b = this.uf[a]; if (!Ta(b) || !this.Jc[b]) throw new kc(this.ye, "Unknown requestId"); this.xf--; this.Jc[b]--; this.Jc[b] || delete this.Jc[b]; delete this.uf[a]; this.dispatchEvent("allocatable") }, di: -1, Fi: function () { return ++this.di } }); function Gh(a, b, c, d) { var e = gi; if (!this.b[a]) throw new C(Gh, 0, "Mime type is not supported"); this.g = a; this.a = d; e.href = b; td.call(this, e.protocol + "//" + e.hostname, b, c) } v(Gh, td); Gh.prototype.De = function () { this.f = this.b[this.g].call(this); return !0 }; Gh.prototype.Sc = function () { this.f && (this.f.abort(), this.f = null) };
    Gh.prototype.b = {
        "application/json": function () { var a = this, b = this.a || {}; (b.headers || (b.headers = {})).Accept = "application/json"; return new $h(this.data, function (b) { 200 <= b.status && 300 > b.status ? a.resolve(b.json()) : a.reject(b) }, b) }, "text/plain": function () { var a = this; return new $h(this.data, function (b) { 200 <= b.status && 300 > b.status ? a.resolve(b.text()) : a.reject(b) }, this.a) }, image: function () {
            var a = w.document.createElement("img"), b = this.a && this.a.crossOrigin, c = this; a.onload = z(this.resolve, this, a); a.onerror = function () { c.reject(Zh.error()) };
            a.src = this.data; Ta(b) && (a.crossOrigin = b); return { abort: function () { a.onerror = a.onload = null; ve && Ie(a) || a.removeAttribute("src") } }
        }
    }; (function () { var a; try { a = new XMLHttpRequest, a.open("get", "/", !0) } catch (b) { a = {} } "response" in a && (Gh.prototype.b.arraybuffer = function () { var a = new XMLHttpRequest, b = this; a.open("GET", this.data); a.responseType = "arraybuffer"; a.onerror = a.ontimeout = function () { b.reject(Zh.error()) }; a.onload = function () { b.resolve(a.response) }; a.send(); return a }) })();
    Gh.prototype.Fe = function () { var a = new wd(new fi); return function () { return a } }(); var Hh = "arraybuffer", gi = w.document.createElement("a"); function hi(a) { var b = ii[a]; if (!b) if (a in ji) b = ii[a] = a; else { var b = ki.length, c = "", d = a.substr(0, 1).toUpperCase() + a.substr(1), e = "", f = !1; li && (e = li + d, f = e in ji); for (; b-- && !f;)c = ki[b], e = c + d, f = e in ji; f && (li = c); if (b = f ? e : null) ii[a] = b; else throw Error("Could not find any variant of CSS property [" + a + "]"); } return b } r("H.dom.cssPrefixer.prefix", hi); var ki = ["O", "Ms", "ms", "Moz", "Webkit"], ii = {}, li = "", ji = document.createElement("span").style; function mi(a, b, c, d, e) { b && (this.c = b); Ta(c) && (this.te = !!c); this.te && d && (this.b = new Th(d.w, d.h)); e && (this.f = { crossOrigin: "anonymous" }); switch (ni[Ya(a)]) { case 2: this.ic = a; oi(this, 1); break; case 1: if (Ie(a)) { this.ic = a; pi(this); oi(this, 1); break } a = a.src; case 0: if (a) { a = xe(a); this.a = new Gh("image", a, A, this.f); this.a.then(z(this.i, this), z(this.g, this)); break } default: throw oi(this, -1), new C(mi, 0, "No image data"); } } p = mi.prototype; p.G = 0; p.getState = function () { return this.G };
    function oi(a, b) { a.G = b; delete a.a; a.c && a.c(b, a) } p.te = !0; function pi(a) { if (a.te) { var b = a.ic, c = qi(a), d, e = c && c.w || +b.width, f = c && c.h || +b.height; B(b, w.HTMLCanvasElement) ? c = b : (c = b.ownerDocument.createElement("CANVAS"), c.width = e, c.height = f, d = c.getContext("2d"), d.drawImage(b, 0, 0, e, f)); a.ic = c } } p.ic = x; p.getData = function () { return this.ic }; var ni = { String: 0, HTMLImageElement: 1, HTMLCanvasElement: 2 }; mi.prototype.b = x;
    function qi(a) { var b = a.b, c, d, e, f; if (!b) { c = a.ic; b = c.naturalWidth || c.width; if (0 === b && ve && 1 === ni[Ya(c)]) { d = !0; if (e = c.parentNode) f = c.nextSibling; document.body.appendChild(c) } a.b = b = new Th(c.naturalWidth || c.width, c.naturalHeight || c.height); d && (e ? e.insertBefore(c, f) : document.body.removeChild(c)) } return b } mi.prototype.i = function (a) { this.ic = a; pi(this); oi(this, 1) }; mi.prototype.g = function () { oi(this, -1) }; mi.prototype.cancel = function () { this.a && this.a.cancel() }; function ri(a, b) { var c, d, e, f; this.uid = si.next(); ri.u.constructor.call(this); if (b) { c = "size"; if (c in b) { d = b[c]; if (!d || isNaN(d.w) || isNaN(d.h)) throw new C(ri, 1, c); this.b = new Th(d.w, d.h) } c = "anchor"; if (c in b) { d = b[c]; if (!d || isNaN(d.x) || isNaN(d.y)) throw new C(ri, 1, c); this.a = new M(d.x, d.y) } c = "hitArea"; c in b && (d = b[c], B(d, Uh, ri, 1), this.g = b[c]); c = "asCanvas"; c in b && (e = b[c]); c = "crossOrigin"; c in b && (f = b[c]) } c = new mi(a, z(this.i, this), e, this.b, f); d = this.G = c.getState(); 0 !== d ? this.i(d, c) : this.f = c } v(ri, I);
    r("H.map.Icon", ri); var si = new ye; ri.prototype.Pc = { ERROR: -1, LOADING: 0, READY: 1 }; ri.prototype.State = ri.prototype.Pc; ri.prototype.getState = function () { return this.G }; ri.prototype.getState = ri.prototype.getState; ri.prototype.i = function (a, b) { this.c = b.getData(); if (1 === a) { var c = this.b; c || (c = this.b = 1 === b.G ? qi(b) : x); this.a || (this.a = new M(c.w / 2 | 0, c.h)) } this.f && (this.G = a, delete this.f, this.dispatchEvent("statechange")) }; ri.prototype.c = x; ri.prototype.Pb = function () { return this.c }; ri.prototype.getBitmap = ri.prototype.Pb;
    ri.prototype.b = x; ri.prototype.o = function () { return this.b }; ri.prototype.getSize = ri.prototype.o; ri.prototype.a = x; ri.prototype.j = function () { return this.a }; ri.prototype.getAnchor = ri.prototype.j; ri.prototype.g = x; ri.prototype.l = function () { return this.g }; ri.prototype.getHitArea = ri.prototype.l; ri.prototype.D = function () { ri.u.D.call(this); this.c ? (this.c.removeAttribute("src"), delete this.c) : (this.f.cancel(), delete this.f) }; var ti = he; r("H.util.events.listenOnce", ti); r("H.util.events.dispatchEvent", function (a, b) { return a.dispatchEvent(b) }); r("H.util.events.fireListeners", function (a, b, c, d) { return zd(a) ? a.dc(b, c, d) : ke(a, b, c, d) }); var ui = ae; r("H.util.events.listen", ui); var vi = ie; r("H.util.events.unlisten", vi);
    var wi = le, le = function (a, b) { var c, d, e, f = !0; c = b[b.currentTarget === b.target ? "AT_TARGET" : a.ya ? "CAPTURING_PHASE" : (d = !0, "BUBBLING_PHASE")]; if (!d || "pointerenter" !== (e = b.type) && "pointerleave" !== e) b.eventPhase = c, f = wi(a, b), d && a.src && a.src.jb && null === a.src.jb() && delete b.eventPhase; return f }; function xi(a, b) { xi.u.constructor.call(this, a, b) } v(xi, Wh); r("H.map.Marker", xi); p = xi.prototype; p.type = Pe.MARKER; p.je = 1; p.ua = function (a) { var b; if (a !== Me.VISUAL || 1 === this.Yg || 1 === this.icon.getState()) b = xi.u.ua.call(this, a); return b || !1 }; p.Yg = 0; p.pg = ri; p.Le = !1; p.Hg = function () { this.ua(Me.VISUAL) };
    p.$b = function (a) { var b = this.icon; this.Le && (b.removeEventListener("statechange", this.Hg, !1, this), delete this.Le); b && (this.Yg = b.getState()); xi.u.$b.call(this, a); 0 === a.getState() && (this.Le = !0, ti(a, "statechange", this.Hg, !1, this)); return this }; xi.prototype.setIcon = xi.prototype.$b; xi.prototype.c = function (a) { return new ri(a.svg, a) }; function yi(a, b, c, d) { yi.u.constructor.call(this, a, b, c); this.modifiers = d } v(yi, Ne); r("H.map.ChangeEvent", yi); yi.prototype.b = 1; yi.prototype.FOV = yi.prototype.b; yi.prototype.PITCH = 2; yi.prototype.PITCH = yi.prototype.PITCH; yi.prototype.POSITION = 4; yi.prototype.POSITION = yi.prototype.POSITION; yi.prototype.c = 8; yi.prototype.ROLL = yi.prototype.c; yi.prototype.f = 16; yi.prototype.SIZE = yi.prototype.f; yi.prototype.g = 32; yi.prototype.YAW = yi.prototype.g; yi.prototype.ZOOM = 64; yi.prototype.ZOOM = yi.prototype.ZOOM; function zi() { this.Y = []; zi.u.constructor.call(this) } v(zi, I); r("H.util.OList", zi); function Ai(a, b, c) { a = a.Y.length; var d; if (c) d = a; else if (D(d = 0 > (d = +b) ? mb(0, a + d) : lb(a, d))) throw new ec(zi, b, [0, a - 1]); return d } zi.prototype.add = function (a, b) { var c = Ai(this, b, D(b)); this.Y.splice(c, 0, a); this.dispatchEvent(new Bi(this, this.a.Lc, c, a, null, null)) }; zi.prototype.add = zi.prototype.add; function Ci(a, b) { var c = a.Y.splice(b, 1)[0]; a.dispatchEvent(new Bi(a, a.a.Nc, b, null, c, null)); return c }
    zi.prototype.b = function (a) { this.get(a); return Ci(this, a) }; zi.prototype.removeAt = zi.prototype.b; zi.prototype.remove = function (a) { a = this.indexOf(a); return 0 <= a ? (Ci(this, a), !0) : !1 }; zi.prototype.remove = zi.prototype.remove; zi.prototype.set = function (a, b) { var c = this.get(a); a = Ai(this, a, !1); c = this.Y[a]; this.Y[a] = b; this.dispatchEvent(new Bi(this, this.a.td, a, b, c, null)); return c }; zi.prototype.set = zi.prototype.set; zi.prototype.indexOf = function (a) { return this.Y.indexOf(a) }; zi.prototype.indexOf = zi.prototype.indexOf;
    zi.prototype.get = function (a) { var b = Ai(this, a, !1), c = this.Y; if (b >= c.length) throw new ec(this.get, a, [0, c.length - 1]); return c[b] }; zi.prototype.get = zi.prototype.get; zi.prototype.g = function () { return this.Y.length }; zi.prototype.getLength = zi.prototype.g; zi.prototype.c = function () { return [].concat(this.Y) }; zi.prototype.asArray = zi.prototype.c; zi.prototype.f = function () { for (var a = this.Y.length; a--;)Ci(this, a) }; zi.prototype.flush = zi.prototype.f; zi.prototype.D = function () { this.f(); zi.u.D.call(this) };
    zi.prototype.a = { Lc: "add", Nc: "remove", td: "set", Pi: "move" }; function Bi(a, b, c, d, e, f) { Bi.u.constructor.call(this, b, a); this.idx = c; this.added = d; this.removed = e; this.moved = f } v(Bi, Bc); function Di(a) { Di.u.constructor.call(this); this.dispatchEvent = z(this.dispatchEvent, this); if (a) for (var b = 0, c = a.length; b < c; b++)this.add(a[b]) } v(Di, zi); r("H.map.DataModel", Di); Di.prototype.add = function (a, b) { B(a, mh, this.add, 0); Di.u.add.call(this, a, b); a.addEventListener(a.a.la, this.dispatchEvent, !1) }; Di.prototype.add = Di.prototype.add;
    Di.prototype.set = function (a, b) { var c; B(b, mh, this.set, 0); c = Di.u.set.call(this, a, b); b.addEventListener(b.a.la, this.dispatchEvent, !1); c.removeEventListener(c.a.la, this.dispatchEvent, !1); return c }; Di.prototype.set = Di.prototype.set; Di.prototype.b = function (a) { var b; (b = Di.u.b.call(this, a)) && b.removeEventListener(b.a.la, this.dispatchEvent, !1); return b }; Di.prototype.removeAt = Di.prototype.b;
    Di.prototype.remove = function (a) { var b; (b = Di.u.remove.call(this, a)) && a.removeEventListener(a.a.la, this.dispatchEvent, !1); return b }; Di.prototype.remove = Di.prototype.remove; Di.prototype.f = function () { for (var a = this.Y.length; a--;)this.b(a); Di.u.f.call(this) }; Di.prototype.flush = Di.prototype.f; function Ei(a, b) { sa(a) && (this.i = a); ab(b) && (this.a = b) } r("H.util.Request", Ei); Ei.State = { PENDING: 0, PROCESSING: 1, COMPLETE: 2, CANCELLED: 3, ERROR: 4 }; var Fi = { Vf: 0, ne: 1, le: 2, Ji: 3, ERROR: 4 }, Gi = [0, 1, 2, 3, 4]; Ei.prototype.G = 0; Ei.prototype.getState = function () { return this.G }; Ei.prototype.getState = Ei.prototype.getState; Ei.prototype.L = function (a) { if (0 > Gi.indexOf(a)) throw new C(this.L, 0, a); if (this.G !== a || 1 === a && 1 < this.a) this.G = a, this.i && this.i(this) }; Ei.prototype.a = 1; Ei.prototype.m = function () { return this.a };
    Ei.prototype.getTotal = Ei.prototype.m; Ei.prototype.b = 0; Ei.prototype.o = function () { return this.b }; Ei.prototype.getProcessed = Ei.prototype.o; Ei.prototype.g = 0; Ei.prototype.j = function () { return this.g }; Ei.prototype.getFailed = Ei.prototype.j; function Hi(a, b) { a.b < a.a && (Ta(b) || (b = Fi.le), b === Fi.Vf || b === Fi.ne || a.G !== Fi.Vf && a.G !== Fi.ne || (a.b++ , b !== Fi.le && a.g++ , a.L(a.b < a.a ? Fi.ne : Fi.le))) } Ei.prototype.cancel = function () { 3 !== this.G && (this.Sc(), this.L(3)) }; Ei.prototype.cancel = Ei.prototype.cancel; function Ii() { } r("H.util.ICapturable", Ii); Ii.prototype.ya = function () { }; Ii.prototype.capture = Ii.prototype.ya; r("H.util.Disposable", xc); xc.prototype.Eb = xc.prototype.Eb; xc.prototype.addOnDisposeCallback = xc.prototype.Eb; r("H.util.dispose", Ac); function Ji(a, b) {
        var c = a.b, d = c.ownerDocument; Ji.u.constructor.call(this); this.a = a; this.b = c = c.appendChild(Ki(d, "DIV", "position:absolute;bottom:4.55em;left:0.5em;z-index:1;height:0px;direction:ltr")); this.ve = Ki(d, "DIV", "position:absolute;top:0px;pointer-events:none;", Li); this.m = c.appendChild(this.ve).firstChild.firstChild.style; c = c.appendChild(Ki(d, "DIV", "-webkit-touch-callout: none;-webkit-user-select:none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select:none;whiteSpace:nowrap;position:relative;top:2.73em;padding-left:1px"));
        this.i = c.appendChild(Ki(d, "SPAN")); this.i.setAttribute("unselectable", "on"); this.l = c.appendChild(Ki(d, "A", "color:inherit", "Terms of use")); this.l.target = "_blank"; this.s = c = c.appendChild(Ki(d, "SPAN", "color:inherit", " | ")); this.B = c.appendChild(function () { var a = Ki(d, "A", "color:inherit", "Report image"); a.target = "_blank"; return a }()); this.o = Qa(Mi); this.g(b); this.f = z(this.f, this); this.c = z(this.c, this); this.a.addEventListener(this.a.v.Sf, this.f); this.a.fa.addEventListener("add", this.c); this.a.fa.addEventListener("remove",
            this.c); this.a.fa.addEventListener("set", this.c); this.c()
    } var Ni; v(Ji, xc); r("H.map.Imprint", Ji); var Mi = { font: "11px Arial,sans-serif", href: "https://legal.here.com/{LN}/terms/serviceterms/{CN}", invert: !1, reportHref: "https://wego.here.com/", locale: "en-US" };
    Ji.prototype.g = function (a) { var b, c; a || (this.o = Qa(Mi)); c = this.o; for (b in c) a && b in a && (c[b] = a[b]); a = c.invert; this.m.fill = a ? "#FFF" : "rgba(0,0,0, 0.7)"; this.b.style.color = a ? "#FFF" : "#333"; this.sg = a; a = c.locale; Oi[a] || (a = "en-US", c.locale = a); this.l.innerHTML = Oi[a]; a = a.split("-"); this.l.href = c.href.replace("{LN}", a[0]).replace("{CN}", a[1].toLowerCase()); this.b.style.font = c.font }; Ji.prototype.setOptions = Ji.prototype.g;
    function Ki(a, b, c, d) { a = a.createElement(b); c && (a.style.cssText = c); d && (a.innerHTML = d); return a } Ji.prototype.v = function () { return this.b }; Ji.prototype.getElement = Ji.prototype.v; Ji.prototype.f = function () { var a = Mi.reportHref, b = this.a, c = this.B, d = this.s, e; b.g().type !== Pi ? d.style.display = "none" : (b = b.c.Ab(), e = b.position, d.style.display = "inline", c.href = a + [e.lat, e.lng, 22, b.yaw, 90 + b.pitch].join() + ",panorama.day,report"); this.i.innerHTML = this.j + " " + this.Ia() + " | " };
    Ji.prototype.c = function () { this.f(); setTimeout(this.f, 5E3) };
    var Li = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="3.64em" height="2.72em" viewBox="7 10 33 18" style="position: relative; left: 2px;"><g><path id="triangle_22_" d="M14.1,28l-3.6,3.6L7,28L14.1,28z"/><path id="here_21_" d="M19.4,19.9c-0.7-0.9-0.7-1.4-0.2-1.8c0.6-0.6,1.1-0.3,1.8,0.3L19.4,19.9z M27,10.3c0.6-0.6,1.1-0.3,1.8,0.3l-1.5,1.5C26.5,11.2,26.6,10.7,27,10.3z M31.6,11.8c-0.7,1-1.9,2.7-3.2,1.4l3.2-3.2c-0.3-0.3-0.5-0.6-0.7-0.7c-1.7-1.7-3.7-1.7-5.2-0.2c-1,1-1.3,2.2-1,3.3l-1-1.1c-0.3,0.2-1.5,1.2-0.6,2.9l-1.1-1l-1.5,1.5l2.1,2.1C21,15.5,19.3,15.6,18,17c-1.5,1.5-1.4,3.2-0.3,4.7l-0.2-0.2c-1.5-1.5-3-0.9-3.8-0.2c-0.6,0.6-1,1.4-0.8,2l-3.1-3.1L8,21.8l6.2,6.2h3.3l-2.2-2.2c-1.2-1.2-1.2-1.8-0.6-2.4c0.5-0.5,1.2-0.2,2.3,0.9l2.2,2.2l1.7-1.7l-2.1-2.1c1.5,1.1,3.3,1.2,4.9-0.4c0,0,0,0,0,0l0,0c1-0.9,1.3-1.8,1.3-1.8l-1.3-0.8c-0.7,1-1.9,2.7-3.1,1.5l3.2-3.2l2,2l1.7-1.7l-2.5-2.5c-1.2-1.2-0.5-2.3,0-2.7c0.2,0.5,0.6,0.9,1,1.4c1.6,1.6,3.7,1.9,5.5,0.1c0,0,0,0,0,0l0,0c1-0.9,1.3-1.8,1.3-1.8L31.6,11.8z"/></g></svg>', Qi =
        "1987&ndash;" + mb(2015, (new Date).getFullYear()) + " HERE"; Ji.prototype.Ia = function () { var a = this.a, b = a.getZoom(), c = a.ba(), a = a.fa, d = a.Y.length, e = {}, f = 0, g, h, k, l = [Qi]; if (c) for (; f < d; f++)if (h = a.get(f).getCopyrights(c, b)) for (g = 0; g < h.length; g++)e[k = h[g].label] || (l.push(k), e[k] = 1); return l.join(", ") }; Ji.prototype.getCopyrights = Ji.prototype.Ia; Ji.prototype.Na = function () { return this.b.style }; Ji.prototype.getStyle = Ji.prototype.Na; Ji.prototype.j = String.fromCharCode(169);
    Ji.prototype.D = function () { this.a.removeEventListener(this.a.v.Sf, this.f); this.a.fa.removeEventListener("add", this.c); this.a.fa.removeEventListener("remove", this.c); this.a.fa.removeEventListener("set", this.c); this.b.parentNode && Ge(this.b) };
    Ji.prototype.ya = function (a, b, c, d) {
        var e = a.getContext("2d"), f = window.getComputedStyle(this.i), g = $a(f.getPropertyValue("font-size")), h; h = this.ve.childNodes[0]; var k = this.b.ownerDocument, l = this.a.b, m = +a.height, n = nb(this.b.offsetLeft * b), q = nb(m - (l.offsetHeight - this.b.offsetTop) * b), l = h.getBoundingClientRect ? h.getBoundingClientRect() : {}, t = l.width * b, u = l.height * b, y = sc; sa(d) && (y = function () { d("capture_error") }); h = this.j + " " + function (a) { a = Ki(k, "div", null, a); return a.textContent || a.innerText || "" }(this.Ia()); e.font =
            g * b + "px " + f.getPropertyValue("font-family"); e.fillStyle = f.getPropertyValue("color"); e.textBaseline = "top"; e.fillText(h, n, q + nb(l.height * b)); Ri(this, e.font, function (b) { (new Gh("image", b)).then(function (b) { e.drawImage(b, n, q, t, u); c(a) }, y) }, y)
    }; Ji.prototype.capture = Ji.prototype.ya;
    function Ri(a, b, c, d) {
        Si(z(function (a) {
            a ? this.sg ? c("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAeCAYAAABe3VzdAAADNklEQVRYR82XW6hVVRSGv7+rmJfSMKSnSkMEfY7EogcJC7tilGRopBAiSaI+SBARQSCIIqgFISih2YW0oAgLCsKXojA0RB+81VugZEFZv/yHuWTt7d7Hfc4+6+h4OWefNfcc3xlj/v+YS1zjoab5bE8DZgGngB8keSg5GwO0PQ54F3i2BnQIWCLpx14hGwG0fT3wOfBwB5DzwOOSDvQC2RTgM8Ae4D/gaeA3YDdwN5AWvyxp+6gD2r4OmAq8AbwInAMmA/OAT4CbgBWStvYClzUjWkHbrwHLgF8LVHJ8DDxah7P9JHCil7M40oA/A7OBC8ANtSqlrQOVs30/8CWQat8r6cxg1RwRQNvPA88Bk4D7gJzBV4A5teSp5MlS4VuA/ZIeu1Kr+wa0/QTwIRDlRhT5eTswBvi2CKOd42AULilndNAYCcA7gK+BmbVMiyXtsh3Qt4FFBTgW8w6wXtLfV4LrSyS2FwAvAWOBX+JtwF0laUDmS/oun23fDNwJnJb0Ty9g1ZphVdB2qrK2LdFfBbb685/AIxXkUKDqa4cMaDs2kjalRe8Fola57J3qRQSJviGHA3gMuAdYI2lDUfDOArQLWAd8VTuTOW9vjUoFy6TIGYpS9wKfAjuK5wVuSfn91iKcvZJeHy5ci0hsZwzNk5Qh3xIFbLyks7aPAtPLgv+L4VZwDwLvA6uKz6XdfcVAi22PBz4q4+lVSRurXW2vKYKIZfwEHCmmXC35HngAyITYD0ys2t8XWflyBfhmvKm24QCk7aVFCPVc7WMszzKucknI+NoHPCUppt13VICZm2nNwjoksByY0SXL72Vi3FieZ97mgrpyqF432H9xScW2O0H+W6oSE/4D2FYuA9kzlUzVTwO3Ad9IOtx3ydo2aLGZLpABm5KW2Z4AfAbMLfsEcpGkKLqRuMwHu0CukrSpCCrvGlF6hBEVL5MUw24kOhp1B8gc+FTqgxpkFLuzSbjk6jpJOkC2tDPeKCkVbDRkO67fDTTC2VK7vgfyBUlfNEpV2zyAK4HNXRLmZfshScdHC6g9T+WDGU2XpkdZdNXhWs6g7dXAhmsJ7jKR2M77bG4kV7Wt9TZfBLgYEC7PSpcIAAAAAElFTkSuQmCC") : c("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAeCAYAAABe3VzdAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIMSURBVFiFzdZPiE1RGADwXzPTTPIMQoodVpbKgpoUG5qExUi8DSVJQv4slJJsbNjYWFhNETWLUUosRDRLUVLCYhIiojFojHkW997uvefNGIuZc99Xp/fOO6/Or++c75xDi0d7hDlWYQNqeB9hvv+OGq6jUWjPsKZKVBbtuKOMy9p3bKqOlsROCWYc27AWr9PfJnCgKlgbluNqivmGDmzBrxR3sCocnMEw7sqXdEAzboeK9uLTFPVbed8VcesxglFJtqNEHbcxlIL68ChADuCSpEgauBULt11SDI3C5yJJdrLCCNsQumMBl+J5AKinY4slBfNTfsRcxJwYsK0YxD3J0r1RPut6Cv/twgp0xoDBBc3LNhr0RwJktNifAn7gsnLmsuxVinyVTn4i7dcLoH4sU96Tp2Pi2uSVehN75Gdev+QO7pIXztmZnLwTvf+AzU+/v5Rn50+A24gP2IW5M4mbJ7+ejgVjJ/EpHXuCa8p77nGK68FX5eWfsTgfTJoh92qu1vAaa+CtPJuDZuEh3CHZUyHyxSSYrL3DWKE/gStm8aybDDkmKYperJM/BrJMnsJuHMLq2YJNh/wsX7JuPAyQfTFg0yGPFMZreCCv4n2xgTQjxyXP+CxquK8iXBYhMlzOtliQBVg4RVuCG/iSto/YHAuWxWFTHyXDWBkbNFkc1cK4LI5rYVwW57QY7i/pZeJv8QQJRQAAAABJRU5ErkJggg==") :
                (a = this.ve.cloneNode(!0), a.firstChild.setAttribute("style", "font:" + b), c(xe(a.innerHTML)))
        }, a), d)
    } Ji.prototype.sg = !1; function Si(a, b) { var c = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(Li), d = Ni; Ta(d) ? a(d) : (new Gh("image", c)).then(function (b) { te.drawImage(b, 0, 0); try { te.getImageData(0, 0, 1, 1), d = !1 } catch (c) { d = 18 === c.code } finally { Ni = d, a(d) } }, b) }
    var Oi = {
        "de-DE": "Nutzungsbedingungen", "en-US": "Terms of use", "en-GB": "Terms of use", "es-ES": "Condiciones de uso", "fi-FI": "Palveluehdot", "fr-FR": "Conditions d'utilisation", "it-IT": "Condizioni di utilizzo", "nl-NL": "Dienstvoorwaarden", "pl-PL": "Warunki \u015bwiadczenia us\u0142ugi", "pt-BR": "Termos de servi\u00e7o", "pt-PT": "Termos do servi\u00e7o", "ru-RU": "\u0423\u0441\u043b\u043e\u0432\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f", "tr-TR": "Servis Ko\u015fullar\u0131",
        "zh-CN": "\u4f7f\u7528\u6761\u6b3e"
    }; function Ti(a, b) { if (D(this.x = +a)) throw new C(Ti, 0, a); if (D(this.y = +b)) throw new C(Ti, 1, b); } Ti.prototype.add = function (a) { return new Ti(this.x + a.x, this.y + a.y) }; Ti.prototype.a = function (a) { if (!B(a, Ti)) throw new C(this.a, 0, a); a = this.b(a); return a.x + a.y }; Ti.prototype.b = function (a) { if (!B(a, Ti)) throw new C(this.b, 0, a); return new Ti(this.x * a.x, this.y * a.y) }; Ti.prototype.Ja = function (a) { return new Ti(this.x * a, this.y * a) }; function Ui(a) { return tb(a.a(a)) }; function Vi(a) { a = a || {}; this.j = a.minSpeed || 3; this.l = a.vectorTolerance || 3; this.i = a.maxSpeed || 300; this.m = a.timeTolerance || 50; this.b = []; this.f = this.g = !1; this.c = this.a = null } function Wi(a, b) { var c, d, e, f; b ? (a.bifocal && b.bifocal ? (c = Xi(a), d = Xi(b)) : b.bifocal ? (c = Yi(a), e = Yi(b).distance(c), f = Yi(b, !0).distance(c), d = e > f ? Yi(b, !0) : Yi(b)) : a.bifocal && !b.bifocal ? (d = Yi(b), e = Yi(a).distance(d), f = Yi(a, !0).distance(d), c = e > f ? Yi(a, !0) : Yi(a)) : (c = a, d = b), e = c.x - d.x, c = c.y - d.y, c = new Ti(e, c)) : c = new Ti(0, 0); return c }
    function Zi(a) { var b; if (!a || D(a.bx) || D(a.by)) return 0; b = a.bx - a.x; a = a.by - a.y; return tb(b * b + a * a) } function Xi(a) { var b, c; !a || D(a.bx) || D(a.by) || (b = a.x - a.bx, c = a.y - a.by, b = new M(a.x - b / 2, a.y - c / 2)); return b } function Yi(a, b) { return b ? new M(a.bx, a.by) : new M(a.x, a.y) } p = Vi.prototype; p.start = function (a, b) { if (D(a)) throw new C(this.start, 0, a); this.g && this.clear(); this.o = a; this.g = !0; this.f = !!b };
    p.gh = function (a, b, c, d, e) { var f = D(a) ? 0 : D(b) ? 1 : null != c && D(c) ? 2 : null != d && D(d) ? 3 : null != e && D(e) ? 4 : A; if (0 <= f) throw new C(this.gh, f, arguments[f]); this.g && (e = e || (new Date).getTime(), this.c = this.a, this.a = { x: a, y: b, bx: null != c ? c : NaN, by: null != d ? d : NaN, ts: e, bifocal: null != c && null != d }, this.f && this.b.push(this.a)) }; p.clear = function () { this.b = []; this.f = this.g = !1; this.a = this.c = null }; p.Fd = function (a) { if (D(a)) throw new C(this.Fd, 0, a); return !!(this.o & a) }; p.mb = function () { return this.g }; p.Ge = ba(1);
    function $i(a) { var b = a.b.length, c = 0, d = new Ti(0, 0); if (a.f) for (; --b && c < a.l;)d = d.add(Wi(a.b[b], a.b[b - 1])), c++; else d = Wi(a.a, a.c); a = d; b = Ui(a); return 0 !== b ? new Ti(a.x / b, a.y / b) : a } function aj(a) { var b; b = b || Date.now(); var c = a.b.length, d = a.b[c - 1], e = 0, f = 0; if (a.f) { for (; --c && e < a.l;)f += Ui(Wi(a.b[c], a.b[c - 1])), e++; c = f / e } else d = a.a, c = Ui(Wi(a.a, a.c)); c >= a.j && b - d.ts <= a.m ? c = c > a.i ? a.i : c : c = 0; return c }
    p.hg = function (a) { var b; b = this.a; var c; if (D(a)) throw new C(this.hg, 0, a); b && this.c && (b = Zi(this.c), 0 !== b && (c = Zi(this.a), a = sb(ub(2, a) * (c / b)) / Cb)); return a }; function bj(a, b, c, d) { bj.u.constructor.call(this); this.ac = a; this.za = d; this.a = a.appendChild(this.createElement(a.ownerDocument)); cj(this, b, c) } v(bj, xc); function cj(a, b, c) { a.size ? (a.size.w = b, a.size.h = c) : a.size = new Th(b, c); a.eh(a.a, a.a.style, b, c, a.za) } p = bj.prototype; p.tg = !0; p.setVisibility = function (a) { a !== this.tg && (this.a.style.display = a ? "block" : "none", this.tg = a) }; p.Se = 1; function dj(a, b) { a.Se !== b && (a.dh(b), a.Se = b) } p.Bd = function () { return this.Se };
    p.D = function () { this.clear(); this.ac.removeChild(this.a); cj(this, 0, 0); this.a = this.ac = null; bj.u.D.call(this) }; p.Te = 0; p.Ib = function () { ++this.Te }; function ej(a) { this.a = a } v(ej, xc); ej.prototype.od = function (a) { var b = this.b; a !== b && (this.b = a, a.Ib(), b && (--b.Te || b.J())) }; ej.prototype.D = function () { var a = this.b; --a.Te || a.J() }; function fj(a, b) { fj.u.constructor.call(this, a); this.Nb = !(!b || !b.Nb); this.l = !(!b || !b.noWrap); this.g = {} } v(fj, ej); fj.prototype.od = function (a) { fj.u.od.call(this, a); this.i = a.ac.ownerDocument }; var gj = function (a, b) { var c = b.Ca(); return B(c, Pf) ? c.ma : (a[0] = c, a) }.bind(null, []);
    fj.prototype.ca = function (a, b, c, d, e, f) {
        var g, h, k = this.a, l, m, n, q, t, u, y; this.m = g = this.g; this.g = h = {}; if (d >= k.min && d <= k.max && (l = this.fg(a, d, e, f), m = l.markers, a = m.length)) { d = []; e = this.b; dj(e, k.opacity); for (k = 0; k < a; k++)for (f = m[k], n = gj(f), q = n.length; q--;)if (t = c.geoToPixel(n[q])) this.l || (u = c.w, t.x -= nb(t.x / u) * u), t.add(b), (u = g[y = f.ta() + "_" + q]) ? delete g[y] : u = { marker: f }, h[y] = u, d.push([u, f, f.sb(), e, t.x, t.y]); d.sort(hj); a = d.length; for (k = 0; k < a; k++)this.wg.apply(this, d[k]) } return !l || l.requested && l.requested === l.total ||
            !l.requested && m.length === l.total ? ij.DONE : ij.PENDING
    }; function hj(a, b) { return Re(Qe(a[1]), Qe(b[1]), !0) || a[5] - b[5] || Re(Qe(a[1]), Qe(b[1]), !1) }; function jj(a, b) { jj.u.constructor.apply(this, arguments); this.f = 0; this.c = []; this.Ee = z(this.Ee, this) } v(jj, fj); p = jj.prototype; p.fg = function () { return this.a.b.apply(this.a, arguments) }; p.ca = function () { var a; this.Ee(); this.o = 0; a = jj.u.ca.apply(this, arguments); var b = this.b, c = this.m, d; for (d in c) kj(this, b, c[d]); return 0 === this.c.length && a ? ij.DONE : ij.PENDING }; p.od = function (a) { jj.u.od.call(this, a); this.j = a.za };
    p.Ee = function () { for (var a = this.c.length, b, c, d; a--;)d = this.c[a], b = d.sd, c = d.sd.sb(), c.ff(d, c, b); this.c.length = 0 }; p.wg = function (a, b, c, d, e, f) { var g = b.j(), h; this.Nb || (e = nb(e), f = nb(f)); a.detail && (g.b(a.bi) ? kj(this, d, a) : h = a.detail); h || (a.detail = h = Fe(c.i, this.i, c.c), this.f++ , sa(c.ff) && this.c.push(h)); a.bi = g.a; h.style.zIndex = this.o++; h.sd = b; d.bc(h, e, f, 0, 0) }; var lj, mj = "pointer-events", nj;
    if (ve) { var oj; ve && jc !== x && (jc = (oj = /(MSIE\s+|rv\:)([^\);]+)(\)|;)/.exec(navigator.userAgent)) ? +oj[2] : x); nj = jc; 9 === nj ? mj = "display" : 10 === nj && (mj = "visibility") } lj = mj;
    jj.prototype.Ma = function (a, b, c) {
        var d = this.j, e, f, g, h = De, k, l, m, n, q, t; if (this.f) {
            a /= d; b /= d; d = this.i; e = d.documentElement; f = this.b.a; g = f.getBoundingClientRect(); a += g.left; for (b += g.top; (l = m = d.elementFromPoint(a, b)) && l !== f && l !== e && m !== n;) {
                for (; (q = l.parentNode) && (!sa(q.contains) || !q.contains(f));)l = q; if (q === f && (l !== m || "svg" !== l.nodeName) && 0 > h.indexOf(t = l.sd) && (h === De && (h = []), h.push(t), c)) break; k || (k = []); n = l.style; k.push({ bg: n.getPropertyValue(lj), $h: n.getPropertyPriority(lj), style: n }); n.setProperty(lj, "visibility" ===
                    lj ? "hidden" : "none", "important"); n = m
            } if (k) for (b = k.length; b--;)a = k[b], a.style.removeProperty(lj), ra(a.bg) && a.style.setProperty(lj, a.bg, a.$h)
        } return h
    }; jj.prototype.dd = function () { return 2 }; function kj(a, b, c) { b.clear(b = c.detail); delete b.sd; a.f--; c = (a = c.marker).sb(); c.f && c.f(b, c, a) } jj.prototype.D = function () { this.c.length = 0; var a = this.b, b = this.g, c; for (c in b) kj(this, a, b[c]); this.b.J(); jj.u.D.call(this) }; function pj(a, b) { if (!a) throw new C(pj, 0, a); pj.u.constructor.call(this, a); this.f = {}; this.g = b && b.Nb; this.l = b && b.noWrap; this.i = qj++ } v(pj, ej); var qj = 0;
    pj.prototype.ca = function (a, b, c, d, e, f) {
        var g = nb(d), h = this.a, k = g + (c.exp - h.pixelProjection.exp), l = h.max; d = h.tileSize; var m = h.opacity, n, q = this.b, t = q.Bd(); n = q.size.w; var u = c.w, y = c.x, J = c.y, T = {}; if (g < h.min || g > l) return ij.DONE; e = h.requestTiles(a, k, e, f, this.i); a = e.total; e = e.tiles; f = e.length; this.j = c; this.m = b; this.c = k; t !== m && dj(q, m); c = d = d * u / (ub(2, k) * d); this.g || (d % 1 && (d = pb(d), u = c / d, y = y / u, J = J / u, u = ub(2, k) * d), y = pb(y), J = pb(J)); this.o = c; k = -d; g = n + d; for (h = 0; h < f; h++) {
            n = e[h]; if (l = n.data) if (c = b.x - (y - n.x * d), m = b.y - (J - n.y *
                d), q.bc(l, c, m, d, d), !this.l) { for (t = c; (t -= u) > k;)q.bc(l, t, m, d, d); for (t = c; (t += u) < g;)q.bc(l, t, m, d, d) } T[this.c + "_" + n.x + "_" + n.y] = n
        } this.f = T; return f === a ? ij.DONE : ij.PENDING
    }; pj.prototype.Ma = function (a, b, c) { if (Ta(this.c)) { var d = this.o, e = d / this.a.tileSize, f = this.j, g = this.m, h, k; a = f.x + (a - g.x); b = f.y + (b - g.y); h = pb(f.w / d); var l = f = pb(a / d), g = pb(b / d); rb(l) >= h && (l %= h); 0 > l && (l = h + l); (h = this.f[this.c + "_" + l + "_" + g]) && h.Ma && (k = h.Ma((a - d * f) / e, (b - d * g) / e, c)) } return k || De }; pj.prototype.dd = function () { return 0 }; var rj, sj = function () { function a() { } for (var b, c, d, e = Ra("o ms moz webkit "), f = 5; f-- && !b;)b = e[f], b = (c = w[b + (b ? "R" : "r") + "equestAnimationFrame"]) && !D(c.call(window, a)) && (d = w[b + (b ? "C" : "c") + "ancelAnimationFrame"]); rj = b ? function (a) { return c.call(w, a) } : function (a) { return w.setTimeout(a, 25) }; return b ? function (a) { return d.call(w, a) } : function (a) { return w.clearTimeout(a) } }(), tj = w.performance && w.performance.now ? function () { return w.performance.now() } : function () { return w.Date.now() }; function qh(a, b, c, d) { this.left = +a; this.top = +b; this.right = +c; this.bottom = +d } r("H.math.Rect", qh); qh.prototype.set = qh; qh.prototype.set = qh.prototype.set; qh.prototype.tb = function () { return this.i || (this.i = new M(this.left, this.top)) }; qh.prototype.getTopLeft = qh.prototype.tb; qh.prototype.rb = function () { return this.f || (this.f = new M(this.right, this.bottom)) }; qh.prototype.getBottomRight = qh.prototype.rb; qh.prototype.a = function (a, b) { return this.left <= a && this.right >= a && this.top <= b && this.bottom >= b };
    qh.prototype.containsXY = qh.prototype.a; function ph(a, b) { return new qh(a.x, a.y, b.x, b.y) } qh.fromPoints = ph; qh.prototype.clone = function () { return new qh(this.left, this.top, this.right, this.bottom) }; qh.prototype.clone = qh.prototype.clone; var ij = { PENDING: 0, ACTIVE: 1, DONE: 2 }; r("H.map.render.RenderState", ij); function uj(a, b) { var c = b || {}, d, e; if (!B(a, Element)) throw new C(uj, 0, a); d = a.ownerDocument.createElement("div"); this.b = a; uj.u.constructor.call(this); this.padding = new qh(0, 0, 0, 0); this.center = new M(0, 0); this.margin = 0; this.element = d; d.style.zIndex = 0; d.style.height = d.style.width = "100%"; d.style.position = "relative" === a.style.position ? "absolute" : "relative"; this.resize(); a.appendChild(d); (e = c.padding) !== A && this.f(e.top, e.right, e.bottom, e.left); this.c((e = c.margin) !== A ? e : 0); (e = c.fixedCenter) !== A && (this.g = !!e) }
    v(uj, I); r("H.map.ViewPort", uj); uj.prototype.a = { la: "update", Oc: "sync" }; uj.prototype.g = !0; uj.prototype.c = function (a) { if (this.margin !== +a) { if (D(this.margin = +a)) throw new C(this.c, 0, a); vj(this); this.dispatchEvent(this.a.la) } }; uj.prototype.setMargin = uj.prototype.c; uj.prototype.f = function (a, b, c, d) { var e = this.padding; if (e.top !== a || e.right !== b || e.bottom !== c || e.left !== d) { if (D(a + b + c + d)) throw new C(this.f); e.top = a; e.right = b; e.bottom = c; e.left = d; vj(this); this.dispatchEvent(this.a.la) } };
    uj.prototype.setPadding = uj.prototype.f; function vj(a) { var b = a.padding; a.center.set((a.width + b.left - b.right) / 2 << 0, (a.height + b.top - b.bottom) / 2 << 0) } uj.prototype.resize = function () { var a = this.b.offsetWidth, b = this.b.offsetHeight; if (this.width !== a || this.height !== b) this.m = new Th(this.width, this.height), this.width = a, this.height = b, vj(this), this.dispatchEvent(this.a.la) }; uj.prototype.resize = uj.prototype.resize;
    uj.prototype.D = function () { w.clearTimeout(this.i); this.i = null; this.b.removeChild(this.element); this.element = this.b = null; uj.u.D.call(this) }; uj.prototype.startInteraction = uj.prototype.o; uj.prototype.interaction = uj.prototype.j; uj.prototype.endInteraction = uj.prototype.l; function wj(a, b, c, d) {
        var e = new qh(0, 0, 0, 0); wj.u.constructor.call(this); this.za = d.pixelRatio; this.wa = { 1: e.clone(), 2: e.clone(), 4: e.clone() }; this.g = a; if (!a) throw new C(wj, 0, a); xj(this); a.addEventListener(a.a.la, this.Dc, !1, this); this.N = z(this.N, this); this.C = z(this.C, this); this.B = z(this.B, this); a.startInteraction = this.N; a.interaction = this.C; a.endInteraction = this.B; this.I = b; if (!b) throw new C(wj, 1, b); this.O = z(this.O, this); this.j = z(this.j, this); this.s = z(this.s, this); b.startControl = this.O; b.control = this.j;
        b.endControl = this.s; b.addEventListener(b.c.la, this.zb, !1, this); this.Ga = c; if (!c) throw new C(wj, 2, c);
    } v(wj, I); r("H.map.render.RenderEngine", wj); wj.prototype.getBBox = wj.prototype.v; function xj(a) { var b = a.g, c = b.width, d = b.height, e = b.padding, f = e.top, g = e.left, h = e.bottom, e = e.right, b = b.margin, k = -(c + g - e) / 2 << 0, l = -(d + f - h) / 2 << 0, c = c + k, d = d + l, m = a.wa; a = a.za; m[1].set((k - b) * a, (l - b) * a, (c + b) * a, (d + b) * a); m[2].set(k * a, l * a, c * a, d * a); m[4].set((k + g) * a, (l + f) * a, (c - e) * a, (d - h) * a) } wj.prototype.Dc = function () { xj(this) };
    wj.prototype.D = function () { var a = this.I, b = this.g; a.removeEventListener(a.c.la, this.zb, !1, this); a.startControl === this.O && (a.startControl = yj.prototype.B); a.control === this.j && (a.control = yj.prototype.v); a.endControl === this.s && (a.endControl = yj.prototype.s); b.removeEventListener(b.a.la, this.Dc, !1, this); b.startInteraction === this.N && (b.startInteraction = uj.prototype.o); b.interaction === this.C && (b.interaction = uj.prototype.j); b.endInteraction === this.B && (b.endInteraction = uj.prototype.l) };
    wj.prototype.getCamForBounds = wj.prototype.P; wj.prototype.ya = function () { return null }; wj.prototype.setPointer = wj.prototype.sa; function zj(a, b) { a.style.transition = "opacity 1.5s"; a.addEventListener("transitionend", function () { b() }, !1); a.style.opacity = 0 } var Aj = { ZOOM: 1, HEADING: 2, TILT: 4, INCLINE: 8, COORD: 16 }; wj.InteractionModifiers = Aj; wj.prototype.ee = { Xf: "render" }; var Bj = { P2D: 0, PANORAMA: 1 }; wj.EngineType = Bj; function Cj(a, b, c, d, e, f) { var g = e || "2d"; Cj.u.constructor.apply(this, arguments); this.b = this.a.getContext(g, f); this.c = "2d" === g; this.f = g; this.g = f } v(Cj, bj); p = Cj.prototype; p.createElement = function (a) { a = a.createElement("CANVAS"); var b = a.style; b.position = "absolute"; b.top = b.left = 0; return a }; p.eh = function (a, b, c, d, e) { a.width = mb(c, 1); a.height = mb(d, 1); b.width = nb(c / e) + "px"; b.height = nb(d / e) + "px" }; p.dh = function (a) { this.b.globalAlpha = a }; p.bc = function (a, b, c, d, e) { this.c && this.b.drawImage(a, b, c, d, e) };
    p.clear = function (a) { var b, c; this.c && (a ? this.b.clearRect(b = a.left, c = a.top, a.right - b, a.bottom - c) : this.a.width = this.size.w) }; p.D = function () { this.a.width = this.a.height = 0; this.b = x; Cj.u.D.call(this) }; function Dj() { I.call(this); this.reset() } v(Dj, I); Dj.prototype.start = function (a, b) { this.a && this.reset(); D(a) || D(b) || (this.atX = a, this.atY = b); this.a = !0 }; Dj.prototype.g = { Mf: "animationupdate" }; function Ej(a) { Ej.u.constructor.call(this, Dj.prototype.g.Mf); this.offset = a } v(Ej, Bc); Dj.prototype.mb = function () { return this.a }; Dj.prototype.set = function (a, b, c) { !this.a || this.b === a && this.c === b && this.f === c || (this.b = a, this.c = b, this.f = c, this.dispatchEvent(new Ej(Fj(this)))) };
    function Fj(a) { return { x: 91.401472 * a.b, y: 91.401472 * a.c, z: a.f } } Dj.prototype.reset = function () { this.a = !1; this.atY = this.atX = null; this.f = this.c = this.b = 0 }; function Gj(a) { a = Fj(a); return tb(a.x * a.x + a.y * a.y + a.z * a.z) } function Hj(a) { var b = Fj(a); a = Gj(a) || 1; return { x: b.x / a, y: b.y / a, z: b.z / a } } Dj.prototype.D = function () { this.reset(); Dj.u.D.call(this) }; function Ij(a, b) { var c = b || {}; B(a, Jj, Ij, 0); Ij.u.constructor.call(this, a); this.Nb = !!c.Nb; this.g = b && b.noWrap; this.i = c.yi || 0; this.c = []; this.f = {} } v(Ij, ej);
    Ij.prototype.ca = function (a, b, c, d, e) {
        var f, g, h = this.a, k, l, m, n, q, t, u = 0, y, J, T, ea, la, ob; d -= this.i; this.c.length = 0; f = this.f; this.f = g = {}; if (d >= h.min && d <= h.max && (k = h.C(a, d, e), l = k.overlays, a = l.length)) for (l.sort(Se), d = this.b, e = this.Nb, ob = h.opacity, h = 0; h < a; h++)m = l[h], n = m.S(), q = c.geoToPixel(n.tb()), t = c.geoToPixel(n.rb()), n = c.w, q.x >= t.x && (q.x -= n), this.g || (u = -((q.x + t.x) / n >> 1) * n), q.x += u, q.add(b), t.x += u, t.add(b), e || (q.round(), t.round()), (n = f[y = m.ta()]) ? delete f[y] : n = { vi: m }, g[y] = n, J = q.x, q = q.y, T = t.x, t = t.y, ea = T - J,
            la = t - q, dj(d, m.Bd() * ob), d.bc(m.Pb(), J, q, ea, la), n.Ae ? n.Ae.set(J, q, T, t) : n.Ae = new qh(J, q, T, t), this.c.push(n); return !k || k.requested && k.requested === k.total || !k.requested && l.length === k.total ? ij.DONE : ij.PENDING
    }; Ij.prototype.Ma = function (a, b, c) { for (var d = this.c, e = d.length, f, g, h; e--;)if (f = d[e], g = f.Ae, g.a(a, b)) if (f = f.vi, h) h.push(f); else if (h = [f], c) break; return h || De }; Ij.prototype.dd = function () { return 0 }; Ij.prototype.D = function () { this.c = null; Ij.u.D.call(this) }; var Kj = { zoom: { min: -8, max: 28 }, camera: { alt: { min: 0, max: 0 }, pitch: { min: 0, max: 0 }, roll: { min: 0, max: 0 }, yaw: { min: 0, max: 0 }, fov: { min: 70, max: 70 } }, interaction: { ZOOM: 1, Ki: 16 }, capture: !0 }; r("H.map.render.p2d.capabilities", Kj); function Lj(a, b) { this.c = []; Lj.u.constructor.apply(this, arguments) } v(Lj, fj); p = Lj.prototype; p.fg = function () { return this.a.c.apply(this.a, arguments) }; p.ca = function () { this.c = []; return Lj.u.ca.apply(this, arguments) }; p.wg = function (a, b, c, d, e, f) { var g = c.b; b = g.w; var g = g.h, h = c.a; this.Nb ? (e -= h.x, f -= h.y) : (e = nb(e - h.x), f = nb(f - h.y)); d.bc(c.Pb(), e, f, b, g); a.detail ? a.detail.set(e, f, e + b, f + g) : a.detail = new qh(e, f, e + b, f + g); this.c.push(a) };
    p.Ma = function (a, b, c) { for (var d = this.c, e = d.length, f, g, h, k = De; e-- && !(f = d[e], g = f.detail, g.a(a, b) && (f = f.marker, (!(h = f.sb().g) || h.a(a - g.left, b - g.top, 0)) && 0 > k.indexOf(f) && (k === De && (k = []), k.push(f), c)));); return k }; p.dd = function () { return 0 }; p.D = function () { this.c = null; Lj.u.D.call(this) }; function Mj(a) { var b = 2; Mj.u.constructor.call(this, a); B(this.a, Oh) && (b = "2d" === a.v ? 0 : 1); this.c = b } v(Mj, ej); Mj.prototype.ca = function (a, b, c, d, e, f) { var g = this.a, h = this.b, k = !(B(h, Cj) && "2d" === h.f); if (d >= g.min && d <= g.max) return k && h.setVisibility(!0), g.ca(h.a, { bounds: a, zoom: d, screenCenter: b, priorityCenter: f, projection: c, cacheOnly: e, size: h.size, pixelRatio: h.za }); k && h.setVisibility(!1); return ij.DONE }; Mj.prototype.dd = function () { return this.c }; r("H.util.animation.ease.LINEAR", function (a) { return a }); r("H.util.animation.ease.EASE_IN_QUAD", function (a) { return a * a }); function Nj(a) { return -a * (a - 2) } r("H.util.animation.ease.EASE_OUT_QUAD", Nj); r("H.util.animation.ease.EASE_IN_OUT_QUINT", function (a) { a *= 2; return 1 > a ? ub(a, 5) / 2 : (a -= 2, ub(a, 5) / 2 + 1) }); r("H.util.animation.ease.EASE_OUT_CIRC", function (a) { return tb(2 * a - a * a) }); function Oj(a, b, c, d) { if (!sa(this.i = a)) throw new C(Oj, 0, a); if (D(this.g = +b)) throw new C(Oj, 1, b); if (!sa(this.f = c) && null != c) throw new C(Oj, 2, c); if (!sa(this.c = d) && null != d) throw new C(Oj, 3, d); this.id = Pj.next(); this.a = !1 } r("H.util.animation.Animation", Oj); var Pj = new ye; Oj.prototype.start = function () { var a = this, b, c = rj, d; d = function () { var e = tj(), f = e - a.Kb, g = f / a.g, g = 1 < g ? 1 : g; a.c && (g = a.c(g)); a.i(g, f, e - b, e); b = e; 1 <= g ? a.stop() : a.b = c(d) }; a.Kb = tj(); b = a.Kb; a.a = !0; a.b = c(d) }; Oj.prototype.start = Oj.prototype.start;
    Oj.prototype.stop = function (a) { sj(this.b); this.a = !1; a || this.f && this.f(this) }; Oj.prototype.stop = Oj.prototype.stop; Oj.prototype.mb = function () { return this.a }; Oj.prototype.isRunning = Oj.prototype.mb; function Qj(a, b) { if (D(this.b = +a)) throw new C(Qj, 0, a); this.a = 0; b && this.f(b) } r("H.util.kinetics.KineticMove", Qj); Qj.prototype.f = function (a) { this.a = a; return this }; Qj.prototype.setInitialSpeed = Qj.prototype.f; Qj.prototype.i = function () { return Math.abs(this.a / this.b) }; Qj.prototype.getDuration = Qj.prototype.i; Qj.prototype.c = function (a) { return this.a + this.b * a }; Qj.prototype.getCurrentSpeed = Qj.prototype.c; Qj.prototype.g = function (a) { return this.a * a + this.b * a * a / 2 }; Qj.prototype.getCurrentPath = Qj.prototype.g; function Rj(a, b, c, d) { Rj.u.constructor.apply(this, arguments) } v(Rj, bj); p = Rj.prototype; p.createElement = function (a) { a = a.createElement("DIV"); a.style.position = "absolute"; return a }; p.eh = function (a, b, c, d) { b.width = c + "px"; b.height = d + "px" }; p.dh = function (a) { this.a.style.opacity = a }; p.bc = function (a, b, c) { var d = this.za, e = a.style; e[hi("transform")] = "matrix(1,0,0,1," + b / d + "," + c / d + ")"; a.parentNode !== this.a && (e.position = "absolute", this.a.appendChild(a)) }; p.clear = function (a) { a ? this.a.removeChild(a) : this.a.innerHTML = "" }; function Sj(a, b) { this.a = a; this.b = b }
    function Tj(a, b, c) {
        var d, e, f, g, h, k = [], l = { ac: a.a, width: b.w, height: b.h, za: a.b }; for (a = 0; a < c.length; a++) {
            b = c[a]; d = b.dd(); g = {}; Ca(g, l); e = b.b; switch (d) {
                case 0: B(b.a, Oh) && (g.xe = b.a.F); if (d = f && "2d" === f.f) { d = g.xe; var m = f.g; d = m === d ? !0 : m && !d ? !m.alpha && !m.willReadFrequently : d && !m ? !d.alpha && !d.willReadFrequently : !d.alpha === !d.alpha && !m.willReadFrequently === !d.willReadFrequently } d ? h = !1 : e && !h ? (f = e, h = !1) : (f = new Cj(g.ac, g.width, g.height, g.za, "2d", g.xe), h = !0); break; case 2: f = e || new Rj(g.ac, g.width, g.height, g.za); h =
                    !e; break; default: f = e || new Cj(g.ac, g.width, g.height, g.za, b.a.v, g.xe), h = !e
            }k[k.length - 1] !== f && (f.a.style.zIndex = k.length, k.push(f)); b.od(f)
        } return k
    }; function yj() { yj.u.constructor.call(this); this.a = {}; this.g = { position: new gc(0, 0), pitch: 0, yaw: 0, roll: 0, fov: 70 }; this.b = 0 } v(yj, I); r("H.map.ViewModel", yj); yj.prototype.c = { la: "update", Oc: "sync" }; yj.prototype.i = Ra("position pitch yaw roll fov zoom"); var Uj = Ra("fov pitch position roll yaw zoom").reduce(function (a, b) { a[b] = yi.prototype[b.toUpperCase()]; return a }, {});
    function Vj(a, b, c, d) { var e = d.length, f, g, h; a.f = 0; a.o = {}; for (a.j = {}; e--;)if (f = d[e], h = c[f], g = b[f], null != h) { if (a.o[f] = g, a.j[f] = h, b[f] = h, $b(h) && $b(g) && (h.lat !== g.lat || h.lng !== g.lng) || !$b(h) && h !== g) a.f |= Uj[f] } else delete b[f]; return b } yj.prototype.Ab = function () { return Vj(this, {}, this.g, this.i) }; yj.prototype.getCameraData = yj.prototype.Ab;
    yj.prototype.Jb = function (a) { var b, c = a.animate; if (!a) throw new C(this.Jb, 0, a); if ((b = a.position) && !$b(b)) throw new C(this.Jb, 0, "position"); this.a.zoom = D(a.zoom) ? D(this.a.zoom) ? this.b : this.a.zoom : a.zoom; b = this.a.zoom; a = Vj(this, {}, a, this.i); this.a = { animate: c, zoom: b, camera: a }; this.dispatchEvent(new Wj(this.a)); return this }; yj.prototype.setCameraData = yj.prototype.Jb;
    function Xj(a, b) { var c = b.zoom; Vj(a, a.g, b, a.i); c !== a.b && (a.f |= Uj.zoom); a.o.zoom = a.b; a.j.zoom = c; a.b = null != c ? c : a.b; a.g.zoom = a.b; a.a = {}; a.dispatchEvent(new yi(a.c.Oc, a.j, a.o, a.f)) } yj.prototype.l = function (a, b) { if (D(a = +a)) throw new C(this.l, 0, a); this.a = { animate: b, zoom: a, camera: this.a.camera || this.g }; this.dispatchEvent(new Wj(this.a)) }; yj.prototype.setZoom = yj.prototype.l; yj.prototype.getZoom = function () { return this.b }; yj.prototype.getZoom = yj.prototype.getZoom;
    yj.prototype.m = function () { var a = this.a.camera; a.zoom = ab(this.a.zoom) ? this.a.zoom : a.zoom; return a }; yj.prototype.getRequestedCameraData = yj.prototype.m; yj.prototype.startControl = yj.prototype.B; yj.prototype.control = yj.prototype.v; yj.prototype.endControl = yj.prototype.s; function Wj(a) { Wj.u.constructor.call(this, yj.prototype.c.la); this.requested = a } v(Wj, Bc); function O(a, b, c, d) {
        var e; O.u.constructor.call(this, a, b, c, d); this.K = new M(0, 0); if (e = d.renderBaseBackground) this.Bh = e.lower, this.Ah = e.higher; this.zh = !!d.enableSubpixelRendering; this.yb = !!d.noWrap; this.Vb = Yj; this.he = this.b = 0; this.jc = this.Yd = !1; this.l = new M(.5, .5); this.i = sb(this.za) / Cb; this.f = new Vi; this.c = d = new Dj; this.Tb = z(this.Tb, this); d.addEventListener(d.g.Mf, this.Tb); this.a = new jh; d = a.element; this.Ba = a = d.ownerDocument.createElement("div"); a.style.position = "absolute"; a.style.width = a.style.height =
            "100%"; a.style.zIndex = 0; d.insertBefore(a, d.firstChild); this.Nf = new Sj(this.Ba, this.za); this.m = []; Zj(this); c.addEventListener("update", this.Gg, !1, this); c.addEventListener(c.a.Lc, this.hf, !1, this); c.addEventListener(c.a.Nc, this.jf, !1, this); c.addEventListener(c.a.td, this.Ig, !1, this); this.Ub = z(O.prototype.Ub, this); this.G = ak; this.kh(); this.b = bk(this, this.I.getZoom() + this.i); ck(this); dk(this, b.Ab().position, this.b); ek(this); this.Dc()
    } v(O, wj); r("H.map.render.p2d.RenderEngine", O); O.prototype.type = Bj.P2D;
    O.prototype.type = O.prototype.type; var ak = 2; O.prototype.ih = Kj; O.prototype.getState = function () { return this.G }; O.prototype.getState = O.prototype.getState; function fk(a, b, c) { b = c - b; return rb(b) < a.a.w / 2 ? b : b - a.a.w * c / rb(c) }
    O.prototype.zb = function (a) {
        var b = this, c, d, e = a.requested, f = e.animate, e = e.camera.position, g = b.a.geoToPixel(e), h = g.x, k = g.y, l = this.b, m = this.l, n = 0, q, t, u; gk(this); this.K.set(0, 0); a = hk(this, a); c = a.zoom; u = a.position; if (f) {
            if (d = c - l, q = { x: m.x, y: m.y }, f = this.a.b(q).x, t = this.a.projection.qb(e), t.x !== this.l.x || t.y !== this.l.y || c !== this.b) h = fk(this, f, h), ik(this, function (a) { var e = a - n, f; c !== l && (g = b.a.b(t), f = b.a.b(q), h = fk(b, f.x, g.x), k = g.y - f.y); n = a; jk(b, h * e, k * e); l += d * e; kk(b, l); ek(b); ok(b) }, this.Ua, function () {
                dk(b, u, c);
                kk(b, c); ek(b, u); ok(b)
            }, this.Xa)
        } else pk(this), dk(this, u, c), kk(this, c), ek(this, u); ok(this)
    }; O.prototype.Ua = 300; O.prototype.lh = function (a) { var b = ab(a); if (!b || b && 0 > a) throw new C(this.lh, 1, "positive number required"); this.Ua = a }; O.prototype.setAnimationDuration = O.prototype.lh; O.prototype.xh = function () { return this.Ua }; O.prototype.getAnimationDuration = O.prototype.xh; O.prototype.Xa = Nj; O.prototype.mh = function (a) { if (!sa(a)) throw new C(this.mh, 1, "function required"); this.Xa = a }; O.prototype.setAnimationEase = O.prototype.mh;
    O.prototype.yh = function () { return this.Xa }; O.prototype.getAnimationEase = O.prototype.yh; O.prototype.kh = function () { this.Xa = Nj; this.Ua = 300 }; O.prototype.resetAnimationDefaults = O.prototype.kh; p = O.prototype; p.Gg = function () { ok(this) }; p.hf = function (a) { var b = a.added; a = a.idx; qk(this, a, b); 0 === a && (ck(this), rk(this, b, !0)); sk(this); ok(this) };
    p.jf = function (a, b) { var c = a.removed, d = a.idx, e; this.Xd = tj(); (e = this.U.Fa.splice(d, 1)[0]) && e.J(); (e = this.F.Fa.splice(d, 1)[0]) && e.J(); (e = this.ea.Fa.splice(d, 1)[0]) && e.J(); (e = this.ba.Fa.splice(d, 1)[0]) && e.J(); this.T = this.Ga.c(); 0 === d && (rk(this, c, !1), ck(this)); this.m = Tj(this.Nf, tk(this), uk(this)); sk(this); b || ok(this) }; p.Ig = function (a) { this.jf(a, !0); this.hf(a) };
    function Zj(a) { var b = a.Ga.c(), c = 0, d = b.length, e;[a.U = {}, a.F = {}, a.ea = {}, a.ba = {}].forEach(function (a) { a.Yc = []; a.Fa = [] }); for (a.T = b; c < d; c++)e = b[c], qk(a, c, e, 1), 0 === c && rk(a, e, !0); ck(a) } function rk(a, b, c) { c = c ? b.addEventListener : b.removeEventListener; c.call(b, b.a.Uf, a.Kg, !1, a); c.call(b, b.a.Tf, a.Kg, !1, a) } p.Kg = function () { ck(this); ok(this) };
    function qk(a, b, c, d) { var e, f, g, h, k; c && (k = { Nb: a.zh, yi: a.i, noWrap: a.yb }, c.ca ? B(c, Oh) ? f = new Mj(c) : B(c, Qh) && (h = new Mj(c)) : (c.requestOverlays && (e = new Ij(c, k)), c.requestTiles && (f = new pj(c, k)), c.requestMarkers && (g = new Lj(c, k)), c.requestDomMarkers && (h = new jj(c, k)))); d = d || 0; a.U.Fa.splice(b, d, e); a.F.Fa.splice(b, d, f); a.ea.Fa.splice(b, d, g); a.ba.Fa.splice(b, d, h); a.T = a.Ga.c(); a.m = Tj(a.Nf, tk(a), uk(a)) }
    function uk(a) { var b = [], b = b.concat(a.F.Fa), b = b.concat(a.U.Fa), b = b.concat(a.ea.Fa), b = b.concat(a.ba.Fa); return b = b.filter(Ta) } function ck(a) { var b; if (0 < a.T.length) b = a.T[0].max, a.be = a.T[0].min, a.Zd = b; else { b = a.ih.zoom; var c = b.max; a.be = b.min; a.Zd = c } b = vk(a, a.b); b !== a.b && (a.b = b, a.a.Ja(b), ek(a)) } function hk(a, b) { var c = b.requested, d, e; e = (d = c.camera) && d.position; d = vk(a, vk(a, c.zoom) + a.i); e = wk({ position: new gc(e.lat, e.lng) }); a.b = c.animate ? a.b : d; e.zoom = d; return e }
    function dk(a, b, c) { var d = a.a; d.Ja(c); a.l = d.projection.qb(b); d.x = d.w * a.l.x; d.y = d.h * a.l.y } function vk(a, b) { var c = a.ih.zoom; return Qb(b, mb(c.min, a.be), lb(c.max, a.Zd)) } function wk(a) { a.yaw = a.pitch = a.roll = 0; a.fov = 70; return a } p.Ka = function (a, b) { var c = this.g.center, d = this.za; return this.a.Aa((a - c.x) * d, (b - c.y) * d, null, this.yb) }; O.prototype.screenToGeo = O.prototype.Ka; O.prototype.sa = sc; O.prototype.setPointer = O.prototype.sa; O.prototype.Za = function (a, b) { var c = this.Ka(a, b), d = this.I.Ab(); d.position = c; return d };
    O.prototype.screenToCameraData = O.prototype.Za; O.prototype.Ya = function (a) { var b = this.za, c = this.g.center, d = c.x * b, c = c.y * b; a = this.a.geoToPixel(a); var e = this.a.w; return new M(this.yb ? nb((a.x + d) / b) : nb((a.x - nb(a.x / e) * e + d) / b), nb((a.y + c) / b)) }; O.prototype.geoToScreen = O.prototype.Ya; O.prototype.v = function (a, b) { var c = this.wa[a || 4], d = this.a, e = c.left - b, f = d.Aa(e, c.top - b), g = c.right + b, c = d.Aa(g, c.bottom + b); g - e >= d.w && (f.lng = -(c.lng = 180)); return Xe(f, c) }; O.prototype.getBBox = O.prototype.v;
    O.prototype.Ma = function (a, b, c) { var d = [], e = this.za; a *= e; b *= e; d = xk(d, this.ba.Fa, a, b, c); if (c && d.length) return d; d = xk(d, this.ea.Fa, a, b, c); if (c && d.length) return d; d = xk(d, this.F.Fa, a, b, c); return c && d.length ? d : xk(d, this.U.Fa, a, b, c) }; O.prototype.getObjectsAt = O.prototype.Ma; function xk(a, b, c, d, e) { for (var f = b.length, g; f-- && !((g = b[f]) && g.Ma && (a = a.concat(g.Ma(c, d, e)), a.length && e));); return a } O.prototype.kb = x; function tk(a) { a = a.wa[2]; return { w: a.right - a.left, h: a.bottom - a.top } }
    O.prototype.Dc = function () { var a = this.m.length, b = this.wa, c, d, e, f, g; this.g.g || (e = b[2].clone()); O.u.Dc.call(this); c = tk(this); this.K.set(0, 0); f = c.w; for (g = c.h; a--;)c = this.m[a], d = c.size, d.w === f && d.h === g || cj(c, f, g); this.kb = new Th(f, g); e && (a = b[2], jk(this, e.left - a.left, e.top - a.top), ek(this)); ok(this) }; O.prototype.Ha = function () { return Kj }; O.prototype.getCapabilities = O.prototype.Ha; function yk(a) { tj() - a.Xd < a.Vb && !a.Yb ? a.uh = rj(a.Ub) : (a.Yb && (sk(a), zk(a)), a.G = ak) }
    function sk(a) { a.U.Yc.length = 0; a.F.Yc.length = 0; a.ea.Yc.length = 0; a.ba.Yc.length = 0 }
    O.prototype.Ub = function () {
        var a = this.F.Fa, b = this.g.center.clone().scale(this.za).round(), c = this.v(1, 0), d = this.v(1, 256), e = this.b, f = e - this.i, g, h, k = Ak, l, m = this.a; g = this.Bh; var n = this.Ah, q = a[0], a = this.K; for (h = this.m.length; h--;)l = this.m[h], B(l, Cj) && l.clear(); if (q) { if (g) for (; g;)h = e - g, q.ca(c, b, m, h, !0, a), --g; if (n && this.jc) for (l = 1; l <= n && (h = e + l, m.Ja(h), g = this.v(2, 0), m.Ja(e), !q.ca(g, b, m, h, !0, a)); l++); } this.Vb = Yj; c = this.jh(c, b, e, !1, a, k.Yf, this.F, this.U); b = this.jh(d, b, f, !1, a, k.Qf, this.ea, this.ba); this.Yb = c &&
            b; this.Fb && (Xj(this.I, this.Fb), this.Fb = null); this.kb && (b = this.g, b.dispatchEvent(new yi(b.a.Oc, b.m, this.kb, yi.prototype.SIZE)), this.kb = x); e < this.he ? this.jc = !0 : this.Yd && (this.jc = !1); this.he = e; this.Yd = c; yk(this)
    };
    O.prototype.jh = function (a, b, c, d, e, f, g) { var h = Array.prototype.slice.call(arguments, 6), k = h.length, l = h[0].Fa.length, m = k * l, n = Ak, q, t, u = !!m, y, J, T; for (y = 0; y < m; y++)f === n.Yf ? (T = y % k, J = Math.floor(y / k)) : f === n.Qf && (T = Math.floor(y / l), J = y % l), q = h[T].Fa[J], t = h[T].Yc, q && (q = q.ca(a, b, this.a, c, d, e), q === ij.ACTIVE && (this.Vb = Infinity), q !== ij.DONE || t[J] || (zk(this, this.T[J]), t[J] = !0), t[J] || (u = !1)); return u }; function zk(a, b) { a.dispatchEvent({ type: a.ee.Xf, target: b || a }) }
    O.prototype.D = function () { var a = this.Ga, b = this.Ga.c()[0], c = this.g; sj(this.uh); pk(this, !0); a.removeEventListener("update", this.Gg, !1, this); a.removeEventListener(a.a.Lc, this.hf, !1, this); a.removeEventListener(a.a.Nc, this.jf, !1, this); a.removeEventListener(a.a.td, this.Ig, !1, this); b && rk(this, b, !1); uk(this).forEach(function (a) { a.J() }); c.element && c.element.removeChild(this.Ba); this.Ba = null; this.G = 3; O.u.D.call(this) }; function ok(a) { a.Xd = tj(); a.G === ak && (a.Yb = !1, a.G = 1, yk(a)) }
    function Bk(a) { return wk({ position: a.a.projection.Fc(a.l) }) } function ek(a, b) { var c = Bk(a); b && (c.position = b); a.Fb = c; a.Fb.zoom = a.b - a.i } function Ck(a, b, c) { jk(a, b * a.za, c * a.za); a.K.set(0, 0); ek(a); ok(a) } function jk(a, b, c) { var d = a.a, e = a.l; d.x = a.yb ? mb(0, lb(d.w, d.x + b)) : Ob(d.x + b, d.w); d.y = mb(0, lb(d.w, d.y + c)); e.x = d.x / d.w; e.y = d.y / d.h } O.prototype.rd = function (a, b, c) { a = vk(this, vk(this, a) + this.i); kk(this, a, b, c) }; O.prototype.zoomAt = O.prototype.rd;
    function kk(a, b, c, d) { var e = a.za, f = a.g.center; c === +c && d === +d ? (c = (c - f.x) * e, d = (d - f.y) * e, a.K.set(c, d), jk(a, c, d), a.a.Ja(b), jk(a, -c, -d)) : (a.K.set(0, 0), a.a.Ja(b)); a.b = b; ek(a); ok(a) }
    O.prototype.P = function (a, b) { var c = this.Ha().zoom.max, d = a.Oa(), e, f, g, h, k; a.ed() || (e = new jh(this.a.projection), e.Ja(c), f = e.geoToPixel(a.tb()).round(), g = e.geoToPixel(a.rb()).round(), c = e.w, a.g() && (f.x -= c), b ? (h = e.geoToPixel(d), k = 2 * mb(h.x - f.x, g.x - h.x), h = 2 * mb(h.y - f.y, g.y - h.y)) : (k = g.x - f.x, h = g.y - f.y, d = e.a(f.add(g).scale(.5))), f = this.wa[4], e = f.right - f.left, f = f.bottom - f.top, c = -8 + lb(sb(e / k * c) / Cb, sb(f / h * c) / Cb) - this.i); return { zoom: vk(this, c), position: d } }; O.prototype.getCamForBounds = O.prototype.P;
    function gk(a) { pk(a, !0); a.c.mb() && a.s(!0); a.f.mb() && a.B(!0); pk(a, !0) } O.prototype.N = function (a, b) { gk(this); Dk(this, b); this.f.start(a, !!b) }; O.prototype.startInteraction = O.prototype.N; function Dk(a, b) { if (b) { var c = {}; c.Xg = b.power; c.Be = b.ease; c.duration = b.duration; a.o = c } } function bk(a, b) { return vk(a, vk(a, b - a.i) + a.i) }
    O.prototype.C = function (a, b, c, d, e) { var f = !1; this.f.mb() && (this.f.gh(a, b, c, d, e), this.f.Fd(Aj.COORD) && (e = this.f, e = Wi(e.a, e.c), 0 < Ui(e) && (Ck(this, -e.x, -e.y), f = !0)), this.f.Fd(Aj.ZOOM) && a === +a && b === +b && c === +c && d === +d && (b = Xi(this.f.a), a = this.f.hg(this.b), a !== this.b && (a = bk(this, a), kk(this, a, b.x, b.y), f = !0)), f && ok(this)) }; O.prototype.interaction = O.prototype.C;
    O.prototype.B = function (a) { var b = this, c, d, e, f; this.f.mb() && !a && (this.o && (a = aj(this.f), e = $i(this.f), f = this.o.duration, c = (this.o.Xg || 1) * a, d = new Qj(-(c / f), c), !D(e.x) && !D(e.y) && 0 < c && b.f.Fd(Aj.COORD) && ik(this, function (a) { c = d.c(a * f); D(c) || Ck(b, nb(-e.x * c), nb(-e.y * c)) }, f, void 0, this.o.Be)), this.o = null, this.f.clear()) }; O.prototype.endInteraction = O.prototype.B; O.prototype.O = function (a, b, c) { gk(this); this.c.start(b, c); Dk(this, a) }; O.prototype.startControl = O.prototype.O;
    O.prototype.j = function (a, b, c, d, e, f, g) { if (D(c = +g || +c)) throw new C(this.j, 2, c); if (D(a)) throw new C(this.j, 0, a); if (D(b)) throw new C(this.j, 2, b); this.c.mb() && this.c.set(a, b, c) }; O.prototype.control = O.prototype.j;
    O.prototype.s = function (a, b) {
        var c = this, d, e, f, g, h, k, l, m; this.c.mb() && (pk(this, !0), e = tj(), d = e - this.Ld, 1 <= d && (f = Fj(this.c), Ek(this, f, d)), !this.o || a || b ? "function" === typeof b && (d = { camera: Bk(this), zoom: this.b - this.i }, b(d), d.zoom += this.i, Fk(this, d)) : (d = Gj(this.c), k = Hj(this.c), l = this.o.duration, g = (this.o.Xg || 1) * d, h = new Qj(-(g / l), g), !D(k.x) && !D(k.y) && 0 < g && ik(this, function (a, b, d, f) { e && (d = f - e, e = 0); g = h.c(a * l) * d; D(g) || ((m = k.z * g) && kk(c, bk(c, c.b + m), c.c.atX, c.c.atY), Ck(c, nb(k.x * g), nb(k.y * g))) }, l, void 0, this.o.Be)),
            this.c.reset())
    }; O.prototype.endControl = O.prototype.s; function Fk(a, b) { var c, d, e, f = a.l, g = a.a.projection.qb(b.camera.position), h = a.a.b(g), k = h.y, h = h.x, l = b.zoom, m = a.a.b(f), f = m.y, n = m.x, m = a.b, q = Gj(a.c), t = a.c.atX, u = a.c.atY, y = 0, J, h = fk(a, n, h), h = h - n, k = k - f, m = l - m, f = tb(h * h + k * k + m * m); 0 !== q && 0 !== f && (c = h / f, d = k / f, e = m / f, J = q * q / (2 * f), ik(a, function (b, f) { var h, k, m; if (1 !== b) { h = q * f - J * f * f / 2; k = h - y; if (m = e * k) m = bk(a, a.b + m), kk(a, bk(a, m), t, u); Ck(a, nb(c * k), nb(d * k)); y = h } else a.l = g, kk(a, bk(a, l), t, u), ek(a), ok(a) }, 2 * f / q)) }
    O.prototype.Tb = function (a) { var b = this, c = a.offset; this.K.set(0, 0); c.x || c.y || c.z ? (this.Ld = tj(), ik(this, function (a, e, f, g) { b.Ld = g; Ek(b, c, f) }, Number.POSITIVE_INFINITY)) : pk(this, !0) }; function Ek(a, b, c) { c = c || 0; b.z && kk(a, bk(a, a.b + b.z * c), a.c.atX, a.c.atY); Ck(a, b.x * c, b.y * c) } function ik(a, b, c, d, e) { a.A && a.A.mb() && a.A.stop(!0); a.A = new Oj(b, c, d, e); a.A.start() } function pk(a, b) { a.A && a.A.mb() && a.A.stop(b) } O.prototype.enter = sc; O.prototype.enter = O.prototype.enter;
    O.prototype.Va = function (a) { var b = this.I.Ab(); this.zb({ requested: { camera: b, zoom: b.zoom, animate: !0 } }); zj(this.Ba, a) }; O.prototype.exit = O.prototype.Va; O.prototype.ya = function (a, b, c, d) { var e = this.Ba.ownerDocument.createElement("canvas"), f = e.getContext("2d"), g = this.za; e.width = (c - a) * g; e.height = (d - b) * g; for (c = 0; c < this.m.length; c++)d = this.m[c], B(d, Cj) && f.drawImage(d.a, -a * g, -b * g); return e }; var Ak = { Qf: 0, Yf: 1 }, Yj = 1E3; function P(a) { var b = {}; this.O = b.previousSibling = b.nextSibling = b; this.kb = new ye; P.u.constructor.call(this, a); a && "objects" in a && this.m(a.objects) } v(P, K); r("H.map.Group", P); P.prototype.type = Pe.GROUP; P.prototype.F = function (a, b) { var c; this.B = !0; c = P.u.F.call(this, a, b); this.B = !1; c && this.forEach(Gk, !0); return c }; P.prototype.setProvider = P.prototype.F; function Gk(a, b, c) { a.F(c.l) } P.prototype.contains = function (a) { var b = this === a; if (!b && this.b && B(a, K)) for (; !b && a;)a === this ? b = !0 : a = a.Da; return b };
    P.prototype.contains = P.prototype.contains; P.prototype.K = function () { this.U = A; this.forEach(Hk, !0) }; P.prototype.resetZInfo = P.prototype.K; function Hk(a) { a.K() } P.prototype.B = !1; P.prototype.ua = function (a) { var b = P.u.ua.call(this, a); b && !this.B && (this.A = a, this.forEach(Ik, !0), delete this.A); return b }; P.prototype.invalidate = P.prototype.ua; function Ik(a, b, c) { a.ua(c.A) }
    P.prototype.forEach = function (a, b, c) { var d, e, f, g; if (this.b) for (d = this.O, e = d.nextSibling, f = 0; e !== d;)g = e.nextSibling, a.call(c, e, f++, this), b && B(e, P) && e.forEach(a, b, c), e = g }; P.prototype.forEach = P.prototype.forEach; P.prototype.s = function (a) { var b = []; this.forEach(Jk, a, b); return b }; P.prototype.getObjects = P.prototype.s; P.prototype.S = function () { var a = null; this.b && this.forEach(function (b) { (b = b.S()) && (a ? a = a.wb(b) : a = b) }); return a }; P.prototype.getBounds = P.prototype.S; function Jk(a) { this.push(a) } P.prototype.b = 0;
    P.prototype.Ba = function () { return this.b }; P.prototype.getChildCount = P.prototype.Ba;
    P.prototype.V = function (a) { var b = this.O, c = b.previousSibling, d; B(a, K, this.V, 0); if (a.contains(this)) throw new kc(this.V, "The new object contains the parent group"); d = a.Da; if (d !== this) { if (d) { d = a.previousSibling; var e = a.nextSibling; d.nextSibling = e; e.previousSibling = d } a.Da = this; K.u.ia.call(a, this); c.nextSibling = a; a.previousSibling = c; a.nextSibling = b; b.previousSibling = a; this.b++ } b = a.F(this.l, this.V); a.fh = this.kb.next(); a.K(); b || a.ua(Me.Z_ORDER); return a }; P.prototype.addObject = P.prototype.V;
    P.prototype.m = function (a) { var b, c; Za(a, this.m, 0); b = a.length; for (c = 0; c < b; c++)this.V(a[c]) }; P.prototype.addObjects = P.prototype.m; P.prototype.a = function (a) { if (!a || a.Da !== this) throw new kc(this.a, "object not found"); var b = a.previousSibling, c = a.nextSibling; b.nextSibling = c; c.previousSibling = b; a.Da = null; K.u.ia.call(a, null); delete a.previousSibling; delete a.nextSibling; B(a.l, L) && a.F(null, this.a); this.b--; return a }; P.prototype.removeObject = P.prototype.a;
    P.prototype.v = function (a) { var b, c; Za(a, this.v, 0); b = a.length; for (c = 0; c < b; c++)this.a(a[c]) }; P.prototype.removeObjects = P.prototype.v; P.prototype.Ea = function () { var a = this.s(); this.v(a) }; P.prototype.removeAll = P.prototype.Ea; function Kk(a) { var b; Ua(this, Kk); Kk.u.constructor.call(this, a); this.C = a = []; for (b in Pe) a[Pe[b]] = new Le } v(Kk, Qg); r("H.map.provider.ObjectProvider", Kk); Kk.prototype.N = function (a) { return this.C[a || Pe.ANY] }; Kk.prototype.getInvalidations = Kk.prototype.N; Kk.prototype.o = function (a, b) { var c, d; b !== Me.NONE && (d = this.C[Pe.ANY], c = d.a + 1, d.c(c, b), d = this.C[a.type], d.c(c, b), a.j().c(c, b), Rg(this, a)) }; Kk.prototype.invalidateObject = Kk.prototype.o; Kk.prototype.requestOverlays = Kk.prototype.K;
    Kk.prototype.requestSpatials = Kk.prototype.m; Kk.prototype.requestSpatialsByTile = Kk.prototype.g; Kk.prototype.P = !1; Kk.prototype.requestMarkers = Kk.prototype.c; Kk.prototype.requestDomMarkers = Kk.prototype.b; function L(a) { a = a || {}; L.u.constructor.call(this, a); this.f = a = new P({ provider: this, min: a.min, max: a.max }); a.ia(this); this.A = new jf; this.v = new jf; this.j = new jf; this.B = new jf } v(L, Kk); r("H.map.provider.LocalObjectProvider", L); L.prototype.I = function () { return this.f }; L.prototype.getRootGroup = L.prototype.I; L.prototype.o = function (a, b) { b & Me.SPATIAL && this.V(a); L.u.o.call(this, a, b) }; L.prototype.invalidateObject = L.prototype.o;
    L.prototype.V = function (a) { var b; B(a, K, this.V, 0); if (a.l !== this) throw new kc(this.V, "foreign object"); this.a(a); b = B(a, xi) ? this.j : B(a, fh) ? this.B : B(a, Lk) ? this.A : this.v; var c = a.S(), d = c.tb(), e = c.rb(); b = (c = c.g()) ? kf(b, d.lat, e.lng, e.lat, d.lng, c) : kf(b, d.lat, d.lng, e.lat, e.lng, c); b.Lf = a; a.Ua = b }; L.prototype.a = function (a) { var b; if (a) if (a.l !== this) { if (B(a, K)) throw new kc(this.a, "foreign object"); } else if (b = a.Ua) (B(a, xi) ? this.j : B(a, fh) ? this.B : B(a, Lk) ? this.A : this.v).remove(b), delete b.Lf, delete a.Ua };
    L.prototype.removeObject = L.prototype.a; function Mk(a, b, c, d, e) { var f, g, h; if (b.c) { a = b !== a.j; e = !e; b = of(b, c); g = 0; c = b.length; for (f = 0; f < c; f++) { h = b[f].Lf; for (var k = nb(d), l = h, m = void 0; (m = l.Ga <= k && l.ea >= k) && (l = l.Da);); m && (e || h.getVisibility(!0)) && (a || 1 === h.sb().getState()) && (b[g++] = h) } b.length = g } else b = De; return b } L.prototype.ba = function () { return 0 < this.A.c }; L.prototype.providesOverlays = L.prototype.ba; L.prototype.K = function (a, b, c) { return Mk(this, this.A, a, b, c).filter(function (a) { return a.Pb() }) };
    L.prototype.requestOverlays = L.prototype.K; L.prototype.s = function () { return 0 < this.v.c }; L.prototype.providesSpatials = L.prototype.s; L.prototype.m = function (a, b, c) { return Mk(this, this.v, a, b, c) }; L.prototype.requestSpatials = L.prototype.m; L.prototype.g = function (a, b) { return Mk(this, this.v, a.s(), a.zL, b) }; L.prototype.requestSpatialsByTile = L.prototype.g; L.prototype.l = function () { return 0 < this.j.c }; L.prototype.providesMarkers = L.prototype.l; L.prototype.c = function (a, b, c) { return Mk(this, this.j, a, b, c) };
    L.prototype.requestMarkers = L.prototype.c; L.prototype.i = function () { return 0 < this.B.c }; L.prototype.providesDomMarkers = L.prototype.i; L.prototype.b = function (a, b, c) { return Mk(this, this.B, a, b, c) }; L.prototype.requestDomMarkers = L.prototype.b; L.prototype.D = function () { this.f.Ea(); L.u.D.call(this) }; function Nk(a, b, c, d, e, f) { var g; for (g = []; d <= e; d++)g = g.concat(sh(a, c, d)); a = g.length; Ei.call(this, f, a); this.l = c = []; this.f = z(this.f, this); this.c = z(this.c, this); for (this.L(1); a--;)f = g[a], c.push(ch(b, f[0], f[1], f[2], this.f, this.c)) } v(Nk, Ei); Nk.prototype.f = function () { Hi(this, 2) }; Nk.prototype.c = function () { Hi(this, 4) }; Nk.prototype.Sc = function () { for (var a = this.l, b = a.length; b--;)a[b].cancel(); this.l = x }; function Ok(a, b) { var c = this; if (!sa(b)) throw new C(Pk, 1, b); if (!sa(a.next || sa(a.cycle))) throw new C(Ok, 2, 'Argument "mode" must implement H.util.AsyncQueue.Mode'); this.b = []; this.c = []; this.g = a; this.i = b; this.l = function () { Qk(c) }; this.a = null; this.f = function () { c.a || (c.a = w.setTimeout(c.l, 1)) } } r("H.util.AsyncQueue", Ok); Ok.prototype.push = function (a, b) { if (!sa(b)) throw new C(this.push, 1, b); var c = Rk(new Sk, a, this.f, b); this.b.push(c); this.f(); return c }; Ok.prototype.push = Ok.prototype.push;
    function Qk(a) { var b, c = a.c, d = 0, e = a.g; e.Kb = tj(); for (a.a = null; d < c.length;)b = c[d], b.rg ? c.splice(d, 1) : d++; for (; b = e.next(a.b, a.c);)b.cancelled ? b.done(null, "cancelled") : (c.push(b), a.i(b, b.data)) } function Sk() { Rk(this, null, null, null) } Ok.Task = Sk; function Rk(a, b, c, d) { a.data = b; a.cancelled = !1; a.rg = !1; a.b = c; a.c = d; a.a = null; return a } Sk.prototype.done = function (a, b) { this.rg = !0; this.b(); this.c(this, a, b) }; Sk.prototype.done = Sk.prototype.done; Sk.prototype.cancel = function () { this.a && this.a(); this.cancelled = !0 };
    Sk.prototype.cancel = Sk.prototype.cancel; Sk.prototype.f = function (a) { this.a = a; return this }; Sk.prototype.setCancelFn = Sk.prototype.f; function Tk(a, b) { Tk.u.constructor.call(this, new Uk(a), b) } v(Tk, Ok); r("H.util.SequentialQueue", Tk); function Uk(a) { if (isNaN(a) || 0 > a) throw new C(Tk, 1, 'Argument "maxTime" must be a positive number'); this.a = a; this.Kb = tj() } Uk.prototype.next = function (a) { return a.length && tj() - this.Kb < this.a ? a.shift() : null }; function Zf(a, b, c, d, e, f) { var g, h, k = a.length, l, m, n, q, t, u, y; if (k) for (g = []; k--;)for (u = a[k], q = u.length, t = 0, l = 1; l < q; l++) { if (y = Vk(u[l - 1], u[l], c, b, d, e)) m = y[0], n = y[1], t && t.pa(m) ? h.push(n) : g.push(h = y), t = n, f && (l = q, k = 0) } else g = a; return g }
    function Vk(a, b, c, d, e, f) { var g = a.x; a = -a.y; var h = b.x; b = -b.y; var k, l, m; c = -c; f = -f; if (g > h) { if (h > e || g < d) return; l = g; m = a; g = h; a = b; h = l; b = m; l = 1 } else if (g > e || h < d) return; if (a > b) { if (b > c || a < f) return; k = 1; a = -a; b = -b; m = f; f = -c; c = -m } else if (a > c || b < f) return; if (g < d) { if ((a += (d - g) * (b - a) / (h - g)) > c) return; g = d } if (a < f) { if ((g += (f - a) * (h - g) / (b - a)) > e) return; a = f } h > e && (b = a + (e - g) * (b - a) / (h - g), h = e); b > c && (h = g + (c - a) * (h - g) / (b - a), b = c); k && (a = -a, b = -b); return l ? [new M(h, -b), new M(g, -a)] : [new M(g, -a), new M(h, -b)] }
    function ag(a, b, c, d, e, f, g, h, k, l) { a = { x: a, y: b, next: c || null, nb: d || null, ef: e || null, df: f || null, bb: g || 0, Ce: h || 0, ie: k || 0, alpha: l || 0 }; d && (a.nb.next = a); c && (a.next.nb = a); return a } function cg(a) { for (; a && a.bb;)a = a.next; return a } function bg(a) { if (a) for (; a.next;)a = a.next; return a } function hg(a) { var b = a; if (b) { do b = b.next; while (b != a && (!b.bb || b.bb && b.ie)) } return b } function gg(a) { var b = bg(a); b.nb.next = a; a.nb = b.nb }
    function dg(a, b, c, d, e, f) { var g, h, k, l = b.x - a.x, m = b.y - a.y; g = d.x - c.x; var n = d.y - c.y; h = l * n - m * g; if (!h) return 0; g = ((c.x - a.x) * n - (c.y - a.y) * g) / h; h = (m * (c.x - a.x) - l * (c.y - a.y)) / h; if (0 > g || 1 < g || 0 > h || 1 < h) return 0; 0 === g ? k = a : 1 === g ? k = b : 0 === h ? k = c : 1 === h && (k = d); if (k && !f) return k.x += 2.480549651603763E-5, k.y += 7.321997314118067E-5, k.zd && (k.zd.x = k.x, k.zd.y = k.y), dg(a, b, c, d, e); e.Hi = a.x + g * l; e.Ii = a.y + g * m; e.Kh = g; e.Zf = h; return 1 }
    function fg(a, b, c) { var d, e = 0, f = {}, g, h, k, l, m, n; c = c || a.y; d = ag(-137438953472, c); Array.isArray(b) ? (k = 0, g = b[k], l = function () { return b[++k] }) : (m = g = b, l = function () { return m = m.next }); for (; n = l();) { h = dg(d, a, g, n, f, !0); g = f.Zf; if (0 === g || 1 === g) return fg(a, b, c + 6E-5); h && e++; g = n } return e % 2 } function eg(a, b, c) { for (b = b.next; b !== c && b.alpha <= a.alpha;)b = b.next; a.next = b; a.nb = b.nb; a.next.nb = a; a.nb.next = a } function $f(a) { for (var b, c = null, d = 0, e = a.length; d < e; d++) { b = ag(a[d].x, a[d].y, c); if (b.next = c) c.nb = b; c = b } return c }; function Wk(a, b, c, d) { a -= c; b -= d; return a * a + b * b }
    function Xk(a, b, c, d, e) { var f, g = 0, h = d, k = a[d].x, l = a[d].y, m = a[e].x, n = a[e].y, q = d + 1, t, u = Wk(k, l, m, n), y; if (u) for (; q < e;)t = a[q++], f = t.x, t = t.y, y = ((f - k) * (m - k) + (t - l) * (n - l)) / u, f = 0 > y ? Wk(f, t, k, l) : 1 < y ? Wk(f, t, m, n) : Wk(f, t, k + y * (m - k), l + y * (n - l)), f > g && (g = f, h = q - 1); else for (; q < e;)t = a[q++], f = t.x, t = t.y, f = Wk(f, t, k, l), f > g && (g = f, h = q - 1); g >= b || 0 < c && h - d ? (--c, 1 < h - d ? (d = Xk(a, b, c, d, h), d.splice(d.length - 1, 1)) : d = [a[d]], d = 1 < e - h ? d.concat(Xk(a, b, c, h, e)) : d.concat(a.slice(h, e + 1))) : d = [a[d], a[e]]; return d }; function Yk(a, b, c, d, e, f, g, h) { Yk.u.constructor.call(this, b, c, d, null); this.key = a; this.C = h; this.b = e; 1 !== f && (this.Wb = f); this.g = {}; this.zL = g; this.F = qb(zf.MAX_LINE_WIDTH / 2 * this.Wb + 1) } v(Yk, $g); r("H.map.provider.SpatialTile", Yk); Yk.prototype.f = Mb; Yk.prototype.N = Mb; Yk.prototype.c = Mb; function Zk(a) { return a.C.getInvalidations(Pe.SPATIAL) }
    function $k(a) { var b = Zk(a), c = b.a, d = a.f, e = d === c, f, g, h, k, l, m; if (!(e || b.j(d) || b.g(d))) { e = a.a; f = a.g; if (b.f(d)) for (g = e.length; g--;)h = e[g], h.j().f(d) && (e.splice(g, 1), k = k || al(a, h.ta())); if (b.i(d)) { for (g = e.length; g--;)if (h = e[g], h.j().i(d) && (l = 1, (h = f[h.ta()]) && h.a)) { k = 1; break } l && e.sort(bl) } if (!k && b.b(d)) for (g = e.length; g--;)if (e[g].j().b(d)) { m = 1; break } a.N !== d || m || (a.N = c, a.c !== d || k || (a.c = c)); a.f = c; e = !0 } return e }
    Yk.prototype.yc = function () { var a = Zk(this), b = a.a, c = this.c, d = c === b; d || (this.C.P && !a.b(c) ? d = !0 : $k(this) && (d = this.c === b)); return d }; Yk.prototype.isCanvasValid = Yk.prototype.yc; Object.defineProperty(Yk.prototype, "valid", { get: function () { return this.yc() }, set: sc, configurable: !0 }); function cl(a, b) { this.b = a; this.a = b } function al(a, b) { var c = a.g, d = c[b]; if (d) return delete c[b], d.a } Yk.prototype.a = De; function bl(a, b) { return Re(Qe(a), Qe(b), !1) } Yk.prototype.I = function () { return this.a }; Yk.prototype.getObjects = Yk.prototype.I;
    var dl = {}; Yk.prototype.j = function () { var a = this.b + "_" + this.Wb, b = dl[a], c; b || (b = -this.F, c = this.b - b, b = dl[a] = new qh(b, b, c, c)); return b }; Yk.prototype.getPxClipRect = Yk.prototype.j; Yk.prototype.s = function () { var a = this.K, b, c; a || (c = this.B(), a = 0, b = this.b, this.z && (b -= a += this.j().top), a = this.K = Xe(c.a(new M(a, a)), c.a(new M(b, b)))); return a }; Yk.prototype.getGeoClipRect = Yk.prototype.s; Yk.prototype.B = function () { var a = this.P, b; a || (b = this.b, a = this.P = new jh(A, b), a.Ja(this.z), a.x = this.x * b, a.y = this.y * b); return a };
    Yk.prototype.getPxProj = Yk.prototype.B; Yk.prototype.Wb = 1; Yk.prototype.pb = function () { return this.Wb }; Yk.prototype.getPixelRatio = Yk.prototype.pb; Yk.prototype.o = function () { var a = this.data; this.data = null; this.c = Mb; return a }; Yk.prototype.releaseCanvas = Yk.prototype.o; Yk.prototype.m = function () { this.g = {}; delete this.a; this.f = Mb }; Yk.prototype.releaseData = Yk.prototype.m;
    Yk.prototype.ca = function (a) {
        var b = a.getContext("2d"), c, d, e, f, g, h, k, l, m, n = k = 0; c = Zk(this); d = this.f; e = this.a; if (!$k(this)) { for (k = e.length; k--;)h = e[k], f = h.j(), (f.f(d) || f.g(d)) && al(this, h.ta()); this.a = this.C.requestSpatialsByTile(this, !1, !1).sort(bl); this.f = c.a } if (this.c < this.f) {
            c = this.a; if (d = c.length) for (a.width = a.height = this.b, b.clearRect(0, 0, this.b, this.b), e = this.g, f = 0; f < d; f++)if (h = c[f], g = h.ta(), l = (k = e[g]) ? k.b : h.getGeometriesForTile(this)) {
                if (k) h.j().b(this.c) && (k.a = Hf(h, l)), k = k.a; else {
                    k = Hf(h, l); m =
                        l; for (var q = h.B ? 2 : 0, t = m.length, u = void 0, y = u = void 0, J = void 0; t--;)if (u = m[t], u !== If) for (y = u.Ra, u = y.length; u--;)J = y[u], 4 < J.length && (y[u] = Xk(J, .36, q || 0, 0, J.length - 1)); this.g[g] = new cl(l, k)
                } if (k) {
                    b.save(); m = h.B ? this.T : this.O; for (g = 0; g < l.length; g++)m.call(this, h, l[g], h.Na(), b); if (l = h.getLabels(this)) for (h = b, g = l.length, m = m = t = q = q = void 0; g--;)for (q = l[g], m = q.size, h.font = m + "px " + q.font, h.fillStyle = q.color, h.textAlign = "center", h.translate(q.x, q.y), h.rotate(q.angle), m = q.lineHeight || 1.375 * m, q = q.lines, t = q.length; t--;)h.fillText(q[t],
                        0, t * m); b.restore()
                } n |= k
            } this.data = n ? a : null; this.N = this.c = this.f
        } else this.data && (n = 1); return 0 < n
    }; Yk.prototype.render = Yk.prototype.ca; Yk.prototype.O = function (a, b, c, d) { var e; c.b && (el(d, c, this.Wb), fl(b, d, !1, !0, !1, this.b, this.F)); c.a && (e = a.s) && e.fd && (gl(d, e), hl(this, d, b, e, c.lineWidth)) };
    Yk.prototype.T = function (a, b, c, d) { var e = c.c, f = c.b, g, h, k = this.b, l = this.F; if (b === If) e && (gl(d, c), d.fillRect(0, 0, k, k)); else if (f && el(d, c, this.Wb), c.a && (g = a.s) && (h = c.lineWidth, g.fd || (g = null)), a = b.b, a === Lb) { if (f || e) gl(d, c), fl(b, d, !0, f, e, k, this.F); g && (gl(d, g), hl(this, d, b, g, h, 0)) } else e && (gl(d, c), fl(b, d, !0, !1, e, k, l, 0, a)), f && fl(b, d, !1, f, !1, k, l, a), g && (gl(d, g), hl(this, d, b, g, h, a)) };
    function fl(a, b, c, d, e, f, g, h, k) { var l, m, n, q = a.Ra, t = -g; g = f + g; h = h || 0; k === A && (k = q.length); if (e && a === If) b.fillRect(0, 0, f, f); else if (k > h) { b.beginPath(); for (f = h; f < k; f++) { m = q[f]; n = m.length; if (m === Tf) b.moveTo(t, t), b.lineTo(t, g), b.lineTo(g, g), b.lineTo(g, t); else for (l = m[0], b.moveTo(l.x, l.y), h = 1; h < n; h++)l = m[h], b.lineTo(l.x, l.y); c && b.closePath() } c && e && b.fill(a.a !== Lb ? "evenodd" : "nonzero"); d && b.stroke() } }
    function el(a, b, c) { var d; a.strokeStyle = b.strokeColor; a.lineWidth = b.lineWidth * c; a.lineCap = b.lineCap; a.lineJoin = b.lineJoin; a.miterLimit = b.miterLimit; a.setLineDash && (d = b.lineDash) !== De && (a.setLineDash(d), a.lineDashOffset = b.lineDashOffset) } function gl(a, b) { a.fillStyle = b.fillColor }
    function hl(a, b, c, d, e, f) {
        var g = e * d.width / 2; e = e * d.length / 2; var h = e / 2; d = 2 * e * d.frequency; var k = tb(ub(e, 2) + ub(g, 2)); a = a.b - k; a = new qh(k, k, a, a); c = c.Ra; var l, m, n, q, t, u, y, J, T, ea, la, ob = Db / 2; f = f || 0; for (k = c.length; k-- > f;) {
            u = 0; l = c[k]; if (q = m = l.length) { n = l; q = n.length; for (t = 0; --q;)t += n[q].distance(n[q - 1]); q = (n = t) >= d } if (q) for (q = lb(pb(n / d), 1E3), q = n / (q + 1), t = q / 2; --m;) {
                for (y = (J = l[m]).distance(T = l[m - 1]); t <= u + y;)la = J.x + (T.x - J.x) * (ea = (t - u) / y), ea = J.y + (T.y - J.y) * ea, a.a(la, ea) && (b.save(), b.translate(la, ea), b.rotate(-Ab((T.y -
                    J.y) / (J.x - T.x)) + (J.x < T.x ? ob : -ob)), b.beginPath(), b.moveTo(-g, -e), b.lineTo(0, e), b.lineTo(g, -e), b.lineTo(0, -h), b.closePath(), b.fill(), b.restore()), t += q; u += y
            }
        }
    } var il = [];
    Yk.prototype.Ma = function (a, b, c) {
        for (var d = this.a, e = d.length, f, g, h, k, l, m, n = De, q, t = this.Wb; e--;)if (g = d[e], g.getVisibility(!0) && (h = this.g[g.ta()]) && (k = h.b)) {
            f = g.Na(); m = "none" !== f.fillColor && g.B; q = "none" === f.strokeColor ? 0 : f.lineWidth * t; for (f = k.length; f--;) {
                l = k[f]; var u; if (!(u = m && l === If) && (u = m || q)) {
                    u = a; var y = b, J = m, T = q, ea = l.a, la = l.b, ob = la !== Lb, na = void 0, ia = void 0; l = l.Ra; for (var Ja = l.length, Jb = void 0, Sd = void 0, lk = void 0, rf = void 0, sf = void 0, ia = Jb = void 0, mk = 0, nk = 0, ia = void 0, Co = !1, rf = 0; rf < Ja; rf++)if (Jb = l[rf],
                        ia = rf >= la, na = !ia && rf >= ea, Jb === Tf && J) na ? mk++ : nk++; else { lk = Jb.length; il.length = 2 * lk; for (sf = 0; sf < lk; sf++)Sd = Jb[sf], il[2 * sf] = Sd.x, il[2 * sf + 1] = Sd.y; Jb = J && !ia; ia = ob && !ia ? 0 : T; if (Jb || ia) if (ia = Ub(u, y, il, ia, Jb), 2 === ia || 1 === ia) { Co = !0; break } else if (3 === ia) if (na) mk++; else if (nk++ , ea === Lb) break } u = Co || 0 < nk && !(mk % 2)
                } if (u) { n === De && (n = []); n.push(g); break }
            } if (c && n.length) break
        } return n
    }; function jl(a, b) { var c, d; jl.u.constructor.call(this, b); this.m = a; this.B = c = b.pixelRatio; this.tileSize = d = 1 << nb(Nb((b.tileSize || 256) * c)); this.C = Tg(d, c); this.Qe = z(this.Qe, this); this.gf = z(this.gf, this); this.Re = z(this.Re, this); this.Pe = z(this.Pe, this); this.g = z(this.g, this); this.m.addEventListener(Qg.prototype.F.la, this.g, !1, this); this.b = []; this.c = new Vg(b.tileCacheSize || 256, this.Qe); this.f = new Vg(b.dataCacheSize || 512, this.gf); this.v = new Tk(20, this.Re); this.a = {}; this.j = tj() } v(jl, Sg);
    r("H.map.provider.SpatialTileProvider", jl); jl.prototype.g = function (a) { a.target.type === Pe.SPATIAL && Rg(this, a.target) }; jl.prototype.o = function (a, b, c, d) { var e = this.getTileKey(a, b, c), f; if (f = this.c.get(e, d)) { if (d || f.yc()) return f; d || this.c.g(e) } if ((f = this.f.get(e, d)) && (d || $k(f))) return a = this.b.pop() || document.createElement("canvas"), f.ca(a) || this.b.push(a), this.c.add(e, f, 1), f; d || ((f = this.a[e]) ? f.count++ : (f = this.v.push([e, a, b, c], this.Pe), f.count = 1, this.a[e] = f)) }; jl.prototype.requestTile = jl.prototype.o;
    jl.prototype.T = function (a, b, c) { this.K(this.getTileKey(a, b, c)) }; jl.prototype.cancelTile = jl.prototype.T; jl.prototype.K = function (a) { var b; if (b = this.a[a]) b.count-- , b.count || (b.cancel(), delete this.a[a]) }; jl.prototype.cancelTileByKey = jl.prototype.K; p = jl.prototype; p.Re = function (a, b) { var c = b[0], d = b[1], e = b[2], f = b[3], c = this.c.get(c) || new Yk(c, d, e, f, this.tileSize, this.B, f + this.C, this.m), d = c.data || this.b.pop() || document.createElement("canvas"); c.ca(d) || this.b.push(d); b.push(c); a.done(c) };
    p.Pe = function (a, b) { var c = a.data[0]; b && this.c.add(c, b, 1); delete this.a[c]; Rg(this) }; p.Qe = function (a, b) { b.data && this.b.push(b.o()); this.f.add(a, b, 1) }; p.gf = function (a, b) { b.m() }; p.D = function () { for (var a in this.a) this.a[a].cancel(); this.c.Ea(); this.f.Ea(); this.b.length = 0; jl.u.D.call(this) }; function Pk(a) { var b = "getURL"; if (!a || !sa(a[b])) throw new C(Pk, 0, "options." + b); Pk.u.constructor.call(this, a); this.P = this[b] = a[b]; b = "tileSize"; this[b] = a[b] || 256; this.I = { crossOrigin: a.crossOrigin }; this.b = w.URL || w.webkitURL; if (Ta(this.I.crossOrigin)) a = !!this.I.crossOrigin; else { a = this.P(0, 0, 0); var b = window.location, c = document.createElement("a"); c.href = a; a = c.hostname === b.hostname && c.port === b.port && c.protocol === b.protocol } (this.O = a && !!Gh.prototype.b[Hh] && !!this.b) && this.g.c(z(this.ea, this)) } v(Pk, N);
    r("H.map.provider.ImageTileProvider", Pk); Pk.prototype.v = function () { return this.tileSize }; Pk.prototype.getEntryWeight = Pk.prototype.v;
    Pk.prototype.c = function (a, b, c, d, e, f) { var g = this, h = this.P(a, b, c), k, l; a = null; h ? (l = w.setTimeout(function () { g.O ? (k = new Gh(Hh, h, f), k.then(function (a) { var b = new Image; b.onload = z(d, null, b, { zi: a }); b.onerror = z(e, null, "bad url"); try { b.src = g.b.createObjectURL(g.f(a)) } catch (c) { } }, e)) : k = (new Gh("image", h, f, g.I)).then(d, e) }, 150), a = { cancel: function () { k ? k.cancel() : w.clearTimeout(l) } }) : d(null); return a }; Pk.prototype.requestInternal = Pk.prototype.c;
    Pk.prototype.Ga = function (a, b) { var c = new Image; c.onload = function () { b(this) }; c.src = this.b.createObjectURL(this.f(a)) }; Pk.prototype.f = function (a) { var b = w.BlobBuilder || w.WebKitBlobBuilder || w.MozBlobBuilder, c = Pk.prototype; c.f = b ? function (a) { var c = new b; c.append(a); return c.getBlob("application/octet-stream") } : function (a) { return new Blob([a], { type: "application/octet-stream" }) }; return c.f(a) }; Pk.prototype.ea = function (a, b) { var c = b.data; c && c instanceof HTMLImageElement && this.b.revokeObjectURL(c.src) }; function oh(a, b) { var c = b || {}, d = c.opacity; this.opacity = Ta(d) ? d : 1; nh.call(this, a, c) } v(oh, nh); r("H.map.layer.TileLayer", oh); oh.prototype.g = function (a, b, c, d, e) { if (!B(a, G)) throw new C(this.g, 0, a); if (D(b = +b)) throw new C(this.g, 1, b); var f; b = pb(b); this.pixelProjection.Ja(b); a = this.j(a); f = this.i(a, b); return this.o(f, a.left > a.right, b, c, d, e) }; oh.prototype.requestTiles = oh.prototype.g; function Jj(a, b) { var c = b || {}; c.tileSize = c.tileSize || 256; c.pixelRatio = c.pixelRatio || 1; c.max = 28; this.f = new jl(a, c); this.i = new oh(this.f, { opacity: 1 }); c.minWorldSize = this.f.tileSize; Jj.u.constructor.call(this, c); this.opacity = this.i.opacity; this.tileSize = this.i.tileSize; this.j = a; this.o = z(this.o, this); this.f.addEventListener(this.f.F.la, this.o); a.addEventListener("update", this.o) } v(Jj, mh); r("H.map.layer.ObjectLayer", Jj);
    Jj.prototype.o = function (a) { a.currentTarget !== this.f && a.target.type === Pe.SPATIAL || this.l() }; Jj.prototype.Pa = function () { return this.j }; Jj.prototype.getProvider = Jj.prototype.Pa; var kl = { markers: De, total: 0 }; Jj.prototype.c = function (a, b, c) { var d = this.j, e; return d.providesMarkers() && (e = d.requestMarkers(a, b, !0, c)).length ? { markers: e, total: e.length } : kl }; Jj.prototype.requestMarkers = Jj.prototype.c;
    Jj.prototype.b = function (a, b, c) { var d = this.j, e; return d.providesDomMarkers() && (e = d.requestDomMarkers(a, b, !0, c)).length ? { markers: e, total: e.length } : kl }; Jj.prototype.requestDomMarkers = Jj.prototype.b; var ll = { tiles: De, total: 0 }; Jj.prototype.g = function (a, b, c, d) { var e; this.j.providesSpatials() ? (e = this.i.g(a, b, c, d), c || (c = this.f, e = tj(), 33 < e - c.j && (Qk(c.v), c.j = e), e = this.i.g(a, b, !0, d))) : e = ll; return e }; Jj.prototype.requestTiles = Jj.prototype.g; Jj.prototype.A = function (a, b, c, d) { return this.i.A(a, b, c, d) };
    Jj.prototype.requestTile = Jj.prototype.A; Jj.prototype.m = function (a, b, c) { this.i.m(a, b, c) }; Jj.prototype.cancelTile = Jj.prototype.m; var ml = { overlays: De, total: 0 }; Jj.prototype.C = function (a, b, c) { var d = this.j, e = ml; d.providesOverlays && d.providesOverlays() && (a = d.requestOverlays(a, b, !0, c), b = a.length) && (e = { overlays: a, total: b }); return e }; Jj.prototype.requestOverlays = Jj.prototype.C; Jj.prototype.D = function () { this.f.J(); this.i.J(); this.j.dispose(); Jj.u.D.call(this) }; function Q(a, b, c) {
        Q.u.constructor.call(this); this.O = z(Q.prototype.O, this); this.l = nl(c, Q); this.c = c = new yj; this.F = !1; c.addEventListener(c.c.Oc, this.Za, !1, this); if (!B(a, Element)) throw new C(Q, 0, a); c = this.b = a.ownerDocument.createElement("div"); var d = c.style; d.position = "relative"; d.height = c.style.width = "100%"; d.overflow = "hidden"; d.webkitTapHighlightColor = "transparent"; "transparent" !== d.webkitTapHighlightColor && (d.webkitTapHighlightColor = "rgba(0,0,0,0)"); a.appendChild(c); this.va = new uj(this.b, this.l); this.va.addEventListener(this.va.a.Oc,
            this.Za, !1, this); a = this.fa = new Di(this.l.layers); a.addEventListener(a.a.td, this.Ba, !1, this); a.addEventListener(a.a.Lc, this.Ba, !1, this); a.addEventListener(a.a.Nc, this.Ba, !1, this); this.B = new L({ max: 28 }); this.ea = new Jj(this.B, this.l); this.re(this.ea); this.i = null; this.fa.add(b, 0); this.f = this.P(this.l.engineType || ol.P2D, this.l); b = this.l.center || new gc(0, 0); a = +this.l.zoom || 0; c = this.l.bounds; this.C = z(this.C, this); this.T = z(this.T, this); B(c, G) ? this.sa(c) : (this.Ga(b), this.Ha(a)); b = this.l.imprint; if (b !== A &&
                "object" !== typeof b) throw new C(Q, 1, "imprint"); this.j = null === b ? b : new Ji(this, b); b = this.l.autoColor; this.I = b === A || !!b; pl(this)
    } v(Q, I); r("H.Map", Q); function nl(a, b) { var c; if (a) if (c = a.pixelRatio, c === A) a.pixelRatio = 1; else { if (!(0 < c)) throw new C(b, 0, "pixelRatio: " + c); } else a = { pixelRatio: 1 }; a.renderBaseBackground || (a.renderBaseBackground = { lower: 3, higher: 2 }); return a }
    Q.prototype.D = function () { this.I = !1; this.j && this.j.J(); this.ea.J(); this.B.J(); this.fa.J(); this.c.J(); this.va.J(); this.f.J(); Ge(this.b); this.b = null; I.prototype.D.call(this) }; Q.prototype.Vb = function () { return this.b }; Q.prototype.getElement = Q.prototype.Vb; Q.prototype.A = function () { return this.l.pixelRatio }; Q.prototype.getPixelRatio = Q.prototype.A; function pl(a) { a.j && a.I && a.j.g({ invert: a.i.Oh }) }
    Q.prototype.Ba = function (a) { var b = a.added, c = a.removed; b && sa(b.Pa) && b.Pa().ia(this); c && sa(c.Pa) && c.Pa().ia(null); 0 === a.idx && (this.dispatchEvent(new Ne(this.v.oh, this.i = a.type !== this.fa.a.Nc ? b : 0 < this.fa.Y.length ? this.fa.get(0) : x, a.type !== this.fa.a.Lc ? c : 1 < this.fa.Y.length ? this.fa.get(1) : x)), pl(this)) }; Q.prototype.Za = function (a) { a.modifiers && (this.F || (ql(this, "start"), this.F = !0), ql(this, "", a)); this.F && (this.Ya && w.clearTimeout(this.Ya), this.Ya = w.setTimeout(this.T, 333)) };
    function ql(a, b, c) { a.dispatchEvent(c ? new yi(a.v.Rf, c.newValue, c.oldValue, c.modifiers) : a.v.Rf + b) } Q.prototype.T = function () { ql(this, "end"); this.F = !1 }; Q.prototype.Ga = function (a, b) { this.c.Jb({ animate: !!b, position: a }); return this }; Q.prototype.setCenter = Q.prototype.Ga; Q.prototype.Oa = function () { var a = this.c.Ab(); return a ? ic(a.position) : x }; Q.prototype.getCenter = Q.prototype.Oa; Q.prototype.Ha = function (a, b) { this.c.l(a, !!b); return this }; Q.prototype.setZoom = Q.prototype.Ha; Q.prototype.getZoom = function () { return this.c.getZoom() };
    Q.prototype.getZoom = Q.prototype.getZoom; Q.prototype.rd = function (a, b, c) { this.f.rd(a, b, c) }; Q.prototype.zoomAt = Q.prototype.rd; Q.prototype.sa = function (a, b) { if (!B(a, G)) throw new C(this.sa, 0, a); var c = this.f.P(a, !1); c.zoom = pb(c.zoom); c.animate = b; this.c.Jb(c); return this }; Q.prototype.setViewBounds = Q.prototype.sa; Q.prototype.ba = function () { return this.f.v(4, 0) }; Q.prototype.getViewBounds = Q.prototype.ba; Q.prototype.U = function (a) { if (!B(a, G)) throw new C(this.U, 0, a); return this.f.P(a, !0) };
    Q.prototype.getCameraDataForBounds = Q.prototype.U; Q.prototype.Ub = function () { return this.va }; Q.prototype.getViewPort = Q.prototype.Ub; Q.prototype.Tb = function () { return this.c }; Q.prototype.getViewModel = Q.prototype.Tb; Q.prototype.kb = function () { return this.fa }; Q.prototype.getLayers = Q.prototype.kb; Q.prototype.Fb = function () { return this.j }; Q.prototype.getImprint = Q.prototype.Fb;
    Q.prototype.ya = function (a, b, c, d, e, f) {
        function g(a, b) { J ? a.cancel() : (n.save(), b.capture(m, t, function (b) { n.restore(); a.done(b) }, function (b) { a.done(null, b); h(null) })) } function h(b) { J || (J = !0, a(b)) } var k = this.g(), l = k.Ha(), m, n, q = this.j, t = this.l.pixelRatio, u; b = b || []; var y = this.va, J = !1, T, ea; if (!sa(a)) throw new C(this.ya, 0, a); c = c || 0; d = d || 0; e = e || y.width; f = f || y.height; T = mb(0, lb(c, e)); ea = mb(0, lb(d, f)); c = lb(y.width, mb(c, e)); d = lb(y.height, mb(d, f)); l.capture ? (m = k.ya(T, ea, c, d), n = m.getContext("2d"), m.style.width = m.width /
            t + "px", m.style.height = m.height / t + "px", u = new Tk(10, g), b = b.concat(q).filter(function (a) { return sa(a && a.capture) }), b.length ? (k = b.pop(), b.forEach(function (a) { u.push(a, sc) }), u.push(k, z(h, this, m)), Qk(u)) : h(m)) : a(null)
    }; Q.prototype.capture = Q.prototype.ya; Q.prototype.g = function () { return this.m || this.f }; Q.prototype.getEngine = Q.prototype.g; Q.prototype.N = function (a) { this.f.type === a || this.wa || (this.wa = !0, this.m = this.P(a), this.m.addEventListener("render", this.C)); return this }; Q.prototype.setEngineType = Q.prototype.N;
    Q.prototype.C = function (a) { a.target === this.m && (this.m.removeEventListener("render", this.C), this.m.enter(), this.f.Va(this.O)) }; Q.prototype.O = function () { var a = this.f.type; this.f.J(); this.f = this.m; this.m = A; this.wa = !1; this.dispatchEvent(new Ne(this.v.vh, this.f.type, a)) };
    Q.prototype.P = function (a, b) { var c = b ? nl(b, this.P) : this.l; if (a === ol.PANORAMA) return this.j && this.I && this.j.g({ invert: !0 }), new w.H.map.render.panorama.RenderEngine(this.va, this.c, this.fa, c); if (a === ol.P2D) return pl(this), new O(this.va, this.c, this.fa, c); throw new C(this.N, 0, a); };
    Q.prototype.K = function (a, b, c, d, e) { var f; b = Ta(b) ? B(b, G, this.K, 1, b) && b : this.ba(); c = Ta(c) ? +c : this.getZoom(); d = Ta(d) ? +d : this.getZoom(); if (!(c <= d)) throw new C(this.K, A, "!(min <= max)"); e = e || this.i; if (!B(e, nh)) throw new C(this.K, 4); if (!(f = e.Pa()) || !B(f, N) || !f.Rc()) throw new kc(this.constructor, "Storing is not supported"); return new Nk(e, f, b, c, d, a) }; Q.prototype.storeContent = Q.prototype.K; function rl(a) { Ei.call(this, a) } v(rl, Ei); rl.prototype.f = function () { Hi(this, 2) }; rl.prototype.c = function () { Hi(this, 4) };
    Q.prototype.yb = function (a) { a = new rl(a); vc().clear(z(a.f, a), z(a.c, a)); return a }; Q.prototype.clearContent = Q.prototype.yb; Q.prototype.re = function (a, b) { -1 === this.fa.indexOf(a) && this.fa.add(a, D(b) ? this.fa.Y.length - 1 : b); return this }; Q.prototype.addLayer = Q.prototype.re; Q.prototype.tf = function (a) { var b = this.fa.indexOf(a); a !== this.i && a !== this.ea && -1 !== b && this.fa.b(b); return this }; Q.prototype.removeLayer = Q.prototype.tf; Q.prototype.Zb = function (a) { this.i !== a && (this.fa.set(0, a), this.i = a); return this };
    Q.prototype.setBaseLayer = Q.prototype.Zb; Q.prototype.zb = function () { return this.i }; Q.prototype.getBaseLayer = Q.prototype.zb; Q.prototype.o = function (a) { if (!hc(a)) throw new C(this.o, 0, a); return (a = this.f.Ya(a)) ? gh(a) : x }; Q.prototype.geoToScreen = Q.prototype.o; Q.prototype.Ka = function (a, b) { var c; if (c = +D(a) || 2 * D(b)) throw new C(this.Ka, c - 1, arguments[c - 1]); return (c = this.f.Ka(a, b)) ? ic(c) : x }; Q.prototype.screenToGeo = Q.prototype.Ka; Q.prototype.Va = function (a, b) { return this.f.Za(a, b) };
    Q.prototype.screenToCameraData = Q.prototype.Va; Q.prototype.V = function (a) { if (!B(a, K)) throw new C(this.V, 0, a); this.B.f.V(a); return a }; Q.prototype.addObject = Q.prototype.V; Q.prototype.a = function (a) { if (!B(a, K)) throw new C(this.a, 0, a); this.B.f.a(a); return a }; Q.prototype.removeObject = Q.prototype.a; Q.prototype.jc = function () { return this.B.f.s(!0) }; Q.prototype.getObjects = Q.prototype.jc; Q.prototype.Ua = function (a) { var b, c; if (!qa(a)) throw new C(this.Ua, 0, a); b = a.length; for (c = 0; c < b; c++)this.V(a[c]); return this };
    Q.prototype.addObjects = Q.prototype.Ua; Q.prototype.Xa = function (a) { if (!B(a, P) && !qa(a)) throw new C(this.Xa, 0, a); a.forEach(this.a, this); return this }; Q.prototype.removeObjects = Q.prototype.Xa; Q.prototype.s = function (a, b) { var c; if (c = +D(a) || 2 * D(b)) throw new C(this.s, c - 1, arguments[c - 1]); return this.f.Ma(a, b, !0)[0] || x }; Q.prototype.getObjectAt = Q.prototype.s; Q.prototype.Ma = function (a, b) { var c; if (c = +D(a) || 2 * D(b)) throw new C(this.s, c - 1, arguments[c - 1]); return this.f.Ma(a, b, !1) }; Q.prototype.getObjectsAt = Q.prototype.Ma;
    var Pi = 1, ol = { P2D: 0, PANORAMA: Pi }; Q.EngineType = ol; Q.prototype.v = { Oi: "mapviewchangestart", Rf: "mapviewchange", Sf: "mapviewchangeend", oh: "baselayerchange", vh: "enginechange" }; function Lk(a, b, c) { this.c = z(this.c, this); K.call(this, c); this.i(a); this.m(b, c && c.crossOrigin); this.f(c && "opacity" in c ? c.opacity : 1) } v(Lk, K); r("H.map.Overlay", Lk); Lk.prototype.type = Pe.OVERLAY; Lk.prototype.S = function () { return this.a }; Lk.prototype.getBounds = Lk.prototype.S; Lk.prototype.i = function (a) { var b = this.a, c = !b; B(a, G, Lk, 0, a); if (c || !b.pa(a)) this.a = a, c || this.ua(Me.SPATIAL); return this }; Lk.prototype.setBounds = Lk.prototype.i; Lk.prototype.Pb = function () { return this.b.getData() };
    Lk.prototype.getBitmap = Lk.prototype.Pb; Lk.prototype.m = function (a, b) { var c = this.b; c && 1 !== c.getState() && c.cancel(); this.b = new mi(a, this.c, !0, A, b); return this }; Lk.prototype.setBitmap = Lk.prototype.m; Lk.prototype.c = function (a, b) { this.b = b; 1 === a && this.ua(Me.VISUAL) }; Lk.prototype.Bd = function () { return this.o }; Lk.prototype.getOpacity = Lk.prototype.Bd; Lk.prototype.f = function (a) { var b = this.o, c = 2 > b; a -= 0; if (0 <= a && 1 >= a) a !== b && (this.o = a, c && this.ua(Me.VISUAL)); else throw new C(this.f, 0); return this };
    Lk.prototype.setOpacity = Lk.prototype.f; function sl() { return Bh("mapsjs-core", "0.17.0", "e7c502b") } r("H.buildInfo", sl); r("H.getScriptPath", function () { var a; a = w.H.scriptPath; Ta(a) || (a = tl); if (!a) throw Error("Cant't detect script path: H.scriptPath is missing"); return a }); var tl, ul = w.document.currentScript, vl; ul || (ul = w.document.querySelector('script[src*="H-"]'), ul || (vl = w.document.getElementsByTagName("script"), ul = vl[vl.length - 1])); tl = ul ? ul.src.replace(/\/[^\/]*$/, "/") : "";

    this["maps" + "js"] = H;
}());
H.__bootstrap__ = "var m,q=this;function aa(a,b,c){a=a.split(\".\");c=c||q;a[0]in c||!c.execScript||c.execScript(\"var \"+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c[d]?c=c[d]:c=c[d]={}:c[d]=b}function ea(){}function fa(){throw Error(\"unimplemented abstract method\");}\nfunction ga(a){var b=typeof a;if(\"object\"==b)if(a){if(a instanceof Array)return\"array\";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(\"[object Window]\"==c)return\"object\";if(\"[object Array]\"==c||\"number\"==typeof a.length&&\"undefined\"!=typeof a.splice&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"splice\"))return\"array\";if(\"[object Function]\"==c||\"undefined\"!=typeof a.call&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"call\"))return\"function\"}else return\"null\";\nelse if(\"function\"==b&&\"undefined\"==typeof a.call)return\"object\";return b}function ha(a){return\"string\"==typeof a}function r(a){return\"function\"==ga(a)}function ia(a){var b=typeof a;return\"object\"==b&&null!=a||\"function\"==b}var ka=\"closure_uid_\"+(1E9*Math.random()>>>0),la=0;function ma(a,b,c){return a.call.apply(a.bind,arguments)}\nfunction qa(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function sa(a,b,c){sa=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf(\"native code\")?ma:qa;return sa.apply(null,arguments)}\nfunction ta(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}}function u(a,b){aa(a,b,void 0)}function ua(a,b){function c(){}c.prototype=b.prototype;a.W=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.eb=function(a,c,f){for(var g=Array(arguments.length-2),h=2;h<arguments.length;h++)g[h-2]=arguments[h];return b.prototype[c].apply(a,g)}};function v(){}u(\"H.util.ICache\",v);v.prototype.add=function(){};v.prototype.add=v.prototype.add;v.prototype.get=function(){};v.prototype.get=v.prototype.get;v.prototype.j=function(){};v.prototype.drop=v.prototype.j;v.prototype.forEach=function(){};v.prototype.forEach=v.prototype.forEach;v.prototype.i=function(){};v.prototype.removeAll=v.prototype.i;v.prototype.g=function(){};v.prototype.registerOnDrop=v.prototype.g;var va=\"constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf\".split(\" \");function wa(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<va.length;f++)c=va[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var y=function(){return this}();function xa(a){if(Error.captureStackTrace)Error.captureStackTrace(this,xa);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}ua(xa,Error);xa.prototype.name=\"CustomError\";var Aa=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\\s\\xa0]+|[\\s\\xa0]+$/g,\"\")};function Ba(a,b){return a<b?-1:a>b?1:0};var Ca=Array.prototype,Da=Ca.indexOf?function(a,b,c){return Ca.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(ha(a))return ha(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};var Ea=sa,Fa=String;function Ga(a){return eval(\"\"+a)}var Ha=y.Object.freeze||function(a){return a};function Ia(a){var b={},c;for(c in a)b[c]=a[c];return b}var z=Ga(),Ja=Ga(null);function Ka(a){return Fa(a).split(\",\"!==z?\",\":\" \")}var Ma=\"prototype constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf\".split(\" \");function Na(a,b,c,d){if(!(b=a instanceof b)&&c)throw new B(c,d,void 0!==z?void 0:a);return b}u(\"H.lang.isObject\",ia);\nfunction Oa(a){for(var b in a)return!1;return!0}u(\"H.lang.isEmptyObject\",Oa);function Pa(a,b,c,d){var e;if(!(e=\"Array\"===Qa(a))&&b)throw new B(b,c,d!==z?d:a);return e}u(\"H.lang.isArray\",function(a,b,c,d){return Pa(a,b,c,d)});u(\"H.lang.isString\",ha);var Ra=isNaN;function Sa(a){return a===+a}u(\"H.lang.isNumber\",Sa);function Qa(a){var b=Object[Ma[0]][Ma[6]].call(a).match(/^\\[object (\\w+)\\]$/);return b?b[1]:typeof a}\nfunction Ta(a,b,c,d){var e=\"\",f=2>arguments.length;f&&(b={H:y.H},c=\"\",d=[]);Ua(b,!0,function(b,f){try{var k=b[f];f=Va(b,k);var l;if(l=!(ia(k)&&k.window===k&&k.self===k))l=!(ia(k)&&0<k.nodeType&&r(k.cloneNode));if(l&&ia(k)){if(k===a)return e=c+\".\"+f,!0;if(0>d.indexOf(k)&&(d.push(k),e=Ta(a,k,c+\".\"+f,d)))return!0}}catch(n){}});f&&(e=e?e.substr(1).replace(\".\"+Ma[0]+\".\",\"#\"):\"~\"+(r(a)?Wa(a)+\"()\":Qa(a)));return e}\nfunction Va(a,b){var c=[];Ua(a,!1,function(a,e){a[e]===b&&c.push(e)});return c.sort(Xa)[0]}function Xa(a,b){return b.length-a.length}var Ya=Object[Ma[0]][Ma[2]];function Ua(a,b,c){var d,e;if(a){for(d in a)if((!b||Ya.call(a,d))&&c(a,d,!0))return;for(e=Ma.length;e--&&(d=Ma[e],b&&!Ya.call(a,d)||!c(a,d,!1)););}}function Wa(a){return(a=/^\\s*function ([^\\( ]+)/.exec(a))?a[1]:\"anonymous\"}function Za(a,b,c){c[b]=\"#\"+b}({}).toString.call(void 0);function C(a,b,c){b&&this.g(b);if(c&&!r(c))throw new B(C,2,c);this.b=0;this.filter=c;this.a={};this.f=this.c=null;this.l(a)}u(\"H.util.Cache\",C);C.prototype.add=function(a,b,c){var d,e;c=+c;if(!Sa(c)||0>c)throw new B(this.add,2,c);a=String(a);d=this.a[a];e=!0;this.filter&&(e=this.filter(a,b,c));d?e?(this.b+=c-d.size,d.size=c,d.data=b,$a(this,d)):bb(this,d,!0):e&&(this.a[a]=cb(this,{id:a,data:b,size:c,F:null,J:null},this.c));db(this);return e};C.prototype.add=C.prototype.add;\nC.prototype.g=function(a){if(!r(a))throw new B(this.g,0,a);this.v=a};C.prototype.registerOnDrop=C.prototype.g;C.prototype.get=function(a,b){var c=b?this.a[a]:$a(this,this.a[a]);return c&&c.data};C.prototype.get=C.prototype.get;C.prototype.j=function(a){var b;(b=this.a[a])&&bb(this,b,!0)};C.prototype.drop=C.prototype.j;C.prototype.forEach=function(a,b,c){var d,e;for(e in this.a)d=this.a[e],(c?c(e,d.data,d.size):1)&&a.call(b,e,d.data,d.size)};C.prototype.forEach=C.prototype.forEach;\nC.prototype.i=function(a){var b,c;for(c in this.a)b=this.a[c],(a?a(c,b.data,b.size):1)&&bb(this,this.a[c],!0)};C.prototype.removeAll=C.prototype.i;C.prototype.l=function(a){if(!(0<+a))throw new B(C.prototype.l,0,a);this.o=+a;db(this);return this};C.prototype.setMaxSize=C.prototype.l;C.prototype.C=function(){return this.o};C.prototype.getMaxSize=C.prototype.C;C.prototype.B=function(){return this.b};C.prototype.getCurrentSize=C.prototype.B;function $a(a,b){b&&(a.c=cb(a,b,a.c));return b}\nfunction db(a){for(;a.b>a.o&&a.f;)bb(a,a.f,!0)}function cb(a,b,c){if(c!==b){(b.F||b.J)&&bb(a,b);if(b.F=c)b.J=c.J,c.J=b;b.J||(a.c=b);b.F||(a.f=b);a.b+=b.size}return b}function bb(a,b,c){var d=b.J,e=b.F;if(d||e||b==a.c&&b==a.f)d?d.F=e:a.c=e,e?e.J=d:a.f=d,a.b-=b.size,c&&(a.v&&a.v(b.id,b.data,b.size),delete a.a[b.id]);b.F=b.J=null};function E(){}u(\"H.service.extension.dataView.ITable\",E);E.prototype.getMeta=E.prototype.Aa;E.prototype.getRowCount=E.prototype.i;E.prototype.getRow=E.prototype.c;E.prototype.getColumnNames=E.prototype.f;E.prototype.getColumn=E.prototype.g;E.prototype.getCell=E.prototype.b;E.prototype.concat=E.prototype.a;function eb(){}u(\"H.service.extension.dataView.IRow\",eb);eb.prototype.getColumnNames=eb.prototype.f;eb.prototype.getCell=eb.prototype.c;eb.prototype.getTable=eb.prototype.b;function fb(a,b){this.a=a;this.g=b}u(\"H.service.extension.dataView.ObjRow\",fb);fb.prototype.f=function(){return this.a.f()};fb.prototype.getColumnNames=fb.prototype.f;fb.prototype.c=function(a){return this.a.b(this.g,a)};fb.prototype.getCell=fb.prototype.c;fb.prototype.b=function(){return this.a};fb.prototype.getTable=fb.prototype.b;function gb(){}u(\"H.service.extension.dataView.IColumn\",gb);gb.prototype.getCell=gb.prototype.a;function hb(a,b){this.c=a;this.b=b}u(\"H.service.extension.dataView.ObjColumn\",hb);hb.prototype.a=function(a){return this.c.b(a,this.b)};hb.prototype.getCell=hb.prototype.a;function B(a,b,c){var d=arguments.length,e;b=1<d?+b:b;d=2<d?Fa(c):\"\";b!==z&&(e=(e=/^.*?\\(([^\\)]+)/.exec((\"\"+a).replace(/(\\/\\*([\\s\\S]*?)\\*\\/)|(\\/\\/(.*)$)/gm,\"\")))?Ka(e[1].replace(/\\s+/g,\"\")):[],e.forEach(Za),e=e[b]||\"#\"+b);this.message=(a?Ta(a):\"\")+(e||d?\" (\":\"\")+(e?\"Argument \"+e:\"\")+(d?(e?\" \":\"\")+d:\"\")+(e||d?\")\":\"\");this.stack=Error().stack}u(\"H.lang.InvalidArgumentError\",B);B.prototype=Error();B.prototype.name=\"InvalidArgumentError\";function F(a,b,c){var d;b=b||(a&&a.length?Object.keys(a[0]):z);this.K=a;if(b)for(this.R=b,this.qa=a=Object.create(Ja,void 0),d=b.length;d--;)a[b[d]]=!0;c!==z&&(this.ta=c)}u(\"H.service.extension.dataView.ObjTable\",F);m=F.prototype;m.ta=z;m.K=z;m.R=z;m.qa=z;m.Aa=function(){return this.ta};F.prototype.getMeta=F.prototype.Aa;F.prototype.i=function(){return this.K?this.K.length:0};F.prototype.getRowCount=F.prototype.i;F.prototype.c=function(a){var b=this.K;return b&&b[a]?new fb(this,a):z};\nF.prototype.getRow=F.prototype.c;F.prototype.f=function(){return this.R||ib};F.prototype.getColumnNames=F.prototype.f;F.prototype.g=function(a){return this.qa[a]?new hb(this,a):z};F.prototype.getColumn=F.prototype.g;F.prototype.b=function(a,b){var c=this.K;return(c=c&&this.qa[b]&&c[a])&&c[b]};F.prototype.getCell=F.prototype.b;\nF.prototype.a=function(){var a=arguments.length,b,c=this.R,d=\"\"+this.R,e=(this.K||[]).slice(),f;for(b=0;b<a;b++){f=arguments[b];if(!(f instanceof F))throw new B(this.a,b);if(f.K){if(c&&\"\"+f.R!==d)throw new B(this.a,b,\"Incompatible columns!\");e=e.concat(f.K)}}return new F(e,this.R,this.ta)};F.prototype.concat=F.prototype.a;function J(a,b){this.x=+a;this.y=+b}u(\"H.math.Point\",J);J.prototype.set=J;J.prototype.set=J.prototype.set;J.prototype.clone=function(a){a?(a.x=this.x,a.y=this.y):a=new J(this.x,this.y);return a};J.prototype.clone=J.prototype.clone;J.prototype.add=function(a){this.x+=a.x;this.y+=a.y;return this};J.prototype.add=J.prototype.add;J.prototype.f=function(a){this.x-=a.x;this.y-=a.y;return this};J.prototype.sub=J.prototype.f;J.prototype.c=function(a,b){this.x*=a;this.y*=void 0===b?a:b;return this};\nJ.prototype.scale=J.prototype.c;J.prototype.round=function(){this.x=jb(this.x);this.y=jb(this.y);return this};J.prototype.round=J.prototype.round;J.prototype.floor=function(){this.x=kb(this.x);this.y=kb(this.y);return this};J.prototype.floor=J.prototype.floor;J.prototype.ceil=function(){this.x=lb(this.x);this.y=lb(this.y);return this};J.prototype.ceil=J.prototype.ceil;J.prototype.Ca=function(a){return!(!a||this.x!==a.x||this.y!==a.y)};J.prototype.equals=J.prototype.Ca;\nJ.prototype.a=function(a,b){var c=b.x-a.x,d=b.y-a.y,e,f=a;if(c||d)e=((this.x-a.x)*c+(this.y-a.y)*d)/(c*c+d*d),0>=e?f=a:1<=e?f=b:f=new J(a.x+e*c,a.y+e*d);return f};J.prototype.getNearest=J.prototype.a;J.prototype.b=function(a){return mb(nb(this.x-a.x,2)+nb(this.y-a.y,2))};J.prototype.distance=J.prototype.b;function ob(a){if(!a)throw new B(ob,0,a);return Na(a,J)?a:new J(a.x,a.y)}J.fromIPoint=ob;function pb(a,b,c,d,e,f){var g,h,k=a.length,l,n,p,w,G,D,I;if(k)for(g=[];k--;)for(D=a[k],w=D.length,G=0,l=1;l<w;l++){if(I=qb(D[l-1],D[l],c,b,d,e))n=I[0],p=I[1],G&&G.Ca(n)?h.push(p):g.push(h=I),G=p,f&&(l=w,k=0)}else g=a;return g}\nfunction qb(a,b,c,d,e,f){var g=a.x;a=-a.y;var h=b.x;b=-b.y;var k,l,n;c=-c;f=-f;if(g>h){if(h>e||g<d)return;l=g;n=a;g=h;a=b;h=l;b=n;l=1}else if(g>e||h<d)return;if(a>b){if(b>c||a<f)return;k=1;a=-a;b=-b;n=f;f=-c;c=-n}else if(a>c||b<f)return;if(g<d){if((a+=(d-g)*(b-a)/(h-g))>c)return;g=d}if(a<f){if((g+=(f-a)*(h-g)/(b-a))>e)return;a=f}h>e&&(b=a+(e-g)*(b-a)/(h-g),h=e);b>c&&(h=g+(c-a)*(h-g)/(b-a),b=c);k&&(a=-a,b=-b);return l?[new J(h,-b),new J(g,-a)]:[new J(g,-a),new J(h,-b)]}\nfunction rb(a,b,c,d,e,f,g,h,k,l){a={x:a,y:b,next:c||null,D:d||null,Da:e||null,ua:f||null,I:g||0,ra:h||0,na:k||0,alpha:l||0};d&&(a.D.next=a);c&&(a.next.D=a);return a}function sb(a){for(;a&&a.I;)a=a.next;return a}function tb(a){if(a)for(;a.next;)a=a.next;return a}function ub(a){var b=a;if(b){do b=b.next;while(b!=a&&(!b.I||b.I&&b.na))}return b}function vb(a){var b=tb(a);b.D.next=a;a.D=b.D}\nfunction wb(a,b,c,d,e,f){var g,h,k,l=b.x-a.x,n=b.y-a.y;g=d.x-c.x;var p=d.y-c.y;h=l*p-n*g;if(!h)return 0;g=((c.x-a.x)*p-(c.y-a.y)*g)/h;h=(n*(c.x-a.x)-l*(c.y-a.y))/h;if(0>g||1<g||0>h||1<h)return 0;0===g?k=a:1===g?k=b:0===h?k=c:1===h&&(k=d);if(k&&!f)return k.x+=2.480549651603763E-5,k.y+=7.321997314118067E-5,k.ia&&(k.ia.x=k.x,k.ia.y=k.y),wb(a,b,c,d,e);e.Za=a.x+g*l;e.$a=a.y+g*n;e.Ja=g;e.xa=h;return 1}\nfunction xb(a,b,c){var d,e=0,f={},g,h,k,l,n,p;c=c||a.y;d=rb(-137438953472,c);Array.isArray(b)?(k=0,g=b[k],l=function(){return b[++k]}):(n=g=b,l=function(){return n=n.next});for(;p=l();){h=wb(d,a,g,p,f,!0);g=f.xa;if(0===g||1===g)return xb(a,b,c+6E-5);h&&e++;g=p}return e%2}function yb(a,b,c){for(b=b.next;b!==c&&b.alpha<=a.alpha;)b=b.next;a.next=b;a.D=b.D;a.next.D=a;a.D.next=a}function zb(a){for(var b,c=null,d=0,e=a.length;d<e;d++){b=rb(a[d].x,a[d].y,c);if(b.next=c)c.D=b;c=b}return c};function Ab(a,b){var c=[];a&&c.push(Ta(a));1<arguments.length&&c.push(b);this.message=c.join(\" \");this.stack=Error().stack}ua(Ab,Error);u(\"H.lang.IllegalOperationError\",Ab);Ab.prototype=Error();Ab.prototype.name=\"IllegalOperationError\";function Bb(a){if(!ha(a))throw new B(this.constructor,0);this.i=y.indexedDB||y.webkitIndexedDB||y.mozIndexedDB||y.msIndexedDB;if(!this.i)throw new Ab(this.constructor,\"This browser does not support IndexedDB\");this.o=a;this.a=[];this.c=[];this.g=Ea(this.g,this)}var Cb,Db;u(\"H.util.IndexedDBStorage\",Bb);\nBb.prototype.get=function(a,b,c){var d;if(!Eb(a))throw new B(this.get,0);if(!r(b))throw new B(this.get,1);Fb(this,function(e){d=e.get(a);Gb(d,b,c)},c);return{cancel:function(){d&&(d.onsuccess=Hb)}}};Bb.prototype.remove=function(a,b,c){if(!Eb(a))throw new B(this.remove,0);Fb(this,function(d){Gb(d[\"delete\"](a),b,c)},c)};Bb.prototype.l=y.IDBTransaction&&y.IDBTransaction.READ_WRITE||\"readwrite\";Bb.prototype.g=function(){var a=this.b.result;a.objectStoreNames.contains(\"data\")||a.createObjectStore(\"data\")};\nfunction Ib(a,b,c){var d;a.b?a.a?(a.a.push(b),c&&a.c.push(c)):a.f?c&&c(a.f):b(a.b.result):(a.b=a.i.open(Jb+a.o,1),a.b.onupgradeneeded=a.g,d=a.b.onerror=function(){clearTimeout(a.j);a.f=this.error;a.c.forEach(function(b){b(a.f)});a.a=a.c=null},a.j=setTimeout(function(){d.call({error:Error(\"DbOpenTimeoutError\")})},500),a.b.onsuccess=function(){clearTimeout(a.j);a.a?(a.a.forEach(function(a){a(this.result)},this),a.a=a.c=null):(a.b=a.f=null,a.a=[],a.c=[])},a.a.push(b),c&&a.c.push(c))}\nfunction Fb(a,b,c){Ib(a,function(c){c=c.transaction([\"data\"],a.l);b(c.objectStore(\"data\"))},c)}function Gb(a,b,c){b&&(a.onsuccess=function(){b(this.result)});c&&(a.onerror=function(){c(this.error)})}function Eb(a){return ha(a)||Sa(a)}Bb.getInstance=function(){Cb||(Cb=new Bb(\"STATIC_DB\"));return Cb};var Jb=\"H_\";\nBb.isSupported=function(){var a,b,c;if(Db===z)if(\"file:\"===window.location.protocol&&-1<navigator.userAgent.toLowerCase().indexOf(\"firefox\")&&128<=window.location.href.length)Db=!1;else{a=y.indexedDB||y.webkitIndexedDB||y.mozIndexedDB||y.msIndexedDB;c=Jb+\"TEST_DB\";try{b=a&&a.open(c,1)}catch(d){}Db=!!b&&null===b.onupgradeneeded;b&&a.deleteDatabase&&a.deleteDatabase(c)}return Db};function L(){0!=Kb&&(Lb[this[ka]||(this[ka]=++la)]=this);this.g=this.g;this.c=this.c}var Kb=0,Lb={};L.prototype.g=!1;L.prototype.S=function(){if(!this.g&&(this.g=!0,this.ja(),0!=Kb)){var a=this[ka]||(this[ka]=++la);delete Lb[a]}};L.prototype.f=function(a,b){this.g?a.call(b):(this.c||(this.c=[]),this.c.push(void 0!==b?sa(a,b):a))};L.prototype.ja=function(){if(this.c)for(;this.c.length;)this.c.shift()()};function N(a,b){this.type=a;this.currentTarget=this.target=b;this.a=!1;this.Ea=!0}N.prototype.c=function(){this.a=!0};N.prototype.f=function(){this.Ea=!1};u(\"H.util.Event\",N);N.prototype.c=N.prototype.c;N.prototype.stopPropagation=N.prototype.c;N.prototype.j=1;N.prototype.CAPTURING_PHASE=N.prototype.j;N.prototype.g=2;N.prototype.AT_TARGET=N.prototype.g;N.prototype.i=3;N.prototype.BUBBLING_PHASE=N.prototype.i;N.prototype.l=0;N.prototype.eventPhase=N.prototype.l;function Mb(a,b,c){Mb.W.constructor.call(this,a,c);this.data=b}ua(Mb,N);u(\"H.util.DataEvent\",Mb);function Nb(a,b,c){Nb.W.constructor.call(this,a,c);this.message=b}ua(Nb,N);u(\"H.util.ErrorEvent\",Nb);var P=Math,Ob=P.min,Pb=P.max,jb=P.round,kb=P.floor,lb=P.ceil,Qb=P.abs,Rb=P.log,mb=P.sqrt,nb=P.pow,Sb=P.exp,Tb=P.sin,Ub=P.asin,Vb=P.cos,Wb=P.tan,Xb=P.atan,Yb=P.atan2,Zb=P.LN2,Q=P.PI,$b=Q/2,ac=Q/4,bc=2*Q,cc=3*Q,dc=Q/180,ec=180/Q,fc=1/0;nb(-2,53);function gc(a,b){var c;return 0>(c=a%b)===0>b?c:c+b}u(\"H.math.normalize\",function(a,b,c){b-=c=c||0;a-=c;return a-kb(a/b)*b+c});function kc(a,b,c){return(a-=0)>c?c:a<b?b:a}u(\"H.math.clamp\",kc);\nfunction lc(a,b,c){var d=0;(d-=0)||(d=0);return b<c?a>=b-d&&a<=c+d:a>=c-d&&a<=b+d}function mc(a,b,c,d,e,f){return mb(nb((a-e)*(d-f)-(b-f)*(c-e),2)/(nb(c-e,2)+nb(d-f,2)))}\nfunction nc(a,b,c){for(var d=c.length,e=d,f,g,h,k,l=c[0],n=0,p=0,w=0;1!=n&&1<e;){g=c[--e];f=c[--e];k=c[e?e-1:(d+(e-1))%d];h=c[e?e-2:(d+(e-2))%d];if(f>=a-0&&f<=a+0&&g>=b-0&&g<=b+0||h>=a-0&&h<=a+0&&k>=b-0&&k<=b+0)n=1;else if(!n&&f===a)h===a&&(g<b&&k>b||g>b&&k<b)||(l<=a&&h>a||l>=a&&h<a)&&(g>=b?++p:++w),n=lc(b,g,k)&&0>=mc(a,b,f,g,h,k)?2:0;else if(!n&&lc(a,f,h)){if(f<a&&h>a||f>a&&h<a)l=g+(a-f)/(h-f)*(k-g),p+=l>b,w+=l<b;n=lc(b,g,k)&&0>=mc(a,b,f,g,h,k)?2:0}l=f}!n&&0!==w&&0!==p%2&&(n=3);return n};function oc(a,b,c){this.f=c;this.c=a;this.g=b;this.b=0;this.a=null}oc.prototype.get=function(){var a;0<this.b?(this.b--,a=this.a,this.a=a.next,a.next=null):a=this.c();return a};function pc(a,b){a.g(b);a.b<a.f&&(a.b++,b.next=a.a,a.a=b)};function qc(){this.b=this.a=null}var sc=new oc(function(){return new rc},function(a){a.reset()},100);qc.prototype.add=function(a,b){var c=sc.get();c.set(a,b);this.b?this.b.next=c:this.a=c;this.b=c};qc.prototype.remove=function(){var a=null;this.a&&(a=this.a,this.a=this.a.next,this.a||(this.b=null),a.next=null);return a};function rc(){this.next=this.b=this.a=null}rc.prototype.set=function(a,b){this.a=a;this.b=b;this.next=null};rc.prototype.reset=function(){this.next=this.b=this.a=null};var R;a:{var tc=q.navigator;if(tc){var uc=tc.userAgent;if(uc){R=uc;break a}}R=\"\"};function vc(){return-1!=R.indexOf(\"Edge\")||-1!=R.indexOf(\"Trident\")||-1!=R.indexOf(\"MSIE\")};function wc(){return-1!=R.indexOf(\"Edge\")};function xc(a){q.setTimeout(function(){throw a;},0)}var yc;\nfunction zc(){var a=q.MessageChannel;\"undefined\"===typeof a&&\"undefined\"!==typeof window&&window.postMessage&&window.addEventListener&&-1==R.indexOf(\"Presto\")&&(a=function(){var a=document.createElement(\"IFRAME\");a.style.display=\"none\";a.src=\"\";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write(\"\");a.close();var c=\"callImmediate\"+Math.random(),d=\"file:\"==b.location.protocol?\"*\":b.location.protocol+\"//\"+b.location.host,a=sa(function(a){if((\"*\"==d||a.origin==\nd)&&a.data==c)this.port1.onmessage()},this);b.addEventListener(\"message\",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if(\"undefined\"!==typeof a&&!vc()){var b=new a,c={},d=c;b.port1.onmessage=function(){if(void 0!==c.next){c=c.next;var a=c.ya;c.ya=null;a()}};return function(a){d.next={ya:a};d=d.next;b.port2.postMessage(0)}}return\"undefined\"!==typeof document&&\"onreadystatechange\"in document.createElement(\"SCRIPT\")?function(a){var b=document.createElement(\"SCRIPT\");\nb.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){q.setTimeout(a,0)}};function Ac(a,b){Bc||Cc();Dc||(Bc(),Dc=!0);Ec.add(a,b)}var Bc;function Cc(){if(q.Promise&&q.Promise.resolve){var a=q.Promise.resolve();Bc=function(){a.then(Fc)}}else Bc=function(){var a=Fc;!r(q.setImmediate)||q.Window&&q.Window.prototype&&q.Window.prototype.setImmediate==q.setImmediate?(yc||(yc=zc()),yc(a)):q.setImmediate(a)}}var Dc=!1,Ec=new qc;function Fc(){for(var a=null;a=Ec.remove();){try{a.a.call(a.b)}catch(b){xc(b)}pc(sc,a)}Dc=!1};function Gc(a,b){this.a=Hc;this.j=void 0;this.f=this.b=this.c=null;this.g=this.i=!1;if(a==Ic)Jc(this,Kc,b);else try{var c=this;a.call(b,function(a){Jc(c,Kc,a)},function(a){Jc(c,Lc,a)})}catch(d){Jc(this,Lc,d)}}var Hc=0,Kc=2,Lc=3;function Mc(){this.next=this.c=this.b=this.f=this.a=null;this.g=!1}Mc.prototype.reset=function(){this.c=this.b=this.f=this.a=null;this.g=!1};var Nc=new oc(function(){return new Mc},function(a){a.reset()},100);function Oc(a,b,c){var d=Nc.get();d.f=a;d.b=b;d.c=c;return d}\nfunction Ic(){}function Pc(a){return new Gc(function(b,c){var d=a.length,e=[];if(d)for(var f=function(a,c){d--;e[a]=c;0==d&&b(e)},g=function(a){c(a)},h=0,k;k=a[h];h++)Qc(k,ta(f,h),g);else b(e)})}function Rc(){var a,b,c=new Gc(function(c,e){a=c;b=e});return new Sc(c,a,b)}Gc.prototype.then=function(a,b,c){return Tc(this,r(a)?a:null,r(b)?b:null,c)};Gc.prototype.then=Gc.prototype.then;Gc.prototype.$goog_Thenable=!0;function Qc(a,b,c,d){a instanceof Gc?Uc(a,Oc(b||ea,c||null,d)):a.then(b,c,d)}\nGc.prototype.cancel=function(a){this.a==Hc&&Ac(function(){var b=new Vc(a);Wc(this,b)},this)};function Wc(a,b){if(a.a==Hc)if(a.c){var c=a.c;if(c.b){for(var d=0,e=null,f=null,g=c.b;g&&(g.g||(d++,g.a==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(c.a==Hc&&1==d?Wc(c,b):(f?(d=f,d.next==c.f&&(c.f=d),d.next=d.next.next):Xc(c),Yc(c,e,Lc,b)))}a.c=null}else Jc(a,Lc,b)}function Uc(a,b){a.b||a.a!=Kc&&a.a!=Lc||Zc(a);a.f?a.f.next=b:a.b=b;a.f=b}\nfunction Tc(a,b,c,d){var e=Oc(null,null,null);e.a=new Gc(function(a,g){e.f=b?function(c){try{var e=b.call(d,c);a(e)}catch(l){g(l)}}:a;e.b=c?function(b){try{var e=c.call(d,b);void 0===e&&b instanceof Vc?g(b):a(e)}catch(l){g(l)}}:g});e.a.c=a;Uc(a,e);return e.a}Gc.prototype.l=function(a){this.a=Hc;Jc(this,Kc,a)};Gc.prototype.o=function(a){this.a=Hc;Jc(this,Lc,a)};\nfunction Jc(a,b,c){if(a.a==Hc){if(a==c)b=Lc,c=new TypeError(\"Promise cannot resolve to itself\");else{var d;if(c)try{d=!!c.$goog_Thenable}catch(e){d=!1}else d=!1;if(d){a.a=1;Qc(c,a.l,a.o,a);return}if(ia(c))try{var f=c.then;if(r(f)){$c(a,c,f);return}}catch(g){b=Lc,c=g}}a.j=c;a.a=b;a.c=null;Zc(a);b!=Lc||c instanceof Vc||ad(a,c)}}function $c(a,b,c){function d(b){f||(f=!0,a.o(b))}function e(b){f||(f=!0,a.l(b))}a.a=1;var f=!1;try{c.call(b,e,d)}catch(g){d(g)}}function Zc(a){a.i||(a.i=!0,Ac(a.v,a))}\nfunction Xc(a){var b=null;a.b&&(b=a.b,a.b=b.next,b.next=null);a.b||(a.f=null);return b}Gc.prototype.v=function(){for(var a=null;a=Xc(this);)Yc(this,a,this.a,this.j);this.i=!1};function Yc(a,b,c,d){if(c==Lc&&b.b&&!b.g)for(;a&&a.g;a=a.c)a.g=!1;if(b.a)b.a.c=null,bd(b,c,d);else try{b.g?b.f.call(b.c):bd(b,c,d)}catch(e){cd.call(null,e)}pc(Nc,b)}function bd(a,b,c){b==Kc?a.f.call(a.c,c):a.b&&a.b.call(a.c,c)}function ad(a,b){a.g=!0;Ac(function(){a.g&&cd.call(null,b)})}var cd=xc;\nfunction Vc(a){xa.call(this,a)}ua(Vc,xa);Vc.prototype.name=\"cancel\";function Sc(a,b,c){this.la=a;this.resolve=b;this.reject=c};function dd(a,b,c){this.type=a;this.data=b;this.G=Rc();this.resolve=Ea(this.resolve,this);this.reject=Ea(this.reject,this);this.a=ed;c!==z&&(this.a=c);this.Pa().add(this)}var ed=1,fd={bb:0,NORMAL:ed,ab:2};dd.prototype.then=function(a,b,c){return this.G.la.then(a,b,c)};\nwa(dd.prototype,{resolve:function(a){this.state=3;this.G.resolve(a)},reject:function(a){this.state=5;this.G.reject(a)},state:0,cancel:function(){this.G.la.cancel();3>this.state&&(this.Ka(),this.Pa().remove(this),this.state=4)},Ka:fa,Na:fa,Ma:function(a){this.state=this.Na(a)?1:5}});function gd(a){this.O={};for(var b in fd)this.O[fd[b]]=[];this.ma=a;this.ma.addEventListener(\"allocatable\",Ea(this.za,this))}u(\"H.util.JobManager\",gd);var hd=Object.keys(fd).map(function(a){return fd[a]}).sort().reverse();\nwa(gd.prototype,{add:function(a){Na(a,dd,this.add,0);this.O[a.a].push(a);this.za()},contains:function(a){return-1<this.O[a.a].indexOf(a)},remove:function(a){var b=a.a;a=this.O[b].indexOf(a);return-1<a?(this.O[b].splice(a,1),!0):!1},za:function(){hd.forEach(function(a){this.O[a]=this.O[a].filter(function(a){var c,d;if((c=this.ma.cb(a))!==Ja)d=Ea(this.ma.fb,this.ma,c,a),a.then(d,d),a.Ma(c);else return!0},this)},this)}});function id(a,b,c){var d=[];1<arguments.length&&d.push(b);2<arguments.length&&d.push(\"out of [\"+c[0]+\"...\"+c[1]+\"]\");this.message=(a?Ta(a):\"\")+(d.length?\" (\"+d.join(\" \")+\")\":\"\");this.stack=Error().stack}u(\"H.lang.OutOfRangeError\",id);id.prototype=Error();id.prototype.name=\"OutOfRangeError\";var jd=\"closure_listenable_\"+(1E6*Math.random()|0),kd=0;function ld(a,b,c,d,e){this.listener=a;this.a=null;this.src=b;this.type=c;this.ga=!!d;this.ka=e;++kd;this.V=this.fa=!1}function md(a){a.V=!0;a.listener=null;a.a=null;a.src=null;a.ka=null};function nd(a){this.src=a;this.a={};this.b=0}nd.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.a[f];a||(a=this.a[f]=[],this.b++);var g=od(a,b,d,e);-1<g?(b=a[g],c||(b.fa=!1)):(b=new ld(b,this.src,f,!!d,e),b.fa=c,a.push(b));return b};nd.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.a))return!1;var e=this.a[a];b=od(e,b,c,d);return-1<b?(md(e[b]),Ca.splice.call(e,b,1),0==e.length&&(delete this.a[a],this.b--),!0):!1};\nfunction pd(a,b){var c=b.type;if(c in a.a){var d=a.a[c],e=Da(d,b),f;(f=0<=e)&&Ca.splice.call(d,e,1);f&&(md(b),0==a.a[c].length&&(delete a.a[c],a.b--))}}function od(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.V&&f.listener==b&&f.ga==!!c&&f.ka==d)return e}return-1};var qd=-1!=R.indexOf(\"Opera\")||-1!=R.indexOf(\"OPR\"),rd=vc(),sd=-1!=R.indexOf(\"Gecko\")&&!(-1!=R.toLowerCase().indexOf(\"webkit\")&&!wc())&&!(-1!=R.indexOf(\"Trident\")||-1!=R.indexOf(\"MSIE\"))&&!wc(),td=-1!=R.toLowerCase().indexOf(\"webkit\")&&!wc();function ud(){var a=R;if(sd)return/rv\\:([^\\);]+)(\\)|;)/.exec(a);if(rd&&wc())return/Edge\\/([\\d\\.]+)/.exec(a);if(rd)return/\\b(?:MSIE|rv)[: ]([^\\);]+)(\\)|;)/.exec(a);if(td)return/WebKit\\/(\\S+)/.exec(a)}\nfunction vd(){var a=q.document;return a?a.documentMode:void 0}var wd=function(){if(qd&&q.opera){var a=q.opera.version;return r(a)?a():a}var a=\"\",b=ud();b&&(a=b?b[1]:\"\");return rd&&!wc()&&(b=vd(),b>parseFloat(a))?String(b):a}(),xd={};\nfunction yd(a){var b;if(!(b=xd[a])){b=0;for(var c=Aa(String(wd)).split(\".\"),d=Aa(String(a)).split(\".\"),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var g=c[f]||\"\",h=d[f]||\"\",k=/(\\d*)(\\D*)/g,l=/(\\d*)(\\D*)/g;do{var n=k.exec(g)||[\"\",\"\",\"\"],p=l.exec(h)||[\"\",\"\",\"\"];if(0==n[0].length&&0==p[0].length)break;b=Ba(0==n[1].length?0:parseInt(n[1],10),0==p[1].length?0:parseInt(p[1],10))||Ba(0==n[2].length,0==p[2].length)||Ba(n[2],p[2])}while(0==b)}b=xd[a]=0<=b}return b}\nvar zd=q.document,Ad=vd(),Bd=!zd||!rd||!Ad&&wc()?void 0:Ad||(\"CSS1Compat\"==zd.compatMode?parseInt(wd,10):5);var Cd;(Cd=!rd)||(Cd=rd&&(wc()||9<=Bd));var Dd=Cd,Ed=rd&&!yd(\"9\");!td||yd(\"528\");sd&&yd(\"1.9b\")||rd&&yd(\"8\")||qd&&yd(\"9.5\")||td&&yd(\"528\");sd&&!yd(\"8\")||rd&&yd(\"9\");function Fd(a){Fd[\" \"](a);return a}Fd[\" \"]=ea;function Gd(a,b){N.call(this,a?a.type:\"\");this.b=this.state=this.currentTarget=this.target=null;if(a){this.type=a.type;this.target=a.target||a.srcElement;this.currentTarget=b;var c=a.relatedTarget;if(c&&sd)try{Fd(c.nodeName)}catch(d){}this.state=a.state;this.b=a;a.defaultPrevented&&this.f()}}ua(Gd,N);Gd.prototype.c=function(){Gd.W.c.call(this);this.b.stopPropagation?this.b.stopPropagation():this.b.cancelBubble=!0};\nGd.prototype.f=function(){Gd.W.f.call(this);var a=this.b;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Ed)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var Hd=\"closure_lm_\"+(1E6*Math.random()|0),Id={},Jd=0;function Kd(a,b,c,d,e){if(\"array\"==ga(b))for(var f=0;f<b.length;f++)Kd(a,b[f],c,d,e);else if(c=Ld(c),a&&a[jd])a.M.add(String(b),c,!1,d,e);else{if(!b)throw Error(\"Invalid event type\");var f=!!d,g=Md(a);g||(a[Hd]=g=new nd(a));c=g.add(b,c,!1,d,e);c.a||(d=Nd(),c.a=d,d.src=a,d.listener=c,a.addEventListener?a.addEventListener(b.toString(),d,f):a.attachEvent(Od(b.toString()),d),Jd++)}}\nfunction Nd(){var a=Pd,b=Dd?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b}function Qd(a,b,c,d,e){if(\"array\"==ga(b))for(var f=0;f<b.length;f++)Qd(a,b[f],c,d,e);else(c=Ld(c),a&&a[jd])?a.M.remove(String(b),c,d,e):a&&(a=Md(a))&&(b=a.a[b.toString()],a=-1,b&&(a=od(b,c,!!d,e)),(c=-1<a?b[a]:null)&&Rd(c))}\nfunction Rd(a){if(\"number\"!=typeof a&&a&&!a.V){var b=a.src;if(b&&b[jd])pd(b.M,a);else{var c=a.type,d=a.a;b.removeEventListener?b.removeEventListener(c,d,a.ga):b.detachEvent&&b.detachEvent(Od(c),d);Jd--;(c=Md(b))?(pd(c,a),0==c.b&&(c.src=null,b[Hd]=null)):md(a)}}}function Od(a){return a in Id?Id[a]:Id[a]=\"on\"+a}function Sd(a,b,c,d){var e=!0;if(a=Md(a))if(b=a.a[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.ga==c&&!f.V&&(f=Td(f,d),e=e&&!1!==f)}return e}\nfunction Td(a,b){var c=a.listener,d=a.ka||a.src;a.fa&&Rd(a);return c.call(d,b)}\nfunction Pd(a,b){if(a.V)return!0;if(!Dd){var c;if(!(c=b))a:{c=[\"window\",\"event\"];for(var d=q,e;e=c.shift();)if(null!=d[e])d=d[e];else{c=null;break a}c=d}e=c;c=new Gd(e,this);d=!0;if(!(0>e.keyCode||void 0!=e.returnValue)){a:{var f=!1;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(g){f=!0}if(f||void 0==e.returnValue)e.returnValue=!0}e=[];for(f=c.currentTarget;f;f=f.parentNode)e.push(f);for(var f=a.type,h=e.length-1;!c.a&&0<=h;h--){c.currentTarget=e[h];var k=Sd(e[h],f,!0,c),d=d&&k}for(h=0;!c.a&&h<e.length;h++)c.currentTarget=\ne[h],k=Sd(e[h],f,!1,c),d=d&&k}return d}return Td(a,new Gd(b,this))}function Md(a){a=a[Hd];return a instanceof nd?a:null}var Ud=\"__closure_events_fn_\"+(1E9*Math.random()>>>0);function Ld(a){if(r(a))return a;a[Ud]||(a[Ud]=function(b){return a.handleEvent(b)});return a[Ud]};function S(){L.call(this);this.M=new nd(this);this.j=this;this.i=null}ua(S,L);S.prototype[jd]=!0;m=S.prototype;m.N=function(){return this.i};m.sa=function(a){this.i=a};m.addEventListener=function(a,b,c,d){Kd(this,a,b,c,d)};m.removeEventListener=function(a,b,c,d){Qd(this,a,b,c,d)};\nm.X=function(a){var b,c=this.N();if(c)for(b=[];c;c=c.N())b.push(c);var c=this.j,d=a.type||a;if(ha(a))a=new N(a,c);else if(a instanceof N)a.target=a.target||c;else{var e=a;a=new N(d,c);wa(a,e)}var e=!0,f;if(b)for(var g=b.length-1;!a.a&&0<=g;g--)f=a.currentTarget=b[g],e=f.T(d,!0,a)&&e;a.a||(f=a.currentTarget=c,e=f.T(d,!0,a)&&e,a.a||(e=f.T(d,!1,a)&&e));if(b)for(g=0;!a.a&&g<b.length;g++)f=a.currentTarget=b[g],e=f.T(d,!1,a)&&e;return e};\nm.ja=function(){S.W.ja.call(this);if(this.M){var a=this.M,b=0,c;for(c in a.a){for(var d=a.a[c],e=0;e<d.length;e++)++b,md(d[e]);delete a.a[c];a.b--}}this.i=null};m.T=function(a,b,c){a=this.M.a[String(a)];if(!a)return!0;a=a.concat();for(var d=!0,e=0;e<a.length;++e){var f=a[e];if(f&&!f.V&&f.ga==b){var g=f.listener,h=f.ka||f.src;f.fa&&pd(this.M,f);d=!1!==g.call(h,c)&&d}}return d&&0!=c.Ea};u(\"H.util.EventTarget\",S);S.prototype.sa=S.prototype.sa;S.prototype.setParentEventTarget=S.prototype.sa;S.prototype.N=S.prototype.N;S.prototype.getParentEventTarget=S.prototype.N;S.prototype.addEventListener=S.prototype.addEventListener;S.prototype.addEventListener=S.prototype.addEventListener;S.prototype.removeEventListener=S.prototype.removeEventListener;S.prototype.removeEventListener=S.prototype.removeEventListener;S.prototype.X=S.prototype.X;S.prototype.dispatchEvent=S.prototype.X;\nS.prototype.S=S.prototype.S;S.prototype.dispose=S.prototype.S;S.prototype.f=S.prototype.f;S.prototype.addOnDisposeCallback=S.prototype.f;S.prototype.l=S.prototype.T;S.prototype.T=function(a,b,c){var d,e,f,g=!0;d=c[c.currentTarget===c.target?\"AT_TARGET\":b?\"CAPTURING_PHASE\":(e=!0,\"BUBBLING_PHASE\")];if(!e||\"pointerenter\"!==(f=c.type)&&\"pointerleave\"!==f)c.eventPhase=d,g=S.prototype.l.apply(this,arguments),e&&this.N&&null===this.N()&&delete c.eventPhase;return g};function T(a){a=a||{};var b=a.callback;this.b=a.label;r(b)&&(this.callback=b);this.a=!!a.disabled;T.W.constructor.call(this)}ua(T,S);u(\"H.util.ContextItem\",T);T.prototype.o=function(){return this.b};T.prototype.getLabel=T.prototype.o;T.prototype.C=function(a){this.b!==a&&(this.b=a,this.X(\"update\"));return this};T.prototype.setLabel=T.prototype.C;T.prototype.v=function(){return this.a};T.prototype.isDisabled=T.prototype.v;T.prototype.B=function(a){a^this.a&&(this.a=a,this.X(\"update\"));return this};\nT.prototype.setDisabled=T.prototype.B;var Vd=new T;T.SEPARATOR=Vd;function Wd(){if(y.document){var a=document.createElement(\"canvas\");a.width=a.height=1;a.getContext(\"2d\")}}u(\"H.util.eval\",function(a){return eval(a)});u(\"H.util.provide\",function(a){aa(a,void 0)});function Xd(){this.F=0}Xd.prototype.next=function(a){if(4294967295===this.F)throw new id(a,this.F,[0,4294967295]);return this.F++};var Yd=new Xd;Ea(Yd.next,Yd);function Hb(){}var ib=Ha([]);Wd();Wd();var ae={undefined:\"GL\",GL:\"GL\",OL:\"OL\",SL:\"SL\",SB:\"SB\",WE:\"WE\",WG:\"WG\"};u(\"H.geo.AltitudeContext\",ae);function be(a,b,c){var d=kc(+a,-90,90);if(b&&Ra(d))throw new B(b,c,a);return d}function de(a,b,c){var d=+a;if(-180>d||180<d)d=gc(d+180,360)-180;if(b&&Ra(d))throw new B(b,c,a);return d}function ee(a,b,c){var d;if(a!==z&&Ra(d=+a)&&b)throw new B(b,c,a);return d}function fe(a,b,c){var d=!ae[a];if(b&&d)throw new B(b,c,a);return!d}u(\"H.geo.isDBC\",function(a,b){return 0!==(0>a^0>b)&&180<Qb(b-a)});function ge(){var a=ge;if(!0===(Na(this,a)&&this.constructor===a))throw new TypeError(\"Illegal constructor \"+Ta(a));}u(\"H.geo.AbstractGeometry\",ge);ge.prototype.getBounds=ge.prototype.B;ge.prototype.equals=ge.prototype.j;ge.prototype.toString=function(){return this.da([this.ea,\" \"]).join(\"\")};ge.prototype.toString=ge.prototype.toString;function U(a,b,c,d){this.lat=be(a,U,0);this.lng=de(b,U,1);c!==z&&(this.alt=ee(c,U,2));d!==z&&fe(d,U,3)&&(this.ctx=d)}ua(U,ge);u(\"H.geo.Point\",U);U.prototype.j=function(a){return this===a||!!a&&this.lat===a.lat&&this.lng===a.lng&&ae[this.ctx]===ae[a.ctx]&&(this.alt||0)===(a.alt||0)};U.prototype.equals=U.prototype.j;\nU.prototype.a=function(a){var b,c;this===a||this.lat===a.lat&&this.lng===a.lng?a=0:(b=this.lat*dc,c=a.lat*dc,a=1.274200158E7*Ub(Ob(1,mb(nb(Tb((b-c)/2),2)+Vb(b)*Vb(c)*nb(Tb((this.lng*dc-a.lng*dc)/2),2)))));return a};U.prototype.distance=U.prototype.a;\nU.prototype.b=function(a,b,c){var d,e,f,g,h,k;if(c){if(b/=6371000.79){a*=dc;d=dc*this.lat;f=Tb(d);g=Tb(b);h=Vb(b);e=dc*this.lng;var l=Vb(d);d=Ub(l*Vb(a)*g+f*h);a=Yb(Tb(a)*l*g,h-f*Tb(d));l=((e+a+Q)%(2*Q)-Q)*ec}return b?new U(d*ec,(l+540)%360-180):this}a=(a%360+360)%360;if(0===(a+90)%180)return d=this.lng+b/(6371000.79*bc*Vb(this.lat*dc))*(270===a?-360:360),new U(this.lat,(d+540)%360-180);if(b/=6371000.79)a*=dc,e=this.lat*dc,f=this.lng*dc,g=e+b*Vb(a),h=g-e,d=Rb(Wb(g/2+ac)/Wb(e/2+ac)),d=Ra(h/d)?Vb(e):\nh/d,k=b*Tb(a)/d,Qb(g)>$b&&(g=0<g?Q-g:-(Q+g));return b?new U(g*ec,((f+k+cc+(Qb(e+h)>$b?Q:0))%bc-Q)*ec):this};U.prototype.walk=U.prototype.b;U.prototype.B=function(){return new V(this.lat,this.lng,this.lat,this.lng)};U.prototype.getBounds=U.prototype.B;function he(a,b,c){var d=!!a&&!(Ra(a.lat=be(a.lat))||Ra(a.lng=de(a.lng))||a.alt!==z&&Ra(a.alt=ee(a.alt))||a.ctx!==z&&!fe(a.ctx));if(!d&&b)throw new B(b,c,a);return d}U.validate=he;\nfunction ie(a){if(!a)throw new B(ie,0,a);return new U(a.lat,a.lng,a.alt,a.ctx)}U.fromIPoint=ie;U.prototype.ea=\"POINT\";U.prototype.da=function(a){a.push(\"(\",this.lng,\" \",this.lat,\")\");return a};function je(){}je.prototype.U=function(){};u(\"H.geo.IProjection.prototype.latLngToPoint\",je.prototype.U);je.prototype.L=function(){};u(\"H.geo.IProjection.prototype.xyToGeo\",je.prototype.L);je.prototype.b=function(){};u(\"H.geo.IProjection.prototype.pointToGeo\",je.prototype.b);je.prototype.a=function(){};u(\"H.geo.IProjection.prototype.geoToPoint\",je.prototype.a);var W={};u(\"H.geo.mercator\",W);W.c=function(a){return Ob(1,Pb(0,.5-Rb(Wb(ac+$b*a/180))/Q/2))};W.f=function(a){return a/360+.5};W.U=function(a,b,c){c?(c.x=W.f(b),c.y=W.c(a)):c=new J(W.f(b),W.c(a));return c};W.latLngToPoint=W.U;W.a=function(a,b){return W.U(a.lat,a.lng,b)};W.geoToPoint=W.a;W.i=function(a){return 0>=a?90:1<=a?-90:ec*(2*Xb(Sb(Q*(1-2*a)))-$b)};W.g=function(a,b){return b?0>=a?-180:1<=a?180:360*gc(a,1)-180:360*(1===a?1:gc(a,1))-180};\nW.L=function(a,b,c,d){c?(c.lat=W.i(b),c.lng=W.g(a,d)):c=new U(W.i(b),W.g(a,d));return c};W.xyToGeo=W.L;W.b=function(a,b,c){return W.L(a.x,a.y,b,c)};W.pointToGeo=W.b;function X(a,b){this.projection=a||W;this.i=0;this.b=this.exp=Rb(b||256)/Zb;ke(this);this.y=this.x=0}u(\"H.geo.PixelProjection\",X);var le=Qb(28)+Qb(-8);X.prototype.a=function(a){if(Ra(a))throw new B(this.a,0,a);var b=this.x/this.w,c=this.y/this.h;this.i=a;this.b=this.exp+a;ke(this);this.x=b*this.w;this.y=c*this.h};X.prototype.rescale=X.prototype.a;function ke(a){a.b>le&&(a.b=le);a.w=nb(2,a.b);a.h=nb(2,a.b)}X.prototype.g=function(){return this.i||0};X.prototype.getZoomScale=X.prototype.g;\nX.prototype.j=function(a,b){var c=this.projection.U(a.lat,a.lng,b);c.x=c.x*this.w-this.x;c.y=c.y*this.h-this.y;return c};X.prototype.geoToPixel=X.prototype.j;X.prototype.f=function(a,b,c){return this.projection.L((a.x+this.x)/this.w,(a.y+this.y)/this.h,b,c)};X.prototype.pixelToGeo=X.prototype.f;X.prototype.L=function(a,b,c,d){return this.projection.L((a+this.x)/this.w,(b+this.y)/this.h,c,d)};X.prototype.xyToGeo=X.prototype.L;\nX.prototype.c=function(a,b,c){a=this.projection.U(a,b,c);a.x=a.x*this.w-this.x;a.y=a.y*this.h-this.y;return a};X.prototype.latLngToPixel=X.prototype.c;X.prototype.l=function(a){return new J(a.x*this.w-this.x,a.y*this.h-this.y)};X.prototype.pointToPixel=X.prototype.l;u(\"H.util.Disposable\",L);L.prototype.f=L.prototype.f;L.prototype.addOnDisposeCallback=L.prototype.f;u(\"H.util.dispose\",function(a){a&&\"function\"==typeof a.S&&a.S()});function me(a,b,c,d){this.key=\"\";this.x=a;this.y=b;this.a=c;this.Y=d;this.G=Rc()}me.prototype.then=function(a,b,c){return this.G.la.then(a,b,c)};me.prototype.resolve=function(a){this.G.resolve(a)};me.prototype.reject=function(a){this.G.reject(a)};me.prototype.cancel=function(){this.G.la.cancel()};function Z(a,b,c,d,e,f){if(a&&b)this.P(a),this.l(b),this.o(c),this.C(e),this.B(f),this.v(d);else throw Error('Parameters \"scheme\" and \"host\" must be specified');}u(\"H.service.Url\",Z);\nfunction ne(a,b){var c=a,d=y.document,e,f,g,h,k=d&&d.createElement(\"a\"),l=\"\";d?(b&&(f=(e=d.getElementsByTagName(\"base\")[0])&&e.href,g=d.head,h=e||g.appendChild(d.createElement(\"base\")),h.href=b),k.href=c,l=k.href,b&&(e?e.href=f:g.removeChild(h))):/[\\w]+:\\/\\//.test(c)&&(l=c);g=/(?:(\\w+):\\/\\/)?(?:([^:]+):([^@/]*)@)?([^/:]+)?(?:[:]{1}([0-9]+))?(\\/[^?#]*)?(\\?[^#]+)?(#.*)?/.exec(l);c=g[1];k=g[4];d=g[5];h=g[6];e=g[7];f=g[8];!g[2]&&k&&/@/.test(k)&&(k=k.split(\"@\")[1]);g=k;h=h&&0<h.length?h.substr(1):\"\";var k=\n{},n;if(e)for(l=/([?&]?([^=&+]+))(=([^&]+))?/g;n=l.exec(e);)k[decodeURIComponent(n[2])]=n[4]?decodeURIComponent(n[4]):void 0;return new Z(c,g,h,k,isNaN(+d)?void 0:+d,f&&0<f.length?f.substr(1):\"\")}Z.parse=ne;var oe=0;Z.prototype.clone=function(){oe++;var a={},b;for(b in this.a)a[b]=this.a[b];return new Z(this.j,this.g,this.b,a,this.i,this.c)};Z.prototype.clone=Z.prototype.clone;\nZ.prototype.P=function(a){if(!a||\"string\"!==typeof a)throw Error('The \"scheme\" parameter must be a non-empty string.');this.j=a;return this};Z.prototype.setScheme=Z.prototype.P;Z.prototype.oa=function(){return this.j};Z.prototype.getScheme=Z.prototype.oa;Z.prototype.l=function(a){if(!a||\"string\"!==typeof a||\"-\"===a.charAt(0)||\".\"===a.charAt(0)||\".\"===a.charAt(a.length-1))throw Error('The \"host\" parameter is not a valid host name.');this.g=a;return this};Z.prototype.setHost=Z.prototype.l;\nZ.prototype.ba=function(){return this.g};Z.prototype.getHost=Z.prototype.ba;Z.prototype.o=function(a){this.b=a||void 0;return this};Z.prototype.setPath=Z.prototype.o;Z.prototype.ca=function(){return this.b};Z.prototype.getPath=Z.prototype.ca;Z.prototype.v=function(a){if(a)if(\"object\"==typeof a)this.a=a;else throw Error('Parameter \"params\" must be an object.');else this.a={};return this};Z.prototype.setQuery=Z.prototype.v;Z.prototype.pa=function(){return!pe(this)};Z.prototype.hasQuery=Z.prototype.pa;\nZ.prototype.ea=function(){return this.a};Z.prototype.getQuery=Z.prototype.ea;Z.prototype.C=function(a){if(a&&isNaN(parseInt(a,10)))throw Error('Parameter \"port\" must be a number or undefined');this.i=+a||void 0;return this};Z.prototype.setPort=Z.prototype.C;Z.prototype.da=function(){return this.i};Z.prototype.getPort=Z.prototype.da;Z.prototype.B=function(a){this.c=a||void 0;return this};Z.prototype.setAnchor=Z.prototype.B;Z.prototype.aa=function(){return this.c};Z.prototype.getAnchor=Z.prototype.aa;\nZ.prototype.f=function(a){if(\"object\"!==typeof a)throw Error('Parameter \"other\" must be an object.');var b=this.a,c;for(c in a)a.hasOwnProperty(c)&&\"function\"!==typeof a[c]&&(b[c]=a[c]);return this};Z.prototype.mergeQuery=Z.prototype.f;Z.prototype.Z=function(a){if(!a||\"string\"!==typeof a)throw Error('Parameter \"subDomain\" must be a non-empty string');\".\"===a.substr(a.length-1)&&(a=a.substr(0,a.length-1));return this.l(a+\".\"+this.g)};Z.prototype.addSubDomain=Z.prototype.Z;\nZ.prototype.$=function(a){if(!a||\"string\"!==typeof a)throw Error('Parameter \"subPath\" must be a non-empty string');return this.o((this.b?this.b+\"/\":\"\")+a)};Z.prototype.addSubPath=Z.prototype.$;Z.prototype.toString=function(){return[this.j+\"://\",this.g,this.i?\":\"+this.i:\"\",this.b||!pe(this)||this.c?\"/\":\"\",this.b?encodeURI(this.b):\"\",qe(this),this.c?\"#\"+encodeURIComponent(this.c):\"\"].join(\"\")};Z.prototype.toString=Z.prototype.toString;\nfunction qe(a){var b=[],c,d=a.a,e;for(c in d)d.hasOwnProperty(c)&&\"function\"!==typeof d[c]&&(e=a.a[c],b.push(encodeURIComponent(c)+(void 0===e?\"\":\"=\"+encodeURIComponent(e))));return 0<b.length?\"?\"+b.join(\"&\"):\"\"}function pe(a){var b,c=0;for(b in a.a)if(a.a.hasOwnProperty(b)&&\"function\"!==typeof a.a[b]&&(c++,0<c))break;return!c};var re={};function se(a){try{importScripts.apply(self,arguments)}catch(b){this.postError(\"invalid_script\")}}function te(a){re[a]=null;this.postMessage(a)}function ue(a,b,c){var d;if(r(b))d=b;else try{d=self.eval(\"(\"+b+\")\"),r(d)||(d=null)}catch(e){}d?(re[a]=d,c||this.postMessage(a)):this.postError(\"invalid_processor\")}function ve(a){this.b=a&&a[0];this.a=a&&a[1];this.c=a&&a[2]||[]}ve.prototype.postError=function(a){this.postMessage(a,z,0)};\nve.prototype.postMessage=function(a,b,c){self.postMessage({processor:this.b,taskId:this.a,type:c===z?1:c,data:a},b||z)};function we(a,b,c){var d;if(!ha(a))throw new B(we,0,\"InvalidArgument\");if(!r(b))throw new B(we,1,\"InvalidArgument\");d=xe++;ye[d]={b:c||ze,a:b};(new ve([\"3\",d,[]])).postMessage(a,[],2)}var ye={},xe=0;\nfunction Ae(a,b){var c,d,e=a;if(ye[this.a])if(d=ye[this.a],c=d.a,delete ye[this.a],b)c(null,b);else{if(d.b===Be){d=new Uint8Array(a);for(var e=d.byteLength,f=\"\",g=0,h,k,l,n;g<e;)h=d[g++],192>h||(k=d[g++],224>h?h=(h&31)<<6|k&63:(l=d[g++],240>h?h=(h&15)<<12|(k&63)<<6|l&63:(n=d[g++],h=(h&7)<<18|(k&63)<<12|(l&63)<<6|n&63))),65536>h?f+=String.fromCharCode(h):(h-=65536,f+=String.fromCharCode((h>>10)+55296,(h&1023)+56320));e=f}c(e)}}var ze=0,Be=1;function V(a,b,c,d){Ce(this,be(a,V,0),de(b,V,1),be(c,V,2),de(d,V,3))}ua(V,ge);u(\"H.geo.Rect\",V);V.prototype.ea=\"POLYGON\";V.prototype.da=function(a){var b=this.A,c=this.m,d=this.u,e=this.s;a.push(\"(\",c,\" \",b,\",\",e,\" \",b,\",\",e,\" \",d,\",\",c,\" \",d,\",\",c,\" \",b,\")\");return a};V.prototype.j=function(a){return this===a||!!a&&this.A===a.A&&this.m===a.m&&this.u===a.u&&this.s===a.s};V.prototype.equals=V.prototype.j;V.prototype.clone=function(){return new V(this.A,this.m,this.u,this.s)};\nV.prototype.clone=V.prototype.clone;function Ce(a,b,c,d,e){a.m=c;a.s=e;b<d&&(c=b,b=d,d=c);a.A=b;a.u=d;a.C=a.o=a.v=null;return a}V.prototype.$=function(){this.C||(this.C=new U(this.A,this.m));return this.C};V.prototype.getTopLeft=V.prototype.$;V.prototype.Z=function(){this.o||(this.o=new U(this.u,this.s));return this.o};V.prototype.getBottomRight=V.prototype.Z;V.prototype.Ga=function(){return this.A};V.prototype.getTop=V.prototype.Ga;V.prototype.oa=function(){return this.u};V.prototype.getBottom=V.prototype.oa;\nV.prototype.pa=function(){return this.m};V.prototype.getLeft=V.prototype.pa;V.prototype.Fa=function(){return this.s};V.prototype.getRight=V.prototype.Fa;V.prototype.f=function(){this.v||(this.v=new U(this.u+(this.A-this.u)/2,De(this.m,this.a())));return this.v};V.prototype.getCenter=V.prototype.f;V.prototype.a=function(){return Ee(this.m,this.s)};V.prototype.getWidth=V.prototype.a;V.prototype.c=function(){return this.A-this.u};V.prototype.getHeight=V.prototype.c;\nV.prototype.Ha=function(){return this.m>this.s};V.prototype.isCDB=V.prototype.Ha;V.prototype.Ia=function(){return!this.a()&&!this.c()};V.prototype.isEmpty=V.prototype.Ia;V.prototype.B=function(){return new V(this.A,this.m,this.u,this.s)};V.prototype.i=function(a,b,c){var d=this.f();c||(a=be(a,this.i,0),b=de(b,this.i,1));b=this.b(a,b,c);a=b.f();return a.lat===d.lat&&a.lng===d.lng&&this.c()===b.c()&&this.a()===b.a()};V.prototype.containsLatLng=V.prototype.i;\nV.prototype.ha=function(a,b){b||he(a,this.ha,0);return this.i(a.lat,a.lng,b)};V.prototype.containsPoint=V.prototype.ha;V.prototype.P=function(a,b){var c=this.f(),d,e;if(!b&&!Na(a,V))throw new B(this.P,0,a);e=this.l(a,b);d=e.f();return d.lat===c.lat&&d.lng===c.lng&&this.c()===e.c()&&this.a()===e.a()};V.prototype.containsRect=V.prototype.P;\nV.prototype.b=function(a,b,c,d){if(!c){if(Ra(a=be(a)))throw new B(this.b,0,a);if(Ra(b=de(b)))throw new B(this.b,1,b);}return Fe(this.A,this.m,this.u,this.s,a,b,a,b,d)};V.prototype.mergeLatLng=V.prototype.b;V.prototype.ba=function(a,b,c){b||he(a,this.ba,0);return this.b(a.lat,a.lng,b,c)};V.prototype.mergePoint=V.prototype.ba;V.prototype.l=function(a,b,c){if(!b&&!Na(a,V))throw new B(this.l,0,a);return Fe(this.A,this.m,this.u,this.s,a.A,a.m,a.u,a.s,c)};V.prototype.mergeRect=V.prototype.l;\nV.prototype.g=function(a,b,c,d,e,f){e||(a=be(a,this.g,0),b=de(b,this.g,1),c=be(c,this.g,2),d=de(d,this.g,3));return Fe(this.A,this.m,this.u,this.s,a,b,c,d,f)};V.prototype.mergeTopLeftBottomRight=V.prototype.g;V.prototype.aa=function(a,b){if(!b&&!Na(a,V))throw new B(this.aa,0,a);var c=this.m<=this.s,d=a.m<=a.s,e=this.m<a.s,f=a.m<this.s;return this.u<=a.A&&a.u<=this.A&&(!c&&(!d||e||f)||!d&&(e||f)||e&&f)};V.prototype.intersects=V.prototype.aa;function Ee(a,b){var c=b-a;return c+(0>c?360:0)}\nfunction De(a,b){var c=a+b/2;return c-(180<c?360:0)}function Fe(a,b,c,d,e,f,g,h,k){var l,n,p;c=Ob(c,g);a=Pb(a,e);e=Ee(b,d);l=De(b,e);g=Ee(f,h);p=De(f,g)-l;p+=0>p-1E-6?360:0;180>p-1E-6?(l=b,n=h):(p=360-p,l=f,n=d);p=p+e/2+g/2;360<=p+5E-7?(l=-180,n=180):p-5E-7<e?(l=b,n=d):p-5E-7<g&&(l=f,n=h);return k?Ce(k,a,l,c,n):new V(a,l,c,n)}V.merge=Fe;function Ge(a,b,c){c||(he(a,Ge,0),he(b,Ge,1));return new V(a.lat,a.lng,b.lat,b.lng)}V.fromPoints=Ge;\nfunction He(a,b){var c=ga(a);if(\"array\"!=c&&(\"object\"!=c||\"number\"!=typeof a.length))throw new B(He,0,a);var c=1,d=a.length,e,f=null;if(0<d)for(e=a[0],f=Ge(e,e,b);c<d;c++)e=a[c],f.b(e.lat,e.lng,b,f);return f}V.coverPoints=He;function Ie(a,b){if(!(b||a&&null!=a.length))throw new B(Ie,0,a);var c=3,d=a.length,e;if(0<d)for(e=new V(a[0],a[1],a[0],a[1]);c<d;c+=3)e.b(a[c],a[c+1],b,e);return e}V.coverLatLngAlts=Ie;\nfunction Je(a,b){if(b&&(!a||null==a.length))throw new B(Je,0,a);var c=1,d=a.length,e;if(0<d)for(e=new V(a[0].A,a[0].m,a[0].u,a[0].s);c<d;c++)e.l(a[c],b,e);return e}V.coverRects=Je;V.prototype.ca=function(a,b){he(a,this.ca,0);var c=this.m,d=this.A,e=this.s,f=this.u,g=this.f().lng,h=a.lat-f-(d-f)/2,k=a.lng-g,k=180<k||-180>k?-(g+a.lng):k,c=c+(0>k?2*k:0),c=-180>c?360+c:c,e=e+(0<k?2*k:0),e=180<e?e-360:e,d=0<h?d+2*h:d;90<=d&&(d=90);f=0>h?f+2*h:f;-90>=f&&(f=-90);return b?Ce(b,d,c,f,e):new V(d,c,f,e)};\nV.prototype.resizeToCenter=V.prototype.ca;function Ke(a,b,c,d){var e=!!c,f,g,h=0,k=0,l=0,n=0,p=0,w,G,D,I=-1;f=y.Float32Array;var M,x=[];if(b){b=Ka(b);a=Ka(a);e&&(g=Ka(c));c=b.length;d=d?1E-7:1E-5;for(M=new f(3*c);h<c;)f=b[h],G=+f,w=+a[h],e&&(D=+g[h]),Le.test(f)?0<=I&&(0<h-I&&x.push(I,h+1),I=-1):0>I&&(I=h),h++,n=M[k++]=n+w*d,l=M[k++]=l+G*d,e&&(p=M[k]=p+D),k++;0<=I&&1<c-I&&x.push(I,c)}else M=new f(0);return{path:M,outlineIndices:x}}var Le=/^-?0\\d/;\nfunction Me(a,b){for(var c=0,d=a.length/3,e=new y.Array(d),f=0;c<d;)e[c++]=b.c(a[f],a[++f]),f+=2;return e};function Ne(a,b){var c=180/(1<<b),d=a.lat+90,e=(a.lng+180)%360,f=0;180==d&&f--;f+=Math.floor(d/c);c=0+Math.floor(e/c);return[f,c]}var Oe=1/Math.pow(10,10);function Pe(a,b){var c=[],d=a.$(),e=a.Z(),f,g;180==e.lng&&(e.lng-=Oe);d=Ne(d,b);e=Ne(e,b);for(g=d[0];g>=e[0];g--)for(f=d[1];f<=e[1];f++)c.push(g,f);return c};function Qe(a,b){this.b={};this.v=ne(a.serverUrl);this.l=b;this.C=a.layerConfigs||[];this.o=a.projected;this.a=a.tileSize||256;this.B=!1!==a.batchTiles;this.P=a.onlyOutline;this.j=new X(Ja,this.a);this.i=new X(Ja,this.a);this.i.a(22-Math.log(this.a)/Math.LN2+8)}ua(Qe,L);m=Qe.prototype;m.Wa=function(a,b,c){var d,e;d={x:a*this.a,y:b*this.a};e={x:a*this.a+(this.a-1),y:b*this.a+(this.a-1)};this.j.a(c);d=this.j.f(d);e=this.j.f(e);d=new V(d.lat,d.lng,e.lat,e.lng);return Re(this,d,this.C,{x:a,y:b,z:c})};\nm.Va=function(a,b,c,d,e){return Re(this,new V(a,b,c,d),e)};\nfunction Re(a,b,c,d){var e=d||{};c=Se(c);var f=Te(c),g,h=[],k=[],l,n,p={},w,G,D;for(G=0;G<c.length;G++)for(l=c[G].layerId,n=c[G].level,p[l]=c[G].columns,g=Pe(b,n),D=0;D<g.length-1;D+=2)d=[l,g[D+1],g[D],n].join(\"_\"),w=a.b[d]||a.l.get(d),w||(w=new me(g[D+1],g[D],n,l),w.key=d,a.b[d]=w,k.push(w)),h.push(w);k.length&&(a.B?Ue(a,k):Ve(a,k));return Pc(h.map(function(a){return a.then(Ea(this.Oa,this,a.Y,f)).then(Ea(this.Ua,this,a,e)).then(Ea(this.Ya,this,p[a.Y]))},a))}\nm.Oa=function(a,b,c){var d=c.Rows,e=d.length,f,g,h,k;if(e&&(f=b[a])){b=new F(c.Rows);g=[];for(h=0;h<e;h++)k=d[h],f(b.c(h),a)&&g.push(k);a={Rows:g};if(c=c.Meta)a.Meta=c}else a=c;return a};function Ve(a,b){function c(b,c,d){d?(delete a.b[b.key],b.reject(d)):We(a,b,c)}var d,e,f;for(d=0;d<b.length;d++)f=b[d],e=a.v.clone().f({tilex:f.x}).f({tiley:f.y}).f({level:f.a}).f({layer:f.Y}),new we(e.toString(),Ea(c,null,f),Be)}function Ue(a,b){var c=b.length,d,e;for(d=0;d<c;d+=15)e=b.slice(d,d+15),Xe(a,e)}\nfunction Xe(a,b){var c=a.v.clone(),d=[],e=[],f=[],g=c.a;b.length&&(b.forEach(function(a){d.push(a.x,a.y);e.push(a.a);f.push(a.Y)}),g.tilexy=d.join(\",\"),g.layers=f.join(\",\"),g.levels=e.join(\",\"),c.v(g),new we(c.toString(),function(c,d){d?b.forEach(function(b){delete a.b[b.key];b.reject(\"error\")}):We(a,b,c)},Be))}\nfunction We(a,b,c){var d,e,f,g;if(Pa(b,void 0,void 0,void 0))for(e=c.indexOf(\"[\")+1,g=0;g<b.length;g++)f=c.indexOf(\"]},{\",e+3)+2,f<e&&(f=c.lastIndexOf(\"]}\")),d=c.substr(e,f-e),e=f+1,Ye(a,b[g],d);else Ye(a,b,c)}function Ye(a,b,c){var d=0;try{d=c.length,delete a.b[b.key],a.l.add(b.key,b,2*d),b.resolve(JSON.parse(c))}catch(e){b.reject(e.message)}}function Te(a){var b={},c,d,e;for(e=0;e<a.length;e++)c=a[e],c.rowFilter&&(d=c.layerId,d=d!==z?d:c.layer,b[d]=Ea(c.rowFilter,c.rowFilterContext));return b}\nm.Ua=function(a,b,c){var d,e,f,g=!1,h,k,l=[],n=[],p=[];a=/^ADAS/.test(a.Y);for(var w=this.P,G=a?\"HPY\":\"LAT\",D=a?\"HPX\":\"LON\",I=a?\"HPZ\":\"ZLEVEL\",M,x,na,ya=0,Zd=c.Rows,ja,oa,gf=Zd.length,$d=this.i;ya<gf;ya++){x=Zd[ya];if(x[G]&&x[D]&&(f=Ke(x[G],x[D],x[I],a),x.geometry=f,delete x[G],delete x[D],delete x[I],x.INNER_LON)){x.INNER_LAT=x.INNER_LAT.split(\";\");x.INNER_LON=x.INNER_LON.split(\";\");M=[];na=x.INNER_LON.length;for(f=0;f<na;f++)M.push(Ke(x.INNER_LAT[f],x.INNER_LON[f],\"\",a));x.interiors=M;delete x.INNER_LAT;\ndelete x.INNER_LON}if(this.o){ja=x.$$projected$$;if(!ja){f=x.geometry;na=(M=x.interiors)?M.length:0;h=Me(f.path,$d);oa=[h];x.$$projected$$=ja={Ta:oa};oa.length+=na;g|=Ze(oa,h,f.outlineIndices);if(na)for(ja.Qa=1,f=0;f<na;f++)x=M[f],h=Me(x.path,$d),oa[1+f]=h,g|=Ze(oa,h,x.outlineIndices);g&&(ja.va=1+na)}if(ja){h=[];oa=ja.Ta;M=na=x=oa.length;for(f=w?ja.va:0;f<x;f++){k=oa[f];var ba=f>=ja.va,ca=void 0,da=void 0,A=void 0,t=void 0,K=e=d=e=void 0,K=void 0,La=[],t=K=A=void 0,K=[],A=void 0,t=0,pa=this.i.g()-\nb.z,ca=(b.x<<pa)*this.a,da=(b.y<<pa)*this.a,K=50<<pa;e=this.a<<pa;if(1===k.length)K=[ca,da,ca+e,da,ca+e,da+e,ca,da+e],nc(k[0].x,k[0].y,K)&&(K=new Int32Array(2),K[0]=k[0].x-ca>>pa,K[1]=k[0].y-da>>pa,La.push(K));else if(A=da-K,t=ca+e+K,e=da+e+K,d=ca-K,K=[new J(d,A),new J(t,A),new J(t,e),new J(d,e),new J(d,A)],ba)for(K=pb([k],d,A,t,e,!1),A=K.length,t=0;t<A;t+=1)La.push($e(K[t],2*K[t].length,ca,da,pa,!0));else if(af(K,k))La.push($e(K,2*K.length,ca,da,pa,!0));else{var A=k,ba=zb(K),A=zb(A),O=void 0,Y=void 0,\nra=void 0,za=void 0,hc=void 0,ic=void 0,ce=ra=t=void 0;d=t=void 0;t={};e=d=1;var ab=0,ab=~~(1*ab);switch(ab){case 1:e=d=0;break;case 2:d=0;e=1;break;case 3:d=1,e=0}var ab=e,jc=za=void 0,ra=O=e=void 0;if(A&&ba){A.ia=rb(A.x,A.y,null,tb(A));ba.ia=rb(ba.x,ba.y,null,tb(ba));for(O=A;O.next;O=O.next)if(!O.I)for(Y=ba;Y.next;Y=Y.next)!Y.I&&(za=sb(O.next),jc=sb(Y.next),ra=wb(O,za,Y,jc,t))&&(ra=t.Ja,ce=t.xa,hc=t.Za,ic=t.$a,ra=rb(hc,ic,null,null,null,null,1,0,0,ra),yb(ra,O,za),za=rb(hc,ic,null,null,null,null,\n1,0,0,ce),yb(za,Y,jc),ra.ua=za,za.ua=ra);t=xb(A,ba);d&&(t=1-t);for(O=A;O;O=O.next)O.I&&(O.ra=t,t=1-t);t=xb(ba,A);ab&&(t=1-t);for(Y=ba;Y.next;Y=Y.next)Y.I&&(Y.ra=t,t=1-t);vb(A);for(vb(ba);(t=ub(A))!=A;){for(O=null;!t.na;t=t.ua){for(d=t.ra;;){O=rb(t.x,t.y,O);t.na=1;t=d?t.next:t.D;if(!t)break;if(t.I){t.na=1;break}}if(!t)break}O.Da=e;e=O}A=e}else A=void 0;t=2*k.length;if(!A&&af(k,K))La.push($e(k,t,ca,da,pa,!0));else for(;A;)La.push($e(A,t,ca,da,pa)),A=A.Da}k=La;if(f===ja.Qa){if(!h.length)break;M=h.length}f===\nja.va&&(na=h.length);k.length&&h.push.apply(h,k)}h.length&&(l[ya]=h,w?n[ya]=p[ya]=fc:(n[ya]=M,p[ya]=na))}}}return{Xa:c,La:l,Ra:n,Sa:p}};function Ze(a,b,c){for(var d=c.length,e=0,f,g,h=b.length;e<d;)f=c[e++],g=c[e++],a.push(g-f===h?b:b.slice(f,g));return 0<c.length}function af(a,b){for(var c=!1,d=[],e=0,f=b.length;e<f;e++)d.push(b[e].x,b[e].y);nc(a[0].x,a[0].y,d)&&(pb([b],a[0].x,a[0].y,a[2].x,a[2].y,!0).length||(c=!0));return c}\nfunction $e(a,b,c,d,e,f){var g=0,h=0,k=a,l=!!f,n=new Int32Array(b);for(l&&(a=k[0]);a;)n[g]=a.x-c>>e,g+=1,n[g]=a.y-d>>e,g+=1,g===b&&(f=new Int32Array(2*b),f.set(n),n=f),h+=1,a=l?k[h]:a.next;f=new Int32Array(g);f.set(Array.prototype.slice.apply(n,[0,g]));return f}\nm.Ya=function(a,b){for(var c=b.Xa,d=b.La,e=b.Ra,f=b.Sa,g=[],h,k={Rows:g},l,n=a?a.length:0,p=0,w,G=c.Rows,D=G.length,I;p<D;p+=1)if(d[p]||!this.o){h={};w=G[p];if(n)for(l=0;l<n;l+=1)w.hasOwnProperty(a[l])&&(h[a[l]]=w[a[l]]);else for(I in w)\"$$projected$$\"!==I&&(h[I]=w[I]);d[p]&&(h.$HProjGeometry={paths:d[p],interiorsIndex:e[p],outlinesIndex:f[p]});w.geometry&&(h.geometry=w.geometry);g.push(h)}c.Meta&&(k.Meta=c.Meta);return k};\nm.ja=function(){for(var a in this.b)this.b.hasOwnProperty(a)&&(this.b[a].reject(\"disposed\"),delete this.b[a])};function Se(a){var b=[],c,d;for(d=0;d<a.length;d++){c=Ia(a[d]);if(c.rowFilter&&(c.rowFilter=eval(\"(\"+c.rowFilter+\")\"),!r(c.rowFilter)))throw Error(\"Invalid row filter for layer \"+c.layerId);b.push(c)}return b};u(\"H.service.extension.worker.processor\",function(a,b,c){function d(a){e.postMessage(a)}var e=this,f=bf[a],g;g=function(a){e.postError(a.toString())};if(0===b)f||(bf[a]=new Qe(c,cf)),this.postMessage();else if(f)switch(b){case 1:try{f.Wa.apply(f,c).then(d,g)}catch(h){this.postError(h.message)}break;case 2:try{f.Va.apply(f,c).then(d,g)}catch(k){this.postError(k.message)}break;case 3:f.S();delete bf[a];Oa(bf)&&cf.i();break;default:e.postError(\"Unsupported command\")}else e.postError(\"TileProvider is not initialized\")});\nvar cf=new C(26214400),bf=Object.create(Ja,void 0);function df(a,b,c){var d=a[b];a=a[b+1];this.Ba=[];this.wa=0;this.a=[a-c,d-c,a+c,d+c]}df.prototype.ha=function(a,b){var c=a[b],d=a[b+1],e=this.a;return e[1]<=c&&c<=e[3]&&e[0]<=d&&d<=e[2]};var ef=new J(0,0);function ff(a,b,c,d,e){d[e]=b;d[e+1]=a}var hf=new X;function jf(a,b,c,d,e){hf.c(a,b,ef);d[e]=ef.x;d[e+1]=ef.y}\nu(\"H.clustering.dynamicgrid.worker\",function(a,b,c,d,e){var f=e?ff:jf,g=0;e=!!self.ArrayBuffer;var h=a.byteLength?new Float64Array(a):a,k=h.length/3,l,n;a=[];var p,w=[],G=[],D=e?new Float64Array(2*k):[],k=0,I,M=0;for(hf.a(d);g<h.length;){I=h[g++];n=h[g++];l=h[g++];f(l,n,d,D,M);for(l=a.length;l--;)if(n=a[l],n.ha(D,M)){p=n;break}p||(p=new df(D,M,b),a.push(p));l=M/2;p.wa+=I||1;p.Ba.push(l);p=null;M+=2}for(l=a.length;l--;)n=a[l],b=n.wa>=c,f=n.Ba,d=f.length,b?(w.push(d),w=w.concat(f)):(k+=d,G=G.concat(f));\nc=[k].concat(G).concat(w);c=e?(new Uint32Array(c)).buffer:c;this.postMessage(c,[c])});self.addEventListener(\"message\",function(a){a=new ve(a.data);var b=re[a.b];if(b)try{b.apply(a,a.c)}catch(c){a.postError(c.message)}else a.postError(\"processor_not_found\")});(function(){var a,b;a=new ve;b=function(b,d){ue.apply(a,[b,d,!0])};b(\"0\",se);b(\"1\",ue);b(\"2\",te);b(\"3\",Ae)})();\n";;
H.util.eval("N.prototype.N=ca(0,function(a){var b=this.g,c,d=this;a!==x?(B(a,Vg,N.prototype.N,0),c=a):c=bh;c!==b&&b.Ea(function(a,b,g){return d.m(a)?(c.add(a,b,g),!0):!1});this.g=c});function S(a,b,c,d,e,f){if(a&&b)this.ce(a),this.nd(b),this.mc(c),this.j(e),this.l(f),this.zf(d);else throw Error('Parameters \"scheme\" and \"host\" must be specified');}r(\"H.service.Url\",S);\nfunction km(a,b){var c=a,d=w.document,e,f,g,h,k=d&&d.createElement(\"a\"),l=\"\";d?(b&&(f=(e=d.getElementsByTagName(\"base\")[0])&&e.href,g=d.head,h=e||g.appendChild(d.createElement(\"base\")),h.href=b),k.href=c,l=k.href,b&&(e?e.href=f:g.removeChild(h))):/[\\w]+:\\/\\//.test(c)&&(l=c);g=/(?:(\\w+):\\/\\/)?(?:([^:]+):([^@/]*)@)?([^/:]+)?(?:[:]{1}([0-9]+))?(\\/[^?#]*)?(\\?[^#]+)?(#.*)?/.exec(l);c=g[1];k=g[4];d=g[5];h=g[6];e=g[7];f=g[8];!g[2]&&k&&/@/.test(k)&&(k=k.split(\"@\")[1]);g=k;h=h&&0<h.length?h.substr(1):\"\";var k=\n{},m;if(e)for(l=/([?&]?([^=&+]+))(=([^&]+))?/g;m=l.exec(e);)k[decodeURIComponent(m[2])]=m[4]?decodeURIComponent(m[4]):void 0;return new S(c,g,h,k,isNaN(+d)?void 0:+d,f&&0<f.length?f.substr(1):\"\")}S.parse=km;var lm=0;S.prototype.clone=function(){lm++;var a={},b;for(b in this.b)a[b]=this.b[b];return new S(this.g,this.vc,this.c,a,this.f,this.a)};S.prototype.clone=S.prototype.clone;\nS.prototype.ce=function(a){if(!a||\"string\"!==typeof a)throw Error('The \"scheme\" parameter must be a non-empty string.');this.g=a;return this};S.prototype.setScheme=S.prototype.ce;S.prototype.B=function(){return this.g};S.prototype.getScheme=S.prototype.B;S.prototype.nd=function(a){if(!a||\"string\"!==typeof a||\"-\"===a.charAt(0)||\".\"===a.charAt(0)||\".\"===a.charAt(a.length-1))throw Error('The \"host\" parameter is not a valid host name.');this.vc=a;return this};S.prototype.setHost=S.prototype.nd;\nS.prototype.o=function(){return this.vc};S.prototype.getHost=S.prototype.o;S.prototype.mc=function(a){this.c=a||void 0;return this};S.prototype.setPath=S.prototype.mc;S.prototype.m=function(){return this.c};S.prototype.getPath=S.prototype.m;S.prototype.zf=function(a){if(a)if(\"object\"==typeof a)this.b=a;else throw Error('Parameter \"params\" must be an object.');else this.b={};return this};S.prototype.setQuery=S.prototype.zf;S.prototype.i=function(){return!mm(this)};S.prototype.hasQuery=S.prototype.i;\nS.prototype.s=function(){return this.b};S.prototype.getQuery=S.prototype.s;S.prototype.j=function(a){if(a&&isNaN(parseInt(a,10)))throw Error('Parameter \"port\" must be a number or undefined');this.f=+a||void 0;return this};S.prototype.setPort=S.prototype.j;S.prototype.v=function(){return this.f};S.prototype.getPort=S.prototype.v;S.prototype.l=function(a){this.a=a||void 0;return this};S.prototype.setAnchor=S.prototype.l;S.prototype.A=function(){return this.a};S.prototype.getAnchor=S.prototype.A;\nS.prototype.$=function(a){if(\"object\"!==typeof a)throw Error('Parameter \"other\" must be an object.');var b=this.b,c;for(c in a)a.hasOwnProperty(c)&&\"function\"!==typeof a[c]&&(b[c]=a[c]);return this};S.prototype.mergeQuery=S.prototype.$;S.prototype.xa=function(a){if(!a||\"string\"!==typeof a)throw Error('Parameter \"subDomain\" must be a non-empty string');\".\"===a.substr(a.length-1)&&(a=a.substr(0,a.length-1));return this.nd(a+\".\"+this.vc)};S.prototype.addSubDomain=S.prototype.xa;\nS.prototype.R=function(a){if(!a||\"string\"!==typeof a)throw Error('Parameter \"subPath\" must be a non-empty string');return this.mc((this.c?this.c+\"/\":\"\")+a)};S.prototype.addSubPath=S.prototype.R;S.prototype.toString=function(){return[this.g+\"://\",this.vc,this.f?\":\"+this.f:\"\",this.c||!mm(this)||this.a?\"/\":\"\",this.c?encodeURI(this.c):\"\",nm(this),this.a?\"#\"+encodeURIComponent(this.a):\"\"].join(\"\")};S.prototype.toString=S.prototype.toString;\nfunction nm(a){var b=[],c,d=a.b,e;for(c in d)d.hasOwnProperty(c)&&\"function\"!==typeof d[c]&&(e=a.b[c],b.push(encodeURIComponent(c)+(void 0===e?\"\":\"=\"+encodeURIComponent(e))));return 0<b.length?\"?\"+b.join(\"&\"):\"\"}function mm(a){var b,c=0;for(b in a.b)if(a.b.hasOwnProperty(b)&&\"function\"!==typeof a.b[b]&&(c++,0<c))break;return!c};function om(a){function b(b){d.contains(e)&&d.removeChild(e);l&&clearTimeout(l);delete om.a[f];b&&a.Zc&&a.Zc.call(k,b)}if(!a.url||!a.oc)throw Error('Parameter \"options\" must specify at least a URL and a callback.');if(\"function\"!==typeof a.oc)throw Error(\"Parmaters options.callback must be a function\");var c=a.Ui||document,d=c.getElementsByTagName(\"head\")[0],e=c.createElement(\"script\"),c=a.url instanceof S?a.url:km(a.url,a.Ti),f=om.c++,g=a.xd||\"callback\",h=a.oc,k={},l=null;k.id=f;k.cancel=function(){b(\"cancelled\")};\n0!==a.timeout&&(l=w.setTimeout(function(){b(\"timeout\")},a.timeout||3E4));om.a[f]=function(a){b();h.call(k,a)};e.type=\"text/javascript\";e.src=c.toString()+(c.i()?\"&\":\"?\")+g+\"=\"+(a.rf?\"H.service.jsonp.handleResponse(\"+f+\")\":encodeURI(\"H.service.jsonp.handleResponse(\"+f+\")\"));d.appendChild(e);return k}r(\"H.service.jsonp\",om);om.b=function(a){return(a=om.a[a])?a:function(){}};om.handleResponse=om.b;om.c=0;om.a={};function pm(a){a=a||{};this.F=a.subDomain;this.c=a.path;this.N=a.callbackKey;this.f=a.baseUrl}r(\"H.service.AbstractRestService\",pm);pm.prototype.W=function(a,b,c,d,e){this.a=(e||this.f).clone();this.F&&this.a.xa(this.F);this.c&&this.a.mc(this.c);c&&this.a.ce(\"https\");return this};pm.prototype.configure=pm.prototype.W;pm.prototype.aa=function(){return this.a};\nfunction qm(a,b,c,d){if(!sa(c))throw Error(\"onResult callback needed\");if(!sa(d))throw Error(\"onError callback needed\");return om({url:b,oc:function(a){c(a)},Zc:function(a){d(Error(\"[\"+a+\"] \"+b+\" request failed\"))},xd:a.N})};function U(a){a=rm(sm,a);this.v(a.baseUrl);this.c(a.useCIT);this.g(a.useHTTPS);tm(this,a.app_id,a.app_code);this.a={}}r(\"H.service.Platform\",U);function tm(a,b,c){a.l=b;a.i=c;a.f.$({app_id:b,app_code:c})}U.prototype.W=function(a){if(a.configure)return a.configure(this.l,this.i,this.B,this.s,this.f);throw Error(\"Object is not configurable\");};U.prototype.configure=U.prototype.W;U.prototype.g=function(a){this.B=a;this.f.ce(a?\"https\":\"http\")};U.prototype.setUseHTTPS=U.prototype.g;\nU.prototype.c=function(a){this.s=a;this.f.nd((a?\"cit.\":\"\")+this.A)};U.prototype.setUseCIT=U.prototype.c;U.prototype.v=function(a){this.A=a.vc;this.f=a=a.clone();a.$({xnlp:\"CL_JSMv3.\"+sl().version});this.c(this.s);this.g(this.B);tm(this,this.l,this.i)};U.prototype.setBaseUrl=U.prototype.v;U.prototype.C=function(){return this.f};U.prototype.getBaseUrl=U.prototype.C;var sm={app_id:null,app_code:null,useHTTPS:!1,useCIT:!1,baseUrl:new S(\"http\",\"api.here.com\")};\nr(\"H.service.setOptions\",function(a,b){sm[a]=b});r(\"H.service.getOptions\",function(a){return sm[a]});function rm(a,b){var c=b||{},d;for(d in a)!a.hasOwnProperty(d)||d in c||(c[d]=a[d]),b&&b.hasOwnProperty(d)&&(c[d]=b[d]);return c};function um(a){a=rm(sm.trafficIncidents,a);a.callbackKey=\"jsoncallback\";um.u.constructor.call(this,a)}v(um,pm);r(\"H.service.TrafficIncidentsService\",um);um.prototype.W=function(a,b,c,d,e){um.u.W.apply(this,[a,b,c,d,e]);this.f&&(this.a=this.f.clone());return this};um.prototype.configure=um.prototype.W;um.prototype.g=function(a,b,c){a=this.aa().clone().R(\"incidents.json\").$(a);return qm(this,a,b,c)};um.prototype.requestIncidents=um.prototype.g;\num.prototype.b=function(a,b,c,d,e,f){a=this.aa().clone().R([\"incidents/json\",c,a,b].join(\"/\")).$(f||{});return qm(this,a,d,e)};um.prototype.requestIncidentsByTile=um.prototype.b;sm.trafficIncidents={subDomain:\"traffic\",path:\"traffic/6.1\"};U.prototype.o=function(){return this.W(new um)};U.prototype.getTrafficIncidentsService=U.prototype.o;function vm(){this.Ff={}}function wm(a){var b,c=a.boxes,d,e;this.label=a.label;this.min=a.minLevel;this.max=a.maxLevel;this.b=[];if(c&&(b=c.length))for(d=c[0],e=new G(d[0],d[1],d[2],d[3]),this.b.push(e),this.a=new G(d[0],d[1],d[2],d[3]),a=1;a<b;a++)d=c[a],e=new G(d[0],d[1],d[2],d[3]),this.b.push(e),this.a.wb(e,!1,this.a)}wm.prototype.xc=function(a,b){var c;if(a>=this.min&&a<=this.max)if((c=this.b.length)&&this.a){if(this.a.xc(b))for(;c--;)if(this.b[c].xc(b))return!0}else return!0;return!1};function xm(a){var b=0,c,d,e=a.length;if(0===e)return b;for(c=0;c<e;c++)d=a.charCodeAt(c),b=(b<<5)-b+d,b|=0;return b}var ym=Function(\"return this\")();function zm(a,b){function c(){k=Aa();te.font=g;h=Math.round(te.measureText(\"BESbswyMi\").width);-1===e.indexOf(h)?b():3E5<k-d?b(\"timeout\"):(l=50*++f,ym.setTimeout(c,Math.min(l,d+3E5-k)))}var d=Aa(),e=Am(),f=0,g=\"35px \"+a+\",\"+Bm.join(\",\"),h,k,l;-1!==Bm.indexOf(a)?b():ym.setTimeout(c,50)}\nfunction Cm(a,b){function c(a){a?b(a):0===--d&&b()}var d=a.length;a.forEach(function(a){zm(a,c)})}var Bm=Ra(\"monospace serif\");function Am(){var a=[];Bm.forEach(function(b){te.font=\"35px \"+b;a.push(Math.round(te.measureText(\"BESbswyMi\").width))});return a}function Dm(a,b){var c=b||document,d=c.createElement(\"style\"),e;d.appendChild(c.createTextNode(\"\"));c.head.appendChild(d);e=d.sheet;a.forEach(function(a,b){e.insertRule(a,b)});return d}function Em(){}\nEm.prototype.pop=function(a){this[a]||(this[a]=[]);return this[a].pop()||ym.document.createElement(\"canvas\")};Em.prototype.push=function(a,b){this[b]||(this[b]=[]);this[b].push(a)};var Fm=new Em;function Gm(a,b,c,d,e,f,g){var h=this;g=g||{};f=f?f:{};var k=a.aa().clone().R(b+\"/\"+a.Cb()+\"/\"+c).$(f),l=a.i;this.service_=a;this.tileBaseUrl_=k;Pk.call(this,{tileSize:d,max:512===d?19:20,min:512===d?2:0,getURL:function(a,b,c){var f=h.tileBaseUrl_.clone();l&&f.xa(l[(c+b+a)%l.length]);f.R(c+\"/\"+a+\"/\"+b+\"/\"+d+\"/\"+e);return f.toString()},crossOrigin:g.crossOrigin,uri:k.toString().replace(/_/g,\"\")+d});this.tileType_=b;this.scheme_=c;this.params_=f;this.copyrightKey_=c.split(\".\")[0];this.C=z(this.C,this);\nthis.getCopyrights=this.Ia;this.U=wc();a.addEventListener(\"versionupdate\",this.C)}v(Gm,Pk);Gm.prototype.MAX_STORE_TIME=2592E6;Gm.prototype.D=function(){Pk.prototype.D.call(this);this.service_.removeEventListener(\"versionupdate\",this.C)};Gm.prototype.Ia=function(a,b){var c=this.service_.Ia().Ff[this.copyrightKey_],d,e=c?c.length:0,f=[];for(d=0;d<e;d++)c[d].xc(b,a)&&f.push(c[d]);return f};\nGm.prototype.C=function(){var a=this.service_;this.tileBaseUrl_=a.aa().clone().R(this.tileType_+\"/\"+a.Cb()+\"/\"+this.scheme_).$(this.params_);this.j(!1)};Gm.prototype.Rc=function(){return this.U};r(\"H.service.MapTileProvider.prototype.canStore\",Gm.prototype.Rc);Gm.prototype.B=function(){return this.Rc()?vc():N.prototype.B.call(this)};r(\"H.service.MapTileProvider.prototype.getStorage\",Gm.prototype.B);function Hm(a){a=rm(sm.maptile,a);I.call(this);this.f=a.baseUrl;this.c=a.path;this.m=a.subDomain;this.i=a.shards;this.ra=(this.s=!!a.ignoreTypes)?null:a.type;this.g=a.version;this.j=new vm;this.o={};this.Ad=0}v(Hm,I);r(\"H.service.MapTileService\",Hm);function Im(a,b){for(var c={},d=a[b+\"s\"][b],e=d.length;e--;)c[d[e].id]=d[e];a[b+\"s\"]=c}\nHm.prototype.W=function(a,b,c,d,e){this.a=(this.f||e).clone();this.m&&this.a.xa(this.m);this.ra&&this.a.xa(this.ra);this.c&&this.a.mc(this.c);\"newest\"===this.g&&Jm(this);return this};Hm.prototype.configure=Hm.prototype.W;Hm.prototype.aa=function(){return this.a};Hm.prototype.A=function(){return this.ra};Hm.prototype.getType=Hm.prototype.A;Hm.prototype.Cb=function(){return this.g};Hm.prototype.getVersion=Hm.prototype.Cb;\nHm.prototype.Ia=function(){this.Ad||(this.g&&\"newest\"!==this.g||\"traffic\"===this.ra)&&Km(this);return this.j};Hm.prototype.getCopyrights=Hm.prototype.Ia;\nfunction Jm(a){var b=a.aa().clone().R(\"info\").$({output:\"json\"});a.i&&b.xa(a.i[0]);om({url:b,xd:\"callback_func\",oc:function(b){b=JSON.parse(b.replace(/,\\s?\\]/g,\"]\")).response;var d;Im(b,\"map\");Im(b,\"scheme\");Im(b,\"tiletype\");Im(b,\"format\");Im(b,\"resolution\");Im(b,\"language\");if(\"newest\"===a.g&&\"traffic\"!==a.ra)for(d in b.maps)b.maps[d].hash&&b.maps[d].newest&&(a.g=b.maps[d].hash,a.dispatchEvent(\"versionupdate\"));a.l=b;a.dispatchEvent(\"infoupdate\")},Zc:function(a){throw Error(\"[\"+a+\"]: Could not fetch meta-info from map tile service @ \"+\nb.toString());},rf:!0})}function Km(a){var b=a.aa().clone().R(\"copyright\").R(a.Cb()).$({output:\"json\"});a.i&&b.xa(a.i[0]);a.Ad=1;om({url:b,xd:\"callback_func\",oc:function(b){this.Ad=2;b=JSON.parse(b);var d=a.j,e;for(e in b)if(b.hasOwnProperty(e))for(var f=b[e],g=d.Ff[e]||(d.Ff[e]=[]),h=void 0,k=f.length,h=0;h<k;h++)g.push(new wm(f[h]));a.dispatchEvent(\"copyrightupdate\")},Zc:function(a){this.Ad=-1;throw Error(\"[\"+a+\"]: Could not fetch copyrights from map tile service @\"+b.toString());},rf:!0})}\nHm.prototype.B=function(){return this.l};Hm.prototype.getInfo=Hm.prototype.B;Hm.prototype.v=function(a,b,c,d,e,f){var g;g=xm(this.aa().clone().R(a+\"/\"+this.Cb()+\"/\"+b+\"/\"+c+\"/\"+d).$(e?e:{}).toString());var h=this.o[g];h||(h=new Gm(this,a,b,c,d,e,f),this.o[g]=h);return h};Hm.prototype.createTileProvider=Hm.prototype.v;Hm.prototype.b=function(a,b,c,d,e,f,g,h){a=this.v(a,b,c,d,e,h);return new oh(a,{opacity:f,dark:!!g})};Hm.prototype.createTileLayer=Hm.prototype.b;\nsm.maptile={type:\"base\",version:\"newest\",subDomain:\"maps\",path:\"maptile/2.1\",shards:[\"1\",\"2\",\"3\",\"4\"]};U.prototype.b=function(a){var b;b=rm(sm.maptile,a);var c;c=\"\"+(b.ignoreTypes?\"\":b.type);c+=b.path;c+=b.subDomain;c+=b.baseUrl;c+=b.shards?b.shards.join(\"\"):\"\";b=xm(c);c=this.a[b];c||(c=this.W(new Hm(a)),this.a[b]=c);return c};U.prototype.getMapTileService=U.prototype.b;function Lm(a){this.f=a;this.hb=this.a(\"general\",\"default\")||Mm;this.c=new Vg(200)}Lm.prototype.b=function(a,b){var c,d,e,f,g;for(g=1;g<arguments.length;g++)for(c in d=arguments[g],d)if(d.hasOwnProperty(c))for(e in a[c]||(a[c]={}),f=d[c],f)f.hasOwnProperty(e)&&void 0!==f[e]&&(a[c][e]=f[e]);return a};Lm.prototype.Na=function(a,b){var c=this.a(\"spaceToGroup\",b);return Nm(this,a,c?c+\"\":void 0)};\nfunction Nm(a,b,c){var d,e,f;f=(b?b+\"_\":\"\")+(c?c:\"default\");d=a.hb;(e=a.c.get(f))?d=e:(b&&c?(d=Nm(a,b,void 0),e=Nm(a,void 0,c),b=a.a(\"venues\",b,\"groups\",c),d=a.b({},a.hb,d,e,b)):b&&!c?d=a.b({},a.hb,a.a(\"venues\",b,\"default\")):!b&&c&&(d=a.b({},a.hb,a.a(\"general\",\"groups\",c))),a.c.add(f,d,1));return d}Lm.prototype.a=function(a){for(var b=this.f,c=arguments,d=c.length,e=0;e!==d;)if(b=b[c[e++]],!b)return;return b};\nvar Mm={space:{fillColor:\"rgba(198, 175, 255, .7)\",strokeColor:\"rgb(162, 141, 216)\",lineWidth:.5},spaceLabel:{fillColor:\"rgb(78,66,111)\"},floor:{fillColor:\"rgba(249, 244, 253, .7)\",strokeColor:\"rgba(255, 255, 255, .7)\",lineWidth:1}};function Om(a,b,c,d,e,f,g,h){this.Ta=[];this.A={};Yk.call(this,a,b,c,d,e,f,g,h)}v(Om,Yk);function Pm(){}Pm.prototype.Ib=function(){};r(\"H.service.remote.IObject.prototype.retain\",Pm.prototype.Ib);Pm.prototype.v=function(){};r(\"H.service.remote.IObject.prototype.release\",Pm.prototype.v);function Qm(a,b){var c={};this.I=a;Ca(c,b||c);Kk.call(this,c);this.lc={};Rm(this)}v(Qm,Kk);r(\"H.service.remote.ObjectProvider\",Qm);Qm.prototype.J=function(){Kk.prototype.J.call(this)};function Rm(a){a=a.N(Pe.SPATIAL);a.c(a.a+1,Me.ADD)}var Sm=[];Qm.prototype.c=function(){return Sm};Qm.prototype.requestMarkers=Qm.prototype.c;Qm.prototype.b=function(){return Sm};Qm.prototype.requestDomMarkers=Qm.prototype.b;Qm.prototype.l=Be;Qm.prototype.providesMarkers=Qm.prototype.l;Qm.prototype.i=Be;\nQm.prototype.providesDomMarkers=Qm.prototype.i;Qm.prototype.s=function(){return!0};Qm.prototype.providesSpatials=Qm.prototype.s;Qm.prototype.m=function(){return Sm};Qm.prototype.requestSpatials=Qm.prototype.m;function Tm(a){return a.getVisibility(!0)}Qm.prototype.g=function(a,b){var c=Um(this,a,Vm);b&&(c=c.filter(Tm));return c};Qm.prototype.requestSpatialsByTile=Qm.prototype.g;function Um(a,b,c){var d=b.i&&b.i[c],e;!d&&(e=b.v)&&(delete b.v,(b.i=a=a.I.parse(a,b,e))&&(d=a[c]));return d||Sm}\nQm.prototype.V=function(a){var b=a.ta();if(this.lc[b])throw new kc(this.V,\"Remote object \"+b+\" already added\");return this.lc[b]=a};Qm.prototype.a=function(a){delete this.lc[a.ta()]};var Vm=\"spatials\";function Wm(a,b,c){Qm.call(this,b,c);this.f=a;this.responseQueue_=[];Xm(this.f)||(this.Vd=z(this.Vd,this),this.f.addEventListener(\"statechange\",this.Vd));this.v=a.m;this.j=0;this.B={onSpaceCreated:c&&c.onSpaceCreated,floorLevel:0,styler:null};this.requestSpatialsByTile=z(this.g,this)}v(Wm,Qm);Wm.prototype.T=function(a,b,c,d){this.vf?this.Ug.apply(this,arguments):d||this.responseQueue_.push({Ci:a,response:c,Vh:b});d&&(a.A[b]=!0)};function Ym(a){return a.getVisibility(!0)}\nWm.prototype.g=function(a,b,c){var d;this.$g||Zm(this);d=a.a;b&&(d=d.filter(Ym));if(!c){b=this.j;var e,f,g,h;if(!a.A[b]&&Xm(this.f)){e=this.f.aa();c=a.x;f=a.y;h=g=a.z;for(var k=1,l;h--;)l=1<<h,k*=4,k+=(c&l&&1)|(f&l&&2);h=k.toString(4).substr(1);e=e.clone().R(\"0/tiles-ia\").R(\"L\"+b).R(h+\".json\");this.v&&e.xa(this.v[(c+f+g)%this.v.length]);c=new Gh(\"text/plain\",e.toString());c.then(z(this.T,this,a,b),sc);a.A[b]=!0}a.A[this.j]=!0}a.l&&(d=d.concat(a.l),delete a.l);return d};\nr(\"H.service.venues.ObjectProvider.prototype.requestSpatialsByTile\",Wm.prototype.g);p=Wm.prototype;p.Kc=function(a){var b,c,d;for(b in this.lc)for(c in d=this.lc[b].C,d)d[c].Kc(a);Rm(this);Rg(this);this.j=a};p.Ug=function(a,b,c,d){if(!d&&(this.B.floorLevel=b,b=(b=this.I.parse(this,a,c,this.B))&&b.spatials))for(a.l=a.l?a.l.concat(b):b,a=b.length;a--;)b[a].ua(Me.ADD)};p.Vd=function(){Xm(this.f)&&($m(this),this.f.removeEventListener(\"statechange\",this.Vd))};\nfunction $m(a){Xm(a.f)&&a.vf&&a.dispatchEvent(\"reload\")}function Zm(a){a.$g=!0;an(a,function(b,c){c?a.dispatchEvent(\"error\"):(a.B.styler=b,bn(a,z(a.si,a)))})}p.si=function(a){a?this.dispatchEvent(\"error\"):(this.responseQueue_.forEach(function(a){this.Ug(a.Ci,a.Vh,a.response)},this),this.responseQueue_=null,this.vf=!0,$m(this))};p.$g=!1;p.vf=!1;function an(a,b){(new Gh(\"application/json\",a.f.l.clone().R(\"styles/styles.json\").toString())).then(function(a){b(new Lm(a))},function(a){b(null,a)})}\nvar cn=0;\nfunction bn(a,b){var c=a.f.l.clone().R(\"fonts\"),d=document,e=[],f,g=[];2===cn?b():(dn.forEach(function(a){g.push(\"FiraGO-Regular\".replace(\"{name}\",a))}),1!==cn&&(dn.forEach(function(a,b){f=c.clone().R(g[b]);e.push('@font-face {font-family: \"FiraGO-Regular\";src: url(\"{url}.woff2\") format(\"woff2\"),url(\"{url}.woff\") format(\"woff\"),url(\"{url}.ttf\") format(\"truetype\");font-weight: normal;font-style: normal;}'.replace(/\\{name\\}/g,a).replace(/\\{url\\}/g,f.toString()))}),a.A=Dm(e,d),cn=1),Cm(g,function(c){cn=c?\n0:2;c&&a.A&&Ge(a.A);b(c)}))}var dn=[\"\"];function en(a,b,c,d){P.call(this,fn(a));this.i=c;this.f=d;this.o={};this.Za=b;this.c=0}v(en,P);r(\"H.service.venues.Building\",en);en.prototype.ta=function(){return this.Za};en.prototype.getId=en.prototype.ta;en.prototype.wa=function(){return this.Da};en.prototype.getVenue=en.prototype.wa;en.prototype.sa=function(){return this.i};en.prototype.getMinLevel=en.prototype.sa;en.prototype.Ya=function(){return this.f};en.prototype.getMaxLevel=en.prototype.Ya;en.prototype.Va=function(){return this.c};\nen.prototype.getCurrentLevel=en.prototype.Va;en.prototype.Kc=function(a){var b,c,d;if(!isNaN(a)&&(b=this.i,c=this.f,a!==this.c))for(this.c=a;b<=c;b++)(d=this.o[b])&&d.setVisibility(b===a);return this.c};en.prototype.ad=function(a){return this.o[a]};en.prototype.getFloor=en.prototype.ad;en.prototype.ba=function(a,b){this.i=Math.min(this.i,a);this.f=Math.max(this.f,b)};en.prototype.adjustMinMaxLevels=en.prototype.ba;function gn(a,b){P.call(this,fn(a));this.C={};this.f=b;a.V(this)}v(gn,P);r(\"H.service.venues.Venue\",gn);gn.prototype.N=function(a){return this.C[a]};gn.prototype.getBuilding=gn.prototype.N;gn.prototype.c=function(){return this.C};gn.prototype.getBuildings=gn.prototype.c;gn.prototype.ta=function(){return this.f};gn.prototype.getId=gn.prototype.ta;function hn(a,b,c,d){d=d||jn;this.Ic={};d.provider=a;this.invalidate=sc;hn.u.constructor.call(this,b,d);delete this.invalidate;c&&(this.f=c);this.ua(Me.ADD)}v(hn,Gf);r(\"H.service.remote.Spatial\",hn);var jn={};hn.prototype.ta=function(){return this.f||Gf.prototype.ta.call(this)};hn.prototype.getId=hn.prototype.ta;hn.prototype.Ib=Function();hn.prototype.retain=hn.prototype.Ib;hn.prototype.v=Function();hn.prototype.release=hn.prototype.v;function kn(a,b){this.a=a;b&&(this.b=b)}var ln=new kn([]);\nhn.prototype.ec=function(a){return(this.Ic[a.key]||ln).a};hn.prototype.getGeometriesForTile=hn.prototype.ec;hn.prototype.ba=function(a){return(this.Ic[a.key]||ln).b};hn.prototype.getLabels=hn.prototype.ba;function mn(a,b,c,d){a.Ic[b.key]=new kn(c,d)};function nn(a,b,c){this.ra=c&&c.type||\"\";hn.call(this,a,!0,b);this.g(c)}v(nn,hn);r(\"H.service.venues.Space\",nn);nn.prototype.i=function(){return this.ra};nn.prototype.getType=nn.prototype.i;nn.prototype.c=function(){return\"floor/polygon\"===this.ra};nn.prototype.isFloorSpace=nn.prototype.c;nn.prototype.b=function(a){a&&(this.ai=new zf(a))};nn.prototype.initLabelStyle=nn.prototype.b;nn.prototype.ad=function(){var a=this.Da;return this.isFloorSpace()?a:a&&a.Da};nn.prototype.getFloor=nn.prototype.ad;\nnn.prototype.a=0;nn.prototype.Ib=function(){++this.a};nn.prototype.retain=nn.prototype.Ib;nn.prototype.v=function(){var a=--this.a,b;a||(b=this.ad(),this.isFloorSpace()?b.ib&&(b.a(b.ib),b.ib=null,on(b)):b&&(delete b.i[this.ta()],b.c.a(this),on(b)));return 1>a};nn.prototype.release=nn.prototype.v;function pn(){}pn.prototype.parse=function(){};r(\"H.service.remote.IParser.prototype.parse\",pn.prototype.parse);function qn(a,b,c){P.call(this,fn(a));this.f=c;this.ib=new nn(a,b.id,b);this.V(this.ib);this.c=new P(fn(a));this.V(this.c);this.i={}}v(qn,P);r(\"H.service.venues.Floor\",qn);qn.prototype.sa=function(){return this.f};qn.prototype.getLevel=qn.prototype.sa;qn.prototype.o=function(){return this.ib};qn.prototype.getFloorSpace=qn.prototype.o;qn.prototype.ba=function(){return this.c};qn.prototype.getSpaces=qn.prototype.ba;qn.prototype.N=function(){return this.Da};qn.prototype.getBuilding=qn.prototype.N;\nqn.prototype.getData=function(){return this.ib&&this.ib.getData()};qn.prototype.getData=qn.prototype.getData;qn.prototype.g=function(a){this.ib.g(a);return this};qn.prototype.setData=qn.prototype.g;qn.prototype.jg=function(a){return this.i[a]};qn.prototype.getSpace=qn.prototype.jg;function on(a){if(!a.c.b&&!a.ib){var b=a.N(),c=a.f;c===b.c&&(b.c=0);delete b.o[c];b.a(a);b.b||(a=b.Da,delete a.C[b.ta()],a.a(b),a.b||a.Pa().a(a))}};function rn(){}var sn;rn.prototype.a=Math.PI/180;function tn(a,b){return a&&a.category&&a.category[b||\"id\"]}function un(a){var b,c;return a.sort(function(a,e){b=a.object.type;c=e.object.type;return b>c?-1:b<c?1:0})}\nrn.prototype.parse=function(a,b,c,d){var e=d.floorLevel,f=d.onSpaceCreated;d=d.styler;var g=[],h,k,l,m,n,q,t,u,y,J={};sn=!1;c=c.replace(/''( )?/g,'$1\\\\\"');try{c=ym.JSON.parse(c)}catch(T){sn=!0}if(c.length)for(c=un(c),h=c.length;h--;){k=c[h];l=k.area;n=l.length;t=u=q=void 0;(u=0<n)||(sn=!0,u=void 0);if(u)for(q=Array(n/2);n;)t=l[--n],u=l[--n],q[n/2]=new M(u,t);l=q?{Ra:[q]}:A;k=k.object;u=y=x;if(1!==k.type)switch(n=k.type.replace(\"/polygon\",\"\"),n){case \"floor\":n=q=k.buildingId;(u=a.lc[n])||(u=new gn(a,\nn),u.ia(a));t=k.buildingMinLevel;y=k.buildingMaxLevel;(n=u.N(q))?n.adjustMinMaxLevels(t,y):(n=new en(a,q,t,y),q=u,u=n,q.C[u.ta()]=u,q.V(u),n.Kc(a.j));0>b.Ta.indexOf(n)&&b.Ta.push(n);(q=n.ad(e))?(n=q.ib,u=n.ec(b),u.length&&(l?l.Ra=u[0].Ra.concat(l.Ra):l=u[0])):(u=q=new qn(a,k,e),t=u.f,u.setVisibility(t===n.c),n.o[t]=u,n.V(u),n=q.ib,f&&f(n),t=tn(q.getData(),\"profileKey\"),y=d.Na(t,void 0),n.O(y.floor));J[k.id]=q;0>g.indexOf(n)&&g.push(n);l&&mn(n,b,[l]);break;case \"hollow\":u=\"hollow-area\";case \"space\":if(m=\nk.id,q=J[/_d$/.test(k.outerAreaId)?k.outerAreaId:k.outerAreaId+\"_d\"])n=q.jg(m),t=tn(q.getData(),\"profileKey\"),u=u||tn(n?n.getData():k),n||(y=n=new nn(a,m,k),q.i[y.ta()]=y,q.c.V(y),y=d.Na(t,u),n.O(y.space),f&&f(n)),n.Ib(),(k=k.label)&&k.firstLinePos?(y=y||d.Na(t,u),q=n.ai,q=[{lines:Ra(k.text,\"\\n\"),angle:k.rotation*this.a,font:\"FiraGO-Regular\",size:k.font.size,lineHeight:k.font.lineHeight,color:q&&q.fillColor||y.spaceLabel.fillColor,x:k.firstLinePos[0],y:k.firstLinePos[1]}],\"nokiapuretextac_rg-webfont\"===\nk.font.face&&(q[0].size=Math.floor(k.font.size/1.26))):q=null,g.push(n),l&&mn(n,b,[l],q)}}else sn=!0;return sn?void 0:{spatials:g}};r(\"H.service.venues.Parser.prototype.parse\",rn.prototype.parse);function vn(a,b){var c=b||{};if(!(a&&a instanceof wn))throw Error(\"InvalidArgument: service required\");this.Ye=z(this.Ye,this);this.b=new Wm(a,new rn,{min:16,max:20,onSpaceCreated:c.onSpaceCreated});this.b.ia(this);this.Xe=z(this.Xe,this);this.b.addEventListener(\"update\",this.Xe);this.lf=z(this.lf,this);this.b.addEventListener(\"reload\",this.lf);this.kf=z(this.kf,this);this.b.addEventListener(\"error\",this.kf);this.Ze=c.pixelRatio||c.pixelratio||1;this.tileSize=256;this.f=Tg(this.tileSize,this.Ze);\nN.call(this,{min:16,max:20});this.N(new Vg(c.tileCacheSize||256,z(this.Ye,this)))}v(vn,N);r(\"H.service.venues.TileProvider\",vn);p=vn.prototype;p.Ze=1;p.Xe=function(){this.dispatchEvent(\"update\")};p.kf=function(){this.dispatchEvent(\"error\")};p.lf=function(){this.j(!0)};p.Ye=function(a,b){var c,d,e;c=b.a;for(e=c.length;e--;)d=c[e],delete d.Ic[b.key],d.v();b.data&&Fm.push(b.o(),this.tileSize);b.m()};p.Kc=function(a){this.b.Kc(a)};vn.prototype.setCurrentLevel=vn.prototype.Kc;vn.prototype.C=function(){return this.b.j};\nvn.prototype.getCurrentLevel=vn.prototype.C;vn.prototype.c=function(a,b,c,d){var e;this.g.get(this.getTileKey(a,b,c))?d(null,null):e=ym.setTimeout(function(){d(null,null)},500);return{cancel:function(){ym.clearTimeout(e)}}};vn.prototype.requestInternal=vn.prototype.c;vn.prototype.P=function(a,b,c){var d=Fm.pop(this.tileSize),e=this.g.get(this.getTileKey(a,b,c));e||(e=new Om(this.A(a,b,c),a,b,c,this.tileSize,this.Ze,c+this.f,this.b));e.ca(d)||Fm.push(d,this.tileSize);return e};\nvn.prototype.createTileInternal=vn.prototype.P;function wn(a){var b=sm.venues;a=rm(b,a||{});I.call(this);this.f=b.baseUrl;this.c=a.path;this.g=a.subDomain;this.m=b.shards}v(wn,I);r(\"H.service.venues.Service\",wn);var xn={ERROR:-1,INIT:0,READY:1};wn.State=xn;\nwn.prototype.W=function(a,b,c,d,e){this.a=(this.f||e).clone();this.l=this.a.clone().xa(\"js\").R(\"statics/venues\").zf();this.g&&this.a.xa(this.g);this.ra&&this.a.xa(this.ra);this.c&&this.a.mc(this.c);a=sm.venueSignature;b=this.a.clone();b.xa(a.subDomain);b.R(a.path);b.R(a.version);this.v=b;this.o=this.a.clone();this.G===xn.INIT&&this.b();return this};wn.prototype.configure=wn.prototype.W;function Xm(a){return a.G===xn.READY}wn.prototype.aa=function(){return Xm(this)?this.a:void 0};\nwn.prototype.b=function(){var a=this;(new Gh(\"application/json\",this.v.toString())).then(function(b){var c=b.SignatureTokens,d=(b=new Date(b.Expires))?b.getTime()-Aa()-36E5:0;a.a.$(c);b&&4E9>d&&ym.setTimeout(z(a.b,a),Math.max(d,0));yn(a,xn.READY)},function(){yn(a,xn.ERROR,\"Error fetching signature\")})};\nwn.prototype.j=function(a,b,c){var d=sm.venuesDiscovery;a=this.o.clone().xa(d.subDomain).R(d.path).R(d.version).$(rm(a,d.params));(new Gh(\"application/json\",a.toString())).then(b,function(a){a.json().then(function(a){c(a.status.message)},function(){c(a.statusText)})})};wn.prototype.discover=wn.prototype.j;wn.prototype.i=function(a){return new oh(new vn(this,a))};wn.prototype.createTileLayer=wn.prototype.i;wn.prototype.G=xn.INIT;wn.prototype.getState=function(){return this.G};\nwn.prototype.getState=wn.prototype.getState;function yn(a,b,c){var d=new Bc(\"statechange\",a);c&&(d.errorCode=c);a.G=b;a.dispatchEvent(d)}U.prototype.m=function(a){return this.W(new wn(a))};U.prototype.getVenueService=U.prototype.m;var zn={subDomain:\"venue.maps\",path:\"\",shards:Ra(\"1 2 3 4\").map(function(a){return\"static-\"+a})};sm.venues=zn;sm.venueSignature={version:\"v1\",subDomain:\"signature\",path:\"venues/signature\"};sm.venuesDiscovery={version:\"v1\",subDomain:\"discovery\",path:\"venues/discovery\"};var An={};function fn(a){An.provider=a;return An};function Bn(){this.a={}}Bn.prototype.sb=function(a,b){var c=a+b,d,e,f;if(!(d=this.a[c])){f={size:{w:26,h:32},anchor:{x:13,y:30}};if(\"CLOSURE\"!==a)switch(d=Cn,a){case \"CONGESTION\":d=d.replace(\"{{icon}}\",Dn);break;case \"ROADWORKS\":d=d.replace(\"{{icon}}\",En);break;case \"ACCIDENT\":d=d.replace(\"{{icon}}\",Fn);break;default:d=d.replace(\"{{icon}}\",Gn)}else d=Hn,f.anchor.y=16;e=In[b]||In.BLOCKING;d=d.replace(\"{{color}}\",e);this.a[c]=d=new ri(d,f)}return d};\nvar In={BLOCKING:\"#323232\",VERYHIGH:\"#d5232f\",HIGH:\"#ffa100\"},Dn='<path d=\"m 18,15 0,0 c 0,-0.1 0,-0.2 0,-0.4 l 0,-0.2 c 0,-0.1 0,-0.2 0,-0.4 0,0 0,0 0,0 0.6,0 1.1,-0.4 1.1,-1 0,-0.5 -0.5,-1 -1,-1 -0.7,0 -1.1,0.5 -1.1,1 -0.1,0 -0.3,-0.1 -0.4,-0.1 l -0.6,0 -0.3,-0.5 C 15.2,11.6 14.3,11 13.3,11 L 18,11 17.2,9.6 C 17,9.3 16.7,9 16.3,9 L 12.8,9 C 12.4,9 12,9.3 11.8,9.6 L 11.1,11 9.8,11 C 9.7,11 9.6,11 9.5,11 9.2,11 9,10.9 9,10.6 L 9,10.4 C 9,10.2 9.2,9.9 9.5,9.9 l 1.2,0 0.6,-1.04 c 0.3,-0.5 0.9,-0.9 1.5,-0.9 l 3.5,0 c 0.6,0 1.2,0.4 1.5,0.9 l 0.6,1.04 1.2,0 c 0.2,0 0.4,0.3 0.4,0.5 l 0,0.2 c 0,0.3 -0.2,0.5 -0.4,0.5 l -0.1,0 c 0.3,0.3 0.5,0.7 0.5,1.1 l 0,3.4 c 0,0.2 -0.2,0.4 -0.4,0.4 l -1.1,0 C 18.3,16 18,15.8 18,15.6 L 18,15 z M 8,18.1 c 0.6,0 1.1,-0.5 1.1,-1.1 0,-0.5 -0.5,-1 -1.1,-1 -0.6,0 -1.1,0.5 -1.1,1 0,0.6 0.5,1.1 1.1,1.1 m 7,0 c 0.6,0 1.1,-0.5 1.1,-1.1 0,-0.5 -0.5,-1 -1.1,-1 -0.5,0 -1,0.5 -1,1 0,0.6 0.5,1.1 1,1.1 M 14.2,13.6 C 14,13.3 13.7,13 13.3,13 L 9.8,13 C 9.4,13 9,13.3 8.8,13.6 L 8.1,15 15,15 14.2,13.6 z m -8.2,1 0,-0.2 c 0,-0.2 0.2,-0.5 0.5,-0.5 l 1.1,0 0.7,-1 C 8.6,12.4 9.2,12 9.8,12 l 3.5,0 c 0.6,0 1.2,0.4 1.5,0.9 l 0.6,1 1.2,0 c 0.2,0 0.4,0.3 0.4,0.5 l 0,0.2 c 0,0.3 -0.2,0.5 -0.4,0.5 l -0.1,0 c 0.3,0.3 0.5,0.7 0.5,1.1 l 0,3.4 c 0,0.2 -0.2,0.4 -0.4,0.4 l -1.1,0 C 15.3,20 15,19.8 15,19.6 L 15,19 8,19 8,19.6 C 8,19.8 7.8,20 7.5,20 l -1,0 C 6.2,20 6,19.8 6,19.6 l 0,-3.4 c 0,-0.4 0.2,-0.8 0.6,-1.1 l -0.1,0 C 6.2,15.1 6,14.9 6,14.6\" fill=\"#ffffff\" />',\nEn='<path d=\"m 9.24,13.2 -3.7,6.8 1.3,0 2.8,-5.1 1.36,1.5 0,3.6 1.1,0 0,-4 -1.4,-1.6 -1.46,-1.2 z M 14.2,9.5 c 0.7,0 1.3,-0.5 1.3,-1.21 0,-0.7 -0.6,-1.2 -1.3,-1.2 -0.7,0 -1.2,0.5 -1.2,1.2 0,0.71 0.5,1.21 1.2,1.21 m -4.46,0.5 1.06,0 -0.96,2.1 -1,-0.8 0.9,-1.3 z m 2.56,4 -1,-0.7 1,-1.9 0,2.6 z m 6.9,1.7 c -0.4,-0.5 -1.5,-1.1 -2.3,0 -0.2,0.3 -0.6,0.7 -0.9,1.2 l -2.7,-2.1 0,-5 -0.8,-0.7 -3.26,0 -1.5,2.3 7.86,6 C 14.7,18.6 13.8,20 13.8,20 l 6,0 1.5,-1.6 c 0,0 -1.7,-2.2 -2.1,-2.7\" fill=\"#ffffff\" />',Fn=\n'<path d=\"m 10.2,15.9 c 0.4,-0.5 1,-0.5 1.4,0 0.5,0.4 0.5,1 0,1.4 -0.4,0.4 -1,0.4 -1.4,0 -0.45,-0.4 -0.45,-1 0,-1.4 m 4.9,-5 c 0.4,-0.4 1.1,-0.4 1.5,0 0.4,0.4 0.4,1.1 0,1.5 -0.4,0.4 -1.1,0.4 -1.5,0 -0.4,-0.4 -0.4,-1.1 0,-1.5 m 2.6,3.8 c 0.1,0.3 0,0.7 -0.3,1 l -1.9,1 c 0,0 0,0.8 0,1.1 0,0.3 0,0.2 -0.1,0.3 -0.1,0.1 -0.3,0.2 -0.5,0.2 l -2.6,-0.3 4.9,-4.9 0.5,1.6 z m -6.5,5 0.1,0.2 c 0.2,0.1 0.5,0.1 0.7,0 l 0.8,-0.9 1.8,0.1 c 1.1,0 1.4,0 1.7,-0.6 l 0.1,-1.3 1.8,-0.8 c 0.4,-0.4 0.6,-1.1 0.4,-1.7 l -0.3,-1.1 0.8,-0.8 c 0.2,-0.2 0.2,-0.5 0,-0.7 L 19,12 c -0.2,-0.2 -0.5,-0.2 -0.7,0 l -0.1,0.1 c 0.1,-0.5 -0.1,-0.9 -0.4,-1.3 L 15.5,8.44 C 15.3,8.26 15,8.26 14.8,8.44 l -0.7,0.74 c -0.2,0.19 -0.2,0.49 0,0.68 l 0.3,0.34 -4.92,5 -0.36,-0.4 C 8.93,14.6 8.63,14.6 8.45,14.8 L 7.7,15.6 c -0.18,0.1 -0.18,0.4 0,0.6 l 2.4,2.4 c 0.3,0.3 0.7,0.4 1.2,0.4 l -0.1,0.1 c -0.2,0.2 -0.2,0.5 0,0.7 m 5.6,-0.8 3.9,0 1.6,-2 -5.5,2 z m -8.08,0 -3.28,-1.8 0.9,1.8 2.38,0 z\" fill=\"#ffffff\" />',\nGn='<path d=\"m 12.9,15.1 c 0.6,0 1.1,-0.5 1.1,-1 l 0.4,-5.9 c 0,-0.6 -0.6,-1.04 -1.5,-1.04 -0.8,0 -1.4,0.44 -1.4,1.04 l 0.3,5.9 c 0,0.5 0.6,1 1.1,1 m 0,1.3 c -0.7,0 -1.3,0.6 -1.3,1.3 0,0.8 0.6,1.4 1.3,1.4 0.8,0 1.4,-0.6 1.4,-1.4 0,-0.7 -0.6,-1.3 -1.4,-1.3\" fill=\"#ffffff\" />',Cn='<svg width=\"26\" height=\"32\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m 16.8,29.4 c 0,-1.1 -1.8,-2 -4,-2 -2.2,0 -4.01,0.9 -4.01,2 0,1.1 1.81,2 4.01,2 2.2,0 4,-0.9 4,-2\" style=\"fill:#878787\"/><path d=\"m 24.1,17.8 c 1.6,-1.6 1.6,-3.8 0,-5.7 L 15.8,1.9 C 15,0.998 14,0.498 12.9,0.498 11.8,0.498 10.7,1.1 10,1.9 L 1.7,12.1 c -1.6,1.9 -1.6,4.1 0,5.7 L 12.9,29 24.1,17.8 z\" stroke=\"#fff\" stroke-width=\"1\" fill=\"{{color}}\" />{{icon}}</svg>',\nHn='<svg width=\"26\" height=\"32\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"13\" cy=\"15\" r=\"11\" fill=\"{{color}}\" stroke=\"#ffffff\" stroke-width=\"1\"/><rect x=\"6\" y=\"13\" width=\"14\" height=\"5\" fill=\"#ffffff\" /></svg>';function Jn(a,b,c){c=c?c:{};c.criticality||(c.criticality=\"major,critical\");if(!(a instanceof um))throw Error(\"IllegalArgument: service\");eh.call(this,{max:20,min:8,requestData:z(this.wa,this)});this.I=new Bn;this.P=a;this.b=c;this.j=z(this.j,this);this.U=setInterval(this.j,b||18E4)}v(Jn,eh);r(\"H.service.TrafficIncidentsProvider\",Jn);Jn.prototype.f={minor:\"HIGH\",\"low impact\":\"HIGH\",major:\"VERYHIGH\",critical:\"BLOCKING\"};\nJn.prototype.wa=function(a,b,c,d,e){var f=this,g=this.f,h=this.I;return this.P.b(a,b,c,function(a){var b=[];a=a.TRAFFIC_ITEMS;var c,e,q,t;if(a)for(a=a.TRAFFIC_ITEM,t=a.length;t--;){c=a[t];e=c.TRAFFIC_ITEM_TYPE_DESC;switch(e){case \"ACCIDENT\":case \"CONGESTION\":q=e;break;case \"CONSTRUCTION\":q=\"ROADWORKS\";break;default:q=\"OTHER\"}q=h.sb(q,g[c.CRITICALITY.DESCRIPTION]);e=c.LOCATION.GEOLOC.ORIGIN;e=new xi({lat:e.LATITUDE,lng:e.LONGITUDE},{provider:f,icon:q});e.g(c);b.push(e)}d(b)},e,this.b)};\nJn.prototype.J=function(){eh.prototype.J.call(this);clearInterval(this.U)};function Kn(a){var b;if(a)for(this.a={},b=a.length;b--;)this.a[a[b]]=!0;this.hh={}}var Ln;Kn.prototype.a={};Kn.prototype.parse=function(a,b,c){var d,e,f,g,h,k;Ln=!1;try{c=ym.JSON.parse(c)}catch(l){Ln=!0}if(c&&(d=c.metadata))for(e in k={spatials:[]},d){if(c=!this.a[e]&&(f=Mn[e]))(g=d[e])||(Ln=!0,g=void 0),c=g;if(c)for(c=g.length;c--;){var m;(m=g[c])||(Ln=!0,m=void 0);(h=m)&&f(b,a,this,e,h,k)}}else Ln=!0;return Ln?void 0:k};r(\"H.service.metaInfo.Parser.prototype.parse\",Kn.prototype.parse);\nvar Mn={\"street labels\":function(a,b,c,d,e,f){var g;(g=e.vertices)||(Ln=!0,g=void 0);if(g){var h=g.length,k,l,m;(l=0<h)||(Ln=!0,l=void 0);if(l)for(k=Array(h/2);h;)m=g[--h],l=g[--h],k[h/2]=new M(l,m);k=k?{Ra:[k]}:A;h=+e[\"font size\"]/a.Wb;g=c.hh[h];g||(Nn.lineWidth=h,g=c.hh[h]=c.hb.f(Nn));On(a,b,k,!1,g,e,d,f)}delete e.vertices},\"city center labels\":function(a,b,c,d,e,f){On(a,b,Pn(e,new Sf([])),!0,c.hb,e,d,f)},labels:function(a,b,c,d,e,f){var g;(g=e[\"bounding boxes\"])||(Ln=!0,g=void 0);if(g){for(var h=\ng.length,k=new Sf([]),l;h--;){var m;(m=g[h])||(Ln=!0,m=void 0);(l=m)&&Pn(l,k)}On(a,b,k,!0,c.hb,e,d,f)}delete e[\"bounding boxes\"]},buildings:function(a,b,c,d,e,f){var g=e.id,h=b.lc[g],k,l,m,n=[],q=[];(k=e)||(Ln=!0,k=void 0);if(k&&((l=k.vertices)||(Ln=!0,l=void 0),l)){var t;(t=k.polygons)||(Ln=!0,t=void 0);(m=t)&&n.push.apply(n,Qn(l,m));(k=k.outlines)||(Ln=!0,k=void 0);(m=k)&&q.push.apply(q,Qn(l,m))}m=n.length;n.push.apply(n,q);q=new Sf(n,Lb,m);(n=n.length)||(Ln=!0,n=void 0);n&&(h?(mn(h,a,[q]),f.spatials.push(h)):\n(h=On(a,b,q,!0,c.hb,e,d,f,g),b.V(h)))}};Mn[\"transit stops\"]=Mn.POIs=Mn.labels;var Rn=[\"box 2\",\"box 1\",\"annotation box\",\"icon box\"];function Pn(a,b){for(var c=Rn.length,d,e;c--;)if(d=Rn[c],e=a[d]){var f=e[0],g=e[1],h=e[2];e=e[3];b.Ra.push([new M(f,g),new M(f+h,g),new M(f+h,g+e),new M(f,g+e)]);delete a[d]}return b}\nfunction Qn(a,b){var c=b.length,d,e,f,g,h;if(0<c)for(e=Array(c);c--;)if((d=b[c])||(Ln=!0,d=void 0),d&&(g=d.length,0<g))for(e[c]=f=Array(g);g--;)h=2*d[g],f[g]=new M(a[h],a[h+1]);return e||[]}var Sn={};function On(a,b,c,d,e,f,g,h,k){Sn.style=e;d=new hn(b,d,k,Sn);c&&mn(d,a,[c]);Tn(f);f.category=g;d.g(f);h.spatials.push(d);d.ia(b);return d}Kn.prototype.hb=new zf({strokeColor:\"transparent\",fillColor:\"transparent\",lineWidth:0});var Nn={};\nfunction Tn(a){var b,c=!1;switch(typeof a){case \"object\":if(a instanceof Array)for(b=a.length;b--;)Tn(a[b])?c=!0:delete a[b];else if(a)for(b in a)Tn(a[b])?c=!0:delete a[b];break;case \"number\":c=!0;break;default:c=!!a}return c};function Un(a,b,c){c=c||{};b=b||{};var d=c.tileType||\"maptile\",e=c.aj||\"normal.day\";N.call(this,{min:0,max:20});!0===b.pois&&(b.pois=\"!F\");this.b=b;if(!(a&&a instanceof Vn))throw Error(\"InvalidArgument: service required\");this.O=a;this.I=z(this.I,this);this.O.addEventListener(\"versionupdate\",this.I);this.f=a.aa().clone().R(d+\"/\"+a.Cb()+\"/\"+e).$(this.ea).$(b);this.Ua=a.g||null;this.wa=c.pixelRatio||c.pixelratio||1;this.tileSize=c.tileSize||256;this.tileType=d;this.scheme=e;this.C=new Qm(new Kn(c.categoryFilter));\nthis.C.ia(this);this.U=z(this.U,this);this.C.addEventListener(\"update\",this.U);N.call(this,{min:0,max:20});this.N(new Vg(c.tileCacheSize||256,z(this.Xa,this)))}v(Un,N);r(\"H.service.metaInfo.TileProvider\",Un);Un.prototype.Xa=function(a,b){for(var c=b.a,d=c.length,e;d--;)e=c[d],delete e.Ic[b.key],e.v();b.data&&(Fm.push(b.o(),this.tileSize),b.m())};Un.prototype.U=function(){this.dispatchEvent(\"update\")};\nUn.prototype.c=function(a,b,c,d,e){var f=this.f.clone(),g=this.Ua,h=this.tileSize,k=this.getTileKey(a,b,c),k=this.g.get(k),l,m,n;k&&!k.yc()?(d(Fm.pop(this.tileSize),null),l={cancel:function(){}}):(g&&f.xa(g[(c+b+a)%g.length]),f.R(c+\"/\"+a+\"/\"+b+\"/\"+h+\"/png8\"),m=ym.setTimeout(function(){n=(new Gh(\"text/plain\",f.toString())).then(function(a){d(null,a)},e)},500));return l||{cancel:function(){n?n.cancel():ym.clearTimeout(m)}}};Un.prototype.requestInternal=Un.prototype.c;\nUn.prototype.P=function(a,b,c,d,e){var f=this.C,g;g=d||Fm.pop(this.tileSize);if(d)a=this.g.get(this.getTileKey(a,b,c)),a.ca(d);else if(d=a=new Yk(this.A(a,b,c),a,b,c,this.tileSize,this.wa,c+0,f),delete d.i,d.v=e,a.ca(g))for(e=a.a,g=e.length;g--;)e[g].Ib();else Fm.push(g,this.tileSize);return a};Un.prototype.createTileInternal=Un.prototype.P;Un.prototype.J=function(){this.C.J();this.O.removeEventListener(\"versionupdate\",this.I);N.prototype.J.call(this)};\nUn.prototype.I=function(){var a=this.O;this.f=a.aa().clone().R(this.tileType+\"/\"+a.Cb()+\"/\"+this.scheme).$(this.ea).$(this.b);this.j(!1)};Un.prototype.ea={metadata:\"metaonly\",mgen:\"2\"};function Vn(a){a=rm(sm.maptile,a||{});I.call(this);this.f=a.baseUrl;this.c=a.path;this.i=a.subDomain;this.g=a.shards;this.ra=(this.v=!!a.ignoreTypes)?null:a.type;this.b=a.version;this.m=new vm}v(Vn,I);r(\"H.service.metaInfo.Service\",Vn);function Wn(a,b){for(var c={},d=a[b+\"s\"][b],e=d.length;e--;)c[d[e].id]=d[e];a[b+\"s\"]=c}Vn.prototype.W=function(a,b,c,d,e){this.a=(this.f||e).clone();this.i&&this.a.xa(this.i);this.ra&&this.a.xa(this.ra);this.c&&this.a.mc(this.c);\"newest\"===this.b&&Xn(this);return this};\nVn.prototype.configure=Vn.prototype.W;Vn.prototype.aa=function(){return this.a};Vn.prototype.Cb=function(){return this.b};Vn.prototype.getVersion=Vn.prototype.Cb;Vn.prototype.Ia=function(){return this.m};Vn.prototype.getCopyrights=Vn.prototype.Ia;\nfunction Xn(a){var b=a.aa().clone().R(\"info\").$({output:\"json\"});a.g&&b.xa(a.g[0]);om({url:b,xd:\"callback_func\",oc:function(b){b=JSON.parse(b.replace(/,\\s?\\]/g,\"]\")).response;var d;Wn(b,\"map\");Wn(b,\"scheme\");Wn(b,\"tiletype\");Wn(b,\"format\");Wn(b,\"resolution\");Wn(b,\"language\");if(\"newest\"===a.b&&\"traffic\"!==a.ra)for(d in b.maps)b.maps[d].hash&&b.maps[d].newest&&(a.b=b.maps[d].hash,a.dispatchEvent(\"versionupdate\"));a.l=b;a.dispatchEvent(\"infoupdate\")},Zc:function(a){throw Error(\"[\"+a+\"]: Could not fetch meta-info from map tile service @\"+\nb.toString());},rf:!0})}Vn.prototype.s=function(){return this.l};Vn.prototype.getInfo=Vn.prototype.s;Vn.prototype.o=function(a,b,c,d,e,f){return new Un(this,d,{tileSize:a,pixelRatio:b,categoryFilter:c,tileType:e,scheme:f})};Vn.prototype.createTileProvider=Vn.prototype.o;Vn.prototype.j=function(a,b,c,d,e,f){a=this.o(a,b,c,d,e,f);return new oh(a)};Vn.prototype.createTileLayer=Vn.prototype.j;\nU.prototype.j=function(a){var b;b=rm(sm.metainfotile,a||{});var c;c=\"\"+(b.ignoreTypes?\"\":b.type);c+=b.path;c+=b.subDomain;c+=b.baseUrl;c+=b.shards?b.shards.join(\"\"):\"\";b=xm(c);c=this.a[\"meta\"+b];c||(c=this.W(new Vn(a)),this.a[\"meta\"+b]=c);return c};U.prototype.getMetaInfoService=U.prototype.j;sm.metainfotile={type:\"base\",version:\"newest\",subDomain:\"maps\",path:\"maptile/2.1\",shards:[\"1\",\"2\",\"3\",\"4\"]};U.prototype.F=function(a,b,c,d,e,f){var g=this.b(),h=this.b({type:\"aerial\"}),k=this.b({type:\"traffic\"}),l=this.b({type:\"pano\"}),m=this.j(),n=this.o(),q=this.m(),t={},u={crossOrigin:\"anonymous\"},y;\"object\"===typeof a&&(f=a,u.crossOrigin=\"crossOrigin\"in f?f.crossOrigin:\"anonymous\",a=f.tileSize,b=f.ppi,c=f.lg,d=f.lg2,e=f.style,f=f.pois);a=a||256;y=320===b?2:1;320===b&&(t.ppi=b);c&&(t.lg=c);d&&(t.lg2=d);e&&(t.style=e);f&&(t.pois=f);b=new Jn(n,void 0,c?t:null);this.U=new uh(b);return{normal:{xbase:g.b(\"xbasetile\",\n\"normal.day\",a,\"png8\",t,1,!1,u),xbasenight:g.b(\"xbasetile\",\"normal.night\",a,\"png8\",t,1,!1,u),base:g.b(\"basetile\",\"normal.day\",a,\"png8\",t,1,!1,u),basenight:g.b(\"basetile\",\"normal.night\",a,\"png8\",t,1,!1,u),map:g.b(\"maptile\",\"normal.day\",a,\"png8\",t,1,!1,u),mapnight:g.b(\"maptile\",\"normal.night\",a,\"png8\",t,1,!1,u),traffic:k.b(\"traffictile\",\"normal.day\",a,\"png8\",t,1,!1,u),trafficnight:k.b(\"traffictile\",\"normal.night\",a,\"png8\",t,1,!1,u),transit:g.b(\"maptile\",\"normal.day.transit\",a,\"png8\",t,1,!1,u),panorama:l.b(\"rctile\",\n\"normal.day\",a,\"png8\",t,1,!1,u),panoramanight:l.b(\"rctile\",\"normal.night\",a,\"png8\",t,1,!1,u),labels:g.b(\"labeltile\",\"normal.day\",a,\"png\",t,1,!1,u),metaInfo:m.j(a,y,[\"buildings\"],t)},satellite:{xbase:h.b(\"xbasetile\",\"hybrid.day\",a,\"jpg\",t,1,!0,u),base:h.b(\"basetile\",\"hybrid.day\",a,\"jpg\",t,1,!0,u),map:h.b(\"maptile\",\"hybrid.day\",a,\"jpg\",t,1,!0,u),traffic:k.b(\"traffictile\",\"hybrid.day\",a,\"jpg\",t,1,!0,u),panorama:l.b(\"rctile\",\"hybrid.day\",a,\"jpg\",t,1,!0,u),labels:h.b(\"labeltile\",\"hybrid.day\",a,\"png\",t,\n1,!0,u)},terrain:{xbase:h.b(\"xbasetile\",\"terrain.day\",a,\"jpg\",t,1,!1,u),base:h.b(\"basetile\",\"terrain.day\",a,\"jpg\",t,1,!1,u),map:h.b(\"maptile\",\"terrain.day\",a,\"jpg\",t,1,!1,u),traffic:k.b(\"traffictile\",\"terrain.day\",a,\"jpg\",t,1,!1,u),panorama:l.b(\"rctile\",\"terrain.day\",a,\"jpg\",t,1,!1,u),labels:h.b(\"labeltile\",\"terrain.day\",a,\"png\",t,1,!1,u)},incidents:this.U,venues:q.i({tileSize:a,pixelRatio:y})}};U.prototype.createDefaultLayers=U.prototype.F;function Yn(a){a=rm(sm.routing,a);a.callbackKey=\"jsoncallback\";Yn.u.constructor.call(this,a)}v(Yn,pm);r(\"H.service.RoutingService\",Yn);Yn.prototype.W=function(a,b,c,d,e){Yn.u.W.apply(this,[a,b,c,d,e]);this.f&&(this.a=this.f.clone(),this.a.$({app_id:a,app_code:b}));return this};Yn.prototype.configure=Yn.prototype.W;Yn.prototype.g=function(a,b,c){a=this.aa().clone().R(\"calculateroute.json\").$(a);qm(this,a,b,c)};Yn.prototype.calculateRoute=Yn.prototype.g;\nYn.prototype.b=function(a,b,c){a=this.aa().clone().xa(\"isoline\").R(\"calculateisoline.json\").$(a);qm(this,a,b,c)};Yn.prototype.calculateIsoline=Yn.prototype.b;sm.routing={subDomain:\"route\",path:\"routing/7.2\"};U.prototype.O=function(a){return this.W(new Yn(a))};U.prototype.getRoutingService=U.prototype.O;function Zn(a){a=rm(sm.geocoding,a);a.callbackKey=\"jsoncallback\";Zn.u.constructor.call(this,a);this.b=a.reverseSubDomain}v(Zn,pm);r(\"H.service.GeocodingService\",Zn);Zn.prototype.W=function(a,b,c,d,e){Zn.u.W.apply(this,[a,b,c,d,e]);this.f&&(this.a=this.f.clone(),this.a.$({app_id:a,app_code:b}));return this};Zn.prototype.configure=Zn.prototype.W;Zn.prototype.g=function(a,b,c){a=this.aa().clone().R(\"geocode.json\").$(a);return qm(this,a,b,c)};Zn.prototype.geocode=Zn.prototype.g;\nZn.prototype.l=function(a,b,c){a=this.aa().clone().R(\"reversegeocode.json\").$(a);this.b&&a.xa(this.b);return qm(this,a,b,c)};Zn.prototype.reverseGeocode=Zn.prototype.l;Zn.prototype.i=function(a,b,c){a=this.aa().clone().R(\"search.json\").$(a);return qm(this,a,b,c)};Zn.prototype.search=Zn.prototype.i;sm.geocoding={subDomain:\"geocoder\",path:\"6.2\",reverseSubDomain:\"reverse\"};U.prototype.I=function(a){return this.W(new Zn(a))};U.prototype.getGeocodingService=U.prototype.I;function $n(a){a=rm(sm.places,a);a.callbackKey=\"callback\";$n.u.constructor.call(this,a)}v($n,pm);r(\"H.service.PlacesService\",$n);$n.EntryPoint={SEARCH:\"discover/search\",SUGGEST:\"suggest\",EXPLORE:\"discover/explore\",AROUND:\"discover/around\",HERE:\"discover/here\",CATEGORIES:\"categories/places\"};$n.prototype.b=function(a,b,c,d){b=b||{};a=this.aa().clone().R(a).$(b);return qm(this,a,c,d)};$n.prototype.request=$n.prototype.b;$n.prototype.m=function(a,b,c){return this.b(\"discover/search\",a,b,c)};\n$n.prototype.search=$n.prototype.m;$n.prototype.v=function(a,b,c){return this.b(\"suggest\",a,b,c)};$n.prototype.suggest=$n.prototype.v;$n.prototype.l=function(a,b,c){return this.b(\"discover/explore\",a,b,c)};$n.prototype.explore=$n.prototype.l;$n.prototype.g=function(a,b,c){return this.b(\"discover/around\",a,b,c)};$n.prototype.around=$n.prototype.g;$n.prototype.j=function(a,b,c){return this.b(\"discover/here\",a,b,c)};$n.prototype.here=$n.prototype.j;\n$n.prototype.i=function(a,b,c){return this.b(\"categories/places\",a,b,c)};$n.prototype.categories=$n.prototype.i;$n.prototype.o=function(a,b,c,d){a=km(a);d&&a.$(d);return qm(this,a,b,c)};$n.prototype.follow=$n.prototype.o;sm.places={subDomain:\"places\",path:\"places/v1\"};U.prototype.P=function(){return this.W(new $n)};U.prototype.getPlacesService=U.prototype.P;function ao(a){a=rm(sm.enterpriseRouting,a);a.callbackKey=\"jsoncallback\";if(!B(a.baseUrl,S))throw new C(ao,0,\"Invalid base url\");this.i=a;ao.u.constructor.call(this,a)}v(ao,pm);r(\"H.service.EnterpriseRoutingService\",ao);ao.prototype.j=function(a,b,c){a=this.aa().clone().R(\"calculateroute.json\").$(a);qm(this,a,b,c)};ao.prototype.calculateRoute=ao.prototype.j;ao.prototype.g=function(a,b,c){a=this.aa().clone().R(\"getroute.json\").$(a);qm(this,a,b,c)};ao.prototype.getRoute=ao.prototype.g;\nao.prototype.b=function(a,b,c){a=this.aa().clone().R(\"getlinkinfo.json\").$(a);qm(this,a,b,c)};ao.prototype.getLinkInfo=ao.prototype.b;ao.prototype.l=function(a,b,c){a=this.aa().clone().R(\"calculateisoline.json\").$(a);qm(this,a,b,c)};ao.prototype.calculateIsoline=ao.prototype.l;ao.prototype.W=function(a,b,c,d,e){var f,g=sm.enterpriseRouting;this.i.baseUrl===g.baseUrl&&e&&(f=e.clone(),f.nd(g.host||g.baseUrl.vc),d&&f.xa(g.citSubDomain));return pm.prototype.W.apply(this,[a,b,c,d,f])};\nao.prototype.configure=ao.prototype.W;var bo={subDomain:\"route\",path:\"routing/6.2\",baseUrl:new S(\"http\",\"nlp.nokia.com\"),host:\"nlp.nokia.com\",citSubDomain:\"st\"};sm.enterpriseRouting=bo;U.prototype.K=function(a){return this.W(new ao(a))};U.prototype.getEnterpriseRoutingService=U.prototype.K;function co(){}r(\"H.service.extension.dataView.ITable\",co);co.prototype.getMeta=co.prototype.cd;co.prototype.getRowCount=co.prototype.g;co.prototype.getRow=co.prototype.Qb;co.prototype.getColumnNames=co.prototype.c;co.prototype.getColumn=co.prototype.l;co.prototype.getCell=co.prototype.f;co.prototype.concat=co.prototype.concat;function eo(){}r(\"H.service.extension.dataView.IRow\",eo);eo.prototype.getColumnNames=eo.prototype.c;eo.prototype.getCell=eo.prototype.a;eo.prototype.getTable=eo.prototype.uc;function fo(a,b){this.b=a;this.f=b}r(\"H.service.extension.dataView.ObjRow\",fo);fo.prototype.c=function(){return this.b.c()};fo.prototype.getColumnNames=fo.prototype.c;fo.prototype.a=function(a){return this.b.f(this.f,a)};fo.prototype.getCell=fo.prototype.a;fo.prototype.uc=function(){return this.b};fo.prototype.getTable=fo.prototype.uc;function go(){}r(\"H.service.extension.dataView.IColumn\",go);go.prototype.getCell=go.prototype.a;function ho(a,b){this.c=a;this.b=b}r(\"H.service.extension.dataView.ObjColumn\",ho);ho.prototype.a=function(a){return this.c.f(a,this.b)};ho.prototype.getCell=ho.prototype.a;function io(a,b,c){var d;b=b||(a&&a.length?Object.keys(a[0]):A);this.cb=a;if(b)for(this.qc=b,this.we=a=Ka(),d=b.length;d--;)a[b[d]]=!0;c!==A&&(this.cf=c)}r(\"H.service.extension.dataView.ObjTable\",io);p=io.prototype;p.cf=A;p.cb=A;p.qc=A;p.we=A;p.cd=function(){return this.cf};io.prototype.getMeta=io.prototype.cd;io.prototype.g=function(){return this.cb?this.cb.length:0};io.prototype.getRowCount=io.prototype.g;io.prototype.Qb=function(a){var b=this.cb;return b&&b[a]?new fo(this,a):A};\nio.prototype.getRow=io.prototype.Qb;io.prototype.c=function(){return this.qc||De};io.prototype.getColumnNames=io.prototype.c;io.prototype.l=function(a){return this.we[a]?new ho(this,a):A};io.prototype.getColumn=io.prototype.l;io.prototype.f=function(a,b){var c=this.cb;return(c=c&&this.we[b]&&c[a])&&c[b]};io.prototype.getCell=io.prototype.f;\nio.prototype.concat=function(){var a=arguments.length,b,c=this.qc,d=\"\"+this.qc,e=(this.cb||[]).slice(),f;for(b=0;b<a;b++){f=arguments[b];if(!(f instanceof io))throw new C(this.concat,b);if(f.cb){if(c&&\"\"+f.qc!==d)throw new C(this.concat,b,\"Incompatible columns!\");e=e.concat(f.cb)}}return new io(e,this.qc,this.cf)};io.prototype.concat=io.prototype.concat;function jo(a,b){a.cb?a.cb.push(b):a.cb=[b];return a.cb.length-1};function ko(a,b,c,d){if(!a||!ra(we(a.layerId,a.layer))||!ab(a.level)||Ta(a.rowFilter)&&!sa(a.rowFilter)||Ta(a.rowFilterContext)&&!Pa(a.rowFilterContext))throw new C(b,c,Ta(d)?d:a);};function lo(a,b,c){var d;B(a,mo,lo,0,\"has invalid type\");B(b,G,lo,1,\"has invalid type\");if(!Za(c))throw new C(lo,2,\"has invalid type\");for(d=0;d<c.length;d++)ko(c[d],lo,2,\"has invalid type\");lo.u.constructor.call(this);this.a=b;this.b=c;(new Lh).md(no,\"H.service.extension.worker.processor\");a=a.aa().clone().R(oo+\".\"+po).$({meta:\"1\"});new Nh(no,{message:[qo,0,{serverUrl:a.toString()}]})}v(lo,I);r(\"H.service.extension.platformData.SearchRequest\",lo);\nlo.prototype.send=function(){var a=no,b=qo,c=[],d,e,f,g=this;for(f=0;f<this.b.length;f++)d=this.b[f],c.push({layerId:we(d.layerId,d.layer),level:d.level,rowFilter:Ta(d.rowFilter)?d.rowFilter+\"\":A,rowFilterContext:d.rowFilterContext,columns:d.columns});e=[this.a.ka,this.a.ga,this.a.ja,this.a.ha,c];this.c=w.setTimeout(function(){(new Nh(a,{message:[b,2,e]})).then(z(ro,g),z(so,g))},1)};lo.prototype.send=lo.prototype.send;lo.prototype.cancel=function(){w.clearTimeout(this.c)};lo.prototype.cancel=lo.prototype.cancel;\nfunction ro(a){var b,c;for(c=0;c<a.length;c++){b=a[c].Rows;for(var d=b.length,e=void 0;d--;)e=b[d],e.geometry&&(e.geometry=[e.geometry.path]);b=new io(b,null,a[c].Meta);this.dispatchEvent(new Cc(\"data\",b))}this.dispatchEvent(new Bc(\"end\"))}function so(a){this.dispatchEvent(new Dc(\"error\",a))}var no=\"pde\",qo=\"pdeSearchRequestProvider\";function to(a,b,c){var d=uo,e=a===d.POLYGON,f=a===d.POLYLINE;this.b=b;this.c=c||sc;(this.a=f||e)?this.l=e:this.g=a===d.MARKER;this.f=this.a?\"$HProjGeometry\":\"geometry\"}\nto.prototype.parse=function(a,b,c){var d,e,f,g,h,k={},l=[],m,n,q,t;m=0;for(n=c.length;m<n;m++)if(d=c[m],q=d.Rows,d=q.length)for(e=Object.keys(q[0]).filter(function(a){return\"geometry\"!==a&&\"$HProjGeometry\"!==a}),e=new io(q,e),t=0;t<d;t++)if(f=q[t],h=f[this.f]){if(delete f[this.f],f=e.Qb(t))try{this.a?g=vo(this,a,b,f,h):g=wo(this,a,f,h.path),g.ia(a),l.push(g)}catch(u){this.c(u.message)}}else this.c(\"Layer must contain geometries\");k[this.a?\"spatials\":this.g?\"markers\":\"domMarkers\"]=l;return k};\nfunction vo(a,b,c,d,e){var f=[],g=e.paths,h=g.length,k=0,l=a.b&&a.b(d);for(a=new hn(b,a.l,A,{style:l||a.i,data:d});k!==h;)f.push(xo(g[k++]));mn(a,c,[new Sf(f,e.interiorsIndex,e.outlinesIndex)]);return a}function wo(a,b,c,d){d=new gc(d[0],d[1]);var e=a.b&&a.b(c);a.g?(a={icon:e,data:c,provider:b},a=new xi(d,a)):(a={icon:e,data:c,provider:b},a=new fh(d,a));return a}function xo(a){for(var b=0,c=a.length,d=[];b<c;)d.push(new M(a[b++],a[b++]));return d};function yo(a){a=a||{};var b=a.tileCacheSize||1024,c=a.resultType,d=a.styleCallback,e=uo;Ta(a.min)||(a.min=12);yo.u.constructor.call(this,a);if(-1===zo.indexOf(c))throw new C(yo,2,\"invalid resultType\");this.b=c;if(d&&!sa(d))throw new C(yo,2,\"invalid style callback\");this.ea=d;this.U=a.pixelRatio||1;this.f=z(this.f,this);this.N(new Vg(b,z(this.fi,this)));this.createTileInternal=c===e.POLYLINE||c===e.POLYGON?z(this.Nh,this):z(this.Mh,this)}v(yo,N);r(\"H.service.extension.TileProvider\",yo);\nyo.prototype.I=!1;var Ao=ri.prototype.Pc.READY;yo.prototype.o=function(a,b,c,d){return this.I?yo.u.o.call(this,a,b,c,d):A};yo.prototype.requestTile=yo.prototype.o;yo.prototype.f=function(a){a=ra(a)?a:a+\"\";this.dispatchEvent(new Dc(\"error\",a,this))};yo.prototype.l=function(){return this.b===uo.MARKER};yo.prototype.providesMarkers=yo.prototype.l;yo.prototype.i=function(){return this.b===uo.DOM_MARKER};yo.prototype.providesDomMarkers=yo.prototype.i;\nyo.prototype.s=function(){return this.b===uo.POLYLINE||this.b===uo.POLYGON};yo.prototype.providesSpatials=yo.prototype.s;function Bo(a){a.C||(a.O||(a.O=a.P(a.b,a.ea,a.f)),a.C=new Qm(a.O),a.C.ia(a),a.C.addEventListener(a.F.la,z(a.ei,a)),a.C.P=!0);return a.C}p=yo.prototype;\np.Mh=function(a,b,c,d){var e=this.getTileKey(a,b,c),e=this.g.get(e),f=this.b==uo.DOM_MARKER,g=[],h=Bo(this);e?e.valid=!0:(a=e=new $g(a,b,c,x),delete a.i,a.v=d);d=f?Um(h,e,\"domMarkers\"):Um(h,e,\"markers\");for(b=d.length;b--;)a=d[b],a.If=e,(f||a.sb().getState()===Ao)&&g.push(a);e.data=g;return e};p.ei=function(a){if(a=a.target.If)a.valid=!1};\np.Nh=function(a,b,c,d){var e=Bo(this),f,g=this.getTileKey(a,b,c),h=this.g.get(g);f=Fm.pop(this.tileSize);h||(a=h=new Yk(g,a,b,c,this.tileSize,this.U,c,e),delete a.i,a.v=d);h.ca(f)||Fm.push(f,this.tileSize);return h};p.fi=function(a,b){var c,d;c=uo;if(this.b===c.POLYLINE||this.b===c.POLYGON){c=b.a;for(d=c.length;d--;)delete c[d].Ic[b.key];b.data&&(Fm.push(b.o(),this.tileSize),b.m())}else for(c=b.data,d=c.length;d--;)delete c[d].If};p.D=function(){yo.u.D.call(this);Bo(this).J()};\nvar uo={MARKER:0,DOM_MARKER:1,POLYLINE:2,POLYGON:3};yo.ResultType=uo;var zo=[uo.MARKER,uo.DOM_MARKER,uo.POLYLINE,uo.POLYGON];function Do(a,b,c){var d=this,e=b&&b.rowFilter,f=c.resultType,g=uo;Do.u.constructor.call(this,c);B(a,mo,Do,0);ko(b,Do,1,\"invalid layer config\");e?(c=Qa(b),c.rowFilter=e.toString()):c=Qa(b);delete c.layer;c.layerId=we(b.layerId,b.layer);(new Lh).md(\"pde\",\"H.service.extension.worker.processor\");a=a.aa().clone().R(oo+\".\"+po).$({meta:1});(new Nh(\"pde\",{message:[this.uid,0,{tileSize:this.tileSize,projected:!0,onlyOutline:f===g.POLYLINE,serverUrl:a.toString(),layerConfigs:[c]}]})).then(function(){d.I=\n!0;Rg(d)},this.f)}v(Do,yo);r(\"H.service.extension.platformData.TileProvider\",Do);Do.prototype.P=function(a,b,c){a=new to(a,b,c);a.i=Eo;return a};var Eo=new zf({strokeColor:\"transparent\",fillColor:\"transparent\",lineWidth:0,lineJoin:\"round\",lineCap:\"round\"});\nDo.prototype.c=function(a,b,c,d,e){var f=this,g=this.getTileKey(a,b,c),h,g=this.g.get(g),k={cancel:sc},l=!0,m,n=uo;g&&(this.b===n.POLYLINE||this.b===n.POLYGON?g.yc()||(d(Fm.pop(this.tileSize),null),l=!1):(d(x),l=!1));l&&(m=ym.setTimeout(function(){h=new Nh(\"pde\",{message:[f.uid,1,[a,b,c]]});h.then(d,e)},500),k.cancel=function(){h?h.cancel():ym.clearTimeout(m)});return k};Do.prototype.requestInternal=Do.prototype.c;Do.prototype.D=function(){Do.u.D.call(this);new Nh(\"pde\",{message:[this.uid,3]})};\nDo.ResultType=uo;function Fo(a,b,c,d,e,f){Go(Fo,1,b,c);Go(Fo,2,d,e);(this.f=a.length)?(this.m=a,this.o=b,this.i=c,this.b=0,this.c=z(this.c,this),this.j=d,this.l=e,this.a=Ka(),Ca(this.a,Ho,f||{}),this.g={},w.setTimeout(this.c,0)):b(De,!0)}var Ho={duration:100,Yh:\"geometry\",Xh:\"WKT\",Ai:\"searchAttributes\",cg:A};\nFo.prototype.c=function(){var a,b,c,d=[];a=!1;for(var e=tj(),f;this.b<this.f;){b=this.m[this.b];a=b.attributes;f=b.layerId||this.a.cg;b.distance&&(a[this.a.Ai]={nearest:new gc(b.nearestLat,b.nearestLon),distance:b.distance});if(b=b[this.a.Yh]){try{c=ug(new Pg(b))}catch(g){this.i(new w.Error(g.message));a=!0;break}a[this.a.Xh]=c}(b=this.g[f])||(b=this.g[f]=this.j({layerId:f,columnNames:Object.keys(a)}));a=this.l(b,a);d.push(a);this.b++;if((a=this.b===this.f)||tj()-e>=this.a.duration){this.o(d,a);break}}a?\nthis.g=x:this.fe=w.setTimeout(this.c,0)};Fo.prototype.cancel=function(){w.clearTimeout(this.fe);this.b<this.f&&this.i(new w.Error(\"parsing canceled\"))};r(\"H.service.extension.util.AsyncParser.prototype.cancel\",Fo.prototype.cancel);function Io(a){this.a=a}Io.prototype.cancel=function(){for(var a=this.a,b=a.length;b--;)a[b].cancel();a.length=0};function Go(a,b,c,d){if(!sa(c))throw new C(a,b,\"has invalid type\");if(!sa(d))throw new C(a,b+1,\"has invalid type\");};function mo(a){a=rm(sm.pde,a||{});mo.u.constructor.call(this,a)}v(mo,pm);r(\"H.service.extension.platformData.Service\",mo);\nmo.prototype.b=function(a,b,c,d,e){var f=\"text/plain\";if(!a)throw new C(this.b,0,a);if(!b)throw new C(this.b,1,b);if(!d)throw new C(this.b,3,d);if(!e)throw new C(this.b,4,e);a=this.aa().clone().R(a+\".\"+b).$(c);b===Jo.JSON&&(f=\"application/json\");b=new Gh(f,a.toString());b.then(d,function(a){\"error\"===a.type?e(a.statusText||\"Unable to load data\"):a.json().then(function(a){e(a.error_description||a.message)},function(){e(a.statusText)})});return b};mo.prototype.request=mo.prototype.b;\nsm.pde={subDomain:\"pde\",path:\"1\"};var oo=\"tiles\";mo.EntryPoint={DOC_ATTRIBUTES:\"doc/attributes\",DOC_LAYER:\"doc/layer\",DOC_LAYERS:\"doc/layers\",DOC_MAPS:\"doc/maps\",DOC_INDEXES:\"doc/indexes\",SEARCH_BBOX:\"search/bbox\",SEARCH_CORRIDOR:\"search/corridor\",SEARCH_PROXIMITY:\"search/proximity\",SEARCH_QUADKEY:\"search/quadkey\",SERVICE_CONFIGURATION:\"serviceconfiguration\",STATIC:\"static\",TILE:\"tile\",TILES:oo,FILE:\"file\",INDEX:\"index\"};var po=\"json\",Jo={TXT:\"txt\",JSON:po,HTML:\"html\",BIN:\"bin\"};\nmo.EntryPointType=Jo;mo.prototype.j=function(a,b){var c=b&&b.resultType,d=new Do(this,a,b),e,f=uo;c==f.MARKER||c===f.DOM_MARKER?e=new uh(d):e=new oh(d);return e};mo.prototype.createTileLayer=mo.prototype.j;function Ko(a,b,c,d,e){var f=[],g,h=c.layer_id||c.layer_ids;a=a.b(b,po,c,function(a){g=new Fo(a.geometries,d,e,function(a){return new io([],a.columnNames,a)},function(a,b){return a.Qb(jo(a,b))},{cg:h});f.push(g)},function(a){e(new w.Error(a))});f.push(a);return new Io(f)}\nfunction Lo(a,b,c){if(!Za(a))throw new C(c,0,\"has invalid type\");if(!Za(b))throw new C(c,1,\"has invalid type\");if(a.length!==b.length||!a.length)throw new C(c,1,\"specify one key attribute for each given layer id in the same order\");}\nmo.prototype.l=function(a,b,c,d,e,f){function g(a,b){b&&h--;d(a,!h)}var h,k=[];Lo(a,b,this.l);Go(this.l,3,d,e);B(c,G,this.l,2);c={bbox:c.ka+\",\"+c.ga+\";\"+c.ja+\",\"+c.ha};f&&Ca(c,f);a=c.layer_id?[c.layer_id]:a;f=0;for(h=a.length;f<h;f++)c.layer_id=a[f],c.key_attribute=b[f],k.push(Ko(this,\"search/bbox\",c,g,e));return new Io(k)};mo.prototype.searchByBoundingBox=mo.prototype.l;\nmo.prototype.i=function(a,b,c,d,e,f,g){Lo(a,b,this.i);B(c,gc,this.i,1,\"has invalid type\");if(!ab(d))throw new C(this.i,2,\"has invalid type\");Go(this.i,4,e,f);a={layer_ids:a.join(\",\"),key_attributes:b.join(\",\"),proximity:c.lat+\",\"+c.lng+\",\"+d};g&&Ca(a,g);return Ko(this,\"search/proximity\",a,e,f)};mo.prototype.searchByProximity=mo.prototype.i;\nmo.prototype.g=function(a,b,c,d,e,f,g){var h=\"\";Lo(a,b,this.g);if(!ra(c)&&!B(c,F))throw new C(this.g,1,\"has invalid type\");if(!ab(d))throw new C(this.g,2,\"has invalid type\");Go(this.g,4,e,f);a={layer_ids:a.join(\",\"),key_attributes:b.join(\",\"),radius:d};if(ra(c))a.route_id=c;else{d=c.na;c=0;for(b=d.length;c<b;c+=3)h+=d[c]+\",\"+d[c+1],c<b-3&&(h+=\";\");a.corridor=h}g&&Ca(a,g);return Ko(this,\"search/corridor\",a,e,f)};mo.prototype.searchByCorridor=mo.prototype.g;\nU.prototype.T=function(a){var b;b=rm(sm.pde,a||{});var c;c=\"\"+(b.path||\"\");c+=b.subDomain||\"\";c+=b.baseUrl?b.baseUrl.toString():\"\";b=xm(c);c=this.a[\"pde\"+b];c||(c=this.W(new mo(a)),this.a[\"pde\"+b]=c);return c};U.prototype.getPlatformDataService=U.prototype.T;function Mo(a){a=rm(sm.gfe,a);Mo.u.constructor.call(this,a)}v(Mo,pm);r(\"H.service.extension.geofencing.Service\",Mo);sm.gfe={subDomain:\"gfe\",path:\"2\"};U.prototype.pb=function(a){return this.W(new Mo(a))};U.prototype.getGeofencingService=U.prototype.pb;Mo.prototype.W=function(a,b,c,d,e){Mo.u.W.apply(this,[a,b,c,d,e]);this.f&&(this.a=this.f.clone());return this};Mo.prototype.configure=Mo.prototype.W;\nMo.prototype.b=function(a,b,c,d){var e;if(!a)throw new C(this.b,0,a);if(!sa(c))throw new TypeError(\"onResult must be a function\");if(!sa(d))throw new TypeError(\"onError must be a function\");e=function(a){d(new w.Error(a))};a=this.aa().clone().R(a+\".json\").$(b);a=new Gh(\"application/json\",a.toString());a.then(c,function(a){\"error\"===a.type?e(a.statusText||\"Unable to load data\"):a.json().then(function(a){e(a.error_description||a.issues[0].message)},e)});return a};Mo.prototype.request=Mo.prototype.b;\nMo.EntryPoint={SEARCH_PROXIMITY:\"search/proximity\"};r(\"H.service.extension.customLocation.Permission\",{READ:\"read\",WRITE:\"write\",EXPORT:\"export\"});r(\"H.service.extension.customLocation.Storage\",{READONLY:\"readonly\",UPDATABLE:\"updatable\"});function No(){if(Oo)throw new kc(No);}r(\"H.service.extension.customLocation.Table\",No);var Oo=!0;function Po(a,b){var c,d,e,f;Oo=!1;c=new No;Oo=!0;c.j=Oa(w.JSON.parse(w.JSON.stringify(a)));d=a.columnNames;e=Ka();for(f=d.length;f--;)e[d[f]]=f;c.o=e;c.b=d.length;if(e=b){if(e.length%d.length)throw new C(Po,1,\"Invalid number of cells\");}else e=[];c.a=e;return c}No.prototype.cd=function(){return this.j};No.prototype.getMeta=No.prototype.cd;No.prototype.g=function(){return this.a.length/this.b};\nNo.prototype.getRowCount=No.prototype.g;No.prototype.Qb=function(a){return a<this.a.length/this.b?new Qo(this,a):A};No.prototype.getRow=No.prototype.Qb;No.prototype.v=function(){var a=this.a.length/this.b,b,c=new w.Array(a);for(b=0;b<a;b++)c[b]=new Qo(this,b);return c};No.prototype.getRows=No.prototype.v;No.prototype.qe=function(a){var b=this.b,c=this.a,d=c.length/this.b;if(!a||a.length%b)throw new C(this.qe,0,\"Invalid number of cells\");this.a=c.concat(a);return d};No.prototype.addCells=No.prototype.qe;\nNo.prototype.m=function(){for(var a=this.b,b=this.a,c=this.a.length/this.b;a--;)b.push(x);return this.Qb(c)};No.prototype.addRow=No.prototype.m;No.prototype.c=function(){return this.j.columnNames};No.prototype.getColumnNames=No.prototype.c;No.prototype.l=function(a){return this.o[a]===A?A:new Ro(this,a)};No.prototype.getColumn=No.prototype.l;No.prototype.f=function(a,b){return this.a[a*this.b+this.o[b]]};No.prototype.getCell=No.prototype.f;\nNo.prototype.i=function(a,b,c){b=this.o[b];if(a>=this.a.length/this.b)throw new C(this.i,0,\"Row index out of bounds\");if(b===A)throw new C(this.i,0,\"Column unknown\");this.a[a*this.b+b]=c};No.prototype.setCell=No.prototype.i;\nNo.prototype.concat=function(){var a=arguments.length,b,c=\"\"+this.c(),d=this.a?this.a.slice():[],e;for(b=0;b<a;b++){e=arguments[b];if(!(e instanceof No))throw new C(this.concat,b);if(\"\"+e.c()!==c)throw new C(this.concat,b,\"Incompatible columns!\");e.a&&(d=d.concat(e.a))}return Po(this.j,d)};No.prototype.concat=No.prototype.concat;var So=/(\\n|\\t|\\r|\")/;\nNo.prototype.Df=function(a,b){var c,d=this.b,e=this.c(),f=[],g,h=[],k=this.a,l=-1,m;for(c=0;c<d;c++)if(!a||a.test(e[c]))\"WKT\"===e[c]&&(l=f.length),f.push(c);if(!(g=f.length))throw new C(this.Df,1,\"No columns filtered\");To(this,h,e,0,d,f,g,l);if(b)for(m=b.length,c=0;c<m;c++)h.push(\"\\n\"),e=b[c],To(this,h,k,e,d,f,g,l);else for(m=this.g(),e=0;e<m;e++)h.push(\"\\n\"),To(this,h,k,e,d,f,g,l);return h.join(\"\")};\nfunction To(a,b,c,d,e,f,g,h){var k,l;for(k=0;k<g;k++)if(k&&b.push(\"\\t\"),l=c[d*e+f[k]],k!==h){if(l!==x){l=String(l);if(So.test(l))throw new C(a.Df,0,'Invalid character (\\\\n, \\\\r, \\\\t, or \") in row '+d+\" column \"+a.j.columnNames[f[k]]);b.push(l)}}else b.push(l)}function Ro(a,b){this.c=a;this.b=b}No.Column=Ro;Ro.prototype.a=function(a){return this.c.f(a,this.b)};Ro.prototype.getCell=Ro.prototype.a;Ro.prototype.f=function(a,b){this.c.i(a,this.b,b)};Ro.prototype.setCell=Ro.prototype.f;\nfunction Qo(a,b){this.b=a;this.Ve=b}No.Row=Qo;Qo.prototype.c=function(){return this.b.c()};Qo.prototype.getColumnNames=Qo.prototype.c;Qo.prototype.a=function(a){return this.b.f(this.Ve,a)};Qo.prototype.getCell=Qo.prototype.a;Qo.prototype.f=function(a,b){this.b.i(this.Ve,a,b)};Qo.prototype.setCell=Qo.prototype.f;Qo.prototype.uc=function(){return this.b};Qo.prototype.getTable=Qo.prototype.uc;function Uo(a){var b=Vo;if(!a||!ra(a.layerId)||Ta(a.rowFilter)&&!sa(a.rowFilter)||Ta(a.rowFilterContext)&&!Pa(a.rowFilterContext))throw new C(b,1,Ta(\"invalid layer config\")?\"invalid layer config\":a);}function Wo(a){return ra(a)&&/^[A-Z][A-Z0-9_]*$/.test(a)}function Xo(a){for(var b=a&&a.length,c=2<=b&&\"WKT\"===a[--b]&&\"GEOMETRY_ID\"===a[--b];c&&b--;)c=Wo(a[b]);return c}\nfunction Yo(a,b){var c=\"\",d,e,f,g,h,k=[];if(!b){g={};k=[];if(a.geometries)for(e=0;e<a.geometries.length;e++)f=a.geometries[e],g[f.layerId]||(g[f.layerId]=[]),g[f.layerId].push(f);for(d in g)k.push({layerId:d,geometries:g[d]});for(d=0;d<k.length;d++)c+=Yo(k[d],k[d].layerId)}else if(a.geometries&&a.geometries.length)for(h=Object.keys(a.geometries[0].attributes),c=c+(\"Meta:\\t\"+b+\"\\n\")+h.join(\"\\t\"),c+=\"\\tWKT\\n\",d=0;d<a.geometries.length;d++){g=a.geometries[d].attributes;f=a.geometries[d].geometry;for(e=\n0;e<h.length;e++)k.push(g[h[e]]);c+=k.join(\"\\t\");c+=\"\\t\"+f+\"\\n\";k=[]}return c};function Zo(a){if(a===A)a=\"\\t\";else if(!/^[^\"\\r\\n]$/.test(a))throw new C(Zo,0);this.b=String(a).charCodeAt(0);this.We=z(this.We,this);this.G=$o}var $o=0;p=Zo.prototype;p.getState=function(){return this.G};function ap(a,b,c){var d=a.G;if(d!==b)throw 1===d&&(a.G=$o),new kc(c,\"Requires state: \"+[\"READY\",\"PARSE\",\"PAUSE\"][b]+\" but found \"+[\"READY\",\"PARSE\",\"PAUSE\"][d]);}p.We=function(a){this.G=$o;throw new C(Zo.prototype.parse,0,\"Malformed DSV at row \"+this.a.o+\" column \"+this.a.c+\": \"+a);};\nfunction bp(a,b){var c=[];a.parse(b,function(a,b,f){1>a&&(c[b]=f);return 0<a});a.G=$o;return c}p.parse=function(a,b,c){ap(this,$o,Zo.prototype.parse);a=a.trim();this.a=new cp(a,this.b,this.We);this.c=b;this.Fg=c||Ce;this.G=2;this.wf()};p.Fg=Ce;\np.wf=function(){var a=this.a,b,c,d=[],e,f,g;ap(this,2,Zo.prototype.wf);this.G=1;do{if(!a.B){this.G=$o;break}if(c>a.c){if(void 0!==f&&f!==c){this.a.b(\"The number of columns must be the same for all rows\");return}f=c}b=a.o;c=a.c;e=a.g;g=this.Fg(b,c,a);if(a.g>e)for(;-1!==a.next(););else{for(;-1!==(e=a.next());)d.push(e);g=String.fromCharCode.apply(x,d);d.length=0}dp(a);this.c(b,c,g)&&(this.G=2)}while(1===this.G);2!=this.G&&void 0!==f&&0<c&&f!==c&&this.a.b(\"The number of columns must be the same for all rows\")};\nfunction cp(a,b,c){this.f=new Pg(a);this.v=b;this.B=!0;this.g=this.o=this.c=0;dp(this);this.b=c;this.i=[];this.j=!1}cp.prototype.g=0;var ep={me:10,Pf:13,oe:34,Mc:-1};function dp(a){var b=a.f.a();a.s=!1;(a.A=34===b)&&a.f.next()}function fp(a,b){var c=a.f;a.s=!0;switch(b){case a.v:a.c++;break;case ep.Pf:c.next(),c.a()!==ep.me&&a.b(\"CR without LF\");case ep.me:a.c=0;a.o++;break;case ep.Mc:a.B=!1;break;default:a.b(\"End of field expected\")}c.next();return ep.Mc}\ncp.prototype.a=function(){var a,b;if(this.s)b=ep.Mc;else if(a=this.f,b=a.a(),this.A)switch(b){case ep.oe:a.next();b=a.a();b!==ep.oe&&(b=fp(this,b));break;case ep.Mc:this.b(\"Closing quotation mark expected\")}else switch(b){case ep.oe:this.b(\"Unexpected quotation mark\");case this.v:case ep.Pf:case ep.me:case ep.Mc:b=fp(this,b)}return b};cp.prototype.m=function(){this.j=!0;this.i=[]};cp.prototype.l=function(){var a=this.i.slice();this.j=!1;this.i=[];return a};\ncp.prototype.next=function(){var a=this.a();-1!==a&&this.f.next();this.j&&this.i.push(a);this.g++;return a};function gp(a,b,c,d){d=d||{};if(!b)throw new C(gp,1,\"has to be a function\");if(!c)throw new C(gp,2,\"has to be a function\");this.c=b;this.g=c;this.a=[];this.i=d.duration||hp;this.b=z(this.b,this);this.f={};var e;a=a.split(\"Meta:\\t\").slice(1);for(b=0;b<a.length;b++)d=a[b].split(\"\\n\"),c=d[0].split(\"\\t\")[0],d=d.slice(1).join(\"\\n\"),this.sc[c]=new Zo,this.Ke[c]=bp(this.sc[c],d),e={layerId:c,columnNames:this.Ke[c]},this.Ne.push(c),this.f[c]=Po(e),this.Kb[c]=tj(),ip(this,d,c),this.b(c)}var hp=100;p=gp.prototype;\np.Ke={};p.Ne=[];p.sc={};p.Kb={};p.Ue={};function ip(a,b,c){var d=[],e=a.Ke[c].length-1,f=a.f[c];try{a.sc[c].parse(b,function(b,g,l){var m=!1;0<b&&(d[g]=l,g===e&&(a.a.push(f.Qb(f.qe(d))),tj()-a.Kb[c]>a.i&&(m=!0)));return m},function(a,b,c){if(0<a&&b===e)return ug(c)})}catch(g){a.g(g)}}p.cancel=function(){for(var a in this.Ue)w.clearTimeout(this.Ue[a])};r(\"H.service.extension.customLocation.AsyncParser.prototype.cancel\",gp.prototype.cancel);\ngp.prototype.b=function(a){var b=this,c;this.Ue[a]=w.setTimeout(function(){if(2===b.sc[a].getState())b.Kb[a]=tj(),b.c(b.a,!1),b.a=[],b.sc[a].wf(),b.b(a);else{c=!0;for(var d=0;d<b.Ne.length;d++)if(b.sc[b.Ne[d]].getState()!==$o){c=!1;break}c&&(0<b.a.length&&b.c(b.a,!0),b.a=[])}},0)};function V(a){a=rm(sm.cle,a);V.u.constructor.call(this,a)}v(V,pm);r(\"H.service.extension.customLocation.Service\",V);V.prototype.W=function(a,b,c,d,e){V.u.W.apply(this,[a,b,c,d,e]);this.f&&(this.a=this.f.clone());return this};V.prototype.configure=V.prototype.W;V.prototype.Ta=function(a,b){var c=b&&b.resultType,d=new Vo(this,a,b),e,f=uo;c==f.MARKER||c===f.DOM_MARKER?e=new uh(d):e=new oh(d);return e};V.prototype.createTileLayer=V.prototype.Ta;U.prototype.N=function(a){return this.W(new V(a))};\nU.prototype.getCustomLocationService=U.prototype.N;function jp(a,b,c,d){var e;a=a===kp?\"changes\":\"file\";var f=b[a],g=ra(f),h=!g&&B(f,Blob);if(!g&&!h)throw new C(d,0,\"Invalid \"+a+\" parameter\");if(lp)h?e=f:e=Ke(f,\"text/plain\"),d=new w.FormData,d.append(a,e,e.name||a+\".wkt\"),c.method=\"POST\",c.data=d,delete b[a];else if(h)throw new C(d,0,\"Sending Blob data is not supported by the browser\");}var lp=w.FormData&&!!w.FormData.prototype.append;\nV.prototype.b=function(a,b,c,d,e){function f(a){e(new w.Error(a))}var g=\"text/plain\",h=mp,k=a===h.LAYERS_UPLOAD||a===h.LAYERS_MODIFY||a===h.LAYERS_IMPORT,l=c,h={data:A,method:\"GET\"};if(!a)throw new C(this.b,0,a);if(!b)throw new C(this.b,1,b);Go(this.b,3,d,e);k&&(B(c,Object,this.b,2,\"Invalid request parameters\"),l=Qa(c),jp(a,l,h,this.b));a=this.aa().clone().R(a+\".\"+b).$(l);b===np.JSON&&(g=\"application/json\");b=new Gh(g,a.toString(),ud,h);b.then(function(a){var b=a.issues;b&&a.error_id&&a.response_code?\nf(b[0].message):d(a)},function(a){\"error\"===a.type||404===a.status?f(a.statusText||\"Unable to load data\"):a.json().then(function(a){f(a.error_description||a.issues[0].message)},f)});return b};V.prototype.request=V.prototype.b;\nvar kp=\"layers/modify\",mp={LAYERS_DELETE:\"layers/delete\",LAYERS_GRANT:\"layers/access/grant\",LAYERS_LIST:\"layers/list\",LAYERS_MODIFY:kp,LAYERS_UPLOAD:\"layers/upload\",LAYERS_IMPORT:\"layers/import\",SEARCH_ALL:\"search/all\",SEARCH_BBOX:\"search/bbox\",SEARCH_CORRIDOR:\"search/corridor\",SEARCH_PROXIMITY:\"search/proximity\",SEARCH_QUADKEY:\"search/quadkey\",SEARCH_TILE:\"tiled/tile\"};V.EntryPoint=mp;var np={TXT:\"txt\",JSON:\"json\"};V.EntryPointType=np;sm.cle={subDomain:\"cle\",path:\"2\"};\nV.prototype.l=function(a,b,c){var d=this;return this.b(\"search/all\",\"txt\",{filter:'WKT==\"\"',layer_id:a},function(e){var f=e.replace(/[\\r\\n]+$/g,\"\").split(\"\\t\");d.b(\"layers/list\",\"json\",{layer_id:a,detail_level:\"all\"},function(a){a=a.layers[0];a.columnNames=f;b(Po(a))},c)},c)};V.prototype.getLayer=V.prototype.l;\nV.prototype.A=function(a,b,c,d){function e(){return++g<f?h.b(\"layers/access/grant\",\"json\",{layer_id:a,granted_app_id:b[g].grantedAppId,permissions:b[g].permissions.join(\",\")},e,d):h.l(a,c,d)}var f=b&&b.length,g=-1,h=this;return e()};V.prototype.grantAccess=V.prototype.A;V.prototype.s=function(a,b,c){return this.b(\"layers/delete\",\"json\",{layer_ids:a},b,c)};V.prototype.deleteLayer=V.prototype.s;\nV.prototype.v=function(a,b,c){function d(){setTimeout(function(){l.l(h,function(a){setTimeout(e.bind(null,a),n)},function(){64E3>m?(m+=n,d()):c(w.Error(\"Timeout\"))})},n);n*=2}function e(d){var e=JSON.stringify(d.c()),f=a.grants,g;e!==JSON.stringify(k)?(g=\"Results into different column names on the backend: \"+e,setTimeout(function(){l.s(h,function(){c(w.Error(g))},function(a){c(w.Error(g+\". \"+a.message))})},n)):f&&f.length?l.A(h,f,b,c):b(d)}var f,g,h,k,l=this,m=0,n=1E3;g=!a||!Wo(h=a.layerId)&&(f=\"layerId\")||\n!Xo(k=a.columnNames)&&(f=\"columnNames\")?0:sa(b)?sa(c)?-1:2:1;if(0<=g)throw new C(l.v,g,f||arguments[g]);return l.l(h,function(){c(w.Error(\"Layer exists already\"))},function(){var b={layer_id:h,file:k.join(\"\\t\")},e=a.level,f=a.storage;e!==A&&(b.level=e);f!==A&&(b.storage=f);l.b(\"layers/upload\",\"json\",b,d,c)})};V.prototype.createLayer=V.prototype.v;\nfunction op(a,b,c,d,e){var f=[],g;a=a.b(b,\"json\",c,function(a){a.geometries.length?(a=Yo(a,c.layer_id),g=new gp(a,d,e),f.push(g)):d(De,!0)},e);f.push(a);return new Io(f)}V.prototype.i=function(a,b,c,d,e,f){if(!Za(a))throw new C(this.i,0,\"has invalid type\");B(b,gc,this.i,1,\"has invalid type\");if(!ab(c))throw new C(this.i,2,\"has invalid type\");Go(this.i,3,d,e);a={layer_ids:a.join(\",\"),proximity:b.lat+\",\"+b.lng+\",\"+c};f&&Ca(a,f);return op(this,\"search/proximity\",a,d,e)};\nV.prototype.searchByProximity=V.prototype.i;V.prototype.g=function(a,b,c,d,e,f){var g,h=\"\";if(!Za(a))throw new C(this.g,0,\"has invalid type\");if(!ra(b)&&!B(b,F))throw new C(this.g,1,\"has invalid type\");if(!ab(c))throw new C(this.g,2,\"has invalid type\");Go(this.g,3,d,e);a={layer_ids:a.join(\",\"),radius:c};if(ra(b))a.route_id=b;else{g=b.na;b=0;for(c=g.length;b<c;b+=3)h+=g[b]+\",\"+g[b+1],b<c-3&&(h+=\",\");a.corridor=h}f&&Ca(a,f);return op(this,\"search/corridor\",a,d,e)};V.prototype.searchByCorridor=V.prototype.g;\nV.prototype.j=function(a,b,c,d,e){function f(a,b){b&&h--;c(a,!h)}var g=[],h;if(!Za(a))throw new C(this.j,0,\"has invalid type\");B(b,G,this.j,1,\"has invalid type\");Go(this.j,2,c,d);b={bbox:b.ka+\",\"+b.ga+\";\"+b.ja+\",\"+b.ha};e&&Ca(b,e);a=b.layer_id?[b.layer_id]:a;e=0;for(h=a.length;e<h;e++)b.layer_id=a[e],g.push(op(this,\"search/bbox\",b,f,d));return new Io(g)};V.prototype.searchByBoundingBox=V.prototype.j;\nV.prototype.o=function(a,b,c,d){var e,f,g=[];if(!ra(a))throw new C(this.o,0,\"has invalid type\");Go(this.o,1,b,c);e={layer_id:a};d&&Ca(e,d);d=this.b(\"search/all\",\"json\",e,function(d){d.geometries.length?(d=Yo(d,a),f=new gp(d,b,c),g.push(f)):b(De,!0)},c);g.push(d);return new Io(g)};V.prototype.searchAll=V.prototype.o;var pp={\"delete\":/^GEOMETRY_ID$/,append:/^(?!GEOMETRY_ID$)/,update:null};\nfunction qp(a,b,c,d,e,f){function g(){ea++;d(this,ea===J)}function h(a){ea++;e(a,this,ea===J)}var k=\"append\"!==b,l,m,n,q,t,u={},y=Ka(),J=0,T=[],ea=0;if(!Za(c))throw new C(f,0,c);Go(f,1,d,e);for(l=c.length;l--;){m=c[l];if(B(m,Qo))if(n=m.uc().cd().layerId,q=m.a(\"GEOMETRY_ID\"),k){if(q===x||\"\"===String(q))t='GEOMETRY_ID must not be null or \"\"';u[q=n+\"_\"+q]&&(t=\"same GEOMETRY_ID for multiple rows\");u[q]=m}else q!==x&&\"\"!==String(q)&&(t='GEOMETRY_ID must be null or \"\"');else t=\"Invalid type\";if(t)throw new C(f,\n0,\"- Invalid row at index \"+l+\", \"+t);q=y[n];q||(q=y[n]=[],J++);q.push(m)}for(n in y){q=y[n];c=[];for(l=q.length;l--;)c.push(q[l].Ve);T.push(a.b(kp,\"json\",{layer_id:n,action:b,changes:q[0].uc().Df(pp[b],c)},z(g,q),z(h,q)))}return new Io(T)}V.prototype.m=function(a,b,c){return qp(this,\"append\",a,b,c,this.m)};V.prototype.appendRows=V.prototype.m;V.prototype.C=function(a,b,c){return qp(this,\"update\",a,b,c,this.C)};V.prototype.updateRows=V.prototype.C;\nV.prototype.B=function(a,b,c){return qp(this,\"delete\",a,b,c,this.B)};V.prototype.deleteRows=V.prototype.B;function Vo(a,b,c){var d=this,e=b&&b.rowFilter,f,g,h,k,l=uo;Vo.u.constructor.call(this,c);B(a,V,Vo,0);h=c.resultType;Uo(b);e?(f=Qa(b),f.rowFilter=e.toString()):f=b;(new Lh).md(\"cle\",\"H.service.extension.worker.processor\");k=b.layerId;a.b(\"layers/list\",\"json\",{detail_level:\"all\",layer_id:k},function(b){b=b.layers;var c;for(c=0;c<b.length;c++)if(b[c].layerId===k){f.level=b[c].level;break}g=a.aa().clone().R(\"tiled/tile.json\").$({meta:1});(new Nh(\"cle\",{message:[d.uid,0,{tileSize:d.tileSize,projected:!0,\nonlyOutline:h===l.POLYLINE,serverUrl:g.toString(),layerConfigs:[f],batchTiles:!1}]})).then(function(){d.I=!0;Rg(d)},d.f)},function(a){d.f(a.message)})}v(Vo,yo);r(\"H.service.extension.customLocation.TileProvider\",Vo);Vo.prototype.P=function(a,b,c){return new to(a,b,c)};\nVo.prototype.c=function(a,b,c,d,e){var f=this,g=this.getTileKey(a,b,c),h,g=this.g.get(g),k={cancel:sc},l=!0,m,n=uo;g&&(this.b===n.POLYLINE||this.b===n.POLYGON?g.yc()||(d(Fm.pop(this.tileSize),null),l=!1):(d(x),l=!1));l&&(m=ym.setTimeout(function(){h=new Nh(\"cle\",{message:[f.uid,1,[a,b,c]]});h.then(d,e)},500),k.cancel=function(){h?h.cancel():ym.clearTimeout(m)});return k};Vo.prototype.requestInternal=Vo.prototype.c;Vo.prototype.D=function(){Vo.u.D.call(this);new Nh(\"cle\",{message:[this.uid,3]})};function rp(a){a=rm(sm.cre,a);rp.u.constructor.call(this,a)}v(rp,pm);r(\"H.service.extension.customRoute.Service\",rp);sm.cre={subDomain:\"cre\",path:\"2\"};U.prototype.Ta=function(a){return this.W(new rp(a))};U.prototype.getCustomRoutingService=U.prototype.Ta;\nrp.prototype.b=function(a,b,c){function d(a){c(new w.Error(a))}Go(this.b,1,b,c);a=this.aa().clone().R(\"calculateroute.json\").$(a);(new Gh(\"application/json\",a.toString())).then(b,function(a){\"error\"===a.type?d(a.statusText||\"Unable to load data\"):a.json().then(function(a){d(a.error_description||a.issues[0].message)},d)})};rp.prototype.calculateRoute=rp.prototype.b;r(\"H.service.buildInfo\",function(){return Bh(\"mapsjs-service\",\"0.17.0\",\"378d765\")});\n");;
H.util.eval("var Cl={};function Dl(a){var b=a.ownerDocument,b=b.documentElement||b.body.parentNode||b.body,c;try{c=a.getBoundingClientRect()}catch(d){c={top:0,right:0,bottom:0,left:0,height:0,width:0}}return{x:c.left+(\"number\"===typeof window.pageXOffset?window.pageXOffset:b.scrollLeft),y:c.top+(\"number\"===typeof window.pageYOffset?window.pageYOffset:b.scrollTop)}}var El=/Edge\\/\\d+/.test(navigator.appVersion),Fl=Function(\"return this\")();function Gl(a,b,c,d,e,f,g){Gl.u.constructor.call(this,a);this.pointers=b;this.changedPointers=c;this.targetPointers=d;this.currentPointer=e;this.originalEvent=g;this.target=f}v(Gl,Bc);r(\"H.mapevents.Event\",Gl);function Hl(a,b,c,d,e,f){if(isNaN(a))throw Error(\"x needs to be a number\");if(isNaN(b))throw Error(\"y needs to be a number\");if(isNaN(c))throw Error(\"pointer must have an id\");this.viewportX=a;this.viewportY=b;this.target=null;this.id=c;this.type=d;this.dragTarget=null;this.a=this.button=Ta(e)?e:-1;this.buttons=Ta(f)?f:0}r(\"H.mapevents.Pointer\",Hl);\nfunction Il(a,b,c){if(isNaN(b))throw Error(\"x needs to be a number\");if(isNaN(c))throw Error(\"y needs to be a number\");a.viewportX=b;a.viewportY=c}Hl.prototype.c=function(){return this.a};Hl.prototype.getLastChangedButton=Hl.prototype.c;function Jl(a,b){a.a=b;a.buttons|=Hl.prototype.b[+b]||0}function Kl(a,b){a.a=b;a.buttons&=~(Hl.prototype.b[+b]||0)}Hl.prototype.b=[1,4,2];var Ll={NONE:-1,LEFT:0,MIDDLE:1,RIGHT:2};Hl.Button=Ll;function Ml(a){this.a=a instanceof Array?a.slice(0):[]}p=Ml.prototype;p.clear=function(){this.a.splice(0,this.a.length)};p.length=function(){return this.a.length};p.indexOf=function(a){for(var b=this.a.length;b--;)if(this.a[b].id===a)return b;return-1};function Nl(a,b){var c=a.indexOf(b);return-1!==c?a.a[c]:null}p.remove=function(a){a=this.indexOf(a);return-1!==a?this.a.splice(a,1)[0]:null};function Ol(a,b){for(var c=a.a.length,d=[];c--;)a.a[c].type!==b&&d.push(a.a[c]);a.a=d}\nfunction Pl(a,b){for(var c=a.a.length;c--;)if(a.a[c].dragTarget===b)return!0;return!1}p.push=function(a){if(a instanceof Hl)return this.a.push(a);throw Error(\"list needs a pointer\");};p.clone=function(){return new Ml(this.a)};function Ql(a,b,c){c=c||{};if(!(a instanceof Q))throw Error(\"events: map instance required\");if(!(b instanceof Array))throw Error(\"events: map array required\");xc.call(this);this.C=c.Wi||300;this.P=c.Vi||50;this.O=c.Zi||50;this.U=c.$i||500;this.N=c.Yi||900;this.T=c.Xi||50;this.map=a;this.j=this.map.va;this.l=this.j.element;this.A=b;this.a=new Ml;this.c=new Ml;this.i={};this.f=null;this.s=!0;this.v={};this.m={};this.o=null;this.Wc=z(this.Wc,this);this.I={pointerdown:this.Qh,pointermove:this.Rh,pointerup:this.Sh,\npointercancel:this.Ph};Rl(this)}v(Ql,xc);function Rl(a,b){for(var c,d,e=0,f=a.A.length,e=0;e<f;e++)d=a.A[e],c=d.listener,\"function\"===typeof c&&(b?(d.target||a.l).removeEventListener(d.La,c):(d.target||a.l).addEventListener(d.La,c))}\nfunction Sl(a,b,c){var d,e=a.I[b],f,g;if(\"function\"===typeof e)for(\"pointermove\"!==b&&(a.s=!0),f=0,g=a.c.length();f<g;f++)b=a.c.a[f],a.l.contains(c.target)?(d=a,d=d.f===b?b.target:0<=b.viewportX&&b.viewportX<d.j.width&&0<=b.viewportY&&b.viewportY<d.j.height?d.map.s(b.viewportX,b.viewportY)||d.map:null):d=null,Tl(b.id,a.v),e.call(a,b,d,c);a.c.clear()}p=Ql.prototype;\np.Sh=function(a,b,c){a.target=b;Ul(this,a,c);Vl(this,b,\"pointerup\",c,a);\"mouse\"!==a.type&&Vl(this,b,\"pointerleave\",c,a);b=this.i[a.id];var d={x:a.viewportX,y:a.viewportY},e=c.timeStamp,f=a.target,g=this.o;b&&b.target===f&&b.ue.distance(d)<this.O&&e-b.Ef<this.U?(Vl(this,f,\"tap\",c,a),g&&g.target===f&&e-g.Ef<this.C?g.ue.distance({x:a.viewportX,y:a.viewportY})<this.P&&(Vl(this,f,\"dbltap\",c,a),this.o=null):this.o={target:f,ue:new M(a.viewportX,a.viewportY),Ef:c.timeStamp}):this.o=null;this.i={};Tl(a.id,\nthis.m)};function Ul(a,b,c){b===a.f&&(Vl(a,b.dragTarget,\"dragend\",c,b),a.f=null,Tl(b.id,a.v));b.dragTarget=null}p.Wc=function(a,b){var c=this;Vl(this,a.dragTarget,\"drag\",b,a);Tl(a.id,this.v);this.v[a.id]=setTimeout(function(){c.Wc(a,b)},150)};function Tl(a,b){b[a]&&(clearTimeout(b[a]),delete b[a])}\nfunction Wl(a,b,c){var d=b.target,e=new M(b.viewportX,b.viewportY),f=b.id;Tl(f,a.m);a.m[f]=setTimeout(function(){d&&d===b.target&&e.distance({x:b.viewportX,y:b.viewportY})<a.T&&(Vl(a,d,\"longpress\",c,b),delete a.i[b.id])},a.N)}\np.Rh=function(a,b,c){var d=a.dragTarget,e=a.id,f;f=a.target;a.target=b;f!==b&&(Vl(this,f,\"pointerleave\",c,a),Vl(this,b,\"pointerenter\",c,a));d?this.f?this.Wc(a,c):this.s?this.s=!1:(this.f=a,Vl(this,d,\"dragstart\",c,a),this.Wc(a,c),delete this.i[e],this.s=!0):(!this.f||this.f&&this.f.dragTarget!==b&&this.f.dragTarget!==this.map)&&Vl(this,b,\"pointermove\",c,a)};\np.Qh=function(a,b,c){var d=!(/^(?:mouse|pen)$/.test(a.type)&&0!==c.button),e;b&&(a.target=b,this.i[a.id]={ue:new M(a.viewportX,a.viewportY),target:a.target,Ef:c.timeStamp},\"mouse\"!==a.type&&Vl(this,b,\"pointerenter\",c,a),e=Vl(this,b,\"pointerdown\",c,a),!this.f&&d&&(b.draggable&&!Pl(this.a,b)?a.dragTarget=b:!this.map.draggable||e.defaultPrevented||Pl(this.a,this.map)||(a.dragTarget=this.map)),Wl(this,a,c))};\np.Ph=function(a,b,c){a.target=null;b?(Vl(this,b,\"pointerleave\",c,a),Vl(this,b,\"pointercancel\",c,a)):Vl(this,this.map,\"pointercancel\",c,a);Ul(this,a,c);this.i={};Tl(a.id,this.m)};function Vl(a,b,c,d,e){var f;if(b&&\"function\"===typeof b.dispatchEvent){f=Gl;var g=a.a.a,h=a.c.a;a=a.a;var k,l=a.a.length,m=[];for(k=0;k<l;k++)a.a[k].target===b&&m.push(a.a[k]);f=new f(c,g,h,m,e,b,d);e.button=/^(?:longpress|(?:dbl)?tap|pointer(?:down|up))$/.test(c)?e.a:Ll.NONE;b.dispatchEvent(f)}return f}\np.D=function(){Rl(this,!0);this.a.clear();this.c.clear();var a=this.v,b;for(b in a)Tl(b,a);var a=this.m,c;for(c in a)Tl(c,a);this.f=this.i=this.o=this.map=this.c=this.a=this.A=this.b=null;xc.prototype.D.call(this)};function Xl(a){this.g=z(this.g,this);Ql.call(this,a,[{La:\"touchstart\",listener:this.g},{La:\"touchmove\",listener:this.g},{La:\"touchend\",listener:this.g},{La:\"touchcancel\",listener:this.g}]);this.F={touchstart:\"pointerdown\",touchmove:\"pointermove\",touchend:\"pointerup\",touchcancel:\"pointercancel\"};this.B=(a=(a=a.j)?a.b:null)?Array.prototype.slice.call(a.querySelectorAll(\"a\"),0):[]}v(Xl,Ql);\nXl.prototype.g=function(a){var b=a.touches,c=this.a.length(),d;if(\"touchstart\"===a.type&&c>=b.length){c=this.a.clone();for(d=b.length;d--;)c.remove(b[d].identifier);for(d=c.length();d--;)this.a.remove(c.a[d].id);this.c=c;Sl(this,\"pointercancel\",a);this.c.clear()}if(this.F[a.type]){b=Dl(this.j.element);c=a.type;d=a.changedTouches;var e=d.length,f,g,h,k,l,m;this.c.clear();for(m=0;m<e;m++)if(h=d[m],l=Nl(this.a,h.identifier),f=h.pageX-b.x,g=h.pageY-b.y,l)if(\"touchmove\"===c){if(h=Math.abs(l.viewportX-\nf),k=Math.abs(l.viewportY-g),1<h||1<k||1===h&&1===k)Il(l,f,g),this.c.push(l)}else\"touchend\"===c&&(this.a.remove(l.id),this.c.push(l),Kl(l,Ll.LEFT));else l=new Hl(f,g,h.identifier,\"touch\",Ll.LEFT,1),this.a.push(l),this.c.push(l);Sl(this,this.F[a.type],a);-1===this.B.indexOf(a.target)&&a.preventDefault()}};Xl.prototype.D=function(){this.B=null;Ql.prototype.D.call(this)};function Yl(a){var b=[],b=Zl(this);(navigator.pointerEnabled||navigator.msPointerEnabled)&&b.push({La:\"MSHoldVisual\",listener:\"prevent\"});Ql.call(this,a,b)}v(Yl,Ql);function Zl(a){var b=navigator.pointerEnabled,c,d,e=[];a.g=z(a.g,a);\"MSPointerDown MSPointerMove MSPointerUp MSPointerCancel MSPointerOut MSPointerOver\".split(\" \").forEach(function(f){c=f.toLowerCase().replace(/ms/g,\"\");d=b?c:f;e.push({La:d,listener:a.g,target:\"MSPointerUp\"===f||\"MSPointerMove\"===f?window:null})});return e}\nvar $l={2:\"touch\",3:\"pen\",4:\"mouse\"};\nYl.prototype.g=function(a){var b=navigator.xi?a.type:a.type.toLowerCase().replace(/ms/g,\"\"),c=Dl(this.l),d=Nl(this.a,a.pointerId),e=a.pageX-c.x,c=a.pageY-c.y,f=$l[a.pointerType]||a.pointerType;El&&\"rtl\"===w.getComputedStyle(this.j.element).direction&&(e-=(w.devicePixelRatio-1)*this.j.width);if(!(d||b in{pointerup:1,pointerout:1,pointercancel:1}||\"touch\"===f&&\"pointerdown\"!==b)){var d={x:e,y:c},g=a.pointerType;\"number\"===typeof g&&(g=$l[g]);d=new Hl(d.x,d.y,a.pointerId,g,a.button,a.buttons);this.a.push(d)}d&&\n(b in{pointerup:1,pointercancel:1}?(\"touch\"===f&&this.a.remove(d.id),Kl(d,a.button)):\"pointerdown\"===b&&(\"touch\"===a.pointerType&&(Ol(this.a,\"mouse\"),Ol(this.a,\"pen\")),Jl(d,a.button)),this.c.push(d),\"pointermove\"!==b?(Il(d,e,c),Sl(this,\"pointerout\"===b||\"pointerover\"===b?\"pointermove\":b,a)):d.viewportX===e&&d.viewportY===c||a.target===document.documentElement||(Il(d,e,c),Sl(this,b,a)));this.c.clear()};function am(a,b,c,d){am.u.constructor.call(this,\"contextmenu\");this.items=[];this.viewportX=a;this.viewportY=b;this.target=c;this.originalEvent=d}v(am,Bc);r(\"H.mapevents.ContextMenuEvent\",am);function bm(a){this.He=z(this.He,this);this.Je=z(this.Je,this);this.Ie=z(this.Ie,this);this.B=!1;this.g=-1;this.F=0;bm.u.constructor.call(this,a,[{La:\"contextmenu\",listener:this.He},{target:a,La:\"longpress\",listener:this.Je},{target:a,La:\"dbltap\",listener:this.Ie}])}v(bm,Ql);p=bm.prototype;p.Je=function(a){var b=a.currentPointer;\"touch\"===b.type&&1===a.pointers.length&&cm(this,b.viewportX,b.viewportY,a.originalEvent,a.target)};p.Ie=function(a){\"touch\"===a.currentPointer.type&&(this.F=Date.now())};\np.He=function(a){var b=this;-1===this.g?this.g=setTimeout(function(){var c=Dl(b.l),d=a.pageX-c.x,c=a.pageY-c.y;b.g=-1;cm(b,d,c,a)},this.C):(clearInterval(this.g),this.g=-1);a.preventDefault()};function cm(a,b,c,d,e){var f=a.map;e=e||f.s(b,c)||f;var g=Date.now()-a.F;!a.B&&g>a.N&&(a.B=!0,e.dispatchEvent(new am(b,c,e,d)),ti(f.b,a.Of,a.dg,!1,a))}p.Of=[\"mousedown\",\"touchstart\",\"pointerdown\",\"wheel\"];p.dg=function(){this.B&&(this.B=!1,this.map.dispatchEvent(new Bc(\"contextmenuclose\",this.map)))};\np.D=function(){var a=this.map.b;clearInterval(this.g);a&&vi(a,this.Of,this.dg,!1,this);Ql.prototype.D.call(this)};function dm(a,b,c,d,e){dm.u.constructor.call(this,\"wheel\");this.delta=a;this.viewportX=b;this.viewportY=c;this.target=d;this.originalEvent=e}v(dm,Bc);r(\"H.mapevents.WheelEvent\",dm);function em(a){var b=\"onwheel\"in document;this.K=b;this.F=(b?\"d\":\"wheelD\")+\"elta\";this.g=z(this.g,this);em.u.constructor.call(this,a,[{La:(b?\"\":\"mouse\")+\"wheel\",listener:this.g}]);this.B=this.map.va}v(em,Ql);\nem.prototype.g=function(a){var b=Dl(this.l),c;c=a.pageX-b.x;var b=a.pageY-b.y,d=this.F,e=a[d+(d+\"Y\"in a?\"Y\":\"\")],f,g,h;El&&\"rtl\"===w.getComputedStyle(this.B.element).direction&&(c-=(w.devicePixelRatio-1)*this.B.width);e&&(h=Math.abs,f=h(e),e=(!(g=a[d+\"X\"])||3<=f/h(g))&&(!(g=a[d+\"Z\"])||3<=f/h(g))?((0<e)-(0>e))*(this.K?1:-1):0);a=new dm(e,c,b,null,a);a.delta&&((a.target=c=this.map.Ma(a.viewportX,a.viewportY)[0])&&sa(c.dispatchEvent)&&c.dispatchEvent(a),a.defaultPrevented||this.map.dispatchEvent(a))};function fm(a){var b=window;this.g=z(this.g,this);Ql.call(this,a,[{La:\"mousedown\",listener:this.g},{La:\"mousemove\",listener:this.g,target:b},{La:\"mouseup\",listener:this.g,target:b},{La:\"mouseover\",listener:this.g},{La:\"mouseout\",listener:this.g},{La:\"dragstart\",listener:this.B}])}v(fm,Ql);\nfm.prototype.g=function(a){var b=a.type,c=Dl(this.l),c={x:a.pageX-c.x,y:a.pageY-c.y},d;(d=this.a.a[0])||(d=new Hl(c.x,c.y,1,\"mouse\"),this.a.push(d));this.c.push(d);Il(d,c.x,c.y);/^mouse(?:move|over|out)$/.test(b)?Sl(this,\"pointermove\",a):(/^mouse(down|up)$/.test(b)&&(c=a.which-1,\"up\"===Fl.RegExp.$1?Kl(d,c):Jl(d,c)),Sl(this,b.replace(\"mouse\",\"pointer\"),a));this.c.clear()};fm.prototype.B=function(a){a.preventDefault()};function gm(a){var b=a.va.element.style;if(-1!==hm.indexOf(a))throw Error(\"InvalidArgument: map is already in use\");this.a=a;hm.push(a);b.msTouchAction=b.touchAction=\"none\";this.f=this.g=this.b=this.c=null;navigator.msPointerEnabled||navigator.pointerEnabled?this.c=new Yl(this.a):(this.c=new Xl(this.a),this.b=new fm(this.a));this.g=new em(this.a);this.f=new bm(this.a);this.a.Eb(this.J,this);xc.call(this)}v(gm,xc);r(\"H.mapevents.MapEvents\",gm);var hm=[];\ngm.prototype.J=function(){this.a=null;this.c.J();this.g.J();this.f.J();this.b&&this.b.J();hm.splice(hm.indexOf(this.a),1);xc.prototype.J.call(this)};gm.prototype.dispose=gm.prototype.J;gm.prototype.i=function(){return this.a};gm.prototype.getAttachedMap=gm.prototype.i;function im(a,b){if(-1!==jm.indexOf(a))throw new C(im,0,\"events are already used\");var c=b||{},d;xc.call(this);this.a=d=a.a;this.o=a;jm.push(a);d.draggable=!0;this.i=c.kinetics||{duration:600,Be:Nj};this.l=7;this.enable(c.enabled||this.l);c=Q.EngineType;this.c=d.va;this.f=this.c.element;this.j=c.P2D;d.addEventListener(\"dragstart\",this.xg,!1,this);d.addEventListener(\"drag\",this.Og,!1,this);d.addEventListener(\"dragend\",this.Pg,!1,this);d.addEventListener(\"wheel\",this.Rg,!1,this);d.addEventListener(\"dbltap\",\nthis.Ng,!1,this);d.addEventListener(\"tap\",this.Qg,!1,this);d.addEventListener(\"pointermove\",this.Vg,!1,this);ui(this.f,\"contextmenu\",this.Mg,!1,this);a.Eb(this.J,this)}v(im,xc);r(\"H.mapevents.Behavior\",im);var jm=[];im.prototype.b=0;im.DRAGGING=1;im.WHEELZOOM=2;im.DBLTAPZOOM=4;p=im.prototype;\np.xg=function(a){var b=a.pointers,c=this.c;a=b[0];b=b[1]||{};if(this.b&1&&(c.startInteraction(17,this.i),c.interaction(a.viewportX,a.viewportY,b.viewportX,b.viewportY),this.b&2)){c=a.viewportX;a=a.viewportY;var d;this.g&&(b=this.a.getZoom(),d=Math[0>this.g?\"ceil\":\"floor\"](b),b!==d&&(this.g=null,this.zoom(b,d,c,a)))}};p.Og=function(a){var b=a.pointers[0],c=a.pointers[1]||Cl;this.b&1&&(this.c.interaction(b.viewportX,b.viewportY,c.viewportX,c.viewportY),a.originalEvent.preventDefault())};\np.Pg=function(){this.b&1&&this.c.endInteraction(!this.i)};p.zoom=function(a,b,c,d){var e=this.a.c;if(isNaN(+a))throw Error(\"start zoom needs to be a number\");if(isNaN(+b))throw Error(\"to zoom needs to be a number\");0!==+b-+a&&(e.startControl(null,c,d),e.control(0,0,.006),e.endControl(!0,function(a){a.zoom=b}))};\np.Rg=function(a){var b,c,d,e;this.b&2&&(b=a.delta,c=this.a.getZoom(),e=Math[0>b?\"ceil\":\"floor\"](c-b),d=this.a,d.g().type===this.j?(this.zoom(c,e,a.viewportX,a.viewportY),this.g=b):(c=this.a.c.Ab(),c.fov+=16*b,d.c.Jb(c)),a.originalEvent.preventDefault())};p.Qg=function(a){a=a.currentPointer;this.a.g().type===Pi&&(a=this.a.Va(a.viewportX,a.viewportY),this.a.c.Jb(a))};p.Vg=function(a){a=a.currentPointer;this.a.g().sa(a.viewportX,a.viewportY)};\np.Ng=function(a){var b=a.currentPointer,c=this.a.getZoom(),d=a.currentPointer.type;this.j===this.a.g().type&&(a=\"mouse\"===d?0===a.originalEvent.button?-1:1:0<a.pointers.length?1:-1,a=Math[0>a?\"ceil\":\"floor\"](c-a),this.b&4&&this.zoom(c,a,b.viewportX,b.viewportY))};p.Mg=function(a){return this.b&4?(a.preventDefault(),!1):!0};\np.J=function(){var a=this.a;a&&(a.draggable=!1,a.removeEventListener(\"dragstart\",this.xg,!1,this),a.removeEventListener(\"drag\",this.Og,!1,this),a.removeEventListener(\"dragend\",this.Pg,!1,this),a.removeEventListener(\"wheel\",this.Rg,!1,this),a.removeEventListener(\"tap\",this.Qg,!1,this),a.removeEventListener(\"dbltap\",this.Ng,!1,this),a.removeEventListener(\"pointermove\",this.Vg,!1,this),this.a=null);this.f&&(this.f.style.msTouchAction=\"\",vi(this.f,\"contextmenu\",this.Mg,!1,this),this.f=null);this.i=this.c=\nnull;jm.splice(jm.indexOf(this.o),1);xc.prototype.J.call(this)};im.prototype.dispose=im.prototype.J;im.prototype.disable=function(a){this.c.endInteraction(!0);a?this.b&a&&(this.b-=a,a&1&&(this.a.draggable=!1)):(this.b=0,this.a.draggable=!1)};im.prototype.disable=im.prototype.disable;im.prototype.enable=function(a){a?this.b&a||(this.b+=a,a&1&&(this.a.draggable=!0)):(this.b=this.l,this.a.draggable=!0)};im.prototype.enable=im.prototype.enable;\nim.prototype.m=function(a){if(isNaN(a))throw Error(\"behavior: number required\");return!!(this.b&a)};im.prototype.isEnabled=im.prototype.m;r(\"H.mapevents.buildInfo\",function(){return Bh(\"mapsjs-mapevents\",\"0.17.0\",\"ed0390e\")});\n");;
H.util.eval("function ar(a,b,c){b=ab(b)?b+\"px\":b;c=ab(c)?c+\"px\":c;a.style[hi(\"transform\")]=\"translate(\"+b+\",\"+c+\")\"}function br(a){var b=a.ownerDocument,c=b.documentElement,b=b.defaultView,d=a.getBoundingClientRect();a=d.left;d=d.top;isNaN(b.pageXOffset)?(a+=c.scrollLeft,d+=c.scrollTop):(a+=b.pageXOffset,d+=b.pageYOffset);return new M(a,d)}var cr={};function dr(a){a?this.a=a:this.a=this.b()}\ndr.prototype.b=function(){var a=Function(\"return this;\")(),b=a.navigator,c=[];b&&(b.msPointerEnabled?c.push(er):b.xi&&c.push(fr));1>c.length&&(\"TouchEvent\"in a&&c.push(gr),c.push(hr));return c};r(\"H.ui.util.Events.prototype.detectEventSets\",dr.prototype.b);dr.prototype.addEventListener=function(a,b,c,d){for(var e=this.a,f,g=e.length,h=!1;g--;)if(f=e[g][b])h=!0,a.addEventListener(f,c,d||!1);h||a.addEventListener(b,c,d||!1)};\ndr.prototype.removeEventListener=function(a,b,c,d){for(var e=this.a,f,g=e.length,h=!1;g--;)if(f=e[g][b])h=!0,a.removeEventListener(f,c,d||!1);h||a.removeEventListener(b,c,d||!1)};\nvar fr={start:\"pointerdown\",end:\"pointerup\",move:\"pointermove\",cancel:\"pointercancel\",over:\"pointerover\",out:\"pointerout\",hover:\"pointerhover\"},er={start:\"MSPointerDown\",end:\"MSPointerUp\",move:\"MSPointerMove\",cancel:\"MSPointerCancel\",over:\"MSPointerOver\",out:\"MSPointerOut\",hover:\"MSPointerHover\"},gr={start:\"touchstart\",end:\"touchend\",move:\"touchmove\",cancel:\"touchcancel\"},hr={start:\"mousedown\",end:\"mouseup\",move:\"mousemove\",over:\"mouseover\",out:\"mouseout\",hover:\"mousehover\"};function ir(a,b,c,d){a=a.createElement(b);c&&(a.className=c);d&&(a.innerHTML=d);return a}function jr(a,b){for(var c=1,d=arguments.length;c<d;c++)a.appendChild(arguments[c])}var kr=new dr;function lr(a,b,c){kr.addEventListener(a,b,c,void 0)}function mr(a,b,c){kr.removeEventListener(a,b,c,void 0)};function X(a,b){I.call(this);this.ra=a||\"div\";this.v=b?b.split(\" \"):[];this.qa(!1);this.B(null);this.el=null}v(X,I);r(\"H.ui.base.Element\",X);X.prototype.ca=function(a){if(!a)throw Error(\"Wrong document object\");this.el=ir(a,this.ra,this.v.join(\" \"));this.renderInternal(this.el,a);this.qa(this.g,!0);nr(this,this.Ua);this.setVisibility(this.N);return this.b()};X.prototype.X=function(){};X.prototype.renderInternal=X.prototype.X;X.prototype.wa=function(){return this.g};X.prototype.isDisabled=X.prototype.wa;\nX.prototype.qa=function(a,b){if(a!==this.g||b)(this.g=a)?this.f(\"H_disabled\"):this.i(\"H_disabled\");return this};X.prototype.setDisabled=X.prototype.qa;X.prototype.getData=function(){return this.P};X.prototype.getData=X.prototype.getData;X.prototype.B=function(a){this.P=a};X.prototype.setData=X.prototype.B;function nr(a,b){a.Ua=b;a.b()&&(b?a.b().setAttribute(\"title\",b):a.b().removeAttribute(\"title\"))}X.prototype.b=function(){return this.el};X.prototype.getElement=X.prototype.b;\nX.prototype.N=!0;X.prototype.setVisibility=function(a){var b;this.N=a;if(b=this.el)b.style.display=a?\"\":\"none\"};X.prototype.setVisibility=X.prototype.setVisibility;X.prototype.getVisibility=function(){return this.N};X.prototype.getVisibility=X.prototype.getVisibility;X.prototype.f=function(a){var b=this.b();0>this.v.indexOf(a)&&this.v.push(a);b&&(b.className=this.v.join(\" \"));return this};X.prototype.addClass=X.prototype.f;\nX.prototype.i=function(a){a=this.v.indexOf(a);var b=this.b();-1<a&&this.v.splice(a,1);b&&(b.className=this.v.join(\" \"));return this};X.prototype.removeClass=X.prototype.i;function or(a){(a=a.b())&&a.parentNode&&Ge(a)}X.prototype.D=function(){X.u.D.call(this);or(this);this.P=this.el=null};function pr(a){a=a||{};X.call(this,\"div\",\"H_btn\");this.Sa(a.label||\" \");nr(this,a.tooltip||\"\");this.B(a.data);this.qa(!!a.disabled);this.L(qr.UP,!0);a.onStateChange&&this.addEventListener(\"statechange\",a.onStateChange);this.l=z(this.l,this);this.c=z(this.c,this)}v(pr,X);r(\"H.ui.base.Button\",pr);pr.prototype.X=function(a){lr(a,\"start\",this.l);lr(a,\"end\",this.c);lr(a,\"out\",this.c);this.Sa(this.a,!0)};pr.prototype.renderInternal=pr.prototype.X;pr.prototype.getState=function(){return this.G};\npr.prototype.getState=pr.prototype.getState;pr.prototype.L=function(a,b){a!==this.G&&(this.G=a,a===qr.DOWN?this.f(\"H_active\"):this.i(\"H_active\"),b||this.dispatchEvent(\"statechange\"));return this};pr.prototype.setState=pr.prototype.L;pr.prototype.o=function(){return this.a};pr.prototype.getLabel=pr.prototype.o;pr.prototype.Sa=function(a,b){if(b||a!==this.a)this.a=a,this.b()&&(this.b().innerHTML=a);return this};pr.prototype.setLabel=pr.prototype.Sa;\npr.prototype.l=function(a){this.g||this.L(qr.DOWN);a.preventDefault()};pr.prototype.c=function(a){this.g||this.L(qr.UP);a.preventDefault()};pr.prototype.D=function(){var a=this.b();a&&(mr(a,\"start\",this.l),mr(a,\"end\",this.c),mr(a,\"out\",this.c));X.prototype.D.call(this)};var qr={UP:\"up\",DOWN:\"down\"};pr.State=qr;function rr(a){pr.call(this,a);this.m=function(a){a.preventDefault()};this.j=z(function(a){this.g||this.toggleState();a.preventDefault()},this)}v(rr,pr);r(\"H.ui.base.PushButton\",rr);rr.prototype.X=function(a){lr(a,\"start\",this.j);lr(a,\"end\",this.m);this.Sa(this.a,!0)};rr.prototype.renderInternal=rr.prototype.X;rr.prototype.s=function(){var a=qr.DOWN;this.L(this.getState()===a?qr.UP:a);return this};rr.prototype.toggleState=rr.prototype.s;\nrr.prototype.D=function(){var a=this.b();a&&mr(a,\"start\",this.j);pr.prototype.D.call(this)};var sr={TOP_LEFT:\"top-left\",TOP_CENTER:\"top-center\",TOP_RIGHT:\"top-right\",LEFT_TOP:\"left-top\",LEFT_MIDDLE:\"left-middle\",LEFT_BOTTOM:\"left-bottom\",RIGHT_TOP:\"right-top\",RIGHT_MIDDLE:\"right-middle\",RIGHT_BOTTOM:\"right-bottom\",BOTTOM_LEFT:\"bottom-left\",BOTTOM_CENTER:\"bottom-center\",BOTTOM_RIGHT:\"bottom-right\"};r(\"H.ui.LayoutAlignment\",sr);function tr(a,b,c){X.call(this,a,b);this.o=c?[].concat(c):[]}v(tr,X);r(\"H.ui.base.Container\",tr);tr.prototype.qa=function(a,b){var c=this.o?this.o.length:0;for(X.prototype.qa.call(this,a,b);c--;)this.o[c].qa(a,b);return this};tr.prototype.setDisabled=tr.prototype.qa;tr.prototype.c=function(a){var b=this.b();this.o.push(a);b&&(a.ca(b.ownerDocument),b.appendChild(a.b()));return this};tr.prototype.addChild=tr.prototype.c;tr.prototype.ea=function(){return[].concat(this.o)};\ntr.prototype.getChildren=tr.prototype.ea;tr.prototype.removeChild=function(a){var b=this.o.indexOf(a),c=this.b();0<=b&&(this.o.splice(b,1),c&&c.removeChild(a.b()))};tr.prototype.removeChild=tr.prototype.removeChild;tr.prototype.X=function(a,b){for(var c=0,d=this.o.length;c<d;c++)a.appendChild(this.o[c].ca(b))};tr.prototype.renderInternal=tr.prototype.X;tr.prototype.D=function(){this.o.forEach(this.Ga,this);X.prototype.D.call(this)};tr.prototype.Ga=function(a){a.J()};function ur(){tr.call(this,\"div\",\"H_pano_mm\");this.a=new X(\"div\",\"H_pano_circle H_noevs\");this.l=new X(\"div\",\"H_pano_man H_noevs\");this.c(this.a);this.c(this.l)}v(ur,tr);ur.prototype.X=function(a,b){tr.prototype.renderInternal.call(this,a,b);ar(this.l.el,-1E3,-1E3);ar(this.a.el,-1E3,-1E3);this.a.el.innerHTML='<svg class=\"H_icon H_noevs\" viewBox=\"0 0 120 60\"><ellipse cx=\"60\" cy=\"30\" rx=\"40\" ry=\"20\" stroke-width=\"3\" /></svg>';vr(this,!1)};\nr(\"H.ui.panorama.Miniman.prototype.renderInternal\",ur.prototype.X);\nfunction vr(a,b,c,d){a.l.el.innerHTML=b?'<svg class=\"H_icon H_noevs\" viewBox=\"0 0 120 192\"><path d=\"m5,83c8,-15 16,-18 23,-20c6,-2 16,-1 17,-1c0,0 11,0 15,0c5,0 6,0 11,0c7,0 20,-6 27,-18c3,-6 4,-9 6,-12c2,-3 7,-5 11,-3c4,2 4,8 3,11c-1,4 -6,15 -9,20c-19,30 -37,32 -38,32l0,94c0,3 -3,7 -8,7c-4,0 -9,-3 -9,-7l-3,-53c0,0 -3,0 -4,0l-3,53c0,3 -3,7 -9,7c-4,0 -9,-3 -9,-7l0,-88c0,0 -9,0 -9,29c0,3 -1,10 -9,10c-7,0 -10,-7 -10,-11c0,-14 0,-31 6,-41l0,0l1,-2z\" stroke-width=\"10\"/><circle r=\"25\" cy=\"25\" cx=\"49\" stroke-width=\"10\"/></svg>':'<svg class=\"H_icon H_noevs\" viewBox=\"0 0 120 192\"><path d=\"m96,85c-6,-13 -17,-18 -23,-21c-6,-2 -12,-2 -12,-2c0,0 -22,0 -22,0c0,0 -6,0 -12,2c-6,2 -16,8 -23,21c-4,9 -4,27 -4,38c0,6 5,9 9,9c3,0 8,-3 8,-9c0,-28 9,-27 9,-27l0,88c0,4 3,7 8,7c4,0 9,-1 9,-7l4,-52c0,0 2,0 3,0l4,52c0,5 4,7 9,7c4,0 8,-3 8,-7l0,-88c0,0 9,0 9,27c0,5 5,9 8,9c3,0 9,-2 9,-9c0,-11 3,-28 -1,-38l0,0m-22,-60c0,14 -11,25 -25,25c-14,0 -25,-11 -25,-25c0,-14 11,-25 25,-25c14,0 25,11 25,25z\" stroke-width=\"10\"/></svg>';\nb&&ar(a.a.el,c||0,d||0);a.qa(!b)};function wr(a){I.call(this);this.f=a;this.map=a.Bb();this.i=this.g=Number.MAX_VALUE;this.Bc=z(this.Bc,this);this.Td=z(this.Td,this);this.mf=z(this.mf,this);this.Od=z(this.Od,this);this.Nd=z(this.Nd,this);this.Md=z(this.Md,this);this.Rd=z(this.Rd,this);this.Id=z(this.Id,this);this.b=new ur;this.b.ca(a.oa.ownerDocument);this.cc=z(this.cc,this);lr(this.b.a.el,\"start\",this.cc);this.o=this.j=Number.MAX_VALUE;this.Wd=z(this.Wd,this);this.Jd=z(this.Jd,this);this.a=new xr(this.map.Oa());this.a.f(\"H_ib_noclose H_pano_ib\");\nthis.v=!1;this.l=ja(\"H.map.render.panorama\").RenderEngine;this.c=0}v(wr,I);p=wr.prototype;\np.enable=function(){var a=this.map;this.v||(this.f.oa.insertBefore(this.b.el,this.f.oa.firstChild),this.f.ud(this.a),this.a.close(),lr(this.a.el,\"start\",this.cc),a.addEventListener(\"pointermove\",this.Bc),a.addEventListener(\"drag\",this.Bc),a.addEventListener(\"tap\",this.Jd),a.addEventListener(\"mapviewchange\",this.Od),a.addEventListener(\"mapviewchangestart\",this.Nd),a.addEventListener(\"mapviewchangeend\",this.Md),a.addEventListener(\"pointerleave\",this.Id),a.addEventListener(\"pointerenter\",this.Rd),this.v=\n!0)};p.Id=function(a){\"mouse\"===a.currentPointer.type&&(or(this.b),this.f.B(this.a))};p.Rd=function(a){\"mouse\"===a.currentPointer.type&&(this.f.oa.insertBefore(this.b.el,this.f.oa.firstChild),this.f.ud(this.a),lr(this.a.el,\"start\",this.cc),this.a.close())};p.cc=function(a){a instanceof MouseEvent&&1!==a.which||yr(this,this.g,this.i)};\np.disable=function(){var a=this.a.el,b=this.map;or(this.b);this.f.B(this.a);a&&mr(a,\"start\",this.cc);mr(this.b.a.el,\"start\",this.cc);b.removeEventListener(\"pointermove\",this.Bc);b.removeEventListener(\"drag\",this.Bc);b.removeEventListener(\"tap\",this.Jd);b.removeEventListener(\"mapviewchange\",this.Od);b.removeEventListener(\"mapviewchangestart\",this.Nd);b.removeEventListener(\"mapviewchangeend\",this.Md);b.removeEventListener(\"pointerleave\",this.Id);b.removeEventListener(\"pointerenter\",this.Rd);this.v=\n!1};function yr(a,b,c){a.l&&(a.j=b,a.o=c,a.l.getClosestPanoramas(a.map.Ka(a.j,a.o),a.Wd))}p.Bc=function(a){var b=a.currentPointer;0===this.map.g().type&&\"touch\"!==b.type&&(a=b.viewportX,b=b.viewportY,this.g!==a||this.i!==b)&&(this.b.l.el.style.display=\"block\",this.B&&clearTimeout(this.B),this.s&&this.s.cancel(),this.m=null,this.g=a,this.i=b,w.setTimeout(z(this.Bi,this,a,b),0),this.B=w.setTimeout(this.Td,350),vr(this.b,!1),this.a.close())};\np.Bi=function(a,b){var c=this.b;ar(c.l.el,a,b);ar(c.a.el,a,b)};p.Td=function(){this.l&&this.l.getClosestPanoramas(this.map.Ka(this.g,this.i),this.mf)};p.mf=function(a){var b=this,c;a&&0<a.length?(c=this.map.o(a[0].position),this.m=a[0].position,vr(this.b,!0,c.x,c.y),c=this.l.getImageUrl(a[0]),this.s=new Gh(\"image\",c),this.s.then(function(c){b.a.s(a[0].position);b.a.o('<img src=\"'+c.src+'\" />');b.a.open()})):this.c&&this.Wd(a)};p.Nd=function(){this.b.a.f(\"H_pano_notransition\");this.a.close()};\np.Md=function(){this.b.a.i(\"H_pano_notransition\")};p.Od=function(){if(this.m){var a=this.map.o(this.m);a&&vr(this.b,!0,a.x,a.y)}this.c=0};p.Jd=function(a){var b=a.currentPointer,c=\"mouse\"===b.type,d=b.viewportX,b=b.viewportY,e=Math.abs;0===a.currentPointer.button&&(1===this.c&&25>e(this.g-d)&&25>e(this.i-b)?this.c++:0===this.c&&this.c++,1!==this.c||c||(this.a.close(),this.g=d,this.i=b,this.j=d,this.o=b,this.Td()),2===this.c||c)&&(yr(this,d,b),this.c=0)};\np.Wd=function(a){a&&0<a.length?this.dispatchEvent({type:\"enter\",position:a[0].position}):(a=this.map.Ka(this.j,this.o),this.a.s(a),this.a.o(this.f.da().translate(\"panorama.unavailableHere\")),this.a.open())};function Y(){tr.call(this,\"div\",\"H_ctl\");this.map=null;this.Mb=\"top-left\"}v(Y,tr);r(\"H.ui.Control\",Y);Y.prototype.Ha=null;Y.prototype.el=Y.prototype.Ha;Y.prototype.Wa=function(a){this.map=a};Y.prototype.ca=function(a){return tr.prototype.ca.call(this,a)};Y.prototype.X=function(a,b){tr.prototype.renderInternal.call(this,a,b);this.l(this.Mb)};Y.prototype.renderInternal=Y.prototype.X;Y.prototype.ld=function(){};Y.prototype.onUnitSystemChange=Y.prototype.ld;Y.prototype.Qa=function(){};\nY.prototype.onMapEngineTypeChange=Y.prototype.Qa;Y.prototype.Bb=function(){return this.map};Y.prototype.getMap=Y.prototype.Bb;Y.prototype.da=function(){return this.sa};Y.prototype.getLocalization=Y.prototype.da;Y.prototype.Ba=function(){return this.Mb};Y.prototype.getAlignment=Y.prototype.Ba;Y.prototype.l=function(a){\"string\"===typeof a&&sr[a.replace(\"-\",\"_\").toUpperCase()]===a&&(this.Mb=a,this.dispatchEvent(\"alignmentchange\"));return this};Y.prototype.setAlignment=Y.prototype.l;function zr(a){var b;b=this.a={wc:{label:'<svg class=\"H_icon\" viewBox=\"75 67 180 200\"><path d=\"m214,153c-6,-13 -17,-18 -23,-21c-6,-2 -12,-2 -12,-2c0,0 -22,0 -22,0c0,0 -6,0 -12,2c-6,2 -16,8 -23,21c-4,9 -4,27 -4,38c0,6 5,9 9,9c3,0 8,-3 8,-9c0,-28 9,-27 9,-27l0,88c0,4 3,7 8,7c4,0 9,-1 9,-7l4,-52c0,0 2,0 3,0l4,52c0,5 4,7 9,7c4,0 8,-3 8,-7l0,-88c0,0 9,0 9,27c0,5 5,9 8,9c3,0 9,-2 9,-9c0,-11 3,-28 -1,-38l0,0z\"/><circle cx=\"167\" cy=\"93\" r=\"25\"/></svg>'},ag:{label:'<svg class=\"H_icon\" viewBox=\"73 72 178 205\"><path d=\"m120,158c8,-15 16,-18 23,-20c6,-2 16,-1 17,-1c0,0 11,0 15,0c5,0 6,0 11,0c7,0 20,-6 27,-18c3,-6 4,-9 6,-12c2,-3 7,-5 11,-3c4,2 4,8 3,11c-1,4 -6,15 -9,20c-19,30 -37,32 -38,32l0,94c0,3 -3,7 -8,7c-4,0 -9,-3 -9,-7l-3,-53c0,0 -3,0 -4,0l-3,53c0,3 -3,7 -9,7c-4,0 -9,-3 -9,-7l0,-88c0,0 -9,0 -9,29c0,3 -1,10 -9,10c-7,0 -10,-7 -10,-11c0,-14 0,-31 6,-41l0,0l1,-2z\"/><circle cx=\"166\" cy=\"99\" r=\"25\"/></svg>'},\nEc:{}};var c=this,d;Y.call(this);this.qa(!0);a&&(Ar(this,a.mapTypes),(d=a.alignment)&&this.l(d));this.coverageButton_=new rr({onStateChange:function(){var a=c.a;c.L(\"down\"===this.getState()?a.ag:a.wc)}});this.s=new pr({onStateChange:function(){c.map.N(0);c.L(c.A)}});this.c(this.coverageButton_);this.c(this.s);this.G=this.A=b.wc}v(zr,Y);r(\"H.ui.Pano\",zr);\nfunction Ar(a,b){var c,d,e,f;if(b){a.C=b;a.F=c=[];e=[\"normal\",\"satellite\",\"terrain\"];for(f=0;f<e.length;f++)b[d=e[f]]&&c.unshift(b[d]);for(d in b)0>e.indexOf(d)&&c.unshift(b[d]);a.qa(!c.length)}}function Br(a,b){var c,d,e,f,g;if(g=b){c=a.C;var h;a:for(e in c)if(cr.hasOwnProperty.call(c,e))for(e in f=c[e],f)if(f[e]===b){h=!0;break a}g=c=h?f:void 0}g&&(d=c.panorama);if(!d)for(e=a.F,f=e.length;f--&&!(d=e[f].panorama););return d}\nzr.prototype.X=function(a,b){Y.prototype.renderInternal.call(this,a,b);this.L(this.a.wc);this.j=new wr(this.jb());this.a.wc.ge=this.da().translate(\"panorama.showCoverage\");this.a.ag.ge=this.da().translate(\"panorama.hideCoverage\");this.a.Ec.ge=this.da().translate(\"panorama.leave\");this.a.Ec.label='<span style=\"padding: 0 0.5em\">'+this.da().translate(\"panorama.leave\")+\"<span>\";this.s.Sa(this.a.Ec.label);nr(this.s,this.a.Ec.ge);var c,d=this;this.j.addEventListener(\"enter\",function(a){d.j.disable();d.map.Ga(a.position,\n!0);setTimeout(function(){d.coverageButton_.setVisibility(!1);d.map.N(Pi)},200)});c=this.map.fa;this.m=z(this.m,this);c.addEventListener(\"add\",this.m);c.addEventListener(\"remove\",this.m,!0,this);c.addEventListener(\"set\",this.m,!0,this)};zr.prototype.renderInternal=zr.prototype.X;zr.prototype.m=function(a){0===a.idx&&this.map&&Br(this,this.map.i)===this.map.i&&(this.j.disable(),this.coverageButton_.L(qr.UP))};\nzr.prototype.L=function(a){var b=this.G,c=this.a,d=a===c.Ec,e=this.coverageButton_;b===c.wc&&(this.K=this.map.i);d?this.A=b:(a===c.wc?(b=\"UP\",c=this.K,this.j&&this.j.disable()):(b=\"DOWN\",c=Br(this,this.map.i),this.j&&this.j.enable()),c&&this.map.Zb(c),e.Sa(a.label),nr(e,a.ge),e.L(qr[b]));this.s.setVisibility(d);e.setVisibility(!d);this.G=a};zr.prototype.Qa=function(a){var b=this.a;this.L(a===Pi?b.Ec:this.A)};zr.prototype.onMapEngineTypeChange=zr.prototype.Qa;function Cr(a,b){var c={},d={};c[\"top-left\"]=ir(b,\"div\",[Dr,Er].join(\" \"));c[\"top-center\"]=ir(b,\"div\",[Dr,Fr,Gr,Er].join(\" \"));c[\"top-right\"]=ir(b,\"div\",[Dr,Er].join(\" \"));c[\"left-top\"]=ir(b,\"div\",[Dr,Hr].join(\" \"));c[\"left-middle\"]=ir(b,\"div\",[Dr,Ir,Jr,Hr].join(\" \"));c[\"left-bottom\"]=ir(b,\"div\",[Dr,Hr].join(\" \"));c[\"right-top\"]=ir(b,\"div\",[Dr,Hr].join(\" \"));c[\"right-middle\"]=ir(b,\"div\",[Dr,Kr,Jr,Hr].join(\" \"));c[\"right-bottom\"]=ir(b,\"div\",[Dr,Hr].join(\" \"));c[\"bottom-left\"]=ir(b,\"div\",[Dr,Er].join(\" \"));\nc[\"bottom-center\"]=ir(b,\"div\",[Dr,Lr,Gr,Er].join(\" \"));c[\"bottom-right\"]=ir(b,\"div\",[Dr,Er].join(\" \"));d[\"top-left\"]=ir(b,\"div\",[Fr,Ir].join(\" \"));d[\"top-right\"]=ir(b,\"div\",[Fr,Kr].join(\" \"));d[\"bottom-left\"]=ir(b,\"div\",[Lr,Ir].join(\" \"));d[\"bottom-right\"]=ir(b,\"div\",[Lr,Kr].join(\" \"));jr(d[\"top-left\"],c[\"top-left\"],c[\"left-top\"]);jr(d[\"top-right\"],c[\"top-right\"],c[\"right-top\"]);jr(d[\"bottom-left\"],c[\"left-bottom\"],c[\"bottom-left\"]);jr(d[\"bottom-right\"],c[\"right-bottom\"],c[\"bottom-right\"]);jr(a,d[\"top-left\"],\nd[\"top-right\"],d[\"bottom-left\"],d[\"bottom-right\"],c[\"top-center\"],c[\"left-middle\"],c[\"right-middle\"],c[\"bottom-center\"]);this.a=c}var Fr=\"H_l_top\",Lr=\"H_l_bottom\",Ir=\"H_l_left\",Kr=\"H_l_right\",Gr=\"H_l_center\",Jr=\"H_l_middle\",Er=\"H_l_horizontal\",Hr=\"H_l_vertical\",Dr=\"H_l_anchor\";function Mr(a){a=a.a;Nr(a[\"top-center\"],!0);Nr(a[\"bottom-center\"],!0);Nr(a[\"left-middle\"],!1);Nr(a[\"right-middle\"],!1)}\nfunction Nr(a,b){var c;b?(c=a.offsetWidth,a.style.marginLeft=-Math.round(.5*c)+\"px\"):(c=a.offsetHeight,a.style.marginTop=-Math.round(.5*c)+\"px\")};var Or={IMPERIAL:\"imperial\",METRIC:\"metric\"};r(\"H.ui.UnitSystem\",Or);var Pr=[];r(\"H.ui.i18n.defaultLocales\",Pr);var Qr={},Rr=[];function Sr(a,b){Qr[a]=b;-1===Pr.indexOf(a)&&Pr.push(a);Rr.length?Tr(a,b):Rr=Object.keys(b)}function Tr(a,b){for(var c=Rr,d=c.length,e;d--;)if(e=c[d],!b[e])throw Error(\"'\"+e+\"' key missing in translation map for \"+a);};Sr(\"nl-NL\",{\"layers.normal\":\"Kaartweergave\",\"layers.satellite\":\"Satelliet\",\"layers.terrain\":\"Terrein\",\"layer.transit\":\"Openbaar vervoer\",\"layer.traffic\":\"Verkeerssituatie\",\"layer.incidents\":\"Toon verkeersincidenten\",\"layers.choose\":\"Weergave kiezen\",minimap:\"Minimap\",\"scale.switchToImperial\":\"Overgaan naar mijlen\",\"scale.switchToMetric\":\"Wijzigen naar km\",\"scale.km\":\"km\",\"scale.m\":\"m\",\"scale.mi\":\"mi\",\"scale.ft\":\"ft\",\"zoom.out\":\"Uitzoomen\",\"zoom.in\":\"Inzoomen\",\"zoom.rectangle\":\"Zoom rectangle\",\"panorama.leave\":\"Straatbeeld verlaten\",\n\"panorama.showCoverage\":\"Toon straatbeeld\",\"panorama.hideCoverage\":\"Verberg straatbeeld\",\"panorama.unavailableHere\":\"Hier hebben we geen Straatbeeld dekking\",\"traffic.MASS_TRANSIT\":\"Openbaar vervoer\",\"traffic.MISCELLANEOUS\":\"Diversen\",\"traffic.ACCIDENT\":\"Ongeval\",\"traffic.OTHER_NEWS\":\"Meer informatie\",\"traffic.PLANNED_EVENT\":\"Geplande afzetting\",\"traffic.ROAD_HAZARD\":\"Gevaar op de weg\",\"traffic.WEATHER\":\"Weer\",\"traffic.CONGESTION\":\"Verkeersopstopping\",\"traffic.CONSTRUCTION\":\"Wegwerkzaamheden\",\"traffic.DISABLED_VEHICLE\":\"Voertuig met pech\",\n\"traffic.from\":\"Begintijd:\",\"traffic.until\":\"Geschatte eindtijd:\",\"distance.measurement\":\"Measure distance\"});Sr(\"pt-PT\",{\"layers.normal\":\"Vista do mapa\",\"layers.satellite\":\"Sat\\u00e9lite\",\"layers.terrain\":\"Terreno\",\"layer.transit\":\"Transportes p\\u00fablicos\",\"layer.traffic\":\"Condi\\u00e7\\u00f5es de tr\\u00e2nsito\",\"layer.incidents\":\"Mostrar incidentes de tr\\u00e2nsito\",\"layers.choose\":\"Escolher vista\",minimap:\"Minimap\",\"scale.switchToImperial\":\"Mudar para milhas\",\"scale.switchToMetric\":\"Mudar para km\",\"scale.km\":\"km\",\"scale.m\":\"m\",\"scale.mi\":\"mi\",\"scale.ft\":\"ft\",\"zoom.out\":\"Diminuir\",\"zoom.in\":\"Aumentar\",\n\"zoom.rectangle\":\"Zoom rectangle\",\"panorama.leave\":\"Sair de Vista de Rua\",\"panorama.showCoverage\":\"Visualizar \\u00e1reas com Vista de Rua\",\"panorama.hideCoverage\":\"Esconder \\u00e1reas com Vista de Rua\",\"panorama.unavailableHere\":\"Vista de Rua indispon\\u00edvel neste local.\",\"traffic.MASS_TRANSIT\":\"Transportes p\\u00fablicos\",\"traffic.MISCELLANEOUS\":\"Diversos\",\"traffic.ACCIDENT\":\"Acidente\",\"traffic.OTHER_NEWS\":\"Outras not\\u00edcias\",\"traffic.PLANNED_EVENT\":\"Evento planeado\",\"traffic.ROAD_HAZARD\":\"Perigo na estrada\",\n\"traffic.WEATHER\":\"Meteorologia\",\"traffic.CONGESTION\":\"Congestionamento\",\"traffic.CONSTRUCTION\":\"Constru\\u00e7\\u00e3o\",\"traffic.DISABLED_VEHICLE\":\"Ve\\u00edculo avariado\",\"traffic.from\":\"Hora de in\\u00edcio:\",\"traffic.until\":\"Hora de fim prevista:\",\"distance.measurement\":\"Measure distance\"});Sr(\"ru-RU\",{\"layers.normal\":\"\\u0420\\u0435\\u0436\\u0438\\u043c \\u043a\\u0430\\u0440\\u0442\\u044b\",\"layers.satellite\":\"\\u0421\\u043f\\u0443\\u0442\\u043d\\u0438\\u043a\\u043e\\u0432\\u0430\\u044f\",\"layers.terrain\":\"\\u041c\\u0435\\u0441\\u0442\\u043d\\u043e\\u0441\\u0442\\u044c\",\"layer.transit\":\"\\u041e\\u0431\\u0449\\u0435\\u0441\\u0442\\u0432\\u0435\\u043d\\u043d\\u044b\\u0439 \\u0442\\u0440\\u0430\\u043d\\u0441\\u043f\\u043e\\u0440\\u0442\",\"layer.traffic\":\"\\u0414\\u043e\\u0440\\u043e\\u0436\\u043d\\u044b\\u0435 \\u0443\\u0441\\u043b\\u043e\\u0432\\u0438\\u044f\",\n\"layer.incidents\":\"\\u041f\\u043e\\u043a\\u0430\\u0437\\u0430\\u0442\\u044c \\u0434\\u043e\\u0440\\u043e\\u0436\\u043d\\u044b\\u0435 \\u0441\\u043e\\u0431\\u044b\\u0442\\u0438\\u044f\",\"layers.choose\":\"\\u0412\\u044b\\u0431\\u0435\\u0440\\u0438\\u0442\\u0435 \\u0432\\u0438\\u0434\",minimap:\"Minimap\",\"scale.switchToImperial\":\"\\u0418\\u0441\\u043f\\u043e\\u043b\\u044c\\u0437\\u043e\\u0432\\u0430\\u0442\\u044c \\u043c\\u0438\\u043b\\u0438\",\"scale.switchToMetric\":\"\\u0418\\u0441\\u043f\\u043e\\u043b\\u044c\\u0437\\u043e\\u0432\\u0430\\u0442\\u044c \\u043a\\u0438\\u043b\\u043e\\u043c\\u0435\\u0442\\u0440\\u044b\",\n\"scale.km\":\"\\u043a\\u043c\",\"scale.m\":\"\\u043c\",\"scale.mi\":\"\\u043c\\u0438\\u043b\\u044c\",\"scale.ft\":\"\\u0444\\u0443\\u0442\",\"zoom.out\":\"\\u041e\\u0442\\u0434\\u0430\\u043b\\u0438\\u0442\\u044c\",\"zoom.in\":\"\\u041f\\u0440\\u0438\\u0431\\u043b\\u0438\\u0437\\u0438\\u0442\\u044c\",\"zoom.rectangle\":\"Zoom rectangle\",\"panorama.leave\":\"\\u0412\\u044b\\u0439\\u0442\\u0438 \\u0438\\u0437 \\u0440\\u0435\\u0436\\u0438\\u043c\\u0430 \\u043f\\u0440\\u043e\\u0441\\u043c\\u043e\\u0442\\u0440\\u0430 \\u0443\\u043b\\u0438\\u0446\",\"panorama.showCoverage\":\"\\u041f\\u043e\\u043a\\u0430\\u0437\\u0430\\u0442\\u044c \\u043e\\u0431\\u043b\\u0430\\u0441\\u0442\\u0438 \\u0441 \\u043f\\u0430\\u043d\\u043e\\u0440\\u0430\\u043c\\u0430\\u043c\\u0438 \\u0443\\u043b\\u0438\\u0446\",\n\"panorama.hideCoverage\":\"\\u0421\\u043a\\u0440\\u044b\\u0442\\u044c \\u043e\\u0431\\u043b\\u0430\\u0441\\u0442\\u0438 \\u0441 \\u043f\\u0430\\u043d\\u043e\\u0440\\u0430\\u043c\\u0430\\u043c\\u0438 \\u0443\\u043b\\u0438\\u0446\",\"panorama.unavailableHere\":\"\\u041d\\u0435\\u0432\\u043e\\u0437\\u043c\\u043e\\u0436\\u043d\\u043e \\u043f\\u043e\\u043a\\u0430\\u0437\\u0430\\u0442\\u044c \\u043f\\u0430\\u043d\\u043e\\u0440\\u0430\\u043c\\u0443 \\u044d\\u0442\\u0438\\u0445 \\u0443\\u043b\\u0438\\u0446\",\"traffic.MASS_TRANSIT\":\"\\u041e\\u0431\\u0449\\u0435\\u0441\\u0442\\u0432\\u0435\\u043d\\u043d\\u044b\\u0439 \\u0442\\u0440\\u0430\\u043d\\u0441\\u043f\\u043e\\u0440\\u0442\",\n\"traffic.MISCELLANEOUS\":\"\\u041f\\u0440\\u043e\\u0447\\u0435\\u0435 \\u0414\\u0422\\u041f\",\"traffic.ACCIDENT\":\"\\u0414\\u0422\\u041f\",\"traffic.OTHER_NEWS\":\"\\u0414\\u0440\\u0443\\u0433\\u0438\\u0435 \\u043d\\u043e\\u0432\\u043e\\u0441\\u0442\\u0438\",\"traffic.PLANNED_EVENT\":\"\\u041f\\u043b\\u0430\\u043d\\u043e\\u0432\\u043e\\u0435 \\u043c\\u0435\\u0440\\u043e\\u043f\\u0440\\u0438\\u044f\\u0442\\u0438\\u0435\",\"traffic.ROAD_HAZARD\":\"\\u0414\\u043e\\u0440\\u043e\\u0436\\u043d\\u0430\\u044f \\u043e\\u043f\\u0430\\u0441\\u043d\\u043e\\u0441\\u0442\\u044c\",\"traffic.WEATHER\":\"\\u041f\\u043e\\u0433\\u043e\\u0434\\u0430\",\n\"traffic.CONGESTION\":\"\\u041f\\u0440\\u043e\\u0431\\u043a\\u0430\",\"traffic.CONSTRUCTION\":\"\\u0420\\u0435\\u043c\\u043e\\u043d\\u0442\",\"traffic.DISABLED_VEHICLE\":\"\\u041d\\u0435\\u0438\\u0441\\u043f\\u0440\\u0430\\u0432\\u043d\\u044b\\u0439 \\u0430\\u0432\\u0442\\u043e\\u043c\\u043e\\u0431\\u0438\\u043b\\u044c\",\"traffic.from\":\"\\u0412\\u0440\\u0435\\u043c\\u044f \\u043d\\u0430\\u0447\\u0430\\u043b\\u0430:\",\"traffic.until\":\"\\u041e\\u0436\\u0438\\u0434\\u0430\\u0435\\u043c\\u043e\\u0435 \\u0432\\u0440\\u0435\\u043c\\u044f \\u043e\\u043a\\u043e\\u043d\\u0447\\u0430\\u043d\\u0438\\u044f:\",\n\"distance.measurement\":\"\\u0418\\u0437\\u043c\\u0435\\u0440\\u0438\\u0442\\u044c \\u0440\\u0430\\u0441\\u0441\\u0442\\u043e\\u044f\\u043d\\u0438\\u0435\"});Sr(\"fi-FI\",{\"layers.normal\":\"Karttan\\u00e4kym\\u00e4\",\"layers.satellite\":\"Satelliitti\",\"layers.terrain\":\"Maasto\",\"layer.transit\":\"Julkinen liikenne\",\"layer.traffic\":\"Liikenneolosuhteet\",\"layer.incidents\":\"N\\u00e4yt\\u00e4 liikennetapahtumat\",\"layers.choose\":\"Valitse n\\u00e4kym\\u00e4\",minimap:\"Minimap\",\"scale.switchToImperial\":\"Vaihda maileihin\",\"scale.switchToMetric\":\"Vaihda kilometreihin\",\"scale.km\":\"km\",\"scale.m\":\"m\",\"scale.mi\":\"mi\",\"scale.ft\":\"ft\",\"zoom.out\":\"Loitonna\",\"zoom.in\":\"L\\u00e4henn\\u00e4\",\n\"zoom.rectangle\":\"Zoom rectangle\",\"panorama.leave\":\"Poistu katun\\u00e4kym\\u00e4st\\u00e4\",\"panorama.showCoverage\":\"N\\u00e4yt\\u00e4 katutason kattavuus\",\"panorama.hideCoverage\":\"Piilota katutason kattavuus\",\"panorama.unavailableHere\":\"Emme voi n\\u00e4ytt\\u00e4\\u00e4 sinulle katu tasoa t\\u00e4ss\\u00e4\",\"traffic.MASS_TRANSIT\":\"Julkinen liikenne\",\"traffic.MISCELLANEOUS\":\"Erittelem\\u00e4t\\u00f6n syy\",\"traffic.ACCIDENT\":\"Onnettomuus\",\"traffic.OTHER_NEWS\":\"Muu tapahtuma\",\"traffic.PLANNED_EVENT\":\"Suunniteltu tapahtuma\",\n\"traffic.ROAD_HAZARD\":\"Vaara tiell\\u00e4\",\"traffic.WEATHER\":\"S\\u00e4\\u00e4\",\"traffic.CONGESTION\":\"Ruuhka\",\"traffic.CONSTRUCTION\":\"Rakennusty\\u00f6\",\"traffic.DISABLED_VEHICLE\":\"Pys\\u00e4htynyt ajoneuvo\",\"traffic.from\":\"Alkamisaika:\",\"traffic.until\":\"Arvioitu p\\u00e4\\u00e4ttymisaika:\",\"distance.measurement\":\"Measure distance\"});Sr(\"pt-BR\",{\"layers.normal\":\"Exibi\\u00e7\\u00e3o do mapa\",\"layers.satellite\":\"Sat\\u00e9lite\",\"layers.terrain\":\"Terreno\",\"layer.transit\":\"Transporte p\\u00fablico\",\"layer.traffic\":\"Condi\\u00e7\\u00f5es do tr\\u00e2nsito\",\"layer.incidents\":\"Mostrar incidentes no tr\\u00e2nsito\",\"layers.choose\":\"Escolher exibi\\u00e7\\u00e3o\",minimap:\"Minimap\",\"scale.switchToImperial\":\"Mudar para milhas\",\"scale.switchToMetric\":\"Mudar para km\",\"scale.km\":\"km\",\"scale.m\":\"m\",\"scale.mi\":\"milhas\",\"scale.ft\":\"p\\u00e9s\",\"zoom.out\":\"Menos zoom\",\n\"zoom.in\":\"Mais zoom\",\"zoom.rectangle\":\"Zoom rectangle\",\"panorama.leave\":\"Sair de n\\u00edvel de rua\",\"panorama.showCoverage\":\"Mostrar \\u00e1reas com N\\u00edvel de Rua\",\"panorama.hideCoverage\":\"Esconder \\u00e1reas com N\\u00edvel de Rua\",\"panorama.unavailableHere\":\"N\\u00e3o \\u00e9 poss\\u00edvel mostrar N\\u00edvel da Rua aqui.\",\"traffic.MASS_TRANSIT\":\"Transporte p\\u00fablico\",\"traffic.MISCELLANEOUS\":\"Miscel\\u00e2nea\",\"traffic.ACCIDENT\":\"Acidente\",\"traffic.OTHER_NEWS\":\"Outras not\\u00edcias\",\"traffic.PLANNED_EVENT\":\"Evento planejado\",\n\"traffic.ROAD_HAZARD\":\"Risco na estrada\",\"traffic.WEATHER\":\"Clima\",\"traffic.CONGESTION\":\"Congestionamento\",\"traffic.CONSTRUCTION\":\"Constru\\u00e7\\u00e3o\",\"traffic.DISABLED_VEHICLE\":\"Ve\\u00edculo incapacitado\",\"traffic.from\":\"Hora de in\\u00edcio:\",\"traffic.until\":\"Tempo final estimado:\",\"distance.measurement\":\"Measure distance\"});Sr(\"zh-CN\",{\"layers.normal\":\"\\u5730\\u56fe\\u89c6\\u56fe\",\"layers.satellite\":\"\\u536b\\u661f\",\"layers.terrain\":\"\\u5730\\u5f62\",\"layer.transit\":\"\\u516c\\u5171\\u4ea4\\u901a\",\"layer.traffic\":\"\\u4ea4\\u901a\\u60c5\\u51b5\",\"layer.incidents\":\"\\u663e\\u793a\\u4ea4\\u901a\\u4e8b\\u4ef6\",\"layers.choose\":\"\\u9009\\u62e9\\u89c6\\u56fe\",minimap:\"Minimap\",\"scale.switchToImperial\":\"\\u5207\\u6362\\u4e3a\\u300c\\u82f1\\u91cc\\u300d\",\"scale.switchToMetric\":\"\\u5207\\u6362\\u4e3a\\u300c\\u516c\\u91cc\\u300d\",\"scale.km\":\"\\u516c\\u91cc\",\"scale.m\":\"\\u7c73\",\n\"scale.mi\":\"\\u82f1\\u91cc\",\"scale.ft\":\"\\u82f1\\u5c3a\",\"zoom.out\":\"\\u7f29\\u5c0f\",\"zoom.in\":\"\\u653e\\u5927\",\"zoom.rectangle\":\"Zoom rectangle\",\"panorama.leave\":\"\\u9000\\u51fa\\u8857\\u666f\",\"panorama.showCoverage\":\"\\u663e\\u793a\\u652f\\u6301\\u8857\\u666f\\u7684\\u533a\\u57df\",\"panorama.hideCoverage\":\"\\u9690\\u85cf\\u652f\\u6301\\u8857\\u666f\\u7684\\u533a\\u57df\",\"panorama.unavailableHere\":\"\\u6b64\\u5730\\u8fd8\\u4e0d\\u652f\\u6301\\u8857\\u666f\",\"traffic.MASS_TRANSIT\":\"\\u516c\\u5171\\u4ea4\\u901a\",\"traffic.MISCELLANEOUS\":\"\\u7efc\\u5408\\u4e8b\\u4ef6\",\n\"traffic.ACCIDENT\":\"\\u4ea4\\u901a\\u610f\\u5916\",\"traffic.OTHER_NEWS\":\"\\u5176\\u4ed6\\u65b0\\u95fb\",\"traffic.PLANNED_EVENT\":\"\\u9884\\u5b9a\\u4e8b\\u4ef6\",\"traffic.ROAD_HAZARD\":\"\\u9053\\u8def\\u5371\\u9669\",\"traffic.WEATHER\":\"\\u5929\\u6c14\",\"traffic.CONGESTION\":\"\\u5835\\u585e\",\"traffic.CONSTRUCTION\":\"\\u65bd\\u5de5\",\"traffic.DISABLED_VEHICLE\":\"\\u8f66\\u8f86\\u629b\\u951a\",\"traffic.from\":\"\\u5f00\\u59cb\\u65f6\\u95f4\\uff1a\",\"traffic.until\":\"\\u9884\\u8ba1\\u7ed3\\u675f\\u65f6\\u95f4\\uff1a\",\"distance.measurement\":\"Measure distance\"});Sr(\"es-ES\",{\"layers.normal\":\"Mapa\",\"layers.satellite\":\"Sat\\u00e9lite\",\"layers.terrain\":\"Terreno\",\"layer.transit\":\"Transporte p\\u00fablico\",\"layer.traffic\":\"Estado del tr\\u00e1fico\",\"layer.incidents\":\"Mostrar incidentes de tr\\u00e1fico\",\"layers.choose\":\"Elija una vista\",minimap:\"Minimap\",\"scale.switchToImperial\":\"Cambiar a millas\",\"scale.switchToMetric\":\"Cambiar a km\",\"scale.km\":\"km\",\"scale.m\":\"m\",\"scale.mi\":\"mi\",\"scale.ft\":\"ft\",\"zoom.out\":\"Alejar\",\"zoom.in\":\"Acercar\",\"zoom.rectangle\":\"Zoom rectangle\",\n\"panorama.leave\":\"Salir de vista de calles\",\"panorama.showCoverage\":\"Mostrar \\u00e1reas con vista desde la calle\",\"panorama.hideCoverage\":\"Ocultar \\u00e1reas con vista desde la calle\",\"panorama.unavailableHere\":\"No se puede mostrar vista desde la calle aqu\\u00ed\",\"traffic.MASS_TRANSIT\":\"Transporte p\\u00fablico\",\"traffic.MISCELLANEOUS\":\"Varios\",\"traffic.ACCIDENT\":\"Accidente\",\"traffic.OTHER_NEWS\":\"M\\u00e1s noticias\",\"traffic.PLANNED_EVENT\":\"Acto programado\",\"traffic.ROAD_HAZARD\":\"Riesgo en carretera\",\n\"traffic.WEATHER\":\"Tiempo\",\"traffic.CONGESTION\":\"Atasco\",\"traffic.CONSTRUCTION\":\"Construcci\\u00f3n\",\"traffic.DISABLED_VEHICLE\":\"Veh\\u00edculo averiado\",\"traffic.from\":\"Inicio:\",\"traffic.until\":\"Finalizaci\\u00f3n estimada:\",\"distance.measurement\":\"Measure distance\"});Sr(\"fr-FR\",{\"layers.normal\":\"Carte\",\"layers.satellite\":\"Satellite\",\"layers.terrain\":\"Terrain\",\"layer.transit\":\"Transports publics\",\"layer.traffic\":\"Conditions de circulation\",\"layer.incidents\":\"Afficher les incidents de circulation\",\"layers.choose\":\"Choisir la vue\",minimap:\"Minimap\",\"scale.switchToImperial\":\"Passer en miles\",\"scale.switchToMetric\":\"Passer en km\",\"scale.km\":\"km\",\"scale.m\":\"m\",\"scale.mi\":\"mi\",\"scale.ft\":\"ft\",\"zoom.out\":\"Zoom arri\\u00e8re\",\"zoom.in\":\"Zoom avant\",\"zoom.rectangle\":\"Zoom rectangle\",\n\"panorama.leave\":\"Quitter le mode chauss\\u00e9e\",\"panorama.showCoverage\":\"Activer le mode Chauss\\u00e9e\",\"panorama.hideCoverage\":\"D\\u00e9sactiver le mode Chauss\\u00e9e\",\"panorama.unavailableHere\":\"Le mode chauss\\u00e9e n'est pas disponible ici\",\"traffic.MASS_TRANSIT\":\"Transports publics\",\"traffic.MISCELLANEOUS\":\"Divers\",\"traffic.ACCIDENT\":\"Accident\",\"traffic.OTHER_NEWS\":\"Autre\",\"traffic.PLANNED_EVENT\":\"\\u00c9v\\u00e9nement pr\\u00e9vu\",\"traffic.ROAD_HAZARD\":\"Danger routier\",\"traffic.WEATHER\":\"M\\u00e9t\\u00e9o\",\n\"traffic.CONGESTION\":\"Embouteillage\",\"traffic.CONSTRUCTION\":\"Travaux\",\"traffic.DISABLED_VEHICLE\":\"V\\u00e9hicule en panne\",\"traffic.from\":\"Date ou heure de d\\u00e9but:\",\"traffic.until\":\"Date et heure de fin estim\\u00e9es:\",\"distance.measurement\":\"Measure distance\"});Sr(\"pl-PL\",{\"layers.normal\":\"Widok mapy\",\"layers.satellite\":\"Satelita\",\"layers.terrain\":\"Teren\",\"layer.transit\":\"Transport publiczny\",\"layer.traffic\":\"Warunki drogowe\",\"layer.incidents\":\"Poka\\u017c zdarzenia drogowe\",\"layers.choose\":\"Wybierz widok\",minimap:\"Minimap\",\"scale.switchToImperial\":\"Zmie\\u0144 na mile\",\"scale.switchToMetric\":\"Zmie\\u0144 na km\",\"scale.km\":\"km\",\"scale.m\":\"m\",\"scale.mi\":\"mi\",\"scale.ft\":\"ft\",\"zoom.out\":\"Oddal\",\"zoom.in\":\"Przybli\\u017c\",\"zoom.rectangle\":\"Zoom rectangle\",\"panorama.leave\":\"Wyjd\\u017a z panoramy\",\n\"panorama.showCoverage\":\"Poka\\u017c obszary trybu panoramy\",\"panorama.hideCoverage\":\"Ukryj obszary trybu panoramy\",\"panorama.unavailableHere\":\"Niemo\\u017cliwe jest pokazanie widoku panoramy w tym miejscu.\",\"traffic.MASS_TRANSIT\":\"Transport publiczny\",\"traffic.MISCELLANEOUS\":\"Inne zdarzenie\",\"traffic.ACCIDENT\":\"Wypadek\",\"traffic.OTHER_NEWS\":\"Inne wiadomo\\u015bci\",\"traffic.PLANNED_EVENT\":\"Zdarzenie planowane\",\"traffic.ROAD_HAZARD\":\"Niebezpiecze\\u0144stwo na drodze\",\"traffic.WEATHER\":\"Pogoda\",\"traffic.CONGESTION\":\"Korek\",\n\"traffic.CONSTRUCTION\":\"Budowa\",\"traffic.DISABLED_VEHICLE\":\"Uszkodzony pojazd\",\"traffic.from\":\"Data rozpocz\\u0119cia:\",\"traffic.until\":\"Przybli\\u017cona data zako\\u0144czenia:\",\"distance.measurement\":\"Measure distance\"});Sr(\"de-DE\",{\"layers.normal\":\"Kartenansicht\",\"layers.satellite\":\"Satellit\",\"layers.terrain\":\"Gel\\u00e4nde\",\"layer.transit\":\"\\u00d6ffentliche Verkehrsmittel\",\"layer.traffic\":\"Verkehrslage\",\"layer.incidents\":\"Verkehrsst\\u00f6rungen anzeigen\",\"layers.choose\":\"Ansicht ausw\\u00e4hlen\",minimap:\"Minimap\",\"scale.switchToImperial\":\"Umrechnung in Meilen\",\"scale.switchToMetric\":\"Umrechnung in Kilometer\",\"scale.km\":\"km\",\"scale.m\":\"m\",\"scale.mi\":\"mi\",\"scale.ft\":\"ft\",\"zoom.out\":\"Verkleinern\",\"zoom.in\":\"Vergr\\u00f6\\u00dfern\",\n\"zoom.rectangle\":\"Zoom rectangle\",\"panorama.leave\":\"Stra\\u00dfenansicht verlassen\",\"panorama.showCoverage\":\"Gebiete mit Stra\\u00dfenszenen anzeigen\",\"panorama.hideCoverage\":\"Gebiete mit Stra\\u00dfenszenen ausblenden\",\"panorama.unavailableHere\":\"Keine Stra\\u00dfenszenen verf\\u00fcgbar\",\"traffic.MASS_TRANSIT\":\"\\u00d6ffentliche Verkehrsmittel\",\"traffic.MISCELLANEOUS\":\"Diverse\",\"traffic.ACCIDENT\":\"Unfall\",\"traffic.OTHER_NEWS\":\"Anderes Ereignis\",\"traffic.PLANNED_EVENT\":\"Geplantes Ereignis\",\"traffic.ROAD_HAZARD\":\"Verkehrshindernis\",\n\"traffic.WEATHER\":\"Wetter\",\"traffic.CONGESTION\":\"Verkehrsstau\",\"traffic.CONSTRUCTION\":\"Baustelle\",\"traffic.DISABLED_VEHICLE\":\"Liegengebliebenes Fahrzeug\",\"traffic.from\":\"Beginn:\",\"traffic.until\":\"Voraussichtliches Ende:\",\"distance.measurement\":\"Measure distance\"});Sr(\"tr-TR\",{\"layers.normal\":\"Harita g\\u00f6r\\u00fcn\\u00fcm\\u00fc\",\"layers.satellite\":\"Uydu\",\"layers.terrain\":\"Arazi\",\"layer.transit\":\"Toplu ula\\u015f\\u0131m\",\"layer.traffic\":\"Trafik durumlar\\u0131\",\"layer.incidents\":\"Trafik olaylar\\u0131n\\u0131 g\\u00f6ster\",\"layers.choose\":\"G\\u00f6r\\u00fcn\\u00fcm se\\u00e7\",minimap:\"Minimap\",\"scale.switchToImperial\":\"Mile d\\u00f6n\\u00fc\\u015ft\\u00fcr\",\"scale.switchToMetric\":\"Kilometreye d\\u00f6n\\u00fc\\u015ft\\u00fcr\",\"scale.km\":\"km\",\"scale.m\":\"m\",\"scale.mi\":\"mil\",\"scale.ft\":\"ft\",\n\"zoom.out\":\"Uzakla\\u015ft\\u0131r\",\"zoom.in\":\"Yak\\u0131nla\\u015ft\\u0131r\",\"zoom.rectangle\":\"Zoom rectangle\",\"panorama.leave\":\"Sokak g\\u00f6r\\u00fcn\\u00fcm\\u00fc kapat\",\"panorama.showCoverage\":\"Sokak G\\u00f6r\\u00fcn\\u00fcm\\u00fcn\\u00fc g\\u00f6ster\",\"panorama.hideCoverage\":\"Sokak G\\u00f6r\\u00fcn\\u00fcm\\u00fcn\\u00fc sakla\",\"panorama.unavailableHere\":\"Cadde g\\u00f6r\\u00fcn\\u00fcm\\u00fc yok\",\"traffic.MASS_TRANSIT\":\"Toplu ula\\u015f\\u0131m\",\"traffic.MISCELLANEOUS\":\"\\u00c7e\\u015fitli\",\"traffic.ACCIDENT\":\"Kaza\",\n\"traffic.OTHER_NEWS\":\"Di\\u011fer haberler\",\"traffic.PLANNED_EVENT\":\"Planl\\u0131 etkinlik\",\"traffic.ROAD_HAZARD\":\"Yol tehlikesi\",\"traffic.WEATHER\":\"Hava durumu\",\"traffic.CONGESTION\":\"Yo\\u011funluk\",\"traffic.CONSTRUCTION\":\"Yol \\u00e7al\\u0131\\u015fmas\\u0131\",\"traffic.DISABLED_VEHICLE\":\"Ara\\u00e7 ar\\u0131zas\\u0131\",\"traffic.from\":\"Ba\\u015flang\\u0131\\u00e7 zaman\\u0131:\",\"traffic.until\":\"Tahmini biti\\u015f zaman\\u0131:\",\"distance.measurement\":\"Measure distance\"});Sr(\"it-IT\",{\"layers.normal\":\"Vista mappa\",\"layers.satellite\":\"Satellite\",\"layers.terrain\":\"Terreno\",\"layer.transit\":\"Mezzi pubblici\",\"layer.traffic\":\"Condizioni del traffico\",\"layer.incidents\":\"Mostra incidenti stradali\",\"layers.choose\":\"Scegli vista\",minimap:\"Minimap\",\"scale.switchToImperial\":\"Passa a miglia\",\"scale.switchToMetric\":\"Passa a km\",\"scale.km\":\"km\",\"scale.m\":\"m\",\"scale.mi\":\"mi\",\"scale.ft\":\"ft\",\"zoom.out\":\"Zoom indietro\",\"zoom.in\":\"Zoom avanti\",\"zoom.rectangle\":\"Zoom rectangle\",\"panorama.leave\":\"Abbandona il livello strada\",\n\"panorama.showCoverage\":\"Mostra le aree al livello strada\",\"panorama.hideCoverage\":\"Nascondi le aree al livello strada\",\"panorama.unavailableHere\":\"Impossibile mostrare il livello strada in questo punto\",\"traffic.MASS_TRANSIT\":\"Mezzi pubblici\",\"traffic.MISCELLANEOUS\":\"Varie\",\"traffic.ACCIDENT\":\"Incidente\",\"traffic.OTHER_NEWS\":\"Altre notizie\",\"traffic.PLANNED_EVENT\":\"Evento pianificato\",\"traffic.ROAD_HAZARD\":\"Strada dissestata\",\"traffic.WEATHER\":\"Maltempo\",\"traffic.CONGESTION\":\"Ingorgo\",\"traffic.CONSTRUCTION\":\"Lavori in corso\",\n\"traffic.DISABLED_VEHICLE\":\"Veicolo in panne\",\"traffic.from\":\"Ora di inizio:\",\"traffic.until\":\"Ora di fine stimata:\",\"distance.measurement\":\"Measure distance\"});Sr(\"en-US\",{\"layers.normal\":\"Map view\",\"layers.satellite\":\"Satellite\",\"layers.terrain\":\"Terrain\",\"layer.transit\":\"Public transport\",\"layer.traffic\":\"Traffic conditions\",\"layer.incidents\":\"Show traffic incidents\",\"layers.choose\":\"Choose view\",minimap:\"Minimap\",\"scale.switchToImperial\":\"Change to miles\",\"scale.switchToMetric\":\"Change to km\",\"scale.km\":\"km\",\"scale.m\":\"m\",\"scale.mi\":\"mi\",\"scale.ft\":\"ft\",\"zoom.out\":\"Zoom out\",\"zoom.in\":\"Zoom in\",\"zoom.rectangle\":\"Zoom rectangle\",\"panorama.leave\":\"Leave street level\",\n\"panorama.showCoverage\":\"Show street level areas\",\"panorama.hideCoverage\":\"Hide street level areas\",\"panorama.unavailableHere\":\"Can't show you street level here\",\"traffic.MASS_TRANSIT\":\"Public transport\",\"traffic.MISCELLANEOUS\":\"Miscellaneous\",\"traffic.ACCIDENT\":\"Accident\",\"traffic.OTHER_NEWS\":\"Other news\",\"traffic.PLANNED_EVENT\":\"Planned event\",\"traffic.ROAD_HAZARD\":\"Road hazard\",\"traffic.WEATHER\":\"Weather\",\"traffic.CONGESTION\":\"Congestion\",\"traffic.CONSTRUCTION\":\"Construction\",\"traffic.DISABLED_VEHICLE\":\"Disabled vehicle\",\n\"traffic.from\":\"Start time:\",\"traffic.until\":\"Estimated end time:\",\"distance.measurement\":\"Measure distance\"});function Ur(a,b){var c;if(!ra(a))throw new TypeError(\"string locale code required\");if(ta(b))c=b,Tr(a,c);else{if(-1===Pr.indexOf(a))throw Error(\"Default locale '\"+a+\"' does nto exist.\");c=Qr[a]}this.a=c||{};this.b=a}r(\"H.ui.i18n.Localization\",Ur);Ur.prototype.c=function(){return this.b};Ur.prototype.getLocale=Ur.prototype.c;Ur.prototype.fc=function(){return Object.keys(this.a)};Ur.prototype.getKeys=Ur.prototype.fc;Ur.prototype.ng=function(a){return!(!this.a||!this.a[a])};\nUr.prototype.hasKey=Ur.prototype.ng;Ur.prototype.translate=function(a){var b=this.a[a];if(!ra(b))throw Error(\"Translation missing for key '\"+a+\"'.\");return b};Ur.prototype.translate=Ur.prototype.translate;function Vr(a){B(a,ne,Vr,1);X.call(this,\"div\",\"H_context_menu_item\");this.c=a;this.l=z(this.l,this);this.a=z(this.a,this);this.c.addEventListener(\"update\",this.a)}v(Vr,X);r(\"H.ui.context.Item\",Vr);Vr.prototype.l=function(a){var b=this.c,c=b.callback;c&&!b.isDisabled()&&(this.dispatchEvent(\"click\"),c(a))};Vr.prototype.X=function(){var a=this,b=this.el;ui(b,\"click\",this.l);b.addEventListener(\"keyup\",function(b){13==b.keyCode&&a.l(b)});this.a()};Vr.prototype.renderInternal=Vr.prototype.X;\nVr.prototype.a=function(){var a=this.el,b=this.c;b.callback?(this.f(\"clickable\"),a.setAttribute(\"tabindex\",\"0\")):(this.i(\"clickable\"),a.removeAttribute(\"tabindex\"));b.isDisabled()?this.f(\"disabled\"):this.i(\"disabled\");b=b.getLabel();Wr.textContent=b;a.innerHTML=Wr.innerHTML.split(\"\\n\").join(\"<br/>\")};Vr.prototype.D=function(){X.prototype.D.call(this);this.c.removeEventListener(\"update\",this.a)};var Xr=new X(\"div\",\"H_context_menu_item_separator\");function Yr(a){B(a,Array,Yr,1);tr.call(this,\"div\",\"H_context_menu\");this.m=a;this.a=null}v(Yr,tr);r(\"H.ui.context.Menu\",Yr);Yr.prototype.X=function(){tr.prototype.X.apply(this,arguments);this.m.forEach(function(a){a===oe?a=Xr:(a=new Vr(a),a.addEventListener(\"click\",this.s.bind(this)));this.c(a)},this);ui(this.el,[\"mousedown\",\"touchstart\",\"pointerdown\",\"wheel\"],function(a){a.stopPropagation()})};Yr.prototype.renderInternal=Yr.prototype.X;\nYr.prototype.j=function(a,b){if(this.a){var c=this.el,d=c.offsetWidth,e=c.offsetHeight,f=this.a,g=f.va.width,f=f.va.height;a+d>g&&a>g/2&&(a-=d);b+e>f&&b>f/2&&(b-=e);ar(c,a,b)}};Yr.prototype.setPosition=Yr.prototype.j;Yr.prototype.s=function(){this.a&&this.a.dispatchEvent(new Bc(\"contextmenuclose\",this.a))};Yr.prototype.l=function(a){this.a=a};Yr.prototype.setMap=Yr.prototype.l;function Z(a,b){var c=a.b,d=this;I.call(this);this.a=a;this.l=c.ownerDocument;this.f={};this.c=[];this.oa=ir(this.l,\"div\",\"H_ui\");this.O=z(function(a){var b=this.v,c=a.target;a=a.target.Mb;var c=c?c.b():null,d=a?b.a[a]:null;c&&d&&(c.parentElement&&c.parentElement.removeChild(c),d.insertBefore(c,/(bottom|right)$/.test(a)||/(center|middle)/.test(a)&&d.childNodes.length%2?d.firstChild:null));Mr(b)},this);this.addEventListener(\"alignmentchange\",this.O);this.ba=z(function(){this.N()},this);this.addEventListener(\"toggleunitsystem\",\nthis.ba);this.U=z(function(){var a=this.a.g().type;if(a!==this.m){var a=this.m=a,b=this.f,c;for(c in b)if(b[c]instanceof Y)b[c].onMapEngineTypeChange(a);Mr(this.v)}},this);this.a.addEventListener(\"enginechange\",this.U);this.oa.addEventListener(\"contextmenu\",this.C,!1);this.oa.addEventListener(\"MSHoldVisual\",this.C,!1);this.a.addEventListener(\"contextmenu\",this.T,!1,this);this.a.addEventListener(\"contextmenuclose\",this.F,!1,this);this.b=null;this.A=-1;this.v=new Cr(this.oa,this.l);this.i=Or.METRIC;\nZr(this,\"en-US\");this.m=this.a.g().type;b&&$r(this,b);c.appendChild(this.oa);w.setTimeout(function(){Mr(d.v)},1)}v(Z,I);r(\"H.ui.UI\",Z);Z.prototype.C=function(a){for(var b=a.target;b&&!/\\bH_ib_content\\b/.test(b.className);)b=b.parentNode;b||a.preventDefault()};Z.prototype.P=function(){return this.oa};Z.prototype.getElement=Z.prototype.P;Z.prototype.Bb=function(){return this.a};Z.prototype.getMap=Z.prototype.Bb;Z.prototype.I=function(){return this.i};Z.prototype.getUnitSystem=Z.prototype.I;\nZ.prototype.o=function(a){var b=this.f,c;if(a!==this.i)for(c in this.i=a,b)if(b[c]instanceof Y)b[c].onUnitSystemChange(this.i)};Z.prototype.setUnitSystem=Z.prototype.o;function Zr(a,b){var c,d;if(ra(b))c=b;else if(b instanceof Ur)c=b.b,d=b;else throw Error(\"The locale parameter must be a string or a H.ui.i18n.Localization object.\");if(c)if(d)a.s=d;else if(0<=Pr.indexOf(c))a.s=new Ur(c);else throw Error(\"Locale [\"+c+\"] is not supported.\");else throw Error(\"No locale was defined.\");}\nZ.prototype.da=function(){return this.s};Z.prototype.N=function(){this.i===Or.METRIC?this.o(Or.IMPERIAL):this.o(Or.METRIC)};Z.prototype.toggleUnitSystem=Z.prototype.N;Z.prototype.ud=function(a){var b=this.c.length,c=this.oa,d,e;0>this.c.indexOf(a)&&(a.ia(this),a.a=this.a,d=a.ca(this.l),0<b?e=this.c[b-1].el.nextSibling:e=this.oa.firstChild,c.insertBefore(d,e),this.c.push(a))};Z.prototype.addBubble=Z.prototype.ud;\nZ.prototype.T=function(a){var b=a.items;this.b&&this.F();clearTimeout(this.A);this.A=w.setTimeout(function(){b.length&&(this.b=new Yr(b),this.oa.insertBefore(this.b.ca(this.l),this.oa.firstChild),this.b.ia(this),this.b.l(this.a),this.b.j(a.viewportX,a.viewportY))}.bind(this),0)};Z.prototype.F=function(){this.b&&(this.b.J(),this.b=null)};Z.prototype.B=function(a){var b=this.c.indexOf(a);-1<b&&(a.ia(null),a.a=null,this.c.splice(b,1),this.oa.removeChild(a.b()))};Z.prototype.removeBubble=Z.prototype.B;\nZ.prototype.K=function(){return this.c};Z.prototype.getBubbles=Z.prototype.K;Z.prototype.g=function(a,b){if(this.j(a))throw Error(\"A control with name [\"+a+\"] is already registered.\");b.ia(this);b.Wa(this.a);b.sa=this.s;b.ca(this.l);b.onUnitSystemChange(this.i);b.onMapEngineTypeChange(this.a.g().type);this.f[a]=b};Z.prototype.addControl=Z.prototype.g;\nZ.prototype.ea=function(a){var b=this.j(a);if(b)b.ia(null),b.Wa(null),or(b),delete this.f[a];else throw Error(\"Control [\"+a+\"] not found in this UI's controls.\");return b};Z.prototype.removeControl=Z.prototype.ea;Z.prototype.j=function(a){return this.f[a]};Z.prototype.getControl=Z.prototype.j;\nZ.prototype.D=function(){for(var a in this.f)cr.hasOwnProperty.call(this.f,a)&&this.f[a].J();this.c.forEach(function(a){a.J()});(a=this.oa.parentNode)&&a.removeChild(this.oa);I.prototype.D.call(this);this.oa=null};Z.prototype.J=function(){I.prototype.J.call(this)};Z.prototype.dispose=Z.prototype.J;\nfunction $r(a,b){var c,d;b.unitSystem&&a.o(b.unitSystem);(d=b.locale)&&Zr(a,d);(c=b.zoom)&&a.g(\"zoom\",new as(\"object\"===typeof c?c:null));(c=b.zoomrectangle)&&a.g(\"zoomrectangle\",new bs(\"object\"===typeof c?c:null));(c=b.mapsettings)&&a.g(\"mapsettings\",new cs(\"object\"===typeof c?c:null));(c=b.scalebar)&&a.g(\"scalebar\",new ds(\"object\"===typeof c?c:null));(c=b.panorama)&&ja(\"H.map.render.panorama\")&&a.g(\"panorama\",new zr(\"object\"===typeof c?c:null));(c=b.distancemeasurement)&&a.g(\"distancemeasurement\",\nnew es(\"object\"===typeof c?c:null))}Z.prototype.ya=function(a,b,c,d){var e=this.j(\"scalebar\"),f=a.getContext(\"2d\"),g=a.width,h=a.height,k=5*b;e&&e.getVisibility()?e.ya(b,function(b){f.drawImage(b,g-b.width-k,h-b.height-k);c(a)},d):c(a)};Z.prototype.capture=Z.prototype.ya;\nZ.createDefault=function(a,b,c){var d=[];b.normal&&d.push({name:\"layers.normal\",mapType:b.normal});b.satellite&&d.push({name:\"layers.satellite\",mapType:b.satellite});b.terrain&&d.push({name:\"layers.terrain\",mapType:b.terrain});if(!d.length)throw Error(\"The mapTypes parameter does not contain any known map types.\");return new Z(a,{unitSystem:Or.METRIC,zoom:{alignment:\"right-middle\"},mapsettings:{alignment:\"bottom-right\",entries:d,incidents:b.incidents},scalebar:{alignment:\"bottom-right\"},panorama:{alignment:\"top-right\",\nmapTypes:b},locale:c||\"en-US\"})};function fs(a){a=a||{};var b;this.s=!!a.vertical;this.T=a.length||\"10em\";this.a=ab(b=a.min)?b:0;this.o=mb(this.a,ab(b=a.max)?b:100);this.O=D(b=a.step)?1:b;this.m=gs(this,ab(b=a.value)?b:(this.a+this.o)/2);this.Qd=z(this.Qd,this);this.Hd=z(this.Hd,this);this.Ud=z(this.Ud,this);this.Sd=z(this.Sd,this);this.c=a.pointerArea;X.call(this,\"div\",\"H_slider\"+(this.s?\"\":\" H_l_horizontal\"))}v(fs,X);r(\"H.ui.base.Slider\",fs);\nfs.prototype.de=function(a,b){var c,d=this.s;if(!this.l||b)a=Qb(a,this.a,this.o),this.j&&(c=100*(a-this.a)/(this.o-this.a),this.j.style[d?\"top\":\"left\"]=(d?-1:1)*c+\"%\"),this.m=gs(this,a);return this.m};fs.prototype.setValue=fs.prototype.de;fs.prototype.K=function(){return this.m};fs.prototype.getValue=fs.prototype.K;function hs(a){a.A||(lr(a.b(),\"start\",a.Qd),lr(a.c,\"move\",a.Hd),lr(a.c,\"end\",a.Ud),lr(a.c,\"out\",a.Sd),a.A=!0)}\nfunction is(a){a.A&&(mr(a.b(),\"start\",a.Qd),mr(a.c,\"move\",a.Hd),mr(a.c,\"end\",a.Ud),mr(a.c,\"out\",a.Sd),a.A=!1)}function gs(a,b){var c=a.O;b=Qb(b,a.a,a.o);return c?a.a+nb((b-a.a)/c)*c:b}function js(a,b){var c=a.C,d=a.s;a.F||(a.F=c[\"offset\"+(d?\"Height\":\"Width\")]);b-=br(c)[d?\"y\":\"x\"];0>b&&(b=0);c=(a.o-a.a)*b/a.F;c=gs(a,d?a.o-c:a.a+c);a.m!==c&&(a.de(c,!0),a.dispatchEvent(new Ne(a.Cg.nc,c,a.m)))}function ks(a,b){return(b.touches?b.targetTouches[0]:b)[\"page\"+(a.s?\"Y\":\"X\")]}\nfunction ls(a){var b=!1,c=a.type;-1!==c.indexOf(\"pointer\")||-1!==c.indexOf(\"touch\")?b=!0:B(a,MouseEvent)&&(b=1===a.which||1===a.buttons);return b}function ms(a){var b=a.touches;return b&&1===b.length||B(a,MouseEvent)}p=fs.prototype;p.Qd=function(a){var b=this.s,c,d;ls(a)&&ms(a)&&(c=ks(this,a),d=a.target,d===this.j||d.parentElement===this.j?(this.I=c-br(this.j)[b?\"y\":\"x\"]-this.j.offsetWidth/2,this.l=!0):js(this,c),a.preventDefault())};p.Ud=function(){this.l&&(this.l=!1)};\np.Sd=function(a){this.l&&a.target===this.c&&(this.l=!1)};p.Hd=function(a){this.l&&ms(a)&&(ls(a)?(js(this,ks(this,a)-this.I),a.preventDefault()):this.l=!1)};p.Cg={nc:\"change\"};\np.X=function(a,b){var c=ir(b,\"div\",\"H_slider_cont\"),d=ir(b,\"div\",\"H_slider_knob_cont\"),e=ir(b,\"div\",\"H_slider_knob\"),f=ir(b,\"div\",\"H_slider_knob_halo\"),g=ir(b,\"div\",\"H_slider_track\");a.appendChild(c);c.appendChild(g);c.appendChild(d);d.appendChild(e);d.appendChild(f);this.C=g;this.j=d;this.c||(this.c=a.ownerDocument.body);c.style[this.s?\"height\":\"width\"]=this.T;this.de(this.m);hs(this)};fs.prototype.renderInternal=fs.prototype.X;fs.prototype.D=function(){is(this)};\nfs.prototype.qa=function(a){a?is(this):this.C&&hs(this);return X.prototype.qa.call(this,a)};fs.prototype.setDisabled=fs.prototype.qa;var ns={\"in\":'<svg class=\"H_icon\" viewBox=\"0 0 25 25\"><path d=\"M 18.5,11 H 14 V 6.5 c 0,-.8 -.7,-1.5 -1.5,-1.5 -.8,0 -1.5,.7 -1.5,1.5 V 11 H 6.5 C 5.7,11 5,11.7 5,12.5 5,13.3 5.7,14 6.5,14 H 11 v 4.5 c 0,.8 .7,1.5 1.5,1.5 .8,0 1.5,-.7 1.5,-1.5 V 14 h 4.5 C 19.3,14 20,13.3 20,12.5 20,11.7 19.3,11 18.5,11 z\" /></svg>',out:'<svg class=\"H_icon\" viewBox=\"0 0 25 25\"><path d=\"m 6.5,11 h 12 c .8,0 1.5,.7 1.5,1.5 0,.8 -.7,1.5 -1.5,1.5 H 6.5 C 5.7,14 5,13.3 5,12.5 5,11.7 5.67,11 6.5,11 z\" /></svg>'};function as(a){a=a||{};var b=a.slider;Y.call(this);this.s=z(this.s,this);this.A=z(this.A,this);this.a=z(this.a,this);b&&(this.C=z(this.C,this),this.I=b,this.ba=a.sliderSnaps);this.F=new pr({label:ns[\"in\"],onStateChange:this.s});this.K=new pr({label:ns.out,onStateChange:this.s});this.f(\"H_zoom\");this.f(\"H_grp\");this.setZoomSpeed(a.zoomSpeed||.004);this.l(a.alignment||\"right-middle\")}v(as,Y);r(\"H.ui.ZoomControl\",as);as.prototype.O=function(){return this.T};as.prototype.getZoomSpeed=as.prototype.O;\nas.prototype.U=function(a){this.T=a};as.prototype.setZoomSpeed=as.prototype.U;as.prototype.Wa=function(a){this.map!==a&&os(this);Y.prototype.Wa.apply(this,arguments);this.map&&this.a()};as.prototype.setMap=as.prototype.Wa;as.prototype.Qa=function(a){this.b().style.display=0!==a?\"none\":\"\"};as.prototype.onMapEngineTypeChange=as.prototype.Qa;as.prototype.D=function(){Y.prototype.D.apply(this,arguments);os(this)};\nas.prototype.X=function(a,b){Y.prototype.renderInternal.call(this,a,b);nr(this.F,this.da().translate(\"zoom.in\"));nr(this.K,this.da().translate(\"zoom.out\"))};as.prototype.renderInternal=as.prototype.X;as.prototype.l=function(a){var b=this.Mb;Y.prototype.l.call(this,a);b!==a&&this.a();return this};as.prototype.setAlignment=as.prototype.l;as.prototype.A=function(a){this.m.de(a.target.getZoom())};\nfunction os(a){a.removeChild(a.m);a.m=null;a.map&&(a.map.removeEventListener(\"baselayerchange\",a.a),a.map.removeEventListener(\"mapviewchange\",a.A));a.j&&(a.j.removeEventListener(\"minchange\",a.a),a.j.removeEventListener(\"maxchange\",a.a),a.j=null)}as.prototype.s=function(a){a=a.target;var b=a===this.F?1:-1,c=0<b?Math.ceil:Math.floor,d=this.map;d&&(\"down\"===a.getState()?(d.c.startControl(),d.c.control(0,0,b*this.T,0,0,0)):d.c.endControl(!0,function(a){a.zoom=c(a.zoom)}))};\nas.prototype.C=function(a){this.map&&this.map.Ha(a.newValue)};\nas.prototype.a=function(){var a=this.Mb,b,c;/^top/g.test(a)||/^bottom/g.test(a)?(b=this.K,a=this.F,c=!1):(b=this.F,a=this.K,c=!0);this.removeChild(b);this.removeChild(a);this.c(b);this.I&&(os(this),b=c,c=this.map,this.I&&c&&(this.j=c.i)&&(this.m=new fs({step:this.ba?1:0,vertical:b,min:this.j.min,max:this.j.max,value:c.getZoom(),pointerArea:c.b}),this.m.addEventListener(this.m.Cg.nc,this.C),c.addEventListener(\"baselayerchange\",this.a),c.addEventListener(\"mapviewchange\",this.A),this.j.addEventListener(\"minchange\",\nthis.a),this.j.addEventListener(\"maxchange\",this.a)),this.c(this.m));this.c(a)};var ps={btn:'<svg version=\"1.1\" class=\"H_icon\" viewBox=\"0 0 20 20\"><path d=\"m15,1H2C1.447,1,1,1.448,1,2v5.001C1,7.553,1.447,8,2,8h13c0.553,0,1-0.447,1-1V2C16,1.448,15.553,1,15,1z M15,5.999v0.91v0.09V7H2l0,0V3h1v3h2V5h1v1h2V4h1v2h2V5h1v0.999h2V3h1V5.999z\"transform=\"translate(1,6)\" /></svg>',point:'<svg width=\"22\" height=\"22\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"11\" cy=\"11\" r=\"8\" stroke=\"#661144\" stroke-width=\"4.5\" fill=\"white\" /></svg>'};var qs,rs=navigator.userAgent,ss=-1<rs.indexOf(\"Android\")&&-1<rs.indexOf(\"Mozilla/5.0\")&&-1<rs.indexOf(\"AppleWebKit\"),ts=/AppleWebKit\\/([\\d.]+)/,us=null===ts.exec(rs)?null:parseFloat(ts.exec(rs)[1]);qs=ss&&null!==us&&537>us;var vs=Function(\"return this\")(),Wr=document.createElement(\"T\");function ws(a,b,c){fh.call(this,a,{icon:xs,visibility:c});ys(this,b)}v(ws,fh);function ys(a,b){a.ci=b;a.oa&&(a.oa.textContent=b)}var xs=new Rh(ir(vs.document,\"span\",\"H_dm_label\"),{onAttach:function(a,b,c){c.oa=a;ys(c,c.ci)},onDetach:function(a,b,c){delete c.oa}});function zs(a,b){I.call(this);this.b=a;this.a=new ws(this.o,\"\");b.push(this.a);this.ub=new P({objects:b,data:this})}v(zs,I);zs.prototype.Sb=!1;zs.prototype.o={lat:0,lng:0};zs.prototype.Sa=function(a,b){ys(this.a,a);this.a.a(b)};function As(a,b){b&&(a.nextSibling=b,b.previousSibling=a)};function Bs(a,b,c,d){var e=new F;As(a,this);As(this,b);e.c(a.getPosition());e.c(b.getPosition());this.c=new pg(e,{style:c.Ac});this.i=new pg(e,{style:{strokeColor:\"transparent\",lineWidth:Math.min(100,this.c.Na().lineWidth+2*(d||5))}});zs.call(this,c,[this.c,this.i]);this.g=this.f=-1;a=this.ub;a.addEventListener(\"pointermove\",this.j,!0,this);a.addEventListener(\"pointerleave\",this.l,!0,this)}v(Bs,zs);Bs.prototype.$c=function(){var a=this.c.Ca();return a.g(0).distance(a.g(1))};\nfunction Cs(a,b,c){var d=a.c.Ca();d.i(3*c,3,[b.lat,b.lng,0]);a.c.c(d)}Bs.prototype.j=function(a){var b=a.currentPointer;a=this.previousSibling.getPosition();var c=this.nextSibling.getPosition(),d=this.b.b,e=b.viewportX,b=b.viewportY;if(this.f!==e||this.g!==b)this.f=e,this.g=b,d.a(this.b.c(a,c,{x:e,y:b})),d.setVisibility(!0)};Bs.prototype.l=function(){this.b.b.setVisibility()};Bs.prototype.yf=function(){this.Sa(this.b.a(this.$c()),this.c.S().Oa())};function Ds(a,b,c){c=b.bd(c||0);this.c=new xi(a,{icon:c,zIndex:0});this.c.draggable=!0;zs.call(this,b,[this.c]);a=this.ub;a.addEventListener(\"dragstart\",this.mi,!0,this);a.addEventListener(\"drag\",this.ni,!0,this);a.addEventListener(\"dragend\",this.li,!0,this)}v(Ds,zs);p=Ds.prototype;p.rc=0;p.af={nc:\"change\"};p.$c=function(){return this.rc};p.getPosition=function(){return this.c.Ca()};\nfunction Es(a){var b=0;a.nextSibling&&a.previousSibling&&(a.nextSibling.Sb||a.previousSibling.Sb?a.nextSibling.Sb&&!a.previousSibling.Sb&&(b=2):b=1);b=a.b.bd(b);a.c.$b(b)}p.ni=function(a){var b=a.currentPointer;a=b.viewportX;b=b.viewportY;if(this.g!==a||this.i!==b)this.g=a,this.i=b,this.c.a(this.b.map.Ka(a-this.f.x,b-this.f.y)),this.dispatchEvent(new Bc(this.af.nc,this))};\np.mi=function(a){var b=a.currentPointer,c=b.viewportX,b=b.viewportY,d=this.b.map.o(this.getPosition());this.c.Ha(1);this.f={x:c-d.x,y:b-d.y};a.stopPropagation()};p.li=function(){this.c.Ha(0)};p.yf=function(a){this.rc=a;this.Sa(this.b.a(a),this.getPosition())};function Fs(a,b){this.c=b;this.b=a;this.a={previousSibling:null,nextSibling:null,Sb:!0};Gs(this,this.a);this.Pd=z(this.Pd,this)}r(\"H.ui.distanceMeasurement.Model\",Fs);p=Fs.prototype;p.ed=function(){return this.a.nextSibling===this.a};function Hs(a,b){for(var c=a.a,d=c.nextSibling;d!==c;)d.a.setVisibility(d.previousSibling===c?!1:b),d=d.nextSibling}\nfunction Is(a,b){var c;c=b||a.a.nextSibling;var d=0,e=0;if(b&&!Js(a,b))throw new C(a.$e,0,b);for(c instanceof Ds?d=c.$c():c instanceof Bs&&(d=c.previousSibling.$c());c&&c!==a.a;c=c.nextSibling,e++)c.yf(d),1===e%2&&(d+=c.$c())}p.Qc=function(a){var b=this.a.previousSibling,c=this.ed();a=new Ds(a,this.c,c?0:2);this.b.V(a.ub);As(a,this.a);a.addEventListener(a.af.nc,this.Pd);c?Gs(this,a):(Ks(this,b,a),Es(b),Is(this,b));return a};\np.insertBefore=function(a,b){var c,d,e,f;d=!1;f=1;if(b){if(!Js(this,b))throw new C(this.insertBefore,1,b);if(d=b.previousSibling.Sb)f=0;f=new Ds(a,this.c,f);f.addEventListener(f.af.nc,this.Pd);this.b.V(f.ub);d?(c=this.a.nextSibling,Ks(this,f,c),Gs(this,f),d=f,Es(c)):(c=b.previousSibling,d=c.previousSibling,e=c.nextSibling,this.b.a(c.ub),Ks(this,d,f),Ks(this,f,e));Is(this,d)}else f=this.Qc(a);return f};p.Ea=function(){Gs(this,this.a);this.b.Ea()};\np.$e=function(a){var b=this.a,c=a.previousSibling,d=a.nextSibling,e;if(!Js(this,a))throw new C(this.$e,0,a);this.b.a(a.ub);c===b?(e=d,e!==b?(a=e.nextSibling,Gs(this,a),a.yf(0),Es(a),Is(this,a)):Gs(this,this.a)):d===b?(e=c,a=e.previousSibling,As(a,b),Es(a)):c&&d&&(Ks(this,c.previousSibling,d.nextSibling),this.b.v([d.ub,c.ub]),Is(this,c.previousSibling));e&&e!==b&&this.b.a(e.ub)};function Js(a,b){for(var c=a.a.nextSibling,d=!1;c!==a.a;){if(c===b){d=!0;break}c=c.nextSibling}return d}\nfunction Ks(a,b,c){b=new Bs(b,c,a.c);a.b.V(b.ub)}function Gs(a,b){a.a.nextSibling=b;b.previousSibling=a.a}p.Pd=function(a){a=a.target;var b=a.previousSibling,c=a.nextSibling,d=a.getPosition(),e;c.Sb||(Cs(c,d,!1),e=a);b.Sb||(Cs(b,d,!0),e=b.previousSibling);Is(this,e)};function es(a){a=a||{};var b,c=a.lineStyle;Y.call(this);this.j=new rr({label:ps.btn,onStateChange:z(this.ii,this)});this.c(this.j);if(b=a.distanceFormatter)this.I=b;c&&(this.O=c);this.l(a.alignment||\"right-bottom\");this.s={};this.s[0]=a.startIcon;this.s[2]=a.endIcon;this.s[1]=a.stopoverIcon;this.s[3]=a.splitIcon}v(es,Y);r(\"H.ui.DistanceMeasurement\",es);es.prototype.O={strokeColor:\"rgba(102,17,68,.7)\",lineWidth:6};\nfunction Ls(a){var b=a.map,c,d={};a.m||(a.A=new L,a.C=new Jj(a.A,{pixelRatio:a.map.A()}),a.U=c=a.A.f,c.addEventListener(\"dragstart\",a.gi,!0,a),c.addEventListener(\"dragend\",a.pd,!0,a),c.addEventListener(\"pointerenter\",a.pd,!0,a),c.addEventListener(\"pointerleave\",a.hi,!0,a),c.addEventListener(\"tap\",a.ji,!0,a),a.F=Ms(a),d.a=z(a.I,a),d.bd=z(a.bd,a),d.c=z(a.T,a),d.map=a.map,d.b=a.F,d.Ac=a.O,a.a=new Fs(a.U,d),a.m=!0);a.F&&a.U.V(a.F);b.addEventListener(\"tap\",a.Jg,!0,a);b.fa.add(a.C)}\nfunction Ns(a){var b=a.map;a.m&&(b.removeEventListener(\"tap\",a.Jg,!0,a),b.tf(a.C),a.a.Ea())}function Ms(a){function b(){var a=c.b,a={anchor:c.a.clone().scale(g).floor(),size:new Th(pb(a.w*g),pb(a.h*g)),hitArea:d};return new ri(c.Pb(),a)}var c=a.bd(3),d=new Uh(Vh.NONE,[]),e=c.Pc.READY,f,g=c===a.K?.5:1,h;c.getState()===e?h=b():(h=new ri(\"<svg/>\",{hitArea:d}),c.addEventListener(\"statechange\",function(){c.getState()===e&&f.$b(b())}));return f=new xi(a.map.Oa(),{visibility:!1,icon:h})}\nes.prototype.I=function(a){var b=\"m\",c=0;\"metric\"===this.ba?1E3<=a&&(a/=1E3,b=\"km\",c=1):(a/=.3048,b=\"ft\",5280<=a&&(a/=5280,b=\"mi\",c=1));return a.toFixed(c)+\" \"+this.da().translate(\"scale.\"+b)};es.prototype.T=function(a,b,c){a=this.map.o(a);b=this.map.o(b);c=(new M(c.x,c.y)).a(a,b);return this.map.Ka(c.x,c.y)};\nes.prototype.X=function(a,b){var c=22*this.map.A(),d=c/2;Y.prototype.renderInternal.call(this,a,b);this.ba=Or.METRIC;this.K=new ri(ps.point,{anchor:{x:d,y:d},size:{w:c,h:c},hitArea:new Uh(Vh.CIRCLE,[d,d,d])});nr(this.j,this.da().translate(\"distance.measurement\"))};es.prototype.renderInternal=es.prototype.X;p=es.prototype;p.bd=function(a){return this.s[a]||this.K};p.pd=function(){Hs(this.a,!0)};p.gi=function(){Hs(this.a)};p.hi=function(a){\"touch\"!==a.currentPointer.type&&Hs(this.a)};\np.ji=function(a){var b=a.currentPointer,c;c=a.target.Da;var d;c&&(c=c.getData())instanceof zs&&(d=c);c=d;a=a.originalEvent;a=a.metaKey||a.altKey;c&&(a&&c instanceof Ds?this.a.$e(c):c instanceof Bs&&(a=c.previousSibling.getPosition(),d=c.nextSibling.getPosition(),b={x:b.viewportX,y:b.viewportY},this.a.insertBefore(this.T(a,d,b),c.nextSibling),this.F.setVisibility()),this.pd())};\np.Jg=function(a){var b=a.currentPointer;a=a.target;if(a===this.map||a.Pa()!==this.A)this.a.Qc(this.map.Ka(b.viewportX,b.viewportY)),this.pd()};p.ii=function(a){\"down\"===a.target.getState()?Ls(this):Ns(this)};p.ld=function(a){this.ba=a;this.m&&(Is(this.a),this.pd())};es.prototype.onUnitSystemChange=es.prototype.ld;es.prototype.Qa=function(a){a=0===a;this.j.setVisibility(a);a||this.j.L(\"up\")};es.prototype.onMapEngineTypeChange=es.prototype.Qa;\nes.prototype.J=function(){Ns(this);this.m&&(this.A.J(),this.C.J());Y.prototype.dispose.call(this)};es.prototype.dispose=es.prototype.J;es.prototype.Wa=function(a){a?this.j.getState()===qr.DOWN&&(this.map=a,Ls(this)):(Ns(this),this.m=!1);Y.prototype.Wa.apply(this,arguments)};es.prototype.setMap=es.prototype.Wa;function xr(a,b){var c=b||{},d=this;X.call(this,\"div\",\"H_ib\");this.I=z(function(a){d.g||(d.close(),a.preventDefault())},this);this.j=z(this.j,this);this.m=z(this.m,this);this.s(a);this.o(c.content);c.onStateChange&&this.addEventListener(\"statechange\",c.onStateChange);this.L(Os.OPEN)}v(xr,X);r(\"H.ui.InfoBubble\",xr);xr.prototype.a=null;xr.prototype.getPosition=function(){return this.c};xr.prototype.s=function(a){this.c=ic(a);this.j()};xr.prototype.setPosition=xr.prototype.s;\nxr.prototype.X=function(a,b){this.A=ir(b,\"div\",\"H_ib_body\");this.tailEl_=ir(b,\"div\",\"H_ib_tail\",Ps);this.F=ir(b,\"div\",\"H_ib_close\",Qs);this.l=ir(b,\"div\",\"H_ib_content\",\"&nbsp;\");this.A.appendChild(this.F);this.A.appendChild(this.l);lr(this.F,\"start\",this.I);this.a.c.addEventListener(\"sync\",this.j);this.a.va.addEventListener(\"sync\",this.j);this.a.addEventListener(\"enginechange\",this.m);a.appendChild(this.A);a.appendChild(this.tailEl_);this.o(this.C)};\nxr.prototype.renderInternal=xr.prototype.X;xr.prototype.m=function(){this.K||(this.K=setTimeout(this.j,0))};\nxr.prototype.j=function(){var a=this.el,b=this.a,c,d=\"none\",e;this.K=0;b&&this.b()&&this.getState()===Os.OPEN&&(b.g().type!==Pi&&(c=b.o(this.c))&&(e=c.x,c=c.y,b=b.va.width,e>=-b||e<=2*b||c>=-b||c<=2*b)&&(d=\"\",qs?(a.style.left=e-b+\"px\",a.style.top=c+\"px\"):ar(a,e,c),b=this.l.offsetWidth,e=e-b,40>e&&(e=Math.max(0,Math.min((b||this.l.offsetWidth)-this.tailEl_.offsetWidth,-e)),this.A.style.right=e?-e+\"px\":\"0\")),a.style.display=d)};var Os={OPEN:\"open\",CLOSED:\"closed\"};xr.State=Os;xr.prototype.G=Os.OPEN;\nxr.prototype.getState=function(){return this.G};xr.prototype.getState=xr.prototype.getState;xr.prototype.L=function(a){a!==this.G&&(this.G=a,this.dispatchEvent(\"statechange\"));if(a=this.b())this.G===Os.OPEN?(a.style.display=\"block\",this.m()):a.style.display=\"none\"};xr.prototype.setState=xr.prototype.L;xr.prototype.close=function(){this.L(Os.CLOSED)};xr.prototype.close=xr.prototype.close;xr.prototype.open=function(){this.L(Os.OPEN)};xr.prototype.open=xr.prototype.open;xr.prototype.T=function(){return this.l};\nxr.prototype.getContentElement=xr.prototype.T;xr.prototype.o=function(a){if(a)if(\"string\"===typeof a||\"number\"===typeof a.nodeType&&\"string\"===typeof a.nodeName)this.C=a;else throw Error(\"InfoBubble content must be a string or HTML node.\");else this.C=void 0;this.b()&&(this.C?(this.l.innerHTML=\"\",\"string\"===typeof this.C?this.l.innerHTML=a:\"number\"===typeof a.nodeType&&\"string\"===typeof a.nodeName&&this.l.appendChild(a)):this.l.innerHTML=\"&nbsp;\",this.m())};xr.prototype.setContent=xr.prototype.o;\nxr.prototype.D=function(){this.close();this.o(null);this.F&&mr(this.F,\"end\",this.I);this.a&&(this.a.c.removeEventListener(\"sync\",this.j),this.a.va.removeEventListener(\"sync\",this.j));X.prototype.D.call(this)};\nvar Ps='<svg viewBox=\"0 0 25 25\"><g><path d=\"M 11.3,0.23 5.08,12.1 C 2.28,12.2 0,13.2 0,14.5 0,15.9 2.28,17 5.08,17 c 2.8,0 5.12,-1.1 5.12,-2.5 0,-0.6 -0.62,-1.2 -1.52,-1.7 L 20.9,1.13 21,0.23 l -9.7,0 z\" style=\"fill:#0d2e41;fill-opacity:0.3\" /><path d=\"M 19.9,0.266 4.88,14.8 12.5,0.266 z\" /></g></svg>',Qs='<svg version=\"1.1\" class=\"H_icon\" viewBox=\"0 0 12 22\"><path d=\"M 9.01,17 6.04,14 3,17 0.03,14.1 3,11 0.096,8.17 3.07,5.15 6.04,8.07 8.95,5.15 11.9,8.17 9.01,11 12,14.1 9.01,17\" /></svg>';function Rs(){this.G=Ss.CLOSED;tr.call(this,\"div\",\"H_overlay\")}v(Rs,tr);r(\"H.ui.base.OverlayPanel\",Rs);Rs.prototype.L=function(a,b){if(a!==this.G||b)this.G=a,a===Ss.OPEN?this.f(\"H_open\"):this.i(\"H_open\");return this};Rs.prototype.setState=Rs.prototype.L;Rs.prototype.getState=function(){return this.G};Rs.prototype.getState=Rs.prototype.getState;\nRs.prototype.a=function(a){var b=a.Mb;a=a.b();var c=this.b(),d=c.style,e;this.i(\"H_top\");this.i(\"H_middle\");this.i(\"H_bottom\");this.i(\"H_left\");this.i(\"H_center\");this.i(\"H_right\");d.bottom=d.top=d.left=d.right=d.margin=\"\";/top/g.test(b)?(this.f(\"H_top\"),d.top=\"0\",d.margin=\"0 1.2em\",e=-1):/bottom/g.test(b)?(this.f(\"H_bottom\"),d.bottom=\"0\",d.margin=\"0 1.2em\",e=1):(this.f(\"H_middle\"),d.top=\"50%\",d.margin=\"0 1.2em\",d.marginTop=-Math.round(.5*c.offsetHeight)+\n\"px\",e=0);/left/g.test(b)?(this.f(\"H_left\"),d.left=a.offsetWidth+\"px\",d.marginLeft=\"1.2em\"):/right/g.test(b)?(this.f(\"H_right\"),d.right=a.offsetWidth+\"px\",d.marginRight=\"1.2em\"):(this.f(\"H_center\"),d.left=\"50%\",0>e?(d.top=a.offsetHeight+\"px\",d.marginTop=\"1.2em\"):0<e&&(d.bottom=a.offsetHeight+\"px\",d.marginBottom=\"1.2em\"),d.marginLeft=-Math.round(.5*c.offsetWidth)+\"px\",a.appendChild(c))};Rs.prototype.pointToControl=Rs.prototype.a;var Ss={OPEN:\"open\",CLOSED:\"closed\"};Rs.State=Ss;function Ts(a){a=a||{};tr.call(this,\"div\",\"H_rdo\");this.A=new X(\"div\",\"H_rdo_title\");this.j=new tr(\"div\",\"H_rdo_buttons\");this.c(this.A);this.c(this.j);this.F=z(function(a){a.target.getState()===qr.DOWN?(this.a(a.target,!0),this.dispatchEvent(Us)):a.target.L(qr.DOWN,!0)},this);this.addEventListener(\"statechange\",this.F);this.m(a.title||\"\");a.onActiveButtonChange&&this.addEventListener(Us,a.onActiveButtonChange);a.buttonsOptions&&a.buttonsOptions.forEach(function(a){this.pe(new rr(a))},\nthis)}v(Ts,tr);r(\"H.ui.base.RadioGroup\",Ts);var Us=\"activebuttonchange\";Ts.prototype.X=function(a,b){tr.prototype.renderInternal.call(this,a,b);this.m(this.s,!0)};Ts.prototype.renderInternal=Ts.prototype.X;Ts.prototype.m=function(a,b){if(a!==this.s||b)this.s=a,this.A.b()&&(this.A.b().innerHTML=this.s);return this};Ts.prototype.setTitle=Ts.prototype.m;Ts.prototype.C=function(){return this.s};Ts.prototype.getTitle=Ts.prototype.C;\nTs.prototype.pe=function(a){if(!(a instanceof rr))throw Error(\"PushButton expected\");a.ia(this);this.j.c(a);return this};Ts.prototype.addButton=Ts.prototype.pe;Ts.prototype.K=function(a){this.j.removeChild(a);a.ia(null);return this};Ts.prototype.removeButton=Ts.prototype.K;Ts.prototype.l=function(){return this.j.ea()};Ts.prototype.getButtons=Ts.prototype.l;Ts.prototype.a=function(a,b){for(var c=this.l(),d=c.length;d--;)c[d].L(c[d]===a?qr.DOWN:qr.UP,b)};Ts.prototype.setActiveButton=Ts.prototype.a;\nTs.prototype.D=function(){this.removeEventListener(\"statechange\",this.F);tr.prototype.D.call(this)};function Vs(){this.f=z(this.f,this);this.l=z(this.l,this);this.a=new rr({label:\"Show traffic incidents\",onStateChange:this.l});this.b=null;this.i=0;this.g=22}function Ws(a,b){var c;(c=a.a.getData())&&c.Pa().removeEventListener(\"tap\",a.f);b?(c=b.Pa(),c.addEventListener(\"tap\",a.f),a.i=c.min,a.g=c.max,a.a.B(b),a.a.setVisibility(!0),Xs(a)):(a.a.B(null),a.a.setVisibility(!1),a.i=0,a.g=22)}\nfunction Ys(a,b){a.c=b;a.a.Sa(b.da().translate(\"layer.incidents\"));Xs(a);a.c.Bb().addEventListener(\"mapviewchange\",function(b){var d=b.newValue.zoom;a.b&&b.modifiers&b.ZOOM&&(d<a.i||d>a.g)&&a.b.close()})}function Xs(a){var b=a.c,c=a.a.getData(),d;b&&(d=b.Bb())&&c?0<=d.fa.indexOf(c)?a.a.L(\"down\",!0):(a.a.L(\"up\",!0),a.b&&a.b.close()):a.a.L(\"up\",!0)}Vs.prototype.l=function(){var a=this.c.Bb(),b=this.a.getData();a&&b&&(this.a.getState()===qr.DOWN?a.re(b):a.tf(b))};\nVs.prototype.f=function(a){var b,c;a.target&&(b=a.target.getData())&&0===a.currentPointer.button&&(this.b||(this.b=new xr(a.target.getPosition()),this.c.ud(this.b)),this.b.s(a.target.getPosition()),c=b.TRAFFIC_ITEM_TYPE_DESC.replace(\" \",\"_\"),this.c.da().ng(\"traffic.\"+c)&&(c=this.c.da().translate(\"traffic.\"+c)),this.b.o('<div class=\"H_tib\"><p>{{title}}</p><p class=\"H_tib_desc\">{{desc}}</p><p class=\"H_tib_time\"><span class=\"H_tib_left\">{{traffic.from}}</span><span class=\"H_tib_right\">{{from}}</span><br/><span class=\"H_tib_left\">{{traffic.until}}</span><span class=\"H_tib_right\">{{until}}</span></p></div>'.replace(\"{{title}}\",\nc).replace(\"{{desc}}\",b.TRAFFIC_ITEM_DESCRIPTION[0].value).replace(\"{{traffic.from}}\",this.c.da().translate(\"traffic.from\")).replace(\"{{traffic.until}}\",this.c.da().translate(\"traffic.until\")).replace(\"{{from}}\",b.START_TIME).replace(\"{{until}}\",b.END_TIME)),this.b.open());a.stopPropagation()};function cs(a){a=a||{};Y.call(this);this.nf=z(this.nf,this);this.of=z(this.of,this);this.kd=z(this.kd,this);this.hd=z(this.hd,this);this.A=z(this.A,this);this.m=new Rs;this.vb=new Ts({onActiveButtonChange:this.kd});this.j=new rr({onStateChange:this.of});this.a=new rr({onStateChange:this.nf});this.s=new Vs;Ws(this.s,a.incidents);this.F=new rr({label:'<svg version=\"1.1\" class=\"H_icon\" viewBox=\"0 0 26 26\"><polygon points=\"19,14 17,14 19,16 13,19 6,16 9,14 7,14 3,16 13,21 23,16\" /><polygon points=\"13,15 3,10 13,5 23,10\"/></svg>',\nonStateChange:z(function(a){a.target.getState()===qr.DOWN?(this.m.L(Ss.OPEN),this.m.a(this)):this.m.L(Ss.CLOSED)},this)});this.m.c(this.vb);this.m.c(this.a);this.m.c(this.j);this.m.c(this.s.a);this.c(this.F);this.c(this.m);a.entries&&a.entries.forEach(function(a){this.vb.pe(new rr({label:a.name,data:a.mapType}))},this);this.l(a.alignment||\"bottom-right\")}v(cs,Y);r(\"H.ui.MapSettingsControl\",cs);\ncs.prototype.X=function(a,b){var c=this.Bb().fa;Y.prototype.renderInternal.call(this,a,b);this.vb.m(this.da().translate(\"layers.choose\"));this.vb.l().forEach(function(a){var b=a.a;\"layers.\"===b.substr(0,7)&&a.Sa(this.da().translate(b))},this);this.j.Sa(this.da().translate(\"layer.transit\"));this.a.Sa(this.da().translate(\"layer.traffic\"));nr(this.F,this.da().translate(\"layers.choose\"));Ys(this.s,this.jb());c.addEventListener(\"add\",this.hd);c.addEventListener(\"remove\",this.hd);c.addEventListener(\"set\",\nthis.hd);this.Bb().addEventListener(\"tap\",this.A);Zs(this)};cs.prototype.renderInternal=cs.prototype.X;p=cs.prototype;p.kd=function(){var a;a:{a=this.vb.l();for(var b=a.length;b--;)if(a[b].getState()===qr.DOWN){a=a[b];break a}a=null}(a=a?a.getData():null)?(b=a.map,this.j.qa(!a.transit),a.transit&&(this.j.g||this.j.getState()!==qr.DOWN||(b=a.transit)),this.a.qa(!a.traffic),a.traffic&&(this.a.g||this.a.getState()!==qr.DOWN||(b=a.traffic)),b&&this.map&&this.map.Zb(b)):(this.j.qa(!0),this.a.qa(!0))};\np.nf=function(){this.a.getState()===qr.DOWN&&this.j.L(qr.UP,!0);this.kd()};p.of=function(){this.j.getState()===qr.DOWN&&this.a.L(qr.UP,!0);this.kd()};p.hd=function(a){0===a.idx?Zs(this,a):Xs(this.s)};\nfunction Zs(a,b){var c=null,d=b?b.added:a.map.i;a.vb.l().forEach(function(a){var b=a.getData();b.map===d?(this.vb.a(a,!0),this.j.L(qr.UP,!0),this.a.L(qr.UP,!0),c=b):b.transit&&b.transit===d?(this.vb.a(a,!0),this.j.L(qr.DOWN,!0),this.a.L(qr.UP,!0),c=b):b.traffic&&b.traffic===d&&(this.vb.a(a,!0),this.j.L(qr.UP,!0),this.a.L(qr.DOWN,!0),c=b)},a);c?(a.j.qa(!c.transit),a.a.qa(!c.traffic)):a.vb.a(null,!0)}p.Qa=function(a){this.b().style.display=a===Pi?\"none\":\"\"};cs.prototype.onMapEngineTypeChange=cs.prototype.Qa;\ncs.prototype.A=function(){this.F.L(qr.UP)};cs.prototype.C=function(a){Ws(this.s,a)};cs.prototype.setIncidentsLayer=cs.prototype.C;function bs(a){a=a||{};Y.call(this);a.adjustZoom&&(this.yg=a.adjustZoom);this.j=new rr({label:'<svg version=\"1.1\" class=\"H_icon\" viewBox=\"0 0 26 26\"><polyline points=\"3,5 3,21 23,21 23,5 3,5\" style=\"fill:none;stroke:white;stroke-width:3\"/></svg>',onStateChange:z(this.ki,this)});this.c(this.j);this.l(a.alignment||\"bottom-right\")}v(bs,Y);r(\"H.ui.ZoomRectangle\",bs);p=bs.prototype;p.yg=function(a){return Math.floor(a)};\np.ki=function(a){var b=this.map,c=b.va.element;a.target.getState()===qr.DOWN?(b.addEventListener(\"dragstart\",this.Ag,!0,this),b.addEventListener(\"drag\",this.Bg,!0,this),b.addEventListener(\"dragend\",this.zg,!0,this),a=c.ownerDocument.createElement(\"div\"),b=a.style,b.position=\"absolute\",b.display=\"none\",b.border=\"2px solid #000\",b.zIndex=1E5,b.backgroundColor=\"rgba(204,204,204,0.5)\",c.appendChild(a),this.a=a):(b.removeEventListener(\"dragstart\",this.Ag,!0,this),b.removeEventListener(\"drag\",this.Bg,!0,\nthis),b.removeEventListener(\"dragend\",this.zg,!0,this),c.removeChild(this.a))};p.Ag=function(a){var b=this.a.style,c=a.currentPointer,d=c.viewportX,c=c.viewportY;a.target===this.map&&(a.stopPropagation(),b.width=\"0px\",b.height=\"0px\",b.top=c+\"px\",b.left=d+\"px\",b.display=\"block\",this.s=c,this.m=d)};\np.Bg=function(a){var b=a.currentPointer,c=b.viewportX,d=b.viewportY,b=this.m,e=this.s,f=this.a.style;a.target===this.map&&(a=c-b,c=d-e,f.left=b+(0>a?a:0)+\"px\",f.top=e+(0>c?c:0)+\"px\",f.width=Math.abs(a)+\"px\",f.height=Math.abs(c)+\"px\")};p.zg=function(a){var b=this.map,c=a.currentPointer;a.target===this.map&&(this.a.style.display=\"none\",a=b.U(fc([b.Ka(this.m,this.s),b.Ka(c.viewportX,c.viewportY)])),a.animate=!0,a.zoom=this.yg(a.zoom,this.map),b.c.Jb(a))};\np.X=function(a,b){Y.prototype.renderInternal.call(this,a,b);nr(this.j,this.da().translate(\"zoom.rectangle\"))};bs.prototype.renderInternal=bs.prototype.X;bs.prototype.Qa=function(a){a=a===Pi;this.b().style.display=a?\"none\":\"\";a&&this.j.L(\"up\")};bs.prototype.onMapEngineTypeChange=bs.prototype.Qa;function $s(a,b){var c=b||{};if(!(a&&a instanceof oh))throw Error(\"Base layer is mandatory for overview UI element\");Y.call(this);this.j=new rr({label:'<svg class=\"H_icon\" viewBox=\"4 4 25 25\"><path d=\"m 8,10 l 0,14 l 18,0 l 0,-14 z m 1,1 l 16,0 l 0,12 L 9,23 z\"/><path d=\"m 10,12 l 0,10 l 6,0 l 0,-6 l 8,0 l 0,-4 z\"/></svg>',onStateChange:z(this.m,this)});this.c(this.j);this.a=new at(a,c.zoomDelta,c.scaleX,c.scaleY);this.l(c.alignment||\"right-bottom\");this.c(this.a)}v($s,Y);\nr(\"H.ui.Overview\",$s);$s.prototype.Zb=function(a){this.a.Zb(a);return this};$s.prototype.setBaseLayer=$s.prototype.Zb;$s.prototype.m=function(a){a.target.getState()===qr.DOWN?bt(this.a):ct(this.a)};$s.prototype.X=function(a,b){Y.prototype.renderInternal.call(this,a,b);this.j.el.style[\"float\"]=this.Mb.match(\"right\")?\"right\":\"left\";this.a.Wa(this.map);nr(this.j,this.da().translate(\"minimap\"))};$s.prototype.renderInternal=$s.prototype.X;\n$s.prototype.Qa=function(a){this.b().style.display=a===Pi?\"none\":\"\";this.j.getState()===qr.DOWN&&bt(this.a)};$s.prototype.onMapEngineTypeChange=$s.prototype.Qa;$s.prototype.D=function(){this.a.J();X.prototype.D.call(this)};function at(a,b,c,d){this.A=a;\"number\"===typeof b&&(this.nh=b);\"number\"===typeof c&&(this.Sg=c);\"number\"===typeof d&&(this.Tg=d);tr.call(this,\"div\",\"H_overview\")}v(at,Y);at.prototype.Zb=function(a){this.j.Zb(a)};\nat.prototype.X=function(a,b){var c=ir(b,\"div\",\"H_overview_map\");jr(a,c);this.m=c};at.prototype.renderInternal=at.prototype.X;p=at.prototype;p.nh=3;p.Sg=5;p.Tg=5;p.Wa=function(a){this.a=a;this.j=new Q(this.m,this.A,{pixelRatio:this.a.A()});this.j.j.b.style.display=\"none\";this.F=this.j.c;this.s=this.a.c};function bt(a){dt(a,!0);a.Cf();a.f(\"H_overview_active\");a.a.addEventListener(\"mapviewchange\",a.Cf,!1,a)}\nfunction ct(a){dt(a);a.i(\"H_overview_active\");a.a.removeEventListener(\"mapviewchange\",a.Cf,!1,a)}p.Cf=function(a){a&&a.modifiers&a.SIZE&&dt(this,!0);a=this.s.Ab();a.zoom=a.zoom-this.nh;this.F.Jb(a)};function dt(a,b){var c=a.a.va.element,d=a.el.style,e=c.offsetWidth/a.Sg/10,c=c.offsetHeight/a.Tg/10,f=a.m.style;b?(d.width=e+\"em\",d.height=c+\"em\",f.width=e-1+\"em\",f.height=c-1+\"em\"):d.width=d.height=\"0em\";a.j.va.resize()}p.J=function(){ct(this);this.j.J()};function ds(a){a=a||{};Y.call(this);this.f(\"H_scalebar\");this.l(a.alignment||\"bottom-right\");this.a=z(this.a,this);this.A=this.s=this.C=this.F=this.m=null}v(ds,Y);r(\"H.ui.ScaleBar\",ds);\nds.prototype.X=function(a,b){Y.prototype.renderInternal.call(this,a,b);var c;a.innerHTML='<svg height=\"28\" version=\"1.1\" class=\"H_scalebar_svg\" xmlns=\"http://www.w3.org/2000/svg\"><polyline style=\"fill:none;stroke:white;stroke-width:4;stroke-opacity:0.8\" points=\"2,19 2,26 98,26 98,19\"/><polyline style=\"fill:none; stroke:black; stroke-width:2\" points=\"2,20 2,26 98,26 98,20\"/><text style=\"stroke:white;stroke-width:2;stroke-opacity:0.8;text-anchor:end;font: bold 10px \\'Lucida Grande\\',\\'Lucida Sans Unicode\\',Arial,Helvetica,sans-serif\" x=\"90\" y=\"22\"></text><text style=\"text-anchor:end;font: bold 10px \\'Lucida Grande\\',\\'Lucida Sans Unicode\\',Arial,Helvetica,sans-serif;color:black;\" x=\"90\" y=\"22\"></text></svg>';a.style.direction=\n\"ltr\";this.m=a.firstChild;c=this.m.childNodes;this.F=c[0];this.C=c[1];this.s=c[2];this.A=c[3];this.K=Or.METRIC;this.I=z(function(a){this.g||(this.dispatchEvent(\"toggleunitsystem\"),a.preventDefault())},this);this.j=z(function(a){a.preventDefault()},this);lr(a,\"start\",this.j);lr(a,\"end\",this.I);nr(this,this.da().translate(\"scale.switchToImperial\"));this.a()};ds.prototype.renderInternal=ds.prototype.X;\nds.prototype.Wa=function(a){this.map&&this.map.removeEventListener(\"mapviewchange\",this.a);a&&a.addEventListener(\"mapviewchange\",this.a);Y.prototype.Wa.apply(this,arguments)};ds.prototype.setMap=ds.prototype.Wa;\nds.prototype.ya=function(a,b,c){var d=document.createElement(\"canvas\"),e=d.getContext(\"2d\"),f=Fe(this.m,document,!1),g;g=parseFloat(f.getAttribute(\"width\"));var h=parseFloat(f.getAttribute(\"height\")),k=g*a;a*=h;f.setAttribute(\"viewBox\",\"0 0 \"+g+\" \"+h);f.setAttribute(\"width\",k);f.setAttribute(\"height\",a);g=document.createElement(\"div\");g.appendChild(f);f=xe(g.innerHTML);d.width=k;d.height=a;(new Gh(\"image\",f)).then(function(a){e.drawImage(a,0,0);b(d)},c)};ds.prototype.capture=ds.prototype.ya;\nds.prototype.ld=function(a){this.K=a;nr(this,\"imperial\"===a?this.da().translate(\"scale.switchToMetric\"):this.da().translate(\"scale.switchToImperial\"));this.a()};ds.prototype.onUnitSystemChange=ds.prototype.ld;ds.prototype.Qa=function(a){this.b().style.display=a===Pi?\"none\":\"\"};ds.prototype.onMapEngineTypeChange=ds.prototype.Qa;\nds.prototype.a=function(){if(this.b()&&(!this.map||this.map.g().type!==Pi)){var a,b=0;a=this.map;var c,d,e;a&&(c=Math.round(.5*a.va.width),d=Math.round(.5*a.va.height),e=a.Ka(c,d))&&(b=ic(e),a=ic(a.Ka(c+1,d)),b=100*b.distance(a));if(a=b)this.K===Or.IMPERIAL?a<et?(d=a/ft,c=this.da().translate(\"scale.ft\")):(d=a/et,c=this.da().translate(\"scale.mi\")):1E3>a?(d=a,c=this.da().translate(\"scale.m\")):(d=a/1E3,c=this.da().translate(\"scale.km\")),a=Math.pow(10,Math.floor(Math.log(d)/Math.LN10)),d=a/d*100,30>d?\n(a*=5,d*=5):75>d?(a*=2,d*=2):150<d&&(a/=2,d/=2),d=Math.round(d),this.m.setAttribute(\"width\",d),this.A.textContent=this.s.textContent=a+\" \"+c,this.A.setAttribute(\"x\",d-8),this.s.setAttribute(\"x\",d-8),this.F.points.getItem(2).x=this.C.points.getItem(2).x=this.F.points.getItem(3).x=this.C.points.getItem(3).x=d-2}};var et=1609.344,ft=.3048006;r(\"H.ui.buildInfo\",function(){return Bh(\"mapsjs-ui\",\"0.17.0\",\"7ec7e09\")});\n");;
var defaultFormatter = function (v) { return v; };
var calendars = {};
var $window = $(window);
var preResizeHeight = 0;
var preResizeWidth = 0;
var openedItems;

var autoFillData = autoFillData || {}; //we are using this for the auto fill in IWYTHM Pannels

var analyticsDatalayer = analyticsDatalayer || {};
analyticsDatalayer.segmentationInfo = analyticsDatalayer.segmentationInfo || {};
analyticsDatalayer.pageInfo = analyticsDatalayer.pageInfo || {};
analyticsDatalayer.vehicleInfo = analyticsDatalayer.vehicleInfo || {};
analyticsDatalayer.vehicleSearchInfo = analyticsDatalayer.vehicleSearchInfo || {};

// iframe resize integration
iFrameResize({}, '.seamless');

// plugin for site-wide ajax calls
(function ($) {
    $.GWUtils = {
        ajaxCall: function (opts, callback) {
            var defaults = {
                type: 'Get',
                dataType: 'json',
                data: '',
                timeout: 15000,
                context: ''
            };

            var options = $.extend(defaults, opts);

            return callback($.ajax({
                url: options.url,
                type: options.type,
                dataType: options.dataType,
                data: options.data,
                timeout: options.timeout
            }), options.context);
        },
        logError: function (error) {
            console.log('error ' + error);
        }
    };
})(jQuery);

// Description https://www.stevefenton.co.uk/2015/08/javascript-key-constants/
var KEY = { SPACE: 32, NUM_0: 48, NUM_1: 49, NUM_2: 50, NUM_3: 51, NUM_4: 52, NUM_5: 53, NUM_6: 54, NUM_7: 55, NUM_8: 56, NUM_9: 57, SEMI_COLON: 59, EQUALS: 61, A: 65, B: 66, C: 67, D: 68, E: 69, F: 70, G: 71, H: 72, I: 73, J: 74, K: 75, L: 76, M: 77, N: 78, O: 79, P: 80, Q: 81, R: 82, S: 83, T: 84, U: 85, V: 86, W: 87, X: 88, Y: 89, Z: 90, NUM_PAD_0: 96, NUM_PAD_1: 97, NUM_PAD_2: 98, NUM_PAD_3: 99, NUM_PAD_4: 100, NUM_PAD_5: 101, NUM_PAD_6: 102, NUM_PAD_7: 103, NUM_PAD_8: 104, NUM_PAD_9: 105, MULTIPLY: 106, ADD: 107, SEPARATOR: 108, SUBTRACT: 109, DECIMAL: 110, DIVIDE: 111, COMMA: 188, PERIOD: 190, SLASH: 191, BACK_QUOTE: 192, OPEN_BRACKET: 219, BACK_SLASH: 220, CLOSE_BRACKET: 221, QUOTE: 222, META: 224 }, SPECIAL_KEY = { CANCEL: 3, HELP: 6, BACK_SPACE: 8, TAB: 9, CLEAR: 12, ENTER: 13, SHIFT: 16, CONTROL: 17, ALT: 18, PAUSE: 19, CAPS_LOCK: 20, ESCAPE: 27, SPACE: KEY.SPACE, PAGE_UP: 33, PAGE_DOWN: 34, END: 35, HOME: 36, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, PRINT_SCREEN: 44, INSERT: 45, DELETE: 46, CONTEXT_MENU: 93, F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, F13: 124, F14: 125, F15: 126, F16: 127, F17: 128, F18: 129, F19: 130, F20: 131, F21: 132, F22: 133, F23: 134, F24: 135, NUM_LOCK: 144, SCROLL_LOCK: 145 };

(function ($) {
    // Description: https://www.stevefenton.co.uk/2015/08/bind-multiple-actions-with-conditional-keys-for-keyboard-events/
    $.fn.bindactions = function (callback, options) {
        var settings = $.extend({
            events: 'click touch keydown',
            keys: [SPECIAL_KEY.SPACE, SPECIAL_KEY.ENTER]
        }, options);

        var keyFound = function (key) {
            for (var i = 0; i < settings.keys.length; i++) {
                if (key === settings.keys[i]) return true;
            }

            if (typeof console !== 'undefined') {
                console.log('Callback not run for key: ' + key);
            }

            return false;
        };

        this.bind(settings.events, function (event) {
            var runCallback = false;

            if (event.type && (event.type === 'keydown' || event.type === 'keyup' || event.type === 'keypress')) {
                runCallback = keyFound(event.keyCode || event.which);
            } else {
                runCallback = true;
            }

            if (runCallback) {
                event.preventDefault();
                callback.call(this, event);
                return false;
            }
        });

        return this;
    };

    $.fn.resetSlider = function () {
        /* General Content Sliders (News, Promotions) */
        var slideWidth = 450;
        var contentSliderOptions;

        function setSlideWidth() {
            var windowsize = $window.width();

            contentSliderOptions = {
                infiniteLoop: true,
                hideControlOnEnd: false,
                pager: false,
                controls: true,
                minSlides: 1,
                maxSlides: 10,
                slideWidth: slideWidth,
                responsive: false,
                preloadImages: 'visible',
                nextText: '<span class="gruxIcon gw-grux-right02"></span>',
                prevText: '<span class="gruxIcon gw-grux-left02"></span>'
            };
        }

        var contentSliders = [];

        setSlideWidth();

        contentSliders.push($(this).bxSlider(contentSliderOptions));
    };
})(jQuery);

$(window).scroll(function () {
    var y = $(this).scrollTop();

    if (window.innerWidth > 992) {
        var endSearchPanel = y + document.getElementById('gw_subHeader').getBoundingClientRect().bottom;

        if (y > endSearchPanel) {
            if ($stickyNavigation.css('top') !== '0px') {
                closeLinkedSite($('#mainNavigation .linkedSite'));
                openStickyFooter();
                openStickyHeader();
            }
        } else {
            if ($stickyNavigation.css('top') === '0px') {
                closeStickyHeader();
                $.SmartMenus.hideAll();
                clearAllContentSticky();

                if ($('#gw_footerSticky__contact').css('display') == 'none') {
                    closeStickyFooter();
                }
            }
        }
    } else {
        if (y == 0 && $('#ContactForm').length == 0) {
            closeStickyFooter();
        } else {
            openStickyFooter();
        }


    }
});

function scrollToHash(hash, offsetTop, speed) {
    if (isNaN(speed)) {
        speed = 700;
    }
    if (hash === '' || hash === '#') {
        $('html,body').animate({
            scrollTop: 0
        }, speed);

        return false;
    }

    var target = $(hash);
    target = target.length ? target : $('[name=' + hash.slice(1) + ']');

    if (target.length) {
        if (offsetTop != null && !isNaN(parseInt(offsetTop, 10))) {
            $('html,body').animate({ scrollTop: target.offset().top - offsetTop }, speed);
        } else {
            $('html,body').animate({ scrollTop: target.offset().top }, speed);
        }

        return false;
    } else {
        console.log('No target found: ' + hash);
    }
}

// Resizing. We should only ever use our custom "resizeDone" event in code.
function shouldHandleResize() {
    var newHeight = $window.height();
    var newWidth = $window.width();

    if (newHeight > (preResizeHeight * 1.15)
        || newHeight < (preResizeHeight * 0.85)) {
        preResizeHeight = newHeight;
        preResizeWidth = newWidth;
        return true;
    }

    if (newWidth > (preResizeWidth * 1.15)
        || newWidth < (preResizeWidth * 0.85)) {
        preResizeHeight = newHeight;
        preResizeWidth = newWidth;
        return true;
    }
    return false;
}

// Debounce Resize Event
var resizeDebounceTimer;
$window.on('resize', function (e) {
    clearTimeout(resizeDebounceTimer);
    resizeDebounceTimer = setTimeout(function () {
        if (!shouldHandleResize()) {
            $window.trigger('resizeMinorDone');
            return;
        }

        $window.trigger('resizeDone');
    }, 250);
});

// Scroll Started Event
var scrollStartedTimer = null;
var isScrolling = false;
$window.scroll(function () {
    window.clearTimeout(scrollStartedTimer);
    scrollStartedTimer = window.setTimeout(function () {
        isScrolling = false;
    }, 250);

    if (isScrolling) {
        // Already Scrolling - Ignore
        return;
    }

    // Raise Scroll Started Event
    isScrolling = true;
    $window.trigger('scrollStarted');
});

function getURLParamByName(n) {
    n = n.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + n + "=([^&#]*)"),
        results = regex.exec(location.search);

    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

// Mapping functions
function convertAjaxResultToHtml(ajaxResult) {
    var message = [];
    $('[data-toggle="tooltip"]').tooltip('destroy');
    $('.error').removeClass('error');

    if (ajaxResult.Success) {
        message.push(ajaxResult.SuccessMessage);
    } else {
        message.push(ajaxResult.ErrorMessage);
        $.each(ajaxResult.Errors, function (key, value) {
            $('[name="' + key + '"]')
                .addClass('error')
                .tooltip({ title: value, placement: 'bottom' });
        });
    }

    message.push(ajaxResult.CtaScript);
    message.push("<script>" + ajaxResult.GAEventScript + "</script>");

    return message;
}

function mapModelsToOptions(selectElement, models, key) {
    var select2Enabled = $(selectElement).hasClass("select2-hidden-accessible");

    // Removing Select2 wrapper to improve browser performance whilst manipulating the element.
    if (select2Enabled) {
        $(selectElement).select2('destroy');
    }

    var i;
    var selectedValue = [];
    $('option:selected', selectElement).each(function (e) {
        selectedValue.push($(this).val());
    });

    // Remove existing options
    for (i = selectElement.childNodes.length - 1; i > 1; i--) {
        selectElement.removeChild(selectElement.childNodes[i]);
    }

    // Add new options
    for (i = 0; i < models.length; i++) {
        var displayName = models[i][key];

        var option = document.createElement('option');
        option.value = displayName;
        option.innerHTML = displayName;

        selectElement.appendChild(option);
    }

    reselectChosenFilterValues(selectElement, selectedValue);

    // Add Select2 functionality back to element after manipulation.
    if (select2Enabled) {
        $(selectElement).select2().maximizeSelect2Height();
    }
}

function reselectChosenFilterValues(selectElement, selectedValue) {
    var count = 0;
    $('option', selectElement).each(function (item) {
        if ($.inArray($(this).val(), selectedValue) != -1) {
            count++;
            $(selectElement).val(selectedValue)
        }
    });

    //Select default if selected chosen filter values no longer available
    if (count == 0) {
        $('option:first', selectElement).prop("selected", true);
    }

    $('select').trigger('change.select2'); //NeededForIE10
}

function reposSliderTooltips() {
    $('input[data-slider="1"]').slider('relayout');
}

function toggleSlider(obj, closeObject, globalClassClose, downFlag) {
    var isOpening = false;

    $.when(
        $.when(obj.siblings(':not(.notSlideSiblings)').slideUp())
            .done(function () {
                closeObject.siblings().find('button.bannerActionCloseTxt').addClass('hiddenButton');
                closeObject.siblings().find('button.bannerActionTxt').removeClass('hiddenButton');
                closeObject.siblings().removeClass('closeActive');

                if (globalClassClose) {
                    var $globalClassClose = $(globalClassClose);
                    $globalClassClose.find('button.bannerActionCloseTxt').addClass('hiddenButton');
                    $globalClassClose.find('button.bannerActionTxt').removeClass('hiddenButton');
                    $globalClassClose.removeClass('closeActive');
                }
            }))
        .done(function () {
            if (obj.is(':visible')) {
                isOpening = false;
                overlayToggle(false, '.overlay1');
                obj.slideUp();
                closeObject.find('button.bannerActionCloseTxt').addClass('hiddenButton');
                closeObject.find('button.bannerActionTxt').removeClass('hiddenButton');
                closeObject.removeClass('closeActive');
            } else {
                isOpening = true;
                overlayToggle(true, '.overlay1');
                obj.slideDown();
                closeObject.find('button.bannerActionTxt').addClass('hiddenButton');
                closeObject.find('button.bannerActionCloseTxt').removeClass('hiddenButton');
                closeObject.addClass('closeActive');
            }

            //reposition any sliders to re-align tooltips
            reposSliderTooltips();
        });

    return isOpening;
}

// Note above parameters can be added to HTML elements via data tags - see http://seiyria.com/bootstrap-slider/
var convertToRangeSlider = function (selector, formatter) {
    formatter = formatter || defaultFormatter;

    var rangeOptions = {
        formatter: formatter,
        tooltip: 'always',
        handle: 'round',
        range: true,
        tooltip_split: false
    };

    if (rtlFlag) {
        $.extend(rangeOptions, {
            reversed: true
        });
    }
    $(selector).slider(rangeOptions);
};

var convertToSlider = function (selector, formatter) {
    formatter = formatter || defaultFormatter;

    var slideOptions = {
        formatter: formatter,
        tooltip: 'always',
        handle: 'square'
    };

    if (rtlFlag) {
        $.extend(slideOptions, {
            reversed: true
        });
    }

    var $elem = $(selector);

    $elem.slider(slideOptions);
};

function cbChangeChecker(cb, helpMeFlag) {
    var displayVal = cb.checked ? 'inline' : 'none';

    if (!helpMeFlag) {
        var targetClass = cb.checked ? 'ActButGreyWellSelectedBlue' : 'ActButGreyWell';
        var targetClassCaret = cb.checked ? 'ActButGreyWellCaretSelectedBlue' : 'ActButGreyWellCaret';
        var targetRemoveClass = !cb.checked ? 'ActButGreyWellSelectedBlue' : 'ActButGreyWell';
        var targetRemoveClassCaret = !cb.checked ? 'ActButGreyWellCaretSelectedBlue' : 'ActButGreyWellCaret';
    } else if (helpMeFlag == true) {
        var targetClass = cb.checked ? 'ActButBlueWellCol4' : 'ActButBlueWell';
        var targetClassCaret = cb.checked ? 'ActButBlueWellCaretCol4' : 'ActButBlueWellCaret';
        var targetRemoveClass = !cb.checked ? 'ActButBlueWellCol4' : 'ActButBlueWell';
        var targetRemoveClassCaret = !cb.checked ? 'ActButBlueWellCaretCol4' : 'ActButBlueWellCaret';
    }

    var $parent = $(cb).parent();
    var $grandParent = $parent.parent();

    $parent.children('span.chkboxTick').css('display', displayVal);
    $grandParent.children('div.ActBut')
        .removeClass(targetRemoveClass)
        .addClass(targetClass);
    $grandParent.children('span.input-group-addon')
        .removeClass(targetRemoveClassCaret)
        .addClass(targetClassCaret);
}

function overlayToggle(shouldShow, overlayClass) {
    if (shouldShow) {
        $('div' + overlayClass).stop(true).fadeIn(200);
    } else {
        $('div' + overlayClass).stop(true).fadeOut(200);
    }
}

//start search section

var EngineSizeUnitFrom = $('input[type=radio][name="EngSize"]:checked').val();
var OdometerUnitFrom = $('input[type=radio][name="Mileage"]:checked').val();
var EnginePowerUnitFrom = $('input[type=radio][name="EngPower"]:checked').val();

function resetVehAdvancedFrm($form) {
    $targetSlider = $('#Filters_Odometer', $form);
    $targetSlider.slider('setAttribute', 'min', $targetSlider.data('slider-min'));
    $targetSlider.slider('setAttribute', 'max', $targetSlider.data('slider-max'));
    $targetSlider.slider('setValue', [$targetSlider.data('slider-min'), $targetSlider.data('slider-max')], true);
    $targetSlider.slider('setAttribute', 'step', $targetSlider.data('slider-step'));

    $targetSlider = $('#Filters_EngineSize', $form);
    $targetSlider.slider('setAttribute', 'min', $targetSlider.data('slider-min'));
    $targetSlider.slider('setAttribute', 'max', $targetSlider.data('slider-max'));
    $targetSlider.slider('setValue', [$targetSlider.data('slider-min'), $targetSlider.data('slider-max')], true);
    $targetSlider.slider('setAttribute', 'step', $targetSlider.data('slider-step'));

    $targetSlider = $('#Filters_EnginePower', $form);
    $targetSlider.slider('setAttribute', 'min', $targetSlider.data('slider-min'));
    $targetSlider.slider('setAttribute', 'max', $targetSlider.data('slider-max'));
    $targetSlider.slider('setValue', [$targetSlider.data('slider-min'), $targetSlider.data('slider-max')], true);
    $targetSlider.slider('setAttribute', 'step', $targetSlider.data('slider-step'));

    $targetSlider = $('#Filters_Price', $form);
    $targetSlider.slider('setValue', [$targetSlider.data('slider-min'), $targetSlider.data('slider-max')], true);

    $targetSlider = $('#Filters_RegistrationDate', $form);
    $targetSlider.slider('setValue', [$targetSlider.data('slider-min'), $targetSlider.data('slider-max')], true);

    $targetSlider = $('#vehAdvRefineByEmissions', $form);
    $targetSlider.slider('setValue', [$targetSlider.data('slider-min'), $targetSlider.data('slider-max')], true);

    $targetSlider = $('#Filters_Seats');
    $targetSlider.slider('setValue', [$targetSlider.data('slider-min'), $targetSlider.data('slider-max')], true);

    //reset remaining form elements in advanced section
    //Now reset form so leave out .vehSearchAdvanced2
    $form.find('input:text, input:password, input:file, select, textarea').val('').trigger("change");
    $form.find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected');

    //Set unit pickers back
    EngineSizeUnitFrom = $('div.UnitWrapper[data-utype="EngSize"]', $form).data("udefault");
    OdometerUnitFrom = $('div.UnitWrapper[data-utype="Mileage"]', $form).data("udefault");
    EnginePowerUnitFrom = $('div.UnitWrapper[data-utype="EngPower"]', $form).data("udefault");

    GetResetUnitSwitchVal("Mileage", false, OdometerUnitFrom, $form);
    GetResetUnitSwitchVal("EngSize", false, EngineSizeUnitFrom, $form);
    GetResetUnitSwitchVal("EngPower", false, EnginePowerUnitFrom, $form);

    var unit = $("#AdvSearchSettingsModel_OdometerFrom", $form);
    if (unit != null) {
        unit.val(OdometerUnitFrom);
    }

    unit = $("#AdvSearchSettingsModel_EngineSizeFrom", $form);
    if (unit != null) {
        unit.val(EngineSizeUnitFrom);
    }

    unit = $("#AdvSearchSettingsModel_EnginePowerFrom", $form);
    if (unit != null) {
        unit.val(EnginePowerUnitFrom);
    }
}

function GetResetUnitSwitchVal(uTypeName, GetNotSet, value, $form) {
    if (GetNotSet) {
        return $('input[name="' + uTypeName + '"]:checked', $form).val();//get value of selected radiobutton via label
    } else {
        $('input[name="' + uTypeName + '"][value="' + value + '"]', $form).prop('checked', true);//set value
    }
}

function executeBasicSearchCount($form) {
    var url = '/Vehicles/GetStockVehicleCount'

    $.GWUtils.ajaxCall({
        url: url,
        type: 'Post',
        data: BuildBasicSearchModel($form),
        context: $form
    }, vehicleSearchCallback);
}

//get vehicle advanced search count
function executeAdvancedSearchCount($form) {
    var url = '/Vehicles/GetStockVehicleCount'

    $.GWUtils.ajaxCall({
        url: url,
        type: 'Post',
        data: BuildAdvancedSearchModel($form),
        context: $form
    }, vehicleSearchCallback);
}

function vehicleSearchCallback(ajaxResponse, context) {
    ajaxResponse
        .done(function (response) {
            $('#SearchCount', context).html(response.Count);
            mapModelsToOptions($('#Filters_MakeName', context)[0], response.Makes, 'Value');
            mapModelsToOptions($('#Filters_ModelName', context)[0], response.Models, 'Value');

            var stockVehicleCountEvent = $.Event("change.StockVehicleCount");
            stockVehicleCountEvent.vehicleCount = response.Count;
            $(document).trigger(stockVehicleCountEvent);
        })
        .fail(function (errorData) {
            $.GWUtils.logError(errorData);
        }
        );
}

function BuildBasicSearchModel($form) {
    var includeNew = false;
    if ($('#IncludeNewVehicles', $form)[0] !== undefined) {
        includeNew = $('#IncludeNewVehicles', $form)[0].checked;
    }

    var includeUsed = false;
    if ($('#IncludeUsedVehicles', $form)[0] !== undefined) {
        includeUsed = $('#IncludeUsedVehicles', $form)[0].checked;
    }

    //Needed while multiselect running in conjuction with single select
    var model;
    var category = $('#Category', $form);

    model = {
        IncludeNewVehicles: includeNew,
        IncludeUsedVehicles: includeUsed,

        Filters: {
            MakeName: $('#Filters_MakeName', $form).select2('val'),
            ModelName: $('#Filters_ModelName', $form).select2('val'),
            Type: category.select2('val')
        }
    }


    return model;
}

function BuildAdvancedSearchModel($form) {
    var includeNew = false;
    if ($('#IncludeNewVehicles', $form)[0] !== undefined) {
        includeNew = $('#IncludeNewVehicles', $form)[0].checked;
    }

    var includeUsed = false;
    if ($('#IncludeUsedVehicles', $form)[0] !== undefined) {
        includeUsed = $('#IncludeUsedVehicles', $form)[0].checked;
    }

    var isYearVisible = false;
    if ($('#IsFilteringByYear', $form) != undefined) {
        isYearVisible = $('#IsFilteringByYear', $form).val();
    }

    return {
        IncludeNewVehicles: includeNew,
        IncludeUsedVehicles: includeUsed,
        IsFilteringByYear: isYearVisible,
        Category: $('#Category', $form).val(),
        AdvSearchSettingsModel: {
            OdometerFrom: $('input[name="AdvSearchSettingsModel.OdometerFrom"]', $form).val(),
            EnginePowerFrom: $('input[name="AdvSearchSettingsModel.EnginePowerFrom"]', $form).val(),
            EngineSizeFrom: $('input[name="AdvSearchSettingsModel.EngineSizeFrom"]', $form).val()
        },

        Mileage: $('input[name="Mileage"]:checked', $form).val(),
        EngSize: $('input[name="EngSize"]:checked', $form).val(),
        EngPower: $('input[name="EngPower"]:checked', $form).val(),

        Filters: {
            MakeName: $('#Filters_MakeName', $form).val(),
            ModelName: $('#Filters_ModelName', $form).val(),
            Type: $('#Filters_Type', $form).val(),
            BodyStyles: $('#Filters_BodyStyles', $form).val(),
            FuelTypeName: $('#Filters_FuelTypeName', $form).val(),
            LocationTown: $('#Filters_LocationTown', $form).val(),
            TransmissionTypeName: $('#Filters_TransmissionTypeName', $form).val(),
            Co2Emissions: $('#Filters_Co2Emissions', $form).val(),
            BodyColour: $('#Filters_BodyColour', $form).val(),
            NumDoors: $('#Filters_NumDoors', $form).val(),
            EnginePower: $('#Filters_EnginePower', $form).val(),
            Price: $('#Filters_Price', $form).val(),
            RegistrationDate: $('#Filters_RegistrationDate', $form).val() + "," + isYearVisible,
            Odometer: $('#Filters_Odometer', $form).val(),
            EngineSize: $('#Filters_EngineSize', $form).val(),
            Seats: $('#Filters_Seats', $form).val()
        }
    };
}

function switchUnit(range, $form) {
    var unitType = $(range).attr('name');
    var unitTo = $(range).val();
    var unitFrom;
    var min;
    var max;
    var step;
    var value;

    EngineSizeUnitFrom = $('input[type=radio][name="EngSize"]:checked', $form).val();
    OdometerUnitFrom = $('input[type=radio][name="Mileage"]:checked', $form).val();
    EnginePowerUnitFrom = $('input[type=radio][name="EngPower"]:checked', $form).val();

    if (unitType === "EngSize") {
        $targetSlider = $('#Filters_EngineSize', $form);

        if (unitTo == "Litre") {
            min = parseFloat($targetSlider.data('slider-min-ltr'));
            max = parseFloat($targetSlider.data('slider-max-ltr'));
            step = parseFloat($targetSlider.data('slider-step-ltr'));
        } else {
            min = $targetSlider.data('slider-min-cc');
            max = $targetSlider.data('slider-max-cc');
            step = $targetSlider.data('slider-step-cc');
        }

        unitFrom = EngineSizeUnitFrom;
        EngineSizeUnitFrom = $(range).val();
        $('#AdvSearchSettingsModel_EngineSizeFrom', $form).val(unitTo);

    } else if (unitType === "Mileage") {
        $targetSlider = $('#Filters_Odometer', $form);

        if (unitTo == "Kilometer") {
            min = $targetSlider.data('slider-min-km');
            max = $targetSlider.data('slider-max-km');
            step = $targetSlider.data('slider-step-km');
        } else if (unitTo == "Mile") {
            min = $targetSlider.data('slider-min-mile');
            max = $targetSlider.data('slider-max-mile');
            step = $targetSlider.data('slider-step-mile');
        } else {
            min = $targetSlider.data('slider-min-mil');
            max = $targetSlider.data('slider-max-mil');
            step = $targetSlider.data('slider-step-mil');
        }

        unitFrom = OdometerUnitFrom;
        OdometerUnitFrom = $(range).val();
        $('#AdvSearchSettingsModel_OdometerFrom', $form).val(unitTo);

    } else if (unitType === "EngPower") {
        $targetSlider = $('#Filters_EnginePower', $form);

        if (unitTo == "Kilowatt") {
            min = $targetSlider.data('slider-min-kw');
            max = $targetSlider.data('slider-max-kw');
            step = $targetSlider.data('slider-step-kw');
        } else {
            min = $targetSlider.data('slider-min-hp');
            max = $targetSlider.data('slider-max-hp');
            step = $targetSlider.data('slider-step-hp');
        }

        unitFrom = EnginePowerUnitFrom;
        EnginePowerUnitFrom = $(range).val();
        $('#AdvSearchSettingsModel_EnginePowerFrom', $form).val(unitTo);
    }

    $targetSlider.slider('setAttribute', 'min', min);
    $targetSlider.slider('setAttribute', 'max', max);

    if (step) {//step value
        $targetSlider.slider('setAttribute', 'step', step);
    }

    $targetSlider.slider('setValue', JSON.parse('[' + min + "," + max + ']'));
}

function vehSearchSubmitForm($form, isBasicSearch) {
    if (isBasicSearch) {
        executeBasicSearchCount($form);
    } else {
        executeAdvancedSearchCount($form);
    }
}

function SetFiltersFromUrl() {
    var queryString = window.location.href.split('?')[1];
    var filters = {
    };

    if (queryString != undefined) {
        queryString.split('&').forEach(function (pair) {
            pair = pair.split('=');

            if (filters.hasOwnProperty(pair[0])) {
                filters[pair[0]].push(decodeURIComponent(pair[1] || ''))
            }
            else {
                filters[pair[0]] = [decodeURIComponent(pair[1] || '')];
            }
        });

        return JSON.parse(JSON.stringify(filters));
    }

    return "";
}

//end search section

function setGoBackUrl(cookieName) {
    var currentUrl = document.URL;
    var expiryDate = new Date();
    expiryDate.setDate(expiryDate.getDate() + 1); // Expires in one day
    Cookies.set(cookieName, currentUrl, {
        expires: expiryDate, appendValues: false
    });
}

function getGoBackUrl(cookieName) {
    var previous = Cookies.get(cookieName);

    if (previous == undefined) {
        previous = window.location.origin;
    }

    return previous;
}

var variantGlider = null;
$(document).ready(function () {

    preResizeHeight = $window.height();
    preResizeWidth = $window.width();

    $('[data-toggle=tooltip]').tooltip();

    // Solves FOUC issue
    $('.caret-x').addClass('caret');

    // Generic "loading" animation for all AJAX calls
    var $loader = $('#loader');
    var loaderTimer;
    var failsafeTimer;
    var loaderStarted;
    $(document).ajaxStart(function () {
        window.clearTimeout(loaderTimer);
        window.clearTimeout(failsafeTimer);
        loaderStarted = new Date().getTime();
        failsafeTimer = window.setTimeout(function () { $loader.hide(); }, 3000);
        $loader.show();
    }).ajaxStop(function () {
        // Don't close too soon as the flash is bad UX
        var time = new Date().getTime() - loaderStarted;
        if (time > 500) {
            $loader.hide();
        }
        loaderTimer = window.setTimeout(function () { $loader.hide(); }, 500 - time);
    });

    // Smooth scroll to #links
    $('a.smooth').bindactions(function (e) {
        if (this.href.indexOf('#') > 0) {
            e.preventDefault();
            var hash = this.href.substring(this.href.indexOf('#'));
            return scrollToHash(hash);
        }
    });
});;
var wasHamMenu = false;

$(document).ready(function () {   

    $(document).on('click touch', '.overlay', function () {
        closeLinkedSite($('.linkedSite'));
        $.SmartMenus.hideAll();
        if ($('#gw_footerSticky__contact').html() != "") {
            closeFooterForm();
        }
    });

    $(window).on('resizeMinorDone resizeDone', function (event) {
        resizeStickyHeader();
        resizeMenu();
        resizeSubHeader();
    });

    if ($('#SmartMaxi').length > 0) {
        var clonedNavigation = $('#SmartMaxi').clone();

        var originalMenu = $('nav#mainNavigation > div:first').clone();

        $('#SmartMaxi', originalMenu).attr("id", "menuCopy");
        $('#navbar', originalMenu).attr("id", "navbarCopy");
        $(originalMenu).addClass('navCopy');
        $('header nav#mainNavigation').append(originalMenu);

        resizeMenu();
    }

    if ($('#gw_subHeader').length > 0) {
        resizeSubHeader();
    }

    if ($('#SmartMaxiSticky').length > 0) {
        resizeStickyHeader();

        setNavigationLevels($('#SmartMaxiSticky'));

        $('#SmartMaxiSticky').smartmenus('refresh');

        var variantGliderSticky = $('#SmartMaxiSticky .slideMaxiMenu').glider({
            list: 'ol',
            nextIcon: '&gt;',
            backIcon: '&lt;',
            controls: 'li',
            navigationMode: 'stop'
        });
    }
});

//Common
function setNavigationLevels($menu) {
    $('> li.hamMenu > ul', $menu).not('.car').removeClass('navLev1 navLev2 navLev3 navLev4').addClass('navLev1');
    $('> li.hamMenu > ul > li > ul', $menu).not('.car').removeClass('navLev1 navLev2 navLev3 navLev4').addClass('navLev2');
    $('> li.hamMenu > ul > li > ul > li > ul', $menu).not('.car').removeClass('navLev1 navLev2 navLev3 navLev4').addClass('navLev3');
    $('> li.hamMenu > ul > li > ul > li > ul > li > ul', $menu).not('.car').removeClass('navLev1 navLev2 navLev3 navLev4').addClass('navLev4');
}

function isCollide(a, b) {
    if (rtlFlag) {
        return ((a.offsetLeft) < b.offsetLeft + b.offsetWidth);
    }

    return ((a.offsetLeft + a.offsetWidth) >= b.offsetLeft);
}
//

//Menu
function resizeMenu() {
    if (window.innerWidth <= 992) {
        if (wasHamMenu) {
            setStandardMenu($('#SmartMaxi'));
        }

        realignMobileHeader();

        return false;
    }

    var $mainMenu;
    var isHamMenu = false;

    adjustLinkedSitePosition();
    closeMobileView();

    if (wasHamMenu) {
        $mainMenu = $('#navbarCopy');
    } else {
        $mainMenu = $('#navbar');
    }

    if ($mainMenu) {

        if (isCollide($('>ul', $mainMenu)[0], $mainMenu.parent('div').children('.dealerLogo')[0])) {
            if (!wasHamMenu) {
                isHamMenu = setHamburgerMenu($('#SmartMaxi'), 'mainNavigation');
            }
            return false;
        }

        $.each($("ul:first > li:not(.hamMenu)", $mainMenu), function () {
            var $this = $(this);
            var containerWidth = Math.max($this.outerWidth() - 39, 0);
            var contentWidth = $this.find('button').innerWidth() || 0;
            var contentHeight = $this.find('button span.gruxIconText').height() || 0;

            if (contentWidth > containerWidth || contentHeight > 50) {
                isHamMenu = setHamburgerMenu($('#SmartMaxi'), 'mainNavigation');
                return false;
            }
            isHamMenu = false;
        });

        if ((wasHamMenu && !isHamMenu)) {
            setStandardMenu($('#SmartMaxi'));
        }
    }
}

function setStandardMenu($menu) {
    $('header nav#mainNavigation > div:first').removeClass('hamburgerNavigation');
    wasHamMenu = false;
    $('#SmartMaxi > li').not('.hamMenu').css({ display: 'table-cell' });
    $('#mainNavigation li.hamMenu').css({ display: 'none' });
}

function refreshMenu($menu) {
    $menu.smartmenus('refresh');
    variantGlider = $('.slideMaxiMenu', $menu).not('.glider').glider({
        list: 'ol',
        nextIcon: '&gt;',
        backIcon: '&lt;',
        controls: 'li',
        navigationMode: 'stop'
    });
}

function setSmartMenu($menu) {
    $menu.bind('beforeshow.smapi', function (e, menu) {
        overlayToggle(true, '.overlay3');
    });

    $menu.bind('click.smapi', function (e, item) {
        if ($(item).hasClass("noLink")) {
            return false;
        }
    });

    $menu.bind('hide.smapi', function (e, menu) {
        if ($(menu).hasClass('navLev1')) {
            overlayToggle(false, '.overlay3');
        }
    });

    $menu.smartmenus('refresh');
}

function loadAsyncSubMenu() {
    $.each($('.topLink[data-url]', $('.nav').not('#menuCopy')), function (key, value) {
        $.GWUtils.ajaxCall({
            url: $(this).data('url'),
            type: 'Get',
            dataType: 'Html',
            context: $(this)
        }, loadSubMenu);
    });
}

function loadSubMenu(ajaxResponse, context) {
    ajaxResponse
    .done(function (data) {
        openedItems = $('#SmartMaxi').children('li.open');
        var ul = $(context).closest('li').children('ul.dropdown-menu');
        ul.html(data);
        var $smartMaxi = $(context).closest('ul.nav');
        $smartMaxi.smartmenus('refresh');
        variantGlider = $('.slideMaxiMenu', $smartMaxi).not('.glider').glider({
            list: 'ol',
            nextIcon: '&gt;',
            backIcon: '&lt;',
            controls: 'li',
            navigationMode: 'stop'
        });

        openedItems.each(function (key, value) {
            $('#SmartMaxi').smartmenus('itemActivate', $(this).children('a'));
        });

        if (data == "\n" || data == " " || data == "" ) {
            $(context).find('.gruxIcon').remove()
        }

    })
    .fail(function (errorData) {
        $.GWUtils.logError(errorData);
    });
}
//

//Small Menu
function setHamburgerMenu($menu, navId) {
    $('header nav#' + navId + ' > div:first').addClass('hamburgerNavigation');
    wasHamMenu = true;

    if ($('#mainNavigation li.hamMenu').length == 0) {
        $.GWUtils.ajaxCall({
            url: '/Header/MenuHam',
            dataType: 'Html',
            context: $menu
        }, setMenuCallBack);
    } else {
        $('#SmartMaxi > li').not('.hamMenu').css({ display: 'none' });
        $('#mainNavigation li.hamMenu').css({ display: 'table-cell' });
    }

    return true;
}

function setMenuCallBack(ajaxResponse, context) {
    ajaxResponse
    .done(function (data) {
        if ($('#mainNavigation li.hamMenu').length == 0) {
            $('#SmartMaxi > li').not('.hamMenu').css({ display: 'none' });
            context.append(data);
            setNavigationLevels(context);
            refreshMenu(context);
            $('#mainNavigation li.hamMenu').css({ display: 'table-cell' });

            loadAsyncSubMenu();
        }
    })
    .fail(function (errorData) {
        $.GWUtils.logError(errorData);
    }
 );
}
//

//Mobile
function realignMobileHeader() {
    if ($('#gw_cookieDirective').css('display') != 'none') {
        $('#navbar').css({ top: $('#gw_cookieDirective').height() + 115 });
        $('#mainNavigation .linkedSite ul').css({ top: $('#gw_cookieDirective').height() + 115 });
    }
}

function closeMobileView() {
    $('#navbar').removeClass('collapse');

    if ($('#respMenuToggle .menuOpen').attr('aria-expanded') == 'true') {
        $('#navbar').removeClass('in');

        $('#respMenuToggle .menuOpen').attr({ 'aria-expanded': 'false' });
        $('#respMenuToggle .menuClose').attr({ 'aria-expanded': 'false' });
    }
}
//

//LinkedSite
function closeLinkedSite(linkedSite) {
    if ($(linkedSite).hasClass('selectedGrey')) {
        $('ul', linkedSite).removeClass('displayList');
        $(linkedSite).removeClass('selectedGrey');
        overlayToggle(false, '.overlay3');
    }
}

function adjustLinkedSitePosition() {
    if ($('#gw_cookieDirective').css('display') != 'none') {
        $('#mainNavigation .linkedSite ul').css({ top: $('#gw_cookieDirective').height() + 90 });
    }
}
//

//SubHeader
function resizeSubHeader() {
    if (!isCollide($('#gw_subHeader__quickActionPanel'), $('#gw_subHeader__contactPanel'))) {
        $('#gw_subHeader__quickActionPanel .quickActionButton').removeClass('hideText');
    }

    if (isCollide($('#gw_subHeader__quickActionPanel')[0], $('#gw_subHeader__contactPanel')[0])) {
        $('#gw_subHeader__quickActionPanel .quickActionButton').addClass('hideText');
    }
}
//;
var areButtonsCollapsed = false;
var isTextCollapsed = false;
var $stickyNavigation = $('#stickyNavigation');
var $stickyFooter = $('#gw_footerSticky');

$(document).ready(function () {

});

//Sticky Header
function openStickyFooter() {
    $stickyFooter.css({ bottom: '0px' });
}

function closeStickyFooter() {
    $stickyFooter.css({ bottom: '-50px' });
}

function openStickyHeader() {
    $stickyNavigation.css({ top: '0px' });
}

function closeStickyHeader() {
    $stickyNavigation.css({ top: '-50px' });
}


function resizeStickyHeader() {
    var stickyHeader = document.getElementById('stickyNavigation');
    if (window.innerWidth > 992) {
        if ($window.scrollTop()) {
            openStickyHeader();
        }

        var currentWidth = $window.width();

        if (stickyHeader) {
            if (!isCollide($('.stickyButtons', stickyHeader)[0], $('.dealerLogo', stickyHeader)[0])) {
                if (isTextCollapsed) {
                    isTextCollapsed = false;
                    $('.nav_DealerName', stickyHeader).removeClass('smallText');
                }

                if (areButtonsCollapsed) {
                    areButtonsCollapsed = false;
                    $('.stickyButtons', stickyHeader).removeClass('hideText');
                }
            }

            while (isCollide($('.stickyButtons', stickyHeader)[0], $('.dealerLogo', stickyHeader)[0]) || isTextCollapsed) {
                if (areButtonsCollapsed) {
                    isTextCollapsed = true;
                    $('.nav_DealerName', stickyHeader).not('.smallText').addClass('smallText');
                    return;
                }

                areButtonsCollapsed = true;
                $('.stickyButtons', stickyHeader).not('.hideText').addClass('hideText');
            }
        }
    } else {
        closeStickyHeader();
    }
}
//

//Footer
function openFooterForm($this) {
    $('#gw_footerSticky button.activeHMe').removeClass('activeHMe');
    $this.toggleClass('activeHMe');

    setAutofillBranch($this.data("branchid"));

    if ($this.data("helptype").includes("/Form/Builder/") || $this.data("helptype").includes("/Contact/")) {
        $.GWUtils.ajaxCall({
            url: $this.data("helptype"),
            dataType: "html",
            data: autoFillData,
            context: $this
        }, formCallback);
    }
    else {
        window.location.href = $this.data("helptype");
    }
}

function setAutofillBranch(branchId) {
    if (autoFillData.Page != undefined && branchId != undefined) {
        if (autoFillData.Page === "Contact" || autoFillData.Page === "Vehicle") {
            if (autoFillData.BranchId === undefined) {
                autoFillData.BranchId = branchId;
            }
        }
        else {
            autoFillData.BranchId = 0;
        }
    }
}

function formCallback(ajaxResponse, context) {
    ajaxResponse
    .done(function (data) {
        $('#gw_footerSticky__contact').html(data);
        $('#gw_footerSticky').css({ bottom: '0px' });
        $('#gw_footerSticky__contact').slideDown();
        overlayToggle(true, '.overlay3');

        if (context.data('eventlistener') != undefined) {
            var previousPageData = Cookies.getJSON('PageData');
        }
    })
    .fail(function (errorData) {
        $.GWUtils.logError(errorData);
    });
}

function closeFooterForm() {
    var $contactPanel = $('#gw_footerSticky__contact');
    $contactPanel.slideUp();

    if ($(window).scrollTop() == 0) {
        $('#gw_footerSticky').css({ bottom: '-50px' });
    }

    overlayToggle(false, '.overlay3');
    $("#gw_footerSticky button.activeHMe").removeClass('activeHMe');
}

function populateAutoFillData(make, model, variant) {
    $.SmartMenus.hideAll();
    autoFillData.Page = "Menu";
    autoFillData.Make = make;
    autoFillData.Model = model;
    autoFillData.Variant = variant;
}
//;
;
(function () {
    $(document).ready(function () {
        //Open the General Search Panel from the topnav
        $('.nav_GenSearchAll').bindactions(function () {
            var $targElem = $(this);

            if ($targElem.attr('data-mobmentab')) {
                $targElem = $targElem.parent();
            }

            var isOpening = toggleSlider($('#SearchSlider'), $targElem, '.sliderClose');
            if (isOpening) {
                $('#GeneralSearch .input-group:first')[0].focus();
            }
        });

        //General Search checkbox activation
        $('.nav_GenSearchAll div.cb').bindactions(function () {
            var $cb = $(this).children().children('input');
            if ($cb != null) {
                $cb.prop('checked', !$cb.prop('checked'));
                $cb.val($cb.prop('checked'));
                $(this).children().children('input:hidden').val($cb.prop('checked'));
                cbChangeChecker($cb[0]);
            }
        });
    });
}());;
(function () {
    function addRemoveSearchTerms(action, term) {
        //convert hidden terms field to a comma seperated array
        var termsArray = $('#searchTerms').val().split(',');

        if (action == 'remove') {
            termsArray.splice($.inArray(term, termsArray), 1);
        } else {
            termsArray.push(term);
        }

        //join terms array by commas and remove any trainling or preceeding commas.
        return termsArray.join(',').replace(/(^,)|(,$)/g, '');
    }


    $(document).ready(function () {
        // VehSearch - slider stop activations
        $('#vehSearchForm').on('change slideStop', function (event) {
            var $form = getForm();
            var eventType = event.type;
            var $eventTarget = $(event.target);
            if ($eventTarget.is('input') && eventType == 'slideStop') {
                vehSearchSubmitForm($form, $('.vehSearchAdvanced2', $form).css('display') == "none");
            }
        });
    });
}());;
(function () {
    // Put news related functions here
}());;
(function () {
    // Place functions for Finance here...

    $(document).ready(function () {

        //Finance Calculator sliders
        convertToSlider('#finCalcMonthlyPay', function (val) { return marketCurrencySymbol + val; });
        convertToSlider('#finCalcAvgAnnualMileage');
        convertToSlider('#finCalcDeposit');
        convertToSlider('#finCalcFinanceDuration');

        $('#finCalcMonthlyPay').on('slide', function (slideEvt) {
            $('#financeCalcMonthlyBudget').text(marketCurrencySymbol + slideEvt.value);
        });
    });
}());;
(function () {
    $(document).ready(function () {
        $(document).on('click', '#ShowMore', function (e) {
            e.defaultPrevented;
            var url = $(this).attr('data-page');
            $.get(url, function (data) {
                var $moreVehicles = $(data).find('li');
                var $additionalContent = $(data).filter('#additional-content');
                if (($('.vResults').length) && ($('.ResultContent').length)) {
                    $('.vResults').append($moreVehicles);
                }
                if (($('.vResults').length == 0) && ($('.ResultContent').length)) {
                    $('.ResultContent').append($moreVehicles);
                }
                $('#additional-content').replaceWith($additionalContent);
                var showMoreEvent = new CustomEvent("show-more", { "detail": "Raised on clicking show more" });
                document.dispatchEvent(showMoreEvent);
            });
            return false;
        });
   

        $(document).on('change', '#SortBy', function (e) {
            window.location.href = RebuildSearchURL(window.location.href) + 'Sort=' + $(this).val().split('_')[0] + '&Dir=' + $(this).val().split('_')[1];

            function RebuildSearchURL(searchUrl) {
                var baseUrl = searchUrl.split('?')[0];
                var queryString = searchUrl.split('?')[1];
                var rebuiltQueryString = "";

                if (queryString == undefined) {
                    return searchUrl + '?';
                }

                $.each(queryString.split('&'), function (c, q) {
                    if (q.indexOf('Sort') < 0 && q.indexOf('Dir') < 0) {
                        rebuiltQueryString = rebuiltQueryString + q + '&';
                    }
                });

                return baseUrl + '?' + rebuiltQueryString;
            }
        });
    });
}());;
(function () {
    $(window).on('scrollStarted', function () {
        if ($('#gw_footerLinks').hasClass('loading')) {
            $('#gw_footerLinks').removeClass('loading');
            loadFooterLinks();
        }
        window.setTimeout(loadNextAsyncItem, 200);
    });

    function loadFooterLinks() {
        $.GWUtils.ajaxCall({
            url: '/Footer/LinksAsync',
            dataType: 'Html',
            context: $('#gw_footerLinks')
        }, setFooterLinks);
    }

    function setFooterLinks(ajaxResponse, context) {
        ajaxResponse
        .done(function (data) {
            context.append(data);
        })
        .fail(function (errorData) {
            $.GWUtils.logError(errorData);
        })
    }

    function loadNextAsyncItem() {
        var $placeholder = $('.async').first();

        if ($placeholder.length == 0) {
            return;
        }

        var $parentSection = $placeholder.parents('section');
        var url = $placeholder.attr('data-page');
        $placeholder.removeClass('async');
        $(document).trigger('loadMore', [$parentSection, url]);
    }

    $(document).on('loadMore', function (e, $target, url) {
        if (url) {
            $.get(url, function (data) {
                $target.html($(data));

                if ($target.hasClass('content-slider')) {
                    // Additional work for content sliders
                    $('#' + $(data).attr('id')).find('.content-list').first().resetSlider();
                }

                if ($target.hasClass('content-map')) {
                    initialiseMap('gw_location__map');
                }

                window.setTimeout(loadNextAsyncItem, 200);
            });
        }
    });
}());;
(function () {
    var ulCompare = null;

    var Vehicle = function () {
        this.current = '0';
        this.previous = '-';
        this.previousScript = '';
        this.currentScript = '';

        return {
            setCurrent: function ($vehicle, script) {
                this.previous = this.current;
                this.current = $vehicle.attr('data-vehicle');
                this.previousScript = this.currentScript;
                this.currentScript = script;
                return this.current;
            },
            isSameVehicle: function () {
                return this.current === this.previous;
            },
            isSameScript: function () {
                return this.currentScript === this.previousScript;
            }
        }
    }

    var vehicle = new Vehicle();
    var compare = new Vehicle();

    $('document').ready(function () {
        CheckVehicles();
    });

    function VehicleSearchFormCallback(ajaxResponse) {
        var $parent = $("#searchRefine");
        ajaxResponse
            .done(function (data) {
                $parent.html(data);

                // TODO: There is nothing in the DONE handler... is a promise needed or not?
                $.when($("#searchRefine").animate({ width: 'toggle' }, 350))
                    .done(function () { });
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            }
        );
    }

    function getCompareVehiclesCall(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                $(targetElement).html(data);
                ulCompare = $('#ulCompare').bxSlider(compareOpts);
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData)
            });
    }

    $('.ShowMore').bind('click', CheckVehicles());

    //Vehicle Search Refine
    $(document).on('click', '#VehSearchRefine', function (e) {
        e.defaultPrevented;

        if ($('#searchRefine').is(':visible') == false) {
            //UpdateCompareVehicles();
        }
        $(this).toggleClass('closeButton');

        $.GWUtils.ajaxCall({
            url: '/Vehicles/VehicleSearchRefineForm',
            dataType: 'Html'
        }, VehicleSearchFormCallback);
    });
    //Vehicle Compare
    $(document).on('click', '#Comparison', function (e) {
        e.stopPropagation();
        e.defaultPrevented;

        if ($('#ComparisonSection').is(':visible') == false) {
            UpdateCompareVehicles();
        } else {
            if (ulCompare) {
                ulCompare.destroySlider();
            }
        }

        if ($('#ComparisonSection').is(":visible") == false && Cookies.get('CompareVehLst').length <= 0) {
            //do nothing
        } else {
            $(this).toggleClass('closeButton');
            $('#ComparisonSection').toggleClass('compare-visible');
        }      
    });

    //Save Results
    $(document).on('click', '#SaveResults', function (e) {
        var savedSearch = document.URL;
        var expiryDate = new Date();
        expiryDate.setDate(expiryDate.getDate() + 1); // Expires in one day
        Cookies.set('StockVehicleSavedSearch', savedSearch, { expires: expiryDate, appendValues: false });
    });

    $(document).on('click', '.removeVehicle', function (e) {
        e.stopPropagation();
        e.defaultPrevented;
        var $vehicle = $(this).parents('li');
        var vehicleId = $vehicle.attr('data-vehicle');
        Cookies.remove('CompareVehLst', { removeValFromLst: true, cvalue: vehicleId });
        deleteCompareVehicle(vehicleId);
    });

    //menu title
    $(document).on('click', 'div.Menu div.forms', function (e) {
        e.defaultPrevented;

        // Cleaning up
        $('.Menu div.selected').removeClass('selected');

        ShowForm(compare, $(this), $(this).parents('li'));
    });

    $(document).on('click', 'div[data-form="Park"]', function (e) {
        e.defaultPrevented;
        var vehicleId = $(this).parents('li').attr('data-vehicle');
        var $checkbox = $(this).children("input[name=ParkButton]").first();
        var isChecked = $checkbox.prop('checked');
        $checkbox.prop('checked', !$checkbox.prop('checked'));

        var expiryDate = new Date();
        expiryDate.setMonth(expiryDate.getMonth() + 1); // Expires in one month
        var add = true;

        if (isChecked) {
            Cookies.remove('ParkedVehicles', { removeValFromLst: true, cvalue: vehicleId });
            $(this).addClass('add-img-Park')
            $(this).removeClass('remove-img-Park');
            add = false;
        } else {
            Cookies.set('ParkedVehicles', vehicleId, { expires: expiryDate, appendValues: true });
            $(this).addClass('remove-img-Park')
            $(this).removeClass('add-img-Park');
        }
        return false;
    });

    //for result page : vehicle card right menu
    $(document).on('click', 'div[data-form="Compare"]', function (e) {
        e.defaultPrevented;
        var vehicleId = $(this).parents('.vRes').attr('data-vehicle');
        var checkbox = $(this).children("input[name=CompareButton]").first();
        var isChecked = checkbox.prop('checked');
        checkbox.prop('checked', !checkbox.prop('checked'));

        var expiryDate = new Date();
        expiryDate.setMonth(expiryDate.getMonth() + 1); // Expires in one month
        var add = true;

        if (isChecked) {
            Cookies.remove('CompareVehLst', { removeValFromLst: true, cvalue: vehicleId });
            if ($("#FavouriteCompare").length > 0) {
                $(this).attr('class', 'CompareFavCheck addFav-img');
            }
            else {
                $(this).addClass('add-img')
                $(this).removeClass('remove-img');
            }
           
            add = false;
        } else {
            Cookies.set('CompareVehLst', vehicleId, { appendValues: true });
            if ($("#FavouriteCompare").length > 0) {
                $(this).attr('class', 'CompareFavCheck removeFav-img');
            }
            else {
                $(this).addClass('remove-img')
                $(this).removeClass('add-img');
            }
        }

        if ($("#ComparisonSection").is(":visible") == true) {
            if (add) {
                UpdateCompareVehicles();
            } else {
                deleteCompareVehicle(vehicleId);
            }
        }
        return false;
    });

    $(document).on('click', 'div.leadPicCTA div[data-cta="1"]', function (e) {
        e.stopPropagation();

        // Cleaning up
        $('.vRes div.selected').removeClass('selected');
        ShowForm(vehicle, $(this), $(this).parents('.vRes'));
    });

    $(document).on('click', 'div.vehicleForm', function (e) {
        e.stopPropagation();//stop form clicks from triggering overall li click below
    });

    $(document).on('click', 'li.vRes', function (e) {
        setGoBackUrl('GoBackUrl');

        // TODO: Remove stock list toggle
        if (!$(".gw_stockList__vehicle").length > 0) {
            e.stopPropagation();
            window.location.href = $(this).data('vehurl');
        }
    });

    //internal functions
    function convertToSlug(Text) {
        return Text.toLowerCase().replace(/ /g, '-').replace(/[^\w-]+/g, '');
    }

    function UpdateCompareVehicles() {
        var cookie = Cookies.get('CompareVehLst');
        if (cookie) {
            $.GWUtils.ajaxCall({
                url: '/Vehicles/GetCompareVehicles',
                data: { ids: cookie },
                dataType: 'Html',
                context: $('#ComparisonSection')
            }, getCompareVehiclesCall);
        }
    }

    function deleteCompareVehicle(vehicleId) {
        $('li.vCompare[data-vehicle=' + vehicleId + ']').remove();

        if ($("#FavouriteCompare").length > 0) {
            var div = $('#CompareCheck_' + vehicleId).parents('.CompareFavCheck');
            div.attr('class', 'CompareFavCheck addFav-img');
        }
        else {
            var $div = $('#CompareCheck_' + vehicleId).parents('.CompareCheck');
            $div.removeClass('remove-img');
            $div.addClass('add-img');
        }


        var compareCount = $('#ComparisonSection ul#ulCompare li').length;
        if (compareCount < 1) {
            $("#ComparisonSection").toggleClass('compare-visible');
            $("#Comparison").removeClass('closeButton');
        } else {
            ulCompare.reloadSlider();
        }
    }

    var compareOpts = {
        infiniteLoop: false,
        pager: false,
        auto: false,
        moveSlides: 1,
        captions: false,
        hideControlOnEnd: true,
        minSlides: 1,
        maxSlides: 25,
        slideWidth: 285,
        slideMargin: 10,
        nextText: '<span class="gruxIcon gw-grux-right02"></span>',
        prevText: '<span class="gruxIcon gw-grux-left02"></span>'
    }

    function CheckVehicles() {
        var vehiclesToCheck = Cookies.get('CompareVehLst');

        //Firstly set all compare elements to unchecked, otherwise previous 'checked' input keep checked status, but below will indicate them as unchecked
        if ($("#FavouriteCompare").length > 0) {
            $('div[data-form="Compare"]').attr('class', 'CompareFavCheck addFav-img');
        }
        else {
            $('div[data-form="Compare"]').removeClass('remove-img').addClass('add-img');
        }
        $('input[name="CompareButton"]').prop("checked", false);

        if (vehiclesToCheck != null && vehiclesToCheck.length > 0) {
            vehiclesToCheck = vehiclesToCheck.split(",");
            var elem;
            for (index = 0; index < vehiclesToCheck.length; ++index) {
                elem = document.getElementById('CompareCheck_' + vehiclesToCheck[index]);
                if (elem != null) {
                    elem.checked = true;
                    if ($("#FavouriteCompare").length > 0) {
                        elem.parentElement.className = 'CompareFavCheck removeFav-img';
                    }
                    else {
                        elem.parentElement.className = 'CompareCheck remove-img';
                    }

                }
            }
        }
    }

    //TODO: Needs revising as to which functionality below in ShowForm is required.
    function ShowForm(vehicleForm, $this, $parent) {
        var script = $this.attr('data-form')
        var vehicleId = vehicleForm.setCurrent($parent, script);

        var $prev = $('#' + vehicleForm.previousScript + '_' + vehicleForm.previous);
        var preParent = $prev.closest('.vehicleForm');

        var $cur = $('#' + vehicleForm.currentScript + '_' + vehicleForm.current);
        var curParent = $cur.closest('.vehicleForm');

        if (vehicleForm.isSameVehicle()) {
            if (vehicleForm.isSameScript()) {
                $cur.fadeOut(200);
                curParent.fadeOut(200);
                vehicleForm.currentScript = '';
                vehicleForm.current = '0';
            } else {
                document.getElementById(vehicleForm.previousScript + "_" + vehicleForm.previous).style.display = 'none';

                $('.formClass').each(function () {
                    this.reset();
                });

                $cur.fadeIn(300);
                $this.addClass('selected');
                $('.error').removeClass('error');
            }
        } else {
            $prev.fadeOut(200);
            preParent.fadeOut(200);

            $('.formClass').each(function () {
                this.reset();
            });

            curParent.fadeIn(200);
            $cur.fadeIn(200);
            $this.addClass('selected');
            $('.error').removeClass('error');
        }
    }

    $(document).on('click touch', '#gw_productVehicle__specifications__download', function () {
        if ($(this).hasClass('selected')) {
            overlayToggle(false, '.overlay2');
        } else {
            overlayToggle(true, '.overlay2');
        }

        $(this).toggleClass('selected');
        $('ul', this).toggleClass('visible');
    });

    $(document).on('click touch', '.overlay', function () {
        closeSpecificationsDownload($('#gw_productVehicle__specifications__download'));
    });

    function closeSpecificationsDownload(downloadSpecificationBox) {
        if ($(downloadSpecificationBox).hasClass('selected')) {
            overlayToggle(false, '.overlay');

            $(downloadSpecificationBox).toggleClass('selected');
            $('ul', downloadSpecificationBox).toggleClass('visible');
        }
    }
}());;
(function ($) {
    $.fn.initialiseHelpMeForm = function () {
        var fieldLoaded = false;

        if (!fieldLoaded) {
            setHelpMeFormDetails($('#gw_footerSticky__contact').find('select#SelectDealer'), 0, false);
        }
    };

    var branchId = '';
    var marketId = '';
    var formRequestCode = '';
    var departmentType = '';

    //TODO: RequestTypes and DepartmentTypes below to come from server side Geronimo Types rather than hard coded here.
    var RequestTypes = {
        'CallMeBack': '1',
        'EmailMeBack': '2',
        'BookTestDrive': '3',
        'BookService': '4',
        'BookAppointment': '5',
        'ValueVehicle': '7'
    };

    var DepartmentTypes = {
        'NewCar': 1,
        'Service': 5
    };

    //CMB_Dealer selected index change
    $(document).on('change', '#SelectDealer', function () {
        if ((($("#VehMake").length > 0 && $("#VehModel").length > 0) || $("#VehVariant").length > 0) && (($("#VehMake").val().length > 0 && $("#VehModel").val().length > 0 || $("#VehVariant").val().length > 0))) {
        }
        else {
            clearScreenSelections();
            setHelpMeFormDetails($(this), 0, true);
        }
    });

    $(document).on('change', '#ContactForm #DepartmentType', function () {
        $("#hdfDepartmentType").val($("#DepartmentType").val());
        clearScreenSelections();

        if (isEmailOrCallmeBackRequest() == false) {
            departmentType = $(this).val();
            loadCalendar($("#DepartmentType"));
        }
    });

    $(document).on('change', '#ContactForm #VehModel', function () {
        $.GWUtils.ajaxCall({
            url: '/Vehicles/GetVehicleVariants',
            data: { branchId: branchId, vehicleMake: $('#VehMake').val(), vehicleModel: $('#VehModel').val() },
            context: $('#VehVariant')
        }, selectListCallback);
    });

    $(document).on('change', '#DateRequest', function () {
        getTimeSlot($(this));
        $('input.calHidden').val($(this).val());
    });

    $(document).on('submit', '#ContactForm', function (e) {
        e.defaultPrevented;
        $container = $(this);

        //disable submit button on submit
        $subBtn = $container.find('button[type="submit"]');
        $subBtn.prop('disabled', true);
        $subBtn.addClass('disabled');

        $.GWUtils.ajaxCall({
            url: '/Contact/Lead',
            type: 'Post',
            data: $container.serialize(),
            context: { targetElement: $container.parent(), subBtn: $subBtn }
        }, submitContactFormCallback);

        return false;
    });

    function setHelpMeFormDetails(objDropdown, deptType, reloadEnquiryDropdowns) {
        if (deptType == 0) {
            deptType = $('#hdfDepartmentType').val()
        }

        setFormDetails(objDropdown, deptType, reloadEnquiryDropdowns);

        if (isEmailOrCallmeBackRequest() == false) {
            if (isAppointmentRequest() == true) {
                loadCalendar($('#DepartmentType'));
            }
            else {
                loadCalendar(objDropdown);
            }
        }
    }

    function setFormDetails(objDropdown, deptType, reloadEnquiryDropdowns) {
        formRequestCode = objDropdown.prev().val();
        marketId = $('#MarketId').val();
        branchId = objDropdown.val();
        departmentType = deptType;

        switch (formRequestCode) {
            case RequestTypes.CallMeBack || RequestTypes.EmailMeBack:
                if (branchId != '') {
                    if (reloadEnquiryDropdowns == true) {
                        getDepartments();
                        $('#DepartmentType').val(departmentType);
                    }
                }
                else {
                    $('#DepartmentType').find('option:not(:first)').remove();
                }
                break;
            case RequestTypes.BookTestDrive:
                if (reloadEnquiryDropdowns == true) {
                    getVehicleModels();
                }
                break;
            case RequestTypes.BookService:
                getServiceType();
                departmentType = departmentType
                break;
            case RequestTypes.BookAppointment:
                if (reloadEnquiryDropdowns == true) {
                    getDepartments();
                    $('#DepartmentType').val(departmentType);
                }
                break;
        }
    }

    function clearScreenSelections() {
        var defaultDate = $('#DefaultDateOfCalendar').val();
        $('#Reason_For_Enquiry').val('');
        $('#BeginDateOfCalendar').val(defaultDate);
        $('#EndDateOfCalendar').val(defaultDate);
        $('#SelectedDate').val('');
        $('#HolidayDates').val('');
        $('#VehModel').find('option:gt(0)').remove();
        $('#VehVariant').find('option:gt(0)').remove();
        $('#TimeSlot').find('option:gt(0)').remove();
        clearDates();
    }

    function loadCalendar(objDropdown) {
        if (isBookable(objDropdown) == true) {
            $("#hdfIsAppointmentEnabledForSelectedDepartment").val("True");
            getCalendarDays();
            bookableToggle(true);
        } else {
            $("#hdfIsAppointmentEnabledForSelectedDepartment").val("False");
            clearDates();
            bookableToggle(false);
        }
    }

    function isBookable(objDropdown) {
        return (objDropdown.children('option:selected').data('isbookable') == "True") || (objDropdown.children('option:selected').data('isbookable') == true);
    }

    function isEmailOrCallmeBackRequest() {
        return formRequestCode == RequestTypes.CallMeBack || formRequestCode == RequestTypes.EmailMeBack;
    }

    function isAppointmentRequest() {
        return formRequestCode == RequestTypes.BookAppointment;
    }

    function bookableToggle(showBookableArea) {
        if (showBookableArea) {
            $('.bookableArea').show();
        } else {
            $('.bookableArea').hide();
        }
    }

    function loadSelectList(data, ctrl) {
        $(ctrl).find('option:gt(0)').remove();
        $.each(data, function (index, itemData) {
            $(ctrl).append($('<option>', {
                value: itemData,
                text: itemData
            }));
        });
    }

    function clearDates() {
        $('#DateRequest option:gt(0)').remove(); // remove all but the first options in select list
    }

    function refreshDates() {
        moment.locale(marketId, {});

        var DateOptions = {};
        var $dr = $('#DateRequest');
        var startDate = moment($('#BeginDateOfCalendar').val(), 'YYYY-MM-DD');
        var endDate = moment($('#EndDateOfCalendar').val(), 'YYYY-MM-DD');
        var daysCount = endDate.diff(startDate, 'days');
        var holidayDays = [];
        if ($('#HolidayDates').val() != "") {
            holidayDays = $('#HolidayDates').val().split(',');
        }
        clearDates();

        for (var dayCounter = 0; dayCounter < daysCount; dayCounter++) {
            var momentDay = moment($('#BeginDateOfCalendar').val(), 'YYYY-MM-DD').add(dayCounter, 'days')

            //http://momentjs.com/docs/#/displaying/format/
            if ($.inArray(moment(momentDay).format('YYYY-MM-DD'), holidayDays) == -1) {
                DateOptions[moment(momentDay).format('YYYY-MM-DD')] = moment(momentDay).format('LL');
            }
        }
        $.each(DateOptions, function (value, key) {
            $dr.append($("<option></option>").attr("value", value).text(key));
        });
    }

    function getServiceType() {
        $.GWUtils.ajaxCall({
            url: '/Contact/GetServiceType',
            data: { branchId: branchId },
            context: $('#ServType')
        }, selectListCallback);
    }

    function getVehicleModels() {
        $.GWUtils.ajaxCall({
            url: '/Vehicles/GetVehicleModels',
            data: { branchId: branchId, vehicleMake: $('#VehMake').val() },
            context: $('#VehModel')
        }, getVehicleModelsCallback);
    }

    function getVehicleVariants() {
        $.GWUtils.ajaxCall({
            url: '/Vehicles/GetVehicleVariants',
            data: { branchId: branchId, vehicleMake: $('#VehMake').val(), vehicleModel: $('#VehModel').val() },
            context: $('#VehVariant')
        }, getVehicleVariantsCallback);
    }

    function getCalendarDays() {
        if (departmentType > 0) {
            $.GWUtils.ajaxCall({
                url: '/Contact/GetCalendarDays',
                data: { branchId: branchId, departmentType: departmentType },
                context: $('#DateRequest')
            }, getCalendarDaysCallback);
        }
    }

    function getDepartments() {
        $.GWUtils.ajaxCall({
            url: '/Contact/GetDepartments',
            data: { branchId: branchId },
            context: $('#DepartmentType')
        }, getDepartmentsCallback);
    }

    function getTimeSlot($target) {
        var deptType = $('#hdfDepartmentType').val().split("_")[0];
        var dateSelected = $target.val();

        $.GWUtils.ajaxCall({
            url: '/Contact/GetTimeSlot',
            data: { branchId: branchId, departmentType: deptType, dateSelected: dateSelected },
            context: $('#TimeSlot')
        }, selectListCallback);
    }

    function getVehicleModelsCallback(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                loadSelectList(data, $(targetElement));
                $("#VehModel").val(autoFillData["Model"]);
                getVehicleVariants();
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            });
    }

    function getVehicleVariantsCallback(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                loadSelectList(data, $(targetElement));

                var hasVariants = false;

                $('#VehVariant option').each(function () {
                    if ($(this).val() !== "") {
                        hasVariants = true;
                    }
                });

                if (!hasVariants) {
                    $("#VehVariant").hide();
                }
                else {
                    $("#VehVariant").show();
                    $("#VehVariant").val(decodeURIComponent(autoFillData["Variant"]));
                }
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            });
    }

    function selectListCallback(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                loadSelectList(data, $(targetElement));
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            });
    }

    function getCalendarDaysCallback(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                $(targetElement).find('option:gt(0)').remove();
                $.each(data, function (index, itemData) {
                    var option = document.createElement('option');
                    option.value = itemData.Value;
                    option.innerHTML = itemData.Text;
                    $(targetElement).append(option);
                });
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            });
    }

    function getDepartmentsCallback(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                $(targetElement).find('option:gt(0)').remove();
                $.each(data, function (index, itemData) {
                    var option = document.createElement('option');
                    option.value = itemData.DepartmentType;
                    option.innerHTML = itemData.DepartmentName;
                    option.setAttribute('data-isbookable', itemData.ApptsEnabled);
                    $(targetElement).append(option);
                });

                var currentDepartment = Cookies.getJSON('PageData').Department;
                if (currentDepartment != null && $(targetElement).find('option[value="' + currentDepartment + '"]').length > 0) {
                    $(targetElement).val(currentDepartment);
                    delete autoFillData.Department
                    Cookies.set('PageData', autoFillData, { appendValues: false, expires: 1 });
                }
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            });
    }

    function submitContactFormCallback(ajaxResponse, conTxt) {
        ajaxResponse
            .done(function (data) {
                var message = convertAjaxResultToHtml(data);
                if (data.Success) {
                    $('#ContactForm').fadeOut('fast');
                    $('#ContactResponse div').html(message[0]);
                    $('#ContactResponse').show('slow');
                    $('#CtaSubmissionScript').html(message[1]);
                    $('#GAEventScript').html(message[2]);

                    window.setTimeout(function () {
                        window.location.href = getGoBackUrl('GoBackUrlFooter');
                    }, 8000);

                } else {
                    $('#ContactResponseFail').html(message[0]).show('fast');
                    //re-enable submit button
                    $(conTxt.subBtn).prop('disabled', false);
                    $(conTxt.subBtn).removeClass('disabled');
                }
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
                //re-enable submit button
                $(conTxt.subBtn).prop('disabled', false);
                $(conTxt.subBtn).removeClass('disabled');
            });
    }
})(jQuery);;
(function () {

    function clearAllContent() {
        var linkedSite = $('.linkedSite');
        $('ul', linkedSite).removeClass('displayList');
        $('div', linkedSite).removeClass('selectedGrey');

        var financeButton = document.getElementById('financeCalculatorMain');
        if (financeButton) {
            financeButton.childNodes[1].style.display = 'block';
            financeButton.childNodes[3].style.display = 'none';
        }

        var searchButton = document.getElementById('vehicleSearchMain');
        if (searchButton != null) {
            searchButton.childNodes[1].style.display = 'block';
            searchButton.childNodes[3].style.display = 'none';
        }

        var contentPanel = document.getElementById('mainSubContent');
        if (contentPanel) {
            contentPanel.style.webkitTransitionDuration = '0.1';
            contentPanel.style.transitionDuration = '0.1';
            contentPanel.style.top = '-' + contentPanel.offsetHeight + 'px';
        }

        overlayToggle(false, '.overlay1');
    }

    $(document).ready(function () {
        $(document).on('click touch', '.linkedSite', function () {
            if ($(this).hasClass('selectedGrey')) {
                overlayToggle(false, '.overlay3');
            } else {
                overlayToggle(true, '.overlay3');
            }

            $(this).toggleClass('selectedGrey');
            $('ul', this).toggleClass('displayList');
        });

        $('.navigation').on('click', 'div.desktopMenu > button', function (e) {
            $.SmartMenus.hideAll();
        });

        $('.vehicleSearch').click(function () {
            toggleSubHeaderPanel($(this), '/SubHeader/BasicSearch');
        });

        $('#mainSubContent').on('click', '.advancedSearch', function (e) {
            e.preventDefault();
            var content = document.getElementById('mainSubContent');

            $.GWUtils.ajaxCall({
                url: '/SubHeader/AdvancedSearch',
                type: 'POST',
                dataType: 'Html',
                data: SetFiltersFromUrl(),
                context: $('#vehSearchForm div:eq(1)', content)
            }, showAdvancedSearch);

        });

        $('#mainSubContent').on('click', '.resetSearch', function (e) {
            e.preventDefault();
            var content = $('#mainSubContent');
            resetVehAdvancedFrm($('#vehSearchForm', content));
            normalizeConditionButtons(content);
            $('#advSearchOptionButtons [type="submit"]').click();
        });

        $('#mainSubContent').on('change', ':checkbox', function (e) {
            var content = $('#mainSubContent');
            vehSearchSubmitForm(content.first(), $('#vehSearchForm div:eq( 1 ) > div').length <= 4);
        });

        $('#mainSubContent').on('change', 'select', function (e) {
            var content = $('#mainSubContent');
            vehSearchSubmitForm(content.first(), $('#vehSearchForm div:eq( 1 ) > div').length <= 4);
        });

        $('#mainSubContent').on('change', 'input[type=radio][data-unitswitch="1"]', function (e) {
            var content = document.getElementById('mainSubContent').firstElementChild;
            switchUnit(this, content);
            executeAdvancedSearchCount(content);
        });

        var sliderDebounceTimer = null;
        $('#mainSubContent').on('change', '.slider', function (e) {
            window.clearTimeout(sliderDebounceTimer);
            sliderDebounceTimer = window.setTimeout(function () {
                var content = document.getElementById('mainSubContent').firstElementChild;
                vehSearchSubmitForm(content, $('#vehSearchForm div:eq( 1 ) > div').length <= 4);
            }, 300);
        });

        function toggleSubHeaderPanel($button, url) {
            var content = document.getElementById('mainSubContent');

            if ($button.hasClass('quickActionButton--opened')) {
                closeSubMenuContent($button, content);
            } else {
                $button.addClass('quickActionButton--opened');
                openSubMenuContent(content, url);
            }
        }

        function openSubMenuContent(panel, url) {
            $.GWUtils.ajaxCall({
                url: url,
                type: 'POST',
                dataType: 'Html',
                data: SetFiltersFromUrl(),
                context: panel
            }, openContent);
        }

        function openContent(ajaxResponse, context) {
            ajaxResponse
                .done(function (data) {
                    $(context).html(data);
                    $(context).slideDown(200);
                    overlayToggle(true, '.overlay1');

                    $(".multiSelect").select2().maximizeSelect2Height();

                    $('.multiSelect').each(function (item, value) {

                        if ($(this).find("option:selected").length == 0) {
                            $(this).val(null);
                        }
                    });

                    $(".multiSelect").trigger('change.select2');
                    registerVehicleSearchEventHandlers();
                    registerVehicleBasicSearchEventHandlers();

                    normalizeConditionButtons(context);

                    executeBasicSearchCount($('#vehSearchForm'));

                    if ($('#subMenuContentAdvanced', context).length > 0) {
                        vehSearchSubmitForm($(context).first(), $('#vehSearchForm div:eq( 1 ) > div').length <= 4);
                    }

                })
                .fail(function (errorData) {
                    $.GWUtils.logError(errorData);
                });
        }

        function registerVehicleBasicSearchEventHandlers() {
            registerDefaultMultiSelectBehaviours($("#Category", "#vehSearchForm"), $("#vehSearchForm #Category option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_MakeName", "#vehSearchForm"), $("#vehSearchForm #Filters_MakeName option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_ModelName", "#vehSearchForm"), $("#vehSearchForm #Filters_ModelName option[value='']"));
        }

        function registerVehicleSearchEventHandlers() {
            $("#basicSearch").on('click touch', '.select2-selection__choice', function () {
                $(this).children('.select2-selection__choice__remove').click()
            });
        }

        function registerVehicleAdvancedSearchEventHandlers() {
            registerDefaultMultiSelectBehaviours($("#Filters_BodyStyles", "#vehSearchForm"), $("#vehSearchForm #Filters_BodyStyles option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_FuelTypeName", "#vehSearchForm"), $("#vehSearchForm #Filters_FuelTypeName option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_LocationTown", "#vehSearchForm"), $("#vehSearchForm #Filters_LocationTown option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_TransmissionTypeName", "#vehSearchForm"), $("#vehSearchForm #Filters_TransmissionTypeName option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_Co2Emissions", "#vehSearchForm"), $("#vehSearchForm #Filters_Co2Emissions option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_BodyColour", "#vehSearchForm"), $("#vehSearchForm #Filters_BodyColour option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_NumDoors", "#vehSearchForm"), $("#vehSearchForm #Filters_NumDoors option[value='']"));
        }

        function registerDefaultMultiSelectBehaviours(searchField, defaultOption) {
            searchField.on("select2:select", function (e) {
                if (e.params.data.id == "") {
                    searchField.select2('val', [""]);
                } else {
                    defaultOption.prop("selected", false);
                }
            });

            searchField.on("select2:unselect", function (e) {
                if (searchField.val() == null) {
                    searchField.select2('val', [""]);
                }
            });

            searchField.on('select2:unselecting', function () {
                $(this).data('unselecting', true);
            }).on('select2:opening', function (e) {
                if ($(this).data('unselecting')) {
                    $(this).removeData('unselecting');
                    e.preventDefault();
                }
            });
        }

        function normalizeConditionButtons(context) {
            //If neither condition button is checked, then the behaviour is the same as if both were checked.
            //The Business would like the second behaviour reflected in the UI
            if ($('#IncludeNewVehicles', context)[0] !== undefined && $('#IncludeUsedVehicles', context)[0] !== undefined) {
                if (!$('#IncludeNewVehicles', context)[0].checked && !$('#IncludeUsedVehicles', context)[0].checked) {
                    $('#IncludeNewVehicles', context)[0].checked = true;
                    $('#IncludeUsedVehicles', context)[0].checked = true;
                }
            }
        }

        function showAdvancedSearch(ajaxResponse, context) {
            ajaxResponse
                .done(function (data) {
                    var content = $('#mainSubContent');
                    content.slideUp(200, function () {
                        context.append(data);

                        $(".multiSelectAdvanced").select2().maximizeSelect2Height();

                        $('.multiSelectAdvanced').each(function (item, value) {
                            if ($(this).find("option:selected").length == 0) {
                                $(this).val(null);
                            }
                        });

                        $(".multiSelectAdvanced").trigger('change.select2');

                        registerVehicleAdvancedSearchEventHandlers();

                        content.slideDown(300, function () {
                            $('.advancedSearch', content).hide();
                            $('.resetSearch', content).show();

                            var sliders = $('.slider', context);
                            $.each(sliders, function () {
                                if (this.name == 'Filters.Price') {
                                    convertToRangeSlider(this, function (val) {
                                        return marketCurrencySymbol + val[0] + ' — ' + val[1];
                                    });
                                } else {
                                    convertToRangeSlider(this, function (val) {
                                        return val[0] + ' — ' + val[1];
                                    });
                                }
                            });
                            vehSearchSubmitForm(content.first(), context.html == '');
                        });
                    });
                })
                .fail(function (errorData) {
                    $.GWUtils.logError(errorData);
                });
        }

        function closeSubMenuContent($button, panel) {
            $(panel).slideUp(300, function () {
                $button.removeClass('quickActionButton--opened');
            });

            overlayToggle(false, '.overlay1');
          
            $('#mainSubContent form').remove(); //Needed as causes conflicts with refine otherwise
        }
    });
}());;
function clearAllContentSticky() {
    closeLinkedSite($('.linkedSite', $stickyNavigation));

    var searchButton = document.getElementById('searchVehicle');
    if (searchButton != null) {
        searchButton.childNodes[1].style.display = 'block';
        searchButton.childNodes[3].style.display = 'none';
    }

    var contentPanel = document.getElementById('subMenuContent');
    if (contentPanel) {
        $('#subMenuContentAdvanced', contentPanel).html("");
        contentPanel.style.webkitTransitionDuration = '0.1';
        contentPanel.style.transitionDuration = '0.1';
        contentPanel.style.top = '-' + contentPanel.offsetHeight + 'px';
        overlayToggle(false, '.overlay2');
    }
}

(function () {
    $(document).ready(function () {

        $('#SmartMaxiSticky').click(function () {
            clearAllContentSticky();
        });

        if ($('#menuCopy').length > 0) {
            var $stickyMobile = $('#menuCopy');

            setSmartMenu($stickyMobile);
        }

        $('#searchVehicle').click(function () {
            var content = document.getElementById('subMenuContent');
            var searchButton = document.getElementById('searchVehicle');

            if (searchButton.childNodes[1].style.display == 'none') {
                closeSubMenuContent(searchButton, content);
            } else {
                clearAllContentSticky();
                openSubMenuContent(searchButton, content, '/SubHeader/BasicSearch');
            }
        });

        $('#subMenuContent').on('click', '.advancedSearch', function (e) {
            e.preventDefault();
            var content = document.getElementById('subMenuContent');

            $.GWUtils.ajaxCall({
                url: '/SubHeader/AdvancedSearch',
                type: 'Get',
                dataType: 'Html',
                data: SetFiltersFromUrl(),
                context: $('#vehSearchForm div:eq(1)', content)
            }, showAdvancedSearch);

        });

        $('#subMenuContent').on('click', '.resetSearch', function (e) {
            e.preventDefault();
            var content = document.getElementById('subMenuContent');
            resetVehAdvancedFrm($('#vehSearchForm', content));
            executeAdvancedSearchCount(content.firstElementChild);
        });

        $('#subMenuContent').on('change', ':checkbox', function (e) {
            var content = document.getElementById('subMenuContent');
            vehSearchSubmitForm(content.firstElementChild, $('#subMenuContentAdvanced', content).html() == '');
        });

        $('#subMenuContent').on('change', 'select', function (e) {
            var content = document.getElementById('subMenuContent');
            vehSearchSubmitForm(content.firstElementChild, $('#subMenuContentAdvanced', content).html() == '');
        });

        $('#subMenuContent').on('change', 'input[type=radio][data-unitswitch="1"]', function (e) {
            var content = document.getElementById('subMenuContent').firstElementChild;
            switchUnit(this, content);
            executeAdvancedSearchCount(content);
        });

        var sliderDebounceTimer = null;
        $('#subMenuContent').on('change', '.slider', function (e) {
            window.clearTimeout(sliderDebounceTimer);
            sliderDebounceTimer = window.setTimeout(function () {
                var content = document.getElementById('subMenuContent').firstElementChild;
                vehSearchSubmitForm(content, $('#subMenuContentAdvanced', content).html() == '');
            }, 300);
        });

        function openSubMenuContent(buttons, panel, url) {
            buttons.childNodes[1].style.display = 'none';
            buttons.childNodes[3].style.display = 'block';

            $.GWUtils.ajaxCall({
                url: url,
                type: 'Get',
                dataType: 'Html',
                data: SetFiltersFromUrl(),
                context: panel
            }, openContent);

        }

        function openContent(ajaxResponse, context) {
            ajaxResponse
                       .done(function (data) {
                           context.style.webkitTransitionDuration = '1';
                           context.style.transitionDuration = '1';
                           setTimeout(function () {
                               $(context).html(data);
                               context.style.top = '50px';
                               overlayToggle(true, '.overlay2');
                               
                               $(".multiSelect").select2().maximizeSelect2Height();

                               $('.multiSelect').each(function (item, value) {
                                   if ($(this).find("option:selected").length == 0) {
                                       $(this).val(null);
                                   }
                               });

                               $(".multiSelect").trigger('change.select2');

                               registerVehicleSearchEventHandlers();
                               registerVehicleBasicSearchEventHandlers();

                               normalizeConditionButtons(context);

                               //executeBasicSearchCount($('#vehSearchForm'));

                               //if ($('#subMenuContentAdvanced', context).length > 0) {
                                   vehSearchSubmitForm($(context).first(), $('#vehSearchForm div:eq( 1 ) > div').length <= 4);
                               //}
                           }, 450);
                       })
                       .fail(function (errorData) {
                           $.GWUtils.logError(errorData);
                       });
        }

        function registerVehicleBasicSearchEventHandlers() {
            registerDefaultMultiSelectBehaviours($("#Category", "#vehSearchForm"), $("#vehSearchForm #Category option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_MakeName", "#vehSearchForm"), $("#vehSearchForm #Filters_MakeName option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_ModelName", "#vehSearchForm"), $("#vehSearchForm #Filters_ModelName option[value='']"));
        }

        function registerVehicleSearchEventHandlers() {
            $("#basicSearch").on('click touch', '.select2-selection__choice', function () {
                $(this).children('.select2-selection__choice__remove').click()
            });
        }

        function registerVehicleAdvancedSearchEventHandlers() {
            registerDefaultMultiSelectBehaviours($("#Filters_BodyStyles", "#vehSearchForm"), $("#vehSearchForm #Filters_BodyStyles option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_FuelTypeName", "#vehSearchForm"), $("#vehSearchForm #Filters_FuelTypeName option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_LocationTown", "#vehSearchForm"), $("#vehSearchForm #Filters_LocationTown option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_TransmissionTypeName", "#vehSearchForm"), $("#vehSearchForm #Filters_TransmissionTypeName option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_Co2Emissions", "#vehSearchForm"), $("#vehSearchForm #Filters_Co2Emissions option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_BodyColour", "#vehSearchForm"), $("#vehSearchForm #Filters_BodyColour option[value='']"));
            registerDefaultMultiSelectBehaviours($("#Filters_NumDoors", "#vehSearchForm"), $("#vehSearchForm #Filters_NumDoors option[value='']"));
        }

        function registerDefaultMultiSelectBehaviours(searchField, defaultOption) {
            searchField.on("select2:select", function (e) {
                if (e.params.data.id == "") {
                    searchField.select2('val', [""]);
                } else {
                    defaultOption.prop("selected", false);
                }
            });

            searchField.on("select2:unselect", function (e) {
                if (searchField.val() == null) {
                    searchField.select2('val', [""]);
                }
            });

            searchField.on('select2:unselecting', function () {
                $(this).data('unselecting', true);
            }).on('select2:opening', function (e) {
                if ($(this).data('unselecting')) {
                    $(this).removeData('unselecting');
                    e.preventDefault();
                }
            });
        }

        function normalizeConditionButtons(context) {
            //If neither condition button is checked, then the behaviour is the same as if both were checked.
            //The Business would like the second behaviour reflected in the UI
            if ($('#IncludeNewVehicles', context)[0] !== undefined && $('#IncludeUsedVehicles', context)[0] !== undefined) {
                if (!$('#IncludeNewVehicles', context)[0].checked && !$('#IncludeUsedVehicles', context)[0].checked) {
                    $('#IncludeNewVehicles', context)[0].checked = true;
                    $('#IncludeUsedVehicles', context)[0].checked = true;
                }
            }
        }

        function showAdvancedSearch(ajaxResponse, context) {
            ajaxResponse
                       .done(function (data) {
                           var content = document.getElementById('subMenuContent');
                           content.style.top = '-1000px';
                           setTimeout(function () {
                               $(context).append(data);
                               $('.advancedSearch', content).hide();
                               $('.resetSearch', content).show();

                               $(".multiSelectAdvanced").select2().maximizeSelect2Height();

                               $('.multiSelectAdvanced').each(function (item, value) {
                                   if ($(this).find("option:selected").length == 0) {
                                       $(this).val(null);
                                   }
                               });

                               $(".multiSelectAdvanced").trigger('change.select2');

                               registerVehicleAdvancedSearchEventHandlers();

                               var sliders = $('.slider', context);
                               $.each(sliders, function () {
                                   if (this.name == 'Filters.Price') {
                                       convertToRangeSlider(this, function (val) { return marketCurrencySymbol + val[0] + ' — ' + val[1]; });
                                   } else {
                                       convertToRangeSlider(this, function (val) { return val[0] + ' — ' + val[1]; });
                                   }
                               });
                               vehSearchSubmitForm(content.firstElementChild, context.html == '');
                               content.style.top = '50px';
                           }, 350);

                       })
                       .fail(function (errorData) {
                           $.GWUtils.logError(errorData);
                       });
        }

        function closeSubMenuContent(buttons, panel) {
            $('#subMenuContentAdvanced').html("");
            $('#subMenuContent').html("");
            buttons.childNodes[1].style.display = 'block';
            buttons.childNodes[3].style.display = 'none';
            panel.style.top = '-' + panel.offsetHeight + 'px';
            overlayToggle(false, '.overlay2');
        }
    });
}());;
(function () {
    var openFrmTarg = getURLParamByName('of');

    if (openFrmTarg.length > 0) {
        openFrmTarg = $.trim(openFrmTarg);
    }

    $(document).ready(function () {

        createEventListenersForFormBuilder();

        /* Old Query String ?of= functionality */
        if (openFrmTarg != null && openFrmTarg.length > 0) {
            var temp = openFrmTarg.split('/');
            var dataType;
            var redirectUrl;

            // TODO: Remove as soon as we have no more old contact forms in live.
            if (temp[1] === 'Form') {
                dataType = 'page';
                redirectUrl = '/' + temp[1] + '/' + temp[2];
            } else {
                if (doesFormBuilderFormExistFor(temp[2])) {
                    var formBuilderForm = $('#gw_footerSticky__components [data-eventListener = "' + temp[2] + '"]');
                    dataType = 'page'
                    openFrmTarg = formBuilderForm.data('page');
                    redirectUrl = formBuilderForm.data('page');
                } else {
                    dataType = 'helptype';
                    redirectUrl = '/' + temp[1] + '/0/' + temp[2];
                }
            }

            var frmOption = $('#gw_footerSticky button[data-' + dataType + '="' + openFrmTarg + '"]');

            if (frmOption.length > 0) {
                if (window.innerWidth > 767) {
                    openFooterForm(frmOption);
                } else {
                    window.location.href = redirectUrl;
                }
            }
        }

        $(document).on('click touch', '.ActHelpMeContact', function (e) {
            e.stopPropagation();
            var dataflag = $(this).data("helptypetarget");

            if (dataflag != null && dataflag.length > 0) {
                var prepop = $(this).data("af-prepop");

                if (prepop != null && prepop == 1) {
                    populateAutoFillCtaData($(this).data());
                }
            }

            if (autoFillData.BranchId === undefined) {
                autoFillData.BranchId = $('#gw_footerSticky button[data-helptype="/Contact/' + dataflag + '"]').data("branchid");
            }

            Cookies.set("PageData", autoFillData, { appendValues: false, expires: 1 });
            $.SmartMenus.hideAll();

            if ($('#gw_footerSticky__components button[data-eventlistener]').length > 0) {
                // Trigger handler for new forms
                $(document).trigger(dataflag, null);
            } else {
                // Open standard forms
                if (window.innerWidth > 767) {
                    openFooterForm($('#gw_footerSticky button[data-helptype="/Contact/' + dataflag + '"]'));
                } else {
                    setGoBackUrl('GoBackUrlFooter');
                    window.location.href = '/Contact/0/' + dataflag;
                }
            }
        });

        /* Old Contact Forms */
        $('#gw_footerSticky button.gw_form__openContactForm').on('click touch', function (e) {
            e.stopPropagation();
            e.preventDefault();

            if (window.innerWidth > 767) {

                if ($(this).hasClass("activeHMe")) {
                    closeFooterForm();
                } else {
                    openFooterForm($(this));
                }
            } else {
                if (!$(this).hasClass("activePage")) {
                    if (noContactFormOpen()) {
                        setGoBackUrl('GoBackUrlFooter');
                    }
                    window.location.href = $(this).data("page");
                }
            }
        });

        $('#gw_footerSticky__GoBack button').on('click touch', function (e) {
            window.location.href = getGoBackUrl('GoBackUrlFooter');
        });

        $('#gw_footerSticky__backToTop > .gruxIcon').bind('click touch', function (e) {
            closeFooterForm();
            scrollToHash("");
        });
    });

    function noContactFormOpen() {
        return ($('#ContactForm').length == 0) && ($('#gw_form__contact').length == 0) && ($('#gw_contactForm').length == 0);
    }

    function populateAutoFillCtaData(listOfDataAttributes) {
        if (listOfDataAttributes != null && listOfDataAttributes != undefined) {
            if (listOfDataAttributes["afPagename"] == "Vehicle") {
                populateAutoFillDataInlineVehicleCTAs(listOfDataAttributes);
            }
            else {
                var ref = listOfDataAttributes["afShorttext"] + "( Ref : Id " + listOfDataAttributes["afContentid"] + " - " + listOfDataAttributes["afShareurl"] + " )";
                populateAutoFillDataInlineCTAs(listOfDataAttributes["afPagename"], listOfDataAttributes["afDepttype"], ref);
            }
        }
    }

    function populateAutoFillDataInlineCTAs(page, department, ref) {
        if (page != null && page.length > 0) {
            autoFillData.Page = page;
        }
        if (department > -1) {
            autoFillData.Department = department;
        }
        if (ref != null && ref.length > 0) {
            autoFillData.Reference = ref;
        }
    }

    function populateAutoFillDataInlineVehicleCTAs(listOfDataAttributes) {
        if (listOfDataAttributes != null && listOfDataAttributes != undefined) {
            autoFillData.BranchId = listOfDataAttributes["afBranchid"];
            autoFillData.Department = listOfDataAttributes["afDepttype"];
            autoFillData.Make = listOfDataAttributes["afMake"];
            autoFillData.Model = listOfDataAttributes["afModel"];

            if (listOfDataAttributes["afVariant"] != null && listOfDataAttributes["afVariant"] != undefined && listOfDataAttributes["afVariant"].length > 0) {
                autoFillData.Variant = listOfDataAttributes["afVariant"];
            }

            autoFillData.Reference = listOfDataAttributes["afVehtitle"] + ' ( Ref : ' + listOfDataAttributes["afVehreference"] + ' - Id: ' + listOfDataAttributes["afContentid"] + ' - ' + listOfDataAttributes["afShareurl"] + ' )';
            autoFillData.Page = listOfDataAttributes["afPagename"];
        }
    }

    function createEventListenersForFormBuilder() {
        var formBuilderForms = $('#gw_footerSticky__components [data-eventListener != ""][data-eventListener]');

        $(formBuilderForms).each(function (index, value) {
            $(document).on($(value).attr("data-eventListener"), function (event, data) {
                if (window.innerWidth > 767) {
                    openFooterForm($('#gw_footerSticky button[data-helptype="' + $(value).attr("data-helptype") + '"]'));
                }
                else {
                    event.preventDefault();
                    setGoBackUrl('GoBackUrlFooter');
                    window.location.href = $(value).attr("data-page");
                }
            })
        })
    }

    function doesFormBuilderFormExistFor(formType) {
        return $('#gw_footerSticky__components [data-eventListener = "' + formType + '"]').length;
    }
}());;
(function () {
    var branchRotator = $('#gw_subHeader__contactRotator').glider({ controls: '#gw_subHeader__contactPanel' });
    var slideBranch = branchRotator[0];

    $(document).ready(function () {
        $('#gw_subHeader__contactPanel .glider-control-next').on('click touch', function () {
            LogRotatorClick(true);
        });

        $('#gw_subHeader__contactPanel .glider-control-back').on('click touch', function () {
            LogRotatorClick(true);
        });


        $('.contactDetails__toggleList').on('click touch', function () {
            if ($('#gw_subHeader__contactList').hasClass('open')) {
                slideBranch.stop();
                $.GWUtils.ajaxCall({
                    url: $(this).closest('li').data('url'),
                    type: 'Get',
                    dataType: 'Html',
                    context: $('#gw_subHeader__contactList')
                }, openDepartmetList);
            } else {
                $('#gw_subHeader__contactList').slideUp(300, function () {
                    overlayToggle(false, '#gw_subHeader--overlay');
                    overlayToggle(false, '.overlay1');
                    $('#gw_subHeader__contactList').addClass('open')
                    slideBranch.start();
                });
            }

            $(this).toggleClass('gw-grux-down01');
            $(this).toggleClass('gw-grux-close01');
        });

        $('#gw_subHeader__contactList').on('click touch', '.contactList__department', function () {
            var $this = $(this).parent('li');

            if ($this.hasClass('open')) {
                collapseContactDepartmentForm($this.children('.contactList__formSection'));
            } else {
                $('#gw_subHeader__contactList li.open').each(function () {
                    collapseContactDepartmentForm($(this).children('.contactList__formSection'));
                });

                var contactFormModel = {
                    MarketId: $this.attr('data-marketid'),
                    BranchId: $this.attr('data-branchid'),
                    BranchTelephoneNumber: $this.attr('data-tel'),
                    Email: $this.attr('data-email'),
                    LanguageId: $this.attr('data-langid'),
                    DepartmentType: $this.attr('data-depttype')
                }

                $.GWUtils.ajaxCall({
                    url: '/Contact/Department',
                    dataType: 'Html',
                    data: contactFormModel,
                    context: $this
                }, contactFormCallback);
            }
        });

        $(document).on('submit', '#gw_departmentContactForm', function (e) {
            e.preventDefault();
            $container = $(this);

            //disable submit button on submit
            $subBtn = $container.find('button[type="submit"]');
            $subBtn.prop('disabled', true);

            $.GWUtils.ajaxCall({
                url: '/Contact/Lead',
                type: 'Post',
                data: $container.serialize(),
                context: { targetElement: $container.parent(), subBtn: $subBtn }
            }, contactLeadCallback);

            return false;
        });

        function openDepartmetList(ajaxResponse, context) {
            ajaxResponse
            .done(function (data) {
                context.children('ul').html(data);
                overlayToggle(true, '#gw_subHeader--overlay');
                overlayToggle(true, '.overlay1');
                context.slideDown(300, function () {
                    context.removeClass('open')
                });

                LogRotatorClick(false)

            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            })
        }

        function LogRotatorClick(isArrowClick) {
            $.GWUtils.ajaxCall({
                url: '/Log/BranchRotatorClick/' + isArrowClick,
                type: 'Post',
                timeout: 5000,
            }, function () { });
        }

        function contactFormCallback(ajaxResponse, context) {
            var $this = $(context);
            ajaxResponse
                .done(function (data) {
                    $this.children('.contactList__formSection').html(data);
                    $this.children('.contactList__formSection').slideDown(function () {
                        $this.addClass('open');
                    });
                })
                .fail(function (errorData) {
                    $.GWUtils.logError(errorData);
                }
            );
        }

        function collapseContactDepartmentForm(contactForm) {
            contactForm.slideUp();
            contactForm.html('');
            contactForm.parent('li').removeClass('open');
        }

        function contactLeadCallback(ajaxResponse, conTxt) {
            ajaxResponse
                .done(function (data) {
                    var message = convertAjaxResultToHtml(data);

                    if (data.Success) {
                        $('#gw_departmentContactForm').fadeOut('fast');
                        $('#gw_departmentContactForm__successResponse').html(message[0]).show('slow');
                        $('#CtaSubmissionScript').html(message[1]);
                        $('#GAEventScript').html(message[2]);
                    } else {
                        $('#gw_departmentContactForm__failedResponse').html(message[0]).show('fast');
                        //re-enable submit button
                        $(conTxt.subBtn).prop('disabled', false);
                    }
                })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
                //re-enable submit button
                $(conTxt.subBtn).prop('disabled', false);
            });
        }
    });
}());;
(function ($) {
    var map, mapCenter, platform, behaviour, markers;
    var DEFAULT_LATITUDE = 51.585516;
    var DEFAULT_LONGITUDE = 0;
    var LAT_LONG_SET_ZOOM = 12;
    var DEFAULT_ZOOM = 5;

    $.fn.initialiseMap = function (appId, appCode, isoLanguageCode) {
        // Initialize the platform object:
        platform = new H.service.Platform({
            'app_id': appId,
            'app_code': appCode
        });

        platform.setUseHTTPS(true);
        addResizeHandler();
        createMap(isoLanguageCode);
        addBranchMarkersToMaps();
    };

    $(document).on('click touch', 'a[data-mapdirections="1"]', function () {
        findGeoLocation($(this), this.getAttribute('data-location'));
    });

    function isMobileDevice() {
        return $('#gw_location__map').height() == 350;
    }

    function findGeoLocation($element, coordinates) {
        var dealerPos = setPosition(coordinates);
        var pos = null;
        var geoResult = false;
        returnVal = handleDirections(geoResult, pos, dealerPos);
        return returnVal;
    }

    function handleDirections(result, position, target) {
        //TODO: Confirm if we need localised url's for Google and/or if we store this centrally in DB
        var redirPath = 'https://maps.google.com/?';
        var iosMobile = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
        //var isAndroid = /Android/i.test(navigator.userAgent);

        if (iosMobile === true) {
            redirPath = 'http://maps.apple.com/?';
        }

        if (target) {
            if (result && position) {
                redirPath += "&";
            }
            redirPath += "daddr=" + target.lat + ',' + target.lng;
        }

        return redirPath;
    }

    function createMap(isoLanguageCode) {
        // Obtain the default map types from the platform object
        var maptypes = platform.createDefaultLayers(
            {
                lg: getMarcCodeFromIsoLanguageCode(isoLanguageCode)
            });

        // Instantiate (and display) a map object:
        var latitude = branchMarkers[0][1] ? branchMarkers[0][1] : DEFAULT_LATITUDE;
        var longitude = branchMarkers[0][2] ? branchMarkers[0][2] : DEFAULT_LONGITUDE;

        map = new H.Map(
            document.getElementById('gw_location__map'),
            maptypes.normal.map,
            {
                zoom: longitude == DEFAULT_LONGITUDE && latitude == DEFAULT_LATITUDE ? DEFAULT_ZOOM : LAT_LONG_SET_ZOOM,
                center: { lng: longitude, lat: latitude }
            }
        );

        addMapUI(map);
        if (isoLanguageCode === "vi") {
            hideSouthChinaSea(map);
        }

    }

    function addMapUI() {
        var ui = H.ui.UI.createDefault(map, platform.createDefaultLayers());
        ui.removeControl('mapsettings');

        if (!isMobileDevice()) {
            var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map));
            behavior.disable(H.mapevents.Behavior.WHEELZOOM);
        }
    }

    function addResizeHandler() {
        window.addEventListener('resize', function () {
            if (isMobileDevice()) {
                resizeMapToFitBranches();
            } else {
                map.getViewPort().resize();
            }
        });
    }

    function addBranchMarkersToMaps() {
        markers = new H.map.Group();

        for (var i = 0; i < branchMarkers.length; i++) {
            markers.addObject(createMarker(branchMarkers[i]));
        }

        markers.addEventListener('tap', function (evt) { window.location.href = '/branchlocation/' + evt.target.getData(); });
        map.addObject(markers);
        resizeMapToFitBranches();
    }

    function resizeMapToFitBranches() {
        if (branchMarkers.length > 1) {
            map.getViewPort().resize();

            setTimeout(function () {
                return map.setViewBounds(markers.getBounds());
            }, 500);
        }
    }

    function createMarker(branchData) {
        var marker;
        if (isMobileDevice()) {
            marker = new H.map.DomMarker({ lat: branchData[1], lng: branchData[2] }, {
                icon: new H.map.DomIcon(markerIconSVG, {
                    onAttach: function (clonedElement, domIcon, domMarker) {
                        clonedElement.addEventListener('touchstart', function () {
                            window.location.href = '/branchlocation/' + domMarker.getData();
                        });
                    }
                })
            });
        } else {
            marker = new H.map.Marker({ lat: branchData[1], lng: branchData[2] }, {
                icon: new H.map.Icon('/Images/GMaps/pushpin_sml.png')
            });
        }

        marker.setData(branchData[3]);
        return marker;
    }

    function getMarcCodeFromIsoLanguageCode(isoLanguageCode) {
        var marcCodeMapping = marcCodeMappings.filter(function (x) { return x.isoLanguageCode === isoLanguageCode })[0];
        return marcCodeMapping == undefined ? 'en' : marcCodeMapping.marcCode;
    }

    function hideSouthChinaSea(map) {
        var boundingBox = new H.geo.Rect(13.01, 112.91, 11.900, 116.00); // South China Sea Rectangle Layer Lat Longs.
        map.addObject(
            new H.map.Rect(boundingBox, {
                style: {
                    fillColor: '#8bc5f8',
                    strokeColor: '#8bc5f8',
                    lineWidth: 0
                }
            })
        );
    }

    var marcCodeMappings = [
        { isoLanguageCode: 'ar', marcCode: 'ara' }, //ME
        { isoLanguageCode: 'cs', marcCode: 'cze' }, //CZ
        { isoLanguageCode: 'it', marcCode: 'ita' }, //IT
        { isoLanguageCode: 'en', marcCode: 'eng' }, //NZ
        { isoLanguageCode: 'fr', marcCode: 'fre' }, //FR
        { isoLanguageCode: 'vi', marcCode: 'vie' }, //VN
        { isoLanguageCode: 'th', marcCode: 'tha' }, //TH
        { isoLanguageCode: 'nl', marcCode: 'dut' }, //NL
        { isoLanguageCode: 'hu', marcCode: 'hun' }, //HU
        { isoLanguageCode: 'nb', marcCode: 'nor' }, //NO
        { isoLanguageCode: 'sv', marcCode: 'swe' }, //SE
        { isoLanguageCode: 'de', marcCode: 'ger' }, //CH
        { isoLanguageCode: 'fi', marcCode: 'fin' }, //FI
        { isoLanguageCode: 'da', marcCode: 'dan' }, //DK
    ];

    var markerIconSVG = '<div style="z-index:2 !important"><svg width="30" height="30" ' +
        'xmlns="http://www.w3.org/2000/svg"  viewBox = "0 0 481.4 595.3" style= "enable-background:new 0 0 481.4 595.3; transform:translate(-15px, -25px)" xml:space="preserve"> ' +
        '<style type="text/css">' +
        '.st0{fill: #8EC043; }.st1{fill: #2475A1; }</style > ' +
        '<path class="st0" d="M241.2,6.8C111.2,6.8,5.8,112.3,5.8,242.3c0,186.8,235.5,346.8,235.5,346.8s235.5-160,235.5-346.8' +
        'C476.7, 112.3, 371.3, 6.8, 241.2, 6.8z M241.2, 381.7c- 77.1, 0 - 139.6 - 62.5 - 139.6 - 139.6c0- 77.1, 62.5 - 139.6, 139.6 - 139.6' +
        's139.6, 62.5, 139.6, 139.6C380.8, 319.2, 318.3, 381.7, 241.2, 381.7z"/>' +
        '<path class="st1" d= "M380.8,242.2c0,77.1-62.5,139.6-139.6,139.6s-139.6-62.5-139.6-139.6c0-77.1,62.5-139.6,139.6-139.6' +
        ' S380.8, 165.1, 380.8, 242.2z"/>' +
        '</svg><div>';
})(jQuery);;
(function ($) {

    $.fn.initialiseContactFormBuilder = function (branchId, departmentId) {
        if (branchId !== 0 || departmentId !== 0) {
            setHelpMeFormDetails($('#gw_form__contact #Branch'));
        }

        setGeronimoSpecialFormFieldTypes();
        raiseFormEvent('FormOpenedEvent');
    };

    var branchId = '';
    var marketId = '';

    var dropdownType = {
        'DepartmentType': 'DepartmentType',
        'VehicleMake': 'VehicleMake',
        'VehicleModel': 'VehicleModel',
        'AppointmentDate': 'AppointmentDate'
    };

    var autofillType = {
        'Make': 'Make',
        'Model': 'Model',
        'Deparment': 'Department',
        'Reason': 'Reason'
    };

    $(document).on('change', '#gw_form__contact #Branch', function () {
        if (resetForm()) {
            clearScreenSelections();
        }

        clearDepartmentListSelection();
        setHelpMeFormDetails($(this), resetForm());
    });

    $(document).on('change', '#gw_form__contact #DepartmentType', function () {
        clearScreenSelections();
        if (dropdownExistsFor(dropdownType.AppointmentDate) === true) {
            loadCalendar($("#gw_form__contact #DepartmentType"));
        }
    });

    $(document).on('change', '#gw_form__contact #VehicleMake', function () {
        getVehicleModels();
    });

    $(document).on('change', '#gw_form__contact #AppointmentDate', function () {
        getTimeSlot($(this));
        $('#gw_form__contact input.calHidden').val($(this).val());
    });

    // TODO: The handlers for form submissions will be done in card 4827 and have been left out in this version of the script
    //       There's a temporary mvc sumbission mechanism in place to get things going etc.

    function resetForm() {
        !(autofillDataExistsFor(autofillType.Make) || autofillDataExistsFor(autofillType.Model));
    }

    function setHelpMeFormDetails(objDropdown, resetSelection) {
        marketId = $('#gw_form__contact #MarketId').val();
        branchId = objDropdown.val();
        resetSelection = resetSelection || true;

        if (dropdownExistsFor(dropdownType.DepartmentType) === true) {
            if (isNumeric(branchId)) {
                getDepartments();
            }
            else {
                $('#gw_form__contact #DepartmentType').find('option:not(:first)').remove();
            }
        }

        if (hiddenExistsFor(dropdownType.DepartmentType) === true && isNumeric(branchId)) {
            setDepartmentBookableAttribute();
        }

        if (dropdownExistsFor(dropdownType.VehicleMake) === true && resetForm) {
            getVehicleMakes();
        }

        if (fieldExistsFor(autofillType.Reason) === true && autoFillData.Reference != undefined) {
            $("#gw_form__contact #" + autofillType.Reason).val(autoFillData.Reference);
        }

        if (isAppointmentRequest() === true) {
            loadCalendar($('#gw_form__contact #DepartmentType'));
        }
        else {
            loadCalendar(objDropdown);
        }
    }

    function setGeronimoSpecialFormFieldTypes() {
        var specialFields = $('#gw_form__contact [data-gw-type]');

        specialFields.each(function () {
            if ($(this).data('gw-type') === 'submission-url') {
                initaliseSubmissionUrlField(this);
            }
        });
    }

    function initaliseSubmissionUrlField(field) {
        var relativePath = document.location.pathname.split('/');

        if (relativePath[1] !== undefined && relativePath[1] === 'Form') {
            $(field).val(getGoBackUrl('GoBackUrlFooter'));
        } else {
            $(field).val(document.location.href);
        }
    }

    function isNumeric(number) {
        return !isNaN(parseFloat(number)) && isFinite(number);
    }

    function getDepartments() {
        $.GWUtils.ajaxCall({
            url: '/Form/GetDepartments',
            data: { branchId: branchId },
            context: $('#gw_form__contact #DepartmentType')
        }, getDepartmentsCallback);
    }

    function getVehicleMakes() {
        var $targetElement = $('#gw_form__contact #VehicleMake');
        if (autofillDataExistsFor(autofillType.Make)) {
            addAutofillItemToDropdown(autofillType.Make, $targetElement);
            $targetElement.find('option:eq(0)').remove();
            getVehicleModels();
        }
        else {
            $.GWUtils.ajaxCall({
                url: '/Vehicles/GetVehicleMakes',
                context: $targetElement
            }, getVehicleMakesCallback);
        }
    }

    function getVehicleModels() {
        var $targetElement = $('#gw_form__contact #VehicleModel');
        if (autofillDataExistsFor(autofillType.Model)) {
            addAutofillItemToDropdown(autofillType.Model, $targetElement);
        }
        else {
            $.GWUtils.ajaxCall({
                url: '/Form/GetVehicleModels',
                data: { vehicleMake: $('#gw_form__contact #VehicleMake').val() },
                context: $targetElement
            }, getVehicleModelsCallback);
        }
    }

    function setDepartmentBookableAttribute() {
        $.GWUtils.ajaxCall({
            url: '/Form/GetDepartments',
            data: { branchId: branchId },
            context: $('#gw_form__contact #DepartmentType')
        }, setDepartmentBookableAttributeCallback);
    }

    function setDepartmentBookableAttributeCallback(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                var targetDepartmentId = targetElement.val();

                if (targetDepartmentId != undefined) {
                    $.each(data, function (index, itemData) {
                        if (itemData.DepartmentType == targetDepartmentId) {
                            targetElement.attr('data-isbookable', itemData.ApptsEnabled);
                            return false;
                        }
                    });
                }

                loadCalendar($('#gw_form__contact #DepartmentType'));
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            });
    }

    function getDepartmentsCallback(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                $(targetElement).find('option:gt(0)').remove();
                $.each(data, function (index, itemData) {
                    var option = document.createElement('option');
                    option.value = itemData.DepartmentType;
                    option.innerHTML = itemData.DepartmentName;
                    option.setAttribute('data-isbookable', itemData.ApptsEnabled);
                    $(targetElement).append(option);
                });

                var currentDepartment = Cookies.getJSON('PageData').Department;
                if (currentDepartment != null && $(targetElement).find('option[value="' + currentDepartment + '"]').length > 0) {
                    $(targetElement).val(currentDepartment);
                    delete autoFillData.Department
                    Cookies.set('PageData', autoFillData, { appendValues: false, expires: 1 });
                }

                autofillScreenField(autofillType.Deparment, $(targetElement));
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            });
    }

    function getVehicleMakesCallback(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                loadSelectList(data, $(targetElement));
                $(targetElement).find('option:eq(0)').remove();
                if (autofillDataExistsFor(autofillType.Make) === true) {
                    autofillScreenField(autofillType.Make, $(targetElement));
                }

                if (dropdownExistsFor(dropdownType.VehicleModel) === true) {
                    getVehicleModels();
                }
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            });
    }

    function getVehicleModelsCallback(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                loadSelectList(data, $(targetElement));
                autofillScreenField(autofillType.Model, $(targetElement));
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            });
    }

    function loadSelectList(data, ctrl) {
        $(ctrl).find('option:gt(0)').remove();
        $.each(data, function (index, itemData) {
            $(ctrl).append($('<option>', {
                value: itemData,
                text: itemData
            }));
        });
    }

    function addAutofillItemToDropdown(autoFillType, ctrl) {
        $(ctrl).find('option:gt(0)').remove();

        var option = document.createElement('option');
        option.value = formatData(autoFillData[autoFillType]);
        option.innerHTML = formatData(autoFillData[autoFillType]);
        $(ctrl).append(option);
        $(ctrl).prop("selectedIndex", 1);
    }

    function autofillScreenField(autoFillType, ctrl) {
        if (autofillDataExistsFor(autoFillType) === true) {
            $(ctrl).val(formatData(autoFillData[autoFillType]));
        }
    }

    function formatData(data) {
        return data.toString().replace('+', ' ');
    }

    function dropdownExistsFor(dropdownType) {
        return $("#gw_form__contact select#" + dropdownType).length > 0;
    }

    function hiddenExistsFor(hiddenId) {
        return $("#gw_form__contact input[type='hidden']#" + hiddenId).length > 0;
    }

    function fieldExistsFor(fieldId) {
        return $("#gw_form__contact #" + fieldId).length > 0;
    }

    function autofillDataExistsFor(autoFillType) {
        var autoFillValue = autoFillData[autoFillType];
        if (autoFillValue !== undefined) {
            if (autoFillValue > 0 || autoFillValue.length > 0) {
                return true;
            }
        }
        return false;
    }

    function clearScreenSelections() {
        var defaultDate = $('#gw_form__contact #DefaultDateOfCalendar').val();
        $('#gw_form__contact #Reason').val('');
        $('#gw_form__contact #VehicleModel').find('option:gt(0)').remove();
        $('#gw_form__contact #BeginDateOfCalendar').val(defaultDate);
        $('#gw_form__contact #EndDateOfCalendar').val(defaultDate);
        $('#gw_form__contact #SelectedDate').val('');
        $('#gw_form__contact #HolidayDates').val('');
        $('#gw_form__contact #AppointmentDate').find('option:gt(0)').remove();
        $('#gw_form__contact #AppointmentTime').find('option:gt(0)').remove();

        if ($("#gw_form__contact input[type='hidden']#DepartmentType") != undefined) {
            $("#gw_form__contact input[type='hidden']#DepartmentType").removeAttr('data-isbookable');
        }
        clearDates();
    }

    function clearDepartmentListSelection() {
        $('#gw_form__contact #DepartmentType').find('option:gt(0)').remove();
    }

    function loadCalendar(objDropdown) {
        if (isBookable(objDropdown) === true) {
            getCalendarDays();
            bookableToggle(true);
        } else {
            clearDates();
            bookableToggle(false);
        }
    }

    function getCalendarDays() {
        var $targetElement = $('#gw_form__contact #DepartmentType');
        if ($targetElement.val() > 0) {
            $.GWUtils.ajaxCall({
                url: '/Form/GetCalendarDays',
                data: { branchId: branchId, departmentType: $targetElement.val() },
                context: $('#gw_form__contact #AppointmentDate')
            }, getCalendarDaysCallback);
        }
    }

    function getCalendarDaysCallback(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                $(targetElement).find('option:gt(0)').remove();
                $.each(data, function (index, itemData) {
                    var option = document.createElement('option');
                    option.value = itemData.Value;
                    option.innerHTML = itemData.Text;
                    $(targetElement).append(option);
                });
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            });
    }

    function getTimeSlot($target) {
        var deptType = $('#gw_form__contact #DepartmentType').val().split("_")[0];
        var dateSelected = $target.val();
        $.GWUtils.ajaxCall({
            url: '/Form/GetTimeSlot',
            data: { branchId: branchId, departmentType: deptType, dateSelected: dateSelected },
            context: $('#gw_form__contact #AppointmentTime')
        }, selectListCallback);
    }

    function selectListCallback(ajaxResponse, targetElement) {
        ajaxResponse
            .done(function (data) {
                loadSelectList(data, $(targetElement));
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            });
    }

    function isBookable(objDropdown) {
        if (objDropdown[0].type === "hidden") {
            return objDropdown.attr('data-isbookable') === "true";
        }
        return objDropdown.children('option:selected').data('isbookable') === "True" || objDropdown.children('option:selected').data('isbookable') === true;
    }

    function bookableToggle(showBookableArea) {
        if (showBookableArea) {
            $('#gw_form__contact #AppointmentDate').show();
            $('#gw_form__contact #AppointmentTime').show();
        } else {
            $('#gw_form__contact #AppointmentDate').hide();
            $('#gw_form__contact #AppointmentTime').hide();
        }
    }

    function clearDates() {
        $('#gw_form__contact #DateRequest option:gt(0)').remove();
    }

    function isAppointmentRequest() {
        return dropdownExistsFor(dropdownType.AppointmentDate) === true
            && isBookable($('#gw_form__contact #DepartmentType')) === true;
    }

    function isMakeAndModeSelected() {
        if ($('#gw_form__contact #VehicleMake').val().length > 0
            && $('#gw_form__contact #VehicleModel').val().length > 0) {
            return true;
        }
        return false;
    }

    function refreshDates() {
        moment.locale(marketId, {});

        var DateOptions = {};
        var $appointmentDate = $('#gw_form__contact #AppointmentDate');
        var $beginDateOfCalendar = $('#gw_form__contact #BeginDateOfCalendar');
        var startDate = moment($beginDateOfCalendar.val(), 'YYYY-MM-DD');
        var endDate = moment($('#gw_form__contact #EndDateOfCalendar').val(), 'YYYY-MM-DD');
        var daysCount = endDate.diff(startDate, 'days');
        var holidayDays = [];
        var $holidayDates = $('#gw_form__contact #HolidayDates');
        if ($holidayDates.val() !== "") {
            holidayDays = $holidayDates.val().split(',');
        }
        clearDates();

        for (var dayCounter = 0; dayCounter < daysCount; dayCounter++) {
            var momentDay = moment($beginDateOfCalendar.val(), 'YYYY-MM-DD').add(dayCounter, 'days');

            //http://momentjs.com/docs/#/displaying/format/
            if ($.inArray(moment(momentDay).format('YYYY-MM-DD'), holidayDays) === -1) {
                DateOptions[moment(momentDay).format('YYYY-MM-DD')] = moment(momentDay).format('LL');
            }
        }
        $.each(DateOptions, function (value, key) {
            $appointmentDate.append($("<option></option>").attr("value", value).text(key));
        });
    }

    $(document).on('submit', '#gw_form__contact', function (e) {
        e.preventDefault();
        $container = $(this);

        $subBtn = $container.find('button[type="submit"]');
        $subBtn.prop('disabled', true);

        $.GWUtils.ajaxCall({
            url: this.action,
            type: 'Post',
            data: GetFields($container[0]),
            context: { targetElement: $container.parent(), subBtn: $subBtn }
        }, leadCallback);

        return false;
    });

    function GetFields($form) {
        var fields = {};

        $('input[type="text"]', $form).each(function () {
            const roboValueKey = 'gw-roboValue';
            if ($(this).prop('name') === roboValueKey) {
                setRoboId(roboValueKey, this);
            }
            fields[this.id] = $(this).val();
        });

        $('input[type="email"]', $form).each(function () {
            fields[this.id] = $(this).val();
        });

        $('input[type="hidden"]', $form).each(function () {
            const roboKey = 'gw-robo';
            if ($(this).prop('name') === roboKey) {
                setRoboId(roboKey, this);
            }
            fields[this.id] = $(this).val();
        });

        $('input[type="radio"]:checked', $form).each(function () {
            fields[this.name] = $(this).val();
        });

        $('input[type="checkbox"]:checked', $form).each(function () {
            fields[this.name] = $(this).val();
        });

        $('select', $form).each(function () {
            fields[this.id] = $(this).val();
        });

        $('textarea', $form).each(function () {
            fields[this.id] = $(this).val();
        });

        return fields;
    }

    function setRoboId(roboKey, element) {
        $(element).prop('id', roboKey);
    }

    function leadCallback(ajaxResponse, context) {
        ajaxResponse
            .done(function (data) {
                var message = convertAjaxResultToHtml(data);

                if (data.Success) {
                    raiseFormEvent('FormSubmittedEvent');
                    $('#gw_form__contact').fadeOut('fast');
                    $('#ContactResponse div').html(message[0]);
                    $('#ContactResponse').show('slow');
                    $('#CtaSubmissionScript').html(message[1]);
                    $('#GAEventScript').html(message[2]);
                } else {
                    $('#ContactResponseFail').html(message[0]).show('fast');
                    $(context.subBtn).prop('disabled', false);
                    $(context.subBtn).removeClass('disabled');
                }
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
                //re-enable submit button
                $(context.subBtn).prop('disabled', false);
            });
    }

    function raiseFormEvent(eventName) {
        var eventData = getFormEventData();
        $(document).trigger(eventName, eventData)
    }

    function getFormEventData() {
        var propertyBagItems = {}
        $('#gw_form__contact [data-includeinevent]:not([data-includeinevent=""])').each(function (key, value) {
            propertyBagItems[$(this).data("includeinevent")] = this.value;
        });

        var formData = {
            formId: $('#gw_form__contact').data('formid'),
            propertyBag: propertyBagItems
        };

        return formData;
    }

    /* Form opening */
    $('.gw_form__openForm').on('click touch', function (e) {
        if (window.innerWidth > 767) {
            e.stopPropagation();
            e.preventDefault();

            if ($('.ActHelpMeContact.VehDetailEmailOrCallMeBack').data('afBranchid') > 0) {
                autoFillData.branchId = $('.ActHelpMeContact.VehDetailEmailOrCallMeBack').data('afBranchid');
            }

            if ($(this).hasClass('activeHMe')) {
                closeFooterForm();
                return false;
            }

            var eventToRaise = $(this).data('eventlistener');

            if (!$(this).hasClass('activeHMe')) {
                $(document).trigger(eventToRaise, null);
            }
        } else {
            setBackUrl();
            return true;
        }
    });

    function setBackUrl() {
        if (noContactFormOpen()) {
            setGoBackUrl('GoBackUrlFooter');
        }
    }

    function noContactFormOpen() {
        return ($('#ContactForm').length == 0) && ($('#gw_form__contact').length == 0) && ($('#gw_contactForm').length == 0);
    }
})(jQuery);;
(function ($) {
    var refinePanel;
    var cookiesHeight;
    var bannerOffset;
    var scrollPosition;
    var resultContentHeight;
    var heightOfRefine;

    $.fn.initialiseStockRefine = function () {

        initalizeSelect2();
        initalizeSliders();

        calculateComponentDimensions();

        registerShowMoreHandler();
        registerVehicleSearchEventHandlers();
        registerRefineResetSearchHandler();
        registerScrollEventToRefine();
        registerWindowResizeEventsHandler();
        registerOpenRefineHandlers();
        registerShowHideRefineHandler();
        
        normalizeConditionButtons();
        executeAdvancedSearchCount("#gw_stockRefine__form");
    };

    function registerScrollEventToRefine() {
        $(document).scroll(function () {
            calculateRefineLayout();
        });
    }

    function registerShowMoreHandler() {
        document.addEventListener('show-more', function () {
            calculateComponentDimensions();
            setRefinePanelFixed();
        });
    }

    function initalizeSliders() {
        var sliders = $('.slider', refinePanel);
        $.each(sliders, function () {
            if (this.name == 'Filters.Price') {
                convertToRangeSlider(this, function (val) {
                    return marketCurrencySymbol + val[0] + ' — ' + val[1];
                });
            } else {
                convertToRangeSlider(this, function (val) {
                    return val[0] + ' — ' + val[1];
                });
            }
        });
    }

    function initalizeSelect2() {
        $(".multiSelect").select2().maximizeSelect2Height();

        $('.multiSelect').each(function (item, value) {
            if ($(this).find("option:selected").length == 0) {
                $(this).val(null);
            }
        });

        $(".multiSelect").trigger('change.select2');
    }

    function registerShowHideRefineHandler() {
        $('#gw_stockRefine').on('click touch', '#gw_stockRefine__showHide__hideRefine', function () {
            closeRefinePanel();
        });

        $('#gw_stockRefine').on('click touch', '#gw_stockRefine__showHide__showRefine', function () {
            openRefinePanel();
        });
    }

    function registerRefineResetSearchHandler() {
        $('#gw_stockRefine__form__actions').on('click', '.resetSearch', function (e) {
            e.preventDefault();

            resetVehAdvancedFrm($('#gw_stockRefine__form'));
            normalizeConditionButtons();

            $("#gw_stockRefine__form__actions [type='submit']").click();
        });
    }

    function registerVehicleSearchEventHandlers() {
        $("#basicSearch").on('click touch', '.select2-selection__choice', function () {
            $(this).children('.select2-selection__choice__remove').click()
        });

        $('#gw_stockRefine__form').on('change', 'select', function (e) {
            var content = $('#gw_stockRefine__form');
            vehSearchSubmitForm(content.first(), false);
        });

        $('#gw_stockRefine__form').on('change', 'input:not(.slider, [type=radio])', function (e) {
            var content = $('#gw_stockRefine__form');
            vehSearchSubmitForm(content.first(), false);
        });

        $('#gw_stockRefine__form').on('change', 'input[type=radio][data-unitswitch="1"]', function (e) {
            var content = document.getElementById('gw_stockRefine__form');
            switchUnit(this, content);
            executeAdvancedSearchCount(content);
        });

        var sliderDebounceTimer = null;
        $('#gw_stockRefine__form').on('change', '.slider', function (e) {
            window.clearTimeout(sliderDebounceTimer);
            sliderDebounceTimer = window.setTimeout(function () {
                var content = $('#gw_stockRefine__form');
                vehSearchSubmitForm(content, false);
            }, 300);
        });

        registerUpdateVehicleCountHandler();
        registerVehicleBasicSearchEventHandlers();
        registerVehicleAdvancedSearchEventHandlers();
    }

    function registerVehicleBasicSearchEventHandlers() {
        registerDefaultMultiSelectBehaviours($("#Category", "#gw_stockRefine"), $("#gw_stockRefine #Category option[value='']"));
        registerDefaultMultiSelectBehaviours($("#Filters_MakeName", "#gw_stockRefine"), $("#gw_stockRefine #Filters_MakeName option[value='']"));
        registerDefaultMultiSelectBehaviours($("#Filters_ModelName", "#gw_stockRefine"), $("#gw_stockRefine #Filters_ModelName option[value='']"));
    }

    function registerVehicleAdvancedSearchEventHandlers() {
        registerDefaultMultiSelectBehaviours($("#Filters_BodyStyles", "#gw_stockRefine"), $("#gw_stockRefine #Filters_BodyStyles option[value='']"));
        registerDefaultMultiSelectBehaviours($("#Filters_FuelTypeName", "#gw_stockRefine"), $("#gw_stockRefine #Filters_FuelTypeName option[value='']"));
        registerDefaultMultiSelectBehaviours($("#Filters_LocationTown", "#gw_stockRefine"), $("#gw_stockRefine #Filters_LocationTown option[value='']"));
        registerDefaultMultiSelectBehaviours($("#Filters_TransmissionTypeName", "#gw_stockRefine"), $("#gw_stockRefine #Filters_TransmissionTypeName option[value='']"));
        registerDefaultMultiSelectBehaviours($("#Filters_Co2Emissions", "#gw_stockRefine"), $("#gw_stockRefine #Filters_Co2Emissions option[value='']"));
        registerDefaultMultiSelectBehaviours($("#Filters_BodyColour", "#gw_stockRefine"), $("#gw_stockRefine #Filters_BodyColour option[value='']"));
        registerDefaultMultiSelectBehaviours($("#Filters_NumDoors", "#gw_stockRefine"), $("#gw_stockRefine #Filters_NumDoors option[value='']"));
    }

    function registerDefaultMultiSelectBehaviours(searchField, defaultOption) {
        searchField.on("select2:select", function (e) {
            if (e.params.data.id == "") {
                searchField.select2('val', [""]);
            } else {
                defaultOption.prop("selected", false).trigger("change.select2");
            }
        });

        searchField.on("select2:unselect", function (e) {
            if (searchField.val() == null) {
                searchField.select2('val', [""]);
            }
        });

        searchField.on('select2:unselecting', function () {
            $(this).data('unselecting', true);
        }).on('select2:opening', function (e) {
            if ($(this).data('unselecting')) {
                $(this).removeData('unselecting');
                e.preventDefault();
            }
        });
    }

    function registerWindowResizeEventsHandler() {
        $(window).resize(function () {
            calculateComponentDimensions();

            if (!$('#gw_stockRefine__closeRefine').is(':visible')) {
                enableSiteScroll();
                showSiteHeaders();
                $('#gw_stockRefine').css('display', '')
            }
        });
    }

    function registerOpenRefineHandlers() {
        $('.TitleWrap').on('click', '#OpenRefine', function (e) {
            disableSiteScroll();
            hideSiteHeaders();
            $('#gw_stockRefine').css('display', 'block');
        });

        $('#gw_stockRefine__closeRefine').on('click', function (e) {
            $('#gw_stockRefine').css('display', 'none');
            enableSiteScroll();
            showSiteHeaders();
        });
    }

    function registerUpdateVehicleCountHandler() {
        $(document).on("change.StockVehicleCount", function (e) {
            $('#gw_stockRefine__form__actions__results__count').html(e.vehicleCount);
        });
    }

    function showSiteHeaders() {
        $('header').css('display', '');
        $('.cntPad').css({ 'top': '', 'position': '' });
        $('#gw_subHeader').css({ 'top': '', 'position': '' });
    }

    function hideSiteHeaders() {
        $('header').css('display', 'none');
        $('.cntPad').css({ 'top': '-500px', 'position': 'absolute' });
        $('#gw_subHeader').css({ 'top': '-500px', 'position': 'absolute' });
    }

    function enableSiteScroll() {
        $('body').css('position', 'initial');
    }

    function disableSiteScroll() {
        $('body').css('position', 'fixed');
    }

    function closeRefinePanel() {
        var isRTL = $('html[dir="rtl"]').length == 1;

        Cookies.set("RefineClosed", true, { appendValues: false });

        //TODO: Remove once stock list toggle is removed.
        $('.ResultContent').removeClass("fullPage");

        $('.stockListResults').removeClass("fullPage");
        $('.gw_stockList__additionalContent').removeClass('fullPage')

        $('#gw_stockRefine__showHide__hideRefine').hide();
        $('#gw_stockRefine__showHide__showRefine').show();

        $('#gw_stockRefine, .TitleWrap').animate({
            marginRight: (isRTL ? '-=350px' : '0'),
            marginLeft: (isRTL ? '0' : '-=350px')
        }).promise().done(function () {
            $('#gw_stockRefine__form__filters').hide();
            $('#gw_stockRefine__form__actions').css('border-top', '0px');
            calculateComponentDimensions();
        });
    }

    function openRefinePanel() {
        var isRTL = $('html[dir="rtl"]').length == 1;

        Cookies.set("RefineClosed", false, { appendValues: false });

        $('#gw_stockRefine__form__filters').show();
        $('#gw_stockRefine__showHide__hideRefine').show();
        $('#gw_stockRefine__showHide__showRefine').hide();

        $('#gw_stockRefine__form__actions').css('border-top', '1px solid #c5c5c5');

        $('#gw_stockRefine, .TitleWrap').animate({
            marginRight: (isRTL ? '+=350px' : '0'),
            marginLeft: (isRTL ? '0' : '+=350px')
        }).promise().done(function () {

            //TODO: Remove once stock list toggle is removed.
            $('.ResultContent').addClass("fullPage");

            $('.stockListResults').addClass("fullPage");
            $('.gw_stockList__additionalContent').addClass('fullPage');
            calculateComponentDimensions();
        });
    }

    function setRefinePanelHeight(stickyHeader) {
        stickyHeader == undefined ? false : true;

        if (!stickyHeader) {
            refinePanel.css("height", "calc((100vh - 190px) - " + cookiesHeight + "px)");
        }
        else {
            refinePanel.css("height", "calc(100vh - 120px)");
        }
    }

    function calculateRefineLayout() {
        scrollPosition = $(document).scrollTop();
        bannerOffset = resultContentHeight - heightOfRefine;

        if (scrollPosition > 160 + cookiesHeight) {
            //scrolling down
            if (scrollPosition > bannerOffset + cookiesHeight) {
                setRefinePanelAbsolute();
            }
            else {
                setRefinePanelFixed();
            }
        }
        else {
            //scrolling up
            setRefinePanelRelative();
        }
    }

    function setRefinePanelFixed() {
        refinePanel.css("position", "fixed");
        refinePanel.css("top", "50px");

        setRefinePanelHeight(true);
    }

    function setRefinePanelRelative() {
        refinePanel.css("position", "relative");
        refinePanel.css("top", "0");

        setRefinePanelHeight();
    }

    function setRefinePanelAbsolute() {
        refinePanel.css("position", "absolute");
        refinePanel.css("top", bannerOffset + "px");
    }

    function calculateComponentDimensions() {
        resultContentHeight = 0;

        //TODO: Remove once stock list feature toggle is completed
        if ($('.ResultContent').length == 1) {
            $('.ResultContent').each(function (i, val) { resultContentHeight += $(val).height(); })
        }

        if ($('.stockListResults').length == 1) {
            $('.stockListResults').each(function (i, val) { resultContentHeight += $(val).height(); })
        }

        refinePanel = $('#gw_stockRefine');
        resultContentHeight += $('.TitleWrap').height();
        heightOfRefine = $('#gw_stockRefine').height();
        cookiesHeight = $('#gw_cookieDirective').height();

        if (cookiesHeight == null) {
            cookiesHeight = 0;
        }

        setRefinePanelHeight();
    }

    function normalizeConditionButtons() {
        //If neither condition button is checked, then the behaviour is the same as if both were checked.
        //The Business would like the second behaviour reflected in the UI

        if ($('#IncludeNewVehicles', '#gw_stockRefine__form')[0] !== undefined && $('#IncludeUsedVehicles', '#gw_stockRefine__form')[0] !== undefined) {
            if (!$('#IncludeNewVehicles', '#gw_stockRefine__form')[0].checked && !$('#IncludeUsedVehicles', '#gw_stockRefine__form')[0].checked) {
                $('#IncludeNewVehicles', '#gw_stockRefine__form')[0].checked = true;
                $('#IncludeUsedVehicles', '#gw_stockRefine__form')[0].checked = true;
            }
        }
    }

})(jQuery);;
(function ($) {

    var numberOfThumbsVisible;
    var totalNumberOfThumbs;
    var totalNumberOfPages;
    var currentPage = 1;
    var isLTR = true;

    $.fn.initialiseGallery = function () {
        isLTR = $('html[dir="rtl"]').length == 0;

        addResizePageHandler();
        calculateThumbPages();
        hideScrollControls();
        addClickHandlersToImages();
    }

    function calculateThumbPages() {
        if ($('#gw_stockDetailsGallery__gallery').css('display') == 'block') {
            numberOfThumbsVisible = Math.floor($('#leadImage').width() / $('.thumb').width());
        }
        else {
            numberOfThumbsVisible = Math.round($('#gw_stockDetailsGallery__gallery__thumbnails__container').width() / $('.thumb').width()) * 3;
        }

        totalNumberOfThumbs = $('#gw_stockDetailsGallery__gallery__thumbnails__container li').length;
        totalNumberOfPages = Math.ceil(totalNumberOfThumbs / numberOfThumbsVisible);
    }

    function addClickHandlersToImages() {
        $('#gw_stockDetailsGallery').on('click', '#gw_stockDetailsGallery__gallery__thumbnails__scroll--Right', function () {
            scrollThumbnailsRight();
        });

        $('#gw_stockDetailsGallery').on('click', '#gw_stockDetailsGallery__gallery__thumbnails__scroll--Left', function () {
            scrollThumbnailsLeft();
        });

        $('#gw_stockDetailsGallery').on('click', '.thumb', function () {
            loadThumbnailIntoMainImage($(this).attr('data-thumbnailNumber'));
        })

        $('#gw_stockDetailsGallery').on('click', '#gw_stockDetailsGallery__gallery__main__navigationOptions--left', function () {
            mainImageNavigateLeft();
        })

        $('#gw_stockDetailsGallery').on('click', '#gw_stockDetailsGallery__gallery__main__navigationOptions--right', function () {
            mainImageNavigateRight();
        })
    }

    function scrollThumbnails(thumbnailNumber) {
        if (isLTR ? isThumbnailOnPreviousPage(thumbnailNumber) : isThumbnailOnNextPage(thumbnailNumber)) {
            scrollThumbnailsLeft();
        }

        if (isLTR ? isThumbnailOnNextPage(thumbnailNumber) : isThumbnailOnPreviousPage(thumbnailNumber)) {
            scrollThumbnailsRight();
        }
    }

    function scrollThumbnailsRight() {
        var container = $('#gw_stockDetailsGallery__gallery__thumbnails__container');
        var animateWidth = $('#gw_stockDetailsGallery__gallery__thumbnails').css('width')

        if (isScrollBeforeEnd()) {
            container.animate({ left: '-=' + animateWidth });
            updateCurrentPageToNextPage();
        }
    }

    function scrollThumbnailsLeft() {
        var container = $('#gw_stockDetailsGallery__gallery__thumbnails__container')
        var animateWidth = $('#gw_stockDetailsGallery__gallery__thumbnails').css('width')

        if (isScrollBeforeStart()) {
            container.animate({ left: '+=' + animateWidth });
            updateCurrentPageToPreviousPage();
        }
    }

    function loadThumbnailIntoMainImage(thumbnailNumber) {
        var thumbnail = getThumbnailFromNumber(thumbnailNumber)

        $('#leadImage').css('background-image', thumbnail.css('background-image'));
        $('#leadImage').attr('data-thumbnailnumber', thumbnail.attr('data-thumbnailnumber'));
        $('#gw_stockDetailsGallery__gallery__main__expand a').attr('href', getUrlFromCssBackgroundProperty(thumbnail.css('background-image')));

        $('.thumb').removeClass('active');
        thumbnail.addClass('active');

        updateMainImagePageCount(thumbnailNumber);
    }

    function hideScrollControls() {
        if (totalNumberOfPages == 1) {
            $('#gw_stockDetailsGallery__gallery__thumbnails__scroll').hide();
            $('#gw_stockDetailsGallery__gallery__thumbnails__container').css('top', '0px');
        }
        else {
            $('#gw_stockDetailsGallery__gallery__thumbnails__scroll').show();
            $('#gw_stockDetailsGallery__gallery__thumbnails__container').css('top', '-' + $('#gw_stockDetailsGallery__gallery__thumbnails__scroll').css('height'));
        }
    }

    function getCurrentMainImageThumbnailNumber() {
        return parseInt($('#leadImage').attr('data-thumbnailnumber'));
    }

    function getThumbnailFromNumber(number) {
        return $('.thumb[data-thumbnailNumber="' + number + '"]');
    }

    function updateMainImagePageCount(thumbnailNumber) {
        $('#gw_stockDetailsGallery__gallery__main__navigationOptions--page').html(thumbnailNumber + '/' + totalNumberOfThumbs);
    }

    function getUrlFromCssBackgroundProperty(cssBackgroundUrl) {
        return cssBackgroundUrl.replace('url(', '').replace(')', '').replace(/\"/gi, "");
    }

    function mainImageNavigateLeft() {
        var currentThumbnailNumber = getCurrentMainImageThumbnailNumber();
        var previousThumbnailNumber = getPreviousThumbnailNumber(currentThumbnailNumber);

        moveToCurrentThumbnailPage(currentThumbnailNumber);

        if (currentThumbnailNumber >= 1) {
            scrollThumbnails(previousThumbnailNumber);
            loadThumbnailIntoMainImage(previousThumbnailNumber);
            updateMainImagePageCount(previousThumbnailNumber);
        }
    }

    function mainImageNavigateRight() {
        var currentThumbnailNumber = getCurrentMainImageThumbnailNumber();
        var nextThumbnailNumber = getNextThumbnailNumber(currentThumbnailNumber);

        moveToCurrentThumbnailPage(currentThumbnailNumber);

        if (currentThumbnailNumber <= totalNumberOfThumbs) {
            scrollThumbnails(nextThumbnailNumber);
            loadThumbnailIntoMainImage(nextThumbnailNumber);
            updateMainImagePageCount(nextThumbnailNumber);
        }
    }

    function moveToCurrentThumbnailPage(currentThumbnailNumber) {
        if (currentThumbnailNumber < currentPage * numberOfThumbsVisible) {
            while (isThumbnailOnPreviousPage(currentThumbnailNumber)) {
                scrollThumbnails(currentThumbnailNumber);
            }
        }

        if (currentThumbnailNumber > currentPage * numberOfThumbsVisible) {
            while (isThumbnailOnNextPage(currentThumbnailNumber)) {
                scrollThumbnails(currentThumbnailNumber);
            }
        }
    }

    function isScrollBeforeStart() {
        return isLTR ? currentPage - 1 >= 1 : currentPage + 1 <= totalNumberOfPages;
    }

    function isScrollBeforeEnd() {
        return isLTR ? currentPage + 1 <= totalNumberOfPages : currentPage - 1 >= 1;
    }

    function isThumbnailOnNextPage(thumbnail) {
        return thumbnail > numberOfThumbsVisible * currentPage
    }

    function isThumbnailOnPreviousPage(thumbnail) {
        return thumbnail <= numberOfThumbsVisible * (currentPage - 1);
    }

    function getNextThumbnailNumber(currentThumbnailNumber) {
        return isLTR ? currentThumbnailNumber + 1 : currentThumbnailNumber - 1;
    }

    function getPreviousThumbnailNumber(currentThumbnailNumber) {
        return isLTR ? currentThumbnailNumber - 1 : currentThumbnailNumber + 1;
    }

    function updateCurrentPageToNextPage() {
        isLTR ? currentPage++ : currentPage--;
    }

    function updateCurrentPageToPreviousPage() {
        isLTR ? currentPage-- : currentPage++;
    }

    function addResizePageHandler() {
        var resizeId;
        $(window).resize(function () {
            clearTimeout(resizeId);
            resizeId = setTimeout(resetGallery(), 500);
        });
    }

    function resetGallery() {
        $('#gw_stockDetailsGallery__gallery__thumbnails__container').css('left', '0px');
        calculateThumbPages();
        currentPage = 1;
        hideScrollControls();
    }
})(jQuery);;
(function ($) {
    // Put promotion related functions here
    var promotionLocationBoxSlider = null;


    //TO DO due to the model being component based we have had to duplicate code for the overlay for both Promotions and News.
    //This may have to be looked at in the future so duplicate will be removed. 
    $.fn.initialisePromotionPage = function () {
        scrollSetup();
    }

    function scrollSetup() {
        var previousScroll = 0;
        var currentScroll = 0;
        var timeout = null;
        var mouseAnimation = $('#gw_singlePromotion__overlayScrollBar__overlayMouse');

        function pageScroll() {          
            $('html, body').animate({
                scrollTop: $(".PromoButtons").offset().top - $("#stickyNavigation:visible").height()
            }, 600);
            return false;
        };;

        $('#gw_singlePromotion__overlayScrollBar').on('click', function () {
            pageScroll();
            previousScroll = $(".PromoButtons").offset().top;
        });

        $(window).on('mousewheel', function (event) {
            currentScroll = $(document).scrollTop().valueOf();
            window.clearTimeout(timeout);
            timeout = window.setTimeout(function () {
                if (mouseAnimation.not(':visible') && currentScroll < previousScroll) {
                    mouseAnimation.show();
                }
                else if (previousScroll == 0 && currentScroll > previousScroll) {
                    mouseAnimation.hide();
                    pageScroll();
                }         
                previousScroll = currentScroll;
            }, 0.2)

        });
    }

    $(document).ready(function () {
        $('.gw_promotionRefine').each(function (i) {
            //force dropdowns to show Filter dept.
            //TODO: Identify reason why dropdown for in view is not setting selected value.
            $(this).find('.gw_promotionRefine__main select[data-dropdown="1"]').val($(this).data('depttype'))
        });

        if (Modernizr.touch) {
            $('#dealProWrap ul li.dPCnt').addClass('touchCnt');
        } else {
            $('#dealProWrap ul li:not(.activeDProm2)').mouseenter(
                function () {
                    $(this).next('.dPCnt').addClass('activeDProm2');
                });
            $('#dealProWrap ul li').mouseleave(function () {
                if ($(this).hasClass('activeDProm2')) {
                    $(this).removeClass('activeDProm2');
                }
            });
        }

        $('.gw_promotionRefine input[data-allflag="1"]').change(function () {
            var thisDept = $(this).data('depttype');
            if ($(this).is(':checked')) {
                $('.gw_promotionRefine input[data-depttype="' + thisDept + '"][data-allflag="0"]').attr('checked', false);
                $('.gw_promotionList li[data-depttype="' + thisDept + '"]').show();
            }
            else {
                $('.gw_promotionList li[data-depttype="' + thisDept + '"]').hide();
            }
            calcAffixPositions();
        })

        $('.gw_promotionRefine input[data-allflag="0"]').change(function () {
            var deptType = $(this).data("depttype");

            if ($(this).is(':checked')) {
                $('.gw_promotionRefine input[data-depttype="' + deptType + '"][data-allflag="1"]').prop('checked', false);
            }

            if ($('.gw_promotionRefine input[data-allflag="0"][data-depttype="' + deptType + '"]:checked').length == 0) {
                $('.gw_promotionRefine input[data-depttype="' + deptType + '"][data-allflag="1"]').prop('checked', true);
                showAllPromotionListItems(deptType);
            }
            else {
                $('.gw_promotionRefine input[data-allflag="0"][data-depttype="' + deptType + '"]').each(function () {
                    var $promotion = $('.gw_promotionList li[data-subcatid="' + this.id + '"]');

                    if ($(this).is(':checked')) {
                        $promotion.show();
                    }
                    else {
                        $promotion.hide();
                    }
                });
            }

            calcAffixPositions();
        });

        function NoOfSubCategorySelected(thisDept) {
            var count = 0;
            $('.gw_promotionRefine input[data-allflag="0"][data-depttype="' + thisDept + '"]:checked').lengh.each(function () {
                if ($(this).is(':checked')) {
                    count = count + 1;
                }
            });
            return count;
        }

        $('.gw_promotionRefine .gw_promotionRefine__main input[data-departmenttitle]').change(function () {
            var thisDept = $(this).data('departmenttitle');
            if ($(this).is(':checked')) {
                $('.gw_promotionRefine .gw_promotionRefine__categories[data-department="' + thisDept + '"]').show();
                $('li[data-depttype="' + thisDept + '"]').show();
            }
            else {
                $('.gw_promotionRefine .gw_promotionRefine__categories[data-department="' + thisDept + '"]').hide();
                $('li[data-depttype="' + thisDept + '"]').hide();
            }
        });

        $('.gw_promotionRefine__main select[data-dropdown="1"]').change(function () {
            if ($(this).val() > 0) {
                scrollToHash('#gw_promotionList__department-' + $(this).val(), $('#gw_promotionRefine_1').parent().height() + 50);
            }
        });

        var Promotion = function () {
            this.current = '0';
            this.previous = '-';
            this.previousScript = '';
            this.currentScript = '';

            return {
                setCurrent: function ($promo, script) {
                    this.previous = this.current;
                    this.current = $promo.attr('data-promoid');
                    this.previousScript = this.currentScript;
                    this.currentScript = script;
                    return this.current;
                },
                isSamePromotion: function () {
                    return this.current === this.previous;
                },
                isSameScript: function () {
                    return this.currentScript === this.previousScript;
                }
            }
        }

        var list = new Promotion();
        var single = new Promotion();

        $(document).on('click touch', '.gw_promotionList__promotion__buttons > div', function (e) {
            e.defaultPrevented;
            e.stopPropagation();
            var displayType = $(this).data("form");
            var promoId = $(this).parent().data("promoid");
            if (displayType !== undefined && (displayType === "Share" || displayType === "ShareSingle" || displayType === "Locations")) {
                if (displayType === "Share") {
                    $('#Share_' + promoId).toggle();
                    $(this).toggleClass('selected');
                } else if (displayType === "ShareSingle") {
                    var pId = $(this).parent().data("promoid");
                    $('#ShareSingle_' + pId).toggle();
                    $(this).toggleClass('selected');
                } else if (displayType === "Locations") {
                    LoadLocations(promoId, $(this));
                }
            }
        });

        function LoadLocations(promoId, $this) {
            if ($this.hasClass('selected')) {
                $('.gw_promotionList__promotion__location[data-pid="' + promoId + '"]').slideUp();
                $this.removeClass('selected');
                return;
            }

            //Hide all existing locations sections
            $('.gw_promotionList__promotion__location').slideUp();
            $('div[data-form="Locations"]').removeClass('selected');

            $.GWUtils.ajaxCall({
                url: '/Promotions/LocationAvailabilityClick',
                data: { promotionId: promoId },
                context: promoId
            }, getBranchLocationsForSelectedPromotion);

            $this.addClass('selected');
        }

        function getBranchLocationsForSelectedPromotion(ajaxResponse, conTxt) {
            ajaxResponse
                .done(function (data) {
                    var $locTarg = $('.gw_promotionList__promotion__location[data-pid="' + conTxt + '"]');
                    var htmlBuffer = "";
                    $.each(data, function (index, element) {
                        htmlBuffer += "<div>" + element + "</div>";
                    });
                    $locTarg.html(htmlBuffer);
                    $locTarg.slideDown();
                })
                .fail(function (errorData) {
                    $.GWUtils.logError(errorData);
                });
        }

        function showAllPromotionListItems(deptId) {
            $('.gw_promotionList li[data-depttype="' + deptId + '"]').show();
        }

        //favourite feature for promotion results page
        $('#gw_promotionList div[data-form="Favourites"]').change(function () {
            setFavoritePromotions($(this));
        })

        //favourite feature for promotion details page
        $('.singlePromotion div[data-form="Favourites"]').change(function () {
            setFavoritePromotions($(this));
        })

        function setFavoritePromotions($this) {
            var checkbox = $this.children("input[name=FavouriteButton]").first();
            var promotionId = checkbox.attr('data-favPromoId');
            var isChecked = checkbox.prop('checked');
            if (isChecked) {
                Cookies.set('FavouritePromotionList', promotionId, { appendValues: true });
            }
            else {
                Cookies.remove('FavouritePromotionList', { removeValFromLst: true, cvalue: promotionId });
            }
        }

        $('.gw_promotionRefine .gw_promotionRefine__main button[data-favouritefordept]').click(function () {
            var favsSelected = false;
            var departmentType = $(this).data('favouritefordept');

            //if removing closebutton class then activate all here
            if ($(this).hasClass('closeButton')) {
                favsSelected = true
                $('ul[data-department="' + departmentType + '"] li.gw_promotionRefine__categories__all input[type="checkbox"]').prop('checked', true);
                showAllPromotionListItems(departmentType);
            }

            $(this).toggleClass('closeButton').promise().done(function () {
                departmentTypeTitle = $('.gw_promotionRefine .gw_promotionRefine__main input[data-departmenttitle = "' + departmentType + '"]');
                departmentTypeTitle.siblings().eq(1).toggleClass('pointerEvent');
                $('.gw_promotionRefine .gw_promotionRefine__main input[data-departmenttitle = "' + departmentType + '"]').addClass('uncheckDeptTitleWhenFavIsSelected');
                subCategoryFilterSelected(departmentType, favsSelected);
                if (!favsSelected) {
                    if (Cookies('FavouritePromotionList') != undefined) {
                        var favPromosForDept = Cookies('FavouritePromotionList').split(",");
                        for (i = 0; i < favPromosForDept.length; i++) {
                            $('.gw_promotionList li[data-depttype="' + departmentType + '"][data-promotionid="' + favPromosForDept[i] + '"]').toggle();
                        }
                    }
                }
            });

            calcAffixPositions();
        })

        $('input[data-ref="1"]').click(function () {
            var deptId = $(this).data("depttype");
            var deptFavourite = $('.gw_promotionRefine .gw_promotionRefine__main button[data-favouritefordept][data-favouritefordept="' + deptId + '"]')
            if (deptFavourite.hasClass('closeButton')) {
                deptFavourite.toggleClass('closeButton');
            }
        });

        function subCategoryFilterSelected(depType, favsSelected) {
            var filterSelected = 0;
            if (!favsSelected) {
                $('.gw_promotionRefine input[data-depttype="' + depType + '"]:checked').each(function () {
                    $(this).prop('checked', false);
                    filterSelected = filterSelected + 1;
                });

                $('.gw_promotionList li[data-depttype="' + depType + '"]').hide();
            }
        }

        if (Cookies('FavouritePromotionList') != undefined) {
            var favPromosForDept = Cookies('FavouritePromotionList').split(",");
            for (i = 0; i < favPromosForDept.length; i++) {
                elem1 = document.getElementById('FavouriteCheck_' + favPromosForDept[i]);
                elem2 = document.getElementById('FavouriteSingleCheck_' + favPromosForDept[i]);
                if (elem1 != null) {
                    elem1.checked = true;
                }
                if (elem2 != null) {
                    elem1.checked = true;
                }
            }
        }

        //Freeze-Scroll feature
        calcAffixPositions();

        function calcAffixPositions() {
            //clear any existing affix's
            $(window).off('.gw_promotionRefine.affix');
            $(".gw_promotionRefine").removeClass('affix affix-top affix-bottom').removeData('bs.affix');

            $('.gw_promotionRefine').each(function (i) {
                filterId = $(this).attr('id');
                var selector = '#' + filterId;
                var winHeight = parseInt($(window).height());

                if ($(selector).length > 0) {
                    var selOffset = parseInt($(selector).offset().top);
                    var selHeight = 0;
                    if (i > 0) {
                        //past first item to affix so take previous items height and use for calc
                        selHeight = $($('.gw_promotionRefine')[i - 1]).height();
                    }
                    var offsetCalc = selOffset - selHeight;

                    $(selector).affix({
                        offset: {
                            top: offsetCalc - 50
                        }
                    })

                    $(selector).on('affixed-top.bs.affix', function () {
                        $(selector).find('.gw_promotionRefine__main select[data-dropdown="1"]').val($(selector).data('depttype'))
                    });

                    $(selector).on('affixed.bs.affix', function () {
                        //set dropdown to current affixed dept section
                        $(selector).find('.gw_promotionRefine__main select[data-dropdown="1"]').val($(selector).data('depttype'))
                    });
                }
            });
        }

        creatingTheDeptTypeList();

        function creatingTheDeptTypeList() {
            $('ul.gw_promotionList li').each(function () {
                var deptType = $(this).data('depttype');
                hideAllUnmappedSubCategoryFilters(deptType);
            });
        }

        function hideAllUnmappedSubCategoryFilters(deptType) {
            var totalCount = $('li[data-depttype="' + deptType + '"].gw_promotionRefine__categories__subcategory').length;
            var hiddenCount = 0;

            $('li[data-depttype="' + deptType + '"].gw_promotionRefine__categories__subcategory').each(function () {
                //TODO replace substring calls
                var subcategoryId = $(this).children('input[data-allflag="0"]').attr('id').split('-')[1];

                //if main promoListItem exists
                if ($('li[data-subcatid="' + deptType + '-' + subcategoryId + '"]').length) {
                    //show filter item
                    $(this).show();

                    //set underlying label for filter to display-inline-block - //TODO check if this is neccessary with li item above being hidden
                    $(this).children('label').css({ 'display': 'inline-block' });
                } else {
                    //hide filter li item to prevent spacing issues on IOS
                    $(this).hide();
                    hiddenCount += 1;
                }
            });

            if (totalCount == hiddenCount) {
                $('li[data-depttype="' + deptType + '"].gw_promotionRefine__categories__all').hide();
            }
            else {
                $('li[data-depttype="' + deptType + '"].gw_promotionRefine__categories__all').show();
            }
        }
    });
}(jQuery));;
(function ($) {

    $.fn.initialiseNewsPage = function () {
        scrollSetup();
    }

    function scrollSetup() {
        var previousScroll = 0;
        var currentScroll = 0;
        var timeout = null;
        var mouseAnimation = $('#gw_singleNewsItem__overlayScrollBar__overlayMouse');

        function pageScroll() {
            $('html, body').animate({
                scrollTop: $(".PromoButtons").offset().top - $("#stickyNavigation:visible").height()
            }, 600);
            return false;
        };;

        $('#gw_singleNewsItem__overlayScrollBar').on('click', function () {
            pageScroll();
            previousScroll = $(".PromoButtons").offset().top;
        });

        $(window).on('mousewheel', function (event) {
            currentScroll = $(document).scrollTop().valueOf();
            window.clearTimeout(timeout);
            timeout = window.setTimeout(function () {
                if (mouseAnimation.not(':visible') && currentScroll < previousScroll) {
                    mouseAnimation.show();
                }
                else if (previousScroll == 0 && currentScroll > previousScroll) {
                    mouseAnimation.hide();
                    pageScroll();
                }
                previousScroll = currentScroll;
            }, 0.2)

        });
    }

    $(document).ready(function () {
        $(document).on('click', 'div.PromoButtons div.forms', function (e) {
            e.defaultPrevented;
            e.stopPropagation();
            var displayType = $(this).data("form");
            var promoId = $(this).parent().data("promoid");
            if (displayType !== undefined && (displayType === "Share" || displayType === "ShareSingle" || displayType === "Locations")) {
                if (displayType === "Share") {
                    $(this).parents('.menuCard').find('.share').toggle();
                } else if (displayType === "ShareSingle") {
                    var pId = $(this).parent().data("promoid");
                    $('#ShareSingle_' + pId).toggle();
                }
                $(this).toggleClass('selected');
            }
        });
    });
}(jQuery));;
(function () {
    $(document).ready(function () {
        var varGlider = $('#varGlide').glider({
            nextIcon: '&gt;',
            backIcon: '&lt;',
            navigationMode: 'stop',
            controls: 'div'
        });

        var productGalleryExt = $('#gw_productGallery_exterior').glider({
            nextIcon: '&gt;',
            backIcon: '&lt;',
            navigationMode: 'stop'
        });

        var productGalleryInt = $('#gw_productGallery_interior').glider({
            nextIcon: '&gt;',
            backIcon: '&lt;',
            navigationMode: 'stop'
        });

        var sliderInterior;
        var sliderExterior;
        lightbox.option({
            'showImageNumberLabel': false,
            'wrapAround': true,
            'resizeDuration': 400
        })

        $('#galleryTabs a').click(function (e) {
            e.preventDefault()
            $(this).tab('show')
        })

        function loadGalllerySliders() {
            if (Modernizr.touch) {
                delete sliderOptions.controls;
            }
        }

        function reloadSlides(targ) {
            if (targ == "int") {
                if (typeof sliderInterior !== 'undefined' && sliderInterior.reloadSlider) {
                    sliderInterior.reloadSlider($.extend(sliderOptions, { startSlide: sliderInterior.getCurrentSlide() }));
                }
            } else if (targ == "ext") {
                if (typeof sliderExterior !== 'undefined' && sliderExterior.reloadSlider) {
                    sliderExterior.reloadSlider($.extend(sliderOptions, { startSlide: sliderExterior.getCurrentSlide() }));
                }
            }
        }

        $window.on('resizeDone', function () {
            reloadSlides("int");
            reloadSlides("ext");
        });

        $('ul#galleryTabs li a').on('shown.bs.tab', function (e) {
            var targTab = $(this).data("slidertarget");
            reloadSlides(targTab);
        })

        var sliderOptions = {
            pager: true,
            infiniteLoop: false,
            captions: false,
            controls: true,
            hideControlOnEnd: true,
            nextText: '<span class="gruxIcon gw-grux-right02"></span>',
            prevText: '<span class="gruxIcon gw-grux-left02"></span>',
            autoHover: true
        }

        loadGalllerySliders();

    })
}());;
(function ($) {

    $.fn.initialiseTopBar = function () {
        setAffixHeights();
        setBackLinkAddress();
    }

    function setAffixHeights() {
        $('section.gw_stockDetailsTopBar__Filters').each(function () {
            $this = $(this);
            if ($this.length > 0) {
                $this.affix({
                    offset: {
                        top: $this.offset().top - 20
                    }
                })
            }
        });
    }
    function setBackLinkAddress() {
        $('#gw_stockDetailsTopBar__goBack').each(function () {
            var previous = Cookies.get('GoBackUrl');

            if (previous == "" || previous == undefined) {
                previous = "/Vehicles/StartSearch";
            }

            $(this).attr('href', previous);

        });
    }

})(jQuery);
(function () {
    $.fn.initialiseBannerStockSearch = function () {
        if ($("#gw_bannerstocksearch").length) {
            $("#gw_banners__controls").css("top", "-110px");
        }
        LoadBannerStockSearch();
    };

    function LoadBannerStockSearch() {
        initalizeSelect2();
        $(".multiSelect").val('').trigger("change"); //This then defaults to 'All Makes' 'All Models'.
        registerVehicleSearchEventHandlers();
        registerOnChangeEventHandlers();
        registerOnClickEventHandlers();
    }

    function registerOnChangeEventHandlers() {
        $(document).on('change', '#basicSearchForm #Filters_MakeName', function () {
            executeBasicSearch(basicSearchForm);
            ShowMakeOverflowedOptions();
          });

        $(document).on('change', '#basicSearchForm #Filters_ModelName', function () {
            executeBasicSearch(basicSearchForm);
        });

        $(document).on('change.select2', '#basicSearchForm #Filters_ModelName', function () {
            ShowModelOverflowedOptions();
        });
    }

    function registerOnClickEventHandlers() {
        $(document).on('click touch', '#gw_bannerstocksearch__openclose', function () {
            executeOpenCloseToggle($(this));
        });
    }

    var overflowSelectedMakeOptions = [
    ];

    function ShowMakeOverflowedOptions() {
        var makeSelect2Id = '#gw_bannerstocksearch__searchoptions__makes';     
        var totalWidth = getSelectedChoicesTotalWidth(makeSelect2Id);
        var totalContainerWidth = getContainerTotalWidth(makeSelect2Id);
        updateOverflowArray(makeSelect2Id, totalContainerWidth, overflowSelectedMakeOptions);
        updateOverflowedOptions(makeSelect2Id, '.make');
    }

    var overflowSelectedModelOptions = [
    ];

    function ShowModelOverflowedOptions() {
        var modelSelect2Id = '#gw_bannerstocksearch__searchoptions__models';
        var totalWidth = getSelectedChoicesTotalWidth(modelSelect2Id);
        var totalContainerWidth = getContainerTotalWidth(modelSelect2Id);
        updateOverflowArray(modelSelect2Id, totalContainerWidth, overflowSelectedModelOptions);
        updateOverflowedOptions(modelSelect2Id, '.model');
    }

    function executeBasicSearch($form) {
        var url = 'Banners/GetBasicSearchModel';
        $.GWUtils.ajaxCall({
            url: url,
            type: 'Post',
            data: BuildModel($form),
            context: $form
        }, BasicvehicleSearchCallback);
    }

    function BuildModel($form) {
        var model;
        model = {
            MakeNames: $('#Filters_MakeName', $form).select2('val'),
            ModelNames: $('#Filters_ModelName', $form).select2('val')
        };
        return model;
    }

    function BasicvehicleSearchCallback(ajaxResponse, context) {
        ajaxResponse
            .done(function (response) {
                $('#SearchCount', context).html(response.Count);
                mapModelsToOptions($('#Filters_MakeName', context)[0], response.Makes, 'Value');
                mapModelsToOptions($('#Filters_ModelName', context)[0], response.Models, 'Value');
                $(".multiSelect").trigger('change.select2');
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            }
            );
    }

    function initalizeSelect2() {
        $(".multiSelect").select2().maximizeSelect2Height();

        $('.multiSelect').each(function (item, value) {
            if ($(this).find("option:selected").length == 0) {
                $(this).val(null);
            }
        });

        $(".multiSelect").trigger('change.select2');
    }

    function registerVehicleSearchEventHandlers() {
        $("#gw_bannerstocksearch__searchcontainer").on('click touch', '.select2-selection__choice', function () {
            $(this).children('.select2-selection__choice__remove').click();
        });

        registerVehicleBasicSearchEventHandlers();
    }

    function registerVehicleBasicSearchEventHandlers() {
        registerDefaultMultiSelectBehaviours($("#Filters_MakeName", "#basicSearchForm"), $("#basicSearchForm #Filters_MakeName option[value='']"));
        registerDefaultMultiSelectBehaviours($("#Filters_ModelName", "#basicSearchForm"), $("#basicSearchForm #Filters_ModelName option[value='']"));
    }

    function registerDefaultMultiSelectBehaviours(searchField, defaultOption) {
        searchField.on("select2:select", function (e) {
            if (e.params.data.id == "") {
                searchField.select2('val', [""]);
            } else {
                defaultOption.prop("selected", false).trigger("change.select2");
            }
        });

        searchField.on("select2:unselect", function (e) {
            if (searchField.val() == null) {
                searchField.select2('val', [""]);
            }
        });

        searchField.on('select2:unselecting', function () {
            $(this).data('unselecting', true);
        }).on('select2:opening', function (e) {
            if ($(this).data('unselecting')) {
                $(this).removeData('unselecting');
                e.preventDefault();
            }
        });
    }

    function getSelectedChoicesTotalWidth(id) {
        var totalWidth = 0;
        $(id + ' li.select2-selection__choice').each(function (index) {
            totalWidth += $(this).outerWidth();
        });

        return totalWidth;
    }

    function updateOverflowArray(id, totalContainerWidth, overflowSelectedOptions) {
        overflowSelectedOptions.length = 0;
        var choiceWidth = 0;
        $(id + ' li.select2-selection__choice').each(function (index, value) {
            choiceWidth += $(this).outerWidth(true);
            if (choiceWidth > totalContainerWidth) {
                overflowSelectedOptions.push(value.title);
            }
        });
    }

    function getContainerTotalWidth(id) {
        return $(id + ' ul.select2-selection__rendered').width();
    }

    function updateOverflowedOptions(id, badgeClassName) {
        var overflowedSelectedOptionsCount = getoverflowSelectedOptionsCount(id);

        if (overflowedSelectedOptionsCount > 0) {
            $(badgeClassName).show();
        }
        else {
            $(badgeClassName).hide();
        }

        $(id + ' #gw_bannerstocksearch__searchoptions__badge__text').text("+" + overflowedSelectedOptionsCount);
    }

    function getoverflowSelectedOptionsCount(id) {
        if (id === "#gw_bannerstocksearch__searchoptions__makes") {
            return overflowSelectedMakeOptions.length;
        }
        if (id === "#gw_bannerstocksearch__searchoptions__models") {
            return overflowSelectedModelOptions.length;
        }
    }

    function executeOpenCloseToggle(element) {
        $(element).toggleClass("gw-grux-down01").toggleClass("gw-grux-up01");
        $("#gw_bannerstocksearch").toggleClass("stocksearchopen");
        if (!window.matchMedia('(max-width: 992px)').matches) {
            $(".glider-circle-icon").toggleClass("stocksearchclose");
        }
    }
})(jQuery);;
(function () {
    var gliderId = 'glider-1';

    $(document).ready(function () {
        AddCarousel();

    });

    function AddCarousel() {
        var bannerRotator = $('#gw_bannerComponentImage__slides').glider({ item: '> li' });

        // As the GliderControlNext should be displayed to the last, it has been appended.
        var $gliderControlNext = $("#gw_bannerComponentImage__slides").find('.glider-control-next');
        $(".glider-control-link").append($gliderControlNext);

        // As the GliderControlBack should be displayed in the first, it has been prepended.
        var $gliderControlBack = $("#gw_bannerComponentImage__slides").find('.glider-control-back');
        $(".glider-control-link").prepend($gliderControlBack);

        if (isTouchDevice()) {
            AddSwipe(bannerRotator);
        }
    }
    
    function isTouchDevice() {
        return !!('ontouchstart' in window);
    }

    function AddSwipe(sliders) {
        var slider = sliders[0];
        $('#gw_bannerComponentImage__slides').swipe({
            swipeLeft: function (event, direction, distance, duration, fingerCount) {
                slider.next();
            },
            swipeRight: function (event, direction, distance, duration, fingerCount) {
                slider.back();
            },
            allowPageScroll: "auto"
        });
    }

})();;
(function () {
    var gliderId = 'glider-1';

    $(document).ready(function () {
        
        $window.on('gliderSlideSelected', function (e, glider, slide) {
            if (glider.id == gliderId) {
                showOverlay(slide);
            }
        });

        $window.on('gliderSlideLeaving', function (e, glider, slide) {
            if (glider.id == gliderId) {
                hideOverlay(slide);
            }
        });
    });

    function hideOverlay(slide) {
        var bannerId = $(slide).data("bannerid");
        $("#gw_bannerComponentText").find('[data-bannerid="' + bannerId + '"]').fadeOut(500);
    }

    function showOverlay(slide) {
        var bannerId = $(slide).data("bannerid");
        $("#gw_bannerComponentText").find('[data-bannerid="' + bannerId + '"]').css({ opacity: 0, display: 'flex' }).animate({
            opacity: 1
        }, 500);
    }
})();;
(function () {
    $.fn.initialiseBannerComponentStockSearch = function () {
        LoadBannerComponentStockSearch();
    };

    function LoadBannerComponentStockSearch() {
        initalizeSelect2();
        $(".multiSelect").val('').trigger("change"); //This then defaults to 'All Makes' 'All Models'.
        registerVehicleSearchEventHandlers();
        registerOnChangeEventHandlers();
        registerOnClickEventHandlers();
    }

    function registerOnChangeEventHandlers() {
        $(document).on('change', '#basicSearchForm #Filters_MakeName', function () {
            executeBasicSearch(basicSearchForm);
            ShowMakeOverflowedOptions();
        });

        $(document).on('change', '#basicSearchForm #Filters_ModelName', function () {
            executeBasicSearch(basicSearchForm);
        });

        $(document).on('change.select2', '#basicSearchForm #Filters_ModelName', function () {
            ShowModelOverflowedOptions();
        });

        $(document).on('select2:open', '#basicSearchForm #Filters_MakeName', function () {
            OpenResultsUp($(this));
        });

        $(document).on('select2:open', '#basicSearchForm #Filters_ModelName', function () {
            OpenResultsUp($(this));
        });
    }

    function registerOnClickEventHandlers() {
        $(document).on('click touch', '#gw_bannercomponentstocksearch__openclose', function () {
            executeOpenCloseToggle($(this));
        });
    }

    var overflowSelectedMakeOptions = [
    ];

    function ShowMakeOverflowedOptions() {
        var makeSelect2Id = '#gw_bannercomponentstocksearch__searchoptions__makes';
        var totalWidth = getSelectedChoicesTotalWidth(makeSelect2Id);
        var totalContainerWidth = getContainerTotalWidth(makeSelect2Id);
        var defaultMakeOption = $('#Filters_MakeName option:first').text();
        updateOverflowArray(makeSelect2Id, totalContainerWidth, overflowSelectedMakeOptions, defaultMakeOption);
        updateOverflowedOptions(makeSelect2Id, '.make');
    }

    var overflowSelectedModelOptions = [
    ];

    function ShowModelOverflowedOptions() {
        var modelSelect2Id = '#gw_bannercomponentstocksearch__searchoptions__models';
        var totalWidth = getSelectedChoicesTotalWidth(modelSelect2Id);
        var totalContainerWidth = getContainerTotalWidth(modelSelect2Id);
        var defaultModelOption = $('#Filters_ModelName option:first').text();
        updateOverflowArray(modelSelect2Id, totalContainerWidth, overflowSelectedModelOptions, defaultModelOption);
        updateOverflowedOptions(modelSelect2Id, '.model');
    }

    function executeBasicSearch($form) {
        var url = 'Banners/GetBasicSearchModel';
        $.GWUtils.ajaxCall({
            url: url,
            type: 'Post',
            data: BuildModel($form),
            context: $form
        }, BasicvehicleSearchCallback);
    }

    function BuildModel($form) {
        var model;
        model = {
            MakeNames: $('#Filters_MakeName', $form).select2('val'),
            ModelNames: $('#Filters_ModelName', $form).select2('val')
        };
        return model;
    }

    function BasicvehicleSearchCallback(ajaxResponse, context) {
        ajaxResponse
            .done(function (response) {
                $('#SearchCount', context).html(response.Count);
                mapModelsToOptions($('#Filters_MakeName', context)[0], response.Makes, 'Value');
                mapModelsToOptions($('#Filters_ModelName', context)[0], response.Models, 'Value');
                $(".multiSelect").trigger('change.select2');
            })
            .fail(function (errorData) {
                $.GWUtils.logError(errorData);
            }
            );
    }

    function initalizeSelect2() {
        $(".multiSelect").select2().maximizeSelect2Height();

        $('.multiSelect').each(function (item, value) {
            if ($(this).find("option:selected").length == 0) {
                $(this).val(null);
            }
        });

        $(".multiSelect").trigger('change.select2');
    }

    function registerVehicleSearchEventHandlers() {
        $("#gw_bannercomponentstocksearch__container").on('click touch', '.select2-selection__choice', function () {
            $(this).children('.select2-selection__choice__remove').click();
        });

        registerVehicleBasicSearchEventHandlers();
    }

    function registerVehicleBasicSearchEventHandlers() {
        registerDefaultMultiSelectBehaviours($("#Filters_MakeName", "#basicSearchForm"), $("#basicSearchForm #Filters_MakeName option[value='']"));
        registerDefaultMultiSelectBehaviours($("#Filters_ModelName", "#basicSearchForm"), $("#basicSearchForm #Filters_ModelName option[value='']"));
    }

    function registerDefaultMultiSelectBehaviours(searchField, defaultOption) {
        searchField.on("select2:select", function (e) {
            if (e.params.data.id == "") {
                searchField.select2('val', [""]);
            } else {
                defaultOption.prop("selected", false).trigger("change.select2");
            }
        });

        searchField.on("select2:unselect", function (e) {
            if (searchField.val() == null) {
                searchField.select2('val', [""]);
            }
        });

        searchField.on('select2:unselecting', function () {
            $(this).data('unselecting', true);
        }).on('select2:opening', function (e) {
            if ($(this).data('unselecting')) {
                $(this).removeData('unselecting');
                e.preventDefault();
            }
        });
    }

    function getSelectedChoicesTotalWidth(id) {
        var totalWidth = 0;
        $(id + ' li.select2-selection__choice').each(function (index) {
            totalWidth += $(this).outerWidth();
        });
        return totalWidth;
    }

    function updateOverflowArray(id, totalContainerWidth, overflowSelectedOptions, defaultOption) {
        overflowSelectedOptions.length = 0;
        var choiceWidth = 0;
        var defaultOptionOuterWidth = 0;
        $(id + ' li.select2-selection__choice').each(function (index, value) {
            choiceWidth += $(this).outerWidth(true);
            if (this.innerText.indexOf(defaultOption) != -1) {
                defaultOptionOuterWidth = $(this).outerWidth(true);
            }
            if ((choiceWidth - defaultOptionOuterWidth) > totalContainerWidth) {
                overflowSelectedOptions.push(value.title);
            }
        });
    }

    function getContainerTotalWidth(id) {
        return $(id + ' ul.select2-selection__rendered').width();
    }

    function updateOverflowedOptions(id, badgeClassName) {
        var overflowedSelectedOptionsCount = getoverflowSelectedOptionsCount(id);

        if (overflowedSelectedOptionsCount > 0) {
            $(badgeClassName).show();
        }
        else {
            $(badgeClassName).hide();
        }

        $(id + ' #gw_bannercomponentstocksearch__searchoptions__badge__text').text("+" + overflowedSelectedOptionsCount);
    }

    function getoverflowSelectedOptionsCount(id) {
        if (id === "#gw_bannercomponentstocksearch__searchoptions__makes") {
            return overflowSelectedMakeOptions.length;
        }
        if (id === "#gw_bannercomponentstocksearch__searchoptions__models") {
            return overflowSelectedModelOptions.length;
        }
    }

    function executeOpenCloseToggle(element) {
        $(element).toggleClass("gw-grux-down01").toggleClass("gw-grux-up01");
        $("#gw_bannercomponentstocksearch").toggleClass("stocksearchopen");
        if (!window.matchMedia('(max-width: 992px)').matches) {
            $(".glider-circle-icon").toggleClass("stocksearchclose");
        }
    }

    function OpenResultsUp(element) {
        var $select2Results = $("#select2-" + $(element).attr('id') + "-results");
        var $parent = $select2Results.parent();
        var $grandparent = $parent.parent();
        var dropUpwards = $grandparent
            .removeClass("select2-dropdown--below").addClass("select2-dropdown--above");
    }
})(jQuery);;
(function ($) {

    $(document).ready(function () {
        $(document).on('click', '#ShowMoreStockVehicles', function (e) {
            e.defaultPrevented;

            var url = $(this).attr('data-page');

            $.get(url, function (data) {
                var $moreVehicles = $(data).find('li');
                var $additionalContent = $(data).filter('#additional-content');

                if (($('.stockListResults').length) && ($('#gw_stockList__list').length)) {
                    $('#gw_stockList__list').append($moreVehicles);
                }

                $('#additional-content').replaceWith($additionalContent);

                var showMoreEvent = new CustomEvent("show-more", { "detail": "Raised on clicking show more" });
                document.dispatchEvent(showMoreEvent);
            });

            return false;
        });
        
        $(document).on('change', '#PagedSortBy', function (e) {
            url = window.location.href;

            url = url.replace(/\/[0-9]+(?=\?)|\/[0-9]+$/g, '');
            url = updateQueryStringParameter(url, 'sort', $(this).val().split('_')[0]);
            url = updateQueryStringParameter(url, 'dir', $(this).val().split('_')[1]);

            window.location.href = url;
        });

        function updateQueryStringParameter(uri, key, value) {
            var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
            var separator = uri.indexOf('?') !== -1 ? "&" : "?";
            if (uri.match(re)) {
                return uri.replace(re, '$1' + key + "=" + value + '$2');
            }
            else {
                return uri + separator + key + "=" + value;
            }
        }

        $(document).on('click', '.buttonShare', function () {
            $(this).closest('.leadWrap').find('.gw_stockList__vehicle__share').toggleClass("share-visible");
            $(this).closest('.gw_stockList__vehicle__image--buttons').find('.CompareFavCheck').toggleClass("hide-favourite");
            return false;
        });
        
    });
    
})(jQuery);
