(()=>{"use strict";const e=window.wp.i18n,t=e=>Math.abs(parseInt(e,10)),a=(e,t,a)=>{const n=new CustomEvent(`wpcf7${t}`,{bubbles:!0,detail:a});"string"==typeof e&&(e=document.querySelector(e)),e.dispatchEvent(n)},n=(e,t)=>{const n=new Map([["init","init"],["validation_failed","invalid"],["acceptance_missing","unaccepted"],["spam","spam"],["aborted","aborted"],["mail_sent","sent"],["mail_failed","failed"],["submitting","submitting"],["resetting","resetting"],["validating","validating"],["payment_required","payment-required"]]);n.has(t)&&(t=n.get(t)),Array.from(n.values()).includes(t)||(t=`custom-${t=(t=t.replace(/[^0-9a-z]+/i," ").trim()).replace(/\s+/,"-")}`);const r=e.getAttribute("data-status");if(e.wpcf7.status=t,e.setAttribute("data-status",t),e.classList.add(t),r&&r!==t){e.classList.remove(r);const t={contactFormId:e.wpcf7.id,pluginVersion:e.wpcf7.pluginVersion,contactFormLocale:e.wpcf7.locale,unitTag:e.wpcf7.unitTag,containerPostId:e.wpcf7.containerPost,status:e.wpcf7.status,prevStatus:r};a(e,"statuschanged",t)}return t},r=e=>{const{root:t,namespace:a="contact-form-7/v1"}=wpcf7.api;return c.reduceRight(((e,t)=>a=>t(a,e)),(e=>{let n,r,{url:c,path:o,endpoint:s,headers:i,body:l,data:p,...d}=e;"string"==typeof s&&(n=a.replace(/^\/|\/$/g,""),r=s.replace(/^\//,""),o=r?n+"/"+r:n),"string"==typeof o&&(-1!==t.indexOf("?")&&(o=o.replace("?","&")),o=o.replace(/^\//,""),c=t+o),i={Accept:"application/json, */*;q=0.1",...i},delete i["X-WP-Nonce"],p&&(l=JSON.stringify(p),i["Content-Type"]="application/json");const f={code:"fetch_error",message:"You are probably offline."},u={code:"invalid_json",message:"The response is not a valid JSON response."};return window.fetch(c||o||window.location.href,{...d,headers:i,body:l}).then((e=>Promise.resolve(e).then((e=>{if(e.status>=200&&e.status<300)return e;throw e})).then((e=>{if(204===e.status)return null;if(e&&e.json)return e.json().catch((()=>{throw u}));throw u}))),(()=>{throw f}))}))(e)},c=[];function o(e,t={}){const{target:a,scope:r=e,...c}=t;if(void 0===e.wpcf7?.schema)return;const o={...e.wpcf7.schema};if(void 0!==a){if(!e.contains(a))return;if(!a.closest(".wpcf7-form-control-wrap[data-name]"))return;if(a.closest(".novalidate"))return}const p=r.querySelectorAll(".wpcf7-form-control-wrap"),d=Array.from(p).reduce(((e,t)=>(t.closest(".novalidate")||t.querySelectorAll(":where(input, textarea, select):enabled").forEach((t=>{if(t.name)switch(t.type){case"button":case"image":case"reset":case"submit":break;case"checkbox":case"radio":t.checked&&e.append(t.name,t.value);break;case"select-multiple":for(const a of t.selectedOptions)e.append(t.name,a.value);break;case"file":for(const a of t.files)e.append(t.name,a);break;default:e.append(t.name,t.value)}})),e)),new FormData),f=e.getAttribute("data-status");Promise.resolve(n(e,"validating")).then((n=>{if(void 0!==swv){const n=swv.validate(o,d,t);for(const t of p){if(void 0===t.dataset.name)continue;const c=t.dataset.name;if(n.has(c)){const{error:t,validInputs:a}=n.get(c);i(e,c),void 0!==t&&s(e,c,t,{scope:r}),l(e,c,null!=a?a:[])}if(t.contains(a))break}}})).finally((()=>{n(e,f)}))}r.use=e=>{c.unshift(e)};const s=(e,t,a,n)=>{const{scope:r=e,...c}=null!=n?n:{},o=`${e.wpcf7?.unitTag}-ve-${t}`.replaceAll(/[^0-9a-z_-]+/gi,""),s=e.querySelector(`.wpcf7-form-control-wrap[data-name="${t}"] .wpcf7-form-control`);(()=>{const t=document.createElement("li");t.setAttribute("id",o),s&&s.id?t.insertAdjacentHTML("beforeend",`<a href="#${s.id}">${a}</a>`):t.insertAdjacentText("beforeend",a),e.wpcf7.parent.querySelector(".screen-reader-response ul").appendChild(t)})(),r.querySelectorAll(`.wpcf7-form-control-wrap[data-name="${t}"]`).forEach((e=>{const t=document.createElement("span");t.classList.add("wpcf7-not-valid-tip"),t.setAttribute("aria-hidden","true"),t.insertAdjacentText("beforeend",a),e.appendChild(t),e.querySelectorAll("[aria-invalid]").forEach((e=>{e.setAttribute("aria-invalid","true")})),e.querySelectorAll(".wpcf7-form-control").forEach((e=>{e.classList.add("wpcf7-not-valid"),e.setAttribute("aria-describedby",o),"function"==typeof e.setCustomValidity&&e.setCustomValidity(a),e.closest(".use-floating-validation-tip")&&(e.addEventListener("focus",(e=>{t.setAttribute("style","display: none")})),t.addEventListener("click",(e=>{t.setAttribute("style","display: none")})))}))}))},i=(e,t)=>{const a=`${e.wpcf7?.unitTag}-ve-${t}`.replaceAll(/[^0-9a-z_-]+/gi,"");e.wpcf7.parent.querySelector(`.screen-reader-response ul li#${a}`)?.remove(),e.querySelectorAll(`.wpcf7-form-control-wrap[data-name="${t}"]`).forEach((e=>{e.querySelector(".wpcf7-not-valid-tip")?.remove(),e.querySelectorAll("[aria-invalid]").forEach((e=>{e.setAttribute("aria-invalid","false")})),e.querySelectorAll(".wpcf7-form-control").forEach((e=>{e.removeAttribute("aria-describedby"),e.classList.remove("wpcf7-not-valid"),"function"==typeof e.setCustomValidity&&e.setCustomValidity("")}))}))},l=(e,t,a)=>{e.querySelectorAll(`[data-reflection-of="${t}"]`).forEach((e=>{if("output"===e.tagName.toLowerCase()){const t=e;0===a.length&&a.push(t.dataset.default),a.slice(0,1).forEach((e=>{e instanceof File&&(e=e.name),t.textContent=e}))}else e.querySelectorAll("output").forEach((e=>{e.hasAttribute("data-default")?0===a.length?e.removeAttribute("hidden"):e.setAttribute("hidden","hidden"):e.remove()})),a.forEach((a=>{a instanceof File&&(a=a.name);const n=document.createElement("output");n.setAttribute("name",t),n.textContent=a,e.appendChild(n)}))}))};function p(e,t={}){if(wpcf7.blocked)return d(e),void n(e,"submitting");const c=new FormData(e);t.submitter&&t.submitter.name&&c.append(t.submitter.name,t.submitter.value);const o={contactFormId:e.wpcf7.id,pluginVersion:e.wpcf7.pluginVersion,contactFormLocale:e.wpcf7.locale,unitTag:e.wpcf7.unitTag,containerPostId:e.wpcf7.containerPost,status:e.wpcf7.status,inputs:Array.from(c,(e=>{const t=e[0],a=e[1];return!t.match(/^_/)&&{name:t,value:a}})).filter((e=>!1!==e)),formData:c};r({endpoint:`contact-forms/${e.wpcf7.id}/feedback`,method:"POST",body:c,wpcf7:{endpoint:"feedback",form:e,detail:o}}).then((t=>{const r=n(e,t.status);return o.status=t.status,o.apiResponse=t,["invalid","unaccepted","spam","aborted"].includes(r)?a(e,r,o):["sent","failed"].includes(r)&&a(e,`mail${r}`,o),a(e,"submit",o),t})).then((t=>{t.posted_data_hash&&(e.querySelector('input[name="_wpcf7_posted_data_hash"]').value=t.posted_data_hash),"mail_sent"===t.status&&(e.reset(),e.wpcf7.resetOnMailSent=!0),t.invalid_fields&&t.invalid_fields.forEach((t=>{s(e,t.field,t.message)})),e.wpcf7.parent.querySelector('.screen-reader-response [role="status"]').insertAdjacentText("beforeend",t.message),e.querySelectorAll(".wpcf7-response-output").forEach((e=>{e.innerText=t.message}))})).catch((e=>console.error(e)))}r.use(((e,t)=>{if(e.wpcf7&&"feedback"===e.wpcf7.endpoint){const{form:t,detail:r}=e.wpcf7;d(t),a(t,"beforesubmit",r),n(t,"submitting")}return t(e)}));const d=e=>{e.querySelectorAll(".wpcf7-form-control-wrap").forEach((t=>{t.dataset.name&&i(e,t.dataset.name)})),e.wpcf7.parent.querySelector('.screen-reader-response [role="status"]').innerText="",e.querySelectorAll(".wpcf7-response-output").forEach((e=>{e.innerText=""}))};function f(e){const t=new FormData(e),c={contactFormId:e.wpcf7.id,pluginVersion:e.wpcf7.pluginVersion,contactFormLocale:e.wpcf7.locale,unitTag:e.wpcf7.unitTag,containerPostId:e.wpcf7.containerPost,status:e.wpcf7.status,inputs:Array.from(t,(e=>{const t=e[0],a=e[1];return!t.match(/^_/)&&{name:t,value:a}})).filter((e=>!1!==e)),formData:t};r({endpoint:`contact-forms/${e.wpcf7.id}/refill`,method:"GET",wpcf7:{endpoint:"refill",form:e,detail:c}}).then((t=>{e.wpcf7.resetOnMailSent?(delete e.wpcf7.resetOnMailSent,n(e,"mail_sent")):n(e,"init"),c.apiResponse=t,a(e,"reset",c)})).catch((e=>console.error(e)))}r.use(((e,t)=>{if(e.wpcf7&&"refill"===e.wpcf7.endpoint){const{form:t,detail:a}=e.wpcf7;d(t),n(t,"resetting")}return t(e)}));const u=(e,t)=>{for(const a in t){const n=t[a];e.querySelectorAll(`input[name="${a}"]`).forEach((e=>{e.value=""})),e.querySelectorAll(`img.wpcf7-captcha-${a.replaceAll(":","")}`).forEach((e=>{e.setAttribute("src",n)}));const r=/([0-9]+)\.(png|gif|jpeg)$/.exec(n);r&&e.querySelectorAll(`input[name="_wpcf7_captcha_challenge_${a}"]`).forEach((e=>{e.value=r[1]}))}},m=(e,t)=>{for(const a in t){const n=t[a][0],r=t[a][1];e.querySelectorAll(`.wpcf7-form-control-wrap[data-name="${a}"]`).forEach((e=>{e.querySelector(`input[name="${a}"]`).value="",e.querySelector(".wpcf7-quiz-label").textContent=n,e.querySelector(`input[name="_wpcf7_quiz_answer_${a}"]`).value=r}))}};function w(e){const a=new FormData(e);e.wpcf7={id:t(a.get("_wpcf7")),status:e.getAttribute("data-status"),pluginVersion:a.get("_wpcf7_version"),locale:a.get("_wpcf7_locale"),unitTag:a.get("_wpcf7_unit_tag"),containerPost:t(a.get("_wpcf7_container_post")),parent:e.closest(".wpcf7"),get schema(){return wpcf7.schemas.get(this.id)}},wpcf7.schemas.set(e.wpcf7.id,void 0),e.querySelectorAll(".has-spinner").forEach((e=>{e.insertAdjacentHTML("afterend",'<span class="wpcf7-spinner"></span>')})),(e=>{e.querySelectorAll(".wpcf7-exclusive-checkbox").forEach((t=>{t.addEventListener("change",(t=>{const a=t.target.getAttribute("name");e.querySelectorAll(`input[type="checkbox"][name="${a}"]`).forEach((e=>{e!==t.target&&(e.checked=!1)}))}))}))})(e),(e=>{e.querySelectorAll(".has-free-text").forEach((t=>{const a=t.querySelector("input.wpcf7-free-text"),n=t.querySelector('input[type="checkbox"], input[type="radio"]');a.disabled=!n.checked,e.addEventListener("change",(e=>{a.disabled=!n.checked,e.target===n&&n.checked&&a.focus()}))}))})(e),(e=>{e.querySelectorAll(".wpcf7-validates-as-url").forEach((e=>{e.addEventListener("change",(t=>{let a=e.value.trim();a&&!a.match(/^[a-z][a-z0-9.+-]*:/i)&&-1!==a.indexOf(".")&&(a=a.replace(/^\/+/,""),a="http://"+a),e.value=a}))}))})(e),(e=>{if(!e.querySelector(".wpcf7-acceptance")||e.classList.contains("wpcf7-acceptance-as-validation"))return;const t=()=>{let t=!0;e.querySelectorAll(".wpcf7-acceptance").forEach((e=>{if(!t||e.classList.contains("optional"))return;const a=e.querySelector('input[type="checkbox"]');(e.classList.contains("invert")&&a.checked||!e.classList.contains("invert")&&!a.checked)&&(t=!1)})),e.querySelectorAll(".wpcf7-submit").forEach((e=>{e.disabled=!t}))};t(),e.addEventListener("change",(e=>{t()})),e.addEventListener("wpcf7reset",(e=>{t()}))})(e),(e=>{const a=(e,a)=>{const n=t(e.getAttribute("data-starting-value")),r=t(e.getAttribute("data-maximum-value")),c=t(e.getAttribute("data-minimum-value")),o=e.classList.contains("down")?n-a.value.trim().length:a.value.trim().length;e.setAttribute("data-current-value",o),e.innerText=o,r&&r<a.value.length?e.classList.add("too-long"):e.classList.remove("too-long"),c&&a.value.length<c?e.classList.add("too-short"):e.classList.remove("too-short")},n=t=>{t={init:!1,...t},e.querySelectorAll(".wpcf7-character-count").forEach((n=>{const r=n.getAttribute("data-target-name"),c=e.querySelector(`[name="${r}"]`);c&&(c.value=c.defaultValue,a(n,c),t.init&&c.addEventListener("keyup",(e=>{a(n,c)})))}))};n({init:!0}),e.addEventListener("wpcf7reset",(e=>{n()}))})(e),window.addEventListener("load",(t=>{wpcf7.cached&&e.reset()})),e.addEventListener("reset",(t=>{wpcf7.reset(e)})),e.addEventListener("submit",(t=>{wpcf7.submit(e,{submitter:t.submitter}),t.preventDefault()})),e.addEventListener("wpcf7submit",(t=>{t.detail.apiResponse.captcha&&u(e,t.detail.apiResponse.captcha),t.detail.apiResponse.quiz&&m(e,t.detail.apiResponse.quiz)})),e.addEventListener("wpcf7reset",(t=>{t.detail.apiResponse.captcha&&u(e,t.detail.apiResponse.captcha),t.detail.apiResponse.quiz&&m(e,t.detail.apiResponse.quiz)})),e.addEventListener("change",(t=>{t.target.closest(".wpcf7-form-control")&&wpcf7.validate(e,{target:t.target})})),e.addEventListener("wpcf7statuschanged",(t=>{const a=t.detail.status;e.querySelectorAll(".active-on-any").forEach((e=>{e.removeAttribute("inert"),e.classList.remove("active-on-any")})),e.querySelectorAll(`.inert-on-${a}`).forEach((e=>{e.setAttribute("inert","inert"),e.classList.add("active-on-any")}))}))}document.addEventListener("DOMContentLoaded",(t=>{var a;if("undefined"!=typeof wpcf7)if(void 0!==wpcf7.api)if("function"==typeof window.fetch)if("function"==typeof window.FormData)if("function"==typeof NodeList.prototype.forEach)if("function"==typeof String.prototype.replaceAll){wpcf7={init:w,submit:p,reset:f,validate:o,schemas:new Map,...null!==(a=wpcf7)&&void 0!==a?a:{}},document.querySelectorAll("form .wpcf7[data-wpcf7-id]").forEach((t=>{const a=document.createElement("p");a.setAttribute("class","wpcf7-form-in-wrong-place");const n=document.createElement("strong");n.append((0,e.__)("Error:","contact-form-7"));const r=(0,e.__)("This contact form is placed in the wrong place.","contact-form-7");a.append(n," ",r),t.replaceWith(a)})),document.querySelectorAll(".wpcf7 > form").forEach((e=>{wpcf7.init(e),e.closest(".wpcf7").classList.replace("no-js","js")}));for(const e of wpcf7.schemas.keys())r({endpoint:`contact-forms/${e}/feedback/schema`,method:"GET"}).then((t=>{wpcf7.schemas.set(e,t)}))}else console.error("Your browser does not support String.replaceAll().");else console.error("Your browser does not support NodeList.forEach().");else console.error("Your browser does not support window.FormData().");else console.error("Your browser does not support window.fetch().");else console.error("wpcf7.api is not defined.");else console.error("wpcf7 is not defined.")}))})();
var retina={};
retina.root=(typeof exports==='undefined' ? window:exports);
retina.config={
retinaImageSuffix:'@2x',
check_mime_type: true,
force_original_dimensions: true
};
retina.config.retinaImagePattern=new RegExp(retina.config.retinaImageSuffix + ".");
(function(){
function Retina(){}
window.retina.root.Retina=Retina;
Retina.configure=function(options){
if(options===null){
options={};}
for (var prop in options){
if(options.hasOwnProperty(prop)){
window.retina.config[prop]=options[prop];
}}
};
Retina.init=function(context){
if(context===null){
context=window.retina.root;
}
var existing_onload=context.onload||function(){};
context.onload=function(){
var images=document.getElementsByTagName('img'), retinaImages=[], i, image;
for (i=0; i < images.length; i +=1){
image=images[i];
if(!retina.config.retinaImagePattern.test(image.getAttribute("src"))){
if(!!!image.getAttributeNode('data-no-retina')){
retinaImages.push(new RetinaImage(image));
}}
}
existing_onload();
};};
Retina.isRetina=function(){
var mediaQuery='(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)';
if(window.retina.root.devicePixelRatio > 1){
return true;
}
if(window.retina.root.matchMedia&&window.retina.root.matchMedia(mediaQuery).matches){
return true;
}
return false;
};
var regexMatch=/\.\w+$/;
function suffixReplace (match){
return window.retina.config.retinaImageSuffix + match;
}
function RetinaImagePath(path, at_2x_path){
this.path=path||'';
if(typeof at_2x_path!=='undefined'&&at_2x_path!==null){
this.at_2x_path=at_2x_path;
this.perform_check=false;
}else{
if(undefined!==document.createElement){
var locationObject=document.createElement('a');
locationObject.href=this.path;
locationObject.pathname=locationObject.pathname.replace(regexMatch, suffixReplace);
this.at_2x_path=locationObject.href;
}else{
var parts=this.path.split('?');
parts[0]=parts[0].replace(regexMatch, suffixReplace);
this.at_2x_path=parts.join('?');
}
this.perform_check=true;
}}
window.retina.root.RetinaImagePath=RetinaImagePath;
RetinaImagePath.confirmed_paths=[];
RetinaImagePath.prototype.is_external=function(){
return !!(this.path.match(/^https?\:/i)&&!this.path.match('//' + document.domain));
};
RetinaImagePath.prototype.check_2x_variant=function(callback){
var http, that=this;
if(this.is_external()){
return callback(false);
}else if(!this.perform_check&&typeof this.at_2x_path!=='undefined'&&this.at_2x_path!==null){
return callback(true);
}else if(this.at_2x_path in RetinaImagePath.confirmed_paths){
return callback(true);
}else{
return callback(false);
}};
function RetinaImage(el){
this.el=el;
this.path=new RetinaImagePath(this.el.getAttribute('src'), this.el.getAttribute('data-at2x'));
var that=this;
this.path.check_2x_variant(function(hasVariant){
if(hasVariant){
that.swap();
}});
}
window.retina.root.RetinaImage=RetinaImage;
RetinaImage.prototype.swap=function(path){
if(typeof path==='undefined'){
path=this.path.at_2x_path;
}
var that=this;
function load(){
var width=that.el.offsetWidth;
var height=that.el.offsetHeight;
if(!that.el.complete||!width||!height){
setTimeout(load, 5);
}else{
if(window.retina.config.force_original_dimensions){
that.el.setAttribute('width', width);
that.el.setAttribute('height', height);
}
that.el.setAttribute('src', path);
}}
load();
};
if(Retina.isRetina()){
Retina.init(window.retina.root);
}})();
;
window.Modernizr=(function(window, document, undefined){
var version='2.8.3',
Modernizr={},
enableClasses=true,
docElement=document.documentElement,
mod='modernizr',
modElem=document.createElement(mod),
mStyle=modElem.style,
inputElem  ,
toString={}.toString,
prefixes=' -webkit- -moz- -o- -ms- '.split(' '),
omPrefixes='Webkit Moz O ms',
cssomPrefixes=omPrefixes.split(' '),
domPrefixes=omPrefixes.toLowerCase().split(' '),
tests={},
inputs={},
attrs={},
classes=[],
slice=classes.slice,
featureName,
injectElementWithStyles=function(rule, callback, nodes, testnames){
var style, ret, node, docOverflow,
div=document.createElement('div'),
body=document.body,
fakeBody=body||document.createElement('body');
if(parseInt(nodes, 10)){
while(nodes--){
node=document.createElement('div');
node.id=testnames ? testnames[nodes]:mod + (nodes + 1);
div.appendChild(node);
}}
style=['&#173;','<style id="s', mod, '">', rule, '</style>'].join('');
div.id=mod;
(body ? div:fakeBody).innerHTML +=style;
fakeBody.appendChild(div);
if(!body){
fakeBody.style.background='';
fakeBody.style.overflow='hidden';
docOverflow=docElement.style.overflow;
docElement.style.overflow='hidden';
docElement.appendChild(fakeBody);
}
ret=callback(div, rule);
if(!body){
fakeBody.parentNode.removeChild(fakeBody);
docElement.style.overflow=docOverflow;
}else{
div.parentNode.removeChild(div);
}
return !!ret;
},
isEventSupported=(function(){
var TAGNAMES={
'select': 'input', 'change': 'input',
'submit': 'form', 'reset': 'form',
'error': 'img', 'load': 'img', 'abort': 'img'
};
function isEventSupported(eventName, element){
element=element||document.createElement(TAGNAMES[eventName]||'div');
eventName='on' + eventName;
var isSupported=eventName in element;
if(!isSupported){
if(!element.setAttribute){
element=document.createElement('div');
}
if(element.setAttribute&&element.removeAttribute){
element.setAttribute(eventName, '');
isSupported=is(element[eventName], 'function');
if(!is(element[eventName], 'undefined')){
element[eventName]=undefined;
}
element.removeAttribute(eventName);
}}
element=null;
return isSupported;
}
return isEventSupported;
})(),
_hasOwnProperty=({}).hasOwnProperty, hasOwnProp;
if(!is(_hasOwnProperty, 'undefined')&&!is(_hasOwnProperty.call, 'undefined')){
hasOwnProp=function (object, property){
return _hasOwnProperty.call(object, property);
};}else{
hasOwnProp=function (object, property){
return ((property in object)&&is(object.constructor.prototype[property], 'undefined'));
};}
if(!Function.prototype.bind){
Function.prototype.bind=function bind(that){
var target=this;
if(typeof target!="function"){
throw new TypeError();
}
var args=slice.call(arguments, 1),
bound=function (){
if(this instanceof bound){
var F=function(){};
F.prototype=target.prototype;
var self=new F();
var result=target.apply(self,
args.concat(slice.call(arguments))
);
if(Object(result)===result){
return result;
}
return self;
}else{
return target.apply(that,
args.concat(slice.call(arguments))
);
}};
return bound;
};}
function setCss(str){
mStyle.cssText=str;
}
function setCssAll(str1, str2){
return setCss(prefixes.join(str1 + ';') +(str2||''));
}
function is(obj, type){
return typeof obj===type;
}
function contains(str, substr){
return !!~('' + str).indexOf(substr);
}
function testProps(props, prefixed){
for(var i in props){
var prop=props[i];
if(!contains(prop, "-")&&mStyle[prop]!==undefined){
return prefixed=='pfx' ? prop:true;
}}
return false;
}
function testDOMProps(props, obj, elem){
for(var i in props){
var item=obj[props[i]];
if(item!==undefined){
if(elem===false) return props[i];
if(is(item, 'function')){
return item.bind(elem||obj);
}
return item;
}}
return false;
}
function testPropsAll(prop, prefixed, elem){
var ucProp=prop.charAt(0).toUpperCase() + prop.slice(1),
props=(prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
if(is(prefixed, "string")||is(prefixed, "undefined")){
return testProps(props, prefixed);
}else{
props=(prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
return testDOMProps(props, prefixed, elem);
}}    tests['touch']=function(){
var bool;
if(('ontouchstart' in window)||window.DocumentTouch&&document instanceof DocumentTouch){
bool=true;
}else{
injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function(node){
bool=node.offsetTop===9;
});
}
return bool;
};
for(var feature in tests){
if(hasOwnProp(tests, feature)){
featureName=feature.toLowerCase();
Modernizr[featureName]=tests[feature]();
classes.push((Modernizr[featureName] ? '':'no-') + featureName);
}}
Modernizr.addTest=function(feature, test){
if(typeof feature=='object'){
for(var key in feature){
if(hasOwnProp(feature, key) ){
Modernizr.addTest(key, feature[ key ]);
}}
}else{
feature=feature.toLowerCase();
if(Modernizr[feature]!==undefined){
return Modernizr;
}
test=typeof test=='function' ? test():test;
if(typeof enableClasses!=="undefined"&&enableClasses){
docElement.className +=' ' + (test ? '':'no-') + feature;
}
Modernizr[feature]=test;
}
return Modernizr;
};
setCss('');
modElem=inputElem=null;
;(function(window, document){
var version='3.7.0';
var options=window.html5||{};
var reSkip=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
var saveClones=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
var supportsHtml5Styles;
var expando='_html5shiv';
var expanID=0;
var expandoData={};
var supportsUnknownElements;
(function(){
try {
var a=document.createElement('a');
a.innerHTML='<xyz></xyz>';
supportsHtml5Styles=('hidden' in a);
supportsUnknownElements=a.childNodes.length==1||(function(){
(document.createElement)('a');
var frag=document.createDocumentFragment();
return (
typeof frag.cloneNode=='undefined' ||
typeof frag.createDocumentFragment=='undefined' ||
typeof frag.createElement=='undefined'
);
}());
} catch(e){
supportsHtml5Styles=true;
supportsUnknownElements=true;
}}());
function addStyleSheet(ownerDocument, cssText){
var p=ownerDocument.createElement('p'),
parent=ownerDocument.getElementsByTagName('head')[0]||ownerDocument.documentElement;
p.innerHTML='x<style>' + cssText + '</style>';
return parent.insertBefore(p.lastChild, parent.firstChild);
}
function getElements(){
var elements=html5.elements;
return typeof elements=='string' ? elements.split(' '):elements;
}
function getExpandoData(ownerDocument){
var data=expandoData[ownerDocument[expando]];
if(!data){
data={};
expanID++;
ownerDocument[expando]=expanID;
expandoData[expanID]=data;
}
return data;
}
function createElement(nodeName, ownerDocument, data){
if(!ownerDocument){
ownerDocument=document;
}
if(supportsUnknownElements){
return ownerDocument.createElement(nodeName);
}
if(!data){
data=getExpandoData(ownerDocument);
}
var node;
if(data.cache[nodeName]){
node=data.cache[nodeName].cloneNode();
}else if(saveClones.test(nodeName)){
node=(data.cache[nodeName]=data.createElem(nodeName)).cloneNode();
}else{
node=data.createElem(nodeName);
}
return node.canHaveChildren&&!reSkip.test(nodeName)&&!node.tagUrn ? data.frag.appendChild(node):node;
}
function createDocumentFragment(ownerDocument, data){
if(!ownerDocument){
ownerDocument=document;
}
if(supportsUnknownElements){
return ownerDocument.createDocumentFragment();
}
data=data||getExpandoData(ownerDocument);
var clone=data.frag.cloneNode(),
i=0,
elems=getElements(),
l=elems.length;
for(;i<l;i++){
clone.createElement(elems[i]);
}
return clone;
}
function shivMethods(ownerDocument, data){
if(!data.cache){
data.cache={};
data.createElem=ownerDocument.createElement;
data.createFrag=ownerDocument.createDocumentFragment;
data.frag=data.createFrag();
}
ownerDocument.createElement=function(nodeName){
if(!html5.shivMethods){
return data.createElem(nodeName);
}
return createElement(nodeName, ownerDocument, data);
};
ownerDocument.createDocumentFragment=Function('h,f', 'return function(){' +
'var n=f.cloneNode(),c=n.createElement;' +
'h.shivMethods&&(' +
getElements().join().replace(/[\w\-]+/g, function(nodeName){
data.createElem(nodeName);
data.frag.createElement(nodeName);
return 'c("' + nodeName + '")';
}) +
');return n}'
)(html5, data.frag);
}
function shivDocument(ownerDocument){
if(!ownerDocument){
ownerDocument=document;
}
var data=getExpandoData(ownerDocument);
if(html5.shivCSS&&!supportsHtml5Styles&&!data.hasCSS){
data.hasCSS = !!addStyleSheet(ownerDocument,
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
'mark{background:#FF0;color:#000}' +
'template{display:none}'
);
}
if(!supportsUnknownElements){
shivMethods(ownerDocument, data);
}
return ownerDocument;
}
var html5={
'elements': options.elements||'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video',
'version': version,
'shivCSS': (options.shivCSS!==false),
'supportsUnknownElements': supportsUnknownElements,
'shivMethods': (options.shivMethods!==false),
'type': 'default',
'shivDocument': shivDocument,
createElement: createElement,
createDocumentFragment: createDocumentFragment
};
window.html5=html5;
shivDocument(document);
}(this, document));
Modernizr._version=version;
Modernizr._prefixes=prefixes;
Modernizr._domPrefixes=domPrefixes;
Modernizr._cssomPrefixes=cssomPrefixes;
Modernizr.hasEvent=isEventSupported;
Modernizr.testProp=function(prop){
return testProps([prop]);
};
Modernizr.testAllProps=testPropsAll;
Modernizr.testStyles=injectElementWithStyles;
Modernizr.prefixed=function(prop, obj, elem){
if(!obj){
return testPropsAll(prop, 'pfx');
}else{
return testPropsAll(prop, obj, elem);
}};
docElement.className=docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
(enableClasses ? ' js ' + classes.join(' '):'');
return Modernizr;
})(this, this.document);
(function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}})(this,document);
Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0));};
;
if(typeof Object.create!=="function"){
Object.create=function (obj){
function F(){}
F.prototype=obj;
return new F();
};}
(function($, window, document){
var Carousel={
init:function (options, el){
var base=this;
base.$elem=$(el);
base.options=$.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options);
base.userOptions=options;
base.loadContent();
},
loadContent:function (){
var base=this, url;
function getData(data){
var i, content="";
if(typeof base.options.jsonSuccess==="function"){
base.options.jsonSuccess.apply(this, [data]);
}else{
for (i in data.owl){
if(data.owl.hasOwnProperty(i)){
content +=data.owl[i].item;
}}
base.$elem.html(content);
}
base.logIn();
}
if(typeof base.options.beforeInit==="function"){
base.options.beforeInit.apply(this, [base.$elem]);
}
if(typeof base.options.jsonPath==="string"){
url=base.options.jsonPath;
$.getJSON(url, getData);
}else{
base.logIn();
}},
logIn:function (){
var base=this;
base.$elem.data("owl-originalStyles", base.$elem.attr("style"));
base.$elem.data("owl-originalClasses", base.$elem.attr("class"));
base.$elem.css({opacity: 0});
base.orignalItems=base.options.items;
base.checkBrowser();
base.wrapperWidth=0;
base.checkVisible=null;
base.setVars();
},
setVars:function (){
var base=this;
if(base.$elem.children().length===0){return false; }
base.baseClass();
base.eventTypes();
base.$userItems=base.$elem.children();
base.itemsAmount=base.$userItems.length;
base.wrapItems();
base.$owlItems=base.$elem.find(".owl-wrapper").eq(0).children(".owl-item");
base.$owlWrapper=base.$elem.find(".owl-wrapper").eq(0);
base.playDirection="next";
base.prevItem=0;
base.prevArr=[0];
base.currentItem=0;
base.customEvents();
base.onStartup();
},
onStartup:function (){
var base=this;
base.updateItems();
base.calculateAll();
base.buildControls();
base.updateControls();
base.response();
base.moveEvents();
base.stopOnHover();
base.owlStatus();
if(base.options.transitionStyle!==false){
base.transitionTypes(base.options.transitionStyle);
}
if(base.options.autoPlay===true){
base.options.autoPlay=5000;
}
base.play();
base.$elem.find(".owl-wrapper").css("display", "block");
if(!base.$elem.is(":visible")){
base.watchVisibility();
}else{
base.$elem.css("opacity", 1);
}
base.onstartup=false;
base.eachMoveUpdate();
if(typeof base.options.afterInit==="function"){
base.options.afterInit.apply(this, [base.$elem]);
}},
eachMoveUpdate:function (){
var base=this;
if(base.options.lazyLoad===true){
base.lazyLoad();
}
if(base.options.autoHeight===true){
base.autoHeight();
}
base.onVisibleItems();
if(typeof base.options.afterAction==="function"){
base.options.afterAction.apply(this, [base.$elem]);
}},
updateVars:function (){
var base=this;
if(typeof base.options.beforeUpdate==="function"){
base.options.beforeUpdate.apply(this, [base.$elem]);
}
base.watchVisibility();
base.updateItems();
base.calculateAll();
base.updatePosition();
base.updateControls();
base.eachMoveUpdate();
if(typeof base.options.afterUpdate==="function"){
base.options.afterUpdate.apply(this, [base.$elem]);
}},
reload:function (){
var base=this;
window.setTimeout(function (){
base.updateVars();
}, 0);
},
watchVisibility:function (){
var base=this;
if(base.$elem.is(":visible")===false){
base.$elem.css({opacity: 0});
window.clearInterval(base.autoPlayInterval);
window.clearInterval(base.checkVisible);
}else{
return false;
}
base.checkVisible=window.setInterval(function (){
if(base.$elem.is(":visible")){
base.reload();
base.$elem.animate({opacity: 1}, 200);
window.clearInterval(base.checkVisible);
}}, 500);
},
wrapItems:function (){
var base=this;
base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>");
base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">");
base.wrapperOuter=base.$elem.find(".owl-wrapper-outer");
base.$elem.css("display", "block");
},
baseClass:function (){
var base=this,
hasBaseClass=base.$elem.hasClass(base.options.baseClass),
hasThemeClass=base.$elem.hasClass(base.options.theme);
if(!hasBaseClass){
base.$elem.addClass(base.options.baseClass);
}
if(!hasThemeClass){
base.$elem.addClass(base.options.theme);
}},
updateItems:function (){
var base=this, width, i;
if(base.options.responsive===false){
return false;
}
if(base.options.singleItem===true){
base.options.items=base.orignalItems=1;
base.options.itemsCustom=false;
base.options.itemsDesktop=false;
base.options.itemsDesktopSmall=false;
base.options.itemsTablet=false;
base.options.itemsTabletSmall=false;
base.options.itemsMobile=false;
return false;
}
width=$(base.options.responsiveBaseWidth).width();
if(width > (base.options.itemsDesktop[0]||base.orignalItems)){
base.options.items=base.orignalItems;
}
if(base.options.itemsCustom!==false){
base.options.itemsCustom.sort(function (a, b){return a[0] - b[0]; });
for (i=0; i < base.options.itemsCustom.length; i +=1){
if(base.options.itemsCustom[i][0] <=width){
base.options.items=base.options.itemsCustom[i][1];
}}
}else{
if(width <=base.options.itemsDesktop[0]&&base.options.itemsDesktop!==false){
base.options.items=base.options.itemsDesktop[1];
}
if(width <=base.options.itemsDesktopSmall[0]&&base.options.itemsDesktopSmall!==false){
base.options.items=base.options.itemsDesktopSmall[1];
}
if(width <=base.options.itemsTablet[0]&&base.options.itemsTablet!==false){
base.options.items=base.options.itemsTablet[1];
}
if(width <=base.options.itemsTabletSmall[0]&&base.options.itemsTabletSmall!==false){
base.options.items=base.options.itemsTabletSmall[1];
}
if(width <=base.options.itemsMobile[0]&&base.options.itemsMobile!==false){
base.options.items=base.options.itemsMobile[1];
}}
if(base.options.items > base.itemsAmount&&base.options.itemsScaleUp===true){
base.options.items=base.itemsAmount;
}},
response:function (){
var base=this,
smallDelay,
lastWindowWidth;
base.resizer=function (){
if($(window).width()!==lastWindowWidth){
if(base.options.autoPlay!==false){
window.clearInterval(base.autoPlayInterval);
}
window.clearTimeout(smallDelay);
smallDelay=window.setTimeout(function (){
lastWindowWidth=$(window).width();
base.updateVars();
}, base.options.responsiveRefreshRate);
}};
if(base.options.responsive!==true){
return false;
}
lastWindowWidth=$(window).width();
$(window).resize(base.resizer);
},
updatePosition:function (){
var base=this;
base.jumpTo(base.currentItem);
if(base.options.autoPlay!==false){
base.checkAp();
}},
appendItemsSizes:function (){
var base=this,
roundPages=0,
lastItem=base.itemsAmount - base.options.items;
base.$owlItems.each(function (index){
var $this=$(this);
$this
.css({"width": base.itemWidth})
.data("owl-item", Number(index));
if(index % base.options.items===0||index===lastItem){
if(!(index > lastItem)){
roundPages +=1;
}}
$this.data("owl-roundPages", roundPages);
});
},
appendWrapperSizes:function (){
var base=this,
width=base.$owlItems.length * base.itemWidth,
cssObj;
base.options['direction']=="rtl" ? cssObj={"right":0,direction:"rtl"}:cssObj={"left":0};
base.$owlWrapper.css({"width": width});
base.$owlWrapper.css(cssObj);
base.appendItemsSizes();
},
calculateAll:function (){
var base=this;
base.calculateWidth();
base.appendWrapperSizes();
base.loops();
base.max();
},
calculateWidth:function (){
var base=this;
base.itemWidth=Math.floor(base.$elem.width() / base.options.items);
},
max:function (){
var base=this,
maximum=((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1;
if(base.options.items > base.itemsAmount){
base.maximumItem=0;
maximum=0;
base.maximumPixels=0;
}else{
base.maximumItem=base.itemsAmount - base.options.items;
base.maximumPixels=maximum;
}
return maximum;
},
min:function (){
return 0;
},
loops:function (){
var base=this,
prev=0,
elWidth=0,
i,
item,
roundPageNum;
base.positionsInArray=[0];
base.pagesInArray=[];
for (i=0; i < base.itemsAmount; i +=1){
elWidth +=base.itemWidth;
base.positionsInArray.push(-elWidth);
if(base.options.scrollPerPage===true){
item=$(base.$owlItems[i]);
roundPageNum=item.data("owl-roundPages");
if(roundPageNum!==prev){
base.pagesInArray[prev]=base.positionsInArray[i];
prev=roundPageNum;
}}
}},
buildControls:function (){
var base=this;
if(base.options.navigation===true||base.options.pagination===true){
base.owlControls=$("<div class=\"owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem);
}
if(base.options.pagination===true){
base.buildPagination();
}
if(base.options.navigation===true){
base.buildButtons();
}},
buildButtons:function (){
var base=this,
buttonsWrapper=$("<div class=\"owl-buttons\"/>");
base.owlControls.append(buttonsWrapper);
base.buttonPrev=$("<div/>", {
"class":"owl-prev",
"html":base.options.navigationText[0]||""
});
base.buttonNext=$("<div/>", {
"class":"owl-next",
"html":base.options.navigationText[1]||""
});
buttonsWrapper
.append(base.buttonPrev)
.append(base.buttonNext);
buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function (event){
event.preventDefault();
});
buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function (event){
event.preventDefault();
if($(this).hasClass("owl-next")){
base.next();
}else{
base.prev();
}});
},
buildPagination:function (){
var base=this;
base.paginationWrapper=$("<div class=\"owl-pagination\"/>");
base.owlControls.append(base.paginationWrapper);
base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function (event){
event.preventDefault();
if(Number($(this).data("owl-page"))!==base.currentItem){
base.goTo(Number($(this).data("owl-page")), true);
}});
},
updatePagination:function (){
var base=this,
counter,
lastPage,
lastItem,
i,
paginationButton,
paginationButtonInner;
if(base.options.pagination===false){
return false;
}
base.paginationWrapper.html("");
counter=0;
lastPage=base.itemsAmount - base.itemsAmount % base.options.items;
for (i=0; i < base.itemsAmount; i +=1){
if(i % base.options.items===0){
counter +=1;
if(lastPage===i){
lastItem=base.itemsAmount - base.options.items;
}
paginationButton=$("<div/>", {
"class":"owl-page"
});
paginationButtonInner=$("<span></span>", {
"text": base.options.paginationNumbers===true ? counter:"",
"class": base.options.paginationNumbers===true ? "owl-numbers":""
});
paginationButton.append(paginationButtonInner);
paginationButton.data("owl-page", lastPage===i ? lastItem:i);
paginationButton.data("owl-roundPages", counter);
base.paginationWrapper.append(paginationButton);
}}
base.checkPagination();
},
checkPagination:function (){
var base=this;
if(base.options.pagination===false){
return false;
}
base.paginationWrapper.find(".owl-page").each(function (){
if($(this).data("owl-roundPages")===$(base.$owlItems[base.currentItem]).data("owl-roundPages")){
base.paginationWrapper
.find(".owl-page")
.removeClass("active");
$(this).addClass("active");
}});
},
checkNavigation:function (){
var base=this;
if(base.options.navigation===false){
return false;
}
if(base.options.rewindNav===false){
if(base.currentItem===0&&base.maximumItem===0){
base.buttonPrev.addClass("disabled");
base.buttonNext.addClass("disabled");
}else if(base.currentItem===0&&base.maximumItem!==0){
base.buttonPrev.addClass("disabled");
base.buttonNext.removeClass("disabled");
}else if(base.currentItem===base.maximumItem){
base.buttonPrev.removeClass("disabled");
base.buttonNext.addClass("disabled");
}else if(base.currentItem!==0&&base.currentItem!==base.maximumItem){
base.buttonPrev.removeClass("disabled");
base.buttonNext.removeClass("disabled");
}}
},
updateControls:function (){
var base=this;
base.updatePagination();
base.checkNavigation();
if(base.owlControls){
if(base.options.items >=base.itemsAmount){
base.owlControls.hide();
}else{
base.owlControls.show();
}}
},
destroyControls:function (){
var base=this;
if(base.owlControls){
base.owlControls.remove();
}},
next:function (speed){
var base=this;
if(base.isTransition){
return false;
}
base.currentItem +=base.options.scrollPerPage===true ? base.options.items:1;
if(base.currentItem > base.maximumItem + (base.options.scrollPerPage===true ? (base.options.items - 1):0)){
if(base.options.rewindNav===true){
base.currentItem=0;
speed="rewind";
}else{
base.currentItem=base.maximumItem;
return false;
}}
base.goTo(base.currentItem, speed);
},
prev:function (speed){
var base=this;
if(base.isTransition){
return false;
}
if(base.options.scrollPerPage===true&&base.currentItem > 0&&base.currentItem < base.options.items){
base.currentItem=0;
}else{
base.currentItem -=base.options.scrollPerPage===true ? base.options.items:1;
}
if(base.currentItem < 0){
if(base.options.rewindNav===true){
base.currentItem=base.maximumItem;
speed="rewind";
}else{
base.currentItem=0;
return false;
}}
base.goTo(base.currentItem, speed);
},
goTo:function (position, speed, drag){
var base=this,
goToPixel;
if(base.isTransition){
return false;
}
if(typeof base.options.beforeMove==="function"){
base.options.beforeMove.apply(this, [base.$elem]);
}
if(position >=base.maximumItem){
position=base.maximumItem;
}else if(position <=0){
position=0;
}
base.currentItem=base.owl.currentItem=position;
if(base.options.transitionStyle!==false&&drag!=="drag"&&base.options.items===1&&base.browser.support3d===true){
base.swapSpeed(0);
if(base.browser.support3d===true){
base.transition3d(base.positionsInArray[position]);
}else{
base.css2slide(base.positionsInArray[position], 1);
}
base.afterGo();
base.singleItemTransition();
return false;
}
goToPixel=base.positionsInArray[position];
if(base.browser.support3d===true){
base.isCss3Finish=false;
if(speed===true){
base.swapSpeed("paginationSpeed");
window.setTimeout(function (){
base.isCss3Finish=true;
}, base.options.paginationSpeed);
}else if(speed==="rewind"){
base.swapSpeed(base.options.rewindSpeed);
window.setTimeout(function (){
base.isCss3Finish=true;
}, base.options.rewindSpeed);
}else{
base.swapSpeed("slideSpeed");
window.setTimeout(function (){
base.isCss3Finish=true;
}, base.options.slideSpeed);
}
base.transition3d(goToPixel);
}else{
if(speed===true){
base.css2slide(goToPixel, base.options.paginationSpeed);
}else if(speed==="rewind"){
base.css2slide(goToPixel, base.options.rewindSpeed);
}else{
base.css2slide(goToPixel, base.options.slideSpeed);
}}
base.afterGo();
},
jumpTo:function (position){
var base=this;
if(typeof base.options.beforeMove==="function"){
base.options.beforeMove.apply(this, [base.$elem]);
}
if(position >=base.maximumItem||position===-1){
position=base.maximumItem;
}else if(position <=0){
position=0;
}
base.swapSpeed(0);
if(base.browser.support3d===true){
base.transition3d(base.positionsInArray[position]);
}else{
base.css2slide(base.positionsInArray[position], 1);
}
base.currentItem=base.owl.currentItem=position;
base.afterGo();
},
afterGo:function (){
var base=this;
base.prevArr.push(base.currentItem);
base.prevItem=base.owl.prevItem=base.prevArr[base.prevArr.length - 2];
base.prevArr.shift(0);
if(base.prevItem!==base.currentItem){
base.checkPagination();
base.checkNavigation();
base.eachMoveUpdate();
if(base.options.autoPlay!==false){
base.checkAp();
}}
if(typeof base.options.afterMove==="function"&&base.prevItem!==base.currentItem){
base.options.afterMove.apply(this, [base.$elem]);
}},
stop:function (){
var base=this;
base.apStatus="stop";
window.clearInterval(base.autoPlayInterval);
},
checkAp:function (){
var base=this;
if(base.apStatus!=="stop"){
base.play();
}},
play:function (){
var base=this;
base.apStatus="play";
if(base.options.autoPlay===false){
return false;
}
window.clearInterval(base.autoPlayInterval);
base.autoPlayInterval=window.setInterval(function (){
base.next(true);
}, base.options.autoPlay);
},
swapSpeed:function (action){
var base=this;
if(action==="slideSpeed"){
base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed));
}else if(action==="paginationSpeed"){
base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed));
}else if(typeof action!=="string"){
base.$owlWrapper.css(base.addCssSpeed(action));
}},
addCssSpeed:function (speed){
return {
"-webkit-transition": "all " + speed + "ms ease",
"-moz-transition": "all " + speed + "ms ease",
"-o-transition": "all " + speed + "ms ease",
"transition": "all " + speed + "ms ease"
};},
removeTransition:function (){
return {
"-webkit-transition": "",
"-moz-transition": "",
"-o-transition": "",
"transition": ""
};},
doTranslate:function (pixels){
var base=this;
base.options['direction']=="rtl" ? pixels=-pixels:pixels=pixels ;
return {
"-webkit-transform": "translate3d(" + pixels + "px, 0px, 0px)",
"-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)",
"-o-transform": "translate3d(" + pixels + "px, 0px, 0px)",
"-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)",
"transform": "translate3d(" + pixels + "px, 0px,0px)"
};},
transition3d:function (value){
var base=this;
base.$owlWrapper.css(base.doTranslate(value));
},
css2move:function (value){
var base=this, cssObj;
base.options['direction']=="rtl" ? cssObj={"right":value}:cssObj={"left":value};
base.$owlWrapper.css(cssObj);
},
css2slide:function (value, speed){
var base=this, cssObj;
base.options['direction']=="rtl" ? cssObj={"right":value}:cssObj={"left":value};
base.isCssFinish=false;
base.$owlWrapper.stop(true,true).animate(cssObj, {
duration:speed||base.options.slideSpeed,
complete:function (){
base.isCssFinish=true;
}});
},
checkBrowser:function (){
var base=this,
translate3D="translate3d(0px, 0px, 0px)",
tempElem=document.createElement("div"),
regex,
asSupport,
support3d,
isTouch;
tempElem.style.cssText="  -moz-transform:" + translate3D +
"; -ms-transform:"     + translate3D +
"; -o-transform:"      + translate3D +
"; -webkit-transform:" + translate3D +
"; transform:"         + translate3D;
regex=/translate3d\(0px, 0px, 0px\)/g;
asSupport=tempElem.style.cssText.match(regex);
support3d=(asSupport!==null&&asSupport.length >=1);
isTouch="ontouchstart" in window||window.navigator.msMaxTouchPoints;
base.browser={
"support3d":support3d,
"isTouch":isTouch
};},
moveEvents:function (){
var base=this;
if(base.options.mouseDrag!==false||base.options.touchDrag!==false){
base.gestures();
base.disabledEvents();
}},
eventTypes:function (){
var base=this,
types=["s", "e", "x"];
base.ev_types={};
if(base.options.mouseDrag===true&&base.options.touchDrag===true){
types=[
"touchstart.owl mousedown.owl",
"touchmove.owl mousemove.owl",
"touchend.owl touchcancel.owl mouseup.owl"
];
}else if(base.options.mouseDrag===false&&base.options.touchDrag===true){
types=[
"touchstart.owl",
"touchmove.owl",
"touchend.owl touchcancel.owl"
];
}else if(base.options.mouseDrag===true&&base.options.touchDrag===false){
types=[
"mousedown.owl",
"mousemove.owl",
"mouseup.owl"
];
}
base.ev_types.start=types[0];
base.ev_types.move=types[1];
base.ev_types.end=types[2];
},
disabledEvents:function (){
var base=this;
base.$elem.on("dragstart.owl", function (event){ event.preventDefault(); });
base.$elem.on("mousedown.disableTextSelect", function (e){
return $(e.target).is('input, textarea, select, option');
});
},
gestures:function (){
var base=this,
locals={
offsetX:0,
offsetY:0,
baseElWidth:0,
relativePos:0,
position: null,
minSwipe:null,
maxSwipe: null,
sliding:null,
dargging: null,
targetElement:null
};
base.isCssFinish=true;
function getTouches(event){
if(event.touches!==undefined){
return {
x:event.touches[0].pageX,
y:event.touches[0].pageY
};}
if(event.touches===undefined){
if(event.pageX!==undefined){
return {
x:event.pageX,
y:event.pageY
};}
if(event.pageX===undefined){
return {
x:event.clientX,
y:event.clientY
};}}
}
function swapEvents(type){
if(type==="on"){
$(document).on(base.ev_types.move, dragMove);
$(document).on(base.ev_types.end, dragEnd);
}else if(type==="off"){
$(document).off(base.ev_types.move);
$(document).off(base.ev_types.end);
}}
function dragStart(event){
var ev=event.originalEvent||event||window.event,
position;
if(ev.which===3){
return false;
}
if(base.itemsAmount <=base.options.items){
return;
}
if(base.isCssFinish===false&&!base.options.dragBeforeAnimFinish){
return false;
}
if(base.isCss3Finish===false&&!base.options.dragBeforeAnimFinish){
return false;
}
if(base.options.autoPlay!==false){
window.clearInterval(base.autoPlayInterval);
}
if(base.browser.isTouch!==true&&!base.$owlWrapper.hasClass("grabbing")){
base.$owlWrapper.addClass("grabbing");
}
base.newPosX=0;
base.newRelativeX=0;
$(this).css(base.removeTransition());
var position=$(this).position();
if(base.options['direction']=="rtl"){
positionRight=base.$owlItems.eq(0).width()*base.currentItem;
locals.relativePos=positionRight;
locals.offsetX=-getTouches(ev).x + positionRight;
}else{
locals.relativePos=position.left;
locals.offsetX=getTouches(ev).x - position.left;
}
locals.offsetY=getTouches(ev).y - position.top;
swapEvents("on");
locals.sliding=false;
locals.targetElement=ev.target||ev.srcElement;
}
function dragMove(event){
var ev=event.originalEvent||event||window.event,
minSwipe,
maxSwipe;
if(base.options['direction']=="rtl"){
base.newPosX=-getTouches(ev).x - locals.offsetX;
base.newPosY=getTouches(ev).y - locals.offsetY;
base.newRelativeX=base.newPosX + locals.relativePos;
}else{
base.newPosX=getTouches(ev).x - locals.offsetX;
base.newPosY=getTouches(ev).y - locals.offsetY;
base.newRelativeX=base.newPosX - locals.relativePos;
}
if(typeof base.options.startDragging==="function"&&locals.dragging!==true&&base.newRelativeX!==0){
locals.dragging=true;
base.options.startDragging.apply(base, [base.$elem]);
}
if((base.newRelativeX > 8||base.newRelativeX < -8)&&(base.browser.isTouch===true)){
if(ev.preventDefault!==undefined){
ev.preventDefault();
}else{
ev.returnValue=false;
}
locals.sliding=true;
}
if((base.newPosY > 10||base.newPosY < -10)&&locals.sliding===false){
$(document).off("touchmove.owl");
}
minSwipe=function (){
return base.newRelativeX / 5;
};
maxSwipe=function (){
return base.maximumPixels + base.newRelativeX / 5;
};
base.newPosX=Math.max(Math.min(base.newPosX, minSwipe()), maxSwipe());
if(base.browser.support3d===true){
base.transition3d(base.newPosX);
}else{
base.css2move(base.newPosX);
}}
function dragEnd(event){
var ev=event.originalEvent||event||window.event,
newPosition,
handlers,
owlStopEvent;
ev.target=ev.target||ev.srcElement;
locals.dragging=false;
if(base.browser.isTouch!==true){
base.$owlWrapper.removeClass("grabbing");
}
if(base.options['direction']=="rtl"){
if(base.newRelativeX < 0){ base.dragDirection=base.owl.dragDirection="right"; }else{ base.dragDirection=base.owl.dragDirection="left"; }}else{
if(base.newRelativeX < 0){ base.dragDirection=base.owl.dragDirection="left"; }else{ base.dragDirection=base.owl.dragDirection="right"; }}
if(base.newRelativeX!==0){
newPosition=base.getNewPosition();
base.goTo(newPosition, false, "drag");
if(locals.targetElement===ev.target&&base.browser.isTouch!==true){
$(ev.target).on("click.disable", function (ev){
ev.stopImmediatePropagation();
ev.stopPropagation();
ev.preventDefault();
$(ev.target).off("click.disable");
});
handlers=$._data(ev.target, "events").click;
owlStopEvent=handlers.pop();
handlers.splice(0, 0, owlStopEvent);
}}
swapEvents("off");
}
base.$elem.on(base.ev_types.start, ".owl-wrapper", dragStart);
},
getNewPosition:function (){
var base=this,
newPosition=base.closestItem();
if(newPosition > base.maximumItem){
base.currentItem=base.maximumItem;
newPosition=base.maximumItem;
}else if(base.newPosX >=0){
newPosition=0;
base.currentItem=0;
}
return newPosition;
},
closestItem:function (){
var base=this,
array=base.options.scrollPerPage===true ? base.pagesInArray:base.positionsInArray,
goal=base.newPosX,
closest=null;
$.each(array, function (i, v){
if(goal - (base.itemWidth / 20) > array[i + 1]&&goal - (base.itemWidth / 20) < v&&base.moveDirection()==="left"){
closest=v;
if(base.options.scrollPerPage===true){
base.currentItem=$.inArray(closest, base.positionsInArray);
}else{
base.currentItem=i;
}}else if(goal + (base.itemWidth / 20) < v&&goal + (base.itemWidth / 20) > (array[i + 1]||array[i] - base.itemWidth)&&base.moveDirection()==="right"){
if(base.options.scrollPerPage===true){
closest=array[i + 1]||array[array.length - 1];
base.currentItem=$.inArray(closest, base.positionsInArray);
}else{
closest=array[i + 1];
base.currentItem=i + 1;
}}
});
return base.currentItem;
},
moveDirection:function (){
var base=this,
direction;
if(base.newRelativeX < 0){
direction="right";
base.playDirection="next";
}else{
direction="left";
base.playDirection="prev";
}
return direction;
},
customEvents:function (){
var base=this;
base.$elem.on("owl.next", function (e){
base.next();
e.stopPropagation();
});
base.$elem.on("owl.prev", function (e){
base.prev();
e.stopPropagation();
});
base.$elem.on("owl.play", function (event, speed){
base.options.autoPlay=speed;
base.play();
base.hoverStatus="play";
});
base.$elem.on("owl.stop", function (){
base.stop();
base.hoverStatus="stop";
});
base.$elem.on("owl.goTo", function (event, item){
base.goTo(item);
});
base.$elem.on("owl.jumpTo", function (event, item){
base.jumpTo(item);
});
},
stopOnHover:function (){
var base=this;
if(base.options.stopOnHover===true&&base.browser.isTouch!==true&&base.options.autoPlay!==false){
base.$elem.on("mouseover", function (){
base.stop();
});
base.$elem.on("mouseout", function (){
if(base.hoverStatus!=="stop"){
base.play();
}});
}},
lazyLoad:function (){
var base=this,
i,
$item,
itemNumber,
$lazyImg,
follow;
if(base.options.lazyLoad===false){
return false;
}
for (i=0; i < base.itemsAmount; i +=1){
$item=$(base.$owlItems[i]);
if($item.data("owl-loaded")==="loaded"){
continue;
}
itemNumber=$item.data("owl-item");
$lazyImg=$item.find(".lazyOwl");
if(typeof $lazyImg.data("src")!=="string"){
$item.data("owl-loaded", "loaded");
continue;
}
if($item.data("owl-loaded")===undefined){
$lazyImg.hide();
$item.addClass("loading").data("owl-loaded", "checked");
}
if(base.options.lazyFollow===true){
follow=itemNumber >=base.currentItem;
}else{
follow=true;
}
if(follow&&itemNumber < base.currentItem + base.options.items&&$lazyImg.length){
base.lazyPreload($item, $lazyImg);
}}
},
lazyPreload:function ($item, $lazyImg){
var base=this,
iterations=0,
isBackgroundImg;
if($lazyImg.prop("tagName")==="DIV"){
$lazyImg.css("background-image", "url(" + $lazyImg.data("src") + ")");
isBackgroundImg=true;
}else{
$lazyImg[0].src=$lazyImg.data("src");
}
function showImage(){
$item.data("owl-loaded", "loaded").removeClass("loading");
$lazyImg.removeAttr("data-src");
if(base.options.lazyEffect==="fade"){
$lazyImg.fadeIn(400);
}else{
$lazyImg.show();
}
if(typeof base.options.afterLazyLoad==="function"){
base.options.afterLazyLoad.apply(this, [base.$elem]);
}}
function checkLazyImage(){
iterations +=1;
if(base.completeImg($lazyImg.get(0))||isBackgroundImg===true){
showImage();
}else if(iterations <=100){
window.setTimeout(checkLazyImage, 100);
}else{
showImage();
}}
checkLazyImage();
},
autoHeight:function (){
var base=this,
$currentimg=$(base.$owlItems[base.currentItem]).find("img"),
iterations;
function addHeight(){
var $currentItem=$(base.$owlItems[base.currentItem]).height();
base.wrapperOuter.css("height", $currentItem + "px");
if(!base.wrapperOuter.hasClass("autoHeight")){
window.setTimeout(function (){
base.wrapperOuter.addClass("autoHeight");
}, 0);
}}
function checkImage(){
iterations +=1;
if(base.completeImg($currentimg.get(0))){
addHeight();
}else if(iterations <=100){
window.setTimeout(checkImage, 100);
}else{
base.wrapperOuter.css("height", "");
}}
if($currentimg.get(0)!==undefined){
iterations=0;
checkImage();
}else{
addHeight();
}},
completeImg:function (img){
var naturalWidthType;
if(!img.complete){
return false;
}
naturalWidthType=typeof img.naturalWidth;
if(naturalWidthType!=="undefined"&&img.naturalWidth===0){
return false;
}
return true;
},
onVisibleItems:function (){
var base=this,
i;
if(base.options.addClassActive===true){
base.$owlItems.removeClass("active");
}
base.visibleItems=[];
for (i=base.currentItem; i < base.currentItem + base.options.items; i +=1){
base.visibleItems.push(i);
if(base.options.addClassActive===true){
$(base.$owlItems[i]).addClass("active");
}}
base.owl.visibleItems=base.visibleItems;
},
transitionTypes:function (className){
var base=this;
base.outClass="owl-" + className + "-out";
base.inClass="owl-" + className + "-in";
},
singleItemTransition:function (){
var base=this,
outClass=base.outClass,
inClass=base.inClass,
$currentItem=base.$owlItems.eq(base.currentItem),
$prevItem=base.$owlItems.eq(base.prevItem),
prevPos=Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem],
origin=Math.abs(base.positionsInArray[base.currentItem]) + base.itemWidth / 2,
animEnd='webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend';
base.isTransition=true;
base.$owlWrapper
.addClass('owl-origin')
.css({
"-webkit-transform-origin":origin + "px",
"-moz-perspective-origin":origin + "px",
"perspective-origin":origin + "px"
});
function transStyles(prevPos){
return {
"position":"relative",
"left":prevPos + "px"
};}
var animEnd='webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend';
$prevItem
.css(transStyles(prevPos, 10))
.addClass(outClass)
.on(animEnd, function (){
base.endPrev=true;
$prevItem.off(animEnd);
base.clearTransStyle($prevItem, outClass);
});
$currentItem
.addClass(inClass)
.on(animEnd, function (){
base.endCurrent=true;
$currentItem.off(animEnd);
base.clearTransStyle($currentItem, inClass);
});
},
clearTransStyle:function (item, classToRemove){
var base=this;
item.css({
"position":"",
"left":""
}).removeClass(classToRemove);
if(base.endPrev&&base.endCurrent){
base.$owlWrapper.removeClass('owl-origin');
base.endPrev=false;
base.endCurrent=false;
base.isTransition=false;
}},
owlStatus:function (){
var base=this;
base.owl={
"userOptions":base.userOptions,
"baseElement":base.$elem,
"userItems":base.$userItems,
"owlItems":base.$owlItems,
"currentItem":base.currentItem,
"prevItem":base.prevItem,
"visibleItems":base.visibleItems,
"isTouch":base.browser.isTouch,
"browser":base.browser,
"dragDirection":base.dragDirection
};},
clearEvents:function (){
var base=this;
base.$elem.off(".owl owl mousedown.disableTextSelect");
$(document).off(".owl owl");
$(window).off("resize", base.resizer);
},
unWrap:function (){
var base=this;
if(base.$elem.children().length!==0){
base.$owlWrapper.unwrap();
base.$userItems.unwrap().unwrap();
if(base.owlControls){
base.owlControls.remove();
}}
base.clearEvents();
base.$elem
.attr("style", base.$elem.data("owl-originalStyles")||"")
.attr("class", base.$elem.data("owl-originalClasses"));
},
destroy:function (){
var base=this;
base.stop();
window.clearInterval(base.checkVisible);
base.unWrap();
base.$elem.removeData();
},
reinit:function (newOptions){
var base=this,
options=$.extend({}, base.userOptions, newOptions);
base.unWrap();
base.init(options, base.$elem);
},
addItem:function (htmlString, targetPosition){
var base=this,
position;
if(!htmlString){return false; }
if(base.$elem.children().length===0){
base.$elem.append(htmlString);
base.setVars();
return false;
}
base.unWrap();
if(targetPosition===undefined||targetPosition===-1){
position=-1;
}else{
position=targetPosition;
}
if(position >=base.$userItems.length||position===-1){
base.$userItems.eq(-1).after(htmlString);
}else{
base.$userItems.eq(position).before(htmlString);
}
base.setVars();
},
removeItem:function (targetPosition){
var base=this,
position;
if(base.$elem.children().length===0){
return false;
}
if(targetPosition===undefined||targetPosition===-1){
position=-1;
}else{
position=targetPosition;
}
base.unWrap();
base.$userItems.eq(position).remove();
base.setVars();
}};
$.fn.owlCarousel=function (options){
return this.each(function (){
if($(this).data("owl-init")===true){
return false;
}
$(this).data("owl-init", true);
var carousel=Object.create(Carousel);
carousel.init(options, this);
$.data(this, "owlCarousel", carousel);
});
};
$.fn.owlCarousel.options={
direction:'ltr',
items:5,
itemsCustom:false,
itemsDesktop:[1199, 4],
itemsDesktopSmall:[979, 3],
itemsTablet:[768, 2],
itemsTabletSmall:false,
itemsMobile:[479, 1],
singleItem:false,
itemsScaleUp:false,
slideSpeed:200,
paginationSpeed:800,
rewindSpeed:1000,
autoPlay:false,
stopOnHover:false,
navigation:false,
navigationText:["prev", "next"],
rewindNav:true,
scrollPerPage:false,
pagination:true,
paginationNumbers:false,
responsive:true,
responsiveRefreshRate:200,
responsiveBaseWidth:window,
baseClass:"owl-carousel",
theme:"owl-theme",
lazyLoad:false,
lazyFollow:true,
lazyEffect:"fade",
autoHeight:false,
jsonPath:false,
jsonSuccess:false,
dragBeforeAnimFinish:true,
mouseDrag:true,
touchDrag:true,
addClassActive:false,
transitionStyle:false,
beforeUpdate:false,
afterUpdate:false,
beforeInit:false,
afterInit:false,
beforeMove:false,
afterMove:false,
afterAction:false,
startDragging:false,
afterLazyLoad: false
};}(jQuery, window, document));
(function(t){function e(){}function i(t){function i(e){e.prototype.option||(e.prototype.option=function(e){t.isPlainObject(e)&&(this.options=t.extend(!0,this.options,e))})}function n(e,i){t.fn[e]=function(n){if("string"==typeof n){for(var s=o.call(arguments,1),a=0,u=this.length;u>a;a++){var p=this[a],h=t.data(p,e);if(h)if(t.isFunction(h[n])&&"_"!==n.charAt(0)){var f=h[n].apply(h,s);if(void 0!==f)return f}else r("no such method '"+n+"' for "+e+" instance");else r("cannot call methods on "+e+" prior to initialization; "+"attempted to call '"+n+"'")}return this}return this.each(function(){var o=t.data(this,e);o?(o.option(n),o._init()):(o=new i(this,n),t.data(this,e,o))})}}if(t){var r="undefined"==typeof console?e:function(t){console.error(t)};return t.bridget=function(t,e){i(e),n(t,e)},t.bridget}}var o=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],i):i(t.jQuery)})(window),function(t){function e(e){var i=t.event;return i.target=i.target||i.srcElement||e,i}var i=document.documentElement,o=function(){};i.addEventListener?o=function(t,e,i){t.addEventListener(e,i,!1)}:i.attachEvent&&(o=function(t,i,o){t[i+o]=o.handleEvent?function(){var i=e(t);o.handleEvent.call(o,i)}:function(){var i=e(t);o.call(t,i)},t.attachEvent("on"+i,t[i+o])});var n=function(){};i.removeEventListener?n=function(t,e,i){t.removeEventListener(e,i,!1)}:i.detachEvent&&(n=function(t,e,i){t.detachEvent("on"+e,t[e+i]);try{delete t[e+i]}catch(o){t[e+i]=void 0}});var r={bind:o,unbind:n};"function"==typeof define&&define.amd?define("eventie/eventie",r):"object"==typeof exports?module.exports=r:t.eventie=r}(this),function(t){function e(t){"function"==typeof t&&(e.isReady?t():r.push(t))}function i(t){var i="readystatechange"===t.type&&"complete"!==n.readyState;if(!e.isReady&&!i){e.isReady=!0;for(var o=0,s=r.length;s>o;o++){var a=r[o];a()}}}function o(o){return o.bind(n,"DOMContentLoaded",i),o.bind(n,"readystatechange",i),o.bind(t,"load",i),e}var n=t.document,r=[];e.isReady=!1,"function"==typeof define&&define.amd?(e.isReady="function"==typeof requirejs,define("doc-ready/doc-ready",["eventie/eventie"],o)):t.docReady=o(t.eventie)}(this),function(){function t(){}function e(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function i(t){return function(){return this[t].apply(this,arguments)}}var o=t.prototype,n=this,r=n.EventEmitter;o.getListeners=function(t){var e,i,o=this._getEvents();if(t instanceof RegExp){e={};for(i in o)o.hasOwnProperty(i)&&t.test(i)&&(e[i]=o[i])}else e=o[t]||(o[t]=[]);return e},o.flattenListeners=function(t){var e,i=[];for(e=0;t.length>e;e+=1)i.push(t[e].listener);return i},o.getListenersAsObject=function(t){var e,i=this.getListeners(t);return i instanceof Array&&(e={},e[t]=i),e||i},o.addListener=function(t,i){var o,n=this.getListenersAsObject(t),r="object"==typeof i;for(o in n)n.hasOwnProperty(o)&&-1===e(n[o],i)&&n[o].push(r?i:{listener:i,once:!1});return this},o.on=i("addListener"),o.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},o.once=i("addOnceListener"),o.defineEvent=function(t){return this.getListeners(t),this},o.defineEvents=function(t){for(var e=0;t.length>e;e+=1)this.defineEvent(t[e]);return this},o.removeListener=function(t,i){var o,n,r=this.getListenersAsObject(t);for(n in r)r.hasOwnProperty(n)&&(o=e(r[n],i),-1!==o&&r[n].splice(o,1));return this},o.off=i("removeListener"),o.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},o.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},o.manipulateListeners=function(t,e,i){var o,n,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(o=i.length;o--;)r.call(this,e,i[o]);else for(o in e)e.hasOwnProperty(o)&&(n=e[o])&&("function"==typeof n?r.call(this,o,n):s.call(this,o,n));return this},o.removeEvent=function(t){var e,i=typeof t,o=this._getEvents();if("string"===i)delete o[t];else if(t instanceof RegExp)for(e in o)o.hasOwnProperty(e)&&t.test(e)&&delete o[e];else delete this._events;return this},o.removeAllListeners=i("removeEvent"),o.emitEvent=function(t,e){var i,o,n,r,s=this.getListenersAsObject(t);for(n in s)if(s.hasOwnProperty(n))for(o=s[n].length;o--;)i=s[n][o],i.once===!0&&this.removeListener(t,i.listener),r=i.listener.apply(this,e||[]),r===this._getOnceReturnValue()&&this.removeListener(t,i.listener);return this},o.trigger=i("emitEvent"),o.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},o.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},o._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},o._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return n.EventEmitter=r,t},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return t}):"object"==typeof module&&module.exports?module.exports=t:this.EventEmitter=t}.call(this),function(t){function e(t){if(t){if("string"==typeof o[t])return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e,n=0,r=i.length;r>n;n++)if(e=i[n]+t,"string"==typeof o[e])return e}}var i="Webkit Moz ms Ms O".split(" "),o=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return e}):"object"==typeof exports?module.exports=e:t.getStyleProperty=e}(window),function(t){function e(t){var e=parseFloat(t),i=-1===t.indexOf("%")&&!isNaN(e);return i&&e}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0,i=s.length;i>e;e++){var o=s[e];t[o]=0}return t}function o(t){function o(t){if("string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var o=r(t);if("none"===o.display)return i();var n={};n.width=t.offsetWidth,n.height=t.offsetHeight;for(var h=n.isBorderBox=!(!p||!o[p]||"border-box"!==o[p]),f=0,d=s.length;d>f;f++){var l=s[f],c=o[l];c=a(t,c);var y=parseFloat(c);n[l]=isNaN(y)?0:y}var m=n.paddingLeft+n.paddingRight,g=n.paddingTop+n.paddingBottom,v=n.marginLeft+n.marginRight,_=n.marginTop+n.marginBottom,I=n.borderLeftWidth+n.borderRightWidth,L=n.borderTopWidth+n.borderBottomWidth,z=h&&u,S=e(o.width);S!==!1&&(n.width=S+(z?0:m+I));var b=e(o.height);return b!==!1&&(n.height=b+(z?0:g+L)),n.innerWidth=n.width-(m+I),n.innerHeight=n.height-(g+L),n.outerWidth=n.width+v,n.outerHeight=n.height+_,n}}function a(t,e){if(n||-1===e.indexOf("%"))return e;var i=t.style,o=i.left,r=t.runtimeStyle,s=r&&r.left;return s&&(r.left=t.currentStyle.left),i.left=e,e=i.pixelLeft,i.left=o,s&&(r.left=s),e}var u,p=t("boxSizing");return function(){if(p){var t=document.createElement("div");t.style.width="200px",t.style.padding="1px 2px 3px 4px",t.style.borderStyle="solid",t.style.borderWidth="1px 2px 3px 4px",t.style[p]="border-box";var i=document.body||document.documentElement;i.appendChild(t);var o=r(t);u=200===e(o.width),i.removeChild(t)}}(),o}var n=t.getComputedStyle,r=n?function(t){return n(t,null)}:function(t){return t.currentStyle},s=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define("get-size/get-size",["get-style-property/get-style-property"],o):"object"==typeof exports?module.exports=o(require("get-style-property")):t.getSize=o(t.getStyleProperty)}(window),function(t,e){function i(t,e){return t[a](e)}function o(t){if(!t.parentNode){var e=document.createDocumentFragment();e.appendChild(t)}}function n(t,e){o(t);for(var i=t.parentNode.querySelectorAll(e),n=0,r=i.length;r>n;n++)if(i[n]===t)return!0;return!1}function r(t,e){return o(t),i(t,e)}var s,a=function(){if(e.matchesSelector)return"matchesSelector";for(var t=["webkit","moz","ms","o"],i=0,o=t.length;o>i;i++){var n=t[i],r=n+"MatchesSelector";if(e[r])return r}}();if(a){var u=document.createElement("div"),p=i(u,"div");s=p?i:r}else s=n;"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return s}):window.matchesSelector=s}(this,Element.prototype),function(t){function e(t,e){for(var i in e)t[i]=e[i];return t}function i(t){for(var e in t)return!1;return e=null,!0}function o(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}function n(t,n,r){function a(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}var u=r("transition"),p=r("transform"),h=u&&p,f=!!r("perspective"),d={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"}[u],l=["transform","transition","transitionDuration","transitionProperty"],c=function(){for(var t={},e=0,i=l.length;i>e;e++){var o=l[e],n=r(o);n&&n!==o&&(t[o]=n)}return t}();e(a.prototype,t.prototype),a.prototype._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},a.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},a.prototype.getSize=function(){this.size=n(this.element)},a.prototype.css=function(t){var e=this.element.style;for(var i in t){var o=c[i]||i;e[o]=t[i]}},a.prototype.getPosition=function(){var t=s(this.element),e=this.layout.options,i=e.isOriginLeft,o=e.isOriginTop,n=parseInt(t[i?"left":"right"],10),r=parseInt(t[o?"top":"bottom"],10);n=isNaN(n)?0:n,r=isNaN(r)?0:r;var a=this.layout.size;n-=i?a.paddingLeft:a.paddingRight,r-=o?a.paddingTop:a.paddingBottom,this.position.x=n,this.position.y=r},a.prototype.layoutPosition=function(){var t=this.layout.size,e=this.layout.options,i={};e.isOriginLeft?(i.left=this.position.x+t.paddingLeft+"px",i.right=""):(i.right=this.position.x+t.paddingRight+"px",i.left=""),e.isOriginTop?(i.top=this.position.y+t.paddingTop+"px",i.bottom=""):(i.bottom=this.position.y+t.paddingBottom+"px",i.top=""),this.css(i),this.emitEvent("layout",[this])};var y=f?function(t,e){return"translate3d("+t+"px, "+e+"px, 0)"}:function(t,e){return"translate("+t+"px, "+e+"px)"};a.prototype._transitionTo=function(t,e){this.getPosition();var i=this.position.x,o=this.position.y,n=parseInt(t,10),r=parseInt(e,10),s=n===this.position.x&&r===this.position.y;if(this.setPosition(t,e),s&&!this.isTransitioning)return this.layoutPosition(),void 0;var a=t-i,u=e-o,p={},h=this.layout.options;a=h.isOriginLeft?a:-a,u=h.isOriginTop?u:-u,p.transform=y(a,u),this.transition({to:p,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},a.prototype.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},a.prototype.moveTo=h?a.prototype._transitionTo:a.prototype.goTo,a.prototype.setPosition=function(t,e){this.position.x=parseInt(t,10),this.position.y=parseInt(e,10)},a.prototype._nonTransition=function(t){this.css(t.to),t.isCleaning&&this._removeStyles(t.to);for(var e in t.onTransitionEnd)t.onTransitionEnd[e].call(this)},a.prototype._transition=function(t){if(!parseFloat(this.layout.options.transitionDuration))return this._nonTransition(t),void 0;var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&&(e.clean[i]=!0);if(t.from){this.css(t.from);var o=this.element.offsetHeight;o=null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0};var m=p&&o(p)+",opacity";a.prototype.enableTransition=function(){this.isTransitioning||(this.css({transitionProperty:m,transitionDuration:this.layout.options.transitionDuration}),this.element.addEventListener(d,this,!1))},a.prototype.transition=a.prototype[u?"_transition":"_nonTransition"],a.prototype.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},a.prototype.onotransitionend=function(t){this.ontransitionend(t)};var g={"-webkit-transform":"transform","-moz-transform":"transform","-o-transform":"transform"};a.prototype.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,o=g[t.propertyName]||t.propertyName;if(delete e.ingProperties[o],i(e.ingProperties)&&this.disableTransition(),o in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[o]),o in e.onEnd){var n=e.onEnd[o];n.call(this),delete e.onEnd[o]}this.emitEvent("transitionEnd",[this])}},a.prototype.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(d,this,!1),this.isTransitioning=!1},a.prototype._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var v={transitionProperty:"",transitionDuration:""};return a.prototype.removeTransitionStyles=function(){this.css(v)},a.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.emitEvent("remove",[this])},a.prototype.remove=function(){if(!u||!parseFloat(this.layout.options.transitionDuration))return this.removeElem(),void 0;var t=this;this.on("transitionEnd",function(){return t.removeElem(),!0}),this.hide()},a.prototype.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options;this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0})},a.prototype.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options;this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:{opacity:function(){this.isHidden&&this.css({display:"none"})}}})},a.prototype.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},a}var r=t.getComputedStyle,s=r?function(t){return r(t,null)}:function(t){return t.currentStyle};"function"==typeof define&&define.amd?define("outlayer/item",["eventEmitter/EventEmitter","get-size/get-size","get-style-property/get-style-property"],n):(t.Outlayer={},t.Outlayer.Item=n(t.EventEmitter,t.getSize,t.getStyleProperty))}(window),function(t){function e(t,e){for(var i in e)t[i]=e[i];return t}function i(t){return"[object Array]"===f.call(t)}function o(t){var e=[];if(i(t))e=t;else if(t&&"number"==typeof t.length)for(var o=0,n=t.length;n>o;o++)e.push(t[o]);else e.push(t);return e}function n(t,e){var i=l(e,t);-1!==i&&e.splice(i,1)}function r(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()}function s(i,s,f,l,c,y){function m(t,i){if("string"==typeof t&&(t=a.querySelector(t)),!t||!d(t))return u&&u.error("Bad "+this.constructor.namespace+" element: "+t),void 0;this.element=t,this.options=e({},this.constructor.defaults),this.option(i);var o=++g;this.element.outlayerGUID=o,v[o]=this,this._create(),this.options.isInitLayout&&this.layout()}var g=0,v={};return m.namespace="outlayer",m.Item=y,m.defaults={containerStyle:{position:"relative"},isInitLayout:!0,isOriginLeft:!0,isOriginTop:!0,isResizeBound:!0,isResizingContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}},e(m.prototype,f.prototype),m.prototype.option=function(t){e(this.options,t)},m.prototype._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),e(this.element.style,this.options.containerStyle),this.options.isResizeBound&&this.bindResize()},m.prototype.reloadItems=function(){this.items=this._itemize(this.element.children)},m.prototype._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,o=[],n=0,r=e.length;r>n;n++){var s=e[n],a=new i(s,this);o.push(a)}return o},m.prototype._filterFindItemElements=function(t){t=o(t);for(var e=this.options.itemSelector,i=[],n=0,r=t.length;r>n;n++){var s=t[n];if(d(s))if(e){c(s,e)&&i.push(s);for(var a=s.querySelectorAll(e),u=0,p=a.length;p>u;u++)i.push(a[u])}else i.push(s)}return i},m.prototype.getItemElements=function(){for(var t=[],e=0,i=this.items.length;i>e;e++)t.push(this.items[e].element);return t},m.prototype.layout=function(){this._resetLayout(),this._manageStamps();var t=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;this.layoutItems(this.items,t),this._isLayoutInited=!0},m.prototype._init=m.prototype.layout,m.prototype._resetLayout=function(){this.getSize()},m.prototype.getSize=function(){this.size=l(this.element)},m.prototype._getMeasurement=function(t,e){var i,o=this.options[t];o?("string"==typeof o?i=this.element.querySelector(o):d(o)&&(i=o),this[t]=i?l(i)[e]:o):this[t]=0},m.prototype.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},m.prototype._getItemsForLayout=function(t){for(var e=[],i=0,o=t.length;o>i;i++){var n=t[i];n.isIgnored||e.push(n)}return e},m.prototype._layoutItems=function(t,e){function i(){o.emitEvent("layoutComplete",[o,t])}var o=this;if(!t||!t.length)return i(),void 0;this._itemsOn(t,"layout",i);for(var n=[],r=0,s=t.length;s>r;r++){var a=t[r],u=this._getItemLayoutPosition(a);u.item=a,u.isInstant=e||a.isLayoutInstant,n.push(u)}this._processLayoutQueue(n)},m.prototype._getItemLayoutPosition=function(){return{x:0,y:0}},m.prototype._processLayoutQueue=function(t){for(var e=0,i=t.length;i>e;e++){var o=t[e];this._positionItem(o.item,o.x,o.y,o.isInstant)}},m.prototype._positionItem=function(t,e,i,o){o?t.goTo(e,i):t.moveTo(e,i)},m.prototype._postLayout=function(){this.resizeContainer()},m.prototype.resizeContainer=function(){if(this.options.isResizingContainer){var t=this._getContainerSize();t&&(this._setContainerMeasure(t.width,!0),this._setContainerMeasure(t.height,!1))}},m.prototype._getContainerSize=h,m.prototype._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&&(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},m.prototype._itemsOn=function(t,e,i){function o(){return n++,n===r&&i.call(s),!0}for(var n=0,r=t.length,s=this,a=0,u=t.length;u>a;a++){var p=t[a];p.on(e,o)}},m.prototype.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},m.prototype.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},m.prototype.stamp=function(t){if(t=this._find(t)){this.stamps=this.stamps.concat(t);for(var e=0,i=t.length;i>e;e++){var o=t[e];this.ignore(o)}}},m.prototype.unstamp=function(t){if(t=this._find(t))for(var e=0,i=t.length;i>e;e++){var o=t[e];n(o,this.stamps),this.unignore(o)}},m.prototype._find=function(t){return t?("string"==typeof t&&(t=this.element.querySelectorAll(t)),t=o(t)):void 0},m.prototype._manageStamps=function(){if(this.stamps&&this.stamps.length){this._getBoundingRect();for(var t=0,e=this.stamps.length;e>t;t++){var i=this.stamps[t];this._manageStamp(i)}}},m.prototype._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},m.prototype._manageStamp=h,m.prototype._getElementOffset=function(t){var e=t.getBoundingClientRect(),i=this._boundingRect,o=l(t),n={left:e.left-i.left-o.marginLeft,top:e.top-i.top-o.marginTop,right:i.right-e.right-o.marginRight,bottom:i.bottom-e.bottom-o.marginBottom};return n},m.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},m.prototype.bindResize=function(){this.isResizeBound||(i.bind(t,"resize",this),this.isResizeBound=!0)},m.prototype.unbindResize=function(){this.isResizeBound&&i.unbind(t,"resize",this),this.isResizeBound=!1},m.prototype.onresize=function(){function t(){e.resize(),delete e.resizeTimeout}this.resizeTimeout&&clearTimeout(this.resizeTimeout);var e=this;this.resizeTimeout=setTimeout(t,100)},m.prototype.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},m.prototype.needsResizeLayout=function(){var t=l(this.element),e=this.size&&t;return e&&t.innerWidth!==this.size.innerWidth},m.prototype.addItems=function(t){var e=this._itemize(t);return e.length&&(this.items=this.items.concat(e)),e},m.prototype.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},m.prototype.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},m.prototype.reveal=function(t){var e=t&&t.length;if(e)for(var i=0;e>i;i++){var o=t[i];o.reveal()}},m.prototype.hide=function(t){var e=t&&t.length;if(e)for(var i=0;e>i;i++){var o=t[i];o.hide()}},m.prototype.getItem=function(t){for(var e=0,i=this.items.length;i>e;e++){var o=this.items[e];if(o.element===t)return o}},m.prototype.getItems=function(t){if(t&&t.length){for(var e=[],i=0,o=t.length;o>i;i++){var n=t[i],r=this.getItem(n);r&&e.push(r)}return e}},m.prototype.remove=function(t){t=o(t);var e=this.getItems(t);if(e&&e.length){this._itemsOn(e,"remove",function(){this.emitEvent("removeComplete",[this,e])});for(var i=0,r=e.length;r>i;i++){var s=e[i];s.remove(),n(s,this.items)}}},m.prototype.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="";for(var e=0,i=this.items.length;i>e;e++){var o=this.items[e];o.destroy()}this.unbindResize(),delete this.element.outlayerGUID,p&&p.removeData(this.element,this.constructor.namespace)},m.data=function(t){var e=t&&t.outlayerGUID;return e&&v[e]},m.create=function(t,i){function o(){m.apply(this,arguments)}return Object.create?o.prototype=Object.create(m.prototype):e(o.prototype,m.prototype),o.prototype.constructor=o,o.defaults=e({},m.defaults),e(o.defaults,i),o.prototype.settings={},o.namespace=t,o.data=m.data,o.Item=function(){y.apply(this,arguments)},o.Item.prototype=new y,s(function(){for(var e=r(t),i=a.querySelectorAll(".js-"+e),n="data-"+e+"-options",s=0,h=i.length;h>s;s++){var f,d=i[s],l=d.getAttribute(n);try{f=l&&JSON.parse(l)}catch(c){u&&u.error("Error parsing "+n+" on "+d.nodeName.toLowerCase()+(d.id?"#"+d.id:"")+": "+c);continue}var y=new o(d,f);p&&p.data(d,t,y)}}),p&&p.bridget&&p.bridget(t,o),o},m.Item=y,m}var a=t.document,u=t.console,p=t.jQuery,h=function(){},f=Object.prototype.toString,d="object"==typeof HTMLElement?function(t){return t instanceof HTMLElement}:function(t){return t&&"object"==typeof t&&1===t.nodeType&&"string"==typeof t.nodeName},l=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var i=0,o=t.length;o>i;i++)if(t[i]===e)return i;return-1};"function"==typeof define&&define.amd?define("outlayer/outlayer",["eventie/eventie","doc-ready/doc-ready","eventEmitter/EventEmitter","get-size/get-size","matches-selector/matches-selector","./item"],s):t.Outlayer=s(t.eventie,t.docReady,t.EventEmitter,t.getSize,t.matchesSelector,t.Outlayer.Item)}(window),function(t){function e(t){function e(){t.Item.apply(this,arguments)}e.prototype=new t.Item,e.prototype._create=function(){this.id=this.layout.itemGUID++,t.Item.prototype._create.call(this),this.sortData={}},e.prototype.updateSortData=function(){if(!this.isIgnored){this.sortData.id=this.id,this.sortData["original-order"]=this.id,this.sortData.random=Math.random();var t=this.layout.options.getSortData,e=this.layout._sorters;for(var i in t){var o=e[i];this.sortData[i]=o(this.element,this)}}};var i=e.prototype.destroy;return e.prototype.destroy=function(){i.apply(this,arguments),this.css({display:""})},e}"function"==typeof define&&define.amd?define("isotope/js/item",["outlayer/outlayer"],e):(t.Isotope=t.Isotope||{},t.Isotope.Item=e(t.Outlayer))}(window),function(t){function e(t,e){function i(t){this.isotope=t,t&&(this.options=t.options[this.namespace],this.element=t.element,this.items=t.filteredItems,this.size=t.size)}return function(){function t(t){return function(){return e.prototype[t].apply(this.isotope,arguments)}}for(var o=["_resetLayout","_getItemLayoutPosition","_manageStamp","_getContainerSize","_getElementOffset","needsResizeLayout"],n=0,r=o.length;r>n;n++){var s=o[n];i.prototype[s]=t(s)}}(),i.prototype.needsVerticalResizeLayout=function(){var e=t(this.isotope.element),i=this.isotope.size&&e;return i&&e.innerHeight!==this.isotope.size.innerHeight},i.prototype._getMeasurement=function(){this.isotope._getMeasurement.apply(this,arguments)},i.prototype.getColumnWidth=function(){this.getSegmentSize("column","Width")},i.prototype.getRowHeight=function(){this.getSegmentSize("row","Height")},i.prototype.getSegmentSize=function(t,e){var i=t+e,o="outer"+e;if(this._getMeasurement(i,o),!this[i]){var n=this.getFirstItemSize();this[i]=n&&n[o]||this.isotope.size["inner"+e]}},i.prototype.getFirstItemSize=function(){var e=this.isotope.filteredItems[0];return e&&e.element&&t(e.element)},i.prototype.layout=function(){this.isotope.layout.apply(this.isotope,arguments)},i.prototype.getSize=function(){this.isotope.getSize(),this.size=this.isotope.size},i.modes={},i.create=function(t,e){function o(){i.apply(this,arguments)}return o.prototype=new i,e&&(o.options=e),o.prototype.namespace=t,i.modes[t]=o,o},i}"function"==typeof define&&define.amd?define("isotope/js/layout-mode",["get-size/get-size","outlayer/outlayer"],e):(t.Isotope=t.Isotope||{},t.Isotope.LayoutMode=e(t.getSize,t.Outlayer))}(window),function(t){function e(t,e){var o=t.create("masonry");return o.prototype._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns();var t=this.cols;for(this.colYs=[];t--;)this.colYs.push(0);this.maxY=0},o.prototype.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var t=this.items[0],i=t&&t.element;this.columnWidth=i&&e(i).outerWidth||this.containerWidth}this.columnWidth+=this.gutter,this.cols=Math.floor((this.containerWidth+this.gutter)/this.columnWidth),this.cols=Math.max(this.cols,1)},o.prototype.getContainerWidth=function(){var t=this.options.isFitWidth?this.element.parentNode:this.element,i=e(t);this.containerWidth=i&&i.innerWidth},o.prototype._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,o=e&&1>e?"round":"ceil",n=Math[o](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var r=this._getColGroup(n),s=Math.min.apply(Math,r),a=i(r,s),u={x:this.columnWidth*a,y:s},p=s+t.size.outerHeight,h=this.cols+1-r.length,f=0;h>f;f++)this.colYs[a+f]=p;return u},o.prototype._getColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,o=0;i>o;o++){var n=this.colYs.slice(o,o+t);e[o]=Math.max.apply(Math,n)}return e},o.prototype._manageStamp=function(t){var i=e(t),o=this._getElementOffset(t),n=this.options.isOriginLeft?o.left:o.right,r=n+i.outerWidth,s=Math.floor(n/this.columnWidth);s=Math.max(0,s);var a=Math.floor(r/this.columnWidth);a-=r%this.columnWidth?0:1,a=Math.min(this.cols-1,a);for(var u=(this.options.isOriginTop?o.top:o.bottom)+i.outerHeight,p=s;a>=p;p++)this.colYs[p]=Math.max(u,this.colYs[p])},o.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this.options.isFitWidth&&(t.width=this._getContainerFitWidth()),t},o.prototype._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},o.prototype.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!==this.containerWidth},o}var i=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var i=0,o=t.length;o>i;i++){var n=t[i];if(n===e)return i}return-1};"function"==typeof define&&define.amd?define("masonry/masonry",["outlayer/outlayer","get-size/get-size"],e):t.Masonry=e(t.Outlayer,t.getSize)}(window),function(t){function e(t,e){for(var i in e)t[i]=e[i];return t}function i(t,i){var o=t.create("masonry"),n=o.prototype._getElementOffset,r=o.prototype.layout,s=o.prototype._getMeasurement;e(o.prototype,i.prototype),o.prototype._getElementOffset=n,o.prototype.layout=r,o.prototype._getMeasurement=s;var a=o.prototype.measureColumns;o.prototype.measureColumns=function(){this.items=this.isotope.filteredItems,a.call(this)};var u=o.prototype._manageStamp;return o.prototype._manageStamp=function(){this.options.isOriginLeft=this.isotope.options.isOriginLeft,this.options.isOriginTop=this.isotope.options.isOriginTop,u.apply(this,arguments)},o}"function"==typeof define&&define.amd?define("isotope/js/layout-modes/masonry",["../layout-mode","masonry/masonry"],i):i(t.Isotope.LayoutMode,t.Masonry)}(window),function(t){function e(t){var e=t.create("fitRows");return e.prototype._resetLayout=function(){this.x=0,this.y=0,this.maxY=0},e.prototype._getItemLayoutPosition=function(t){t.getSize(),0!==this.x&&t.size.outerWidth+this.x>this.isotope.size.innerWidth&&(this.x=0,this.y=this.maxY);var e={x:this.x,y:this.y};return this.maxY=Math.max(this.maxY,this.y+t.size.outerHeight),this.x+=t.size.outerWidth,e},e.prototype._getContainerSize=function(){return{height:this.maxY}},e}"function"==typeof define&&define.amd?define("isotope/js/layout-modes/fit-rows",["../layout-mode"],e):e(t.Isotope.LayoutMode)}(window),function(t){function e(t){var e=t.create("vertical",{horizontalAlignment:0});return e.prototype._resetLayout=function(){this.y=0},e.prototype._getItemLayoutPosition=function(t){t.getSize();var e=(this.isotope.size.innerWidth-t.size.outerWidth)*this.options.horizontalAlignment,i=this.y;return this.y+=t.size.outerHeight,{x:e,y:i}},e.prototype._getContainerSize=function(){return{height:this.y}},e}"function"==typeof define&&define.amd?define("isotope/js/layout-modes/vertical",["../layout-mode"],e):e(t.Isotope.LayoutMode)}(window),function(t){function e(t,e){for(var i in e)t[i]=e[i];return t}function i(t){return"[object Array]"===h.call(t)}function o(t){var e=[];if(i(t))e=t;else if(t&&"number"==typeof t.length)for(var o=0,n=t.length;n>o;o++)e.push(t[o]);else e.push(t);return e}function n(t,e){var i=f(e,t);-1!==i&&e.splice(i,1)}function r(t,i,r,u,h){function f(t,e){return function(i,o){for(var n=0,r=t.length;r>n;n++){var s=t[n],a=i.sortData[s],u=o.sortData[s];if(a>u||u>a){var p=void 0!==e[s]?e[s]:e,h=p?1:-1;return(a>u?1:-1)*h}}return 0}}var d=t.create("isotope",{layoutMode:"masonry",isJQueryFiltering:!0,sortAscending:!0});d.Item=u,d.LayoutMode=h,d.prototype._create=function(){this.itemGUID=0,this._sorters={},this._getSorters(),t.prototype._create.call(this),this.modes={},this.filteredItems=this.items,this.sortHistory=["original-order"];for(var e in h.modes)this._initLayoutMode(e)},d.prototype.reloadItems=function(){this.itemGUID=0,t.prototype.reloadItems.call(this)},d.prototype._itemize=function(){for(var e=t.prototype._itemize.apply(this,arguments),i=0,o=e.length;o>i;i++){var n=e[i];n.id=this.itemGUID++}return this._updateItemsSortData(e),e},d.prototype._initLayoutMode=function(t){var i=h.modes[t],o=this.options[t]||{};this.options[t]=i.options?e(i.options,o):o,this.modes[t]=new i(this)},d.prototype.layout=function(){return!this._isLayoutInited&&this.options.isInitLayout?(this.arrange(),void 0):(this._layout(),void 0)},d.prototype._layout=function(){var t=this._getIsInstant();this._resetLayout(),this._manageStamps(),this.layoutItems(this.filteredItems,t),this._isLayoutInited=!0},d.prototype.arrange=function(t){this.option(t),this._getIsInstant(),this.filteredItems=this._filter(this.items),this._sort(),this._layout()},d.prototype._init=d.prototype.arrange,d.prototype._getIsInstant=function(){var t=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;return this._isInstant=t,t},d.prototype._filter=function(t){function e(){f.reveal(n),f.hide(r)}var i=this.options.filter;i=i||"*";for(var o=[],n=[],r=[],s=this._getFilterTest(i),a=0,u=t.length;u>a;a++){var p=t[a];if(!p.isIgnored){var h=s(p);h&&o.push(p),h&&p.isHidden?n.push(p):h||p.isHidden||r.push(p)}}var f=this;return this._isInstant?this._noTransition(e):e(),o},d.prototype._getFilterTest=function(t){return s&&this.options.isJQueryFiltering?function(e){return s(e.element).is(t)}:"function"==typeof t?function(e){return t(e.element)}:function(e){return r(e.element,t)}},d.prototype.updateSortData=function(t){this._getSorters(),t=o(t);
var e=this.getItems(t);e=e.length?e:this.items,this._updateItemsSortData(e)},d.prototype._getSorters=function(){var t=this.options.getSortData;for(var e in t){var i=t[e];this._sorters[e]=l(i)}},d.prototype._updateItemsSortData=function(t){for(var e=0,i=t.length;i>e;e++){var o=t[e];o.updateSortData()}};var l=function(){function t(t){if("string"!=typeof t)return t;var i=a(t).split(" "),o=i[0],n=o.match(/^\[(.+)\]$/),r=n&&n[1],s=e(r,o),u=d.sortDataParsers[i[1]];return t=u?function(t){return t&&u(s(t))}:function(t){return t&&s(t)}}function e(t,e){var i;return i=t?function(e){return e.getAttribute(t)}:function(t){var i=t.querySelector(e);return i&&p(i)}}return t}();d.sortDataParsers={parseInt:function(t){return parseInt(t,10)},parseFloat:function(t){return parseFloat(t)}},d.prototype._sort=function(){var t=this.options.sortBy;if(t){var e=[].concat.apply(t,this.sortHistory),i=f(e,this.options.sortAscending);this.filteredItems.sort(i),t!==this.sortHistory[0]&&this.sortHistory.unshift(t)}},d.prototype._mode=function(){var t=this.options.layoutMode,e=this.modes[t];if(!e)throw Error("No layout mode: "+t);return e.options=this.options[t],e},d.prototype._resetLayout=function(){t.prototype._resetLayout.call(this),this._mode()._resetLayout()},d.prototype._getItemLayoutPosition=function(t){return this._mode()._getItemLayoutPosition(t)},d.prototype._manageStamp=function(t){this._mode()._manageStamp(t)},d.prototype._getContainerSize=function(){return this._mode()._getContainerSize()},d.prototype.needsResizeLayout=function(){return this._mode().needsResizeLayout()},d.prototype.appended=function(t){var e=this.addItems(t);if(e.length){var i=this._filterRevealAdded(e);this.filteredItems=this.filteredItems.concat(i)}},d.prototype.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps();var o=this._filterRevealAdded(e);this.layoutItems(i),this.filteredItems=o.concat(this.filteredItems)}},d.prototype._filterRevealAdded=function(t){var e=this._noTransition(function(){return this._filter(t)});return this.layoutItems(e,!0),this.reveal(e),t},d.prototype.insert=function(t){var e=this.addItems(t);if(e.length){var i,o,n=e.length;for(i=0;n>i;i++)o=e[i],this.element.appendChild(o.element);var r=this._filter(e);for(this._noTransition(function(){this.hide(r)}),i=0;n>i;i++)e[i].isLayoutInstant=!0;for(this.arrange(),i=0;n>i;i++)delete e[i].isLayoutInstant;this.reveal(r)}};var c=d.prototype.remove;return d.prototype.remove=function(t){t=o(t);var e=this.getItems(t);if(c.call(this,t),e&&e.length)for(var i=0,r=e.length;r>i;i++){var s=e[i];n(s,this.filteredItems)}},d.prototype.shuffle=function(){for(var t=0,e=this.items.length;e>t;t++){var i=this.items[t];i.sortData.random=Math.random()}this.options.sortBy="random",this._sort(),this._layout()},d.prototype._noTransition=function(t){var e=this.options.transitionDuration;this.options.transitionDuration=0;var i=t.call(this);return this.options.transitionDuration=e,i},d.prototype.getFilteredItemElements=function(){for(var t=[],e=0,i=this.filteredItems.length;i>e;e++)t.push(this.filteredItems[e].element);return t},d}var s=t.jQuery,a=String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^\s+|\s+$/g,"")},u=document.documentElement,p=u.textContent?function(t){return t.textContent}:function(t){return t.innerText},h=Object.prototype.toString,f=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var i=0,o=t.length;o>i;i++)if(t[i]===e)return i;return-1};"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size","matches-selector/matches-selector","isotope/js/item","isotope/js/layout-mode","isotope/js/layout-modes/masonry","isotope/js/layout-modes/fit-rows","isotope/js/layout-modes/vertical"],r):t.Isotope=r(t.Outlayer,t.getSize,t.matchesSelector,t.Isotope.Item,t.Isotope.LayoutMode)}(window);
(function (window, document, $, undefined){
"use strict";
var H=$("html"),
W=$(window),
D=$(document),
F=$.fancybox=function (){
F.open.apply(this, arguments);
},
IE=navigator.userAgent.match(/msie/i),
didUpdate=null,
isTouch=document.createTouch!==undefined,
isQuery=function(obj){
return obj&&obj.hasOwnProperty&&obj instanceof $;
},
isString=function(str){
return str&&$.type(str)==="string";
},
isPercentage=function(str){
return isString(str)&&str.indexOf('%') > 0;
},
isScrollable=function(el){
return (el&&!(el.style.overflow&&el.style.overflow==='hidden')&&((el.clientWidth&&el.scrollWidth > el.clientWidth)||(el.clientHeight&&el.scrollHeight > el.clientHeight)));
},
getScalar=function(orig, dim){
var value=parseInt(orig, 10)||0;
if(dim&&isPercentage(orig)){
value=F.getViewport()[ dim ] / 100 * value;
}
return Math.ceil(value);
},
getValue=function(value, dim){
return getScalar(value, dim) + 'px';
};
$.extend(F, {
version: '2.1.5',
defaults: {
padding:15,
margin:20,
width:800,
height:600,
minWidth:100,
minHeight:100,
maxWidth:9999,
maxHeight:9999,
pixelRatio: 1,
autoSize:true,
autoHeight:false,
autoWidth:false,
autoResize:true,
autoCenter:!isTouch,
fitToView:true,
aspectRatio:false,
topRatio:0.5,
leftRatio:0.5,
scrolling:'auto', // 'auto', 'yes' or 'no'
wrapCSS:'',
arrows:true,
closeBtn:true,
closeClick:false,
nextClick:false,
mouseWheel:true,
autoPlay:false,
playSpeed:3000,
preload:3,
modal:false,
loop:true,
ajax:{
dataType:'html',
headers:{ 'X-fancyBox': true }},
iframe:{
scrolling:'auto',
preload:true
},
swf:{
wmode: 'transparent',
allowfullscreen:'true',
allowscriptaccess:'always'
},
keys:{
next:{
13:'left',
34:'up',
39:'left',
40:'up'
},
prev:{
8:'right',
33:'down',
37:'right',
38:'down'
},
close:[27],
play:[32],
toggle:[70]
},
direction:{
next:'left',
prev:'right'
},
scrollOutside:true,
index:0,
type:null,
href:null,
content:null,
title:null,
tpl: {
wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
image:'<img class="fancybox-image" src="{href}" alt="" />',
iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"':'') + '></iframe>',
error:'<p class="fancybox-error">'+cws_nav.cws_fn_error+'</p>',
closeBtn:'<a title="'+cws_nav.cws_fn_close+'" class="fancybox-item fancybox-close" href="javascript:;"></a>',
next:'<a title="'+cws_nav.cws_fn_next+'" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
prev:'<a title="'+cws_nav.cws_fn_prev+'" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
},
openEffect:'fade', // 'elastic', 'fade' or 'none'
openSpeed:250,
openEasing:'swing',
openOpacity:true,
openMethod:'zoomIn',
closeEffect:'fade', // 'elastic', 'fade' or 'none'
closeSpeed:250,
closeEasing:'swing',
closeOpacity:true,
closeMethod:'zoomOut',
nextEffect:'elastic', // 'elastic', 'fade' or 'none'
nextSpeed:250,
nextEasing:'swing',
nextMethod:'changeIn',
prevEffect:'elastic', // 'elastic', 'fade' or 'none'
prevSpeed:250,
prevEasing:'swing',
prevMethod:'changeOut',
helpers:{
overlay:true,
title:true
},
onCancel:$.noop,
beforeLoad:$.noop,
afterLoad:$.noop,
beforeShow:$.noop,
afterShow:$.noop,
beforeChange:$.noop,
beforeClose:$.noop,
afterClose:$.noop
},
group:{},
opts:{},
previous:null,
coming:null,
current:null,
isActive:false,
isOpen:false,
isOpened:false,
wrap:null,
skin:null,
outer:null,
inner:null,
player:{
timer:null,
isActive:false
},
ajaxLoad:null,
imgPreload:null,
transitions:{},
helpers:{},
open: function (group, opts){
if(!group){
return;
}
if(!$.isPlainObject(opts)){
opts={};}
if(false===F.close(true)){
return;
}
if(!$.isArray(group)){
group=isQuery(group) ? $(group).get():[group];
}
$.each(group, function(i, element){
var obj={},
href,
title,
content,
type,
rez,
hrefParts,
selector;
if($.type(element)==="object"){
if(element.nodeType){
element=$(element);
}
if(isQuery(element)){
obj={
href:element.data('fancybox-href')||element.attr('href'),
title:element.data('fancybox-title')||element.attr('title'),
isDom:true,
element:element
};
if($.metadata){
$.extend(true, obj, element.metadata());
}}else{
obj=element;
}}
href=opts.href||obj.href||(isString(element) ? element:null);
title=opts.title!==undefined ? opts.title:obj.title||'';
content=opts.content||obj.content;
type=content ? 'html':(opts.type||obj.type);
if(!type&&obj.isDom){
type=element.data('fancybox-type');
if(!type){
rez=element.prop('class').match(/fancybox\.(\w+)/);
type=rez ? rez[1]:null;
}}
if(isString(href)){
if(!type){
if(F.isImage(href)){
type='image';
}else if(F.isSWF(href)){
type='swf';
}else if(href.charAt(0)==='#'){
type='inline';
}else if(isString(element)){
type='html';
content=element;
}}
if(type==='ajax'){
hrefParts=href.split(/\s+/, 2);
href=hrefParts.shift();
selector=hrefParts.shift();
}}
if(!content){
if(type==='inline'){
if(href){
content=$(isString(href) ? href.replace(/.*(?=#[^\s]+$)/, ''):href);
}else if(obj.isDom){
content=element;
}}else if(type==='html'){
content=href;
}else if(!type&&!href&&obj.isDom){
type='inline';
content=element;
}}
$.extend(obj, {
href:href,
type:type,
content:content,
title:title,
selector:selector
});
group[ i ]=obj;
});
F.opts=$.extend(true, {}, F.defaults, opts);
if(opts.keys!==undefined){
F.opts.keys=opts.keys ? $.extend({}, F.defaults.keys, opts.keys):false;
}
F.group=group;
return F._start(F.opts.index);
},
cancel: function (){
var coming=F.coming;
if(!coming||false===F.trigger('onCancel')){
return;
}
F.hideLoading();
if(F.ajaxLoad){
F.ajaxLoad.abort();
}
F.ajaxLoad=null;
if(F.imgPreload){
F.imgPreload.onload=F.imgPreload.onerror=null;
}
if(coming.wrap){
coming.wrap.stop(true, true).trigger('onReset').remove();
}
F.coming=null;
if(!F.current){
F._afterZoomOut(coming);
}},
close: function (event){
F.cancel();
if(false===F.trigger('beforeClose')){
return;
}
F.unbindEvents();
if(!F.isActive){
return;
}
if(!F.isOpen||event===true){
$('.fancybox-wrap').stop(true).trigger('onReset').remove();
F._afterZoomOut();
}else{
F.isOpen=F.isOpened=false;
F.isClosing=true;
$('.fancybox-item, .fancybox-nav').remove();
F.wrap.stop(true, true).removeClass('fancybox-opened');
F.transitions[ F.current.closeMethod ]();
}},
play: function(action){
var clear=function (){
clearTimeout(F.player.timer);
},
set=function (){
clear();
if(F.current&&F.player.isActive){
F.player.timer=setTimeout(F.next, F.current.playSpeed);
}},
stop=function (){
clear();
D.unbind('.player');
F.player.isActive=false;
F.trigger('onPlayEnd');
},
start=function (){
if(F.current&&(F.current.loop||F.current.index < F.group.length - 1)){
F.player.isActive=true;
D.bind({
'onCancel.player beforeClose.player':stop,
'onUpdate.player':set,
'beforeLoad.player':clear
});
set();
F.trigger('onPlayStart');
}};
if(action===true||(!F.player.isActive&&action!==false)){
start();
}else{
stop();
}},
next: function(direction){
var current=F.current;
if(current){
if(!isString(direction)){
direction=current.direction.next;
}
F.jumpto(current.index + 1, direction, 'next');
}},
prev: function(direction){
var current=F.current;
if(current){
if(!isString(direction)){
direction=current.direction.prev;
}
F.jumpto(current.index - 1, direction, 'prev');
}},
jumpto: function(index, direction, router){
var current=F.current;
if(!current){
return;
}
index=getScalar(index);
F.direction=direction||current.direction[ (index >=current.index ? 'next':'prev') ];
F.router=router||'jumpto';
if(current.loop){
if(index < 0){
index=current.group.length + (index % current.group.length);
}
index=index % current.group.length;
}
if(current.group[ index ]!==undefined){
F.cancel();
F._start(index);
}},
reposition: function (e, onlyAbsolute){
var current=F.current,
wrap=current ? current.wrap:null,
pos;
if(wrap){
pos=F._getPosition(onlyAbsolute);
if(e&&e.type==='scroll'){
delete pos.position;
wrap.stop(true, true).animate(pos, 200);
}else{
wrap.css(pos);
current.pos=$.extend({}, current.dim, pos);
}}
},
update: function (e){
var type=(e&&e.type),
anyway = !type||type==='orientationchange';
if(anyway){
clearTimeout(didUpdate);
didUpdate=null;
}
if(!F.isOpen||didUpdate){
return;
}
didUpdate=setTimeout(function(){
var current=F.current;
if(!current||F.isClosing){
return;
}
F.wrap.removeClass('fancybox-tmp');
if(anyway||type==='load'||(type==='resize'&&current.autoResize)){
F._setDimension();
}
if(!(type==='scroll'&&current.canShrink)){
F.reposition(e);
}
F.trigger('onUpdate');
didUpdate=null;
}, (anyway&&!isTouch ? 0:300));
},
toggle: function(action){
if(F.isOpen){
F.current.fitToView=$.type(action)==="boolean" ? action:!F.current.fitToView;
if(isTouch){
F.wrap.removeAttr('style').addClass('fancybox-tmp');
F.trigger('onUpdate');
}
F.update();
}},
hideLoading: function (){
D.unbind('.loading');
$('#fancybox-loading').remove();
},
showLoading: function (){
var el, viewport;
F.hideLoading();
el=$('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body');
D.bind('keydown.loading', function(e){
if((e.which||e.keyCode)===27){
e.preventDefault();
F.cancel();
}});
if(!F.defaults.fixed){
viewport=F.getViewport();
el.css({
position:'absolute',
top:(viewport.h * 0.5) + viewport.y,
left:(viewport.w * 0.5) + viewport.x
});
}},
getViewport: function (){
var locked=(F.current&&F.current.locked)||false,
rez={
x: W.scrollLeft(),
y: W.scrollTop()
};
if(locked){
rez.w=locked[0].clientWidth;
rez.h=locked[0].clientHeight;
}else{
rez.w=isTouch&&window.innerWidth  ? window.innerWidth:W.width();
rez.h=isTouch&&window.innerHeight ? window.innerHeight:W.height();
}
return rez;
},
unbindEvents: function (){
if(F.wrap&&isQuery(F.wrap)){
F.wrap.unbind('.fb');
}
D.unbind('.fb');
W.unbind('.fb');
},
bindEvents: function (){
var current=F.current,
keys;
if(!current){
return;
}
W.bind('orientationchange.fb' + (isTouch ? '':' resize.fb') + (current.autoCenter&&!current.locked ? ' scroll.fb':''), F.update);
keys=current.keys;
if(keys){
D.bind('keydown.fb', function (e){
var code=e.which||e.keyCode,
target=e.target||e.srcElement;
if(code===27&&F.coming){
return false;
}
if(!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.metaKey&&!(target&&(target.type||$(target).is('[contenteditable]')))){
$.each(keys, function(i, val){
if(current.group.length > 1&&val[ code ]!==undefined){
F[ i ](val[ code ]);
e.preventDefault();
return false;
}
if($.inArray(code, val) > -1){
F[ i ] ();
e.preventDefault();
return false;
}});
}});
}
if($.fn.mousewheel&&current.mouseWheel){
F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY){
var target=e.target||null,
parent=$(target),
canScroll=false;
while (parent.length){
if(canScroll||parent.is('.fancybox-skin')||parent.is('.fancybox-wrap')){
break;
}
canScroll=isScrollable(parent[0]);
parent=$(parent).parent();
}
if(delta!==0&&!canScroll){
if(F.group.length > 1&&!current.canShrink){
if(deltaY > 0||deltaX > 0){
F.prev(deltaY > 0 ? 'down':'left');
}else if(deltaY < 0||deltaX < 0){
F.next(deltaY < 0 ? 'up':'right');
}
e.preventDefault();
}}
});
}},
trigger: function (event, o){
var ret, obj=o||F.coming||F.current;
if(!obj){
return;
}
if($.isFunction(obj[event])){
ret=obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
}
if(ret===false){
return false;
}
if(obj.helpers){
$.each(obj.helpers, function (helper, opts){
if(opts&&F.helpers[helper]&&$.isFunction(F.helpers[helper][event])){
F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj);
}});
}
D.trigger(event);
},
isImage: function (str){
return isString(str)&&str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i);
},
isSWF: function (str){
return isString(str)&&str.match(/\.(swf)((\?|#).*)?$/i);
},
_start: function (index){
var coming={},
obj,
href,
type,
margin,
padding;
index=getScalar(index);
obj=F.group[ index ]||null;
if(!obj){
return false;
}
coming=$.extend(true, {}, F.opts, obj);
margin=coming.margin;
padding=coming.padding;
if($.type(margin)==='number'){
coming.margin=[margin, margin, margin, margin];
}
if($.type(padding)==='number'){
coming.padding=[padding, padding, padding, padding];
}
if(coming.modal){
$.extend(true, coming, {
closeBtn:false,
closeClick:false,
nextClick:false,
arrows:false,
mouseWheel:false,
keys:null,
helpers: {
overlay:{
closeClick:false
}}
});
}
if(coming.autoSize){
coming.autoWidth=coming.autoHeight=true;
}
if(coming.width==='auto'){
coming.autoWidth=true;
}
if(coming.height==='auto'){
coming.autoHeight=true;
}
/*
* Add reference to the group, so it`s possible to access from callbacks, example:
* afterLoad:function(){
*     this.title='Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title:'');
* }
*/
coming.group=F.group;
coming.index=index;
F.coming=coming;
if(false===F.trigger('beforeLoad')){
F.coming=null;
return;
}
type=coming.type;
href=coming.href;
if(!type){
F.coming=null;
if(F.current&&F.router&&F.router!=='jumpto'){
F.current.index=index;
return F[ F.router ](F.direction);
}
return false;
}
F.isActive=true;
if(type==='image'||type==='swf'){
coming.autoHeight=coming.autoWidth=false;
coming.scrolling='visible';
}
if(type==='image'){
coming.aspectRatio=true;
}
if(type==='iframe'&&isTouch){
coming.scrolling='scroll';
}
coming.wrap=$(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile':'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo(coming.parent||'body');
$.extend(coming, {
skin:$('.fancybox-skin',  coming.wrap),
outer:$('.fancybox-outer', coming.wrap),
inner:$('.fancybox-inner', coming.wrap)
});
$.each(["Top", "Right", "Bottom", "Left"], function(i, v){
coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
});
F.trigger('onReady');
if(type==='inline'||type==='html'){
if(!coming.content||!coming.content.length){
return F._error('content');
}}else if(!href){
return F._error('href');
}
if(type==='image'){
F._loadImage();
}else if(type==='ajax'){
F._loadAjax();
}else if(type==='iframe'){
F._loadIframe();
}else{
F._afterLoad();
}},
_error: function(type){
$.extend(F.coming, {
type:'html',
autoWidth:true,
autoHeight:true,
minWidth:0,
minHeight:0,
scrolling:'no',
hasError:type,
content:F.coming.tpl.error
});
F._afterLoad();
},
_loadImage: function (){
var img=F.imgPreload=new Image();
img.onload=function (){
this.onload=this.onerror=null;
F.coming.width=this.width / F.opts.pixelRatio;
F.coming.height=this.height / F.opts.pixelRatio;
F._afterLoad();
};
img.onerror=function (){
this.onload=this.onerror=null;
F._error('image');
};
img.src=F.coming.href;
if(img.complete!==true){
F.showLoading();
}},
_loadAjax: function (){
var coming=F.coming;
F.showLoading();
F.ajaxLoad=$.ajax($.extend({}, coming.ajax, {
url: coming.href,
error: function (jqXHR, textStatus){
if(F.coming&&textStatus!=='abort'){
F._error('ajax', jqXHR);
}else{
F.hideLoading();
}},
success: function (data, textStatus){
if(textStatus==='success'){
coming.content=data;
F._afterLoad();
}}
}));
},
_loadIframe: function(){
var coming=F.coming,
iframe=$(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
.attr('scrolling', isTouch ? 'auto':coming.iframe.scrolling)
.attr('src', coming.href);
$(coming.wrap).bind('onReset', function (){
try {
$(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
} catch (e){}});
if(coming.iframe.preload){
F.showLoading();
iframe.one('load', function(){
$(this).data('ready', 1);
if(!isTouch){
$(this).bind('load.fb', F.update);
}
$(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
F._afterLoad();
});
}
coming.content=iframe.appendTo(coming.inner);
if(!coming.iframe.preload){
F._afterLoad();
}},
_preloadImages: function(){
var group=F.group,
current=F.current,
len=group.length,
cnt=current.preload ? Math.min(current.preload, len - 1):0,
item,
i;
for (i=1; i <=cnt; i +=1){
item=group[ (current.index + i) % len ];
if(item.type==='image'&&item.href){
new Image().src=item.href;
}}
},
_afterLoad: function (){
var coming=F.coming,
previous=F.current,
placeholder='fancybox-placeholder',
current,
content,
type,
scrolling,
href,
embed;
F.hideLoading();
if(!coming||F.isActive===false){
return;
}
if(false===F.trigger('afterLoad', coming, previous)){
coming.wrap.stop(true).trigger('onReset').remove();
F.coming=null;
return;
}
if(previous){
F.trigger('beforeChange', previous);
previous.wrap.stop(true).removeClass('fancybox-opened')
.find('.fancybox-item, .fancybox-nav')
.remove();
}
F.unbindEvents();
current=coming;
content=coming.content;
type=coming.type;
scrolling=coming.scrolling;
$.extend(F, {
wrap:current.wrap,
skin:current.skin,
outer:current.outer,
inner:current.inner,
current:current,
previous:previous
});
href=current.href;
switch (type){
case 'inline':
case 'ajax':
case 'html':
if(current.selector){
content=$('<div>').html(content).find(current.selector);
}else if(isQuery(content)){
if(!content.data(placeholder)){
content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter(content).hide());
}
content=content.show().detach();
current.wrap.bind('onReset', function (){
if($(this).find(content).length){
content.hide().replaceAll(content.data(placeholder)).data(placeholder, false);
}});
}
break;
case 'image':
content=current.tpl.image.replace('{href}', href);
break;
case 'swf':
content='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
embed='';
$.each(current.swf, function(name, val){
content +='<param name="' + name + '" value="' + val + '"></param>';
embed   +=' ' + name + '="' + val + '"';
});
content +='<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
break;
}
if(!(isQuery(content)&&content.parent().is(current.inner))){
current.inner.append(content);
}
F.trigger('beforeShow');
current.inner.css('overflow', scrolling==='yes' ? 'scroll':(scrolling==='no' ? 'hidden':scrolling));
F._setDimension();
F.reposition();
F.isOpen=false;
F.coming=null;
F.bindEvents();
if(!F.isOpened){
$('.fancybox-wrap').not(current.wrap).stop(true).trigger('onReset').remove();
}else if(previous.prevMethod){
F.transitions[ previous.prevMethod ]();
}
F.transitions[ F.isOpened ? current.nextMethod:current.openMethod ]();
F._preloadImages();
},
_setDimension: function (){
var viewport=F.getViewport(),
steps=0,
canShrink=false,
canExpand=false,
wrap=F.wrap,
skin=F.skin,
inner=F.inner,
current=F.current,
width=current.width,
height=current.height,
minWidth=current.minWidth,
minHeight=current.minHeight,
maxWidth=current.maxWidth,
maxHeight=current.maxHeight,
scrolling=current.scrolling,
scrollOut=current.scrollOutside ? current.scrollbarWidth:0,
margin=current.margin,
wMargin=getScalar(margin[1] + margin[3]),
hMargin=getScalar(margin[0] + margin[2]),
wPadding,
hPadding,
wSpace,
hSpace,
origWidth,
origHeight,
origMaxWidth,
origMaxHeight,
ratio,
width_,
height_,
maxWidth_,
maxHeight_,
iframe,
body;
wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
wPadding=getScalar(skin.outerWidth(true)  - skin.width());
hPadding=getScalar(skin.outerHeight(true) - skin.height());
wSpace=wMargin + wPadding;
hSpace=hMargin + hPadding;
origWidth=isPercentage(width)  ? (viewport.w - wSpace) * getScalar(width)  / 100:width;
origHeight=isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100:height;
if(current.type==='iframe'){
iframe=current.content;
if(current.autoHeight&&iframe.data('ready')===1){
try {
if(iframe[0].contentWindow.document.location){
inner.width(origWidth).height(9999);
body=iframe.contents().find('body');
if(scrollOut){
body.css('overflow-x', 'hidden');
}
origHeight=body.outerHeight(true);
}} catch (e){}}
}else if(current.autoWidth||current.autoHeight){
inner.addClass('fancybox-tmp');
if(!current.autoWidth){
inner.width(origWidth);
}
if(!current.autoHeight){
inner.height(origHeight);
}
if(current.autoWidth){
origWidth=inner.width();
}
if(current.autoHeight){
origHeight=inner.height();
}
inner.removeClass('fancybox-tmp');
}
width=getScalar(origWidth);
height=getScalar(origHeight);
ratio=origWidth / origHeight;
minWidth=getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace:minWidth);
maxWidth=getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace:maxWidth);
minHeight=getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace:minHeight);
maxHeight=getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace:maxHeight);
origMaxWidth=maxWidth;
origMaxHeight=maxHeight;
if(current.fitToView){
maxWidth=Math.min(viewport.w - wSpace, maxWidth);
maxHeight=Math.min(viewport.h - hSpace, maxHeight);
}
maxWidth_=viewport.w - wMargin;
maxHeight_=viewport.h - hMargin;
if(current.aspectRatio){
if(width > maxWidth){
width=maxWidth;
height=getScalar(width / ratio);
}
if(height > maxHeight){
height=maxHeight;
width=getScalar(height * ratio);
}
if(width < minWidth){
width=minWidth;
height=getScalar(width / ratio);
}
if(height < minHeight){
height=minHeight;
width=getScalar(height * ratio);
}}else{
width=Math.max(minWidth, Math.min(width, maxWidth));
if(current.autoHeight&&current.type!=='iframe'){
inner.width(width);
height=inner.height();
}
height=Math.max(minHeight, Math.min(height, maxHeight));
}
if(current.fitToView){
inner.width(width).height(height);
wrap.width(width + wPadding);
width_=wrap.width();
height_=wrap.height();
if(current.aspectRatio){
while ((width_ > maxWidth_||height_ > maxHeight_)&&width > minWidth&&height > minHeight){
if(steps++ > 19){
break;
}
height=Math.max(minHeight, Math.min(maxHeight, height - 10));
width=getScalar(height * ratio);
if(width < minWidth){
width=minWidth;
height=getScalar(width / ratio);
}
if(width > maxWidth){
width=maxWidth;
height=getScalar(width / ratio);
}
inner.width(width).height(height);
wrap.width(width + wPadding);
width_=wrap.width();
height_=wrap.height();
}}else{
width=Math.max(minWidth,  Math.min(width,  width  - (width_  - maxWidth_)));
height=Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
}}
if(scrollOut&&scrolling==='auto'&&height < origHeight&&(width + wPadding + scrollOut) < maxWidth_){
width +=scrollOut;
}
inner.width(width).height(height);
wrap.width(width + wPadding);
width_=wrap.width();
height_=wrap.height();
canShrink=(width_ > maxWidth_||height_ > maxHeight_)&&width > minWidth&&height > minHeight;
canExpand=current.aspectRatio ? (width < origMaxWidth&&height < origMaxHeight&&width < origWidth&&height < origHeight):((width < origMaxWidth||height < origMaxHeight)&&(width < origWidth||height < origHeight));
$.extend(current, {
dim:{
width:getValue(width_),
height:getValue(height_)
},
origWidth:origWidth,
origHeight:origHeight,
canShrink:canShrink,
canExpand:canExpand,
wPadding:wPadding,
hPadding:hPadding,
wrapSpace:height_ - skin.outerHeight(true),
skinSpace:skin.height() - height
});
if(!iframe&&current.autoHeight&&height > minHeight&&height < maxHeight&&!canExpand){
inner.height('auto');
}},
_getPosition: function (onlyAbsolute){
var current=F.current,
viewport=F.getViewport(),
margin=current.margin,
width=F.wrap.width()  + margin[1] + margin[3],
height=F.wrap.height() + margin[0] + margin[2],
rez={
position: 'absolute',
top:margin[0],
left:margin[3]
};
if(current.autoCenter&&current.fixed&&!onlyAbsolute&&height <=viewport.h&&width <=viewport.w){
rez.position='fixed';
}else if(!current.locked){
rez.top  +=viewport.y;
rez.left +=viewport.x;
}
rez.top=getValue(Math.max(rez.top,  rez.top  + ((viewport.h - height) * current.topRatio)));
rez.left=getValue(Math.max(rez.left, rez.left + ((viewport.w - width)  * current.leftRatio)));
return rez;
},
_afterZoomIn: function (){
var current=F.current;
if(!current){
return;
}
F.isOpen=F.isOpened=true;
F.wrap.css('overflow', 'visible').addClass('fancybox-opened');
F.update();
if(current.closeClick||(current.nextClick&&F.group.length > 1)){
F.inner.css('cursor', 'pointer').bind('click.fb', function(e){
if(!$(e.target).is('a')&&!$(e.target).parent().is('a')){
e.preventDefault();
F[ current.closeClick ? 'close':'next' ]();
}});
}
if(current.closeBtn){
$(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e){
e.preventDefault();
F.close();
});
}
if(current.arrows&&F.group.length > 1){
if(current.loop||current.index > 0){
$(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
}
if(current.loop||current.index < F.group.length - 1){
$(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
}}
F.trigger('afterShow');
if(!current.loop&&current.index===current.group.length - 1){
F.play(false);
}else if(F.opts.autoPlay&&!F.player.isActive){
F.opts.autoPlay=false;
F.play();
}},
_afterZoomOut: function(obj){
obj=obj||F.current;
$('.fancybox-wrap').trigger('onReset').remove();
$.extend(F, {
group:{},
opts:{},
router:false,
current:null,
isActive:false,
isOpened:false,
isOpen:false,
isClosing:false,
wrap:null,
skin:null,
outer:null,
inner:null
});
F.trigger('afterClose', obj);
}});
F.transitions={
getOrigPosition: function (){
var current=F.current,
element=current.element,
orig=current.orig,
pos={},
width=50,
height=50,
hPadding=current.hPadding,
wPadding=current.wPadding,
viewport=F.getViewport();
if(!orig&&current.isDom&&element.is(':visible')){
orig=element.find('img:first');
if(!orig.length){
orig=element;
}}
if(isQuery(orig)){
pos=orig.offset();
if(orig.is('img')){
width=orig.outerWidth();
height=orig.outerHeight();
}}else{
pos.top=viewport.y + (viewport.h - height) * current.topRatio;
pos.left=viewport.x + (viewport.w - width)  * current.leftRatio;
}
if(F.wrap.css('position')==='fixed'||current.locked){
pos.top  -=viewport.y;
pos.left -=viewport.x;
}
pos={
top:getValue(pos.top  - hPadding * current.topRatio),
left:getValue(pos.left - wPadding * current.leftRatio),
width:getValue(width  + wPadding),
height:getValue(height + hPadding)
};
return pos;
},
step: function (now, fx){
var ratio,
padding,
value,
prop=fx.prop,
current=F.current,
wrapSpace=current.wrapSpace,
skinSpace=current.skinSpace;
if(prop==='width'||prop==='height'){
ratio=fx.end===fx.start ? 1:(now - fx.start) / (fx.end - fx.start);
if(F.isClosing){
ratio=1 - ratio;
}
padding=prop==='width' ? current.wPadding:current.hPadding;
value=now - padding;
F.skin[ prop ](getScalar(prop==='width' ?  value:value - (wrapSpace * ratio)) );
F.inner[ prop ](getScalar(prop==='width' ?  value:value - (wrapSpace * ratio) - (skinSpace * ratio)) );
}},
zoomIn: function (){
var current=F.current,
startPos=current.pos,
effect=current.openEffect,
elastic=effect==='elastic',
endPos=$.extend({opacity:1}, startPos);
delete endPos.position;
if(elastic){
startPos=this.getOrigPosition();
if(current.openOpacity){
startPos.opacity=0.1;
}}else if(effect==='fade'){
startPos.opacity=0.1;
}
F.wrap.css(startPos).animate(endPos, {
duration:effect==='none' ? 0:current.openSpeed,
easing:current.openEasing,
step:elastic ? this.step:null,
complete:F._afterZoomIn
});
},
zoomOut: function (){
var current=F.current,
effect=current.closeEffect,
elastic=effect==='elastic',
endPos={opacity:0.1};
if(elastic){
endPos=this.getOrigPosition();
if(current.closeOpacity){
endPos.opacity=0.1;
}}
F.wrap.animate(endPos, {
duration:effect==='none' ? 0:current.closeSpeed,
easing:current.closeEasing,
step:elastic ? this.step:null,
complete:F._afterZoomOut
});
},
changeIn: function (){
var current=F.current,
effect=current.nextEffect,
startPos=current.pos,
endPos={ opacity:1 },
direction=F.direction,
distance=200,
field;
startPos.opacity=0.1;
if(effect==='elastic'){
field=direction==='down'||direction==='up' ? 'top':'left';
if(direction==='down'||direction==='right'){
startPos[ field ]=getValue(getScalar(startPos[ field ]) - distance);
endPos[ field ]='+=' + distance + 'px';
}else{
startPos[ field ]=getValue(getScalar(startPos[ field ]) + distance);
endPos[ field ]='-=' + distance + 'px';
}}
if(effect==='none'){
F._afterZoomIn();
}else{
F.wrap.css(startPos).animate(endPos, {
duration:current.nextSpeed,
easing:current.nextEasing,
complete:F._afterZoomIn
});
}},
changeOut: function (){
var previous=F.previous,
effect=previous.prevEffect,
endPos={ opacity:0.1 },
direction=F.direction,
distance=200;
if(effect==='elastic'){
endPos[ direction==='down'||direction==='up' ? 'top':'left' ]=(direction==='up'||direction==='left' ? '-':'+') + '=' + distance + 'px';
}
previous.wrap.animate(endPos, {
duration:effect==='none' ? 0:previous.prevSpeed,
easing:previous.prevEasing,
complete:function (){
$(this).trigger('onReset').remove();
}});
}};
F.helpers.overlay={
defaults:{
closeClick:true,
speedOut:200,
showEarly:true,
css:{},
locked:!isTouch,
fixed:true
},
overlay:null,
fixed:false,
el:$('html'),
create:function(opts){
opts=$.extend({}, this.defaults, opts);
if(this.overlay){
this.close();
}
this.overlay=$('<div class="fancybox-overlay"></div>').appendTo(F.coming ? F.coming.parent:opts.parent);
this.fixed=false;
if(opts.fixed&&F.defaults.fixed){
this.overlay.addClass('fancybox-overlay-fixed');
this.fixed=true;
}},
open:function(opts){
var that=this;
opts=$.extend({}, this.defaults, opts);
if(this.overlay){
this.overlay.unbind('.overlay').width('auto').height('auto');
}else{
this.create(opts);
}
if(!this.fixed){
W.bind('resize.overlay', $.proxy(this.update, this));
this.update();
}
if(opts.closeClick){
this.overlay.bind('click.overlay', function(e){
if($(e.target).hasClass('fancybox-overlay')){
if(F.isActive){
F.close();
}else{
that.close();
}
return false;
}});
}
this.overlay.css(opts.css).show();
},
close:function(){
var scrollV, scrollH;
W.unbind('resize.overlay');
if(this.el.hasClass('fancybox-lock')){
$('.fancybox-margin').removeClass('fancybox-margin');
scrollV=W.scrollTop();
scrollH=W.scrollLeft();
this.el.removeClass('fancybox-lock');
W.scrollTop(scrollV).scrollLeft(scrollH);
}
$('.fancybox-overlay').remove().hide();
$.extend(this, {
overlay:null,
fixed:false
});
},
update:function (){
var width='100%', offsetWidth;
this.overlay.width(width).height('100%');
if(IE){
offsetWidth=Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
if(D.width() > offsetWidth){
width=D.width();
}}else if(D.width() > W.width()){
width=D.width();
}
this.overlay.width(width).height(D.height());
},
onReady:function (opts, obj){
var overlay=this.overlay;
$('.fancybox-overlay').stop(true, true);
if(!overlay){
this.create(opts);
}
if(opts.locked&&this.fixed&&obj.fixed){
if(!overlay){
this.margin=D.height() > W.height() ? $('html').css('margin-right').replace("px", ""):false;
}
obj.locked=this.overlay.append(obj.wrap);
obj.fixed=false;
}
if(opts.showEarly===true){
this.beforeShow.apply(this, arguments);
}},
beforeShow:function(opts, obj){
var scrollV, scrollH;
if(obj.locked){
if(this.margin!==false){
$('*').filter(function(){
return ($(this).css('position')==='fixed'&&!$(this).hasClass("fancybox-overlay")&&!$(this).hasClass("fancybox-wrap"));
}).addClass('fancybox-margin');
this.el.addClass('fancybox-margin');
}
scrollV=W.scrollTop();
scrollH=W.scrollLeft();
this.el.addClass('fancybox-lock');
W.scrollTop(scrollV).scrollLeft(scrollH);
}
this.open(opts);
},
onUpdate:function(){
if(!this.fixed){
this.update();
}},
afterClose: function (opts){
if(this.overlay&&!F.coming){
this.overlay.fadeOut(opts.speedOut, $.proxy(this.close, this));
}}
};
F.helpers.title={
defaults:{
type:'float', // 'float', 'inside', 'outside' or 'over',
position:'bottom' // 'top' or 'bottom'
},
beforeShow: function (opts){
var current=F.current,
text=current.title,
type=opts.type,
title,
target;
if($.isFunction(text)){
text=text.call(current.element, current);
}
if(!isString(text)||$.trim(text)===''){
return;
}
title=$('<div class="fancybox-title fancybox-title-' + type + '-wrap">' + text + '</div>');
switch (type){
case 'inside':
target=F.skin;
break;
case 'outside':
target=F.wrap;
break;
case 'over':
target=F.inner;
break;
default: // 'float'
target=F.skin;
title.appendTo('body');
if(IE){
title.width(title.width());
}
title.wrapInner('<span class="child"></span>');
F.current.margin[2] +=Math.abs(getScalar(title.css('margin-bottom')));
break;
}
title[ (opts.position==='top' ? 'prependTo':'appendTo') ](target);
}};
$.fn.fancybox=function (options){
var index,
that=$(this),
selector=this.selector||'',
run=function(e){
var what=$(this).blur(), idx=index, relType, relVal;
if(!(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&!what.is('.fancybox-wrap')){
relType=options.groupAttr||'data-fancybox-group';
relVal=what.attr(relType);
if(!relVal){
relType='rel';
relVal=what.get(0)[ relType ];
}
if(relVal&&relVal!==''&&relVal!=='nofollow'){
what=selector.length ? $(selector):that;
what=what.filter('[' + relType + '="' + relVal + '"]');
idx=what.index(this);
}
options.index=idx;
if(F.open(what, options)!==false){
e.preventDefault();
}}
};
options=options||{};
index=options.index||0;
if(!selector||options.live===false){
that.unbind('click.fb-start').bind('click.fb-start', run);
}else{
D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
}
this.filter('[data-fancybox-start=1]').trigger('click');
return this;
};
D.ready(function(){
var w1, w2;
if($.scrollbarWidth===undefined){
$.scrollbarWidth=function(){
var parent=$('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
child=parent.children(),
width=child.innerWidth() - child.height(99).innerWidth();
parent.remove();
return width;
};}
if($.support.fixedPosition===undefined){
$.support.fixedPosition=(function(){
var elem=$('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
fixed=(elem[0].offsetTop===20||elem[0].offsetTop===15);
elem.remove();
return fixed;
}());
}
$.extend(F.defaults, {
scrollbarWidth:$.scrollbarWidth(),
fixed:$.support.fixedPosition,
parent:$('body')
});
w1=$(window).width();
H.addClass('fancybox-lock-test');
w2=$(window).width();
H.removeClass('fancybox-lock-test');
$("<style type='text/css'>.fancybox-margin{margin-right:" + (w2 - w1) + "px;}</style>").appendTo("head");
});
}(window, document, jQuery));
(function(){
var COUNT_FRAMERATE, COUNT_MS_PER_FRAME, DIGIT_FORMAT, DIGIT_HTML, DIGIT_SPEEDBOOST, DURATION, FORMAT_MARK_HTML, FORMAT_PARSER, FRAMERATE, FRAMES_PER_VALUE, MS_PER_FRAME, MutationObserver, Odometer, RIBBON_HTML, TRANSITION_END_EVENTS, TRANSITION_SUPPORT, VALUE_HTML, addClass, createFromHTML, fractionalPart, now, removeClass, requestAnimationFrame, round, transitionCheckStyles, trigger, truncate, wrapJQuery, _jQueryWrapped, _old, _ref, _ref1,
__slice=[].slice;
VALUE_HTML='<span class="odometer-value"></span>';
RIBBON_HTML='<span class="odometer-ribbon"><span class="odometer-ribbon-inner">' + VALUE_HTML + '</span></span>';
DIGIT_HTML='<span class="odometer-digit"><span class="odometer-digit-spacer">8</span><span class="odometer-digit-inner">' + RIBBON_HTML + '</span></span>';
FORMAT_MARK_HTML='<span class="odometer-formatting-mark"></span>';
DIGIT_FORMAT='(,ddd).dd';
FORMAT_PARSER=/^\(?([^)]*)\)?(?:(.)(d+))?$/;
FRAMERATE=30;
DURATION=2000;
COUNT_FRAMERATE=20;
FRAMES_PER_VALUE=2;
DIGIT_SPEEDBOOST=.5;
MS_PER_FRAME=1000 / FRAMERATE;
COUNT_MS_PER_FRAME=1000 / COUNT_FRAMERATE;
TRANSITION_END_EVENTS='transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd';
transitionCheckStyles=document.createElement('div').style;
TRANSITION_SUPPORT=(transitionCheckStyles.transition!=null)||(transitionCheckStyles.webkitTransition!=null)||(transitionCheckStyles.mozTransition!=null)||(transitionCheckStyles.oTransition!=null);
requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;
MutationObserver=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;
createFromHTML=function(html){
var el;
el=document.createElement('div');
el.innerHTML=html;
return el.children[0];
};
removeClass=function(el, name){
return el.className=el.className.replace(new RegExp("(^|)" + (name.split(' ').join('|')) + "(|$)", 'gi'), ' ');
};
addClass=function(el, name){
removeClass(el, name);
return el.className +=" " + name;
};
trigger=function(el, name){
var evt;
if(document.createEvent!=null){
evt=document.createEvent('HTMLEvents');
evt.initEvent(name, true, true);
return el.dispatchEvent(evt);
}};
now=function(){
var _ref, _ref1;
return (_ref=(_ref1=window.performance)!=null ? typeof _ref1.now==="function" ? _ref1.now():void 0:void 0)!=null ? _ref:+(new Date);
};
round=function(val, precision){
if(precision==null){
precision=0;
}
if(!precision){
return Math.round(val);
}
val *=Math.pow(10, precision);
val +=0.5;
val=Math.floor(val);
return val /=Math.pow(10, precision);
};
truncate=function(val){
if(val < 0){
return Math.ceil(val);
}else{
return Math.floor(val);
}};
fractionalPart=function(val){
return val - round(val);
};
_jQueryWrapped=false;
(wrapJQuery=function(){
var property, _i, _len, _ref, _results;
if(_jQueryWrapped){
return;
}
if(window.jQuery!=null){
_jQueryWrapped=true;
_ref=['html', 'text'];
_results=[];
for (_i=0, _len=_ref.length; _i < _len; _i++){
property=_ref[_i];
_results.push((function(property){
var old;
old=window.jQuery.fn[property];
return window.jQuery.fn[property]=function(val){
var _ref1;
if((val==null)||(((_ref1=this[0])!=null ? _ref1.odometer:void 0)==null)){
return old.apply(this, arguments);
}
return this[0].odometer.update(val);
};})(property));
}
return _results;
}})();
setTimeout(wrapJQuery, 0);
Odometer=(function(){
function Odometer(options){
var e, k, property, v, _base, _i, _len, _ref, _ref1, _ref2,
_this=this;
this.options=options;
this.el=this.options.el;
if(this.el.odometer!=null){
return this.el.odometer;
}
this.el.odometer=this;
_ref=Odometer.options;
for (k in _ref){
v=_ref[k];
if(this.options[k]==null){
this.options[k]=v;
}}
if((_base=this.options).duration==null){
_base.duration=DURATION;
}
this.MAX_VALUES=((this.options.duration / MS_PER_FRAME) / FRAMES_PER_VALUE) | 0;
this.resetFormat();
this.value=this.cleanValue((_ref1=this.options.value)!=null ? _ref1:'');
this.renderInside();
this.render();
try {
_ref2=['innerHTML', 'innerText', 'textContent'];
for (_i=0, _len=_ref2.length; _i < _len; _i++){
property=_ref2[_i];
if(this.el[property]!=null){
(function(property){
return Object.defineProperty(_this.el, property, {
get: function(){
var _ref3;
if(property==='innerHTML'){
return _this.inside.outerHTML;
}else{
return (_ref3=_this.inside.innerText)!=null ? _ref3:_this.inside.textContent;
}},
set: function(val){
return _this.update(val);
}});
})(property);
}}
} catch (_error){
e=_error;
this.watchForMutations();
}
this;
}
Odometer.prototype.renderInside=function(){
this.inside=document.createElement('div');
this.inside.className='odometer-inside';
this.el.innerHTML='';
return this.el.appendChild(this.inside);
};
Odometer.prototype.watchForMutations=function(){
var e,
_this=this;
if(MutationObserver==null){
return;
}
try {
if(this.observer==null){
this.observer=new MutationObserver(function(mutations){
var newVal;
newVal=_this.el.innerText;
_this.renderInside();
_this.render(_this.value);
return _this.update(newVal);
});
}
this.watchMutations=true;
return this.startWatchingMutations();
} catch (_error){
e=_error;
}};
Odometer.prototype.startWatchingMutations=function(){
if(this.watchMutations){
return this.observer.observe(this.el, {
childList: true
});
}};
Odometer.prototype.stopWatchingMutations=function(){
var _ref;
return (_ref=this.observer)!=null ? _ref.disconnect():void 0;
};
Odometer.prototype.cleanValue=function(val){
var _ref;
if(typeof val==='string'){
val=val.replace((_ref=this.format.radix)!=null ? _ref:'.', '<radix>');
val=val.replace(/[.,]/g, '');
val=val.replace('<radix>', '.');
val=parseFloat(val, 10)||0;
}
return round(val, this.format.precision);
};
Odometer.prototype.bindTransitionEnd=function(){
var event, renderEnqueued, _i, _len, _ref, _results,
_this=this;
if(this.transitionEndBound){
return;
}
this.transitionEndBound=true;
renderEnqueued=false;
_ref=TRANSITION_END_EVENTS.split(' ');
_results=[];
for (_i=0, _len=_ref.length; _i < _len; _i++){
event=_ref[_i];
_results.push(this.el.addEventListener(event, function(){
if(renderEnqueued){
return true;
}
renderEnqueued=true;
setTimeout(function(){
_this.render();
renderEnqueued=false;
return trigger(_this.el, 'odometerdone');
}, 0);
return true;
}, false));
}
return _results;
};
Odometer.prototype.resetFormat=function(){
var format, fractional, parsed, precision, radix, repeating, _ref, _ref1;
format=(_ref=this.options.format)!=null ? _ref:DIGIT_FORMAT;
format||(format='d');
parsed=FORMAT_PARSER.exec(format);
if(!parsed){
throw new Error("Odometer: Unparsable digit format");
}
_ref1=parsed.slice(1, 4), repeating=_ref1[0], radix=_ref1[1], fractional=_ref1[2];
precision=(fractional!=null ? fractional.length:void 0)||0;
return this.format={
repeating: repeating,
radix: radix,
precision: precision
};};
Odometer.prototype.render=function(value){
var classes, cls, digit, match, newClasses, theme, wholePart, _i, _j, _len, _len1, _ref;
if(value==null){
value=this.value;
}
this.stopWatchingMutations();
this.resetFormat();
this.inside.innerHTML='';
theme=this.options.theme;
classes=this.el.className.split(' ');
newClasses=[];
for (_i=0, _len=classes.length; _i < _len; _i++){
cls=classes[_i];
if(!cls.length){
continue;
}
if(match=/^odometer-theme-(.+)$/.exec(cls)){
theme=match[1];
continue;
}
if(/^odometer(-|$)/.test(cls)){
continue;
}
newClasses.push(cls);
}
newClasses.push('odometer');
if(!TRANSITION_SUPPORT){
newClasses.push('odometer-no-transitions');
}
if(theme){
newClasses.push("odometer-theme-" + theme);
}else{
newClasses.push("odometer-auto-theme");
}
this.el.className=newClasses.join(' ');
this.ribbons={};
this.digits=[];
wholePart = !this.format.precision||!fractionalPart(value)||false;
_ref=value.toString().split('').reverse();
for (_j=0, _len1=_ref.length; _j < _len1; _j++){
digit=_ref[_j];
if(digit==='.'){
wholePart=true;
}
this.addDigit(digit, wholePart);
}
return this.startWatchingMutations();
};
Odometer.prototype.update=function(newValue){
var diff,
_this=this;
newValue=this.cleanValue(newValue);
if(!(diff=newValue - this.value)){
return;
}
removeClass(this.el, 'odometer-animating-up odometer-animating-down odometer-animating');
if(diff > 0){
addClass(this.el, 'odometer-animating-up');
}else{
addClass(this.el, 'odometer-animating-down');
}
this.stopWatchingMutations();
this.animate(newValue);
this.startWatchingMutations();
setTimeout(function(){
_this.el.offsetHeight;
return addClass(_this.el, 'odometer-animating');
}, 0);
return this.value=newValue;
};
Odometer.prototype.renderDigit=function(){
return createFromHTML(DIGIT_HTML);
};
Odometer.prototype.insertDigit=function(digit, before){
if(before!=null){
return this.inside.insertBefore(digit, before);
}else if(!this.inside.children.length){
return this.inside.appendChild(digit);
}else{
return this.inside.insertBefore(digit, this.inside.children[0]);
}};
Odometer.prototype.addSpacer=function(chr, before, extraClasses){
var spacer;
spacer=createFromHTML(FORMAT_MARK_HTML);
spacer.innerHTML=chr;
if(extraClasses){
addClass(spacer, extraClasses);
}
return this.insertDigit(spacer, before);
};
Odometer.prototype.addDigit=function(value, repeating){
var chr, digit, resetted, _ref;
if(repeating==null){
repeating=true;
}
if(value==='-'){
return this.addSpacer(value, null, 'odometer-negation-mark');
}
if(value==='.'){
return this.addSpacer((_ref=this.format.radix)!=null ? _ref:'.', null, 'odometer-radix-mark');
}
if(repeating){
resetted=false;
while (true){
if(!this.format.repeating.length){
if(resetted){
throw new Error("Bad odometer format without digits");
}
this.resetFormat();
resetted=true;
}
chr=this.format.repeating[this.format.repeating.length - 1];
this.format.repeating=this.format.repeating.substring(0, this.format.repeating.length - 1);
if(chr==='d'){
break;
}
this.addSpacer(chr);
}}
digit=this.renderDigit();
digit.querySelector('.odometer-value').innerHTML=value;
this.digits.push(digit);
return this.insertDigit(digit);
};
Odometer.prototype.animate=function(newValue){
if(!TRANSITION_SUPPORT||this.options.animation==='count'){
return this.animateCount(newValue);
}else{
return this.animateSlide(newValue);
}};
Odometer.prototype.animateCount=function(newValue){
var cur, diff, last, start, tick,
_this=this;
if(!(diff=+newValue - this.value)){
return;
}
start=last=now();
cur=this.value;
return (tick=function(){
var delta, dist, fraction;
if((now() - start) > _this.options.duration){
_this.value=newValue;
_this.render();
trigger(_this.el, 'odometerdone');
return;
}
delta=now() - last;
if(delta > COUNT_MS_PER_FRAME){
last=now();
fraction=delta / _this.options.duration;
dist=diff * fraction;
cur +=dist;
_this.render(Math.round(cur));
}
if(requestAnimationFrame!=null){
return requestAnimationFrame(tick);
}else{
return setTimeout(tick, COUNT_MS_PER_FRAME);
}})();
};
Odometer.prototype.getDigitCount=function(){
var i, max, value, values, _i, _len;
values=1 <=arguments.length ? __slice.call(arguments, 0):[];
for (i=_i=0, _len=values.length; _i < _len; i=++_i){
value=values[i];
values[i]=Math.abs(value);
}
max=Math.max.apply(Math, values);
return Math.ceil(Math.log(max + 1) / Math.log(10));
};
Odometer.prototype.getFractionalDigitCount=function(){
var i, parser, parts, value, values, _i, _len;
values=1 <=arguments.length ? __slice.call(arguments, 0):[];
parser=/^\-?\d*\.(\d*?)0*$/;
for (i=_i=0, _len=values.length; _i < _len; i=++_i){
value=values[i];
values[i]=value.toString();
parts=parser.exec(values[i]);
if(parts==null){
values[i]=0;
}else{
values[i]=parts[1].length;
}}
return Math.max.apply(Math, values);
};
Odometer.prototype.resetDigits=function(){
this.digits=[];
this.ribbons=[];
this.inside.innerHTML='';
return this.resetFormat();
};
Odometer.prototype.animateSlide=function(newValue){
var boosted, cur, diff, digitCount, digits, dist, end, fractionalCount, frame, frames, i, incr, j, mark, numEl, oldValue, start, _base, _i, _j, _k, _l, _len, _len1, _len2, _m, _ref, _results;
oldValue=this.value;
fractionalCount=this.getFractionalDigitCount(oldValue, newValue);
if(fractionalCount){
newValue=newValue * Math.pow(10, fractionalCount);
oldValue=oldValue * Math.pow(10, fractionalCount);
}
if(!(diff=newValue - oldValue)){
return;
}
this.bindTransitionEnd();
digitCount=this.getDigitCount(oldValue, newValue);
digits=[];
boosted=0;
for (i=_i=0; 0 <=digitCount ? _i < digitCount:_i > digitCount; i=0 <=digitCount ? ++_i:--_i){
start=truncate(oldValue / Math.pow(10, digitCount - i - 1));
end=truncate(newValue / Math.pow(10, digitCount - i - 1));
dist=end - start;
if(Math.abs(dist) > this.MAX_VALUES){
frames=[];
incr=dist / (this.MAX_VALUES + this.MAX_VALUES * boosted * DIGIT_SPEEDBOOST);
cur=start;
while ((dist > 0&&cur < end)||(dist < 0&&cur > end)){
frames.push(Math.round(cur));
cur +=incr;
}
if(frames[frames.length - 1]!==end){
frames.push(end);
}
boosted++;
}else{
frames=(function(){
_results=[];
for (var _j=start; start <=end ? _j <=end:_j >=end; start <=end ? _j++:_j--){ _results.push(_j); }
return _results;
}).apply(this);
}
for (i=_k=0, _len=frames.length; _k < _len; i=++_k){
frame=frames[i];
frames[i]=Math.abs(frame % 10);
}
digits.push(frames);
}
this.resetDigits();
_ref=digits.reverse();
for (i=_l=0, _len1=_ref.length; _l < _len1; i=++_l){
frames=_ref[i];
if(!this.digits[i]){
this.addDigit(' ', i >=fractionalCount);
}
if((_base=this.ribbons)[i]==null){
_base[i]=this.digits[i].querySelector('.odometer-ribbon-inner');
}
this.ribbons[i].innerHTML='';
if(diff < 0){
frames=frames.reverse();
}
for (j=_m=0, _len2=frames.length; _m < _len2; j=++_m){
frame=frames[j];
numEl=document.createElement('div');
numEl.className='odometer-value';
numEl.innerHTML=frame;
this.ribbons[i].appendChild(numEl);
if(j===frames.length - 1){
addClass(numEl, 'odometer-last-value');
}
if(j===0){
addClass(numEl, 'odometer-first-value');
}}
}
if(start < 0){
this.addDigit('-');
}
mark=this.inside.querySelector('.odometer-radix-mark');
if(mark!=null){
mark.parent.removeChild(mark);
}
if(fractionalCount){
return this.addSpacer(this.format.radix, this.digits[fractionalCount - 1], 'odometer-radix-mark');
}};
return Odometer;
})();
Odometer.options=(_ref=window.odometerOptions)!=null ? _ref:{};
setTimeout(function(){
var k, v, _base, _ref1, _results;
if(window.odometerOptions){
_ref1=window.odometerOptions;
_results=[];
for (k in _ref1){
v=_ref1[k];
_results.push((_base=Odometer.options)[k]!=null ? (_base=Odometer.options)[k]:_base[k]=v);
}
return _results;
}}, 0);
Odometer.init=function(){
var el, elements, _i, _len, _ref1, _results;
if(document.querySelectorAll==null){
return;
}
elements=document.querySelectorAll(Odometer.options.selector||'.odometer');
_results=[];
for (_i=0, _len=elements.length; _i < _len; _i++){
el=elements[_i];
_results.push(el.odometer=new Odometer({
el: el,
value: (_ref1=el.innerText)!=null ? _ref1:el.textContent
}));
}
return _results;
};
if((((_ref1=document.documentElement)!=null ? _ref1.doScroll:void 0)!=null)&&(document.createEventObject!=null)){
_old=document.onreadystatechange;
document.onreadystatechange=function(){
if(document.readyState==='complete'&&Odometer.options.auto!==false){
Odometer.init();
}
return _old!=null ? _old.apply(this, arguments):void 0;
};}else{
document.addEventListener('DOMContentLoaded', function(){
if(Odometer.options.auto!==false){
return Odometer.init();
}}, false);
}
if(typeof define==='function'&&define.amd){
define(['jquery'], function(){
return Odometer;
});
}else if(typeof exports===!'undefined'){
module.exports=Odometer;
}else{
window.Odometer=Odometer;
}}).call(this);
(function (factory){
if(typeof define==='function'&&define.amd){
define(['jquery'], factory);
}else if(typeof exports==='object'){
factory(require('jquery'));
}else{
factory(jQuery);
}}(function (jQuery){
var S2 =
(function (){
if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd){
var S2=jQuery.fn.select2.amd;
}
var S2;(function (){ if(!S2||!S2.requirejs){
if(!S2){ S2={};}else{ require=S2; }
var requirejs, require, define;
(function (undef){
var main, req, makeMap, handlers,
defined={},
waiting={},
config={},
defining={},
hasOwn=Object.prototype.hasOwnProperty,
aps=[].slice,
jsSuffixRegExp=/\.js$/;
function hasProp(obj, prop){
return hasOwn.call(obj, prop);
}
function normalize(name, baseName){
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
foundI, foundStarMap, starI, i, j, part,
baseParts=baseName&&baseName.split("/"),
map=config.map,
starMap=(map&&map['*'])||{};
if(name&&name.charAt(0)==="."){
if(baseName){
name=name.split('/');
lastIndex=name.length - 1;
if(config.nodeIdCompat&&jsSuffixRegExp.test(name[lastIndex])){
name[lastIndex]=name[lastIndex].replace(jsSuffixRegExp, '');
}
name=baseParts.slice(0, baseParts.length - 1).concat(name);
for (i=0; i < name.length; i +=1){
part=name[i];
if(part==="."){
name.splice(i, 1);
i -=1;
}else if(part===".."){
if(i===1&&(name[2]==='..'||name[0]==='..')){
break;
}else if(i > 0){
name.splice(i - 1, 2);
i -=2;
}}
}
name=name.join("/");
}else if(name.indexOf('./')===0){
name=name.substring(2);
}}
if((baseParts||starMap)&&map){
nameParts=name.split('/');
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=map[baseParts.slice(0, j).join('/')];
if(mapValue){
mapValue=mapValue[nameSegment];
if(mapValue){
foundMap=mapValue;
foundI=i;
break;
}}
}}
if(foundMap){
break;
}
if(!foundStarMap&&starMap&&starMap[nameSegment]){
foundStarMap=starMap[nameSegment];
starI=i;
}}
if(!foundMap&&foundStarMap){
foundMap=foundStarMap;
foundI=starI;
}
if(foundMap){
nameParts.splice(0, foundI, foundMap);
name=nameParts.join('/');
}}
return name;
}
function makeRequire(relName, forceSync){
return function (){
var args=aps.call(arguments, 0);
if(typeof args[0]!=='string'&&args.length===1){
args.push(null);
}
return req.apply(undef, args.concat([relName, forceSync]));
};}
function makeNormalize(relName){
return function (name){
return normalize(name, relName);
};}
function makeLoad(depName){
return function (value){
defined[depName]=value;
};}
function callDep(name){
if(hasProp(waiting, name)){
var args=waiting[name];
delete waiting[name];
defining[name]=true;
main.apply(undef, args);
}
if(!hasProp(defined, name)&&!hasProp(defining, name)){
throw new Error('No ' + name);
}
return defined[name];
}
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];
}
makeMap=function (name, relName){
var plugin,
parts=splitPrefix(name),
prefix=parts[0];
name=parts[1];
if(prefix){
prefix=normalize(prefix, relName);
plugin=callDep(prefix);
}
if(prefix){
if(plugin&&plugin.normalize){
name=plugin.normalize(name, makeNormalize(relName));
}else{
name=normalize(name, relName);
}}else{
name=normalize(name, relName);
parts=splitPrefix(name);
prefix=parts[0];
name=parts[1];
if(prefix){
plugin=callDep(prefix);
}}
return {
f: prefix ? prefix + '!' + name:name,
n: name,
pr: prefix,
p: plugin
};};
function makeConfig(name){
return function (){
return (config&&config.config&&config.config[name])||{};};
}
handlers={
require: function (name){
return makeRequire(name);
},
exports: function (name){
var e=defined[name];
if(typeof e!=='undefined'){
return e;
}else{
return (defined[name]={});
}},
module: function (name){
return {
id: name,
uri: '',
exports: defined[name],
config: makeConfig(name)
};}};
main=function (name, deps, callback, relName){
var cjsModule, depName, ret, map, i,
args=[],
callbackType=typeof callback,
usingExports;
relName=relName||name;
if(callbackType==='undefined'||callbackType==='function'){
deps = !deps.length&&callback.length ? ['require', 'exports', 'module']:deps;
for (i=0; i < deps.length; i +=1){
map=makeMap(deps[i], relName);
depName=map.f;
if(depName==="require"){
args[i]=handlers.require(name);
}else if(depName==="exports"){
args[i]=handlers.exports(name);
usingExports=true;
}else if(depName==="module"){
cjsModule=args[i]=handlers.module(name);
}else if(hasProp(defined, depName) ||
hasProp(waiting, depName) ||
hasProp(defining, depName)){
args[i]=callDep(depName);
}else if(map.p){
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
args[i]=defined[depName];
}else{
throw new Error(name + ' missing ' + depName);
}}
ret=callback ? callback.apply(defined[name], args):undefined;
if(name){
if(cjsModule&&cjsModule.exports!==undef &&
cjsModule.exports!==defined[name]){
defined[name]=cjsModule.exports;
}else if(ret!==undef||!usingExports){
defined[name]=ret;
}}
}else if(name){
defined[name]=callback;
}};
requirejs=require=req=function (deps, callback, relName, forceSync, alt){
if(typeof deps==="string"){
if(handlers[deps]){
return handlers[deps](callback);
}
return callDep(makeMap(deps, callback).f);
}else if(!deps.splice){
config=deps;
if(config.deps){
req(config.deps, config.callback);
}
if(!callback){
return;
}
if(callback.splice){
deps=callback;
callback=relName;
relName=null;
}else{
deps=undef;
}}
callback=callback||function (){};
if(typeof relName==='function'){
relName=forceSync;
forceSync=alt;
}
if(forceSync){
main(undef, deps, callback, relName);
}else{
setTimeout(function (){
main(undef, deps, callback, relName);
}, 4);
}
return req;
};
req.config=function (cfg){
return req(cfg);
};
requirejs._defined=defined;
define=function (name, deps, callback){
if(typeof name!=='string'){
throw new Error('See almond README: incorrect module build, no module name');
}
if(!deps.splice){
callback=deps;
deps=[];
}
if(!hasProp(defined, name)&&!hasProp(waiting, name)){
waiting[name]=[name, deps, callback];
}};
define.amd={
jQuery: true
};}());
S2.requirejs=requirejs;S2.require=require;S2.define=define;
}}());
S2.define("almond", function(){});
S2.define('jquery',[],function (){
var _$=jQuery||$;
if(_$==null&&console&&console.error){
console.error('Select2: An instance of jQuery or a jQuery-compatible library was not ' +
'found. Make sure that you are including jQuery before Select2 on your ' +
'web page.'
);
}
return _$;
});
S2.define('select2/utils',[
'jquery'
], function ($){
var Utils={};
Utils.Extend=function (ChildClass, SuperClass){
var __hasProp={}.hasOwnProperty;
function BaseConstructor (){
this.constructor=ChildClass;
}
for (var key in SuperClass){
if(__hasProp.call(SuperClass, key)){
ChildClass[key]=SuperClass[key];
}}
BaseConstructor.prototype=SuperClass.prototype;
ChildClass.prototype=new BaseConstructor();
ChildClass.__super__=SuperClass.prototype;
return ChildClass;
};
function getMethods (theClass){
var proto=theClass.prototype;
var methods=[];
for (var methodName in proto){
var m=proto[methodName];
if(typeof m!=='function'){
continue;
}
if(methodName==='constructor'){
continue;
}
methods.push(methodName);
}
return methods;
}
Utils.Decorate=function (SuperClass, DecoratorClass){
var decoratedMethods=getMethods(DecoratorClass);
var superMethods=getMethods(SuperClass);
function DecoratedClass (){
var unshift=Array.prototype.unshift;
var argCount=DecoratorClass.prototype.constructor.length;
var calledConstructor=SuperClass.prototype.constructor;
if(argCount > 0){
unshift.call(arguments, SuperClass.prototype.constructor);
calledConstructor=DecoratorClass.prototype.constructor;
}
calledConstructor.apply(this, arguments);
}
DecoratorClass.displayName=SuperClass.displayName;
function ctr (){
this.constructor=DecoratedClass;
}
DecoratedClass.prototype=new ctr();
for (var m=0; m < superMethods.length; m++){
var superMethod=superMethods[m];
DecoratedClass.prototype[superMethod] =
SuperClass.prototype[superMethod];
}
var calledMethod=function (methodName){
var originalMethod=function (){};
if(methodName in DecoratedClass.prototype){
originalMethod=DecoratedClass.prototype[methodName];
}
var decoratedMethod=DecoratorClass.prototype[methodName];
return function (){
var unshift=Array.prototype.unshift;
unshift.call(arguments, originalMethod);
return decoratedMethod.apply(this, arguments);
};};
for (var d=0; d < decoratedMethods.length; d++){
var decoratedMethod=decoratedMethods[d];
DecoratedClass.prototype[decoratedMethod]=calledMethod(decoratedMethod);
}
return DecoratedClass;
};
var Observable=function (){
this.listeners={};};
Observable.prototype.on=function (event, callback){
this.listeners=this.listeners||{};
if(event in this.listeners){
this.listeners[event].push(callback);
}else{
this.listeners[event]=[callback];
}};
Observable.prototype.trigger=function (event){
var slice=Array.prototype.slice;
var params=slice.call(arguments, 1);
this.listeners=this.listeners||{};
if(params==null){
params=[];
}
if(params.length===0){
params.push({});
}
params[0]._type=event;
if(event in this.listeners){
this.invoke(this.listeners[event], slice.call(arguments, 1));
}
if('*' in this.listeners){
this.invoke(this.listeners['*'], arguments);
}};
Observable.prototype.invoke=function (listeners, params){
for (var i=0, len=listeners.length; i < len; i++){
listeners[i].apply(this, params);
}};
Utils.Observable=Observable;
Utils.generateChars=function (length){
var chars='';
for (var i=0; i < length; i++){
var randomChar=Math.floor(Math.random() * 36);
chars +=randomChar.toString(36);
}
return chars;
};
Utils.bind=function (func, context){
return function (){
func.apply(context, arguments);
};};
Utils._convertData=function (data){
for (var originalKey in data){
var keys=originalKey.split('-');
var dataLevel=data;
if(keys.length===1){
continue;
}
for (var k=0; k < keys.length; k++){
var key=keys[k];
key=key.substring(0, 1).toLowerCase() + key.substring(1);
if(!(key in dataLevel)){
dataLevel[key]={};}
if(k==keys.length - 1){
dataLevel[key]=data[originalKey];
}
dataLevel=dataLevel[key];
}
delete data[originalKey];
}
return data;
};
Utils.hasScroll=function (index, el){
var $el=$(el);
var overflowX=el.style.overflowX;
var overflowY=el.style.overflowY;
if(overflowX===overflowY &&
(overflowY==='hidden'||overflowY==='visible')){
return false;
}
if(overflowX==='scroll'||overflowY==='scroll'){
return true;
}
return ($el.innerHeight() < el.scrollHeight ||
$el.innerWidth() < el.scrollWidth);
};
Utils.escapeMarkup=function (markup){
var replaceMap={
'\\': '&#92;',
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#39;',
'/': '&#47;'
};
if(typeof markup!=='string'){
return markup;
}
return String(markup).replace(/[&<>"'\/\\]/g, function (match){
return replaceMap[match];
});
};
Utils.appendMany=function ($element, $nodes){
if($.fn.jquery.substr(0, 3)==='1.7'){
var $jqNodes=$();
$.map($nodes, function (node){
$jqNodes=$jqNodes.add(node);
});
$nodes=$jqNodes;
}
$element.append($nodes);
};
return Utils;
});
S2.define('select2/results',[
'jquery',
'./utils'
], function ($, Utils){
function Results ($element, options, dataAdapter){
this.$element=$element;
this.data=dataAdapter;
this.options=options;
Results.__super__.constructor.call(this);
}
Utils.Extend(Results, Utils.Observable);
Results.prototype.render=function (){
var $results=$(
'<ul class="select2-results__options" role="tree"></ul>'
);
if(this.options.get('multiple')){
$results.attr('aria-multiselectable', 'true');
}
this.$results=$results;
return $results;
};
Results.prototype.clear=function (){
this.$results.empty();
};
Results.prototype.displayMessage=function (params){
var escapeMarkup=this.options.get('escapeMarkup');
this.clear();
this.hideLoading();
var $message=$(
'<li role="treeitem" aria-live="assertive"' +
' class="select2-results__option"></li>'
);
var message=this.options.get('translations').get(params.message);
$message.append(escapeMarkup(
message(params.args)
)
);
$message[0].className +=' select2-results__message';
this.$results.append($message);
};
Results.prototype.hideMessages=function (){
this.$results.find('.select2-results__message').remove();
};
Results.prototype.append=function (data){
this.hideLoading();
var $options=[];
if(data.results==null||data.results.length===0){
if(this.$results.children().length===0){
this.trigger('results:message', {
message: 'noResults'
});
}
return;
}
data.results=this.sort(data.results);
for (var d=0; d < data.results.length; d++){
var item=data.results[d];
var $option=this.option(item);
$options.push($option);
}
this.$results.append($options);
};
Results.prototype.position=function ($results, $dropdown){
var $resultsContainer=$dropdown.find('.select2-results');
$resultsContainer.append($results);
};
Results.prototype.sort=function (data){
var sorter=this.options.get('sorter');
return sorter(data);
};
Results.prototype.highlightFirstItem=function (){
var $options=this.$results
.find('.select2-results__option[aria-selected]');
var $selected=$options.filter('[aria-selected=true]');
if($selected.length > 0){
$selected.first().trigger('mouseenter');
}else{
$options.first().trigger('mouseenter');
}
this.ensureHighlightVisible();
};
Results.prototype.setClasses=function (){
var self=this;
this.data.current(function (selected){
var selectedIds=$.map(selected, function (s){
return s.id.toString();
});
var $options=self.$results
.find('.select2-results__option[aria-selected]');
$options.each(function (){
var $option=$(this);
var item=$.data(this, 'data');
var id='' + item.id;
if((item.element!=null&&item.element.selected) ||
(item.element==null&&$.inArray(id, selectedIds) > -1)){
$option.attr('aria-selected', 'true');
}else{
$option.attr('aria-selected', 'false');
}});
});
};
Results.prototype.showLoading=function (params){
this.hideLoading();
var loadingMore=this.options.get('translations').get('searching');
var loading={
disabled: true,
loading: true,
text: loadingMore(params)
};
var $loading=this.option(loading);
$loading.className +=' loading-results';
this.$results.prepend($loading);
};
Results.prototype.hideLoading=function (){
this.$results.find('.loading-results').remove();
};
Results.prototype.option=function (data){
var option=document.createElement('li');
option.className='select2-results__option';
var attrs={
'role': 'treeitem',
'aria-selected': 'false'
};
if(data.disabled){
delete attrs['aria-selected'];
attrs['aria-disabled']='true';
}
if(data.id==null){
delete attrs['aria-selected'];
}
if(data._resultId!=null){
option.id=data._resultId;
}
if(data.title){
option.title=data.title;
}
if(data.children){
attrs.role='group';
attrs['aria-label']=data.text;
delete attrs['aria-selected'];
}
for (var attr in attrs){
var val=attrs[attr];
option.setAttribute(attr, val);
}
if(data.children){
var $option=$(option);
var label=document.createElement('strong');
label.className='select2-results__group';
var $label=$(label);
this.template(data, label);
var $children=[];
for (var c=0; c < data.children.length; c++){
var child=data.children[c];
var $child=this.option(child);
$children.push($child);
}
var $childrenContainer=$('<ul></ul>', {
'class': 'select2-results__options select2-results__options--nested'
});
$childrenContainer.append($children);
$option.append(label);
$option.append($childrenContainer);
}else{
this.template(data, option);
}
$.data(option, 'data', data);
return option;
};
Results.prototype.bind=function (container, $container){
var self=this;
var id=container.id + '-results';
this.$results.attr('id', id);
container.on('results:all', function (params){
self.clear();
self.append(params.data);
if(container.isOpen()){
self.setClasses();
self.highlightFirstItem();
}});
container.on('results:append', function (params){
self.append(params.data);
if(container.isOpen()){
self.setClasses();
}});
container.on('query', function (params){
self.hideMessages();
self.showLoading(params);
});
container.on('select', function (){
if(!container.isOpen()){
return;
}
self.setClasses();
self.highlightFirstItem();
});
container.on('unselect', function (){
if(!container.isOpen()){
return;
}
self.setClasses();
self.highlightFirstItem();
});
container.on('open', function (){
self.$results.attr('aria-expanded', 'true');
self.$results.attr('aria-hidden', 'false');
self.setClasses();
self.ensureHighlightVisible();
});
container.on('close', function (){
self.$results.attr('aria-expanded', 'false');
self.$results.attr('aria-hidden', 'true');
self.$results.removeAttr('aria-activedescendant');
});
container.on('results:toggle', function (){
var $highlighted=self.getHighlightedResults();
if($highlighted.length===0){
return;
}
$highlighted.trigger('mouseup');
});
container.on('results:select', function (){
var $highlighted=self.getHighlightedResults();
if($highlighted.length===0){
return;
}
var data=$highlighted.data('data');
if($highlighted.attr('aria-selected')=='true'){
self.trigger('close', {});
}else{
self.trigger('select', {
data: data
});
}});
container.on('results:previous', function (){
var $highlighted=self.getHighlightedResults();
var $options=self.$results.find('[aria-selected]');
var currentIndex=$options.index($highlighted);
if(currentIndex===0){
return;
}
var nextIndex=currentIndex - 1;
if($highlighted.length===0){
nextIndex=0;
}
var $next=$options.eq(nextIndex);
$next.trigger('mouseenter');
var currentOffset=self.$results.offset().top;
var nextTop=$next.offset().top;
var nextOffset=self.$results.scrollTop() + (nextTop - currentOffset);
if(nextIndex===0){
self.$results.scrollTop(0);
}else if(nextTop - currentOffset < 0){
self.$results.scrollTop(nextOffset);
}});
container.on('results:next', function (){
var $highlighted=self.getHighlightedResults();
var $options=self.$results.find('[aria-selected]');
var currentIndex=$options.index($highlighted);
var nextIndex=currentIndex + 1;
if(nextIndex >=$options.length){
return;
}
var $next=$options.eq(nextIndex);
$next.trigger('mouseenter');
var currentOffset=self.$results.offset().top +
self.$results.outerHeight(false);
var nextBottom=$next.offset().top + $next.outerHeight(false);
var nextOffset=self.$results.scrollTop() + nextBottom - currentOffset;
if(nextIndex===0){
self.$results.scrollTop(0);
}else if(nextBottom > currentOffset){
self.$results.scrollTop(nextOffset);
}});
container.on('results:focus', function (params){
params.element.addClass('select2-results__option--highlighted');
});
container.on('results:message', function (params){
self.displayMessage(params);
});
if($.fn.mousewheel){
this.$results.on('mousewheel', function (e){
var top=self.$results.scrollTop();
var bottom=self.$results.get(0).scrollHeight - top + e.deltaY;
var isAtTop=e.deltaY > 0&&top - e.deltaY <=0;
var isAtBottom=e.deltaY < 0&&bottom <=self.$results.height();
if(isAtTop){
self.$results.scrollTop(0);
e.preventDefault();
e.stopPropagation();
}else if(isAtBottom){
self.$results.scrollTop(self.$results.get(0).scrollHeight - self.$results.height()
);
e.preventDefault();
e.stopPropagation();
}});
}
this.$results.on('mouseup', '.select2-results__option[aria-selected]',
function (evt){
var $this=$(this);
var data=$this.data('data');
if($this.attr('aria-selected')==='true'){
if(self.options.get('multiple')){
self.trigger('unselect', {
originalEvent: evt,
data: data
});
}else{
self.trigger('close', {});
}
return;
}
self.trigger('select', {
originalEvent: evt,
data: data
});
});
this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
function (evt){
var data=$(this).data('data');
self.getHighlightedResults()
.removeClass('select2-results__option--highlighted');
self.trigger('results:focus', {
data: data,
element: $(this)
});
});
};
Results.prototype.getHighlightedResults=function (){
var $highlighted=this.$results
.find('.select2-results__option--highlighted');
return $highlighted;
};
Results.prototype.destroy=function (){
this.$results.remove();
};
Results.prototype.ensureHighlightVisible=function (){
var $highlighted=this.getHighlightedResults();
if($highlighted.length===0){
return;
}
var $options=this.$results.find('[aria-selected]');
var currentIndex=$options.index($highlighted);
var currentOffset=this.$results.offset().top;
var nextTop=$highlighted.offset().top;
var nextOffset=this.$results.scrollTop() + (nextTop - currentOffset);
var offsetDelta=nextTop - currentOffset;
nextOffset -=$highlighted.outerHeight(false) * 2;
if(currentIndex <=2){
this.$results.scrollTop(0);
}else if(offsetDelta > this.$results.outerHeight()||offsetDelta < 0){
this.$results.scrollTop(nextOffset);
}};
Results.prototype.template=function (result, container){
var template=this.options.get('templateResult');
var escapeMarkup=this.options.get('escapeMarkup');
var content=template(result, container);
if(content==null){
container.style.display='none';
}else if(typeof content==='string'){
container.innerHTML=escapeMarkup(content);
}else{
$(container).append(content);
}};
return Results;
});
S2.define('select2/keys',[
], function (){
var KEYS={
BACKSPACE: 8,
TAB: 9,
ENTER: 13,
SHIFT: 16,
CTRL: 17,
ALT: 18,
ESC: 27,
SPACE: 32,
PAGE_UP: 33,
PAGE_DOWN: 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
DELETE: 46
};
return KEYS;
});
S2.define('select2/selection/base',[
'jquery',
'../utils',
'../keys'
], function ($, Utils, KEYS){
function BaseSelection ($element, options){
this.$element=$element;
this.options=options;
BaseSelection.__super__.constructor.call(this);
}
Utils.Extend(BaseSelection, Utils.Observable);
BaseSelection.prototype.render=function (){
var $selection=$(
'<span class="select2-selection" role="combobox" ' +
' aria-haspopup="true" aria-expanded="false">' +
'</span>'
);
this._tabindex=0;
if(this.$element.data('old-tabindex')!=null){
this._tabindex=this.$element.data('old-tabindex');
}else if(this.$element.attr('tabindex')!=null){
this._tabindex=this.$element.attr('tabindex');
}
$selection.attr('title', this.$element.attr('title'));
$selection.attr('tabindex', this._tabindex);
this.$selection=$selection;
return $selection;
};
BaseSelection.prototype.bind=function (container, $container){
var self=this;
var id=container.id + '-container';
var resultsId=container.id + '-results';
this.container=container;
this.$selection.on('focus', function (evt){
self.trigger('focus', evt);
});
this.$selection.on('blur', function (evt){
self._handleBlur(evt);
});
this.$selection.on('keydown', function (evt){
self.trigger('keypress', evt);
if(evt.which===KEYS.SPACE){
evt.preventDefault();
}});
container.on('results:focus', function (params){
self.$selection.attr('aria-activedescendant', params.data._resultId);
});
container.on('selection:update', function (params){
self.update(params.data);
});
container.on('open', function (){
self.$selection.attr('aria-expanded', 'true');
self.$selection.attr('aria-owns', resultsId);
self._attachCloseHandler(container);
});
container.on('close', function (){
self.$selection.attr('aria-expanded', 'false');
self.$selection.removeAttr('aria-activedescendant');
self.$selection.removeAttr('aria-owns');
self.$selection.focus();
self._detachCloseHandler(container);
});
container.on('enable', function (){
self.$selection.attr('tabindex', self._tabindex);
});
container.on('disable', function (){
self.$selection.attr('tabindex', '-1');
});
};
BaseSelection.prototype._handleBlur=function (evt){
var self=this;
window.setTimeout(function (){
if((document.activeElement==self.$selection[0]) ||
($.contains(self.$selection[0], document.activeElement))
){
return;
}
self.trigger('blur', evt);
}, 1);
};
BaseSelection.prototype._attachCloseHandler=function (container){
var self=this;
$(document.body).on('mousedown.select2.' + container.id, function (e){
var $target=$(e.target);
var $select=$target.closest('.select2');
var $all=$('.select2.select2-container--open');
$all.each(function (){
var $this=$(this);
if(this==$select[0]){
return;
}
var $element=$this.data('element');
$element.select2('close');
});
});
};
BaseSelection.prototype._detachCloseHandler=function (container){
$(document.body).off('mousedown.select2.' + container.id);
};
BaseSelection.prototype.position=function ($selection, $container){
var $selectionContainer=$container.find('.selection');
$selectionContainer.append($selection);
};
BaseSelection.prototype.destroy=function (){
this._detachCloseHandler(this.container);
};
BaseSelection.prototype.update=function (data){
throw new Error('The `update` method must be defined in child classes.');
};
return BaseSelection;
});
S2.define('select2/selection/single',[
'jquery',
'./base',
'../utils',
'../keys'
], function ($, BaseSelection, Utils, KEYS){
function SingleSelection (){
SingleSelection.__super__.constructor.apply(this, arguments);
}
Utils.Extend(SingleSelection, BaseSelection);
SingleSelection.prototype.render=function (){
var $selection=SingleSelection.__super__.render.call(this);
$selection.addClass('select2-selection--single');
$selection.html('<span class="select2-selection__rendered"></span>' +
'<span class="select2-selection__arrow" role="presentation">' +
'<b role="presentation"></b>' +
'</span>'
);
return $selection;
};
SingleSelection.prototype.bind=function (container, $container){
var self=this;
SingleSelection.__super__.bind.apply(this, arguments);
var id=container.id + '-container';
this.$selection.find('.select2-selection__rendered').attr('id', id);
this.$selection.attr('aria-labelledby', id);
this.$selection.on('mousedown', function (evt){
if(evt.which!==1){
return;
}
self.trigger('toggle', {
originalEvent: evt
});
});
this.$selection.on('focus', function (evt){
});
this.$selection.on('blur', function (evt){
});
container.on('focus', function (evt){
if(!container.isOpen()){
self.$selection.focus();
}});
container.on('selection:update', function (params){
self.update(params.data);
});
};
SingleSelection.prototype.clear=function (){
this.$selection.find('.select2-selection__rendered').empty();
};
SingleSelection.prototype.display=function (data, container){
var template=this.options.get('templateSelection');
var escapeMarkup=this.options.get('escapeMarkup');
return escapeMarkup(template(data, container));
};
SingleSelection.prototype.selectionContainer=function (){
return $('<span></span>');
};
SingleSelection.prototype.update=function (data){
if(data.length===0){
this.clear();
return;
}
var selection=data[0];
var $rendered=this.$selection.find('.select2-selection__rendered');
var formatted=this.display(selection, $rendered);
$rendered.empty().append(formatted);
$rendered.prop('title', selection.title||selection.text);
};
return SingleSelection;
});
S2.define('select2/selection/multiple',[
'jquery',
'./base',
'../utils'
], function ($, BaseSelection, Utils){
function MultipleSelection ($element, options){
MultipleSelection.__super__.constructor.apply(this, arguments);
}
Utils.Extend(MultipleSelection, BaseSelection);
MultipleSelection.prototype.render=function (){
var $selection=MultipleSelection.__super__.render.call(this);
$selection.addClass('select2-selection--multiple');
$selection.html('<ul class="select2-selection__rendered"></ul>'
);
return $selection;
};
MultipleSelection.prototype.bind=function (container, $container){
var self=this;
MultipleSelection.__super__.bind.apply(this, arguments);
this.$selection.on('click', function (evt){
self.trigger('toggle', {
originalEvent: evt
});
});
this.$selection.on('click',
'.select2-selection__choice__remove',
function (evt){
if(self.options.get('disabled')){
return;
}
var $remove=$(this);
var $selection=$remove.parent();
var data=$selection.data('data');
self.trigger('unselect', {
originalEvent: evt,
data: data
});
}
);
};
MultipleSelection.prototype.clear=function (){
this.$selection.find('.select2-selection__rendered').empty();
};
MultipleSelection.prototype.display=function (data, container){
var template=this.options.get('templateSelection');
var escapeMarkup=this.options.get('escapeMarkup');
return escapeMarkup(template(data, container));
};
MultipleSelection.prototype.selectionContainer=function (){
var $container=$(
'<li class="select2-selection__choice">' +
'<span class="select2-selection__choice__remove" role="presentation">' +
'&times;' +
'</span>' +
'</li>'
);
return $container;
};
MultipleSelection.prototype.update=function (data){
this.clear();
if(data.length===0){
return;
}
var $selections=[];
for (var d=0; d < data.length; d++){
var selection=data[d];
var $selection=this.selectionContainer();
var formatted=this.display(selection, $selection);
$selection.append(formatted);
$selection.prop('title', selection.title||selection.text);
$selection.data('data', selection);
$selections.push($selection);
}
var $rendered=this.$selection.find('.select2-selection__rendered');
Utils.appendMany($rendered, $selections);
};
return MultipleSelection;
});
S2.define('select2/selection/placeholder',[
'../utils'
], function (Utils){
function Placeholder (decorated, $element, options){
this.placeholder=this.normalizePlaceholder(options.get('placeholder'));
decorated.call(this, $element, options);
}
Placeholder.prototype.normalizePlaceholder=function (_, placeholder){
if(typeof placeholder==='string'){
placeholder={
id: '',
text: placeholder
};}
return placeholder;
};
Placeholder.prototype.createPlaceholder=function (decorated, placeholder){
var $placeholder=this.selectionContainer();
$placeholder.html(this.display(placeholder));
$placeholder.addClass('select2-selection__placeholder')
.removeClass('select2-selection__choice');
return $placeholder;
};
Placeholder.prototype.update=function (decorated, data){
var singlePlaceholder=(
data.length==1&&data[0].id!=this.placeholder.id
);
var multipleSelections=data.length > 1;
if(multipleSelections||singlePlaceholder){
return decorated.call(this, data);
}
this.clear();
var $placeholder=this.createPlaceholder(this.placeholder);
this.$selection.find('.select2-selection__rendered').append($placeholder);
};
return Placeholder;
});
S2.define('select2/selection/allowClear',[
'jquery',
'../keys'
], function ($, KEYS){
function AllowClear (){ }
AllowClear.prototype.bind=function (decorated, container, $container){
var self=this;
decorated.call(this, container, $container);
if(this.placeholder==null){
if(this.options.get('debug')&&window.console&&console.error){
console.error('Select2: The `allowClear` option should be used in combination ' +
'with the `placeholder` option.'
);
}}
this.$selection.on('mousedown', '.select2-selection__clear',
function (evt){
self._handleClear(evt);
});
container.on('keypress', function (evt){
self._handleKeyboardClear(evt, container);
});
};
AllowClear.prototype._handleClear=function (_, evt){
if(this.options.get('disabled')){
return;
}
var $clear=this.$selection.find('.select2-selection__clear');
if($clear.length===0){
return;
}
evt.stopPropagation();
var data=$clear.data('data');
for (var d=0; d < data.length; d++){
var unselectData={
data: data[d]
};
this.trigger('unselect', unselectData);
if(unselectData.prevented){
return;
}}
this.$element.val(this.placeholder.id).trigger('change');
this.trigger('toggle', {});
};
AllowClear.prototype._handleKeyboardClear=function (_, evt, container){
if(container.isOpen()){
return;
}
if(evt.which==KEYS.DELETE||evt.which==KEYS.BACKSPACE){
this._handleClear(evt);
}};
AllowClear.prototype.update=function (decorated, data){
decorated.call(this, data);
if(this.$selection.find('.select2-selection__placeholder').length > 0 ||
data.length===0){
return;
}
var $remove=$(
'<span class="select2-selection__clear">' +
'&times;' +
'</span>'
);
$remove.data('data', data);
this.$selection.find('.select2-selection__rendered').prepend($remove);
};
return AllowClear;
});
S2.define('select2/selection/search',[
'jquery',
'../utils',
'../keys'
], function ($, Utils, KEYS){
function Search (decorated, $element, options){
decorated.call(this, $element, options);
}
Search.prototype.render=function (decorated){
var $search=$(
'<li class="select2-search select2-search--inline">' +
'<input class="select2-search__field" type="search" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
'</li>'
);
this.$searchContainer=$search;
this.$search=$search.find('input');
var $rendered=decorated.call(this);
this._transferTabIndex();
return $rendered;
};
Search.prototype.bind=function (decorated, container, $container){
var self=this;
decorated.call(this, container, $container);
container.on('open', function (){
self.$search.trigger('focus');
});
container.on('close', function (){
self.$search.val('');
self.$search.removeAttr('aria-activedescendant');
self.$search.trigger('focus');
});
container.on('enable', function (){
self.$search.prop('disabled', false);
self._transferTabIndex();
});
container.on('disable', function (){
self.$search.prop('disabled', true);
});
container.on('focus', function (evt){
self.$search.trigger('focus');
});
container.on('results:focus', function (params){
self.$search.attr('aria-activedescendant', params.id);
});
this.$selection.on('focusin', '.select2-search--inline', function (evt){
self.trigger('focus', evt);
});
this.$selection.on('focusout', '.select2-search--inline', function (evt){
self._handleBlur(evt);
});
this.$selection.on('keydown', '.select2-search--inline', function (evt){
evt.stopPropagation();
self.trigger('keypress', evt);
self._keyUpPrevented=evt.isDefaultPrevented();
var key=evt.which;
if(key===KEYS.BACKSPACE&&self.$search.val()===''){
var $previousChoice=self.$searchContainer
.prev('.select2-selection__choice');
if($previousChoice.length > 0){
var item=$previousChoice.data('data');
self.searchRemoveChoice(item);
evt.preventDefault();
}}
});
var msie=document.documentMode;
var disableInputEvents=msie&&msie <=11;
this.$selection.on('input.searchcheck',
'.select2-search--inline',
function (evt){
if(disableInputEvents){
self.$selection.off('input.search input.searchcheck');
return;
}
self.$selection.off('keyup.search');
}
);
this.$selection.on('keyup.search input.search',
'.select2-search--inline',
function (evt){
if(disableInputEvents&&evt.type==='input'){
self.$selection.off('input.search input.searchcheck');
return;
}
var key=evt.which;
if(key==KEYS.SHIFT||key==KEYS.CTRL||key==KEYS.ALT){
return;
}
if(key==KEYS.TAB){
return;
}
self.handleSearch(evt);
}
);
};
Search.prototype._transferTabIndex=function (decorated){
this.$search.attr('tabindex', this.$selection.attr('tabindex'));
this.$selection.attr('tabindex', '-1');
};
Search.prototype.createPlaceholder=function (decorated, placeholder){
this.$search.attr('placeholder', placeholder.text);
};
Search.prototype.update=function (decorated, data){
var searchHadFocus=this.$search[0]==document.activeElement;
this.$search.attr('placeholder', '');
decorated.call(this, data);
this.$selection.find('.select2-selection__rendered')
.append(this.$searchContainer);
this.resizeSearch();
if(searchHadFocus){
this.$search.focus();
}};
Search.prototype.handleSearch=function (){
this.resizeSearch();
if(!this._keyUpPrevented){
var input=this.$search.val();
this.trigger('query', {
term: input
});
}
this._keyUpPrevented=false;
};
Search.prototype.searchRemoveChoice=function (decorated, item){
this.trigger('unselect', {
data: item
});
this.$search.val(item.text);
this.handleSearch();
};
Search.prototype.resizeSearch=function (){
this.$search.css('width', '25px');
var width='';
if(this.$search.attr('placeholder')!==''){
width=this.$selection.find('.select2-selection__rendered').innerWidth();
}else{
var minimumWidth=this.$search.val().length + 1;
width=(minimumWidth * 0.75) + 'em';
}
this.$search.css('width', width);
};
return Search;
});
S2.define('select2/selection/eventRelay',[
'jquery'
], function ($){
function EventRelay (){ }
EventRelay.prototype.bind=function (decorated, container, $container){
var self=this;
var relayEvents=[
'open', 'opening',
'close', 'closing',
'select', 'selecting',
'unselect', 'unselecting'
];
var preventableEvents=['opening', 'closing', 'selecting', 'unselecting'];
decorated.call(this, container, $container);
container.on('*', function (name, params){
if($.inArray(name, relayEvents)===-1){
return;
}
params=params||{};
var evt=$.Event('select2:' + name, {
params: params
});
self.$element.trigger(evt);
if($.inArray(name, preventableEvents)===-1){
return;
}
params.prevented=evt.isDefaultPrevented();
});
};
return EventRelay;
});
S2.define('select2/translation',[
'jquery',
'require'
], function ($, require){
function Translation (dict){
this.dict=dict||{};}
Translation.prototype.all=function (){
return this.dict;
};
Translation.prototype.get=function (key){
return this.dict[key];
};
Translation.prototype.extend=function (translation){
this.dict=$.extend({}, translation.all(), this.dict);
};
Translation._cache={};
Translation.loadPath=function (path){
if(!(path in Translation._cache)){
var translations=require(path);
Translation._cache[path]=translations;
}
return new Translation(Translation._cache[path]);
};
return Translation;
});
S2.define('select2/diacritics',[
], function (){
var diacritics={
'\u24B6': 'A',
'\uFF21': 'A',
'\u00C0': 'A',
'\u00C1': 'A',
'\u00C2': 'A',
'\u1EA6': 'A',
'\u1EA4': 'A',
'\u1EAA': 'A',
'\u1EA8': 'A',
'\u00C3': 'A',
'\u0100': 'A',
'\u0102': 'A',
'\u1EB0': 'A',
'\u1EAE': 'A',
'\u1EB4': 'A',
'\u1EB2': 'A',
'\u0226': 'A',
'\u01E0': 'A',
'\u00C4': 'A',
'\u01DE': 'A',
'\u1EA2': 'A',
'\u00C5': 'A',
'\u01FA': 'A',
'\u01CD': 'A',
'\u0200': 'A',
'\u0202': 'A',
'\u1EA0': 'A',
'\u1EAC': 'A',
'\u1EB6': 'A',
'\u1E00': 'A',
'\u0104': 'A',
'\u023A': 'A',
'\u2C6F': 'A',
'\uA732': 'AA',
'\u00C6': 'AE',
'\u01FC': 'AE',
'\u01E2': 'AE',
'\uA734': 'AO',
'\uA736': 'AU',
'\uA738': 'AV',
'\uA73A': 'AV',
'\uA73C': 'AY',
'\u24B7': 'B',
'\uFF22': 'B',
'\u1E02': 'B',
'\u1E04': 'B',
'\u1E06': 'B',
'\u0243': 'B',
'\u0182': 'B',
'\u0181': 'B',
'\u24B8': 'C',
'\uFF23': 'C',
'\u0106': 'C',
'\u0108': 'C',
'\u010A': 'C',
'\u010C': 'C',
'\u00C7': 'C',
'\u1E08': 'C',
'\u0187': 'C',
'\u023B': 'C',
'\uA73E': 'C',
'\u24B9': 'D',
'\uFF24': 'D',
'\u1E0A': 'D',
'\u010E': 'D',
'\u1E0C': 'D',
'\u1E10': 'D',
'\u1E12': 'D',
'\u1E0E': 'D',
'\u0110': 'D',
'\u018B': 'D',
'\u018A': 'D',
'\u0189': 'D',
'\uA779': 'D',
'\u01F1': 'DZ',
'\u01C4': 'DZ',
'\u01F2': 'Dz',
'\u01C5': 'Dz',
'\u24BA': 'E',
'\uFF25': 'E',
'\u00C8': 'E',
'\u00C9': 'E',
'\u00CA': 'E',
'\u1EC0': 'E',
'\u1EBE': 'E',
'\u1EC4': 'E',
'\u1EC2': 'E',
'\u1EBC': 'E',
'\u0112': 'E',
'\u1E14': 'E',
'\u1E16': 'E',
'\u0114': 'E',
'\u0116': 'E',
'\u00CB': 'E',
'\u1EBA': 'E',
'\u011A': 'E',
'\u0204': 'E',
'\u0206': 'E',
'\u1EB8': 'E',
'\u1EC6': 'E',
'\u0228': 'E',
'\u1E1C': 'E',
'\u0118': 'E',
'\u1E18': 'E',
'\u1E1A': 'E',
'\u0190': 'E',
'\u018E': 'E',
'\u24BB': 'F',
'\uFF26': 'F',
'\u1E1E': 'F',
'\u0191': 'F',
'\uA77B': 'F',
'\u24BC': 'G',
'\uFF27': 'G',
'\u01F4': 'G',
'\u011C': 'G',
'\u1E20': 'G',
'\u011E': 'G',
'\u0120': 'G',
'\u01E6': 'G',
'\u0122': 'G',
'\u01E4': 'G',
'\u0193': 'G',
'\uA7A0': 'G',
'\uA77D': 'G',
'\uA77E': 'G',
'\u24BD': 'H',
'\uFF28': 'H',
'\u0124': 'H',
'\u1E22': 'H',
'\u1E26': 'H',
'\u021E': 'H',
'\u1E24': 'H',
'\u1E28': 'H',
'\u1E2A': 'H',
'\u0126': 'H',
'\u2C67': 'H',
'\u2C75': 'H',
'\uA78D': 'H',
'\u24BE': 'I',
'\uFF29': 'I',
'\u00CC': 'I',
'\u00CD': 'I',
'\u00CE': 'I',
'\u0128': 'I',
'\u012A': 'I',
'\u012C': 'I',
'\u0130': 'I',
'\u00CF': 'I',
'\u1E2E': 'I',
'\u1EC8': 'I',
'\u01CF': 'I',
'\u0208': 'I',
'\u020A': 'I',
'\u1ECA': 'I',
'\u012E': 'I',
'\u1E2C': 'I',
'\u0197': 'I',
'\u24BF': 'J',
'\uFF2A': 'J',
'\u0134': 'J',
'\u0248': 'J',
'\u24C0': 'K',
'\uFF2B': 'K',
'\u1E30': 'K',
'\u01E8': 'K',
'\u1E32': 'K',
'\u0136': 'K',
'\u1E34': 'K',
'\u0198': 'K',
'\u2C69': 'K',
'\uA740': 'K',
'\uA742': 'K',
'\uA744': 'K',
'\uA7A2': 'K',
'\u24C1': 'L',
'\uFF2C': 'L',
'\u013F': 'L',
'\u0139': 'L',
'\u013D': 'L',
'\u1E36': 'L',
'\u1E38': 'L',
'\u013B': 'L',
'\u1E3C': 'L',
'\u1E3A': 'L',
'\u0141': 'L',
'\u023D': 'L',
'\u2C62': 'L',
'\u2C60': 'L',
'\uA748': 'L',
'\uA746': 'L',
'\uA780': 'L',
'\u01C7': 'LJ',
'\u01C8': 'Lj',
'\u24C2': 'M',
'\uFF2D': 'M',
'\u1E3E': 'M',
'\u1E40': 'M',
'\u1E42': 'M',
'\u2C6E': 'M',
'\u019C': 'M',
'\u24C3': 'N',
'\uFF2E': 'N',
'\u01F8': 'N',
'\u0143': 'N',
'\u00D1': 'N',
'\u1E44': 'N',
'\u0147': 'N',
'\u1E46': 'N',
'\u0145': 'N',
'\u1E4A': 'N',
'\u1E48': 'N',
'\u0220': 'N',
'\u019D': 'N',
'\uA790': 'N',
'\uA7A4': 'N',
'\u01CA': 'NJ',
'\u01CB': 'Nj',
'\u24C4': 'O',
'\uFF2F': 'O',
'\u00D2': 'O',
'\u00D3': 'O',
'\u00D4': 'O',
'\u1ED2': 'O',
'\u1ED0': 'O',
'\u1ED6': 'O',
'\u1ED4': 'O',
'\u00D5': 'O',
'\u1E4C': 'O',
'\u022C': 'O',
'\u1E4E': 'O',
'\u014C': 'O',
'\u1E50': 'O',
'\u1E52': 'O',
'\u014E': 'O',
'\u022E': 'O',
'\u0230': 'O',
'\u00D6': 'O',
'\u022A': 'O',
'\u1ECE': 'O',
'\u0150': 'O',
'\u01D1': 'O',
'\u020C': 'O',
'\u020E': 'O',
'\u01A0': 'O',
'\u1EDC': 'O',
'\u1EDA': 'O',
'\u1EE0': 'O',
'\u1EDE': 'O',
'\u1EE2': 'O',
'\u1ECC': 'O',
'\u1ED8': 'O',
'\u01EA': 'O',
'\u01EC': 'O',
'\u00D8': 'O',
'\u01FE': 'O',
'\u0186': 'O',
'\u019F': 'O',
'\uA74A': 'O',
'\uA74C': 'O',
'\u01A2': 'OI',
'\uA74E': 'OO',
'\u0222': 'OU',
'\u24C5': 'P',
'\uFF30': 'P',
'\u1E54': 'P',
'\u1E56': 'P',
'\u01A4': 'P',
'\u2C63': 'P',
'\uA750': 'P',
'\uA752': 'P',
'\uA754': 'P',
'\u24C6': 'Q',
'\uFF31': 'Q',
'\uA756': 'Q',
'\uA758': 'Q',
'\u024A': 'Q',
'\u24C7': 'R',
'\uFF32': 'R',
'\u0154': 'R',
'\u1E58': 'R',
'\u0158': 'R',
'\u0210': 'R',
'\u0212': 'R',
'\u1E5A': 'R',
'\u1E5C': 'R',
'\u0156': 'R',
'\u1E5E': 'R',
'\u024C': 'R',
'\u2C64': 'R',
'\uA75A': 'R',
'\uA7A6': 'R',
'\uA782': 'R',
'\u24C8': 'S',
'\uFF33': 'S',
'\u1E9E': 'S',
'\u015A': 'S',
'\u1E64': 'S',
'\u015C': 'S',
'\u1E60': 'S',
'\u0160': 'S',
'\u1E66': 'S',
'\u1E62': 'S',
'\u1E68': 'S',
'\u0218': 'S',
'\u015E': 'S',
'\u2C7E': 'S',
'\uA7A8': 'S',
'\uA784': 'S',
'\u24C9': 'T',
'\uFF34': 'T',
'\u1E6A': 'T',
'\u0164': 'T',
'\u1E6C': 'T',
'\u021A': 'T',
'\u0162': 'T',
'\u1E70': 'T',
'\u1E6E': 'T',
'\u0166': 'T',
'\u01AC': 'T',
'\u01AE': 'T',
'\u023E': 'T',
'\uA786': 'T',
'\uA728': 'TZ',
'\u24CA': 'U',
'\uFF35': 'U',
'\u00D9': 'U',
'\u00DA': 'U',
'\u00DB': 'U',
'\u0168': 'U',
'\u1E78': 'U',
'\u016A': 'U',
'\u1E7A': 'U',
'\u016C': 'U',
'\u00DC': 'U',
'\u01DB': 'U',
'\u01D7': 'U',
'\u01D5': 'U',
'\u01D9': 'U',
'\u1EE6': 'U',
'\u016E': 'U',
'\u0170': 'U',
'\u01D3': 'U',
'\u0214': 'U',
'\u0216': 'U',
'\u01AF': 'U',
'\u1EEA': 'U',
'\u1EE8': 'U',
'\u1EEE': 'U',
'\u1EEC': 'U',
'\u1EF0': 'U',
'\u1EE4': 'U',
'\u1E72': 'U',
'\u0172': 'U',
'\u1E76': 'U',
'\u1E74': 'U',
'\u0244': 'U',
'\u24CB': 'V',
'\uFF36': 'V',
'\u1E7C': 'V',
'\u1E7E': 'V',
'\u01B2': 'V',
'\uA75E': 'V',
'\u0245': 'V',
'\uA760': 'VY',
'\u24CC': 'W',
'\uFF37': 'W',
'\u1E80': 'W',
'\u1E82': 'W',
'\u0174': 'W',
'\u1E86': 'W',
'\u1E84': 'W',
'\u1E88': 'W',
'\u2C72': 'W',
'\u24CD': 'X',
'\uFF38': 'X',
'\u1E8A': 'X',
'\u1E8C': 'X',
'\u24CE': 'Y',
'\uFF39': 'Y',
'\u1EF2': 'Y',
'\u00DD': 'Y',
'\u0176': 'Y',
'\u1EF8': 'Y',
'\u0232': 'Y',
'\u1E8E': 'Y',
'\u0178': 'Y',
'\u1EF6': 'Y',
'\u1EF4': 'Y',
'\u01B3': 'Y',
'\u024E': 'Y',
'\u1EFE': 'Y',
'\u24CF': 'Z',
'\uFF3A': 'Z',
'\u0179': 'Z',
'\u1E90': 'Z',
'\u017B': 'Z',
'\u017D': 'Z',
'\u1E92': 'Z',
'\u1E94': 'Z',
'\u01B5': 'Z',
'\u0224': 'Z',
'\u2C7F': 'Z',
'\u2C6B': 'Z',
'\uA762': 'Z',
'\u24D0': 'a',
'\uFF41': 'a',
'\u1E9A': 'a',
'\u00E0': 'a',
'\u00E1': 'a',
'\u00E2': 'a',
'\u1EA7': 'a',
'\u1EA5': 'a',
'\u1EAB': 'a',
'\u1EA9': 'a',
'\u00E3': 'a',
'\u0101': 'a',
'\u0103': 'a',
'\u1EB1': 'a',
'\u1EAF': 'a',
'\u1EB5': 'a',
'\u1EB3': 'a',
'\u0227': 'a',
'\u01E1': 'a',
'\u00E4': 'a',
'\u01DF': 'a',
'\u1EA3': 'a',
'\u00E5': 'a',
'\u01FB': 'a',
'\u01CE': 'a',
'\u0201': 'a',
'\u0203': 'a',
'\u1EA1': 'a',
'\u1EAD': 'a',
'\u1EB7': 'a',
'\u1E01': 'a',
'\u0105': 'a',
'\u2C65': 'a',
'\u0250': 'a',
'\uA733': 'aa',
'\u00E6': 'ae',
'\u01FD': 'ae',
'\u01E3': 'ae',
'\uA735': 'ao',
'\uA737': 'au',
'\uA739': 'av',
'\uA73B': 'av',
'\uA73D': 'ay',
'\u24D1': 'b',
'\uFF42': 'b',
'\u1E03': 'b',
'\u1E05': 'b',
'\u1E07': 'b',
'\u0180': 'b',
'\u0183': 'b',
'\u0253': 'b',
'\u24D2': 'c',
'\uFF43': 'c',
'\u0107': 'c',
'\u0109': 'c',
'\u010B': 'c',
'\u010D': 'c',
'\u00E7': 'c',
'\u1E09': 'c',
'\u0188': 'c',
'\u023C': 'c',
'\uA73F': 'c',
'\u2184': 'c',
'\u24D3': 'd',
'\uFF44': 'd',
'\u1E0B': 'd',
'\u010F': 'd',
'\u1E0D': 'd',
'\u1E11': 'd',
'\u1E13': 'd',
'\u1E0F': 'd',
'\u0111': 'd',
'\u018C': 'd',
'\u0256': 'd',
'\u0257': 'd',
'\uA77A': 'd',
'\u01F3': 'dz',
'\u01C6': 'dz',
'\u24D4': 'e',
'\uFF45': 'e',
'\u00E8': 'e',
'\u00E9': 'e',
'\u00EA': 'e',
'\u1EC1': 'e',
'\u1EBF': 'e',
'\u1EC5': 'e',
'\u1EC3': 'e',
'\u1EBD': 'e',
'\u0113': 'e',
'\u1E15': 'e',
'\u1E17': 'e',
'\u0115': 'e',
'\u0117': 'e',
'\u00EB': 'e',
'\u1EBB': 'e',
'\u011B': 'e',
'\u0205': 'e',
'\u0207': 'e',
'\u1EB9': 'e',
'\u1EC7': 'e',
'\u0229': 'e',
'\u1E1D': 'e',
'\u0119': 'e',
'\u1E19': 'e',
'\u1E1B': 'e',
'\u0247': 'e',
'\u025B': 'e',
'\u01DD': 'e',
'\u24D5': 'f',
'\uFF46': 'f',
'\u1E1F': 'f',
'\u0192': 'f',
'\uA77C': 'f',
'\u24D6': 'g',
'\uFF47': 'g',
'\u01F5': 'g',
'\u011D': 'g',
'\u1E21': 'g',
'\u011F': 'g',
'\u0121': 'g',
'\u01E7': 'g',
'\u0123': 'g',
'\u01E5': 'g',
'\u0260': 'g',
'\uA7A1': 'g',
'\u1D79': 'g',
'\uA77F': 'g',
'\u24D7': 'h',
'\uFF48': 'h',
'\u0125': 'h',
'\u1E23': 'h',
'\u1E27': 'h',
'\u021F': 'h',
'\u1E25': 'h',
'\u1E29': 'h',
'\u1E2B': 'h',
'\u1E96': 'h',
'\u0127': 'h',
'\u2C68': 'h',
'\u2C76': 'h',
'\u0265': 'h',
'\u0195': 'hv',
'\u24D8': 'i',
'\uFF49': 'i',
'\u00EC': 'i',
'\u00ED': 'i',
'\u00EE': 'i',
'\u0129': 'i',
'\u012B': 'i',
'\u012D': 'i',
'\u00EF': 'i',
'\u1E2F': 'i',
'\u1EC9': 'i',
'\u01D0': 'i',
'\u0209': 'i',
'\u020B': 'i',
'\u1ECB': 'i',
'\u012F': 'i',
'\u1E2D': 'i',
'\u0268': 'i',
'\u0131': 'i',
'\u24D9': 'j',
'\uFF4A': 'j',
'\u0135': 'j',
'\u01F0': 'j',
'\u0249': 'j',
'\u24DA': 'k',
'\uFF4B': 'k',
'\u1E31': 'k',
'\u01E9': 'k',
'\u1E33': 'k',
'\u0137': 'k',
'\u1E35': 'k',
'\u0199': 'k',
'\u2C6A': 'k',
'\uA741': 'k',
'\uA743': 'k',
'\uA745': 'k',
'\uA7A3': 'k',
'\u24DB': 'l',
'\uFF4C': 'l',
'\u0140': 'l',
'\u013A': 'l',
'\u013E': 'l',
'\u1E37': 'l',
'\u1E39': 'l',
'\u013C': 'l',
'\u1E3D': 'l',
'\u1E3B': 'l',
'\u017F': 'l',
'\u0142': 'l',
'\u019A': 'l',
'\u026B': 'l',
'\u2C61': 'l',
'\uA749': 'l',
'\uA781': 'l',
'\uA747': 'l',
'\u01C9': 'lj',
'\u24DC': 'm',
'\uFF4D': 'm',
'\u1E3F': 'm',
'\u1E41': 'm',
'\u1E43': 'm',
'\u0271': 'm',
'\u026F': 'm',
'\u24DD': 'n',
'\uFF4E': 'n',
'\u01F9': 'n',
'\u0144': 'n',
'\u00F1': 'n',
'\u1E45': 'n',
'\u0148': 'n',
'\u1E47': 'n',
'\u0146': 'n',
'\u1E4B': 'n',
'\u1E49': 'n',
'\u019E': 'n',
'\u0272': 'n',
'\u0149': 'n',
'\uA791': 'n',
'\uA7A5': 'n',
'\u01CC': 'nj',
'\u24DE': 'o',
'\uFF4F': 'o',
'\u00F2': 'o',
'\u00F3': 'o',
'\u00F4': 'o',
'\u1ED3': 'o',
'\u1ED1': 'o',
'\u1ED7': 'o',
'\u1ED5': 'o',
'\u00F5': 'o',
'\u1E4D': 'o',
'\u022D': 'o',
'\u1E4F': 'o',
'\u014D': 'o',
'\u1E51': 'o',
'\u1E53': 'o',
'\u014F': 'o',
'\u022F': 'o',
'\u0231': 'o',
'\u00F6': 'o',
'\u022B': 'o',
'\u1ECF': 'o',
'\u0151': 'o',
'\u01D2': 'o',
'\u020D': 'o',
'\u020F': 'o',
'\u01A1': 'o',
'\u1EDD': 'o',
'\u1EDB': 'o',
'\u1EE1': 'o',
'\u1EDF': 'o',
'\u1EE3': 'o',
'\u1ECD': 'o',
'\u1ED9': 'o',
'\u01EB': 'o',
'\u01ED': 'o',
'\u00F8': 'o',
'\u01FF': 'o',
'\u0254': 'o',
'\uA74B': 'o',
'\uA74D': 'o',
'\u0275': 'o',
'\u01A3': 'oi',
'\u0223': 'ou',
'\uA74F': 'oo',
'\u24DF': 'p',
'\uFF50': 'p',
'\u1E55': 'p',
'\u1E57': 'p',
'\u01A5': 'p',
'\u1D7D': 'p',
'\uA751': 'p',
'\uA753': 'p',
'\uA755': 'p',
'\u24E0': 'q',
'\uFF51': 'q',
'\u024B': 'q',
'\uA757': 'q',
'\uA759': 'q',
'\u24E1': 'r',
'\uFF52': 'r',
'\u0155': 'r',
'\u1E59': 'r',
'\u0159': 'r',
'\u0211': 'r',
'\u0213': 'r',
'\u1E5B': 'r',
'\u1E5D': 'r',
'\u0157': 'r',
'\u1E5F': 'r',
'\u024D': 'r',
'\u027D': 'r',
'\uA75B': 'r',
'\uA7A7': 'r',
'\uA783': 'r',
'\u24E2': 's',
'\uFF53': 's',
'\u00DF': 's',
'\u015B': 's',
'\u1E65': 's',
'\u015D': 's',
'\u1E61': 's',
'\u0161': 's',
'\u1E67': 's',
'\u1E63': 's',
'\u1E69': 's',
'\u0219': 's',
'\u015F': 's',
'\u023F': 's',
'\uA7A9': 's',
'\uA785': 's',
'\u1E9B': 's',
'\u24E3': 't',
'\uFF54': 't',
'\u1E6B': 't',
'\u1E97': 't',
'\u0165': 't',
'\u1E6D': 't',
'\u021B': 't',
'\u0163': 't',
'\u1E71': 't',
'\u1E6F': 't',
'\u0167': 't',
'\u01AD': 't',
'\u0288': 't',
'\u2C66': 't',
'\uA787': 't',
'\uA729': 'tz',
'\u24E4': 'u',
'\uFF55': 'u',
'\u00F9': 'u',
'\u00FA': 'u',
'\u00FB': 'u',
'\u0169': 'u',
'\u1E79': 'u',
'\u016B': 'u',
'\u1E7B': 'u',
'\u016D': 'u',
'\u00FC': 'u',
'\u01DC': 'u',
'\u01D8': 'u',
'\u01D6': 'u',
'\u01DA': 'u',
'\u1EE7': 'u',
'\u016F': 'u',
'\u0171': 'u',
'\u01D4': 'u',
'\u0215': 'u',
'\u0217': 'u',
'\u01B0': 'u',
'\u1EEB': 'u',
'\u1EE9': 'u',
'\u1EEF': 'u',
'\u1EED': 'u',
'\u1EF1': 'u',
'\u1EE5': 'u',
'\u1E73': 'u',
'\u0173': 'u',
'\u1E77': 'u',
'\u1E75': 'u',
'\u0289': 'u',
'\u24E5': 'v',
'\uFF56': 'v',
'\u1E7D': 'v',
'\u1E7F': 'v',
'\u028B': 'v',
'\uA75F': 'v',
'\u028C': 'v',
'\uA761': 'vy',
'\u24E6': 'w',
'\uFF57': 'w',
'\u1E81': 'w',
'\u1E83': 'w',
'\u0175': 'w',
'\u1E87': 'w',
'\u1E85': 'w',
'\u1E98': 'w',
'\u1E89': 'w',
'\u2C73': 'w',
'\u24E7': 'x',
'\uFF58': 'x',
'\u1E8B': 'x',
'\u1E8D': 'x',
'\u24E8': 'y',
'\uFF59': 'y',
'\u1EF3': 'y',
'\u00FD': 'y',
'\u0177': 'y',
'\u1EF9': 'y',
'\u0233': 'y',
'\u1E8F': 'y',
'\u00FF': 'y',
'\u1EF7': 'y',
'\u1E99': 'y',
'\u1EF5': 'y',
'\u01B4': 'y',
'\u024F': 'y',
'\u1EFF': 'y',
'\u24E9': 'z',
'\uFF5A': 'z',
'\u017A': 'z',
'\u1E91': 'z',
'\u017C': 'z',
'\u017E': 'z',
'\u1E93': 'z',
'\u1E95': 'z',
'\u01B6': 'z',
'\u0225': 'z',
'\u0240': 'z',
'\u2C6C': 'z',
'\uA763': 'z',
'\u0386': '\u0391',
'\u0388': '\u0395',
'\u0389': '\u0397',
'\u038A': '\u0399',
'\u03AA': '\u0399',
'\u038C': '\u039F',
'\u038E': '\u03A5',
'\u03AB': '\u03A5',
'\u038F': '\u03A9',
'\u03AC': '\u03B1',
'\u03AD': '\u03B5',
'\u03AE': '\u03B7',
'\u03AF': '\u03B9',
'\u03CA': '\u03B9',
'\u0390': '\u03B9',
'\u03CC': '\u03BF',
'\u03CD': '\u03C5',
'\u03CB': '\u03C5',
'\u03B0': '\u03C5',
'\u03C9': '\u03C9',
'\u03C2': '\u03C3'
};
return diacritics;
});
S2.define('select2/data/base',[
'../utils'
], function (Utils){
function BaseAdapter ($element, options){
BaseAdapter.__super__.constructor.call(this);
}
Utils.Extend(BaseAdapter, Utils.Observable);
BaseAdapter.prototype.current=function (callback){
throw new Error('The `current` method must be defined in child classes.');
};
BaseAdapter.prototype.query=function (params, callback){
throw new Error('The `query` method must be defined in child classes.');
};
BaseAdapter.prototype.bind=function (container, $container){
};
BaseAdapter.prototype.destroy=function (){
};
BaseAdapter.prototype.generateResultId=function (container, data){
var id=container.id + '-result-';
id +=Utils.generateChars(4);
if(data.id!=null){
id +='-' + data.id.toString();
}else{
id +='-' + Utils.generateChars(4);
}
return id;
};
return BaseAdapter;
});
S2.define('select2/data/select',[
'./base',
'../utils',
'jquery'
], function (BaseAdapter, Utils, $){
function SelectAdapter ($element, options){
this.$element=$element;
this.options=options;
SelectAdapter.__super__.constructor.call(this);
}
Utils.Extend(SelectAdapter, BaseAdapter);
SelectAdapter.prototype.current=function (callback){
var data=[];
var self=this;
this.$element.find(':selected').each(function (){
var $option=$(this);
var option=self.item($option);
data.push(option);
});
callback(data);
};
SelectAdapter.prototype.select=function (data){
var self=this;
data.selected=true;
if($(data.element).is('option')){
data.element.selected=true;
this.$element.trigger('change');
return;
}
if(this.$element.prop('multiple')){
this.current(function (currentData){
var val=[];
data=[data];
data.push.apply(data, currentData);
for (var d=0; d < data.length; d++){
var id=data[d].id;
if($.inArray(id, val)===-1){
val.push(id);
}}
self.$element.val(val);
self.$element.trigger('change');
});
}else{
var val=data.id;
this.$element.val(val);
this.$element.trigger('change');
}};
SelectAdapter.prototype.unselect=function (data){
var self=this;
if(!this.$element.prop('multiple')){
return;
}
data.selected=false;
if($(data.element).is('option')){
data.element.selected=false;
this.$element.trigger('change');
return;
}
this.current(function (currentData){
var val=[];
for (var d=0; d < currentData.length; d++){
var id=currentData[d].id;
if(id!==data.id&&$.inArray(id, val)===-1){
val.push(id);
}}
self.$element.val(val);
self.$element.trigger('change');
});
};
SelectAdapter.prototype.bind=function (container, $container){
var self=this;
this.container=container;
container.on('select', function (params){
self.select(params.data);
});
container.on('unselect', function (params){
self.unselect(params.data);
});
};
SelectAdapter.prototype.destroy=function (){
this.$element.find('*').each(function (){
$.removeData(this, 'data');
});
};
SelectAdapter.prototype.query=function (params, callback){
var data=[];
var self=this;
var $options=this.$element.children();
$options.each(function (){
var $option=$(this);
if(!$option.is('option')&&!$option.is('optgroup')){
return;
}
var option=self.item($option);
var matches=self.matches(params, option);
if(matches!==null){
data.push(matches);
}});
callback({
results: data
});
};
SelectAdapter.prototype.addOptions=function ($options){
Utils.appendMany(this.$element, $options);
};
SelectAdapter.prototype.option=function (data){
var option;
if(data.children){
option=document.createElement('optgroup');
option.label=data.text;
}else{
option=document.createElement('option');
if(option.textContent!==undefined){
option.textContent=data.text;
}else{
option.innerText=data.text;
}}
if(data.id){
option.value=data.id;
}
if(data.disabled){
option.disabled=true;
}
if(data.selected){
option.selected=true;
}
if(data.title){
option.title=data.title;
}
var $option=$(option);
var normalizedData=this._normalizeItem(data);
normalizedData.element=option;
$.data(option, 'data', normalizedData);
return $option;
};
SelectAdapter.prototype.item=function ($option){
var data={};
data=$.data($option[0], 'data');
if(data!=null){
return data;
}
if($option.is('option')){
data={
id: $option.val(),
text: $option.text(),
disabled: $option.prop('disabled'),
selected: $option.prop('selected'),
title: $option.prop('title')
};}else if($option.is('optgroup')){
data={
text: $option.prop('label'),
children: [],
title: $option.prop('title')
};
var $children=$option.children('option');
var children=[];
for (var c=0; c < $children.length; c++){
var $child=$($children[c]);
var child=this.item($child);
children.push(child);
}
data.children=children;
}
data=this._normalizeItem(data);
data.element=$option[0];
$.data($option[0], 'data', data);
return data;
};
SelectAdapter.prototype._normalizeItem=function (item){
if(!$.isPlainObject(item)){
item={
id: item,
text: item
};}
item=$.extend({}, {
text: ''
}, item);
var defaults={
selected: false,
disabled: false
};
if(item.id!=null){
item.id=item.id.toString();
}
if(item.text!=null){
item.text=item.text.toString();
}
if(item._resultId==null&&item.id&&this.container!=null){
item._resultId=this.generateResultId(this.container, item);
}
return $.extend({}, defaults, item);
};
SelectAdapter.prototype.matches=function (params, data){
var matcher=this.options.get('matcher');
return matcher(params, data);
};
return SelectAdapter;
});
S2.define('select2/data/array',[
'./select',
'../utils',
'jquery'
], function (SelectAdapter, Utils, $){
function ArrayAdapter ($element, options){
var data=options.get('data')||[];
ArrayAdapter.__super__.constructor.call(this, $element, options);
this.addOptions(this.convertToOptions(data));
}
Utils.Extend(ArrayAdapter, SelectAdapter);
ArrayAdapter.prototype.select=function (data){
var $option=this.$element.find('option').filter(function (i, elm){
return elm.value==data.id.toString();
});
if($option.length===0){
$option=this.option(data);
this.addOptions($option);
}
ArrayAdapter.__super__.select.call(this, data);
};
ArrayAdapter.prototype.convertToOptions=function (data){
var self=this;
var $existing=this.$element.find('option');
var existingIds=$existing.map(function (){
return self.item($(this)).id;
}).get();
var $options=[];
function onlyItem (item){
return function (){
return $(this).val()==item.id;
};}
for (var d=0; d < data.length; d++){
var item=this._normalizeItem(data[d]);
if($.inArray(item.id, existingIds) >=0){
var $existingOption=$existing.filter(onlyItem(item));
var existingData=this.item($existingOption);
var newData=$.extend(true, {}, item, existingData);
var $newOption=this.option(newData);
$existingOption.replaceWith($newOption);
continue;
}
var $option=this.option(item);
if(item.children){
var $children=this.convertToOptions(item.children);
Utils.appendMany($option, $children);
}
$options.push($option);
}
return $options;
};
return ArrayAdapter;
});
S2.define('select2/data/ajax',[
'./array',
'../utils',
'jquery'
], function (ArrayAdapter, Utils, $){
function AjaxAdapter ($element, options){
this.ajaxOptions=this._applyDefaults(options.get('ajax'));
if(this.ajaxOptions.processResults!=null){
this.processResults=this.ajaxOptions.processResults;
}
AjaxAdapter.__super__.constructor.call(this, $element, options);
}
Utils.Extend(AjaxAdapter, ArrayAdapter);
AjaxAdapter.prototype._applyDefaults=function (options){
var defaults={
data: function (params){
return $.extend({}, params, {
q: params.term
});
},
transport: function (params, success, failure){
var $request=$.ajax(params);
$request.then(success);
$request.fail(failure);
return $request;
}};
return $.extend({}, defaults, options, true);
};
AjaxAdapter.prototype.processResults=function (results){
return results;
};
AjaxAdapter.prototype.query=function (params, callback){
var matches=[];
var self=this;
if(this._request!=null){
if($.isFunction(this._request.abort)){
this._request.abort();
}
this._request=null;
}
var options=$.extend({
type: 'GET'
}, this.ajaxOptions);
if(typeof options.url==='function'){
options.url=options.url.call(this.$element, params);
}
if(typeof options.data==='function'){
options.data=options.data.call(this.$element, params);
}
function request (){
var $request=options.transport(options, function (data){
var results=self.processResults(data, params);
if(self.options.get('debug')&&window.console&&console.error){
if(!results||!results.results||!$.isArray(results.results)){
console.error('Select2: The AJAX results did not return an array in the ' +
'`results` key of the response.'
);
}}
callback(results);
}, function (){
if($request.status&&$request.status==='0'){
return;
}
self.trigger('results:message', {
message: 'errorLoading'
});
});
self._request=$request;
}
if(this.ajaxOptions.delay&&params.term!=null){
if(this._queryTimeout){
window.clearTimeout(this._queryTimeout);
}
this._queryTimeout=window.setTimeout(request, this.ajaxOptions.delay);
}else{
request();
}};
return AjaxAdapter;
});
S2.define('select2/data/tags',[
'jquery'
], function ($){
function Tags (decorated, $element, options){
var tags=options.get('tags');
var createTag=options.get('createTag');
if(createTag!==undefined){
this.createTag=createTag;
}
var insertTag=options.get('insertTag');
if(insertTag!==undefined){
this.insertTag=insertTag;
}
decorated.call(this, $element, options);
if($.isArray(tags)){
for (var t=0; t < tags.length; t++){
var tag=tags[t];
var item=this._normalizeItem(tag);
var $option=this.option(item);
this.$element.append($option);
}}
}
Tags.prototype.query=function (decorated, params, callback){
var self=this;
this._removeOldTags();
if(params.term==null||params.page!=null){
decorated.call(this, params, callback);
return;
}
function wrapper (obj, child){
var data=obj.results;
for (var i=0; i < data.length; i++){
var option=data[i];
var checkChildren=(
option.children!=null &&
!wrapper({
results: option.children
}, true)
);
var checkText=option.text===params.term;
if(checkText||checkChildren){
if(child){
return false;
}
obj.data=data;
callback(obj);
return;
}}
if(child){
return true;
}
var tag=self.createTag(params);
if(tag!=null){
var $option=self.option(tag);
$option.attr('data-select2-tag', true);
self.addOptions([$option]);
self.insertTag(data, tag);
}
obj.results=data;
callback(obj);
}
decorated.call(this, params, wrapper);
};
Tags.prototype.createTag=function (decorated, params){
var term=$.trim(params.term);
if(term===''){
return null;
}
return {
id: term,
text: term
};};
Tags.prototype.insertTag=function (_, data, tag){
data.unshift(tag);
};
Tags.prototype._removeOldTags=function (_){
var tag=this._lastTag;
var $options=this.$element.find('option[data-select2-tag]');
$options.each(function (){
if(this.selected){
return;
}
$(this).remove();
});
};
return Tags;
});
S2.define('select2/data/tokenizer',[
'jquery'
], function ($){
function Tokenizer (decorated, $element, options){
var tokenizer=options.get('tokenizer');
if(tokenizer!==undefined){
this.tokenizer=tokenizer;
}
decorated.call(this, $element, options);
}
Tokenizer.prototype.bind=function (decorated, container, $container){
decorated.call(this, container, $container);
this.$search=container.dropdown.$search||container.selection.$search ||
$container.find('.select2-search__field');
};
Tokenizer.prototype.query=function (decorated, params, callback){
var self=this;
function createAndSelect (data){
var item=self._normalizeItem(data);
var $existingOptions=self.$element.find('option').filter(function (){
return $(this).val()===item.id;
});
if(!$existingOptions.length){
var $option=self.option(item);
$option.attr('data-select2-tag', true);
self._removeOldTags();
self.addOptions([$option]);
}
select(item);
}
function select (data){
self.trigger('select', {
data: data
});
}
params.term=params.term||'';
var tokenData=this.tokenizer(params, this.options, createAndSelect);
if(tokenData.term!==params.term){
if(this.$search.length){
this.$search.val(tokenData.term);
this.$search.focus();
}
params.term=tokenData.term;
}
decorated.call(this, params, callback);
};
Tokenizer.prototype.tokenizer=function (_, params, options, callback){
var separators=options.get('tokenSeparators')||[];
var term=params.term;
var i=0;
var createTag=this.createTag||function (params){
return {
id: params.term,
text: params.term
};};
while (i < term.length){
var termChar=term[i];
if($.inArray(termChar, separators)===-1){
i++;
continue;
}
var part=term.substr(0, i);
var partParams=$.extend({}, params, {
term: part
});
var data=createTag(partParams);
if(data==null){
i++;
continue;
}
callback(data);
term=term.substr(i + 1)||'';
i=0;
}
return {
term: term
};};
return Tokenizer;
});
S2.define('select2/data/minimumInputLength',[
], function (){
function MinimumInputLength (decorated, $e, options){
this.minimumInputLength=options.get('minimumInputLength');
decorated.call(this, $e, options);
}
MinimumInputLength.prototype.query=function (decorated, params, callback){
params.term=params.term||'';
if(params.term.length < this.minimumInputLength){
this.trigger('results:message', {
message: 'inputTooShort',
args: {
minimum: this.minimumInputLength,
input: params.term,
params: params
}});
return;
}
decorated.call(this, params, callback);
};
return MinimumInputLength;
});
S2.define('select2/data/maximumInputLength',[
], function (){
function MaximumInputLength (decorated, $e, options){
this.maximumInputLength=options.get('maximumInputLength');
decorated.call(this, $e, options);
}
MaximumInputLength.prototype.query=function (decorated, params, callback){
params.term=params.term||'';
if(this.maximumInputLength > 0 &&
params.term.length > this.maximumInputLength){
this.trigger('results:message', {
message: 'inputTooLong',
args: {
maximum: this.maximumInputLength,
input: params.term,
params: params
}});
return;
}
decorated.call(this, params, callback);
};
return MaximumInputLength;
});
S2.define('select2/data/maximumSelectionLength',[
], function (){
function MaximumSelectionLength (decorated, $e, options){
this.maximumSelectionLength=options.get('maximumSelectionLength');
decorated.call(this, $e, options);
}
MaximumSelectionLength.prototype.query =
function (decorated, params, callback){
var self=this;
this.current(function (currentData){
var count=currentData!=null ? currentData.length:0;
if(self.maximumSelectionLength > 0 &&
count >=self.maximumSelectionLength){
self.trigger('results:message', {
message: 'maximumSelected',
args: {
maximum: self.maximumSelectionLength
}});
return;
}
decorated.call(self, params, callback);
});
};
return MaximumSelectionLength;
});
S2.define('select2/dropdown',[
'jquery',
'./utils'
], function ($, Utils){
function Dropdown ($element, options){
this.$element=$element;
this.options=options;
Dropdown.__super__.constructor.call(this);
}
Utils.Extend(Dropdown, Utils.Observable);
Dropdown.prototype.render=function (){
var $dropdown=$(
'<span class="select2-dropdown">' +
'<span class="select2-results"></span>' +
'</span>'
);
$dropdown.attr('dir', this.options.get('dir'));
this.$dropdown=$dropdown;
return $dropdown;
};
Dropdown.prototype.bind=function (){
};
Dropdown.prototype.position=function ($dropdown, $container){
};
Dropdown.prototype.destroy=function (){
this.$dropdown.remove();
};
return Dropdown;
});
S2.define('select2/dropdown/search',[
'jquery',
'../utils'
], function ($, Utils){
function Search (){ }
Search.prototype.render=function (decorated){
var $rendered=decorated.call(this);
var $search=$(
'<span class="select2-search select2-search--dropdown">' +
'<input class="select2-search__field" type="search" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
' spellcheck="false" role="textbox" />' +
'</span>'
);
this.$searchContainer=$search;
this.$search=$search.find('input');
$rendered.prepend($search);
return $rendered;
};
Search.prototype.bind=function (decorated, container, $container){
var self=this;
decorated.call(this, container, $container);
this.$search.on('keydown', function (evt){
self.trigger('keypress', evt);
self._keyUpPrevented=evt.isDefaultPrevented();
});
this.$search.on('input', function (evt){
$(this).off('keyup');
});
this.$search.on('keyup input', function (evt){
self.handleSearch(evt);
});
container.on('open', function (){
self.$search.attr('tabindex', 0);
self.$search.focus();
window.setTimeout(function (){
self.$search.focus();
}, 0);
});
container.on('close', function (){
self.$search.attr('tabindex', -1);
self.$search.val('');
});
container.on('focus', function (){
if(container.isOpen()){
self.$search.focus();
}});
container.on('results:all', function (params){
if(params.query.term==null||params.query.term===''){
var showSearch=self.showSearch(params);
if(showSearch){
self.$searchContainer.removeClass('select2-search--hide');
}else{
self.$searchContainer.addClass('select2-search--hide');
}}
});
};
Search.prototype.handleSearch=function (evt){
if(!this._keyUpPrevented){
var input=this.$search.val();
this.trigger('query', {
term: input
});
}
this._keyUpPrevented=false;
};
Search.prototype.showSearch=function (_, params){
return true;
};
return Search;
});
S2.define('select2/dropdown/hidePlaceholder',[
], function (){
function HidePlaceholder (decorated, $element, options, dataAdapter){
this.placeholder=this.normalizePlaceholder(options.get('placeholder'));
decorated.call(this, $element, options, dataAdapter);
}
HidePlaceholder.prototype.append=function (decorated, data){
data.results=this.removePlaceholder(data.results);
decorated.call(this, data);
};
HidePlaceholder.prototype.normalizePlaceholder=function (_, placeholder){
if(typeof placeholder==='string'){
placeholder={
id: '',
text: placeholder
};}
return placeholder;
};
HidePlaceholder.prototype.removePlaceholder=function (_, data){
var modifiedData=data.slice(0);
for (var d=data.length - 1; d >=0; d--){
var item=data[d];
if(this.placeholder.id===item.id){
modifiedData.splice(d, 1);
}}
return modifiedData;
};
return HidePlaceholder;
});
S2.define('select2/dropdown/infiniteScroll',[
'jquery'
], function ($){
function InfiniteScroll (decorated, $element, options, dataAdapter){
this.lastParams={};
decorated.call(this, $element, options, dataAdapter);
this.$loadingMore=this.createLoadingMore();
this.loading=false;
}
InfiniteScroll.prototype.append=function (decorated, data){
this.$loadingMore.remove();
this.loading=false;
decorated.call(this, data);
if(this.showLoadingMore(data)){
this.$results.append(this.$loadingMore);
}};
InfiniteScroll.prototype.bind=function (decorated, container, $container){
var self=this;
decorated.call(this, container, $container);
container.on('query', function (params){
self.lastParams=params;
self.loading=true;
});
container.on('query:append', function (params){
self.lastParams=params;
self.loading=true;
});
this.$results.on('scroll', function (){
var isLoadMoreVisible=$.contains(document.documentElement,
self.$loadingMore[0]
);
if(self.loading||!isLoadMoreVisible){
return;
}
var currentOffset=self.$results.offset().top +
self.$results.outerHeight(false);
var loadingMoreOffset=self.$loadingMore.offset().top +
self.$loadingMore.outerHeight(false);
if(currentOffset + 50 >=loadingMoreOffset){
self.loadMore();
}});
};
InfiniteScroll.prototype.loadMore=function (){
this.loading=true;
var params=$.extend({}, {page: 1}, this.lastParams);
params.page++;
this.trigger('query:append', params);
};
InfiniteScroll.prototype.showLoadingMore=function (_, data){
return data.pagination&&data.pagination.more;
};
InfiniteScroll.prototype.createLoadingMore=function (){
var $option=$(
'<li ' +
'class="select2-results__option select2-results__option--load-more"' +
'role="treeitem" aria-disabled="true"></li>'
);
var message=this.options.get('translations').get('loadingMore');
$option.html(message(this.lastParams));
return $option;
};
return InfiniteScroll;
});
S2.define('select2/dropdown/attachBody',[
'jquery',
'../utils'
], function ($, Utils){
function AttachBody (decorated, $element, options){
this.$dropdownParent=options.get('dropdownParent')||$(document.body);
decorated.call(this, $element, options);
}
AttachBody.prototype.bind=function (decorated, container, $container){
var self=this;
var setupResultsEvents=false;
decorated.call(this, container, $container);
container.on('open', function (){
self._showDropdown();
self._attachPositioningHandler(container);
if(!setupResultsEvents){
setupResultsEvents=true;
container.on('results:all', function (){
self._positionDropdown();
self._resizeDropdown();
});
container.on('results:append', function (){
self._positionDropdown();
self._resizeDropdown();
});
}});
container.on('close', function (){
self._hideDropdown();
self._detachPositioningHandler(container);
});
this.$dropdownContainer.on('mousedown', function (evt){
evt.stopPropagation();
});
};
AttachBody.prototype.destroy=function (decorated){
decorated.call(this);
this.$dropdownContainer.remove();
};
AttachBody.prototype.position=function (decorated, $dropdown, $container){
$dropdown.attr('class', $container.attr('class'));
$dropdown.removeClass('select2');
$dropdown.addClass('select2-container--open');
$dropdown.css({
position: 'absolute',
top: -999999
});
this.$container=$container;
};
AttachBody.prototype.render=function (decorated){
var $container=$('<span></span>');
var $dropdown=decorated.call(this);
$container.append($dropdown);
this.$dropdownContainer=$container;
return $container;
};
AttachBody.prototype._hideDropdown=function (decorated){
this.$dropdownContainer.detach();
};
AttachBody.prototype._attachPositioningHandler =
function (decorated, container){
var self=this;
var scrollEvent='scroll.select2.' + container.id;
var resizeEvent='resize.select2.' + container.id;
var orientationEvent='orientationchange.select2.' + container.id;
var $watchers=this.$container.parents().filter(Utils.hasScroll);
$watchers.each(function (){
$(this).data('select2-scroll-position', {
x: $(this).scrollLeft(),
y: $(this).scrollTop()
});
});
$watchers.on(scrollEvent, function (ev){
var position=$(this).data('select2-scroll-position');
$(this).scrollTop(position.y);
});
$(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
function (e){
self._positionDropdown();
self._resizeDropdown();
});
};
AttachBody.prototype._detachPositioningHandler =
function (decorated, container){
var scrollEvent='scroll.select2.' + container.id;
var resizeEvent='resize.select2.' + container.id;
var orientationEvent='orientationchange.select2.' + container.id;
var $watchers=this.$container.parents().filter(Utils.hasScroll);
$watchers.off(scrollEvent);
$(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
};
AttachBody.prototype._positionDropdown=function (){
var $window=$(window);
var isCurrentlyAbove=this.$dropdown.hasClass('select2-dropdown--above');
var isCurrentlyBelow=this.$dropdown.hasClass('select2-dropdown--below');
var newDirection=null;
var offset=this.$container.offset();
offset.bottom=offset.top + this.$container.outerHeight(false);
var container={
height: this.$container.outerHeight(false)
};
container.top=offset.top;
container.bottom=offset.top + container.height;
var dropdown={
height: this.$dropdown.outerHeight(false)
};
var viewport={
top: $window.scrollTop(),
bottom: $window.scrollTop() + $window.height()
};
var enoughRoomAbove=viewport.top < (offset.top - dropdown.height);
var enoughRoomBelow=viewport.bottom > (offset.bottom + dropdown.height);
var css={
left: offset.left,
top: container.bottom
};
var $offsetParent=this.$dropdownParent;
if($offsetParent.css('position')==='static'){
$offsetParent=$offsetParent.offsetParent();
}
var parentOffset=$offsetParent.offset();
css.top -=parentOffset.top;
css.left -=parentOffset.left;
if(!isCurrentlyAbove&&!isCurrentlyBelow){
newDirection='below';
}
if(!enoughRoomBelow&&enoughRoomAbove&&!isCurrentlyAbove){
newDirection='above';
}else if(!enoughRoomAbove&&enoughRoomBelow&&isCurrentlyAbove){
newDirection='below';
}
if(newDirection=='above' ||
(isCurrentlyAbove&&newDirection!=='below')){
css.top=container.top - parentOffset.top - dropdown.height;
}
if(newDirection!=null){
this.$dropdown
.removeClass('select2-dropdown--below select2-dropdown--above')
.addClass('select2-dropdown--' + newDirection);
this.$container
.removeClass('select2-container--below select2-container--above')
.addClass('select2-container--' + newDirection);
}
this.$dropdownContainer.css(css);
};
AttachBody.prototype._resizeDropdown=function (){
var css={
width: this.$container.outerWidth(false) + 'px'
};
if(this.options.get('dropdownAutoWidth')){
css.minWidth=css.width;
css.position='relative';
css.width='auto';
}
this.$dropdown.css(css);
};
AttachBody.prototype._showDropdown=function (decorated){
this.$dropdownContainer.appendTo(this.$dropdownParent);
this._positionDropdown();
this._resizeDropdown();
};
return AttachBody;
});
S2.define('select2/dropdown/minimumResultsForSearch',[
], function (){
function countResults (data){
var count=0;
for (var d=0; d < data.length; d++){
var item=data[d];
if(item.children){
count +=countResults(item.children);
}else{
count++;
}}
return count;
}
function MinimumResultsForSearch (decorated, $element, options, dataAdapter){
this.minimumResultsForSearch=options.get('minimumResultsForSearch');
if(this.minimumResultsForSearch < 0){
this.minimumResultsForSearch=Infinity;
}
decorated.call(this, $element, options, dataAdapter);
}
MinimumResultsForSearch.prototype.showSearch=function (decorated, params){
if(countResults(params.data.results) < this.minimumResultsForSearch){
return false;
}
return decorated.call(this, params);
};
return MinimumResultsForSearch;
});
S2.define('select2/dropdown/selectOnClose',[
], function (){
function SelectOnClose (){ }
SelectOnClose.prototype.bind=function (decorated, container, $container){
var self=this;
decorated.call(this, container, $container);
container.on('close', function (params){
self._handleSelectOnClose(params);
});
};
SelectOnClose.prototype._handleSelectOnClose=function (_, params){
if(params&&params.originalSelect2Event!=null){
var event=params.originalSelect2Event;
if(event._type==='select'||event._type==='unselect'){
return;
}}
var $highlightedResults=this.getHighlightedResults();
if($highlightedResults.length < 1){
return;
}
var data=$highlightedResults.data('data');
if((data.element!=null&&data.element.selected) ||
(data.element==null&&data.selected)
){
return;
}
this.trigger('select', {
data: data
});
};
return SelectOnClose;
});
S2.define('select2/dropdown/closeOnSelect',[
], function (){
function CloseOnSelect (){ }
CloseOnSelect.prototype.bind=function (decorated, container, $container){
var self=this;
decorated.call(this, container, $container);
container.on('select', function (evt){
self._selectTriggered(evt);
});
container.on('unselect', function (evt){
self._selectTriggered(evt);
});
};
CloseOnSelect.prototype._selectTriggered=function (_, evt){
var originalEvent=evt.originalEvent;
if(originalEvent&&originalEvent.ctrlKey){
return;
}
this.trigger('close', {
originalEvent: originalEvent,
originalSelect2Event: evt
});
};
return CloseOnSelect;
});
S2.define('select2/i18n/en',[],function (){
return {
errorLoading: function (){
return 'The results could not be loaded.';
},
inputTooLong: function (args){
var overChars=args.input.length - args.maximum;
var message='Please delete ' + overChars + ' character';
if(overChars!=1){
message +='s';
}
return message;
},
inputTooShort: function (args){
var remainingChars=args.minimum - args.input.length;
var message='Please enter ' + remainingChars + ' or more characters';
return message;
},
loadingMore: function (){
return 'Loading more results…';
},
maximumSelected: function (args){
var message='You can only select ' + args.maximum + ' item';
if(args.maximum!=1){
message +='s';
}
return message;
},
noResults: function (){
return 'No results found';
},
searching: function (){
return 'Searching…';
}};});
S2.define('select2/defaults',[
'jquery',
'require',
'./results',
'./selection/single',
'./selection/multiple',
'./selection/placeholder',
'./selection/allowClear',
'./selection/search',
'./selection/eventRelay',
'./utils',
'./translation',
'./diacritics',
'./data/select',
'./data/array',
'./data/ajax',
'./data/tags',
'./data/tokenizer',
'./data/minimumInputLength',
'./data/maximumInputLength',
'./data/maximumSelectionLength',
'./dropdown',
'./dropdown/search',
'./dropdown/hidePlaceholder',
'./dropdown/infiniteScroll',
'./dropdown/attachBody',
'./dropdown/minimumResultsForSearch',
'./dropdown/selectOnClose',
'./dropdown/closeOnSelect',
'./i18n/en'
], function ($, require,
ResultsList,
SingleSelection, MultipleSelection, Placeholder, AllowClear,
SelectionSearch, EventRelay,
Utils, Translation, DIACRITICS,
SelectData, ArrayData, AjaxData, Tags, Tokenizer,
MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
EnglishTranslation){
function Defaults (){
this.reset();
}
Defaults.prototype.apply=function (options){
options=$.extend(true, {}, this.defaults, options);
if(options.dataAdapter==null){
if(options.ajax!=null){
options.dataAdapter=AjaxData;
}else if(options.data!=null){
options.dataAdapter=ArrayData;
}else{
options.dataAdapter=SelectData;
}
if(options.minimumInputLength > 0){
options.dataAdapter=Utils.Decorate(options.dataAdapter,
MinimumInputLength
);
}
if(options.maximumInputLength > 0){
options.dataAdapter=Utils.Decorate(options.dataAdapter,
MaximumInputLength
);
}
if(options.maximumSelectionLength > 0){
options.dataAdapter=Utils.Decorate(options.dataAdapter,
MaximumSelectionLength
);
}
if(options.tags){
options.dataAdapter=Utils.Decorate(options.dataAdapter, Tags);
}
if(options.tokenSeparators!=null||options.tokenizer!=null){
options.dataAdapter=Utils.Decorate(options.dataAdapter,
Tokenizer
);
}
if(options.query!=null){
var Query=require(options.amdBase + 'compat/query');
options.dataAdapter=Utils.Decorate(options.dataAdapter,
Query
);
}
if(options.initSelection!=null){
var InitSelection=require(options.amdBase + 'compat/initSelection');
options.dataAdapter=Utils.Decorate(options.dataAdapter,
InitSelection
);
}}
if(options.resultsAdapter==null){
options.resultsAdapter=ResultsList;
if(options.ajax!=null){
options.resultsAdapter=Utils.Decorate(options.resultsAdapter,
InfiniteScroll
);
}
if(options.placeholder!=null){
options.resultsAdapter=Utils.Decorate(options.resultsAdapter,
HidePlaceholder
);
}
if(options.selectOnClose){
options.resultsAdapter=Utils.Decorate(options.resultsAdapter,
SelectOnClose
);
}}
if(options.dropdownAdapter==null){
if(options.multiple){
options.dropdownAdapter=Dropdown;
}else{
var SearchableDropdown=Utils.Decorate(Dropdown, DropdownSearch);
options.dropdownAdapter=SearchableDropdown;
}
if(options.minimumResultsForSearch!==0){
options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,
MinimumResultsForSearch
);
}
if(options.closeOnSelect){
options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,
CloseOnSelect
);
}
if(options.dropdownCssClass!=null ||
options.dropdownCss!=null ||
options.adaptDropdownCssClass!=null
){
var DropdownCSS=require(options.amdBase + 'compat/dropdownCss');
options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,
DropdownCSS
);
}
options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,
AttachBody
);
}
if(options.selectionAdapter==null){
if(options.multiple){
options.selectionAdapter=MultipleSelection;
}else{
options.selectionAdapter=SingleSelection;
}
if(options.placeholder!=null){
options.selectionAdapter=Utils.Decorate(options.selectionAdapter,
Placeholder
);
}
if(options.allowClear){
options.selectionAdapter=Utils.Decorate(options.selectionAdapter,
AllowClear
);
}
if(options.multiple){
options.selectionAdapter=Utils.Decorate(options.selectionAdapter,
SelectionSearch
);
}
if(options.containerCssClass!=null ||
options.containerCss!=null ||
options.adaptContainerCssClass!=null
){
var ContainerCSS=require(options.amdBase + 'compat/containerCss');
options.selectionAdapter=Utils.Decorate(options.selectionAdapter,
ContainerCSS
);
}
options.selectionAdapter=Utils.Decorate(options.selectionAdapter,
EventRelay
);
}
if(typeof options.language==='string'){
if(options.language.indexOf('-') > 0){
var languageParts=options.language.split('-');
var baseLanguage=languageParts[0];
options.language=[options.language, baseLanguage];
}else{
options.language=[options.language];
}}
if($.isArray(options.language)){
var languages=new Translation();
options.language.push('en');
var languageNames=options.language;
for (var l=0; l < languageNames.length; l++){
var name=languageNames[l];
var language={};
try {
language=Translation.loadPath(name);
} catch (e){
try {
name=this.defaults.amdLanguageBase + name;
language=Translation.loadPath(name);
} catch (ex){
if(options.debug&&window.console&&console.warn){
console.warn('Select2: The language file for "' + name + '" could not be ' +
'automatically loaded. A fallback will be used instead.'
);
}
continue;
}}
languages.extend(language);
}
options.translations=languages;
}else{
var baseTranslation=Translation.loadPath(this.defaults.amdLanguageBase + 'en'
);
var customTranslation=new Translation(options.language);
customTranslation.extend(baseTranslation);
options.translations=customTranslation;
}
return options;
};
Defaults.prototype.reset=function (){
function stripDiacritics (text){
function match(a){
return DIACRITICS[a]||a;
}
return text.replace(/[^\u0000-\u007E]/g, match);
}
function matcher (params, data){
if($.trim(params.term)===''){
return data;
}
if(data.children&&data.children.length > 0){
var match=$.extend(true, {}, data);
for (var c=data.children.length - 1; c >=0; c--){
var child=data.children[c];
var matches=matcher(params, child);
if(matches==null){
match.children.splice(c, 1);
}}
if(match.children.length > 0){
return match;
}
return matcher(params, match);
}
var original=stripDiacritics(data.text).toUpperCase();
var term=stripDiacritics(params.term).toUpperCase();
if(original.indexOf(term) > -1){
return data;
}
return null;
}
this.defaults={
amdBase: './',
amdLanguageBase: './i18n/',
closeOnSelect: true,
debug: false,
dropdownAutoWidth: false,
escapeMarkup: Utils.escapeMarkup,
language: EnglishTranslation,
matcher: matcher,
minimumInputLength: 0,
maximumInputLength: 0,
maximumSelectionLength: 0,
minimumResultsForSearch: 0,
selectOnClose: false,
sorter: function (data){
return data;
},
templateResult: function (result){
return result.text;
},
templateSelection: function (selection){
return selection.text;
},
theme: 'default',
width: 'resolve'
};};
Defaults.prototype.set=function (key, value){
var camelKey=$.camelCase(key);
var data={};
data[camelKey]=value;
var convertedData=Utils._convertData(data);
$.extend(this.defaults, convertedData);
};
var defaults=new Defaults();
return defaults;
});
S2.define('select2/options',[
'require',
'jquery',
'./defaults',
'./utils'
], function (require, $, Defaults, Utils){
function Options (options, $element){
this.options=options;
if($element!=null){
this.fromElement($element);
}
this.options=Defaults.apply(this.options);
if($element&&$element.is('input')){
var InputCompat=require(this.get('amdBase') + 'compat/inputData');
this.options.dataAdapter=Utils.Decorate(this.options.dataAdapter,
InputCompat
);
}}
Options.prototype.fromElement=function ($e){
var excludedData=['select2'];
if(this.options.multiple==null){
this.options.multiple=$e.prop('multiple');
}
if(this.options.disabled==null){
this.options.disabled=$e.prop('disabled');
}
if(this.options.language==null){
if($e.prop('lang')){
this.options.language=$e.prop('lang').toLowerCase();
}else if($e.closest('[lang]').prop('lang')){
this.options.language=$e.closest('[lang]').prop('lang');
}}
if(this.options.dir==null){
if($e.prop('dir')){
this.options.dir=$e.prop('dir');
}else if($e.closest('[dir]').prop('dir')){
this.options.dir=$e.closest('[dir]').prop('dir');
}else{
this.options.dir='ltr';
}}
$e.prop('disabled', this.options.disabled);
$e.prop('multiple', this.options.multiple);
if($e.data('select2Tags')){
if(this.options.debug&&window.console&&console.warn){
console.warn('Select2: The `data-select2-tags` attribute has been changed to ' +
'use the `data-data` and `data-tags="true"` attributes and will be ' +
'removed in future versions of Select2.'
);
}
$e.data('data', $e.data('select2Tags'));
$e.data('tags', true);
}
if($e.data('ajaxUrl')){
if(this.options.debug&&window.console&&console.warn){
console.warn('Select2: The `data-ajax-url` attribute has been changed to ' +
'`data-ajax--url` and support for the old attribute will be removed' +
' in future versions of Select2.'
);
}
$e.attr('ajax--url', $e.data('ajaxUrl'));
$e.data('ajax--url', $e.data('ajaxUrl'));
}
var dataset={};
if($.fn.jquery&&$.fn.jquery.substr(0, 2)=='1.'&&$e[0].dataset){
dataset=$.extend(true, {}, $e[0].dataset, $e.data());
}else{
dataset=$e.data();
}
var data=$.extend(true, {}, dataset);
data=Utils._convertData(data);
for (var key in data){
if($.inArray(key, excludedData) > -1){
continue;
}
if($.isPlainObject(this.options[key])){
$.extend(this.options[key], data[key]);
}else{
this.options[key]=data[key];
}}
return this;
};
Options.prototype.get=function (key){
return this.options[key];
};
Options.prototype.set=function (key, val){
this.options[key]=val;
};
return Options;
});
S2.define('select2/core',[
'jquery',
'./options',
'./utils',
'./keys'
], function ($, Options, Utils, KEYS){
var Select2=function ($element, options){
if($element.data('select2')!=null){
$element.data('select2').destroy();
}
this.$element=$element;
this.id=this._generateId($element);
options=options||{};
this.options=new Options(options, $element);
Select2.__super__.constructor.call(this);
var tabindex=$element.attr('tabindex')||0;
$element.data('old-tabindex', tabindex);
$element.attr('tabindex', '-1');
var DataAdapter=this.options.get('dataAdapter');
this.dataAdapter=new DataAdapter($element, this.options);
var $container=this.render();
this._placeContainer($container);
var SelectionAdapter=this.options.get('selectionAdapter');
this.selection=new SelectionAdapter($element, this.options);
this.$selection=this.selection.render();
this.selection.position(this.$selection, $container);
var DropdownAdapter=this.options.get('dropdownAdapter');
this.dropdown=new DropdownAdapter($element, this.options);
this.$dropdown=this.dropdown.render();
this.dropdown.position(this.$dropdown, $container);
var ResultsAdapter=this.options.get('resultsAdapter');
this.results=new ResultsAdapter($element, this.options, this.dataAdapter);
this.$results=this.results.render();
this.results.position(this.$results, this.$dropdown);
var self=this;
this._bindAdapters();
this._registerDomEvents();
this._registerDataEvents();
this._registerSelectionEvents();
this._registerDropdownEvents();
this._registerResultsEvents();
this._registerEvents();
this.dataAdapter.current(function (initialData){
self.trigger('selection:update', {
data: initialData
});
});
$element.addClass('select2-hidden-accessible');
$element.attr('aria-hidden', 'true');
this._syncAttributes();
$element.data('select2', this);
};
Utils.Extend(Select2, Utils.Observable);
Select2.prototype._generateId=function ($element){
var id='';
if($element.attr('id')!=null){
id=$element.attr('id');
}else if($element.attr('name')!=null){
id=$element.attr('name') + '-' + Utils.generateChars(2);
}else{
id=Utils.generateChars(4);
}
id=id.replace(/(:|\.|\[|\]|,)/g, '');
id='select2-' + id;
return id;
};
Select2.prototype._placeContainer=function ($container){
$container.insertAfter(this.$element);
var width=this._resolveWidth(this.$element, this.options.get('width'));
if(width!=null){
$container.css('width', width);
}};
Select2.prototype._resolveWidth=function ($element, method){
var WIDTH=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
if(method=='resolve'){
var styleWidth=this._resolveWidth($element, 'style');
if(styleWidth!=null){
return styleWidth;
}
return this._resolveWidth($element, 'element');
}
if(method=='element'){
var elementWidth=$element.outerWidth(false);
if(elementWidth <=0){
return 'auto';
}
return elementWidth + 'px';
}
if(method=='style'){
var style=$element.attr('style');
if(typeof(style)!=='string'){
return null;
}
var attrs=style.split(';');
for (var i=0, l=attrs.length; i < l; i=i + 1){
var attr=attrs[i].replace(/\s/g, '');
var matches=attr.match(WIDTH);
if(matches!==null&&matches.length >=1){
return matches[1];
}}
return null;
}
return method;
};
Select2.prototype._bindAdapters=function (){
this.dataAdapter.bind(this, this.$container);
this.selection.bind(this, this.$container);
this.dropdown.bind(this, this.$container);
this.results.bind(this, this.$container);
};
Select2.prototype._registerDomEvents=function (){
var self=this;
this.$element.on('change.select2', function (){
self.dataAdapter.current(function (data){
self.trigger('selection:update', {
data: data
});
});
});
this.$element.on('focus.select2', function (evt){
self.trigger('focus', evt);
});
this._syncA=Utils.bind(this._syncAttributes, this);
this._syncS=Utils.bind(this._syncSubtree, this);
if(this.$element[0].attachEvent){
this.$element[0].attachEvent('onpropertychange', this._syncA);
}
var observer=window.MutationObserver ||
window.WebKitMutationObserver ||
window.MozMutationObserver
;
if(observer!=null){
this._observer=new observer(function (mutations){
$.each(mutations, self._syncA);
$.each(mutations, self._syncS);
});
this._observer.observe(this.$element[0], {
attributes: true,
childList: true,
subtree: false
});
}else if(this.$element[0].addEventListener){
this.$element[0].addEventListener('DOMAttrModified',
self._syncA,
false
);
this.$element[0].addEventListener('DOMNodeInserted',
self._syncS,
false
);
this.$element[0].addEventListener('DOMNodeRemoved',
self._syncS,
false
);
}};
Select2.prototype._registerDataEvents=function (){
var self=this;
this.dataAdapter.on('*', function (name, params){
self.trigger(name, params);
});
};
Select2.prototype._registerSelectionEvents=function (){
var self=this;
var nonRelayEvents=['toggle', 'focus'];
this.selection.on('toggle', function (){
self.toggleDropdown();
});
this.selection.on('focus', function (params){
self.focus(params);
});
this.selection.on('*', function (name, params){
if($.inArray(name, nonRelayEvents)!==-1){
return;
}
self.trigger(name, params);
});
};
Select2.prototype._registerDropdownEvents=function (){
var self=this;
this.dropdown.on('*', function (name, params){
self.trigger(name, params);
});
};
Select2.prototype._registerResultsEvents=function (){
var self=this;
this.results.on('*', function (name, params){
self.trigger(name, params);
});
};
Select2.prototype._registerEvents=function (){
var self=this;
this.on('open', function (){
self.$container.addClass('select2-container--open');
});
this.on('close', function (){
self.$container.removeClass('select2-container--open');
});
this.on('enable', function (){
self.$container.removeClass('select2-container--disabled');
});
this.on('disable', function (){
self.$container.addClass('select2-container--disabled');
});
this.on('blur', function (){
self.$container.removeClass('select2-container--focus');
});
this.on('query', function (params){
if(!self.isOpen()){
self.trigger('open', {});
}
this.dataAdapter.query(params, function (data){
self.trigger('results:all', {
data: data,
query: params
});
});
});
this.on('query:append', function (params){
this.dataAdapter.query(params, function (data){
self.trigger('results:append', {
data: data,
query: params
});
});
});
this.on('keypress', function (evt){
var key=evt.which;
if(self.isOpen()){
if(key===KEYS.ESC||key===KEYS.TAB ||
(key===KEYS.UP&&evt.altKey)){
self.close();
evt.preventDefault();
}else if(key===KEYS.ENTER){
self.trigger('results:select', {});
evt.preventDefault();
}else if((key===KEYS.SPACE&&evt.ctrlKey)){
self.trigger('results:toggle', {});
evt.preventDefault();
}else if(key===KEYS.UP){
self.trigger('results:previous', {});
evt.preventDefault();
}else if(key===KEYS.DOWN){
self.trigger('results:next', {});
evt.preventDefault();
}}else{
if(key===KEYS.ENTER||key===KEYS.SPACE ||
(key===KEYS.DOWN&&evt.altKey)){
self.open();
evt.preventDefault();
}}
});
};
Select2.prototype._syncAttributes=function (){
this.options.set('disabled', this.$element.prop('disabled'));
if(this.options.get('disabled')){
if(this.isOpen()){
this.close();
}
this.trigger('disable', {});
}else{
this.trigger('enable', {});
}};
Select2.prototype._syncSubtree=function (evt, mutations){
var changed=false;
var self=this;
if(evt&&evt.target&&(
evt.target.nodeName!=='OPTION'&&evt.target.nodeName!=='OPTGROUP'
)
){
return;
}
if(!mutations){
changed=true;
}else if(mutations.addedNodes&&mutations.addedNodes.length > 0){
for (var n=0; n < mutations.addedNodes.length; n++){
var node=mutations.addedNodes[n];
if(node.selected){
changed=true;
}}
}else if(mutations.removedNodes&&mutations.removedNodes.length > 0){
changed=true;
}
if(changed){
this.dataAdapter.current(function (currentData){
self.trigger('selection:update', {
data: currentData
});
});
}};
Select2.prototype.trigger=function (name, args){
var actualTrigger=Select2.__super__.trigger;
var preTriggerMap={
'open': 'opening',
'close': 'closing',
'select': 'selecting',
'unselect': 'unselecting'
};
if(args===undefined){
args={};}
if(name in preTriggerMap){
var preTriggerName=preTriggerMap[name];
var preTriggerArgs={
prevented: false,
name: name,
args: args
};
actualTrigger.call(this, preTriggerName, preTriggerArgs);
if(preTriggerArgs.prevented){
args.prevented=true;
return;
}}
actualTrigger.call(this, name, args);
};
Select2.prototype.toggleDropdown=function (){
if(this.options.get('disabled')){
return;
}
if(this.isOpen()){
this.close();
}else{
this.open();
}};
Select2.prototype.open=function (){
if(this.isOpen()){
return;
}
this.trigger('query', {});
};
Select2.prototype.close=function (){
if(!this.isOpen()){
return;
}
this.trigger('close', {});
};
Select2.prototype.isOpen=function (){
return this.$container.hasClass('select2-container--open');
};
Select2.prototype.hasFocus=function (){
return this.$container.hasClass('select2-container--focus');
};
Select2.prototype.focus=function (data){
if(this.hasFocus()){
return;
}
this.$container.addClass('select2-container--focus');
this.trigger('focus', {});
};
Select2.prototype.enable=function (args){
if(this.options.get('debug')&&window.console&&console.warn){
console.warn('Select2: The `select2("enable")` method has been deprecated and will' +
' be removed in later Select2 versions. Use $element.prop("disabled")' +
' instead.'
);
}
if(args==null||args.length===0){
args=[true];
}
var disabled = !args[0];
this.$element.prop('disabled', disabled);
};
Select2.prototype.data=function (){
if(this.options.get('debug') &&
arguments.length > 0&&window.console&&console.warn){
console.warn('Select2: Data can no longer be set using `select2("data")`. You ' +
'should consider setting the value instead using `$element.val()`.'
);
}
var data=[];
this.dataAdapter.current(function (currentData){
data=currentData;
});
return data;
};
Select2.prototype.val=function (args){
if(this.options.get('debug')&&window.console&&console.warn){
console.warn('Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.val() instead.'
);
}
if(args==null||args.length===0){
return this.$element.val();
}
var newVal=args[0];
if($.isArray(newVal)){
newVal=$.map(newVal, function (obj){
return obj.toString();
});
}
this.$element.val(newVal).trigger('change');
};
Select2.prototype.destroy=function (){
this.$container.remove();
if(this.$element[0].detachEvent){
this.$element[0].detachEvent('onpropertychange', this._syncA);
}
if(this._observer!=null){
this._observer.disconnect();
this._observer=null;
}else if(this.$element[0].removeEventListener){
this.$element[0]
.removeEventListener('DOMAttrModified', this._syncA, false);
this.$element[0]
.removeEventListener('DOMNodeInserted', this._syncS, false);
this.$element[0]
.removeEventListener('DOMNodeRemoved', this._syncS, false);
}
this._syncA=null;
this._syncS=null;
this.$element.off('.select2');
this.$element.attr('tabindex', this.$element.data('old-tabindex'));
this.$element.removeClass('select2-hidden-accessible');
this.$element.attr('aria-hidden', 'false');
this.$element.removeData('select2');
this.dataAdapter.destroy();
this.selection.destroy();
this.dropdown.destroy();
this.results.destroy();
this.dataAdapter=null;
this.selection=null;
this.dropdown=null;
this.results=null;
};
Select2.prototype.render=function (){
var $container=$(
'<span class="select2 select2-container">' +
'<span class="selection"></span>' +
'<span class="dropdown-wrapper" aria-hidden="true"></span>' +
'</span>'
);
$container.attr('dir', this.options.get('dir'));
this.$container=$container;
this.$container.addClass('select2-container--' + this.options.get('theme'));
$container.data('element', this.$element);
return $container;
};
return Select2;
});
S2.define('jquery-mousewheel',[
'jquery'
], function ($){
return $;
});
S2.define('jquery.select2',[
'jquery',
'jquery-mousewheel',
'./select2/core',
'./select2/defaults'
], function ($, _, Select2, Defaults){
if($.fn.select2==null){
var thisMethods=['open', 'close', 'destroy'];
$.fn.select2=function (options){
options=options||{};
if(typeof options==='object'){
this.each(function (){
var instanceOptions=$.extend(true, {}, options);
var instance=new Select2($(this), instanceOptions);
});
return this;
}else if(typeof options==='string'){
var ret;
var args=Array.prototype.slice.call(arguments, 1);
this.each(function (){
var instance=$(this).data('select2');
if(instance==null&&window.console&&console.error){
console.error('The select2(\'' + options + '\') method was called on an ' +
'element that is not using Select2.'
);
}
ret=instance[options].apply(instance, args);
});
if($.inArray(options, thisMethods) > -1){
return this;
}
return ret;
}else{
throw new Error('Invalid arguments for Select2: ' + options);
}};}
if($.fn.select2.defaults==null){
$.fn.select2.defaults=Defaults;
}
return Select2;
});
return {
define: S2.define,
require: S2.require
};}());
var select2=S2.require('jquery.select2');
jQuery.fn.select2.amd=S2;
return select2;
}));
(function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("wolfy87-eventemitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(window,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function f(e){this.img=e}function c(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var f=r[o];this.addImage(f)}}},s.prototype.addImage=function(e){var t=new f(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),f.prototype=new t,f.prototype.check=function(){var e=v[this.img.src]||new c(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},f.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return c.prototype=new t,c.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},c.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s});
(function(){var a,b,c,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}},g=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};b=function(){function a(){}return a.prototype.extend=function(a,b){var c,d;for(c in b)d=b[c],null==a[c]&&(a[c]=d);return a},a.prototype.isMobile=function(a){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(a)},a.prototype.addEvent=function(a,b,c){return null!=a.addEventListener?a.addEventListener(b,c,!1):null!=a.attachEvent?a.attachEvent("on"+b,c):a[b]=c},a.prototype.removeEvent=function(a,b,c){return null!=a.removeEventListener?a.removeEventListener(b,c,!1):null!=a.detachEvent?a.detachEvent("on"+b,c):delete a[b]},a.prototype.innerHeight=function(){return"innerHeight"in window?window.innerHeight:document.documentElement.clientHeight},a}(),c=this.WeakMap||this.MozWeakMap||(c=function(){function a(){this.keys=[],this.values=[]}return a.prototype.get=function(a){var b,c,d,e,f;for(f=this.keys,b=d=0,e=f.length;e>d;b=++d)if(c=f[b],c===a)return this.values[b]},a.prototype.set=function(a,b){var c,d,e,f,g;for(g=this.keys,c=e=0,f=g.length;f>e;c=++e)if(d=g[c],d===a)return void(this.values[c]=b);return this.keys.push(a),this.values.push(b)},a}()),a=this.MutationObserver||this.WebkitMutationObserver||this.MozMutationObserver||(a=function(){function a(){"undefined"!=typeof console&&null!==console&&console.warn("MutationObserver is not supported by your browser."),"undefined"!=typeof console&&null!==console&&console.warn("WOW.js cannot detect dom mutations, please call .sync() after loading new content.")}return a.notSupported=!0,a.prototype.observe=function(){},a}()),d=this.getComputedStyle||function(a){return this.getPropertyValue=function(b){var c;return"float"===b&&(b="styleFloat"),e.test(b)&&b.replace(e,function(a,b){return b.toUpperCase()}),(null!=(c=a.currentStyle)?c[b]:void 0)||null},this},e=/(\-([a-z]){1})/g,this.WOW=function(){function e(a){null==a&&(a={}),this.scrollCallback=f(this.scrollCallback,this),this.scrollHandler=f(this.scrollHandler,this),this.start=f(this.start,this),this.scrolled=!0,this.config=this.util().extend(a,this.defaults),this.animationNameCache=new c}return e.prototype.defaults={boxClass:"wow",animateClass:"animated",offset:0,mobile:!0,live:!0,callback:null},e.prototype.init=function(){var a;return this.element=window.document.documentElement,"interactive"===(a=document.readyState)||"complete"===a?this.start():this.util().addEvent(document,"DOMContentLoaded",this.start),this.finished=[]},e.prototype.start=function(){var b,c,d,e;if(this.stopped=!1,this.boxes=function(){var a,c,d,e;for(d=this.element.querySelectorAll("."+this.config.boxClass),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(b);return e}.call(this),this.all=function(){var a,c,d,e;for(d=this.boxes,e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(b);return e}.call(this),this.boxes.length)if(this.disabled())this.resetStyle();else for(e=this.boxes,c=0,d=e.length;d>c;c++)b=e[c],this.applyStyle(b,!0);return this.disabled()||(this.util().addEvent(window,"scroll",this.scrollHandler),this.util().addEvent(window,"resize",this.scrollHandler),this.interval=setInterval(this.scrollCallback,50)),this.config.live?new a(function(a){return function(b){var c,d,e,f,g;for(g=[],e=0,f=b.length;f>e;e++)d=b[e],g.push(function(){var a,b,e,f;for(e=d.addedNodes||[],f=[],a=0,b=e.length;b>a;a++)c=e[a],f.push(this.doSync(c));return f}.call(a));return g}}(this)).observe(document.body,{childList:!0,subtree:!0}):void 0},e.prototype.stop=function(){return this.stopped=!0,this.util().removeEvent(window,"scroll",this.scrollHandler),this.util().removeEvent(window,"resize",this.scrollHandler),null!=this.interval?clearInterval(this.interval):void 0},e.prototype.sync=function(){return a.notSupported?this.doSync(this.element):void 0},e.prototype.doSync=function(a){var b,c,d,e,f;if(null==a&&(a=this.element),1===a.nodeType){for(a=a.parentNode||a,e=a.querySelectorAll("."+this.config.boxClass),f=[],c=0,d=e.length;d>c;c++)b=e[c],g.call(this.all,b)<0?(this.boxes.push(b),this.all.push(b),this.stopped||this.disabled()?this.resetStyle():this.applyStyle(b,!0),f.push(this.scrolled=!0)):f.push(void 0);return f}},e.prototype.show=function(a){return this.applyStyle(a),a.className=""+a.className+" "+this.config.animateClass,null!=this.config.callback?this.config.callback(a):void 0},e.prototype.applyStyle=function(a,b){var c,d,e;return d=a.getAttribute("data-wow-duration"),c=a.getAttribute("data-wow-delay"),e=a.getAttribute("data-wow-iteration"),this.animate(function(f){return function(){return f.customStyle(a,b,d,c,e)}}(this))},e.prototype.animate=function(){return"requestAnimationFrame"in window?function(a){return window.requestAnimationFrame(a)}:function(a){return a()}}(),e.prototype.resetStyle=function(){var a,b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.style.visibility="visible");return e},e.prototype.customStyle=function(a,b,c,d,e){return b&&this.cacheAnimationName(a),a.style.visibility=b?"hidden":"visible",c&&this.vendorSet(a.style,{animationDuration:c}),d&&this.vendorSet(a.style,{animationDelay:d}),e&&this.vendorSet(a.style,{animationIterationCount:e}),this.vendorSet(a.style,{animationName:b?"none":this.cachedAnimationName(a)}),a},e.prototype.vendors=["moz","webkit"],e.prototype.vendorSet=function(a,b){var c,d,e,f;f=[];for(c in b)d=b[c],a[""+c]=d,f.push(function(){var b,f,g,h;for(g=this.vendors,h=[],b=0,f=g.length;f>b;b++)e=g[b],h.push(a[""+e+c.charAt(0).toUpperCase()+c.substr(1)]=d);return h}.call(this));return f},e.prototype.vendorCSS=function(a,b){var c,e,f,g,h,i;for(e=d(a),c=e.getPropertyCSSValue(b),i=this.vendors,g=0,h=i.length;h>g;g++)f=i[g],c=c||e.getPropertyCSSValue("-"+f+"-"+b);return c},e.prototype.animationName=function(a){var b;try{b=this.vendorCSS(a,"animation-name").cssText}catch(c){b=d(a).getPropertyValue("animation-name")}return"none"===b?"":b},e.prototype.cacheAnimationName=function(a){return this.animationNameCache.set(a,this.animationName(a))},e.prototype.cachedAnimationName=function(a){return this.animationNameCache.get(a)},e.prototype.scrollHandler=function(){return this.scrolled=!0},e.prototype.scrollCallback=function(){var a;return!this.scrolled||(this.scrolled=!1,this.boxes=function(){var b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],a&&(this.isVisible(a)?this.show(a):e.push(a));return e}.call(this),this.boxes.length||this.config.live)?void 0:this.stop()},e.prototype.offsetTop=function(a){for(var b;void 0===a.offsetTop;)a=a.parentNode;for(b=a.offsetTop;a=a.offsetParent;)b+=a.offsetTop;return b},e.prototype.isVisible=function(a){var b,c,d,e,f;return c=a.getAttribute("data-wow-offset")||this.config.offset,f=window.pageYOffset,e=f+Math.min(this.element.clientHeight,this.util().innerHeight())-c,d=this.offsetTop(a),b=d+a.clientHeight,e>=d&&b>=f},e.prototype.util=function(){return null!=this._util?this._util:this._util=new b},e.prototype.disabled=function(){return!this.config.mobile&&this.util().isMobile(navigator.userAgent)},e}()}).call(this);
(function($){
$.fn.cws_prlx=cws_prlx;
window.addEventListener('scroll', function (){
if(window.cws_prlx!=undefined&&!window.cws_prlx.disabled){
window.cws_prlx.translate_layers();
}}, false);
window.addEventListener('resize', function (){
var i, section_id, section_params;
if(window.cws_prlx!=undefined){
if(window.cws_prlx.servant.is_mobile()){
if(!window.cws_prlx.disabled){
for(layer_id in window.cws_prlx.layers){
window.cws_prlx.layers[layer_id].el.removeAttribute('style');
}
window.cws_prlx.disabled=true;
}}else{
if(window.cws_prlx.disabled){
window.cws_prlx.disabled=false;
}
for(section_id in window.cws_prlx.sections){
section_params=window.cws_prlx.sections[section_id];
if(section_params.height!=section_params.el.offsetHeight){
window.cws_prlx.prepare_section_data(section_id);
}}
}}
}, false);
function cws_prlx(args){
var factory, sects;
sects=$(this);
if(!sects.length) return;
factory=new cws_prlx_factory(args);
window.cws_prlx=window.cws_prlx!=undefined ? window.cws_prlx:new cws_prlx_builder ();
sects.each(function (){
var sect=$(this);
var sect_id=factory.add_section(sect);
if(sect_id) window.cws_prlx.prepare_section_data(sect_id);
});
}
function cws_prlx_factory(args){
var args=args!=undefined ? args:{};
args.def_speed=args.def_speed!=undefined&&!isNaN(parseInt(args.def_speed) )&&parseInt(args.def_speed > 0)&&parseInt(args.def_speed <=100) ? args.def_speed:50;
args.layer_sel=args.layer_sel!=undefined&&typeof args.layer_sel=="string"&&args.layer_sel.length ? args.layer_sel:".cws_prlx_layer";
this.args=args;
this.add_section=cws_prlx_add_section;
this.add_layer=cws_prlx_add_layer;
this.remove_layer=cws_prlx_remove_layer;
}
function cws_prlx_builder (){
this.servant=new cws_servant ();
this.sections={};
this.layers={};
this.calc_layer_speed=cws_prlx_calc_layer_speed;
this.prepare_section_data=cws_prlx_prepare_section_data;
this.prepare_layer_data=cws_prlx_prepare_layer_data;
this.translate_layers=cws_prlx_translate_layers;
this.translate_layer=cws_prlx_translate_layer;
this.conditions={};
this.conditions.layer_loaded=cws_prlx_layer_loaded_condition;
this.disabled=false;
}
function cws_prlx_add_section(section_obj){
var factory, section, section_id, layers, layer, i;
factory=this;
section=section_obj[0];
layers=$(factory.args.layer_sel, section_obj);
if(!layers.length) return false;
section_id=window.cws_prlx.servant.uniq_id('cws_prlx_section_');
section.id=section_id;
window.cws_prlx.sections[section_id]={
'el':section,
'height':null,
'layer_sel':factory.args.layer_sel
}
if(/cws_Yt_video_bg/.test(section.className) ){  
section.addEventListener("DOMNodeRemoved", function(e){
var el=e.srcElement ? e.srcElement:e.target;
if($(el).is(factory.args.layer_sel) ){
factory.remove_layer(el.id);
}}, false);
section.addEventListener("DOMNodeInserted", function(e){
var el=e.srcElement ? e.srcElement:e.target;
if($(el).is(factory.args.layer_sel) ){
factory.add_layer(el, section_id);
}}, false);
}
section.addEventListener("DOMNodeRemoved", function(e){ 
window.cws_prlx.prepare_section_data(section_id);
},false);
section.addEventListener("DOMNodeInserted", function(e){ 
window.cws_prlx.prepare_section_data(section_id);
},false);
for(i=0; i < layers.length; i++){
layer=layers[i];
factory.add_layer(layer, section_id)
}
return section_id;
}
function cws_prlx_add_layer(layer, section_id){
var factory, layer_rel_speed, layer_params;
factory=this;
layer.id = !layer.id.length ? window.cws_prlx.servant.uniq_id('cws_prlx_layer_'):layer.id;
layer_rel_speed=$(layer).data('scroll-speed');
layer_rel_speed=layer_rel_speed!=undefined ? layer_rel_speed:factory.args.def_speed;
layer_params={
'el':layer,
'section_id':section_id,
'height':null,
'loaded':false,
'rel_speed':layer_rel_speed,
'speed':null
}
window.cws_prlx.layers[layer.id]=layer_params;
return layer.id;
}
function cws_prlx_remove_layer(layer_id){
var layers;
layers=window.cws_prlx.layers;
if(layers[layer_id]!=undefined){
delete layers[layer_id];
}}
function cws_prlx_prepare_section_data(section_id){
var section, section_params, layer_sel, layers, layer, layer_id, i;
if(!Object.keys(window.cws_prlx.sections).length||window.cws_prlx.sections[section_id]==undefined) return false;
section_params=window.cws_prlx.sections[section_id];
section=section_params.el;
section_params.height=section.offsetHeight;
section_obj=$(section);
layers=$(section_params.layer_sel, section_obj);
for(i=0; i<layers.length; i++){
layer=layers[i];
layer_id=layer.id;
if(layer_id) window.cws_prlx.prepare_layer_data(layer_id, section_id);
}}
function cws_prlx_prepare_layer_data(layer_id, section_id){
window.cws_prlx.servant.wait_for('layer_loaded', [ layer_id ], function(layer_id){
var layer_params, layer;
layer_params=window.cws_prlx.layers[layer_id];
layer=layer_params.el;
layer_params.height=layer.offsetHeight;
window.cws_prlx.calc_layer_speed(layer_id);
window.cws_prlx.translate_layer(layer_id);
layer_params.loaded=true;
}, [ layer_id ]);
}
function cws_prlx_translate_layers (){
var layers, layer_ids, layer_id, i;
if(window.cws_prlx==undefined) return;
layers=window.cws_prlx.layers;
layer_ids=Object.keys(layers);
for(i=0; i < layer_ids.length; i++){
layer_id=layer_ids[i];
window.cws_prlx.translate_layer(layer_id);
}}
function cws_prlx_translate_layer(layer_id){
var layer_params, section, layer, layer_translation, style_adjs;
if(window.cws_prlx==undefined||window.cws_prlx.layers[layer_id]==undefined) return false;
layer_params=window.cws_prlx.layers[layer_id];
if(layer_params.speed==null) return false;
if(layer_params.section_id==undefined||window.cws_prlx.sections[layer_params.section_id]==undefined) return false;
section=window.cws_prlx.sections[layer_params.section_id].el;
if(window.cws_prlx.servant.is_visible(section) ){
layer=layer_params.el;
layer_translation=(section.getBoundingClientRect().top - window.innerHeight) * layer_params.speed;
style_adjs={
"WebkitTransform":"translate(-50%," + layer_translation + "px)",
"MozTransform":"translate(-50%," + layer_translation + "px)",
"msTransform":"translate(-50%," + layer_translation + "px)",
"OTransform":"translate(-50%," + layer_translation + "px)",
"transform":"translate(-50%," + layer_translation + "px)"
}
for(key in style_adjs){
layer.style[key]=style_adjs[key];
}}
}
function cws_servant (){
this.uniq_id=cws_uniq_id;
this.wait_for=cws_wait_for;
this.is_visible=cws_is_visible;
this.is_mobile=cws_is_mobile;
}
function cws_uniq_id(prefix){
var d, t, n, id;
var prefix=prefix!=undefined ? prefix:"";
d=new Date();
t=d.getTime();
n=parseInt(Math.random() * t);
id=prefix + n;
return id;
}
function cws_wait_for(condition, condition_args, callback, callback_args){
var match=false;
var condition_args=condition_args!=undefined&&typeof condition_args=='object' ? condition_args:new Array();
var callback_args=callback_args!=undefined&&typeof callback_args=='object' ? callback_args:new Array();
if(condition==undefined||typeof condition!='string'||callback==undefined||typeof callback!='function') return match;
match=window.cws_prlx.conditions[condition].apply(window, condition_args);
if(match==true){
callback.apply(window, callback_args);
return true;
}
else if(match==false){
setTimeout(function (){
cws_wait_for(condition, condition_args, callback, callback_args);
}, 10);
}else{
return false;
}}
function cws_is_visible(el){
var window_top, window_height, window_bottom, el_top, el_height, el_bottom, r;
window_top=window.pageYOffset;
window_height=window.innerHeight;
window_bottom=window_top + window_height;
el_top=$(el).offset().top;
el_height=el.offsetHeight;
el_bottom=el_top + el_height;
r=(el_top > window_top&&el_top < window_bottom)||(el_top < window_top&&el_bottom > window_bottom)||(el_bottom > window_top&&el_bottom < window_bottom) ? true:false;
return r;
}
function cws_is_mobile (){
return window.innerWidth < 768;
}
function cws_prlx_layer_loaded_condition(layer_id){
var layer, r;
r=false;
if(layer_id==undefined||typeof layer_id!='string') return r;
if(window.cws_prlx.layers[layer_id]==undefined) return r;
layer=window.cws_prlx.layers[layer_id].el;
switch(layer.tagName){
case "IMG":
if(layer.complete==undefined){
console.log('img hasn\'t complete property');
}else{
if(!layer.complete){
return r;
}}
break;
case "DIV":  
if(/^video-/.test(layer.id) ){
return r;
}
break;
}
return true;
}
function cws_prlx_calc_layer_speed(layer_id){
var layer_params, layer, section_id, section_params, window_height;
layer_params=window.cws_prlx.layers[layer_id];
layer=layer_params.el;
section_id=layer_params.section_id;
section_params=window.cws_prlx.sections[section_id];
window_height=window.innerHeight;
layer_params.speed=(( layer_params.height - section_params.height) /(window_height + section_params.height) ) *(layer_params.rel_speed / 100);
}}(jQuery));