diff options
Diffstat (limited to 'compose/nginx/darling/assets/mw/app-bundles/mw-2019-05-09.13-43-27.000000-app-bundle/js/main.min.js')
-rw-r--r-- | compose/nginx/darling/assets/mw/app-bundles/mw-2019-05-09.13-43-27.000000-app-bundle/js/main.min.js | 15921 |
1 files changed, 15921 insertions, 0 deletions
diff --git a/compose/nginx/darling/assets/mw/app-bundles/mw-2019-05-09.13-43-27.000000-app-bundle/js/main.min.js b/compose/nginx/darling/assets/mw/app-bundles/mw-2019-05-09.13-43-27.000000-app-bundle/js/main.min.js new file mode 100644 index 0000000..9f41742 --- /dev/null +++ b/compose/nginx/darling/assets/mw/app-bundles/mw-2019-05-09.13-43-27.000000-app-bundle/js/main.min.js @@ -0,0 +1,15921 @@ +var requirejs,require,define;(function(global){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version='2.1.20',commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,isBrowser=!!(typeof window!=='undefined'&&typeof navigator!=='undefined'&&window.document),isWebWorker=!isBrowser&&typeof importScripts!=='undefined',readyRegExp=isBrowser&&navigator.platform==='PLAYSTATION 3'?/^complete$/:/^(complete|loaded)$/,defContextName='_',isOpera=typeof opera!=='undefined'&&opera.toString()==='[object Opera]',contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function isFunction(it){return ostring.call(it)==='[object Function]'} +function isArray(it){return ostring.call(it)==='[object Array]'} +function each(ary,func){if(ary){var i;for(i=0;i<ary.length;i+=1){if(ary[i]&&func(ary[i],i,ary)){break}}}} +function eachReverse(ary,func){if(ary){var i;for(i=ary.length-1;i>-1;i-=1){if(ary[i]&&func(ary[i],i,ary)){break}}}} +function hasProp(obj,prop){return hasOwn.call(obj,prop)} +function getOwn(obj,prop){return hasProp(obj,prop)&&obj[prop]} +function eachProp(obj,func){var prop;for(prop in obj){if(hasProp(obj,prop)){if(func(obj[prop],prop)){break}}}} +function mixin(target,source,force,deepStringMixin){if(source){eachProp(source,function(value,prop){if(force||!hasProp(target,prop)){if(deepStringMixin&&typeof value==='object'&&value&&!isArray(value)&&!isFunction(value)&&!(value instanceof RegExp)){if(!target[prop]){target[prop]={}} +mixin(target[prop],value,force,deepStringMixin);}else{target[prop]=value}}})} +return target} +function bind(obj,fn){return function(){return fn.apply(obj,arguments)}} +function scripts(){return document.getElementsByTagName('script')} +function defaultOnError(err){throw err} +function getGlobal(value){if(!value){return value} +var g=global;each(value.split('.'),function(part){g=g[part]});return g} +function makeError(id,msg,err,requireModules){var e=new Error(msg+'\nhttp://requirejs.org/docs/errors.html#'+id);e.requireType=id;e.requireModules=requireModules;if(err){e.originalError=err} +return e} +if(typeof define!=='undefined'){return} +if(typeof requirejs!=='undefined'){if(isFunction(requirejs)){return} +cfg=requirejs;requirejs=undefined} +if(typeof require!=='undefined'&&!isFunction(require)){cfg=require;require=undefined} +function newContext(contextName){var inCheckLoaded,Module,context,handlers,checkLoadedTimeoutId,config={waitSeconds:30,baseUrl:'./',paths:{},bundles:{},pkgs:{},shim:{},config:{}},registry={},enabledRegistry={},undefEvents={},defQueue=[],defined={},urlFetched={},bundlesMap={},requireCounter=1,unnormalizedCounter=1;function trimDots(ary){var i,part;for(i=0;i<ary.length;i++){part=ary[i];if(part==='.'){ary.splice(i,1);i-=1}else if(part==='..'){if(i===0||(i===1&&ary[2]==='..')||ary[i-1]==='..'){continue}else if(i>0){ary.splice(i-1,2);i-=2}}}} +function normalize(name,baseName,applyMap){var pkgMain,mapValue,nameParts,i,j,nameSegment,lastIndex,foundMap,foundI,foundStarMap,starI,normalizedBaseParts,baseParts=(baseName&&baseName.split('/')),map=config.map,starMap=map&&map['*'];if(name){name=name.split('/');lastIndex=name.length-1;if(config.nodeIdCompat&&jsSuffixRegExp.test(name[lastIndex])){name[lastIndex]=name[lastIndex].replace(jsSuffixRegExp,'')} +if(name[0].charAt(0)==='.'&&baseParts){normalizedBaseParts=baseParts.slice(0,baseParts.length-1);name=normalizedBaseParts.concat(name)} +trimDots(name);name=name.join('/')} +if(applyMap&&map&&(baseParts||starMap)){nameParts=name.split('/');outerLoop:for(i=nameParts.length;i>0;i-=1){nameSegment=nameParts.slice(0,i).join('/');if(baseParts){for(j=baseParts.length;j>0;j-=1){mapValue=getOwn(map,baseParts.slice(0,j).join('/'));if(mapValue){mapValue=getOwn(mapValue,nameSegment);if(mapValue){foundMap=mapValue;foundI=i;break outerLoop}}}} +if(!foundStarMap&&starMap&&getOwn(starMap,nameSegment)){foundStarMap=getOwn(starMap,nameSegment);starI=i}} +if(!foundMap&&foundStarMap){foundMap=foundStarMap;foundI=starI} +if(foundMap){nameParts.splice(0,foundI,foundMap);name=nameParts.join('/')}} +pkgMain=getOwn(config.pkgs,name);return pkgMain?pkgMain:name} +function removeScript(name){if(isBrowser){each(scripts(),function(scriptNode){if(scriptNode.getAttribute('data-requiremodule')===name&&scriptNode.getAttribute('data-requirecontext')===context.contextName){scriptNode.parentNode.removeChild(scriptNode);return !0}})}} +function hasPathFallback(id){var pathConfig=getOwn(config.paths,id);if(pathConfig&&isArray(pathConfig)&&pathConfig.length>1){pathConfig.shift();context.require.undef(id);context.makeRequire(null,{skipMap:!0})([id]);return !0}} +function splitPrefix(name){var prefix,index=name?name.indexOf('!'):-1;if(index>-1){prefix=name.substring(0,index);name=name.substring(index+1,name.length)} +return[prefix,name]} +function makeModuleMap(name,parentModuleMap,isNormalized,applyMap){var url,pluginModule,suffix,nameParts,prefix=null,parentName=parentModuleMap?parentModuleMap.name:null,originalName=name,isDefine=!0,normalizedName='';if(!name){isDefine=!1;name='_@r'+(requireCounter+=1)} +nameParts=splitPrefix(name);prefix=nameParts[0];name=nameParts[1];if(prefix){prefix=normalize(prefix,parentName,applyMap);pluginModule=getOwn(defined,prefix)} +if(name){if(prefix){if(pluginModule&&pluginModule.normalize){normalizedName=pluginModule.normalize(name,function(name){return normalize(name,parentName,applyMap)})}else{normalizedName=name.indexOf('!')===-1?normalize(name,parentName,applyMap):name}}else{normalizedName=normalize(name,parentName,applyMap);nameParts=splitPrefix(normalizedName);prefix=nameParts[0];normalizedName=nameParts[1];isNormalized=!0;url=context.nameToUrl(normalizedName)}} +suffix=prefix&&!pluginModule&&!isNormalized?'_unnormalized'+(unnormalizedCounter+=1):'';return{prefix:prefix,name:normalizedName,parentMap:parentModuleMap,unnormalized:!!suffix,url:url,originalName:originalName,isDefine:isDefine,id:(prefix?prefix+'!'+normalizedName:normalizedName)+suffix}} +function getModule(depMap){var id=depMap.id,mod=getOwn(registry,id);if(!mod){mod=registry[id]=new context.Module(depMap)} +return mod} +function on(depMap,name,fn){var id=depMap.id,mod=getOwn(registry,id);if(hasProp(defined,id)&&(!mod||mod.defineEmitComplete)){if(name==='defined'){fn(defined[id])}}else{mod=getModule(depMap);if(mod.error&&name==='error'){fn(mod.error)}else{mod.on(name,fn)}}} +function onError(err,errback){var ids=err.requireModules,notified=!1;if(errback){errback(err)}else{each(ids,function(id){var mod=getOwn(registry,id);if(mod){mod.error=err;if(mod.events.error){notified=!0;mod.emit('error',err)}}});if(!notified){req.onError(err)}}} +function takeGlobalQueue(){if(globalDefQueue.length){each(globalDefQueue,function(queueItem){var id=queueItem[0];if(typeof id==='string'){context.defQueueMap[id]=!0} +defQueue.push(queueItem)});globalDefQueue=[]}} +handlers={'require':function(mod){if(mod.require){return mod.require}else{return(mod.require=context.makeRequire(mod.map))}},'exports':function(mod){mod.usingExports=!0;if(mod.map.isDefine){if(mod.exports){return(defined[mod.map.id]=mod.exports)}else{return(mod.exports=defined[mod.map.id]={})}}},'module':function(mod){if(mod.module){return mod.module}else{return(mod.module={id:mod.map.id,uri:mod.map.url,config:function(){return getOwn(config.config,mod.map.id)||{}},exports:mod.exports||(mod.exports={})})}}};function cleanRegistry(id){delete registry[id];delete enabledRegistry[id]} +function breakCycle(mod,traced,processed){var id=mod.map.id;if(mod.error){mod.emit('error',mod.error)}else{traced[id]=!0;each(mod.depMaps,function(depMap,i){var depId=depMap.id,dep=getOwn(registry,depId);if(dep&&!mod.depMatched[i]&&!processed[depId]){if(getOwn(traced,depId)){mod.defineDep(i,defined[depId]);mod.check()}else{breakCycle(dep,traced,processed)}}});processed[id]=!0}} +function checkLoaded(){var err,usingPathFallback,waitInterval=config.waitSeconds*1000,expired=waitInterval&&(context.startTime+waitInterval)<new Date().getTime(),noLoads=[],reqCalls=[],stillLoading=!1,needCycleCheck=!0;if(inCheckLoaded){return} +inCheckLoaded=!0;eachProp(enabledRegistry,function(mod){var map=mod.map,modId=map.id;if(!mod.enabled){return} +if(!map.isDefine){reqCalls.push(mod)} +if(!mod.error){if(!mod.inited&&expired){if(hasPathFallback(modId)){usingPathFallback=!0;stillLoading=!0}else{noLoads.push(modId);removeScript(modId)}}else if(!mod.inited&&mod.fetched&&map.isDefine){stillLoading=!0;if(!map.prefix){return(needCycleCheck=!1)}}}});if(expired&&noLoads.length){err=makeError('timeout','Load timeout for modules: '+noLoads,null,noLoads);err.contextName=context.contextName;return onError(err)} +if(needCycleCheck){each(reqCalls,function(mod){breakCycle(mod,{},{})})} +if((!expired||usingPathFallback)&&stillLoading){if((isBrowser||isWebWorker)&&!checkLoadedTimeoutId){checkLoadedTimeoutId=setTimeout(function(){checkLoadedTimeoutId=0;checkLoaded()},50)}} +inCheckLoaded=!1} +Module=function(map){this.events=getOwn(undefEvents,map.id)||{};this.map=map;this.shim=getOwn(config.shim,map.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};Module.prototype={init:function(depMaps,factory,errback,options){options=options||{};if(this.inited){return} +this.factory=factory;if(errback){this.on('error',errback)}else if(this.events.error){errback=bind(this,function(err){this.emit('error',err)})} +this.depMaps=depMaps&&depMaps.slice(0);this.errback=errback;this.inited=!0;this.ignore=options.ignore;if(options.enabled||this.enabled){this.enable()}else{this.check()}},defineDep:function(i,depExports){if(!this.depMatched[i]){this.depMatched[i]=!0;this.depCount-=1;this.depExports[i]=depExports}},fetch:function(){if(this.fetched){return} +this.fetched=!0;context.startTime=(new Date()).getTime();var map=this.map;if(this.shim){context.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return map.prefix?this.callPlugin():this.load()}))}else{return map.prefix?this.callPlugin():this.load()}},load:function(){var url=this.map.url;if(!urlFetched[url]){urlFetched[url]=!0;context.load(this.map.id,url)}},check:function(){if(!this.enabled||this.enabling){return} +var err,cjsModule,id=this.map.id,depExports=this.depExports,exports=this.exports,factory=this.factory;if(!this.inited){if(!hasProp(context.defQueueMap,id)){this.fetch()}}else if(this.error){this.emit('error',this.error)}else if(!this.defining){this.defining=!0;if(this.depCount<1&&!this.defined){if(isFunction(factory)){if((this.events.error&&this.map.isDefine)||req.onError!==defaultOnError){try{exports=context.execCb(id,factory,depExports,exports)}catch(e){err=e}}else{exports=context.execCb(id,factory,depExports,exports)} +if(this.map.isDefine&&exports===undefined){cjsModule=this.module;if(cjsModule){exports=cjsModule.exports}else if(this.usingExports){exports=this.exports}} +if(err){err.requireMap=this.map;err.requireModules=this.map.isDefine?[this.map.id]:null;err.requireType=this.map.isDefine?'define':'require';return onError((this.error=err))}}else{exports=factory} +this.exports=exports;if(this.map.isDefine&&!this.ignore){defined[id]=exports;if(req.onResourceLoad){req.onResourceLoad(context,this.map,this.depMaps)}} +cleanRegistry(id);this.defined=!0} +this.defining=!1;if(this.defined&&!this.defineEmitted){this.defineEmitted=!0;this.emit('defined',this.exports);this.defineEmitComplete=!0}}},callPlugin:function(){var map=this.map,id=map.id,pluginMap=makeModuleMap(map.prefix);this.depMaps.push(pluginMap);on(pluginMap,'defined',bind(this,function(plugin){var load,normalizedMap,normalizedMod,bundleId=getOwn(bundlesMap,this.map.id),name=this.map.name,parentName=this.map.parentMap?this.map.parentMap.name:null,localRequire=context.makeRequire(map.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(plugin.normalize){name=plugin.normalize(name,function(name){return normalize(name,parentName,!0)})||''} +normalizedMap=makeModuleMap(map.prefix+'!'+name,this.map.parentMap);on(normalizedMap,'defined',bind(this,function(value){this.init([],function(){return value},null,{enabled:!0,ignore:!0})}));normalizedMod=getOwn(registry,normalizedMap.id);if(normalizedMod){this.depMaps.push(normalizedMap);if(this.events.error){normalizedMod.on('error',bind(this,function(err){this.emit('error',err)}))} +normalizedMod.enable()} +return} +if(bundleId){this.map.url=context.nameToUrl(bundleId);this.load();return} +load=bind(this,function(value){this.init([],function(){return value},null,{enabled:!0})});load.error=bind(this,function(err){this.inited=!0;this.error=err;err.requireModules=[id];eachProp(registry,function(mod){if(mod.map.id.indexOf(id+'_unnormalized')===0){cleanRegistry(mod.map.id)}});onError(err)});load.fromText=bind(this,function(text,textAlt){var moduleName=map.name,moduleMap=makeModuleMap(moduleName),hasInteractive=useInteractive;if(textAlt){text=textAlt} +if(hasInteractive){useInteractive=!1} +getModule(moduleMap);if(hasProp(config.config,id)){config.config[moduleName]=config.config[id]} +try{req.exec(text)}catch(e){return onError(makeError('fromtexteval','fromText eval for '+id+' failed: '+e,e,[id]))} +if(hasInteractive){useInteractive=!0} +this.depMaps.push(moduleMap);context.completeLoad(moduleName);localRequire([moduleName],load)});plugin.load(map.name,localRequire,load,config)}));context.enable(pluginMap,this);this.pluginMaps[pluginMap.id]=pluginMap},enable:function(){enabledRegistry[this.map.id]=this;this.enabled=!0;this.enabling=!0;each(this.depMaps,bind(this,function(depMap,i){var id,mod,handler;if(typeof depMap==='string'){depMap=makeModuleMap(depMap,(this.map.isDefine?this.map:this.map.parentMap),!1,!this.skipMap);this.depMaps[i]=depMap;handler=getOwn(handlers,depMap.id);if(handler){this.depExports[i]=handler(this);return} +this.depCount+=1;on(depMap,'defined',bind(this,function(depExports){if(this.undefed){return} +this.defineDep(i,depExports);this.check()}));if(this.errback){on(depMap,'error',bind(this,this.errback))}else if(this.events.error){on(depMap,'error',bind(this,function(err){this.emit('error',err)}))}} +id=depMap.id;mod=registry[id];if(!hasProp(handlers,id)&&mod&&!mod.enabled){context.enable(depMap,this)}}));eachProp(this.pluginMaps,bind(this,function(pluginMap){var mod=getOwn(registry,pluginMap.id);if(mod&&!mod.enabled){context.enable(pluginMap,this)}}));this.enabling=!1;this.check()},on:function(name,cb){var cbs=this.events[name];if(!cbs){cbs=this.events[name]=[]} +cbs.push(cb)},emit:function(name,evt){each(this.events[name],function(cb){cb(evt)});if(name==='error'){delete this.events[name]}}};function callGetModule(args){if(!hasProp(defined,args[0])){getModule(makeModuleMap(args[0],null,!0)).init(args[1],args[2])}} +function removeListener(node,func,name,ieName){if(node.detachEvent&&!isOpera){if(ieName){node.detachEvent(ieName,func)}}else{node.removeEventListener(name,func,!1)}} +function getScriptData(evt){var node=evt.currentTarget||evt.srcElement;removeListener(node,context.onScriptLoad,'load','onreadystatechange');removeListener(node,context.onScriptError,'error');return{node:node,id:node&&node.getAttribute('data-requiremodule')}} +function intakeDefines(){var args;takeGlobalQueue();while(defQueue.length){args=defQueue.shift();if(args[0]===null){return onError(makeError('mismatch','Mismatched anonymous define() module: '+args[args.length-1]))}else{callGetModule(args)}} +context.defQueueMap={}} +context={config:config,contextName:contextName,registry:registry,defined:defined,urlFetched:urlFetched,defQueue:defQueue,defQueueMap:{},Module:Module,makeModuleMap:makeModuleMap,nextTick:req.nextTick,onError:onError,configure:function(cfg){if(cfg.baseUrl){if(cfg.baseUrl.charAt(cfg.baseUrl.length-1)!=='/'){cfg.baseUrl+='/'}} +var shim=config.shim,objs={paths:!0,bundles:!0,config:!0,map:!0};eachProp(cfg,function(value,prop){if(objs[prop]){if(!config[prop]){config[prop]={}} +mixin(config[prop],value,!0,!0)}else{config[prop]=value}});if(cfg.bundles){eachProp(cfg.bundles,function(value,prop){each(value,function(v){if(v!==prop){bundlesMap[v]=prop}})})} +if(cfg.shim){eachProp(cfg.shim,function(value,id){if(isArray(value)){value={deps:value}} +if((value.exports||value.init)&&!value.exportsFn){value.exportsFn=context.makeShimExports(value)} +shim[id]=value});config.shim=shim} +if(cfg.packages){each(cfg.packages,function(pkgObj){var location,name;pkgObj=typeof pkgObj==='string'?{name:pkgObj}:pkgObj;name=pkgObj.name;location=pkgObj.location;if(location){config.paths[name]=pkgObj.location} +config.pkgs[name]=pkgObj.name+'/'+(pkgObj.main||'main').replace(currDirRegExp,'').replace(jsSuffixRegExp,'')})} +eachProp(registry,function(mod,id){if(!mod.inited&&!mod.map.unnormalized){mod.map=makeModuleMap(id,null,!0)}});if(cfg.deps||cfg.callback){context.require(cfg.deps||[],cfg.callback)}},makeShimExports:function(value){function fn(){var ret;if(value.init){ret=value.init.apply(global,arguments)} +return ret||(value.exports&&getGlobal(value.exports))} +return fn},makeRequire:function(relMap,options){options=options||{};function localRequire(deps,callback,errback){var id,map,requireMod;if(options.enableBuildCallback&&callback&&isFunction(callback)){callback.__requireJsBuild=!0} +if(typeof deps==='string'){if(isFunction(callback)){return onError(makeError('requireargs','Invalid require call'),errback)} +if(relMap&&hasProp(handlers,deps)){return handlers[deps](registry[relMap.id])} +if(req.get){return req.get(context,deps,relMap,localRequire)} +map=makeModuleMap(deps,relMap,!1,!0);id=map.id;if(!hasProp(defined,id)){return onError(makeError('notloaded','Module name "'+id+'" has not been loaded yet for context: '+contextName+(relMap?'':'. Use require([])')))} +return defined[id]} +intakeDefines();context.nextTick(function(){intakeDefines();requireMod=getModule(makeModuleMap(null,relMap));requireMod.skipMap=options.skipMap;requireMod.init(deps,callback,errback,{enabled:!0});checkLoaded()});return localRequire} +mixin(localRequire,{isBrowser:isBrowser,toUrl:function(moduleNamePlusExt){var ext,index=moduleNamePlusExt.lastIndexOf('.'),segment=moduleNamePlusExt.split('/')[0],isRelative=segment==='.'||segment==='..';if(index!==-1&&(!isRelative||index>1)){ext=moduleNamePlusExt.substring(index,moduleNamePlusExt.length);moduleNamePlusExt=moduleNamePlusExt.substring(0,index)} +return context.nameToUrl(normalize(moduleNamePlusExt,relMap&&relMap.id,!0),ext,!0)},defined:function(id){return hasProp(defined,makeModuleMap(id,relMap,!1,!0).id)},specified:function(id){id=makeModuleMap(id,relMap,!1,!0).id;return hasProp(defined,id)||hasProp(registry,id)}});if(!relMap){localRequire.undef=function(id){takeGlobalQueue();var map=makeModuleMap(id,relMap,!0),mod=getOwn(registry,id);mod.undefed=!0;removeScript(id);delete defined[id];delete urlFetched[map.url];delete undefEvents[id];eachReverse(defQueue,function(args,i){if(args[0]===id){defQueue.splice(i,1)}});delete context.defQueueMap[id];if(mod){if(mod.events.defined){undefEvents[id]=mod.events} +cleanRegistry(id)}}} +return localRequire},enable:function(depMap){var mod=getOwn(registry,depMap.id);if(mod){getModule(depMap).enable()}},completeLoad:function(moduleName){var found,args,mod,shim=getOwn(config.shim,moduleName)||{},shExports=shim.exports;takeGlobalQueue();while(defQueue.length){args=defQueue.shift();if(args[0]===null){args[0]=moduleName;if(found){break} +found=!0}else if(args[0]===moduleName){found=!0} +callGetModule(args)} +context.defQueueMap={};mod=getOwn(registry,moduleName);if(!found&&!hasProp(defined,moduleName)&&mod&&!mod.inited){if(config.enforceDefine&&(!shExports||!getGlobal(shExports))){if(hasPathFallback(moduleName)){return}else{return onError(makeError('nodefine','No define call for '+moduleName,null,[moduleName]))}}else{callGetModule([moduleName,(shim.deps||[]),shim.exportsFn])}} +checkLoaded()},nameToUrl:function(moduleName,ext,skipExt){var paths,syms,i,parentModule,url,parentPath,bundleId,pkgMain=getOwn(config.pkgs,moduleName);if(pkgMain){moduleName=pkgMain} +bundleId=getOwn(bundlesMap,moduleName);if(bundleId){return context.nameToUrl(bundleId,ext,skipExt)} +if(req.jsExtRegExp.test(moduleName)){url=moduleName+(ext||'')}else{paths=config.paths;syms=moduleName.split('/');for(i=syms.length;i>0;i-=1){parentModule=syms.slice(0,i).join('/');parentPath=getOwn(paths,parentModule);if(parentPath){if(isArray(parentPath)){parentPath=parentPath[0]} +syms.splice(0,i,parentPath);break}} +url=syms.join('/');url+=(ext||(/^data\:|\?/.test(url)||skipExt?'':'.js'));url=(url.charAt(0)==='/'||url.match(/^[\w\+\.\-]+:/)?'':config.baseUrl)+url} +return config.urlArgs?url+((url.indexOf('?')===-1?'?':'&')+config.urlArgs):url},load:function(id,url){req.load(context,id,url)},execCb:function(name,callback,args,exports){return callback.apply(exports,args)},onScriptLoad:function(evt){if(evt.type==='load'||(readyRegExp.test((evt.currentTarget||evt.srcElement).readyState))){interactiveScript=null;var data=getScriptData(evt);context.completeLoad(data.id)}},onScriptError:function(evt){var data=getScriptData(evt);if(!hasPathFallback(data.id)){return onError(makeError('scripterror','Script error for: '+data.id,evt,[data.id]))}}};context.require=context.makeRequire();return context} +req=requirejs=function(deps,callback,errback,optional){var context,config,contextName=defContextName;if(!isArray(deps)&&typeof deps!=='string'){config=deps;if(isArray(callback)){deps=callback;callback=errback;errback=optional}else{deps=[]}} +if(config&&config.context){contextName=config.context} +context=getOwn(contexts,contextName);if(!context){context=contexts[contextName]=req.s.newContext(contextName)} +if(config){context.configure(config)} +return context.require(deps,callback,errback)};req.config=function(config){return req(config)};req.nextTick=typeof setTimeout!=='undefined'?function(fn){setTimeout(fn,4)}:function(fn){fn()};if(!require){require=req} +req.version=version;req.jsExtRegExp=/^\/|:|\?|\.js$/;req.isBrowser=isBrowser;s=req.s={contexts:contexts,newContext:newContext};req({});each(['toUrl','undef','defined','specified'],function(prop){req[prop]=function(){var ctx=contexts[defContextName];return ctx.require[prop].apply(ctx,arguments)}});if(isBrowser){head=s.head=document.getElementsByTagName('head')[0];baseElement=document.getElementsByTagName('base')[0];if(baseElement){head=s.head=baseElement.parentNode}} +req.onError=defaultOnError;req.createNode=function(config,moduleName,url){var node=config.xhtml?document.createElementNS('http://www.w3.org/1999/xhtml','html:script'):document.createElement('script');node.type=config.scriptType||'text/javascript';node.charset='utf-8';node.async=!0;return node};req.load=function(context,moduleName,url){var config=(context&&context.config)||{},node;if(isBrowser){node=req.createNode(config,moduleName,url);if(config.onNodeCreated){config.onNodeCreated(node,config,moduleName,url)} +node.setAttribute('data-requirecontext',context.contextName);node.setAttribute('data-requiremodule',moduleName);if(node.attachEvent&&!(node.attachEvent.toString&&node.attachEvent.toString().indexOf('[native code')<0)&&!isOpera){useInteractive=!0;node.attachEvent('onreadystatechange',context.onScriptLoad)}else{node.addEventListener('load',context.onScriptLoad,!1);node.addEventListener('error',context.onScriptError,!1)} +node.src=url;currentlyAddingScript=node;if(baseElement){head.insertBefore(node,baseElement)}else{head.appendChild(node)} +currentlyAddingScript=null;return node}else if(isWebWorker){try{importScripts(url);context.completeLoad(moduleName)}catch(e){context.onError(makeError('importscripts','importScripts failed for '+moduleName+' at '+url,e,[moduleName]))}}};function getInteractiveScript(){if(interactiveScript&&interactiveScript.readyState==='interactive'){return interactiveScript} +eachReverse(scripts(),function(script){if(script.readyState==='interactive'){return(interactiveScript=script)}});return interactiveScript} +if(isBrowser&&!cfg.skipDataMain){eachReverse(scripts(),function(script){if(!head){head=script.parentNode} +dataMain=script.getAttribute('data-main');if(dataMain){mainScript=dataMain;if(!cfg.baseUrl){src=mainScript.split('/');mainScript=src.pop();subPath=src.length?src.join('/')+'/':'./';cfg.baseUrl=subPath} +mainScript=mainScript.replace(jsSuffixRegExp,'');if(req.jsExtRegExp.test(mainScript)){mainScript=dataMain} +cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript];return !0}})} +define=function(name,deps,callback){var node,context;if(typeof name!=='string'){callback=deps;deps=name;name=null} +if(!isArray(deps)){callback=deps;deps=null} +if(!deps&&isFunction(callback)){deps=[];if(callback.length){callback.toString().replace(commentRegExp,'').replace(cjsRequireRegExp,function(match,dep){deps.push(dep)});deps=(callback.length===1?['require']:['require','exports','module']).concat(deps)}} +if(useInteractive){node=currentlyAddingScript||getInteractiveScript();if(node){if(!name){name=node.getAttribute('data-requiremodule')} +context=contexts[node.getAttribute('data-requirecontext')]}} +if(context){context.defQueue.push([name,deps,callback]);context.defQueueMap[name]=!0}else{globalDefQueue.push([name,deps,callback])}};define.amd={jQuery:!0};req.exec=function(text){return eval(text)};req(cfg)}(this));define('text',['module'],function(module){'use strict';var text,fs,Cc,Ci,xpcIsWindows,progIds=['Msxml2.XMLHTTP','Microsoft.XMLHTTP','Msxml2.XMLHTTP.4.0'],xmlRegExp=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,bodyRegExp=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,hasLocation=typeof location!=='undefined'&&location.href,defaultProtocol=hasLocation&&location.protocol&&location.protocol.replace(/\:/,''),defaultHostName=hasLocation&&location.hostname,defaultPort=hasLocation&&(location.port||undefined),buildMap={},masterConfig=(module.config&&module.config())||{};text={version:'2.0.14',strip:function(content){if(content){content=content.replace(xmlRegExp,"");var matches=content.match(bodyRegExp);if(matches){content=matches[1]}}else{content=""} +return content},jsEscape:function(content){return content.replace(/(['\\])/g,'\\$1').replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:masterConfig.createXhr||function(){var xhr,i,progId;if(typeof XMLHttpRequest!=="undefined"){return new XMLHttpRequest()}else if(typeof ActiveXObject!=="undefined"){for(i=0;i<3;i+=1){progId=progIds[i];try{xhr=new ActiveXObject(progId)}catch(e){} +if(xhr){progIds=[progId];break}}} +return xhr},parseName:function(name){var modName,ext,temp,strip=!1,index=name.lastIndexOf("."),isRelative=name.indexOf('./')===0||name.indexOf('../')===0;if(index!==-1&&(!isRelative||index>1)){modName=name.substring(0,index);ext=name.substring(index+1)}else{modName=name} +temp=ext||modName;index=temp.indexOf("!");if(index!==-1){strip=temp.substring(index+1)==="strip";temp=temp.substring(0,index);if(ext){ext=temp}else{modName=temp}} +return{moduleName:modName,ext:ext,strip:strip}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(url,protocol,hostname,port){var uProtocol,uHostName,uPort,match=text.xdRegExp.exec(url);if(!match){return !0} +uProtocol=match[2];uHostName=match[3];uHostName=uHostName.split(':');uPort=uHostName[1];uHostName=uHostName[0];return(!uProtocol||uProtocol===protocol)&&(!uHostName||uHostName.toLowerCase()===hostname.toLowerCase())&&((!uPort&&!uHostName)||uPort===port)},finishLoad:function(name,strip,content,onLoad){content=strip?text.strip(content):content;if(masterConfig.isBuild){buildMap[name]=content} +onLoad(content)},load:function(name,req,onLoad,config){if(config&&config.isBuild&&!config.inlineText){onLoad();return} +masterConfig.isBuild=config&&config.isBuild;var parsed=text.parseName(name),nonStripName=parsed.moduleName+(parsed.ext?'.'+parsed.ext:''),url=req.toUrl(nonStripName),useXhr=(masterConfig.useXhr)||text.useXhr;if(url.indexOf('empty:')===0){onLoad();return} +if(!hasLocation||useXhr(url,defaultProtocol,defaultHostName,defaultPort)){text.get(url,function(content){text.finishLoad(name,parsed.strip,content,onLoad)},function(err){if(onLoad.error){onLoad.error(err)}})}else{req([nonStripName],function(content){text.finishLoad(parsed.moduleName+'.'+parsed.ext,parsed.strip,content,onLoad)})}},write:function(pluginName,moduleName,write,config){if(buildMap.hasOwnProperty(moduleName)){var content=text.jsEscape(buildMap[moduleName]);write.asModule(pluginName+"!"+moduleName,"define(function () { return '"+content+"';});\n")}},writeFile:function(pluginName,moduleName,req,write,config){var parsed=text.parseName(moduleName),extPart=parsed.ext?'.'+parsed.ext:'',nonStripName=parsed.moduleName+extPart,fileName=req.toUrl(parsed.moduleName+extPart)+'.js';text.load(nonStripName,req,function(value){var textWrite=function(contents){return write(fileName,contents)};textWrite.asModule=function(moduleName,contents){return write.asModule(moduleName,fileName,contents)};text.write(pluginName,nonStripName,textWrite,config)},config)}};if(masterConfig.env==='node'||(!masterConfig.env&&typeof process!=="undefined"&&process.versions&&!!process.versions.node&&!process.versions['node-webkit']&&!process.versions['atom-shell'])){fs=require.nodeRequire('fs');text.get=function(url,callback,errback){try{var file=fs.readFileSync(url,'utf8');if(file[0]==='\uFEFF'){file=file.substring(1)} +callback(file)}catch(e){if(errback){errback(e)}}}}else if(masterConfig.env==='xhr'||(!masterConfig.env&&text.createXhr())){text.get=function(url,callback,errback,headers){var xhr=text.createXhr(),header;xhr.open('GET',url,!0);if(headers){for(header in headers){if(headers.hasOwnProperty(header)){xhr.setRequestHeader(header.toLowerCase(),headers[header])}}} +if(masterConfig.onXhr){masterConfig.onXhr(xhr,url)} +xhr.onreadystatechange=function(evt){var status,err;if(xhr.readyState===4){status=xhr.status||0;if(status>399&&status<600){err=new Error(url+' HTTP status: '+status);err.xhr=xhr;if(errback){errback(err)}}else{callback(xhr.responseText)} +if(masterConfig.onXhrComplete){masterConfig.onXhrComplete(xhr,url)}}};xhr.send(null)}}else if(masterConfig.env==='rhino'||(!masterConfig.env&&typeof Packages!=='undefined'&&typeof java!=='undefined')){text.get=function(url,callback){var stringBuffer,line,encoding="utf-8",file=new java.io.File(url),lineSeparator=java.lang.System.getProperty("line.separator"),input=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file),encoding)),content='';try{stringBuffer=new java.lang.StringBuffer();line=input.readLine();if(line&&line.length()&&line.charAt(0)===0xfeff){line=line.substring(1)} +if(line!==null){stringBuffer.append(line)} +while((line=input.readLine())!==null){stringBuffer.append(lineSeparator);stringBuffer.append(line)} +content=String(stringBuffer.toString())}finally{input.close()} +callback(content)}}else if(masterConfig.env==='xpconnect'||(!masterConfig.env&&typeof Components!=='undefined'&&Components.classes&&Components.interfaces)){Cc=Components.classes;Ci=Components.interfaces;Components.utils['import']('resource://gre/modules/FileUtils.jsm');xpcIsWindows=('@mozilla.org/windows-registry-key;1' in Cc);text.get=function(url,callback){var inStream,convertStream,fileObj,readData={};if(xpcIsWindows){url=url.replace(/\//g,'\\')} +fileObj=new FileUtils.File(url);try{inStream=Cc['@mozilla.org/network/file-input-stream;1'].createInstance(Ci.nsIFileInputStream);inStream.init(fileObj,1,0,!1);convertStream=Cc['@mozilla.org/intl/converter-input-stream;1'].createInstance(Ci.nsIConverterInputStream);convertStream.init(inStream,"utf-8",inStream.available(),Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);convertStream.readString(inStream.available(),readData);convertStream.close();inStream.close();callback(readData.value)}catch(e){throw new Error((fileObj&&fileObj.path||'')+': '+e)}}} +return text});(function(global,factory){"use strict";if(typeof module==="object"&&typeof module.exports==="object"){module.exports=global.document?factory(global,!0):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 document=window.document;var getProto=Object.getPrototypeOf;var slice=arr.slice;var concat=arr.concat;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"};var isWindow=function isWindow(obj){return obj!=null&&obj===obj.window};var preservedScriptAttributes={type:!0,src:!0,noModule:!0};function DOMEval(code,doc,node){doc=doc||document;var i,script=doc.createElement("script");script.text=code;if(node){for(i in preservedScriptAttributes){if(node[i]){script[i]=node[i]}}} +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.3.1",jQuery=function(selector,context){return new jQuery.fn.init(selector,context)},rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;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)},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=!1;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){src=target[name];copy=options[name];if(target===copy){continue} +if(deep&©&&(jQuery.isPlainObject(copy)||(copyIsArray=Array.isArray(copy)))){if(copyIsArray){copyIsArray=!1;clone=src&&Array.isArray(src)?src:[]}else{clone=src&&jQuery.isPlainObject(src)?src:{}} +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:!0,error:function(msg){throw new Error(msg)},noop:function(){},isPlainObject:function(obj){var proto,Ctor;if(!obj||toString.call(obj)!=="[object Object]"){return !1} +proto=getProto(obj);if(!proto){return !0} +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 !1} +return !0},globalEval:function(code){DOMEval(code)},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])===!1){break}}}else{for(i in obj){if(callback.call(obj[i],i,obj[i])===!1){break}}} +return obj},trim:function(text){return text==null?"":(text+"").replace(rtrim,"")},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)},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 concat.apply([],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 !1} +return type==="array"||length===0||typeof length==="number"&&length>0&&(length-1)in obj} +var Sizzle=(function(window){var i,support,Expr,getText,isXML,tokenize,compile,select,outermostContext,sortInput,hasDuplicate,setDocument,document,docElem,documentIsHTML,rbuggyQSA,rbuggyMatches,matches,contains,expando="sizzle"+1*new Date(),preferredDoc=window.document,dirruns=0,done=0,classCache=createCache(),tokenCache=createCache(),compilerCache=createCache(),sortOrder=function(a,b){if(a===b){hasDuplicate=!0} +return 0},hasOwn=({}).hasOwnProperty,arr=[],pop=arr.pop,push_native=arr.push,push=arr.push,slice=arr.slice,indexOf=function(list,elem){var i=0,len=list.length;for(;i<len;i++){if(list[i]===elem){return i}} +return-1},booleans="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",whitespace="[\\x20\\t\\r\\n\\f]",identifier="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",attributes="\\["+whitespace+"*("+identifier+")(?:"+whitespace+"*([*^$|!~]?=)"+whitespace+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+identifier+"))|)"+whitespace+"*\\]",pseudos=":("+identifier+")(?:\\(("+"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|"+"((?:\\\\.|[^\\\\()[\\]]|"+attributes+")*)|"+".*"+")\\)|)",rwhitespace=new RegExp(whitespace+"+","g"),rtrim=new RegExp("^"+whitespace+"+|((?:^|[^\\\\])(?:\\\\.)*)"+whitespace+"+$","g"),rcomma=new RegExp("^"+whitespace+"*,"+whitespace+"*"),rcombinators=new RegExp("^"+whitespace+"*([>+~]|"+whitespace+")"+whitespace+"*"),rattributeQuotes=new RegExp("="+whitespace+"*([^\\]'\"]*?)"+whitespace+"*\\]","g"),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,rnative=/^[^{]+\{\s*\[native \w/,rquickExpr=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,rsibling=/[+~]/,runescape=new RegExp("\\\\([\\da-f]{1,6}"+whitespace+"?|("+whitespace+")|.)","ig"),funescape=function(_,escaped,escapedWhitespace){var high="0x"+escaped-0x10000;return high!==high||escapedWhitespace?escaped:high<0?String.fromCharCode(high+0x10000):String.fromCharCode(high>>10|0xD800,high&0x3FF|0xDC00)},rcssescape=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,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},unloadHandler=function(){setDocument()},disabledAncestor=addCombinator(function(elem){return elem.disabled===!0&&("form" in elem||"label" in elem)},{dir:"parentNode",next:"legend"});try{push.apply((arr=slice.call(preferredDoc.childNodes)),preferredDoc.childNodes);arr[preferredDoc.childNodes.length].nodeType}catch(e){push={apply:arr.length?function(target,els){push_native.apply(target,slice.call(els))}:function(target,els){var j=target.length,i=0;while((target[j++]=els[i++])){} +target.length=j-1}}} +function Sizzle(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){if((context?context.ownerDocument||context:preferredDoc)!==document){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){results.push(elem);return results}}else{return results}}else{if(newContext&&(elem=newContext.getElementById(m))&&contains(context,elem)&&elem.id===m){results.push(elem);return results}}}else if(match[2]){push.apply(results,context.getElementsByTagName(selector));return results}else if((m=match[3])&&support.getElementsByClassName&&context.getElementsByClassName){push.apply(results,context.getElementsByClassName(m));return results}} +if(support.qsa&&!compilerCache[selector+" "]&&(!rbuggyQSA||!rbuggyQSA.test(selector))){if(nodeType!==1){newContext=context;newSelector=selector}else if(context.nodeName.toLowerCase()!=="object"){if((nid=context.getAttribute("id"))){nid=nid.replace(rcssescape,fcssescape)}else{context.setAttribute("id",(nid=expando))} +groups=tokenize(selector);i=groups.length;while(i--){groups[i]="#"+nid+" "+toSelector(groups[i])} +newSelector=groups.join(",");newContext=rsibling.test(selector)&&testContext(context.parentNode)||context} +if(newSelector){try{push.apply(results,newContext.querySelectorAll(newSelector));return results}catch(qsaError){}finally{if(nid===expando){context.removeAttribute("id")}}}}}} +return select(selector.replace(rtrim,"$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]=!0;return fn} +function assert(fn){var el=document.createElement("fieldset");try{return !!fn(el)}catch(e){return !1}finally{if(el.parentNode){el.parentNode.removeChild(el)} +el=null}} +function addHandle(attrs,handler){var arr=attrs.split("|"),i=arr.length;while(i--){Expr.attrHandle[arr[i]]=handler}} +function siblingCheck(a,b){var cur=b&&a,diff=cur&&a.nodeType===1&&b.nodeType===1&&a.sourceIndex-b.sourceIndex;if(diff){return diff} +if(cur){while((cur=cur.nextSibling)){if(cur===b){return-1}}} +return a?1:-1} +function createInputPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type===type}} +function createButtonPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&elem.type===type}} +function createDisabledPseudo(disabled){return function(elem){if("form" in elem){if(elem.parentNode&&elem.disabled===!1){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&&disabledAncestor(elem)===disabled} +return elem.disabled===disabled}else if("label" in elem){return elem.disabled===disabled} +return !1}} +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} +support=Sizzle.support={};isXML=Sizzle.isXML=function(elem){var documentElement=elem&&(elem.ownerDocument||elem).documentElement;return documentElement?documentElement.nodeName!=="HTML":!1};setDocument=Sizzle.setDocument=function(node){var hasCompare,subWindow,doc=node?node.ownerDocument||node:preferredDoc;if(doc===document||doc.nodeType!==9||!doc.documentElement){return document} +document=doc;docElem=document.documentElement;documentIsHTML=!isXML(document);if(preferredDoc!==document&&(subWindow=document.defaultView)&&subWindow.top!==subWindow){if(subWindow.addEventListener){subWindow.addEventListener("unload",unloadHandler,!1)}else if(subWindow.attachEvent){subWindow.attachEvent("onunload",unloadHandler)}} +support.attributes=assert(function(el){el.className="i";return !el.getAttribute("className")});support.getElementsByTagName=assert(function(el){el.appendChild(document.createComment(""));return !el.getElementsByTagName("*").length});support.getElementsByClassName=rnative.test(document.getElementsByClassName);support.getById=assert(function(el){docElem.appendChild(el).id=expando;return !document.getElementsByName||!document.getElementsByName(expando).length});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=support.getElementsByTagName?function(tag,context){if(typeof context.getElementsByTagName!=="undefined"){return context.getElementsByTagName(tag)}else if(support.qsa){return context.querySelectorAll(tag)}}:function(tag,context){var elem,tmp=[],i=0,results=context.getElementsByTagName(tag);if(tag==="*"){while((elem=results[i++])){if(elem.nodeType===1){tmp.push(elem)}} +return tmp} +return results};Expr.find.CLASS=support.getElementsByClassName&&function(className,context){if(typeof context.getElementsByClassName!=="undefined"&&documentIsHTML){return context.getElementsByClassName(className)}};rbuggyMatches=[];rbuggyQSA=[];if((support.qsa=rnative.test(document.querySelectorAll))){assert(function(el){docElem.appendChild(el).innerHTML="<a id='"+expando+"'></a>"+"<select id='"+expando+"-\r\\' msallowcapture=''>"+"<option selected=''></option></select>";if(el.querySelectorAll("[msallowcapture^='']").length){rbuggyQSA.push("[*^$]="+whitespace+"*(?:''|\"\")")} +if(!el.querySelectorAll("[selected]").length){rbuggyQSA.push("\\["+whitespace+"*(?:value|"+booleans+")")} +if(!el.querySelectorAll("[id~="+expando+"-]").length){rbuggyQSA.push("~=")} +if(!el.querySelectorAll(":checked").length){rbuggyQSA.push(":checked")} +if(!el.querySelectorAll("a#"+expando+"+*").length){rbuggyQSA.push(".#.+[+~]")}});assert(function(el){el.innerHTML="<a href='' disabled='disabled'></a>"+"<select disabled='disabled'><option/></select>";var input=document.createElement("input");input.setAttribute("type","hidden");el.appendChild(input).setAttribute("name","D");if(el.querySelectorAll("[name=d]").length){rbuggyQSA.push("name"+whitespace+"*[*^$|!~]?=")} +if(el.querySelectorAll(":enabled").length!==2){rbuggyQSA.push(":enabled",":disabled")} +docElem.appendChild(el).disabled=!0;if(el.querySelectorAll(":disabled").length!==2){rbuggyQSA.push(":enabled",":disabled")} +el.querySelectorAll("*,:x");rbuggyQSA.push(",.*:")})} +if((support.matchesSelector=rnative.test((matches=docElem.matches||docElem.webkitMatchesSelector||docElem.mozMatchesSelector||docElem.oMatchesSelector||docElem.msMatchesSelector)))){assert(function(el){support.disconnectedMatch=matches.call(el,"*");matches.call(el,"[s!='']:x");rbuggyMatches.push("!=",pseudos)})} +rbuggyQSA=rbuggyQSA.length&&new RegExp(rbuggyQSA.join("|"));rbuggyMatches=rbuggyMatches.length&&new RegExp(rbuggyMatches.join("|"));hasCompare=rnative.test(docElem.compareDocumentPosition);contains=hasCompare||rnative.test(docElem.contains)?function(a,b){var adown=a.nodeType===9?a.documentElement:a,bup=b&&b.parentNode;return a===bup||!!(bup&&bup.nodeType===1&&(adown.contains?adown.contains(bup):a.compareDocumentPosition&&a.compareDocumentPosition(bup)&16))}:function(a,b){if(b){while((b=b.parentNode)){if(b===a){return !0}}} +return !1};sortOrder=hasCompare?function(a,b){if(a===b){hasDuplicate=!0;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&&contains(preferredDoc,a)){return-1} +if(b===document||b.ownerDocument===preferredDoc&&contains(preferredDoc,b)){return 1} +return sortInput?(indexOf(sortInput,a)-indexOf(sortInput,b)):0} +return compare&4?-1:1}:function(a,b){if(a===b){hasDuplicate=!0;return 0} +var cur,i=0,aup=a.parentNode,bup=b.parentNode,ap=[a],bp=[b];if(!aup||!bup){return a===document?-1:b===document?1:aup?-1:bup?1:sortInput?(indexOf(sortInput,a)-indexOf(sortInput,b)):0}else if(aup===bup){return siblingCheck(a,b)} +cur=a;while((cur=cur.parentNode)){ap.unshift(cur)} +cur=b;while((cur=cur.parentNode)){bp.unshift(cur)} +while(ap[i]===bp[i]){i++} +return i?siblingCheck(ap[i],bp[i]):ap[i]===preferredDoc?-1:bp[i]===preferredDoc?1:0};return document};Sizzle.matches=function(expr,elements){return Sizzle(expr,null,null,elements)};Sizzle.matchesSelector=function(elem,expr){if((elem.ownerDocument||elem)!==document){setDocument(elem)} +expr=expr.replace(rattributeQuotes,"='$1']");if(support.matchesSelector&&documentIsHTML&&!compilerCache[expr+" "]&&(!rbuggyMatches||!rbuggyMatches.test(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){}} +return Sizzle(expr,document,null,[elem]).length>0};Sizzle.contains=function(context,elem){if((context.ownerDocument||context)!==document){setDocument(context)} +return contains(context,elem)};Sizzle.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;return val!==undefined?val:support.attributes||!documentIsHTML?elem.getAttribute(name):(val=elem.getAttributeNode(name))&&val.specified?val.value:null};Sizzle.escape=function(sel){return(sel+"").replace(rcssescape,fcssescape)};Sizzle.error=function(msg){throw new Error("Syntax error, unrecognized expression: "+msg)};Sizzle.uniqueSort=function(results){var elem,duplicates=[],j=0,i=0;hasDuplicate=!support.detectDuplicates;sortInput=!support.sortStable&&results.slice(0);results.sort(sortOrder);if(hasDuplicate){while((elem=results[i++])){if(elem===results[i]){j=duplicates.push(i)}} +while(j--){results.splice(duplicates[j],1)}} +sortInput=null;return results};getText=Sizzle.getText=function(elem){var node,ret="",i=0,nodeType=elem.nodeType;if(!nodeType){while((node=elem[i++])){ret+=getText(node)}}else if(nodeType===1||nodeType===9||nodeType===11){if(typeof elem.textContent==="string"){return elem.textContent}else{for(elem=elem.firstChild;elem;elem=elem.nextSibling){ret+=getText(elem)}}}else if(nodeType===3||nodeType===4){return elem.nodeValue} +return ret};Expr=Sizzle.selectors={cacheLength:50,createPseudo:markFunction,match:matchExpr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{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]){Sizzle.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]){Sizzle.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,!0))&&(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 nodeName=nodeNameSelector.replace(runescape,funescape).toLowerCase();return nodeNameSelector==="*"?function(){return !0}:function(elem){return elem.nodeName&&elem.nodeName.toLowerCase()===nodeName}},"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=Sizzle.attr(elem,name);if(result==null){return operator==="!="} +if(!operator){return !0} +result+="";return operator==="="?result===check:operator==="!="?result!==check:operator==="^="?check&&result.indexOf(check)===0:operator==="*="?check&&result.indexOf(check)>-1:operator==="$="?check&&result.slice(-check.length)===check:operator==="~="?(" "+result.replace(rwhitespace," ")+" ").indexOf(check)>-1:operator==="|="?result===check||result.slice(0,check.length+1)===check+"-":!1}},"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,uniqueCache,outerCache,node,nodeIndex,start,dir=simple!==forward?"nextSibling":"previousSibling",parent=elem.parentNode,name=ofType&&elem.nodeName.toLowerCase(),useCache=!xml&&!ofType,diff=!1;if(parent){if(simple){while(dir){node=elem;while((node=node[dir])){if(ofType?node.nodeName.toLowerCase()===name:node.nodeType===1){return !1}} +start=dir=type==="only"&&!start&&"nextSibling"} +return !0} +start=[forward?parent.firstChild:parent.lastChild];if(forward&&useCache){node=parent;outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});cache=uniqueCache[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){uniqueCache[type]=[dirruns,nodeIndex,diff];break}}}else{if(useCache){node=elem;outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});cache=uniqueCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex} +if(diff===!1){while((node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop())){if((ofType?node.nodeName.toLowerCase()===name:node.nodeType===1)&&++diff){if(useCache){outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});uniqueCache[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()]||Sizzle.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(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(rtrim,"$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 Sizzle(selector,elem).length>0}}),"contains":markFunction(function(text){text=text.replace(runescape,funescape);return function(elem){return(elem.textContent||elem.innerText||getText(elem)).indexOf(text)>-1}}),"lang":markFunction(function(lang){if(!ridentifier.test(lang||"")){Sizzle.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 !1}}),"target":function(elem){var hash=window.location&&window.location.hash;return hash&&hash.slice(1)===elem.id},"root":function(elem){return elem===docElem},"focus":function(elem){return elem===document.activeElement&&(!document.hasFocus||document.hasFocus())&&!!(elem.type||elem.href||~elem.tabIndex)},"enabled":createDisabledPseudo(!1),"disabled":createDisabledPseudo(!0),"checked":function(elem){var nodeName=elem.nodeName.toLowerCase();return(nodeName==="input"&&!!elem.checked)||(nodeName==="option"&&!!elem.selected)},"selected":function(elem){if(elem.parentNode){elem.parentNode.selectedIndex} +return elem.selected===!0},"empty":function(elem){for(elem=elem.firstChild;elem;elem=elem.nextSibling){if(elem.nodeType<6){return !1}} +return !0},"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){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type==="button"||name==="button"},"text":function(elem){var attr;return elem.nodeName.toLowerCase()==="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=argument<0?argument+length: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:!0,checkbox:!0,file:!0,password:!0,image:!0}){Expr.pseudos[i]=createInputPseudo(i)} +for(i in{submit:!0,reset:!0}){Expr.pseudos[i]=createButtonPseudo(i)} +function setFilters(){} +setFilters.prototype=Expr.filters=Expr.pseudos;Expr.setFilters=new setFilters();tokenize=Sizzle.tokenize=function(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=!1;if((match=rcombinators.exec(soFar))){matched=match.shift();tokens.push({value:matched,type:match[0].replace(rtrim," ")});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}} +return parseOnly?soFar.length:soFar?Sizzle.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 !1}:function(elem,context,xml){var oldCache,uniqueCache,outerCache,newCache=[dirruns,doneName];if(xml){while((elem=elem[dir])){if(elem.nodeType===1||checkNonElements){if(matcher(elem,context,xml)){return !0}}}}else{while((elem=elem[dir])){if(elem.nodeType===1||checkNonElements){outerCache=elem[expando]||(elem[expando]={});uniqueCache=outerCache[elem.uniqueID]||(outerCache[elem.uniqueID]={});if(skip&&skip===elem.nodeName.toLowerCase()){elem=elem[dir]||elem}else if((oldCache=uniqueCache[key])&&oldCache[0]===dirruns&&oldCache[1]===doneName){return(newCache[2]=oldCache[2])}else{uniqueCache[key]=newCache;if((newCache[2]=matcher(elem,context,xml))){return !0}}}}} +return !1}} +function elementMatcher(matchers){return matchers.length>1?function(elem,context,xml){var i=matchers.length;while(i--){if(!matchers[i](elem,context,xml)){return !1}} +return !0}:matchers[0]} +function multipleContexts(selector,contexts,results){var i=0,len=contexts.length;for(;i<len;i++){Sizzle(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,preMap=[],postMap=[],preexisting=results.length,elems=seed||multipleContexts(selector||"*",context.nodeType?[context]:context,[]),matcherIn=preFilter&&(seed||!selector)?condense(elems,preMap,preFilter,context,xml):elems,matcherOut=matcher?postFinder||(seed?preFilter:preexisting||postFilter)?[]:results:matcherIn;if(matcher){matcher(matcherIn,matcherOut,context,xml)} +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(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,!0),matchAnyContext=addCombinator(function(elem){return indexOf(checkContext,elem)>-1},implicitRelative,!0),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(rtrim,"$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)){results.push(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){Sizzle.uniqueSort(results)}} +if(outermost){dirruns=dirrunsUnique;outermostContext=contextBackup} +return unmatched};return bySet?markFunction(superMatcher):superMatcher} +compile=Sizzle.compile=function(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};select=Sizzle.select=function(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;support.detectDuplicates=!!hasDuplicate;setDocument();support.sortDetached=assert(function(el){return el.compareDocumentPosition(document.createElement("fieldset"))&1});if(!assert(function(el){el.innerHTML="<a href='#'></a>";return el.firstChild.getAttribute("href")==="#"})){addHandle("type|href|height|width",function(elem,name,isXML){if(!isXML){return elem.getAttribute(name,name.toLowerCase()==="type"?1:2)}})} +if(!support.attributes||!assert(function(el){el.innerHTML="<input/>";el.firstChild.setAttribute("value","");return el.firstChild.getAttribute("value")===""})){addHandle("value",function(elem,name,isXML){if(!isXML&&elem.nodeName.toLowerCase()==="input"){return elem.defaultValue}})} +if(!assert(function(el){return el.getAttribute("disabled")==null})){addHandle(booleans,function(elem,name,isXML){var val;if(!isXML){return elem[name]===!0?name.toLowerCase():(val=elem.getAttributeNode(name))&&val.specified?val.value:null}})} +return Sizzle})(window);jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.pseudos;jQuery.uniqueSort=jQuery.unique=Sizzle.uniqueSort;jQuery.text=Sizzle.getText;jQuery.isXMLDoc=Sizzle.isXML;jQuery.contains=Sizzle.contains;jQuery.escapeSelector=Sizzle.escape;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;function nodeName(elem,name){return elem.nodeName&&elem.nodeName.toLowerCase()===name.toLowerCase()};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 !0}}}))} +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||[],!1))},not:function(selector){return this.pushStack(winnow(this,selector||[],!0))},is:function(selector){return !!winnow(this,typeof selector==="string"&&rneedsContext.test(selector)?jQuery(selector):selector||[],!1).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,!0));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:!0,contents:!0,next:!0,prev:!0};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 !0}}})},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(nodeName(elem,"iframe")){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]=!0});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=!0;for(;queue.length;firingIndex=-1){memory=queue.shift();while(++firingIndex<list.length){if(list[firingIndex].apply(memory[0],memory[1])===!1&&options.stopOnFalse){firingIndex=list.length;memory=!1}}} +if(!options.memory){memory=!1} +firing=!1;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.stackTrace)} +if(depth+1>=maxDepth){if(handler!==Thrower){that=undefined;args=[e]} +deferred.rejectWith(that,args)}}};if(depth){process()}else{if(jQuery.Deferred.getStackHook){process.stackTrace=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),master=jQuery.Deferred(),updateFunc=function(i){return function(value){resolveContexts[i]=this;resolveValues[i]=arguments.length>1?slice.call(arguments):value;if(!(--remaining)){master.resolveWith(resolveContexts,resolveValues)}}};if(remaining<=1){adoptValue(singleValue,master.done(updateFunc(i)).resolve,master.reject,!remaining);if(master.state()==="pending"||isFunction(resolveValues[i]&&resolveValues[i].then)){return master.then()}} +while(i--){adoptValue(resolveValues[i],updateFunc(i),master.reject)} +return master.promise()}});var rerrorNames=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;jQuery.Deferred.exceptionHook=function(error,stack){if(window.console&&window.console.warn&&error&&rerrorNames.test(error.name)){window.console.warn("jQuery.Deferred exception: "+error.message,error.stack,stack)}};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:!1,readyWait:1,ready:function(wait){if(wait===!0?--jQuery.readyWait:jQuery.isReady){return} +jQuery.isReady=!0;if(wait!==!0&&--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=!0;for(i in key){access(elems,fn,i,key[i],!0,emptyGet,raw)}}else if(value!==undefined){chainable=!0;if(!isFunction(value)){raw=!0} +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:!0})}}} +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 !0} +if(data==="false"){return !1} +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",!0)}} +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,!0)},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 isHiddenWithinTree=function(elem,el){elem=el||elem;return elem.style.display==="none"||elem.style.display===""&&jQuery.contains(elem.ownerDocument,elem)&&jQuery.css(elem,"display")==="none"};var swap=function(elem,options,callback,args){var ret,name,old={};for(name in options){old[name]=elem.style[name];elem.style[name]=options[name]} +ret=callback.apply(elem,args||[]);for(name in options){elem.style[name]=old[name]} +return ret};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=(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,!0)},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);var wrapMap={option:[1,"<select multiple='multiple'>","</select>"],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.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;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,contains,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} +contains=jQuery.contains(elem.ownerDocument,elem);tmp=getAll(fragment.appendChild(elem),"script");if(contains){setGlobalEval(tmp)} +if(scripts){j=0;while((elem=tmp[j++])){if(rscriptType.test(elem.type||"")){scripts.push(elem)}}}} +return fragment}(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(!0).cloneNode(!0).lastChild.checked;div.innerHTML="<textarea>x</textarea>";support.noCloneChecked=!!div.cloneNode(!0).lastChild.defaultValue})();var documentElement=document.documentElement;var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rtypenamespace=/^([^.]*)(?:\.(.+)|)/;function returnTrue(){return !0} +function returnFalse(){return !1} +function safeActiveElement(){try{return document.activeElement}catch(err){}} +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===!1){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(!elemData){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={}} +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)===!1){if(elem.addEventListener){if(type=='wheel'||type=='mousewheel'||type=='touchstart'||type=='touchmove'){elem.addEventListener(type,eventHandle,{passive:!0})} +else{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]=!0}},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,!0)} +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)===!1){jQuery.removeEvent(elem,type,elemData.handle)} +delete events[type]}} +if(jQuery.isEmptyObject(events)){dataPriv.remove(elem,"handle events")}},dispatch:function(nativeEvent){var event=jQuery.event.fix(nativeEvent);var i,j,ret,matched,handleObj,handlerQueue,args=new Array(arguments.length),handlers=(dataPriv.get(this,"events")||{})[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)===!1){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||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)===!1){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===!0)){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:!0,configurable:!0,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:!0,configurable:!0,writable:!0,value:value})}})},fix:function(originalEvent){return originalEvent[jQuery.expando]?originalEvent:new jQuery.Event(originalEvent)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==safeActiveElement()&&this.focus){this.focus();return !1}},delegateType:"focusin"},blur:{trigger:function(){if(this===safeActiveElement()&&this.blur){this.blur();return !1}},delegateType:"focusout"},click:{trigger:function(){if(this.type==="checkbox"&&this.click&&nodeName(this,"input")){this.click();return !1}},_default:function(event){return nodeName(event.target,"a")}},beforeunload:{postDispatch:function(event){if(event.result!==undefined&&event.originalEvent){event.originalEvent.returnValue=event.result}}}}};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===!1?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]=!0};jQuery.Event.prototype={constructor:jQuery.Event,isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse,isSimulated:!1,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:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(event){var button=event.button;if(event.which==null&&rkeyEvent.test(event.type)){return event.charCode!=null?event.charCode:event.keyCode} +if(!event.which&&button!==undefined&&rmouseEvent.test(event.type)){if(button&1){return 1} +if(button&2){return 3} +if(button&4){return 2} +return 0} +return event.which}},jQuery.event.addProp);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===!1||typeof selector==="function"){fn=selector;selector=undefined} +if(fn===!1){fn=returnFalse} +return this.each(function(){jQuery.event.remove(this,types,fn,selector)})}});var rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,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,pdataCur,udataOld,udataCur,events;if(dest.nodeType!==1){return} +if(dataPriv.hasData(src)){pdataOld=dataPriv.access(src);pdataCur=dataPriv.set(dest,pdataOld);events=pdataOld.events;if(events){delete pdataCur.handle;pdataCur.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=concat.apply([],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,!1,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,!0,!0);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){jQuery._evalUrl(node.src)}}else{DOMEval(node.textContent.replace(rcleanScript,""),doc,node)}}}}}} +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&&jQuery.contains(node.ownerDocument,node)){setGlobalEval(getAll(node,"script"))} +node.parentNode.removeChild(node)}} +return elem} +jQuery.extend({htmlPrefilter:function(html){return html.replace(rxhtmlTag,"<$1></$2>")},clone:function(elem,dataAndEvents,deepDataAndEvents){var i,l,srcElements,destElements,clone=elem.cloneNode(!0),inPage=jQuery.contains(elem.ownerDocument,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,!0)},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,!1));elem.textContent=""}} +return this},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?!1: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,!1));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(!0);jQuery(insert[i])[original](elems);push.apply(ret,elems.get())} +return this.pushStack(ret)}});var rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i");var getStyles=function(elem){var view=elem.ownerDocument.defaultView;if(!view||!view.opener){view=window} +return view.getComputedStyle(elem)};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=div.offsetWidth===36||"absolute";documentElement.removeChild(container);div=null} +function roundPixelMeasures(measure){return Math.round(parseFloat(measure))} +var pixelPositionVal,boxSizingReliableVal,scrollboxSizeVal,pixelBoxStylesVal,reliableMarginLeftVal,container=document.createElement("div"),div=document.createElement("div");if(!div.style){return} +div.style.backgroundClip="content-box";div.cloneNode(!0).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}})})();function curCSS(elem,name,computed){var width,minWidth,maxWidth,ret,style=elem.style;computed=computed||getStyles(elem);if(computed){ret=computed.getPropertyValue(name)||computed[name];if(ret===""&&!jQuery.contains(elem.ownerDocument,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 rdisplayswap=/^(none|table(?!-c[ea]).+)/,rcustomProp=/^--/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"},cssPrefixes=["Webkit","Moz","ms"],emptyStyle=document.createElement("div").style;function vendorPropName(name){if(name in emptyStyle){return 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 ret=jQuery.cssProps[name];if(!ret){ret=jQuery.cssProps[name]=vendorPropName(name)||name} +return ret} +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;if(box===(isBorderBox?"border":"content")){return 0} +for(;i<4;i+=2){if(box==="margin"){delta+=jQuery.css(elem,box+cssExpand[i],!0,styles)} +if(!isBorderBox){delta+=jQuery.css(elem,"padding"+cssExpand[i],!0,styles);if(box!=="padding"){delta+=jQuery.css(elem,"border"+cssExpand[i]+"Width",!0,styles)}else{extra+=jQuery.css(elem,"border"+cssExpand[i]+"Width",!0,styles)}}else{if(box==="content"){delta-=jQuery.css(elem,"padding"+cssExpand[i],!0,styles)} +if(box!=="margin"){delta-=jQuery.css(elem,"border"+cssExpand[i]+"Width",!0,styles)}}} +if(!isBorderBox&&computedVal>=0){delta+=Math.max(0,Math.ceil(elem["offset"+dimension[0].toUpperCase()+dimension.slice(1)]-computedVal-delta-extra-0.5))} +return delta} +function getWidthOrHeight(elem,dimension,extra){var styles=getStyles(elem),val=curCSS(elem,dimension,styles),isBorderBox=jQuery.css(elem,"boxSizing",!1,styles)==="border-box",valueIsBorderBox=isBorderBox;if(rnumnonpx.test(val)){if(!extra){return val} +val="auto"} +valueIsBorderBox=valueIsBorderBox&&(support.boxSizingReliable()||val===elem.style[dimension]);if(val==="auto"||!parseFloat(val)&&jQuery.css(elem,"display",!1,styles)==="inline"){val=elem["offset"+dimension[0].toUpperCase()+dimension.slice(1)];valueIsBorderBox=!0} +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":!0,"columnCount":!0,"fillOpacity":!0,"flexGrow":!0,"flexShrink":!0,"fontWeight":!0,"lineHeight":!0,"opacity":!0,"order":!0,"orphans":!0,"widows":!0,"zIndex":!0,"zoom":!0},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"){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,!1,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,!0,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===!0||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),isBorderBox=jQuery.css(elem,"boxSizing",!1,styles)==="border-box",subtract=extra&&boxModelAdjustment(elem,dimension,extra,isBorderBox,styles);if(isBorderBox&&support.scrollboxSize()===styles.position){subtract-=Math.ceil(elem["offset"+dimension[0].toUpperCase()+dimension.slice(1)]-parseFloat(styles[dimension])-boxModelAdjustment(elem,dimension,"border",!1,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],!1,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&&(tween.elem.style[jQuery.cssProps[tween.prop]]!=null||jQuery.cssHooks[tween.prop])){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===!1&&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=!0}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],!0);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=!1;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],!0)} +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 !1} +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 !1},animation=deferred.promise({elem:elem,props:jQuery.extend({},properties),opts:jQuery.extend(!0,{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=!0;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===!0){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(!0)}};doAnimation.finish=doAnimation;return empty||optall.queue===!1?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&&type!==!1){this.queue(type||"fx",[])} +return this.each(function(){var dequeue=!0,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=!1;timers.splice(index,1)}} +if(dequeue||!gotoEnd){jQuery.dequeue(this,type)}})},finish:function(type){if(type!==!1){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=!0;jQuery.queue(this,type,[]);if(hooks&&hooks.stop){hooks.stop.call(this,!0)} +for(index=timers.length;index--;){if(timers[index].elem===this&&timers[index].queue===type){timers[index].anim.stop(!0);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,!0),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=!0;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===!1){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 classes,elem,cur,curValue,clazz,j,finalValue,i=0;if(isFunction(value)){return this.each(function(j){jQuery(this).addClass(value.call(this,j,getClass(this)))})} +classes=classesToArray(value);if(classes.length){while((elem=this[i++])){curValue=getClass(elem);cur=elem.nodeType===1&&(" "+stripAndCollapse(curValue)+" ");if(cur){j=0;while((clazz=classes[j++])){if(cur.indexOf(" "+clazz+" ")<0){cur+=clazz+" "}} +finalValue=stripAndCollapse(cur);if(curValue!==finalValue){elem.setAttribute("class",finalValue)}}}} +return this},removeClass:function(value){var classes,elem,cur,curValue,clazz,j,finalValue,i=0;if(isFunction(value)){return this.each(function(j){jQuery(this).removeClass(value.call(this,j,getClass(this)))})} +if(!arguments.length){return this.attr("class","")} +classes=classesToArray(value);if(classes.length){while((elem=this[i++])){curValue=getClass(elem);cur=elem.nodeType===1&&(" "+stripAndCollapse(curValue)+" ");if(cur){j=0;while((clazz=classes[j++])){while(cur.indexOf(" "+clazz+" ")>-1){cur=cur.replace(" "+clazz+" "," ")}} +finalValue=stripAndCollapse(cur);if(curValue!==finalValue){elem.setAttribute("class",finalValue)}}}} +return this},toggleClass:function(value,stateVal){var type=typeof value,isValidValue=type==="string"||Array.isArray(value);if(typeof stateVal==="boolean"&&isValidValue){return stateVal?this.addClass(value):this.removeClass(value)} +if(isFunction(value)){return this.each(function(i){jQuery(this).toggleClass(value.call(this,i,getClass(this),stateVal),stateVal)})} +return this.each(function(){var className,i,self,classNames;if(isValidValue){i=0;self=jQuery(this);classNames=classesToArray(value);while((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===!1?"":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 !0}} +return !1}});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=!0}} +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}}});support.focusin="onfocusin" in window;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)===!1){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")||{})[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===!1){event.preventDefault()}}} +event.type=type;if(!onlyHandlers&&!event.isDefaultPrevented()){if((!special._default||special._default.apply(eventPath.pop(),data)===!1)&&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:!0});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,!0)}}});if(!support.focusin){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){var handler=function(event){jQuery.event.simulate(fix,event.target,jQuery.event.fix(event))};jQuery.event.special[fix]={setup:function(){var doc=this.ownerDocument||this,attaches=dataPriv.access(doc,fix);if(!attaches){doc.addEventListener(orig,handler,!0)} +dataPriv.access(doc,fix,(attaches||0)+1)},teardown:function(){var doc=this.ownerDocument||this,attaches=dataPriv.access(doc,fix)-1;if(!attaches){doc.removeEventListener(orig,handler,!0);dataPriv.remove(doc,fix)}else{dataPriv.access(doc,fix,attaches)}}}})} +var location=window.location;var nonce=Date.now();var rquery=(/\?/);jQuery.parseXML=function(data){var xml;if(!data||typeof data!=="string"){return null} +try{xml=(new window.DOMParser()).parseFromString(data,"text/xml")}catch(e){xml=undefined} +if(!xml||xml.getElementsByTagName("parsererror").length){jQuery.error("Invalid XML: "+data)} +return xml};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(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]=!0;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 !1}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(!0,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===!0){conv=converters[conv2]}else if(converters[conv2]!==!0){current=tmp[0];dataTypes.unshift(tmp[1])} +break}}}} +if(conv!==!0){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:!0,processData:!0,async:!0,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":!0,"text json":JSON.parse,"text xml":jQuery.parseXML},flatOptions:{url:!0,context:!0}},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()]=match[2]}} +match=responseHeaders[key.toLowerCase()]} +return match==null?null:match},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=!0}} +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===!1){cacheURL=cacheURL.replace(rantiCache,"$1");uncached=(rquery.test(cacheURL)?"&":"?")+"_="+(nonce++)+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!==!1||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)===!1||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=!1;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=!0;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)} +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._evalUrl=function(url){return jQuery.ajax({url:url,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})};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(!0);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=!1}});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=!1} +if(s.crossDomain){s.type="GET"}});jQuery.ajaxTransport("script",function(s){if(s.crossDomain){var script,callback;return{send:function(_,complete){script=jQuery("<script>").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++));this[callback]=!0;return callback}});jQuery.ajaxPrefilter("json jsonp",function(s,originalSettings,jqXHR){var callbackName,overwritten,responseContainer,jsonProp=s.jsonp!==!1&&(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!==!1){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=!1} +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.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(i,type){jQuery.fn[type]=function(fn){return this.on(type,fn)}});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",!0);parentOffset.left+=jQuery.css(offsetParent,"borderLeftWidth",!0)}} +return{top:offset.top-parentOffset.top-jQuery.css(elem,"marginTop",!0),left:offset.left-parentOffset.left-jQuery.css(elem,"marginLeft",!0)}},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===!0||value===!0?"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(("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)}});jQuery.fn.extend({hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver)}});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)}});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(!0)}};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))};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(!noGlobal){window.jQuery=window.$=jQuery} +return jQuery});(function(factory){if(typeof exports==='object'){module.exports=factory(require('jquery'))}else if(typeof define==='function'&&define.amd){define('inview',['jquery'],factory)}else{factory(jQuery)}}(function($){var inviewObjects=[],viewportSize,viewportOffset,d=document,w=window,documentElement=d.documentElement,timer;$.event.special.inview={add:function(data){inviewObjects.push({data:data,$element:$(this),element:this});if(!timer&&inviewObjects.length){timer=setInterval(checkInView,250)}},remove:function(data){for(var i=0;i<inviewObjects.length;i++){var inviewObject=inviewObjects[i];if(inviewObject.element===this&&inviewObject.data.guid===data.guid){inviewObjects.splice(i,1);break}} +if(!inviewObjects.length){clearInterval(timer);timer=null}}};function getViewportSize(){var mode,domObject,size={height:w.innerHeight,width:w.innerWidth};if(!size.height){mode=d.compatMode;if(mode||!$.support.boxModel){domObject=mode==='CSS1Compat'?documentElement:d.body;size={height:domObject.clientHeight,width:domObject.clientWidth}}} +return size} +function getViewportOffset(){return{top:w.pageYOffset||documentElement.scrollTop||d.body.scrollTop,left:w.pageXOffset||documentElement.scrollLeft||d.body.scrollLeft}} +function checkInView(){if(!inviewObjects.length){return} +var i=0,$elements=$.map(inviewObjects,function(inviewObject){var selector=inviewObject.data.selector,$element=inviewObject.$element;return selector?$element.find(selector):$element});viewportSize=viewportSize||getViewportSize();viewportOffset=viewportOffset||getViewportOffset();for(;i<inviewObjects.length;i++){if(!$.contains(documentElement,$elements[i][0])){continue} +var $element=$($elements[i]),elementSize={height:$element[0].offsetHeight,width:$element[0].offsetWidth},elementOffset=$element.offset(),inView=$element.data('inview');if(!viewportOffset||!viewportSize){return} +if(elementOffset.top+elementSize.height>viewportOffset.top&&elementOffset.top<viewportOffset.top+viewportSize.height&&elementOffset.left+elementSize.width>viewportOffset.left&&elementOffset.left<viewportOffset.left+viewportSize.width){if(!inView){$element.data('inview',!0).trigger('inview',[!0])}}else if(inView){$element.data('inview',!1).trigger('inview',[!1])}}} +$(w).on("scroll resize scrollstop",function(){viewportSize=viewportOffset=null});if(!documentElement.addEventListener&&documentElement.attachEvent){documentElement.attachEvent("onfocusin",function(){viewportOffset=null})}}));(function(factory){'use strict';if(typeof define==='function'&&define.amd){define('slick',['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:!0,adaptiveHeight:!1,appendArrows:$(element),appendDots:$(element),arrows:!0,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:!1,autoplaySpeed:3000,centerMode:!1,centerPadding:'50px',cssEase:'ease',customPaging:function(slider,i){return $('<button type="button" />').text(i+1)},dots:!1,dotsClass:'slick-dots',draggable:!0,easing:'linear',edgeFriction:0.35,fade:!1,focusOnSelect:!1,focusOnChange:!1,infinite:!0,initialSlide:0,lazyLoad:'ondemand',mobileFirst:!1,pauseOnHover:!0,pauseOnFocus:!0,pauseOnDotsHover:!1,respondTo:'window',responsive:null,rows:1,rtl:!1,slide:'',slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,useTransform:!0,variableWidth:!1,vertical:!1,verticalSwiping:!1,waitForAnimate:!0,zIndex:1000};_.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,scrolling:!1,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,swiping:!1,$list:null,touchObject:{},transformsEnabled:!1,unslicked:!1};$.extend(_,_.initials);_.activeBreakpoint=null;_.animType=null;_.animProp=null;_.breakpoints=[];_.breakpointSettings=[];_.cssTransitions=!1;_.focussed=!1;_.interrupted=!1;_.hidden='hidden';_.paused=!0;_.positionProp=null;_.respondTo=null;_.rowCount=1;_.shouldClick=!0;_.$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(!0)} +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 !1} +_.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===!0){$(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===!0&&_.options.vertical===!1){var targetHeight=_.$slides.eq(_.currentSlide).outerHeight(!0);_.$list.animate({height:targetHeight},_.options.speed)}};Slick.prototype.animateSlide=function(targetLeft,callback){var animProps={},_=this;_.animateHeight();if(_.options.rtl===!0&&_.options.vertical===!1){targetLeft=-targetLeft} +if(_.transformsEnabled===!1){if(_.options.vertical===!1){_.$slideTrack.animate({left:targetLeft},_.options.speed,_.options.easing,callback)}else{_.$slideTrack.animate({top:targetLeft},_.options.speed,_.options.easing,callback)}}else{if(_.cssTransitions===!1){if(_.options.rtl===!0){_.currentLeft=-(_.currentLeft)} +$({animStart:_.currentLeft}).animate({animStart:targetLeft},{duration:_.options.speed,easing:_.options.easing,step:function(now){now=Math.ceil(now);if(_.options.vertical===!1){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===!1){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,!0)}})}};Slick.prototype.applyTransition=function(slide){var _=this,transition={};if(_.options.fade===!1){transition[_.transitionType]=_.transformType+' '+_.options.speed+'ms '+_.options.cssEase}else{transition[_.transitionType]='opacity '+_.options.speed+'ms '+_.options.cssEase} +if(_.options.fade===!1){_.$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===!1){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===!0){_.$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!==!0){_.$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===!0){_.$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===!0||_.options.swipeToSlide===!0){_.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===!0){_.$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>1){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=!1;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===!1){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===!0){_.currentSlide=_.options.initialSlide} +_.refresh(initial)} +triggerBreakpoint=targetBreakpoint}}else{_.activeBreakpoint=targetBreakpoint;if(_.breakpointSettings[targetBreakpoint]==='unslick'){_.unslick(targetBreakpoint)}else{_.options=$.extend({},_.originalSettings,_.breakpointSettings[targetBreakpoint]);if(initial===!0){_.currentSlide=_.options.initialSlide} +_.refresh(initial)} +triggerBreakpoint=targetBreakpoint}}else{if(_.activeBreakpoint!==null){_.activeBreakpoint=null;_.options=_.originalSettings;if(initial===!0){_.currentSlide=_.options.initialSlide} +_.refresh(initial);triggerBreakpoint=targetBreakpoint}} +if(!initial&&triggerBreakpoint!==!1){_.$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,!1,dontAnimate)} +break;case 'next':slideOffset=indexOffset===0?_.options.slidesToScroll:indexOffset;if(_.slideCount>_.options.slidesToShow){_.slideHandler(_.currentSlide+slideOffset,!1,dontAnimate)} +break;case 'index':var index=event.data.index===0?0:event.data.index||$target.index()*_.options.slidesToScroll;_.slideHandler(_.checkNavigable(index),!1,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,_,!0)).off('mouseleave.slick',$.proxy(_.interrupt,_,!1));if(_.options.accessibility===!0){_.$dots.off('keydown.slick',_.keyHandler)}} +_.$slider.off('focus.slick blur.slick');if(_.options.arrows===!0&&_.slideCount>_.options.slidesToShow){_.$prevArrow&&_.$prevArrow.off('click.slick',_.changeSlide);_.$nextArrow&&_.$nextArrow.off('click.slick',_.changeSlide);if(_.options.accessibility===!0){_.$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===!0){_.$list.off('keydown.slick',_.keyHandler)} +if(_.options.focusOnSelect===!0){$(_.$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,_,!0));_.$list.off('mouseleave.slick',$.proxy(_.interrupt,_,!1))};Slick.prototype.cleanUpRows=function(){var _=this,originalSlides;if(_.options.rows>1){originalSlides=_.$slides.children().children();originalSlides.removeAttr('style');_.$slider.empty().append(originalSlides)}};Slick.prototype.clickHandler=function(event){var _=this;if(_.shouldClick===!1){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=!0;if(!refresh){_.$slider.trigger('destroy',[_])}};Slick.prototype.disableTransition=function(slide){var _=this,transition={};transition[_.transitionType]='';if(_.options.fade===!1){_.$slideTrack.css(transition)}else{_.$slides.eq(slide).css(transition)}};Slick.prototype.fadeSlide=function(slideIndex,callback){var _=this;if(_.cssTransitions===!1){_.$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===!1){_.$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===!0){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===!0){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(!0);if(_.options.infinite===!0){if(_.slideCount>_.options.slidesToShow){_.slideOffset=(_.slideWidth*_.options.slidesToShow)*-1;coef=-1 +if(_.options.vertical===!0&&_.options.centerMode===!0){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===!0&&_.slideCount<=_.options.slidesToShow){_.slideOffset=((_.slideWidth*Math.floor(_.options.slidesToShow))/2)-((_.slideWidth*_.slideCount)/2)}else if(_.options.centerMode===!0&&_.options.infinite===!0){_.slideOffset+=_.slideWidth*Math.floor(_.options.slidesToShow/2)-_.slideWidth}else if(_.options.centerMode===!0){_.slideOffset=0;_.slideOffset+=_.slideWidth*Math.floor(_.options.slidesToShow/2)} +if(_.options.vertical===!1){targetLeft=((slideIndex*_.slideWidth)*-1)+_.slideOffset}else{targetLeft=((slideIndex*verticalHeight)*-1)+verticalOffset} +if(_.options.variableWidth===!0){if(_.slideCount<=_.options.slidesToShow||_.options.infinite===!1){targetSlide=_.$slideTrack.children('.slick-slide').eq(slideIndex)}else{targetSlide=_.$slideTrack.children('.slick-slide').eq(slideIndex+_.options.slidesToShow)} +if(_.options.rtl===!0){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===!0){if(_.slideCount<=_.options.slidesToShow||_.options.infinite===!1){targetSlide=_.$slideTrack.children('.slick-slide').eq(slideIndex)}else{targetSlide=_.$slideTrack.children('.slick-slide').eq(slideIndex+_.options.slidesToShow+1)} +if(_.options.rtl===!0){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===!1){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===!0?_.slideWidth*Math.floor(_.options.slidesToShow/2):0;if(_.options.swipeToSlide===!0){_.$slideTrack.find('.slick-slide').each(function(index,slide){if(slide.offsetLeft-centerOffset+($(slide).outerWidth()/2)>(_.swipeLeft*-1)){swipedSlide=slide;return !1}});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(!0);_.focusHandler()} +if(creation){_.$slider.trigger('init',[_])} +if(_.options.accessibility===!0){_.initADA()} +if(_.options.autoplay){_.paused=!1;_.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){$(this).attr({'aria-describedby':'slick-slide-control'+_.instanceUid+slideControlIndex})}});_.$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++){_.$slides.eq(i).attr('tabindex',0)} +_.activateADA()};Slick.prototype.initArrowEvents=function(){var _=this;if(_.options.arrows===!0&&_.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===!0){_.$prevArrow.on('keydown.slick',_.keyHandler);_.$nextArrow.on('keydown.slick',_.keyHandler)}}};Slick.prototype.initDotEvents=function(){var _=this;if(_.options.dots===!0){$('li',_.$dots).on('click.slick',{message:'index'},_.changeSlide);if(_.options.accessibility===!0){_.$dots.on('keydown.slick',_.keyHandler)}} +if(_.options.dots===!0&&_.options.pauseOnDotsHover===!0){$('li',_.$dots).on('mouseenter.slick',$.proxy(_.interrupt,_,!0)).on('mouseleave.slick',$.proxy(_.interrupt,_,!1))}};Slick.prototype.initSlideEvents=function(){var _=this;if(_.options.pauseOnHover){_.$list.on('mouseenter.slick',$.proxy(_.interrupt,_,!0));_.$list.on('mouseleave.slick',$.proxy(_.interrupt,_,!1))}};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===!0){_.$list.on('keydown.slick',_.keyHandler)} +if(_.options.focusOnSelect===!0){$(_.$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===!0&&_.slideCount>_.options.slidesToShow){_.$prevArrow.show();_.$nextArrow.show()} +if(_.options.dots===!0&&_.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===!0){_.changeSlide({data:{message:_.options.rtl===!0?'next':'previous'}})}else if(event.keyCode===39&&_.options.accessibility===!0){_.changeSlide({data:{message:_.options.rtl===!0?'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===!0){if(_.options.infinite===!0){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===!0){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=!0};Slick.prototype.play=Slick.prototype.slickPlay=function(){var _=this;_.autoPlay();_.options.autoplay=!0;_.paused=!1;_.focussed=!1;_.interrupted=!1};Slick.prototype.postSlide=function(index){var _=this;if(!_.unslicked){_.$slider.trigger('afterChange',[_,index]);_.animating=!1;if(_.slideCount>_.options.slidesToShow){_.setPosition()} +_.swipeLeft=null;if(_.options.autoplay){_.autoPlay()} +if(_.options.accessibility===!0){_.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===!0){_.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(!0);$.extend(_,_.initials,{currentSlide:currentSlide});_.init();if(!initializing){_.changeSlide({data:{message:'index',index:currentSlide}},!1)}};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(!1,!0);if(_.options.focusOnSelect===!0){$(_.$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===!0?0:_.slideCount-1}else{index=removeBefore===!0?--index:index} +if(_.slideCount<1||index<0||index>_.slideCount-1){return !1} +_.unload();if(removeAll===!0){_.$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===!0){position=-position} +x=_.positionProp=='left'?Math.ceil(position)+'px':'0px';y=_.positionProp=='top'?Math.ceil(position)+'px':'0px';positionProps[_.positionProp]=position;if(_.transformsEnabled===!1){_.$slideTrack.css(positionProps)}else{positionProps={};if(_.cssTransitions===!1){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===!1){if(_.options.centerMode===!0){_.$list.css({padding:('0px '+_.options.centerPadding)})}}else{_.$list.height(_.$slides.first().outerHeight(!0)*_.options.slidesToShow);if(_.options.centerMode===!0){_.$list.css({padding:(_.options.centerPadding+' 0px')})}} +_.listWidth=_.$list.width();_.listHeight=_.$list.height();if(_.options.vertical===!1&&_.options.variableWidth===!1){_.slideWidth=Math.ceil(_.listWidth/_.options.slidesToShow);_.$slideTrack.width(Math.ceil((_.slideWidth*_.$slideTrack.children('.slick-slide').length)))}else if(_.options.variableWidth===!0){_.$slideTrack.width(5000*_.slideCount)}else{_.slideWidth=Math.ceil(_.listWidth);_.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(!0)*_.$slideTrack.children('.slick-slide').length)))} +var offset=_.$slides.first().outerWidth(!0)-_.$slides.first().width();if(_.options.variableWidth===!1)_.$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===!0){$(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===!0&&_.options.vertical===!1){var targetHeight=_.$slides.eq(_.currentSlide).outerHeight(!0);_.$list.css('height',targetHeight)}};Slick.prototype.setOption=Slick.prototype.slickSetOption=function(){var _=this,l,item,option,value,refresh=!1,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===!1){_.setCSS(_.getLeft(_.currentSlide))}else{_.setFade()} +_.$slider.trigger('setPosition',[_])};Slick.prototype.setProps=function(){var _=this,bodyStyle=document.body.style;_.positionProp=_.options.vertical===!0?'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===!0){_.cssTransitions=!0}} +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=!1} +if(bodyStyle.MozTransform!==undefined){_.animType='MozTransform';_.transformType='-moz-transform';_.transitionType='MozTransition';if(bodyStyle.perspectiveProperty===undefined&&bodyStyle.MozPerspective===undefined)_.animType=!1} +if(bodyStyle.webkitTransform!==undefined){_.animType='webkitTransform';_.transformType='-webkit-transform';_.transitionType='webkitTransition';if(bodyStyle.perspectiveProperty===undefined&&bodyStyle.webkitPerspective===undefined)_.animType=!1} +if(bodyStyle.msTransform!==undefined){_.animType='msTransform';_.transformType='-ms-transform';_.transitionType='msTransition';if(bodyStyle.msTransform===undefined)_.animType=!1} +if(bodyStyle.transform!==undefined&&_.animType!==!1){_.animType='transform';_.transformType='transform';_.transitionType='transition'} +_.transformsEnabled=_.options.useTransform&&(_.animType!==null&&_.animType!==!1)};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===!0){var evenCoef=_.options.slidesToShow%2===0?1:0;centerOffset=Math.floor(_.options.slidesToShow/2);if(_.options.infinite===!0){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===!0?_.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===!0){_.options.centerMode=!1} +if(_.options.infinite===!0&&_.options.fade===!1){slideIndex=null;if(_.slideCount>_.options.slidesToShow){if(_.options.centerMode===!0){infiniteCount=_.options.slidesToShow+1}else{infiniteCount=_.options.slidesToShow} +for(i=_.slideCount;i>(_.slideCount-infiniteCount);i-=1){slideIndex=i-1;$(_.$slides[slideIndex]).clone(!0).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(!0).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,!1,!0);return} +_.slideHandler(index)};Slick.prototype.slideHandler=function(index,sync,dontAnimate){var targetSlide,animSlide,oldSlide,slideLeft,targetLeft=null,_=this,navTarget;sync=sync||!1;if(_.animating===!0&&_.options.waitForAnimate===!0){return} +if(_.options.fade===!0&&_.currentSlide===index){return} +if(sync===!1){_.asNavFor(index)} +targetSlide=index;targetLeft=_.getLeft(targetSlide);slideLeft=_.getLeft(_.currentSlide);_.currentLeft=_.swipeLeft===null?slideLeft:_.swipeLeft;if(_.options.infinite===!1&&_.options.centerMode===!1&&(index<0||index>_.getDotCount()*_.options.slidesToScroll)){if(_.options.fade===!1){targetSlide=_.currentSlide;if(dontAnimate!==!0){_.animateSlide(slideLeft,function(){_.postSlide(targetSlide)})}else{_.postSlide(targetSlide)}} +return}else if(_.options.infinite===!1&&_.options.centerMode===!0&&(index<0||index>(_.slideCount-_.options.slidesToScroll))){if(_.options.fade===!1){targetSlide=_.currentSlide;if(dontAnimate!==!0){_.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=!0;_.$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===!0){if(dontAnimate!==!0){_.fadeSlideOut(oldSlide);_.fadeSlide(animSlide,function(){_.postSlide(animSlide)})}else{_.postSlide(animSlide)} +_.animateHeight();return} +if(dontAnimate!==!0){_.animateSlide(targetLeft,function(){_.postSlide(animSlide)})}else{_.postSlide(animSlide)}};Slick.prototype.startLoad=function(){var _=this;if(_.options.arrows===!0&&_.slideCount>_.options.slidesToShow){_.$prevArrow.hide();_.$nextArrow.hide()} +if(_.options.dots===!0&&_.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===!1?'left':'right')} +if((swipeAngle<=360)&&(swipeAngle>=315)){return(_.options.rtl===!1?'left':'right')} +if((swipeAngle>=135)&&(swipeAngle<=225)){return(_.options.rtl===!1?'right':'left')} +if(_.options.verticalSwiping===!0){if((swipeAngle>=35)&&(swipeAngle<=135)){return 'down'}else{return 'up'}} +return 'vertical'};Slick.prototype.swipeEnd=function(event){var _=this,slideCount,direction;_.dragging=!1;_.swiping=!1;if(_.scrolling){_.scrolling=!1;return !1} +_.interrupted=!1;_.shouldClick=(_.touchObject.swipeLength>10)?!1:!0;if(_.touchObject.curX===undefined){return !1} +if(_.touchObject.edgeHit===!0){_.$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===!1)||('ontouchend' in document&&_.options.swipe===!1)){return}else if(_.options.draggable===!1&&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===!0){_.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=!1,curLeft,swipeDirection,swipeLength,positionOffset,touches,verticalSwipeLength;touches=event.originalEvent!==undefined?event.originalEvent.touches:null;if(!_.dragging||_.scrolling||touches&&touches.length!==1){return !1} +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=!0;return !1} +if(_.options.verticalSwiping===!0){_.touchObject.swipeLength=verticalSwipeLength} +swipeDirection=_.swipeDirection();if(event.originalEvent!==undefined&&_.touchObject.swipeLength>4){_.swiping=!0;event.preventDefault()} +positionOffset=(_.options.rtl===!1?1:-1)*(_.touchObject.curX>_.touchObject.startX?1:-1);if(_.options.verticalSwiping===!0){positionOffset=_.touchObject.curY>_.touchObject.startY?1:-1} +swipeLength=_.touchObject.swipeLength;_.touchObject.edgeHit=!1;if(_.options.infinite===!1){if((_.currentSlide===0&&swipeDirection==='right')||(_.currentSlide>=_.getDotCount()&&swipeDirection==='left')){swipeLength=_.touchObject.swipeLength*_.options.edgeFriction;_.touchObject.edgeHit=!0}} +if(_.options.vertical===!1){_.swipeLeft=curLeft+swipeLength*positionOffset}else{_.swipeLeft=curLeft+(swipeLength*(_.$list.height()/_.listWidth))*positionOffset} +if(_.options.verticalSwiping===!0){_.swipeLeft=curLeft+swipeLength*positionOffset} +if(_.options.fade===!0||_.options.touchMove===!1){return !1} +if(_.animating===!0){_.swipeLeft=null;return !1} +_.setCSS(_.swipeLeft)};Slick.prototype.swipeStart=function(event){var _=this,touches;_.interrupted=!0;if(_.touchObject.fingerCount!==1||_.slideCount<=_.options.slidesToShow){_.touchObject={};return !1} +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=!0};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===!0&&_.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===!1){_.$nextArrow.addClass('slick-disabled').attr('aria-disabled','true');_.$prevArrow.removeClass('slick-disabled').attr('aria-disabled','false')}else if(_.currentSlide>=_.slideCount-1&&_.options.centerMode===!0){_.$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=!0}else{_.interrupted=!1}}};$.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(global){var apple_phone=/iPhone/i,apple_ipod=/iPod/i,apple_tablet=/iPad/i,android_phone=/(?=.*\bAndroid\b)(?=.*\bMobile\b)/i,android_tablet=/Android/i,amazon_phone=/(?=.*\bAndroid\b)(?=.*\bSD4930UR\b)/i,amazon_tablet=/(?=.*\bAndroid\b)(?=.*\b(?:KFOT|KFTT|KFJWI|KFJWA|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|KFARWI|KFASWI|KFSAWI|KFSAWA)\b)/i,windows_phone=/IEMobile/i,windows_tablet=/(?=.*\bWindows\b)(?=.*\bARM\b)/i,other_blackberry=/BlackBerry/i,other_blackberry_10=/BB10/i,other_opera=/Opera Mini/i,other_chrome=/(CriOS|Chrome)(?=.*\bMobile\b)/i,other_firefox=/(?=.*\bFirefox\b)(?=.*\bMobile\b)/i,seven_inch=new RegExp('(?:'+'Nexus 7'+'|'+'BNTV250'+'|'+'Kindle Fire'+'|'+'Silk'+'|'+'GT-P1000'+')','i');var match=function(regex,userAgent){return regex.test(userAgent)};var IsMobileClass=function(userAgent){var ua=userAgent||navigator.userAgent;var tmp=ua.split('[FBAN');if(typeof tmp[1]!=='undefined'){ua=tmp[0]} +this.apple={phone:match(apple_phone,ua),ipod:match(apple_ipod,ua),tablet:!match(apple_phone,ua)&&match(apple_tablet,ua),device:match(apple_phone,ua)||match(apple_ipod,ua)||match(apple_tablet,ua)};this.amazon={phone:match(amazon_phone,ua),tablet:!match(amazon_phone,ua)&&match(amazon_tablet,ua),device:match(amazon_phone,ua)||match(amazon_tablet,ua)};this.android={phone:match(amazon_phone,ua)||match(android_phone,ua),tablet:!match(amazon_phone,ua)&&!match(android_phone,ua)&&(match(amazon_tablet,ua)||match(android_tablet,ua)),device:match(amazon_phone,ua)||match(amazon_tablet,ua)||match(android_phone,ua)||match(android_tablet,ua)};this.windows={phone:match(windows_phone,ua),tablet:match(windows_tablet,ua),device:match(windows_phone,ua)||match(windows_tablet,ua)};this.other={blackberry:match(other_blackberry,ua),blackberry10:match(other_blackberry_10,ua),opera:match(other_opera,ua),firefox:match(other_firefox,ua),chrome:match(other_chrome,ua),device:match(other_blackberry,ua)||match(other_blackberry_10,ua)||match(other_opera,ua)||match(other_firefox,ua)||match(other_chrome,ua)};this.seven_inch=match(seven_inch,ua);this.any=this.apple.device||this.android.device||this.windows.device||this.other.device||this.seven_inch;this.phone=this.apple.phone||this.android.phone||this.windows.phone;this.tablet=this.apple.tablet||this.android.tablet||this.windows.tablet;if(typeof window==='undefined'){return this}};var instantiate=function(){var IM=new IsMobileClass();IM.Class=IsMobileClass;return IM};if(typeof module!='undefined'&&module.exports&&typeof window==='undefined'){module.exports=IsMobileClass}else if(typeof module!='undefined'&&module.exports&&typeof window!=='undefined'){module.exports=instantiate()}else if(typeof define==='function'&&define.amd){define('isMobile',[],global.isMobile=instantiate())}else{global.isMobile=instantiate()}})(this);(function(factory){if(typeof define==='function'&&define.amd){define('jqueryCookie',['jquery'],factory)}else if(typeof exports==='object'){factory(require('jquery'))}else{factory(jQuery)}}(function($){var pluses=/\+/g;function encode(s){return config.raw?s:encodeURIComponent(s)} +function decode(s){return config.raw?s:decodeURIComponent(s)} +function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value))} +function parseCookieValue(s){if(s.indexOf('"')===0){s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,'\\')} +try{s=decodeURIComponent(s.replace(pluses,' '));return config.json?JSON.parse(s):s}catch(e){}} +function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value} +var config=$.cookie=function(key,value,options){if(value!==undefined&&!$.isFunction(value)){options=$.extend({},config.defaults,options);if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setTime(+t+days*864e+5)} +return(document.cookie=[encode(key),'=',stringifyCookieValue(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''))} +var result=key?undefined:{};var cookies=document.cookie?document.cookie.split('; '):[];for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split('=');var name=decode(parts.shift());var cookie=parts.join('=');if(key&&key===name){result=read(cookie,value);break} +if(!key&&(cookie=read(cookie))!==undefined){result[name]=cookie}} +return result};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)===undefined){return !1} +$.cookie(key,'',$.extend({},options,{expires:-1}));return !$.cookie(key)}}));(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/ +};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,'gm')(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)('hr','\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))')('def','\\n+(?='+block.def.source+')')();block.blockquote=replace(block.blockquote)('def',block.def)();block._tag='(?!(?:'+'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'+'|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'+'|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b';block.html=replace(block.html)('comment',/<!--[\s\S]*?-->/)('closed',/<(tag)[\s\S]+?<\/\1>/)('closing',/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)('hr',block.hr)('heading',block.heading)('lheading',block.lheading)('blockquote',block.blockquote)('tag','<'+block._tag)('def',block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/ +});block.gfm.paragraph=replace(block.paragraph)('(?!','(?!'+block.gfm.fences.source.replace('\\1','\\2')+'|'+block.list.source.replace('\\1','\\3')+'|')();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ +});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}} +Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,'\n').replace(/\t/g,' ').replace(/\u00a0/g,' ').replace(/\u2424/g,'\n');return this.token(src,!0)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,''),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:'space'})}} +if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,'');this.tokens.push({type:'code',text:!this.options.pedantic?cap.replace(/\n+$/,''):cap});continue} +if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:'code',lang:cap[2],text:cap[3]||''});continue} +if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:'heading',depth:cap[1].length,text:cap[2]});continue} +if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:'table',header:cap[1].replace(/^ *| *\| *$/g,'').split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,'').split(/ *\| */),cells:cap[3].replace(/\n$/,'').split('\n')};for(i=0;i<item.align.length;i++){if(/^ *-+: *$/.test(item.align[i])){item.align[i]='right'}else if(/^ *:-+: *$/.test(item.align[i])){item.align[i]='center'}else if(/^ *:-+ *$/.test(item.align[i])){item.align[i]='left'}else{item.align[i]=null}} +for(i=0;i<item.cells.length;i++){item.cells[i]=item.cells[i].split(/ *\| */)} +this.tokens.push(item);continue} +if(cap=this.rules.lheading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:'heading',depth:cap[2]==='='?1:2,text:cap[1]});continue} +if(cap=this.rules.hr.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:'hr'});continue} +if(cap=this.rules.blockquote.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:'blockquote_start'});cap=cap[0].replace(/^ *> ?/gm,'');this.token(cap,top,!0);this.tokens.push({type:'blockquote_end'});continue} +if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:'list_start',ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=!1;l=cap.length;i=0;for(;i<l;i++){item=cap[i];space=item.length;item=item.replace(/^ *([*+-]|\d+\.) +/,'');if(~item.indexOf('\n ')){space-=item.length;item=!this.options.pedantic?item.replace(new RegExp('^ {1,'+space+'}','gm'),''):item.replace(/^ {1,4}/gm,'')} +if(this.options.smartLists&&i!==l-1){b=block.bullet.exec(cap[i+1])[0];if(bull!==b&&!(bull.length>1&&b.length>1)){src=cap.slice(i+1).join('\n')+src;i=l-1}} +loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==='\n';if(!loose)loose=next} +this.tokens.push({type:loose?'loose_item_start':'list_item_start'});this.token(item,!1,bq);this.tokens.push({type:'list_item_end'})} +this.tokens.push({type:'list_end'});continue} +if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?'paragraph':'html',pre:!this.options.sanitizer&&(cap[1]==='pre'||cap[1]==='script'||cap[1]==='style'),text:cap[0]});continue} +if((!bq&&top)&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue} +if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:'table',header:cap[1].replace(/^ *| *\| *$/g,'').split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,'').split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,'').split('\n')};for(i=0;i<item.align.length;i++){if(/^ *-+: *$/.test(item.align[i])){item.align[i]='right'}else if(/^ *:-+: *$/.test(item.align[i])){item.align[i]='center'}else if(/^ *:-+ *$/.test(item.align[i])){item.align[i]='left'}else{item.align[i]=null}} +for(i=0;i<item.cells.length;i++){item.cells[i]=item.cells[i].replace(/^ *\| *| *\| *$/g,'').split(/ *\| */)} +this.tokens.push(item);continue} +if(top&&(cap=this.rules.paragraph.exec(src))){src=src.substring(cap[0].length);this.tokens.push({type:'paragraph',text:cap[1].charAt(cap[1].length-1)==='\n'?cap[1].slice(0,-1):cap[1]});continue} +if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:'text',text:cap[0]});continue} +if(src){throw new Error('Infinite loop on byte: '+src.charCodeAt(0))}} +return this.tokens};var inline={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/ +};inline._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;inline._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)('inside',inline._inside)('href',inline._href)();inline.reflink=replace(inline.reflink)('inside',inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/ +});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)('])','~|])')(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)(']|','~]|')('|','|https?://|')()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)('{2,}','*')(),text:replace(inline.gfm.text)('{2,}','*')()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error('Tokens array requires a `links` property.')} +if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}} +InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out='',link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue} +if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==='@'){text=cap[1].charAt(6)===':'?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle('mailto:')+text}else{text=escape(cap[1]);href=text} +out+=this.renderer.link(href,null,text);continue} +if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue} +if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^<a /i.test(cap[0])){this.inLink=!0}else if(this.inLink&&/^<\/a>/i.test(cap[0])){this.inLink=!1} +src=src.substring(cap[0].length);out+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(cap[0]):escape(cap[0]):cap[0] +continue} +if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=!0;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=!1;continue} +if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g,' ');link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue} +this.inLink=!0;out+=this.outputLink(cap,link);this.inLink=!1;continue} +if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue} +if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue} +if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],!0));continue} +if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue} +if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue} +if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.text(escape(this.smartypants(cap[0])));continue} +if(src){throw new Error('Infinite loop on byte: '+src.charCodeAt(0))}} +return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=='!'?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/---/g,'\u2014').replace(/--/g,'\u2013').replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018') + // closing singles & apostrophes + .replace(/'/g, '\u2019') + // opening doubles + .replace(/(^|[-\u2014/(\[{\u2018\s])"/g,'$1\u201c').replace(/"/g,'\u201d').replace(/\.{3}/g,'\u2026')};InlineLexer.prototype.mangle=function(text){if(!this.options.mangle)return text;var out='',l=text.length,i=0,ch;for(;i<l;i++){ch=text.charCodeAt(i);if(Math.random()>0.5){ch='x'+ch.toString(16)} +out+='&#'+ch+';'} +return out};function Renderer(options){this.options=options||{}} +Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=!0;code=out}} +if(!lang){return '<pre><code>'+(escaped?code:escape(code,!0))+'\n</code></pre>'} +return '<pre><code class="'+this.options.langPrefix+escape(lang,!0)+'">'+(escaped?code:escape(code,!0))+'\n</code></pre>\n'};Renderer.prototype.blockquote=function(quote){return '<blockquote>\n'+quote+'</blockquote>\n'};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return '<h'+level+' id="'+this.options.headerPrefix+raw.toLowerCase().replace(/[^\w]+/g,'-')+'">'+text+'</h'+level+'>\n'};Renderer.prototype.hr=function(){return this.options.xhtml?'<hr/>\n':'<hr>\n'};Renderer.prototype.list=function(body,ordered){var type=ordered?'ol':'ul';return '<'+type+'>\n'+body+'</'+type+'>\n'};Renderer.prototype.listitem=function(text){return '<li>'+text+'</li>\n'};Renderer.prototype.paragraph=function(text){return '<p>'+text+'</p>\n'};Renderer.prototype.table=function(header,body){return '<table>\n'+'<thead>\n'+header+'</thead>\n'+'<tbody>\n'+body+'</tbody>\n'+'</table>\n'};Renderer.prototype.tablerow=function(content){return '<tr>\n'+content+'</tr>\n'};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?'th':'td';var tag=flags.align?'<'+type+' style="text-align:'+flags.align+'">':'<'+type+'>';return tag+content+'</'+type+'>\n'};Renderer.prototype.strong=function(text){return '<strong>'+text+'</strong>'};Renderer.prototype.em=function(text){return '<em>'+text+'</em>'};Renderer.prototype.codespan=function(text){return '<code>'+text+'</code>'};Renderer.prototype.br=function(){return this.options.xhtml?'<br/>':'<br>'};Renderer.prototype.del=function(text){return '<del>'+text+'</del>'};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,'').toLowerCase()}catch(e){return ''} +if(prot.indexOf('javascript:')===0||prot.indexOf('vbscript:')===0){return ''}} +var out='<a href="'+href+'"';if(title){out+=' title="'+title+'"'} +out+='>'+text+'</a>';return out};Renderer.prototype.image=function(href,title,text){var out='<img src="'+href+'" alt="'+text+'"';if(title){out+=' title="'+title+'"'} +out+=this.options.xhtml?'/>':'>';return out};Renderer.prototype.text=function(text){return text};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options} +Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out='';while(this.next()){out+=this.tok()} +return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==='text'){body+='\n'+this.next().text} +return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case 'space':{return ''} +case 'hr':{return this.renderer.hr()} +case 'heading':{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text)} +case 'code':{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped)} +case 'table':{var header='',body='',i,row,cell,flags,j;cell='';for(i=0;i<this.token.header.length;i++){flags={header:!0,align:this.token.align[i]};cell+=this.renderer.tablecell(this.inline.output(this.token.header[i]),{header:!0,align:this.token.align[i]})} +header+=this.renderer.tablerow(cell);for(i=0;i<this.token.cells.length;i++){row=this.token.cells[i];cell='';for(j=0;j<row.length;j++){cell+=this.renderer.tablecell(this.inline.output(row[j]),{header:!1,align:this.token.align[j]})} +body+=this.renderer.tablerow(cell)} +return this.renderer.table(header,body)} +case 'blockquote_start':{var body='';while(this.next().type!=='blockquote_end'){body+=this.tok()} +return this.renderer.blockquote(body)} +case 'list_start':{var body='',ordered=this.token.ordered;while(this.next().type!=='list_end'){body+=this.tok()} +return this.renderer.list(body,ordered)} +case 'list_item_start':{var body='';while(this.next().type!=='list_item_end'){body+=this.token.type==='text'?this.parseText():this.tok()} +return this.renderer.listitem(body)} +case 'loose_item_start':{var body='';while(this.next().type!=='list_item_end'){body+=this.tok()} +return this.renderer.listitem(body)} +case 'html':{var html=!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):this.token.text;return this.renderer.html(html)} +case 'paragraph':{return this.renderer.paragraph(this.inline.output(this.token.text))} +case 'text':{return this.renderer.paragraph(this.parseText())}}};function escape(html,encode){return html.replace(!encode?/&(?!#?\w+;)/g:/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''')} +function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==='colon')return ':';if(n.charAt(0)==='#'){return n.charAt(1)==='x'?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))} +return ''})} +function replace(regex,opt){regex=regex.source;opt=opt||'';return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,'$1');regex=regex.replace(name,val);return self}} +function noop(){} +noop.exec=noop;function merge(obj){var i=1,target,key;for(;i<arguments.length;i++){target=arguments[i];for(key in target){if(Object.prototype.hasOwnProperty.call(target,key)){obj[key]=target[key]}}} +return obj} +function marked(src,opt,callback){if(callback||typeof opt==='function'){if(!callback){callback=opt;opt=null} +opt=merge({},marked.defaults,opt||{});var highlight=opt.highlight,tokens,pending,i=0;try{tokens=Lexer.lex(src,opt)}catch(e){return callback(e)} +pending=tokens.length;var done=function(err){if(err){opt.highlight=highlight;return callback(err)} +var out;try{out=Parser.parse(tokens,opt)}catch(e){err=e} +opt.highlight=highlight;return err?callback(err):callback(null,out)};if(!highlight||highlight.length<3){return done()} +delete opt.highlight;if(!pending)return done();for(;i<tokens.length;i++){(function(token){if(token.type!=='code'){return --pending||done()} +return highlight(token.text,token.lang,function(err,code){if(err)return done(err);if(code==null||code===token.text){return --pending||done()} +token.text=code;token.escaped=!0;--pending||done()})})(tokens[i])} +return} +try{if(opt)opt=merge({},marked.defaults,opt);return Parser.parse(Lexer.lex(src,opt),opt)}catch(e){e.message+='\nPlease report this to https://github.com/chjj/marked.';if((opt||marked.defaults).silent){return '<p>An error occured:</p><pre>'+escape(e.message+'',!0)+'</pre>'} +throw e}} +marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:'lang-',smartypants:!1,headerPrefix:'',renderer:new Renderer,xhtml:!1};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=='undefined'&&typeof exports==='object'){module.exports=marked}else if(typeof define==='function'&&define.amd){define('marked',[],function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=='undefined'?window:global)}());(function(factory){if(typeof exports==='object'){module.exports=factory(require('jquery'))}else if(typeof define==='function'&&define.amd){define('jqueryKnob',['jquery'],factory)}else{factory(jQuery)}}(function($){"use strict";var k={},max=Math.max,min=Math.min;k.c={};k.c.d=$(document);k.c.t=function(e){return e.originalEvent.touches.length-1};k.o=function(){var s=this;this.o=null;this.$=null;this.i=null;this.g=null;this.v=null;this.cv=null;this.x=0;this.y=0;this.w=0;this.h=0;this.$c=null;this.c=null;this.t=0;this.isInit=!1;this.fgColor=null;this.pColor=null;this.dH=null;this.cH=null;this.eH=null;this.rH=null;this.scale=1;this.relative=!1;this.relativeWidth=!1;this.relativeHeight=!1;this.$div=null;this.run=function(){var cf=function(e,conf){var k;for(k in conf){s.o[k]=conf[k]} +s._carve().init();s._configure()._draw();};if(this.$.data('kontroled'))return;this.$.data('kontroled',!0);this.extend();this.o=$.extend({min:this.$.data('min')!==undefined?this.$.data('min'):0,max:this.$.data('max')!==undefined?this.$.data('max'):100,stopper:!0,readOnly:this.$.data('readonly')||(this.$.attr('readonly')==='readonly'),cursor:this.$.data('cursor')===!0&&30||this.$.data('cursor')||0,thickness:this.$.data('thickness')&&Math.max(Math.min(this.$.data('thickness'),1),0.01)||0.35,lineCap:this.$.data('linecap')||'butt',width:this.$.data('width')||200,height:this.$.data('height')||200,displayInput:this.$.data('displayinput')==null||this.$.data('displayinput'),displayPrevious:this.$.data('displayprevious'),fgColor:this.$.data('fgcolor')||'#87CEEB',inputColor:this.$.data('inputcolor'),font:this.$.data('font')||'Arial',fontWeight:this.$.data('font-weight')||'bold',inline:!1,step:this.$.data('step')||1,rotation:this.$.data('rotation'),draw:null,change:null,cancel:null,release:null,format:function(v){return v},parse:function(v){return parseFloat(v)}},this.o);this.o.flip=this.o.rotation==='anticlockwise'||this.o.rotation==='acw';if(!this.o.inputColor){this.o.inputColor=this.o.fgColor} +if(this.$.is('fieldset')){this.v={};this.i=this.$.find('input');this.i.each(function(k){var $this=$(this);s.i[k]=$this;s.v[k]=s.o.parse($this.val());$this.bind('change blur',function(){var val={};val[k]=$this.val();s.val(s._validate(val))})});this.$.find('legend').remove()}else{this.i=this.$;this.v=this.o.parse(this.$.val());this.v===''&&(this.v=this.o.min);this.$.bind('change blur',function(){s.val(s._validate(s.o.parse(s.$.val())))})} +!this.o.displayInput&&this.$.hide();this.$c=$(document.createElement('canvas')).attr({width:this.o.width,height:this.o.height});this.$div=$('<div style="'+(this.o.inline?'display:inline;':'')+'width:'+this.o.width+'px;height:'+this.o.height+'px;'+'"></div>');this.$.wrap(this.$div).before(this.$c);this.$div=this.$.parent();if(typeof G_vmlCanvasManager!=='undefined'){G_vmlCanvasManager.initElement(this.$c[0])} +this.c=this.$c[0].getContext?this.$c[0].getContext('2d'):null;if(!this.c){throw{name:"CanvasNotSupportedException",message:"Canvas not supported. Please use excanvas on IE8.0.",toString:function(){return this.name+": "+this.message}}} +this.scale=(window.devicePixelRatio||1)/(this.c.webkitBackingStorePixelRatio||this.c.mozBackingStorePixelRatio||this.c.msBackingStorePixelRatio||this.c.oBackingStorePixelRatio||this.c.backingStorePixelRatio||1);this.relativeWidth=this.o.width%1!==0&&this.o.width.indexOf('%');this.relativeHeight=this.o.height%1!==0&&this.o.height.indexOf('%');this.relative=this.relativeWidth||this.relativeHeight;this._carve();if(this.v instanceof Object){this.cv={};this.copy(this.v,this.cv)}else{this.cv=this.v} +this.$.bind("configure",cf).parent().bind("configure",cf);this._listen()._configure()._xy().init();this.isInit=!0;this.$.val(this.o.format(this.v));this._draw();return this};this._carve=function(){if(this.relative){var w=this.relativeWidth?this.$div.parent().width()*parseInt(this.o.width)/100:this.$div.parent().width(),h=this.relativeHeight?this.$div.parent().height()*parseInt(this.o.height)/100:this.$div.parent().height();this.w=this.h=Math.min(w,h)}else{this.w=this.o.width;this.h=this.o.height} +this.$div.css({'width':this.w+'px','height':this.h+'px'});this.$c.attr({width:this.w,height:this.h});if(this.scale!==1){this.$c[0].width=this.$c[0].width*this.scale;this.$c[0].height=this.$c[0].height*this.scale;this.$c.width(this.w);this.$c.height(this.h)} +return this};this._draw=function(){var d=!0;s.g=s.c;s.clear();s.dH&&(d=s.dH());d!==!1&&s.draw()};this._touch=function(e){var touchMove=function(e){var v=s.xy2val(e.originalEvent.touches[s.t].pageX,e.originalEvent.touches[s.t].pageY);if(v==s.cv)return;if(s.cH&&s.cH(v)===!1)return;s.change(s._validate(v));s._draw()};this.t=k.c.t(e);touchMove(e);k.c.d.bind("touchmove.k",touchMove).bind("touchend.k",function(){k.c.d.unbind('touchmove.k touchend.k');s.val(s.cv)});return this};this._mouse=function(e){var mouseMove=function(e){var v=s.xy2val(e.pageX,e.pageY);if(v==s.cv)return;if(s.cH&&(s.cH(v)===!1))return;s.change(s._validate(v));s._draw()};mouseMove(e);k.c.d.bind("mousemove.k",mouseMove).bind("keyup.k",function(e){if(e.keyCode===27){k.c.d.unbind("mouseup.k mousemove.k keyup.k");if(s.eH&&s.eH()===!1) +return;s.cancel()}}).bind("mouseup.k",function(e){k.c.d.unbind('mousemove.k mouseup.k keyup.k');s.val(s.cv)});return this};this._xy=function(){var o=this.$c.offset();this.x=o.left;this.y=o.top;return this};this._listen=function(){if(!this.o.readOnly){this.$c.bind("mousedown",function(e){e.preventDefault();s._xy()._mouse(e)}).bind("touchstart",function(e){e.preventDefault();s._xy()._touch(e)});this.listen()}else{this.$.attr('readonly','readonly')} +if(this.relative){$(window).resize(function(){s._carve().init();s._draw()})} +return this};this._configure=function(){if(this.o.draw)this.dH=this.o.draw;if(this.o.change)this.cH=this.o.change;if(this.o.cancel)this.eH=this.o.cancel;if(this.o.release)this.rH=this.o.release;if(this.o.displayPrevious){this.pColor=this.h2rgba(this.o.fgColor,"0.4");this.fgColor=this.h2rgba(this.o.fgColor,"0.6")}else{this.fgColor=this.o.fgColor} +return this};this._clear=function(){this.$c[0].width=this.$c[0].width};this._validate=function(v){var val=(~~(((v<0)?-0.5:0.5)+(v/this.o.step)))*this.o.step;return Math.round(val*100)/100};this.listen=function(){};this.extend=function(){};this.init=function(){};this.change=function(v){};this.val=function(v){};this.xy2val=function(x,y){};this.draw=function(){};this.clear=function(){this._clear()};this.h2rgba=function(h,a){var rgb;h=h.substring(1,7);rgb=[parseInt(h.substring(0,2),16),parseInt(h.substring(2,4),16),parseInt(h.substring(4,6),16)];return "rgba("+rgb[0]+","+rgb[1]+","+rgb[2]+","+a+")"};this.copy=function(f,t){for(var i in f){t[i]=f[i]}}};k.Dial=function(){k.o.call(this);this.startAngle=null;this.xy=null;this.radius=null;this.lineWidth=null;this.cursorExt=null;this.w2=null;this.PI2=2*Math.PI;this.extend=function(){this.o=$.extend({bgColor:this.$.data('bgcolor')||'#EEEEEE',angleOffset:this.$.data('angleoffset')||0,angleArc:this.$.data('anglearc')||360,inline:!0},this.o)};this.val=function(v,triggerRelease){if(null!=v){v=this.o.parse(v);if(triggerRelease!==!1&&v!=this.v&&this.rH&&this.rH(v)===!1){return} +this.cv=this.o.stopper?max(min(v,this.o.max),this.o.min):v;this.v=this.cv;this.$.val(this.o.format(this.v));this._draw()}else{return this.v}};this.xy2val=function(x,y){var a,ret;a=Math.atan2(x-(this.x+this.w2),-(y-this.y-this.w2))-this.angleOffset;if(this.o.flip){a=this.angleArc-a-this.PI2} +if(this.angleArc!=this.PI2&&(a<0)&&(a>-0.5)){a=0}else if(a<0){a+=this.PI2} +ret=(a*(this.o.max-this.o.min)/this.angleArc)+this.o.min;this.o.stopper&&(ret=max(min(ret,this.o.max),this.o.min));return ret};this.listen=function(){var s=this,mwTimerStop,mwTimerRelease,mw=function(e){e.preventDefault();var ori=e.originalEvent,deltaX=ori.detail||ori.wheelDeltaX,deltaY=ori.detail||ori.wheelDeltaY,v=s._validate(s.o.parse(s.$.val()))+(deltaX>0||deltaY>0?s.o.step:deltaX<0||deltaY<0?-s.o.step:0);v=max(min(v,s.o.max),s.o.min);s.val(v,!1);if(s.rH){clearTimeout(mwTimerStop);mwTimerStop=setTimeout(function(){s.rH(v);mwTimerStop=null},100);if(!mwTimerRelease){mwTimerRelease=setTimeout(function(){if(mwTimerStop) +s.rH(v);mwTimerRelease=null},200)}}},kval,to,m=1,kv={37:-s.o.step,38:s.o.step,39:s.o.step,40:-s.o.step};this.$.bind("keydown",function(e){var kc=e.keyCode;if(kc>=96&&kc<=105){kc=e.keyCode=kc-48} +kval=parseInt(String.fromCharCode(kc));if(isNaN(kval)){(kc!==13)&&kc!==8&&kc!==9&&kc!==189&&(kc!==190||s.$.val().match(/\./))&&e.preventDefault();if($.inArray(kc,[37,38,39,40])>-1){e.preventDefault();var v=s.o.parse(s.$.val())+kv[kc]*m;s.o.stopper&&(v=max(min(v,s.o.max),s.o.min));s.change(s._validate(v));s._draw();to=window.setTimeout(function(){m*=2},30)}}}).bind("keyup",function(e){if(isNaN(kval)){if(to){window.clearTimeout(to);to=null;m=1;s.val(s.$.val())}}else{(s.$.val()>s.o.max&&s.$.val(s.o.max))||(s.$.val()<s.o.min&&s.$.val(s.o.min))}});this.$c.bind("mousewheel DOMMouseScroll",mw);this.$.bind("mousewheel DOMMouseScroll",mw)};this.init=function(){if(this.v<this.o.min||this.v>this.o.max){this.v=this.o.min} +this.$.val(this.v);this.w2=this.w/2;this.cursorExt=this.o.cursor/100;this.xy=this.w2*this.scale;this.lineWidth=this.xy*this.o.thickness;this.lineCap=this.o.lineCap;this.radius=this.xy-this.lineWidth/2;this.o.angleOffset&&(this.o.angleOffset=isNaN(this.o.angleOffset)?0:this.o.angleOffset);this.o.angleArc&&(this.o.angleArc=isNaN(this.o.angleArc)?this.PI2:this.o.angleArc);this.angleOffset=this.o.angleOffset*Math.PI/180;this.angleArc=this.o.angleArc*Math.PI/180;this.startAngle=1.5*Math.PI+this.angleOffset;this.endAngle=1.5*Math.PI+this.angleOffset+this.angleArc;var s=max(String(Math.abs(this.o.max)).length,String(Math.abs(this.o.min)).length,2)+2;this.o.displayInput&&this.i.css({'width':((this.w/2+4)>>0)+'px','height':((this.w/3)>>0)+'px','position':'absolute','vertical-align':'middle','margin-top':((this.w/3)>>0)+'px','margin-left':'-'+((this.w*3/4+2)>>0)+'px','border':0,'background':'none','font':this.o.fontWeight+' '+((this.w/s)>>0)+'px '+this.o.font,'text-align':'center','color':this.o.inputColor||this.o.fgColor,'padding':'0px','-webkit-appearance':'none'})||this.i.css({'width':'0px','visibility':'hidden'})};this.change=function(v){this.cv=v;this.$.val(this.o.format(v))};this.angle=function(v){return(v-this.o.min)*this.angleArc/(this.o.max-this.o.min)};this.arc=function(v){var sa,ea;v=this.angle(v);if(this.o.flip){sa=this.endAngle+0.00001;ea=sa-v-0.00001}else{sa=this.startAngle-0.00001;ea=sa+v+0.00001} +this.o.cursor&&(sa=ea-this.cursorExt)&&(ea=ea+this.cursorExt);return{s:sa,e:ea,d:this.o.flip&&!this.o.cursor}};this.draw=function(){var c=this.g,a=this.arc(this.cv),pa,r=1;c.lineWidth=this.lineWidth;c.lineCap=this.lineCap;if(this.o.bgColor!=="none"){c.beginPath();c.strokeStyle=this.o.bgColor;c.arc(this.xy,this.xy,this.radius,this.endAngle-0.00001,this.startAngle+0.00001,!0);c.stroke()} +if(this.o.displayPrevious){pa=this.arc(this.v);c.beginPath();c.strokeStyle=this.pColor;c.arc(this.xy,this.xy,this.radius,pa.s,pa.e,pa.d);c.stroke();r=this.cv==this.v} +c.beginPath();c.strokeStyle=r?this.o.fgColor:this.fgColor;c.arc(this.xy,this.xy,this.radius,a.s,a.e,a.d);c.stroke()};this.cancel=function(){this.val(this.v)}};$.fn.dial=$.fn.knob=function(o){return this.each(function(){var d=new k.Dial();d.o=o;d.$=$(this);d.run()}).parent()}}));(function(factory){if(typeof define==="function"&&define.amd){define('jqueryui',["jquery"],factory)}else{factory(jQuery)}}(function($){$.ui=$.ui||{};var version=$.ui.version="1.12.1";var widgetUuid=0;var widgetSlice=Array.prototype.slice;$.cleanData=(function(orig){return function(elems){var events,elem,i;for(i=0;(elem=elems[i])!=null;i++){try{events=$._data(elem,"events");if(events&&events.remove){$(elem).triggerHandler("remove")}}catch(e){}} +orig(elems)}})($.cleanData);$.widget=function(name,base,prototype){var existingConstructor,constructor,basePrototype;var proxiedPrototype={};var namespace=name.split(".")[0];name=name.split(".")[1];var fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget} +if($.isArray(prototype)){prototype=$.extend.apply(null,[{}].concat(prototype))} +$.expr[":"][fullName.toLowerCase()]=function(elem){return !!$.data(elem,fullName)};$[namespace]=$[namespace]||{};existingConstructor=$[namespace][name];constructor=$[namespace][name]=function(options,element){if(!this._createWidget){return new constructor(options,element)} +if(arguments.length){this._createWidget(options,element)}};$.extend(constructor,existingConstructor,{version:prototype.version,_proto:$.extend({},prototype),_childConstructors:[]});basePrototype=new base();basePrototype.options=$.widget.extend({},basePrototype.options);$.each(prototype,function(prop,value){if(!$.isFunction(value)){proxiedPrototype[prop]=value;return} +proxiedPrototype[prop]=(function(){function _super(){return base.prototype[prop].apply(this,arguments)} +function _superApply(args){return base.prototype[prop].apply(this,args)} +return function(){var __super=this._super;var __superApply=this._superApply;var returnValue;this._super=_super;this._superApply=_superApply;returnValue=value.apply(this,arguments);this._super=__super;this._superApply=__superApply;return returnValue}})()});constructor.prototype=$.widget.extend(basePrototype,{widgetEventPrefix:existingConstructor?(basePrototype.widgetEventPrefix||name):name},proxiedPrototype,{constructor:constructor,namespace:namespace,widgetName:name,widgetFullName:fullName});if(existingConstructor){$.each(existingConstructor._childConstructors,function(i,child){var childPrototype=child.prototype;$.widget(childPrototype.namespace+"."+childPrototype.widgetName,constructor,child._proto)});delete existingConstructor._childConstructors}else{base._childConstructors.push(constructor)} +$.widget.bridge(name,constructor);return constructor};$.widget.extend=function(target){var input=widgetSlice.call(arguments,1);var inputIndex=0;var inputLength=input.length;var key;var value;for(;inputIndex<inputLength;inputIndex++){for(key in input[inputIndex]){value=input[inputIndex][key];if(input[inputIndex].hasOwnProperty(key)&&value!==undefined){if($.isPlainObject(value)){target[key]=$.isPlainObject(target[key])?$.widget.extend({},target[key],value):$.widget.extend({},value)}else{target[key]=value}}}} +return target};$.widget.bridge=function(name,object){var fullName=object.prototype.widgetFullName||name;$.fn[name]=function(options){var isMethodCall=typeof options==="string";var args=widgetSlice.call(arguments,1);var returnValue=this;if(isMethodCall){if(!this.length&&options==="instance"){returnValue=undefined}else{this.each(function(){var methodValue;var instance=$.data(this,fullName);if(options==="instance"){returnValue=instance;return !1} +if(!instance){return $.error("cannot call methods on "+name+" prior to initialization; "+"attempted to call method '"+options+"'")} +if(!$.isFunction(instance[options])||options.charAt(0)==="_"){return $.error("no such method '"+options+"' for "+name+" widget instance")} +methodValue=instance[options].apply(instance,args);if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue&&methodValue.jquery?returnValue.pushStack(methodValue.get()):methodValue;return !1}})}}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:!1,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(!0,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:!0}))}},_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:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(options){var full=[];var that=this;options=$.extend({element:this.element,classes:this.options.classes||{}},options);function processClassString(classes,checkOption){var current,i;for(i=0;i<classes.length;i++){current=that.classesElementLookup[classes[i]]||$();if(options.add){current=$($.unique(current.get().concat(options.element.get())))}else{current=$(current.not(options.element).get())} +that.classesElementLookup[classes[i]]=current;full.push(classes[i]);if(checkOption&&options.classes[classes[i]]){full.push(options.classes[classes[i]])}}} +this._on(options.element,{"remove":"_untrackClassesElement"});if(options.keys){processClassString(options.keys.match(/\S+/g)||[],!0)} +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())}})},_removeClass:function(element,keys,extra){return this._toggleClass(element,keys,extra,!1)},_addClass:function(element,keys,extra){return this._toggleClass(element,keys,extra,!0)},_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=!1} +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===!0||$(this).hasClass("ui-state-disabled"))){return} +return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)} +if(typeof handler!=="string"){handlerProxy.guid=handler.guid=handler.guid||handlerProxy.guid||$.guid++} +var match=event.match(/^([\w:-]*)\s*(.*)$/);var eventName=match[1]+instance.eventNamespace;var selector=match[2];if(selector){delegateElement.on(eventName,selector,handlerProxy)}else{element.on(eventName,handlerProxy)}})},_off:function(element,eventName){eventName=(eventName||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;element.off(eventName).off(eventName);this.bindings=$(this.bindings.not(element).get());this.focusable=$(this.focusable.not(element).get());this.hoverable=$(this.hoverable.not(element).get())},_delay:function(handler,delay){function handlerProxy(){return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)} +var instance=this;return setTimeout(handlerProxy,delay||0)},_hoverable:function(element){this.hoverable=this.hoverable.add(element);this._on(element,{mouseenter:function(event){this._addClass($(event.currentTarget),null,"ui-state-hover")},mouseleave:function(event){this._removeClass($(event.currentTarget),null,"ui-state-hover")}})},_focusable:function(element){this.focusable=this.focusable.add(element);this._on(element,{focusin:function(event){this._addClass($(event.currentTarget),null,"ui-state-focus")},focusout:function(event){this._removeClass($(event.currentTarget),null,"ui-state-focus")}})},_trigger:function(type,event,data){var prop,orig;var callback=this.options[type];data=data||{};event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();event.target=this.element[0];orig=event.originalEvent;if(orig){for(prop in orig){if(!(prop in event)){event[prop]=orig[prop]}}} +this.element.trigger(event,data);return !($.isFunction(callback)&&callback.apply(this.element[0],[event].concat(data))===!1||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===!0||typeof options==="number"?defaultEffect:options.effect||defaultEffect;options=options||{};if(typeof options==="number"){options={duration:options}} +hasOptions=!$.isEmptyObject(options);options.complete=callback;if(options.delay){element.delay(options.delay)} +if(hasOptions&&$.effects&&$.effects.effect[effectName]){element[method](options)}else if(effectName!==method&&element[effectName]){element[effectName](options.duration,options.easing,callback)}else{element.queue(function(next){$(this)[method]();if(callback){callback.call(element[0])} +next()})}}});var widget=$.widget;(function(){var cachedScrollbarWidth,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 getDimensions(elem){var raw=elem[0];if(raw.nodeType===9){return{width:elem.width(),height:elem.height(),offset:{top:0,left:0}}} +if($.isWindow(raw)){return{width:elem.width(),height:elem.height(),offset:{top:elem.scrollTop(),left:elem.scrollLeft()}}} +if(raw.preventDefault){return{width:0,height:0,offset:{top:raw.pageY,left:raw.pageX}}} +return{width:elem.outerWidth(),height:elem.outerHeight(),offset:elem.offset()}} +$.position={scrollbarWidth:function(){if(cachedScrollbarWidth!==undefined){return cachedScrollbarWidth} +var w1,w2,div=$("<div "+"style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>"+"<div style='height:100px;width:auto;'></div></div>"),innerDiv=div.children()[0];$("body").append(div);w1=innerDiv.offsetWidth;div.css("overflow","scroll");w2=innerDiv.offsetWidth;if(w1===w2){w2=div[0].clientWidth} +div.remove();return(cachedScrollbarWidth=w1-w2)},getScrollInfo:function(within){var overflowX=within.isWindow||within.isDocument?"":within.element.css("overflow-x"),overflowY=within.isWindow||within.isDocument?"":within.element.css("overflow-y"),hasOverflowX=overflowX==="scroll"||(overflowX==="auto"&&within.width<within.element[0].scrollWidth),hasOverflowY=overflowY==="scroll"||(overflowY==="auto"&&within.height<within.element[0].scrollHeight);return{width:hasOverflowY?$.position.scrollbarWidth():0,height:hasOverflowX?$.position.scrollbarWidth():0}},getWithinInfo:function(element){var withinElement=$(element||window),isWindow=$.isWindow(withinElement[0]),isDocument=!!withinElement[0]&&withinElement[0].nodeType===9,hasOffset=!isWindow&&!isDocument;return{element:withinElement,isWindow:isWindow,isDocument:isDocument,offset:hasOffset?$(element).offset():{left:0,top:0},scrollLeft:withinElement.scrollLeft(),scrollTop:withinElement.scrollTop(),width:withinElement.outerWidth(),height:withinElement.outerHeight()}}};$.fn.position=function(options){if(!options||!options.of){return _position.apply(this,arguments)} +options=$.extend({},options);var atOffset,targetWidth,targetHeight,targetOffset,basePosition,dimensions,target=$(options.of),within=$.position.getWithinInfo(options.within),scrollInfo=$.position.getScrollInfo(within),collision=(options.collision||"flip").split(" "),offsets={};dimensions=getDimensions(target);if(target[0].preventDefault){options.at="left top"} +targetWidth=dimensions.width;targetHeight=dimensions.height;targetOffset=dimensions.offset;basePosition=$.extend({},targetOffset);$.each(["my","at"],function(){var pos=(options[this]||"").split(" "),horizontalOffset,verticalOffset;if(pos.length===1){pos=rhorizontal.test(pos[0])?pos.concat(["center"]):rvertical.test(pos[0])?["center"].concat(pos):["center","center"]} +pos[0]=rhorizontal.test(pos[0])?pos[0]:"center";pos[1]=rvertical.test(pos[1])?pos[1]:"center";horizontalOffset=roffset.exec(pos[0]);verticalOffset=roffset.exec(pos[1]);offsets[this]=[horizontalOffset?horizontalOffset[0]:0,verticalOffset?verticalOffset[0]:0];options[this]=[rposition.exec(pos[0])[0],rposition.exec(pos[1])[0]]});if(collision.length===1){collision[1]=collision[0]} +if(options.at[0]==="right"){basePosition.left+=targetWidth}else if(options.at[0]==="center"){basePosition.left+=targetWidth/2} +if(options.at[1]==="bottom"){basePosition.top+=targetHeight}else if(options.at[1]==="center"){basePosition.top+=targetHeight/2} +atOffset=getOffsets(offsets.at,targetWidth,targetHeight);basePosition.left+=atOffset[0];basePosition.top+=atOffset[1];return this.each(function(){var collisionPosition,using,elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseCss(this,"marginLeft"),marginTop=parseCss(this,"marginTop"),collisionWidth=elemWidth+marginLeft+parseCss(this,"marginRight")+scrollInfo.width,collisionHeight=elemHeight+marginTop+parseCss(this,"marginBottom")+scrollInfo.height,position=$.extend({},basePosition),myOffset=getOffsets(offsets.my,elem.outerWidth(),elem.outerHeight());if(options.my[0]==="right"){position.left-=elemWidth}else if(options.my[0]==="center"){position.left-=elemWidth/2} +if(options.my[1]==="bottom"){position.top-=elemHeight}else if(options.my[1]==="center"){position.top-=elemHeight/2} +position.left+=myOffset[0];position.top+=myOffset[1];collisionPosition={marginLeft:marginLeft,marginTop:marginTop};$.each(["left","top"],function(i,dir){if($.ui.position[collision[i]]){$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,collisionPosition:collisionPosition,collisionWidth:collisionWidth,collisionHeight:collisionHeight,offset:[atOffset[0]+myOffset[0],atOffset[1]+myOffset[1]],my:options.my,at:options.at,within:within,elem:elem})}});if(options.using){using=function(props){var left=targetOffset.left-position.left,right=left+targetWidth-elemWidth,top=targetOffset.top-position.top,bottom=top+targetHeight-elemHeight,feedback={target:{element:target,left:targetOffset.left,top:targetOffset.top,width:targetWidth,height:targetHeight},element:{element:elem,left:position.left,top:position.top,width:elemWidth,height:elemHeight},horizontal:right<0?"left":left>0?"right":"center",vertical:bottom<0?"top":top>0?"bottom":"middle"};if(targetWidth<elemWidth&&abs(left+right)<targetWidth){feedback.horizontal="center"} +if(targetHeight<elemHeight&&abs(top+bottom)<targetHeight){feedback.vertical="middle"} +if(max(abs(left),abs(right))>max(abs(top),abs(bottom))){feedback.important="horizontal"}else{feedback.important="vertical"} +options.using.call(this,props,feedback)}} +elem.offset($.extend(position,{using:using}))})};$.ui.position={fit:{left:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollLeft:within.offset.left,outerWidth=within.width,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=withinOffset-collisionPosLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-withinOffset,newOverRight;if(data.collisionWidth>outerWidth){if(overLeft>0&&overRight<=0){newOverRight=position.left+overLeft+data.collisionWidth-outerWidth-withinOffset;position.left+=overLeft-newOverRight}else if(overRight>0&&overLeft<=0){position.left=withinOffset}else{if(overLeft>overRight){position.left=withinOffset+outerWidth-data.collisionWidth}else{position.left=withinOffset}}}else if(overLeft>0){position.left+=overLeft}else if(overRight>0){position.left-=overRight}else{position.left=max(position.left-collisionPosLeft,position.left)}},top:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollTop:within.offset.top,outerHeight=data.within.height,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=withinOffset-collisionPosTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-withinOffset,newOverBottom;if(data.collisionHeight>outerHeight){if(overTop>0&&overBottom<=0){newOverBottom=position.top+overTop+data.collisionHeight-outerHeight-withinOffset;position.top+=overTop-newOverBottom}else if(overBottom>0&&overTop<=0){position.top=withinOffset}else{if(overTop>overBottom){position.top=withinOffset+outerHeight-data.collisionHeight}else{position.top=withinOffset}}}else if(overTop>0){position.top+=overTop}else if(overBottom>0){position.top-=overBottom}else{position.top=max(position.top-collisionPosTop,position.top)}}},flip:{left:function(position,data){var within=data.within,withinOffset=within.offset.left+within.scrollLeft,outerWidth=within.width,offsetLeft=within.isWindow?within.scrollLeft:within.offset.left,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=collisionPosLeft-offsetLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-offsetLeft,myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:data.at[0]==="right"?-data.targetWidth:0,offset=-2*data.offset[0],newOverRight,newOverLeft;if(overLeft<0){newOverRight=position.left+myOffset+atOffset+offset+data.collisionWidth-outerWidth-withinOffset;if(newOverRight<0||newOverRight<abs(overLeft)){position.left+=myOffset+atOffset+offset}}else if(overRight>0){newOverLeft=position.left-data.collisionPosition.marginLeft+myOffset+atOffset+offset-offsetLeft;if(newOverLeft>0||abs(newOverLeft)<overRight){position.left+=myOffset+atOffset+offset}}},top:function(position,data){var within=data.within,withinOffset=within.offset.top+within.scrollTop,outerHeight=within.height,offsetTop=within.isWindow?within.scrollTop:within.offset.top,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=collisionPosTop-offsetTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-offsetTop,top=data.my[1]==="top",myOffset=top?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:data.at[1]==="bottom"?-data.targetHeight:0,offset=-2*data.offset[1],newOverTop,newOverBottom;if(overTop<0){newOverBottom=position.top+myOffset+atOffset+offset+data.collisionHeight-outerHeight-withinOffset;if(newOverBottom<0||newOverBottom<abs(overTop)){position.top+=myOffset+atOffset+offset}}else if(overBottom>0){newOverTop=position.top-data.collisionPosition.marginTop+myOffset+atOffset+offset-offsetTop;if(newOverTop>0||abs(newOverTop)<overBottom){position.top+=myOffset+atOffset+offset}}}},flipfit:{left:function(){$.ui.position.flip.left.apply(this,arguments);$.ui.position.fit.left.apply(this,arguments)},top:function(){$.ui.position.flip.top.apply(this,arguments);$.ui.position.fit.top.apply(this,arguments)}}}})();var position=$.ui.position;var data=$.extend($.expr[":"],{data:$.expr.createPseudo?$.expr.createPseudo(function(dataName){return function(elem){return !!$.data(elem,dataName)}}):function(elem,i,match){return !!$.data(elem,match[3])}});var disableSelection=$.fn.extend({disableSelection:(function(){var eventType="onselectstart" in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(eventType+".ui-disableSelection",function(event){event.preventDefault()})}})(),enableSelection:function(){return this.off(".ui-disableSelection")}});var dataSpace="ui-effects-",dataSpaceStyle="ui-effects-style",dataSpaceAnimated="ui-effects-animated",jQuery=$;$.effects={effect:{}};(function(jQuery,undefined){var stepHooks="backgroundColor borderBottomColor borderLeftColor borderRightColor "+"borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",rplusequals=/^([\-+])=\s*(\d+\.?\d*)/,stringParsers=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(execResult){return[execResult[1],execResult[2],execResult[3],execResult[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(execResult){return[execResult[1]*2.55,execResult[2]*2.55,execResult[3]*2.55,execResult[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(execResult){return[parseInt(execResult[1],16),parseInt(execResult[2],16),parseInt(execResult[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(execResult){return[parseInt(execResult[1]+execResult[1],16),parseInt(execResult[2]+execResult[2],16),parseInt(execResult[3]+execResult[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(execResult){return[execResult[1],execResult[2]/100,execResult[3]/100,execResult[4]]}}],color=jQuery.Color=function(color,green,blue,alpha){return new jQuery.Color.fn.parse(color,green,blue,alpha)},spaces={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},propTypes={"byte":{floor:!0,max:255},"percent":{max:1},"degrees":{mod:360,floor:!0}},support=color.support={},supportElem=jQuery("<p>")[0],colors,each=jQuery.each;supportElem.style.cssText="background-color:rgba(1,1,1,.5)";support.rgba=supportElem.style.backgroundColor.indexOf("rgba")>-1;each(spaces,function(spaceName,space){space.cache="_"+spaceName;space.props.alpha={idx:3,type:"percent",def:1}});function clamp(value,prop,allowEmpty){var type=propTypes[prop.type]||{};if(value==null){return(allowEmpty||!prop.def)?null:prop.def} +value=type.floor?~~value:parseFloat(value);if(isNaN(value)){return prop.def} +if(type.mod){return(value+type.mod)%type.mod} +return 0>value?0:type.max<value?type.max:value} +function stringParse(string){var inst=color(),rgba=inst._rgba=[];string=string.toLowerCase();each(stringParsers,function(i,parser){var parsed,match=parser.re.exec(string),values=match&&parser.parse(match),spaceName=parser.space||"rgba";if(values){parsed=inst[spaceName](values);inst[spaces[spaceName].cache]=parsed[spaces[spaceName].cache];rgba=inst._rgba=parsed._rgba;return !1}});if(rgba.length){if(rgba.join()==="0,0,0,0"){jQuery.extend(rgba,colors.transparent)} +return inst} +return colors[string]} +color.fn=jQuery.extend(color.prototype,{parse:function(red,green,blue,alpha){if(red===undefined){this._rgba=[null,null,null,null];return this} +if(red.jquery||red.nodeType){red=jQuery(red).css(green);green=undefined} +var inst=this,type=jQuery.type(red),rgba=this._rgba=[];if(green!==undefined){red=[red,green,blue,alpha];type="array"} +if(type==="string"){return this.parse(stringParse(red)||colors._default)} +if(type==="array"){each(spaces.rgba.props,function(key,prop){rgba[prop.idx]=clamp(red[prop.idx],prop)});return this} +if(type==="object"){if(red instanceof color){each(spaces,function(spaceName,space){if(red[space.cache]){inst[space.cache]=red[space.cache].slice()}})}else{each(spaces,function(spaceName,space){var cache=space.cache;each(space.props,function(key,prop){if(!inst[cache]&&space.to){if(key==="alpha"||red[key]==null){return} +inst[cache]=space.to(inst._rgba)} +inst[cache][prop.idx]=clamp(red[key],prop,!0)});if(inst[cache]&&jQuery.inArray(null,inst[cache].slice(0,3))<0){inst[cache][3]=1;if(space.from){inst._rgba=space.from(inst[cache])}}})} +return this}},is:function(compare){var is=color(compare),same=!0,inst=this;each(spaces,function(_,space){var localCache,isCache=is[space.cache];if(isCache){localCache=inst[space.cache]||space.to&&space.to(inst._rgba)||[];each(space.props,function(_,prop){if(isCache[prop.idx]!=null){same=(isCache[prop.idx]===localCache[prop.idx]);return same}})} +return same});return same},_space:function(){var used=[],inst=this;each(spaces,function(spaceName,space){if(inst[space.cache]){used.push(spaceName)}});return used.pop()},transition:function(other,distance){var end=color(other),spaceName=end._space(),space=spaces[spaceName],startColor=this.alpha()===0?color("transparent"):this,start=startColor[space.cache]||space.to(startColor._rgba),result=start.slice();end=end[space.cache];each(space.props,function(key,prop){var index=prop.idx,startValue=start[index],endValue=end[index],type=propTypes[prop.type]||{};if(endValue===null){return} +if(startValue===null){result[index]=endValue}else{if(type.mod){if(endValue-startValue>type.mod/2){startValue+=type.mod}else if(startValue-endValue>type.mod/2){startValue-=type.mod}} +result[index]=clamp((endValue-startValue)*distance+startValue,prop)}});return this[spaceName](result)},blend:function(opaque){if(this._rgba[3]===1){return this} +var rgb=this._rgba.slice(),a=rgb.pop(),blend=color(opaque)._rgba;return color(jQuery.map(rgb,function(v,i){return(1-a)*blend[i]+a*v}))},toRgbaString:function(){var prefix="rgba(",rgba=jQuery.map(this._rgba,function(v,i){return v==null?(i>2?1:0):v});if(rgba[3]===1){rgba.pop();prefix="rgb("} +return prefix+rgba.join()+")"},toHslaString:function(){var prefix="hsla(",hsla=jQuery.map(this.hsla(),function(v,i){if(v==null){v=i>2?1:0} +if(i&&i<3){v=Math.round(v*100)+"%"} +return v});if(hsla[3]===1){hsla.pop();prefix="hsl("} +return prefix+hsla.join()+")"},toHexString:function(includeAlpha){var rgba=this._rgba.slice(),alpha=rgba.pop();if(includeAlpha){rgba.push(~~(alpha*255))} +return "#"+jQuery.map(rgba,function(v){v=(v||0).toString(16);return v.length===1?"0"+v:v}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}});color.fn.parse.prototype=color.fn;function hue2rgb(p,q,h){h=(h+1)%1;if(h*6<1){return p+(q-p)*h*6} +if(h*2<1){return q} +if(h*3<2){return p+(q-p)*((2/3)-h)*6} +return p} +spaces.hsla.to=function(rgba){if(rgba[0]==null||rgba[1]==null||rgba[2]==null){return[null,null,null,rgba[3]]} +var r=rgba[0]/255,g=rgba[1]/255,b=rgba[2]/255,a=rgba[3],max=Math.max(r,g,b),min=Math.min(r,g,b),diff=max-min,add=max+min,l=add*0.5,h,s;if(min===max){h=0}else if(r===max){h=(60*(g-b)/diff)+360}else if(g===max){h=(60*(b-r)/diff)+120}else{h=(60*(r-g)/diff)+240} +if(diff===0){s=0}else if(l<=0.5){s=diff/add}else{s=diff/(2-add)} +return[Math.round(h)%360,s,l,a==null?1:a]};spaces.hsla.from=function(hsla){if(hsla[0]==null||hsla[1]==null||hsla[2]==null){return[null,null,null,hsla[3]]} +var h=hsla[0]/360,s=hsla[1],l=hsla[2],a=hsla[3],q=l<=0.5?l*(1+s):l+s-l*s,p=2*l-q;return[Math.round(hue2rgb(p,q,h+(1/3))*255),Math.round(hue2rgb(p,q,h)*255),Math.round(hue2rgb(p,q,h-(1/3))*255),a]};each(spaces,function(spaceName,space){var props=space.props,cache=space.cache,to=space.to,from=space.from;color.fn[spaceName]=function(value){if(to&&!this[cache]){this[cache]=to(this._rgba)} +if(value===undefined){return this[cache].slice()} +var ret,type=jQuery.type(value),arr=(type==="array"||type==="object")?value:arguments,local=this[cache].slice();each(props,function(key,prop){var val=arr[type==="object"?key:prop.idx];if(val==null){val=local[prop.idx]} +local[prop.idx]=clamp(val,prop)});if(from){ret=color(from(local));ret[cache]=local;return ret}else{return color(local)}};each(props,function(key,prop){if(color.fn[key]){return} +color.fn[key]=function(value){var vtype=jQuery.type(value),fn=(key==="alpha"?(this._hsla?"hsla":"rgba"):spaceName),local=this[fn](),cur=local[prop.idx],match;if(vtype==="undefined"){return cur} +if(vtype==="function"){value=value.call(this,cur);vtype=jQuery.type(value)} +if(value==null&&prop.empty){return this} +if(vtype==="string"){match=rplusequals.exec(value);if(match){value=cur+parseFloat(match[2])*(match[1]==="+"?1:-1)}} +local[prop.idx]=value;return this[fn](local)}})});color.hook=function(hook){var hooks=hook.split(" ");each(hooks,function(i,hook){jQuery.cssHooks[hook]={set:function(elem,value){var parsed,curElem,backgroundColor="";if(value!=="transparent"&&(jQuery.type(value)!=="string"||(parsed=stringParse(value)))){value=color(parsed||value);if(!support.rgba&&value._rgba[3]!==1){curElem=hook==="backgroundColor"?elem.parentNode:elem;while((backgroundColor===""||backgroundColor==="transparent")&&curElem&&curElem.style){try{backgroundColor=jQuery.css(curElem,"backgroundColor");curElem=curElem.parentNode}catch(e){}} +value=value.blend(backgroundColor&&backgroundColor!=="transparent"?backgroundColor:"_default")} +value=value.toRgbaString()} +try{elem.style[hook]=value}catch(e){}}};jQuery.fx.step[hook]=function(fx){if(!fx.colorInit){fx.start=color(fx.elem,hook);fx.end=color(fx.end);fx.colorInit=!0} +jQuery.cssHooks[hook].set(fx.elem,fx.start.transition(fx.end,fx.pos))}})};color.hook(stepHooks);jQuery.cssHooks.borderColor={expand:function(value){var expanded={};each(["Top","Right","Bottom","Left"],function(i,part){expanded["border"+part+"Color"]=value});return expanded}};colors=jQuery.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}})(jQuery);(function(){var classAnimationActions=["add","remove","toggle"],shorthandStyles={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};$.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(_,prop){$.fx.step[prop]=function(fx){if(fx.end!=="none"&&!fx.setAttr||fx.pos===1&&!fx.setAttr){jQuery.style(fx.elem,prop,fx.end);fx.setAttr=!0}}});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:!1,complete:function(){dfd.resolve(styleInfo)}});this.el.animate(this.diff,opts);return dfd.promise()});$.when.apply($,allAnimations.get()).done(function(){applyClassChange();$.each(arguments,function(){var el=this.el;$.each(this.diff,function(key){el.css(key,"")})});o.complete.call(animated[0])})})};$.fn.extend({addClass:(function(orig){return function(classNames,speed,easing,callback){return speed?$.effects.animateClass.call(this,{add:classNames},speed,easing,callback):orig.apply(this,arguments)}})($.fn.addClass),removeClass:(function(orig){return function(classNames,speed,easing,callback){return arguments.length>1?$.effects.animateClass.call(this,{remove:classNames},speed,easing,callback):orig.apply(this,arguments)}})($.fn.removeClass),toggleClass:(function(orig){return function(classNames,force,speed,easing,callback){if(typeof force==="boolean"||force===undefined){if(!speed){return orig.apply(this,arguments)}else{return $.effects.animateClass.call(this,(force?{add:classNames}:{remove:classNames}),speed,easing,callback)}}else{return $.effects.animateClass.call(this,{toggle:classNames},force,speed,easing)}}})($.fn.toggleClass),switchClass:function(remove,add,speed,easing,callback){return $.effects.animateClass.call(this,{add:add,remove:remove},speed,easing,callback)}})})();(function(){if($.expr&&$.expr.filters&&$.expr.filters.animated){$.expr.filters.animated=(function(orig){return function(elem){return !!$(elem).data(dataSpaceAnimated)||orig(elem)}})($.expr.filters.animated)} +if($.uiBackCompat!==!1){$.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(!0),height:element.outerHeight(!0),"float":element.css("float")},wrapper=$("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),size={width:element.width(),height:element.height()},active=document.activeElement;try{active.id}catch(e){active=document.body} +element.wrap(wrapper);if(element[0]===active||$.contains(element[0],active)){$(active).trigger("focus")} +wrapper=element.parent();if(element.css("position")==="static"){wrapper.css({position:"relative"});element.css({position:"relative"})}else{$.extend(props,{position:element.css("position"),zIndex:element.css("z-index")});$.each(["top","left","bottom","right"],function(i,pos){props[pos]=element.css(pos);if(isNaN(parseInt(props[pos],10))){props[pos]="auto"}});element.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})} +element.css(size);return wrapper.css(props).show()},removeWrapper:function(element){var active=document.activeElement;if(element.parent().is(".ui-effects-wrapper")){element.parent().replaceWith(element);if(element[0]===active||$.contains(element[0],active)){$(active).trigger("focus")}} +return element}})} +$.extend($.effects,{version:"1.12.1",define:function(name,mode,effect){if(!effect){effect=mode;mode="effect"} +$.effects.effect[name]=effect;$.effects.effect[name].mode=mode;return effect},scaledDimensions:function(element,percent,direction){if(percent===0){return{height:0,width:0,outerHeight:0,outerWidth:0}} +var x=direction!=="horizontal"?((percent||100)/100):1,y=direction!=="vertical"?((percent||100)/100):1;return{height:element.height()*y,width:element.width()*x,outerHeight:element.outerHeight()*y,outerWidth:element.outerWidth()*x}},clipToBox:function(animation){return{width:animation.clip.right-animation.clip.left,height:animation.clip.bottom-animation.clip.top,left:animation.clip.left,top:animation.clip.top}},unshift:function(element,queueLength,count){var queue=element.queue();if(queueLength>1){queue.splice.apply(queue,[1,0].concat(queue.splice(queueLength,count)))} +element.dequeue()},saveStyle:function(element){element.data(dataSpaceStyle,element[0].style.cssText)},restoreStyle:function(element){element[0].style.cssText=element.data(dataSpaceStyle)||"";element.removeData(dataSpaceStyle)},mode:function(element,mode){var hidden=element.is(":hidden");if(mode==="toggle"){mode=hidden?"show":"hide"} +if(hidden?mode==="hide":mode==="show"){mode="none"} +return mode},getBaseline:function(origin,original){var y,x;switch(origin[0]){case "top":y=0;break;case "middle":y=0.5;break;case "bottom":y=1;break;default:y=origin[0]/original.height} +switch(origin[1]){case "left":x=0;break;case "center":x=0.5;break;case "right":x=1;break;default:x=origin[1]/original.width} +return{x:x,y:y}},createPlaceholder:function(element){var placeholder,cssPosition=element.css("position"),position=element.position();element.css({marginTop:element.css("marginTop"),marginBottom:element.css("marginBottom"),marginLeft:element.css("marginLeft"),marginRight:element.css("marginRight")}).outerWidth(element.outerWidth()).outerHeight(element.outerHeight());if(/^(static|relative)/.test(cssPosition)){cssPosition="absolute";placeholder=$("<"+element[0].nodeName+">").insertAfter(element).css({display:/^(inline|ruby)/.test(element.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:element.css("marginTop"),marginBottom:element.css("marginBottom"),marginLeft:element.css("marginLeft"),marginRight:element.css("marginRight"),"float":element.css("float")}).outerWidth(element.outerWidth()).outerHeight(element.outerHeight()).addClass("ui-effects-placeholder");element.data(dataSpace+"placeholder",placeholder)} +element.css({position:cssPosition,left:position.left,top:position.top});return placeholder},removePlaceholder:function(element){var dataKey=dataSpace+"placeholder",placeholder=element.data(dataKey);if(placeholder){placeholder.remove();element.removeData(dataKey)}},cleanUp:function(element){$.effects.restoreStyle(element);$.effects.removePlaceholder(element)},setTransition:function(element,list,factor,value){value=value||{};$.each(list,function(i,x){var unit=element.cssUnit(x);if(unit[0]>0){value[x]=unit[0]*factor+unit[1]}});return value}});function _normalizeArguments(effect,options,speed,callback){if($.isPlainObject(effect)){options=effect;effect=effect.effect} +effect={effect:effect};if(options==null){options={}} +if($.isFunction(options)){callback=options;speed=null;options={}} +if(typeof options==="number"||$.fx.speeds[options]){callback=speed;speed=options;options={}} +if($.isFunction(speed)){callback=speed;speed=null} +if(options){$.extend(effect,options)} +speed=speed||options.duration;effect.duration=$.fx.off?0:typeof speed==="number"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;effect.complete=callback||options.complete;return effect} +function standardAnimationOption(option){if(!option||typeof option==="number"||$.fx.speeds[option]){return !0} +if(typeof option==="string"&&!$.effects.effect[option]){return !0} +if($.isFunction(option)){return !0} +if(typeof option==="object"&&!option.effect){return !0} +return !1} +$.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,!0);modes.push(normalizedMode);if(defaultMode&&(normalizedMode==="show"||(normalizedMode===defaultMode&&normalizedMode==="hide"))){el.show()} +if(!defaultMode||normalizedMode!=="none"){$.effects.saveStyle(el)} +if($.isFunction(next)){next()}};if($.fx.off||!effectMethod){if(mode){return this[mode](args.duration,complete)}else{return this.each(function(){if(complete){complete.call(this)}})}} +function run(next){var elem=$(this);function cleanup(){elem.removeData(dataSpaceAnimated);$.effects.cleanUp(elem);if(args.mode==="hide"){elem.hide()} +done()} +function done(){if($.isFunction(complete)){complete.call(elem[0])} +if($.isFunction(next)){next()}} +args.mode=modes.shift();if($.uiBackCompat!==!1&&!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===!1?this.each(prefilter).each(run):this.queue(queueName,prefilter).queue(queueName,run)},show:(function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args.mode="show";return this.effect.call(this,args)}}})($.fn.show),hide:(function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args.mode="hide";return this.effect.call(this,args)}}})($.fn.hide),toggle:(function(orig){return function(option){if(standardAnimationOption(option)||typeof option==="boolean"){return orig.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args.mode="toggle";return this.effect.call(this,args)}}})($.fn.toggle),cssUnit:function(key){var style=this.css(key),val=[];$.each(["em","px","%","pt"],function(i,unit){if(style.indexOf(unit)>0){val=[parseFloat(style),unit]}});return val},cssClip:function(clipObj){if(clipObj){return this.css("clip","rect("+clipObj.top+"px "+clipObj.right+"px "+clipObj.bottom+"px "+clipObj.left+"px)")} +return parseClip(this.css("clip"),this)},transfer:function(options,done){var element=$(this),target=$(options.to),targetFixed=target.css("position")==="fixed",body=$("body"),fixTop=targetFixed?body.scrollTop():0,fixLeft=targetFixed?body.scrollLeft():0,endPosition=target.offset(),animation={top:endPosition.top-fixTop,left:endPosition.left-fixLeft,height:target.innerHeight(),width:target.innerWidth()},startPosition=element.offset(),transfer=$("<div class='ui-effects-transfer'></div>").appendTo("body").addClass(options.className).css({top:startPosition.top-fixTop,left:startPosition.left-fixLeft,height:element.innerHeight(),width:element.innerWidth(),position:targetFixed?"fixed":"absolute"}).animate(animation,options.duration,options.easing,function(){transfer.remove();if($.isFunction(done)){done()}})}});function parseClip(str,element){var outerWidth=element.outerWidth(),outerHeight=element.outerHeight(),clipRegex=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,values=clipRegex.exec(str)||["",0,outerWidth,outerHeight,0];return{top:parseFloat(values[1])||0,right:values[2]==="auto"?outerWidth:parseFloat(values[2]),bottom:values[3]==="auto"?outerHeight:parseFloat(values[3]),left:parseFloat(values[4])||0}} +$.fx.step.clip=function(fx){if(!fx.clipInit){fx.start=$(fx.elem).cssClip();if(typeof fx.end==="string"){fx.end=parseClip(fx.end,fx.elem)} +fx.clipInit=!0} +$(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:!1,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:!1,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"](!0)/2;animation[ref]=motion+distance;if(show){element.css(animation);animation[ref]=oppositeMotion+distance;animation.opacity=1} +element.animate(animation,{queue:!1,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:!1,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:!1,duration:options.duration,easing:options.easing,complete:done})});var effectsEffectSize=$.effects.define("size",function(options,done){var baseline,factor,temp,element=$(this),cProps=["fontSize"],vProps=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],hProps=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],mode=options.mode,restore=mode!=="effect",scale=options.scale||"both",origin=options.origin||["middle","center"],position=element.css("position"),pos=element.position(),original=$.effects.scaledDimensions(element),from=options.from||original,to=options.to||$.effects.scaledDimensions(element,0);$.effects.createPlaceholder(element);if(mode==="show"){temp=from;from=to;to=temp} +factor={from:{y:from.height/original.height,x:from.width/original.width},to:{y:to.height/original.height,x:to.width/original.width}};if(scale==="box"||scale==="both"){if(factor.from.y!==factor.to.y){from=$.effects.setTransition(element,vProps,factor.from.y,from);to=$.effects.setTransition(element,vProps,factor.to.y,to)} +if(factor.from.x!==factor.to.x){from=$.effects.setTransition(element,hProps,factor.from.x,from);to=$.effects.setTransition(element,hProps,factor.to.x,to)}} +if(scale==="content"||scale==="both"){if(factor.from.y!==factor.to.y){from=$.effects.setTransition(element,cProps,factor.from.y,from);to=$.effects.setTransition(element,cProps,factor.to.y,to)}} +if(origin){baseline=$.effects.getBaseline(origin,original);from.top=(original.outerHeight-from.outerHeight)*baseline.y+pos.top;from.left=(original.outerWidth-from.outerWidth)*baseline.x+pos.left;to.top=(original.outerHeight-to.outerHeight)*baseline.y+pos.top;to.left=(original.outerWidth-to.outerWidth)*baseline.x+pos.left} +element.css(from);if(scale==="content"||scale==="both"){vProps=vProps.concat(["marginTop","marginBottom"]).concat(cProps);hProps=hProps.concat(["marginLeft","marginRight"]);element.find("*[width]").each(function(){var child=$(this),childOriginal=$.effects.scaledDimensions(child),childFrom={height:childOriginal.height*factor.from.y,width:childOriginal.width*factor.from.x,outerHeight:childOriginal.outerHeight*factor.from.y,outerWidth:childOriginal.outerWidth*factor.from.x},childTo={height:childOriginal.height*factor.to.y,width:childOriginal.width*factor.to.x,outerHeight:childOriginal.height*factor.to.y,outerWidth:childOriginal.width*factor.to.x};if(factor.from.y!==factor.to.y){childFrom=$.effects.setTransition(child,vProps,factor.from.y,childFrom);childTo=$.effects.setTransition(child,vProps,factor.to.y,childTo)} +if(factor.from.x!==factor.to.x){childFrom=$.effects.setTransition(child,hProps,factor.from.x,childFrom);childTo=$.effects.setTransition(child,hProps,factor.to.x,childTo)} +if(restore){$.effects.saveStyle(child)} +child.css(childFrom);child.animate(childTo,options.duration,options.easing,function(){if(restore){$.effects.restoreStyle(child)}})})} +element.animate(to,{queue:!1,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(!0,{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(!0,{},options,{fade:!0,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"](!0),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:!1,duration:options.duration,easing:options.easing,complete:done})});var effect;if($.uiBackCompat!==!1){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 !1} +img=$("img[usemap='#"+mapName+"']");return img.length>0&&img.is(":visible")} +if(/^(input|select|textarea|button|object)$/.test(nodeName)){focusableIfVisible=!element.disabled;if(focusableIfVisible){fieldset=$(element).closest("fieldset")[0];if(fieldset){focusableIfVisible=!fieldset.disabled}}}else if("a"===nodeName){focusableIfVisible=element.href||hasTabindex}else{focusableIfVisible=hasTabindex} +return focusableIfVisible&&$(element).is(":visible")&&visible($(element))};function visible(element){var visibility=element.css("visibility");while(visibility==="inherit"){element=element.parent();visibility=element.css("visibility")} +return visibility!=="hidden"} +$.extend($.expr[":"],{focusable:function(element){return $.ui.focusable(element,$.attr(element,"tabindex")!=null)}});var focusable=$.ui.focusable;var form=$.fn.form=function(){return typeof this[0].form==="string"?this.closest("form"):$(this[0].form)};var formResetMixin=$.ui.formResetMixin={_formResetHandler:function(){var form=$(this);setTimeout(function(){var instances=form.data("ui-form-reset-instances");$.each(instances,function(){this.refresh()})})},_bindFormResetHandler:function(){this.form=this.element.form();if(!this.form.length){return} +var instances=this.form.data("ui-form-reset-instances")||[];if(!instances.length){this.form.on("reset.ui-form-reset",this._formResetHandler)} +instances.push(this);this.form.data("ui-form-reset-instances",instances)},_unbindFormResetHandler:function(){if(!this.form.length){return} +var instances=this.form.data("ui-form-reset-instances");instances.splice($.inArray(this,instances),1);if(instances.length){this.form.data("ui-form-reset-instances",instances)}else{this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}};if($.fn.jquery.substring(0,3)==="1.7"){$.each(["Width","Height"],function(i,name){var side=name==="Width"?["Left","Right"]:["Top","Bottom"],type=name.toLowerCase(),orig={innerWidth:$.fn.innerWidth,innerHeight:$.fn.innerHeight,outerWidth:$.fn.outerWidth,outerHeight:$.fn.outerHeight};function reduce(elem,size,border,margin){$.each(side,function(){size-=parseFloat($.css(elem,"padding"+this))||0;if(border){size-=parseFloat($.css(elem,"border"+this+"Width"))||0} +if(margin){size-=parseFloat($.css(elem,"margin"+this))||0}});return size} +$.fn["inner"+name]=function(size){if(size===undefined){return orig["inner"+name].call(this)} +return this.each(function(){$(this).css(type,reduce(this,size)+"px")})};$.fn["outer"+name]=function(size,margin){if(typeof size!=="number"){return orig["outer"+name].call(this,size)} +return this.each(function(){$(this).css(type,reduce(this,size,!0,margin)+"px")})}});$.fn.addBack=function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}};var keycode=$.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38};var escapeSelector=$.ui.escapeSelector=(function(){var selectorEscape=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g; + return function( selector ) { + return selector.replace( selectorEscape, "\\$1" ); + }; +} )(); + + +/*! + * jQuery UI Labels 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: labels +//>>group: Core +//>>description: Find all the labels associated with a given input +//>>docs: http://api.jqueryui.com/labels/ + + + +var labels = $.fn.labels = function() { + var ancestor, selector, id, labels, ancestors; + + // Check control.labels first + if ( this[ 0 ].labels && this[ 0 ].labels.length ) { + return this.pushStack( this[ 0 ].labels ); + } + + // Support: IE <= 11, FF <= 37, Android <= 2.3 only + // Above browsers do not support control.labels. Everything below is to support them + // as well as document fragments. control.labels does not work on document fragments + labels = this.eq( 0 ).parents( "label" ); + + // Look for the label based on the id + id = this.attr( "id" ); + if ( id ) { + + // We don't search against the document in case the element + // is disconnected from the DOM + ancestor = this.eq( 0 ).parents().last(); + + // Get a full set of top level ancestors + ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); + + // Create a selector for the label based on the id + selector = "label[for='" + $.ui.escapeSelector( id ) + "']"; + + labels = labels.add( ancestors.find( selector ).addBack( selector ) ); + + } + + // Return whatever we have found for labels + return this.pushStack( labels ); +}; + + +/*! + * jQuery UI Scroll Parent 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: scrollParent +//>>group: Core +//>>description: Get the closest ancestor element that is scrollable. +//>>docs: http://api.jqueryui.com/scrollParent/ + + + +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; +}; + + +/*! + * jQuery UI Tabbable 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: :tabbable Selector +//>>group: Core +//>>description: Selects elements which can be tabbed to. +//>>docs: http://api.jqueryui.com/tabbable-selector/ + + + +var tabbable = $.extend( $.expr[ ":" ], { + tabbable: function( element ) { + var tabIndex = $.attr( element, "tabindex" ), + hasTabindex = tabIndex != null; + return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex ); + } +} ); + + +/*! + * jQuery UI Unique ID 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: uniqueId +//>>group: Core +//>>description: Functions to generate and remove uniqueId's +//>>docs: http://api.jqueryui.com/uniqueId/ + + + +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" ); + } + } ); + } +} ); + + +/*! + * jQuery UI Accordion 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Accordion +//>>group: Widgets +// jscs:disable maximumLineLength +//>>description: Displays collapsible content panels for presenting information in a limited amount of space. +// jscs:enable maximumLineLength +//>>docs: http://api.jqueryui.com/accordion/ +//>>demos: http://jqueryui.com/accordion/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/accordion.css +//>>css.theme: ../../themes/base/theme.css + + + +var widgetsAccordion = $.widget( "ui.accordion", { + version: "1.12.1", + options: { + active: 0, + animate: {}, + classes: { + "ui-accordion-header": "ui-corner-top", + "ui-accordion-header-collapsed": "ui-corner-all", + "ui-accordion-content": "ui-corner-bottom" + }, + collapsible: false, + event: "click", + header: "> li > :first-child, > :not(li):even", + heightStyle: "auto", + icons: { + activeHeader: "ui-icon-triangle-1-s", + header: "ui-icon-triangle-1-e" + }, + + // Callbacks + 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" ); + + // Don't allow collapsible: false and active: false / null + if ( !options.collapsible && ( options.active === false || options.active == null ) ) { + options.active = 0; + } + + this._processPanels(); + + // handle negative values + 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; + + // Clean up main element + this.element.removeAttr( "role" ); + + // Clean up headers + this.headers + .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" ) + .removeUniqueId(); + + this._destroyIcons(); + + // Clean up content panels + 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" ) { + + // _activate() will handle invalid values and update this.options + 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 ); + + // Setting collapsible: false while collapsed; open first panel + 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 ); + + // Support: IE8 Only + // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE + // so we need to add the disabled class to the headers and panels + 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(); + + // Was collapsed or no panel + if ( ( options.active === false && options.collapsible === true ) || + !this.headers.length ) { + options.active = false; + this.active = $(); + + // active false only when collapsible is true + } else if ( options.active === false ) { + this._activate( 0 ); + + // was active, but active panel is gone + } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { + + // all remaining panel are disabled + if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) { + options.active = false; + this.active = $(); + + // activate previous panel + } else { + this._activate( Math.max( 0, options.active - 1 ) ); + } + + // was active, active panel still exists + } else { + + // make sure active index is correct + options.active = this.headers.index( this.active ); + } + + this._destroyIcons(); + + this._refresh(); + }, + + _processPanels: function() { + var prevHeaders = this.headers, + prevPanels = this.panels; + + this.headers = this.element.find( this.options.header ); + this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed", + "ui-state-default" ); + + this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide(); + this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" ); + + // Avoid memory leaks (#10056) + 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(); + + // Make sure at least one header is in the tab order + 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 ]; + + // Trying to activate the already active panel + if ( active === this.active[ 0 ] ) { + return; + } + + // Trying to collapse, simulate a click on the currently active header + 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 ( + + // click on active header, but not collapsible + ( clickedIsActive && !options.collapsible ) || + + // allow canceling activation + ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { + return; + } + + options.active = collapsing ? false : this.headers.index( clicked ); + + // When the call to ._toggle() comes after the class changes + // it causes a very odd bug in IE 8 (see #6720) + this.active = clickedIsActive ? $() : clicked; + this._toggle( eventData ); + + // Switch classes + // corner classes on the previously active header stay after the animation + 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; + + // Handle activating a panel during the animation for another activation + 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 we're switching panels, remove the old header from the tab order + // if we're opening from collapsed state, remove the previous header from the tab order + // if we're collapsing, then keep the collapsing header in the tab order + 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; + } + + // fall back from options to animation in case of partial down settings + 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" ); + + // Work around for rendering bug in IE (#5421) + if ( toHide.length ) { + toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className; + } + this._trigger( "activate", null, data ); + } +} ); + + + +var safeActiveElement = $.ui.safeActiveElement = function( document ) { + var activeElement; + + // Support: IE 9 only + // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> + try { + activeElement = document.activeElement; + } catch ( error ) { + activeElement = document.body; + } + + // Support: IE 9 - 11 only + // IE may return null instead of an element + // Interestingly, this only seems to occur when NOT in an iframe + if ( !activeElement ) { + activeElement = document.body; + } + + // Support: IE 11 only + // IE11 returns a seemingly empty object in some cases when accessing + // document.activeElement from an <iframe> + if ( !activeElement.nodeName ) { + activeElement = document.body; + } + + return activeElement; +}; + + +/*! + * jQuery UI Menu 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Menu +//>>group: Widgets +//>>description: Creates nestable menus. +//>>docs: http://api.jqueryui.com/menu/ +//>>demos: http://jqueryui.com/menu/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/menu.css +//>>css.theme: ../../themes/base/theme.css + + + +var widgetsMenu = $.widget( "ui.menu", { + version: "1.12.1", + defaultElement: "<ul>", + delay: 300, + options: { + icons: { + submenu: "ui-icon-caret-1-e" + }, + items: "> *", + menus: "ul", + position: { + my: "left top", + at: "right top" + }, + role: "menu", + + // Callbacks + blur: null, + focus: null, + select: null + }, + + _create: function() { + this.activeMenu = this.element; + + // Flag used to prevent firing of the click handler + // as the event bubbles up through nested menus + this.mouseHandled = false; + this.element + .uniqueId() + .attr( { + role: this.options.role, + tabIndex: 0 + } ); + + this._addClass( "ui-menu", "ui-widget ui-widget-content" ); + this._on( { + + // Prevent focus from sticking to links inside menu after clicking + // them (focus should always stay on UL during navigation). + "mousedown .ui-menu-item": function( event ) { + event.preventDefault(); + }, + "click .ui-menu-item": function( event ) { + var target = $( event.target ); + var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) ); + if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { + this.select( event ); + + // Only set the mouseHandled flag if the event will bubble, see #9469. + if ( !event.isPropagationStopped() ) { + this.mouseHandled = true; + } + + // Open submenu on click + if ( target.has( ".ui-menu" ).length ) { + this.expand( event ); + } else if ( !this.element.is( ":focus" ) && + active.closest( ".ui-menu" ).length ) { + + // Redirect focus to the menu + this.element.trigger( "focus", [ true ] ); + + // If the active item is on the top level, let it stay active. + // Otherwise, blur the active item since it is no longer visible. + if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { + clearTimeout( this.timer ); + } + } + } + }, + "mouseenter .ui-menu-item": function( event ) { + + // Ignore mouse events while typeahead is active, see #10458. + // Prevents focusing the wrong item when typeahead causes a scroll while the mouse + // is over an item in the menu + if ( this.previousFilter ) { + return; + } + + var actualTarget = $( event.target ).closest( ".ui-menu-item" ), + target = $( event.currentTarget ); + + // Ignore bubbled events on parent items, see #11641 + if ( actualTarget[ 0 ] !== target[ 0 ] ) { + return; + } + + // Remove ui-state-active class from siblings of the newly focused menu item + // to avoid a jump caused by adjacent elements both having a class with a border + this._removeClass( target.siblings().children( ".ui-state-active" ), + null, "ui-state-active" ); + this.focus( event, target ); + }, + mouseleave: "collapseAll", + "mouseleave .ui-menu": "collapseAll", + focus: function( event, keepActiveItem ) { + + // If there's already an active item, keep it active + // If not, activate the first item + var item = this.active || this.element.find( this.options.items ).eq( 0 ); + + if ( !keepActiveItem ) { + this.focus( event, item ); + } + }, + blur: function( event ) { + this._delay( function() { + var notContained = !$.contains( + this.element[ 0 ], + $.ui.safeActiveElement( this.document[ 0 ] ) + ); + if ( notContained ) { + this.collapseAll( event ); + } + } ); + }, + keydown: "_keydown" + } ); + + this.refresh(); + + // Clicks outside of a menu collapse any open menus + this._on( this.document, { + click: function( event ) { + if ( this._closeOnDocumentClick( event ) ) { + this.collapseAll( event ); + } + + // Reset the mouseHandled flag + this.mouseHandled = false; + } + } ); + }, + + _destroy: function() { + var items = this.element.find( ".ui-menu-item" ) + .removeAttr( "role aria-disabled" ), + submenus = items.children( ".ui-menu-item-wrapper" ) + .removeUniqueId() + .removeAttr( "tabIndex role aria-haspopup" ); + + // Destroy (sub)menus + 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; + + // Support number pad values + 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 no matches on the current filter, reset to the last character pressed + // to move down the menu to the first item that starts with that character + 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 ); + + // Initialize nested menus + 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 ); + + // Initialize menu-items containing spaces and/or dashes only as dividers + items.not( ".ui-menu-item" ).each( function() { + var item = $( this ); + if ( that._isDivider( item ) ) { + that._addClass( item, "ui-menu-divider", "ui-widget-content" ); + } + } ); + + // Don't refresh list items that are already adapted + 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" ); + + // Add aria-disabled attribute to any disabled menu item + items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); + + // If the active item has been removed, blur the menu + 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" ); + + // Only update aria-activedescendant if there's a role + // otherwise we assume focus is managed elsewhere + if ( this.options.role ) { + this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); + } + + // Highlight active parent menu item, if any + 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 ); + + // Don't open if already open fixes a Firefox bug that caused a .5 pixel + // shift in the submenu position when mousing over the caret icon + 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() { + + // If we were passed an event, look for the submenu that contains the event + var currentMenu = all ? this.element : + $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); + + // If we found no valid submenu ancestor, use the main menu to close all + // sub menus anyway + if ( !currentMenu.length ) { + currentMenu = this.element; + } + + this._close( currentMenu ); + + this.blur( event ); + + // Work around active item staying active after menu is blurred + this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" ); + + this.activeMenu = currentMenu; + }, this.delay ); + }, + + // With no arguments, closes the currently active menu - if nothing is active + // it closes all menus. If passed an argument, it will search for menus BELOW + _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 ) { + + // Match hyphen, em dash, en dash + return !/[^\-\u2014\u2013\s]/.test( item.text() ); + }, + + collapse: function( event ) { + var newItem = this.active && + this.active.parent().closest( ".ui-menu-item", this.element ); + if ( newItem && newItem.length ) { + this._close(); + this.focus( event, newItem ); + } + }, + + expand: function( event ) { + var newItem = this.active && + this.active + .children( ".ui-menu " ) + .find( this.options.items ) + .first(); + + if ( newItem && newItem.length ) { + this._open( newItem.parent() ); + + // Delay so Firefox will not hide activedescendant change in expanding submenu from AT + this._delay( function() { + this.focus( event, newItem ); + } ); + } + }, + + next: function( event ) { + this._move( "next", "first", event ); + }, + + previous: function( event ) { + this._move( "prev", "last", event ); + }, + + isFirstItem: function() { + return this.active && !this.active.prevAll( ".ui-menu-item" ).length; + }, + + isLastItem: function() { + return this.active && !this.active.nextAll( ".ui-menu-item" ).length; + }, + + _move: function( direction, filter, event ) { + var next; + if ( this.active ) { + if ( direction === "first" || direction === "last" ) { + next = this.active + [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) + .eq( -1 ); + } else { + next = this.active + [ direction + "All" ]( ".ui-menu-item" ) + .eq( 0 ); + } + } + if ( !next || !next.length || !this.active ) { + next = this.activeMenu.find( this.options.items )[ filter ](); + } + + this.focus( event, next ); + }, + + nextPage: function( event ) { + var item, base, height; + + if ( !this.active ) { + this.next( event ); + return; + } + if ( this.isLastItem() ) { + return; + } + if ( this._hasScroll() ) { + base = this.active.offset().top; + height = this.element.height(); + this.active.nextAll( ".ui-menu-item" ).each( function() { + item = $( this ); + return item.offset().top - base - height < 0; + } ); + + this.focus( event, item ); + } else { + this.focus( event, this.activeMenu.find( this.options.items ) + [ !this.active ? "first" : "last" ]() ); + } + }, + + previousPage: function( event ) { + var item, base, height; + if ( !this.active ) { + this.next( event ); + return; + } + if ( this.isFirstItem() ) { + return; + } + if ( this._hasScroll() ) { + base = this.active.offset().top; + height = this.element.height(); + this.active.prevAll( ".ui-menu-item" ).each( function() { + item = $( this ); + return item.offset().top - base + height > 0; + } ); + + this.focus( event, item ); + } else { + this.focus( event, this.activeMenu.find( this.options.items ).first() ); + } + }, + + _hasScroll: function() { + return this.element.outerHeight() < this.element.prop( "scrollHeight" ); + }, + + select: function( event ) { + + // TODO: It should never be possible to not have an active item at this + // point, but the tests don't trigger mouseenter before click. + 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 ) + + // Only match on items, not dividers or other content (#10571) + .filter( ".ui-menu-item" ) + .filter( function() { + return regex.test( + $.trim( $( this ).children( ".ui-menu-item-wrapper" ).text() ) ); + } ); + } +} ); + + +/*! + * jQuery UI Autocomplete 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Autocomplete +//>>group: Widgets +//>>description: Lists suggested words as the user is typing. +//>>docs: http://api.jqueryui.com/autocomplete/ +//>>demos: http://jqueryui.com/autocomplete/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/autocomplete.css +//>>css.theme: ../../themes/base/theme.css + + + +$.widget( "ui.autocomplete", { + version: "1.12.1", + defaultElement: "<input>", + options: { + appendTo: null, + autoFocus: false, + delay: 300, + minLength: 1, + position: { + my: "left top", + at: "left bottom", + collision: "none" + }, + source: null, + + // Callbacks + change: null, + close: null, + focus: null, + open: null, + response: null, + search: null, + select: null + }, + + requestIndex: 0, + pending: 0, + + _create: function() { + + // Some browsers only repeat keydown events, not keypress events, + // so we use the suppressKeyPress flag to determine if we've already + // handled the keydown event. #7269 + // Unfortunately the code for & in keypress is the same as the up arrow, + // so we use the suppressKeyPressRepeat flag to avoid handling keypress + // events when we know the keydown event was used to modify the + // search term. #7799 + var suppressKeyPress, suppressKeyPressRepeat, suppressInput, + nodeName = this.element[ 0 ].nodeName.toLowerCase(), + isTextarea = nodeName === "textarea", + isInput = nodeName === "input"; + + // Textareas are always multi-line + // Inputs are always single-line, even if inside a contentEditable element + // IE also treats inputs as contentEditable + // All other element types are determined by whether or not they're contentEditable + 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: + + // when menu is open and has focus + if ( this.menu.active ) { + + // #6055 - Opera still allows the keypress to occur + // which causes forms to submit + 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 ); + + // Different browsers have different default behavior for escape + // Single press can mean undo or clear + // Double press in IE means clear the whole form + event.preventDefault(); + } + break; + default: + suppressKeyPressRepeat = true; + + // search timeout should be triggered before the input value is changed + 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; + } + + // Replicate some key handlers to allow them to repeat in Firefox and Opera + var keyCode = $.ui.keyCode; + switch ( event.keyCode ) { + case keyCode.PAGE_UP: + this._move( "previousPage", event ); + break; + case keyCode.PAGE_DOWN: + this._move( "nextPage", event ); + break; + case keyCode.UP: + this._keyEvent( "previous", event ); + break; + case keyCode.DOWN: + this._keyEvent( "next", event ); + break; + } + }, + input: function( event ) { + if ( suppressInput ) { + suppressInput = false; + event.preventDefault(); + return; + } + this._searchTimeout( event ); + }, + focus: function() { + this.selectedItem = null; + this.previous = this._value(); + }, + blur: function( event ) { + if ( this.cancelBlur ) { + delete this.cancelBlur; + return; + } + + clearTimeout( this.searching ); + this.close( event ); + this._change( event ); + } + } ); + + this._initSource(); + this.menu = $( "<ul>" ) + .appendTo( this._appendTo() ) + .menu( { + + // disable ARIA support, the live region takes care of that + role: null + } ) + .hide() + .menu( "instance" ); + + this._addClass( this.menu.element, "ui-autocomplete", "ui-front" ); + this._on( this.menu.element, { + mousedown: function( event ) { + + // prevent moving focus out of the text field + event.preventDefault(); + + // IE doesn't prevent moving focus even with event.preventDefault() + // so we set a flag to know when we should ignore the blur event + this.cancelBlur = true; + this._delay( function() { + delete this.cancelBlur; + + // Support: IE 8 only + // Right clicking a menu item or selecting text from the menu items will + // result in focus moving out of the input. However, we've already received + // and ignored the blur event because of the cancelBlur flag set above. So + // we restore focus to ensure that the menu closes properly based on the user's + // next actions. + if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) { + this.element.trigger( "focus" ); + } + } ); + }, + menufocus: function( event, ui ) { + var label, item; + + // support: Firefox + // Prevent accidental activation of menu items in Firefox (#7024 #9118) + 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 } ) ) { + + // use value to match what will end up in the input, if it was a key event + if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { + this._value( item.value ); + } + } + + // Announce the value in the liveRegion + label = ui.item.attr( "aria-label" ) || item.value; + if ( label && $.trim( label ).length ) { + this.liveRegion.children().hide(); + $( "<div>" ).text( label ).appendTo( this.liveRegion ); + } + }, + menuselect: function( event, ui ) { + var item = ui.item.data( "ui-autocomplete-item" ), + previous = this.previous; + + // Only trigger when focus was lost (click on menu) + if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) { + this.element.trigger( "focus" ); + this.previous = previous; + + // #6109 - IE triggers two focus events and the second + // is asynchronous, so we need to reset the previous + // term synchronously and asynchronously :-( + this._delay( function() { + this.previous = previous; + this.selectedItem = item; + } ); + } + + if ( false !== this._trigger( "select", event, { item: item } ) ) { + this._value( item.value ); + } + + // reset the term after the select event + // this allows custom select handling to work properly + 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" ); + + // Turning off autocomplete prevents the browser from remembering the + // value when navigating through history, so we re-enable autocomplete + // if the page is unloaded before the widget is destroyed. #7790 + this._on( this.window, { + beforeunload: function() { + this.element.removeAttr( "autocomplete" ); + } + } ); + }, + + _destroy: function() { + clearTimeout( this.searching ); + this.element.removeAttr( "autocomplete" ); + this.menu.element.remove(); + this.liveRegion.remove(); + }, + + _setOption: function( key, value ) { + this._super( key, value ); + if ( key === "source" ) { + this._initSource(); + } + if ( key === "appendTo" ) { + this.menu.element.appendTo( this._appendTo() ); + } + if ( key === "disabled" && value && this.xhr ) { + this.xhr.abort(); + } + }, + + _isEventTargetInWidget: function( event ) { + var menuElement = this.menu.element[ 0 ]; + + return event.target === this.element[ 0 ] || + event.target === menuElement || + $.contains( menuElement, event.target ); + }, + + _closeOnClickOutside: function( event ) { + if ( !this._isEventTargetInWidget( event ) ) { + this.close(); + } + }, + + _appendTo: function() { + var element = this.options.appendTo; + + if ( element ) { + element = element.jquery || element.nodeType ? + $( element ) : + this.document.find( element ).eq( 0 ); + } + + if ( !element || !element[ 0 ] ) { + element = this.element.closest( ".ui-front, dialog" ); + } + + if ( !element.length ) { + element = this.document[ 0 ].body; + } + + return element; + }, + + _initSource: function() { + var array, url, + that = this; + if ( $.isArray( this.options.source ) ) { + array = this.options.source; + this.source = function( request, response ) { + response( $.ui.autocomplete.filter( array, request.term ) ); + }; + } else if ( typeof this.options.source === "string" ) { + url = this.options.source; + this.source = function( request, response ) { + if ( that.xhr ) { + that.xhr.abort(); + } + that.xhr = $.ajax( { + url: url, + data: request, + dataType: "json", + success: function( data ) { + response( data ); + }, + error: function() { + response( [] ); + } + } ); + }; + } else { + this.source = this.options.source; + } + }, + + _searchTimeout: function( event ) { + clearTimeout( this.searching ); + this.searching = this._delay( function() { + + // Search if the value has changed, or if the user retypes the same value (see #7434) + 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(); + + // Always save the actual value, not the one passed as an argument + this.term = this._value(); + + if ( value.length < this.options.minLength ) { + return this.close( event ); + } + + if ( this._trigger( "search", event ) === false ) { + return; + } + + return this._search( value ); + }, + + _search: function( value ) { + this.pending++; + this._addClass( "ui-autocomplete-loading" ); + this.cancelSearch = false; + + this.source( { term: value }, this._response() ); + }, + + _response: function() { + var index = ++this.requestIndex; + + return $.proxy( function( content ) { + if ( index === this.requestIndex ) { + this.__response( content ); + } + + this.pending--; + if ( !this.pending ) { + this._removeClass( "ui-autocomplete-loading" ); + } + }, this ); + }, + + __response: function( content ) { + if ( content ) { + content = this._normalize( content ); + } + this._trigger( "response", null, { content: content } ); + if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { + this._suggest( content ); + this._trigger( "open" ); + } else { + + // use ._close() instead of .close() so we don't cancel future searches + this._close(); + } + }, + + close: function( event ) { + this.cancelSearch = true; + this._close( event ); + }, + + _close: function( event ) { + + // Remove the handler that closes the menu on outside clicks + 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 ) { + + // assume all items have the right format when the first item is complete + 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(); + + // Size and position menu + ul.show(); + this._resizeMenu(); + ul.position( $.extend( { + of: this.element + }, this.options.position ) ); + + if ( this.options.autoFocus ) { + this.menu.next(); + } + + // Listen for interactions outside of the widget (#6642) + this._on( this.document, { + mousedown: "_closeOnClickOutside" + } ); + }, + + _resizeMenu: function() { + var ul = this.menu.element; + ul.outerWidth( Math.max( + + // Firefox wraps long text (possibly a rounding bug) + // so we add 1px to avoid the wrapping (#7513) + 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 ); + + // Prevents moving cursor to beginning/end of the text field in some browsers + event.preventDefault(); + } + }, + + // Support: Chrome <=50 + // We should be able to just use this.element.prop( "isContentEditable" ) + // but hidden elements always report false in Chrome. + // https://code.google.com/p/chromium/issues/detail?id=313082 + _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 ); + } ); + } +} ); + +// Live region extension, adding a `messages` option +// NOTE: This is an experimental API. We are still investigating +// a full solution for string manipulation and internationalization. +$.widget( "ui.autocomplete", $.ui.autocomplete, { + options: { + messages: { + noResults: "No search results.", + results: function( amount ) { + return amount + ( amount > 1 ? " results are" : " result is" ) + + " available, use up and down arrow keys to navigate."; + } + } + }, + + __response: function( content ) { + var message; + this._superApply( arguments ); + if ( this.options.disabled || this.cancelSearch ) { + return; + } + if ( content && content.length ) { + message = this.options.messages.results( content.length ); + } else { + message = this.options.messages.noResults; + } + this.liveRegion.children().hide(); + $( "<div>" ).text( message ).appendTo( this.liveRegion ); + } +} ); + +var widgetsAutocomplete = $.ui.autocomplete; + + +/*! + * jQuery UI Controlgroup 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Controlgroup +//>>group: Widgets +//>>description: Visually groups form control widgets +//>>docs: http://api.jqueryui.com/controlgroup/ +//>>demos: http://jqueryui.com/controlgroup/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/controlgroup.css +//>>css.theme: ../../themes/base/theme.css + + +var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; + +var widgetsControlgroup = $.widget( "ui.controlgroup", { + version: "1.12.1", + 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(); + }, + + // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation + _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 = []; + + // First we iterate over each of the items options + $.each( this.options.items, function( widget, selector ) { + var labels; + var options = {}; + + // Make sure the widget has a selector set + 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; + } + + // Make sure the widget actually exists + if ( !$.fn[ widget ] ) { + return; + } + + // We assume everything is in the middle to start because we can't determine + // first / last elements until all enhancments are done. + if ( that[ "_" + widget + "Options" ] ) { + options = that[ "_" + widget + "Options" ]( "middle" ); + } else { + options = { classes: {} }; + } + + // Find instances of this widget inside controlgroup and init them + that.element + .find( selector ) + .each( function() { + var element = $( this ); + var instance = element[ widget ]( "instance" ); + + // We need to clone the default options for this type of widget to avoid + // polluting the variable options which has a wider scope than a single widget. + var instanceOptions = $.widget.extend( {}, options ); + + // If the button is the child of a spinner ignore it + // TODO: Find a more generic solution + if ( widget === "button" && element.parent( ".ui-spinner" ).length ) { + return; + } + + // Create the widget if it doesn't exist + if ( !instance ) { + instance = element[ widget ]()[ widget ]( "instance" ); + } + if ( instance ) { + instanceOptions.classes = + that._resolveClassesValues( instanceOptions.classes, instance ); + } + element[ widget ]( instanceOptions ); + + // Store an instance of the controlgroup to be able to reference + // from the outermost element for changing options and refresh + var widgetElement = element[ widget ]( "widget" ); + $.data( widgetElement[ 0 ], "ui-controlgroup-data", + instance ? instance : element[ widget ]( "instance" ) ); + + childWidgets.push( widgetElement[ 0 ] ); + } ); + } ); + + this.childWidgets = $( $.unique( childWidgets ) ); + this._addClass( this.childWidgets, "ui-controlgroup-item" ); + }, + + _callChildMethod: function( method ) { + this.childWidgets.each( function() { + var element = $( this ), + data = element.data( "ui-controlgroup-data" ); + if ( data && data[ method ] ) { + data[ method ](); + } + } ); + }, + + _updateCornerClass: function( element, position ) { + var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; + var add = this._buildSimpleOptions( position, "label" ).classes.label; + + this._removeClass( element, null, remove ); + this._addClass( element, null, add ); + }, + + _buildSimpleOptions: function( position, key ) { + var direction = this.options.direction === "vertical"; + var result = { + classes: {} + }; + result.classes[ key ] = { + "middle": "", + "first": "ui-corner-" + ( direction ? "top" : "left" ), + "last": "ui-corner-" + ( direction ? "bottom" : "right" ), + "only": "ui-corner-all" + }[ position ]; + + return result; + }, + + _spinnerOptions: function( position ) { + var options = this._buildSimpleOptions( position, "ui-spinner" ); + + options.classes[ "ui-spinner-up" ] = ""; + options.classes[ "ui-spinner-down" ] = ""; + + return options; + }, + + _buttonOptions: function( position ) { + return this._buildSimpleOptions( position, "ui-button" ); + }, + + _checkboxradioOptions: function( position ) { + return this._buildSimpleOptions( position, "ui-checkboxradio-label" ); + }, + + _selectmenuOptions: function( position ) { + var direction = this.options.direction === "vertical"; + return { + width: direction ? "auto" : false, + classes: { + middle: { + "ui-selectmenu-button-open": "", + "ui-selectmenu-button-closed": "" + }, + first: { + "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ), + "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" ) + }, + last: { + "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", + "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" ) + }, + only: { + "ui-selectmenu-button-open": "ui-corner-top", + "ui-selectmenu-button-closed": "ui-corner-all" + } + + }[ position ] + }; + }, + + _resolveClassesValues: function( classes, instance ) { + var result = {}; + $.each( classes, function( key ) { + var current = instance.options.classes[ key ] || ""; + current = $.trim( 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; + + // We filter here because we need to track all childWidgets not just the visible ones + if ( this.options.onlyVisible ) { + children = children.filter( ":visible" ); + } + + if ( children.length ) { + + // We do this last because we need to make sure all enhancment is done + // before determining first and last + $.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 ); + } + } ); + + // Finally call the refresh method on each of the child widgets. + this._callChildMethod( "refresh" ); + } + } +} ); + +/*! + * jQuery UI Checkboxradio 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Checkboxradio +//>>group: Widgets +//>>description: Enhances a form with multiple themeable checkboxes or radio buttons. +//>>docs: http://api.jqueryui.com/checkboxradio/ +//>>demos: http://jqueryui.com/checkboxradio/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/button.css +//>>css.structure: ../../themes/base/checkboxradio.css +//>>css.theme: ../../themes/base/theme.css + + + +$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { + version: "1.12.1", + options: { + disabled: null, + label: null, + icon: true, + classes: { + "ui-checkboxradio-label": "ui-corner-all", + "ui-checkboxradio-icon": "ui-corner-all" + } + }, + + _getCreateOptions: function() { + var disabled, labels; + var that = this; + var options = this._super() || {}; + + // We read the type here, because it makes more sense to throw a element type error first, + // rather then the error for lack of a label. Often if its the wrong type, it + // won't have a label (e.g. calling on a div, btn, etc) + this._readType(); + + labels = this.element.labels(); + + // If there are multiple labels, use the last one + this.label = $( labels[ labels.length - 1 ] ); + if ( !this.label.length ) { + $.error( "No label found for checkboxradio widget" ); + } + + this.originalLabel = ""; + + // We need to get the label text but this may also need to make sure it does not contain the + // input itself. + this.label.contents().not( this.element[ 0 ] ).each( function() { + + // The label contents could be text, html, or a mix. We concat each element to get a + // string representation of the label, without the input as part of it. + that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML; + } ); + + // Set the label option if we found label text + if ( this.originalLabel ) { + options.label = this.originalLabel; + } + + disabled = this.element[ 0 ].disabled; + if ( disabled != null ) { + options.disabled = disabled; + } + return options; + }, + + _create: function() { + var checked = this.element[ 0 ].checked; + + this._bindFormResetHandler(); + + if ( this.options.disabled == null ) { + this.options.disabled = this.element[ 0 ].disabled; + } + + this._setOption( "disabled", this.options.disabled ); + this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" ); + this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" ); + + if ( this.type === "radio" ) { + this._addClass( this.label, "ui-checkboxradio-radio-label" ); + } + + if ( this.options.label && this.options.label !== this.originalLabel ) { + this._updateLabel(); + } else if ( this.originalLabel ) { + this.options.label = this.originalLabel; + } + + this._enhance(); + + if ( checked ) { + this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); + if ( this.icon ) { + this._addClass( this.icon, null, "ui-state-hover" ); + } + } + + this._on( { + change: "_toggleClasses", + focus: function() { + this._addClass( this.label, null, "ui-state-focus ui-visual-focus" ); + }, + blur: function() { + this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" ); + } + } ); + }, + + _readType: function() { + var nodeName = this.element[ 0 ].nodeName.toLowerCase(); + this.type = this.element[ 0 ].type; + if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) { + $.error( "Can't create checkboxradio on element.nodeName=" + nodeName + + " and element.type=" + this.type ); + } + }, + + // Support jQuery Mobile enhanced option + _enhance: function() { + this._updateIcon( this.element[ 0 ].checked ); + }, + + widget: function() { + return this.label; + }, + + _getRadioGroup: function() { + var group; + var name = this.element[ 0 ].name; + var nameSelector = "input[name='" + $.ui.escapeSelector( name ) + "']"; + + if ( !name ) { + return $( [] ); + } + + if ( this.form.length ) { + group = $( this.form[ 0 ].elements ).filter( nameSelector ); + } else { + + // Not inside a form, check all inputs that also are not inside a form + 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 ) { + + // We don't allow the value to be set to nothing + 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; + + // Don't refresh when setting disabled + 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() { + + // Remove the contents of the label ( minus the icon, icon space, and input ) + 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; + + +/*! + * jQuery UI Button 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Button +//>>group: Widgets +//>>description: Enhances a form with themeable buttons. +//>>docs: http://api.jqueryui.com/button/ +//>>demos: http://jqueryui.com/button/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/button.css +//>>css.theme: ../../themes/base/theme.css + + + +$.widget( "ui.button", { + version: "1.12.1", + defaultElement: "<button>", + options: { + classes: { + "ui-button": "ui-corner-all" + }, + disabled: null, + icon: null, + iconPosition: "beginning", + label: null, + showLabel: true + }, + + _getCreateOptions: function() { + var disabled, + + // This is to support cases like in jQuery Mobile where the base widget does have + // an implementation of _getCreateOptions + 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; + } + + // We have to check the option again here even though we did in _getCreateOptions, + // because null may have been passed on init which would override what was set in + // _getCreateOptions + if ( this.options.disabled == null ) { + this.options.disabled = this.element[ 0 ].disabled || false; + } + + this.hasTitle = !!this.element.attr( "title" ); + + // Check to see if the label needs to be set or if its already correct + 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(); + + // Support: PhantomJS <= 1.9, IE 8 Only + // If a native click is available use it so we actually cause navigation + // otherwise just trigger a click event + 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"; + + // Create icon + 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 ) { + + // If we are updating the icon remove the old icon class + this._removeClass( this.icon, null, this.options.icon ); + } + + // If we are updating the icon add the new icon class + if ( icon ) { + this._addClass( this.icon, null, value ); + } + + this._attachIcon( position ); + + // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove + // the iconSpace if there is one. + if ( displayBlock ) { + this._addClass( this.icon, null, "ui-widget-icon-block" ); + if ( this.iconSpace ) { + this.iconSpace.remove(); + } + } else { + + // Position is beginning or end so remove the ui-widget-icon-block class and add the + // space if it does not exist + 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 ); + } + + // Make sure we can't end up with a button that has neither text nor icon + if ( key === "showLabel" ) { + this._toggleClass( "ui-button-icon-only", null, !value ); + this._updateTooltip(); + } + + if ( key === "label" ) { + if ( this.isInput ) { + this.element.val( value ); + } else { + + // If there is an icon, append it, else nothing then append the value + // this avoids removal of the icon when setting label text + this.element.html( value ); + if ( this.icon ) { + this._attachIcon( this.options.iconPosition ); + this._attachIconSpace( this.options.iconPosition ); + } + } + } + + this._super( key, value ); + + if ( key === "disabled" ) { + this._toggleClass( null, "ui-state-disabled", value ); + this.element[ 0 ].disabled = value; + if ( value ) { + this.element.blur(); + } + } + }, + + refresh: function() { + + // Make sure to only check disabled if its an element that supports this otherwise + // check for the disabled class to determine state + 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(); + } +} ); + +// DEPRECATED +if ( $.uiBackCompat !== false ) { + + // Text and Icons options + $.widget( "ui.button", $.ui.button, { + options: { + text: true, + icons: { + primary: null, + secondary: null + } + }, + + _create: function() { + if ( this.options.showLabel && !this.options.text ) { + this.options.showLabel = this.options.text; + } + if ( !this.options.showLabel && this.options.text ) { + this.options.text = this.options.showLabel; + } + if ( !this.options.icon && ( this.options.icons.primary || + this.options.icons.secondary ) ) { + if ( this.options.icons.primary ) { + this.options.icon = this.options.icons.primary; + } else { + this.options.icon = this.options.icons.secondary; + this.options.iconPosition = "end"; + } + } else if ( this.options.icon ) { + this.options.icons.primary = this.options.icon; + } + this._super(); + }, + + _setOption: function( key, value ) { + if ( key === "text" ) { + this._super( "showLabel", value ); + return; + } + if ( key === "showLabel" ) { + this.options.text = value; + } + if ( key === "icon" ) { + this.options.icons.primary = value; + } + if ( key === "icons" ) { + if ( value.primary ) { + this._super( "icon", value.primary ); + this._super( "iconPosition", "beginning" ); + } else if ( value.secondary ) { + this._super( "icon", value.secondary ); + this._super( "iconPosition", "end" ); + } + } + this._superApply( arguments ); + } + } ); + + $.fn.button = ( function( orig ) { + return function() { + if ( !this.length || ( this.length && this[ 0 ].tagName !== "INPUT" ) || + ( this.length && this[ 0 ].tagName === "INPUT" && ( + this.attr( "type" ) !== "checkbox" && this.attr( "type" ) !== "radio" + ) ) ) { + return orig.apply( this, arguments ); + } + if ( !$.ui.checkboxradio ) { + $.error( "Checkboxradio widget missing" ); + } + if ( arguments.length === 0 ) { + return this.checkboxradio( { + "icon": false + } ); + } + return this.checkboxradio.apply( this, arguments ); + }; + } )( $.fn.button ); + + $.fn.buttonset = function() { + if ( !$.ui.controlgroup ) { + $.error( "Controlgroup widget missing" ); + } + if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) { + return this.controlgroup.apply( this, + [ arguments[ 0 ], "items.button", arguments[ 2 ] ] ); + } + if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) { + return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] ); + } + if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) { + arguments[ 0 ].items = { + button: arguments[ 0 ].items + }; + } + return this.controlgroup.apply( this, arguments ); + }; +} + +var widgetsButton = $.ui.button; + + +// jscs:disable maximumLineLength +/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ +/*! + * jQuery UI Datepicker 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Datepicker +//>>group: Widgets +//>>description: Displays a calendar from an input or inline for selecting dates. +//>>docs: http://api.jqueryui.com/datepicker/ +//>>demos: http://jqueryui.com/datepicker/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/datepicker.css +//>>css.theme: ../../themes/base/theme.css + + + +$.extend( $.ui, { datepicker: { version: "1.12.1" } } ); + +var datepicker_instActive; + +function datepicker_getZindex( elem ) { + var position, value; + while ( elem.length && elem[ 0 ] !== document ) { + + // Ignore z-index if position is set to a value where z-index is ignored by the browser + // This makes behavior of this function consistent across browsers + // WebKit always returns auto if the element is positioned + position = elem.css( "position" ); + if ( position === "absolute" || position === "relative" || position === "fixed" ) { + + // IE returns 0 when zIndex is not specified + // other browsers return a string + // we ignore the case of nested elements with an explicit value of 0 + // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> + value = parseInt( elem.css( "zIndex" ), 10 ); + if ( !isNaN( value ) && value !== 0 ) { + return value; + } + } + elem = elem.parent(); + } + + return 0; +} +/* Date picker manager. + Use the singleton instance of this class, $.datepicker, to interact with the date picker. + Settings for (groups of) date pickers are maintained in an instance object, + allowing multiple different settings on the same page. */ + +function Datepicker() { + this._curInst = null; // The current instance in use + this._keyEvent = false; // If the last event was a key event + this._disabledInputs = []; // List of date picker inputs that have been disabled + this._datepickerShowing = false; // True if the popup picker is showing , false if not + this._inDialog = false; // True if showing within a "dialog", false if not + this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division + this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class + this._appendClass = "ui-datepicker-append"; // The name of the append marker class + this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class + this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class + this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class + this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class + this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class + this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class + this.regional = []; // Available regional settings, indexed by language code + this.regional[ "" ] = { // Default regional settings + closeText: "Done", // Display text for close link + prevText: "Prev", // Display text for previous month link + nextText: "Next", // Display text for next month link + currentText: "Today", // Display text for current month link + monthNames: [ "January","February","March","April","May","June", + "July","August","September","October","November","December" ], // Names of months for drop-down and formatting + monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting + dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting + dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting + dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday + weekHeader: "Wk", // Column header for week of the year + dateFormat: "mm/dd/yy", // See format options on parseDate + firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... + isRTL: false, // True if right-to-left language, false if left-to-right + showMonthAfterYear: false, // True if the year select precedes month, false for month then year + yearSuffix: "" // Additional text to append to the year in the month headers + }; + this._defaults = { // Global defaults for all the date picker instances + showOn: "focus", // "focus" for popup on focus, + // "button" for trigger button, or "both" for either + showAnim: "fadeIn", // Name of jQuery animation for popup + showOptions: {}, // Options for enhanced animations + defaultDate: null, // Used when field is blank: actual date, + // +/-number for offset from today, null for today + appendText: "", // Display text following the input box, e.g. showing the format + buttonText: "...", // Text for trigger button + buttonImage: "", // URL for trigger button image + buttonImageOnly: false, // True if the image appears alone, false if it appears on a button + hideIfNoPrevNext: false, // True to hide next/previous month links + // if not applicable, false to just disable them + navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links + gotoCurrent: false, // True if today link goes back to current selection instead + changeMonth: false, // True if month can be selected directly, false if only prev/next + changeYear: false, // True if year can be selected directly, false if only prev/next + yearRange: "c-10:c+10", // Range of years to display in drop-down, + // either relative to today's year (-nn:+nn), relative to currently displayed year + // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) + showOtherMonths: false, // True to show dates in other months, false to leave blank + selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable + showWeek: false, // True to show week of the year, false to not show it + calculateWeek: this.iso8601Week, // How to calculate the week of the year, + // takes a Date and returns the number of the week for it + shortYearCutoff: "+10", // Short year values < this are in the current century, + // > this are in the previous century, + // string value starting with "+" for current year + value + minDate: null, // The earliest selectable date, or null for no limit + maxDate: null, // The latest selectable date, or null for no limit + duration: "fast", // Duration of display/closure + beforeShowDay: null, // Function that takes a date and returns an array with + // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", + // [2] = cell title (optional), e.g. $.datepicker.noWeekends + beforeShow: null, // Function that takes an input field and + // returns a set of custom settings for the date picker + onSelect: null, // Define a callback function when a date is selected + onChangeMonthYear: null, // Define a callback function when the month or year is changed + onClose: null, // Define a callback function when the datepicker is closed + numberOfMonths: 1, // Number of months to show at a time + showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) + stepMonths: 1, // Number of months to step back/forward + stepBigMonths: 12, // Number of months to step back/forward for the big links + altField: "", // Selector for an alternate field to store selected dates into + altFormat: "", // The date format to use for the alternate field + constrainInput: true, // The input is constrained by the current date format + showButtonPanel: false, // True to show button panel, false to not show it + autoSize: false, // True to size the input for the date format, false to leave as is + disabled: false // The initial disabled state + }; + $.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, { + /* Class name added to elements to indicate already configured with a date picker. */ + markerClassName: "hasDatepicker", + + //Keep track of the maximum number of rows displayed (see #7043) + maxRows: 4, + + // TODO rename to "widget" when switching to widget factory + _widgetDatepicker: function() { + return this.dpDiv; + }, + + /* Override the default settings for all instances of the date picker. + * @param settings object - the new settings to use as defaults (anonymous object) + * @return the manager object + */ + setDefaults: function( settings ) { + datepicker_extendRemove( this._defaults, settings || {} ); + return this; + }, + + /* Attach the date picker to a jQuery selection. + * @param target element - the target input field or division or span + * @param settings object - the new settings to use for this date picker instance (anonymous) + */ + _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 ); + } + }, + + /* Create a new instance object. */ + _newInst: function( target, inline ) { + var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars + return { id: id, input: target, // associated target + selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection + drawMonth: 0, drawYear: 0, // month being drawn + inline: inline, // is datepicker inline or not + dpDiv: ( !inline ? this.dpDiv : // presentation div + datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; + }, + + /* Attach the date picker to an input field. */ + _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 disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) + if ( inst.settings.disabled ) { + this._disableDatepicker( target ); + } + }, + + /* Make attachments based on settings. */ + _attachments: function( input, inst ) { + var showOn, buttonText, buttonImage, + appendText = this._get( inst, "appendText" ), + isRTL = this._get( inst, "isRTL" ); + + if ( inst.append ) { + inst.append.remove(); + } + if ( appendText ) { + inst.append = $( "<span class='" + this._appendClass + "'>" + appendText + "</span>" ); + input[ isRTL ? "before" : "after" ]( inst.append ); + } + + input.off( "focus", this._showDatepicker ); + + if ( inst.trigger ) { + inst.trigger.remove(); + } + + showOn = this._get( inst, "showOn" ); + if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field + input.on( "focus", this._showDatepicker ); + } + if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked + buttonText = this._get( inst, "buttonText" ); + buttonImage = this._get( inst, "buttonImage" ); + inst.trigger = $( this._get( inst, "buttonImageOnly" ) ? + $( "<img/>" ).addClass( this._triggerClass ). + attr( { src: buttonImage, alt: buttonText, title: buttonText } ) : + $( "<button type='button'></button>" ).addClass( this._triggerClass ). + html( !buttonImage ? buttonText : $( "<img/>" ).attr( + { src:buttonImage, alt:buttonText, title:buttonText } ) ) ); + input[ isRTL ? "before" : "after" ]( inst.trigger ); + inst.trigger.on( "click", function() { + if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) { + $.datepicker._hideDatepicker(); + } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) { + $.datepicker._hideDatepicker(); + $.datepicker._showDatepicker( input[ 0 ] ); + } else { + $.datepicker._showDatepicker( input[ 0 ] ); + } + return false; + } ); + } + }, + + /* Apply the maximum length for the date format. */ + _autoSize: function( inst ) { + if ( this._get( inst, "autoSize" ) && !inst.inline ) { + var findMax, max, maxI, i, + date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits + 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 ); + } + }, + + /* Attach an inline date picker to a div. */ + _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 disabled option is true, disable the datepicker before showing it (see ticket #5665) + if ( inst.settings.disabled ) { + this._disableDatepicker( target ); + } + + // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements + // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height + inst.dpDiv.css( "display", "block" ); + }, + + /* Pop-up the date picker in a "dialog" box. + * @param input element - ignored + * @param date string or Date - the initial date to display + * @param onSelect function - the function to call when a date is selected + * @param settings object - update the dialog date picker instance's settings (anonymous object) + * @param pos int[2] - coordinates for the dialog's position within the screen or + * event - with x/y coordinates or + * leave empty for default (screen centre) + * @return the manager object + */ + _dialogDatepicker: function( input, date, onSelect, settings, pos ) { + var id, browserWidth, browserHeight, scrollX, scrollY, + inst = this._dialogInst; // internal instance + + 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 = // should use actual width/height below + [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ]; + } + + // Move input on screen for focus, but hidden behind dialog + 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; + }, + + /* Detach a datepicker from its control. + * @param target element - the target input field or division or span + */ + _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; + } + }, + + /* Enable the date picker to a jQuery selection. + * @param target element - the target input field or division or span + */ + _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 ); } ); // delete entry + }, + + /* Disable the date picker to a jQuery selection. + * @param target element - the target input field or division or span + */ + _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 ); } ); // delete entry + this._disabledInputs[ this._disabledInputs.length ] = target; + }, + + /* Is the first field in a jQuery collection disabled as a datepicker? + * @param target element - the target input field or division or span + * @return boolean - true if disabled, false if enabled + */ + _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; + }, + + /* Retrieve the instance data for the target control. + * @param target element - the target input field or division or span + * @return object - the associated instance data + * @throws error if a jQuery problem getting data + */ + _getInst: function( target ) { + try { + return $.data( target, "datepicker" ); + } + catch ( err ) { + throw "Missing instance data for this datepicker"; + } + }, + + /* Update or retrieve the settings for a date picker attached to an input field or division. + * @param target element - the target input field or division or span + * @param name object - the new settings to update or + * string - the name of the setting to change or retrieve, + * when retrieving also "all" for all instance settings or + * "defaults" for all global defaults + * @param value any - the new value for the setting + * (omit if above is an object or to retrieve a value) + */ + _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 ); + + // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided + 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 ); + } + }, + + // Change method deprecated + _changeDatepicker: function( target, name, value ) { + this._optionDatepicker( target, name, value ); + }, + + /* Redraw the date picker attached to an input field or division. + * @param target element - the target input field or division or span + */ + _refreshDatepicker: function( target ) { + var inst = this._getInst( target ); + if ( inst ) { + this._updateDatepicker( inst ); + } + }, + + /* Set the dates for a jQuery selection. + * @param target element - the target input field or division or span + * @param date Date - the new date + */ + _setDateDatepicker: function( target, date ) { + var inst = this._getInst( target ); + if ( inst ) { + this._setDate( inst, date ); + this._updateDatepicker( inst ); + this._updateAlternate( inst ); + } + }, + + /* Get the date(s) for the first entry in a jQuery selection. + * @param target element - the target input field or division or span + * @param noDefault boolean - true if no default date is to be used + * @return Date - the current date + */ + _getDateDatepicker: function( target, noDefault ) { + var inst = this._getInst( target ); + if ( inst && !inst.inline ) { + this._setDateFromField( inst, noDefault ); + } + return ( inst ? this._getDate( inst ) : null ); + }, + + /* Handle keystrokes. */ + _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; // hide on tab out + 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 ); + + // Trigger custom callback + onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); + } else { + $.datepicker._hideDatepicker(); + } + + return false; // don't submit the form + case 27: $.datepicker._hideDatepicker(); + break; // hide on escape + case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? + -$.datepicker._get( inst, "stepBigMonths" ) : + -$.datepicker._get( inst, "stepMonths" ) ), "M" ); + break; // previous month/year on page up/+ ctrl + case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? + +$.datepicker._get( inst, "stepBigMonths" ) : + +$.datepicker._get( inst, "stepMonths" ) ), "M" ); + break; // next month/year on page down/+ ctrl + case 35: if ( event.ctrlKey || event.metaKey ) { + $.datepicker._clearDate( event.target ); + } + handled = event.ctrlKey || event.metaKey; + break; // clear on ctrl or command +end + case 36: if ( event.ctrlKey || event.metaKey ) { + $.datepicker._gotoToday( event.target ); + } + handled = event.ctrlKey || event.metaKey; + break; // current on ctrl or command +home + case 37: if ( event.ctrlKey || event.metaKey ) { + $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); + } + handled = event.ctrlKey || event.metaKey; + + // -1 day on ctrl or command +left + if ( event.originalEvent.altKey ) { + $.datepicker._adjustDate( event.target, ( event.ctrlKey ? + -$.datepicker._get( inst, "stepBigMonths" ) : + -$.datepicker._get( inst, "stepMonths" ) ), "M" ); + } + + // next month/year on alt +left on Mac + break; + case 38: if ( event.ctrlKey || event.metaKey ) { + $.datepicker._adjustDate( event.target, -7, "D" ); + } + handled = event.ctrlKey || event.metaKey; + break; // -1 week on ctrl or command +up + case 39: if ( event.ctrlKey || event.metaKey ) { + $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); + } + handled = event.ctrlKey || event.metaKey; + + // +1 day on ctrl or command +right + if ( event.originalEvent.altKey ) { + $.datepicker._adjustDate( event.target, ( event.ctrlKey ? + +$.datepicker._get( inst, "stepBigMonths" ) : + +$.datepicker._get( inst, "stepMonths" ) ), "M" ); + } + + // next month/year on alt +right + break; + case 40: if ( event.ctrlKey || event.metaKey ) { + $.datepicker._adjustDate( event.target, +7, "D" ); + } + handled = event.ctrlKey || event.metaKey; + break; // +1 week on ctrl or command +down + default: handled = false; + } + } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home + $.datepicker._showDatepicker( this ); + } else { + handled = false; + } + + if ( handled ) { + event.preventDefault(); + event.stopPropagation(); + } + }, + + /* Filter entered characters - based on date format. */ + _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 ); + } + }, + + /* Synchronise manual entry and field/alternate field. */ + _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 ) { // only if valid + $.datepicker._setDateFromField( inst ); + $.datepicker._updateAlternate( inst ); + $.datepicker._updateDatepicker( inst ); + } + } + catch ( err ) { + } + } + return true; + }, + + /* Pop-up the date picker for a given input field. + * If false returned from beforeShow event handler do not show. + * @param input element - the input field attached to the date picker or + * event - if triggered by focus + */ + _showDatepicker: function( input ) { + input = input.target || input; + if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger + input = $( "input", input.parentNode )[ 0 ]; + } + + if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here + 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 ) { // hide cursor + input.value = ""; + } + if ( !$.datepicker._pos ) { // position below input + $.datepicker._pos = $.datepicker._findPos( input ); + $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height + } + + 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; + + //to avoid flashes on Firefox + inst.dpDiv.empty(); + + // determine sizing offscreen + inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } ); + $.datepicker._updateDatepicker( inst ); + + // fix width for dynamic number of date pickers + // and adjust position before showing + 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; + } + }, + + /* Generate the date picker content. */ + _updateDatepicker: function( inst ) { + this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) + datepicker_instActive = inst; // for delegate hover events + inst.dpDiv.empty().append( this._generateHTML( inst ) ); + this._attachHandlers( inst ); + + var origyearshtml, + numMonths = this._getNumberOfMonths( inst ), + cols = numMonths[ 1 ], + width = 17, + activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ); + + if ( activeCell.length > 0 ) { + datepicker_handleMouseover.apply( activeCell.get( 0 ) ); + } + + inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); + if ( cols > 1 ) { + inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); + } + inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + + "Class" ]( "ui-datepicker-multi" ); + inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + + "Class" ]( "ui-datepicker-rtl" ); + + if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { + inst.input.trigger( "focus" ); + } + + // Deffered render of the years select (to avoid flashes on Firefox) + if ( inst.yearshtml ) { + origyearshtml = inst.yearshtml; + setTimeout( function() { + + //assure that inst.yearshtml didn't change. + if ( origyearshtml === inst.yearshtml && inst.yearshtml ) { + inst.dpDiv.find( "select.ui-datepicker-year:first" ).replaceWith( inst.yearshtml ); + } + origyearshtml = inst.yearshtml = null; + }, 0 ); + } + }, + + // #6694 - don't focus the input if it's already focused + // this breaks the change event in IE + // Support: IE and jQuery <1.9 + _shouldFocusInput: function( inst ) { + return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); + }, + + /* Check positioning to remain on screen. */ + _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; + + // Now check if datepicker is showing outside window viewport - move to a better place if so. + 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; + }, + + /* Find an object's position on the screen. */ + _findPos: function( obj ) { + var position, + inst = this._getInst( obj ), + isRTL = this._get( inst, "isRTL" ); + + while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden( obj ) ) ) { + obj = obj[ isRTL ? "previousSibling" : "nextSibling" ]; + } + + position = $( obj ).offset(); + return [ position.left, position.top ]; + }, + + /* Hide the date picker from view. + * @param input element - the input field attached to the date picker + */ + _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 ); + }; + + // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed + 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; + } + }, + + /* Tidy up after a dialog display. */ + _tidyDialog: function( inst ) { + inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" ); + }, + + /* Close date picker if clicked elsewhere. */ + _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(); + } + }, + + /* Adjust one of the date sub-fields. */ + _adjustDate: function( id, offset, period ) { + var target = $( id ), + inst = this._getInst( target[ 0 ] ); + + if ( this._isDisabledDatepicker( target[ 0 ] ) ) { + return; + } + this._adjustInstDate( inst, offset + + ( period === "M" ? this._get( inst, "showCurrentAtPos" ) : 0 ), // undo positioning + period ); + this._updateDatepicker( inst ); + }, + + /* Action for current link. */ + _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 ); + }, + + /* Action for selecting a new month/year. */ + _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 ); + }, + + /* Action for selecting a day. */ + _selectDay: function( id, month, year, td ) { + var inst, + target = $( id ); + + if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) { + return; + } + + inst = this._getInst( target[ 0 ] ); + inst.selectedDay = inst.currentDay = $( "a", td ).html(); + inst.selectedMonth = inst.currentMonth = month; + inst.selectedYear = inst.currentYear = year; + this._selectDate( id, this._formatDate( inst, + inst.currentDay, inst.currentMonth, inst.currentYear ) ); + }, + + /* Erase the input field and hide the date picker. */ + _clearDate: function( id ) { + var target = $( id ); + this._selectDate( target, "" ); + }, + + /* Update the input field with the selected date. */ + _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 ] ); // trigger custom callback + } else if ( inst.input ) { + inst.input.trigger( "change" ); // fire the change event + } + + if ( inst.inline ) { + this._updateDatepicker( inst ); + } else { + this._hideDatepicker(); + this._lastInput = inst.input[ 0 ]; + if ( typeof( inst.input[ 0 ] ) !== "object" ) { + inst.input.trigger( "focus" ); // restore focus + } + this._lastInput = null; + } + }, + + /* Update any alternate field to synchronise with the main field. */ + _updateAlternate: function( inst ) { + var altFormat, date, dateStr, + altField = this._get( inst, "altField" ); + + if ( altField ) { // update alternate field too + altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" ); + date = this._getDate( inst ); + dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) ); + $( altField ).val( dateStr ); + } + }, + + /* Set as beforeShowDay function to prevent selection of weekends. + * @param date Date - the date to customise + * @return [boolean, string] - is this date selectable?, what is its CSS class? + */ + noWeekends: function( date ) { + var day = date.getDay(); + return [ ( day > 0 && day < 6 ), "" ]; + }, + + /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. + * @param date Date - the date to get the week for + * @return number - the number of the week within the year that contains this date + */ + iso8601Week: function( date ) { + var time, + checkDate = new Date( date.getTime() ); + + // Find Thursday of this week starting on Monday + checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) ); + + time = checkDate.getTime(); + checkDate.setMonth( 0 ); // Compare with Jan 1 + checkDate.setDate( 1 ); + return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1; + }, + + /* Parse a string value into a date object. + * See formatDate below for the possible formats. + * + * @param format string - the expected format of the date + * @param value string - the date in the above format + * @param settings Object - attributes include: + * shortYearCutoff number - the cutoff year for determining the century (optional) + * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + * dayNames string[7] - names of the days from Sunday (optional) + * monthNamesShort string[12] - abbreviated names of the months (optional) + * monthNames string[12] - names of the months (optional) + * @return Date - the extracted date value or null if value is blank + */ + 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, + + // Check whether a format character is doubled + lookAhead = function( match ) { + var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); + if ( matches ) { + iFormat++; + } + return matches; + }, + + // Extract a number from the string value + 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 ); + }, + + // Extract a name from the string value and convert to an index + 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; + } + }, + + // Confirm that a literal character matches the string value + 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"; // E.g. 31/02/00 + } + return date; + }, + + /* Standard date formats. */ + ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) + 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", // RFC 822 + TICKS: "!", + TIMESTAMP: "@", + W3C: "yy-mm-dd", // ISO 8601 + + _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) + + Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ), + + /* Format a date object into a string value. + * The format can be combinations of the following: + * d - day of month (no leading zero) + * dd - day of month (two digit) + * o - day of year (no leading zeros) + * oo - day of year (three digit) + * D - day name short + * DD - day name long + * m - month of year (no leading zero) + * mm - month of year (two digit) + * M - month name short + * MM - month name long + * y - year (two digit) + * yy - year (four digit) + * @ - Unix timestamp (ms since 01/01/1970) + * ! - Windows ticks (100ns since 01/01/0001) + * "..." - literal text + * '' - single quote + * + * @param format string - the desired format of the date + * @param date Date - the date value to format + * @param settings Object - attributes include: + * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + * dayNames string[7] - names of the days from Sunday (optional) + * monthNamesShort string[12] - abbreviated names of the months (optional) + * monthNames string[12] - names of the months (optional) + * @return string - the date in the above format + */ + 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, + + // Check whether a format character is doubled + lookAhead = function( match ) { + var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); + if ( matches ) { + iFormat++; + } + return matches; + }, + + // Format a number, with leading zero if necessary + formatNumber = function( match, value, len ) { + var num = "" + value; + if ( lookAhead( match ) ) { + while ( num.length < len ) { + num = "0" + num; + } + } + return num; + }, + + // Format a name, short or long as requested + 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; + }, + + /* Extract all possible characters from the date format. */ + _possibleChars: function( format ) { + var iFormat, + chars = "", + literal = false, + + // Check whether a format character is doubled + 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; // Accept anything + case "'": + if ( lookAhead( "'" ) ) { + chars += "'"; + } else { + literal = true; + } + break; + default: + chars += format.charAt( iFormat ); + } + } + } + return chars; + }, + + /* Get a setting value, defaulting if necessary. */ + _get: function( inst, name ) { + return inst.settings[ name ] !== undefined ? + inst.settings[ name ] : this._defaults[ name ]; + }, + + /* Parse existing date and initialise date picker. */ + _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 ); + }, + + /* Retrieve the default date shown on opening. */ + _getDefaultDate: function( inst ) { + return this._restrictMinMax( inst, + this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) ); + }, + + /* A date may be specified as an exact value or a relative one. */ + _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 ) { + + // Ignore + } + + 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 ); + }, + + /* Handle switch to/from daylight saving. + * Hours may be non-zero on daylight saving cut-over: + * > 12 when midnight changeover, but then cannot generate + * midnight datetime, so jump to 1AM, otherwise reset. + * @param date (Date) the date to check + * @return (Date) the corrected date + */ + _daylightSavingAdjust: function( date ) { + if ( !date ) { + return null; + } + date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 ); + return date; + }, + + /* Set the date(s) directly. */ + _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 ) ); + } + }, + + /* Retrieve the date(s) directly. */ + _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; + }, + + /* Attach the onxxx handlers. These are declared statically so + * they work with static code transformers like Caja. + */ + _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" ) ] ); + } ); + }, + + /* Generate the HTML for the current state of the date picker. */ + _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() ) ), // clear time + isRTL = this._get( inst, "isRTL" ), + showButtonPanel = this._get( inst, "showButtonPanel" ), + hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ), + navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ), + numMonths = this._getNumberOfMonths( inst ), + showCurrentAtPos = this._get( inst, "showCurrentAtPos" ), + stepMonths = this._get( inst, "stepMonths" ), + isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ), + currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) : + new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ), + minDate = this._getMinMaxDate( inst, "min" ), + maxDate = this._getMinMaxDate( inst, "max" ), + drawMonth = inst.drawMonth - showCurrentAtPos, + drawYear = inst.drawYear; + + if ( drawMonth < 0 ) { + drawMonth += 12; + drawYear--; + } + if ( maxDate ) { + maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(), + maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) ); + maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw ); + while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) { + drawMonth--; + if ( drawMonth < 0 ) { + drawMonth = 11; + drawYear--; + } + } + } + inst.drawMonth = drawMonth; + inst.drawYear = drawYear; + + prevText = this._get( inst, "prevText" ); + prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText, + this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ), + this._getFormatConfig( inst ) ) ); + + prev = ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ? + "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" + + " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" : + ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" ) ); + + nextText = this._get( inst, "nextText" ); + nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText, + this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ), + this._getFormatConfig( inst ) ) ); + + next = ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ? + "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" + + " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" : + ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" ) ); + + currentText = this._get( inst, "currentText" ); + gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today ); + currentText = ( !navigationAsDateFormat ? currentText : + this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) ); + + controls = ( !inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" + + this._get( inst, "closeText" ) + "</button>" : "" ); + + buttonPanel = ( showButtonPanel ) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + ( isRTL ? controls : "" ) + + ( this._isInRange( inst, gotoDate ) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" + + ">" + currentText + "</button>" : "" ) + ( isRTL ? "" : controls ) + "</div>" : ""; + + firstDay = parseInt( this._get( inst, "firstDay" ), 10 ); + firstDay = ( isNaN( firstDay ) ? 0 : firstDay ); + + showWeek = this._get( inst, "showWeek" ); + dayNames = this._get( inst, "dayNames" ); + dayNamesMin = this._get( inst, "dayNamesMin" ); + monthNames = this._get( inst, "monthNames" ); + monthNamesShort = this._get( inst, "monthNamesShort" ); + beforeShowDay = this._get( inst, "beforeShowDay" ); + showOtherMonths = this._get( inst, "showOtherMonths" ); + selectOtherMonths = this._get( inst, "selectOtherMonths" ); + defaultDate = this._getDefaultDate( inst ); + html = ""; + + for ( row = 0; row < numMonths[ 0 ]; row++ ) { + group = ""; + this.maxRows = 4; + for ( col = 0; col < numMonths[ 1 ]; col++ ) { + selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) ); + cornerClass = " ui-corner-all"; + calender = ""; + if ( isMultiMonth ) { + calender += "<div class='ui-datepicker-group"; + if ( numMonths[ 1 ] > 1 ) { + switch ( col ) { + case 0: calender += " ui-datepicker-group-first"; + cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break; + case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last"; + cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break; + default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; + } + } + calender += "'>"; + } + calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + + ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + + ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + + this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, + row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers + "</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++ ) { // days of the week + 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 ); // calculate the number of rows to generate + numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043) + this.maxRows = numRows; + printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) ); + for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows + calender += "<tr>"; + tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" + + this._get( inst, "calculateWeek" )( printDate ) + "</td>" ); + for ( dow = 0; dow < 7; dow++ ) { // create date picker days + 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" : "" ) + // highlight weekends + ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months + ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key + ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? + + // or defaultDate is current printedDate and defaultDate is selectedDate + " " + this._dayOverClass : "" ) + // highlight selected day + ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days + ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates + ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day + ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) + ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title + ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions + ( otherMonth && !showOtherMonths ? " " : // display for other months + ( 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" : "" ) + // highlight selected day + ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months + "' href='#'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date + 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; + }, + + /* Generate the month and year header. */ + _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, + secondary, monthNames, monthNamesShort ) { + + var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, + changeMonth = this._get( inst, "changeMonth" ), + changeYear = this._get( inst, "changeYear" ), + showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), + html = "<div class='ui-datepicker-title'>", + monthHtml = ""; + + // Month selection + if ( secondary || !changeMonth ) { + monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>"; + } else { + inMinYear = ( minDate && minDate.getFullYear() === drawYear ); + inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); + monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>"; + for ( month = 0; month < 12; month++ ) { + if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { + monthHtml += "<option value='" + month + "'" + + ( month === drawMonth ? " selected='selected'" : "" ) + + ">" + monthNamesShort[ month ] + "</option>"; + } + } + monthHtml += "</select>"; + } + + if ( !showMonthAfterYear ) { + html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" ); + } + + // Year selection + if ( !inst.yearshtml ) { + inst.yearshtml = ""; + if ( secondary || !changeYear ) { + html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; + } else { + + // determine range of years to display + years = this._get( inst, "yearRange" ).split( ":" ); + thisYear = new Date().getFullYear(); + determineYear = function( value ) { + var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : + ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : + parseInt( value, 10 ) ) ); + return ( isNaN( year ) ? thisYear : year ); + }; + year = determineYear( years[ 0 ] ); + endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); + year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); + endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear ); + inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>"; + for ( ; year <= endYear; year++ ) { + inst.yearshtml += "<option value='" + year + "'" + + ( year === drawYear ? " selected='selected'" : "" ) + + ">" + year + "</option>"; + } + inst.yearshtml += "</select>"; + + html += inst.yearshtml; + inst.yearshtml = null; + } + } + + html += this._get( inst, "yearSuffix" ); + if ( showMonthAfterYear ) { + html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml; + } + html += "</div>"; // Close datepicker_header + return html; + }, + + /* Adjust one of the date sub-fields. */ + _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 ); + } + }, + + /* Ensure a date is within any min/max bounds. */ + _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 ); + }, + + /* Notify change of month/year. */ + _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 ] ); + } + }, + + /* Determine the number of months to show. */ + _getNumberOfMonths: function( inst ) { + var numMonths = this._get( inst, "numberOfMonths" ); + return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); + }, + + /* Determine the current maximum date - ensure no time components are set. */ + _getMinMaxDate: function( inst, minMax ) { + return this._determineDate( inst, this._get( inst, minMax + "Date" ), null ); + }, + + /* Find the number of days in a given month. */ + _getDaysInMonth: function( year, month ) { + return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate(); + }, + + /* Find the day of the week of the first of a month. */ + _getFirstDayOfMonth: function( year, month ) { + return new Date( year, month, 1 ).getDay(); + }, + + /* Determines if we should allow a "next/prev" month display change. */ + _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 ); + }, + + /* Is the given date in the accepted range? */ + _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 ) ); + }, + + /* Provide the configuration settings for formatting/parsing. */ + _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" ) }; + }, + + /* Format the given date for display. */ + _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 ) ); + } +} ); + +/* + * Bind hover events for datepicker elements. + * Done via delegate so the binding only occurs once in the lifetime of the parent div. + * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. + */ +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" ); + } + } +} + +/* jQuery extend now ignores nulls! */ +function datepicker_extendRemove( target, props ) { + $.extend( target, props ); + for ( var name in props ) { + if ( props[ name ] == null ) { + target[ name ] = props[ name ]; + } + } + return target; +} + +/* Invoke the datepicker functionality. + @param options string - a command, optionally followed by additional parameters or + Object - settings for attaching new datepicker functionality + @return jQuery object */ +$.fn.datepicker = function( options ) { + + /* Verify an empty collection wasn't passed - Fixes #6976 */ + if ( !this.length ) { + return this; + } + + /* Initialise the date picker. */ + if ( !$.datepicker.initialized ) { + $( document ).on( "mousedown", $.datepicker._checkExternalClick ); + $.datepicker.initialized = true; + } + + /* Append datepicker main container to body if not exist. */ + if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { + $( "body" ).append( $.datepicker.dpDiv ); + } + + var otherArgs = Array.prototype.slice.call( arguments, 1 ); + if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { + return $.datepicker[ "_" + options + "Datepicker" ]. + apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); + } + if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { + return $.datepicker[ "_" + options + "Datepicker" ]. + apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); + } + return this.each( function() { + typeof options === "string" ? + $.datepicker[ "_" + options + "Datepicker" ]. + apply( $.datepicker, [ this ].concat( otherArgs ) ) : + $.datepicker._attachDatepicker( this, options ); + } ); +}; + +$.datepicker = new Datepicker(); // singleton instance +$.datepicker.initialized = false; +$.datepicker.uuid = new Date().getTime(); +$.datepicker.version = "1.12.1"; + +var widgetsDatepicker = $.datepicker; + + + + +// This file is deprecated +var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); + +/*! + * jQuery UI Mouse 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Mouse +//>>group: Widgets +//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. +//>>docs: http://api.jqueryui.com/mouse/ + + + +var mouseHandled = false; +$( document ).on( "mouseup", function() { + mouseHandled = false; +} ); + +var widgetsMouse = $.widget( "ui.mouse", { + version: "1.12.1", + 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; + }, + + // TODO: make sure destroying one instance of mouse doesn't mess with + // other instances of mouse + _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 ) { + + // don't let more than one widget handle mouseStart + if ( mouseHandled ) { + return; + } + + this._mouseMoved = false; + + // We may have missed mouseup (out of window) + ( this._mouseStarted && this._mouseUp( event ) ); + + this._mouseDownEvent = event; + + var that = this, + btnIsLeft = ( event.which === 1 ), + + // event.target.nodeName works around a bug in IE 8 with + // disabled inputs (#7620) + 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; + } + } + + // Click event may never have fired (Gecko & Opera) + if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { + $.removeData( event.target, this.widgetName + ".preventClickEvent" ); + } + + // These delegates are required to keep context + 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 ) { + + // Only check for mouseups outside the document if you've moved inside the document + // at least once. This prevents the firing of mouseup in the case of IE<9, which will + // fire a mousemove event if content is placed under the cursor. See #7778 + // Support: IE <9 + if ( this._mouseMoved ) { + + // IE mouseup check - mouseup happened when mouse was out of window + if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && + !event.button ) { + return this._mouseUp( event ); + + // Iframe mouseup check - mouseup occurred in another document + } else if ( !event.which ) { + + // Support: Safari <=8 - 9 + // Safari sets which to 0 if you press any of the following keys + // during a drag (#14461) + if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || + event.originalEvent.metaKey || event.originalEvent.shiftKey ) { + this.ignoreMissingWhich = true; + } else if ( !this.ignoreMissingWhich ) { + return this._mouseUp( event ); + } + } + } + + if ( event.which || event.button ) { + this._mouseMoved = true; + } + + if ( this._mouseStarted ) { + this._mouseDrag( event ); + return event.preventDefault(); + } + + if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { + this._mouseStarted = + ( this._mouseStart( this._mouseDownEvent, event ) !== false ); + ( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) ); + } + + return !this._mouseStarted; + }, + + _mouseUp: function( event ) { + this.document + .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) + .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); + + if ( this._mouseStarted ) { + this._mouseStarted = false; + + if ( event.target === this._mouseDownEvent.target ) { + $.data( event.target, this.widgetName + ".preventClickEvent", true ); + } + + this._mouseStop( event ); + } + + if ( this._mouseDelayTimer ) { + clearTimeout( this._mouseDelayTimer ); + delete this._mouseDelayTimer; + } + + this.ignoreMissingWhich = false; + mouseHandled = false; + event.preventDefault(); + }, + + _mouseDistanceMet: function( event ) { + return ( Math.max( + Math.abs( this._mouseDownEvent.pageX - event.pageX ), + Math.abs( this._mouseDownEvent.pageY - event.pageY ) + ) >= this.options.distance + ); + }, + + _mouseDelayMet: function( /* event */ ) { + return this.mouseDelayMet; + }, + + // These are placeholder methods, to be overriden by extending plugin + _mouseStart: function( /* event */ ) {}, + _mouseDrag: function( /* event */ ) {}, + _mouseStop: function( /* event */ ) {}, + _mouseCapture: function( /* event */ ) { return true; } +} ); + + + + +// $.ui.plugin is deprecated. Use $.widget() extensions instead. +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 ) { + + // Support: IE9 - 10 only + // If the <body> is blurred, IE will switch windows, see #9420 + if ( element && element.nodeName.toLowerCase() !== "body" ) { + $( element ).trigger( "blur" ); + } +}; + + +/*! + * jQuery UI Draggable 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Draggable +//>>group: Interactions +//>>description: Enables dragging functionality for any element. +//>>docs: http://api.jqueryui.com/draggable/ +//>>demos: http://jqueryui.com/draggable/ +//>>css.structure: ../../themes/base/draggable.css + + + +$.widget( "ui.draggable", $.ui.mouse, { + version: "1.12.1", + 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, + + // Callbacks + 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; + + // Among others, prevent a drag on a resizable-handle + if ( this.helper || o.disabled || + $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { + return false; + } + + //Quit if we're not on a valid handle + 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 ); + + // Don't blur if the event occurred on an element that is within + // the currently focused element + // See #10527, #12472 + if ( target.closest( activeElement ).length ) { + return; + } + + // Blur any element that currently has focus, see #4261 + $.ui.safeBlur( activeElement ); + }, + + _mouseStart: function( event ) { + + var o = this.options; + + //Create and append the visible helper + this.helper = this._createHelper( event ); + + this._addClass( this.helper, "ui-draggable-dragging" ); + + //Cache the helper size + this._cacheHelperProportions(); + + //If ddmanager is used for droppables, set the global draggable + if ( $.ui.ddmanager ) { + $.ui.ddmanager.current = this; + } + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //Store the helper's css position + 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; + + //The element's absolute position on the page minus margins + this.positionAbs = this.element.offset(); + this._refreshOffsets( event ); + + //Generate the original position + this.originalPosition = this.position = this._generatePosition( event, false ); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + + //Adjust the mouse offset relative to the helper if "cursorAt" is supplied + ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) ); + + //Set a containment if given in the options + this._setContainment(); + + //Trigger event + callbacks + if ( this._trigger( "start", event ) === false ) { + this._clear(); + return false; + } + + //Recache the helper size + this._cacheHelperProportions(); + + //Prepare the droppable offsets + if ( $.ui.ddmanager && !o.dropBehaviour ) { + $.ui.ddmanager.prepareOffsets( this, event ); + } + + // Execute the drag once - this causes the helper not to be visible before getting its + // correct position + this._mouseDrag( event, true ); + + // If the ddmanager is used for droppables, inform the manager that dragging has started + // (see #5003) + 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 ) { + + // reset any necessary cached properties (see #5009) + if ( this.hasFixedAncestor ) { + this.offset.parent = this._getParentOffset(); + } + + //Compute the helpers position + this.position = this._generatePosition( event, true ); + this.positionAbs = this._convertPositionTo( "absolute" ); + + //Call plugins and callbacks and use the resulting position if something is returned + 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 ) { + + //If we are using droppables, inform the manager about the drop + var that = this, + dropped = false; + if ( $.ui.ddmanager && !this.options.dropBehaviour ) { + dropped = $.ui.ddmanager.drop( this, event ); + } + + //if a drop comes from outside (a sortable) + if ( this.dropped ) { + dropped = this.dropped; + this.dropped = false; + } + + if ( ( this.options.revert === "invalid" && !dropped ) || + ( this.options.revert === "valid" && dropped ) || + this.options.revert === true || ( $.isFunction( this.options.revert ) && + this.options.revert.call( this.element, dropped ) ) + ) { + $( this.helper ).animate( + this.originalPosition, + parseInt( this.options.revertDuration, 10 ), + function() { + if ( that._trigger( "stop", event ) !== false ) { + that._clear(); + } + } + ); + } else { + if ( this._trigger( "stop", event ) !== false ) { + this._clear(); + } + } + + return false; + }, + + _mouseUp: function( event ) { + this._unblockFrames(); + + // If the ddmanager is used for droppables, inform the manager that dragging has stopped + // (see #5003) + if ( $.ui.ddmanager ) { + $.ui.ddmanager.dragStop( this, event ); + } + + // Only need to focus if the event occurred on the draggable itself, see #10527 + if ( this.handleElement.is( event.target ) ) { + + // The interaction is over; whether or not the click resulted in a drag, + // focus the element + this.element.trigger( "focus" ); + } + + return $.ui.mouse.prototype._mouseUp.call( this, event ); + }, + + cancel: function() { + + if ( this.helper.is( ".ui-draggable-dragging" ) ) { + this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); + } else { + this._clear(); + } + + return this; + + }, + + _getHandle: function( event ) { + return this.options.handle ? + !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : + true; + }, + + _setHandleClassName: function() { + this.handleElement = this.options.handle ? + this.element.find( this.options.handle ) : this.element; + this._addClass( this.handleElement, "ui-draggable-handle" ); + }, + + _removeHandleClassName: function() { + this._removeClass( this.handleElement, "ui-draggable-handle" ); + }, + + _createHelper: function( event ) { + + var o = this.options, + helperIsFunction = $.isFunction( o.helper ), + helper = helperIsFunction ? + $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : + ( o.helper === "clone" ? + this.element.clone().removeAttr( "id" ) : + this.element ); + + if ( !helper.parents( "body" ).length ) { + helper.appendTo( ( o.appendTo === "parent" ? + this.element[ 0 ].parentNode : + o.appendTo ) ); + } + + // Http://bugs.jqueryui.com/ticket/9446 + // a helper function can return the original element + // which wouldn't have been set to relative in _create + if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { + this._setPositionRelative(); + } + + if ( helper[ 0 ] !== this.element[ 0 ] && + !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { + helper.css( "position", "absolute" ); + } + + return helper; + + }, + + _setPositionRelative: function() { + if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { + this.element[ 0 ].style.position = "relative"; + } + }, + + _adjustOffsetFromHelper: function( obj ) { + if ( typeof obj === "string" ) { + obj = obj.split( " " ); + } + if ( $.isArray( obj ) ) { + obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; + } + if ( "left" in obj ) { + this.offset.click.left = obj.left + this.margins.left; + } + if ( "right" in obj ) { + this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + } + if ( "top" in obj ) { + this.offset.click.top = obj.top + this.margins.top; + } + if ( "bottom" in obj ) { + this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + } + }, + + _isRootNode: function( element ) { + return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; + }, + + _getParentOffset: function() { + + //Get the offsetParent and cache its position + var po = this.offsetParent.offset(), + document = this.document[ 0 ]; + + // This is a special case where we need to modify a offset calculated on start, since the + // following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the + // next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't + // the document, which means that the scroll is included in the initial calculation of the + // offset of the parent, and never recalculated upon drag + 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: ( + + // The absolute mouse position + pos.top + + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.top * mod + + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.top * mod - + ( ( this.cssPosition === "fixed" ? + -this.offset.scroll.top : + ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) + ), + left: ( + + // The absolute mouse position + pos.left + + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.left * mod + + + // The offsetParent's offset without borders (offset + border) + 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; + + // Cache the scroll + if ( !scrollIsRootNode || !this.offset.scroll ) { + this.offset.scroll = { + top: this.scrollParent.scrollTop(), + left: this.scrollParent.scrollLeft() + }; + } + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + // If we are not dragging yet, we won't check for options + 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 ) { + + //Check for grid elements set to 0 to prevent divide by 0 error causing invalid + // argument errors in IE (see ticket #6950) + 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: ( + + // The absolute mouse position + pageY - + + // Click offset (relative to the element) + this.offset.click.top - + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.top - + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.top + + ( this.cssPosition === "fixed" ? + -this.offset.scroll.top : + ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) + ), + left: ( + + // The absolute mouse position + pageX - + + // Click offset (relative to the element) + this.offset.click.left - + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.left - + + // The offsetParent's offset without borders (offset + border) + 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(); + } + }, + + // From now on bulk stuff - mainly helpers + + _trigger: function( type, event, ui ) { + ui = ui || this._uiHash(); + $.ui.plugin.call( this, type, [ event, ui, this ], true ); + + // Absolute position and offset (see #6884 ) have to be recalculated after plugins + 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 ); + + // RefreshPositions is called at drag start to refresh the containerCache + // which is used in drag. This ensures it's initialized and synchronized + // with any changes that might have happened on the page since initialization. + 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; + + // Allow this sortable to handle removing the helper + draggable.cancelHelperRemoval = true; + sortable.cancelHelperRemoval = false; + + // Use _storedCSS To restore properties in the sortable, + // as this also handles revert (#9675) since the draggable + // may have modified them in unexpected ways (#8809) + sortable._storedCSS = { + position: sortable.placeholder.css( "position" ), + top: sortable.placeholder.css( "top" ), + left: sortable.placeholder.css( "left" ) + }; + + sortable._mouseStop( event ); + + // Once drag has ended, the sortable should return to using + // its original helper, not the shared helper from draggable + sortable.options.helper = sortable.options._helper; + } else { + + // Prevent this Sortable from removing the helper. + // However, don't set the draggable to remove the helper + // either as another connected Sortable may yet handle the removal. + sortable.cancelHelperRemoval = true; + + sortable._trigger( "deactivate", event, uiSortable ); + } + } ); + }, + drag: function( event, ui, draggable ) { + $.each( draggable.sortables, function() { + var innermostIntersecting = false, + sortable = this; + + // Copy over variables that sortable's _intersectsWith uses + 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() { + + // Copy over variables that sortable's _intersectsWith uses + 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 it intersects, we use a little isOver variable and set it once, + // so that the move-in stuff gets fired only once. + if ( !sortable.isOver ) { + sortable.isOver = 1; + + // Store draggable's parent in case we need to reappend to it later. + draggable._parent = ui.helper.parent(); + + sortable.currentItem = ui.helper + .appendTo( sortable.element ) + .data( "ui-sortable-item", true ); + + // Store helper option to later restore it + sortable.options._helper = sortable.options.helper; + + sortable.options.helper = function() { + return ui.helper[ 0 ]; + }; + + // Fire the start events of the sortable with our passed browser event, + // and our own helper (so it doesn't create a new one) + event.target = sortable.currentItem[ 0 ]; + sortable._mouseCapture( event, true ); + sortable._mouseStart( event, true, true ); + + // Because the browser event is way off the new appended portlet, + // modify necessary variables to reflect the changes + 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 ); + + // Inform draggable that the helper is in a valid drop zone, + // used solely in the revert option to handle "valid/invalid". + draggable.dropped = sortable.element; + + // Need to refreshPositions of all sortables in the case that + // adding to one sortable changes the location of the other sortables (#9675) + $.each( draggable.sortables, function() { + this.refreshPositions(); + } ); + + // Hack so receive/update callbacks work (mostly) + draggable.currentItem = draggable.element; + sortable.fromOutside = draggable; + } + + if ( sortable.currentItem ) { + sortable._mouseDrag( event ); + + // Copy the sortable's position because the draggable's can potentially reflect + // a relative position, while sortable is always absolute, which the dragged + // element has now become. (#8809) + ui.position = sortable.position; + } + } else { + + // If it doesn't intersect with the sortable, and it intersected before, + // we fake the drag stop of the sortable, but make sure it doesn't remove + // the helper by using cancelHelperRemoval. + if ( sortable.isOver ) { + + sortable.isOver = 0; + sortable.cancelHelperRemoval = true; + + // Calling sortable's mouseStop would trigger a revert, + // so revert must be temporarily false until after mouseStop is called. + sortable.options._revert = sortable.options.revert; + sortable.options.revert = false; + + sortable._trigger( "out", event, sortable._uiHash( sortable ) ); + sortable._mouseStop( event, true ); + + // Restore sortable behaviors that were modfied + // when the draggable entered the sortable area (#9481) + sortable.options.revert = sortable.options._revert; + sortable.options.helper = sortable.options._helper; + + if ( sortable.placeholder ) { + sortable.placeholder.remove(); + } + + // Restore and recalculate the draggable's offset considering the sortable + // may have modified them in unexpected ways. (#8809, #10669) + ui.helper.appendTo( draggable._parent ); + draggable._refreshOffsets( event ); + ui.position = draggable._generatePosition( event, true ); + + draggable._trigger( "fromSortable", event ); + + // Inform draggable that the helper is no longer in a valid drop zone + draggable.dropped = false; + + // Need to refreshPositions of all sortables just in case removing + // from one sortable changes the location of other sortables (#9675) + $.each( draggable.sortables, function() { + this.refreshPositions(); + } ); + } + } + } ); + } +} ); + +$.ui.plugin.add( "draggable", "cursor", { + start: function( event, ui, instance ) { + var t = $( "body" ), + o = instance.options; + + if ( t.css( "cursor" ) ) { + o._cursor = t.css( "cursor" ); + } + t.css( "cursor", o.cursor ); + }, + stop: function( event, ui, instance ) { + var o = instance.options; + if ( o._cursor ) { + $( "body" ).css( "cursor", o._cursor ); + } + } +} ); + +$.ui.plugin.add( "draggable", "opacity", { + start: function( event, ui, instance ) { + var t = $( ui.helper ), + o = instance.options; + if ( t.css( "opacity" ) ) { + o._opacity = t.css( "opacity" ); + } + t.css( "opacity", o.opacity ); + }, + stop: function( event, ui, instance ) { + var o = instance.options; + if ( o._opacity ) { + $( ui.helper ).css( "opacity", o._opacity ); + } + } +} ); + +$.ui.plugin.add( "draggable", "scroll", { + start: function( event, ui, i ) { + if ( !i.scrollParentNotHidden ) { + i.scrollParentNotHidden = i.helper.scrollParent( false ); + } + + if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && + i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { + i.overflowOffset = i.scrollParentNotHidden.offset(); + } + }, + drag: function( event, ui, i ) { + + var o = i.options, + scrolled = false, + scrollParent = i.scrollParentNotHidden[ 0 ], + document = i.document[ 0 ]; + + if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { + if ( !o.axis || o.axis !== "x" ) { + if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < + o.scrollSensitivity ) { + scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; + } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { + scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; + } + } + + if ( !o.axis || o.axis !== "y" ) { + if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < + o.scrollSensitivity ) { + scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; + } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { + scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; + } + } + + } else { + + if ( !o.axis || o.axis !== "x" ) { + if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { + scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); + } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < + o.scrollSensitivity ) { + scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); + } + } + + if ( !o.axis || o.axis !== "y" ) { + if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { + scrolled = $( document ).scrollLeft( + $( document ).scrollLeft() - o.scrollSpeed + ); + } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < + o.scrollSensitivity ) { + scrolled = $( document ).scrollLeft( + $( document ).scrollLeft() + o.scrollSpeed + ); + } + } + + } + + if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { + $.ui.ddmanager.prepareOffsets( i, event ); + } + + } +} ); + +$.ui.plugin.add( "draggable", "snap", { + start: function( event, ui, i ) { + + var o = i.options; + + i.snapElements = []; + + $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) + .each( function() { + var $t = $( this ), + $o = $t.offset(); + if ( this !== i.element[ 0 ] ) { + i.snapElements.push( { + item: this, + width: $t.outerWidth(), height: $t.outerHeight(), + top: $o.top, left: $o.left + } ); + } + } ); + + }, + drag: function( event, ui, inst ) { + + var ts, bs, ls, rs, l, r, t, b, i, first, + o = inst.options, + d = o.snapTolerance, + x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, + y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; + + for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { + + l = inst.snapElements[ i ].left - inst.margins.left; + r = l + inst.snapElements[ i ].width; + t = inst.snapElements[ i ].top - inst.margins.top; + b = t + inst.snapElements[ i ].height; + + if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || + !$.contains( inst.snapElements[ i ].item.ownerDocument, + inst.snapElements[ i ].item ) ) { + if ( inst.snapElements[ i ].snapping ) { + ( inst.options.snap.release && + inst.options.snap.release.call( + inst.element, + event, + $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) + ) ); + } + inst.snapElements[ i ].snapping = false; + continue; + } + + if ( o.snapMode !== "inner" ) { + ts = Math.abs( t - y2 ) <= d; + bs = Math.abs( b - y1 ) <= d; + ls = Math.abs( l - x2 ) <= d; + rs = Math.abs( r - x1 ) <= d; + if ( ts ) { + ui.position.top = inst._convertPositionTo( "relative", { + top: t - inst.helperProportions.height, + left: 0 + } ).top; + } + if ( bs ) { + ui.position.top = inst._convertPositionTo( "relative", { + top: b, + left: 0 + } ).top; + } + if ( ls ) { + ui.position.left = inst._convertPositionTo( "relative", { + top: 0, + left: l - inst.helperProportions.width + } ).left; + } + if ( rs ) { + ui.position.left = inst._convertPositionTo( "relative", { + top: 0, + left: r + } ).left; + } + } + + first = ( ts || bs || ls || rs ); + + if ( o.snapMode !== "outer" ) { + ts = Math.abs( t - y1 ) <= d; + bs = Math.abs( b - y2 ) <= d; + ls = Math.abs( l - x1 ) <= d; + rs = Math.abs( r - x2 ) <= d; + if ( ts ) { + ui.position.top = inst._convertPositionTo( "relative", { + top: t, + left: 0 + } ).top; + } + if ( bs ) { + ui.position.top = inst._convertPositionTo( "relative", { + top: b - inst.helperProportions.height, + left: 0 + } ).top; + } + if ( ls ) { + ui.position.left = inst._convertPositionTo( "relative", { + top: 0, + left: l + } ).left; + } + if ( rs ) { + ui.position.left = inst._convertPositionTo( "relative", { + top: 0, + left: r - inst.helperProportions.width + } ).left; + } + } + + if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { + ( inst.options.snap.snap && + inst.options.snap.snap.call( + inst.element, + event, + $.extend( inst._uiHash(), { + snapItem: inst.snapElements[ i ].item + } ) ) ); + } + inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); + + } + + } +} ); + +$.ui.plugin.add( "draggable", "stack", { + start: function( event, ui, instance ) { + var min, + o = instance.options, + group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { + return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - + ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); + } ); + + if ( !group.length ) { return; } + + min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; + $( group ).each( function( i ) { + $( this ).css( "zIndex", min + i ); + } ); + this.css( "zIndex", ( min + group.length ) ); + } +} ); + +$.ui.plugin.add( "draggable", "zIndex", { + start: function( event, ui, instance ) { + var t = $( ui.helper ), + o = instance.options; + + if ( t.css( "zIndex" ) ) { + o._zIndex = t.css( "zIndex" ); + } + t.css( "zIndex", o.zIndex ); + }, + stop: function( event, ui, instance ) { + var o = instance.options; + + if ( o._zIndex ) { + $( ui.helper ).css( "zIndex", o._zIndex ); + } + } +} ); + +var widgetsDraggable = $.ui.draggable; + + +/*! + * jQuery UI Resizable 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Resizable +//>>group: Interactions +//>>description: Enables resize functionality for any element. +//>>docs: http://api.jqueryui.com/resizable/ +//>>demos: http://jqueryui.com/resizable/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/resizable.css +//>>css.theme: ../../themes/base/theme.css + + + +$.widget( "ui.resizable", $.ui.mouse, { + version: "1.12.1", + 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, + + // See #7960 + zIndex: 90, + + // Callbacks + 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; + } + + // TODO: determine which cases actually cause this to happen + // if the element doesn't have the scroll set, see if it's possible to + // set the scroll + el[ scroll ] = 1; + has = ( el[ scroll ] > 0 ); + el[ scroll ] = 0; + return has; + }, + + _create: function() { + + var margins, + o = this.options, + that = this; + this._addClass( "ui-resizable" ); + + $.extend( this, { + _aspectRatio: !!( o.aspectRatio ), + aspectRatio: o.aspectRatio, + originalElement: this.element, + _proportionallyResizeElements: [], + _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null + } ); + + // Wrap the element if it cannot hold child nodes + if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { + + this.element.wrap( + $( "<div class='ui-wrapper' style='overflow: hidden;'></div>" ).css( { + position: this.element.css( "position" ), + width: this.element.outerWidth(), + height: this.element.outerHeight(), + top: this.element.css( "top" ), + left: this.element.css( "left" ) + } ) + ); + + this.element = this.element.parent().data( + "ui-resizable", this.element.resizable( "instance" ) + ); + + this.elementIsWrapper = true; + + margins = { + marginTop: this.originalElement.css( "marginTop" ), + marginRight: this.originalElement.css( "marginRight" ), + marginBottom: this.originalElement.css( "marginBottom" ), + marginLeft: this.originalElement.css( "marginLeft" ) + }; + + this.element.css( margins ); + this.originalElement.css( "margin", 0 ); + + // support: Safari + // Prevent Safari textarea resize + this.originalResizeStyle = this.originalElement.css( "resize" ); + this.originalElement.css( "resize", "none" ); + + this._proportionallyResizeElements.push( this.originalElement.css( { + position: "static", + zoom: 1, + display: "block" + } ) ); + + // Support: IE9 + // avoid IE jump (hard set the margin) + this.originalElement.css( margins ); + + this._proportionallyResize(); + } + + this._setupHandles(); + + if ( o.autoHide ) { + $( this.element ) + .on( "mouseenter", function() { + if ( o.disabled ) { + return; + } + that._removeClass( "ui-resizable-autohide" ); + that._handles.show(); + } ) + .on( "mouseleave", function() { + if ( o.disabled ) { + return; + } + if ( !that.resizing ) { + that._addClass( "ui-resizable-autohide" ); + that._handles.hide(); + } + } ); + } + + this._mouseInit(); + }, + + _destroy: function() { + + this._mouseDestroy(); + + var wrapper, + _destroy = function( exp ) { + $( exp ) + .removeData( "resizable" ) + .removeData( "ui-resizable" ) + .off( ".resizable" ) + .find( ".ui-resizable-handle" ) + .remove(); + }; + + // TODO: Unwrap at same DOM position + if ( this.elementIsWrapper ) { + _destroy( this.element ); + wrapper = this.element; + this.originalElement.css( { + position: wrapper.css( "position" ), + width: wrapper.outerWidth(), + height: wrapper.outerHeight(), + top: wrapper.css( "top" ), + left: wrapper.css( "left" ) + } ).insertAfter( wrapper ); + wrapper.remove(); + } + + this.originalElement.css( "resize", this.originalResizeStyle ); + _destroy( this.originalElement ); + + return this; + }, + + _setOption: function( key, value ) { + this._super( key, value ); + + switch ( key ) { + case "handles": + this._removeHandles(); + this._setupHandles(); + break; + default: + break; + } + }, + + _setupHandles: function() { + var o = this.options, handle, i, n, hname, axis, that = this; + this.handles = o.handles || + ( !$( ".ui-resizable-handle", this.element ).length ? + "e,s,se" : { + n: ".ui-resizable-n", + e: ".ui-resizable-e", + s: ".ui-resizable-s", + w: ".ui-resizable-w", + se: ".ui-resizable-se", + sw: ".ui-resizable-sw", + ne: ".ui-resizable-ne", + nw: ".ui-resizable-nw" + } ); + + this._handles = $(); + if ( this.handles.constructor === String ) { + + if ( this.handles === "all" ) { + this.handles = "n,e,s,w,se,sw,ne,nw"; + } + + n = this.handles.split( "," ); + this.handles = {}; + + for ( i = 0; i < n.length; i++ ) { + + handle = $.trim( n[ i ] ); + hname = "ui-resizable-" + handle; + axis = $( "<div>" ); + this._addClass( axis, "ui-resizable-handle " + hname ); + + axis.css( { zIndex: o.zIndex } ); + + this.handles[ handle ] = ".ui-resizable-" + handle; + this.element.append( axis ); + } + + } + + this._renderAxis = function( target ) { + + var i, axis, padPos, padWrapper; + + target = target || this.element; + + for ( i in this.handles ) { + + if ( this.handles[ i ].constructor === String ) { + this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show(); + } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) { + this.handles[ i ] = $( this.handles[ i ] ); + this._on( this.handles[ i ], { "mousedown": that._mouseDown } ); + } + + if ( this.elementIsWrapper && + this.originalElement[ 0 ] + .nodeName + .match( /^(textarea|input|select|button)$/i ) ) { + axis = $( this.handles[ i ], this.element ); + + padWrapper = /sw|ne|nw|se|n|s/.test( i ) ? + axis.outerHeight() : + axis.outerWidth(); + + padPos = [ "padding", + /ne|nw|n/.test( i ) ? "Top" : + /se|sw|s/.test( i ) ? "Bottom" : + /^e$/.test( i ) ? "Right" : "Left" ].join( "" ); + + target.css( padPos, padWrapper ); + + this._proportionallyResize(); + } + + this._handles = this._handles.add( this.handles[ i ] ); + } + }; + + // TODO: make renderAxis a prototype function + this._renderAxis( this.element ); + + this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) ); + this._handles.disableSelection(); + + this._handles.on( "mouseover", function() { + if ( !that.resizing ) { + if ( this.className ) { + axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i ); + } + that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se"; + } + } ); + + if ( o.autoHide ) { + this._handles.hide(); + this._addClass( "ui-resizable-autohide" ); + } + }, + + _removeHandles: function() { + this._handles.remove(); + }, + + _mouseCapture: function( event ) { + var i, handle, + capture = false; + + for ( i in this.handles ) { + handle = $( this.handles[ i ] )[ 0 ]; + if ( handle === event.target || $.contains( handle, event.target ) ) { + capture = true; + } + } + + return !this.options.disabled && capture; + }, + + _mouseStart: function( event ) { + + var curleft, curtop, cursor, + o = this.options, + el = this.element; + + this.resizing = true; + + this._renderProxy(); + + curleft = this._num( this.helper.css( "left" ) ); + curtop = this._num( this.helper.css( "top" ) ); + + if ( o.containment ) { + curleft += $( o.containment ).scrollLeft() || 0; + curtop += $( o.containment ).scrollTop() || 0; + } + + this.offset = this.helper.offset(); + this.position = { left: curleft, top: curtop }; + + this.size = this._helper ? { + width: this.helper.width(), + height: this.helper.height() + } : { + width: el.width(), + height: el.height() + }; + + this.originalSize = this._helper ? { + width: el.outerWidth(), + height: el.outerHeight() + } : { + width: el.width(), + height: el.height() + }; + + this.sizeDiff = { + width: el.outerWidth() - el.width(), + height: el.outerHeight() - el.height() + }; + + this.originalPosition = { left: curleft, top: curtop }; + this.originalMousePosition = { left: event.pageX, top: event.pageY }; + + this.aspectRatio = ( typeof o.aspectRatio === "number" ) ? + o.aspectRatio : + ( ( this.originalSize.width / this.originalSize.height ) || 1 ); + + cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" ); + $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor ); + + this._addClass( "ui-resizable-resizing" ); + this._propagate( "start", event ); + return true; + }, + + _mouseDrag: function( event ) { + + var data, props, + smp = this.originalMousePosition, + a = this.axis, + dx = ( event.pageX - smp.left ) || 0, + dy = ( event.pageY - smp.top ) || 0, + trigger = this._change[ a ]; + + this._updatePrevProperties(); + + if ( !trigger ) { + return false; + } + + data = trigger.apply( this, [ event, dx, dy ] ); + + this._updateVirtualBoundaries( event.shiftKey ); + if ( this._aspectRatio || event.shiftKey ) { + data = this._updateRatio( data, event ); + } + + data = this._respectSize( data, event ); + + this._updateCache( data ); + + this._propagate( "resize", event ); + + props = this._applyChanges(); + + if ( !this._helper && this._proportionallyResizeElements.length ) { + this._proportionallyResize(); + } + + if ( !$.isEmptyObject( props ) ) { + this._updatePrevProperties(); + this._trigger( "resize", event, this.ui() ); + this._applyChanges(); + } + + return false; + }, + + _mouseStop: function( event ) { + + this.resizing = false; + var pr, ista, soffseth, soffsetw, s, left, top, + o = this.options, that = this; + + if ( this._helper ) { + + pr = this._proportionallyResizeElements; + ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ); + soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height; + soffsetw = ista ? 0 : that.sizeDiff.width; + + s = { + width: ( that.helper.width() - soffsetw ), + height: ( that.helper.height() - soffseth ) + }; + left = ( parseFloat( that.element.css( "left" ) ) + + ( that.position.left - that.originalPosition.left ) ) || null; + top = ( parseFloat( that.element.css( "top" ) ) + + ( that.position.top - that.originalPosition.top ) ) || null; + + if ( !o.animate ) { + this.element.css( $.extend( s, { top: top, left: left } ) ); + } + + that.helper.height( that.size.height ); + that.helper.width( that.size.width ); + + if ( this._helper && !o.animate ) { + this._proportionallyResize(); + } + } + + $( "body" ).css( "cursor", "auto" ); + + this._removeClass( "ui-resizable-resizing" ); + + this._propagate( "stop", event ); + + if ( this._helper ) { + this.helper.remove(); + } + + return false; + + }, + + _updatePrevProperties: function() { + this.prevPosition = { + top: this.position.top, + left: this.position.left + }; + this.prevSize = { + width: this.size.width, + height: this.size.height + }; + }, + + _applyChanges: function() { + var props = {}; + + if ( this.position.top !== this.prevPosition.top ) { + props.top = this.position.top + "px"; + } + if ( this.position.left !== this.prevPosition.left ) { + props.left = this.position.left + "px"; + } + if ( this.size.width !== this.prevSize.width ) { + props.width = this.size.width + "px"; + } + if ( this.size.height !== this.prevSize.height ) { + props.height = this.size.height + "px"; + } + + this.helper.css( props ); + + return props; + }, + + _updateVirtualBoundaries: function( forceAspectRatio ) { + var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, + o = this.options; + + b = { + minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0, + maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity, + minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0, + maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity + }; + + if ( this._aspectRatio || forceAspectRatio ) { + pMinWidth = b.minHeight * this.aspectRatio; + pMinHeight = b.minWidth / this.aspectRatio; + pMaxWidth = b.maxHeight * this.aspectRatio; + pMaxHeight = b.maxWidth / this.aspectRatio; + + if ( pMinWidth > b.minWidth ) { + b.minWidth = pMinWidth; + } + if ( pMinHeight > b.minHeight ) { + b.minHeight = pMinHeight; + } + if ( pMaxWidth < b.maxWidth ) { + b.maxWidth = pMaxWidth; + } + if ( pMaxHeight < b.maxHeight ) { + b.maxHeight = pMaxHeight; + } + } + this._vBoundaries = b; + }, + + _updateCache: function( data ) { + this.offset = this.helper.offset(); + if ( this._isNumber( data.left ) ) { + this.position.left = data.left; + } + if ( this._isNumber( data.top ) ) { + this.position.top = data.top; + } + if ( this._isNumber( data.height ) ) { + this.size.height = data.height; + } + if ( this._isNumber( data.width ) ) { + this.size.width = data.width; + } + }, + + _updateRatio: function( data ) { + + var cpos = this.position, + csize = this.size, + a = this.axis; + + if ( this._isNumber( data.height ) ) { + data.width = ( data.height * this.aspectRatio ); + } else if ( this._isNumber( data.width ) ) { + data.height = ( data.width / this.aspectRatio ); + } + + if ( a === "sw" ) { + data.left = cpos.left + ( csize.width - data.width ); + data.top = null; + } + if ( a === "nw" ) { + data.top = cpos.top + ( csize.height - data.height ); + data.left = cpos.left + ( csize.width - data.width ); + } + + return data; + }, + + _respectSize: function( data ) { + + var o = this._vBoundaries, + a = this.axis, + ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ), + ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ), + isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), + isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), + dw = this.originalPosition.left + this.originalSize.width, + dh = this.originalPosition.top + this.originalSize.height, + cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); + if ( isminw ) { + data.width = o.minWidth; + } + if ( isminh ) { + data.height = o.minHeight; + } + if ( ismaxw ) { + data.width = o.maxWidth; + } + if ( ismaxh ) { + data.height = o.maxHeight; + } + + if ( isminw && cw ) { + data.left = dw - o.minWidth; + } + if ( ismaxw && cw ) { + data.left = dw - o.maxWidth; + } + if ( isminh && ch ) { + data.top = dh - o.minHeight; + } + if ( ismaxh && ch ) { + data.top = dh - o.maxHeight; + } + + // Fixing jump error on top/left - bug #2330 + 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 ]; + + // TODO: Seems like a bug to cache this.outerDimensions + // considering that we are in a loop. + if ( !this.outerDimensions ) { + this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); + } + + prel.css( { + height: ( element.height() - this.outerDimensions.height ) || 0, + width: ( element.width() - this.outerDimensions.width ) || 0 + } ); + + } + + }, + + _renderProxy: function() { + + var el = this.element, o = this.options; + this.elementOffset = el.offset(); + + if ( this._helper ) { + + this.helper = this.helper || $( "<div style='overflow:hidden;'></div>" ); + + this._addClass( this.helper, this._helper ); + this.helper.css( { + width: this.element.outerWidth(), + height: this.element.outerHeight(), + position: "absolute", + left: this.elementOffset.left + "px", + top: this.elementOffset.top + "px", + zIndex: ++o.zIndex //TODO: Don't modify option + } ); + + this.helper + .appendTo( "body" ) + .disableSelection(); + + } else { + this.helper = this.element; + } + + }, + + _change: { + e: function( event, dx ) { + return { width: this.originalSize.width + dx }; + }, + w: function( event, dx ) { + var cs = this.originalSize, sp = this.originalPosition; + return { left: sp.left + dx, width: cs.width - dx }; + }, + n: function( event, dx, dy ) { + var cs = this.originalSize, sp = this.originalPosition; + return { top: sp.top + dy, height: cs.height - dy }; + }, + s: function( event, dx, dy ) { + return { height: this.originalSize.height + dy }; + }, + se: function( event, dx, dy ) { + return $.extend( this._change.s.apply( this, arguments ), + this._change.e.apply( this, [ event, dx, dy ] ) ); + }, + sw: function( event, dx, dy ) { + return $.extend( this._change.s.apply( this, arguments ), + this._change.w.apply( this, [ event, dx, dy ] ) ); + }, + ne: function( event, dx, dy ) { + return $.extend( this._change.n.apply( this, arguments ), + this._change.e.apply( this, [ event, dx, dy ] ) ); + }, + nw: function( event, dx, dy ) { + return $.extend( this._change.n.apply( this, arguments ), + this._change.w.apply( this, [ event, dx, dy ] ) ); + } + }, + + _propagate: function( n, event ) { + $.ui.plugin.call( this, n, [ event, this.ui() ] ); + ( n !== "resize" && this._trigger( n, event, this.ui() ) ); + }, + + plugins: {}, + + ui: function() { + return { + originalElement: this.originalElement, + element: this.element, + helper: this.helper, + position: this.position, + size: this.size, + originalSize: this.originalSize, + originalPosition: this.originalPosition + }; + } + +} ); + +/* + * Resizable Extensions + */ + +$.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 } ); + } + + // Propagating resize, and updating values for each animation step + 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" ); + + // DEPRECATED + // TODO: remove after 1.12 + if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) { + + // Ghost option + 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; + + +/*! + * jQuery UI Dialog 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Dialog +//>>group: Widgets +//>>description: Displays customizable dialog windows. +//>>docs: http://api.jqueryui.com/dialog/ +//>>demos: http://jqueryui.com/dialog/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/dialog.css +//>>css.theme: ../../themes/base/theme.css + + + +$.widget( "ui.dialog", { + version: "1.12.1", + 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", + + // Ensure the titlebar is always visible + 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, + + // Callbacks + 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; + } + + // Dialogs can't be disabled + 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 ) + + // Without detaching first, the following becomes really slow + .detach(); + + this.uiDialog.remove(); + + if ( this.originalTitle ) { + this.element.attr( "title", this.originalTitle ); + } + + next = originalPosition.parent.children().eq( originalPosition.index ); + + // Don't try to place the dialog next to itself (#8613) + 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 ) { + + // Hiding a focused element doesn't trigger blur in WebKit + // so in case we have nothing to focus on, explicitly blur the active element + // https://bugs.webkit.org/show_bug.cgi?id=47182 + $.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 ); + + // Ensure the overlay is moved to the top with the dialog, but only when + // opening. The overlay shouldn't move after the dialog is open so that + // modeless dialogs opened after the modal dialog stack properly. + 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" ); + } ); + + // Track the dialog immediately upon openening in case a focus event + // somehow occurs outside of the dialog before an element inside the + // dialog is focused (#10152) + this._makeFocusTarget(); + + this._trigger( "open" ); + }, + + _focusTabbable: function() { + + // Set focus to the first match: + // 1. An element that was focused previously + // 2. First element inside the dialog matching [autofocus] + // 3. Tabbable element inside the content element + // 4. Tabbable element inside the buttonpane + // 5. The close button + // 6. The dialog itself + var hasFocus = this._focusedElement; + if ( !hasFocus ) { + hasFocus = this.element.find( "[autofocus]" ); + } + if ( !hasFocus.length ) { + hasFocus = this.element.find( ":tabbable" ); + } + if ( !hasFocus.length ) { + hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); + } + if ( !hasFocus.length ) { + hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); + } + if ( !hasFocus.length ) { + hasFocus = this.uiDialog; + } + hasFocus.eq( 0 ).trigger( "focus" ); + }, + + _keepFocus: function( event ) { + function checkFocus() { + var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), + isActive = this.uiDialog[ 0 ] === activeElement || + $.contains( this.uiDialog[ 0 ], activeElement ); + if ( !isActive ) { + this._focusTabbable(); + } + } + event.preventDefault(); + checkFocus.call( this ); + + // support: IE + // IE <= 8 doesn't prevent moving focus even with event.preventDefault() + // so we check again later + this._delay( checkFocus ); + }, + + _createWrapper: function() { + this.uiDialog = $( "<div>" ) + .hide() + .attr( { + + // Setting tabIndex makes the div focusable + 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; + } + + // Prevent tabbing out of dialogs + if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { + return; + } + var tabbables = this.uiDialog.find( ":tabbable" ), + first = tabbables.filter( ":first" ), + last = tabbables.filter( ":last" ); + + if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) && + !event.shiftKey ) { + this._delay( function() { + first.trigger( "focus" ); + } ); + event.preventDefault(); + } else if ( ( event.target === first[ 0 ] || + event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) { + this._delay( function() { + last.trigger( "focus" ); + } ); + event.preventDefault(); + } + }, + mousedown: function( event ) { + if ( this._moveToTop( event ) ) { + this._focusTabbable(); + } + } + } ); + + // We assume that any existing aria-describedby attribute means + // that the dialog content is marked up properly + // otherwise we brute force the content as the description + 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 ) { + + // Don't prevent click on close button (#8838) + // Focusing a dialog that is partially scrolled out of view + // causes the browser to scroll it into view, preventing the click event + if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { + + // Dialog isn't getting focus when dragging (#8063) + this.uiDialog.trigger( "focus" ); + } + } + } ); + + // Support: IE + // Use type="button" to prevent enter keypresses in textboxes from closing the + // dialog in IE (#9312) + 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( " " ); + } + }, + + _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; + + // If we already have a button pane, remove it + this.uiDialogButtonPane.remove(); + this.uiButtonSet.empty(); + + if ( $.isEmptyObject( buttons ) || ( $.isArray( buttons ) && !buttons.length ) ) { + this._removeClass( this.uiDialog, "ui-dialog-buttons" ); + return; + } + + $.each( buttons, function( name, props ) { + var click, buttonOptions; + props = $.isFunction( props ) ? + { click: props, text: name } : + props; + + // Default to a non-submitting button + props = $.extend( { type: "button" }, props ); + + // Change the context for the click callback to be the main element + click = props.click; + buttonOptions = { + icon: props.icon, + iconPosition: props.iconPosition, + showLabel: props.showLabel, + + // Deprecated options + icons: props.icons, + text: props.text + }; + + delete props.click; + delete props.icon; + delete props.iconPosition; + delete props.showLabel; + + // Deprecated options + 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, + + // .ui-resizable has position: relative defined in the stylesheet + // but dialogs have to use absolute or fixed positioning + 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() { + + // Need to show the dialog to get the actual offset in the position plugin + 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( { + + // Ensure that we always pass a string + 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" ) { + + // currently resizable, becoming non-resizable + isResizable = uiDialog.is( ":data(ui-resizable)" ); + if ( isResizable && !value ) { + uiDialog.resizable( "destroy" ); + } + + // Currently resizable, changing handles + if ( isResizable && typeof value === "string" ) { + uiDialog.resizable( "option", "handles", value ); + } + + // Currently non-resizable, becoming resizable + if ( !isResizable && value !== false ) { + this._makeResizable(); + } + } + + if ( key === "title" ) { + this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); + } + }, + + _size: function() { + + // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content + // divs will both have width and height set, so we need to reset them + var nonContentHeight, minContentHeight, maxContentHeight, + options = this.options; + + // Reset content sizing + this.element.show().css( { + width: "auto", + minHeight: 0, + maxHeight: "none", + height: 0 + } ); + + if ( options.minWidth > options.width ) { + options.width = options.minWidth; + } + + // Reset wrapper sizing + // determine the height of all the non-content elements + 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; + } + + // TODO: Remove hack when datepicker implements + // the .ui-front logic (#8989) + return !!$( event.target ).closest( ".ui-datepicker" ).length; + }, + + _createOverlay: function() { + if ( !this.options.modal ) { + return; + } + + // We use a delay in case the overlay is created from an + // event that we're going to be cancelling (#2804) + var isOpening = true; + this._delay( function() { + isOpening = false; + } ); + + if ( !this.document.data( "ui-dialog-overlays" ) ) { + + // Prevent use of anchors and inputs + // Using _on() for an event handler shared across many instances is + // safe because the dialogs stack and must be closed in reverse order + this._on( this.document, { + focusin: function( event ) { + if ( isOpening ) { + return; + } + + if ( !this._allowInteraction( event ) ) { + event.preventDefault(); + this._trackingInstances()[ 0 ]._focusTabbable(); + } + } + } ); + } + + this.overlay = $( "<div>" ) + .appendTo( this._appendTo() ); + + this._addClass( this.overlay, null, "ui-widget-overlay ui-front" ); + this._on( this.overlay, { + mousedown: "_keepFocus" + } ); + this.document.data( "ui-dialog-overlays", + ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 ); + }, + + _destroyOverlay: function() { + if ( !this.options.modal ) { + return; + } + + if ( this.overlay ) { + var overlays = this.document.data( "ui-dialog-overlays" ) - 1; + + if ( !overlays ) { + this._off( this.document, "focusin" ); + this.document.removeData( "ui-dialog-overlays" ); + } else { + this.document.data( "ui-dialog-overlays", overlays ); + } + + this.overlay.remove(); + this.overlay = null; + } + } +} ); + +// DEPRECATED +// TODO: switch return back to widget declaration at top of file when this is removed +if ( $.uiBackCompat !== false ) { + + // Backcompat for dialogClass option + $.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; + + +/*! + * jQuery UI Droppable 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Droppable +//>>group: Interactions +//>>description: Enables drop targets for draggable elements. +//>>docs: http://api.jqueryui.com/droppable/ +//>>demos: http://jqueryui.com/droppable/ + + + +$.widget( "ui.droppable", { + version: "1.12.1", + widgetEventPrefix: "drop", + options: { + accept: "*", + addClasses: true, + greedy: false, + scope: "default", + tolerance: "intersect", + + // Callbacks + activate: null, + deactivate: null, + drop: null, + out: null, + over: null + }, + _create: function() { + + var proportions, + o = this.options, + accept = o.accept; + + this.isover = false; + this.isout = true; + + this.accept = $.isFunction( accept ) ? accept : function( d ) { + return d.is( accept ); + }; + + this.proportions = function( /* valueToWrite */ ) { + if ( arguments.length ) { + + // Store the droppable's proportions + proportions = arguments[ 0 ]; + } else { + + // Retrieve or derive the droppable's proportions + return proportions ? + proportions : + proportions = { + width: this.element[ 0 ].offsetWidth, + height: this.element[ 0 ].offsetHeight + }; + } + }; + + this._addToManager( o.scope ); + + o.addClasses && this._addClass( "ui-droppable" ); + + }, + + _addToManager: function( scope ) { + + // Add the reference and positions to the manager + $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || []; + $.ui.ddmanager.droppables[ scope ].push( this ); + }, + + _splice: function( drop ) { + var i = 0; + for ( ; i < drop.length; i++ ) { + if ( drop[ i ] === this ) { + drop.splice( i, 1 ); + } + } + }, + + _destroy: function() { + var drop = $.ui.ddmanager.droppables[ this.options.scope ]; + + this._splice( drop ); + }, + + _setOption: function( key, value ) { + + if ( key === "accept" ) { + this.accept = $.isFunction( value ) ? value : function( d ) { + return d.is( value ); + }; + } else if ( key === "scope" ) { + var drop = $.ui.ddmanager.droppables[ this.options.scope ]; + + this._splice( drop ); + this._addToManager( value ); + } + + this._super( key, value ); + }, + + _activate: function( event ) { + var draggable = $.ui.ddmanager.current; + + this._addActiveClass(); + if ( draggable ) { + this._trigger( "activate", event, this.ui( draggable ) ); + } + }, + + _deactivate: function( event ) { + var draggable = $.ui.ddmanager.current; + + this._removeActiveClass(); + if ( draggable ) { + this._trigger( "deactivate", event, this.ui( draggable ) ); + } + }, + + _over: function( event ) { + + var draggable = $.ui.ddmanager.current; + + // Bail if draggable and droppable are same element + 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; + + // Bail if draggable and droppable are same element + 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; + + // Bail if draggable and droppable are same element + if ( !draggable || ( draggable.currentItem || + draggable.element )[ 0 ] === this.element[ 0 ] ) { + return false; + } + + this.element + .find( ":data(ui-droppable)" ) + .not( ".ui-draggable-dragging" ) + .each( function() { + var inst = $( this ).droppable( "instance" ); + if ( + inst.options.greedy && + !inst.options.disabled && + inst.options.scope === draggable.options.scope && + inst.accept.call( + inst.element[ 0 ], ( draggable.currentItem || draggable.element ) + ) && + intersect( + draggable, + $.extend( inst, { offset: inst.element.offset() } ), + inst.options.tolerance, event + ) + ) { + childrenIntersection = true; + return false; } + } ); + if ( childrenIntersection ) { + return false; + } + + if ( this.accept.call( this.element[ 0 ], + ( draggable.currentItem || draggable.element ) ) ) { + this._removeActiveClass(); + this._removeHoverClass(); + + this._trigger( "drop", event, this.ui( draggable ) ); + return this.element; + } + + return false; + + }, + + ui: function( c ) { + return { + draggable: ( c.currentItem || c.element ), + helper: c.helper, + position: c.position, + offset: c.positionAbs + }; + }, + + // Extension points just to make backcompat sane and avoid duplicating logic + // TODO: Remove in 1.13 along with call to it below + _addHoverClass: function() { + this._addClass( "ui-droppable-hover" ); + }, + + _removeHoverClass: function() { + this._removeClass( "ui-droppable-hover" ); + }, + + _addActiveClass: function() { + this._addClass( "ui-droppable-active" ); + }, + + _removeActiveClass: function() { + this._removeClass( "ui-droppable-active" ); + } +} ); + +var intersect = $.ui.intersect = ( function() { + function isOverAxis( x, reference, size ) { + return ( x >= reference ) && ( x < ( reference + size ) ); + } + + return function( draggable, droppable, toleranceMode, event ) { + + if ( !droppable.offset ) { + return false; + } + + var x1 = ( draggable.positionAbs || + draggable.position.absolute ).left + draggable.margins.left, + y1 = ( draggable.positionAbs || + draggable.position.absolute ).top + draggable.margins.top, + x2 = x1 + draggable.helperProportions.width, + y2 = y1 + draggable.helperProportions.height, + l = droppable.offset.left, + t = droppable.offset.top, + r = l + droppable.proportions().width, + b = t + droppable.proportions().height; + + switch ( toleranceMode ) { + case "fit": + return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b ); + case "intersect": + return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half + x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half + t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half + y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half + case "pointer": + return isOverAxis( event.pageY, t, droppable.proportions().height ) && + isOverAxis( event.pageX, l, droppable.proportions().width ); + case "touch": + return ( + ( y1 >= t && y1 <= b ) || // Top edge touching + ( y2 >= t && y2 <= b ) || // Bottom edge touching + ( y1 < t && y2 > b ) // Surrounded vertically + ) && ( + ( x1 >= l && x1 <= r ) || // Left edge touching + ( x2 >= l && x2 <= r ) || // Right edge touching + ( x1 < l && x2 > r ) // Surrounded horizontally + ); + default: + return false; + } + }; +} )(); + +/* + This manager tracks offsets of draggables and droppables +*/ +$.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, // workaround for #2317 + list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack(); + + droppablesLoop: for ( i = 0; i < m.length; i++ ) { + + // No disabled and non-accepted + if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], + ( t.currentItem || t.element ) ) ) ) { + continue; + } + + // Filter out elements in the current dragged item + 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; + } + + // Activate the droppable if used directly from draggables + 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; + + // Create a copy of the droppables in case the list changes during the drop (#9116) + $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() { + + if ( !this.options ) { + return; + } + if ( !this.options.disabled && this.visible && + intersect( draggable, this, this.options.tolerance, event ) ) { + dropped = this._drop.call( this, event ) || dropped; + } + + if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], + ( draggable.currentItem || draggable.element ) ) ) { + this.isout = true; + this.isover = false; + this._deactivate.call( this, event ); + } + + } ); + return dropped; + + }, + dragStart: function( draggable, event ) { + + // Listen for scrolling so that if the dragging causes scrolling the position of the + // droppables can be recalculated (see #5003) + draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() { + if ( !draggable.options.refreshPositions ) { + $.ui.ddmanager.prepareOffsets( draggable, event ); + } + } ); + }, + drag: function( draggable, event ) { + + // If you have a highly dynamic page, you might try this option. It renders positions + // every time you move the mouse. + if ( draggable.options.refreshPositions ) { + $.ui.ddmanager.prepareOffsets( draggable, event ); + } + + // Run through all droppables and check their positions based on specific tolerance options + $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() { + + if ( this.options.disabled || this.greedyChild || !this.visible ) { + return; + } + + var parentInstance, scope, parent, + intersects = intersect( draggable, this, this.options.tolerance, event ), + c = !intersects && this.isover ? + "isout" : + ( intersects && !this.isover ? "isover" : null ); + if ( !c ) { + return; + } + + if ( this.options.greedy ) { + + // find droppable parents with same scope + 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" ); + } + } + + // We just moved into a greedy child + 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 ); + + // We just moved out of a greedy child + 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" ); + + // Call prepareOffsets one final time since IE does not fire return scroll events when + // overflow was caused by drag (see #5003) + if ( !draggable.options.refreshPositions ) { + $.ui.ddmanager.prepareOffsets( draggable, event ); + } + } +}; + +// DEPRECATED +// TODO: switch return back to widget declaration at top of file when this is removed +if ( $.uiBackCompat !== false ) { + + // Backcompat for activeClass and hoverClass options + $.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; + + +/*! + * jQuery UI Progressbar 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Progressbar +//>>group: Widgets +// jscs:disable maximumLineLength +//>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. +// jscs:enable maximumLineLength +//>>docs: http://api.jqueryui.com/progressbar/ +//>>demos: http://jqueryui.com/progressbar/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/progressbar.css +//>>css.theme: ../../themes/base/theme.css + + + +var widgetsProgressbar = $.widget( "ui.progressbar", { + version: "1.12.1", + 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() { + + // Constrain initial value + this.oldValue = this.options.value = this._constrainedValue(); + + this.element.attr( { + + // Only set static values; aria-valuenow and aria-valuemax are + // set inside _refreshValue() + 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; + + // Sanitize value + if ( typeof newValue !== "number" ) { + newValue = 0; + } + + return this.indeterminate ? false : + Math.min( this.options.max, Math.max( this.min, newValue ) ); + }, + + _setOptions: function( options ) { + + // Ensure "value" option is set after other values (like max) + 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" ) { + + // Don't allow a max less than min + 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" ); + } + } +} ); + + +/*! + * jQuery UI Selectable 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Selectable +//>>group: Interactions +//>>description: Allows groups of elements to be selected with the mouse. +//>>docs: http://api.jqueryui.com/selectable/ +//>>demos: http://jqueryui.com/selectable/ +//>>css.structure: ../../themes/base/selectable.css + + + +var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, { + version: "1.12.1", + options: { + appendTo: "body", + autoRefresh: true, + distance: 0, + filter: "*", + tolerance: "touch", + + // Callbacks + selected: null, + selecting: null, + start: null, + stop: null, + unselected: null, + unselecting: null + }, + _create: function() { + var that = this; + + this._addClass( "ui-selectable" ); + + this.dragged = false; + + // Cache selectee children based on filter + 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 ); + + // position helper (lasso) + 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; + + // selectable UNSELECTING callback + 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; + + // selectable (UN)SELECTING callback + 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 = {}; + + //prevent helper from being selected if appendTo: selectable + 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 ) { + + // SELECT + 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; + + // selectable SELECTING callback + that._trigger( "selecting", event, { + selecting: selectee.element + } ); + } + } else { + + // UNSELECT + 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; + } + + // selectable UNSELECTING callback + 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; + + // selectable UNSELECTING callback + 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; + } + +} ); + + +/*! + * jQuery UI Selectmenu 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Selectmenu +//>>group: Widgets +// jscs:disable maximumLineLength +//>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select. +// jscs:enable maximumLineLength +//>>docs: http://api.jqueryui.com/selectmenu/ +//>>demos: http://jqueryui.com/selectmenu/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css +//>>css.theme: ../../themes/base/theme.css + + + +var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { + version: "1.12.1", + 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, + + // Callbacks + 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 + ); + + // Associate existing label with the new button + this.labels = this.element.labels().attr( "for", this.ids.button ); + this._on( this.labels, { + click: function( event ) { + this.button.focus(); + event.preventDefault(); + } + } ); + + // Hide original select element + this.element.hide(); + + // Create button + 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() { + + // Delay rendering the menu items until the button receives focus. + // The menu may have already been rendered via a programmatic open. + if ( !that._rendered ) { + that._refreshMenu(); + } + } ); + }, + + _drawMenu: function() { + var that = this; + + // Create menu + this.menu = $( "<ul>", { + "aria-hidden": "true", + "aria-labelledby": this.ids.button, + id: this.ids.menu + } ); + + // Wrap menu + this.menuWrap = $( "<div>" ).append( this.menu ); + this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" ); + this.menuWrap.appendTo( this._appendTo() ); + + // Initialize menu widget + this.menuInstance = this.menu + .menu( { + classes: { + "ui-menu": "ui-corner-bottom" + }, + role: "listbox", + select: function( event, ui ) { + event.preventDefault(); + + // Support: IE8 + // If the item was selected via a click, the text selection + // will be destroyed in IE + that._setSelection(); + + that._select( ui.item.data( "ui-selectmenu-item" ), event ); + }, + focus: function( event, ui ) { + var item = ui.item.data( "ui-selectmenu-item" ); + + // Prevent inital focus from firing and check if its a newly focused 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" ); + + // Don't close the menu on mouseleave + this.menuInstance._off( this.menu, "mouseleave" ); + + // Cancel the menu's collapseAll on document click + this.menuInstance._closeOnDocumentClick = function() { + return false; + }; + + // Selects often contain empty items, but never contain dividers + this.menuInstance._isDivider = function() { + return false; + }; + }, + + refresh: function() { + this._refreshMenu(); + this.buttonItem.replaceWith( + this.buttonItem = this._renderButtonItem( + + // Fall back to an empty object in case there are no options + 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(); + + // Update the menu to have the correct item focused + this.menuInstance.focus( null, item ); + this._setAria( item.data( "ui-selectmenu-item" ) ); + + // Set disabled state + this._setOption( "disabled", this.element.prop( "disabled" ) ); + }, + + open: function( event ) { + if ( this.options.disabled ) { + return; + } + + // If this is the first time the menu is being opened, render the items + if ( !this._rendered ) { + this._refreshMenu(); + } else { + + // Menu clears focus on close, reset focus to selected item + this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" ); + this.menuInstance.focus( null, this._getSelectedItem() ); + } + + // If there are no options, don't open the menu + 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( " " ); + } + }, + + _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 ); + + // Support: IE8 + } else { + this.range.select(); + } + + // Support: IE + // Setting the text selection kills the button focus in IE, but + // restoring the focus doesn't kill the selection. + this.button.focus(); + }, + + _documentClick: { + mousedown: function( event ) { + if ( !this.isOpen ) { + return; + } + + if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + + $.ui.escapeSelector( this.ids.button ) ).length ) { + this.close( event ); + } + } + }, + + _buttonEvents: { + + // Prevent text selection from being reset when interacting with the selectmenu (#10144) + mousedown: function() { + var selection; + + if ( window.getSelection ) { + selection = window.getSelection(); + if ( selection.rangeCount ) { + this.range = selection.getRangeAt( 0 ); + } + + // Support: IE8 + } 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; + + // Change native select element + 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 ); + + // We can't use two _toggleClass() calls here, because we need to make sure + // we always remove classes first and add them second, otherwise if both classes have the + // same theme class, it will be removed after we add it. + 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; + + // For `width:!1`, just remove inline style and stop + if ( width === false ) { + this.button.css( "width", "" ); + return; + } + + // For `width:null`, match the width of the original element + 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(), + + // Support: IE10 + // IE10 wraps long text (possibly a rounding bug) + // so we add 1px to avoid the wrapping + this.menu.width( "" ).outerWidth() + 1 + ) ); + }, + + _getCreateOptions: function() { + var options = this._super(); + + options.disabled = this.element.prop( "disabled" ); + + return options; + }, + + _parseOptions: function( options ) { + var that = this, + data = []; + options.each( function( index, item ) { + data.push( that._parseOption( $( item ), index ) ); + } ); + this.items = data; + }, + + _parseOption: function( option, index ) { + var optgroup = option.parent( "optgroup" ); + + return { + element: option, + index: index, + value: option.val(), + label: option.text(), + optgroup: optgroup.attr( "label" ) || "", + disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" ) + }; + }, + + _destroy: function() { + this._unbindFormResetHandler(); + this.menuWrap.remove(); + this.button.remove(); + this.element.show(); + this.element.removeUniqueId(); + this.labels.attr( "for", this.ids.element ); + } +} ] ); + + +/*! + * jQuery UI Slider 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Slider +//>>group: Widgets +//>>description: Displays a flexible slider with ranges and accessibility via keyboard. +//>>docs: http://api.jqueryui.com/slider/ +//>>demos: http://jqueryui.com/slider/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/slider.css +//>>css.theme: ../../themes/base/theme.css + + + +var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, { + version: "1.12.1", + widgetEventPrefix: "slide", + + options: { + animate: false, + classes: { + "ui-slider": "ui-corner-all", + "ui-slider-handle": "ui-corner-all", + + // Note: ui-widget-header isn't the most fittingly semantic framework class for this + // element, but worked best visually with a variety of themes + "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, + + // Callbacks + change: null, + slide: null, + start: null, + stop: null + }, + + // Number of pages in a slider + // (how many times can you page up/down to go through the whole range) + 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 ( $.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" ); + + // Handle range switching from true to min/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 ) ); + + // A slide can be canceled by returning false from the slide callback + 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 ) { + + //store the last changed value index for reference when handles overlap + this._lastChangedValue = index; + this._trigger( "change", event, this._uiHash( index ) ); + } + }, + + value: function( newValue ) { + if ( arguments.length ) { + this.options.value = this._trimAlignValue( newValue ); + this._refreshValue(); + this._change( null, 0 ); + return; + } + + return this._value(); + }, + + values: function( index, newValue ) { + var vals, + newValues, + i; + + if ( arguments.length > 1 ) { + this.options.values[ index ] = this._trimAlignValue( newValue ); + this._refreshValue(); + this._change( null, index ); + return; + } + + if ( arguments.length ) { + if ( $.isArray( arguments[ 0 ] ) ) { + vals = this.options.values; + newValues = arguments[ 0 ]; + for ( i = 0; i < vals.length; i += 1 ) { + vals[ i ] = this._trimAlignValue( newValues[ i ] ); + this._change( null, i ); + } + this._refreshValue(); + } else { + if ( this._hasMultipleValues() ) { + return this._values( index ); + } else { + return this.value(); + } + } + } else { + return this._values(); + } + }, + + _setOption: function( key, value ) { + var i, + valsLength = 0; + + if ( key === "range" && this.options.range === true ) { + if ( value === "min" ) { + this.options.value = this._values( 0 ); + this.options.values = null; + } else if ( value === "max" ) { + this.options.value = this._values( this.options.values.length - 1 ); + this.options.values = null; + } + } + + if ( $.isArray( this.options.values ) ) { + valsLength = this.options.values.length; + } + + this._super( key, value ); + + switch ( key ) { + case "orientation": + this._detectOrientation(); + this._removeClass( "ui-slider-horizontal ui-slider-vertical" ) + ._addClass( "ui-slider-" + this.orientation ); + this._refreshValue(); + if ( this.options.range ) { + this._refreshRange( value ); + } + + // Reset positioning from previous orientation + 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(); + + // Start from the last handle to prevent unreachable handles (#9046) + 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 ); + }, + + //internal value getter + // _value() returns value trimmed by min and max, aligned by step + _value: function() { + var val = this.options.value; + val = this._trimAlignValue( val ); + + return val; + }, + + //internal values getter + // _values() returns array of values trimmed by min and max, aligned by step + // _values( index ) returns single value trimmed by min and max, aligned by step + _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() ) { + + // .slice() creates a copy of the array + // this copy gets trimmed by min and max and then returned + vals = this.options.values.slice(); + for ( i = 0; i < vals.length; i += 1 ) { + vals[ i ] = this._trimAlignValue( vals[ i ] ); + } + + return vals; + } else { + return []; + } + }, + + // Returns the step-aligned value that val is closest to, between (inclusive) min and max + _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 ); + } + + // Since JavaScript has problems with large floats, round + // the final value to 5 digits after the decimal point (see #4124) + 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 ) { + + //If max is not divisible by step, rounding off may increase its value + 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" ); + } + } + } +} ); + + +/*! + * jQuery UI Sortable 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Sortable +//>>group: Interactions +//>>description: Enables items in a list to be sorted using the mouse. +//>>docs: http://api.jqueryui.com/sortable/ +//>>demos: http://jqueryui.com/sortable/ +//>>css.structure: ../../themes/base/sortable.css + + + +var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, { + version: "1.12.1", + 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, + + // Callbacks + 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" ); + + //Get the items + this.refresh(); + + //Let's determine the parent's offset + this.offset = this.element.offset(); + + //Initialize mouse events for interaction + this._mouseInit(); + + this._setHandleClassName(); + + //We're ready to go + 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; + } + + //We have to refresh the items data once first + this._refreshItems( event ); + + //Find out if the clicked node (or one of its parents) is a actual item in this.items + $( 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; + + //We only need to call refreshPositions, because the refreshItems call has been moved to + // mouseCapture + this.refreshPositions(); + + //Create and append the visible helper + this.helper = this._createHelper( event ); + + //Cache the helper size + this._cacheHelperProportions(); + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //Get the next scrolling parent + this.scrollParent = this.helper.scrollParent(); + + //The element's absolute position on the page minus margins + 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: { //Where the click happened, relative to the element + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top + }, + parent: this._getParentOffset(), + + // This is a relative to absolute position minus the actual position calculation - + // only used for relative positioned helper + relative: this._getRelativeOffset() + } ); + + // Only after we got the offset, we can change the helper's position to absolute + // TODO: Still need to figure out a way to make relative sorting possible + this.helper.css( "position", "absolute" ); + this.cssPosition = this.helper.css( "position" ); + + //Generate the original position + this.originalPosition = this._generatePosition( event ); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + + //Adjust the mouse offset relative to the helper if "cursorAt" is supplied + ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) ); + + //Cache the former DOM position + this.domPosition = { + prev: this.currentItem.prev()[ 0 ], + parent: this.currentItem.parent()[ 0 ] + }; + + // If the helper is not the original, hide the original so it's not playing any role during + // the drag, won't cause anything bad this way + if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { + this.currentItem.hide(); + } + + //Create the placeholder + this._createPlaceholder(); + + //Set a containment if given in the options + if ( o.containment ) { + this._setContainment(); + } + + if ( o.cursor && o.cursor !== "auto" ) { // cursor option + body = this.document.find( "body" ); + + // Support: IE + this.storedCursor = body.css( "cursor" ); + body.css( "cursor", o.cursor ); + + this.storedStylesheet = + $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body ); + } + + if ( o.opacity ) { // opacity option + if ( this.helper.css( "opacity" ) ) { + this._storedOpacity = this.helper.css( "opacity" ); + } + this.helper.css( "opacity", o.opacity ); + } + + if ( o.zIndex ) { // zIndex option + if ( this.helper.css( "zIndex" ) ) { + this._storedZIndex = this.helper.css( "zIndex" ); + } + this.helper.css( "zIndex", o.zIndex ); + } + + //Prepare scrolling + if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && + this.scrollParent[ 0 ].tagName !== "HTML" ) { + this.overflowOffset = this.scrollParent.offset(); + } + + //Call callbacks + this._trigger( "start", event, this._uiHash() ); + + //Recache the helper size + if ( !this._preserveHelperProportions ) { + this._cacheHelperProportions(); + } + + //Post "activate" events to possible containers + if ( !noActivation ) { + for ( i = this.containers.length - 1; i >= 0; i-- ) { + this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); + } + } + + //Prepare possible droppables + 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" ); + + // Execute the drag once - this causes the helper not to be visiblebefore getting its + // correct position + this._mouseDrag( event ); + return true; + + }, + + _mouseDrag: function( event ) { + var i, item, itemElement, intersection, + o = this.options, + scrolled = false; + + //Compute the helpers position + this.position = this._generatePosition( event ); + this.positionAbs = this._convertPositionTo( "absolute" ); + + if ( !this.lastPositionAbs ) { + this.lastPositionAbs = this.positionAbs; + } + + //Do scrolling + if ( this.options.scroll ) { + if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && + this.scrollParent[ 0 ].tagName !== "HTML" ) { + + if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) - + event.pageY < o.scrollSensitivity ) { + this.scrollParent[ 0 ].scrollTop = + scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed; + } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) { + this.scrollParent[ 0 ].scrollTop = + scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed; + } + + if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) - + event.pageX < o.scrollSensitivity ) { + this.scrollParent[ 0 ].scrollLeft = scrolled = + this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed; + } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) { + this.scrollParent[ 0 ].scrollLeft = scrolled = + this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed; + } + + } else { + + if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) { + scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed ); + } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) < + o.scrollSensitivity ) { + scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed ); + } + + if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) { + scrolled = this.document.scrollLeft( + this.document.scrollLeft() - o.scrollSpeed + ); + } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) < + o.scrollSensitivity ) { + scrolled = this.document.scrollLeft( + this.document.scrollLeft() + o.scrollSpeed + ); + } + + } + + if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { + $.ui.ddmanager.prepareOffsets( this, event ); + } + } + + //Regenerate the absolute position used for position checks + this.positionAbs = this._convertPositionTo( "absolute" ); + + //Set the helper position + 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"; + } + + //Rearrange + for ( i = this.items.length - 1; i >= 0; i-- ) { + + //Cache variables and intersection, continue if no intersection + item = this.items[ i ]; + itemElement = item.item[ 0 ]; + intersection = this._intersectsWithPointer( item ); + if ( !intersection ) { + continue; + } + + // Only put the placeholder inside the current Container, skip all + // items from other containers. This works because when moving + // an item from one container to another the + // currentContainer is switched before the placeholder is moved. + // + // Without this, moving items in "sub-sortables" can cause + // the placeholder to jitter between the outer and inner container. + if ( item.instance !== this.currentContainer ) { + continue; + } + + // Cannot intersect with itself + // no useless actions that have been done before + // no action if the item moved is the parent of the item checked + 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; + } + } + + //Post events to containers + this._contactContainers( event ); + + //Interconnect with droppables + if ( $.ui.ddmanager ) { + $.ui.ddmanager.drag( this, event ); + } + + //Call callbacks + this._trigger( "sort", event, this._uiHash() ); + + this.lastPositionAbs = this.positionAbs; + return false; + + }, + + _mouseStop: function( event, noPropagation ) { + + if ( !event ) { + return; + } + + //If we are using droppables, inform the manager about the drop + 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(); + } + + //Post deactivating events to containers + 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 ) { + + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, + // it unbinds ALL events from the original node! + 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; + + }, + + /* Be careful with the following core functions */ + _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 ) && // Right Half + x2 - ( this.helperProportions.width / 2 ) < r && // Left Half + t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half + y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half + + } + }, + + _intersectsWithPointer: function( item ) { + var verticalDirection, horizontalDirection, + isOverElementHeight = ( this.options.axis === "x" ) || + this._isOverAxis( + this.positionAbs.top + this.offset.click.top, item.top, item.height ), + isOverElementWidth = ( this.options.axis === "y" ) || + this._isOverAxis( + this.positionAbs.left + this.offset.click.left, item.left, item.width ), + isOverElement = isOverElementHeight && isOverElementWidth; + + if ( !isOverElement ) { + return false; + } + + verticalDirection = this._getDragVerticalDirection(); + horizontalDirection = this._getDragHorizontalDirection(); + + return this.floating ? + ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) + : ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); + + }, + + _intersectsWithSides: function( item ) { + + var isOverBottomHalf = this._isOverAxis( this.positionAbs.top + + this.offset.click.top, item.top + ( item.height / 2 ), item.height ), + isOverRightHalf = this._isOverAxis( this.positionAbs.left + + this.offset.click.left, item.left + ( item.width / 2 ), item.width ), + verticalDirection = this._getDragVerticalDirection(), + horizontalDirection = this._getDragHorizontalDirection(); + + if ( this.floating && horizontalDirection ) { + return ( ( horizontalDirection === "right" && isOverRightHalf ) || + ( horizontalDirection === "left" && !isOverRightHalf ) ); + } else { + return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) || + ( verticalDirection === "up" && !isOverBottomHalf ) ); + } + + }, + + _getDragVerticalDirection: function() { + var delta = this.positionAbs.top - this.lastPositionAbs.top; + return delta !== 0 && ( delta > 0 ? "down" : "up" ); + }, + + _getDragHorizontalDirection: function() { + var delta = this.positionAbs.left - this.lastPositionAbs.left; + return delta !== 0 && ( delta > 0 ? "right" : "left" ); + }, + + refresh: function( event ) { + this._refreshItems( event ); + this._setHandleClassName(); + this.refreshPositions(); + return this; + }, + + _connectWith: function() { + var options = this.options; + return options.connectWith.constructor === String ? + [ options.connectWith ] : + options.connectWith; + }, + + _getItemsAsjQuery: function( connected ) { + + var i, j, cur, inst, + items = [], + queries = [], + connectWith = this._connectWith(); + + if ( connectWith && connected ) { + for ( i = connectWith.length - 1; i >= 0; i-- ) { + cur = $( connectWith[ i ], this.document[ 0 ] ); + for ( j = cur.length - 1; j >= 0; j-- ) { + inst = $.data( cur[ j ], this.widgetFullName ); + if ( inst && inst !== this && !inst.options.disabled ) { + queries.push( [ $.isFunction( inst.options.items ) ? + inst.options.items.call( inst.element ) : + $( inst.options.items, inst.element ) + .not( ".ui-sortable-helper" ) + .not( ".ui-sortable-placeholder" ), inst ] ); + } + } + } + } + + queries.push( [ $.isFunction( this.options.items ) ? + this.options.items + .call( this.element, null, { options: this.options, item: this.currentItem } ) : + $( this.options.items, this.element ) + .not( ".ui-sortable-helper" ) + .not( ".ui-sortable-placeholder" ), this ] ); + + function addItems() { + items.push( this ); + } + for ( i = queries.length - 1; i >= 0; i-- ) { + queries[ i ][ 0 ].each( addItems ); + } + + return $( items ); + + }, + + _removeCurrentsFromItems: function() { + + var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" ); + + this.items = $.grep( this.items, function( item ) { + for ( var j = 0; j < list.length; j++ ) { + if ( list[ j ] === item.item[ 0 ] ) { + return false; + } + } + return true; + } ); + + }, + + _refreshItems: function( event ) { + + this.items = []; + this.containers = [ this ]; + + var i, j, cur, inst, targetData, _queries, item, queriesLength, + items = this.items, + queries = [ [ $.isFunction( this.options.items ) ? + this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) : + $( this.options.items, this.element ), this ] ], + connectWith = this._connectWith(); + + //Shouldn't be run the first time through due to massive slow-down + if ( connectWith && this.ready ) { + for ( i = connectWith.length - 1; i >= 0; i-- ) { + cur = $( connectWith[ i ], this.document[ 0 ] ); + for ( j = cur.length - 1; j >= 0; j-- ) { + inst = $.data( cur[ j ], this.widgetFullName ); + if ( inst && inst !== this && !inst.options.disabled ) { + queries.push( [ $.isFunction( inst.options.items ) ? + inst.options.items + .call( inst.element[ 0 ], event, { item: this.currentItem } ) : + $( inst.options.items, inst.element ), inst ] ); + this.containers.push( inst ); + } + } + } + } + + for ( i = queries.length - 1; i >= 0; i-- ) { + targetData = queries[ i ][ 1 ]; + _queries = queries[ i ][ 0 ]; + + for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) { + item = $( _queries[ j ] ); + + // Data for target checking (mouse manager) + item.data( this.widgetName + "-item", targetData ); + + items.push( { + item: item, + instance: targetData, + width: 0, height: 0, + left: 0, top: 0 + } ); + } + } + + }, + + refreshPositions: function( fast ) { + + // Determine whether items are being displayed horizontally + this.floating = this.items.length ? + this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : + false; + + //This has to be redone because due to the item being moved out/into the offsetParent, + // the offsetParent's position will change + if ( this.offsetParent && this.helper ) { + this.offset.parent = this._getParentOffset(); + } + + var i, item, t, p; + + for ( i = this.items.length - 1; i >= 0; i-- ) { + item = this.items[ i ]; + + //We ignore calculating positions of all connected containers when we're not over them + if ( item.instance !== this.currentContainer && this.currentContainer && + item.item[ 0 ] !== this.currentItem[ 0 ] ) { + continue; + } + + t = this.options.toleranceElement ? + $( this.options.toleranceElement, item.item ) : + item.item; + + if ( !fast ) { + item.width = t.outerWidth(); + item.height = t.outerHeight(); + } + + p = t.offset(); + item.left = p.left; + item.top = p.top; + } + + if ( this.options.custom && this.options.custom.refreshContainers ) { + this.options.custom.refreshContainers.call( this ); + } else { + for ( i = this.containers.length - 1; i >= 0; i-- ) { + p = this.containers[ i ].element.offset(); + this.containers[ i ].containerCache.left = p.left; + this.containers[ i ].containerCache.top = p.top; + this.containers[ i ].containerCache.width = + this.containers[ i ].element.outerWidth(); + this.containers[ i ].containerCache.height = + this.containers[ i ].element.outerHeight(); + } + } + + return this; + }, + + _createPlaceholder: function( that ) { + that = that || this; + var className, + o = that.options; + + if ( !o.placeholder || o.placeholder.constructor === String ) { + className = o.placeholder; + o.placeholder = { + element: function() { + + var nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(), + element = $( "<" + nodeName + ">", that.document[ 0 ] ); + + that._addClass( element, "ui-sortable-placeholder", + className || that.currentItem[ 0 ].className ) + ._removeClass( element, "ui-sortable-helper" ); + + if ( nodeName === "tbody" ) { + that._createTrPlaceholder( + that.currentItem.find( "tr" ).eq( 0 ), + $( "<tr>", that.document[ 0 ] ).appendTo( element ) + ); + } else if ( nodeName === "tr" ) { + that._createTrPlaceholder( that.currentItem, element ); + } else if ( nodeName === "img" ) { + element.attr( "src", that.currentItem.attr( "src" ) ); + } + + if ( !className ) { + element.css( "visibility", "hidden" ); + } + + return element; + }, + update: function( container, p ) { + + // 1. If a className is set as 'placeholder option, we don't force sizes - + // the class is responsible for that + // 2. The option 'forcePlaceholderSize can be enabled to force it even if a + // class name is specified + if ( className && !o.forcePlaceholderSize ) { + return; + } + + //If the element doesn't have a actual height by itself (without styles coming + // from a stylesheet), it receives the inline height from the dragged item + if ( !p.height() ) { + p.height( + that.currentItem.innerHeight() - + parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) - + parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) ); + } + if ( !p.width() ) { + p.width( + that.currentItem.innerWidth() - + parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) - + parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) ); + } + } + }; + } + + //Create the placeholder + that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) ); + + //Append it after the actual current item + that.currentItem.after( that.placeholder ); + + //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) + o.placeholder.update( that, that.placeholder ); + + }, + + _createTrPlaceholder: function( sourceTr, targetTr ) { + var that = this; + + sourceTr.children().each( function() { + $( "<td> </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; + + // Get innermost container that intersects with item + for ( i = this.containers.length - 1; i >= 0; i-- ) { + + // Never consider a container that's located within the item itself + if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) { + continue; + } + + if ( this._intersectsWith( this.containers[ i ].containerCache ) ) { + + // If we've already found a container and it's more "inner" than this, then continue + if ( innermostContainer && + $.contains( + this.containers[ i ].element[ 0 ], + innermostContainer.element[ 0 ] ) ) { + continue; + } + + innermostContainer = this.containers[ i ]; + innermostIndex = i; + + } else { + + // container doesn't intersect. trigger "out" event if necessary + if ( this.containers[ i ].containerCache.over ) { + this.containers[ i ]._trigger( "out", event, this._uiHash( this ) ); + this.containers[ i ].containerCache.over = 0; + } + } + + } + + // If no intersecting containers found, return + if ( !innermostContainer ) { + return; + } + + // Move the item into the container if it's not there already + 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 { + + // When entering a new container, we will find the item with the least distance and + // append our item near it + 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"; + } + } + + //Check if dropOnEmpty is enabled + if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) { + return; + } + + if ( this.currentContainer === this.containers[ innermostIndex ] ) { + if ( !this.currentContainer.containerCache.over ) { + this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); + this.currentContainer.containerCache.over = 1; + } + return; + } + + itemWithLeastDistance ? + this._rearrange( event, itemWithLeastDistance, null, true ) : + this._rearrange( event, null, this.containers[ innermostIndex ].element, true ); + this._trigger( "change", event, this._uiHash() ); + this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) ); + this.currentContainer = this.containers[ innermostIndex ]; + + //Update the placeholder + this.options.placeholder.update( this.currentContainer, this.placeholder ); + + this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); + this.containers[ innermostIndex ].containerCache.over = 1; + } + + }, + + _createHelper: function( event ) { + + var o = this.options, + helper = $.isFunction( o.helper ) ? + $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) : + ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem ); + + //Add the helper to the DOM if that didn't happen already + if ( !helper.parents( "body" ).length ) { + $( o.appendTo !== "parent" ? + o.appendTo : + this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] ); + } + + if ( helper[ 0 ] === this.currentItem[ 0 ] ) { + this._storedCSS = { + width: this.currentItem[ 0 ].style.width, + height: this.currentItem[ 0 ].style.height, + position: this.currentItem.css( "position" ), + top: this.currentItem.css( "top" ), + left: this.currentItem.css( "left" ) + }; + } + + if ( !helper[ 0 ].style.width || o.forceHelperSize ) { + helper.width( this.currentItem.width() ); + } + if ( !helper[ 0 ].style.height || o.forceHelperSize ) { + helper.height( this.currentItem.height() ); + } + + return helper; + + }, + + _adjustOffsetFromHelper: function( obj ) { + if ( typeof obj === "string" ) { + obj = obj.split( " " ); + } + if ( $.isArray( obj ) ) { + obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; + } + if ( "left" in obj ) { + this.offset.click.left = obj.left + this.margins.left; + } + if ( "right" in obj ) { + this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + } + if ( "top" in obj ) { + this.offset.click.top = obj.top + this.margins.top; + } + if ( "bottom" in obj ) { + this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + } + }, + + _getParentOffset: function() { + + //Get the offsetParent and cache its position + this.offsetParent = this.helper.offsetParent(); + var po = this.offsetParent.offset(); + + // This is a special case where we need to modify a offset calculated on start, since the + // following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the + // next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't + // the document, which means that the scroll is included in the initial calculation of the + // offset of the parent, and never recalculated upon drag + 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(); + } + + // This needs to be actually done for all browsers, since pageX/pageY includes this + // information with an ugly IE fix + 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: ( + + // The absolute mouse position + pos.top + + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.top * mod + + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.top * mod - + ( ( this.cssPosition === "fixed" ? + -this.scrollParent.scrollTop() : + ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod ) + ), + left: ( + + // The absolute mouse position + pos.left + + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.left * mod + + + // The offsetParent's offset without borders (offset + border) + 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 ); + + // This is another very weird special case that only happens for relative elements: + // 1. If the css position is relative + // 2. and the scroll parent is the document or similar to the offset parent + // we have to refresh the relative offset during the scroll so there are no jumps + if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] && + this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) { + this.offset.relative = this._getRelativeOffset(); + } + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options + + 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: ( + + // The absolute mouse position + pageY - + + // Click offset (relative to the element) + this.offset.click.top - + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.top - + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.top + + ( ( this.cssPosition === "fixed" ? + -this.scrollParent.scrollTop() : + ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) ) + ), + left: ( + + // The absolute mouse position + pageX - + + // Click offset (relative to the element) + this.offset.click.left - + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.left - + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.left + + ( ( this.cssPosition === "fixed" ? + -this.scrollParent.scrollLeft() : + scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) + ) + }; + + }, + + _rearrange: function( event, i, a, hardRefresh ) { + + a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) : + i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ], + ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) ); + + //Various things done here to improve the performance: + // 1. we create a setTimeout, that calls refreshPositions + // 2. on the instance, we have a counter variable, that get's higher after every append + // 3. on the local scope, we copy the counter variable, and check in the timeout, + // if it's still the same + // 4. this lets only the last addition to the timeout stack through + this.counter = this.counter ? ++this.counter : 1; + var counter = this.counter; + + this._delay( function() { + if ( counter === this.counter ) { + + //Precompute after each DOM insertion, NOT on mousemove + this.refreshPositions( !hardRefresh ); + } + } ); + + }, + + _clear: function( event, noPropagation ) { + + this.reverting = false; + + // We delay all events that have to be triggered to after the point where the placeholder + // has been removed and everything else normalized again + var i, + delayedTriggers = []; + + // We first have to update the dom position of the actual currentItem + // Note: don't do it if the current item is already removed (by a user), or it gets + // reappended (see #4088) + 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 ) { + + // Trigger update callback if the DOM position has changed + delayedTriggers.push( function( event ) { + this._trigger( "update", event, this._uiHash() ); + } ); + } + + // Check if the items Container has Changed and trigger appropriate + // events. + 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 ) ); + } + } + + //Post events to containers + 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; + } + } + + //Do what was originally in plugins + 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]).remove(); would have been the jQuery way - unfortunately, + // it unbinds ALL events from the original node! + 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++ ) { + + // Trigger all delayed events + 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 + }; + } + +} ); + + +/*! + * jQuery UI Spinner 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Spinner +//>>group: Widgets +//>>description: Displays buttons to easily input numbers via the keyboard or mouse. +//>>docs: http://api.jqueryui.com/spinner/ +//>>demos: http://jqueryui.com/spinner/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/spinner.css +//>>css.theme: ../../themes/base/theme.css + + + +function spinnerModifer( fn ) { + return function() { + var previous = this.element.val(); + fn.apply( this, arguments ); + this._refresh(); + if ( previous !== this.element.val() ) { + this._trigger( "change" ); + } + }; +} + +$.widget( "ui.spinner", { + version: "1.12.1", + 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() { + + // handle string values that need to be parsed + this._setOption( "max", this.options.max ); + this._setOption( "min", this.options.min ); + this._setOption( "step", this.options.step ); + + // Only format if there is a value, prevents the field from being marked + // as invalid in Firefox, see #9573. + if ( this.value() !== "" ) { + + // Format the value, but don't constrain. + this._value( this.element.val(), true ); + } + + this._draw(); + this._on( this._events ); + this._refresh(); + + // Turning off autocomplete prevents the browser from remembering the + // value when navigating through history, so we re-enable autocomplete + // if the page is unloaded before the widget is destroyed. #7790 + this._on( this.window, { + beforeunload: function() { + this.element.removeAttr( "autocomplete" ); + } + } ); + }, + + _getCreateOptions: function() { + var options = this._super(); + var element = this.element; + + $.each( [ "min", "max", "step" ], function( i, option ) { + var value = element.attr( option ); + if ( value != null && value.length ) { + options[ option ] = value; + } + } ); + + return options; + }, + + _events: { + keydown: function( event ) { + if ( this._start( event ) && this._keydown( event ) ) { + event.preventDefault(); + } + }, + keyup: "_stop", + focus: function() { + this.previous = this.element.val(); + }, + blur: function( event ) { + if ( this.cancelBlur ) { + delete this.cancelBlur; + return; + } + + this._stop(); + this._refresh(); + if ( this.previous !== this.element.val() ) { + this._trigger( "change", event ); + } + }, + mousewheel: function( event, delta ) { + if ( !delta ) { + return; + } + if ( !this.spinning && !this._start( event ) ) { + return false; + } + + this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event ); + clearTimeout( this.mousewheelTimer ); + this.mousewheelTimer = this._delay( function() { + if ( this.spinning ) { + this._stop( event ); + } + }, 100 ); + event.preventDefault(); + }, + "mousedown .ui-spinner-button": function( event ) { + var previous; + + // We never want the buttons to have focus; whenever the user is + // interacting with the spinner, the focus should be on the input. + // If the input is focused then this.previous is properly set from + // when the input first received focus. If the input is not focused + // then we need to set this.previous based on the value before spinning. + 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; + + // support: IE + // IE sets focus asynchronously, so we need to check if focus + // moved off of the input because the user clicked on the button. + this._delay( function() { + this.previous = previous; + } ); + } + } + + // Ensure focus is on (or stays on) the text field + event.preventDefault(); + checkFocus.call( this ); + + // Support: IE + // IE doesn't prevent moving focus even with event.preventDefault() + // so we set a flag to know when we should ignore the blur event + // and check (again) if focus moved off of the input. + 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 ) { + + // button will add ui-state-active if mouse was down while mouseleave and kept down + 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 ); + }, + + // TODO: do we really want to consider this a stop? + // shouldn't we just stop the repeater and wait until mouseup before + // we trigger the stop event? + "mouseleave .ui-spinner-button": "_stop" + }, + + // Support mobile enhanced option and make backcompat more sane + _enhance: function() { + this.uiSpinner = this.element + .attr( "autocomplete", "off" ) + .wrap( "<span>" ) + .parent() + + // Add buttons + .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" ); + + // Button bindings + this.buttons = this.uiSpinner.children( "a" ) + .attr( "tabIndex", -1 ) + .attr( "aria-hidden", true ) + .button( { + classes: { + "ui-button": "" + } + } ); + + // TODO: Right now button does not support classes this is already updated in button PR + 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 + } ); + + // IE 6 doesn't understand height: 50% for the buttons + // unless the wrapper has an explicit height + if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) && + this.uiSpinner.height() > 0 ) { + this.uiSpinner.height( this.uiSpinner.height() ); + } + }, + + _keydown: function( event ) { + var options = this.options, + keyCode = $.ui.keyCode; + + switch ( event.keyCode ) { + case keyCode.UP: + this._repeat( null, 1, event ); + return true; + case keyCode.DOWN: + this._repeat( null, -1, event ); + return true; + case keyCode.PAGE_UP: + this._repeat( null, options.page, event ); + return true; + case keyCode.PAGE_DOWN: + this._repeat( null, -options.page, event ); + return true; + } + + return false; + }, + + _start: function( event ) { + if ( !this.spinning && this._trigger( "start", event ) === false ) { + return false; + } + + if ( !this.counter ) { + this.counter = 1; + } + this.spinning = true; + return true; + }, + + _repeat: function( i, steps, event ) { + i = i || 500; + + clearTimeout( this.timer ); + this.timer = this._delay( function() { + this._repeat( 40, steps, event ); + }, i ); + + this._spin( steps * this.options.step, event ); + }, + + _spin: function( step, event ) { + var value = this.value() || 0; + + if ( !this.counter ) { + this.counter = 1; + } + + value = this._adjustValue( value + step * this._increment( this.counter ) ); + + if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) { + this._value( value ); + this.counter++; + } + }, + + _increment: function( i ) { + var incremental = this.options.incremental; + + if ( incremental ) { + return $.isFunction( incremental ) ? + incremental( i ) : + Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ); + } + + return 1; + }, + + _precision: function() { + var precision = this._precisionOf( this.options.step ); + if ( this.options.min !== null ) { + precision = Math.max( precision, this._precisionOf( this.options.min ) ); + } + return precision; + }, + + _precisionOf: function( num ) { + var str = num.toString(), + decimal = str.indexOf( "." ); + return decimal === -1 ? 0 : str.length - decimal - 1; + }, + + _adjustValue: function( value ) { + var base, aboveMin, + options = this.options; + + // Make sure we're at a valid step + // - find out where we are relative to the base (min or 0) + base = options.min !== null ? options.min : 0; + aboveMin = value - base; + + // - round to the nearest step + aboveMin = Math.round( aboveMin / options.step ) * options.step; + + // - rounding is based on 0, so adjust back to our base + value = base + aboveMin; + + // Fix precision from bad JS floating point math + value = parseFloat( value.toFixed( this._precision() ) ); + + // Clamp the value + if ( options.max !== null && value > options.max ) { + return options.max; + } + if ( options.min !== null && value < options.min ) { + return options.min; + } + + return value; + }, + + _stop: function( event ) { + if ( !this.spinning ) { + return; + } + + clearTimeout( this.timer ); + clearTimeout( this.mousewheelTimer ); + this.counter = 0; + this.spinning = false; + this._trigger( "stop", event ); + }, + + _setOption: function( key, value ) { + var prevValue, first, last; + + if ( key === "culture" || key === "numberFormat" ) { + prevValue = this._parse( this.element.val() ); + this.options[ key ] = value; + this.element.val( this._format( prevValue ) ); + return; + } + + if ( key === "max" || key === "min" || key === "step" ) { + if ( typeof value === "string" ) { + value = this._parse( value ); + } + } + if ( key === "icons" ) { + first = this.buttons.first().find( ".ui-icon" ); + this._removeClass( first, null, this.options.icons.up ); + this._addClass( first, null, value.up ); + last = this.buttons.last().find( ".ui-icon" ); + this._removeClass( last, null, this.options.icons.down ); + this._addClass( last, null, value.down ); + } + + this._super( key, value ); + }, + + _setOptionDisabled: function( value ) { + this._super( value ); + + this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value ); + this.element.prop( "disabled", !!value ); + this.buttons.button( value ? "disable" : "enable" ); + }, + + _setOptions: spinnerModifer( function( options ) { + this._super( options ); + } ), + + _parse: function( val ) { + if ( typeof val === "string" && val !== "" ) { + val = window.Globalize && this.options.numberFormat ? + Globalize.parseFloat( val, 10, this.options.culture ) : +val; + } + return val === "" || isNaN( val ) ? null : val; + }, + + _format: function( value ) { + if ( value === "" ) { + return ""; + } + return window.Globalize && this.options.numberFormat ? + Globalize.format( value, this.options.numberFormat, this.options.culture ) : + value; + }, + + _refresh: function() { + this.element.attr( { + "aria-valuemin": this.options.min, + "aria-valuemax": this.options.max, + + // TODO: what should we do with values that can't be parsed? + "aria-valuenow": this._parse( this.element.val() ) + } ); + }, + + isValid: function() { + var value = this.value(); + + // Null is invalid + if ( value === null ) { + return false; + } + + // If value gets adjusted, it's invalid + return value === this._adjustValue( value ); + }, + + // Update the value without triggering change + _value: function( value, allowAny ) { + var parsed; + if ( value !== "" ) { + parsed = this._parse( value ); + if ( parsed !== null ) { + if ( !allowAny ) { + parsed = this._adjustValue( parsed ); + } + value = this._format( parsed ); + } + } + this.element.val( value ); + this._refresh(); + }, + + _destroy: function() { + this.element + .prop( "disabled", false ) + .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" ); + + this.uiSpinner.replaceWith( this.element ); + }, + + stepUp: spinnerModifer( function( steps ) { + this._stepUp( steps ); + } ), + _stepUp: function( steps ) { + if ( this._start() ) { + this._spin( ( steps || 1 ) * this.options.step ); + this._stop(); + } + }, + + stepDown: spinnerModifer( function( steps ) { + this._stepDown( steps ); + } ), + _stepDown: function( steps ) { + if ( this._start() ) { + this._spin( ( steps || 1 ) * -this.options.step ); + this._stop(); + } + }, + + pageUp: spinnerModifer( function( pages ) { + this._stepUp( ( pages || 1 ) * this.options.page ); + } ), + + pageDown: spinnerModifer( function( pages ) { + this._stepDown( ( pages || 1 ) * this.options.page ); + } ), + + value: function( newVal ) { + if ( !arguments.length ) { + return this._parse( this.element.val() ); + } + spinnerModifer( this._value ).call( this, newVal ); + }, + + widget: function() { + return this.uiSpinner; + } +} ); + +// DEPRECATED +// TODO: switch return back to widget declaration at top of file when this is removed +if ( $.uiBackCompat !== false ) { + + // Backcompat for spinner html extension points + $.widget( "ui.spinner", $.ui.spinner, { + _enhance: function() { + this.uiSpinner = this.element + .attr( "autocomplete", "off" ) + .wrap( this._uiSpinnerHtml() ) + .parent() + + // Add buttons + .append( this._buttonHtml() ); + }, + _uiSpinnerHtml: function() { + return "<span>"; + }, + + _buttonHtml: function() { + return "<a></a><a></a>"; + } + } ); +} + +var widgetsSpinner = $.ui.spinner; + + +/*! + * jQuery UI Tabs 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +//>>label: Tabs +//>>group: Widgets +//>>description: Transforms a set of container elements into a tab structure. +//>>docs: http://api.jqueryui.com/tabs/ +//>>demos: http://jqueryui.com/tabs/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/tabs.css +//>>css.theme: ../../themes/base/theme.css + + + +$.widget( "ui.tabs", { + version: "1.12.1", + 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, + + // Callbacks + 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, "" ); + + // Decoding may throw an error if the URL isn't UTF-8 (#9518) + 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(); + + // Take disabling tabs via class attribute from HTML + // into account and update option properly. + if ( $.isArray( options.disabled ) ) { + options.disabled = $.unique( options.disabled.concat( + $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { + return that.tabs.index( li ); + } ) + ) ).sort(); + } + + // Check for length avoids error when initializing empty list + 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 ) { + + // check the fragment identifier in the URL + if ( locationHash ) { + this.tabs.each( function( i, tab ) { + if ( $( tab ).attr( "aria-controls" ) === locationHash ) { + active = i; + return false; + } + } ); + } + + // Check for a tab marked active via a class + if ( active === null ) { + active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); + } + + // No active tab, set to false + if ( active === null || active === -1 ) { + active = this.tabs.length ? 0 : false; + } + } + + // Handle numbers: negative, out of range + if ( active !== false ) { + active = this.tabs.index( this.tabs.eq( active ) ); + if ( active === -1 ) { + active = collapsible ? false : 0; + } + } + + // Don't allow collapsible: false and active: false + 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: + + // Activate only, no collapsing + event.preventDefault(); + clearTimeout( this.activating ); + this._activate( selectedIndex ); + return; + case $.ui.keyCode.ENTER: + + // Toggle (cancel delayed activation, allow collapsing) + event.preventDefault(); + clearTimeout( this.activating ); + + // Determine if we should collapse or activate + this._activate( selectedIndex === this.options.active ? false : selectedIndex ); + return; + default: + return; + } + + // Focus the appropriate tab, based on which key was pressed + event.preventDefault(); + clearTimeout( this.activating ); + selectedIndex = this._focusNextTab( selectedIndex, goingForward ); + + // Navigating with control/command key will prevent automatic activation + if ( !event.ctrlKey && !event.metaKey ) { + + // Update aria-selected immediately so that AT think the tab is already selected. + // Otherwise AT may confuse the user by stating that they need to activate the tab, + // but the tab will already be activated by the time the announcement finishes. + 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; + } + + // Ctrl+up moves focus to the current tab + if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { + event.preventDefault(); + this.active.trigger( "focus" ); + } + }, + + // Alt+page up/down moves focus to the previous/next tab (and activates) + _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" ) { + + // _activate() will handle invalid values and update this.options + this._activate( value ); + return; + } + + this._super( key, value ); + + if ( key === "collapsible" ) { + this._toggleClass( "ui-tabs-collapsible", null, value ); + + // Setting collapsible: false while collapsed; open first panel + 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===!1||!this.anchors.length){options.active=!1;this.active=$()}else if(this.active.length&&!$.contains(this.tablist[0],this.active[0])){if(this.tabs.length===options.disabled.length){options.active=!1;this.active=$()}else{this._activate(this._findNextTab(Math.max(0,options.active-1),!1))}}else{options.active=this.tabs.index(this.active)} +this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled);this._setupEvents(this.options.event);this._setupHeightStyle(this.options.heightStyle);this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1});this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"});if(!this.active.length){this.tabs.eq(0).attr("tabIndex",0)}else{this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0});this._addClass(this.active,"ui-tabs-active","ui-state-active");this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})}},_processTabs:function(){var that=this,prevTabs=this.tabs,prevAnchors=this.anchors,prevPanels=this.panels;this.tablist=this._getList().attr("role","tablist");this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header");this.tablist.on("mousedown"+this.eventNamespace,"> li",function(event){if($(this).is(".ui-state-disabled")){event.preventDefault()}}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){if($(this).closest("li").is(".ui-state-disabled")){this.blur()}});this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1});this._addClass(this.tabs,"ui-tabs-tab","ui-state-default");this.anchors=this.tabs.map(function(){return $("a",this)[0]}).attr({role:"presentation",tabIndex:-1});this._addClass(this.anchors,"ui-tabs-anchor");this.panels=$();this.anchors.each(function(i,anchor){var selector,panel,panelId,anchorId=$(anchor).uniqueId().attr("id"),tab=$(anchor).closest("li"),originalAriaControls=tab.attr("aria-controls");if(that._isLocal(anchor)){selector=anchor.hash;panelId=selector.substring(1);panel=that.element.find(that._sanitizeSelector(selector))}else{panelId=tab.attr("aria-controls")||$({}).uniqueId()[0].id;selector="#"+panelId;panel=that.element.find(selector);if(!panel.length){panel=that._createPanel(panelId);panel.insertAfter(that.panels[i-1]||that.tablist)} +panel.attr("aria-live","polite")} +if(panel.length){that.panels=that.panels.add(panel)} +if(originalAriaControls){tab.data("ui-tabs-aria-controls",originalAriaControls)} +tab.attr({"aria-controls":panelId,"aria-labelledby":anchorId});panel.attr("aria-labelledby",anchorId)});this.panels.attr("role","tabpanel");this._addClass(this.panels,"ui-tabs-panel","ui-widget-content");if(prevTabs){this._off(prevTabs.not(this.tabs));this._off(prevAnchors.not(this.anchors));this._off(prevPanels.not(this.panels))}},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(id){return $("<div>").attr("id",id).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(disabled){var currentItem,li,i;if($.isArray(disabled)){if(!disabled.length){disabled=!1}else if(disabled.length===this.anchors.length){disabled=!0}} +for(i=0;(li=this.tabs[i]);i++){currentItem=$(li);if(disabled===!0||$.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===!0)},_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(!0,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(!0)});this.element.children().not(this.panels).each(function(){maxHeight-=$(this).outerHeight(!0)});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)===!1)){return} +options.active=collapsing?!1: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=!0;function complete(){that.running=!1;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===!1?$():this.tabs.eq(index)},_getIndex:function(index){if(typeof index==="string"){index=this.anchors.index(this.anchors.filter("[href$='"+$.ui.escapeSelector(index)+"']"))} +return index},_destroy:function(){if(this.xhr){this.xhr.abort()} +this.tablist.removeAttr("role").off(this.eventNamespace);this.anchors.removeAttr("role tabIndex").removeUniqueId();this.tabs.add(this.panels).each(function(){if($.data(this,"ui-tabs-destroy")){$(this).remove()}else{$(this).removeAttr("role tabIndex "+"aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}});this.tabs.each(function(){var li=$(this),prev=li.data("ui-tabs-aria-controls");if(prev){li.attr("aria-controls",prev).removeData("ui-tabs-aria-controls")}else{li.removeAttr("aria-controls")}});this.panels.show();if(this.options.heightStyle!=="content"){this.panels.css("height","")}},enable:function(index){var disabled=this.options.disabled;if(disabled===!1){return} +if(index===undefined){disabled=!1}else{index=this._getIndex(index);if($.isArray(disabled)){disabled=$.map(disabled,function(num){return num!==index?num:null})}else{disabled=$.map(this.tabs,function(li,num){return num!==index?num:null})}} +this._setOptionDisabled(disabled)},disable:function(index){var disabled=this.options.disabled;if(disabled===!0){return} +if(index===undefined){disabled=!0}else{index=this._getIndex(index);if($.inArray(index,disabled)!==-1){return} +if($.isArray(disabled)){disabled=$.merge([index],disabled).sort()}else{disabled=[index]}} +this._setOptionDisabled(disabled)},load:function(index,event){index=this._getIndex(index);var that=this,tab=this.tabs.eq(index),anchor=tab.find(".ui-tabs-anchor"),panel=this._getPanelForTab(tab),eventData={tab:tab,panel:panel},complete=function(jqXHR,status){if(status==="abort"){that.panels.stop(!1,!0)} +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!==!1){$.widget("ui.tabs",$.ui.tabs,{_processTabs:function(){this._superApply(arguments);this._addClass(this.tabs,"ui-tab")}})} +var widgetsTabs=$.ui.tabs;$.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var title=$(this).attr("title")||"";return $("<a>").text(title).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(elem,id){var describedby=(elem.attr("aria-describedby")||"").split(/\s+/);describedby.push(id);elem.data("ui-tooltip-id",id).attr("aria-describedby",$.trim(describedby.join(" ")))},_removeDescribedBy:function(elem){var id=elem.data("ui-tooltip-id"),describedby=(elem.attr("aria-describedby")||"").split(/\s+/),index=$.inArray(id,describedby);if(index!==-1){describedby.splice(index,1)} +elem.removeData("ui-tooltip-id");describedby=$.trim(describedby.join(" "));if(describedby){elem.attr("aria-describedby",describedby)}else{elem.removeAttr("aria-describedby")}},_create:function(){this._on({mouseover:"open",focusin:"open"});this.tooltips={};this.parents={};this.liveRegion=$("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body);this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible");this.disabledTitles=$([])},_setOption:function(key,value){var that=this;this._super(key,value);if(key==="content"){$.each(this.tooltips,function(id,tooltipData){that._updateContent(tooltipData.element)})}},_setOptionDisabled:function(value){this[value?"_disable":"_enable"]()},_disable:function(){var that=this;$.each(this.tooltips,function(id,tooltipData){var event=$.Event("blur");event.target=event.currentTarget=tooltipData.element[0];that.close(event,!0)});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",!0);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,!0)} +if(parent.attr("title")){parent.uniqueId();that.parents[this.id]={element:this,title:parent.attr("title")};parent.attr("title","")}})} +this._registerCloseHandlers(event,target);this._updateContent(target,event)},_updateContent:function(target,event){var content,contentOption=this.options.content,that=this,eventType=event?event.type:null;if(typeof contentOption==="string"||contentOption.nodeType||contentOption.jquery){return this._open(event,target,contentOption)} +content=contentOption.call(target[0],function(response){that._delay(function(){if(!target.data("ui-tooltip-open")){return} +if(event){event.type=eventType} +this._open(event,target,response)})});if(content){this._open(event,target,content)}},_open:function(event,target,content){var tooltipData,tooltip,delayedShow,a11yContent,positionOption=$.extend({},this.options.position);if(!content){return} +tooltipData=this._find(target);if(tooltipData){tooltipData.tooltip.find(".ui-tooltip-content").html(content);return} +if(target.is("[title]")){if(event&&event.type==="mouseover"){target.attr("title","")}else{target.removeAttr("title")}} +tooltipData=this._tooltip(target);tooltip=tooltipData.tooltip;this._addDescribedBy(target,tooltip.attr("id"));tooltip.find(".ui-tooltip-content").html(content);this.liveRegion.children().hide();a11yContent=$("<div>").html(tooltip.find(".ui-tooltip-content").html());a11yContent.removeAttr("name").find("[name]").removeAttr("name");a11yContent.removeAttr("id").find("[id]").removeAttr("id");a11yContent.appendTo(this.liveRegion);function position(event){positionOption.of=event;if(tooltip.is(":hidden")){return} +tooltip.position(positionOption)} +if(this.options.track&&event&&/^mouse/.test(event.type)){this._on(this.document,{mousemove:position});position(event)}else{tooltip.position($.extend({of:target},this.options.position))} +tooltip.hide();this._show(tooltip,this.options.show);if(this.options.track&&this.options.show&&this.options.show.delay){delayedShow=this.delayedShow=setInterval(function(){if(tooltip.is(":visible")){position(positionOption.of);clearInterval(delayedShow)}},$.fx.interval)} +this._trigger("open",event,{tooltip:tooltip})},_registerCloseHandlers:function(event,target){var events={keyup:function(event){if(event.keyCode===$.ui.keyCode.ESCAPE){var fakeEvent=$.Event(event);fakeEvent.currentTarget=target[0];this.close(fakeEvent,!0)}}};if(target[0]!==this.element[0]){events.remove=function(){this._removeTooltip(this._find(target).tooltip)}} +if(!event||event.type==="mouseover"){events.mouseleave="close"} +if(!event||event.type==="focusin"){events.focusout="close"} +this._on(!0,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=!0;tooltip.stop(!0);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=!0;this._trigger("close",event,{tooltip:tooltip});if(!tooltipData.hiding){tooltipData.closing=!1}},_tooltip:function(element){var tooltip=$("<div>").attr("role","tooltip"),content=$("<div>").appendTo(tooltip),id=tooltip.uniqueId().attr("id");this._addClass(content,"ui-tooltip-content");this._addClass(tooltip,"ui-tooltip","ui-widget ui-widget-content");tooltip.appendTo(this._appendTo(element));return this.tooltips[id]={element:element,tooltip:tooltip}},_find:function(target){var id=target.data("ui-tooltip-id");return id?this.tooltips[id]:null},_removeTooltip:function(tooltip){tooltip.remove();delete this.tooltips[tooltip.attr("id")]},_appendTo:function(target){var element=target.closest(".ui-front, dialog");if(!element.length){element=this.document[0].body} +return element},_destroy:function(){var that=this;$.each(this.tooltips,function(id,tooltipData){var event=$.Event("blur"),element=tooltipData.element;event.target=event.currentTarget=element[0];that.close(event,!0);$("#"+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!==!1){$.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(root,factory){if(typeof define==='function'&&define.amd){define('remodal',['jquery'],function($){return factory(root,$)})}else if(typeof exports==='object'){factory(root,require('jquery'))}else{factory(root,root.jQuery||root.Zepto)}})(this,function(global,$){'use strict';var PLUGIN_NAME='remodal';var NAMESPACE=global.REMODAL_GLOBALS&&global.REMODAL_GLOBALS.NAMESPACE||PLUGIN_NAME;var ANIMATIONSTART_EVENTS=$.map(['animationstart','webkitAnimationStart','MSAnimationStart','oAnimationStart'],function(eventName){return eventName+'.'+NAMESPACE}).join(' ');var ANIMATIONEND_EVENTS=$.map(['animationend','webkitAnimationEnd','MSAnimationEnd','oAnimationEnd'],function(eventName){return eventName+'.'+NAMESPACE}).join(' ');var DEFAULTS=$.extend({hashTracking:!0,closeOnConfirm:!0,closeOnCancel:!0,closeOnEscape:!0,closeOnOutsideClick:!0,modifier:''},global.REMODAL_GLOBALS&&global.REMODAL_GLOBALS.DEFAULTS);var STATES={CLOSING:'closing',CLOSED:'closed',OPENING:'opening',OPENED:'opened'};var STATE_CHANGE_REASONS={CONFIRMATION:'confirmation',CANCELLATION:'cancellation'};var IS_ANIMATION=(function(){var style=document.createElement('div').style;return style.animationName!==undefined||style.WebkitAnimationName!==undefined||style.MozAnimationName!==undefined||style.msAnimationName!==undefined||style.OAnimationName!==undefined})();var IS_IOS=/iPad|iPhone|iPod/.test(navigator.platform);var current;var scrollTop;function getAnimationDuration($elem){if(IS_ANIMATION&&$elem.css('animation-name')==='none'&&$elem.css('-webkit-animation-name')==='none'&&$elem.css('-moz-animation-name')==='none'&&$elem.css('-o-animation-name')==='none'&&$elem.css('-ms-animation-name')==='none'){return 0} +var duration=$elem.css('animation-duration')||$elem.css('-webkit-animation-duration')||$elem.css('-moz-animation-duration')||$elem.css('-o-animation-duration')||$elem.css('-ms-animation-duration')||'0s';var delay=$elem.css('animation-delay')||$elem.css('-webkit-animation-delay')||$elem.css('-moz-animation-delay')||$elem.css('-o-animation-delay')||$elem.css('-ms-animation-delay')||'0s';var iterationCount=$elem.css('animation-iteration-count')||$elem.css('-webkit-animation-iteration-count')||$elem.css('-moz-animation-iteration-count')||$elem.css('-o-animation-iteration-count')||$elem.css('-ms-animation-iteration-count')||'1';var max;var len;var num;var i;duration=duration.split(', ');delay=delay.split(', ');iterationCount=iterationCount.split(', ');for(i=0,len=duration.length,max=Number.NEGATIVE_INFINITY;i<len;i++){num=parseFloat(duration[i])*parseInt(iterationCount[i],10)+parseFloat(delay[i]);if(num>max){max=num}} +return num} +function getScrollbarWidth(){if($(document.body).height()<=$(window).height()){return 0} +var outer=document.createElement('div');var inner=document.createElement('div');var widthNoScroll;var widthWithScroll;outer.style.visibility='hidden';outer.style.width='100px';document.body.appendChild(outer);widthNoScroll=outer.offsetWidth;outer.style.overflow='scroll';inner.style.width='100%';outer.appendChild(inner);widthWithScroll=inner.offsetWidth;outer.parentNode.removeChild(outer);return widthNoScroll-widthWithScroll} +function lockScreen(){if(IS_IOS){return} +var $html=$('html');var lockedClass=namespacify('is-locked');var paddingRight;var $body;if(!$html.hasClass(lockedClass)){$body=$(document.body);paddingRight=parseInt($body.css('padding-right'),10)+getScrollbarWidth();$body.css('padding-right',paddingRight+'px');$html.addClass(lockedClass)}} +function unlockScreen(){if(IS_IOS){return} +var $html=$('html');var lockedClass=namespacify('is-locked');var paddingRight;var $body;if($html.hasClass(lockedClass)){$body=$(document.body);paddingRight=parseInt($body.css('padding-right'),10)-getScrollbarWidth();$body.css('padding-right',paddingRight+'px');$html.removeClass(lockedClass)}} +function setState(instance,state,isSilent,reason){var newState=namespacify('is',state);var allStates=[namespacify('is',STATES.CLOSING),namespacify('is',STATES.OPENING),namespacify('is',STATES.CLOSED),namespacify('is',STATES.OPENED)].join(' ');instance.$bg.removeClass(allStates).addClass(newState);instance.$overlay.removeClass(allStates).addClass(newState);instance.$wrapper.removeClass(allStates).addClass(newState);instance.$modal.removeClass(allStates).addClass(newState);instance.state=state;!isSilent&&instance.$modal.trigger({type:state,reason:reason},[{reason:reason}])} +function syncWithAnimation(doBeforeAnimation,doAfterAnimation,instance){var runningAnimationsCount=0;var handleAnimationStart=function(e){if(e.target!==this){return} +runningAnimationsCount++};var handleAnimationEnd=function(e){if(e.target!==this){return} +if(--runningAnimationsCount===0){$.each(['$bg','$overlay','$wrapper','$modal'],function(index,elemName){instance[elemName].off(ANIMATIONSTART_EVENTS+' '+ANIMATIONEND_EVENTS)});doAfterAnimation()}};$.each(['$bg','$overlay','$wrapper','$modal'],function(index,elemName){instance[elemName].on(ANIMATIONSTART_EVENTS,handleAnimationStart).on(ANIMATIONEND_EVENTS,handleAnimationEnd)});doBeforeAnimation();if(getAnimationDuration(instance.$bg)===0&&getAnimationDuration(instance.$overlay)===0&&getAnimationDuration(instance.$wrapper)===0&&getAnimationDuration(instance.$modal)===0){$.each(['$bg','$overlay','$wrapper','$modal'],function(index,elemName){instance[elemName].off(ANIMATIONSTART_EVENTS+' '+ANIMATIONEND_EVENTS)});doAfterAnimation()}} +function halt(instance){if(instance.state===STATES.CLOSED){return} +$.each(['$bg','$overlay','$wrapper','$modal'],function(index,elemName){instance[elemName].off(ANIMATIONSTART_EVENTS+' '+ANIMATIONEND_EVENTS)});instance.$bg.removeClass(instance.settings.modifier);instance.$overlay.removeClass(instance.settings.modifier).hide();instance.$wrapper.hide();unlockScreen();setState(instance,STATES.CLOSED,!0)} +function parseOptions(str){var obj={};var arr;var len;var val;var i;str=str.replace(/\s*:\s*/g,':').replace(/\s*,\s*/g,',');arr=str.split(',');for(i=0,len=arr.length;i<len;i++){arr[i]=arr[i].split(':');val=arr[i][1];if(typeof val==='string'||val instanceof String){val=val==='true'||(val==='false'?!1:val)} +if(typeof val==='string'||val instanceof String){val=!isNaN(val)?+val:val} +obj[arr[i][0]]=val} +return obj} +function namespacify(){var result=NAMESPACE;for(var i=0;i<arguments.length;++i){result+='-'+arguments[i]} +return result} +function handleHashChangeEvent(){var id=location.hash.replace('#','');var instance;var $elem;if(!id){if(current&¤t.state===STATES.OPENED&¤t.settings.hashTracking){current.close()}}else{try{$elem=$('[data-'+PLUGIN_NAME+'-id="'+id+'"]')}catch(err){} +if($elem&&$elem.length){instance=$[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)];if(instance&&instance.settings.hashTracking){instance.open()}}}} +function Remodal($modal,options){var $body=$(document.body);var remodal=this;remodal.settings=$.extend({},DEFAULTS,options);remodal.index=$[PLUGIN_NAME].lookup.push(remodal)-1;remodal.state=STATES.CLOSED;remodal.$overlay=$('.'+namespacify('overlay'));if(!remodal.$overlay.length){remodal.$overlay=$('<div>').addClass(namespacify('overlay')+' '+namespacify('is',STATES.CLOSED)).hide();$body.append(remodal.$overlay)} +remodal.$bg=$('.'+namespacify('bg')).addClass(namespacify('is',STATES.CLOSED));remodal.$modal=$modal.addClass(NAMESPACE+' '+namespacify('is-initialized')+' '+remodal.settings.modifier+' '+namespacify('is',STATES.CLOSED)).attr('tabindex','-1');remodal.$wrapper=$('<div>').addClass(namespacify('wrapper')+' '+remodal.settings.modifier+' '+namespacify('is',STATES.CLOSED)).hide().append(remodal.$modal);$body.append(remodal.$wrapper);remodal.$wrapper.on('click.'+NAMESPACE,'[data-'+PLUGIN_NAME+'-action="close"]',function(e){e.preventDefault();remodal.close()});remodal.$wrapper.on('click.'+NAMESPACE,'[data-'+PLUGIN_NAME+'-action="cancel"]',function(e){e.preventDefault();remodal.$modal.trigger(STATE_CHANGE_REASONS.CANCELLATION);if(remodal.settings.closeOnCancel){remodal.close(STATE_CHANGE_REASONS.CANCELLATION)}});remodal.$wrapper.on('click.'+NAMESPACE,'[data-'+PLUGIN_NAME+'-action="confirm"]',function(e){e.preventDefault();remodal.$modal.trigger(STATE_CHANGE_REASONS.CONFIRMATION);if(remodal.settings.closeOnConfirm){remodal.close(STATE_CHANGE_REASONS.CONFIRMATION)}});remodal.$wrapper.on('click.'+NAMESPACE,function(e){var $target=$(e.target);if(!$target.hasClass(namespacify('wrapper'))){return} +if(remodal.settings.closeOnOutsideClick){remodal.close()}})} +Remodal.prototype.open=function(){var remodal=this;var id;if(remodal.state===STATES.OPENING||remodal.state===STATES.CLOSING){return} +id=remodal.$modal.attr('data-'+PLUGIN_NAME+'-id');if(id&&remodal.settings.hashTracking){scrollTop=$(window).scrollTop();location.hash=id} +if(current&¤t!==remodal){halt(current)} +current=remodal;lockScreen();remodal.$bg.addClass(remodal.settings.modifier);remodal.$overlay.addClass(remodal.settings.modifier).show();remodal.$wrapper.show().scrollTop(0);remodal.$modal.focus();syncWithAnimation(function(){setState(remodal,STATES.OPENING)},function(){setState(remodal,STATES.OPENED)},remodal)};Remodal.prototype.close=function(reason){var remodal=this;if(remodal.state===STATES.OPENING||remodal.state===STATES.CLOSING){return} +if(remodal.settings.hashTracking&&remodal.$modal.attr('data-'+PLUGIN_NAME+'-id')===location.hash.substr(1)){location.hash='';$(window).scrollTop(scrollTop)} +syncWithAnimation(function(){setState(remodal,STATES.CLOSING,!1,reason)},function(){remodal.$bg.removeClass(remodal.settings.modifier);remodal.$overlay.removeClass(remodal.settings.modifier).hide();remodal.$wrapper.hide();unlockScreen();setState(remodal,STATES.CLOSED,!1,reason)},remodal)};Remodal.prototype.getState=function(){return this.state};Remodal.prototype.destroy=function(){var lookup=$[PLUGIN_NAME].lookup;var instanceCount;halt(this);this.$wrapper.remove();delete lookup[this.index];instanceCount=$.grep(lookup,function(instance){return !!instance}).length;if(instanceCount===0){this.$overlay.remove();this.$bg.removeClass(namespacify('is',STATES.CLOSING)+' '+namespacify('is',STATES.OPENING)+' '+namespacify('is',STATES.CLOSED)+' '+namespacify('is',STATES.OPENED))}};$[PLUGIN_NAME]={lookup:[]};$.fn[PLUGIN_NAME]=function(opts){var instance;var $elem;this.each(function(index,elem){$elem=$(elem);if($elem.data(PLUGIN_NAME)==null){instance=new Remodal($elem,opts);$elem.data(PLUGIN_NAME,instance.index);if(instance.settings.hashTracking&&$elem.attr('data-'+PLUGIN_NAME+'-id')===location.hash.substr(1)){instance.open()}}else{instance=$[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)]}});return instance};$(document).ready(function(){$(document).on('click','[data-'+PLUGIN_NAME+'-target]',function(e){e.preventDefault();var elem=e.currentTarget;var id=elem.getAttribute('data-'+PLUGIN_NAME+'-target');var $target=$('[data-'+PLUGIN_NAME+'-id="'+id+'"]');$[PLUGIN_NAME].lookup[$target.data(PLUGIN_NAME)].open()});$(document).find('.'+NAMESPACE).each(function(i,container){var $container=$(container);var options=$container.data(PLUGIN_NAME+'-options');if(!options){options={}}else if(typeof options==='string'||options instanceof String){options=parseOptions(options)} +$container[PLUGIN_NAME](options)});$(document).on('keydown.'+NAMESPACE,function(e){if(current&¤t.settings.closeOnEscape&¤t.state===STATES.OPENED&&e.keyCode===27){current.close()}});$(window).on('hashchange.'+NAMESPACE,handleHashChangeEvent)})});(function(){var root=typeof self=='object'&&self.self===self&&self||typeof global=='object'&&global.global===global&&global||this;var previousUnderscore=root._;var ArrayProto=Array.prototype,ObjProto=Object.prototype;var SymbolProto=typeof Symbol!=='undefined'?Symbol.prototype:null;var push=ArrayProto.push,slice=ArrayProto.slice,toString=ObjProto.toString,hasOwnProperty=ObjProto.hasOwnProperty;var nativeIsArray=Array.isArray,nativeKeys=Object.keys,nativeCreate=Object.create;var Ctor=function(){};var _=function(obj){if(obj instanceof _)return obj;if(!(this instanceof _))return new _(obj);this._wrapped=obj};if(typeof exports!='undefined'&&!exports.nodeType){if(typeof module!='undefined'&&!module.nodeType&&module.exports){exports=module.exports=_} +exports._=_}else{root._=_} +_.VERSION='1.8.3';var optimizeCb=function(func,context,argCount){if(context===void 0)return func;switch(argCount==null?3:argCount){case 1:return function(value){return func.call(context,value)};case 3:return function(value,index,collection){return func.call(context,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(context,accumulator,value,index,collection)}} +return function(){return func.apply(context,arguments)}};var cb=function(value,context,argCount){if(value==null)return _.identity;if(_.isFunction(value))return optimizeCb(value,context,argCount);if(_.isObject(value))return _.matcher(value);return _.property(value)};_.iteratee=function(value,context){return cb(value,context,Infinity)};var restArgs=function(func,startIndex){startIndex=startIndex==null?func.length-1:+startIndex;return function(){var length=Math.max(arguments.length-startIndex,0);var rest=Array(length);for(var index=0;index<length;index++){rest[index]=arguments[index+startIndex]} +switch(startIndex){case 0:return func.call(this,rest);case 1:return func.call(this,arguments[0],rest);case 2:return func.call(this,arguments[0],arguments[1],rest)} +var args=Array(startIndex+1);for(index=0;index<startIndex;index++){args[index]=arguments[index]} +args[startIndex]=rest;return func.apply(this,args)}};var baseCreate=function(prototype){if(!_.isObject(prototype))return{};if(nativeCreate)return nativeCreate(prototype);Ctor.prototype=prototype;var result=new Ctor;Ctor.prototype=null;return result};var property=function(key){return function(obj){return obj==null?void 0:obj[key]}};var MAX_ARRAY_INDEX=Math.pow(2,53)-1;var getLength=property('length');var isArrayLike=function(collection){var length=getLength(collection);return typeof length=='number'&&length>=0&&length<=MAX_ARRAY_INDEX};_.each=_.forEach=function(obj,iteratee,context){iteratee=optimizeCb(iteratee,context);var i,length;if(isArrayLike(obj)){for(i=0,length=obj.length;i<length;i++){iteratee(obj[i],i,obj)}}else{var keys=_.keys(obj);for(i=0,length=keys.length;i<length;i++){iteratee(obj[keys[i]],keys[i],obj)}} +return obj};_.map=_.collect=function(obj,iteratee,context){iteratee=cb(iteratee,context);var keys=!isArrayLike(obj)&&_.keys(obj),length=(keys||obj).length,results=Array(length);for(var index=0;index<length;index++){var currentKey=keys?keys[index]:index;results[index]=iteratee(obj[currentKey],currentKey,obj)} +return results};var createReduce=function(dir){var reducer=function(obj,iteratee,memo,initial){var keys=!isArrayLike(obj)&&_.keys(obj),length=(keys||obj).length,index=dir>0?0:length-1;if(!initial){memo=obj[keys?keys[index]:index];index+=dir} +for(;index>=0&&index<length;index+=dir){var currentKey=keys?keys[index]:index;memo=iteratee(memo,obj[currentKey],currentKey,obj)} +return memo};return function(obj,iteratee,memo,context){var initial=arguments.length>=3;return reducer(obj,optimizeCb(iteratee,context,4),memo,initial)}};_.reduce=_.foldl=_.inject=createReduce(1);_.reduceRight=_.foldr=createReduce(-1);_.find=_.detect=function(obj,predicate,context){var key;if(isArrayLike(obj)){key=_.findIndex(obj,predicate,context)}else{key=_.findKey(obj,predicate,context)} +if(key!==void 0&&key!==-1)return obj[key]};_.filter=_.select=function(obj,predicate,context){var results=[];predicate=cb(predicate,context);_.each(obj,function(value,index,list){if(predicate(value,index,list))results.push(value)});return results};_.reject=function(obj,predicate,context){return _.filter(obj,_.negate(cb(predicate)),context)};_.every=_.all=function(obj,predicate,context){predicate=cb(predicate,context);var keys=!isArrayLike(obj)&&_.keys(obj),length=(keys||obj).length;for(var index=0;index<length;index++){var currentKey=keys?keys[index]:index;if(!predicate(obj[currentKey],currentKey,obj))return !1} +return !0};_.some=_.any=function(obj,predicate,context){predicate=cb(predicate,context);var keys=!isArrayLike(obj)&&_.keys(obj),length=(keys||obj).length;for(var index=0;index<length;index++){var currentKey=keys?keys[index]:index;if(predicate(obj[currentKey],currentKey,obj))return !0} +return !1};_.contains=_.includes=_.include=function(obj,item,fromIndex,guard){if(!isArrayLike(obj))obj=_.values(obj);if(typeof fromIndex!='number'||guard)fromIndex=0;return _.indexOf(obj,item,fromIndex)>=0};_.invoke=restArgs(function(obj,method,args){var isFunc=_.isFunction(method);return _.map(obj,function(value){var func=isFunc?method:value[method];return func==null?func:func.apply(value,args)})});_.pluck=function(obj,key){return _.map(obj,_.property(key))};_.where=function(obj,attrs){return _.filter(obj,_.matcher(attrs))};_.findWhere=function(obj,attrs){return _.find(obj,_.matcher(attrs))};_.max=function(obj,iteratee,context){var result=-Infinity,lastComputed=-Infinity,value,computed;if(iteratee==null||(typeof iteratee=='number'&&typeof obj[0]!='object')&&obj!=null){obj=isArrayLike(obj)?obj:_.values(obj);for(var i=0,length=obj.length;i<length;i++){value=obj[i];if(value!=null&&value>result){result=value}}}else{iteratee=cb(iteratee,context);_.each(obj,function(v,index,list){computed=iteratee(v,index,list);if(computed>lastComputed||computed===-Infinity&&result===-Infinity){result=v;lastComputed=computed}})} +return result};_.min=function(obj,iteratee,context){var result=Infinity,lastComputed=Infinity,value,computed;if(iteratee==null||(typeof iteratee=='number'&&typeof obj[0]!='object')&&obj!=null){obj=isArrayLike(obj)?obj:_.values(obj);for(var i=0,length=obj.length;i<length;i++){value=obj[i];if(value!=null&&value<result){result=value}}}else{iteratee=cb(iteratee,context);_.each(obj,function(v,index,list){computed=iteratee(v,index,list);if(computed<lastComputed||computed===Infinity&&result===Infinity){result=v;lastComputed=computed}})} +return result};_.shuffle=function(obj){return _.sample(obj,Infinity)};_.sample=function(obj,n,guard){if(n==null||guard){if(!isArrayLike(obj))obj=_.values(obj);return obj[_.random(obj.length-1)]} +var sample=isArrayLike(obj)?_.clone(obj):_.values(obj);var length=getLength(sample);n=Math.max(Math.min(n,length),0);var last=length-1;for(var index=0;index<n;index++){var rand=_.random(index,last);var temp=sample[index];sample[index]=sample[rand];sample[rand]=temp} +return sample.slice(0,n)};_.sortBy=function(obj,iteratee,context){var index=0;iteratee=cb(iteratee,context);return _.pluck(_.map(obj,function(value,key,list){return{value:value,index:index++,criteria:iteratee(value,key,list)}}).sort(function(left,right){var a=left.criteria;var b=right.criteria;if(a!==b){if(a>b||a===void 0)return 1;if(a<b||b===void 0)return-1} +return left.index-right.index}),'value')};var group=function(behavior,partition){return function(obj,iteratee,context){var result=partition?[[],[]]:{};iteratee=cb(iteratee,context);_.each(obj,function(value,index){var key=iteratee(value,index,obj);behavior(result,value,key)});return result}};_.groupBy=group(function(result,value,key){if(_.has(result,key))result[key].push(value);else result[key]=[value]});_.indexBy=group(function(result,value,key){result[key]=value});_.countBy=group(function(result,value,key){if(_.has(result,key))result[key]++;else result[key]=1});var reStrSymbol=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;_.toArray=function(obj){if(!obj)return[];if(_.isArray(obj))return slice.call(obj);if(_.isString(obj)){return obj.match(reStrSymbol)} +if(isArrayLike(obj))return _.map(obj);return _.values(obj)};_.size=function(obj){if(obj==null)return 0;return isArrayLike(obj)?obj.length:_.keys(obj).length};_.partition=group(function(result,value,pass){result[pass?0:1].push(value)},!0);_.first=_.head=_.take=function(array,n,guard){if(array==null)return void 0;if(n==null||guard)return array[0];return _.initial(array,array.length-n)};_.initial=function(array,n,guard){return slice.call(array,0,Math.max(0,array.length-(n==null||guard?1:n)))};_.last=function(array,n,guard){if(array==null)return void 0;if(n==null||guard)return array[array.length-1];return _.rest(array,Math.max(0,array.length-n))};_.rest=_.tail=_.drop=function(array,n,guard){return slice.call(array,n==null||guard?1:n)};_.compact=function(array){return _.filter(array)};var flatten=function(input,shallow,strict,output){output=output||[];var idx=output.length;for(var i=0,length=getLength(input);i<length;i++){var value=input[i];if(isArrayLike(value)&&(_.isArray(value)||_.isArguments(value))){if(shallow){var j=0,len=value.length;while(j<len)output[idx++]=value[j++]}else{flatten(value,shallow,strict,output);idx=output.length}}else if(!strict){output[idx++]=value}} +return output};_.flatten=function(array,shallow){return flatten(array,shallow,!1)};_.without=restArgs(function(array,otherArrays){return _.difference(array,otherArrays)});_.uniq=_.unique=function(array,isSorted,iteratee,context){if(!_.isBoolean(isSorted)){context=iteratee;iteratee=isSorted;isSorted=!1} +if(iteratee!=null)iteratee=cb(iteratee,context);var result=[];var seen=[];for(var i=0,length=getLength(array);i<length;i++){var value=array[i],computed=iteratee?iteratee(value,i,array):value;if(isSorted){if(!i||seen!==computed)result.push(value);seen=computed}else if(iteratee){if(!_.contains(seen,computed)){seen.push(computed);result.push(value)}}else if(!_.contains(result,value)){result.push(value)}} +return result};_.union=restArgs(function(arrays){return _.uniq(flatten(arrays,!0,!0))});_.intersection=function(array){var result=[];var argsLength=arguments.length;for(var i=0,length=getLength(array);i<length;i++){var item=array[i];if(_.contains(result,item))continue;var j;for(j=1;j<argsLength;j++){if(!_.contains(arguments[j],item))break} +if(j===argsLength)result.push(item)} +return result};_.difference=restArgs(function(array,rest){rest=flatten(rest,!0,!0);return _.filter(array,function(value){return !_.contains(rest,value)})});_.unzip=function(array){var length=array&&_.max(array,getLength).length||0;var result=Array(length);for(var index=0;index<length;index++){result[index]=_.pluck(array,index)} +return result};_.zip=restArgs(_.unzip);_.object=function(list,values){var result={};for(var i=0,length=getLength(list);i<length;i++){if(values){result[list[i]]=values[i]}else{result[list[i][0]]=list[i][1]}} +return result};var createPredicateIndexFinder=function(dir){return function(array,predicate,context){predicate=cb(predicate,context);var length=getLength(array);var index=dir>0?0:length-1;for(;index>=0&&index<length;index+=dir){if(predicate(array[index],index,array))return index} +return-1}};_.findIndex=createPredicateIndexFinder(1);_.findLastIndex=createPredicateIndexFinder(-1);_.sortedIndex=function(array,obj,iteratee,context){iteratee=cb(iteratee,context,1);var value=iteratee(obj);var low=0,high=getLength(array);while(low<high){var mid=Math.floor((low+high)/2);if(iteratee(array[mid])<value)low=mid+1;else high=mid} +return low};var createIndexFinder=function(dir,predicateFind,sortedIndex){return function(array,item,idx){var i=0,length=getLength(array);if(typeof idx=='number'){if(dir>0){i=idx>=0?idx:Math.max(idx+length,i)}else{length=idx>=0?Math.min(idx+1,length):idx+length+1}}else if(sortedIndex&&idx&&length){idx=sortedIndex(array,item);return array[idx]===item?idx:-1} +if(item!==item){idx=predicateFind(slice.call(array,i,length),_.isNaN);return idx>=0?idx+i:-1} +for(idx=dir>0?i:length-1;idx>=0&&idx<length;idx+=dir){if(array[idx]===item)return idx} +return-1}};_.indexOf=createIndexFinder(1,_.findIndex,_.sortedIndex);_.lastIndexOf=createIndexFinder(-1,_.findLastIndex);_.range=function(start,stop,step){if(stop==null){stop=start||0;start=0} +if(!step){step=stop<start?-1:1} +var length=Math.max(Math.ceil((stop-start)/step),0);var range=Array(length);for(var idx=0;idx<length;idx++,start+=step){range[idx]=start} +return range};_.chunk=function(array,count){if(count==null||count<1)return[];var result=[];var i=0,length=array.length;while(i<length){result.push(slice.call(array,i,i+=count))} +return result};var executeBound=function(sourceFunc,boundFunc,context,callingContext,args){if(!(callingContext instanceof boundFunc))return sourceFunc.apply(context,args);var self=baseCreate(sourceFunc.prototype);var result=sourceFunc.apply(self,args);if(_.isObject(result))return result;return self};_.bind=restArgs(function(func,context,args){if(!_.isFunction(func))throw new TypeError('Bind must be called on a function');var bound=restArgs(function(callArgs){return executeBound(func,bound,context,this,args.concat(callArgs))});return bound});_.partial=restArgs(function(func,boundArgs){var placeholder=_.partial.placeholder;var bound=function(){var position=0,length=boundArgs.length;var args=Array(length);for(var i=0;i<length;i++){args[i]=boundArgs[i]===placeholder?arguments[position++]:boundArgs[i]} +while(position<arguments.length)args.push(arguments[position++]);return executeBound(func,bound,this,this,args)};return bound});_.partial.placeholder=_;_.bindAll=restArgs(function(obj,keys){keys=flatten(keys,!1,!1);var index=keys.length;if(index<1)throw new Error('bindAll must be passed function names');while(index--){var key=keys[index];obj[key]=_.bind(obj[key],obj)}});_.memoize=function(func,hasher){var memoize=function(key){var cache=memoize.cache;var address=''+(hasher?hasher.apply(this,arguments):key);if(!_.has(cache,address))cache[address]=func.apply(this,arguments);return cache[address]};memoize.cache={};return memoize};_.delay=restArgs(function(func,wait,args){return setTimeout(function(){return func.apply(null,args)},wait)});_.defer=_.partial(_.delay,_,1);_.throttle=function(func,wait,options){var timeout,context,args,result;var previous=0;if(!options)options={};var later=function(){previous=options.leading===!1?0:_.now();timeout=null;result=func.apply(context,args);if(!timeout)context=args=null};var throttled=function(){var now=_.now();if(!previous&&options.leading===!1)previous=now;var remaining=wait-(now-previous);context=this;args=arguments;if(remaining<=0||remaining>wait){if(timeout){clearTimeout(timeout);timeout=null} +previous=now;result=func.apply(context,args);if(!timeout)context=args=null}else if(!timeout&&options.trailing!==!1){timeout=setTimeout(later,remaining)} +return result};throttled.cancel=function(){clearTimeout(timeout);previous=0;timeout=context=args=null};return throttled};_.debounce=function(func,wait,immediate){var timeout,result;var later=function(context,args){timeout=null;if(args)result=func.apply(context,args)};var debounced=restArgs(function(args){var callNow=immediate&&!timeout;if(timeout)clearTimeout(timeout);if(callNow){timeout=setTimeout(later,wait);result=func.apply(this,args)}else if(!immediate){timeout=_.delay(later,wait,this,args)} +return result});debounced.cancel=function(){clearTimeout(timeout);timeout=null};return debounced};_.wrap=function(func,wrapper){return _.partial(wrapper,func)};_.negate=function(predicate){return function(){return !predicate.apply(this,arguments)}};_.compose=function(){var args=arguments;var start=args.length-1;return function(){var i=start;var result=args[start].apply(this,arguments);while(i--)result=args[i].call(this,result);return result}};_.after=function(times,func){return function(){if(--times<1){return func.apply(this,arguments)}}};_.before=function(times,func){var memo;return function(){if(--times>0){memo=func.apply(this,arguments)} +if(times<=1)func=null;return memo}};_.once=_.partial(_.before,2);_.restArgs=restArgs;var hasEnumBug=!{toString:null}.propertyIsEnumerable('toString');var nonEnumerableProps=['valueOf','isPrototypeOf','toString','propertyIsEnumerable','hasOwnProperty','toLocaleString'];var collectNonEnumProps=function(obj,keys){var nonEnumIdx=nonEnumerableProps.length;var constructor=obj.constructor;var proto=_.isFunction(constructor)&&constructor.prototype||ObjProto;var prop='constructor';if(_.has(obj,prop)&&!_.contains(keys,prop))keys.push(prop);while(nonEnumIdx--){prop=nonEnumerableProps[nonEnumIdx];if(prop in obj&&obj[prop]!==proto[prop]&&!_.contains(keys,prop)){keys.push(prop)}}};_.keys=function(obj){if(!_.isObject(obj))return[];if(nativeKeys)return nativeKeys(obj);var keys=[];for(var key in obj)if(_.has(obj,key))keys.push(key);if(hasEnumBug)collectNonEnumProps(obj,keys);return keys};_.allKeys=function(obj){if(!_.isObject(obj))return[];var keys=[];for(var key in obj)keys.push(key);if(hasEnumBug)collectNonEnumProps(obj,keys);return keys};_.values=function(obj){var keys=_.keys(obj);var length=keys.length;var values=Array(length);for(var i=0;i<length;i++){values[i]=obj[keys[i]]} +return values};_.mapObject=function(obj,iteratee,context){iteratee=cb(iteratee,context);var keys=_.keys(obj),length=keys.length,results={};for(var index=0;index<length;index++){var currentKey=keys[index];results[currentKey]=iteratee(obj[currentKey],currentKey,obj)} +return results};_.pairs=function(obj){var keys=_.keys(obj);var length=keys.length;var pairs=Array(length);for(var i=0;i<length;i++){pairs[i]=[keys[i],obj[keys[i]]]} +return pairs};_.invert=function(obj){var result={};var keys=_.keys(obj);for(var i=0,length=keys.length;i<length;i++){result[obj[keys[i]]]=keys[i]} +return result};_.functions=_.methods=function(obj){var names=[];for(var key in obj){if(_.isFunction(obj[key]))names.push(key)} +return names.sort()};var createAssigner=function(keysFunc,defaults){return function(obj){var length=arguments.length;if(defaults)obj=Object(obj);if(length<2||obj==null)return obj;for(var index=1;index<length;index++){var source=arguments[index],keys=keysFunc(source),l=keys.length;for(var i=0;i<l;i++){var key=keys[i];if(!defaults||obj[key]===void 0)obj[key]=source[key]}} +return obj}};_.extend=createAssigner(_.allKeys);_.extendOwn=_.assign=createAssigner(_.keys);_.findKey=function(obj,predicate,context){predicate=cb(predicate,context);var keys=_.keys(obj),key;for(var i=0,length=keys.length;i<length;i++){key=keys[i];if(predicate(obj[key],key,obj))return key}};var keyInObj=function(value,key,obj){return key in obj};_.pick=restArgs(function(obj,keys){var result={},iteratee=keys[0];if(obj==null)return result;if(_.isFunction(iteratee)){if(keys.length>1)iteratee=optimizeCb(iteratee,keys[1]);keys=_.allKeys(obj)}else{iteratee=keyInObj;keys=flatten(keys,!1,!1);obj=Object(obj)} +for(var i=0,length=keys.length;i<length;i++){var key=keys[i];var value=obj[key];if(iteratee(value,key,obj))result[key]=value} +return result});_.omit=restArgs(function(obj,keys){var iteratee=keys[0],context;if(_.isFunction(iteratee)){iteratee=_.negate(iteratee);if(keys.length>1)context=keys[1]}else{keys=_.map(flatten(keys,!1,!1),String);iteratee=function(value,key){return !_.contains(keys,key)}} +return _.pick(obj,iteratee,context)});_.defaults=createAssigner(_.allKeys,!0);_.create=function(prototype,props){var result=baseCreate(prototype);if(props)_.extendOwn(result,props);return result};_.clone=function(obj){if(!_.isObject(obj))return obj;return _.isArray(obj)?obj.slice():_.extend({},obj)};_.tap=function(obj,interceptor){interceptor(obj);return obj};_.isMatch=function(object,attrs){var keys=_.keys(attrs),length=keys.length;if(object==null)return !length;var obj=Object(object);for(var i=0;i<length;i++){var key=keys[i];if(attrs[key]!==obj[key]||!(key in obj))return !1} +return !0};var eq,deepEq;eq=function(a,b,aStack,bStack){if(a===b)return a!==0||1/a===1/b;if(a==null||b==null)return a===b;if(a!==a)return b!==b;var type=typeof a;if(type!=='function'&&type!=='object'&&typeof b!='object')return !1;return deepEq(a,b,aStack,bStack)};deepEq=function(a,b,aStack,bStack){if(a instanceof _)a=a._wrapped;if(b instanceof _)b=b._wrapped;var className=toString.call(a);if(className!==toString.call(b))return !1;switch(className){case '[object RegExp]':case '[object String]':return ''+a===''+b;case '[object Number]':if(+a!==+a)return+b!==+b;return+a===0?1/+a===1/b:+a===+b;case '[object Date]':case '[object Boolean]':return+a===+b;case '[object Symbol]':return SymbolProto.valueOf.call(a)===SymbolProto.valueOf.call(b)} +var areArrays=className==='[object Array]';if(!areArrays){if(typeof a!='object'||typeof b!='object')return !1;var aCtor=a.constructor,bCtor=b.constructor;if(aCtor!==bCtor&&!(_.isFunction(aCtor)&&aCtor instanceof aCtor&&_.isFunction(bCtor)&&bCtor instanceof bCtor)&&('constructor' in a&&'constructor' in b)){return !1}} +aStack=aStack||[];bStack=bStack||[];var length=aStack.length;while(length--){if(aStack[length]===a)return bStack[length]===b} +aStack.push(a);bStack.push(b);if(areArrays){length=a.length;if(length!==b.length)return !1;while(length--){if(!eq(a[length],b[length],aStack,bStack))return !1}}else{var keys=_.keys(a),key;length=keys.length;if(_.keys(b).length!==length)return !1;while(length--){key=keys[length];if(!(_.has(b,key)&&eq(a[key],b[key],aStack,bStack)))return !1}} +aStack.pop();bStack.pop();return !0};_.isEqual=function(a,b){return eq(a,b)};_.isEmpty=function(obj){if(obj==null)return !0;if(isArrayLike(obj)&&(_.isArray(obj)||_.isString(obj)||_.isArguments(obj)))return obj.length===0;return _.keys(obj).length===0};_.isElement=function(obj){return !!(obj&&obj.nodeType===1)};_.isArray=nativeIsArray||function(obj){return toString.call(obj)==='[object Array]'};_.isObject=function(obj){var type=typeof obj;return type==='function'||type==='object'&&!!obj};_.each(['Arguments','Function','String','Number','Date','RegExp','Error','Symbol'],function(name){_['is'+name]=function(obj){return toString.call(obj)==='[object '+name+']'}});if(!_.isArguments(arguments)){_.isArguments=function(obj){return _.has(obj,'callee')}} +var nodelist=root.document&&root.document.childNodes;if(typeof/./!='function'&&typeof Int8Array!='object'&&typeof nodelist!='function'){_.isFunction=function(obj){return typeof obj=='function'||!1}} +_.isFinite=function(obj){return !_.isSymbol(obj)&&isFinite(obj)&&!isNaN(parseFloat(obj))};_.isNaN=function(obj){return _.isNumber(obj)&&isNaN(obj)};_.isBoolean=function(obj){return obj===!0||obj===!1||toString.call(obj)==='[object Boolean]'};_.isNull=function(obj){return obj===null};_.isUndefined=function(obj){return obj===void 0};_.has=function(obj,key){return obj!=null&&hasOwnProperty.call(obj,key)};_.noConflict=function(){root._=previousUnderscore;return this};_.identity=function(value){return value};_.constant=function(value){return function(){return value}};_.noop=function(){};_.property=property;_.propertyOf=function(obj){return obj==null?function(){}:function(key){return obj[key]}};_.matcher=_.matches=function(attrs){attrs=_.extendOwn({},attrs);return function(obj){return _.isMatch(obj,attrs)}};_.times=function(n,iteratee,context){var accum=Array(Math.max(0,n));iteratee=optimizeCb(iteratee,context,1);for(var i=0;i<n;i++)accum[i]=iteratee(i);return accum};_.random=function(min,max){if(max==null){max=min;min=0} +return min+Math.floor(Math.random()*(max-min+1))};_.now=Date.now||function(){return new Date().getTime()};var escapeMap={'&':'&','<':'<','>':'>','"':'"',"'":''','`':'`'};var unescapeMap=_.invert(escapeMap);var createEscaper=function(map){var escaper=function(match){return map[match]};var source='(?:'+_.keys(map).join('|')+')';var testRegexp=RegExp(source);var replaceRegexp=RegExp(source,'g');return function(string){string=string==null?'':''+string;return testRegexp.test(string)?string.replace(replaceRegexp,escaper):string}};_.escape=createEscaper(escapeMap);_.unescape=createEscaper(unescapeMap);_.result=function(object,prop,fallback){var value=object==null?void 0:object[prop];if(value===void 0){value=fallback} +return _.isFunction(value)?value.call(object):value};var idCounter=0;_.uniqueId=function(prefix){var id=++idCounter+'';return prefix?prefix+id:id};_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var noMatch=/(.)^/;var escapes={"'":"'",'\\':'\\','\r':'r','\n':'n','\u2028':'u2028','\u2029':'u2029'};var escapeRegExp=/\\|'|\r|\n|\u2028|\u2029/g;var escapeChar=function(match){return '\\'+escapes[match]};_.template=function(text,settings,oldSettings){if(!settings&&oldSettings)settings=oldSettings;settings=_.defaults({},settings,_.templateSettings);var matcher=RegExp([(settings.escape||noMatch).source,(settings.interpolate||noMatch).source,(settings.evaluate||noMatch).source].join('|')+'|$','g');var index=0;var source="__p+='";text.replace(matcher,function(match,escape,interpolate,evaluate,offset){source+=text.slice(index,offset).replace(escapeRegExp,escapeChar);index=offset+match.length;if(escape){source+="'+\n((__t=("+escape+"))==null?'':_.escape(__t))+\n'"}else if(interpolate){source+="'+\n((__t=("+interpolate+"))==null?'':__t)+\n'"}else if(evaluate){source+="';\n"+evaluate+"\n__p+='"} +return match});source+="';\n";if(!settings.variable)source='with(obj||{}){\n'+source+'}\n';source="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+source+'return __p;\n';var render;try{render=new Function(settings.variable||'obj','_',source)}catch(e){e.source=source;throw e} +var template=function(data){return render.call(this,data,_)};var argument=settings.variable||'obj';template.source='function('+argument+'){\n'+source+'}';return template};_.chain=function(obj){var instance=_(obj);instance._chain=!0;return instance};var chainResult=function(instance,obj){return instance._chain?_(obj).chain():obj};_.mixin=function(obj){_.each(_.functions(obj),function(name){var func=_[name]=obj[name];_.prototype[name]=function(){var args=[this._wrapped];push.apply(args,arguments);return chainResult(this,func.apply(_,args))}})};_.mixin(_);_.each(['pop','push','reverse','shift','sort','splice','unshift'],function(name){var method=ArrayProto[name];_.prototype[name]=function(){var obj=this._wrapped;method.apply(obj,arguments);if((name==='shift'||name==='splice')&&obj.length===0)delete obj[0];return chainResult(this,obj)}});_.each(['concat','join','slice'],function(name){var method=ArrayProto[name];_.prototype[name]=function(){return chainResult(this,method.apply(this._wrapped,arguments))}});_.prototype.value=function(){return this._wrapped};_.prototype.valueOf=_.prototype.toJSON=_.prototype.value;_.prototype.toString=function(){return ''+this._wrapped};if(typeof define=='function'&&define.amd){define('underscore',[],function(){return _})}}());(function(root,factory){if(typeof define==='function'&&define.amd){define('chartist',[],function(){return(root.Chartist=factory())})}else if(typeof exports==='object'){module.exports=factory()}else{root.Chartist=factory()}}(this,function(){var Chartist={version:'0.9.7'};(function(window,document,Chartist){'use strict';Chartist.namespaces={svg:'http://www.w3.org/2000/svg',xmlns:'http://www.w3.org/2000/xmlns/',xhtml:'http://www.w3.org/1999/xhtml',xlink:'http://www.w3.org/1999/xlink',ct:'http://gionkunz.github.com/chartist-js/ct'};Chartist.noop=function(n){return n};Chartist.alphaNumerate=function(n){return String.fromCharCode(97+n%26)};Chartist.extend=function(target){target=target||{};var sources=Array.prototype.slice.call(arguments,1);sources.forEach(function(source){for(var prop in source){if(typeof source[prop]==='object'&&source[prop]!==null&&!(source[prop]instanceof Array)){target[prop]=Chartist.extend({},target[prop],source[prop])}else{target[prop]=source[prop]}}});return target};Chartist.replaceAll=function(str,subStr,newSubStr){return str.replace(new RegExp(subStr,'g'),newSubStr)};Chartist.ensureUnit=function(value,unit){if(typeof value==='number'){value=value+unit} +return value};Chartist.quantity=function(input){if(typeof input==='string'){var match=(/^(\d+)\s*(.*)$/g).exec(input);return{value:+match[1],unit:match[2]||undefined}} +return{value:input}};Chartist.querySelector=function(query){return query instanceof Node?query:document.querySelector(query)};Chartist.times=function(length){return Array.apply(null,new Array(length))};Chartist.sum=function(previous,current){return previous+(current?current:0)};Chartist.mapMultiply=function(factor){return function(num){return num*factor}};Chartist.mapAdd=function(addend){return function(num){return num+addend}};Chartist.serialMap=function(arr,cb){var result=[],length=Math.max.apply(null,arr.map(function(e){return e.length}));Chartist.times(length).forEach(function(e,index){var args=arr.map(function(e){return e[index]});result[index]=cb.apply(null,args)});return result};Chartist.roundWithPrecision=function(value,digits){var precision=Math.pow(10,digits||Chartist.precision);return Math.round(value*precision)/precision};Chartist.precision=8;Chartist.escapingMap={'&':'&','<':'<','>':'>','"':'"','\'':'''};Chartist.serialize=function(data){if(data===null||data===undefined){return data}else if(typeof data==='number'){data=''+data}else if(typeof data==='object'){data=JSON.stringify({data:data})} +return Object.keys(Chartist.escapingMap).reduce(function(result,key){return Chartist.replaceAll(result,key,Chartist.escapingMap[key])},data)};Chartist.deserialize=function(data){if(typeof data!=='string'){return data} +data=Object.keys(Chartist.escapingMap).reduce(function(result,key){return Chartist.replaceAll(result,Chartist.escapingMap[key],key)},data);try{data=JSON.parse(data);data=data.data!==undefined?data.data:data}catch(e){} +return data};Chartist.createSvg=function(container,width,height,className){var svg;width=width||'100%';height=height||'100%';Array.prototype.slice.call(container.querySelectorAll('svg')).filter(function filterChartistSvgObjects(svg){return svg.getAttributeNS(Chartist.namespaces.xmlns,'ct')}).forEach(function removePreviousElement(svg){container.removeChild(svg)});svg=new Chartist.Svg('svg').attr({width:width,height:height}).addClass(className).attr({style:'width: '+width+'; height: '+height+';'});container.appendChild(svg._node);return svg};Chartist.normalizeData=function(data){data=data||{series:[],labels:[]};data.series=data.series||[];data.labels=data.labels||[];if(data.series.length>0&&data.labels.length===0){var normalized=Chartist.getDataArray(data),labelCount;if(normalized.every(function(value){return value instanceof Array})){labelCount=Math.max.apply(null,normalized.map(function(series){return series.length}))}else{labelCount=normalized.length} +data.labels=Chartist.times(labelCount).map(function(){return ''})} +return data};Chartist.reverseData=function(data){data.labels.reverse();data.series.reverse();for(var i=0;i<data.series.length;i++){if(typeof(data.series[i])==='object'&&data.series[i].data!==undefined){data.series[i].data.reverse()}else if(data.series[i]instanceof Array){data.series[i].reverse()}}};Chartist.getDataArray=function(data,reverse,multi){if(reverse&&!data.reversed||!reverse&&data.reversed){Chartist.reverseData(data);data.reversed=!data.reversed} +function recursiveConvert(value){if(Chartist.isFalseyButZero(value)){return undefined}else if((value.data||value)instanceof Array){return(value.data||value).map(recursiveConvert)}else if(value.hasOwnProperty('value')){return recursiveConvert(value.value)}else{if(multi){var multiValue={};if(typeof multi==='string'){multiValue[multi]=Chartist.getNumberOrUndefined(value)}else{multiValue.y=Chartist.getNumberOrUndefined(value)} +multiValue.x=value.hasOwnProperty('x')?Chartist.getNumberOrUndefined(value.x):multiValue.x;multiValue.y=value.hasOwnProperty('y')?Chartist.getNumberOrUndefined(value.y):multiValue.y;return multiValue}else{return Chartist.getNumberOrUndefined(value)}}} +return data.series.map(recursiveConvert)};Chartist.normalizePadding=function(padding,fallback){fallback=fallback||0;return typeof padding==='number'?{top:padding,right:padding,bottom:padding,left:padding}:{top:typeof padding.top==='number'?padding.top:fallback,right:typeof padding.right==='number'?padding.right:fallback,bottom:typeof padding.bottom==='number'?padding.bottom:fallback,left:typeof padding.left==='number'?padding.left:fallback}};Chartist.getMetaData=function(series,index){var value=series.data?series.data[index]:series[index];return value?Chartist.serialize(value.meta):undefined};Chartist.orderOfMagnitude=function(value){return Math.floor(Math.log(Math.abs(value))/Math.LN10)};Chartist.projectLength=function(axisLength,length,bounds){return length/bounds.range*axisLength};Chartist.getAvailableHeight=function(svg,options){return Math.max((Chartist.quantity(options.height).value||svg.height())-(options.chartPadding.top+options.chartPadding.bottom)-options.axisX.offset,0)};Chartist.getHighLow=function(data,options,dimension){options=Chartist.extend({},options,dimension?options['axis'+dimension.toUpperCase()]:{});var highLow={high:options.high===undefined?-Number.MAX_VALUE:+options.high,low:options.low===undefined?Number.MAX_VALUE:+options.low};var findHigh=options.high===undefined;var findLow=options.low===undefined;function recursiveHighLow(data){if(data===undefined){return undefined}else if(data instanceof Array){for(var i=0;i<data.length;i++){recursiveHighLow(data[i])}}else{var value=dimension?+data[dimension]:+data;if(findHigh&&value>highLow.high){highLow.high=value} +if(findLow&&value<highLow.low){highLow.low=value}}} +if(findHigh||findLow){recursiveHighLow(data)} +if(options.referenceValue||options.referenceValue===0){highLow.high=Math.max(options.referenceValue,highLow.high);highLow.low=Math.min(options.referenceValue,highLow.low)} +if(highLow.high<=highLow.low){if(highLow.low===0){highLow.high=1}else if(highLow.low<0){highLow.high=0}else if(highLow.high>0){highLow.low=0}else{highLow.high=1;highLow.low=0}} +return highLow};Chartist.isNum=function(value){return !isNaN(value)&&isFinite(value)};Chartist.isFalseyButZero=function(value){return !value&&value!==0};Chartist.getNumberOrUndefined=function(value){return isNaN(+value)?undefined:+value};Chartist.getMultiValue=function(value,dimension){if(Chartist.isNum(value)){return+value}else if(value){return value[dimension||'y']||0}else{return 0}};Chartist.rho=function(num){if(num===1){return num} +function gcd(p,q){if(p%q===0){return q}else{return gcd(q,p%q)}} +function f(x){return x*x+1} +var x1=2,x2=2,divisor;if(num%2===0){return 2} +do{x1=f(x1)%num;x2=f(f(x2))%num;divisor=gcd(Math.abs(x1-x2),num)}while(divisor===1);return divisor};Chartist.getBounds=function(axisLength,highLow,scaleMinSpace,onlyInteger){var i,optimizationCounter=0,newMin,newMax,bounds={high:highLow.high,low:highLow.low};bounds.valueRange=bounds.high-bounds.low;bounds.oom=Chartist.orderOfMagnitude(bounds.valueRange);bounds.step=Math.pow(10,bounds.oom);bounds.min=Math.floor(bounds.low/bounds.step)*bounds.step;bounds.max=Math.ceil(bounds.high/bounds.step)*bounds.step;bounds.range=bounds.max-bounds.min;bounds.numberOfSteps=Math.round(bounds.range/bounds.step);var length=Chartist.projectLength(axisLength,bounds.step,bounds);var scaleUp=length<scaleMinSpace;var smallestFactor=onlyInteger?Chartist.rho(bounds.range):0;if(onlyInteger&&Chartist.projectLength(axisLength,1,bounds)>=scaleMinSpace){bounds.step=1}else if(onlyInteger&&smallestFactor<bounds.step&&Chartist.projectLength(axisLength,smallestFactor,bounds)>=scaleMinSpace){bounds.step=smallestFactor}else{for(;;){if(scaleUp&&Chartist.projectLength(axisLength,bounds.step,bounds)<=scaleMinSpace){bounds.step*=2}else if(!scaleUp&&Chartist.projectLength(axisLength,bounds.step/2,bounds)>=scaleMinSpace){bounds.step/=2;if(onlyInteger&&bounds.step%1!==0){bounds.step*=2;break}}else{break} +if(optimizationCounter++>1000){throw new Error('Exceeded maximum number of iterations while optimizing scale step!')}}} +newMin=bounds.min;newMax=bounds.max;while(newMin+bounds.step<=bounds.low){newMin+=bounds.step} +while(newMax-bounds.step>=bounds.high){newMax-=bounds.step} +bounds.min=newMin;bounds.max=newMax;bounds.range=bounds.max-bounds.min;bounds.values=[];for(i=bounds.min;i<=bounds.max;i+=bounds.step){bounds.values.push(Chartist.roundWithPrecision(i))} +return bounds};Chartist.polarToCartesian=function(centerX,centerY,radius,angleInDegrees){var angleInRadians=(angleInDegrees-90)*Math.PI/180.0;return{x:centerX+(radius*Math.cos(angleInRadians)),y:centerY+(radius*Math.sin(angleInRadians))}};Chartist.createChartRect=function(svg,options,fallbackPadding){var hasAxis=!!(options.axisX||options.axisY);var yAxisOffset=hasAxis?options.axisY.offset:0;var xAxisOffset=hasAxis?options.axisX.offset:0;var width=svg.width()||Chartist.quantity(options.width).value||0;var height=svg.height()||Chartist.quantity(options.height).value||0;var normalizedPadding=Chartist.normalizePadding(options.chartPadding,fallbackPadding);width=Math.max(width,yAxisOffset+normalizedPadding.left+normalizedPadding.right);height=Math.max(height,xAxisOffset+normalizedPadding.top+normalizedPadding.bottom);var chartRect={padding:normalizedPadding,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};if(hasAxis){if(options.axisX.position==='start'){chartRect.y2=normalizedPadding.top+xAxisOffset;chartRect.y1=Math.max(height-normalizedPadding.bottom,chartRect.y2+1)}else{chartRect.y2=normalizedPadding.top;chartRect.y1=Math.max(height-normalizedPadding.bottom-xAxisOffset,chartRect.y2+1)} +if(options.axisY.position==='start'){chartRect.x1=normalizedPadding.left+yAxisOffset;chartRect.x2=Math.max(width-normalizedPadding.right,chartRect.x1+1)}else{chartRect.x1=normalizedPadding.left;chartRect.x2=Math.max(width-normalizedPadding.right-yAxisOffset,chartRect.x1+1)}}else{chartRect.x1=normalizedPadding.left;chartRect.x2=Math.max(width-normalizedPadding.right,chartRect.x1+1);chartRect.y2=normalizedPadding.top;chartRect.y1=Math.max(height-normalizedPadding.bottom,chartRect.y2+1)} +return chartRect};Chartist.createGrid=function(position,index,axis,offset,length,group,classes,eventEmitter){var positionalData={};positionalData[axis.units.pos+'1']=position;positionalData[axis.units.pos+'2']=position;positionalData[axis.counterUnits.pos+'1']=offset;positionalData[axis.counterUnits.pos+'2']=offset+length;var gridElement=group.elem('line',positionalData,classes.join(' '));eventEmitter.emit('draw',Chartist.extend({type:'grid',axis:axis,index:index,group:group,element:gridElement},positionalData))};Chartist.createLabel=function(position,length,index,labels,axis,axisOffset,labelOffset,group,classes,useForeignObject,eventEmitter){var labelElement;var positionalData={};positionalData[axis.units.pos]=position+labelOffset[axis.units.pos];positionalData[axis.counterUnits.pos]=labelOffset[axis.counterUnits.pos];positionalData[axis.units.len]=length;positionalData[axis.counterUnits.len]=axisOffset-10;if(useForeignObject){var content='<span class="'+classes.join(' ')+'" style="'+axis.units.len+': '+Math.round(positionalData[axis.units.len])+'px; '+axis.counterUnits.len+': '+Math.round(positionalData[axis.counterUnits.len])+'px">'+labels[index]+'</span>';labelElement=group.foreignObject(content,Chartist.extend({style:'overflow: visible;'},positionalData))}else{labelElement=group.elem('text',positionalData,classes.join(' ')).text(labels[index])} +eventEmitter.emit('draw',Chartist.extend({type:'label',axis:axis,index:index,group:group,element:labelElement,text:labels[index]},positionalData))};Chartist.getSeriesOption=function(series,options,key){if(series.name&&options.series&&options.series[series.name]){var seriesOptions=options.series[series.name];return seriesOptions.hasOwnProperty(key)?seriesOptions[key]:options[key]}else{return options[key]}};Chartist.optionsProvider=function(options,responsiveOptions,eventEmitter){var baseOptions=Chartist.extend({},options),currentOptions,mediaQueryListeners=[],i;function updateCurrentOptions(preventChangedEvent){var previousOptions=currentOptions;currentOptions=Chartist.extend({},baseOptions);if(responsiveOptions){for(i=0;i<responsiveOptions.length;i++){var mql=window.matchMedia(responsiveOptions[i][0]);if(mql.matches){currentOptions=Chartist.extend(currentOptions,responsiveOptions[i][1])}}} +if(eventEmitter&&!preventChangedEvent){eventEmitter.emit('optionsChanged',{previousOptions:previousOptions,currentOptions:currentOptions})}} +function removeMediaQueryListeners(){mediaQueryListeners.forEach(function(mql){mql.removeListener(updateCurrentOptions)})} +if(!window.matchMedia){throw 'window.matchMedia not found! Make sure you\'re using a polyfill.'}else if(responsiveOptions){for(i=0;i<responsiveOptions.length;i++){var mql=window.matchMedia(responsiveOptions[i][0]);mql.addListener(updateCurrentOptions);mediaQueryListeners.push(mql)}} +updateCurrentOptions(!0);return{removeMediaQueryListeners:removeMediaQueryListeners,getCurrentOptions:function getCurrentOptions(){return Chartist.extend({},currentOptions)}}}}(window,document,Chartist));(function(window,document,Chartist){'use strict';Chartist.Interpolation={};Chartist.Interpolation.none=function(options){var defaultOptions={fillHoles:!1};options=Chartist.extend({},defaultOptions,options);return function none(pathCoordinates,valueData){var path=new Chartist.Svg.Path();var hole=!0;for(var i=0;i<pathCoordinates.length;i+=2){var currX=pathCoordinates[i];var currY=pathCoordinates[i+1];var currData=valueData[i/2];if(currData.value!==undefined){if(hole){path.move(currX,currY,!1,currData)}else{path.line(currX,currY,!1,currData)} +hole=!1}else if(!options.fillHoles){hole=!0}} +return path}};Chartist.Interpolation.simple=function(options){var defaultOptions={divisor:2,fillHoles:!1};options=Chartist.extend({},defaultOptions,options);var d=1/Math.max(1,options.divisor);return function simple(pathCoordinates,valueData){var path=new Chartist.Svg.Path();var prevX,prevY,prevData;for(var i=0;i<pathCoordinates.length;i+=2){var currX=pathCoordinates[i];var currY=pathCoordinates[i+1];var length=(currX-prevX)*d;var currData=valueData[i/2];if(currData.value!==undefined){if(prevData===undefined){path.move(currX,currY,!1,currData)}else{path.curve(prevX+length,prevY,currX-length,currY,currX,currY,!1,currData)} +prevX=currX;prevY=currY;prevData=currData}else if(!options.fillHoles){prevX=currX=prevData=undefined}} +return path}};Chartist.Interpolation.cardinal=function(options){var defaultOptions={tension:1,fillHoles:!1};options=Chartist.extend({},defaultOptions,options);var t=Math.min(1,Math.max(0,options.tension)),c=1-t;function splitIntoSegments(pathCoordinates,valueData){var segments=[];var hole=!0;for(var i=0;i<pathCoordinates.length;i+=2){if(valueData[i/2].value===undefined){if(!options.fillHoles){hole=!0}}else{if(hole){segments.push({pathCoordinates:[],valueData:[]});hole=!1} +segments[segments.length-1].pathCoordinates.push(pathCoordinates[i],pathCoordinates[i+1]);segments[segments.length-1].valueData.push(valueData[i/2])}} +return segments} +return function cardinal(pathCoordinates,valueData){var segments=splitIntoSegments(pathCoordinates,valueData);if(!segments.length){return Chartist.Interpolation.none()([])}else if(segments.length>1){var paths=[];segments.forEach(function(segment){paths.push(cardinal(segment.pathCoordinates,segment.valueData))});return Chartist.Svg.Path.join(paths)}else{pathCoordinates=segments[0].pathCoordinates;valueData=segments[0].valueData;if(pathCoordinates.length<=4){return Chartist.Interpolation.none()(pathCoordinates,valueData)} +var path=new Chartist.Svg.Path().move(pathCoordinates[0],pathCoordinates[1],!1,valueData[0]),z;for(var i=0,iLen=pathCoordinates.length;iLen-2*!z>i;i+=2){var p=[{x:+pathCoordinates[i-2],y:+pathCoordinates[i-1]},{x:+pathCoordinates[i],y:+pathCoordinates[i+1]},{x:+pathCoordinates[i+2],y:+pathCoordinates[i+3]},{x:+pathCoordinates[i+4],y:+pathCoordinates[i+5]}];if(z){if(!i){p[0]={x:+pathCoordinates[iLen-2],y:+pathCoordinates[iLen-1]}}else if(iLen-4===i){p[3]={x:+pathCoordinates[0],y:+pathCoordinates[1]}}else if(iLen-2===i){p[2]={x:+pathCoordinates[0],y:+pathCoordinates[1]};p[3]={x:+pathCoordinates[2],y:+pathCoordinates[3]}}}else{if(iLen-4===i){p[3]=p[2]}else if(!i){p[0]={x:+pathCoordinates[i],y:+pathCoordinates[i+1]}}} +path.curve((t*(-p[0].x+6*p[1].x+p[2].x)/6)+(c*p[2].x),(t*(-p[0].y+6*p[1].y+p[2].y)/6)+(c*p[2].y),(t*(p[1].x+6*p[2].x-p[3].x)/6)+(c*p[2].x),(t*(p[1].y+6*p[2].y-p[3].y)/6)+(c*p[2].y),p[2].x,p[2].y,!1,valueData[(i+2)/2])} +return path}}};Chartist.Interpolation.step=function(options){var defaultOptions={postpone:!0,fillHoles:!1};options=Chartist.extend({},defaultOptions,options);return function step(pathCoordinates,valueData){var path=new Chartist.Svg.Path();var prevX,prevY,prevData;for(var i=0;i<pathCoordinates.length;i+=2){var currX=pathCoordinates[i];var currY=pathCoordinates[i+1];var currData=valueData[i/2];if(currData.value!==undefined){if(prevData===undefined){path.move(currX,currY,!1,currData)}else{if(options.postpone){path.line(currX,prevY,!1,prevData)}else{path.line(prevX,currY,!1,currData)} +path.line(currX,currY,!1,currData)} +prevX=currX;prevY=currY;prevData=currData}else if(!options.fillHoles){prevX=prevY=prevData=undefined}} +return path}}}(window,document,Chartist));(function(window,document,Chartist){'use strict';Chartist.EventEmitter=function(){var handlers=[];function addEventHandler(event,handler){handlers[event]=handlers[event]||[];handlers[event].push(handler)} +function removeEventHandler(event,handler){if(handlers[event]){if(handler){handlers[event].splice(handlers[event].indexOf(handler),1);if(handlers[event].length===0){delete handlers[event]}}else{delete handlers[event]}}} +function emit(event,data){if(handlers[event]){handlers[event].forEach(function(handler){handler(data)})} +if(handlers['*']){handlers['*'].forEach(function(starHandler){starHandler(event,data)})}} +return{addEventHandler:addEventHandler,removeEventHandler:removeEventHandler,emit:emit}}}(window,document,Chartist));(function(window,document,Chartist){'use strict';function listToArray(list){var arr=[];if(list.length){for(var i=0;i<list.length;i++){arr.push(list[i])}} +return arr} +function extend(properties,superProtoOverride){var superProto=superProtoOverride||this.prototype||Chartist.Class;var proto=Object.create(superProto);Chartist.Class.cloneDefinitions(proto,properties);var constr=function(){var fn=proto.constructor||function(){},instance;instance=this===Chartist?Object.create(proto):this;fn.apply(instance,Array.prototype.slice.call(arguments,0));return instance};constr.prototype=proto;constr.super=superProto;constr.extend=this.extend;return constr} +function cloneDefinitions(){var args=listToArray(arguments);var target=args[0];args.splice(1,args.length-1).forEach(function(source){Object.getOwnPropertyNames(source).forEach(function(propName){delete target[propName];Object.defineProperty(target,propName,Object.getOwnPropertyDescriptor(source,propName))})});return target} +Chartist.Class={extend:extend,cloneDefinitions:cloneDefinitions}}(window,document,Chartist));(function(window,document,Chartist){'use strict';function update(data,options,override){if(data){this.data=data;this.eventEmitter.emit('data',{type:'update',data:this.data})} +if(options){this.options=Chartist.extend({},override?this.options:this.defaultOptions,options);if(!this.initializeTimeoutId){this.optionsProvider.removeMediaQueryListeners();this.optionsProvider=Chartist.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter)}} +if(!this.initializeTimeoutId){this.createChart(this.optionsProvider.getCurrentOptions())} +return this} +function detach(){if(!this.initializeTimeoutId){window.removeEventListener('resize',this.resizeListener);this.optionsProvider.removeMediaQueryListeners()}else{window.clearTimeout(this.initializeTimeoutId)} +return this} +function on(event,handler){this.eventEmitter.addEventHandler(event,handler);return this} +function off(event,handler){this.eventEmitter.removeEventHandler(event,handler);return this} +function initialize(){window.addEventListener('resize',this.resizeListener);this.optionsProvider=Chartist.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter);this.eventEmitter.addEventHandler('optionsChanged',function(){this.update()}.bind(this));if(this.options.plugins){this.options.plugins.forEach(function(plugin){if(plugin instanceof Array){plugin[0](this,plugin[1])}else{plugin(this)}}.bind(this))} +this.eventEmitter.emit('data',{type:'initial',data:this.data});this.createChart(this.optionsProvider.getCurrentOptions());this.initializeTimeoutId=undefined} +function Base(query,data,defaultOptions,options,responsiveOptions){this.container=Chartist.querySelector(query);this.data=data;this.defaultOptions=defaultOptions;this.options=options;this.responsiveOptions=responsiveOptions;this.eventEmitter=Chartist.EventEmitter();this.supportsForeignObject=Chartist.Svg.isSupported('Extensibility');this.supportsAnimations=Chartist.Svg.isSupported('AnimationEventsAttribute');this.resizeListener=function resizeListener(){this.update()}.bind(this);if(this.container){if(this.container.__chartist__){this.container.__chartist__.detach()} +this.container.__chartist__=this} +this.initializeTimeoutId=setTimeout(initialize.bind(this),0)} +Chartist.Base=Chartist.Class.extend({constructor:Base,optionsProvider:undefined,container:undefined,svg:undefined,eventEmitter:undefined,createChart:function(){throw new Error('Base chart type can\'t be instantiated!')},update:update,detach:detach,on:on,off:off,version:Chartist.version,supportsForeignObject:!1})}(window,document,Chartist));(function(window,document,Chartist){'use strict';function Svg(name,attributes,className,parent,insertFirst){if(name instanceof Element){this._node=name}else{this._node=document.createElementNS(Chartist.namespaces.svg,name);if(name==='svg'){this.attr({'xmlns:ct':Chartist.namespaces.ct})}} +if(attributes){this.attr(attributes)} +if(className){this.addClass(className)} +if(parent){if(insertFirst&&parent._node.firstChild){parent._node.insertBefore(this._node,parent._node.firstChild)}else{parent._node.appendChild(this._node)}}} +function attr(attributes,ns){if(typeof attributes==='string'){if(ns){return this._node.getAttributeNS(ns,attributes)}else{return this._node.getAttribute(attributes)}} +Object.keys(attributes).forEach(function(key){if(attributes[key]===undefined){return} +if(key.indexOf(':')!==-1){var namespacedAttribute=key.split(':');this._node.setAttributeNS(Chartist.namespaces[namespacedAttribute[0]],key,attributes[key])}else{this._node.setAttribute(key,attributes[key])}}.bind(this));return this} +function elem(name,attributes,className,insertFirst){return new Chartist.Svg(name,attributes,className,this,insertFirst)} +function parent(){return this._node.parentNode instanceof SVGElement?new Chartist.Svg(this._node.parentNode):null} +function root(){var node=this._node;while(node.nodeName!=='svg'){node=node.parentNode} +return new Chartist.Svg(node)} +function querySelector(selector){var foundNode=this._node.querySelector(selector);return foundNode?new Chartist.Svg(foundNode):null} +function querySelectorAll(selector){var foundNodes=this._node.querySelectorAll(selector);return foundNodes.length?new Chartist.Svg.List(foundNodes):null} +function foreignObject(content,attributes,className,insertFirst){if(typeof content==='string'){var container=document.createElement('div');container.innerHTML=content;content=container.firstChild} +content.setAttribute('xmlns',Chartist.namespaces.xmlns);var fnObj=this.elem('foreignObject',attributes,className,insertFirst);fnObj._node.appendChild(content);return fnObj} +function text(t){this._node.appendChild(document.createTextNode(t));return this} +function empty(){while(this._node.firstChild){this._node.removeChild(this._node.firstChild)} +return this} +function remove(){this._node.parentNode.removeChild(this._node);return this.parent()} +function replace(newElement){this._node.parentNode.replaceChild(newElement._node,this._node);return newElement} +function append(element,insertFirst){if(insertFirst&&this._node.firstChild){this._node.insertBefore(element._node,this._node.firstChild)}else{this._node.appendChild(element._node)} +return this} +function classes(){return this._node.getAttribute('class')?this._node.getAttribute('class').trim().split(/\s+/):[]} +function addClass(names){this._node.setAttribute('class',this.classes(this._node).concat(names.trim().split(/\s+/)).filter(function(elem,pos,self){return self.indexOf(elem)===pos}).join(' '));return this} +function removeClass(names){var removedClasses=names.trim().split(/\s+/);this._node.setAttribute('class',this.classes(this._node).filter(function(name){return removedClasses.indexOf(name)===-1}).join(' '));return this} +function removeAllClasses(){this._node.setAttribute('class','');return this} +function height(){return this._node.getBoundingClientRect().height} +function width(){return this._node.getBoundingClientRect().width} +function animate(animations,guided,eventEmitter){if(guided===undefined){guided=!0} +Object.keys(animations).forEach(function createAnimateForAttributes(attribute){function createAnimate(animationDefinition,guided){var attributeProperties={},animate,timeout,easing;if(animationDefinition.easing){easing=animationDefinition.easing instanceof Array?animationDefinition.easing:Chartist.Svg.Easing[animationDefinition.easing];delete animationDefinition.easing} +animationDefinition.begin=Chartist.ensureUnit(animationDefinition.begin,'ms');animationDefinition.dur=Chartist.ensureUnit(animationDefinition.dur,'ms');if(easing){animationDefinition.calcMode='spline';animationDefinition.keySplines=easing.join(' ');animationDefinition.keyTimes='0;1'} +if(guided){animationDefinition.fill='freeze';attributeProperties[attribute]=animationDefinition.from;this.attr(attributeProperties);timeout=Chartist.quantity(animationDefinition.begin||0).value;animationDefinition.begin='indefinite'} +animate=this.elem('animate',Chartist.extend({attributeName:attribute},animationDefinition));if(guided){setTimeout(function(){try{animate._node.beginElement()}catch(err){attributeProperties[attribute]=animationDefinition.to;this.attr(attributeProperties);animate.remove()}}.bind(this),timeout)} +if(eventEmitter){animate._node.addEventListener('beginEvent',function handleBeginEvent(){eventEmitter.emit('animationBegin',{element:this,animate:animate._node,params:animationDefinition})}.bind(this))} +animate._node.addEventListener('endEvent',function handleEndEvent(){if(eventEmitter){eventEmitter.emit('animationEnd',{element:this,animate:animate._node,params:animationDefinition})} +if(guided){attributeProperties[attribute]=animationDefinition.to;this.attr(attributeProperties);animate.remove()}}.bind(this))} +if(animations[attribute]instanceof Array){animations[attribute].forEach(function(animationDefinition){createAnimate.bind(this)(animationDefinition,!1)}.bind(this))}else{createAnimate.bind(this)(animations[attribute],guided)}}.bind(this));return this} +Chartist.Svg=Chartist.Class.extend({constructor:Svg,attr:attr,elem:elem,parent:parent,root:root,querySelector:querySelector,querySelectorAll:querySelectorAll,foreignObject:foreignObject,text:text,empty:empty,remove:remove,replace:replace,append:append,classes:classes,addClass:addClass,removeClass:removeClass,removeAllClasses:removeAllClasses,height:height,width:width,animate:animate});Chartist.Svg.isSupported=function(feature){return document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#'+feature,'1.1')};var easingCubicBeziers={easeInSine:[0.47,0,0.745,0.715],easeOutSine:[0.39,0.575,0.565,1],easeInOutSine:[0.445,0.05,0.55,0.95],easeInQuad:[0.55,0.085,0.68,0.53],easeOutQuad:[0.25,0.46,0.45,0.94],easeInOutQuad:[0.455,0.03,0.515,0.955],easeInCubic:[0.55,0.055,0.675,0.19],easeOutCubic:[0.215,0.61,0.355,1],easeInOutCubic:[0.645,0.045,0.355,1],easeInQuart:[0.895,0.03,0.685,0.22],easeOutQuart:[0.165,0.84,0.44,1],easeInOutQuart:[0.77,0,0.175,1],easeInQuint:[0.755,0.05,0.855,0.06],easeOutQuint:[0.23,1,0.32,1],easeInOutQuint:[0.86,0,0.07,1],easeInExpo:[0.95,0.05,0.795,0.035],easeOutExpo:[0.19,1,0.22,1],easeInOutExpo:[1,0,0,1],easeInCirc:[0.6,0.04,0.98,0.335],easeOutCirc:[0.075,0.82,0.165,1],easeInOutCirc:[0.785,0.135,0.15,0.86],easeInBack:[0.6,-0.28,0.735,0.045],easeOutBack:[0.175,0.885,0.32,1.275],easeInOutBack:[0.68,-0.55,0.265,1.55]};Chartist.Svg.Easing=easingCubicBeziers;function SvgList(nodeList){var list=this;this.svgElements=[];for(var i=0;i<nodeList.length;i++){this.svgElements.push(new Chartist.Svg(nodeList[i]))} +Object.keys(Chartist.Svg.prototype).filter(function(prototypeProperty){return['constructor','parent','querySelector','querySelectorAll','replace','append','classes','height','width'].indexOf(prototypeProperty)===-1}).forEach(function(prototypeProperty){list[prototypeProperty]=function(){var args=Array.prototype.slice.call(arguments,0);list.svgElements.forEach(function(element){Chartist.Svg.prototype[prototypeProperty].apply(element,args)});return list}})} +Chartist.Svg.List=Chartist.Class.extend({constructor:SvgList})}(window,document,Chartist));(function(window,document,Chartist){'use strict';var elementDescriptions={m:['x','y'],l:['x','y'],c:['x1','y1','x2','y2','x','y'],a:['rx','ry','xAr','lAf','sf','x','y']};var defaultOptions={accuracy:3};function element(command,params,pathElements,pos,relative,data){var pathElement=Chartist.extend({command:relative?command.toLowerCase():command.toUpperCase()},params,data?{data:data}:{});pathElements.splice(pos,0,pathElement)} +function forEachParam(pathElements,cb){pathElements.forEach(function(pathElement,pathElementIndex){elementDescriptions[pathElement.command.toLowerCase()].forEach(function(paramName,paramIndex){cb(pathElement,paramName,pathElementIndex,paramIndex,pathElements)})})} +function SvgPath(close,options){this.pathElements=[];this.pos=0;this.close=close;this.options=Chartist.extend({},defaultOptions,options)} +function position(pos){if(pos!==undefined){this.pos=Math.max(0,Math.min(this.pathElements.length,pos));return this}else{return this.pos}} +function remove(count){this.pathElements.splice(this.pos,count);return this} +function move(x,y,relative,data){element('M',{x:+x,y:+y},this.pathElements,this.pos++,relative,data);return this} +function line(x,y,relative,data){element('L',{x:+x,y:+y},this.pathElements,this.pos++,relative,data);return this} +function curve(x1,y1,x2,y2,x,y,relative,data){element('C',{x1:+x1,y1:+y1,x2:+x2,y2:+y2,x:+x,y:+y},this.pathElements,this.pos++,relative,data);return this} +function arc(rx,ry,xAr,lAf,sf,x,y,relative,data){element('A',{rx:+rx,ry:+ry,xAr:+xAr,lAf:+lAf,sf:+sf,x:+x,y:+y},this.pathElements,this.pos++,relative,data);return this} +function parse(path){var chunks=path.replace(/([A-Za-z])([0-9])/g,'$1 $2').replace(/([0-9])([A-Za-z])/g,'$1 $2').split(/[\s,]+/).reduce(function(result,element){if(element.match(/[A-Za-z]/)){result.push([])} +result[result.length-1].push(element);return result},[]);if(chunks[chunks.length-1][0].toUpperCase()==='Z'){chunks.pop()} +var elements=chunks.map(function(chunk){var command=chunk.shift(),description=elementDescriptions[command.toLowerCase()];return Chartist.extend({command:command},description.reduce(function(result,paramName,index){result[paramName]=+chunk[index];return result},{}))});var spliceArgs=[this.pos,0];Array.prototype.push.apply(spliceArgs,elements);Array.prototype.splice.apply(this.pathElements,spliceArgs);this.pos+=elements.length;return this} +function stringify(){var accuracyMultiplier=Math.pow(10,this.options.accuracy);return this.pathElements.reduce(function(path,pathElement){var params=elementDescriptions[pathElement.command.toLowerCase()].map(function(paramName){return this.options.accuracy?(Math.round(pathElement[paramName]*accuracyMultiplier)/accuracyMultiplier):pathElement[paramName]}.bind(this));return path+pathElement.command+params.join(',')}.bind(this),'')+(this.close?'Z':'')} +function scale(x,y){forEachParam(this.pathElements,function(pathElement,paramName){pathElement[paramName]*=paramName[0]==='x'?x:y});return this} +function translate(x,y){forEachParam(this.pathElements,function(pathElement,paramName){pathElement[paramName]+=paramName[0]==='x'?x:y});return this} +function transform(transformFnc){forEachParam(this.pathElements,function(pathElement,paramName,pathElementIndex,paramIndex,pathElements){var transformed=transformFnc(pathElement,paramName,pathElementIndex,paramIndex,pathElements);if(transformed||transformed===0){pathElement[paramName]=transformed}});return this} +function clone(close){var c=new Chartist.Svg.Path(close||this.close);c.pos=this.pos;c.pathElements=this.pathElements.slice().map(function cloneElements(pathElement){return Chartist.extend({},pathElement)});c.options=Chartist.extend({},this.options);return c} +function splitByCommand(command){var split=[new Chartist.Svg.Path()];this.pathElements.forEach(function(pathElement){if(pathElement.command===command.toUpperCase()&&split[split.length-1].pathElements.length!==0){split.push(new Chartist.Svg.Path())} +split[split.length-1].pathElements.push(pathElement)});return split} +function join(paths,close,options){var joinedPath=new Chartist.Svg.Path(close,options);for(var i=0;i<paths.length;i++){var path=paths[i];for(var j=0;j<path.pathElements.length;j++){joinedPath.pathElements.push(path.pathElements[j])}} +return joinedPath} +Chartist.Svg.Path=Chartist.Class.extend({constructor:SvgPath,position:position,remove:remove,move:move,line:line,curve:curve,arc:arc,scale:scale,translate:translate,transform:transform,parse:parse,stringify:stringify,clone:clone,splitByCommand:splitByCommand});Chartist.Svg.Path.elementDescriptions=elementDescriptions;Chartist.Svg.Path.join=join}(window,document,Chartist));(function(window,document,Chartist){'use strict';var axisUnits={x:{pos:'x',len:'width',dir:'horizontal',rectStart:'x1',rectEnd:'x2',rectOffset:'y2'},y:{pos:'y',len:'height',dir:'vertical',rectStart:'y2',rectEnd:'y1',rectOffset:'x1'}};function Axis(units,chartRect,ticks,options){this.units=units;this.counterUnits=units===axisUnits.x?axisUnits.y:axisUnits.x;this.chartRect=chartRect;this.axisLength=chartRect[units.rectEnd]-chartRect[units.rectStart];this.gridOffset=chartRect[units.rectOffset];this.ticks=ticks;this.options=options} +function createGridAndLabels(gridGroup,labelGroup,useForeignObject,chartOptions,eventEmitter){var axisOptions=chartOptions['axis'+this.units.pos.toUpperCase()];var projectedValues=this.ticks.map(this.projectValue.bind(this));var labelValues=this.ticks.map(axisOptions.labelInterpolationFnc);projectedValues.forEach(function(projectedValue,index){var labelOffset={x:0,y:0};var labelLength;if(projectedValues[index+1]){labelLength=projectedValues[index+1]-projectedValue}else{labelLength=Math.max(this.axisLength-projectedValue,30)} +if(Chartist.isFalseyButZero(labelValues[index])&&labelValues[index]!==''){return} +if(this.units.pos==='x'){projectedValue=this.chartRect.x1+projectedValue;labelOffset.x=chartOptions.axisX.labelOffset.x;if(chartOptions.axisX.position==='start'){labelOffset.y=this.chartRect.padding.top+chartOptions.axisX.labelOffset.y+(useForeignObject?5:20)}else{labelOffset.y=this.chartRect.y1+chartOptions.axisX.labelOffset.y+(useForeignObject?5:20)}}else{projectedValue=this.chartRect.y1-projectedValue;labelOffset.y=chartOptions.axisY.labelOffset.y-(useForeignObject?labelLength:0);if(chartOptions.axisY.position==='start'){labelOffset.x=useForeignObject?this.chartRect.padding.left+chartOptions.axisY.labelOffset.x:this.chartRect.x1-10}else{labelOffset.x=this.chartRect.x2+chartOptions.axisY.labelOffset.x+10}} +if(axisOptions.showGrid){Chartist.createGrid(projectedValue,index,this,this.gridOffset,this.chartRect[this.counterUnits.len](),gridGroup,[chartOptions.classNames.grid,chartOptions.classNames[this.units.dir]],eventEmitter)} +if(axisOptions.showLabel){Chartist.createLabel(projectedValue,labelLength,index,labelValues,this,axisOptions.offset,labelOffset,labelGroup,[chartOptions.classNames.label,chartOptions.classNames[this.units.dir],chartOptions.classNames[axisOptions.position]],useForeignObject,eventEmitter)}}.bind(this))} +Chartist.Axis=Chartist.Class.extend({constructor:Axis,createGridAndLabels:createGridAndLabels,projectValue:function(value,index,data){throw new Error('Base axis can\'t be instantiated!')}});Chartist.Axis.units=axisUnits}(window,document,Chartist));(function(window,document,Chartist){'use strict';function AutoScaleAxis(axisUnit,data,chartRect,options){var highLow=options.highLow||Chartist.getHighLow(data.normalized,options,axisUnit.pos);this.bounds=Chartist.getBounds(chartRect[axisUnit.rectEnd]-chartRect[axisUnit.rectStart],highLow,options.scaleMinSpace||20,options.onlyInteger);this.range={min:this.bounds.min,max:this.bounds.max};Chartist.AutoScaleAxis.super.constructor.call(this,axisUnit,chartRect,this.bounds.values,options)} +function projectValue(value){return this.axisLength*(+Chartist.getMultiValue(value,this.units.pos)-this.bounds.min)/this.bounds.range} +Chartist.AutoScaleAxis=Chartist.Axis.extend({constructor:AutoScaleAxis,projectValue:projectValue})}(window,document,Chartist));(function(window,document,Chartist){'use strict';function FixedScaleAxis(axisUnit,data,chartRect,options){var highLow=options.highLow||Chartist.getHighLow(data.normalized,options,axisUnit.pos);this.divisor=options.divisor||1;this.ticks=options.ticks||Chartist.times(this.divisor).map(function(value,index){return highLow.low+(highLow.high-highLow.low)/this.divisor*index}.bind(this));this.ticks.sort(function(a,b){return a-b});this.range={min:highLow.low,max:highLow.high};Chartist.FixedScaleAxis.super.constructor.call(this,axisUnit,chartRect,this.ticks,options);this.stepLength=this.axisLength/this.divisor} +function projectValue(value){return this.axisLength*(+Chartist.getMultiValue(value,this.units.pos)-this.range.min)/(this.range.max-this.range.min)} +Chartist.FixedScaleAxis=Chartist.Axis.extend({constructor:FixedScaleAxis,projectValue:projectValue})}(window,document,Chartist));(function(window,document,Chartist){'use strict';function StepAxis(axisUnit,data,chartRect,options){Chartist.StepAxis.super.constructor.call(this,axisUnit,chartRect,options.ticks,options);this.stepLength=this.axisLength/(options.ticks.length-(options.stretch?1:0))} +function projectValue(value,index){return this.stepLength*index} +Chartist.StepAxis=Chartist.Axis.extend({constructor:StepAxis,projectValue:projectValue})}(window,document,Chartist));(function(window,document,Chartist){'use strict';var defaultOptions={axisX:{offset:30,position:'end',labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:Chartist.noop,type:undefined},axisY:{offset:40,position:'start',labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:Chartist.noop,type:undefined,scaleMinSpace:20,onlyInteger:!1},width:undefined,height:undefined,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,low:undefined,high:undefined,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:'ct-chart-line',label:'ct-label',labelGroup:'ct-labels',series:'ct-series',line:'ct-line',point:'ct-point',area:'ct-area',grid:'ct-grid',gridGroup:'ct-grids',vertical:'ct-vertical',horizontal:'ct-horizontal',start:'ct-start',end:'ct-end'}};function createChart(options){this.data=Chartist.normalizeData(this.data);var data={raw:this.data,normalized:Chartist.getDataArray(this.data,options.reverseData,!0)};this.svg=Chartist.createSvg(this.container,options.width,options.height,options.classNames.chart);var gridGroup=this.svg.elem('g').addClass(options.classNames.gridGroup);var seriesGroup=this.svg.elem('g');var labelGroup=this.svg.elem('g').addClass(options.classNames.labelGroup);var chartRect=Chartist.createChartRect(this.svg,options,defaultOptions.padding);var axisX,axisY;if(options.axisX.type===undefined){axisX=new Chartist.StepAxis(Chartist.Axis.units.x,data,chartRect,Chartist.extend({},options.axisX,{ticks:data.raw.labels,stretch:options.fullWidth}))}else{axisX=options.axisX.type.call(Chartist,Chartist.Axis.units.x,data,chartRect,options.axisX)} +if(options.axisY.type===undefined){axisY=new Chartist.AutoScaleAxis(Chartist.Axis.units.y,data,chartRect,Chartist.extend({},options.axisY,{high:Chartist.isNum(options.high)?options.high:options.axisY.high,low:Chartist.isNum(options.low)?options.low:options.axisY.low}))}else{axisY=options.axisY.type.call(Chartist,Chartist.Axis.units.y,data,chartRect,options.axisY)} +axisX.createGridAndLabels(gridGroup,labelGroup,this.supportsForeignObject,options,this.eventEmitter);axisY.createGridAndLabels(gridGroup,labelGroup,this.supportsForeignObject,options,this.eventEmitter);data.raw.series.forEach(function(series,seriesIndex){var seriesElement=seriesGroup.elem('g');seriesElement.attr({'ct:series-name':series.name,'ct:meta':Chartist.serialize(series.meta)});seriesElement.addClass([options.classNames.series,(series.className||options.classNames.series+'-'+Chartist.alphaNumerate(seriesIndex))].join(' '));var pathCoordinates=[],pathData=[];data.normalized[seriesIndex].forEach(function(value,valueIndex){var p={x:chartRect.x1+axisX.projectValue(value,valueIndex,data.normalized[seriesIndex]),y:chartRect.y1-axisY.projectValue(value,valueIndex,data.normalized[seriesIndex])};pathCoordinates.push(p.x,p.y);pathData.push({value:value,valueIndex:valueIndex,meta:Chartist.getMetaData(series,valueIndex)})}.bind(this));var seriesOptions={lineSmooth:Chartist.getSeriesOption(series,options,'lineSmooth'),showPoint:Chartist.getSeriesOption(series,options,'showPoint'),showLine:Chartist.getSeriesOption(series,options,'showLine'),showArea:Chartist.getSeriesOption(series,options,'showArea'),areaBase:Chartist.getSeriesOption(series,options,'areaBase')};var smoothing=typeof seriesOptions.lineSmooth==='function'?seriesOptions.lineSmooth:(seriesOptions.lineSmooth?Chartist.Interpolation.cardinal():Chartist.Interpolation.none());var path=smoothing(pathCoordinates,pathData);if(seriesOptions.showPoint){path.pathElements.forEach(function(pathElement){var point=seriesElement.elem('line',{x1:pathElement.x,y1:pathElement.y,x2:pathElement.x+0.01,y2:pathElement.y},options.classNames.point).attr({'ct:value':[pathElement.data.value.x,pathElement.data.value.y].filter(Chartist.isNum).join(','),'ct:meta':pathElement.data.meta});this.eventEmitter.emit('draw',{type:'point',value:pathElement.data.value,index:pathElement.data.valueIndex,meta:pathElement.data.meta,series:series,seriesIndex:seriesIndex,axisX:axisX,axisY:axisY,group:seriesElement,element:point,x:pathElement.x,y:pathElement.y})}.bind(this))} +if(seriesOptions.showLine){var line=seriesElement.elem('path',{d:path.stringify()},options.classNames.line,!0);this.eventEmitter.emit('draw',{type:'line',values:data.normalized[seriesIndex],path:path.clone(),chartRect:chartRect,index:seriesIndex,series:series,seriesIndex:seriesIndex,axisX:axisX,axisY:axisY,group:seriesElement,element:line})} +if(seriesOptions.showArea&&axisY.range){var areaBase=Math.max(Math.min(seriesOptions.areaBase,axisY.range.max),axisY.range.min);var areaBaseProjected=chartRect.y1-axisY.projectValue(areaBase);path.splitByCommand('M').filter(function onlySolidSegments(pathSegment){return pathSegment.pathElements.length>1}).map(function convertToArea(solidPathSegments){var firstElement=solidPathSegments.pathElements[0];var lastElement=solidPathSegments.pathElements[solidPathSegments.pathElements.length-1];return solidPathSegments.clone(!0).position(0).remove(1).move(firstElement.x,areaBaseProjected).line(firstElement.x,firstElement.y).position(solidPathSegments.pathElements.length+1).line(lastElement.x,areaBaseProjected)}).forEach(function createArea(areaPath){var area=seriesElement.elem('path',{d:areaPath.stringify()},options.classNames.area,!0);this.eventEmitter.emit('draw',{type:'area',values:data.normalized[seriesIndex],path:areaPath.clone(),series:series,seriesIndex:seriesIndex,axisX:axisX,axisY:axisY,chartRect:chartRect,index:seriesIndex,group:seriesElement,element:area})}.bind(this))}}.bind(this));this.eventEmitter.emit('created',{bounds:axisY.bounds,chartRect:chartRect,axisX:axisX,axisY:axisY,svg:this.svg,options:options})} +function Line(query,data,options,responsiveOptions){Chartist.Line.super.constructor.call(this,query,data,defaultOptions,Chartist.extend({},defaultOptions,options),responsiveOptions)} +Chartist.Line=Chartist.Base.extend({constructor:Line,createChart:createChart})}(window,document,Chartist));(function(window,document,Chartist){'use strict';var defaultOptions={axisX:{offset:30,position:'end',labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:Chartist.noop,scaleMinSpace:30,onlyInteger:!1},axisY:{offset:40,position:'start',labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:Chartist.noop,scaleMinSpace:20,onlyInteger:!1},width:undefined,height:undefined,high:undefined,low:undefined,chartPadding:{top:15,right:15,bottom:5,left:10},seriesBarDistance:15,stackBars:!1,stackMode:'accumulate',horizontalBars:!1,distributeSeries:!1,reverseData:!1,classNames:{chart:'ct-chart-bar',horizontalBars:'ct-horizontal-bars',label:'ct-label',labelGroup:'ct-labels',series:'ct-series',bar:'ct-bar',grid:'ct-grid',gridGroup:'ct-grids',vertical:'ct-vertical',horizontal:'ct-horizontal',start:'ct-start',end:'ct-end'}};function createChart(options){this.data=Chartist.normalizeData(this.data);var data={raw:this.data,normalized:options.distributeSeries?Chartist.getDataArray(this.data,options.reverseData,options.horizontalBars?'x':'y').map(function(value){return[value]}):Chartist.getDataArray(this.data,options.reverseData,options.horizontalBars?'x':'y')};var highLow;this.svg=Chartist.createSvg(this.container,options.width,options.height,options.classNames.chart+(options.horizontalBars?' '+options.classNames.horizontalBars:''));var gridGroup=this.svg.elem('g').addClass(options.classNames.gridGroup);var seriesGroup=this.svg.elem('g');var labelGroup=this.svg.elem('g').addClass(options.classNames.labelGroup);if(options.stackBars&&data.normalized.length!==0){var serialSums=Chartist.serialMap(data.normalized,function serialSums(){return Array.prototype.slice.call(arguments).map(function(value){return value}).reduce(function(prev,curr){return{x:prev.x+(curr&&curr.x)||0,y:prev.y+(curr&&curr.y)||0}},{x:0,y:0})});highLow=Chartist.getHighLow([serialSums],Chartist.extend({},options,{referenceValue:0}),options.horizontalBars?'x':'y')}else{highLow=Chartist.getHighLow(data.normalized,Chartist.extend({},options,{referenceValue:0}),options.horizontalBars?'x':'y')} +highLow.high=+options.high||(options.high===0?0:highLow.high);highLow.low=+options.low||(options.low===0?0:highLow.low);var chartRect=Chartist.createChartRect(this.svg,options,defaultOptions.padding);var valueAxis,labelAxisTicks,labelAxis,axisX,axisY;if(options.distributeSeries&&options.stackBars){labelAxisTicks=data.raw.labels.slice(0,1)}else{labelAxisTicks=data.raw.labels} +if(options.horizontalBars){if(options.axisX.type===undefined){valueAxis=axisX=new Chartist.AutoScaleAxis(Chartist.Axis.units.x,data,chartRect,Chartist.extend({},options.axisX,{highLow:highLow,referenceValue:0}))}else{valueAxis=axisX=options.axisX.type.call(Chartist,Chartist.Axis.units.x,data,chartRect,Chartist.extend({},options.axisX,{highLow:highLow,referenceValue:0}))} +if(options.axisY.type===undefined){labelAxis=axisY=new Chartist.StepAxis(Chartist.Axis.units.y,data,chartRect,{ticks:labelAxisTicks})}else{labelAxis=axisY=options.axisY.type.call(Chartist,Chartist.Axis.units.y,data,chartRect,options.axisY)}}else{if(options.axisX.type===undefined){labelAxis=axisX=new Chartist.StepAxis(Chartist.Axis.units.x,data,chartRect,{ticks:labelAxisTicks})}else{labelAxis=axisX=options.axisX.type.call(Chartist,Chartist.Axis.units.x,data,chartRect,options.axisX)} +if(options.axisY.type===undefined){valueAxis=axisY=new Chartist.AutoScaleAxis(Chartist.Axis.units.y,data,chartRect,Chartist.extend({},options.axisY,{highLow:highLow,referenceValue:0}))}else{valueAxis=axisY=options.axisY.type.call(Chartist,Chartist.Axis.units.y,data,chartRect,Chartist.extend({},options.axisY,{highLow:highLow,referenceValue:0}))}} +var zeroPoint=options.horizontalBars?(chartRect.x1+valueAxis.projectValue(0)):(chartRect.y1-valueAxis.projectValue(0));var stackedBarValues=[];labelAxis.createGridAndLabels(gridGroup,labelGroup,this.supportsForeignObject,options,this.eventEmitter);valueAxis.createGridAndLabels(gridGroup,labelGroup,this.supportsForeignObject,options,this.eventEmitter);data.raw.series.forEach(function(series,seriesIndex){var biPol=seriesIndex-(data.raw.series.length-1)/2;var periodHalfLength;var seriesElement;if(options.distributeSeries&&!options.stackBars){periodHalfLength=labelAxis.axisLength/data.normalized.length/2}else if(options.distributeSeries&&options.stackBars){periodHalfLength=labelAxis.axisLength/2}else{periodHalfLength=labelAxis.axisLength/data.normalized[seriesIndex].length/2} +seriesElement=seriesGroup.elem('g');seriesElement.attr({'ct:series-name':series.name,'ct:meta':Chartist.serialize(series.meta)});seriesElement.addClass([options.classNames.series,(series.className||options.classNames.series+'-'+Chartist.alphaNumerate(seriesIndex))].join(' '));data.normalized[seriesIndex].forEach(function(value,valueIndex){var projected,bar,previousStack,labelAxisValueIndex;if(options.distributeSeries&&!options.stackBars){labelAxisValueIndex=seriesIndex}else if(options.distributeSeries&&options.stackBars){labelAxisValueIndex=0}else{labelAxisValueIndex=valueIndex} +if(options.horizontalBars){projected={x:chartRect.x1+valueAxis.projectValue(value&&value.x?value.x:0,valueIndex,data.normalized[seriesIndex]),y:chartRect.y1-labelAxis.projectValue(value&&value.y?value.y:0,labelAxisValueIndex,data.normalized[seriesIndex])}}else{projected={x:chartRect.x1+labelAxis.projectValue(value&&value.x?value.x:0,labelAxisValueIndex,data.normalized[seriesIndex]),y:chartRect.y1-valueAxis.projectValue(value&&value.y?value.y:0,valueIndex,data.normalized[seriesIndex])}} +if(labelAxis instanceof Chartist.StepAxis){if(!labelAxis.options.stretch){projected[labelAxis.units.pos]+=periodHalfLength*(options.horizontalBars?-1:1)} +projected[labelAxis.units.pos]+=(options.stackBars||options.distributeSeries)?0:biPol*options.seriesBarDistance*(options.horizontalBars?-1:1)} +previousStack=stackedBarValues[valueIndex]||zeroPoint;stackedBarValues[valueIndex]=previousStack-(zeroPoint-projected[labelAxis.counterUnits.pos]);if(value===undefined){return} +var positions={};positions[labelAxis.units.pos+'1']=projected[labelAxis.units.pos];positions[labelAxis.units.pos+'2']=projected[labelAxis.units.pos];if(options.stackBars&&(options.stackMode==='accumulate'||!options.stackMode)){positions[labelAxis.counterUnits.pos+'1']=previousStack;positions[labelAxis.counterUnits.pos+'2']=stackedBarValues[valueIndex]}else{positions[labelAxis.counterUnits.pos+'1']=zeroPoint;positions[labelAxis.counterUnits.pos+'2']=projected[labelAxis.counterUnits.pos]} +positions.x1=Math.min(Math.max(positions.x1,chartRect.x1),chartRect.x2);positions.x2=Math.min(Math.max(positions.x2,chartRect.x1),chartRect.x2);positions.y1=Math.min(Math.max(positions.y1,chartRect.y2),chartRect.y1);positions.y2=Math.min(Math.max(positions.y2,chartRect.y2),chartRect.y1);bar=seriesElement.elem('line',positions,options.classNames.bar).attr({'ct:value':[value.x,value.y].filter(Chartist.isNum).join(','),'ct:meta':Chartist.getMetaData(series,valueIndex)});this.eventEmitter.emit('draw',Chartist.extend({type:'bar',value:value,index:valueIndex,meta:Chartist.getMetaData(series,valueIndex),series:series,seriesIndex:seriesIndex,axisX:axisX,axisY:axisY,chartRect:chartRect,group:seriesElement,element:bar},positions))}.bind(this))}.bind(this));this.eventEmitter.emit('created',{bounds:valueAxis.bounds,chartRect:chartRect,axisX:axisX,axisY:axisY,svg:this.svg,options:options})} +function Bar(query,data,options,responsiveOptions){Chartist.Bar.super.constructor.call(this,query,data,defaultOptions,Chartist.extend({},defaultOptions,options),responsiveOptions)} +Chartist.Bar=Chartist.Base.extend({constructor:Bar,createChart:createChart})}(window,document,Chartist));(function(window,document,Chartist){'use strict';var defaultOptions={width:undefined,height:undefined,chartPadding:5,classNames:{chartPie:'ct-chart-pie',chartDonut:'ct-chart-donut',series:'ct-series',slicePie:'ct-slice-pie',sliceDonut:'ct-slice-donut',label:'ct-label'},startAngle:0,total:undefined,donut:!1,donutWidth:60,showLabel:!0,labelOffset:0,labelPosition:'inside',labelInterpolationFnc:Chartist.noop,labelDirection:'neutral',reverseData:!1,ignoreEmptyValues:!1};function determineAnchorPosition(center,label,direction){var toTheRight=label.x>center.x;if(toTheRight&&direction==='explode'||!toTheRight&&direction==='implode'){return 'start'}else if(toTheRight&&direction==='implode'||!toTheRight&&direction==='explode'){return 'end'}else{return 'middle'}} +function createChart(options){this.data=Chartist.normalizeData(this.data);var seriesGroups=[],labelsGroup,chartRect,radius,labelRadius,totalDataSum,startAngle=options.startAngle,dataArray=Chartist.getDataArray(this.data,options.reverseData);this.svg=Chartist.createSvg(this.container,options.width,options.height,options.donut?options.classNames.chartDonut:options.classNames.chartPie);chartRect=Chartist.createChartRect(this.svg,options,defaultOptions.padding);radius=Math.min(chartRect.width()/2,chartRect.height()/2);totalDataSum=options.total||dataArray.reduce(function(previousValue,currentValue){return previousValue+currentValue},0);var donutWidth=Chartist.quantity(options.donutWidth);if(donutWidth.unit==='%'){donutWidth.value*=radius/100} +radius-=options.donut?donutWidth.value/2:0;if(options.labelPosition==='outside'||options.donut){labelRadius=radius}else if(options.labelPosition==='center'){labelRadius=0}else{labelRadius=radius/2} +labelRadius+=options.labelOffset;var center={x:chartRect.x1+chartRect.width()/2,y:chartRect.y2+chartRect.height()/2};var hasSingleValInSeries=this.data.series.filter(function(val){return val.hasOwnProperty('value')?val.value!==0:val!==0}).length===1;if(options.showLabel){labelsGroup=this.svg.elem('g',null,null,!0)} +for(var i=0;i<this.data.series.length;i++){if(dataArray[i]===0&&options.ignoreEmptyValues)continue;var series=this.data.series[i];seriesGroups[i]=this.svg.elem('g',null,null,!0);seriesGroups[i].attr({'ct:series-name':series.name});seriesGroups[i].addClass([options.classNames.series,(series.className||options.classNames.series+'-'+Chartist.alphaNumerate(i))].join(' '));var endAngle=startAngle+dataArray[i]/totalDataSum*360;var overlappigStartAngle=Math.max(0,startAngle-(i===0||hasSingleValInSeries?0:0.2));if(endAngle-overlappigStartAngle>=359.99){endAngle=overlappigStartAngle+359.99} +var start=Chartist.polarToCartesian(center.x,center.y,radius,overlappigStartAngle),end=Chartist.polarToCartesian(center.x,center.y,radius,endAngle);var path=new Chartist.Svg.Path(!options.donut).move(end.x,end.y).arc(radius,radius,0,endAngle-startAngle>180,0,start.x,start.y);if(!options.donut){path.line(center.x,center.y)} +var pathElement=seriesGroups[i].elem('path',{d:path.stringify()},options.donut?options.classNames.sliceDonut:options.classNames.slicePie);pathElement.attr({'ct:value':dataArray[i],'ct:meta':Chartist.serialize(series.meta)});if(options.donut){pathElement.attr({'style':'stroke-width: '+donutWidth.value+'px'})} +this.eventEmitter.emit('draw',{type:'slice',value:dataArray[i],totalDataSum:totalDataSum,index:i,meta:series.meta,series:series,group:seriesGroups[i],element:pathElement,path:path.clone(),center:center,radius:radius,startAngle:startAngle,endAngle:endAngle});if(options.showLabel){var labelPosition=Chartist.polarToCartesian(center.x,center.y,labelRadius,startAngle+(endAngle-startAngle)/2),interpolatedValue=options.labelInterpolationFnc(this.data.labels&&!Chartist.isFalseyButZero(this.data.labels[i])?this.data.labels[i]:dataArray[i],i);if(interpolatedValue||interpolatedValue===0){var labelElement=labelsGroup.elem('text',{dx:labelPosition.x,dy:labelPosition.y,'text-anchor':determineAnchorPosition(center,labelPosition,options.labelDirection)},options.classNames.label).text(''+interpolatedValue);this.eventEmitter.emit('draw',{type:'label',index:i,group:labelsGroup,element:labelElement,text:''+interpolatedValue,x:labelPosition.x,y:labelPosition.y})}} +startAngle=endAngle} +this.eventEmitter.emit('created',{chartRect:chartRect,svg:this.svg,options:options})} +function Pie(query,data,options,responsiveOptions){Chartist.Pie.super.constructor.call(this,query,data,defaultOptions,Chartist.extend({},defaultOptions,options),responsiveOptions)} +Chartist.Pie=Chartist.Base.extend({constructor:Pie,createChart:createChart,determineAnchorPosition:determineAnchorPosition})}(window,document,Chartist));return Chartist}));define('matchMedia',[],function(){window.matchMedia||(window.matchMedia=function(){"use strict";var styleMedia=(window.styleMedia||window.media);if(!styleMedia){var style=document.createElement('style'),script=document.getElementsByTagName('script')[0],info=null;style.type='text/css';style.id='matchmediajs-test';script.parentNode.insertBefore(style,script);info=('getComputedStyle' in window)&&window.getComputedStyle(style,null)||style.currentStyle;styleMedia={matchMedium:function(media){var text='@media '+media+'{ #matchmediajs-test { width: 1px; } }';if(style.styleSheet){style.styleSheet.cssText=text}else{style.textContent=text} +return info.width==='1px'}}} +return function(media){return{matches:styleMedia.matchMedium(media||'all'),media:media||'all'}}}());if(window.matchMedia&&window.matchMedia('all').addListener){return !1} +var localMatchMedia=window.matchMedia,hasMediaQueries=localMatchMedia('only all').matches,isListening=!1,timeoutID=0,queries=[],handleChange=function(evt){clearTimeout(timeoutID);timeoutID=setTimeout(function(){for(var i=0,il=queries.length;i<il;i++){var mql=queries[i].mql,listeners=queries[i].listeners||[],matches=localMatchMedia(mql.media).matches;if(matches!==mql.matches){mql.matches=matches;for(var j=0,jl=listeners.length;j<jl;j++){listeners[j].call(window,mql)}}}},30)};window.matchMedia=function(media){var mql=localMatchMedia(media),listeners=[],index=0;mql.addListener=function(listener){if(!hasMediaQueries){return} +if(!isListening){isListening=!0;window.addEventListener('resize',handleChange,!0)} +if(index===0){index=queries.push({mql:mql,listeners:listeners})} +listeners.push(listener)};mql.removeListener=function(listener){for(var i=0,il=listeners.length;i<il;i++){if(listeners[i]===listener){listeners.splice(i,1)}}};return mql};return window.matchMedia});define('raf',[],function(){"use strict";var lastTime=0;var vendors=['ms','moz','webkit','o'];for(var x=0;x<vendors.length&&!window.requestAnimationFrame;++x){window.requestAnimationFrame=window[vendors[x]+'RequestAnimationFrame'];window.cancelAnimationFrame=window[vendors[x]+'CancelAnimationFrame']||window[vendors[x]+'CancelRequestAnimationFrame']} +if(!window.requestAnimationFrame) +window.requestAnimationFrame=function(callback,element){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=window.setTimeout(function(){callback(currTime+timeToCall)},timeToCall);lastTime=currTime+timeToCall;return id};if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(id){clearTimeout(id)}}});define('waypoints',['jquery'],function($){(function(){'use strict' +var keyCounter=0 +var allWaypoints={} +function Waypoint(options){if(!options){throw new Error('No options passed to Waypoint constructor')} +if(!options.element){throw new Error('No element option passed to Waypoint constructor')} +if(!options.handler){throw new Error('No handler option passed to Waypoint constructor')} +this.key='waypoint-'+keyCounter +this.options=Waypoint.Adapter.extend({},Waypoint.defaults,options) +this.element=this.options.element +this.adapter=new Waypoint.Adapter(this.element) +this.callback=options.handler +this.axis=this.options.horizontal?'horizontal':'vertical' +this.enabled=this.options.enabled +this.triggerPoint=null +this.group=Waypoint.Group.findOrCreate({name:this.options.group,axis:this.axis}) +this.context=Waypoint.Context.findOrCreateByElement(this.options.context) +if(Waypoint.offsetAliases[this.options.offset]){this.options.offset=Waypoint.offsetAliases[this.options.offset]} +this.group.add(this) +this.context.add(this) +allWaypoints[this.key]=this +keyCounter+=1} +Waypoint.prototype.queueTrigger=function(direction){this.group.queueTrigger(this,direction)} +Waypoint.prototype.trigger=function(args){if(!this.enabled){return} +if(this.callback){this.callback.apply(this,args)}} +Waypoint.prototype.destroy=function(){this.context.remove(this) +this.group.remove(this) +delete allWaypoints[this.key]} +Waypoint.prototype.disable=function(){this.enabled=!1 +return this} +Waypoint.prototype.enable=function(){this.context.refresh() +this.enabled=!0 +return this} +Waypoint.prototype.next=function(){return this.group.next(this)} +Waypoint.prototype.previous=function(){return this.group.previous(this)} +Waypoint.invokeAll=function(method){var allWaypointsArray=[] +for(var waypointKey in allWaypoints){allWaypointsArray.push(allWaypoints[waypointKey])} +for(var i=0,end=allWaypointsArray.length;i<end;i++){allWaypointsArray[i][method]()}} +Waypoint.destroyAll=function(){Waypoint.invokeAll('destroy')} +Waypoint.disableAll=function(){Waypoint.invokeAll('disable')} +Waypoint.enableAll=function(){Waypoint.Context.refreshAll() +for(var waypointKey in allWaypoints){allWaypoints[waypointKey].enabled=!0} +return this} +Waypoint.refreshAll=function(){Waypoint.Context.refreshAll()} +Waypoint.viewportHeight=function(){return window.innerHeight||document.documentElement.clientHeight} +Waypoint.viewportWidth=function(){return document.documentElement.clientWidth} +Waypoint.adapters=[] +Waypoint.defaults={context:window,continuous:!0,enabled:!0,group:'default',horizontal:!1,offset:0} +Waypoint.offsetAliases={'bottom-in-view':function(){return this.context.innerHeight()-this.adapter.outerHeight()},'bottom-in-view-offset':function(){return this.context.innerHeight()-this.adapter.outerHeight()-60},'right-in-view':function(){return this.context.innerWidth()-this.adapter.outerWidth()},'ety-explorer':function(){return $('.shrinkheader').outerHeight()}} +window.Waypoint=Waypoint}());(function(){'use strict' +function requestAnimationFrameShim(callback){window.setTimeout(callback,1000/60)} +var keyCounter=0 +var contexts={} +var Waypoint=window.Waypoint +var oldWindowLoad=window.onload +function Context(element){this.element=element +this.Adapter=Waypoint.Adapter +this.adapter=new this.Adapter(element) +this.key='waypoint-context-'+keyCounter +this.didScroll=!1 +this.didResize=!1 +this.oldScroll={x:this.adapter.scrollLeft(),y:this.adapter.scrollTop()} +this.waypoints={vertical:{},horizontal:{}} +element.waypointContextKey=this.key +contexts[element.waypointContextKey]=this +keyCounter+=1 +if(!Waypoint.windowContext){Waypoint.windowContext=!0 +Waypoint.windowContext=new Context(window)} +this.createThrottledScrollHandler() +this.createThrottledResizeHandler()} +Context.prototype.add=function(waypoint){var axis=waypoint.options.horizontal?'horizontal':'vertical' +this.waypoints[axis][waypoint.key]=waypoint +this.refresh()} +Context.prototype.checkEmpty=function(){var horizontalEmpty=this.Adapter.isEmptyObject(this.waypoints.horizontal) +var verticalEmpty=this.Adapter.isEmptyObject(this.waypoints.vertical) +var isWindow=this.element==this.element.window +if(horizontalEmpty&&verticalEmpty&&!isWindow){this.adapter.off('.waypoints') +delete contexts[this.key]}} +Context.prototype.createThrottledResizeHandler=function(){var self=this +function resizeHandler(){self.handleResize() +self.didResize=!1} +this.adapter.on('resize.waypoints',function(){if(!self.didResize){self.didResize=!0 +Waypoint.requestAnimationFrame(resizeHandler)}})} +Context.prototype.createThrottledScrollHandler=function(){var self=this +function scrollHandler(){self.handleScroll() +self.didScroll=!1} +this.adapter.on('scroll.waypoints',function(){if(!self.didScroll||Waypoint.isTouch){self.didScroll=!0 +Waypoint.requestAnimationFrame(scrollHandler)}})} +Context.prototype.handleResize=function(){Waypoint.Context.refreshAll()} +Context.prototype.handleScroll=function(){var triggeredGroups={} +var axes={horizontal:{newScroll:this.adapter.scrollLeft(),oldScroll:this.oldScroll.x,forward:'right',backward:'left'},vertical:{newScroll:this.adapter.scrollTop(),oldScroll:this.oldScroll.y,forward:'down',backward:'up'}} +for(var axisKey in axes){var axis=axes[axisKey] +var isForward=axis.newScroll>axis.oldScroll +var direction=isForward?axis.forward:axis.backward +for(var waypointKey in this.waypoints[axisKey]){var waypoint=this.waypoints[axisKey][waypointKey] +if(waypoint.triggerPoint===null){continue} +var wasBeforeTriggerPoint=axis.oldScroll<waypoint.triggerPoint +var nowAfterTriggerPoint=axis.newScroll>=waypoint.triggerPoint +var crossedForward=wasBeforeTriggerPoint&&nowAfterTriggerPoint +var crossedBackward=!wasBeforeTriggerPoint&&!nowAfterTriggerPoint +if(crossedForward||crossedBackward){waypoint.queueTrigger(direction) +triggeredGroups[waypoint.group.id]=waypoint.group}}} +for(var groupKey in triggeredGroups){triggeredGroups[groupKey].flushTriggers()} +this.oldScroll={x:axes.horizontal.newScroll,y:axes.vertical.newScroll}} +Context.prototype.innerHeight=function(){if(this.element==this.element.window){return Waypoint.viewportHeight()} +return this.adapter.innerHeight()} +Context.prototype.remove=function(waypoint){delete this.waypoints[waypoint.axis][waypoint.key] +this.checkEmpty()} +Context.prototype.innerWidth=function(){if(this.element==this.element.window){return Waypoint.viewportWidth()} +return this.adapter.innerWidth()} +Context.prototype.destroy=function(){var allWaypoints=[] +for(var axis in this.waypoints){for(var waypointKey in this.waypoints[axis]){allWaypoints.push(this.waypoints[axis][waypointKey])}} +for(var i=0,end=allWaypoints.length;i<end;i++){allWaypoints[i].destroy()}} +Context.prototype.refresh=function(){var isWindow=this.element==this.element.window +var contextOffset=isWindow?undefined:this.adapter.offset() +var triggeredGroups={} +var axes +this.handleScroll() +axes={horizontal:{contextOffset:isWindow?0:contextOffset.left,contextScroll:isWindow?0:this.oldScroll.x,contextDimension:this.innerWidth(),oldScroll:this.oldScroll.x,forward:'right',backward:'left',offsetProp:'left'},vertical:{contextOffset:isWindow?0:contextOffset.top,contextScroll:isWindow?0:this.oldScroll.y,contextDimension:this.innerHeight(),oldScroll:this.oldScroll.y,forward:'down',backward:'up',offsetProp:'top'}} +for(var axisKey in axes){var axis=axes[axisKey] +for(var waypointKey in this.waypoints[axisKey]){var waypoint=this.waypoints[axisKey][waypointKey] +var adjustment=waypoint.options.offset +var oldTriggerPoint=waypoint.triggerPoint +var elementOffset=0 +var freshWaypoint=oldTriggerPoint==null +var contextModifier,wasBeforeScroll,nowAfterScroll +var triggeredBackward,triggeredForward +if(waypoint.element!==waypoint.element.window){elementOffset=waypoint.adapter.offset()[axis.offsetProp]} +if(typeof adjustment==='function'){adjustment=adjustment.apply(waypoint)} +else if(typeof adjustment==='string'){adjustment=parseFloat(adjustment) +if(waypoint.options.offset.indexOf('%')>-1){adjustment=Math.ceil(axis.contextDimension*adjustment/100)}} +contextModifier=axis.contextScroll-axis.contextOffset +waypoint.triggerPoint=Math.floor(elementOffset+contextModifier-adjustment) +wasBeforeScroll=oldTriggerPoint<axis.oldScroll +nowAfterScroll=waypoint.triggerPoint>=axis.oldScroll +triggeredBackward=wasBeforeScroll&&nowAfterScroll +triggeredForward=!wasBeforeScroll&&!nowAfterScroll +if(!freshWaypoint&&triggeredBackward){waypoint.queueTrigger(axis.backward) +triggeredGroups[waypoint.group.id]=waypoint.group} +else if(!freshWaypoint&&triggeredForward){waypoint.queueTrigger(axis.forward) +triggeredGroups[waypoint.group.id]=waypoint.group} +else if(freshWaypoint&&axis.oldScroll>=waypoint.triggerPoint){waypoint.queueTrigger(axis.forward) +triggeredGroups[waypoint.group.id]=waypoint.group}}} +Waypoint.requestAnimationFrame(function(){for(var groupKey in triggeredGroups){triggeredGroups[groupKey].flushTriggers()}}) +return this} +Context.findOrCreateByElement=function(element){return Context.findByElement(element)||new Context(element)} +Context.refreshAll=function(){for(var contextId in contexts){contexts[contextId].refresh()}} +Context.findByElement=function(element){return contexts[element.waypointContextKey]} +window.onload=function(){if(oldWindowLoad){oldWindowLoad()} +Context.refreshAll()} +Waypoint.requestAnimationFrame=function(callback){var requestFn=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||requestAnimationFrameShim +requestFn.call(window,callback)} +Waypoint.Context=Context}());(function(){'use strict' +function byTriggerPoint(a,b){return a.triggerPoint-b.triggerPoint} +function byReverseTriggerPoint(a,b){return b.triggerPoint-a.triggerPoint} +var groups={vertical:{},horizontal:{}} +var Waypoint=window.Waypoint +function Group(options){this.name=options.name +this.axis=options.axis +this.id=this.name+'-'+this.axis +this.waypoints=[] +this.clearTriggerQueues() +groups[this.axis][this.name]=this} +Group.prototype.add=function(waypoint){this.waypoints.push(waypoint)} +Group.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}} +Group.prototype.flushTriggers=function(){for(var direction in this.triggerQueues){var waypoints=this.triggerQueues[direction] +var reverse=direction==='up'||direction==='left' +waypoints.sort(reverse?byReverseTriggerPoint:byTriggerPoint) +for(var i=0,end=waypoints.length;i<end;i+=1){var waypoint=waypoints[i] +if(waypoint.options.continuous||i===waypoints.length-1){waypoint.trigger([direction])}}} +this.clearTriggerQueues()} +Group.prototype.next=function(waypoint){this.waypoints.sort(byTriggerPoint) +var index=Waypoint.Adapter.inArray(waypoint,this.waypoints) +var isLast=index===this.waypoints.length-1 +return isLast?null:this.waypoints[index+1]} +Group.prototype.previous=function(waypoint){this.waypoints.sort(byTriggerPoint) +var index=Waypoint.Adapter.inArray(waypoint,this.waypoints) +return index?this.waypoints[index-1]:null} +Group.prototype.queueTrigger=function(waypoint,direction){this.triggerQueues[direction].push(waypoint)} +Group.prototype.remove=function(waypoint){var index=Waypoint.Adapter.inArray(waypoint,this.waypoints) +if(index>-1){this.waypoints.splice(index,1)}} +Group.prototype.first=function(){return this.waypoints[0]} +Group.prototype.last=function(){return this.waypoints[this.waypoints.length-1]} +Group.findOrCreate=function(options){return groups[options.axis][options.name]||new Group(options)} +Waypoint.Group=Group}());(function(){'use strict' +var $=window.jQuery +var Waypoint=window.Waypoint +function JQueryAdapter(element){this.$element=$(element)} +$.each(['innerHeight','innerWidth','off','offset','on','outerHeight','outerWidth','scrollLeft','scrollTop'],function(i,method){JQueryAdapter.prototype[method]=function(){var args=Array.prototype.slice.call(arguments) +return this.$element[method].apply(this.$element,args)}}) +$.each(['extend','inArray','isEmptyObject'],function(i,method){JQueryAdapter[method]=$[method]}) +Waypoint.adapters.push({name:'jquery',Adapter:JQueryAdapter}) +Waypoint.Adapter=JQueryAdapter}());(function(){'use strict' +var Waypoint=window.Waypoint +function createExtension(framework){return function(){var waypoints=[] +var overrides=arguments[0] +if(framework.isFunction(arguments[0])){overrides=framework.extend({},arguments[1]) +overrides.handler=arguments[0]} +this.each(function(){var options=framework.extend({},overrides,{element:this}) +if(typeof options.context==='string'){options.context=framework(this).closest(options.context)[0]} +waypoints.push(new Waypoint(options))}) +return waypoints}} +if(window.jQuery){window.jQuery.fn.waypoint=createExtension(window.jQuery)} +if(window.Zepto){window.Zepto.fn.waypoint=createExtension(window.Zepto)}}());(function(){'use strict' +var $=window.jQuery +var Waypoint=window.Waypoint +function Sticky(options){this.options=$.extend({},Waypoint.defaults,Sticky.defaults,options) +this.element=this.options.element +this.$element=$(this.element) +this.createWrapper() +this.createWaypoint()} +Sticky.prototype.createWaypoint=function(){var originalHandler=this.options.handler +this.waypoint=new Waypoint($.extend({},this.options,{element:this.wrapper,handler:$.proxy(function(direction){var shouldBeStuck=this.options.direction.indexOf(direction)>-1 +var wrapperHeight=shouldBeStuck?this.$element.outerHeight(!0):'' +this.$wrapper.height(wrapperHeight) +this.$element.toggleClass(this.options.stuckClass,shouldBeStuck) +if(originalHandler){originalHandler.call(this,direction)}},this)}))} +Sticky.prototype.createWrapper=function(){if(this.options.wrapper){this.$element.wrap(this.options.wrapper)} +this.$wrapper=this.$element.parent() +this.wrapper=this.$wrapper[0]} +Sticky.prototype.destroy=function(){if(this.$element.parent()[0]===this.wrapper){this.waypoint.destroy() +this.$element.removeClass(this.options.stuckClass) +if(this.options.wrapper){this.$element.unwrap()}}} +Sticky.defaults={wrapper:'<div class="sticky-wrapper" />',stuckClass:'stuck',direction:'down right'} +Waypoint.Sticky=Sticky}());(function(){'use strict' +var $=window.jQuery +var Waypoint=window.Waypoint +function Infinite(options){this.options=$.extend({},Infinite.defaults,options) +this.container=this.options.element +if(this.options.container!=='auto'){this.container=this.options.container} +this.$container=$(this.container) +this.$more=$(this.options.more) +if(this.$more.length){this.setupHandler() +this.waypoint=new Waypoint(this.options)}} +Infinite.prototype.setupHandler=function(){this.options.handler=$.proxy(function(){this.options.onBeforePageLoad() +this.destroy() +this.$container.addClass(this.options.loadingClass) +$.get($(this.options.more).attr('href'),$.proxy(function(data){var $data=$($.parseHTML(data)) +var $newMore=$data.find(this.options.more) +var $items=$data.find(this.options.items) +if(!$items.length){$items=$data.filter(this.options.items)} +this.$container.append($items) +this.$container.removeClass(this.options.loadingClass) +if(!$newMore.length){$newMore=$data.filter(this.options.more)} +if($newMore.length){this.$more.replaceWith($newMore) +this.$more=$newMore +this.waypoint=new Waypoint(this.options)} +else{this.$more.remove()} +this.options.onAfterPageLoad($items)},this))},this)} +Infinite.prototype.destroy=function(){if(this.waypoint){this.waypoint.destroy()}} +Infinite.defaults={container:'auto',items:'.infinite-item',more:'.infinite-more-link',offset:'bottom-in-view',loadingClass:'infinite-loading',onBeforePageLoad:$.noop,onAfterPageLoad:$.noop} +Waypoint.Infinite=Infinite}())});define('counter',['jquery','easing'],function($){var Counter,defaults,pluginName;pluginName="counter";defaults={autoStart:!0,duration:1500,countFrom:void 0,countTo:void 0,runOnce:!1,placeholder:void 0,easing:"easeOutQuad",onStart:function(){},onComplete:function(){},numberFormatter:function(number){return Math.round(number)}};Counter=(function(){function Counter(element,options){this.element=element;this.options=$.extend(!0,{},defaults,options);this.init()} +return Counter})();Counter.prototype.init=function(){var givenNumber;givenNumber=parseInt(this.element.innerHTML);if((givenNumber!=null)&&!isNaN(givenNumber)){if(this.options.countFrom<givenNumber){this.options.countTo=givenNumber}else{this.options.countFrom=givenNumber}} +if(this.options.countFrom===void 0){this.options.countFrom=0} +if(this.options.countTo===void 0){this.options.countTo=0} +if(this.options.placeholder!=null){this.element.innerHTML=this.options.placeholder} +if(this.options.autoStart){return this.start()}};Counter.prototype.start=function(){var self;if(this.options.runOnce&&this.runCount()>=1){return !1} +if(!this.running){this.running=!0;this.updateRunCount();this.options.onStart();self=this;return jQuery({count:this.options.countFrom}).animate({count:this.options.countTo},{duration:this.options.duration,easing:this.options.easing,step:function(){return self.setNumber(this.count)},complete:function(){self.setNumber(self.options.countTo);self.running=!1;return self.options.onComplete()}})}};Counter.prototype.updateRunCount=function(){return $(this.element).data("counterRunCount",(this.runCount()||0)+1)};Counter.prototype.runCount=function(){return $(this.element).data("counterRunCount")};Counter.prototype.setNumber=function(number){return this.element.innerHTML=this.options.numberFormatter(number)};return $.fn.counter=function(options){var self;self=this;return this.each(function(){var plugin;if(plugin=$(this).data("plugin_"+pluginName)){if(typeof options==="string"){switch(options){case "start":return plugin.start()}}}else{return $(this).data("plugin_"+pluginName,new Counter(this,options))}})}});define('easing',['jquery'],function($){$.easing.jswing=$.easing.swing;$.extend($.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4} +else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4} +else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4} +else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b}})});define('jqueryPlugin',['jquery'],function($){(function(){var initializing=!1;window.JQClass=function(){};JQClass.classes={};JQClass.extend=function extender(prop){var base=this.prototype;initializing=!0;var prototype=new this();initializing=!1;for(var name in prop){prototype[name]=typeof prop[name]=='function'&&typeof base[name]=='function'?(function(name,fn){return function(){var __super=this._super;this._super=function(args){return base[name].apply(this,args||[])};var ret=fn.apply(this,arguments);this._super=__super;return ret}})(name,prop[name]):prop[name]} +function JQClass(){if(!initializing&&this._init){this._init.apply(this,arguments)}} +JQClass.prototype=prototype;JQClass.prototype.constructor=JQClass;JQClass.extend=extender;return JQClass}})();JQClass.classes.JQPlugin=JQClass.extend({name:'plugin',defaultOptions:{},regionalOptions:{},_getters:[],_getMarker:function(){return 'is-'+this.name},_init:function(){$.extend(this.defaultOptions,(this.regionalOptions&&this.regionalOptions[''])||{});var jqName=camelCase(this.name);$[jqName]=this;$.fn[jqName]=function(options){var otherArgs=Array.prototype.slice.call(arguments,1);if($[jqName]._isNotChained(options,otherArgs)){return $[jqName][options].apply($[jqName],[this[0]].concat(otherArgs))} +return this.each(function(){if(typeof options==='string'){if(options[0]==='_'||!$[jqName][options]){throw 'Unknown method: '+options} +$[jqName][options].apply($[jqName],[this].concat(otherArgs))} +else{$[jqName]._attach(this,options)}})}},setDefaults:function(options){$.extend(this.defaultOptions,options||{})},_isNotChained:function(name,otherArgs){if(name==='option'&&(otherArgs.length===0||(otherArgs.length===1&&typeof otherArgs[0]==='string'))){return !0} +return $.inArray(name,this._getters)>-1},_attach:function(elem,options){elem=$(elem);if(elem.hasClass(this._getMarker())){return} +elem.addClass(this._getMarker());options=$.extend({},this.defaultOptions,this._getMetadata(elem),options||{});var inst=$.extend({name:this.name,elem:elem,options:options},this._instSettings(elem,options));elem.data(this.name,inst);this._postAttach(elem,inst);this.option(elem,options)},_instSettings:function(elem,options){return{}},_postAttach:function(elem,inst){},_getMetadata:function(elem){try{var data=elem.data(this.name.toLowerCase())||'';data=data.replace(/'/g,'"');data=data.replace(/([a-zA-Z0-9]+):/g,function(match,group,i){var count=data.substring(0,i).match(/"/g);return(!count||count.length%2===0?'"'+group+'":':group+':')});data=$.parseJSON('{'+data+'}');for(var name in data){var value=data[name];if(typeof value==='string'&&value.match(/^new Date\((.*)\)$/)){data[name]=eval(value)}} +return data} +catch(e){return{}}},_getInst:function(elem){return $(elem).data(this.name)||{}},option:function(elem,name,value){elem=$(elem);var inst=elem.data(this.name);if(!name||(typeof name==='string'&&value==null)){var options=(inst||{}).options;return(options&&name?options[name]:options)} +if(!elem.hasClass(this._getMarker())){return} +var options=name||{};if(typeof name==='string'){options={};options[name]=value} +this._optionsChanged(elem,inst,options);$.extend(inst.options,options)},_optionsChanged:function(elem,inst,options){},destroy:function(elem){elem=$(elem);if(!elem.hasClass(this._getMarker())){return} +this._preDestroy(elem,this._getInst(elem));elem.removeData(this.name).removeClass(this._getMarker())},_preDestroy:function(elem,inst){}});function camelCase(name){return name.replace(/-([a-z])/g,function(match,group){return group.toUpperCase()})} +$.JQPlugin={createPlugin:function(superClass,overrides){if(typeof superClass==='object'){overrides=superClass;superClass='JQPlugin'} +superClass=camelCase(superClass);var className=camelCase(overrides.name);JQClass.classes[className]=JQClass.classes[superClass].extend(overrides);new JQClass.classes[className]()}}});define('jqueryCountdown',['jquery','jqueryPlugin'],function($){var pluginName='countdown';var Y=0;var O=1;var W=2;var D=3;var H=4;var M=5;var S=6;$.JQPlugin.createPlugin({name:pluginName,defaultOptions:{until:null,since:null,timezone:null,serverSync:null,format:'dHMS',layout:'',compact:!1,padZeroes:!1,significant:0,description:'',expiryUrl:'',expiryText:'',alwaysExpire:!1,onExpiry:null,onTick:null,tickInterval:1},regionalOptions:{'':{labels:['Years','Months','Weeks','Days','Hours','Minutes','Seconds'],labels1:['Year','Month','Week','Day','Hour','Minute','Second'],compactLabels:['y','m','w','d'],whichLabels:null,digits:['0','1','2','3','4','5','6','7','8','9'],timeSeparator:':',isRTL:!1}},_getters:['getTimes'],_rtlClass:pluginName+'-rtl',_sectionClass:pluginName+'-section',_amountClass:pluginName+'-amount',_periodClass:pluginName+'-period',_rowClass:pluginName+'-row',_holdingClass:pluginName+'-holding',_showClass:pluginName+'-show',_descrClass:pluginName+'-descr',_timerElems:[],_init:function(){var self=this;this._super();this._serverSyncs=[];var now=(typeof Date.now=='function'?Date.now:function(){return new Date().getTime()});var perfAvail=(window.performance&&typeof window.performance.now=='function');function timerCallBack(timestamp){var drawStart=(timestamp<1e12?(perfAvail?(performance.now()+performance.timing.navigationStart):now()):timestamp||now());if(drawStart-animationStartTime>=1000){self._updateElems();animationStartTime=drawStart} +requestAnimationFrame(timerCallBack)} +var requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||null;var animationStartTime=0;if(!requestAnimationFrame||$.noRequestAnimationFrame){$.noRequestAnimationFrame=null;setInterval(function(){self._updateElems()},980)} +else{animationStartTime=window.animationStartTime||window.webkitAnimationStartTime||window.mozAnimationStartTime||window.oAnimationStartTime||window.msAnimationStartTime||now();requestAnimationFrame(timerCallBack)}},UTCDate:function(tz,year,month,day,hours,mins,secs,ms){if(typeof year=='object'&&year.constructor==Date){ms=year.getMilliseconds();secs=year.getSeconds();mins=year.getMinutes();hours=year.getHours();day=year.getDate();month=year.getMonth();year=year.getFullYear()} +var d=new Date();d.setUTCFullYear(year);d.setUTCDate(1);d.setUTCMonth(month||0);d.setUTCDate(day||1);d.setUTCHours(hours||0);d.setUTCMinutes((mins||0)-(Math.abs(tz)<30?tz*60:tz));d.setUTCSeconds(secs||0);d.setUTCMilliseconds(ms||0);return d},periodsToSeconds:function(periods){return periods[0]*31557600+periods[1]*2629800+periods[2]*604800+periods[3]*86400+periods[4]*3600+periods[5]*60+periods[6]},_instSettings:function(elem,options){return{_periods:[0,0,0,0,0,0,0]}},_addElem:function(elem){if(!this._hasElem(elem)){this._timerElems.push(elem)}},_hasElem:function(elem){return($.inArray(elem,this._timerElems)>-1)},_removeElem:function(elem){this._timerElems=$.map(this._timerElems,function(value){return(value==elem?null:value)})},_updateElems:function(){for(var i=this._timerElems.length-1;i>=0;i--){this._updateCountdown(this._timerElems[i])}},_optionsChanged:function(elem,inst,options){if(options.layout){options.layout=options.layout.replace(/</g,'<').replace(/>/g,'>')} +this._resetExtraLabels(inst.options,options);var timezoneChanged=(inst.options.timezone!=options.timezone);$.extend(inst.options,options);this._adjustSettings(elem,inst,options.until!=null||options.since!=null||timezoneChanged);var now=new Date();if((inst._since&&inst._since<now)||(inst._until&&inst._until>now)){this._addElem(elem[0])} +this._updateCountdown(elem,inst)},_updateCountdown:function(elem,inst){elem=elem.jquery?elem:$(elem);inst=inst||this._getInst(elem);if(!inst){return} +elem.html(this._generateHTML(inst)).toggleClass(this._rtlClass,inst.options.isRTL);if($.isFunction(inst.options.onTick)){var periods=inst._hold!='lap'?inst._periods:this._calculatePeriods(inst,inst._show,inst.options.significant,new Date());if(inst.options.tickInterval==1||this.periodsToSeconds(periods)%inst.options.tickInterval==0){inst.options.onTick.apply(elem[0],[periods])}} +var expired=inst._hold!='pause'&&(inst._since?inst._now.getTime()<inst._since.getTime():inst._now.getTime()>=inst._until.getTime());if(expired&&!inst._expiring){inst._expiring=!0;if(this._hasElem(elem[0])||inst.options.alwaysExpire){this._removeElem(elem[0]);if($.isFunction(inst.options.onExpiry)){inst.options.onExpiry.apply(elem[0],[])} +if(inst.options.expiryText){var layout=inst.options.layout;inst.options.layout=inst.options.expiryText;this._updateCountdown(elem[0],inst);inst.options.layout=layout} +if(inst.options.expiryUrl){window.location=inst.options.expiryUrl}} +inst._expiring=!1} +else if(inst._hold=='pause'){this._removeElem(elem[0])}},_resetExtraLabels:function(base,options){for(var n in options){if(n.match(/[Ll]abels[02-9]|compactLabels1/)){base[n]=options[n]}} +for(var n in base){if(n.match(/[Ll]abels[02-9]|compactLabels1/)&&typeof options[n]==='undefined'){base[n]=null}}},_adjustSettings:function(elem,inst,recalc){var now;var serverOffset=0;var serverEntry=null;for(var i=0;i<this._serverSyncs.length;i++){if(this._serverSyncs[i][0]==inst.options.serverSync){serverEntry=this._serverSyncs[i][1];break}} +if(serverEntry!=null){serverOffset=(inst.options.serverSync?serverEntry:0);now=new Date()} +else{var serverResult=($.isFunction(inst.options.serverSync)?inst.options.serverSync.apply(elem[0],[]):null);now=new Date();serverOffset=(serverResult?now.getTime()-serverResult.getTime():0);this._serverSyncs.push([inst.options.serverSync,serverOffset])} +var timezone=inst.options.timezone;timezone=(timezone==null?-now.getTimezoneOffset():timezone);if(recalc||(!recalc&&inst._until==null&&inst._since==null)){inst._since=inst.options.since;if(inst._since!=null){inst._since=this.UTCDate(timezone,this._determineTime(inst._since,null));if(inst._since&&serverOffset){inst._since.setMilliseconds(inst._since.getMilliseconds()+serverOffset)}} +inst._until=this.UTCDate(timezone,this._determineTime(inst.options.until,now));if(serverOffset){inst._until.setMilliseconds(inst._until.getMilliseconds()+serverOffset)}} +inst._show=this._determineShow(inst)},_preDestroy:function(elem,inst){this._removeElem(elem[0]);elem.empty()},pause:function(elem){this._hold(elem,'pause')},lap:function(elem){this._hold(elem,'lap')},resume:function(elem){this._hold(elem,null)},toggle:function(elem){var inst=$.data(elem,this.name)||{};this[!inst._hold?'pause':'resume'](elem)},toggleLap:function(elem){var inst=$.data(elem,this.name)||{};this[!inst._hold?'lap':'resume'](elem)},_hold:function(elem,hold){var inst=$.data(elem,this.name);if(inst){if(inst._hold=='pause'&&!hold){inst._periods=inst._savePeriods;var sign=(inst._since?'-':'+');inst[inst._since?'_since':'_until']=this._determineTime(sign+inst._periods[0]+'y'+sign+inst._periods[1]+'o'+sign+inst._periods[2]+'w'+sign+inst._periods[3]+'d'+sign+inst._periods[4]+'h'+sign+inst._periods[5]+'m'+sign+inst._periods[6]+'s');this._addElem(elem)} +inst._hold=hold;inst._savePeriods=(hold=='pause'?inst._periods:null);$.data(elem,this.name,inst);this._updateCountdown(elem,inst)}},getTimes:function(elem){var inst=$.data(elem,this.name);return(!inst?null:(inst._hold=='pause'?inst._savePeriods:(!inst._hold?inst._periods:this._calculatePeriods(inst,inst._show,inst.options.significant,new Date()))))},_determineTime:function(setting,defaultTime){var self=this;var offsetNumeric=function(offset){var time=new Date();time.setTime(time.getTime()+offset*1000);return time};var offsetString=function(offset){offset=offset.toLowerCase();var time=new Date();var year=time.getFullYear();var month=time.getMonth();var day=time.getDate();var hour=time.getHours();var minute=time.getMinutes();var second=time.getSeconds();var pattern=/([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||'s'){case 's':second+=parseInt(matches[1],10);break;case 'm':minute+=parseInt(matches[1],10);break;case 'h':hour+=parseInt(matches[1],10);break;case 'd':day+=parseInt(matches[1],10);break;case 'w':day+=parseInt(matches[1],10)*7;break;case 'o':month+=parseInt(matches[1],10);day=Math.min(day,self._getDaysInMonth(year,month));break;case 'y':year+=parseInt(matches[1],10);day=Math.min(day,self._getDaysInMonth(year,month));break} +matches=pattern.exec(offset)} +return new Date(year,month,day,hour,minute,second,0)};var time=(setting==null?defaultTime:(typeof setting=='string'?offsetString(setting):(typeof setting=='number'?offsetNumeric(setting):setting)));if(time)time.setMilliseconds(0);return time},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_normalLabels:function(num){return num},_generateHTML:function(inst){var self=this;inst._periods=(inst._hold?inst._periods:this._calculatePeriods(inst,inst._show,inst.options.significant,new Date()));var shownNonZero=!1;var showCount=0;var sigCount=inst.options.significant;var show=$.extend({},inst._show);for(var period=Y;period<=S;period++){shownNonZero|=(inst._show[period]=='?'&&inst._periods[period]>0);show[period]=(inst._show[period]=='?'&&!shownNonZero?null:inst._show[period]);showCount+=(show[period]?1:0);sigCount-=(inst._periods[period]>0?1:0)} +var showSignificant=[!1,!1,!1,!1,!1,!1,!1];for(var period=S;period>=Y;period--){if(inst._show[period]){if(inst._periods[period]){showSignificant[period]=!0} +else{showSignificant[period]=sigCount>0;sigCount--}}} +var labels=(inst.options.compact?inst.options.compactLabels:inst.options.labels);var whichLabels=inst.options.whichLabels||this._normalLabels;var showCompact=function(period){var labelsNum=inst.options['compactLabels'+whichLabels(inst._periods[period])];return(show[period]?self._translateDigits(inst,inst._periods[period])+(labelsNum?labelsNum[period]:labels[period])+' ':'')};var minDigits=(inst.options.padZeroes?2:1);var showFull=function(period){var labelsNum=inst.options['labels'+whichLabels(inst._periods[period])];return((!inst.options.significant&&show[period])||(inst.options.significant&&showSignificant[period])?'<span class="'+self._sectionClass+'">'+'<span class="'+self._amountClass+'">'+self._minDigits(inst,inst._periods[period],minDigits)+'</span>'+'<span class="'+self._periodClass+'">'+(labelsNum?labelsNum[period]:labels[period])+'</span></span>':'')};return(inst.options.layout?this._buildLayout(inst,show,inst.options.layout,inst.options.compact,inst.options.significant,showSignificant):((inst.options.compact?'<span class="'+this._rowClass+' '+this._amountClass+(inst._hold?' '+this._holdingClass:'')+'">'+showCompact(Y)+showCompact(O)+showCompact(W)+showCompact(D)+(show[H]?this._minDigits(inst,inst._periods[H],2):'')+(show[M]?(show[H]?inst.options.timeSeparator:'')+this._minDigits(inst,inst._periods[M],2):'')+(show[S]?(show[H]||show[M]?inst.options.timeSeparator:'')+this._minDigits(inst,inst._periods[S],2):''):'<span class="'+this._rowClass+' '+this._showClass+(inst.options.significant||showCount)+(inst._hold?' '+this._holdingClass:'')+'">'+showFull(Y)+showFull(O)+showFull(W)+showFull(D)+showFull(H)+showFull(M)+showFull(S))+'</span>'+(inst.options.description?'<span class="'+this._rowClass+' '+this._descrClass+'">'+inst.options.description+'</span>':'')))},_buildLayout:function(inst,show,layout,compact,significant,showSignificant){var labels=inst.options[compact?'compactLabels':'labels'];var whichLabels=inst.options.whichLabels||this._normalLabels;var labelFor=function(index){return(inst.options[(compact?'compactLabels':'labels')+whichLabels(inst._periods[index])]||labels)[index]};var digit=function(value,position){return inst.options.digits[Math.floor(value/position)%10]};var subs={desc:inst.options.description,sep:inst.options.timeSeparator,yl:labelFor(Y),yn:this._minDigits(inst,inst._periods[Y],1),ynn:this._minDigits(inst,inst._periods[Y],2),ynnn:this._minDigits(inst,inst._periods[Y],3),y1:digit(inst._periods[Y],1),y10:digit(inst._periods[Y],10),y100:digit(inst._periods[Y],100),y1000:digit(inst._periods[Y],1000),ol:labelFor(O),on:this._minDigits(inst,inst._periods[O],1),onn:this._minDigits(inst,inst._periods[O],2),onnn:this._minDigits(inst,inst._periods[O],3),o1:digit(inst._periods[O],1),o10:digit(inst._periods[O],10),o100:digit(inst._periods[O],100),o1000:digit(inst._periods[O],1000),wl:labelFor(W),wn:this._minDigits(inst,inst._periods[W],1),wnn:this._minDigits(inst,inst._periods[W],2),wnnn:this._minDigits(inst,inst._periods[W],3),w1:digit(inst._periods[W],1),w10:digit(inst._periods[W],10),w100:digit(inst._periods[W],100),w1000:digit(inst._periods[W],1000),dl:labelFor(D),dn:this._minDigits(inst,inst._periods[D],1),dnn:this._minDigits(inst,inst._periods[D],2),dnnn:this._minDigits(inst,inst._periods[D],3),d1:digit(inst._periods[D],1),d10:digit(inst._periods[D],10),d100:digit(inst._periods[D],100),d1000:digit(inst._periods[D],1000),hl:labelFor(H),hn:this._minDigits(inst,inst._periods[H],1),hnn:this._minDigits(inst,inst._periods[H],2),hnnn:this._minDigits(inst,inst._periods[H],3),h1:digit(inst._periods[H],1),h10:digit(inst._periods[H],10),h100:digit(inst._periods[H],100),h1000:digit(inst._periods[H],1000),ml:labelFor(M),mn:this._minDigits(inst,inst._periods[M],1),mnn:this._minDigits(inst,inst._periods[M],2),mnnn:this._minDigits(inst,inst._periods[M],3),m1:digit(inst._periods[M],1),m10:digit(inst._periods[M],10),m100:digit(inst._periods[M],100),m1000:digit(inst._periods[M],1000),sl:labelFor(S),sn:this._minDigits(inst,inst._periods[S],1),snn:this._minDigits(inst,inst._periods[S],2),snnn:this._minDigits(inst,inst._periods[S],3),s1:digit(inst._periods[S],1),s10:digit(inst._periods[S],10),s100:digit(inst._periods[S],100),s1000:digit(inst._periods[S],1000)};var html=layout;for(var i=Y;i<=S;i++){var period='yowdhms'.charAt(i);var re=new RegExp('\\{'+period+'<\\}([\\s\\S]*)\\{'+period+'>\\}','g');html=html.replace(re,((!significant&&show[i])||(significant&&showSignificant[i])?'$1':''))} +$.each(subs,function(n,v){var re=new RegExp('\\{'+n+'\\}','g');html=html.replace(re,v)});return html},_minDigits:function(inst,value,len){value=''+value;if(value.length>=len){return this._translateDigits(inst,value)} +value='0000000000'+value;return this._translateDigits(inst,value.substr(value.length-len))},_translateDigits:function(inst,value){return(''+value).replace(/[0-9]/g,function(digit){return inst.options.digits[digit]})},_determineShow:function(inst){var format=inst.options.format;var show=[];show[Y]=(format.match('y')?'?':(format.match('Y')?'!':null));show[O]=(format.match('o')?'?':(format.match('O')?'!':null));show[W]=(format.match('w')?'?':(format.match('W')?'!':null));show[D]=(format.match('d')?'?':(format.match('D')?'!':null));show[H]=(format.match('h')?'?':(format.match('H')?'!':null));show[M]=(format.match('m')?'?':(format.match('M')?'!':null));show[S]=(format.match('s')?'?':(format.match('S')?'!':null));return show},_calculatePeriods:function(inst,show,significant,now){inst._now=now;inst._now.setMilliseconds(0);var until=new Date(inst._now.getTime());if(inst._since){if(now.getTime()<inst._since.getTime()){inst._now=now=until} +else{now=inst._since}} +else{until.setTime(inst._until.getTime());if(now.getTime()>inst._until.getTime()){inst._now=now=until}} +var periods=[0,0,0,0,0,0,0];if(show[Y]||show[O]){var lastNow=this._getDaysInMonth(now.getFullYear(),now.getMonth());var lastUntil=this._getDaysInMonth(until.getFullYear(),until.getMonth());var sameDay=(until.getDate()==now.getDate()||(until.getDate()>=Math.min(lastNow,lastUntil)&&now.getDate()>=Math.min(lastNow,lastUntil)));var getSecs=function(date){return(date.getHours()*60+date.getMinutes())*60+date.getSeconds()};var months=Math.max(0,(until.getFullYear()-now.getFullYear())*12+until.getMonth()-now.getMonth()+((until.getDate()<now.getDate()&&!sameDay)||(sameDay&&getSecs(until)<getSecs(now))?-1:0));periods[Y]=(show[Y]?Math.floor(months/12):0);periods[O]=(show[O]?months-periods[Y]*12:0);now=new Date(now.getTime());var wasLastDay=(now.getDate()==lastNow);var lastDay=this._getDaysInMonth(now.getFullYear()+periods[Y],now.getMonth()+periods[O]);if(now.getDate()>lastDay){now.setDate(lastDay)} +now.setFullYear(now.getFullYear()+periods[Y]);now.setMonth(now.getMonth()+periods[O]);if(wasLastDay){now.setDate(lastDay)}} +var diff=Math.floor((until.getTime()-now.getTime())/1000);var extractPeriod=function(period,numSecs){periods[period]=(show[period]?Math.floor(diff/numSecs):0);diff-=periods[period]*numSecs};extractPeriod(W,604800);extractPeriod(D,86400);extractPeriod(H,3600);extractPeriod(M,60);extractPeriod(S,1);if(diff>0&&!inst._since){var multiplier=[1,12,4.3482,7,24,60,60];var lastShown=S;var max=1;for(var period=S;period>=Y;period--){if(show[period]){if(periods[lastShown]>=max){periods[lastShown]=0;diff=1} +if(diff>0){periods[period]++;diff=0;lastShown=period;max=1}} +max*=multiplier[period]}} +if(significant){for(var period=Y;period<=S;period++){if(significant&&periods[period]){significant--} +else if(!significant){periods[period]=0}}} +return periods}})});(function(factory){if(typeof exports==='object'){module.exports=factory(require('jquery'))}else if(typeof define==='function'&&define.amd){define('jqueryShorten',['jquery'],factory)}else{factory(jQuery)}}(function($){$.fn.shorten=function(settings){"use strict";var config={showChars:100,minHideChars:10,ellipsesText:"...",moreText:"more",lessText:"less",onLess:function(){},onMore:function(){},errMsg:null,force:!1};if(settings){$.extend(config,settings)} +if($(this).data('jquery.shorten')&&!config.force){return !1} +$(this).data('jquery.shorten',!0);return this.each(function(){var $this=$(this);var content=$this.html();var contentlen=$this.text().length;if(contentlen>config.showChars+config.minHideChars){var c=content.substr(0,config.showChars);if(c.indexOf('<')>=0){var inTag=!1;var bag='';var countChars=0;var openTags=[];var tagName=null;for(var i=0,r=0;r<=config.showChars;i++){if(content[i]=='<'&&!inTag){inTag=!0;tagName=content.substring(i+1,content.indexOf('>',i));if(tagName[0]=='/'){if(tagName!='/'+openTags[0]){config.errMsg='ERROR en HTML: the top of the stack should be the tag that closes'}else{openTags.shift()}}else{if(tagName.toLowerCase()!='br'){openTags.unshift(tagName)}}} +if(inTag&&content[i]=='>'){inTag=!1} +if(inTag){bag+=content.charAt(i)} +else{r++;if(countChars<=config.showChars){bag+=content.charAt(i);countChars++}else{if(openTags.length>0){for(j=0;j<openTags.length;j++){bag+='</'+openTags[j]+'>'} +break}}}} +c=$('<div/>').html(bag+'<span class="ellip">'+config.ellipsesText+'</span>').html()}else{c+=config.ellipsesText} +var html='<div class="shortcontent">'+c+'<span><a href="javascript://nop/" class="morelink">'+config.moreText+'</a></span></div><div class="allcontent">'+content+'</div>';$this.html(html);$this.find(".allcontent").hide();$this.find(".morelink").click(function(e){e.preventDefault();$this.find(".shortcontent").hide();$this.find(".allcontent").show()})}})}}));define('lazySizes',['jquery'],function($){(function(window,factory){var lazySizes=factory(window,window.document);window.lazySizes=lazySizes;if(typeof module=='object'&&module.exports){module.exports=lazySizes}}(window,function l(window,document){'use strict';if(!document.getElementsByClassName){return} +var lazySizesConfig;var docElem=document.documentElement;var Date=window.Date;var supportPicture=window.HTMLPictureElement;var _addEventListener='addEventListener';var _getAttribute='getAttribute';var addEventListener=window[_addEventListener];var setTimeout=window.setTimeout;var requestAnimationFrame=window.requestAnimationFrame||setTimeout;var requestIdleCallback=window.requestIdleCallback;var regPicture=/^picture$/i;var loadEvents=['load','error','lazyincluded','_lazyloaded'];var regClassCache={};var forEach=Array.prototype.forEach;var hasClass=function(ele,cls){if(!regClassCache[cls]){regClassCache[cls]=new RegExp('(\\s|^)'+cls+'(\\s|$)')} +return regClassCache[cls].test(ele[_getAttribute]('class')||'')&®ClassCache[cls]};var addClass=function(ele,cls){if(!hasClass(ele,cls)){ele.setAttribute('class',(ele[_getAttribute]('class')||'').trim()+' '+cls)}};var removeClass=function(ele,cls){var reg;if((reg=hasClass(ele,cls))){ele.setAttribute('class',(ele[_getAttribute]('class')||'').replace(reg,' '))}};var addRemoveLoadEvents=function(dom,fn,add){var action=add?_addEventListener:'removeEventListener';if(add){addRemoveLoadEvents(dom,fn)} +loadEvents.forEach(function(evt){dom[action](evt,fn)})};var triggerEvent=function(elem,name,detail,noBubbles,noCancelable){var event=document.createEvent('CustomEvent');event.initCustomEvent(name,!noBubbles,!noCancelable,detail||{});elem.dispatchEvent(event);return event};var updatePolyfill=function(el,full){var polyfill;if(!supportPicture&&(polyfill=(window.picturefill||lazySizesConfig.pf))){polyfill({reevaluate:!0,elements:[el]})}else if(full&&full.src){el.src=full.src}};var getCSS=function(elem,style){return(getComputedStyle(elem,null)||{})[style]};var getWidth=function(elem,parent,width){width=width||elem.offsetWidth;while(width<lazySizesConfig.minSize&&parent&&!elem._lazysizesWidth){width=parent.offsetWidth;parent=parent.parentNode} +return width};var rAF=(function(){var running,waiting;var firstFns=[];var secondFns=[];var fns=firstFns;var run=function(){var runFns=fns;fns=firstFns.length?secondFns:firstFns;running=!0;waiting=!1;while(runFns.length){runFns.shift()()} +running=!1};var rafBatch=function(fn,queue){if(running&&!queue){fn.apply(this,arguments)}else{fns.push(fn);if(!waiting){waiting=!0;(document.hidden?setTimeout:requestAnimationFrame)(run)}}};rafBatch._lsFlush=run;return rafBatch})();var rAFIt=function(fn,simple){return simple?function(){rAF(fn)}:function(){var that=this;var args=arguments;rAF(function(){fn.apply(that,args)})}};var throttle=function(fn){var running;var lastTime=0;var gDelay=125;var RIC_DEFAULT_TIMEOUT=666;var rICTimeout=RIC_DEFAULT_TIMEOUT;var run=function(){running=!1;lastTime=Date.now();fn()};var idleCallback=requestIdleCallback?function(){requestIdleCallback(run,{timeout:rICTimeout});if(rICTimeout!==RIC_DEFAULT_TIMEOUT){rICTimeout=RIC_DEFAULT_TIMEOUT}}:rAFIt(function(){setTimeout(run)},!0);return function(isPriority){var delay;if((isPriority=isPriority===!0)){rICTimeout=44} +if(running){return} +running=!0;delay=gDelay-(Date.now()-lastTime);if(delay<0){delay=0} +if(isPriority||(delay<9&&requestIdleCallback)){idleCallback()}else{setTimeout(idleCallback,delay)}}};var debounce=function(func){var timeout,timestamp;var wait=99;var run=function(){timeout=null;func()};var later=function(){var last=Date.now()-timestamp;if(last<wait){setTimeout(later,wait-last)}else{(requestIdleCallback||run)(run)}};return function(){timestamp=Date.now();if(!timeout){timeout=setTimeout(later,wait)}}};var loader=(function(){var lazyloadElems,preloadElems,isCompleted,resetPreloadingTimer,loadMode,started;var eLvW,elvH,eLtop,eLleft,eLright,eLbottom;var defaultExpand,preloadExpand,hFac;var regImg=/^img$/i;var regIframe=/^iframe$/i;var supportScroll=('onscroll' in window)&&!(/glebot/.test(navigator.userAgent));var shrinkExpand=0;var currentExpand=0;var isLoading=0;var lowRuns=-1;var resetPreloading=function(e){isLoading--;if(e&&e.target){addRemoveLoadEvents(e.target,resetPreloading)} +if(!e||isLoading<0||!e.target){isLoading=0}};var isNestedVisible=function(elem,elemExpand){var outerRect;var parent=elem;var visible=getCSS(document.body,'visibility')=='hidden'||getCSS(elem,'visibility')!='hidden';eLtop-=elemExpand;eLbottom+=elemExpand;eLleft-=elemExpand;eLright+=elemExpand;while(visible&&(parent=parent.offsetParent)&&parent!=document.body&&parent!=docElem){visible=((getCSS(parent,'opacity')||1)>0);if(visible&&getCSS(parent,'overflow')!='visible'){outerRect=parent.getBoundingClientRect();visible=eLright>outerRect.left&&eLleft<outerRect.right&&eLbottom>outerRect.top-1&&eLtop<outerRect.bottom+1}} +return visible};var checkElements=function(){var eLlen,i,rect,autoLoadElem,loadedSomething,elemExpand,elemNegativeExpand,elemExpandVal,beforeExpandVal;if((loadMode=lazySizesConfig.loadMode)&&isLoading<8&&(eLlen=lazyloadElems.length)){i=0;lowRuns++;if(preloadExpand==null){if(!('expand' in lazySizesConfig)){lazySizesConfig.expand=docElem.clientHeight>500&&docElem.clientWidth>500?500:370} +defaultExpand=lazySizesConfig.expand;preloadExpand=defaultExpand*lazySizesConfig.expFactor} +if(currentExpand<preloadExpand&&isLoading<1&&lowRuns>2&&loadMode>2&&!document.hidden){currentExpand=preloadExpand;lowRuns=0}else if(loadMode>1&&lowRuns>1&&isLoading<6){currentExpand=defaultExpand}else{currentExpand=shrinkExpand} +for(;i<eLlen;i++){if(!lazyloadElems[i]||lazyloadElems[i]._lazyRace){continue} +if(!supportScroll){unveilElement(lazyloadElems[i]);continue} +if(!(elemExpandVal=lazyloadElems[i][_getAttribute]('data-expand'))||!(elemExpand=elemExpandVal*1)){elemExpand=currentExpand} +if(beforeExpandVal!==elemExpand){eLvW=innerWidth+(elemExpand*hFac);elvH=innerHeight+elemExpand;elemNegativeExpand=elemExpand*-1;beforeExpandVal=elemExpand} +rect=lazyloadElems[i].getBoundingClientRect();if((eLbottom=rect.bottom)>=elemNegativeExpand&&(eLtop=rect.top)<=elvH&&(eLright=rect.right)>=elemNegativeExpand*hFac&&(eLleft=rect.left)<=eLvW&&(eLbottom||eLright||eLleft||eLtop)&&((isCompleted&&isLoading<3&&!elemExpandVal&&(loadMode<3||lowRuns<4))||isNestedVisible(lazyloadElems[i],elemExpand))){unveilElement(lazyloadElems[i]);loadedSomething=!0;if(isLoading>9){break}}else if(!loadedSomething&&isCompleted&&!autoLoadElem&&isLoading<4&&lowRuns<4&&loadMode>2&&(preloadElems[0]||lazySizesConfig.preloadAfterLoad)&&(preloadElems[0]||(!elemExpandVal&&((eLbottom||eLright||eLleft||eLtop)||lazyloadElems[i][_getAttribute](lazySizesConfig.sizesAttr)!='auto')))){autoLoadElem=preloadElems[0]||lazyloadElems[i]}} +if(autoLoadElem&&!loadedSomething){unveilElement(autoLoadElem)}}};var throttledCheckElements=throttle(checkElements);var switchLoadingClass=function(e){addClass(e.target,lazySizesConfig.loadedClass);removeClass(e.target,lazySizesConfig.loadingClass);addRemoveLoadEvents(e.target,rafSwitchLoadingClass)};var rafedSwitchLoadingClass=rAFIt(switchLoadingClass);var rafSwitchLoadingClass=function(e){rafedSwitchLoadingClass({target:e.target})};var changeIframeSrc=function(elem,src){try{elem.contentWindow.location.replace(src)}catch(e){elem.src=src}};var handleSources=function(source){var customMedia,parent;var sourceSrcset=source[_getAttribute](lazySizesConfig.srcsetAttr);if((customMedia=lazySizesConfig.customMedia[source[_getAttribute]('data-media')||source[_getAttribute]('media')])){source.setAttribute('media',customMedia)} +if(sourceSrcset){source.setAttribute('srcset',sourceSrcset)} +if(customMedia){parent=source.parentNode;parent.insertBefore(source.cloneNode(),source);parent.removeChild(source)}};var lazyUnveil=rAFIt(function(elem,detail,isAuto,sizes,isImg){var src,srcset,parent,isPicture,event,firesLoad;if(!(event=triggerEvent(elem,'lazybeforeunveil',detail)).defaultPrevented){if(sizes){if(isAuto){addClass(elem,lazySizesConfig.autosizesClass)}else{elem.setAttribute('sizes',sizes)}} +srcset=elem[_getAttribute](lazySizesConfig.srcsetAttr);src=elem[_getAttribute](lazySizesConfig.srcAttr);if(isImg){parent=elem.parentNode;isPicture=parent&®Picture.test(parent.nodeName||'')} +firesLoad=detail.firesLoad||(('src' in elem)&&(srcset||src||isPicture));event={target:elem};if(firesLoad){addRemoveLoadEvents(elem,resetPreloading,!0);clearTimeout(resetPreloadingTimer);resetPreloadingTimer=setTimeout(resetPreloading,2500);addClass(elem,lazySizesConfig.loadingClass);addRemoveLoadEvents(elem,rafSwitchLoadingClass,!0)} +if(isPicture){forEach.call(parent.getElementsByTagName('source'),handleSources)} +if(srcset){elem.setAttribute('srcset',srcset)}else if(src&&!isPicture){if(regIframe.test(elem.nodeName)){changeIframeSrc(elem,src)}else{elem.src=src}} +if(srcset||isPicture){updatePolyfill(elem,{src:src})}} +if(elem._lazyRace){delete elem._lazyRace} +removeClass(elem,lazySizesConfig.lazyClass);rAF(function(){if(!firesLoad||(elem.complete&&elem.naturalWidth>1)){if(firesLoad){resetPreloading(event)}else{isLoading--} +switchLoadingClass(event)}},!0)});var unveilElement=function(elem){var detail;var isImg=regImg.test(elem.nodeName);var sizes=isImg&&(elem[_getAttribute](lazySizesConfig.sizesAttr)||elem[_getAttribute]('sizes'));var isAuto=sizes=='auto';if((isAuto||!isCompleted)&&isImg&&(elem.src||elem.srcset)&&!elem.complete&&!hasClass(elem,lazySizesConfig.errorClass)){return} +detail=triggerEvent(elem,'lazyunveilread').detail;if(isAuto){autoSizer.updateElem(elem,!0,elem.offsetWidth)} +elem._lazyRace=!0;isLoading++;lazyUnveil(elem,detail,isAuto,sizes,isImg)};var onload=function(){if(isCompleted){return} +if(Date.now()-started<999){setTimeout(onload,999);return} +var afterScroll=debounce(function(){lazySizesConfig.loadMode=3;throttledCheckElements()});isCompleted=!0;lazySizesConfig.loadMode=3;throttledCheckElements();addEventListener('scroll',function(){if(lazySizesConfig.loadMode==3){lazySizesConfig.loadMode=2} +afterScroll()},!0)};return{_:function(){started=Date.now();lazyloadElems=document.getElementsByClassName(lazySizesConfig.lazyClass);preloadElems=document.getElementsByClassName(lazySizesConfig.lazyClass+' '+lazySizesConfig.preloadClass);hFac=lazySizesConfig.hFac;addEventListener('scroll',throttledCheckElements,!0);addEventListener('resize',throttledCheckElements,!0);if(window.MutationObserver){new MutationObserver(throttledCheckElements).observe(docElem,{childList:!0,subtree:!0,attributes:!0})}else{docElem[_addEventListener]('DOMNodeInserted',throttledCheckElements,!0);docElem[_addEventListener]('DOMAttrModified',throttledCheckElements,!0);setInterval(throttledCheckElements,999)} +addEventListener('hashchange',throttledCheckElements,!0);['focus','mouseover','click','load','transitionend','animationend','webkitAnimationEnd'].forEach(function(name){document[_addEventListener](name,throttledCheckElements,!0)});if((/d$|^c/.test(document.readyState))){onload()}else{addEventListener('load',onload);document[_addEventListener]('DOMContentLoaded',throttledCheckElements);setTimeout(onload,20000)} +if(lazyloadElems.length){checkElements();rAF._lsFlush()}else{throttledCheckElements()}},checkElems:throttledCheckElements,unveil:unveilElement}})();var autoSizer=(function(){var autosizesElems;var sizeElement=rAFIt(function(elem,parent,event,width){var sources,i,len;elem._lazysizesWidth=width;width+='px';elem.setAttribute('sizes',width);if(regPicture.test(parent.nodeName||'')){sources=parent.getElementsByTagName('source');for(i=0,len=sources.length;i<len;i++){sources[i].setAttribute('sizes',width)}} +if(!event.detail.dataAttr){updatePolyfill(elem,event.detail)}});var getSizeElement=function(elem,dataAttr,width){var event;var parent=elem.parentNode;if(parent){width=getWidth(elem,parent,width);event=triggerEvent(elem,'lazybeforesizes',{width:width,dataAttr:!!dataAttr});if(!event.defaultPrevented){width=event.detail.width;if(width&&width!==elem._lazysizesWidth){sizeElement(elem,parent,event,width)}}}};var updateElementsSizes=function(){var i;var len=autosizesElems.length;if(len){i=0;for(;i<len;i++){getSizeElement(autosizesElems[i])}}};var debouncedUpdateElementsSizes=debounce(updateElementsSizes);return{_:function(){autosizesElems=document.getElementsByClassName(lazySizesConfig.autosizesClass);addEventListener('resize',debouncedUpdateElementsSizes)},checkElems:debouncedUpdateElementsSizes,updateElem:getSizeElement}})();var init=function(){if(!init.i){init.i=!0;autoSizer._();loader._()}};(function(){var prop;var lazySizesDefaults={lazyClass:'lazyload',loadedClass:'lazyloaded',loadingClass:'lazyloading',preloadClass:'lazypreload',errorClass:'lazyerror',autosizesClass:'lazyautosizes',srcAttr:'data-src',srcsetAttr:'data-srcset',sizesAttr:'data-sizes',minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:0.8,loadMode:2};lazySizesConfig=window.lazySizesConfig||window.lazysizesConfig||{};for(prop in lazySizesDefaults){if(!(prop in lazySizesConfig)){lazySizesConfig[prop]=lazySizesDefaults[prop]}} +window.lazySizesConfig=lazySizesConfig;setTimeout(function(){if(lazySizesConfig.init){init()}})})();return{cfg:lazySizesConfig,autoSizer:autoSizer,loader:loader,init:init,uP:updatePolyfill,aC:addClass,rC:removeClass,hC:hasClass,fire:triggerEvent,gW:getWidth,rAF:rAF,}}))});define('lozad',[],function(){'use strict' +var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var isIE=document.documentMode;var defaultConfig={rootMargin:'0px',threshold:0,load:function load(element){if(element.nodeName.toLowerCase()==='picture'){var img=document.createElement('img');if(isIE&&element.getAttribute('data-iesrc')){img.src=element.getAttribute('data-iesrc')} +element.appendChild(img)} +if(element.getAttribute('data-src')){element.src=element.getAttribute('data-src')} +if(element.getAttribute('data-srcset')){element.srcset=element.getAttribute('data-srcset')} +if(element.getAttribute('data-background-image')){element.style.backgroundImage='url('+element.getAttribute('data-background-image')+')'}},loaded:function loaded(){}};function markAsLoaded(element){element.setAttribute('data-loaded',!0);element.classList.remove("lazyload");element.classList.add("lazyloaded")} +var isLoaded=function isLoaded(element){return element.getAttribute('data-loaded')==='true'};var onIntersection=function onIntersection(load,loaded){return function(entries,observer){entries.forEach(function(entry){if(entry.intersectionRatio>0){observer.unobserve(entry.target);if(!isLoaded(entry.target)){load(entry.target);markAsLoaded(entry.target);loaded(entry.target)}}})}};var getElements=function getElements(selector){if(selector instanceof Element){return[selector]} +if(selector instanceof NodeList){return selector} +return document.querySelectorAll(selector)};var lozad=function(){var selector=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'.lozad';var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _defaultConfig$option=_extends({},defaultConfig,options),rootMargin=_defaultConfig$option.rootMargin,threshold=_defaultConfig$option.threshold,load=_defaultConfig$option.load,loaded=_defaultConfig$option.loaded;var observer=void 0;if(window.IntersectionObserver){observer=new IntersectionObserver(onIntersection(load,loaded),{rootMargin:rootMargin,threshold:threshold})} +return{observe:function observe(){var elements=getElements(selector);for(var i=0;i<elements.length;i++){if(isLoaded(elements[i])){continue} +if(observer){observer.observe(elements[i]);continue} +load(elements[i]);markAsLoaded(elements[i]);loaded(elements[i])}},triggerLoad:function triggerLoad(element){if(isLoaded(element)){return} +load(element);markAsLoaded(element);loaded(element)}}};return lozad});define('common',['jquery','wodSwapper','utils'],function($,wodSwapper,utils){"use strict";var module={};module.init=function(selector){if(wodSwapper.cameFromWodEmail()){wodSwapper.cookieWodSubscriber()} +if('ontouchstart' in document){$('body').removeClass('no-touch')} +$('body').bind('touchstart',function(event){})};return module});define('fbSdk',['jquery','underscore','matchMedia'],function($,_){"use strict";var module={};var toggleFBComment=function(){var $el,id,graphURL;$el=$(".toggle-fb-comments");if($el.length===0){return !1} +id=$el.find(".fb-comments-container").attr("data-href");graphURL="https://graph.facebook.com/?id="+id;$.getJSON(graphURL,function(data){var c={},commentText="comments";c.share=data.share||{};if(!!c.share.comment_count){commentText=(parseInt(c.share.comment_count)>1)?c.share.comment_count+" comments":c.share.comment_count+" comment"} +$el.find(".fb-comment-count").text(commentText)});var loadFBComments=function(){var $fbcontainer=$el.find(".fb-comments-container");if(!$fbcontainer.hasClass("loaded")){$fbcontainer.addClass("fb-comments loaded");if(typeof(FB)!=="undefined"){FB.XFBML.parse()}} +$(window).off("scroll.loadFBcomments")};$el.find(".toggle-link").on("click",function(e){e.preventDefault();loadFBComments();$el.toggleClass("display-comments");$(window).trigger("updatesticky")});var mobileScreen=window.matchMedia('screen and (max-width: 767px)');if(mobileScreen.matches)return;var throttle_loadFBComments=_.throttle(loadFBComments,300);$(window).on("scroll.loadFBcomments",throttle_loadFBComments)};module.init=function(){$(document).ready(function(){toggleFBComment()})};module.execCmd=function(cbFunction){if(window.mwdata.fbSdkReady){cbFunction()}else{window.mwdata.fbSdkQueue.push(cbFunction)}};return module});define('favorites',['jquery','gaTracker','fbSdk'],function($,gaTracker,fbSdk){function loginToFB(success){return function(){var fbCmd=function(){FB.login(success,{perms:''})};fbSdk.execCmd(fbCmd);return !1}};function favoritesWidget(elem){var widget=$(elem);if(widget.length==0)return;$(widget).click(function(){return widget.toggle()});widget.onStatusLoaded=function(response){this.repaint(response)};widget.refresh=function(){var fbFuncCallback=function(){FB.getLoginStatus(function(response){if(response.status=='connected'){$.getScript('https://stats.merriam-webster.com/my-saved-words/app-redesign.php?'+'action=words.in_list'+'&word=/'+escape($('#my-saved-words-icon').attr('data-ref'))+'/'+escape($('#my-saved-words-icon').attr('data-word'))+'&uid='+response.authResponse.userID+'&callback=onStatusLoaded'+'&sel='+escape(elem)+'&access_token='+response.authResponse.accessToken)}else{widget.repaint(response)}})};fbSdk.execCmd(fbFuncCallback)};widget.repaint=function(response){$(this).data('saved',response.status=='saved');if(response.status=='saved'){$(this).addClass('saved');$(this).data('saved',!0)}else{$(this).removeClass('saved');$(this).data('saved',!1)}};widget.toggle=loginToFB(function(response){var saved=$(widget).data('saved');saved=typeof(saved)!=='undefined'&&saved;var url='/'+escape($(widget).attr('data-ref'))+'/starclick/'+(saved?'unsave/':'save/')+escape($(widget).attr('data-word'));var gaCmd=function(){ga('send','pageview',url)};gaTracker.execCmd(gaCmd);$.getScript('https://stats.merriam-webster.com/my-saved-words/app-redesign.php?'+'action='+(saved?'words.delete':'words.save')+'&uid='+response.authResponse.userID+'&access_token='+response.authResponse.accessToken+'&callback=onStatusLoaded'+'&sel='+escape(elem)+'&word=/'+escape($(widget).attr('data-ref'))+'/'+escape($(widget).attr('data-word')));return !1});widget.repaint({response:'not_authorized'});widget.refresh()} +function manageWidget(elem){var widget=$(elem)[0];widget.deleteWords=function(){var ids=[];$(this).find('input').each(function(index,item){if(item.checked){ids.push(item.value)}});if(ids.length>0){var fbFuncCallback=function(){FB.getLoginStatus(function(response){$.getScript('https://stats.merriam-webster.com/my-saved-words/app-redesign.php?'+'action=words.delete'+'&uid='+response.authResponse.userID+'&access_token='+response.authResponse.accessToken+'&callback=onFavoritesDeleted'+'&sel='+escape(elem)+'&word[]='+ids.join('&word[]='))})};fbSdk.execCmd(fbFuncCallback)}else{alert("You have to select at least one word to delete.")}} +widget.onFavoritesDeleted=function(response){this.refresh()} +widget.onFavoritesLoaded=function(response){if(typeof(response.status)=='undefined'||response.status!='success'){return};$(this).addClass('favorites-manager').removeClass('edit-on').html('').append($('<div class="social-info">').append($('<div class="photo">').append($('<img />').attr('src','https://graph.facebook.com/'+$(this).data('userID')+'/picture'))).append($('<div class="name">').html($(this).data('userName')))).append($('<h2>').append($('<a>').attr('href','#').html('Recent').click(function(e){e.preventDefault();$(widget).data('sort','date');widget.refresh();return !1})).append($('<a>').attr('href','#').html('Alphabetical').click(function(e){e.preventDefault();$(widget).data('sort','value');widget.refresh();return !1})).append($('<a>').attr('href','#').html('Edit List').click(function(e){e.preventDefault();$(this).parents('.favorites-manager').toggleClass('edit-on');$(this).html($(this).parents('.favorites-manager').hasClass('edit-on')?'Edit List Off':'Edit List');return !1}))).append($('<h3>').append($('<a>').attr('href','#').html('Select All').click(function(e){e.preventDefault();$(this).parents('.favorites-manager').toggleClass('all-selected');$(this).parents('.favorites-manager').find('input').prop('checked',$(this).parents('.favorites-manager').hasClass('all-selected'));$(this).html($(this).parents('.favorites-manager').hasClass('all-selected')?'Unselect All':'Select All');return !1})).append($('<a>').attr('href','#').html('Delete').click(function(e){e.preventDefault();$(this).parents('.favorites-manager')[0].deleteWords();return !1}))).append($('<ul class="nobullet_noindent_list" />'));if(response.entries.length>0){var widget=this;$(response.entries).each(function(index,entry){$(widget).find('ul').append($('<li>').append($('<input>').attr('type','checkbox').attr('value',entry.word)).append($('<a>').attr('href',entry.url.replace(/\[.*$/,'')).append(entry.display.replace(/^<sup>([0-9]+)<\/sup>/,''))).append(' <em>Saved '+entry.date+'</em>'))})}else{$(this).find('ul').html('').append($('<li>').html('Your list is empty.'))}};widget.refresh=function(){FB.getLoginStatus(function(response){if(response.status=='connected'){$(widget).parents('#static_pg_container').removeClass('not-logged-in');FB.api('/me?access_token='+response.authResponse.accessToken,function(me_response){$(widget).data('userID',me_response.id);$(widget).data('userName',me_response.name);$.getScript('https://stats.merriam-webster.com/my-saved-words/app-redesign.php?'+'action=words.get_all'+'&sort='+($(widget).data('sort')?$(widget).data('sort'):'date')+'&uid='+response.authResponse.userID+'&access_token='+response.authResponse.accessToken+'&callback=onFavoritesLoaded'+'&sel='+escape(elem))})}else{$(widget).parents('#static_pg_container').addClass('not-logged-in');$(widget).html('').append($("<p>Save words to create your own quick links to important definitions, usage notes, synonyms, and more.</p>")).append($('<p>').append($('<a>').attr('href','#').html('Log into Facebook').click(loginToFB(function(){widget.refresh()}))))}})};fbSdk.execCmd(widget.refresh)} +return{favoritesWidget:favoritesWidget,manageWidget:manageWidget}});define('wordClick',['jquery'],function(){function init(node){if(typeof(node)!='undefined'){var nodeName=node.nodeName.toLowerCase();if(node.nodeType==3&&node.nodeValue.trim()!=''){var current=node;$(node.nodeValue.split(/([^\W]+)/)).each(function(index,value){if(/[^\W]+/.test(value)){current=$('<a>').attr('href',value).addClass('word-click').append(document.createTextNode(value)).insertAfter(current)}else{current=$(document.createTextNode(value)).insertAfter(current)}});$(node).remove()}else if(node.nodeType==1&&!/(a|h2|h6)$/.test(nodeName)){if(!$(node).hasClass('sense')){$(node).contents().each(function(index,elem){init(elem)})}}}else{$("*[data-word-click='enabled'] .def-text .definition-inner-item").each(function(index,elem){init(elem)})}} +return{init:init}});define('shareLinks',['jquery','fbSdk'],function($,fbSdk){"use strict";var module={};module.init=function(elem){var select=typeof(elem)!='undefined'?$(elem):$('.share-link');$(select).each(function(index,link){link=$(link);if(typeof(elem)!=='undefined'||!link.data('data-share-onclick-set')){var shareUrl=$(this).attr('data-share-url')||'';var fb_app_id=$('meta[property="fb:app_id"]').attr('content');if(link.hasClass('fb')){link.attr('data-share-target','facebook')}else if(link.hasClass('twitter')){link.attr('data-share-url','https://twitter.com/intent/tweet?'+'url='+encodeURIComponent(shareUrl).replace('#','%23')+'&text='+encodeURIComponent((link.attr('data-share-text')||'').replace(/"/g,'%22').replace(/[“”]/g,'"'))).attr('data-share-target','twitter')} +if(!link.data('data-share-onclick-set')){link.data('data-share-onclick-set',!0);link.click(function(e){e.preventDefault();if($(this).attr('data-share-target')=='facebook'){var data={app_id:fb_app_id,method:'feed',link:$(this).attr('data-share-url'),display:'popup'};var picture=$(this).attr('data-share-image');if(typeof picture!==typeof undefined&&picture!==!1){data.picture=picture} +var title=$(this).attr('data-share-title');if(typeof title!==typeof undefined&&title!==!1){data.title=title.replace(/[“”]/g,'"');data.name=title.replace(/[“”]/g,'"')} +var description=$(this).attr('data-share-description');if(typeof description!==typeof undefined&&description!==!1){data.description=description.replace(/[“”]/g,'"')} +var fbCmd=function(){FB.ui(data,function(response){})};fbSdk.execCmd(fbCmd);return}else{var width=$(this).attr('data-share-target')=='twitter'?590:575;var height=$(this).attr('data-share-target')=='twitter'?440:400;var left=($(window).width()-width)/2;var top=($(window).height()-height)/2;var the_url=$(this).attr('data-share-url');if($(this).attr('data-share-target')=='pinterest'){width=800;height=600} +var opts='status=1'+',width='+width+',height='+height+',top='+top+',left='+left;var target=$(this).attr('data-share-target');window.open(the_url,target,opts);return !1}})}}})};return module});define('valentinePromo',['jquery'],function(){$('body').addClass('valentine-promo');$('<div id="hearts"></div>').prependTo('.outer-container')});define('topAdAdjuster',['jquery','underscore','matchMedia'],function($,_){"use strict";var module={};var alreadyInitialized=!1;module.init=function(topAdAdjusterDisabled){var shrinkHeader=$('.shrinkheader');var menuFiller=$('.menu-filler');var adContainer=$('.home-top-creative-cont');var mqMax768=window.matchMedia('screen and (max-width: 768px)');var previousPosition=0;var isRolledUp=!1;var updatePosition=function(){var nowPosition=$(document).scrollTop();var maxNowPosition=$(document).height()-$(window).height();if(nowPosition>maxNowPosition){nowPosition=maxNowPosition} +if(nowPosition<0){nowPosition=0} +if(previousPosition!==nowPosition){if(previousPosition<nowPosition){if(!isRolledUp){shrinkHeader.addClass('roll-up');adContainer.addClass('roll-up');menuFiller.removeClass('extended-for-ad');isRolledUp=!0}}else{shrinkHeader.removeClass('roll-up');adContainer.removeClass('roll-up');menuFiller.addClass('extended-for-ad');isRolledUp=!1}} +previousPosition=nowPosition};var throttledUpdatePosition=_.debounce(updatePosition,20);var initAdjuster=function(){if(mqMax768.matches){if(!alreadyInitialized){adContainer.addClass('fixed-on-top-in-mobile');menuFiller.addClass('extended-for-ad');$(window).on('scroll',throttledUpdatePosition);alreadyInitialized=!0}}else{if(alreadyInitialized){adContainer.removeClass('fixed-on-top-in-mobile');menuFiller.removeClass('extended-for-ad');$(window).off("scroll",throttledUpdatePosition);alreadyInitialized=!1}}};if(!topAdAdjusterDisabled){initAdjuster();mqMax768.addListener(initAdjuster)}};return module});define('typeshift',[],function(){var module={};module.init=function(assetLocation,divId){function preload(){game.load.crossOrigin='anonymous';game.load.image("dragBox",assetLocation+"/images/dragBox.png") +for(var e=65;91>e;e++){var t=String.fromCharCode(e) +halfSize?(game.load.spritesheet(t,assetLocation+"/images/"+t+"2.png",tileWActual,tileHActual),game.load.image("arrow",assetLocation+"/images/Arrow2.png"),game.load.image("arrowBright",assetLocation+"/images/ArrowBright2.png")):(game.load.spritesheet(t,assetLocation+"/images/"+t+".png",tileWActual,tileHActual),game.load.image("arrow",assetLocation+"/images/Arrow.png"),game.load.image("arrowBright",assetLocation+"/images/ArrowBright.png"))} +game.load.audio("tick",assetLocation+"/sounds/TumblerMove.wav"),game.load.audio("solve",assetLocation+"/sounds/FoundWord.wav"),game.load.audio("puzzleComplete",assetLocation+"/sounds/PuzzleSuccess.wav"),game.load.audio("gameOver",assetLocation+"/sounds/GameOverInfoIn.wav"),game.load.bitmapFont("din",assetLocation+"/fonts/font.png",assetLocation+"/fonts/font.fnt"),game.load.text("dailyPuzzle",assetLocation+"/puzzles/"+getDateString(0)+".txt"),game.stage.backgroundColor="#1A2025",game.input.maxPointers=1,game.scale.setShowAll(),game.scale.pageAlignHorizontally=!0,game.scale.pageAlignVertically=!0,game.scale.scaleMode=Phaser.ScaleManager.SHOW_ALL} +function create(){if(shapesBG=game.add.graphics(0,0),shapesBG.beginFill(3028800),shapesBG.drawRect(0,game.world.height/2-tileH/2,game.world.width,tileH),loadDailyPuzzle(),sfx_tick=game.add.audio("tick"),sfx_solve=game.add.audio("solve"),sfx_puzzleComplete=game.add.audio("puzzleComplete"),sfx_gameOverIn=game.add.audio("gameOver"),shapesFG=game.add.graphics(0,0),shapesFG.beginFill(1712165,.392),shapesFG.drawRect(0,0,game.world.width,game.world.height/2-tileH/2),shapesFG.drawRect(0,game.world.height/2+tileH/2,game.world.width,game.world.height),halfSize?(streakText=game.add.bitmapText(0,textSize/4,"din"," Streak: "+currentStreak,textSize/2),bestText=game.add.bitmapText(game.world.width,textSize/4,"din","Best: "+bestStreak+" ",textSize/2),bestText.anchor.set(1,0)):(streakText=game.add.bitmapText(0,textSize/2,"din"," Streak: "+currentStreak,textSize),bestText=game.add.bitmapText(game.world.width,textSize/2,"din","Best: "+bestStreak+" ",textSize),bestText.anchor.set(1,0)),streakText.alpha=.5,bestText.alpha=.5,shapesGameOverScreen=game.add.graphics(0,0),shapesGameOverScreen.beginFill(0,.7),shapesGameOverScreen.drawRect(0,0,game.world.width,game.world.height),halfSize?(gameOverText=game.add.bitmapText(game.world.width/2,0,"din","",textSize/2),tutorialText=game.add.bitmapText(game.world.width/2,game.world.height/4,"din","",textSize/2)):(gameOverText=game.add.bitmapText(game.world.width/2,0,"din","",textSize),tutorialText=game.add.bitmapText(game.world.width/2,game.world.height/4,"din","",textSize)),tutorialText.align="center",tutorialText.anchor.set(.5,.5),gameOverText.align="center",gameOverText.text=" Puzzle Complete!\n\n\nCore Words",gameOverText.anchor.set(.5,0),shapesGameOverScreen.y=shapesGameOverScreen.y-game.world.height,gameOverObject=game.add.group(),gameOverObject.add(gameOverText),gameOverObject.y=gameOverObject.y-game.world.height,localStorage.getItem("lastCompletedDay")==getDateString(0)){for(var e=0;e<columns.length;e++)columns[e].hitZone.input.disableDrag(),columns[e].setAllToSolved() +loadData(),populateGameOverText() +var t=game.world.height-gameOverText.height +t/=2,gameOverObject.y=t,shapesGameOverScreen.y+=game.world.height}else tutorialButton=game.add.bitmapText(game.world.width-4/(halfSize+1),textSize/2*4/(halfSize+1),"din","How to play ",textSize/(halfSize+1)),tutorialButton.tint=0,tutorialButton.anchor.set(1,0),tutorialShape=game.add.graphics(game.world.width-1.2*tutorialButton.width,textSize/2*4/(halfSize+1)),tutorialShape.beginFill(16777215),tutorialShape.drawRect(0,0,1.2*tutorialButton.width,1.5*tutorialButton.height),tutorialShape.inputEnabled=!0,tutorialShape.events.onInputDown.add(doTutorial),game.world.bringToTop(tutorialButton)} +function doTutorial(){sfx_gameOverIn.play(),clearLevel(),loadTutorial(),resetObjects(),tutorialText.text="Slide columns up or down.\nTry to spell a word in the center row.",streakText.text="",bestText.text="",tutorialButton.x+=1e3,tutorialShape.x+=1e3} +function reloadDaily(){playingTutorial=!1,sfx_gameOverIn.play(),clearLevel(),loadDailyPuzzle(),resetObjects(),tutorialText.text="",shapesGameOverScreen.y=shapesGameOverScreen.y-game.world.height,gameOverObject.y=gameOverObject.y-game.world.height,shapesGameOverScreen.inputEnabled=!1,tutorialShape.inputEnabled=!0,streakText.text=" Streak: "+currentStreak,bestText.text="Best: "+bestStreak+" ",tutorialButton.x-=1e3,tutorialShape.x-=1e3,startTime=-1} +function update(){-1==startTime&&(startTime=game.time.totalElapsedSeconds())} +function checkWord(){console.log(totalTime) +for(var e="",t=0;t<columns.length;t++)e+=columns[t].letter +for(var a=!1,r=!0,t=0;t<coreWords.length;t++) +if(coreWords[t]==e){r=!1,f_coreWords[t]||(f_coreWords[t]=!0,a=!0) +break} +if(0==a&&r) +for(var t=0;t<allWords.length;t++) +if(allWords[t]==e&&!f_allWords[t]){f_allWords[t]=!0,a=!0 +break} +if(a){sfx_solve.play() +for(var t=0;t<columns.length;t++)columns[t].solve() +if(playingTutorial&&(4==nSolvedTiles?tutorialText.text="Words turn tiles green.\nTry to turn every tile green.":tutorialText.text="Great job!"),console.log(nSolvedTiles+", "+nTiles),nSolvedTiles==nTiles){if(playingTutorial)gameOverText.text="Remember:\nWords must be spelled in the center row.\n\nGood luck with today's daily puzzle!\n\nTap anywhere to continue.",shapesGameOverScreen.events.onInputDown.add(reloadDaily),tutorialShape.inputEnabled=!1 +else{tutorialButton.x+=1e3,tutorialShape.x+=1e3,totalTime+=parseInt(game.time.totalElapsedSeconds()-startTime),currentStreak++ +var l=localStorage.getItem("lastCompletedDay") +null==l&&(l="null"),localStorage.setItem("priorLastCompletedDay",l),localStorage.setItem("lastCompletedDay",getDateString(0)),localStorage.setItem("currentStreak",currentStreak),currentStreak>bestStreak&&(bestStreak=currentStreak,console.log(bestStreak),localStorage.setItem("bestStreak",bestStreak)),populateGameOverText()} +sfx_puzzleComplete.play() +for(var t=0;t<columns.length;t++){columns[t].hitZone.input.disableDrag() +var o=game.add.tween(columns[t]) +o.to({y:columns[t].y-40},110,Phaser.Easing.Sinusoidal.Out,!0,50*t+100) +var n=game.add.tween(columns[t]) +n.to({y:columns[t].y},110,Phaser.Easing.Sinusoidal.In,!1),o.chain(n)} +var i=game.world.height-gameOverText.height +i/=2 +var s=game.add.tween(gameOverObject) +s.to({y:i},1e3,Phaser.Easing.Exponential.In,!0,50*columns.length+300) +var d=game.add.tween(shapesGameOverScreen) +d.to({y:0},1e3,Phaser.Easing.Exponential.In,!0,50*columns.length+300),game.time.events.add(50*columns.length+300+1e3,playGameOverSound,this)} +playingTutorial||savePuzzle()}} +function playGameOverSound(){playingTutorial&&(shapesGameOverScreen.inputEnabled=!0),sfx_gameOverIn.play()} +function loadDailyPuzzle(){var e=game.cache.getText("dailyPuzzle") +text=e.split("\n") +var t=parseInt(text[0]),a=parseInt(text[1]),r=parseInt(text[2]),l=parseInt(text[3]) +nTiles=0,nSolvedTiles=0,createColumns(t) +for(var o=0;a>o;o++) +for(var n=0;t>n;n++)"*"!=text[o+4][n]&&(addTile(columns[n],text[o+4][n]),nTiles++) +for(var i=0;i<columns.length;i++)finish(columns[i]) +for(var i=0;r>i;i++){var s=i+4+a +coreWords.push(text[s]),f_coreWords.push(!1)} +for(var i=0;l>i;i++){var s=i+4+a+r +allWords.push(text[s]),f_allWords.push(!1)} +loadPuzzle()} +function loadTutorial(){playingTutorial=!0 +var e=4 +nTiles=6,nSolvedTiles=0,createColumns(e),addTile(columns[0],"B"),addTile(columns[0],"W"),addTile(columns[1],"I"),addTile(columns[2],"R"),addTile(columns[3],"D"),addTile(columns[3],"E") +for(var t=0;t<columns.length;t++)finish(columns[t]) +columns[3].snapToIndex(0),coreWords.push("BIRD"),f_coreWords.push(!1),coreWords.push("WIRE"),f_coreWords.push(!1)} +function populateGameOverText(){function e(){sfx_gameOverIn.play(),window.open("http://www.spelltower.to/web.php?word="+this.word)} +function e(){window.open("http://www.spelltower.to/web.php?word="+this.word)} +var t +t=halfSize?textSize/2:textSize +var a=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=new Date +gameOverText.text=a[r.getDay()]+" Puzzle Complete!\n\nTime: " +var l=totalTime,o=parseInt(l/60) +l-=60*o,o>0&&(gameOverText.text+=o+"m "),gameOverText.text+=l+"s",gameOverText.text+="\n\n" +var n=coreWords.length,i=Math.ceil(n/4) +gameOverText.text+="Core Words:\n\n" +for(var s=0,d=0,g=0,m=0;m<coreWords.length;m++){0==d&&(g=Math.min(n-4*s,4),d=0) +var h=0 +if(1==g)h=game.world.centerX +else if(2==g){var c=9 +5==coreWords[m].length?c=11:6==coreWords[m].length&&(c=10),0==d?h=game.world.centerX-game.world.width/c:1==d&&(h=game.world.centerX+game.world.width/c)}else if(3==g){var c=4 +5==coreWords[m].length?c=5:6==coreWords[m].length&&(c=4.5),0==d?h=game.world.centerX-game.world.width/c:1==d?h=game.world.centerX:2==d&&(h=game.world.centerX+game.world.width/c)}else if(4==g){var c=9 +5==coreWords[m].length?c=11:6==coreWords[m].length&&(c=10),0==d?h=game.world.centerX-game.world.width/c:1==d?h=game.world.centerX+game.world.width/c:2==d?h=game.world.centerX-game.world.width/c*3.2:3==d&&(h=game.world.centerX+game.world.width/c*3.2)} +var u,p=25-12.5*halfSize+(6+s)*t+s*(25-12.5*halfSize) +u=halfSize?game.add.bitmapText(h,p,"din","",textSize/2):game.add.bitmapText(h,p,"din","",textSize),u.anchor.set(.5,0),u.text=coreWords[m],f_coreWords[m]?u.text+="‡":u.alpha=.3,gameOverObject.add(u),u.inputEnabled=!0,u.events.onInputDown.add(e,{word:coreWords[m]}),d++,4==d&&(d=0,s++)} +for(var m=0;i>m;m++)gameOverText.text+="\n" +for(var v=0,m=0;m<allWords.length;m++)f_allWords[m]&&v++ +var w=Math.ceil(v/4) +gameOverText.text+="Additional Found Words:\n\n",s=0,d=0,g=0 +for(var m=0;m<allWords.length;m++) +if(f_allWords[m]){0==d&&(g=Math.min(v-4*s,4),d=0) +var h=0 +if(1==g)h=game.world.centerX +else if(2==g){var c=9 +5==allWords[m].length?c=11:6==allWords[m].length&&(c=10),0==d?h=game.world.centerX-game.world.width/c:1==d&&(h=game.world.centerX+game.world.width/c)}else if(3==g){var c=4 +5==allWords[m].length?c=5:6==allWords[m].length&&(c=4.5),0==d?h=game.world.centerX-game.world.width/c:1==d?h=game.world.centerX:2==d&&(h=game.world.centerX+game.world.width/c)}else if(4==g){var c=9 +5==allWords[m].length?c=11:6==allWords[m].length&&(c=10),0==d?h=game.world.centerX-game.world.width/c:1==d?h=game.world.centerX+game.world.width/c:2==d?h=game.world.centerX-game.world.width/c*3:3==d&&(h=game.world.centerX+game.world.width/c*3)} +var u,p=25-12.5*halfSize+(6+s+i+3)*t+s*(25-12.5*halfSize) +u=halfSize?game.add.bitmapText(h,p,"din","",textSize/2):game.add.bitmapText(h,p,"din","",textSize),u.anchor.set(.5,0),u.text=allWords[m],gameOverObject.add(u),u.inputEnabled=!0,u.events.onInputDown.add(e,{word:allWords[m]}),d++,4==d&&(d=0,s++)} +for(var m=0;w>m;m++)gameOverText.text+="\n" +gameOverText.text+="Streak: "+currentStreak,streakText.text=" Streak: "+currentStreak,bestText.text="Best: "+bestStreak+" ",saveData()} +function savePuzzle(){var e=totalTime+parseInt(game.time.totalElapsedSeconds()-startTime),t="" +t+=getDateString(0),t+="/",t+=e,t+="/" +for(var a=0;a<coreWords.length;a++)f_coreWords[a]&&(t+=a+"|") +t+="/" +for(var a=0;a<allWords.length;a++)f_allWords[a]&&(t+=a+"|") +t+="/" +for(var a=0;a<columns.length;a++) +for(var r=0;r<columns[a].children.length;r++)t+=columns[a].children[r].solved?"1":"0" +localStorage.setItem("puzzleData",t)} +function loadPuzzle(){var e=localStorage.getItem("puzzleData") +if(totalTime=0,null!=e){var t=e.split("/") +if(t[0]==getDateString(0)){totalTime=parseFloat(t[1]) +for(var a=t[2].split("|"),r=t[3].split("|"),l=0;l<a.length;l++)a[l].length>0&&(f_coreWords[parseInt(a[l])]=!0) +for(var l=0;l<r.length;l++)r[l].length>0&&(f_allWords[parseInt(r[l])]=!0) +for(var o=0,n=0;n<columns.length;n++) +for(var i=0;i<columns[n].children.length;i++)"1"==t[4][o]&&(columns[n].children[i].solved=!0,columns[n].children[i].animations.play("solved"),nSolvedTiles++),o++}}} +function saveData(){var e="" +e+=totalTime,e+="/" +for(var t=0;t<coreWords.length;t++)f_coreWords[t]&&(e+=t+"|") +e+="/" +for(var t=0;t<allWords.length;t++)f_allWords[t]&&(e+=t+"|") +localStorage.setItem("saveData",e) +localStorage.getItem("saveData")} +function loadData(){for(var e=localStorage.getItem("saveData"),t=e.split("/"),a=0;a<t.length;a++)console.log(a) +totalTime=parseFloat(t[0]) +for(var r=t[1].split("|"),l=t[2].split("|"),o=0;o<r.length;o++)r[o].length>0&&(f_coreWords[parseInt(r[o])]=!0) +for(var o=0;o<l.length;o++)l[o].length>0&&(f_allWords[parseInt(l[o])]=!0)} +function getDateString(e){var t=new Date +t.setDate(t.getDate()-e) +var a=t.getDate() +10>a&&(a="0"+a) +var r=t.getMonth()+1 +10>r&&(r="0"+r) +var l=t.getFullYear() +return l+"-"+r+"-"+a} +function clearLevel(){for(var e=columns.length-1;e>=0;e--)columns[e].hitZone.destroy(),columns[e].destroy() +columns.splice(0,columns.length),coreWords.splice(0,coreWords.length),allWords.splice(0,allWords.length),f_coreWords.splice(0,f_coreWords.length),f_allWords.splice(0,f_allWords.length)} +function resetObjects(){game.world.bringToTop(shapesFG),game.world.bringToTop(streakText),game.world.bringToTop(bestText),game.world.bringToTop(tutorialShape),game.world.bringToTop(tutorialButton),game.world.bringToTop(tutorialText),game.world.bringToTop(shapesGameOverScreen),game.world.bringToTop(gameOverObject),game.world.bringToTop(gameOverText)} +function createColumns(e){for(var t=(game.world.width-e*tileW)/2+tileW/2,a=0;e>a;a++){var r=newColumn(t+tileW*a) +columns.push(r)}} +function newColumn(e){var t=game.add.group() +return t.x=e,t.y=0,t.letter="_",t.index=0,t.move=function(e){this.y=e},t.snap=function(){index=Math.round(this.y/tileH),index>0?index=0:index<-1*(this.maxDrag-1)&&(index=-1*(this.maxDrag-1)),this.y=index*tileH,this.hitZone.y=game.world.centerY-this.hitZone.height/2,this.index=Math.abs(index),this.letter=this.children[this.index].letter,checkWord()},t.snapToIndex=function(e){this.y=e*tileH*-1,this.snap()},t.solve=function(){this.children[this.index].animations.play("solved") +var e=game.add.tween(this.children[this.index].scale).to({x:1,y:.7},90,Phaser.Easing.Quartic.In,!0),t=game.add.tween(this.children[this.index].scale).to({x:1,y:1},90,Phaser.Easing.Quartic.Out,!1) +e.chain(t),this.children[this.index].solved||(this.children[this.index].solved=!0,nSolvedTiles++)},t.setAllToSolved=function(){for(var e=0;e<this.children.length-2;e++)this.children[e].animations.play("solved")},t.startDrag=function(e,t,a,r,l){e.dY=e.y,e.readyToDrag=!0,e.totalDist=0,e.timeLastPlay=0},t.stopDrag=function(e,a,r,l,o){e.dY=e.y,e.readyToDrag=!1,game.time.totalElapsedSeconds()-e.timeLastPlay>.07&&sfx_tick.play(),t.snap()},t.moveColumn=function(e,a,r,l,o){change=e.y-e.dY,e.readyToDrag&&0!=change&&(index=Math.round(t.y/tileH),index>0&&(change/=4),index<-1*(t.maxDrag-1)&&(change/=4),e.column.move(e.column.y+change),e.dY=e.y,e.totalDist+=change,Math.abs(e.totalDist)-tileH>0&&(sfx_tick.play(),e.timeLastPlay=game.time.totalElapsedSeconds(),e.totalDist>0?e.totalDist=e.totalDist-tileH:e.totalDist=e.totalDist+tileH))},t} +function addTile(e,t){i=e.children.length,tile=e.create(0,game.world.centerY+i*tileH,t),tile.animations.add("normal",[0],1,!1),tile.animations.add("solved",[1],1,!1),tile.animations.play("normal"),tile.letter=t,tile.solved=!1,tile.anchor.setTo(.5,.5)} +function finish(e){i=e.children.length,e.maxDrag=e.children.length*tileH +var t=game.add.sprite(0,0,"","dragBox") +t.anchor.setTo(.5,0),t.width=tileW,t.height=10*e.maxDrag,t.inputEnabled=!0,t.x=e.x,t.y=game.world.centerY-t.height/2,t.input.enableDrag(),t.input.setDragLock(!1,!0),t.events.onDragStart.add(e.startDrag),t.events.onDragStop.add(e.stopDrag),t.events.onDragUpdate.add(e.moveColumn),t.dY=0,t.column=e,t.readyToDrag=!1,e.hitZone=t,e.index=Math.floor(e.children.length/2),e.letter=e.children[e.index].letter,e.children.length>1?(playingTutorial?arrow=e.create(0,game.world.centerY+i*tileH-tileH/5,"arrowBright"):arrow=e.create(0,game.world.centerY+i*tileH-tileH/5,"arrow"),arrow.anchor.setTo(.5,.5),playingTutorial?arrow=e.create(0,game.world.centerY-tileH+tileH/5,"arrowBright"):arrow=e.create(0,game.world.centerY-tileH+tileH/5,"arrow"),arrow.anchor.setTo(.5,.5),arrow.angle=180,e.maxDrag=e.children.length-2):e.maxDrag=e.children.length,e.move(e.index*tileH*-1)} +var winHeight=window.innerHeight*window.devicePixelRatio,halfSize=!1 +925>winHeight&&(halfSize=!0) +var game,tileW,tileH,tileWActual,tileHActual,fontSize,lastCompletedDay=localStorage.getItem("lastCompletedDay"),priorLastCompletedDay=localStorage.getItem("priorLastCompletedDay"),currentStreak,bestStreak +lastCompletedDay==getDateString(1)||priorLastCompletedDay==getDateString(1)?(currentStreak=localStorage.getItem("currentStreak"),null==currentStreak&&(currentStreak=0)):currentStreak=lastCompletedDay==getDateString(0)?1:0,bestStreak=localStorage.getItem("bestStreak"),null==bestStreak&&(bestStreak=0),halfSize?(tileW=88.5,tileH=88.5,tileWActual=87,tileHActual=87,fontSize=winHeight/621*100,game=new Phaser.Game(621,925,Phaser.AUTO,divId,{preload:preload,create:create,update:update})):(tileW=177,tileH=177,tileWActual=174,tileHActual=174,fontSize=winHeight/1242*100,game=new Phaser.Game(1242,1850,Phaser.AUTO,divId,{preload:preload,create:create,update:update})) +var shapesBG,shapesFG,tutorialShape,tutorialButton,tutorialText,playingTutorial=!1,shapesGameOverScreen,columns=[],gameOverText,gameOverObject,streakText,bestText,sfx_tick,sfx_solve,sfx_gameOverIn,allWords=[],f_allWords=[],coreWords=[],f_coreWords=[],nTiles,nSolvedTiles,startTime=-1,totalTime,textSize=70};return module});define('toggleMenu',['jquery'],function($){"use strict";var module={};var toggleMenu=function(){$(".menu-toggle, .close-trigger").on("click",function(e){$("body").toggleClass("mobile-open-menu")})} +module.init=function(){toggleMenu()} +return module});define('autocomplete',['jquery','jqueryui'],function($){"use strict";var module={};var sTerm='';var appendTo="#mw-autocomplete";var inputTerm=$("#s-term");module.init=function(){inputTerm.on("keydown",function(event){if(event.keyCode===$.ui.keyCode.TAB&&$(this).autocomplete("instance").menu.active){event.preventDefault()}}).autocomplete({source:function(request,response){sTerm=request.term;var r=($("#mw-search-tabs .active").data("search-url")==='/thesaurus')?'r=collegiate-thesaurus&':'';$.getJSON("/lapi/v1/mwol-search/autocomplete?"+r+"search="+request.term,function(data){response(data.docs)})},appendTo:appendTo,minLength:3,select:function(event,ui){window.location.href=ui.item.href;return !0},open:function(event,ui){$(appendTo).addClass("active")},close:function(event,ui){$(appendTo).removeClass("active")},focus:function(event,ui){inputTerm.val(ui.item.word);return !1},}).autocomplete("instance")._renderItem=function(ul,item){var ref,refLink,sItem,bWord,pos;sItem={bWord:item.word,ref:"",refLink:""} +if(item.ref==="owl-combined"){sItem.ref="Dictionary";sItem.refLink="/dictionary/"}else if(item.ref==="collegiate-thesaurus"){sItem.ref="Thesaurus";sItem.refLink="/thesaurus/"}else if(item.ref=="legal"){sItem.ref="Legal Dictionary";sItem.refLink="/legal/"}else if(item.ref=="medical"){sItem.ref="Medical Dictionary";sItem.refLink="/medical/"} +pos=item.word.toLowerCase().indexOf(sTerm.toLowerCase());if(pos>=0){sItem.bWord=item.word.substring(0,pos)+'<b>'+item.word.substring(pos,sTerm.length)+'</b>'+item.word.substring(pos+sTerm.length)} +item.href=sItem.refLink+item.word.toLowerCase();sItem.label=sItem.bWord+" in <em>"+sItem.ref+"</em>";return $("<li>").append("<div>"+sItem.label+"</div>").appendTo(ul)}};return module});define('searchBar',['jquery'],function($){"use strict";var module={};var mwForm=$("#mw-search-frm");var mwTab=$("#mw-search-tabs");var sTerm=$("#s-term");var clearTerm=$("#clear-term-cnt");var toggleForm=function(){$(".mob-search-btn").on("click",function(e){e.preventDefault();$(this).toggleClass("active");$(".search-cnt").toggleClass("active");var tmp=sTerm.val();sTerm.focus().val("").blur().focus().val(tmp);if('ontouchstart' in window){setTimeout(function(){window.scrollTo(0,0)},100)}})} +var toggleClearTerm=function(){if(sTerm.val().length>0){clearTerm.addClass("active")}else{clearTerm.removeClass("active")}} +var submitForm=function(){var typedText=sTerm.val().trim().toLowerCase();var refType=$(".header-search-tabs .active").data('search-url');var srcTracking='';if(window.location.pathname.indexOf("/dictionary/dictionary")===0&&window.document.referrer.indexOf("merriam-webster.com")<0&&window.document.referrer.indexOf("m-w.com")<0){srcTracking='?src=search-dict-hed'} +sessionStorage.setItem("seletedTab",refType);if(typedText!==''){if(typeof(heap)!=="undefined"){heap.addEventProperties({"Global - Entered Search String":typedText})} +window.location=refType+'/'+typedText.replace(/\//g,'%2F')+srcTracking}} +var searchForm=function(){sTerm.keypress(function(e){if(e.which===13){submitForm()}});mwForm.on('submit',function(e){e.preventDefault();submitForm()});$('.desk-search-btn, .search-bar-submit',mwForm).on('click',function(e){e.preventDefault();submitForm()})} +var clearForm=function(){$("#clear-search").on("click",function(e){e.preventDefault();sTerm.val("").focus();toggleClearTerm()}) +sTerm.bind('input propertychange',function(){toggleClearTerm()})} +var toggleTab=function(){var tabs=mwTab.find(".button");tabs.on("click",function(e){e.preventDefault();if($(this).hasClass("active")){return} +var searchURL=$(this).data("search-url");mwForm.attr("action",searchURL);var sText=sTerm.val().trim().toLowerCase();if(sText!==''){window.location=searchURL+"/"+sText}else{tabs.removeClass("active");$(this).addClass("active");if(searchURL==="/dictionary"){mwTab.removeClass("search-thesaurus").addClass("search-dictionary")}else{mwTab.removeClass("search-dictionary").addClass("search-thesaurus")}}})} +module.init=function(){toggleForm();searchForm();clearForm();toggleTab();toggleClearTerm()} +return module});define('homeVideo',['jquery','cmsImg','jwplayer','mwVideoAd','slick'],function($,cmsImg,jwplayer,mwVideoAd){"use strict";var jwPlayerDiv='video-placeholder';var videosArea=$(".wgt-hv");var videoContainer=$(".video-container");var videoPlayerArea=$(".video-player");var videoPlayLink=$(".video-container .video-play-link");var videoPlaceCont=$(".vp-cont");var videoPlace=$(".video-placeholder");var videoList=$('.wgt-hv .video-list');window.jwplayer=window.jwplayer||jwplayer;jwplayer.key=window.mwdata.jwkey;var allVideos;var largeImagesData;var playerInstance=jwplayer(jwPlayerDiv);var playlist=[];var alreadyCounted=!1;var firstVideoId=null;var playedOnce=!1;var activeIndex=null;var adTag="";var firstPlay=!0;var newPlaylist;var instantiatePlayer=function(url){adTag=url;for(var key in allVideos){if(allVideos.hasOwnProperty(key)){var vid=allVideos[key];var hosted=vid.hosted_video;var youtube=vid.youtube_video;var fileSrc=(hosted===null)?youtube:(window.mwdata.assetsDomain3+hosted);var largeImageData=largeImagesData[key];var imgSrc=cmsImg.getUrl(largeImageData,'vid-home-video-recent-lg');var playlistItem={'image':'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==','title':vid.name,'file':fileSrc+'?ec_rate=900','mediaid':vid.jw_id||"null"};if((vid.sub_file!==null)&&(vid.sub_file!=='')){var track={file:window.mwdata.assetsDomain1+"/mw/video-subtitles/"+vid.sub_file,label:"English",kind:"captions","default":!1};playlistItem.tracks=[track]} +playlist.push(playlistItem)}} +if(firstPlay===!1){return} +playerInstance.setup({advertising:{client:'googima',skipoffset:5},aspectratio:"16:9",autostart:!1,displaydescription:!0,displaytitle:!0,shuffle:!1,flashplayer:window.mwdata.jwPlayerPath+'jwplayer.flash.swf',mute:!1,playlist:[playlist[0]],preload:"none",primary:"html5",repeat:!1,stagevideo:!1,visualplaylist:!1,width:"100%",captions:{backgroundOpacity:50,fontSize:14,fontFamily:'"Open Sans",sans-serif'}});firstPlay=!1;playerInstance.on('beforePlay',function(e){if(e.startTime===null){playerInstance.playAd(adTag)}});playerInstance.on('complete',function(){playedOnce=!0;playerInstance.stop();videoPlaceCont.addClass('hidden');videoPlayLink.addClass('is-visible')});playerInstance.on('play',function(){var actInd=videosArea.find(".video-item.active").data("video-index");var vidData=allVideos[actInd];if(!alreadyCounted){alreadyCounted=!0;var request=$.ajax({"method":"POST","url":"/lapi/1/mwol-video/play/count","data":{'id':vidData.id}}).done(function(ajaxResponse){}).fail(function(jqXHR,textStatus){}).always(function(jqXHR,textStatus){})}});playerInstance.setAdTag=function(url){adTag=url}};var enableSidebar=function(){videoList.slick({"slidesToShow":4,"slidesToScroll":1,"respondTo":"window","touchThreshold":20,"variableWidth":!0,"lazyLoad":"ondemand","prevArrow":'<button type="button" class="hv-btn hv-prev-btn"></button>',"nextArrow":'<button type="button" class="hv-btn hv-next-btn"></button>',"responsive":[{"breakpoint":768,"settings":{"slidesToShow":2,"variableWidth":!1}}]});$(".video-item").on("click",function(e){e.preventDefault();var curIndex=$(this).data("video-index");updateActiveVideo(curIndex);startPlayback(curIndex)})};var enablePlayLink=function(){videoPlayLink.on("click",function(e){e.preventDefault();if(videoPlayLink.hasClass('in-progress')){return} +videoPlayLink.addClass('in-progress');var currentInd=videoContainer.attr('data-ind');startPlayback(currentInd)})};var updateActiveVideo=function(ind){var imData=largeImagesData[ind];var vidData=allVideos[ind];activeIndex=ind;var sidebarItem=videosArea.find('.video-item[data-video-index="'+ind+'"]');var sidebarItemAct=videosArea.find(".video-item.active");var videoPlayerTitle=videosArea.find(".hv-title");var videoPlayerBlurb=videosArea.find(".hv-teaser");var videoPlayerImage=videosArea.find(".video-play-link img");sidebarItemAct.removeClass("active");sidebarItem.addClass("active");var lgImg=cmsImg.render(imData,'vid-home-video-recent-lg') +videoPlayerImage.replaceWith(lgImg);videoPlayerTitle.html(vidData.name);videoPlayerTitle.attr('href','/video/'+vidData.slug);videoPlayerBlurb.html(vidData.teaser);videoPlayerBlurb.attr('href','/video/'+vidData.slug);videoContainer.attr('data-ind',ind);alreadyCounted=!1};var startPlayback=function(ind){var firstTime=videoPlayLink.hasClass('is-visible');newPlaylist=[playlist[ind]];var playVideo=function(adURL){playerInstance.setAdTag(adURL);playerInstance.load(newPlaylist);playerInstance.play();videoPlayLink.removeClass('is-visible');videoPlayLink.removeClass('in-progress');videoPlaceCont.removeClass('hidden')} +mwVideoAd.init(playVideo)};var module={};module.init=function(vs,ims){largeImagesData=ims;allVideos=vs;instantiatePlayer();enableSidebar();enablePlayLink()};return module});define('homeMp',['jquery','autofit','slick'],function($,autofit){"use strict";var module={};module.init=function(){$('.words-list').slick({"slidesToShow":5,"touchThreshold":20,"slidesToScroll":1,"variableWidth":!0,"infinite":!0});window.wordAutoFit=new autofit({'items':'.popular-words-area h5','closestContainer':'.words-list','closestItemContainer':'.word','maxWidthRatio':.6})};return module});define('homeFeatured',['jquery','adProcessor','uniqueId','slick'],function($,adProcessor,uniqueId){"use strict";var module={};module.init=function(){var featuredSlider=$('.trending-carousel');var trendingOps={centerMode:!1,infinite:!0,autoplay:!1,autoplaySpeed:4000,touchThreshold:20,slidesToShow:2,slidesToScroll:1,variableWidth:!0,responsive:[{breakpoint:1400,settings:{centerMode:!0,infinite:!0,}},{breakpoint:1034,settings:{centerMode:!0,infinite:!0,}},{breakpoint:768,settings:{slide:".slider-card:not(.home-creative-card)",autoplay:!1,centerMode:!1,variableWidth:!1,slidesToShow:2,slidesToScroll:1,infinite:!1,arrows:!1,dots:!1,vertical:!0,swipe:!1}},{breakpoint:640,settings:{slide:".slider-card:not(.home-creative-card)",autoplay:!1,centerMode:!1,variableWidth:!1,slidesToShow:2,slidesToScroll:1,infinite:!1,arrows:!1,dots:!1,vertical:!0,swipe:!1}}]};featuredSlider.slick(trendingOps)};return module});define('mp24h',['jquery','autofit','slick'],function($,autofit){"use strict";var module={};module.init=function(){$(".words-list-mp24").slick({"slidesToShow":5,"touchThreshold":193,"edgeFriction":193,"slidesToScroll":1,"variableWidth":!0,"infinite":!0});window.wordAutoFit=new autofit({"items":".words-list-mp24 h5","closestContainer":".words-list-mp24","closestItemContainer":".word","maxWidthRatio":.6})};return module});define('gamesLandingFeatured',['jquery','slick'],function($){"use strict";var module={};module.init=function(){var gamesLandingSliderSlick=$('.challenges-slider');gamesLandingSliderSlick.slick({"slidesToShow":3,"touchThreshold":20,"respondTo":"slider","variableWidth":!0,"slidesToScroll":1,"infinite":!0,"arrows":!0,"appendArrows":".chalenges-bar","placeholders":!1,"responsive":[{"breakpoint":580,"settings":{"slidesToScroll":1}}]});$(".slick-prev",gamesLandingSliderSlick).on("click",function(e){gamesLandingSliderSlick.slick('slickPrev')});$(".slick-next",gamesLandingSliderSlick).on("click",function(e){gamesLandingSliderSlick.slick('slickNext')})};module.typeShiftStreak=function(){console.log(localStorage.getItem("lastPlayedTypeShift"));if(typeof(localStorage)!=="undefined"&&!!localStorage.getItem("lastPlayedTypeShift")){if(!!localStorage.getItem("lastCompletedDay")){$("#fgPlayedDate").html(localStorage.getItem("lastCompletedDay")).removeClass("hidden")} +$("#fgCurrentStreak").html(localStorage.getItem("currentStreak")||0);$("#fgLongestStreak").html(localStorage.getItem("bestStreak")||0);$("#fgTrackStreak").removeClass("hidden")}else{$("#fgNotPlayed").removeClass("hidden")}} +return module});define('gameRecircWidget',['jquery','slick'],function($){"use strict";var module={};module.init=function(){var gameRecircWidgetSlider=$('.game-recirc-widget .challenges-slider');gameRecircWidgetSlider.slick({"slidesToShow":3,"touchThreshold":20,"respondTo":"slider","variableWidth":!0,"slidesToScroll":1,"infinite":!0,"arrows":!0,"appendArrows":".chalenges-bar","placeholders":!1,"lazyload":"progressive","responsive":[{"breakpoint":580,"settings":{"slidesToScroll":1}}]});$(".slick-prev",gameRecircWidgetSlider).on("click",function(e){gameRecircWidgetSlider.slick('slickPrev')});$(".slick-next",gameRecircWidgetSlider).on("click",function(e){gameRecircWidgetSlider.slick('slickNext')})};return module});define('wgtGamesNext0',['jquery','slick'],function($){"use strict";var module={};module.init=function(){$('.next0').removeClass('hidden');var nextGameNav=$(".next-game-nav");var nextGameSlider=$(".next-game-slider");var nextGameOps={slidesToShow:1,slidesToScroll:1,infinite:!1,asNavFor:".next-game-slider","respondTo":"window","touchThreshold":20};var nextGameSliderOps={arrows:!1,slidesToShow:1,slidesToScroll:1,infinite:!1,asNavFor:".next-game-nav",dots:!1,"respondTo":"window","touchThreshold":20};nextGameNav.slick(nextGameOps);nextGameSlider.slick(nextGameSliderOps);window.mwdata.wgtGamesNext0=nextGameSlider};return module});define('wgtGamesNext1',['jquery','slick'],function($){"use strict";var module={};module.init=function(){var container=$('.wgt-next1').find('.nitems');var itemsCount=container.find('.nitem').length;var slickConfig={slidesToShow:1,touchThreshold:20,respondTo:"slider",variableWidth:!1,slidesToScroll:1,infinite:!0,arrows:!1,placeholders:!1};container.slick(slickConfig);$('.wgt-next1').find(".nbutton").on("click",function(e){container.slick('slickNext')})};return module});define('wodLandingRecent',['jquery','dynamicFonts','slick'],function($,dynamicFonts){"use strict";var module={};module.init=function(){$('.wod-carousel .word-items').slick({"slidesToShow":1,"touchThreshold":25,"dots":!0,"variableWidth":!1,"slidesToScroll":1,"infinite":!0,"responsive":[{breakpoint:480,settings:{arrows:!1}}]});dynamicFonts({"container":".wod-carousel .word-header","target":".wod-carousel .word-header h2"});$(window).bind("resize",function(){dynamicFonts({"container":".wod-carousel .word-header","target":".wod-carousel .word-header h2"})})};return module});define('wapLandingFeatured',['jquery','slick','lozad'],function($,slick,lozad){"use strict";var module={};var container=$(".wap-carousel .bar-items");module.init=function(){container.slick({"slidesToShow":1,"touchThreshold":20,"dots":!0,"variableWidth":!1,"slidesToScroll":1,"infinite":!0,"lazyLoad":"progressive","responsive":[{"breakpoint":768,"settings":{arrows:!1}}]});if(typeof(window.IntersectionObserver)!=="undefined"){const observer=lozad();observer.observe()}else{container.find("img").addClass("lazyload")}};return module});define('videoLandingFeatured',['jquery','slick','lozad'],function($,slick,lozad){"use strict";var module={};var container=$('.v-preview-list');module.init=function(){container.slick({"slidesToShow":1,"centerPadding":"0","touchThreshold":20,"slidesToScroll":1,"variableWidth":!0,"infinite":!0,"centerMode":!0,"lazyLoad":"progressive","responsive":[{"breakpoint":768,"settings":{"variableWidth":!1}}]})};return module});define('videoLandingRecent',['jquery','slick'],function($){"use strict";var module={};module.init=function(){$('.v-latest-list').slick({"slidesToShow":2,"respondTo":"slider","touchThreshold":20,"slidesToScroll":2,"responsive":[{"breakpoint":540,"settings":{"slidesToShow":1,"slidesToScroll":1}}]})};return module});define('wodSubscribe',['jquery'],function($){'use strict';var module={};module.init=function(){$('.js-wod-subscribe-frm').on('submit',function(e){e.preventDefault();var form=$(this);var submitButton=form.find('[type=submit]:visible');var textField=form.find('[type=text]');if(submitButton.hasClass('busy1')){return} +var formData={email:textField.val(),subscribe:'1',callback:'signup_callback'};if(form.data("source")!==undefined){formData.source=form.data("source")} +if(form.data("campaign")!==undefined){formData.campaign=form.data("campaign")} +if(form.data("medium")!==undefined){formData.medium=form.data("medium")} +submitButton.addClass('busy1');$.ajax({type:'GET',dataType:"jsonp",url:'https://www.drhinternet.net/mw-signup-wod-jsonp/subscribe.php',jsonp:!1,jsonpCallback:'signup_callback',data:formData,}).done(function(dataWeGotViaJsonp){$.cookie('wodEmail',formData.email,{expires:1,path:'/'});window.location='/wotd-signup-message?message='+dataWeGotViaJsonp}).always(function(){submitButton.removeClass('busy1')})});$("#resent-confirmation").click(function(e){e.preventDefault();var $this=$(this);var wodEmail=$.cookie('wodEmail');var formData={email:wodEmail,subscribe:'1',callback:'signup_callback'};if($(this).hasClass("busy1")){return}else{$(this).addClass("busy1")} +$.ajax({type:'GET',dataType:"jsonp",url:'https://www.drhinternet.net/mw-signup-wod-jsonp/subscribe.php',jsonp:!1,jsonpCallback:'signup_callback',data:formData,}).done(function(dataWeGotViaJsonp){var $p=$this.parent();$p.fadeOut(function(){$p.html("<b class='sent-msg'>Email sent! Please check your email.</b>")}).fadeIn()})})};return module});define('subscribeOverlay',['jquery','matchMedia'],function($,matchMedia){'use strict';var module={};var mqMax768=window.matchMedia('screen and (max-width: 768px)');var container;function ouibounce(el,custom_config){"use strict";var config=custom_config||{},aggressive=config.aggressive||!1,sensitivity=setDefault(config.sensitivity,20),timer=setDefault(config.timer,1000),delay=setDefault(config.delay,0),callback=config.callback||function(){},cookieExpire=setDefaultCookieExpire(config.cookieExpire)||'',cookieDomain=config.cookieDomain?';domain='+config.cookieDomain:'',cookieName=config.cookieName?config.cookieName:'viewedOuibounceModal',sitewide=config.sitewide===!0?';path=/':'',_delayTimer=null,_html=document.documentElement;function setDefault(_property,_default){return typeof _property==='undefined'?_default:_property} +function setDefaultCookieExpire(days){var ms=days*24*60*60*1000;var date=new Date();date.setTime(date.getTime()+ms);return "; expires="+date.toUTCString()} +setTimeout(attachOuiBounce,timer);function attachOuiBounce(){if(isDisabled()){return} +_html.addEventListener('mouseleave',handleMouseleave);_html.addEventListener('mouseenter',handleMouseenter);_html.addEventListener('keydown',handleKeydown)} +function handleMouseleave(e){if(e.clientY>sensitivity){return} +_delayTimer=setTimeout(fire,delay)} +function handleMouseenter(){if(_delayTimer){clearTimeout(_delayTimer);_delayTimer=null}} +var disableKeydown=!1;function handleKeydown(e){if(disableKeydown){return} +else if(!e.metaKey||e.keyCode!==76){return} +disableKeydown=!0;_delayTimer=setTimeout(fire,delay)} +function checkCookieValue(cookieName,value){return parseCookies()[cookieName]===value} +function parseCookies(){var cookies=document.cookie.split('; ');var ret={};for(var i=cookies.length-1;i>=0;i--){var el=cookies[i].split('=');ret[el[0]]=el[1]} +return ret} +function isDisabled(){return checkCookieValue(cookieName,'true')&&!aggressive} +function isWODSubscriber(){return checkCookieValue('b-e-subsc','1')&&!aggressive} +function fire(){if(isDisabled()||isWODSubscriber()){return} +if(el){el.style.display='block'} +callback();disable()} +function disable(custom_options){var options=custom_options||{};if(typeof options.cookieExpire!=='undefined'){cookieExpire=setDefaultCookieExpire(options.cookieExpire)} +if(options.sitewide===!0){sitewide=';path=/'} +if(typeof options.cookieDomain!=='undefined'){cookieDomain=';domain='+options.cookieDomain} +if(typeof options.cookieName!=='undefined'){cookieName=options.cookieName} +console.log("zz"+cookieExpire);document.cookie=cookieName+'=true'+cookieExpire+cookieDomain+sitewide;container.on("noThanksSubscribe",function(){console.log("zz"+cookieName+setDefaultCookieExpire(7));document.cookie=cookieName+'=true'+setDefaultCookieExpire(7)+cookieDomain+sitewide});_html.removeEventListener('mouseleave',handleMouseleave);_html.removeEventListener('mouseenter',handleMouseenter);_html.removeEventListener('keydown',handleKeydown)} +return{fire:fire,disable:disable,isDisabled:isDisabled}} +var initOverlay=function(){container=$("#subscribe-overlay");var addedHTML='<div class="success-message subscribe-added"><p><b>You\'re on your way to learning something new every day!</b></p>';addedHTML+='<p>We just need to make sure you\'re really you — so we\'ve sent you a confirmation email. Please click the link in that email to confirm your subscription. You might also want to add "word@m-w.com" to your spam filter whitelist or address book to ensure delivery of the Word of the Day to your email inbox.</p>';addedHTML+='<p> Thanks,<br/>The Merriam-Webster Team</p></div> ';var resentConfirmationTML='<div class="success-message resent-confirmation-message">';resentConfirmationTML+='<p><b>Looks like you\'ve tried to subscribe already.</b></p>';resentConfirmationTML+='<p>Hmm, our records show that you tried to subscribe to the Word of the Day once before, but did not confirm your subscription. We ask you to click on a link in an email to be sure you\'re really you — so we\'ve resent that confirmation email now. It could be that your spam filter is blocking the confirmation message. Please add "word@m-w.com" to your address book or whitelist to ensure delivery of the Word the day, and the confirmation message — and start learning something new every day!</p>';resentConfirmationTML+='<p>Thanks,<br/>The Merriam-Webster Team</p></div>';var subscribedTML='<div class="success-message already-subscribed-message">';subscribedTML+='<p><b>You\'re already subscribed!</b></p>';subscribedTML+='<p>If you are not getting our emails, it could be that your spam filter is blocking the Word of the Day email.</p>';subscribedTML+='<p>If you have not done so already, please add "word@m-w.com" to your address book or whitelist to ensure delivery of the Word the Day — and start learning something new every day!</p>';subscribedTML+='<p>Thanks,<br/>The Merriam-Webster Team</p></div>';var subscribeOverlayHTML='<div class="underlay"></div><div class="subscribe-modal"><a class="overlay-close"><span aria-label="Close Overlay">×</span></a>';subscribeOverlayHTML+='<div class="overlay-box"><div class="overlay-left"><div class="overlay-image-spacing"><div class="overlay-image">';subscribeOverlayHTML+='</div></div></div><div class="overlay-right"><div class="overlay-form"><div class="overlay-subscribe">';subscribeOverlayHTML+='<p>You\'re never<br/>too cool to learn something new.</p><p>Sign up for our <b><em>Word of the Day</em></b><br/>daily newsletter!</p>';subscribeOverlayHTML+='<form class="subscribe-box"><input type="text" name="subscribe-email" class="subcribe-email" id="subscribe-email" placeholder="Email address"/><input type="submit" class="btn subscribe-btn" id="overlay-subscribe-btn" value="subscribe" />';subscribeOverlayHTML+='</form><div class="overlay-close-link">No thanks, maybe later.</div></div><div id="success-message"></div></div> </div></div></div>';container.html(subscribeOverlayHTML);var hideOverlay=function(){window.disableRecircBar=!1;container.hide()} +$('body').on('click',function(e){hideOverlay()});container.find(".subscribe-modal").on('click',function(e){e.stopPropagation()});container.find(".overlay-close").on("click",function(e){e.preventDefault();hideOverlay()});container.find(".overlay-close-link").on("click",function(e){e.preventDefault();container.trigger("noThanksSubscribe");hideOverlay()});container.on("submit",".subscribe-box",function(e){e.preventDefault();var submitButton=container.find(".subscribe-btn");var textField=container.find(".subcribe-email");if(submitButton.hasClass('busy1')){return}else{submitButton.addClass('busy1')} +$.ajax({type:'GET',dataType:"jsonp",url:'https://www.drhinternet.net/mw-signup-wod-jsonp/subscribe.php',jsonp:!1,jsonpCallback:'signup_callback',data:{email:textField.val(),subscribe:'1',source:'mwsite',campaign:'wotd',medium:'scroll-away',callback:'signup_callback'}}).done(function(dataWeGotViaJsonp){if(dataWeGotViaJsonp==='subscribe.added'){container.find(".overlay-form").html(addedHTML);container.trigger("closedoverlay")}else if(dataWeGotViaJsonp==='subscribe.resent_confirmation'){container.find(".overlay-form").html(resentConfirmationTML);container.trigger("closedoverlay")}else if(dataWeGotViaJsonp==='subscribe.already_subscribed'){container.find(".overlay-form").html(subscribedTML);container.trigger("closedoverlay")}else if(dataWeGotViaJsonp==='subscribe.invalid_email'){alert("Please enter a valid Email address.")}else{alert("Please try again.")}}).always(function(){submitButton.removeClass('busy1')})})};module.init=function(){if(mqMax768.matches||window.location.pathname.indexOf('/dictionary')!==0){return} +if(!!window.disableWODSubscribe===!0){return} +initOverlay();var _ouibounce=ouibounce(document.getElementById('subscribe-overlay'),{timer:100,cookieName:'subscribeOverlay',cookieExpire:7,sitewide:!0,callback:function(){console.log('ouibounce fired!');window.disableRecircBar=!0}})} +return module});define('recircBar',['jquery','slick'],function($){"use strict";var module={};module.init=function(){$('.recirc-bar .bar-items').on('init',function(event,slick){var allSettings=slick.options;if(allSettings.duplicateArrows===!0){$(this).parent().find('button').each(function(){var newBtn=$(this).clone(!0);newBtn.appendTo($(this).parent()).addClass('clone')})} +$(this).attr('data-slides-num',$(this).find('.slick-slide').not('.slick-cloned').length)});$('.recirc-bar .bar-items').slick({"slidesToShow":4,"slidesToScroll":1,"variableWidth":!0,"infinite":!0,"touchThreshold":20,"duplicateArrows":!0,"lazyLoad":"ondemand","appendArrows":".recirc-bar"});$('.recirc-bar').hover(function(e){var _width=$(this).width();$(this).off("mousemove").on("mousemove",function(e){if((e.pageX-this.offsetLeft)<(_width/2)){$(this).removeClass('hovering-right') +$(this).addClass('hovering-left')}else{$(this).removeClass('hovering-left') +$(this).addClass('hovering-right')}})},function(){$(this).removeClass('hovering-right').removeClass('hovering-left');$(this).off("mousemove")});$(".recirc-bar a").click(function(e){var data={url:$(this).attr("href"),src:'recirctop'} +sessionStorage.setItem('gaSRCTracker',JSON.stringify(data))})};return module});define('svgReplace',['jquery'],function($){"use strict";var module={};module.init=function(){$('img.svg').each(function(){var $img=$(this);var imgID=$img.attr('id');var imgClass=$img.attr('class');var imgURL=$img.attr('src');var alt=$img.attr('alt');$.get(imgURL,function(data){var $svg=$(data).find('svg');if(typeof imgID!=='undefined'){$svg=$svg.attr('id',imgID)} +if(typeof imgClass!=='undefined'){$svg=$svg.attr('class',imgClass+' replaced-svg')} +if(imgURL.search(/audio.svg/)&&alt){$svg=$svg.attr('alt',alt);$svg=$svg.prepend("<title>"+alt+"</title>")} +$svg=$svg.removeAttr('xmlns:a');if(!$svg.attr('viewBox')&&$svg.attr('height')&&$svg.attr('width')){$svg.attr('viewBox','0 0 '+$svg.attr('height')+' '+$svg.attr('width'))} +$img.replaceWith($svg)},'xml')});var touchsupport=('ontouchstart' in window)||(navigator.maxTouchPoints>0)||(navigator.msMaxTouchPoints>0) +if(!touchsupport){$('.play-pron, .anchor-list a, .widget-button, .widget-button svg, .ul-button, .ul-icon').addClass('hoverable')}};return module});define('stickyPopup',['jquery'],function($){"use strict";var module={};var el,name;var closePopup=function(){sessionStorage.setItem(name,"1");el.remove()} +module.init=function(){el=$("#mw-sticky-popup");if(el.length>0){name=el.data("name")||"stickyPopup";if(!!sessionStorage.getItem(name)===!1){el.show();el.on("click",".popup-close",closePopup)}else{el.remove()}}} +return module});define('wgtRelatedTo',['jquery','slick'],function($){"use strict";var module={};module.init=function(trackSrc){var container=$('.ritems');var itemsCount=$('.ritems').find('.ritem').length;var gaSRCTracker=trackSrc;var slickConfig={slidesToShow:2,touchThreshold:20,variableWidth:!1,slidesToScroll:1,infinite:!0,arrows:!0,appendArrows:".ritems-container",placeholders:!1,mobileFirst:!0,respondTo:'min',nextArrow:'<button type="button" class="rel-to-btn rel-to-next-btn"><i class="fa fa-angle-right"></i></button>',prevArrow:'<button type="button" class="rel-to-btn rel-to-prev-btn"><i class="fa fa-angle-left"></i></button>',responsive:[{breakpoint:696,settings:{slidesToShow:4,slidesToScroll:1,}},{breakpoint:522,settings:{slidesToShow:3,slidesToScroll:1,}}]};container.slick(slickConfig);$(".slick-prev",container).on("click",function(e){container.slick('slickPrev')});$(".slick-next",container).on("click",function(e){container.slick('slickNext')});container.find(".ritem-a").click(function(){var data={url:$(this).attr("href"),src:gaSRCTracker} +sessionStorage.setItem('gaSRCTracker',JSON.stringify(data))})};return module});define('socialSidebar',['jquery','waypoints','matchMedia'],function($){"use strict";var module={};module.init=function(selector){var mqMax768=window.matchMedia('screen and (max-width: 768px)');var stickySocial=$('.social-sidebar');if(!mqMax768.matches){var initialOffset,contentArea;contentArea=$('.left-content');initialOffset=$(".main-wrapper").offset().top;stickySocial.css({top:initialOffset});contentArea.waypoint(function(direction){if(direction=='down'){stickySocial.addClass('stickied');stickySocial.css({top:$('.shrinkheader').outerHeight()+30})}else if(direction=='up'){stickySocial.removeClass('stickied');stickySocial.css({top:$(".main-wrapper").offset().top})}},{offset:$('.shrinkheader').outerHeight()+30});if(!mqMax768.matches){var articleBottomStop=$(".seen-and-heard-block");articleBottomStop.waypoint(function(direction){if(direction=='down'){stickySocial.css({'visibility':'hidden',top:$('.shrinkheader').outerHeight()+30})}else if(direction=='up'){stickySocial.addClass('stickied');stickySocial.css({'visibility':'visible',})}},{offset:$('.shrinkheader').outerHeight()+stickySocial.outerHeight()})}} +$(document).on('facebook:loginStatus',function(event,response){require(['favorites'],function(favorites){favorites.favoritesWidget('#my-saved-words-icon')})});var updateTWShareLink=function(){var timeTraveler=$("#first-known-use-explorer a");if(timeTraveler.length>0){var twURL=timeTraveler.attr("href").split("?")[0]+"?src=defrecirc-timetraveler-sharebutton";stickySocial.find(".tw-icon a").attr("href",twURL)}} +if(location.pathname.indexOf("/dictionary/")>=0){updateTWShareLink()} +stickySocial.find(".cite-link").one("click.cite-load",function(e){e.preventDefault();var _this=$(this);var easybibLib=window.mwdata.assetsDomain2+'/mw/easybib/widget.min.js';$.getScript(easybibLib,function(){_this.html($('#EBwidget_container'));if(typeof(EBwidget)!=="undefined"){EBwidget.update("new")}})})};return module});define('rhymingSocialSidebar',['jquery','waypoints','matchMedia'],function($){"use strict";var module={};module.init=function(selector){var mqMax768=window.matchMedia('screen and (max-width: 768px)');if(1==1){var headerOffset,stickySocial,initialOffset,contentArea;stickySocial=$('.social-sidebar');contentArea=$('.left-content');initialOffset=$('.shrinkheader').outerHeight()+230;stickySocial.css({top:initialOffset});contentArea.waypoint(function(direction){if(direction=='down'){stickySocial.addClass('stickied');stickySocial.css({top:$('.shrinkheader').outerHeight()+30})}else if(direction=='up'){stickySocial.removeClass('stickied');stickySocial.css({top:$('.shrinkheader').outerHeight()+230})}},{offset:$('.shrinkheader').outerHeight()+30});if(!mqMax768.matches){var articleBottomStop=$(".global-footer");articleBottomStop.waypoint(function(direction){if(direction=='down'){stickySocial.css({'visibility':'hidden',top:$('.shrinkheader').outerHeight()+30})}else if(direction=='up'){stickySocial.addClass('stickied');stickySocial.css({'visibility':'visible',})}},{offset:$('.shrinkheader').outerHeight()+stickySocial.outerHeight()})}} +$(document).on('facebook:loginStatus',function(event,response){require(['favorites'],function(favorites){favorites.favoritesWidget('#my-saved-words-icon')})})};return module});define('wgtIncentiveAnchors',['jquery','gaTracker'],function($,gaTracker){"use strict";var module={};module.init=function(){$('.wgt-incentive-anchors').insertBefore($('#anchor-links-container'));$('#anchor-links-container').remove();$('.card-box a[data-link], .wgt-incentive-anchors a').each(function(index,anchor){$(anchor).click(function(event){event.preventDefault();var selector=$(this).attr('data-link');var module=$(selector).first();$('html, body').animate({scrollTop:module.offset().top-$('.shrinkheader').outerHeight()-25},'slow');var action=$(this).attr('data-tracking-action');var category=$(this).attr('data-tracking-category');var label=$(this).attr('data-tracking-label');var gaCmd=function(){ga('send','event',category,action,label)};gaTracker.execCmd(gaCmd)})})};return module});define('definitions',['jquery','adProcessor','ads2Refresher','matchMedia','isMobile','underscore','wodSwapper','trackInactive','waypoints'],function($,adProcessor,ads2Refresher,matchMedia,isMobile,_,wodSwapper,trackInactive){"use strict";var _def={};var scrollToCollapsedBox=function(elem){_def.collapsedBoxOffset=_def.collapsedBoxOffset||$('.shrinkheader').outerHeight(!0)+30;if(!elem.hasClass('open-container')){if(elem.closest('.container').length){elem=elem.closest('.container')} +var destination=elem.offset().top-_def.collapsedBoxOffset;var screenBody=(isMobile.any!==!0)?$("html, body"):$("body");screenBody.animate({scrollTop:destination},300)}};var toggleCardBoxes=function(boxClass,boxHeight){$(".small-box, .word-by-word-box").each(function(){var _this=$(this);if(_this.hasClass("toggle-box"))return;var toggleHtml='<div class="toggle-trigger"><p class="trigger-line"><span class="trigger-arrow"></span></p></div>';var thisHeight=_this.height();var innerHeight=_this.find(".inner-box-wrapper").height();if(innerHeight>(thisHeight+18)){_this.addClass("toggle-box").append(toggleHtml);_this.off("click",".toggle-trigger").on("click",".toggle-trigger",function(){_this.toggleClass("open-container");scrollToCollapsedBox(_this)})}else{if(_this.hasClass("toggle-box")){_this.find(".toggle-trigger").remove();_this.removeClass("toggle-box open-container")}}});$(".henhouse").each(function(){var _this=$(this);_this.off("click",".toggle-trigger").on("click",".toggle-trigger",function(){_this.toggleClass("open-container");scrollToCollapsedBox(_this)})})} +var mw_on_popscore=function(mwol_popularity_data){$('.popularity-block').html('<span>Popularity: '+mwol_popularity_data.label+'</span>').removeClass("hidden");$('.pop-update-wrapper .sep-bar').removeClass("hidden")};var loadPopularity=function(params){window.mw_on_popscore=window.mw_on_popscore||mw_on_popscore;$.getScript("https://stats.merriam-webster.com/pop-score-redesign.php?"+"word="+params.word+"&t="+(new Date().getTime())+"&id=popularity-score")};var scrollByHash=function(){var hashAnchor,headerHeight;if(location.hash.length>0){hashAnchor=$(location.hash+"-anchor");if(hashAnchor.length>0){window.hashScrolled=0;headerHeight=$('.shrinkheader').height();window.hashInterval=window.setInterval(function(){if(Math.abs(hashAnchor.offset().top-window.hashScrolled)>5){window.hashScrolled=hashAnchor.offset().top;$('html, body').animate({scrollTop:hashAnchor.offset().top-headerHeight-10},'fast')}},650);window.setTimeout(function(){window.clearInterval(window.hashInterval)},4000)}}} +var getSpeechLink=function(speechText){var link='',linkTo='';switch(speechText){case 'noun':case 'n':case 'plural noun':linkTo="noun";break;case 'verb':case 'vb':case 'imperative verb':case 'impersonal verb':linkTo="verb";break;case 'adv':case 'adverb':linkTo="adverb";break;case 'transitive':case 'transitive verb':linkTo="transitive";break;case 'auxiliary verb':linkTo="auxiliary%20verb";break;case 'conjunction':linkTo="conjunction";break;case 'adjective':case 'adj':linkTo="adjective";break;case 'preposition':linkTo="preposition";break;case 'interjection':linkTo="interjection";break;case 'prefix':linkTo="prefix";break;case 'plural pronoun':case 'pronoun':linkTo="pronoun";break;case 'indefinite article':linkTo="indefinite%20article";break;case 'intransitive':case 'intransitive verb':linkTo="intransitive";break;case 'collective mark':linkTo="collective%20mark";break;case 'certification mark':linkTo="certification%20mark";break;case 'service mark':linkTo="service%20mark";break;case 'abbreviation':linkTo="abbreviation";break;case 'symbol':linkTo="symbol";break;case 'trademark':linkTo="trademark";break;case 'definite article':linkTo="definite%20article";break;case 'auxiliary verb':linkTo="auxiliary%20verb";break} +if(linkTo!==''){link='<a class="important-blue-link" href="/dictionary/'+linkTo+'">'+speechText+'</a>'} +return link} +var LinkPartofSpeech=function(){$(".word-attributes, .blue-heading").each(function(){var $elements;if($(this).hasClass("word-attributes")){$elements=$(this).find(".main-attr").eq(0).find("em")}else{$elements=$(this)} +if($elements.length===0){return} +$elements.each(function(){var speechText,link=[],linkTo='',$element;$element=$(this);speechText=$element.text().toLowerCase().trim();if(speechText.indexOf('noun,')===0){linkTo="noun"}else if(speechText.indexOf('pronoun,')===0){linkTo="pronoun"}else if(speechText.indexOf('verb,')===0){linkTo="verb"}else if(speechText.indexOf('combining form')>=0){linkTo="combining%20form"}else if(speechText.indexOf('suffix')>=0){linkTo="suffix"} +if(linkTo!==''){link.push('<a class="important-blue-link" href="/dictionary/'+linkTo+'">'+speechText+'</a>')}else{speechText.split(" or ").forEach(function(item){var itemLink=getSpeechLink(item);if(itemLink!==''){link.push(itemLink)}})} +if(link.length>0){$element.html(link.join(" or "))}})})} +var customDefStyles=function(){$(".t",".syns-box").each(function(){$(this).before('<i class="bracket">⟨</i>');$(this).after('<i class="bracket">⟩</i>')});$("vi, .vis.aq",".usage-box").each(function(){$(this).prepend('<i class="bracket">⟨</i>');$(this).append('<i class="bracket">⟩</i>')})} +var fadeInExplorer=function(){$(".first-known-use-explorer").parent().waypoint({handler:function(direction){$(this.element).find(".explorer-wrapper").removeClass("hidden").addClass("animated fadeInUp50");this.destroy()},offset:'bottom-in-view-offset'});$(".first-use-box").waypoint({handler:function(direction){$(this.element).find(".explorer-wrapper").removeClass("hidden").addClass("animated fadeInUp50");this.destroy()},offset:'bottom-in-view-offset'});$(".origin-box").waypoint({handler:function(direction){$(this.element).addClass("open-container").find(".explorer-wrapper").removeClass("invisible").addClass("animated fadeInUp50");this.destroy()},offset:'bottom-in-view-offset'})} +var TWFixedHeader=function(){if(window.matchMedia('screen and (max-width: 767px)').matches){_def.waypointDown=new Waypoint({element:$(".wgt-def-trend-watch"),handler:function(direction){if(direction=="down"){$("#trend-watch-teaser-list").addClass("fixed");$(".wgt-def-trend-watch").addClass("fixed")}},offset:$(".shrinkheader").height()});_def.waypointUp=new Waypoint({element:$(".wgt-def-trend-watch"),handler:function(direction){if(direction=="up"){$("#trend-watch-teaser-list").removeClass("fixed");$(".wgt-def-trend-watch").addClass("fixed")}},offset:$(".wgt-def-trend-watch").offset().top-84})}} +var replaceSemiColon=function(){if(location.pathname.indexOf("/thesaurus/")>=0){$(".syn-block, .rel-block, .near-block, .ant-block").each(function(){$(this).html($(this).html().replace(/\;/g,'<p class="line-break"><\/p>'))})}} +var init=function(){var retoggleCardBoxes=_.debounce(toggleCardBoxes,100);customDefStyles();replaceSemiColon();retoggleCardBoxes();LinkPartofSpeech();$(window).resize(retoggleCardBoxes);scrollByHash();ads2Refresher.init();fadeInExplorer();wodSwapper.swapWidgets();TWFixedHeader();trackInactive.init()};var module={loadPopularity:loadPopularity,init:init};return module});define('videoLanding',['jquery','isMobile'],function($,isMobile){"use strict";var module={};module.init=function(){var isDesktop=isMobile.any!==!0;var scrollToCollapsedBox=function(elem){var collapsedBoxOffset=$('.shrinkheader').outerHeight(!0)+30;if(elem.hasClass('vopen')){}else{var cont=elem.closest('.container');var destination=cont.offset().top-collapsedBoxOffset;var screenBody=isDesktop?$("html, body"):$("body");screenBody.animate({scrollTop:destination},300)}};$(".v-toggle-trigger").on('click',function(){scrollToCollapsedBox($(this).closest('.v-toggle-box').toggleClass('vopen'))})};return module});define('videoPlay',['jquery','cmsImg','shareLinks','fbSdk','gaTracker','mwVideoAd','jwplayer','jqueryKnob','slick'],function($,cmsImg,shareLinks,fbSdk,gaTracker,mwVideoAd){"use strict";var jwPlayerDiv='video-placeholder';var videosArea=$(".vsp-area");var videoContainer=$(".video-container");var videoPlayerArea=$(".video-player");var videoPlayLink=$(".video-container .video-play-link");var videoNextLink=$(".video-container .video-next-link");var videoPlaceCont=$(".vp-cont");var videoPlace=$(".video-placeholder");var videoList=$('.vsp-area .video-list');var autoplayInput=$('.toggle-track input');var autoplayTrack=$('.toggle-track');window.jwplayer.key=window.mwdata.jwkey;var allVideos;var largeImagesData;var playerInstance=jwplayer(jwPlayerDiv);var playlist=[];var nextTimerCount=0;var nextIntervalId;var alreadyCounted=!1;var wasAutoplayed=!1;var adAlreadyPlayed=!1;var activeIndex=null;var playsCounter=0;var adTag="";var firstPlay=!0;var newPlaylist;var enableSidebar=function(){videoList.slick({"vertical":!0,"verticalSwiping":!0,"centerMode":!1,"slidesToShow":4,"slidesToScroll":1,"respondTo":"window","infinite":!1,"touchThreshold":20,"variableWidth":!1,"prevArrow":'<button type="button" class="vsp-btn vsp-prev-btn"></button>',"nextArrow":'<button type="button" class="vsp-btn vsp-next-btn"></button>',"responsive":[{"breakpoint":961,"settings":{"vertical":!1,"verticalSwiping":!1,"centerMode":!1,"slidesToShow":4,"slidesToScroll":1,"variableWidth":!1,"respondTo":"window","infinite":!0}},{"breakpoint":768,"settings":{"centerMode":!1,"vertical":!1,"verticalSwiping":!1,"slidesToShow":2,"slidesToScroll":1,"respondTo":"window","variableWidth":!1,"infinite":!0}}]});$(".video-item").on("click",function(e){e.preventDefault();var curIndex=$(this).data("video-index");if(nextIntervalId!==undefined){window.clearInterval(nextIntervalId);nextTimerCount=0} +wasAutoplayed=!1;updateActiveVideo(curIndex);startPlayback(curIndex)})};var instantiatePlayer=function(){if(firstPlay===!1){return} +for(var key in allVideos){if(allVideos.hasOwnProperty(key)){var vid=allVideos[key];var hosted=vid.hosted_video;var youtube=vid.youtube_video;var fileSrc=(hosted===null)?youtube:(window.mwdata.assetsDomain3+hosted);var largeImageData=largeImagesData[key];var imgSrc=cmsImg.getUrl(largeImageData,'vid-video-play-lg');var playlistItem={'image':imgSrc,'title':vid.name,'file':fileSrc+'?ec_rate=900','mediaid':vid.jw_id||"null"};if((vid.sub_file!==null)&&(vid.sub_file!=='')){var track={file:window.mwdata.assetsDomain1+"/mw/video-subtitles/"+vid.sub_file,label:"English",kind:"captions","default":!1};playlistItem.tracks=[track]} +playlist.push(playlistItem)}} +playerInstance.setup({advertising:{client:'googima',skipoffset:5},aspectratio:"16:9",autostart:!1,displaydescription:!0,displaytitle:!0,shuffle:!1,flashplayer:window.mwdata.jwPlayerPath+'jwplayer.flash.swf',mute:!1,playlist:[playlist[0]],preload:"none",primary:"html5",repeat:!1,stagevideo:!1,visualplaylist:!1,width:"100%",captions:{backgroundOpacity:50,fontSize:14,fontFamily:'"Open Sans",sans-serif'}});firstPlay=!1;playerInstance.on('beforePlay',function(e){if(e.startTime===null){playerInstance.playAd(adTag)}});playerInstance.on('complete',function(){playerInstance.stop();videoPlaceCont.addClass('hidden');if(autoplayTrack.hasClass('autoplay-on')){videoPlayLink.removeClass('is-visible');var enableCircle=playsCounter<4;showNextScreenOverlay(enableCircle)}else{videoPlayLink.addClass('is-visible')}});playerInstance.on('play',function(){var actInd=videosArea.find(".video-item.active").data("video-index");var vidData=allVideos[actInd];if(!alreadyCounted){alreadyCounted=!0;var request=$.ajax({"method":"POST","url":"/lapi/1/mwol-video/play/count","data":{'id':vidData.id}}).done(function(ajaxResponse){}).fail(function(jqXHR,textStatus){}).always(function(jqXHR,textStatus){})}});playerInstance.setAdTag=function(url){adTag=url}};var showNextScreenOverlay=function(enableCircle){var nextEl=videosArea.find(".video-item.active").next();if(nextEl.length===0){return} +var nextInd=nextEl.data("video-index");var vidData=allVideos[nextInd];var imData=largeImagesData[nextInd];videoNextLink.find('.n-title').html(vidData.name);var nextImg=cmsImg.render(imData,'vid-home-video-recent-lg');videoNextLink.find('img').replaceWith(nextImg);videoNextLink.find('.np-icon').attr('data-ind',nextInd);if(enableCircle){videoNextLink.find(".n-timer").html('<input type="text" value="0" class="n-timer-dial">');videoNextLink.find(".n-timer-dial").knob({'min':0,'max':5000,'readOnly':!0,"fgColor":"#AE0015",'bgColor':'rgba(0,0,0,0)','width':62,'height':62,'thickness':0.15,'displayInput':!1});if(nextIntervalId!==undefined){window.clearInterval(nextIntervalId);videoNextLink.find(".n-timer-dial").val(0).trigger('change')} +nextIntervalId=window.setInterval(function(){nextTimerCount=nextTimerCount+20;if(nextTimerCount<5000){videoNextLink.find(".n-timer-dial").val(nextTimerCount).trigger('change')}else{videoNextLink.find(".n-timer-dial").val(5000).trigger('change');window.clearInterval(nextIntervalId);nextTimerCount=0;videoNextLink.removeClass('is-visible');videoNextLink.find(".n-timer").html('');wasAutoplayed=!0;var nid=videoNextLink.find('.np-icon').attr('data-ind');updateActiveVideo(nid);startPlayback(nid)}},20)} +var ncan=videoNextLink.find('.n-cancel');if(!ncan.hasClass('nc-enabled')){ncan.addClass('nc-enabled');ncan.on('click',function(e){e.preventDefault();window.clearInterval(nextIntervalId);nextTimerCount=0;videoNextLink.find(".n-timer").html('')})} +var ncl=videoNextLink.find('.n-close');if(!ncl.hasClass('nc-enabled')){ncl.addClass('nc-enabled');ncl.on('click',function(e){e.preventDefault();if(nextIntervalId!==undefined){window.clearInterval(nextIntervalId);nextTimerCount=0} +videoNextLink.removeClass('is-visible');videoPlayLink.addClass('is-visible')})} +var ntim=videoNextLink.find('.n-timer');if(!ntim.hasClass('nc-enabled')){ntim.addClass('nc-enabled');ntim.on('click',function(e){e.preventDefault();window.clearInterval(nextIntervalId);nextTimerCount=0;videoNextLink.find(".n-timer").html('');wasAutoplayed=!1;var nid=videoNextLink.find('.np-icon').attr('data-ind');updateActiveVideo(nid);startPlayback(nid)})} +videoNextLink.addClass('is-visible')};var enableAutoplayButton=function(){autoplayTrack.on("click",function(){if(autoplayInput.is(':checked')){autoplayTrack.toggleClass('autoplay-on')}})};var startPlayback=function(ind){if(!wasAutoplayed){playsCounter=0}else{playsCounter++} +newPlaylist=[playlist[ind]];var playVideo=function(adURL){playerInstance.setAdTag(adURL);playerInstance.load(newPlaylist);playerInstance.play();videoPlayLink.removeClass('is-visible');videoNextLink.removeClass('is-visible');videoPlayLink.removeClass('in-progress');videoPlaceCont.removeClass('hidden')} +mwVideoAd.init(playVideo)};var enablePlayLink=function(){videoPlayLink.on("click",function(e){e.preventDefault();if(videoPlayLink.hasClass('in-progress')){return} +videoPlayLink.addClass('in-progress');var currentInd=videoContainer.attr('data-ind');updateActiveVideo(currentInd);startPlayback(currentInd)})};var updateActiveVideo=function(ind){var imData=largeImagesData[ind];var vidData=allVideos[ind];videosArea.find('.fb.share-link').attr('data-share-url',vidData.meta.og['og:url']).attr('data-share-image',vidData.meta.og['og:image']).attr('data-share-title',vidData.meta.og['og:title']).attr('data-share-description',vidData.meta.og['og:description']);videosArea.find('.twitter.share-link').attr('data-share-url',vidData.meta.twitter['twitter:url']);videosArea.find('.twitter.share-link').attr('data-share-text',vidData.meta.twitter['twitter:share-text']);shareLinks.init(videosArea.find('.fb.share-link'));shareLinks.init(videosArea.find('.twitter.share-link'));videosArea.find('.fb-comments').attr('data-href',vidData.meta.comments_id);document.title=vidData.meta.title;var gaCmd=function(){var urlToTrack="/video/"+vidData.slug;ga('send','pageview',urlToTrack)};gaTracker.execCmd(gaCmd);var fbCmd=function(){FB.XFBML.parse()};fbSdk.execCmd(fbCmd);if(activeIndex!==ind){adAlreadyPlayed=!1} +activeIndex=ind;var sidebarItem=videosArea.find('.video-item[data-video-index="'+ind+'"]');var sidebarItemAct=videosArea.find(".video-item.active");var videoPlayerTitle=videosArea.find(".item-text-title");var videoPlayerBlurb=videosArea.find(".item-text-subtitle");var videoPlayerViewCount=videosArea.find(".views-count");var videoPlayerImage=videosArea.find(".video-play-link img");var videoPlayerFeaturing=videosArea.find(".featuring-a");var videoPlayerBody=videosArea.find(".video-body");sidebarItemAct.removeClass("active");sidebarItem.addClass("active");var lgImg=cmsImg.render(imData,'vid-home-video-recent-lg');videoPlayerImage.replaceWith(lgImg);videoPlayerTitle.html(vidData.name);videoPlayerBlurb.html(vidData.teaser);if(parseInt(vidData.vc.toString().replace(/,/g,''))<5000){videoPlayerViewCount.html('<span class="new">New!</span>')}else{videoPlayerViewCount.html(vidData.vc+' views')} +videoPlayerBody.html(vidData.body);if(vidData.aPublic){var fEl=$('<b></b>');fEl.attr('class','featuring-a');fEl.html(vidData.aName)}else{var fEl=$('<b></b>');fEl.attr('class','featuring-a');fEl.html(vidData.aName)} +videoPlayerFeaturing.replaceWith(fEl);videoContainer.attr('data-ind',ind);var currentSlide=videoList.slick('slickCurrentSlide');if((ind-currentSlide)>3){videoList.slick('slickNext')} +if(window.history){window.history.pushState("",vidData.page_title,"/video/"+vidData.slug)} +alreadyCounted=!1};var module={};module.init=function(vs,ims){allVideos=vs;largeImagesData=ims;instantiatePlayer();enableSidebar();enableAutoplayButton();enablePlayLink()};return module});define('videoPlayer',['jquery','cmsImg','fbSdk','gaTracker','mwVideoAd','jwplayer','jqueryKnob','slick'],function($,cmsImg,fbSdk,gaTracker,mwVideoAd){"use strict";var jwPlayerDiv='video-placeholder';var videosArea=$(".vsp-area");var videoContainer=$(".video-container");var videoPlayerArea=$(".video-player");var videoPlayLink=$(".video-container .video-play-link");var videoNextLink=$(".video-container .video-next-link");var videoPlaceCont=$(".vp-cont");var videoPlace=$(".video-placeholder");var videoList=$('.vsp-area .video-list');var autoplayInput=$('.toggle-track input');var autoplayTrack=$('.toggle-track');window.jwplayer.key=window.mwdata.jwkey;var allVideos;var largeImagesData;var playerInstance;var playlist=[];var nextTimerCount=0;var nextIntervalId;var alreadyCounted=!1;var wasAutoplayed=!1;var adAlreadyPlayed=!1;var activeIndex=null;var playsCounter=0;var adTag="";var newPlaylist;var instantiatePlayer=function(){playerInstance=jwplayer(jwPlayerDiv);for(var key in allVideos){if(allVideos.hasOwnProperty(key)){var vid=allVideos[key];var hosted=vid.hosted_video;var youtube=vid.youtube_video;var fileSrc=(hosted===null)?youtube:(window.mwdata.assetsDomain3+hosted);var largeImageData=largeImagesData[key];var imgSrc=cmsImg.getUrl(largeImageData,'vid-video-play-lg');var playlistItem={'image':imgSrc,'title':vid.name,'file':fileSrc+'?ec_rate=900','mediaid':vid.jw_id||"null"};if((vid.sub_file!==null)&&(vid.sub_file!=='')){var track={file:window.mwdata.assetsDomain1+"/mw/video-subtitles/"+vid.sub_file,label:"English",kind:"captions","default":!1};playlistItem.tracks=[track]} +playlist.push(playlistItem)}} +playerInstance.setup({advertising:{client:'googima',skipoffset:5},aspectratio:"16:9",autostart:!1,displaydescription:!0,displaytitle:!0,shuffle:!1,flashplayer:window.mwdata.jwPlayerPath+'jwplayer.flash.swf',mute:!1,playlist:[playlist[0]],preload:"none",primary:"html5",repeat:!1,stagevideo:!1,visualplaylist:!1,width:"100%",captions:{backgroundOpacity:50,fontSize:14,fontFamily:'"Open Sans",sans-serif'}});playerInstance.setAdTag=function(url){adTag=url} +playerInstance.on('beforePlay',function(e){if(e.startTime===null){playerInstance.playAd(adTag)}});playerInstance.on('complete',function(){console.log('complete playsCounter',playsCounter);playerInstance.stop();videoPlaceCont.addClass('hidden');if(autoplayTrack.hasClass('autoplay-on')){videoPlayLink.removeClass('is-visible');var enableCircle=playsCounter<4}else{videoPlayLink.addClass('is-visible')}});playerInstance.on('play',function(){var vidData=allVideos[0];if(!alreadyCounted){alreadyCounted=!0;var request=$.ajax({"method":"POST","url":"/lapi/1/mwol-video/play/count","data":{'id':vidData.id}}).done(function(ajaxResponse){}).fail(function(jqXHR,textStatus){}).always(function(jqXHR,textStatus){})}})};var startPlayback=function(ind){if(!wasAutoplayed){playsCounter=0}else{playsCounter++} +newPlaylist=[playlist[ind]];var playVideo=function(adURL){playerInstance.setAdTag(adURL);playerInstance.load(newPlaylist);playerInstance.play();videoPlayLink.removeClass('is-visible');videoNextLink.removeClass('is-visible');videoPlayLink.removeClass('in-progress');videoPlaceCont.removeClass('hidden')} +mwVideoAd.init(playVideo)};var enablePlayLink=function(){videoPlayLink.on("click",function(e){e.preventDefault();if(videoPlayLink.hasClass('in-progress')){return} +videoPlayLink.addClass('in-progress');var currentInd=videoContainer.attr('data-ind');startPlayback(currentInd)})};var module={};module.init=function(vs,ims){allVideos=vs;largeImagesData=ims;instantiatePlayer();enablePlayLink()};return module});define('newQuizPlay',['jquery','gaTracker','trackHeapEvents','shareLinks','isMobile','cmsImg','mdParser','utils','wgtGamesNext0','text!/tpls/question.html','text!/tpls/result.html','adProcessor','agePopup','quizs','jqueryCookie','jqueryShorten','matchMedia','slick','counter','jqueryCountdown','remodal'],function($,gaTracker,trackHeapEvents,shareLinks,isMobile,cmsImg,mdParser,utils,wgtGamesNext0,qHtml,rHtml,adProcessor,agePopup,quizs){"use strict";var module={};module.quizId=undefined;var isDesktop=(isMobile.any!==!0);var windowHeight=$(window).outerHeight();var isComplex=null;var intitialQuestion=null;var intitialAnswer=null;var isTimed=null;var countd=null;var quizTimeoutId;var countdActive=!1;var quizNextQuestionTriggeredOnce=!0;var quizSlug='';var quizName="";var isSpellIt=!1;var isTrueFalse=!1;var questionWrapper=$('.qs-wrap');var reviewModal=null;var leaderModal=null;var enterLeader=null;var timerContainer=$(".timer-container");var timerInfo=$(".quiz-timer-info");var quizTimer=!0;quizs.setData({});function wait(callback,seconds){var tId=window.setTimeout(callback,seconds*1000);return tId} +var startTimer=function(question){var remainingTime=question.find(".remaining-time");var timerMessage=question.find(".timer-message");quizTimeoutId=undefined;countdActive=!1;quizTimeoutId=wait(function(){countdActive=!0;countd=remainingTime.countdown({until:remainingTime.attr("data-time-remaining"),padZeroes:!0,format:"S",layout:":{snn}",compact:!0,onTick:function(periods){var seconds=periods[6];if(typeof seconds!==undefined){if(seconds===5){remainingTime.addClass("time-running-out")}}},onExpiry:function(){timerMessage.text("TIME’S UP");var questionId=question.attr('data-question-id');checkAnswer(questionId,'',0)}})},0.5)};var stopTimer=function(question){var remainingTime=question.find(".remaining-time");remainingTime.countdown('pause')};var spellItQuestion=function(questionText,nextQuestion){var inputWidth=(questionText.length)*24+12;var question_text=$('<div class="question text-question spell-it-question">').append($('<p class="play">').append($('<div>').append(document.createTextNode('Hear It: ')).append($('<a href="#" class="play-pron">').attr('data-lang','en_us').attr('data-type','spell_it').attr('data-file',questionText).html('PLAY').click(function(event){if(typeof($(this).data('clickedOnce'))=='undefined'){$(this).parents('p').find('input').attr('disabled',!1).focus();$(this).data('clickedOnce',!0)}}).on("canplay",function(){window.setTimeout(function(){startTimer(nextQuestion)},1.5)}))).append($('<div class="answer-div">').html('Spell It: ').append('<div class="spell-it-input" style="width: '+(inputWidth-13)+'px;"><input data-aid="'+questionText+'" type="text" size="'+questionText.length+'" maxlength="'+questionText.length+'" disabled="disabled" style="min-width: '+inputWidth+'px;" /><div class="tail" style="left:'+(inputWidth+18)+'px;"></div></div>').addClass('length'+questionText.length)));question_text.find('input').keyup(function(event){if(event.keyCode==13&&this.value.trim()!==''){event.preventDefault();nextQuestion.find('.choice-1').removeClass('disabled').click();return !1}else{if(this.value!==''){nextQuestion.find('.choice-1').removeClass('disabled').data('inputTyped',!0)}else{nextQuestion.find('.choice-1').addClass('disabled').data('inputTyped',!1)}}});return question_text};var reviewAnswers=function(){var item,selectedChoice,badgeContent=$(".badge-container"),yourScore=$("#your-score"),answersContent=$("#review-answers-list"),questiongStage=$(".question-gstage"),showAdIndex=(questiongStage.length>4)?4:(questiongStage.length-2);var adSlotModal='slot-quiz-modal';var admdl=JSON.parse(JSON.stringify(window.mwdata.ads['slot-modal']));window.mwdata.ads[adSlotModal]=admdl;answersContent.empty();if(window.location.pathname.indexOf("/name-that-thing")>=0){answersContent.addClass("name-that-thing-list")} +questiongStage.each(function(index){var hasNoText=!1;item=$("<li class='clearfix'></li>");if(index===0){item.append('<span class="numbering one">'+(index+1)+'</span>')}else if(index>=9){item.append('<span class="numbering tens">'+(index+1)+'</span>')}else{item.append('<span class="numbering">'+(index+1)+'</span>')} +hasNoText=($(this).find(".question").text().length===0)?' has-no-text':'';item.append('<div class="question-copy">'+$(this).find(".question").html()+'</div>');selectedChoice=$(this).find(".selected");if(selectedChoice.hasClass("correct-choice")){item.append('<div class="answer-choice answer-correct'+hasNoText+'"><span class="answer-icon iconcheckmark"></span>'+selectedChoice.text()+'</div>')}else if(selectedChoice.hasClass("wrong-choice")){item.append('<div class="answer-choice answer-wrong'+hasNoText+'"><span class="answer-icon iconwrong"></span>'+selectedChoice.text()+'</div>');item.append('<div class="correct-answer">correct: '+$(this).find(".correct-choice").text()+'</div>')}else{item.append("<div class='answer-choice answer-wrong"+hasNoText+"'><span class='answer-icon iconstopclock'></span>Time's Up</div>");item.append('<div class="correct-answer">correct: '+$(this).find(".correct-choice").text()+'</div>')} +if($(this).find(".answer-description-block p").length>0){if($(this).find(".answer-description-block .allcontent").length>0){item.append('<div class="info-text">'+$(this).find(".answer-description-block .allcontent").html()+'</div>')}else{item.append('<div class="info-text">'+$(this).find(".answer-description-block p").html()+'</div>')}} +answersContent.append(item);if(index===showAdIndex){answersContent.append('<li class="clearfix review-modal-creative"><div class="abl abl-300-250-nr"><div class="slot-quiz-modal"></div></div></li>')}});yourScore.find(".my-score").text(badgeContent.find(".user-score").text());yourScore.find(".total-score").text(badgeContent.find(".total-score-possible").text());yourScore.find(".total-correct").text(badgeContent.find(".of-correct").text()+" correct!");yourScore.find(".avg-score").text("(Average: "+badgeContent.find(".avg-points").text()+badgeContent.find(".avg-points-txt").text()+")");adProcessor.renderDfp(adSlotModal,'.'+adSlotModal)};var getDifficulty=function(diffKey){var diff={name:'medium',level:2} +if(diffKey===null){return diff} +switch(diffKey.toLowerCase()){case 'level-1':diff.name='easy';diff.level=1;break;case 'level-2':break;case 'level-3':diff.name='hard';diff.level=3;break;case 'level-4':diff.name='hardest';diff.level=4;break} +return diff} +var renderQuestion=function(qData){var jqQuestion=$(qHtml);var difficulty=getDifficulty(qData.diff_key);if(location.pathname.indexOf('/vocabulary')>=0){qData.question=(qData.question.indexOf('synonym')>=0)?qData.question:"Which is a synonym of <b>"+qData.question+"</b>?"} +if(qData.imageData!==null){qData.imageData.alt='';var isImageAndText=(qData.question!==undefined)&&(qData.question!==null)&&(qData.question!=='');if(isImageAndText){jqQuestion.find('.question').addClass('image-text-question').append(cmsImg.render(qData.imageData));var supplQuestion=$('<div class="extra-question"></div>');var questionText=replaceQuizAudioToken(qData.question);supplQuestion.html(mdParser(questionText,!0));jqQuestion.find('.question').append(supplQuestion)}else{jqQuestion.find('.question').addClass('image-question').append(cmsImg.render(qData.imageData))}}else if(isSpellIt){jqQuestion.find('.question').append(spellItQuestion(qData.question,jqQuestion));var onclick=function(){};jqQuestion.find('.choices').addClass("choices-spell-it").append($('<a>').addClass('choice choice-1 disabled').data('answer',qData.question).attr("data-level",difficulty.level).attr('href','#').html('SUBMIT').click(onclick))}else{jqQuestion.find('.question').addClass('text-question').append(mdParser(replaceQuizAudioToken(qData.question)))} +if(quizTimer&&isTimed){jqQuestion.find('.remaining-time').attr('data-time-remaining','+'+quizs.get('timer')+'s').html(':'+quizs.get('timer'))}else{if(quizTimer){jqQuestion.find('.play-stats').addClass('has-two');jqQuestion.find('.play-stats').find('.play-stat-time-section').remove()}else{jqQuestion.find('.play-stats').find('.play-stat-time-section').replaceWith('<div class="play-stat timer-off"><div class="timer-off-wrapper">TIMER: <span class="timer-off-text">OFF</span></div></div>')}} +if(!isComplex){jqQuestion.find('.avg-points-txt').css('display','none');jqQuestion.find('.stat-points-text').html('CORRECT');jqQuestion.find('.mobile-stat-points-text').html('CORR');jqQuestion.find('.play-level').css('visibility','hidden')} +jqQuestion.find('.current-screen').html(quizs.get('currentScreen'));jqQuestion.find('.total-screens').html(quizs.get('totalScreens'));jqQuestion.find('.play-level').find("."+difficulty.name).addClass("active");var qAnswers=(isTrueFalse&&qData.answers[0].answer.toLowerCase()==='false')?qData.answers.reverse():qData.answers;qAnswers.forEach(function(qAnswer,anum){var a=$('<a class = "choice" data-correct="" data-level="" data-aid = "" href = ""></a>');a.addClass('choice-'+(anum+1)).attr('data-aid',qAnswer.id).attr('data-correct',qAnswer.is_correct).attr("data-level",difficulty.level).attr('href','/word-games/'+jqQuestion.slug+'#'+qAnswer.answer).html(qAnswer.answer+' <div class="status-cont"><i class="choice-status"></i></div>').appendTo(jqQuestion.find('.choices'))});if(quizs.get('currentScreen')>=(quizs.get('totalScreens'))){jqQuestion.find('.more-link').addClass('see-results').text('SEE YOUR RESULT')}else{jqQuestion.find('.more-link').addClass('next-question').text('NEXT QUESTION')} +jqQuestion.attr('data-question-id',qData.id);jqQuestion.addClass('qid-'+qData.id);jqQuestion.css("min-height",windowHeight-$(".shrinkheader").outerHeight());return jqQuestion};var constructResult=function(resultData){var jqResult=$(rHtml);if(resultData.isLegacy){jqResult.find('.game-nav-links').find('li').eq(1).find('a').html('try another one')} +jqResult.find('.user-score').html(resultData.ourScore);jqResult.find('.total-score-possible').html(resultData.maxPossibleScore);jqResult.find('.of-correct').html(resultData.correctAnswers+'/'+resultData.totalAnswers);jqResult.find('.avg-points').html(resultData.avg);jqResult.find('.my-rank').html(resultData.rank);if(resultData.rank>50){jqResult.find('.rank-description').find('h2').css('display','none')} +jqResult.find('.my-percentile').html(resultData.myPercentFive);if(resultData.myPercentFive>50&&resultData.rank>50){jqResult.find('.youre-in-the-top').hide()} +if(resultData.responseBlock!==null){var qresp=mdParser(resultData.responseBlock);jqResult.find('.md-percent-response').html(qresp)}else{jqResult.find('.md-percent-response').css('visibility','hidden')} +if(!isComplex){jqResult.find('.scome-th').html('# Correct / # Total')} +var agePopupWgt;jqResult.find('.age-compare a').on('click',function(e){e.preventDefault();if(!agePopupWgt){var ageOptions={quizType:'new',quizId:module.quizId,maxScore:resultData.maxPossibleScore,score:resultData.ourScore};agePopupWgt=agePopup.create(ageOptions)} +agePopupWgt.open()});quizName=quizName.replace(/[\*_]/g,'');var share_text="I scored "+resultData.ourScore+" out of "+resultData.maxPossibleScore+" on "+quizName+"! from @MerriamWebster";shareLinks.init(jqResult.find('.fb.share-link').attr('data-share-url',$('head').find("meta[property='og:url']").attr('content')).attr('data-share-image',$('head').find("meta[property='og:image']").attr('content')).attr('data-share-title',share_text).attr('data-share-description',''));shareLinks.init(jqResult.find('.twitter.share-link').attr('data-share-url',$('head').find("meta[name='twitter:url']").attr('content')).attr('data-share-text',share_text).attr('data-share-image',$('head').find("meta[name='twitter:image']").attr('content')));populateLeaderboards(jqResult);return jqResult};var renderAdsInQuestion=function(nextQuestion){window.mwdata.adsQuizCount++;var mobileM=(window.matchMedia('screen and (max-width: 767px)').matches)?"M":"";var adSlotNameLeft='slot-quiz-'+window.mwdata.adsQuizCount+'-left';var adSlotNameRight='slot-quiz-'+window.mwdata.adsQuizCount+'-right';var adcl=JSON.parse(JSON.stringify(window.mwdata.ads['slot-ltpl']));var adcr=JSON.parse(JSON.stringify(window.mwdata.ads['slot-rtpl']));adcl.data.targeting=[['POS',['M'+adcl.data.sizeMap[0].toString().replace(",","")+mobileM+'TOP'+window.mwdata.adsQuizCount]]];adcr.data.targeting=[['POS',['M'+adcr.data.sizeMap[0].toString().replace(",","")+mobileM+'BOT'+window.mwdata.adsQuizCount]]];window.mwdata.ads[adSlotNameLeft]=adcl;window.mwdata.ads[adSlotNameRight]=adcr;nextQuestion.find('.q-left-creative').find('.ad-liner').addClass(adSlotNameLeft);nextQuestion.find('.q-right-creative').find('.ad-liner').addClass(adSlotNameRight);adProcessor.renderDfp(adSlotNameLeft,'.'+adSlotNameLeft);adProcessor.renderDfp(adSlotNameRight,'.'+adSlotNameRight)};var replaceQuizAudioToken=function(text){var audioTknPattern=/(\{audio:([^\}]+)\})/g;var matches;while(matches=audioTknPattern.exec(text)){var params=matches[2].split(':');var file=params.length>=1?params[0]:'';var path=params.length>1?params[1]:'';var lang=params.length>2?params[2]:'en_us';if(path==''){path=file.substring(0,1);if(/^gg.*/.test(file)){path='gg'}else if(/^bix.*/.test(file)){path='bix'}else if(/^[0-9]+.*/.test(file)){path='number'}else if(/^_.*/.test(file)){path='number'}} +var link='<a class="play-pron converted" '+'data-lang="'+lang+'" '+'data-file="'+file+'" '+'data-dir="'+path+'" href="#">play <span class="play-box"> </span></a>';text=text.split(matches[1]).join(link)} +return text};var getAnswertext=function(qid,aid){var i,allAnswers;allAnswers=quizs.get('allAnswers')[qid].answers;for(i=0;i<allAnswers.length;i++){if(allAnswers[i].id==aid){return(typeof(allAnswers[i].response)!=="undefined")?allAnswers[i].response:''}}} +var checkAnswer=function(qid,aid,tl){var spellItAnswer,allChoices,selectedChoice,diffLevel,currentPoints;var currentQuestion=questionWrapper.find('.show-screen');var answerCorrect=!1;var questionPoints={points:0,bonus:0} +allChoices=currentQuestion.find('.choice').addClass('already-answered');if(!isSpellIt){if(aid!==null){selectedChoice=currentQuestion.find('[data-aid="'+aid+'"]');selectedChoice.addClass('selected')} +answerCorrect=!!((aid!==null)&&selectedChoice.attr("data-correct")==="1")}else{spellItAnswer=currentQuestion.find('input').data('aid').toLowerCase();answerCorrect=(currentQuestion.find('input').val().toLowerCase()===spellItAnswer)?!0:!1;selectedChoice=currentQuestion.find(".choice-1")} +if(answerCorrect){quizs.set('correctAnswers',quizs.get('correctAnswers')+1);diffLevel=parseInt(selectedChoice.attr("data-level"));if(isTimed){questionPoints=calculateScore(diffLevel,tl)}else{questionPoints=calculateScore(diffLevel,0)} +if(isSpellIt){selectedChoice.html('Correct')} +selectedChoice.addClass('correct-choice')}else{if(!isSpellIt){selectedChoice.addClass('wrong-choice')}else{selectedChoice.html("<div class='choice-text'>Sorry, the correct answer is:</div><div class='choice-answer'>"+spellItAnswer+"</div>").addClass('wrong-choice')}} +currentQuestion.find('[data-correct="1"]').addClass('correct-choice');currentPoints=currentQuestion.find('.total-points').attr('data-points');quizs.set('totalScore',quizs.get('totalScore')+questionPoints.points+questionPoints.bonus);var resultData={points:questionPoints.points,bonus:questionPoints.bonus,response:quizs.get('allAnswers')[qid].response} +if(!!resultData.response===!1){resultData.response=getAnswertext(qid,aid)} +var pointsBeforeBonus=quizs.get('totalScore')-resultData.bonus;currentQuestion.find('.total-points').html(pointsBeforeBonus).attr('data-points',pointsBeforeBonus).attr('data-possible-points',resultData.bonus);var isMobile=window.matchMedia('screen and (max-width: 767px)').matches;if(isMobile){allChoices.not(".wrong-choice, .correct-choice").hide()} +allChoices.filter(".wrong-choice").addClass("animated headShake");allChoices.filter(".correct-choice").addClass("animated pulse");if(resultData.response){var response=replaceQuizAudioToken(resultData.response);var resDiv=$('<div class="answer-description-block animated fadeInDown"></div>');resDiv.html(mdParser(response)).append('<div class="arrow-down"></div>');if(isMobile){resDiv.find("p").shorten({showChars:65,moreText:"more"})} +resDiv.find('a').attr('target','_blank').attr('rel','noopener');resDiv.insertAfter(currentQuestion.find('.choices'))} +currentQuestion.find(".more-link").addClass("visible animated fadeInUp");currentQuestion.find('.bonus-points').html('+'+resultData.bonus);if(resultData.bonus!==0){var playStatTimeSection=currentQuestion.find(".play-stat-time-section");var front=playStatTimeSection.find('.front');var back=playStatTimeSection.find('.back');wait(function(){front.addClass("flipped");back.addClass("flipped");wait(function(){front.removeClass("flipped");back.removeClass("flipped")},2.5)},1)} +var totalPoints=currentQuestion.find(".total-points");var pointsShowCb=function(){totalPoints.counter({autoStart:!0,duration:250,easing:"easeOutCubic",countFrom:+totalPoints.attr("data-points"),countTo:+totalPoints.attr("data-points")+ +totalPoints.attr("data-possible-points"),runOnce:!0})};if(resultData.bonus!==0){wait(pointsShowCb,2)}else{pointsShowCb()} +if(isMobile.any){setTimeout(function(){var nextLink=currentQuestion.find('.more-link');var offset=nextLink.offset().top+nextLink.height();var completed=!1;$('html, body').stop(!0,!0).animate({scrollTop:offset},{queue:!0,complete:function(){if(!completed){nextLink.addClass('bounce');completed=!0}}})},1000)}} +var saveMyInitials=function(initials){var dataForSave={'initials':initials};var promise=$.ajax({url:'/lapi/v1/mwol-games/quiz-session/initials/save',type:'POST',data:quizs.getSave(dataForSave)});return promise};var populateLeaderboards=function(jqResult){console.log('populateLeaderboards',jqResult,jqResult,jqResult.find('.lg-board'),jqResult.find('.sm-board'));$('.lg-board').html('');jqResult.find('.sm-board').html('');$.ajax({url:'/lapi/v1/mwol-games/quiz/scores/get',type:'GET',data:{}}).done(function(ajaxResponse){var top25Data=ajaxResponse.data.top25;var rank=ajaxResponse.data.rank;var maxScore=ajaxResponse.data.maxScore;var r=0;for(var key in top25Data){if(top25Data.hasOwnProperty(key)){var rec=top25Data[key];r++;var tr=$('<tr></tr>');$('<td class="game-rank"></td>').html(r).appendTo(tr);$('<td class="name"></td>').html(rec.name).appendTo(tr);$('<td></td>').html(isComplex?rec.score:(rec.score+' / '+maxScore)).appendTo(tr);$('<td></td>').html(rec.time).appendTo(tr);if(rank==r){tr.attr('id','user-rank-position');tr.addClass('user-rank-position')} +tr.appendTo($('.lg-board'));if(r<=3){var trc=tr.clone(!0,!0);trc.appendTo(jqResult.find('.sm-board'))}}}})};var displayQuestion=function(questionData,isNext,triggerAnswer){if(isNext){var currentQuestion=questionWrapper.find('.show-screen');currentQuestion.find(".play-metadata").addClass("fade-out");currentQuestion.find(".more-link").fadeOut();currentQuestion.removeClass("show-screen").addClass("seen-screen")} +var nextQuestion=renderQuestion(questionData);questionWrapper.append(nextQuestion);nextQuestion.addClass('show-screen');nextQuestion.find(".more-link").css('visibility','hidden');nextQuestion.find('.total-points').html(quizs.get('totalScore')).attr('data-points',quizs.get('totalScore'));var tries=0;var isMobile=window.matchMedia('screen and (max-width: 767px)').matches;for(;;){var boxHeight=nextQuestion.find('.question').outerHeight();var fontSize=parseInt(nextQuestion.find('.question p').css('font-size'));var lineHeight=parseInt(nextQuestion.find('.question p').css('line-height'));if((isMobile&&(boxHeight==180))||(!isMobile&&(boxHeight==210))){break} +tries++;if(tries>100){break}} +var url=quizSlug+'/question'+quizs.get('currentScreen');var gaCmd=function(){if(typeof(window.mwdata.contentType1)!='undefined'&&window.mwdata.contentType1!=null){ga('set','contentGroup1',window.mwdata.contentType1)} +if(typeof(window.mwdata.contentType2)!='undefined'&&window.mwdata.contentType2!=null){ga('set','contentGroup2',window.mwdata.contentType2)} +if(typeof(window.mwdata.contentType3)!='undefined'&&window.mwdata.contentType3!=null){ga('set','contentGroup3',window.mwdata.contentType3)} +ga('send','pageview',url)};gaTracker.execCmd(gaCmd);trackHeapEvents.trackPageView('quizPVs',{pvs:1});renderAdsInQuestion(nextQuestion);var offset=nextQuestion.offset().top-$(".shrinkheader").outerHeight();var screenBody=$("html, body").stop(!0,!0);quizNextQuestionTriggeredOnce=!1;screenBody.animate({scrollTop:offset},{queue:!0,complete:function(){if(!quizNextQuestionTriggeredOnce){if(isTimed&&!triggerAnswer){if(!isSpellIt){startTimer(nextQuestion)};nextQuestion.find(".play-metadata, .choices").addClass("fade-in")}else{nextQuestion.find(".play-metadata, .choices").addClass("fade-in")} +if(triggerAnswer){nextQuestion.find('[data-aid="'+intitialAnswer+'"]').trigger('click')}} +quizNextQuestionTriggeredOnce=!0}})} +var showNextQuestion=function(isNext,triggerAnswer){quizs.get('qIds') +var qID=quizs.get('qIds')[quizs.get('currentScreen')-1];var questionData=quizs.get('allAnswers')[qID];questionData.imageData=(quizs.get('imageData')[qID]===null||quizs.get('imageData')[qID]===undefined)?null:quizs.get('imageData')[qID];displayQuestion(questionData,isNext,triggerAnswer);quizs.set('currentScreen',quizs.get('currentScreen')+1)};var showResults=function(){var dataForFinal={score:quizs.get('totalScore'),totalAnswers:quizs.get('totalScreens'),correctAnswers:quizs.get('correctAnswers')};$.ajax({url:'/lapi/v1/mwol-games/quiz/finalize',type:'POST',data:quizs.getFinal(dataForFinal)}).done(function(ajaxResponse,status,xhr){var resultData=ajaxResponse.data;if(resultData.isLegacy){var prev=resultData.quizCode+'_prevscore';var date=resultData.quizCode+'_prevdate';var hscore=resultData.quizCode+'_highscore';var hs=0;if($.cookie(hscore)!==undefined){hs=$.cookie(hscore)} +$.cookie(prev,resultData.ourScore);$.cookie(date,Date.now());$.cookie(hscore,resultData.ourScore>hs?resultData.ourScore:hs)} +var url=quizSlug+'/finalscore';var gaCmd=function(){if(typeof(window.mwdata.contentType1)!='undefined'&&window.mwdata.contentType1!=null){ga('set','contentGroup1',window.mwdata.contentType1)} +if(typeof(window.mwdata.contentType2)!='undefined'&&window.mwdata.contentType2!=null){ga('set','contentGroup2',window.mwdata.contentType2)} +if(typeof(window.mwdata.contentType3)!='undefined'&&window.mwdata.contentType3!=null){ga('set','contentGroup3',window.mwdata.contentType3)} +ga('send','pageview',url)};gaTracker.execCmd(gaCmd);trackHeapEvents.trackPageView('quizPVs',{pvs:1});var currentQuestion=questionWrapper.find('.show-screen');currentQuestion.find(".play-metadata").addClass("fade-out");currentQuestion.find(".more-link").fadeOut();currentQuestion.removeClass("show-screen").addClass("seen-screen");var resultScreen=constructResult(resultData,quizId);$('.results-inner').append(resultScreen);$('.results-wrap').removeClass('hidden');var offset=resultScreen.offset().top-$(".shrinkheader").outerHeight();var screenBody=isDesktop?$("html, body"):$("body");screenBody.stop(!0,!0).animate({scrollTop:offset},{queue:!0,complete:function(){resultScreen.find("[data-remodal-id=leaderModal]").remodal({hashTracking:!1});resultScreen.find(".enter-initials-modal .form-group input[type=text]").on("keyup",function(e){e.preventDefault();e.stopPropagation();var el=$(this);var isFilled=el.val().length===+el.attr("maxlength");if(isFilled){if(!(/(iPad|iPhone|iPod)/g.test(navigator.userAgent))){el.next("input").trigger('focus')}}});resultScreen.find("#leaderboard-initials").submit(function(e){e.preventDefault();var form=$(this);var inputs=form.find('[type=text]');var initials='';inputs.each(function(){initials=initials+$(this).val()});if((initials.length>0)&&(initials.length<=3)){var promise=saveMyInitials(initials);$.when(promise).done(function(){populateLeaderboards(resultScreen)})} +$(this).parents(".enter-initials-modal").find(".remodal-close").trigger("click");return !1});if(resultData.rank<=25&&quizTimer){if(enterLeader===null){enterLeader=$('[data-remodal-id=enterLeaderModal]').remodal({hashTracking:!1})} +enterLeader.open()} +$('.global-footer').removeClass('hidden');$('.add-widgets-wrap').removeClass('hidden');$('.js-more-screen').removeClass('hidden');wgtGamesNext0.init()}});if(isSpellIt){$(".game-nav-links li").eq(0).hide();$("#reviewAnswers").remove()}else{$("#reviewAnswers").on("click",function(e){e.preventDefault();if(reviewModal===null){reviewAnswers();reviewModal=$('[data-remodal-id=reviewAnswersModal]').remodal()} +var url=quizSlug+'/reviewanswers';var gaCmd=function(){if(typeof(window.mwdata.contentType1)!='undefined'&&window.mwdata.contentType1!=null){ga('set','contentGroup1',window.mwdata.contentType1)} +if(typeof(window.mwdata.contentType2)!='undefined'&&window.mwdata.contentType2!=null){ga('set','contentGroup2',window.mwdata.contentType2)} +if(typeof(window.mwdata.contentType3)!='undefined'&&window.mwdata.contentType3!=null){ga('set','contentGroup3',window.mwdata.contentType3)} +ga('send','pageview',url)};gaTracker.execCmd(gaCmd);trackHeapEvents.trackPageView('quizPVs',{pvs:1});reviewModal.open()});$("#view-top-score").on("click",function(e){e.preventDefault();if(leaderModal===null){leaderModal=$('[data-remodal-id=leaderModal]').remodal()} +if(reviewModal!==null){reviewModal.close()} +leaderModal.open()})}}).fail(function(response){if(ajaxResponse.code=='refresh'){location.reload();return} +var ajaxResponse=JSON.parse(response.responseText);var txt="Checking results failed with these errors: "+ajaxResponse.messages.join();alert(txt)}).always(function(){})};var toggleTimer=function(){if(timerContainer.length>0){timerContainer.on("click",".timer-toggle",function(){if(timerContainer.hasClass("was-clicked")){return} +timerContainer.toggleClass("on");window.setTimeout(function(){timerContainer.find(".timer-toggle").toggleClass("on");timerInfo.toggleClass("on")},300)})}};var calculateScore=function(difficulty,timerLeft){var bonus,points,timerScore;var bonusTime=10-(parseInt(quizs.get('timer'))-parseInt(timerLeft));timerScore=(bonusTime>0)?bonusTime:0;bonus=(20*timerScore);points=(parseInt(difficulty)*100);return{points:points,bonus:bonus}} +module.init=function(complex,ag,quizId,qId,aid,slug,name,quizData){isComplex=complex;answerGiven=ag;intitialQuestion=qId;intitialAnswer=aid;quizName=name;quizSlug=slug;isSpellIt=(location.pathname.toLowerCase().indexOf('/spell-it')>=0)?!0:!1;isTrueFalse=(!isSpellIt&&location.pathname.toLowerCase().indexOf('/true-or-false')>=0)?!0:!1;if(intitialQuestion){var i=quizData.qIds.indexOf(intitialQuestion.toString());if(i>0){quizData.qIds.splice(i,1);quizData.qIds.unshift(intitialQuestion.toString())}} +quizs.setData(quizData);isTimed=(quizs.get('timer_key')=="on")?!0:!1;quizs.set('currentScreen',1);quizs.set('totalScore',0);quizs.set('correctAnswers',0);quizs.set('totalScreens',quizs.get('qIds').length);module.quizId=quizId;$('html').on('click','.start-quiz, .next-question',function(e){e.preventDefault();$(this).addClass('was-clicked');if($(this).hasClass("start-quiz")){if(timerContainer.length>0){timerContainer.addClass("was-clicked");quizTimer=timerContainer.hasClass("on")}} +showNextQuestion($(this).hasClass('next-question'),!1)});if(intitialQuestion!==null){$('.start-quiz').addClass('was-clicked');showNextQuestion(!1,answerGiven)}else{$('.introduction-screen').css("min-height",windowHeight-$(".shrinkheader").outerHeight());$('.introduction-screen').removeClass('hidden');var url=quizSlug} +trackHeapEvents.trackPageView('quizPVs',{pvs:1});$('html').on('click','.qs-wrap .show-screen .choice',function(e){e.preventDefault();if($(this).hasClass('already-answered')||$(this).hasClass('disabled')){return} +var qid=$(this).closest('.js-q-container').attr('data-question-id');var aid=$(this).attr('data-aid');var timeLeft=null;if(isTimed){if(countdActive){quizTimeoutId=undefined;countdActive=!1;stopTimer($(this).closest('.js-q-container'));timeLeft=$(this).closest('.js-q-container').find('.remaining-time').text();timeLeft=timeLeft.replace(/:/g,'')}else{window.clearTimeout(quizTimeoutId);quizTimeoutId=undefined;countdActive=!1;timeLeft=$(this).closest('.js-q-container').find('.remaining-time').text();timeLeft=timeLeft.replace(/:/g,'')}} +checkAnswer(qid,aid,timeLeft)});$('html').on('click','.see-results',function(e){e.preventDefault();if(!$(this).hasClass('was-clicked')){$(this).addClass('was-clicked');showResults()}});toggleTimer()};return module});define('wodLanding',['jquery','isMobile'],function($){"use strict";var module={};module.init=function(selector){var scrollToCollapsedBox=function(elem){var collapsedBoxOffset=$('.shrinkheader').outerHeight(!0)+30;if(!elem.hasClass('open-container')){if(elem.closest('.container').length){elem=elem.closest('.container')} +var destination=elem.offset().top-collapsedBoxOffset;var screenBody=(isMobile.any!==!0)?$("html, body"):$("body");screenBody.animate({scrollTop:destination},300)}};$('html').on('click','.toggle-trigger',function(){scrollToCollapsedBox($(this).closest('.toggle-box').toggleClass('open-container'))});var listEl=$(".more-words-of-day-container");var numToShow=4;var loadMoreCnt=$('.see-more-cta-container');var loadMoreBtn=$('.load-more-words');var numInList=listEl.length;listEl.hide();if(numInList>numToShow){loadMoreBtn.show()} +listEl.slice(0,numToShow).show();loadMoreBtn.click(function(e){e.preventDefault();var showing=listEl.filter(':visible').length;listEl.slice(showing-1,showing+numToShow).fadeIn();var nowShowing=listEl.filter(':visible').length;if(nowShowing>=numInList){loadMoreCnt.hide()}})};return module});define('wodArticle',['jquery','waypoints','matchMedia'],function($){"use strict";var module={};module.init=function(legacyUbWodSubscribe,legacyUbWodEmail){$(document).ready(function(){function checkWidth(){var mobileScreen,tabletAndUpScreen,mobilePortrait,mobileLandscape,tabletOnlyScreen;mobileScreen=window.matchMedia('screen and (max-width: 767px)').matches;mobilePortrait=matchMedia('(orientation:portrait)').matches;mobileLandscape=matchMedia('(orientation:landscape)').matches;if(mobileScreen&&mobilePortrait||mobileScreen&&mobileLandscape){$('.wod-definition-container').prepend($(".article-social-sidebar"))}} +checkWidth();$(window).bind("resize",function(){checkWidth()});var articleStickySocial=$('.article-social-sidebar');var articleHeader=$('.wod-article-header');var articleBottomStop=$(".more-words-of-day-container");var contentArea=$('.wod-definition-container');var articleHeaderOffset;var articleInitialOffset;var stickOffset;var contentArea;articleInitialOffset=articleHeader.outerHeight()+80;articleStickySocial.css({top:articleInitialOffset});articleStickySocial.removeClass('social-hide-till-load');contentArea.waypoint(function(direction){articleHeaderOffset=articleHeader.outerHeight()+80;stickOffset=$('.primary-header-container').height();if(direction=='down'){articleStickySocial.addClass('stickied');articleStickySocial.css({top:$('.shrinkheader').outerHeight()+30})}else if(direction=='up'){articleStickySocial.removeClass('stickied');articleStickySocial.css({top:articleHeaderOffset})}},{offset:$('.shrinkheader').outerHeight()+30});articleBottomStop.waypoint(function(direction){articleHeaderOffset=articleHeader.outerHeight()+80;if(direction=='down'){articleStickySocial.css({'visibility':'hidden',top:$('.shrinkheader').outerHeight()+30})}else if(direction=='up'){articleStickySocial.addClass('stickied');articleStickySocial.css({'visibility':'visible',top:$('.shrinkheader').outerHeight()+30})}},{offset:80});var isWodSubscriber=($.cookie('b-e-subsc')!==undefined);var wotdRightBox=$("#wotd-right-content-box");if(isWodSubscriber&&!legacyUbWodSubscribe){wotdRightBox.addClass("active-games");wotdRightBox.find("#wotd-subscribe-box").hide().find("#wotd-games-box").show();wotdRightBox.find("a").click(function(){ga('send','event','WOTD Box','WOTD-Games','clicked',1)})}else{wotdRightBox.addClass("active-subscribe");wotdRightBox.find("form").on("submit",function(){ga('send','event','WOTD Box','WOTD-Subscribe','clicked',1)});if(legacyUbWodSubscribe){wotdRightBox.find(".wod-subscribe-input").val(legacyUbWodEmail);wotdRightBox.find("form").trigger('submit')}} +wotdRightBox.removeClass("hidden")})};return module});define('wapArticle',['jquery','waypoints'],function($){"use strict";var module={};module.init=function(){var articleHeaderOffset;var articleStickySocial;var articleInitialOffset;var stickOffset;var contentArea;articleStickySocial=$('.article-social-sidebar');contentArea=$('.univ-title-container .title-sm');articleInitialOffset=contentArea.outerHeight()+80;articleStickySocial.css({top:articleInitialOffset});contentArea.waypoint(function(direction){if(direction=='down'){articleStickySocial.addClass('stickied');articleStickySocial.css({top:$('.shrinkheader').outerHeight()+30})}else if(direction=='up'){articleStickySocial.removeClass('stickied');articleStickySocial.css({top:$('.univ-title-container').outerHeight()+80})}},{offset:$('.shrinkheader').outerHeight()+30});var articleBottomStop=$(".seen-and-heard-block");articleBottomStop.waypoint(function(direction){if(direction=='down'){articleStickySocial.css({'visibility':'hidden',top:$('.shrinkheader').outerHeight()+30})}else if(direction=='up'){articleStickySocial.addClass('stickied');articleStickySocial.css({'visibility':'visible',top:$('.shrinkheader').outerHeight()+30})}},{offset:$('.shrinkheader').outerHeight()+30})};return module});define('wapSlideshow',['jquery','underscore','shareLinks',"fbSdk",'gaTracker','trackHeapEvents','adProcessor','waypoints','slick','matchMedia'],function($,_,shareLinks,fbSdk,gaTracker,trackHeapEvents,adProcessor){"use strict";var module={};module.init=function(slides,initialSlide,longscroll){var isFirstSlide=!0;var throttleCall=!0;var loadedSlides={};var currentSlideIndex=initialSlide;var willScroll=(currentSlideIndex!==0)?!0:!1;var $wapSliderSlick;var longscrollGallery=(longscroll)?!0:!1;var loadedFBComments=!1;if(currentSlideIndex!==0){willScroll=!0} +var scrollToSlide=function(index){var hashAnchor,headerHeight;hashAnchor=$(".wap-slideshow-slick .item").eq(index);if(hashAnchor.length>0){window.hashScrolled=0;headerHeight=$('.shrinkheader').height();window.hashInterval=window.setInterval(function(){if(Math.abs(hashAnchor.offset().top-window.hashScrolled)>5){window.hashScrolled=hashAnchor.offset().top;$('html, body').animate({scrollTop:hashAnchor.offset().top-headerHeight-10},'fast')}},650);window.setTimeout(function(){window.clearInterval(window.hashInterval);willScroll=!1},1500)}} +var updateSocialShare=function(slideIndex,$socialBar){$('.fb.share-link',$socialBar).attr('data-share-url',slides[slideIndex].meta.og['og:url']).attr('data-share-image',slides[slideIndex].meta.og['og:image']).attr('data-share-title',slides[slideIndex].meta.og['og:title']).attr('data-share-description',slides[slideIndex].meta.og['og:description']);$('.twitter.share-link',$socialBar).attr('data-share-url',slides[slideIndex].meta.twitter['twitter:url']).attr('data-share-text',slides[slideIndex].meta.twitter['twitter:share-text']).attr('data-share-image',slides[slideIndex].meta.twitter['twitter:image']).attr('data-share-title',slides[slideIndex].meta.twitter['twitter:title']).attr('data-share-description',slides[slideIndex].meta.twitter['twitter:description']);shareLinks.init($('.fb.share-link',$socialBar));shareLinks.init($('.twitter.share-link',$socialBar))} +var updateSlideData=function(slideIndex){console.log('updateSlideData',slideIndex);if(longscrollGallery){updateSocialShare(0,'.article-social-sidebar');updateSocialShare(slideIndex,'.article-share-slide')}else{updateSocialShare(slideIndex,'.article-social-sidebar')} +if(currentSlideIndex===slideIndex){return !0} +if(longscrollGallery){if(!window.matchMedia('screen and (max-width: 767px)').matches){adProcessor.refreshGptAds(['slot-right2'])}}else{adProcessor.refreshGptAds()} +currentSlideIndex=slideIndex;if(longscrollGallery){$('.fb-comments').attr('data-href',slides[0].meta.comments_id)}else{$('.fb-comments').attr('data-href',slides[slideIndex].meta.comments_id)} +if(!longscrollGallery||(longscrollGallery&&!loadedFBComments)){var fbCmd=function(){FB.XFBML.parse()};fbSdk.execCmd(fbCmd);loadedFBComments=!0} +var el=$('.wap-slideshow-slick').find('.item:eq('+slideIndex+')');var pageTitle=el.attr('data-page-title');var sData=slides[slideIndex];var slideRelUrl='/words-at-play/'+sData['gal-slug']+'/'+sData['url-name'];if(window.history&&(!isFirstSlide||longscrollGallery)){window.history.pushState("",pageTitle,slideRelUrl)} +$('title').html(pageTitle);if((!isFirstSlide||longscrollGallery)&&!(loadedSlides[slideIndex]===!0)){var gaCmd=function(){if(typeof(window.mwdata.contentType1)!='undefined'&&window.mwdata.contentType1!=null){ga('set','contentGroup1',window.mwdata.contentType1)} +if(typeof(window.mwdata.contentType2)!='undefined'&&window.mwdata.contentType2!=null){ga('set','contentGroup2',window.mwdata.contentType2)} +if(typeof(window.mwdata.contentType3)!='undefined'&&window.mwdata.contentType3!=null){ga('set','contentGroup3',window.mwdata.contentType3)} +ga('send','pageview',slideRelUrl)};gaTracker.execCmd(gaCmd);console.log('GA tracking: ',slideRelUrl)} +if(longscrollGallery){trackHeapEvents.trackPageView('longScrollPVs',{pvs:1})} +loadedSlides[slideIndex]=!0;isFirstSlide=!1};var loadAllAdSlide=function(){$(".slide-ad").each(function(index){var adslot=$(this).attr("data-slot");var setMS=(index*1000);window.setTimeout(function(){adProcessor.renderDfp(adslot,'.'+adslot)},setMS)})};if(longscrollGallery){loadAllAdSlide()} +$('.exclusive-hit-area').on('mouseenter',function(){$(this).closest('.item').find('.exclusive-hit-area').first().addClass('hover');if(!$(this).next('.item').length){$(this).off('click').on('click',function(){$(this).closest('.item').find('.exclusive-hit-area').first().addClass('hover');$('html, body').animate({scrollTop:$(this).closest('.slick-track').find('.slick-active').offset().top-$('.shrinkheader').outerHeight()-10},'slow')})}});$('.next-arrow-content').on('mouseleave',function(){$(this).find('.exclusive-hit-area').removeClass('hover')});$('.next-arrow-content-btm').on('mouseleave',function(){$(this).find('.exclusive-hit-area-btm').removeClass('hover')});$('body').on('mouseup touchend',function(){$('.exclusive-hit-area').removeClass('hover');$('.exclusive-hit-area-btm').removeClass('hover')});$('.exclusive-hit-area').on('touchstart',function(e){if($(this).hasClass('hover')){}else{e.preventDefault()} +$(this).closest('.item').find('.exclusive-hit-area').first().addClass('hover');$(this).closest('.item').find('.exclusive-hit-area-btm').first().addClass('hover')});$('.exclusive-hit-area-btm').on('mouseenter',function(){$('.exclusive-hit-area-btm').first().addClass('hover')});$('.next-arrow-content-btm').on('click',function(e){window.location=$('.exclusive-hit-area').attr('href');e.preventDefault();return !1});var slideIndex=initialSlide;if(!longscrollGallery){var $wapSliderSlickReady=!1;$wapSliderSlick=$('.wap-slideshow-slick').on('init',function(event,slick){slick.activateADA=function(){var _=slick,_isSlideOnFocus=_.$slider.find('*').is(':focus');_.$slideTrack.find('.slick-active').attr({'aria-hidden':'false','tabindex':'0'}).find('a, input, button, select').attr({'tabindex':'0'});if($wapSliderSlickReady) +$('html, body').animate({scrollTop:_.$slideTrack.find('.slick-active').offset().top-$('.shrinkheader').outerHeight()-10},'default',function(){});$wapSliderSlickReady=!0}});$wapSliderSlick.slick({"initialSlide":initialSlide,"speed":0,"draggable":!1,"swipeToSlide":!1,"touchMove":!1,"adaptiveHeight":!0,"slidesToShow":1,"touchThreshold":0.5,"variableWidth":!1,"slidesToScroll":1,"arrows":!0,"infinite":!1,"appendArrows":".wap-slideshow .item .arrow-containers"});$wapSliderSlick.on('afterChange',function(event,slick,currentSlide){updateSlideData(currentSlide)});$(".slick-prev",$wapSliderSlick).on("click",function(e){$wapSliderSlick.slick('slickPrev')});$(".slick-next",$wapSliderSlick).on("click",function(e){$wapSliderSlick.slick('slickNext')});$('.wap-slideshow-slick, .wap-slideshow-slick .item').on("touchend",function(e){e.stopPropagation()});updateSlideData(slideIndex)}else{if(slideIndex!==0){scrollToSlide(slideIndex);updateSlideData(slideIndex)}} +function checkWidth(){var mobileScreen;var tabletAndUpScreen;var mobilePortrait;var mobileLandscape;var tabletOnlyScreen;mobileScreen=window.matchMedia('screen and (max-width: 767px)').matches;mobilePortrait=matchMedia('(orientation:portrait)').matches;mobileLandscape=matchMedia('(orientation:landscape)').matches;if(mobileScreen&&mobilePortrait||mobileScreen&&mobileLandscape){$('.article-social-sidebar').insertAfter(".article-title-container .slideshow-dek")}} +checkWidth();$(window).bind("resize",function(){checkWidth()});var articleHeaderOffset;var articleStickySocial;var articleInitialOffset;var stickOffset;var contentArea;articleStickySocial=$('.article-social-sidebar');contentArea=$('.univ-title-container .title-sm');articleInitialOffset=contentArea.outerHeight()+80;articleStickySocial.css({top:articleInitialOffset});articleStickySocial.removeClass('social-hide-till-load');contentArea.waypoint(function(direction){if(direction=='down'){articleStickySocial.addClass('stickied');articleStickySocial.css({top:$('.shrinkheader').outerHeight()+30})}else if(direction=='up'){articleStickySocial.removeClass('stickied');articleStickySocial.css({top:$('.univ-title-container').outerHeight()+80})}},{offset:$('.shrinkheader').outerHeight()+30});var articleBottomStop=$(".seen-and-heard-block");articleBottomStop.waypoint(function(direction){if(direction=='down'){articleStickySocial.css({'visibility':'hidden',top:$('.shrinkheader').outerHeight()+30})}else if(direction=='up'){articleStickySocial.addClass('stickied');articleStickySocial.css({'visibility':'visible',top:$('.shrinkheader').outerHeight()+30})}},{offset:$('.shrinkheader').outerHeight()+30});var throttledUpdateSlide=_.debounce(updateSlideData,10);$(".wap-slideshow-slick .item").waypoint({handler:function(direction){if(willScroll){return} +var index=parseInt($(this.element).attr("data-slide-num"))||0;if(index>=0){throttledUpdateSlide(index)}},offset:$('.shrinkheader').outerHeight()+50,continuous:!1});$(".long-scroll, .hero-gallery").waypoint({handler:function(direction){if($(".slide-footer-next").hasClass("animated")){return} +$(".slide-footer-next").removeClass("hidden").addClass("animated fadeInUp50")},offset:'bottom-in-view'})};return module});define('wodManage',['jquery'],function($){"use strict";$('#wod-change-frm').on('submit',function(e){e.preventDefault();var form=$(this);var submitButton=form.find('[type=submit]');var textField1=form.find('[name=email]');var textField2=form.find('[name=new_email]');if(submitButton.hasClass('busy1')){return} +submitButton.val(submitButton.attr('data-loading1'));submitButton.addClass('busy1');$.ajax({type:'GET',dataType:"jsonp",url:'https://www.drhinternet.net/mw-signup-wod-jsonp/change.php',jsonp:!1,jsonpCallback:'email_change',data:{email:textField1.val(),new_email:textField2.val(),COA:'1',callback:'email_change'}}).done(function(dataWeGotViaJsonp){if(_.isArray(dataWeGotViaJsonp)){window.location='/wotd-signup-message?message='+dataWeGotViaJsonp[0]}else{window.location='/wotd-signup-message?message='+dataWeGotViaJsonp}}).always(function(){submitButton.val(submitButton.attr('data-normal1'));submitButton.removeClass('busy1')})});$('#wod-signup-frm').on('submit',function(e){e.preventDefault();var form=$(this);var submitButton=form.find('[type=submit]');var textField1=form.find('[name=email]');if(submitButton.hasClass('busy1')){return} +submitButton.val(submitButton.attr('data-loading1'));submitButton.addClass('busy1');$.ajax({type:'GET',dataType:"jsonp",url:'https://www.drhinternet.net/mw-signup-wod-jsonp/unsubscribe.php',jsonp:!1,jsonpCallback:'subscribe_cancel',data:{email:textField1.val(),remove:'1',callback:'subscribe_cancel'}}).done(function(dataWeGotViaJsonp){window.location='/wotd-signup-message?message='+dataWeGotViaJsonp}).always(function(){submitButton.val(submitButton.attr('data-normal1'));submitButton.removeClass('busy1')})})});define('contactEmail',['jquery'],function($){var emailForm=$('.ct-frm');var submitBtn=$('.cf-submit-btn');emailForm.on('submit',function(e){e.preventDefault();e.stopPropagation();if(submitBtn.hasClass("sending")){return !1}else{submitBtn.addClass("sending").text("Sending...")} +emailForm.find('.frm-item-err').html('').addClass('hidden');emailForm.find('.ct-global-danger,.ct-global-success').html('').addClass('hidden');$.ajax({url:'/lapi/1/contact-email/send',dataType:'json',type:'POST',data:emailForm.serialize()}).done(function(ajaxResponse,status,xhr){if(ajaxResponse.succ_message){$("#topic").val("");$("#question").val("");var li=$('<li></li>').text(ajaxResponse.succ_message);emailForm.find('.ct-global-success').removeClass('hidden').append(li);submitBtn.addClass("sent").text("Sent");window.setTimeout(function(){emailForm.find('.ct-global-success').empty().addClass("hidden");submitBtn.removeClass("sending sent").text("Send")},3000)}}).fail(function(response){var ajaxResponse=JSON.parse(response.responseText);if(ajaxResponse.val_messages){var vms=ajaxResponse.val_messages;for(var key in vms){if(vms.hasOwnProperty(key)){$('.'+key+'-err').append('<li>'+vms[key]+'</li>').removeClass('hidden')}}} +if(ajaxResponse.err_message){var li=$('<li></li>').text(ajaxResponse.err_message);emailForm.find('.ct-global-danger').removeClass('hidden').append(li);} +submitBtn.removeClass("sending sent").text("Send")}).always(function(){})})});define('uclickHtml',['jquery'],function($){"use strict";var module={};module.init=function(gameId){var height='700';if(gameId==='lex'){height='500'} +var tag=document.createElement("script");tag.src="https://embed.universaluclick.com/s.js";var aScriptTag=document.getElementsByTagName("script")[0];aScriptTag.parentNode.insertBefore(tag,aScriptTag);var apicontainer;var gameOptions={height:height,width:"100%",customerId:"mwb",key:"c4b63a5135d91f8366191659108970c0",gameId:gameId};window.onUUAPIReady=function(){apicontainer=new UU.Player("uu_hld",gameOptions)}};return module});define('gamePlay',['jwplayer','jquery','uclickHtml','remodal','underscore','matchMedia','wgtGamesNext1','typeshift','dynScript','mwVideoAd'],function(jwplayer,$,uclickHtml,remodal,_,matchMedia,wgtGamesNext1,typeshift,dynScript,mwVideoAd){"use strict";var module={};module.init=function(gameTpl,gameCfg,noJumpingJumble){window.jwplayer=window.jwplayer||jwplayer;jwplayer.key=window.mwdata.jwkey;var wasGameShown=!1;var mqMax667=window.matchMedia('screen and (max-width: 667px)');var playerInstance=jwplayer('gvideo-ad');var gH=$('#game-holder');var autoPlayable=!1;var browserObj;var adTag;function get_browser(){var ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(M[1])){tem=/\brv[ :]+(\d+)/g.exec(ua)||[];return{name:'IE',version:(tem[1]||'')}} +if(M[1]==='Chrome'){tem=ua.match(/\bOPR\/(\d+)/) +if(tem!=null){return{name:'Opera',version:tem[1]}}} +M=M[2]?[M[1],M[2]]:[navigator.appName,navigator.appVersion,'-?'];if((tem=ua.match(/version\/(\d+)/i))!=null){M.splice(1,1,tem[1])} +return{name:M[0],version:M[1]}} +var heapTrackGameTime=function(){if(typeof(heap)==="undefined"||typeof(performance)==="undefined"){return} +var pageOpenTime=performance.now();window.onbeforeunload=function(){var totalTimeOnPage=(performance.now()-pageOpenTime)/1000;heap.track("Closed Page",{total_time_on_page:totalTimeOnPage})}} +var loadGame=_.once(function(){if(wasGameShown){return} +if(playerInstance){playerInstance.remove();$("#gvideo-ad").remove()};gH.find(".game-template").removeClass("hidden");wasGameShown=!0;if(gameCfg.type==='uclick-html5'){uclickHtml.init(gameCfg.gdata.gameId)} +if(gameCfg.type==='special-typeshift'){if(typeof(localStorage)!=="undefined"){localStorage.setItem("lastPlayedTypeShift",Date())} +var cb=function(){typeshift.init(window.mwdata.assetsDomain2+'/mw/static/typeshift','typeshift_inner')};dynScript.load(window.mwdata.assetsDomain2+'/mw/static/typeshift/js/phaser.min.js',{},cb)} +wasGameShown=!0});if(noJumpingJumble){$('#noJumpingJumble').remodal().open()} +$(".more-games-recirc").removeClass('hidden');wgtGamesNext1.init();if(typeof(Modernizr)!=="undefined"){if(!Modernizr.flash&&gameCfg.gdata.tech=="flash"){gH.hide();browserObj=get_browser();if(browserObj.name.toLowerCase()==='safari'&&parseInt(browserObj.version)>=10){$('.lock-message').addClass('safari-lock-message')}else{$('.lock-message').addClass('force-lock-message')} +return} +if(!!autoPlayable===!1){if(typeof(sessionStorage)!=="undefined"){autoPlayable=sessionStorage.getItem('videoautoplay')} +Modernizr.on('videoautoplay',function(result){autoPlayable=result;if(typeof(sessionStorage)!=="undefined"){sessionStorage.setItem('videoautoplay',result)}})}} +if(mqMax667.matches){loadGame();return} +var getAdTag=function(autoPlayable){var videoAd='https://googleads.g.doubleclick.net/pagead/ads?client=ca-video-pub-2804842558535487&slotname=4669406612&ad_type=skippablevideo_image&description_url=http%3A%2F%2Fmerriam-webster.com&sdmax=30000&videoad_start_delay=0&vpmute=0&vpa=0';var imageAd='https://googleads.g.doubleclick.net/pagead/ads?client=ca-video-pub-2804842558535487&slotname=8481058694&ad_type=text_image&description_url=http%3A%2F%2Fmerriam-webster.com&videoad_start_delay=0&vpmute=0&vpa=0';return(!!autoPlayable)?videoAd:imageAd};var showAdAndLoadGame=function(url){adTag=url;if(wasGameShown){return} +playerInstance.setup({advertising:{client:'googima',skipoffset:5},file:window.mwdata.assetsDomain2+'/mw/static/blank-video/black.mp4',aspectratio:"16:9",autostart:!0,displaydescription:!0,displaytitle:!0,shuffle:!1,flashplayer:window.mwdata.jwPlayerPath+'jwplayer.flash.swf',mute:!1,preload:"none",primary:"html5",repeat:!1,stagevideo:!1,visualplaylist:!1,width:"100%"});playerInstance.on('beforePlay',function(){if(adTag===!1){return !0}else{playerInstance.playAd(adTag)}});playerInstance.on('adSkipped',function(){loadGame()});playerInstance.on('adError',function(){loadGame()});playerInstance.on('adComplete',function(){loadGame()});playerInstance.on('complete',function(){loadGame()});playerInstance.on('setupError',function(){loadGame()})};mqMax667.addListener(function(){mwVideoAd.init(showAdAndLoadGame)});mwVideoAd.init(showAdAndLoadGame);heapTrackGameTime()};return module});define('archiveFetcher',['jquery'],function($){var currenlyShown;var totalItems;var module={};module.init=function(apiUrl,count,total){currenlyShown=count;totalItems=total;var archiveMoreBtn=$('.archive-more');archiveMoreBtn.on('click',function(e){e.preventDefault();$.ajax({url:apiUrl,dataType:'json',type:'GET',data:{'offset':currenlyShown}}).done(function(ajaxResponse,status,xhr){console.log('ajaxResponse',ajaxResponse)}).fail(function(response){console.log("Archive call failed.")}).always(function(){})})};return module});define('wodSwapper',['jquery','utils','jqueryCookie'],function($,utils){var module={};module.cameFromWodEmail=function(){var utmCampaign=utils.getQueryVariable('utm_campaign');var utmSource=utils.getQueryVariable('utm_source');if((utmCampaign==='newsletter')&&(utmSource==='wotd')){return !0} +return !1};module.swapWidgets=function(){var isWodSubscriber=($.cookie('b-e-subsc')!==undefined);if(isWodSubscriber){a=$('.wgt-wod-side');b=$('.wgt-games-side');var tmp=$('<span>').hide();a.before(tmp);b.before(a);tmp.replaceWith(b);b.removeClass('bottom-location').addClass('top-location')}};module.cookieWodSubscriber=function(){$.cookie('b-e-subsc','1',{expires:365,path:'/'})};module.uncookieWodSubscriber=function(){$.removeCookie('b-e-subsc')};return module});define('thesaurusLanding',['jquery'],function($){$('.thes-search').on('submit',function(e){e.preventDefault();var word=$('.thes-search-id').val();window.location.href="/thesaurus/"+word})});define('legalLanding',['jquery'],function($){$('.legal-search').on('submit',function(e){e.preventDefault();var word=$('.legal-search-id').val();window.location.href="/legal/"+word})});define('medicalLanding',['jquery'],function($){$('.medical-search').on('submit',function(e){e.preventDefault();var word=$('.medical-search-id').val();window.location.href="/medical/"+word})});define('agePopup',['text!/tpls/age-popup.html','chartist','underscore','jquery','matchMedia'],function(agePopupTpl,chartist,_,$){var buildWidget=function(){var widget={_barData:undefined,_barOptions:undefined,_gui:$(agePopupTpl),_isInitiated:!1,_ageGroup:undefined,_wasAnimated:!1,_chart:undefined,_horline:undefined,_submitsCount:0,_previousAge:0,_nowAge:0,_options:{quizType:undefined,quizId:undefined,maxScore:undefined,score:undefined},open:function(){var that=this;var inst=this._gui.remodal();$(document).on('opened','.age-popup',function(){var age=$.cookie('quiz-age');if(age!==undefined){that._changeAge(age,!0)}});inst.open()},_submitAge:function(age,gotAgeFromCookie){var that=this;$.cookie('quiz-age',age,{expires:365});that._previousAge=that._nowAge;that._nowAge=age;var dfd=$.Deferred();var submitScore=!gotAgeFromCookie||(gotAgeFromCookie&&(that._submitsCount===0));$.ajax({url:'/lapi/v1/mwol-games/quiz/age/submit',type:'POST',data:{quizId:that._options.quizId,onlyFetchData:!submitScore?1:0,previousAge:that._previousAge,nowAge:that._nowAge,quizType:that._options.quizType,score:that._options.score}}).done(function(ajaxResponse){dfd.resolve(ajaxResponse)}).fail(function(response){var ajaxResponse=(response.responseText==='')?{}:JSON.parse(response.responseText);alert(ajaxResponse.messages.join("\n"))}).always(function(){that._submitsCount++});return dfd.promise()},_build:function(){var that=this;that._gui.find('.your-score span').html(that._options.score);var ages=[];for(i=16;i<=99;i++){ages.push([i,i])} +ages.push(['100+','100+']);$.each(ages,function(k,age){var link=$('<a class="border-box"></a>');link.attr('data-age',age[0]);link.html(age[1]);that._gui.find('.dropdown-content').append(link)});var barScores=[0,0,0,0,0,0,0];var xLabels=['Teen','20s','30s','40s','50s','60s','70s+'];var labelToIdx={'teen':0,'20':1,'30':2,'40':3,'50':4,'60':5,'70':6,};that._barData={labels:xLabels,series:[barScores]};that._barOptions={axisY:{low:0,high:that._options.maxScore,scaleMinSpace:50,onlyInteger:!0}};that._chart=new Chartist.Bar(that._gui.find('.bar-chart').get(0),that._barData,that._barOptions);that._chart.on('draw',function(drawData){if((drawData.type==="bar")&&that._isInitiated){var myGroup=parseInt(labelToIdx[that._ageGroup])===drawData.index;if(!that._wasAnimated){drawData.element.animate({y2:{begin:0,dur:'0.7s',from:drawData.y1,to:drawData.y2,easing:'easeOutQuart'}})} +var label=new Chartist.Svg("text");var labelX=drawData.x1;var labelY=drawData.y2-14;label.text(drawData.value.y);label.addClass(myGroup?'bar-label-active':'bar-label');label.attr({x:labelX,y:labelY,"text-anchor":"middle"});if(!that._wasAnimated){label.animate({y:{begin:0,dur:'0.7s',from:drawData.y1,to:labelY,easing:'easeOutQuart'}})} +drawData.group.append(label);if(myGroup){drawData.element.addClass('active');var mobileScreen=matchMedia('screen and (max-width: 767px)');if(mobileScreen.matches){var yourAge1=new Chartist.Svg("text");var labelX=drawData.x1;var labelY=drawData.y2-64;yourAge1.text("Your");yourAge1.addClass('bar-your-age');yourAge1.attr({x:labelX,y:labelY,"text-anchor":"middle"});if(!that._wasAnimated){yourAge1.animate({y:{begin:0,dur:'0.7s',from:drawData.y1,to:labelY,easing:'easeOutQuart'}})} +var yourAge2=new Chartist.Svg("text");var labelX=drawData.x1;var labelY=drawData.y2-52;yourAge2.text("Age");yourAge2.addClass('bar-your-age');yourAge2.attr({x:labelX,y:labelY,"text-anchor":"middle"});if(!that._wasAnimated){yourAge2.animate({y:{begin:0,dur:'0.7s',from:drawData.y1,to:labelY,easing:'easeOutQuart'}})} +drawData.group.append(yourAge1);drawData.group.append(yourAge2);var yourAge3=new Chartist.Svg("text");var labelX=drawData.x1;var labelY=drawData.y2-40;yourAge3.text("Group!");yourAge3.addClass('bar-your-age');yourAge3.attr({x:labelX,y:labelY,"text-anchor":"middle"});if(!that._wasAnimated){yourAge3.animate({y:{begin:0,dur:'0.7s',from:drawData.y1,to:labelY,easing:'easeOutQuart'}})} +drawData.group.append(yourAge1);drawData.group.append(yourAge2);drawData.group.append(yourAge3)}else{var yourAge1=new Chartist.Svg("text");var labelX=drawData.x1;var labelY=drawData.y2-60;yourAge1.text("Your");yourAge1.addClass('bar-your-age');yourAge1.attr({x:labelX,y:labelY,"text-anchor":"middle"});if(!that._wasAnimated){yourAge1.animate({y:{begin:0,dur:'0.7s',from:drawData.y1,to:labelY,easing:'easeOutQuart'}})} +var yourAge2=new Chartist.Svg("text");var labelX=drawData.x1;var labelY=drawData.y2-40;yourAge2.text("Age Group!");yourAge2.addClass('bar-your-age');yourAge2.attr({x:labelX,y:labelY,"text-anchor":"middle"});if(!that._wasAnimated){yourAge2.animate({y:{begin:0,dur:'0.7s',from:drawData.y1,to:labelY,easing:'easeOutQuart'}})} +drawData.group.append(yourAge1);drawData.group.append(yourAge2)} +var chartHeight=mobileScreen.matches?310:420;var onePercent=that._options.maxScore/100;var ourPercent=that._options.score/onePercent;var ourHeight=(chartHeight-(chartHeight/100)*ourPercent)+15;var x1=drawData.chartRect.x1+10;var x2=drawData.chartRect.x2-10;var horLine=new Chartist.Svg("line");horLine.addClass('bar-line');horLine.attr({x1:x1,x2:x2,y1:ourHeight,y2:ourHeight});that._horline=horLine;var img=new Chartist.Svg('image');img._node.setAttributeNS(null,'height','30');img._node.setAttributeNS(null,'width','51');img._node.setAttributeNS('http://www.w3.org/1999/xlink','href',window.mwdata.assetsDomain2+'/mw/static/quizzes/you_pointer.svg');img._node.setAttributeNS(null,'x',x2);img._node.setAttributeNS(null,'y',ourHeight-12);img._node.setAttributeNS(null,'visibility','visible');drawData.group.append(img)} +if(drawData.index===6){that._wasAnimated=!0;if(that._horline){drawData.group.append(that._horline)}}}});that._gui.find('.ages-dropdown').removeClass('hidden');that._gui.find('.comp-text').removeClass('hidden').text('See how you compare.');that._gui.find('.changelink').addClass('hidden');that._gui.find('.changelink').on('click',function(e){e.preventDefault();e.stopPropagation();that._gui.find('.ages-dropdown').removeClass('hidden');that._gui.find('.comp-text').removeClass('hidden').text('See how you compare.');that._gui.find('.changelink').addClass('hidden')});that._gui.find('.ages-dropdown a').on('click',function(e){e.preventDefault();var age=$(this).attr('data-age');that._changeAge(age,!1)})},_changeAge:function(age,gotAgeFromCookie){var that=this;that._isInitiated=!0;that._gui.find('.dropbtn span').text(age);that._gui.find('.dropbtn').addClass('selected');that._gui.find('.ages-dropdown').addClass('hidden');that._gui.find('.comp-text').removeClass('hidden').text('Your age: '+age);that._gui.find('.changelink').removeClass('hidden');var promise=that._submitAge(age,gotAgeFromCookie);$.when(promise).done(function(avData){that._ageGroup=avData.data.ageGroup;var barScores=[];var averages=avData.data.averages;$.each(averages,function(k,av){var avg=0;var takers=(av[1]===null)?0:av[1];var totals=(av[2]===null)?0:av[2];if(takers!==0){avg=totals/takers;avg=avg.toFixed(2)} +barScores.push(avg)});that._barData.series=[barScores];that._chart.update(that._barData)})}};return widget};var myModule={} +myModule.create=function(options){var widget=buildWidget();$.extend(!0,widget._options,options);widget._build();return widget};return myModule});define('quizs',['jquery'],function($){"use strict";var widget={_qd:undefined,setData:function(qs){var that=this;that._qd=that._e(JSON.stringify(qs))},get:function(k){var that=this;var data=that._getData();return data[k]},set:function(k,v){var that=this;var data=that._getData();data[k]=v;that.setData(data)},getFinal:function(dataForFinal){var that=this;var n=that._getRanN();var s1=that._getRanS(n);var s2='r_'+that._getRanS(5);var res=s1+that._e(JSON.stringify(dataForFinal))+String(n);var resObj={};resObj[s2]=res;console.log('s1:',s1);console.log('n:',n);console.log('from:',JSON.stringify(dataForFinal));console.log('to:',that._e(JSON.stringify(dataForFinal)));return resObj},getSave:function(dataForSave){var that=this;var n=that._getRanN();var s1=that._getRanS(n);var s2='r_'+that._getRanS(5);var res=s1+that._e(JSON.stringify(dataForSave))+String(n);var resObj={};resObj[s2]=res;return resObj},_getRanN:function(num){var num=Math.floor(Math.random()*10);if(num<1){num=1} +if(num>9){num=9} +return num},_getRanS:function(num){var text="";var possible="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(var i=0;i<num;i++){text+=possible.charAt(Math.floor(Math.random()*possible.length))} +return text},_getData:function(){var that=this;var dataString=that._d(that._qd);return JSON.parse(dataString)},_e:function(s){var encodedString=window.btoa(unescape(encodeURIComponent(s)));return encodedString},_d:function(s){var decodedString=decodeURIComponent(escape(window.atob(s)));return decodedString}};return widget});define('ads2Refresher',['jquery','adProcessor'],function($,adProcessor){var module={};module.init=function(){window.mwdata.adRefreshCounter=0;var mediaQuery=window.matchMedia('screen and (max-width: 767px)');var ads=(!mediaQuery.matches?window.mwdata.ads2:window.mwdata.ads2Mobile);if(typeof(ads)==="object"&&Object.keys(ads).length>0){var initialReload=!0;var gptTagsAlreadyReplaced=!1;var intervalId;var slotsToReload=[];var resetReloadedTags=function(){for(var key in ads){if(ads.hasOwnProperty(key)){window.mwdata.ads[key]=ads[key];slotsToReload.push(key)}} +adProcessor.cleanUpDfpSlots(slotsToReload);};var adReloader=function(){if(window.mwdata.ad_refresh_counter!==undefined){if(window.mwdata.ad_refresh_counter>12){clearInterval(intervalId);return}} +if(initialReload){resetReloadedTags();refreshGptAds();initialReload=!1}else{refreshGptAds()}};var refreshGptAds=function(){if(window.mwdata.ad_refresh_counter===undefined){window.mwdata.ad_refresh_counter=1}else{window.mwdata.ad_refresh_counter++} +if(!gptTagsAlreadyReplaced){adProcessor.prepareOnlyTheseAdSlots(slotsToReload);var arrayLength=slotsToReload.length;for(var i=0;i<arrayLength;i++){var slotName=slotsToReload[i];adProcessor.setDfpSlotTargeting(slotName,'REFRESH',window.mwdata.ad_refresh_counter);adProcessor.renderDfp(slotName)} +gptTagsAlreadyReplaced=!0}else{var arrayLength=slotsToReload.length;for(var i=0;i<arrayLength;i++){var slotName=slotsToReload[i];adProcessor.setDfpSlotTargeting(slotName,'REFRESH',window.mwdata.ad_refresh_counter)} +adProcessor.refreshGptAds(slotsToReload)}};var initAdReloadTimer=function(){if(intervalId===undefined){intervalId=setInterval(adReloader,70000)}};var doSomething=function(mq){if(!mq.matches){initAdReloadTimer()}else{clearInterval(intervalId)}};mediaQuery.addListener(doSomething);if(!location.pathname.includes('/word-of-the-day')){if(!mediaQuery.matches){initAdReloadTimer()}}else{initAdReloadTimer()}}};return module});define('trackHeapEvents',['jquery'],function($){"use strict";var module={};module.initDefEvents=function(){window.mwHeapEvents=window.mwHeapEvents||{};window.mwHeapEvents['Definition - Initial Search String']='';window.mwHeapEvents['Definition - Search Matches Headword']='false';window.mwHeapEvents['Definition - Function Label']='';window.mwHeapEvents['Definition - Has Homograph']='false';window.mwHeapEvents['Definition - Has Etymology']='false';window.mwHeapEvents['Definition - Has Example Sentences']='false';window.mwHeapEvents['Definition - Has Related Content']='false';window.mwHeapEvents['Definition - Has Usage Guide']='false';window.mwHeapEvents['Definition - Has Synonym Guide']='false';window.mwHeapEvents['Definition - Has Little Gem']='false'} +module.trackEvents=function(){if(typeof(heap)!=="undefined"&&typeof(window.mwHeapEvents)!=="undefined"){if(typeof(Object.keys)!=="undefined"&&Object.keys(window.mwHeapEvents).length>0){heap.addEventProperties(window.mwHeapEvents)}}} +module.addEvent=function(name,value){if(typeof(value)!=="undefined"&&value!=null&&value.length>0){window.mwHeapEvents=window.mwHeapEvents||{};window.mwHeapEvents[name]=value}} +module.trackPageView=function(name,value){if(typeof(heap)!=="undefined"){heap.track(name,value)}} +return module});define('trackScrollDepth',['jquery','inview'],function($){"use strict";var module={};module.init=function(eventLabelName){var gaEventLabel='Sections';if(typeof(eventLabelName!=="undefined")){gaEventLabel=eventLabelName} +var trackEvents=function(eventName){console.log("Scroll Depth - "+eventName);ga('send','event','Scroll Depth',gaEventLabel,eventName,1);if(typeof(heap)!=="undefined"&&typeof(window.mwHeapEvents)!=="undefined"){console.log("Heap Track Scroll Depth - "+eventName);heap.track('Scroll Depth',{Sections:eventName,view:1})}} +$(".scrollDepth").one('inview',function(event,isInView){if(isInView){var eventName=$(this).attr("data-eventName");trackEvents(eventName)}});$(".continuousHeapScrollDepth").on('inview',function(event,isInView){if(isInView){var eventName=$(this).attr("data-eventName");if(typeof(heap)!=="undefined"&&typeof(window.mwHeapEvents)!=="undefined"){console.log("Heap Track Scroll Depth - "+eventName);heap.track('Scroll Depth',{Scroll:eventName,view:1})}}});$(".gaScrollDepth").one('inview',function(event,isInView){if(isInView){var eventName=$(this).attr("data-eventName");ga('send','event','Scroll Depth',gaEventLabel,eventName,1);console.log("GA Track Scroll Depth - "+eventName)}})} +return module});define('dynamicFonts',['jquery','matchMedia'],function($){"use strict";function fontSizer(options){var defaults={"quantifier":0.07};var settings=$.extend(defaults,options);var target=$(settings.target);var container=$(settings.container);var fontSize=container.width()*settings.quantifier;var mobileScreen,tabletAndUpScreen,mobilePortrait,mobileLandscape,tabletOnlyScreen,mobileBreakPoints,notMobileBreakPoints;mobileScreen=matchMedia('screen and (max-width: 426px)').matches;mobilePortrait=matchMedia('(orientation:portrait)').matches;mobileLandscape=matchMedia('(orientation:landscape)').matches;tabletOnlyScreen=matchMedia('screen and (min-width: 767px)').matches&&matchMedia('screen and (max-width: 959px)').matches;mobileBreakPoints=mobileScreen&&mobilePortrait||mobileScreen&&mobileLandscape;notMobileBreakPoints=!mobileScreen&&!mobilePortrait||!mobileScreen&&!mobileLandscape;if(tabletOnlyScreen){target.css('font-size',fontSize)} +if(mobileBreakPoints){target.css('font-size',fontSize)} +if(notMobileBreakPoints&&!tabletOnlyScreen){target.css('font-size','')}} +return fontSizer});define('dynScript',['jquery'],function($){var module={};module.load=function(script,attributes,onloadCb){var fjs=document.getElementsByTagName('script')[0];var js=document.createElement('script');if(attributes!==undefined){for(var key in attributes){if(attributes.hasOwnProperty(key)){$(js).attr(key,attributes[key])}}} +if(onloadCb!==undefined){js.onload=onloadCb} +js.src=script;fjs.parentNode.insertBefore(js,fjs)};return module});define('adPOS',[],function(){var module={};function getWindowDimensions(){var width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;return[width,height]} +function parseSizeMappings(sizeMappings){try{var sd=getWindowDimensions();var validMappings=sizeMappings.filter(function(m){return m[0][0]<=sd[0]&&m[0][1]<=sd[1]});return validMappings.length>0?validMappings[0][1]:[]}catch(e){return sizeMappings[sizeMappings.length-1][1]}} +function updateADPOSNaming(){var i,j,adPos,adSize;var mobileM=(window.matchMedia('screen and (max-width: 767px)').matches)?"M":"";var setPOSName=function(adData){if(Array.isArray(adData.sizeMap)&&adData.sizeMap.length>0){adSize=adData.sizeMap[0].toString().replace(",","");for(i=0;i<adData.targeting.length;i++){if(adData.targeting[i][0].toUpperCase()==="POS"){adPos="M"+adSize+mobileM+adData.targeting[i][1];adData.targeting[i][1]=[adPos];break}}}} +for(i in window.mwdata.ads){setPOSName(window.mwdata.ads[i].data)} +if(typeof(window.mwdata.ads2)==="object"&&!Array.isArray(window.mwdata.ads2)){for(j in window.mwdata.ads2){setPOSName(window.mwdata.ads2[j].data)}} +if(typeof(window.mwdata.ads2Mobile)==="object"&&!Array.isArray(window.mwdata.ads2Mobile)){for(j in window.mwdata.ads2Mobile){setPOSName(window.mwdata.ads2Mobile[j].data)}}} +function createSizeMapping(){try{var sizeMap,sizeMap2,adData,adData2;for(var i in window.mwdata.ads){adData=window.mwdata.ads[i].data;sizeMap=[];if(typeof(adData.sizeMappings)!=="undefined"&&adData.sizeMappings.length>0){adData.sizeMappings.reverse().forEach(function(adSize){sizeMap.push([adSize.screen,adSize.ads])});window.mwdata.ads[i].data.sizeMap=parseSizeMappings(sizeMap);if(window.mwdata.ads[i].data.sizeMap.length===0){window.mwdata.ads[i].data.sizeMap=adData.defSizes}}} +if(typeof(window.mwdata.ads2)==="object"&&!Array.isArray(window.mwdata.ads2)){for(var j in window.mwdata.ads2){adData2=window.mwdata.ads2[j].data;sizeMap2=[];if(typeof(adData2.sizeMappings)!=="undefined"&&adData2.sizeMappings.length>0){adData2.sizeMappings.reverse().forEach(function(adSize){sizeMap2.push([adSize.screen,adSize.ads])});window.mwdata.ads2[j].data.sizeMap=parseSizeMappings(sizeMap2);if(window.mwdata.ads2[j].data.sizeMap.length===0){window.mwdata.ads2[j].data.sizeMap=adData2.defSizes}}}} +if(typeof(window.mwdata.ads2Mobile)==="object"&&!Array.isArray(window.mwdata.ads2Mobile)){for(var j in window.mwdata.ads2Mobile){adData2=window.mwdata.ads2Mobile[j].data;sizeMap2=[];if(typeof(adData2.sizeMappings)!=="undefined"&&adData2.sizeMappings.length>0){adData2.sizeMappings.reverse().forEach(function(adSize){sizeMap2.push([adSize.screen,adSize.ads])});window.mwdata.ads2Mobile[j].data.sizeMap=parseSizeMappings(sizeMap2);if(window.mwdata.ads2Mobile[j].data.sizeMap.length===0){window.mwdata.ads2Mobile[j].data.sizeMap=adData2.defSizes}}}}}catch(e){for(var i in window.mwdata.ads){window.mwdata.ads[i].data.sizeMap=window.mwdata.ads[i].data.defSizes} +for(var i in window.mwdata.ads){window.mwdata.ads2[i].data.sizeMap=window.mwdata.ads2[i].data.defSizes} +for(var i in window.mwdata.ads){window.mwdata.ads2Mobile[i].data.sizeMap=window.mwdata.ads2Mobile[i].data.defSizes}}} +module.init=function(){createSizeMapping();updateADPOSNaming();} +return module});define('adProcessor',['jquery','uniqueId','utils','jqueryCookie','matchMedia'],function($,uniqueId,utils){var module={};var canonicalURL=window.mwdata.canonicalURL||location.href;window.will=window.will||[];if(!Array.prototype.indexOf){Array.prototype.indexOf=function(needle){for(var i=0;i<this.length;i++){if(this[i]===needle){return i}} +return-1}} +var viewportDiff=function(){var e=window;var a='inner';if(!('innerWidth' in window)){a='client';e=document.documentElement||document.body} +var cssWidth=e[a+'Width'];var jsWidth=$(window).width();var diff=cssWidth-jsWidth;diff=(diff<0)?0:diff;return diff};module.prepareAdSlots=function(allowedIds){var that=this;var ads=[];var allowedLength=allowedIds.length;for(var i=0;i<allowedLength;i++){var asn=allowedIds[i];if(window.mwdata.tagsPrepped.indexOf(asn)!==-1){continue} +ads[asn]=window.mwdata.ads[asn];window.mwdata.tagsPrepped.push(asn)} +if(window.gptadslots===undefined){window.gptadslots={}} +if(window.quantSegs===undefined){window.quantSegs=[]} +if(!$.isEmptyObject(ads)){var googleDfpAdsPresent=!1;for(var slotName in ads){if(ads.hasOwnProperty(slotName)){var adEntry=ads[slotName];if(typeof(adEntry)!=="undefined"&&adEntry.type==='google_dfp'){googleDfpAdsPresent=!0;var uid=uniqueId.getUniqueId();adEntry.data.id='gpt-id-'+uid}}} +var prepDfpSlots=function(result){googletag.cmd.push(function(){for(var slotName in ads){var adEntry=ads[slotName];if(adEntry.type==='google_dfp'){var unitName=adEntry.data.slot;if(window.mwdata.adTestSupport){var params=utils.getQueryVariables();if('test-tags' in params){unitName=unitName+'_TEST';console.log('unitName',unitName)}} +gptadslots[slotName]=googletag.defineSlot(unitName,adEntry.data.sizeMap,adEntry.data.id).setTargeting('ad_group',Adomik.randomAdGroup()).setTargeting('ad_h',(new Date().getUTCHours().toString()));if(typeof adEntry.data.targeting!=='undefined'){for(var i=0;i<adEntry.data.targeting.length;i++){var currentTarget=adEntry.data.targeting[i];var targetingType=currentTarget[0];var targetingValue=(targetingType==='qsegs')?result:currentTarget[1];if((targetingValue!==null)&&(targetingValue!=='')){if(targetingType=='SEARCH'){gptadslots[slotName].setTargeting(targetingType,window.mwdata.search)}else if(targetingType=='CAT'){gptadslots[slotName].setTargeting(targetingType,window.mwdata.cat)}else if(targetingType=='PAGE'){var pvc=$.cookie('pvc');pvc=(pvc===undefined)?1:parseInt(pvc);gptadslots[slotName].setTargeting(targetingType,pvc)}else if(targetingType=='POS'){gptadslots[slotName].setTargeting(targetingType,targetingValue);gptadslots[slotName].setTargeting("index_kv",targetingValue)}else{gptadslots[slotName].setTargeting(targetingType,targetingValue)}}}} +if(!$.isEmptyObject(adEntry.data.sizeMappings)){var mapping=googletag.sizeMapping();for(var key in adEntry.data.sizeMappings.reverse()){if(adEntry.data.sizeMappings.hasOwnProperty(key)){var sizeData=adEntry.data.sizeMappings[key];var browserSize=sizeData.screen;var adSizes=sizeData.ads;var diff=viewportDiff();var bw=parseInt(browserSize[0]);bw=(bw<diff)?bw:(bw-diff);var bh=parseInt(browserSize[1]);browserSize=[bw,bh];mapping.addSize(browserSize,adSizes)}} +var mappingBuildResult=mapping.build();gptadslots[slotName].defineSizeMapping(mappingBuildResult)} +gptadslots[slotName].addService(googletag.pubads())}} +if(!window.mwdata.dfpSvcUp){window.mwdata.dfpSvcUp=!0;var launchGoogleTags=function(){googletag.pubads().set("page_url",canonicalURL);googletag.pubads().enableAsyncRendering();googletag.pubads().enableSingleRequest();googletag.enableServices()};launchGoogleTags()}})};if(googleDfpAdsPresent){prepDfpSlots(null)}}};module.prepareAdLibraries=function(){var that=this;if(typeof(window.mwdata.taxon)!="undefined"&&window.mwdata.taxon!=null){var adTaxon=window.mwdata.taxon.slice(",");var contentLabels=[],headwordLabels=[],sponsorshipLabels=[];adTaxon.forEach(function(taxon){if(taxon.indexOf('Content Label - ')>=0){contentLabels.push(taxon.replace("Content Label - ",""))}else if(taxon.indexOf('Headword - ')>=0){headwordLabels.push(taxon.replace("Headword - ",""))}else if(taxon.indexOf('Sponsorships - ')>=0){sponsorshipLabels.push(taxon.replace("Sponsorships - ",""))}});$.each(window.mwdata.ads,function(slotId,slot){if("data" in slot&&"targeting" in slot.data){if(contentLabels.length>0){window.mwdata.ads[slotId].data.targeting.push(["CONTENT",contentLabels])} +if(headwordLabels.length>0){window.mwdata.ads[slotId].data.targeting.push(["HEADWORD",headwordLabels])} +if(sponsorshipLabels.length>0){window.mwdata.ads[slotId].data.targeting.push(["SPONSORSHIPS",sponsorshipLabels])}}});$.each(window.mwdata.ads2,function(slotId,slot){if("data" in slot&&"targeting" in slot.data){if(contentLabels.length>0){window.mwdata.ads2[slotId].data.targeting.push(["CONTENT",contentLabels])} +if(headwordLabels.length>0){window.mwdata.ads2[slotId].data.targeting.push(["HEADWORD",headwordLabels])} +if(sponsorshipLabels.length>0){window.mwdata.ads2[slotId].data.targeting.push(["SPONSORSHIPS",sponsorshipLabels])}}});$.each(window.mwdata.ads2Mobile,function(slotId,slot){if("data" in slot&&"targeting" in slot.data){if(contentLabels.length>0){window.mwdata.ads2Mobile[slotId].data.targeting.push(["CONTENT",contentLabels])} +if(headwordLabels.length>0){window.mwdata.ads2Mobile[slotId].data.targeting.push(["HEADWORD",headwordLabels])} +if(sponsorshipLabels.length>0){window.mwdata.ads2Mobile[slotId].data.targeting.push(["SPONSORSHIPS",sponsorshipLabels])}}})}};module.prepareAllAdSlotsExcept=function(exceptionSlots){var that=this;var slotNames=$.map(window.mwdata.ads,function(element,index){return index});var forPrep=[];for(var i=0;i<slotNames.length;i++){var slotName=slotNames[i];if(exceptionSlots.indexOf(slotName)===-1){forPrep.push(slotName)}} +that.prepareAdSlots(forPrep)};module.prepareOnlyTheseAdSlots=function(forPrep){var that=this;that.prepareAdSlots(forPrep)};module.cleanUpDfpSlots=function(slotsToReload){var arrayLength1=slotsToReload.length;for(var i1=0;i1<arrayLength1;i1++){var reloadSlotName=slotsToReload[i1];var arrayLength2=window.mwdata.tagsPrepped.length;for(var i2=0;i2<arrayLength2;i2++){var preppedSlotName=window.mwdata.tagsPrepped[i2];if(reloadSlotName===preppedSlotName){window.mwdata.tagsPrepped.splice(i2,1)}} +if(gptadslots[reloadSlotName]!==undefined){googletag.destroySlots([gptadslots[reloadSlotName]])}}};module.refreshGptAds=function(slotsToRefresh){var that=this;if(window.googletag&&googletag.apiReady){if(slotsToRefresh===undefined){headertag.pubads().refresh()}else{var arrayLength=slotsToRefresh.length;for(var i=0;i<arrayLength;i++){var refreshSlotName=slotsToRefresh[i];that.refreshDfp(refreshSlotName)}}}};module.setDfpSlotTargeting=function(slotName,targetingName,targetingValue){gptadslots[slotName].setTargeting(targetingName,targetingValue)};module.renderDfp=function(slotId,parentSelector){var that=this;that.prepareAdSlots([slotId]);var adData=window.mwdata.ads[slotId];if(typeof(adData)==="undefined"){return} +var parentDiv=(parentSelector===undefined)?('.'+slotId):parentSelector;var parentDivEl=$(parentDiv);if(parentDivEl.length==0){return} +var adDiv=$('<div></div>').attr('id',adData.data.id).prependTo(parentDivEl);if(adData.data.divClass!==undefined){adDiv.addClass(adData.data.divClass)} +var isAdPresentInThisScreenWidth=!1;var viewportWidth=$(window).width();var mappingsLength=adData.data.sizeMappings.length;var chosenWidth,panSizes;for(var i=0;i<mappingsLength;i++){var mapping=adData.data.sizeMappings[i];var screenWidth=mapping.screen[0];var adsPresent=(mapping.ads.length!==0);if(viewportWidth>=screenWidth){chosenWidth=screenWidth;isAdPresentInThisScreenWidth=adsPresent}} +if(isAdPresentInThisScreenWidth&&!adData.data.noPf){adDiv.attr('adonis-marker','');panSizes="[["+adData.data.sizeMap.toString()+"]]";adDiv.attr('data-pan-sizes',panSizes)} +apstag.fetchBids({slots:[{slotID:adData.data.id,slotName:adData.data.slot,sizes:adData.data.sizeMap}],timeout:750},function(bids){googletag.cmd.push(function(){apstag.setDisplayBids([adData.data.id]);headertag.display(adData.data.id);parentDivEl.addClass('ad-displayed');if(adData.data.refresh!==undefined){var rfn=function(){headertag.pubads().refresh([window.gptadslots[slotId]])};setInterval(rfn,adData.data.refresh*1000)}})})};module.refreshDfp=function(slotId,parentSelector){var that=this;that.prepareAdSlots([slotId]);var adData=window.mwdata.ads[slotId];if(typeof(adData)==="undefined"){return} +var isAdPresentInThisScreenWidth=!1;var viewportWidth=$(window).width();var mappingsLength=adData.data.sizeMappings.length;var chosenWidth;for(var i=0;i<mappingsLength;i++){var mapping=adData.data.sizeMappings[i];var screenWidth=mapping.screen[0];var adsPresent=(mapping.ads.length!==0);if(viewportWidth>=screenWidth){chosenWidth=screenWidth;isAdPresentInThisScreenWidth=adsPresent}} +apstag.fetchBids({slots:[{slotID:adData.data.id,slotName:adData.data.slot,sizes:adData.data.sizeMap}],timeout:750},function(bids){console.log("fetch refresh");googletag.cmd.push(function(){apstag.setDisplayBids([window.gptadslots[slotId].getSlotElementId()]);headertag.pubads().refresh([window.gptadslots[slotId]])})})};return module});define('audioplayer',['jquery','utils'],function($,utils){function buildUrl(lang,dir,file,type){var audioSrc;if(type==='spell_it'){audioSrc=window.mwdata.assetsDomain2+"/mw/spellit-files/"+file}else{lang=lang.replace("_","/");audioSrc=window.mwdata.pronsDomain+"/audio/prons/"+lang+'/'+'mp3'+'/'+dir+'/'+file} +return audioSrc} +function collectDataFromEl(el){var data={};data.lang=$(el).attr('data-lang');data.dir=$(el).attr('data-dir');data.file=$(el).attr('data-file');data.type=$(el).attr('data-type');data.title=$(el).attr('data-title');if(!data.dir&&data.file){data.dir=data.file.charAt(0)} +return data} +function doAudio(audioSrc,el){var audioEl=document.createElement("audio");$(audioEl).on('ended',function(){$(audioEl).remove();if(el){el.data('playing',!1)}});$(audioEl).on("canplay",function(){el.trigger("canplay")});var srcExt;if(audioEl.canPlayType("audio/mpeg")){srcExt=".mp3"}else if(audioEl.canPlayType("audio/ogg")){srcExt=".ogg"} +audioEl.setAttribute("src",audioSrc+srcExt);audioEl.play()} +function audioFallBack(audioSrc,el){var embedEl=document.createElement("embed");$(embedEl).on('ended',function(){$(embedEl).remove();if(el){el.data('playing',!1)}});$(embedEl).on("canplay",function(){el.trigger("canplay")});embedEl.src=audioSrc;embedEl.autostart="true";embedEl.play()} +function playFromElement(el){var data=collectDataFromEl(el);var audioSrc=buildUrl(data.lang,data.dir,data.file,data.type);if(el.data('playing')!==!0){el.data('playing',!0);var audioElTest=document.createElement("audio");var supportsAudio=(typeof audioElTest.canPlayType==="function");if(supportsAudio){doAudio(audioSrc,el)}else{audioFallBack(audioSrc,el)}}} +function playFromData(lang,dir,file){var audioSrc=buildUrl(lang,dir,file);var audioElTest=document.createElement("audio");var supportsAudio=(typeof audioElTest.canPlayType==="function");if(supportsAudio){doAudio(audioSrc)}else{audioFallBack(audioSrc)}} +var module={init:function(){$('html').on("click",".play-pron",function(e){e.preventDefault();playFromElement($(this))});$('html').on("mouseover",".play-pron",function(e){e.preventDefault();var el=this;if(!$(el).hasClass('converted')){var data=collectDataFromEl(el);var url=window.location.origin+window.location.pathname+'?pronunciation&lang='+data.lang+'&dir='+data.dir+'&file='+data.file;$(el).attr('title',data.title);$(el).attr('href',url);$(el).addClass('converted')}});var params=utils.getQueryVariables();if('autoplay' in params){var playMeNowElement=$('.wod-autoplay');if(playMeNowElement.length===1){playFromElement(playMeNowElement)}} +if('pronunciation' in params){if(('dir' in params)&&('file' in params)){playFromData('en_us',params.dir,params.file)}else{$(document).ready(function(){var playMeNowElement=$('.play-pron').first();playFromElement(playMeNowElement)})}}}};return module});define('autofit',['jquery'],function($){'use strict' +var autofit=function(options){this._options=options;this.init()};autofit.prototype.init=function(){this.addItems();this.calculateSize();this.addListener()};autofit.prototype.addItems=function(){var _this=this;this._items=[];jQuery(this._options.items).each(function(){_this._items.push(this)})};autofit.prototype.resetItem=function(item){$(item).data('fitratio',1).children().first().css('font-size','')};autofit.prototype.fitItem=function(item,itemWidth,maxWidth){var newRatio=maxWidth/itemWidth;$(item).data('fitratio',newRatio).children().first().css('font-size',newRatio+'em')};autofit.prototype.calculateContainerSize=function(){};autofit.prototype.calculateSize=function(){var _this=this;jQuery(this._items).each(function(){$(this).closest(_this._options.closestItemContainer).css('maxWidth',$(this).closest(_this._options.closestContainer).width());var itemWidth=$(this).outerWidth();var itemRatio=$(this).data('fitratio')||1;itemWidth/=itemRatio;var maxWidth=$(this).closest(_this._options.closestContainer).outerWidth()*_this._options.maxWidthRatio;if(itemWidth>maxWidth){_this.fitItem(this,itemWidth,maxWidth)}else{_this.resetItem(this)}})};autofit.prototype.addListener=function(){var _this=this,_timeout;var callback=function(){clearTimeout(_timeout);_timeout=setTimeout(function(){if(window.innerWidth!==768) +_this.calculateSize()},200)};window.addEventListener=window.addEventListener||window.attachEvent;window.addEventListener('orientationchange',callback);window.addEventListener('resize',callback)};return autofit});define('cmsImg',['jquery'],function($){"use strict";var module={};var dataToAttributes=function(imData,dimName){if(imData===null){var defUrl=window.mwdata.assetsDomain1+'/mw/static/default-cms-images';var srcset=defUrl+"/no-image@1x.jpg 1x, "+defUrl+"/no-image@2x.jpg 2x";attrs={'alt':'no Image','is_retina':!1,'src':defUrl+'/no-image@1x.jpg','data-caption':'','data-credit':'','data-type':'','data-dim':dimName,'data-ret-pref':'','data-ret-x':'','srcset':srcset}}else if(imData.is_retina==1){var dir=window.mwdata.assetsDomain1+"/mw/images/"+imData.type+'/'+imData.directory;var parts=imData.source.split('.');var file=parts[0]+"@1x.jpg";var srcset=dir+'/'+parts[0]+'@1x.jpg 1x, '+dir+'/'+parts[0]+'@2x.jpg 2x';var attrs={'alt':imData.alt,'is_retina':'true','src':dir+'/'+file,'data-caption':imData.caption,'data-credit':imData.credit,'data-type':imData.type,'data-dim':dimName,'data-ret-pref':parts[0],'data-ret-x':'1','srcset':srcset}}else{var dir=window.mwdata.assetsDomain1+"/mw/images/"+imData.type+"/"+imData.directory;var parts=imData.source.split('.');var file=parts[0]+"@1x.jpg";var attrs={'alt':imData.alt,'is_retina':'false','src':dir+'/'+file,'data-caption':imData.caption,'data-credit':imData.credit,'data-type':imData.type,'data-dim':dimName,'data-ret-pref':'','data-ret-x':''}} +return attrs};module.getUrl=function(imageData,dimName){var attrs=dataToAttributes(imageData,dimName);return attrs.src};module.render=function(imageData,dimName){var attrs=dataToAttributes(imageData,dimName);var tag=$('<img />');for(var key in attrs){if(attrs.hasOwnProperty(key)){var attrName=key;var attrValue=attrs[key];tag.attr(attrName,attrValue);}} +return tag};module.renderLazyLoad=function(imageData,dimName){var attrs=dataToAttributes(imageData,dimName);var tag=$('<img class="lazyload" />');for(var key in attrs){if(attrs.hasOwnProperty(key)){var attrName=key;var attrValue=attrs[key];if(attrName=="src"||attrName=="srcset"){attrName="data-"+attrName} +tag.attr(attrName,attrValue)}} +return tag};return module});define('gaTracker',[],function(){"use strict";var module={};var gaTrackCode,gaTrackURL;var standardGatInitialization=function(){(function(i,s,o,g,r,a,m){i.GoogleAnalyticsObject=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create',window.mwdata.gaSiteId,'auto');if(typeof(window.gaOptimize)!=="undefined"&&window.gaOptimize){ga('require','GTM-P8TR3R8')} +if(typeof(window.mwdata.contentType1)!='undefined'&&window.mwdata.contentType1!=null){ga('set','contentGroup1',window.mwdata.contentType1)} +if(typeof(window.mwdata.contentType2)!='undefined'&&window.mwdata.contentType2!=null){ga('set','contentGroup2',window.mwdata.contentType2)} +if(typeof(window.mwdata.contentType3)!='undefined'&&window.mwdata.contentType3!=null){ga('set','contentGroup3',window.mwdata.contentType3)} +if(window.mwdata.gaNoTrackOnLoad!==!0){if(typeof(window.mwdata)!=="undefined"&&!!window.mwdata.partialMatch&&!!window.mwdata.partialURL){gaTrackURL=window.mwdata.partialURL;ga('send','pageview',gaTrackURL)}else{gaTrackCode=sessionStorage.getItem('gaSRCTracker');if(!!gaTrackCode){gaTrackCode=JSON.parse(gaTrackCode);if(!!gaTrackCode.url&&!!gaTrackCode.src&&gaTrackCode.url==window.location.pathname){gaTrackURL=document.location.pathname+"?src="+gaTrackCode.src;ga('send','pageview',gaTrackURL)}else{ga('send','pageview')} +sessionStorage.removeItem('gaSRCTracker')}else{ga('send','pageview')}}}};module.init=function(){standardGatInitialization()};module.execCmd=function(cbFunction){if(window.ga===undefined){standardGatInitialization()} +cbFunction()};return module});define('mdParser',["jquery","marked"],function($,marked){"use strict";var module=function(str,stripPars){if(str===null){return ''} +var mdText=marked(str);if(stripPars!==undefined){mdText=mdText.trim();console.log('mdText',mdText);mdText=mdText.replace(/^<p>/,'');mdText=mdText.replace(/<\/p>$/,'')} +return mdText};return module});define('podcastPlayer',['jquery','jwplayer'],function($,jwplayer){"use strict";window.jwplayer=window.jwplayer||jwplayer;jwplayer.key=window.mwdata.jwkey;var module={};module.init=function(selector,skin){var podcastPlayer=$(selector);var audio=podcastPlayer.attr('data-podcast-src');var podcastPlayer=jwplayer("podcast-player");podcastPlayer.setup({skin:{name:skin},preload:"none",file:audio,width:"100%",height:30})};return module});define('stickyCol',['jquery','underscore','matchMedia'],function($,_){'use strict' +var module={_leftContent:undefined,_rightRail:undefined,_container:undefined,_updatePosition:function(){var that=window.stickyCol?window.stickyCol:this;var rrHeight=$(that._rightRail).children().first().height();var cHeight=$(that._container).height();if(rrHeight>=cHeight){if(rrHeight>cHeight){$(that._container).removeClass('state-middle');$(that._container).removeClass('state-bottom')} +return} +var stickyStartPoint=$(that._rightRail).offset().top;var lastStickyPoint=stickyStartPoint+rrHeight;var lastContentPoint=stickyStartPoint+cHeight;var scrollPosition=$(window).scrollTop();var lastVisiblePoint=scrollPosition+$(window).innerHeight();if(lastVisiblePoint>lastContentPoint){$(that._container).addClass('state-bottom')}else{$(that._container).removeClass('state-bottom');if(lastVisiblePoint>lastStickyPoint){$(that._container).addClass('state-middle')}else{$(that._container).removeClass('state-middle')}}},enableListeners:function(leftContent,rightRail,container){var mobileScreen=window.matchMedia('screen and (max-width: 767px)');var that=this;if(mobileScreen.matches||$(rightRail).length===0||$(leftContent).length===0||$(leftContent).height()<$(rightRail).height())return;that._leftContent=leftContent;that._rightRail=rightRail;that._container=container;var throttledUpdatePosition=_.throttle(that._updatePosition,100);$(window).on('scroll touchmove orientationchange resize updatesticky',throttledUpdatePosition);setTimeout(that._updatePosition(),20)}};window.stickyCol=module;return window.stickyCol});define('uniqueId',[],function(_){var module={};module.getUniqueId=function(){return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16)})} +return module});define('utils',['jquery'],function($){var module={};module.scrollToAnchorOnClick=function(elemClass,anchorID){$(elemClass).off("click").on("click",function(e){e.preventDefault();var destination=$(anchorID).offset().top-$('.shrinkheader').outerHeight(!0);$("html, body").animate({scrollTop:destination},300)})};module.getQueryVariable=function(variable){var query=window.location.search.substring(1);var vars=query.split('&');for(var i=0;i<vars.length;i++){var pair=vars[i].split('=');if(decodeURIComponent(pair[0])==variable){return decodeURIComponent(pair[1])}} +return null};module.getQueryVariables=function(){var params={},queries,temp,i,l;var queryString=window.location.search.substring(1);queries=queryString.split("&");for(i=0,l=queries.length;i<l;i++){temp=queries[i].split('=');params[temp[0]]=temp[1]} +return params};module.replaceDiacritics=function(str){var defaultDiacriticsRemovalMap=[{'base':'A','letters':/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{'base':'AA','letters':/[\uA732]/g},{'base':'AE','letters':/[\u00C6\u01FC\u01E2]/g},{'base':'AO','letters':/[\uA734]/g},{'base':'AU','letters':/[\uA736]/g},{'base':'AV','letters':/[\uA738\uA73A]/g},{'base':'AY','letters':/[\uA73C]/g},{'base':'B','letters':/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{'base':'C','letters':/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{'base':'D','letters':/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{'base':'DZ','letters':/[\u01F1\u01C4]/g},{'base':'Dz','letters':/[\u01F2\u01C5]/g},{'base':'E','letters':/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{'base':'F','letters':/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{'base':'G','letters':/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{'base':'H','letters':/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{'base':'I','letters':/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{'base':'J','letters':/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{'base':'K','letters':/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{'base':'L','letters':/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{'base':'LJ','letters':/[\u01C7]/g},{'base':'Lj','letters':/[\u01C8]/g},{'base':'M','letters':/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{'base':'N','letters':/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{'base':'NJ','letters':/[\u01CA]/g},{'base':'Nj','letters':/[\u01CB]/g},{'base':'O','letters':/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{'base':'OI','letters':/[\u01A2]/g},{'base':'OO','letters':/[\uA74E]/g},{'base':'OU','letters':/[\u0222]/g},{'base':'P','letters':/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{'base':'Q','letters':/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{'base':'R','letters':/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{'base':'S','letters':/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{'base':'T','letters':/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{'base':'TZ','letters':/[\uA728]/g},{'base':'U','letters':/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{'base':'V','letters':/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{'base':'VY','letters':/[\uA760]/g},{'base':'W','letters':/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{'base':'X','letters':/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{'base':'Y','letters':/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{'base':'Z','letters':/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{'base':'a','letters':/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{'base':'aa','letters':/[\uA733]/g},{'base':'ae','letters':/[\u00E6\u01FD\u01E3]/g},{'base':'ao','letters':/[\uA735]/g},{'base':'au','letters':/[\uA737]/g},{'base':'av','letters':/[\uA739\uA73B]/g},{'base':'ay','letters':/[\uA73D]/g},{'base':'b','letters':/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{'base':'c','letters':/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{'base':'d','letters':/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{'base':'dz','letters':/[\u01F3\u01C6]/g},{'base':'e','letters':/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{'base':'f','letters':/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{'base':'g','letters':/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{'base':'h','letters':/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{'base':'hv','letters':/[\u0195]/g},{'base':'i','letters':/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{'base':'j','letters':/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{'base':'k','letters':/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{'base':'l','letters':/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{'base':'lj','letters':/[\u01C9]/g},{'base':'m','letters':/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{'base':'n','letters':/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{'base':'nj','letters':/[\u01CC]/g},{'base':'o','letters':/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{'base':'oi','letters':/[\u01A3]/g},{'base':'ou','letters':/[\u0223]/g},{'base':'oo','letters':/[\uA74F]/g},{'base':'p','letters':/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{'base':'q','letters':/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{'base':'r','letters':/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{'base':'s','letters':/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{'base':'t','letters':/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{'base':'tz','letters':/[\uA729]/g},{'base':'u','letters':/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{'base':'v','letters':/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{'base':'vy','letters':/[\uA761]/g},{'base':'w','letters':/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{'base':'x','letters':/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{'base':'y','letters':/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{'base':'z','letters':/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];for(var i=0;i<defaultDiacriticsRemovalMap.length;i++){str=str.replace(defaultDiacriticsRemovalMap[i].letters,defaultDiacriticsRemovalMap[i].base)} +return str};module.getUniqueId=function(){return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16)})} +return module});define('mwVideoAd',['jquery'],function($){"use strict";var module={};window.pbjs=window.pbjs||{};pbjs.que=pbjs.que||[];window.PREBID_TIMEOUT=700;window.PREBID_LOADED=!1;var tempTag=!1;var preBid={placementId:'14335794',iu:'/15510053/MW/VIDEO_PRE',openxUnit:'540529024',pubmatic:'1775054@640x480',mimes:['video/mp4','application/javascript']} +if(location.pathname.indexOf('/word-games/')===0){preBid={placementId:'14335791',iu:'/15510053/MW/VIDEO_PRE_GAMES',openxUnit:'540529023',pubmatic:'1799563@640x480',}} +var invokeCallback=function(url){tempTag=url} +var videoAdUnit={code:'MWVIDEO',mediaTypes:{video:{playerSize:[640,480],context:'instream'}},bids:[{bidder:'appnexus',params:{placementId:preBid.placementId,video:{minduration:1,maxduration:15,w:640,h:480,skippable:!0,playback_method:['click_to_play']}}},{bidder:'pubmatic',params:{publisherId:'157732',adSlot:preBid.pubmatic,video:{mimes:preBid.mimes,api:[2],skippable:!0,playbackmethod:[3],protocols:[2,3,5,6],linearity:1,w:640,h:480,minduration:1,maxduration:15,startdelay:0,placement:1}}},{bidder:'openx',params:{unit:preBid.openxUnit,delDomain:'merriamwebster-d.openx.net',video:{openrtb:{imp:[{video:{mimes:preBid.mimes,minduration:1,maxduration:15,w:640,h:480,playbackmethod:[3],skip:1,skipafter:5}}]}}}}]};var requestVideoAd=function(){pbjs.requestBids({bidsBackHandler:function(bids){var videoUrl=pbjs.adServers.dfp.buildVideoUrl({adUnit:videoAdUnit,params:{iu:preBid.iu,output:'vast'}});invokeCallback(videoUrl)}})} +pbjs.que.push(function(){pbjs.addAdUnits(videoAdUnit);pbjs.setConfig({cache:{url:'https://prebid.adnxs.com/pbc/v1/cache'}});pbjs.setConfig({userSync:{filterSettings:{iframe:{bidders:'*',filter:'include'}}}});window.PREBID_LOADED=!0;requestVideoAd()});var loadPrebid=function(){var d=document,pbs=d.createElement('script'),pro=d.location.protocol;pbs.type='text/javascript';pbs.src=window.mwdata.assetsDomain2+'/mw/prebid/prebid1.35.0.js';pbs.async=!0;var target=document.getElementsByTagName('head')[0];target.insertBefore(pbs,target.firstChild)} +var getNextAd=function(){pbjs.que.push(function(){requestVideoAd()})} +module.init=function(callback){if(!window.PREBID_LOADED){loadPrebid();invokeCallback=callback;if(tempTag){invokeCallback(tempTag);tempTag=!1}else{window.setTimeout(function(){if(!window.PREBID_LOADED){invokeCallback(tempTag)}},window.PREBID_TIMEOUT+300)}}else{getNextAd()}} +return module}) \ No newline at end of file |