(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory():typeof define==='function'&&define.amd?define(factory):(global=typeof globalThis!=='undefined'?globalThis:global||self,global.bootstrap=factory());})(this,(function(){'use strict';const elementMap=new Map();const Data={set(element,key,instance){if(!elementMap.has(element)){elementMap.set(element,new Map());}
const instanceMap=elementMap.get(element);if(!instanceMap.has(key)&&instanceMap.size!==0){console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);return;}
instanceMap.set(key,instance);},get(element,key){if(elementMap.has(element)){return elementMap.get(element).get(key)||null;}
return null;},remove(element,key){if(!elementMap.has(element)){return;}
const instanceMap=elementMap.get(element);instanceMap.delete(key);if(instanceMap.size===0){elementMap.delete(element);}}};const MAX_UID=1000000;const MILLISECONDS_MULTIPLIER=1000;const TRANSITION_END='transitionend';const parseSelector=selector=>{if(selector&&window.CSS&&window.CSS.escape){selector=selector.replace(/#([^\s"#']+)/g,(match,id)=>`#${CSS.escape(id)}`);}
return selector;};const toType=object=>{if(object===null||object===undefined){return`${object}`;}
return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();};const getUID=prefix=>{do{prefix+=Math.floor(Math.random()*MAX_UID);}while(document.getElementById(prefix));return prefix;};const getTransitionDurationFromElement=element=>{if(!element){return 0;}
let{transitionDuration,transitionDelay}=window.getComputedStyle(element);const floatTransitionDuration=Number.parseFloat(transitionDuration);const floatTransitionDelay=Number.parseFloat(transitionDelay);if(!floatTransitionDuration&&!floatTransitionDelay){return 0;}
transitionDuration=transitionDuration.split(',')[0];transitionDelay=transitionDelay.split(',')[0];return(Number.parseFloat(transitionDuration)+Number.parseFloat(transitionDelay))*MILLISECONDS_MULTIPLIER;};const triggerTransitionEnd=element=>{element.dispatchEvent(new Event(TRANSITION_END));};const isElement$1=object=>{if(!object||typeof object!=='object'){return false;}
if(typeof object.jquery!=='undefined'){object=object[0];}
return typeof object.nodeType!=='undefined';};const getElement=object=>{if(isElement$1(object)){return object.jquery?object[0]:object;}
if(typeof object==='string'&&object.length>0){return document.querySelector(parseSelector(object));}
return null;};const isVisible=element=>{if(!isElement$1(element)||element.getClientRects().length===0){return false;}
const elementIsVisible=getComputedStyle(element).getPropertyValue('visibility')==='visible';const closedDetails=element.closest('details:not([open])');if(!closedDetails){return elementIsVisible;}
if(closedDetails!==element){const summary=element.closest('summary');if(summary&&summary.parentNode!==closedDetails){return false;}
if(summary===null){return false;}}
return elementIsVisible;};const isDisabled=element=>{if(!element||element.nodeType!==Node.ELEMENT_NODE){return true;}
if(element.classList.contains('disabled')){return true;}
if(typeof element.disabled!=='undefined'){return element.disabled;}
return element.hasAttribute('disabled')&&element.getAttribute('disabled')!=='false';};const findShadowRoot=element=>{if(!document.documentElement.attachShadow){return null;}
if(typeof element.getRootNode==='function'){const root=element.getRootNode();return root instanceof ShadowRoot?root:null;}
if(element instanceof ShadowRoot){return element;}
if(!element.parentNode){return null;}
return findShadowRoot(element.parentNode);};const noop=()=>{};const reflow=element=>{element.offsetHeight;};const getjQuery=()=>{if(window.jQuery&&!document.body.hasAttribute('data-bs-no-jquery')){return window.jQuery;}
return null;};const DOMContentLoadedCallbacks=[];const onDOMContentLoaded=callback=>{if(document.readyState==='loading'){if(!DOMContentLoadedCallbacks.length){document.addEventListener('DOMContentLoaded',()=>{for(const callback of DOMContentLoadedCallbacks){callback();}});}
DOMContentLoadedCallbacks.push(callback);}else{callback();}};const isRTL=()=>document.documentElement.dir==='rtl';const defineJQueryPlugin=plugin=>{onDOMContentLoaded(()=>{const $=getjQuery();if($){const name=plugin.NAME;const JQUERY_NO_CONFLICT=$.fn[name];$.fn[name]=plugin.jQueryInterface;$.fn[name].Constructor=plugin;$.fn[name].noConflict=()=>{$.fn[name]=JQUERY_NO_CONFLICT;return plugin.jQueryInterface;};}});};const execute=(possibleCallback,args=[],defaultValue=possibleCallback)=>{return typeof possibleCallback==='function'?possibleCallback(...args):defaultValue;};const executeAfterTransition=(callback,transitionElement,waitForTransition=true)=>{if(!waitForTransition){execute(callback);return;}
const durationPadding=5;const emulatedDuration=getTransitionDurationFromElement(transitionElement)+durationPadding;let called=false;const handler=({target})=>{if(target!==transitionElement){return;}
called=true;transitionElement.removeEventListener(TRANSITION_END,handler);execute(callback);};transitionElement.addEventListener(TRANSITION_END,handler);setTimeout(()=>{if(!called){triggerTransitionEnd(transitionElement);}},emulatedDuration);};const getNextActiveElement=(list,activeElement,shouldGetNext,isCycleAllowed)=>{const listLength=list.length;let index=list.indexOf(activeElement);if(index===-1){return!shouldGetNext&&isCycleAllowed?list[listLength-1]:list[0];}
index+=shouldGetNext?1:-1;if(isCycleAllowed){index=(index+listLength)%listLength;}
return list[Math.max(0,Math.min(index,listLength-1))];};const namespaceRegex=/[^.]*(?=\..*)\.|.*/;const stripNameRegex=/\..*/;const stripUidRegex=/::\d+$/;const eventRegistry={};let uidEvent=1;const customEvents={mouseenter:'mouseover',mouseleave:'mouseout'};const nativeEvents=new Set(['click','dblclick','mouseup','mousedown','contextmenu','mousewheel','DOMMouseScroll','mouseover','mouseout','mousemove','selectstart','selectend','keydown','keypress','keyup','orientationchange','touchstart','touchmove','touchend','touchcancel','pointerdown','pointermove','pointerup','pointerleave','pointercancel','gesturestart','gesturechange','gestureend','focus','blur','change','reset','select','submit','focusin','focusout','load','unload','beforeunload','resize','move','DOMContentLoaded','readystatechange','error','abort','scroll']);function makeEventUid(element,uid){return uid&&`${uid}::${uidEvent++}`||element.uidEvent||uidEvent++;}
function getElementEvents(element){const uid=makeEventUid(element);element.uidEvent=uid;eventRegistry[uid]=eventRegistry[uid]||{};return eventRegistry[uid];}
function bootstrapHandler(element,fn){return function handler(event){hydrateObj(event,{delegateTarget:element});if(handler.oneOff){EventHandler.off(element,event.type,fn);}
return fn.apply(element,[event]);};}
function bootstrapDelegationHandler(element,selector,fn){return function handler(event){const domElements=element.querySelectorAll(selector);for(let{target}=event;target&&target!==this;target=target.parentNode){for(const domElement of domElements){if(domElement!==target){continue;}
hydrateObj(event,{delegateTarget:target});if(handler.oneOff){EventHandler.off(element,event.type,selector,fn);}
return fn.apply(target,[event]);}}};}
function findHandler(events,callable,delegationSelector=null){return Object.values(events).find(event=>event.callable===callable&&event.delegationSelector===delegationSelector);}
function normalizeParameters(originalTypeEvent,handler,delegationFunction){const isDelegated=typeof handler==='string';const callable=isDelegated?delegationFunction:handler||delegationFunction;let typeEvent=getTypeEvent(originalTypeEvent);if(!nativeEvents.has(typeEvent)){typeEvent=originalTypeEvent;}
return[isDelegated,callable,typeEvent];}
function addHandler(element,originalTypeEvent,handler,delegationFunction,oneOff){if(typeof originalTypeEvent!=='string'||!element){return;}
let[isDelegated,callable,typeEvent]=normalizeParameters(originalTypeEvent,handler,delegationFunction);if(originalTypeEvent in customEvents){const wrapFunction=fn=>{return function(event){if(!event.relatedTarget||event.relatedTarget!==event.delegateTarget&&!event.delegateTarget.contains(event.relatedTarget)){return fn.call(this,event);}};};callable=wrapFunction(callable);}
const events=getElementEvents(element);const handlers=events[typeEvent]||(events[typeEvent]={});const previousFunction=findHandler(handlers,callable,isDelegated?handler:null);if(previousFunction){previousFunction.oneOff=previousFunction.oneOff&&oneOff;return;}
const uid=makeEventUid(callable,originalTypeEvent.replace(namespaceRegex,''));const fn=isDelegated?bootstrapDelegationHandler(element,handler,callable):bootstrapHandler(element,callable);fn.delegationSelector=isDelegated?handler:null;fn.callable=callable;fn.oneOff=oneOff;fn.uidEvent=uid;handlers[uid]=fn;element.addEventListener(typeEvent,fn,isDelegated);}
function removeHandler(element,events,typeEvent,handler,delegationSelector){const fn=findHandler(events[typeEvent],handler,delegationSelector);if(!fn){return;}
element.removeEventListener(typeEvent,fn,Boolean(delegationSelector));delete events[typeEvent][fn.uidEvent];}
function removeNamespacedHandlers(element,events,typeEvent,namespace){const storeElementEvent=events[typeEvent]||{};for(const[handlerKey,event]of Object.entries(storeElementEvent)){if(handlerKey.includes(namespace)){removeHandler(element,events,typeEvent,event.callable,event.delegationSelector);}}}
function getTypeEvent(event){event=event.replace(stripNameRegex,'');return customEvents[event]||event;}
const EventHandler={on(element,event,handler,delegationFunction){addHandler(element,event,handler,delegationFunction,false);},one(element,event,handler,delegationFunction){addHandler(element,event,handler,delegationFunction,true);},off(element,originalTypeEvent,handler,delegationFunction){if(typeof originalTypeEvent!=='string'||!element){return;}
const[isDelegated,callable,typeEvent]=normalizeParameters(originalTypeEvent,handler,delegationFunction);const inNamespace=typeEvent!==originalTypeEvent;const events=getElementEvents(element);const storeElementEvent=events[typeEvent]||{};const isNamespace=originalTypeEvent.startsWith('.');if(typeof callable!=='undefined'){if(!Object.keys(storeElementEvent).length){return;}
removeHandler(element,events,typeEvent,callable,isDelegated?handler:null);return;}
if(isNamespace){for(const elementEvent of Object.keys(events)){removeNamespacedHandlers(element,events,elementEvent,originalTypeEvent.slice(1));}}
for(const[keyHandlers,event]of Object.entries(storeElementEvent)){const handlerKey=keyHandlers.replace(stripUidRegex,'');if(!inNamespace||originalTypeEvent.includes(handlerKey)){removeHandler(element,events,typeEvent,event.callable,event.delegationSelector);}}},trigger(element,event,args){if(typeof event!=='string'||!element){return null;}
const $=getjQuery();const typeEvent=getTypeEvent(event);const inNamespace=event!==typeEvent;let jQueryEvent=null;let bubbles=true;let nativeDispatch=true;let defaultPrevented=false;if(inNamespace&&$){jQueryEvent=$.Event(event,args);$(element).trigger(jQueryEvent);bubbles=!jQueryEvent.isPropagationStopped();nativeDispatch=!jQueryEvent.isImmediatePropagationStopped();defaultPrevented=jQueryEvent.isDefaultPrevented();}
const evt=hydrateObj(new Event(event,{bubbles,cancelable:true}),args);if(defaultPrevented){evt.preventDefault();}
if(nativeDispatch){element.dispatchEvent(evt);}
if(evt.defaultPrevented&&jQueryEvent){jQueryEvent.preventDefault();}
return evt;}};function hydrateObj(obj,meta={}){for(const[key,value]of Object.entries(meta)){try{obj[key]=value;}catch(_unused){Object.defineProperty(obj,key,{configurable:true,get(){return value;}});}}
return obj;}
function normalizeData(value){if(value==='true'){return true;}
if(value==='false'){return false;}
if(value===Number(value).toString()){return Number(value);}
if(value===''||value==='null'){return null;}
if(typeof value!=='string'){return value;}
try{return JSON.parse(decodeURIComponent(value));}catch(_unused){return value;}}
function normalizeDataKey(key){return key.replace(/[A-Z]/g,chr=>`-${chr.toLowerCase()}`);}
const Manipulator={setDataAttribute(element,key,value){element.setAttribute(`data-bs-${normalizeDataKey(key)}`,value);},removeDataAttribute(element,key){element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);},getDataAttributes(element){if(!element){return{};}
const attributes={};const bsKeys=Object.keys(element.dataset).filter(key=>key.startsWith('bs')&&!key.startsWith('bsConfig'));for(const key of bsKeys){let pureKey=key.replace(/^bs/,'');pureKey=pureKey.charAt(0).toLowerCase()+pureKey.slice(1,pureKey.length);attributes[pureKey]=normalizeData(element.dataset[key]);}
return attributes;},getDataAttribute(element,key){return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));}};class Config{static get Default(){return{};}
static get DefaultType(){return{};}
static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!');}
_getConfig(config){config=this._mergeConfigObj(config);config=this._configAfterMerge(config);this._typeCheckConfig(config);return config;}
_configAfterMerge(config){return config;}
_mergeConfigObj(config,element){const jsonConfig=isElement$1(element)?Manipulator.getDataAttribute(element,'config'):{};return{...this.constructor.Default,...(typeof jsonConfig==='object'?jsonConfig:{}),...(isElement$1(element)?Manipulator.getDataAttributes(element):{}),...(typeof config==='object'?config:{})};}
_typeCheckConfig(config,configTypes=this.constructor.DefaultType){for(const[property,expectedTypes]of Object.entries(configTypes)){const value=config[property];const valueType=isElement$1(value)?'element':toType(value);if(!new RegExp(expectedTypes).test(valueType)){throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);}}}}
const VERSION='5.3.2';class BaseComponent extends Config{constructor(element,config){super();element=getElement(element);if(!element){return;}
this._element=element;this._config=this._getConfig(config);Data.set(this._element,this.constructor.DATA_KEY,this);}
dispose(){Data.remove(this._element,this.constructor.DATA_KEY);EventHandler.off(this._element,this.constructor.EVENT_KEY);for(const propertyName of Object.getOwnPropertyNames(this)){this[propertyName]=null;}}
_queueCallback(callback,element,isAnimated=true){executeAfterTransition(callback,element,isAnimated);}
_getConfig(config){config=this._mergeConfigObj(config,this._element);config=this._configAfterMerge(config);this._typeCheckConfig(config);return config;}
static getInstance(element){return Data.get(getElement(element),this.DATA_KEY);}
static getOrCreateInstance(element,config={}){return this.getInstance(element)||new this(element,typeof config==='object'?config:null);}
static get VERSION(){return VERSION;}
static get DATA_KEY(){return`bs.${this.NAME}`;}
static get EVENT_KEY(){return`.${this.DATA_KEY}`;}
static eventName(name){return`${name}${this.EVENT_KEY}`;}}
const getSelector=element=>{let selector=element.getAttribute('data-bs-target');if(!selector||selector==='#'){let hrefAttribute=element.getAttribute('href');if(!hrefAttribute||!hrefAttribute.includes('#')&&!hrefAttribute.startsWith('.')){return null;}
if(hrefAttribute.includes('#')&&!hrefAttribute.startsWith('#')){hrefAttribute=`#${hrefAttribute.split('#')[1]}`;}
selector=hrefAttribute&&hrefAttribute!=='#'?parseSelector(hrefAttribute.trim()):null;}
return selector;};const SelectorEngine={find(selector,element=document.documentElement){return[].concat(...Element.prototype.querySelectorAll.call(element,selector));},findOne(selector,element=document.documentElement){return Element.prototype.querySelector.call(element,selector);},children(element,selector){return[].concat(...element.children).filter(child=>child.matches(selector));},parents(element,selector){const parents=[];let ancestor=element.parentNode.closest(selector);while(ancestor){parents.push(ancestor);ancestor=ancestor.parentNode.closest(selector);}
return parents;},prev(element,selector){let previous=element.previousElementSibling;while(previous){if(previous.matches(selector)){return[previous];}
previous=previous.previousElementSibling;}
return[];},next(element,selector){let next=element.nextElementSibling;while(next){if(next.matches(selector)){return[next];}
next=next.nextElementSibling;}
return[];},focusableChildren(element){const focusables=['a','button','input','textarea','select','details','[tabindex]','[contenteditable="true"]'].map(selector=>`${selector}:not([tabindex^="-"])`).join(',');return this.find(focusables,element).filter(el=>!isDisabled(el)&&isVisible(el));},getSelectorFromElement(element){const selector=getSelector(element);if(selector){return SelectorEngine.findOne(selector)?selector:null;}
return null;},getElementFromSelector(element){const selector=getSelector(element);return selector?SelectorEngine.findOne(selector):null;},getMultipleElementsFromSelector(element){const selector=getSelector(element);return selector?SelectorEngine.find(selector):[];}};const enableDismissTrigger=(component,method='hide')=>{const clickEvent=`click.dismiss${component.EVENT_KEY}`;const name=component.NAME;EventHandler.on(document,clickEvent,`[data-bs-dismiss="${name}"]`,function(event){if(['A','AREA'].includes(this.tagName)){event.preventDefault();}
if(isDisabled(this)){return;}
const target=SelectorEngine.getElementFromSelector(this)||this.closest(`.${name}`);const instance=component.getOrCreateInstance(target);instance[method]();});};const NAME$f='alert';const DATA_KEY$a='bs.alert';const EVENT_KEY$b=`.${DATA_KEY$a}`;const EVENT_CLOSE=`close${EVENT_KEY$b}`;const EVENT_CLOSED=`closed${EVENT_KEY$b}`;const CLASS_NAME_FADE$5='fade';const CLASS_NAME_SHOW$8='show';class Alert extends BaseComponent{static get NAME(){return NAME$f;}
close(){const closeEvent=EventHandler.trigger(this._element,EVENT_CLOSE);if(closeEvent.defaultPrevented){return;}
this._element.classList.remove(CLASS_NAME_SHOW$8);const isAnimated=this._element.classList.contains(CLASS_NAME_FADE$5);this._queueCallback(()=>this._destroyElement(),this._element,isAnimated);}
_destroyElement(){this._element.remove();EventHandler.trigger(this._element,EVENT_CLOSED);this.dispose();}
static jQueryInterface(config){return this.each(function(){const data=Alert.getOrCreateInstance(this);if(typeof config!=='string'){return;}
if(data[config]===undefined||config.startsWith('_')||config==='constructor'){throw new TypeError(`No method named "${config}"`);}
data[config](this);});}}
enableDismissTrigger(Alert,'close');defineJQueryPlugin(Alert);const NAME$e='button';const DATA_KEY$9='bs.button';const EVENT_KEY$a=`.${DATA_KEY$9}`;const DATA_API_KEY$6='.data-api';const CLASS_NAME_ACTIVE$3='active';const SELECTOR_DATA_TOGGLE$5='[data-bs-toggle="button"]';const EVENT_CLICK_DATA_API$6=`click${EVENT_KEY$a}${DATA_API_KEY$6}`;class Button extends BaseComponent{static get NAME(){return NAME$e;}
toggle(){this._element.setAttribute('aria-pressed',this._element.classList.toggle(CLASS_NAME_ACTIVE$3));}
static jQueryInterface(config){return this.each(function(){const data=Button.getOrCreateInstance(this);if(config==='toggle'){data[config]();}});}}
EventHandler.on(document,EVENT_CLICK_DATA_API$6,SELECTOR_DATA_TOGGLE$5,event=>{event.preventDefault();const button=event.target.closest(SELECTOR_DATA_TOGGLE$5);const data=Button.getOrCreateInstance(button);data.toggle();});defineJQueryPlugin(Button);const NAME$d='swipe';const EVENT_KEY$9='.bs.swipe';const EVENT_TOUCHSTART=`touchstart${EVENT_KEY$9}`;const EVENT_TOUCHMOVE=`touchmove${EVENT_KEY$9}`;const EVENT_TOUCHEND=`touchend${EVENT_KEY$9}`;const EVENT_POINTERDOWN=`pointerdown${EVENT_KEY$9}`;const EVENT_POINTERUP=`pointerup${EVENT_KEY$9}`;const POINTER_TYPE_TOUCH='touch';const POINTER_TYPE_PEN='pen';const CLASS_NAME_POINTER_EVENT='pointer-event';const SWIPE_THRESHOLD=40;const Default$c={endCallback:null,leftCallback:null,rightCallback:null};const DefaultType$c={endCallback:'(function|null)',leftCallback:'(function|null)',rightCallback:'(function|null)'};class Swipe extends Config{constructor(element,config){super();this._element=element;if(!element||!Swipe.isSupported()){return;}
this._config=this._getConfig(config);this._deltaX=0;this._supportPointerEvents=Boolean(window.PointerEvent);this._initEvents();}
static get Default(){return Default$c;}
static get DefaultType(){return DefaultType$c;}
static get NAME(){return NAME$d;}
dispose(){EventHandler.off(this._element,EVENT_KEY$9);}
_start(event){if(!this._supportPointerEvents){this._deltaX=event.touches[0].clientX;return;}
if(this._eventIsPointerPenTouch(event)){this._deltaX=event.clientX;}}
_end(event){if(this._eventIsPointerPenTouch(event)){this._deltaX=event.clientX-this._deltaX;}
this._handleSwipe();execute(this._config.endCallback);}
_move(event){this._deltaX=event.touches&&event.touches.length>1?0:event.touches[0].clientX-this._deltaX;}
_handleSwipe(){const absDeltaX=Math.abs(this._deltaX);if(absDeltaX<=SWIPE_THRESHOLD){return;}
const direction=absDeltaX/this._deltaX;this._deltaX=0;if(!direction){return;}
execute(direction>0?this._config.rightCallback:this._config.leftCallback);}
_initEvents(){if(this._supportPointerEvents){EventHandler.on(this._element,EVENT_POINTERDOWN,event=>this._start(event));EventHandler.on(this._element,EVENT_POINTERUP,event=>this._end(event));this._element.classList.add(CLASS_NAME_POINTER_EVENT);}else{EventHandler.on(this._element,EVENT_TOUCHSTART,event=>this._start(event));EventHandler.on(this._element,EVENT_TOUCHMOVE,event=>this._move(event));EventHandler.on(this._element,EVENT_TOUCHEND,event=>this._end(event));}}
_eventIsPointerPenTouch(event){return this._supportPointerEvents&&(event.pointerType===POINTER_TYPE_PEN||event.pointerType===POINTER_TYPE_TOUCH);}
static isSupported(){return'ontouchstart' in document.documentElement||navigator.maxTouchPoints>0;}}
const NAME$c='carousel';const DATA_KEY$8='bs.carousel';const EVENT_KEY$8=`.${DATA_KEY$8}`;const DATA_API_KEY$5='.data-api';const ARROW_LEFT_KEY$1='ArrowLeft';const ARROW_RIGHT_KEY$1='ArrowRight';const TOUCHEVENT_COMPAT_WAIT=500;const ORDER_NEXT='next';const ORDER_PREV='prev';const DIRECTION_LEFT='left';const DIRECTION_RIGHT='right';const EVENT_SLIDE=`slide${EVENT_KEY$8}`;const EVENT_SLID=`slid${EVENT_KEY$8}`;const EVENT_KEYDOWN$1=`keydown${EVENT_KEY$8}`;const EVENT_MOUSEENTER$1=`mouseenter${EVENT_KEY$8}`;const EVENT_MOUSELEAVE$1=`mouseleave${EVENT_KEY$8}`;const EVENT_DRAG_START=`dragstart${EVENT_KEY$8}`;const EVENT_LOAD_DATA_API$3=`load${EVENT_KEY$8}${DATA_API_KEY$5}`;const EVENT_CLICK_DATA_API$5=`click${EVENT_KEY$8}${DATA_API_KEY$5}`;const CLASS_NAME_CAROUSEL='carousel';const CLASS_NAME_ACTIVE$2='active';const CLASS_NAME_SLIDE='slide';const CLASS_NAME_END='carousel-item-end';const CLASS_NAME_START='carousel-item-start';const CLASS_NAME_NEXT='carousel-item-next';const CLASS_NAME_PREV='carousel-item-prev';const SELECTOR_ACTIVE='.active';const SELECTOR_ITEM='.carousel-item';const SELECTOR_ACTIVE_ITEM=SELECTOR_ACTIVE+SELECTOR_ITEM;const SELECTOR_ITEM_IMG='.carousel-item img';const SELECTOR_INDICATORS='.carousel-indicators';const SELECTOR_DATA_SLIDE='[data-bs-slide], [data-bs-slide-to]';const SELECTOR_DATA_RIDE='[data-bs-ride="carousel"]';const KEY_TO_DIRECTION={[ARROW_LEFT_KEY$1]:DIRECTION_RIGHT,[ARROW_RIGHT_KEY$1]:DIRECTION_LEFT};const Default$b={interval:5000,keyboard:true,pause:'hover',ride:false,touch:true,wrap:true};const DefaultType$b={interval:'(number|boolean)',keyboard:'boolean',pause:'(string|boolean)',ride:'(boolean|string)',touch:'boolean',wrap:'boolean'};class Carousel extends BaseComponent{constructor(element,config){super(element,config);this._interval=null;this._activeElement=null;this._isSliding=false;this.touchTimeout=null;this._swipeHelper=null;this._indicatorsElement=SelectorEngine.findOne(SELECTOR_INDICATORS,this._element);this._addEventListeners();if(this._config.ride===CLASS_NAME_CAROUSEL){this.cycle();}}
static get Default(){return Default$b;}
static get DefaultType(){return DefaultType$b;}
static get NAME(){return NAME$c;}
next(){this._slide(ORDER_NEXT);}
nextWhenVisible(){if(!document.hidden&&isVisible(this._element)){this.next();}}
prev(){this._slide(ORDER_PREV);}
pause(){if(this._isSliding){triggerTransitionEnd(this._element);}
this._clearInterval();}
cycle(){this._clearInterval();this._updateInterval();this._interval=setInterval(()=>this.nextWhenVisible(),this._config.interval);}
_maybeEnableCycle(){if(!this._config.ride){return;}
if(this._isSliding){EventHandler.one(this._element,EVENT_SLID,()=>this.cycle());return;}
this.cycle();}
to(index){const items=this._getItems();if(index>items.length-1||index<0){return;}
if(this._isSliding){EventHandler.one(this._element,EVENT_SLID,()=>this.to(index));return;}
const activeIndex=this._getItemIndex(this._getActive());if(activeIndex===index){return;}
const order=index>activeIndex?ORDER_NEXT:ORDER_PREV;this._slide(order,items[index]);}
dispose(){if(this._swipeHelper){this._swipeHelper.dispose();}
super.dispose();}
_configAfterMerge(config){config.defaultInterval=config.interval;return config;}
_addEventListeners(){if(this._config.keyboard){EventHandler.on(this._element,EVENT_KEYDOWN$1,event=>this._keydown(event));}
if(this._config.pause==='hover'){EventHandler.on(this._element,EVENT_MOUSEENTER$1,()=>this.pause());EventHandler.on(this._element,EVENT_MOUSELEAVE$1,()=>this._maybeEnableCycle());}
if(this._config.touch&&Swipe.isSupported()){this._addTouchEventListeners();}}
_addTouchEventListeners(){for(const img of SelectorEngine.find(SELECTOR_ITEM_IMG,this._element)){EventHandler.on(img,EVENT_DRAG_START,event=>event.preventDefault());}
const endCallBack=()=>{if(this._config.pause!=='hover'){return;}
this.pause();if(this.touchTimeout){clearTimeout(this.touchTimeout);}
this.touchTimeout=setTimeout(()=>this._maybeEnableCycle(),TOUCHEVENT_COMPAT_WAIT+this._config.interval);};const swipeConfig={leftCallback:()=>this._slide(this._directionToOrder(DIRECTION_LEFT)),rightCallback:()=>this._slide(this._directionToOrder(DIRECTION_RIGHT)),endCallback:endCallBack};this._swipeHelper=new Swipe(this._element,swipeConfig);}
_keydown(event){if(/input|textarea/i.test(event.target.tagName)){return;}
const direction=KEY_TO_DIRECTION[event.key];if(direction){event.preventDefault();this._slide(this._directionToOrder(direction));}}
_getItemIndex(element){return this._getItems().indexOf(element);}
_setActiveIndicatorElement(index){if(!this._indicatorsElement){return;}
const activeIndicator=SelectorEngine.findOne(SELECTOR_ACTIVE,this._indicatorsElement);activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);activeIndicator.removeAttribute('aria-current');const newActiveIndicator=SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`,this._indicatorsElement);if(newActiveIndicator){newActiveIndicator.classList.add(CLASS_NAME_ACTIVE$2);newActiveIndicator.setAttribute('aria-current','true');}}
_updateInterval(){const element=this._activeElement||this._getActive();if(!element){return;}
const elementInterval=Number.parseInt(element.getAttribute('data-bs-interval'),10);this._config.interval=elementInterval||this._config.defaultInterval;}
_slide(order,element=null){if(this._isSliding){return;}
const activeElement=this._getActive();const isNext=order===ORDER_NEXT;const nextElement=element||getNextActiveElement(this._getItems(),activeElement,isNext,this._config.wrap);if(nextElement===activeElement){return;}
const nextElementIndex=this._getItemIndex(nextElement);const triggerEvent=eventName=>{return EventHandler.trigger(this._element,eventName,{relatedTarget:nextElement,direction:this._orderToDirection(order),from:this._getItemIndex(activeElement),to:nextElementIndex});};const slideEvent=triggerEvent(EVENT_SLIDE);if(slideEvent.defaultPrevented){return;}
if(!activeElement||!nextElement){return;}
const isCycling=Boolean(this._interval);this.pause();this._isSliding=true;this._setActiveIndicatorElement(nextElementIndex);this._activeElement=nextElement;const directionalClassName=isNext?CLASS_NAME_START:CLASS_NAME_END;const orderClassName=isNext?CLASS_NAME_NEXT:CLASS_NAME_PREV;nextElement.classList.add(orderClassName);reflow(nextElement);activeElement.classList.add(directionalClassName);nextElement.classList.add(directionalClassName);const completeCallBack=()=>{nextElement.classList.remove(directionalClassName,orderClassName);nextElement.classList.add(CLASS_NAME_ACTIVE$2);activeElement.classList.remove(CLASS_NAME_ACTIVE$2,orderClassName,directionalClassName);this._isSliding=false;triggerEvent(EVENT_SLID);};this._queueCallback(completeCallBack,activeElement,this._isAnimated());if(isCycling){this.cycle();}}
_isAnimated(){return this._element.classList.contains(CLASS_NAME_SLIDE);}
_getActive(){return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM,this._element);}
_getItems(){return SelectorEngine.find(SELECTOR_ITEM,this._element);}
_clearInterval(){if(this._interval){clearInterval(this._interval);this._interval=null;}}
_directionToOrder(direction){if(isRTL()){return direction===DIRECTION_LEFT?ORDER_PREV:ORDER_NEXT;}
return direction===DIRECTION_LEFT?ORDER_NEXT:ORDER_PREV;}
_orderToDirection(order){if(isRTL()){return order===ORDER_PREV?DIRECTION_LEFT:DIRECTION_RIGHT;}
return order===ORDER_PREV?DIRECTION_RIGHT:DIRECTION_LEFT;}
static jQueryInterface(config){return this.each(function(){const data=Carousel.getOrCreateInstance(this,config);if(typeof config==='number'){data.to(config);return;}
if(typeof config==='string'){if(data[config]===undefined||config.startsWith('_')||config==='constructor'){throw new TypeError(`No method named "${config}"`);}
data[config]();}});}}
EventHandler.on(document,EVENT_CLICK_DATA_API$5,SELECTOR_DATA_SLIDE,function(event){const target=SelectorEngine.getElementFromSelector(this);if(!target||!target.classList.contains(CLASS_NAME_CAROUSEL)){return;}
event.preventDefault();const carousel=Carousel.getOrCreateInstance(target);const slideIndex=this.getAttribute('data-bs-slide-to');if(slideIndex){carousel.to(slideIndex);carousel._maybeEnableCycle();return;}
if(Manipulator.getDataAttribute(this,'slide')==='next'){carousel.next();carousel._maybeEnableCycle();return;}
carousel.prev();carousel._maybeEnableCycle();});EventHandler.on(window,EVENT_LOAD_DATA_API$3,()=>{const carousels=SelectorEngine.find(SELECTOR_DATA_RIDE);for(const carousel of carousels){Carousel.getOrCreateInstance(carousel);}});defineJQueryPlugin(Carousel);const NAME$b='collapse';const DATA_KEY$7='bs.collapse';const EVENT_KEY$7=`.${DATA_KEY$7}`;const DATA_API_KEY$4='.data-api';const EVENT_SHOW$6=`show${EVENT_KEY$7}`;const EVENT_SHOWN$6=`shown${EVENT_KEY$7}`;const EVENT_HIDE$6=`hide${EVENT_KEY$7}`;const EVENT_HIDDEN$6=`hidden${EVENT_KEY$7}`;const EVENT_CLICK_DATA_API$4=`click${EVENT_KEY$7}${DATA_API_KEY$4}`;const CLASS_NAME_SHOW$7='show';const CLASS_NAME_COLLAPSE='collapse';const CLASS_NAME_COLLAPSING='collapsing';const CLASS_NAME_COLLAPSED='collapsed';const CLASS_NAME_DEEPER_CHILDREN=`:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;const CLASS_NAME_HORIZONTAL='collapse-horizontal';const WIDTH='width';const HEIGHT='height';const SELECTOR_ACTIVES='.collapse.show, .collapse.collapsing';const SELECTOR_DATA_TOGGLE$4='[data-bs-toggle="collapse"]';const Default$a={parent:null,toggle:true};const DefaultType$a={parent:'(null|element)',toggle:'boolean'};class Collapse extends BaseComponent{constructor(element,config){super(element,config);this._isTransitioning=false;this._triggerArray=[];const toggleList=SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);for(const elem of toggleList){const selector=SelectorEngine.getSelectorFromElement(elem);const filterElement=SelectorEngine.find(selector).filter(foundElement=>foundElement===this._element);if(selector!==null&&filterElement.length){this._triggerArray.push(elem);}}
this._initializeChildren();if(!this._config.parent){this._addAriaAndCollapsedClass(this._triggerArray,this._isShown());}
if(this._config.toggle){this.toggle();}}
static get Default(){return Default$a;}
static get DefaultType(){return DefaultType$a;}
static get NAME(){return NAME$b;}
toggle(){if(this._isShown()){this.hide();}else{this.show();}}
show(){if(this._isTransitioning||this._isShown()){return;}
let activeChildren=[];if(this._config.parent){activeChildren=this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element=>element!==this._element).map(element=>Collapse.getOrCreateInstance(element,{toggle:false}));}
if(activeChildren.length&&activeChildren[0]._isTransitioning){return;}
const startEvent=EventHandler.trigger(this._element,EVENT_SHOW$6);if(startEvent.defaultPrevented){return;}
for(const activeInstance of activeChildren){activeInstance.hide();}
const dimension=this._getDimension();this._element.classList.remove(CLASS_NAME_COLLAPSE);this._element.classList.add(CLASS_NAME_COLLAPSING);this._element.style[dimension]=0;this._addAriaAndCollapsedClass(this._triggerArray,true);this._isTransitioning=true;const complete=()=>{this._isTransitioning=false;this._element.classList.remove(CLASS_NAME_COLLAPSING);this._element.classList.add(CLASS_NAME_COLLAPSE,CLASS_NAME_SHOW$7);this._element.style[dimension]='';EventHandler.trigger(this._element,EVENT_SHOWN$6);};const capitalizedDimension=dimension[0].toUpperCase()+dimension.slice(1);const scrollSize=`scroll${capitalizedDimension}`;this._queueCallback(complete,this._element,true);this._element.style[dimension]=`${this._element[scrollSize]}px`;}
hide(){if(this._isTransitioning||!this._isShown()){return;}
const startEvent=EventHandler.trigger(this._element,EVENT_HIDE$6);if(startEvent.defaultPrevented){return;}
const dimension=this._getDimension();this._element.style[dimension]=`${this._element.getBoundingClientRect()[dimension]}px`;reflow(this._element);this._element.classList.add(CLASS_NAME_COLLAPSING);this._element.classList.remove(CLASS_NAME_COLLAPSE,CLASS_NAME_SHOW$7);for(const trigger of this._triggerArray){const element=SelectorEngine.getElementFromSelector(trigger);if(element&&!this._isShown(element)){this._addAriaAndCollapsedClass([trigger],false);}}
this._isTransitioning=true;const complete=()=>{this._isTransitioning=false;this._element.classList.remove(CLASS_NAME_COLLAPSING);this._element.classList.add(CLASS_NAME_COLLAPSE);EventHandler.trigger(this._element,EVENT_HIDDEN$6);};this._element.style[dimension]='';this._queueCallback(complete,this._element,true);}
_isShown(element=this._element){return element.classList.contains(CLASS_NAME_SHOW$7);}
_configAfterMerge(config){config.toggle=Boolean(config.toggle);config.parent=getElement(config.parent);return config;}
_getDimension(){return this._element.classList.contains(CLASS_NAME_HORIZONTAL)?WIDTH:HEIGHT;}
_initializeChildren(){if(!this._config.parent){return;}
const children=this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4);for(const element of children){const selected=SelectorEngine.getElementFromSelector(element);if(selected){this._addAriaAndCollapsedClass([element],this._isShown(selected));}}}
_getFirstLevelChildren(selector){const children=SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN,this._config.parent);return SelectorEngine.find(selector,this._config.parent).filter(element=>!children.includes(element));}
_addAriaAndCollapsedClass(triggerArray,isOpen){if(!triggerArray.length){return;}
for(const element of triggerArray){element.classList.toggle(CLASS_NAME_COLLAPSED,!isOpen);element.setAttribute('aria-expanded',isOpen);}}
static jQueryInterface(config){const _config={};if(typeof config==='string'&&/show|hide/.test(config)){_config.toggle=false;}
return this.each(function(){const data=Collapse.getOrCreateInstance(this,_config);if(typeof config==='string'){if(typeof data[config]==='undefined'){throw new TypeError(`No method named "${config}"`);}
data[config]();}});}}
EventHandler.on(document,EVENT_CLICK_DATA_API$4,SELECTOR_DATA_TOGGLE$4,function(event){if(event.target.tagName==='A'||event.delegateTarget&&event.delegateTarget.tagName==='A'){event.preventDefault();}
for(const element of SelectorEngine.getMultipleElementsFromSelector(this)){Collapse.getOrCreateInstance(element,{toggle:false}).toggle();}});defineJQueryPlugin(Collapse);var top='top';var bottom='bottom';var right='right';var left='left';var auto='auto';var basePlacements=[top,bottom,right,left];var start='start';var end='end';var clippingParents='clippingParents';var viewport='viewport';var popper='popper';var reference='reference';var variationPlacements=basePlacements.reduce(function(acc,placement){return acc.concat([placement+"-"+start,placement+"-"+end]);},[]);var placements=[].concat(basePlacements,[auto]).reduce(function(acc,placement){return acc.concat([placement,placement+"-"+start,placement+"-"+end]);},[]);var beforeRead='beforeRead';var read='read';var afterRead='afterRead';var beforeMain='beforeMain';var main='main';var afterMain='afterMain';var beforeWrite='beforeWrite';var write='write';var afterWrite='afterWrite';var modifierPhases=[beforeRead,read,afterRead,beforeMain,main,afterMain,beforeWrite,write,afterWrite];function getNodeName(element){return element?(element.nodeName||'').toLowerCase():null;}
function getWindow(node){if(node==null){return window;}
if(node.toString()!=='[object Window]'){var ownerDocument=node.ownerDocument;return ownerDocument?ownerDocument.defaultView||window:window;}
return node;}
function isElement(node){var OwnElement=getWindow(node).Element;return node instanceof OwnElement||node instanceof Element;}
function isHTMLElement(node){var OwnElement=getWindow(node).HTMLElement;return node instanceof OwnElement||node instanceof HTMLElement;}
function isShadowRoot(node){if(typeof ShadowRoot==='undefined'){return false;}
var OwnElement=getWindow(node).ShadowRoot;return node instanceof OwnElement||node instanceof ShadowRoot;}
function applyStyles(_ref){var state=_ref.state;Object.keys(state.elements).forEach(function(name){var style=state.styles[name]||{};var attributes=state.attributes[name]||{};var element=state.elements[name];if(!isHTMLElement(element)||!getNodeName(element)){return;}
Object.assign(element.style,style);Object.keys(attributes).forEach(function(name){var value=attributes[name];if(value===false){element.removeAttribute(name);}else{element.setAttribute(name,value===true?'':value);}});});}
function effect$2(_ref2){var state=_ref2.state;var initialStyles={popper:{position:state.options.strategy,left:'0',top:'0',margin:'0'},arrow:{position:'absolute'},reference:{}};Object.assign(state.elements.popper.style,initialStyles.popper);state.styles=initialStyles;if(state.elements.arrow){Object.assign(state.elements.arrow.style,initialStyles.arrow);}
return function(){Object.keys(state.elements).forEach(function(name){var element=state.elements[name];var attributes=state.attributes[name]||{};var styleProperties=Object.keys(state.styles.hasOwnProperty(name)?state.styles[name]:initialStyles[name]);var style=styleProperties.reduce(function(style,property){style[property]='';return style;},{});if(!isHTMLElement(element)||!getNodeName(element)){return;}
Object.assign(element.style,style);Object.keys(attributes).forEach(function(attribute){element.removeAttribute(attribute);});});};}
const applyStyles$1={name:'applyStyles',enabled:true,phase:'write',fn:applyStyles,effect:effect$2,requires:['computeStyles']};function getBasePlacement(placement){return placement.split('-')[0];}
var max=Math.max;var min=Math.min;var round=Math.round;function getUAString(){var uaData=navigator.userAgentData;if(uaData!=null&&uaData.brands&&Array.isArray(uaData.brands)){return uaData.brands.map(function(item){return item.brand+"/"+item.version;}).join(' ');}
return navigator.userAgent;}
function isLayoutViewport(){return!/^((?!chrome|android).)*safari/i.test(getUAString());}
function getBoundingClientRect(element,includeScale,isFixedStrategy){if(includeScale===void 0){includeScale=false;}
if(isFixedStrategy===void 0){isFixedStrategy=false;}
var clientRect=element.getBoundingClientRect();var scaleX=1;var scaleY=1;if(includeScale&&isHTMLElement(element)){scaleX=element.offsetWidth>0?round(clientRect.width)/element.offsetWidth||1:1;scaleY=element.offsetHeight>0?round(clientRect.height)/element.offsetHeight||1:1;}
var _ref=isElement(element)?getWindow(element):window,visualViewport=_ref.visualViewport;var addVisualOffsets=!isLayoutViewport()&&isFixedStrategy;var x=(clientRect.left+(addVisualOffsets&&visualViewport?visualViewport.offsetLeft:0))/scaleX;var y=(clientRect.top+(addVisualOffsets&&visualViewport?visualViewport.offsetTop:0))/scaleY;var width=clientRect.width/scaleX;var height=clientRect.height/scaleY;return{width:width,height:height,top:y,right:x+width,bottom:y+height,left:x,x:x,y:y};}
function getLayoutRect(element){var clientRect=getBoundingClientRect(element);var width=element.offsetWidth;var height=element.offsetHeight;if(Math.abs(clientRect.width-width)<=1){width=clientRect.width;}
if(Math.abs(clientRect.height-height)<=1){height=clientRect.height;}
return{x:element.offsetLeft,y:element.offsetTop,width:width,height:height};}
function contains(parent,child){var rootNode=child.getRootNode&&child.getRootNode();if(parent.contains(child)){return true;}
else if(rootNode&&isShadowRoot(rootNode)){var next=child;do{if(next&&parent.isSameNode(next)){return true;}
next=next.parentNode||next.host;}while(next);}
return false;}
function getComputedStyle$1(element){return getWindow(element).getComputedStyle(element);}
function isTableElement(element){return['table','td','th'].indexOf(getNodeName(element))>=0;}
function getDocumentElement(element){return((isElement(element)?element.ownerDocument:element.document)||window.document).documentElement;}
function getParentNode(element){if(getNodeName(element)==='html'){return element;}
return(element.assignedSlot||element.parentNode||(isShadowRoot(element)?element.host:null)||getDocumentElement(element));}
function getTrueOffsetParent(element){if(!isHTMLElement(element)||getComputedStyle$1(element).position==='fixed'){return null;}
return element.offsetParent;}
function getContainingBlock(element){var isFirefox=/firefox/i.test(getUAString());var isIE=/Trident/i.test(getUAString());if(isIE&&isHTMLElement(element)){var elementCss=getComputedStyle$1(element);if(elementCss.position==='fixed'){return null;}}
var currentNode=getParentNode(element);if(isShadowRoot(currentNode)){currentNode=currentNode.host;}
while(isHTMLElement(currentNode)&&['html','body'].indexOf(getNodeName(currentNode))<0){var css=getComputedStyle$1(currentNode);if(css.transform!=='none'||css.perspective!=='none'||css.contain==='paint'||['transform','perspective'].indexOf(css.willChange)!==-1||isFirefox&&css.willChange==='filter'||isFirefox&&css.filter&&css.filter!=='none'){return currentNode;}else{currentNode=currentNode.parentNode;}}
return null;}
function getOffsetParent(element){var window=getWindow(element);var offsetParent=getTrueOffsetParent(element);while(offsetParent&&isTableElement(offsetParent)&&getComputedStyle$1(offsetParent).position==='static'){offsetParent=getTrueOffsetParent(offsetParent);}
if(offsetParent&&(getNodeName(offsetParent)==='html'||getNodeName(offsetParent)==='body'&&getComputedStyle$1(offsetParent).position==='static')){return window;}
return offsetParent||getContainingBlock(element)||window;}
function getMainAxisFromPlacement(placement){return['top','bottom'].indexOf(placement)>=0?'x':'y';}
function within(min$1,value,max$1){return max(min$1,min(value,max$1));}
function withinMaxClamp(min,value,max){var v=within(min,value,max);return v>max?max:v;}
function getFreshSideObject(){return{top:0,right:0,bottom:0,left:0};}
function mergePaddingObject(paddingObject){return Object.assign({},getFreshSideObject(),paddingObject);}
function expandToHashMap(value,keys){return keys.reduce(function(hashMap,key){hashMap[key]=value;return hashMap;},{});}
var toPaddingObject=function toPaddingObject(padding,state){padding=typeof padding==='function'?padding(Object.assign({},state.rects,{placement:state.placement})):padding;return mergePaddingObject(typeof padding!=='number'?padding:expandToHashMap(padding,basePlacements));};function arrow(_ref){var _state$modifiersData$;var state=_ref.state,name=_ref.name,options=_ref.options;var arrowElement=state.elements.arrow;var popperOffsets=state.modifiersData.popperOffsets;var basePlacement=getBasePlacement(state.placement);var axis=getMainAxisFromPlacement(basePlacement);var isVertical=[left,right].indexOf(basePlacement)>=0;var len=isVertical?'height':'width';if(!arrowElement||!popperOffsets){return;}
var paddingObject=toPaddingObject(options.padding,state);var arrowRect=getLayoutRect(arrowElement);var minProp=axis==='y'?top:left;var maxProp=axis==='y'?bottom:right;var endDiff=state.rects.reference[len]+state.rects.reference[axis]-popperOffsets[axis]-state.rects.popper[len];var startDiff=popperOffsets[axis]-state.rects.reference[axis];var arrowOffsetParent=getOffsetParent(arrowElement);var clientSize=arrowOffsetParent?axis==='y'?arrowOffsetParent.clientHeight||0:arrowOffsetParent.clientWidth||0:0;var centerToReference=endDiff/2-startDiff/2;var min=paddingObject[minProp];var max=clientSize-arrowRect[len]-paddingObject[maxProp];var center=clientSize/2-arrowRect[len]/2+centerToReference;var offset=within(min,center,max);var axisProp=axis;state.modifiersData[name]=(_state$modifiersData$={},_state$modifiersData$[axisProp]=offset,_state$modifiersData$.centerOffset=offset-center,_state$modifiersData$);}
function effect$1(_ref2){var state=_ref2.state,options=_ref2.options;var _options$element=options.element,arrowElement=_options$element===void 0?'[data-popper-arrow]':_options$element;if(arrowElement==null){return;}
if(typeof arrowElement==='string'){arrowElement=state.elements.popper.querySelector(arrowElement);if(!arrowElement){return;}}
if(!contains(state.elements.popper,arrowElement)){return;}
state.elements.arrow=arrowElement;}
const arrow$1={name:'arrow',enabled:true,phase:'main',fn:arrow,effect:effect$1,requires:['popperOffsets'],requiresIfExists:['preventOverflow']};function getVariation(placement){return placement.split('-')[1];}
var unsetSides={top:'auto',right:'auto',bottom:'auto',left:'auto'};function roundOffsetsByDPR(_ref,win){var x=_ref.x,y=_ref.y;var dpr=win.devicePixelRatio||1;return{x:round(x*dpr)/dpr||0,y:round(y*dpr)/dpr||0};}
function mapToStyles(_ref2){var _Object$assign2;var popper=_ref2.popper,popperRect=_ref2.popperRect,placement=_ref2.placement,variation=_ref2.variation,offsets=_ref2.offsets,position=_ref2.position,gpuAcceleration=_ref2.gpuAcceleration,adaptive=_ref2.adaptive,roundOffsets=_ref2.roundOffsets,isFixed=_ref2.isFixed;var _offsets$x=offsets.x,x=_offsets$x===void 0?0:_offsets$x,_offsets$y=offsets.y,y=_offsets$y===void 0?0:_offsets$y;var _ref3=typeof roundOffsets==='function'?roundOffsets({x:x,y:y}):{x:x,y:y};x=_ref3.x;y=_ref3.y;var hasX=offsets.hasOwnProperty('x');var hasY=offsets.hasOwnProperty('y');var sideX=left;var sideY=top;var win=window;if(adaptive){var offsetParent=getOffsetParent(popper);var heightProp='clientHeight';var widthProp='clientWidth';if(offsetParent===getWindow(popper)){offsetParent=getDocumentElement(popper);if(getComputedStyle$1(offsetParent).position!=='static'&&position==='absolute'){heightProp='scrollHeight';widthProp='scrollWidth';}}
offsetParent=offsetParent;if(placement===top||(placement===left||placement===right)&&variation===end){sideY=bottom;var offsetY=isFixed&&offsetParent===win&&win.visualViewport?win.visualViewport.height:offsetParent[heightProp];y-=offsetY-popperRect.height;y*=gpuAcceleration?1:-1;}
if(placement===left||(placement===top||placement===bottom)&&variation===end){sideX=right;var offsetX=isFixed&&offsetParent===win&&win.visualViewport?win.visualViewport.width:offsetParent[widthProp];x-=offsetX-popperRect.width;x*=gpuAcceleration?1:-1;}}
var commonStyles=Object.assign({position:position},adaptive&&unsetSides);var _ref4=roundOffsets===true?roundOffsetsByDPR({x:x,y:y},getWindow(popper)):{x:x,y:y};x=_ref4.x;y=_ref4.y;if(gpuAcceleration){var _Object$assign;return Object.assign({},commonStyles,(_Object$assign={},_Object$assign[sideY]=hasY?'0':'',_Object$assign[sideX]=hasX?'0':'',_Object$assign.transform=(win.devicePixelRatio||1)<=1?"translate("+x+"px, "+y+"px)":"translate3d("+x+"px, "+y+"px, 0)",_Object$assign));}
return Object.assign({},commonStyles,(_Object$assign2={},_Object$assign2[sideY]=hasY?y+"px":'',_Object$assign2[sideX]=hasX?x+"px":'',_Object$assign2.transform='',_Object$assign2));}
function computeStyles(_ref5){var state=_ref5.state,options=_ref5.options;var _options$gpuAccelerat=options.gpuAcceleration,gpuAcceleration=_options$gpuAccelerat===void 0?true:_options$gpuAccelerat,_options$adaptive=options.adaptive,adaptive=_options$adaptive===void 0?true:_options$adaptive,_options$roundOffsets=options.roundOffsets,roundOffsets=_options$roundOffsets===void 0?true:_options$roundOffsets;var commonStyles={placement:getBasePlacement(state.placement),variation:getVariation(state.placement),popper:state.elements.popper,popperRect:state.rects.popper,gpuAcceleration:gpuAcceleration,isFixed:state.options.strategy==='fixed'};if(state.modifiersData.popperOffsets!=null){state.styles.popper=Object.assign({},state.styles.popper,mapToStyles(Object.assign({},commonStyles,{offsets:state.modifiersData.popperOffsets,position:state.options.strategy,adaptive:adaptive,roundOffsets:roundOffsets})));}
if(state.modifiersData.arrow!=null){state.styles.arrow=Object.assign({},state.styles.arrow,mapToStyles(Object.assign({},commonStyles,{offsets:state.modifiersData.arrow,position:'absolute',adaptive:false,roundOffsets:roundOffsets})));}
state.attributes.popper=Object.assign({},state.attributes.popper,{'data-popper-placement':state.placement});}
const computeStyles$1={name:'computeStyles',enabled:true,phase:'beforeWrite',fn:computeStyles,data:{}};var passive={passive:true};function effect(_ref){var state=_ref.state,instance=_ref.instance,options=_ref.options;var _options$scroll=options.scroll,scroll=_options$scroll===void 0?true:_options$scroll,_options$resize=options.resize,resize=_options$resize===void 0?true:_options$resize;var window=getWindow(state.elements.popper);var scrollParents=[].concat(state.scrollParents.reference,state.scrollParents.popper);if(scroll){scrollParents.forEach(function(scrollParent){scrollParent.addEventListener('scroll',instance.update,passive);});}
if(resize){window.addEventListener('resize',instance.update,passive);}
return function(){if(scroll){scrollParents.forEach(function(scrollParent){scrollParent.removeEventListener('scroll',instance.update,passive);});}
if(resize){window.removeEventListener('resize',instance.update,passive);}};}
const eventListeners={name:'eventListeners',enabled:true,phase:'write',fn:function fn(){},effect:effect,data:{}};var hash$1={left:'right',right:'left',bottom:'top',top:'bottom'};function getOppositePlacement(placement){return placement.replace(/left|right|bottom|top/g,function(matched){return hash$1[matched];});}
var hash={start:'end',end:'start'};function getOppositeVariationPlacement(placement){return placement.replace(/start|end/g,function(matched){return hash[matched];});}
function getWindowScroll(node){var win=getWindow(node);var scrollLeft=win.pageXOffset;var scrollTop=win.pageYOffset;return{scrollLeft:scrollLeft,scrollTop:scrollTop};}
function getWindowScrollBarX(element){return getBoundingClientRect(getDocumentElement(element)).left+getWindowScroll(element).scrollLeft;}
function getViewportRect(element,strategy){var win=getWindow(element);var html=getDocumentElement(element);var visualViewport=win.visualViewport;var width=html.clientWidth;var height=html.clientHeight;var x=0;var y=0;if(visualViewport){width=visualViewport.width;height=visualViewport.height;var layoutViewport=isLayoutViewport();if(layoutViewport||!layoutViewport&&strategy==='fixed'){x=visualViewport.offsetLeft;y=visualViewport.offsetTop;}}
return{width:width,height:height,x:x+getWindowScrollBarX(element),y:y};}
function getDocumentRect(element){var _element$ownerDocumen;var html=getDocumentElement(element);var winScroll=getWindowScroll(element);var body=(_element$ownerDocumen=element.ownerDocument)==null?void 0:_element$ownerDocumen.body;var width=max(html.scrollWidth,html.clientWidth,body?body.scrollWidth:0,body?body.clientWidth:0);var height=max(html.scrollHeight,html.clientHeight,body?body.scrollHeight:0,body?body.clientHeight:0);var x=-winScroll.scrollLeft+getWindowScrollBarX(element);var y=-winScroll.scrollTop;if(getComputedStyle$1(body||html).direction==='rtl'){x+=max(html.clientWidth,body?body.clientWidth:0)-width;}
return{width:width,height:height,x:x,y:y};}
function isScrollParent(element){var _getComputedStyle=getComputedStyle$1(element),overflow=_getComputedStyle.overflow,overflowX=_getComputedStyle.overflowX,overflowY=_getComputedStyle.overflowY;return /auto|scroll|overlay|hidden/.test(overflow+overflowY+overflowX);}
function getScrollParent(node){if(['html','body','#document'].indexOf(getNodeName(node))>=0){return node.ownerDocument.body;}
if(isHTMLElement(node)&&isScrollParent(node)){return node;}
return getScrollParent(getParentNode(node));}
function listScrollParents(element,list){var _element$ownerDocumen;if(list===void 0){list=[];}
var scrollParent=getScrollParent(element);var isBody=scrollParent===((_element$ownerDocumen=element.ownerDocument)==null?void 0:_element$ownerDocumen.body);var win=getWindow(scrollParent);var target=isBody?[win].concat(win.visualViewport||[],isScrollParent(scrollParent)?scrollParent:[]):scrollParent;var updatedList=list.concat(target);return isBody?updatedList:updatedList.concat(listScrollParents(getParentNode(target)));}
function rectToClientRect(rect){return Object.assign({},rect,{left:rect.x,top:rect.y,right:rect.x+rect.width,bottom:rect.y+rect.height});}
function getInnerBoundingClientRect(element,strategy){var rect=getBoundingClientRect(element,false,strategy==='fixed');rect.top=rect.top+element.clientTop;rect.left=rect.left+element.clientLeft;rect.bottom=rect.top+element.clientHeight;rect.right=rect.left+element.clientWidth;rect.width=element.clientWidth;rect.height=element.clientHeight;rect.x=rect.left;rect.y=rect.top;return rect;}
function getClientRectFromMixedType(element,clippingParent,strategy){return clippingParent===viewport?rectToClientRect(getViewportRect(element,strategy)):isElement(clippingParent)?getInnerBoundingClientRect(clippingParent,strategy):rectToClientRect(getDocumentRect(getDocumentElement(element)));}
function getClippingParents(element){var clippingParents=listScrollParents(getParentNode(element));var canEscapeClipping=['absolute','fixed'].indexOf(getComputedStyle$1(element).position)>=0;var clipperElement=canEscapeClipping&&isHTMLElement(element)?getOffsetParent(element):element;if(!isElement(clipperElement)){return[];}
return clippingParents.filter(function(clippingParent){return isElement(clippingParent)&&contains(clippingParent,clipperElement)&&getNodeName(clippingParent)!=='body';});}
function getClippingRect(element,boundary,rootBoundary,strategy){var mainClippingParents=boundary==='clippingParents'?getClippingParents(element):[].concat(boundary);var clippingParents=[].concat(mainClippingParents,[rootBoundary]);var firstClippingParent=clippingParents[0];var clippingRect=clippingParents.reduce(function(accRect,clippingParent){var rect=getClientRectFromMixedType(element,clippingParent,strategy);accRect.top=max(rect.top,accRect.top);accRect.right=min(rect.right,accRect.right);accRect.bottom=min(rect.bottom,accRect.bottom);accRect.left=max(rect.left,accRect.left);return accRect;},getClientRectFromMixedType(element,firstClippingParent,strategy));clippingRect.width=clippingRect.right-clippingRect.left;clippingRect.height=clippingRect.bottom-clippingRect.top;clippingRect.x=clippingRect.left;clippingRect.y=clippingRect.top;return clippingRect;}
function computeOffsets(_ref){var reference=_ref.reference,element=_ref.element,placement=_ref.placement;var basePlacement=placement?getBasePlacement(placement):null;var variation=placement?getVariation(placement):null;var commonX=reference.x+reference.width/2-element.width/2;var commonY=reference.y+reference.height/2-element.height/2;var offsets;switch(basePlacement){case top:offsets={x:commonX,y:reference.y-element.height};break;case bottom:offsets={x:commonX,y:reference.y+reference.height};break;case right:offsets={x:reference.x+reference.width,y:commonY};break;case left:offsets={x:reference.x-element.width,y:commonY};break;default:offsets={x:reference.x,y:reference.y};}
var mainAxis=basePlacement?getMainAxisFromPlacement(basePlacement):null;if(mainAxis!=null){var len=mainAxis==='y'?'height':'width';switch(variation){case start:offsets[mainAxis]=offsets[mainAxis]-(reference[len]/2-element[len]/2);break;case end:offsets[mainAxis]=offsets[mainAxis]+(reference[len]/2-element[len]/2);break;}}
return offsets;}
function detectOverflow(state,options){if(options===void 0){options={};}
var _options=options,_options$placement=_options.placement,placement=_options$placement===void 0?state.placement:_options$placement,_options$strategy=_options.strategy,strategy=_options$strategy===void 0?state.strategy:_options$strategy,_options$boundary=_options.boundary,boundary=_options$boundary===void 0?clippingParents:_options$boundary,_options$rootBoundary=_options.rootBoundary,rootBoundary=_options$rootBoundary===void 0?viewport:_options$rootBoundary,_options$elementConte=_options.elementContext,elementContext=_options$elementConte===void 0?popper:_options$elementConte,_options$altBoundary=_options.altBoundary,altBoundary=_options$altBoundary===void 0?false:_options$altBoundary,_options$padding=_options.padding,padding=_options$padding===void 0?0:_options$padding;var paddingObject=mergePaddingObject(typeof padding!=='number'?padding:expandToHashMap(padding,basePlacements));var altContext=elementContext===popper?reference:popper;var popperRect=state.rects.popper;var element=state.elements[altBoundary?altContext:elementContext];var clippingClientRect=getClippingRect(isElement(element)?element:element.contextElement||getDocumentElement(state.elements.popper),boundary,rootBoundary,strategy);var referenceClientRect=getBoundingClientRect(state.elements.reference);var popperOffsets=computeOffsets({reference:referenceClientRect,element:popperRect,strategy:'absolute',placement:placement});var popperClientRect=rectToClientRect(Object.assign({},popperRect,popperOffsets));var elementClientRect=elementContext===popper?popperClientRect:referenceClientRect;var overflowOffsets={top:clippingClientRect.top-elementClientRect.top+paddingObject.top,bottom:elementClientRect.bottom-clippingClientRect.bottom+paddingObject.bottom,left:clippingClientRect.left-elementClientRect.left+paddingObject.left,right:elementClientRect.right-clippingClientRect.right+paddingObject.right};var offsetData=state.modifiersData.offset;if(elementContext===popper&&offsetData){var offset=offsetData[placement];Object.keys(overflowOffsets).forEach(function(key){var multiply=[right,bottom].indexOf(key)>=0?1:-1;var axis=[top,bottom].indexOf(key)>=0?'y':'x';overflowOffsets[key]+=offset[axis]*multiply;});}
return overflowOffsets;}
function computeAutoPlacement(state,options){if(options===void 0){options={};}
var _options=options,placement=_options.placement,boundary=_options.boundary,rootBoundary=_options.rootBoundary,padding=_options.padding,flipVariations=_options.flipVariations,_options$allowedAutoP=_options.allowedAutoPlacements,allowedAutoPlacements=_options$allowedAutoP===void 0?placements:_options$allowedAutoP;var variation=getVariation(placement);var placements$1=variation?flipVariations?variationPlacements:variationPlacements.filter(function(placement){return getVariation(placement)===variation;}):basePlacements;var allowedPlacements=placements$1.filter(function(placement){return allowedAutoPlacements.indexOf(placement)>=0;});if(allowedPlacements.length===0){allowedPlacements=placements$1;}
var overflows=allowedPlacements.reduce(function(acc,placement){acc[placement]=detectOverflow(state,{placement:placement,boundary:boundary,rootBoundary:rootBoundary,padding:padding})[getBasePlacement(placement)];return acc;},{});return Object.keys(overflows).sort(function(a,b){return overflows[a]-overflows[b];});}
function getExpandedFallbackPlacements(placement){if(getBasePlacement(placement)===auto){return[];}
var oppositePlacement=getOppositePlacement(placement);return[getOppositeVariationPlacement(placement),oppositePlacement,getOppositeVariationPlacement(oppositePlacement)];}
function flip(_ref){var state=_ref.state,options=_ref.options,name=_ref.name;if(state.modifiersData[name]._skip){return;}
var _options$mainAxis=options.mainAxis,checkMainAxis=_options$mainAxis===void 0?true:_options$mainAxis,_options$altAxis=options.altAxis,checkAltAxis=_options$altAxis===void 0?true:_options$altAxis,specifiedFallbackPlacements=options.fallbackPlacements,padding=options.padding,boundary=options.boundary,rootBoundary=options.rootBoundary,altBoundary=options.altBoundary,_options$flipVariatio=options.flipVariations,flipVariations=_options$flipVariatio===void 0?true:_options$flipVariatio,allowedAutoPlacements=options.allowedAutoPlacements;var preferredPlacement=state.options.placement;var basePlacement=getBasePlacement(preferredPlacement);var isBasePlacement=basePlacement===preferredPlacement;var fallbackPlacements=specifiedFallbackPlacements||(isBasePlacement||!flipVariations?[getOppositePlacement(preferredPlacement)]:getExpandedFallbackPlacements(preferredPlacement));var placements=[preferredPlacement].concat(fallbackPlacements).reduce(function(acc,placement){return acc.concat(getBasePlacement(placement)===auto?computeAutoPlacement(state,{placement:placement,boundary:boundary,rootBoundary:rootBoundary,padding:padding,flipVariations:flipVariations,allowedAutoPlacements:allowedAutoPlacements}):placement);},[]);var referenceRect=state.rects.reference;var popperRect=state.rects.popper;var checksMap=new Map();var makeFallbackChecks=true;var firstFittingPlacement=placements[0];for(var i=0;i<placements.length;i++){var placement=placements[i];var _basePlacement=getBasePlacement(placement);var isStartVariation=getVariation(placement)===start;var isVertical=[top,bottom].indexOf(_basePlacement)>=0;var len=isVertical?'width':'height';var overflow=detectOverflow(state,{placement:placement,boundary:boundary,rootBoundary:rootBoundary,altBoundary:altBoundary,padding:padding});var mainVariationSide=isVertical?isStartVariation?right:left:isStartVariation?bottom:top;if(referenceRect[len]>popperRect[len]){mainVariationSide=getOppositePlacement(mainVariationSide);}
var altVariationSide=getOppositePlacement(mainVariationSide);var checks=[];if(checkMainAxis){checks.push(overflow[_basePlacement]<=0);}
if(checkAltAxis){checks.push(overflow[mainVariationSide]<=0,overflow[altVariationSide]<=0);}
if(checks.every(function(check){return check;})){firstFittingPlacement=placement;makeFallbackChecks=false;break;}
checksMap.set(placement,checks);}
if(makeFallbackChecks){var numberOfChecks=flipVariations?3:1;var _loop=function _loop(_i){var fittingPlacement=placements.find(function(placement){var checks=checksMap.get(placement);if(checks){return checks.slice(0,_i).every(function(check){return check;});}});if(fittingPlacement){firstFittingPlacement=fittingPlacement;return"break";}};for(var _i=numberOfChecks;_i>0;_i--){var _ret=_loop(_i);if(_ret==="break")break;}}
if(state.placement!==firstFittingPlacement){state.modifiersData[name]._skip=true;state.placement=firstFittingPlacement;state.reset=true;}}
const flip$1={name:'flip',enabled:true,phase:'main',fn:flip,requiresIfExists:['offset'],data:{_skip:false}};function getSideOffsets(overflow,rect,preventedOffsets){if(preventedOffsets===void 0){preventedOffsets={x:0,y:0};}
return{top:overflow.top-rect.height-preventedOffsets.y,right:overflow.right-rect.width+preventedOffsets.x,bottom:overflow.bottom-rect.height+preventedOffsets.y,left:overflow.left-rect.width-preventedOffsets.x};}
function isAnySideFullyClipped(overflow){return[top,right,bottom,left].some(function(side){return overflow[side]>=0;});}
function hide(_ref){var state=_ref.state,name=_ref.name;var referenceRect=state.rects.reference;var popperRect=state.rects.popper;var preventedOffsets=state.modifiersData.preventOverflow;var referenceOverflow=detectOverflow(state,{elementContext:'reference'});var popperAltOverflow=detectOverflow(state,{altBoundary:true});var referenceClippingOffsets=getSideOffsets(referenceOverflow,referenceRect);var popperEscapeOffsets=getSideOffsets(popperAltOverflow,popperRect,preventedOffsets);var isReferenceHidden=isAnySideFullyClipped(referenceClippingOffsets);var hasPopperEscaped=isAnySideFullyClipped(popperEscapeOffsets);state.modifiersData[name]={referenceClippingOffsets:referenceClippingOffsets,popperEscapeOffsets:popperEscapeOffsets,isReferenceHidden:isReferenceHidden,hasPopperEscaped:hasPopperEscaped};state.attributes.popper=Object.assign({},state.attributes.popper,{'data-popper-reference-hidden':isReferenceHidden,'data-popper-escaped':hasPopperEscaped});}
const hide$1={name:'hide',enabled:true,phase:'main',requiresIfExists:['preventOverflow'],fn:hide};function distanceAndSkiddingToXY(placement,rects,offset){var basePlacement=getBasePlacement(placement);var invertDistance=[left,top].indexOf(basePlacement)>=0?-1:1;var _ref=typeof offset==='function'?offset(Object.assign({},rects,{placement:placement})):offset,skidding=_ref[0],distance=_ref[1];skidding=skidding||0;distance=(distance||0)*invertDistance;return[left,right].indexOf(basePlacement)>=0?{x:distance,y:skidding}:{x:skidding,y:distance};}
function offset(_ref2){var state=_ref2.state,options=_ref2.options,name=_ref2.name;var _options$offset=options.offset,offset=_options$offset===void 0?[0,0]:_options$offset;var data=placements.reduce(function(acc,placement){acc[placement]=distanceAndSkiddingToXY(placement,state.rects,offset);return acc;},{});var _data$state$placement=data[state.placement],x=_data$state$placement.x,y=_data$state$placement.y;if(state.modifiersData.popperOffsets!=null){state.modifiersData.popperOffsets.x+=x;state.modifiersData.popperOffsets.y+=y;}
state.modifiersData[name]=data;}
const offset$1={name:'offset',enabled:true,phase:'main',requires:['popperOffsets'],fn:offset};function popperOffsets(_ref){var state=_ref.state,name=_ref.name;state.modifiersData[name]=computeOffsets({reference:state.rects.reference,element:state.rects.popper,strategy:'absolute',placement:state.placement});}
const popperOffsets$1={name:'popperOffsets',enabled:true,phase:'read',fn:popperOffsets,data:{}};function getAltAxis(axis){return axis==='x'?'y':'x';}
function preventOverflow(_ref){var state=_ref.state,options=_ref.options,name=_ref.name;var _options$mainAxis=options.mainAxis,checkMainAxis=_options$mainAxis===void 0?true:_options$mainAxis,_options$altAxis=options.altAxis,checkAltAxis=_options$altAxis===void 0?false:_options$altAxis,boundary=options.boundary,rootBoundary=options.rootBoundary,altBoundary=options.altBoundary,padding=options.padding,_options$tether=options.tether,tether=_options$tether===void 0?true:_options$tether,_options$tetherOffset=options.tetherOffset,tetherOffset=_options$tetherOffset===void 0?0:_options$tetherOffset;var overflow=detectOverflow(state,{boundary:boundary,rootBoundary:rootBoundary,padding:padding,altBoundary:altBoundary});var basePlacement=getBasePlacement(state.placement);var variation=getVariation(state.placement);var isBasePlacement=!variation;var mainAxis=getMainAxisFromPlacement(basePlacement);var altAxis=getAltAxis(mainAxis);var popperOffsets=state.modifiersData.popperOffsets;var referenceRect=state.rects.reference;var popperRect=state.rects.popper;var tetherOffsetValue=typeof tetherOffset==='function'?tetherOffset(Object.assign({},state.rects,{placement:state.placement})):tetherOffset;var normalizedTetherOffsetValue=typeof tetherOffsetValue==='number'?{mainAxis:tetherOffsetValue,altAxis:tetherOffsetValue}:Object.assign({mainAxis:0,altAxis:0},tetherOffsetValue);var offsetModifierState=state.modifiersData.offset?state.modifiersData.offset[state.placement]:null;var data={x:0,y:0};if(!popperOffsets){return;}
if(checkMainAxis){var _offsetModifierState$;var mainSide=mainAxis==='y'?top:left;var altSide=mainAxis==='y'?bottom:right;var len=mainAxis==='y'?'height':'width';var offset=popperOffsets[mainAxis];var min$1=offset+overflow[mainSide];var max$1=offset-overflow[altSide];var additive=tether?-popperRect[len]/2:0;var minLen=variation===start?referenceRect[len]:popperRect[len];var maxLen=variation===start?-popperRect[len]:-referenceRect[len];var arrowElement=state.elements.arrow;var arrowRect=tether&&arrowElement?getLayoutRect(arrowElement):{width:0,height:0};var arrowPaddingObject=state.modifiersData['arrow#persistent']?state.modifiersData['arrow#persistent'].padding:getFreshSideObject();var arrowPaddingMin=arrowPaddingObject[mainSide];var arrowPaddingMax=arrowPaddingObject[altSide];var arrowLen=within(0,referenceRect[len],arrowRect[len]);var minOffset=isBasePlacement?referenceRect[len]/2-additive-arrowLen-arrowPaddingMin-normalizedTetherOffsetValue.mainAxis:minLen-arrowLen-arrowPaddingMin-normalizedTetherOffsetValue.mainAxis;var maxOffset=isBasePlacement?-referenceRect[len]/2+additive+arrowLen+arrowPaddingMax+normalizedTetherOffsetValue.mainAxis:maxLen+arrowLen+arrowPaddingMax+normalizedTetherOffsetValue.mainAxis;var arrowOffsetParent=state.elements.arrow&&getOffsetParent(state.elements.arrow);var clientOffset=arrowOffsetParent?mainAxis==='y'?arrowOffsetParent.clientTop||0:arrowOffsetParent.clientLeft||0:0;var offsetModifierValue=(_offsetModifierState$=offsetModifierState==null?void 0:offsetModifierState[mainAxis])!=null?_offsetModifierState$:0;var tetherMin=offset+minOffset-offsetModifierValue-clientOffset;var tetherMax=offset+maxOffset-offsetModifierValue;var preventedOffset=within(tether?min(min$1,tetherMin):min$1,offset,tether?max(max$1,tetherMax):max$1);popperOffsets[mainAxis]=preventedOffset;data[mainAxis]=preventedOffset-offset;}
if(checkAltAxis){var _offsetModifierState$2;var _mainSide=mainAxis==='x'?top:left;var _altSide=mainAxis==='x'?bottom:right;var _offset=popperOffsets[altAxis];var _len=altAxis==='y'?'height':'width';var _min=_offset+overflow[_mainSide];var _max=_offset-overflow[_altSide];var isOriginSide=[top,left].indexOf(basePlacement)!==-1;var _offsetModifierValue=(_offsetModifierState$2=offsetModifierState==null?void 0:offsetModifierState[altAxis])!=null?_offsetModifierState$2:0;var _tetherMin=isOriginSide?_min:_offset-referenceRect[_len]-popperRect[_len]-_offsetModifierValue+normalizedTetherOffsetValue.altAxis;var _tetherMax=isOriginSide?_offset+referenceRect[_len]+popperRect[_len]-_offsetModifierValue-normalizedTetherOffsetValue.altAxis:_max;var _preventedOffset=tether&&isOriginSide?withinMaxClamp(_tetherMin,_offset,_tetherMax):within(tether?_tetherMin:_min,_offset,tether?_tetherMax:_max);popperOffsets[altAxis]=_preventedOffset;data[altAxis]=_preventedOffset-_offset;}
state.modifiersData[name]=data;}
const preventOverflow$1={name:'preventOverflow',enabled:true,phase:'main',fn:preventOverflow,requiresIfExists:['offset']};function getHTMLElementScroll(element){return{scrollLeft:element.scrollLeft,scrollTop:element.scrollTop};}
function getNodeScroll(node){if(node===getWindow(node)||!isHTMLElement(node)){return getWindowScroll(node);}else{return getHTMLElementScroll(node);}}
function isElementScaled(element){var rect=element.getBoundingClientRect();var scaleX=round(rect.width)/element.offsetWidth||1;var scaleY=round(rect.height)/element.offsetHeight||1;return scaleX!==1||scaleY!==1;}
function getCompositeRect(elementOrVirtualElement,offsetParent,isFixed){if(isFixed===void 0){isFixed=false;}
var isOffsetParentAnElement=isHTMLElement(offsetParent);var offsetParentIsScaled=isHTMLElement(offsetParent)&&isElementScaled(offsetParent);var documentElement=getDocumentElement(offsetParent);var rect=getBoundingClientRect(elementOrVirtualElement,offsetParentIsScaled,isFixed);var scroll={scrollLeft:0,scrollTop:0};var offsets={x:0,y:0};if(isOffsetParentAnElement||!isOffsetParentAnElement&&!isFixed){if(getNodeName(offsetParent)!=='body'||isScrollParent(documentElement)){scroll=getNodeScroll(offsetParent);}
if(isHTMLElement(offsetParent)){offsets=getBoundingClientRect(offsetParent,true);offsets.x+=offsetParent.clientLeft;offsets.y+=offsetParent.clientTop;}else if(documentElement){offsets.x=getWindowScrollBarX(documentElement);}}
return{x:rect.left+scroll.scrollLeft-offsets.x,y:rect.top+scroll.scrollTop-offsets.y,width:rect.width,height:rect.height};}
function order(modifiers){var map=new Map();var visited=new Set();var result=[];modifiers.forEach(function(modifier){map.set(modifier.name,modifier);});function sort(modifier){visited.add(modifier.name);var requires=[].concat(modifier.requires||[],modifier.requiresIfExists||[]);requires.forEach(function(dep){if(!visited.has(dep)){var depModifier=map.get(dep);if(depModifier){sort(depModifier);}}});result.push(modifier);}
modifiers.forEach(function(modifier){if(!visited.has(modifier.name)){sort(modifier);}});return result;}
function orderModifiers(modifiers){var orderedModifiers=order(modifiers);return modifierPhases.reduce(function(acc,phase){return acc.concat(orderedModifiers.filter(function(modifier){return modifier.phase===phase;}));},[]);}
function debounce(fn){var pending;return function(){if(!pending){pending=new Promise(function(resolve){Promise.resolve().then(function(){pending=undefined;resolve(fn());});});}
return pending;};}
function mergeByName(modifiers){var merged=modifiers.reduce(function(merged,current){var existing=merged[current.name];merged[current.name]=existing?Object.assign({},existing,current,{options:Object.assign({},existing.options,current.options),data:Object.assign({},existing.data,current.data)}):current;return merged;},{});return Object.keys(merged).map(function(key){return merged[key];});}
var DEFAULT_OPTIONS={placement:'bottom',modifiers:[],strategy:'absolute'};function areValidElements(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}
return!args.some(function(element){return!(element&&typeof element.getBoundingClientRect==='function');});}
function popperGenerator(generatorOptions){if(generatorOptions===void 0){generatorOptions={};}
var _generatorOptions=generatorOptions,_generatorOptions$def=_generatorOptions.defaultModifiers,defaultModifiers=_generatorOptions$def===void 0?[]:_generatorOptions$def,_generatorOptions$def2=_generatorOptions.defaultOptions,defaultOptions=_generatorOptions$def2===void 0?DEFAULT_OPTIONS:_generatorOptions$def2;return function createPopper(reference,popper,options){if(options===void 0){options=defaultOptions;}
var state={placement:'bottom',orderedModifiers:[],options:Object.assign({},DEFAULT_OPTIONS,defaultOptions),modifiersData:{},elements:{reference:reference,popper:popper},attributes:{},styles:{}};var effectCleanupFns=[];var isDestroyed=false;var instance={state:state,setOptions:function setOptions(setOptionsAction){var options=typeof setOptionsAction==='function'?setOptionsAction(state.options):setOptionsAction;cleanupModifierEffects();state.options=Object.assign({},defaultOptions,state.options,options);state.scrollParents={reference:isElement(reference)?listScrollParents(reference):reference.contextElement?listScrollParents(reference.contextElement):[],popper:listScrollParents(popper)};var orderedModifiers=orderModifiers(mergeByName([].concat(defaultModifiers,state.options.modifiers)));state.orderedModifiers=orderedModifiers.filter(function(m){return m.enabled;});runModifierEffects();return instance.update();},forceUpdate:function forceUpdate(){if(isDestroyed){return;}
var _state$elements=state.elements,reference=_state$elements.reference,popper=_state$elements.popper;if(!areValidElements(reference,popper)){return;}
state.rects={reference:getCompositeRect(reference,getOffsetParent(popper),state.options.strategy==='fixed'),popper:getLayoutRect(popper)};state.reset=false;state.placement=state.options.placement;state.orderedModifiers.forEach(function(modifier){return state.modifiersData[modifier.name]=Object.assign({},modifier.data);});for(var index=0;index<state.orderedModifiers.length;index++){if(state.reset===true){state.reset=false;index=-1;continue;}
var _state$orderedModifie=state.orderedModifiers[index],fn=_state$orderedModifie.fn,_state$orderedModifie2=_state$orderedModifie.options,_options=_state$orderedModifie2===void 0?{}:_state$orderedModifie2,name=_state$orderedModifie.name;if(typeof fn==='function'){state=fn({state:state,options:_options,name:name,instance:instance})||state;}}},update:debounce(function(){return new Promise(function(resolve){instance.forceUpdate();resolve(state);});}),destroy:function destroy(){cleanupModifierEffects();isDestroyed=true;}};if(!areValidElements(reference,popper)){return instance;}
instance.setOptions(options).then(function(state){if(!isDestroyed&&options.onFirstUpdate){options.onFirstUpdate(state);}});function runModifierEffects(){state.orderedModifiers.forEach(function(_ref){var name=_ref.name,_ref$options=_ref.options,options=_ref$options===void 0?{}:_ref$options,effect=_ref.effect;if(typeof effect==='function'){var cleanupFn=effect({state:state,name:name,instance:instance,options:options});var noopFn=function noopFn(){};effectCleanupFns.push(cleanupFn||noopFn);}});}
function cleanupModifierEffects(){effectCleanupFns.forEach(function(fn){return fn();});effectCleanupFns=[];}
return instance;};}
var createPopper$2=popperGenerator();var defaultModifiers$1=[eventListeners,popperOffsets$1,computeStyles$1,applyStyles$1];var createPopper$1=popperGenerator({defaultModifiers:defaultModifiers$1});var defaultModifiers=[eventListeners,popperOffsets$1,computeStyles$1,applyStyles$1,offset$1,flip$1,preventOverflow$1,arrow$1,hide$1];var createPopper=popperGenerator({defaultModifiers:defaultModifiers});const Popper=Object.freeze(Object.defineProperty({__proto__:null,afterMain,afterRead,afterWrite,applyStyles:applyStyles$1,arrow:arrow$1,auto,basePlacements,beforeMain,beforeRead,beforeWrite,bottom,clippingParents,computeStyles:computeStyles$1,createPopper,createPopperBase:createPopper$2,createPopperLite:createPopper$1,detectOverflow,end,eventListeners,flip:flip$1,hide:hide$1,left,main,modifierPhases,offset:offset$1,placements,popper,popperGenerator,popperOffsets:popperOffsets$1,preventOverflow:preventOverflow$1,read,reference,right,start,top,variationPlacements,viewport,write},Symbol.toStringTag,{value:'Module'}));const NAME$a='dropdown';const DATA_KEY$6='bs.dropdown';const EVENT_KEY$6=`.${DATA_KEY$6}`;const DATA_API_KEY$3='.data-api';const ESCAPE_KEY$2='Escape';const TAB_KEY$1='Tab';const ARROW_UP_KEY$1='ArrowUp';const ARROW_DOWN_KEY$1='ArrowDown';const RIGHT_MOUSE_BUTTON=2;const EVENT_HIDE$5=`hide${EVENT_KEY$6}`;const EVENT_HIDDEN$5=`hidden${EVENT_KEY$6}`;const EVENT_SHOW$5=`show${EVENT_KEY$6}`;const EVENT_SHOWN$5=`shown${EVENT_KEY$6}`;const EVENT_CLICK_DATA_API$3=`click${EVENT_KEY$6}${DATA_API_KEY$3}`;const EVENT_KEYDOWN_DATA_API=`keydown${EVENT_KEY$6}${DATA_API_KEY$3}`;const EVENT_KEYUP_DATA_API=`keyup${EVENT_KEY$6}${DATA_API_KEY$3}`;const CLASS_NAME_SHOW$6='show';const CLASS_NAME_DROPUP='dropup';const CLASS_NAME_DROPEND='dropend';const CLASS_NAME_DROPSTART='dropstart';const CLASS_NAME_DROPUP_CENTER='dropup-center';const CLASS_NAME_DROPDOWN_CENTER='dropdown-center';const SELECTOR_DATA_TOGGLE$3='[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)';const SELECTOR_DATA_TOGGLE_SHOWN=`${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`;const SELECTOR_MENU='.dropdown-menu';const SELECTOR_NAVBAR='.navbar';const SELECTOR_NAVBAR_NAV='.navbar-nav';const SELECTOR_VISIBLE_ITEMS='.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';const PLACEMENT_TOP=isRTL()?'top-end':'top-start';const PLACEMENT_TOPEND=isRTL()?'top-start':'top-end';const PLACEMENT_BOTTOM=isRTL()?'bottom-end':'bottom-start';const PLACEMENT_BOTTOMEND=isRTL()?'bottom-start':'bottom-end';const PLACEMENT_RIGHT=isRTL()?'left-start':'right-start';const PLACEMENT_LEFT=isRTL()?'right-start':'left-start';const PLACEMENT_TOPCENTER='top';const PLACEMENT_BOTTOMCENTER='bottom';const Default$9={autoClose:true,boundary:'clippingParents',display:'dynamic',offset:[0,2],popperConfig:null,reference:'toggle'};const DefaultType$9={autoClose:'(boolean|string)',boundary:'(string|element)',display:'string',offset:'(array|string|function)',popperConfig:'(null|object|function)',reference:'(string|element|object)'};class Dropdown extends BaseComponent{constructor(element,config){super(element,config);this._popper=null;this._parent=this._element.parentNode;this._menu=SelectorEngine.next(this._element,SELECTOR_MENU)[0]||SelectorEngine.prev(this._element,SELECTOR_MENU)[0]||SelectorEngine.findOne(SELECTOR_MENU,this._parent);this._inNavbar=this._detectNavbar();}
static get Default(){return Default$9;}
static get DefaultType(){return DefaultType$9;}
static get NAME(){return NAME$a;}
toggle(){return this._isShown()?this.hide():this.show();}
show(){if(isDisabled(this._element)||this._isShown()){return;}
const relatedTarget={relatedTarget:this._element};const showEvent=EventHandler.trigger(this._element,EVENT_SHOW$5,relatedTarget);if(showEvent.defaultPrevented){return;}
this._createPopper();if('ontouchstart' in document.documentElement&&!this._parent.closest(SELECTOR_NAVBAR_NAV)){for(const element of[].concat(...document.body.children)){EventHandler.on(element,'mouseover',noop);}}
this._element.focus();this._element.setAttribute('aria-expanded',true);this._menu.classList.add(CLASS_NAME_SHOW$6);this._element.classList.add(CLASS_NAME_SHOW$6);EventHandler.trigger(this._element,EVENT_SHOWN$5,relatedTarget);}
hide(){if(isDisabled(this._element)||!this._isShown()){return;}
const relatedTarget={relatedTarget:this._element};this._completeHide(relatedTarget);}
dispose(){if(this._popper){this._popper.destroy();}
super.dispose();}
update(){this._inNavbar=this._detectNavbar();if(this._popper){this._popper.update();}}
_completeHide(relatedTarget){const hideEvent=EventHandler.trigger(this._element,EVENT_HIDE$5,relatedTarget);if(hideEvent.defaultPrevented){return;}
if('ontouchstart' in document.documentElement){for(const element of[].concat(...document.body.children)){EventHandler.off(element,'mouseover',noop);}}
if(this._popper){this._popper.destroy();}
this._menu.classList.remove(CLASS_NAME_SHOW$6);this._element.classList.remove(CLASS_NAME_SHOW$6);this._element.setAttribute('aria-expanded','false');Manipulator.removeDataAttribute(this._menu,'popper');EventHandler.trigger(this._element,EVENT_HIDDEN$5,relatedTarget);}
_getConfig(config){config=super._getConfig(config);if(typeof config.reference==='object'&&!isElement$1(config.reference)&&typeof config.reference.getBoundingClientRect!=='function'){throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);}
return config;}
_createPopper(){if(typeof Popper==='undefined'){throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');}
let referenceElement=this._element;if(this._config.reference==='parent'){referenceElement=this._parent;}else if(isElement$1(this._config.reference)){referenceElement=getElement(this._config.reference);}else if(typeof this._config.reference==='object'){referenceElement=this._config.reference;}
const popperConfig=this._getPopperConfig();this._popper=createPopper(referenceElement,this._menu,popperConfig);}
_isShown(){return this._menu.classList.contains(CLASS_NAME_SHOW$6);}
_getPlacement(){const parentDropdown=this._parent;if(parentDropdown.classList.contains(CLASS_NAME_DROPEND)){return PLACEMENT_RIGHT;}
if(parentDropdown.classList.contains(CLASS_NAME_DROPSTART)){return PLACEMENT_LEFT;}
if(parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)){return PLACEMENT_TOPCENTER;}
if(parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)){return PLACEMENT_BOTTOMCENTER;}
const isEnd=getComputedStyle(this._menu).getPropertyValue('--bs-position').trim()==='end';if(parentDropdown.classList.contains(CLASS_NAME_DROPUP)){return isEnd?PLACEMENT_TOPEND:PLACEMENT_TOP;}
return isEnd?PLACEMENT_BOTTOMEND:PLACEMENT_BOTTOM;}
_detectNavbar(){return this._element.closest(SELECTOR_NAVBAR)!==null;}
_getOffset(){const{offset}=this._config;if(typeof offset==='string'){return offset.split(',').map(value=>Number.parseInt(value,10));}
if(typeof offset==='function'){return popperData=>offset(popperData,this._element);}
return offset;}
_getPopperConfig(){const defaultBsPopperConfig={placement:this._getPlacement(),modifiers:[{name:'preventOverflow',options:{boundary:this._config.boundary}},{name:'offset',options:{offset:this._getOffset()}}]};if(this._inNavbar||this._config.display==='static'){Manipulator.setDataAttribute(this._menu,'popper','static');defaultBsPopperConfig.modifiers=[{name:'applyStyles',enabled:false}];}
return{...defaultBsPopperConfig,...execute(this._config.popperConfig,[defaultBsPopperConfig])};}
_selectMenuItem({key,target}){const items=SelectorEngine.find(SELECTOR_VISIBLE_ITEMS,this._menu).filter(element=>isVisible(element));if(!items.length){return;}
getNextActiveElement(items,target,key===ARROW_DOWN_KEY$1,!items.includes(target)).focus();}
static jQueryInterface(config){return this.each(function(){const data=Dropdown.getOrCreateInstance(this,config);if(typeof config!=='string'){return;}
if(typeof data[config]==='undefined'){throw new TypeError(`No method named "${config}"`);}
data[config]();});}
static clearMenus(event){if(event.button===RIGHT_MOUSE_BUTTON||event.type==='keyup'&&event.key!==TAB_KEY$1){return;}
const openToggles=SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN);for(const toggle of openToggles){const context=Dropdown.getInstance(toggle);if(!context||context._config.autoClose===false){continue;}
const composedPath=event.composedPath();const isMenuTarget=composedPath.includes(context._menu);if(composedPath.includes(context._element)||context._config.autoClose==='inside'&&!isMenuTarget||context._config.autoClose==='outside'&&isMenuTarget){continue;}
if(context._menu.contains(event.target)&&(event.type==='keyup'&&event.key===TAB_KEY$1||/input|select|option|textarea|form/i.test(event.target.tagName))){continue;}
const relatedTarget={relatedTarget:context._element};if(event.type==='click'){relatedTarget.clickEvent=event;}
context._completeHide(relatedTarget);}}
static dataApiKeydownHandler(event){const isInput=/input|textarea/i.test(event.target.tagName);const isEscapeEvent=event.key===ESCAPE_KEY$2;const isUpOrDownEvent=[ARROW_UP_KEY$1,ARROW_DOWN_KEY$1].includes(event.key);if(!isUpOrDownEvent&&!isEscapeEvent){return;}
if(isInput&&!isEscapeEvent){return;}
event.preventDefault();const getToggleButton=this.matches(SELECTOR_DATA_TOGGLE$3)?this:SelectorEngine.prev(this,SELECTOR_DATA_TOGGLE$3)[0]||SelectorEngine.next(this,SELECTOR_DATA_TOGGLE$3)[0]||SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3,event.delegateTarget.parentNode);const instance=Dropdown.getOrCreateInstance(getToggleButton);if(isUpOrDownEvent){event.stopPropagation();instance.show();instance._selectMenuItem(event);return;}
if(instance._isShown()){event.stopPropagation();instance.hide();getToggleButton.focus();}}}
EventHandler.on(document,EVENT_KEYDOWN_DATA_API,SELECTOR_DATA_TOGGLE$3,Dropdown.dataApiKeydownHandler);EventHandler.on(document,EVENT_KEYDOWN_DATA_API,SELECTOR_MENU,Dropdown.dataApiKeydownHandler);EventHandler.on(document,EVENT_CLICK_DATA_API$3,Dropdown.clearMenus);EventHandler.on(document,EVENT_KEYUP_DATA_API,Dropdown.clearMenus);EventHandler.on(document,EVENT_CLICK_DATA_API$3,SELECTOR_DATA_TOGGLE$3,function(event){event.preventDefault();Dropdown.getOrCreateInstance(this).toggle();});defineJQueryPlugin(Dropdown);const NAME$9='backdrop';const CLASS_NAME_FADE$4='fade';const CLASS_NAME_SHOW$5='show';const EVENT_MOUSEDOWN=`mousedown.bs.${NAME$9}`;const Default$8={className:'modal-backdrop',clickCallback:null,isAnimated:false,isVisible:true,rootElement:'body'};const DefaultType$8={className:'string',clickCallback:'(function|null)',isAnimated:'boolean',isVisible:'boolean',rootElement:'(element|string)'};class Backdrop extends Config{constructor(config){super();this._config=this._getConfig(config);this._isAppended=false;this._element=null;}
static get Default(){return Default$8;}
static get DefaultType(){return DefaultType$8;}
static get NAME(){return NAME$9;}
show(callback){if(!this._config.isVisible){execute(callback);return;}
this._append();const element=this._getElement();if(this._config.isAnimated){reflow(element);}
element.classList.add(CLASS_NAME_SHOW$5);this._emulateAnimation(()=>{execute(callback);});}
hide(callback){if(!this._config.isVisible){execute(callback);return;}
this._getElement().classList.remove(CLASS_NAME_SHOW$5);this._emulateAnimation(()=>{this.dispose();execute(callback);});}
dispose(){if(!this._isAppended){return;}
EventHandler.off(this._element,EVENT_MOUSEDOWN);this._element.remove();this._isAppended=false;}
_getElement(){if(!this._element){const backdrop=document.createElement('div');backdrop.className=this._config.className;if(this._config.isAnimated){backdrop.classList.add(CLASS_NAME_FADE$4);}
this._element=backdrop;}
return this._element;}
_configAfterMerge(config){config.rootElement=getElement(config.rootElement);return config;}
_append(){if(this._isAppended){return;}
const element=this._getElement();this._config.rootElement.append(element);EventHandler.on(element,EVENT_MOUSEDOWN,()=>{execute(this._config.clickCallback);});this._isAppended=true;}
_emulateAnimation(callback){executeAfterTransition(callback,this._getElement(),this._config.isAnimated);}}
const NAME$8='focustrap';const DATA_KEY$5='bs.focustrap';const EVENT_KEY$5=`.${DATA_KEY$5}`;const EVENT_FOCUSIN$2=`focusin${EVENT_KEY$5}`;const EVENT_KEYDOWN_TAB=`keydown.tab${EVENT_KEY$5}`;const TAB_KEY='Tab';const TAB_NAV_FORWARD='forward';const TAB_NAV_BACKWARD='backward';const Default$7={autofocus:true,trapElement:null};const DefaultType$7={autofocus:'boolean',trapElement:'element'};class FocusTrap extends Config{constructor(config){super();this._config=this._getConfig(config);this._isActive=false;this._lastTabNavDirection=null;}
static get Default(){return Default$7;}
static get DefaultType(){return DefaultType$7;}
static get NAME(){return NAME$8;}
activate(){if(this._isActive){return;}
if(this._config.autofocus){this._config.trapElement.focus();}
EventHandler.off(document,EVENT_KEY$5);EventHandler.on(document,EVENT_FOCUSIN$2,event=>this._handleFocusin(event));EventHandler.on(document,EVENT_KEYDOWN_TAB,event=>this._handleKeydown(event));this._isActive=true;}
deactivate(){if(!this._isActive){return;}
this._isActive=false;EventHandler.off(document,EVENT_KEY$5);}
_handleFocusin(event){const{trapElement}=this._config;if(event.target===document||event.target===trapElement||trapElement.contains(event.target)){return;}
const elements=SelectorEngine.focusableChildren(trapElement);if(elements.length===0){trapElement.focus();}else if(this._lastTabNavDirection===TAB_NAV_BACKWARD){elements[elements.length-1].focus();}else{elements[0].focus();}}
_handleKeydown(event){if(event.key!==TAB_KEY){return;}
this._lastTabNavDirection=event.shiftKey?TAB_NAV_BACKWARD:TAB_NAV_FORWARD;}}
const SELECTOR_FIXED_CONTENT='.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';const SELECTOR_STICKY_CONTENT='.sticky-top';const PROPERTY_PADDING='padding-right';const PROPERTY_MARGIN='margin-right';class ScrollBarHelper{constructor(){this._element=document.body;}
getWidth(){const documentWidth=document.documentElement.clientWidth;return Math.abs(window.innerWidth-documentWidth);}
hide(){const width=this.getWidth();this._disableOverFlow();this._setElementAttributes(this._element,PROPERTY_PADDING,calculatedValue=>calculatedValue+width);this._setElementAttributes(SELECTOR_FIXED_CONTENT,PROPERTY_PADDING,calculatedValue=>calculatedValue+width);this._setElementAttributes(SELECTOR_STICKY_CONTENT,PROPERTY_MARGIN,calculatedValue=>calculatedValue-width);}
reset(){this._resetElementAttributes(this._element,'overflow');this._resetElementAttributes(this._element,PROPERTY_PADDING);this._resetElementAttributes(SELECTOR_FIXED_CONTENT,PROPERTY_PADDING);this._resetElementAttributes(SELECTOR_STICKY_CONTENT,PROPERTY_MARGIN);}
isOverflowing(){return this.getWidth()>0;}
_disableOverFlow(){this._saveInitialAttribute(this._element,'overflow');this._element.style.overflow='hidden';}
_setElementAttributes(selector,styleProperty,callback){const scrollbarWidth=this.getWidth();const manipulationCallBack=element=>{if(element!==this._element&&window.innerWidth>element.clientWidth+scrollbarWidth){return;}
this._saveInitialAttribute(element,styleProperty);const calculatedValue=window.getComputedStyle(element).getPropertyValue(styleProperty);element.style.setProperty(styleProperty,`${callback(Number.parseFloat(calculatedValue))}px`);};this._applyManipulationCallback(selector,manipulationCallBack);}
_saveInitialAttribute(element,styleProperty){const actualValue=element.style.getPropertyValue(styleProperty);if(actualValue){Manipulator.setDataAttribute(element,styleProperty,actualValue);}}
_resetElementAttributes(selector,styleProperty){const manipulationCallBack=element=>{const value=Manipulator.getDataAttribute(element,styleProperty);if(value===null){element.style.removeProperty(styleProperty);return;}
Manipulator.removeDataAttribute(element,styleProperty);element.style.setProperty(styleProperty,value);};this._applyManipulationCallback(selector,manipulationCallBack);}
_applyManipulationCallback(selector,callBack){if(isElement$1(selector)){callBack(selector);return;}
for(const sel of SelectorEngine.find(selector,this._element)){callBack(sel);}}}
const NAME$7='modal';const DATA_KEY$4='bs.modal';const EVENT_KEY$4=`.${DATA_KEY$4}`;const DATA_API_KEY$2='.data-api';const ESCAPE_KEY$1='Escape';const EVENT_HIDE$4=`hide${EVENT_KEY$4}`;const EVENT_HIDE_PREVENTED$1=`hidePrevented${EVENT_KEY$4}`;const EVENT_HIDDEN$4=`hidden${EVENT_KEY$4}`;const EVENT_SHOW$4=`show${EVENT_KEY$4}`;const EVENT_SHOWN$4=`shown${EVENT_KEY$4}`;const EVENT_RESIZE$1=`resize${EVENT_KEY$4}`;const EVENT_CLICK_DISMISS=`click.dismiss${EVENT_KEY$4}`;const EVENT_MOUSEDOWN_DISMISS=`mousedown.dismiss${EVENT_KEY$4}`;const EVENT_KEYDOWN_DISMISS$1=`keydown.dismiss${EVENT_KEY$4}`;const EVENT_CLICK_DATA_API$2=`click${EVENT_KEY$4}${DATA_API_KEY$2}`;const CLASS_NAME_OPEN='modal-open';const CLASS_NAME_FADE$3='fade';const CLASS_NAME_SHOW$4='show';const CLASS_NAME_STATIC='modal-static';const OPEN_SELECTOR$1='.modal.show';const SELECTOR_DIALOG='.modal-dialog';const SELECTOR_MODAL_BODY='.modal-body';const SELECTOR_DATA_TOGGLE$2='[data-bs-toggle="modal"]';const Default$6={backdrop:true,focus:true,keyboard:true};const DefaultType$6={backdrop:'(boolean|string)',focus:'boolean',keyboard:'boolean'};class Modal extends BaseComponent{constructor(element,config){super(element,config);this._dialog=SelectorEngine.findOne(SELECTOR_DIALOG,this._element);this._backdrop=this._initializeBackDrop();this._focustrap=this._initializeFocusTrap();this._isShown=false;this._isTransitioning=false;this._scrollBar=new ScrollBarHelper();this._addEventListeners();}
static get Default(){return Default$6;}
static get DefaultType(){return DefaultType$6;}
static get NAME(){return NAME$7;}
toggle(relatedTarget){return this._isShown?this.hide():this.show(relatedTarget);}
show(relatedTarget){if(this._isShown||this._isTransitioning){return;}
const showEvent=EventHandler.trigger(this._element,EVENT_SHOW$4,{relatedTarget});if(showEvent.defaultPrevented){return;}
this._isShown=true;this._isTransitioning=true;this._scrollBar.hide();document.body.classList.add(CLASS_NAME_OPEN);this._adjustDialog();this._backdrop.show(()=>this._showElement(relatedTarget));}
hide(){if(!this._isShown||this._isTransitioning){return;}
const hideEvent=EventHandler.trigger(this._element,EVENT_HIDE$4);if(hideEvent.defaultPrevented){return;}
this._isShown=false;this._isTransitioning=true;this._focustrap.deactivate();this._element.classList.remove(CLASS_NAME_SHOW$4);this._queueCallback(()=>this._hideModal(),this._element,this._isAnimated());}
dispose(){EventHandler.off(window,EVENT_KEY$4);EventHandler.off(this._dialog,EVENT_KEY$4);this._backdrop.dispose();this._focustrap.deactivate();super.dispose();}
handleUpdate(){this._adjustDialog();}
_initializeBackDrop(){return new Backdrop({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()});}
_initializeFocusTrap(){return new FocusTrap({trapElement:this._element});}
_showElement(relatedTarget){if(!document.body.contains(this._element)){document.body.append(this._element);}
this._element.style.display='block';this._element.removeAttribute('aria-hidden');this._element.setAttribute('aria-modal',true);this._element.setAttribute('role','dialog');this._element.scrollTop=0;const modalBody=SelectorEngine.findOne(SELECTOR_MODAL_BODY,this._dialog);if(modalBody){modalBody.scrollTop=0;}
reflow(this._element);this._element.classList.add(CLASS_NAME_SHOW$4);const transitionComplete=()=>{if(this._config.focus){this._focustrap.activate();}
this._isTransitioning=false;EventHandler.trigger(this._element,EVENT_SHOWN$4,{relatedTarget});};this._queueCallback(transitionComplete,this._dialog,this._isAnimated());}
_addEventListeners(){EventHandler.on(this._element,EVENT_KEYDOWN_DISMISS$1,event=>{if(event.key!==ESCAPE_KEY$1){return;}
if(this._config.keyboard){this.hide();return;}
this._triggerBackdropTransition();});EventHandler.on(window,EVENT_RESIZE$1,()=>{if(this._isShown&&!this._isTransitioning){this._adjustDialog();}});EventHandler.on(this._element,EVENT_MOUSEDOWN_DISMISS,event=>{EventHandler.one(this._element,EVENT_CLICK_DISMISS,event2=>{if(this._element!==event.target||this._element!==event2.target){return;}
if(this._config.backdrop==='static'){this._triggerBackdropTransition();return;}
if(this._config.backdrop){this.hide();}});});}
_hideModal(){this._element.style.display='none';this._element.setAttribute('aria-hidden',true);this._element.removeAttribute('aria-modal');this._element.removeAttribute('role');this._isTransitioning=false;this._backdrop.hide(()=>{document.body.classList.remove(CLASS_NAME_OPEN);this._resetAdjustments();this._scrollBar.reset();EventHandler.trigger(this._element,EVENT_HIDDEN$4);});}
_isAnimated(){return this._element.classList.contains(CLASS_NAME_FADE$3);}
_triggerBackdropTransition(){const hideEvent=EventHandler.trigger(this._element,EVENT_HIDE_PREVENTED$1);if(hideEvent.defaultPrevented){return;}
const isModalOverflowing=this._element.scrollHeight>document.documentElement.clientHeight;const initialOverflowY=this._element.style.overflowY;if(initialOverflowY==='hidden'||this._element.classList.contains(CLASS_NAME_STATIC)){return;}
if(!isModalOverflowing){this._element.style.overflowY='hidden';}
this._element.classList.add(CLASS_NAME_STATIC);this._queueCallback(()=>{this._element.classList.remove(CLASS_NAME_STATIC);this._queueCallback(()=>{this._element.style.overflowY=initialOverflowY;},this._dialog);},this._dialog);this._element.focus();}
_adjustDialog(){const isModalOverflowing=this._element.scrollHeight>document.documentElement.clientHeight;const scrollbarWidth=this._scrollBar.getWidth();const isBodyOverflowing=scrollbarWidth>0;if(isBodyOverflowing&&!isModalOverflowing){const property=isRTL()?'paddingLeft':'paddingRight';this._element.style[property]=`${scrollbarWidth}px`;}
if(!isBodyOverflowing&&isModalOverflowing){const property=isRTL()?'paddingRight':'paddingLeft';this._element.style[property]=`${scrollbarWidth}px`;}}
_resetAdjustments(){this._element.style.paddingLeft='';this._element.style.paddingRight='';}
static jQueryInterface(config,relatedTarget){return this.each(function(){const data=Modal.getOrCreateInstance(this,config);if(typeof config!=='string'){return;}
if(typeof data[config]==='undefined'){throw new TypeError(`No method named "${config}"`);}
data[config](relatedTarget);});}}
EventHandler.on(document,EVENT_CLICK_DATA_API$2,SELECTOR_DATA_TOGGLE$2,function(event){const target=SelectorEngine.getElementFromSelector(this);if(['A','AREA'].includes(this.tagName)){event.preventDefault();}
EventHandler.one(target,EVENT_SHOW$4,showEvent=>{if(showEvent.defaultPrevented){return;}
EventHandler.one(target,EVENT_HIDDEN$4,()=>{if(isVisible(this)){this.focus();}});});const alreadyOpen=SelectorEngine.findOne(OPEN_SELECTOR$1);if(alreadyOpen){Modal.getInstance(alreadyOpen).hide();}
const data=Modal.getOrCreateInstance(target);data.toggle(this);});enableDismissTrigger(Modal);defineJQueryPlugin(Modal);const NAME$6='offcanvas';const DATA_KEY$3='bs.offcanvas';const EVENT_KEY$3=`.${DATA_KEY$3}`;const DATA_API_KEY$1='.data-api';const EVENT_LOAD_DATA_API$2=`load${EVENT_KEY$3}${DATA_API_KEY$1}`;const ESCAPE_KEY='Escape';const CLASS_NAME_SHOW$3='show';const CLASS_NAME_SHOWING$1='showing';const CLASS_NAME_HIDING='hiding';const CLASS_NAME_BACKDROP='offcanvas-backdrop';const OPEN_SELECTOR='.offcanvas.show';const EVENT_SHOW$3=`show${EVENT_KEY$3}`;const EVENT_SHOWN$3=`shown${EVENT_KEY$3}`;const EVENT_HIDE$3=`hide${EVENT_KEY$3}`;const EVENT_HIDE_PREVENTED=`hidePrevented${EVENT_KEY$3}`;const EVENT_HIDDEN$3=`hidden${EVENT_KEY$3}`;const EVENT_RESIZE=`resize${EVENT_KEY$3}`;const EVENT_CLICK_DATA_API$1=`click${EVENT_KEY$3}${DATA_API_KEY$1}`;const EVENT_KEYDOWN_DISMISS=`keydown.dismiss${EVENT_KEY$3}`;const SELECTOR_DATA_TOGGLE$1='[data-bs-toggle="offcanvas"]';const Default$5={backdrop:true,keyboard:true,scroll:false};const DefaultType$5={backdrop:'(boolean|string)',keyboard:'boolean',scroll:'boolean'};class Offcanvas extends BaseComponent{constructor(element,config){super(element,config);this._isShown=false;this._backdrop=this._initializeBackDrop();this._focustrap=this._initializeFocusTrap();this._addEventListeners();}
static get Default(){return Default$5;}
static get DefaultType(){return DefaultType$5;}
static get NAME(){return NAME$6;}
toggle(relatedTarget){return this._isShown?this.hide():this.show(relatedTarget);}
show(relatedTarget){if(this._isShown){return;}
const showEvent=EventHandler.trigger(this._element,EVENT_SHOW$3,{relatedTarget});if(showEvent.defaultPrevented){return;}
this._isShown=true;this._backdrop.show();if(!this._config.scroll){new ScrollBarHelper().hide();}
this._element.setAttribute('aria-modal',true);this._element.setAttribute('role','dialog');this._element.classList.add(CLASS_NAME_SHOWING$1);const completeCallBack=()=>{if(!this._config.scroll||this._config.backdrop){this._focustrap.activate();}
this._element.classList.add(CLASS_NAME_SHOW$3);this._element.classList.remove(CLASS_NAME_SHOWING$1);EventHandler.trigger(this._element,EVENT_SHOWN$3,{relatedTarget});};this._queueCallback(completeCallBack,this._element,true);}
hide(){if(!this._isShown){return;}
const hideEvent=EventHandler.trigger(this._element,EVENT_HIDE$3);if(hideEvent.defaultPrevented){return;}
this._focustrap.deactivate();this._element.blur();this._isShown=false;this._element.classList.add(CLASS_NAME_HIDING);this._backdrop.hide();const completeCallback=()=>{this._element.classList.remove(CLASS_NAME_SHOW$3,CLASS_NAME_HIDING);this._element.removeAttribute('aria-modal');this._element.removeAttribute('role');if(!this._config.scroll){new ScrollBarHelper().reset();}
EventHandler.trigger(this._element,EVENT_HIDDEN$3);};this._queueCallback(completeCallback,this._element,true);}
dispose(){this._backdrop.dispose();this._focustrap.deactivate();super.dispose();}
_initializeBackDrop(){const clickCallback=()=>{if(this._config.backdrop==='static'){EventHandler.trigger(this._element,EVENT_HIDE_PREVENTED);return;}
this.hide();};const isVisible=Boolean(this._config.backdrop);return new Backdrop({className:CLASS_NAME_BACKDROP,isVisible,isAnimated:true,rootElement:this._element.parentNode,clickCallback:isVisible?clickCallback:null});}
_initializeFocusTrap(){return new FocusTrap({trapElement:this._element});}
_addEventListeners(){EventHandler.on(this._element,EVENT_KEYDOWN_DISMISS,event=>{if(event.key!==ESCAPE_KEY){return;}
if(this._config.keyboard){this.hide();return;}
EventHandler.trigger(this._element,EVENT_HIDE_PREVENTED);});}
static jQueryInterface(config){return this.each(function(){const data=Offcanvas.getOrCreateInstance(this,config);if(typeof config!=='string'){return;}
if(data[config]===undefined||config.startsWith('_')||config==='constructor'){throw new TypeError(`No method named "${config}"`);}
data[config](this);});}}
EventHandler.on(document,EVENT_CLICK_DATA_API$1,SELECTOR_DATA_TOGGLE$1,function(event){const target=SelectorEngine.getElementFromSelector(this);if(['A','AREA'].includes(this.tagName)){event.preventDefault();}
if(isDisabled(this)){return;}
EventHandler.one(target,EVENT_HIDDEN$3,()=>{if(isVisible(this)){this.focus();}});const alreadyOpen=SelectorEngine.findOne(OPEN_SELECTOR);if(alreadyOpen&&alreadyOpen!==target){Offcanvas.getInstance(alreadyOpen).hide();}
const data=Offcanvas.getOrCreateInstance(target);data.toggle(this);});EventHandler.on(window,EVENT_LOAD_DATA_API$2,()=>{for(const selector of SelectorEngine.find(OPEN_SELECTOR)){Offcanvas.getOrCreateInstance(selector).show();}});EventHandler.on(window,EVENT_RESIZE,()=>{for(const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')){if(getComputedStyle(element).position!=='fixed'){Offcanvas.getOrCreateInstance(element).hide();}}});enableDismissTrigger(Offcanvas);defineJQueryPlugin(Offcanvas);const ARIA_ATTRIBUTE_PATTERN=/^aria-[\w-]*$/i;const DefaultAllowlist={'*':['class','dir','id','lang','role',ARIA_ATTRIBUTE_PATTERN],a:['target','href','title','rel'],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:['src','srcset','alt','title','width','height'],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]};const uriAttributes=new Set(['background','cite','href','itemtype','longdesc','poster','src','xlink:href']);const SAFE_URL_PATTERN=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;const allowedAttribute=(attribute,allowedAttributeList)=>{const attributeName=attribute.nodeName.toLowerCase();if(allowedAttributeList.includes(attributeName)){if(uriAttributes.has(attributeName)){return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue));}
return true;}
return allowedAttributeList.filter(attributeRegex=>attributeRegex instanceof RegExp).some(regex=>regex.test(attributeName));};function sanitizeHtml(unsafeHtml,allowList,sanitizeFunction){if(!unsafeHtml.length){return unsafeHtml;}
if(sanitizeFunction&&typeof sanitizeFunction==='function'){return sanitizeFunction(unsafeHtml);}
const domParser=new window.DOMParser();const createdDocument=domParser.parseFromString(unsafeHtml,'text/html');const elements=[].concat(...createdDocument.body.querySelectorAll('*'));for(const element of elements){const elementName=element.nodeName.toLowerCase();if(!Object.keys(allowList).includes(elementName)){element.remove();continue;}
const attributeList=[].concat(...element.attributes);const allowedAttributes=[].concat(allowList['*']||[],allowList[elementName]||[]);for(const attribute of attributeList){if(!allowedAttribute(attribute,allowedAttributes)){element.removeAttribute(attribute.nodeName);}}}
return createdDocument.body.innerHTML;}
const NAME$5='TemplateFactory';const Default$4={allowList:DefaultAllowlist,content:{},extraClass:'',html:false,sanitize:true,sanitizeFn:null,template:'<div></div>'};const DefaultType$4={allowList:'object',content:'object',extraClass:'(string|function)',html:'boolean',sanitize:'boolean',sanitizeFn:'(null|function)',template:'string'};const DefaultContentType={entry:'(string|element|function|null)',selector:'(string|element)'};class TemplateFactory extends Config{constructor(config){super();this._config=this._getConfig(config);}
static get Default(){return Default$4;}
static get DefaultType(){return DefaultType$4;}
static get NAME(){return NAME$5;}
getContent(){return Object.values(this._config.content).map(config=>this._resolvePossibleFunction(config)).filter(Boolean);}
hasContent(){return this.getContent().length>0;}
changeContent(content){this._checkContent(content);this._config.content={...this._config.content,...content};return this;}
toHtml(){const templateWrapper=document.createElement('div');templateWrapper.innerHTML=this._maybeSanitize(this._config.template);for(const[selector,text]of Object.entries(this._config.content)){this._setContent(templateWrapper,text,selector);}
const template=templateWrapper.children[0];const extraClass=this._resolvePossibleFunction(this._config.extraClass);if(extraClass){template.classList.add(...extraClass.split(' '));}
return template;}
_typeCheckConfig(config){super._typeCheckConfig(config);this._checkContent(config.content);}
_checkContent(arg){for(const[selector,content]of Object.entries(arg)){super._typeCheckConfig({selector,entry:content},DefaultContentType);}}
_setContent(template,content,selector){const templateElement=SelectorEngine.findOne(selector,template);if(!templateElement){return;}
content=this._resolvePossibleFunction(content);if(!content){templateElement.remove();return;}
if(isElement$1(content)){this._putElementInTemplate(getElement(content),templateElement);return;}
if(this._config.html){templateElement.innerHTML=this._maybeSanitize(content);return;}
templateElement.textContent=content;}
_maybeSanitize(arg){return this._config.sanitize?sanitizeHtml(arg,this._config.allowList,this._config.sanitizeFn):arg;}
_resolvePossibleFunction(arg){return execute(arg,[this]);}
_putElementInTemplate(element,templateElement){if(this._config.html){templateElement.innerHTML='';templateElement.append(element);return;}
templateElement.textContent=element.textContent;}}
const NAME$4='tooltip';const DISALLOWED_ATTRIBUTES=new Set(['sanitize','allowList','sanitizeFn']);const CLASS_NAME_FADE$2='fade';const CLASS_NAME_MODAL='modal';const CLASS_NAME_SHOW$2='show';const SELECTOR_TOOLTIP_INNER='.tooltip-inner';const SELECTOR_MODAL=`.${CLASS_NAME_MODAL}`;const EVENT_MODAL_HIDE='hide.bs.modal';const TRIGGER_HOVER='hover';const TRIGGER_FOCUS='focus';const TRIGGER_CLICK='click';const TRIGGER_MANUAL='manual';const EVENT_HIDE$2='hide';const EVENT_HIDDEN$2='hidden';const EVENT_SHOW$2='show';const EVENT_SHOWN$2='shown';const EVENT_INSERTED='inserted';const EVENT_CLICK$1='click';const EVENT_FOCUSIN$1='focusin';const EVENT_FOCUSOUT$1='focusout';const EVENT_MOUSEENTER='mouseenter';const EVENT_MOUSELEAVE='mouseleave';const AttachmentMap={AUTO:'auto',TOP:'top',RIGHT:isRTL()?'left':'right',BOTTOM:'bottom',LEFT:isRTL()?'right':'left'};const Default$3={allowList:DefaultAllowlist,animation:true,boundary:'clippingParents',container:false,customClass:'',delay:0,fallbackPlacements:['top','right','bottom','left'],html:false,offset:[0,6],placement:'top',popperConfig:null,sanitize:true,sanitizeFn:null,selector:false,template:'<div class="tooltip" role="tooltip">'+'<div class="tooltip-arrow"></div>'+'<div class="tooltip-inner"></div>'+'</div>',title:'',trigger:'hover focus'};const DefaultType$3={allowList:'object',animation:'boolean',boundary:'(string|element)',container:'(string|element|boolean)',customClass:'(string|function)',delay:'(number|object)',fallbackPlacements:'array',html:'boolean',offset:'(array|string|function)',placement:'(string|function)',popperConfig:'(null|object|function)',sanitize:'boolean',sanitizeFn:'(null|function)',selector:'(string|boolean)',template:'string',title:'(string|element|function)',trigger:'string'};class Tooltip extends BaseComponent{constructor(element,config){if(typeof Popper==='undefined'){throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');}
super(element,config);this._isEnabled=true;this._timeout=0;this._isHovered=null;this._activeTrigger={};this._popper=null;this._templateFactory=null;this._newContent=null;this.tip=null;this._setListeners();if(!this._config.selector){this._fixTitle();}}
static get Default(){return Default$3;}
static get DefaultType(){return DefaultType$3;}
static get NAME(){return NAME$4;}
enable(){this._isEnabled=true;}
disable(){this._isEnabled=false;}
toggleEnabled(){this._isEnabled=!this._isEnabled;}
toggle(){if(!this._isEnabled){return;}
this._activeTrigger.click=!this._activeTrigger.click;if(this._isShown()){this._leave();return;}
this._enter();}
dispose(){clearTimeout(this._timeout);EventHandler.off(this._element.closest(SELECTOR_MODAL),EVENT_MODAL_HIDE,this._hideModalHandler);if(this._element.getAttribute('data-bs-original-title')){this._element.setAttribute('title',this._element.getAttribute('data-bs-original-title'));}
this._disposePopper();super.dispose();}
show(){if(this._element.style.display==='none'){throw new Error('Please use show on visible elements');}
if(!(this._isWithContent()&&this._isEnabled)){return;}
const showEvent=EventHandler.trigger(this._element,this.constructor.eventName(EVENT_SHOW$2));const shadowRoot=findShadowRoot(this._element);const isInTheDom=(shadowRoot||this._element.ownerDocument.documentElement).contains(this._element);if(showEvent.defaultPrevented||!isInTheDom){return;}
this._disposePopper();const tip=this._getTipElement();this._element.setAttribute('aria-describedby',tip.getAttribute('id'));const{container}=this._config;if(!this._element.ownerDocument.documentElement.contains(this.tip)){container.append(tip);EventHandler.trigger(this._element,this.constructor.eventName(EVENT_INSERTED));}
this._popper=this._createPopper(tip);tip.classList.add(CLASS_NAME_SHOW$2);if('ontouchstart' in document.documentElement){for(const element of[].concat(...document.body.children)){EventHandler.on(element,'mouseover',noop);}}
const complete=()=>{EventHandler.trigger(this._element,this.constructor.eventName(EVENT_SHOWN$2));if(this._isHovered===false){this._leave();}
this._isHovered=false;};this._queueCallback(complete,this.tip,this._isAnimated());}
hide(){if(!this._isShown()){return;}
const hideEvent=EventHandler.trigger(this._element,this.constructor.eventName(EVENT_HIDE$2));if(hideEvent.defaultPrevented){return;}
const tip=this._getTipElement();tip.classList.remove(CLASS_NAME_SHOW$2);if('ontouchstart' in document.documentElement){for(const element of[].concat(...document.body.children)){EventHandler.off(element,'mouseover',noop);}}
this._activeTrigger[TRIGGER_CLICK]=false;this._activeTrigger[TRIGGER_FOCUS]=false;this._activeTrigger[TRIGGER_HOVER]=false;this._isHovered=null;const complete=()=>{if(this._isWithActiveTrigger()){return;}
if(!this._isHovered){this._disposePopper();}
this._element.removeAttribute('aria-describedby');EventHandler.trigger(this._element,this.constructor.eventName(EVENT_HIDDEN$2));};this._queueCallback(complete,this.tip,this._isAnimated());}
update(){if(this._popper){this._popper.update();}}
_isWithContent(){return Boolean(this._getTitle());}
_getTipElement(){if(!this.tip){this.tip=this._createTipElement(this._newContent||this._getContentForTemplate());}
return this.tip;}
_createTipElement(content){const tip=this._getTemplateFactory(content).toHtml();if(!tip){return null;}
tip.classList.remove(CLASS_NAME_FADE$2,CLASS_NAME_SHOW$2);tip.classList.add(`bs-${this.constructor.NAME}-auto`);const tipId=getUID(this.constructor.NAME).toString();tip.setAttribute('id',tipId);if(this._isAnimated()){tip.classList.add(CLASS_NAME_FADE$2);}
return tip;}
setContent(content){this._newContent=content;if(this._isShown()){this._disposePopper();this.show();}}
_getTemplateFactory(content){if(this._templateFactory){this._templateFactory.changeContent(content);}else{this._templateFactory=new TemplateFactory({...this._config,content,extraClass:this._resolvePossibleFunction(this._config.customClass)});}
return this._templateFactory;}
_getContentForTemplate(){return{[SELECTOR_TOOLTIP_INNER]:this._getTitle()};}
_getTitle(){return this._resolvePossibleFunction(this._config.title)||this._element.getAttribute('data-bs-original-title');}
_initializeOnDelegatedTarget(event){return this.constructor.getOrCreateInstance(event.delegateTarget,this._getDelegateConfig());}
_isAnimated(){return this._config.animation||this.tip&&this.tip.classList.contains(CLASS_NAME_FADE$2);}
_isShown(){return this.tip&&this.tip.classList.contains(CLASS_NAME_SHOW$2);}
_createPopper(tip){const placement=execute(this._config.placement,[this,tip,this._element]);const attachment=AttachmentMap[placement.toUpperCase()];return createPopper(this._element,tip,this._getPopperConfig(attachment));}
_getOffset(){const{offset}=this._config;if(typeof offset==='string'){return offset.split(',').map(value=>Number.parseInt(value,10));}
if(typeof offset==='function'){return popperData=>offset(popperData,this._element);}
return offset;}
_resolvePossibleFunction(arg){return execute(arg,[this._element]);}
_getPopperConfig(attachment){const defaultBsPopperConfig={placement:attachment,modifiers:[{name:'flip',options:{fallbackPlacements:this._config.fallbackPlacements}},{name:'offset',options:{offset:this._getOffset()}},{name:'preventOverflow',options:{boundary:this._config.boundary}},{name:'arrow',options:{element:`.${this.constructor.NAME}-arrow`}},{name:'preSetPlacement',enabled:true,phase:'beforeMain',fn:data=>{this._getTipElement().setAttribute('data-popper-placement',data.state.placement);}}]};return{...defaultBsPopperConfig,...execute(this._config.popperConfig,[defaultBsPopperConfig])};}
_setListeners(){const triggers=this._config.trigger.split(' ');for(const trigger of triggers){if(trigger==='click'){EventHandler.on(this._element,this.constructor.eventName(EVENT_CLICK$1),this._config.selector,event=>{const context=this._initializeOnDelegatedTarget(event);context.toggle();});}else if(trigger!==TRIGGER_MANUAL){const eventIn=trigger===TRIGGER_HOVER?this.constructor.eventName(EVENT_MOUSEENTER):this.constructor.eventName(EVENT_FOCUSIN$1);const eventOut=trigger===TRIGGER_HOVER?this.constructor.eventName(EVENT_MOUSELEAVE):this.constructor.eventName(EVENT_FOCUSOUT$1);EventHandler.on(this._element,eventIn,this._config.selector,event=>{const context=this._initializeOnDelegatedTarget(event);context._activeTrigger[event.type==='focusin'?TRIGGER_FOCUS:TRIGGER_HOVER]=true;context._enter();});EventHandler.on(this._element,eventOut,this._config.selector,event=>{const context=this._initializeOnDelegatedTarget(event);context._activeTrigger[event.type==='focusout'?TRIGGER_FOCUS:TRIGGER_HOVER]=context._element.contains(event.relatedTarget);context._leave();});}}
this._hideModalHandler=()=>{if(this._element){this.hide();}};EventHandler.on(this._element.closest(SELECTOR_MODAL),EVENT_MODAL_HIDE,this._hideModalHandler);}
_fixTitle(){const title=this._element.getAttribute('title');if(!title){return;}
if(!this._element.getAttribute('aria-label')&&!this._element.textContent.trim()){this._element.setAttribute('aria-label',title);}
this._element.setAttribute('data-bs-original-title',title);this._element.removeAttribute('title');}
_enter(){if(this._isShown()||this._isHovered){this._isHovered=true;return;}
this._isHovered=true;this._setTimeout(()=>{if(this._isHovered){this.show();}},this._config.delay.show);}
_leave(){if(this._isWithActiveTrigger()){return;}
this._isHovered=false;this._setTimeout(()=>{if(!this._isHovered){this.hide();}},this._config.delay.hide);}
_setTimeout(handler,timeout){clearTimeout(this._timeout);this._timeout=setTimeout(handler,timeout);}
_isWithActiveTrigger(){return Object.values(this._activeTrigger).includes(true);}
_getConfig(config){const dataAttributes=Manipulator.getDataAttributes(this._element);for(const dataAttribute of Object.keys(dataAttributes)){if(DISALLOWED_ATTRIBUTES.has(dataAttribute)){delete dataAttributes[dataAttribute];}}
config={...dataAttributes,...(typeof config==='object'&&config?config:{})};config=this._mergeConfigObj(config);config=this._configAfterMerge(config);this._typeCheckConfig(config);return config;}
_configAfterMerge(config){config.container=config.container===false?document.body:getElement(config.container);if(typeof config.delay==='number'){config.delay={show:config.delay,hide:config.delay};}
if(typeof config.title==='number'){config.title=config.title.toString();}
if(typeof config.content==='number'){config.content=config.content.toString();}
return config;}
_getDelegateConfig(){const config={};for(const[key,value]of Object.entries(this._config)){if(this.constructor.Default[key]!==value){config[key]=value;}}
config.selector=false;config.trigger='manual';return config;}
_disposePopper(){if(this._popper){this._popper.destroy();this._popper=null;}
if(this.tip){this.tip.remove();this.tip=null;}}
static jQueryInterface(config){return this.each(function(){const data=Tooltip.getOrCreateInstance(this,config);if(typeof config!=='string'){return;}
if(typeof data[config]==='undefined'){throw new TypeError(`No method named "${config}"`);}
data[config]();});}}
defineJQueryPlugin(Tooltip);const NAME$3='popover';const SELECTOR_TITLE='.popover-header';const SELECTOR_CONTENT='.popover-body';const Default$2={...Tooltip.Default,content:'',offset:[0,8],placement:'right',template:'<div class="popover" role="tooltip">'+'<div class="popover-arrow"></div>'+'<h3 class="popover-header"></h3>'+'<div class="popover-body"></div>'+'</div>',trigger:'click'};const DefaultType$2={...Tooltip.DefaultType,content:'(null|string|element|function)'};class Popover extends Tooltip{static get Default(){return Default$2;}
static get DefaultType(){return DefaultType$2;}
static get NAME(){return NAME$3;}
_isWithContent(){return this._getTitle()||this._getContent();}
_getContentForTemplate(){return{[SELECTOR_TITLE]:this._getTitle(),[SELECTOR_CONTENT]:this._getContent()};}
_getContent(){return this._resolvePossibleFunction(this._config.content);}
static jQueryInterface(config){return this.each(function(){const data=Popover.getOrCreateInstance(this,config);if(typeof config!=='string'){return;}
if(typeof data[config]==='undefined'){throw new TypeError(`No method named "${config}"`);}
data[config]();});}}
defineJQueryPlugin(Popover);const NAME$2='scrollspy';const DATA_KEY$2='bs.scrollspy';const EVENT_KEY$2=`.${DATA_KEY$2}`;const DATA_API_KEY='.data-api';const EVENT_ACTIVATE=`activate${EVENT_KEY$2}`;const EVENT_CLICK=`click${EVENT_KEY$2}`;const EVENT_LOAD_DATA_API$1=`load${EVENT_KEY$2}${DATA_API_KEY}`;const CLASS_NAME_DROPDOWN_ITEM='dropdown-item';const CLASS_NAME_ACTIVE$1='active';const SELECTOR_DATA_SPY='[data-bs-spy="scroll"]';const SELECTOR_TARGET_LINKS='[href]';const SELECTOR_NAV_LIST_GROUP='.nav, .list-group';const SELECTOR_NAV_LINKS='.nav-link';const SELECTOR_NAV_ITEMS='.nav-item';const SELECTOR_LIST_ITEMS='.list-group-item';const SELECTOR_LINK_ITEMS=`${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;const SELECTOR_DROPDOWN='.dropdown';const SELECTOR_DROPDOWN_TOGGLE$1='.dropdown-toggle';const Default$1={offset:null,rootMargin:'0px 0px -25%',smoothScroll:false,target:null,threshold:[0.1,0.5,1]};const DefaultType$1={offset:'(number|null)',rootMargin:'string',smoothScroll:'boolean',target:'element',threshold:'array'};class ScrollSpy extends BaseComponent{constructor(element,config){super(element,config);this._targetLinks=new Map();this._observableSections=new Map();this._rootElement=getComputedStyle(this._element).overflowY==='visible'?null:this._element;this._activeTarget=null;this._observer=null;this._previousScrollData={visibleEntryTop:0,parentScrollTop:0};this.refresh();}
static get Default(){return Default$1;}
static get DefaultType(){return DefaultType$1;}
static get NAME(){return NAME$2;}
refresh(){this._initializeTargetsAndObservables();this._maybeEnableSmoothScroll();if(this._observer){this._observer.disconnect();}else{this._observer=this._getNewObserver();}
for(const section of this._observableSections.values()){this._observer.observe(section);}}
dispose(){this._observer.disconnect();super.dispose();}
_configAfterMerge(config){config.target=getElement(config.target)||document.body;config.rootMargin=config.offset?`${config.offset}px 0px -30%`:config.rootMargin;if(typeof config.threshold==='string'){config.threshold=config.threshold.split(',').map(value=>Number.parseFloat(value));}
return config;}
_maybeEnableSmoothScroll(){if(!this._config.smoothScroll){return;}
EventHandler.off(this._config.target,EVENT_CLICK);EventHandler.on(this._config.target,EVENT_CLICK,SELECTOR_TARGET_LINKS,event=>{const observableSection=this._observableSections.get(event.target.hash);if(observableSection){event.preventDefault();const root=this._rootElement||window;const height=observableSection.offsetTop-this._element.offsetTop;if(root.scrollTo){root.scrollTo({top:height,behavior:'smooth'});return;}
root.scrollTop=height;}});}
_getNewObserver(){const options={root:this._rootElement,threshold:this._config.threshold,rootMargin:this._config.rootMargin};return new IntersectionObserver(entries=>this._observerCallback(entries),options);}
_observerCallback(entries){const targetElement=entry=>this._targetLinks.get(`#${entry.target.id}`);const activate=entry=>{this._previousScrollData.visibleEntryTop=entry.target.offsetTop;this._process(targetElement(entry));};const parentScrollTop=(this._rootElement||document.documentElement).scrollTop;const userScrollsDown=parentScrollTop>=this._previousScrollData.parentScrollTop;this._previousScrollData.parentScrollTop=parentScrollTop;for(const entry of entries){if(!entry.isIntersecting){this._activeTarget=null;this._clearActiveClass(targetElement(entry));continue;}
const entryIsLowerThanPrevious=entry.target.offsetTop>=this._previousScrollData.visibleEntryTop;if(userScrollsDown&&entryIsLowerThanPrevious){activate(entry);if(!parentScrollTop){return;}
continue;}
if(!userScrollsDown&&!entryIsLowerThanPrevious){activate(entry);}}}
_initializeTargetsAndObservables(){this._targetLinks=new Map();this._observableSections=new Map();const targetLinks=SelectorEngine.find(SELECTOR_TARGET_LINKS,this._config.target);for(const anchor of targetLinks){if(!anchor.hash||isDisabled(anchor)){continue;}
const observableSection=SelectorEngine.findOne(decodeURI(anchor.hash),this._element);if(isVisible(observableSection)){this._targetLinks.set(decodeURI(anchor.hash),anchor);this._observableSections.set(anchor.hash,observableSection);}}}
_process(target){if(this._activeTarget===target){return;}
this._clearActiveClass(this._config.target);this._activeTarget=target;target.classList.add(CLASS_NAME_ACTIVE$1);this._activateParents(target);EventHandler.trigger(this._element,EVENT_ACTIVATE,{relatedTarget:target});}
_activateParents(target){if(target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)){SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1,target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);return;}
for(const listGroup of SelectorEngine.parents(target,SELECTOR_NAV_LIST_GROUP)){for(const item of SelectorEngine.prev(listGroup,SELECTOR_LINK_ITEMS)){item.classList.add(CLASS_NAME_ACTIVE$1);}}}
_clearActiveClass(parent){parent.classList.remove(CLASS_NAME_ACTIVE$1);const activeNodes=SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`,parent);for(const node of activeNodes){node.classList.remove(CLASS_NAME_ACTIVE$1);}}
static jQueryInterface(config){return this.each(function(){const data=ScrollSpy.getOrCreateInstance(this,config);if(typeof config!=='string'){return;}
if(data[config]===undefined||config.startsWith('_')||config==='constructor'){throw new TypeError(`No method named "${config}"`);}
data[config]();});}}
EventHandler.on(window,EVENT_LOAD_DATA_API$1,()=>{for(const spy of SelectorEngine.find(SELECTOR_DATA_SPY)){ScrollSpy.getOrCreateInstance(spy);}});defineJQueryPlugin(ScrollSpy);const NAME$1='tab';const DATA_KEY$1='bs.tab';const EVENT_KEY$1=`.${DATA_KEY$1}`;const EVENT_HIDE$1=`hide${EVENT_KEY$1}`;const EVENT_HIDDEN$1=`hidden${EVENT_KEY$1}`;const EVENT_SHOW$1=`show${EVENT_KEY$1}`;const EVENT_SHOWN$1=`shown${EVENT_KEY$1}`;const EVENT_CLICK_DATA_API=`click${EVENT_KEY$1}`;const EVENT_KEYDOWN=`keydown${EVENT_KEY$1}`;const EVENT_LOAD_DATA_API=`load${EVENT_KEY$1}`;const ARROW_LEFT_KEY='ArrowLeft';const ARROW_RIGHT_KEY='ArrowRight';const ARROW_UP_KEY='ArrowUp';const ARROW_DOWN_KEY='ArrowDown';const HOME_KEY='Home';const END_KEY='End';const CLASS_NAME_ACTIVE='active';const CLASS_NAME_FADE$1='fade';const CLASS_NAME_SHOW$1='show';const CLASS_DROPDOWN='dropdown';const SELECTOR_DROPDOWN_TOGGLE='.dropdown-toggle';const SELECTOR_DROPDOWN_MENU='.dropdown-menu';const NOT_SELECTOR_DROPDOWN_TOGGLE=`:not(${SELECTOR_DROPDOWN_TOGGLE})`;const SELECTOR_TAB_PANEL='.list-group, .nav, [role="tablist"]';const SELECTOR_OUTER='.nav-item, .list-group-item';const SELECTOR_INNER=`.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;const SELECTOR_DATA_TOGGLE='[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';const SELECTOR_INNER_ELEM=`${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;const SELECTOR_DATA_TOGGLE_ACTIVE=`.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`;class Tab extends BaseComponent{constructor(element){super(element);this._parent=this._element.closest(SELECTOR_TAB_PANEL);if(!this._parent){return;}
this._setInitialAttributes(this._parent,this._getChildren());EventHandler.on(this._element,EVENT_KEYDOWN,event=>this._keydown(event));}
static get NAME(){return NAME$1;}
show(){const innerElem=this._element;if(this._elemIsActive(innerElem)){return;}
const active=this._getActiveElem();const hideEvent=active?EventHandler.trigger(active,EVENT_HIDE$1,{relatedTarget:innerElem}):null;const showEvent=EventHandler.trigger(innerElem,EVENT_SHOW$1,{relatedTarget:active});if(showEvent.defaultPrevented||hideEvent&&hideEvent.defaultPrevented){return;}
this._deactivate(active,innerElem);this._activate(innerElem,active);}
_activate(element,relatedElem){if(!element){return;}
element.classList.add(CLASS_NAME_ACTIVE);this._activate(SelectorEngine.getElementFromSelector(element));const complete=()=>{if(element.getAttribute('role')!=='tab'){element.classList.add(CLASS_NAME_SHOW$1);return;}
element.removeAttribute('tabindex');element.setAttribute('aria-selected',true);this._toggleDropDown(element,true);EventHandler.trigger(element,EVENT_SHOWN$1,{relatedTarget:relatedElem});};this._queueCallback(complete,element,element.classList.contains(CLASS_NAME_FADE$1));}
_deactivate(element,relatedElem){if(!element){return;}
element.classList.remove(CLASS_NAME_ACTIVE);element.blur();this._deactivate(SelectorEngine.getElementFromSelector(element));const complete=()=>{if(element.getAttribute('role')!=='tab'){element.classList.remove(CLASS_NAME_SHOW$1);return;}
element.setAttribute('aria-selected',false);element.setAttribute('tabindex','-1');this._toggleDropDown(element,false);EventHandler.trigger(element,EVENT_HIDDEN$1,{relatedTarget:relatedElem});};this._queueCallback(complete,element,element.classList.contains(CLASS_NAME_FADE$1));}
_keydown(event){if(![ARROW_LEFT_KEY,ARROW_RIGHT_KEY,ARROW_UP_KEY,ARROW_DOWN_KEY,HOME_KEY,END_KEY].includes(event.key)){return;}
event.stopPropagation();event.preventDefault();const children=this._getChildren().filter(element=>!isDisabled(element));let nextActiveElement;if([HOME_KEY,END_KEY].includes(event.key)){nextActiveElement=children[event.key===HOME_KEY?0:children.length-1];}else{const isNext=[ARROW_RIGHT_KEY,ARROW_DOWN_KEY].includes(event.key);nextActiveElement=getNextActiveElement(children,event.target,isNext,true);}
if(nextActiveElement){nextActiveElement.focus({preventScroll:true});Tab.getOrCreateInstance(nextActiveElement).show();}}
_getChildren(){return SelectorEngine.find(SELECTOR_INNER_ELEM,this._parent);}
_getActiveElem(){return this._getChildren().find(child=>this._elemIsActive(child))||null;}
_setInitialAttributes(parent,children){this._setAttributeIfNotExists(parent,'role','tablist');for(const child of children){this._setInitialAttributesOnChild(child);}}
_setInitialAttributesOnChild(child){child=this._getInnerElement(child);const isActive=this._elemIsActive(child);const outerElem=this._getOuterElement(child);child.setAttribute('aria-selected',isActive);if(outerElem!==child){this._setAttributeIfNotExists(outerElem,'role','presentation');}
if(!isActive){child.setAttribute('tabindex','-1');}
this._setAttributeIfNotExists(child,'role','tab');this._setInitialAttributesOnTargetPanel(child);}
_setInitialAttributesOnTargetPanel(child){const target=SelectorEngine.getElementFromSelector(child);if(!target){return;}
this._setAttributeIfNotExists(target,'role','tabpanel');if(child.id){this._setAttributeIfNotExists(target,'aria-labelledby',`${child.id}`);}}
_toggleDropDown(element,open){const outerElem=this._getOuterElement(element);if(!outerElem.classList.contains(CLASS_DROPDOWN)){return;}
const toggle=(selector,className)=>{const element=SelectorEngine.findOne(selector,outerElem);if(element){element.classList.toggle(className,open);}};toggle(SELECTOR_DROPDOWN_TOGGLE,CLASS_NAME_ACTIVE);toggle(SELECTOR_DROPDOWN_MENU,CLASS_NAME_SHOW$1);outerElem.setAttribute('aria-expanded',open);}
_setAttributeIfNotExists(element,attribute,value){if(!element.hasAttribute(attribute)){element.setAttribute(attribute,value);}}
_elemIsActive(elem){return elem.classList.contains(CLASS_NAME_ACTIVE);}
_getInnerElement(elem){return elem.matches(SELECTOR_INNER_ELEM)?elem:SelectorEngine.findOne(SELECTOR_INNER_ELEM,elem);}
_getOuterElement(elem){return elem.closest(SELECTOR_OUTER)||elem;}
static jQueryInterface(config){return this.each(function(){const data=Tab.getOrCreateInstance(this);if(typeof config!=='string'){return;}
if(data[config]===undefined||config.startsWith('_')||config==='constructor'){throw new TypeError(`No method named "${config}"`);}
data[config]();});}}
EventHandler.on(document,EVENT_CLICK_DATA_API,SELECTOR_DATA_TOGGLE,function(event){if(['A','AREA'].includes(this.tagName)){event.preventDefault();}
if(isDisabled(this)){return;}
Tab.getOrCreateInstance(this).show();});EventHandler.on(window,EVENT_LOAD_DATA_API,()=>{for(const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)){Tab.getOrCreateInstance(element);}});defineJQueryPlugin(Tab);const NAME='toast';const DATA_KEY='bs.toast';const EVENT_KEY=`.${DATA_KEY}`;const EVENT_MOUSEOVER=`mouseover${EVENT_KEY}`;const EVENT_MOUSEOUT=`mouseout${EVENT_KEY}`;const EVENT_FOCUSIN=`focusin${EVENT_KEY}`;const EVENT_FOCUSOUT=`focusout${EVENT_KEY}`;const EVENT_HIDE=`hide${EVENT_KEY}`;const EVENT_HIDDEN=`hidden${EVENT_KEY}`;const EVENT_SHOW=`show${EVENT_KEY}`;const EVENT_SHOWN=`shown${EVENT_KEY}`;const CLASS_NAME_FADE='fade';const CLASS_NAME_HIDE='hide';const CLASS_NAME_SHOW='show';const CLASS_NAME_SHOWING='showing';const DefaultType={animation:'boolean',autohide:'boolean',delay:'number'};const Default={animation:true,autohide:true,delay:5000};class Toast extends BaseComponent{constructor(element,config){super(element,config);this._timeout=null;this._hasMouseInteraction=false;this._hasKeyboardInteraction=false;this._setListeners();}
static get Default(){return Default;}
static get DefaultType(){return DefaultType;}
static get NAME(){return NAME;}
show(){const showEvent=EventHandler.trigger(this._element,EVENT_SHOW);if(showEvent.defaultPrevented){return;}
this._clearTimeout();if(this._config.animation){this._element.classList.add(CLASS_NAME_FADE);}
const complete=()=>{this._element.classList.remove(CLASS_NAME_SHOWING);EventHandler.trigger(this._element,EVENT_SHOWN);this._maybeScheduleHide();};this._element.classList.remove(CLASS_NAME_HIDE);reflow(this._element);this._element.classList.add(CLASS_NAME_SHOW,CLASS_NAME_SHOWING);this._queueCallback(complete,this._element,this._config.animation);}
hide(){if(!this.isShown()){return;}
const hideEvent=EventHandler.trigger(this._element,EVENT_HIDE);if(hideEvent.defaultPrevented){return;}
const complete=()=>{this._element.classList.add(CLASS_NAME_HIDE);this._element.classList.remove(CLASS_NAME_SHOWING,CLASS_NAME_SHOW);EventHandler.trigger(this._element,EVENT_HIDDEN);};this._element.classList.add(CLASS_NAME_SHOWING);this._queueCallback(complete,this._element,this._config.animation);}
dispose(){this._clearTimeout();if(this.isShown()){this._element.classList.remove(CLASS_NAME_SHOW);}
super.dispose();}
isShown(){return this._element.classList.contains(CLASS_NAME_SHOW);}
_maybeScheduleHide(){if(!this._config.autohide){return;}
if(this._hasMouseInteraction||this._hasKeyboardInteraction){return;}
this._timeout=setTimeout(()=>{this.hide();},this._config.delay);}
_onInteraction(event,isInteracting){switch(event.type){case'mouseover':case'mouseout':{this._hasMouseInteraction=isInteracting;break;}
case'focusin':case'focusout':{this._hasKeyboardInteraction=isInteracting;break;}}
if(isInteracting){this._clearTimeout();return;}
const nextElement=event.relatedTarget;if(this._element===nextElement||this._element.contains(nextElement)){return;}
this._maybeScheduleHide();}
_setListeners(){EventHandler.on(this._element,EVENT_MOUSEOVER,event=>this._onInteraction(event,true));EventHandler.on(this._element,EVENT_MOUSEOUT,event=>this._onInteraction(event,false));EventHandler.on(this._element,EVENT_FOCUSIN,event=>this._onInteraction(event,true));EventHandler.on(this._element,EVENT_FOCUSOUT,event=>this._onInteraction(event,false));}
_clearTimeout(){clearTimeout(this._timeout);this._timeout=null;}
static jQueryInterface(config){return this.each(function(){const data=Toast.getOrCreateInstance(this,config);if(typeof config==='string'){if(typeof data[config]==='undefined'){throw new TypeError(`No method named "${config}"`);}
data[config](this);}});}}
enableDismissTrigger(Toast);defineJQueryPlugin(Toast);const index_umd={Alert,Button,Carousel,Collapse,Dropdown,Modal,Offcanvas,Popover,ScrollSpy,Tab,Toast,Tooltip};return index_umd;}));;;
(function(global,factory){"use strict";if(typeof module==="object"&&typeof module.exports==="object"){module.exports=global.document?factory(global,true):function(w){if(!w.document){throw new Error("jQuery requires a window with a document");}
return factory(w);};}else{factory(global);}})(typeof window!=="undefined"?window:this,function(window,noGlobal){"use strict";var arr=[];var getProto=Object.getPrototypeOf;var slice=arr.slice;var flat=arr.flat?function(array){return arr.flat.call(array);}:function(array){return arr.concat.apply([],array);};var push=arr.push;var indexOf=arr.indexOf;var class2type={};var toString=class2type.toString;var hasOwn=class2type.hasOwnProperty;var fnToString=hasOwn.toString;var ObjectFunctionString=fnToString.call(Object);var support={};var isFunction=function isFunction(obj){return typeof obj==="function"&&typeof obj.nodeType!=="number"&&typeof obj.item!=="function";};var isWindow=function isWindow(obj){return obj!=null&&obj===obj.window;};var document=window.document;var preservedScriptAttributes={type:true,src:true,nonce:true,noModule:true};function DOMEval(code,node,doc){doc=doc||document;var i,val,script=doc.createElement("script");script.text=code;if(node){for(i in preservedScriptAttributes){val=node[i]||node.getAttribute&&node.getAttribute(i);if(val){script.setAttribute(i,val);}}}
doc.head.appendChild(script).parentNode.removeChild(script);}
function toType(obj){if(obj==null){return obj+"";}
return typeof obj==="object"||typeof obj==="function"?class2type[toString.call(obj)]||"object":typeof obj;}
var version="3.7.1",rhtmlSuffix=/HTML$/i,jQuery=function(selector,context){return new jQuery.fn.init(selector,context);};jQuery.fn=jQuery.prototype={jquery:version,constructor:jQuery,length:0,toArray:function(){return slice.call(this);},get:function(num){if(num==null){return slice.call(this);}
return num<0?this[num+this.length]:this[num];},pushStack:function(elems){var ret=jQuery.merge(this.constructor(),elems);ret.prevObject=this;return ret;},each:function(callback){return jQuery.each(this,callback);},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},slice:function(){return this.pushStack(slice.apply(this,arguments));},first:function(){return this.eq(0);},last:function(){return this.eq(-1);},even:function(){return this.pushStack(jQuery.grep(this,function(_elem,i){return(i+1)%2;}));},odd:function(){return this.pushStack(jQuery.grep(this,function(_elem,i){return i%2;}));},eq:function(i){var len=this.length,j=+i+(i<0?len:0);return this.pushStack(j>=0&&j<len?[this[j]]:[]);},end:function(){return this.prevObject||this.constructor();},push:push,sort:arr.sort,splice:arr.splice};jQuery.extend=jQuery.fn.extend=function(){var options,name,src,copy,copyIsArray,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[i]||{};i++;}
if(typeof target!=="object"&&!isFunction(target)){target={};}
if(i===length){target=this;i--;}
for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){copy=options[name];if(name==="__proto__"||target===copy){continue;}
if(deep&&copy&&(jQuery.isPlainObject(copy)||(copyIsArray=Array.isArray(copy)))){src=target[name];if(copyIsArray&&!Array.isArray(src)){clone=[];}else if(!copyIsArray&&!jQuery.isPlainObject(src)){clone={};}else{clone=src;}
copyIsArray=false;target[name]=jQuery.extend(deep,clone,copy);}else if(copy!==undefined){target[name]=copy;}}}}
return target;};jQuery.extend({expando:"jQuery"+(version+Math.random()).replace(/\D/g,""),isReady:true,error:function(msg){throw new Error(msg);},noop:function(){},isPlainObject:function(obj){var proto,Ctor;if(!obj||toString.call(obj)!=="[object Object]"){return false;}
proto=getProto(obj);if(!proto){return true;}
Ctor=hasOwn.call(proto,"constructor")&&proto.constructor;return typeof Ctor==="function"&&fnToString.call(Ctor)===ObjectFunctionString;},isEmptyObject:function(obj){var name;for(name in obj){return false;}
return true;},globalEval:function(code,options,doc){DOMEval(code,{nonce:options&&options.nonce},doc);},each:function(obj,callback){var length,i=0;if(isArrayLike(obj)){length=obj.length;for(;i<length;i++){if(callback.call(obj[i],i,obj[i])===false){break;}}}else{for(i in obj){if(callback.call(obj[i],i,obj[i])===false){break;}}}
return obj;},text:function(elem){var node,ret="",i=0,nodeType=elem.nodeType;if(!nodeType){while((node=elem[i++])){ret+=jQuery.text(node);}}
if(nodeType===1||nodeType===11){return elem.textContent;}
if(nodeType===9){return elem.documentElement.textContent;}
if(nodeType===3||nodeType===4){return elem.nodeValue;}
return ret;},makeArray:function(arr,results){var ret=results||[];if(arr!=null){if(isArrayLike(Object(arr))){jQuery.merge(ret,typeof arr==="string"?[arr]:arr);}else{push.call(ret,arr);}}
return ret;},inArray:function(elem,arr,i){return arr==null?-1:indexOf.call(arr,elem,i);},isXMLDoc:function(elem){var namespace=elem&&elem.namespaceURI,docElem=elem&&(elem.ownerDocument||elem).documentElement;return!rhtmlSuffix.test(namespace||docElem&&docElem.nodeName||"HTML");},merge:function(first,second){var len=+second.length,j=0,i=first.length;for(;j<len;j++){first[i++]=second[j];}
first.length=i;return first;},grep:function(elems,callback,invert){var callbackInverse,matches=[],i=0,length=elems.length,callbackExpect=!invert;for(;i<length;i++){callbackInverse=!callback(elems[i],i);if(callbackInverse!==callbackExpect){matches.push(elems[i]);}}
return matches;},map:function(elems,callback,arg){var length,value,i=0,ret=[];if(isArrayLike(elems)){length=elems.length;for(;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret.push(value);}}}else{for(i in elems){value=callback(elems[i],i,arg);if(value!=null){ret.push(value);}}}
return flat(ret);},guid:1,support:support});if(typeof Symbol==="function"){jQuery.fn[Symbol.iterator]=arr[Symbol.iterator];}
jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(_i,name){class2type["[object "+name+"]"]=name.toLowerCase();});function isArrayLike(obj){var length=!!obj&&"length" in obj&&obj.length,type=toType(obj);if(isFunction(obj)||isWindow(obj)){return false;}
return type==="array"||length===0||typeof length==="number"&&length>0&&(length-1)in obj;}
function nodeName(elem,name){return elem.nodeName&&elem.nodeName.toLowerCase()===name.toLowerCase();}
var pop=arr.pop;var sort=arr.sort;var splice=arr.splice;var whitespace="[\\x20\\t\\r\\n\\f]";var rtrimCSS=new RegExp("^"+whitespace+"+|((?:^|[^\\\\])(?:\\\\.)*)"+whitespace+"+$","g");jQuery.contains=function(a,b){var bup=b&&b.parentNode;return a===bup||!!(bup&&bup.nodeType===1&&(a.contains?a.contains(bup):a.compareDocumentPosition&&a.compareDocumentPosition(bup)&16));};var rcssescape=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function fcssescape(ch,asCodePoint){if(asCodePoint){if(ch==="\0"){return"\uFFFD";}
return ch.slice(0,-1)+"\\"+ch.charCodeAt(ch.length-1).toString(16)+" ";}
return"\\"+ch;}
jQuery.escapeSelector=function(sel){return(sel+"").replace(rcssescape,fcssescape);};var preferredDoc=document,pushNative=push;(function(){var i,Expr,outermostContext,sortInput,hasDuplicate,push=pushNative,document,documentElement,documentIsHTML,rbuggyQSA,matches,expando=jQuery.expando,dirruns=0,done=0,classCache=createCache(),tokenCache=createCache(),compilerCache=createCache(),nonnativeSelectorCache=createCache(),sortOrder=function(a,b){if(a===b){hasDuplicate=true;}
return 0;},booleans="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|"+"loop|multiple|open|readonly|required|scoped",identifier="(?:\\\\[\\da-fA-F]{1,6}"+whitespace+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",attributes="\\["+whitespace+"*("+identifier+")(?:"+whitespace+"*([*^$|!~]?=)"+whitespace+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+identifier+"))|)"+
whitespace+"*\\]",pseudos=":("+identifier+")(?:\\(("+"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|"+"((?:\\\\.|[^\\\\()[\\]]|"+attributes+")*)|"+".*"+")\\)|)",rwhitespace=new RegExp(whitespace+"+","g"),rcomma=new RegExp("^"+whitespace+"*,"+whitespace+"*"),rleadingCombinator=new RegExp("^"+whitespace+"*([>+~]|"+whitespace+")"+
whitespace+"*"),rdescend=new RegExp(whitespace+"|>"),rpseudo=new RegExp(pseudos),ridentifier=new RegExp("^"+identifier+"$"),matchExpr={ID:new RegExp("^#("+identifier+")"),CLASS:new RegExp("^\\.("+identifier+")"),TAG:new RegExp("^("+identifier+"|[*])"),ATTR:new RegExp("^"+attributes),PSEUDO:new RegExp("^"+pseudos),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+
whitespace+"*(even|odd|(([+-]|)(\\d*)n|)"+whitespace+"*(?:([+-]|)"+
whitespace+"*(\\d+)|))"+whitespace+"*\\)|)","i"),bool:new RegExp("^(?:"+booleans+")$","i"),needsContext:new RegExp("^"+whitespace+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+whitespace+"*((?:-\\d)?\\d*)"+whitespace+"*\\)|)(?=[^-]|$)","i")},rinputs=/^(?:input|select|textarea|button)$/i,rheader=/^h\d$/i,rquickExpr=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,rsibling=/[+~]/,runescape=new RegExp("\\\\[\\da-fA-F]{1,6}"+whitespace+"?|\\\\([^\\r\\n\\f])","g"),funescape=function(escape,nonHex){var high="0x"+escape.slice(1)-0x10000;if(nonHex){return nonHex;}
return high<0?String.fromCharCode(high+0x10000):String.fromCharCode(high>>10|0xD800,high&0x3FF|0xDC00);},unloadHandler=function(){setDocument();},inDisabledFieldset=addCombinator(function(elem){return elem.disabled===true&&nodeName(elem,"fieldset");},{dir:"parentNode",next:"legend"});function safeActiveElement(){try{return document.activeElement;}catch(err){}}
try{push.apply((arr=slice.call(preferredDoc.childNodes)),preferredDoc.childNodes);arr[preferredDoc.childNodes.length].nodeType;}catch(e){push={apply:function(target,els){pushNative.apply(target,slice.call(els));},call:function(target){pushNative.apply(target,slice.call(arguments,1));}};}
function find(selector,context,results,seed){var m,i,elem,nid,match,groups,newSelector,newContext=context&&context.ownerDocument,nodeType=context?context.nodeType:9;results=results||[];if(typeof selector!=="string"||!selector||nodeType!==1&&nodeType!==9&&nodeType!==11){return results;}
if(!seed){setDocument(context);context=context||document;if(documentIsHTML){if(nodeType!==11&&(match=rquickExpr.exec(selector))){if((m=match[1])){if(nodeType===9){if((elem=context.getElementById(m))){if(elem.id===m){push.call(results,elem);return results;}}else{return results;}}else{if(newContext&&(elem=newContext.getElementById(m))&&find.contains(context,elem)&&elem.id===m){push.call(results,elem);return results;}}}else if(match[2]){push.apply(results,context.getElementsByTagName(selector));return results;}else if((m=match[3])&&context.getElementsByClassName){push.apply(results,context.getElementsByClassName(m));return results;}}
if(!nonnativeSelectorCache[selector+" "]&&(!rbuggyQSA||!rbuggyQSA.test(selector))){newSelector=selector;newContext=context;if(nodeType===1&&(rdescend.test(selector)||rleadingCombinator.test(selector))){newContext=rsibling.test(selector)&&testContext(context.parentNode)||context;if(newContext!=context||!support.scope){if((nid=context.getAttribute("id"))){nid=jQuery.escapeSelector(nid);}else{context.setAttribute("id",(nid=expando));}}
groups=tokenize(selector);i=groups.length;while(i--){groups[i]=(nid?"#"+nid:":scope")+" "+
toSelector(groups[i]);}
newSelector=groups.join(",");}
try{push.apply(results,newContext.querySelectorAll(newSelector));return results;}catch(qsaError){nonnativeSelectorCache(selector,true);}finally{if(nid===expando){context.removeAttribute("id");}}}}}
return select(selector.replace(rtrimCSS,"$1"),context,results,seed);}
function createCache(){var keys=[];function cache(key,value){if(keys.push(key+" ")>Expr.cacheLength){delete cache[keys.shift()];}
return(cache[key+" "]=value);}
return cache;}
function markFunction(fn){fn[expando]=true;return fn;}
function assert(fn){var el=document.createElement("fieldset");try{return!!fn(el);}catch(e){return false;}finally{if(el.parentNode){el.parentNode.removeChild(el);}
el=null;}}
function createInputPseudo(type){return function(elem){return nodeName(elem,"input")&&elem.type===type;};}
function createButtonPseudo(type){return function(elem){return(nodeName(elem,"input")||nodeName(elem,"button"))&&elem.type===type;};}
function createDisabledPseudo(disabled){return function(elem){if("form" in elem){if(elem.parentNode&&elem.disabled===false){if("label" in elem){if("label" in elem.parentNode){return elem.parentNode.disabled===disabled;}else{return elem.disabled===disabled;}}
return elem.isDisabled===disabled||elem.isDisabled!==!disabled&&inDisabledFieldset(elem)===disabled;}
return elem.disabled===disabled;}else if("label" in elem){return elem.disabled===disabled;}
return false;};}
function createPositionalPseudo(fn){return markFunction(function(argument){argument=+argument;return markFunction(function(seed,matches){var j,matchIndexes=fn([],seed.length,argument),i=matchIndexes.length;while(i--){if(seed[(j=matchIndexes[i])]){seed[j]=!(matches[j]=seed[j]);}}});});}
function testContext(context){return context&&typeof context.getElementsByTagName!=="undefined"&&context;}
function setDocument(node){var subWindow,doc=node?node.ownerDocument||node:preferredDoc;if(doc==document||doc.nodeType!==9||!doc.documentElement){return document;}
document=doc;documentElement=document.documentElement;documentIsHTML=!jQuery.isXMLDoc(document);matches=documentElement.matches||documentElement.webkitMatchesSelector||documentElement.msMatchesSelector;if(documentElement.msMatchesSelector&&preferredDoc!=document&&(subWindow=document.defaultView)&&subWindow.top!==subWindow){subWindow.addEventListener("unload",unloadHandler);}
support.getById=assert(function(el){documentElement.appendChild(el).id=jQuery.expando;return!document.getElementsByName||!document.getElementsByName(jQuery.expando).length;});support.disconnectedMatch=assert(function(el){return matches.call(el,"*");});support.scope=assert(function(){return document.querySelectorAll(":scope");});support.cssHas=assert(function(){try{document.querySelector(":has(*,:jqfake)");return false;}catch(e){return true;}});if(support.getById){Expr.filter.ID=function(id){var attrId=id.replace(runescape,funescape);return function(elem){return elem.getAttribute("id")===attrId;};};Expr.find.ID=function(id,context){if(typeof context.getElementById!=="undefined"&&documentIsHTML){var elem=context.getElementById(id);return elem?[elem]:[];}};}else{Expr.filter.ID=function(id){var attrId=id.replace(runescape,funescape);return function(elem){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return node&&node.value===attrId;};};Expr.find.ID=function(id,context){if(typeof context.getElementById!=="undefined"&&documentIsHTML){var node,i,elems,elem=context.getElementById(id);if(elem){node=elem.getAttributeNode("id");if(node&&node.value===id){return[elem];}
elems=context.getElementsByName(id);i=0;while((elem=elems[i++])){node=elem.getAttributeNode("id");if(node&&node.value===id){return[elem];}}}
return[];}};}
Expr.find.TAG=function(tag,context){if(typeof context.getElementsByTagName!=="undefined"){return context.getElementsByTagName(tag);}else{return context.querySelectorAll(tag);}};Expr.find.CLASS=function(className,context){if(typeof context.getElementsByClassName!=="undefined"&&documentIsHTML){return context.getElementsByClassName(className);}};rbuggyQSA=[];assert(function(el){var input;documentElement.appendChild(el).innerHTML="<a id='"+expando+"' href='' disabled='disabled'></a>"+"<select id='"+expando+"-\r\\' disabled='disabled'>"+"<option selected=''></option></select>";if(!el.querySelectorAll("[selected]").length){rbuggyQSA.push("\\["+whitespace+"*(?:value|"+booleans+")");}
if(!el.querySelectorAll("[id~="+expando+"-]").length){rbuggyQSA.push("~=");}
if(!el.querySelectorAll("a#"+expando+"+*").length){rbuggyQSA.push(".#.+[+~]");}
if(!el.querySelectorAll(":checked").length){rbuggyQSA.push(":checked");}
input=document.createElement("input");input.setAttribute("type","hidden");el.appendChild(input).setAttribute("name","D");documentElement.appendChild(el).disabled=true;if(el.querySelectorAll(":disabled").length!==2){rbuggyQSA.push(":enabled",":disabled");}
input=document.createElement("input");input.setAttribute("name","");el.appendChild(input);if(!el.querySelectorAll("[name='']").length){rbuggyQSA.push("\\["+whitespace+"*name"+whitespace+"*="+
whitespace+"*(?:''|\"\")");}});if(!support.cssHas){rbuggyQSA.push(":has");}
rbuggyQSA=rbuggyQSA.length&&new RegExp(rbuggyQSA.join("|"));sortOrder=function(a,b){if(a===b){hasDuplicate=true;return 0;}
var compare=!a.compareDocumentPosition-!b.compareDocumentPosition;if(compare){return compare;}
compare=(a.ownerDocument||a)==(b.ownerDocument||b)?a.compareDocumentPosition(b):1;if(compare&1||(!support.sortDetached&&b.compareDocumentPosition(a)===compare)){if(a===document||a.ownerDocument==preferredDoc&&find.contains(preferredDoc,a)){return-1;}
if(b===document||b.ownerDocument==preferredDoc&&find.contains(preferredDoc,b)){return 1;}
return sortInput?(indexOf.call(sortInput,a)-indexOf.call(sortInput,b)):0;}
return compare&4?-1:1;};return document;}
find.matches=function(expr,elements){return find(expr,null,null,elements);};find.matchesSelector=function(elem,expr){setDocument(elem);if(documentIsHTML&&!nonnativeSelectorCache[expr+" "]&&(!rbuggyQSA||!rbuggyQSA.test(expr))){try{var ret=matches.call(elem,expr);if(ret||support.disconnectedMatch||elem.document&&elem.document.nodeType!==11){return ret;}}catch(e){nonnativeSelectorCache(expr,true);}}
return find(expr,document,null,[elem]).length>0;};find.contains=function(context,elem){if((context.ownerDocument||context)!=document){setDocument(context);}
return jQuery.contains(context,elem);};find.attr=function(elem,name){if((elem.ownerDocument||elem)!=document){setDocument(elem);}
var fn=Expr.attrHandle[name.toLowerCase()],val=fn&&hasOwn.call(Expr.attrHandle,name.toLowerCase())?fn(elem,name,!documentIsHTML):undefined;if(val!==undefined){return val;}
return elem.getAttribute(name);};find.error=function(msg){throw new Error("Syntax error, unrecognized expression: "+msg);};jQuery.uniqueSort=function(results){var elem,duplicates=[],j=0,i=0;hasDuplicate=!support.sortStable;sortInput=!support.sortStable&&slice.call(results,0);sort.call(results,sortOrder);if(hasDuplicate){while((elem=results[i++])){if(elem===results[i]){j=duplicates.push(i);}}
while(j--){splice.call(results,duplicates[j],1);}}
sortInput=null;return results;};jQuery.fn.uniqueSort=function(){return this.pushStack(jQuery.uniqueSort(slice.apply(this)));};Expr=jQuery.expr={cacheLength:50,createPseudo:markFunction,match:matchExpr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(match){match[1]=match[1].replace(runescape,funescape);match[3]=(match[3]||match[4]||match[5]||"").replace(runescape,funescape);if(match[2]==="~="){match[3]=" "+match[3]+" ";}
return match.slice(0,4);},CHILD:function(match){match[1]=match[1].toLowerCase();if(match[1].slice(0,3)==="nth"){if(!match[3]){find.error(match[0]);}
match[4]=+(match[4]?match[5]+(match[6]||1):2*(match[3]==="even"||match[3]==="odd"));match[5]=+((match[7]+match[8])||match[3]==="odd");}else if(match[3]){find.error(match[0]);}
return match;},PSEUDO:function(match){var excess,unquoted=!match[6]&&match[2];if(matchExpr.CHILD.test(match[0])){return null;}
if(match[3]){match[2]=match[4]||match[5]||"";}else if(unquoted&&rpseudo.test(unquoted)&&(excess=tokenize(unquoted,true))&&(excess=unquoted.indexOf(")",unquoted.length-excess)-unquoted.length)){match[0]=match[0].slice(0,excess);match[2]=unquoted.slice(0,excess);}
return match.slice(0,3);}},filter:{TAG:function(nodeNameSelector){var expectedNodeName=nodeNameSelector.replace(runescape,funescape).toLowerCase();return nodeNameSelector==="*"?function(){return true;}:function(elem){return nodeName(elem,expectedNodeName);};},CLASS:function(className){var pattern=classCache[className+" "];return pattern||(pattern=new RegExp("(^|"+whitespace+")"+className+"("+whitespace+"|$)"))&&classCache(className,function(elem){return pattern.test(typeof elem.className==="string"&&elem.className||typeof elem.getAttribute!=="undefined"&&elem.getAttribute("class")||"");});},ATTR:function(name,operator,check){return function(elem){var result=find.attr(elem,name);if(result==null){return operator==="!=";}
if(!operator){return true;}
result+="";if(operator==="="){return result===check;}
if(operator==="!="){return result!==check;}
if(operator==="^="){return check&&result.indexOf(check)===0;}
if(operator==="*="){return check&&result.indexOf(check)>-1;}
if(operator==="$="){return check&&result.slice(-check.length)===check;}
if(operator==="~="){return(" "+result.replace(rwhitespace," ")+" ").indexOf(check)>-1;}
if(operator==="|="){return result===check||result.slice(0,check.length+1)===check+"-";}
return false;};},CHILD:function(type,what,_argument,first,last){var simple=type.slice(0,3)!=="nth",forward=type.slice(-4)!=="last",ofType=what==="of-type";return first===1&&last===0?function(elem){return!!elem.parentNode;}:function(elem,_context,xml){var cache,outerCache,node,nodeIndex,start,dir=simple!==forward?"nextSibling":"previousSibling",parent=elem.parentNode,name=ofType&&elem.nodeName.toLowerCase(),useCache=!xml&&!ofType,diff=false;if(parent){if(simple){while(dir){node=elem;while((node=node[dir])){if(ofType?nodeName(node,name):node.nodeType===1){return false;}}
start=dir=type==="only"&&!start&&"nextSibling";}
return true;}
start=[forward?parent.firstChild:parent.lastChild];if(forward&&useCache){outerCache=parent[expando]||(parent[expando]={});cache=outerCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex&&cache[2];node=nodeIndex&&parent.childNodes[nodeIndex];while((node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop())){if(node.nodeType===1&&++diff&&node===elem){outerCache[type]=[dirruns,nodeIndex,diff];break;}}}else{if(useCache){outerCache=elem[expando]||(elem[expando]={});cache=outerCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex;}
if(diff===false){while((node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop())){if((ofType?nodeName(node,name):node.nodeType===1)&&++diff){if(useCache){outerCache=node[expando]||(node[expando]={});outerCache[type]=[dirruns,diff];}
if(node===elem){break;}}}}}
diff-=last;return diff===first||(diff%first===0&&diff/first>=0);}};},PSEUDO:function(pseudo,argument){var args,fn=Expr.pseudos[pseudo]||Expr.setFilters[pseudo.toLowerCase()]||find.error("unsupported pseudo: "+pseudo);if(fn[expando]){return fn(argument);}
if(fn.length>1){args=[pseudo,pseudo,"",argument];return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase())?markFunction(function(seed,matches){var idx,matched=fn(seed,argument),i=matched.length;while(i--){idx=indexOf.call(seed,matched[i]);seed[idx]=!(matches[idx]=matched[i]);}}):function(elem){return fn(elem,0,args);};}
return fn;}},pseudos:{not:markFunction(function(selector){var input=[],results=[],matcher=compile(selector.replace(rtrimCSS,"$1"));return matcher[expando]?markFunction(function(seed,matches,_context,xml){var elem,unmatched=matcher(seed,null,xml,[]),i=seed.length;while(i--){if((elem=unmatched[i])){seed[i]=!(matches[i]=elem);}}}):function(elem,_context,xml){input[0]=elem;matcher(input,null,xml,results);input[0]=null;return!results.pop();};}),has:markFunction(function(selector){return function(elem){return find(selector,elem).length>0;};}),contains:markFunction(function(text){text=text.replace(runescape,funescape);return function(elem){return(elem.textContent||jQuery.text(elem)).indexOf(text)>-1;};}),lang:markFunction(function(lang){if(!ridentifier.test(lang||"")){find.error("unsupported lang: "+lang);}
lang=lang.replace(runescape,funescape).toLowerCase();return function(elem){var elemLang;do{if((elemLang=documentIsHTML?elem.lang:elem.getAttribute("xml:lang")||elem.getAttribute("lang"))){elemLang=elemLang.toLowerCase();return elemLang===lang||elemLang.indexOf(lang+"-")===0;}}while((elem=elem.parentNode)&&elem.nodeType===1);return false;};}),target:function(elem){var hash=window.location&&window.location.hash;return hash&&hash.slice(1)===elem.id;},root:function(elem){return elem===documentElement;},focus:function(elem){return elem===safeActiveElement()&&document.hasFocus()&&!!(elem.type||elem.href||~elem.tabIndex);},enabled:createDisabledPseudo(false),disabled:createDisabledPseudo(true),checked:function(elem){return(nodeName(elem,"input")&&!!elem.checked)||(nodeName(elem,"option")&&!!elem.selected);},selected:function(elem){if(elem.parentNode){elem.parentNode.selectedIndex;}
return elem.selected===true;},empty:function(elem){for(elem=elem.firstChild;elem;elem=elem.nextSibling){if(elem.nodeType<6){return false;}}
return true;},parent:function(elem){return!Expr.pseudos.empty(elem);},header:function(elem){return rheader.test(elem.nodeName);},input:function(elem){return rinputs.test(elem.nodeName);},button:function(elem){return nodeName(elem,"input")&&elem.type==="button"||nodeName(elem,"button");},text:function(elem){var attr;return nodeName(elem,"input")&&elem.type==="text"&&((attr=elem.getAttribute("type"))==null||attr.toLowerCase()==="text");},first:createPositionalPseudo(function(){return[0];}),last:createPositionalPseudo(function(_matchIndexes,length){return[length-1];}),eq:createPositionalPseudo(function(_matchIndexes,length,argument){return[argument<0?argument+length:argument];}),even:createPositionalPseudo(function(matchIndexes,length){var i=0;for(;i<length;i+=2){matchIndexes.push(i);}
return matchIndexes;}),odd:createPositionalPseudo(function(matchIndexes,length){var i=1;for(;i<length;i+=2){matchIndexes.push(i);}
return matchIndexes;}),lt:createPositionalPseudo(function(matchIndexes,length,argument){var i;if(argument<0){i=argument+length;}else if(argument>length){i=length;}else{i=argument;}
for(;--i>=0;){matchIndexes.push(i);}
return matchIndexes;}),gt:createPositionalPseudo(function(matchIndexes,length,argument){var i=argument<0?argument+length:argument;for(;++i<length;){matchIndexes.push(i);}
return matchIndexes;})}};Expr.pseudos.nth=Expr.pseudos.eq;for(i in{radio:true,checkbox:true,file:true,password:true,image:true}){Expr.pseudos[i]=createInputPseudo(i);}
for(i in{submit:true,reset:true}){Expr.pseudos[i]=createButtonPseudo(i);}
function setFilters(){}
setFilters.prototype=Expr.filters=Expr.pseudos;Expr.setFilters=new setFilters();function tokenize(selector,parseOnly){var matched,match,tokens,type,soFar,groups,preFilters,cached=tokenCache[selector+" "];if(cached){return parseOnly?0:cached.slice(0);}
soFar=selector;groups=[];preFilters=Expr.preFilter;while(soFar){if(!matched||(match=rcomma.exec(soFar))){if(match){soFar=soFar.slice(match[0].length)||soFar;}
groups.push((tokens=[]));}
matched=false;if((match=rleadingCombinator.exec(soFar))){matched=match.shift();tokens.push({value:matched,type:match[0].replace(rtrimCSS," ")});soFar=soFar.slice(matched.length);}
for(type in Expr.filter){if((match=matchExpr[type].exec(soFar))&&(!preFilters[type]||(match=preFilters[type](match)))){matched=match.shift();tokens.push({value:matched,type:type,matches:match});soFar=soFar.slice(matched.length);}}
if(!matched){break;}}
if(parseOnly){return soFar.length;}
return soFar?find.error(selector):tokenCache(selector,groups).slice(0);}
function toSelector(tokens){var i=0,len=tokens.length,selector="";for(;i<len;i++){selector+=tokens[i].value;}
return selector;}
function addCombinator(matcher,combinator,base){var dir=combinator.dir,skip=combinator.next,key=skip||dir,checkNonElements=base&&key==="parentNode",doneName=done++;return combinator.first?function(elem,context,xml){while((elem=elem[dir])){if(elem.nodeType===1||checkNonElements){return matcher(elem,context,xml);}}
return false;}:function(elem,context,xml){var oldCache,outerCache,newCache=[dirruns,doneName];if(xml){while((elem=elem[dir])){if(elem.nodeType===1||checkNonElements){if(matcher(elem,context,xml)){return true;}}}}else{while((elem=elem[dir])){if(elem.nodeType===1||checkNonElements){outerCache=elem[expando]||(elem[expando]={});if(skip&&nodeName(elem,skip)){elem=elem[dir]||elem;}else if((oldCache=outerCache[key])&&oldCache[0]===dirruns&&oldCache[1]===doneName){return(newCache[2]=oldCache[2]);}else{outerCache[key]=newCache;if((newCache[2]=matcher(elem,context,xml))){return true;}}}}}
return false;};}
function elementMatcher(matchers){return matchers.length>1?function(elem,context,xml){var i=matchers.length;while(i--){if(!matchers[i](elem,context,xml)){return false;}}
return true;}:matchers[0];}
function multipleContexts(selector,contexts,results){var i=0,len=contexts.length;for(;i<len;i++){find(selector,contexts[i],results);}
return results;}
function condense(unmatched,map,filter,context,xml){var elem,newUnmatched=[],i=0,len=unmatched.length,mapped=map!=null;for(;i<len;i++){if((elem=unmatched[i])){if(!filter||filter(elem,context,xml)){newUnmatched.push(elem);if(mapped){map.push(i);}}}}
return newUnmatched;}
function setMatcher(preFilter,selector,matcher,postFilter,postFinder,postSelector){if(postFilter&&!postFilter[expando]){postFilter=setMatcher(postFilter);}
if(postFinder&&!postFinder[expando]){postFinder=setMatcher(postFinder,postSelector);}
return markFunction(function(seed,results,context,xml){var temp,i,elem,matcherOut,preMap=[],postMap=[],preexisting=results.length,elems=seed||multipleContexts(selector||"*",context.nodeType?[context]:context,[]),matcherIn=preFilter&&(seed||!selector)?condense(elems,preMap,preFilter,context,xml):elems;if(matcher){matcherOut=postFinder||(seed?preFilter:preexisting||postFilter)?[]:results;matcher(matcherIn,matcherOut,context,xml);}else{matcherOut=matcherIn;}
if(postFilter){temp=condense(matcherOut,postMap);postFilter(temp,[],context,xml);i=temp.length;while(i--){if((elem=temp[i])){matcherOut[postMap[i]]=!(matcherIn[postMap[i]]=elem);}}}
if(seed){if(postFinder||preFilter){if(postFinder){temp=[];i=matcherOut.length;while(i--){if((elem=matcherOut[i])){temp.push((matcherIn[i]=elem));}}
postFinder(null,(matcherOut=[]),temp,xml);}
i=matcherOut.length;while(i--){if((elem=matcherOut[i])&&(temp=postFinder?indexOf.call(seed,elem):preMap[i])>-1){seed[temp]=!(results[temp]=elem);}}}}else{matcherOut=condense(matcherOut===results?matcherOut.splice(preexisting,matcherOut.length):matcherOut);if(postFinder){postFinder(null,results,matcherOut,xml);}else{push.apply(results,matcherOut);}}});}
function matcherFromTokens(tokens){var checkContext,matcher,j,len=tokens.length,leadingRelative=Expr.relative[tokens[0].type],implicitRelative=leadingRelative||Expr.relative[" "],i=leadingRelative?1:0,matchContext=addCombinator(function(elem){return elem===checkContext;},implicitRelative,true),matchAnyContext=addCombinator(function(elem){return indexOf.call(checkContext,elem)>-1;},implicitRelative,true),matchers=[function(elem,context,xml){var ret=(!leadingRelative&&(xml||context!=outermostContext))||((checkContext=context).nodeType?matchContext(elem,context,xml):matchAnyContext(elem,context,xml));checkContext=null;return ret;}];for(;i<len;i++){if((matcher=Expr.relative[tokens[i].type])){matchers=[addCombinator(elementMatcher(matchers),matcher)];}else{matcher=Expr.filter[tokens[i].type].apply(null,tokens[i].matches);if(matcher[expando]){j=++i;for(;j<len;j++){if(Expr.relative[tokens[j].type]){break;}}
return setMatcher(i>1&&elementMatcher(matchers),i>1&&toSelector(tokens.slice(0,i-1).concat({value:tokens[i-2].type===" "?"*":""})).replace(rtrimCSS,"$1"),matcher,i<j&&matcherFromTokens(tokens.slice(i,j)),j<len&&matcherFromTokens((tokens=tokens.slice(j))),j<len&&toSelector(tokens));}
matchers.push(matcher);}}
return elementMatcher(matchers);}
function matcherFromGroupMatchers(elementMatchers,setMatchers){var bySet=setMatchers.length>0,byElement=elementMatchers.length>0,superMatcher=function(seed,context,xml,results,outermost){var elem,j,matcher,matchedCount=0,i="0",unmatched=seed&&[],setMatched=[],contextBackup=outermostContext,elems=seed||byElement&&Expr.find.TAG("*",outermost),dirrunsUnique=(dirruns+=contextBackup==null?1:Math.random()||0.1),len=elems.length;if(outermost){outermostContext=context==document||context||outermost;}
for(;i!==len&&(elem=elems[i])!=null;i++){if(byElement&&elem){j=0;if(!context&&elem.ownerDocument!=document){setDocument(elem);xml=!documentIsHTML;}
while((matcher=elementMatchers[j++])){if(matcher(elem,context||document,xml)){push.call(results,elem);break;}}
if(outermost){dirruns=dirrunsUnique;}}
if(bySet){if((elem=!matcher&&elem)){matchedCount--;}
if(seed){unmatched.push(elem);}}}
matchedCount+=i;if(bySet&&i!==matchedCount){j=0;while((matcher=setMatchers[j++])){matcher(unmatched,setMatched,context,xml);}
if(seed){if(matchedCount>0){while(i--){if(!(unmatched[i]||setMatched[i])){setMatched[i]=pop.call(results);}}}
setMatched=condense(setMatched);}
push.apply(results,setMatched);if(outermost&&!seed&&setMatched.length>0&&(matchedCount+setMatchers.length)>1){jQuery.uniqueSort(results);}}
if(outermost){dirruns=dirrunsUnique;outermostContext=contextBackup;}
return unmatched;};return bySet?markFunction(superMatcher):superMatcher;}
function compile(selector,match){var i,setMatchers=[],elementMatchers=[],cached=compilerCache[selector+" "];if(!cached){if(!match){match=tokenize(selector);}
i=match.length;while(i--){cached=matcherFromTokens(match[i]);if(cached[expando]){setMatchers.push(cached);}else{elementMatchers.push(cached);}}
cached=compilerCache(selector,matcherFromGroupMatchers(elementMatchers,setMatchers));cached.selector=selector;}
return cached;}
function select(selector,context,results,seed){var i,tokens,token,type,find,compiled=typeof selector==="function"&&selector,match=!seed&&tokenize((selector=compiled.selector||selector));results=results||[];if(match.length===1){tokens=match[0]=match[0].slice(0);if(tokens.length>2&&(token=tokens[0]).type==="ID"&&context.nodeType===9&&documentIsHTML&&Expr.relative[tokens[1].type]){context=(Expr.find.ID(token.matches[0].replace(runescape,funescape),context)||[])[0];if(!context){return results;}else if(compiled){context=context.parentNode;}
selector=selector.slice(tokens.shift().value.length);}
i=matchExpr.needsContext.test(selector)?0:tokens.length;while(i--){token=tokens[i];if(Expr.relative[(type=token.type)]){break;}
if((find=Expr.find[type])){if((seed=find(token.matches[0].replace(runescape,funescape),rsibling.test(tokens[0].type)&&testContext(context.parentNode)||context))){tokens.splice(i,1);selector=seed.length&&toSelector(tokens);if(!selector){push.apply(results,seed);return results;}
break;}}}}
(compiled||compile(selector,match))(seed,context,!documentIsHTML,results,!context||rsibling.test(selector)&&testContext(context.parentNode)||context);return results;}
support.sortStable=expando.split("").sort(sortOrder).join("")===expando;setDocument();support.sortDetached=assert(function(el){return el.compareDocumentPosition(document.createElement("fieldset"))&1;});jQuery.find=find;jQuery.expr[":"]=jQuery.expr.pseudos;jQuery.unique=jQuery.uniqueSort;find.compile=compile;find.select=select;find.setDocument=setDocument;find.tokenize=tokenize;find.escape=jQuery.escapeSelector;find.getText=jQuery.text;find.isXML=jQuery.isXMLDoc;find.selectors=jQuery.expr;find.support=jQuery.support;find.uniqueSort=jQuery.uniqueSort;})();var dir=function(elem,dir,until){var matched=[],truncate=until!==undefined;while((elem=elem[dir])&&elem.nodeType!==9){if(elem.nodeType===1){if(truncate&&jQuery(elem).is(until)){break;}
matched.push(elem);}}
return matched;};var siblings=function(n,elem){var matched=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){matched.push(n);}}
return matched;};var rneedsContext=jQuery.expr.match.needsContext;var rsingleTag=(/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i);function winnow(elements,qualifier,not){if(isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){return!!qualifier.call(elem,i,elem)!==not;});}
if(qualifier.nodeType){return jQuery.grep(elements,function(elem){return(elem===qualifier)!==not;});}
if(typeof qualifier!=="string"){return jQuery.grep(elements,function(elem){return(indexOf.call(qualifier,elem)>-1)!==not;});}
return jQuery.filter(qualifier,elements,not);}
jQuery.filter=function(expr,elems,not){var elem=elems[0];if(not){expr=":not("+expr+")";}
if(elems.length===1&&elem.nodeType===1){return jQuery.find.matchesSelector(elem,expr)?[elem]:[];}
return jQuery.find.matches(expr,jQuery.grep(elems,function(elem){return elem.nodeType===1;}));};jQuery.fn.extend({find:function(selector){var i,ret,len=this.length,self=this;if(typeof selector!=="string"){return this.pushStack(jQuery(selector).filter(function(){for(i=0;i<len;i++){if(jQuery.contains(self[i],this)){return true;}}}));}
ret=this.pushStack([]);for(i=0;i<len;i++){jQuery.find(selector,self[i],ret);}
return len>1?jQuery.uniqueSort(ret):ret;},filter:function(selector){return this.pushStack(winnow(this,selector||[],false));},not:function(selector){return this.pushStack(winnow(this,selector||[],true));},is:function(selector){return!!winnow(this,typeof selector==="string"&&rneedsContext.test(selector)?jQuery(selector):selector||[],false).length;}});var rootjQuery,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,init=jQuery.fn.init=function(selector,context,root){var match,elem;if(!selector){return this;}
root=root||rootjQuery;if(typeof selector==="string"){if(selector[0]==="<"&&selector[selector.length-1]===">"&&selector.length>=3){match=[null,selector,null];}else{match=rquickExpr.exec(selector);}
if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;jQuery.merge(this,jQuery.parseHTML(match[1],context&&context.nodeType?context.ownerDocument||context:document,true));if(rsingleTag.test(match[1])&&jQuery.isPlainObject(context)){for(match in context){if(isFunction(this[match])){this[match](context[match]);}else{this.attr(match,context[match]);}}}
return this;}else{elem=document.getElementById(match[2]);if(elem){this[0]=elem;this.length=1;}
return this;}}else if(!context||context.jquery){return(context||root).find(selector);}else{return this.constructor(context).find(selector);}}else if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(isFunction(selector)){return root.ready!==undefined?root.ready(selector):selector(jQuery);}
return jQuery.makeArray(selector,this);};init.prototype=jQuery.fn;rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({has:function(target){var targets=jQuery(target,this),l=targets.length;return this.filter(function(){var i=0;for(;i<l;i++){if(jQuery.contains(this,targets[i])){return true;}}});},closest:function(selectors,context){var cur,i=0,l=this.length,matched=[],targets=typeof selectors!=="string"&&jQuery(selectors);if(!rneedsContext.test(selectors)){for(;i<l;i++){for(cur=this[i];cur&&cur!==context;cur=cur.parentNode){if(cur.nodeType<11&&(targets?targets.index(cur)>-1:cur.nodeType===1&&jQuery.find.matchesSelector(cur,selectors))){matched.push(cur);break;}}}}
return this.pushStack(matched.length>1?jQuery.uniqueSort(matched):matched);},index:function(elem){if(!elem){return(this[0]&&this[0].parentNode)?this.first().prevAll().length:-1;}
if(typeof elem==="string"){return indexOf.call(jQuery(elem),this[0]);}
return indexOf.call(this,elem.jquery?elem[0]:elem);},add:function(selector,context){return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(),jQuery(selector,context))));},addBack:function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector));}});function sibling(cur,dir){while((cur=cur[dir])&&cur.nodeType!==1){}
return cur;}
jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null;},parents:function(elem){return dir(elem,"parentNode");},parentsUntil:function(elem,_i,until){return dir(elem,"parentNode",until);},next:function(elem){return sibling(elem,"nextSibling");},prev:function(elem){return sibling(elem,"previousSibling");},nextAll:function(elem){return dir(elem,"nextSibling");},prevAll:function(elem){return dir(elem,"previousSibling");},nextUntil:function(elem,_i,until){return dir(elem,"nextSibling",until);},prevUntil:function(elem,_i,until){return dir(elem,"previousSibling",until);},siblings:function(elem){return siblings((elem.parentNode||{}).firstChild,elem);},children:function(elem){return siblings(elem.firstChild);},contents:function(elem){if(elem.contentDocument!=null&&getProto(elem.contentDocument)){return elem.contentDocument;}
if(nodeName(elem,"template")){elem=elem.content||elem;}
return jQuery.merge([],elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(until,selector){var matched=jQuery.map(this,fn,until);if(name.slice(-5)!=="Until"){selector=until;}
if(selector&&typeof selector==="string"){matched=jQuery.filter(selector,matched);}
if(this.length>1){if(!guaranteedUnique[name]){jQuery.uniqueSort(matched);}
if(rparentsprev.test(name)){matched.reverse();}}
return this.pushStack(matched);};});var rnothtmlwhite=(/[^\x20\t\r\n\f]+/g);function createOptions(options){var object={};jQuery.each(options.match(rnothtmlwhite)||[],function(_,flag){object[flag]=true;});return object;}
jQuery.Callbacks=function(options){options=typeof options==="string"?createOptions(options):jQuery.extend({},options);var
firing,memory,fired,locked,list=[],queue=[],firingIndex=-1,fire=function(){locked=locked||options.once;fired=firing=true;for(;queue.length;firingIndex=-1){memory=queue.shift();while(++firingIndex<list.length){if(list[firingIndex].apply(memory[0],memory[1])===false&&options.stopOnFalse){firingIndex=list.length;memory=false;}}}
if(!options.memory){memory=false;}
firing=false;if(locked){if(memory){list=[];}else{list="";}}},self={add:function(){if(list){if(memory&&!firing){firingIndex=list.length-1;queue.push(memory);}
(function add(args){jQuery.each(args,function(_,arg){if(isFunction(arg)){if(!options.unique||!self.has(arg)){list.push(arg);}}else if(arg&&arg.length&&toType(arg)!=="string"){add(arg);}});})(arguments);if(memory&&!firing){fire();}}
return this;},remove:function(){jQuery.each(arguments,function(_,arg){var index;while((index=jQuery.inArray(arg,list,index))>-1){list.splice(index,1);if(index<=firingIndex){firingIndex--;}}});return this;},has:function(fn){return fn?jQuery.inArray(fn,list)>-1:list.length>0;},empty:function(){if(list){list=[];}
return this;},disable:function(){locked=queue=[];list=memory="";return this;},disabled:function(){return!list;},lock:function(){locked=queue=[];if(!memory&&!firing){list=memory="";}
return this;},locked:function(){return!!locked;},fireWith:function(context,args){if(!locked){args=args||[];args=[context,args.slice?args.slice():args];queue.push(args);if(!firing){fire();}}
return this;},fire:function(){self.fireWith(this,arguments);return this;},fired:function(){return!!fired;}};return self;};function Identity(v){return v;}
function Thrower(ex){throw ex;}
function adoptValue(value,resolve,reject,noValue){var method;try{if(value&&isFunction((method=value.promise))){method.call(value).done(resolve).fail(reject);}else if(value&&isFunction((method=value.then))){method.call(value,resolve,reject);}else{resolve.apply(undefined,[value].slice(noValue));}}catch(value){reject.apply(undefined,[value]);}}
jQuery.extend({Deferred:function(func){var tuples=[["notify","progress",jQuery.Callbacks("memory"),jQuery.Callbacks("memory"),2],["resolve","done",jQuery.Callbacks("once memory"),jQuery.Callbacks("once memory"),0,"resolved"],["reject","fail",jQuery.Callbacks("once memory"),jQuery.Callbacks("once memory"),1,"rejected"]],state="pending",promise={state:function(){return state;},always:function(){deferred.done(arguments).fail(arguments);return this;},"catch":function(fn){return promise.then(null,fn);},pipe:function(){var fns=arguments;return jQuery.Deferred(function(newDefer){jQuery.each(tuples,function(_i,tuple){var fn=isFunction(fns[tuple[4]])&&fns[tuple[4]];deferred[tuple[1]](function(){var returned=fn&&fn.apply(this,arguments);if(returned&&isFunction(returned.promise)){returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);}else{newDefer[tuple[0]+"With"](this,fn?[returned]:arguments);}});});fns=null;}).promise();},then:function(onFulfilled,onRejected,onProgress){var maxDepth=0;function resolve(depth,deferred,handler,special){return function(){var that=this,args=arguments,mightThrow=function(){var returned,then;if(depth<maxDepth){return;}
returned=handler.apply(that,args);if(returned===deferred.promise()){throw new TypeError("Thenable self-resolution");}
then=returned&&(typeof returned==="object"||typeof returned==="function")&&returned.then;if(isFunction(then)){if(special){then.call(returned,resolve(maxDepth,deferred,Identity,special),resolve(maxDepth,deferred,Thrower,special));}else{maxDepth++;then.call(returned,resolve(maxDepth,deferred,Identity,special),resolve(maxDepth,deferred,Thrower,special),resolve(maxDepth,deferred,Identity,deferred.notifyWith));}}else{if(handler!==Identity){that=undefined;args=[returned];}
(special||deferred.resolveWith)(that,args);}},process=special?mightThrow:function(){try{mightThrow();}catch(e){if(jQuery.Deferred.exceptionHook){jQuery.Deferred.exceptionHook(e,process.error);}
if(depth+1>=maxDepth){if(handler!==Thrower){that=undefined;args=[e];}
deferred.rejectWith(that,args);}}};if(depth){process();}else{if(jQuery.Deferred.getErrorHook){process.error=jQuery.Deferred.getErrorHook();}else if(jQuery.Deferred.getStackHook){process.error=jQuery.Deferred.getStackHook();}
window.setTimeout(process);}};}
return jQuery.Deferred(function(newDefer){tuples[0][3].add(resolve(0,newDefer,isFunction(onProgress)?onProgress:Identity,newDefer.notifyWith));tuples[1][3].add(resolve(0,newDefer,isFunction(onFulfilled)?onFulfilled:Identity));tuples[2][3].add(resolve(0,newDefer,isFunction(onRejected)?onRejected:Thrower));}).promise();},promise:function(obj){return obj!=null?jQuery.extend(obj,promise):promise;}},deferred={};jQuery.each(tuples,function(i,tuple){var list=tuple[2],stateString=tuple[5];promise[tuple[1]]=list.add;if(stateString){list.add(function(){state=stateString;},tuples[3-i][2].disable,tuples[3-i][3].disable,tuples[0][2].lock,tuples[0][3].lock);}
list.add(tuple[3].fire);deferred[tuple[0]]=function(){deferred[tuple[0]+"With"](this===deferred?undefined:this,arguments);return this;};deferred[tuple[0]+"With"]=list.fireWith;});promise.promise(deferred);if(func){func.call(deferred,deferred);}
return deferred;},when:function(singleValue){var
remaining=arguments.length,i=remaining,resolveContexts=Array(i),resolveValues=slice.call(arguments),primary=jQuery.Deferred(),updateFunc=function(i){return function(value){resolveContexts[i]=this;resolveValues[i]=arguments.length>1?slice.call(arguments):value;if(!(--remaining)){primary.resolveWith(resolveContexts,resolveValues);}};};if(remaining<=1){adoptValue(singleValue,primary.done(updateFunc(i)).resolve,primary.reject,!remaining);if(primary.state()==="pending"||isFunction(resolveValues[i]&&resolveValues[i].then)){return primary.then();}}
while(i--){adoptValue(resolveValues[i],updateFunc(i),primary.reject);}
return primary.promise();}});var rerrorNames=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;jQuery.Deferred.exceptionHook=function(error,asyncError){if(window.console&&window.console.warn&&error&&rerrorNames.test(error.name)){window.console.warn("jQuery.Deferred exception: "+error.message,error.stack,asyncError);}};jQuery.readyException=function(error){window.setTimeout(function(){throw error;});};var readyList=jQuery.Deferred();jQuery.fn.ready=function(fn){readyList.then(fn).catch(function(error){jQuery.readyException(error);});return this;};jQuery.extend({isReady:false,readyWait:1,ready:function(wait){if(wait===true?--jQuery.readyWait:jQuery.isReady){return;}
jQuery.isReady=true;if(wait!==true&&--jQuery.readyWait>0){return;}
readyList.resolveWith(document,[jQuery]);}});jQuery.ready.then=readyList.then;function completed(){document.removeEventListener("DOMContentLoaded",completed);window.removeEventListener("load",completed);jQuery.ready();}
if(document.readyState==="complete"||(document.readyState!=="loading"&&!document.documentElement.doScroll)){window.setTimeout(jQuery.ready);}else{document.addEventListener("DOMContentLoaded",completed);window.addEventListener("load",completed);}
var access=function(elems,fn,key,value,chainable,emptyGet,raw){var i=0,len=elems.length,bulk=key==null;if(toType(key)==="object"){chainable=true;for(i in key){access(elems,fn,i,key[i],true,emptyGet,raw);}}else if(value!==undefined){chainable=true;if(!isFunction(value)){raw=true;}
if(bulk){if(raw){fn.call(elems,value);fn=null;}else{bulk=fn;fn=function(elem,_key,value){return bulk.call(jQuery(elem),value);};}}
if(fn){for(;i<len;i++){fn(elems[i],key,raw?value:value.call(elems[i],i,fn(elems[i],key)));}}}
if(chainable){return elems;}
if(bulk){return fn.call(elems);}
return len?fn(elems[0],key):emptyGet;};var rmsPrefix=/^-ms-/,rdashAlpha=/-([a-z])/g;function fcamelCase(_all,letter){return letter.toUpperCase();}
function camelCase(string){return string.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase);}
var acceptData=function(owner){return owner.nodeType===1||owner.nodeType===9||!(+owner.nodeType);};function Data(){this.expando=jQuery.expando+Data.uid++;}
Data.uid=1;Data.prototype={cache:function(owner){var value=owner[this.expando];if(!value){value={};if(acceptData(owner)){if(owner.nodeType){owner[this.expando]=value;}else{Object.defineProperty(owner,this.expando,{value:value,configurable:true});}}}
return value;},set:function(owner,data,value){var prop,cache=this.cache(owner);if(typeof data==="string"){cache[camelCase(data)]=value;}else{for(prop in data){cache[camelCase(prop)]=data[prop];}}
return cache;},get:function(owner,key){return key===undefined?this.cache(owner):owner[this.expando]&&owner[this.expando][camelCase(key)];},access:function(owner,key,value){if(key===undefined||((key&&typeof key==="string")&&value===undefined)){return this.get(owner,key);}
this.set(owner,key,value);return value!==undefined?value:key;},remove:function(owner,key){var i,cache=owner[this.expando];if(cache===undefined){return;}
if(key!==undefined){if(Array.isArray(key)){key=key.map(camelCase);}else{key=camelCase(key);key=key in cache?[key]:(key.match(rnothtmlwhite)||[]);}
i=key.length;while(i--){delete cache[key[i]];}}
if(key===undefined||jQuery.isEmptyObject(cache)){if(owner.nodeType){owner[this.expando]=undefined;}else{delete owner[this.expando];}}},hasData:function(owner){var cache=owner[this.expando];return cache!==undefined&&!jQuery.isEmptyObject(cache);}};var dataPriv=new Data();var dataUser=new Data();var rbrace=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,rmultiDash=/[A-Z]/g;function getData(data){if(data==="true"){return true;}
if(data==="false"){return false;}
if(data==="null"){return null;}
if(data===+data+""){return+data;}
if(rbrace.test(data)){return JSON.parse(data);}
return data;}
function dataAttr(elem,key,data){var name;if(data===undefined&&elem.nodeType===1){name="data-"+key.replace(rmultiDash,"-$&").toLowerCase();data=elem.getAttribute(name);if(typeof data==="string"){try{data=getData(data);}catch(e){}
dataUser.set(elem,key,data);}else{data=undefined;}}
return data;}
jQuery.extend({hasData:function(elem){return dataUser.hasData(elem)||dataPriv.hasData(elem);},data:function(elem,name,data){return dataUser.access(elem,name,data);},removeData:function(elem,name){dataUser.remove(elem,name);},_data:function(elem,name,data){return dataPriv.access(elem,name,data);},_removeData:function(elem,name){dataPriv.remove(elem,name);}});jQuery.fn.extend({data:function(key,value){var i,name,data,elem=this[0],attrs=elem&&elem.attributes;if(key===undefined){if(this.length){data=dataUser.get(elem);if(elem.nodeType===1&&!dataPriv.get(elem,"hasDataAttrs")){i=attrs.length;while(i--){if(attrs[i]){name=attrs[i].name;if(name.indexOf("data-")===0){name=camelCase(name.slice(5));dataAttr(elem,name,data[name]);}}}
dataPriv.set(elem,"hasDataAttrs",true);}}
return data;}
if(typeof key==="object"){return this.each(function(){dataUser.set(this,key);});}
return access(this,function(value){var data;if(elem&&value===undefined){data=dataUser.get(elem,key);if(data!==undefined){return data;}
data=dataAttr(elem,key);if(data!==undefined){return data;}
return;}
this.each(function(){dataUser.set(this,key,value);});},null,value,arguments.length>1,null,true);},removeData:function(key){return this.each(function(){dataUser.remove(this,key);});}});jQuery.extend({queue:function(elem,type,data){var queue;if(elem){type=(type||"fx")+"queue";queue=dataPriv.get(elem,type);if(data){if(!queue||Array.isArray(data)){queue=dataPriv.access(elem,type,jQuery.makeArray(data));}else{queue.push(data);}}
return queue||[];}},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),startLength=queue.length,fn=queue.shift(),hooks=jQuery._queueHooks(elem,type),next=function(){jQuery.dequeue(elem,type);};if(fn==="inprogress"){fn=queue.shift();startLength--;}
if(fn){if(type==="fx"){queue.unshift("inprogress");}
delete hooks.stop;fn.call(elem,next,hooks);}
if(!startLength&&hooks){hooks.empty.fire();}},_queueHooks:function(elem,type){var key=type+"queueHooks";return dataPriv.get(elem,key)||dataPriv.access(elem,key,{empty:jQuery.Callbacks("once memory").add(function(){dataPriv.remove(elem,[type+"queue",key]);})});}});jQuery.fn.extend({queue:function(type,data){var setter=2;if(typeof type!=="string"){data=type;type="fx";setter--;}
if(arguments.length<setter){return jQuery.queue(this[0],type);}
return data===undefined?this:this.each(function(){var queue=jQuery.queue(this,type,data);jQuery._queueHooks(this,type);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type);}});},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type);});},clearQueue:function(type){return this.queue(type||"fx",[]);},promise:function(type,obj){var tmp,count=1,defer=jQuery.Deferred(),elements=this,i=this.length,resolve=function(){if(!(--count)){defer.resolveWith(elements,[elements]);}};if(typeof type!=="string"){obj=type;type=undefined;}
type=type||"fx";while(i--){tmp=dataPriv.get(elements[i],type+"queueHooks");if(tmp&&tmp.empty){count++;tmp.empty.add(resolve);}}
resolve();return defer.promise(obj);}});var pnum=(/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;var rcssNum=new RegExp("^(?:([+-])=|)("+pnum+")([a-z%]*)$","i");var cssExpand=["Top","Right","Bottom","Left"];var documentElement=document.documentElement;var isAttached=function(elem){return jQuery.contains(elem.ownerDocument,elem);},composed={composed:true};if(documentElement.getRootNode){isAttached=function(elem){return jQuery.contains(elem.ownerDocument,elem)||elem.getRootNode(composed)===elem.ownerDocument;};}
var isHiddenWithinTree=function(elem,el){elem=el||elem;return elem.style.display==="none"||elem.style.display===""&&isAttached(elem)&&jQuery.css(elem,"display")==="none";};function adjustCSS(elem,prop,valueParts,tween){var adjusted,scale,maxIterations=20,currentValue=tween?function(){return tween.cur();}:function(){return jQuery.css(elem,prop,"");},initial=currentValue(),unit=valueParts&&valueParts[3]||(jQuery.cssNumber[prop]?"":"px"),initialInUnit=elem.nodeType&&(jQuery.cssNumber[prop]||unit!=="px"&&+initial)&&rcssNum.exec(jQuery.css(elem,prop));if(initialInUnit&&initialInUnit[3]!==unit){initial=initial/2;unit=unit||initialInUnit[3];initialInUnit=+initial||1;while(maxIterations--){jQuery.style(elem,prop,initialInUnit+unit);if((1-scale)*(1-(scale=currentValue()/initial||0.5))<=0){maxIterations=0;}
initialInUnit=initialInUnit/scale;}
initialInUnit=initialInUnit*2;jQuery.style(elem,prop,initialInUnit+unit);valueParts=valueParts||[];}
if(valueParts){initialInUnit=+initialInUnit||+initial||0;adjusted=valueParts[1]?initialInUnit+(valueParts[1]+1)*valueParts[2]:+valueParts[2];if(tween){tween.unit=unit;tween.start=initialInUnit;tween.end=adjusted;}}
return adjusted;}
var defaultDisplayMap={};function getDefaultDisplay(elem){var temp,doc=elem.ownerDocument,nodeName=elem.nodeName,display=defaultDisplayMap[nodeName];if(display){return display;}
temp=doc.body.appendChild(doc.createElement(nodeName));display=jQuery.css(temp,"display");temp.parentNode.removeChild(temp);if(display==="none"){display="block";}
defaultDisplayMap[nodeName]=display;return display;}
function showHide(elements,show){var display,elem,values=[],index=0,length=elements.length;for(;index<length;index++){elem=elements[index];if(!elem.style){continue;}
display=elem.style.display;if(show){if(display==="none"){values[index]=dataPriv.get(elem,"display")||null;if(!values[index]){elem.style.display="";}}
if(elem.style.display===""&&isHiddenWithinTree(elem)){values[index]=getDefaultDisplay(elem);}}else{if(display!=="none"){values[index]="none";dataPriv.set(elem,"display",display);}}}
for(index=0;index<length;index++){if(values[index]!=null){elements[index].style.display=values[index];}}
return elements;}
jQuery.fn.extend({show:function(){return showHide(this,true);},hide:function(){return showHide(this);},toggle:function(state){if(typeof state==="boolean"){return state?this.show():this.hide();}
return this.each(function(){if(isHiddenWithinTree(this)){jQuery(this).show();}else{jQuery(this).hide();}});}});var rcheckableType=(/^(?:checkbox|radio)$/i);var rtagName=(/<([a-z][^\/\0>\x20\t\r\n\f]*)/i);var rscriptType=(/^$|^module$|\/(?:java|ecma)script/i);(function(){var fragment=document.createDocumentFragment(),div=fragment.appendChild(document.createElement("div")),input=document.createElement("input");input.setAttribute("type","radio");input.setAttribute("checked","checked");input.setAttribute("name","t");div.appendChild(input);support.checkClone=div.cloneNode(true).cloneNode(true).lastChild.checked;div.innerHTML="<textarea>x</textarea>";support.noCloneChecked=!!div.cloneNode(true).lastChild.defaultValue;div.innerHTML="<option></option>";support.option=!!div.lastChild;})();var wrapMap={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;if(!support.option){wrapMap.optgroup=wrapMap.option=[1,"<select multiple='multiple'>","</select>"];}
function getAll(context,tag){var ret;if(typeof context.getElementsByTagName!=="undefined"){ret=context.getElementsByTagName(tag||"*");}else if(typeof context.querySelectorAll!=="undefined"){ret=context.querySelectorAll(tag||"*");}else{ret=[];}
if(tag===undefined||tag&&nodeName(context,tag)){return jQuery.merge([context],ret);}
return ret;}
function setGlobalEval(elems,refElements){var i=0,l=elems.length;for(;i<l;i++){dataPriv.set(elems[i],"globalEval",!refElements||dataPriv.get(refElements[i],"globalEval"));}}
var rhtml=/<|&#?\w+;/;function buildFragment(elems,context,scripts,selection,ignored){var elem,tmp,tag,wrap,attached,j,fragment=context.createDocumentFragment(),nodes=[],i=0,l=elems.length;for(;i<l;i++){elem=elems[i];if(elem||elem===0){if(toType(elem)==="object"){jQuery.merge(nodes,elem.nodeType?[elem]:elem);}else if(!rhtml.test(elem)){nodes.push(context.createTextNode(elem));}else{tmp=tmp||fragment.appendChild(context.createElement("div"));tag=(rtagName.exec(elem)||["",""])[1].toLowerCase();wrap=wrapMap[tag]||wrapMap._default;tmp.innerHTML=wrap[1]+jQuery.htmlPrefilter(elem)+wrap[2];j=wrap[0];while(j--){tmp=tmp.lastChild;}
jQuery.merge(nodes,tmp.childNodes);tmp=fragment.firstChild;tmp.textContent="";}}}
fragment.textContent="";i=0;while((elem=nodes[i++])){if(selection&&jQuery.inArray(elem,selection)>-1){if(ignored){ignored.push(elem);}
continue;}
attached=isAttached(elem);tmp=getAll(fragment.appendChild(elem),"script");if(attached){setGlobalEval(tmp);}
if(scripts){j=0;while((elem=tmp[j++])){if(rscriptType.test(elem.type||"")){scripts.push(elem);}}}}
return fragment;}
var rtypenamespace=/^([^.]*)(?:\.(.+)|)/;function returnTrue(){return true;}
function returnFalse(){return false;}
function on(elem,types,selector,data,fn,one){var origFn,type;if(typeof types==="object"){if(typeof selector!=="string"){data=data||selector;selector=undefined;}
for(type in types){on(elem,type,selector,data,types[type],one);}
return elem;}
if(data==null&&fn==null){fn=selector;data=selector=undefined;}else if(fn==null){if(typeof selector==="string"){fn=data;data=undefined;}else{fn=data;data=selector;selector=undefined;}}
if(fn===false){fn=returnFalse;}else if(!fn){return elem;}
if(one===1){origFn=fn;fn=function(event){jQuery().off(event);return origFn.apply(this,arguments);};fn.guid=origFn.guid||(origFn.guid=jQuery.guid++);}
return elem.each(function(){jQuery.event.add(this,types,fn,data,selector);});}
jQuery.event={global:{},add:function(elem,types,handler,data,selector){var handleObjIn,eventHandle,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.get(elem);if(!acceptData(elem)){return;}
if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;selector=handleObjIn.selector;}
if(selector){jQuery.find.matchesSelector(documentElement,selector);}
if(!handler.guid){handler.guid=jQuery.guid++;}
if(!(events=elemData.events)){events=elemData.events=Object.create(null);}
if(!(eventHandle=elemData.handle)){eventHandle=elemData.handle=function(e){return typeof jQuery!=="undefined"&&jQuery.event.triggered!==e.type?jQuery.event.dispatch.apply(elem,arguments):undefined;};}
types=(types||"").match(rnothtmlwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){continue;}
special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;special=jQuery.event.special[type]||{};handleObj=jQuery.extend({type:type,origType:origType,data:data,handler:handler,guid:handler.guid,selector:selector,needsContext:selector&&jQuery.expr.match.needsContext.test(selector),namespace:namespaces.join(".")},handleObjIn);if(!(handlers=events[type])){handlers=events[type]=[];handlers.delegateCount=0;if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){if(elem.addEventListener){elem.addEventListener(type,eventHandle);}}}
if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid;}}
if(selector){handlers.splice(handlers.delegateCount++,0,handleObj);}else{handlers.push(handleObj);}
jQuery.event.global[type]=true;}},remove:function(elem,types,handler,selector,mappedTypes){var j,origCount,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.hasData(elem)&&dataPriv.get(elem);if(!elemData||!(events=elemData.events)){return;}
types=(types||"").match(rnothtmlwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){for(type in events){jQuery.event.remove(elem,type+types[t],handler,selector,true);}
continue;}
special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;handlers=events[type]||[];tmp=tmp[2]&&new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)");origCount=j=handlers.length;while(j--){handleObj=handlers[j];if((mappedTypes||origType===handleObj.origType)&&(!handler||handler.guid===handleObj.guid)&&(!tmp||tmp.test(handleObj.namespace))&&(!selector||selector===handleObj.selector||selector==="**"&&handleObj.selector)){handlers.splice(j,1);if(handleObj.selector){handlers.delegateCount--;}
if(special.remove){special.remove.call(elem,handleObj);}}}
if(origCount&&!handlers.length){if(!special.teardown||special.teardown.call(elem,namespaces,elemData.handle)===false){jQuery.removeEvent(elem,type,elemData.handle);}
delete events[type];}}
if(jQuery.isEmptyObject(events)){dataPriv.remove(elem,"handle events");}},dispatch:function(nativeEvent){var i,j,ret,matched,handleObj,handlerQueue,args=new Array(arguments.length),event=jQuery.event.fix(nativeEvent),handlers=(dataPriv.get(this,"events")||Object.create(null))[event.type]||[],special=jQuery.event.special[event.type]||{};args[0]=event;for(i=1;i<arguments.length;i++){args[i]=arguments[i];}
event.delegateTarget=this;if(special.preDispatch&&special.preDispatch.call(this,event)===false){return;}
handlerQueue=jQuery.event.handlers.call(this,event,handlers);i=0;while((matched=handlerQueue[i++])&&!event.isPropagationStopped()){event.currentTarget=matched.elem;j=0;while((handleObj=matched.handlers[j++])&&!event.isImmediatePropagationStopped()){if(!event.rnamespace||handleObj.namespace===false||event.rnamespace.test(handleObj.namespace)){event.handleObj=handleObj;event.data=handleObj.data;ret=((jQuery.event.special[handleObj.origType]||{}).handle||handleObj.handler).apply(matched.elem,args);if(ret!==undefined){if((event.result=ret)===false){event.preventDefault();event.stopPropagation();}}}}}
if(special.postDispatch){special.postDispatch.call(this,event);}
return event.result;},handlers:function(event,handlers){var i,handleObj,sel,matchedHandlers,matchedSelectors,handlerQueue=[],delegateCount=handlers.delegateCount,cur=event.target;if(delegateCount&&cur.nodeType&&!(event.type==="click"&&event.button>=1)){for(;cur!==this;cur=cur.parentNode||this){if(cur.nodeType===1&&!(event.type==="click"&&cur.disabled===true)){matchedHandlers=[];matchedSelectors={};for(i=0;i<delegateCount;i++){handleObj=handlers[i];sel=handleObj.selector+" ";if(matchedSelectors[sel]===undefined){matchedSelectors[sel]=handleObj.needsContext?jQuery(sel,this).index(cur)>-1:jQuery.find(sel,this,null,[cur]).length;}
if(matchedSelectors[sel]){matchedHandlers.push(handleObj);}}
if(matchedHandlers.length){handlerQueue.push({elem:cur,handlers:matchedHandlers});}}}}
cur=this;if(delegateCount<handlers.length){handlerQueue.push({elem:cur,handlers:handlers.slice(delegateCount)});}
return handlerQueue;},addProp:function(name,hook){Object.defineProperty(jQuery.Event.prototype,name,{enumerable:true,configurable:true,get:isFunction(hook)?function(){if(this.originalEvent){return hook(this.originalEvent);}}:function(){if(this.originalEvent){return this.originalEvent[name];}},set:function(value){Object.defineProperty(this,name,{enumerable:true,configurable:true,writable:true,value:value});}});},fix:function(originalEvent){return originalEvent[jQuery.expando]?originalEvent:new jQuery.Event(originalEvent);},special:{load:{noBubble:true},click:{setup:function(data){var el=this||data;if(rcheckableType.test(el.type)&&el.click&&nodeName(el,"input")){leverageNative(el,"click",true);}
return false;},trigger:function(data){var el=this||data;if(rcheckableType.test(el.type)&&el.click&&nodeName(el,"input")){leverageNative(el,"click");}
return true;},_default:function(event){var target=event.target;return rcheckableType.test(target.type)&&target.click&&nodeName(target,"input")&&dataPriv.get(target,"click")||nodeName(target,"a");}},beforeunload:{postDispatch:function(event){if(event.result!==undefined&&event.originalEvent){event.originalEvent.returnValue=event.result;}}}}};function leverageNative(el,type,isSetup){if(!isSetup){if(dataPriv.get(el,type)===undefined){jQuery.event.add(el,type,returnTrue);}
return;}
dataPriv.set(el,type,false);jQuery.event.add(el,type,{namespace:false,handler:function(event){var result,saved=dataPriv.get(this,type);if((event.isTrigger&1)&&this[type]){if(!saved){saved=slice.call(arguments);dataPriv.set(this,type,saved);this[type]();result=dataPriv.get(this,type);dataPriv.set(this,type,false);if(saved!==result){event.stopImmediatePropagation();event.preventDefault();return result;}}else if((jQuery.event.special[type]||{}).delegateType){event.stopPropagation();}}else if(saved){dataPriv.set(this,type,jQuery.event.trigger(saved[0],saved.slice(1),this));event.stopPropagation();event.isImmediatePropagationStopped=returnTrue;}}});}
jQuery.removeEvent=function(elem,type,handle){if(elem.removeEventListener){elem.removeEventListener(type,handle);}};jQuery.Event=function(src,props){if(!(this instanceof jQuery.Event)){return new jQuery.Event(src,props);}
if(src&&src.type){this.originalEvent=src;this.type=src.type;this.isDefaultPrevented=src.defaultPrevented||src.defaultPrevented===undefined&&src.returnValue===false?returnTrue:returnFalse;this.target=(src.target&&src.target.nodeType===3)?src.target.parentNode:src.target;this.currentTarget=src.currentTarget;this.relatedTarget=src.relatedTarget;}else{this.type=src;}
if(props){jQuery.extend(this,props);}
this.timeStamp=src&&src.timeStamp||Date.now();this[jQuery.expando]=true;};jQuery.Event.prototype={constructor:jQuery.Event,isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse,isSimulated:false,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=returnTrue;if(e&&!this.isSimulated){e.preventDefault();}},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=returnTrue;if(e&&!this.isSimulated){e.stopPropagation();}},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=returnTrue;if(e&&!this.isSimulated){e.stopImmediatePropagation();}
this.stopPropagation();}};jQuery.each({altKey:true,bubbles:true,cancelable:true,changedTouches:true,ctrlKey:true,detail:true,eventPhase:true,metaKey:true,pageX:true,pageY:true,shiftKey:true,view:true,"char":true,code:true,charCode:true,key:true,keyCode:true,button:true,buttons:true,clientX:true,clientY:true,offsetX:true,offsetY:true,pointerId:true,pointerType:true,screenX:true,screenY:true,targetTouches:true,toElement:true,touches:true,which:true},jQuery.event.addProp);jQuery.each({focus:"focusin",blur:"focusout"},function(type,delegateType){function focusMappedHandler(nativeEvent){if(document.documentMode){var handle=dataPriv.get(this,"handle"),event=jQuery.event.fix(nativeEvent);event.type=nativeEvent.type==="focusin"?"focus":"blur";event.isSimulated=true;handle(nativeEvent);if(event.target===event.currentTarget){handle(event);}}else{jQuery.event.simulate(delegateType,nativeEvent.target,jQuery.event.fix(nativeEvent));}}
jQuery.event.special[type]={setup:function(){var attaches;leverageNative(this,type,true);if(document.documentMode){attaches=dataPriv.get(this,delegateType);if(!attaches){this.addEventListener(delegateType,focusMappedHandler);}
dataPriv.set(this,delegateType,(attaches||0)+1);}else{return false;}},trigger:function(){leverageNative(this,type);return true;},teardown:function(){var attaches;if(document.documentMode){attaches=dataPriv.get(this,delegateType)-1;if(!attaches){this.removeEventListener(delegateType,focusMappedHandler);dataPriv.remove(this,delegateType);}else{dataPriv.set(this,delegateType,attaches);}}else{return false;}},_default:function(event){return dataPriv.get(event.target,type);},delegateType:delegateType};jQuery.event.special[delegateType]={setup:function(){var doc=this.ownerDocument||this.document||this,dataHolder=document.documentMode?this:doc,attaches=dataPriv.get(dataHolder,delegateType);if(!attaches){if(document.documentMode){this.addEventListener(delegateType,focusMappedHandler);}else{doc.addEventListener(type,focusMappedHandler,true);}}
dataPriv.set(dataHolder,delegateType,(attaches||0)+1);},teardown:function(){var doc=this.ownerDocument||this.document||this,dataHolder=document.documentMode?this:doc,attaches=dataPriv.get(dataHolder,delegateType)-1;if(!attaches){if(document.documentMode){this.removeEventListener(delegateType,focusMappedHandler);}else{doc.removeEventListener(type,focusMappedHandler,true);}
dataPriv.remove(dataHolder,delegateType);}else{dataPriv.set(dataHolder,delegateType,attaches);}}};});jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(orig,fix){jQuery.event.special[orig]={delegateType:fix,bindType:fix,handle:function(event){var ret,target=this,related=event.relatedTarget,handleObj=event.handleObj;if(!related||(related!==target&&!jQuery.contains(target,related))){event.type=handleObj.origType;ret=handleObj.handler.apply(this,arguments);event.type=fix;}
return ret;}};});jQuery.fn.extend({on:function(types,selector,data,fn){return on(this,types,selector,data,fn);},one:function(types,selector,data,fn){return on(this,types,selector,data,fn,1);},off:function(types,selector,fn){var handleObj,type;if(types&&types.preventDefault&&types.handleObj){handleObj=types.handleObj;jQuery(types.delegateTarget).off(handleObj.namespace?handleObj.origType+"."+handleObj.namespace:handleObj.origType,handleObj.selector,handleObj.handler);return this;}
if(typeof types==="object"){for(type in types){this.off(type,selector,types[type]);}
return this;}
if(selector===false||typeof selector==="function"){fn=selector;selector=undefined;}
if(fn===false){fn=returnFalse;}
return this.each(function(){jQuery.event.remove(this,types,fn,selector);});}});var
rnoInnerhtml=/<script|<style|<link/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rcleanScript=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function manipulationTarget(elem,content){if(nodeName(elem,"table")&&nodeName(content.nodeType!==11?content:content.firstChild,"tr")){return jQuery(elem).children("tbody")[0]||elem;}
return elem;}
function disableScript(elem){elem.type=(elem.getAttribute("type")!==null)+"/"+elem.type;return elem;}
function restoreScript(elem){if((elem.type||"").slice(0,5)==="true/"){elem.type=elem.type.slice(5);}else{elem.removeAttribute("type");}
return elem;}
function cloneCopyEvent(src,dest){var i,l,type,pdataOld,udataOld,udataCur,events;if(dest.nodeType!==1){return;}
if(dataPriv.hasData(src)){pdataOld=dataPriv.get(src);events=pdataOld.events;if(events){dataPriv.remove(dest,"handle events");for(type in events){for(i=0,l=events[type].length;i<l;i++){jQuery.event.add(dest,type,events[type][i]);}}}}
if(dataUser.hasData(src)){udataOld=dataUser.access(src);udataCur=jQuery.extend({},udataOld);dataUser.set(dest,udataCur);}}
function fixInput(src,dest){var nodeName=dest.nodeName.toLowerCase();if(nodeName==="input"&&rcheckableType.test(src.type)){dest.checked=src.checked;}else if(nodeName==="input"||nodeName==="textarea"){dest.defaultValue=src.defaultValue;}}
function domManip(collection,args,callback,ignored){args=flat(args);var fragment,first,scripts,hasScripts,node,doc,i=0,l=collection.length,iNoClone=l-1,value=args[0],valueIsFunction=isFunction(value);if(valueIsFunction||(l>1&&typeof value==="string"&&!support.checkClone&&rchecked.test(value))){return collection.each(function(index){var self=collection.eq(index);if(valueIsFunction){args[0]=value.call(this,index,self.html());}
domManip(self,args,callback,ignored);});}
if(l){fragment=buildFragment(args,collection[0].ownerDocument,false,collection,ignored);first=fragment.firstChild;if(fragment.childNodes.length===1){fragment=first;}
if(first||ignored){scripts=jQuery.map(getAll(fragment,"script"),disableScript);hasScripts=scripts.length;for(;i<l;i++){node=fragment;if(i!==iNoClone){node=jQuery.clone(node,true,true);if(hasScripts){jQuery.merge(scripts,getAll(node,"script"));}}
callback.call(collection[i],node,i);}
if(hasScripts){doc=scripts[scripts.length-1].ownerDocument;jQuery.map(scripts,restoreScript);for(i=0;i<hasScripts;i++){node=scripts[i];if(rscriptType.test(node.type||"")&&!dataPriv.access(node,"globalEval")&&jQuery.contains(doc,node)){if(node.src&&(node.type||"").toLowerCase()!=="module"){if(jQuery._evalUrl&&!node.noModule){jQuery._evalUrl(node.src,{nonce:node.nonce||node.getAttribute("nonce")},doc);}}else{DOMEval(node.textContent.replace(rcleanScript,""),node,doc);}}}}}}
return collection;}
function remove(elem,selector,keepData){var node,nodes=selector?jQuery.filter(selector,elem):elem,i=0;for(;(node=nodes[i])!=null;i++){if(!keepData&&node.nodeType===1){jQuery.cleanData(getAll(node));}
if(node.parentNode){if(keepData&&isAttached(node)){setGlobalEval(getAll(node,"script"));}
node.parentNode.removeChild(node);}}
return elem;}
jQuery.extend({htmlPrefilter:function(html){return html;},clone:function(elem,dataAndEvents,deepDataAndEvents){var i,l,srcElements,destElements,clone=elem.cloneNode(true),inPage=isAttached(elem);if(!support.noCloneChecked&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){destElements=getAll(clone);srcElements=getAll(elem);for(i=0,l=srcElements.length;i<l;i++){fixInput(srcElements[i],destElements[i]);}}
if(dataAndEvents){if(deepDataAndEvents){srcElements=srcElements||getAll(elem);destElements=destElements||getAll(clone);for(i=0,l=srcElements.length;i<l;i++){cloneCopyEvent(srcElements[i],destElements[i]);}}else{cloneCopyEvent(elem,clone);}}
destElements=getAll(clone,"script");if(destElements.length>0){setGlobalEval(destElements,!inPage&&getAll(elem,"script"));}
return clone;},cleanData:function(elems){var data,elem,type,special=jQuery.event.special,i=0;for(;(elem=elems[i])!==undefined;i++){if(acceptData(elem)){if((data=elem[dataPriv.expando])){if(data.events){for(type in data.events){if(special[type]){jQuery.event.remove(elem,type);}else{jQuery.removeEvent(elem,type,data.handle);}}}
elem[dataPriv.expando]=undefined;}
if(elem[dataUser.expando]){elem[dataUser.expando]=undefined;}}}}});jQuery.fn.extend({detach:function(selector){return remove(this,selector,true);},remove:function(selector){return remove(this,selector);},text:function(value){return access(this,function(value){return value===undefined?jQuery.text(this):this.empty().each(function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){this.textContent=value;}});},null,value,arguments.length);},append:function(){return domManip(this,arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.appendChild(elem);}});},prepend:function(){return domManip(this,arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.insertBefore(elem,target.firstChild);}});},before:function(){return domManip(this,arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this);}});},after:function(){return domManip(this,arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this.nextSibling);}});},empty:function(){var elem,i=0;for(;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));elem.textContent="";}}
return this;},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents);});},html:function(value){return access(this,function(value){var elem=this[0]||{},i=0,l=this.length;if(value===undefined&&elem.nodeType===1){return elem.innerHTML;}
if(typeof value==="string"&&!rnoInnerhtml.test(value)&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=jQuery.htmlPrefilter(value);try{for(;i<l;i++){elem=this[i]||{};if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));elem.innerHTML=value;}}
elem=0;}catch(e){}}
if(elem){this.empty().append(value);}},null,value,arguments.length);},replaceWith:function(){var ignored=[];return domManip(this,arguments,function(elem){var parent=this.parentNode;if(jQuery.inArray(this,ignored)<0){jQuery.cleanData(getAll(this));if(parent){parent.replaceChild(elem,this);}}},ignored);}});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var elems,ret=[],insert=jQuery(selector),last=insert.length-1,i=0;for(;i<=last;i++){elems=i===last?this:this.clone(true);jQuery(insert[i])[original](elems);push.apply(ret,elems.get());}
return this.pushStack(ret);};});var rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i");var rcustomProp=/^--/;var getStyles=function(elem){var view=elem.ownerDocument.defaultView;if(!view||!view.opener){view=window;}
return view.getComputedStyle(elem);};var swap=function(elem,options,callback){var ret,name,old={};for(name in options){old[name]=elem.style[name];elem.style[name]=options[name];}
ret=callback.call(elem);for(name in options){elem.style[name]=old[name];}
return ret;};var rboxStyle=new RegExp(cssExpand.join("|"),"i");(function(){function computeStyleTests(){if(!div){return;}
container.style.cssText="position:absolute;left:-11111px;width:60px;"+"margin-top:1px;padding:0;border:0";div.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;"+"margin:auto;border:1px;padding:1px;"+"width:60%;top:1%";documentElement.appendChild(container).appendChild(div);var divStyle=window.getComputedStyle(div);pixelPositionVal=divStyle.top!=="1%";reliableMarginLeftVal=roundPixelMeasures(divStyle.marginLeft)===12;div.style.right="60%";pixelBoxStylesVal=roundPixelMeasures(divStyle.right)===36;boxSizingReliableVal=roundPixelMeasures(divStyle.width)===36;div.style.position="absolute";scrollboxSizeVal=roundPixelMeasures(div.offsetWidth/3)===12;documentElement.removeChild(container);div=null;}
function roundPixelMeasures(measure){return Math.round(parseFloat(measure));}
var pixelPositionVal,boxSizingReliableVal,scrollboxSizeVal,pixelBoxStylesVal,reliableTrDimensionsVal,reliableMarginLeftVal,container=document.createElement("div"),div=document.createElement("div");if(!div.style){return;}
div.style.backgroundClip="content-box";div.cloneNode(true).style.backgroundClip="";support.clearCloneStyle=div.style.backgroundClip==="content-box";jQuery.extend(support,{boxSizingReliable:function(){computeStyleTests();return boxSizingReliableVal;},pixelBoxStyles:function(){computeStyleTests();return pixelBoxStylesVal;},pixelPosition:function(){computeStyleTests();return pixelPositionVal;},reliableMarginLeft:function(){computeStyleTests();return reliableMarginLeftVal;},scrollboxSize:function(){computeStyleTests();return scrollboxSizeVal;},reliableTrDimensions:function(){var table,tr,trChild,trStyle;if(reliableTrDimensionsVal==null){table=document.createElement("table");tr=document.createElement("tr");trChild=document.createElement("div");table.style.cssText="position:absolute;left:-11111px;border-collapse:separate";tr.style.cssText="box-sizing:content-box;border:1px solid";tr.style.height="1px";trChild.style.height="9px";trChild.style.display="block";documentElement.appendChild(table).appendChild(tr).appendChild(trChild);trStyle=window.getComputedStyle(tr);reliableTrDimensionsVal=(parseInt(trStyle.height,10)+
parseInt(trStyle.borderTopWidth,10)+
parseInt(trStyle.borderBottomWidth,10))===tr.offsetHeight;documentElement.removeChild(table);}
return reliableTrDimensionsVal;}});})();function curCSS(elem,name,computed){var width,minWidth,maxWidth,ret,isCustomProp=rcustomProp.test(name),style=elem.style;computed=computed||getStyles(elem);if(computed){ret=computed.getPropertyValue(name)||computed[name];if(isCustomProp&&ret){ret=ret.replace(rtrimCSS,"$1")||undefined;}
if(ret===""&&!isAttached(elem)){ret=jQuery.style(elem,name);}
if(!support.pixelBoxStyles()&&rnumnonpx.test(ret)&&rboxStyle.test(name)){width=style.width;minWidth=style.minWidth;maxWidth=style.maxWidth;style.minWidth=style.maxWidth=style.width=ret;ret=computed.width;style.width=width;style.minWidth=minWidth;style.maxWidth=maxWidth;}}
return ret!==undefined?ret+"":ret;}
function addGetHookIf(conditionFn,hookFn){return{get:function(){if(conditionFn()){delete this.get;return;}
return(this.get=hookFn).apply(this,arguments);}};}
var cssPrefixes=["Webkit","Moz","ms"],emptyStyle=document.createElement("div").style,vendorProps={};function vendorPropName(name){var capName=name[0].toUpperCase()+name.slice(1),i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in emptyStyle){return name;}}}
function finalPropName(name){var final=jQuery.cssProps[name]||vendorProps[name];if(final){return final;}
if(name in emptyStyle){return name;}
return vendorProps[name]=vendorPropName(name)||name;}
var
rdisplayswap=/^(none|table(?!-c[ea]).+)/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"};function setPositiveNumber(_elem,value,subtract){var matches=rcssNum.exec(value);return matches?Math.max(0,matches[2]-(subtract||0))+(matches[3]||"px"):value;}
function boxModelAdjustment(elem,dimension,box,isBorderBox,styles,computedVal){var i=dimension==="width"?1:0,extra=0,delta=0,marginDelta=0;if(box===(isBorderBox?"border":"content")){return 0;}
for(;i<4;i+=2){if(box==="margin"){marginDelta+=jQuery.css(elem,box+cssExpand[i],true,styles);}
if(!isBorderBox){delta+=jQuery.css(elem,"padding"+cssExpand[i],true,styles);if(box!=="padding"){delta+=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles);}else{extra+=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles);}}else{if(box==="content"){delta-=jQuery.css(elem,"padding"+cssExpand[i],true,styles);}
if(box!=="margin"){delta-=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles);}}}
if(!isBorderBox&&computedVal>=0){delta+=Math.max(0,Math.ceil(elem["offset"+dimension[0].toUpperCase()+dimension.slice(1)]-
computedVal-
delta-
extra-
0.5))||0;}
return delta+marginDelta;}
function getWidthOrHeight(elem,dimension,extra){var styles=getStyles(elem),boxSizingNeeded=!support.boxSizingReliable()||extra,isBorderBox=boxSizingNeeded&&jQuery.css(elem,"boxSizing",false,styles)==="border-box",valueIsBorderBox=isBorderBox,val=curCSS(elem,dimension,styles),offsetProp="offset"+dimension[0].toUpperCase()+dimension.slice(1);if(rnumnonpx.test(val)){if(!extra){return val;}
val="auto";}
if((!support.boxSizingReliable()&&isBorderBox||!support.reliableTrDimensions()&&nodeName(elem,"tr")||val==="auto"||!parseFloat(val)&&jQuery.css(elem,"display",false,styles)==="inline")&&elem.getClientRects().length){isBorderBox=jQuery.css(elem,"boxSizing",false,styles)==="border-box";valueIsBorderBox=offsetProp in elem;if(valueIsBorderBox){val=elem[offsetProp];}}
val=parseFloat(val)||0;return(val+
boxModelAdjustment(elem,dimension,extra||(isBorderBox?"border":"content"),valueIsBorderBox,styles,val))+"px";}
jQuery.extend({cssHooks:{opacity:{get:function(elem,computed){if(computed){var ret=curCSS(elem,"opacity");return ret===""?"1":ret;}}}},cssNumber:{animationIterationCount:true,aspectRatio:true,borderImageSlice:true,columnCount:true,flexGrow:true,flexShrink:true,fontWeight:true,gridArea:true,gridColumn:true,gridColumnEnd:true,gridColumnStart:true,gridRow:true,gridRowEnd:true,gridRowStart:true,lineHeight:true,opacity:true,order:true,orphans:true,scale:true,widows:true,zIndex:true,zoom:true,fillOpacity:true,floodOpacity:true,stopOpacity:true,strokeMiterlimit:true,strokeOpacity:true},cssProps:{},style:function(elem,name,value,extra){if(!elem||elem.nodeType===3||elem.nodeType===8||!elem.style){return;}
var ret,type,hooks,origName=camelCase(name),isCustomProp=rcustomProp.test(name),style=elem.style;if(!isCustomProp){name=finalPropName(origName);}
hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];if(value!==undefined){type=typeof value;if(type==="string"&&(ret=rcssNum.exec(value))&&ret[1]){value=adjustCSS(elem,name,ret);type="number";}
if(value==null||value!==value){return;}
if(type==="number"&&!isCustomProp){value+=ret&&ret[3]||(jQuery.cssNumber[origName]?"":"px");}
if(!support.clearCloneStyle&&value===""&&name.indexOf("background")===0){style[name]="inherit";}
if(!hooks||!("set" in hooks)||(value=hooks.set(elem,value,extra))!==undefined){if(isCustomProp){style.setProperty(name,value);}else{style[name]=value;}}}else{if(hooks&&"get" in hooks&&(ret=hooks.get(elem,false,extra))!==undefined){return ret;}
return style[name];}},css:function(elem,name,extra,styles){var val,num,hooks,origName=camelCase(name),isCustomProp=rcustomProp.test(name);if(!isCustomProp){name=finalPropName(origName);}
hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];if(hooks&&"get" in hooks){val=hooks.get(elem,true,extra);}
if(val===undefined){val=curCSS(elem,name,styles);}
if(val==="normal"&&name in cssNormalTransform){val=cssNormalTransform[name];}
if(extra===""||extra){num=parseFloat(val);return extra===true||isFinite(num)?num||0:val;}
return val;}});jQuery.each(["height","width"],function(_i,dimension){jQuery.cssHooks[dimension]={get:function(elem,computed,extra){if(computed){return rdisplayswap.test(jQuery.css(elem,"display"))&&(!elem.getClientRects().length||!elem.getBoundingClientRect().width)?swap(elem,cssShow,function(){return getWidthOrHeight(elem,dimension,extra);}):getWidthOrHeight(elem,dimension,extra);}},set:function(elem,value,extra){var matches,styles=getStyles(elem),scrollboxSizeBuggy=!support.scrollboxSize()&&styles.position==="absolute",boxSizingNeeded=scrollboxSizeBuggy||extra,isBorderBox=boxSizingNeeded&&jQuery.css(elem,"boxSizing",false,styles)==="border-box",subtract=extra?boxModelAdjustment(elem,dimension,extra,isBorderBox,styles):0;if(isBorderBox&&scrollboxSizeBuggy){subtract-=Math.ceil(elem["offset"+dimension[0].toUpperCase()+dimension.slice(1)]-
parseFloat(styles[dimension])-
boxModelAdjustment(elem,dimension,"border",false,styles)-
0.5);}
if(subtract&&(matches=rcssNum.exec(value))&&(matches[3]||"px")!=="px"){elem.style[dimension]=value;value=jQuery.css(elem,dimension);}
return setPositiveNumber(elem,value,subtract);}};});jQuery.cssHooks.marginLeft=addGetHookIf(support.reliableMarginLeft,function(elem,computed){if(computed){return(parseFloat(curCSS(elem,"marginLeft"))||elem.getBoundingClientRect().left-
swap(elem,{marginLeft:0},function(){return elem.getBoundingClientRect().left;}))+"px";}});jQuery.each({margin:"",padding:"",border:"Width"},function(prefix,suffix){jQuery.cssHooks[prefix+suffix]={expand:function(value){var i=0,expanded={},parts=typeof value==="string"?value.split(" "):[value];for(;i<4;i++){expanded[prefix+cssExpand[i]+suffix]=parts[i]||parts[i-2]||parts[0];}
return expanded;}};if(prefix!=="margin"){jQuery.cssHooks[prefix+suffix].set=setPositiveNumber;}});jQuery.fn.extend({css:function(name,value){return access(this,function(elem,name,value){var styles,len,map={},i=0;if(Array.isArray(name)){styles=getStyles(elem);len=name.length;for(;i<len;i++){map[name[i]]=jQuery.css(elem,name[i],false,styles);}
return map;}
return value!==undefined?jQuery.style(elem,name,value):jQuery.css(elem,name);},name,value,arguments.length>1);}});function Tween(elem,options,prop,end,easing){return new Tween.prototype.init(elem,options,prop,end,easing);}
jQuery.Tween=Tween;Tween.prototype={constructor:Tween,init:function(elem,options,prop,end,easing,unit){this.elem=elem;this.prop=prop;this.easing=easing||jQuery.easing._default;this.options=options;this.start=this.now=this.cur();this.end=end;this.unit=unit||(jQuery.cssNumber[prop]?"":"px");},cur:function(){var hooks=Tween.propHooks[this.prop];return hooks&&hooks.get?hooks.get(this):Tween.propHooks._default.get(this);},run:function(percent){var eased,hooks=Tween.propHooks[this.prop];if(this.options.duration){this.pos=eased=jQuery.easing[this.easing](percent,this.options.duration*percent,0,1,this.options.duration);}else{this.pos=eased=percent;}
this.now=(this.end-this.start)*eased+this.start;if(this.options.step){this.options.step.call(this.elem,this.now,this);}
if(hooks&&hooks.set){hooks.set(this);}else{Tween.propHooks._default.set(this);}
return this;}};Tween.prototype.init.prototype=Tween.prototype;Tween.propHooks={_default:{get:function(tween){var result;if(tween.elem.nodeType!==1||tween.elem[tween.prop]!=null&&tween.elem.style[tween.prop]==null){return tween.elem[tween.prop];}
result=jQuery.css(tween.elem,tween.prop,"");return!result||result==="auto"?0:result;},set:function(tween){if(jQuery.fx.step[tween.prop]){jQuery.fx.step[tween.prop](tween);}else if(tween.elem.nodeType===1&&(jQuery.cssHooks[tween.prop]||tween.elem.style[finalPropName(tween.prop)]!=null)){jQuery.style(tween.elem,tween.prop,tween.now+tween.unit);}else{tween.elem[tween.prop]=tween.now;}}}};Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(tween){if(tween.elem.nodeType&&tween.elem.parentNode){tween.elem[tween.prop]=tween.now;}}};jQuery.easing={linear:function(p){return p;},swing:function(p){return 0.5-Math.cos(p*Math.PI)/2;},_default:"swing"};jQuery.fx=Tween.prototype.init;jQuery.fx.step={};var
fxNow,inProgress,rfxtypes=/^(?:toggle|show|hide)$/,rrun=/queueHooks$/;function schedule(){if(inProgress){if(document.hidden===false&&window.requestAnimationFrame){window.requestAnimationFrame(schedule);}else{window.setTimeout(schedule,jQuery.fx.interval);}
jQuery.fx.tick();}}
function createFxNow(){window.setTimeout(function(){fxNow=undefined;});return(fxNow=Date.now());}
function genFx(type,includeWidth){var which,i=0,attrs={height:type};includeWidth=includeWidth?1:0;for(;i<4;i+=2-includeWidth){which=cssExpand[i];attrs["margin"+which]=attrs["padding"+which]=type;}
if(includeWidth){attrs.opacity=attrs.width=type;}
return attrs;}
function createTween(value,prop,animation){var tween,collection=(Animation.tweeners[prop]||[]).concat(Animation.tweeners["*"]),index=0,length=collection.length;for(;index<length;index++){if((tween=collection[index].call(animation,prop,value))){return tween;}}}
function defaultPrefilter(elem,props,opts){var prop,value,toggle,hooks,oldfire,propTween,restoreDisplay,display,isBox="width" in props||"height" in props,anim=this,orig={},style=elem.style,hidden=elem.nodeType&&isHiddenWithinTree(elem),dataShow=dataPriv.get(elem,"fxshow");if(!opts.queue){hooks=jQuery._queueHooks(elem,"fx");if(hooks.unqueued==null){hooks.unqueued=0;oldfire=hooks.empty.fire;hooks.empty.fire=function(){if(!hooks.unqueued){oldfire();}};}
hooks.unqueued++;anim.always(function(){anim.always(function(){hooks.unqueued--;if(!jQuery.queue(elem,"fx").length){hooks.empty.fire();}});});}
for(prop in props){value=props[prop];if(rfxtypes.test(value)){delete props[prop];toggle=toggle||value==="toggle";if(value===(hidden?"hide":"show")){if(value==="show"&&dataShow&&dataShow[prop]!==undefined){hidden=true;}else{continue;}}
orig[prop]=dataShow&&dataShow[prop]||jQuery.style(elem,prop);}}
propTween=!jQuery.isEmptyObject(props);if(!propTween&&jQuery.isEmptyObject(orig)){return;}
if(isBox&&elem.nodeType===1){opts.overflow=[style.overflow,style.overflowX,style.overflowY];restoreDisplay=dataShow&&dataShow.display;if(restoreDisplay==null){restoreDisplay=dataPriv.get(elem,"display");}
display=jQuery.css(elem,"display");if(display==="none"){if(restoreDisplay){display=restoreDisplay;}else{showHide([elem],true);restoreDisplay=elem.style.display||restoreDisplay;display=jQuery.css(elem,"display");showHide([elem]);}}
if(display==="inline"||display==="inline-block"&&restoreDisplay!=null){if(jQuery.css(elem,"float")==="none"){if(!propTween){anim.done(function(){style.display=restoreDisplay;});if(restoreDisplay==null){display=style.display;restoreDisplay=display==="none"?"":display;}}
style.display="inline-block";}}}
if(opts.overflow){style.overflow="hidden";anim.always(function(){style.overflow=opts.overflow[0];style.overflowX=opts.overflow[1];style.overflowY=opts.overflow[2];});}
propTween=false;for(prop in orig){if(!propTween){if(dataShow){if("hidden" in dataShow){hidden=dataShow.hidden;}}else{dataShow=dataPriv.access(elem,"fxshow",{display:restoreDisplay});}
if(toggle){dataShow.hidden=!hidden;}
if(hidden){showHide([elem],true);}
anim.done(function(){if(!hidden){showHide([elem]);}
dataPriv.remove(elem,"fxshow");for(prop in orig){jQuery.style(elem,prop,orig[prop]);}});}
propTween=createTween(hidden?dataShow[prop]:0,prop,anim);if(!(prop in dataShow)){dataShow[prop]=propTween.start;if(hidden){propTween.end=propTween.start;propTween.start=0;}}}}
function propFilter(props,specialEasing){var index,name,easing,value,hooks;for(index in props){name=camelCase(index);easing=specialEasing[name];value=props[index];if(Array.isArray(value)){easing=value[1];value=props[index]=value[0];}
if(index!==name){props[name]=value;delete props[index];}
hooks=jQuery.cssHooks[name];if(hooks&&"expand" in hooks){value=hooks.expand(value);delete props[name];for(index in value){if(!(index in props)){props[index]=value[index];specialEasing[index]=easing;}}}else{specialEasing[name]=easing;}}}
function Animation(elem,properties,options){var result,stopped,index=0,length=Animation.prefilters.length,deferred=jQuery.Deferred().always(function(){delete tick.elem;}),tick=function(){if(stopped){return false;}
var currentTime=fxNow||createFxNow(),remaining=Math.max(0,animation.startTime+animation.duration-currentTime),temp=remaining/animation.duration||0,percent=1-temp,index=0,length=animation.tweens.length;for(;index<length;index++){animation.tweens[index].run(percent);}
deferred.notifyWith(elem,[animation,percent,remaining]);if(percent<1&&length){return remaining;}
if(!length){deferred.notifyWith(elem,[animation,1,0]);}
deferred.resolveWith(elem,[animation]);return false;},animation=deferred.promise({elem:elem,props:jQuery.extend({},properties),opts:jQuery.extend(true,{specialEasing:{},easing:jQuery.easing._default},options),originalProperties:properties,originalOptions:options,startTime:fxNow||createFxNow(),duration:options.duration,tweens:[],createTween:function(prop,end){var tween=jQuery.Tween(elem,animation.opts,prop,end,animation.opts.specialEasing[prop]||animation.opts.easing);animation.tweens.push(tween);return tween;},stop:function(gotoEnd){var index=0,length=gotoEnd?animation.tweens.length:0;if(stopped){return this;}
stopped=true;for(;index<length;index++){animation.tweens[index].run(1);}
if(gotoEnd){deferred.notifyWith(elem,[animation,1,0]);deferred.resolveWith(elem,[animation,gotoEnd]);}else{deferred.rejectWith(elem,[animation,gotoEnd]);}
return this;}}),props=animation.props;propFilter(props,animation.opts.specialEasing);for(;index<length;index++){result=Animation.prefilters[index].call(animation,elem,props,animation.opts);if(result){if(isFunction(result.stop)){jQuery._queueHooks(animation.elem,animation.opts.queue).stop=result.stop.bind(result);}
return result;}}
jQuery.map(props,createTween,animation);if(isFunction(animation.opts.start)){animation.opts.start.call(elem,animation);}
animation.progress(animation.opts.progress).done(animation.opts.done,animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);jQuery.fx.timer(jQuery.extend(tick,{elem:elem,anim:animation,queue:animation.opts.queue}));return animation;}
jQuery.Animation=jQuery.extend(Animation,{tweeners:{"*":[function(prop,value){var tween=this.createTween(prop,value);adjustCSS(tween.elem,prop,rcssNum.exec(value),tween);return tween;}]},tweener:function(props,callback){if(isFunction(props)){callback=props;props=["*"];}else{props=props.match(rnothtmlwhite);}
var prop,index=0,length=props.length;for(;index<length;index++){prop=props[index];Animation.tweeners[prop]=Animation.tweeners[prop]||[];Animation.tweeners[prop].unshift(callback);}},prefilters:[defaultPrefilter],prefilter:function(callback,prepend){if(prepend){Animation.prefilters.unshift(callback);}else{Animation.prefilters.push(callback);}}});jQuery.speed=function(speed,easing,fn){var opt=speed&&typeof speed==="object"?jQuery.extend({},speed):{complete:fn||!fn&&easing||isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!isFunction(easing)&&easing};if(jQuery.fx.off){opt.duration=0;}else{if(typeof opt.duration!=="number"){if(opt.duration in jQuery.fx.speeds){opt.duration=jQuery.fx.speeds[opt.duration];}else{opt.duration=jQuery.fx.speeds._default;}}}
if(opt.queue==null||opt.queue===true){opt.queue="fx";}
opt.old=opt.complete;opt.complete=function(){if(isFunction(opt.old)){opt.old.call(this);}
if(opt.queue){jQuery.dequeue(this,opt.queue);}};return opt;};jQuery.fn.extend({fadeTo:function(speed,to,easing,callback){return this.filter(isHiddenWithinTree).css("opacity",0).show().end().animate({opacity:to},speed,easing,callback);},animate:function(prop,speed,easing,callback){var empty=jQuery.isEmptyObject(prop),optall=jQuery.speed(speed,easing,callback),doAnimation=function(){var anim=Animation(this,jQuery.extend({},prop),optall);if(empty||dataPriv.get(this,"finish")){anim.stop(true);}};doAnimation.finish=doAnimation;return empty||optall.queue===false?this.each(doAnimation):this.queue(optall.queue,doAnimation);},stop:function(type,clearQueue,gotoEnd){var stopQueue=function(hooks){var stop=hooks.stop;delete hooks.stop;stop(gotoEnd);};if(typeof type!=="string"){gotoEnd=clearQueue;clearQueue=type;type=undefined;}
if(clearQueue){this.queue(type||"fx",[]);}
return this.each(function(){var dequeue=true,index=type!=null&&type+"queueHooks",timers=jQuery.timers,data=dataPriv.get(this);if(index){if(data[index]&&data[index].stop){stopQueue(data[index]);}}else{for(index in data){if(data[index]&&data[index].stop&&rrun.test(index)){stopQueue(data[index]);}}}
for(index=timers.length;index--;){if(timers[index].elem===this&&(type==null||timers[index].queue===type)){timers[index].anim.stop(gotoEnd);dequeue=false;timers.splice(index,1);}}
if(dequeue||!gotoEnd){jQuery.dequeue(this,type);}});},finish:function(type){if(type!==false){type=type||"fx";}
return this.each(function(){var index,data=dataPriv.get(this),queue=data[type+"queue"],hooks=data[type+"queueHooks"],timers=jQuery.timers,length=queue?queue.length:0;data.finish=true;jQuery.queue(this,type,[]);if(hooks&&hooks.stop){hooks.stop.call(this,true);}
for(index=timers.length;index--;){if(timers[index].elem===this&&timers[index].queue===type){timers[index].anim.stop(true);timers.splice(index,1);}}
for(index=0;index<length;index++){if(queue[index]&&queue[index].finish){queue[index].finish.call(this);}}
delete data.finish;});}});jQuery.each(["toggle","show","hide"],function(_i,name){var cssFn=jQuery.fn[name];jQuery.fn[name]=function(speed,easing,callback){return speed==null||typeof speed==="boolean"?cssFn.apply(this,arguments):this.animate(genFx(name,true),speed,easing,callback);};});jQuery.each({slideDown:genFx("show"),slideUp:genFx("hide"),slideToggle:genFx("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(name,props){jQuery.fn[name]=function(speed,easing,callback){return this.animate(props,speed,easing,callback);};});jQuery.timers=[];jQuery.fx.tick=function(){var timer,i=0,timers=jQuery.timers;fxNow=Date.now();for(;i<timers.length;i++){timer=timers[i];if(!timer()&&timers[i]===timer){timers.splice(i--,1);}}
if(!timers.length){jQuery.fx.stop();}
fxNow=undefined;};jQuery.fx.timer=function(timer){jQuery.timers.push(timer);jQuery.fx.start();};jQuery.fx.interval=13;jQuery.fx.start=function(){if(inProgress){return;}
inProgress=true;schedule();};jQuery.fx.stop=function(){inProgress=null;};jQuery.fx.speeds={slow:600,fast:200,_default:400};jQuery.fn.delay=function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(next,hooks){var timeout=window.setTimeout(next,time);hooks.stop=function(){window.clearTimeout(timeout);};});};(function(){var input=document.createElement("input"),select=document.createElement("select"),opt=select.appendChild(document.createElement("option"));input.type="checkbox";support.checkOn=input.value!=="";support.optSelected=opt.selected;input=document.createElement("input");input.value="t";input.type="radio";support.radioValue=input.value==="t";})();var boolHook,attrHandle=jQuery.expr.attrHandle;jQuery.fn.extend({attr:function(name,value){return access(this,jQuery.attr,name,value,arguments.length>1);},removeAttr:function(name){return this.each(function(){jQuery.removeAttr(this,name);});}});jQuery.extend({attr:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return;}
if(typeof elem.getAttribute==="undefined"){return jQuery.prop(elem,name,value);}
if(nType!==1||!jQuery.isXMLDoc(elem)){hooks=jQuery.attrHooks[name.toLowerCase()]||(jQuery.expr.match.bool.test(name)?boolHook:undefined);}
if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);return;}
if(hooks&&"set" in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret;}
elem.setAttribute(name,value+"");return value;}
if(hooks&&"get" in hooks&&(ret=hooks.get(elem,name))!==null){return ret;}
ret=jQuery.find.attr(elem,name);return ret==null?undefined:ret;},attrHooks:{type:{set:function(elem,value){if(!support.radioValue&&value==="radio"&&nodeName(elem,"input")){var val=elem.value;elem.setAttribute("type",value);if(val){elem.value=val;}
return value;}}}},removeAttr:function(elem,value){var name,i=0,attrNames=value&&value.match(rnothtmlwhite);if(attrNames&&elem.nodeType===1){while((name=attrNames[i++])){elem.removeAttribute(name);}}}});boolHook={set:function(elem,value,name){if(value===false){jQuery.removeAttr(elem,name);}else{elem.setAttribute(name,name);}
return name;}};jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),function(_i,name){var getter=attrHandle[name]||jQuery.find.attr;attrHandle[name]=function(elem,name,isXML){var ret,handle,lowercaseName=name.toLowerCase();if(!isXML){handle=attrHandle[lowercaseName];attrHandle[lowercaseName]=ret;ret=getter(elem,name,isXML)!=null?lowercaseName:null;attrHandle[lowercaseName]=handle;}
return ret;};});var rfocusable=/^(?:input|select|textarea|button)$/i,rclickable=/^(?:a|area)$/i;jQuery.fn.extend({prop:function(name,value){return access(this,jQuery.prop,name,value,arguments.length>1);},removeProp:function(name){return this.each(function(){delete this[jQuery.propFix[name]||name];});}});jQuery.extend({prop:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return;}
if(nType!==1||!jQuery.isXMLDoc(elem)){name=jQuery.propFix[name]||name;hooks=jQuery.propHooks[name];}
if(value!==undefined){if(hooks&&"set" in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret;}
return(elem[name]=value);}
if(hooks&&"get" in hooks&&(ret=hooks.get(elem,name))!==null){return ret;}
return elem[name];},propHooks:{tabIndex:{get:function(elem){var tabindex=jQuery.find.attr(elem,"tabindex");if(tabindex){return parseInt(tabindex,10);}
if(rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href){return 0;}
return-1;}}},propFix:{"for":"htmlFor","class":"className"}});if(!support.optSelected){jQuery.propHooks.selected={get:function(elem){var parent=elem.parentNode;if(parent&&parent.parentNode){parent.parentNode.selectedIndex;}
return null;},set:function(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex;}}}};}
jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){jQuery.propFix[this.toLowerCase()]=this;});function stripAndCollapse(value){var tokens=value.match(rnothtmlwhite)||[];return tokens.join(" ");}
function getClass(elem){return elem.getAttribute&&elem.getAttribute("class")||"";}
function classesToArray(value){if(Array.isArray(value)){return value;}
if(typeof value==="string"){return value.match(rnothtmlwhite)||[];}
return[];}
jQuery.fn.extend({addClass:function(value){var classNames,cur,curValue,className,i,finalValue;if(isFunction(value)){return this.each(function(j){jQuery(this).addClass(value.call(this,j,getClass(this)));});}
classNames=classesToArray(value);if(classNames.length){return this.each(function(){curValue=getClass(this);cur=this.nodeType===1&&(" "+stripAndCollapse(curValue)+" ");if(cur){for(i=0;i<classNames.length;i++){className=classNames[i];if(cur.indexOf(" "+className+" ")<0){cur+=className+" ";}}
finalValue=stripAndCollapse(cur);if(curValue!==finalValue){this.setAttribute("class",finalValue);}}});}
return this;},removeClass:function(value){var classNames,cur,curValue,className,i,finalValue;if(isFunction(value)){return this.each(function(j){jQuery(this).removeClass(value.call(this,j,getClass(this)));});}
if(!arguments.length){return this.attr("class","");}
classNames=classesToArray(value);if(classNames.length){return this.each(function(){curValue=getClass(this);cur=this.nodeType===1&&(" "+stripAndCollapse(curValue)+" ");if(cur){for(i=0;i<classNames.length;i++){className=classNames[i];while(cur.indexOf(" "+className+" ")>-1){cur=cur.replace(" "+className+" "," ");}}
finalValue=stripAndCollapse(cur);if(curValue!==finalValue){this.setAttribute("class",finalValue);}}});}
return this;},toggleClass:function(value,stateVal){var classNames,className,i,self,type=typeof value,isValidValue=type==="string"||Array.isArray(value);if(isFunction(value)){return this.each(function(i){jQuery(this).toggleClass(value.call(this,i,getClass(this),stateVal),stateVal);});}
if(typeof stateVal==="boolean"&&isValidValue){return stateVal?this.addClass(value):this.removeClass(value);}
classNames=classesToArray(value);return this.each(function(){if(isValidValue){self=jQuery(this);for(i=0;i<classNames.length;i++){className=classNames[i];if(self.hasClass(className)){self.removeClass(className);}else{self.addClass(className);}}}else if(value===undefined||type==="boolean"){className=getClass(this);if(className){dataPriv.set(this,"__className__",className);}
if(this.setAttribute){this.setAttribute("class",className||value===false?"":dataPriv.get(this,"__className__")||"");}}});},hasClass:function(selector){var className,elem,i=0;className=" "+selector+" ";while((elem=this[i++])){if(elem.nodeType===1&&(" "+stripAndCollapse(getClass(elem))+" ").indexOf(className)>-1){return true;}}
return false;}});var rreturn=/\r/g;jQuery.fn.extend({val:function(value){var hooks,ret,valueIsFunction,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.type]||jQuery.valHooks[elem.nodeName.toLowerCase()];if(hooks&&"get" in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret;}
ret=elem.value;if(typeof ret==="string"){return ret.replace(rreturn,"");}
return ret==null?"":ret;}
return;}
valueIsFunction=isFunction(value);return this.each(function(i){var val;if(this.nodeType!==1){return;}
if(valueIsFunction){val=value.call(this,i,jQuery(this).val());}else{val=value;}
if(val==null){val="";}else if(typeof val==="number"){val+="";}else if(Array.isArray(val)){val=jQuery.map(val,function(value){return value==null?"":value+"";});}
hooks=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];if(!hooks||!("set" in hooks)||hooks.set(this,val,"value")===undefined){this.value=val;}});}});jQuery.extend({valHooks:{option:{get:function(elem){var val=jQuery.find.attr(elem,"value");return val!=null?val:stripAndCollapse(jQuery.text(elem));}},select:{get:function(elem){var value,option,i,options=elem.options,index=elem.selectedIndex,one=elem.type==="select-one",values=one?null:[],max=one?index+1:options.length;if(index<0){i=max;}else{i=one?index:0;}
for(;i<max;i++){option=options[i];if((option.selected||i===index)&&!option.disabled&&(!option.parentNode.disabled||!nodeName(option.parentNode,"optgroup"))){value=jQuery(option).val();if(one){return value;}
values.push(value);}}
return values;},set:function(elem,value){var optionSet,option,options=elem.options,values=jQuery.makeArray(value),i=options.length;while(i--){option=options[i];if(option.selected=jQuery.inArray(jQuery.valHooks.option.get(option),values)>-1){optionSet=true;}}
if(!optionSet){elem.selectedIndex=-1;}
return values;}}}});jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={set:function(elem,value){if(Array.isArray(value)){return(elem.checked=jQuery.inArray(jQuery(elem).val(),value)>-1);}}};if(!support.checkOn){jQuery.valHooks[this].get=function(elem){return elem.getAttribute("value")===null?"on":elem.value;};}});var location=window.location;var nonce={guid:Date.now()};var rquery=(/\?/);jQuery.parseXML=function(data){var xml,parserErrorElem;if(!data||typeof data!=="string"){return null;}
try{xml=(new window.DOMParser()).parseFromString(data,"text/xml");}catch(e){}
parserErrorElem=xml&&xml.getElementsByTagName("parsererror")[0];if(!xml||parserErrorElem){jQuery.error("Invalid XML: "+(parserErrorElem?jQuery.map(parserErrorElem.childNodes,function(el){return el.textContent;}).join("\n"):data));}
return xml;};var rfocusMorph=/^(?:focusinfocus|focusoutblur)$/,stopPropagationCallback=function(e){e.stopPropagation();};jQuery.extend(jQuery.event,{trigger:function(event,data,elem,onlyHandlers){var i,cur,tmp,bubbleType,ontype,handle,special,lastElement,eventPath=[elem||document],type=hasOwn.call(event,"type")?event.type:event,namespaces=hasOwn.call(event,"namespace")?event.namespace.split("."):[];cur=lastElement=tmp=elem=elem||document;if(elem.nodeType===3||elem.nodeType===8){return;}
if(rfocusMorph.test(type+jQuery.event.triggered)){return;}
if(type.indexOf(".")>-1){namespaces=type.split(".");type=namespaces.shift();namespaces.sort();}
ontype=type.indexOf(":")<0&&"on"+type;event=event[jQuery.expando]?event:new jQuery.Event(type,typeof event==="object"&&event);event.isTrigger=onlyHandlers?2:3;event.namespace=namespaces.join(".");event.rnamespace=event.namespace?new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;event.result=undefined;if(!event.target){event.target=elem;}
data=data==null?[event]:jQuery.makeArray(data,[event]);special=jQuery.event.special[type]||{};if(!onlyHandlers&&special.trigger&&special.trigger.apply(elem,data)===false){return;}
if(!onlyHandlers&&!special.noBubble&&!isWindow(elem)){bubbleType=special.delegateType||type;if(!rfocusMorph.test(bubbleType+type)){cur=cur.parentNode;}
for(;cur;cur=cur.parentNode){eventPath.push(cur);tmp=cur;}
if(tmp===(elem.ownerDocument||document)){eventPath.push(tmp.defaultView||tmp.parentWindow||window);}}
i=0;while((cur=eventPath[i++])&&!event.isPropagationStopped()){lastElement=cur;event.type=i>1?bubbleType:special.bindType||type;handle=(dataPriv.get(cur,"events")||Object.create(null))[event.type]&&dataPriv.get(cur,"handle");if(handle){handle.apply(cur,data);}
handle=ontype&&cur[ontype];if(handle&&handle.apply&&acceptData(cur)){event.result=handle.apply(cur,data);if(event.result===false){event.preventDefault();}}}
event.type=type;if(!onlyHandlers&&!event.isDefaultPrevented()){if((!special._default||special._default.apply(eventPath.pop(),data)===false)&&acceptData(elem)){if(ontype&&isFunction(elem[type])&&!isWindow(elem)){tmp=elem[ontype];if(tmp){elem[ontype]=null;}
jQuery.event.triggered=type;if(event.isPropagationStopped()){lastElement.addEventListener(type,stopPropagationCallback);}
elem[type]();if(event.isPropagationStopped()){lastElement.removeEventListener(type,stopPropagationCallback);}
jQuery.event.triggered=undefined;if(tmp){elem[ontype]=tmp;}}}}
return event.result;},simulate:function(type,elem,event){var e=jQuery.extend(new jQuery.Event(),event,{type:type,isSimulated:true});jQuery.event.trigger(e,null,elem);}});jQuery.fn.extend({trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},triggerHandler:function(type,data){var elem=this[0];if(elem){return jQuery.event.trigger(type,data,elem,true);}}});var
rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;function buildParams(prefix,obj,traditional,add){var name;if(Array.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional||rbracket.test(prefix)){add(prefix,v);}else{buildParams(prefix+"["+(typeof v==="object"&&v!=null?i:"")+"]",v,traditional,add);}});}else if(!traditional&&toType(obj)==="object"){for(name in obj){buildParams(prefix+"["+name+"]",obj[name],traditional,add);}}else{add(prefix,obj);}}
jQuery.param=function(a,traditional){var prefix,s=[],add=function(key,valueOrFunction){var value=isFunction(valueOrFunction)?valueOrFunction():valueOrFunction;s[s.length]=encodeURIComponent(key)+"="+
encodeURIComponent(value==null?"":value);};if(a==null){return"";}
if(Array.isArray(a)||(a.jquery&&!jQuery.isPlainObject(a))){jQuery.each(a,function(){add(this.name,this.value);});}else{for(prefix in a){buildParams(prefix,a[prefix],traditional,add);}}
return s.join("&");};jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){var elements=jQuery.prop(this,"elements");return elements?jQuery.makeArray(elements):this;}).filter(function(){var type=this.type;return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(type)&&(this.checked||!rcheckableType.test(type));}).map(function(_i,elem){var val=jQuery(this).val();if(val==null){return null;}
if(Array.isArray(val)){return jQuery.map(val,function(val){return{name:elem.name,value:val.replace(rCRLF,"\r\n")};});}
return{name:elem.name,value:val.replace(rCRLF,"\r\n")};}).get();}});var
r20=/%20/g,rhash=/#.*$/,rantiCache=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)$/mg,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,prefilters={},transports={},allTypes="*/".concat("*"),originAnchor=document.createElement("a");originAnchor.href=location.href;function addToPrefiltersOrTransports(structure){return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*";}
var dataType,i=0,dataTypes=dataTypeExpression.toLowerCase().match(rnothtmlwhite)||[];if(isFunction(func)){while((dataType=dataTypes[i++])){if(dataType[0]==="+"){dataType=dataType.slice(1)||"*";(structure[dataType]=structure[dataType]||[]).unshift(func);}else{(structure[dataType]=structure[dataType]||[]).push(func);}}}};}
function inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR){var inspected={},seekingTransport=(structure===transports);function inspect(dataType){var selected;inspected[dataType]=true;jQuery.each(structure[dataType]||[],function(_,prefilterOrFactory){var dataTypeOrTransport=prefilterOrFactory(options,originalOptions,jqXHR);if(typeof dataTypeOrTransport==="string"&&!seekingTransport&&!inspected[dataTypeOrTransport]){options.dataTypes.unshift(dataTypeOrTransport);inspect(dataTypeOrTransport);return false;}else if(seekingTransport){return!(selected=dataTypeOrTransport);}});return selected;}
return inspect(options.dataTypes[0])||!inspected["*"]&&inspect("*");}
function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:(deep||(deep={})))[key]=src[key];}}
if(deep){jQuery.extend(true,target,deep);}
return target;}
function ajaxHandleResponses(s,jqXHR,responses){var ct,type,finalDataType,firstDataType,contents=s.contents,dataTypes=s.dataTypes;while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("Content-Type");}}
if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break;}}}
if(dataTypes[0]in responses){finalDataType=dataTypes[0];}else{for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break;}
if(!firstDataType){firstDataType=type;}}
finalDataType=finalDataType||firstDataType;}
if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType);}
return responses[finalDataType];}}
function ajaxConvert(s,response,jqXHR,isSuccess){var conv2,current,conv,tmp,prev,converters={},dataTypes=s.dataTypes.slice();if(dataTypes[1]){for(conv in s.converters){converters[conv.toLowerCase()]=s.converters[conv];}}
current=dataTypes.shift();while(current){if(s.responseFields[current]){jqXHR[s.responseFields[current]]=response;}
if(!prev&&isSuccess&&s.dataFilter){response=s.dataFilter(response,s.dataType);}
prev=current;current=dataTypes.shift();if(current){if(current==="*"){current=prev;}else if(prev!=="*"&&prev!==current){conv=converters[prev+" "+current]||converters["* "+current];if(!conv){for(conv2 in converters){tmp=conv2.split(" ");if(tmp[1]===current){conv=converters[prev+" "+tmp[0]]||converters["* "+tmp[0]];if(conv){if(conv===true){conv=converters[conv2];}else if(converters[conv2]!==true){current=tmp[0];dataTypes.unshift(tmp[1]);}
break;}}}}
if(conv!==true){if(conv&&s.throws){response=conv(response);}else{try{response=conv(response);}catch(e){return{state:"parsererror",error:conv?e:"No conversion from "+prev+" to "+current};}}}}}}
return{state:"success",data:response};}
jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:location.href,type:"GET",isLocal:rlocalProtocol.test(location.protocol),global:true,processData:true,async:true,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":true,"text json":JSON.parse,"text xml":jQuery.parseXML},flatOptions:{url:true,context:true}},ajaxSetup:function(target,settings){return settings?ajaxExtend(ajaxExtend(target,jQuery.ajaxSettings),settings):ajaxExtend(jQuery.ajaxSettings,target);},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(url,options){if(typeof url==="object"){options=url;url=undefined;}
options=options||{};var transport,cacheURL,responseHeadersString,responseHeaders,timeoutTimer,urlAnchor,completed,fireGlobals,i,uncached,s=jQuery.ajaxSetup({},options),callbackContext=s.context||s,globalEventContext=s.context&&(callbackContext.nodeType||callbackContext.jquery)?jQuery(callbackContext):jQuery.event,deferred=jQuery.Deferred(),completeDeferred=jQuery.Callbacks("once memory"),statusCode=s.statusCode||{},requestHeaders={},requestHeadersNames={},strAbort="canceled",jqXHR={readyState:0,getResponseHeader:function(key){var match;if(completed){if(!responseHeaders){responseHeaders={};while((match=rheaders.exec(responseHeadersString))){responseHeaders[match[1].toLowerCase()+" "]=(responseHeaders[match[1].toLowerCase()+" "]||[]).concat(match[2]);}}
match=responseHeaders[key.toLowerCase()+" "];}
return match==null?null:match.join(", ");},getAllResponseHeaders:function(){return completed?responseHeadersString:null;},setRequestHeader:function(name,value){if(completed==null){name=requestHeadersNames[name.toLowerCase()]=requestHeadersNames[name.toLowerCase()]||name;requestHeaders[name]=value;}
return this;},overrideMimeType:function(type){if(completed==null){s.mimeType=type;}
return this;},statusCode:function(map){var code;if(map){if(completed){jqXHR.always(map[jqXHR.status]);}else{for(code in map){statusCode[code]=[statusCode[code],map[code]];}}}
return this;},abort:function(statusText){var finalText=statusText||strAbort;if(transport){transport.abort(finalText);}
done(0,finalText);return this;}};deferred.promise(jqXHR);s.url=((url||s.url||location.href)+"").replace(rprotocol,location.protocol+"//");s.type=options.method||options.type||s.method||s.type;s.dataTypes=(s.dataType||"*").toLowerCase().match(rnothtmlwhite)||[""];if(s.crossDomain==null){urlAnchor=document.createElement("a");try{urlAnchor.href=s.url;urlAnchor.href=urlAnchor.href;s.crossDomain=originAnchor.protocol+"//"+originAnchor.host!==urlAnchor.protocol+"//"+urlAnchor.host;}catch(e){s.crossDomain=true;}}
if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional);}
inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);if(completed){return jqXHR;}
fireGlobals=jQuery.event&&s.global;if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart");}
s.type=s.type.toUpperCase();s.hasContent=!rnoContent.test(s.type);cacheURL=s.url.replace(rhash,"");if(!s.hasContent){uncached=s.url.slice(cacheURL.length);if(s.data&&(s.processData||typeof s.data==="string")){cacheURL+=(rquery.test(cacheURL)?"&":"?")+s.data;delete s.data;}
if(s.cache===false){cacheURL=cacheURL.replace(rantiCache,"$1");uncached=(rquery.test(cacheURL)?"&":"?")+"_="+(nonce.guid++)+
uncached;}
s.url=cacheURL+uncached;}else if(s.data&&s.processData&&(s.contentType||"").indexOf("application/x-www-form-urlencoded")===0){s.data=s.data.replace(r20,"+");}
if(s.ifModified){if(jQuery.lastModified[cacheURL]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[cacheURL]);}
if(jQuery.etag[cacheURL]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[cacheURL]);}}
if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType);}
jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+
(s.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):s.accepts["*"]);for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i]);}
if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||completed)){return jqXHR.abort();}
strAbort="abort";completeDeferred.add(s.complete);jqXHR.done(s.success);jqXHR.fail(s.error);transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);if(!transport){done(-1,"No Transport");}else{jqXHR.readyState=1;if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s]);}
if(completed){return jqXHR;}
if(s.async&&s.timeout>0){timeoutTimer=window.setTimeout(function(){jqXHR.abort("timeout");},s.timeout);}
try{completed=false;transport.send(requestHeaders,done);}catch(e){if(completed){throw e;}
done(-1,e);}}
function done(status,nativeStatusText,responses,headers){var isSuccess,success,error,response,modified,statusText=nativeStatusText;if(completed){return;}
completed=true;if(timeoutTimer){window.clearTimeout(timeoutTimer);}
transport=undefined;responseHeadersString=headers||"";jqXHR.readyState=status>0?4:0;isSuccess=status>=200&&status<300||status===304;if(responses){response=ajaxHandleResponses(s,jqXHR,responses);}
if(!isSuccess&&jQuery.inArray("script",s.dataTypes)>-1&&jQuery.inArray("json",s.dataTypes)<0){s.converters["text script"]=function(){};}
response=ajaxConvert(s,response,jqXHR,isSuccess);if(isSuccess){if(s.ifModified){modified=jqXHR.getResponseHeader("Last-Modified");if(modified){jQuery.lastModified[cacheURL]=modified;}
modified=jqXHR.getResponseHeader("etag");if(modified){jQuery.etag[cacheURL]=modified;}}
if(status===204||s.type==="HEAD"){statusText="nocontent";}else if(status===304){statusText="notmodified";}else{statusText=response.state;success=response.data;error=response.error;isSuccess=!error;}}else{error=statusText;if(status||!statusText){statusText="error";if(status<0){status=0;}}}
jqXHR.status=status;jqXHR.statusText=(nativeStatusText||statusText)+"";if(isSuccess){deferred.resolveWith(callbackContext,[success,statusText,jqXHR]);}else{deferred.rejectWith(callbackContext,[jqXHR,statusText,error]);}
jqXHR.statusCode(statusCode);statusCode=undefined;if(fireGlobals){globalEventContext.trigger(isSuccess?"ajaxSuccess":"ajaxError",[jqXHR,s,isSuccess?success:error]);}
completeDeferred.fireWith(callbackContext,[jqXHR,statusText]);if(fireGlobals){globalEventContext.trigger("ajaxComplete",[jqXHR,s]);if(!(--jQuery.active)){jQuery.event.trigger("ajaxStop");}}}
return jqXHR;},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},getScript:function(url,callback){return jQuery.get(url,undefined,callback,"script");}});jQuery.each(["get","post"],function(_i,method){jQuery[method]=function(url,data,callback,type){if(isFunction(data)){type=type||callback;callback=data;data=undefined;}
return jQuery.ajax(jQuery.extend({url:url,type:method,dataType:type,data:data,success:callback},jQuery.isPlainObject(url)&&url));};});jQuery.ajaxPrefilter(function(s){var i;for(i in s.headers){if(i.toLowerCase()==="content-type"){s.contentType=s.headers[i]||"";}}});jQuery._evalUrl=function(url,options,doc){return jQuery.ajax({url:url,type:"GET",dataType:"script",cache:true,async:false,global:false,converters:{"text script":function(){}},dataFilter:function(response){jQuery.globalEval(response,options,doc);}});};jQuery.fn.extend({wrapAll:function(html){var wrap;if(this[0]){if(isFunction(html)){html=html.call(this[0]);}
wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0]);}
wrap.map(function(){var elem=this;while(elem.firstElementChild){elem=elem.firstElementChild;}
return elem;}).append(this);}
return this;},wrapInner:function(html){if(isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i));});}
return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html);}else{self.append(html);}});},wrap:function(html){var htmlIsFunction=isFunction(html);return this.each(function(i){jQuery(this).wrapAll(htmlIsFunction?html.call(this,i):html);});},unwrap:function(selector){this.parent(selector).not("body").each(function(){jQuery(this).replaceWith(this.childNodes);});return this;}});jQuery.expr.pseudos.hidden=function(elem){return!jQuery.expr.pseudos.visible(elem);};jQuery.expr.pseudos.visible=function(elem){return!!(elem.offsetWidth||elem.offsetHeight||elem.getClientRects().length);};jQuery.ajaxSettings.xhr=function(){try{return new window.XMLHttpRequest();}catch(e){}};var xhrSuccessStatus={0:200,1223:204},xhrSupported=jQuery.ajaxSettings.xhr();support.cors=!!xhrSupported&&("withCredentials" in xhrSupported);support.ajax=xhrSupported=!!xhrSupported;jQuery.ajaxTransport(function(options){var callback,errorCallback;if(support.cors||xhrSupported&&!options.crossDomain){return{send:function(headers,complete){var i,xhr=options.xhr();xhr.open(options.type,options.url,options.async,options.username,options.password);if(options.xhrFields){for(i in options.xhrFields){xhr[i]=options.xhrFields[i];}}
if(options.mimeType&&xhr.overrideMimeType){xhr.overrideMimeType(options.mimeType);}
if(!options.crossDomain&&!headers["X-Requested-With"]){headers["X-Requested-With"]="XMLHttpRequest";}
for(i in headers){xhr.setRequestHeader(i,headers[i]);}
callback=function(type){return function(){if(callback){callback=errorCallback=xhr.onload=xhr.onerror=xhr.onabort=xhr.ontimeout=xhr.onreadystatechange=null;if(type==="abort"){xhr.abort();}else if(type==="error"){if(typeof xhr.status!=="number"){complete(0,"error");}else{complete(xhr.status,xhr.statusText);}}else{complete(xhrSuccessStatus[xhr.status]||xhr.status,xhr.statusText,(xhr.responseType||"text")!=="text"||typeof xhr.responseText!=="string"?{binary:xhr.response}:{text:xhr.responseText},xhr.getAllResponseHeaders());}}};};xhr.onload=callback();errorCallback=xhr.onerror=xhr.ontimeout=callback("error");if(xhr.onabort!==undefined){xhr.onabort=errorCallback;}else{xhr.onreadystatechange=function(){if(xhr.readyState===4){window.setTimeout(function(){if(callback){errorCallback();}});}};}
callback=callback("abort");try{xhr.send(options.hasContent&&options.data||null);}catch(e){if(callback){throw e;}}},abort:function(){if(callback){callback();}}};}});jQuery.ajaxPrefilter(function(s){if(s.crossDomain){s.contents.script=false;}});jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, "+"application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(text){jQuery.globalEval(text);return text;}}});jQuery.ajaxPrefilter("script",function(s){if(s.cache===undefined){s.cache=false;}
if(s.crossDomain){s.type="GET";}});jQuery.ajaxTransport("script",function(s){if(s.crossDomain||s.scriptAttrs){var script,callback;return{send:function(_,complete){script=jQuery("<script>").attr(s.scriptAttrs||{}).prop({charset:s.scriptCharset,src:s.url}).on("load error",callback=function(evt){script.remove();callback=null;if(evt){complete(evt.type==="error"?404:200,evt.type);}});document.head.appendChild(script[0]);},abort:function(){if(callback){callback();}}};}});var oldCallbacks=[],rjsonp=/(=)\?(?=&|$)|\?\?/;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var callback=oldCallbacks.pop()||(jQuery.expando+"_"+(nonce.guid++));this[callback]=true;return callback;}});jQuery.ajaxPrefilter("json jsonp",function(s,originalSettings,jqXHR){var callbackName,overwritten,responseContainer,jsonProp=s.jsonp!==false&&(rjsonp.test(s.url)?"url":typeof s.data==="string"&&(s.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&rjsonp.test(s.data)&&"data");if(jsonProp||s.dataTypes[0]==="jsonp"){callbackName=s.jsonpCallback=isFunction(s.jsonpCallback)?s.jsonpCallback():s.jsonpCallback;if(jsonProp){s[jsonProp]=s[jsonProp].replace(rjsonp,"$1"+callbackName);}else if(s.jsonp!==false){s.url+=(rquery.test(s.url)?"&":"?")+s.jsonp+"="+callbackName;}
s.converters["script json"]=function(){if(!responseContainer){jQuery.error(callbackName+" was not called");}
return responseContainer[0];};s.dataTypes[0]="json";overwritten=window[callbackName];window[callbackName]=function(){responseContainer=arguments;};jqXHR.always(function(){if(overwritten===undefined){jQuery(window).removeProp(callbackName);}else{window[callbackName]=overwritten;}
if(s[callbackName]){s.jsonpCallback=originalSettings.jsonpCallback;oldCallbacks.push(callbackName);}
if(responseContainer&&isFunction(overwritten)){overwritten(responseContainer[0]);}
responseContainer=overwritten=undefined;});return"script";}});support.createHTMLDocument=(function(){var body=document.implementation.createHTMLDocument("").body;body.innerHTML="<form></form><form></form>";return body.childNodes.length===2;})();jQuery.parseHTML=function(data,context,keepScripts){if(typeof data!=="string"){return[];}
if(typeof context==="boolean"){keepScripts=context;context=false;}
var base,parsed,scripts;if(!context){if(support.createHTMLDocument){context=document.implementation.createHTMLDocument("");base=context.createElement("base");base.href=document.location.href;context.head.appendChild(base);}else{context=document;}}
parsed=rsingleTag.exec(data);scripts=!keepScripts&&[];if(parsed){return[context.createElement(parsed[1])];}
parsed=buildFragment([data],context,scripts);if(scripts&&scripts.length){jQuery(scripts).remove();}
return jQuery.merge([],parsed.childNodes);};jQuery.fn.load=function(url,params,callback){var selector,type,response,self=this,off=url.indexOf(" ");if(off>-1){selector=stripAndCollapse(url.slice(off));url=url.slice(0,off);}
if(isFunction(params)){callback=params;params=undefined;}else if(params&&typeof params==="object"){type="POST";}
if(self.length>0){jQuery.ajax({url:url,type:type||"GET",dataType:"html",data:params}).done(function(responseText){response=arguments;self.html(selector?jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector):responseText);}).always(callback&&function(jqXHR,status){self.each(function(){callback.apply(this,response||[jqXHR.responseText,status,jqXHR]);});});}
return this;};jQuery.expr.pseudos.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};jQuery.offset={setOffset:function(elem,options,i){var curPosition,curLeft,curCSSTop,curTop,curOffset,curCSSLeft,calculatePosition,position=jQuery.css(elem,"position"),curElem=jQuery(elem),props={};if(position==="static"){elem.style.position="relative";}
curOffset=curElem.offset();curCSSTop=jQuery.css(elem,"top");curCSSLeft=jQuery.css(elem,"left");calculatePosition=(position==="absolute"||position==="fixed")&&(curCSSTop+curCSSLeft).indexOf("auto")>-1;if(calculatePosition){curPosition=curElem.position();curTop=curPosition.top;curLeft=curPosition.left;}else{curTop=parseFloat(curCSSTop)||0;curLeft=parseFloat(curCSSLeft)||0;}
if(isFunction(options)){options=options.call(elem,i,jQuery.extend({},curOffset));}
if(options.top!=null){props.top=(options.top-curOffset.top)+curTop;}
if(options.left!=null){props.left=(options.left-curOffset.left)+curLeft;}
if("using" in options){options.using.call(elem,props);}else{curElem.css(props);}}};jQuery.fn.extend({offset:function(options){if(arguments.length){return options===undefined?this:this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
var rect,win,elem=this[0];if(!elem){return;}
if(!elem.getClientRects().length){return{top:0,left:0};}
rect=elem.getBoundingClientRect();win=elem.ownerDocument.defaultView;return{top:rect.top+win.pageYOffset,left:rect.left+win.pageXOffset};},position:function(){if(!this[0]){return;}
var offsetParent,offset,doc,elem=this[0],parentOffset={top:0,left:0};if(jQuery.css(elem,"position")==="fixed"){offset=elem.getBoundingClientRect();}else{offset=this.offset();doc=elem.ownerDocument;offsetParent=elem.offsetParent||doc.documentElement;while(offsetParent&&(offsetParent===doc.body||offsetParent===doc.documentElement)&&jQuery.css(offsetParent,"position")==="static"){offsetParent=offsetParent.parentNode;}
if(offsetParent&&offsetParent!==elem&&offsetParent.nodeType===1){parentOffset=jQuery(offsetParent).offset();parentOffset.top+=jQuery.css(offsetParent,"borderTopWidth",true);parentOffset.left+=jQuery.css(offsetParent,"borderLeftWidth",true);}}
return{top:offset.top-parentOffset.top-jQuery.css(elem,"marginTop",true),left:offset.left-parentOffset.left-jQuery.css(elem,"marginLeft",true)};},offsetParent:function(){return this.map(function(){var offsetParent=this.offsetParent;while(offsetParent&&jQuery.css(offsetParent,"position")==="static"){offsetParent=offsetParent.offsetParent;}
return offsetParent||documentElement;});}});jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(method,prop){var top="pageYOffset"===prop;jQuery.fn[method]=function(val){return access(this,function(elem,method,val){var win;if(isWindow(elem)){win=elem;}else if(elem.nodeType===9){win=elem.defaultView;}
if(val===undefined){return win?win[prop]:elem[method];}
if(win){win.scrollTo(!top?val:win.pageXOffset,top?val:win.pageYOffset);}else{elem[method]=val;}},method,val,arguments.length);};});jQuery.each(["top","left"],function(_i,prop){jQuery.cssHooks[prop]=addGetHookIf(support.pixelPosition,function(elem,computed){if(computed){computed=curCSS(elem,prop);return rnumnonpx.test(computed)?jQuery(elem).position()[prop]+"px":computed;}});});jQuery.each({Height:"height",Width:"width"},function(name,type){jQuery.each({padding:"inner"+name,content:type,"":"outer"+name},function(defaultExtra,funcName){jQuery.fn[funcName]=function(margin,value){var chainable=arguments.length&&(defaultExtra||typeof margin!=="boolean"),extra=defaultExtra||(margin===true||value===true?"margin":"border");return access(this,function(elem,type,value){var doc;if(isWindow(elem)){return funcName.indexOf("outer")===0?elem["inner"+name]:elem.document.documentElement["client"+name];}
if(elem.nodeType===9){doc=elem.documentElement;return Math.max(elem.body["scroll"+name],doc["scroll"+name],elem.body["offset"+name],doc["offset"+name],doc["client"+name]);}
return value===undefined?jQuery.css(elem,type,extra):jQuery.style(elem,type,value,extra);},type,chainable?margin:undefined,chainable);};});});jQuery.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(_i,type){jQuery.fn[type]=function(fn){return this.on(type,fn);};});jQuery.fn.extend({bind:function(types,data,fn){return this.on(types,null,data,fn);},unbind:function(types,fn){return this.off(types,null,fn);},delegate:function(selector,types,data,fn){return this.on(types,selector,data,fn);},undelegate:function(selector,types,fn){return arguments.length===1?this.off(selector,"**"):this.off(types,selector||"**",fn);},hover:function(fnOver,fnOut){return this.on("mouseenter",fnOver).on("mouseleave",fnOut||fnOver);}});jQuery.each(("blur focus focusin focusout resize scroll click dblclick "+"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+"change select submit keydown keypress keyup contextmenu").split(" "),function(_i,name){jQuery.fn[name]=function(data,fn){return arguments.length>0?this.on(name,null,data,fn):this.trigger(name);};});var rtrim=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;jQuery.proxy=function(fn,context){var tmp,args,proxy;if(typeof context==="string"){tmp=fn[context];context=fn;fn=tmp;}
if(!isFunction(fn)){return undefined;}
args=slice.call(arguments,2);proxy=function(){return fn.apply(context||this,args.concat(slice.call(arguments)));};proxy.guid=fn.guid=fn.guid||jQuery.guid++;return proxy;};jQuery.holdReady=function(hold){if(hold){jQuery.readyWait++;}else{jQuery.ready(true);}};jQuery.isArray=Array.isArray;jQuery.parseJSON=JSON.parse;jQuery.nodeName=nodeName;jQuery.isFunction=isFunction;jQuery.isWindow=isWindow;jQuery.camelCase=camelCase;jQuery.type=toType;jQuery.now=Date.now;jQuery.isNumeric=function(obj){var type=jQuery.type(obj);return(type==="number"||type==="string")&&!isNaN(obj-parseFloat(obj));};jQuery.trim=function(text){return text==null?"":(text+"").replace(rtrim,"$1");};if(typeof define==="function"&&define.amd){define("jquery",[],function(){return jQuery;});}
var
_jQuery=window.jQuery,_$=window.$;jQuery.noConflict=function(deep){if(window.$===jQuery){window.$=_$;}
if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery;}
return jQuery;};if(typeof noGlobal==="undefined"){window.jQuery=window.$=jQuery;}
return jQuery;});;;
(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery"],factory);}else{factory(jQuery);}})(function($){"use strict";$.ui=$.ui||{};var version=$.ui.version="1.13.2";var widgetUuid=0;var widgetHasOwnProperty=Array.prototype.hasOwnProperty;var widgetSlice=Array.prototype.slice;$.cleanData=(function(orig){return function(elems){var events,elem,i;for(i=0;(elem=elems[i])!=null;i++){events=$._data(elem,"events");if(events&&events.remove){$(elem).triggerHandler("remove");}}
orig(elems);};})($.cleanData);$.widget=function(name,base,prototype){var existingConstructor,constructor,basePrototype;var proxiedPrototype={};var namespace=name.split(".")[0];name=name.split(".")[1];var fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget;}
if(Array.isArray(prototype)){prototype=$.extend.apply(null,[{}].concat(prototype));}
$.expr.pseudos[fullName.toLowerCase()]=function(elem){return!!$.data(elem,fullName);};$[namespace]=$[namespace]||{};existingConstructor=$[namespace][name];constructor=$[namespace][name]=function(options,element){if(!this||!this._createWidget){return new constructor(options,element);}
if(arguments.length){this._createWidget(options,element);}};$.extend(constructor,existingConstructor,{version:prototype.version,_proto:$.extend({},prototype),_childConstructors:[]});basePrototype=new base();basePrototype.options=$.widget.extend({},basePrototype.options);$.each(prototype,function(prop,value){if(typeof value!=="function"){proxiedPrototype[prop]=value;return;}
proxiedPrototype[prop]=(function(){function _super(){return base.prototype[prop].apply(this,arguments);}
function _superApply(args){return base.prototype[prop].apply(this,args);}
return function(){var __super=this._super;var __superApply=this._superApply;var returnValue;this._super=_super;this._superApply=_superApply;returnValue=value.apply(this,arguments);this._super=__super;this._superApply=__superApply;return returnValue;};})();});constructor.prototype=$.widget.extend(basePrototype,{widgetEventPrefix:existingConstructor?(basePrototype.widgetEventPrefix||name):name},proxiedPrototype,{constructor:constructor,namespace:namespace,widgetName:name,widgetFullName:fullName});if(existingConstructor){$.each(existingConstructor._childConstructors,function(i,child){var childPrototype=child.prototype;$.widget(childPrototype.namespace+"."+childPrototype.widgetName,constructor,child._proto);});delete existingConstructor._childConstructors;}else{base._childConstructors.push(constructor);}
$.widget.bridge(name,constructor);return constructor;};$.widget.extend=function(target){var input=widgetSlice.call(arguments,1);var inputIndex=0;var inputLength=input.length;var key;var value;for(;inputIndex<inputLength;inputIndex++){for(key in input[inputIndex]){value=input[inputIndex][key];if(widgetHasOwnProperty.call(input[inputIndex],key)&&value!==undefined){if($.isPlainObject(value)){target[key]=$.isPlainObject(target[key])?$.widget.extend({},target[key],value):$.widget.extend({},value);}else{target[key]=value;}}}}
return target;};$.widget.bridge=function(name,object){var fullName=object.prototype.widgetFullName||name;$.fn[name]=function(options){var isMethodCall=typeof options==="string";var args=widgetSlice.call(arguments,1);var returnValue=this;if(isMethodCall){if(!this.length&&options==="instance"){returnValue=undefined;}else{this.each(function(){var methodValue;var instance=$.data(this,fullName);if(options==="instance"){returnValue=instance;return false;}
if(!instance){return $.error("cannot call methods on "+name+" prior to initialization; "+"attempted to call method '"+options+"'");}
if(typeof instance[options]!=="function"||options.charAt(0)==="_"){return $.error("no such method '"+options+"' for "+name+" widget instance");}
methodValue=instance[options].apply(instance,args);if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue&&methodValue.jquery?returnValue.pushStack(methodValue.get()):methodValue;return false;}});}}else{if(args.length){options=$.widget.extend.apply(null,[options].concat(args));}
this.each(function(){var instance=$.data(this,fullName);if(instance){instance.option(options||{});if(instance._init){instance._init();}}else{$.data(this,fullName,new object(options,this));}});}
return returnValue;};};$.Widget=function(){};$.Widget._childConstructors=[];$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:false,create:null},_createWidget:function(options,element){element=$(element||this.defaultElement||this)[0];this.element=$(element);this.uuid=widgetUuid++;this.eventNamespace="."+this.widgetName+this.uuid;this.bindings=$();this.hoverable=$();this.focusable=$();this.classesElementLookup={};if(element!==this){$.data(element,this.widgetFullName,this);this._on(true,this.element,{remove:function(event){if(event.target===element){this.destroy();}}});this.document=$(element.style?element.ownerDocument:element.document||element);this.window=$(this.document[0].defaultView||this.document[0].parentWindow);}
this.options=$.widget.extend({},this.options,this._getCreateOptions(),options);this._create();if(this.options.disabled){this._setOptionDisabled(this.options.disabled);}
this._trigger("create",null,this._getCreateEventData());this._init();},_getCreateOptions:function(){return{};},_getCreateEventData:$.noop,_create:$.noop,_init:$.noop,destroy:function(){var that=this;this._destroy();$.each(this.classesElementLookup,function(key,value){that._removeClass(value,key);});this.element.off(this.eventNamespace).removeData(this.widgetFullName);this.widget().off(this.eventNamespace).removeAttr("aria-disabled");this.bindings.off(this.eventNamespace);},_destroy:$.noop,widget:function(){return this.element;},option:function(key,value){var options=key;var parts;var curOption;var i;if(arguments.length===0){return $.widget.extend({},this.options);}
if(typeof key==="string"){options={};parts=key.split(".");key=parts.shift();if(parts.length){curOption=options[key]=$.widget.extend({},this.options[key]);for(i=0;i<parts.length-1;i++){curOption[parts[i]]=curOption[parts[i]]||{};curOption=curOption[parts[i]];}
key=parts.pop();if(arguments.length===1){return curOption[key]===undefined?null:curOption[key];}
curOption[key]=value;}else{if(arguments.length===1){return this.options[key]===undefined?null:this.options[key];}
options[key]=value;}}
this._setOptions(options);return this;},_setOptions:function(options){var key;for(key in options){this._setOption(key,options[key]);}
return this;},_setOption:function(key,value){if(key==="classes"){this._setOptionClasses(value);}
this.options[key]=value;if(key==="disabled"){this._setOptionDisabled(value);}
return this;},_setOptionClasses:function(value){var classKey,elements,currentElements;for(classKey in value){currentElements=this.classesElementLookup[classKey];if(value[classKey]===this.options.classes[classKey]||!currentElements||!currentElements.length){continue;}
elements=$(currentElements.get());this._removeClass(currentElements,classKey);elements.addClass(this._classes({element:elements,keys:classKey,classes:value,add:true}));}},_setOptionDisabled:function(value){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!value);if(value){this._removeClass(this.hoverable,null,"ui-state-hover");this._removeClass(this.focusable,null,"ui-state-focus");}},enable:function(){return this._setOptions({disabled:false});},disable:function(){return this._setOptions({disabled:true});},_classes:function(options){var full=[];var that=this;options=$.extend({element:this.element,classes:this.options.classes||{}},options);function bindRemoveEvent(){var nodesToBind=[];options.element.each(function(_,element){var isTracked=$.map(that.classesElementLookup,function(elements){return elements;}).some(function(elements){return elements.is(element);});if(!isTracked){nodesToBind.push(element);}});that._on($(nodesToBind),{remove:"_untrackClassesElement"});}
function processClassString(classes,checkOption){var current,i;for(i=0;i<classes.length;i++){current=that.classesElementLookup[classes[i]]||$();if(options.add){bindRemoveEvent();current=$($.uniqueSort(current.get().concat(options.element.get())));}else{current=$(current.not(options.element).get());}
that.classesElementLookup[classes[i]]=current;full.push(classes[i]);if(checkOption&&options.classes[classes[i]]){full.push(options.classes[classes[i]]);}}}
if(options.keys){processClassString(options.keys.match(/\S+/g)||[],true);}
if(options.extra){processClassString(options.extra.match(/\S+/g)||[]);}
return full.join(" ");},_untrackClassesElement:function(event){var that=this;$.each(that.classesElementLookup,function(key,value){if($.inArray(event.target,value)!==-1){that.classesElementLookup[key]=$(value.not(event.target).get());}});this._off($(event.target));},_removeClass:function(element,keys,extra){return this._toggleClass(element,keys,extra,false);},_addClass:function(element,keys,extra){return this._toggleClass(element,keys,extra,true);},_toggleClass:function(element,keys,extra,add){add=(typeof add==="boolean")?add:extra;var shift=(typeof element==="string"||element===null),options={extra:shift?keys:extra,keys:shift?element:keys,element:shift?this.element:element,add:add};options.element.toggleClass(this._classes(options),add);return this;},_on:function(suppressDisabledCheck,element,handlers){var delegateElement;var instance=this;if(typeof suppressDisabledCheck!=="boolean"){handlers=element;element=suppressDisabledCheck;suppressDisabledCheck=false;}
if(!handlers){handlers=element;element=this.element;delegateElement=this.widget();}else{element=delegateElement=$(element);this.bindings=this.bindings.add(element);}
$.each(handlers,function(event,handler){function handlerProxy(){if(!suppressDisabledCheck&&(instance.options.disabled===true||$(this).hasClass("ui-state-disabled"))){return;}
return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments);}
if(typeof handler!=="string"){handlerProxy.guid=handler.guid=handler.guid||handlerProxy.guid||$.guid++;}
var match=event.match(/^([\w:-]*)\s*(.*)$/);var eventName=match[1]+instance.eventNamespace;var selector=match[2];if(selector){delegateElement.on(eventName,selector,handlerProxy);}else{element.on(eventName,handlerProxy);}});},_off:function(element,eventName){eventName=(eventName||"").split(" ").join(this.eventNamespace+" ")+
this.eventNamespace;element.off(eventName);this.bindings=$(this.bindings.not(element).get());this.focusable=$(this.focusable.not(element).get());this.hoverable=$(this.hoverable.not(element).get());},_delay:function(handler,delay){function handlerProxy(){return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments);}
var instance=this;return setTimeout(handlerProxy,delay||0);},_hoverable:function(element){this.hoverable=this.hoverable.add(element);this._on(element,{mouseenter:function(event){this._addClass($(event.currentTarget),null,"ui-state-hover");},mouseleave:function(event){this._removeClass($(event.currentTarget),null,"ui-state-hover");}});},_focusable:function(element){this.focusable=this.focusable.add(element);this._on(element,{focusin:function(event){this._addClass($(event.currentTarget),null,"ui-state-focus");},focusout:function(event){this._removeClass($(event.currentTarget),null,"ui-state-focus");}});},_trigger:function(type,event,data){var prop,orig;var callback=this.options[type];data=data||{};event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();event.target=this.element[0];orig=event.originalEvent;if(orig){for(prop in orig){if(!(prop in event)){event[prop]=orig[prop];}}}
this.element.trigger(event,data);return!(typeof callback==="function"&&callback.apply(this.element[0],[event].concat(data))===false||event.isDefaultPrevented());}};$.each({show:"fadeIn",hide:"fadeOut"},function(method,defaultEffect){$.Widget.prototype["_"+method]=function(element,options,callback){if(typeof options==="string"){options={effect:options};}
var hasOptions;var effectName=!options?method:options===true||typeof options==="number"?defaultEffect:options.effect||defaultEffect;options=options||{};if(typeof options==="number"){options={duration:options};}else if(options===true){options={};}
hasOptions=!$.isEmptyObject(options);options.complete=callback;if(options.delay){element.delay(options.delay);}
if(hasOptions&&$.effects&&$.effects.effect[effectName]){element[method](options);}else if(effectName!==method&&element[effectName]){element[effectName](options.duration,options.easing,callback);}else{element.queue(function(next){$(this)[method]();if(callback){callback.call(element[0]);}
next();});}};});var widget=$.widget;(function(){var cachedScrollbarWidth,max=Math.max,abs=Math.abs,rhorizontal=/left|center|right/,rvertical=/top|center|bottom/,roffset=/[\+\-]\d+(\.[\d]+)?%?/,rposition=/^\w+/,rpercent=/%$/,_position=$.fn.position;function getOffsets(offsets,width,height){return[parseFloat(offsets[0])*(rpercent.test(offsets[0])?width/100:1),parseFloat(offsets[1])*(rpercent.test(offsets[1])?height/100:1)];}
function parseCss(element,property){return parseInt($.css(element,property),10)||0;}
function isWindow(obj){return obj!=null&&obj===obj.window;}
function getDimensions(elem){var raw=elem[0];if(raw.nodeType===9){return{width:elem.width(),height:elem.height(),offset:{top:0,left:0}};}
if(isWindow(raw)){return{width:elem.width(),height:elem.height(),offset:{top:elem.scrollTop(),left:elem.scrollLeft()}};}
if(raw.preventDefault){return{width:0,height:0,offset:{top:raw.pageY,left:raw.pageX}};}
return{width:elem.outerWidth(),height:elem.outerHeight(),offset:elem.offset()};}
$.position={scrollbarWidth:function(){if(cachedScrollbarWidth!==undefined){return cachedScrollbarWidth;}
var w1,w2,div=$("<div style="+"'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>"+"<div style='height:300px;width:auto;'></div></div>"),innerDiv=div.children()[0];$("body").append(div);w1=innerDiv.offsetWidth;div.css("overflow","scroll");w2=innerDiv.offsetWidth;if(w1===w2){w2=div[0].clientWidth;}
div.remove();return(cachedScrollbarWidth=w1-w2);},getScrollInfo:function(within){var overflowX=within.isWindow||within.isDocument?"":within.element.css("overflow-x"),overflowY=within.isWindow||within.isDocument?"":within.element.css("overflow-y"),hasOverflowX=overflowX==="scroll"||(overflowX==="auto"&&within.width<within.element[0].scrollWidth),hasOverflowY=overflowY==="scroll"||(overflowY==="auto"&&within.height<within.element[0].scrollHeight);return{width:hasOverflowY?$.position.scrollbarWidth():0,height:hasOverflowX?$.position.scrollbarWidth():0};},getWithinInfo:function(element){var withinElement=$(element||window),isElemWindow=isWindow(withinElement[0]),isDocument=!!withinElement[0]&&withinElement[0].nodeType===9,hasOffset=!isElemWindow&&!isDocument;return{element:withinElement,isWindow:isElemWindow,isDocument:isDocument,offset:hasOffset?$(element).offset():{left:0,top:0},scrollLeft:withinElement.scrollLeft(),scrollTop:withinElement.scrollTop(),width:withinElement.outerWidth(),height:withinElement.outerHeight()};}};$.fn.position=function(options){if(!options||!options.of){return _position.apply(this,arguments);}
options=$.extend({},options);var atOffset,targetWidth,targetHeight,targetOffset,basePosition,dimensions,target=typeof options.of==="string"?$(document).find(options.of):$(options.of),within=$.position.getWithinInfo(options.within),scrollInfo=$.position.getScrollInfo(within),collision=(options.collision||"flip").split(" "),offsets={};dimensions=getDimensions(target);if(target[0].preventDefault){options.at="left top";}
targetWidth=dimensions.width;targetHeight=dimensions.height;targetOffset=dimensions.offset;basePosition=$.extend({},targetOffset);$.each(["my","at"],function(){var pos=(options[this]||"").split(" "),horizontalOffset,verticalOffset;if(pos.length===1){pos=rhorizontal.test(pos[0])?pos.concat(["center"]):rvertical.test(pos[0])?["center"].concat(pos):["center","center"];}
pos[0]=rhorizontal.test(pos[0])?pos[0]:"center";pos[1]=rvertical.test(pos[1])?pos[1]:"center";horizontalOffset=roffset.exec(pos[0]);verticalOffset=roffset.exec(pos[1]);offsets[this]=[horizontalOffset?horizontalOffset[0]:0,verticalOffset?verticalOffset[0]:0];options[this]=[rposition.exec(pos[0])[0],rposition.exec(pos[1])[0]];});if(collision.length===1){collision[1]=collision[0];}
if(options.at[0]==="right"){basePosition.left+=targetWidth;}else if(options.at[0]==="center"){basePosition.left+=targetWidth/2;}
if(options.at[1]==="bottom"){basePosition.top+=targetHeight;}else if(options.at[1]==="center"){basePosition.top+=targetHeight/2;}
atOffset=getOffsets(offsets.at,targetWidth,targetHeight);basePosition.left+=atOffset[0];basePosition.top+=atOffset[1];return this.each(function(){var collisionPosition,using,elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseCss(this,"marginLeft"),marginTop=parseCss(this,"marginTop"),collisionWidth=elemWidth+marginLeft+parseCss(this,"marginRight")+
scrollInfo.width,collisionHeight=elemHeight+marginTop+parseCss(this,"marginBottom")+
scrollInfo.height,position=$.extend({},basePosition),myOffset=getOffsets(offsets.my,elem.outerWidth(),elem.outerHeight());if(options.my[0]==="right"){position.left-=elemWidth;}else if(options.my[0]==="center"){position.left-=elemWidth/2;}
if(options.my[1]==="bottom"){position.top-=elemHeight;}else if(options.my[1]==="center"){position.top-=elemHeight/2;}
position.left+=myOffset[0];position.top+=myOffset[1];collisionPosition={marginLeft:marginLeft,marginTop:marginTop};$.each(["left","top"],function(i,dir){if($.ui.position[collision[i]]){$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,collisionPosition:collisionPosition,collisionWidth:collisionWidth,collisionHeight:collisionHeight,offset:[atOffset[0]+myOffset[0],atOffset[1]+myOffset[1]],my:options.my,at:options.at,within:within,elem:elem});}});if(options.using){using=function(props){var left=targetOffset.left-position.left,right=left+targetWidth-elemWidth,top=targetOffset.top-position.top,bottom=top+targetHeight-elemHeight,feedback={target:{element:target,left:targetOffset.left,top:targetOffset.top,width:targetWidth,height:targetHeight},element:{element:elem,left:position.left,top:position.top,width:elemWidth,height:elemHeight},horizontal:right<0?"left":left>0?"right":"center",vertical:bottom<0?"top":top>0?"bottom":"middle"};if(targetWidth<elemWidth&&abs(left+right)<targetWidth){feedback.horizontal="center";}
if(targetHeight<elemHeight&&abs(top+bottom)<targetHeight){feedback.vertical="middle";}
if(max(abs(left),abs(right))>max(abs(top),abs(bottom))){feedback.important="horizontal";}else{feedback.important="vertical";}
options.using.call(this,props,feedback);};}
elem.offset($.extend(position,{using:using}));});};$.ui.position={fit:{left:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollLeft:within.offset.left,outerWidth=within.width,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=withinOffset-collisionPosLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-withinOffset,newOverRight;if(data.collisionWidth>outerWidth){if(overLeft>0&&overRight<=0){newOverRight=position.left+overLeft+data.collisionWidth-outerWidth-
withinOffset;position.left+=overLeft-newOverRight;}else if(overRight>0&&overLeft<=0){position.left=withinOffset;}else{if(overLeft>overRight){position.left=withinOffset+outerWidth-data.collisionWidth;}else{position.left=withinOffset;}}}else if(overLeft>0){position.left+=overLeft;}else if(overRight>0){position.left-=overRight;}else{position.left=max(position.left-collisionPosLeft,position.left);}},top:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollTop:within.offset.top,outerHeight=data.within.height,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=withinOffset-collisionPosTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-withinOffset,newOverBottom;if(data.collisionHeight>outerHeight){if(overTop>0&&overBottom<=0){newOverBottom=position.top+overTop+data.collisionHeight-outerHeight-
withinOffset;position.top+=overTop-newOverBottom;}else if(overBottom>0&&overTop<=0){position.top=withinOffset;}else{if(overTop>overBottom){position.top=withinOffset+outerHeight-data.collisionHeight;}else{position.top=withinOffset;}}}else if(overTop>0){position.top+=overTop;}else if(overBottom>0){position.top-=overBottom;}else{position.top=max(position.top-collisionPosTop,position.top);}}},flip:{left:function(position,data){var within=data.within,withinOffset=within.offset.left+within.scrollLeft,outerWidth=within.width,offsetLeft=within.isWindow?within.scrollLeft:within.offset.left,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=collisionPosLeft-offsetLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-offsetLeft,myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:data.at[0]==="right"?-data.targetWidth:0,offset=-2*data.offset[0],newOverRight,newOverLeft;if(overLeft<0){newOverRight=position.left+myOffset+atOffset+offset+data.collisionWidth-
outerWidth-withinOffset;if(newOverRight<0||newOverRight<abs(overLeft)){position.left+=myOffset+atOffset+offset;}}else if(overRight>0){newOverLeft=position.left-data.collisionPosition.marginLeft+myOffset+
atOffset+offset-offsetLeft;if(newOverLeft>0||abs(newOverLeft)<overRight){position.left+=myOffset+atOffset+offset;}}},top:function(position,data){var within=data.within,withinOffset=within.offset.top+within.scrollTop,outerHeight=within.height,offsetTop=within.isWindow?within.scrollTop:within.offset.top,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=collisionPosTop-offsetTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-offsetTop,top=data.my[1]==="top",myOffset=top?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:data.at[1]==="bottom"?-data.targetHeight:0,offset=-2*data.offset[1],newOverTop,newOverBottom;if(overTop<0){newOverBottom=position.top+myOffset+atOffset+offset+data.collisionHeight-
outerHeight-withinOffset;if(newOverBottom<0||newOverBottom<abs(overTop)){position.top+=myOffset+atOffset+offset;}}else if(overBottom>0){newOverTop=position.top-data.collisionPosition.marginTop+myOffset+atOffset+
offset-offsetTop;if(newOverTop>0||abs(newOverTop)<overBottom){position.top+=myOffset+atOffset+offset;}}}},flipfit:{left:function(){$.ui.position.flip.left.apply(this,arguments);$.ui.position.fit.left.apply(this,arguments);},top:function(){$.ui.position.flip.top.apply(this,arguments);$.ui.position.fit.top.apply(this,arguments);}}};})();var position=$.ui.position;var data=$.extend($.expr.pseudos,{data:$.expr.createPseudo?$.expr.createPseudo(function(dataName){return function(elem){return!!$.data(elem,dataName);};}):function(elem,i,match){return!!$.data(elem,match[3]);}});var disableSelection=$.fn.extend({disableSelection:(function(){var eventType="onselectstart" in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(eventType+".ui-disableSelection",function(event){event.preventDefault();});};})(),enableSelection:function(){return this.off(".ui-disableSelection");}});var jQuery=$;var stepHooks="backgroundColor borderBottomColor borderLeftColor borderRightColor "+"borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",class2type={},toString=class2type.toString,rplusequals=/^([\-+])=\s*(\d+\.?\d*)/,stringParsers=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(execResult){return[execResult[1],execResult[2],execResult[3],execResult[4]];}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(execResult){return[execResult[1]*2.55,execResult[2]*2.55,execResult[3]*2.55,execResult[4]];}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,parse:function(execResult){return[parseInt(execResult[1],16),parseInt(execResult[2],16),parseInt(execResult[3],16),execResult[4]?(parseInt(execResult[4],16)/255).toFixed(2):1];}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,parse:function(execResult){return[parseInt(execResult[1]+execResult[1],16),parseInt(execResult[2]+execResult[2],16),parseInt(execResult[3]+execResult[3],16),execResult[4]?(parseInt(execResult[4]+execResult[4],16)/255).toFixed(2):1];}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(execResult){return[execResult[1],execResult[2]/100,execResult[3]/100,execResult[4]];}}],color=jQuery.Color=function(color,green,blue,alpha){return new jQuery.Color.fn.parse(color,green,blue,alpha);},spaces={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},propTypes={"byte":{floor:true,max:255},"percent":{max:1},"degrees":{mod:360,floor:true}},support=color.support={},supportElem=jQuery("<p>")[0],colors,each=jQuery.each;supportElem.style.cssText="background-color:rgba(1,1,1,.5)";support.rgba=supportElem.style.backgroundColor.indexOf("rgba")>-1;each(spaces,function(spaceName,space){space.cache="_"+spaceName;space.props.alpha={idx:3,type:"percent",def:1};});jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(_i,name){class2type["[object "+name+"]"]=name.toLowerCase();});function getType(obj){if(obj==null){return obj+"";}
return typeof obj==="object"?class2type[toString.call(obj)]||"object":typeof obj;}
function clamp(value,prop,allowEmpty){var type=propTypes[prop.type]||{};if(value==null){return(allowEmpty||!prop.def)?null:prop.def;}
value=type.floor?~~value:parseFloat(value);if(isNaN(value)){return prop.def;}
if(type.mod){return(value+type.mod)%type.mod;}
return Math.min(type.max,Math.max(0,value));}
function stringParse(string){var inst=color(),rgba=inst._rgba=[];string=string.toLowerCase();each(stringParsers,function(_i,parser){var parsed,match=parser.re.exec(string),values=match&&parser.parse(match),spaceName=parser.space||"rgba";if(values){parsed=inst[spaceName](values);inst[spaces[spaceName].cache]=parsed[spaces[spaceName].cache];rgba=inst._rgba=parsed._rgba;return false;}});if(rgba.length){if(rgba.join()==="0,0,0,0"){jQuery.extend(rgba,colors.transparent);}
return inst;}
return colors[string];}
color.fn=jQuery.extend(color.prototype,{parse:function(red,green,blue,alpha){if(red===undefined){this._rgba=[null,null,null,null];return this;}
if(red.jquery||red.nodeType){red=jQuery(red).css(green);green=undefined;}
var inst=this,type=getType(red),rgba=this._rgba=[];if(green!==undefined){red=[red,green,blue,alpha];type="array";}
if(type==="string"){return this.parse(stringParse(red)||colors._default);}
if(type==="array"){each(spaces.rgba.props,function(_key,prop){rgba[prop.idx]=clamp(red[prop.idx],prop);});return this;}
if(type==="object"){if(red instanceof color){each(spaces,function(_spaceName,space){if(red[space.cache]){inst[space.cache]=red[space.cache].slice();}});}else{each(spaces,function(_spaceName,space){var cache=space.cache;each(space.props,function(key,prop){if(!inst[cache]&&space.to){if(key==="alpha"||red[key]==null){return;}
inst[cache]=space.to(inst._rgba);}
inst[cache][prop.idx]=clamp(red[key],prop,true);});if(inst[cache]&&jQuery.inArray(null,inst[cache].slice(0,3))<0){if(inst[cache][3]==null){inst[cache][3]=1;}
if(space.from){inst._rgba=space.from(inst[cache]);}}});}
return this;}},is:function(compare){var is=color(compare),same=true,inst=this;each(spaces,function(_,space){var localCache,isCache=is[space.cache];if(isCache){localCache=inst[space.cache]||space.to&&space.to(inst._rgba)||[];each(space.props,function(_,prop){if(isCache[prop.idx]!=null){same=(isCache[prop.idx]===localCache[prop.idx]);return same;}});}
return same;});return same;},_space:function(){var used=[],inst=this;each(spaces,function(spaceName,space){if(inst[space.cache]){used.push(spaceName);}});return used.pop();},transition:function(other,distance){var end=color(other),spaceName=end._space(),space=spaces[spaceName],startColor=this.alpha()===0?color("transparent"):this,start=startColor[space.cache]||space.to(startColor._rgba),result=start.slice();end=end[space.cache];each(space.props,function(_key,prop){var index=prop.idx,startValue=start[index],endValue=end[index],type=propTypes[prop.type]||{};if(endValue===null){return;}
if(startValue===null){result[index]=endValue;}else{if(type.mod){if(endValue-startValue>type.mod/2){startValue+=type.mod;}else if(startValue-endValue>type.mod/2){startValue-=type.mod;}}
result[index]=clamp((endValue-startValue)*distance+startValue,prop);}});return this[spaceName](result);},blend:function(opaque){if(this._rgba[3]===1){return this;}
var rgb=this._rgba.slice(),a=rgb.pop(),blend=color(opaque)._rgba;return color(jQuery.map(rgb,function(v,i){return(1-a)*blend[i]+a*v;}));},toRgbaString:function(){var prefix="rgba(",rgba=jQuery.map(this._rgba,function(v,i){if(v!=null){return v;}
return i>2?1:0;});if(rgba[3]===1){rgba.pop();prefix="rgb(";}
return prefix+rgba.join()+")";},toHslaString:function(){var prefix="hsla(",hsla=jQuery.map(this.hsla(),function(v,i){if(v==null){v=i>2?1:0;}
if(i&&i<3){v=Math.round(v*100)+"%";}
return v;});if(hsla[3]===1){hsla.pop();prefix="hsl(";}
return prefix+hsla.join()+")";},toHexString:function(includeAlpha){var rgba=this._rgba.slice(),alpha=rgba.pop();if(includeAlpha){rgba.push(~~(alpha*255));}
return"#"+jQuery.map(rgba,function(v){v=(v||0).toString(16);return v.length===1?"0"+v:v;}).join("");},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString();}});color.fn.parse.prototype=color.fn;function hue2rgb(p,q,h){h=(h+1)%1;if(h*6<1){return p+(q-p)*h*6;}
if(h*2<1){return q;}
if(h*3<2){return p+(q-p)*((2/3)-h)*6;}
return p;}
spaces.hsla.to=function(rgba){if(rgba[0]==null||rgba[1]==null||rgba[2]==null){return[null,null,null,rgba[3]];}
var r=rgba[0]/255,g=rgba[1]/255,b=rgba[2]/255,a=rgba[3],max=Math.max(r,g,b),min=Math.min(r,g,b),diff=max-min,add=max+min,l=add*0.5,h,s;if(min===max){h=0;}else if(r===max){h=(60*(g-b)/diff)+360;}else if(g===max){h=(60*(b-r)/diff)+120;}else{h=(60*(r-g)/diff)+240;}
if(diff===0){s=0;}else if(l<=0.5){s=diff/add;}else{s=diff/(2-add);}
return[Math.round(h)%360,s,l,a==null?1:a];};spaces.hsla.from=function(hsla){if(hsla[0]==null||hsla[1]==null||hsla[2]==null){return[null,null,null,hsla[3]];}
var h=hsla[0]/360,s=hsla[1],l=hsla[2],a=hsla[3],q=l<=0.5?l*(1+s):l+s-l*s,p=2*l-q;return[Math.round(hue2rgb(p,q,h+(1/3))*255),Math.round(hue2rgb(p,q,h)*255),Math.round(hue2rgb(p,q,h-(1/3))*255),a];};each(spaces,function(spaceName,space){var props=space.props,cache=space.cache,to=space.to,from=space.from;color.fn[spaceName]=function(value){if(to&&!this[cache]){this[cache]=to(this._rgba);}
if(value===undefined){return this[cache].slice();}
var ret,type=getType(value),arr=(type==="array"||type==="object")?value:arguments,local=this[cache].slice();each(props,function(key,prop){var val=arr[type==="object"?key:prop.idx];if(val==null){val=local[prop.idx];}
local[prop.idx]=clamp(val,prop);});if(from){ret=color(from(local));ret[cache]=local;return ret;}else{return color(local);}};each(props,function(key,prop){if(color.fn[key]){return;}
color.fn[key]=function(value){var local,cur,match,fn,vtype=getType(value);if(key==="alpha"){fn=this._hsla?"hsla":"rgba";}else{fn=spaceName;}
local=this[fn]();cur=local[prop.idx];if(vtype==="undefined"){return cur;}
if(vtype==="function"){value=value.call(this,cur);vtype=getType(value);}
if(value==null&&prop.empty){return this;}
if(vtype==="string"){match=rplusequals.exec(value);if(match){value=cur+parseFloat(match[2])*(match[1]==="+"?1:-1);}}
local[prop.idx]=value;return this[fn](local);};});});color.hook=function(hook){var hooks=hook.split(" ");each(hooks,function(_i,hook){jQuery.cssHooks[hook]={set:function(elem,value){var parsed,curElem,backgroundColor="";if(value!=="transparent"&&(getType(value)!=="string"||(parsed=stringParse(value)))){value=color(parsed||value);if(!support.rgba&&value._rgba[3]!==1){curElem=hook==="backgroundColor"?elem.parentNode:elem;while((backgroundColor===""||backgroundColor==="transparent")&&curElem&&curElem.style){try{backgroundColor=jQuery.css(curElem,"backgroundColor");curElem=curElem.parentNode;}catch(e){}}
value=value.blend(backgroundColor&&backgroundColor!=="transparent"?backgroundColor:"_default");}
value=value.toRgbaString();}
try{elem.style[hook]=value;}catch(e){}}};jQuery.fx.step[hook]=function(fx){if(!fx.colorInit){fx.start=color(fx.elem,hook);fx.end=color(fx.end);fx.colorInit=true;}
jQuery.cssHooks[hook].set(fx.elem,fx.start.transition(fx.end,fx.pos));};});};color.hook(stepHooks);jQuery.cssHooks.borderColor={expand:function(value){var expanded={};each(["Top","Right","Bottom","Left"],function(_i,part){expanded["border"+part+"Color"]=value;});return expanded;}};colors=jQuery.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"};var dataSpace="ui-effects-",dataSpaceStyle="ui-effects-style",dataSpaceAnimated="ui-effects-animated";$.effects={effect:{}};(function(){var classAnimationActions=["add","remove","toggle"],shorthandStyles={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};$.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(_,prop){$.fx.step[prop]=function(fx){if(fx.end!=="none"&&!fx.setAttr||fx.pos===1&&!fx.setAttr){jQuery.style(fx.elem,prop,fx.end);fx.setAttr=true;}};});function camelCase(string){return string.replace(/-([\da-z])/gi,function(all,letter){return letter.toUpperCase();});}
function getElementStyles(elem){var key,len,style=elem.ownerDocument.defaultView?elem.ownerDocument.defaultView.getComputedStyle(elem,null):elem.currentStyle,styles={};if(style&&style.length&&style[0]&&style[style[0]]){len=style.length;while(len--){key=style[len];if(typeof style[key]==="string"){styles[camelCase(key)]=style[key];}}}else{for(key in style){if(typeof style[key]==="string"){styles[key]=style[key];}}}
return styles;}
function styleDifference(oldStyle,newStyle){var diff={},name,value;for(name in newStyle){value=newStyle[name];if(oldStyle[name]!==value){if(!shorthandStyles[name]){if($.fx.step[name]||!isNaN(parseFloat(value))){diff[name]=value;}}}}
return diff;}
if(!$.fn.addBack){$.fn.addBack=function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector));};}
$.effects.animateClass=function(value,duration,easing,callback){var o=$.speed(duration,easing,callback);return this.queue(function(){var animated=$(this),baseClass=animated.attr("class")||"",applyClassChange,allAnimations=o.children?animated.find("*").addBack():animated;allAnimations=allAnimations.map(function(){var el=$(this);return{el:el,start:getElementStyles(this)};});applyClassChange=function(){$.each(classAnimationActions,function(i,action){if(value[action]){animated[action+"Class"](value[action]);}});};applyClassChange();allAnimations=allAnimations.map(function(){this.end=getElementStyles(this.el[0]);this.diff=styleDifference(this.start,this.end);return this;});animated.attr("class",baseClass);allAnimations=allAnimations.map(function(){var styleInfo=this,dfd=$.Deferred(),opts=$.extend({},o,{queue:false,complete:function(){dfd.resolve(styleInfo);}});this.el.animate(this.diff,opts);return dfd.promise();});$.when.apply($,allAnimations.get()).done(function(){applyClassChange();$.each(arguments,function(){var el=this.el;$.each(this.diff,function(key){el.css(key,"");});});o.complete.call(animated[0]);});});};$.fn.extend({addClass:(function(orig){return function(classNames,speed,easing,callback){return speed?$.effects.animateClass.call(this,{add:classNames},speed,easing,callback):orig.apply(this,arguments);};})($.fn.addClass),removeClass:(function(orig){return function(classNames,speed,easing,callback){return arguments.length>1?$.effects.animateClass.call(this,{remove:classNames},speed,easing,callback):orig.apply(this,arguments);};})($.fn.removeClass),toggleClass:(function(orig){return function(classNames,force,speed,easing,callback){if(typeof force==="boolean"||force===undefined){if(!speed){return orig.apply(this,arguments);}else{return $.effects.animateClass.call(this,(force?{add:classNames}:{remove:classNames}),speed,easing,callback);}}else{return $.effects.animateClass.call(this,{toggle:classNames},force,speed,easing);}};})($.fn.toggleClass),switchClass:function(remove,add,speed,easing,callback){return $.effects.animateClass.call(this,{add:add,remove:remove},speed,easing,callback);}});})();(function(){if($.expr&&$.expr.pseudos&&$.expr.pseudos.animated){$.expr.pseudos.animated=(function(orig){return function(elem){return!!$(elem).data(dataSpaceAnimated)||orig(elem);};})($.expr.pseudos.animated);}
if($.uiBackCompat!==false){$.extend($.effects,{save:function(element,set){var i=0,length=set.length;for(;i<length;i++){if(set[i]!==null){element.data(dataSpace+set[i],element[0].style[set[i]]);}}},restore:function(element,set){var val,i=0,length=set.length;for(;i<length;i++){if(set[i]!==null){val=element.data(dataSpace+set[i]);element.css(set[i],val);}}},setMode:function(el,mode){if(mode==="toggle"){mode=el.is(":hidden")?"show":"hide";}
return mode;},createWrapper:function(element){if(element.parent().is(".ui-effects-wrapper")){return element.parent();}
var props={width:element.outerWidth(true),height:element.outerHeight(true),"float":element.css("float")},wrapper=$("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),size={width:element.width(),height:element.height()},active=document.activeElement;try{active.id;}catch(e){active=document.body;}
element.wrap(wrapper);if(element[0]===active||$.contains(element[0],active)){$(active).trigger("focus");}
wrapper=element.parent();if(element.css("position")==="static"){wrapper.css({position:"relative"});element.css({position:"relative"});}else{$.extend(props,{position:element.css("position"),zIndex:element.css("z-index")});$.each(["top","left","bottom","right"],function(i,pos){props[pos]=element.css(pos);if(isNaN(parseInt(props[pos],10))){props[pos]="auto";}});element.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"});}
element.css(size);return wrapper.css(props).show();},removeWrapper:function(element){var active=document.activeElement;if(element.parent().is(".ui-effects-wrapper")){element.parent().replaceWith(element);if(element[0]===active||$.contains(element[0],active)){$(active).trigger("focus");}}
return element;}});}
$.extend($.effects,{version:"1.13.2",define:function(name,mode,effect){if(!effect){effect=mode;mode="effect";}
$.effects.effect[name]=effect;$.effects.effect[name].mode=mode;return effect;},scaledDimensions:function(element,percent,direction){if(percent===0){return{height:0,width:0,outerHeight:0,outerWidth:0};}
var x=direction!=="horizontal"?((percent||100)/100):1,y=direction!=="vertical"?((percent||100)/100):1;return{height:element.height()*y,width:element.width()*x,outerHeight:element.outerHeight()*y,outerWidth:element.outerWidth()*x};},clipToBox:function(animation){return{width:animation.clip.right-animation.clip.left,height:animation.clip.bottom-animation.clip.top,left:animation.clip.left,top:animation.clip.top};},unshift:function(element,queueLength,count){var queue=element.queue();if(queueLength>1){queue.splice.apply(queue,[1,0].concat(queue.splice(queueLength,count)));}
element.dequeue();},saveStyle:function(element){element.data(dataSpaceStyle,element[0].style.cssText);},restoreStyle:function(element){element[0].style.cssText=element.data(dataSpaceStyle)||"";element.removeData(dataSpaceStyle);},mode:function(element,mode){var hidden=element.is(":hidden");if(mode==="toggle"){mode=hidden?"show":"hide";}
if(hidden?mode==="hide":mode==="show"){mode="none";}
return mode;},getBaseline:function(origin,original){var y,x;switch(origin[0]){case"top":y=0;break;case"middle":y=0.5;break;case"bottom":y=1;break;default:y=origin[0]/original.height;}
switch(origin[1]){case"left":x=0;break;case"center":x=0.5;break;case"right":x=1;break;default:x=origin[1]/original.width;}
return{x:x,y:y};},createPlaceholder:function(element){var placeholder,cssPosition=element.css("position"),position=element.position();element.css({marginTop:element.css("marginTop"),marginBottom:element.css("marginBottom"),marginLeft:element.css("marginLeft"),marginRight:element.css("marginRight")}).outerWidth(element.outerWidth()).outerHeight(element.outerHeight());if(/^(static|relative)/.test(cssPosition)){cssPosition="absolute";placeholder=$("<"+element[0].nodeName+">").insertAfter(element).css({display:/^(inline|ruby)/.test(element.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:element.css("marginTop"),marginBottom:element.css("marginBottom"),marginLeft:element.css("marginLeft"),marginRight:element.css("marginRight"),"float":element.css("float")}).outerWidth(element.outerWidth()).outerHeight(element.outerHeight()).addClass("ui-effects-placeholder");element.data(dataSpace+"placeholder",placeholder);}
element.css({position:cssPosition,left:position.left,top:position.top});return placeholder;},removePlaceholder:function(element){var dataKey=dataSpace+"placeholder",placeholder=element.data(dataKey);if(placeholder){placeholder.remove();element.removeData(dataKey);}},cleanUp:function(element){$.effects.restoreStyle(element);$.effects.removePlaceholder(element);},setTransition:function(element,list,factor,value){value=value||{};$.each(list,function(i,x){var unit=element.cssUnit(x);if(unit[0]>0){value[x]=unit[0]*factor+unit[1];}});return value;}});function _normalizeArguments(effect,options,speed,callback){if($.isPlainObject(effect)){options=effect;effect=effect.effect;}
effect={effect:effect};if(options==null){options={};}
if(typeof options==="function"){callback=options;speed=null;options={};}
if(typeof options==="number"||$.fx.speeds[options]){callback=speed;speed=options;options={};}
if(typeof speed==="function"){callback=speed;speed=null;}
if(options){$.extend(effect,options);}
speed=speed||options.duration;effect.duration=$.fx.off?0:typeof speed==="number"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;effect.complete=callback||options.complete;return effect;}
function standardAnimationOption(option){if(!option||typeof option==="number"||$.fx.speeds[option]){return true;}
if(typeof option==="string"&&!$.effects.effect[option]){return true;}
if(typeof option==="function"){return true;}
if(typeof option==="object"&&!option.effect){return true;}
return false;}
$.fn.extend({effect:function(){var args=_normalizeArguments.apply(this,arguments),effectMethod=$.effects.effect[args.effect],defaultMode=effectMethod.mode,queue=args.queue,queueName=queue||"fx",complete=args.complete,mode=args.mode,modes=[],prefilter=function(next){var el=$(this),normalizedMode=$.effects.mode(el,mode)||defaultMode;el.data(dataSpaceAnimated,true);modes.push(normalizedMode);if(defaultMode&&(normalizedMode==="show"||(normalizedMode===defaultMode&&normalizedMode==="hide"))){el.show();}
if(!defaultMode||normalizedMode!=="none"){$.effects.saveStyle(el);}
if(typeof next==="function"){next();}};if($.fx.off||!effectMethod){if(mode){return this[mode](args.duration,complete);}else{return this.each(function(){if(complete){complete.call(this);}});}}
function run(next){var elem=$(this);function cleanup(){elem.removeData(dataSpaceAnimated);$.effects.cleanUp(elem);if(args.mode==="hide"){elem.hide();}
done();}
function done(){if(typeof complete==="function"){complete.call(elem[0]);}
if(typeof next==="function"){next();}}
args.mode=modes.shift();if($.uiBackCompat!==false&&!defaultMode){if(elem.is(":hidden")?mode==="hide":mode==="show"){elem[mode]();done();}else{effectMethod.call(elem[0],args,done);}}else{if(args.mode==="none"){elem[mode]();done();}else{effectMethod.call(elem[0],args,cleanup);}}}
return queue===false?this.each(prefilter).each(run):this.queue(queueName,prefilter).queue(queueName,run);},show:(function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments);}else{var args=_normalizeArguments.apply(this,arguments);args.mode="show";return this.effect.call(this,args);}};})($.fn.show),hide:(function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments);}else{var args=_normalizeArguments.apply(this,arguments);args.mode="hide";return this.effect.call(this,args);}};})($.fn.hide),toggle:(function(orig){return function(option){if(standardAnimationOption(option)||typeof option==="boolean"){return orig.apply(this,arguments);}else{var args=_normalizeArguments.apply(this,arguments);args.mode="toggle";return this.effect.call(this,args);}};})($.fn.toggle),cssUnit:function(key){var style=this.css(key),val=[];$.each(["em","px","%","pt"],function(i,unit){if(style.indexOf(unit)>0){val=[parseFloat(style),unit];}});return val;},cssClip:function(clipObj){if(clipObj){return this.css("clip","rect("+clipObj.top+"px "+clipObj.right+"px "+
clipObj.bottom+"px "+clipObj.left+"px)");}
return parseClip(this.css("clip"),this);},transfer:function(options,done){var element=$(this),target=$(options.to),targetFixed=target.css("position")==="fixed",body=$("body"),fixTop=targetFixed?body.scrollTop():0,fixLeft=targetFixed?body.scrollLeft():0,endPosition=target.offset(),animation={top:endPosition.top-fixTop,left:endPosition.left-fixLeft,height:target.innerHeight(),width:target.innerWidth()},startPosition=element.offset(),transfer=$("<div class='ui-effects-transfer'></div>");transfer.appendTo("body").addClass(options.className).css({top:startPosition.top-fixTop,left:startPosition.left-fixLeft,height:element.innerHeight(),width:element.innerWidth(),position:targetFixed?"fixed":"absolute"}).animate(animation,options.duration,options.easing,function(){transfer.remove();if(typeof done==="function"){done();}});}});function parseClip(str,element){var outerWidth=element.outerWidth(),outerHeight=element.outerHeight(),clipRegex=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,values=clipRegex.exec(str)||["",0,outerWidth,outerHeight,0];return{top:parseFloat(values[1])||0,right:values[2]==="auto"?outerWidth:parseFloat(values[2]),bottom:values[3]==="auto"?outerHeight:parseFloat(values[3]),left:parseFloat(values[4])||0};}
$.fx.step.clip=function(fx){if(!fx.clipInit){fx.start=$(fx.elem).cssClip();if(typeof fx.end==="string"){fx.end=parseClip(fx.end,fx.elem);}
fx.clipInit=true;}
$(fx.elem).cssClip({top:fx.pos*(fx.end.top-fx.start.top)+fx.start.top,right:fx.pos*(fx.end.right-fx.start.right)+fx.start.right,bottom:fx.pos*(fx.end.bottom-fx.start.bottom)+fx.start.bottom,left:fx.pos*(fx.end.left-fx.start.left)+fx.start.left});};})();(function(){var baseEasings={};$.each(["Quad","Cubic","Quart","Quint","Expo"],function(i,name){baseEasings[name]=function(p){return Math.pow(p,i+2);};});$.extend(baseEasings,{Sine:function(p){return 1-Math.cos(p*Math.PI/2);},Circ:function(p){return 1-Math.sqrt(1-p*p);},Elastic:function(p){return p===0||p===1?p:-Math.pow(2,8*(p-1))*Math.sin(((p-1)*80-7.5)*Math.PI/15);},Back:function(p){return p*p*(3*p-2);},Bounce:function(p){var pow2,bounce=4;while(p<((pow2=Math.pow(2,--bounce))-1)/11){}
return 1/Math.pow(4,3-bounce)-7.5625*Math.pow((pow2*3-2)/22-p,2);}});$.each(baseEasings,function(name,easeIn){$.easing["easeIn"+name]=easeIn;$.easing["easeOut"+name]=function(p){return 1-easeIn(1-p);};$.easing["easeInOut"+name]=function(p){return p<0.5?easeIn(p*2)/2:1-easeIn(p* -2+2)/2;};});})();var effect=$.effects;var effectsEffectBlind=$.effects.define("blind","hide",function(options,done){var map={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},element=$(this),direction=options.direction||"up",start=element.cssClip(),animate={clip:$.extend({},start)},placeholder=$.effects.createPlaceholder(element);animate.clip[map[direction][0]]=animate.clip[map[direction][1]];if(options.mode==="show"){element.cssClip(animate.clip);if(placeholder){placeholder.css($.effects.clipToBox(animate));}
animate.clip=start;}
if(placeholder){placeholder.animate($.effects.clipToBox(animate),options.duration,options.easing);}
element.animate(animate,{queue:false,duration:options.duration,easing:options.easing,complete:done});});var effectsEffectBounce=$.effects.define("bounce",function(options,done){var upAnim,downAnim,refValue,element=$(this),mode=options.mode,hide=mode==="hide",show=mode==="show",direction=options.direction||"up",distance=options.distance,times=options.times||5,anims=times*2+(show||hide?1:0),speed=options.duration/anims,easing=options.easing,ref=(direction==="up"||direction==="down")?"top":"left",motion=(direction==="up"||direction==="left"),i=0,queuelen=element.queue().length;$.effects.createPlaceholder(element);refValue=element.css(ref);if(!distance){distance=element[ref==="top"?"outerHeight":"outerWidth"]()/3;}
if(show){downAnim={opacity:1};downAnim[ref]=refValue;element.css("opacity",0).css(ref,motion?-distance*2:distance*2).animate(downAnim,speed,easing);}
if(hide){distance=distance/Math.pow(2,times-1);}
downAnim={};downAnim[ref]=refValue;for(;i<times;i++){upAnim={};upAnim[ref]=(motion?"-=":"+=")+distance;element.animate(upAnim,speed,easing).animate(downAnim,speed,easing);distance=hide?distance*2:distance/2;}
if(hide){upAnim={opacity:0};upAnim[ref]=(motion?"-=":"+=")+distance;element.animate(upAnim,speed,easing);}
element.queue(done);$.effects.unshift(element,queuelen,anims+1);});var effectsEffectClip=$.effects.define("clip","hide",function(options,done){var start,animate={},element=$(this),direction=options.direction||"vertical",both=direction==="both",horizontal=both||direction==="horizontal",vertical=both||direction==="vertical";start=element.cssClip();animate.clip={top:vertical?(start.bottom-start.top)/2:start.top,right:horizontal?(start.right-start.left)/2:start.right,bottom:vertical?(start.bottom-start.top)/2:start.bottom,left:horizontal?(start.right-start.left)/2:start.left};$.effects.createPlaceholder(element);if(options.mode==="show"){element.cssClip(animate.clip);animate.clip=start;}
element.animate(animate,{queue:false,duration:options.duration,easing:options.easing,complete:done});});var effectsEffectDrop=$.effects.define("drop","hide",function(options,done){var distance,element=$(this),mode=options.mode,show=mode==="show",direction=options.direction||"left",ref=(direction==="up"||direction==="down")?"top":"left",motion=(direction==="up"||direction==="left")?"-=":"+=",oppositeMotion=(motion==="+=")?"-=":"+=",animation={opacity:0};$.effects.createPlaceholder(element);distance=options.distance||element[ref==="top"?"outerHeight":"outerWidth"](true)/2;animation[ref]=motion+distance;if(show){element.css(animation);animation[ref]=oppositeMotion+distance;animation.opacity=1;}
element.animate(animation,{queue:false,duration:options.duration,easing:options.easing,complete:done});});var effectsEffectExplode=$.effects.define("explode","hide",function(options,done){var i,j,left,top,mx,my,rows=options.pieces?Math.round(Math.sqrt(options.pieces)):3,cells=rows,element=$(this),mode=options.mode,show=mode==="show",offset=element.show().css("visibility","hidden").offset(),width=Math.ceil(element.outerWidth()/cells),height=Math.ceil(element.outerHeight()/rows),pieces=[];function childComplete(){pieces.push(this);if(pieces.length===rows*cells){animComplete();}}
for(i=0;i<rows;i++){top=offset.top+i*height;my=i-(rows-1)/2;for(j=0;j<cells;j++){left=offset.left+j*width;mx=j-(cells-1)/2;element.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-j*width,top:-i*height}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:width,height:height,left:left+(show?mx*width:0),top:top+(show?my*height:0),opacity:show?0:1}).animate({left:left+(show?0:mx*width),top:top+(show?0:my*height),opacity:show?1:0},options.duration||500,options.easing,childComplete);}}
function animComplete(){element.css({visibility:"visible"});$(pieces).remove();done();}});var effectsEffectFade=$.effects.define("fade","toggle",function(options,done){var show=options.mode==="show";$(this).css("opacity",show?0:1).animate({opacity:show?1:0},{queue:false,duration:options.duration,easing:options.easing,complete:done});});var effectsEffectFold=$.effects.define("fold","hide",function(options,done){var element=$(this),mode=options.mode,show=mode==="show",hide=mode==="hide",size=options.size||15,percent=/([0-9]+)%/.exec(size),horizFirst=!!options.horizFirst,ref=horizFirst?["right","bottom"]:["bottom","right"],duration=options.duration/2,placeholder=$.effects.createPlaceholder(element),start=element.cssClip(),animation1={clip:$.extend({},start)},animation2={clip:$.extend({},start)},distance=[start[ref[0]],start[ref[1]]],queuelen=element.queue().length;if(percent){size=parseInt(percent[1],10)/100*distance[hide?0:1];}
animation1.clip[ref[0]]=size;animation2.clip[ref[0]]=size;animation2.clip[ref[1]]=0;if(show){element.cssClip(animation2.clip);if(placeholder){placeholder.css($.effects.clipToBox(animation2));}
animation2.clip=start;}
element.queue(function(next){if(placeholder){placeholder.animate($.effects.clipToBox(animation1),duration,options.easing).animate($.effects.clipToBox(animation2),duration,options.easing);}
next();}).animate(animation1,duration,options.easing).animate(animation2,duration,options.easing).queue(done);$.effects.unshift(element,queuelen,4);});var effectsEffectHighlight=$.effects.define("highlight","show",function(options,done){var element=$(this),animation={backgroundColor:element.css("backgroundColor")};if(options.mode==="hide"){animation.opacity=0;}
$.effects.saveStyle(element);element.css({backgroundImage:"none",backgroundColor:options.color||"#ffff99"}).animate(animation,{queue:false,duration:options.duration,easing:options.easing,complete:done});});var effectsEffectSize=$.effects.define("size",function(options,done){var baseline,factor,temp,element=$(this),cProps=["fontSize"],vProps=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],hProps=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],mode=options.mode,restore=mode!=="effect",scale=options.scale||"both",origin=options.origin||["middle","center"],position=element.css("position"),pos=element.position(),original=$.effects.scaledDimensions(element),from=options.from||original,to=options.to||$.effects.scaledDimensions(element,0);$.effects.createPlaceholder(element);if(mode==="show"){temp=from;from=to;to=temp;}
factor={from:{y:from.height/original.height,x:from.width/original.width},to:{y:to.height/original.height,x:to.width/original.width}};if(scale==="box"||scale==="both"){if(factor.from.y!==factor.to.y){from=$.effects.setTransition(element,vProps,factor.from.y,from);to=$.effects.setTransition(element,vProps,factor.to.y,to);}
if(factor.from.x!==factor.to.x){from=$.effects.setTransition(element,hProps,factor.from.x,from);to=$.effects.setTransition(element,hProps,factor.to.x,to);}}
if(scale==="content"||scale==="both"){if(factor.from.y!==factor.to.y){from=$.effects.setTransition(element,cProps,factor.from.y,from);to=$.effects.setTransition(element,cProps,factor.to.y,to);}}
if(origin){baseline=$.effects.getBaseline(origin,original);from.top=(original.outerHeight-from.outerHeight)*baseline.y+pos.top;from.left=(original.outerWidth-from.outerWidth)*baseline.x+pos.left;to.top=(original.outerHeight-to.outerHeight)*baseline.y+pos.top;to.left=(original.outerWidth-to.outerWidth)*baseline.x+pos.left;}
delete from.outerHeight;delete from.outerWidth;element.css(from);if(scale==="content"||scale==="both"){vProps=vProps.concat(["marginTop","marginBottom"]).concat(cProps);hProps=hProps.concat(["marginLeft","marginRight"]);element.find("*[width]").each(function(){var child=$(this),childOriginal=$.effects.scaledDimensions(child),childFrom={height:childOriginal.height*factor.from.y,width:childOriginal.width*factor.from.x,outerHeight:childOriginal.outerHeight*factor.from.y,outerWidth:childOriginal.outerWidth*factor.from.x},childTo={height:childOriginal.height*factor.to.y,width:childOriginal.width*factor.to.x,outerHeight:childOriginal.height*factor.to.y,outerWidth:childOriginal.width*factor.to.x};if(factor.from.y!==factor.to.y){childFrom=$.effects.setTransition(child,vProps,factor.from.y,childFrom);childTo=$.effects.setTransition(child,vProps,factor.to.y,childTo);}
if(factor.from.x!==factor.to.x){childFrom=$.effects.setTransition(child,hProps,factor.from.x,childFrom);childTo=$.effects.setTransition(child,hProps,factor.to.x,childTo);}
if(restore){$.effects.saveStyle(child);}
child.css(childFrom);child.animate(childTo,options.duration,options.easing,function(){if(restore){$.effects.restoreStyle(child);}});});}
element.animate(to,{queue:false,duration:options.duration,easing:options.easing,complete:function(){var offset=element.offset();if(to.opacity===0){element.css("opacity",from.opacity);}
if(!restore){element.css("position",position==="static"?"relative":position).offset(offset);$.effects.saveStyle(element);}
done();}});});var effectsEffectScale=$.effects.define("scale",function(options,done){var el=$(this),mode=options.mode,percent=parseInt(options.percent,10)||(parseInt(options.percent,10)===0?0:(mode!=="effect"?0:100)),newOptions=$.extend(true,{from:$.effects.scaledDimensions(el),to:$.effects.scaledDimensions(el,percent,options.direction||"both"),origin:options.origin||["middle","center"]},options);if(options.fade){newOptions.from.opacity=1;newOptions.to.opacity=0;}
$.effects.effect.size.call(this,newOptions,done);});var effectsEffectPuff=$.effects.define("puff","hide",function(options,done){var newOptions=$.extend(true,{},options,{fade:true,percent:parseInt(options.percent,10)||150});$.effects.effect.scale.call(this,newOptions,done);});var effectsEffectPulsate=$.effects.define("pulsate","show",function(options,done){var element=$(this),mode=options.mode,show=mode==="show",hide=mode==="hide",showhide=show||hide,anims=((options.times||5)*2)+(showhide?1:0),duration=options.duration/anims,animateTo=0,i=1,queuelen=element.queue().length;if(show||!element.is(":visible")){element.css("opacity",0).show();animateTo=1;}
for(;i<anims;i++){element.animate({opacity:animateTo},duration,options.easing);animateTo=1-animateTo;}
element.animate({opacity:animateTo},duration,options.easing);element.queue(done);$.effects.unshift(element,queuelen,anims+1);});var effectsEffectShake=$.effects.define("shake",function(options,done){var i=1,element=$(this),direction=options.direction||"left",distance=options.distance||20,times=options.times||3,anims=times*2+1,speed=Math.round(options.duration/anims),ref=(direction==="up"||direction==="down")?"top":"left",positiveMotion=(direction==="up"||direction==="left"),animation={},animation1={},animation2={},queuelen=element.queue().length;$.effects.createPlaceholder(element);animation[ref]=(positiveMotion?"-=":"+=")+distance;animation1[ref]=(positiveMotion?"+=":"-=")+distance*2;animation2[ref]=(positiveMotion?"-=":"+=")+distance*2;element.animate(animation,speed,options.easing);for(;i<times;i++){element.animate(animation1,speed,options.easing).animate(animation2,speed,options.easing);}
element.animate(animation1,speed,options.easing).animate(animation,speed/2,options.easing).queue(done);$.effects.unshift(element,queuelen,anims+1);});var effectsEffectSlide=$.effects.define("slide","show",function(options,done){var startClip,startRef,element=$(this),map={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},mode=options.mode,direction=options.direction||"left",ref=(direction==="up"||direction==="down")?"top":"left",positiveMotion=(direction==="up"||direction==="left"),distance=options.distance||element[ref==="top"?"outerHeight":"outerWidth"](true),animation={};$.effects.createPlaceholder(element);startClip=element.cssClip();startRef=element.position()[ref];animation[ref]=(positiveMotion?-1:1)*distance+startRef;animation.clip=element.cssClip();animation.clip[map[direction][1]]=animation.clip[map[direction][0]];if(mode==="show"){element.cssClip(animation.clip);element.css(ref,animation[ref]);animation.clip=startClip;animation[ref]=startRef;}
element.animate(animation,{queue:false,duration:options.duration,easing:options.easing,complete:done});});var effect;if($.uiBackCompat!==false){effect=$.effects.define("transfer",function(options,done){$(this).transfer(options,done);});}
var effectsEffectTransfer=effect;$.ui.focusable=function(element,hasTabindex){var map,mapName,img,focusableIfVisible,fieldset,nodeName=element.nodeName.toLowerCase();if("area"===nodeName){map=element.parentNode;mapName=map.name;if(!element.href||!mapName||map.nodeName.toLowerCase()!=="map"){return false;}
img=$("img[usemap='#"+mapName+"']");return img.length>0&&img.is(":visible");}
if(/^(input|select|textarea|button|object)$/.test(nodeName)){focusableIfVisible=!element.disabled;if(focusableIfVisible){fieldset=$(element).closest("fieldset")[0];if(fieldset){focusableIfVisible=!fieldset.disabled;}}}else if("a"===nodeName){focusableIfVisible=element.href||hasTabindex;}else{focusableIfVisible=hasTabindex;}
return focusableIfVisible&&$(element).is(":visible")&&visible($(element));};function visible(element){var visibility=element.css("visibility");while(visibility==="inherit"){element=element.parent();visibility=element.css("visibility");}
return visibility==="visible";}
$.extend($.expr.pseudos,{focusable:function(element){return $.ui.focusable(element,$.attr(element,"tabindex")!=null);}});var focusable=$.ui.focusable;var form=$.fn._form=function(){return typeof this[0].form==="string"?this.closest("form"):$(this[0].form);};var formResetMixin=$.ui.formResetMixin={_formResetHandler:function(){var form=$(this);setTimeout(function(){var instances=form.data("ui-form-reset-instances");$.each(instances,function(){this.refresh();});});},_bindFormResetHandler:function(){this.form=this.element._form();if(!this.form.length){return;}
var instances=this.form.data("ui-form-reset-instances")||[];if(!instances.length){this.form.on("reset.ui-form-reset",this._formResetHandler);}
instances.push(this);this.form.data("ui-form-reset-instances",instances);},_unbindFormResetHandler:function(){if(!this.form.length){return;}
var instances=this.form.data("ui-form-reset-instances");instances.splice($.inArray(this,instances),1);if(instances.length){this.form.data("ui-form-reset-instances",instances);}else{this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset");}}};if(!$.expr.pseudos){$.expr.pseudos=$.expr[":"];}
if(!$.uniqueSort){$.uniqueSort=$.unique;}
if(!$.escapeSelector){var rcssescape=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;var fcssescape=function(ch,asCodePoint){if(asCodePoint){if(ch==="\0"){return"\uFFFD";}
return ch.slice(0,-1)+"\\"+ch.charCodeAt(ch.length-1).toString(16)+" ";}
return"\\"+ch;};$.escapeSelector=function(sel){return(sel+"").replace(rcssescape,fcssescape);};}
if(!$.fn.even||!$.fn.odd){$.fn.extend({even:function(){return this.filter(function(i){return i%2===0;});},odd:function(){return this.filter(function(i){return i%2===1;});}});};var keycode=$.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38};var labels=$.fn.labels=function(){var ancestor,selector,id,labels,ancestors;if(!this.length){return this.pushStack([]);}
if(this[0].labels&&this[0].labels.length){return this.pushStack(this[0].labels);}
labels=this.eq(0).parents("label");id=this.attr("id");if(id){ancestor=this.eq(0).parents().last();ancestors=ancestor.add(ancestor.length?ancestor.siblings():this.siblings());selector="label[for='"+$.escapeSelector(id)+"']";labels=labels.add(ancestors.find(selector).addBack(selector));}
return this.pushStack(labels);};var scrollParent=$.fn.scrollParent=function(includeHidden){var position=this.css("position"),excludeStaticParent=position==="absolute",overflowRegex=includeHidden?/(auto|scroll|hidden)/:/(auto|scroll)/,scrollParent=this.parents().filter(function(){var parent=$(this);if(excludeStaticParent&&parent.css("position")==="static"){return false;}
return overflowRegex.test(parent.css("overflow")+parent.css("overflow-y")+
parent.css("overflow-x"));}).eq(0);return position==="fixed"||!scrollParent.length?$(this[0].ownerDocument||document):scrollParent;};var tabbable=$.extend($.expr.pseudos,{tabbable:function(element){var tabIndex=$.attr(element,"tabindex"),hasTabindex=tabIndex!=null;return(!hasTabindex||tabIndex>=0)&&$.ui.focusable(element,hasTabindex);}});var uniqueId=$.fn.extend({uniqueId:(function(){var uuid=0;return function(){return this.each(function(){if(!this.id){this.id="ui-id-"+(++uuid);}});};})(),removeUniqueId:function(){return this.each(function(){if(/^ui-id-\d+$/.test(this.id)){$(this).removeAttr("id");}});}});var widgetsAccordion=$.widget("ui.accordion",{version:"1.13.2",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:false,event:"click",header:function(elem){return elem.find("> li > :first-child").add(elem.find("> :not(li)").even());},heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var options=this.options;this.prevShow=this.prevHide=$();this._addClass("ui-accordion","ui-widget ui-helper-reset");this.element.attr("role","tablist");if(!options.collapsible&&(options.active===false||options.active==null)){options.active=0;}
this._processPanels();if(options.active<0){options.active+=this.headers.length;}
this._refresh();},_getCreateEventData:function(){return{header:this.active,panel:!this.active.length?$():this.active.next()};},_createIcons:function(){var icon,children,icons=this.options.icons;if(icons){icon=$("<span>");this._addClass(icon,"ui-accordion-header-icon","ui-icon "+icons.header);icon.prependTo(this.headers);children=this.active.children(".ui-accordion-header-icon");this._removeClass(children,icons.header)._addClass(children,null,icons.activeHeader)._addClass(this.headers,"ui-accordion-icons");}},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons");this.headers.children(".ui-accordion-header-icon").remove();},_destroy:function(){var contents;this.element.removeAttr("role");this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId();this._destroyIcons();contents=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId();if(this.options.heightStyle!=="content"){contents.css("height","");}},_setOption:function(key,value){if(key==="active"){this._activate(value);return;}
if(key==="event"){if(this.options.event){this._off(this.headers,this.options.event);}
this._setupEvents(value);}
this._super(key,value);if(key==="collapsible"&&!value&&this.options.active===false){this._activate(0);}
if(key==="icons"){this._destroyIcons();if(value){this._createIcons();}}},_setOptionDisabled:function(value){this._super(value);this.element.attr("aria-disabled",value);this._toggleClass(null,"ui-state-disabled",!!value);this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!value);},_keydown:function(event){if(event.altKey||event.ctrlKey){return;}
var keyCode=$.ui.keyCode,length=this.headers.length,currentIndex=this.headers.index(event.target),toFocus=false;switch(event.keyCode){case keyCode.RIGHT:case keyCode.DOWN:toFocus=this.headers[(currentIndex+1)%length];break;case keyCode.LEFT:case keyCode.UP:toFocus=this.headers[(currentIndex-1+length)%length];break;case keyCode.SPACE:case keyCode.ENTER:this._eventHandler(event);break;case keyCode.HOME:toFocus=this.headers[0];break;case keyCode.END:toFocus=this.headers[length-1];break;}
if(toFocus){$(event.target).attr("tabIndex",-1);$(toFocus).attr("tabIndex",0);$(toFocus).trigger("focus");event.preventDefault();}},_panelKeyDown:function(event){if(event.keyCode===$.ui.keyCode.UP&&event.ctrlKey){$(event.currentTarget).prev().trigger("focus");}},refresh:function(){var options=this.options;this._processPanels();if((options.active===false&&options.collapsible===true)||!this.headers.length){options.active=false;this.active=$();}else if(options.active===false){this._activate(0);}else if(this.active.length&&!$.contains(this.element[0],this.active[0])){if(this.headers.length===this.headers.find(".ui-state-disabled").length){options.active=false;this.active=$();}else{this._activate(Math.max(0,options.active-1));}}else{options.active=this.headers.index(this.active);}
this._destroyIcons();this._refresh();},_processPanels:function(){var prevHeaders=this.headers,prevPanels=this.panels;if(typeof this.options.header==="function"){this.headers=this.options.header(this.element);}else{this.headers=this.element.find(this.options.header);}
this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default");this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide();this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content");if(prevPanels){this._off(prevHeaders.not(this.headers));this._off(prevPanels.not(this.panels));}},_refresh:function(){var maxHeight,options=this.options,heightStyle=options.heightStyle,parent=this.element.parent();this.active=this._findActive(options.active);this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed");this._addClass(this.active.next(),"ui-accordion-content-active");this.active.next().show();this.headers.attr("role","tab").each(function(){var header=$(this),headerId=header.uniqueId().attr("id"),panel=header.next(),panelId=panel.uniqueId().attr("id");header.attr("aria-controls",panelId);panel.attr("aria-labelledby",headerId);}).next().attr("role","tabpanel");this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex",0);}else{this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"});}
this._createIcons();this._setupEvents(options.event);if(heightStyle==="fill"){maxHeight=parent.height();this.element.siblings(":visible").each(function(){var elem=$(this),position=elem.css("position");if(position==="absolute"||position==="fixed"){return;}
maxHeight-=elem.outerHeight(true);});this.headers.each(function(){maxHeight-=$(this).outerHeight(true);});this.headers.next().each(function(){$(this).height(Math.max(0,maxHeight-
$(this).innerHeight()+$(this).height()));}).css("overflow","auto");}else if(heightStyle==="auto"){maxHeight=0;this.headers.next().each(function(){var isVisible=$(this).is(":visible");if(!isVisible){$(this).show();}
maxHeight=Math.max(maxHeight,$(this).css("height","").height());if(!isVisible){$(this).hide();}}).height(maxHeight);}},_activate:function(index){var active=this._findActive(index)[0];if(active===this.active[0]){return;}
active=active||this.active[0];this._eventHandler({target:active,currentTarget:active,preventDefault:$.noop});},_findActive:function(selector){return typeof selector==="number"?this.headers.eq(selector):$();},_setupEvents:function(event){var events={keydown:"_keydown"};if(event){$.each(event.split(" "),function(index,eventName){events[eventName]="_eventHandler";});}
this._off(this.headers.add(this.headers.next()));this._on(this.headers,events);this._on(this.headers.next(),{keydown:"_panelKeyDown"});this._hoverable(this.headers);this._focusable(this.headers);},_eventHandler:function(event){var activeChildren,clickedChildren,options=this.options,active=this.active,clicked=$(event.currentTarget),clickedIsActive=clicked[0]===active[0],collapsing=clickedIsActive&&options.collapsible,toShow=collapsing?$():clicked.next(),toHide=active.next(),eventData={oldHeader:active,oldPanel:toHide,newHeader:collapsing?$():clicked,newPanel:toShow};event.preventDefault();if((clickedIsActive&&!options.collapsible)||(this._trigger("beforeActivate",event,eventData)===false)){return;}
options.active=collapsing?false:this.headers.index(clicked);this.active=clickedIsActive?$():clicked;this._toggle(eventData);this._removeClass(active,"ui-accordion-header-active","ui-state-active");if(options.icons){activeChildren=active.children(".ui-accordion-header-icon");this._removeClass(activeChildren,null,options.icons.activeHeader)._addClass(activeChildren,null,options.icons.header);}
if(!clickedIsActive){this._removeClass(clicked,"ui-accordion-header-collapsed")._addClass(clicked,"ui-accordion-header-active","ui-state-active");if(options.icons){clickedChildren=clicked.children(".ui-accordion-header-icon");this._removeClass(clickedChildren,null,options.icons.header)._addClass(clickedChildren,null,options.icons.activeHeader);}
this._addClass(clicked.next(),"ui-accordion-content-active");}},_toggle:function(data){var toShow=data.newPanel,toHide=this.prevShow.length?this.prevShow:data.oldPanel;this.prevShow.add(this.prevHide).stop(true,true);this.prevShow=toShow;this.prevHide=toHide;if(this.options.animate){this._animate(toShow,toHide,data);}else{toHide.hide();toShow.show();this._toggleComplete(data);}
toHide.attr({"aria-hidden":"true"});toHide.prev().attr({"aria-selected":"false","aria-expanded":"false"});if(toShow.length&&toHide.length){toHide.prev().attr({"tabIndex":-1,"aria-expanded":"false"});}else if(toShow.length){this.headers.filter(function(){return parseInt($(this).attr("tabIndex"),10)===0;}).attr("tabIndex",-1);}
toShow.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0});},_animate:function(toShow,toHide,data){var total,easing,duration,that=this,adjust=0,boxSizing=toShow.css("box-sizing"),down=toShow.length&&(!toHide.length||(toShow.index()<toHide.index())),animate=this.options.animate||{},options=down&&animate.down||animate,complete=function(){that._toggleComplete(data);};if(typeof options==="number"){duration=options;}
if(typeof options==="string"){easing=options;}
easing=easing||options.easing||animate.easing;duration=duration||options.duration||animate.duration;if(!toHide.length){return toShow.animate(this.showProps,duration,easing,complete);}
if(!toShow.length){return toHide.animate(this.hideProps,duration,easing,complete);}
total=toShow.show().outerHeight();toHide.animate(this.hideProps,{duration:duration,easing:easing,step:function(now,fx){fx.now=Math.round(now);}});toShow.hide().animate(this.showProps,{duration:duration,easing:easing,complete:complete,step:function(now,fx){fx.now=Math.round(now);if(fx.prop!=="height"){if(boxSizing==="content-box"){adjust+=fx.now;}}else if(that.options.heightStyle!=="content"){fx.now=Math.round(total-toHide.outerHeight()-adjust);adjust=0;}}});},_toggleComplete:function(data){var toHide=data.oldPanel,prev=toHide.prev();this._removeClass(toHide,"ui-accordion-content-active");this._removeClass(prev,"ui-accordion-header-active")._addClass(prev,"ui-accordion-header-collapsed");if(toHide.length){toHide.parent()[0].className=toHide.parent()[0].className;}
this._trigger("activate",null,data);}});var safeActiveElement=$.ui.safeActiveElement=function(document){var activeElement;try{activeElement=document.activeElement;}catch(error){activeElement=document.body;}
if(!activeElement){activeElement=document.body;}
if(!activeElement.nodeName){activeElement=document.body;}
return activeElement;};var widgetsMenu=$.widget("ui.menu",{version:"1.13.2",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element;this.mouseHandled=false;this.lastMousePosition={x:null,y:null};this.element.uniqueId().attr({role:this.options.role,tabIndex:0});this._addClass("ui-menu","ui-widget ui-widget-content");this._on({"mousedown .ui-menu-item":function(event){event.preventDefault();this._activateItem(event);},"click .ui-menu-item":function(event){var target=$(event.target);var active=$($.ui.safeActiveElement(this.document[0]));if(!this.mouseHandled&&target.not(".ui-state-disabled").length){this.select(event);if(!event.isPropagationStopped()){this.mouseHandled=true;}
if(target.has(".ui-menu").length){this.expand(event);}else if(!this.element.is(":focus")&&active.closest(".ui-menu").length){this.element.trigger("focus",[true]);if(this.active&&this.active.parents(".ui-menu").length===1){clearTimeout(this.timer);}}}},"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(event,keepActiveItem){var item=this.active||this._menuItems().first();if(!keepActiveItem){this.focus(event,item);}},blur:function(event){this._delay(function(){var notContained=!$.contains(this.element[0],$.ui.safeActiveElement(this.document[0]));if(notContained){this.collapseAll(event);}});},keydown:"_keydown"});this.refresh();this._on(this.document,{click:function(event){if(this._closeOnDocumentClick(event)){this.collapseAll(event,true);}
this.mouseHandled=false;}});},_activateItem:function(event){if(this.previousFilter){return;}
if(event.clientX===this.lastMousePosition.x&&event.clientY===this.lastMousePosition.y){return;}
this.lastMousePosition={x:event.clientX,y:event.clientY};var actualTarget=$(event.target).closest(".ui-menu-item"),target=$(event.currentTarget);if(actualTarget[0]!==target[0]){return;}
if(target.is(".ui-state-active")){return;}
this._removeClass(target.siblings().children(".ui-state-active"),null,"ui-state-active");this.focus(event,target);},_destroy:function(){var items=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),submenus=items.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled "+"tabIndex").removeUniqueId().show();submenus.children().each(function(){var elem=$(this);if(elem.data("ui-menu-submenu-caret")){elem.remove();}});},_keydown:function(event){var match,prev,character,skip,preventDefault=true;switch(event.keyCode){case $.ui.keyCode.PAGE_UP:this.previousPage(event);break;case $.ui.keyCode.PAGE_DOWN:this.nextPage(event);break;case $.ui.keyCode.HOME:this._move("first","first",event);break;case $.ui.keyCode.END:this._move("last","last",event);break;case $.ui.keyCode.UP:this.previous(event);break;case $.ui.keyCode.DOWN:this.next(event);break;case $.ui.keyCode.LEFT:this.collapse(event);break;case $.ui.keyCode.RIGHT:if(this.active&&!this.active.is(".ui-state-disabled")){this.expand(event);}
break;case $.ui.keyCode.ENTER:case $.ui.keyCode.SPACE:this._activate(event);break;case $.ui.keyCode.ESCAPE:this.collapse(event);break;default:preventDefault=false;prev=this.previousFilter||"";skip=false;character=event.keyCode>=96&&event.keyCode<=105?(event.keyCode-96).toString():String.fromCharCode(event.keyCode);clearTimeout(this.filterTimer);if(character===prev){skip=true;}else{character=prev+character;}
match=this._filterMenuItems(character);match=skip&&match.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):match;if(!match.length){character=String.fromCharCode(event.keyCode);match=this._filterMenuItems(character);}
if(match.length){this.focus(event,match);this.previousFilter=character;this.filterTimer=this._delay(function(){delete this.previousFilter;},1000);}else{delete this.previousFilter;}}
if(preventDefault){event.preventDefault();}},_activate:function(event){if(this.active&&!this.active.is(".ui-state-disabled")){if(this.active.children("[aria-haspopup='true']").length){this.expand(event);}else{this.select(event);}}},refresh:function(){var menus,items,newSubmenus,newItems,newWrappers,that=this,icon=this.options.icons.submenu,submenus=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length);newSubmenus=submenus.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var menu=$(this),item=menu.prev(),submenuCaret=$("<span>").data("ui-menu-submenu-caret",true);that._addClass(submenuCaret,"ui-menu-icon","ui-icon "+icon);item.attr("aria-haspopup","true").prepend(submenuCaret);menu.attr("aria-labelledby",item.attr("id"));});this._addClass(newSubmenus,"ui-menu","ui-widget ui-widget-content ui-front");menus=submenus.add(this.element);items=menus.find(this.options.items);items.not(".ui-menu-item").each(function(){var item=$(this);if(that._isDivider(item)){that._addClass(item,"ui-menu-divider","ui-widget-content");}});newItems=items.not(".ui-menu-item, .ui-menu-divider");newWrappers=newItems.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()});this._addClass(newItems,"ui-menu-item")._addClass(newWrappers,"ui-menu-item-wrapper");items.filter(".ui-state-disabled").attr("aria-disabled","true");if(this.active&&!$.contains(this.element[0],this.active[0])){this.blur();}},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role];},_setOption:function(key,value){if(key==="icons"){var icons=this.element.find(".ui-menu-icon");this._removeClass(icons,null,this.options.icons.submenu)._addClass(icons,null,value.submenu);}
this._super(key,value);},_setOptionDisabled:function(value){this._super(value);this.element.attr("aria-disabled",String(value));this._toggleClass(null,"ui-state-disabled",!!value);},focus:function(event,item){var nested,focused,activeParent;this.blur(event,event&&event.type==="focus");this._scrollIntoView(item);this.active=item.first();focused=this.active.children(".ui-menu-item-wrapper");this._addClass(focused,null,"ui-state-active");if(this.options.role){this.element.attr("aria-activedescendant",focused.attr("id"));}
activeParent=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper");this._addClass(activeParent,null,"ui-state-active");if(event&&event.type==="keydown"){this._close();}else{this.timer=this._delay(function(){this._close();},this.delay);}
nested=item.children(".ui-menu");if(nested.length&&event&&(/^mouse/.test(event.type))){this._startOpening(nested);}
this.activeMenu=item.parent();this._trigger("focus",event,{item:item});},_scrollIntoView:function(item){var borderTop,paddingTop,offset,scroll,elementHeight,itemHeight;if(this._hasScroll()){borderTop=parseFloat($.css(this.activeMenu[0],"borderTopWidth"))||0;paddingTop=parseFloat($.css(this.activeMenu[0],"paddingTop"))||0;offset=item.offset().top-this.activeMenu.offset().top-borderTop-paddingTop;scroll=this.activeMenu.scrollTop();elementHeight=this.activeMenu.height();itemHeight=item.outerHeight();if(offset<0){this.activeMenu.scrollTop(scroll+offset);}else if(offset+itemHeight>elementHeight){this.activeMenu.scrollTop(scroll+offset-elementHeight+itemHeight);}}},blur:function(event,fromFocus){if(!fromFocus){clearTimeout(this.timer);}
if(!this.active){return;}
this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active");this._trigger("blur",event,{item:this.active});this.active=null;},_startOpening:function(submenu){clearTimeout(this.timer);if(submenu.attr("aria-hidden")!=="true"){return;}
this.timer=this._delay(function(){this._close();this._open(submenu);},this.delay);},_open:function(submenu){var position=$.extend({of:this.active},this.options.position);clearTimeout(this.timer);this.element.find(".ui-menu").not(submenu.parents(".ui-menu")).hide().attr("aria-hidden","true");submenu.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(position);},collapseAll:function(event,all){clearTimeout(this.timer);this.timer=this._delay(function(){var currentMenu=all?this.element:$(event&&event.target).closest(this.element.find(".ui-menu"));if(!currentMenu.length){currentMenu=this.element;}
this._close(currentMenu);this.blur(event);this._removeClass(currentMenu.find(".ui-state-active"),null,"ui-state-active");this.activeMenu=currentMenu;},all?0:this.delay);},_close:function(startMenu){if(!startMenu){startMenu=this.active?this.active.parent():this.element;}
startMenu.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false");},_closeOnDocumentClick:function(event){return!$(event.target).closest(".ui-menu").length;},_isDivider:function(item){return!/[^\-\u2014\u2013\s]/.test(item.text());},collapse:function(event){var newItem=this.active&&this.active.parent().closest(".ui-menu-item",this.element);if(newItem&&newItem.length){this._close();this.focus(event,newItem);}},expand:function(event){var newItem=this.active&&this._menuItems(this.active.children(".ui-menu")).first();if(newItem&&newItem.length){this._open(newItem.parent());this._delay(function(){this.focus(event,newItem);});}},next:function(event){this._move("next","first",event);},previous:function(event){this._move("prev","last",event);},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length;},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length;},_menuItems:function(menu){return(menu||this.element).find(this.options.items).filter(".ui-menu-item");},_move:function(direction,filter,event){var next;if(this.active){if(direction==="first"||direction==="last"){next=this.active
[direction==="first"?"prevAll":"nextAll"](".ui-menu-item").last();}else{next=this.active
[direction+"All"](".ui-menu-item").first();}}
if(!next||!next.length||!this.active){next=this._menuItems(this.activeMenu)[filter]();}
this.focus(event,next);},nextPage:function(event){var item,base,height;if(!this.active){this.next(event);return;}
if(this.isLastItem()){return;}
if(this._hasScroll()){base=this.active.offset().top;height=this.element.innerHeight();if($.fn.jquery.indexOf("3.2.")===0){height+=this.element[0].offsetHeight-this.element.outerHeight();}
this.active.nextAll(".ui-menu-item").each(function(){item=$(this);return item.offset().top-base-height<0;});this.focus(event,item);}else{this.focus(event,this._menuItems(this.activeMenu)
[!this.active?"first":"last"]());}},previousPage:function(event){var item,base,height;if(!this.active){this.next(event);return;}
if(this.isFirstItem()){return;}
if(this._hasScroll()){base=this.active.offset().top;height=this.element.innerHeight();if($.fn.jquery.indexOf("3.2.")===0){height+=this.element[0].offsetHeight-this.element.outerHeight();}
this.active.prevAll(".ui-menu-item").each(function(){item=$(this);return item.offset().top-base+height>0;});this.focus(event,item);}else{this.focus(event,this._menuItems(this.activeMenu).first());}},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight");},select:function(event){this.active=this.active||$(event.target).closest(".ui-menu-item");var ui={item:this.active};if(!this.active.has(".ui-menu").length){this.collapseAll(event,true);}
this._trigger("select",event,ui);},_filterMenuItems:function(character){var escapedCharacter=character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),regex=new RegExp("^"+escapedCharacter,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return regex.test(String.prototype.trim.call($(this).children(".ui-menu-item-wrapper").text()));});}});$.widget("ui.autocomplete",{version:"1.13.2",defaultElement:"<input>",options:{appendTo:null,autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,liveRegionTimer:null,_create:function(){var suppressKeyPress,suppressKeyPressRepeat,suppressInput,nodeName=this.element[0].nodeName.toLowerCase(),isTextarea=nodeName==="textarea",isInput=nodeName==="input";this.isMultiLine=isTextarea||!isInput&&this._isContentEditable(this.element);this.valueMethod=this.element[isTextarea||isInput?"val":"text"];this.isNewMenu=true;this._addClass("ui-autocomplete-input");this.element.attr("autocomplete","off");this._on(this.element,{keydown:function(event){if(this.element.prop("readOnly")){suppressKeyPress=true;suppressInput=true;suppressKeyPressRepeat=true;return;}
suppressKeyPress=false;suppressInput=false;suppressKeyPressRepeat=false;var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:suppressKeyPress=true;this._move("previousPage",event);break;case keyCode.PAGE_DOWN:suppressKeyPress=true;this._move("nextPage",event);break;case keyCode.UP:suppressKeyPress=true;this._keyEvent("previous",event);break;case keyCode.DOWN:suppressKeyPress=true;this._keyEvent("next",event);break;case keyCode.ENTER:if(this.menu.active){suppressKeyPress=true;event.preventDefault();this.menu.select(event);}
break;case keyCode.TAB:if(this.menu.active){this.menu.select(event);}
break;case keyCode.ESCAPE:if(this.menu.element.is(":visible")){if(!this.isMultiLine){this._value(this.term);}
this.close(event);event.preventDefault();}
break;default:suppressKeyPressRepeat=true;this._searchTimeout(event);break;}},keypress:function(event){if(suppressKeyPress){suppressKeyPress=false;if(!this.isMultiLine||this.menu.element.is(":visible")){event.preventDefault();}
return;}
if(suppressKeyPressRepeat){return;}
var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:this._move("previousPage",event);break;case keyCode.PAGE_DOWN:this._move("nextPage",event);break;case keyCode.UP:this._keyEvent("previous",event);break;case keyCode.DOWN:this._keyEvent("next",event);break;}},input:function(event){if(suppressInput){suppressInput=false;event.preventDefault();return;}
this._searchTimeout(event);},focus:function(){this.selectedItem=null;this.previous=this._value();},blur:function(event){clearTimeout(this.searching);this.close(event);this._change(event);}});this._initSource();this.menu=$("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().attr({"unselectable":"on"}).menu("instance");this._addClass(this.menu.element,"ui-autocomplete","ui-front");this._on(this.menu.element,{mousedown:function(event){event.preventDefault();},menufocus:function(event,ui){var label,item;if(this.isNewMenu){this.isNewMenu=false;if(event.originalEvent&&/^mouse/.test(event.originalEvent.type)){this.menu.blur();this.document.one("mousemove",function(){$(event.target).trigger(event.originalEvent);});return;}}
item=ui.item.data("ui-autocomplete-item");if(false!==this._trigger("focus",event,{item:item})){if(event.originalEvent&&/^key/.test(event.originalEvent.type)){this._value(item.value);}}
label=ui.item.attr("aria-label")||item.value;if(label&&String.prototype.trim.call(label).length){clearTimeout(this.liveRegionTimer);this.liveRegionTimer=this._delay(function(){this.liveRegion.html($("<div>").text(label));},100);}},menuselect:function(event,ui){var item=ui.item.data("ui-autocomplete-item"),previous=this.previous;if(this.element[0]!==$.ui.safeActiveElement(this.document[0])){this.element.trigger("focus");this.previous=previous;this._delay(function(){this.previous=previous;this.selectedItem=item;});}
if(false!==this._trigger("select",event,{item:item})){this._value(item.value);}
this.term=this._value();this.close(event);this.selectedItem=item;}});this.liveRegion=$("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body);this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible");this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete");}});},_destroy:function(){clearTimeout(this.searching);this.element.removeAttr("autocomplete");this.menu.element.remove();this.liveRegion.remove();},_setOption:function(key,value){this._super(key,value);if(key==="source"){this._initSource();}
if(key==="appendTo"){this.menu.element.appendTo(this._appendTo());}
if(key==="disabled"&&value&&this.xhr){this.xhr.abort();}},_isEventTargetInWidget:function(event){var menuElement=this.menu.element[0];return event.target===this.element[0]||event.target===menuElement||$.contains(menuElement,event.target);},_closeOnClickOutside:function(event){if(!this._isEventTargetInWidget(event)){this.close();}},_appendTo:function(){var element=this.options.appendTo;if(element){element=element.jquery||element.nodeType?$(element):this.document.find(element).eq(0);}
if(!element||!element[0]){element=this.element.closest(".ui-front, dialog");}
if(!element.length){element=this.document[0].body;}
return element;},_initSource:function(){var array,url,that=this;if(Array.isArray(this.options.source)){array=this.options.source;this.source=function(request,response){response($.ui.autocomplete.filter(array,request.term));};}else if(typeof this.options.source==="string"){url=this.options.source;this.source=function(request,response){if(that.xhr){that.xhr.abort();}
that.xhr=$.ajax({url:url,data:request,dataType:"json",success:function(data){response(data);},error:function(){response([]);}});};}else{this.source=this.options.source;}},_searchTimeout:function(event){clearTimeout(this.searching);this.searching=this._delay(function(){var equalValues=this.term===this._value(),menuVisible=this.menu.element.is(":visible"),modifierKey=event.altKey||event.ctrlKey||event.metaKey||event.shiftKey;if(!equalValues||(equalValues&&!menuVisible&&!modifierKey)){this.selectedItem=null;this.search(null,event);}},this.options.delay);},search:function(value,event){value=value!=null?value:this._value();this.term=this._value();if(value.length<this.options.minLength){return this.close(event);}
if(this._trigger("search",event)===false){return;}
return this._search(value);},_search:function(value){this.pending++;this._addClass("ui-autocomplete-loading");this.cancelSearch=false;this.source({term:value},this._response());},_response:function(){var index=++this.requestIndex;return function(content){if(index===this.requestIndex){this.__response(content);}
this.pending--;if(!this.pending){this._removeClass("ui-autocomplete-loading");}}.bind(this);},__response:function(content){if(content){content=this._normalize(content);}
this._trigger("response",null,{content:content});if(!this.options.disabled&&content&&content.length&&!this.cancelSearch){this._suggest(content);this._trigger("open");}else{this._close();}},close:function(event){this.cancelSearch=true;this._close(event);},_close:function(event){this._off(this.document,"mousedown");if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.blur();this.isNewMenu=true;this._trigger("close",event);}},_change:function(event){if(this.previous!==this._value()){this._trigger("change",event,{item:this.selectedItem});}},_normalize:function(items){if(items.length&&items[0].label&&items[0].value){return items;}
return $.map(items,function(item){if(typeof item==="string"){return{label:item,value:item};}
return $.extend({},item,{label:item.label||item.value,value:item.value||item.label});});},_suggest:function(items){var ul=this.menu.element.empty();this._renderMenu(ul,items);this.isNewMenu=true;this.menu.refresh();ul.show();this._resizeMenu();ul.position($.extend({of:this.element},this.options.position));if(this.options.autoFocus){this.menu.next();}
this._on(this.document,{mousedown:"_closeOnClickOutside"});},_resizeMenu:function(){var ul=this.menu.element;ul.outerWidth(Math.max(ul.width("").outerWidth()+1,this.element.outerWidth()));},_renderMenu:function(ul,items){var that=this;$.each(items,function(index,item){that._renderItemData(ul,item);});},_renderItemData:function(ul,item){return this._renderItem(ul,item).data("ui-autocomplete-item",item);},_renderItem:function(ul,item){return $("<li>").append($("<div>").text(item.label)).appendTo(ul);},_move:function(direction,event){if(!this.menu.element.is(":visible")){this.search(null,event);return;}
if(this.menu.isFirstItem()&&/^previous/.test(direction)||this.menu.isLastItem()&&/^next/.test(direction)){if(!this.isMultiLine){this._value(this.term);}
this.menu.blur();return;}
this.menu[direction](event);},widget:function(){return this.menu.element;},_value:function(){return this.valueMethod.apply(this.element,arguments);},_keyEvent:function(keyEvent,event){if(!this.isMultiLine||this.menu.element.is(":visible")){this._move(keyEvent,event);event.preventDefault();}},_isContentEditable:function(element){if(!element.length){return false;}
var editable=element.prop("contentEditable");if(editable==="inherit"){return this._isContentEditable(element.parent());}
return editable==="true";}});$.extend($.ui.autocomplete,{escapeRegex:function(value){return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");},filter:function(array,term){var matcher=new RegExp($.ui.autocomplete.escapeRegex(term),"i");return $.grep(array,function(value){return matcher.test(value.label||value.value||value);});}});$.widget("ui.autocomplete",$.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(amount){return amount+(amount>1?" results are":" result is")+" available, use up and down arrow keys to navigate.";}}},__response:function(content){var message;this._superApply(arguments);if(this.options.disabled||this.cancelSearch){return;}
if(content&&content.length){message=this.options.messages.results(content.length);}else{message=this.options.messages.noResults;}
clearTimeout(this.liveRegionTimer);this.liveRegionTimer=this._delay(function(){this.liveRegion.html($("<div>").text(message));},100);}});var widgetsAutocomplete=$.ui.autocomplete;var controlgroupCornerRegex=/ui-corner-([a-z]){2,6}/g;var widgetsControlgroup=$.widget("ui.controlgroup",{version:"1.13.2",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:true,items:{"button":"input[type=button], input[type=submit], input[type=reset], button, a","controlgroupLabel":".ui-controlgroup-label","checkboxradio":"input[type='checkbox'], input[type='radio']","selectmenu":"select","spinner":".ui-spinner-input"}},_create:function(){this._enhance();},_enhance:function(){this.element.attr("role","toolbar");this.refresh();},_destroy:function(){this._callChildMethod("destroy");this.childWidgets.removeData("ui-controlgroup-data");this.element.removeAttr("role");if(this.options.items.controlgroupLabel){this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap();}},_initWidgets:function(){var that=this,childWidgets=[];$.each(this.options.items,function(widget,selector){var labels;var options={};if(!selector){return;}
if(widget==="controlgroupLabel"){labels=that.element.find(selector);labels.each(function(){var element=$(this);if(element.children(".ui-controlgroup-label-contents").length){return;}
element.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>");});that._addClass(labels,null,"ui-widget ui-widget-content ui-state-default");childWidgets=childWidgets.concat(labels.get());return;}
if(!$.fn[widget]){return;}
if(that["_"+widget+"Options"]){options=that["_"+widget+"Options"]("middle");}else{options={classes:{}};}
that.element.find(selector).each(function(){var element=$(this);var instance=element[widget]("instance");var instanceOptions=$.widget.extend({},options);if(widget==="button"&&element.parent(".ui-spinner").length){return;}
if(!instance){instance=element[widget]()[widget]("instance");}
if(instance){instanceOptions.classes=that._resolveClassesValues(instanceOptions.classes,instance);}
element[widget](instanceOptions);var widgetElement=element[widget]("widget");$.data(widgetElement[0],"ui-controlgroup-data",instance?instance:element[widget]("instance"));childWidgets.push(widgetElement[0]);});});this.childWidgets=$($.uniqueSort(childWidgets));this._addClass(this.childWidgets,"ui-controlgroup-item");},_callChildMethod:function(method){this.childWidgets.each(function(){var element=$(this),data=element.data("ui-controlgroup-data");if(data&&data[method]){data[method]();}});},_updateCornerClass:function(element,position){var remove="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";var add=this._buildSimpleOptions(position,"label").classes.label;this._removeClass(element,null,remove);this._addClass(element,null,add);},_buildSimpleOptions:function(position,key){var direction=this.options.direction==="vertical";var result={classes:{}};result.classes[key]={"middle":"","first":"ui-corner-"+(direction?"top":"left"),"last":"ui-corner-"+(direction?"bottom":"right"),"only":"ui-corner-all"}[position];return result;},_spinnerOptions:function(position){var options=this._buildSimpleOptions(position,"ui-spinner");options.classes["ui-spinner-up"]="";options.classes["ui-spinner-down"]="";return options;},_buttonOptions:function(position){return this._buildSimpleOptions(position,"ui-button");},_checkboxradioOptions:function(position){return this._buildSimpleOptions(position,"ui-checkboxradio-label");},_selectmenuOptions:function(position){var direction=this.options.direction==="vertical";return{width:direction?"auto":false,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(direction?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(direction?"top":"left")},last:{"ui-selectmenu-button-open":direction?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(direction?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[position]};},_resolveClassesValues:function(classes,instance){var result={};$.each(classes,function(key){var current=instance.options.classes[key]||"";current=String.prototype.trim.call(current.replace(controlgroupCornerRegex,""));result[key]=(current+" "+classes[key]).replace(/\s+/g," ");});return result;},_setOption:function(key,value){if(key==="direction"){this._removeClass("ui-controlgroup-"+this.options.direction);}
this._super(key,value);if(key==="disabled"){this._callChildMethod(value?"disable":"enable");return;}
this.refresh();},refresh:function(){var children,that=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction);if(this.options.direction==="horizontal"){this._addClass(null,"ui-helper-clearfix");}
this._initWidgets();children=this.childWidgets;if(this.options.onlyVisible){children=children.filter(":visible");}
if(children.length){$.each(["first","last"],function(index,value){var instance=children[value]().data("ui-controlgroup-data");if(instance&&that["_"+instance.widgetName+"Options"]){var options=that["_"+instance.widgetName+"Options"](children.length===1?"only":value);options.classes=that._resolveClassesValues(options.classes,instance);instance.element[instance.widgetName](options);}else{that._updateCornerClass(children[value](),value);}});this._callChildMethod("refresh");}}});$.widget("ui.checkboxradio",[$.ui.formResetMixin,{version:"1.13.2",options:{disabled:null,label:null,icon:true,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var disabled,labels,labelContents;var options=this._super()||{};this._readType();labels=this.element.labels();this.label=$(labels[labels.length-1]);if(!this.label.length){$.error("No label found for checkboxradio widget");}
this.originalLabel="";labelContents=this.label.contents().not(this.element[0]);if(labelContents.length){this.originalLabel+=labelContents.clone().wrapAll("<div></div>").parent().html();}
if(this.originalLabel){options.label=this.originalLabel;}
disabled=this.element[0].disabled;if(disabled!=null){options.disabled=disabled;}
return options;},_create:function(){var checked=this.element[0].checked;this._bindFormResetHandler();if(this.options.disabled==null){this.options.disabled=this.element[0].disabled;}
this._setOption("disabled",this.options.disabled);this._addClass("ui-checkboxradio","ui-helper-hidden-accessible");this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget");if(this.type==="radio"){this._addClass(this.label,"ui-checkboxradio-radio-label");}
if(this.options.label&&this.options.label!==this.originalLabel){this._updateLabel();}else if(this.originalLabel){this.options.label=this.originalLabel;}
this._enhance();if(checked){this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active");}
this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus");},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus");}});},_readType:function(){var nodeName=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type;if(nodeName!=="input"||!/radio|checkbox/.test(this.type)){$.error("Can't create checkboxradio on element.nodeName="+nodeName+" and element.type="+this.type);}},_enhance:function(){this._updateIcon(this.element[0].checked);},widget:function(){return this.label;},_getRadioGroup:function(){var group;var name=this.element[0].name;var nameSelector="input[name='"+$.escapeSelector(name)+"']";if(!name){return $([]);}
if(this.form.length){group=$(this.form[0].elements).filter(nameSelector);}else{group=$(nameSelector).filter(function(){return $(this)._form().length===0;});}
return group.not(this.element);},_toggleClasses:function(){var checked=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",checked);if(this.options.icon&&this.type==="checkbox"){this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",checked)._toggleClass(this.icon,null,"ui-icon-blank",!checked);}
if(this.type==="radio"){this._getRadioGroup().each(function(){var instance=$(this).checkboxradio("instance");if(instance){instance._removeClass(instance.label,"ui-checkboxradio-checked","ui-state-active");}});}},_destroy:function(){this._unbindFormResetHandler();if(this.icon){this.icon.remove();this.iconSpace.remove();}},_setOption:function(key,value){if(key==="label"&&!value){return;}
this._super(key,value);if(key==="disabled"){this._toggleClass(this.label,null,"ui-state-disabled",value);this.element[0].disabled=value;return;}
this.refresh();},_updateIcon:function(checked){var toAdd="ui-icon ui-icon-background ";if(this.options.icon){if(!this.icon){this.icon=$("<span>");this.iconSpace=$("<span> </span>");this._addClass(this.iconSpace,"ui-checkboxradio-icon-space");}
if(this.type==="checkbox"){toAdd+=checked?"ui-icon-check ui-state-checked":"ui-icon-blank";this._removeClass(this.icon,null,checked?"ui-icon-blank":"ui-icon-check");}else{toAdd+="ui-icon-blank";}
this._addClass(this.icon,"ui-checkboxradio-icon",toAdd);if(!checked){this._removeClass(this.icon,null,"ui-icon-check ui-state-checked");}
this.icon.prependTo(this.label).after(this.iconSpace);}else if(this.icon!==undefined){this.icon.remove();this.iconSpace.remove();delete this.icon;}},_updateLabel:function(){var contents=this.label.contents().not(this.element[0]);if(this.icon){contents=contents.not(this.icon[0]);}
if(this.iconSpace){contents=contents.not(this.iconSpace[0]);}
contents.remove();this.label.append(this.options.label);},refresh:function(){var checked=this.element[0].checked,isDisabled=this.element[0].disabled;this._updateIcon(checked);this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",checked);if(this.options.label!==null){this._updateLabel();}
if(isDisabled!==this.options.disabled){this._setOptions({"disabled":isDisabled});}}}]);var widgetsCheckboxradio=$.ui.checkboxradio;$.widget("ui.button",{version:"1.13.2",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:true},_getCreateOptions:function(){var disabled,options=this._super()||{};this.isInput=this.element.is("input");disabled=this.element[0].disabled;if(disabled!=null){options.disabled=disabled;}
this.originalLabel=this.isInput?this.element.val():this.element.html();if(this.originalLabel){options.label=this.originalLabel;}
return options;},_create:function(){if(!this.option.showLabel&!this.options.icon){this.options.showLabel=true;}
if(this.options.disabled==null){this.options.disabled=this.element[0].disabled||false;}
this.hasTitle=!!this.element.attr("title");if(this.options.label&&this.options.label!==this.originalLabel){if(this.isInput){this.element.val(this.options.label);}else{this.element.html(this.options.label);}}
this._addClass("ui-button","ui-widget");this._setOption("disabled",this.options.disabled);this._enhance();if(this.element.is("a")){this._on({"keyup":function(event){if(event.keyCode===$.ui.keyCode.SPACE){event.preventDefault();if(this.element[0].click){this.element[0].click();}else{this.element.trigger("click");}}}});}},_enhance:function(){if(!this.element.is("button")){this.element.attr("role","button");}
if(this.options.icon){this._updateIcon("icon",this.options.icon);this._updateTooltip();}},_updateTooltip:function(){this.title=this.element.attr("title");if(!this.options.showLabel&&!this.title){this.element.attr("title",this.options.label);}},_updateIcon:function(option,value){var icon=option!=="iconPosition",position=icon?this.options.iconPosition:value,displayBlock=position==="top"||position==="bottom";if(!this.icon){this.icon=$("<span>");this._addClass(this.icon,"ui-button-icon","ui-icon");if(!this.options.showLabel){this._addClass("ui-button-icon-only");}}else if(icon){this._removeClass(this.icon,null,this.options.icon);}
if(icon){this._addClass(this.icon,null,value);}
this._attachIcon(position);if(displayBlock){this._addClass(this.icon,null,"ui-widget-icon-block");if(this.iconSpace){this.iconSpace.remove();}}else{if(!this.iconSpace){this.iconSpace=$("<span> </span>");this._addClass(this.iconSpace,"ui-button-icon-space");}
this._removeClass(this.icon,null,"ui-wiget-icon-block");this._attachIconSpace(position);}},_destroy:function(){this.element.removeAttr("role");if(this.icon){this.icon.remove();}
if(this.iconSpace){this.iconSpace.remove();}
if(!this.hasTitle){this.element.removeAttr("title");}},_attachIconSpace:function(iconPosition){this.icon[/^(?:end|bottom)/.test(iconPosition)?"before":"after"](this.iconSpace);},_attachIcon:function(iconPosition){this.element[/^(?:end|bottom)/.test(iconPosition)?"append":"prepend"](this.icon);},_setOptions:function(options){var newShowLabel=options.showLabel===undefined?this.options.showLabel:options.showLabel,newIcon=options.icon===undefined?this.options.icon:options.icon;if(!newShowLabel&&!newIcon){options.showLabel=true;}
this._super(options);},_setOption:function(key,value){if(key==="icon"){if(value){this._updateIcon(key,value);}else if(this.icon){this.icon.remove();if(this.iconSpace){this.iconSpace.remove();}}}
if(key==="iconPosition"){this._updateIcon(key,value);}
if(key==="showLabel"){this._toggleClass("ui-button-icon-only",null,!value);this._updateTooltip();}
if(key==="label"){if(this.isInput){this.element.val(value);}else{this.element.html(value);if(this.icon){this._attachIcon(this.options.iconPosition);this._attachIconSpace(this.options.iconPosition);}}}
this._super(key,value);if(key==="disabled"){this._toggleClass(null,"ui-state-disabled",value);this.element[0].disabled=value;if(value){this.element.trigger("blur");}}},refresh:function(){var isDisabled=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");if(isDisabled!==this.options.disabled){this._setOptions({disabled:isDisabled});}
this._updateTooltip();}});if($.uiBackCompat!==false){$.widget("ui.button",$.ui.button,{options:{text:true,icons:{primary:null,secondary:null}},_create:function(){if(this.options.showLabel&&!this.options.text){this.options.showLabel=this.options.text;}
if(!this.options.showLabel&&this.options.text){this.options.text=this.options.showLabel;}
if(!this.options.icon&&(this.options.icons.primary||this.options.icons.secondary)){if(this.options.icons.primary){this.options.icon=this.options.icons.primary;}else{this.options.icon=this.options.icons.secondary;this.options.iconPosition="end";}}else if(this.options.icon){this.options.icons.primary=this.options.icon;}
this._super();},_setOption:function(key,value){if(key==="text"){this._super("showLabel",value);return;}
if(key==="showLabel"){this.options.text=value;}
if(key==="icon"){this.options.icons.primary=value;}
if(key==="icons"){if(value.primary){this._super("icon",value.primary);this._super("iconPosition","beginning");}else if(value.secondary){this._super("icon",value.secondary);this._super("iconPosition","end");}}
this._superApply(arguments);}});$.fn.button=(function(orig){return function(options){var isMethodCall=typeof options==="string";var args=Array.prototype.slice.call(arguments,1);var returnValue=this;if(isMethodCall){if(!this.length&&options==="instance"){returnValue=undefined;}else{this.each(function(){var methodValue;var type=$(this).attr("type");var name=type!=="checkbox"&&type!=="radio"?"button":"checkboxradio";var instance=$.data(this,"ui-"+name);if(options==="instance"){returnValue=instance;return false;}
if(!instance){return $.error("cannot call methods on button"+" prior to initialization; "+"attempted to call method '"+options+"'");}
if(typeof instance[options]!=="function"||options.charAt(0)==="_"){return $.error("no such method '"+options+"' for button"+" widget instance");}
methodValue=instance[options].apply(instance,args);if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue&&methodValue.jquery?returnValue.pushStack(methodValue.get()):methodValue;return false;}});}}else{if(args.length){options=$.widget.extend.apply(null,[options].concat(args));}
this.each(function(){var type=$(this).attr("type");var name=type!=="checkbox"&&type!=="radio"?"button":"checkboxradio";var instance=$.data(this,"ui-"+name);if(instance){instance.option(options||{});if(instance._init){instance._init();}}else{if(name==="button"){orig.call($(this),options);return;}
$(this).checkboxradio($.extend({icon:false},options));}});}
return returnValue;};})($.fn.button);$.fn.buttonset=function(){if(!$.ui.controlgroup){$.error("Controlgroup widget missing");}
if(arguments[0]==="option"&&arguments[1]==="items"&&arguments[2]){return this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]);}
if(arguments[0]==="option"&&arguments[1]==="items"){return this.controlgroup.apply(this,[arguments[0],"items.button"]);}
if(typeof arguments[0]==="object"&&arguments[0].items){arguments[0].items={button:arguments[0].items};}
return this.controlgroup.apply(this,arguments);};}
var widgetsButton=$.ui.button;$.extend($.ui,{datepicker:{version:"1.13.2"}});var datepicker_instActive;function datepicker_getZindex(elem){var position,value;while(elem.length&&elem[0]!==document){position=elem.css("position");if(position==="absolute"||position==="relative"||position==="fixed"){value=parseInt(elem.css("zIndex"),10);if(!isNaN(value)&&value!==0){return value;}}
elem=elem.parent();}
return 0;}
function Datepicker(){this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:"",selectMonthLabel:"Select month",selectYearLabel:"Select year"};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,onUpdateDatepicker:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false,disabled:false};$.extend(this._defaults,this.regional[""]);this.regional.en=$.extend(true,{},this.regional[""]);this.regional["en-US"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));}
$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv;},setDefaults:function(settings){datepicker_extendRemove(this._defaults,settings||{});return this;},_attachDatepicker:function(target,settings){var nodeName,inline,inst;nodeName=target.nodeName.toLowerCase();inline=(nodeName==="div"||nodeName==="span");if(!target.id){this.uuid+=1;target.id="dp"+this.uuid;}
inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{});if(nodeName==="input"){this._connectDatepicker(target,inst);}else if(inline){this._inlineDatepicker(target,inst);}},_newInst:function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:datepicker_bindHover($("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return;}
this._attachments(input,inst);input.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp);this._autoSize(inst);$.data(target,"datepicker",inst);if(inst.settings.disabled){this._disableDatepicker(target);}},_attachments:function(input,inst){var showOn,buttonText,buttonImage,appendText=this._get(inst,"appendText"),isRTL=this._get(inst,"isRTL");if(inst.append){inst.append.remove();}
if(appendText){inst.append=$("<span>").addClass(this._appendClass).text(appendText);input[isRTL?"before":"after"](inst.append);}
input.off("focus",this._showDatepicker);if(inst.trigger){inst.trigger.remove();}
showOn=this._get(inst,"showOn");if(showOn==="focus"||showOn==="both"){input.on("focus",this._showDatepicker);}
if(showOn==="button"||showOn==="both"){buttonText=this._get(inst,"buttonText");buttonImage=this._get(inst,"buttonImage");if(this._get(inst,"buttonImageOnly")){inst.trigger=$("<img>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText});}else{inst.trigger=$("<button type='button'>").addClass(this._triggerClass);if(buttonImage){inst.trigger.html($("<img>").attr({src:buttonImage,alt:buttonText,title:buttonText}));}else{inst.trigger.text(buttonText);}}
input[isRTL?"before":"after"](inst.trigger);inst.trigger.on("click",function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput===input[0]){$.datepicker._hideDatepicker();}else if($.datepicker._datepickerShowing&&$.datepicker._lastInput!==input[0]){$.datepicker._hideDatepicker();$.datepicker._showDatepicker(input[0]);}else{$.datepicker._showDatepicker(input[0]);}
return false;});}},_autoSize:function(inst){if(this._get(inst,"autoSize")&&!inst.inline){var findMax,max,maxI,i,date=new Date(2009,12-1,20),dateFormat=this._get(inst,"dateFormat");if(dateFormat.match(/[DM]/)){findMax=function(names){max=0;maxI=0;for(i=0;i<names.length;i++){if(names[i].length>max){max=names[i].length;maxI=i;}}
return maxI;};date.setMonth(findMax(this._get(inst,(dateFormat.match(/MM/)?"monthNames":"monthNamesShort"))));date.setDate(findMax(this._get(inst,(dateFormat.match(/DD/)?"dayNames":"dayNamesShort")))+20-date.getDay());}
inst.input.attr("size",this._formatDate(inst,date).length);}},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return;}
divSpan.addClass(this.markerClassName).append(inst.dpDiv);$.data(target,"datepicker",inst);this._setDate(inst,this._getDefaultDate(inst),true);this._updateDatepicker(inst);this._updateAlternate(inst);if(inst.settings.disabled){this._disableDatepicker(target);}
inst.dpDiv.css("display","block");},_dialogDatepicker:function(input,date,onSelect,settings,pos){var id,browserWidth,browserHeight,scrollX,scrollY,inst=this._dialogInst;if(!inst){this.uuid+=1;id="dp"+this.uuid;this._dialogInput=$("<input type='text' id='"+id+"' style='position: absolute; top: -100px; width: 0px;'/>");this._dialogInput.on("keydown",this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],"datepicker",inst);}
datepicker_extendRemove(inst.settings,settings||{});date=(date&&date.constructor===Date?this._formatDate(inst,date):date);this._dialogInput.val(date);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){browserWidth=document.documentElement.clientWidth;browserHeight=document.documentElement.clientHeight;scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY];}
this._dialogInput.css("left",(this._pos[0]+20)+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv);}
$.data(this._dialogInput[0],"datepicker",inst);return this;},_destroyDatepicker:function(target){var nodeName,$target=$(target),inst=$.data(target,"datepicker");if(!$target.hasClass(this.markerClassName)){return;}
nodeName=target.nodeName.toLowerCase();$.removeData(target,"datepicker");if(nodeName==="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp);}else if(nodeName==="div"||nodeName==="span"){$target.removeClass(this.markerClassName).empty();}
if(datepicker_instActive===inst){datepicker_instActive=null;this._curInst=null;}},_enableDatepicker:function(target){var nodeName,inline,$target=$(target),inst=$.data(target,"datepicker");if(!$target.hasClass(this.markerClassName)){return;}
nodeName=target.nodeName.toLowerCase();if(nodeName==="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false;}).end().filter("img").css({opacity:"1.0",cursor:""});}else if(nodeName==="div"||nodeName==="span"){inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",false);}
this._disabledInputs=$.map(this._disabledInputs,function(value){return(value===target?null:value);});},_disableDatepicker:function(target){var nodeName,inline,$target=$(target),inst=$.data(target,"datepicker");if(!$target.hasClass(this.markerClassName)){return;}
nodeName=target.nodeName.toLowerCase();if(nodeName==="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true;}).end().filter("img").css({opacity:"0.5",cursor:"default"});}else if(nodeName==="div"||nodeName==="span"){inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",true);}
this._disabledInputs=$.map(this._disabledInputs,function(value){return(value===target?null:value);});this._disabledInputs[this._disabledInputs.length]=target;},_isDisabledDatepicker:function(target){if(!target){return false;}
for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]===target){return true;}}
return false;},_getInst:function(target){try{return $.data(target,"datepicker");}catch(err){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(target,name,value){var settings,date,minDate,maxDate,inst=this._getInst(target);if(arguments.length===2&&typeof name==="string"){return(name==="defaults"?$.extend({},$.datepicker._defaults):(inst?(name==="all"?$.extend({},inst.settings):this._get(inst,name)):null));}
settings=name||{};if(typeof name==="string"){settings={};settings[name]=value;}
if(inst){if(this._curInst===inst){this._hideDatepicker();}
date=this._getDateDatepicker(target,true);minDate=this._getMinMaxDate(inst,"min");maxDate=this._getMinMaxDate(inst,"max");datepicker_extendRemove(inst.settings,settings);if(minDate!==null&&settings.dateFormat!==undefined&&settings.minDate===undefined){inst.settings.minDate=this._formatDate(inst,minDate);}
if(maxDate!==null&&settings.dateFormat!==undefined&&settings.maxDate===undefined){inst.settings.maxDate=this._formatDate(inst,maxDate);}
if("disabled" in settings){if(settings.disabled){this._disableDatepicker(target);}else{this._enableDatepicker(target);}}
this._attachments($(target),inst);this._autoSize(inst);this._setDate(inst,date);this._updateAlternate(inst);this._updateDatepicker(inst);}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value);},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst);}},_setDateDatepicker:function(target,date){var inst=this._getInst(target);if(inst){this._setDate(inst,date);this._updateDatepicker(inst);this._updateAlternate(inst);}},_getDateDatepicker:function(target,noDefault){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst,noDefault);}
return(inst?this._getDate(inst):null);},_doKeyDown:function(event){var onSelect,dateStr,sel,inst=$.datepicker._getInst(event.target),handled=true,isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker();handled=false;break;case 13:sel=$("td."+$.datepicker._dayOverClass+":not(."+
$.datepicker._currentClass+")",inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0]);}
onSelect=$.datepicker._get(inst,"onSelect");if(onSelect){dateStr=$.datepicker._formatDate(inst);onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst]);}else{$.datepicker._hideDatepicker();}
return false;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target);}
handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target);}
handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D");}
handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");}
break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D");}
handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D");}
handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");}
break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D");}
handled=event.ctrlKey||event.metaKey;break;default:handled=false;}}else if(event.keyCode===36&&event.ctrlKey){$.datepicker._showDatepicker(this);}else{handled=false;}
if(handled){event.preventDefault();event.stopPropagation();}},_doKeyPress:function(event){var chars,chr,inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));chr=String.fromCharCode(event.charCode==null?event.keyCode:event.charCode);return event.ctrlKey||event.metaKey||(chr<" "||!chars||chars.indexOf(chr)>-1);}},_doKeyUp:function(event){var date,inst=$.datepicker._getInst(event.target);if(inst.input.val()!==inst.lastVal){try{date=$.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),(inst.input?inst.input.val():null),$.datepicker._getFormatConfig(inst));if(date){$.datepicker._setDateFromField(inst);$.datepicker._updateAlternate(inst);$.datepicker._updateDatepicker(inst);}}catch(err){}}
return true;},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!=="input"){input=$("input",input.parentNode)[0];}
if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput===input){return;}
var inst,beforeShow,beforeShowSettings,isFixed,offset,showAnim,duration;inst=$.datepicker._getInst(input);if($.datepicker._curInst&&$.datepicker._curInst!==inst){$.datepicker._curInst.dpDiv.stop(true,true);if(inst&&$.datepicker._datepickerShowing){$.datepicker._hideDatepicker($.datepicker._curInst.input[0]);}}
beforeShow=$.datepicker._get(inst,"beforeShow");beforeShowSettings=beforeShow?beforeShow.apply(input,[input,inst]):{};if(beforeShowSettings===false){return;}
datepicker_extendRemove(inst.settings,beforeShowSettings);inst.lastVal=null;$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value="";}
if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight;}
isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")==="fixed";return!isFixed;});offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.dpDiv.empty();inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){showAnim=$.datepicker._get(inst,"showAnim");duration=$.datepicker._get(inst,"duration");inst.dpDiv.css("z-index",datepicker_getZindex($(input))+1);$.datepicker._datepickerShowing=true;if($.effects&&$.effects.effect[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration);}else{inst.dpDiv[showAnim||"show"](showAnim?duration:null);}
if($.datepicker._shouldFocusInput(inst)){inst.input.trigger("focus");}
$.datepicker._curInst=inst;}},_updateDatepicker:function(inst){this.maxRows=4;datepicker_instActive=inst;inst.dpDiv.empty().append(this._generateHTML(inst));this._attachHandlers(inst);var origyearshtml,numMonths=this._getNumberOfMonths(inst),cols=numMonths[1],width=17,activeCell=inst.dpDiv.find("."+this._dayOverClass+" a"),onUpdateDatepicker=$.datepicker._get(inst,"onUpdateDatepicker");if(activeCell.length>0){datepicker_handleMouseover.apply(activeCell.get(0));}
inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em");}
inst.dpDiv[(numMonths[0]!==1||numMonths[1]!==1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst===$.datepicker._curInst&&$.datepicker._datepickerShowing&&$.datepicker._shouldFocusInput(inst)){inst.input.trigger("focus");}
if(inst.yearshtml){origyearshtml=inst.yearshtml;setTimeout(function(){if(origyearshtml===inst.yearshtml&&inst.yearshtml){inst.dpDiv.find("select.ui-datepicker-year").first().replaceWith(inst.yearshtml);}
origyearshtml=inst.yearshtml=null;},0);}
if(onUpdateDatepicker){onUpdateDatepicker.apply((inst.input?inst.input[0]:null),[inst]);}},_shouldFocusInput:function(inst){return inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")&&!inst.input.is(":focus");},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth(),dpHeight=inst.dpDiv.outerHeight(),inputWidth=inst.input?inst.input.outerWidth():0,inputHeight=inst.input?inst.input.outerHeight():0,viewWidth=document.documentElement.clientWidth+(isFixed?0:$(document).scrollLeft()),viewHeight=document.documentElement.clientHeight+(isFixed?0:$(document).scrollTop());offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left===inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top===(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=Math.min(offset.left,(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0);offset.top-=Math.min(offset.top,(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(dpHeight+inputHeight):0);return offset;},_findPos:function(obj){var position,inst=this._getInst(obj),isRTL=this._get(inst,"isRTL");while(obj&&(obj.type==="hidden"||obj.nodeType!==1||$.expr.pseudos.hidden(obj))){obj=obj[isRTL?"previousSibling":"nextSibling"];}
position=$(obj).offset();return[position.left,position.top];},_hideDatepicker:function(input){var showAnim,duration,postProcess,onClose,inst=this._curInst;if(!inst||(input&&inst!==$.data(input,"datepicker"))){return;}
if(this._datepickerShowing){showAnim=this._get(inst,"showAnim");duration=this._get(inst,"duration");postProcess=function(){$.datepicker._tidyDialog(inst);};if($.effects&&($.effects.effect[showAnim]||$.effects[showAnim])){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess);}else{inst.dpDiv[(showAnim==="slideDown"?"slideUp":(showAnim==="fadeIn"?"fadeOut":"hide"))]((showAnim?duration:null),postProcess);}
if(!showAnim){postProcess();}
this._datepickerShowing=false;onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst]);}
this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv);}}
this._inDialog=false;}},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar");},_checkExternalClick:function(event){if(!$.datepicker._curInst){return;}
var $target=$(event.target),inst=$.datepicker._getInst($target[0]);if((($target[0].id!==$.datepicker._mainDivId&&$target.parents("#"+$.datepicker._mainDivId).length===0&&!$target.hasClass($.datepicker.markerClassName)&&!$target.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)))||($target.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!==inst)){$.datepicker._hideDatepicker();}},_adjustDate:function(id,offset,period){var target=$(id),inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return;}
this._adjustInstDate(inst,offset,period);this._updateDatepicker(inst);},_gotoToday:function(id){var date,target=$(id),inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear;}else{date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();}
this._notifyChange(inst);this._adjustDate(target);},_selectMonthYear:function(id,select,period){var target=$(id),inst=this._getInst(target[0]);inst["selected"+(period==="M"?"Month":"Year")]=inst["draw"+(period==="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target);},_selectDay:function(id,month,year,td){var inst,target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return;}
inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=parseInt($("a",td).attr("data-date"));inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));},_clearDate:function(id){var target=$(id);this._selectDate(target,"");},_selectDate:function(id,dateStr){var onSelect,target=$(id),inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr);}
this._updateAlternate(inst);onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst]);}else if(inst.input){inst.input.trigger("change");}
if(inst.inline){this._updateDatepicker(inst);}else{this._hideDatepicker();this._lastInput=inst.input[0];if(typeof(inst.input[0])!=="object"){inst.input.trigger("focus");}
this._lastInput=null;}},_updateAlternate:function(inst){var altFormat,date,dateStr,altField=this._get(inst,"altField");if(altField){altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(document).find(altField).val(dateStr);}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""];},iso8601Week:function(date){var time,checkDate=new Date(date.getTime());checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7));time=checkDate.getTime();checkDate.setMonth(0);checkDate.setDate(1);return Math.floor(Math.round((time-checkDate)/86400000)/7)+1;},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments";}
value=(typeof value==="object"?value.toString():value+"");if(value===""){return null;}
var iFormat,dim,extra,iValue=0,shortYearCutoffTemp=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff,shortYearCutoff=(typeof shortYearCutoffTemp!=="string"?shortYearCutoffTemp:new Date().getFullYear()%100+parseInt(shortYearCutoffTemp,10)),dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,year=-1,month=-1,day=-1,doy=-1,literal=false,date,lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)===match);if(matches){iFormat++;}
return matches;},getNumber=function(match){var isDoubled=lookAhead(match),size=(match==="@"?14:(match==="!"?20:(match==="y"&&isDoubled?4:(match==="o"?3:2)))),minSize=(match==="y"?size:1),digits=new RegExp("^\\d{"+minSize+","+size+"}"),num=value.substring(iValue).match(digits);if(!num){throw"Missing number at position "+iValue;}
iValue+=num[0].length;return parseInt(num[0],10);},getName=function(match,shortNames,longNames){var index=-1,names=$.map(lookAhead(match)?longNames:shortNames,function(v,k){return[[k,v]];}).sort(function(a,b){return-(a[1].length-b[1].length);});$.each(names,function(i,pair){var name=pair[1];if(value.substr(iValue,name.length).toLowerCase()===name.toLowerCase()){index=pair[0];iValue+=name.length;return false;}});if(index!==-1){return index+1;}else{throw"Unknown name at position "+iValue;}},checkLiteral=function(){if(value.charAt(iValue)!==format.charAt(iFormat)){throw"Unexpected literal at position "+iValue;}
iValue++;};for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false;}else{checkLiteral();}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"!":date=new Date((getNumber("!")-this._ticksTo1970)/10000);year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral();}else{literal=true;}
break;default:checkLiteral();}}}
if(iValue<value.length){extra=value.substr(iValue);if(!/^\s+/.test(extra)){throw"Extra/unparsed characters found in date: "+extra;}}
if(year===-1){year=new Date().getFullYear();}else if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+
(year<=shortYearCutoff?0:-100);}
if(doy>-1){month=1;day=doy;do{dim=this._getDaysInMonth(year,month-1);if(day<=dim){break;}
month++;day-=dim;}while(true);}
date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!==year||date.getMonth()+1!==month||date.getDate()!==day){throw"Invalid date";}
return date;},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+
Math.floor(1970/400))*24*60*60*10000000),formatDate:function(format,date,settings){if(!date){return"";}
var iFormat,dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)===match);if(matches){iFormat++;}
return matches;},formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num;}}
return num;},formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value]);},output="",literal=false;if(date){for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false;}else{output+=format.charAt(iFormat);}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":output+=formatNumber("o",Math.round((new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime()-new Date(date.getFullYear(),0,0).getTime())/86400000),3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getFullYear()%100<10?"0":"")+date.getFullYear()%100);break;case"@":output+=date.getTime();break;case"!":output+=date.getTime()*10000+this._ticksTo1970;break;case"'":if(lookAhead("'")){output+="'";}else{literal=true;}
break;default:output+=format.charAt(iFormat);}}}}
return output;},_possibleChars:function(format){var iFormat,chars="",literal=false,lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)===match);if(matches){iFormat++;}
return matches;};for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false;}else{chars+=format.charAt(iFormat);}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'";}else{literal=true;}
break;default:chars+=format.charAt(iFormat);}}}
return chars;},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name];},_setDateFromField:function(inst,noDefault){if(inst.input.val()===inst.lastVal){return;}
var dateFormat=this._get(inst,"dateFormat"),dates=inst.lastVal=inst.input?inst.input.val():null,defaultDate=this._getDefaultDate(inst),date=defaultDate,settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate;}catch(event){dates=(noDefault?"":dates);}
inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst);},_getDefaultDate:function(inst){return this._restrictMinMax(inst,this._determineDate(inst,this._get(inst,"defaultDate"),new Date()));},_determineDate:function(inst,date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date;},offsetString=function(offset){try{return $.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),offset,$.datepicker._getFormatConfig(inst));}catch(e){}
var date=(offset.toLowerCase().match(/^c/)?$.datepicker._getDate(inst):null)||new Date(),year=date.getFullYear(),month=date.getMonth(),day=date.getDate(),pattern=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break;}
matches=pattern.exec(offset);}
return new Date(year,month,day);},newDate=(date==null||date===""?defaultDate:(typeof date==="string"?offsetString(date):(typeof date==="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):new Date(date.getTime()))));newDate=(newDate&&newDate.toString()==="Invalid Date"?defaultDate:newDate);if(newDate){newDate.setHours(0);newDate.setMinutes(0);newDate.setSeconds(0);newDate.setMilliseconds(0);}
return this._daylightSavingAdjust(newDate);},_daylightSavingAdjust:function(date){if(!date){return null;}
date.setHours(date.getHours()>12?date.getHours()+2:0);return date;},_setDate:function(inst,date,noChange){var clear=!date,origMonth=inst.selectedMonth,origYear=inst.selectedYear,newDate=this._restrictMinMax(inst,this._determineDate(inst,date,new Date()));inst.selectedDay=inst.currentDay=newDate.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear();if((origMonth!==inst.selectedMonth||origYear!==inst.selectedYear)&&!noChange){this._notifyChange(inst);}
this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst));}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()==="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate;},_attachHandlers:function(inst){var stepMonths=this._get(inst,"stepMonths"),id="#"+inst.id.replace(/\\\\/g,"\\");inst.dpDiv.find("[data-handler]").map(function(){var handler={prev:function(){$.datepicker._adjustDate(id,-stepMonths,"M");},next:function(){$.datepicker._adjustDate(id,+stepMonths,"M");},hide:function(){$.datepicker._hideDatepicker();},today:function(){$.datepicker._gotoToday(id);},selectDay:function(){$.datepicker._selectDay(id,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this);return false;},selectMonth:function(){$.datepicker._selectMonthYear(id,this,"M");return false;},selectYear:function(){$.datepicker._selectMonthYear(id,this,"Y");return false;}};$(this).on(this.getAttribute("data-event"),handler[this.getAttribute("data-handler")]);});},_generateHTML:function(inst){var maxDraw,prevText,prev,nextText,next,currentText,gotoDate,controls,buttonPanel,firstDay,showWeek,dayNames,dayNamesMin,monthNames,monthNamesShort,beforeShowDay,showOtherMonths,selectOtherMonths,defaultDate,html,dow,row,group,col,selectedDate,cornerClass,calender,thead,day,daysInMonth,leadDays,curRows,numRows,printDate,dRow,tbody,daySettings,otherMonth,unselectable,tempDate=new Date(),today=this._daylightSavingAdjust(new Date(tempDate.getFullYear(),tempDate.getMonth(),tempDate.getDate())),isRTL=this._get(inst,"isRTL"),showButtonPanel=this._get(inst,"showButtonPanel"),hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext"),navigationAsDateFormat=this._get(inst,"navigationAsDateFormat"),numMonths=this._getNumberOfMonths(inst),showCurrentAtPos=this._get(inst,"showCurrentAtPos"),stepMonths=this._get(inst,"stepMonths"),isMultiMonth=(numMonths[0]!==1||numMonths[1]!==1),currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay))),minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),drawMonth=inst.drawMonth-showCurrentAtPos,drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--;}
if(maxDate){maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-(numMonths[0]*numMonths[1])+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--;}}}
inst.drawMonth=drawMonth;inst.drawYear=drawYear;prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));if(this._canAdjustMonth(inst,-1,drawYear,drawMonth)){prev=$("<a>").attr({"class":"ui-datepicker-prev ui-corner-all","data-handler":"prev","data-event":"click",title:prevText}).append($("<span>").addClass("ui-icon ui-icon-circle-triangle-"+
(isRTL?"e":"w")).text(prevText))[0].outerHTML;}else if(hideIfNoPrevNext){prev="";}else{prev=$("<a>").attr({"class":"ui-datepicker-prev ui-corner-all ui-state-disabled",title:prevText}).append($("<span>").addClass("ui-icon ui-icon-circle-triangle-"+
(isRTL?"e":"w")).text(prevText))[0].outerHTML;}
nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));if(this._canAdjustMonth(inst,+1,drawYear,drawMonth)){next=$("<a>").attr({"class":"ui-datepicker-next ui-corner-all","data-handler":"next","data-event":"click",title:nextText}).append($("<span>").addClass("ui-icon ui-icon-circle-triangle-"+
(isRTL?"w":"e")).text(nextText))[0].outerHTML;}else if(hideIfNoPrevNext){next="";}else{next=$("<a>").attr({"class":"ui-datepicker-next ui-corner-all ui-state-disabled",title:nextText}).append($("<span>").attr("class","ui-icon ui-icon-circle-triangle-"+
(isRTL?"w":"e")).text(nextText))[0].outerHTML;}
currentText=this._get(inst,"currentText");gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));controls="";if(!inst.inline){controls=$("<button>").attr({type:"button","class":"ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all","data-handler":"hide","data-event":"click"}).text(this._get(inst,"closeText"))[0].outerHTML;}
buttonPanel="";if(showButtonPanel){buttonPanel=$("<div class='ui-datepicker-buttonpane ui-widget-content'>").append(isRTL?controls:"").append(this._isInRange(inst,gotoDate)?$("<button>").attr({type:"button","class":"ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all","data-handler":"today","data-event":"click"}).text(currentText):"").append(isRTL?"":controls)[0].outerHTML;}
firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);showWeek=this._get(inst,"showWeek");dayNames=this._get(inst,"dayNames");dayNamesMin=this._get(inst,"dayNamesMin");monthNames=this._get(inst,"monthNames");monthNamesShort=this._get(inst,"monthNamesShort");beforeShowDay=this._get(inst,"beforeShowDay");showOtherMonths=this._get(inst,"showOtherMonths");selectOtherMonths=this._get(inst,"selectOtherMonths");defaultDate=this._getDefaultDate(inst);html="";for(row=0;row<numMonths[0];row++){group="";this.maxRows=4;for(col=0;col<numMonths[1];col++){selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));cornerClass=" ui-corner-all";calender="";if(isMultiMonth){calender+="<div class='ui-datepicker-group";if(numMonths[1]>1){switch(col){case 0:calender+=" ui-datepicker-group-first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle";cornerClass="";break;}}
calender+="'>";}
calender+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+cornerClass+"'>"+
(/all|left/.test(cornerClass)&&row===0?(isRTL?next:prev):"")+
(/all|right/.test(cornerClass)&&row===0?(isRTL?prev:next):"")+
this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>";thead=(showWeek?"<th class='ui-datepicker-week-col'>"+this._get(inst,"weekHeader")+"</th>":"");for(dow=0;dow<7;dow++){day=(dow+firstDay)%7;thead+="<th scope='col'"+((dow+firstDay+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+dayNames[day]+"'>"+dayNamesMin[day]+"</span></th>";}
calender+=thead+"</tr></thead><tbody>";daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear===inst.selectedYear&&drawMonth===inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth);}
leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;curRows=Math.ceil((leadDays+daysInMonth)/7);numRows=(isMultiMonth?this.maxRows>curRows?this.maxRows:curRows:curRows);this.maxRows=numRows;printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(dRow=0;dRow<numRows;dRow++){calender+="<tr>";tbody=(!showWeek?"":"<td class='ui-datepicker-week-col'>"+
this._get(inst,"calculateWeek")(printDate)+"</td>");for(dow=0;dow<7;dow++){daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);otherMonth=(printDate.getMonth()!==drawMonth);unselectable=(otherMonth&&!selectOtherMonths)||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+="<td class='"+
((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+
(otherMonth?" ui-datepicker-other-month":"")+
((printDate.getTime()===selectedDate.getTime()&&drawMonth===inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()===printDate.getTime()&&defaultDate.getTime()===selectedDate.getTime())?" "+this._dayOverClass:"")+
(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+
(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+
(printDate.getTime()===currentDate.getTime()?" "+this._currentClass:"")+
(printDate.getTime()===today.getTime()?" ui-datepicker-today":""))+"'"+
((!otherMonth||showOtherMonths)&&daySettings[2]?" title='"+daySettings[2].replace(/'/g,"&#39;")+"'":"")+
(unselectable?"":" data-handler='selectDay' data-event='click' data-month='"+printDate.getMonth()+"' data-year='"+printDate.getFullYear()+"'")+">"+
(otherMonth&&!showOtherMonths?"&#xa0;":(unselectable?"<span class='ui-state-default'>"+printDate.getDate()+"</span>":"<a class='ui-state-default"+
(printDate.getTime()===today.getTime()?" ui-state-highlight":"")+
(printDate.getTime()===currentDate.getTime()?" ui-state-active":"")+
(otherMonth?" ui-priority-secondary":"")+"' href='#' aria-current='"+(printDate.getTime()===currentDate.getTime()?"true":"false")+"' data-date='"+printDate.getDate()+"'>"+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate);}
calender+=tbody+"</tr>";}
drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++;}
calender+="</tbody></table>"+(isMultiMonth?"</div>"+
((numMonths[0]>0&&col===numMonths[1]-1)?"<div class='ui-datepicker-row-break'></div>":""):"");group+=calender;}
html+=group;}
html+=buttonPanel;inst._keyEvent=false;return html;},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var inMinYear,inMaxYear,month,years,thisYear,determineYear,year,endYear,changeMonth=this._get(inst,"changeMonth"),changeYear=this._get(inst,"changeYear"),showMonthAfterYear=this._get(inst,"showMonthAfterYear"),selectMonthLabel=this._get(inst,"selectMonthLabel"),selectYearLabel=this._get(inst,"selectYearLabel"),html="<div class='ui-datepicker-title'>",monthHtml="";if(secondary||!changeMonth){monthHtml+="<span class='ui-datepicker-month'>"+monthNames[drawMonth]+"</span>";}else{inMinYear=(minDate&&minDate.getFullYear()===drawYear);inMaxYear=(maxDate&&maxDate.getFullYear()===drawYear);monthHtml+="<select class='ui-datepicker-month' aria-label='"+selectMonthLabel+"' data-handler='selectMonth' data-event='change'>";for(month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+="<option value='"+month+"'"+
(month===drawMonth?" selected='selected'":"")+">"+monthNamesShort[month]+"</option>";}}
monthHtml+="</select>";}
if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?"&#xa0;":"");}
if(!inst.yearshtml){inst.yearshtml="";if(secondary||!changeYear){html+="<span class='ui-datepicker-year'>"+drawYear+"</span>";}else{years=this._get(inst,"yearRange").split(":");thisYear=new Date().getFullYear();determineYear=function(value){var year=(value.match(/c[+\-].*/)?drawYear+parseInt(value.substring(1),10):(value.match(/[+\-].*/)?thisYear+parseInt(value,10):parseInt(value,10)));return(isNaN(year)?thisYear:year);};year=determineYear(years[0]);endYear=Math.max(year,determineYear(years[1]||""));year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);inst.yearshtml+="<select class='ui-datepicker-year' aria-label='"+selectYearLabel+"' data-handler='selectYear' data-event='change'>";for(;year<=endYear;year++){inst.yearshtml+="<option value='"+year+"'"+
(year===drawYear?" selected='selected'":"")+">"+year+"</option>";}
inst.yearshtml+="</select>";html+=inst.yearshtml;inst.yearshtml=null;}}
html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")+monthHtml;}
html+="</div>";return html;},_adjustInstDate:function(inst,offset,period){var year=inst.selectedYear+(period==="Y"?offset:0),month=inst.selectedMonth+(period==="M"?offset:0),day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period==="D"?offset:0),date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period==="M"||period==="Y"){this._notifyChange(inst);}},_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),newDate=(minDate&&date<minDate?minDate:date);return(maxDate&&newDate>maxDate?maxDate:newDate);},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst]);}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths==="number"?[1,numMonths]:numMonths));},_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null);},_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new Date(year,month,32)).getDate();},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay();},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst),date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()));}
return this._isInRange(inst,date);},_isInRange:function(inst,date){var yearSplit,currentYear,minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),minYear=null,maxYear=null,years=this._get(inst,"yearRange");if(years){yearSplit=years.split(":");currentYear=new Date().getFullYear();minYear=parseInt(yearSplit[0],10);maxYear=parseInt(yearSplit[1],10);if(yearSplit[0].match(/[+\-].*/)){minYear+=currentYear;}
if(yearSplit[1].match(/[+\-].*/)){maxYear+=currentYear;}}
return((!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime())&&(!minYear||date.getFullYear()>=minYear)&&(!maxYear||date.getFullYear()<=maxYear));},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!=="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")};},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear;}
var date=(day?(typeof day==="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst));}});function datepicker_bindHover(dpDiv){var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.on("mouseout",selector,function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!==-1){$(this).removeClass("ui-datepicker-prev-hover");}
if(this.className.indexOf("ui-datepicker-next")!==-1){$(this).removeClass("ui-datepicker-next-hover");}}).on("mouseover",selector,datepicker_handleMouseover);}
function datepicker_handleMouseover(){if(!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline?datepicker_instActive.dpDiv.parent()[0]:datepicker_instActive.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!==-1){$(this).addClass("ui-datepicker-prev-hover");}
if(this.className.indexOf("ui-datepicker-next")!==-1){$(this).addClass("ui-datepicker-next-hover");}}}
function datepicker_extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null){target[name]=props[name];}}
return target;}
$.fn.datepicker=function(options){if(!this.length){return this;}
if(!$.datepicker.initialized){$(document).on("mousedown",$.datepicker._checkExternalClick);$.datepicker.initialized=true;}
if($("#"+$.datepicker._mainDivId).length===0){$("body").append($.datepicker.dpDiv);}
var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options==="string"&&(options==="isDisabled"||options==="getDate"||options==="widget")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs));}
if(options==="option"&&arguments.length===2&&typeof arguments[1]==="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs));}
return this.each(function(){if(typeof options==="string"){$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs));}else{$.datepicker._attachDatepicker(this,options);}});};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.13.2";var widgetsDatepicker=$.datepicker;var ie=$.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var mouseHandled=false;$(document).on("mouseup",function(){mouseHandled=false;});var widgetsMouse=$.widget("ui.mouse",{version:"1.13.2",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var that=this;this.element.on("mousedown."+this.widgetName,function(event){return that._mouseDown(event);}).on("click."+this.widgetName,function(event){if(true===$.data(event.target,that.widgetName+".preventClickEvent")){$.removeData(event.target,that.widgetName+".preventClickEvent");event.stopImmediatePropagation();return false;}});this.started=false;},_mouseDestroy:function(){this.element.off("."+this.widgetName);if(this._mouseMoveDelegate){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate);}},_mouseDown:function(event){if(mouseHandled){return;}
this._mouseMoved=false;if(this._mouseStarted){this._mouseUp(event);}
this._mouseDownEvent=event;var that=this,btnIsLeft=(event.which===1),elIsCancel=(typeof this.options.cancel==="string"&&event.target.nodeName?$(event.target).closest(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true;}
this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){that.mouseDelayMet=true;},this.options.delay);}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(event)!==false);if(!this._mouseStarted){event.preventDefault();return true;}}
if(true===$.data(event.target,this.widgetName+".preventClickEvent")){$.removeData(event.target,this.widgetName+".preventClickEvent");}
this._mouseMoveDelegate=function(event){return that._mouseMove(event);};this._mouseUpDelegate=function(event){return that._mouseUp(event);};this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate);event.preventDefault();mouseHandled=true;return true;},_mouseMove:function(event){if(this._mouseMoved){if($.ui.ie&&(!document.documentMode||document.documentMode<9)&&!event.button){return this._mouseUp(event);}else if(!event.which){if(event.originalEvent.altKey||event.originalEvent.ctrlKey||event.originalEvent.metaKey||event.originalEvent.shiftKey){this.ignoreMissingWhich=true;}else if(!this.ignoreMissingWhich){return this._mouseUp(event);}}}
if(event.which||event.button){this._mouseMoved=true;}
if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault();}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);if(this._mouseStarted){this._mouseDrag(event);}else{this._mouseUp(event);}}
return!this._mouseStarted;},_mouseUp:function(event){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(event.target===this._mouseDownEvent.target){$.data(event.target,this.widgetName+".preventClickEvent",true);}
this._mouseStop(event);}
if(this._mouseDelayTimer){clearTimeout(this._mouseDelayTimer);delete this._mouseDelayTimer;}
this.ignoreMissingWhich=false;mouseHandled=false;event.preventDefault();},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance);},_mouseDelayMet:function(){return this.mouseDelayMet;},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true;}});var plugin=$.ui.plugin={add:function(module,option,set){var i,proto=$.ui[module].prototype;for(i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args,allowDisconnected){var i,set=instance.plugins[name];if(!set){return;}
if(!allowDisconnected&&(!instance.element[0].parentNode||instance.element[0].parentNode.nodeType===11)){return;}
for(i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}};var safeBlur=$.ui.safeBlur=function(element){if(element&&element.nodeName.toLowerCase()!=="body"){$(element).trigger("blur");}};$.widget("ui.draggable",$.ui.mouse,{version:"1.13.2",widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false,drag:null,start:null,stop:null},_create:function(){if(this.options.helper==="original"){this._setPositionRelative();}
if(this.options.addClasses){this._addClass("ui-draggable");}
this._setHandleClassName();this._mouseInit();},_setOption:function(key,value){this._super(key,value);if(key==="handle"){this._removeHandleClassName();this._setHandleClassName();}},_destroy:function(){if((this.helper||this.element).is(".ui-draggable-dragging")){this.destroyOnClear=true;return;}
this._removeHandleClassName();this._mouseDestroy();},_mouseCapture:function(event){var o=this.options;if(this.helper||o.disabled||$(event.target).closest(".ui-resizable-handle").length>0){return false;}
this.handle=this._getHandle(event);if(!this.handle){return false;}
this._blurActiveElement(event);this._blockFrames(o.iframeFix===true?"iframe":o.iframeFix);return true;},_blockFrames:function(selector){this.iframeBlocks=this.document.find(selector).map(function(){var iframe=$(this);return $("<div>").css("position","absolute").appendTo(iframe.parent()).outerWidth(iframe.outerWidth()).outerHeight(iframe.outerHeight()).offset(iframe.offset())[0];});},_unblockFrames:function(){if(this.iframeBlocks){this.iframeBlocks.remove();delete this.iframeBlocks;}},_blurActiveElement:function(event){var activeElement=$.ui.safeActiveElement(this.document[0]),target=$(event.target);if(target.closest(activeElement).length){return;}
$.ui.safeBlur(activeElement);},_mouseStart:function(event){var o=this.options;this.helper=this._createHelper(event);this._addClass(this.helper,"ui-draggable-dragging");this._cacheHelperProportions();if($.ui.ddmanager){$.ui.ddmanager.current=this;}
this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent(true);this.offsetParent=this.helper.offsetParent();this.hasFixedAncestor=this.helper.parents().filter(function(){return $(this).css("position")==="fixed";}).length>0;this.positionAbs=this.element.offset();this._refreshOffsets(event);this.originalPosition=this.position=this._generatePosition(event,false);this.originalPageX=event.pageX;this.originalPageY=event.pageY;if(o.cursorAt){this._adjustOffsetFromHelper(o.cursorAt);}
this._setContainment();if(this._trigger("start",event)===false){this._clear();return false;}
this._cacheHelperProportions();if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event);}
this._mouseDrag(event,true);if($.ui.ddmanager){$.ui.ddmanager.dragStart(this,event);}
return true;},_refreshOffsets:function(event){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:false,parent:this._getParentOffset(),relative:this._getRelativeOffset()};this.offset.click={left:event.pageX-this.offset.left,top:event.pageY-this.offset.top};},_mouseDrag:function(event,noPropagation){if(this.hasFixedAncestor){this.offset.parent=this._getParentOffset();}
this.position=this._generatePosition(event,true);this.positionAbs=this._convertPositionTo("absolute");if(!noPropagation){var ui=this._uiHash();if(this._trigger("drag",event,ui)===false){this._mouseUp(new $.Event("mouseup",event));return false;}
this.position=ui.position;}
this.helper[0].style.left=this.position.left+"px";this.helper[0].style.top=this.position.top+"px";if($.ui.ddmanager){$.ui.ddmanager.drag(this,event);}
return false;},_mouseStop:function(event){var that=this,dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour){dropped=$.ui.ddmanager.drop(this,event);}
if(this.dropped){dropped=this.dropped;this.dropped=false;}
if((this.options.revert==="invalid"&&!dropped)||(this.options.revert==="valid"&&dropped)||this.options.revert===true||(typeof this.options.revert==="function"&&this.options.revert.call(this.element,dropped))){$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){if(that._trigger("stop",event)!==false){that._clear();}});}else{if(this._trigger("stop",event)!==false){this._clear();}}
return false;},_mouseUp:function(event){this._unblockFrames();if($.ui.ddmanager){$.ui.ddmanager.dragStop(this,event);}
if(this.handleElement.is(event.target)){this.element.trigger("focus");}
return $.ui.mouse.prototype._mouseUp.call(this,event);},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp(new $.Event("mouseup",{target:this.element[0]}));}else{this._clear();}
return this;},_getHandle:function(event){return this.options.handle?!!$(event.target).closest(this.element.find(this.options.handle)).length:true;},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element;this._addClass(this.handleElement,"ui-draggable-handle");},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle");},_createHelper:function(event){var o=this.options,helperIsFunction=typeof o.helper==="function",helper=helperIsFunction?$(o.helper.apply(this.element[0],[event])):(o.helper==="clone"?this.element.clone().removeAttr("id"):this.element);if(!helper.parents("body").length){helper.appendTo((o.appendTo==="parent"?this.element[0].parentNode:o.appendTo));}
if(helperIsFunction&&helper[0]===this.element[0]){this._setPositionRelative();}
if(helper[0]!==this.element[0]&&!(/(fixed|absolute)/).test(helper.css("position"))){helper.css("position","absolute");}
return helper;},_setPositionRelative:function(){if(!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative";}},_adjustOffsetFromHelper:function(obj){if(typeof obj==="string"){obj=obj.split(" ");}
if(Array.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0};}
if("left" in obj){this.offset.click.left=obj.left+this.margins.left;}
if("right" in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;}
if("top" in obj){this.offset.click.top=obj.top+this.margins.top;}
if("bottom" in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;}},_isRootNode:function(element){return(/(html|body)/i).test(element.tagName)||element===this.document[0];},_getParentOffset:function(){var po=this.offsetParent.offset(),document=this.document[0];if(this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();}
if(this._isRootNode(this.offsetParent[0])){po={top:0,left:0};}
return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition!=="relative"){return{top:0,left:0};}
var p=this.element.position(),scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+
(!scrollIsRootNode?this.scrollParent.scrollTop():0),left:p.left-(parseInt(this.helper.css("left"),10)||0)+
(!scrollIsRootNode?this.scrollParent.scrollLeft():0)};},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0),right:(parseInt(this.element.css("marginRight"),10)||0),bottom:(parseInt(this.element.css("marginBottom"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var isUserScrollable,c,ce,o=this.options,document=this.document[0];this.relativeContainer=null;if(!o.containment){this.containment=null;return;}
if(o.containment==="window"){this.containment=[$(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,$(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,$(window).scrollLeft()+$(window).width()-
this.helperProportions.width-this.margins.left,$(window).scrollTop()+
($(window).height()||document.body.parentNode.scrollHeight)-
this.helperProportions.height-this.margins.top];return;}
if(o.containment==="document"){this.containment=[0,0,$(document).width()-this.helperProportions.width-this.margins.left,($(document).height()||document.body.parentNode.scrollHeight)-
this.helperProportions.height-this.margins.top];return;}
if(o.containment.constructor===Array){this.containment=o.containment;return;}
if(o.containment==="parent"){o.containment=this.helper[0].parentNode;}
c=$(o.containment);ce=c[0];if(!ce){return;}
isUserScrollable=/(scroll|auto)/.test(c.css("overflow"));this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+
(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+
(parseInt(c.css("paddingTop"),10)||0),(isUserScrollable?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-
(parseInt(c.css("borderRightWidth"),10)||0)-
(parseInt(c.css("paddingRight"),10)||0)-
this.helperProportions.width-
this.margins.left-
this.margins.right,(isUserScrollable?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-
(parseInt(c.css("borderBottomWidth"),10)||0)-
(parseInt(c.css("paddingBottom"),10)||0)-
this.helperProportions.height-
this.margins.top-
this.margins.bottom];this.relativeContainer=c;},_convertPositionTo:function(d,pos){if(!pos){pos=this.position;}
var mod=d==="absolute"?1:-1,scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:(pos.top+
this.offset.relative.top*mod+
this.offset.parent.top*mod-
((this.cssPosition==="fixed"?-this.offset.scroll.top:(scrollIsRootNode?0:this.offset.scroll.top))*mod)),left:(pos.left+
this.offset.relative.left*mod+
this.offset.parent.left*mod-
((this.cssPosition==="fixed"?-this.offset.scroll.left:(scrollIsRootNode?0:this.offset.scroll.left))*mod))};},_generatePosition:function(event,constrainPosition){var containment,co,top,left,o=this.options,scrollIsRootNode=this._isRootNode(this.scrollParent[0]),pageX=event.pageX,pageY=event.pageY;if(!scrollIsRootNode||!this.offset.scroll){this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()};}
if(constrainPosition){if(this.containment){if(this.relativeContainer){co=this.relativeContainer.offset();containment=[this.containment[0]+co.left,this.containment[1]+co.top,this.containment[2]+co.left,this.containment[3]+co.top];}else{containment=this.containment;}
if(event.pageX-this.offset.click.left<containment[0]){pageX=containment[0]+this.offset.click.left;}
if(event.pageY-this.offset.click.top<containment[1]){pageY=containment[1]+this.offset.click.top;}
if(event.pageX-this.offset.click.left>containment[2]){pageX=containment[2]+this.offset.click.left;}
if(event.pageY-this.offset.click.top>containment[3]){pageY=containment[3]+this.offset.click.top;}}
if(o.grid){top=o.grid[1]?this.originalPageY+Math.round((pageY-
this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY;pageY=containment?((top-this.offset.click.top>=containment[1]||top-this.offset.click.top>containment[3])?top:((top-this.offset.click.top>=containment[1])?top-o.grid[1]:top+o.grid[1])):top;left=o.grid[0]?this.originalPageX+
Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX;pageX=containment?((left-this.offset.click.left>=containment[0]||left-this.offset.click.left>containment[2])?left:((left-this.offset.click.left>=containment[0])?left-o.grid[0]:left+o.grid[0])):left;}
if(o.axis==="y"){pageX=this.originalPageX;}
if(o.axis==="x"){pageY=this.originalPageY;}}
return{top:(pageY-
this.offset.click.top-
this.offset.relative.top-
this.offset.parent.top+
(this.cssPosition==="fixed"?-this.offset.scroll.top:(scrollIsRootNode?0:this.offset.scroll.top))),left:(pageX-
this.offset.click.left-
this.offset.relative.left-
this.offset.parent.left+
(this.cssPosition==="fixed"?-this.offset.scroll.left:(scrollIsRootNode?0:this.offset.scroll.left)))};},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging");if(this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval){this.helper.remove();}
this.helper=null;this.cancelHelperRemoval=false;if(this.destroyOnClear){this.destroy();}},_trigger:function(type,event,ui){ui=ui||this._uiHash();$.ui.plugin.call(this,type,[event,ui,this],true);if(/^(drag|start|stop)/.test(type)){this.positionAbs=this._convertPositionTo("absolute");ui.offset=this.positionAbs;}
return $.Widget.prototype._trigger.call(this,type,event,ui);},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs};}});$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui,draggable){var uiSortable=$.extend({},ui,{item:draggable.element});draggable.sortables=[];$(draggable.options.connectToSortable).each(function(){var sortable=$(this).sortable("instance");if(sortable&&!sortable.options.disabled){draggable.sortables.push(sortable);sortable.refreshPositions();sortable._trigger("activate",event,uiSortable);}});},stop:function(event,ui,draggable){var uiSortable=$.extend({},ui,{item:draggable.element});draggable.cancelHelperRemoval=false;$.each(draggable.sortables,function(){var sortable=this;if(sortable.isOver){sortable.isOver=0;draggable.cancelHelperRemoval=true;sortable.cancelHelperRemoval=false;sortable._storedCSS={position:sortable.placeholder.css("position"),top:sortable.placeholder.css("top"),left:sortable.placeholder.css("left")};sortable._mouseStop(event);sortable.options.helper=sortable.options._helper;}else{sortable.cancelHelperRemoval=true;sortable._trigger("deactivate",event,uiSortable);}});},drag:function(event,ui,draggable){$.each(draggable.sortables,function(){var innermostIntersecting=false,sortable=this;sortable.positionAbs=draggable.positionAbs;sortable.helperProportions=draggable.helperProportions;sortable.offset.click=draggable.offset.click;if(sortable._intersectsWith(sortable.containerCache)){innermostIntersecting=true;$.each(draggable.sortables,function(){this.positionAbs=draggable.positionAbs;this.helperProportions=draggable.helperProportions;this.offset.click=draggable.offset.click;if(this!==sortable&&this._intersectsWith(this.containerCache)&&$.contains(sortable.element[0],this.element[0])){innermostIntersecting=false;}
return innermostIntersecting;});}
if(innermostIntersecting){if(!sortable.isOver){sortable.isOver=1;draggable._parent=ui.helper.parent();sortable.currentItem=ui.helper.appendTo(sortable.element).data("ui-sortable-item",true);sortable.options._helper=sortable.options.helper;sortable.options.helper=function(){return ui.helper[0];};event.target=sortable.currentItem[0];sortable._mouseCapture(event,true);sortable._mouseStart(event,true,true);sortable.offset.click.top=draggable.offset.click.top;sortable.offset.click.left=draggable.offset.click.left;sortable.offset.parent.left-=draggable.offset.parent.left-
sortable.offset.parent.left;sortable.offset.parent.top-=draggable.offset.parent.top-
sortable.offset.parent.top;draggable._trigger("toSortable",event);draggable.dropped=sortable.element;$.each(draggable.sortables,function(){this.refreshPositions();});draggable.currentItem=draggable.element;sortable.fromOutside=draggable;}
if(sortable.currentItem){sortable._mouseDrag(event);ui.position=sortable.position;}}else{if(sortable.isOver){sortable.isOver=0;sortable.cancelHelperRemoval=true;sortable.options._revert=sortable.options.revert;sortable.options.revert=false;sortable._trigger("out",event,sortable._uiHash(sortable));sortable._mouseStop(event,true);sortable.options.revert=sortable.options._revert;sortable.options.helper=sortable.options._helper;if(sortable.placeholder){sortable.placeholder.remove();}
ui.helper.appendTo(draggable._parent);draggable._refreshOffsets(event);ui.position=draggable._generatePosition(event,true);draggable._trigger("fromSortable",event);draggable.dropped=false;$.each(draggable.sortables,function(){this.refreshPositions();});}}});}});$.ui.plugin.add("draggable","cursor",{start:function(event,ui,instance){var t=$("body"),o=instance.options;if(t.css("cursor")){o._cursor=t.css("cursor");}
t.css("cursor",o.cursor);},stop:function(event,ui,instance){var o=instance.options;if(o._cursor){$("body").css("cursor",o._cursor);}}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui,instance){var t=$(ui.helper),o=instance.options;if(t.css("opacity")){o._opacity=t.css("opacity");}
t.css("opacity",o.opacity);},stop:function(event,ui,instance){var o=instance.options;if(o._opacity){$(ui.helper).css("opacity",o._opacity);}}});$.ui.plugin.add("draggable","scroll",{start:function(event,ui,i){if(!i.scrollParentNotHidden){i.scrollParentNotHidden=i.helper.scrollParent(false);}
if(i.scrollParentNotHidden[0]!==i.document[0]&&i.scrollParentNotHidden[0].tagName!=="HTML"){i.overflowOffset=i.scrollParentNotHidden.offset();}},drag:function(event,ui,i){var o=i.options,scrolled=false,scrollParent=i.scrollParentNotHidden[0],document=i.document[0];if(scrollParent!==document&&scrollParent.tagName!=="HTML"){if(!o.axis||o.axis!=="x"){if((i.overflowOffset.top+scrollParent.offsetHeight)-event.pageY<o.scrollSensitivity){scrollParent.scrollTop=scrolled=scrollParent.scrollTop+o.scrollSpeed;}else if(event.pageY-i.overflowOffset.top<o.scrollSensitivity){scrollParent.scrollTop=scrolled=scrollParent.scrollTop-o.scrollSpeed;}}
if(!o.axis||o.axis!=="y"){if((i.overflowOffset.left+scrollParent.offsetWidth)-event.pageX<o.scrollSensitivity){scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft+o.scrollSpeed;}else if(event.pageX-i.overflowOffset.left<o.scrollSensitivity){scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft-o.scrollSpeed;}}}else{if(!o.axis||o.axis!=="x"){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);}else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);}}
if(!o.axis||o.axis!=="y"){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);}else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}}}
if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(i,event);}}});$.ui.plugin.add("draggable","snap",{start:function(event,ui,i){var o=i.options;i.snapElements=[];$(o.snap.constructor!==String?(o.snap.items||":data(ui-draggable)"):o.snap).each(function(){var $t=$(this),$o=$t.offset();if(this!==i.element[0]){i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left});}});},drag:function(event,ui,inst){var ts,bs,ls,rs,l,r,t,b,i,first,o=inst.options,d=o.snapTolerance,x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(i=inst.snapElements.length-1;i>=0;i--){l=inst.snapElements[i].left-inst.margins.left;r=l+inst.snapElements[i].width;t=inst.snapElements[i].top-inst.margins.top;b=t+inst.snapElements[i].height;if(x2<l-d||x1>r+d||y2<t-d||y1>b+d||!$.contains(inst.snapElements[i].item.ownerDocument,inst.snapElements[i].item)){if(inst.snapElements[i].snapping){if(inst.options.snap.release){inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}));}}
inst.snapElements[i].snapping=false;continue;}
if(o.snapMode!=="inner"){ts=Math.abs(t-y2)<=d;bs=Math.abs(b-y1)<=d;ls=Math.abs(l-x2)<=d;rs=Math.abs(r-x1)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top;}
if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top;}
if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left;}
if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left;}}
first=(ts||bs||ls||rs);if(o.snapMode!=="outer"){ts=Math.abs(t-y1)<=d;bs=Math.abs(b-y2)<=d;ls=Math.abs(l-x1)<=d;rs=Math.abs(r-x2)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top;}
if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top;}
if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left;}
if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left;}}
if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first)){if(inst.options.snap.snap){inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}));}}
inst.snapElements[i].snapping=(ts||bs||ls||rs||first);}}});$.ui.plugin.add("draggable","stack",{start:function(event,ui,instance){var min,o=instance.options,group=$.makeArray($(o.stack)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||0)-
(parseInt($(b).css("zIndex"),10)||0);});if(!group.length){return;}
min=parseInt($(group[0]).css("zIndex"),10)||0;$(group).each(function(i){$(this).css("zIndex",min+i);});this.css("zIndex",(min+group.length));}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui,instance){var t=$(ui.helper),o=instance.options;if(t.css("zIndex")){o._zIndex=t.css("zIndex");}
t.css("zIndex",o.zIndex);},stop:function(event,ui,instance){var o=instance.options;if(o._zIndex){$(ui.helper).css("zIndex",o._zIndex);}}});var widgetsDraggable=$.ui.draggable;$.widget("ui.resizable",$.ui.mouse,{version:"1.13.2",widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(value){return parseFloat(value)||0;},_isNumber:function(value){return!isNaN(parseFloat(value));},_hasScroll:function(el,a){if($(el).css("overflow")==="hidden"){return false;}
var scroll=(a&&a==="left")?"scrollLeft":"scrollTop",has=false;if(el[scroll]>0){return true;}
try{el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;}catch(e){}
return has;},_create:function(){var margins,o=this.options,that=this;this._addClass("ui-resizable");$.extend(this,{_aspectRatio:!!(o.aspectRatio),aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)){this.element.wrap($("<div class='ui-wrapper'></div>").css({overflow:"hidden",position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance"));this.elementIsWrapper=true;margins={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")};this.element.css(margins);this.originalElement.css("margin",0);this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css(margins);this._proportionallyResize();}
this._setupHandles();if(o.autoHide){$(this.element).on("mouseenter",function(){if(o.disabled){return;}
that._removeClass("ui-resizable-autohide");that._handles.show();}).on("mouseleave",function(){if(o.disabled){return;}
if(!that.resizing){that._addClass("ui-resizable-autohide");that._handles.hide();}});}
this._mouseInit();},_destroy:function(){this._mouseDestroy();this._addedHandles.remove();var wrapper,_destroy=function(exp){$(exp).removeData("resizable").removeData("ui-resizable").off(".resizable");};if(this.elementIsWrapper){_destroy(this.element);wrapper=this.element;this.originalElement.css({position:wrapper.css("position"),width:wrapper.outerWidth(),height:wrapper.outerHeight(),top:wrapper.css("top"),left:wrapper.css("left")}).insertAfter(wrapper);wrapper.remove();}
this.originalElement.css("resize",this.originalResizeStyle);_destroy(this.originalElement);return this;},_setOption:function(key,value){this._super(key,value);switch(key){case"handles":this._removeHandles();this._setupHandles();break;case"aspectRatio":this._aspectRatio=!!value;break;default:break;}},_setupHandles:function(){var o=this.options,handle,i,n,hname,axis,that=this;this.handles=o.handles||(!$(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});this._handles=$();this._addedHandles=$();if(this.handles.constructor===String){if(this.handles==="all"){this.handles="n,e,s,w,se,sw,ne,nw";}
n=this.handles.split(",");this.handles={};for(i=0;i<n.length;i++){handle=String.prototype.trim.call(n[i]);hname="ui-resizable-"+handle;axis=$("<div>");this._addClass(axis,"ui-resizable-handle "+hname);axis.css({zIndex:o.zIndex});this.handles[handle]=".ui-resizable-"+handle;if(!this.element.children(this.handles[handle]).length){this.element.append(axis);this._addedHandles=this._addedHandles.add(axis);}}}
this._renderAxis=function(target){var i,axis,padPos,padWrapper;target=target||this.element;for(i in this.handles){if(this.handles[i].constructor===String){this.handles[i]=this.element.children(this.handles[i]).first().show();}else if(this.handles[i].jquery||this.handles[i].nodeType){this.handles[i]=$(this.handles[i]);this._on(this.handles[i],{"mousedown":that._mouseDown});}
if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)){axis=$(this.handles[i],this.element);padWrapper=/sw|ne|nw|se|n|s/.test(i)?axis.outerHeight():axis.outerWidth();padPos=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");target.css(padPos,padWrapper);this._proportionallyResize();}
this._handles=this._handles.add(this.handles[i]);}};this._renderAxis(this.element);this._handles=this._handles.add(this.element.find(".ui-resizable-handle"));this._handles.disableSelection();this._handles.on("mouseover",function(){if(!that.resizing){if(this.className){axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);}
that.axis=axis&&axis[1]?axis[1]:"se";}});if(o.autoHide){this._handles.hide();this._addClass("ui-resizable-autohide");}},_removeHandles:function(){this._addedHandles.remove();},_mouseCapture:function(event){var i,handle,capture=false;for(i in this.handles){handle=$(this.handles[i])[0];if(handle===event.target||$.contains(handle,event.target)){capture=true;}}
return!this.options.disabled&&capture;},_mouseStart:function(event){var curleft,curtop,cursor,o=this.options,el=this.element;this.resizing=true;this._renderProxy();curleft=this._num(this.helper.css("left"));curtop=this._num(this.helper.css("top"));if(o.containment){curleft+=$(o.containment).scrollLeft()||0;curtop+=$(o.containment).scrollTop()||0;}
this.offset=this.helper.offset();this.position={left:curleft,top:curtop};this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:el.width(),height:el.height()};this.originalSize=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.sizeDiff={width:el.outerWidth()-el.width(),height:el.outerHeight()-el.height()};this.originalPosition={left:curleft,top:curtop};this.originalMousePosition={left:event.pageX,top:event.pageY};this.aspectRatio=(typeof o.aspectRatio==="number")?o.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);cursor=$(".ui-resizable-"+this.axis).css("cursor");$("body").css("cursor",cursor==="auto"?this.axis+"-resize":cursor);this._addClass("ui-resizable-resizing");this._propagate("start",event);return true;},_mouseDrag:function(event){var data,props,smp=this.originalMousePosition,a=this.axis,dx=(event.pageX-smp.left)||0,dy=(event.pageY-smp.top)||0,trigger=this._change[a];this._updatePrevProperties();if(!trigger){return false;}
data=trigger.apply(this,[event,dx,dy]);this._updateVirtualBoundaries(event.shiftKey);if(this._aspectRatio||event.shiftKey){data=this._updateRatio(data,event);}
data=this._respectSize(data,event);this._updateCache(data);this._propagate("resize",event);props=this._applyChanges();if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize();}
if(!$.isEmptyObject(props)){this._updatePrevProperties();this._trigger("resize",event,this.ui());this._applyChanges();}
return false;},_mouseStop:function(event){this.resizing=false;var pr,ista,soffseth,soffsetw,s,left,top,o=this.options,that=this;if(this._helper){pr=this._proportionallyResizeElements;ista=pr.length&&(/textarea/i).test(pr[0].nodeName);soffseth=ista&&this._hasScroll(pr[0],"left")?0:that.sizeDiff.height;soffsetw=ista?0:that.sizeDiff.width;s={width:(that.helper.width()-soffsetw),height:(that.helper.height()-soffseth)};left=(parseFloat(that.element.css("left"))+
(that.position.left-that.originalPosition.left))||null;top=(parseFloat(that.element.css("top"))+
(that.position.top-that.originalPosition.top))||null;if(!o.animate){this.element.css($.extend(s,{top:top,left:left}));}
that.helper.height(that.size.height);that.helper.width(that.size.width);if(this._helper&&!o.animate){this._proportionallyResize();}}
$("body").css("cursor","auto");this._removeClass("ui-resizable-resizing");this._propagate("stop",event);if(this._helper){this.helper.remove();}
return false;},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left};this.prevSize={width:this.size.width,height:this.size.height};},_applyChanges:function(){var props={};if(this.position.top!==this.prevPosition.top){props.top=this.position.top+"px";}
if(this.position.left!==this.prevPosition.left){props.left=this.position.left+"px";}
if(this.size.width!==this.prevSize.width){props.width=this.size.width+"px";}
if(this.size.height!==this.prevSize.height){props.height=this.size.height+"px";}
this.helper.css(props);return props;},_updateVirtualBoundaries:function(forceAspectRatio){var pMinWidth,pMaxWidth,pMinHeight,pMaxHeight,b,o=this.options;b={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:Infinity,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:Infinity};if(this._aspectRatio||forceAspectRatio){pMinWidth=b.minHeight*this.aspectRatio;pMinHeight=b.minWidth/this.aspectRatio;pMaxWidth=b.maxHeight*this.aspectRatio;pMaxHeight=b.maxWidth/this.aspectRatio;if(pMinWidth>b.minWidth){b.minWidth=pMinWidth;}
if(pMinHeight>b.minHeight){b.minHeight=pMinHeight;}
if(pMaxWidth<b.maxWidth){b.maxWidth=pMaxWidth;}
if(pMaxHeight<b.maxHeight){b.maxHeight=pMaxHeight;}}
this._vBoundaries=b;},_updateCache:function(data){this.offset=this.helper.offset();if(this._isNumber(data.left)){this.position.left=data.left;}
if(this._isNumber(data.top)){this.position.top=data.top;}
if(this._isNumber(data.height)){this.size.height=data.height;}
if(this._isNumber(data.width)){this.size.width=data.width;}},_updateRatio:function(data){var cpos=this.position,csize=this.size,a=this.axis;if(this._isNumber(data.height)){data.width=(data.height*this.aspectRatio);}else if(this._isNumber(data.width)){data.height=(data.width/this.aspectRatio);}
if(a==="sw"){data.left=cpos.left+(csize.width-data.width);data.top=null;}
if(a==="nw"){data.top=cpos.top+(csize.height-data.height);data.left=cpos.left+(csize.width-data.width);}
return data;},_respectSize:function(data){var o=this._vBoundaries,a=this.axis,ismaxw=this._isNumber(data.width)&&o.maxWidth&&(o.maxWidth<data.width),ismaxh=this._isNumber(data.height)&&o.maxHeight&&(o.maxHeight<data.height),isminw=this._isNumber(data.width)&&o.minWidth&&(o.minWidth>data.width),isminh=this._isNumber(data.height)&&o.minHeight&&(o.minHeight>data.height),dw=this.originalPosition.left+this.originalSize.width,dh=this.originalPosition.top+this.originalSize.height,cw=/sw|nw|w/.test(a),ch=/nw|ne|n/.test(a);if(isminw){data.width=o.minWidth;}
if(isminh){data.height=o.minHeight;}
if(ismaxw){data.width=o.maxWidth;}
if(ismaxh){data.height=o.maxHeight;}
if(isminw&&cw){data.left=dw-o.minWidth;}
if(ismaxw&&cw){data.left=dw-o.maxWidth;}
if(isminh&&ch){data.top=dh-o.minHeight;}
if(ismaxh&&ch){data.top=dh-o.maxHeight;}
if(!data.width&&!data.height&&!data.left&&data.top){data.top=null;}else if(!data.width&&!data.height&&!data.top&&data.left){data.left=null;}
return data;},_getPaddingPlusBorderDimensions:function(element){var i=0,widths=[],borders=[element.css("borderTopWidth"),element.css("borderRightWidth"),element.css("borderBottomWidth"),element.css("borderLeftWidth")],paddings=[element.css("paddingTop"),element.css("paddingRight"),element.css("paddingBottom"),element.css("paddingLeft")];for(;i<4;i++){widths[i]=(parseFloat(borders[i])||0);widths[i]+=(parseFloat(paddings[i])||0);}
return{height:widths[0]+widths[2],width:widths[1]+widths[3]};},_proportionallyResize:function(){if(!this._proportionallyResizeElements.length){return;}
var prel,i=0,element=this.helper||this.element;for(;i<this._proportionallyResizeElements.length;i++){prel=this._proportionallyResizeElements[i];if(!this.outerDimensions){this.outerDimensions=this._getPaddingPlusBorderDimensions(prel);}
prel.css({height:(element.height()-this.outerDimensions.height)||0,width:(element.width()-this.outerDimensions.width)||0});}},_renderProxy:function(){var el=this.element,o=this.options;this.elementOffset=el.offset();if(this._helper){this.helper=this.helper||$("<div></div>").css({overflow:"hidden"});this._addClass(this.helper,this._helper);this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++o.zIndex});this.helper.appendTo("body").disableSelection();}else{this.helper=this.element;}},_change:{e:function(event,dx){return{width:this.originalSize.width+dx};},w:function(event,dx){var cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx};},n:function(event,dx,dy){var cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy};},s:function(event,dx,dy){return{height:this.originalSize.height+dy};},se:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]));},sw:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]));},ne:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]));},nw:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]));}},_propagate:function(n,event){$.ui.plugin.call(this,n,[event,this.ui()]);if(n!=="resize"){this._trigger(n,event,this.ui());}},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition};}});$.ui.plugin.add("resizable","animate",{stop:function(event){var that=$(this).resizable("instance"),o=that.options,pr=that._proportionallyResizeElements,ista=pr.length&&(/textarea/i).test(pr[0].nodeName),soffseth=ista&&that._hasScroll(pr[0],"left")?0:that.sizeDiff.height,soffsetw=ista?0:that.sizeDiff.width,style={width:(that.size.width-soffsetw),height:(that.size.height-soffseth)},left=(parseFloat(that.element.css("left"))+
(that.position.left-that.originalPosition.left))||null,top=(parseFloat(that.element.css("top"))+
(that.position.top-that.originalPosition.top))||null;that.element.animate($.extend(style,top&&left?{top:top,left:left}:{}),{duration:o.animateDuration,easing:o.animateEasing,step:function(){var data={width:parseFloat(that.element.css("width")),height:parseFloat(that.element.css("height")),top:parseFloat(that.element.css("top")),left:parseFloat(that.element.css("left"))};if(pr&&pr.length){$(pr[0]).css({width:data.width,height:data.height});}
that._updateCache(data);that._propagate("resize",event);}});}});$.ui.plugin.add("resizable","containment",{start:function(){var element,p,co,ch,cw,width,height,that=$(this).resizable("instance"),o=that.options,el=that.element,oc=o.containment,ce=(oc instanceof $)?oc.get(0):(/parent/.test(oc))?el.parent().get(0):oc;if(!ce){return;}
that.containerElement=$(ce);if(/document/.test(oc)||oc===document){that.containerOffset={left:0,top:0};that.containerPosition={left:0,top:0};that.parentData={element:$(document),left:0,top:0,width:$(document).width(),height:$(document).height()||document.body.parentNode.scrollHeight};}else{element=$(ce);p=[];$(["Top","Right","Left","Bottom"]).each(function(i,name){p[i]=that._num(element.css("padding"+name));});that.containerOffset=element.offset();that.containerPosition=element.position();that.containerSize={height:(element.innerHeight()-p[3]),width:(element.innerWidth()-p[1])};co=that.containerOffset;ch=that.containerSize.height;cw=that.containerSize.width;width=(that._hasScroll(ce,"left")?ce.scrollWidth:cw);height=(that._hasScroll(ce)?ce.scrollHeight:ch);that.parentData={element:ce,left:co.left,top:co.top,width:width,height:height};}},resize:function(event){var woset,hoset,isParent,isOffsetRelative,that=$(this).resizable("instance"),o=that.options,co=that.containerOffset,cp=that.position,pRatio=that._aspectRatio||event.shiftKey,cop={top:0,left:0},ce=that.containerElement,continueResize=true;if(ce[0]!==document&&(/static/).test(ce.css("position"))){cop=co;}
if(cp.left<(that._helper?co.left:0)){that.size.width=that.size.width+
(that._helper?(that.position.left-co.left):(that.position.left-cop.left));if(pRatio){that.size.height=that.size.width/that.aspectRatio;continueResize=false;}
that.position.left=o.helper?co.left:0;}
if(cp.top<(that._helper?co.top:0)){that.size.height=that.size.height+
(that._helper?(that.position.top-co.top):that.position.top);if(pRatio){that.size.width=that.size.height*that.aspectRatio;continueResize=false;}
that.position.top=that._helper?co.top:0;}
isParent=that.containerElement.get(0)===that.element.parent().get(0);isOffsetRelative=/relative|absolute/.test(that.containerElement.css("position"));if(isParent&&isOffsetRelative){that.offset.left=that.parentData.left+that.position.left;that.offset.top=that.parentData.top+that.position.top;}else{that.offset.left=that.element.offset().left;that.offset.top=that.element.offset().top;}
woset=Math.abs(that.sizeDiff.width+
(that._helper?that.offset.left-cop.left:(that.offset.left-co.left)));hoset=Math.abs(that.sizeDiff.height+
(that._helper?that.offset.top-cop.top:(that.offset.top-co.top)));if(woset+that.size.width>=that.parentData.width){that.size.width=that.parentData.width-woset;if(pRatio){that.size.height=that.size.width/that.aspectRatio;continueResize=false;}}
if(hoset+that.size.height>=that.parentData.height){that.size.height=that.parentData.height-hoset;if(pRatio){that.size.width=that.size.height*that.aspectRatio;continueResize=false;}}
if(!continueResize){that.position.left=that.prevPosition.left;that.position.top=that.prevPosition.top;that.size.width=that.prevSize.width;that.size.height=that.prevSize.height;}},stop:function(){var that=$(this).resizable("instance"),o=that.options,co=that.containerOffset,cop=that.containerPosition,ce=that.containerElement,helper=$(that.helper),ho=helper.offset(),w=helper.outerWidth()-that.sizeDiff.width,h=helper.outerHeight()-that.sizeDiff.height;if(that._helper&&!o.animate&&(/relative/).test(ce.css("position"))){$(this).css({left:ho.left-cop.left-co.left,width:w,height:h});}
if(that._helper&&!o.animate&&(/static/).test(ce.css("position"))){$(this).css({left:ho.left-cop.left-co.left,width:w,height:h});}}});$.ui.plugin.add("resizable","alsoResize",{start:function(){var that=$(this).resizable("instance"),o=that.options;$(o.alsoResize).each(function(){var el=$(this);el.data("ui-resizable-alsoresize",{width:parseFloat(el.width()),height:parseFloat(el.height()),left:parseFloat(el.css("left")),top:parseFloat(el.css("top"))});});},resize:function(event,ui){var that=$(this).resizable("instance"),o=that.options,os=that.originalSize,op=that.originalPosition,delta={height:(that.size.height-os.height)||0,width:(that.size.width-os.width)||0,top:(that.position.top-op.top)||0,left:(that.position.left-op.left)||0};$(o.alsoResize).each(function(){var el=$(this),start=$(this).data("ui-resizable-alsoresize"),style={},css=el.parents(ui.originalElement[0]).length?["width","height"]:["width","height","top","left"];$.each(css,function(i,prop){var sum=(start[prop]||0)+(delta[prop]||0);if(sum&&sum>=0){style[prop]=sum||null;}});el.css(style);});},stop:function(){$(this).removeData("ui-resizable-alsoresize");}});$.ui.plugin.add("resizable","ghost",{start:function(){var that=$(this).resizable("instance"),cs=that.size;that.ghost=that.originalElement.clone();that.ghost.css({opacity:0.25,display:"block",position:"relative",height:cs.height,width:cs.width,margin:0,left:0,top:0});that._addClass(that.ghost,"ui-resizable-ghost");if($.uiBackCompat!==false&&typeof that.options.ghost==="string"){that.ghost.addClass(this.options.ghost);}
that.ghost.appendTo(that.helper);},resize:function(){var that=$(this).resizable("instance");if(that.ghost){that.ghost.css({position:"relative",height:that.size.height,width:that.size.width});}},stop:function(){var that=$(this).resizable("instance");if(that.ghost&&that.helper){that.helper.get(0).removeChild(that.ghost.get(0));}}});$.ui.plugin.add("resizable","grid",{resize:function(){var outerDimensions,that=$(this).resizable("instance"),o=that.options,cs=that.size,os=that.originalSize,op=that.originalPosition,a=that.axis,grid=typeof o.grid==="number"?[o.grid,o.grid]:o.grid,gridX=(grid[0]||1),gridY=(grid[1]||1),ox=Math.round((cs.width-os.width)/gridX)*gridX,oy=Math.round((cs.height-os.height)/gridY)*gridY,newWidth=os.width+ox,newHeight=os.height+oy,isMaxWidth=o.maxWidth&&(o.maxWidth<newWidth),isMaxHeight=o.maxHeight&&(o.maxHeight<newHeight),isMinWidth=o.minWidth&&(o.minWidth>newWidth),isMinHeight=o.minHeight&&(o.minHeight>newHeight);o.grid=grid;if(isMinWidth){newWidth+=gridX;}
if(isMinHeight){newHeight+=gridY;}
if(isMaxWidth){newWidth-=gridX;}
if(isMaxHeight){newHeight-=gridY;}
if(/^(se|s|e)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight;}else if(/^(ne)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight;that.position.top=op.top-oy;}else if(/^(sw)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight;that.position.left=op.left-ox;}else{if(newHeight-gridY<=0||newWidth-gridX<=0){outerDimensions=that._getPaddingPlusBorderDimensions(this);}
if(newHeight-gridY>0){that.size.height=newHeight;that.position.top=op.top-oy;}else{newHeight=gridY-outerDimensions.height;that.size.height=newHeight;that.position.top=op.top+os.height-newHeight;}
if(newWidth-gridX>0){that.size.width=newWidth;that.position.left=op.left-ox;}else{newWidth=gridX-outerDimensions.width;that.size.width=newWidth;that.position.left=op.left+os.width-newWidth;}}}});var widgetsResizable=$.ui.resizable;$.widget("ui.dialog",{version:"1.13.2",options:{appendTo:"body",autoOpen:true,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:true,closeText:"Close",draggable:true,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",of:window,collision:"fit",using:function(pos){var topOffset=$(this).css(pos).offset().top;if(topOffset<0){$(this).css("top",pos.top-topOffset);}}},resizable:true,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},resizableRelatedOptions:{maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height};this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)};this.originalTitle=this.element.attr("title");if(this.options.title==null&&this.originalTitle!=null){this.options.title=this.originalTitle;}
if(this.options.disabled){this.options.disabled=false;}
this._createWrapper();this.element.show().removeAttr("title").appendTo(this.uiDialog);this._addClass("ui-dialog-content","ui-widget-content");this._createTitlebar();this._createButtonPane();if(this.options.draggable&&$.fn.draggable){this._makeDraggable();}
if(this.options.resizable&&$.fn.resizable){this._makeResizable();}
this._isOpen=false;this._trackFocus();},_init:function(){if(this.options.autoOpen){this.open();}},_appendTo:function(){var element=this.options.appendTo;if(element&&(element.jquery||element.nodeType)){return $(element);}
return this.document.find(element||"body").eq(0);},_destroy:function(){var next,originalPosition=this.originalPosition;this._untrackInstance();this._destroyOverlay();this.element.removeUniqueId().css(this.originalCss).detach();this.uiDialog.remove();if(this.originalTitle){this.element.attr("title",this.originalTitle);}
next=originalPosition.parent.children().eq(originalPosition.index);if(next.length&&next[0]!==this.element[0]){next.before(this.element);}else{originalPosition.parent.append(this.element);}},widget:function(){return this.uiDialog;},disable:$.noop,enable:$.noop,close:function(event){var that=this;if(!this._isOpen||this._trigger("beforeClose",event)===false){return;}
this._isOpen=false;this._focusedElement=null;this._destroyOverlay();this._untrackInstance();if(!this.opener.filter(":focusable").trigger("focus").length){$.ui.safeBlur($.ui.safeActiveElement(this.document[0]));}
this._hide(this.uiDialog,this.options.hide,function(){that._trigger("close",event);});},isOpen:function(){return this._isOpen;},moveToTop:function(){this._moveToTop();},_moveToTop:function(event,silent){var moved=false,zIndices=this.uiDialog.siblings(".ui-front:visible").map(function(){return+$(this).css("z-index");}).get(),zIndexMax=Math.max.apply(null,zIndices);if(zIndexMax>=+this.uiDialog.css("z-index")){this.uiDialog.css("z-index",zIndexMax+1);moved=true;}
if(moved&&!silent){this._trigger("focus",event);}
return moved;},open:function(){var that=this;if(this._isOpen){if(this._moveToTop()){this._focusTabbable();}
return;}
this._isOpen=true;this.opener=$($.ui.safeActiveElement(this.document[0]));this._size();this._position();this._createOverlay();this._moveToTop(null,true);if(this.overlay){this.overlay.css("z-index",this.uiDialog.css("z-index")-1);}
this._show(this.uiDialog,this.options.show,function(){that._focusTabbable();that._trigger("focus");});this._makeFocusTarget();this._trigger("open");},_focusTabbable:function(){var hasFocus=this._focusedElement;if(!hasFocus){hasFocus=this.element.find("[autofocus]");}
if(!hasFocus.length){hasFocus=this.element.find(":tabbable");}
if(!hasFocus.length){hasFocus=this.uiDialogButtonPane.find(":tabbable");}
if(!hasFocus.length){hasFocus=this.uiDialogTitlebarClose.filter(":tabbable");}
if(!hasFocus.length){hasFocus=this.uiDialog;}
hasFocus.eq(0).trigger("focus");},_restoreTabbableFocus:function(){var activeElement=$.ui.safeActiveElement(this.document[0]),isActive=this.uiDialog[0]===activeElement||$.contains(this.uiDialog[0],activeElement);if(!isActive){this._focusTabbable();}},_keepFocus:function(event){event.preventDefault();this._restoreTabbableFocus();this._delay(this._restoreTabbableFocus);},_createWrapper:function(){this.uiDialog=$("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo());this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front");this._on(this.uiDialog,{keydown:function(event){if(this.options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){event.preventDefault();this.close(event);return;}
if(event.keyCode!==$.ui.keyCode.TAB||event.isDefaultPrevented()){return;}
var tabbables=this.uiDialog.find(":tabbable"),first=tabbables.first(),last=tabbables.last();if((event.target===last[0]||event.target===this.uiDialog[0])&&!event.shiftKey){this._delay(function(){first.trigger("focus");});event.preventDefault();}else if((event.target===first[0]||event.target===this.uiDialog[0])&&event.shiftKey){this._delay(function(){last.trigger("focus");});event.preventDefault();}},mousedown:function(event){if(this._moveToTop(event)){this._focusTabbable();}}});if(!this.element.find("[aria-describedby]").length){this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")});}},_createTitlebar:function(){var uiDialogTitle;this.uiDialogTitlebar=$("<div>");this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix");this._on(this.uiDialogTitlebar,{mousedown:function(event){if(!$(event.target).closest(".ui-dialog-titlebar-close")){this.uiDialog.trigger("focus");}}});this.uiDialogTitlebarClose=$("<button type='button'></button>").button({label:$("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:false}).appendTo(this.uiDialogTitlebar);this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close");this._on(this.uiDialogTitlebarClose,{click:function(event){event.preventDefault();this.close(event);}});uiDialogTitle=$("<span>").uniqueId().prependTo(this.uiDialogTitlebar);this._addClass(uiDialogTitle,"ui-dialog-title");this._title(uiDialogTitle);this.uiDialogTitlebar.prependTo(this.uiDialog);this.uiDialog.attr({"aria-labelledby":uiDialogTitle.attr("id")});},_title:function(title){if(this.options.title){title.text(this.options.title);}else{title.html("&#160;");}},_createButtonPane:function(){this.uiDialogButtonPane=$("<div>");this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix");this.uiButtonSet=$("<div>").appendTo(this.uiDialogButtonPane);this._addClass(this.uiButtonSet,"ui-dialog-buttonset");this._createButtons();},_createButtons:function(){var that=this,buttons=this.options.buttons;this.uiDialogButtonPane.remove();this.uiButtonSet.empty();if($.isEmptyObject(buttons)||(Array.isArray(buttons)&&!buttons.length)){this._removeClass(this.uiDialog,"ui-dialog-buttons");return;}
$.each(buttons,function(name,props){var click,buttonOptions;props=typeof props==="function"?{click:props,text:name}:props;props=$.extend({type:"button"},props);click=props.click;buttonOptions={icon:props.icon,iconPosition:props.iconPosition,showLabel:props.showLabel,icons:props.icons,text:props.text};delete props.click;delete props.icon;delete props.iconPosition;delete props.showLabel;delete props.icons;if(typeof props.text==="boolean"){delete props.text;}
$("<button></button>",props).button(buttonOptions).appendTo(that.uiButtonSet).on("click",function(){click.apply(that.element[0],arguments);});});this._addClass(this.uiDialog,"ui-dialog-buttons");this.uiDialogButtonPane.appendTo(this.uiDialog);},_makeDraggable:function(){var that=this,options=this.options;function filteredUi(ui){return{position:ui.position,offset:ui.offset};}
this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(event,ui){that._addClass($(this),"ui-dialog-dragging");that._blockFrames();that._trigger("dragStart",event,filteredUi(ui));},drag:function(event,ui){that._trigger("drag",event,filteredUi(ui));},stop:function(event,ui){var left=ui.offset.left-that.document.scrollLeft(),top=ui.offset.top-that.document.scrollTop();options.position={my:"left top",at:"left"+(left>=0?"+":"")+left+" "+"top"+(top>=0?"+":"")+top,of:that.window};that._removeClass($(this),"ui-dialog-dragging");that._unblockFrames();that._trigger("dragStop",event,filteredUi(ui));}});},_makeResizable:function(){var that=this,options=this.options,handles=options.resizable,position=this.uiDialog.css("position"),resizeHandles=typeof handles==="string"?handles:"n,e,s,w,se,sw,ne,nw";function filteredUi(ui){return{originalPosition:ui.originalPosition,originalSize:ui.originalSize,position:ui.position,size:ui.size};}
this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:this._minHeight(),handles:resizeHandles,start:function(event,ui){that._addClass($(this),"ui-dialog-resizing");that._blockFrames();that._trigger("resizeStart",event,filteredUi(ui));},resize:function(event,ui){that._trigger("resize",event,filteredUi(ui));},stop:function(event,ui){var offset=that.uiDialog.offset(),left=offset.left-that.document.scrollLeft(),top=offset.top-that.document.scrollTop();options.height=that.uiDialog.height();options.width=that.uiDialog.width();options.position={my:"left top",at:"left"+(left>=0?"+":"")+left+" "+"top"+(top>=0?"+":"")+top,of:that.window};that._removeClass($(this),"ui-dialog-resizing");that._unblockFrames();that._trigger("resizeStop",event,filteredUi(ui));}}).css("position",position);},_trackFocus:function(){this._on(this.widget(),{focusin:function(event){this._makeFocusTarget();this._focusedElement=$(event.target);}});},_makeFocusTarget:function(){this._untrackInstance();this._trackingInstances().unshift(this);},_untrackInstance:function(){var instances=this._trackingInstances(),exists=$.inArray(this,instances);if(exists!==-1){instances.splice(exists,1);}},_trackingInstances:function(){var instances=this.document.data("ui-dialog-instances");if(!instances){instances=[];this.document.data("ui-dialog-instances",instances);}
return instances;},_minHeight:function(){var options=this.options;return options.height==="auto"?options.minHeight:Math.min(options.minHeight,options.height);},_position:function(){var isVisible=this.uiDialog.is(":visible");if(!isVisible){this.uiDialog.show();}
this.uiDialog.position(this.options.position);if(!isVisible){this.uiDialog.hide();}},_setOptions:function(options){var that=this,resize=false,resizableOptions={};$.each(options,function(key,value){that._setOption(key,value);if(key in that.sizeRelatedOptions){resize=true;}
if(key in that.resizableRelatedOptions){resizableOptions[key]=value;}});if(resize){this._size();this._position();}
if(this.uiDialog.is(":data(ui-resizable)")){this.uiDialog.resizable("option",resizableOptions);}},_setOption:function(key,value){var isDraggable,isResizable,uiDialog=this.uiDialog;if(key==="disabled"){return;}
this._super(key,value);if(key==="appendTo"){this.uiDialog.appendTo(this._appendTo());}
if(key==="buttons"){this._createButtons();}
if(key==="closeText"){this.uiDialogTitlebarClose.button({label:$("<a>").text(""+this.options.closeText).html()});}
if(key==="draggable"){isDraggable=uiDialog.is(":data(ui-draggable)");if(isDraggable&&!value){uiDialog.draggable("destroy");}
if(!isDraggable&&value){this._makeDraggable();}}
if(key==="position"){this._position();}
if(key==="resizable"){isResizable=uiDialog.is(":data(ui-resizable)");if(isResizable&&!value){uiDialog.resizable("destroy");}
if(isResizable&&typeof value==="string"){uiDialog.resizable("option","handles",value);}
if(!isResizable&&value!==false){this._makeResizable();}}
if(key==="title"){this._title(this.uiDialogTitlebar.find(".ui-dialog-title"));}},_size:function(){var nonContentHeight,minContentHeight,maxContentHeight,options=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0});if(options.minWidth>options.width){options.width=options.minWidth;}
nonContentHeight=this.uiDialog.css({height:"auto",width:options.width}).outerHeight();minContentHeight=Math.max(0,options.minHeight-nonContentHeight);maxContentHeight=typeof options.maxHeight==="number"?Math.max(0,options.maxHeight-nonContentHeight):"none";if(options.height==="auto"){this.element.css({minHeight:minContentHeight,maxHeight:maxContentHeight,height:"auto"});}else{this.element.height(Math.max(0,options.height-nonContentHeight));}
if(this.uiDialog.is(":data(ui-resizable)")){this.uiDialog.resizable("option","minHeight",this._minHeight());}},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var iframe=$(this);return $("<div>").css({position:"absolute",width:iframe.outerWidth(),height:iframe.outerHeight()}).appendTo(iframe.parent()).offset(iframe.offset())[0];});},_unblockFrames:function(){if(this.iframeBlocks){this.iframeBlocks.remove();delete this.iframeBlocks;}},_allowInteraction:function(event){if($(event.target).closest(".ui-dialog").length){return true;}
return!!$(event.target).closest(".ui-datepicker").length;},_createOverlay:function(){if(!this.options.modal){return;}
var jqMinor=$.fn.jquery.substring(0,4);var isOpening=true;this._delay(function(){isOpening=false;});if(!this.document.data("ui-dialog-overlays")){this.document.on("focusin.ui-dialog",function(event){if(isOpening){return;}
var instance=this._trackingInstances()[0];if(!instance._allowInteraction(event)){event.preventDefault();instance._focusTabbable();if(jqMinor==="3.4."||jqMinor==="3.5."){instance._delay(instance._restoreTabbableFocus);}}}.bind(this));}
this.overlay=$("<div>").appendTo(this._appendTo());this._addClass(this.overlay,null,"ui-widget-overlay ui-front");this._on(this.overlay,{mousedown:"_keepFocus"});this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1);},_destroyOverlay:function(){if(!this.options.modal){return;}
if(this.overlay){var overlays=this.document.data("ui-dialog-overlays")-1;if(!overlays){this.document.off("focusin.ui-dialog");this.document.removeData("ui-dialog-overlays");}else{this.document.data("ui-dialog-overlays",overlays);}
this.overlay.remove();this.overlay=null;}}});if($.uiBackCompat!==false){$.widget("ui.dialog",$.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super();this.uiDialog.addClass(this.options.dialogClass);},_setOption:function(key,value){if(key==="dialogClass"){this.uiDialog.removeClass(this.options.dialogClass).addClass(value);}
this._superApply(arguments);}});}
var widgetsDialog=$.ui.dialog;$.widget("ui.droppable",{version:"1.13.2",widgetEventPrefix:"drop",options:{accept:"*",addClasses:true,greedy:false,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var proportions,o=this.options,accept=o.accept;this.isover=false;this.isout=true;this.accept=typeof accept==="function"?accept:function(d){return d.is(accept);};this.proportions=function(){if(arguments.length){proportions=arguments[0];}else{return proportions?proportions:proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};}};this._addToManager(o.scope);if(o.addClasses){this._addClass("ui-droppable");}},_addToManager:function(scope){$.ui.ddmanager.droppables[scope]=$.ui.ddmanager.droppables[scope]||[];$.ui.ddmanager.droppables[scope].push(this);},_splice:function(drop){var i=0;for(;i<drop.length;i++){if(drop[i]===this){drop.splice(i,1);}}},_destroy:function(){var drop=$.ui.ddmanager.droppables[this.options.scope];this._splice(drop);},_setOption:function(key,value){if(key==="accept"){this.accept=typeof value==="function"?value:function(d){return d.is(value);};}else if(key==="scope"){var drop=$.ui.ddmanager.droppables[this.options.scope];this._splice(drop);this._addToManager(value);}
this._super(key,value);},_activate:function(event){var draggable=$.ui.ddmanager.current;this._addActiveClass();if(draggable){this._trigger("activate",event,this.ui(draggable));}},_deactivate:function(event){var draggable=$.ui.ddmanager.current;this._removeActiveClass();if(draggable){this._trigger("deactivate",event,this.ui(draggable));}},_over:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return;}
if(this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){this._addHoverClass();this._trigger("over",event,this.ui(draggable));}},_out:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return;}
if(this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){this._removeHoverClass();this._trigger("out",event,this.ui(draggable));}},_drop:function(event,custom){var draggable=custom||$.ui.ddmanager.current,childrenIntersection=false;if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return false;}
this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var inst=$(this).droppable("instance");if(inst.options.greedy&&!inst.options.disabled&&inst.options.scope===draggable.options.scope&&inst.accept.call(inst.element[0],(draggable.currentItem||draggable.element))&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance,event)){childrenIntersection=true;return false;}});if(childrenIntersection){return false;}
if(this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){this._removeActiveClass();this._removeHoverClass();this._trigger("drop",event,this.ui(draggable));return this.element;}
return false;},ui:function(c){return{draggable:(c.currentItem||c.element),helper:c.helper,position:c.position,offset:c.positionAbs};},_addHoverClass:function(){this._addClass("ui-droppable-hover");},_removeHoverClass:function(){this._removeClass("ui-droppable-hover");},_addActiveClass:function(){this._addClass("ui-droppable-active");},_removeActiveClass:function(){this._removeClass("ui-droppable-active");}});$.ui.intersect=(function(){function isOverAxis(x,reference,size){return(x>=reference)&&(x<(reference+size));}
return function(draggable,droppable,toleranceMode,event){if(!droppable.offset){return false;}
var x1=(draggable.positionAbs||draggable.position.absolute).left+draggable.margins.left,y1=(draggable.positionAbs||draggable.position.absolute).top+draggable.margins.top,x2=x1+draggable.helperProportions.width,y2=y1+draggable.helperProportions.height,l=droppable.offset.left,t=droppable.offset.top,r=l+droppable.proportions().width,b=t+droppable.proportions().height;switch(toleranceMode){case"fit":return(l<=x1&&x2<=r&&t<=y1&&y2<=b);case"intersect":return(l<x1+(draggable.helperProportions.width/2)&&x2-(draggable.helperProportions.width/2)<r&&t<y1+(draggable.helperProportions.height/2)&&y2-(draggable.helperProportions.height/2)<b);case"pointer":return isOverAxis(event.pageY,t,droppable.proportions().height)&&isOverAxis(event.pageX,l,droppable.proportions().width);case"touch":return((y1>=t&&y1<=b)||(y2>=t&&y2<=b)||(y1<t&&y2>b))&&((x1>=l&&x1<=r)||(x2>=l&&x2<=r)||(x1<l&&x2>r));default:return false;}};})();$.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,event){var i,j,m=$.ui.ddmanager.droppables[t.options.scope]||[],type=event?event.type:null,list=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();droppablesLoop:for(i=0;i<m.length;i++){if(m[i].options.disabled||(t&&!m[i].accept.call(m[i].element[0],(t.currentItem||t.element)))){continue;}
for(j=0;j<list.length;j++){if(list[j]===m[i].element[0]){m[i].proportions().height=0;continue droppablesLoop;}}
m[i].visible=m[i].element.css("display")!=="none";if(!m[i].visible){continue;}
if(type==="mousedown"){m[i]._activate.call(m[i],event);}
m[i].offset=m[i].element.offset();m[i].proportions({width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight});}},drop:function(draggable,event){var dropped=false;$.each(($.ui.ddmanager.droppables[draggable.options.scope]||[]).slice(),function(){if(!this.options){return;}
if(!this.options.disabled&&this.visible&&$.ui.intersect(draggable,this,this.options.tolerance,event)){dropped=this._drop.call(this,event)||dropped;}
if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){this.isout=true;this.isover=false;this._deactivate.call(this,event);}});return dropped;},dragStart:function(draggable,event){draggable.element.parentsUntil("body").on("scroll.droppable",function(){if(!draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event);}});},drag:function(draggable,event){if(draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event);}
$.each($.ui.ddmanager.droppables[draggable.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible){return;}
var parentInstance,scope,parent,intersects=$.ui.intersect(draggable,this,this.options.tolerance,event),c=!intersects&&this.isover?"isout":(intersects&&!this.isover?"isover":null);if(!c){return;}
if(this.options.greedy){scope=this.options.scope;parent=this.element.parents(":data(ui-droppable)").filter(function(){return $(this).droppable("instance").options.scope===scope;});if(parent.length){parentInstance=$(parent[0]).droppable("instance");parentInstance.greedyChild=(c==="isover");}}
if(parentInstance&&c==="isover"){parentInstance.isover=false;parentInstance.isout=true;parentInstance._out.call(parentInstance,event);}
this[c]=true;this[c==="isout"?"isover":"isout"]=false;this[c==="isover"?"_over":"_out"].call(this,event);if(parentInstance&&c==="isout"){parentInstance.isout=false;parentInstance.isover=true;parentInstance._over.call(parentInstance,event);}});},dragStop:function(draggable,event){draggable.element.parentsUntil("body").off("scroll.droppable");if(!draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event);}}};if($.uiBackCompat!==false){$.widget("ui.droppable",$.ui.droppable,{options:{hoverClass:false,activeClass:false},_addActiveClass:function(){this._super();if(this.options.activeClass){this.element.addClass(this.options.activeClass);}},_removeActiveClass:function(){this._super();if(this.options.activeClass){this.element.removeClass(this.options.activeClass);}},_addHoverClass:function(){this._super();if(this.options.hoverClass){this.element.addClass(this.options.hoverClass);}},_removeHoverClass:function(){this._super();if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass);}}});}
var widgetsDroppable=$.ui.droppable;var widgetsProgressbar=$.widget("ui.progressbar",{version:"1.13.2",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue();this.element.attr({role:"progressbar","aria-valuemin":this.min});this._addClass("ui-progressbar","ui-widget ui-widget-content");this.valueDiv=$("<div>").appendTo(this.element);this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header");this._refreshValue();},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow");this.valueDiv.remove();},value:function(newValue){if(newValue===undefined){return this.options.value;}
this.options.value=this._constrainedValue(newValue);this._refreshValue();},_constrainedValue:function(newValue){if(newValue===undefined){newValue=this.options.value;}
this.indeterminate=newValue===false;if(typeof newValue!=="number"){newValue=0;}
return this.indeterminate?false:Math.min(this.options.max,Math.max(this.min,newValue));},_setOptions:function(options){var value=options.value;delete options.value;this._super(options);this.options.value=this._constrainedValue(value);this._refreshValue();},_setOption:function(key,value){if(key==="max"){value=Math.max(this.min,value);}
this._super(key,value);},_setOptionDisabled:function(value){this._super(value);this.element.attr("aria-disabled",value);this._toggleClass(null,"ui-state-disabled",!!value);},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min);},_refreshValue:function(){var value=this.options.value,percentage=this._percentage();this.valueDiv.toggle(this.indeterminate||value>this.min).width(percentage.toFixed(0)+"%");this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,value===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate);if(this.indeterminate){this.element.removeAttr("aria-valuenow");if(!this.overlayDiv){this.overlayDiv=$("<div>").appendTo(this.valueDiv);this._addClass(this.overlayDiv,"ui-progressbar-overlay");}}else{this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":value});if(this.overlayDiv){this.overlayDiv.remove();this.overlayDiv=null;}}
if(this.oldValue!==value){this.oldValue=value;this._trigger("change");}
if(value===this.options.max){this._trigger("complete");}}});var widgetsSelectable=$.widget("ui.selectable",$.ui.mouse,{version:"1.13.2",options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var that=this;this._addClass("ui-selectable");this.dragged=false;this.refresh=function(){that.elementPos=$(that.element[0]).offset();that.selectees=$(that.options.filter,that.element[0]);that._addClass(that.selectees,"ui-selectee");that.selectees.each(function(){var $this=$(this),selecteeOffset=$this.offset(),pos={left:selecteeOffset.left-that.elementPos.left,top:selecteeOffset.top-that.elementPos.top};$.data(this,"selectable-item",{element:this,$element:$this,left:pos.left,top:pos.top,right:pos.left+$this.outerWidth(),bottom:pos.top+$this.outerHeight(),startselected:false,selected:$this.hasClass("ui-selected"),selecting:$this.hasClass("ui-selecting"),unselecting:$this.hasClass("ui-unselecting")});});};this.refresh();this._mouseInit();this.helper=$("<div>");this._addClass(this.helper,"ui-selectable-helper");},_destroy:function(){this.selectees.removeData("selectable-item");this._mouseDestroy();},_mouseStart:function(event){var that=this,options=this.options;this.opos=[event.pageX,event.pageY];this.elementPos=$(this.element[0]).offset();if(this.options.disabled){return;}
this.selectees=$(options.filter,this.element[0]);this._trigger("start",event);$(options.appendTo).append(this.helper);this.helper.css({"left":event.pageX,"top":event.pageY,"width":0,"height":0});if(options.autoRefresh){this.refresh();}
this.selectees.filter(".ui-selected").each(function(){var selectee=$.data(this,"selectable-item");selectee.startselected=true;if(!event.metaKey&&!event.ctrlKey){that._removeClass(selectee.$element,"ui-selected");selectee.selected=false;that._addClass(selectee.$element,"ui-unselecting");selectee.unselecting=true;that._trigger("unselecting",event,{unselecting:selectee.element});}});$(event.target).parents().addBack().each(function(){var doSelect,selectee=$.data(this,"selectable-item");if(selectee){doSelect=(!event.metaKey&&!event.ctrlKey)||!selectee.$element.hasClass("ui-selected");that._removeClass(selectee.$element,doSelect?"ui-unselecting":"ui-selected")._addClass(selectee.$element,doSelect?"ui-selecting":"ui-unselecting");selectee.unselecting=!doSelect;selectee.selecting=doSelect;selectee.selected=doSelect;if(doSelect){that._trigger("selecting",event,{selecting:selectee.element});}else{that._trigger("unselecting",event,{unselecting:selectee.element});}
return false;}});},_mouseDrag:function(event){this.dragged=true;if(this.options.disabled){return;}
var tmp,that=this,options=this.options,x1=this.opos[0],y1=this.opos[1],x2=event.pageX,y2=event.pageY;if(x1>x2){tmp=x2;x2=x1;x1=tmp;}
if(y1>y2){tmp=y2;y2=y1;y1=tmp;}
this.helper.css({left:x1,top:y1,width:x2-x1,height:y2-y1});this.selectees.each(function(){var selectee=$.data(this,"selectable-item"),hit=false,offset={};if(!selectee||selectee.element===that.element[0]){return;}
offset.left=selectee.left+that.elementPos.left;offset.right=selectee.right+that.elementPos.left;offset.top=selectee.top+that.elementPos.top;offset.bottom=selectee.bottom+that.elementPos.top;if(options.tolerance==="touch"){hit=(!(offset.left>x2||offset.right<x1||offset.top>y2||offset.bottom<y1));}else if(options.tolerance==="fit"){hit=(offset.left>x1&&offset.right<x2&&offset.top>y1&&offset.bottom<y2);}
if(hit){if(selectee.selected){that._removeClass(selectee.$element,"ui-selected");selectee.selected=false;}
if(selectee.unselecting){that._removeClass(selectee.$element,"ui-unselecting");selectee.unselecting=false;}
if(!selectee.selecting){that._addClass(selectee.$element,"ui-selecting");selectee.selecting=true;that._trigger("selecting",event,{selecting:selectee.element});}}else{if(selectee.selecting){if((event.metaKey||event.ctrlKey)&&selectee.startselected){that._removeClass(selectee.$element,"ui-selecting");selectee.selecting=false;that._addClass(selectee.$element,"ui-selected");selectee.selected=true;}else{that._removeClass(selectee.$element,"ui-selecting");selectee.selecting=false;if(selectee.startselected){that._addClass(selectee.$element,"ui-unselecting");selectee.unselecting=true;}
that._trigger("unselecting",event,{unselecting:selectee.element});}}
if(selectee.selected){if(!event.metaKey&&!event.ctrlKey&&!selectee.startselected){that._removeClass(selectee.$element,"ui-selected");selectee.selected=false;that._addClass(selectee.$element,"ui-unselecting");selectee.unselecting=true;that._trigger("unselecting",event,{unselecting:selectee.element});}}}});return false;},_mouseStop:function(event){var that=this;this.dragged=false;$(".ui-unselecting",this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");that._removeClass(selectee.$element,"ui-unselecting");selectee.unselecting=false;selectee.startselected=false;that._trigger("unselected",event,{unselected:selectee.element});});$(".ui-selecting",this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");that._removeClass(selectee.$element,"ui-selecting")._addClass(selectee.$element,"ui-selected");selectee.selecting=false;selectee.selected=true;selectee.startselected=true;that._trigger("selected",event,{selected:selectee.element});});this._trigger("stop",event);this.helper.remove();return false;}});var widgetsSelectmenu=$.widget("ui.selectmenu",[$.ui.formResetMixin,{version:"1.13.2",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:false,change:null,close:null,focus:null,open:null,select:null},_create:function(){var selectmenuId=this.element.uniqueId().attr("id");this.ids={element:selectmenuId,button:selectmenuId+"-button",menu:selectmenuId+"-menu"};this._drawButton();this._drawMenu();this._bindFormResetHandler();this._rendered=false;this.menuItems=$();},_drawButton:function(){var icon,that=this,item=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button);this._on(this.labels,{click:function(event){this.button.trigger("focus");event.preventDefault();}});this.element.hide();this.button=$("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element);this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget");icon=$("<span>").appendTo(this.button);this._addClass(icon,"ui-selectmenu-icon","ui-icon "+this.options.icons.button);this.buttonItem=this._renderButtonItem(item).appendTo(this.button);if(this.options.width!==false){this._resizeButton();}
this._on(this.button,this._buttonEvents);this.button.one("focusin",function(){if(!that._rendered){that._refreshMenu();}});},_drawMenu:function(){var that=this;this.menu=$("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu});this.menuWrap=$("<div>").append(this.menu);this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front");this.menuWrap.appendTo(this._appendTo());this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(event,ui){event.preventDefault();that._setSelection();that._select(ui.item.data("ui-selectmenu-item"),event);},focus:function(event,ui){var item=ui.item.data("ui-selectmenu-item");if(that.focusIndex!=null&&item.index!==that.focusIndex){that._trigger("focus",event,{item:item});if(!that.isOpen){that._select(item,event);}}
that.focusIndex=item.index;that.button.attr("aria-activedescendant",that.menuItems.eq(item.index).attr("id"));}}).menu("instance");this.menuInstance._off(this.menu,"mouseleave");this.menuInstance._closeOnDocumentClick=function(){return false;};this.menuInstance._isDivider=function(){return false;};},refresh:function(){this._refreshMenu();this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{}));if(this.options.width===null){this._resizeButton();}},_refreshMenu:function(){var item,options=this.element.find("option");this.menu.empty();this._parseOptions(options);this._renderMenu(this.menu,this.items);this.menuInstance.refresh();this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper");this._rendered=true;if(!options.length){return;}
item=this._getSelectedItem();this.menuInstance.focus(null,item);this._setAria(item.data("ui-selectmenu-item"));this._setOption("disabled",this.element.prop("disabled"));},open:function(event){if(this.options.disabled){return;}
if(!this._rendered){this._refreshMenu();}else{this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active");this.menuInstance.focus(null,this._getSelectedItem());}
if(!this.menuItems.length){return;}
this.isOpen=true;this._toggleAttr();this._resizeMenu();this._position();this._on(this.document,this._documentClick);this._trigger("open",event);},_position:function(){this.menuWrap.position($.extend({of:this.button},this.options.position));},close:function(event){if(!this.isOpen){return;}
this.isOpen=false;this._toggleAttr();this.range=null;this._off(this.document);this._trigger("close",event);},widget:function(){return this.button;},menuWidget:function(){return this.menu;},_renderButtonItem:function(item){var buttonItem=$("<span>");this._setText(buttonItem,item.label);this._addClass(buttonItem,"ui-selectmenu-text");return buttonItem;},_renderMenu:function(ul,items){var that=this,currentOptgroup="";$.each(items,function(index,item){var li;if(item.optgroup!==currentOptgroup){li=$("<li>",{text:item.optgroup});that._addClass(li,"ui-selectmenu-optgroup","ui-menu-divider"+
(item.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""));li.appendTo(ul);currentOptgroup=item.optgroup;}
that._renderItemData(ul,item);});},_renderItemData:function(ul,item){return this._renderItem(ul,item).data("ui-selectmenu-item",item);},_renderItem:function(ul,item){var li=$("<li>"),wrapper=$("<div>",{title:item.element.attr("title")});if(item.disabled){this._addClass(li,null,"ui-state-disabled");}
this._setText(wrapper,item.label);return li.append(wrapper).appendTo(ul);},_setText:function(element,value){if(value){element.text(value);}else{element.html("&#160;");}},_move:function(direction,event){var item,next,filter=".ui-menu-item";if(this.isOpen){item=this.menuItems.eq(this.focusIndex).parent("li");}else{item=this.menuItems.eq(this.element[0].selectedIndex).parent("li");filter+=":not(.ui-state-disabled)";}
if(direction==="first"||direction==="last"){next=item[direction==="first"?"prevAll":"nextAll"](filter).eq(-1);}else{next=item[direction+"All"](filter).eq(0);}
if(next.length){this.menuInstance.focus(event,next);}},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li");},_toggle:function(event){this[this.isOpen?"close":"open"](event);},_setSelection:function(){var selection;if(!this.range){return;}
if(window.getSelection){selection=window.getSelection();selection.removeAllRanges();selection.addRange(this.range);}else{this.range.select();}
this.button.trigger("focus");},_documentClick:{mousedown:function(event){if(!this.isOpen){return;}
if(!$(event.target).closest(".ui-selectmenu-menu, #"+
$.escapeSelector(this.ids.button)).length){this.close(event);}}},_buttonEvents:{mousedown:function(){var selection;if(window.getSelection){selection=window.getSelection();if(selection.rangeCount){this.range=selection.getRangeAt(0);}}else{this.range=document.selection.createRange();}},click:function(event){this._setSelection();this._toggle(event);},keydown:function(event){var preventDefault=true;switch(event.keyCode){case $.ui.keyCode.TAB:case $.ui.keyCode.ESCAPE:this.close(event);preventDefault=false;break;case $.ui.keyCode.ENTER:if(this.isOpen){this._selectFocusedItem(event);}
break;case $.ui.keyCode.UP:if(event.altKey){this._toggle(event);}else{this._move("prev",event);}
break;case $.ui.keyCode.DOWN:if(event.altKey){this._toggle(event);}else{this._move("next",event);}
break;case $.ui.keyCode.SPACE:if(this.isOpen){this._selectFocusedItem(event);}else{this._toggle(event);}
break;case $.ui.keyCode.LEFT:this._move("prev",event);break;case $.ui.keyCode.RIGHT:this._move("next",event);break;case $.ui.keyCode.HOME:case $.ui.keyCode.PAGE_UP:this._move("first",event);break;case $.ui.keyCode.END:case $.ui.keyCode.PAGE_DOWN:this._move("last",event);break;default:this.menu.trigger(event);preventDefault=false;}
if(preventDefault){event.preventDefault();}}},_selectFocusedItem:function(event){var item=this.menuItems.eq(this.focusIndex).parent("li");if(!item.hasClass("ui-state-disabled")){this._select(item.data("ui-selectmenu-item"),event);}},_select:function(item,event){var oldIndex=this.element[0].selectedIndex;this.element[0].selectedIndex=item.index;this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(item));this._setAria(item);this._trigger("select",event,{item:item});if(item.index!==oldIndex){this._trigger("change",event,{item:item});}
this.close(event);},_setAria:function(item){var id=this.menuItems.eq(item.index).attr("id");this.button.attr({"aria-labelledby":id,"aria-activedescendant":id});this.menu.attr("aria-activedescendant",id);},_setOption:function(key,value){if(key==="icons"){var icon=this.button.find("span.ui-icon");this._removeClass(icon,null,this.options.icons.button)._addClass(icon,null,value.button);}
this._super(key,value);if(key==="appendTo"){this.menuWrap.appendTo(this._appendTo());}
if(key==="width"){this._resizeButton();}},_setOptionDisabled:function(value){this._super(value);this.menuInstance.option("disabled",value);this.button.attr("aria-disabled",value);this._toggleClass(this.button,null,"ui-state-disabled",value);this.element.prop("disabled",value);if(value){this.button.attr("tabindex",-1);this.close();}else{this.button.attr("tabindex",0);}},_appendTo:function(){var element=this.options.appendTo;if(element){element=element.jquery||element.nodeType?$(element):this.document.find(element).eq(0);}
if(!element||!element[0]){element=this.element.closest(".ui-front, dialog");}
if(!element.length){element=this.document[0].body;}
return element;},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen);this._removeClass(this.button,"ui-selectmenu-button-"+
(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+
(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen);this.menu.attr("aria-hidden",!this.isOpen);},_resizeButton:function(){var width=this.options.width;if(width===false){this.button.css("width","");return;}
if(width===null){width=this.element.show().outerWidth();this.element.hide();}
this.button.outerWidth(width);},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1));},_getCreateOptions:function(){var options=this._super();options.disabled=this.element.prop("disabled");return options;},_parseOptions:function(options){var that=this,data=[];options.each(function(index,item){if(item.hidden){return;}
data.push(that._parseOption($(item),index));});this.items=data;},_parseOption:function(option,index){var optgroup=option.parent("optgroup");return{element:option,index:index,value:option.val(),label:option.text(),optgroup:optgroup.attr("label")||"",disabled:optgroup.prop("disabled")||option.prop("disabled")};},_destroy:function(){this._unbindFormResetHandler();this.menuWrap.remove();this.button.remove();this.element.show();this.element.removeUniqueId();this.labels.attr("for",this.ids.element);}}]);var widgetsSlider=$.widget("ui.slider",$.ui.mouse,{version:"1.13.2",widgetEventPrefix:"slide",options:{animate:false,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this._calculateNewMax();this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content");this._refresh();this._animateOff=false;},_refresh:function(){this._createRange();this._createHandles();this._setupEvents();this._refreshValue();},_createHandles:function(){var i,handleCount,options=this.options,existingHandles=this.element.find(".ui-slider-handle"),handle="<span tabindex='0'></span>",handles=[];handleCount=(options.values&&options.values.length)||1;if(existingHandles.length>handleCount){existingHandles.slice(handleCount).remove();existingHandles=existingHandles.slice(0,handleCount);}
for(i=existingHandles.length;i<handleCount;i++){handles.push(handle);}
this.handles=existingHandles.add($(handles.join("")).appendTo(this.element));this._addClass(this.handles,"ui-slider-handle","ui-state-default");this.handle=this.handles.eq(0);this.handles.each(function(i){$(this).data("ui-slider-handle-index",i).attr("tabIndex",0);});},_createRange:function(){var options=this.options;if(options.range){if(options.range===true){if(!options.values){options.values=[this._valueMin(),this._valueMin()];}else if(options.values.length&&options.values.length!==2){options.values=[options.values[0],options.values[0]];}else if(Array.isArray(options.values)){options.values=options.values.slice(0);}}
if(!this.range||!this.range.length){this.range=$("<div>").appendTo(this.element);this._addClass(this.range,"ui-slider-range");}else{this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max");this.range.css({"left":"","bottom":""});}
if(options.range==="min"||options.range==="max"){this._addClass(this.range,"ui-slider-range-"+options.range);}}else{if(this.range){this.range.remove();}
this.range=null;}},_setupEvents:function(){this._off(this.handles);this._on(this.handles,this._handleEvents);this._hoverable(this.handles);this._focusable(this.handles);},_destroy:function(){this.handles.remove();if(this.range){this.range.remove();}
this._mouseDestroy();},_mouseCapture:function(event){var position,normValue,distance,closestHandle,index,allowed,offset,mouseOverHandle,that=this,o=this.options;if(o.disabled){return false;}
this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();position={x:event.pageX,y:event.pageY};normValue=this._normValueFromMouse(position);distance=this._valueMax()-this._valueMin()+1;this.handles.each(function(i){var thisDistance=Math.abs(normValue-that.values(i));if((distance>thisDistance)||(distance===thisDistance&&(i===that._lastChangedValue||that.values(i)===o.min))){distance=thisDistance;closestHandle=$(this);index=i;}});allowed=this._start(event,index);if(allowed===false){return false;}
this._mouseSliding=true;this._handleIndex=index;this._addClass(closestHandle,null,"ui-state-active");closestHandle.trigger("focus");offset=closestHandle.offset();mouseOverHandle=!$(event.target).parents().addBack().is(".ui-slider-handle");this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-(closestHandle.width()/2),top:event.pageY-offset.top-
(closestHandle.height()/2)-
(parseInt(closestHandle.css("borderTopWidth"),10)||0)-
(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+
(parseInt(closestHandle.css("marginTop"),10)||0)};if(!this.handles.hasClass("ui-state-hover")){this._slide(event,index,normValue);}
this._animateOff=true;return true;},_mouseStart:function(){return true;},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);this._slide(event,this._handleIndex,normValue);return false;},_mouseStop:function(event){this._removeClass(this.handles,null,"ui-state-active");this._mouseSliding=false;this._stop(event,this._handleIndex);this._change(event,this._handleIndex);this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false;},_detectOrientation:function(){this.orientation=(this.options.orientation==="vertical")?"vertical":"horizontal";},_normValueFromMouse:function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;if(this.orientation==="horizontal"){pixelTotal=this.elementSize.width;pixelMouse=position.x-this.elementOffset.left-
(this._clickOffset?this._clickOffset.left:0);}else{pixelTotal=this.elementSize.height;pixelMouse=position.y-this.elementOffset.top-
(this._clickOffset?this._clickOffset.top:0);}
percentMouse=(pixelMouse/pixelTotal);if(percentMouse>1){percentMouse=1;}
if(percentMouse<0){percentMouse=0;}
if(this.orientation==="vertical"){percentMouse=1-percentMouse;}
valueTotal=this._valueMax()-this._valueMin();valueMouse=this._valueMin()+percentMouse*valueTotal;return this._trimAlignValue(valueMouse);},_uiHash:function(index,value,values){var uiHash={handle:this.handles[index],handleIndex:index,value:value!==undefined?value:this.value()};if(this._hasMultipleValues()){uiHash.value=value!==undefined?value:this.values(index);uiHash.values=values||this.values();}
return uiHash;},_hasMultipleValues:function(){return this.options.values&&this.options.values.length;},_start:function(event,index){return this._trigger("start",event,this._uiHash(index));},_slide:function(event,index,newVal){var allowed,otherVal,currentValue=this.value(),newValues=this.values();if(this._hasMultipleValues()){otherVal=this.values(index?0:1);currentValue=this.values(index);if(this.options.values.length===2&&this.options.range===true){newVal=index===0?Math.min(otherVal,newVal):Math.max(otherVal,newVal);}
newValues[index]=newVal;}
if(newVal===currentValue){return;}
allowed=this._trigger("slide",event,this._uiHash(index,newVal,newValues));if(allowed===false){return;}
if(this._hasMultipleValues()){this.values(index,newVal);}else{this.value(newVal);}},_stop:function(event,index){this._trigger("stop",event,this._uiHash(index));},_change:function(event,index){if(!this._keySliding&&!this._mouseSliding){this._lastChangedValue=index;this._trigger("change",event,this._uiHash(index));}},value:function(newValue){if(arguments.length){this.options.value=this._trimAlignValue(newValue);this._refreshValue();this._change(null,0);return;}
return this._value();},values:function(index,newValue){var vals,newValues,i;if(arguments.length>1){this.options.values[index]=this._trimAlignValue(newValue);this._refreshValue();this._change(null,index);return;}
if(arguments.length){if(Array.isArray(arguments[0])){vals=this.options.values;newValues=arguments[0];for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(newValues[i]);this._change(null,i);}
this._refreshValue();}else{if(this._hasMultipleValues()){return this._values(index);}else{return this.value();}}}else{return this._values();}},_setOption:function(key,value){var i,valsLength=0;if(key==="range"&&this.options.range===true){if(value==="min"){this.options.value=this._values(0);this.options.values=null;}else if(value==="max"){this.options.value=this._values(this.options.values.length-1);this.options.values=null;}}
if(Array.isArray(this.options.values)){valsLength=this.options.values.length;}
this._super(key,value);switch(key){case"orientation":this._detectOrientation();this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation);this._refreshValue();if(this.options.range){this._refreshRange(value);}
this.handles.css(value==="horizontal"?"bottom":"left","");break;case"value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case"values":this._animateOff=true;this._refreshValue();for(i=valsLength-1;i>=0;i--){this._change(null,i);}
this._animateOff=false;break;case"step":case"min":case"max":this._animateOff=true;this._calculateNewMax();this._refreshValue();this._animateOff=false;break;case"range":this._animateOff=true;this._refresh();this._animateOff=false;break;}},_setOptionDisabled:function(value){this._super(value);this._toggleClass(null,"ui-state-disabled",!!value);},_value:function(){var val=this.options.value;val=this._trimAlignValue(val);return val;},_values:function(index){var val,vals,i;if(arguments.length){val=this.options.values[index];val=this._trimAlignValue(val);return val;}else if(this._hasMultipleValues()){vals=this.options.values.slice();for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(vals[i]);}
return vals;}else{return[];}},_trimAlignValue:function(val){if(val<=this._valueMin()){return this._valueMin();}
if(val>=this._valueMax()){return this._valueMax();}
var step=(this.options.step>0)?this.options.step:1,valModStep=(val-this._valueMin())%step,alignValue=val-valModStep;if(Math.abs(valModStep)*2>=step){alignValue+=(valModStep>0)?step:(-step);}
return parseFloat(alignValue.toFixed(5));},_calculateNewMax:function(){var max=this.options.max,min=this._valueMin(),step=this.options.step,aboveMin=Math.round((max-min)/step)*step;max=aboveMin+min;if(max>this.options.max){max-=step;}
this.max=parseFloat(max.toFixed(this._precision()));},_precision:function(){var precision=this._precisionOf(this.options.step);if(this.options.min!==null){precision=Math.max(precision,this._precisionOf(this.options.min));}
return precision;},_precisionOf:function(num){var str=num.toString(),decimal=str.indexOf(".");return decimal===-1?0:str.length-decimal-1;},_valueMin:function(){return this.options.min;},_valueMax:function(){return this.max;},_refreshRange:function(orientation){if(orientation==="vertical"){this.range.css({"width":"","left":""});}
if(orientation==="horizontal"){this.range.css({"height":"","bottom":""});}},_refreshValue:function(){var lastValPercent,valPercent,value,valueMin,valueMax,oRange=this.options.range,o=this.options,that=this,animate=(!this._animateOff)?o.animate:false,_set={};if(this._hasMultipleValues()){this.handles.each(function(i){valPercent=(that.values(i)-that._valueMin())/(that._valueMax()-
that._valueMin())*100;_set[that.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);if(that.options.range===true){if(that.orientation==="horizontal"){if(i===0){that.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate);}
if(i===1){that.range[animate?"animate":"css"]({width:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate});}}else{if(i===0){that.range.stop(1,1)[animate?"animate":"css"]({bottom:(valPercent)+"%"},o.animate);}
if(i===1){that.range[animate?"animate":"css"]({height:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate});}}}
lastValPercent=valPercent;});}else{value=this.value();valueMin=this._valueMin();valueMax=this._valueMax();valPercent=(valueMax!==valueMin)?(value-valueMin)/(valueMax-valueMin)*100:0;_set[this.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);if(oRange==="min"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate);}
if(oRange==="max"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:(100-valPercent)+"%"},o.animate);}
if(oRange==="min"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate);}
if(oRange==="max"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:(100-valPercent)+"%"},o.animate);}}},_handleEvents:{keydown:function(event){var allowed,curVal,newVal,step,index=$(event.target).data("ui-slider-handle-index");switch(event.keyCode){case $.ui.keyCode.HOME:case $.ui.keyCode.END:case $.ui.keyCode.PAGE_UP:case $.ui.keyCode.PAGE_DOWN:case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:event.preventDefault();if(!this._keySliding){this._keySliding=true;this._addClass($(event.target),null,"ui-state-active");allowed=this._start(event,index);if(allowed===false){return;}}
break;}
step=this.options.step;if(this._hasMultipleValues()){curVal=newVal=this.values(index);}else{curVal=newVal=this.value();}
switch(event.keyCode){case $.ui.keyCode.HOME:newVal=this._valueMin();break;case $.ui.keyCode.END:newVal=this._valueMax();break;case $.ui.keyCode.PAGE_UP:newVal=this._trimAlignValue(curVal+((this._valueMax()-this._valueMin())/this.numPages));break;case $.ui.keyCode.PAGE_DOWN:newVal=this._trimAlignValue(curVal-((this._valueMax()-this._valueMin())/this.numPages));break;case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:if(curVal===this._valueMax()){return;}
newVal=this._trimAlignValue(curVal+step);break;case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:if(curVal===this._valueMin()){return;}
newVal=this._trimAlignValue(curVal-step);break;}
this._slide(event,index,newVal);},keyup:function(event){var index=$(event.target).data("ui-slider-handle-index");if(this._keySliding){this._keySliding=false;this._stop(event,index);this._change(event,index);this._removeClass($(event.target),null,"ui-state-active");}}}});var widgetsSortable=$.widget("ui.sortable",$.ui.mouse,{version:"1.13.2",widgetEventPrefix:"sort",ready:false,options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(x,reference,size){return(x>=reference)&&(x<(reference+size));},_isFloating:function(item){return(/left|right/).test(item.css("float"))||(/inline|table-cell/).test(item.css("display"));},_create:function(){this.containerCache={};this._addClass("ui-sortable");this.refresh();this.offset=this.element.offset();this._mouseInit();this._setHandleClassName();this.ready=true;},_setOption:function(key,value){this._super(key,value);if(key==="handle"){this._setHandleClassName();}},_setHandleClassName:function(){var that=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle");$.each(this.items,function(){that._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle");});},_destroy:function(){this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--){this.items[i].item.removeData(this.widgetName+"-item");}
return this;},_mouseCapture:function(event,overrideHandle){var currentItem=null,validHandle=false,that=this;if(this.reverting){return false;}
if(this.options.disabled||this.options.type==="static"){return false;}
this._refreshItems(event);$(event.target).parents().each(function(){if($.data(this,that.widgetName+"-item")===that){currentItem=$(this);return false;}});if($.data(event.target,that.widgetName+"-item")===that){currentItem=$(event.target);}
if(!currentItem){return false;}
if(this.options.handle&&!overrideHandle){$(this.options.handle,currentItem).find("*").addBack().each(function(){if(this===event.target){validHandle=true;}});if(!validHandle){return false;}}
this.currentItem=currentItem;this._removeCurrentsFromItems();return true;},_mouseStart:function(event,overrideHandle,noActivation){var i,body,o=this.options;this.currentContainer=this;this.refreshPositions();this.appendTo=$(o.appendTo!=="parent"?o.appendTo:this.currentItem.parent());this.helper=this._createHelper(event);this._cacheHelperProportions();this._cacheMargins();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},relative:this._getRelativeOffset()});this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");if(o.cursorAt){this._adjustOffsetFromHelper(o.cursorAt);}
this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!==this.currentItem[0]){this.currentItem.hide();}
this._createPlaceholder();this.scrollParent=this.placeholder.scrollParent();$.extend(this.offset,{parent:this._getParentOffset()});if(o.containment){this._setContainment();}
if(o.cursor&&o.cursor!=="auto"){body=this.document.find("body");this.storedCursor=body.css("cursor");body.css("cursor",o.cursor);this.storedStylesheet=$("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(body);}
if(o.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex");}
this.helper.css("zIndex",o.zIndex);}
if(o.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity");}
this.helper.css("opacity",o.opacity);}
if(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"){this.overflowOffset=this.scrollParent.offset();}
this._trigger("start",event,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions();}
if(!noActivation){for(i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,this._uiHash(this));}}
if($.ui.ddmanager){$.ui.ddmanager.current=this;}
if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event);}
this.dragging=true;this._addClass(this.helper,"ui-sortable-helper");if(!this.helper.parent().is(this.appendTo)){this.helper.detach().appendTo(this.appendTo);this.offset.parent=this._getParentOffset();}
this.position=this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;this.lastPositionAbs=this.positionAbs=this._convertPositionTo("absolute");this._mouseDrag(event);return true;},_scroll:function(event){var o=this.options,scrolled=false;if(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-
event.pageY<o.scrollSensitivity){this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed;}else if(event.pageY-this.overflowOffset.top<o.scrollSensitivity){this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed;}
if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-
event.pageX<o.scrollSensitivity){this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed;}else if(event.pageX-this.overflowOffset.left<o.scrollSensitivity){this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed;}}else{if(event.pageY-this.document.scrollTop()<o.scrollSensitivity){scrolled=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed);}else if(this.window.height()-(event.pageY-this.document.scrollTop())<o.scrollSensitivity){scrolled=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed);}
if(event.pageX-this.document.scrollLeft()<o.scrollSensitivity){scrolled=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed);}else if(this.window.width()-(event.pageX-this.document.scrollLeft())<o.scrollSensitivity){scrolled=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed);}}
return scrolled;},_mouseDrag:function(event){var i,item,itemElement,intersection,o=this.options;this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!=="y"){this.helper[0].style.left=this.position.left+"px";}
if(!this.options.axis||this.options.axis!=="x"){this.helper[0].style.top=this.position.top+"px";}
if(o.scroll){if(this._scroll(event)!==false){this._refreshItemPositions(true);if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event);}}}
this.dragDirection={vertical:this._getDragVerticalDirection(),horizontal:this._getDragHorizontalDirection()};for(i=this.items.length-1;i>=0;i--){item=this.items[i];itemElement=item.item[0];intersection=this._intersectsWithPointer(item);if(!intersection){continue;}
if(item.instance!==this.currentContainer){continue;}
if(itemElement!==this.currentItem[0]&&this.placeholder[intersection===1?"next":"prev"]()[0]!==itemElement&&!$.contains(this.placeholder[0],itemElement)&&(this.options.type==="semi-dynamic"?!$.contains(this.element[0],itemElement):true)){this.direction=intersection===1?"down":"up";if(this.options.tolerance==="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item);}else{break;}
this._trigger("change",event,this._uiHash());break;}}
this._contactContainers(event);if($.ui.ddmanager){$.ui.ddmanager.drag(this,event);}
this._trigger("sort",event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false;},_mouseStop:function(event,noPropagation){if(!event){return;}
if($.ui.ddmanager&&!this.options.dropBehaviour){$.ui.ddmanager.drop(this,event);}
if(this.options.revert){var that=this,cur=this.placeholder.offset(),axis=this.options.axis,animation={};if(!axis||axis==="x"){animation.left=cur.left-this.offset.parent.left-this.margins.left+
(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft);}
if(!axis||axis==="y"){animation.top=cur.top-this.offset.parent.top-this.margins.top+
(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop);}
this.reverting=true;$(this.helper).animate(animation,parseInt(this.options.revert,10)||500,function(){that._clear(event);});}else{this._clear(event,noPropagation);}
return false;},cancel:function(){if(this.dragging){this._mouseUp(new $.Event("mouseup",{target:null}));if(this.options.helper==="original"){this.currentItem.css(this._storedCSS);this._removeClass(this.currentItem,"ui-sortable-helper");}else{this.currentItem.show();}
for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,this._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,this._uiHash(this));this.containers[i].containerCache.over=0;}}}
if(this.placeholder){if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0]);}
if(this.options.helper!=="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove();}
$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem);}else{$(this.domPosition.parent).prepend(this.currentItem);}}
return this;},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected),str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||"id")||"").match(o.expression||(/(.+)[\-=_](.+)/));if(res){str.push((o.key||res[1]+"[]")+"="+(o.key&&o.expression?res[1]:res[2]));}});if(!str.length&&o.key){str.push(o.key+"=");}
return str.join("&");},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected),ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||"id")||"");});return ret;},_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height,l=item.left,r=l+item.width,t=item.top,b=t+item.height,dyClick=this.offset.click.top,dxClick=this.offset.click.left,isOverElementHeight=(this.options.axis==="x")||((y1+dyClick)>t&&(y1+dyClick)<b),isOverElementWidth=(this.options.axis==="y")||((x1+dxClick)>l&&(x1+dxClick)<r),isOverElement=isOverElementHeight&&isOverElementWidth;if(this.options.tolerance==="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!=="pointer"&&this.helperProportions[this.floating?"width":"height"]>item[this.floating?"width":"height"])){return isOverElement;}else{return(l<x1+(this.helperProportions.width/2)&&x2-(this.helperProportions.width/2)<r&&t<y1+(this.helperProportions.height/2)&&y2-(this.helperProportions.height/2)<b);}},_intersectsWithPointer:function(item){var verticalDirection,horizontalDirection,isOverElementHeight=(this.options.axis==="x")||this._isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=(this.options.axis==="y")||this._isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth;if(!isOverElement){return false;}
verticalDirection=this.dragDirection.vertical;horizontalDirection=this.dragDirection.horizontal;return this.floating?((horizontalDirection==="right"||verticalDirection==="down")?2:1):(verticalDirection&&(verticalDirection==="down"?2:1));},_intersectsWithSides:function(item){var isOverBottomHalf=this._isOverAxis(this.positionAbs.top+
this.offset.click.top,item.top+(item.height/2),item.height),isOverRightHalf=this._isOverAxis(this.positionAbs.left+
this.offset.click.left,item.left+(item.width/2),item.width),verticalDirection=this.dragDirection.vertical,horizontalDirection=this.dragDirection.horizontal;if(this.floating&&horizontalDirection){return((horizontalDirection==="right"&&isOverRightHalf)||(horizontalDirection==="left"&&!isOverRightHalf));}else{return verticalDirection&&((verticalDirection==="down"&&isOverBottomHalf)||(verticalDirection==="up"&&!isOverBottomHalf));}},_getDragVerticalDirection:function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!==0&&(delta>0?"down":"up");},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!==0&&(delta>0?"right":"left");},refresh:function(event){this._refreshItems(event);this._setHandleClassName();this.refreshPositions();return this;},_connectWith:function(){var options=this.options;return options.connectWith.constructor===String?[options.connectWith]:options.connectWith;},_getItemsAsjQuery:function(connected){var i,j,cur,inst,items=[],queries=[],connectWith=this._connectWith();if(connectWith&&connected){for(i=connectWith.length-1;i>=0;i--){cur=$(connectWith[i],this.document[0]);for(j=cur.length-1;j>=0;j--){inst=$.data(cur[j],this.widgetFullName);if(inst&&inst!==this&&!inst.options.disabled){queries.push([typeof inst.options.items==="function"?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),inst]);}}}}
queries.push([typeof this.options.items==="function"?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);function addItems(){items.push(this);}
for(i=queries.length-1;i>=0;i--){queries[i][0].each(addItems);}
return $(items);},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=$.grep(this.items,function(item){for(var j=0;j<list.length;j++){if(list[j]===item.item[0]){return false;}}
return true;});},_refreshItems:function(event){this.items=[];this.containers=[this];var i,j,cur,inst,targetData,_queries,item,queriesLength,items=this.items,queries=[[typeof this.options.items==="function"?this.options.items.call(this.element[0],event,{item:this.currentItem}):$(this.options.items,this.element),this]],connectWith=this._connectWith();if(connectWith&&this.ready){for(i=connectWith.length-1;i>=0;i--){cur=$(connectWith[i],this.document[0]);for(j=cur.length-1;j>=0;j--){inst=$.data(cur[j],this.widgetFullName);if(inst&&inst!==this&&!inst.options.disabled){queries.push([typeof inst.options.items==="function"?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst);}}}}
for(i=queries.length-1;i>=0;i--){targetData=queries[i][1];_queries=queries[i][0];for(j=0,queriesLength=_queries.length;j<queriesLength;j++){item=$(_queries[j]);item.data(this.widgetName+"-item",targetData);items.push({item:item,instance:targetData,width:0,height:0,left:0,top:0});}}},_refreshItemPositions:function(fast){var i,item,t,p;for(i=this.items.length-1;i>=0;i--){item=this.items[i];if(this.currentContainer&&item.instance!==this.currentContainer&&item.item[0]!==this.currentItem[0]){continue;}
t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight();}
p=t.offset();item.left=p.left;item.top=p.top;}},refreshPositions:function(fast){this.floating=this.items.length?this.options.axis==="x"||this._isFloating(this.items[0].item):false;if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset();}
this._refreshItemPositions(fast);var i,p;if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this);}else{for(i=this.containers.length-1;i>=0;i--){p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight();}}
return this;},_createPlaceholder:function(that){that=that||this;var className,nodeName,o=that.options;if(!o.placeholder||o.placeholder.constructor===String){className=o.placeholder;nodeName=that.currentItem[0].nodeName.toLowerCase();o.placeholder={element:function(){var element=$("<"+nodeName+">",that.document[0]);that._addClass(element,"ui-sortable-placeholder",className||that.currentItem[0].className)._removeClass(element,"ui-sortable-helper");if(nodeName==="tbody"){that._createTrPlaceholder(that.currentItem.find("tr").eq(0),$("<tr>",that.document[0]).appendTo(element));}else if(nodeName==="tr"){that._createTrPlaceholder(that.currentItem,element);}else if(nodeName==="img"){element.attr("src",that.currentItem.attr("src"));}
if(!className){element.css("visibility","hidden");}
return element;},update:function(container,p){if(className&&!o.forcePlaceholderSize){return;}
if(!p.height()||(o.forcePlaceholderSize&&(nodeName==="tbody"||nodeName==="tr"))){p.height(that.currentItem.innerHeight()-
parseInt(that.currentItem.css("paddingTop")||0,10)-
parseInt(that.currentItem.css("paddingBottom")||0,10));}
if(!p.width()){p.width(that.currentItem.innerWidth()-
parseInt(that.currentItem.css("paddingLeft")||0,10)-
parseInt(that.currentItem.css("paddingRight")||0,10));}}};}
that.placeholder=$(o.placeholder.element.call(that.element,that.currentItem));that.currentItem.after(that.placeholder);o.placeholder.update(that,that.placeholder);},_createTrPlaceholder:function(sourceTr,targetTr){var that=this;sourceTr.children().each(function(){$("<td>&#160;</td>",that.document[0]).attr("colspan",$(this).attr("colspan")||1).appendTo(targetTr);});},_contactContainers:function(event){var i,j,dist,itemWithLeastDistance,posProperty,sizeProperty,cur,nearBottom,floating,axis,innermostContainer=null,innermostIndex=null;for(i=this.containers.length-1;i>=0;i--){if($.contains(this.currentItem[0],this.containers[i].element[0])){continue;}
if(this._intersectsWith(this.containers[i].containerCache)){if(innermostContainer&&$.contains(this.containers[i].element[0],innermostContainer.element[0])){continue;}
innermostContainer=this.containers[i];innermostIndex=i;}else{if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",event,this._uiHash(this));this.containers[i].containerCache.over=0;}}}
if(!innermostContainer){return;}
if(this.containers.length===1){if(!this.containers[innermostIndex].containerCache.over){this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1;}}else{dist=10000;itemWithLeastDistance=null;floating=innermostContainer.floating||this._isFloating(this.currentItem);posProperty=floating?"left":"top";sizeProperty=floating?"width":"height";axis=floating?"pageX":"pageY";for(j=this.items.length-1;j>=0;j--){if(!$.contains(this.containers[innermostIndex].element[0],this.items[j].item[0])){continue;}
if(this.items[j].item[0]===this.currentItem[0]){continue;}
cur=this.items[j].item.offset()[posProperty];nearBottom=false;if(event[axis]-cur>this.items[j][sizeProperty]/2){nearBottom=true;}
if(Math.abs(event[axis]-cur)<dist){dist=Math.abs(event[axis]-cur);itemWithLeastDistance=this.items[j];this.direction=nearBottom?"up":"down";}}
if(!itemWithLeastDistance&&!this.options.dropOnEmpty){return;}
if(this.currentContainer===this.containers[innermostIndex]){if(!this.currentContainer.containerCache.over){this.containers[innermostIndex]._trigger("over",event,this._uiHash());this.currentContainer.containerCache.over=1;}
return;}
if(itemWithLeastDistance){this._rearrange(event,itemWithLeastDistance,null,true);}else{this._rearrange(event,null,this.containers[innermostIndex].element,true);}
this._trigger("change",event,this._uiHash());this.containers[innermostIndex]._trigger("change",event,this._uiHash(this));this.currentContainer=this.containers[innermostIndex];this.options.placeholder.update(this.currentContainer,this.placeholder);this.scrollParent=this.placeholder.scrollParent();if(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"){this.overflowOffset=this.scrollParent.offset();}
this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1;}},_createHelper:function(event){var o=this.options,helper=typeof o.helper==="function"?$(o.helper.apply(this.element[0],[event,this.currentItem])):(o.helper==="clone"?this.currentItem.clone():this.currentItem);if(!helper.parents("body").length){this.appendTo[0].appendChild(helper[0]);}
if(helper[0]===this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};}
if(!helper[0].style.width||o.forceHelperSize){helper.width(this.currentItem.width());}
if(!helper[0].style.height||o.forceHelperSize){helper.height(this.currentItem.height());}
return helper;},_adjustOffsetFromHelper:function(obj){if(typeof obj==="string"){obj=obj.split(" ");}
if(Array.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0};}
if("left" in obj){this.offset.click.left=obj.left+this.margins.left;}
if("right" in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;}
if("top" in obj){this.offset.click.top=obj.top+this.margins.top;}
if("bottom" in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition==="absolute"&&this.scrollParent[0]!==this.document[0]&&$.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();}
if(this.offsetParent[0]===this.document[0].body||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&$.ui.ie)){po={top:0,left:0};}
return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+
this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+
this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var ce,co,over,o=this.options;if(o.containment==="parent"){o.containment=this.helper[0].parentNode;}
if(o.containment==="document"||o.containment==="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,o.containment==="document"?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,(o.containment==="document"?(this.document.height()||document.body.parentNode.scrollHeight):this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];}
if(!(/^(document|window|parent)$/).test(o.containment)){ce=$(o.containment)[0];co=$(o.containment).offset();over=($(ce).css("overflow")!=="hidden");this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+
(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+
(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-
(parseInt($(ce).css("borderLeftWidth"),10)||0)-
(parseInt($(ce).css("paddingRight"),10)||0)-
this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-
(parseInt($(ce).css("borderTopWidth"),10)||0)-
(parseInt($(ce).css("paddingBottom"),10)||0)-
this.helperProportions.height-this.margins.top];}},_convertPositionTo:function(d,pos){if(!pos){pos=this.position;}
var mod=d==="absolute"?1:-1,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==this.document[0]&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top+
this.offset.relative.top*mod+
this.offset.parent.top*mod-
((this.cssPosition==="fixed"?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left+
this.offset.relative.left*mod+
this.offset.parent.left*mod-
((this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))};},_generatePosition:function(event){var top,left,o=this.options,pageX=event.pageX,pageY=event.pageY,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==this.document[0]&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);if(this.cssPosition==="relative"&&!(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0])){this.offset.relative=this._getRelativeOffset();}
if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0]){pageX=this.containment[0]+this.offset.click.left;}
if(event.pageY-this.offset.click.top<this.containment[1]){pageY=this.containment[1]+this.offset.click.top;}
if(event.pageX-this.offset.click.left>this.containment[2]){pageX=this.containment[2]+this.offset.click.left;}
if(event.pageY-this.offset.click.top>this.containment[3]){pageY=this.containment[3]+this.offset.click.top;}}
if(o.grid){top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?((top-this.offset.click.top>=this.containment[1]&&top-this.offset.click.top<=this.containment[3])?top:((top-this.offset.click.top>=this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?((left-this.offset.click.left>=this.containment[0]&&left-this.offset.click.left<=this.containment[2])?left:((left-this.offset.click.left>=this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}}
return{top:(pageY-
this.offset.click.top-
this.offset.relative.top-
this.offset.parent.top+
((this.cssPosition==="fixed"?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop())))),left:(pageX-
this.offset.click.left-
this.offset.relative.left-
this.offset.parent.left+
((this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())))};},_rearrange:function(event,i,a,hardRefresh){if(a){a[0].appendChild(this.placeholder[0]);}else{i.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction==="down"?i.item[0]:i.item[0].nextSibling));}
this.counter=this.counter?++this.counter:1;var counter=this.counter;this._delay(function(){if(counter===this.counter){this.refreshPositions(!hardRefresh);}});},_clear:function(event,noPropagation){this.reverting=false;var i,delayedTriggers=[];if(!this._noFinalSort&&this.currentItem.parent().length){this.placeholder.before(this.currentItem);}
this._noFinalSort=null;if(this.helper[0]===this.currentItem[0]){for(i in this._storedCSS){if(this._storedCSS[i]==="auto"||this._storedCSS[i]==="static"){this._storedCSS[i]="";}}
this.currentItem.css(this._storedCSS);this._removeClass(this.currentItem,"ui-sortable-helper");}else{this.currentItem.show();}
if(this.fromOutside&&!noPropagation){delayedTriggers.push(function(event){this._trigger("receive",event,this._uiHash(this.fromOutside));});}
if((this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!noPropagation){delayedTriggers.push(function(event){this._trigger("update",event,this._uiHash());});}
if(this!==this.currentContainer){if(!noPropagation){delayedTriggers.push(function(event){this._trigger("remove",event,this._uiHash());});delayedTriggers.push((function(c){return function(event){c._trigger("receive",event,this._uiHash(this));};}).call(this,this.currentContainer));delayedTriggers.push((function(c){return function(event){c._trigger("update",event,this._uiHash(this));};}).call(this,this.currentContainer));}}
function delayEvent(type,instance,container){return function(event){container._trigger(type,event,instance._uiHash(instance));};}
for(i=this.containers.length-1;i>=0;i--){if(!noPropagation){delayedTriggers.push(delayEvent("deactivate",this,this.containers[i]));}
if(this.containers[i].containerCache.over){delayedTriggers.push(delayEvent("out",this,this.containers[i]));this.containers[i].containerCache.over=0;}}
if(this.storedCursor){this.document.find("body").css("cursor",this.storedCursor);this.storedStylesheet.remove();}
if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity);}
if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex==="auto"?"":this._storedZIndex);}
this.dragging=false;if(!noPropagation){this._trigger("beforeStop",event,this._uiHash());}
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(!this.cancelHelperRemoval){if(this.helper[0]!==this.currentItem[0]){this.helper.remove();}
this.helper=null;}
if(!noPropagation){for(i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event);}
this._trigger("stop",event,this._uiHash());}
this.fromOutside=false;return!this.cancelHelperRemoval;},_trigger:function(){if($.Widget.prototype._trigger.apply(this,arguments)===false){this.cancel();}},_uiHash:function(_inst){var inst=_inst||this;return{helper:inst.helper,placeholder:inst.placeholder||$([]),position:inst.position,originalPosition:inst.originalPosition,offset:inst.positionAbs,item:inst.currentItem,sender:_inst?_inst.element:null};}});function spinnerModifier(fn){return function(){var previous=this.element.val();fn.apply(this,arguments);this._refresh();if(previous!==this.element.val()){this._trigger("change");}};}
$.widget("ui.spinner",{version:"1.13.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:true,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max);this._setOption("min",this.options.min);this._setOption("step",this.options.step);if(this.value()!==""){this._value(this.element.val(),true);}
this._draw();this._on(this._events);this._refresh();this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete");}});},_getCreateOptions:function(){var options=this._super();var element=this.element;$.each(["min","max","step"],function(i,option){var value=element.attr(option);if(value!=null&&value.length){options[option]=value;}});return options;},_events:{keydown:function(event){if(this._start(event)&&this._keydown(event)){event.preventDefault();}},keyup:"_stop",focus:function(){this.previous=this.element.val();},blur:function(event){if(this.cancelBlur){delete this.cancelBlur;return;}
this._stop();this._refresh();if(this.previous!==this.element.val()){this._trigger("change",event);}},mousewheel:function(event,delta){var activeElement=$.ui.safeActiveElement(this.document[0]);var isActive=this.element[0]===activeElement;if(!isActive||!delta){return;}
if(!this.spinning&&!this._start(event)){return false;}
this._spin((delta>0?1:-1)*this.options.step,event);clearTimeout(this.mousewheelTimer);this.mousewheelTimer=this._delay(function(){if(this.spinning){this._stop(event);}},100);event.preventDefault();},"mousedown .ui-spinner-button":function(event){var previous;previous=this.element[0]===$.ui.safeActiveElement(this.document[0])?this.previous:this.element.val();function checkFocus(){var isActive=this.element[0]===$.ui.safeActiveElement(this.document[0]);if(!isActive){this.element.trigger("focus");this.previous=previous;this._delay(function(){this.previous=previous;});}}
event.preventDefault();checkFocus.call(this);this.cancelBlur=true;this._delay(function(){delete this.cancelBlur;checkFocus.call(this);});if(this._start(event)===false){return;}
this._repeat(null,$(event.currentTarget).hasClass("ui-spinner-up")?1:-1,event);},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(event){if(!$(event.currentTarget).hasClass("ui-state-active")){return;}
if(this._start(event)===false){return false;}
this._repeat(null,$(event.currentTarget).hasClass("ui-spinner-up")?1:-1,event);},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>");},_draw:function(){this._enhance();this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content");this._addClass("ui-spinner-input");this.element.attr("role","spinbutton");this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",true).button({classes:{"ui-button":""}});this._removeClass(this.buttons,"ui-corner-all");this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up");this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down");this.buttons.first().button({"icon":this.options.icons.up,"showLabel":false});this.buttons.last().button({"icon":this.options.icons.down,"showLabel":false});if(this.buttons.height()>Math.ceil(this.uiSpinner.height()*0.5)&&this.uiSpinner.height()>0){this.uiSpinner.height(this.uiSpinner.height());}},_keydown:function(event){var options=this.options,keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.UP:this._repeat(null,1,event);return true;case keyCode.DOWN:this._repeat(null,-1,event);return true;case keyCode.PAGE_UP:this._repeat(null,options.page,event);return true;case keyCode.PAGE_DOWN:this._repeat(null,-options.page,event);return true;}
return false;},_start:function(event){if(!this.spinning&&this._trigger("start",event)===false){return false;}
if(!this.counter){this.counter=1;}
this.spinning=true;return true;},_repeat:function(i,steps,event){i=i||500;clearTimeout(this.timer);this.timer=this._delay(function(){this._repeat(40,steps,event);},i);this._spin(steps*this.options.step,event);},_spin:function(step,event){var value=this.value()||0;if(!this.counter){this.counter=1;}
value=this._adjustValue(value+step*this._increment(this.counter));if(!this.spinning||this._trigger("spin",event,{value:value})!==false){this._value(value);this.counter++;}},_increment:function(i){var incremental=this.options.incremental;if(incremental){return typeof incremental==="function"?incremental(i):Math.floor(i*i*i/50000-i*i/500+17*i/200+1);}
return 1;},_precision:function(){var precision=this._precisionOf(this.options.step);if(this.options.min!==null){precision=Math.max(precision,this._precisionOf(this.options.min));}
return precision;},_precisionOf:function(num){var str=num.toString(),decimal=str.indexOf(".");return decimal===-1?0:str.length-decimal-1;},_adjustValue:function(value){var base,aboveMin,options=this.options;base=options.min!==null?options.min:0;aboveMin=value-base;aboveMin=Math.round(aboveMin/options.step)*options.step;value=base+aboveMin;value=parseFloat(value.toFixed(this._precision()));if(options.max!==null&&value>options.max){return options.max;}
if(options.min!==null&&value<options.min){return options.min;}
return value;},_stop:function(event){if(!this.spinning){return;}
clearTimeout(this.timer);clearTimeout(this.mousewheelTimer);this.counter=0;this.spinning=false;this._trigger("stop",event);},_setOption:function(key,value){var prevValue,first,last;if(key==="culture"||key==="numberFormat"){prevValue=this._parse(this.element.val());this.options[key]=value;this.element.val(this._format(prevValue));return;}
if(key==="max"||key==="min"||key==="step"){if(typeof value==="string"){value=this._parse(value);}}
if(key==="icons"){first=this.buttons.first().find(".ui-icon");this._removeClass(first,null,this.options.icons.up);this._addClass(first,null,value.up);last=this.buttons.last().find(".ui-icon");this._removeClass(last,null,this.options.icons.down);this._addClass(last,null,value.down);}
this._super(key,value);},_setOptionDisabled:function(value){this._super(value);this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!value);this.element.prop("disabled",!!value);this.buttons.button(value?"disable":"enable");},_setOptions:spinnerModifier(function(options){this._super(options);}),_parse:function(val){if(typeof val==="string"&&val!==""){val=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(val,10,this.options.culture):+val;}
return val===""||isNaN(val)?null:val;},_format:function(value){if(value===""){return"";}
return window.Globalize&&this.options.numberFormat?Globalize.format(value,this.options.numberFormat,this.options.culture):value;},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())});},isValid:function(){var value=this.value();if(value===null){return false;}
return value===this._adjustValue(value);},_value:function(value,allowAny){var parsed;if(value!==""){parsed=this._parse(value);if(parsed!==null){if(!allowAny){parsed=this._adjustValue(parsed);}
value=this._format(parsed);}}
this.element.val(value);this._refresh();},_destroy:function(){this.element.prop("disabled",false).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow");this.uiSpinner.replaceWith(this.element);},stepUp:spinnerModifier(function(steps){this._stepUp(steps);}),_stepUp:function(steps){if(this._start()){this._spin((steps||1)*this.options.step);this._stop();}},stepDown:spinnerModifier(function(steps){this._stepDown(steps);}),_stepDown:function(steps){if(this._start()){this._spin((steps||1)* -this.options.step);this._stop();}},pageUp:spinnerModifier(function(pages){this._stepUp((pages||1)*this.options.page);}),pageDown:spinnerModifier(function(pages){this._stepDown((pages||1)*this.options.page);}),value:function(newVal){if(!arguments.length){return this._parse(this.element.val());}
spinnerModifier(this._value).call(this,newVal);},widget:function(){return this.uiSpinner;}});if($.uiBackCompat!==false){$.widget("ui.spinner",$.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());},_uiSpinnerHtml:function(){return"<span>";},_buttonHtml:function(){return"<a></a><a></a>";}});}
var widgetsSpinner=$.ui.spinner;$.widget("ui.tabs",{version:"1.13.2",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:false,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:(function(){var rhash=/#.*$/;return function(anchor){var anchorUrl,locationUrl;anchorUrl=anchor.href.replace(rhash,"");locationUrl=location.href.replace(rhash,"");try{anchorUrl=decodeURIComponent(anchorUrl);}catch(error){}
try{locationUrl=decodeURIComponent(locationUrl);}catch(error){}
return anchor.hash.length>1&&anchorUrl===locationUrl;};})(),_create:function(){var that=this,options=this.options;this.running=false;this._addClass("ui-tabs","ui-widget ui-widget-content");this._toggleClass("ui-tabs-collapsible",null,options.collapsible);this._processTabs();options.active=this._initialActive();if(Array.isArray(options.disabled)){options.disabled=$.uniqueSort(options.disabled.concat($.map(this.tabs.filter(".ui-state-disabled"),function(li){return that.tabs.index(li);}))).sort();}
if(this.options.active!==false&&this.anchors.length){this.active=this._findActive(options.active);}else{this.active=$();}
this._refresh();if(this.active.length){this.load(options.active);}},_initialActive:function(){var active=this.options.active,collapsible=this.options.collapsible,locationHash=location.hash.substring(1);if(active===null){if(locationHash){this.tabs.each(function(i,tab){if($(tab).attr("aria-controls")===locationHash){active=i;return false;}});}
if(active===null){active=this.tabs.index(this.tabs.filter(".ui-tabs-active"));}
if(active===null||active===-1){active=this.tabs.length?0:false;}}
if(active!==false){active=this.tabs.index(this.tabs.eq(active));if(active===-1){active=collapsible?false:0;}}
if(!collapsible&&active===false&&this.anchors.length){active=0;}
return active;},_getCreateEventData:function(){return{tab:this.active,panel:!this.active.length?$():this._getPanelForTab(this.active)};},_tabKeydown:function(event){var focusedTab=$($.ui.safeActiveElement(this.document[0])).closest("li"),selectedIndex=this.tabs.index(focusedTab),goingForward=true;if(this._handlePageNav(event)){return;}
switch(event.keyCode){case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:selectedIndex++;break;case $.ui.keyCode.UP:case $.ui.keyCode.LEFT:goingForward=false;selectedIndex--;break;case $.ui.keyCode.END:selectedIndex=this.anchors.length-1;break;case $.ui.keyCode.HOME:selectedIndex=0;break;case $.ui.keyCode.SPACE:event.preventDefault();clearTimeout(this.activating);this._activate(selectedIndex);return;case $.ui.keyCode.ENTER:event.preventDefault();clearTimeout(this.activating);this._activate(selectedIndex===this.options.active?false:selectedIndex);return;default:return;}
event.preventDefault();clearTimeout(this.activating);selectedIndex=this._focusNextTab(selectedIndex,goingForward);if(!event.ctrlKey&&!event.metaKey){focusedTab.attr("aria-selected","false");this.tabs.eq(selectedIndex).attr("aria-selected","true");this.activating=this._delay(function(){this.option("active",selectedIndex);},this.delay);}},_panelKeydown:function(event){if(this._handlePageNav(event)){return;}
if(event.ctrlKey&&event.keyCode===$.ui.keyCode.UP){event.preventDefault();this.active.trigger("focus");}},_handlePageNav:function(event){if(event.altKey&&event.keyCode===$.ui.keyCode.PAGE_UP){this._activate(this._focusNextTab(this.options.active-1,false));return true;}
if(event.altKey&&event.keyCode===$.ui.keyCode.PAGE_DOWN){this._activate(this._focusNextTab(this.options.active+1,true));return true;}},_findNextTab:function(index,goingForward){var lastTabIndex=this.tabs.length-1;function constrain(){if(index>lastTabIndex){index=0;}
if(index<0){index=lastTabIndex;}
return index;}
while($.inArray(constrain(),this.options.disabled)!==-1){index=goingForward?index+1:index-1;}
return index;},_focusNextTab:function(index,goingForward){index=this._findNextTab(index,goingForward);this.tabs.eq(index).trigger("focus");return index;},_setOption:function(key,value){if(key==="active"){this._activate(value);return;}
this._super(key,value);if(key==="collapsible"){this._toggleClass("ui-tabs-collapsible",null,value);if(!value&&this.options.active===false){this._activate(0);}}
if(key==="event"){this._setupEvents(value);}
if(key==="heightStyle"){this._setupHeightStyle(value);}},_sanitizeSelector:function(hash){return hash?hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):"";},refresh:function(){var options=this.options,lis=this.tablist.children(":has(a[href])");options.disabled=$.map(lis.filter(".ui-state-disabled"),function(tab){return lis.index(tab);});this._processTabs();if(options.active===false||!this.anchors.length){options.active=false;this.active=$();}else if(this.active.length&&!$.contains(this.tablist[0],this.active[0])){if(this.tabs.length===options.disabled.length){options.active=false;this.active=$();}else{this._activate(this._findNextTab(Math.max(0,options.active-1),false));}}else{options.active=this.tabs.index(this.active);}
this._refresh();},_refresh:function(){this._setOptionDisabled(this.options.disabled);this._setupEvents(this.options.event);this._setupHeightStyle(this.options.heightStyle);this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1});this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"});if(!this.active.length){this.tabs.eq(0).attr("tabIndex",0);}else{this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0});this._addClass(this.active,"ui-tabs-active","ui-state-active");this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"});}},_processTabs:function(){var that=this,prevTabs=this.tabs,prevAnchors=this.anchors,prevPanels=this.panels;this.tablist=this._getList().attr("role","tablist");this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header");this.tablist.on("mousedown"+this.eventNamespace,"> li",function(event){if($(this).is(".ui-state-disabled")){event.preventDefault();}}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){if($(this).closest("li").is(".ui-state-disabled")){this.blur();}});this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1});this._addClass(this.tabs,"ui-tabs-tab","ui-state-default");this.anchors=this.tabs.map(function(){return $("a",this)[0];}).attr({tabIndex:-1});this._addClass(this.anchors,"ui-tabs-anchor");this.panels=$();this.anchors.each(function(i,anchor){var selector,panel,panelId,anchorId=$(anchor).uniqueId().attr("id"),tab=$(anchor).closest("li"),originalAriaControls=tab.attr("aria-controls");if(that._isLocal(anchor)){selector=anchor.hash;panelId=selector.substring(1);panel=that.element.find(that._sanitizeSelector(selector));}else{panelId=tab.attr("aria-controls")||$({}).uniqueId()[0].id;selector="#"+panelId;panel=that.element.find(selector);if(!panel.length){panel=that._createPanel(panelId);panel.insertAfter(that.panels[i-1]||that.tablist);}
panel.attr("aria-live","polite");}
if(panel.length){that.panels=that.panels.add(panel);}
if(originalAriaControls){tab.data("ui-tabs-aria-controls",originalAriaControls);}
tab.attr({"aria-controls":panelId,"aria-labelledby":anchorId});panel.attr("aria-labelledby",anchorId);});this.panels.attr("role","tabpanel");this._addClass(this.panels,"ui-tabs-panel","ui-widget-content");if(prevTabs){this._off(prevTabs.not(this.tabs));this._off(prevAnchors.not(this.anchors));this._off(prevPanels.not(this.panels));}},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0);},_createPanel:function(id){return $("<div>").attr("id",id).data("ui-tabs-destroy",true);},_setOptionDisabled:function(disabled){var currentItem,li,i;if(Array.isArray(disabled)){if(!disabled.length){disabled=false;}else if(disabled.length===this.anchors.length){disabled=true;}}
for(i=0;(li=this.tabs[i]);i++){currentItem=$(li);if(disabled===true||$.inArray(i,disabled)!==-1){currentItem.attr("aria-disabled","true");this._addClass(currentItem,null,"ui-state-disabled");}else{currentItem.removeAttr("aria-disabled");this._removeClass(currentItem,null,"ui-state-disabled");}}
this.options.disabled=disabled;this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,disabled===true);},_setupEvents:function(event){var events={};if(event){$.each(event.split(" "),function(index,eventName){events[eventName]="_eventHandler";});}
this._off(this.anchors.add(this.tabs).add(this.panels));this._on(true,this.anchors,{click:function(event){event.preventDefault();}});this._on(this.anchors,events);this._on(this.tabs,{keydown:"_tabKeydown"});this._on(this.panels,{keydown:"_panelKeydown"});this._focusable(this.tabs);this._hoverable(this.tabs);},_setupHeightStyle:function(heightStyle){var maxHeight,parent=this.element.parent();if(heightStyle==="fill"){maxHeight=parent.height();maxHeight-=this.element.outerHeight()-this.element.height();this.element.siblings(":visible").each(function(){var elem=$(this),position=elem.css("position");if(position==="absolute"||position==="fixed"){return;}
maxHeight-=elem.outerHeight(true);});this.element.children().not(this.panels).each(function(){maxHeight-=$(this).outerHeight(true);});this.panels.each(function(){$(this).height(Math.max(0,maxHeight-
$(this).innerHeight()+$(this).height()));}).css("overflow","auto");}else if(heightStyle==="auto"){maxHeight=0;this.panels.each(function(){maxHeight=Math.max(maxHeight,$(this).height("").height());}).height(maxHeight);}},_eventHandler:function(event){var options=this.options,active=this.active,anchor=$(event.currentTarget),tab=anchor.closest("li"),clickedIsActive=tab[0]===active[0],collapsing=clickedIsActive&&options.collapsible,toShow=collapsing?$():this._getPanelForTab(tab),toHide=!active.length?$():this._getPanelForTab(active),eventData={oldTab:active,oldPanel:toHide,newTab:collapsing?$():tab,newPanel:toShow};event.preventDefault();if(tab.hasClass("ui-state-disabled")||tab.hasClass("ui-tabs-loading")||this.running||(clickedIsActive&&!options.collapsible)||(this._trigger("beforeActivate",event,eventData)===false)){return;}
options.active=collapsing?false:this.tabs.index(tab);this.active=clickedIsActive?$():tab;if(this.xhr){this.xhr.abort();}
if(!toHide.length&&!toShow.length){$.error("jQuery UI Tabs: Mismatching fragment identifier.");}
if(toShow.length){this.load(this.tabs.index(tab),event);}
this._toggle(event,eventData);},_toggle:function(event,eventData){var that=this,toShow=eventData.newPanel,toHide=eventData.oldPanel;this.running=true;function complete(){that.running=false;that._trigger("activate",event,eventData);}
function show(){that._addClass(eventData.newTab.closest("li"),"ui-tabs-active","ui-state-active");if(toShow.length&&that.options.show){that._show(toShow,that.options.show,complete);}else{toShow.show();complete();}}
if(toHide.length&&this.options.hide){this._hide(toHide,this.options.hide,function(){that._removeClass(eventData.oldTab.closest("li"),"ui-tabs-active","ui-state-active");show();});}else{this._removeClass(eventData.oldTab.closest("li"),"ui-tabs-active","ui-state-active");toHide.hide();show();}
toHide.attr("aria-hidden","true");eventData.oldTab.attr({"aria-selected":"false","aria-expanded":"false"});if(toShow.length&&toHide.length){eventData.oldTab.attr("tabIndex",-1);}else if(toShow.length){this.tabs.filter(function(){return $(this).attr("tabIndex")===0;}).attr("tabIndex",-1);}
toShow.attr("aria-hidden","false");eventData.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0});},_activate:function(index){var anchor,active=this._findActive(index);if(active[0]===this.active[0]){return;}
if(!active.length){active=this.active;}
anchor=active.find(".ui-tabs-anchor")[0];this._eventHandler({target:anchor,currentTarget:anchor,preventDefault:$.noop});},_findActive:function(index){return index===false?$():this.tabs.eq(index);},_getIndex:function(index){if(typeof index==="string"){index=this.anchors.index(this.anchors.filter("[href$='"+
$.escapeSelector(index)+"']"));}
return index;},_destroy:function(){if(this.xhr){this.xhr.abort();}
this.tablist.removeAttr("role").off(this.eventNamespace);this.anchors.removeAttr("role tabIndex").removeUniqueId();this.tabs.add(this.panels).each(function(){if($.data(this,"ui-tabs-destroy")){$(this).remove();}else{$(this).removeAttr("role tabIndex "+"aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded");}});this.tabs.each(function(){var li=$(this),prev=li.data("ui-tabs-aria-controls");if(prev){li.attr("aria-controls",prev).removeData("ui-tabs-aria-controls");}else{li.removeAttr("aria-controls");}});this.panels.show();if(this.options.heightStyle!=="content"){this.panels.css("height","");}},enable:function(index){var disabled=this.options.disabled;if(disabled===false){return;}
if(index===undefined){disabled=false;}else{index=this._getIndex(index);if(Array.isArray(disabled)){disabled=$.map(disabled,function(num){return num!==index?num:null;});}else{disabled=$.map(this.tabs,function(li,num){return num!==index?num:null;});}}
this._setOptionDisabled(disabled);},disable:function(index){var disabled=this.options.disabled;if(disabled===true){return;}
if(index===undefined){disabled=true;}else{index=this._getIndex(index);if($.inArray(index,disabled)!==-1){return;}
if(Array.isArray(disabled)){disabled=$.merge([index],disabled).sort();}else{disabled=[index];}}
this._setOptionDisabled(disabled);},load:function(index,event){index=this._getIndex(index);var that=this,tab=this.tabs.eq(index),anchor=tab.find(".ui-tabs-anchor"),panel=this._getPanelForTab(tab),eventData={tab:tab,panel:panel},complete=function(jqXHR,status){if(status==="abort"){that.panels.stop(false,true);}
that._removeClass(tab,"ui-tabs-loading");panel.removeAttr("aria-busy");if(jqXHR===that.xhr){delete that.xhr;}};if(this._isLocal(anchor[0])){return;}
this.xhr=$.ajax(this._ajaxSettings(anchor,event,eventData));if(this.xhr&&this.xhr.statusText!=="canceled"){this._addClass(tab,"ui-tabs-loading");panel.attr("aria-busy","true");this.xhr.done(function(response,status,jqXHR){setTimeout(function(){panel.html(response);that._trigger("load",event,eventData);complete(jqXHR,status);},1);}).fail(function(jqXHR,status){setTimeout(function(){complete(jqXHR,status);},1);});}},_ajaxSettings:function(anchor,event,eventData){var that=this;return{url:anchor.attr("href").replace(/#.*$/,""),beforeSend:function(jqXHR,settings){return that._trigger("beforeLoad",event,$.extend({jqXHR:jqXHR,ajaxSettings:settings},eventData));}};},_getPanelForTab:function(tab){var id=$(tab).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+id));}});if($.uiBackCompat!==false){$.widget("ui.tabs",$.ui.tabs,{_processTabs:function(){this._superApply(arguments);this._addClass(this.tabs,"ui-tab");}});}
var widgetsTabs=$.ui.tabs;$.widget("ui.tooltip",{version:"1.13.2",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var title=$(this).attr("title");return $("<a>").text(title).html();},hide:true,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:true,track:false,close:null,open:null},_addDescribedBy:function(elem,id){var describedby=(elem.attr("aria-describedby")||"").split(/\s+/);describedby.push(id);elem.data("ui-tooltip-id",id).attr("aria-describedby",String.prototype.trim.call(describedby.join(" ")));},_removeDescribedBy:function(elem){var id=elem.data("ui-tooltip-id"),describedby=(elem.attr("aria-describedby")||"").split(/\s+/),index=$.inArray(id,describedby);if(index!==-1){describedby.splice(index,1);}
elem.removeData("ui-tooltip-id");describedby=String.prototype.trim.call(describedby.join(" "));if(describedby){elem.attr("aria-describedby",describedby);}else{elem.removeAttr("aria-describedby");}},_create:function(){this._on({mouseover:"open",focusin:"open"});this.tooltips={};this.parents={};this.liveRegion=$("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body);this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible");this.disabledTitles=$([]);},_setOption:function(key,value){var that=this;this._super(key,value);if(key==="content"){$.each(this.tooltips,function(id,tooltipData){that._updateContent(tooltipData.element);});}},_setOptionDisabled:function(value){this[value?"_disable":"_enable"]();},_disable:function(){var that=this;$.each(this.tooltips,function(id,tooltipData){var event=$.Event("blur");event.target=event.currentTarget=tooltipData.element[0];that.close(event,true);});this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var element=$(this);if(element.is("[title]")){return element.data("ui-tooltip-title",element.attr("title")).removeAttr("title");}}));},_enable:function(){this.disabledTitles.each(function(){var element=$(this);if(element.data("ui-tooltip-title")){element.attr("title",element.data("ui-tooltip-title"));}});this.disabledTitles=$([]);},open:function(event){var that=this,target=$(event?event.target:this.element).closest(this.options.items);if(!target.length||target.data("ui-tooltip-id")){return;}
if(target.attr("title")){target.data("ui-tooltip-title",target.attr("title"));}
target.data("ui-tooltip-open",true);if(event&&event.type==="mouseover"){target.parents().each(function(){var parent=$(this),blurEvent;if(parent.data("ui-tooltip-open")){blurEvent=$.Event("blur");blurEvent.target=blurEvent.currentTarget=this;that.close(blurEvent,true);}
if(parent.attr("title")){parent.uniqueId();that.parents[this.id]={element:this,title:parent.attr("title")};parent.attr("title","");}});}
this._registerCloseHandlers(event,target);this._updateContent(target,event);},_updateContent:function(target,event){var content,contentOption=this.options.content,that=this,eventType=event?event.type:null;if(typeof contentOption==="string"||contentOption.nodeType||contentOption.jquery){return this._open(event,target,contentOption);}
content=contentOption.call(target[0],function(response){that._delay(function(){if(!target.data("ui-tooltip-open")){return;}
if(event){event.type=eventType;}
this._open(event,target,response);});});if(content){this._open(event,target,content);}},_open:function(event,target,content){var tooltipData,tooltip,delayedShow,a11yContent,positionOption=$.extend({},this.options.position);if(!content){return;}
tooltipData=this._find(target);if(tooltipData){tooltipData.tooltip.find(".ui-tooltip-content").html(content);return;}
if(target.is("[title]")){if(event&&event.type==="mouseover"){target.attr("title","");}else{target.removeAttr("title");}}
tooltipData=this._tooltip(target);tooltip=tooltipData.tooltip;this._addDescribedBy(target,tooltip.attr("id"));tooltip.find(".ui-tooltip-content").html(content);this.liveRegion.children().hide();a11yContent=$("<div>").html(tooltip.find(".ui-tooltip-content").html());a11yContent.removeAttr("name").find("[name]").removeAttr("name");a11yContent.removeAttr("id").find("[id]").removeAttr("id");a11yContent.appendTo(this.liveRegion);function position(event){positionOption.of=event;if(tooltip.is(":hidden")){return;}
tooltip.position(positionOption);}
if(this.options.track&&event&&/^mouse/.test(event.type)){this._on(this.document,{mousemove:position});position(event);}else{tooltip.position($.extend({of:target},this.options.position));}
tooltip.hide();this._show(tooltip,this.options.show);if(this.options.track&&this.options.show&&this.options.show.delay){delayedShow=this.delayedShow=setInterval(function(){if(tooltip.is(":visible")){position(positionOption.of);clearInterval(delayedShow);}},13);}
this._trigger("open",event,{tooltip:tooltip});},_registerCloseHandlers:function(event,target){var events={keyup:function(event){if(event.keyCode===$.ui.keyCode.ESCAPE){var fakeEvent=$.Event(event);fakeEvent.currentTarget=target[0];this.close(fakeEvent,true);}}};if(target[0]!==this.element[0]){events.remove=function(){var targetElement=this._find(target);if(targetElement){this._removeTooltip(targetElement.tooltip);}};}
if(!event||event.type==="mouseover"){events.mouseleave="close";}
if(!event||event.type==="focusin"){events.focusout="close";}
this._on(true,target,events);},close:function(event){var tooltip,that=this,target=$(event?event.currentTarget:this.element),tooltipData=this._find(target);if(!tooltipData){target.removeData("ui-tooltip-open");return;}
tooltip=tooltipData.tooltip;if(tooltipData.closing){return;}
clearInterval(this.delayedShow);if(target.data("ui-tooltip-title")&&!target.attr("title")){target.attr("title",target.data("ui-tooltip-title"));}
this._removeDescribedBy(target);tooltipData.hiding=true;tooltip.stop(true);this._hide(tooltip,this.options.hide,function(){that._removeTooltip($(this));});target.removeData("ui-tooltip-open");this._off(target,"mouseleave focusout keyup");if(target[0]!==this.element[0]){this._off(target,"remove");}
this._off(this.document,"mousemove");if(event&&event.type==="mouseleave"){$.each(this.parents,function(id,parent){$(parent.element).attr("title",parent.title);delete that.parents[id];});}
tooltipData.closing=true;this._trigger("close",event,{tooltip:tooltip});if(!tooltipData.hiding){tooltipData.closing=false;}},_tooltip:function(element){var tooltip=$("<div>").attr("role","tooltip"),content=$("<div>").appendTo(tooltip),id=tooltip.uniqueId().attr("id");this._addClass(content,"ui-tooltip-content");this._addClass(tooltip,"ui-tooltip","ui-widget ui-widget-content");tooltip.appendTo(this._appendTo(element));return this.tooltips[id]={element:element,tooltip:tooltip};},_find:function(target){var id=target.data("ui-tooltip-id");return id?this.tooltips[id]:null;},_removeTooltip:function(tooltip){clearInterval(this.delayedShow);tooltip.remove();delete this.tooltips[tooltip.attr("id")];},_appendTo:function(target){var element=target.closest(".ui-front, dialog");if(!element.length){element=this.document[0].body;}
return element;},_destroy:function(){var that=this;$.each(this.tooltips,function(id,tooltipData){var event=$.Event("blur"),element=tooltipData.element;event.target=event.currentTarget=element[0];that.close(event,true);$("#"+id).remove();if(element.data("ui-tooltip-title")){if(!element.attr("title")){element.attr("title",element.data("ui-tooltip-title"));}
element.removeData("ui-tooltip-title");}});this.liveRegion.remove();}});if($.uiBackCompat!==false){$.widget("ui.tooltip",$.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var tooltipData=this._superApply(arguments);if(this.options.tooltipClass){tooltipData.tooltip.addClass(this.options.tooltipClass);}
return tooltipData;}});}
var widgetsTooltip=$.ui.tooltip;});;;
(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory);}else if(typeof module==="object"&&module.exports){module.exports=factory(require("jquery"));}else{factory(jQuery);}}(function($){$.extend($.fn,{validate:function(options){if(!this.length){if(options&&options.debug&&window.console){console.warn("Nothing selected, can't validate, returning nothing.");}
return;}
var validator=$.data(this[0],"validator");if(validator){return validator;}
this.attr("novalidate","novalidate");validator=new $.validator(options,this[0]);$.data(this[0],"validator",validator);if(validator.settings.onsubmit){this.on("click.validate",":submit",function(event){validator.submitButton=event.currentTarget;if($(this).hasClass("cancel")){validator.cancelSubmit=true;}
if($(this).attr("formnovalidate")!==undefined){validator.cancelSubmit=true;}});this.on("submit.validate",function(event){if(validator.settings.debug){event.preventDefault();}
function handle(){var hidden,result;if(validator.submitButton&&(validator.settings.submitHandler||validator.formSubmitted)){hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val($(validator.submitButton).val()).appendTo(validator.currentForm);}
if(validator.settings.submitHandler&&!validator.settings.debug){result=validator.settings.submitHandler.call(validator,validator.currentForm,event);if(hidden){hidden.remove();}
if(result!==undefined){return result;}
return false;}
return true;}
if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}
if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}
return handle();}else{validator.focusInvalid();return false;}});}
return validator;},valid:function(){var valid,validator,errorList;if($(this[0]).is("form")){valid=this.validate().form();}else{errorList=[];valid=true;validator=$(this[0].form).validate();this.each(function(){valid=validator.element(this)&&valid;if(!valid){errorList=errorList.concat(validator.errorList);}});validator.errorList=errorList;}
return valid;},rules:function(command,argument){var element=this[0],isContentEditable=typeof this.attr("contenteditable")!=="undefined"&&this.attr("contenteditable")!=="false",settings,staticRules,existingRules,data,param,filtered;if(element==null){return;}
if(!element.form&&isContentEditable){element.form=this.closest("form")[0];element.name=this.attr("name");}
if(element.form==null){return;}
if(command){settings=$.data(element.form,"validator").settings;staticRules=settings.rules;existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));delete existingRules.messages;staticRules[element.name]=existingRules;if(argument.messages){settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);}
break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}
filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}
data=$.validator.normalizeRules($.extend({},$.validator.classRules(element),$.validator.attributeRules(element),$.validator.dataRules(element),$.validator.staticRules(element)),element);if(data.required){param=data.required;delete data.required;data=$.extend({required:param},data);}
if(data.remote){param=data.remote;delete data.remote;data=$.extend(data,{remote:param});}
return data;}});var trim=function(str){return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");};$.extend($.expr.pseudos||$.expr[":"],{blank:function(a){return!trim(""+$(a).val());},filled:function(a){var val=$(a).val();return val!==null&&!!trim(""+val);},unchecked:function(a){return!$(a).prop("checked");}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length===1){return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};}
if(params===undefined){return source;}
if(arguments.length>2&&params.constructor!==Array){params=$.makeArray(arguments).slice(1);}
if(params.constructor!==Array){params=[params];}
$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),function(){return n;});});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:false,focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:":hidden",ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup){if(this.settings.unhighlight){this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);}
this.hideThese(this.errorsFor(element));}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element,event){var excludedKeys=[16,17,18,20,35,36,37,38,39,40,45,144,225];if(event.which===9&&this.elementValue(element)===""||$.inArray(event.keyCode,excludedKeys)!==-1){return;}else if(element.name in this.submitted||element.name in this.invalid){this.element(element);}},onclick:function(element){if(element.name in this.submitted){this.element(element);}else if(element.parentNode.name in this.submitted){this.element(element.parentNode);}},highlight:function(element,errorClass,validClass){if(element.type==="radio"){this.findByName(element.name).addClass(errorClass).removeClass(validClass);}else{$(element).addClass(errorClass).removeClass(validClass);}},unhighlight:function(element,errorClass,validClass){if(element.type==="radio"){this.findByName(element.name).removeClass(errorClass).addClass(validClass);}else{$(element).removeClass(errorClass).addClass(validClass);}}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}."),step:$.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var currentForm=this.currentForm,groups=(this.groups={}),rules;$.each(this.settings.groups,function(key,value){if(typeof value==="string"){value=value.split(/\s/);}
$.each(value,function(index,name){groups[name]=key;});});rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var isContentEditable=typeof $(this).attr("contenteditable")!=="undefined"&&$(this).attr("contenteditable")!=="false";if(!this.form&&isContentEditable){this.form=$(this).closest("form")[0];this.name=$(this).attr("name");}
if(currentForm!==this.form){return;}
var validator=$.data(this.form,"validator"),eventType="on"+event.type.replace(/^validate/,""),settings=validator.settings;if(settings[eventType]&&!$(this).is(settings.ignore)){settings[eventType].call(validator,this,event);}}
$(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], "+"[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], "+"[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], "+"[type='radio'], [type='checkbox'], [contenteditable], [type='button']",delegate).on("click.validate","select, option, [type='radio'], [type='checkbox']",delegate);if(this.settings.invalidHandler){$(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler);}},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid()){$(this.currentForm).triggerHandler("invalid-form",[this]);}
this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}
return this.valid();},element:function(element){var cleanElement=this.clean(element),checkElement=this.validationTargetFor(cleanElement),v=this,result=true,rs,group;if(checkElement===undefined){delete this.invalid[cleanElement.name];}else{this.prepareElement(checkElement);this.currentElements=$(checkElement);group=this.groups[checkElement.name];if(group){$.each(this.groups,function(name,testgroup){if(testgroup===group&&name!==checkElement.name){cleanElement=v.validationTargetFor(v.clean(v.findByName(name)));if(cleanElement&&cleanElement.name in v.invalid){v.currentElements.push(cleanElement);result=v.check(cleanElement)&&result;}}});}
rs=this.check(checkElement)!==false;result=result&&rs;if(rs){this.invalid[checkElement.name]=false;}else{this.invalid[checkElement.name]=true;}
if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}
this.showErrors();$(element).attr("aria-invalid",!rs);}
return result;},showErrors:function(errors){if(errors){var validator=this;$.extend(this.errorMap,errors);this.errorList=$.map(this.errorMap,function(message,name){return{message:message,element:validator.findByName(name)[0]};});this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}
if(this.settings.showErrors){this.settings.showErrors.call(this,this.errorMap,this.errorList);}else{this.defaultShowErrors();}},resetForm:function(){if($.fn.resetForm){$(this.currentForm).resetForm();}
this.invalid={};this.submitted={};this.prepareForm();this.hideErrors();var elements=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(elements);},resetElements:function(elements){var i;if(this.settings.unhighlight){for(i=0;elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,"");this.findByName(elements[i].name).removeClass(this.settings.validClass);}}else{elements.removeClass(this.settings.errorClass).removeClass(this.settings.validClass);}},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0,i;for(i in obj){if(obj[i]!==undefined&&obj[i]!==null&&obj[i]!==false){count++;}}
return count;},hideErrors:function(){this.hideThese(this.toHide);},hideThese:function(errors){errors.not(this.containers).text("");this.addWrapper(errors).hide();},valid:function(){return this.size()===0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").trigger("focus").trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name===lastActive.name;}).length===1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var name=this.name||$(this).attr("name");var isContentEditable=typeof $(this).attr("contenteditable")!=="undefined"&&$(this).attr("contenteditable")!=="false";if(!name&&validator.settings.debug&&window.console){console.error("%o has no name assigned",this);}
if(isContentEditable){this.form=$(this).closest("form")[0];this.name=name;}
if(this.form!==validator.currentForm){return false;}
if(name in rulesCache||!validator.objectLength($(this).rules())){return false;}
rulesCache[name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){var errorClass=this.settings.errorClass.split(" ").join(".");return $(this.settings.errorElement+"."+errorClass,this.errorContext);},resetInternals:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);},reset:function(){this.resetInternals();this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},elementValue:function(element){var $element=$(element),type=element.type,isContentEditable=typeof $element.attr("contenteditable")!=="undefined"&&$element.attr("contenteditable")!=="false",val,idx;if(type==="radio"||type==="checkbox"){return this.findByName(element.name).filter(":checked").val();}else if(type==="number"&&typeof element.validity!=="undefined"){return element.validity.badInput?"NaN":$element.val();}
if(isContentEditable){val=$element.text();}else{val=$element.val();}
if(type==="file"){if(val.substr(0,12)==="C:\\fakepath\\"){return val.substr(12);}
idx=val.lastIndexOf("/");if(idx>=0){return val.substr(idx+1);}
idx=val.lastIndexOf("\\");if(idx>=0){return val.substr(idx+1);}
return val;}
if(typeof val==="string"){return val.replace(/\r/g,"");}
return val;},check:function(element){element=this.validationTargetFor(this.clean(element));var rules=$(element).rules(),rulesCount=$.map(rules,function(n,i){return i;}).length,dependencyMismatch=false,val=this.elementValue(element),result,method,rule,normalizer;this.abortRequest(element);if(typeof rules.normalizer==="function"){normalizer=rules.normalizer;}else if(typeof this.settings.normalizer==="function"){normalizer=this.settings.normalizer;}
if(normalizer){val=normalizer.call(element,val);delete rules.normalizer;}
for(method in rules){rule={method:method,parameters:rules[method]};try{result=$.validator.methods[method].call(this,val,element,rule.parameters);if(result==="dependency-mismatch"&&rulesCount===1){dependencyMismatch=true;continue;}
dependencyMismatch=false;if(result==="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}
if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){if(this.settings.debug&&window.console){console.log("Exception occurred when checking element "+element.id+", check the '"+rule.method+"' method.",e);}
if(e instanceof TypeError){e.message+=".  Exception occurred when checking element "+element.id+", check the '"+rule.method+"' method.";}
throw e;}}
if(dependencyMismatch){return;}
if(this.objectLength(rules)){this.successList.push(element);}
return true;},customDataMessage:function(element,method){return $(element).data("msg"+method.charAt(0).toUpperCase()+
method.substring(1).toLowerCase())||$(element).data("msg");},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor===String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined){return arguments[i];}}
return undefined;},defaultMessage:function(element,rule){if(typeof rule==="string"){rule={method:rule};}
var message=this.findDefined(this.customMessage(element.name,rule.method),this.customDataMessage(element,rule.method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[rule.method],"<strong>Warning: No message defined for "+element.name+"</strong>"),theregex=/\$?\{(\d+)\}/g;if(typeof message==="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=$.validator.format(message.replace(theregex,"{$1}"),rule.parameters);}
return message;},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule);this.errorList.push({message:message,element:element,method:rule.method});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper){toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));}
return toToggle;},defaultShowErrors:function(){var i,elements,error;for(i=0;this.errorList[i];i++){error=this.errorList[i];if(this.settings.highlight){this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);}
this.showLabel(error.element,error.message);}
if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}
if(this.settings.success){for(i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}
if(this.settings.unhighlight){for(i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}
this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var place,group,errorID,v,error=this.errorsFor(element),elementID=this.idOrName(element),describedBy=$(element).attr("aria-describedby");if(error.length){error.removeClass(this.settings.validClass).addClass(this.settings.errorClass);if(this.settings&&this.settings.escapeHtml){error.text(message||"");}else{error.html(message||"");}}else{error=$("<"+this.settings.errorElement+">").attr("id",elementID+"-error").addClass(this.settings.errorClass);if(this.settings&&this.settings.escapeHtml){error.text(message||"");}else{error.html(message||"");}
place=error;if(this.settings.wrapper){place=error.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}
if(this.labelContainer.length){this.labelContainer.append(place);}else if(this.settings.errorPlacement){this.settings.errorPlacement.call(this,place,$(element));}else{place.insertAfter(element);}
if(error.is("label")){error.attr("for",elementID);}else if(error.parents("label[for='"+this.escapeCssMeta(elementID)+"']").length===0){errorID=error.attr("id");if(!describedBy){describedBy=errorID;}else if(!describedBy.match(new RegExp("\\b"+this.escapeCssMeta(errorID)+"\\b"))){describedBy+=" "+errorID;}
$(element).attr("aria-describedby",describedBy);group=this.groups[element.name];if(group){v=this;$.each(v.groups,function(name,testgroup){if(testgroup===group){$("[name='"+v.escapeCssMeta(name)+"']",v.currentForm).attr("aria-describedby",error.attr("id"));}});}}}
if(!message&&this.settings.success){error.text("");if(typeof this.settings.success==="string"){error.addClass(this.settings.success);}else{this.settings.success(error,element);}}
this.toShow=this.toShow.add(error);},errorsFor:function(element){var name=this.escapeCssMeta(this.idOrName(element)),describer=$(element).attr("aria-describedby"),selector="label[for='"+name+"'], label[for='"+name+"'] *";if(describer){selector=selector+", #"+this.escapeCssMeta(describer).replace(/\s+/g,", #");}
return this.errors().filter(selector);},escapeCssMeta:function(string){if(string===undefined){return"";}
return string.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,"\\$1");},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},validationTargetFor:function(element){if(this.checkable(element)){element=this.findByName(element.name);}
return $(element).not(this.settings.ignore)[0];},checkable:function(element){return(/radio|checkbox/i).test(element.type);},findByName:function(name){return $(this.currentForm).find("[name='"+this.escapeCssMeta(name)+"']");},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case"select":return $("option:selected",element).length;case"input":if(this.checkable(element)){return this.findByName(element.name).filter(":checked").length;}}
return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){var val=this.elementValue(element);return!$.validator.methods.required.call(this,val,element)&&"dependency-mismatch";},elementAjaxPort:function(element){return"validate"+element.name;},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;$(element).addClass(this.settings.pendingClass);this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0){this.pendingRequest=0;}
delete this.pending[element.name];$(element).removeClass(this.settings.pendingClass);if(valid&&this.pendingRequest===0&&this.formSubmitted&&this.form()&&this.pendingRequest===0){$(this.currentForm).trigger("submit");if(this.submitButton){$("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove();}
this.formSubmitted=false;}else if(!valid&&this.pendingRequest===0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},abortRequest:function(element){var port;if(this.pending[element.name]){port=this.elementAjaxPort(element);$.ajaxAbort(port);this.pendingRequest--;if(this.pendingRequest<0){this.pendingRequest=0;}
delete this.pending[element.name];$(element).removeClass(this.settings.pendingClass);}},previousValue:function(element,method){method=typeof method==="string"&&method||"remote";return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,{method:method})});},destroy:function(){this.resetForm();$(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur");}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},number:{number:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){if(className.constructor===String){this.classRuleSettings[className]=rules;}else{$.extend(this.classRuleSettings,className);}},classRules:function(element){var rules={},classes=$(element).attr("class");if(classes){$.each(classes.split(" "),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});}
return rules;},normalizeAttributeRule:function(rules,type,method,value){if(/min|max|step/.test(method)&&(type===null||/number|range|text/.test(type))){value=Number(value);if(isNaN(value)){value=undefined;}}
if(value||value===0){rules[method]=value;}else if(type===method&&type!=="range"){rules[type==="date"?"dateISO":method]=true;}},attributeRules:function(element){var rules={},$element=$(element),type=element.getAttribute("type"),method,value;for(method in $.validator.methods){if(method==="required"){value=element.getAttribute(method);if(value===""){value=true;}
value=!!value;}else{value=$element.attr(method);}
this.normalizeAttributeRule(rules,type,method,value);}
if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}
return rules;},dataRules:function(element){var rules={},$element=$(element),type=element.getAttribute("type"),method,value;for(method in $.validator.methods){value=$element.data("rule"+method.charAt(0).toUpperCase()+method.substring(1).toLowerCase());if(value===""){value=true;}
this.normalizeAttributeRule(rules,type,method,value);}
return rules;},staticRules:function(element){var rules={},validator=$.data(element.form,"validator");if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}
return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}
if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}
if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{$.data(element.form,"validator").resetElements($(element));delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=typeof parameter==="function"&&rule!=="normalizer"?parameter(element):parameter;});$.each(["minlength","maxlength"],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(["rangelength","range"],function(){var parts;if(rules[this]){if(Array.isArray(rules[this])){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}else if(typeof rules[this]==="string"){parts=rules[this].replace(/[\[\]]/g,"").split(/[\s,]+/);rules[this]=[Number(parts[0]),Number(parts[1])];}}});if($.validator.autoCreateRanges){if(rules.min!=null&&rules.max!=null){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}
if(rules.minlength!=null&&rules.maxlength!=null){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}
return rules;},normalizeRule:function(data){if(typeof data==="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}
return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!==undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element)){return"dependency-mismatch";}
if(element.nodeName.toLowerCase()==="select"){var val=$(element).val();return val&&val.length>0;}
if(this.checkable(element)){return this.getLength(value,element)>0;}
return value!==undefined&&value!==null&&value.length>0;},email:function(value,element){return this.optional(element)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(value);},url:function(value,element){return this.optional(element)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(value);},date:(function(){var called=false;return function(value,element){if(!called){called=true;if(this.settings.debug&&window.console){console.warn("The `date` method is deprecated and will be removed in version '2.0.0'.\n"+"Please don't use it, since it relies on the Date constructor, which\n"+"behaves very differently across browsers and locales. Use `dateISO`\n"+"instead or one of the locale specific methods in `localizations/`\n"+"and `additional-methods.js`.");}}
return this.optional(element)||!/Invalid|NaN/.test(new Date(value).toString());};}()),dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);},number:function(value,element){return this.optional(element)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},minlength:function(value,element,param){var length=Array.isArray(value)?value.length:this.getLength(value,element);return this.optional(element)||length>=param;},maxlength:function(value,element,param){var length=Array.isArray(value)?value.length:this.getLength(value,element);return this.optional(element)||length<=param;},rangelength:function(value,element,param){var length=Array.isArray(value)?value.length:this.getLength(value,element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},step:function(value,element,param){var type=$(element).attr("type"),errorMessage="Step attribute on input type "+type+" is not supported.",supportedTypes=["text","number","range"],re=new RegExp("\\b"+type+"\\b"),notSupported=type&&!re.test(supportedTypes.join()),decimalPlaces=function(num){var match=(""+num).match(/(?:\.(\d+))?$/);if(!match){return 0;}
return match[1]?match[1].length:0;},toInt=function(num){return Math.round(num*Math.pow(10,decimals));},valid=true,decimals;if(notSupported){throw new Error(errorMessage);}
decimals=decimalPlaces(param);if(decimalPlaces(value)>decimals||toInt(value)%toInt(param)!==0){valid=false;}
return this.optional(element)||valid;},equalTo:function(value,element,param){var target=$(param);if(this.settings.onfocusout&&target.not(".validate-equalTo-blur").length){target.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){$(element).valid();});}
return value===target.val();},remote:function(value,element,param,method){if(this.optional(element)){return"dependency-mismatch";}
method=typeof method==="string"&&method||"remote";var previous=this.previousValue(element,method),validator,data,optionDataString;if(!this.settings.messages[element.name]){this.settings.messages[element.name]={};}
previous.originalMessage=previous.originalMessage||this.settings.messages[element.name][method];this.settings.messages[element.name][method]=previous.message;param=typeof param==="string"&&{url:param}||param;optionDataString=$.param($.extend({data:value},param.data));if(previous.old===optionDataString){return previous.valid;}
previous.old=optionDataString;validator=this;this.startRequest(element);data={};data[element.name]=value;$.ajax($.extend(true,{mode:"abort",port:this.elementAjaxPort(element),dataType:"json",data:data,context:validator.currentForm,success:function(response){var valid=response===true||response==="true",errors,message,submitted;validator.settings.messages[element.name][method]=previous.originalMessage;if(valid){submitted=validator.formSubmitted;validator.toHide=validator.errorsFor(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.invalid[element.name]=false;validator.showErrors();}else{errors={};message=response||validator.defaultMessage(element,{method:method,parameters:value});errors[element.name]=previous.message=message;validator.invalid[element.name]=true;validator.showErrors(errors);}
previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}}});var pendingRequests={},ajax;if($.ajaxPrefilter){$.ajaxPrefilter(function(settings,_,xhr){var port=settings.port;if(settings.mode==="abort"){$.ajaxAbort(port);pendingRequests[port]=xhr;}});}else{ajax=$.ajax;$.ajax=function(settings){var mode=("mode" in settings?settings:$.ajaxSettings).mode,port=("port" in settings?settings:$.ajaxSettings).port;if(mode==="abort"){$.ajaxAbort(port);pendingRequests[port]=ajax.apply(this,arguments);return pendingRequests[port];}
return ajax.apply(this,arguments);};}
$.ajaxAbort=function(port){if(pendingRequests[port]){pendingRequests[port].abort();delete pendingRequests[port];}};return $;}));;;
(function(factory){if(typeof define==='function'&&define.amd){define("jquery.validate.unobtrusive",['jquery-validation'],factory);}else if(typeof module==='object'&&module.exports){module.exports=factory(require('jquery-validation'));}else{jQuery.validator.unobtrusive=factory(jQuery);}}(function($){var $jQval=$.validator,adapters,data_validation="unobtrusiveValidation";function setValidationValues(options,ruleName,value){options.rules[ruleName]=value;if(options.message){options.messages[ruleName]=options.message;}}
function splitAndTrim(value){return value.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g);}
function escapeAttributeValue(value){return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1");}
function getModelPrefix(fieldName){return fieldName.substr(0,fieldName.lastIndexOf(".")+1);}
function appendModelPrefix(value,prefix){if(value.indexOf("*.")===0){value=value.replace("*.",prefix);}
return value;}
function onError(error,inputElement){var container=$(this).find("[data-valmsg-for='"+escapeAttributeValue(inputElement[0].name)+"']"),replaceAttrValue=container.attr("data-valmsg-replace"),replace=replaceAttrValue?$.parseJSON(replaceAttrValue)!==false:null;container.removeClass("field-validation-valid").addClass("field-validation-error");error.data("unobtrusiveContainer",container);if(replace){container.empty();error.removeClass("input-validation-error").appendTo(container);}
else{error.hide();}}
function onErrors(event,validator){var container=$(this).find("[data-valmsg-summary=true]"),list=container.find("ul");if(list&&list.length&&validator.errorList.length){list.empty();container.addClass("validation-summary-errors").removeClass("validation-summary-valid");$.each(validator.errorList,function(){$("<li />").html(this.message).appendTo(list);});}}
function onSuccess(error){var container=error.data("unobtrusiveContainer");if(container){var replaceAttrValue=container.attr("data-valmsg-replace"),replace=replaceAttrValue?$.parseJSON(replaceAttrValue):null;container.addClass("field-validation-valid").removeClass("field-validation-error");error.removeData("unobtrusiveContainer");if(replace){container.empty();}}}
function onReset(event){var $form=$(this),key='__jquery_unobtrusive_validation_form_reset';if($form.data(key)){return;}
$form.data(key,true);try{$form.data("validator").resetForm();}finally{$form.removeData(key);}
$form.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");$form.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer");}
function validationInfo(form){var $form=$(form),result=$form.data(data_validation),onResetProxy=$.proxy(onReset,form),defaultOptions=$jQval.unobtrusive.options||{},execInContext=function(name,args){var func=defaultOptions[name];func&&$.isFunction(func)&&func.apply(form,args);};if(!result){result={options:{errorClass:defaultOptions.errorClass||"input-validation-error",errorElement:defaultOptions.errorElement||"span",errorPlacement:function(){onError.apply(form,arguments);execInContext("errorPlacement",arguments);},invalidHandler:function(){onErrors.apply(form,arguments);execInContext("invalidHandler",arguments);},messages:{},rules:{},success:function(){onSuccess.apply(form,arguments);execInContext("success",arguments);}},attachValidation:function(){$form.off("reset."+data_validation,onResetProxy).on("reset."+data_validation,onResetProxy).validate(this.options);},validate:function(){$form.validate();return $form.valid();}};$form.data(data_validation,result);}
return result;}
$jQval.unobtrusive={adapters:[],parseElement:function(element,skipAttach){var $element=$(element),form=$element.parents("form")[0],valInfo,rules,messages;if(!form){return;}
valInfo=validationInfo(form);valInfo.options.rules[element.name]=rules={};valInfo.options.messages[element.name]=messages={};$.each(this.adapters,function(){var prefix="data-val-"+this.name,message=$element.attr(prefix),paramValues={};if(message!==undefined){prefix+="-";$.each(this.params,function(){paramValues[this]=$element.attr(prefix+this);});this.adapt({element:element,form:form,message:message,params:paramValues,rules:rules,messages:messages});}});$.extend(rules,{"__dummy__":true});if(!skipAttach){valInfo.attachValidation();}},parse:function(selector){var $selector=$(selector),$forms=$selector.parents().addBack().filter("form").add($selector.find("form")).has("[data-val=true]");$selector.find("[data-val=true]").each(function(){$jQval.unobtrusive.parseElement(this,true);});$forms.each(function(){var info=validationInfo(this);if(info){info.attachValidation();}});}};adapters=$jQval.unobtrusive.adapters;adapters.add=function(adapterName,params,fn){if(!fn){fn=params;params=[];}
this.push({name:adapterName,params:params,adapt:fn});return this;};adapters.addBool=function(adapterName,ruleName){return this.add(adapterName,function(options){setValidationValues(options,ruleName||adapterName,true);});};adapters.addMinMax=function(adapterName,minRuleName,maxRuleName,minMaxRuleName,minAttribute,maxAttribute){return this.add(adapterName,[minAttribute||"min",maxAttribute||"max"],function(options){var min=options.params.min,max=options.params.max;if(min&&max){setValidationValues(options,minMaxRuleName,[min,max]);}
else if(min){setValidationValues(options,minRuleName,min);}
else if(max){setValidationValues(options,maxRuleName,max);}});};adapters.addSingleVal=function(adapterName,attribute,ruleName){return this.add(adapterName,[attribute||"val"],function(options){setValidationValues(options,ruleName||adapterName,options.params[attribute]);});};$jQval.addMethod("__dummy__",function(value,element,params){return true;});$jQval.addMethod("regex",function(value,element,params){var match;if(this.optional(element)){return true;}
match=new RegExp(params).exec(value);return(match&&(match.index===0)&&(match[0].length===value.length));});$jQval.addMethod("nonalphamin",function(value,element,nonalphamin){var match;if(nonalphamin){match=value.match(/\W/g);match=match&&match.length>=nonalphamin;}
return match;});if($jQval.methods.extension){adapters.addSingleVal("accept","mimtype");adapters.addSingleVal("extension","extension");}else{adapters.addSingleVal("extension","extension","accept");}
adapters.addSingleVal("regex","pattern");adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");adapters.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");adapters.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength");adapters.add("equalto",["other"],function(options){var prefix=getModelPrefix(options.element.name),other=options.params.other,fullOtherName=appendModelPrefix(other,prefix),element=$(options.form).find(":input").filter("[name='"+escapeAttributeValue(fullOtherName)+"']")[0];setValidationValues(options,"equalTo",element);});adapters.add("required",function(options){if(options.element.tagName.toUpperCase()!=="INPUT"||options.element.type.toUpperCase()!=="CHECKBOX"){setValidationValues(options,"required",true);}});adapters.add("remote",["url","type","additionalfields"],function(options){var value={url:options.params.url,type:options.params.type||"GET",data:{}},prefix=getModelPrefix(options.element.name);$.each(splitAndTrim(options.params.additionalfields||options.element.name),function(i,fieldName){var paramName=appendModelPrefix(fieldName,prefix);value.data[paramName]=function(){var field=$(options.form).find(":input").filter("[name='"+escapeAttributeValue(paramName)+"']");if(field.is(":checkbox")){return field.filter(":checked").val()||field.filter(":hidden").val()||'';}
else if(field.is(":radio")){return field.filter(":checked").val()||'';}
return field.val();};});setValidationValues(options,"remote",value);});adapters.add("password",["min","nonalphamin","regex"],function(options){if(options.params.min){setValidationValues(options,"minlength",options.params.min);}
if(options.params.nonalphamin){setValidationValues(options,"nonalphamin",options.params.nonalphamin);}
if(options.params.regex){setValidationValues(options,"regex",options.params.regex);}});adapters.add("fileextensions",["extensions"],function(options){setValidationValues(options,"extension",options.params.extensions);});$(function(){$jQval.unobtrusive.parse(document);});return $jQval.unobtrusive;}));;;
(function(){"use strict";window.ng=window.ng||{};window.ng.util=window.ng.util||{};ng.util.getCookie=function(cookieName){var name=cookieName+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)===" ")c=c.substring(1);if(c.indexOf(name)===0)return c.substring(name.length,c.length);}
return"";}
ng.util.setCookie=function(cookieName,cookieValue,expiryInHours,path,domain,sameSite){sameSite=sameSite||"lax";var cookieString=cookieName+"="+cookieValue;if(expiryInHours){var d=new Date();d.setTime(d.getTime()+expiryInHours*60*60*1000);cookieString+=";expires="+d.toUTCString();}
if(path){cookieString+=";path="+path;}
if(domain){cookieString+=";domain="+domain;}
if(sameSite){cookieString+=";samesite="+sameSite;}
document.cookie=cookieString;}
ng.util.getUrlParam=function(paramName){"use strict";var values=[];if(window.location&&typeof window.location.href==="string"){var src=window.location.href;var re=new RegExp("[\?&]"+paramName+"=([^&#]*)","g");var result;while((result=re.exec(src))!==null){values.push(decodeURIComponent(result[1].replace(/\+/g," ")));}}
if(values.length===0){return null;}else if(values.length===1){return values[0];}else{return values;}}
ng.util.setUrlParam=function(url,name,value){"use strict";if(typeof url!=="string"||typeof name!=="string"||typeof value!="string")return url;var parts,anchor,parameters;parts=url.split("#");if(parts.length===2){anchor=parts[1];}
parts=parts[0].split("?");if(parts.length===2){parameters=parts[1];}
parameters=parameters?parameters+"&"+name+"="+encodeURIComponent(value):name+"="+encodeURIComponent(value);url=parts[0]+(parameters?"?"+parameters:"")+(anchor?"#"+anchor:"");return url;}
ng.util.addOrUpdateUrlParam=function(url,pName,pValue){"use strict";if(typeof url!=="string"||typeof pName!=="string")return url;var parts,anchor,parameters;parts=url.split("#");if(parts.length===2){anchor=parts[1];}
parts=parts[0].split("?");if(parts.length===2){parameters=parts[1];}
pValue=encodeURIComponent(pValue);if(parameters!==undefined&&parameters!==''){var foundParamName=0;var obj=parameters.split('&');let i=0;for(;i<obj.length;i++){if(obj[i].startsWith(pName+'=')){let pair=obj[i].split('=');pair[1]=pValue;obj[i]=pair.join('=');foundParamName=1;break;}}
if(foundParamName===0){obj.push(pName+'='+pValue);}
parameters=obj.join('&');}
else{parameters=pName+'='+pValue;}
url=parts[0]+(parameters?"?"+parameters:"")+(anchor?"#"+anchor:"");return url;};ng.util.urlContains=function(str){return window.location&&window.location.href.toLowerCase().indexOf(str.toLowerCase())>-1;}
ng.util.urlMatches=function(re){return window.location&&re.test(window.location.href);}
ng.util.trapFocusOn=function($container,$firstItem,$lastItem){var firstFocusableElem=$firstItem[0];var lastFocusableElem=$lastItem[0];var KEYCODE_TAB=9;ng.util.trapFocusOff($container);$container.on("keydown.trapFocus",function(e){if(e.keyCode===KEYCODE_TAB){if(e.shiftKey){if(document.activeElement===firstFocusableElem){lastFocusableElem.focus();e.preventDefault();}}else{if(document.activeElement===lastFocusableElem){firstFocusableElem.focus();e.preventDefault();}}}});}
ng.util.trapFocusOff=function($container){$container.off("keydown.trapFocus");}
ng.util.addModalKeyboardInteraction=function(modal,closeCallback){var KEYCODE_TAB=9;var KEYCODE_ESC=27;modal.on("keydown.modal",function(e){if(e.keyCode===KEYCODE_TAB){var tabbable=getTabbable(modal);var firstTabbable=tabbable.first();var lastTabbable=tabbable.last();if(e.shiftKey){if(document.activeElement===firstTabbable[0]){lastTabbable.trigger("focus");e.preventDefault();}}else{if(document.activeElement===lastTabbable[0]){firstTabbable.trigger("focus");e.preventDefault();}}}
else if(e.keyCode===KEYCODE_ESC){closeCallback(modal);}});return getTabbable(modal);}
function getFocusable(container){var selector="input:visible:not(:disabled), select:visible:not(:disabled), textarea:visible:not(:disabled), button:visible:not(:disabled), object:visible:not(:disabled), a[href]:visible, area[href]:visible, *[tabindex]:visible";return $(selector,container);}
function getTabbable(container){var focusable=getFocusable(container);return focusable.filter(function(idx,ele){return ele.tabIndex>=0;});}
ng.util.getTabbable=getTabbable;ng.util.sessionSet=function(key,value){try{sessionStorage.setItem(key,JSON.stringify(value));return true;}catch(err){console.log(err);return false;}}
ng.util.sessionGet=function(key){try{return JSON.parse(sessionStorage.getItem(key));}catch(err){console.log(err);return null;}}
ng.util.sessionRemove=function(key){try{sessionStorage.removeItem(key);return true;}catch(err){console.log(err);return false;}}})();;;
(function(){"use strict";window.ng=window.ng||{};window.ng.ui=window.ng.ui||{};ng.ui.ShowPageLoadingOverlay=function(){$('.page-loading-overlay').show();setTimeout(function(){let txt=$('.page-loading-overlay .h2').html();$('.page-loading-overlay .h2').html('<span role="status">'+txt+'</span>');},100);};ng.ui.HidePageLoadingOverlay=function(){$('.page-loading-overlay').hide();};})();;;
function attachPopup(popup){"use strict";var matchingLinks=[];if(popup.matchUrl){matchingLinks=$("a").filter(function(){return $(this).attr("href")&&$(this).attr("href").toLowerCase().indexOf(popup.matchUrl.toLowerCase())>=0;});}
if(matchingLinks.length>0){var cookieName=popup.id;loadPopup(popup,cookieName);matchingLinks.on("click",function(){$(this).addClass(popup.id+"-opener");return!showPopup(popup,cookieName,$(this));});}}
function loadPopup(popup,cookieName){"use strict";var setTheCookie=false;var popupID=popup.id;if($("#"+popupID).length===0){$.get("/custom/popups/membership/popup.html?v=20191107",function(popupHtml){$(popupHtml).attr("id",popupID).appendTo("body");var $popup=$("#"+popupID);$(".title",$popup).html(popup.title).attr("id",popupID+"-title");$(".subtitle",$popup).text(popup.subtitle);$(".popup",$popup).attr("aria-labelledby",popupID+"-title");if(popup.button1Text){$(".btp-membership-button",$popup).text(popup.button1Text);$(".btp-membership-button",$popup).attr("href",popup.button1Url);}else{$(".btp-membership-button",$popup).hide();}
if(popup.button2Text){$(".btp-tickets-button",$popup).text(popup.button2Text);$(".btp-tickets-button",$popup).attr("href",popup.button2Url);}else{$(".btp-tickets-button",$popup).hide();}
$(".btp-membership-button",$popup).attr("data-btpid",popupID);$(".btp-tickets-button",$popup).attr("data-btpid",popupID);$(".btp-close-button",$popup).attr("data-btpid",popupID);var imageStyles="<style>#"+popupID+" .popup .image {background-image: url("+popup.mobileImage+");} @media (min-width: 992px) {#"+popupID+" .popup .image {background-image: url("+popup.desktopImage+");}}</style>";$(imageStyles).appendTo("head");if(setTheCookie){ng.util.setCookie(cookieName,"1",0,"/");}
$(".popup-screen, .btp-close-button",$popup).on("click",function(){hidePopup($popup);});$(".button a",$popup).on("click",function(){hidePopup($popup);if(setTheCookie){ng.util.setCookie(cookieName,"1",0,"/");}
return true;});});}}
function showPopup(popup,cookieName,$clickedLink){"use strict";var checkTheCookie=false;var showSpeed=400;if(checkTheCookie&&ng.util.getCookie(cookieName)==="1"){return false;}
var popupID=popup.id;var $popup=$("#"+popupID);if($popup.length===0){return false;}else{var isSignedIn=ng.util.getCookie("ngSessUid")>0;var isMember=ng.util.getCookie("ngSessMember").length>0;if(isSignedIn&&isMember){var memberUrl=popup.button1Url;var pattern=/\/account\/login\?returnurl=/i;if(pattern.test(memberUrl)){memberUrl=memberUrl.replace(pattern,"");memberUrl=decodeURIComponent(memberUrl);}
$clickedLink.attr("href",memberUrl).attr("target","_blank");return false;}
if(isSignedIn&&!isMember){$clickedLink.attr("target","_blank");return false;}
$popup.addClass("visible").fadeIn(showSpeed,function(){$(".btn",$popup).filter(":visible").first().trigger("focus");});ng.util.addModalKeyboardInteraction($popup,hidePopup);if(!popup.button2Url){var originalUrl=$clickedLink.attr("href");$(".btp-tickets-button",$popup).attr("href",originalUrl);}
return true;}}
function hidePopup($popup){"use strict";var popupID=$popup.attr("id");if($popup.length>0){$popup.hide().removeClass("visible");}
$("."+popupID+"-opener").trigger("focus").removeClass(popupID+"-opener");}
$(window).on("load",function(){"use strict";setTimeout(function(){if(window.location&&window.location.hash){let fragmentID=window.location.hash.substring(1);if(fragmentID.indexOf("=")>-1){return;}
if($("#"+fragmentID).hasClass('for-collapse')){if(!$("#"+fragmentID+'-content').hasClass('show')){$("#"+fragmentID+'-content').collapse('show');}}
let extraFixedTop=$(".extra-fixed-top").outerHeight(true);scrollToFragment(fragmentID,extraFixedTop);}},25);});$("a[href^='#']").on("click.shared",function(e){"use strict";if($(this).parents(".modal").length>0){return;}
e.preventDefault();var fragmentID=this.hash.substring(1);window.location.hash=fragmentID;scrollToFragment(fragmentID);});function scrollToFragment(fragmentId,extraFixedTop){"use strict";extraFixedTop=extraFixedTop||0;if(fragmentId){if($(".top-bar").length>0)
extraFixedTop+=$(".top-bar").outerHeight(true);if($(".secondary-menu-bar").length>0)
extraFixedTop+=$(".secondary-menu-bar").outerHeight(true);if(fragmentId==="top"){$(document).scrollTop(0);$("#top").trigger("blur");}else{var fragment=$("#"+fragmentId+", a[name='"+fragmentId+"']").first();if(fragment.length>0){var newScrollTop=fragment.offset().top-extraFixedTop-10;$(document).scrollTop(newScrollTop);}}}}
$(function(){"use strict";window.addEventListener("resize",resizeThrottler,false);var wWidth=window.innerWidth;var wHeight=window.innerHeight;var resizeTimeout;function resizeThrottler(){if(!resizeTimeout){resizeTimeout=setTimeout(function(){resizeTimeout=null;let wChange=(wWidth-window.innerWidth)!=0;let hChange=(wHeight-window.innerHeight)!=0;wWidth=window.innerWidth;wHeight=window.innerHeight;actualResizeHandler(wChange,hChange);},67);}}
function actualResizeHandler(widthChange,heightChange){if(typeof adjustTopBar==="function")adjustTopBar();if(typeof adjustAudioPlayerPosition==="function")adjustAudioPlayerPosition();if(typeof adjustCatalogueEntryLayout==="function")adjustCatalogueEntryLayout();if(heightChange){if(typeof adjustPaintingCanvasSize==="function")adjustPaintingCanvasSize();}
if(widthChange){if(typeof resetCardSliders==="function")resetCardSliders();if(typeof resetCardSliderElementals==="function")resetCardSliderElementals();if(typeof adjustSecondaryMenu==="function")adjustSecondaryMenu();if(typeof adjustBrowseEventsPanel==="function")adjustBrowseEventsPanel();if(typeof adjustEventListingFilter==="function")adjustEventListingFilter();if(typeof adjustExhibitionVenues==="function")adjustExhibitionVenues();if(typeof adjustTablists==="function")adjustTablists();}}});$(function(){"use strict";if(window.innerWidth&&window.innerWidth<1200){$(".read-more:visible").readMore();}});(function($){$.fn.readMore=function(action,showReadLess){const defaultMaxHeight=500;const minHeight=120;const tolerance=200;return this.each(function(){let block=$(this);if(action==="remove"){remove(block,showReadLess);}else{add(block,showReadLess);}
function add(block,showReadLess){let maxHeight=parseInt(block.data("maxHeight"));if(isNaN(maxHeight)){maxHeight=defaultMaxHeight;}
block.addClass("read-more");let currentHeight=block.outerHeight();if(currentHeight>maxHeight+tolerance){let topMargin=parseInt(block.css("marginTop"));let bottomMargin=parseInt(block.css("marginBottom"));if(isNaN(topMargin)){topMargin=0;}
if(isNaN(bottomMargin)){bottomMargin=0;}
let newHeight=maxHeight-topMargin-bottomMargin;if(newHeight>=minHeight){block.addClass("read-more-overflow");block.outerHeight(newHeight);block.append("<div class='read-more-fade'></div><button class='read-more-popover more'>Read more</button>");block.find(".read-more-popover.more").on("click",function(){remove(block,showReadLess);});}}}
function remove(block,showReadLess){if(block.length>0&&block.hasClass("read-more-overflow")){block.removeClass("read-more-overflow");block.outerHeight("auto");block.find(".read-more-fade, .read-more-popover").remove();if(showReadLess===true){block.addClass("read-more-overflow");block.append("<button class='read-more-popover less'>Read less</button>");block.find(".read-more-popover.less").on("click",function(){$(this).remove();add(block,showReadLess);block[0].scrollIntoView(false);});}}}});};}(jQuery));$(function(){"use strict";var urlParamName="promo";var cookieName="ngPromo";var tnewHostLive="my.nationalgallery.org.uk";var tnewHostTest="nglo-tnew-test.tnhs.cloud";var promo;promo=ng.util.getUrlParam(urlParamName);if(promo){ng.util.setCookie(cookieName,promo,7*24,"/");}
promo=ng.util.getCookie(cookieName);if(promo){$("a[href]").each(function(){var href=$(this).attr("href");if(href&&(href.indexOf(tnewHostLive)>-1||href.indexOf(tnewHostTest)>-1)){href=ng.util.setUrlParam(href,urlParamName,promo);$(this).attr("href",href);}});if(typeof btPopup!=="undefined"&&btPopup.MembershipLink){btPopup.MembershipLink=ng.util.setUrlParam(btPopup.MembershipLink,urlParamName,promo);}}});(function($){$.validator.unobtrusive.adapters.add("regexwithoptions",["pattern","flags"],function(options){options.messages['regexwithoptions']=options.message;options.rules['regexwithoptions']=options.params;});$.validator.addMethod("regexwithoptions",function(value,element,params){var match;if(this.optional(element)){return true;}
var reg=new RegExp(params.pattern,params.flags);match=reg.exec(value);return(match&&(match.index===0)&&(match[0].length===value.length));});})(jQuery);$(function(){$(".umbraco-forms-form .umbraco-forms-indicator").attr("aria-label","(required)");$(".umbraco-forms-form .field-validation-valid").attr("role","alert");});;;
(function(){"use strict";if($("#CybotCookiebotDialog").length){CookiebotOnDialogDisplay();}else{window.addEventListener("CookiebotOnDialogDisplay",function(e){window.setTimeout(function(){CookiebotOnDialogDisplay();},250);},false);}
window.addEventListener("CookiebotOnConsentReady",function(e){CookiebotOnDialogHide();},false);$(".cookiebot-renew").on("click",function(){if(typeof Cookiebot!=="undefined"){Cookiebot.renew();}});function CookiebotOnDialogDisplay(){$("#CybotCookiebotDialog").before("<div id='CookiebotDialogScreen'></div>");$("body").addClass("modal-open");$("#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowAll").trigger("focus");}
function CookiebotOnDialogHide(){$("#CookiebotDialogScreen").remove();$("body").removeClass("modal-open");}})();;;
function adjustSecondaryMenu(){$(".secondary-menu-bar .menu .dropdown").hide();$(".secondary-menu-bar .menu-main").removeClass("ms-auto");$(".secondary-menu-bar .menu-overflow .dropdown-item").each(function(){$(this).removeClass("dropdown-item").addClass("nav-item").appendTo(".secondary-menu-bar .menu-main");});var totalItemWidth=25;var availableSpace=$(".secondary-menu-bar .menu").width();$(".secondary-menu-bar .menu .nav-item").each(function(){totalItemWidth+=$(this).innerWidth();if(totalItemWidth>availableSpace){$(this).removeClass("nav-item").addClass("dropdown-item").appendTo(".secondary-menu-bar .menu-overflow");}});if(totalItemWidth>availableSpace){$(".secondary-menu-bar .menu .dropdown").show();$(".secondary-menu-bar .menu-main").addClass("ms-auto");}}
$(function(){adjustSecondaryMenu();if($(".secondary-menu-bar .nav-link[href^='#']").length>0){$("body").scrollspy({target:".secondary-menu-bar",rootMargin:"-100px 0px -75% 0px",threshold:[0]});}});;;
function OpenSeadragon(options){return new OpenSeadragon.Viewer(options);}
(function($){$.version={versionStr:'2.4.2',major:parseInt('2',10),minor:parseInt('4',10),revision:parseInt('2',10)};var class2type={'[object Boolean]':'boolean','[object Number]':'number','[object String]':'string','[object Function]':'function','[object Array]':'array','[object Date]':'date','[object RegExp]':'regexp','[object Object]':'object'},toString=Object.prototype.toString,hasOwn=Object.prototype.hasOwnProperty;$.isFunction=function(obj){return $.type(obj)==="function";};$.isArray=Array.isArray||function(obj){return $.type(obj)==="array";};$.isWindow=function(obj){return obj&&typeof obj==="object"&&"setInterval" in obj;};$.type=function(obj){return(obj===null)||(obj===undefined)?String(obj):class2type[toString.call(obj)]||"object";};$.isPlainObject=function(obj){if(!obj||OpenSeadragon.type(obj)!=="object"||obj.nodeType||$.isWindow(obj)){return false;}
if(obj.constructor&&!hasOwn.call(obj,"constructor")&&!hasOwn.call(obj.constructor.prototype,"isPrototypeOf")){return false;}
var lastKey;for(var key in obj){lastKey=key;}
return lastKey===undefined||hasOwn.call(obj,lastKey);};$.isEmptyObject=function(obj){for(var name in obj){return false;}
return true;};$.freezeObject=function(obj){if(Object.freeze){$.freezeObject=Object.freeze;}else{$.freezeObject=function(obj){return obj;};}
return $.freezeObject(obj);};$.supportsCanvas=(function(){var canvasElement=document.createElement('canvas');return!!($.isFunction(canvasElement.getContext)&&canvasElement.getContext('2d'));}());$.isCanvasTainted=function(canvas){var isTainted=false;try{canvas.getContext('2d').getImageData(0,0,1,1);}catch(e){isTainted=true;}
return isTainted;};$.pixelDensityRatio=(function(){if($.supportsCanvas){var context=document.createElement('canvas').getContext('2d');var devicePixelRatio=window.devicePixelRatio||1;var backingStoreRatio=context.webkitBackingStorePixelRatio||context.mozBackingStorePixelRatio||context.msBackingStorePixelRatio||context.oBackingStorePixelRatio||context.backingStorePixelRatio||1;return Math.max(devicePixelRatio,1)/backingStoreRatio;}else{return 1;}}());}(OpenSeadragon));(function($){$.extend=function(){var options,name,src,copy,copyIsArray,clone,target=arguments[0]||{},length=arguments.length,deep=false,i=1;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2;}
if(typeof target!=="object"&&!OpenSeadragon.isFunction(target)){target={};}
if(length===i){target=this;--i;}
for(;i<length;i++){options=arguments[i];if(options!==null||options!==undefined){for(name in options){src=target[name];copy=options[name];if(target===copy){continue;}
if(deep&&copy&&(OpenSeadragon.isPlainObject(copy)||(copyIsArray=OpenSeadragon.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&OpenSeadragon.isArray(src)?src:[];}else{clone=src&&OpenSeadragon.isPlainObject(src)?src:{};}
target[name]=OpenSeadragon.extend(deep,clone,copy);}else if(copy!==undefined){target[name]=copy;}}}}
return target;};var isIOSDevice=function(){if(typeof navigator!=='object'){return false;}
var userAgent=navigator.userAgent;if(typeof userAgent!=='string'){return false;}
return userAgent.indexOf('iPhone')!==-1||userAgent.indexOf('iPad')!==-1||userAgent.indexOf('iPod')!==-1;};$.extend($,{DEFAULT_SETTINGS:{xmlPath:null,tileSources:null,tileHost:null,initialPage:0,crossOriginPolicy:false,ajaxWithCredentials:false,loadTilesWithAjax:false,ajaxHeaders:{},panHorizontal:true,panVertical:true,constrainDuringPan:false,wrapHorizontal:false,wrapVertical:false,visibilityRatio:0.5,minPixelRatio:0.5,defaultZoomLevel:0,minZoomLevel:null,maxZoomLevel:null,homeFillsViewer:false,clickTimeThreshold:300,clickDistThreshold:5,dblClickTimeThreshold:300,dblClickDistThreshold:20,springStiffness:6.5,animationTime:1.2,gestureSettingsMouse:{scrollToZoom:true,clickToZoom:true,dblClickToZoom:false,pinchToZoom:false,zoomToRefPoint:true,flickEnabled:false,flickMinSpeed:120,flickMomentum:0.25,pinchRotate:false},gestureSettingsTouch:{scrollToZoom:false,clickToZoom:false,dblClickToZoom:true,pinchToZoom:true,zoomToRefPoint:true,flickEnabled:true,flickMinSpeed:120,flickMomentum:0.25,pinchRotate:false},gestureSettingsPen:{scrollToZoom:false,clickToZoom:true,dblClickToZoom:false,pinchToZoom:false,zoomToRefPoint:true,flickEnabled:false,flickMinSpeed:120,flickMomentum:0.25,pinchRotate:false},gestureSettingsUnknown:{scrollToZoom:false,clickToZoom:false,dblClickToZoom:true,pinchToZoom:true,zoomToRefPoint:true,flickEnabled:true,flickMinSpeed:120,flickMomentum:0.25,pinchRotate:false},zoomPerClick:2,zoomPerScroll:1.2,zoomPerSecond:1.0,blendTime:0,alwaysBlend:false,autoHideControls:true,immediateRender:false,minZoomImageRatio:0.9,maxZoomPixelRatio:1.1,smoothTileEdgesMinZoom:1.1,iOSDevice:isIOSDevice(),pixelsPerWheelLine:40,pixelsPerArrowPress:40,autoResize:true,preserveImageSizeOnResize:false,minScrollDeltaTime:50,rotationIncrement:90,showSequenceControl:true,sequenceControlAnchor:null,preserveViewport:false,preserveOverlays:false,navPrevNextWrap:false,showNavigationControl:true,navigationControlAnchor:null,showZoomControl:true,showHomeControl:true,showFullPageControl:true,showRotationControl:false,showFlipControl:false,controlsFadeDelay:2000,controlsFadeLength:1500,mouseNavEnabled:true,showNavigator:false,navigatorId:null,navigatorPosition:null,navigatorSizeRatio:0.2,navigatorMaintainSizeRatio:false,navigatorTop:null,navigatorLeft:null,navigatorHeight:null,navigatorWidth:null,navigatorAutoResize:true,navigatorAutoFade:true,navigatorRotate:true,navigatorBackground:'#000',navigatorOpacity:0.8,navigatorBorderColor:'#555',navigatorDisplayRegionColor:'#900',degrees:0,flipped:false,opacity:1,preload:false,compositeOperation:null,imageSmoothingEnabled:true,placeholderFillStyle:null,showReferenceStrip:false,referenceStripScroll:'horizontal',referenceStripElement:null,referenceStripHeight:null,referenceStripWidth:null,referenceStripPosition:'BOTTOM_LEFT',referenceStripSizeRatio:0.2,collectionRows:3,collectionColumns:0,collectionLayout:'horizontal',collectionMode:false,collectionTileSize:800,collectionTileMargin:80,imageLoaderLimit:0,maxImageCacheCount:200,timeout:30000,useCanvas:true,prefixUrl:"/images/",navImages:{zoomIn:{REST:'zoomin_rest.png',GROUP:'zoomin_grouphover.png',HOVER:'zoomin_hover.png',DOWN:'zoomin_pressed.png'},zoomOut:{REST:'zoomout_rest.png',GROUP:'zoomout_grouphover.png',HOVER:'zoomout_hover.png',DOWN:'zoomout_pressed.png'},home:{REST:'home_rest.png',GROUP:'home_grouphover.png',HOVER:'home_hover.png',DOWN:'home_pressed.png'},fullpage:{REST:'fullpage_rest.png',GROUP:'fullpage_grouphover.png',HOVER:'fullpage_hover.png',DOWN:'fullpage_pressed.png'},rotateleft:{REST:'rotateleft_rest.png',GROUP:'rotateleft_grouphover.png',HOVER:'rotateleft_hover.png',DOWN:'rotateleft_pressed.png'},rotateright:{REST:'rotateright_rest.png',GROUP:'rotateright_grouphover.png',HOVER:'rotateright_hover.png',DOWN:'rotateright_pressed.png'},flip:{REST:'flip_rest.png',GROUP:'flip_grouphover.png',HOVER:'flip_hover.png',DOWN:'flip_pressed.png'},previous:{REST:'previous_rest.png',GROUP:'previous_grouphover.png',HOVER:'previous_hover.png',DOWN:'previous_pressed.png'},next:{REST:'next_rest.png',GROUP:'next_grouphover.png',HOVER:'next_hover.png',DOWN:'next_pressed.png'}},debugMode:false,debugGridColor:['#437AB2','#1B9E77','#D95F02','#7570B3','#E7298A','#66A61E','#E6AB02','#A6761D','#666666']},SIGNAL:"----seadragon----",delegate:function(object,method){return function(){var args=arguments;if(args===undefined){args=[];}
return method.apply(object,args);};},BROWSERS:{UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5},getElement:function(element){if(typeof(element)=="string"){element=document.getElementById(element);}
return element;},getElementPosition:function(element){var result=new $.Point(),isFixed,offsetParent;element=$.getElement(element);isFixed=$.getElementStyle(element).position=="fixed";offsetParent=getOffsetParent(element,isFixed);while(offsetParent){result.x+=element.offsetLeft;result.y+=element.offsetTop;if(isFixed){result=result.plus($.getPageScroll());}
element=offsetParent;isFixed=$.getElementStyle(element).position=="fixed";offsetParent=getOffsetParent(element,isFixed);}
return result;},getElementOffset:function(element){element=$.getElement(element);var doc=element&&element.ownerDocument,docElement,win,boundingRect={top:0,left:0};if(!doc){return new $.Point();}
docElement=doc.documentElement;if(typeof element.getBoundingClientRect!==typeof undefined){boundingRect=element.getBoundingClientRect();}
win=(doc==doc.window)?doc:(doc.nodeType===9)?doc.defaultView||doc.parentWindow:false;return new $.Point(boundingRect.left+(win.pageXOffset||docElement.scrollLeft)-(docElement.clientLeft||0),boundingRect.top+(win.pageYOffset||docElement.scrollTop)-(docElement.clientTop||0));},getElementSize:function(element){element=$.getElement(element);return new $.Point(element.clientWidth,element.clientHeight);},getElementStyle:document.documentElement.currentStyle?function(element){element=$.getElement(element);return element.currentStyle;}:function(element){element=$.getElement(element);return window.getComputedStyle(element,"");},getCssPropertyWithVendorPrefix:function(property){var memo={};$.getCssPropertyWithVendorPrefix=function(property){if(memo[property]!==undefined){return memo[property];}
var style=document.createElement('div').style;var result=null;if(style[property]!==undefined){result=property;}else{var prefixes=['Webkit','Moz','MS','O','webkit','moz','ms','o'];var suffix=$.capitalizeFirstLetter(property);for(var i=0;i<prefixes.length;i++){var prop=prefixes[i]+suffix;if(style[prop]!==undefined){result=prop;break;}}}
memo[property]=result;return result;};return $.getCssPropertyWithVendorPrefix(property);},capitalizeFirstLetter:function(string){return string.charAt(0).toUpperCase()+string.slice(1);},positiveModulo:function(number,modulo){var result=number%modulo;if(result<0){result+=modulo;}
return result;},pointInElement:function(element,point){element=$.getElement(element);var offset=$.getElementOffset(element),size=$.getElementSize(element);return point.x>=offset.x&&point.x<offset.x+size.x&&point.y<offset.y+size.y&&point.y>=offset.y;},getEvent:function(event){if(event){$.getEvent=function(event){return event;};}else{$.getEvent=function(){return window.event;};}
return $.getEvent(event);},getMousePosition:function(event){if(typeof(event.pageX)=="number"){$.getMousePosition=function(event){var result=new $.Point();event=$.getEvent(event);result.x=event.pageX;result.y=event.pageY;return result;};}else if(typeof(event.clientX)=="number"){$.getMousePosition=function(event){var result=new $.Point();event=$.getEvent(event);result.x=event.clientX+
document.body.scrollLeft+
document.documentElement.scrollLeft;result.y=event.clientY+
document.body.scrollTop+
document.documentElement.scrollTop;return result;};}else{throw new Error("Unknown event mouse position, no known technique.");}
return $.getMousePosition(event);},getPageScroll:function(){var docElement=document.documentElement||{},body=document.body||{};if(typeof(window.pageXOffset)=="number"){$.getPageScroll=function(){return new $.Point(window.pageXOffset,window.pageYOffset);};}else if(body.scrollLeft||body.scrollTop){$.getPageScroll=function(){return new $.Point(document.body.scrollLeft,document.body.scrollTop);};}else if(docElement.scrollLeft||docElement.scrollTop){$.getPageScroll=function(){return new $.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop);};}else{return new $.Point(0,0);}
return $.getPageScroll();},setPageScroll:function(scroll){if(typeof(window.scrollTo)!=="undefined"){$.setPageScroll=function(scroll){window.scrollTo(scroll.x,scroll.y);};}else{var originalScroll=$.getPageScroll();if(originalScroll.x===scroll.x&&originalScroll.y===scroll.y){return;}
document.body.scrollLeft=scroll.x;document.body.scrollTop=scroll.y;var currentScroll=$.getPageScroll();if(currentScroll.x!==originalScroll.x&&currentScroll.y!==originalScroll.y){$.setPageScroll=function(scroll){document.body.scrollLeft=scroll.x;document.body.scrollTop=scroll.y;};return;}
document.documentElement.scrollLeft=scroll.x;document.documentElement.scrollTop=scroll.y;currentScroll=$.getPageScroll();if(currentScroll.x!==originalScroll.x&&currentScroll.y!==originalScroll.y){$.setPageScroll=function(scroll){document.documentElement.scrollLeft=scroll.x;document.documentElement.scrollTop=scroll.y;};return;}
$.setPageScroll=function(scroll){};}
return $.setPageScroll(scroll);},getWindowSize:function(){var docElement=document.documentElement||{},body=document.body||{};if(typeof(window.innerWidth)=='number'){$.getWindowSize=function(){return new $.Point(window.innerWidth,window.innerHeight);};}else if(docElement.clientWidth||docElement.clientHeight){$.getWindowSize=function(){return new $.Point(document.documentElement.clientWidth,document.documentElement.clientHeight);};}else if(body.clientWidth||body.clientHeight){$.getWindowSize=function(){return new $.Point(document.body.clientWidth,document.body.clientHeight);};}else{throw new Error("Unknown window size, no known technique.");}
return $.getWindowSize();},makeCenteredNode:function(element){element=$.getElement(element);var wrappers=[$.makeNeutralElement('div'),$.makeNeutralElement('div'),$.makeNeutralElement('div')];$.extend(wrappers[0].style,{display:"table",height:"100%",width:"100%"});$.extend(wrappers[1].style,{display:"table-row"});$.extend(wrappers[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"});wrappers[0].appendChild(wrappers[1]);wrappers[1].appendChild(wrappers[2]);wrappers[2].appendChild(element);return wrappers[0];},makeNeutralElement:function(tagName){var element=document.createElement(tagName),style=element.style;style.background="transparent none";style.border="none";style.margin="0px";style.padding="0px";style.position="static";return element;},now:function(){if(Date.now){$.now=Date.now;}else{$.now=function(){return new Date().getTime();};}
return $.now();},makeTransparentImage:function(src){$.makeTransparentImage=function(src){var img=$.makeNeutralElement("img");img.src=src;return img;};if($.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<7){$.makeTransparentImage=function(src){var img=$.makeNeutralElement("img"),element=null;element=$.makeNeutralElement("span");element.style.display="inline-block";img.onload=function(){element.style.width=element.style.width||img.width+"px";element.style.height=element.style.height||img.height+"px";img.onload=null;img=null;};img.src=src;element.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
src+"', sizingMethod='scale')";return element;};}
return $.makeTransparentImage(src);},setElementOpacity:function(element,opacity,usesAlpha){var ieOpacity,ieFilter;element=$.getElement(element);if(usesAlpha&&!$.Browser.alpha){opacity=Math.round(opacity);}
if($.Browser.opacity){element.style.opacity=opacity<1?opacity:"";}else{if(opacity<1){ieOpacity=Math.round(100*opacity);ieFilter="alpha(opacity="+ieOpacity+")";element.style.filter=ieFilter;}else{element.style.filter="";}}},setElementTouchActionNone:function(element){element=$.getElement(element);if(typeof element.style.touchAction!=='undefined'){element.style.touchAction='none';}else if(typeof element.style.msTouchAction!=='undefined'){element.style.msTouchAction='none';}},addClass:function(element,className){element=$.getElement(element);if(!element.className){element.className=className;}else if((' '+element.className+' ').indexOf(' '+className+' ')===-1){element.className+=' '+className;}},indexOf:function(array,searchElement,fromIndex){if(Array.prototype.indexOf){this.indexOf=function(array,searchElement,fromIndex){return array.indexOf(searchElement,fromIndex);};}else{this.indexOf=function(array,searchElement,fromIndex){var i,pivot=(fromIndex)?fromIndex:0,length;if(!array){throw new TypeError();}
length=array.length;if(length===0||pivot>=length){return-1;}
if(pivot<0){pivot=length-Math.abs(pivot);}
for(i=pivot;i<length;i++){if(array[i]===searchElement){return i;}}
return-1;};}
return this.indexOf(array,searchElement,fromIndex);},removeClass:function(element,className){var oldClasses,newClasses=[],i;element=$.getElement(element);oldClasses=element.className.split(/\s+/);for(i=0;i<oldClasses.length;i++){if(oldClasses[i]&&oldClasses[i]!==className){newClasses.push(oldClasses[i]);}}
element.className=newClasses.join(' ');},addEvent:(function(){if(window.addEventListener){return function(element,eventName,handler,useCapture){element=$.getElement(element);element.addEventListener(eventName,handler,useCapture);};}else if(window.attachEvent){return function(element,eventName,handler,useCapture){element=$.getElement(element);element.attachEvent('on'+eventName,handler);};}else{throw new Error("No known event model.");}}()),removeEvent:(function(){if(window.removeEventListener){return function(element,eventName,handler,useCapture){element=$.getElement(element);element.removeEventListener(eventName,handler,useCapture);};}else if(window.detachEvent){return function(element,eventName,handler,useCapture){element=$.getElement(element);element.detachEvent('on'+eventName,handler);};}else{throw new Error("No known event model.");}}()),cancelEvent:function(event){event=$.getEvent(event);if(event.preventDefault){$.cancelEvent=function(event){event.preventDefault();};}else{$.cancelEvent=function(event){event=$.getEvent(event);event.cancel=true;event.returnValue=false;};}
$.cancelEvent(event);},stopEvent:function(event){event=$.getEvent(event);if(event.stopPropagation){$.stopEvent=function(event){event.stopPropagation();};}else{$.stopEvent=function(event){event=$.getEvent(event);event.cancelBubble=true;};}
$.stopEvent(event);},createCallback:function(object,method){var initialArgs=[],i;for(i=2;i<arguments.length;i++){initialArgs.push(arguments[i]);}
return function(){var args=initialArgs.concat([]),i;for(i=0;i<arguments.length;i++){args.push(arguments[i]);}
return method.apply(object,args);};},getUrlParameter:function(key){var value=URLPARAMS[key];return value?value:null;},getUrlProtocol:function(url){var match=url.match(/^([a-z]+:)\/\//i);if(match===null){return window.location.protocol;}
return match[1].toLowerCase();},createAjaxRequest:function(local){var supportActiveX;try{supportActiveX=!!new ActiveXObject("Microsoft.XMLHTTP");}catch(e){supportActiveX=false;}
if(supportActiveX){if(window.XMLHttpRequest){$.createAjaxRequest=function(local){if(local){return new ActiveXObject("Microsoft.XMLHTTP");}
return new XMLHttpRequest();};}else{$.createAjaxRequest=function(){return new ActiveXObject("Microsoft.XMLHTTP");};}}else if(window.XMLHttpRequest){$.createAjaxRequest=function(){return new XMLHttpRequest();};}else{throw new Error("Browser doesn't support XMLHttpRequest.");}
return $.createAjaxRequest(local);},makeAjaxRequest:function(url,onSuccess,onError){var withCredentials;var headers;var responseType;if($.isPlainObject(url)){onSuccess=url.success;onError=url.error;withCredentials=url.withCredentials;headers=url.headers;responseType=url.responseType||null;url=url.url;}
var protocol=$.getUrlProtocol(url);var request=$.createAjaxRequest(protocol==="file:");if(!$.isFunction(onSuccess)){throw new Error("makeAjaxRequest requires a success callback");}
request.onreadystatechange=function(){if(request.readyState==4){request.onreadystatechange=function(){};if((request.status>=200&&request.status<300)||(request.status===0&&protocol!=="http:"&&protocol!=="https:")){onSuccess(request);}else{$.console.log("AJAX request returned %d: %s",request.status,url);if($.isFunction(onError)){onError(request);}}}};try{request.open("GET",url,true);if(responseType){request.responseType=responseType;}
if(headers){for(var headerName in headers){if(Object.prototype.hasOwnProperty.call(headers,headerName)&&headers[headerName]){request.setRequestHeader(headerName,headers[headerName]);}}}
if(withCredentials){request.withCredentials=true;}
request.send(null);}catch(e){var msg=e.message;var oldIE=$.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<10;if(oldIE&&typeof(e.number)!="undefined"&&e.number==-2147024891){msg+="\nSee http://msdn.microsoft.com/en-us/library/ms537505(v=vs.85).aspx#xdomain";}
$.console.log("%s while making AJAX request: %s",e.name,msg);request.onreadystatechange=function(){};if(window.XDomainRequest){var xdr=new window.XDomainRequest();if(xdr){xdr.onload=function(e){if($.isFunction(onSuccess)){onSuccess({responseText:xdr.responseText,status:200,statusText:'OK'});}};xdr.onerror=function(e){if($.isFunction(onError)){onError({responseText:xdr.responseText,status:444,statusText:'An error happened. Due to an XDomainRequest deficiency we can not extract any information about this error. Upgrade your browser.'});}};try{xdr.open('GET',url);xdr.send();}catch(e2){if($.isFunction(onError)){onError(request,e);}}}}else{if($.isFunction(onError)){onError(request,e);}}}
return request;},jsonp:function(options){var script,url=options.url,head=document.head||document.getElementsByTagName("head")[0]||document.documentElement,jsonpCallback=options.callbackName||'openseadragon'+$.now(),previous=window[jsonpCallback],replace="$1"+jsonpCallback+"$2",callbackParam=options.param||'callback',callback=options.callback;url=url.replace(/(\=)\?(&|$)|\?\?/i,replace);url+=(/\?/.test(url)?"&":"?")+callbackParam+"="+jsonpCallback;window[jsonpCallback]=function(response){if(!previous){try{delete window[jsonpCallback];}catch(e){}}else{window[jsonpCallback]=previous;}
if(callback&&$.isFunction(callback)){callback(response);}};script=document.createElement("script");if(undefined!==options.async||false!==options.async){script.async="async";}
if(options.scriptCharset){script.charset=options.scriptCharset;}
script.src=url;script.onload=script.onreadystatechange=function(_,isAbort){if(isAbort||!script.readyState||/loaded|complete/.test(script.readyState)){script.onload=script.onreadystatechange=null;if(head&&script.parentNode){head.removeChild(script);}
script=undefined;}};head.insertBefore(script,head.firstChild);},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open.";},parseXml:function(string){if(window.DOMParser){$.parseXml=function(string){var xmlDoc=null,parser;parser=new DOMParser();xmlDoc=parser.parseFromString(string,"text/xml");return xmlDoc;};}else if(window.ActiveXObject){$.parseXml=function(string){var xmlDoc=null;xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async=false;xmlDoc.loadXML(string);return xmlDoc;};}else{throw new Error("Browser doesn't support XML DOM.");}
return $.parseXml(string);},parseJSON:function(string){if(window.JSON&&window.JSON.parse){$.parseJSON=window.JSON.parse;}else{$.parseJSON=function(string){return eval('('+string+')');};}
return $.parseJSON(string);},imageFormatSupported:function(extension){extension=extension?extension:"";return!!FILEFORMATS[extension.toLowerCase()];}});var nullfunction=function(msg){};$.console=window.console||{log:nullfunction,debug:nullfunction,info:nullfunction,warn:nullfunction,error:nullfunction,assert:nullfunction};$.Browser={vendor:$.BROWSERS.UNKNOWN,version:0,alpha:true};var FILEFORMATS={"bmp":false,"jpeg":true,"jpg":true,"png":true,"tif":false,"wdp":false},URLPARAMS={};(function(){var ver=navigator.appVersion,ua=navigator.userAgent,regex;switch(navigator.appName){case"Microsoft Internet Explorer":if(!!window.attachEvent&&!!window.ActiveXObject){$.Browser.vendor=$.BROWSERS.IE;$.Browser.version=parseFloat(ua.substring(ua.indexOf("MSIE")+5,ua.indexOf(";",ua.indexOf("MSIE"))));}
break;case"Netscape":if(window.addEventListener){if(ua.indexOf("Firefox")>=0){$.Browser.vendor=$.BROWSERS.FIREFOX;$.Browser.version=parseFloat(ua.substring(ua.indexOf("Firefox")+8));}else if(ua.indexOf("Safari")>=0){$.Browser.vendor=ua.indexOf("Chrome")>=0?$.BROWSERS.CHROME:$.BROWSERS.SAFARI;$.Browser.version=parseFloat(ua.substring(ua.substring(0,ua.indexOf("Safari")).lastIndexOf("/")+1,ua.indexOf("Safari")));}else{regex=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})");if(regex.exec(ua)!==null){$.Browser.vendor=$.BROWSERS.IE;$.Browser.version=parseFloat(RegExp.$1);}}}
break;case"Opera":$.Browser.vendor=$.BROWSERS.OPERA;$.Browser.version=parseFloat(ver);break;}
var query=window.location.search.substring(1),parts=query.split('&'),part,sep,i;for(i=0;i<parts.length;i++){part=parts[i];sep=part.indexOf('=');if(sep>0){var key=part.substring(0,sep),value=part.substring(sep+1);try{URLPARAMS[key]=decodeURIComponent(value);}catch(e){$.console.error("Ignoring malformed URL parameter: %s=%s",key,value);}}}
$.Browser.alpha=!(($.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<9)||($.Browser.vendor==$.BROWSERS.CHROME&&$.Browser.version<2));$.Browser.opacity=!($.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<9);})();(function(w){var requestAnimationFrame=w.requestAnimationFrame||w.mozRequestAnimationFrame||w.webkitRequestAnimationFrame||w.msRequestAnimationFrame;var cancelAnimationFrame=w.cancelAnimationFrame||w.mozCancelAnimationFrame||w.webkitCancelAnimationFrame||w.msCancelAnimationFrame;if(requestAnimationFrame&&cancelAnimationFrame){$.requestAnimationFrame=function(){return requestAnimationFrame.apply(w,arguments);};$.cancelAnimationFrame=function(){return cancelAnimationFrame.apply(w,arguments);};}else{var aAnimQueue=[],processing=[],iRequestId=0,iIntervalId;$.requestAnimationFrame=function(callback){aAnimQueue.push([++iRequestId,callback]);if(!iIntervalId){iIntervalId=setInterval(function(){if(aAnimQueue.length){var time=$.now();var temp=processing;processing=aAnimQueue;aAnimQueue=temp;while(processing.length){processing.shift()[1](time);}}else{clearInterval(iIntervalId);iIntervalId=undefined;}},1000/50);}
return iRequestId;};$.cancelAnimationFrame=function(requestId){var i,j;for(i=0,j=aAnimQueue.length;i<j;i+=1){if(aAnimQueue[i][0]===requestId){aAnimQueue.splice(i,1);return;}}
for(i=0,j=processing.length;i<j;i+=1){if(processing[i][0]===requestId){processing.splice(i,1);return;}}};}})(window);function getOffsetParent(element,isFixed){if(isFixed&&element!=document.body){return document.body;}else{return element.offsetParent;}}}(OpenSeadragon));(function(root,factory){if(typeof define==='function'&&define.amd){define([],factory);}else if(typeof module==='object'&&module.exports){module.exports=factory();}else{root.OpenSeadragon=factory();}}(this,function(){return OpenSeadragon;}));(function($){var fullScreenApi={supportsFullScreen:false,isFullScreen:function(){return false;},getFullScreenElement:function(){return null;},requestFullScreen:function(){},exitFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:'',fullScreenErrorEventName:''};if(document.exitFullscreen){fullScreenApi.supportsFullScreen=true;fullScreenApi.getFullScreenElement=function(){return document.fullscreenElement;};fullScreenApi.requestFullScreen=function(element){return element.requestFullscreen();};fullScreenApi.exitFullScreen=function(){document.exitFullscreen();};fullScreenApi.fullScreenEventName="fullscreenchange";fullScreenApi.fullScreenErrorEventName="fullscreenerror";}else if(document.msExitFullscreen){fullScreenApi.supportsFullScreen=true;fullScreenApi.getFullScreenElement=function(){return document.msFullscreenElement;};fullScreenApi.requestFullScreen=function(element){return element.msRequestFullscreen();};fullScreenApi.exitFullScreen=function(){document.msExitFullscreen();};fullScreenApi.fullScreenEventName="MSFullscreenChange";fullScreenApi.fullScreenErrorEventName="MSFullscreenError";}else if(document.webkitExitFullscreen){fullScreenApi.supportsFullScreen=true;fullScreenApi.getFullScreenElement=function(){return document.webkitFullscreenElement;};fullScreenApi.requestFullScreen=function(element){return element.webkitRequestFullscreen();};fullScreenApi.exitFullScreen=function(){document.webkitExitFullscreen();};fullScreenApi.fullScreenEventName="webkitfullscreenchange";fullScreenApi.fullScreenErrorEventName="webkitfullscreenerror";}else if(document.webkitCancelFullScreen){fullScreenApi.supportsFullScreen=true;fullScreenApi.getFullScreenElement=function(){return document.webkitCurrentFullScreenElement;};fullScreenApi.requestFullScreen=function(element){return element.webkitRequestFullScreen();};fullScreenApi.exitFullScreen=function(){document.webkitCancelFullScreen();};fullScreenApi.fullScreenEventName="webkitfullscreenchange";fullScreenApi.fullScreenErrorEventName="webkitfullscreenerror";}else if(document.mozCancelFullScreen){fullScreenApi.supportsFullScreen=true;fullScreenApi.getFullScreenElement=function(){return document.mozFullScreenElement;};fullScreenApi.requestFullScreen=function(element){return element.mozRequestFullScreen();};fullScreenApi.exitFullScreen=function(){document.mozCancelFullScreen();};fullScreenApi.fullScreenEventName="mozfullscreenchange";fullScreenApi.fullScreenErrorEventName="mozfullscreenerror";}
fullScreenApi.isFullScreen=function(){return fullScreenApi.getFullScreenElement()!==null;};fullScreenApi.cancelFullScreen=function(){$.console.error("cancelFullScreen is deprecated. Use exitFullScreen instead.");fullScreenApi.exitFullScreen();};$.extend($,fullScreenApi);})(OpenSeadragon);(function($){$.EventSource=function(){this.events={};};$.EventSource.prototype={addOnceHandler:function(eventName,handler,userData,times){var self=this;times=times||1;var count=0;var onceHandler=function(event){count++;if(count===times){self.removeHandler(eventName,onceHandler);}
handler(event);};this.addHandler(eventName,onceHandler,userData);},addHandler:function(eventName,handler,userData){var events=this.events[eventName];if(!events){this.events[eventName]=events=[];}
if(handler&&$.isFunction(handler)){events[events.length]={handler:handler,userData:userData||null};}},removeHandler:function(eventName,handler){var events=this.events[eventName],handlers=[],i;if(!events){return;}
if($.isArray(events)){for(i=0;i<events.length;i++){if(events[i].handler!==handler){handlers.push(events[i]);}}
this.events[eventName]=handlers;}},removeAllHandlers:function(eventName){if(eventName){this.events[eventName]=[];}else{for(var eventType in this.events){this.events[eventType]=[];}}},getHandler:function(eventName){var events=this.events[eventName];if(!events||!events.length){return null;}
events=events.length===1?[events[0]]:Array.apply(null,events);return function(source,args){var i,length=events.length;for(i=0;i<length;i++){if(events[i]){args.eventSource=source;args.userData=events[i].userData;events[i].handler(args);}}};},raiseEvent:function(eventName,eventArgs){var handler=this.getHandler(eventName);if(handler){if(!eventArgs){eventArgs={};}
handler(this,eventArgs);}}};}(OpenSeadragon));(function($){var MOUSETRACKERS=[];var THIS={};$.MouseTracker=function(options){MOUSETRACKERS.push(this);var args=arguments;if(!$.isPlainObject(options)){options={element:args[0],clickTimeThreshold:args[1],clickDistThreshold:args[2]};}
this.hash=Math.random();this.element=$.getElement(options.element);this.clickTimeThreshold=options.clickTimeThreshold||$.DEFAULT_SETTINGS.clickTimeThreshold;this.clickDistThreshold=options.clickDistThreshold||$.DEFAULT_SETTINGS.clickDistThreshold;this.dblClickTimeThreshold=options.dblClickTimeThreshold||$.DEFAULT_SETTINGS.dblClickTimeThreshold;this.dblClickDistThreshold=options.dblClickDistThreshold||$.DEFAULT_SETTINGS.dblClickDistThreshold;this.userData=options.userData||null;this.stopDelay=options.stopDelay||50;this.enterHandler=options.enterHandler||null;this.exitHandler=options.exitHandler||null;this.pressHandler=options.pressHandler||null;this.nonPrimaryPressHandler=options.nonPrimaryPressHandler||null;this.releaseHandler=options.releaseHandler||null;this.nonPrimaryReleaseHandler=options.nonPrimaryReleaseHandler||null;this.moveHandler=options.moveHandler||null;this.scrollHandler=options.scrollHandler||null;this.clickHandler=options.clickHandler||null;this.dblClickHandler=options.dblClickHandler||null;this.dragHandler=options.dragHandler||null;this.dragEndHandler=options.dragEndHandler||null;this.pinchHandler=options.pinchHandler||null;this.stopHandler=options.stopHandler||null;this.keyDownHandler=options.keyDownHandler||null;this.keyUpHandler=options.keyUpHandler||null;this.keyHandler=options.keyHandler||null;this.focusHandler=options.focusHandler||null;this.blurHandler=options.blurHandler||null;var _this=this;THIS[this.hash]={click:function(event){onClick(_this,event);},dblclick:function(event){onDblClick(_this,event);},keydown:function(event){onKeyDown(_this,event);},keyup:function(event){onKeyUp(_this,event);},keypress:function(event){onKeyPress(_this,event);},focus:function(event){onFocus(_this,event);},blur:function(event){onBlur(_this,event);},wheel:function(event){onWheel(_this,event);},mousewheel:function(event){onMouseWheel(_this,event);},DOMMouseScroll:function(event){onMouseWheel(_this,event);},MozMousePixelScroll:function(event){onMouseWheel(_this,event);},mouseenter:function(event){onMouseEnter(_this,event);},mouseleave:function(event){onMouseLeave(_this,event);},mouseover:function(event){onMouseOver(_this,event);},mouseout:function(event){onMouseOut(_this,event);},mousedown:function(event){onMouseDown(_this,event);},mouseup:function(event){onMouseUp(_this,event);},mouseupcaptured:function(event){onMouseUpCaptured(_this,event);},mousemove:function(event){onMouseMove(_this,event);},mousemovecaptured:function(event){onMouseMoveCaptured(_this,event);},touchstart:function(event){onTouchStart(_this,event);},touchend:function(event){onTouchEnd(_this,event);},touchendcaptured:function(event){onTouchEndCaptured(_this,event);},touchmove:function(event){onTouchMove(_this,event);},touchmovecaptured:function(event){onTouchMoveCaptured(_this,event);},touchcancel:function(event){onTouchCancel(_this,event);},gesturestart:function(event){onGestureStart(_this,event);},gesturechange:function(event){onGestureChange(_this,event);},pointerover:function(event){onPointerOver(_this,event);},MSPointerOver:function(event){onPointerOver(_this,event);},pointerout:function(event){onPointerOut(_this,event);},MSPointerOut:function(event){onPointerOut(_this,event);},pointerdown:function(event){onPointerDown(_this,event);},MSPointerDown:function(event){onPointerDown(_this,event);},pointerup:function(event){onPointerUp(_this,event);},MSPointerUp:function(event){onPointerUp(_this,event);},pointermove:function(event){onPointerMove(_this,event);},MSPointerMove:function(event){onPointerMove(_this,event);},pointercancel:function(event){onPointerCancel(_this,event);},MSPointerCancel:function(event){onPointerCancel(_this,event);},pointerupcaptured:function(event){onPointerUpCaptured(_this,event);},pointermovecaptured:function(event){onPointerMoveCaptured(_this,event);},tracking:false,activePointersLists:[],lastClickPos:null,dblClickTimeOut:null,pinchGPoints:[],lastPinchDist:0,currentPinchDist:0,lastPinchCenter:null,currentPinchCenter:null};if(!options.startDisabled){this.setTracking(true);}};$.MouseTracker.prototype={destroy:function(){var i;stopTracking(this);this.element=null;for(i=0;i<MOUSETRACKERS.length;i++){if(MOUSETRACKERS[i]===this){MOUSETRACKERS.splice(i,1);break;}}
THIS[this.hash]=null;delete THIS[this.hash];},isTracking:function(){return THIS[this.hash].tracking;},setTracking:function(track){if(track){startTracking(this);}else{stopTracking(this);}
return this;},getActivePointersListsExceptType:function(type){var delegate=THIS[this.hash];var listArray=[];for(var i=0;i<delegate.activePointersLists.length;++i){if(delegate.activePointersLists[i].type!==type){listArray.push(delegate.activePointersLists[i]);}}
return listArray;},getActivePointersListByType:function(type){var delegate=THIS[this.hash],i,len=delegate.activePointersLists.length,list;for(i=0;i<len;i++){if(delegate.activePointersLists[i].type===type){return delegate.activePointersLists[i];}}
list=new $.MouseTracker.GesturePointList(type);delegate.activePointersLists.push(list);return list;},getActivePointerCount:function(){var delegate=THIS[this.hash],i,len=delegate.activePointersLists.length,count=0;for(i=0;i<len;i++){count+=delegate.activePointersLists[i].getLength();}
return count;},enterHandler:function(){},exitHandler:function(){},pressHandler:function(){},nonPrimaryPressHandler:function(){},releaseHandler:function(){},nonPrimaryReleaseHandler:function(){},moveHandler:function(){},scrollHandler:function(){},clickHandler:function(){},dblClickHandler:function(){},dragHandler:function(){},dragEndHandler:function(){},pinchHandler:function(){},stopHandler:function(){},keyDownHandler:function(){},keyUpHandler:function(){},keyHandler:function(){},focusHandler:function(){},blurHandler:function(){}};$.MouseTracker.resetAllMouseTrackers=function(){for(var i=0;i<MOUSETRACKERS.length;i++){if(MOUSETRACKERS[i].isTracking()){MOUSETRACKERS[i].setTracking(false);MOUSETRACKERS[i].setTracking(true);}}};$.MouseTracker.gesturePointVelocityTracker=(function(){var trackerPoints=[],intervalId=0,lastTime=0;var _generateGuid=function(tracker,gPoint){return tracker.hash.toString()+gPoint.type+gPoint.id.toString();};var _doTracking=function(){var i,len=trackerPoints.length,trackPoint,gPoint,now=$.now(),elapsedTime,distance,speed;elapsedTime=now-lastTime;lastTime=now;for(i=0;i<len;i++){trackPoint=trackerPoints[i];gPoint=trackPoint.gPoint;gPoint.direction=Math.atan2(gPoint.currentPos.y-trackPoint.lastPos.y,gPoint.currentPos.x-trackPoint.lastPos.x);distance=trackPoint.lastPos.distanceTo(gPoint.currentPos);trackPoint.lastPos=gPoint.currentPos;speed=1000*distance/(elapsedTime+1);gPoint.speed=0.75*speed+0.25*gPoint.speed;}};var addPoint=function(tracker,gPoint){var guid=_generateGuid(tracker,gPoint);trackerPoints.push({guid:guid,gPoint:gPoint,lastPos:gPoint.currentPos});if(trackerPoints.length===1){lastTime=$.now();intervalId=window.setInterval(_doTracking,50);}};var removePoint=function(tracker,gPoint){var guid=_generateGuid(tracker,gPoint),i,len=trackerPoints.length;for(i=0;i<len;i++){if(trackerPoints[i].guid===guid){trackerPoints.splice(i,1);len--;if(len===0){window.clearInterval(intervalId);}
break;}}};return{addPoint:addPoint,removePoint:removePoint};})();$.MouseTracker.captureElement=document;$.MouseTracker.wheelEventName=($.Browser.vendor==$.BROWSERS.IE&&$.Browser.version>8)||('onwheel' in document.createElement('div'))?'wheel':document.onmousewheel!==undefined?'mousewheel':'DOMMouseScroll';$.MouseTracker.supportsMouseCapture=(function(){var divElement=document.createElement('div');return $.isFunction(divElement.setCapture)&&$.isFunction(divElement.releaseCapture);}());$.MouseTracker.subscribeEvents=["click","dblclick","keydown","keyup","keypress","focus","blur",$.MouseTracker.wheelEventName];if($.MouseTracker.wheelEventName=="DOMMouseScroll"){$.MouseTracker.subscribeEvents.push("MozMousePixelScroll");}
if(window.PointerEvent&&(window.navigator.pointerEnabled||$.Browser.vendor!==$.BROWSERS.IE)){$.MouseTracker.havePointerEvents=true;$.MouseTracker.subscribeEvents.push("pointerover","pointerout","pointerdown","pointerup","pointermove","pointercancel");$.MouseTracker.unprefixedPointerEvents=true;if(navigator.maxTouchPoints){$.MouseTracker.maxTouchPoints=navigator.maxTouchPoints;}else{$.MouseTracker.maxTouchPoints=0;}
$.MouseTracker.haveMouseEnter=false;}else if(window.MSPointerEvent&&window.navigator.msPointerEnabled){$.MouseTracker.havePointerEvents=true;$.MouseTracker.subscribeEvents.push("MSPointerOver","MSPointerOut","MSPointerDown","MSPointerUp","MSPointerMove","MSPointerCancel");$.MouseTracker.unprefixedPointerEvents=false;if(navigator.msMaxTouchPoints){$.MouseTracker.maxTouchPoints=navigator.msMaxTouchPoints;}else{$.MouseTracker.maxTouchPoints=0;}
$.MouseTracker.haveMouseEnter=false;}else{$.MouseTracker.havePointerEvents=false;if($.Browser.vendor===$.BROWSERS.IE&&$.Browser.version<9){$.MouseTracker.subscribeEvents.push("mouseenter","mouseleave");$.MouseTracker.haveMouseEnter=true;}else{$.MouseTracker.subscribeEvents.push("mouseover","mouseout");$.MouseTracker.haveMouseEnter=false;}
$.MouseTracker.subscribeEvents.push("mousedown","mouseup","mousemove");if('ontouchstart' in window){$.MouseTracker.subscribeEvents.push("touchstart","touchend","touchmove","touchcancel");}
if('ongesturestart' in window){$.MouseTracker.subscribeEvents.push("gesturestart","gesturechange");}
$.MouseTracker.mousePointerId="legacy-mouse";$.MouseTracker.maxTouchPoints=10;}
$.MouseTracker.GesturePointList=function(type){this._gPoints=[];this.type=type;this.buttons=0;this.contacts=0;this.clicks=0;this.captureCount=0;};$.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length;},asArray:function(){return this._gPoints;},add:function(gp){return this._gPoints.push(gp);},removeById:function(id){var i,len=this._gPoints.length;for(i=0;i<len;i++){if(this._gPoints[i].id===id){this._gPoints.splice(i,1);break;}}
return this._gPoints.length;},getByIndex:function(index){if(index<this._gPoints.length){return this._gPoints[index];}
return null;},getById:function(id){var i,len=this._gPoints.length;for(i=0;i<len;i++){if(this._gPoints[i].id===id){return this._gPoints[i];}}
return null;},getPrimary:function(id){var i,len=this._gPoints.length;for(i=0;i<len;i++){if(this._gPoints[i].isPrimary){return this._gPoints[i];}}
return null;},addContact:function(){++this.contacts;if(this.contacts>1&&(this.type==="mouse"||this.type==="pen")){this.contacts=1;}},removeContact:function(){--this.contacts;if(this.contacts<0){this.contacts=0;}}};function clearTrackedPointers(tracker){var delegate=THIS[tracker.hash],i,pointerListCount=delegate.activePointersLists.length;for(i=0;i<pointerListCount;i++){if(delegate.activePointersLists[i].captureCount>0){$.removeEvent($.MouseTracker.captureElement,'mousemove',delegate.mousemovecaptured,true);$.removeEvent($.MouseTracker.captureElement,'mouseup',delegate.mouseupcaptured,true);$.removeEvent($.MouseTracker.captureElement,$.MouseTracker.unprefixedPointerEvents?'pointermove':'MSPointerMove',delegate.pointermovecaptured,true);$.removeEvent($.MouseTracker.captureElement,$.MouseTracker.unprefixedPointerEvents?'pointerup':'MSPointerUp',delegate.pointerupcaptured,true);$.removeEvent($.MouseTracker.captureElement,'touchmove',delegate.touchmovecaptured,true);$.removeEvent($.MouseTracker.captureElement,'touchend',delegate.touchendcaptured,true);delegate.activePointersLists[i].captureCount=0;}}
for(i=0;i<pointerListCount;i++){delegate.activePointersLists.pop();}}
function startTracking(tracker){var delegate=THIS[tracker.hash],event,i;if(!delegate.tracking){for(i=0;i<$.MouseTracker.subscribeEvents.length;i++){event=$.MouseTracker.subscribeEvents[i];$.addEvent(tracker.element,event,delegate[event],false);}
clearTrackedPointers(tracker);delegate.tracking=true;}}
function stopTracking(tracker){var delegate=THIS[tracker.hash],event,i;if(delegate.tracking){for(i=0;i<$.MouseTracker.subscribeEvents.length;i++){event=$.MouseTracker.subscribeEvents[i];$.removeEvent(tracker.element,event,delegate[event],false);}
clearTrackedPointers(tracker);delegate.tracking=false;}}
function getCaptureEventParams(tracker,pointerType){var delegate=THIS[tracker.hash];if(pointerType==='pointerevent'){return{upName:$.MouseTracker.unprefixedPointerEvents?'pointerup':'MSPointerUp',upHandler:delegate.pointerupcaptured,moveName:$.MouseTracker.unprefixedPointerEvents?'pointermove':'MSPointerMove',moveHandler:delegate.pointermovecaptured};}else if(pointerType==='mouse'){return{upName:'mouseup',upHandler:delegate.mouseupcaptured,moveName:'mousemove',moveHandler:delegate.mousemovecaptured};}else if(pointerType==='touch'){return{upName:'touchend',upHandler:delegate.touchendcaptured,moveName:'touchmove',moveHandler:delegate.touchmovecaptured};}else{throw new Error("MouseTracker.getCaptureEventParams: Unknown pointer type.");}}
function capturePointer(tracker,pointerType,pointerCount){var pointsList=tracker.getActivePointersListByType(pointerType),eventParams;pointsList.captureCount+=(pointerCount||1);if(pointsList.captureCount===1){if($.Browser.vendor===$.BROWSERS.IE&&$.Browser.version<9){tracker.element.setCapture(true);}else{eventParams=getCaptureEventParams(tracker,$.MouseTracker.havePointerEvents?'pointerevent':pointerType);if(isInIframe&&canAccessEvents(window.top)){$.addEvent(window.top,eventParams.upName,eventParams.upHandler,true);}
$.addEvent($.MouseTracker.captureElement,eventParams.upName,eventParams.upHandler,true);$.addEvent($.MouseTracker.captureElement,eventParams.moveName,eventParams.moveHandler,true);}}}
function releasePointer(tracker,pointerType,pointerCount){var pointsList=tracker.getActivePointersListByType(pointerType),eventParams;pointsList.captureCount-=(pointerCount||1);if(pointsList.captureCount===0){if($.Browser.vendor===$.BROWSERS.IE&&$.Browser.version<9){tracker.element.releaseCapture();}else{eventParams=getCaptureEventParams(tracker,$.MouseTracker.havePointerEvents?'pointerevent':pointerType);if(isInIframe&&canAccessEvents(window.top)){$.removeEvent(window.top,eventParams.upName,eventParams.upHandler,true);}
$.removeEvent($.MouseTracker.captureElement,eventParams.moveName,eventParams.moveHandler,true);$.removeEvent($.MouseTracker.captureElement,eventParams.upName,eventParams.upHandler,true);}}}
function getPointerType(event){var pointerTypeStr;if($.MouseTracker.unprefixedPointerEvents){pointerTypeStr=event.pointerType;}else{switch(event.pointerType)
{case 0x00000002:pointerTypeStr='touch';break;case 0x00000003:pointerTypeStr='pen';break;case 0x00000004:pointerTypeStr='mouse';break;default:pointerTypeStr='';}}
return pointerTypeStr;}
function getMouseAbsolute(event){return $.getMousePosition(event);}
function getMouseRelative(event,element){return getPointRelativeToAbsolute(getMouseAbsolute(event),element);}
function getPointRelativeToAbsolute(point,element){var offset=$.getElementOffset(element);return point.minus(offset);}
function getCenterPoint(point1,point2){return new $.Point((point1.x+point2.x)/2,(point1.y+point2.y)/2);}
function onClick(tracker,event){if(tracker.clickHandler){$.cancelEvent(event);}}
function onDblClick(tracker,event){if(tracker.dblClickHandler){$.cancelEvent(event);}}
function onKeyDown(tracker,event){var propagate;if(tracker.keyDownHandler){event=$.getEvent(event);propagate=tracker.keyDownHandler({eventSource:tracker,keyCode:event.keyCode?event.keyCode:event.charCode,ctrl:event.ctrlKey,shift:event.shiftKey,alt:event.altKey,meta:event.metaKey,originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(!propagate){$.cancelEvent(event);}}}
function onKeyUp(tracker,event){var propagate;if(tracker.keyUpHandler){event=$.getEvent(event);propagate=tracker.keyUpHandler({eventSource:tracker,keyCode:event.keyCode?event.keyCode:event.charCode,ctrl:event.ctrlKey,shift:event.shiftKey,alt:event.altKey,meta:event.metaKey,originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(!propagate){$.cancelEvent(event);}}}
function onKeyPress(tracker,event){var propagate;if(tracker.keyHandler){event=$.getEvent(event);propagate=tracker.keyHandler({eventSource:tracker,keyCode:event.keyCode?event.keyCode:event.charCode,ctrl:event.ctrlKey,shift:event.shiftKey,alt:event.altKey,meta:event.metaKey,originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(!propagate){$.cancelEvent(event);}}}
function onFocus(tracker,event){var propagate;if(tracker.focusHandler){event=$.getEvent(event);propagate=tracker.focusHandler({eventSource:tracker,originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}}
function onBlur(tracker,event){var propagate;if(tracker.blurHandler){event=$.getEvent(event);propagate=tracker.blurHandler({eventSource:tracker,originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}}
function onWheel(tracker,event){handleWheelEvent(tracker,event,event);}
function onMouseWheel(tracker,event){event=$.getEvent(event);var simulatedEvent={target:event.target||event.srcElement,type:"wheel",shiftKey:event.shiftKey||false,clientX:event.clientX,clientY:event.clientY,pageX:event.pageX?event.pageX:event.clientX,pageY:event.pageY?event.pageY:event.clientY,deltaMode:event.type=="MozMousePixelScroll"?0:1,deltaX:0,deltaZ:0};if($.MouseTracker.wheelEventName=="mousewheel"){simulatedEvent.deltaY=-event.wheelDelta/$.DEFAULT_SETTINGS.pixelsPerWheelLine;}else{simulatedEvent.deltaY=event.detail;}
handleWheelEvent(tracker,simulatedEvent,event);}
function handleWheelEvent(tracker,event,originalEvent){var nDelta=0,propagate;nDelta=event.deltaY<0?1:-1;if(tracker.scrollHandler){propagate=tracker.scrollHandler({eventSource:tracker,pointerType:'mouse',position:getMouseRelative(event,tracker.element),scroll:nDelta,shift:event.shiftKey,isTouchEvent:false,originalEvent:originalEvent,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(originalEvent);}}}
function isParentChild(parent,child)
{if(parent===child){return false;}
while(child&&child!==parent){child=child.parentNode;}
return child===parent;}
function onMouseEnter(tracker,event){event=$.getEvent(event);handleMouseEnter(tracker,event);}
function onMouseOver(tracker,event){event=$.getEvent(event);if(event.currentTarget===event.relatedTarget||isParentChild(event.currentTarget,event.relatedTarget)){return;}
handleMouseEnter(tracker,event);}
function handleMouseEnter(tracker,event){var gPoint={id:$.MouseTracker.mousePointerId,type:'mouse',isPrimary:true,currentPos:getMouseAbsolute(event),currentTime:$.now()};updatePointersEnter(tracker,event,[gPoint]);}
function onMouseLeave(tracker,event){event=$.getEvent(event);handleMouseExit(tracker,event);}
function onMouseOut(tracker,event){event=$.getEvent(event);if(event.currentTarget===event.relatedTarget||isParentChild(event.currentTarget,event.relatedTarget)){return;}
handleMouseExit(tracker,event);}
function handleMouseExit(tracker,event){var gPoint={id:$.MouseTracker.mousePointerId,type:'mouse',isPrimary:true,currentPos:getMouseAbsolute(event),currentTime:$.now()};updatePointersExit(tracker,event,[gPoint]);}
function getStandardizedButton(button){if($.Browser.vendor===$.BROWSERS.IE&&$.Browser.version<9){if(button===1){return 0;}else if(button===2){return 2;}else if(button===4){return 1;}else{return-1;}}else{return button;}}
function onMouseDown(tracker,event){var gPoint;event=$.getEvent(event);gPoint={id:$.MouseTracker.mousePointerId,type:'mouse',isPrimary:true,currentPos:getMouseAbsolute(event),currentTime:$.now()};if(updatePointersDown(tracker,event,[gPoint],getStandardizedButton(event.button))){$.stopEvent(event);capturePointer(tracker,'mouse');}
if(tracker.clickHandler||tracker.dblClickHandler||tracker.pressHandler||tracker.dragHandler||tracker.dragEndHandler){$.cancelEvent(event);}}
function onMouseUp(tracker,event){handleMouseUp(tracker,event);}
function onMouseUpCaptured(tracker,event){handleMouseUp(tracker,event);$.stopEvent(event);}
function handleMouseUp(tracker,event){var gPoint;event=$.getEvent(event);gPoint={id:$.MouseTracker.mousePointerId,type:'mouse',isPrimary:true,currentPos:getMouseAbsolute(event),currentTime:$.now()};if(updatePointersUp(tracker,event,[gPoint],getStandardizedButton(event.button))){releasePointer(tracker,'mouse');}}
function onMouseMove(tracker,event){handleMouseMove(tracker,event);}
function onMouseMoveCaptured(tracker,event){handleMouseMove(tracker,event);$.stopEvent(event);}
function handleMouseMove(tracker,event){var gPoint;event=$.getEvent(event);gPoint={id:$.MouseTracker.mousePointerId,type:'mouse',isPrimary:true,currentPos:getMouseAbsolute(event),currentTime:$.now()};updatePointersMove(tracker,event,[gPoint]);}
function abortContacts(tracker,event,pointsList){var i,gPointCount=pointsList.getLength(),abortGPoints=[];if(pointsList.type==='touch'||pointsList.contacts>0){for(i=0;i<gPointCount;i++){abortGPoints.push(pointsList.getByIndex(i));}
if(abortGPoints.length>0){updatePointersUp(tracker,event,abortGPoints,0);pointsList.captureCount=1;releasePointer(tracker,pointsList.type);updatePointersExit(tracker,event,abortGPoints);}}}
function onTouchStart(tracker,event){var time,i,j,touchCount=event.changedTouches.length,gPoints=[],parentGPoints,pointsList=tracker.getActivePointersListByType('touch');time=$.now();if(pointsList.getLength()>event.touches.length-touchCount){$.console.warn('Tracked touch contact count doesn\'t match event.touches.length. Removing all tracked touch pointers.');abortContacts(tracker,event,pointsList);}
for(i=0;i<touchCount;i++){gPoints.push({id:event.changedTouches[i].identifier,type:'touch',currentPos:getMouseAbsolute(event.changedTouches[i]),currentTime:time});}
updatePointersEnter(tracker,event,gPoints);for(i=0;i<MOUSETRACKERS.length;i++){if(MOUSETRACKERS[i]!==tracker&&MOUSETRACKERS[i].isTracking()&&isParentChild(MOUSETRACKERS[i].element,tracker.element)){parentGPoints=[];for(j=0;j<touchCount;j++){parentGPoints.push({id:event.changedTouches[j].identifier,type:'touch',currentPos:getMouseAbsolute(event.changedTouches[j]),currentTime:time});}
updatePointersEnter(MOUSETRACKERS[i],event,parentGPoints);}}
if(updatePointersDown(tracker,event,gPoints,0)){$.stopEvent(event);capturePointer(tracker,'touch',touchCount);}
$.cancelEvent(event);}
function onTouchEnd(tracker,event){handleTouchEnd(tracker,event);}
function onTouchEndCaptured(tracker,event){handleTouchEnd(tracker,event);$.stopEvent(event);}
function handleTouchEnd(tracker,event){var time,i,j,touchCount=event.changedTouches.length,gPoints=[],parentGPoints;time=$.now();for(i=0;i<touchCount;i++){gPoints.push({id:event.changedTouches[i].identifier,type:'touch',currentPos:getMouseAbsolute(event.changedTouches[i]),currentTime:time});}
if(updatePointersUp(tracker,event,gPoints,0)){releasePointer(tracker,'touch',touchCount);}
updatePointersExit(tracker,event,gPoints);for(i=0;i<MOUSETRACKERS.length;i++){if(MOUSETRACKERS[i]!==tracker&&MOUSETRACKERS[i].isTracking()&&isParentChild(MOUSETRACKERS[i].element,tracker.element)){parentGPoints=[];for(j=0;j<touchCount;j++){parentGPoints.push({id:event.changedTouches[j].identifier,type:'touch',currentPos:getMouseAbsolute(event.changedTouches[j]),currentTime:time});}
updatePointersExit(MOUSETRACKERS[i],event,parentGPoints);}}
$.cancelEvent(event);}
function onTouchMove(tracker,event){handleTouchMove(tracker,event);}
function onTouchMoveCaptured(tracker,event){handleTouchMove(tracker,event);$.stopEvent(event);}
function handleTouchMove(tracker,event){var i,touchCount=event.changedTouches.length,gPoints=[];for(i=0;i<touchCount;i++){gPoints.push({id:event.changedTouches[i].identifier,type:'touch',currentPos:getMouseAbsolute(event.changedTouches[i]),currentTime:$.now()});}
updatePointersMove(tracker,event,gPoints);$.cancelEvent(event);}
function onTouchCancel(tracker,event){var pointsList=tracker.getActivePointersListByType('touch');abortContacts(tracker,event,pointsList);}
function onGestureStart(tracker,event){event.stopPropagation();event.preventDefault();return false;}
function onGestureChange(tracker,event){event.stopPropagation();event.preventDefault();return false;}
function onPointerOver(tracker,event){var gPoint;if(event.currentTarget===event.relatedTarget||isParentChild(event.currentTarget,event.relatedTarget)){return;}
gPoint={id:event.pointerId,type:getPointerType(event),isPrimary:event.isPrimary,currentPos:getMouseAbsolute(event),currentTime:$.now()};updatePointersEnter(tracker,event,[gPoint]);}
function onPointerOut(tracker,event){var gPoint;if(event.currentTarget===event.relatedTarget||isParentChild(event.currentTarget,event.relatedTarget)){return;}
gPoint={id:event.pointerId,type:getPointerType(event),isPrimary:event.isPrimary,currentPos:getMouseAbsolute(event),currentTime:$.now()};updatePointersExit(tracker,event,[gPoint]);}
function onPointerDown(tracker,event){var gPoint;gPoint={id:event.pointerId,type:getPointerType(event),isPrimary:event.isPrimary,currentPos:getMouseAbsolute(event),currentTime:$.now()};if(updatePointersDown(tracker,event,[gPoint],event.button)){$.stopEvent(event);capturePointer(tracker,gPoint.type);}
if(tracker.clickHandler||tracker.dblClickHandler||tracker.pressHandler||tracker.dragHandler||tracker.dragEndHandler||tracker.pinchHandler){$.cancelEvent(event);}}
function onPointerUp(tracker,event){handlePointerUp(tracker,event);}
function onPointerUpCaptured(tracker,event){var pointsList=tracker.getActivePointersListByType(getPointerType(event));if(pointsList.getById(event.pointerId)){handlePointerUp(tracker,event);}
$.stopEvent(event);}
function handlePointerUp(tracker,event){var gPoint;gPoint={id:event.pointerId,type:getPointerType(event),isPrimary:event.isPrimary,currentPos:getMouseAbsolute(event),currentTime:$.now()};if(updatePointersUp(tracker,event,[gPoint],event.button)){releasePointer(tracker,gPoint.type);}}
function onPointerMove(tracker,event){handlePointerMove(tracker,event);}
function onPointerMoveCaptured(tracker,event){var pointsList=tracker.getActivePointersListByType(getPointerType(event));if(pointsList.getById(event.pointerId)){handlePointerMove(tracker,event);}
$.stopEvent(event);}
function handlePointerMove(tracker,event){var gPoint;gPoint={id:event.pointerId,type:getPointerType(event),isPrimary:event.isPrimary,currentPos:getMouseAbsolute(event),currentTime:$.now()};updatePointersMove(tracker,event,[gPoint]);}
function onPointerCancel(tracker,event){var gPoint;gPoint={id:event.pointerId,type:getPointerType(event)};updatePointersCancel(tracker,event,[gPoint]);}
function startTrackingPointer(pointsList,gPoint){if(!Object.prototype.hasOwnProperty.call(gPoint,'isPrimary')){if(pointsList.getLength()===0){gPoint.isPrimary=true;}else{gPoint.isPrimary=false;}}
gPoint.speed=0;gPoint.direction=0;gPoint.contactPos=gPoint.currentPos;gPoint.contactTime=gPoint.currentTime;gPoint.lastPos=gPoint.currentPos;gPoint.lastTime=gPoint.currentTime;return pointsList.add(gPoint);}
function stopTrackingPointer(pointsList,gPoint){var listLength,primaryPoint;if(pointsList.getById(gPoint.id)){listLength=pointsList.removeById(gPoint.id);if(!Object.prototype.hasOwnProperty.call(gPoint,'isPrimary')){primaryPoint=pointsList.getPrimary();if(!primaryPoint){primaryPoint=pointsList.getByIndex(0);if(primaryPoint){primaryPoint.isPrimary=true;}}}}else{listLength=pointsList.getLength();}
return listLength;}
function updatePointersEnter(tracker,event,gPoints){var pointsList=tracker.getActivePointersListByType(gPoints[0].type),i,gPointCount=gPoints.length,curGPoint,updateGPoint,propagate;for(i=0;i<gPointCount;i++){curGPoint=gPoints[i];updateGPoint=pointsList.getById(curGPoint.id);if(updateGPoint){updateGPoint.insideElement=true;updateGPoint.lastPos=updateGPoint.currentPos;updateGPoint.lastTime=updateGPoint.currentTime;updateGPoint.currentPos=curGPoint.currentPos;updateGPoint.currentTime=curGPoint.currentTime;curGPoint=updateGPoint;}else{curGPoint.captured=false;curGPoint.insideElementPressed=false;curGPoint.insideElement=true;startTrackingPointer(pointsList,curGPoint);}
if(tracker.enterHandler){propagate=tracker.enterHandler({eventSource:tracker,pointerType:curGPoint.type,position:getPointRelativeToAbsolute(curGPoint.currentPos,tracker.element),buttons:pointsList.buttons,pointers:tracker.getActivePointerCount(),insideElementPressed:curGPoint.insideElementPressed,buttonDownAny:pointsList.buttons!==0,isTouchEvent:curGPoint.type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}}}
function updatePointersExit(tracker,event,gPoints){var pointsList=tracker.getActivePointersListByType(gPoints[0].type),i,gPointCount=gPoints.length,curGPoint,updateGPoint,propagate;for(i=0;i<gPointCount;i++){curGPoint=gPoints[i];updateGPoint=pointsList.getById(curGPoint.id);if(updateGPoint){if(updateGPoint.captured){updateGPoint.insideElement=false;updateGPoint.lastPos=updateGPoint.currentPos;updateGPoint.lastTime=updateGPoint.currentTime;updateGPoint.currentPos=curGPoint.currentPos;updateGPoint.currentTime=curGPoint.currentTime;}else{stopTrackingPointer(pointsList,updateGPoint);}
curGPoint=updateGPoint;}
if(tracker.exitHandler){propagate=tracker.exitHandler({eventSource:tracker,pointerType:curGPoint.type,position:curGPoint.currentPos&&getPointRelativeToAbsolute(curGPoint.currentPos,tracker.element),buttons:pointsList.buttons,pointers:tracker.getActivePointerCount(),insideElementPressed:updateGPoint?updateGPoint.insideElementPressed:false,buttonDownAny:pointsList.buttons!==0,isTouchEvent:curGPoint.type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}}}
function updatePointersDown(tracker,event,gPoints,buttonChanged){var delegate=THIS[tracker.hash],propagate,pointsList=tracker.getActivePointersListByType(gPoints[0].type),i,gPointCount=gPoints.length,curGPoint,updateGPoint;if(typeof event.buttons!=='undefined'){pointsList.buttons=event.buttons;}else{if($.Browser.vendor===$.BROWSERS.IE&&$.Browser.version<9){if(buttonChanged===0){pointsList.buttons+=1;}else if(buttonChanged===1){pointsList.buttons+=4;}else if(buttonChanged===2){pointsList.buttons+=2;}else if(buttonChanged===3){pointsList.buttons+=8;}else if(buttonChanged===4){pointsList.buttons+=16;}else if(buttonChanged===5){pointsList.buttons+=32;}}else{if(buttonChanged===0){pointsList.buttons|=1;}else if(buttonChanged===1){pointsList.buttons|=4;}else if(buttonChanged===2){pointsList.buttons|=2;}else if(buttonChanged===3){pointsList.buttons|=8;}else if(buttonChanged===4){pointsList.buttons|=16;}else if(buttonChanged===5){pointsList.buttons|=32;}}}
var otherPointsLists=tracker.getActivePointersListsExceptType(gPoints[0].type);for(i=0;i<otherPointsLists.length;i++){abortContacts(tracker,event,otherPointsLists[i]);}
if(buttonChanged!==0){if(tracker.nonPrimaryPressHandler){propagate=tracker.nonPrimaryPressHandler({eventSource:tracker,pointerType:gPoints[0].type,position:getPointRelativeToAbsolute(gPoints[0].currentPos,tracker.element),button:buttonChanged,buttons:pointsList.buttons,isTouchEvent:gPoints[0].type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}
return false;}
for(i=0;i<gPointCount;i++){curGPoint=gPoints[i];updateGPoint=pointsList.getById(curGPoint.id);if(updateGPoint){updateGPoint.captured=true;updateGPoint.insideElementPressed=true;updateGPoint.insideElement=true;updateGPoint.contactPos=curGPoint.currentPos;updateGPoint.contactTime=curGPoint.currentTime;updateGPoint.lastPos=updateGPoint.currentPos;updateGPoint.lastTime=updateGPoint.currentTime;updateGPoint.currentPos=curGPoint.currentPos;updateGPoint.currentTime=curGPoint.currentTime;curGPoint=updateGPoint;}else{curGPoint.captured=true;curGPoint.insideElementPressed=true;curGPoint.insideElement=true;startTrackingPointer(pointsList,curGPoint);}
pointsList.addContact();if(tracker.dragHandler||tracker.dragEndHandler||tracker.pinchHandler){$.MouseTracker.gesturePointVelocityTracker.addPoint(tracker,curGPoint);}
if(pointsList.contacts===1){if(tracker.pressHandler){propagate=tracker.pressHandler({eventSource:tracker,pointerType:curGPoint.type,position:getPointRelativeToAbsolute(curGPoint.contactPos,tracker.element),buttons:pointsList.buttons,isTouchEvent:curGPoint.type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}}else if(pointsList.contacts===2){if(tracker.pinchHandler&&curGPoint.type==='touch'){delegate.pinchGPoints=pointsList.asArray();delegate.lastPinchDist=delegate.currentPinchDist=delegate.pinchGPoints[0].currentPos.distanceTo(delegate.pinchGPoints[1].currentPos);delegate.lastPinchCenter=delegate.currentPinchCenter=getCenterPoint(delegate.pinchGPoints[0].currentPos,delegate.pinchGPoints[1].currentPos);}}}
return true;}
function updatePointersUp(tracker,event,gPoints,buttonChanged){var delegate=THIS[tracker.hash],pointsList=tracker.getActivePointersListByType(gPoints[0].type),propagate,releasePoint,releaseTime,i,gPointCount=gPoints.length,curGPoint,updateGPoint,releaseCapture=false,wasCaptured=false,quick;if(typeof event.buttons!=='undefined'){pointsList.buttons=event.buttons;}else{if($.Browser.vendor===$.BROWSERS.IE&&$.Browser.version<9){if(buttonChanged===0){pointsList.buttons-=1;}else if(buttonChanged===1){pointsList.buttons-=4;}else if(buttonChanged===2){pointsList.buttons-=2;}else if(buttonChanged===3){pointsList.buttons-=8;}else if(buttonChanged===4){pointsList.buttons-=16;}else if(buttonChanged===5){pointsList.buttons-=32;}}else{if(buttonChanged===0){pointsList.buttons^=~1;}else if(buttonChanged===1){pointsList.buttons^=~4;}else if(buttonChanged===2){pointsList.buttons^=~2;}else if(buttonChanged===3){pointsList.buttons^=~8;}else if(buttonChanged===4){pointsList.buttons^=~16;}else if(buttonChanged===5){pointsList.buttons^=~32;}}}
if(buttonChanged!==0){if(tracker.nonPrimaryReleaseHandler){propagate=tracker.nonPrimaryReleaseHandler({eventSource:tracker,pointerType:gPoints[0].type,position:getPointRelativeToAbsolute(gPoints[0].currentPos,tracker.element),button:buttonChanged,buttons:pointsList.buttons,isTouchEvent:gPoints[0].type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}
var otherPointsList=tracker.getActivePointersListByType("mouse");abortContacts(tracker,event,otherPointsList);return false;}
if(typeof gPoints[0].currentPos==="undefined"){abortContacts(tracker,event,pointsList);return false;}
for(i=0;i<gPointCount;i++){curGPoint=gPoints[i];updateGPoint=pointsList.getById(curGPoint.id);if(updateGPoint){if(updateGPoint.captured){updateGPoint.captured=false;releaseCapture=true;wasCaptured=true;}
updateGPoint.lastPos=updateGPoint.currentPos;updateGPoint.lastTime=updateGPoint.currentTime;updateGPoint.currentPos=curGPoint.currentPos;updateGPoint.currentTime=curGPoint.currentTime;if(!updateGPoint.insideElement){stopTrackingPointer(pointsList,updateGPoint);}
releasePoint=updateGPoint.currentPos;releaseTime=updateGPoint.currentTime;if(wasCaptured){pointsList.removeContact();if(tracker.dragHandler||tracker.dragEndHandler||tracker.pinchHandler){$.MouseTracker.gesturePointVelocityTracker.removePoint(tracker,updateGPoint);}
if(pointsList.contacts===0){if(tracker.releaseHandler){propagate=tracker.releaseHandler({eventSource:tracker,pointerType:updateGPoint.type,position:getPointRelativeToAbsolute(releasePoint,tracker.element),buttons:pointsList.buttons,insideElementPressed:updateGPoint.insideElementPressed,insideElementReleased:updateGPoint.insideElement,isTouchEvent:updateGPoint.type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}
if(tracker.dragEndHandler&&!updateGPoint.currentPos.equals(updateGPoint.contactPos)){propagate=tracker.dragEndHandler({eventSource:tracker,pointerType:updateGPoint.type,position:getPointRelativeToAbsolute(updateGPoint.currentPos,tracker.element),speed:updateGPoint.speed,direction:updateGPoint.direction,shift:event.shiftKey,isTouchEvent:updateGPoint.type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}
if((tracker.clickHandler||tracker.dblClickHandler)&&updateGPoint.insideElement){quick=releaseTime-updateGPoint.contactTime<=tracker.clickTimeThreshold&&updateGPoint.contactPos.distanceTo(releasePoint)<=tracker.clickDistThreshold;if(tracker.clickHandler){propagate=tracker.clickHandler({eventSource:tracker,pointerType:updateGPoint.type,position:getPointRelativeToAbsolute(updateGPoint.currentPos,tracker.element),quick:quick,shift:event.shiftKey,isTouchEvent:updateGPoint.type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}
if(tracker.dblClickHandler&&quick){pointsList.clicks++;if(pointsList.clicks===1){delegate.lastClickPos=releasePoint;delegate.dblClickTimeOut=setTimeout(function(){pointsList.clicks=0;},tracker.dblClickTimeThreshold);}else if(pointsList.clicks===2){clearTimeout(delegate.dblClickTimeOut);pointsList.clicks=0;if(delegate.lastClickPos.distanceTo(releasePoint)<=tracker.dblClickDistThreshold){propagate=tracker.dblClickHandler({eventSource:tracker,pointerType:updateGPoint.type,position:getPointRelativeToAbsolute(updateGPoint.currentPos,tracker.element),shift:event.shiftKey,isTouchEvent:updateGPoint.type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}
delegate.lastClickPos=null;}}}}else if(pointsList.contacts===2){if(tracker.pinchHandler&&updateGPoint.type==='touch'){delegate.pinchGPoints=pointsList.asArray();delegate.lastPinchDist=delegate.currentPinchDist=delegate.pinchGPoints[0].currentPos.distanceTo(delegate.pinchGPoints[1].currentPos);delegate.lastPinchCenter=delegate.currentPinchCenter=getCenterPoint(delegate.pinchGPoints[0].currentPos,delegate.pinchGPoints[1].currentPos);}}}else{if(tracker.releaseHandler){propagate=tracker.releaseHandler({eventSource:tracker,pointerType:updateGPoint.type,position:getPointRelativeToAbsolute(releasePoint,tracker.element),buttons:pointsList.buttons,insideElementPressed:updateGPoint.insideElementPressed,insideElementReleased:updateGPoint.insideElement,isTouchEvent:updateGPoint.type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}}}}
return releaseCapture;}
function updatePointersMove(tracker,event,gPoints){var delegate=THIS[tracker.hash],pointsList=tracker.getActivePointersListByType(gPoints[0].type),i,gPointCount=gPoints.length,curGPoint,updateGPoint,gPointArray,delta,propagate;if(typeof event.buttons!=='undefined'){pointsList.buttons=event.buttons;}
for(i=0;i<gPointCount;i++){curGPoint=gPoints[i];updateGPoint=pointsList.getById(curGPoint.id);if(updateGPoint){if(Object.prototype.hasOwnProperty.call(curGPoint,'isPrimary')){updateGPoint.isPrimary=curGPoint.isPrimary;}
updateGPoint.lastPos=updateGPoint.currentPos;updateGPoint.lastTime=updateGPoint.currentTime;updateGPoint.currentPos=curGPoint.currentPos;updateGPoint.currentTime=curGPoint.currentTime;}else{curGPoint.captured=false;curGPoint.insideElementPressed=false;curGPoint.insideElement=true;startTrackingPointer(pointsList,curGPoint);}}
if(tracker.stopHandler&&gPoints[0].type==='mouse'){clearTimeout(tracker.stopTimeOut);tracker.stopTimeOut=setTimeout(function(){handlePointerStop(tracker,event,gPoints[0].type);},tracker.stopDelay);}
if(pointsList.contacts===0){if(tracker.moveHandler){propagate=tracker.moveHandler({eventSource:tracker,pointerType:gPoints[0].type,position:getPointRelativeToAbsolute(gPoints[0].currentPos,tracker.element),buttons:pointsList.buttons,isTouchEvent:gPoints[0].type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}}else if(pointsList.contacts===1){if(tracker.moveHandler){updateGPoint=pointsList.asArray()[0];propagate=tracker.moveHandler({eventSource:tracker,pointerType:updateGPoint.type,position:getPointRelativeToAbsolute(updateGPoint.currentPos,tracker.element),buttons:pointsList.buttons,isTouchEvent:updateGPoint.type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}
if(tracker.dragHandler){updateGPoint=pointsList.asArray()[0];delta=updateGPoint.currentPos.minus(updateGPoint.lastPos);propagate=tracker.dragHandler({eventSource:tracker,pointerType:updateGPoint.type,position:getPointRelativeToAbsolute(updateGPoint.currentPos,tracker.element),buttons:pointsList.buttons,delta:delta,speed:updateGPoint.speed,direction:updateGPoint.direction,shift:event.shiftKey,isTouchEvent:updateGPoint.type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}}else if(pointsList.contacts===2){if(tracker.moveHandler){gPointArray=pointsList.asArray();propagate=tracker.moveHandler({eventSource:tracker,pointerType:gPointArray[0].type,position:getPointRelativeToAbsolute(getCenterPoint(gPointArray[0].currentPos,gPointArray[1].currentPos),tracker.element),buttons:pointsList.buttons,isTouchEvent:gPointArray[0].type==='touch',originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}
if(tracker.pinchHandler&&gPoints[0].type==='touch'){delta=delegate.pinchGPoints[0].currentPos.distanceTo(delegate.pinchGPoints[1].currentPos);if(delta!=delegate.currentPinchDist){delegate.lastPinchDist=delegate.currentPinchDist;delegate.currentPinchDist=delta;delegate.lastPinchCenter=delegate.currentPinchCenter;delegate.currentPinchCenter=getCenterPoint(delegate.pinchGPoints[0].currentPos,delegate.pinchGPoints[1].currentPos);propagate=tracker.pinchHandler({eventSource:tracker,pointerType:'touch',gesturePoints:delegate.pinchGPoints,lastCenter:getPointRelativeToAbsolute(delegate.lastPinchCenter,tracker.element),center:getPointRelativeToAbsolute(delegate.currentPinchCenter,tracker.element),lastDistance:delegate.lastPinchDist,distance:delegate.currentPinchDist,shift:event.shiftKey,originalEvent:event,preventDefaultAction:false,userData:tracker.userData});if(propagate===false){$.cancelEvent(event);}}}}}
function updatePointersCancel(tracker,event,gPoints){updatePointersUp(tracker,event,gPoints,0);updatePointersExit(tracker,event,gPoints);}
function handlePointerStop(tracker,originalMoveEvent,pointerType){if(tracker.stopHandler){tracker.stopHandler({eventSource:tracker,pointerType:pointerType,position:getMouseRelative(originalMoveEvent,tracker.element),buttons:tracker.getActivePointersListByType(pointerType).buttons,isTouchEvent:pointerType==='touch',originalEvent:originalMoveEvent,preventDefaultAction:false,userData:tracker.userData});}}
var isInIframe=(function(){try{return window.self!==window.top;}catch(e){return true;}})();function canAccessEvents(target){try{return target.addEventListener&&target.removeEventListener;}catch(e){return false;}}}(OpenSeadragon));(function($){$.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5};$.Control=function(element,options,container){var parent=element.parentNode;if(typeof options==='number')
{$.console.error("Passing an anchor directly into the OpenSeadragon.Control constructor is deprecated; "+"please use an options object instead.  "+"Support for this deprecated variant is scheduled for removal in December 2013");options={anchor:options};}
options.attachToViewer=(typeof options.attachToViewer==='undefined')?true:options.attachToViewer;this.autoFade=(typeof options.autoFade==='undefined')?true:options.autoFade;this.element=element;this.anchor=options.anchor;this.container=container;if(this.anchor==$.ControlAnchor.ABSOLUTE){this.wrapper=$.makeNeutralElement("div");this.wrapper.style.position="absolute";this.wrapper.style.top=typeof(options.top)=="number"?(options.top+'px'):options.top;this.wrapper.style.left=typeof(options.left)=="number"?(options.left+'px'):options.left;this.wrapper.style.height=typeof(options.height)=="number"?(options.height+'px'):options.height;this.wrapper.style.width=typeof(options.width)=="number"?(options.width+'px'):options.width;this.wrapper.style.margin="0px";this.wrapper.style.padding="0px";this.element.style.position="relative";this.element.style.top="0px";this.element.style.left="0px";this.element.style.height="100%";this.element.style.width="100%";}else{this.wrapper=$.makeNeutralElement("div");this.wrapper.style.display="inline-block";if(this.anchor==$.ControlAnchor.NONE){this.wrapper.style.width=this.wrapper.style.height="100%";}}
this.wrapper.appendChild(this.element);if(options.attachToViewer){if(this.anchor==$.ControlAnchor.TOP_RIGHT||this.anchor==$.ControlAnchor.BOTTOM_RIGHT){this.container.insertBefore(this.wrapper,this.container.firstChild);}else{this.container.appendChild(this.wrapper);}}else{parent.appendChild(this.wrapper);}};$.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element);this.container.removeChild(this.wrapper);},isVisible:function(){return this.wrapper.style.display!="none";},setVisible:function(visible){this.wrapper.style.display=visible?(this.anchor==$.ControlAnchor.ABSOLUTE?'block':'inline-block'):"none";},setOpacity:function(opacity){if(this.element[$.SIGNAL]&&$.Browser.vendor==$.BROWSERS.IE){$.setElementOpacity(this.element,opacity,true);}else{$.setElementOpacity(this.wrapper,opacity,true);}}};}(OpenSeadragon));(function($){$.ControlDock=function(options){var layouts=['topleft','topright','bottomright','bottomleft'],layout,i;$.extend(true,this,{id:'controldock-'+$.now()+'-'+Math.floor(Math.random()*1000000),container:$.makeNeutralElement('div'),controls:[]},options);this.container.onsubmit=function(){return false;};if(this.element){this.element=$.getElement(this.element);this.element.appendChild(this.container);this.element.style.position='relative';this.container.style.width='100%';this.container.style.height='100%';}
for(i=0;i<layouts.length;i++){layout=layouts[i];this.controls[layout]=$.makeNeutralElement("div");this.controls[layout].style.position='absolute';if(layout.match('left')){this.controls[layout].style.left='0px';}
if(layout.match('right')){this.controls[layout].style.right='0px';}
if(layout.match('top')){this.controls[layout].style.top='0px';}
if(layout.match('bottom')){this.controls[layout].style.bottom='0px';}}
this.container.appendChild(this.controls.topleft);this.container.appendChild(this.controls.topright);this.container.appendChild(this.controls.bottomright);this.container.appendChild(this.controls.bottomleft);};$.ControlDock.prototype={addControl:function(element,controlOptions){element=$.getElement(element);var div=null;if(getControlIndex(this,element)>=0){return;}
switch(controlOptions.anchor){case $.ControlAnchor.TOP_RIGHT:div=this.controls.topright;element.style.position="relative";element.style.paddingRight="0px";element.style.paddingTop="0px";break;case $.ControlAnchor.BOTTOM_RIGHT:div=this.controls.bottomright;element.style.position="relative";element.style.paddingRight="0px";element.style.paddingBottom="0px";break;case $.ControlAnchor.BOTTOM_LEFT:div=this.controls.bottomleft;element.style.position="relative";element.style.paddingLeft="0px";element.style.paddingBottom="0px";break;case $.ControlAnchor.TOP_LEFT:div=this.controls.topleft;element.style.position="relative";element.style.paddingLeft="0px";element.style.paddingTop="0px";break;case $.ControlAnchor.ABSOLUTE:div=this.container;element.style.margin="0px";element.style.padding="0px";break;default:case $.ControlAnchor.NONE:div=this.container;element.style.margin="0px";element.style.padding="0px";break;}
this.controls.push(new $.Control(element,controlOptions,div));element.style.display="inline-block";},removeControl:function(element){element=$.getElement(element);var i=getControlIndex(this,element);if(i>=0){this.controls[i].destroy();this.controls.splice(i,1);}
return this;},clearControls:function(){while(this.controls.length>0){this.controls.pop().destroy();}
return this;},areControlsEnabled:function(){var i;for(i=this.controls.length-1;i>=0;i--){if(this.controls[i].isVisible()){return true;}}
return false;},setControlsEnabled:function(enabled){var i;for(i=this.controls.length-1;i>=0;i--){this.controls[i].setVisible(enabled);}
return this;}};function getControlIndex(dock,element){var controls=dock.controls,i;for(i=controls.length-1;i>=0;i--){if(controls[i].element==element){return i;}}
return-1;}}(OpenSeadragon));(function($){$.Placement=$.freezeObject({CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8,properties:{0:{isLeft:false,isHorizontallyCentered:true,isRight:false,isTop:false,isVerticallyCentered:true,isBottom:false},1:{isLeft:true,isHorizontallyCentered:false,isRight:false,isTop:true,isVerticallyCentered:false,isBottom:false},2:{isLeft:false,isHorizontallyCentered:true,isRight:false,isTop:true,isVerticallyCentered:false,isBottom:false},3:{isLeft:false,isHorizontallyCentered:false,isRight:true,isTop:true,isVerticallyCentered:false,isBottom:false},4:{isLeft:false,isHorizontallyCentered:false,isRight:true,isTop:false,isVerticallyCentered:true,isBottom:false},5:{isLeft:false,isHorizontallyCentered:false,isRight:true,isTop:false,isVerticallyCentered:false,isBottom:true},6:{isLeft:false,isHorizontallyCentered:true,isRight:false,isTop:false,isVerticallyCentered:false,isBottom:true},7:{isLeft:true,isHorizontallyCentered:false,isRight:false,isTop:false,isVerticallyCentered:false,isBottom:true},8:{isLeft:true,isHorizontallyCentered:false,isRight:false,isTop:false,isVerticallyCentered:true,isBottom:false}}});}(OpenSeadragon));(function($){var THIS={};var nextHash=1;$.Viewer=function(options){var args=arguments,_this=this,i;if(!$.isPlainObject(options)){options={id:args[0],xmlPath:args.length>1?args[1]:undefined,prefixUrl:args.length>2?args[2]:undefined,controls:args.length>3?args[3]:undefined,overlays:args.length>4?args[4]:undefined};}
if(options.config){$.extend(true,options,options.config);delete options.config;}
$.extend(true,this,{id:options.id,hash:options.hash||nextHash++,initialPage:0,element:null,container:null,canvas:null,overlays:[],overlaysContainer:null,previousBody:[],customControls:[],source:null,drawer:null,world:null,viewport:null,navigator:null,collectionViewport:null,collectionDrawer:null,navImages:null,buttons:null,profiler:null},$.DEFAULT_SETTINGS,options);if(typeof(this.hash)==="undefined"){throw new Error("A hash must be defined, either by specifying options.id or options.hash.");}
if(typeof(THIS[this.hash])!=="undefined"){$.console.warn("Hash "+this.hash+" has already been used.");}
THIS[this.hash]={"fsBoundsDelta":new $.Point(1,1),"prevContainerSize":null,"animating":false,"forceRedraw":false,"mouseInside":false,"group":null,"zooming":false,"zoomFactor":null,"lastZoomTime":null,"fullPage":false,"onfullscreenchange":null};this._sequenceIndex=0;this._firstOpen=true;this._updateRequestId=null;this._loadQueue=[];this.currentOverlays=[];this._lastScrollTime=$.now();$.EventSource.call(this);this.addHandler('open-failed',function(event){var msg=$.getString("Errors.OpenFailed",event.eventSource,event.message);_this._showMessage(msg);});$.ControlDock.call(this,options);if(this.xmlPath){this.tileSources=[this.xmlPath];}
this.element=this.element||document.getElementById(this.id);this.canvas=$.makeNeutralElement("div");this.canvas.className="openseadragon-canvas";(function(style){style.width="100%";style.height="100%";style.overflow="hidden";style.position="absolute";style.top="0px";style.left="0px";}(this.canvas.style));$.setElementTouchActionNone(this.canvas);if(options.tabIndex!==""){this.canvas.tabIndex=(options.tabIndex===undefined?0:options.tabIndex);}
this.container.className="openseadragon-container";(function(style){style.width="100%";style.height="100%";style.position="relative";style.overflow="hidden";style.left="0px";style.top="0px";style.textAlign="left";}(this.container.style));this.container.insertBefore(this.canvas,this.container.firstChild);this.element.appendChild(this.container);this.bodyWidth=document.body.style.width;this.bodyHeight=document.body.style.height;this.bodyOverflow=document.body.style.overflow;this.docOverflow=document.documentElement.style.overflow;this.innerTracker=new $.MouseTracker({element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,keyDownHandler:$.delegate(this,onCanvasKeyDown),keyHandler:$.delegate(this,onCanvasKeyPress),clickHandler:$.delegate(this,onCanvasClick),dblClickHandler:$.delegate(this,onCanvasDblClick),dragHandler:$.delegate(this,onCanvasDrag),dragEndHandler:$.delegate(this,onCanvasDragEnd),enterHandler:$.delegate(this,onCanvasEnter),exitHandler:$.delegate(this,onCanvasExit),pressHandler:$.delegate(this,onCanvasPress),releaseHandler:$.delegate(this,onCanvasRelease),nonPrimaryPressHandler:$.delegate(this,onCanvasNonPrimaryPress),nonPrimaryReleaseHandler:$.delegate(this,onCanvasNonPrimaryRelease),scrollHandler:$.delegate(this,onCanvasScroll),pinchHandler:$.delegate(this,onCanvasPinch)});this.outerTracker=new $.MouseTracker({element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:$.delegate(this,onContainerEnter),exitHandler:$.delegate(this,onContainerExit)});if(this.toolbar){this.toolbar=new $.ControlDock({element:this.toolbar});}
this.bindStandardControls();THIS[this.hash].prevContainerSize=_getSafeElemSize(this.container);this.world=new $.World({viewer:this});this.world.addHandler('add-item',function(event){_this.source=_this.world.getItemAt(0).source;THIS[_this.hash].forceRedraw=true;if(!_this._updateRequestId){_this._updateRequestId=scheduleUpdate(_this,updateMulti);}});this.world.addHandler('remove-item',function(event){if(_this.world.getItemCount()){_this.source=_this.world.getItemAt(0).source;}else{_this.source=null;}
THIS[_this.hash].forceRedraw=true;});this.world.addHandler('metrics-change',function(event){if(_this.viewport){_this.viewport._setContentBounds(_this.world.getHomeBounds(),_this.world.getContentFactor());}});this.world.addHandler('item-index-change',function(event){_this.source=_this.world.getItemAt(0).source;});this.viewport=new $.Viewport({containerSize:THIS[this.hash].prevContainerSize,springStiffness:this.springStiffness,animationTime:this.animationTime,minZoomImageRatio:this.minZoomImageRatio,maxZoomPixelRatio:this.maxZoomPixelRatio,visibilityRatio:this.visibilityRatio,wrapHorizontal:this.wrapHorizontal,wrapVertical:this.wrapVertical,defaultZoomLevel:this.defaultZoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,viewer:this,degrees:this.degrees,flipped:this.flipped,navigatorRotate:this.navigatorRotate,homeFillsViewer:this.homeFillsViewer,margins:this.viewportMargins});this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor());this.imageLoader=new $.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:options.timeout});this.tileCache=new $.TileCache({maxImageCacheCount:this.maxImageCacheCount});this.drawer=new $.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor});this.overlaysContainer=$.makeNeutralElement("div");this.canvas.appendChild(this.overlaysContainer);if(!this.drawer.canRotate()){if(this.rotateLeft){i=this.buttons.buttons.indexOf(this.rotateLeft);this.buttons.buttons.splice(i,1);this.buttons.element.removeChild(this.rotateLeft.element);}
if(this.rotateRight){i=this.buttons.buttons.indexOf(this.rotateRight);this.buttons.buttons.splice(i,1);this.buttons.element.removeChild(this.rotateRight.element);}}
if(this.showNavigator){this.navigator=new $.Navigator({id:this.navigatorId,position:this.navigatorPosition,sizeRatio:this.navigatorSizeRatio,maintainSizeRatio:this.navigatorMaintainSizeRatio,top:this.navigatorTop,left:this.navigatorLeft,width:this.navigatorWidth,height:this.navigatorHeight,autoResize:this.navigatorAutoResize,autoFade:this.navigatorAutoFade,prefixUrl:this.prefixUrl,viewer:this,navigatorRotate:this.navigatorRotate,background:this.navigatorBackground,opacity:this.navigatorOpacity,borderColor:this.navigatorBorderColor,displayRegionColor:this.navigatorDisplayRegionColor,crossOriginPolicy:this.crossOriginPolicy});}
if(this.sequenceMode){this.bindSequenceControls();}
if(this.tileSources){this.open(this.tileSources);}
for(i=0;i<this.customControls.length;i++){this.addControl(this.customControls[i].id,{anchor:this.customControls[i].anchor});}
$.requestAnimationFrame(function(){beginControlsAutoHide(_this);});if(this.imageSmoothingEnabled!==undefined&&!this.imageSmoothingEnabled){this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled);}};$.extend($.Viewer.prototype,$.EventSource.prototype,$.ControlDock.prototype,{isOpen:function(){return!!this.world.getItemCount();},openDzi:function(dzi){$.console.error("[Viewer.openDzi] this function is deprecated; use Viewer.open() instead.");return this.open(dzi);},openTileSource:function(tileSource){$.console.error("[Viewer.openTileSource] this function is deprecated; use Viewer.open() instead.");return this.open(tileSource);},open:function(tileSources,initialPage){var _this=this;this.close();if(!tileSources){return;}
if(this.sequenceMode&&$.isArray(tileSources)){if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null;}
if(typeof initialPage!='undefined'&&!isNaN(initialPage)){this.initialPage=initialPage;}
this.tileSources=tileSources;this._sequenceIndex=Math.max(0,Math.min(this.tileSources.length-1,this.initialPage));if(this.tileSources.length){this.open(this.tileSources[this._sequenceIndex]);if(this.showReferenceStrip){this.addReferenceStrip();}}
this._updateSequenceButtons(this._sequenceIndex);return;}
if(!$.isArray(tileSources)){tileSources=[tileSources];}
if(!tileSources.length){return;}
this._opening=true;var expected=tileSources.length;var successes=0;var failures=0;var failEvent;var checkCompletion=function(){if(successes+failures===expected){if(successes){if(_this._firstOpen||!_this.preserveViewport){_this.viewport.goHome(true);_this.viewport.update();}
_this._firstOpen=false;var source=tileSources[0];if(source.tileSource){source=source.tileSource;}
if(_this.overlays&&!_this.preserveOverlays){for(var i=0;i<_this.overlays.length;i++){_this.currentOverlays[i]=getOverlayObject(_this,_this.overlays[i]);}}
_this._drawOverlays();_this._opening=false;_this.raiseEvent('open',{source:source});}else{_this._opening=false;_this.raiseEvent('open-failed',failEvent);}}};var doOne=function(options){if(!$.isPlainObject(options)||!options.tileSource){options={tileSource:options};}
if(options.index!==undefined){$.console.error('[Viewer.open] setting indexes here is not supported; use addTiledImage instead');delete options.index;}
if(options.collectionImmediately===undefined){options.collectionImmediately=true;}
var originalSuccess=options.success;options.success=function(event){successes++;if(options.tileSource.overlays){for(var i=0;i<options.tileSource.overlays.length;i++){_this.addOverlay(options.tileSource.overlays[i]);}}
if(originalSuccess){originalSuccess(event);}
checkCompletion();};var originalError=options.error;options.error=function(event){failures++;if(!failEvent){failEvent=event;}
if(originalError){originalError(event);}
checkCompletion();};_this.addTiledImage(options);};for(var i=0;i<tileSources.length;i++){doOne(tileSources[i]);}
return this;},close:function(){if(!THIS[this.hash]){return this;}
this._opening=false;if(this.navigator){this.navigator.close();}
if(!this.preserveOverlays){this.clearOverlays();this.overlaysContainer.innerHTML="";}
THIS[this.hash].animating=false;this.world.removeAll();this.imageLoader.clear();this.raiseEvent('close');return this;},destroy:function(){if(!THIS[this.hash]){return;}
this.close();this.clearOverlays();this.overlaysContainer.innerHTML="";if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null;}
if(this._updateRequestId!==null){$.cancelAnimationFrame(this._updateRequestId);this._updateRequestId=null;}
if(this.drawer){this.drawer.destroy();}
this.removeAllHandlers();if(this.element){while(this.element.firstChild){this.element.removeChild(this.element.firstChild);}}
if(this.innerTracker){this.innerTracker.destroy();}
if(this.outerTracker){this.outerTracker.destroy();}
THIS[this.hash]=null;delete THIS[this.hash];this.canvas=null;this.container=null;this.element=null;},isMouseNavEnabled:function(){return this.innerTracker.isTracking();},setMouseNavEnabled:function(enabled){this.innerTracker.setTracking(enabled);this.outerTracker.setTracking(enabled);this.raiseEvent('mouse-enabled',{enabled:enabled});return this;},areControlsEnabled:function(){var enabled=this.controls.length,i;for(i=0;i<this.controls.length;i++){enabled=enabled&&this.controls[i].isVisible();}
return enabled;},setControlsEnabled:function(enabled){if(enabled){abortControlsAutoHide(this);}else{beginControlsAutoHide(this);}
this.raiseEvent('controls-enabled',{enabled:enabled});return this;},setDebugMode:function(debugMode){for(var i=0;i<this.world.getItemCount();i++){this.world.getItemAt(i).debugMode=debugMode;}
this.debugMode=debugMode;this.forceRedraw();},isFullPage:function(){return THIS[this.hash].fullPage;},setFullPage:function(fullPage){var body=document.body,bodyStyle=body.style,docStyle=document.documentElement.style,_this=this,nodes,i;if(fullPage==this.isFullPage()){return this;}
var fullPageEventArgs={fullPage:fullPage,preventDefaultAction:false};this.raiseEvent('pre-full-page',fullPageEventArgs);if(fullPageEventArgs.preventDefaultAction){return this;}
if(fullPage){this.elementSize=$.getElementSize(this.element);this.pageScroll=$.getPageScroll();this.elementMargin=this.element.style.margin;this.element.style.margin="0";this.elementPadding=this.element.style.padding;this.element.style.padding="0";this.bodyMargin=bodyStyle.margin;this.docMargin=docStyle.margin;bodyStyle.margin="0";docStyle.margin="0";this.bodyPadding=bodyStyle.padding;this.docPadding=docStyle.padding;bodyStyle.padding="0";docStyle.padding="0";this.bodyWidth=bodyStyle.width;this.docWidth=docStyle.width;bodyStyle.width="100%";docStyle.width="100%";this.bodyHeight=bodyStyle.height;this.docHeight=docStyle.height;bodyStyle.height="100%";docStyle.height="100%";this.previousBody=[];THIS[this.hash].prevElementParent=this.element.parentNode;THIS[this.hash].prevNextSibling=this.element.nextSibling;THIS[this.hash].prevElementWidth=this.element.style.width;THIS[this.hash].prevElementHeight=this.element.style.height;nodes=body.childNodes.length;for(i=0;i<nodes;i++){this.previousBody.push(body.childNodes[0]);body.removeChild(body.childNodes[0]);}
if(this.toolbar&&this.toolbar.element){this.toolbar.parentNode=this.toolbar.element.parentNode;this.toolbar.nextSibling=this.toolbar.element.nextSibling;body.appendChild(this.toolbar.element);$.addClass(this.toolbar.element,'fullpage');}
$.addClass(this.element,'fullpage');body.appendChild(this.element);this.element.style.height=$.getWindowSize().y+'px';this.element.style.width=$.getWindowSize().x+'px';if(this.toolbar&&this.toolbar.element){this.element.style.height=($.getElementSize(this.element).y-$.getElementSize(this.toolbar.element).y)+'px';}
THIS[this.hash].fullPage=true;$.delegate(this,onContainerEnter)({});}else{this.element.style.margin=this.elementMargin;this.element.style.padding=this.elementPadding;bodyStyle.margin=this.bodyMargin;docStyle.margin=this.docMargin;bodyStyle.padding=this.bodyPadding;docStyle.padding=this.docPadding;bodyStyle.width=this.bodyWidth;docStyle.width=this.docWidth;bodyStyle.height=this.bodyHeight;docStyle.height=this.docHeight;body.removeChild(this.element);nodes=this.previousBody.length;for(i=0;i<nodes;i++){body.appendChild(this.previousBody.shift());}
$.removeClass(this.element,'fullpage');THIS[this.hash].prevElementParent.insertBefore(this.element,THIS[this.hash].prevNextSibling);if(this.toolbar&&this.toolbar.element){body.removeChild(this.toolbar.element);$.removeClass(this.toolbar.element,'fullpage');this.toolbar.parentNode.insertBefore(this.toolbar.element,this.toolbar.nextSibling);delete this.toolbar.parentNode;delete this.toolbar.nextSibling;}
this.element.style.width=THIS[this.hash].prevElementWidth;this.element.style.height=THIS[this.hash].prevElementHeight;var restoreScrollCounter=0;var restoreScroll=function(){$.setPageScroll(_this.pageScroll);var pageScroll=$.getPageScroll();restoreScrollCounter++;if(restoreScrollCounter<10&&(pageScroll.x!==_this.pageScroll.x||pageScroll.y!==_this.pageScroll.y)){$.requestAnimationFrame(restoreScroll);}};$.requestAnimationFrame(restoreScroll);THIS[this.hash].fullPage=false;$.delegate(this,onContainerExit)({});}
if(this.navigator&&this.viewport){this.navigator.update(this.viewport);}
this.raiseEvent('full-page',{fullPage:fullPage});return this;},setFullScreen:function(fullScreen){var _this=this;if(!$.supportsFullScreen){return this.setFullPage(fullScreen);}
if($.isFullScreen()===fullScreen){return this;}
var fullScreeEventArgs={fullScreen:fullScreen,preventDefaultAction:false};this.raiseEvent('pre-full-screen',fullScreeEventArgs);if(fullScreeEventArgs.preventDefaultAction){return this;}
if(fullScreen){this.setFullPage(true);if(!this.isFullPage()){return this;}
this.fullPageStyleWidth=this.element.style.width;this.fullPageStyleHeight=this.element.style.height;this.element.style.width='100%';this.element.style.height='100%';var onFullScreenChange=function(){var isFullScreen=$.isFullScreen();if(!isFullScreen){$.removeEvent(document,$.fullScreenEventName,onFullScreenChange);$.removeEvent(document,$.fullScreenErrorEventName,onFullScreenChange);_this.setFullPage(false);if(_this.isFullPage()){_this.element.style.width=_this.fullPageStyleWidth;_this.element.style.height=_this.fullPageStyleHeight;}}
if(_this.navigator&&_this.viewport){setTimeout(function(){_this.navigator.update(_this.viewport);});}
_this.raiseEvent('full-screen',{fullScreen:isFullScreen});};$.addEvent(document,$.fullScreenEventName,onFullScreenChange);$.addEvent(document,$.fullScreenErrorEventName,onFullScreenChange);$.requestFullScreen(document.body);}else{$.exitFullScreen();}
return this;},isVisible:function(){return this.container.style.visibility!="hidden";},setVisible:function(visible){this.container.style.visibility=visible?"":"hidden";this.raiseEvent('visible',{visible:visible});return this;},addTiledImage:function(options){$.console.assert(options,"[Viewer.addTiledImage] options is required");$.console.assert(options.tileSource,"[Viewer.addTiledImage] options.tileSource is required");$.console.assert(!options.replace||(options.index>-1&&options.index<this.world.getItemCount()),"[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world");var _this=this;if(options.replace){options.replaceItem=_this.world.getItemAt(options.index);}
this._hideMessage();if(options.placeholderFillStyle===undefined){options.placeholderFillStyle=this.placeholderFillStyle;}
if(options.opacity===undefined){options.opacity=this.opacity;}
if(options.preload===undefined){options.preload=this.preload;}
if(options.compositeOperation===undefined){options.compositeOperation=this.compositeOperation;}
if(options.crossOriginPolicy===undefined){options.crossOriginPolicy=options.tileSource.crossOriginPolicy!==undefined?options.tileSource.crossOriginPolicy:this.crossOriginPolicy;}
if(options.ajaxWithCredentials===undefined){options.ajaxWithCredentials=this.ajaxWithCredentials;}
if(options.loadTilesWithAjax===undefined){options.loadTilesWithAjax=this.loadTilesWithAjax;}
if(options.ajaxHeaders===undefined||options.ajaxHeaders===null){options.ajaxHeaders=this.ajaxHeaders;}else if($.isPlainObject(options.ajaxHeaders)&&$.isPlainObject(this.ajaxHeaders)){options.ajaxHeaders=$.extend({},this.ajaxHeaders,options.ajaxHeaders);}
var myQueueItem={options:options};function raiseAddItemFailed(event){for(var i=0;i<_this._loadQueue.length;i++){if(_this._loadQueue[i]===myQueueItem){_this._loadQueue.splice(i,1);break;}}
if(_this._loadQueue.length===0){refreshWorld(myQueueItem);}
_this.raiseEvent('add-item-failed',event);if(options.error){options.error(event);}}
function refreshWorld(theItem){if(_this.collectionMode){_this.world.arrange({immediately:theItem.options.collectionImmediately,rows:_this.collectionRows,columns:_this.collectionColumns,layout:_this.collectionLayout,tileSize:_this.collectionTileSize,tileMargin:_this.collectionTileMargin});_this.world.setAutoRefigureSizes(true);}}
if($.isArray(options.tileSource)){setTimeout(function(){raiseAddItemFailed({message:"[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.",source:options.tileSource,options:options});});return;}
this._loadQueue.push(myQueueItem);function processReadyItems(){var queueItem,tiledImage,optionsClone;while(_this._loadQueue.length){queueItem=_this._loadQueue[0];if(!queueItem.tileSource){break;}
_this._loadQueue.splice(0,1);if(queueItem.options.replace){var newIndex=_this.world.getIndexOfItem(queueItem.options.replaceItem);if(newIndex!=-1){queueItem.options.index=newIndex;}
_this.world.removeItem(queueItem.options.replaceItem);}
tiledImage=new $.TiledImage({viewer:_this,source:queueItem.tileSource,viewport:_this.viewport,drawer:_this.drawer,tileCache:_this.tileCache,imageLoader:_this.imageLoader,x:queueItem.options.x,y:queueItem.options.y,width:queueItem.options.width,height:queueItem.options.height,fitBounds:queueItem.options.fitBounds,fitBoundsPlacement:queueItem.options.fitBoundsPlacement,clip:queueItem.options.clip,placeholderFillStyle:queueItem.options.placeholderFillStyle,opacity:queueItem.options.opacity,preload:queueItem.options.preload,degrees:queueItem.options.degrees,compositeOperation:queueItem.options.compositeOperation,springStiffness:_this.springStiffness,animationTime:_this.animationTime,minZoomImageRatio:_this.minZoomImageRatio,wrapHorizontal:_this.wrapHorizontal,wrapVertical:_this.wrapVertical,immediateRender:_this.immediateRender,blendTime:_this.blendTime,alwaysBlend:_this.alwaysBlend,minPixelRatio:_this.minPixelRatio,smoothTileEdgesMinZoom:_this.smoothTileEdgesMinZoom,iOSDevice:_this.iOSDevice,crossOriginPolicy:queueItem.options.crossOriginPolicy,ajaxWithCredentials:queueItem.options.ajaxWithCredentials,loadTilesWithAjax:queueItem.options.loadTilesWithAjax,ajaxHeaders:queueItem.options.ajaxHeaders,debugMode:_this.debugMode});if(_this.collectionMode){_this.world.setAutoRefigureSizes(false);}
_this.world.addItem(tiledImage,{index:queueItem.options.index});if(_this._loadQueue.length===0){refreshWorld(queueItem);}
if(_this.world.getItemCount()===1&&!_this.preserveViewport){_this.viewport.goHome(true);}
if(_this.navigator){optionsClone=$.extend({},queueItem.options,{replace:false,originalTiledImage:tiledImage,tileSource:queueItem.tileSource});_this.navigator.addTiledImage(optionsClone);}
if(queueItem.options.success){queueItem.options.success({item:tiledImage});}}}
getTileSourceImplementation(this,options.tileSource,options,function(tileSource){myQueueItem.tileSource=tileSource;processReadyItems();},function(event){event.options=options;raiseAddItemFailed(event);processReadyItems();});},addSimpleImage:function(options){$.console.assert(options,"[Viewer.addSimpleImage] options is required");$.console.assert(options.url,"[Viewer.addSimpleImage] options.url is required");var opts=$.extend({},options,{tileSource:{type:'image',url:options.url}});delete opts.url;this.addTiledImage(opts);},addLayer:function(options){var _this=this;$.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var optionsClone=$.extend({},options,{success:function(event){_this.raiseEvent("add-layer",{options:options,drawer:event.item});},error:function(event){_this.raiseEvent("add-layer-failed",event);}});this.addTiledImage(optionsClone);return this;},getLayerAtLevel:function(level){$.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead.");return this.world.getItemAt(level);},getLevelOfLayer:function(drawer){$.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead.");return this.world.getIndexOfItem(drawer);},getLayersCount:function(){$.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead.");return this.world.getItemCount();},setLayerLevel:function(drawer,level){$.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead.");return this.world.setItemIndex(drawer,level);},removeLayer:function(drawer){$.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead.");return this.world.removeItem(drawer);},forceRedraw:function(){THIS[this.hash].forceRedraw=true;return this;},bindSequenceControls:function(){var onFocusHandler=$.delegate(this,onFocus),onBlurHandler=$.delegate(this,onBlur),onNextHandler=$.delegate(this,onNext),onPreviousHandler=$.delegate(this,onPrevious),navImages=this.navImages,useGroup=true;if(this.showSequenceControl){if(this.previousButton||this.nextButton){useGroup=false;}
this.previousButton=new $.Button({element:this.previousButton?$.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:$.getString("Tooltips.PreviousPage"),srcRest:resolveUrl(this.prefixUrl,navImages.previous.REST),srcGroup:resolveUrl(this.prefixUrl,navImages.previous.GROUP),srcHover:resolveUrl(this.prefixUrl,navImages.previous.HOVER),srcDown:resolveUrl(this.prefixUrl,navImages.previous.DOWN),onRelease:onPreviousHandler,onFocus:onFocusHandler,onBlur:onBlurHandler});this.nextButton=new $.Button({element:this.nextButton?$.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:$.getString("Tooltips.NextPage"),srcRest:resolveUrl(this.prefixUrl,navImages.next.REST),srcGroup:resolveUrl(this.prefixUrl,navImages.next.GROUP),srcHover:resolveUrl(this.prefixUrl,navImages.next.HOVER),srcDown:resolveUrl(this.prefixUrl,navImages.next.DOWN),onRelease:onNextHandler,onFocus:onFocusHandler,onBlur:onBlurHandler});if(!this.navPrevNextWrap){this.previousButton.disable();}
if(!this.tileSources||!this.tileSources.length){this.nextButton.disable();}
if(useGroup){this.paging=new $.ButtonGroup({buttons:[this.previousButton,this.nextButton],clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.pagingControl=this.paging.element;if(this.toolbar){this.toolbar.addControl(this.pagingControl,{anchor:$.ControlAnchor.BOTTOM_RIGHT});}else{this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||$.ControlAnchor.TOP_LEFT});}}}
return this;},bindStandardControls:function(){var beginZoomingInHandler=$.delegate(this,beginZoomingIn),endZoomingHandler=$.delegate(this,endZooming),doSingleZoomInHandler=$.delegate(this,doSingleZoomIn),beginZoomingOutHandler=$.delegate(this,beginZoomingOut),doSingleZoomOutHandler=$.delegate(this,doSingleZoomOut),onHomeHandler=$.delegate(this,onHome),onFullScreenHandler=$.delegate(this,onFullScreen),onRotateLeftHandler=$.delegate(this,onRotateLeft),onRotateRightHandler=$.delegate(this,onRotateRight),onFlipHandler=$.delegate(this,onFlip),onFocusHandler=$.delegate(this,onFocus),onBlurHandler=$.delegate(this,onBlur),navImages=this.navImages,buttons=[],useGroup=true;if(this.showNavigationControl){if(this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton){useGroup=false;}
if(this.showZoomControl){buttons.push(this.zoomInButton=new $.Button({element:this.zoomInButton?$.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:$.getString("Tooltips.ZoomIn"),srcRest:resolveUrl(this.prefixUrl,navImages.zoomIn.REST),srcGroup:resolveUrl(this.prefixUrl,navImages.zoomIn.GROUP),srcHover:resolveUrl(this.prefixUrl,navImages.zoomIn.HOVER),srcDown:resolveUrl(this.prefixUrl,navImages.zoomIn.DOWN),onPress:beginZoomingInHandler,onRelease:endZoomingHandler,onClick:doSingleZoomInHandler,onEnter:beginZoomingInHandler,onExit:endZoomingHandler,onFocus:onFocusHandler,onBlur:onBlurHandler}));buttons.push(this.zoomOutButton=new $.Button({element:this.zoomOutButton?$.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:$.getString("Tooltips.ZoomOut"),srcRest:resolveUrl(this.prefixUrl,navImages.zoomOut.REST),srcGroup:resolveUrl(this.prefixUrl,navImages.zoomOut.GROUP),srcHover:resolveUrl(this.prefixUrl,navImages.zoomOut.HOVER),srcDown:resolveUrl(this.prefixUrl,navImages.zoomOut.DOWN),onPress:beginZoomingOutHandler,onRelease:endZoomingHandler,onClick:doSingleZoomOutHandler,onEnter:beginZoomingOutHandler,onExit:endZoomingHandler,onFocus:onFocusHandler,onBlur:onBlurHandler}));}
if(this.showHomeControl){buttons.push(this.homeButton=new $.Button({element:this.homeButton?$.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:$.getString("Tooltips.Home"),srcRest:resolveUrl(this.prefixUrl,navImages.home.REST),srcGroup:resolveUrl(this.prefixUrl,navImages.home.GROUP),srcHover:resolveUrl(this.prefixUrl,navImages.home.HOVER),srcDown:resolveUrl(this.prefixUrl,navImages.home.DOWN),onRelease:onHomeHandler,onFocus:onFocusHandler,onBlur:onBlurHandler}));}
if(this.showFullPageControl){buttons.push(this.fullPageButton=new $.Button({element:this.fullPageButton?$.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:$.getString("Tooltips.FullPage"),srcRest:resolveUrl(this.prefixUrl,navImages.fullpage.REST),srcGroup:resolveUrl(this.prefixUrl,navImages.fullpage.GROUP),srcHover:resolveUrl(this.prefixUrl,navImages.fullpage.HOVER),srcDown:resolveUrl(this.prefixUrl,navImages.fullpage.DOWN),onRelease:onFullScreenHandler,onFocus:onFocusHandler,onBlur:onBlurHandler}));}
if(this.showRotationControl){buttons.push(this.rotateLeftButton=new $.Button({element:this.rotateLeftButton?$.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:$.getString("Tooltips.RotateLeft"),srcRest:resolveUrl(this.prefixUrl,navImages.rotateleft.REST),srcGroup:resolveUrl(this.prefixUrl,navImages.rotateleft.GROUP),srcHover:resolveUrl(this.prefixUrl,navImages.rotateleft.HOVER),srcDown:resolveUrl(this.prefixUrl,navImages.rotateleft.DOWN),onRelease:onRotateLeftHandler,onFocus:onFocusHandler,onBlur:onBlurHandler}));buttons.push(this.rotateRightButton=new $.Button({element:this.rotateRightButton?$.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:$.getString("Tooltips.RotateRight"),srcRest:resolveUrl(this.prefixUrl,navImages.rotateright.REST),srcGroup:resolveUrl(this.prefixUrl,navImages.rotateright.GROUP),srcHover:resolveUrl(this.prefixUrl,navImages.rotateright.HOVER),srcDown:resolveUrl(this.prefixUrl,navImages.rotateright.DOWN),onRelease:onRotateRightHandler,onFocus:onFocusHandler,onBlur:onBlurHandler}));}
if(this.showFlipControl){buttons.push(this.flipButton=new $.Button({element:this.flipButton?$.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:$.getString("Tooltips.Flip"),srcRest:resolveUrl(this.prefixUrl,navImages.flip.REST),srcGroup:resolveUrl(this.prefixUrl,navImages.flip.GROUP),srcHover:resolveUrl(this.prefixUrl,navImages.flip.HOVER),srcDown:resolveUrl(this.prefixUrl,navImages.flip.DOWN),onRelease:onFlipHandler,onFocus:onFocusHandler,onBlur:onBlurHandler}));}
if(useGroup){this.buttons=new $.ButtonGroup({buttons:buttons,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.navControl=this.buttons.element;this.addHandler('open',$.delegate(this,lightUp));if(this.toolbar){this.toolbar.addControl(this.navControl,{anchor:this.navigationControlAnchor||$.ControlAnchor.TOP_LEFT});}else{this.addControl(this.navControl,{anchor:this.navigationControlAnchor||$.ControlAnchor.TOP_LEFT});}}}
return this;},currentPage:function(){return this._sequenceIndex;},goToPage:function(page){if(this.tileSources&&page>=0&&page<this.tileSources.length){this._sequenceIndex=page;this._updateSequenceButtons(page);this.open(this.tileSources[page]);if(this.referenceStrip){this.referenceStrip.setFocus(page);}
this.raiseEvent('page',{page:page});}
return this;},addOverlay:function(element,location,placement,onDraw){var options;if($.isPlainObject(element)){options=element;}else{options={element:element,location:location,placement:placement,onDraw:onDraw};}
element=$.getElement(options.element);if(getOverlayIndex(this.currentOverlays,element)>=0){return this;}
var overlay=getOverlayObject(this,options);this.currentOverlays.push(overlay);overlay.drawHTML(this.overlaysContainer,this.viewport);this.raiseEvent('add-overlay',{element:element,location:options.location,placement:options.placement});return this;},updateOverlay:function(element,location,placement){var i;element=$.getElement(element);i=getOverlayIndex(this.currentOverlays,element);if(i>=0){this.currentOverlays[i].update(location,placement);THIS[this.hash].forceRedraw=true;this.raiseEvent('update-overlay',{element:element,location:location,placement:placement});}
return this;},removeOverlay:function(element){var i;element=$.getElement(element);i=getOverlayIndex(this.currentOverlays,element);if(i>=0){this.currentOverlays[i].destroy();this.currentOverlays.splice(i,1);THIS[this.hash].forceRedraw=true;this.raiseEvent('remove-overlay',{element:element});}
return this;},clearOverlays:function(){while(this.currentOverlays.length>0){this.currentOverlays.pop().destroy();}
THIS[this.hash].forceRedraw=true;this.raiseEvent('clear-overlay',{});return this;},getOverlayById:function(element){var i;element=$.getElement(element);i=getOverlayIndex(this.currentOverlays,element);if(i>=0){return this.currentOverlays[i];}else{return null;}},_updateSequenceButtons:function(page){if(this.nextButton){if(!this.tileSources||this.tileSources.length-1===page){if(!this.navPrevNextWrap){this.nextButton.disable();}}else{this.nextButton.enable();}}
if(this.previousButton){if(page>0){this.previousButton.enable();}else{if(!this.navPrevNextWrap){this.previousButton.disable();}}}},_showMessage:function(message){this._hideMessage();var div=$.makeNeutralElement("div");div.appendChild(document.createTextNode(message));this.messageDiv=$.makeCenteredNode(div);$.addClass(this.messageDiv,"openseadragon-message");this.container.appendChild(this.messageDiv);},_hideMessage:function(){var div=this.messageDiv;if(div){div.parentNode.removeChild(div);delete this.messageDiv;}},gestureSettingsByDeviceType:function(type){switch(type){case'mouse':return this.gestureSettingsMouse;case'touch':return this.gestureSettingsTouch;case'pen':return this.gestureSettingsPen;default:return this.gestureSettingsUnknown;}},_drawOverlays:function(){var i,length=this.currentOverlays.length;for(i=0;i<length;i++){this.currentOverlays[i].drawHTML(this.overlaysContainer,this.viewport);}},_cancelPendingImages:function(){this._loadQueue=[];},removeReferenceStrip:function(){this.showReferenceStrip=false;if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null;}},addReferenceStrip:function(){this.showReferenceStrip=true;if(this.sequenceMode){if(this.referenceStrip){return;}
if(this.tileSources.length&&this.tileSources.length>1){this.referenceStrip=new $.ReferenceStrip({id:this.referenceStripElement,position:this.referenceStripPosition,sizeRatio:this.referenceStripSizeRatio,scroll:this.referenceStripScroll,height:this.referenceStripHeight,width:this.referenceStripWidth,tileSources:this.tileSources,prefixUrl:this.prefixUrl,useCanvas:this.useCanvas,viewer:this});this.referenceStrip.setFocus(this._sequenceIndex);}}else{$.console.warn('Attempting to display a reference strip while "sequenceMode" is off.');}}});function _getSafeElemSize(oElement){oElement=$.getElement(oElement);return new $.Point((oElement.clientWidth===0?1:oElement.clientWidth),(oElement.clientHeight===0?1:oElement.clientHeight));}
function getTileSourceImplementation(viewer,tileSource,imgOptions,successCallback,failCallback){var _this=viewer;if($.type(tileSource)=='string'){if(tileSource.match(/^\s*<.*>\s*$/)){tileSource=$.parseXml(tileSource);}else if(tileSource.match(/^\s*[\{\[].*[\}\]]\s*$/)){try{var tileSourceJ=$.parseJSON(tileSource);tileSource=tileSourceJ;}catch(e){}}}
function waitUntilReady(tileSource,originalTileSource){if(tileSource.ready){successCallback(tileSource);}else{tileSource.addHandler('ready',function(){successCallback(tileSource);});tileSource.addHandler('open-failed',function(event){failCallback({message:event.message,source:originalTileSource});});}}
setTimeout(function(){if($.type(tileSource)=='string'){tileSource=new $.TileSource({url:tileSource,crossOriginPolicy:imgOptions.crossOriginPolicy!==undefined?imgOptions.crossOriginPolicy:viewer.crossOriginPolicy,ajaxWithCredentials:viewer.ajaxWithCredentials,ajaxHeaders:viewer.ajaxHeaders,useCanvas:viewer.useCanvas,success:function(event){successCallback(event.tileSource);}});tileSource.addHandler('open-failed',function(event){failCallback(event);});}else if($.isPlainObject(tileSource)||tileSource.nodeType){if(tileSource.crossOriginPolicy===undefined&&(imgOptions.crossOriginPolicy!==undefined||viewer.crossOriginPolicy!==undefined)){tileSource.crossOriginPolicy=imgOptions.crossOriginPolicy!==undefined?imgOptions.crossOriginPolicy:viewer.crossOriginPolicy;}
if(tileSource.ajaxWithCredentials===undefined){tileSource.ajaxWithCredentials=viewer.ajaxWithCredentials;}
if(tileSource.useCanvas===undefined){tileSource.useCanvas=viewer.useCanvas;}
if($.isFunction(tileSource.getTileUrl)){var customTileSource=new $.TileSource(tileSource);customTileSource.getTileUrl=tileSource.getTileUrl;successCallback(customTileSource);}else{var $TileSource=$.TileSource.determineType(_this,tileSource);if(!$TileSource){failCallback({message:"Unable to load TileSource",source:tileSource});return;}
var options=$TileSource.prototype.configure.apply(_this,[tileSource]);waitUntilReady(new $TileSource(options),tileSource);}}else{waitUntilReady(tileSource,tileSource);}});}
function getOverlayObject(viewer,overlay){if(overlay instanceof $.Overlay){return overlay;}
var element=null;if(overlay.element){element=$.getElement(overlay.element);}else{var id=overlay.id?overlay.id:"openseadragon-overlay-"+Math.floor(Math.random()*10000000);element=$.getElement(overlay.id);if(!element){element=document.createElement("a");element.href="#/overlay/"+id;}
element.id=id;$.addClass(element,overlay.className?overlay.className:"openseadragon-overlay");}
var location=overlay.location;var width=overlay.width;var height=overlay.height;if(!location){var x=overlay.x;var y=overlay.y;if(overlay.px!==undefined){var rect=viewer.viewport.imageToViewportRectangle(new $.Rect(overlay.px,overlay.py,width||0,height||0));x=rect.x;y=rect.y;width=width!==undefined?rect.width:undefined;height=height!==undefined?rect.height:undefined;}
location=new $.Point(x,y);}
var placement=overlay.placement;if(placement&&$.type(placement)==="string"){placement=$.Placement[overlay.placement.toUpperCase()];}
return new $.Overlay({element:element,location:location,placement:placement,onDraw:overlay.onDraw,checkResize:overlay.checkResize,width:width,height:height,rotationMode:overlay.rotationMode});}
function getOverlayIndex(overlays,element){var i;for(i=overlays.length-1;i>=0;i--){if(overlays[i].element===element){return i;}}
return-1;}
function scheduleUpdate(viewer,updateFunc){return $.requestAnimationFrame(function(){updateFunc(viewer);});}
function scheduleControlsFade(viewer){$.requestAnimationFrame(function(){updateControlsFade(viewer);});}
function beginControlsAutoHide(viewer){if(!viewer.autoHideControls){return;}
viewer.controlsShouldFade=true;viewer.controlsFadeBeginTime=$.now()+
viewer.controlsFadeDelay;window.setTimeout(function(){scheduleControlsFade(viewer);},viewer.controlsFadeDelay);}
function updateControlsFade(viewer){var currentTime,deltaTime,opacity,i;if(viewer.controlsShouldFade){currentTime=$.now();deltaTime=currentTime-viewer.controlsFadeBeginTime;opacity=1.0-deltaTime/viewer.controlsFadeLength;opacity=Math.min(1.0,opacity);opacity=Math.max(0.0,opacity);for(i=viewer.controls.length-1;i>=0;i--){if(viewer.controls[i].autoFade){viewer.controls[i].setOpacity(opacity);}}
if(opacity>0){scheduleControlsFade(viewer);}}}
function abortControlsAutoHide(viewer){var i;viewer.controlsShouldFade=false;for(i=viewer.controls.length-1;i>=0;i--){viewer.controls[i].setOpacity(1.0);}}
function onFocus(){abortControlsAutoHide(this);}
function onBlur(){beginControlsAutoHide(this);}
function onCanvasKeyDown(event){var canvasKeyDownEventArgs={originalEvent:event.originalEvent,preventDefaultAction:event.preventDefaultAction,preventVerticalPan:event.preventVerticalPan,preventHorizontalPan:event.preventHorizontalPan};this.raiseEvent('canvas-key',canvasKeyDownEventArgs);if(!canvasKeyDownEventArgs.preventDefaultAction&&!event.ctrl&&!event.alt&&!event.meta){switch(event.keyCode){case 38:if(!canvasKeyDownEventArgs.preventVerticalPan){if(event.shift){this.viewport.zoomBy(1.1);}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0,-this.pixelsPerArrowPress)));}
this.viewport.applyConstraints();}
return false;case 40:if(!canvasKeyDownEventArgs.preventVerticalPan){if(event.shift){this.viewport.zoomBy(0.9);}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0,this.pixelsPerArrowPress)));}
this.viewport.applyConstraints();}
return false;case 37:if(!canvasKeyDownEventArgs.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(-this.pixelsPerArrowPress,0)));this.viewport.applyConstraints();}
return false;case 39:if(!canvasKeyDownEventArgs.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(this.pixelsPerArrowPress,0)));this.viewport.applyConstraints();}
return false;default:return true;}}else{return true;}}
function onCanvasKeyPress(event){var canvasKeyPressEventArgs={originalEvent:event.originalEvent,preventDefaultAction:event.preventDefaultAction,preventVerticalPan:event.preventVerticalPan,preventHorizontalPan:event.preventHorizontalPan};this.raiseEvent('canvas-key',canvasKeyPressEventArgs);if(!canvasKeyPressEventArgs.preventDefaultAction&&!event.ctrl&&!event.alt&&!event.meta){switch(event.keyCode){case 43:case 61:this.viewport.zoomBy(1.1);this.viewport.applyConstraints();return false;case 45:this.viewport.zoomBy(0.9);this.viewport.applyConstraints();return false;case 48:this.viewport.goHome();this.viewport.applyConstraints();return false;case 119:case 87:if(!canvasKeyPressEventArgs.preventVerticalPan){if(event.shift){this.viewport.zoomBy(1.1);}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0,-40)));}
this.viewport.applyConstraints();}
return false;case 115:case 83:if(!canvasKeyPressEventArgs.preventVerticalPan){if(event.shift){this.viewport.zoomBy(0.9);}else{this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0,40)));}
this.viewport.applyConstraints();}
return false;case 97:if(!canvasKeyPressEventArgs.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(-40,0)));this.viewport.applyConstraints();}
return false;case 100:if(!canvasKeyPressEventArgs.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(40,0)));this.viewport.applyConstraints();}
return false;case 114:if(this.viewport.flipped){this.viewport.setRotation($.positiveModulo(this.viewport.degrees-this.rotationIncrement,360));}else{this.viewport.setRotation($.positiveModulo(this.viewport.degrees+this.rotationIncrement,360));}
this.viewport.applyConstraints();return false;case 82:if(this.viewport.flipped){this.viewport.setRotation($.positiveModulo(this.viewport.degrees+this.rotationIncrement,360));}else{this.viewport.setRotation($.positiveModulo(this.viewport.degrees-this.rotationIncrement,360));}
this.viewport.applyConstraints();return false;case 102:this.viewport.toggleFlip();return false;default:return true;}}else{return true;}}
function onCanvasClick(event){var gestureSettings;var haveKeyboardFocus=document.activeElement==this.canvas;if(!haveKeyboardFocus){this.canvas.focus();}
if(this.viewport.flipped){event.position.x=this.viewport.getContainerSize().x-event.position.x;}
var canvasClickEventArgs={tracker:event.eventSource,position:event.position,quick:event.quick,shift:event.shift,originalEvent:event.originalEvent,preventDefaultAction:event.preventDefaultAction};this.raiseEvent('canvas-click',canvasClickEventArgs);if(!canvasClickEventArgs.preventDefaultAction&&this.viewport&&event.quick){gestureSettings=this.gestureSettingsByDeviceType(event.pointerType);if(gestureSettings.clickToZoom){this.viewport.zoomBy(event.shift?1.0/this.zoomPerClick:this.zoomPerClick,gestureSettings.zoomToRefPoint?this.viewport.pointFromPixel(event.position,true):null);this.viewport.applyConstraints();}}}
function onCanvasDblClick(event){var gestureSettings;var canvasDblClickEventArgs={tracker:event.eventSource,position:event.position,shift:event.shift,originalEvent:event.originalEvent,preventDefaultAction:event.preventDefaultAction};this.raiseEvent('canvas-double-click',canvasDblClickEventArgs);if(!canvasDblClickEventArgs.preventDefaultAction&&this.viewport){gestureSettings=this.gestureSettingsByDeviceType(event.pointerType);if(gestureSettings.dblClickToZoom){this.viewport.zoomBy(event.shift?1.0/this.zoomPerClick:this.zoomPerClick,gestureSettings.zoomToRefPoint?this.viewport.pointFromPixel(event.position,true):null);this.viewport.applyConstraints();}}}
function onCanvasDrag(event){var gestureSettings;var canvasDragEventArgs={tracker:event.eventSource,position:event.position,delta:event.delta,speed:event.speed,direction:event.direction,shift:event.shift,originalEvent:event.originalEvent,preventDefaultAction:event.preventDefaultAction};this.raiseEvent('canvas-drag',canvasDragEventArgs);if(!canvasDragEventArgs.preventDefaultAction&&this.viewport){gestureSettings=this.gestureSettingsByDeviceType(event.pointerType);if(!this.panHorizontal){event.delta.x=0;}
if(!this.panVertical){event.delta.y=0;}
if(this.viewport.flipped){event.delta.x=-event.delta.x;}
if(this.constrainDuringPan){var delta=this.viewport.deltaPointsFromPixels(event.delta.negate());this.viewport.centerSpringX.target.value+=delta.x;this.viewport.centerSpringY.target.value+=delta.y;var bounds=this.viewport.getBounds();var constrainedBounds=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=delta.x;this.viewport.centerSpringY.target.value-=delta.y;if(bounds.x!=constrainedBounds.x){event.delta.x=0;}
if(bounds.y!=constrainedBounds.y){event.delta.y=0;}}
this.viewport.panBy(this.viewport.deltaPointsFromPixels(event.delta.negate()),gestureSettings.flickEnabled&&!this.constrainDuringPan);}}
function onCanvasDragEnd(event){if(!event.preventDefaultAction&&this.viewport){var gestureSettings=this.gestureSettingsByDeviceType(event.pointerType);if(gestureSettings.flickEnabled&&event.speed>=gestureSettings.flickMinSpeed){var amplitudeX=0;if(this.panHorizontal){amplitudeX=gestureSettings.flickMomentum*event.speed*Math.cos(event.direction);}
var amplitudeY=0;if(this.panVertical){amplitudeY=gestureSettings.flickMomentum*event.speed*Math.sin(event.direction);}
var center=this.viewport.pixelFromPoint(this.viewport.getCenter(true));var target=this.viewport.pointFromPixel(new $.Point(center.x-amplitudeX,center.y-amplitudeY));this.viewport.panTo(target,false);}
this.viewport.applyConstraints();}
this.raiseEvent('canvas-drag-end',{tracker:event.eventSource,position:event.position,speed:event.speed,direction:event.direction,shift:event.shift,originalEvent:event.originalEvent});}
function onCanvasEnter(event){this.raiseEvent('canvas-enter',{tracker:event.eventSource,pointerType:event.pointerType,position:event.position,buttons:event.buttons,pointers:event.pointers,insideElementPressed:event.insideElementPressed,buttonDownAny:event.buttonDownAny,originalEvent:event.originalEvent});}
function onCanvasExit(event){if(window.location!=window.parent.location){$.MouseTracker.resetAllMouseTrackers();}
this.raiseEvent('canvas-exit',{tracker:event.eventSource,pointerType:event.pointerType,position:event.position,buttons:event.buttons,pointers:event.pointers,insideElementPressed:event.insideElementPressed,buttonDownAny:event.buttonDownAny,originalEvent:event.originalEvent});}
function onCanvasPress(event){this.raiseEvent('canvas-press',{tracker:event.eventSource,pointerType:event.pointerType,position:event.position,insideElementPressed:event.insideElementPressed,insideElementReleased:event.insideElementReleased,originalEvent:event.originalEvent});}
function onCanvasRelease(event){this.raiseEvent('canvas-release',{tracker:event.eventSource,pointerType:event.pointerType,position:event.position,insideElementPressed:event.insideElementPressed,insideElementReleased:event.insideElementReleased,originalEvent:event.originalEvent});}
function onCanvasNonPrimaryPress(event){this.raiseEvent('canvas-nonprimary-press',{tracker:event.eventSource,position:event.position,pointerType:event.pointerType,button:event.button,buttons:event.buttons,originalEvent:event.originalEvent});}
function onCanvasNonPrimaryRelease(event){this.raiseEvent('canvas-nonprimary-release',{tracker:event.eventSource,position:event.position,pointerType:event.pointerType,button:event.button,buttons:event.buttons,originalEvent:event.originalEvent});}
function onCanvasPinch(event){var gestureSettings,centerPt,lastCenterPt,panByPt;if(!event.preventDefaultAction&&this.viewport){gestureSettings=this.gestureSettingsByDeviceType(event.pointerType);if(gestureSettings.pinchToZoom){centerPt=this.viewport.pointFromPixel(event.center,true);lastCenterPt=this.viewport.pointFromPixel(event.lastCenter,true);panByPt=lastCenterPt.minus(centerPt);if(!this.panHorizontal){panByPt.x=0;}
if(!this.panVertical){panByPt.y=0;}
this.viewport.zoomBy(event.distance/event.lastDistance,centerPt,true);if(gestureSettings.zoomToRefPoint){this.viewport.panBy(panByPt,true);}
this.viewport.applyConstraints();}
if(gestureSettings.pinchRotate){var angle1=Math.atan2(event.gesturePoints[0].currentPos.y-event.gesturePoints[1].currentPos.y,event.gesturePoints[0].currentPos.x-event.gesturePoints[1].currentPos.x);var angle2=Math.atan2(event.gesturePoints[0].lastPos.y-event.gesturePoints[1].lastPos.y,event.gesturePoints[0].lastPos.x-event.gesturePoints[1].lastPos.x);this.viewport.setRotation(this.viewport.getRotation()+((angle1-angle2)*(180/Math.PI)));}}
this.raiseEvent('canvas-pinch',{tracker:event.eventSource,gesturePoints:event.gesturePoints,lastCenter:event.lastCenter,center:event.center,lastDistance:event.lastDistance,distance:event.distance,shift:event.shift,originalEvent:event.originalEvent});return false;}
function onCanvasScroll(event){var gestureSettings,factor,thisScrollTime,deltaScrollTime;thisScrollTime=$.now();deltaScrollTime=thisScrollTime-this._lastScrollTime;if(deltaScrollTime>this.minScrollDeltaTime){this._lastScrollTime=thisScrollTime;if(this.viewport.flipped){event.position.x=this.viewport.getContainerSize().x-event.position.x;}
if(!event.preventDefaultAction&&this.viewport){gestureSettings=this.gestureSettingsByDeviceType(event.pointerType);if(gestureSettings.scrollToZoom){factor=Math.pow(this.zoomPerScroll,event.scroll);this.viewport.zoomBy(factor,gestureSettings.zoomToRefPoint?this.viewport.pointFromPixel(event.position,true):null);this.viewport.applyConstraints();}}
this.raiseEvent('canvas-scroll',{tracker:event.eventSource,position:event.position,scroll:event.scroll,shift:event.shift,originalEvent:event.originalEvent});if(gestureSettings&&gestureSettings.scrollToZoom){return false;}}
else{gestureSettings=this.gestureSettingsByDeviceType(event.pointerType);if(gestureSettings&&gestureSettings.scrollToZoom){return false;}}}
function onContainerEnter(event){THIS[this.hash].mouseInside=true;abortControlsAutoHide(this);this.raiseEvent('container-enter',{tracker:event.eventSource,position:event.position,buttons:event.buttons,pointers:event.pointers,insideElementPressed:event.insideElementPressed,buttonDownAny:event.buttonDownAny,originalEvent:event.originalEvent});}
function onContainerExit(event){if(event.pointers<1){THIS[this.hash].mouseInside=false;if(!THIS[this.hash].animating){beginControlsAutoHide(this);}}
this.raiseEvent('container-exit',{tracker:event.eventSource,position:event.position,buttons:event.buttons,pointers:event.pointers,insideElementPressed:event.insideElementPressed,buttonDownAny:event.buttonDownAny,originalEvent:event.originalEvent});}
function updateMulti(viewer){updateOnce(viewer);if(viewer.isOpen()){viewer._updateRequestId=scheduleUpdate(viewer,updateMulti);}else{viewer._updateRequestId=false;}}
function updateOnce(viewer){if(viewer._opening){return;}
if(viewer.autoResize){var containerSize=_getSafeElemSize(viewer.container);var prevContainerSize=THIS[viewer.hash].prevContainerSize;if(!containerSize.equals(prevContainerSize)){var viewport=viewer.viewport;if(viewer.preserveImageSizeOnResize){var resizeRatio=prevContainerSize.x/containerSize.x;var zoom=viewport.getZoom()*resizeRatio;var center=viewport.getCenter();viewport.resize(containerSize,false);viewport.zoomTo(zoom,null,true);viewport.panTo(center,true);}else{var oldBounds=viewport.getBounds();viewport.resize(containerSize,true);viewport.fitBoundsWithConstraints(oldBounds,true);}
THIS[viewer.hash].prevContainerSize=containerSize;THIS[viewer.hash].forceRedraw=true;}}
var viewportChange=viewer.viewport.update();var animated=viewer.world.update()||viewportChange;if(viewportChange){viewer.raiseEvent('viewport-change');}
if(viewer.referenceStrip){animated=viewer.referenceStrip.update(viewer.viewport)||animated;}
if(!THIS[viewer.hash].animating&&animated){viewer.raiseEvent("animation-start");abortControlsAutoHide(viewer);}
if(animated||THIS[viewer.hash].forceRedraw||viewer.world.needsDraw()){drawWorld(viewer);viewer._drawOverlays();if(viewer.navigator){viewer.navigator.update(viewer.viewport);}
THIS[viewer.hash].forceRedraw=false;if(animated){viewer.raiseEvent("animation");}}
if(THIS[viewer.hash].animating&&!animated){viewer.raiseEvent("animation-finish");if(!THIS[viewer.hash].mouseInside){beginControlsAutoHide(viewer);}}
THIS[viewer.hash].animating=animated;}
function drawWorld(viewer){viewer.imageLoader.clear();viewer.drawer.clear();viewer.world.draw();viewer.raiseEvent('update-viewport',{});}
function resolveUrl(prefix,url){return prefix?prefix+url:url;}
function beginZoomingIn(){THIS[this.hash].lastZoomTime=$.now();THIS[this.hash].zoomFactor=this.zoomPerSecond;THIS[this.hash].zooming=true;scheduleZoom(this);}
function beginZoomingOut(){THIS[this.hash].lastZoomTime=$.now();THIS[this.hash].zoomFactor=1.0/this.zoomPerSecond;THIS[this.hash].zooming=true;scheduleZoom(this);}
function endZooming(){THIS[this.hash].zooming=false;}
function scheduleZoom(viewer){$.requestAnimationFrame($.delegate(viewer,doZoom));}
function doZoom(){var currentTime,deltaTime,adjustedFactor;if(THIS[this.hash].zooming&&this.viewport){currentTime=$.now();deltaTime=currentTime-THIS[this.hash].lastZoomTime;adjustedFactor=Math.pow(THIS[this.hash].zoomFactor,deltaTime/1000);this.viewport.zoomBy(adjustedFactor);this.viewport.applyConstraints();THIS[this.hash].lastZoomTime=currentTime;scheduleZoom(this);}}
function doSingleZoomIn(){if(this.viewport){THIS[this.hash].zooming=false;this.viewport.zoomBy(this.zoomPerClick/1.0);this.viewport.applyConstraints();}}
function doSingleZoomOut(){if(this.viewport){THIS[this.hash].zooming=false;this.viewport.zoomBy(1.0/this.zoomPerClick);this.viewport.applyConstraints();}}
function lightUp(){this.buttons.emulateEnter();this.buttons.emulateExit();}
function onHome(){if(this.viewport){this.viewport.goHome();}}
function onFullScreen(){if(this.isFullPage()&&!$.isFullScreen()){this.setFullPage(false);}else{this.setFullScreen(!this.isFullPage());}
if(this.buttons){this.buttons.emulateExit();}
this.fullPageButton.element.focus();if(this.viewport){this.viewport.applyConstraints();}}
function onRotateLeft(){if(this.viewport){var currRotation=this.viewport.getRotation();if(this.viewport.flipped){currRotation=$.positiveModulo(currRotation+this.rotationIncrement,360);}else{currRotation=$.positiveModulo(currRotation-this.rotationIncrement,360);}
this.viewport.setRotation(currRotation);}}
function onRotateRight(){if(this.viewport){var currRotation=this.viewport.getRotation();if(this.viewport.flipped){currRotation=$.positiveModulo(currRotation-this.rotationIncrement,360);}else{currRotation=$.positiveModulo(currRotation+this.rotationIncrement,360);}
this.viewport.setRotation(currRotation);}}
function onFlip(){this.viewport.toggleFlip();}
function onPrevious(){var previous=this._sequenceIndex-1;if(this.navPrevNextWrap&&previous<0){previous+=this.tileSources.length;}
this.goToPage(previous);}
function onNext(){var next=this._sequenceIndex+1;if(this.navPrevNextWrap&&next>=this.tileSources.length){next=0;}
this.goToPage(next);}}(OpenSeadragon));(function($){$.Navigator=function(options){var viewer=options.viewer,_this=this,viewerSize,navigatorSize;if(!options.id){options.id='navigator-'+$.now();this.element=$.makeNeutralElement("div");options.controlOptions={anchor:$.ControlAnchor.TOP_RIGHT,attachToViewer:true,autoFade:options.autoFade};if(options.position){if('BOTTOM_RIGHT'==options.position){options.controlOptions.anchor=$.ControlAnchor.BOTTOM_RIGHT;}else if('BOTTOM_LEFT'==options.position){options.controlOptions.anchor=$.ControlAnchor.BOTTOM_LEFT;}else if('TOP_RIGHT'==options.position){options.controlOptions.anchor=$.ControlAnchor.TOP_RIGHT;}else if('TOP_LEFT'==options.position){options.controlOptions.anchor=$.ControlAnchor.TOP_LEFT;}else if('ABSOLUTE'==options.position){options.controlOptions.anchor=$.ControlAnchor.ABSOLUTE;options.controlOptions.top=options.top;options.controlOptions.left=options.left;options.controlOptions.height=options.height;options.controlOptions.width=options.width;}}}else{this.element=document.getElementById(options.id);options.controlOptions={anchor:$.ControlAnchor.NONE,attachToViewer:false,autoFade:false};}
this.element.id=options.id;this.element.className+=' navigator';options=$.extend(true,{sizeRatio:$.DEFAULT_SETTINGS.navigatorSizeRatio},options,{element:this.element,tabIndex:-1,showNavigator:false,mouseNavEnabled:false,showNavigationControl:false,showSequenceControl:false,immediateRender:true,blendTime:0,animationTime:0,autoResize:options.autoResize,minZoomImageRatio:1.0,background:options.background,opacity:options.opacity,borderColor:options.borderColor,displayRegionColor:options.displayRegionColor});options.minPixelRatio=this.minPixelRatio=viewer.minPixelRatio;$.setElementTouchActionNone(this.element);this.borderWidth=2;this.fudge=new $.Point(1,1);this.totalBorderWidths=new $.Point(this.borderWidth*2,this.borderWidth*2).minus(this.fudge);if(options.controlOptions.anchor!=$.ControlAnchor.NONE){(function(style,borderWidth){style.margin='0px';style.border=borderWidth+'px solid '+options.borderColor;style.padding='0px';style.background=options.background;style.opacity=options.opacity;style.overflow='hidden';}(this.element.style,this.borderWidth));}
this.displayRegion=$.makeNeutralElement("div");this.displayRegion.id=this.element.id+'-displayregion';this.displayRegion.className='displayregion';(function(style,borderWidth){style.position='relative';style.top='0px';style.left='0px';style.fontSize='0px';style.overflow='hidden';style.border=borderWidth+'px solid '+options.displayRegionColor;style.margin='0px';style.padding='0px';style.background='transparent';style['float']='left';style.cssFloat='left';style.styleFloat='left';style.zIndex=999999999;style.cursor='default';}(this.displayRegion.style,this.borderWidth));this.displayRegionContainer=$.makeNeutralElement("div");this.displayRegionContainer.id=this.element.id+'-displayregioncontainer';this.displayRegionContainer.className="displayregioncontainer";this.displayRegionContainer.style.width="100%";this.displayRegionContainer.style.height="100%";viewer.addControl(this.element,options.controlOptions);this._resizeWithViewer=options.controlOptions.anchor!=$.ControlAnchor.ABSOLUTE&&options.controlOptions.anchor!=$.ControlAnchor.NONE;if(options.width&&options.height){this.setWidth(options.width);this.setHeight(options.height);}else if(this._resizeWithViewer){viewerSize=$.getElementSize(viewer.element);this.element.style.height=Math.round(viewerSize.y*options.sizeRatio)+'px';this.element.style.width=Math.round(viewerSize.x*options.sizeRatio)+'px';this.oldViewerSize=viewerSize;navigatorSize=$.getElementSize(this.element);this.elementArea=navigatorSize.x*navigatorSize.y;}
this.oldContainerSize=new $.Point(0,0);$.Viewer.apply(this,[options]);this.displayRegionContainer.appendChild(this.displayRegion);this.element.getElementsByTagName('div')[0].appendChild(this.displayRegionContainer);function rotate(degrees){_setTransformRotate(_this.displayRegionContainer,degrees);_setTransformRotate(_this.displayRegion,-degrees);_this.viewport.setRotation(degrees);}
if(options.navigatorRotate){var degrees=options.viewer.viewport?options.viewer.viewport.getRotation():options.viewer.degrees||0;rotate(degrees);options.viewer.addHandler("rotate",function(args){rotate(args.degrees);});}
this.innerTracker.destroy();this.innerTracker=new $.MouseTracker({element:this.element,dragHandler:$.delegate(this,onCanvasDrag),clickHandler:$.delegate(this,onCanvasClick),releaseHandler:$.delegate(this,onCanvasRelease),scrollHandler:$.delegate(this,onCanvasScroll)});this.addHandler("reset-size",function(){if(_this.viewport){_this.viewport.goHome(true);}});viewer.world.addHandler("item-index-change",function(event){window.setTimeout(function(){var item=_this.world.getItemAt(event.previousIndex);_this.world.setItemIndex(item,event.newIndex);},1);});viewer.world.addHandler("remove-item",function(event){var theirItem=event.item;var myItem=_this._getMatchingItem(theirItem);if(myItem){_this.world.removeItem(myItem);}});this.update(viewer.viewport);};$.extend($.Navigator.prototype,$.EventSource.prototype,$.Viewer.prototype,{updateSize:function(){if(this.viewport){var containerSize=new $.Point((this.container.clientWidth===0?1:this.container.clientWidth),(this.container.clientHeight===0?1:this.container.clientHeight));if(!containerSize.equals(this.oldContainerSize)){this.viewport.resize(containerSize,true);this.viewport.goHome(true);this.oldContainerSize=containerSize;this.drawer.clear();this.world.draw();}}},setWidth:function(width){this.width=width;this.element.style.width=typeof(width)=="number"?(width+'px'):width;this._resizeWithViewer=false;},setHeight:function(height){this.height=height;this.element.style.height=typeof(height)=="number"?(height+'px'):height;this._resizeWithViewer=false;},setFlip:function(state){this.viewport.setFlip(state);this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)");return this;},setDisplayTransform:function(rule){setElementTransform(this.displayRegion,rule);setElementTransform(this.canvas,rule);setElementTransform(this.element,rule);},update:function(viewport){var viewerSize,newWidth,newHeight,bounds,topleft,bottomright;viewerSize=$.getElementSize(this.viewer.element);if(this._resizeWithViewer&&viewerSize.x&&viewerSize.y&&!viewerSize.equals(this.oldViewerSize)){this.oldViewerSize=viewerSize;if(this.maintainSizeRatio||!this.elementArea){newWidth=viewerSize.x*this.sizeRatio;newHeight=viewerSize.y*this.sizeRatio;}else{newWidth=Math.sqrt(this.elementArea*(viewerSize.x/viewerSize.y));newHeight=this.elementArea/newWidth;}
this.element.style.width=Math.round(newWidth)+'px';this.element.style.height=Math.round(newHeight)+'px';if(!this.elementArea){this.elementArea=newWidth*newHeight;}
this.updateSize();}
if(viewport&&this.viewport){bounds=viewport.getBoundsNoRotate(true);topleft=this.viewport.pixelFromPointNoRotate(bounds.getTopLeft(),false);bottomright=this.viewport.pixelFromPointNoRotate(bounds.getBottomRight(),false).minus(this.totalBorderWidths);var style=this.displayRegion.style;style.display=this.world.getItemCount()?'block':'none';style.top=Math.round(topleft.y)+'px';style.left=Math.round(topleft.x)+'px';var width=Math.abs(topleft.x-bottomright.x);var height=Math.abs(topleft.y-bottomright.y);style.width=Math.round(Math.max(width,0))+'px';style.height=Math.round(Math.max(height,0))+'px';}},addTiledImage:function(options){var _this=this;var original=options.originalTiledImage;delete options.original;var optionsClone=$.extend({},options,{success:function(event){var myItem=event.item;myItem._originalForNavigator=original;_this._matchBounds(myItem,original,true);function matchBounds(){_this._matchBounds(myItem,original);}
function matchOpacity(){_this._matchOpacity(myItem,original);}
function matchCompositeOperation(){_this._matchCompositeOperation(myItem,original);}
original.addHandler('bounds-change',matchBounds);original.addHandler('clip-change',matchBounds);original.addHandler('opacity-change',matchOpacity);original.addHandler('composite-operation-change',matchCompositeOperation);}});return $.Viewer.prototype.addTiledImage.apply(this,[optionsClone]);},_getMatchingItem:function(theirItem){var count=this.world.getItemCount();var item;for(var i=0;i<count;i++){item=this.world.getItemAt(i);if(item._originalForNavigator===theirItem){return item;}}
return null;},_matchBounds:function(myItem,theirItem,immediately){var bounds=theirItem.getBoundsNoRotate();myItem.setPosition(bounds.getTopLeft(),immediately);myItem.setWidth(bounds.width,immediately);myItem.setRotation(theirItem.getRotation(),immediately);myItem.setClip(theirItem.getClip());},_matchOpacity:function(myItem,theirItem){myItem.setOpacity(theirItem.opacity);},_matchCompositeOperation:function(myItem,theirItem){myItem.setCompositeOperation(theirItem.compositeOperation);}});function onCanvasClick(event){var canvasClickEventArgs={tracker:event.eventSource,position:event.position,quick:event.quick,shift:event.shift,originalEvent:event.originalEvent,preventDefaultAction:event.preventDefaultAction};this.viewer.raiseEvent('navigator-click',canvasClickEventArgs);if(!canvasClickEventArgs.preventDefaultAction&&event.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){if(this.viewer.viewport.flipped){event.position.x=this.viewport.getContainerSize().x-event.position.x;}
var target=this.viewport.pointFromPixel(event.position);if(!this.panVertical){target.y=this.viewer.viewport.getCenter(true).y;}else if(!this.panHorizontal){target.x=this.viewer.viewport.getCenter(true).x;}
this.viewer.viewport.panTo(target);this.viewer.viewport.applyConstraints();}}
function onCanvasDrag(event){var canvasDragEventArgs={tracker:event.eventSource,position:event.position,delta:event.delta,speed:event.speed,direction:event.direction,shift:event.shift,originalEvent:event.originalEvent,preventDefaultAction:event.preventDefaultAction};this.viewer.raiseEvent('navigator-drag',canvasDragEventArgs);if(!canvasDragEventArgs.preventDefaultAction&&this.viewer.viewport){if(!this.panHorizontal){event.delta.x=0;}
if(!this.panVertical){event.delta.y=0;}
if(this.viewer.viewport.flipped){event.delta.x=-event.delta.x;}
this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(event.delta));if(this.viewer.constrainDuringPan){this.viewer.viewport.applyConstraints();}}}
function onCanvasRelease(event){if(event.insideElementPressed&&this.viewer.viewport){this.viewer.viewport.applyConstraints();}}
function onCanvasScroll(event){this.viewer.raiseEvent('navigator-scroll',{tracker:event.eventSource,position:event.position,scroll:event.scroll,shift:event.shift,originalEvent:event.originalEvent});return false;}
function _setTransformRotate(element,degrees){setElementTransform(element,"rotate("+degrees+"deg)");}
function setElementTransform(element,rule){element.style.webkitTransform=rule;element.style.mozTransform=rule;element.style.msTransform=rule;element.style.oTransform=rule;element.style.transform=rule;}}(OpenSeadragon));(function($){var I18N={Errors:{Dzc:"Sorry, we don't support Deep Zoom Collections!",Dzi:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",Xml:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",ImageFormat:"Sorry, we don't support {0}-based Deep Zoom Images.",Security:"It looks like a security restriction stopped us from "+"loading this Deep Zoom Image.",Status:"This space unintentionally left blank ({0} {1}).",OpenFailed:"Unable to open {0}: {1}"},Tooltips:{FullPage:"Toggle full page",Home:"Go home",ZoomIn:"Zoom in",ZoomOut:"Zoom out",NextPage:"Next page",PreviousPage:"Previous page",RotateLeft:"Rotate left",RotateRight:"Rotate right",Flip:"Flip Horizontally"}};$.extend($,{getString:function(prop){var props=prop.split('.'),string=null,args=arguments,container=I18N,i;for(i=0;i<props.length-1;i++){container=container[props[i]]||{};}
string=container[props[i]];if(typeof(string)!="string"){$.console.log("Untranslated source string:",prop);string="";}
return string.replace(/\{\d+\}/g,function(capture){var i=parseInt(capture.match(/\d+/),10)+1;return i<args.length?args[i]:"";});},setString:function(prop,value){var props=prop.split('.'),container=I18N,i;for(i=0;i<props.length-1;i++){if(!container[props[i]]){container[props[i]]={};}
container=container[props[i]];}
container[props[i]]=value;}});}(OpenSeadragon));(function($){$.Point=function(x,y){this.x=typeof(x)=="number"?x:0;this.y=typeof(y)=="number"?y:0;};$.Point.prototype={clone:function(){return new $.Point(this.x,this.y);},plus:function(point){return new $.Point(this.x+point.x,this.y+point.y);},minus:function(point){return new $.Point(this.x-point.x,this.y-point.y);},times:function(factor){return new $.Point(this.x*factor,this.y*factor);},divide:function(factor){return new $.Point(this.x/factor,this.y/factor);},negate:function(){return new $.Point(-this.x,-this.y);},distanceTo:function(point){return Math.sqrt(Math.pow(this.x-point.x,2)+
Math.pow(this.y-point.y,2));},squaredDistanceTo:function(point){return Math.pow(this.x-point.x,2)+
Math.pow(this.y-point.y,2);},apply:function(func){return new $.Point(func(this.x),func(this.y));},equals:function(point){return(point instanceof $.Point)&&(this.x===point.x)&&(this.y===point.y);},rotate:function(degrees,pivot){pivot=pivot||new $.Point(0,0);var cos;var sin;if(degrees%90===0){var d=$.positiveModulo(degrees,360);switch(d){case 0:cos=1;sin=0;break;case 90:cos=0;sin=1;break;case 180:cos=-1;sin=0;break;case 270:cos=0;sin=-1;break;}}else{var angle=degrees*Math.PI/180.0;cos=Math.cos(angle);sin=Math.sin(angle);}
var x=cos*(this.x-pivot.x)-sin*(this.y-pivot.y)+pivot.x;var y=sin*(this.x-pivot.x)+cos*(this.y-pivot.y)+pivot.y;return new $.Point(x,y);},toString:function(){return"("+(Math.round(this.x*100)/100)+","+(Math.round(this.y*100)/100)+")";}};}(OpenSeadragon));(function($){$.TileSource=function(width,height,tileSize,tileOverlap,minLevel,maxLevel){var _this=this;var args=arguments,options,i;if($.isPlainObject(width)){options=width;}else{options={width:args[0],height:args[1],tileSize:args[2],tileOverlap:args[3],minLevel:args[4],maxLevel:args[5]};}
$.EventSource.call(this);$.extend(true,this,options);if(!this.success){for(i=0;i<arguments.length;i++){if($.isFunction(arguments[i])){this.success=arguments[i];break;}}}
if(this.success){this.addHandler('ready',function(event){_this.success(event);});}
if('string'==$.type(arguments[0])){this.url=arguments[0];}
if(this.url){this.aspectRatio=1;this.dimensions=new $.Point(10,10);this._tileWidth=0;this._tileHeight=0;this.tileOverlap=0;this.minLevel=0;this.maxLevel=0;this.ready=false;this.getImageInfo(this.url);}else{this.ready=true;this.aspectRatio=(options.width&&options.height)?(options.width/options.height):1;this.dimensions=new $.Point(options.width,options.height);if(this.tileSize){this._tileWidth=this._tileHeight=this.tileSize;delete this.tileSize;}else{if(this.tileWidth){this._tileWidth=this.tileWidth;delete this.tileWidth;}else{this._tileWidth=0;}
if(this.tileHeight){this._tileHeight=this.tileHeight;delete this.tileHeight;}else{this._tileHeight=0;}}
this.tileOverlap=options.tileOverlap?options.tileOverlap:0;this.minLevel=options.minLevel?options.minLevel:0;this.maxLevel=(undefined!==options.maxLevel&&null!==options.maxLevel)?options.maxLevel:((options.width&&options.height)?Math.ceil(Math.log(Math.max(options.width,options.height))/Math.log(2)):0);if(this.success&&$.isFunction(this.success)){this.success(this);}}};$.TileSource.prototype={getTileSize:function(level){$.console.error("[TileSource.getTileSize] is deprecated. "+"Use TileSource.getTileWidth() and TileSource.getTileHeight() instead");return this._tileWidth;},getTileWidth:function(level){if(!this._tileWidth){return this.getTileSize(level);}
return this._tileWidth;},getTileHeight:function(level){if(!this._tileHeight){return this.getTileSize(level);}
return this._tileHeight;},getLevelScale:function(level){var levelScaleCache={},i;for(i=0;i<=this.maxLevel;i++){levelScaleCache[i]=1/Math.pow(2,this.maxLevel-i);}
this.getLevelScale=function(_level){return levelScaleCache[_level];};return this.getLevelScale(level);},getNumTiles:function(level){var scale=this.getLevelScale(level),x=Math.ceil(scale*this.dimensions.x/this.getTileWidth(level)),y=Math.ceil(scale*this.dimensions.y/this.getTileHeight(level));return new $.Point(x,y);},getPixelRatio:function(level){var imageSizeScaled=this.dimensions.times(this.getLevelScale(level)),rx=1.0/imageSizeScaled.x,ry=1.0/imageSizeScaled.y;return new $.Point(rx,ry);},getClosestLevel:function(){var i,tiles;for(i=this.minLevel+1;i<=this.maxLevel;i++){tiles=this.getNumTiles(i);if(tiles.x>1||tiles.y>1){break;}}
return i-1;},getTileAtPoint:function(level,point){var validPoint=point.x>=0&&point.x<=1&&point.y>=0&&point.y<=1/this.aspectRatio;$.console.assert(validPoint,"[TileSource.getTileAtPoint] must be called with a valid point.");var widthScaled=this.dimensions.x*this.getLevelScale(level);var pixelX=point.x*widthScaled;var pixelY=point.y*widthScaled;var x=Math.floor(pixelX/this.getTileWidth(level));var y=Math.floor(pixelY/this.getTileHeight(level));if(point.x>=1){x=this.getNumTiles(level).x-1;}
var EPSILON=1e-15;if(point.y>=1/this.aspectRatio-EPSILON){y=this.getNumTiles(level).y-1;}
return new $.Point(x,y);},getTileBounds:function(level,x,y,isSource){var dimensionsScaled=this.dimensions.times(this.getLevelScale(level)),tileWidth=this.getTileWidth(level),tileHeight=this.getTileHeight(level),px=(x===0)?0:tileWidth*x-this.tileOverlap,py=(y===0)?0:tileHeight*y-this.tileOverlap,sx=tileWidth+(x===0?1:2)*this.tileOverlap,sy=tileHeight+(y===0?1:2)*this.tileOverlap,scale=1.0/dimensionsScaled.x;sx=Math.min(sx,dimensionsScaled.x-px);sy=Math.min(sy,dimensionsScaled.y-py);if(isSource){return new $.Rect(0,0,sx,sy);}
return new $.Rect(px*scale,py*scale,sx*scale,sy*scale);},getImageInfo:function(url){var _this=this,callbackName,callback,readySource,options,urlParts,filename,lastDot;if(url){urlParts=url.split('/');filename=urlParts[urlParts.length-1];lastDot=filename.lastIndexOf('.');if(lastDot>-1){urlParts[urlParts.length-1]=filename.slice(0,lastDot);}}
callback=function(data){if(typeof(data)==="string"){data=$.parseXml(data);}
var $TileSource=$.TileSource.determineType(_this,data,url);if(!$TileSource){_this.raiseEvent('open-failed',{message:"Unable to load TileSource",source:url});return;}
options=$TileSource.prototype.configure.apply(_this,[data,url]);if(options.ajaxWithCredentials===undefined){options.ajaxWithCredentials=_this.ajaxWithCredentials;}
readySource=new $TileSource(options);_this.ready=true;_this.raiseEvent('ready',{tileSource:readySource});};if(url.match(/\.js$/)){callbackName=url.split('/').pop().replace('.js','');$.jsonp({url:url,async:false,callbackName:callbackName,callback:callback});}else{$.makeAjaxRequest({url:url,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(xhr){var data=processResponse(xhr);callback(data);},error:function(xhr,exc){var msg;try{msg="HTTP "+xhr.status+" attempting to load TileSource";}catch(e){var formattedExc;if(typeof(exc)=="undefined"||!exc.toString){formattedExc="Unknown error";}else{formattedExc=exc.toString();}
msg=formattedExc+" attempting to load TileSource";}
_this.raiseEvent('open-failed',{message:msg,source:url});}});}},supports:function(data,url){return false;},configure:function(data,url){throw new Error("Method not implemented.");},getTileUrl:function(level,x,y){throw new Error("Method not implemented.");},getTileAjaxHeaders:function(level,x,y){return{};},tileExists:function(level,x,y){var numTiles=this.getNumTiles(level);return level>=this.minLevel&&level<=this.maxLevel&&x>=0&&y>=0&&x<numTiles.x&&y<numTiles.y;}};$.extend(true,$.TileSource.prototype,$.EventSource.prototype);function processResponse(xhr){var responseText=xhr.responseText,status=xhr.status,statusText,data;if(!xhr){throw new Error($.getString("Errors.Security"));}else if(xhr.status!==200&&xhr.status!==0){status=xhr.status;statusText=(status==404)?"Not Found":xhr.statusText;throw new Error($.getString("Errors.Status",status,statusText));}
if(responseText.match(/\s*<.*/)){try{data=(xhr.responseXML&&xhr.responseXML.documentElement)?xhr.responseXML:$.parseXml(responseText);}catch(e){data=xhr.responseText;}}else if(responseText.match(/\s*[\{\[].*/)){try{data=$.parseJSON(responseText);}catch(e){data=responseText;}}else{data=responseText;}
return data;}
$.TileSource.determineType=function(tileSource,data,url){var property;for(property in OpenSeadragon){if(property.match(/.+TileSource$/)&&$.isFunction(OpenSeadragon[property])&&$.isFunction(OpenSeadragon[property].prototype.supports)&&OpenSeadragon[property].prototype.supports.call(tileSource,data,url)){return OpenSeadragon[property];}}
$.console.error("No TileSource was able to open %s %s",url,data);};}(OpenSeadragon));(function($){$.DziTileSource=function(width,height,tileSize,tileOverlap,tilesUrl,fileFormat,displayRects,minLevel,maxLevel){var i,rect,level,options;if($.isPlainObject(width)){options=width;}else{options={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4],fileFormat:arguments[5],displayRects:arguments[6],minLevel:arguments[7],maxLevel:arguments[8]};}
this._levelRects={};this.tilesUrl=options.tilesUrl;this.fileFormat=options.fileFormat;this.displayRects=options.displayRects;if(this.displayRects){for(i=this.displayRects.length-1;i>=0;i--){rect=this.displayRects[i];for(level=rect.minLevel;level<=rect.maxLevel;level++){if(!this._levelRects[level]){this._levelRects[level]=[];}
this._levelRects[level].push(rect);}}}
$.TileSource.apply(this,[options]);};$.extend($.DziTileSource.prototype,$.TileSource.prototype,{supports:function(data,url){var ns;if(data.Image){ns=data.Image.xmlns;}else if(data.documentElement){if("Image"==data.documentElement.localName||"Image"==data.documentElement.tagName){ns=data.documentElement.namespaceURI;}}
ns=(ns||'').toLowerCase();return(ns.indexOf('schemas.microsoft.com/deepzoom/2008')!==-1||ns.indexOf('schemas.microsoft.com/deepzoom/2009')!==-1);},configure:function(data,url){var options;if(!$.isPlainObject(data)){options=configureFromXML(this,data);}else{options=configureFromObject(this,data);}
if(url&&!options.tilesUrl){options.tilesUrl=url.replace(/([^\/]+?)(\.(dzi|xml|js)?(\?[^\/]*)?)?\/?$/,'$1_files/');if(url.search(/\.(dzi|xml|js)\?/)!=-1){options.queryParams=url.match(/\?.*/);}else{options.queryParams='';}}
return options;},getTileUrl:function(level,x,y){return[this.tilesUrl,level,'/',x,'_',y,'.',this.fileFormat,this.queryParams].join('');},tileExists:function(level,x,y){var rects=this._levelRects[level],rect,scale,xMin,yMin,xMax,yMax,i;if((this.minLevel&&level<this.minLevel)||(this.maxLevel&&level>this.maxLevel)){return false;}
if(!rects||!rects.length){return true;}
for(i=rects.length-1;i>=0;i--){rect=rects[i];if(level<rect.minLevel||level>rect.maxLevel){continue;}
scale=this.getLevelScale(level);xMin=rect.x*scale;yMin=rect.y*scale;xMax=xMin+rect.width*scale;yMax=yMin+rect.height*scale;xMin=Math.floor(xMin/this._tileWidth);yMin=Math.floor(yMin/this._tileWidth);xMax=Math.ceil(xMax/this._tileWidth);yMax=Math.ceil(yMax/this._tileWidth);if(xMin<=x&&x<xMax&&yMin<=y&&y<yMax){return true;}}
return false;}});function configureFromXML(tileSource,xmlDoc){if(!xmlDoc||!xmlDoc.documentElement){throw new Error($.getString("Errors.Xml"));}
var root=xmlDoc.documentElement,rootName=root.localName||root.tagName,ns=xmlDoc.documentElement.namespaceURI,configuration=null,displayRects=[],dispRectNodes,dispRectNode,rectNode,sizeNode,i;if(rootName=="Image"){try{sizeNode=root.getElementsByTagName("Size")[0];if(sizeNode===undefined){sizeNode=root.getElementsByTagNameNS(ns,"Size")[0];}
configuration={Image:{xmlns:"http://schemas.microsoft.com/deepzoom/2008",Url:root.getAttribute("Url"),Format:root.getAttribute("Format"),DisplayRect:null,Overlap:parseInt(root.getAttribute("Overlap"),10),TileSize:parseInt(root.getAttribute("TileSize"),10),Size:{Height:parseInt(sizeNode.getAttribute("Height"),10),Width:parseInt(sizeNode.getAttribute("Width"),10)}}};if(!$.imageFormatSupported(configuration.Image.Format)){throw new Error($.getString("Errors.ImageFormat",configuration.Image.Format.toUpperCase()));}
dispRectNodes=root.getElementsByTagName("DisplayRect");if(dispRectNodes===undefined){dispRectNodes=root.getElementsByTagNameNS(ns,"DisplayRect")[0];}
for(i=0;i<dispRectNodes.length;i++){dispRectNode=dispRectNodes[i];rectNode=dispRectNode.getElementsByTagName("Rect")[0];if(rectNode===undefined){rectNode=dispRectNode.getElementsByTagNameNS(ns,"Rect")[0];}
displayRects.push({Rect:{X:parseInt(rectNode.getAttribute("X"),10),Y:parseInt(rectNode.getAttribute("Y"),10),Width:parseInt(rectNode.getAttribute("Width"),10),Height:parseInt(rectNode.getAttribute("Height"),10),MinLevel:parseInt(dispRectNode.getAttribute("MinLevel"),10),MaxLevel:parseInt(dispRectNode.getAttribute("MaxLevel"),10)}});}
if(displayRects.length){configuration.Image.DisplayRect=displayRects;}
return configureFromObject(tileSource,configuration);}catch(e){throw(e instanceof Error)?e:new Error($.getString("Errors.Dzi"));}}else if(rootName=="Collection"){throw new Error($.getString("Errors.Dzc"));}else if(rootName=="Error"){var messageNode=root.getElementsByTagName("Message")[0];var message=messageNode.firstChild.nodeValue;throw new Error(message);}
throw new Error($.getString("Errors.Dzi"));}
function configureFromObject(tileSource,configuration){var imageData=configuration.Image,tilesUrl=imageData.Url,fileFormat=imageData.Format,sizeData=imageData.Size,dispRectData=imageData.DisplayRect||[],width=parseInt(sizeData.Width,10),height=parseInt(sizeData.Height,10),tileSize=parseInt(imageData.TileSize,10),tileOverlap=parseInt(imageData.Overlap,10),displayRects=[],rectData,i;for(i=0;i<dispRectData.length;i++){rectData=dispRectData[i].Rect;displayRects.push(new $.DisplayRect(parseInt(rectData.X,10),parseInt(rectData.Y,10),parseInt(rectData.Width,10),parseInt(rectData.Height,10),parseInt(rectData.MinLevel,10),parseInt(rectData.MaxLevel,10)));}
return $.extend(true,{width:width,height:height,tileSize:tileSize,tileOverlap:tileOverlap,minLevel:null,maxLevel:null,tilesUrl:tilesUrl,fileFormat:fileFormat,displayRects:displayRects},configuration);}}(OpenSeadragon));(function($){$.IIIFTileSource=function(options){$.extend(true,this,options);if(!(this.height&&this.width&&this['@id'])){throw new Error('IIIF required parameters not provided.');}
options.tileSizePerScaleFactor={};this.tileFormat=this.tileFormat||'jpg';this.version=options.version;if(this.tile_width&&this.tile_height){options.tileWidth=this.tile_width;options.tileHeight=this.tile_height;}else if(this.tile_width){options.tileSize=this.tile_width;}else if(this.tile_height){options.tileSize=this.tile_height;}else if(this.tiles){if(this.tiles.length==1){options.tileWidth=this.tiles[0].width;options.tileHeight=this.tiles[0].height||this.tiles[0].width;this.scale_factors=this.tiles[0].scaleFactors;}else{this.scale_factors=[];for(var t=0;t<this.tiles.length;t++){for(var sf=0;sf<this.tiles[t].scaleFactors.length;sf++){var scaleFactor=this.tiles[t].scaleFactors[sf];this.scale_factors.push(scaleFactor);options.tileSizePerScaleFactor[scaleFactor]={width:this.tiles[t].width,height:this.tiles[t].height||this.tiles[t].width};}}}}else if(canBeTiled(options)){var shortDim=Math.min(this.height,this.width),tileOptions=[256,512,1024],smallerTiles=[];for(var c=0;c<tileOptions.length;c++){if(tileOptions[c]<=shortDim){smallerTiles.push(tileOptions[c]);}}
if(smallerTiles.length>0){options.tileSize=Math.max.apply(null,smallerTiles);}else{options.tileSize=shortDim;}}else if(this.sizes&&this.sizes.length>0){this.emulateLegacyImagePyramid=true;options.levels=constructLevels(this);$.extend(true,options,{width:options.levels[options.levels.length-1].width,height:options.levels[options.levels.length-1].height,tileSize:Math.max(options.height,options.width),tileOverlap:0,minLevel:0,maxLevel:options.levels.length-1});this.levels=options.levels;}else{$.console.error("Nothing in the info.json to construct image pyramids from");}
if(!options.maxLevel&&!this.emulateLegacyImagePyramid){if(!this.scale_factors){options.maxLevel=Number(Math.ceil(Math.log(Math.max(this.width,this.height),2)));}else{var maxScaleFactor=Math.max.apply(null,this.scale_factors);options.maxLevel=Math.round(Math.log(maxScaleFactor)*Math.LOG2E);}}
$.TileSource.apply(this,[options]);};$.extend($.IIIFTileSource.prototype,$.TileSource.prototype,{supports:function(data,url){if(data.protocol&&data.protocol=='http://iiif.io/api/image'){return true;}else if(data['@context']&&(data['@context']=="http://library.stanford.edu/iiif/image-api/1.1/context.json"||data['@context']=="http://iiif.io/api/image/1/context.json")){return true;}else if(data.profile&&data.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html")===0){return true;}else if(data.identifier&&data.width&&data.height){return true;}else if(data.documentElement&&"info"==data.documentElement.tagName&&"http://library.stanford.edu/iiif/image-api/ns/"==data.documentElement.namespaceURI){return true;}else{return false;}},configure:function(data,url){if(!$.isPlainObject(data)){var options=configureFromXml10(data);options['@context']="http://iiif.io/api/image/1.0/context.json";options['@id']=url.replace('/info.xml','');options.version=1;return options;}else{if(!data['@context']){data['@context']='http://iiif.io/api/image/1.0/context.json';data['@id']=url.replace('/info.json','');data.version=1;}else{var context=data['@context'];if(Array.isArray(context)){for(var i=0;i<context.length;i++){if(typeof context[i]==='string'&&(/^http:\/\/iiif\.io\/api\/image\/[1-3]\/context\.json$/.test(context[i])||context[i]==='http://library.stanford.edu/iiif/image-api/1.1/context.json')){context=context[i];break;}}}
switch(context){case'http://iiif.io/api/image/1/context.json':case'http://library.stanford.edu/iiif/image-api/1.1/context.json':data.version=1;break;case'http://iiif.io/api/image/2/context.json':data.version=2;break;case'http://iiif.io/api/image/3/context.json':data.version=3;break;default:$.console.error('Data has a @context property which contains no known IIIF context URI.');}}
if(!data['@id']&&data['id']){data['@id']=data['id'];}
if(data.preferredFormats){for(var f=0;f<data.preferredFormats.length;f++){if(OpenSeadragon.imageFormatSupported(data.preferredFormats[f])){data.tileFormat=data.preferredFormats[f];break;}}}
return data;}},getTileWidth:function(level){if(this.emulateLegacyImagePyramid){return $.TileSource.prototype.getTileWidth.call(this,level);}
var scaleFactor=Math.pow(2,this.maxLevel-level);if(this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[scaleFactor]){return this.tileSizePerScaleFactor[scaleFactor].width;}
return this._tileWidth;},getTileHeight:function(level){if(this.emulateLegacyImagePyramid){return $.TileSource.prototype.getTileHeight.call(this,level);}
var scaleFactor=Math.pow(2,this.maxLevel-level);if(this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[scaleFactor]){return this.tileSizePerScaleFactor[scaleFactor].height;}
return this._tileHeight;},getLevelScale:function(level){if(this.emulateLegacyImagePyramid){var levelScale=NaN;if(this.levels.length>0&&level>=this.minLevel&&level<=this.maxLevel){levelScale=this.levels[level].width/this.levels[this.maxLevel].width;}
return levelScale;}
return $.TileSource.prototype.getLevelScale.call(this,level);},getNumTiles:function(level){if(this.emulateLegacyImagePyramid){var scale=this.getLevelScale(level);if(scale){return new $.Point(1,1);}else{return new $.Point(0,0);}}
return $.TileSource.prototype.getNumTiles.call(this,level);},getTileAtPoint:function(level,point){if(this.emulateLegacyImagePyramid){return new $.Point(0,0);}
return $.TileSource.prototype.getTileAtPoint.call(this,level,point);},getTileUrl:function(level,x,y){if(this.emulateLegacyImagePyramid){var url=null;if(this.levels.length>0&&level>=this.minLevel&&level<=this.maxLevel){url=this.levels[level].url;}
return url;}
var IIIF_ROTATION='0',scale=Math.pow(0.5,this.maxLevel-level),levelWidth=Math.ceil(this.width*scale),levelHeight=Math.ceil(this.height*scale),tileWidth,tileHeight,iiifTileSizeWidth,iiifTileSizeHeight,iiifRegion,iiifTileX,iiifTileY,iiifTileW,iiifTileH,iiifSize,iiifSizeW,iiifSizeH,iiifQuality,uri;tileWidth=this.getTileWidth(level);tileHeight=this.getTileHeight(level);iiifTileSizeWidth=Math.ceil(tileWidth/scale);iiifTileSizeHeight=Math.ceil(tileHeight/scale);if(this.version===1){iiifQuality="native."+this.tileFormat;}else{iiifQuality="default."+this.tileFormat;}
if(levelWidth<tileWidth&&levelHeight<tileHeight){if(this.version===2&&levelWidth===this.width){iiifSize="max";}else if(this.version===3&&levelWidth===this.width&&levelHeight===this.height){iiifSize="max";}else if(this.version===3){iiifSize=levelWidth+","+levelHeight;}else{iiifSize=levelWidth+",";}
iiifRegion='full';}else{iiifTileX=x*iiifTileSizeWidth;iiifTileY=y*iiifTileSizeHeight;iiifTileW=Math.min(iiifTileSizeWidth,this.width-iiifTileX);iiifTileH=Math.min(iiifTileSizeHeight,this.height-iiifTileY);if(x===0&&y===0&&iiifTileW===this.width&&iiifTileH===this.height){iiifRegion="full";}else{iiifRegion=[iiifTileX,iiifTileY,iiifTileW,iiifTileH].join(',');}
iiifSizeW=Math.ceil(iiifTileW*scale);iiifSizeH=Math.ceil(iiifTileH*scale);if(this.version===2&&iiifSizeW===this.width){iiifSize="max";}else if(this.version===3&&iiifSizeW===this.width&&iiifSizeH===this.height){iiifSize="max";}else if(this.version===3){iiifSize=iiifSizeW+","+iiifSizeH;}else{iiifSize=iiifSizeW+",";}}
uri=[this['@id'],iiifRegion,iiifSize,IIIF_ROTATION,iiifQuality].join('/');return uri;},__testonly__:{canBeTiled:canBeTiled,constructLevels:constructLevels}});function canBeTiled(options){var level0Profiles=["http://library.stanford.edu/iiif/image-api/compliance.html#level0","http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0","http://iiif.io/api/image/2/level0.json","level0","https://iiif.io/api/image/3/level0.json"];var profileLevel=Array.isArray(options.profile)?options.profile[0]:options.profile;var isLevel0=(level0Profiles.indexOf(profileLevel)!==-1);var hasCanoncicalSizeFeature=false;if(options.version===2&&options.profile.length>1&&options.profile[1].supports){hasCanoncicalSizeFeature=options.profile[1].supports.indexOf("sizeByW")!==-1;}
if(options.version===3&&options.extraFeatures){hasCanoncicalSizeFeature=options.extraFeatures.indexOf("sizeByWh")!==-1;}
return!isLevel0||hasCanoncicalSizeFeature;}
function constructLevels(options){var levels=[];for(var i=0;i<options.sizes.length;i++){levels.push({url:options['@id']+'/full/'+options.sizes[i].width+','+
(options.version===3?options.sizes[i].height:'')+'/0/default.'+options.tileFormat,width:options.sizes[i].width,height:options.sizes[i].height});}
return levels.sort(function(a,b){return a.width-b.width;});}
function configureFromXml10(xmlDoc){if(!xmlDoc||!xmlDoc.documentElement){throw new Error($.getString("Errors.Xml"));}
var root=xmlDoc.documentElement,rootName=root.tagName,configuration=null;if(rootName=="info"){try{configuration={};parseXML10(root,configuration);return configuration;}catch(e){throw(e instanceof Error)?e:new Error($.getString("Errors.IIIF"));}}
throw new Error($.getString("Errors.IIIF"));}
function parseXML10(node,configuration,property){var i,value;if(node.nodeType==3&&property){value=node.nodeValue.trim();if(value.match(/^\d*$/)){value=Number(value);}
if(!configuration[property]){configuration[property]=value;}else{if(!$.isArray(configuration[property])){configuration[property]=[configuration[property]];}
configuration[property].push(value);}}else if(node.nodeType==1){for(i=0;i<node.childNodes.length;i++){parseXML10(node.childNodes[i],configuration,node.nodeName);}}}}(OpenSeadragon));(function($){$.OsmTileSource=function(width,height,tileSize,tileOverlap,tilesUrl){var options;if($.isPlainObject(width)){options=width;}else{options={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]};}
if(!options.width||!options.height){options.width=65572864;options.height=65572864;}
if(!options.tileSize){options.tileSize=256;options.tileOverlap=0;}
if(!options.tilesUrl){options.tilesUrl="http://tile.openstreetmap.org/";}
options.minLevel=8;$.TileSource.apply(this,[options]);};$.extend($.OsmTileSource.prototype,$.TileSource.prototype,{supports:function(data,url){return(data.type&&"openstreetmaps"==data.type);},configure:function(data,url){return data;},getTileUrl:function(level,x,y){return this.tilesUrl+(level-8)+"/"+x+"/"+y+".png";}});}(OpenSeadragon));(function($){$.TmsTileSource=function(width,height,tileSize,tileOverlap,tilesUrl){var options;if($.isPlainObject(width)){options=width;}else{options={width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]};}
var bufferedWidth=Math.ceil(options.width/256)*256,bufferedHeight=Math.ceil(options.height/256)*256,max;if(bufferedWidth>bufferedHeight){max=bufferedWidth/256;}else{max=bufferedHeight/256;}
options.maxLevel=Math.ceil(Math.log(max)/Math.log(2))-1;options.tileSize=256;options.width=bufferedWidth;options.height=bufferedHeight;$.TileSource.apply(this,[options]);};$.extend($.TmsTileSource.prototype,$.TileSource.prototype,{supports:function(data,url){return(data.type&&"tiledmapservice"==data.type);},configure:function(data,url){return data;},getTileUrl:function(level,x,y){var yTiles=this.getNumTiles(level).y-1;return this.tilesUrl+level+"/"+x+"/"+(yTiles-y)+".png";}});}(OpenSeadragon));(function($){$.ZoomifyTileSource=function(options){options.tileSize=256;var currentImageSize={x:options.width,y:options.height};options.imageSizes=[{x:options.width,y:options.height}];options.gridSize=[this._getGridSize(options.width,options.height,options.tileSize)];while(parseInt(currentImageSize.x,10)>options.tileSize||parseInt(currentImageSize.y,10)>options.tileSize){currentImageSize.x=Math.floor(currentImageSize.x/2);currentImageSize.y=Math.floor(currentImageSize.y/2);options.imageSizes.push({x:currentImageSize.x,y:currentImageSize.y});options.gridSize.push(this._getGridSize(currentImageSize.x,currentImageSize.y,options.tileSize));}
options.imageSizes.reverse();options.gridSize.reverse();options.minLevel=0;options.maxLevel=options.gridSize.length-1;OpenSeadragon.TileSource.apply(this,[options]);};$.extend($.ZoomifyTileSource.prototype,$.TileSource.prototype,{_getGridSize:function(width,height,tileSize){return{x:Math.ceil(width/tileSize),y:Math.ceil(height/tileSize)};},_calculateAbsoluteTileNumber:function(level,x,y){var num=0;var size={};for(var z=0;z<level;z++){size=this.gridSize[z];num+=size.x*size.y;}
size=this.gridSize[level];num+=size.x*y+x;return num;},supports:function(data,url){return(data.type&&"zoomifytileservice"==data.type);},configure:function(data,url){return data;},getTileUrl:function(level,x,y){var result=0;var num=this._calculateAbsoluteTileNumber(level,x,y);result=Math.floor(num/256);return this.tilesUrl+'TileGroup'+result+'/'+level+'-'+x+'-'+y+'.jpg';}});}(OpenSeadragon));(function($){$.LegacyTileSource=function(levels){var options,width,height;if($.isArray(levels)){options={type:'legacy-image-pyramid',levels:levels};}
options.levels=filterFiles(options.levels);if(options.levels.length>0){width=options.levels[options.levels.length-1].width;height=options.levels[options.levels.length-1].height;}
else{width=0;height=0;$.console.error("No supported image formats found");}
$.extend(true,options,{width:width,height:height,tileSize:Math.max(height,width),tileOverlap:0,minLevel:0,maxLevel:options.levels.length>0?options.levels.length-1:0});$.TileSource.apply(this,[options]);this.levels=options.levels;};$.extend($.LegacyTileSource.prototype,$.TileSource.prototype,{supports:function(data,url){return(data.type&&"legacy-image-pyramid"==data.type)||(data.documentElement&&"legacy-image-pyramid"==data.documentElement.getAttribute('type'));},configure:function(configuration,dataUrl){var options;if(!$.isPlainObject(configuration)){options=configureFromXML(this,configuration);}else{options=configureFromObject(this,configuration);}
return options;},getLevelScale:function(level){var levelScale=NaN;if(this.levels.length>0&&level>=this.minLevel&&level<=this.maxLevel){levelScale=this.levels[level].width/this.levels[this.maxLevel].width;}
return levelScale;},getNumTiles:function(level){var scale=this.getLevelScale(level);if(scale){return new $.Point(1,1);}else{return new $.Point(0,0);}},getTileUrl:function(level,x,y){var url=null;if(this.levels.length>0&&level>=this.minLevel&&level<=this.maxLevel){url=this.levels[level].url;}
return url;}});function filterFiles(files){var filtered=[],file,i;for(i=0;i<files.length;i++){file=files[i];if(file.height&&file.width&&file.url){filtered.push({url:file.url,width:Number(file.width),height:Number(file.height)});}
else{$.console.error('Unsupported image format: %s',file.url?file.url:'<no URL>');}}
return filtered.sort(function(a,b){return a.height-b.height;});}
function configureFromXML(tileSource,xmlDoc){if(!xmlDoc||!xmlDoc.documentElement){throw new Error($.getString("Errors.Xml"));}
var root=xmlDoc.documentElement,rootName=root.tagName,conf=null,levels=[],level,i;if(rootName=="image"){try{conf={type:root.getAttribute("type"),levels:[]};levels=root.getElementsByTagName("level");for(i=0;i<levels.length;i++){level=levels[i];conf.levels.push({url:level.getAttribute("url"),width:parseInt(level.getAttribute("width"),10),height:parseInt(level.getAttribute("height"),10)});}
return configureFromObject(tileSource,conf);}catch(e){throw(e instanceof Error)?e:new Error('Unknown error parsing Legacy Image Pyramid XML.');}}else if(rootName=="collection"){throw new Error('Legacy Image Pyramid Collections not yet supported.');}else if(rootName=="error"){throw new Error('Error: '+xmlDoc);}
throw new Error('Unknown element '+rootName);}
function configureFromObject(tileSource,configuration){return configuration.levels;}}(OpenSeadragon));(function($){$.ImageTileSource=function(options){options=$.extend({buildPyramid:true,crossOriginPolicy:false,ajaxWithCredentials:false,useCanvas:true},options);$.TileSource.apply(this,[options]);};$.extend($.ImageTileSource.prototype,$.TileSource.prototype,{supports:function(data,url){return data.type&&data.type==="image";},configure:function(options,dataUrl){return options;},getImageInfo:function(url){var image=this._image=new Image();var _this=this;if(this.crossOriginPolicy){image.crossOrigin=this.crossOriginPolicy;}
if(this.ajaxWithCredentials){image.useCredentials=this.ajaxWithCredentials;}
$.addEvent(image,'load',function(){_this.width=Object.prototype.hasOwnProperty.call(image,'naturalWidth')?image.naturalWidth:image.width;_this.height=Object.prototype.hasOwnProperty.call(image,'naturalHeight')?image.naturalHeight:image.height;_this.aspectRatio=_this.width/_this.height;_this.dimensions=new $.Point(_this.width,_this.height);_this._tileWidth=_this.width;_this._tileHeight=_this.height;_this.tileOverlap=0;_this.minLevel=0;_this.levels=_this._buildLevels();_this.maxLevel=_this.levels.length-1;_this.ready=true;_this.raiseEvent('ready',{tileSource:_this});});$.addEvent(image,'error',function(){_this.raiseEvent('open-failed',{message:"Error loading image at "+url,source:url});});image.src=url;},getLevelScale:function(level){var levelScale=NaN;if(level>=this.minLevel&&level<=this.maxLevel){levelScale=this.levels[level].width/this.levels[this.maxLevel].width;}
return levelScale;},getNumTiles:function(level){var scale=this.getLevelScale(level);if(scale){return new $.Point(1,1);}else{return new $.Point(0,0);}},getTileUrl:function(level,x,y){var url=null;if(level>=this.minLevel&&level<=this.maxLevel){url=this.levels[level].url;}
return url;},getContext2D:function(level,x,y){var context=null;if(level>=this.minLevel&&level<=this.maxLevel){context=this.levels[level].context2D;}
return context;},_buildLevels:function(){var levels=[{url:this._image.src,width:Object.prototype.hasOwnProperty.call(this._image,'naturalWidth')?this._image.naturalWidth:this._image.width,height:Object.prototype.hasOwnProperty.call(this._image,'naturalHeight')?this._image.naturalHeight:this._image.height}];if(!this.buildPyramid||!$.supportsCanvas||!this.useCanvas){delete this._image;return levels;}
var currentWidth=Object.prototype.hasOwnProperty.call(this._image,'naturalWidth')?this._image.naturalWidth:this._image.width;var currentHeight=Object.prototype.hasOwnProperty.call(this._image,'naturalHeight')?this._image.naturalHeight:this._image.height;var bigCanvas=document.createElement("canvas");var bigContext=bigCanvas.getContext("2d");bigCanvas.width=currentWidth;bigCanvas.height=currentHeight;bigContext.drawImage(this._image,0,0,currentWidth,currentHeight);levels[0].context2D=bigContext;delete this._image;if($.isCanvasTainted(bigCanvas)){return levels;}
while(currentWidth>=2&&currentHeight>=2){currentWidth=Math.floor(currentWidth/2);currentHeight=Math.floor(currentHeight/2);var smallCanvas=document.createElement("canvas");var smallContext=smallCanvas.getContext("2d");smallCanvas.width=currentWidth;smallCanvas.height=currentHeight;smallContext.drawImage(bigCanvas,0,0,currentWidth,currentHeight);levels.splice(0,0,{context2D:smallContext,width:currentWidth,height:currentHeight});bigCanvas=smallCanvas;bigContext=smallContext;}
return levels;}});}(OpenSeadragon));(function($){$.TileSourceCollection=function(tileSize,tileSources,rows,layout){$.console.error('TileSourceCollection is deprecated; use World instead');};}(OpenSeadragon));(function($){$.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3};$.Button=function(options){var _this=this;$.EventSource.call(this);$.extend(true,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:$.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:$.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2000,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null},options);this.element=options.element||$.makeNeutralElement("div");if(!options.element){this.imgRest=$.makeTransparentImage(this.srcRest);this.imgGroup=$.makeTransparentImage(this.srcGroup);this.imgHover=$.makeTransparentImage(this.srcHover);this.imgDown=$.makeTransparentImage(this.srcDown);this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip;this.element.style.position="relative";$.setElementTouchActionNone(this.element);this.imgGroup.style.position=this.imgHover.style.position=this.imgDown.style.position="absolute";this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top="0px";this.imgGroup.style.left=this.imgHover.style.left=this.imgDown.style.left="0px";this.imgHover.style.visibility=this.imgDown.style.visibility="hidden";if($.Browser.vendor==$.BROWSERS.FIREFOX&&$.Browser.version<3){this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top="";}
this.element.appendChild(this.imgRest);this.element.appendChild(this.imgGroup);this.element.appendChild(this.imgHover);this.element.appendChild(this.imgDown);}
this.addHandler("press",this.onPress);this.addHandler("release",this.onRelease);this.addHandler("click",this.onClick);this.addHandler("enter",this.onEnter);this.addHandler("exit",this.onExit);this.addHandler("focus",this.onFocus);this.addHandler("blur",this.onBlur);this.currentState=$.ButtonState.GROUP;this.fadeBeginTime=null;this.shouldFade=false;this.element.style.display="inline-block";this.element.style.position="relative";this.element.title=this.tooltip;this.tracker=new $.MouseTracker({element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(event){if(event.insideElementPressed){inTo(_this,$.ButtonState.DOWN);_this.raiseEvent("enter",{originalEvent:event.originalEvent});}else if(!event.buttonDownAny){inTo(_this,$.ButtonState.HOVER);}},focusHandler:function(event){this.enterHandler(event);_this.raiseEvent("focus",{originalEvent:event.originalEvent});},exitHandler:function(event){outTo(_this,$.ButtonState.GROUP);if(event.insideElementPressed){_this.raiseEvent("exit",{originalEvent:event.originalEvent});}},blurHandler:function(event){this.exitHandler(event);_this.raiseEvent("blur",{originalEvent:event.originalEvent});},pressHandler:function(event){inTo(_this,$.ButtonState.DOWN);_this.raiseEvent("press",{originalEvent:event.originalEvent});},releaseHandler:function(event){if(event.insideElementPressed&&event.insideElementReleased){outTo(_this,$.ButtonState.HOVER);_this.raiseEvent("release",{originalEvent:event.originalEvent});}else if(event.insideElementPressed){outTo(_this,$.ButtonState.GROUP);}else{inTo(_this,$.ButtonState.HOVER);}},clickHandler:function(event){if(event.quick){_this.raiseEvent("click",{originalEvent:event.originalEvent});}},keyHandler:function(event){if(13===event.keyCode){_this.raiseEvent("click",{originalEvent:event.originalEvent});_this.raiseEvent("release",{originalEvent:event.originalEvent});return false;}
return true;}});outTo(this,$.ButtonState.REST);};$.extend($.Button.prototype,$.EventSource.prototype,{notifyGroupEnter:function(){inTo(this,$.ButtonState.GROUP);},notifyGroupExit:function(){outTo(this,$.ButtonState.REST);},disable:function(){this.notifyGroupExit();this.element.disabled=true;$.setElementOpacity(this.element,0.2,true);},enable:function(){this.element.disabled=false;$.setElementOpacity(this.element,1.0,true);this.notifyGroupEnter();}});function scheduleFade(button){$.requestAnimationFrame(function(){updateFade(button);});}
function updateFade(button){var currentTime,deltaTime,opacity;if(button.shouldFade){currentTime=$.now();deltaTime=currentTime-button.fadeBeginTime;opacity=1.0-deltaTime/button.fadeLength;opacity=Math.min(1.0,opacity);opacity=Math.max(0.0,opacity);if(button.imgGroup){$.setElementOpacity(button.imgGroup,opacity,true);}
if(opacity>0){scheduleFade(button);}}}
function beginFading(button){button.shouldFade=true;button.fadeBeginTime=$.now()+button.fadeDelay;window.setTimeout(function(){scheduleFade(button);},button.fadeDelay);}
function stopFading(button){button.shouldFade=false;if(button.imgGroup){$.setElementOpacity(button.imgGroup,1.0,true);}}
function inTo(button,newState){if(button.element.disabled){return;}
if(newState>=$.ButtonState.GROUP&&button.currentState==$.ButtonState.REST){stopFading(button);button.currentState=$.ButtonState.GROUP;}
if(newState>=$.ButtonState.HOVER&&button.currentState==$.ButtonState.GROUP){if(button.imgHover){button.imgHover.style.visibility="";}
button.currentState=$.ButtonState.HOVER;}
if(newState>=$.ButtonState.DOWN&&button.currentState==$.ButtonState.HOVER){if(button.imgDown){button.imgDown.style.visibility="";}
button.currentState=$.ButtonState.DOWN;}}
function outTo(button,newState){if(button.element.disabled){return;}
if(newState<=$.ButtonState.HOVER&&button.currentState==$.ButtonState.DOWN){if(button.imgDown){button.imgDown.style.visibility="hidden";}
button.currentState=$.ButtonState.HOVER;}
if(newState<=$.ButtonState.GROUP&&button.currentState==$.ButtonState.HOVER){if(button.imgHover){button.imgHover.style.visibility="hidden";}
button.currentState=$.ButtonState.GROUP;}
if(newState<=$.ButtonState.REST&&button.currentState==$.ButtonState.GROUP){beginFading(button);button.currentState=$.ButtonState.REST;}}}(OpenSeadragon));(function($){$.ButtonGroup=function(options){$.extend(true,this,{buttons:[],clickTimeThreshold:$.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:$.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},options);var buttons=this.buttons.concat([]),_this=this,i;this.element=options.element||$.makeNeutralElement("div");if(!options.group){this.element.style.display="inline-block";for(i=0;i<buttons.length;i++){this.element.appendChild(buttons[i].element);}}
$.setElementTouchActionNone(this.element);this.tracker=new $.MouseTracker({element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(event){var i;for(i=0;i<_this.buttons.length;i++){_this.buttons[i].notifyGroupEnter();}},exitHandler:function(event){var i;if(!event.insideElementPressed){for(i=0;i<_this.buttons.length;i++){_this.buttons[i].notifyGroupExit();}}},});};$.ButtonGroup.prototype={emulateEnter:function(){this.tracker.enterHandler({eventSource:this.tracker});},emulateExit:function(){this.tracker.exitHandler({eventSource:this.tracker});}};}(OpenSeadragon));(function($){$.Rect=function(x,y,width,height,degrees){this.x=typeof(x)==="number"?x:0;this.y=typeof(y)==="number"?y:0;this.width=typeof(width)==="number"?width:0;this.height=typeof(height)==="number"?height:0;this.degrees=typeof(degrees)==="number"?degrees:0;this.degrees=$.positiveModulo(this.degrees,360);var newTopLeft,newWidth;if(this.degrees>=270){newTopLeft=this.getTopRight();this.x=newTopLeft.x;this.y=newTopLeft.y;newWidth=this.height;this.height=this.width;this.width=newWidth;this.degrees-=270;}else if(this.degrees>=180){newTopLeft=this.getBottomRight();this.x=newTopLeft.x;this.y=newTopLeft.y;this.degrees-=180;}else if(this.degrees>=90){newTopLeft=this.getBottomLeft();this.x=newTopLeft.x;this.y=newTopLeft.y;newWidth=this.height;this.height=this.width;this.width=newWidth;this.degrees-=90;}};$.Rect.fromSummits=function(topLeft,topRight,bottomLeft){var width=topLeft.distanceTo(topRight);var height=topLeft.distanceTo(bottomLeft);var diff=topRight.minus(topLeft);var radians=Math.atan(diff.y/diff.x);if(diff.x<0){radians+=Math.PI;}else if(diff.y<0){radians+=2*Math.PI;}
return new $.Rect(topLeft.x,topLeft.y,width,height,radians/Math.PI*180);};$.Rect.prototype={clone:function(){return new $.Rect(this.x,this.y,this.width,this.height,this.degrees);},getAspectRatio:function(){return this.width/this.height;},getTopLeft:function(){return new $.Point(this.x,this.y);},getBottomRight:function(){return new $.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft());},getTopRight:function(){return new $.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft());},getBottomLeft:function(){return new $.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft());},getCenter:function(){return new $.Point(this.x+this.width/2.0,this.y+this.height/2.0).rotate(this.degrees,this.getTopLeft());},getSize:function(){return new $.Point(this.width,this.height);},equals:function(other){return(other instanceof $.Rect)&&this.x===other.x&&this.y===other.y&&this.width===other.width&&this.height===other.height&&this.degrees===other.degrees;},times:function(factor){return new $.Rect(this.x*factor,this.y*factor,this.width*factor,this.height*factor,this.degrees);},translate:function(delta){return new $.Rect(this.x+delta.x,this.y+delta.y,this.width,this.height,this.degrees);},union:function(rect){var thisBoundingBox=this.getBoundingBox();var otherBoundingBox=rect.getBoundingBox();var left=Math.min(thisBoundingBox.x,otherBoundingBox.x);var top=Math.min(thisBoundingBox.y,otherBoundingBox.y);var right=Math.max(thisBoundingBox.x+thisBoundingBox.width,otherBoundingBox.x+otherBoundingBox.width);var bottom=Math.max(thisBoundingBox.y+thisBoundingBox.height,otherBoundingBox.y+otherBoundingBox.height);return new $.Rect(left,top,right-left,bottom-top);},intersection:function(rect){var EPSILON=0.0000000001;var intersectionPoints=[];var thisTopLeft=this.getTopLeft();if(rect.containsPoint(thisTopLeft,EPSILON)){intersectionPoints.push(thisTopLeft);}
var thisTopRight=this.getTopRight();if(rect.containsPoint(thisTopRight,EPSILON)){intersectionPoints.push(thisTopRight);}
var thisBottomLeft=this.getBottomLeft();if(rect.containsPoint(thisBottomLeft,EPSILON)){intersectionPoints.push(thisBottomLeft);}
var thisBottomRight=this.getBottomRight();if(rect.containsPoint(thisBottomRight,EPSILON)){intersectionPoints.push(thisBottomRight);}
var rectTopLeft=rect.getTopLeft();if(this.containsPoint(rectTopLeft,EPSILON)){intersectionPoints.push(rectTopLeft);}
var rectTopRight=rect.getTopRight();if(this.containsPoint(rectTopRight,EPSILON)){intersectionPoints.push(rectTopRight);}
var rectBottomLeft=rect.getBottomLeft();if(this.containsPoint(rectBottomLeft,EPSILON)){intersectionPoints.push(rectBottomLeft);}
var rectBottomRight=rect.getBottomRight();if(this.containsPoint(rectBottomRight,EPSILON)){intersectionPoints.push(rectBottomRight);}
var thisSegments=this._getSegments();var rectSegments=rect._getSegments();for(var i=0;i<thisSegments.length;i++){var thisSegment=thisSegments[i];for(var j=0;j<rectSegments.length;j++){var rectSegment=rectSegments[j];var intersect=getIntersection(thisSegment[0],thisSegment[1],rectSegment[0],rectSegment[1]);if(intersect){intersectionPoints.push(intersect);}}}
function getIntersection(a,b,c,d){var abVector=b.minus(a);var cdVector=d.minus(c);var denom=-cdVector.x*abVector.y+abVector.x*cdVector.y;if(denom===0){return null;}
var s=(abVector.x*(a.y-c.y)-abVector.y*(a.x-c.x))/denom;var t=(cdVector.x*(a.y-c.y)-cdVector.y*(a.x-c.x))/denom;if(-EPSILON<=s&&s<=1-EPSILON&&-EPSILON<=t&&t<=1-EPSILON){return new $.Point(a.x+t*abVector.x,a.y+t*abVector.y);}
return null;}
if(intersectionPoints.length===0){return null;}
var minX=intersectionPoints[0].x;var maxX=intersectionPoints[0].x;var minY=intersectionPoints[0].y;var maxY=intersectionPoints[0].y;for(var k=1;k<intersectionPoints.length;k++){var point=intersectionPoints[k];if(point.x<minX){minX=point.x;}
if(point.x>maxX){maxX=point.x;}
if(point.y<minY){minY=point.y;}
if(point.y>maxY){maxY=point.y;}}
return new $.Rect(minX,minY,maxX-minX,maxY-minY);},_getSegments:function(){var topLeft=this.getTopLeft();var topRight=this.getTopRight();var bottomLeft=this.getBottomLeft();var bottomRight=this.getBottomRight();return[[topLeft,topRight],[topRight,bottomRight],[bottomRight,bottomLeft],[bottomLeft,topLeft]];},rotate:function(degrees,pivot){degrees=$.positiveModulo(degrees,360);if(degrees===0){return this.clone();}
pivot=pivot||this.getCenter();var newTopLeft=this.getTopLeft().rotate(degrees,pivot);var newTopRight=this.getTopRight().rotate(degrees,pivot);var diff=newTopRight.minus(newTopLeft);diff=diff.apply(function(x){var EPSILON=1e-15;return Math.abs(x)<EPSILON?0:x;});var radians=Math.atan(diff.y/diff.x);if(diff.x<0){radians+=Math.PI;}else if(diff.y<0){radians+=2*Math.PI;}
return new $.Rect(newTopLeft.x,newTopLeft.y,this.width,this.height,radians/Math.PI*180);},getBoundingBox:function(){if(this.degrees===0){return this.clone();}
var topLeft=this.getTopLeft();var topRight=this.getTopRight();var bottomLeft=this.getBottomLeft();var bottomRight=this.getBottomRight();var minX=Math.min(topLeft.x,topRight.x,bottomLeft.x,bottomRight.x);var maxX=Math.max(topLeft.x,topRight.x,bottomLeft.x,bottomRight.x);var minY=Math.min(topLeft.y,topRight.y,bottomLeft.y,bottomRight.y);var maxY=Math.max(topLeft.y,topRight.y,bottomLeft.y,bottomRight.y);return new $.Rect(minX,minY,maxX-minX,maxY-minY);},getIntegerBoundingBox:function(){var boundingBox=this.getBoundingBox();var x=Math.floor(boundingBox.x);var y=Math.floor(boundingBox.y);var width=Math.ceil(boundingBox.width+boundingBox.x-x);var height=Math.ceil(boundingBox.height+boundingBox.y-y);return new $.Rect(x,y,width,height);},containsPoint:function(point,epsilon){epsilon=epsilon||0;var topLeft=this.getTopLeft();var topRight=this.getTopRight();var bottomLeft=this.getBottomLeft();var topDiff=topRight.minus(topLeft);var leftDiff=bottomLeft.minus(topLeft);return((point.x-topLeft.x)*topDiff.x+
(point.y-topLeft.y)*topDiff.y>=-epsilon)&&((point.x-topRight.x)*topDiff.x+
(point.y-topRight.y)*topDiff.y<=epsilon)&&((point.x-topLeft.x)*leftDiff.x+
(point.y-topLeft.y)*leftDiff.y>=-epsilon)&&((point.x-bottomLeft.x)*leftDiff.x+
(point.y-bottomLeft.y)*leftDiff.y<=epsilon);},toString:function(){return"["+
(Math.round(this.x*100)/100)+", "+
(Math.round(this.y*100)/100)+", "+
(Math.round(this.width*100)/100)+"x"+
(Math.round(this.height*100)/100)+", "+
(Math.round(this.degrees*100)/100)+"deg"+"]";}};}(OpenSeadragon));(function($){var THIS={};$.ReferenceStrip=function(options){var _this=this,viewer=options.viewer,viewerSize=$.getElementSize(viewer.element),element,style,i;if(!options.id){options.id='referencestrip-'+$.now();this.element=$.makeNeutralElement("div");this.element.id=options.id;this.element.className='referencestrip';}
options=$.extend(true,{sizeRatio:$.DEFAULT_SETTINGS.referenceStripSizeRatio,position:$.DEFAULT_SETTINGS.referenceStripPosition,scroll:$.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:$.DEFAULT_SETTINGS.clickTimeThreshold},options,{element:this.element,showNavigator:false,mouseNavEnabled:false,showNavigationControl:false,showSequenceControl:false});$.extend(this,options);THIS[this.id]={"animating":false};this.minPixelRatio=this.viewer.minPixelRatio;style=this.element.style;style.marginTop='0px';style.marginRight='0px';style.marginBottom='0px';style.marginLeft='0px';style.left='0px';style.bottom='0px';style.border='0px';style.background='#000';style.position='relative';$.setElementTouchActionNone(this.element);$.setElementOpacity(this.element,0.8);this.viewer=viewer;this.innerTracker=new $.MouseTracker({element:this.element,dragHandler:$.delegate(this,onStripDrag),scrollHandler:$.delegate(this,onStripScroll),enterHandler:$.delegate(this,onStripEnter),exitHandler:$.delegate(this,onStripExit),keyDownHandler:$.delegate(this,onKeyDown),keyHandler:$.delegate(this,onKeyPress)});if(options.width&&options.height){this.element.style.width=options.width+'px';this.element.style.height=options.height+'px';viewer.addControl(this.element,{anchor:$.ControlAnchor.BOTTOM_LEFT});}else{if("horizontal"==options.scroll){this.element.style.width=(viewerSize.x*options.sizeRatio*viewer.tileSources.length)+(12*viewer.tileSources.length)+'px';this.element.style.height=(viewerSize.y*options.sizeRatio)+'px';viewer.addControl(this.element,{anchor:$.ControlAnchor.BOTTOM_LEFT});}else{this.element.style.height=(viewerSize.y*options.sizeRatio*viewer.tileSources.length)+(12*viewer.tileSources.length)+'px';this.element.style.width=(viewerSize.x*options.sizeRatio)+'px';viewer.addControl(this.element,{anchor:$.ControlAnchor.TOP_LEFT});}}
this.panelWidth=(viewerSize.x*this.sizeRatio)+8;this.panelHeight=(viewerSize.y*this.sizeRatio)+8;this.panels=[];this.miniViewers={};for(i=0;i<viewer.tileSources.length;i++){element=$.makeNeutralElement('div');element.id=this.element.id+"-"+i;element.style.width=_this.panelWidth+'px';element.style.height=_this.panelHeight+'px';element.style.display='inline';element.style.float='left';element.style.cssFloat='left';element.style.styleFloat='left';element.style.padding='2px';$.setElementTouchActionNone(element);element.innerTracker=new $.MouseTracker({element:element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,pressHandler:function(event){event.eventSource.dragging=$.now();},releaseHandler:function(event){var tracker=event.eventSource,id=tracker.element.id,page=Number(id.split('-')[2]),now=$.now();if(event.insideElementPressed&&event.insideElementReleased&&tracker.dragging&&(now-tracker.dragging)<tracker.clickTimeThreshold){tracker.dragging=null;viewer.goToPage(page);}}});this.element.appendChild(element);element.activePanel=false;this.panels.push(element);}
loadPanels(this,this.scroll=='vertical'?viewerSize.y:viewerSize.x,0);this.setFocus(0);};$.extend($.ReferenceStrip.prototype,$.EventSource.prototype,$.Viewer.prototype,{setFocus:function(page){var element=this.element.querySelector('#'+this.element.id+'-'+page),viewerSize=$.getElementSize(this.viewer.canvas),scrollWidth=Number(this.element.style.width.replace('px','')),scrollHeight=Number(this.element.style.height.replace('px','')),offsetLeft=-Number(this.element.style.marginLeft.replace('px','')),offsetTop=-Number(this.element.style.marginTop.replace('px','')),offset;if(this.currentSelected!==element){if(this.currentSelected){this.currentSelected.style.background='#000';}
this.currentSelected=element;this.currentSelected.style.background='#999';if('horizontal'==this.scroll){offset=(Number(page))*(this.panelWidth+3);if(offset>offsetLeft+viewerSize.x-this.panelWidth){offset=Math.min(offset,(scrollWidth-viewerSize.x));this.element.style.marginLeft=-offset+'px';loadPanels(this,viewerSize.x,-offset);}else if(offset<offsetLeft){offset=Math.max(0,offset-viewerSize.x/2);this.element.style.marginLeft=-offset+'px';loadPanels(this,viewerSize.x,-offset);}}else{offset=(Number(page))*(this.panelHeight+3);if(offset>offsetTop+viewerSize.y-this.panelHeight){offset=Math.min(offset,(scrollHeight-viewerSize.y));this.element.style.marginTop=-offset+'px';loadPanels(this,viewerSize.y,-offset);}else if(offset<offsetTop){offset=Math.max(0,offset-viewerSize.y/2);this.element.style.marginTop=-offset+'px';loadPanels(this,viewerSize.y,-offset);}}
this.currentPage=page;onStripEnter.call(this,{eventSource:this.innerTracker});}},update:function(){if(THIS[this.id].animating){$.console.log('image reference strip update');return true;}
return false;},destroy:function(){if(this.miniViewers){for(var key in this.miniViewers){this.miniViewers[key].destroy();}}
if(this.element){this.element.parentNode.removeChild(this.element);}}});function onStripDrag(event){var offsetLeft=Number(this.element.style.marginLeft.replace('px','')),offsetTop=Number(this.element.style.marginTop.replace('px','')),scrollWidth=Number(this.element.style.width.replace('px','')),scrollHeight=Number(this.element.style.height.replace('px','')),viewerSize=$.getElementSize(this.viewer.canvas);this.dragging=true;if(this.element){if('horizontal'==this.scroll){if(-event.delta.x>0){if(offsetLeft>-(scrollWidth-viewerSize.x)){this.element.style.marginLeft=(offsetLeft+(event.delta.x*2))+'px';loadPanels(this,viewerSize.x,offsetLeft+(event.delta.x*2));}}else if(-event.delta.x<0){if(offsetLeft<0){this.element.style.marginLeft=(offsetLeft+(event.delta.x*2))+'px';loadPanels(this,viewerSize.x,offsetLeft+(event.delta.x*2));}}}else{if(-event.delta.y>0){if(offsetTop>-(scrollHeight-viewerSize.y)){this.element.style.marginTop=(offsetTop+(event.delta.y*2))+'px';loadPanels(this,viewerSize.y,offsetTop+(event.delta.y*2));}}else if(-event.delta.y<0){if(offsetTop<0){this.element.style.marginTop=(offsetTop+(event.delta.y*2))+'px';loadPanels(this,viewerSize.y,offsetTop+(event.delta.y*2));}}}}
return false;}
function onStripScroll(event){var offsetLeft=Number(this.element.style.marginLeft.replace('px','')),offsetTop=Number(this.element.style.marginTop.replace('px','')),scrollWidth=Number(this.element.style.width.replace('px','')),scrollHeight=Number(this.element.style.height.replace('px','')),viewerSize=$.getElementSize(this.viewer.canvas);if(this.element){if('horizontal'==this.scroll){if(event.scroll>0){if(offsetLeft>-(scrollWidth-viewerSize.x)){this.element.style.marginLeft=(offsetLeft-(event.scroll*60))+'px';loadPanels(this,viewerSize.x,offsetLeft-(event.scroll*60));}}else if(event.scroll<0){if(offsetLeft<0){this.element.style.marginLeft=(offsetLeft-(event.scroll*60))+'px';loadPanels(this,viewerSize.x,offsetLeft-(event.scroll*60));}}}else{if(event.scroll<0){if(offsetTop>viewerSize.y-scrollHeight){this.element.style.marginTop=(offsetTop+(event.scroll*60))+'px';loadPanels(this,viewerSize.y,offsetTop+(event.scroll*60));}}else if(event.scroll>0){if(offsetTop<0){this.element.style.marginTop=(offsetTop+(event.scroll*60))+'px';loadPanels(this,viewerSize.y,offsetTop+(event.scroll*60));}}}}
return false;}
function loadPanels(strip,viewerSize,scroll){var panelSize,activePanelsStart,activePanelsEnd,miniViewer,style,i,element;if('horizontal'==strip.scroll){panelSize=strip.panelWidth;}else{panelSize=strip.panelHeight;}
activePanelsStart=Math.ceil(viewerSize/panelSize)+5;activePanelsEnd=Math.ceil((Math.abs(scroll)+viewerSize)/panelSize)+1;activePanelsStart=activePanelsEnd-activePanelsStart;activePanelsStart=activePanelsStart<0?0:activePanelsStart;for(i=activePanelsStart;i<activePanelsEnd&&i<strip.panels.length;i++){element=strip.panels[i];if(!element.activePanel){var miniTileSource;var originalTileSource=strip.viewer.tileSources[i];if(originalTileSource.referenceStripThumbnailUrl){miniTileSource={type:'image',url:originalTileSource.referenceStripThumbnailUrl};}else{miniTileSource=originalTileSource;}
miniViewer=new $.Viewer({id:element.id,tileSources:[miniTileSource],element:element,navigatorSizeRatio:strip.sizeRatio,showNavigator:false,mouseNavEnabled:false,showNavigationControl:false,showSequenceControl:false,immediateRender:true,blendTime:0,animationTime:0,loadTilesWithAjax:strip.viewer.loadTilesWithAjax,ajaxHeaders:strip.viewer.ajaxHeaders,useCanvas:strip.useCanvas});miniViewer.displayRegion=$.makeNeutralElement("div");miniViewer.displayRegion.id=element.id+'-displayregion';miniViewer.displayRegion.className='displayregion';style=miniViewer.displayRegion.style;style.position='relative';style.top='0px';style.left='0px';style.fontSize='0px';style.overflow='hidden';style.float='left';style.cssFloat='left';style.styleFloat='left';style.zIndex=999999999;style.cursor='default';style.width=(strip.panelWidth-4)+'px';style.height=(strip.panelHeight-4)+'px';miniViewer.displayRegion.innerTracker=new $.MouseTracker({element:miniViewer.displayRegion,startDisabled:true});element.getElementsByTagName('div')[0].appendChild(miniViewer.displayRegion);strip.miniViewers[element.id]=miniViewer;element.activePanel=true;}}}
function onStripEnter(event){var element=event.eventSource.element;if('horizontal'==this.scroll){element.style.marginBottom="0px";}else{element.style.marginLeft="0px";}
return false;}
function onStripExit(event){var element=event.eventSource.element;if('horizontal'==this.scroll){element.style.marginBottom="-"+($.getElementSize(element).y/2)+"px";}else{element.style.marginLeft="-"+($.getElementSize(element).x/2)+"px";}
return false;}
function onKeyDown(event){if(!event.preventDefaultAction&&!event.ctrl&&!event.alt&&!event.meta){switch(event.keyCode){case 38:onStripScroll.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});return false;case 40:onStripScroll.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});return false;case 37:onStripScroll.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});return false;case 39:onStripScroll.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});return false;default:return true;}}else{return true;}}
function onKeyPress(event){if(!event.preventDefaultAction&&!event.ctrl&&!event.alt&&!event.meta){switch(event.keyCode){case 61:onStripScroll.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});return false;case 45:onStripScroll.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});return false;case 48:case 119:case 87:onStripScroll.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});return false;case 115:case 83:onStripScroll.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});return false;case 97:onStripScroll.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});return false;case 100:onStripScroll.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});return false;default:return true;}}else{return true;}}}(OpenSeadragon));(function($){$.DisplayRect=function(x,y,width,height,minLevel,maxLevel){$.Rect.apply(this,[x,y,width,height]);this.minLevel=minLevel;this.maxLevel=maxLevel;};$.extend($.DisplayRect.prototype,$.Rect.prototype);}(OpenSeadragon));(function($){$.Spring=function(options){var args=arguments;if(typeof(options)!='object'){options={initial:args.length&&typeof(args[0])=="number"?args[0]:undefined,springStiffness:args.length>1?args[1].springStiffness:5.0,animationTime:args.length>1?args[1].animationTime:1.5};}
$.console.assert(typeof options.springStiffness==="number"&&options.springStiffness!==0,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number");$.console.assert(typeof options.animationTime==="number"&&options.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0");if(options.exponential){this._exponential=true;delete options.exponential;}
$.extend(true,this,options);this.current={value:typeof(this.initial)=="number"?this.initial:(this._exponential?0:1),time:$.now()};$.console.assert(!this._exponential||this.current.value!==0,"[OpenSeadragon.Spring] value must be non-zero for exponential springs");this.start={value:this.current.value,time:this.current.time};this.target={value:this.current.value,time:this.current.time};if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value);}};$.Spring.prototype={resetTo:function(target){$.console.assert(!this._exponential||target!==0,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs");this.start.value=this.target.value=this.current.value=target;this.start.time=this.target.time=this.current.time=$.now();if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value);}},springTo:function(target){$.console.assert(!this._exponential||target!==0,"[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs");this.start.value=this.current.value;this.start.time=this.current.time;this.target.value=target;this.target.time=this.start.time+1000*this.animationTime;if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);}},shiftBy:function(delta){this.start.value+=delta;this.target.value+=delta;if(this._exponential){$.console.assert(this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.shiftBy] spring value must be non-zero for exponential springs");this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);}},setExponential:function(value){this._exponential=value;if(this._exponential){$.console.assert(this.current.value!==0&&this.target.value!==0&&this.start.value!==0,"[OpenSeadragon.Spring.setExponential] spring value must be non-zero for exponential springs");this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value);}},update:function(){this.current.time=$.now();var startValue,targetValue;if(this._exponential){startValue=this.start._logValue;targetValue=this.target._logValue;}else{startValue=this.start.value;targetValue=this.target.value;}
var currentValue=(this.current.time>=this.target.time)?targetValue:startValue+
(targetValue-startValue)*transform(this.springStiffness,(this.current.time-this.start.time)/(this.target.time-this.start.time));var oldValue=this.current.value;if(this._exponential){this.current.value=Math.exp(currentValue);}else{this.current.value=currentValue;}
return oldValue!=this.current.value;},isAtTargetValue:function(){return this.current.value===this.target.value;}};function transform(stiffness,x){return(1.0-Math.exp(stiffness* -x))/(1.0-Math.exp(-stiffness));}}(OpenSeadragon));(function($){function ImageJob(options){$.extend(true,this,{timeout:$.DEFAULT_SETTINGS.timeout,jobId:null},options);this.image=null;}
ImageJob.prototype={errorMsg:null,start:function(){var self=this;var selfAbort=this.abort;this.image=new Image();this.image.onload=function(){self.finish(true);};this.image.onabort=this.image.onerror=function(){self.errorMsg="Image load aborted";self.finish(false);};this.jobId=window.setTimeout(function(){self.errorMsg="Image load exceeded timeout ("+self.timeout+" ms)";self.finish(false);},this.timeout);if(this.loadWithAjax){this.request=$.makeAjaxRequest({url:this.src,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,responseType:"arraybuffer",success:function(request){var blb;try{blb=new window.Blob([request.response]);}catch(e){var BlobBuilder=(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder);if(e.name==='TypeError'&&BlobBuilder){var bb=new BlobBuilder();bb.append(request.response);blb=bb.getBlob();}}
if(blb.size===0){self.errorMsg="Empty image response.";self.finish(false);}
var url=(window.URL||window.webkitURL).createObjectURL(blb);self.image.src=url;},error:function(request){self.errorMsg="Image load aborted - XHR error";self.finish(false);}});this.abort=function(){self.request.abort();if(typeof selfAbort==="function"){selfAbort();}};}else{if(this.crossOriginPolicy!==false){this.image.crossOrigin=this.crossOriginPolicy;}
this.image.src=this.src;}},finish:function(successful){this.image.onload=this.image.onerror=this.image.onabort=null;if(!successful){this.image=null;}
if(this.jobId){window.clearTimeout(this.jobId);}
this.callback(this);}};$.ImageLoader=function(options){$.extend(true,this,{jobLimit:$.DEFAULT_SETTINGS.imageLoaderLimit,timeout:$.DEFAULT_SETTINGS.timeout,jobQueue:[],jobsInProgress:0},options);};$.ImageLoader.prototype={addJob:function(options){var _this=this,complete=function(job){completeJob(_this,job,options.callback);},jobOptions={src:options.src,loadWithAjax:options.loadWithAjax,ajaxHeaders:options.loadWithAjax?options.ajaxHeaders:null,crossOriginPolicy:options.crossOriginPolicy,ajaxWithCredentials:options.ajaxWithCredentials,callback:complete,abort:options.abort,timeout:this.timeout},newJob=new ImageJob(jobOptions);if(!this.jobLimit||this.jobsInProgress<this.jobLimit){newJob.start();this.jobsInProgress++;}
else{this.jobQueue.push(newJob);}},clear:function(){for(var i=0;i<this.jobQueue.length;i++){var job=this.jobQueue[i];if(typeof job.abort==="function"){job.abort();}}
this.jobQueue=[];}};function completeJob(loader,job,callback){var nextJob;loader.jobsInProgress--;if((!loader.jobLimit||loader.jobsInProgress<loader.jobLimit)&&loader.jobQueue.length>0){nextJob=loader.jobQueue.shift();nextJob.start();loader.jobsInProgress++;}
callback(job.image,job.errorMsg,job.request);}}(OpenSeadragon));(function($){$.Tile=function(level,x,y,bounds,exists,url,context2D,loadWithAjax,ajaxHeaders,sourceBounds){this.level=level;this.x=x;this.y=y;this.bounds=bounds;this.sourceBounds=sourceBounds;this.exists=exists;this.url=url;this.context2D=context2D;this.loadWithAjax=loadWithAjax;this.ajaxHeaders=ajaxHeaders;if(this.ajaxHeaders){this.cacheKey=this.url+"+"+JSON.stringify(this.ajaxHeaders);}else{this.cacheKey=this.url;}
this.loaded=false;this.loading=false;this.element=null;this.imgElement=null;this.image=null;this.style=null;this.position=null;this.size=null;this.blendStart=null;this.opacity=null;this.squaredDistance=null;this.visibility=null;this.beingDrawn=false;this.lastTouchTime=0;this.isRightMost=false;this.isBottomMost=false;};$.Tile.prototype={toString:function(){return this.level+"/"+this.x+"_"+this.y;},_hasTransparencyChannel:function(){return!!this.context2D||this.url.match('.png');},drawHTML:function(container){if(!this.cacheImageRecord){$.console.warn('[Tile.drawHTML] attempting to draw tile %s when it\'s not cached',this.toString());return;}
if(!this.loaded){$.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return;}
if(!this.element){this.element=$.makeNeutralElement("div");this.imgElement=this.cacheImageRecord.getImage().cloneNode();this.imgElement.style.msInterpolationMode="nearest-neighbor";this.imgElement.style.width="100%";this.imgElement.style.height="100%";this.style=this.element.style;this.style.position="absolute";}
if(this.element.parentNode!=container){container.appendChild(this.element);}
if(this.imgElement.parentNode!=this.element){this.element.appendChild(this.imgElement);}
this.style.top=this.position.y+"px";this.style.left=this.position.x+"px";this.style.height=this.size.y+"px";this.style.width=this.size.x+"px";$.setElementOpacity(this.element,this.opacity);},drawCanvas:function(context,drawingHandler,scale,translate){var position=this.position.times($.pixelDensityRatio),size=this.size.times($.pixelDensityRatio),rendered;if(!this.context2D&&!this.cacheImageRecord){$.console.warn('[Tile.drawCanvas] attempting to draw tile %s when it\'s not cached',this.toString());return;}
rendered=this.context2D||this.cacheImageRecord.getRenderedContext();if(!this.loaded||!rendered){$.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());return;}
context.save();context.globalAlpha=this.opacity;if(typeof scale==='number'&&scale!==1){position=position.times(scale);size=size.times(scale);}
if(translate instanceof $.Point){position=position.plus(translate);}
if(context.globalAlpha===1&&this._hasTransparencyChannel()){context.clearRect(position.x,position.y,size.x,size.y);}
drawingHandler({context:context,tile:this,rendered:rendered});var sourceWidth,sourceHeight;if(this.sourceBounds){sourceWidth=Math.min(this.sourceBounds.width,rendered.canvas.width);sourceHeight=Math.min(this.sourceBounds.height,rendered.canvas.height);}else{sourceWidth=rendered.canvas.width;sourceHeight=rendered.canvas.height;}
context.drawImage(rendered.canvas,0,0,sourceWidth,sourceHeight,position.x,position.y,size.x,size.y);context.restore();},getScaleForEdgeSmoothing:function(){var context;if(this.cacheImageRecord){context=this.cacheImageRecord.getRenderedContext();}else if(this.context2D){context=this.context2D;}else{$.console.warn('[Tile.drawCanvas] attempting to get tile scale %s when tile\'s not cached',this.toString());return 1;}
return context.canvas.width/(this.size.x*$.pixelDensityRatio);},getTranslationForEdgeSmoothing:function(scale,canvasSize,sketchCanvasSize){var x=Math.max(1,Math.ceil((sketchCanvasSize.x-canvasSize.x)/2));var y=Math.max(1,Math.ceil((sketchCanvasSize.y-canvasSize.y)/2));return new $.Point(x,y).minus(this.position.times($.pixelDensityRatio).times(scale||1).apply(function(x){return x%1;}));},unload:function(){if(this.imgElement&&this.imgElement.parentNode){this.imgElement.parentNode.removeChild(this.imgElement);}
if(this.element&&this.element.parentNode){this.element.parentNode.removeChild(this.element);}
this.element=null;this.imgElement=null;this.loaded=false;this.loading=false;}};}(OpenSeadragon));(function($){$.OverlayPlacement=$.Placement;$.OverlayRotationMode=$.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3});$.Overlay=function(element,location,placement){var options;if($.isPlainObject(element)){options=element;}else{options={element:element,location:location,placement:placement};}
this.element=options.element;this.style=options.element.style;this._init(options);};$.Overlay.prototype={_init:function(options){this.location=options.location;this.placement=options.placement===undefined?$.Placement.TOP_LEFT:options.placement;this.onDraw=options.onDraw;this.checkResize=options.checkResize===undefined?true:options.checkResize;this.width=options.width===undefined?null:options.width;this.height=options.height===undefined?null:options.height;this.rotationMode=options.rotationMode||$.OverlayRotationMode.EXACT;if(this.location instanceof $.Rect){this.width=this.location.width;this.height=this.location.height;this.location=this.location.getTopLeft();this.placement=$.Placement.TOP_LEFT;}
this.scales=this.width!==null&&this.height!==null;this.bounds=new $.Rect(this.location.x,this.location.y,this.width,this.height);this.position=this.location;},adjust:function(position,size){var properties=$.Placement.properties[this.placement];if(!properties){return;}
if(properties.isHorizontallyCentered){position.x-=size.x/2;}else if(properties.isRight){position.x-=size.x;}
if(properties.isVerticallyCentered){position.y-=size.y/2;}else if(properties.isBottom){position.y-=size.y;}},destroy:function(){var element=this.element;var style=this.style;if(element.parentNode){element.parentNode.removeChild(element);if(element.prevElementParent){style.display='none';document.body.appendChild(element);}}
this.onDraw=null;style.top="";style.left="";style.position="";if(this.width!==null){style.width="";}
if(this.height!==null){style.height="";}
var transformOriginProp=$.getCssPropertyWithVendorPrefix('transformOrigin');var transformProp=$.getCssPropertyWithVendorPrefix('transform');if(transformOriginProp&&transformProp){style[transformOriginProp]="";style[transformProp]="";}},drawHTML:function(container,viewport){var element=this.element;if(element.parentNode!==container){element.prevElementParent=element.parentNode;element.prevNextSibling=element.nextSibling;container.appendChild(element);this.style.position="absolute";this.size=$.getElementSize(element);}
var positionAndSize=this._getOverlayPositionAndSize(viewport);var position=positionAndSize.position;var size=this.size=positionAndSize.size;var rotate=positionAndSize.rotate;if(this.onDraw){this.onDraw(position,size,this.element);}else{var style=this.style;style.left=position.x+"px";style.top=position.y+"px";if(this.width!==null){style.width=size.x+"px";}
if(this.height!==null){style.height=size.y+"px";}
var transformOriginProp=$.getCssPropertyWithVendorPrefix('transformOrigin');var transformProp=$.getCssPropertyWithVendorPrefix('transform');if(transformOriginProp&&transformProp){if(rotate){style[transformOriginProp]=this._getTransformOrigin();style[transformProp]="rotate("+rotate+"deg)";}else{style[transformOriginProp]="";style[transformProp]="";}}
if(style.display!=='none'){style.display='block';}}},_getOverlayPositionAndSize:function(viewport){var position=viewport.pixelFromPoint(this.location,true);var size=this._getSizeInPixels(viewport);this.adjust(position,size);var rotate=0;if(viewport.degrees&&this.rotationMode!==$.OverlayRotationMode.NO_ROTATION){if(this.rotationMode===$.OverlayRotationMode.BOUNDING_BOX&&this.width!==null&&this.height!==null){var rect=new $.Rect(position.x,position.y,size.x,size.y);var boundingBox=this._getBoundingBox(rect,viewport.degrees);position=boundingBox.getTopLeft();size=boundingBox.getSize();}else{rotate=viewport.degrees;}}
return{position:position,size:size,rotate:rotate};},_getSizeInPixels:function(viewport){var width=this.size.x;var height=this.size.y;if(this.width!==null||this.height!==null){var scaledSize=viewport.deltaPixelsFromPointsNoRotate(new $.Point(this.width||0,this.height||0),true);if(this.width!==null){width=scaledSize.x;}
if(this.height!==null){height=scaledSize.y;}}
if(this.checkResize&&(this.width===null||this.height===null)){var eltSize=this.size=$.getElementSize(this.element);if(this.width===null){width=eltSize.x;}
if(this.height===null){height=eltSize.y;}}
return new $.Point(width,height);},_getBoundingBox:function(rect,degrees){var refPoint=this._getPlacementPoint(rect);return rect.rotate(degrees,refPoint).getBoundingBox();},_getPlacementPoint:function(rect){var result=new $.Point(rect.x,rect.y);var properties=$.Placement.properties[this.placement];if(properties){if(properties.isHorizontallyCentered){result.x+=rect.width/2;}else if(properties.isRight){result.x+=rect.width;}
if(properties.isVerticallyCentered){result.y+=rect.height/2;}else if(properties.isBottom){result.y+=rect.height;}}
return result;},_getTransformOrigin:function(){var result="";var properties=$.Placement.properties[this.placement];if(!properties){return result;}
if(properties.isLeft){result="left";}else if(properties.isRight){result="right";}
if(properties.isTop){result+=" top";}else if(properties.isBottom){result+=" bottom";}
return result;},update:function(location,placement){var options=$.isPlainObject(location)?location:{location:location,placement:placement};this._init({location:options.location||this.location,placement:options.placement!==undefined?options.placement:this.placement,onDraw:options.onDraw||this.onDraw,checkResize:options.checkResize||this.checkResize,width:options.width!==undefined?options.width:this.width,height:options.height!==undefined?options.height:this.height,rotationMode:options.rotationMode||this.rotationMode});},getBounds:function(viewport){$.console.assert(viewport,'A viewport must now be passed to Overlay.getBounds.');var width=this.width;var height=this.height;if(width===null||height===null){var size=viewport.deltaPointsFromPixelsNoRotate(this.size,true);if(width===null){width=size.x;}
if(height===null){height=size.y;}}
var location=this.location.clone();this.adjust(location,new $.Point(width,height));return this._adjustBoundsForRotation(viewport,new $.Rect(location.x,location.y,width,height));},_adjustBoundsForRotation:function(viewport,bounds){if(!viewport||viewport.degrees===0||this.rotationMode===$.OverlayRotationMode.EXACT){return bounds;}
if(this.rotationMode===$.OverlayRotationMode.BOUNDING_BOX){if(this.width===null||this.height===null){return bounds;}
var positionAndSize=this._getOverlayPositionAndSize(viewport);return viewport.viewerElementToViewportRectangle(new $.Rect(positionAndSize.position.x,positionAndSize.position.y,positionAndSize.size.x,positionAndSize.size.y));}
return bounds.rotate(-viewport.degrees,this._getPlacementPoint(bounds));}};}(OpenSeadragon));(function($){$.Drawer=function(options){$.console.assert(options.viewer,"[Drawer] options.viewer is required");var args=arguments;if(!$.isPlainObject(options)){options={source:args[0],viewport:args[1],element:args[2]};}
$.console.assert(options.viewport,"[Drawer] options.viewport is required");$.console.assert(options.element,"[Drawer] options.element is required");if(options.source){$.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead");}
this.viewer=options.viewer;this.viewport=options.viewport;this.debugGridColor=typeof options.debugGridColor==='string'?[options.debugGridColor]:options.debugGridColor||$.DEFAULT_SETTINGS.debugGridColor;if(options.opacity){$.console.error("[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead");}
this.useCanvas=$.supportsCanvas&&(this.viewer?this.viewer.useCanvas:true);this.container=$.getElement(options.element);this.canvas=$.makeNeutralElement(this.useCanvas?"canvas":"div");this.context=this.useCanvas?this.canvas.getContext("2d"):null;this.sketchCanvas=null;this.sketchContext=null;this.element=this.container;this.container.dir='ltr';if(this.useCanvas){var viewportSize=this._calculateCanvasSize();this.canvas.width=viewportSize.x;this.canvas.height=viewportSize.y;}
this.canvas.style.width="100%";this.canvas.style.height="100%";this.canvas.style.position="absolute";$.setElementOpacity(this.canvas,this.opacity,true);this.container.style.textAlign="left";this.container.appendChild(this.canvas);this._imageSmoothingEnabled=true;};$.Drawer.prototype={addOverlay:function(element,location,placement,onDraw){$.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead.");this.viewer.addOverlay(element,location,placement,onDraw);return this;},updateOverlay:function(element,location,placement){$.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead.");this.viewer.updateOverlay(element,location,placement);return this;},removeOverlay:function(element){$.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead.");this.viewer.removeOverlay(element);return this;},clearOverlays:function(){$.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead.");this.viewer.clearOverlays();return this;},viewportCoordToDrawerCoord:function(point){var vpPoint=this.viewport.pixelFromPointNoRotate(point,true);return new $.Point(vpPoint.x*$.pixelDensityRatio,vpPoint.y*$.pixelDensityRatio);},clipWithPolygons:function(polygons,useSketch){if(!this.useCanvas){return;}
var context=this._getContext(useSketch);context.beginPath();polygons.forEach(function(polygon){polygon.forEach(function(coord,i){context[i===0?'moveTo':'lineTo'](coord.x,coord.y);});});context.clip();},setOpacity:function(opacity){$.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");var world=this.viewer.world;for(var i=0;i<world.getItemCount();i++){world.getItemAt(i).setOpacity(opacity);}
return this;},getOpacity:function(){$.console.error("drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.");var world=this.viewer.world;var maxOpacity=0;for(var i=0;i<world.getItemCount();i++){var opacity=world.getItemAt(i).getOpacity();if(opacity>maxOpacity){maxOpacity=opacity;}}
return maxOpacity;},needsUpdate:function(){$.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead.");return this.viewer.world.needsDraw();},numTilesLoaded:function(){$.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead.");return this.viewer.tileCache.numTilesLoaded();},reset:function(){$.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead.");this.viewer.world.resetItems();return this;},update:function(){$.console.error("[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead.");this.clear();this.viewer.world.draw();return this;},canRotate:function(){return this.useCanvas;},destroy:function(){this.canvas.width=1;this.canvas.height=1;this.sketchCanvas=null;this.sketchContext=null;},clear:function(){this.canvas.innerHTML="";if(this.useCanvas){var viewportSize=this._calculateCanvasSize();if(this.canvas.width!=viewportSize.x||this.canvas.height!=viewportSize.y){this.canvas.width=viewportSize.x;this.canvas.height=viewportSize.y;this._updateImageSmoothingEnabled(this.context);if(this.sketchCanvas!==null){var sketchCanvasSize=this._calculateSketchCanvasSize();this.sketchCanvas.width=sketchCanvasSize.x;this.sketchCanvas.height=sketchCanvasSize.y;this._updateImageSmoothingEnabled(this.sketchContext);}}
this._clear();}},_clear:function(useSketch,bounds){if(!this.useCanvas){return;}
var context=this._getContext(useSketch);if(bounds){context.clearRect(bounds.x,bounds.y,bounds.width,bounds.height);}else{var canvas=context.canvas;context.clearRect(0,0,canvas.width,canvas.height);}},viewportToDrawerRectangle:function(rectangle){var topLeft=this.viewport.pixelFromPointNoRotate(rectangle.getTopLeft(),true);var size=this.viewport.deltaPixelsFromPointsNoRotate(rectangle.getSize(),true);return new $.Rect(topLeft.x*$.pixelDensityRatio,topLeft.y*$.pixelDensityRatio,size.x*$.pixelDensityRatio,size.y*$.pixelDensityRatio);},drawTile:function(tile,drawingHandler,useSketch,scale,translate){$.console.assert(tile,'[Drawer.drawTile] tile is required');$.console.assert(drawingHandler,'[Drawer.drawTile] drawingHandler is required');if(this.useCanvas){var context=this._getContext(useSketch);scale=scale||1;tile.drawCanvas(context,drawingHandler,scale,translate);}else{tile.drawHTML(this.canvas);}},_getContext:function(useSketch){var context=this.context;if(useSketch){if(this.sketchCanvas===null){this.sketchCanvas=document.createElement("canvas");var sketchCanvasSize=this._calculateSketchCanvasSize();this.sketchCanvas.width=sketchCanvasSize.x;this.sketchCanvas.height=sketchCanvasSize.y;this.sketchContext=this.sketchCanvas.getContext("2d");if(this.viewport.getRotation()===0){var self=this;this.viewer.addHandler('rotate',function resizeSketchCanvas(){if(self.viewport.getRotation()===0){return;}
self.viewer.removeHandler('rotate',resizeSketchCanvas);var sketchCanvasSize=self._calculateSketchCanvasSize();self.sketchCanvas.width=sketchCanvasSize.x;self.sketchCanvas.height=sketchCanvasSize.y;});}
this._updateImageSmoothingEnabled(this.sketchContext);}
context=this.sketchContext;}
return context;},saveContext:function(useSketch){if(!this.useCanvas){return;}
this._getContext(useSketch).save();},restoreContext:function(useSketch){if(!this.useCanvas){return;}
this._getContext(useSketch).restore();},setClip:function(rect,useSketch){if(!this.useCanvas){return;}
var context=this._getContext(useSketch);context.beginPath();context.rect(rect.x,rect.y,rect.width,rect.height);context.clip();},drawRectangle:function(rect,fillStyle,useSketch){if(!this.useCanvas){return;}
var context=this._getContext(useSketch);context.save();context.fillStyle=fillStyle;context.fillRect(rect.x,rect.y,rect.width,rect.height);context.restore();},blendSketch:function(opacity,scale,translate,compositeOperation){var options=opacity;if(!$.isPlainObject(options)){options={opacity:opacity,scale:scale,translate:translate,compositeOperation:compositeOperation};}
if(!this.useCanvas||!this.sketchCanvas){return;}
opacity=options.opacity;compositeOperation=options.compositeOperation;var bounds=options.bounds;this.context.save();this.context.globalAlpha=opacity;if(compositeOperation){this.context.globalCompositeOperation=compositeOperation;}
if(bounds){if(bounds.x<0){bounds.width+=bounds.x;bounds.x=0;}
if(bounds.x+bounds.width>this.canvas.width){bounds.width=this.canvas.width-bounds.x;}
if(bounds.y<0){bounds.height+=bounds.y;bounds.y=0;}
if(bounds.y+bounds.height>this.canvas.height){bounds.height=this.canvas.height-bounds.y;}
this.context.drawImage(this.sketchCanvas,bounds.x,bounds.y,bounds.width,bounds.height,bounds.x,bounds.y,bounds.width,bounds.height);}else{scale=options.scale||1;translate=options.translate;var position=translate instanceof $.Point?translate:new $.Point(0,0);var widthExt=0;var heightExt=0;if(translate){var widthDiff=this.sketchCanvas.width-this.canvas.width;var heightDiff=this.sketchCanvas.height-this.canvas.height;widthExt=Math.round(widthDiff/2);heightExt=Math.round(heightDiff/2);}
this.context.drawImage(this.sketchCanvas,position.x-widthExt*scale,position.y-heightExt*scale,(this.canvas.width+2*widthExt)*scale,(this.canvas.height+2*heightExt)*scale,-widthExt,-heightExt,this.canvas.width+2*widthExt,this.canvas.height+2*heightExt);}
this.context.restore();},drawDebugInfo:function(tile,count,i,tiledImage){if(!this.useCanvas){return;}
var colorIndex=this.viewer.world.getIndexOfItem(tiledImage)%this.debugGridColor.length;var context=this.context;context.save();context.lineWidth=2*$.pixelDensityRatio;context.font='small-caps bold '+(13*$.pixelDensityRatio)+'px arial';context.strokeStyle=this.debugGridColor[colorIndex];context.fillStyle=this.debugGridColor[colorIndex];if(this.viewport.degrees!==0){this._offsetForRotation({degrees:this.viewport.degrees});}
if(tiledImage.getRotation(true)%360!==0){this._offsetForRotation({degrees:tiledImage.getRotation(true),point:tiledImage.viewport.pixelFromPointNoRotate(tiledImage._getRotationPoint(true),true)});}
if(tiledImage.viewport.degrees===0&&tiledImage.getRotation(true)%360===0){if(tiledImage._drawer.viewer.viewport.getFlip()){tiledImage._drawer._flip();}}
context.strokeRect(tile.position.x*$.pixelDensityRatio,tile.position.y*$.pixelDensityRatio,tile.size.x*$.pixelDensityRatio,tile.size.y*$.pixelDensityRatio);var tileCenterX=(tile.position.x+(tile.size.x/2))*$.pixelDensityRatio;var tileCenterY=(tile.position.y+(tile.size.y/2))*$.pixelDensityRatio;context.translate(tileCenterX,tileCenterY);context.rotate(Math.PI/180* -this.viewport.degrees);context.translate(-tileCenterX,-tileCenterY);if(tile.x===0&&tile.y===0){context.fillText("Zoom: "+this.viewport.getZoom(),tile.position.x*$.pixelDensityRatio,(tile.position.y-30)*$.pixelDensityRatio);context.fillText("Pan: "+this.viewport.getBounds().toString(),tile.position.x*$.pixelDensityRatio,(tile.position.y-20)*$.pixelDensityRatio);}
context.fillText("Level: "+tile.level,(tile.position.x+10)*$.pixelDensityRatio,(tile.position.y+20)*$.pixelDensityRatio);context.fillText("Column: "+tile.x,(tile.position.x+10)*$.pixelDensityRatio,(tile.position.y+30)*$.pixelDensityRatio);context.fillText("Row: "+tile.y,(tile.position.x+10)*$.pixelDensityRatio,(tile.position.y+40)*$.pixelDensityRatio);context.fillText("Order: "+i+" of "+count,(tile.position.x+10)*$.pixelDensityRatio,(tile.position.y+50)*$.pixelDensityRatio);context.fillText("Size: "+tile.size.toString(),(tile.position.x+10)*$.pixelDensityRatio,(tile.position.y+60)*$.pixelDensityRatio);context.fillText("Position: "+tile.position.toString(),(tile.position.x+10)*$.pixelDensityRatio,(tile.position.y+70)*$.pixelDensityRatio);if(this.viewport.degrees!==0){this._restoreRotationChanges();}
if(tiledImage.getRotation(true)%360!==0){this._restoreRotationChanges();}
if(tiledImage.viewport.degrees===0&&tiledImage.getRotation(true)%360===0){if(tiledImage._drawer.viewer.viewport.getFlip()){tiledImage._drawer._flip();}}
context.restore();},debugRect:function(rect){if(this.useCanvas){var context=this.context;context.save();context.lineWidth=2*$.pixelDensityRatio;context.strokeStyle=this.debugGridColor[0];context.fillStyle=this.debugGridColor[0];context.strokeRect(rect.x*$.pixelDensityRatio,rect.y*$.pixelDensityRatio,rect.width*$.pixelDensityRatio,rect.height*$.pixelDensityRatio);context.restore();}},setImageSmoothingEnabled:function(imageSmoothingEnabled){if(this.useCanvas){this._imageSmoothingEnabled=imageSmoothingEnabled;this._updateImageSmoothingEnabled(this.context);this.viewer.forceRedraw();}},_updateImageSmoothingEnabled:function(context){context.msImageSmoothingEnabled=this._imageSmoothingEnabled;context.imageSmoothingEnabled=this._imageSmoothingEnabled;},getCanvasSize:function(sketch){var canvas=this._getContext(sketch).canvas;return new $.Point(canvas.width,canvas.height);},getCanvasCenter:function(){return new $.Point(this.canvas.width/2,this.canvas.height/2);},_offsetForRotation:function(options){var point=options.point?options.point.times($.pixelDensityRatio):this.getCanvasCenter();var context=this._getContext(options.useSketch);context.save();context.translate(point.x,point.y);if(this.viewer.viewport.flipped){context.rotate(Math.PI/180* -options.degrees);context.scale(-1,1);}else{context.rotate(Math.PI/180*options.degrees);}
context.translate(-point.x,-point.y);},_flip:function(options){options=options||{};var point=options.point?options.point.times($.pixelDensityRatio):this.getCanvasCenter();var context=this._getContext(options.useSketch);context.translate(point.x,0);context.scale(-1,1);context.translate(-point.x,0);},_restoreRotationChanges:function(useSketch){var context=this._getContext(useSketch);context.restore();},_calculateCanvasSize:function(){var pixelDensityRatio=$.pixelDensityRatio;var viewportSize=this.viewport.getContainerSize();return{x:Math.round(viewportSize.x*pixelDensityRatio),y:Math.round(viewportSize.y*pixelDensityRatio)};},_calculateSketchCanvasSize:function(){var canvasSize=this._calculateCanvasSize();if(this.viewport.getRotation()===0){return canvasSize;}
var sketchCanvasSize=Math.ceil(Math.sqrt(canvasSize.x*canvasSize.x+
canvasSize.y*canvasSize.y));return{x:sketchCanvasSize,y:sketchCanvasSize};}};}(OpenSeadragon));(function($){$.Viewport=function(options){var args=arguments;if(args.length&&args[0]instanceof $.Point){options={containerSize:args[0],contentSize:args[1],config:args[2]};}
if(options.config){$.extend(true,options,options.config);delete options.config;}
this._margins=$.extend({left:0,top:0,right:0,bottom:0},options.margins||{});delete options.margins;$.extend(true,this,{containerSize:null,contentSize:null,zoomPoint:null,viewer:null,springStiffness:$.DEFAULT_SETTINGS.springStiffness,animationTime:$.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:$.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:$.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:$.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:$.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:$.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:$.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:$.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:$.DEFAULT_SETTINGS.maxZoomLevel,degrees:$.DEFAULT_SETTINGS.degrees,flipped:$.DEFAULT_SETTINGS.flipped,homeFillsViewer:$.DEFAULT_SETTINGS.homeFillsViewer},options);this._updateContainerInnerSize();this.centerSpringX=new $.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.centerSpringY=new $.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.zoomSpring=new $.Spring({exponential:true,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime});this._oldCenterX=this.centerSpringX.current.value;this._oldCenterY=this.centerSpringY.current.value;this._oldZoom=this.zoomSpring.current.value;this._setContentBounds(new $.Rect(0,0,1,1),1);this.goHome(true);this.update();};$.Viewport.prototype={resetContentSize:function(contentSize){$.console.assert(contentSize,"[Viewport.resetContentSize] contentSize is required");$.console.assert(contentSize instanceof $.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point");$.console.assert(contentSize.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0");$.console.assert(contentSize.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0");this._setContentBounds(new $.Rect(0,0,1,contentSize.y/contentSize.x),contentSize.x);return this;},setHomeBounds:function(bounds,contentFactor){$.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually.");this._setContentBounds(bounds,contentFactor);},_setContentBounds:function(bounds,contentFactor){$.console.assert(bounds,"[Viewport._setContentBounds] bounds is required");$.console.assert(bounds instanceof $.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect");$.console.assert(bounds.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0");$.console.assert(bounds.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0");this._contentBoundsNoRotate=bounds.clone();this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(contentFactor);this._contentBounds=bounds.rotate(this.degrees).getBoundingBox();this._contentSize=this._contentBounds.getSize().times(contentFactor);this._contentAspectRatio=this._contentSize.x/this._contentSize.y;if(this.viewer){this.viewer.raiseEvent('reset-size',{contentSize:this._contentSizeNoRotate.clone(),contentFactor:contentFactor,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()});}},getHomeZoom:function(){if(this.defaultZoomLevel){return this.defaultZoomLevel;}
var aspectFactor=this._contentAspectRatio/this.getAspectRatio();var output;if(this.homeFillsViewer){output=aspectFactor>=1?aspectFactor:1;}else{output=aspectFactor>=1?1:aspectFactor;}
return output/this._contentBounds.width;},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation());},getHomeBoundsNoRotate:function(){var center=this._contentBounds.getCenter();var width=1.0/this.getHomeZoom();var height=width/this.getAspectRatio();return new $.Rect(center.x-(width/2.0),center.y-(height/2.0),width,height);},goHome:function(immediately){if(this.viewer){this.viewer.raiseEvent('home',{immediately:immediately});}
return this.fitBounds(this.getHomeBounds(),immediately);},getMinZoom:function(){var homeZoom=this.getHomeZoom(),zoom=this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*homeZoom;return zoom;},getMaxZoom:function(){var zoom=this.maxZoomLevel;if(!zoom){zoom=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x;zoom/=this._contentBounds.width;}
return Math.max(zoom,this.getHomeZoom());},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y;},getContainerSize:function(){return new $.Point(this.containerSize.x,this.containerSize.y);},getMargins:function(){return $.extend({},this._margins);},setMargins:function(margins){$.console.assert($.type(margins)==='object','[Viewport.setMargins] margins must be an object');this._margins=$.extend({left:0,top:0,right:0,bottom:0},margins);this._updateContainerInnerSize();if(this.viewer){this.viewer.forceRedraw();}},getBounds:function(current){return this.getBoundsNoRotate(current).rotate(-this.getRotation());},getBoundsNoRotate:function(current){var center=this.getCenter(current);var width=1.0/this.getZoom(current);var height=width/this.getAspectRatio();return new $.Rect(center.x-(width/2.0),center.y-(height/2.0),width,height);},getBoundsWithMargins:function(current){return this.getBoundsNoRotateWithMargins(current).rotate(-this.getRotation(),this.getCenter(current));},getBoundsNoRotateWithMargins:function(current){var bounds=this.getBoundsNoRotate(current);var factor=this._containerInnerSize.x*this.getZoom(current);bounds.x-=this._margins.left/factor;bounds.y-=this._margins.top/factor;bounds.width+=(this._margins.left+this._margins.right)/factor;bounds.height+=(this._margins.top+this._margins.bottom)/factor;return bounds;},getCenter:function(current){var centerCurrent=new $.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),centerTarget=new $.Point(this.centerSpringX.target.value,this.centerSpringY.target.value),oldZoomPixel,zoom,width,height,bounds,newZoomPixel,deltaZoomPixels,deltaZoomPoints;if(current){return centerCurrent;}else if(!this.zoomPoint){return centerTarget;}
oldZoomPixel=this.pixelFromPoint(this.zoomPoint,true);zoom=this.getZoom();width=1.0/zoom;height=width/this.getAspectRatio();bounds=new $.Rect(centerCurrent.x-width/2.0,centerCurrent.y-height/2.0,width,height);newZoomPixel=this._pixelFromPoint(this.zoomPoint,bounds);deltaZoomPixels=newZoomPixel.minus(oldZoomPixel);deltaZoomPoints=deltaZoomPixels.divide(this._containerInnerSize.x*zoom);return centerTarget.plus(deltaZoomPoints);},getZoom:function(current){if(current){return this.zoomSpring.current.value;}else{return this.zoomSpring.target.value;}},_applyZoomConstraints:function(zoom){return Math.max(Math.min(zoom,this.getMaxZoom()),this.getMinZoom());},_applyBoundaryConstraints:function(bounds){var newBounds=new $.Rect(bounds.x,bounds.y,bounds.width,bounds.height);if(this.wrapHorizontal){}else{var horizontalThreshold=this.visibilityRatio*newBounds.width;var boundsRight=newBounds.x+newBounds.width;var contentRight=this._contentBoundsNoRotate.x+this._contentBoundsNoRotate.width;var leftDx=this._contentBoundsNoRotate.x-boundsRight+horizontalThreshold;var rightDx=contentRight-newBounds.x-horizontalThreshold;if(horizontalThreshold>this._contentBoundsNoRotate.width){newBounds.x+=(leftDx+rightDx)/2;}else if(rightDx<0){newBounds.x+=rightDx;}else if(leftDx>0){newBounds.x+=leftDx;}}
if(this.wrapVertical){}else{var verticalThreshold=this.visibilityRatio*newBounds.height;var boundsBottom=newBounds.y+newBounds.height;var contentBottom=this._contentBoundsNoRotate.y+this._contentBoundsNoRotate.height;var topDy=this._contentBoundsNoRotate.y-boundsBottom+verticalThreshold;var bottomDy=contentBottom-newBounds.y-verticalThreshold;if(verticalThreshold>this._contentBoundsNoRotate.height){newBounds.y+=(topDy+bottomDy)/2;}else if(bottomDy<0){newBounds.y+=bottomDy;}else if(topDy>0){newBounds.y+=topDy;}}
return newBounds;},_raiseConstraintsEvent:function(immediately){if(this.viewer){this.viewer.raiseEvent('constrain',{immediately:immediately});}},applyConstraints:function(immediately){var actualZoom=this.getZoom();var constrainedZoom=this._applyZoomConstraints(actualZoom);if(actualZoom!==constrainedZoom){this.zoomTo(constrainedZoom,this.zoomPoint,immediately);}
var bounds=this.getBoundsNoRotate();var constrainedBounds=this._applyBoundaryConstraints(bounds);this._raiseConstraintsEvent(immediately);if(bounds.x!==constrainedBounds.x||bounds.y!==constrainedBounds.y||immediately){this.fitBounds(constrainedBounds.rotate(-this.getRotation()),immediately);}
return this;},ensureVisible:function(immediately){return this.applyConstraints(immediately);},_fitBounds:function(bounds,options){options=options||{};var immediately=options.immediately||false;var constraints=options.constraints||false;var aspect=this.getAspectRatio();var center=bounds.getCenter();var newBounds=new $.Rect(bounds.x,bounds.y,bounds.width,bounds.height,bounds.degrees+this.getRotation()).getBoundingBox();if(newBounds.getAspectRatio()>=aspect){newBounds.height=newBounds.width/aspect;}else{newBounds.width=newBounds.height*aspect;}
newBounds.x=center.x-newBounds.width/2;newBounds.y=center.y-newBounds.height/2;var newZoom=1.0/newBounds.width;if(constraints){var newBoundsAspectRatio=newBounds.getAspectRatio();var newConstrainedZoom=this._applyZoomConstraints(newZoom);if(newZoom!==newConstrainedZoom){newZoom=newConstrainedZoom;newBounds.width=1.0/newZoom;newBounds.x=center.x-newBounds.width/2;newBounds.height=newBounds.width/newBoundsAspectRatio;newBounds.y=center.y-newBounds.height/2;}
newBounds=this._applyBoundaryConstraints(newBounds);center=newBounds.getCenter();this._raiseConstraintsEvent(immediately);}
if(immediately){this.panTo(center,true);return this.zoomTo(newZoom,null,true);}
this.panTo(this.getCenter(true),true);this.zoomTo(this.getZoom(true),null,true);var oldBounds=this.getBounds();var oldZoom=this.getZoom();if(oldZoom===0||Math.abs(newZoom/oldZoom-1)<0.00000001){this.zoomTo(newZoom,true);return this.panTo(center,immediately);}
newBounds=newBounds.rotate(-this.getRotation());var referencePoint=newBounds.getTopLeft().times(newZoom).minus(oldBounds.getTopLeft().times(oldZoom)).divide(newZoom-oldZoom);return this.zoomTo(newZoom,referencePoint,immediately);},fitBounds:function(bounds,immediately){return this._fitBounds(bounds,{immediately:immediately,constraints:false});},fitBoundsWithConstraints:function(bounds,immediately){return this._fitBounds(bounds,{immediately:immediately,constraints:true});},fitVertically:function(immediately){var box=new $.Rect(this._contentBounds.x+(this._contentBounds.width/2),this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(box,immediately);},fitHorizontally:function(immediately){var box=new $.Rect(this._contentBounds.x,this._contentBounds.y+(this._contentBounds.height/2),this._contentBounds.width,0);return this.fitBounds(box,immediately);},getConstrainedBounds:function(current){var bounds,constrainedBounds;bounds=this.getBounds(current);constrainedBounds=this._applyBoundaryConstraints(bounds);return constrainedBounds;},panBy:function(delta,immediately){var center=new $.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(center.plus(delta),immediately);},panTo:function(center,immediately){if(immediately){this.centerSpringX.resetTo(center.x);this.centerSpringY.resetTo(center.y);}else{this.centerSpringX.springTo(center.x);this.centerSpringY.springTo(center.y);}
if(this.viewer){this.viewer.raiseEvent('pan',{center:center,immediately:immediately});}
return this;},zoomBy:function(factor,refPoint,immediately){return this.zoomTo(this.zoomSpring.target.value*factor,refPoint,immediately);},zoomTo:function(zoom,refPoint,immediately){var _this=this;this.zoomPoint=refPoint instanceof $.Point&&!isNaN(refPoint.x)&&!isNaN(refPoint.y)?refPoint:null;if(immediately){this._adjustCenterSpringsForZoomPoint(function(){_this.zoomSpring.resetTo(zoom);});}else{this.zoomSpring.springTo(zoom);}
if(this.viewer){this.viewer.raiseEvent('zoom',{zoom:zoom,refPoint:refPoint,immediately:immediately});}
return this;},setRotation:function(degrees){if(!this.viewer||!this.viewer.drawer.canRotate()){return this;}
this.degrees=$.positiveModulo(degrees,360);this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor());this.viewer.forceRedraw();this.viewer.raiseEvent('rotate',{"degrees":degrees});return this;},getRotation:function(){return this.degrees;},resize:function(newContainerSize,maintain){var oldBounds=this.getBoundsNoRotate(),newBounds=oldBounds,widthDeltaFactor;this.containerSize.x=newContainerSize.x;this.containerSize.y=newContainerSize.y;this._updateContainerInnerSize();if(maintain){widthDeltaFactor=newContainerSize.x/this.containerSize.x;newBounds.width=oldBounds.width*widthDeltaFactor;newBounds.height=newBounds.width/this.getAspectRatio();}
if(this.viewer){this.viewer.raiseEvent('resize',{newContainerSize:newContainerSize,maintain:maintain});}
return this.fitBounds(newBounds,true);},_updateContainerInnerSize:function(){this._containerInnerSize=new $.Point(Math.max(1,this.containerSize.x-(this._margins.left+this._margins.right)),Math.max(1,this.containerSize.y-(this._margins.top+this._margins.bottom)));},update:function(){var _this=this;this._adjustCenterSpringsForZoomPoint(function(){_this.zoomSpring.update();});this.centerSpringX.update();this.centerSpringY.update();var changed=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom;this._oldCenterX=this.centerSpringX.current.value;this._oldCenterY=this.centerSpringY.current.value;this._oldZoom=this.zoomSpring.current.value;return changed;},_adjustCenterSpringsForZoomPoint:function(zoomSpringHandler){if(this.zoomPoint){var oldZoomPixel=this.pixelFromPoint(this.zoomPoint,true);zoomSpringHandler();var newZoomPixel=this.pixelFromPoint(this.zoomPoint,true);var deltaZoomPixels=newZoomPixel.minus(oldZoomPixel);var deltaZoomPoints=this.deltaPointsFromPixels(deltaZoomPixels,true);this.centerSpringX.shiftBy(deltaZoomPoints.x);this.centerSpringY.shiftBy(deltaZoomPoints.y);if(this.zoomSpring.isAtTargetValue()){this.zoomPoint=null;}}else{zoomSpringHandler();}},deltaPixelsFromPointsNoRotate:function(deltaPoints,current){return deltaPoints.times(this._containerInnerSize.x*this.getZoom(current));},deltaPixelsFromPoints:function(deltaPoints,current){return this.deltaPixelsFromPointsNoRotate(deltaPoints.rotate(this.getRotation()),current);},deltaPointsFromPixelsNoRotate:function(deltaPixels,current){return deltaPixels.divide(this._containerInnerSize.x*this.getZoom(current));},deltaPointsFromPixels:function(deltaPixels,current){return this.deltaPointsFromPixelsNoRotate(deltaPixels,current).rotate(-this.getRotation());},pixelFromPointNoRotate:function(point,current){return this._pixelFromPointNoRotate(point,this.getBoundsNoRotate(current));},pixelFromPoint:function(point,current){return this._pixelFromPoint(point,this.getBoundsNoRotate(current));},_pixelFromPointNoRotate:function(point,bounds){return point.minus(bounds.getTopLeft()).times(this._containerInnerSize.x/bounds.width).plus(new $.Point(this._margins.left,this._margins.top));},_pixelFromPoint:function(point,bounds){return this._pixelFromPointNoRotate(point.rotate(this.getRotation(),this.getCenter(true)),bounds);},pointFromPixelNoRotate:function(pixel,current){var bounds=this.getBoundsNoRotate(current);return pixel.minus(new $.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/bounds.width).plus(bounds.getTopLeft());},pointFromPixel:function(pixel,current){return this.pointFromPixelNoRotate(pixel,current).rotate(-this.getRotation(),this.getCenter(true));},_viewportToImageDelta:function(viewerX,viewerY){var scale=this._contentBoundsNoRotate.width;return new $.Point(viewerX*this._contentSizeNoRotate.x/scale,viewerY*this._contentSizeNoRotate.x/scale);},viewportToImageCoordinates:function(viewerX,viewerY){if(viewerX instanceof $.Point){return this.viewportToImageCoordinates(viewerX.x,viewerX.y);}
if(this.viewer){var count=this.viewer.world.getItemCount();if(count>1){$.console.error('[Viewport.viewportToImageCoordinates] is not accurate '+'with multi-image; use TiledImage.viewportToImageCoordinates instead.');}else if(count===1){var item=this.viewer.world.getItemAt(0);return item.viewportToImageCoordinates(viewerX,viewerY,true);}}
return this._viewportToImageDelta(viewerX-this._contentBoundsNoRotate.x,viewerY-this._contentBoundsNoRotate.y);},_imageToViewportDelta:function(imageX,imageY){var scale=this._contentBoundsNoRotate.width;return new $.Point(imageX/this._contentSizeNoRotate.x*scale,imageY/this._contentSizeNoRotate.x*scale);},imageToViewportCoordinates:function(imageX,imageY){if(imageX instanceof $.Point){return this.imageToViewportCoordinates(imageX.x,imageX.y);}
if(this.viewer){var count=this.viewer.world.getItemCount();if(count>1){$.console.error('[Viewport.imageToViewportCoordinates] is not accurate '+'with multi-image; use TiledImage.imageToViewportCoordinates instead.');}else if(count===1){var item=this.viewer.world.getItemAt(0);return item.imageToViewportCoordinates(imageX,imageY,true);}}
var point=this._imageToViewportDelta(imageX,imageY);point.x+=this._contentBoundsNoRotate.x;point.y+=this._contentBoundsNoRotate.y;return point;},imageToViewportRectangle:function(imageX,imageY,pixelWidth,pixelHeight){var rect=imageX;if(!(rect instanceof $.Rect)){rect=new $.Rect(imageX,imageY,pixelWidth,pixelHeight);}
if(this.viewer){var count=this.viewer.world.getItemCount();if(count>1){$.console.error('[Viewport.imageToViewportRectangle] is not accurate '+'with multi-image; use TiledImage.imageToViewportRectangle instead.');}else if(count===1){var item=this.viewer.world.getItemAt(0);return item.imageToViewportRectangle(imageX,imageY,pixelWidth,pixelHeight,true);}}
var coordA=this.imageToViewportCoordinates(rect.x,rect.y);var coordB=this._imageToViewportDelta(rect.width,rect.height);return new $.Rect(coordA.x,coordA.y,coordB.x,coordB.y,rect.degrees);},viewportToImageRectangle:function(viewerX,viewerY,pointWidth,pointHeight){var rect=viewerX;if(!(rect instanceof $.Rect)){rect=new $.Rect(viewerX,viewerY,pointWidth,pointHeight);}
if(this.viewer){var count=this.viewer.world.getItemCount();if(count>1){$.console.error('[Viewport.viewportToImageRectangle] is not accurate '+'with multi-image; use TiledImage.viewportToImageRectangle instead.');}else if(count===1){var item=this.viewer.world.getItemAt(0);return item.viewportToImageRectangle(viewerX,viewerY,pointWidth,pointHeight,true);}}
var coordA=this.viewportToImageCoordinates(rect.x,rect.y);var coordB=this._viewportToImageDelta(rect.width,rect.height);return new $.Rect(coordA.x,coordA.y,coordB.x,coordB.y,rect.degrees);},viewerElementToImageCoordinates:function(pixel){var point=this.pointFromPixel(pixel,true);return this.viewportToImageCoordinates(point);},imageToViewerElementCoordinates:function(pixel){var point=this.imageToViewportCoordinates(pixel);return this.pixelFromPoint(point,true);},windowToImageCoordinates:function(pixel){$.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var viewerCoordinates=pixel.minus($.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(viewerCoordinates);},imageToWindowCoordinates:function(pixel){$.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");var viewerCoordinates=this.imageToViewerElementCoordinates(pixel);return viewerCoordinates.plus($.getElementPosition(this.viewer.element));},viewerElementToViewportCoordinates:function(pixel){return this.pointFromPixel(pixel,true);},viewportToViewerElementCoordinates:function(point){return this.pixelFromPoint(point,true);},viewerElementToViewportRectangle:function(rectangle){return $.Rect.fromSummits(this.pointFromPixel(rectangle.getTopLeft(),true),this.pointFromPixel(rectangle.getTopRight(),true),this.pointFromPixel(rectangle.getBottomLeft(),true));},viewportToViewerElementRectangle:function(rectangle){return $.Rect.fromSummits(this.pixelFromPoint(rectangle.getTopLeft(),true),this.pixelFromPoint(rectangle.getTopRight(),true),this.pixelFromPoint(rectangle.getBottomLeft(),true));},windowToViewportCoordinates:function(pixel){$.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var viewerCoordinates=pixel.minus($.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(viewerCoordinates);},viewportToWindowCoordinates:function(point){$.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");var viewerCoordinates=this.viewportToViewerElementCoordinates(point);return viewerCoordinates.plus($.getElementPosition(this.viewer.element));},viewportToImageZoom:function(viewportZoom){if(this.viewer){var count=this.viewer.world.getItemCount();if(count>1){$.console.error('[Viewport.viewportToImageZoom] is not '+'accurate with multi-image.');}else if(count===1){var item=this.viewer.world.getItemAt(0);return item.viewportToImageZoom(viewportZoom);}}
var imageWidth=this._contentSizeNoRotate.x;var containerWidth=this._containerInnerSize.x;var scale=this._contentBoundsNoRotate.width;var viewportToImageZoomRatio=(containerWidth/imageWidth)*scale;return viewportZoom*viewportToImageZoomRatio;},imageToViewportZoom:function(imageZoom){if(this.viewer){var count=this.viewer.world.getItemCount();if(count>1){$.console.error('[Viewport.imageToViewportZoom] is not accurate '+'with multi-image.');}else if(count===1){var item=this.viewer.world.getItemAt(0);return item.imageToViewportZoom(imageZoom);}}
var imageWidth=this._contentSizeNoRotate.x;var containerWidth=this._containerInnerSize.x;var scale=this._contentBoundsNoRotate.width;var viewportToImageZoomRatio=(imageWidth/containerWidth)/scale;return imageZoom*viewportToImageZoomRatio;},toggleFlip:function(){this.setFlip(!this.getFlip());return this;},getFlip:function(){return this.flipped;},setFlip:function(state){if(this.flipped===state){return this;}
this.flipped=state;if(this.viewer.navigator){this.viewer.navigator.setFlip(this.getFlip());}
this.viewer.forceRedraw();this.viewer.raiseEvent('flip',{"flipped":state});return this;}};}(OpenSeadragon));(function($){$.TiledImage=function(options){var _this=this;$.console.assert(options.tileCache,"[TiledImage] options.tileCache is required");$.console.assert(options.drawer,"[TiledImage] options.drawer is required");$.console.assert(options.viewer,"[TiledImage] options.viewer is required");$.console.assert(options.imageLoader,"[TiledImage] options.imageLoader is required");$.console.assert(options.source,"[TiledImage] options.source is required");$.console.assert(!options.clip||options.clip instanceof $.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present");$.EventSource.call(this);this._tileCache=options.tileCache;delete options.tileCache;this._drawer=options.drawer;delete options.drawer;this._imageLoader=options.imageLoader;delete options.imageLoader;if(options.clip instanceof $.Rect){this._clip=options.clip.clone();}
delete options.clip;var x=options.x||0;delete options.x;var y=options.y||0;delete options.y;this.normHeight=options.source.dimensions.y/options.source.dimensions.x;this.contentAspectX=options.source.dimensions.x/options.source.dimensions.y;var scale=1;if(options.width){scale=options.width;delete options.width;if(options.height){$.console.error("specifying both width and height to a tiledImage is not supported");delete options.height;}}else if(options.height){scale=options.height/this.normHeight;delete options.height;}
var fitBounds=options.fitBounds;delete options.fitBounds;var fitBoundsPlacement=options.fitBoundsPlacement||OpenSeadragon.Placement.CENTER;delete options.fitBoundsPlacement;var degrees=options.degrees||0;delete options.degrees;$.extend(true,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:false,_needsDraw:true,_hasOpaqueTile:false,_tilesLoading:0,springStiffness:$.DEFAULT_SETTINGS.springStiffness,animationTime:$.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:$.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:$.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:$.DEFAULT_SETTINGS.wrapVertical,immediateRender:$.DEFAULT_SETTINGS.immediateRender,blendTime:$.DEFAULT_SETTINGS.blendTime,alwaysBlend:$.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:$.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:$.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:$.DEFAULT_SETTINGS.iOSDevice,debugMode:$.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:$.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:$.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:$.DEFAULT_SETTINGS.placeholderFillStyle,opacity:$.DEFAULT_SETTINGS.opacity,preload:$.DEFAULT_SETTINGS.preload,compositeOperation:$.DEFAULT_SETTINGS.compositeOperation},options);this._preload=this.preload;delete this.preload;this._fullyLoaded=false;this._xSpring=new $.Spring({initial:x,springStiffness:this.springStiffness,animationTime:this.animationTime});this._ySpring=new $.Spring({initial:y,springStiffness:this.springStiffness,animationTime:this.animationTime});this._scaleSpring=new $.Spring({initial:scale,springStiffness:this.springStiffness,animationTime:this.animationTime});this._degreesSpring=new $.Spring({initial:degrees,springStiffness:this.springStiffness,animationTime:this.animationTime});this._updateForScale();if(fitBounds){this.fitBounds(fitBounds,fitBoundsPlacement,true);}
this._drawingHandler=function(args){_this.viewer.raiseEvent('tile-drawing',$.extend({tiledImage:_this},args));};};$.extend($.TiledImage.prototype,$.EventSource.prototype,{needsDraw:function(){return this._needsDraw;},getFullyLoaded:function(){return this._fullyLoaded;},_setFullyLoaded:function(flag){if(flag===this._fullyLoaded){return;}
this._fullyLoaded=flag;this.raiseEvent('fully-loaded-change',{fullyLoaded:this._fullyLoaded});},reset:function(){this._tileCache.clearTilesFor(this);this.lastResetTime=$.now();this._needsDraw=true;},update:function(){var xUpdated=this._xSpring.update();var yUpdated=this._ySpring.update();var scaleUpdated=this._scaleSpring.update();var degreesUpdated=this._degreesSpring.update();if(xUpdated||yUpdated||scaleUpdated||degreesUpdated){this._updateForScale();this._needsDraw=true;return true;}
return false;},draw:function(){if(this.opacity!==0||this._preload){this._midDraw=true;this._updateViewport();this._midDraw=false;}
else{this._needsDraw=false;}},destroy:function(){this.reset();},getBounds:function(current){return this.getBoundsNoRotate(current).rotate(this.getRotation(current),this._getRotationPoint(current));},getBoundsNoRotate:function(current){return current?new $.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new $.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget);},getWorldBounds:function(){$.console.error('[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead');return this.getBounds();},getClippedBounds:function(current){var bounds=this.getBoundsNoRotate(current);if(this._clip){var worldWidth=current?this._worldWidthCurrent:this._worldWidthTarget;var ratio=worldWidth/this.source.dimensions.x;var clip=this._clip.times(ratio);bounds=new $.Rect(bounds.x+clip.x,bounds.y+clip.y,clip.width,clip.height);}
return bounds.rotate(this.getRotation(current),this._getRotationPoint(current));},getContentSize:function(){return new $.Point(this.source.dimensions.x,this.source.dimensions.y);},_viewportToImageDelta:function(viewerX,viewerY,current){var scale=(current?this._scaleSpring.current.value:this._scaleSpring.target.value);return new $.Point(viewerX*(this.source.dimensions.x/scale),viewerY*((this.source.dimensions.y*this.contentAspectX)/scale));},viewportToImageCoordinates:function(viewerX,viewerY,current){var point;if(viewerX instanceof $.Point){current=viewerY;point=viewerX;}else{point=new $.Point(viewerX,viewerY);}
point=point.rotate(-this.getRotation(current),this._getRotationPoint(current));return current?this._viewportToImageDelta(point.x-this._xSpring.current.value,point.y-this._ySpring.current.value):this._viewportToImageDelta(point.x-this._xSpring.target.value,point.y-this._ySpring.target.value);},_imageToViewportDelta:function(imageX,imageY,current){var scale=(current?this._scaleSpring.current.value:this._scaleSpring.target.value);return new $.Point((imageX/this.source.dimensions.x)*scale,(imageY/this.source.dimensions.y/this.contentAspectX)*scale);},imageToViewportCoordinates:function(imageX,imageY,current){if(imageX instanceof $.Point){current=imageY;imageY=imageX.y;imageX=imageX.x;}
var point=this._imageToViewportDelta(imageX,imageY);if(current){point.x+=this._xSpring.current.value;point.y+=this._ySpring.current.value;}else{point.x+=this._xSpring.target.value;point.y+=this._ySpring.target.value;}
return point.rotate(this.getRotation(current),this._getRotationPoint(current));},imageToViewportRectangle:function(imageX,imageY,pixelWidth,pixelHeight,current){var rect=imageX;if(rect instanceof $.Rect){current=imageY;}else{rect=new $.Rect(imageX,imageY,pixelWidth,pixelHeight);}
var coordA=this.imageToViewportCoordinates(rect.getTopLeft(),current);var coordB=this._imageToViewportDelta(rect.width,rect.height,current);return new $.Rect(coordA.x,coordA.y,coordB.x,coordB.y,rect.degrees+this.getRotation(current));},viewportToImageRectangle:function(viewerX,viewerY,pointWidth,pointHeight,current){var rect=viewerX;if(viewerX instanceof $.Rect){current=viewerY;}else{rect=new $.Rect(viewerX,viewerY,pointWidth,pointHeight);}
var coordA=this.viewportToImageCoordinates(rect.getTopLeft(),current);var coordB=this._viewportToImageDelta(rect.width,rect.height,current);return new $.Rect(coordA.x,coordA.y,coordB.x,coordB.y,rect.degrees-this.getRotation(current));},viewerElementToImageCoordinates:function(pixel){var point=this.viewport.pointFromPixel(pixel,true);return this.viewportToImageCoordinates(point);},imageToViewerElementCoordinates:function(pixel){var point=this.imageToViewportCoordinates(pixel);return this.viewport.pixelFromPoint(point,true);},windowToImageCoordinates:function(pixel){var viewerCoordinates=pixel.minus(OpenSeadragon.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(viewerCoordinates);},imageToWindowCoordinates:function(pixel){var viewerCoordinates=this.imageToViewerElementCoordinates(pixel);return viewerCoordinates.plus(OpenSeadragon.getElementPosition(this.viewer.element));},_viewportToTiledImageRectangle:function(rect){var scale=this._scaleSpring.current.value;rect=rect.rotate(-this.getRotation(true),this._getRotationPoint(true));return new $.Rect((rect.x-this._xSpring.current.value)/scale,(rect.y-this._ySpring.current.value)/scale,rect.width/scale,rect.height/scale,rect.degrees);},viewportToImageZoom:function(viewportZoom){var ratio=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return ratio*viewportZoom;},imageToViewportZoom:function(imageZoom){var ratio=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return imageZoom/ratio;},setPosition:function(position,immediately){var sameTarget=(this._xSpring.target.value===position.x&&this._ySpring.target.value===position.y);if(immediately){if(sameTarget&&this._xSpring.current.value===position.x&&this._ySpring.current.value===position.y){return;}
this._xSpring.resetTo(position.x);this._ySpring.resetTo(position.y);this._needsDraw=true;}else{if(sameTarget){return;}
this._xSpring.springTo(position.x);this._ySpring.springTo(position.y);this._needsDraw=true;}
if(!sameTarget){this._raiseBoundsChange();}},setWidth:function(width,immediately){this._setScale(width,immediately);},setHeight:function(height,immediately){this._setScale(height/this.normHeight,immediately);},setCroppingPolygons:function(polygons){var isXYObject=function(obj){return obj instanceof $.Point||(typeof obj.x==='number'&&typeof obj.y==='number');};var objectToSimpleXYObject=function(objs){return objs.map(function(obj){try{if(isXYObject(obj)){return{x:obj.x,y:obj.y};}else{throw new Error();}}catch(e){throw new Error('A Provided cropping polygon point is not supported');}});};try{if(!$.isArray(polygons)){throw new Error('Provided cropping polygon is not an array');}
this._croppingPolygons=polygons.map(function(polygon){return objectToSimpleXYObject(polygon);});}catch(e){$.console.error('[TiledImage.setCroppingPolygons] Cropping polygon format not supported');$.console.error(e);this._croppingPolygons=null;}},resetCroppingPolygons:function(){this._croppingPolygons=null;},fitBounds:function(bounds,anchor,immediately){anchor=anchor||$.Placement.CENTER;var anchorProperties=$.Placement.properties[anchor];var aspectRatio=this.contentAspectX;var xOffset=0;var yOffset=0;var displayedWidthRatio=1;var displayedHeightRatio=1;if(this._clip){aspectRatio=this._clip.getAspectRatio();displayedWidthRatio=this._clip.width/this.source.dimensions.x;displayedHeightRatio=this._clip.height/this.source.dimensions.y;if(bounds.getAspectRatio()>aspectRatio){xOffset=this._clip.x/this._clip.height*bounds.height;yOffset=this._clip.y/this._clip.height*bounds.height;}else{xOffset=this._clip.x/this._clip.width*bounds.width;yOffset=this._clip.y/this._clip.width*bounds.width;}}
if(bounds.getAspectRatio()>aspectRatio){var height=bounds.height/displayedHeightRatio;var marginLeft=0;if(anchorProperties.isHorizontallyCentered){marginLeft=(bounds.width-bounds.height*aspectRatio)/2;}else if(anchorProperties.isRight){marginLeft=bounds.width-bounds.height*aspectRatio;}
this.setPosition(new $.Point(bounds.x-xOffset+marginLeft,bounds.y-yOffset),immediately);this.setHeight(height,immediately);}else{var width=bounds.width/displayedWidthRatio;var marginTop=0;if(anchorProperties.isVerticallyCentered){marginTop=(bounds.height-bounds.width/aspectRatio)/2;}else if(anchorProperties.isBottom){marginTop=bounds.height-bounds.width/aspectRatio;}
this.setPosition(new $.Point(bounds.x-xOffset,bounds.y-yOffset+marginTop),immediately);this.setWidth(width,immediately);}},getClip:function(){if(this._clip){return this._clip.clone();}
return null;},setClip:function(newClip){$.console.assert(!newClip||newClip instanceof $.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null");if(newClip instanceof $.Rect){this._clip=newClip.clone();}else{this._clip=null;}
this._needsDraw=true;this.raiseEvent('clip-change');},getOpacity:function(){return this.opacity;},setOpacity:function(opacity){if(opacity===this.opacity){return;}
this.opacity=opacity;this._needsDraw=true;this.raiseEvent('opacity-change',{opacity:this.opacity});},getPreload:function(){return this._preload;},setPreload:function(preload){this._preload=!!preload;this._needsDraw=true;},getRotation:function(current){return current?this._degreesSpring.current.value:this._degreesSpring.target.value;},setRotation:function(degrees,immediately){if(this._degreesSpring.target.value===degrees&&this._degreesSpring.isAtTargetValue()){return;}
if(immediately){this._degreesSpring.resetTo(degrees);}else{this._degreesSpring.springTo(degrees);}
this._needsDraw=true;this._raiseBoundsChange();},_getRotationPoint:function(current){return this.getBoundsNoRotate(current).getCenter();},getCompositeOperation:function(){return this.compositeOperation;},setCompositeOperation:function(compositeOperation){if(compositeOperation===this.compositeOperation){return;}
this.compositeOperation=compositeOperation;this._needsDraw=true;this.raiseEvent('composite-operation-change',{compositeOperation:this.compositeOperation});},_setScale:function(scale,immediately){var sameTarget=(this._scaleSpring.target.value===scale);if(immediately){if(sameTarget&&this._scaleSpring.current.value===scale){return;}
this._scaleSpring.resetTo(scale);this._updateForScale();this._needsDraw=true;}else{if(sameTarget){return;}
this._scaleSpring.springTo(scale);this._updateForScale();this._needsDraw=true;}
if(!sameTarget){this._raiseBoundsChange();}},_updateForScale:function(){this._worldWidthTarget=this._scaleSpring.target.value;this._worldHeightTarget=this.normHeight*this._scaleSpring.target.value;this._worldWidthCurrent=this._scaleSpring.current.value;this._worldHeightCurrent=this.normHeight*this._scaleSpring.current.value;},_raiseBoundsChange:function(){this.raiseEvent('bounds-change');},_isBottomItem:function(){return this.viewer.world.getItemAt(0)===this;},_getLevelsInterval:function(){var lowestLevel=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2)));var currentZeroRatio=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),true).x*this._scaleSpring.current.value;var highestLevel=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(currentZeroRatio/this.minPixelRatio)/Math.log(2))));highestLevel=Math.max(highestLevel,this.source.minLevel||0);lowestLevel=Math.min(lowestLevel,highestLevel);return{lowestLevel:lowestLevel,highestLevel:highestLevel};},_updateViewport:function(){this._needsDraw=false;this._tilesLoading=0;this.loadingCoverage={};while(this.lastDrawn.length>0){var tile=this.lastDrawn.pop();tile.beingDrawn=false;}
var viewport=this.viewport;var drawArea=this._viewportToTiledImageRectangle(viewport.getBoundsWithMargins(true));if(!this.wrapHorizontal&&!this.wrapVertical){var tiledImageBounds=this._viewportToTiledImageRectangle(this.getClippedBounds(true));drawArea=drawArea.intersection(tiledImageBounds);if(drawArea===null){return;}}
var levelsInterval=this._getLevelsInterval();var lowestLevel=levelsInterval.lowestLevel;var highestLevel=levelsInterval.highestLevel;var bestTile=null;var haveDrawn=false;var currentTime=$.now();for(var level=highestLevel;level>=lowestLevel;level--){var drawLevel=false;var currentRenderPixelRatio=viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(level),true).x*this._scaleSpring.current.value;if(level===lowestLevel||(!haveDrawn&&currentRenderPixelRatio>=this.minPixelRatio)){drawLevel=true;haveDrawn=true;}else if(!haveDrawn){continue;}
var targetRenderPixelRatio=viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(level),false).x*this._scaleSpring.current.value;var targetZeroRatio=viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),false).x*this._scaleSpring.current.value;var optimalRatio=this.immediateRender?1:targetZeroRatio;var levelOpacity=Math.min(1,(currentRenderPixelRatio-0.5)/0.5);var levelVisibility=optimalRatio/Math.abs(optimalRatio-targetRenderPixelRatio);bestTile=updateLevel(this,haveDrawn,drawLevel,level,levelOpacity,levelVisibility,drawArea,currentTime,bestTile);if(providesCoverage(this.coverage,level)){break;}}
drawTiles(this,this.lastDrawn);if(bestTile&&!bestTile.context2D){loadTile(this,bestTile,currentTime);this._needsDraw=true;this._setFullyLoaded(false);}else{this._setFullyLoaded(this._tilesLoading===0);}},_getCornerTiles:function(level,topLeftBound,bottomRightBound){var leftX;var rightX;if(this.wrapHorizontal){leftX=$.positiveModulo(topLeftBound.x,1);rightX=$.positiveModulo(bottomRightBound.x,1);}else{leftX=Math.max(0,topLeftBound.x);rightX=Math.min(1,bottomRightBound.x);}
var topY;var bottomY;var aspectRatio=1/this.source.aspectRatio;if(this.wrapVertical){topY=$.positiveModulo(topLeftBound.y,aspectRatio);bottomY=$.positiveModulo(bottomRightBound.y,aspectRatio);}else{topY=Math.max(0,topLeftBound.y);bottomY=Math.min(aspectRatio,bottomRightBound.y);}
var topLeftTile=this.source.getTileAtPoint(level,new $.Point(leftX,topY));var bottomRightTile=this.source.getTileAtPoint(level,new $.Point(rightX,bottomY));var numTiles=this.source.getNumTiles(level);if(this.wrapHorizontal){topLeftTile.x+=numTiles.x*Math.floor(topLeftBound.x);bottomRightTile.x+=numTiles.x*Math.floor(bottomRightBound.x);}
if(this.wrapVertical){topLeftTile.y+=numTiles.y*Math.floor(topLeftBound.y/aspectRatio);bottomRightTile.y+=numTiles.y*Math.floor(bottomRightBound.y/aspectRatio);}
return{topLeft:topLeftTile,bottomRight:bottomRightTile,};}});function updateLevel(tiledImage,haveDrawn,drawLevel,level,levelOpacity,levelVisibility,drawArea,currentTime,best){var topLeftBound=drawArea.getBoundingBox().getTopLeft();var bottomRightBound=drawArea.getBoundingBox().getBottomRight();if(tiledImage.viewer){tiledImage.viewer.raiseEvent('update-level',{tiledImage:tiledImage,havedrawn:haveDrawn,level:level,opacity:levelOpacity,visibility:levelVisibility,drawArea:drawArea,topleft:topLeftBound,bottomright:bottomRightBound,currenttime:currentTime,best:best});}
resetCoverage(tiledImage.coverage,level);resetCoverage(tiledImage.loadingCoverage,level);var cornerTiles=tiledImage._getCornerTiles(level,topLeftBound,bottomRightBound);var topLeftTile=cornerTiles.topLeft;var bottomRightTile=cornerTiles.bottomRight;var numberOfTiles=tiledImage.source.getNumTiles(level);var viewportCenter=tiledImage.viewport.pixelFromPoint(tiledImage.viewport.getCenter());for(var x=topLeftTile.x;x<=bottomRightTile.x;x++){for(var y=topLeftTile.y;y<=bottomRightTile.y;y++){if(!tiledImage.wrapHorizontal&&!tiledImage.wrapVertical){var tileBounds=tiledImage.source.getTileBounds(level,x,y);if(drawArea.intersection(tileBounds)===null){continue;}}
best=updateTile(tiledImage,drawLevel,haveDrawn,x,y,level,levelOpacity,levelVisibility,viewportCenter,numberOfTiles,currentTime,best);}}
return best;}
function updateTile(tiledImage,haveDrawn,drawLevel,x,y,level,levelOpacity,levelVisibility,viewportCenter,numberOfTiles,currentTime,best){var tile=getTile(x,y,level,tiledImage,tiledImage.source,tiledImage.tilesMatrix,currentTime,numberOfTiles,tiledImage._worldWidthCurrent,tiledImage._worldHeightCurrent),drawTile=drawLevel;if(tiledImage.viewer){tiledImage.viewer.raiseEvent('update-tile',{tiledImage:tiledImage,tile:tile});}
setCoverage(tiledImage.coverage,level,x,y,false);var loadingCoverage=tile.loaded||tile.loading||isCovered(tiledImage.loadingCoverage,level,x,y);setCoverage(tiledImage.loadingCoverage,level,x,y,loadingCoverage);if(!tile.exists){return best;}
if(haveDrawn&&!drawTile){if(isCovered(tiledImage.coverage,level,x,y)){setCoverage(tiledImage.coverage,level,x,y,true);}else{drawTile=true;}}
if(!drawTile){return best;}
positionTile(tile,tiledImage.source.tileOverlap,tiledImage.viewport,viewportCenter,levelVisibility,tiledImage);if(!tile.loaded){if(tile.context2D){setTileLoaded(tiledImage,tile);}else{var imageRecord=tiledImage._tileCache.getImageRecord(tile.cacheKey);if(imageRecord){var image=imageRecord.getImage();setTileLoaded(tiledImage,tile,image);}}}
if(tile.loaded){var needsDraw=blendTile(tiledImage,tile,x,y,level,levelOpacity,currentTime);if(needsDraw){tiledImage._needsDraw=true;}}else if(tile.loading){tiledImage._tilesLoading++;}else if(!loadingCoverage){best=compareTiles(best,tile);}
return best;}
function getTile(x,y,level,tiledImage,tileSource,tilesMatrix,time,numTiles,worldWidth,worldHeight){var xMod,yMod,bounds,sourceBounds,exists,url,ajaxHeaders,context2D,tile;if(!tilesMatrix[level]){tilesMatrix[level]={};}
if(!tilesMatrix[level][x]){tilesMatrix[level][x]={};}
if(!tilesMatrix[level][x][y]){xMod=(numTiles.x+(x%numTiles.x))%numTiles.x;yMod=(numTiles.y+(y%numTiles.y))%numTiles.y;bounds=tileSource.getTileBounds(level,xMod,yMod);sourceBounds=tileSource.getTileBounds(level,xMod,yMod,true);exists=tileSource.tileExists(level,xMod,yMod);url=tileSource.getTileUrl(level,xMod,yMod);if(tiledImage.loadTilesWithAjax){ajaxHeaders=tileSource.getTileAjaxHeaders(level,xMod,yMod);if($.isPlainObject(tiledImage.ajaxHeaders)){ajaxHeaders=$.extend({},tiledImage.ajaxHeaders,ajaxHeaders);}}else{ajaxHeaders=null;}
context2D=tileSource.getContext2D?tileSource.getContext2D(level,xMod,yMod):undefined;bounds.x+=(x-xMod)/numTiles.x;bounds.y+=(worldHeight/worldWidth)*((y-yMod)/numTiles.y);tile=new $.Tile(level,x,y,bounds,exists,url,context2D,tiledImage.loadTilesWithAjax,ajaxHeaders,sourceBounds);if(xMod===numTiles.x-1){tile.isRightMost=true;}
if(yMod===numTiles.y-1){tile.isBottomMost=true;}
tilesMatrix[level][x][y]=tile;}
tile=tilesMatrix[level][x][y];tile.lastTouchTime=time;return tile;}
function loadTile(tiledImage,tile,time){tile.loading=true;tiledImage._imageLoader.addJob({src:tile.url,loadWithAjax:tile.loadWithAjax,ajaxHeaders:tile.ajaxHeaders,crossOriginPolicy:tiledImage.crossOriginPolicy,ajaxWithCredentials:tiledImage.ajaxWithCredentials,callback:function(image,errorMsg,tileRequest){onTileLoad(tiledImage,tile,time,image,errorMsg,tileRequest);},abort:function(){tile.loading=false;}});}
function onTileLoad(tiledImage,tile,time,image,errorMsg,tileRequest){if(!image){$.console.log("Tile %s failed to load: %s - error: %s",tile,tile.url,errorMsg);tiledImage.viewer.raiseEvent("tile-load-failed",{tile:tile,tiledImage:tiledImage,time:time,message:errorMsg,tileRequest:tileRequest});tile.loading=false;tile.exists=false;return;}
if(time<tiledImage.lastResetTime){$.console.log("Ignoring tile %s loaded before reset: %s",tile,tile.url);tile.loading=false;return;}
var finish=function(){var cutoff=tiledImage.source.getClosestLevel();setTileLoaded(tiledImage,tile,image,cutoff,tileRequest);};if(!tiledImage._midDraw){finish();}else{window.setTimeout(finish,1);}}
function setTileLoaded(tiledImage,tile,image,cutoff,tileRequest){var increment=0;function getCompletionCallback(){increment++;return completionCallback;}
function completionCallback(){increment--;if(increment===0){tile.loading=false;tile.loaded=true;if(!tile.context2D){tiledImage._tileCache.cacheTile({image:image,tile:tile,cutoff:cutoff,tiledImage:tiledImage});}
tiledImage._needsDraw=true;}}
tiledImage.viewer.raiseEvent("tile-loaded",{tile:tile,tiledImage:tiledImage,tileRequest:tileRequest,image:image,getCompletionCallback:getCompletionCallback});getCompletionCallback()();}
function positionTile(tile,overlap,viewport,viewportCenter,levelVisibility,tiledImage){var boundsTL=tile.bounds.getTopLeft();boundsTL.x*=tiledImage._scaleSpring.current.value;boundsTL.y*=tiledImage._scaleSpring.current.value;boundsTL.x+=tiledImage._xSpring.current.value;boundsTL.y+=tiledImage._ySpring.current.value;var boundsSize=tile.bounds.getSize();boundsSize.x*=tiledImage._scaleSpring.current.value;boundsSize.y*=tiledImage._scaleSpring.current.value;var positionC=viewport.pixelFromPointNoRotate(boundsTL,true),positionT=viewport.pixelFromPointNoRotate(boundsTL,false),sizeC=viewport.deltaPixelsFromPointsNoRotate(boundsSize,true),sizeT=viewport.deltaPixelsFromPointsNoRotate(boundsSize,false),tileCenter=positionT.plus(sizeT.divide(2)),tileSquaredDistance=viewportCenter.squaredDistanceTo(tileCenter);if(!overlap){sizeC=sizeC.plus(new $.Point(1,1));}
if(tile.isRightMost&&tiledImage.wrapHorizontal){sizeC.x+=0.75;}
if(tile.isBottomMost&&tiledImage.wrapVertical){sizeC.y+=0.75;}
tile.position=positionC;tile.size=sizeC;tile.squaredDistance=tileSquaredDistance;tile.visibility=levelVisibility;}
function blendTile(tiledImage,tile,x,y,level,levelOpacity,currentTime){var blendTimeMillis=1000*tiledImage.blendTime,deltaTime,opacity;if(!tile.blendStart){tile.blendStart=currentTime;}
deltaTime=currentTime-tile.blendStart;opacity=blendTimeMillis?Math.min(1,deltaTime/(blendTimeMillis)):1;if(tiledImage.alwaysBlend){opacity*=levelOpacity;}
tile.opacity=opacity;tiledImage.lastDrawn.push(tile);if(opacity===1){setCoverage(tiledImage.coverage,level,x,y,true);tiledImage._hasOpaqueTile=true;}else if(deltaTime<blendTimeMillis){return true;}
return false;}
function providesCoverage(coverage,level,x,y){var rows,cols,i,j;if(!coverage[level]){return false;}
if(x===undefined||y===undefined){rows=coverage[level];for(i in rows){if(Object.prototype.hasOwnProperty.call(rows,i)){cols=rows[i];for(j in cols){if(Object.prototype.hasOwnProperty.call(cols,j)&&!cols[j]){return false;}}}}
return true;}
return(coverage[level][x]===undefined||coverage[level][x][y]===undefined||coverage[level][x][y]===true);}
function isCovered(coverage,level,x,y){if(x===undefined||y===undefined){return providesCoverage(coverage,level+1);}else{return(providesCoverage(coverage,level+1,2*x,2*y)&&providesCoverage(coverage,level+1,2*x,2*y+1)&&providesCoverage(coverage,level+1,2*x+1,2*y)&&providesCoverage(coverage,level+1,2*x+1,2*y+1));}}
function setCoverage(coverage,level,x,y,covers){if(!coverage[level]){$.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",level);return;}
if(!coverage[level][x]){coverage[level][x]={};}
coverage[level][x][y]=covers;}
function resetCoverage(coverage,level){coverage[level]={};}
function compareTiles(previousBest,tile){if(!previousBest){return tile;}
if(tile.visibility>previousBest.visibility){return tile;}else if(tile.visibility==previousBest.visibility){if(tile.squaredDistance<previousBest.squaredDistance){return tile;}}
return previousBest;}
function drawTiles(tiledImage,lastDrawn){if(tiledImage.opacity===0||(lastDrawn.length===0&&!tiledImage.placeholderFillStyle)){return;}
var tile=lastDrawn[0];var useSketch;if(tile){useSketch=tiledImage.opacity<1||(tiledImage.compositeOperation&&tiledImage.compositeOperation!=='source-over')||(!tiledImage._isBottomItem()&&tile._hasTransparencyChannel());}
var sketchScale;var sketchTranslate;var zoom=tiledImage.viewport.getZoom(true);var imageZoom=tiledImage.viewportToImageZoom(zoom);if(lastDrawn.length>1&&imageZoom>tiledImage.smoothTileEdgesMinZoom&&!tiledImage.iOSDevice&&tiledImage.getRotation(true)%360===0&&$.supportsCanvas){useSketch=true;sketchScale=tile.getScaleForEdgeSmoothing();sketchTranslate=tile.getTranslationForEdgeSmoothing(sketchScale,tiledImage._drawer.getCanvasSize(false),tiledImage._drawer.getCanvasSize(true));}
var bounds;if(useSketch){if(!sketchScale){bounds=tiledImage.viewport.viewportToViewerElementRectangle(tiledImage.getClippedBounds(true)).getIntegerBoundingBox();if(tiledImage._drawer.viewer.viewport.getFlip()){if(tiledImage.viewport.degrees!==0||tiledImage.getRotation(true)%360!==0){bounds.x=tiledImage._drawer.viewer.container.clientWidth-(bounds.x+bounds.width);}}
bounds=bounds.times($.pixelDensityRatio);}
tiledImage._drawer._clear(true,bounds);}
if(!sketchScale){if(tiledImage.viewport.degrees!==0){tiledImage._drawer._offsetForRotation({degrees:tiledImage.viewport.degrees,useSketch:useSketch});}
if(tiledImage.getRotation(true)%360!==0){tiledImage._drawer._offsetForRotation({degrees:tiledImage.getRotation(true),point:tiledImage.viewport.pixelFromPointNoRotate(tiledImage._getRotationPoint(true),true),useSketch:useSketch});}
if(tiledImage.viewport.degrees===0&&tiledImage.getRotation(true)%360===0){if(tiledImage._drawer.viewer.viewport.getFlip()){tiledImage._drawer._flip();}}}
var usedClip=false;if(tiledImage._clip){tiledImage._drawer.saveContext(useSketch);var box=tiledImage.imageToViewportRectangle(tiledImage._clip,true);box=box.rotate(-tiledImage.getRotation(true),tiledImage._getRotationPoint(true));var clipRect=tiledImage._drawer.viewportToDrawerRectangle(box);if(sketchScale){clipRect=clipRect.times(sketchScale);}
if(sketchTranslate){clipRect=clipRect.translate(sketchTranslate);}
tiledImage._drawer.setClip(clipRect,useSketch);usedClip=true;}
if(tiledImage._croppingPolygons){tiledImage._drawer.saveContext(useSketch);try{var polygons=tiledImage._croppingPolygons.map(function(polygon){return polygon.map(function(coord){var point=tiledImage.imageToViewportCoordinates(coord.x,coord.y,true).rotate(-tiledImage.getRotation(true),tiledImage._getRotationPoint(true));var clipPoint=tiledImage._drawer.viewportCoordToDrawerCoord(point);if(sketchScale){clipPoint=clipPoint.times(sketchScale);}
return clipPoint;});});tiledImage._drawer.clipWithPolygons(polygons,useSketch);}catch(e){$.console.error(e);}
usedClip=true;}
if(tiledImage.placeholderFillStyle&&tiledImage._hasOpaqueTile===false){var placeholderRect=tiledImage._drawer.viewportToDrawerRectangle(tiledImage.getBounds(true));if(sketchScale){placeholderRect=placeholderRect.times(sketchScale);}
if(sketchTranslate){placeholderRect=placeholderRect.translate(sketchTranslate);}
var fillStyle=null;if(typeof tiledImage.placeholderFillStyle==="function"){fillStyle=tiledImage.placeholderFillStyle(tiledImage,tiledImage._drawer.context);}
else{fillStyle=tiledImage.placeholderFillStyle;}
tiledImage._drawer.drawRectangle(placeholderRect,fillStyle,useSketch);}
for(var i=lastDrawn.length-1;i>=0;i--){tile=lastDrawn[i];tiledImage._drawer.drawTile(tile,tiledImage._drawingHandler,useSketch,sketchScale,sketchTranslate);tile.beingDrawn=true;if(tiledImage.viewer){tiledImage.viewer.raiseEvent('tile-drawn',{tiledImage:tiledImage,tile:tile});}}
if(usedClip){tiledImage._drawer.restoreContext(useSketch);}
if(!sketchScale){if(tiledImage.getRotation(true)%360!==0){tiledImage._drawer._restoreRotationChanges(useSketch);}
if(tiledImage.viewport.degrees!==0){tiledImage._drawer._restoreRotationChanges(useSketch);}}
if(useSketch){if(sketchScale){if(tiledImage.viewport.degrees!==0){tiledImage._drawer._offsetForRotation({degrees:tiledImage.viewport.degrees,useSketch:false});}
if(tiledImage.getRotation(true)%360!==0){tiledImage._drawer._offsetForRotation({degrees:tiledImage.getRotation(true),point:tiledImage.viewport.pixelFromPointNoRotate(tiledImage._getRotationPoint(true),true),useSketch:false});}}
tiledImage._drawer.blendSketch({opacity:tiledImage.opacity,scale:sketchScale,translate:sketchTranslate,compositeOperation:tiledImage.compositeOperation,bounds:bounds});if(sketchScale){if(tiledImage.getRotation(true)%360!==0){tiledImage._drawer._restoreRotationChanges(false);}
if(tiledImage.viewport.degrees!==0){tiledImage._drawer._restoreRotationChanges(false);}}}
if(!sketchScale){if(tiledImage.viewport.degrees===0&&tiledImage.getRotation(true)%360===0){if(tiledImage._drawer.viewer.viewport.getFlip()){tiledImage._drawer._flip();}}}
drawDebugInfo(tiledImage,lastDrawn);}
function drawDebugInfo(tiledImage,lastDrawn){if(tiledImage.debugMode){for(var i=lastDrawn.length-1;i>=0;i--){var tile=lastDrawn[i];try{tiledImage._drawer.drawDebugInfo(tile,lastDrawn.length,i,tiledImage);}catch(e){$.console.error(e);}}}}}(OpenSeadragon));(function($){var TileRecord=function(options){$.console.assert(options,"[TileCache.cacheTile] options is required");$.console.assert(options.tile,"[TileCache.cacheTile] options.tile is required");$.console.assert(options.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");this.tile=options.tile;this.tiledImage=options.tiledImage;};var ImageRecord=function(options){$.console.assert(options,"[ImageRecord] options is required");$.console.assert(options.image,"[ImageRecord] options.image is required");this._image=options.image;this._tiles=[];};ImageRecord.prototype={destroy:function(){this._image=null;this._renderedContext=null;this._tiles=null;},getImage:function(){return this._image;},getRenderedContext:function(){if(!this._renderedContext){var canvas=document.createElement('canvas');canvas.width=this._image.width;canvas.height=this._image.height;this._renderedContext=canvas.getContext('2d');this._renderedContext.drawImage(this._image,0,0);this._image=null;}
return this._renderedContext;},setRenderedContext:function(renderedContext){$.console.error("ImageRecord.setRenderedContext is deprecated. "+"The rendered context should be created by the ImageRecord "+"itself when calling ImageRecord.getRenderedContext.");this._renderedContext=renderedContext;},addTile:function(tile){$.console.assert(tile,'[ImageRecord.addTile] tile is required');this._tiles.push(tile);},removeTile:function(tile){for(var i=0;i<this._tiles.length;i++){if(this._tiles[i]===tile){this._tiles.splice(i,1);return;}}
$.console.warn('[ImageRecord.removeTile] trying to remove unknown tile',tile);},getTileCount:function(){return this._tiles.length;}};$.TileCache=function(options){options=options||{};this._maxImageCacheCount=options.maxImageCacheCount||$.DEFAULT_SETTINGS.maxImageCacheCount;this._tilesLoaded=[];this._imagesLoaded=[];this._imagesLoadedCount=0;};$.TileCache.prototype={numTilesLoaded:function(){return this._tilesLoaded.length;},cacheTile:function(options){$.console.assert(options,"[TileCache.cacheTile] options is required");$.console.assert(options.tile,"[TileCache.cacheTile] options.tile is required");$.console.assert(options.tile.cacheKey,"[TileCache.cacheTile] options.tile.cacheKey is required");$.console.assert(options.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");var cutoff=options.cutoff||0;var insertionIndex=this._tilesLoaded.length;var imageRecord=this._imagesLoaded[options.tile.cacheKey];if(!imageRecord){$.console.assert(options.image,"[TileCache.cacheTile] options.image is required to create an ImageRecord");imageRecord=this._imagesLoaded[options.tile.cacheKey]=new ImageRecord({image:options.image});this._imagesLoadedCount++;}
imageRecord.addTile(options.tile);options.tile.cacheImageRecord=imageRecord;if(this._imagesLoadedCount>this._maxImageCacheCount){var worstTile=null;var worstTileIndex=-1;var worstTileRecord=null;var prevTile,worstTime,worstLevel,prevTime,prevLevel,prevTileRecord;for(var i=this._tilesLoaded.length-1;i>=0;i--){prevTileRecord=this._tilesLoaded[i];prevTile=prevTileRecord.tile;if(prevTile.level<=cutoff||prevTile.beingDrawn){continue;}else if(!worstTile){worstTile=prevTile;worstTileIndex=i;worstTileRecord=prevTileRecord;continue;}
prevTime=prevTile.lastTouchTime;worstTime=worstTile.lastTouchTime;prevLevel=prevTile.level;worstLevel=worstTile.level;if(prevTime<worstTime||(prevTime==worstTime&&prevLevel>worstLevel)){worstTile=prevTile;worstTileIndex=i;worstTileRecord=prevTileRecord;}}
if(worstTile&&worstTileIndex>=0){this._unloadTile(worstTileRecord);insertionIndex=worstTileIndex;}}
this._tilesLoaded[insertionIndex]=new TileRecord({tile:options.tile,tiledImage:options.tiledImage});},clearTilesFor:function(tiledImage){$.console.assert(tiledImage,'[TileCache.clearTilesFor] tiledImage is required');var tileRecord;for(var i=0;i<this._tilesLoaded.length;++i){tileRecord=this._tilesLoaded[i];if(tileRecord.tiledImage===tiledImage){this._unloadTile(tileRecord);this._tilesLoaded.splice(i,1);i--;}}},getImageRecord:function(cacheKey){$.console.assert(cacheKey,'[TileCache.getImageRecord] cacheKey is required');return this._imagesLoaded[cacheKey];},_unloadTile:function(tileRecord){$.console.assert(tileRecord,'[TileCache._unloadTile] tileRecord is required');var tile=tileRecord.tile;var tiledImage=tileRecord.tiledImage;tile.unload();tile.cacheImageRecord=null;var imageRecord=this._imagesLoaded[tile.cacheKey];imageRecord.removeTile(tile);if(!imageRecord.getTileCount()){imageRecord.destroy();delete this._imagesLoaded[tile.cacheKey];this._imagesLoadedCount--;}
tiledImage.viewer.raiseEvent("tile-unloaded",{tile:tile,tiledImage:tiledImage});}};}(OpenSeadragon));(function($){$.World=function(options){var _this=this;$.console.assert(options.viewer,"[World] options.viewer is required");$.EventSource.call(this);this.viewer=options.viewer;this._items=[];this._needsDraw=false;this._autoRefigureSizes=true;this._needsSizesFigured=false;this._delegatedFigureSizes=function(event){if(_this._autoRefigureSizes){_this._figureSizes();}else{_this._needsSizesFigured=true;}};this._figureSizes();};$.extend($.World.prototype,$.EventSource.prototype,{addItem:function(item,options){$.console.assert(item,"[World.addItem] item is required");$.console.assert(item instanceof $.TiledImage,"[World.addItem] only TiledImages supported at this time");options=options||{};if(options.index!==undefined){var index=Math.max(0,Math.min(this._items.length,options.index));this._items.splice(index,0,item);}else{this._items.push(item);}
if(this._autoRefigureSizes){this._figureSizes();}else{this._needsSizesFigured=true;}
this._needsDraw=true;item.addHandler('bounds-change',this._delegatedFigureSizes);item.addHandler('clip-change',this._delegatedFigureSizes);this.raiseEvent('add-item',{item:item});},getItemAt:function(index){$.console.assert(index!==undefined,"[World.getItemAt] index is required");return this._items[index];},getIndexOfItem:function(item){$.console.assert(item,"[World.getIndexOfItem] item is required");return $.indexOf(this._items,item);},getItemCount:function(){return this._items.length;},setItemIndex:function(item,index){$.console.assert(item,"[World.setItemIndex] item is required");$.console.assert(index!==undefined,"[World.setItemIndex] index is required");var oldIndex=this.getIndexOfItem(item);if(index>=this._items.length){throw new Error("Index bigger than number of layers.");}
if(index===oldIndex||oldIndex===-1){return;}
this._items.splice(oldIndex,1);this._items.splice(index,0,item);this._needsDraw=true;this.raiseEvent('item-index-change',{item:item,previousIndex:oldIndex,newIndex:index});},removeItem:function(item){$.console.assert(item,"[World.removeItem] item is required");var index=$.indexOf(this._items,item);if(index===-1){return;}
item.removeHandler('bounds-change',this._delegatedFigureSizes);item.removeHandler('clip-change',this._delegatedFigureSizes);item.destroy();this._items.splice(index,1);this._figureSizes();this._needsDraw=true;this._raiseRemoveItem(item);},removeAll:function(){this.viewer._cancelPendingImages();var item;var i;for(i=0;i<this._items.length;i++){item=this._items[i];item.removeHandler('bounds-change',this._delegatedFigureSizes);item.removeHandler('clip-change',this._delegatedFigureSizes);item.destroy();}
var removedItems=this._items;this._items=[];this._figureSizes();this._needsDraw=true;for(i=0;i<removedItems.length;i++){item=removedItems[i];this._raiseRemoveItem(item);}},resetItems:function(){for(var i=0;i<this._items.length;i++){this._items[i].reset();}},update:function(){var animated=false;for(var i=0;i<this._items.length;i++){animated=this._items[i].update()||animated;}
return animated;},draw:function(){for(var i=0;i<this._items.length;i++){this._items[i].draw();}
this._needsDraw=false;},needsDraw:function(){for(var i=0;i<this._items.length;i++){if(this._items[i].needsDraw()){return true;}}
return this._needsDraw;},getHomeBounds:function(){return this._homeBounds.clone();},getContentFactor:function(){return this._contentFactor;},setAutoRefigureSizes:function(value){this._autoRefigureSizes=value;if(value&this._needsSizesFigured){this._figureSizes();this._needsSizesFigured=false;}},arrange:function(options){options=options||{};var immediately=options.immediately||false;var layout=options.layout||$.DEFAULT_SETTINGS.collectionLayout;var rows=options.rows||$.DEFAULT_SETTINGS.collectionRows;var columns=options.columns||$.DEFAULT_SETTINGS.collectionColumns;var tileSize=options.tileSize||$.DEFAULT_SETTINGS.collectionTileSize;var tileMargin=options.tileMargin||$.DEFAULT_SETTINGS.collectionTileMargin;var increment=tileSize+tileMargin;var wrap;if(!options.rows&&columns){wrap=columns;}else{wrap=Math.ceil(this._items.length/rows);}
var x=0;var y=0;var item,box,width,height,position;this.setAutoRefigureSizes(false);for(var i=0;i<this._items.length;i++){if(i&&(i%wrap)===0){if(layout==='horizontal'){y+=increment;x=0;}else{x+=increment;y=0;}}
item=this._items[i];box=item.getBounds();if(box.width>box.height){width=tileSize;}else{width=tileSize*(box.width/box.height);}
height=width*(box.height/box.width);position=new $.Point(x+((tileSize-width)/2),y+((tileSize-height)/2));item.setPosition(position,immediately);item.setWidth(width,immediately);if(layout==='horizontal'){x+=increment;}else{y+=increment;}}
this.setAutoRefigureSizes(true);},_figureSizes:function(){var oldHomeBounds=this._homeBounds?this._homeBounds.clone():null;var oldContentSize=this._contentSize?this._contentSize.clone():null;var oldContentFactor=this._contentFactor||0;if(!this._items.length){this._homeBounds=new $.Rect(0,0,1,1);this._contentSize=new $.Point(1,1);this._contentFactor=1;}else{var item=this._items[0];var bounds=item.getBounds();this._contentFactor=item.getContentSize().x/bounds.width;var clippedBounds=item.getClippedBounds().getBoundingBox();var left=clippedBounds.x;var top=clippedBounds.y;var right=clippedBounds.x+clippedBounds.width;var bottom=clippedBounds.y+clippedBounds.height;for(var i=1;i<this._items.length;i++){item=this._items[i];bounds=item.getBounds();this._contentFactor=Math.max(this._contentFactor,item.getContentSize().x/bounds.width);clippedBounds=item.getClippedBounds().getBoundingBox();left=Math.min(left,clippedBounds.x);top=Math.min(top,clippedBounds.y);right=Math.max(right,clippedBounds.x+clippedBounds.width);bottom=Math.max(bottom,clippedBounds.y+clippedBounds.height);}
this._homeBounds=new $.Rect(left,top,right-left,bottom-top);this._contentSize=new $.Point(this._homeBounds.width*this._contentFactor,this._homeBounds.height*this._contentFactor);}
if(this._contentFactor!==oldContentFactor||!this._homeBounds.equals(oldHomeBounds)||!this._contentSize.equals(oldContentSize)){this.raiseEvent('metrics-change',{});}},_raiseRemoveItem:function(item){this.raiseEvent('remove-item',{item:item});}});}(OpenSeadragon));;;
jQuery.migrateTrace=false;$(function(){$("#showFrontBtn, #showBackBtn").on("click",function(){var $btn=$(this);if($btn.hasClass("active")){return;}
var url=$btn.data("goto");window.location.href=url;});$("#viewBackSwitch").on("click",function(){var $inactiveBtn=$(".front-back-toggle").find("button:not(.active)").first();$inactiveBtn.trigger("click");});$('.toggle-painting-overlay').on('click',function(){TogglePaintingOverlay($(this).attr('data-toggle-area'));});function TogglePaintingOverlay(area){if(!area||area===$('.painting-overlay-tab.active').attr('data-area')){if($("#tabDownload.active").length){$("#btnDownload").trigger("focus");}else if($("#tabKeyFacts.active").length){$("#btnKeyFacts").trigger("focus");}else if($("#tabDescription.active").length){$("#btnDescription").trigger("focus");}
$('.painting-overlay, .painting-overlay-tab').removeClass('active');}
else{$('#agreedToTerms').prop("checked",false);$("#download-image-link-btn").prop("disabled",true);if(!$('.painting-overlay').hasClass('active')){$('.painting-overlay').addClass('active');}
$('.painting-overlay .painting_download-tabs .painting-inner-tab').each(function(item,el){$(this).removeClass('active');});$('.painting-overlay .painting-overlay-tab').each(function(item,el){if($(this).attr('data-area')===area){$(this).addClass('active');if(area==='painting_download'){$('.painting-overlay .painting_download-tabs .painting-inner-tab[data-step="1"]').addClass('active');$(".btn",this).filter(":visible").first().trigger("focus");ng.util.trapFocusOn($(".painting-overlay"),$(".painting-overlay .painting-overlay-controls .btn-close"),$(".painting-overlay .painting-inner-tab[data-step='1'] a").last());}else{let overlay=$(this).closest(".painting-overlay");$(".btn-close",overlay).trigger("focus");let tabbable=ng.util.getTabbable($(this));ng.util.trapFocusOn(overlay,$(".btn-close",overlay),tabbable.last());}}
else{$(this).removeClass('active');}});$("body, html").animate({scrollTop:0});}
$(".painting-overlay-tab").each(function(){var $tab=$(this);var toggleArea=$tab.data("area");if($tab.hasClass("active")){$(".toggle-painting-overlay[data-toggle-area="+toggleArea+"]").addClass("active").attr("aria-expanded","true");}else{$(".toggle-painting-overlay[data-toggle-area="+toggleArea+"]").removeClass("active").attr("aria-expanded","false");}});}
$('.step-download-tab').on('click',function(){GoToDownloadStep($(this).attr('data-step'));});$(".painting-overlay").on("keydown",function(e){var KEYCODE_ESC=27;if(e.keyCode===KEYCODE_ESC){TogglePaintingOverlay("");}});function GoToDownloadStep(step){$('.painting-overlay .painting_download-tabs .painting-inner-tab').each(function(item,el){if($(this).attr('data-step')===step){$(this).addClass('active');$(".btn, #agreedToTerms",this).filter(":visible").first().trigger("focus");if(step==="2"){ng.util.trapFocusOn($(".painting-overlay"),$(".painting-overlay .painting-overlay-controls .btn-close"),$(".painting-overlay .painting-inner-tab[data-step='2'] .btn").last());}else if(step==="3"){ng.util.trapFocusOn($(".painting-overlay"),$(".painting-overlay .painting-overlay-controls .btn-close"),$(".painting-overlay .painting-inner-tab[data-step='3'] input:visible:not(:disabled)").last());}}
else{$(this).removeClass('active');}});}
$(".m-painting-page [role='tab'], .m-painting-page-group-info [role='tab']").on("click",function(){var $tab=$(this);var $tablist=$tab.closest("[role='tablist']");var $tabpanel=$("#"+$tab.attr("aria-controls"));var $tabpanels=$tabpanel.parent().find("[role='tabpanel']");$tablist.find("[role='tab']").removeClass("active").attr({"aria-selected":"false","tabindex":"-1"})
$tabpanels.prop("hidden",true);$tab.addClass("active").attr({"aria-selected":"true","tabindex":"0"})
$tabpanel.prop("hidden",false);});$(".m-painting-page [role='tablist'], .m-painting-page-group-info [role='tablist']").on("keydown",function(e){if(e.keyCode===39||e.keyCode===37){var $tabs=$(this).find("[role='tab']");var $activeTab=$tabs.filter(".active").first();var activeTabIdx=$tabs.index($activeTab);if(e.keyCode===39){activeTabIdx++;if(activeTabIdx>=$tabs.length){activeTabIdx=0;}}else{activeTabIdx--;if(activeTabIdx<0){activeTabIdx=$tabs.length-1;}}
$($tabs.get(activeTabIdx)).focus().trigger("click");}});function staticImageDynamicSrcHandler(isLoad){var imgSrcPattern=$('.static-image-dynamic-src').attr('data-static-image-pattern');var iipServerUrl=zoomViewerPaintingSpec.server;var currW=0;var currH=0;if(!isLoad){var currSrc=$('.static-image-dynamic-src').css('background-image');var currSrcWidth="";var currSrcHeight="";if(imgSrcPattern.indexOf(iipServerUrl)>-1){currSrcWidth=currSrc.substr(currSrc.indexOf('&WID')+5);currSrcWidth=currSrcWidth.substring(0,currSrcWidth.indexOf('&'));currSrcHeight=currSrc.substr(currSrc.indexOf('&HEI')+5);currSrcHeight=currSrcHeight.substring(0,currSrcHeight.indexOf('&'));}
else{currSrcWidth=currSrc.substr(currSrc.indexOf('&width')+7);currSrcWidth=currSrcWidth.substring(0,currSrcWidth.indexOf('&'));currSrcHeight=currSrc.substr(currSrc.indexOf('&height')+8);currSrcHeight=currSrcHeight.substring(0,currSrcHeight.indexOf('&'));}
currW=+(currSrcWidth);currH=+(currSrcHeight);}
var targetW=$('.static-image-dynamic-src').width();var targetH=$('.static-image-dynamic-src').height();var newW=-1;var newH=-1;{if(targetW<=576){newW=576;}
else if(targetW<=768){newW=768;}
else if(targetW<=992){newW=992;}
else if(targetW<=1024){newW=1024;}
else if(targetW<=1200){newW=1200;}
else if(targetW<=1600){newW=1600;}
else{newW=1920;}
if(targetH<=750){newH=750;}
else if(targetH<=900){newH=900;}
else if(targetH<=1024){newH=1024;}
else if(targetH<=1080){newH=1080;}
else{newH=1366;}}
if(newW!==currW||newH!==currH){var bgUrl=imgSrcPattern.replace("{W_PLACEHOLDER}",newW).replace("{H_PLACEHOLDER}",newH);$('.static-image-dynamic-src').css('background-image','url("'+bgUrl+'")');}}
var staticImageDynamicSrcTimeout;function staticImageDynamicSrcThrottler(){if(!staticImageDynamicSrcTimeout){staticImageDynamicSrcTimeout=setTimeout(function(){staticImageDynamicSrcTimeout=null;staticImageDynamicSrcHandler();},1000);}}
if($('.static-image-dynamic-src').length>0){staticImageDynamicSrcHandler(true);window.addEventListener("resize",staticImageDynamicSrcThrottler,false);window.addEventListener("orientationchange",staticImageDynamicSrcThrottler,false);}});$.urlParam=function(name){var results=new RegExp('[\?&]'+name+'=([^&#]*)').exec(window.location.href);if(results==null){return null;}
else{return decodeURI(results[1])||0;}}
function browserSupportsFullScreen(){if(document.exitFullscreen||document.msExitFullscreen||document.webkitExitFullscreen||document.webkitCancelFullScreen||document.mozCancelFullScreen){return true;}
else{return false;}}
function initOpenSeadragonViewer(zoomViewerPaintingSpec){var viewer=OpenSeadragon({id:"zoomViewerPlaceholder",tileSources:zoomViewerPaintingSpec.server+"?DeepZoom="+zoomViewerPaintingSpec.image+".dzi",tabIndex:0,blendTime:0,alwaysBlend:false,showNavigationControl:true,immediateRender:true,defaultZoomLevel:0,visibilityRatio:0.85,zoomPerScroll:1.1,zoomPerClick:1.8,minZoomImageRatio:0.9,maxZoomPixelRatio:1.1,autoResize:true,autoHideControls:true,showNavigator:true,navigatorPosition:"ABSOLUTE",navigatorHeight:145,navigatorWidth:190,navigatorAutoFade:true,navigatorBackground:"#3b3c40",navigatorBorderColor:"#FFF",navigatorDisplayRegionColor:"#FFF",navigatorAutoResize:false,controlsFadeDelay:4000,fullPageButton:"ztb-fullscreen-mode",homeButton:"ztb-full-image",zoomInButton:"ztb-zoom-in",zoomOutButton:"ztb-zoom-out",navigatorOpacity:1,gestureSettingsMouse:{scrollToZoom:true,pinchToZoom:false,clickToZoom:true,dblClickToZoom:false},gestureSettingsTouch:{scrollToZoom:false,pinchToZoom:true,clickToZoom:false,dblClickToZoom:true}});viewer.addHandler('open',function(){if(!browserSupportsFullScreen()){$('#zoomViewerPlaceholder').addClass('no-full-screen-support');}
$('#zoomViewerPlaceholder .navigator').parent().addClass('zt-navigator-wrap');viewer.addControl(OpenSeadragon.getElement('ztb-fullscreen-mode'),{anchor:OpenSeadragon.ControlAnchor.NONE});viewer.addControl(OpenSeadragon.getElement('minimap-controls'),{anchor:OpenSeadragon.ControlAnchor.NONE});var rectX,rectY,rectW,rectH;{var img={w:viewer.world.getItemAt(0).getContentSize().x,h:viewer.world.getItemAt(0).getContentSize().y};var fpCoordinates={l:zoomViewerPaintingSpec.focalPointLeftPercentage*img.w,t:zoomViewerPaintingSpec.focalPointTopPercentage*img.h};var vport=viewer.viewport.getContainerSize();var scaleForWidth=img.w/vport.x;var scaleForHeight=img.h/vport.y;if(scaleForWidth<scaleForHeight){rectW=img.w;rectH=img.w*vport.y/vport.x;rectX=0;rectY=fpCoordinates.t-(rectH/2);if(rectY<0){rectY=0;}
else if(rectY+rectH>img.h){rectY=img.h-rectH;}}
else{rectH=img.h;rectW=vport.x*img.h/vport.y;rectY=0;rectX=fpCoordinates.l-(rectW/2);if(rectX<0){rectX=0;}
else if(rectX+rectW>img.w){rectX=img.w-rectW;}}}
var newBounds=viewer.viewport.imageToViewportRectangle(rectX,rectY,rectW,rectH);viewer.viewport.fitBounds(newBounds,true);pp_setSliderData();$("#zoomViewerPlaceholder .openseadragon-canvas").attr({"role":"figure","aria-label":"Zoomable painting image"});});var sliderData;window.addEventListener("resize",pp_resizeThrottler,false);var pp_resizeTimeout;function pp_resizeThrottler(){if(!pp_resizeTimeout){pp_resizeTimeout=setTimeout(function(){pp_resizeTimeout=null;pp_setSliderData();},67);}}
function pp_setSliderData(){var img={w:viewer.world.getItemAt(0).getContentSize().x,h:viewer.world.getItemAt(0).getContentSize().y};var vport=viewer.viewport.getContainerSize();var scaleForWidth=img.w/vport.x;var scaleForHeight=img.h/vport.y;if(scaleForWidth>scaleForHeight){sliderData={imgW:img.w,imgH:img.h,imgRatio:img.h/img.w,imgMaxW:img.w*1.1,imgMaxH:img.h*1.1,imgMinW:vport.x*0.9,imgMinH:(vport.x*(img.h/img.w))*0.9,vPortW:vport.x,vPortH:vport.y};}
else{sliderData={imgW:img.w,imgH:img.h,imgRatio:img.h/img.w,imgMaxW:img.w*1.1,imgMaxH:img.h*1.1,imgMinW:(vport.y*(img.w/img.h))*0.9,imgMinH:vport.y*0.9,vPortW:vport.x,vPortH:vport.y};}}
viewer.addHandler('zoom',function(){pp_sliderThrottler();});var pp_sliderTimeout;function pp_sliderThrottler(){if(!pp_sliderTimeout){pp_sliderTimeout=setTimeout(function(){pp_sliderTimeout=null;setZoomSliderPos();},67);}}
function setZoomSliderPos(){if(sliderData!==undefined){var imgZoom=viewer.viewport.viewportToImageZoom(viewer.viewport.getZoom());var currW=imgZoom*sliderData.imgW;var currH=sliderData.imgRatio*currW;var onePercent=(sliderData.imgMaxW-sliderData.imgMinW)/100;var currPercent=(currW-sliderData.imgMinW)/onePercent;if(currPercent>100){currPercent=100;}
else if(currPercent<0){currPercent=0;}
$('#ztb-slider-indicator-dot').animate({"left":currPercent+"%"},100);}}
setTimeout(function(){viewer.addHandler('animation',function(param){pp_zoomThrottler();});},5000);var pp_zoomTimeout;function pp_zoomThrottler(){if(!pp_zoomTimeout){pp_zoomTimeout=setTimeout(function(){pp_zoomTimeout=null;$('#zoom-image-footer').fadeOut(1500);},100);}}
window.addEventListener("scroll",pp_scrollThrottler,false);var pp_scrollTimeout;function pp_scrollThrottler(){if(!pp_scrollTimeout){pp_scrollTimeout=setTimeout(function(){pp_scrollTimeout=null;$('#zoom-image-footer').fadeIn(1500);},100);}}
viewer.addHandler('full-screen',function(param){if(param.fullScreen){$("#ztb-fullscreen-mode > span").text("Close full screen");}
else{$("#ztb-fullscreen-mode > span").text("Open full screen");}});}
function adjustPaintingCanvasSize(){var topBarH=$('.top-bar').height();var secondaryNavH=$('.secondary-menu-bar').height();var setHeight=window.innerHeight-topBarH-secondaryNavH-60;if(setHeight<196){setHeight=196;}
$('.m-painting-page .painting-hero').css('height',setHeight+'px');$('.m-painting-page .painting-container').css('height',setHeight+'px');$('.m-painting-page .painting-container .painting-img').css('height',setHeight+'px');}
$(function(){adjustPaintingCanvasSize();if(typeof zoomViewerPaintingSpec!==undefined&&$("#zoomViewerPlaceholder").length>0){initOpenSeadragonViewer(zoomViewerPaintingSpec);}
if($('.m-painting-page .scroll-down-area button').length>0){$('.m-painting-page .scroll-down-area button').on("click",function(){var scrollPos=$('.m-painting-page .painting-hero').height();$("body, html").animate({scrollTop:scrollPos+60},400,function(){$(this).trigger("blur");});});}});;;
(function(m,$,undefined){var opener=null;m.ToggleExpandDetails=function(component){var detailsOnDisplay=$(component).find('.expand-object-details-displayed').html()==="1";$(component).find('.expand-details').slideToggle(700);if(detailsOnDisplay){$(component).find('.expand-object-details-displayed').html('0');$(component).find('.toggle-info-button').attr('aria-expanded','false');}
else{$(component).find('.expand-object-details-displayed').html('1');$(component).find('.toggle-info-button').attr('aria-expanded','true');}};m.InitExpandAreas=function(){$(".expand-component").each(function(){var component=$(this)[0];$(this).find('.show-expand-content-action').on("click",function(){opener=$(this).find("button").first();var expandContent=$(component).find('.expand-content');expandContent.show();ng.util.addModalKeyboardInteraction(expandContent,m.CloseExpandContent);$(".btn-close",expandContent).trigger("focus");});$(this).find('.toggle-info-button').on("click",function(){m.ToggleExpandDetails(component);});});};m.CloseExpandContent=function(expandContent){expandContent.hide();opener.trigger("focus");};}(window.expandComponentScript=window.expandComponentScript||{},jQuery));$(function(){expandComponentScript.InitExpandAreas();});;;
window.adjustTopBar=function(){"use strict";var maxHeight=100;var menuPadding=0;var menus=$(".top-bar .menu .content");var searchFormPadding=0;var searchForm=$(".top-bar .search-form .content");if($(window).width()<992){var menu1=menus.first();if(menu1.length>0){menuPadding=parseInt(menu1.css("padding-top"),10)+parseInt(menu1.css("padding-bottom"),10);}
if(searchForm.length>0){searchFormPadding=parseInt(searchForm.css("padding-top"),10)+parseInt(searchForm.css("padding-bottom"),10);searchForm.height($(window).height()-$(".top-bar .icons").height()-searchFormPadding);}
maxHeight=$(window).height()-$(".top-bar .icons").height()-menuPadding;menus.height(maxHeight);}else{if(searchForm.length>0){searchForm.height("");}
menus.each(function(){maxHeight=Math.max(maxHeight,$(this).height());});menus.height(maxHeight);}}
$(function(){"use strict";var DEBUG=false;var DEBUG_SIGN_IN=false;adjustTopBar();disableTabAccessToMenuAndSearch();if($(".secondary-menu-bar").length>0){$(".top-bar").addClass("with-secondary-menu-bar");}
var isLive=document&&document.location&&document.location.hostname&&document.location.hostname.indexOf('nationalgallery.org.uk')>-1;if(isLive){if($('[data-session-state="RequireTessSession"]').length>0){ensureTessSession();}}
var retryGetSessionState=5;if(isLive||DEBUG){manageSessionInfo();}
$("#TopBarMenuButton").on("click",function(){var button=$(this);var menu=$(".top-bar .menu.level-1");if(!button.hasClass("open")){openMenuDialog(button,menu);}else{closeMenuDialog();}});$(".top-bar .menu-opener").on("click",function(){var button=$(this);var menuId=button.data("open");var menu=$(".top-bar").find("#"+menuId);openSubMenu(button,menu);});$(".top-bar .menu-heading").on("click",function(){var button=$(this);var menu=button.closest(".menu");closeSubMenu(button,menu);});$("#TopBarSearchButton1").on("click",function(){var button=$(this);var searchForm=$(".top-bar .search-form");if(!button.hasClass("open")){openSearchDialog(button,searchForm);}else{closeSearchDialog();}});$(".top-bar .search-form .close-button").on("click",function(){closeSearchDialog();});$('.top-bar .sign-in .dropdown-toggle').on("click",function(){closeSearchDialog();closeMenuDialog();});$(document).on("click",function(e){if($(e.target).closest(".top-bar").length===0){closeSearchDialog();closeMenuDialog();}});function openMenuDialog(trigger,menu){if(menu.hasClass("open")){return;}
closeSearchDialog();addMainOverlay();trigger.addClass("open").attr("aria-expanded","true");showMenu(menu);enableTabAccess($(".top-bar .menu .level-1-content"));$("a, button",menu).filter(":visible").first().trigger("focus");var $firstItem=$("#TopBarMenuButton").first();var $lastItem=$("a, button",".top-bar .menu .level-1-content").last();ng.util.trapFocusOn($(".top-bar"),$firstItem,$lastItem);menu.on("keydown",function(e){var KEYCODE_ESC=27;if(e.keyCode===KEYCODE_ESC){closeMenuDialog();}});$("button",menu).filter(":visible").on("blur",function(){var button=$(this);if(button.attr("aria-expanded")==="true"){var menuId=button.data("open");var menu=$(".top-bar").find("#"+menuId);$("a, button",menu).filter(":visible").first().trigger("focus");}});$("a, button",menu).filter(":visible").last().on("blur",function(){trigger.trigger("focus");});}
function closeMenuDialog(){var menuDialog=$(".top-bar .menu.level-1");if(!menuDialog.hasClass("open")){return;}
hideMenu(menuDialog);menuDialog.find(".menu-item-wrapper").removeClass("active").removeClass("inactive");var menuButton=$("#TopBarMenuButton");menuButton.removeClass("open").attr("aria-expanded","false");var levelTwoMenus=$(".top-bar .menu.level-2");hideMenu(levelTwoMenus);removeMainOverlay();disableTabAccessToMenuAndSearch();ng.util.trapFocusOff($(".top-bar"));menuButton.trigger("focus");}
function openSubMenu(trigger,menu){if(menu.hasClass("open")){return;}
trigger.attr("aria-expanded","true");var menus=$(".top-bar .menu.level-2");menus.removeClass("open");showMenu(menu);enableTabAccess(menu);var menuItems=$(".top-bar .menu.level-1 .menu-item-wrapper");menuItems.removeClass("active");menuItems.addClass("inactive");trigger.parent().removeClass("inactive");trigger.parent().addClass("active");if($(window).width()<992){disableTabAccess($(".top-bar .menu .level-1-content"));}
$("a, button",menu).filter(":visible").first().trigger("focus");$("a, button",menu).filter(":visible").last().on("blur",function(){let nextTopLevelClickable=trigger.parent().next().find("a, button");if(nextTopLevelClickable){nextTopLevelClickable.trigger("focus");}});var $firstItem=$("#TopBarMenuButton").first();var $lastItem=$("a, button",menu).last();ng.util.trapFocusOn($(".top-bar"),$firstItem,$lastItem);}
function closeSubMenu(trigger,menu){if(!menu.hasClass("open")){return;}
trigger.attr("aria-expanded","false");hideMenu(menu);disableTabAccess(menu);var menuItems=$(".top-bar .menu.level-1 .menu-item-wrapper");var activeMenuItem=menuItems.filter(".active").first();menuItems.removeClass("active").removeClass("inactive");if($(window).width()<992){enableTabAccess($(".top-bar .menu .level-1-content"));}
activeMenuItem.find("a, button").filter(":visible").first().trigger("focus");var $firstItem=$("#TopBarMenuButton").first();var $lastItem=$("a, button",".top-bar .menu .level-1-content").last();ng.util.trapFocusOn($(".top-bar"),$firstItem,$lastItem);}
function showMenu(menu){var properties;if(window.matchMedia("(min-width: 992px)").matches){menu.css({left:""});properties={top:$(".top-bar").height()};}else{menu.css({top:""});properties={left:0}}
menu.css({visibility:"visible"}).animate(properties,300,function(){$(this).attr("aria-hidden","false").addClass("open");});}
function hideMenu(menu){var properties;if(window.matchMedia("(min-width: 992px)").matches){menu.css({left:""});properties={top:"-100%"};}else{menu.css({top:""});properties={left:"-100%"}}
menu.animate(properties,300,function(){$(this).css({visibility:""}).attr("aria-hidden","true").removeClass("open");});}
function openSearchDialog(trigger,searchDialog){if(searchDialog.hasClass("open")){return;}
closeMenuDialog();addMainOverlay();trigger.addClass("open").attr("aria-expanded","true");searchDialog.addClass("open").attr("aria-hidden","false");enableTabAccessToSearch();var textBox=searchDialog.find(".textbox");textBox.prop("autocomplete","off").trigger("focus").prop("autocomplete","on");var $firstItem=$("#TopBarMenuButton").first();var $lastItem=searchDialog.find(".submit-button");ng.util.trapFocusOn($(".top-bar"),$firstItem,$lastItem);searchDialog.on("keydown",function(e){var KEYCODE_ESC=27;if(e.keyCode===KEYCODE_ESC){closeSearchDialog();}});}
function closeSearchDialog(){var searchDialog=$(".top-bar .search-form");if(!searchDialog.hasClass("open")){return;}
searchDialog.removeClass("open").attr("aria-hidden","true");var searchButton=$("#TopBarSearchButton1");searchButton.removeClass("open").attr("aria-expanded","false");removeMainOverlay();disableTabAccessToMenuAndSearch();ng.util.trapFocusOff($(".top-bar"));searchButton.trigger("focus");}
function addMainOverlay(){$(".main").addClass("main-overlay");$(".main, footer").attr("aria-hidden","true");}
function removeMainOverlay(){$(".main").removeClass("main-overlay");$(".main, footer").removeAttr("aria-hidden");}
function disableTabAccessToMenuAndSearch(){disableTabAccess($(".top-bar .menu, .top-bar .search-form"));}
function enableTabAccessToSearch(){enableTabAccess($(".top-bar .search-form"));}
function disableTabAccess($container){$container.find("a, button, input").attr("tabindex","-1");}
function enableTabAccess($container){$container.find("a, button, input").removeAttr("tabindex");}
function ensureTessSession(){var request=new XMLHttpRequest();request.withCredentials=true;request.overrideMimeType("application/json");request.open("GET",tNewApiSessionUrl,true);request.send(null);}
function manageSessionInfo(){getSessionState();setInterval(getSessionState,10000);}
function getSessionState(){if(DEBUG){if(DEBUG_SIGN_IN){updateSessionData('JG',1,'M',4000000);return;}else{updateSessionData('',0,'',0);return;}}
var sessionSharingOn=ng.util.getCookie(sSharingCookieName);if(sessionSharingOn==="Y"){if(retryGetSessionState>0){$.ajax({url:'/umbraco/Surface/Session/GetSessionState',cache:false,type:"GET",success:function(data){if(data===null){updateSessionData('',0,'',0);retryGetSessionState=retryGetSessionState-1;}else{var isAuth=data["isAuthenticated"]===true;var initials=isAuth?data["initials"]:"";var uid=data["constituentId"]!==undefined?+(data["constituentId"]):0;var memStatus=isAuth?data["membershipStatus"]:"";var itemsInBasket=data["numberOfItemsInCart"]!==undefined?+(data["numberOfItemsInCart"]):0;updateSessionData(initials,itemsInBasket,memStatus,uid);retryGetSessionState=0;}},error:function(){updateSessionData('',0,'',0);retryGetSessionState=retryGetSessionState-1;}});}}
else{updateSessionData('',0,'',0);}}
function updateSessionData(userInitials,itemsInBasket,membershipStatus,uid){ng.util.setCookie(sDataInitials,userInitials,0,"/");ng.util.setCookie(sDataBasketCount,itemsInBasket,0,"/");ng.util.setCookie(sDataMembershipStatus,membershipStatus,0,"/");ng.util.setCookie(sDataUserId,uid,0,"/");adjustViewForSession(userInitials,itemsInBasket);}
function adjustViewForSession(userInitials,itemsInBasket){$('.sessionUserInitials').html(userInitials);if(userInitials===''){$('.top-bar .authenticated-user').hide();$('.top-bar .anonymous-user').show();}
else{$('.top-bar .anonymous-user').hide();$('.top-bar .authenticated-user').show();}
if(itemsInBasket>0){$('.sessionUserBasketState').show();$('.sessionUserBasketItemsCount').show();}
else{$('.sessionUserBasketState').hide();$('.sessionUserBasketItemsCount').hide();}
var accountStatusText="";if(userInitials===""){accountStatusText+="You are not signed in.";}else{accountStatusText+="You are signed in.";}
if(itemsInBasket>0){accountStatusText+=" You have "+itemsInBasket+" item"+(itemsInBasket>1?"s":"")+" in your basket.";}
$(".top-bar #AccountStatusText").html(accountStatusText);}});;;
;(function(factory){'use strict';if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else if(typeof exports!=='undefined'){module.exports=factory(require('jquery'));}else{factory(jQuery);}}(function($){'use strict';var Slick=window.Slick||{};Slick=(function(){var instanceUid=0;function Slick(element,settings){var _=this,dataSettings;_.defaults={accessibility:true,adaptiveHeight:false,appendArrows:$(element),appendDots:$(element),arrows:true,asNavFor:null,prevArrow:'<button class="slick-prev" aria-label="Previous" type="button">Previous</button>',nextArrow:'<button class="slick-next" aria-label="Next" type="button">Next</button>',autoplay:false,autoplaySpeed:3000,centerMode:false,centerPadding:'50px',cssEase:'ease',customPaging:function(slider,i){return $('<button type="button" />').text(i+1);},dots:false,dotsClass:'slick-dots',draggable:true,easing:'linear',edgeFriction:0.35,fade:false,focusOnSelect:false,focusOnChange:false,infinite:true,initialSlide:0,lazyLoad:'ondemand',mobileFirst:false,pauseOnHover:true,pauseOnFocus:true,pauseOnDotsHover:false,respondTo:'window',responsive:null,rows:1,rtl:false,slide:'',slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:true,swipeToSlide:false,touchMove:true,touchThreshold:5,useCSS:true,useTransform:true,variableWidth:false,vertical:false,verticalSwiping:false,waitForAnimate:true,zIndex:1000};_.initials={animating:false,dragging:false,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,scrolling:false,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:false,slideOffset:0,swipeLeft:null,swiping:false,$list:null,touchObject:{},transformsEnabled:false,unslicked:false};$.extend(_,_.initials);_.activeBreakpoint=null;_.animType=null;_.animProp=null;_.breakpoints=[];_.breakpointSettings=[];_.cssTransitions=false;_.focussed=false;_.interrupted=false;_.hidden='hidden';_.paused=true;_.positionProp=null;_.respondTo=null;_.rowCount=1;_.shouldClick=true;_.$slider=$(element);_.$slidesCache=null;_.transformType=null;_.transitionType=null;_.visibilityChange='visibilitychange';_.windowWidth=0;_.windowTimer=null;dataSettings=$(element).data('slick')||{};_.options=$.extend({},_.defaults,settings,dataSettings);_.currentSlide=_.options.initialSlide;_.originalSettings=_.options;if(typeof document.mozHidden!=='undefined'){_.hidden='mozHidden';_.visibilityChange='mozvisibilitychange';}else if(typeof document.webkitHidden!=='undefined'){_.hidden='webkitHidden';_.visibilityChange='webkitvisibilitychange';}
_.autoPlay=$.proxy(_.autoPlay,_);_.autoPlayClear=$.proxy(_.autoPlayClear,_);_.autoPlayIterator=$.proxy(_.autoPlayIterator,_);_.changeSlide=$.proxy(_.changeSlide,_);_.clickHandler=$.proxy(_.clickHandler,_);_.selectHandler=$.proxy(_.selectHandler,_);_.setPosition=$.proxy(_.setPosition,_);_.swipeHandler=$.proxy(_.swipeHandler,_);_.dragHandler=$.proxy(_.dragHandler,_);_.keyHandler=$.proxy(_.keyHandler,_);_.instanceUid=instanceUid++;_.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/;_.registerBreakpoints();_.init(true);}
return Slick;}());Slick.prototype.activateADA=function(){var _=this;_.$slideTrack.find('.slick-active').attr({'aria-hidden':'false'}).find('a, input, button, select').attr({'tabindex':'0'});};Slick.prototype.addSlide=Slick.prototype.slickAdd=function(markup,index,addBefore){var _=this;if(typeof(index)==='boolean'){addBefore=index;index=null;}else if(index<0||(index>=_.slideCount)){return false;}
_.unload();if(typeof(index)==='number'){if(index===0&&_.$slides.length===0){$(markup).appendTo(_.$slideTrack);}else if(addBefore){$(markup).insertBefore(_.$slides.eq(index));}else{$(markup).insertAfter(_.$slides.eq(index));}}else{if(addBefore===true){$(markup).prependTo(_.$slideTrack);}else{$(markup).appendTo(_.$slideTrack);}}
_.$slides=_.$slideTrack.children(this.options.slide);_.$slideTrack.children(this.options.slide).detach();_.$slideTrack.append(_.$slides);_.$slides.each(function(index,element){$(element).attr('data-slick-index',index);});_.$slidesCache=_.$slides;_.reinit();};Slick.prototype.animateHeight=function(){var _=this;if(_.options.slidesToShow===1&&_.options.adaptiveHeight===true&&_.options.vertical===false){var targetHeight=_.$slides.eq(_.currentSlide).outerHeight(true);_.$list.animate({height:targetHeight},_.options.speed);}};Slick.prototype.animateSlide=function(targetLeft,callback){var animProps={},_=this;_.animateHeight();if(_.options.rtl===true&&_.options.vertical===false){targetLeft=-targetLeft;}
if(_.transformsEnabled===false){if(_.options.vertical===false){_.$slideTrack.animate({left:targetLeft},_.options.speed,_.options.easing,callback);}else{_.$slideTrack.animate({top:targetLeft},_.options.speed,_.options.easing,callback);}}else{if(_.cssTransitions===false){if(_.options.rtl===true){_.currentLeft=-(_.currentLeft);}
$({animStart:_.currentLeft}).animate({animStart:targetLeft},{duration:_.options.speed,easing:_.options.easing,step:function(now){now=Math.ceil(now);if(_.options.vertical===false){animProps[_.animType]='translate('+
now+'px, 0px)';_.$slideTrack.css(animProps);}else{animProps[_.animType]='translate(0px,'+
now+'px)';_.$slideTrack.css(animProps);}},complete:function(){if(callback){callback.call();}}});}else{_.applyTransition();targetLeft=Math.ceil(targetLeft);if(_.options.vertical===false){animProps[_.animType]='translate3d('+targetLeft+'px, 0px, 0px)';}else{animProps[_.animType]='translate3d(0px,'+targetLeft+'px, 0px)';}
_.$slideTrack.css(animProps);if(callback){setTimeout(function(){_.disableTransition();callback.call();},_.options.speed);}}}};Slick.prototype.getNavTarget=function(){var _=this,asNavFor=_.options.asNavFor;if(asNavFor&&asNavFor!==null){asNavFor=$(asNavFor).not(_.$slider);}
return asNavFor;};Slick.prototype.asNavFor=function(index){var _=this,asNavFor=_.getNavTarget();if(asNavFor!==null&&typeof asNavFor==='object'){asNavFor.each(function(){var target=$(this).slick('getSlick');if(!target.unslicked){target.slideHandler(index,true);}});}};Slick.prototype.applyTransition=function(slide){var _=this,transition={};if(_.options.fade===false){transition[_.transitionType]=_.transformType+' '+_.options.speed+'ms '+_.options.cssEase;}else{transition[_.transitionType]='opacity '+_.options.speed+'ms '+_.options.cssEase;}
if(_.options.fade===false){_.$slideTrack.css(transition);}else{_.$slides.eq(slide).css(transition);}};Slick.prototype.autoPlay=function(){var _=this;_.autoPlayClear();if(_.slideCount>_.options.slidesToShow){_.autoPlayTimer=setInterval(_.autoPlayIterator,_.options.autoplaySpeed);}};Slick.prototype.autoPlayClear=function(){var _=this;if(_.autoPlayTimer){clearInterval(_.autoPlayTimer);}};Slick.prototype.autoPlayIterator=function(){var _=this,slideTo=_.currentSlide+_.options.slidesToScroll;if(!_.paused&&!_.interrupted&&!_.focussed){if(_.options.infinite===false){if(_.direction===1&&(_.currentSlide+1)===(_.slideCount-1)){_.direction=0;}
else if(_.direction===0){slideTo=_.currentSlide-_.options.slidesToScroll;if(_.currentSlide-1===0){_.direction=1;}}}
_.slideHandler(slideTo);}};Slick.prototype.buildArrows=function(){var _=this;if(_.options.arrows===true){_.$prevArrow=$(_.options.prevArrow).addClass('slick-arrow');_.$nextArrow=$(_.options.nextArrow).addClass('slick-arrow');if(_.slideCount>_.options.slidesToShow){_.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');_.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');if(_.htmlExpr.test(_.options.prevArrow)){_.$prevArrow.prependTo(_.options.appendArrows);}
if(_.htmlExpr.test(_.options.nextArrow)){_.$nextArrow.appendTo(_.options.appendArrows);}
if(_.options.infinite!==true){_.$prevArrow.addClass('slick-disabled').attr('aria-disabled','true');}}else{_.$prevArrow.add(_.$nextArrow).addClass('slick-hidden').attr({'aria-disabled':'true','tabindex':'-1'});}}};Slick.prototype.buildDots=function(){var _=this,i,dot;if(_.options.dots===true&&_.slideCount>_.options.slidesToShow){_.$slider.addClass('slick-dotted');dot=$('<ul />').addClass(_.options.dotsClass);for(i=0;i<=_.getDotCount();i+=1){dot.append($('<li />').append(_.options.customPaging.call(this,_,i)));}
_.$dots=dot.appendTo(_.options.appendDots);_.$dots.find('li').first().addClass('slick-active');}};Slick.prototype.buildOut=function(){var _=this;_.$slides=_.$slider.children(_.options.slide+':not(.slick-cloned)').addClass('slick-slide');_.slideCount=_.$slides.length;_.$slides.each(function(index,element){$(element).attr('data-slick-index',index).data('originalStyling',$(element).attr('style')||'');});_.$slider.addClass('slick-slider');_.$slideTrack=(_.slideCount===0)?$('<div class="slick-track"/>').appendTo(_.$slider):_.$slides.wrapAll('<div class="slick-track"/>').parent();_.$list=_.$slideTrack.wrap('<div class="slick-list"/>').parent();_.$slideTrack.css('opacity',0);if(_.options.centerMode===true||_.options.swipeToSlide===true){_.options.slidesToScroll=1;}
$('img[data-lazy]',_.$slider).not('[src]').addClass('slick-loading');_.setupInfinite();_.buildArrows();_.buildDots();_.updateDots();_.setSlideClasses(typeof _.currentSlide==='number'?_.currentSlide:0);if(_.options.draggable===true){_.$list.addClass('draggable');}};Slick.prototype.buildRows=function(){var _=this,a,b,c,newSlides,numOfSlides,originalSlides,slidesPerSection;newSlides=document.createDocumentFragment();originalSlides=_.$slider.children();if(_.options.rows>0){slidesPerSection=_.options.slidesPerRow*_.options.rows;numOfSlides=Math.ceil(originalSlides.length/slidesPerSection);for(a=0;a<numOfSlides;a++){var slide=document.createElement('div');for(b=0;b<_.options.rows;b++){var row=document.createElement('div');for(c=0;c<_.options.slidesPerRow;c++){var target=(a*slidesPerSection+((b*_.options.slidesPerRow)+c));if(originalSlides.get(target)){row.appendChild(originalSlides.get(target));}}
slide.appendChild(row);}
newSlides.appendChild(slide);}
_.$slider.empty().append(newSlides);_.$slider.children().children().children().css({'width':(100/_.options.slidesPerRow)+'%','display':'inline-block'});}};Slick.prototype.checkResponsive=function(initial,forceUpdate){var _=this,breakpoint,targetBreakpoint,respondToWidth,triggerBreakpoint=false;var sliderWidth=_.$slider.width();var windowWidth=window.innerWidth||$(window).width();if(_.respondTo==='window'){respondToWidth=windowWidth;}else if(_.respondTo==='slider'){respondToWidth=sliderWidth;}else if(_.respondTo==='min'){respondToWidth=Math.min(windowWidth,sliderWidth);}
if(_.options.responsive&&_.options.responsive.length&&_.options.responsive!==null){targetBreakpoint=null;for(breakpoint in _.breakpoints){if(_.breakpoints.hasOwnProperty(breakpoint)){if(_.originalSettings.mobileFirst===false){if(respondToWidth<_.breakpoints[breakpoint]){targetBreakpoint=_.breakpoints[breakpoint];}}else{if(respondToWidth>_.breakpoints[breakpoint]){targetBreakpoint=_.breakpoints[breakpoint];}}}}
if(targetBreakpoint!==null){if(_.activeBreakpoint!==null){if(targetBreakpoint!==_.activeBreakpoint||forceUpdate){_.activeBreakpoint=targetBreakpoint;if(_.breakpointSettings[targetBreakpoint]==='unslick'){_.unslick(targetBreakpoint);}else{_.options=$.extend({},_.originalSettings,_.breakpointSettings[targetBreakpoint]);if(initial===true){_.currentSlide=_.options.initialSlide;}
_.refresh(initial);}
triggerBreakpoint=targetBreakpoint;}}else{_.activeBreakpoint=targetBreakpoint;if(_.breakpointSettings[targetBreakpoint]==='unslick'){_.unslick(targetBreakpoint);}else{_.options=$.extend({},_.originalSettings,_.breakpointSettings[targetBreakpoint]);if(initial===true){_.currentSlide=_.options.initialSlide;}
_.refresh(initial);}
triggerBreakpoint=targetBreakpoint;}}else{if(_.activeBreakpoint!==null){_.activeBreakpoint=null;_.options=_.originalSettings;if(initial===true){_.currentSlide=_.options.initialSlide;}
_.refresh(initial);triggerBreakpoint=targetBreakpoint;}}
if(!initial&&triggerBreakpoint!==false){_.$slider.trigger('breakpoint',[_,triggerBreakpoint]);}}};Slick.prototype.changeSlide=function(event,dontAnimate){var _=this,$target=$(event.currentTarget),indexOffset,slideOffset,unevenOffset;if($target.is('a')){event.preventDefault();}
if(!$target.is('li')){$target=$target.closest('li');}
unevenOffset=(_.slideCount%_.options.slidesToScroll!==0);indexOffset=unevenOffset?0:(_.slideCount-_.currentSlide)%_.options.slidesToScroll;switch(event.data.message){case'previous':slideOffset=indexOffset===0?_.options.slidesToScroll:_.options.slidesToShow-indexOffset;if(_.slideCount>_.options.slidesToShow){_.slideHandler(_.currentSlide-slideOffset,false,dontAnimate);}
break;case'next':slideOffset=indexOffset===0?_.options.slidesToScroll:indexOffset;if(_.slideCount>_.options.slidesToShow){_.slideHandler(_.currentSlide+slideOffset,false,dontAnimate);}
break;case'index':var index=event.data.index===0?0:event.data.index||$target.index()*_.options.slidesToScroll;_.slideHandler(_.checkNavigable(index),false,dontAnimate);$target.children().trigger('focus');break;default:return;}};Slick.prototype.checkNavigable=function(index){var _=this,navigables,prevNavigable;navigables=_.getNavigableIndexes();prevNavigable=0;if(index>navigables[navigables.length-1]){index=navigables[navigables.length-1];}else{for(var n in navigables){if(index<navigables[n]){index=prevNavigable;break;}
prevNavigable=navigables[n];}}
return index;};Slick.prototype.cleanUpEvents=function(){var _=this;if(_.options.dots&&_.$dots!==null){$('li',_.$dots).off('click.slick',_.changeSlide).off('mouseenter.slick',$.proxy(_.interrupt,_,true)).off('mouseleave.slick',$.proxy(_.interrupt,_,false));if(_.options.accessibility===true){_.$dots.off('keydown.slick',_.keyHandler);}}
_.$slider.off('focus.slick blur.slick');if(_.options.arrows===true&&_.slideCount>_.options.slidesToShow){_.$prevArrow&&_.$prevArrow.off('click.slick',_.changeSlide);_.$nextArrow&&_.$nextArrow.off('click.slick',_.changeSlide);if(_.options.accessibility===true){_.$prevArrow&&_.$prevArrow.off('keydown.slick',_.keyHandler);_.$nextArrow&&_.$nextArrow.off('keydown.slick',_.keyHandler);}}
_.$list.off('touchstart.slick mousedown.slick',_.swipeHandler);_.$list.off('touchmove.slick mousemove.slick',_.swipeHandler);_.$list.off('touchend.slick mouseup.slick',_.swipeHandler);_.$list.off('touchcancel.slick mouseleave.slick',_.swipeHandler);_.$list.off('click.slick',_.clickHandler);$(document).off(_.visibilityChange,_.visibility);_.cleanUpSlideEvents();if(_.options.accessibility===true){_.$list.off('keydown.slick',_.keyHandler);}
if(_.options.focusOnSelect===true){$(_.$slideTrack).children().off('click.slick',_.selectHandler);}
$(window).off('orientationchange.slick.slick-'+_.instanceUid,_.orientationChange);$(window).off('resize.slick.slick-'+_.instanceUid,_.resize);$('[draggable!=true]',_.$slideTrack).off('dragstart',_.preventDefault);$(window).off('load.slick.slick-'+_.instanceUid,_.setPosition);};Slick.prototype.cleanUpSlideEvents=function(){var _=this;_.$list.off('mouseenter.slick',$.proxy(_.interrupt,_,true));_.$list.off('mouseleave.slick',$.proxy(_.interrupt,_,false));};Slick.prototype.cleanUpRows=function(){var _=this,originalSlides;if(_.options.rows>0){originalSlides=_.$slides.children().children();originalSlides.removeAttr('style');_.$slider.empty().append(originalSlides);}};Slick.prototype.clickHandler=function(event){var _=this;if(_.shouldClick===false){event.stopImmediatePropagation();event.stopPropagation();event.preventDefault();}};Slick.prototype.destroy=function(refresh){var _=this;_.autoPlayClear();_.touchObject={};_.cleanUpEvents();$('.slick-cloned',_.$slider).detach();if(_.$dots){_.$dots.remove();}
if(_.$prevArrow&&_.$prevArrow.length){_.$prevArrow.removeClass('slick-disabled slick-arrow slick-hidden').removeAttr('aria-hidden aria-disabled tabindex').css('display','');if(_.htmlExpr.test(_.options.prevArrow)){_.$prevArrow.remove();}}
if(_.$nextArrow&&_.$nextArrow.length){_.$nextArrow.removeClass('slick-disabled slick-arrow slick-hidden').removeAttr('aria-hidden aria-disabled tabindex').css('display','');if(_.htmlExpr.test(_.options.nextArrow)){_.$nextArrow.remove();}}
if(_.$slides){_.$slides.removeClass('slick-slide slick-active slick-center slick-visible slick-current').removeAttr('aria-hidden').removeAttr('data-slick-index').each(function(){$(this).attr('style',$(this).data('originalStyling'));});_.$slideTrack.children(this.options.slide).detach();_.$slideTrack.detach();_.$list.detach();_.$slider.append(_.$slides);}
_.cleanUpRows();_.$slider.removeClass('slick-slider');_.$slider.removeClass('slick-initialized');_.$slider.removeClass('slick-dotted');_.unslicked=true;if(!refresh){_.$slider.trigger('destroy',[_]);}};Slick.prototype.disableTransition=function(slide){var _=this,transition={};transition[_.transitionType]='';if(_.options.fade===false){_.$slideTrack.css(transition);}else{_.$slides.eq(slide).css(transition);}};Slick.prototype.fadeSlide=function(slideIndex,callback){var _=this;if(_.cssTransitions===false){_.$slides.eq(slideIndex).css({zIndex:_.options.zIndex});_.$slides.eq(slideIndex).animate({opacity:1},_.options.speed,_.options.easing,callback);}else{_.applyTransition(slideIndex);_.$slides.eq(slideIndex).css({opacity:1,zIndex:_.options.zIndex});if(callback){setTimeout(function(){_.disableTransition(slideIndex);callback.call();},_.options.speed);}}};Slick.prototype.fadeSlideOut=function(slideIndex){var _=this;if(_.cssTransitions===false){_.$slides.eq(slideIndex).animate({opacity:0,zIndex:_.options.zIndex-2},_.options.speed,_.options.easing);}else{_.applyTransition(slideIndex);_.$slides.eq(slideIndex).css({opacity:0,zIndex:_.options.zIndex-2});}};Slick.prototype.filterSlides=Slick.prototype.slickFilter=function(filter){var _=this;if(filter!==null){_.$slidesCache=_.$slides;_.unload();_.$slideTrack.children(this.options.slide).detach();_.$slidesCache.filter(filter).appendTo(_.$slideTrack);_.reinit();}};Slick.prototype.focusHandler=function(){var _=this;_.$slider.off('focus.slick blur.slick').on('focus.slick blur.slick','*',function(event){event.stopImmediatePropagation();var $sf=$(this);setTimeout(function(){if(_.options.pauseOnFocus){_.focussed=$sf.is(':focus');_.autoPlay();}},0);});};Slick.prototype.getCurrent=Slick.prototype.slickCurrentSlide=function(){var _=this;return _.currentSlide;};Slick.prototype.getDotCount=function(){var _=this;var breakPoint=0;var counter=0;var pagerQty=0;if(_.options.infinite===true){if(_.slideCount<=_.options.slidesToShow){++pagerQty;}else{while(breakPoint<_.slideCount){++pagerQty;breakPoint=counter+_.options.slidesToScroll;counter+=_.options.slidesToScroll<=_.options.slidesToShow?_.options.slidesToScroll:_.options.slidesToShow;}}}else if(_.options.centerMode===true){pagerQty=_.slideCount;}else if(!_.options.asNavFor){pagerQty=1+Math.ceil((_.slideCount-_.options.slidesToShow)/_.options.slidesToScroll);}else{while(breakPoint<_.slideCount){++pagerQty;breakPoint=counter+_.options.slidesToScroll;counter+=_.options.slidesToScroll<=_.options.slidesToShow?_.options.slidesToScroll:_.options.slidesToShow;}}
return pagerQty-1;};Slick.prototype.getLeft=function(slideIndex){var _=this,targetLeft,verticalHeight,verticalOffset=0,targetSlide,coef;_.slideOffset=0;verticalHeight=_.$slides.first().outerHeight(true);if(_.options.infinite===true){if(_.slideCount>_.options.slidesToShow){_.slideOffset=(_.slideWidth*_.options.slidesToShow)* -1;coef=-1
if(_.options.vertical===true&&_.options.centerMode===true){if(_.options.slidesToShow===2){coef=-1.5;}else if(_.options.slidesToShow===1){coef=-2}}
verticalOffset=(verticalHeight*_.options.slidesToShow)*coef;}
if(_.slideCount%_.options.slidesToScroll!==0){if(slideIndex+_.options.slidesToScroll>_.slideCount&&_.slideCount>_.options.slidesToShow){if(slideIndex>_.slideCount){_.slideOffset=((_.options.slidesToShow-(slideIndex-_.slideCount))*_.slideWidth)* -1;verticalOffset=((_.options.slidesToShow-(slideIndex-_.slideCount))*verticalHeight)* -1;}else{_.slideOffset=((_.slideCount%_.options.slidesToScroll)*_.slideWidth)* -1;verticalOffset=((_.slideCount%_.options.slidesToScroll)*verticalHeight)* -1;}}}}else{if(slideIndex+_.options.slidesToShow>_.slideCount){_.slideOffset=((slideIndex+_.options.slidesToShow)-_.slideCount)*_.slideWidth;verticalOffset=((slideIndex+_.options.slidesToShow)-_.slideCount)*verticalHeight;}}
if(_.slideCount<=_.options.slidesToShow){_.slideOffset=0;verticalOffset=0;}
if(_.options.centerMode===true&&_.slideCount<=_.options.slidesToShow){_.slideOffset=((_.slideWidth*Math.floor(_.options.slidesToShow))/2)-((_.slideWidth*_.slideCount)/2);}else if(_.options.centerMode===true&&_.options.infinite===true){_.slideOffset+=_.slideWidth*Math.floor(_.options.slidesToShow/2)-_.slideWidth;}else if(_.options.centerMode===true){_.slideOffset=0;_.slideOffset+=_.slideWidth*Math.floor(_.options.slidesToShow/2);}
if(_.options.vertical===false){targetLeft=((slideIndex*_.slideWidth)* -1)+_.slideOffset;}else{targetLeft=((slideIndex*verticalHeight)* -1)+verticalOffset;}
if(_.options.variableWidth===true){if(_.slideCount<=_.options.slidesToShow||_.options.infinite===false){targetSlide=_.$slideTrack.children('.slick-slide').eq(slideIndex);}else{targetSlide=_.$slideTrack.children('.slick-slide').eq(slideIndex+_.options.slidesToShow);}
if(_.options.rtl===true){if(targetSlide[0]){targetLeft=(_.$slideTrack.width()-targetSlide[0].offsetLeft-targetSlide.width())* -1;}else{targetLeft=0;}}else{targetLeft=targetSlide[0]?targetSlide[0].offsetLeft* -1:0;}
if(_.options.centerMode===true){if(_.slideCount<=_.options.slidesToShow||_.options.infinite===false){targetSlide=_.$slideTrack.children('.slick-slide').eq(slideIndex);}else{targetSlide=_.$slideTrack.children('.slick-slide').eq(slideIndex+_.options.slidesToShow+1);}
if(_.options.rtl===true){if(targetSlide[0]){targetLeft=(_.$slideTrack.width()-targetSlide[0].offsetLeft-targetSlide.width())* -1;}else{targetLeft=0;}}else{targetLeft=targetSlide[0]?targetSlide[0].offsetLeft* -1:0;}
targetLeft+=(_.$list.width()-targetSlide.outerWidth())/2;}}
return targetLeft;};Slick.prototype.getOption=Slick.prototype.slickGetOption=function(option){var _=this;return _.options[option];};Slick.prototype.getNavigableIndexes=function(){var _=this,breakPoint=0,counter=0,indexes=[],max;if(_.options.infinite===false){max=_.slideCount;}else{breakPoint=_.options.slidesToScroll* -1;counter=_.options.slidesToScroll* -1;max=_.slideCount*2;}
while(breakPoint<max){indexes.push(breakPoint);breakPoint=counter+_.options.slidesToScroll;counter+=_.options.slidesToScroll<=_.options.slidesToShow?_.options.slidesToScroll:_.options.slidesToShow;}
return indexes;};Slick.prototype.getSlick=function(){return this;};Slick.prototype.getSlideCount=function(){var _=this,slidesTraversed,swipedSlide,centerOffset;centerOffset=_.options.centerMode===true?_.slideWidth*Math.floor(_.options.slidesToShow/2):0;if(_.options.swipeToSlide===true){_.$slideTrack.find('.slick-slide').each(function(index,slide){if(slide.offsetLeft-centerOffset+($(slide).outerWidth()/2)>(_.swipeLeft* -1)){swipedSlide=slide;return false;}});slidesTraversed=Math.abs($(swipedSlide).attr('data-slick-index')-_.currentSlide)||1;return slidesTraversed;}else{return _.options.slidesToScroll;}};Slick.prototype.goTo=Slick.prototype.slickGoTo=function(slide,dontAnimate){var _=this;_.changeSlide({data:{message:'index',index:parseInt(slide)}},dontAnimate);};Slick.prototype.init=function(creation){var _=this;if(!$(_.$slider).hasClass('slick-initialized')){$(_.$slider).addClass('slick-initialized');_.buildRows();_.buildOut();_.setProps();_.startLoad();_.loadSlider();_.initializeEvents();_.updateArrows();_.updateDots();_.checkResponsive(true);_.focusHandler();}
if(creation){_.$slider.trigger('init',[_]);}
if(_.options.accessibility===true){_.initADA();}
if(_.options.autoplay){_.paused=false;_.autoPlay();}};Slick.prototype.initADA=function(){var _=this,numDotGroups=Math.ceil(_.slideCount/_.options.slidesToShow),tabControlIndexes=_.getNavigableIndexes().filter(function(val){return(val>=0)&&(val<_.slideCount);});_.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({'aria-hidden':'true','tabindex':'-1'}).find('a, input, button, select').attr({'tabindex':'-1'});if(_.$dots!==null){_.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i){var slideControlIndex=tabControlIndexes.indexOf(i);$(this).attr({'role':'tabpanel','id':'slick-slide'+_.instanceUid+i,'tabindex':-1});if(slideControlIndex!==-1){var ariaButtonControl='slick-slide-control'+_.instanceUid+slideControlIndex
if($('#'+ariaButtonControl).length){$(this).attr({'aria-describedby':ariaButtonControl});}}});_.$dots.attr('role','tablist').find('li').each(function(i){var mappedSlideIndex=tabControlIndexes[i];$(this).attr({'role':'presentation'});$(this).find('button').first().attr({'role':'tab','id':'slick-slide-control'+_.instanceUid+i,'aria-controls':'slick-slide'+_.instanceUid+mappedSlideIndex,'aria-label':(i+1)+' of '+numDotGroups,'aria-selected':null,'tabindex':'-1'});}).eq(_.currentSlide).find('button').attr({'aria-selected':'true','tabindex':'0'}).end();}
for(var i=_.currentSlide,max=i+_.options.slidesToShow;i<max;i++){if(_.options.focusOnChange){_.$slides.eq(i).attr({'tabindex':'0'});}else{_.$slides.eq(i).removeAttr('tabindex');}}
_.activateADA();};Slick.prototype.initArrowEvents=function(){var _=this;if(_.options.arrows===true&&_.slideCount>_.options.slidesToShow){_.$prevArrow.off('click.slick').on('click.slick',{message:'previous'},_.changeSlide);_.$nextArrow.off('click.slick').on('click.slick',{message:'next'},_.changeSlide);if(_.options.accessibility===true){_.$prevArrow.on('keydown.slick',_.keyHandler);_.$nextArrow.on('keydown.slick',_.keyHandler);}}};Slick.prototype.initDotEvents=function(){var _=this;if(_.options.dots===true&&_.slideCount>_.options.slidesToShow){$('li',_.$dots).on('click.slick',{message:'index'},_.changeSlide);if(_.options.accessibility===true){_.$dots.on('keydown.slick',_.keyHandler);}}
if(_.options.dots===true&&_.options.pauseOnDotsHover===true&&_.slideCount>_.options.slidesToShow){$('li',_.$dots).on('mouseenter.slick',$.proxy(_.interrupt,_,true)).on('mouseleave.slick',$.proxy(_.interrupt,_,false));}};Slick.prototype.initSlideEvents=function(){var _=this;if(_.options.pauseOnHover){_.$list.on('mouseenter.slick',$.proxy(_.interrupt,_,true));_.$list.on('mouseleave.slick',$.proxy(_.interrupt,_,false));}};Slick.prototype.initializeEvents=function(){var _=this;_.initArrowEvents();_.initDotEvents();_.initSlideEvents();_.$list.on('touchstart.slick mousedown.slick',{action:'start'},_.swipeHandler);_.$list.on('touchmove.slick mousemove.slick',{action:'move'},_.swipeHandler);_.$list.on('touchend.slick mouseup.slick',{action:'end'},_.swipeHandler);_.$list.on('touchcancel.slick mouseleave.slick',{action:'end'},_.swipeHandler);_.$list.on('click.slick',_.clickHandler);$(document).on(_.visibilityChange,$.proxy(_.visibility,_));if(_.options.accessibility===true){_.$list.on('keydown.slick',_.keyHandler);}
if(_.options.focusOnSelect===true){$(_.$slideTrack).children().on('click.slick',_.selectHandler);}
$(window).on('orientationchange.slick.slick-'+_.instanceUid,$.proxy(_.orientationChange,_));$(window).on('resize.slick.slick-'+_.instanceUid,$.proxy(_.resize,_));$('[draggable!=true]',_.$slideTrack).on('dragstart',_.preventDefault);$(window).on('load.slick.slick-'+_.instanceUid,_.setPosition);$(_.setPosition);};Slick.prototype.initUI=function(){var _=this;if(_.options.arrows===true&&_.slideCount>_.options.slidesToShow){_.$prevArrow.show();_.$nextArrow.show();}
if(_.options.dots===true&&_.slideCount>_.options.slidesToShow){_.$dots.show();}};Slick.prototype.keyHandler=function(event){var _=this;if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')){if(event.keyCode===37&&_.options.accessibility===true){_.changeSlide({data:{message:_.options.rtl===true?'next':'previous'}});}else if(event.keyCode===39&&_.options.accessibility===true){_.changeSlide({data:{message:_.options.rtl===true?'previous':'next'}});}}};Slick.prototype.lazyLoad=function(){var _=this,loadRange,cloneRange,rangeStart,rangeEnd;function loadImages(imagesScope){$('img[data-lazy]',imagesScope).each(function(){var image=$(this),imageSource=$(this).attr('data-lazy'),imageSrcSet=$(this).attr('data-srcset'),imageSizes=$(this).attr('data-sizes')||_.$slider.attr('data-sizes'),imageToLoad=document.createElement('img');imageToLoad.onload=function(){image.animate({opacity:0},100,function(){if(imageSrcSet){image.attr('srcset',imageSrcSet);if(imageSizes){image.attr('sizes',imageSizes);}}
image.attr('src',imageSource).animate({opacity:1},200,function(){image.removeAttr('data-lazy data-srcset data-sizes').removeClass('slick-loading');});_.$slider.trigger('lazyLoaded',[_,image,imageSource]);});};imageToLoad.onerror=function(){image.removeAttr('data-lazy').removeClass('slick-loading').addClass('slick-lazyload-error');_.$slider.trigger('lazyLoadError',[_,image,imageSource]);};imageToLoad.src=imageSource;});}
if(_.options.centerMode===true){if(_.options.infinite===true){rangeStart=_.currentSlide+(_.options.slidesToShow/2+1);rangeEnd=rangeStart+_.options.slidesToShow+2;}else{rangeStart=Math.max(0,_.currentSlide-(_.options.slidesToShow/2+1));rangeEnd=2+(_.options.slidesToShow/2+1)+_.currentSlide;}}else{rangeStart=_.options.infinite?_.options.slidesToShow+_.currentSlide:_.currentSlide;rangeEnd=Math.ceil(rangeStart+_.options.slidesToShow);if(_.options.fade===true){if(rangeStart>0)rangeStart--;if(rangeEnd<=_.slideCount)rangeEnd++;}}
loadRange=_.$slider.find('.slick-slide').slice(rangeStart,rangeEnd);if(_.options.lazyLoad==='anticipated'){var prevSlide=rangeStart-1,nextSlide=rangeEnd,$slides=_.$slider.find('.slick-slide');for(var i=0;i<_.options.slidesToScroll;i++){if(prevSlide<0)prevSlide=_.slideCount-1;loadRange=loadRange.add($slides.eq(prevSlide));loadRange=loadRange.add($slides.eq(nextSlide));prevSlide--;nextSlide++;}}
loadImages(loadRange);if(_.slideCount<=_.options.slidesToShow){cloneRange=_.$slider.find('.slick-slide');loadImages(cloneRange);}else
if(_.currentSlide>=_.slideCount-_.options.slidesToShow){cloneRange=_.$slider.find('.slick-cloned').slice(0,_.options.slidesToShow);loadImages(cloneRange);}else if(_.currentSlide===0){cloneRange=_.$slider.find('.slick-cloned').slice(_.options.slidesToShow* -1);loadImages(cloneRange);}};Slick.prototype.loadSlider=function(){var _=this;_.setPosition();_.$slideTrack.css({opacity:1});_.$slider.removeClass('slick-loading');_.initUI();if(_.options.lazyLoad==='progressive'){_.progressiveLazyLoad();}};Slick.prototype.next=Slick.prototype.slickNext=function(){var _=this;_.changeSlide({data:{message:'next'}});};Slick.prototype.orientationChange=function(){var _=this;_.checkResponsive();_.setPosition();};Slick.prototype.pause=Slick.prototype.slickPause=function(){var _=this;_.autoPlayClear();_.paused=true;};Slick.prototype.play=Slick.prototype.slickPlay=function(){var _=this;_.autoPlay();_.options.autoplay=true;_.paused=false;_.focussed=false;_.interrupted=false;};Slick.prototype.postSlide=function(index){var _=this;if(!_.unslicked){_.$slider.trigger('afterChange',[_,index]);_.animating=false;if(_.slideCount>_.options.slidesToShow){_.setPosition();}
_.swipeLeft=null;if(_.options.autoplay){_.autoPlay();}
if(_.options.accessibility===true){_.initADA();if(_.options.focusOnChange){var $currentSlide=$(_.$slides.get(_.currentSlide));$currentSlide.attr('tabindex',0).focus();}}}};Slick.prototype.prev=Slick.prototype.slickPrev=function(){var _=this;_.changeSlide({data:{message:'previous'}});};Slick.prototype.preventDefault=function(event){event.preventDefault();};Slick.prototype.progressiveLazyLoad=function(tryCount){tryCount=tryCount||1;var _=this,$imgsToLoad=$('img[data-lazy]',_.$slider),image,imageSource,imageSrcSet,imageSizes,imageToLoad;if($imgsToLoad.length){image=$imgsToLoad.first();imageSource=image.attr('data-lazy');imageSrcSet=image.attr('data-srcset');imageSizes=image.attr('data-sizes')||_.$slider.attr('data-sizes');imageToLoad=document.createElement('img');imageToLoad.onload=function(){if(imageSrcSet){image.attr('srcset',imageSrcSet);if(imageSizes){image.attr('sizes',imageSizes);}}
image.attr('src',imageSource).removeAttr('data-lazy data-srcset data-sizes').removeClass('slick-loading');if(_.options.adaptiveHeight===true){_.setPosition();}
_.$slider.trigger('lazyLoaded',[_,image,imageSource]);_.progressiveLazyLoad();};imageToLoad.onerror=function(){if(tryCount<3){setTimeout(function(){_.progressiveLazyLoad(tryCount+1);},500);}else{image.removeAttr('data-lazy').removeClass('slick-loading').addClass('slick-lazyload-error');_.$slider.trigger('lazyLoadError',[_,image,imageSource]);_.progressiveLazyLoad();}};imageToLoad.src=imageSource;}else{_.$slider.trigger('allImagesLoaded',[_]);}};Slick.prototype.refresh=function(initializing){var _=this,currentSlide,lastVisibleIndex;lastVisibleIndex=_.slideCount-_.options.slidesToShow;if(!_.options.infinite&&(_.currentSlide>lastVisibleIndex)){_.currentSlide=lastVisibleIndex;}
if(_.slideCount<=_.options.slidesToShow){_.currentSlide=0;}
currentSlide=_.currentSlide;_.destroy(true);$.extend(_,_.initials,{currentSlide:currentSlide});_.init();if(!initializing){_.changeSlide({data:{message:'index',index:currentSlide}},false);}};Slick.prototype.registerBreakpoints=function(){var _=this,breakpoint,currentBreakpoint,l,responsiveSettings=_.options.responsive||null;if($.type(responsiveSettings)==='array'&&responsiveSettings.length){_.respondTo=_.options.respondTo||'window';for(breakpoint in responsiveSettings){l=_.breakpoints.length-1;if(responsiveSettings.hasOwnProperty(breakpoint)){currentBreakpoint=responsiveSettings[breakpoint].breakpoint;while(l>=0){if(_.breakpoints[l]&&_.breakpoints[l]===currentBreakpoint){_.breakpoints.splice(l,1);}
l--;}
_.breakpoints.push(currentBreakpoint);_.breakpointSettings[currentBreakpoint]=responsiveSettings[breakpoint].settings;}}
_.breakpoints.sort(function(a,b){return(_.options.mobileFirst)?a-b:b-a;});}};Slick.prototype.reinit=function(){var _=this;_.$slides=_.$slideTrack.children(_.options.slide).addClass('slick-slide');_.slideCount=_.$slides.length;if(_.currentSlide>=_.slideCount&&_.currentSlide!==0){_.currentSlide=_.currentSlide-_.options.slidesToScroll;}
if(_.slideCount<=_.options.slidesToShow){_.currentSlide=0;}
_.registerBreakpoints();_.setProps();_.setupInfinite();_.buildArrows();_.updateArrows();_.initArrowEvents();_.buildDots();_.updateDots();_.initDotEvents();_.cleanUpSlideEvents();_.initSlideEvents();_.checkResponsive(false,true);if(_.options.focusOnSelect===true){$(_.$slideTrack).children().on('click.slick',_.selectHandler);}
_.setSlideClasses(typeof _.currentSlide==='number'?_.currentSlide:0);_.setPosition();_.focusHandler();_.paused=!_.options.autoplay;_.autoPlay();_.$slider.trigger('reInit',[_]);};Slick.prototype.resize=function(){var _=this;if($(window).width()!==_.windowWidth){clearTimeout(_.windowDelay);_.windowDelay=window.setTimeout(function(){_.windowWidth=$(window).width();_.checkResponsive();if(!_.unslicked){_.setPosition();}},50);}};Slick.prototype.removeSlide=Slick.prototype.slickRemove=function(index,removeBefore,removeAll){var _=this;if(typeof(index)==='boolean'){removeBefore=index;index=removeBefore===true?0:_.slideCount-1;}else{index=removeBefore===true?--index:index;}
if(_.slideCount<1||index<0||index>_.slideCount-1){return false;}
_.unload();if(removeAll===true){_.$slideTrack.children().remove();}else{_.$slideTrack.children(this.options.slide).eq(index).remove();}
_.$slides=_.$slideTrack.children(this.options.slide);_.$slideTrack.children(this.options.slide).detach();_.$slideTrack.append(_.$slides);_.$slidesCache=_.$slides;_.reinit();};Slick.prototype.setCSS=function(position){var _=this,positionProps={},x,y;if(_.options.rtl===true){position=-position;}
x=_.positionProp=='left'?Math.ceil(position)+'px':'0px';y=_.positionProp=='top'?Math.ceil(position)+'px':'0px';positionProps[_.positionProp]=position;if(_.transformsEnabled===false){_.$slideTrack.css(positionProps);}else{positionProps={};if(_.cssTransitions===false){positionProps[_.animType]='translate('+x+', '+y+')';_.$slideTrack.css(positionProps);}else{positionProps[_.animType]='translate3d('+x+', '+y+', 0px)';_.$slideTrack.css(positionProps);}}};Slick.prototype.setDimensions=function(){var _=this;if(_.options.vertical===false){if(_.options.centerMode===true){_.$list.css({padding:('0px '+_.options.centerPadding)});}}else{_.$list.height(_.$slides.first().outerHeight(true)*_.options.slidesToShow);if(_.options.centerMode===true){_.$list.css({padding:(_.options.centerPadding+' 0px')});}}
_.listWidth=_.$list.width();_.listHeight=_.$list.height();if(_.options.vertical===false&&_.options.variableWidth===false){_.slideWidth=Math.ceil(_.listWidth/_.options.slidesToShow);_.$slideTrack.width(Math.ceil((_.slideWidth*_.$slideTrack.children('.slick-slide').length)));}else if(_.options.variableWidth===true){_.$slideTrack.width(5000*_.slideCount);}else{_.slideWidth=Math.ceil(_.listWidth);_.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true)*_.$slideTrack.children('.slick-slide').length)));}
var offset=_.$slides.first().outerWidth(true)-_.$slides.first().width();if(_.options.variableWidth===false)_.$slideTrack.children('.slick-slide').width(_.slideWidth-offset);};Slick.prototype.setFade=function(){var _=this,targetLeft;_.$slides.each(function(index,element){targetLeft=(_.slideWidth*index)* -1;if(_.options.rtl===true){$(element).css({position:'relative',right:targetLeft,top:0,zIndex:_.options.zIndex-2,opacity:0});}else{$(element).css({position:'relative',left:targetLeft,top:0,zIndex:_.options.zIndex-2,opacity:0});}});_.$slides.eq(_.currentSlide).css({zIndex:_.options.zIndex-1,opacity:1});};Slick.prototype.setHeight=function(){var _=this;if(_.options.slidesToShow===1&&_.options.adaptiveHeight===true&&_.options.vertical===false){var targetHeight=_.$slides.eq(_.currentSlide).outerHeight(true);_.$list.css('height',targetHeight);}};Slick.prototype.setOption=Slick.prototype.slickSetOption=function(){var _=this,l,item,option,value,refresh=false,type;if($.type(arguments[0])==='object'){option=arguments[0];refresh=arguments[1];type='multiple';}else if($.type(arguments[0])==='string'){option=arguments[0];value=arguments[1];refresh=arguments[2];if(arguments[0]==='responsive'&&$.type(arguments[1])==='array'){type='responsive';}else if(typeof arguments[1]!=='undefined'){type='single';}}
if(type==='single'){_.options[option]=value;}else if(type==='multiple'){$.each(option,function(opt,val){_.options[opt]=val;});}else if(type==='responsive'){for(item in value){if($.type(_.options.responsive)!=='array'){_.options.responsive=[value[item]];}else{l=_.options.responsive.length-1;while(l>=0){if(_.options.responsive[l].breakpoint===value[item].breakpoint){_.options.responsive.splice(l,1);}
l--;}
_.options.responsive.push(value[item]);}}}
if(refresh){_.unload();_.reinit();}};Slick.prototype.setPosition=function(){var _=this;_.setDimensions();_.setHeight();if(_.options.fade===false){_.setCSS(_.getLeft(_.currentSlide));}else{_.setFade();}
_.$slider.trigger('setPosition',[_]);};Slick.prototype.setProps=function(){var _=this,bodyStyle=document.body.style;_.positionProp=_.options.vertical===true?'top':'left';if(_.positionProp==='top'){_.$slider.addClass('slick-vertical');}else{_.$slider.removeClass('slick-vertical');}
if(bodyStyle.WebkitTransition!==undefined||bodyStyle.MozTransition!==undefined||bodyStyle.msTransition!==undefined){if(_.options.useCSS===true){_.cssTransitions=true;}}
if(_.options.fade){if(typeof _.options.zIndex==='number'){if(_.options.zIndex<3){_.options.zIndex=3;}}else{_.options.zIndex=_.defaults.zIndex;}}
if(bodyStyle.OTransform!==undefined){_.animType='OTransform';_.transformType='-o-transform';_.transitionType='OTransition';if(bodyStyle.perspectiveProperty===undefined&&bodyStyle.webkitPerspective===undefined)_.animType=false;}
if(bodyStyle.MozTransform!==undefined){_.animType='MozTransform';_.transformType='-moz-transform';_.transitionType='MozTransition';if(bodyStyle.perspectiveProperty===undefined&&bodyStyle.MozPerspective===undefined)_.animType=false;}
if(bodyStyle.webkitTransform!==undefined){_.animType='webkitTransform';_.transformType='-webkit-transform';_.transitionType='webkitTransition';if(bodyStyle.perspectiveProperty===undefined&&bodyStyle.webkitPerspective===undefined)_.animType=false;}
if(bodyStyle.msTransform!==undefined){_.animType='msTransform';_.transformType='-ms-transform';_.transitionType='msTransition';if(bodyStyle.msTransform===undefined)_.animType=false;}
if(bodyStyle.transform!==undefined&&_.animType!==false){_.animType='transform';_.transformType='transform';_.transitionType='transition';}
_.transformsEnabled=_.options.useTransform&&(_.animType!==null&&_.animType!==false);};Slick.prototype.setSlideClasses=function(index){var _=this,centerOffset,allSlides,indexOffset,remainder;allSlides=_.$slider.find('.slick-slide').removeClass('slick-active slick-center slick-current').attr('aria-hidden','true');_.$slides.eq(index).addClass('slick-current');if(_.options.centerMode===true){var evenCoef=_.options.slidesToShow%2===0?1:0;centerOffset=Math.floor(_.options.slidesToShow/2);if(_.options.infinite===true){if(index>=centerOffset&&index<=(_.slideCount-1)-centerOffset){_.$slides.slice(index-centerOffset+evenCoef,index+centerOffset+1).addClass('slick-active').attr('aria-hidden','false');}else{indexOffset=_.options.slidesToShow+index;allSlides.slice(indexOffset-centerOffset+1+evenCoef,indexOffset+centerOffset+2).addClass('slick-active').attr('aria-hidden','false');}
if(index===0){allSlides.eq(allSlides.length-1-_.options.slidesToShow).addClass('slick-center');}else if(index===_.slideCount-1){allSlides.eq(_.options.slidesToShow).addClass('slick-center');}}
_.$slides.eq(index).addClass('slick-center');}else{if(index>=0&&index<=(_.slideCount-_.options.slidesToShow)){_.$slides.slice(index,index+_.options.slidesToShow).addClass('slick-active').attr('aria-hidden','false');}else if(allSlides.length<=_.options.slidesToShow){allSlides.addClass('slick-active').attr('aria-hidden','false');}else{remainder=_.slideCount%_.options.slidesToShow;indexOffset=_.options.infinite===true?_.options.slidesToShow+index:index;if(_.options.slidesToShow==_.options.slidesToScroll&&(_.slideCount-index)<_.options.slidesToShow){allSlides.slice(indexOffset-(_.options.slidesToShow-remainder),indexOffset+remainder).addClass('slick-active').attr('aria-hidden','false');}else{allSlides.slice(indexOffset,indexOffset+_.options.slidesToShow).addClass('slick-active').attr('aria-hidden','false');}}}
if(_.options.lazyLoad==='ondemand'||_.options.lazyLoad==='anticipated'){_.lazyLoad();}};Slick.prototype.setupInfinite=function(){var _=this,i,slideIndex,infiniteCount;if(_.options.fade===true){_.options.centerMode=false;}
if(_.options.infinite===true&&_.options.fade===false){slideIndex=null;if(_.slideCount>_.options.slidesToShow){if(_.options.centerMode===true){infiniteCount=_.options.slidesToShow+1;}else{infiniteCount=_.options.slidesToShow;}
for(i=_.slideCount;i>(_.slideCount-
infiniteCount);i-=1){slideIndex=i-1;$(_.$slides[slideIndex]).clone(true).attr('id','').attr('data-slick-index',slideIndex-_.slideCount).prependTo(_.$slideTrack).addClass('slick-cloned');}
for(i=0;i<infiniteCount+_.slideCount;i+=1){slideIndex=i;$(_.$slides[slideIndex]).clone(true).attr('id','').attr('data-slick-index',slideIndex+_.slideCount).appendTo(_.$slideTrack).addClass('slick-cloned');}
_.$slideTrack.find('.slick-cloned').find('[id]').each(function(){$(this).attr('id','');});}}};Slick.prototype.interrupt=function(toggle){var _=this;if(!toggle){_.autoPlay();}
_.interrupted=toggle;};Slick.prototype.selectHandler=function(event){var _=this;var targetElement=$(event.target).is('.slick-slide')?$(event.target):$(event.target).parents('.slick-slide');var index=parseInt(targetElement.attr('data-slick-index'));if(!index)index=0;if(_.slideCount<=_.options.slidesToShow){_.slideHandler(index,false,true);return;}
_.slideHandler(index);};Slick.prototype.slideHandler=function(index,sync,dontAnimate){var targetSlide,animSlide,oldSlide,slideLeft,targetLeft=null,_=this,navTarget;sync=sync||false;if(_.animating===true&&_.options.waitForAnimate===true){return;}
if(_.options.fade===true&&_.currentSlide===index){return;}
if(sync===false){_.asNavFor(index);}
targetSlide=index;targetLeft=_.getLeft(targetSlide);slideLeft=_.getLeft(_.currentSlide);_.currentLeft=_.swipeLeft===null?slideLeft:_.swipeLeft;if(_.options.infinite===false&&_.options.centerMode===false&&(index<0||index>_.getDotCount()*_.options.slidesToScroll)){if(_.options.fade===false){targetSlide=_.currentSlide;if(dontAnimate!==true&&_.slideCount>_.options.slidesToShow){_.animateSlide(slideLeft,function(){_.postSlide(targetSlide);});}else{_.postSlide(targetSlide);}}
return;}else if(_.options.infinite===false&&_.options.centerMode===true&&(index<0||index>(_.slideCount-_.options.slidesToScroll))){if(_.options.fade===false){targetSlide=_.currentSlide;if(dontAnimate!==true&&_.slideCount>_.options.slidesToShow){_.animateSlide(slideLeft,function(){_.postSlide(targetSlide);});}else{_.postSlide(targetSlide);}}
return;}
if(_.options.autoplay){clearInterval(_.autoPlayTimer);}
if(targetSlide<0){if(_.slideCount%_.options.slidesToScroll!==0){animSlide=_.slideCount-(_.slideCount%_.options.slidesToScroll);}else{animSlide=_.slideCount+targetSlide;}}else if(targetSlide>=_.slideCount){if(_.slideCount%_.options.slidesToScroll!==0){animSlide=0;}else{animSlide=targetSlide-_.slideCount;}}else{animSlide=targetSlide;}
_.animating=true;_.$slider.trigger('beforeChange',[_,_.currentSlide,animSlide]);oldSlide=_.currentSlide;_.currentSlide=animSlide;_.setSlideClasses(_.currentSlide);if(_.options.asNavFor){navTarget=_.getNavTarget();navTarget=navTarget.slick('getSlick');if(navTarget.slideCount<=navTarget.options.slidesToShow){navTarget.setSlideClasses(_.currentSlide);}}
_.updateDots();_.updateArrows();if(_.options.fade===true){if(dontAnimate!==true){_.fadeSlideOut(oldSlide);_.fadeSlide(animSlide,function(){_.postSlide(animSlide);});}else{_.postSlide(animSlide);}
_.animateHeight();return;}
if(dontAnimate!==true&&_.slideCount>_.options.slidesToShow){_.animateSlide(targetLeft,function(){_.postSlide(animSlide);});}else{_.postSlide(animSlide);}};Slick.prototype.startLoad=function(){var _=this;if(_.options.arrows===true&&_.slideCount>_.options.slidesToShow){_.$prevArrow.hide();_.$nextArrow.hide();}
if(_.options.dots===true&&_.slideCount>_.options.slidesToShow){_.$dots.hide();}
_.$slider.addClass('slick-loading');};Slick.prototype.swipeDirection=function(){var xDist,yDist,r,swipeAngle,_=this;xDist=_.touchObject.startX-_.touchObject.curX;yDist=_.touchObject.startY-_.touchObject.curY;r=Math.atan2(yDist,xDist);swipeAngle=Math.round(r*180/Math.PI);if(swipeAngle<0){swipeAngle=360-Math.abs(swipeAngle);}
if((swipeAngle<=45)&&(swipeAngle>=0)){return(_.options.rtl===false?'left':'right');}
if((swipeAngle<=360)&&(swipeAngle>=315)){return(_.options.rtl===false?'left':'right');}
if((swipeAngle>=135)&&(swipeAngle<=225)){return(_.options.rtl===false?'right':'left');}
if(_.options.verticalSwiping===true){if((swipeAngle>=35)&&(swipeAngle<=135)){return'down';}else{return'up';}}
return'vertical';};Slick.prototype.swipeEnd=function(event){var _=this,slideCount,direction;_.dragging=false;_.swiping=false;if(_.scrolling){_.scrolling=false;return false;}
_.interrupted=false;_.shouldClick=(_.touchObject.swipeLength>10)?false:true;if(_.touchObject.curX===undefined){return false;}
if(_.touchObject.edgeHit===true){_.$slider.trigger('edge',[_,_.swipeDirection()]);}
if(_.touchObject.swipeLength>=_.touchObject.minSwipe){direction=_.swipeDirection();switch(direction){case'left':case'down':slideCount=_.options.swipeToSlide?_.checkNavigable(_.currentSlide+_.getSlideCount()):_.currentSlide+_.getSlideCount();_.currentDirection=0;break;case'right':case'up':slideCount=_.options.swipeToSlide?_.checkNavigable(_.currentSlide-_.getSlideCount()):_.currentSlide-_.getSlideCount();_.currentDirection=1;break;default:}
if(direction!='vertical'){_.slideHandler(slideCount);_.touchObject={};_.$slider.trigger('swipe',[_,direction]);}}else{if(_.touchObject.startX!==_.touchObject.curX){_.slideHandler(_.currentSlide);_.touchObject={};}}};Slick.prototype.swipeHandler=function(event){var _=this;if((_.options.swipe===false)||('ontouchend' in document&&_.options.swipe===false)){return;}else if(_.options.draggable===false&&event.type.indexOf('mouse')!==-1){return;}
_.touchObject.fingerCount=event.originalEvent&&event.originalEvent.touches!==undefined?event.originalEvent.touches.length:1;_.touchObject.minSwipe=_.listWidth/_.options.touchThreshold;if(_.options.verticalSwiping===true){_.touchObject.minSwipe=_.listHeight/_.options.touchThreshold;}
switch(event.data.action){case'start':_.swipeStart(event);break;case'move':_.swipeMove(event);break;case'end':_.swipeEnd(event);break;}};Slick.prototype.swipeMove=function(event){var _=this,edgeWasHit=false,curLeft,swipeDirection,swipeLength,positionOffset,touches,verticalSwipeLength;touches=event.originalEvent!==undefined?event.originalEvent.touches:null;if(!_.dragging||_.scrolling||touches&&touches.length!==1){return false;}
curLeft=_.getLeft(_.currentSlide);_.touchObject.curX=touches!==undefined?touches[0].pageX:event.clientX;_.touchObject.curY=touches!==undefined?touches[0].pageY:event.clientY;_.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(_.touchObject.curX-_.touchObject.startX,2)));verticalSwipeLength=Math.round(Math.sqrt(Math.pow(_.touchObject.curY-_.touchObject.startY,2)));if(!_.options.verticalSwiping&&!_.swiping&&verticalSwipeLength>4){_.scrolling=true;return false;}
if(_.options.verticalSwiping===true){_.touchObject.swipeLength=verticalSwipeLength;}
swipeDirection=_.swipeDirection();if(event.originalEvent!==undefined&&_.touchObject.swipeLength>4){_.swiping=true;event.preventDefault();}
positionOffset=(_.options.rtl===false?1:-1)*(_.touchObject.curX>_.touchObject.startX?1:-1);if(_.options.verticalSwiping===true){positionOffset=_.touchObject.curY>_.touchObject.startY?1:-1;}
swipeLength=_.touchObject.swipeLength;_.touchObject.edgeHit=false;if(_.options.infinite===false){if((_.currentSlide===0&&swipeDirection==='right')||(_.currentSlide>=_.getDotCount()&&swipeDirection==='left')){swipeLength=_.touchObject.swipeLength*_.options.edgeFriction;_.touchObject.edgeHit=true;}}
if(_.options.vertical===false){_.swipeLeft=curLeft+swipeLength*positionOffset;}else{_.swipeLeft=curLeft+(swipeLength*(_.$list.height()/_.listWidth))*positionOffset;}
if(_.options.verticalSwiping===true){_.swipeLeft=curLeft+swipeLength*positionOffset;}
if(_.options.fade===true||_.options.touchMove===false){return false;}
if(_.animating===true){_.swipeLeft=null;return false;}
_.setCSS(_.swipeLeft);};Slick.prototype.swipeStart=function(event){var _=this,touches;_.interrupted=true;if(_.touchObject.fingerCount!==1||_.slideCount<=_.options.slidesToShow){_.touchObject={};return false;}
if(event.originalEvent!==undefined&&event.originalEvent.touches!==undefined){touches=event.originalEvent.touches[0];}
_.touchObject.startX=_.touchObject.curX=touches!==undefined?touches.pageX:event.clientX;_.touchObject.startY=_.touchObject.curY=touches!==undefined?touches.pageY:event.clientY;_.dragging=true;};Slick.prototype.unfilterSlides=Slick.prototype.slickUnfilter=function(){var _=this;if(_.$slidesCache!==null){_.unload();_.$slideTrack.children(this.options.slide).detach();_.$slidesCache.appendTo(_.$slideTrack);_.reinit();}};Slick.prototype.unload=function(){var _=this;$('.slick-cloned',_.$slider).remove();if(_.$dots){_.$dots.remove();}
if(_.$prevArrow&&_.htmlExpr.test(_.options.prevArrow)){_.$prevArrow.remove();}
if(_.$nextArrow&&_.htmlExpr.test(_.options.nextArrow)){_.$nextArrow.remove();}
_.$slides.removeClass('slick-slide slick-active slick-visible slick-current').attr('aria-hidden','true').css('width','');};Slick.prototype.unslick=function(fromBreakpoint){var _=this;_.$slider.trigger('unslick',[_,fromBreakpoint]);_.destroy();};Slick.prototype.updateArrows=function(){var _=this,centerOffset;centerOffset=Math.floor(_.options.slidesToShow/2);if(_.options.arrows===true&&_.slideCount>_.options.slidesToShow&&!_.options.infinite){_.$prevArrow.removeClass('slick-disabled').attr('aria-disabled','false');_.$nextArrow.removeClass('slick-disabled').attr('aria-disabled','false');if(_.currentSlide===0){_.$prevArrow.addClass('slick-disabled').attr('aria-disabled','true');_.$nextArrow.removeClass('slick-disabled').attr('aria-disabled','false');}else if(_.currentSlide>=_.slideCount-_.options.slidesToShow&&_.options.centerMode===false){_.$nextArrow.addClass('slick-disabled').attr('aria-disabled','true');_.$prevArrow.removeClass('slick-disabled').attr('aria-disabled','false');}else if(_.currentSlide>=_.slideCount-1&&_.options.centerMode===true){_.$nextArrow.addClass('slick-disabled').attr('aria-disabled','true');_.$prevArrow.removeClass('slick-disabled').attr('aria-disabled','false');}}};Slick.prototype.updateDots=function(){var _=this;if(_.$dots!==null){_.$dots.find('li').removeClass('slick-active').end();_.$dots.find('li').eq(Math.floor(_.currentSlide/_.options.slidesToScroll)).addClass('slick-active');}};Slick.prototype.visibility=function(){var _=this;if(_.options.autoplay){if(document[_.hidden]){_.interrupted=true;}else{_.interrupted=false;}}};$.fn.slick=function(){var _=this,opt=arguments[0],args=Array.prototype.slice.call(arguments,1),l=_.length,i,ret;for(i=0;i<l;i++){if(typeof opt=='object'||typeof opt=='undefined')
_[i].slick=new Slick(_[i],opt);else
ret=_[i].slick[opt].apply(_[i].slick,args);if(typeof ret!='undefined')return ret;}
return _;};}));;;
$(function(){"use strict";if($(".document-page-main").length>0){$(".c-video-player .playlist .col-xl-6").removeClass("col-xl-6").addClass("col-xl-9");}
$(".c-video-player .adjust-cookie-preferences").on("click",function(){if(Cookiebot){Cookiebot.renew();window.addEventListener('CookiebotOnAccept',function(e){location.reload();},false);}});renderPlayers();function renderPlayers(){$(".c-video-player").each(function(){renderPlayer($(this));});}
function renderPlayer($vpComponent){if(!Cookiebot||!Cookiebot.consent.marketing){$vpComponent.find(".message-container .loading-message").hide();$vpComponent.find(".message-container .cookie-message").show();}else{$vpComponent.find(".message-container").hide();$vpComponent.find(".player-container").show();$vpComponent.find(".playlist-container").show();var $playlist=$(".playlist",$vpComponent);if($playlist.length>0){$(".card-track",$playlist).on("init",function(event,slick){updateSliderIndicator(slick);});$(".card-track",$playlist).slick({infinite:false,mobileFirst:true,slidesToShow:1,slidesToScroll:1,variableWidth:true,prevArrow:$vpComponent.find(".slick-prev"),nextArrow:$vpComponent.find(".slick-next"),respondTo:"slider",responsive:[{breakpoint:190,settings:{slidesToShow:2,slidesToScroll:2}},{breakpoint:394,settings:{slidesToShow:3,slidesToScroll:3}}]});var $firstCard=$(".card",$playlist).first();updateVideo($vpComponent,$firstCard,false);$(".card",$playlist).on("click",function(){var $card=$(this);updateVideo($vpComponent,$card,true);});$(".card-track",$playlist).on("breakpoint",function(){$(".card",this).on("click",function(){var $card=$(this);updateVideo($vpComponent,$card,true);});});$(".card-track",$playlist).on("afterChange",function(event,slick,currentSlide){updateSliderIndicator(slick);});}}}
function updateVideo($vpComponent,$card,autoplay){var videoId=$card.attr("data-video-id");var $player=$(".player .frame",$vpComponent);loadVideoPlayer($player,videoId,autoplay);updateVideoInfo($vpComponent,$card);$(".card",$vpComponent).removeClass("selected");$card.addClass("selected");}
function loadVideoPlayer($player,videoId,autoplay){var playerSrc=$player.attr("src");playerSrc=playerSrc.replace(/embed\/.*\?/,"embed/"+videoId+"?");if(playerSrc.indexOf("autoplay=")===-1){playerSrc+="&autoplay="+(autoplay?"1":"0");}else{playerSrc=playerSrc.replace(/autoplay=./,"autoplay="+(autoplay?"1":"0"));}
$player.attr("src",playerSrc);}
function updateVideoInfo($vpComponent,$card){var duration=$card.find(".duration").text();var title=$card.find(".card-title").text();var description=$card.find(".hidden-description").text();$(".info .view-time",$vpComponent).text(duration);$(".info .title",$vpComponent).text(title);$(".info .description",$vpComponent).text(description);}
function updateSliderIndicator(slick){var slideCount=slick.slideCount;var slidesPerPage=slick.options.slidesToShow;var currentSlide=slick.currentSlide+1;var pageCount=Math.ceil(slideCount/slidesPerPage);var currentPage=Math.ceil(currentSlide/slidesPerPage);var $playlist=slick.$slider.closest(".playlist");var $controls=$playlist.find(".controls");$controls.find(".card-slider-current-card-indicator").text(currentPage);$controls.find(".card-slider-total-indicator").text(pageCount);if(pageCount>1){$controls.show();}else{$controls.hide();}
var $liveRegion=$playlist.find(".live-region");$liveRegion.text("Page "+currentPage+" of "+pageCount);}});;;
$(function(){"use strict;"
const sessionKey="RelatedPaintings";$(".m-related-paintings.with-see-more-loader-form").each(function(idx){var component=$(this);var pageSize=component.data("pageSize");var componentKey=component.data("componentKey");componentKey="c_"+componentKey+"_"+idx;component.data("componentKey",componentKey);var sessionObj=ng.util.sessionGet(sessionKey)||{};var visibleItems=sessionObj[componentKey]||pageSize;component.find('.image-item').each(function(idx){if(idx>=visibleItems){$(this).hide();}});UpdateIndicators(component);component.find('.see-more-loader-form button').on("click",function(){SeeMoreRelatedPaintings(component,pageSize);});component.find('.view-all-link').on("click",function(){if(!($(this).hasClass("disabled"))){SeeAllRelatedPaintings(component);}});});function SeeMoreRelatedPaintings(component,pageSize){component.find('.image-item:not(:visible)').each(function(idx){if(idx<pageSize){$(this).show();if(idx===0){$(this).find("a:focusable").first().trigger("focus");}}});UpdateIndicators(component);}
function SeeAllRelatedPaintings(component){component.find('.image-item').each(function(){$(this).show();});UpdateIndicators(component);}
function UpdateIndicators(component){var visibleItems=component.find('.image-item:visible').length;var totalCount=component.find('.image-item').length;var visiblePercent=(visibleItems/totalCount)*100;visiblePercent=Math.round(visiblePercent);if(visiblePercent>100){visiblePercent=100;}
component.find('.x-count').html(visibleItems);component.find('.showing-x-of-y-indicator .x-count-line').css("width",visiblePercent+"%");if(visibleItems===totalCount){component.find(".see-more-loader-form button").prop("disabled",true);component.find(".view-all-link").addClass("disabled");}
else{component.find(".see-more-loader-form button").prop("disabled",false);}
if(Cookiebot.consent.preferences){var sessionObj=ng.util.sessionGet(sessionKey)||{};var componentKey=component.data("componentKey");sessionObj[componentKey]=visibleItems;ng.util.sessionSet(sessionKey,sessionObj);}}});;;
(function(){"use strict";var DEBUG=false;var infoParameterName="ngInfo";var infoCookieName="ngInfo";const defaultCurrency="GBP";$(function(){var $products=$(".dl-product").not(".dl-duplicate");if($products.length>0){var products=[];$products.each(function(){var $product=$(this);var product={name:$product.data("dlName"),id:$product.data("dlName"),category:$product.data("dlCategory"),variant:$product.data("dlVariant"),list:getListName($product)};products.push(product);});var dataLayerItem={event:"productImpression",ecommerce:{impressions:products}};pushToDataLayer(dataLayerItem);}
var $product=$(".dl-product-detail").first();if($product.length===1){var product={name:$product.data("dlName"),id:$product.data("dlName"),category:$product.data("dlCategory"),variant:$product.data("dlVariant"),price:parseFloat($product.data("dlPrice"))};var dataLayerItem={event:"productDetail",ecommerce:{detail:{products:[product]}}};pushToDataLayer(dataLayerItem);}
if(ng.util.urlContains("/visiting/plan-your-visit/general-admission")){var dataLayerItem={event:"productDetail",ecommerce:{detail:{products:[{name:"Gallery entry",id:"Gallery entry",category:"Gallery entry",variant:"Gallery entry",price:"0"}]}}};pushToDataLayer(dataLayerItem);}
var $promotions=$(".c-angle-cut, .c-browse-events-panel");if($promotions.length>0){var promotions=[];$promotions.each(function(idx){var $promotion=$(this);var name=$promotion.hasClass("c-angle-cut")?$promotion.find(".title").text():"Browse all events";var promotion={name:name,id:name,creative:$promotion.hasClass("c-angle-cut")?"Angle cut":"Browse all events",position:(idx+1).toString()};promotions.push(promotion);});var dataLayerItem={event:"promotionView",ecommerce:{promoView:{promotions:promotions}}};pushToDataLayer(dataLayerItem);}
$(document).on("click",".dl-purchase-link, .btp-membership-button, .btp-tickets-button, .c-banner-body-side-panel .btn-next",function(){var url=$(this).attr("href");var id=$(this).attr("id");var funnel=$(this).hasClass("btp-membership-button")?"member":$(this).hasClass("btp-tickets-button")?"guest":undefined;var $product=$(this).closest(".dl-product, .dl-product-detail");if($product.length===0){$product=$(document).find(".dl-product-detail").first();}
if(url&&$product.length){url=addDataLayerInfoToUrl(url,$product.data("dlName"),$product.data("dlName"),$product.data("dlCategory"),$product.data("dlVariant"),$product.data("dlPrice"),funnel);}else if(url&&url.match(/galleryentry/i)){url=addDataLayerInfoToUrl(url,"General admission","General admission","Admissions","General admission","0.00",funnel);}
$(this).attr("href",url);});$(".event-listing .label").has("label[for='IncludePaid_main']").on("click",function(){var dataLayerItem={"event":"trackEvent","eventDetails.category":"Event Filter","eventDetails.action":"Price","eventDetails.label":"Paid"};pushToDataLayer(dataLayerItem);});$(".event-listing .label").has("label[for='IncludeFree_main']").on("click",function(){var dataLayerItem={"event":"trackEvent","eventDetails.category":"Event Filter","eventDetails.action":"Price","eventDetails.label":"Free"};pushToDataLayer(dataLayerItem);});$(".event-listing .category-picker .label").on("click",function(){var category=$(this).closest(".category-picker").find("input").val();var dataLayerItem={"event":"trackEvent","eventDetails.category":"Event Filter","eventDetails.action":"Type","eventDetails.label":category};pushToDataLayer(dataLayerItem);});$(".event-listing .audience-filter .label").on("click",function(){var $input=$(this).closest(".audience-filter").find("input");var audience=$input.attr("id")==="IsAccessible_main"?"Access":$input.val();var dataLayerItem={"event":"trackEvent","eventDetails.category":"Event Filter","eventDetails.action":"Audience","eventDetails.label":audience};pushToDataLayer(dataLayerItem);});$(".dl-product-link").on("click",function(){var $product=$(this).closest(".dl-product");var product={name:$product.data("dlName"),id:$product.data("dlName"),category:$product.data("dlCategory"),variant:$product.data("dlVariant")};var dataLayerItem={event:"productClick",ecommerce:{click:{actionField:{list:getListName($product)},products:[product]}}};pushToDataLayer(dataLayerItem);});$(".exhibition-listing .label").has("label[for='showPaid']").on("click",function(){var dataLayerItem={"event":"trackEvent","eventDetails.category":"Exhibition Filter","eventDetails.action":"Price","eventDetails.label":"Paid"};pushToDataLayer(dataLayerItem);});$(".exhibition-listing .label").has("label[for='showFree']").on("click",function(){var dataLayerItem={"event":"trackEvent","eventDetails.category":"Exhibition Filter","eventDetails.action":"Price","eventDetails.label":"Free"};pushToDataLayer(dataLayerItem);});$("#subscribe-form .btn").on("click",function(){var userID=ng.util.getCookie("ngSessUid");var dataLayerItem={"event":"trackEvent","eventDetails.category":"Form","eventDetails.action":"Newsletter Sign-up","eventDetails.label":userID};pushToDataLayer(dataLayerItem);});$(".dc-image-carousel-with-expand .shift-right").on("click",function(){var slideNumber=$(this).closest("div").find(".displayed-object-idx").text();var dataLayerItem={"event":"trackEvent","eventDetails.category":"Image Carousel","eventDetails.label":slideNumber};pushToDataLayer(dataLayerItem);});$(".c-angle-cut a, .c-browse-events-panel a").on("click",function(){var $promotion=$(this).closest(".c-angle-cut, .c-browse-events-panel");var $promotions=$(".c-angle-cut, .c-browse-events-panel");var idx=0;$promotions.each(function(i){if($(this)[0]===$promotion[0]){idx=i;}})
var promotion={};promotion.name=promotion.id=$promotion.hasClass("c-angle-cut")?$promotion.find(".title").text():"Browse all events";promotion.creative=$promotion.hasClass("c-angle-cut")?"Angle cut":"Browse all events";promotion.position=(idx+1).toString();var dataLayerItem={event:"promotionClick",ecommerce:{promoClick:{promotions:[promotion]}}};pushToDataLayer(dataLayerItem);});$("#contact-preferences-form .btn-primary").on("click",function(){var userID=ng.util.getCookie("ngSessUid");var dataLayerItem={"event":"trackEvent","eventDetails.category":"Account","eventDetails.action":"Update Account","eventDetails.label":userID};pushToDataLayer(dataLayerItem);});});function getListName($obj){var listName;if($(".home-page .c-events-carousel").find($obj).length>0){listName="Home carousel";}else if($(".exhibition-page .c-events-carousel").find($obj).length>0){listName="Related events";}else if($(".c-events-carousel").find($obj).length>0){listName="Events carousel";}else if($(".exhibition-listing").find($obj).length>0){listName="Exhibitions";}else if($(".event-listing").find($obj).length>0){listName="Events";}else if($(".event-page.festival-variant").find($obj).length>0){listName="Festival events";}else if($(".m-membership-promo-block").find($obj).length>0){listName="Membership";}else if($(".c-whats-on-panel").find($obj).length>0){listName="What's on panel";}else if($(".c-exhibition-listing").find($obj).length>0){listName="Exhibition listing component";}else if($(".c-promoted-event").find($obj).length>0){listName="Promoted event";}else if(ng.util.urlContains("/membership/on-demand")){listName="On-demand films";}else if($obj.closest(".dl-list").length>0){listName=$obj.closest(".dl-list").data("dlListName");}
return listName;}
function addDataLayerInfoToUrl(url,name,id,category,variant,price,funnel){var info={product:{name:name,id:id,category:category,variant:variant,price:price},funnel:funnel};var jsonInfo=JSON.stringify(info);url=ng.util.setUrlParam(url,infoParameterName,jsonInfo);saveDataLayerInfoToCookie(jsonInfo);return url;}
function saveDataLayerInfoToCookie(jsonInfo){var domain=window.location.host;if(domain.match("/nationalgallery\.org\.uk/")){domain=".nationalgallery.org.uk";}else{domain=null;}
ng.util.setCookie(infoCookieName,encodeURIComponent(jsonInfo),0,"/",domain);}
function pushToDataLayer(item){var dataLayer=window.dataLayer=window.dataLayer||[];dataLayer.push(item);consoleLog(item);}
function consoleLog(item){if(DEBUG)
console.log(JSON.stringify(item,null,2));}
function getItemsFromEvent($elem){let items=[];let $itemElems=$elem.find("[data-dl-item-name], [data-dl-item-id]")
$itemElems.each(function(){let $itemElem=$(this);let item={item_id:$itemElem.data("dlItemId"),item_name:$itemElem.data("dlItemName"),index:Number($itemElem.data("dlIndex")),item_category:$itemElem.data("dlItemCategory"),item_category2:$itemElem.data("dlItemCategory2"),item_category3:$itemElem.data("dlItemCategory3"),price:Number($itemElem.data("dlPrice")),quantity:Number($itemElem.data("dlQuantity")),};items.push(item);});return items;}
function pushEcommerceEventToDataLayer(event){pushToDataLayer({ecommerce:null});pushToDataLayer(event);}})();;;
