text: (function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,u=e.jQuery,l=e.$,c={},d=[],f="1.10.2",p=d.concat,h=d.push,g=d.slice,v=d.indexOf,m=c.toString,y=c.hasOwnProperty,b=f.trim,w=function(e,t){return new w.fn.init(e,t,r)},C=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,S=/\S+/g,x=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,T=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,A=/(?:^|:|,)(?:\s*\[)+/g,N=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,I=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,R=/^-ms-/,_=/-([\da-z])/gi,O=function(e,t){return t.toUpperCase()},D=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(L(),w.ready())},L=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",D,!1),e.removeEventListener("load",D,!1)):(a.detachEvent("onreadystatechange",D),e.detachEvent("onload",D))};w.fn=w.prototype={jquery:f,constructor:w,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:T.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof w?n[0]:n,w.merge(this,w.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&w.isPlainObject(n))for(i in n)w.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):w.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),w.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return w.each(this,e,t)},ready:function(e){return w.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},w.fn.init.prototype=w.fn,w.extend=w.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||w.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(w.isPlainObject(r)||(n=w.isArray(r)))?(n?(n=!1,a=e&&w.isArray(e)?e:[]):a=e&&w.isPlainObject(e)?e:{},s[i]=w.extend(c,a,r)):r!==t&&(s[i]=r));return s},w.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===w&&(e.$=l),t&&e.jQuery===w&&(e.jQuery=u),w},isReady:!1,readyWait:1,holdReady:function(e){e?w.readyWait++:w.ready(!0)},ready:function(e){if(e===!0?!--w.readyWait:!w.isReady){if(!a.body)return setTimeout(w.ready);w.isReady=!0,e!==!0&&--w.readyWait>0||(n.resolveWith(a,[w]),w.fn.trigger&&w(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===w.type(e)},isArray:Array.isArray||function(e){return"array"===w.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[m.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==w.type(e)||e.nodeType||w.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}if(w.support.ownLast)for(n in e)return y.call(e,n);for(n in e);return n===t||y.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=w.buildFragment([e],t,i),i&&w(i).remove(),w.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=w.trim(n),n&&E.test(n.replace(N,"@").replace(I,"]").replace(A,"")))?Function("return "+n)():(w.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(e){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&w.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(R,"ms-").replace(_,O)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=B(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff ")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(x,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(B(Object(e))?w.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(v)return v.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=B(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return p.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),w.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===w.type(r)){o=!0;for(u in r)w.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,w.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(w(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),w.ready.promise=function(t){if(!n)if(n=w.Deferred(),"complete"===a.readyState)setTimeout(w.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",D,!1),e.addEventListener("load",D,!1);else{a.attachEvent("onreadystatechange",D),e.attachEvent("onload",D);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(e){}r&&r.doScroll&&function e(){if(!w.isReady){try{r.doScroll("left")}catch(t){return setTimeout(e,50)}L(),w.ready()}}()}return n.promise(t)},w.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function B(e){var t=e.length,n=w.type(e);return w.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=w(a),function(e,t){var n,r,i,o,a,s,u,l,c,d,f,p,h,g,v,m,y,b="sizzle"+-new Date,C=e.document,S=0,x=0,T=ae(),k=ae(),E=ae(),A=!1,N=function(e,t){return e===t?(A=!0,0):0},I=typeof t,R=1<<31,_={}.hasOwnProperty,O=[],D=O.pop,L=O.push,B=O.push,M=O.slice,j=O.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},q="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",z="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",F=z.replace("w","w#"),H="\\["+P+"*("+z+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+F+")|)|)"+P+"*\\]",U=":("+z+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+H.replace(3,8)+")*)|.*)\\)|)",$=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),V=RegExp("^"+P+"*,"+P+"*"),W=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),K=RegExp(P+"*[+~]"),G=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(U),X=RegExp("^"+F+"$"),Y={ID:RegExp("^#("+z+")"),CLASS:RegExp("^\\.("+z+")"),TAG:RegExp("^("+z.replace("w","w*")+")"),ATTR:RegExp("^"+H),PSEUDO:RegExp("^"+U),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+q+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},Q=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/^(?:input|select|textarea|button)$/i,te=/^h\d$/i,ne=/'|\\/g,re=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),ie=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{B.apply(O=M.call(C.childNodes),C.childNodes),O[C.childNodes.length].nodeType}catch(e){B={apply:O.length?function(e,t){L.apply(e,M.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,n,i){var o,a,s,u,l,c,p,v,m,w;if((t?t.ownerDocument||t:C)!==f&&d(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(u=t.nodeType)&&9!==u)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===u){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&y(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return B.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return B.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(v=p=b,m=t,w=9===u&&e,1===u&&"object"!==t.nodeName.toLowerCase()){c=ge(e),(p=t.getAttribute("id"))?v=p.replace(ne,"\\$&"):t.setAttribute("id",v),v="[id='"+v+"'] ",l=c.length;while(l--)c[l]=v+ve(c[l]);m=K.test(e)&&t.parentNode||t,w=c.join(",")}if(w)try{return B.apply(n,m.querySelectorAll(w)),n}catch(e){}finally{p||t.removeAttribute("id")}}}return Te(e.replace($,"$1"),t,n,i)}function ae(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function se(e){return e[b]=!0,e}function ue(e){var t=f.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||R)-(~e.sourceIndex||R);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function fe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pe(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=oe.support={},d=oe.setDocument=function(e){var n=e?e.ownerDocument||e:C,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,p=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){d()}),r.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ue(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ue(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ue(function(e){return p.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==I&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(re,ie);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(re,ie);return function(e){var n=typeof e.getAttributeNode!==I&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==I?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==I&&h?n.getElementsByClassName(e):t},v=[],g=[],(r.qsa=Q.test(n.querySelectorAll))&&(ue(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+q+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ue(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=Q.test(m=p.webkitMatchesSelector||p.mozMatchesSelector||p.oMatchesSelector||p.msMatchesSelector))&&ue(function(e){r.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),v.push("!=",U)}),g=g.length&&RegExp(g.join("|")),v=v.length&&RegExp(v.join("|")),y=Q.test(p.contains)||p.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},N=p.compareDocumentPosition?function(e,t){if(e===t)return A=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||y(C,e)?-1:t===n||y(C,t)?1:c?j.call(c,e)-j.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],u=[t];if(e===t)return A=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?j.call(c,e)-j.call(c,t):0;if(o===a)return ce(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)u.unshift(r);while(s[i]===u[i])i++;return i?ce(s[i],u[i]):s[i]===C?-1:u[i]===C?1:0},n):f},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&d(e),t=t.replace(G,"='$1']"),!(!r.matchesSelector||!h||v&&v.test(t)||g&&g.test(t)))try{var n=m.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return oe(t,f,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==f&&d(e),y(e,t)},oe.attr=function(e,n){(e.ownerDocument||e)!==f&&d(e);var i=o.attrHandle[n.toLowerCase()],a=i&&_.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},oe.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,n=[],i=0,o=0;if(A=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(N),A){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=oe.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=oe.selectors={cacheLength:50,createPseudo:se,match:Y,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(re,ie),e[3]=(e[4]||e[5]||"").replace(re,ie),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Y.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=ge(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(re,ie).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&T(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==I&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,d,f,p,h,g=o!==a?"nextSibling":"previousSibling",v=t.parentNode,m=s&&t.nodeName.toLowerCase(),y=!u&&!s;if(v){if(o){while(g){d=t;while(d=d[g])if(s?d.nodeName.toLowerCase()===m:1===d.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?v.firstChild:v.lastChild],a&&y){c=v[b]||(v[b]={}),l=c[e]||[],p=l[0]===S&&l[1],f=l[0]===S&&l[2],d=p&&v.childNodes[p];while(d=++p&&d&&d[g]||(f=p=0)||h.pop())if(1===d.nodeType&&++f&&d===t){c[e]=[S,p,f];break}}else if(y&&(l=(t[b]||(t[b]={}))[e])&&l[0]===S)f=l[1];else while(d=++p&&d&&d[g]||(f=p=0)||h.pop())if((s?d.nodeName.toLowerCase()===m:1===d.nodeType)&&++f&&(y&&((d[b]||(d[b]={}))[e]=[S,f]),d===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=j.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:se(function(e){var t=[],n=[],r=u(e.replace($,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:se(function(e){return X.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(re,ie).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===p},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return te.test(e.nodeName)},input:function(e){return ee.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pe(function(){return[0]}),last:pe(function(e,t){return[t-1]}),eq:pe(function(e,t,n){return[0>n?n+t:n]}),even:pe(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pe(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pe(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pe(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=de(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=fe(n);function he(){}he.prototype=o.filters=o.pseudos,o.setFilters=new he;function ge(e,t){var n,r,i,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=o.preFilter;while(s){(!n||(r=V.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(i=[])),n=!1,(r=W.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace($," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Y[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)}function ve(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=x++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var u,l,c,d=S+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(l=c[r])&&l[0]===d){if((u=l[1])===!0||u===i)return u===!0}else if(l=c[r]=[d],l[1]=e(t,n,s)||i,l[1]===!0)return!0}}function ye(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function we(e,t,n,r,i,o){return r&&!r[b]&&(r=we(r)),i&&!i[b]&&(i=we(i,o)),se(function(o,a,s,u){var l,c,d,f=[],p=[],h=a.length,g=o||xe(t||"*",s.nodeType?[s]:s,[]),v=!e||!o&&t?g:be(g,f,e,s,u),m=n?i||(o?e:h||r)?[]:a:v;if(n&&n(v,m,s,u),r){l=be(m,p),r(l,[],s,u),c=l.length;while(c--)(d=l[c])&&(m[p[c]]=!(v[p[c]]=d))}if(o){if(i||e){if(i){l=[],c=m.length;while(c--)(d=m[c])&&l.push(v[c]=d);i(null,m=[],l,u)}c=m.length;while(c--)(d=m[c])&&(l=i?j.call(o,d):f[c])>-1&&(o[l]=!(a[l]=d))}}else m=be(m===a?m.splice(h,m.length):m),i?i(null,a,m,u):B.apply(a,m)})}function Ce(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),d=me(function(e){return j.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):d(e,n,r))}];for(;i>u;u++)if(n=o.relative[e[u].type])f=[me(ye(f),n)];else{if(n=o.filter[e[u].type].apply(null,e[u].matches),n[b]){for(r=++u;i>r;r++)if(o.relative[e[r].type])break;return we(u>1&&ye(f),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace($,"$1"),n,r>u&&Ce(e.slice(u,r)),i>r&&Ce(e=e.slice(r)),i>r&&ve(e))}f.push(n)}return ye(f)}function Se(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,u,c,d,p){var h,g,v,m=[],y=0,b="0",w=s&&[],C=null!=p,x=l,T=s||a&&o.find.TAG("*",p&&u.parentNode||u),k=S+=null==x?1:Math.random()||.1;for(C&&(l=u!==f&&u,i=n);null!=(h=T[b]);b++){if(a&&h){g=0;while(v=e[g++])if(v(h,u,c)){d.push(h);break}C&&(S=k,i=++n)}r&&((h=!v&&h)&&y--,s&&w.push(h))}if(y+=b,r&&b!==y){g=0;while(v=t[g++])v(w,m,u,c);if(s){if(y>0)while(b--)w[b]||m[b]||(m[b]=D.call(d));m=be(m)}B.apply(d,m),C&&!s&&m.length>0&&y+t.length>1&&oe.uniqueSort(d)}return C&&(S=k,l=x),w};return r?se(s):s}u=oe.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=ge(e)),n=t.length;while(n--)o=Ce(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Se(i,r))}return o};function xe(e,t,n){var r=0,i=t.length;for(;i>r;r++)oe(e,t[r],n);return n}function Te(e,t,n,i){var a,s,l,c,d,f=ge(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(l=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(l.matches[0].replace(re,ie),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Y.needsContext.test(e)?0:s.length;while(a--){if(l=s[a],o.relative[c=l.type])break;if((d=o.find[c])&&(i=d(l.matches[0].replace(re,ie),K.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&ve(s),!e)return B.apply(n,i),n;break}}}return u(e,f)(i,t,!h,n,K.test(e)),n}r.sortStable=b.split("").sort(N).join("")===b,r.detectDuplicates=A,d(),r.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(q,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),w.find=oe,w.expr=oe.selectors,w.expr[":"]=w.expr.pseudos,w.unique=oe.uniqueSort,w.text=oe.getText,w.isXMLDoc=oe.isXML,w.contains=oe.contains}(e);var M={};function j(e){var t=M[e]={};return w.each(e.match(S)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?M[e]||j(e):w.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:d.disable())},d={add:function(){if(u){var t=u.length;(function t(n){w.each(n,function(n,r){var i=w.type(r);"function"===i?e.unique&&d.has(r)||u.push(r):r&&r.length&&"string"!==i&&t(r)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&w.each(arguments,function(e,t){var r;while((r=w.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?w.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],o=0,this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||d.disable(),this},locked:function(){return!l},fireWith:function(e,t){return!u||i&&!l||(t=t||[],t=[e,t.slice?t.slice():t],n?l.push(t):c(t)),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!i}};return d},w.extend({Deferred:function(e){var t=[["resolve","done",w.Callbacks("once memory"),"resolved"],["reject","fail",w.Callbacks("once memory"),"rejected"],["notify","progress",w.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return w.Deferred(function(n){w.each(t,function(t,o){var a=o[0],s=w.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&w.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?w.extend(e,r):r}},i={};return r.pipe=r.then,w.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&w.isFunction(e.promise)?r:0,o=1===i?e:w.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&w.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),w.support=function(t){var n,r,o,s,u,l,c,d,f,p=a.createElement("div");if(p.setAttribute("className","t"),p.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*")||[],r=p.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),l=s.appendChild(a.createElement("option")),o=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==p.className,t.leadingWhitespace=3===p.firstChild.nodeType,t.tbody=!p.getElementsByTagName("tbody").length,t.htmlSerialize=!!p.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=l.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete p.test}catch(e){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),u=a.createDocumentFragment(),u.appendChild(o),t.appendChecked=o.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,p.attachEvent&&(p.attachEvent("onclick",function(){t.noCloneEvent=!1}),p.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})p.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||p.attributes[c].expando===!1;p.style.backgroundClip="content-box",p.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===p.style.backgroundClip;for(f in w(t))break;return t.ownLast="0"!==f,w(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=a.getElementsByTagName("body")[0];u&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(p),p.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=p.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",d=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=d&&0===o[0].offsetHeight,p.innerHTML="",p.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",w.swap(u,null!=u.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===p.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(p,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(p,null)||{width:"4px"}).width,r=p.appendChild(a.createElement("div")),r.style.cssText=p.style.cssText=s,r.style.marginRight=r.style.width="0",p.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof p.style.zoom!==i&&(p.innerHTML="",p.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===p.offsetWidth,p.style.display="block",p.innerHTML="<div></div>",p.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==p.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=p=o=r=null)}),n=s=u=l=r=o=null,t;
  }({});var q=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function z(e,n,r,i){if(w.acceptData(e)){var o,a,s=w.expando,u=e.nodeType,l=u?w.cache:e,c=u?e[s]:e[s]&&s;if(c&&l[c]&&(i||l[c].data)||r!==t||"string"!=typeof n)return c||(c=u?e[s]=d.pop()||w.guid++:s),l[c]||(l[c]=u?{}:{toJSON:w.noop}),("object"==typeof n||"function"==typeof n)&&(i?l[c]=w.extend(l[c],n):l[c].data=w.extend(l[c].data,n)),a=l[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[w.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[w.camelCase(n)])):o=a,o}}function F(e,t,n){if(w.acceptData(e)){var r,i,o=e.nodeType,a=o?w.cache:e,s=o?e[w.expando]:w.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){w.isArray(t)?t=t.concat(w.map(t,w.camelCase)):t in r?t=[t]:(t=w.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!U(r):!w.isEmptyObject(r))return}(n||(delete a[s].data,U(a[s])))&&(o?w.cleanData([e],!0):w.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}w.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?w.cache[e[w.expando]]:e[w.expando],!!e&&!U(e)},data:function(e,t,n){return z(e,t,n)},removeData:function(e,t){return F(e,t)},_data:function(e,t,n){return z(e,t,n,!0)},_removeData:function(e,t){return F(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&w.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),w.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=w.data(s),1===s.nodeType&&!w._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=w.camelCase(i.slice(5)),H(s,i,o[i]));w._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){w.data(this,e)}):arguments.length>1?this.each(function(){w.data(this,e,n)}):s?H(s,e,w.data(s,e)):null},removeData:function(e){return this.each(function(){w.removeData(this,e)})}});function H(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:q.test(r)?w.parseJSON(r):r}catch(e){}w.data(e,n,r)}else r=t}return r}function U(e){var t;for(t in e)if(("data"!==t||!w.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}w.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=w._data(e,n),r&&(!i||w.isArray(r)?i=w._data(e,n,w.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return w._data(e,n)||w._data(e,n,{empty:w.Callbacks("once memory").add(function(){w._removeData(e,t+"queue"),w._removeData(e,n)})})}}),w.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?w.queue(this[0],e):n===t?this:this.each(function(){var t=w.queue(this,e,n);w._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},delay:function(e,t){return e=w.fx?w.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=w.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=w._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var $,V,W=/[\t\r\n\f]/g,K=/\r/g,G=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,X=/^(?:checked|selected)$/i,Y=w.support.getSetAttribute,Q=w.support.input;w.fn.extend({attr:function(e,t){return w.access(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})},prop:function(e,t){return w.access(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return e=w.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(e){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(w.isFunction(e))return this.each(function(t){w(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(S)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=w.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(w.isFunction(e))return this.each(function(t){w(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(S)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?w.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):w.isFunction(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=w(this),a=e.match(S)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&w._data(this,"__className__",this.className),this.className=this.className||e===!1?"":w._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(W," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=w.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,w(this).val()):e,null==o?o="":"number"==typeof o?o+="":w.isArray(o)&&(o=w.map(o,function(e){return null==e?"":e+""})),r=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=w.valHooks[o.type]||w.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(K,""):null==n?"":n)}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(w.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&w.nodeName(n.parentNode,"optgroup"))){if(t=w(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=w.inArray(w(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?w.prop(e,n,r):(1===s&&w.isXMLDoc(e)||(n=n.toLowerCase(),o=w.attrHooks[n]||(w.expr.match.bool.test(n)?V:$)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=w.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(w.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(S);if(o&&1===e.nodeType)while(n=o[i++])r=w.propFix[n]||n,w.expr.match.bool.test(n)?Q&&Y||!X.test(n)?e[r]=!1:e[w.camelCase("default-"+n)]=e[r]=!1:w.attr(e,n,""),e.removeAttribute(Y?n:r)},attrHooks:{type:{set:function(e,t){if(!w.support.radioValue&&"radio"===t&&w.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{for:"htmlFor",class:"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!w.isXMLDoc(e),a&&(n=w.propFix[n]||n,o=w.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):G.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),V={set:function(e,t,n){return t===!1?w.removeAttr(e,n):Q&&Y||!X.test(n)?e.setAttribute(!Y&&w.propFix[n]||n,n):e[w.camelCase("default-"+n)]=e[n]=!0,n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,n){var r=w.expr.attrHandle[n]||w.find.attr;w.expr.attrHandle[n]=Q&&Y||!X.test(n)?function(e,n,i){var o=w.expr.attrHandle[n],a=i?t:(w.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return w.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[w.camelCase("default-"+n)]?n.toLowerCase():null}}),Q&&Y||(w.attrHooks.value={set:function(e,n,r){return w.nodeName(e,"input")?(e.defaultValue=n,t):$&&$.set(e,n,r)}}),Y||($={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},w.expr.attrHandle.id=w.expr.attrHandle.name=w.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},w.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:$.set},w.attrHooks.contenteditable={set:function(e,t,n){$.set(e,""===t?!1:t,n)}},w.each(["width","height"],function(e,n){w.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),w.support.hrefNormalized||w.each(["href","src"],function(e,t){w.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),w.support.style||(w.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),w.support.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this}),w.support.enctype||(w.propFix.enctype="encoding"),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,n){return w.isArray(n)?e.checked=w.inArray(w(e).val(),n)>=0:t}},w.support.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,ee=/^key/,te=/^(?:mouse|contextmenu)|click/,ne=/^(?:focusinfocus|focusoutblur)$/,re=/^([^.]*)(?:\.(.+)|)$/;function ie(){return!0}function oe(){return!1}function ae(){try{return a.activeElement}catch(e){}}w.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,d,f,p,h,g,v,m,y=w._data(e);if(y){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=w.guid++),(u=y.events)||(u=y.events={}),(f=y.handle)||(f=y.handle=function(e){return typeof w===i||e&&w.event.triggered===e.type?t:w.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(S)||[""],l=n.length;while(l--)s=re.exec(n[l])||[],g=m=s[1],v=(s[2]||"").split(".").sort(),g&&(d=w.event.special[g]||{},g=(a?d.delegateType:d.bindType)||g,d=w.event.special[g]||{},p=w.extend({type:g,origType:m,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&w.expr.match.needsContext.test(a),namespace:v.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,d.setup&&d.setup.call(e,o,v,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),d.add&&(d.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,p):h.push(p),w.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,d,f,p,h,g,v=w.hasData(e)&&w._data(e);if(v&&(c=v.events)){t=(t||"").match(S)||[""],l=t.length;while(l--)if(s=re.exec(t[l])||[],p=g=s[1],h=(s[2]||"").split(".").sort(),p){d=w.event.special[p]||{},p=(r?d.delegateType:d.bindType)||p,f=c[p]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,d.remove&&d.remove.call(e,a));u&&!f.length&&(d.teardown&&d.teardown.call(e,h,v.handle)!==!1||w.removeEvent(e,p,v.handle),delete c[p])}else for(p in c)w.event.remove(e,p+t[l],n,r,!0);w.isEmptyObject(c)&&(delete v.handle,w._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,u,l,c,d,f,p,h=[i||a],g=y.call(n,"type")?n.type:n,v=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!ne.test(g+w.event.triggered)&&(g.indexOf(".")>=0&&(v=g.split("."),g=v.shift(),v.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[w.expando]?n:new w.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=v.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:w.makeArray(r,[n]),d=w.event.special[g]||{},o||!d.trigger||d.trigger.apply(i,r)!==!1)){if(!o&&!d.noBubble&&!w.isWindow(i)){for(c=d.delegateType||g,ne.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}p=0;while((l=h[p++])&&!n.isPropagationStopped())n.type=p>1?c:d.bindType||g,s=(w._data(l,"events")||{})[n.type]&&w._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&w.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!d._default||d._default.apply(h.pop(),r)===!1)&&w.acceptData(i)&&u&&i[g]&&!w.isWindow(i)){f=i[u],f&&(i[u]=null),w.event.triggered=g;try{i[g]()}catch(e){}w.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=w.event.fix(e);var n,r,i,o,a,s=[],u=g.call(arguments),l=(w._data(this,"events")||{})[e.type]||[],c=w.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=w.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((w.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?w(r,this).index(l)>=0:w.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[w.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=te.test(i)?this.mouseHooks:ee.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new w.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ae()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===ae()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return w.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return w.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=w.extend(new w.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?w.event.trigger(i,null,t):w.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},w.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},w.Event=function(e,n){return this instanceof w.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?ie:oe):this.type=e,n&&w.extend(this,n),this.timeStamp=e&&e.timeStamp||w.now(),this[w.expando]=!0,t):new w.Event(e,n)},w.Event.prototype={isDefaultPrevented:oe,isPropagationStopped:oe,isImmediatePropagationStopped:oe,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=ie,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=ie,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ie,this.stopPropagation()}},w.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!w.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.support.submitBubbles||(w.event.special.submit={setup:function(){return w.nodeName(this,"form")?!1:(w.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=w.nodeName(n,"input")||w.nodeName(n,"button")?n.form:t;r&&!w._data(r,"submitBubbles")&&(w.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),w._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&w.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return w.nodeName(this,"form")?!1:(w.event.remove(this,"._submit"),t)}}),w.support.changeBubbles||(w.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(w.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),w.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),w.event.simulate("change",this,e,!0)})),!1):(w.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!w._data(t,"changeBubbles")&&(w.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||w.event.simulate("change",this.parentNode,e,!0)}),w._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return w.event.remove(this,"._change"),!Z.test(this.nodeName)}}),w.support.focusinBubbles||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){w.event.simulate(t,e.target,w.event.fix(e),!0)};w.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),w.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=oe;else if(!i)return this;return 1===o&&(s=i,i=function(e){return w().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=w.guid++)),this.each(function(){w.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,w(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=oe),this.each(function(){w.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?w.event.trigger(e,n,r,!0):t}});var se=/^.[^:#\[\.,]*$/,ue=/^(?:parents|prev(?:Until|All))/,le=w.expr.match.needsContext,ce={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;i>t;t++)if(w.contains(r[t],this))return!0}));for(t=0;i>t;t++)w.find(e,r[t],n);return n=this.pushStack(i>1?w.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=w(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(w.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(fe(this,e||[],!0))},filter:function(e){return this.pushStack(fe(this,e||[],!1))},is:function(e){return!!fe(this,"string"==typeof e&&le.test(e)?w(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=le.test(e)||"string"!=typeof e?w(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?w.unique(o):o)},index:function(e){return e?"string"==typeof e?w.inArray(this[0],w(e)):w.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?w(e,t):w.makeArray(e&&e.nodeType?[e]:e),r=w.merge(this.get(),n);return this.pushStack(w.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function de(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return w.dir(e,"parentNode")},parentsUntil:function(e,t,n){return w.dir(e,"parentNode",n)},next:function(e){return de(e,"nextSibling")},prev:function(e){return de(e,"previousSibling")},nextAll:function(e){return w.dir(e,"nextSibling")},prevAll:function(e){return w.dir(e,"previousSibling")},nextUntil:function(e,t,n){return w.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return w.dir(e,"previousSibling",n)},siblings:function(e){return w.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return w.sibling(e.firstChild)},contents:function(e){return w.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:w.merge([],e.childNodes)}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(ce[e]||(i=w.unique(i)),ue.test(e)&&(i=i.reverse())),this.pushStack(i)}}),w.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!w(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function fe(e,t,n){if(w.isFunction(t))return w.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return w.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(se.test(t))return w.filter(t,e,n);t=w.filter(t,e)}return w.grep(e,function(e){return w.inArray(e,t)>=0!==n})}function pe(e){var t=he.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var he="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ge=/ jQuery\d+="(?:null|\d+)"/g,ve=RegExp("<(?:"+he+")[\\s/>]","i"),me=/^\s+/,ye=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,be=/<([\w:]+)/,we=/<tbody/i,Ce=/<|&#?\w+;/,Se=/<(?:script|style|link)/i,xe=/^(?:checkbox|radio)$/i,Te=/checked\s*(?:[^=]|=\s*.checked.)/i,ke=/^$|\/(?:java|ecma)script/i,Ee=/^true\/(.*)/,Ae=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Ne={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:w.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Ie=pe(a),Re=Ie.appendChild(a.createElement("div"));Ne.optgroup=Ne.option,Ne.tbody=Ne.tfoot=Ne.colgroup=Ne.caption=Ne.thead,Ne.th=Ne.td,w.fn.extend({text:function(e){return w.access(this,function(e){return e===t?w.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=_e(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=_e(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?w.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||w.cleanData(je(n)),n.parentNode&&(t&&w.contains(n.ownerDocument,n)&&Le(je(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&w.cleanData(je(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&w.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return w.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(ge,""):t;if(!("string"!=typeof e||Se.test(e)||!w.support.htmlSerialize&&ve.test(e)||!w.support.leadingWhitespace&&me.test(e)||Ne[(be.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(ye,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(w.cleanData(je(n,!1)),n.innerHTML=e);n=0}catch(e){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=w.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),w(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=p.apply([],e);var r,i,o,a,s,u,l=0,c=this.length,d=this,f=c-1,h=e[0],g=w.isFunction(h);if(g||!(1>=c||"string"!=typeof h||w.support.checkClone)&&Te.test(h))return this.each(function(r){var i=d.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(u=w.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=u.firstChild,1===u.childNodes.length&&(u=r),r)){for(a=w.map(je(u,"script"),Oe),o=a.length;c>l;l++)i=u,l!==f&&(i=w.clone(i,!0,!0),o&&w.merge(a,je(i,"script"))),t.call(this[l],i,l);if(o)for(s=a[a.length-1].ownerDocument,w.map(a,De),l=0;o>l;l++)i=a[l],ke.test(i.type||"")&&!w._data(i,"globalEval")&&w.contains(s,i)&&(i.src?w._evalUrl(i.src):w.globalEval((i.text||i.textContent||i.innerHTML||"").replace(Ae,"")));u=r=null}return this}});function _e(e,t){return w.nodeName(e,"table")&&w.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Oe(e){return e.type=(null!==w.find.attr(e,"type"))+"/"+e.type,e}function De(e){var t=Ee.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Le(e,t){var n,r=0;for(;null!=(n=e[r]);r++)w._data(n,"globalEval",!t||w._data(t[r],"globalEval"))}function Be(e,t){if(1===t.nodeType&&w.hasData(e)){var n,r,i,o=w._data(e),a=w._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)w.event.add(t,n,s[n][r])}a.data&&(a.data=w.extend({},a.data))}}function Me(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!w.support.noCloneEvent&&t[w.expando]){i=w._data(t);for(r in i.events)w.removeEvent(t,r,i.handle);t.removeAttribute(w.expando)}"script"===n&&t.text!==e.text?(Oe(t).text=e.text,De(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),w.support.html5Clone&&e.innerHTML&&!w.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&xe.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){var n,r=0,i=[],o=w(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),w(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function je(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||w.nodeName(o,n)?s.push(o):w.merge(s,je(o,n));return n===t||n&&w.nodeName(e,n)?w.merge([e],s):s}function qe(e){xe.test(e.type)&&(e.defaultChecked=e.checked)}w.extend({clone:function(e,t,n){var r,i,o,a,s,u=w.contains(e.ownerDocument,e);if(w.support.html5Clone||w.isXMLDoc(e)||!ve.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Re.innerHTML=e.outerHTML,Re.removeChild(o=Re.firstChild)),!(w.support.noCloneEvent&&w.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(r=je(o),s=je(e),a=0;null!=(i=s[a]);++a)r[a]&&Me(i,r[a]);if(t)if(n)for(s=s||je(e),r=r||je(o),a=0;null!=(i=s[a]);a++)Be(i,r[a]);else Be(e,o);return r=je(o,"script"),r.length>0&&Le(r,!u&&je(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,d=e.length,f=pe(t),p=[],h=0;for(;d>h;h++)if(o=e[h],o||0===o)if("object"===w.type(o))w.merge(p,o.nodeType?[o]:o);else if(Ce.test(o)){s=s||f.appendChild(t.createElement("div")),u=(be.exec(o)||["",""])[1].toLowerCase(),c=Ne[u]||Ne._default,s.innerHTML=c[1]+o.replace(ye,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!w.support.leadingWhitespace&&me.test(o)&&p.push(t.createTextNode(me.exec(o)[0])),!w.support.tbody){o="table"!==u||we.test(o)?"<table>"!==c[1]||we.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)w.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)}w.merge(p,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else p.push(t.createTextNode(o));s&&f.removeChild(s),w.support.appendChecked||w.grep(je(p,"input"),qe),h=0;while(o=p[h++])if((!r||-1===w.inArray(o,r))&&(a=w.contains(o.ownerDocument,o),s=je(f.appendChild(o),"script"),a&&Le(s),n)){i=0;while(o=s[i++])ke.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=w.expando,l=w.cache,c=w.support.deleteExpando,f=w.event.special;for(;null!=(n=e[s]);s++)if((t||w.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?w.event.remove(n,r):w.removeEvent(n,r,a.handle);
  l[o]&&(delete l[o],c?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,d.push(o))}},_evalUrl:function(e){return w.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})}}),w.fn.extend({wrapAll:function(e){if(w.isFunction(e))return this.each(function(t){w(this).wrapAll(e.call(this,t))});if(this[0]){var t=w(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return w.isFunction(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=w.isFunction(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){w.nodeName(this,"body")||w(this).replaceWith(this.childNodes)}).end()}});var Pe,ze,Fe,He=/alpha\([^)]*\)/i,Ue=/opacity\s*=\s*([^)]*)/,$e=/^(top|right|bottom|left)$/,Ve=/^(none|table(?!-c[ea]).+)/,We=/^margin/,Ke=RegExp("^("+C+")(.*)$","i"),Ge=RegExp("^("+C+")(?!px)[a-z%]+$","i"),Je=RegExp("^([+-])=("+C+")","i"),Xe={BODY:"block"},Ye={position:"absolute",visibility:"hidden",display:"block"},Qe={letterSpacing:0,fontWeight:400},Ze=["Top","Right","Bottom","Left"],et=["Webkit","O","Moz","ms"];function tt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=et.length;while(i--)if(t=et[i]+n,t in e)return t;return r}function nt(e,t){return e=t||e,"none"===w.css(e,"display")||!w.contains(e.ownerDocument,e)}function rt(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=w._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nt(r)&&(o[a]=w._data(r,"olddisplay",st(r.nodeName)))):o[a]||(i=nt(r),(n&&"none"!==n||!i)&&w._data(r,"olddisplay",i?n:w.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}w.fn.extend({css:function(e,n){return w.access(this,function(e,n,r){var i,o,a={},s=0;if(w.isArray(n)){for(o=ze(e),i=n.length;i>s;s++)a[n[s]]=w.css(e,n[s],!1,o);return a}return r!==t?w.style(e,n,r):w.css(e,n)},e,n,arguments.length>1)},show:function(){return rt(this,!0)},hide:function(){return rt(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nt(this)?w(this).show():w(this).hide()})}}),w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:w.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=w.camelCase(n),l=e.style;if(n=w.cssProps[u]||(w.cssProps[u]=tt(l,u)),s=w.cssHooks[n]||w.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Je.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(w.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||w.cssNumber[u]||(r+="px"),w.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(e){}}},css:function(e,n,r,i){var o,a,s,u=w.camelCase(n);return n=w.cssProps[u]||(w.cssProps[u]=tt(e.style,u)),s=w.cssHooks[n]||w.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Fe(e,n,i)),"normal"===a&&n in Qe&&(a=Qe[n]),""===r||r?(o=parseFloat(a),r===!0||w.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(ze=function(t){return e.getComputedStyle(t,null)},Fe=function(e,n,r){var i,o,a,s=r||ze(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||w.contains(e.ownerDocument,e)||(u=w.style(e,n)),Ge.test(u)&&We.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):a.documentElement.currentStyle&&(ze=function(e){return e.currentStyle},Fe=function(e,n,r){var i,o,a,s=r||ze(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Ge.test(u)&&!$e.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function it(e,t,n){var r=Ke.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function ot(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=w.css(e,n+Ze[o],!0,i)),r?("content"===n&&(a-=w.css(e,"padding"+Ze[o],!0,i)),"margin"!==n&&(a-=w.css(e,"border"+Ze[o]+"Width",!0,i))):(a+=w.css(e,"padding"+Ze[o],!0,i),"padding"!==n&&(a+=w.css(e,"border"+Ze[o]+"Width",!0,i)));return a}function at(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=ze(e),a=w.support.boxSizing&&"border-box"===w.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Fe(e,t,o),(0>i||null==i)&&(i=e.style[t]),Ge.test(i))return i;r=a&&(w.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+ot(e,t,n||(a?"border":"content"),r,o)+"px"}function st(e){var t=a,n=Xe[e];return n||(n=ut(e,t),"none"!==n&&n||(Pe=(Pe||w("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pe[0].contentWindow||Pe[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ut(e,t),Pe.detach()),Xe[e]=n),n}function ut(e,t){var n=w(t.createElement(e)).appendTo(t.body),r=w.css(n[0],"display");return n.remove(),r}w.each(["height","width"],function(e,n){w.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Ve.test(w.css(e,"display"))?w.swap(e,Ye,function(){return at(e,n,i)}):at(e,n,i):t},set:function(e,t,r){var i=r&&ze(e);return it(e,t,r?ot(e,n,r,w.support.boxSizing&&"border-box"===w.css(e,"boxSizing",!1,i),i):0)}}}),w.support.opacity||(w.cssHooks.opacity={get:function(e,t){return Ue.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=w.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===w.trim(o.replace(He,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=He.test(o)?o.replace(He,i):o+" "+i)}}),w(function(){w.support.reliableMarginRight||(w.cssHooks.marginRight={get:function(e,n){return n?w.swap(e,{display:"inline-block"},Fe,[e,"marginRight"]):t}}),!w.support.pixelPosition&&w.fn.position&&w.each(["top","left"],function(e,n){w.cssHooks[n]={get:function(e,r){return r?(r=Fe(e,n),Ge.test(r)?w(e).position()[n]+"px":r):t}}})}),w.expr&&w.expr.filters&&(w.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!w.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||w.css(e,"display"))},w.expr.filters.visible=function(e){return!w.expr.filters.hidden(e)}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Ze[r]+t]=o[r]||o[r-2]||o[0];return i}},We.test(e)||(w.cssHooks[e+t].set=it)});var lt=/%20/g,ct=/\[\]$/,dt=/\r?\n/g,ft=/^(?:submit|button|image|reset|file)$/i,pt=/^(?:input|select|textarea|keygen)/i;w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&pt.test(this.nodeName)&&!ft.test(e)&&(this.checked||!xe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:w.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(dt,"\r\n")}}):{name:t.name,value:n.replace(dt,"\r\n")}}).get()}}),w.param=function(e,n){var r,i=[],o=function(e,t){t=w.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=w.ajaxSettings&&w.ajaxSettings.traditional),w.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){o(this.name,this.value)});else for(r in e)ht(r,e[r],n,o);return i.join("&").replace(lt,"+")};function ht(e,t,n,r){var i;if(w.isArray(t))w.each(t,function(t,i){n||ct.test(e)?r(e,i):ht(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==w.type(t))r(e,t);else for(i in t)ht(e+"["+i+"]",t[i],n,r)}w.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var gt,vt,mt=w.now(),yt=/\?/,bt=/#.*$/,wt=/([?&])_=[^&]*/,Ct=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,St=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,xt=/^(?:GET|HEAD)$/,Tt=/^\/\//,kt=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Et=w.fn.load,At={},Nt={},It="*/".concat("*");try{vt=o.href}catch(e){vt=a.createElement("a"),vt.href="",vt=vt.href}gt=kt.exec(vt.toLowerCase())||[];function Rt(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(S)||[];if(w.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,n,r,i){var o={},a=e===Nt;function s(u){var l;return o[u]=!0,w.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Ot(e,n){var r,i,o=w.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&w.extend(!0,e,r),e}w.fn.load=function(e,n,r){if("string"!=typeof e&&Et)return Et.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),w.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&w.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?w("<div>").append(w.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:vt,type:"GET",isLocal:St.test(gt[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":It,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":w.parseJSON,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Ot(Ot(e,w.ajaxSettings),t):Ot(w.ajaxSettings,e)},ajaxPrefilter:Rt(At),ajaxTransport:Rt(Nt),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,d=w.ajaxSetup({},n),f=d.context||d,p=d.context&&(f.nodeType||f.jquery)?w(f):w.event,h=w.Deferred(),g=w.Callbacks("once memory"),v=d.statusCode||{},m={},y={},b=0,C="canceled",x={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Ct.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=y[n]=y[n]||e,m[e]=t),this},overrideMimeType:function(e){return b||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)v[t]=[v[t],e[t]];else x.always(e[x.status]);return this},abort:function(e){var t=e||C;return l&&l.abort(t),T(0,t),this}};if(h.promise(x).complete=g.add,x.success=x.done,x.error=x.fail,d.url=((e||d.url||vt)+"").replace(bt,"").replace(Tt,gt[1]+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=w.trim(d.dataType||"*").toLowerCase().match(S)||[""],null==d.crossDomain&&(r=kt.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]===gt[1]&&r[2]===gt[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(gt[3]||("http:"===gt[1]?"80":"443")))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=w.param(d.data,d.traditional)),_t(At,d,n,x),2===b)return x;u=d.global,u&&0===w.active++&&w.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!xt.test(d.type),o=d.url,d.hasContent||(d.data&&(o=d.url+=(yt.test(o)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=wt.test(o)?o.replace(wt,"$1_="+mt++):o+(yt.test(o)?"&":"?")+"_="+mt++)),d.ifModified&&(w.lastModified[o]&&x.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&x.setRequestHeader("If-None-Match",w.etag[o])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",d.contentType),x.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+It+"; q=0.01":""):d.accepts["*"]);for(i in d.headers)x.setRequestHeader(i,d.headers[i]);if(d.beforeSend&&(d.beforeSend.call(f,x,d)===!1||2===b))return x.abort();C="abort";for(i in{success:1,error:1,complete:1})x[i](d[i]);if(l=_t(Nt,d,n,x)){x.readyState=1,u&&p.trigger("ajaxSend",[x,d]),d.async&&d.timeout>0&&(s=setTimeout(function(){x.abort("timeout")},d.timeout));try{b=1,l.send(m,T)}catch(e){if(!(2>b))throw e;T(-1,e)}}else T(-1,"No Transport");function T(e,n,r,i){var c,m,y,C,S,T=n;2!==b&&(b=2,s&&clearTimeout(s),l=t,a=i||"",x.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(C=Dt(d,x,r)),C=Lt(d,C,x,c),c?(d.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(w.lastModified[o]=S),S=x.getResponseHeader("etag"),S&&(w.etag[o]=S)),204===e||"HEAD"===d.type?T="nocontent":304===e?T="notmodified":(T=C.state,m=C.data,y=C.error,c=!y)):(y=T,(e||!T)&&(T="error",0>e&&(e=0))),x.status=e,x.statusText=(n||T)+"",c?h.resolveWith(f,[m,T,x]):h.rejectWith(f,[x,T,y]),x.statusCode(v),v=t,u&&p.trigger(c?"ajaxSuccess":"ajaxError",[x,d,c?m:y]),g.fireWith(f,[x,T]),u&&(p.trigger("ajaxComplete",[x,d]),--w.active||w.event.trigger("ajaxStop")))}return x},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,n){return w.get(e,t,n,"script")}}),w.each(["get","post"],function(e,n){w[n]=function(e,r,i,o){return w.isFunction(r)&&(o=o||i,i=r,r=t),w.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Dt(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes;while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Lt(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(a=l[u+" "+o]||l["* "+o],!a)for(i in l)if(s=i.split(" "),s[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){a===!0?a=l[i]:l[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),w.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||w("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Bt=[],Mt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Bt.pop()||w.expando+"_"+mt++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Mt.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Mt.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=w.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Mt,"$1"+o):n.jsonp!==!1&&(n.url+=(yt.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||w.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Bt.push(o)),s&&w.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var jt,qt,Pt=0,zt=e.ActiveXObject&&function(){var e;for(e in jt)jt[e](t,!0)};function Ft(){try{return new e.XMLHttpRequest}catch(e){}}function Ht(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}w.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Ft()||Ht()}:Ft,qt=w.ajaxSettings.xhr(),w.support.cors=!!qt&&"withCredentials"in qt,qt=w.support.ajax=!!qt,qt&&w.ajaxTransport(function(n){if(!n.crossDomain||w.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(e){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,d;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=w.noop,zt&&delete jt[a]),i)4!==u.readyState&&u.abort();else{d={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(d.text=u.responseText);try{c=u.statusText}catch(e){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=d.text?200:404}}catch(e){i||o(-1,e)}d&&o(s,c,d,l)},n.async?4===u.readyState?setTimeout(r):(a=++Pt,zt&&(jt||(jt={},w(e).unload(zt)),jt[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Ut,$t,Vt=/^(?:toggle|show|hide)$/,Wt=RegExp("^(?:([+-])=|)("+C+")([a-z%]*)$","i"),Kt=/queueHooks$/,Gt=[en],Jt={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Wt.exec(t),o=i&&i[3]||(w.cssNumber[e]?"":"px"),a=(w.cssNumber[e]||"px"!==o&&+r)&&Wt.exec(w.css(n.elem,e)),s=1,u=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,w.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--u)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Xt(){return setTimeout(function(){Ut=t}),Ut=w.now()}function Yt(e,t,n){var r,i=(Jt[t]||[]).concat(Jt["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function Qt(e,t,n){var r,i,o=0,a=Gt.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Ut||Xt(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Ut||Xt(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(Zt(c,l.opts.specialEasing);a>o;o++)if(r=Gt[o].call(l,e,c,l.opts))return r;return w.map(c,Yt,l),w.isFunction(l.opts.start)&&l.opts.start.call(e,l),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function Zt(e,t){var n,r,i,o,a;for(n in e)if(r=w.camelCase(n),i=t[r],o=e[n],w.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=w.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}w.Animation=w.extend(Qt,{tweener:function(e,t){w.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Jt[n]=Jt[n]||[],Jt[n].unshift(t)},prefilter:function(e,t){t?Gt.unshift(e):Gt.push(e)}});function en(e,t,n){var r,i,o,a,s,u,l=this,c={},d=e.style,f=e.nodeType&&nt(e),p=w._data(e,"fxshow");n.queue||(s=w._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,u=s.empty.fire,s.empty.fire=function(){s.unqueued||u()}),s.unqueued++,l.always(function(){l.always(function(){s.unqueued--,w.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===w.css(e,"display")&&"none"===w.css(e,"float")&&(w.support.inlineBlockNeedsLayout&&"inline"!==st(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",w.support.shrinkWrapBlocks||l.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vt.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=p&&p[r]||w.style(e,r)}if(!w.isEmptyObject(c)){p?"hidden"in p&&(f=p.hidden):p=w._data(e,"fxshow",{}),o&&(p.hidden=!f),f?w(e).show():l.done(function(){w(e).hide()}),l.done(function(){var t;w._removeData(e,"fxshow");for(t in c)w.style(e,t,c[t])});for(r in c)a=Yt(f?p[r]:0,r,l),r in p||(p[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function tn(e,t,n,r,i){return new tn.prototype.init(e,t,n,r,i)}w.Tween=tn,tn.prototype={constructor:tn,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tn.propHooks[this.prop];return e&&e.get?e.get(this):tn.propHooks._default.get(this)},run:function(e){var t,n=tn.propHooks[this.prop];return this.pos=t=this.options.duration?w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tn.propHooks._default.set(this),this}},tn.prototype.init.prototype=tn.prototype,tn.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=w.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[w.cssProps[e.prop]]||w.cssHooks[e.prop])?w.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},tn.propHooks.scrollTop=tn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(nn(t,!0),e,r,i)}}),w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=Qt(this,w.extend({},e),o);(i||w._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=w.timers,a=w._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Kt.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&w.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=w._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function nn(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Ze[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}w.each({slideDown:nn("show"),slideUp:nn("hide"),slideToggle:nn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||w.isFunction(e)&&e,duration:e,easing:n&&t||t&&!w.isFunction(t)&&t};return r.duration=w.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in w.fx.speeds?w.fx.speeds[r.duration]:w.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){w.isFunction(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},w.timers=[],w.fx=tn.prototype.init,w.fx.tick=function(){var e,n=w.timers,r=0;for(Ut=w.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||w.fx.stop(),Ut=t},w.fx.timer=function(e){e()&&w.timers.push(e)&&w.fx.start()},w.fx.interval=13,w.fx.start=function(){$t||($t=setInterval(w.fx.tick,w.fx.interval))},w.fx.stop=function(){clearInterval($t),$t=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fx.step={},w.expr&&w.expr.filters&&(w.expr.filters.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length}),w.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){w.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,w.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=rn(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},w.offset={setOffset:function(e,t,n){var r=w.css(e,"position");"static"===r&&(e.style.position="relative");var i=w(e),o=i.offset(),a=w.css(e,"top"),s=w.css(e,"left"),u=("absolute"===r||"fixed"===r)&&w.inArray("auto",[a,s])>-1,l={},c={},d,f;u?(c=i.position(),d=c.top,f=c.left):(d=parseFloat(a)||0,f=parseFloat(s)||0),w.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+d),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},w.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===w.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),w.nodeName(e[0],"html")||(n=e.offset()),n.top+=w.css(e[0],"borderTopWidth",!0),n.left+=w.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-w.css(r,"marginTop",!0),left:t.left-n.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!w.nodeName(e,"html")&&"static"===w.css(e,"position"))e=e.offsetParent;return e||s})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);w.fn[e]=function(i){return w.access(this,function(e,i,o){var a=rn(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?w(a).scrollLeft():o,r?o:w(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function rn(e){return w.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}w.each({Height:"height",Width:"width"},function(e,n){w.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){w.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return w.access(this,function(n,r,i){var o;return w.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?w.css(n,r,s):w.style(n,r,i,s)},n,a?i:t,a,null)}})}),w.fn.size=function(){return this.length},w.fn.andSelf=w.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=w:(e.jQuery=e.$=w,"function"==typeof define&&define.amd&&define("jquery",[],function(){return w}))})(window);(function(e){if(typeof define==="function"&&define.amd){define(["jquery"],e)}else{e(jQuery)}})(function(e){var t=/\+/g;function n(e){return s.raw?e:encodeURIComponent(e)}function r(e){return s.raw?e:decodeURIComponent(e)}function i(e){return n(s.json?JSON.stringify(e):String(e))}function o(e){if(e.indexOf('"')===0){e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")}try{e=decodeURIComponent(e.replace(t," "));return s.json?JSON.parse(e):e}catch(e){}}function a(t,n){var r=s.raw?t:o(t);return e.isFunction(n)?n(r):r}var s=e.cookie=function(t,o,u){if(o!==undefined&&!e.isFunction(o)){u=e.extend({},s.defaults,u);if(typeof u.expires==="number"){var l=u.expires,c=u.expires=new Date;c.setTime(+c+l*864e5)}return document.cookie=[n(t),"=",i(o),u.expires?"; expires="+u.expires.toUTCString():"",u.path?"; path="+u.path:"",u.domain?"; domain="+u.domain:"",u.secure?"; secure":""].join("")}var d=t?undefined:{};var f=document.cookie?document.cookie.split("; "):[];for(var p=0,h=f.length;p<h;p++){var g=f[p].split("=");var v=r(g.shift());var m=g.join("=");if(t&&t===v){d=a(m,o);break}if(!t&&(m=a(m))!==undefined){d[v]=m}}return d};s.defaults={};e.removeCookie=function(t,n){if(e.cookie(t)===undefined){return false}e.cookie(t,"",e.extend({},n,{expires:-1}));return!e.cookie(t)}});if("undefined"!=typeof jQuery){(function(e){e.imgpreload=function(t,n){n=e.extend({},e.fn.imgpreload.defaults,n instanceof Function?{all:n}:n);if("string"==typeof t){t=new Array(t)}var r=new Array;e.each(t,function(i,o){var a=new Image;var s=o;var u=a;if("string"!=typeof o){s=e(o).attr("src")||e(o).css("background-image").replace(/^url\((?:"|')?(.*)(?:'|")?\)$/gm,"$1");u=o}e(a).bind("load error",function(i){r.push(u);e.data(u,"loaded","error"==i.type?false:true);if(n.each instanceof Function){n.each.call(u)}if(r.length>=t.length&&n.all instanceof Function){n.all.call(r)}e(this).unbind("load error")});a.src=s})};e.fn.imgpreload=function(t){e.imgpreload(this,t);return this};e.fn.imgpreload.defaults={each:null,all:null}})(jQuery)}(function(){(function(e){var t=this||(0,eval)("this"),n=t.document,r=t.navigator,i=t.jQuery,o=t.JSON;(function(e){"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?e(module.exports||exports):"function"===typeof define&&define.amd?define(["exports"],e):e(t.ko={})})(function(a){function s(e,t){return null===e||typeof e in c?e===t:!1}function u(e,t,n,r){l.d[e]={init:function(e){l.a.f.set(e,g,{});return{controlsDescendantBindings:!0}},update:function(e,i,o,a,s){o=l.a.f.get(e,g);i=l.a.c(i());a=!n!==!i;var u=!o.ob;if(u||t||a!==o.Db)u&&(o.ob=l.a.Ya(l.e.childNodes(e),!0)),a?(u||l.e.S(e,l.a.Ya(o.ob)),l.Ta(r?r(s,i):s,e)):l.e.Z(e),o.Db=a}};l.g.Y[e]=!1;l.e.P[e]=!0}var l="undefined"!==typeof a?a:{};l.b=function(e,t){for(var n=e.split("."),r=l,i=0;i<n.length-1;i++)r=r[n[i]];r[n[n.length-1]]=t};l.s=function(e,t,n){e[t]=n};l.version="3.0.0";l.b("version",l.version);l.a=function(){function a(e,t){for(var n in e)e.hasOwnProperty(n)&&t(n,e[n])}function s(e,t){if("input"!==l.a.v(e)||!e.type||"click"!=t.toLowerCase())return!1;var n=e.type;return"checkbox"==n||"radio"==n;
  }var u={},c={};u[r&&/Firefox\/2/i.test(r.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];u.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");a(u,function(e,t){if(t.length)for(var n=0,r=t.length;n<r;n++)c[t[n]]=e});var d={propertychange:!0},f=n&&function(){for(var t=3,r=n.createElement("div"),i=r.getElementsByTagName("i");r.innerHTML="<!--[if gt IE "+ ++t+"]><i></i><![endif]-->",i[0];);return 4<t?t:e}();return{$a:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],n:function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n])},l:function(e,t){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(e,t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},Ua:function(e,t,n){for(var r=0,i=e.length;r<i;r++)if(t.call(n,e[r]))return e[r];return null},ia:function(e,t){var n=l.a.l(e,t);0<=n&&e.splice(n,1)},Va:function(e){e=e||[];for(var t=[],n=0,r=e.length;n<r;n++)0>l.a.l(t,e[n])&&t.push(e[n]);return t},ha:function(e,t){e=e||[];for(var n=[],r=0,i=e.length;r<i;r++)n.push(t(e[r]));return n},ga:function(e,t){e=e||[];for(var n=[],r=0,i=e.length;r<i;r++)t(e[r])&&n.push(e[r]);return n},X:function(e,t){if(t instanceof Array)e.push.apply(e,t);else for(var n=0,r=t.length;n<r;n++)e.push(t[n]);return e},V:function(e,t,n){var r=l.a.l(l.a.Ha(e),t);0>r?n&&e.push(t):n||e.splice(r,1)},extend:function(e,t){if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},K:a,Da:function(e,t){if(!e)return e;var n={},r;for(r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r],r,e));return n},wa:function(e){for(;e.firstChild;)l.removeNode(e.firstChild)},Vb:function(e){e=l.a.Q(e);for(var t=n.createElement("div"),r=0,i=e.length;r<i;r++)t.appendChild(l.L(e[r]));return t},Ya:function(e,t){for(var n=0,r=e.length,i=[];n<r;n++){var o=e[n].cloneNode(!0);i.push(t?l.L(o):o)}return i},S:function(e,t){l.a.wa(e);if(t)for(var n=0,r=t.length;n<r;n++)e.appendChild(t[n])},nb:function(e,t){var n=e.nodeType?[e]:e;if(0<n.length){for(var r=n[0],i=r.parentNode,o=0,a=t.length;o<a;o++)i.insertBefore(t[o],r);o=0;for(a=n.length;o<a;o++)l.removeNode(n[o])}},$:function(e,t){if(e.length){for(t=8===t.nodeType&&t.parentNode||t;e.length&&e[0].parentNode!==t;)e.splice(0,1);if(1<e.length){var n=e[0],r=e[e.length-1];for(e.length=0;n!==r;)if(e.push(n),n=n.nextSibling,!n)return;e.push(r)}}return e},qb:function(e,t){7>f?e.setAttribute("selected",t):e.selected=t},la:function(t){return null===t||t===e?"":t.trim?t.trim():t.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},ec:function(e,t){for(var n=[],r=(e||"").split(t),i=0,o=r.length;i<o;i++){var a=l.a.la(r[i]);""!==a&&n.push(a)}return n},ac:function(e,t){e=e||"";return t.length>e.length?!1:e.substring(0,t.length)===t},Gb:function(e,t){if(e===t)return!0;if(11===e.nodeType)return!1;if(t.contains)return t.contains(3===e.nodeType?e.parentNode:e);if(t.compareDocumentPosition)return 16==(t.compareDocumentPosition(e)&16);for(;e&&e!=t;)e=e.parentNode;return!!e},va:function(e){return l.a.Gb(e,e.ownerDocument.documentElement)},Ra:function(e){return!!l.a.Ua(e,l.a.va)},v:function(e){return e&&e.tagName&&e.tagName.toLowerCase()},r:function(e,t,n){var r=f&&d[t];if(r||"undefined"==typeof i)if(r||"function"!=typeof e.addEventListener)if("undefined"!=typeof e.attachEvent){var o=function(t){n.call(e,t)},a="on"+t;e.attachEvent(a,o);l.a.C.ea(e,function(){e.detachEvent(a,o)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else e.addEventListener(t,n,!1);else{if(s(e,t)){var u=n;n=function(e,t){var n=this.checked;t&&(this.checked=!0!==t.Ab);u.call(this,e);this.checked=n}}i(e).bind(t,n)}},da:function(e,r){if(!e||!e.nodeType)throw Error("element must be a DOM node when calling triggerEvent");if("undefined"!=typeof i){var o=[];s(e,r)&&o.push({Ab:e.checked});i(e).trigger(r,o)}else if("function"==typeof n.createEvent)if("function"==typeof e.dispatchEvent)o=n.createEvent(c[r]||"HTMLEvents"),o.initEvent(r,!0,!0,t,0,0,0,0,0,!1,!1,!1,!1,0,e),e.dispatchEvent(o);else throw Error("The supplied element doesn't support dispatchEvent");else if("undefined"!=typeof e.fireEvent)s(e,r)&&(e.checked=!0!==e.checked),e.fireEvent("on"+r);else throw Error("Browser doesn't support triggering events")},c:function(e){return l.M(e)?e():e},Ha:function(e){return l.M(e)?e.t():e},ma:function(e,t,n){if(t){var r=/\S+/g,i=e.className.match(r)||[];l.a.n(t.match(r),function(e){l.a.V(i,e,n)});e.className=i.join(" ")}},Ma:function(t,r){var i=l.a.c(r);if(null===i||i===e)i="";var o=l.e.firstChild(t);!o||3!=o.nodeType||l.e.nextSibling(o)?l.e.S(t,[n.createTextNode(i)]):o.data=i;l.a.Jb(t)},pb:function(e,t){e.name=t;if(7>=f)try{e.mergeAttributes(n.createElement("<input name='"+e.name+"'/>"),!1)}catch(e){}},Jb:function(e){9<=f&&(e=1==e.nodeType?e:e.parentNode,e.style&&(e.style.zoom=e.style.zoom))},Hb:function(e){if(f){var t=e.style.width;e.style.width=0;e.style.width=t}},Zb:function(e,t){e=l.a.c(e);t=l.a.c(t);for(var n=[],r=e;r<=t;r++)n.push(r);return n},Q:function(e){for(var t=[],n=0,r=e.length;n<r;n++)t.push(e[n]);return t},cc:6===f,dc:7===f,ja:f,ab:function(e,t){for(var n=l.a.Q(e.getElementsByTagName("input")).concat(l.a.Q(e.getElementsByTagName("textarea"))),r="string"==typeof t?function(e){return e.name===t}:function(e){return t.test(e.name)},i=[],o=n.length-1;0<=o;o--)r(n[o])&&i.push(n[o]);return i},Wb:function(e){return"string"==typeof e&&(e=l.a.la(e))?o&&o.parse?o.parse(e):new Function("return "+e)():null},Na:function(e,t,n){if(!o||!o.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return o.stringify(l.a.c(e),t,n)},Xb:function(e,t,r){r=r||{};var i=r.params||{},o=r.includeFields||this.$a,s=e;if("object"==typeof e&&"form"===l.a.v(e))for(var s=e.action,u=o.length-1;0<=u;u--)for(var c=l.a.ab(e,o[u]),d=c.length-1;0<=d;d--)i[c[d].name]=c[d].value;t=l.a.c(t);var f=n.createElement("form");f.style.display="none";f.action=s;f.method="post";for(var p in t)e=n.createElement("input"),e.name=p,e.value=l.a.Na(l.a.c(t[p])),f.appendChild(e);a(i,function(e,t){var r=n.createElement("input");r.name=e;r.value=t;f.appendChild(r)});n.body.appendChild(f);r.submitter?r.submitter(f):f.submit();setTimeout(function(){f.parentNode.removeChild(f)},0)}}}();l.b("utils",l.a);l.b("utils.arrayForEach",l.a.n);l.b("utils.arrayFirst",l.a.Ua);l.b("utils.arrayFilter",l.a.ga);l.b("utils.arrayGetDistinctValues",l.a.Va);l.b("utils.arrayIndexOf",l.a.l);l.b("utils.arrayMap",l.a.ha);l.b("utils.arrayPushAll",l.a.X);l.b("utils.arrayRemoveItem",l.a.ia);l.b("utils.extend",l.a.extend);l.b("utils.fieldsIncludedWithJsonPost",l.a.$a);l.b("utils.getFormFields",l.a.ab);l.b("utils.peekObservable",l.a.Ha);l.b("utils.postJson",l.a.Xb);l.b("utils.parseJson",l.a.Wb);l.b("utils.registerEventHandler",l.a.r);l.b("utils.stringifyJson",l.a.Na);l.b("utils.range",l.a.Zb);l.b("utils.toggleDomNodeCssClass",l.a.ma);l.b("utils.triggerEvent",l.a.da);l.b("utils.unwrapObservable",l.a.c);l.b("utils.objectForEach",l.a.K);l.b("utils.addOrRemoveItem",l.a.V);l.b("unwrap",l.a.c);Function.prototype.bind||(Function.prototype.bind=function(e){var t=this,n=Array.prototype.slice.call(arguments);e=n.shift();return function(){return t.apply(e,n.concat(Array.prototype.slice.call(arguments)))}});l.a.f=new function(){function t(t,o){var a=t[r];if(!a||"null"===a||!i[a]){if(!o)return e;a=t[r]="ko"+n++;i[a]={}}return i[a]}var n=0,r="__ko__"+(new Date).getTime(),i={};return{get:function(n,r){var i=t(n,!1);return i===e?e:i[r]},set:function(n,r,i){if(i!==e||t(n,!1)!==e)t(n,!0)[r]=i},clear:function(e){var t=e[r];return t?(delete i[t],e[r]=null,!0):!1},D:function(){return n++ +r}}};l.b("utils.domData",l.a.f);l.b("utils.domData.clear",l.a.f.clear);l.a.C=new function(){function t(t,n){var i=l.a.f.get(t,r);i===e&&n&&(i=[],l.a.f.set(t,r,i));return i}function n(e){var r=t(e,!1);if(r)for(var r=r.slice(0),o=0;o<r.length;o++)r[o](e);l.a.f.clear(e);"function"==typeof i&&"function"==typeof i.cleanData&&i.cleanData([e]);if(a[e.nodeType])for(r=e.firstChild;e=r;)r=e.nextSibling,8===e.nodeType&&n(e)}var r=l.a.f.D(),o={1:!0,8:!0,9:!0},a={1:!0,9:!0};return{ea:function(e,n){if("function"!=typeof n)throw Error("Callback must be a function");t(e,!0).push(n)},mb:function(n,i){var o=t(n,!1);o&&(l.a.ia(o,i),0==o.length&&l.a.f.set(n,r,e))},L:function(e){if(o[e.nodeType]&&(n(e),a[e.nodeType])){var t=[];l.a.X(t,e.getElementsByTagName("*"));for(var r=0,i=t.length;r<i;r++)n(t[r])}return e},removeNode:function(e){l.L(e);e.parentNode&&e.parentNode.removeChild(e)}}};l.L=l.a.C.L;l.removeNode=l.a.C.removeNode;l.b("cleanNode",l.L);l.b("removeNode",l.removeNode);l.b("utils.domNodeDisposal",l.a.C);l.b("utils.domNodeDisposal.addDisposeCallback",l.a.C.ea);l.b("utils.domNodeDisposal.removeDisposeCallback",l.a.C.mb);(function(){l.a.Fa=function(e){var r;if("undefined"!=typeof i)if(i.parseHTML)r=i.parseHTML(e)||[];else{if((r=i.clean([e]))&&r[0]){for(e=r[0];e.parentNode&&11!==e.parentNode.nodeType;)e=e.parentNode;e.parentNode&&e.parentNode.removeChild(e)}}else{var o=l.a.la(e).toLowerCase();r=n.createElement("div");o=o.match(/^<(thead|tbody|tfoot)/)&&[1,"<table>","</table>"]||!o.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!o.indexOf("<td")||!o.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];e="ignored<div>"+o[1]+e+o[2]+"</div>";for("function"==typeof t.innerShiv?r.appendChild(t.innerShiv(e)):r.innerHTML=e;o[0]--;)r=r.lastChild;r=l.a.Q(r.lastChild.childNodes)}return r};l.a.Ka=function(t,n){l.a.wa(t);n=l.a.c(n);if(null!==n&&n!==e)if("string"!=typeof n&&(n=n.toString()),"undefined"!=typeof i)i(t).html(n);else for(var r=l.a.Fa(n),o=0;o<r.length;o++)t.appendChild(r[o])}})();l.b("utils.parseHtmlFragment",l.a.Fa);l.b("utils.setHtml",l.a.Ka);l.u=function(){function t(e,n){if(e)if(8==e.nodeType){var r=l.u.jb(e.nodeValue);null!=r&&n.push({Fb:e,Tb:r})}else if(1==e.nodeType)for(var r=0,i=e.childNodes,o=i.length;r<o;r++)t(i[r],n)}var n={};return{Ca:function(e){if("function"!=typeof e)throw Error("You can only pass a function to ko.memoization.memoize()");var t=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);n[t]=e;return"<!--[ko_memo:"+t+"]-->"},ub:function(t,r){var i=n[t];if(i===e)throw Error("Couldn't find any memo with ID "+t+". Perhaps it's already been unmemoized.");try{return i.apply(null,r||[]),!0}finally{delete n[t]}},vb:function(e,n){var r=[];t(e,r);for(var i=0,o=r.length;i<o;i++){var a=r[i].Fb,s=[a];n&&l.a.X(s,n);l.u.ub(r[i].Tb,s);a.nodeValue="";a.parentNode&&a.parentNode.removeChild(a)}},jb:function(e){return(e=e.match(/^\[ko_memo\:(.*?)\]$/))?e[1]:null}}}();l.b("memoization",l.u);l.b("memoization.memoize",l.u.Ca);l.b("memoization.unmemoize",l.u.ub);l.b("memoization.parseMemoText",l.u.jb);l.b("memoization.unmemoizeDomNodeAndDescendants",l.u.vb);l.xa={throttle:function(e,t){e.throttleEvaluation=t;var n=null;return l.h({read:e,write:function(r){clearTimeout(n);n=setTimeout(function(){e(r)},t)}})},notify:function(e,t){e.equalityComparer="always"==t?null:s}};var c={undefined:1,boolean:1,number:1,string:1};l.b("extenders",l.xa);l.sb=function(e,t,n){this.target=e;this.qa=t;this.Eb=n;l.s(this,"dispose",this.B)};l.sb.prototype.B=function(){this.Qb=!0;this.Eb()};l.ca=function(){this.F={};l.a.extend(this,l.ca.fn);l.s(this,"subscribe",this.T);l.s(this,"extend",this.extend);l.s(this,"getSubscriptionsCount",this.Lb)};var d="change";l.ca.fn={T:function(e,t,n){n=n||d;var r=new l.sb(this,t?e.bind(t):e,function(){l.a.ia(this.F[n],r)}.bind(this));this.F[n]||(this.F[n]=[]);this.F[n].push(r);return r},notifySubscribers:function(e,t){t=t||d;if(this.cb(t))try{l.i.Wa();for(var n=this.F[t].slice(0),r=0,i;i=n[r];++r)i&&!0!==i.Qb&&i.qa(e)}finally{l.i.end()}},cb:function(e){return this.F[e]&&this.F[e].length},Lb:function(){var e=0;l.a.K(this.F,function(t,n){e+=n.length});return e},extend:function(e){var t=this;e&&l.a.K(e,function(e,n){var r=l.xa[e];"function"==typeof r&&(t=r(t,n)||t)});return t}};l.fb=function(e){return null!=e&&"function"==typeof e.T&&"function"==typeof e.notifySubscribers};l.b("subscribable",l.ca);l.b("isSubscribable",l.fb);l.i=function(){var e=[];return{Wa:function(t){e.push(t&&{qa:t,Za:[]})},end:function(){e.pop()},lb:function(t){if(!l.fb(t))throw Error("Only subscribable things can act as dependencies");if(0<e.length){var n=e[e.length-1];!n||0<=l.a.l(n.Za,t)||(n.Za.push(t),n.qa(t))}},p:function(t,n,r){try{return e.push(null),t.apply(n,r||[])}finally{e.pop()}}}}();l.q=function(e){function t(){if(0<arguments.length)return t.equalityComparer&&t.equalityComparer(n,arguments[0])||(t.O(),n=arguments[0],t.N()),this;l.i.lb(t);return n}var n=e;l.ca.call(t);t.t=function(){return n};t.N=function(){t.notifySubscribers(n)};t.O=function(){t.notifySubscribers(n,"beforeChange")};l.a.extend(t,l.q.fn);l.s(t,"peek",t.t);l.s(t,"valueHasMutated",t.N);l.s(t,"valueWillMutate",t.O);return t};l.q.fn={equalityComparer:s};var f=l.q.Yb="__ko_proto__";l.q.fn[f]=l.q;l.ya=function(t,n){return null===t||t===e||t[f]===e?!1:t[f]===n?!0:l.ya(t[f],n)};l.M=function(e){return l.ya(e,l.q)};l.gb=function(e){return"function"==typeof e&&e[f]===l.q||"function"==typeof e&&e[f]===l.h&&e.Nb?!0:!1};l.b("observable",l.q);l.b("isObservable",l.M);l.b("isWriteableObservable",l.gb);l.ba=function(e){e=e||[];if("object"!=typeof e||!("length"in e))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");e=l.q(e);l.a.extend(e,l.ba.fn);return e.extend({trackArrayChanges:!0})};l.ba.fn={remove:function(e){for(var t=this.t(),n=[],r="function"!=typeof e||l.M(e)?function(t){return t===e}:e,i=0;i<t.length;i++){var o=t[i];r(o)&&(0===n.length&&this.O(),n.push(o),t.splice(i,1),i--)}n.length&&this.N();return n},removeAll:function(t){if(t===e){var n=this.t(),r=n.slice(0);this.O();n.splice(0,n.length);this.N();return r}return t?this.remove(function(e){return 0<=l.a.l(t,e)}):[]},destroy:function(e){var t=this.t(),n="function"!=typeof e||l.M(e)?function(t){return t===e}:e;this.O();for(var r=t.length-1;0<=r;r--)n(t[r])&&(t[r]._destroy=!0);this.N()},destroyAll:function(t){return t===e?this.destroy(function(){return!0}):t?this.destroy(function(e){return 0<=l.a.l(t,e)}):[]},indexOf:function(e){var t=this();return l.a.l(t,e)},replace:function(e,t){var n=this.indexOf(e);0<=n&&(this.O(),this.t()[n]=t,this.N())}};l.a.n("pop push reverse shift sort splice unshift".split(" "),function(e){l.ba.fn[e]=function(){var t=this.t();this.O();this.Xa(t,e,arguments);t=t[e].apply(t,arguments);this.N();return t}});l.a.n(["slice"],function(e){l.ba.fn[e]=function(){var t=this();return t[e].apply(t,arguments)}});l.b("observableArray",l.ba);var p="arrayChange";l.xa.trackArrayChanges=function(e){function t(){if(!n){n=!0;var t=e.notifySubscribers;e.notifySubscribers=function(e,n){n&&n!==d||++i;return t.apply(this,arguments)};var o=[].concat(e.t()||[]);r=null;e.T(function(t){t=[].concat(t||[]);if(e.cb(p)){var n;if(!r||1<i)r=l.a.ra(o,t,{sparse:!0});n=r;n.length&&e.notifySubscribers(n,p)}o=t;r=null;i=0})}}if(!e.Xa){var n=!1,r=null,i=0,o=e.T;e.T=e.subscribe=function(e,n,r){r===p&&t();return o.apply(this,arguments)};e.Xa=function(e,t,o){function a(e,t,n){s.push({status:e,value:t,index:n})}if(n&&!i){var s=[],u=e.length,l=o.length,c=0;switch(t){case"push":c=u;case"unshift":for(t=0;t<l;t++)a("added",o[t],c+t);break;case"pop":c=u-1;case"shift":u&&a("deleted",e[c],c);break;case"splice":t=Math.min(Math.max(0,0>o[0]?u+o[0]:o[0]),u);for(var u=1===l?u:Math.min(t+(o[1]||0),u),l=t+l-2,c=Math.max(u,l),d=2;t<c;++t,++d)t<u&&a("deleted",e[t],t),t<l&&a("added",o[d],t);break;default:return}r=s}}}};l.h=function(t,n,r){function i(){l.a.n(w,function(e){e.B()});w=[]}function o(){var e=s.throttleEvaluation;e&&0<=e?(clearTimeout(C),C=setTimeout(a,e)):a()}function a(){if(!f){if(y&&y()){if(!p){b();d=!0;return}}else p=!1;f=!0;try{var t=l.a.ha(w,function(e){return e.target});l.i.Wa(function(n){var r;0<=(r=l.a.l(t,n))?t[r]=e:w.push(n.T(o))});for(var r=n?h.call(n):h(),i=t.length-1;0<=i;i--)t[i]&&w.splice(i,1)[0].B();d=!0;s.equalityComparer&&s.equalityComparer(c,r)||(s.notifySubscribers(c,"beforeChange"),c=r,s.notifySubscribers(c))}finally{l.i.end(),f=!1}w.length||b()}}function s(){if(0<arguments.length){if("function"===typeof g)g.apply(n,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}d||a();l.i.lb(s);return c}function u(){return!d||0<w.length}var c,d=!1,f=!1,p=!1,h=t;h&&"object"==typeof h?(r=h,h=r.read):(r=r||{},h||(h=r.read));if("function"!=typeof h)throw Error("Pass a function that returns the value of the ko.computed");var g=r.write,v=r.disposeWhenNodeIsRemoved||r.I||null,m=r.disposeWhen||r.ua,y=m,b=i,w=[],C=null;n||(n=r.owner);s.t=function(){d||a();return c};s.Kb=function(){return w.length};s.Nb="function"===typeof r.write;s.B=function(){b()};s.aa=u;l.ca.call(s);l.a.extend(s,l.h.fn);l.s(s,"peek",s.t);l.s(s,"dispose",s.B);l.s(s,"isActive",s.aa);l.s(s,"getDependenciesCount",s.Kb);v&&(p=!0,v.nodeType&&(y=function(){return!l.a.va(v)||m&&m()}));!0!==r.deferEvaluation&&a();v&&u()&&(b=function(){l.a.C.mb(v,b);i()},l.a.C.ea(v,b));return s};l.Pb=function(e){return l.ya(e,l.h)};a=l.q.Yb;l.h[a]=l.q;l.h.fn={equalityComparer:s};l.h.fn[a]=l.h;l.b("dependentObservable",l.h);l.b("computed",l.h);l.b("isComputed",l.Pb);(function(){function t(i,o,a){a=a||new r;i=o(i);if("object"!=typeof i||null===i||i===e||i instanceof Date||i instanceof String||i instanceof Number||i instanceof Boolean)return i;var s=i instanceof Array?[]:{};a.save(i,s);n(i,function(n){var r=o(i[n]);switch(typeof r){case"boolean":case"number":case"string":case"function":s[n]=r;break;case"object":case"undefined":var u=a.get(r);s[n]=u!==e?u:t(r,o,a)}});return s}function n(e,t){if(e instanceof Array){for(var n=0;n<e.length;n++)t(n);"function"==typeof e.toJSON&&t("toJSON")}else for(n in e)t(n)}function r(){this.keys=[];this.Qa=[]}l.tb=function(e){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return t(e,function(e){for(var t=0;l.M(e)&&10>t;t++)e=e();return e})};l.toJSON=function(e,t,n){e=l.tb(e);return l.a.Na(e,t,n)};r.prototype={save:function(e,t){var n=l.a.l(this.keys,e);0<=n?this.Qa[n]=t:(this.keys.push(e),this.Qa.push(t))},get:function(t){t=l.a.l(this.keys,t);return 0<=t?this.Qa[t]:e}}})();l.b("toJS",l.tb);l.b("toJSON",l.toJSON);(function(){l.k={o:function(t){switch(l.a.v(t)){case"option":return!0===t.__ko__hasDomDataOptionValue__?l.a.f.get(t,l.d.options.Ea):7>=l.a.ja?t.getAttributeNode("value")&&t.getAttributeNode("value").specified?t.value:t.text:t.value;case"select":return 0<=t.selectedIndex?l.k.o(t.options[t.selectedIndex]):e;default:return t.value}},na:function(t,n){switch(l.a.v(t)){case"option":switch(typeof n){case"string":l.a.f.set(t,l.d.options.Ea,e);"__ko__hasDomDataOptionValue__"in t&&delete t.__ko__hasDomDataOptionValue__;t.value=n;break;default:l.a.f.set(t,l.d.options.Ea,n),t.__ko__hasDomDataOptionValue__=!0,t.value="number"===typeof n?n:""}break;case"select":""===n&&(n=e);if(null===n||n===e)t.selectedIndex=-1;for(var r=t.options.length-1;0<=r;r--)if(l.k.o(t.options[r])==n){t.selectedIndex=r;break}1<t.size||-1!==t.selectedIndex||(t.selectedIndex=0);break;default:if(null===n||n===e)n="";t.value=n}}}})();l.b("selectExtensions",l.k);l.b("selectExtensions.readValue",l.k.o);l.b("selectExtensions.writeValue",l.k.na);l.g=function(){function e(e){e=l.a.la(e);123===e.charCodeAt(0)&&(e=e.slice(1,-1));var t=[],n=e.match(r),a,s,u=0;if(n){n.push(",");for(var c=0,d;d=n[c];++c){var f=d.charCodeAt(0);if(44===f){if(0>=u){a&&t.push(s?{key:a,value:s.join("")}:{unknown:a});a=s=u=0;continue}}else if(58===f){if(!s)continue}else if(47===f&&c&&1<d.length)(f=n[c-1].match(i))&&!o[f[0]]&&(e=e.substr(e.indexOf(d)+1),n=e.match(r),n.push(","),c=-1,d="/");else if(40===f||123===f||91===f)++u;else if(41===f||125===f||93===f)--u;else if(!a&&!s){a=34===f||39===f?d.slice(1,-1):d;continue}s?s.push(d):s=[d]}}return t}var t=["true","false","null","undefined"],n=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,r=RegExp("\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|/(?:[^/\\\\]|\\\\.)*/w*|[^\\s:,/][^,\"'{}()/:[\\]]*[^\\s,\"'{}()/:[\\]]|[^\\s]","g"),i=/[\])"'A-Za-z0-9_$]+$/,o={in:1,return:1,typeof:1},a={};return{Y:[],U:a,Ga:e,ka:function(r,i){function o(e,r){var i,d=l.getBindingHandler(e);if(d&&d.preprocess?r=d.preprocess(r,e,o):1){if(d=a[e])i=r,0<=l.a.l(t,i)?i=!1:(d=i.match(n),i=null===d?!1:d[1]?"Object("+d[1]+")"+d[2]:i),d=i;d&&u.push("'"+e+"':function(_z){"+i+"=_z}");c&&(r="function(){return "+r+" }");s.push("'"+e+"':"+r)}}i=i||{};var s=[],u=[],c=i.valueAccessors,d="string"===typeof r?e(r):r;l.a.n(d,function(e){o(e.key||e.unknown,e.value)});u.length&&o("_ko_property_writers","{"+u.join(",")+"}");return s.join(",")},Sb:function(e,t){for(var n=0;n<e.length;n++)if(e[n].key==t)return!0;return!1},oa:function(e,t,n,r,i){if(e&&l.M(e))!l.gb(e)||i&&e.t()===r||e(r);else if((e=t.get("_ko_property_writers"))&&e[n])e[n](r)}}}();l.b("expressionRewriting",l.g);l.b("expressionRewriting.bindingRewriteValidators",l.g.Y);l.b("expressionRewriting.parseObjectLiteral",l.g.Ga);l.b("expressionRewriting.preProcessBindings",l.g.ka);l.b("expressionRewriting._twoWayBindings",l.g.U);l.b("jsonExpressionRewriting",l.g);l.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",l.g.ka);(function(){function e(e){return 8==e.nodeType&&a.test(o?e.text:e.nodeValue)}function t(e){return 8==e.nodeType&&s.test(o?e.text:e.nodeValue)}function r(n,r){for(var i=n,o=1,a=[];i=i.nextSibling;){if(t(i)&&(o--,0===o))return a;a.push(i);e(i)&&o++}if(!r)throw Error("Cannot find closing comment tag to match: "+n.nodeValue);return null}function i(e,t){var n=r(e,t);return n?0<n.length?n[n.length-1].nextSibling:e.nextSibling:null}var o=n&&"<!--test-->"===n.createComment("test").text,a=o?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,s=o?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,u={ul:!0,ol:!0};l.e={P:{},childNodes:function(t){return e(t)?r(t):t.childNodes},Z:function(t){if(e(t)){t=l.e.childNodes(t);for(var n=0,r=t.length;n<r;n++)l.removeNode(t[n])}else l.a.wa(t)},S:function(t,n){if(e(t)){l.e.Z(t);for(var r=t.nextSibling,i=0,o=n.length;i<o;i++)r.parentNode.insertBefore(n[i],r)}else l.a.S(t,n)},kb:function(t,n){e(t)?t.parentNode.insertBefore(n,t.nextSibling):t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)},eb:function(t,n,r){r?e(t)?t.parentNode.insertBefore(n,r.nextSibling):r.nextSibling?t.insertBefore(n,r.nextSibling):t.appendChild(n):l.e.kb(t,n)},firstChild:function(n){return e(n)?!n.nextSibling||t(n.nextSibling)?null:n.nextSibling:n.firstChild},nextSibling:function(n){e(n)&&(n=i(n));return n.nextSibling&&t(n.nextSibling)?null:n.nextSibling},Mb:e,bc:function(e){return(e=(o?e.text:e.nodeValue).match(a))?e[1]:null},ib:function(n){if(u[l.a.v(n)]){var r=n.firstChild;if(r){do if(1===r.nodeType){var o;o=r.firstChild;var a=null;if(o){do if(a)a.push(o);else if(e(o)){var s=i(o,!0);s?o=s:a=[o]}else t(o)&&(a=[o]);while(o=o.nextSibling)}if(o=a)for(a=r.nextSibling,s=0;s<o.length;s++)a?n.insertBefore(o[s],a):n.appendChild(o[s])}while(r=r.nextSibling)}}}}})();l.b("virtualElements",l.e);l.b("virtualElements.allowedBindings",l.e.P);l.b("virtualElements.emptyNode",l.e.Z);l.b("virtualElements.insertAfter",l.e.eb);l.b("virtualElements.prepend",l.e.kb);l.b("virtualElements.setDomNodeChildren",l.e.S);(function(){l.H=function(){this.zb={}};l.a.extend(l.H.prototype,{nodeHasBindings:function(e){switch(e.nodeType){case 1:return null!=e.getAttribute("data-bind");case 8:return l.e.Mb(e);default:return!1}},getBindings:function(e,t){var n=this.getBindingsString(e,t);return n?this.parseBindingsString(n,t,e):null},getBindingAccessors:function(e,t){var n=this.getBindingsString(e,t);return n?this.parseBindingsString(n,t,e,{valueAccessors:!0}):null},getBindingsString:function(e){switch(e.nodeType){case 1:return e.getAttribute("data-bind");case 8:return l.e.bc(e);default:return null}},parseBindingsString:function(e,t,n,r){try{var i=this.zb,o=e+(r&&r.valueAccessors||""),a;if(!(a=i[o])){var s,u="with($context){with($data||{}){return{"+l.g.ka(e,r)+"}}}";s=new Function("$context","$element",u);a=i[o]=s}return a(t,n)}catch(t){throw t.message="Unable to parse bindings.\nBindings value: "+e+"\nMessage: "+t.message,t}}});l.H.instance=new l.H})();l.b("bindingProvider",l.H);(function(){function n(e){return function(){return e}}function r(e){return e()}function i(e){return l.a.Da(l.i.p(e),function(t,n){return function(){return e()[n]}})}function o(e,t){return i(this.getBindings.bind(this,e,t))}function a(e,t,n){var r,i=l.e.firstChild(t),o=l.H.instance,a=o.preprocessNode;if(a){for(;r=i;)i=l.e.nextSibling(r),a.call(o,r);i=l.e.firstChild(t)}for(;r=i;)i=l.e.nextSibling(r),s(e,r,n)}function s(e,t,n){var r=!0,i=1===t.nodeType;i&&l.e.ib(t);if(i&&n||l.H.instance.nodeHasBindings(t))r=c(t,null,e,n).shouldBindDescendants;r&&!f[l.a.v(t)]&&a(e,t,!i)}function u(e){var t=[],n={},r=[];l.a.K(e,function i(o){if(!n[o]){var a=l.getBindingHandler(o);a&&(a.after&&(r.push(o),l.a.n(a.after,function(t){if(e[t]){if(-1!==l.a.l(r,t))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+r.join(", "));i(t)}}),r.pop()),t.push({key:o,bb:a}));n[o]=!0}});return t}function c(t,n,i,a){var s=l.a.f.get(t,p);if(!n){if(s)throw Error("You cannot apply bindings multiple times to the same element.");l.a.f.set(t,p,!0)}!s&&a&&l.rb(t,i);var c;if(n&&"function"!==typeof n)c=n;else{var d=l.H.instance,f=d.getBindingAccessors||o;if(n||i.A){var h=l.h(function(){(c=n?n(i,t):f.call(d,t,i))&&i.A&&i.A();return c},null,{I:t});c&&h.aa()||(h=null)}else c=l.i.p(f,d,[t,i])}var g;if(c){var v=h?function(e){return function(){return r(h()[e])}}:function(e){return c[e]},m=function(){return l.a.Da(h?h():c,r)};m.get=function(e){return c[e]&&r(v(e))};m.has=function(e){return e in c};a=u(c);l.a.n(a,function(n){var r=n.bb.init,o=n.bb.update,a=n.key;if(8===t.nodeType&&!l.e.P[a])throw Error("The binding '"+a+"' cannot be used with virtual elements");try{"function"==typeof r&&l.i.p(function(){var n=r(t,v(a),m,i.$data,i);if(n&&n.controlsDescendantBindings){if(g!==e)throw Error("Multiple bindings ("+g+" and "+a+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");g=a}}),"function"==typeof o&&l.h(function(){o(t,v(a),m,i.$data,i)},null,{I:t})}catch(e){throw e.message='Unable to process binding "'+a+": "+c[a]+'"\nMessage: '+e.message,e}})}return{shouldBindDescendants:g===e}}function d(e){return e&&e instanceof l.G?e:new l.G(e)}l.d={};var f={script:!0};l.getBindingHandler=function(e){return l.d[e]};l.G=function(t,n,r,i){var o=this,a="function"==typeof t,s,u=l.h(function(){var e=a?t():t;n?(n.A&&n.A(),l.a.extend(o,n),u&&(o.A=u)):(o.$parents=[],o.$root=e,o.ko=l);o.$rawData=t;o.$data=e;r&&(o[r]=e);i&&i(o,n,e);return o.$data},null,{ua:function(){return s&&!l.a.Ra(s)},I:!0});u.aa()&&(o.A=u,u.equalityComparer=null,s=[],u.wb=function(t){s.push(t);l.a.C.ea(t,function(t){l.a.ia(s,t);s.length||(u.B(),o.A=u=e)})})};l.G.prototype.createChildContext=function(e,t,n){return new l.G(e,this,t,function(e,t){e.$parentContext=t;e.$parent=t.$data;e.$parents=(t.$parents||[]).slice(0);e.$parents.unshift(e.$parent);n&&n(e)})};l.G.prototype.extend=function(e){return new l.G(this.$rawData,this,null,function(t){l.a.extend(t,"function"==typeof e?e():e)})};var p=l.a.f.D(),h=l.a.f.D();l.rb=function(e,t){if(2==arguments.length)l.a.f.set(e,h,t),t.A&&t.A.wb(e);else return l.a.f.get(e,h)};l.pa=function(e,t,n){1===e.nodeType&&l.e.ib(e);return c(e,t,d(n),!0)};l.xb=function(e,t,r){r=d(r);return l.pa(e,"function"===typeof t?i(t.bind(null,r,e)):l.a.Da(t,n),r)};l.Ta=function(e,t){1!==t.nodeType&&8!==t.nodeType||a(d(e),t,!0)};l.Sa=function(e,n){if(n&&1!==n.nodeType&&8!==n.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");n=n||t.document.body;s(d(e),n,!0)};l.ta=function(t){switch(t.nodeType){case 1:case 8:var n=l.rb(t);if(n)return n;if(t.parentNode)return l.ta(t.parentNode)}return e};l.Cb=function(t){return(t=l.ta(t))?t.$data:e};l.b("bindingHandlers",l.d);l.b("applyBindings",l.Sa);l.b("applyBindingsToDescendants",l.Ta);l.b("applyBindingAccessorsToNode",l.pa);l.b("applyBindingsToNode",l.xb);l.b("contextFor",l.ta);l.b("dataFor",l.Cb)})();var h={class:"className",for:"htmlFor"};l.d.attr={update:function(t,n){var r=l.a.c(n())||{};l.a.K(r,function(n,r){r=l.a.c(r);var i=!1===r||null===r||r===e;i&&t.removeAttribute(n);8>=l.a.ja&&n in h?(n=h[n],i?t.removeAttribute(n):t[n]=r):i||t.setAttribute(n,r.toString());"name"===n&&l.a.pb(t,i?"":r.toString())})}};(function(){l.d.checked={after:["value","attr"],init:function(t,n,r){function i(){return r.has("checkedValue")?l.a.c(r.get("checkedValue")):t.value}function o(){var e=t.checked,o=f?i():e;if(p&&(!u||e)){var a=l.i.p(n);c?d!==o?(e&&(l.a.V(a,o,!0),l.a.V(a,d,!1)),d=o):l.a.V(a,o,e):l.g.oa(a,r,"checked",o,!0)}}function a(){var e=l.a.c(n());t.checked=c?0<=l.a.l(e,i()):s?e:i()===e}var s="checkbox"==t.type,u="radio"==t.type;if(s||u){var c=s&&l.a.c(n())instanceof Array,d=c?i():e,f=u||c,p=!1;u&&!t.name&&l.d.uniqueName.init(t,function(){return!0});l.h(o,null,{I:t});l.a.r(t,"click",o);l.h(a,null,{I:t});p=!0}}};l.g.U.checked=!0;l.d.checkedValue={update:function(e,t){e.value=l.a.c(t())}}})();l.d.css={update:function(e,t){var n=l.a.c(t());"object"==typeof n?l.a.K(n,function(t,n){n=l.a.c(n);l.a.ma(e,t,n)}):(n=String(n||""),l.a.ma(e,e.__ko__cssValue,!1),e.__ko__cssValue=n,l.a.ma(e,n,!0))}};l.d.enable={update:function(e,t){var n=l.a.c(t());n&&e.disabled?e.removeAttribute("disabled"):n||e.disabled||(e.disabled=!0)}};l.d.disable={update:function(e,t){l.d.enable.update(e,function(){return!l.a.c(t())})}};l.d.event={init:function(e,t,n,r,i){var o=t()||{};l.a.K(o,function(o){"string"==typeof o&&l.a.r(e,o,function(e){var a,s=t()[o];if(s){try{var u=l.a.Q(arguments);r=i.$data;u.unshift(r);a=s.apply(r,u)}finally{!0!==a&&(e.preventDefault?e.preventDefault():e.returnValue=!1)}!1===n.get(o+"Bubble")&&(e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation())}})})}};l.d.foreach={hb:function(e){return function(){var t=e(),n=l.a.Ha(t);if(!n||"number"==typeof n.length)return{foreach:t,templateEngine:l.J.Aa};l.a.c(t);return{foreach:n.data,as:n.as,includeDestroyed:n.includeDestroyed,afterAdd:n.afterAdd,beforeRemove:n.beforeRemove,afterRender:n.afterRender,beforeMove:n.beforeMove,afterMove:n.afterMove,templateEngine:l.J.Aa}}},init:function(e,t){return l.d.template.init(e,l.d.foreach.hb(t))},update:function(e,t,n,r,i){return l.d.template.update(e,l.d.foreach.hb(t),n,r,i)}};l.g.Y.foreach=!1;l.e.P.foreach=!0;l.d.hasfocus={init:function(e,t,n){function r(r){e.__ko_hasfocusUpdating=!0;var i=e.ownerDocument;if("activeElement"in i){var o;try{o=i.activeElement}catch(e){o=i.body}r=o===e}i=t();l.g.oa(i,n,"hasfocus",r,!0);e.__ko_hasfocusLastValue=r;e.__ko_hasfocusUpdating=!1}var i=r.bind(null,!0),o=r.bind(null,!1);l.a.r(e,"focus",i);l.a.r(e,"focusin",i);l.a.r(e,"blur",o);l.a.r(e,"focusout",o)},update:function(e,t){var n=!!l.a.c(t());e.__ko_hasfocusUpdating||e.__ko_hasfocusLastValue===n||(n?e.focus():e.blur(),l.i.p(l.a.da,null,[e,n?"focusin":"focusout"]))}};l.g.U.hasfocus=!0;l.d.hasFocus=l.d.hasfocus;l.g.U.hasFocus=!0;l.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){l.a.Ka(e,t())}};var g=l.a.f.D();u("if");u("ifnot",!1,!0);u("with",!0,!1,function(e,t){return e.createChildContext(t)});l.d.options={init:function(e){if("select"!==l.a.v(e))throw Error("options binding applies only to SELECT elements");for(;0<e.length;)e.remove(0);return{controlsDescendantBindings:!0}},update:function(t,r,i){function o(){return l.a.ga(t.options,function(e){return e.selected})}function a(e,t,n){var r=typeof t;return"function"==r?t(e):"string"==r?e[t]:n;
  }function s(e,n){if(f.length){var r=0<=l.a.l(f,l.k.o(n[0]));l.a.qb(n[0],r);h&&!r&&l.i.p(l.a.da,null,[t,"change"])}}var u=0!=t.length&&t.multiple?t.scrollTop:null;r=l.a.c(r());var c=i.get("optionsIncludeDestroyed"),d={},f;f=t.multiple?l.a.ha(o(),l.k.o):0<=t.selectedIndex?[l.k.o(t.options[t.selectedIndex])]:[];if(r){"undefined"==typeof r.length&&(r=[r]);var p=l.a.ga(r,function(t){return c||t===e||null===t||!l.a.c(t._destroy)});i.has("optionsCaption")&&(r=l.a.c(i.get("optionsCaption")),null!==r&&r!==e&&p.unshift(d))}else r=[];var h=!1;r=s;i.has("optionsAfterRender")&&(r=function(t,n){s(0,n);l.i.p(i.get("optionsAfterRender"),null,[n[0],t!==d?t:e])});l.a.Ja(t,p,function(t,r,o){o.length&&(f=o[0].selected?[l.k.o(o[0])]:[],h=!0);r=n.createElement("option");t===d?(l.a.Ma(r,i.get("optionsCaption")),l.k.na(r,e)):(o=a(t,i.get("optionsValue"),t),l.k.na(r,l.a.c(o)),t=a(t,i.get("optionsText"),o),l.a.Ma(r,t));return[r]},null,r);(t.multiple?f.length&&o().length<f.length:f.length&&0<=t.selectedIndex?l.k.o(t.options[t.selectedIndex])!==f[0]:f.length||0<=t.selectedIndex)&&l.i.p(l.a.da,null,[t,"change"]);l.a.Hb(t);u&&20<Math.abs(u-t.scrollTop)&&(t.scrollTop=u)}};l.d.options.Ea=l.a.f.D();l.d.selectedOptions={after:["options","foreach"],init:function(e,t,n){l.a.r(e,"change",function(){var r=t(),i=[];l.a.n(e.getElementsByTagName("option"),function(e){e.selected&&i.push(l.k.o(e))});l.g.oa(r,n,"selectedOptions",i)})},update:function(e,t){if("select"!=l.a.v(e))throw Error("values binding applies only to SELECT elements");var n=l.a.c(t());n&&"number"==typeof n.length&&l.a.n(e.getElementsByTagName("option"),function(e){var t=0<=l.a.l(n,l.k.o(e));l.a.qb(e,t)})}};l.g.U.selectedOptions=!0;l.d.style={update:function(e,t){var n=l.a.c(t()||{});l.a.K(n,function(t,n){n=l.a.c(n);e.style[t]=n||""})}};l.d.submit={init:function(e,t,n,r,i){if("function"!=typeof t())throw Error("The value for a submit binding must be a function");l.a.r(e,"submit",function(n){var r,o=t();try{r=o.call(i.$data,e)}finally{!0!==r&&(n.preventDefault?n.preventDefault():n.returnValue=!1)}})}};l.d.text={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){l.a.Ma(e,t())}};l.e.P.text=!0;l.d.uniqueName={init:function(e,t){if(t()){var n="ko_unique_"+ ++l.d.uniqueName.Bb;l.a.pb(e,n)}}};l.d.uniqueName.Bb=0;l.d.value={after:["options","foreach"],init:function(e,t,n){function r(){a=!1;var r=t(),i=l.k.o(e);l.g.oa(r,n,"value",i)}var i=["change"],o=n.get("valueUpdate"),a=!1;o&&("string"==typeof o&&(o=[o]),l.a.X(i,o),i=l.a.Va(i));!l.a.ja||"input"!=e.tagName.toLowerCase()||"text"!=e.type||"off"==e.autocomplete||e.form&&"off"==e.form.autocomplete||-1!=l.a.l(i,"propertychange")||(l.a.r(e,"propertychange",function(){a=!0}),l.a.r(e,"blur",function(){a&&r()}));l.a.n(i,function(t){var n=r;l.a.ac(t,"after")&&(n=function(){setTimeout(r,0)},t=t.substring(5));l.a.r(e,t,n)})},update:function(e,t){var n="select"===l.a.v(e),r=l.a.c(t()),i=l.k.o(e);r!==i&&(i=function(){l.k.na(e,r)},i(),n&&(r!==l.k.o(e)?l.i.p(l.a.da,null,[e,"change"]):setTimeout(i,0)))}};l.g.U.value=!0;l.d.visible={update:function(e,t){var n=l.a.c(t()),r="none"!=e.style.display;n&&!r?e.style.display="":!n&&r&&(e.style.display="none")}};(function(e){l.d[e]={init:function(t,n,r,i,o){return l.d.event.init.call(this,t,function(){var t={};t[e]=n();return t},r,i,o)}}})("click");l.w=function(){};l.w.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")};l.w.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")};l.w.prototype.makeTemplateSource=function(e,t){if("string"==typeof e){t=t||n;var r=t.getElementById(e);if(!r)throw Error("Cannot find template with ID "+e);return new l.m.j(r)}if(1==e.nodeType||8==e.nodeType)return new l.m.W(e);throw Error("Unknown template type: "+e)};l.w.prototype.renderTemplate=function(e,t,n,r){e=this.makeTemplateSource(e,r);return this.renderTemplateSource(e,t,n)};l.w.prototype.isTemplateRewritten=function(e,t){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(e,t).data("isRewritten")};l.w.prototype.rewriteTemplate=function(e,t,n){e=this.makeTemplateSource(e,n);t=t(e.text());e.text(t);e.data("isRewritten",!0)};l.b("templateEngine",l.w);l.Oa=function(){function e(e,t,n,r){e=l.g.Ga(e);for(var i=l.g.Y,o=0;o<e.length;o++){var a=e[o].key;if(i.hasOwnProperty(a)){var s=i[a];if("function"===typeof s){if(a=s(e[o].value))throw Error(a)}else if(!s)throw Error("This template engine does not support the '"+a+"' binding within its templates")}}n="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+l.g.ka(e,{valueAccessors:!0})+" } })()},'"+n.toLowerCase()+"')";return r.createJavaScriptEvaluatorBlock(n)+t}var t=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,n=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{Ib:function(e,t,n){t.isTemplateRewritten(e,n)||t.rewriteTemplate(e,function(e){return l.Oa.Ub(e,t)},n)},Ub:function(r,i){return r.replace(t,function(t,n,r,o,a){return e(a,n,r,i)}).replace(n,function(t,n){return e(n,"<!-- ko -->","#comment",i)})},yb:function(e,t){return l.u.Ca(function(n,r){var i=n.nextSibling;i&&i.nodeName.toLowerCase()===t&&l.pa(i,e,r)})}}}();l.b("__tr_ambtns",l.Oa.yb);(function(){l.m={};l.m.j=function(e){this.j=e};l.m.j.prototype.text=function(){var e=l.a.v(this.j),e="script"===e?"text":"textarea"===e?"value":"innerHTML";if(0==arguments.length)return this.j[e];var t=arguments[0];"innerHTML"===e?l.a.Ka(this.j,t):this.j[e]=t};var t=l.a.f.D()+"_";l.m.j.prototype.data=function(e){if(1===arguments.length)return l.a.f.get(this.j,t+e);l.a.f.set(this.j,t+e,arguments[1])};var n=l.a.f.D();l.m.W=function(e){this.j=e};l.m.W.prototype=new l.m.j;l.m.W.prototype.text=function(){if(0==arguments.length){var t=l.a.f.get(this.j,n)||{};t.Pa===e&&t.sa&&(t.Pa=t.sa.innerHTML);return t.Pa}l.a.f.set(this.j,n,{Pa:arguments[0]})};l.m.j.prototype.nodes=function(){if(0==arguments.length)return(l.a.f.get(this.j,n)||{}).sa;l.a.f.set(this.j,n,{sa:arguments[0]})};l.b("templateSources",l.m);l.b("templateSources.domElement",l.m.j);l.b("templateSources.anonymousTemplate",l.m.W)})();(function(){function t(e,t,n){var r;for(t=l.e.nextSibling(t);e&&(r=e)!==t;)e=l.e.nextSibling(r),n(r,e)}function n(e,n){if(e.length){var r=e[0],i=e[e.length-1],o=r.parentNode,a=l.H.instance,s=a.preprocessNode;if(s){t(r,i,function(e,t){var n=e.previousSibling,o=s.call(a,e);o&&(e===r&&(r=o[0]||t),e===i&&(i=o[o.length-1]||n))});e.length=0;if(!r)return;r===i?e.push(r):(e.push(r,i),l.a.$(e,o))}t(r,i,function(e){1!==e.nodeType&&8!==e.nodeType||l.Sa(n,e)});t(r,i,function(e){1!==e.nodeType&&8!==e.nodeType||l.u.vb(e,[n])});l.a.$(e,o)}}function r(e){return e.nodeType?e:0<e.length?e[0]:null}function i(e,t,i,a,s){s=s||{};var u=e&&r(e),u=u&&u.ownerDocument,c=s.templateEngine||o;l.Oa.Ib(i,c,u);i=c.renderTemplate(i,a,s,u);if("number"!=typeof i.length||0<i.length&&"number"!=typeof i[0].nodeType)throw Error("Template engine must return an array of DOM nodes");u=!1;switch(t){case"replaceChildren":l.e.S(e,i);u=!0;break;case"replaceNode":l.a.nb(e,i);u=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+t)}u&&(n(i,a),s.afterRender&&l.i.p(s.afterRender,null,[i,a.$data]));return i}var o;l.La=function(t){if(t!=e&&!(t instanceof l.w))throw Error("templateEngine must inherit from ko.templateEngine");o=t};l.Ia=function(t,n,a,s,u){a=a||{};if((a.templateEngine||o)==e)throw Error("Set a template engine before calling renderTemplate");u=u||"replaceChildren";if(s){var c=r(s);return l.h(function(){var e=n&&n instanceof l.G?n:new l.G(l.a.c(n)),o="function"==typeof t?t(e.$data,e):t,e=i(s,u,o,e,a);"replaceNode"==u&&(s=e,c=r(s))},null,{ua:function(){return!c||!l.a.va(c)},I:c&&"replaceNode"==u?c.parentNode:c})}return l.u.Ca(function(e){l.Ia(t,n,a,e,"replaceNode")})};l.$b=function(t,r,o,a,s){function u(e,t){n(t,d);o.afterRender&&o.afterRender(t,e)}function c(e,n){d=s.createChildContext(e,o.as,function(e){e.$index=n});var r="function"==typeof t?t(e,d):t;return i(null,"ignoreTargetNode",r,d,o)}var d;return l.h(function(){var t=l.a.c(r)||[];"undefined"==typeof t.length&&(t=[t]);t=l.a.ga(t,function(t){return o.includeDestroyed||t===e||null===t||!l.a.c(t._destroy)});l.i.p(l.a.Ja,null,[a,t,c,o,u])},null,{I:a})};var a=l.a.f.D();l.d.template={init:function(e,t){var n=l.a.c(t());"string"==typeof n||n.name?l.e.Z(e):(n=l.e.childNodes(e),n=l.a.Vb(n),new l.m.W(e).nodes(n));return{controlsDescendantBindings:!0}},update:function(t,n,r,i,o){n=l.a.c(n());r={};i=!0;var s,u=null;"string"!=typeof n&&(r=n,n=l.a.c(r.name),"if"in r&&(i=l.a.c(r["if"])),i&&"ifnot"in r&&(i=!l.a.c(r.ifnot)),s=l.a.c(r.data));"foreach"in r?u=l.$b(n||t,i&&r.foreach||[],r,t,o):i?(o="data"in r?o.createChildContext(s,r.as):o,u=l.Ia(n||t,o,r,t)):l.e.Z(t);o=u;(s=l.a.f.get(t,a))&&"function"==typeof s.B&&s.B();l.a.f.set(t,a,o&&o.aa()?o:e)}};l.g.Y.template=function(e){e=l.g.Ga(e);return 1==e.length&&e[0].unknown||l.g.Sb(e,"name")?null:"This template engine does not support anonymous templates nested within its templates"};l.e.P.template=!0})();l.b("setTemplateEngine",l.La);l.b("renderTemplate",l.Ia);l.a.ra=function(){function e(e,t,n,r,i){var o=Math.min,a=Math.max,s=[],u,l=e.length,c,d=t.length,f=d-l||1,p=l+d+1,h,g,v;for(u=0;u<=l;u++)for(g=h,s.push(h=[]),v=o(d,u+f),c=a(0,u-1);c<=v;c++)h[c]=c?u?e[u-1]===t[c-1]?g[c-1]:o(g[c]||p,h[c-1]||p)+1:c+1:u+1;o=[];a=[];f=[];u=l;for(c=d;u||c;)d=s[u][c]-1,c&&d===s[u][c-1]?a.push(o[o.length]={status:n,value:t[--c],index:c}):u&&d===s[u-1][c]?f.push(o[o.length]={status:r,value:e[--u],index:u}):(--c,--u,i.sparse||o.push({status:"retained",value:t[c]}));if(a.length&&f.length){e=10*l;var m;for(t=n=0;(i.dontLimitMoves||t<e)&&(m=a[n]);n++){for(r=0;s=f[r];r++)if(m.value===s.value){m.moved=s.index;s.moved=m.index;f.splice(r,1);t=r=0;break}t+=r}}return o.reverse()}return function(t,n,r){r="boolean"===typeof r?{dontLimitMoves:r}:r||{};t=t||[];n=n||[];return t.length<=n.length?e(t,n,"added","deleted",r):e(n,t,"deleted","added",r)}}();l.b("utils.compareArrays",l.a.ra);(function(){function t(t,n,r,i,o){var a=[],s=l.h(function(){var e=n(r,o,l.a.$(a,t))||[];0<a.length&&(l.a.nb(a,e),i&&l.i.p(i,null,[r,e,o]));a.splice(0,a.length);l.a.X(a,e)},null,{I:t,ua:function(){return!l.a.Ra(a)}});return{R:a,h:s.aa()?s:e}}var n=l.a.f.D();l.a.Ja=function(r,i,o,a,s){function u(e,t){C=f[t];m!==t&&(w[e]=C);C.za(m++);l.a.$(C.R,r);g.push(C);b.push(C)}function c(e,t){if(e)for(var n=0,r=t.length;n<r;n++)t[n]&&l.a.n(t[n].R,function(r){e(r,n,t[n].fa)})}i=i||[];a=a||{};var d=l.a.f.get(r,n)===e,f=l.a.f.get(r,n)||[],p=l.a.ha(f,function(e){return e.fa}),h=l.a.ra(p,i,a.dontLimitMoves),g=[],v=0,m=0,y=[],b=[];i=[];for(var w=[],p=[],C,S=0,x,T;x=h[S];S++)switch(T=x.moved,x.status){case"deleted":T===e&&(C=f[v],C.h&&C.h.B(),y.push.apply(y,l.a.$(C.R,r)),a.beforeRemove&&(i[S]=C,b.push(C)));v++;break;case"retained":u(S,v++);break;case"added":T!==e?u(S,T):(C={fa:x.value,za:l.q(m++)},g.push(C),b.push(C),d||(p[S]=C))}c(a.beforeMove,w);l.a.n(y,a.beforeRemove?l.L:l.removeNode);for(var S=0,d=l.e.firstChild(r),k;C=b[S];S++){C.R||l.a.extend(C,t(r,o,C.fa,s,C.za));for(v=0;h=C.R[v];d=h.nextSibling,k=h,v++)h!==d&&l.e.eb(r,h,k);!C.Ob&&s&&(s(C.fa,C.R,C.za),C.Ob=!0)}c(a.beforeRemove,i);c(a.afterMove,w);c(a.afterAdd,p);l.a.f.set(r,n,g)}})();l.b("utils.setDomNodeChildrenFromArrayMapping",l.a.Ja);l.J=function(){this.allowTemplateRewriting=!1};l.J.prototype=new l.w;l.J.prototype.renderTemplateSource=function(e){var t=(9>l.a.ja?0:e.nodes)?e.nodes():null;if(t)return l.a.Q(t.cloneNode(!0).childNodes);e=e.text();return l.a.Fa(e)};l.J.Aa=new l.J;l.La(l.J.Aa);l.b("nativeTemplateEngine",l.J);(function(){l.Ba=function(){var e=this.Rb=function(){if("undefined"==typeof i||!i.tmpl)return 0;try{if(0<=i.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(e){}return 1}();this.renderTemplateSource=function(t,r,o){o=o||{};if(2>e)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var a=t.data("precompiled");a||(a=t.text()||"",a=i.template(null,"{{ko_with $item.koBindingContext}}"+a+"{{/ko_with}}"),t.data("precompiled",a));t=[r.$data];r=i.extend({koBindingContext:r},o.templateOptions);r=i.tmpl(a,t,r);r.appendTo(n.createElement("div"));i.fragments={};return r};this.createJavaScriptEvaluatorBlock=function(e){return"{{ko_code ((function() { return "+e+" })()) }}"};this.addTemplate=function(e,t){n.write("<script type='text/html' id='"+e+"'>"+t+"</script>")};0<e&&(i.tmpl.tag.ko_code={open:"__.push($1 || '');"},i.tmpl.tag.ko_with={open:"with($1) {",close:"} "})};l.Ba.prototype=new l.w;var e=new l.Ba;0<e.Rb&&l.La(e);l.b("jqueryTmplTemplateEngine",l.Ba)})()})})()})();(function(){var e;e=function(e){var t,n;return t=!1,e(function(){var r;return r=(document.body||document.documentElement).style,t=void 0!==r.animation||void 0!==r.WebkitAnimation||void 0!==r.MozAnimation||void 0!==r.MsAnimation||void 0!==r.OAnimation,e(window).bind("keyup.vex",function(e){return 27===e.keyCode?n.closeByEscape():void 0})}),n={globalID:1,animationEndEvent:"animationend webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend",baseClassNames:{vex:"vex",content:"vex-content",overlay:"vex-overlay",close:"vex-close",closing:"vex-closing",open:"vex-open"},defaultOptions:{content:"",showCloseButton:!0,escapeButtonCloses:!0,overlayClosesOnClick:!0,appendLocation:"body",className:"",css:{},overlayClassName:"",overlayCSS:{},contentClassName:"",contentCSS:{},closeClassName:"",closeCSS:{}},open:function(t){return t=e.extend({},n.defaultOptions,t),t.id=n.globalID,n.globalID+=1,t.$vex=e("<div>").addClass(n.baseClassNames.vex).addClass(t.className).css(t.css).data({vex:t}),t.$vexOverlay=e("<div>").addClass(n.baseClassNames.overlay).addClass(t.overlayClassName).css(t.overlayCSS).data({vex:t}),t.overlayClosesOnClick&&t.$vexOverlay.bind("click.vex",function(t){return t.target===this?n.close(e(this).data().vex.id):void 0}),t.$vex.append(t.$vexOverlay),t.$vexContent=e("<div>").addClass(n.baseClassNames.content).addClass(t.contentClassName).css(t.contentCSS).append(t.content).data({vex:t}),t.$vex.append(t.$vexContent),t.showCloseButton&&(t.$closeButton=e("<div>").addClass(n.baseClassNames.close).addClass(t.closeClassName).css(t.closeCSS).data({vex:t}).bind("click.vex",function(){return n.close(e(this).data().vex.id)}),t.$vexContent.append(t.$closeButton)),e(t.appendLocation).append(t.$vex),n.setupBodyClassName(t.$vex),t.afterOpen&&t.afterOpen(t.$vexContent,t),setTimeout(function(){return t.$vexContent.trigger("vexOpen",t)},0),t.$vexContent},getAllVexes:function(){return e("."+n.baseClassNames.vex+':not(".'+n.baseClassNames.closing+'") .'+n.baseClassNames.content)},getVexByID:function(t){return n.getAllVexes().filter(function(){return e(this).data().vex.id===t})},close:function(e){var t;if(!e){if(t=n.getAllVexes().last(),!t.length)return!1;e=t.data().vex.id}return n.closeByID(e)},closeAll:function(){var t;return t=n.getAllVexes().map(function(){return e(this).data().vex.id}).toArray(),(null!=t?t.length:void 0)?(e.each(t.reverse(),function(e,t){return n.closeByID(t)}),!0):!1},closeByID:function(r){var i,o,a,s,u;return o=n.getVexByID(r),o.length?(i=o.data().vex.$vex,u=e.extend({},o.data().vex),a=function(){return u.beforeClose?u.beforeClose(o,u):void 0},s=function(){return o.trigger("vexClose",u),i.remove(),u.afterClose?u.afterClose(o,u):void 0},t?(a(),i.unbind(n.animationEndEvent).bind(n.animationEndEvent,function(){return s()}).addClass(n.baseClassNames.closing)):(a(),s()),!0):void 0},closeByEscape:function(){var t,r,i;return i=n.getAllVexes().map(function(){return e(this).data().vex.id}).toArray(),(null!=i?i.length:void 0)?(r=Math.max.apply(Math,i),t=n.getVexByID(r),t.data().vex.escapeButtonCloses!==!0?!1:n.closeByID(r)):!1},setupBodyClassName:function(t){return t.bind("vexOpen.vex",function(){return e("body").addClass(n.baseClassNames.open)}).bind("vexClose.vex",function(){return n.getAllVexes().length?void 0:e("body").removeClass(n.baseClassNames.open)})},hideLoading:function(){return e(".vex-loading-spinner").remove()},showLoading:function(){return n.hideLoading(),e("body").append('<div class="vex-loading-spinner '+n.defaultOptions.className+'"></div>')}}},"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):window.vex=e(jQuery)}).call(this),function(){var e;e=function(e,t){var n,r;return null==t?e.error("Vex is required to use vex.dialog"):(n=function(t){var n;return n={},e.each(t.serializeArray(),function(){return n[this.name]?(n[this.name].push||(n[this.name]=[n[this.name]]),n[this.name].push(this.value||"")):n[this.name]=this.value||""}),n},r={},r.buttons={YES:{text:"OK",type:"submit",className:"vex-dialog-button-primary"},NO:{text:"Cancel",type:"button",className:"vex-dialog-button-secondary",click:function(e){return e.data().vex.value=!1,t.close(e.data().vex.id)}}},r.defaultOptions={callback:function(){},afterOpen:function(){},message:"Message",input:'<input name="vex" type="hidden" value="_vex-empty-value" />',value:!1,buttons:[r.buttons.YES,r.buttons.NO],showCloseButton:!1,onSubmit:function(i){var o,a;return o=e(this),a=o.parent(),i.preventDefault(),i.stopPropagation(),a.data().vex.value=r.getFormValueOnSubmit(n(o)),t.close(a.data().vex.id)},focusFirstInput:!0},r.defaultAlertOptions={message:"Alert",buttons:[r.buttons.YES]},r.defaultConfirmOptions={message:"Confirm"},r.open=function(n){var i;return n=e.extend({},t.defaultOptions,r.defaultOptions,n),n.content=r.buildDialogForm(n),n.beforeClose=function(e){return n.callback(e.data().vex.value)},i=t.open(n),n.focusFirstInput&&i.find('input[type="submit"], textarea, input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="email"], input[type="month"], input[type="number"], input[type="password"], input[type="search"], input[type="tel"], input[type="text"], input[type="time"], input[type="url"], input[type="week"]').first().focus(),i},r.alert=function(t){return"string"==typeof t&&(t={message:t}),t=e.extend({},r.defaultAlertOptions,t),r.open(t)},r.confirm=function(t){return"string"==typeof t?e.error("dialog.confirm(options) requires options.callback."):(t=e.extend({},r.defaultConfirmOptions,t),r.open(t))},r.prompt=function(t){var n;return"string"==typeof t?e.error("dialog.prompt(options) requires options.callback."):(n={message:'<label for="vex">'+(t.label||"Prompt:")+"</label>",input:'<input name="vex" type="text" class="vex-dialog-prompt-input" placeholder="'+(t.placeholder||"")+'"  value="'+(t.value||"")+'" />'},t=e.extend({},n,t),r.open(t))},r.buildDialogForm=function(t){var n,i,o;return n=e('<form class="vex-dialog-form" />'),o=e('<div class="vex-dialog-message" />'),i=e('<div class="vex-dialog-input" />'),n.append(o.append(t.message)).append(i.append(t.input)).append(r.buttonsToDOM(t.buttons)).bind("submit.vex",t.onSubmit),n},r.getFormValueOnSubmit=function(e){return e.vex||""===e.vex?"_vex-empty-value"===e.vex?!0:e.vex:e},r.buttonsToDOM=function(n){var r;return r=e('<div class="vex-dialog-buttons" />'),e.each(n,function(i,o){return r.append(e('<input type="'+o.type+'" />').val(o.text).addClass(o.className+" vex-dialog-button "+(0===i?"vex-first ":"")+(i===n.length-1?"vex-last ":"")).bind("click.vex",function(n){return o.click?o.click(e(this).parents("."+t.baseClassNames.content),n):void 0}))}),r},r)},"function"==typeof define&&define.amd?define(["jquery","vex"],e):"object"==typeof exports?module.exports=e(require("jquery"),require("vex")):window.vex.dialog=e(window.jQuery,window.vex)}.call(this);ko.bindingHandlers.showFloating={init:function(e,t,n,r){var i,o,a,s,u;u=$(ko.utils.unwrapObservable(t()));o=$(u);i=$(e);a=$(window);s=-8;return a.scroll(function(){var e;e=o.offset().top+s;if(a.scrollTop()>e&&r.isCondensed()){i.addClass("visible");return o.addClass("hidden")}else{i.removeClass("visible");return o.removeClass("hidden")}})}};ko.bindingHandlers.slideVisible={update:function(e,t,n){var r,i;i=ko.unwrap(t());r=n.get("slideDuration")||400;if(i===true){return $(e).slideDown(r)}else{return $(e).slideUp(r)}}};(function(){var e,t,n,r,i;t=window.DominionSets;e=window.DominionKingdoms;i=function(e){var t;t=typeof e==="string"?e:e.id;if(t.indexOf("_")>0){return t.split("_")[0]}else{return t}};r=function(e){return t[e]};n=function(e){var t,n,i,o,a,s,u,l,c,d,f,p,h,g,v,m,y,b,w;if(!e){throw Error("Missing card id.")}a=e.split("_");w=a[0];b=r(w);if(a.length===3&&a[1]==="event"){g=b.events;for(o=0,d=g.length;o<d;o++){i=g[o];if(i.id===e){return i}}throw Error("Unknown card id: "+e)}if(a.length===3&&a[1]==="landmark"){v=b.landmarks;for(s=0,f=v.length;s<f;s++){c=v[s];if(c.id===e){return c}}throw Error("Unknown card id: "+e)}if(a.length===3&&a[1]==="boon"){m=b.boons;for(u=0,p=m.length;u<p;u++){t=m[u];if(t.id===e){return t}}throw Error("Unknown card id: "+e)}y=b.cards;for(l=0,h=y.length;l<h;l++){n=y[l];if(n.id===e){return n}}throw Error("Unknown card id: "+e)};return window.Querier={getSetIdFromObject:i,getSetById:r,getCardById:n}})();(function(){var e;e="/img/cards";return ko.bindingHandlers.cardImage={update:function(t,n,r,i){var o,a;a=n();o=typeof a==="string"?a:a.id;return t.src=e+"/"+o+".jpg"}}})();(function(){var e;ko.bindingHandlers.fadeIn={init:function(t,n,r,i){var o,a;o=$(t);a=ko.unwrap(n());return e(o,a)},update:function(t,n,r,i){var o,a,s;o=$(t);s=ko.unwrap(n());a=Number(o.css("opacity"))===1;if(!!s===a){return}return e(o,s)}};return e=function(e,t){if(t){e.show();return setTimeout(function(){return e.css("opacity",1)},0)}else{e.hide();return e.css("opacity",0)}}})();(function(){var e;ko.bindingHandlers.scaleOffWidthOfImage={init:function(t,n,r,i){var o,a,s,u,l,c;u=ko.unwrap(n());l=ko.unwrap(u.selector);o=$(t);a=o.find(l).eq(0);s=a.get(0);ko.utils.domData.set(t,"image",s);c=e.bind(this,o,s);$(window).resize(c);a.load(c);return c()},update:function(t,n,r,i){var o,a,s,u;s=ko.unwrap(n());u=ko.unwrap(s.trigger);o=$(t);a=ko.utils.domData.get(t,"image");if(!e(o,a)){return setTimeout(e.bind(this,o,a),0)}}};return e=function(e,t){var n,r,i;r=e.height();i=t.naturalHeight/t.naturalWidth;if(i){e.height(e.width()*i)}n=e.height();return r!==n&&n!==0}})();(function(){var e;e=window.Querier;return ko.bindingHandlers.dominionSetName={update:function(t,n,r,i){var o,a,s;s=n();a=e.getSetIdFromObject(s);o=e.getSetById(a);return $(t).html('<span class="set-name '+a+'">'+o.name+"</span>")}}})();(function(){var e;e=window.Querier;return ko.bindingHandlers.dominionSetNames={update:function(t,n,r,i){var o,a,s,u,l,c;c=ko.unwrap(n());o=[];for(a=0,s=c.length;a<s;a++){l=c[a];u=e.getSetById(l);o.push('<span class="set-name '+l+'">'+u.name+"</span>")}return $(t).html(o.join(" "))}}})();(function(){return ko.bindingHandlers.showMenu={init:function(e,t,n,r){return $(window).resize(function(){var t,n,r,i;n=$(e);t=n.children();r=ko.utils.domData.set(e,"showMenu-enabled");i=ko.utils.domData.set(e,"showMenu-show");if(r){return n.height(i?t.outerHeight():0)}})},update:function(e,t){var n,r,i,o,a;a=ko.unwrap(t());i=ko.unwrap(a.enabled);o=ko.unwrap(a.show);r=$(e);ko.utils.domData.set(e,"showMenu-enabled",i);ko.utils.domData.set(e,"showMenu-show",o);if(i){n=r.children();return r.height(o?n.outerHeight():0)}else{return r.css("height","auto")}}}})();(function(){var e;e=window.Querier;return ko.bindingHandlers.withCard={init:function(t,n,r,i,o){var a;a=e.getCardById.bind(null,ko.unwrap(n()));return ko.bindingHandlers["with"].init(t,a,r,i,o)},update:function(t,n,r,i,o){var a;a=e.getCardById.bind(null,ko.unwrap(n()));return ko.bindingHandlers["with"].update(t,a,r,i,o)}}})();(function(){var e,t,n;e=800;t=function(e){return $(document).ready(function(){$.cookie.json=true;ko.applyBindings(e);$(window).resize(n.bind(null,e));return n(e)})};n=function(t){return t.isCondensed($(window).width()<=e)};return window.Setup={initialize:t}})();(function(){var e,t,n;t={LOAD_FULL_KINGDOM_FROM_URL:"LOAD_FULL_KINGDOM_FROM_URL",LOAD_PARTIAL_KINGDOM_FROM_URL:"LOAD_PARTIAL_KINGDOM_FROM_URL",RANDOMIZE_EVENTS_AND_LANDMARKS:"RANDOMIZE_EVENTS_AND_LANDMARKS",RANDOMIZE_KINGDOM:"RANDOMIZE_KINGDOM",RANDOMIZE_MULTIPLE:"RANDOMIZE_MULTIPLE",RANDOMIZE_SINGLE:"RANDOMIZE_SINGLE"};e={ERROR:"error",EVENT:"event"};n=function(){function t(){}t.trackEvent=function(n){return t.attemptToSend(e.EVENT,n)};t.trackError=function(n){return t.attemptToSend(e.ERROR,n)};t.attemptToSend=function(e,t){if(window.ga){return ga("send","event",e,t)}};return t}();window.EventTracker=n;window.EventTracker.Event=t;return window.EventTracker.Error=Error})();(function(){return window.CardType={NONE:"none",ACTION:"isAction",ACTION_SUPPLIER:"isActionSupplier",ATTACK:"isAttack",BUY_SUPPLIER:"isBuySupplier",DRAWER:"isDrawer",MULTI_DRAWER:"isMultiDrawer",DURATION:"isDuration",REACTION:"isReaction",RESERVE:"isReserve",TRASHING:"isTrashing",TREASURE:"isTreasure",VICTORY:"isVictory"}})();(function(){var e;e=function(){function e(e,t,n){this.title=e;this.url=t;this.isActive=ko.observable(!!n)}e.prototype.setActive=function(e){return this.isActive(e)};return e}();return window.MenuItemViewModel=e})();var bind=function(e,t){return function(){return e.apply(t,arguments)}};(function(){var e,t,n;t=window.MenuItemViewModel;e={NONE:-1,RANDOMIZER:0,SETS:1};n=function(){function n(e,t){this.toggleMenu=bind(this.toggleMenu,this);this.subtitle=ko.observable(e);this.showMenu=ko.observable(false);this.menuItems=this.createMenuItemsWithSelectedIndex(t);this.isCondensed=ko.observable(false)}n.prototype.toggleMenu=function(){var e;e=!this.showMenu();if(e){$(window).scrollTop(0)}return this.showMenu(e)};n.prototype.createMenuItemsWithSelectedIndex=function(n){return[new t("Randomizer","/index.html",n===e.RANDOMIZER),new t("Recommended Kingdoms","/sets.html",n===e.SETS)]};return n}();n.MenuItem=e;return window.PageViewModel=n})();(function(){window.CardCost={TREASURE_2:"treasure2",TREASURE_3:"treasure3",TREASURE_4:"treasure4",TREASURE_5:"treasure5",TREASURE_6:"treasure6",TREASURE_7:"treasure7",TREASURE_8:"treasure8"};return window.CardCostValues=[CardCost.TREASURE_2,CardCost.TREASURE_2,CardCost.TREASURE_2,CardCost.TREASURE_3,CardCost.TREASURE_4,CardCost.TREASURE_5,CardCost.TREASURE_6,CardCost.TREASURE_7,CardCost.TREASURE_8]})();(function(){var e,t;e=function(){function e(e,t,n,r,i){this.supply=e;this.events=t;this.landmarks=n;this.projects=r;this.metadata=i}e.prototype.getSupply=function(){return this.supply};e.prototype.getEvents=function(){return this.events};e.prototype.getLandmarks=function(){return this.landmarks};e.prototype.getProjects=function(){return this.projects};e.prototype.getMetadata=function(){return this.metadata};return e}();t=function(){function e(e,t){this.useColonies=e;this.useShelters=t}e.prototype.getUseColonies=function(){return this.useColonies};e.prototype.getUseShelters=function(){return this.useShelters};return e}();window.Kingdom=e;return window.Kingdom.Metadata=t})();(function(){var e,t;t=function(){function e(e,t){this.cards=e;this.metadata=t}e.prototype.getCards=function(){return this.cards};e.prototype.getMetadata=function(){return this.metadata};return e}();e=function(){function e(e,t,n,r){this.builder=e;this.prioritizedSetId=t;this.numberOfAlchemyCardsInUse=n;this.numberOfHighCostCardsInUse=r}e.prototype.getBuilder=function(){return this.builder};e.prototype.getPrioritizedSetId=function(){return this.prioritizedSetId};e.prototype.getNumberOfAlchemyCardsInUse=function(){return this.numberOfAlchemyCardsInUse};e.prototype.getNumberOfHighCostCardsInUse=function(){return this.numberOfHighCostCardsInUse};return e}();window.Supply=t;return window.Supply.Metadata=e})();(function(){var e,t;e=function(e,t){return Math.floor(Math.random()*(t-e)+e)};t=function(t,n){var r,i;i=[];if(t>=n){t=n}while(i.length<t){while(true){r=e(0,n);if(i.indexOf(r)===-1){i.push(r);break}}}return i};return window.RandUtil={getRandomInt:e,getRandomInts:t}})();(function(){var e,t,n,r,i,o,a,s,u,l,c,d,f,p,h,g,v,m,y,b;e=window.CardCost;t=window.CardCostValues;n=window.CardType;r=function(e){var t;return function(){var n,r,i;i=[];for(n=0,r=e.length;n<r;n++){t=e[n];i.push(t.id)}return i}()};b=function(e,t){var n;n=e.filter(s(r(t)));return n.concat(t)};g=function(e,t){var n,r,i;for(r=0,i=e.length;r<i;r++){n=e[r];if(n.id===t){return n}}return null};v=function(e){return e.id.indexOf("_event_")!==-1};m=function(e){return e.id.indexOf("_landmark_")!==-1};y=function(e){return e.id.indexOf("_project_")!==-1};p=function(e,t){var n,r,i;i=[];for(r in e){n=e[r];if(t.indexOf(n.id)!==-1){i.push(n)}}return i};h=function(e,t){var n,r,i;i=[];for(r in e){n=e[r];if(t.indexOf(n.id)===-1){i.push(n)}}return i};d=function(e){return function(t){return e.indexOf(t.setId)!==-1}};u=function(e){return function(t){return e.indexOf(t.setId)===-1}};c=function(e){return function(t){return e.indexOf(t.id)!==-1}};s=function(e){return function(t){return e.indexOf(t.id)===-1}};o=function(e){return function(t){var n,r,i;for(r=0,i=e.length;r<i;r++){n=e[r];if(t[n]===true){return true}}return false}};l=function(e){return function(t){var n,r,i;for(r=0,i=e.length;r<i;r++){n=e[r];if(t[n]===true){return false}}return true}};f=function(e){if(e===n.NONE){return function(e){return true}}return function(t){if(t[e]===true){return true}return false}};i=function(e){return function(n){var r;r=t[Math.min(n.cost.treasure,8)];return e.indexOf(r)!==-1}};a=function(e){return function(n){var r;r=t[Math.min(n.cost.treasure,8)];return e.indexOf(r)===-1}};return window.CardUtil={extractIds:r,unionCards:b,findCardById:g,isEvent:v,isLandmark:m,isProject:y,filterSetsByAllowedSetIds:p,filterSetsByExcludedSetIds:h,filterByIncludedSetIds:d,filterByExcludedSetIds:u,filterByIncludedIds:c,filterByExcludedIds:s,filterByAllowedTypes:o,filterByExcludedTypes:l,filterByRequiredType:f,filterByAllowedCosts:i,filterByExcludedCosts:a}})();(function(){var e;e=function(){function e(){}e.prototype.getBannedCards=function(e){throw Error("Not implemented.")};return e}();return window.SupplyBan=e})();var extend=function(e,t){for(var n in t){if(hasProp.call(t,n))e[n]=t[n]}function r(){this.constructor=e}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e},hasProp={}.hasOwnProperty;(function(){var e,t,n;t=window.CardUtil;n=window.SupplyBan;e=function(e){extend(n,e);function n(e){n.__super__.constructor.call(this);this.cardIds=e}n.prototype.getBannedCards=function(e){return e.filter(t.filterByIncludedIds(this.cardIds))};return n}(n);return window.CardSupplyBan=e})();var extend=function(e,t){for(var n in t){if(hasProp.call(t,n))e[n]=t[n]}function r(){this.constructor=e}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e},hasProp={}.hasOwnProperty;(function(){var e,t,n;e=window.CardUtil;n=window.SupplyBan;t=function(t){extend(n,t);function n(e){n.__super__.constructor.call(this);this.costs=e}n.prototype.getBannedCards=function(t){return t.filter(e.filterByAllowedCosts(this.costs))};return n}(n);return window.CostSupplyBan=t})();(function(){var e,t,n;e=window.CardUtil;t=window.RandUtil;n=function(){function t(e,t,n,r){if(t.length+n.length>r){throw Error("Cannot create a division with more locked and selected cards than the total count.")}if(e.length+t.length+n.length<r){throw Error("Cannot create an unfilled division without enough available cards to fill it.")}this.availableCards=e;this.lockedCards=t;this.selectedCards=n;this.totalCount=r}t.prototype.getAvailableCards=function(){return this.availableCards};t.prototype.getLockedCards=function(){return this.lockedCards};t.prototype.getSelectedCards=function(){return this.selectedCards};t.prototype.getLockedAndSelectedCards=function(){return this.lockedCards.concat(this.selectedCards)};t.prototype.getTotalCount=function(){return this.totalCount};t.prototype.getUnfilledCount=function(){return this.totalCount-this.lockedCards.length-this.selectedCards.length};t.prototype.isFilled=function(){return this.lockedCards.length+this.selectedCards.length>=this.totalCount};t.prototype.createDivisionByRemovingCards=function(n){
  var r,i;r=this.availableCards.filter(e.filterByExcludedIds(n));i=this.selectedCards.filter(e.filterByExcludedIds(n));return new t(r,this.lockedCards,i,this.totalCount)};t.prototype.createDivisionByLockingCard=function(n){var r,i;i=e.findCardById(this.availableCards,n);if(i){r=this.availableCards.filter(e.filterByExcludedIds([n]));return new t(r,this.lockedCards.concat(i),this.selectedCards,this.totalCount)}i=e.findCardById(this.selectedCards,n);if(i){r=this.selectedCards.filter(e.filterByExcludedIds([n]));return new t(this.availableCards,this.lockedCards.concat(i),r,this.totalCount)}throw Error("Can't lock card: "+n+". Not found in available or selected cards.")};t.prototype.createDivisionBySelectingCard=function(n){var r,i;i=e.findCardById(this.availableCards,n);if(!i){throw Error("Can't select card: "+n+". Not found in available cards.")}r=this.availableCards.filter(e.filterByExcludedIds([n]));return new t(r,this.lockedCards,this.selectedCards.concat(i),this.totalCount)};return t}();return window.SupplyDivision=n})();(function(){var e;e=function(){function e(e,t){this.start=e;this.length=t}e.prototype.getStart=function(){return this.start};e.prototype.getLength=function(){return this.length};e.prototype.getEnd=function(){return this.start+this.length};e.prototype.isInRange=function(e){return this.start<=e&&e<this.getEnd()};e.createFromIndices=function(t,n){return new e(t,n-t)};return e}();return window.Range=e})();var extend=function(e,t){for(var n in t){if(hasProp.call(t,n))e[n]=t[n]}function r(){this.constructor=e}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e},hasProp={}.hasOwnProperty;(function(){var e,t,n;e=window.RandUtil;t=window.Range;n=function(t){extend(n,t);function n(e,t){var r,i,o,a;r=0;for(i=0,o=t.length;i<o;i++){a=t[i];r+=a}n.__super__.constructor.call(this,e,r);this.segmentLengths=t}n.prototype.getSegmentForIndex=function(e){var t,n,r,i,o,a;o=0;i=this.segmentLengths;for(t=n=0,r=i.length;n<r;t=++n){a=i[t];o+=a;if(e<o){return t}}return-1};n.prototype.getRandomSegmentIndex=function(){var t;t=e.getRandomInt(0,this.getLength());return this.getSegmentForIndex(t)};n.prototype.isInRange=function(e){return this.start<=e&&e<this.getEnd()};return n}(t);return window.SegmentedRange=n})();(function(){var e,t,n,r;e=window.RandUtil;r=window.SupplyDivision;t=window.SegmentedRange;n=function(){function n(e){this.count=e}n.prototype.getCount=function(){return this.count};n.prototype.subdivideDivisions=function(e){var t,n,i,o,a,s,u,l,c,d,f;s=[];t=this.getRandomizedCountsPerDivision(e);for(o=i=0,a=e.length;i<a;o=++i){n=e[o];c=n.getTotalCount()-t[o];if(c>0){u=this.getRemainingCards(n);l=new r(u,[],[],c);s.push(l)}if(t[o]>0){d=this.getSatisfyingCards(n);f=new r(d,[],[],t[o]);s.push(f)}}return s};n.prototype.getRandomizedCountsPerDivision=function(t){var n,r,i,o,a,s,u,l,c,d,f,p,h,g;p=this.createRangesForDivisions(t);g=0;n=[];for(i=0,s=p.length;i<s;i++){f=p[i];l=f.getStart();n.push(l);g+=l}if(g>this.count){throw Error("Unable to divide division. Too few remaining cards.")}c=this.count-g;if(c===0){return n}h=this.createSegmentedRangeFromRanges(p);if(h.getLength()<c){throw Error("Unable to divide division. Too few satisfying cards.")}d=e.getRandomInts(c,h.getLength());for(a=0,u=d.length;a<u;a++){o=d[a];r=h.getSegmentForIndex(o);n[r]+=1}return n};n.prototype.createSegmentedRangeFromRanges=function(e){var n,r,i,o;i=[];for(n=0,r=e.length;n<r;n++){o=e[n];i.push(o.getLength())}return new t(0,i)};n.prototype.createRangesForDivisions=function(e){var t,n,r,i,o,a,s,u,l,c;l=this.getSatisfyingCardsPerDivision(e);s=[];for(r=n=0,i=l.length;n<i;r=++n){t=l[r];c=e[r].getUnfilledCount();u=e[r].getAvailableCards().length-t.length;a=Math.max(c-u,0);o=Math.min(c,t.length);s.push(new Range(a,o-a))}return s};n.prototype.getSatisfyingCardsPerDivision=function(e){var t,n,r,i;i=[];for(n=0,r=e.length;n<r;n++){t=e[n];i.push(this.getSatisfyingCards(t))}return i};n.prototype.getSatisfyingCards=function(e){throw Error("Not implemented.")};n.prototype.getRemainingCards=function(e){throw Error("Not implemented.")};return n}();return window.SupplyDivider=n})();var bind=function(e,t){return function(){return e.apply(t,arguments)}},extend=function(e,t){for(var n in t){if(hasProp.call(t,n))e[n]=t[n]}function r(){this.constructor=e}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e},hasProp={}.hasOwnProperty;(function(){var e,t,n,r,i,o,a;e=window.CardCostValues;t=window.CardUtil;o=window.SupplyDivider;r=1;i=2;a=1;n=function(e){extend(t,e);function t(e,n){this.getCardCost=bind(this.getCardCost,this);this.isRemainingCard=bind(this.isRemainingCard,this);this.isSatisfyingCard=bind(this.isSatisfyingCard,this);t.__super__.constructor.call(this,n);this.highCostCutOff=e}t.prototype.getSatisfyingCards=function(e){return e.getAvailableCards().filter(this.isSatisfyingCard)};t.prototype.getRemainingCards=function(e){return e.getAvailableCards().filter(this.isRemainingCard)};t.prototype.isSatisfyingCard=function(e){var t;t=this.getCardCost(e);return t>=this.highCostCutOff};t.prototype.isRemainingCard=function(e){var t;t=this.getCardCost(e);return t<this.highCostCutOff};t.prototype.getCardCost=function(e){var t,n,o;t=(e.cost.debt||0)*r;n=(e.cost.potion||0)*i;o=(e.cost.treasure||0)*a;return t+n+o};return t}(o);return window.CostSupplyDivider=n})();(function(){var e;e=function(){function e(){}e.prototype.isSatisfied=function(e){throw Error("Not implemented.")};e.prototype.allowLockedCard=function(e,t){return true};e.prototype.correctDivisions=function(e){throw Error("Not implemented.")};return e}();return window.SupplyCorrection=e})();(function(){var e,t,n,r,i,o,a;e=window.CardUtil;t=function(e){var t,n,r,i;t=[];for(r=0,i=e.length;r<i;r++){n=e[r];t=t.concat(n.getAvailableCards())}return t};i=function(e){return o(e).concat(a(e))};o=function(e){var t,n,r,i;t=[];for(r=0,i=e.length;r<i;r++){n=e[r];t=t.concat(n.getLockedCards())}return t};a=function(e){var t,n,r,i;t=[];for(r=0,i=e.length;r<i;r++){n=e[r];t=t.concat(n.getSelectedCards())}return t};n=function(e,t){var n,i,o,a,s;o=r(e,t);n=[];for(a=0,s=o.length;a<s;a++){i=o[a];n=n.concat(i)}return n};r=function(t,n){var r,i,o,a,s,u;i=[];for(s=a=0,u=t.length;a<u;s=++a){o=t[s];if(o.getSelectedCards().length||!o.isFilled()){r=o.getAvailableCards();i.push(r.filter(e.filterByRequiredType(n)))}else{i.push([])}}return i};return window.SupplyDivisions={getLockedAndSelectedCards:i,getLockedCards:o,getSelectedCards:a,getAvailableCardsOfType:n,getAvailableCardsOfTypePerDivision:r}})();var extend=function(e,t){for(var n in t){if(hasProp.call(t,n))e[n]=t[n]}function r(){this.constructor=e}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e},hasProp={}.hasOwnProperty;(function(){var e,t,n,r,i,o,a;e=window.CardType;t=window.CardUtil;n=window.RandUtil;i=window.SegmentedRange;o=window.SupplyCorrection;a=window.SupplyDivisions;r=function(r){extend(o,r);function o(){return o.__super__.constructor.apply(this,arguments)}o.prototype.isSatisfied=function(n){var r,i;i=this.getLockedAndSelectedCards(n);if(this.hasReaction(i)){return true}if(i.filter(t.filterByRequiredType(e.ATTACK)).length){return false}r=a.getAvailableCardsOfType(n,e.ATTACK);if(r.length){return false}return true};o.prototype.allowLockedCard=function(t,n){var r,i,o,s,u,l,c,d,f,p;console.log("checking if card is allowed: "+n.id);if(!n.isAttack){return true}if(this.hasReaction(this.getLockedAndSelectedCards(t))){console.log("attack allowed because reaction exists");return true}r=a.getAvailableCardsOfTypePerDivision(t,e.REACTION);p=0;for(u=0,c=r.length;u<c;u++){f=r[u];p+=f.length}if(p<1){return false}o=this.getDivisionContainingCard(t,n);for(s=l=0,d=t.length;l<d;s=++l){i=t[s];if(i===o){if(i.getUnfilledCount()>=2&&r[s]>0){debugger;console.log("attack allowed because of same division having reaction");return true}}else{if(!i.isFilled()&&r[s]>0){debugger;console.log("attack allowed because another division has reaction");return true}}}return false};o.prototype.correctDivisions=function(n){var r,i,o;i=this.getLockedCards(n);o=!!i.filter(t.filterByRequiredType(e.ATTACK)).length;r=this.hasAvailableReactions(n);if(o&&r){return this.lockRandomCardOfType(n,e.REACTION)}if(o&&!r){throw Error("Attack is locked but no reactions available.")}if(!r){return this.removeAttacksFromAvailableCards(n)}if(!this.checkIfAttacksShouldBeIncluded(n)){return this.removeAttacksFromAvailableCards(n)}n=this.lockRandomCardOfType(n,e.REACTION);n=this.lockRandomCardOfType(n,e.ATTACK);return n};o.prototype.removeAttacksFromAvailableCards=function(n){var r,i,o,a,s,u;u=[];for(a=0,s=n.length;a<s;a++){o=n[a];i=o.getAvailableCards();r=i.filter(t.filterByRequiredType(e.ATTACK));u.push(o.createDivisionByRemovingCards(t.extractIds(r)))}return u};o.prototype.checkIfAttacksShouldBeIncluded=function(n){var r,i;n=this.lockRandomCardOfType(n,e.REACTION);i=this.fillDivisions(n);r=this.getLockedAndSelectedCards(i);return r.filter(t.filterByRequiredType(e.ATTACK)).length>0};o.prototype.fillDivisions=function(e){var t,n,r,i,o;i=[];for(n=0,r=e.length;n<r;n++){t=e[n];while(!t.isFilled()){o=this.getRandomCard(t.getAvailableCards());t=t.createDivisionBySelectingCard(o.id)}i.push(t)}return i};o.prototype.lockRandomCardOfType=function(e,t){var n,r,o,s,u,l,c,d;e=e.concat();n=a.getAvailableCardsOfTypePerDivision(e,t);s=[];for(l=0,c=n.length;l<c;l++){o=n[l];s.push(o.length)}d=new i(0,s);u=d.getRandomSegmentIndex();r=this.getRandomCard(n[u]);e[u]=e[u].createDivisionByLockingCard(r.id);return e};o.prototype.hasAvailableReactions=function(t){var n;n=a.getAvailableCardsOfType(t,e.REACTION);return!!reactions.length};o.prototype.getLockedAndSelectedCards=function(e){var t,n,r,i;t=[];for(r=0,i=e.length;r<i;r++){n=e[r];t=t.concat(n.getLockedAndSelectedCards())}return t};o.prototype.getLockedCards=function(e){var t,n,r,i;t=[];for(r=0,i=e.length;r<i;r++){n=e[r];t=t.concat(n.getLockedCards())}return t};o.prototype.getDivisionContainingCard=function(e,n){var r,i,o,a;for(o=0,a=e.length;o<a;o++){i=e[o];r=i.getLockedAndSelectedCards().concat(i.getAvailableCards());if(r.filter(t.filterByIncludedIds([n.id])).length){return i}}throw Error("Card not found in any of the divisions: "+n.id)};o.prototype.getRandomCard=function(e){return e[n.getRandomInt(0,e.length)]};o.prototype.hasReaction=function(n){return!!n.filter(t.filterByRequiredType(e.REACTION)).length};return o}(o);return window.ReactionSupplyCorrection=r})();var extend=function(e,t){for(var n in t){if(hasProp.call(t,n))e[n]=t[n]}function r(){this.constructor=e}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e},hasProp={}.hasOwnProperty;(function(){var e,t,n;e=window.CardUtil;n=window.SupplyBan;t=function(t){extend(n,t);function n(e){n.__super__.constructor.call(this);this.setIds=e}n.prototype.getBannedCards=function(t){return t.filter(e.filterByIncludedSetIds(this.setIds))};return n}(n);return window.SetSupplyBan=t})();var extend=function(e,t){for(var n in t){if(hasProp.call(t,n))e[n]=t[n]}function r(){this.constructor=e}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e},hasProp={}.hasOwnProperty;(function(){var e,t,n;e=window.CardUtil;n=window.SupplyDivider;t=function(t){extend(n,t);function n(e,t){n.__super__.constructor.call(this,t);this.setId=e}n.prototype.getSatisfyingCards=function(t){var n;n=t.getAvailableCards();return n.filter(e.filterByIncludedSetIds([this.setId]))};n.prototype.getRemainingCards=function(t){var n;n=t.getAvailableCards();return n.filter(e.filterByExcludedSetIds([this.setId]))};return n}(n);return window.SetSupplyDivider=t})();(function(){var e,t,n;e=window.CardUtil;t=window.RandUtil;n=function(){function n(e){this.cards=e;this.dividers=[];this.requirements=[];this.bans=[];this.corrections=[]}n.prototype.addDivider=function(e){return this.dividers.push(e)};n.prototype.addRequirement=function(e){return this.requirements.push(e)};n.prototype.addBan=function(e){return this.bans.push(e)};n.prototype.addCorrection=function(e){return this.corrections.push(e)};n.prototype.createUnfilledDivisions=function(e){var t,n;t=new SupplyDivision(this.cards,[],[],10);t=this.applyBans(t);t=this.addExistingCardsAsAvailable(t,e);n=this.applyDividers([t]);n=this.applyExistingCards(n,e);return n};n.prototype.createSupply=function(e){var t;t=this.createUnfilledDivisions(e);t=this.applyRequirements(t);t=this.applyCorrections(t);t=this.fillDivisions(t);return this.gatherCards(t)};n.prototype.clone=function(){var e;e=new n;e.cards=this.cards;e.dividers=this.dividers;e.requirements=this.requirements;e.bans=this.bans;e.corrections=this.corrections;return e};n.prototype.applyBans=function(t){var n,r,i,o,a;a=this.bans;for(i=0,o=a.length;i<o;i++){n=a[i];r=n.getBannedCards(t.getAvailableCards());t=t.createDivisionByRemovingCards(e.extractIds(r))}return t};n.prototype.applyRequirements=function(e){var n,r,i,o,a,s,u,l,c;e=e.concat();a=this.orderRequirementsForDivisions(e);for(i=0,o=a.length;i<o;i++){u=a[i];if(u.isSatisfied(e)){continue}l=this.getSegmentedRangeForRequirement(u,e);if(!l.getLength()){throw Error("Unable to satisfy requirement: "+u+".")}r=l.getRandomSegmentIndex();n=u.getSatisfyingCardsFromDivisions([e[r]]);while(n.length){s=t.getRandomInt(0,n.length);c=n[s];if(this.allowLockedCard(e,c)){e[r]=e[r].createDivisionByLockingCard(c.id);break}n.splice(s,1)}if(!n.length){throw Error("Unable to satisfy requirement: "+u+".")}}return e};n.prototype.applyDividers=function(e){var t,n,r,i;i=this.dividers;for(n=0,r=i.length;n<r;n++){t=i[n];e=t.subdivideDivisions(e)}return e};n.prototype.addExistingCardsAsAvailable=function(t,n){var r,i,o,a,s;r=e.extractIds(t.getAvailableCards());o=[];for(a=0,s=n.length;a<s;a++){i=n[a];if(r.indexOf(i.id)===-1){o.push(i)}}return new SupplyDivision(t.getAvailableCards().concat(o),t.getLockedCards(),t.getSelectedCards(),t.getTotalCount())};n.prototype.applyExistingCards=function(e,t){var n,r,i,o,a,s,u,l;e=e.concat();n=[];for(a=0,u=t.length;a<u;a++){o=t[a];i=this.findIndexOfDivisionContainingCardId(e,o.id);if(i===-1){n.push(o)}else{r=e[i];e[i]=r.createDivisionByLockingCard(o.id)}}if(!n.length){return e}for(s=0,l=n.length;s<l;s++){o=n[s];i=this.getIndexOfDivisionWithMostUnfilledCards(e);r=e[i];e[i]=new SupplyDivision(r.getAvailableCards(),r.getLockedCards(),r.getSelectedCards(),r.getTotalCount()-1)}e.push(new SupplyDivision([],n,[],n.length));return e};n.prototype.fillDivisions=function(e){var t,n,r,i,o;i=[];for(n=0,r=e.length;n<r;n++){t=e[n];while(!t.isFilled()){o=this.selectRandomCard(t.getAvailableCards());t=t.createDivisionBySelectingCard(o.id)}i.push(t)}return i};n.prototype.applyCorrections=function(e){var t,n,r,i;i=this.corrections;for(n=0,r=i.length;n<r;n++){t=i[n];if(!t.isSatisfied(e)){e=t.correctDivisions(e)}}return e};n.prototype.gatherCards=function(e){var t,n,r,i;t=[];for(r=0,i=e.length;r<i;r++){n=e[r];t=t.concat(n.getLockedAndSelectedCards())}return t};n.prototype.orderRequirementsForDivisions=function(e){var t,n,r,i,o,a,s,u,l,c,d;d=[];c=[];u=this.requirements;for(n=t=0,i=u.length;t<i;n=++t){l=u[n];if(l.isSatisfied(e)){d.push(l);continue}c.push({requirement:l,count:l.getSatisfyingCardsFromDivisions(e)})}c.sort(function(e,t){if(e.count<t.count){return-1}if(e.count>t.count){return 1}return 0});a=[];for(r=0,o=c.length;r<o;r++){s=c[r];a.push(s.requirement)}return d.concat(a)};n.prototype.getSegmentedRangeForRequirement=function(e,t){var n,r,i,o;o=[];for(r=0,i=t.length;r<i;r++){n=t[r];if(n.isFilled()){o.push(0)}else{o.push(e.getSatisfyingCardsFromDivisions([n]).length)}}return new SegmentedRange(0,o)};n.prototype.findIndexOfDivisionContainingCardId=function(t,n){var r,i,o,a;for(i=o=0,a=t.length;o<a;i=++o){r=t[i];if(!r.isFilled()&&e.findCardById(r.getAvailableCards(),n)){return i}}return-1};n.prototype.getIndexOfDivisionWithMostUnfilledCards=function(e){var t,n,r,i,o,a;o=0;a=-1;for(r=n=0,i=e.length;n<i;r=++n){t=e[r];if(t.getUnfilledCount()>o){a=r}}return a};n.prototype.allowLockedCard=function(e,t){var n,r,i,o;o=this.corrections;for(r=0,i=o.length;r<i;r++){n=o[r];if(!n.allowLockedCard(e,t)){return false}}return true};n.prototype.selectRandomCard=function(e){return e[t.getRandomInt(0,e.length)]};return n}();return window.SupplyBuilder=n})();var extend=function(e,t){for(var n in t){if(hasProp.call(t,n))e[n]=t[n]}function r(){this.constructor=e}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e},hasProp={}.hasOwnProperty;(function(){var e,t,n;e=window.CardUtil;t=window.SupplyBan;n=function(t){extend(n,t);function n(e){n.__super__.constructor.call(this);this.types=e}n.prototype.getBannedCards=function(t){return t.filter(e.filterByAllowedTypes(this.types))};return n}(t);return window.TypeSupplyBan=n})();(function(){var e;e=function(){function e(){}e.prototype.isSatisfied=function(e){var t,n,r;for(n=0,r=e.length;n<r;n++){t=e[n];if(this.getSatisfyingCards(t.getLockedAndSelectedCards()).length){return true}}return false};e.prototype.getSatisfyingCardsFromDivisions=function(e){var t,n,r,i;i=[];for(n=0,r=e.length;n<r;n++){t=e[n];i=i.concat(this.getSatisfyingCards(t.getAvailableCards()))}return i};e.prototype.getSatisfyingCards=function(e){throw Error("Not implemented.")};return e}();return window.SupplyRequirement=e})();var extend=function(e,t){for(var n in t){if(hasProp.call(t,n))e[n]=t[n]}function r(){this.constructor=e}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e},hasProp={}.hasOwnProperty;(function(){var e,t,n;e=window.CardUtil;t=window.SupplyRequirement;n=function(t){extend(n,t);function n(e,t){n.__super__.constructor.call(this);this.type=e;this.requireNewCard=t}n.prototype.isSatisfied=function(e){if(this.requireNewCard){return false}return n.__super__.isSatisfied.call(this,e)};n.prototype.getSatisfyingCards=function(t){return t.filter(e.filterByRequiredType(this.type))};n.prototype.toString=function(){return"TypeSupplyRequirement(type="+this.type+",requireNewCard="+this.requireNewCard};return n}(t);return window.TypeSupplyRequirement=n})();(function(){var e;e=function(e,t){var n,r,i,o,a,s,u;r=[];for(u in e){s=e[u];if(s[t]){a=s[t];for(i=0,o=a.length;i<o;i++){n=a[i];r.push(n)}}}return r};return window.Util={flattenSetsForProperty:e}})();(function(){var e,t,n,r,i,o,a,s,u,l,c,d,f,p,h,g,v,m,y,b,w,C,S,x,T,k,E,A,N,I,R,_,O,D,L,B,M,j,q,P,z,F,H,U,$;e=window.CardCost;t=window.CardSupplyBan;n=window.CardType;r=window.CardUtil;i=window.CostSupplyBan;o=window.CostSupplyDivider;s=window.Kingdom;v=window.RandUtil;m=window.ReactionSupplyCorrection;b=window.SetSupplyBan;w=window.SetSupplyDivider;S=window.SupplyBuilder;x=window.SupplyDivisions;C=window.Supply;k=window.TypeSupplyRequirement;T=window.TypeSupplyBan;E=window.Util;y={baseset2:"baseset",intrigue2:"intrigue"};d=3;h=10;f=3;u=5;a=5;p=3;c=5;l=2;g=5;N=function(e,t){var n,r,i;i=O(e,t);n=D(e,t.getSetIds(),[],[]);r=B(e,t.getSetIds());return new s(i,n.events,n.landmarks,n.projects,r)};_=function(e,t){var n;try{return O(e,t)}catch(e){n=e;console.log("Failed to create supply: \n"+n.toString());return null}};O=function(e,t){var n,r;r=d;while(r>0){try{return I(e,t)}catch(e){n=e;console.log("Error when trying to select cards: \n"+n.toString());r-=1}}throw Error("Failed to select cards that satisfied all requirements.")};I=function(e,s){var u,l,d,f,m,y,x,N,I,_,O;l=E.flattenSetsForProperty(e,"cards");_=r.filterSetsByAllowedSetIds(e,s.getSetIds());d=E.flattenSetsForProperty(_,"cards");d=q(d,s.getIncludeCardIds());O=new S(d);if(s.getExcludeCardIds().length){O.addBan(new t(s.getExcludeCardIds()))}if(s.getExcludeTypes().length){O.addBan(new T(s.getExcludeTypes()))}if(s.getExcludeCosts().length){O.addBan(new i(s.getExcludeCosts()))}if(s.getRequireSingleCardOfType()&&s.getRequireSingleCardOfType()!==n.NONE){O.addRequirement(new k(s.getRequireSingleCardOfType(),true))}if(s.getRequireActionProvider()){O.addRequirement(new k(n.ACTION_SUPPLIER,false))}if(s.getRequireCardProvider()){O.addRequirement(new k(n.MULTI_DRAWER,false))}if(s.getRequireBuyProvider()){O.addRequirement(new k(n.BUY_SUPPLIER,false))}if(s.getRequireTrashing()){O.addRequirement(new k(n.TRASHING,false))}N=h;if(s.getPrioritizeSet()&&s.getPrioritizeSet()!==SetId.ALCHEMY){O.addDivider(new w(s.getPrioritizeSet(),g));N-=g}if(U(s)){u=M(s,N);O.addDivider(new w(SetId.ALCHEMY,u));N-=u}else if(s.getSetIds().length>1){O.addBan(new b([SetId.ALCHEMY]))}if(s.getDistributeCost()){y=v.getRandomInt(p,c);O.addDivider(new o(a,y))}m=l.filter(r.filterByIncludedIds(s.getIncludeCardIds()));I=R(O,m);if(s.getRequireReactionIfAttacks()){f=A(O,m,I);if(f){O=f;I=R(O,m)}}x=new C.Metadata(O,s.getPrioritizeSet()||null,u||null,y||null);return new C(I,x)};D=function(e,t,n,i){var o,a,s,u,c,d,f,p,g,v;v=r.filterSetsByAllowedSetIds(e,t);s=E.flattenSetsForProperty(v,"cards");o=s.concat(L(e,t,[]));d=H(o,h);f=[];p=[];g=[];for(u=0,c=d.length;u<c;u++){a=d[u];if(r.isEvent(a)){f.push(a)}else if(r.isLandmark(a)){p.push(a)}else if(r.isProject(a)){g.push(a)}if(f.length+p.length+g>=l){break}}return{events:f,landmarks:p,projects:g}};j=function(e,t,n,r){var i;i=L(e,t,n);return H(i,r)};L=function(e,t,n){var i,o,a,s;s=r.filterSetsByAllowedSetIds(e,t);i=E.flattenSetsForProperty(s,"events");o=E.flattenSetsForProperty(s,"landmarks");a=E.flattenSetsForProperty(s,"projects");return i.concat(o,a).filter(r.filterByExcludedIds(n))};B=function(e,t){var n,i,o;n=r.filterSetsByAllowedSetIds(e,t);i=$(SetId.PROSPERITY,n);o=$(SetId.DARK_AGES,n);return new s.Metadata(i,o)};$=function(e,t){var n,i,o,a,s,u;i=r.extractIds(t).indexOf(e);if(i===-1){return false}s=t[i].cards.length;a=0;for(n=0,o=t.length;n<o;n++){u=t[n];a+=u.cards.length}i=v.getRandomInt(0,a);return i<s};H=function(e,t){var n,r,i;r=v.getRandomInts(t,e.length);i=function(){var t,i,o;o=[];for(t=0,i=r.length;t<i;t++){n=r[t];o.push(e[n])}return o}();return i};U=function(e){var t;if(e.getSetIds().length===1){return false}if(e.getPrioritizeSet()===SetId.ALCHEMY){return true}if(e.getSetIds().indexOf(SetId.ALCHEMY)===-1){return false}if(e.getSetIds().length<3){return true}t=!v.getRandomInt(0,e.getSetIds().length);return t};A=function(e,t,i){var o,a;if(i.filter(r.filterByRequiredType(n.REACTION)).length){return null}if(!i.filter(r.filterByRequiredType(n.ATTACK)).length){return null}e=e.clone();o=e.createUnfilledDivisions(t);a=x.getAvailableCardsOfType(o,n.REACTION);if(a.length){e.addRequirement(new k(n.REACTION,false));return e}e.addBan(new T(n.ATTACK));return e};R=function(e,t){var n,r;r=d;while(r>0){try{return e.createSupply(t)}catch(e){n=e;console.log("Error when trying to select cards: \n"+n.toString());r-=1}}throw Error("Failed to select cards that satisfied all requirements.")};M=function(e,t){var n,r;r=f;n=u;if(e.getPrioritizeSet()===SetId.ALCHEMY){r=Math.max(r,g);n=Math.max(n,u)}return v.getRandomInt(r,Math.min(n,t))};q=function(e,t){var n,i,o,a,s,u,l,c,d,f,p,h;for(n in y){u=y[n];a=e.filter(r.filterByIncludedSetIds([n]));d=e.filter(r.filterByIncludedSetIds([u]));i=z(a,u);h=d.filter(r.filterByIncludedIds(t));l=P(i,r.extractIds(h));c=P(r.extractIds(d),l);p=z(h,n);o=P(r.extractIds(a),p);s=P(r.extractIds(a),o);f=P(r.extractIds(d),c);e=e.filter(r.filterByExcludedIds(s));e=e.filter(r.filterByExcludedIds(f))}return e};P=function(e,t){return e.filter(function(e){return t.indexOf(e)===-1})};z=function(e,t){var n,r,i,o;r=[];for(i=0,o=e.length;i<o;i++){n=e[i];r.push(F(n.id,t))}return r};F=function(e,t){return t+"_"+e.split("_")[1]};return window.Randomizer={createKingdom:N,createSupply:I,createSupplyWithRetries:O,createSupplySafe:_,getAddons:D,getRandomAddons:j}})();(function(){return window.SetId={ADVENTURES:"adventures",ALCHEMY:"alchemy",BASE_SET:"baseset",BASE_SET_2:"baseset2",CORNUCOPIA:"cornucopia",DARK_AGES:"darkages",EMPIRES:"empires",GUILDS:"guilds",HINTERLANDS:"hinterlands",INTRIGUE:"intrigue",INTRIGUE_2:"intrigue2",NOCTURNE:"nocturne",PROMOS:"promos",PROSPERITY:"prosperity",RENAISSANCE:"renaissance",SEASIDE:"seaside"}})();(function(){var e,t,n,r;r=window.SetId;e=window.CardCost;t=window.CardType;n=function(){function e(){this.setIds=r.BASE_SET;this.includeCardIds=[];this.excludeCardIds=[];this.requireSingleCardOfType=t.NONE;this.excludeTypes=[];this.excludeCosts=[];this.requireActionProvider=true;this.requireCardProvider=false;this.requireBuyProvider=false;this.requireReactionIfAttacks=false;this.requireTrashing=false;this.distributeCost=false;this.prioritizeSet=null}e.prototype.getSetIds=function(){return this.setIds};e.prototype.setSetIds=function(e){this.setIds=e;return this};e.prototype.getIncludeCardIds=function(){return this.includeCardIds};e.prototype.setIncludeCardIds=function(e){this.includeCardIds=e;return this};e.prototype.getExcludeCardIds=function(){return this.excludeCardIds};e.prototype.setExcludeCardIds=function(e){this.excludeCardIds=e;return this};e.prototype.getRequireSingleCardOfType=function(){return this.requireSingleCardOfType};e.prototype.setRequireSingleCardOfType=function(e){this.requireSingleCardOfType=e;return this};e.prototype.getExcludeTypes=function(){return this.excludeTypes};e.prototype.setExcludeTypes=function(e){this.excludeTypes=e;return this};e.prototype.getExcludeCosts=function(){return this.excludeCosts};e.prototype.setExcludeCosts=function(e){this.excludeCosts=e;return this};e.prototype.getRequireActionProvider=function(){return this.requireActionProvider};e.prototype.setRequireActionProvider=function(e){this.requireActionProvider=e;return this};e.prototype.getRequireCardProvider=function(){return this.requireCardProvider};e.prototype.setRequireCardProvider=function(e){this.requireCardProvider=e;return this};e.prototype.getRequireBuyProvider=function(){return this.requireBuyProvider};e.prototype.setRequireBuyProvider=function(e){this.requireBuyProvider=e;return this};e.prototype.getRequireReactionIfAttacks=function(){return this.requireReactionIfAttacks};e.prototype.setRequireReactionIfAttacks=function(e){this.requireReactionIfAttacks=e;return this};e.prototype.getRequireTrashing=function(){return this.requireTrashing};e.prototype.setRequireTrashing=function(e){this.requireTrashing=e;return this};e.prototype.getDistributeCost=function(){return this.distributeCost};e.prototype.setDistributeCost=function(e){this.distributeCost=e;return this};e.prototype.getPrioritizeSet=function(){return this.prioritizeSet};e.prototype.setPrioritizeSet=function(e){this.prioritizeSet=e;return this};return e}();return window.RandomizerOptions=n})();(function(){var e,t,n,r,i,o,a,s,u,l,c,d,f,p,h,g,v;e=window.Kingdom;t=window.Supply;n=window.Util;f=function(e){var t,n;t=[];t.push(v(e.getSupply().getCards()));if(e.getEvents().length){t.push(d(e.getEvents()))}if(e.getLandmarks().length){t.push(p(e.getLandmarks()))}if(e.getProjects().length){t.push(g(e.getProjects()))}n=h(e.getMetadata());if(n.length){t.push(n)}return t.join("&")};r=function(r,o){var l,c,d,f,p,h,g,v,m,y,b,w,C,S,x,T;C=u("supply",o);if(!C){C=u("cards",o)||[]}if(!C.length){return null}h=u("events",o)||[];v=u("landmarks",o)||[];y=u("projects",o)||[];T=s("shelters",o);x=s("colonies",o);l=n.flattenSetsForProperty(r,"cards");c=n.flattenSetsForProperty(r,"events");d=n.flattenSetsForProperty(r,"landmarks");f=n.flattenSetsForProperty(r,"projects");p=a(C,l).slice(0,10);g=a(h,c).slice(0,2);m=a(v,d).slice(0,Math.max(0,2-g.length));b=a(y,f).slice(0,Math.max(0,2-g.length-m.length));S=new t.Metadata(null,null,null,null);w=new t(p,S);return new e(w,g,m,b,i(o))};v=function(e){var t;t=e.concat().sort(function(e,t){if(e.shortId>t.shortId){return 1}if(e.shortId<t.shortId){return-1}return 0});return"supply="+c(t)};d=function(e){return"events="+c(e)};p=function(e){return"landmarks="+c(e)};g=function(e){return"projects="+c(e)};c=function(e){var t,n;if(!e.length){return""}n=function(){var n,r,i;i=[];for(n=0,r=e.length;n<r;n++){t=e[n];i.push(t.shortId)}return i}();return n.join(",")};h=function(e){var t;t=[];if(e.getUseColonies()){t.push("colonies=1")}if(e.getUseShelters()){t.push("shelters=1")}return t.join("&")};i=function(t){return new e.Metadata(s("colonies",t),s("shelters",t))};a=function(e,t){var n,r,i,a,s;i=[];for(a=0,s=e.length;a<s;a++){n=e[a];r=o(n,t);if(r){i.push(r)}}return i};o=function(e,t){var n,r,i;for(r=0,i=t.length;r<i;r++){n=t[r];if(n.id===e||n.shortId===e){return n}}return null};u=function(e,t){var n;n=l(e,t);if(!n){return null}return n.split(",")};s=function(e,t){var n;n=l(e,t);return n==="1"||n==="true"};l=function(e,t){var n,r;r=new RegExp(e+"=([\\w,]+)");n=r.exec(t);if(!(n!=null?n[1]:void 0)){return null}return n[1]};return window.Serializer={serializeKingdom:f,deserializeKingdom:r}})();(function(){var e;e=function(){function e(e,t,n,r,i,o,a,s){this.requireActionProvider=ko.observable(e);this.requireCardProvider=ko.observable(t);this.requireBuyProvider=ko.observable(n);this.allowAttacks=ko.observable(r);this.requireReaction=ko.observable(i);this.requireTrashing=ko.observable(o);this.distributeCost=ko.observable(a);this.prioritizeSet=ko.observable(s)}e.prototype.toObject=function(){return{requireActionProvider:this.requireActionProvider(),requireCardProvider:this.requireCardProvider(),requireBuyProvider:this.requireBuyProvider(),allowAttacks:this.allowAttacks(),requireReaction:this.requireReaction(),requireTrashing:this.requireTrashing(),distributeCost:this.distributeCost(),prioritizeSet:this.prioritizeSet()}};e.createFromObject=function(t){t=t||{};return new e(t.requireActionProvider!=null?!!t.requireActionProvider:true,t.requireCardProvider!=null?!!t.requireCardProvider:false,!!t.requireBuyProvider,t.allowAttacks!=null?!!t.allowAttacks:true,!!t.requireReaction,!!t.requireTrashing,!!t.distributeCost,t.prioritizeSet||null)};return e}();return window.RandomizerSettings=e})();(function(){var e,t,n;e=window.RandomizerSettings;n={SET:"set",ALPHABETICAL:"alpha",COST:"cost"};t=function(){function t(e,t,n){this.selectedSets=ko.observableArray(e);this.sortOption=ko.observable(t);this.randomizerSettings=ko.observable(n);console.log(this.sortOption())}t.prototype.toObject=function(){return{sets:t.serializeSets(this.selectedSets()),sortOption:this.sortOption(),randomizerSettings:this.randomizerSettings().toObject()}};t.createFromObject=function(n){n=n||{};return new t(this.deserializeSets(n),this.deserailizeSort(n),e.createFromObject(n.randomizerSettings!=null?n.randomizerSettings:n))};t.serializeSets=function(e){if(e.length){return e.join(",")}return"baseset"};t.deserializeSets=function(e){var t;if(e.sets!=null){t=e.sets.split(",");if(t.length&&t[0].length){return t}}return["baseset"]};t.deserailizeSort=function(e){var t,r;if(e.sortOption){for(t in n){r=n[t];if(e.sortOption===r){return r}}return n.SET}if(!!e.sortAlphabetically){return n.ALPHABETICAL}return n.SET};return t}();window.Settings=t;return window.Settings.SortOption=n})();(function(){var e,t,n;e=window.Settings;t=function(){var t;try{t=$.cookie("options");t=typeof t==="string"?JSON.parse(t):t;return e.createFromObject(t)}catch(t){return e.createFromObject({})}};n=function(e){return $.cookie("options",e.toObject(),{expires:365})};return window.SettingsManager={loadSettings:t,saveSettings:n}})();var bind=function(e,t){return function(){return e.apply(t,arguments)}};(function(){var e,t,n,r,i;e=600;r="/img/cards";i="/img/cards/backside_blue.jpg";n="/img/cards/backside_blue_horizontal.jpg";t=function(){function t(e,t){this.getLoadingImageUrl=bind(this.getLoadingImageUrl,this);this.toggleSelected=bind(this.toggleSelected,this);this.setToLoading=bind(this.setToLoading,this);this.failedToLoad=bind(this.failedToLoad,this);this.setData=bind(this.setData,this);this.parent=e;this.isVertical=!!t;this.id=ko.observable();this.setId=ko.observable();this.name=ko.observable();this.set=ko.observable();this.isLoading=ko.observable(true);this.cardImageLoaded=ko.observable(false);this.animationStartTime=null;this.selected=ko.observable(false);this.cardIdBeingLoaded=null;this.imageUrl=ko.observable(this.getLoadingImageUrl());this.setClass=ko.computed(function(e){return function(){if(e.isLoading()){return"loading"}else{return e.setId()}}}(this))}t.prototype.setData=function(t,n){var i,o,a;this.cardIdBeingLoaded=t.id;
  i=t.id;o=r+"/"+t.id+".jpg";a=function(e){return function(){var r,i,a;e.id(t.id);e.name(t.name);e.setId(t.setId);for(r=0,i=n.length;r<i;r++){a=n[r];if(a.id===t.setId){e.set(a.name);break}}e.imageUrl(o);e.isLoading(false);return e.cardImageLoaded(true)}}(this);this.cardImageLoaded(false);return $.imgpreload(o,function(t){return function(){var n;if(t.cardIdBeingLoaded!==i){return}n=e-(Date.now()-t.animationStartTime);if(n>0){return setTimeout(a,n)}else{return a()}}}(this))};t.prototype.failedToLoad=function(){var t;this.isLoading(false);this.cardImageLoaded(false);if((t=e-(Date.now()-this.animationStartTime))>0){return setTimeout(function(e){return function(){return e.cardImageLoaded(true)}}(this),t)}else{return this.cardImageLoaded(true)}};t.prototype.setToLoading=function(){this.selected(false);this.isLoading(true);return this.animationStartTime=Date.now()};t.prototype.toggleSelected=function(){return this.selected(!this.selected())};t.prototype.getLoadingImageUrl=function(){if(this.isVertical){return i}else{return n}};return t}();window.CardViewModel=t;window.CardViewModel.VERTICAL_LOADING_IMAGE_URL=i;window.CardViewModel.HORIZONTAL_LOADING_IMAGE_URL=n;return window.CardViewModel.ANIMATION_TIME=e})();var bind=function(e,t){return function(){return e.apply(t,arguments)}};(function(){var e;e=function(){function e(e){this.toObject=bind(this.toObject,this);this.id=e.id;this.name=e.name;this.active=ko.observable(e.active!=null?e.active:true)}e.prototype.toObject=function(){return{id:this.id,name:this.name,active:this.active()}};return e}();return window.SetViewModel=e})();var bind=function(e,t){return function(){return e.apply(t,arguments)}};vex.defaultOptions.className="vex-theme-os";(function(){var e,t,n,r,i,o;t=window.CardCost;n=window.CardType;o=window.SetViewModel;e="all";r=function(){function e(e){this.id=e.id;this.name=e.name;this.active=ko.observable(true)}return e}();i=function(){function i(t){this.close=bind(this.close,this);this.open=bind(this.open,this);this.fetchNewCards=bind(this.fetchNewCards,this);this.toggleCostsSection=bind(this.toggleCostsSection,this);this.toggleTypesSection=bind(this.toggleTypesSection,this);this.toggleSetsSection=bind(this.toggleSetsSection,this);this.sets=ko.observableArray();this.selectedSetId=ko.observable(e);this.types=this.createTypes();this.selectedType=ko.observable(n.NONE);this.costs=this.createCosts();this.vexDialogId=null;this.callback=null;this.openSetsSection=ko.observable(false);this.openTypesSection=ko.observable(false);this.openCostsSection=ko.observable(false)}i.prototype.toggleSetsSection=function(){return this.openSetsSection(!this.openSetsSection())};i.prototype.toggleTypesSection=function(){return this.openTypesSection(!this.openTypesSection())};i.prototype.toggleCostsSection=function(){return this.openCostsSection(!this.openCostsSection())};i.prototype.fetchNewCards=function(){this.callback();return this.close()};i.prototype.open=function(e,t){var n,r;this.callback=t;this.sets(this.createSets(e));this.checkSelectedSetState();n=null;r=vex.open({afterOpen:function(e){n=$(".dialog-hidden-content .dialog-content").first().detach();return e.append(n)},beforeClose:function(){return n.detach().appendTo($(".dialog-hidden-content"))},afterClose:function(e){return function(){return e.vexDialogId=null}}(this)});return this.vexDialogId=r.data().vex.id};i.prototype.resetOptions=function(){var t,r,i,o,a;this.selectedSetId(e);this.selectedType(n.NONE);o=this.costs;a=[];for(r=0,i=o.length;r<i;r++){t=o[r];a.push(t.active(true))}return a};i.prototype.close=function(){if(!this.vexDialogId){return}vex.close(this.vexDialogId);return this.callback=null};i.prototype.createSets=function(t){var n,i,o,a;o=[new r({id:e,name:"Any"})];for(n=0,i=t.length;n<i;n++){a=t[n];o.push(new r({id:a.id,name:a.name}))}return o};i.prototype.checkSelectedSetState=function(){var t,n,r,i,o;i=this.selectedSetId();r=this.sets();for(t=0,n=r.length;t<n;t++){o=r[t];if(o.id===i){return}}return this.selectedSetId(e)};i.prototype.createTypes=function(){return[new r({id:n.NONE,name:"Any"}),new r({id:n.DRAWER,name:"+ Cards"}),new r({id:n.BUY_SUPPLIER,name:"+1 Buy"}),new r({id:n.ACTION_SUPPLIER,name:"+2 Actions"}),new r({id:n.ACTION,name:"Action"}),new r({id:n.ATTACK,name:"Attack"}),new r({id:n.DURATION,name:"Duration"}),new r({id:n.REACTION,name:"Reaction"}),new r({id:n.RESERVE,name:"Reserve"}),new r({id:n.TRASHING,name:"Trashing"}),new r({id:n.TREASURE,name:"Treasure"}),new r({id:n.VICTORY,name:"Victory"})]};i.prototype.createCosts=function(){return[new r({id:t.TREASURE_2,name:"1-2"}),new r({id:t.TREASURE_3,name:"3"}),new r({id:t.TREASURE_4,name:"4"}),new r({id:t.TREASURE_5,name:"5"}),new r({id:t.TREASURE_6,name:"6"}),new r({id:t.TREASURE_7,name:"7"}),new r({id:t.TREASURE_8,name:"8+"})]};return i}();window.DialogViewModel=i;return window.DialogViewModel.ALL_SETS=e})();(function(){var e;e=function(){function e(){this.useColonies=ko.observable(false);this.useShelters=ko.observable(false);this.show=ko.computed(function(e){return function(){return e.useColonies()||e.useShelters()}}(this))}e.prototype.update=function(e){this.useColonies(e.getUseColonies());return this.useShelters(e.getUseShelters())};return e}();return window.MetadataViewModel=e})();var bind=function(e,t){return function(){return e.apply(t,arguments)}},extend=function(e,t){for(var n in t){if(hasProp.call(t,n))e[n]=t[n]}function r(){this.constructor=e}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e},hasProp={}.hasOwnProperty;(function(){var e,t,n,r,i,o,a,s,u,l,c,d,f,p,h,g,v,m,y;e=window.CardType;t=window.CardViewModel;n=window.DialogViewModel;r=window.EventTracker.Error;i=window.EventTracker.Event;o=window.EventTracker;l=window.MetadataViewModel;c=window.PageViewModel;f=window.Randomizer;p=window.RandomizerOptions;d=window.Querier;g=window.Serializer;v=window.SetViewModel;m=window.Settings;y=window.SettingsManager;u=3;s=24;h="Dominion card picker for desktop and mobile";a=function(r){extend(a,r);function a(e){this.cardSorter=bind(this.cardSorter,this);this.cardPairSorter=bind(this.cardPairSorter,this);this.sortCards=bind(this.sortCards,this);this.loadCardBacks=bind(this.loadCardBacks,this);this.prioritizeSetEnabledChanged=bind(this.prioritizeSetEnabledChanged,this);this.prioritizeSetAllowedChanged=bind(this.prioritizeSetAllowedChanged,this);this.saveSettings=bind(this.saveSettings,this);this.loadOptionsFromSettings=bind(this.loadOptionsFromSettings,this);this.randomizeIndividualSelectedCard=bind(this.randomizeIndividualSelectedCard,this);this.randomizeSelectedAddons=bind(this.randomizeSelectedAddons,this);this.randomizeSelectedCards=bind(this.randomizeSelectedCards,this);this.randomize=bind(this.randomize,this);this.loadInitialKingdom=bind(this.loadInitialKingdom,this);var r;a.__super__.constructor.call(this,h,c.MenuItem.RANDOMIZER);this.dominionSets=e;this.kingdom=null;this.sets=ko.observableArray(this.createSetViewModels());this.cards=ko.observableArray(function(){var e,n;n=[];for(r=e=0;e<10;r=++e){n.push(new t(this))}return n}.call(this));this.addons=ko.observableArray(function(){var e,n;n=[];for(r=e=0;e<2;r=++e){n.push(new t(this,false))}return n}.call(this));this.distributeCostAllowed=this.createDistributeCostAllowedObservable();this.prioritizeSetEnabled=ko.observable();this.prioritizeSetAllowed=this.createPrioritizeSetAllowedObservable();this.prioritizeSetAllowed.subscribe(this.prioritizeSetAllowedChanged);this.prioritizeSetOptions=this.createPrioritizeSetOptionsObservable();this.settings=null;this.randomizerSettings=null;this.loadOptionsFromSettings();this.isEnlarged=ko.observable(false);this.metadata=new l;this.dialog=new n(this.sets());this.hasLoaded=ko.observable(false);this.showAddons=this.createShowAddonsObservable();this.addonsHeader=this.createAddonsHeaderObservable();this.randomizeButtonText=this.createRandomizeButtonTextObservable();this.loadCardBacks();this.loadInitialKingdom()}a.prototype.loadInitialKingdom=function(){var e,t,n,r,a;n=g.deserializeKingdom(this.dominionSets,location.search);if(n){if(n.getSupply().getCards().length===10){o.trackEvent(i.LOAD_FULL_KINGDOM_FROM_URL);this.setKingdom(n);return}r=this.createRandomizerOptions().setSetIds(this.getSelectedSetIds()).setExcludeTypes(this.getExcludeTypes()).setIncludeCardIds(function(){var t,r,i,o;i=n.getSupply().getCards();o=[];for(t=0,r=i.length;t<r;t++){e=i[t];o.push(e.id)}return o}());a=f.createSupplySafe(this.dominionSets,r);if(a){o.trackEvent(i.LOAD_PARTIAL_KINGDOM_FROM_URL);t=new Kingdom(a,n.getEvents(),n.getLandmarks(),n.getProjects(),n.getMetadata());this.setKingdom(t);return}else{o.trackError(i.LOAD_PARTIAL_KINGDOM_FROM_URL)}}return this.randomize()};a.prototype.randomize=function(){var e,t;t=this.getSelectedCards();e=this.getSelectedEvents().length||this.getSelectedLandmarks().length||this.getSelectedProjects().length||this.getSelectedUndefinedAddons().length;if(!t.length&&!e){this.randomizeFullKingdom();return}if(t.length===1&&!e){this.dialog.open(this.getSelectedSets(),this.randomizeIndividualSelectedCard);return}if(t.length){this.randomizeSelectedCards()}if(e){return this.randomizeSelectedAddons()}};a.prototype.randomizeFullKingdom=function(){var e,t,n,r,a,s,u,l,c;c=this.getSelectedSetIds();if(!c.length){return}u=this.cards();for(t=0,r=u.length;t<r;t++){e=u[t];e.setToLoading()}l=this.addons();for(n=0,a=l.length;n<a;n++){e=l[n];e.setToLoading()}s=this.createRandomizerOptions().setSetIds(c).setExcludeCardIds(this.getCardsToExclude()).setExcludeTypes(this.getExcludeTypes());this.dialog.resetOptions();try{this.setKingdom(f.createKingdom(this.dominionSets,s));o.trackEvent(i.RANDOMIZE_KINGDOM)}catch(e){o.trackError(i.RANDOMIZE_KINGDOM)}return this.saveSettings()};a.prototype.randomizeSelectedCards=function(){var e,t;e=this.createRandomizerOptions().setSetIds(this.getSelectedSetIds()).setIncludeCardIds(this.extractCardIds(this.getUnselectedCards())).setExcludeCardIds(this.extractCardIds(this.getSelectedCards())).setExcludeTypes(this.getExcludeTypes());t=f.createSupplySafe(this.dominionSets,e);if(t){o.trackEvent(i.RANDOMIZE_MULTIPLE);return this.replaceSelectedCardsWithSupply(t)}else{return o.trackError(i.RANDOMIZE_MULTIPLE)}};a.prototype.randomizeSelectedAddons=function(){var e,t,n,r,a,s;a=this.getSelectedEvents().concat(this.getSelectedLandmarks(),this.getSelectedProjects());t=a.length+this.getSelectedUndefinedAddons().length;s=this.getSelectedSetIds();r=function(){var t,n,r;r=[];for(t=0,n=a.length;t<n;t++){e=a[t];r.push(e.id)}return r}();n=f.getRandomAddons(this.dominionSets,s,r,t);this.replaceSelectedAddons(n);return o.trackEvent(i.RANDOMIZE_EVENTS_AND_LANDMARKS)};a.prototype.randomizeIndividualSelectedCard=function(){var t,r,a,s,u;r=[];if(this.dialog.selectedType()&&!this.randomizerSettings.allowAttacks()){r.push(e.ATTACK)}s=[this.dialog.selectedSetId()];if(this.dialog.selectedSetId()===n.ALL_SETS){s=this.getSelectedSetIds()}a=(new p).setSetIds(s).setIncludeCardIds(this.extractCardIds(this.getUnselectedCards())).setExcludeCardIds(this.extractCardIds(this.getSelectedCards())).setExcludeTypes(r).setExcludeCosts(function(){var e,n,r,i;r=this.dialog.costs;i=[];for(e=0,n=r.length;e<n;e++){t=r[e];if(!t.active()){i.push(ko.unwrap(t.id))}}return i}.call(this));if(this.dialog.selectedType()){a.setRequireSingleCardOfType(this.dialog.selectedType())}else{a.setRequireActionProvider(this.randomizerSettings.requireActionProvider()).setRequireCardProvider(this.randomizerSettings.requireCardProvider()).setRequireBuyProvider(this.randomizerSettings.requireBuyProvider()).setRequireTrashing(this.randomizerSettings.requireTrashing()).setRequireReactionIfAttacks(this.randomizerSettings.requireReaction())}u=f.createSupplySafe(this.dominionSets,a);if(u){o.trackEvent(i.RANDOMIZE_SINGLE);return this.replaceSelectedCardsWithSupply(u)}else{return o.trackError(i.RANDOMIZE_SINGLE)}};a.prototype.replaceSelectedCardsWithSupply=function(e){var n,r,i,o,a,s,u,l,c,d,f,p,h,g,v;h=this.getSelectedCards();c=this.extractCardIds(this.getUnselectedCards());for(o=0,s=h.length;o<s;o++){n=h[o];n.setToLoading()}this.kingdom=new Kingdom(e,this.kingdom.getEvents(),this.kingdom.getLandmarks(),this.kingdom.getProjects(),this.kingdom.getMetadata());this.updateUrlForKingdom(this.kingdom);v=this.sets();i=h.length;f=function(e){return function(){if(--i<=0){return setTimeout(function(){return e.sortCards()},t.ANIMATION_TIME)}}}(this);g=function(e){return function(e,t){e.setData(t,v);if(e.cardImageLoaded()){return f()}else{return function(){var t;return t=e.cardImageLoaded.subscribe(function(e){if(!e){return}t.dispose();return f()})}()}}}(this);l=0;d=this.kingdom.getSupply().getCards();p=[];for(a=0,u=d.length;a<u;a++){r=d[a];if(c.indexOf(r.id)===-1&&l<h.length){p.push(g(h[l++],r))}else{p.push(void 0)}}return p};a.prototype.replaceSelectedAddons=function(e){var t,n,r,i,o,a,s,u,l,c,d,f,p,h,g;d=this.getSelectedEvents();f=this.getSelectedLandmarks();p=this.getSelectedProjects();h=this.getSelectedUndefinedAddons();c=d.concat(f,p,h);for(r=0,o=c.length;r<o;r++){t=c[r];t.setToLoading()}u=function(){var e,n,r,i;r=this.addons();i=[];for(e=0,n=r.length;e<n;e++){t=r[e];if(!t.selected()){i.push(ko.unwrap(t.id))}}return i}.call(this);g=this.sets();s=0;l=[];for(i=0,a=e.length;i<a;i++){n=e[i];if(u.indexOf(n.id)===-1&&s<c.length){l.push(c[s++].setData(n,g))}else{l.push(void 0)}}return l};a.prototype.setKingdom=function(e){var t,n,r,i,o,a,s,u,l,c,d,f,p,h,g,v;this.kingdom=e;v=this.kingdom.getSupply().getCards().concat();v.sort(this.cardSorter);i=this.kingdom.getEvents();l=this.kingdom.getLandmarks();p=this.kingdom.getProjects();r=this.cards();g=this.sets();for(o=a=0,c=v.length;a<c;o=++a){n=v[o];r[o].setData(n,g)}h=this.addons();for(o=s=0,d=h.length;s<d;o=++s){t=h[o];if(o<i.length){t.setData(i[o],g);continue}u=o-i.length;if(u<l.length){t.setData(l[u],g);continue}f=o-i.length-l.length;if(f<p.length){t.setData(p[f],g);continue}t.setToLoading()}this.metadata.update(e.getMetadata());return this.updateUrlForKingdom(e)};a.prototype.toggleEnlarged=function(){return this.isEnlarged(!this.isEnlarged())};a.prototype.createSetViewModels=function(){var e,t,n;n=function(){var n,r;n=this.dominionSets;r=[];for(t in n){e=n[t];r.push(e)}return r}.call(this);n.sort(function(e,t){if(e.name===t.name){return 0}if(e.name<t.name){return-1}else{return 1}});return function(){var t,r,i;i=[];for(t=0,r=n.length;t<r;t++){e=n[t];i.push(new v(e))}return i}()};a.prototype.createShowAddonsObservable=function(){return ko.computed(function(e){return function(){var t,n,r,i,o,a,s,u,l,c,d,f;if(!e.hasLoaded()){return false}a=ko.unwrap(e.sets);for(n=0,i=a.length;n<i;n++){f=a[n];if(ko.unwrap(f.active)){d=e.dominionSets[ko.unwrap(f.id)];if(((s=d.events)!=null?s.length:void 0)||((u=d.landmarks)!=null?u.length:void 0)||((l=d.projects)!=null?l.length:void 0)){return true}}}c=e.addons();for(r=0,o=c.length;r<o;r++){t=c[r];if(!ko.unwrap(t.isLoading)){return true}}return false}}(this))};a.prototype.createAddonsHeaderObservable=function(){return ko.computed(function(e){return function(){var t,n,r,i,o,a,s,u,l,c,d,f,p,h,g,v,m;n=false;r=false;o=false;d=ko.unwrap(e.sets);for(s=0,l=d.length;s<l;s++){m=d[s];if(ko.unwrap(m.active)){v=e.dominionSets[ko.unwrap(m.id)];if((f=v.events)!=null?f.length:void 0){n=true}if((p=v.landmarks)!=null?p.length:void 0){r=true}if((h=v.projects)!=null?h.length:void 0){o=true}}}g=e.addons();for(u=0,c=g.length;u<c;u++){t=g[u];a=ko.unwrap(t.id);if(a&&a.indexOf("_event_")!==-1){n=true}if(a&&a.indexOf("_landmark_")!==-1){r=true}if(a&&a.indexOf("_project_")!==-1){i=true}}if(n&&r&&o){return"Events, Landmarks and Projects"}if(n&&r){return"Events and Landmarks"}if(n&&o){return"Events and Projects"}if(r&&o){return"Landmarks and Projects"}if(n){return"Events"}if(r){return"Landmarks"}if(o){return"Projects"}return""}}(this))};a.prototype.createRandomizeButtonTextObservable=function(){return ko.computed(function(e){return function(){var t,n,r,i;t=e.cards().concat(e.addons());for(r=0,i=t.length;r<i;r++){n=t[r];if(n.selected()){return"Replace!"}}return"Randomize!"}}(this))};a.prototype.createDistributeCostAllowedObservable=function(){return ko.computed(function(e){return function(){var t,n,r,i,o;o=e.getSelectedSetIds();t=0;for(n=0,r=o.length;n<r;n++){i=o[n];t+=e.dominionSets[i].cards.length}return t>=s}}(this))};a.prototype.createPrioritizeSetAllowedObservable=function(){return ko.computed(function(e){return function(){return e.getSelectedSetIds().length>=u}}(this))};a.prototype.createPrioritizeSetOptionsObservable=function(){return ko.computed(function(e){return function(){var t,n,r,i,o;r=[];i=e.sets();for(t=0,n=i.length;t<n;t++){o=i[t];if(o.active()){r.push({name:o.name,value:o.id})}}return r}}(this))};a.prototype.createRandomizerOptions=function(){return(new p).setRequireActionProvider(this.randomizerSettings.requireActionProvider()).setRequireBuyProvider(this.randomizerSettings.requireBuyProvider()).setRequireTrashing(this.randomizerSettings.requireTrashing()).setRequireReactionIfAttacks(this.randomizerSettings.requireReaction()).setDistributeCost(this.distributeCostAllowed()&&this.randomizerSettings.distributeCost()).setPrioritizeSet(this.prioritizeSetAllowed()&&this.prioritizeSetEnabled()&&this.randomizerSettings.prioritizeSet())};a.prototype.loadOptionsFromSettings=function(){var e,t,n,r,i;this.settings=y.loadSettings();this.randomizerSettings=this.settings.randomizerSettings();r=this.settings.selectedSets();n=this.sets();for(e=0,t=n.length;e<t;e++){i=n[e];i.active(r.indexOf(i.id)!==-1);i.active.subscribe(this.saveSettings)}this.prioritizeSetEnabled(!!this.randomizerSettings.prioritizeSet());this.prioritizeSetEnabled.subscribe(this.prioritizeSetEnabledChanged);this.settings.sortOption.subscribe(this.sortCards);this.settings.sortOption.subscribe(this.saveSettings);this.randomizerSettings.requireActionProvider.subscribe(this.saveSettings);this.randomizerSettings.requireBuyProvider.subscribe(this.saveSettings);this.randomizerSettings.allowAttacks.subscribe(this.saveSettings);this.randomizerSettings.requireReaction.subscribe(this.saveSettings);this.randomizerSettings.requireTrashing.subscribe(this.saveSettings);this.randomizerSettings.distributeCost.subscribe(this.saveSettings);return this.randomizerSettings.prioritizeSet.subscribe(this.saveSettings)};a.prototype.saveSettings=function(){var e;e=this.getSelectedSetIds();this.settings.selectedSets(e);return y.saveSettings(this.settings)};a.prototype.prioritizeSetAllowedChanged=function(){if(!this.prioritizeSetAllowed()){return this.randomizerSettings.prioritizeSet(null)}};a.prototype.prioritizeSetEnabledChanged=function(){if(!this.prioritizeSetEnabled()){return this.randomizerSettings.prioritizeSet(null)}};a.prototype.getCardsToExclude=function(){var e;if(this.randomizerSettings.prioritizeSet()){return[]}e=this.getSelectedSetIds();if(e.length<3){return[]}return this.extractCardIds(this.cards())};a.prototype.getExcludeTypes=function(){var t;t=[];if(!this.randomizerSettings.allowAttacks()){t.push(e.ATTACK)}return t};a.prototype.extractCardIds=function(e){var t;return function(){var n,r,i;i=[];for(n=0,r=e.length;n<r;n++){t=e[n];i.push(ko.unwrap(t.id))}return i}()};a.prototype.getSelectedSetIds=function(){var e;return function(){var t,n,r,i;r=this.sets();i=[];for(t=0,n=r.length;t<n;t++){e=r[t];if(e.active()){i.push(e.id)}}return i}.call(this)};a.prototype.getSelectedSets=function(){var e;return function(){var t,n,r,i;r=this.sets();i=[];for(t=0,n=r.length;t<n;t++){e=r[t];if(e.active()){i.push(e)}}return i}.call(this)};a.prototype.getSelectedCards=function(){var e;return function(){var t,n,r,i;r=this.cards();i=[];for(t=0,n=r.length;t<n;t++){e=r[t];if(e.selected()){i.push(e)}}return i}.call(this)};a.prototype.getUnselectedCards=function(){var e;return function(){var t,n,r,i;r=this.cards();i=[];for(t=0,n=r.length;t<n;t++){e=r[t];if(!e.selected()){i.push(e)}}return i}.call(this)};a.prototype.getSelectedEvents=function(){var e,t,n,r,i,o;o=[];i=this.addons();for(n=0,r=i.length;n<r;n++){e=i[n];t=ko.unwrap(e.id);if(t&&t.indexOf("_event_")!==-1&&ko.unwrap(e.selected)){o.push(e)}}return o};a.prototype.getSelectedLandmarks=function(){var e,t,n,r,i,o;o=[];i=this.addons();for(n=0,r=i.length;n<r;n++){e=i[n];t=ko.unwrap(e.id);if(t&&t.indexOf("_landmark_")!==-1&&ko.unwrap(e.selected)){o.push(e)}}return o};a.prototype.getSelectedProjects=function(){var e,t,n,r,i,o;o=[];i=this.addons();for(n=0,r=i.length;n<r;n++){e=i[n];t=ko.unwrap(e.id);if(t&&t.indexOf("_project_")!==-1&&ko.unwrap(e.selected)){o.push(e)}}return o};a.prototype.getSelectedUndefinedAddons=function(){var e,t,n,r,i;i=[];r=this.addons();for(t=0,n=r.length;t<n;t++){e=r[t];if(ko.unwrap(e.isLoading)&&ko.unwrap(e.selected)){i.push(e)}}return i};a.prototype.updateUrlForKingdom=function(e){var t;t=new URL(location.href);t.search=g.serializeKingdom(e);return history.replaceState({},"",t.href)};a.prototype.loadCardBacks=function(){var e,n,r;r=Date.now();n=2;e=function(e){return function(){var t;if(--n!==0){return}if((t=500-(Date.now()-r))>0){return setTimeout(function(){return e.hasLoaded(true)},t)}else{return e.hasLoaded(true)}}}(this);$.imgpreload(t.VERTICAL_LOADING_IMAGE_URL,e);return $.imgpreload(t.HORIZONTAL_LOADING_IMAGE_URL,e)};a.prototype.sortCards=function(){var e,t,n,r,i,o,a,s,u,l,c,d,f,p,h,g,v,m,y,b,w;s=this.isEnlarged()&&this.isCondensed();e=$("body");i=this.cards();t=$("#cards").find(".card-wrap .card-front");w=[];for(a=u=0,d=i.length;u<d;a=++u){n=i[a];w.push({card:n,element:$(t[a])})}w.sort(this.cardPairSorter);v=[];for(b=l=0,f=w.length;l<f;b=++l){y=w[b];for(r=c=0,p=i.length;c<p;r=++c){n=i[r];if(n===y.card&&b!==r){y.movedFrom=y.element.offset();y.movedTo=$(t[b]).offset();v.push(y)}}}o=function(t){var n,r,i,o,a,u;t.clone=t.element.clone(false);a=t.movedTo.left-t.movedFrom.left;u=t.movedTo.top-t.movedFrom.top;o=function(e,t,n){e["-webkit-"+t]=n;e["-moz-"+t]=n;e[t]=n;return e};r={position:"absolute",height:t.element.height(),width:t.element.width(),top:t.movedFrom.top,left:t.movedFrom.left,"transition-property":"-webkit-transform, -webkit-filter, opacity","transition-property":"-moz-transform, -moz-filter, opacity"};o(r,"transition-timing-function","ease-in-out");o(r,"transition-duration","600ms");o(r,"transition-delay",0);o(r,"filter","none");o(r,"transition","transform 600ms ease-in-out");o(r,"transform","translate(0px,0px)");if(s){t.clone.addClass("enlarge-cards")}t.clone.appendTo(e).css(r);i=$([t.element.get(0),t.element.siblings(".card-back").get(0)]);i.css("visibility","hidden");n=function(){i.css("visibility","visible");return t.clone.remove()};t.clone.bind("webkitTransitionEnd transitionend otransitionend oTransitionEnd",n);setTimeout(n,610);return setTimeout(function(){return t.clone.css(o({},"transform","translate("+a+"px,"+u+"px)"))},0)};for(g=0,h=v.length;g<h;g++){m=v[g];o(m)}return this.cards.sort(this.cardSorter)};a.prototype.cardPairSorter=function(e,t){return this.cardSorter(e.card,t.card)};a.prototype.cardSorter=function(e,t){var n;if(this.settings.sortOption()===m.SortOption.SET){if(ko.unwrap(e.setId)<ko.unwrap(t.setId)){return-1}if(ko.unwrap(e.setId)>ko.unwrap(t.setId)){return 1}}else if(this.settings.sortOption()===m.SortOption.COST){n=this.compareCosts(ko.unwrap(e.id),ko.unwrap(t.id));if(n!==0){return n}}if(ko.unwrap(e.name)<ko.unwrap(t.name)){return-1}if(ko.unwrap(e.name)>ko.unwrap(t.name)){return 1}return 0};a.prototype.compareCosts=function(e,t){var n,r;n=this.getCostSum(d.getCardById(e));r=this.getCostSum(d.getCardById(t));if(n<r){return-1}if(n>r){return 1}};a.prototype.getCostSum=function(e){return(e.cost.treasure||0)+(e.cost.potion||0)*.9+(e.cost.debt||0)};return a}(c);return window.IndexViewModel=a})();window.Setup.initialize(new window.IndexViewModel(window.DominionSets));